UNPKG

eve

Version:

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

65 lines (64 loc) • 3.18 kB
import type { AgentInvocationRequest } from "#execution/tools/subagent/invoke-agent.js"; import type { RuntimeSubagentResult } from "#shared/action-types.js"; import type { HandleEventFn } from "#harness/types.js"; import type { ActivityWorkIdentityV1 } from "#protocol/activity.js"; import { type SubagentCalledStreamEvent, type SubagentCompletedStreamEvent } from "#protocol/message.js"; import { type DurableSessionState } from "#execution/durable-session-store.js"; import type { RuntimeSubagentChildResult } from "#shared/action-types.js"; export type AgentInvocationDispatchResult = { readonly kind: "dispatched"; readonly agentId: string; readonly event: SubagentCalledStreamEvent; readonly serializedContext?: Record<string, unknown>; readonly sessionState: DurableSessionState; } | { readonly kind: "failed"; readonly result: RuntimeSubagentResult; readonly serializedContext?: Record<string, unknown>; readonly sessionState: DurableSessionState; }; export type TaskAgentInvocationDispatchResult = { readonly kind: "not-admitted"; readonly sessionState: DurableSessionState; } | AgentInvocationDispatchResult; /** Dispatches one owner-scoped local or remote agent invocation. */ export declare function dispatchAgentInvocation(input: { readonly activityWorkIdentity?: ActivityWorkIdentityV1; readonly callbackBaseUrl: string; readonly emit?: HandleEventFn; readonly replyTo: string; readonly request: AgentInvocationRequest; readonly serializedContext: Record<string, unknown>; readonly sessionState: DurableSessionState; readonly ownerId: string; /** Optional creator snapshot used only to prepare this invocation. */ readonly invocationContext?: Record<string, unknown>; readonly taskId?: string | undefined; }): Promise<AgentInvocationDispatchResult>; /** * Dispatches one agent request after any task-owned invocation is admitted. * The callback origin is parent-owned, so it is derived from this workflow's * own metadata rather than accepted from the inbound request. */ export declare function dispatchTaskAgentInvocationStep(input: Omit<Parameters<typeof dispatchAgentInvocation>[0], "callbackBaseUrl" | "emit">): Promise<TaskAgentInvocationDispatchResult>; /** Applies an owner-scoped child settlement to the parent session's canonical state. */ export declare function settleTaskAgentInvocationStep(input: { readonly ownerId: string; readonly result: RuntimeSubagentChildResult; readonly serializedContext: Record<string, unknown>; readonly sessionState: DurableSessionState; readonly taskId?: string | undefined; }): Promise<{ readonly settled: boolean; readonly completion?: SubagentCompletedStreamEvent; readonly serializedContext: Record<string, unknown>; readonly sessionState: DurableSessionState; }>; /** Releases any child leases still owned by a completed workflow-tool run. */ export declare function releaseAgentInvocationOwnerStep(input: { readonly cancelled?: boolean; readonly ownerId: string; readonly sessionState: DurableSessionState; }): Promise<{ readonly sessionState: DurableSessionState; }>;