UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

45 lines • 2.13 kB
import { type After, type HandleExit, type LiveHandle, type MachineLifecycle } from "./live-handle.ts"; export type WaitUntil = Readonly<{ states?: readonly MachineLifecycle[]; output?: string; idle?: true; }>; export type WaitAsk = Readonly<{ yieldMs: number; lastSeq?: number; until?: WaitUntil; }>; export type WaitReason = "exited" | "state" | "output" | "matched" | "idle" | "timeout"; /** The relay host's replay_gap message (it names the offset replay resumes at), when `lastSeq` precedes the retained output. */ export declare const replayGap: (h: LiveHandle, lastSeq: number | undefined) => string | undefined; export declare const waitForHandle: (h: LiveHandle, ask: WaitAsk, signal: AbortSignal, after: After) => Promise<WaitReason>; type Lifecycle = Readonly<{ state: "starting" | "running" | "waiting_input"; stdinOpen: true; outputClosed: false; }> | Readonly<{ state: "exited"; exitCode: number; stdinOpen: false; outputClosed: true; }> | Readonly<{ state: "killed"; stdinOpen: false; outputClosed: true; }> | Readonly<{ state: "lost"; reason: "agent_restarted" | "exit_status_unavailable"; stdinOpen: false; outputClosed: true; }>; export declare const lifecycleOf: (state: MachineLifecycle, exit: HandleExit | null, lostReason?: "agent_restarted" | "exit_status_unavailable") => Lifecycle; /** * The relay host's TerminalResult for a live handle, carrying at most RESULT_OUTPUT_MAX bytes of output. * - "oldest" (a wait with a cursor, exec, write_stdin): the output from `fromSeq`, paging forward. * - "newest" (a wait without a cursor, #1217): the last RESULT_OUTPUT_MAX bytes, so `lastSeq` reaches totalBytes. The * page starts on a UTF-8 character boundary, stepping past at most 3 continuation bytes, so output that is not UTF-8 * still yields its newest bytes. */ export declare const terminalResult: (h: LiveHandle, fromSeq: number, nowMs: number, extra?: Readonly<Record<string, unknown>>, window?: "oldest" | "newest") => Readonly<Record<string, unknown>>; export {}; //# sourceMappingURL=terminal-wait.d.ts.map