UNPKG

@code-yeongyu/senpi

Version:

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

50 lines • 1.98 kB
import type { LaunchRequest } from "./launch-gate.ts"; export type WorkerLaunchMessage = { readonly kind: "launch"; readonly launchId: string; readonly slot: number; readonly request: LaunchRequest; } | { readonly kind: "invoking"; readonly launchId: string; } | { readonly kind: "started"; readonly launchId: string; readonly pid: number; readonly breakaway: boolean; } | { readonly kind: "done"; readonly launchId: string; readonly exitCode?: number; readonly signal?: string; }; export interface WorkerLaunchClientOptions { readonly clockBuffer: SharedArrayBuffer; readonly post: (message: WorkerLaunchMessage) => void; readonly jobId: () => string; /** Test-only `SKIP_ACK_WAIT` mutation. */ readonly skipAckWait?: boolean; /** Bounded wait for the ack; the server kills the child long before this in practice. */ readonly ackTimeoutMs?: number; /** The worker's identity inside launch ids; the worker thread id by default. */ readonly workerId?: number; } export declare class WorkerLaunchError extends Error { readonly code: string; constructor(code: string, message: string); } export declare class WorkerLaunchClient { #private; constructor(options: WorkerLaunchClientOptions); /** Sends `launch` and blocks this worker until the ack; returns the launch id for `invoke`/`done`. */ acquire(request: Omit<LaunchRequest, "jobId">): string; /** Immediately before the real call: store the invoke tick and let the protocol loop publish the proof. */ invoke(launchId: string): void; /** Windows: the command's pid once the real call returned it, for the server's creation-time membership record. */ started(launchId: string, pid: number, breakaway?: boolean): void; done(launchId: string, outcome: { readonly exitCode?: number | null; readonly signal?: string | null; }): void; } //# sourceMappingURL=worker-launch.d.ts.map