UNPKG

@code-yeongyu/senpi

Version:

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

72 lines • 4 kB
import { type CallCorrelation, type CallProjection, type CallRaw, type CallScope, type FrozenCalls, type OutstandingCall } from "./compact-call-model.ts"; import { CompactCallTable } from "./compact-call-table.ts"; import type { CompactContentStore } from "./compact-content-store.ts"; import type { ValueRef } from "./compact-values.ts"; export interface CallStep { readonly sequence: number; readonly scope: CallScope; } export interface AnnouncedBlock { readonly messageId: string; readonly contentIndex: number; readonly id: string; readonly name: string; readonly arguments: unknown; readonly resolvedName?: string; readonly correlation?: CallCorrelation; } export interface ExecutionStart { readonly toolCallId: string; readonly toolName: string; readonly args: unknown; readonly parentToolCallId?: string; /** The key its producer minted with a bridge-started call's start (RULING-127 (b)); the host mints none then. */ readonly key?: string; } /** * The outstanding-call phase machine (R3.C3.1-C3.3, RULING-13): one reducer, phases only forward, records in any * order, a key fixed at creation (the producer's, RULING-127). Every change republishes the calls root at the lane * sequence given. */ export declare class CompactSessionCalls { readonly table: CompactCallTable; sequence: number; private mintedAt; private mintedK; constructor(store: CompactContentStore); get(key: string): OutstandingCall | undefined; /** * `toolcall_start`: a bridge-started call joins by id and, like a fresh one, reads its raw prefix through the active * block until its end (C3 cond. 3); an owned slot with the same id is a collision. */ toolStart(step: CallStep, block: AnnouncedBlock): void; requestedName(step: CallStep, messageId: string, contentIndex: number, name: string): void; /** `toolcall_end` and each terminal block: the announcement's final id, name and input; the call owns the raw. */ announce(step: CallStep, block: AnnouncedBlock, raw: CallRaw | null): void; /** Each per-id execution record returns the call it changed (RULING-123), undefined when it changed none. */ executionStart(step: CallStep, start: ExecutionStart): OutstandingCall | undefined; executionUpdate(step: CallStep, toolCallId: string, args: unknown, partialResult: unknown): OutstandingCall | undefined; hook(step: CallStep, toolCallId: string, record: unknown): OutstandingCall | undefined; /** An end closes the oldest call still open under its id (senpi#4278); with none open it may replace an abandoned one. */ executionEnd(step: CallStep, toolCallId: string, result: unknown, isError: boolean): OutstandingCall | undefined; /** * The carrier settled (RULING-13 Q2): the oldest call under its id still awaiting a carrier, own turn first (the * same order the ends closed them in, senpi#4278), leaves with its completed descendants as one projection. */ settle(step: CallStep, toolCallId: string, isError: boolean): CallProjection | undefined; /** RULING-13 Q3: a never-started call ends as an explicit `not-executed` terminal, never a silent removal. */ turnEnd(step: CallStep): void; /** RULING-13 Q4: after the run settled no carrier can arrive; started calls stay carrierless until retirement. */ agentSettled(step: CallStep): void; freeze(): FrozenCalls; release(frozen: FrozenCalls): void; entries(ref: ValueRef | undefined, valid: () => void): AsyncGenerator<readonly [string, OutstandingCall], any, any>; /** FIFO (senpi#4278): the oldest call under the id that can take the record, own turn first; none open, the newest. */ private resolve; private lookup; private ignore; /** `key`: the producer's key for a block or a bridge-started call; the host mints one only for a call with neither. */ private create; private update; } //# sourceMappingURL=compact-session-calls.d.ts.map