UNPKG

@eko-ai/eko

Version:

Empowering language to transform human words into action.

105 lines 3.12 kB
import { Agent } from "../agent"; import { IMcpClient } from "./mcp.types"; import { IA2aClient } from "../agent/a2a"; import { LLMs, LLMStreamMessage } from "./llm.types"; import { AgentContext } from "../agent/agent-context"; export type EkoConfig = { llms: LLMs; agents?: Agent[]; planLlms?: string[]; compressLlms?: string[]; callback?: AgentStreamCallback & HumanCallback; defaultMcpClient?: IMcpClient; a2aClient?: IA2aClient; }; export type AgentStreamMessage = { streamType: "agent"; chatId: string; taskId: string; agentName: string; nodeId?: string | null; } & ({ type: "workflow"; streamDone: boolean; workflow: Workflow; } | { type: "workflow_confirm"; workflow: Workflow; resolve: (result: "confirm" | "cancel") => void; } | { type: "agent_start"; agentNode: WorkflowAgent; } | LLMStreamMessage | { type: "agent_result"; agentNode: WorkflowAgent; error?: any; result?: string; }); export interface AgentStreamCallback { onMessage: (message: AgentStreamMessage, agentContext?: AgentContext | undefined) => Promise<void>; } export type WorkflowTextNode = { type: "normal"; text: string; input?: string | null; output?: string | null; }; export type WorkflowForEachNode = { type: "forEach"; items: string; nodes: WorkflowNode[]; }; export type WorkflowWatchNode = { type: "watch"; event: "dom" | "gui" | "file"; loop: boolean; description: string; triggerNodes: (WorkflowTextNode | WorkflowForEachNode)[]; }; export type WorkflowNode = WorkflowTextNode | WorkflowForEachNode | WorkflowWatchNode; export type WorkflowAgent = { id: string; name: string; task: string; dependsOn: string[]; nodes: WorkflowNode[]; parallel?: boolean; status: "init" | "running" | "done" | "error"; xml: string; }; export type Workflow = { taskId: string; name: string; thought: string; agents: WorkflowAgent[]; xml: string; modified?: boolean; taskPrompt?: string; }; export interface HumanCallback { onHumanConfirm?: (agentContext: AgentContext, prompt: string, extInfo?: any) => Promise<boolean>; onHumanInput?: (agentContext: AgentContext, prompt: string, extInfo?: any) => Promise<string>; onHumanSelect?: (agentContext: AgentContext, prompt: string, options: string[], multiple?: boolean, extInfo?: any) => Promise<string[]>; onHumanHelp?: (agentContext: AgentContext, helpType: "request_login" | "request_assistance", prompt: string, extInfo?: any) => Promise<boolean>; } export type EkoResult = { taskId: string; success: boolean; stopReason: "abort" | "error" | "done"; result: string; error?: unknown; }; export type NormalAgentNode = { type: "normal"; agent: WorkflowAgent; nextAgent?: AgentNode; result?: string; }; export type ParallelAgentNode = { type: "parallel"; agents: NormalAgentNode[]; nextAgent?: AgentNode; result?: string; }; export type AgentNode = NormalAgentNode | ParallelAgentNode; //# sourceMappingURL=agent.types.d.ts.map