/** * Adapter — Phase 5 of the Ink migration. Bridges the Ink App tree to * the rest of the codebase that imports PromptController. * * Goal: zero changes to interactiveShell.ts. When EROSOLAR_INK=1, the * factory returns an Ink-backed instance that satisfies the same * surface; otherwise it returns the existing PromptController. This is * the migration's safety valve — production keeps the old path until * we've grown enough Ink coverage to flip the default. * * The adapter is intentionally narrow today: it covers prompt input * + status + history + suggestions. Methods on PromptController that * we haven't ported yet (pinned prompt, secret-mode panels, the chrome * banner, etc.) are no-ops or fall through to a tiny event emitter so * existing callers don't crash. Each phase of the migration replaces * one of those no-ops with a real Ink-backed implementation. */ import { EventEmitter } from 'node:events'; import type { ChatItem } from './ChatStatic.js'; export interface InkPromptAdapterCallbacks { onSubmit: (text: string) => void; onCancel?: () => void; onCtrlC?: (info: { hadBuffer: boolean; }) => void; } export interface InkPromptAdapter extends EventEmitter { start(): void; stop(): void; setStatusMessage(message: string | null): void; setModeMessage(message: string | null): void; appendHistory(item: ChatItem): void; setSuggestions(suggestions: { label: string; hint?: string; }[]): void; /** Drive the prompt's initial buffer (e.g. resuming an interrupted line). */ setBuffer(text: string): void; /** True when EROSOLAR_INK=1 was honoured at construction time. */ readonly enabled: boolean; } /** * Returns true when the harness should mount the Ink-backed adapter. * Three signals — explicit env opt-in, never in plain mode, never under * a non-TTY pipe (Ink would refuse raw mode and crash). */ export declare function shouldUseInkAdapter(opts: { plainMode: boolean; isTty: boolean; }): boolean; /** * Construct a live adapter. The implementation lazy-imports the React + * Ink bundle so requiring this module from a non-Ink path doesn't pay * the parse cost — the production CLI only loads Ink when actually * mounting it. */ export declare function createInkPromptAdapter(callbacks: InkPromptAdapterCallbacks): Promise; //# sourceMappingURL=adapter.d.ts.map