normalizeHarnessRun
normalizeHarnessRun<
TInput,TMetadata,TOutput>(input,result,context?):HarnessRun<TOutput>
Normalizes a lightweight harness result into the reporter-facing run shape.
Type Parameters
Section titled “Type Parameters”TInput
Section titled “TInput”TInput = unknown
TMetadata
Section titled “TMetadata”TMetadata extends HarnessMetadata = HarnessMetadata
TOutput
Section titled “TOutput”TOutput extends JsonValue | undefined = JsonValue | undefined
Parameters
Section titled “Parameters”TInput
Original input passed to the harness.
result
Section titled “result”HarnessResultLike<TOutput>
Lightweight result or pre-normalized harness run.
context?
Section titled “context?”HarnessContext<TMetadata>
Optional per-run context used to merge artifacts.
Returns
Section titled “Returns”HarnessRun<TOutput>
Example
Section titled “Example”const run = normalizeHarnessRun("Refund invoice inv_123", { output: { status: "approved" }, toolCalls: [{ name: "lookupInvoice", arguments: { invoiceId: "inv_123" } }], usage: { provider: "openai", model: "gpt-4o-mini" },});
expect(toolCalls(run.session)).toHaveLength(1);