UNPKG

@code-yeongyu/senpi

Version:

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

36 lines • 1.97 kB
/** * The session tool barrier (senpi#3717). A client that captures a pre-turn workspace checkpoint arms * the turn with a barrier, sends the prompt at once, and releases the barrier when its capture is * done. Until then a tool that may change the workspace waits in preflight; read-only tools do not. * The ceiling (`deadlineMs`) bounds the wait when a release never arrives. */ /** What a tool can do to the workspace. Tools that do not declare it are treated as `"write"`. */ export type ToolWorkspaceEffect = "read" | "write"; export interface ToolBarrierSpec { /** Client-chosen id that `releaseToolBarrier` must name; 1-256 characters. */ readonly id: string; /** Ceiling in milliseconds after which the barrier opens by itself; an integer in 1..600000. */ readonly deadlineMs: number; } export declare const MAX_TOOL_BARRIER_ID_LENGTH = 256; export declare const MAX_TOOL_BARRIER_DEADLINE_MS = 600000; /** Why `value` is not a {@link ToolBarrierSpec}, or undefined when it is one. */ export declare function toolBarrierSpecError(value: unknown): string | undefined; /** One pending wait: the barrier id it waits on and the promise that settles when it may proceed. */ export interface ToolBarrierWait { readonly id: string; readonly done: Promise<void>; } export declare class ToolBarrier { #private; constructor(onExpired: (spec: ToolBarrierSpec) => void); /** Arm, or re-arm under a new id and ceiling; calls already waiting keep waiting. */ arm(spec: ToolBarrierSpec): void; /** Open the barrier armed under `id`. False when nothing with that id is armed (a no-op). */ release(id: string): boolean; /** The armed turn ended: open without reporting anything. */ clear(): void; /** The wait a write tool must take now, or undefined when nothing is armed. Settles early on abort. */ wait(signal: AbortSignal | undefined): ToolBarrierWait | undefined; } //# sourceMappingURL=tool-barrier.d.ts.map