@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
44 lines • 2.48 kB
TypeScript
import type { DescendantsLedger, LaunchLog } from "./descendants.ts";
import type { ToolChildMessageOf } from "./protocol.ts";
export declare const LAUNCH_PROOF_MS = 5000;
export interface BarrierViolation {
readonly launchId: string;
readonly jobId: string | undefined;
readonly reason: "proof_missing" | "proof_unacked" | "proof_unordered" | "proof_unknown_launch" | "ledger_unwritable" | "breakaway_contradicts_containment";
/** `tool_child_containment_violation` when the started command is not where its launch said it would be. */
readonly code: "tool_child_barrier_violation" | "tool_child_containment_violation";
}
export interface LaunchEnforcerOptions {
readonly generation: number;
readonly ledger: DescendantsLedger;
readonly log: LaunchLog;
readonly sendAck: (launchId: string) => void;
readonly onViolation: (violation: BarrierViolation) => void;
readonly leaderStart: (pid: number) => Promise<string | undefined>;
/** Test-only gate: resolves when the test releases this launch's ack (`HOLD_LAUNCH_ACK`). */
readonly holdAck?: (launchId: string) => Promise<void>;
readonly setTimer?: (fn: () => void, ms: number) => () => void;
readonly proofMs?: number;
/** Windows: a live job listing, recorded as confirmation of creation-time membership (never as a refutation). */
readonly confirmMember?: (pid: number) => boolean;
}
export declare class LaunchEnforcer {
#private;
constructor(options: LaunchEnforcerOptions);
onLaunch(frame: ToolChildMessageOf<"launch">): Promise<void>;
/**
* Resolves once every launch received so far is in the ledger. Teardown reads the ledger after this: a launch whose
* entry was still being written when the child was killed (a violation kills at once) is swept like any other.
*/
recorded(): Promise<void>;
onProof(frame: ToolChildMessageOf<"launch_proof">): void;
/**
* Windows creation-time evidence: a command started by a creator inside the job is a member from creation (job
* membership is inherited), unless it broke away. A `breakaway` that contradicts the ledgered containment means the
* command is not where the server recorded it, so the generation is ended as a containment violation.
*/
onCommandStarted(frame: ToolChildMessageOf<"command_started">): void;
onDone(frame: ToolChildMessageOf<"launch_done">): void;
dispose(): void;
}
//# sourceMappingURL=launch-enforcer.d.ts.map