@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
31 lines • 2.43 kB
TypeScript
import type { MonitorRegistry } from "../monitor-registry.ts";
import type { MonitorRegistration, TerminalManifestWriter } from "../terminal-manifest.ts";
import type { TerminalManifestRpcCheckpoint } from "../terminal-manifest-model.ts";
import { type TerminalToolContext, type TerminalToolResult } from "./context.ts";
export declare const MAX_PENDING_MONITOR_SPECS = 32;
/** Bind the session's manifest writer so monitor tool calls can hand it specs captured at the call site. */
export declare function bindTerminalManifestWriter(sessionId: string, writer: TerminalManifestWriter): void;
export declare function unbindTerminalManifestWriter(sessionId: string): void;
export declare function pendingDurableSpecCount(sessionId: string): number;
/** The durability session key for a tool context: the agent session id, when the context carries one. */
export declare function manifestSessionKey(ctx: TerminalToolContext): string | undefined;
/**
* Hand a spec captured at the monitor tool call site to the session's writer, or queue it until
* one binds. The write is awaited: the tool result must not claim a watch before its manifest
* entry exists on disk.
*/
export declare function handMonitorSpec(sessionKey: string | undefined, registration: MonitorRegistration): Promise<void>;
/** Persist a durable file watch's baseline checkpoint through the writer's debounced path. */
export declare function handFileCheckpoint(sessionKey: string | undefined, monitorId: string, registry: MonitorRegistry, runtimeId: string): void;
/** Persist an rpc watch's view (host generations, session statuses) through the session's writer. */
export declare function handRpcCheckpoint(sessionKey: string | undefined, monitorId: string, checkpoint: TerminalManifestRpcCheckpoint): void;
/**
* Admission control for a durable create. There is no cap unless `terminal.maxDurableMonitors`
* sets one; then refuse once the session already holds that many restart-surviving monitors,
* counting both the bound writer's entries and the specs still queued for a writer. Checked
* BEFORE any spawn or registry registration so a refused call leaves no PTY and no manifest
* entry behind. A context with no session key persists nothing, so it has no durable
* population to cap.
*/
export declare function durableAdmissionError(ctx: TerminalToolContext): TerminalToolResult | undefined;
//# sourceMappingURL=monitor-manifest-binding.d.ts.map