@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
73 lines • 3.45 kB
TypeScript
/** G: spawn to ready-or-failed decision. */
export declare const STARTUP_DECISION_BUDGET_MS = 180000;
export type StartupPhase = "supervisor_bootstrap" | "supervisor_setup" | "host_bootstrap" | "host_runtime" | "opaque_host" | "internal_ready" | "observer_ready" | "public_published" | "presenter_resolved" | "public_verified";
export declare const STARTUP_PHASE_ALLOWANCE_MS: Readonly<Record<StartupPhase, number>>;
/**
* `legacy`: a supervisor command that is not known to report progress. It gets one public-ready phase of the
* whole decision budget from spawn, with no renewals, and keeps every inner limit of its own.
*/
export type StartupLaunchKind = "initial" | "successor" | "legacy";
export interface StartupClock {
now(): number;
scheduleAt(at: number, fire: () => void): unknown;
cancel(handle: unknown): void;
}
export type StartupTimeout = {
readonly kind: "timeout";
readonly phase: StartupPhase;
readonly limit: "phase" | "overall";
readonly phaseBudgetMs: number;
readonly elapsedMs: number;
};
export type StartupOutcome = {
readonly kind: "ready";
readonly elapsedMs: number;
} | StartupTimeout | {
readonly kind: "failed";
readonly phase: StartupPhase;
readonly cause: Error;
readonly elapsedMs: number;
};
export interface StartupController {
/** `ignored`: a replay of a completed phase; `rejected`: terminal, expired, or not the current phase. */
complete(phase: StartupPhase): "accepted" | "ignored" | "rejected";
/**
* The supervisor declares, before it spawns its host child, that the child cannot report progress. Only
* an initial launch in supervisor_setup may switch; the opaque phase then replaces the child's phases.
*/
declareOpaqueHost(): "accepted" | "rejected";
fail(cause: Error): void;
readonly terminal: StartupOutcome | undefined;
readonly phase: StartupPhase;
/** Milliseconds left before the current phase's deadline; 0 once terminal. */
remainingMs(): number;
/** Resolves true once `phase` is the current phase, false once the attempt is terminal first. */
whenPhase(phase: StartupPhase): Promise<boolean>;
/** Resolves with the terminal outcome. */
settled(): Promise<StartupOutcome>;
}
/** Create the controller immediately BEFORE spawning: its creation instant is the spawn origin. */
export declare function startStartupController(options: {
readonly launchKind: StartupLaunchKind;
readonly clock: StartupClock;
/** G for this attempt; only tests lower it. */
readonly decisionBudgetMs?: number;
}): StartupController;
/**
* The numerical envelope every startup-adjacent wait derives from, for one resolved child-stall
* setting (`SENPI_RPC_CHILD_STALLED_STOP_MAX_MS`, default 60 s).
*/
export declare function startupEnvelope(stallMs?: number): {
readonly decision: 180000;
readonly stop: number;
readonly cleanup: number;
readonly settled: number;
readonly discovery: 90000;
readonly holder: number;
readonly lockWait: number;
readonly handoverReply: number;
};
/** The ensure lock was not acquired within W: no startup was attempted by this caller, and nothing was signalled. */
export declare function ensureLockWaitDetail(lockWaitMs: number): string;
export declare function startupTimeoutDetail(outcome: StartupTimeout, cleanup: "completed" | "incomplete"): string;
//# sourceMappingURL=host-startup-policy.d.ts.map