import { Box, Text, Newline } from 'ink' import * as React from 'react' import { getTheme } from '../utils/theme' import { PRODUCT_NAME } from '../constants/product' import { getAnthropicApiKey, getGlobalConfig } from '../utils/config' import { getCwd } from '../utils/state' import { AsciiLogo } from './AsciiLogo' import type { WrappedClient } from '../services/mcpClient' import { getModelManager } from '../utils/model' import { MACRO } from '../constants/macros' export const MIN_LOGO_WIDTH = 50 const DEFAULT_UPDATE_COMMANDS = [ 'bun add -g @shareai-lab/kode@latest', 'npm install -g @shareai-lab/kode@latest', ] as const export function Logo({ mcpClients, isDefaultModel = false, updateBannerVersion, updateBannerCommands, }: { mcpClients: WrappedClient[] isDefaultModel?: boolean updateBannerVersion?: string | null updateBannerCommands?: string[] | null }): React.ReactNode { const width = Math.max(MIN_LOGO_WIDTH, getCwd().length + 12) const theme = getTheme() const config = getGlobalConfig() const modelManager = getModelManager() const mainModelName = modelManager.getModelName('main') const currentModel = mainModelName || 'No model configured' const apiKey = getAnthropicApiKey() const hasOverrides = Boolean( process.env.ANTHROPIC_API_KEY || process.env.DISABLE_PROMPT_CACHING || process.env.API_TIMEOUT_MS || process.env.MAX_THINKING_TOKENS, ) return ( {updateBannerVersion ? ( New version available: {updateBannerVersion} (current: {MACRO.VERSION}) Run the following command to update: {' '} {updateBannerCommands?.[1] ?? DEFAULT_UPDATE_COMMANDS[1]} {process.platform !== 'win32' && ( Note: you may need to prefix with "sudo" on macOS/Linux. )} ) : null} Welcome to{' '} {PRODUCT_NAME} research preview! {/* */} <> /help for help cwd: {getCwd()} {hasOverrides && ( Overrides (via env): {process.env.ANTHROPIC_API_KEY && apiKey ? ( • API Key:{' '} sk-ant-…{apiKey!.slice(-width + 25)} ) : null} {process.env.DISABLE_PROMPT_CACHING ? ( • Prompt caching:{' '} off ) : null} {process.env.API_TIMEOUT_MS ? ( • API timeout:{' '} {process.env.API_TIMEOUT_MS}ms ) : null} {process.env.MAX_THINKING_TOKENS ? ( • Max thinking tokens:{' '} {process.env.MAX_THINKING_TOKENS} ) : null} {process.env.ANTHROPIC_BASE_URL ? ( • API Base URL:{' '} {process.env.ANTHROPIC_BASE_URL} ) : null} )} {mcpClients.length ? ( MCP Servers: {mcpClients.map((client, idx) => ( • {client.name} {client.type === 'connected' ? 'connected' : 'failed'} ))} ) : null} ) }