import { BaseResult } from "./base-result.type.mjs"; import { AgentReport } from "./execution-report.type.mjs"; //#region ../ai/src/contracts/result/agent-result.type.d.ts /** * Result returned by `agent.execute()` and resolved by `stream.result`. * * **Canonical destructuring:** `const { data, text, report, usage, error }`. * * `report.trips` / `report.children` / `report.duration` hold * everything the old top-level fields did — tool dispatches live as * child nodes on `report.children` (filter `type === "tool"`), and * moving these under `report` leaves the root clean for the four * things callers reach for constantly (`data`, `text`, `usage`, * `error`). * * @example * const { data, error, report, usage } = await agent.execute(input); * * if (error) { * logger.error(error.code, { duration: report.duration }); * return; * } * * return { answer: data, cost: usage.total, latency: report.duration }; */ type AgentResult = BaseResult & { /** Discriminant for narrowing `SessionSendResult.executionResult`. */type: "agent"; /** Typed structured output when the caller passed an `output` schema. */ data?: TOutput; /** Raw text from the final LLM trip. */ text?: string; /** Trips, tool calls, status, and timing for this execution. */ report: AgentReport; }; //#endregion export { AgentResult }; //# sourceMappingURL=agent-result.type.d.mts.map