import { Box, Text } from 'ink'; import React from 'react'; import { SidePanel } from './Panels'; import { accent, glyph } from './theme'; export type HeaderFact = { label: string; value: string; /** Defaults to the quiet metadata colour; set for anything the user must not miss. */ tone?: 'warn' | 'err' | 'ok' | 'info'; }; const TONE_COLOR: Record, string> = { warn: accent.warn, err: accent.err, ok: accent.ok, info: accent.info, }; /** * The welcome dashboard, shown once before the first turn, in OpenCode's grammar. * * The session is introduced by a banner (what this conversation is), then the * environment is grouped into a labelled panel so the eye scans one label rather * than a wall of text. A final meta bar carries cwd and version, the two facts a * bug report needs. Facts that demand attention — a missing provider, a failed * plugin, `--yolo` — are lifted out of the quiet layer with colour, because a * warning rendered dim is a warning nobody reads. */ export function Header({ version, provider, model, sessionId, cwd, title, facts, }: { version: string; provider?: string; model?: string; sessionId: string; cwd: string; title?: string; facts: readonly HeaderFact[]; }) { return ( {model ? ( <> {`${glyph.ok} `} {provider ? `${provider}/` : ''} {model} {` ${glyph.sep} session ${sessionId}`} ) : ( <> {`${glyph.warn} `} no provider configured {` ${glyph.sep} run /provider to begin`} )} {facts.length > 0 && ( {facts.map((f, i) => ( {f.label.padEnd(14)} {f.value} ))} )} {cwd} {` ${glyph.sep} `} {`shiro-neko ${version}`} {` ${glyph.sep} `} /help for commands ); }