eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
102 lines (101 loc) • 4.98 kB
TypeScript
import type { AgentTUIInputQuestion, AgentTUIInputQuestionResponse, AgentTUIRenderer, AgentTUISessionOptions, AgentTUIStreamResult, AgentTUIToolApprovalRequest, AgentTUIToolApprovalResponse, ConnectionAuthUpdate, SubagentStepUpdate, SubagentToolUpdate } from "./runner.js";
import type { SetupFlowRenderer } from "./setup-flow.js";
import type { AssistantResponseStatsMode, LogDisplayMode, TerminalPartDisplayMode } from "./types.js";
import type { AgentInfoResult } from "#client/index.js";
import type { VercelStatusSnapshot } from "./vercel-status.js";
export type TerminalInput = {
isTTY?: boolean;
on(event: "data", listener: (chunk: Buffer) => void): TerminalInput;
off(event: "data", listener: (chunk: Buffer) => void): TerminalInput;
resume(): TerminalInput;
pause(): TerminalInput;
setRawMode?: (mode: boolean) => TerminalInput;
};
export type TerminalOutput = {
isTTY?: boolean;
columns?: number;
rows?: number;
write(chunk: string | Uint8Array, encodingOrCallback?: BufferEncoding | ((error?: Error | null) => void), callback?: (error?: Error | null) => void): boolean;
on(event: "resize", listener: () => void): TerminalOutput;
off(event: "resize", listener: () => void): TerminalOutput;
};
export type TerminalRendererOptions = {
input?: TerminalInput;
output?: TerminalOutput;
tools?: TerminalPartDisplayMode;
reasoning?: TerminalPartDisplayMode;
subagents?: TerminalPartDisplayMode;
connectionAuth?: TerminalPartDisplayMode;
assistantResponseStats?: AssistantResponseStatsMode;
contextSize?: number;
captureForeignOutput?: boolean;
logs?: LogDisplayMode;
color?: boolean;
unicode?: boolean;
};
export type AgentHeaderOptions = {
name: string;
serverUrl: string;
info?: AgentInfoResult;
/** Message-of-the-day line under the brand line (local sessions only). */
tip?: string;
};
export declare class TerminalRenderer implements AgentTUIRenderer {
#private;
readonly setupFlow: SetupFlowRenderer;
constructor(options?: TerminalRendererOptions);
/**
* Commits the startup agent header (brand mark + resolved configuration) to
* scrollback before the first prompt. Later calls (dev HMR refreshing fields
* such as the agent name) commit a fresh header beneath the existing
* transcript only when the rendered header actually changed — every source
* reload re-sends it, and an identical banner repeated per reload is noise.
* Committed scrollback is never cleared or replayed.
*/
renderAgentHeader(options: AgentHeaderOptions): void;
readPrompt(options?: AgentTUISessionOptions): Promise<string>;
renderStream(result: AgentTUIStreamResult, options?: AgentTUISessionOptions): Promise<void>;
readToolApproval(request: AgentTUIToolApprovalRequest, options?: AgentTUISessionOptions): Promise<AgentTUIToolApprovalResponse>;
readInputQuestion(question: AgentTUIInputQuestion, options?: AgentTUISessionOptions): Promise<AgentTUIInputQuestionResponse | undefined>;
upsertSubagentStep(update: SubagentStepUpdate): void;
upsertSubagentTool(update: SubagentToolUpdate): void;
markChildToolCallId(callId: string): void;
upsertConnectionAuth(update: ConnectionAuthUpdate): void;
setConnectionAuthPendingCount(count: number): void;
setVercelStatus(status: VercelStatusSnapshot): void;
reset(): void;
/**
* Commits a single dim informational line to the transcript (e.g. the
* session-recovery notice after a terminal server failure). No-op when the
* text is blank.
*/
renderNotice(text: string): void;
renderSandboxLog(text: string): void;
/**
* Sets the setup attention line (yellow `⚠`, commands blue) as a live footer
* element above the prompt. Unlike committed scrollback, it can be cleared:
* once the underlying issue is fixed (e.g. `/login` succeeds) the runner calls
* {@link clearSetupWarning} and the line disappears rather than lingering
* stale in the transcript.
*/
renderSetupWarning(text: string): void;
/** Removes the setup attention line once its issue is resolved. */
clearSetupWarning(): void;
/**
* Commits one command's outcome under its invocation with the elbow
* connector (` ⎿ /model cancelled.`), Claude Code's sub-result grammar.
*/
renderCommandResult(text: string): void;
shutdown(): void;
/** The log sources the transcript currently renders. */
logDisplayMode(): LogDisplayMode;
/**
* Switches which captured log sources the transcript shows. Captured
* output is buffered in the block history regardless of mode, so the
* committed transcript is re-rendered under the new filter and replayed:
* hiding removes past log lines, showing restores them at their original
* positions.
*/
setLogDisplayMode(mode: LogDisplayMode): void;
flushDelayedDevBuildErrors(): void;
}