Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI, Telegram or More.
feat(tui): launch pad redesign — pixel ☿ mark, live readiness, type to start
Salman Qureshi95a0fbf01913
diff --git a/src/ui/App.tsx b/src/ui/App.tsxindex aa2f8d6a..e22d81d0 100644--- a/src/ui/App.tsx+++ b/src/ui/App.tsx@@ -18,33 +18,12 @@ import { loadInputHistory, saveInputHistory } from './input-history-store.js';import { buildMercuryMessageLines, buildMercuryBrandLines, buildStreamTailLines, parseChunkIndex, splitFinalMessage, splitStreamingMessage, type MercuryTranscriptLine } from './mercury-transcript.js';import { GENERIC_PHASES, PLANNING_VERBS, lastUserText, pickStatusWord } from './status-word.js';import { nextTip, rotateTip } from './tips.js';+import { LaunchPad } from './launch-pad.js';import { SLASH_COMMANDS, buildSlashSuggestions, buildSkillSuggestions, skillFillText, shouldSubmitSlash, pushHistoryLine, historyPrev, historyNext, createInputHistoryState, SuggestionList, applyEditKey, isPasteChunk, graphemeAt, nextGraphemeBoundary, expandTabs, ctrlCAction, CTRL_C_EXIT_HINT, CTRL_C_EXIT_WINDOW_MS, type EditorKey, type SkillEntry } from './input-composer.js';import { PLAYER_CONTROLS, formatNowPlaying } from '../spotify/ui.js';import type { SpotifyClient } from '../spotify/client.js';import type { SubAgentStatus } from '../types/agent.js';-const MERCURY_LOGO = [- ' __ _____________ ________ ________ __',- ' / |/ / ____/ __ \\/ ____/ / / / __ \\/ < /',- ' / /|_/ / __/ / /_/ / / / / / / /_/ /\\ / ',- ' / / / / /___/ _, _/ /___/ /_/ / _, _/ / / ',- '/_/ /_/_____/_/ |_|\\____/\\____/_/ |_| /_/ ',-];--const MERCURY_MARK = [- ' ╭─╮ ╭─╮',- ' ╭─╯ ╰─────╯ ╰─╮',- ' ╭─╯ ╰─╮',- ' │ ● ● │',- ' │ ◡ │',- ' │ │',- ' ╰─╮ ╭─╯',- ' ╰─────╮ ╭─────╯',- ' │ │',- ' ─┼───┼─',- ' │ │',-];-const BRAND = IS_LIGHT_TERMINAL? { logo: 'blue', title: 'blue', subtitle: 'gray', accent: 'magenta' }: { logo: 'cyan', title: 'cyan', subtitle: 'gray', accent: 'magenta' };@@ -104,8 +83,6 @@ export function TuiApp({ channel, onInput, onPermissionResolve, onExit, onInterrconst permIdxRef = React.useRef(0);const [menuIdx, setMenuIdx] = React.useState(0);const [spotifyIdx, setSpotifyIdx] = React.useState(6);- const [splashPhase, setSplashPhase] = React.useState<'logo' | 'skills' | 'provider' | 'ready'>('logo');- const [skillsLoaded, setSkillsLoaded] = React.useState(0);const [showStartupDetails, setShowStartupDetails] = React.useState(false);const [spotifyNow, setSpotifyNow] = React.useState('');const [spotifyStatus, setSpotifyStatus] = React.useState('');@@ -199,33 +176,8 @@ export function TuiApp({ channel, onInput, onPermissionResolve, onExit, onInterrreturn true;}, [skillSuggestions, skillSelIdx, input]);- React.useEffect(() => {- if (state.mode !== 'splash') return;- if (splashPhase === 'logo') {- const t = setTimeout(() => setSplashPhase('skills'), 80);- return () => clearTimeout(t);- }- }, [state.mode, splashPhase]);-- React.useEffect(() => {- if (state.mode !== 'splash') return;- if (splashPhase === 'skills') {- if (skillsLoaded >= state.skills.length) {- const t = setTimeout(() => setSplashPhase('provider'), 60);- return () => clearTimeout(t);- }- const t = setTimeout(() => setSkillsLoaded((i) => i + 1), 20);- return () => clearTimeout(t);- }- }, [state.mode, splashPhase, skillsLoaded, state.skills.length]);-- React.useEffect(() => {- if (state.mode !== 'splash') return;- if (splashPhase === 'provider') {- const t = setTimeout(() => setSplashPhase('ready'), 80);- return () => clearTimeout(t);- }- }, [state.mode, splashPhase]);+ // One tip per launch, picked once so it does not change on re-render.+ const launchTip = React.useMemo(() => rotateTip('chat')?.tip ?? null, []);React.useEffect(() => {if (state.mode === 'spotify' && spotifyClient) {@@ -346,15 +298,24 @@ export function TuiApp({ channel, onInput, onPermissionResolve, onExit, onInterrreturn;}- if (state.mode === 'splash') {- if (ch === 'd' || ch === 'D') {+ if (state.mode === 'splash' && !state.permissionPrompt) {+ if (key.tab) {setShowStartupDetails((v) => !v);return;}- if (!state.permissionPrompt && isEnter) {+ if (isEnter) {onInput('/chat');return;}+ // Typing anywhere starts chat with that text already in the input:+ // keystrokes on the launch pad are never dropped.+ if (ch && !key.ctrl && !key.meta && !key.escape && /[^\x00-\x1f\x7f]/.test(ch)) {+ onInput('/chat');+ const text = ch.replace(/[\r\n]+$/, '');+ setInputAndCursor(text);+ return;+ }+ return;}// ── Mercury Code full-screen mode ──@@ -781,87 +742,10 @@ export function TuiApp({ channel, onInput, onPermissionResolve, onExit, onInterr}});- if (state.mode === 'splash' && isNarrow(terminalSize.cols)) {- // Narrow (< 60 cols, e.g. Termux portrait): one column, no logo art,- // every row truncated instead of wrapped.- const w = Math.max(1, terminalSize.cols - 2);- const provider = state.provider ? `${state.provider.name} · ${state.provider.model}` : 'Detecting...';- return (- <Box flexDirection="column" flexGrow={1}>- <Box flexDirection="column" paddingX={1}>- <Text wrap="truncate-end"><Text color={BRAND.logo}>☿ </Text><Text bold color={BRAND.title}>MERCURY</Text></Text>- <Text color={BRAND.subtitle} wrap="truncate-end">Your soul-driven AI agent</Text>- <Text color="gray">{'─'.repeat(ruleWidth(terminalSize.cols, 56))}</Text>- <Text color="green" wrap="truncate-end">● Core {splashPhase === 'ready' ? 'ready' : 'booting'}</Text>- <Text color={state.provider ? 'green' : 'yellow'} wrap="truncate-end">{state.provider ? '●' : '◐'} Provider {state.provider ? 'ready' : 'loading'}</Text>- <Text color={skillsLoaded >= state.skills.length ? 'green' : 'yellow'} wrap="truncate-end">{skillsLoaded >= state.skills.length ? '●' : '◐'} Skills {skillsLoaded}/{state.skills.length}</Text>- <Text color="gray">{'─'.repeat(ruleWidth(terminalSize.cols, 56))}</Text>- <Text wrap="truncate-end">Version: <Text color="cyan">{state.version}</Text></Text>- <Text wrap="truncate-end">Provider: <Text color={BRAND.accent}>{fitText(provider, Math.max(1, w - 10))}</Text></Text>- <Text color="gray">{'─'.repeat(ruleWidth(terminalSize.cols, 56))}</Text>- <Text dimColor wrap="truncate-end">{splashPhase === 'ready' ? 'Enter: open chat · D: details' : 'Initializing Mercury...'}</Text>- {showStartupDetails && state.skills.slice(0, skillsLoaded).map((skill, i) => (- <Text key={i} dimColor wrap="truncate-end">- {skill.name}</Text>- ))}- </Box>- {state.permissionPrompt && (- <PermPromptView prompt={state.permissionPrompt} activeIdx={permIdx} />- )}- </Box>- );- }-if (state.mode === 'splash') {- // Two columns: the mark column is sized to its art (26) + gutter; the- // session column takes the rest, its rules capped at what remains.- const markColWidth = 34;- const sessionRule = '─'.repeat(ruleWidth(terminalSize.cols - markColWidth, 56));return (<Box flexDirection="column" flexGrow={1}>- <Box flexDirection="row" flexGrow={1} paddingX={1}>- <Box flexDirection="column" width={markColWidth} paddingRight={2} flexShrink={0}>- {MERCURY_MARK.map((line, i) => (- <Text key={i} color={BRAND.logo}>{line}</Text>- ))}- <Text bold color={BRAND.title}>MERCURY</Text>- <Text color={BRAND.subtitle}>Your soul-driven AI agent</Text>- <Text color="gray">{'─'.repeat(30)}</Text>- <Text color="green">● Core {splashPhase === 'ready' ? 'ready' : 'booting'}</Text>- <Text color={state.provider ? 'green' : 'yellow'}>{state.provider ? '●' : '◐'} Provider {state.provider ? 'ready' : 'loading'}</Text>- <Text color={skillsLoaded >= state.skills.length ? 'green' : 'yellow'}>{skillsLoaded >= state.skills.length ? '●' : '◐'} Skills {skillsLoaded}/{state.skills.length}</Text>- <Text color="gray">{'─'.repeat(30)}</Text>- <Text dimColor>Press Enter to open chat</Text>- <Text dimColor>Press D for startup details</Text>- </Box>- <Box flexDirection="column" flexGrow={1}>- <Text bold color="white">Session</Text>- <Text color="gray">{sessionRule}</Text>- <Text>Version: <Text color="cyan">{state.version}</Text>{isDevBuild(state.version) && <Text color="yellow"> ⚠ development build</Text>}</Text>- <Text>Provider: <Text color={BRAND.accent}>{state.provider ? `${state.provider.name} · ${state.provider.model}` : 'Detecting...'}</Text></Text>- <Text>Mode: <Text color="yellow">Startup</Text></Text>- {state.tokenInfo && (- <Text>Budget: <Text color="green">{state.tokenInfo.used.toLocaleString()}/{state.tokenInfo.budget.toLocaleString()} ({state.tokenInfo.percentage}%)</Text></Text>- )}- <Text>Web: {state.web?.enabled ? <Text color="green">Serving · http://127.0.0.1:{state.web.port}</Text> : <Text color="gray">Disabled</Text>}</Text>- <Text color="gray">{sessionRule}</Text>- <Text bold color="white">Capabilities</Text>- <Text>Skills loaded: <Text color="cyan">{skillsLoaded}</Text> / {state.skills.length}</Text>- {showStartupDetails ? (- <Box flexDirection="column" marginTop={1}>- {state.skills.slice(0, skillsLoaded).map((skill, i) => (- <Text key={i} dimColor>- {skill.name}</Text>- ))}- </Box>- ) : (- <Text dimColor>Details hidden (press D)</Text>- )}- <Text color="gray">{sessionRule}</Text>- <Text>{splashPhase === 'ready' ? 'Mercury is live.' : 'Initializing Mercury...'}</Text>- {splashPhase === 'ready' && <Text color="green">Ready. Enter to open chat.</Text>}- {!state.provider && <Text color="yellow">Waiting for provider handshake...</Text>}- {state.provider && <Text color="green">Provider connected.</Text>}- </Box>- </Box>+ <LaunchPad state={state} cols={terminalSize.cols} showDetails={showStartupDetails} tip={launchTip} />{state.permissionPrompt && (<PermPromptView prompt={state.permissionPrompt} activeIdx={permIdx} />)}diff --git a/src/ui/launch-pad.test.tsx b/src/ui/launch-pad.test.tsxnew file mode 100644index 00000000..1c4a66d9--- /dev/null+++ b/src/ui/launch-pad.test.tsx@@ -0,0 +1,166 @@+import { describe, expect, it, vi } from 'vitest';++vi.hoisted(() => {+ process.env.CI = '0';+});++import React from 'react';+import { render } from 'ink';+import { EventEmitter } from 'node:events';+import stringWidth from 'string-width';+import { TuiApp } from './App.js';+import { CLIChannel, type TuiState } from '../channels/cli.js';+import { MERCURY_MARK, MERCURY_MARK_SMALL, MERCURY_MARK_WIDTH, MERCURY_MARK_SMALL_WIDTH } from './mercury-mark.js';+import { launchPadChecks, tildify, isLaunchPadReady } from './launch-pad.js';++const ESC = String.fromCharCode(27);+const stripAnsi = (s: string) => s.replace(new RegExp(`${ESC}\\[[0-9;?]*[A-Za-z]`, 'g'), '');++class FakeStdout extends EventEmitter {+ chunks: string[] = [];+ rows = 40;+ isTTY = true;+ constructor(public columns: number) { super(); }+ write(chunk: string): boolean {+ this.chunks.push(chunk);+ return true;+ }+ get output(): string {+ return this.chunks.join('');+ }+}++class FakeStdin extends EventEmitter {+ isTTY = true;+ private queue: string[] = [];+ setEncoding(): void {}+ setRawMode(): void {}+ resume(): void {}+ pause(): void {}+ ref(): void {}+ unref(): void {}+ read(): string | null { return this.queue.shift() ?? null; }+ type(text: string): void {+ this.queue.push(text);+ this.emit('readable');+ }+}++async function waitFor(pred: () => boolean, timeoutMs = 4000): Promise<void> {+ const deadline = Date.now() + timeoutMs;+ while (Date.now() < deadline && !pred()) await new Promise((r) => setTimeout(r, 20));+ if (!pred()) throw new Error('condition not met in time');+}++// debug mode writes every frame in full (no diff-render), so the last chunk+// that contains the marker is a complete, settled frame.+function lastFrame(stdout: FakeStdout, marker: string): string[] {+ const chunk = [...stdout.chunks].reverse().find((c) => stripAnsi(c).includes(marker))!;+ return stripAnsi(chunk).split('\n').map((r) => r.replace(/\s+$/, '')).filter((r) => r.length > 0 || true);+}++function state(patch: Record<string, unknown> = {}): TuiState {+ return {+ ...new CLIChannel().getTuiStateSnapshot(),+ mode: 'splash',+ version: '1.3.1',+ provider: { name: 'anthropic', model: 'claude-opus-5-5' },+ tokenInfo: { used: 1204, budget: 200000, percentage: 1 },+ skills: [{ name: 'web-search', description: '', loaded: true }, { name: 'daily-digest', description: '', loaded: true }],+ web: { enabled: true, port: 3010 },+ ...patch,+ } as unknown as TuiState;+}++async function renderPad(s: TuiState, cols: number, onInput: (t: string) => void = () => {}) {+ const stdout = new FakeStdout(cols);+ const stdin = new FakeStdin();+ const channel = { getTuiStateSnapshot: () => s, subscribeToTuiState: () => () => {} };+ const { unmount } = render(+ <TuiApp channel={channel} onInput={onInput} onPermissionResolve={() => {}} onExit={() => {}} />,+ { stdout: stdout as any, stdin: stdin as any, exitOnCtrlC: false, patchConsole: false, debug: true },+ );+ // Wait for the full mark draw-in (13 rows × 24 ms) and a settled frame.+ await waitFor(() => stripAnsi(stdout.output).includes('Workspace'));+ await new Promise((r) => setTimeout(r, 450));+ return { stdout, stdin, unmount };+}++describe('Mercury mark', () => {+ it.each([+ ['hero', MERCURY_MARK, MERCURY_MARK_WIDTH],+ ['small', MERCURY_MARK_SMALL, MERCURY_MARK_SMALL_WIDTH],+ ] as const)('%s mark is single-width block art, within its width, and left/right symmetric', (_name, mark, width) => {+ for (const row of mark) {+ expect(row).toMatch(/^[ █▀▄]*$/);+ expect(stringWidth(row)).toBeLessThanOrEqual(width);+ const padded = row.padEnd(width, ' ');+ expect([...padded].reverse().join('')).toBe(padded);+ }+ });+});++describe('launch pad checks', () => {+ it('derive only from real state: pending until the provider handshake', () => {+ const pending = launchPadChecks(state({ provider: null }), '/tmp/work');+ expect(pending[0]).toMatchObject({ label: 'Provider', status: 'pending' });+ expect(pending[1]).toMatchObject({ label: 'Skills', status: 'done' });+ expect(launchPadChecks(state({ skills: [] }), '/w')[1]).toMatchObject({ value: 'none installed', status: 'info' });+ expect(isLaunchPadReady(state({ provider: null }))).toBe(false);+ const ready = launchPadChecks(state(), '/tmp/work');+ expect(ready.map((c) => `${c.label}=${c.status}`)).toEqual([+ 'Provider=done', 'Skills=done', 'Web=done', 'Budget=info', 'Workspace=info',+ ]);+ expect(launchPadChecks(state({ web: null, tokenInfo: null }), '/w').map((c) => c.label)).toEqual(['Provider', 'Skills', 'Web', 'Workspace']);+ });++ it('abbreviates the home directory', () => {+ expect(tildify('/Users/jane/code/app', '/Users/jane')).toBe('~/code/app');+ expect(tildify('/Users/jane', '/Users/jane')).toBe('~');+ expect(tildify('/Users/janet/x', '/Users/jane')).toBe('/Users/janet/x');+ });+});++describe('launch pad rendering', () => {+ it.each([100, 70, 50])('fits %i columns with no wrapped rows', async (cols) => {+ const { stdout, unmount } = await renderPad(state(), cols);+ const rows = lastFrame(stdout, 'Workspace');+ for (const row of rows) expect(stringWidth(row)).toBeLessThanOrEqual(cols);+ const text = rows.join('\n');+ expect(text).toContain('MERCURY');+ expect(text).toContain('anthropic · claude-opus-5-5');+ expect(text).toContain('Type to start chatting');+ // Hero mark at ≥ 80, compact at 60–79, none in narrow terminals.+ if (cols >= 80) expect(text).toContain(MERCURY_MARK[10]);+ else if (cols >= 60) expect(text).toContain(MERCURY_MARK_SMALL[1]);+ else expect(text).not.toContain('███');+ unmount();+ });++ it('shows a pending provider with a spinner and keeps the same row count', async () => {+ const a = await renderPad(state({ provider: null }), 100);+ const pendingRows = lastFrame(a.stdout, 'Workspace');+ expect(pendingRows.join('\n')).toContain('connecting…');+ expect(pendingRows.join('\n')).toContain('Starting up — you can already type');+ a.unmount();+ const b = await renderPad(state(), 100);+ expect(lastFrame(b.stdout, 'Workspace').length).toBe(pendingRows.length);+ b.unmount();+ });++ it('typing starts chat and keeps the keystroke; Enter starts chat', async () => {+ const inputs: string[] = [];+ const { stdin, stdout, unmount } = await renderPad(state(), 100, (t) => inputs.push(t));+ stdin.type('h');+ await waitFor(() => inputs.includes('/chat'));+ expect(inputs).toEqual(['/chat']);+ unmount();++ const enter: string[] = [];+ const second = await renderPad(state(), 100, (t) => enter.push(t));+ second.stdin.type('\r');+ await waitFor(() => enter.includes('/chat'));+ second.unmount();+ expect(stripAnsi(stdout.output)).toContain('Type to start chatting');+ });+});diff --git a/src/ui/launch-pad.tsx b/src/ui/launch-pad.tsxnew file mode 100644index 00000000..ffecd22f--- /dev/null+++ b/src/ui/launch-pad.tsx@@ -0,0 +1,173 @@+/**+ * The launch pad: the first screen of the Mercury TUI.+ *+ * Design rules:+ * - Every status row reflects real state (provider handshake, skills+ * discovered, web server, budget, workspace). Nothing ticks on a timer.+ * - The layout never jumps: every row is present from the first frame, and+ * pending rows show a spinner in place of the check.+ * - The mark draws in top-down over ~300 ms once, then stays still.+ * - Typing anywhere starts chat (handled by the app's input layer); Enter on+ * an empty pad does the same; Tab toggles the skills list.+ */+import React from 'react';+import { Box, Text } from 'ink';+import { homedir } from 'node:os';+import type { TuiState } from '../channels/cli.js';+import { IS_LIGHT_TERMINAL } from '../utils/terminal-theme.js';+import { isDevBuild } from '../utils/dev-build.js';+import { fitText, fitTail, isNarrow } from './layout.js';+import { useTick, spinnerFrame } from './tick-store.js';+import { MERCURY_MARK, MERCURY_MARK_SMALL, MERCURY_MARK_WIDTH, MERCURY_MARK_SMALL_WIDTH } from './mercury-mark.js';++const COLORS = IS_LIGHT_TERMINAL+ ? { mark: 'blue', title: 'blue', muted: 'gray', key: 'blue', accent: 'magenta' }+ : { mark: 'cyan', title: 'cyan', muted: 'gray', key: 'cyan', accent: 'magenta' };++/** Milliseconds between mark rows during the draw-in. */+export const MARK_REVEAL_STEP_MS = 24;++export interface LaunchPadCheck {+ label: string;+ value: string;+ /** done = ✓, pending = spinner, info = · (not a readiness gate). */+ status: 'done' | 'pending' | 'info' | 'off';+ /** Paths keep their tail when truncated (the folder name matters most). */+ keepTail?: boolean;+}++/** The status rows, derived only from real state. Exported for tests. */+export function launchPadChecks(state: TuiState, cwd: string = process.cwd()): LaunchPadCheck[] {+ const checks: LaunchPadCheck[] = [];+ checks.push(state.provider+ ? { label: 'Provider', value: `${state.provider.name} · ${state.provider.model}`, status: 'done' }+ : { label: 'Provider', value: 'connecting…', status: 'pending' });+ const skillCount = state.skills.length;+ // Skills are discovered from disk before the TUI mounts, so this is a fact,+ // not a readiness gate.+ checks.push(skillCount > 0+ ? { label: 'Skills', value: skillCount === 1 ? '1 ready' : `${skillCount} ready`, status: 'done' }+ : { label: 'Skills', value: 'none installed', status: 'info' });+ checks.push(state.web?.enabled+ ? { label: 'Web', value: `127.0.0.1:${state.web.port}`, status: 'done' }+ : { label: 'Web', value: 'off', status: 'off' });+ if (state.tokenInfo) {+ checks.push({ label: 'Budget', value: `${state.tokenInfo.used.toLocaleString()} / ${state.tokenInfo.budget.toLocaleString()} today`, status: 'info' });+ }+ checks.push({ label: 'Workspace', value: tildify(cwd), status: 'info', keepTail: true });+ return checks;+}++export function tildify(path: string, home: string = homedir()): string {+ return home && (path === home || path.startsWith(home + '/')) ? '~' + path.slice(home.length) : path;+}++export function isLaunchPadReady(state: TuiState): boolean {+ return state.provider != null;+}++/** Draw-in progress for the mark: rows revealed so far, advancing once. */+function useMarkReveal(total: number): number {+ const [shown, setShown] = React.useState(0);+ React.useEffect(() => {+ if (shown >= total) return;+ const t = setTimeout(() => setShown((n) => Math.min(total, n + 1)), MARK_REVEAL_STEP_MS);+ return () => clearTimeout(t);+ }, [shown, total]);+ return shown;+}++function CheckRow({ check, labelWidth, valueWidth, frame }: { check: LaunchPadCheck; labelWidth: number; valueWidth: number; frame: string }) {+ const glyph = check.status === 'done' ? '✓' : check.status === 'pending' ? frame : '·';+ const glyphColor = check.status === 'done' ? 'green' : check.status === 'pending' ? 'yellow' : COLORS.muted;+ return (+ <Text wrap="truncate-end">+ <Text color={glyphColor}>{glyph}</Text>+ <Text> {check.label.padEnd(labelWidth)} </Text>+ <Text color={check.status === 'off' ? COLORS.muted : undefined}>{check.keepTail ? fitTail(check.value, valueWidth) : fitText(check.value, valueWidth)}</Text>+ </Text>+ );+}++export interface LaunchPadProps {+ state: TuiState;+ cols: number;+ showDetails: boolean;+ tip?: string | null;+}++export function LaunchPad({ state, cols, showDetails, tip }: LaunchPadProps) {+ const narrow = isNarrow(cols);+ // Hero mark from 80 cols, compact from 60, none below (Termux portrait).+ const mark = narrow ? [] : cols >= 80 ? MERCURY_MARK : MERCURY_MARK_SMALL;+ const markWidth = narrow ? 0 : cols >= 80 ? MERCURY_MARK_WIDTH : MERCURY_MARK_SMALL_WIDTH;+ const revealed = useMarkReveal(mark.length);+ const ready = isLaunchPadReady(state);+ const now = useTick(!ready);+ const frame = spinnerFrame(now);++ const gutter = narrow ? 0 : 5;+ const panelWidth = Math.max(10, cols - 2 - markWidth - gutter);+ const checks = launchPadChecks(state);+ const labelWidth = Math.max(...checks.map((c) => c.label.length));+ const valueWidth = Math.max(4, panelWidth - labelWidth - 4);+ const versionLabel = `v${state.version}`;++ const panel = (+ <Box flexDirection="column" width={narrow ? undefined : panelWidth}>+ <Text wrap="truncate-end">+ {narrow && <Text color={COLORS.mark}>☿ </Text>}+ <Text bold color={COLORS.title}>MERCURY</Text>+ <Text color={COLORS.muted}> {versionLabel}</Text>+ {isDevBuild(state.version) && <Text color="yellow"> ⚠ development build</Text>}+ </Text>+ <Text color={COLORS.muted} wrap="truncate-end">Your soul-driven AI agent</Text>+ <Text> </Text>+ {checks.map((check) => (+ <CheckRow key={check.label} check={check} labelWidth={labelWidth} valueWidth={valueWidth} frame={frame} />+ ))}+ <Text> </Text>+ {ready ? (+ <Text bold wrap="truncate-end">Type to start chatting</Text>+ ) : (+ <Text color={COLORS.muted} wrap="truncate-end">Starting up — you can already type</Text>+ )}+ <Text wrap="truncate-end">+ <Text color={COLORS.key}>/code</Text><Text color={COLORS.muted}> Mercury Code here </Text>+ <Text color={COLORS.key}>Tab</Text><Text color={COLORS.muted}> {showDetails ? 'hide skills' : 'skills'}</Text>+ </Text>+ {tip ? (+ <>+ <Text> </Text>+ <Text color={COLORS.muted} wrap="truncate-end">tip: {fitText(tip, Math.max(4, panelWidth - 5))}</Text>+ </>+ ) : null}+ </Box>+ );++ return (+ <Box flexDirection="column" flexGrow={1} paddingX={1} paddingTop={narrow ? 0 : 1}>+ {narrow ? panel : (+ <Box flexDirection="row">+ <Box flexDirection="column" width={markWidth} marginRight={gutter} flexShrink={0}>+ {mark.map((line, i) => (+ // Unrevealed rows render as blank lines so the layout never jumps.+ <Text key={i} color={COLORS.mark}>{i < revealed ? line : ' '}</Text>+ ))}+ </Box>+ {panel}+ </Box>+ )}+ {showDetails && (+ <Box flexDirection="column" marginTop={1}>+ <Text color={COLORS.muted}>Skills</Text>+ {state.skills.length === 0+ ? <Text color={COLORS.muted}> none installed — /skills to browse the registry</Text>+ : state.skills.map((skill) => (+ <Text key={skill.name} color={COLORS.muted} wrap="truncate-end"> {skill.name}</Text>+ ))}+ </Box>+ )}+ </Box>+ );+}diff --git a/src/ui/mercury-mark.ts b/src/ui/mercury-mark.tsnew file mode 100644index 00000000..6745a2b2--- /dev/null+++ b/src/ui/mercury-mark.ts@@ -0,0 +1,46 @@+/**+ * The Mercury mark: the planetary symbol ☿ (crescent, ring, cross) drawn as+ * half-block pixel art. Every filled cell is a single-codepoint block+ * character (█ ▀ ▄), which terminals render exactly one cell wide, so the+ * mark is pixel-aligned everywhere — the earlier box-drawing outline had+ * corners and sides in different columns and broke apart on screen.+ *+ * Both sizes are generated from the same geometry (crescent arc above a+ * ring, a stem with a crossbar below) and are left/right symmetric around+ * their centre column. Keep them as literals: generating at runtime would+ * make the art depend on floating-point rounding.+ */++/** Hero mark: 19 cols × 13 rows. Used on the launch pad at ≥ 60 columns. */+export const MERCURY_MARK = [+ '██ ██',+ '▀██▄ ▄██▀',+ ' ▀▀███▄▄▄▄▄███▀▀',+ ' ▄▄▄▄▄▄▄▄▄',+ ' ▄▄██▀▀ ▀▀██▄▄',+ '███ ███',+ '███ ███',+ ' ▀▀██▄▄ ▄▄██▀▀',+ ' ▀▀▀███▀▀▀',+ ' ███',+ ' █████████████',+ ' ███',+ ' ███',+] as const;++/** Compact mark: 15 cols × 10 rows, for medium-width terminals. */+export const MERCURY_MARK_SMALL = [+ '██ ██',+ ' ▀██▄▄▄▄▄▄▄██▀',+ ' ▄█████▄',+ ' ▄█▀▀ ▀▀█▄',+ '███ ███',+ ' ▀█▄▄ ▄▄█▀',+ ' ▀▀███▀▀',+ ' ▄▄▄███▄▄▄',+ ' ▀▀▀███▀▀▀',+ ' ███',+] as const;++export const MERCURY_MARK_WIDTH = 19;+export const MERCURY_MARK_SMALL_WIDTH = 15;diff --git a/src/ui/narrow-terminal.test.tsx b/src/ui/narrow-terminal.test.tsxindex 9d1196b6..a2499b65 100644--- a/src/ui/narrow-terminal.test.tsx+++ b/src/ui/narrow-terminal.test.tsx@@ -108,28 +108,27 @@ describe('layout rules', () => {describe(`TUI at ${COLS} columns`, () => {it('splash collapses to one column with no logo art', async () => {- const { rows, unmount } = await renderApp(state({ mode: 'splash' }), 'Core');+ const { rows, unmount } = await renderApp(state({ mode: 'splash', web: null, skills: [] }), 'Workspace');expectFits(rows);- expect(rows.join('\n')).not.toContain('╭─╮'); // the 26-col mark is gone- expect(rows[0]).toContain('MERCURY');- expect(rows.some((r) => r.includes('Provider: deepseek · deepseek-chat'))).toBe(true);- // snapshot-ish: the whole collapsed splash, row by row- expect(rows.map((r) => r.trimStart())).toEqual([- '☿ MERCURY',+ expect(rows.join('\n')).not.toContain('███'); // the ☿ block mark needs >= 60 cols+ // snapshot-ish: the whole collapsed launch pad, row by row (tip and the+ // workspace path vary by machine, so they are checked by prefix only)+ const trimmed = rows.map((r) => r.trimStart());+ expect(trimmed.slice(0, 7)).toEqual([+ '☿ MERCURY v1.3.1','Your soul-driven AI agent',- '─'.repeat(48),- '● Core booting',- '● Provider ready',- '● Skills 0/0',- '─'.repeat(48),- 'Version: 1.3.1',- 'Provider: deepseek · deepseek-chat',- '─'.repeat(48),- 'Initializing Mercury...',+ '',+ '✓ Provider deepseek · deepseek-chat',+ '· Skills none installed',+ '· Web off',+ '· Budget ' + (1200).toLocaleString() + ' / ' + (100000).toLocaleString() + ' today',]);+ expect(trimmed[7]).toMatch(/^· Workspace /);+ expect(trimmed.slice(8, 11)).toEqual(['', 'Type to start chatting', '/code Mercury Code here Tab skills']);unmount();});+it('chat: input chrome is exactly four rows and the sidebar collapses', async () => {const { rows, unmount } = await renderApp(state({mode: 'chat',