eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
46 lines (45 loc) • 1.9 kB
TypeScript
import { ContextKey } from "#context/key.js";
import type { InternalToolLabelDefinition, ToolExecuteOptions } from "#tools/definition.js";
import type { AgentView } from "#subagents/handles/prompt.js";
import type { JsonValue } from "#shared/json.js";
export interface BackgroundExecutableTool {
readonly label?: InternalToolLabelDefinition;
readonly executeInput?: (input: unknown) => JsonValue;
readonly name: string;
/** Selected agent definition's runtime graph ID; absent for authored workflow tools. */
readonly nodeId?: string;
/** Registered durable workflow body run by the session-owned task. */
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 {
hasPendingTasks?(): boolean;
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>;