@agentscope/studio
Version:
AgentScope Studio is a powerful local monitoring and visualization tool designed to provide real-time insights into your system's performance and behavior.
75 lines (71 loc) • 3.18 kB
JavaScript
;
/**
* Display a startup banner for AgentScope Studio
* Inspired by Phoenix's banner style
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.displayBanner = displayBanner;
const chalk_1 = __importDefault(require("chalk"));
const figlet_1 = __importDefault(require("figlet"));
function displayBanner(appName, version, port, otelGrpcPort, databasePath, mode) {
// Create welcome message with border
const welcomeMessage = `* Welcome to ${chalk_1.default.bold('AgentScope-Studio')} v${version}! *`;
// Strip ANSI codes to calculate the actual display length
const displayLength =
// eslint-disable-next-line no-control-regex
welcomeMessage.replace(/\u001b\[[0-9;]*m/g, '').length;
const borderLength = displayLength + 4;
const topBorder = '┌' + '─'.repeat(borderLength - 2) + '┐';
const bottomBorder = '└' + '─'.repeat(borderLength - 2) + '┘';
const welcomeBanner = `${topBorder}\n│ ${welcomeMessage} │\n${bottomBorder}`;
// Generate ASCII art using figlet
let asciiText;
try {
asciiText = figlet_1.default.textSync(appName, {
font: 'ANSI Shadow',
horizontalLayout: 'default',
verticalLayout: 'default',
});
}
catch (_a) {
asciiText = appName;
}
if (!asciiText || asciiText.trim().length === 0) {
asciiText = appName;
}
// Wrap ASCII art in a border
const lines = asciiText
.split('\n')
.filter((line) => line.trim().length > 0);
if (lines.length === 0) {
lines.push(appName);
}
const appNameBanner = [...lines].join('\n');
// Community and documentation links with colors
const modeColor = mode === 'production' ? chalk_1.default.green : chalk_1.default.yellow;
const links = `
${chalk_1.default.cyan('🌍 Join our Community 🌍')}
${chalk_1.default.blue('https://github.com/agentscope-ai')}
${chalk_1.default.yellow('⭐ Leave us a Star ⭐')}
${chalk_1.default.blue('https://github.com/agentscope-ai/agentscope-studio')}
${chalk_1.default.magenta('📚 Documentation 📚')}
${chalk_1.default.blue('https://github.com/agentscope-ai/agentscope-studio')}
${chalk_1.default.green('🚀 AgentScope Studio Server 🚀')}
${chalk_1.default.bold('Studio UI:')} ${chalk_1.default.cyan(`http://localhost:${port}`)}
${chalk_1.default.bold('Traces Endpoint:')}
${chalk_1.default.bold(' - HTTP:')} ${chalk_1.default.cyan(`http://localhost:${port}/v1/traces`)}
${chalk_1.default.bold(' - gRPC:')} ${chalk_1.default.cyan(`http://localhost:${otelGrpcPort}`)}
${chalk_1.default.bold('Mode:')} ${modeColor(mode)}
${chalk_1.default.bold('Storage:')} ${chalk_1.default.gray(databasePath)}
`;
// Display banner with a separator line
console.log('');
console.log(chalk_1.default.cyan(welcomeBanner));
console.log('');
console.log(chalk_1.default.cyan(appNameBanner));
console.log(links);
console.log('');
}