UNPKG

eve

Version:

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

46 lines (45 loc) 1.9 kB
import { ContextKey } from "#context/key.js"; import type { ToolExecuteOptions } from "#tools/definition.js"; import type { TaskExec } from "#tools/task.js"; import type { AgentView } from "#subagents/handles/prompt.js"; import type { JsonValue } from "#shared/json.js"; export interface BackgroundExecutableTool { readonly execute: (input: unknown, options: ToolExecuteOptions, task: TaskExec) => unknown; readonly executeInput?: (input: unknown) => JsonValue; readonly name: string; readonly nodeId?: string; readonly resultKind?: "subagent" | "tool"; /** Present when the execute body runs in the task-owned durable workflow. */ readonly workflowId?: string; } export interface BackgroundToolCall { readonly callId: string; readonly definition: BackgroundExecutableTool; readonly input: unknown; } export interface BackgroundToolCallBatch { readonly calls: readonly BackgroundToolCall[]; register(call: { readonly callId: string; readonly input: unknown; readonly toolName: string; }): void; setTool(name: string, definition?: BackgroundExecutableTool): void; } export interface BackgroundToolExecutor { readAgentViews?(): Promise<readonly AgentView[]>; execute(input: { readonly batch: BackgroundToolCallBatch; readonly definition: BackgroundExecutableTool; readonly options: ToolExecuteOptions; readonly toolInput: unknown; }): Promise<unknown>; } export declare const BackgroundToolExecutorKey: ContextKey<BackgroundToolExecutor>; export declare function createBackgroundToolCallBatch(): BackgroundToolCallBatch; export declare function executeBackgroundToolCall(input: { readonly batch: BackgroundToolCallBatch; readonly definition: BackgroundExecutableTool; readonly options: ToolExecuteOptions; readonly toolInput: unknown; }): Promise<unknown>;