@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
27 lines • 1.59 kB
TypeScript
/**
* A headless engine's view of which machines its sessions depend on are reachable (C2, K7; senpi#5652).
*
* The owning machine (the placement) offline pauses every session before its next provider request; a hand offline
* pauses the tool calls of the sessions that run on it, while other sessions keep going. Each pause is a durable
* record (presence-ledger.ts); reconnect resumes it exactly once, and a restart recovers the open pauses.
*/
import type { RpcSessionPresence } from "../rpc/rpc-host-response-types.ts";
import type { PresenceLedger } from "./presence-ledger.ts";
/** What a step needs: a provider request needs the placement; a tool batch also needs the session's hands. */
export type PresenceWork = "request" | "tools";
export interface HeadlessPresence {
readonly placement: string;
/** Registers an open session and the hand machines its tool calls run on (empty for a fused session). */
track(sessionId: string, hands: readonly string[]): Promise<void>;
machineOffline(machine: string): Promise<void>;
machineOnline(machine: string): Promise<void>;
view(sessionId: string): RpcSessionPresence;
/** Resolves once nothing `work` depends on is paused, or when `signal` aborts. */
ready(sessionId: string, work: PresenceWork, signal?: AbortSignal): Promise<void>;
subscribe(listener: (sessionId: string) => void): () => void;
}
export declare function openHeadlessPresence(options: {
readonly ledger: PresenceLedger;
readonly placement: string;
}): Promise<HeadlessPresence>;
//# sourceMappingURL=presence.d.ts.map