@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
56 lines • 3.44 kB
TypeScript
/**
* The supervisor's part in a coordinated startup (senpi#4602, A-amended sections 1-3): it reports its own
* milestones on the startup pipe, relays its host child's, records the attempt nonce in its own generation
* directory for recovery, and - because the launcher's controller now decides when a start has failed -
* retries a silent internal-readiness probe or a failed first observer connection inside the attempt's
* budget instead of ending the generation on the first 10 s / 5 s miss. An uncoordinated supervisor keeps
* its original limits exactly.
*/
import type { ChildProcess } from "node:child_process";
import type { Server } from "node:net";
import type { SupervisorLaunch } from "./host-lifecycle-launch.ts";
import type { RpcPublicEndpoint } from "./rpc-public-key.ts";
/** How long the supervisor waits for an uncoordinated host child to start listening; it exits when the child misses this. */
export declare const HOST_CHILD_LISTEN_MS = 30000;
/** Declared before the host child is spawned: a custom child command cannot report its own progress. */
export declare function declareHostChild(childCommand: string | undefined): void;
/** Whether the host child gets the startup pipe: only a coordinated launch of the engine's own host. */
export declare function hostChildReportsStartup(childCommand: string | undefined): boolean;
export declare function hostChildSpawned(child: ChildProcess, generationDir: string, supervisorStartTime: string | undefined): Promise<void>;
export declare function awaitInternalStartup(options: {
readonly internalSocket: string;
readonly internalSecret: Uint8Array | undefined;
readonly internalKey: Buffer | undefined;
readonly openObserver: () => Promise<void>;
}): Promise<void>;
export declare function supervisorPublished(): void;
/**
* Binds and publishes this generation's public endpoint (senpi#4602, A-amended section 4). An initial start binds
* the public name and claims its owner token in one fence. A successor stages its own `.next-<gen>` listener, then -
* on a coordinated launch - waits for the launcher's publication grant, which comes only after its presenter (P7)
* resolved; only then does it publish its key and adopt the public name, under the fence, re-checking the grant,
* the predecessor's owner token and the entry it was decided against.
*/
export declare function publishSupervisorEndpoint(options: {
readonly launch: SupervisorLaunch;
readonly server: Server;
readonly publicSecret: Uint8Array | undefined;
readonly publicEndpoint: RpcPublicEndpoint | undefined;
readonly generationDir: string;
readonly instanceId: string;
/** This generation's settings as read at boot: the generation number the owner token names. */
readonly settings: unknown;
/** Marked the moment this generation's key is published: its teardown owns the public entry from then on. */
readonly state: {
publicSocketOwned: boolean;
};
}): Promise<void>;
/**
* The host child's stdio: stdin for the internal key, inherited stderr, the lifetime pipe at 3, the presenter
* channel at 4 when bootstrapped, and on a coordinated start the startup pipe at 16 with its fillers.
*/
export declare function hostChildStdio(bootstrap: boolean, reportsStartup: boolean): {
readonly stdio: ("ignore" | "inherit" | "pipe")[];
readonly fillers: number[];
};
//# sourceMappingURL=host-lifecycle-startup.d.ts.map