UNPKG

eve

Version:

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

62 lines (61 loc) 2.52 kB
import type { WebSearchProvider } from "#shared/web-search.js"; /** Session facts that can hide a selected tool without changing source composition. */ export type ToolAvailabilityCondition = "delegated-task-child" | "root-session"; /** Native behavior declared by a selected compiled tool. */ export type CompiledToolHandling = { readonly kind: "dispatch"; readonly action: "self-agent" | "task-cancel"; } | { readonly kind: "provider-tool"; readonly provider: WebSearchProvider; } | { readonly kind: "workflow-tool"; readonly workflowId: string; }; /** Closed, serializable behavior carried by one selected compiled tool. */ export interface ToolExecutionShape { readonly lifetime: "step" | "task"; readonly suspend: "none" | "workflow"; } export interface CompiledToolBehavior { readonly availability: readonly ToolAvailabilityCondition[]; readonly handling?: CompiledToolHandling; readonly presentation?: "load-skill"; readonly shape?: ToolExecutionShape; } /** Concrete dispatch identity prepared before a tool reaches the harness. */ export type PreparedDispatchTarget = { readonly kind: "remote-agent-call"; readonly nodeId: string; readonly remoteAgentName: string; } | { readonly kind: "self-agent-call"; readonly nodeId: string; readonly subagentName: string; } | { readonly kind: "subagent-call"; readonly nodeId: string; readonly subagentName: string; } | { readonly kind: "task-cancel"; } | { readonly kind: "workflow-tool-call"; readonly workflowId: string; }; /** Runtime-prepared handling consumed by the harness and execution boundary. */ export type PreparedToolHandling = { readonly kind: "dispatch"; readonly target: PreparedDispatchTarget; } | Extract<CompiledToolHandling, { readonly kind: "provider-tool"; }>; /** Runtime-prepared behavior carried by one harness-visible tool. */ export interface PreparedToolBehavior { readonly availability: readonly ToolAvailabilityCondition[]; readonly handling?: PreparedToolHandling; readonly presentation?: CompiledToolBehavior["presentation"]; } /** Attaches internal behavior without adding a public string-keyed definition field. */ export declare function attachToolBehavior<TDefinition extends object>(definition: TDefinition, behavior: CompiledToolBehavior): TDefinition; /** Reads internal behavior from a framework-owned definition. */ export declare function readToolBehavior(value: unknown): CompiledToolBehavior | undefined;