// A harness that answers from a script instead of a model. For tests and for // exercising a machine's plumbing without spending on inference. import type { Harness, HarnessRequest } from "../harness.ts"; import type { HarnessResult } from "../types.ts"; export function scriptedHarness(reply: (request: HarnessRequest) => string | Promise, name = "scripted"): Harness { return { name, async run(request): Promise { const output = await reply(request); return { trajectory: [ { role: "user", content: request.input }, { role: "assistant", content: output }, ], output, model: request.model, stopReason: "stop", }; }, }; }