import type { SessionCapabilities, TurnCaller } from "#channel/types.js"; import type { SessionInputQueue } from "#execution/session/input-queue.js"; import type { SessionInboxReader } from "#execution/session-inbox/inbox.js"; import type { SessionStateCursor } from "#execution/session/state-cursor.js"; import type { WorkflowToolRunMessage } from "#execution/tools/workflow/messages.js"; import type { TurnOutcome, TurnStepPayload } from "#execution/session/turn-step-types.js"; import type { TurnControl } from "#execution/session/turn-control.js"; import type { RuntimeActionResult } from "#shared/action-types.js"; /** True when a delegating parent (local or remote) receives this session's input requests. */ export declare function hasDelegatedCallerContext(serializedContext: Record): boolean; export interface SessionExecutionInput { readonly capabilities?: SessionCapabilities; readonly cursor: SessionStateCursor; readonly inbox: SessionInboxReader; readonly queue: SessionInputQueue; readonly sessionId: string; } /** * Executes conversational turns inside the owning session workflow: runs * `turnStep`, services the inbox at committed boundaries, coordinates waits, * and settles locally. There is no child run and no transport protocol. */ export declare class SessionExecution { private readonly input; constructor(input: SessionExecutionInput); get cursor(): SessionStateCursor; runTurn(delivery: TurnStepPayload | undefined, options?: { /** * The delegated caller the turn answers, including for a first turn whose * input carries no caller. The turn's first step binds it into the context. */ readonly caller?: TurnCaller; readonly control?: TurnControl; }): Promise; /** * Applies what runs reported while the model step ran, so the next step sees * it. Consecutive `agent-started` messages, such as a fan-out's, share one step. * An ending session drops them: its stream is closed, and finalizing the * session terminates the children. */ private handleBoundaryMessages; private runTurnSteps; /** * Starts the workflow tool runs a parked step requested, and returns the * results of any that settled at once. Task tool calls need no dispatch: the * session answers them itself. */ private dispatchRuns; handleWorkflowMessage(message: WorkflowToolRunMessage): Promise; /** * Stops the work a cancelled turn leaves behind: the workflow tool runs it * waits on and every working task. A turn that waits on no run, the common * case, skips that durable step. */ cancelTurnWork(): Promise; /** `session.cancel()` stops the turn, the calls it waits on, and every working task. */ private finishCancelledTurn; /** * The model tried to end the turn while its tasks work. The turn parks as * `eve__task_wait` would, until one of them settles or the turn is steered. */ private waitForHeldTurn; /** * The turn waits on a sign-in or tool approval it raised. It wakes with the * delivery its next step reads: the sign-in callback, an approval answer * from any responder, or a message from the turn's own person, which steers * the turn and cancels the request. Anyone else's message queues behind it. */ private waitForHeldRequest; private waitForRuntimeActionResults; /** Answers every `eve__task_wait` that can return now; returns the ones still waiting. */ private resolveTaskWaits; /** * `eve__task_cancel` is answered at once, and so is each `eve__task_wait` that can * return now: a timeout of 0, a result already waiting, or nothing working. * Any other `eve__task_wait` parks the open turn, reported once as * `turn.waiting`, and the turn resolves it alongside the step's other * workflow tool calls. */ private answerTaskToolCalls; private traceTaskWait; /** Aborts the `abortSignal` of every workflow tool call the wait has no result for yet. */ private interruptWaitedWorkflowCalls; }