UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

59 lines (58 loc) 2.62 kB
/** * Sends delegated task results to their parent and conversation results to * the caller of each turn. */ import type { TurnCaller } from "#channel/types.js"; import type { RuntimeSubagentChildResult } from "#shared/action-types.js"; import type { AgentTurnOutcome } from "#shared/agent-turn-outcome.js"; import type { TokenUsage } from "#shared/token-usage.js"; /** * Resumes the parent driver's hook with a delegated subagent result. * No-op for root sessions. * * `usage` — the completed child's session-total token spend — is * attached to success results so the caller can attribute the * subagent's tokens. Error results never carry usage. */ export declare function notifyDelegatedParentStep(input: { readonly result: RuntimeSubagentChildResult | undefined; readonly serializedContext: Record<string, unknown>; readonly usage?: TokenUsage; }): Promise<void>; /** Settled turn payload forwarded from the driver to the caller. */ export interface SettledTurnNotification { readonly output: unknown; readonly isError?: boolean; /** Usage this turn added; omitted (zero) on crash and expiry paths. */ readonly usage?: TokenUsage; } /** * Sends a settled conversation turn to the caller that started it. * * `lifecycle` is the child engine's explicit verdict — `parked` when the * child session survived the turn and can accept another delivery, * `terminal` when it ended with this turn. It is carried on the result as * an {@link AgentTurnOutcome} so the caller never infers lifecycle from * success or error codes. */ export declare function notifyTurnCallerStep(input: { readonly caller: TurnCaller | undefined; readonly lifecycle: AgentTurnOutcome["kind"]; readonly sessionId: string; readonly settled: SettledTurnNotification; }): Promise<void>; /** Settles a workflow-owned caller after the child turn is cooperatively cancelled. */ export declare function notifyCancelledTaskCallerStep(input: { readonly caller: TurnCaller | undefined; readonly sessionId: string; readonly usage?: TokenUsage; }): Promise<void>; /** Resolves the caller that created a delegated conversation session. */ export declare function resolveInitialTurnCallerStep(input: { readonly serializedContext: Record<string, unknown>; }): Promise<TurnCaller | undefined>; /** Rebinds child event forwarding to the caller that owns the next accepted turn. */ export declare function bindTurnCallerContextStep(input: { readonly caller: TurnCaller | undefined; readonly serializedContext: Record<string, unknown>; }): Promise<Record<string, unknown>>;