/** * The conversation phase of a TUI run, without anything that decides what the * conversation is about. * * Ink is mounted for the conversation and unmounted around every selector, so * the selectors keep the bare terminal they were written for. What survives a * hand-off — the session, the recall history, the transcript already in the * scrollback — is held here; each caller supplies the session, the selector for * a finished summary, and what to do with the decision. */ import type { PostSummaryAction } from '../interactive/interactive-summary.js'; import type { InteractiveModeResult } from '../interactive/interactive.js'; import { type TranscriptEntry } from './TranscriptEntryView.js'; import type { InteractiveResultSource, TuiConversation, TuiHandoffId } from './tuiConversation.js'; export interface TuiConversationRunOptions { readonly cwd: string; readonly lang: 'en' | 'ja'; readonly conversation: TuiConversation; /** Written into the transcript of the first mount only. */ readonly initialEntries: readonly TranscriptEntry[]; /** `summarize` turns the first input straight into an instruction. */ readonly submitMode: 'chat' | 'summarize'; readonly autoSubmit: boolean; /** * Provider and model of this session, formatted for the status row. Read per * mount, because a hand-off (exec's `/setup`) can replace the session. */ readonly modelLabel: () => string; /** * Runs the post-summary selector on the bare terminal. The task it answers * with is what the run returns: a mode may normalize the draft (Retry and * Instruct append the attachment list) before showing it for confirmation. * `origin` is the command path the task came from, which decides which of the * mode's selectors runs. */ readonly chooseAction: (task: string, origin?: InteractiveResultSource) => Promise<{ action: PostSummaryAction; task: string; } | null>; /** Printed when the selector says to keep editing. */ readonly continuePrompt: string; /** * Carries out the decision with Ink unmounted and returns the line to greet * the session with. Left out by a caller that wants the decision handed back * instead — the run then ends there. */ readonly dispatch?: (result: InteractiveModeResult) => Promise; /** Shown while dispatch runs; all input received by this view is discarded. */ readonly dispatchPlaceholder?: string; /** * Runs what a `handoff` command asked for, with Ink unmounted, together with * whatever was typed alongside the command. It answers with the line to greet * the session with, or with the result that ends the run. */ readonly onHandoff?: (id: TuiHandoffId, text: string) => Promise; /** Reads a live workflow status while this view remains mounted. */ readonly liveStatusReader?: () => string; readonly liveStatusRefreshIntervalMs?: number; } export type TuiHandoffOutcome = /** The conversation continues; the line is written into the transcript. */ { readonly kind: 'continue'; readonly notice?: string; } /** The run is over and this is what the caller asked for. */ | { readonly kind: 'finished'; readonly result: InteractiveModeResult; }; export declare function runTuiConversation(options: TuiConversationRunOptions): Promise; //# sourceMappingURL=conversationRunner.d.ts.map