UNPKG

eve

Version:

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

45 lines (44 loc) 2.18 kB
import type { RuntimeActionResultHookPayload, SubagentAuthorizationEventHookPayload, SubagentInputRequestHookPayload } from "#channel/types.js"; import type { RuntimeSubagentChildResult, RuntimeSubagentResult } 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, admission, 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; /** 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; readonly returnResult: true; }): Promise<JsonValue | RuntimeSubagentResult>; export declare function invokeAgent(ctx: ToolContext, input: InternalAgentInput, options?: { readonly invocationId?: string; readonly returnResult?: false; }): Promise<JsonValue>; export declare function validateAgentInput(input: InternalAgentInput): void;