import { AIError } from "../../errors/ai-error.mjs"; import { Usage } from "./usage.type.mjs"; import { AttemptEntry } from "./attempt-entry.type.mjs"; import { BaseReport } from "./base-report.type.mjs"; import { AgentReport } from "./execution-report.type.mjs"; import { AgentResult } from "./agent-result.type.mjs"; //#region ../ai/src/contracts/result/step-result.type.d.ts /** * Frozen snapshot of a completed workflow step, stored under * `WorkflowReport.steps[name]` and `ctx.steps[name]`. * * For agent-backed steps, three forensic fields are surfaced at the * top level for easy inspection: * * - `agentReport` — trips, tool calls, status, timing for the agent * call that produced this step's output. Mirrors * `executionResult.report` but is directly reachable without * narrowing the union. * - `agentUsage` — token counts for this step in isolation. Sum of * all `steps[*].agentUsage` equals the workflow-level `usage`. * - `executionResult` — the full `AgentResult` (or custom `run` * return value). Use this when you need `data` / `text` / `error` * alongside the report. */ type StepSnapshot = Readonly<{ output: unknown; skipped: boolean; status: "completed" | "skipped" | "failed"; startedAt: string; endedAt: string; duration: number; attempts: number; attemptHistory: AttemptEntry[]; error?: AIError; state: Readonly>; /** Full agent result when the step ran an agent; absent for `run` / skipped / parallel steps. */ executionResult?: AgentResult; /** Shortcut: `executionResult.report` when present. */ agentReport?: AgentReport; /** Shortcut: `executionResult.usage` when present. */ agentUsage?: Usage; /** * Reports of any executable (agent, workflow, tool, supervisor, ...) * a `run` callback invoked DIRECTLY — `agent.execute(...)` rather * than the declarative `agent:` field — captured via the same ambient * run-frame a supervisor/team/orchestrator callback already gets. * Absent for `agent` / skipped / parallel steps, or a `run` step that * invoked nothing observable. */ children?: BaseReport[]; /** Nested children for parallel steps. */ steps?: Record; }>; //#endregion export { StepSnapshot }; //# sourceMappingURL=step-result.type.d.mts.map