@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
42 lines • 1.81 kB
TypeScript
import { type ToolChildMessageOf } from "./protocol.ts";
/**
* The one host-call capacity both sides enforce: `HOST_CALL_ACTIVE` running plus `HOST_CALL_WAITING` queued (264).
* The child admits against it before sending, the server admits against it on receipt; there is no second constant.
*/
export declare function hostCallCapacity(): number;
export type HostCallRefusalCode = "host_call_capacity" | "host_call_duplicate";
export type HostCallDecision = {
state: "active";
} | {
state: "waiting";
} | {
state: "refused";
frame: ToolChildMessageOf<"host_call_refused">;
};
/** Lossless host-call admission: a call is running, queued FIFO, or refused with a frame naming its `callId`. */
export declare class HostCallAdmission {
#private;
get active(): number;
get waiting(): number;
submit(callId: string): HostCallDecision;
/** Ends a call (or withdraws a queued one) and returns the call promoted into the freed active slot, if any. */
settle(callId: string): string | undefined;
}
export type JobRefusalCode = "tool_child_jobs_full" | "tool_child_nested_full" | "tool_child_parent_unknown" | "tool_child_job_duplicate";
export type JobDecision = {
admitted: true;
} | {
admitted: false;
frame: ToolChildMessageOf<"job_refused">;
};
/**
* Per-child job budget. Ordinary jobs are capped at `TOOL_CHILD_LIMITS.jobs`. A nested job (started on behalf of a
* running job, e.g. a tool an eval cell calls) is admitted past that cap, so a full child cannot deadlock its own
* callers; nested jobs arrive through host calls and are bounded by `hostCallCapacity()`.
*/
export declare class JobAdmission {
#private;
admit(jobId: string, parentJobId?: string): JobDecision;
finish(jobId: string): void;
}
//# sourceMappingURL=admission.d.ts.map