Skip to content

normalizeHarnessRun

normalizeHarnessRun<TInput, TOutput>(input, result, context?): HarnessRun<TOutput>

Normalizes a lightweight harness result into the reporter-facing run shape.

TInput = unknown

TOutput extends JsonValue | undefined = JsonValue | undefined

TInput

Original input passed to the harness.

HarnessResultLike<TOutput>

Lightweight result or pre-normalized harness run.

HarnessContext

Optional per-run context used to merge artifacts.

HarnessRun<TOutput>

const run = normalizeHarnessRun("Refund invoice inv_123", {
output: { status: "approved" },
events: [
{ type: "message", role: "user", content: "Refund invoice inv_123" },
{
type: "tool_call",
id: "call_lookup",
name: "lookupInvoice",
arguments: { invoiceId: "inv_123" },
},
{
type: "tool_result",
toolCallId: "call_lookup",
name: "lookupInvoice",
content: { refundable: true },
},
],
usage: { provider: "openai", model: "gpt-4o-mini" },
});
expect(toolCalls(run)).toHaveLength(1);