import { AIError } from "../../errors/ai-error.mjs"; import { ToolCall } from "../result/tool-call.type.mjs"; import { LLMTrip } from "../result/llm-trip.type.mjs"; import { AgentResult } from "../result/agent-result.type.mjs"; //#region ../ai/src/contracts/events/agent-events.type.d.ts /** * Lightweight tool metadata surfaced on tool-lifecycle events. A * deliberately thin slice of `ToolConfig` — name and description * for identity, plus the resolved present-progressive `action` * string for streaming UX. Wrapped tools may carry heavy state * (validated schemas, captured closures, large `meta` blocks); we * keep events serializable and cheap by omitting all of that. */ type ToolEventMeta = { /** Tool name as exposed to the LLM. */name: string; /** Tool description (the same string the LLM sees). */ description: string; /** * Resolved status string for UI display. The framework resolves * `ToolConfig.action` (string or `(input) => string`) into a * plain string at emit time so consumers don't have to. * `undefined` when the tool didn't declare an `action`. */ action?: string; }; /** Agent is about to begin execution */ type AgentStartingPayload = { input: string; }; /** A new LLM trip is beginning */ type AgentTripStartedPayload = { tripIndex: number; input: string; }; /** Token delta received during streaming */ type AgentStreamingPayload = { delta: string; tripIndex: number; }; /** LLM has requested a tool call */ type AgentToolCallingPayload = { tool: ToolEventMeta; input: unknown; tripIndex: number; }; /** Tool call completed successfully */ type AgentToolCalledPayload = ToolCall & { tool: ToolEventMeta; }; /** Tool call failed with an error */ type AgentToolCallingFailedPayload = { tool: ToolEventMeta; input: unknown; error: AIError; tripIndex: number; }; /** An LLM trip completed */ type AgentTripCompletedPayload = { trip: LLMTrip; }; /** Agent execution completed successfully */ type AgentCompletedPayload = { result: AgentResult; }; /** Agent execution failed */ type AgentErrorPayload = { error: AIError; }; //#endregion export { AgentCompletedPayload, AgentErrorPayload, AgentStartingPayload, AgentStreamingPayload, AgentToolCalledPayload, AgentToolCallingFailedPayload, AgentToolCallingPayload, AgentTripCompletedPayload, AgentTripStartedPayload, ToolEventMeta }; //# sourceMappingURL=agent-events.type.d.mts.map