import type { ConversationState } from "#client/conversation-state.js"; import type { EveAgentStoreSnapshot } from "#client/eve-agent-store.js"; import type { EveAgentReducer } from "#client/reducer.js"; import { type FailureStreamEvent } from "./errors.js"; export interface TokenUsage { readonly inputTokens: number; readonly outputTokens: number; } /** Terminal presentation facts that the canonical conversation does not model. */ export interface TuiSessionData { /** Step usage summed across the session; the renderer subtracts a turn baseline. */ readonly usage: TokenUsage; /** The latest step's report, whose input restates the context size. */ readonly lastStepUsage?: { readonly inputTokens?: number; readonly outputTokens?: number; }; /** The model the latest turn resolved; cleared when another turn starts. */ readonly modelId?: string; readonly modelTurnId?: string; /** One entry per failure cascade (`step.failed` → `turn.failed` → `session.failed`). */ readonly failures: readonly FailureStreamEvent[]; readonly sessionFailed: boolean; /** Failure keys seen since the last `turn.started`, for cascade deduplication. */ readonly turnFailureKeys: readonly string[]; /** Tools' authored `label` copy by call, which the canonical conversation drops. */ readonly toolLabels: Readonly>; /** Calls the session refused for the model to retry; people only see the retry. */ readonly withdrawnCallIds: readonly string[]; } export interface ToolLabels { readonly start?: string; readonly complete?: string; } export declare const tuiSessionReducer: EveAgentReducer; /** One rendered failure cascade. */ export interface AgentTUIFailure { readonly message: string; readonly hint?: string; /** Diagnostic dump for unrecognized failures. */ readonly detail?: string; } /** Everything the renderer draws for the session, derived from one store snapshot. */ export interface AgentTUIConversationView { readonly conversation: ConversationState; /** A turn is being submitted or is running, including server-initiated turns. */ readonly working: boolean; readonly data: TuiSessionData; readonly failures: readonly AgentTUIFailure[]; } export declare function conversationView(snapshot: EveAgentStoreSnapshot, /** Replaces a failure's harness hint with a surface-local fix. */ failureHint?: (event: FailureStreamEvent) => string | undefined): AgentTUIConversationView; export declare function isWorking(status: EveAgentStoreSnapshot["status"]): boolean;