@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
56 lines • 2.98 kB
TypeScript
/**
* Drives one start attempt from its controller to READY or a terminal failure (senpi#4602, A-amended):
* the producer milestones advance the phases on their own; this module completes the two phases the launcher
* owns - the presenter result and the public `get_protocol_info` verification - each inside its phase's
* remaining time, and turns a child exit or an incompatible answer into an explicit, latched failure.
*/
import type { ChildProcess } from "node:child_process";
import type { HostAttachHold } from "./host-attach-hold.ts";
import type { HostProtocolInfo } from "./host-decision.ts";
import { type ChildExit } from "./host-readiness.ts";
import { type StartupClock, type StartupController, type StartupOutcome } from "./host-startup-policy.ts";
import { type StartupBinding } from "./host-startup-wire.ts";
/** The launcher's monotonic clock: never the wall clock, never another process's timestamps. */
export declare function monotonicStartupClock(): StartupClock;
export interface StartupAttempt {
readonly controller: StartupController;
readonly binding: StartupBinding;
readonly coordinated: boolean;
/** The supervisor's hand-off variable, for a coordinated launch; read it after `stdio()`, which decides the fillers. */
readonly env: Readonly<Record<string, string>>;
/** `base` with the startup pipe and its fillers, for a coordinated launch; `base` unchanged otherwise. */
stdio<T>(base: readonly T[]): (T | "pipe")[];
attach(child: ChildProcess, childExit: Promise<ChildExit>): void;
}
/** Created immediately BEFORE the spawn: the controller's creation instant is the attempt's origin. */
export declare function beginStartupAttempt(options: {
readonly socket: string;
readonly instanceId: string;
readonly generation: number;
/** The supervisor command is the engine's own, known to report progress; anything else is legacy. */
readonly coordinated: boolean;
readonly decisionBudgetMs?: number;
readonly clock?: StartupClock;
/** The attempt nonce, allocated before the startup intent that names it is written. */
readonly attempt: string;
/** A successor generation: its own phase path (presenter before publication) and the instance it replaces. */
readonly successorOf?: string | null;
}): StartupAttempt;
export declare function exitMessage(exit: ChildExit): string;
export type StartupResult = {
readonly ready: true;
readonly hold: HostAttachHold;
} | {
readonly ready: false;
readonly outcome: Exclude<StartupOutcome, {
readonly kind: "ready";
}>;
};
export declare function driveStartupToReady(options: {
readonly attempt: StartupAttempt;
readonly socket: string;
readonly childExit: Promise<ChildExit>;
readonly presenterEnrollment: Promise<unknown> | undefined;
readonly isCompatible: (protocol: HostProtocolInfo | undefined) => boolean;
}): Promise<StartupResult>;
//# sourceMappingURL=host-startup-run.d.ts.map