UNPKG

eve

Version:

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

43 lines (42 loc) • 1.98 kB
import type { RuntimeActionResultHookPayload, SubagentAuthorizationEventHookPayload, SubagentInputRequestHookPayload } from "#channel/types.js"; import type { RuntimeSubagentChildResult } from "#shared/action-types.js"; import type { JsonValue } from "#shared/json.js"; import type { JsonObject } from "#shared/json.js"; import type { AgentInput } from "#tools/workflow-definition.js"; import type { ToolContext } from "#tools/definition.js"; export type InternalAgentInput = { readonly agentId?: string; readonly message: string; readonly outputSchema?: JsonObject; readonly target: string; }; /** * Asks the owning session to spawn an agent for a workflow tool run. Spawning * needs owner-held material (auth, capabilities, the agent handle * store) that a workflow tool body never has. */ export interface AgentInvocationRequest { readonly input: InternalAgentInput; readonly invocationId: string; readonly kind: "agent-invoke"; } /** * Tells the owning session that an owner-spawned agent replied to the run, so * the owner can release the handle it reserved for `agent-invoke`. */ export interface AgentSettlementRequest { readonly kind: "agent-settled"; readonly result: RuntimeSubagentChildResult; } export type AgentInvocationEvent = SubagentAuthorizationEventHookPayload | SubagentInputRequestHookPayload; export type AgentInvocationReply = AgentInvocationEvent | RuntimeActionResultHookPayload | { readonly kind: "agent-settled"; readonly callId: string; }; /** Invokes an agent from a workflow tool. */ export declare function agent(ctx: ToolContext, target: string, input: AgentInput): Promise<JsonValue>; /** Invokes an agent with a framework-selected replay-stable invocation id. */ export declare function invokeAgent(ctx: ToolContext, input: InternalAgentInput, options?: { readonly invocationId?: string; }): Promise<JsonValue>; export declare function validateAgentInput(input: InternalAgentInput): void;