UNPKG

eve

Version:

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

287 lines (286 loc) 14 kB
import { z } from "#compiled/zod/index.js"; /** * Eve-owned `tool-call` action requested by the model. * * Depending on the tool definition, it can execute locally, be provider * executed, or be handled later by the runtime. */ export type RuntimeToolCallActionRequest = z.infer<typeof runtimeToolCallActionRequestSchema>; /** * Zod schema for one Eve-owned `tool-call` action request. */ export declare const runtimeToolCallActionRequestSchema: z.ZodObject<{ callId: z.ZodString; input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>; kind: z.ZodLiteral<"tool-call">; toolName: z.ZodString; }, z.core.$strict>; export type RuntimeSubagentCallActionRequest = z.infer<typeof runtimeSubagentCallActionRequestSchema>; declare const runtimeSubagentCallActionRequestSchema: z.ZodObject<{ callId: z.ZodString; description: z.ZodString; input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>; kind: z.ZodLiteral<"subagent-call">; name: z.ZodString; nodeId: z.ZodString; subagentName: z.ZodString; }, z.core.$strict>; export type RuntimeRemoteAgentCallActionRequest = z.infer<typeof runtimeRemoteAgentCallActionRequestSchema>; export declare const runtimeRemoteAgentCallActionRequestSchema: z.ZodObject<{ callId: z.ZodString; description: z.ZodString; input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>; kind: z.ZodLiteral<"remote-agent-call">; name: z.ZodString; nodeId: z.ZodString; remoteAgentName: z.ZodString; }, z.core.$strict>; export type RuntimeWorkflowToolCallActionRequest = z.infer<typeof runtimeWorkflowToolCallActionRequestSchema>; declare const runtimeWorkflowToolCallActionRequestSchema: z.ZodObject<{ callId: z.ZodString; input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>; kind: z.ZodLiteral<"workflow-tool-call">; toolName: z.ZodString; workflowId: z.ZodString; }, z.core.$strict>; /** * Internal subagent dispatch request issued by the agent workflow task. * * This is deliberately not a {@link RuntimeActionRequest}: subagent tools are * workflow tasks, while runtime actions are reserved for framework controls. */ export type RuntimeSubagentDispatchRequest = z.infer<typeof runtimeSubagentDispatchRequestSchema>; /** * Zod schema for one internal local-subagent dispatch request. */ declare const runtimeSubagentDispatchRequestSchema: z.ZodObject<{ callId: z.ZodString; description: z.ZodString; input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>; kind: z.ZodLiteral<"subagent-call">; name: z.ZodString; nodeId: z.ZodString; subagentName: z.ZodString; }, z.core.$strict>; /** * Internal remote-agent dispatch request issued by the agent workflow task. */ export type RuntimeRemoteAgentDispatchRequest = z.infer<typeof runtimeRemoteAgentDispatchRequestSchema>; /** * Zod schema for one internal remote-agent dispatch request. */ export declare const runtimeRemoteAgentDispatchRequestSchema: z.ZodObject<{ callId: z.ZodString; description: z.ZodString; input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>; kind: z.ZodLiteral<"remote-agent-call">; name: z.ZodString; nodeId: z.ZodString; remoteAgentName: z.ZodString; }, z.core.$strict>; /** * One workflow task requested by the harness. The turn owner starts the * durable run named by `workflowId`; blocking tools wait for its result, * while background tools settle after task admission. * * Tasks are the coordination contract for authored workflow tools and * subagents. They are intentionally separate from `RuntimeActionRequest`. */ export type RuntimeWorkflowTaskRequest = z.infer<typeof runtimeWorkflowTaskRequestSchema>; export declare const runtimeWorkflowTaskRequestSchema: z.ZodObject<{ callId: z.ZodString; executeInput: z.ZodOptional<z.ZodType<import("#shared/json.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonValue, unknown>>>; input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>; kind: z.ZodLiteral<"workflow-task">; nodeId: z.ZodOptional<z.ZodString>; resultKind: z.ZodOptional<z.ZodEnum<{ subagent: "subagent"; tool: "tool"; }>>; toolName: z.ZodString; workflowId: z.ZodString; }, z.core.$strict>; /** * Eve-owned `load-skill` action requested by the model. */ type RuntimeLoadSkillActionRequest = z.infer<typeof runtimeLoadSkillActionRequestSchema>; /** * Zod schema for one Eve-owned `load-skill` action request. */ declare const runtimeLoadSkillActionRequestSchema: z.ZodObject<{ callId: z.ZodString; input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>; kind: z.ZodLiteral<"load-skill">; }, z.core.$strict>; /** * Eve-owned action request surfaced by the harness. * * `tool-call` covers ordinary model-visible calls, including framework task * controls. Deferred workflow and subagent execution uses * {@link RuntimeWorkflowTaskRequest} instead. */ export type RuntimeActionRequest = RuntimeLoadSkillActionRequest | RuntimeRemoteAgentCallActionRequest | RuntimeSubagentCallActionRequest | RuntimeToolCallActionRequest | RuntimeWorkflowToolCallActionRequest; /** Marks an in-process tool action without changing its serialized protocol shape. */ export declare function markRuntimeWorkflowToolAction(action: RuntimeToolCallActionRequest): RuntimeToolCallActionRequest; /** Reads the in-process marker or the older explicit protocol action kind. */ export declare function isRuntimeWorkflowToolAction(action: RuntimeActionRequest): boolean; /** Internal agent dispatch request owned by a workflow task. */ export type RuntimeAgentDispatchRequest = RuntimeRemoteAgentDispatchRequest | RuntimeSubagentDispatchRequest; /** * Zod schema for one runtime action request. */ export declare const runtimeActionRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ callId: z.ZodString; input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>; kind: z.ZodLiteral<"load-skill">; }, z.core.$strict>, z.ZodObject<{ callId: z.ZodString; description: z.ZodString; input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>; kind: z.ZodLiteral<"remote-agent-call">; name: z.ZodString; nodeId: z.ZodString; remoteAgentName: z.ZodString; }, z.core.$strict>, z.ZodObject<{ callId: z.ZodString; description: z.ZodString; input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>; kind: z.ZodLiteral<"subagent-call">; name: z.ZodString; nodeId: z.ZodString; subagentName: z.ZodString; }, z.core.$strict>, z.ZodObject<{ callId: z.ZodString; input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>; kind: z.ZodLiteral<"tool-call">; toolName: z.ZodString; }, z.core.$strict>, z.ZodObject<{ callId: z.ZodString; input: z.ZodType<import("#shared/json.js").JsonObject, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonObject, unknown>>; kind: z.ZodLiteral<"workflow-tool-call">; toolName: z.ZodString; workflowId: z.ZodString; }, z.core.$strict>], "kind">; /** * Runtime-owned authored tool-result projected back into a harness resume call. */ export type RuntimeToolResultActionResult = z.infer<typeof runtimeToolResultActionResultSchema>; /** * Zod schema for one runtime-owned authored tool-result action result. */ declare const runtimeToolResultActionResultSchema: z.ZodObject<{ callId: z.ZodString; isError: z.ZodOptional<z.ZodBoolean>; kind: z.ZodLiteral<"tool-result">; output: z.ZodType<import("#shared/json.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonValue, unknown>>; toolName: z.ZodString; }, z.core.$strict>; /** * Subagent result produced by a dispatched child session and delivered back * through the parent's resume hook. * * Results bind to the pending call by callId alone: possession of the * parent's callback token is the authorization to settle, so no further * identity verification happens here. Under the accepted at-least-once * dispatch window a replay-orphaned duplicate child holds the same token * and callId and may settle the call in place of the owned child — its * output is computed from the same input, and this is an accepted * trade-off, not an oversight. * * `outcome` is the child engine's explicit lifecycle verdict for the settled * turn. The parent settles the agent handle from `outcome.kind` and folds * `outcome.usageDelta` into its session totals; `output`/`isError` remain * the tool-result projection shown to the model. Every producer states the * envelope explicitly — task-mode boundaries synthesize a terminal one — * so the parent never infers lifecycle from an absent field. `usage` * carries the turn's token spend so the caller can attribute the * subagent's tokens. * * `backgroundTask` marks the one parent-produced exception: delegated * dispatch resolves the model's tool call with a parked task receipt before * the child settles. Stream consumers use the marker to keep child lifecycle * open while still recording the receipt as the tool result. */ export interface RuntimeSubagentChildResult { readonly backgroundTask?: { readonly status: "working"; readonly taskId: string; }; readonly callId: string; readonly isError?: boolean; readonly kind: "subagent-result"; readonly origin: "child"; readonly outcome: import("#shared/agent-turn-outcome.js").AgentTurnOutcome; readonly output: import("#shared/json.js").JsonValue; readonly subagentName: string; readonly usage?: import("#shared/token-usage.js").TokenUsage; } /** Token-only subagent result schema retained for historical wire formats. */ export declare const runtimeSubagentChildResultSchema: z.ZodObject<{ backgroundTask: z.ZodOptional<z.ZodObject<{ status: z.ZodLiteral<"working">; taskId: z.ZodString; }, z.core.$strict>>; callId: z.ZodString; isError: z.ZodOptional<z.ZodBoolean>; kind: z.ZodLiteral<"subagent-result">; origin: z.ZodLiteral<"child">; outcome: z.ZodType<import("#shared/agent-turn-outcome.js").AgentTurnOutcome, unknown, z.core.$ZodTypeInternals<import("#shared/agent-turn-outcome.js").AgentTurnOutcome, unknown>>; output: z.ZodType<import("#shared/json.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonValue, unknown>>; subagentName: z.ZodString; usage: z.ZodOptional<z.ZodObject<{ cacheReadTokens: z.ZodNumber; cacheWriteTokens: z.ZodNumber; inputTokens: z.ZodNumber; outputTokens: z.ZodNumber; }, z.core.$strip>>; }, z.core.$strict>; /** Current subagent result schema, including optional model token cost. */ export declare const runtimeSubagentChildResultWithCostSchema: z.ZodType<RuntimeSubagentChildResult>; /** * Subagent failure synthesized on the parent side when no child produced a * result: dispatch rejections, start failures, and agentId-continuation * delivery errors. Always an error. Enters the harness only through the * trusted step-result path, never through the shared callback inbox. */ export type RuntimeSubagentDispatchFailure = z.infer<typeof runtimeSubagentDispatchFailureSchema>; /** * Zod schema for one parent-synthesized subagent dispatch failure. */ declare const runtimeSubagentDispatchFailureSchema: z.ZodObject<{ callId: z.ZodString; isError: z.ZodLiteral<true>; kind: z.ZodLiteral<"subagent-result">; origin: z.ZodLiteral<"dispatch">; output: z.ZodType<import("#shared/json.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonValue, unknown>>; subagentName: z.ZodString; }, z.core.$strict>; /** * Runtime-owned subagent result projected back into a harness resume call, * discriminated on `origin`: `child` results come from a dispatched child * session and must bind to a running agent handle; `dispatch` failures are * parent-synthesized and trusted by construction. */ export type RuntimeSubagentResult = RuntimeSubagentChildResult | RuntimeSubagentDispatchFailure; /** * Runtime-owned action result produced by framework-owned loading code. */ type RuntimeLoadSkillActionResult = z.infer<typeof runtimeLoadSkillActionResultSchema>; /** * Zod schema for one runtime-owned load-skill action result. * * The result still reports whether a skill became active during the turn; the * action name reflects how the model requests those instructions. */ declare const runtimeLoadSkillActionResultSchema: z.ZodObject<{ callId: z.ZodString; isError: z.ZodOptional<z.ZodBoolean>; kind: z.ZodLiteral<"load-skill-result">; output: z.ZodType<import("#shared/json.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("#shared/json.js").JsonValue, unknown>>; name: z.ZodOptional<z.ZodString>; }, z.core.$strict>; /** * Runtime-owned action result produced by framework-owned runtime code. */ export type RuntimeActionResult = RuntimeLoadSkillActionResult | RuntimeSubagentResult | RuntimeToolResultActionResult; export {};