@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
38 lines • 2.07 kB
TypeScript
import type { ImageContent } from "@earendil-works/pi-ai";
import type { CustomMessage } from "./messages.ts";
type Message = Pick<CustomMessage, "customType" | "content" | "display" | "details">;
export interface RunResumePorts {
readonly resumeCause?: "stop" | "interrupted";
readonly heldInputs: () => readonly {
readonly inputId: string;
readonly text: string;
readonly images?: readonly ImageContent[];
}[];
/** Held manual-continue inputs: the turn continues the work itself, so it consumes them without carrying them. */
readonly continueInputs: () => readonly string[];
readonly heldWakes: () => readonly {
readonly source: string;
readonly message: Message;
}[];
readonly send: (message: Message) => Promise<void>;
/** The next turn's id once it starts, or undefined once `until` settles first; it stops listening either way. */
readonly turnStarted: (until: Promise<void>) => Promise<string | undefined>;
readonly idle: () => Promise<void>;
/** False once a Stop newer than the one this resume released has landed. */
readonly current: () => boolean;
readonly consume: (inputIds: readonly string[], sources: readonly string[]) => void;
readonly sendFailed: (error: unknown) => void;
}
/**
* The turn after a Stop or a parent's run Resume (senpi#3811), as ONE message so it is one turn: held human input
* first, then the wakes held while paused, then the directive naming the interrupted turn. Answers once that turn
* started, or once the send settled without starting one (a newer Stop during admission), so a resume never waits on
* a turn that will not come. `delivered` is the one settlement rule both resume paths share: it hands the held input
* and wakes to `consume` only if the turn started, its send succeeded, and no newer Stop aborted it.
*/
export declare function startRunResumeTurn(ports: RunResumePorts): Promise<{
turnId: string | undefined;
delivered: Promise<boolean>;
}>;
export {};
//# sourceMappingURL=run-resume-turn.d.ts.map