/** * `experimental_stub` — a tool stub that answers PER INVOCATION, for the eval * tier's `stubs`. The rules and their matching are in `core/stub-rules.ts`; this * is the typed helper and the check over a run's recorded calls. * * ONE experimental root (STABILITY.md "one root per feature"): `rest` and * `called` are members, so no stable name rests on an unstable one. The rules * themselves are plain data (`ToolStub`): a `.mjs` literal of the same shape is * accepted, because the spec boundary parses `stubs` either way. */ import type { Check } from "./check.js"; import type { Trace } from "./harness-test.js"; import { type ArgvPattern, type ArgvToken, type StubRule, type ToolStub } from "./core/stub-rules.js"; /** Bounds for {@link experimental_stub.called}. */ export interface StubCalledBounds { /** At least this many matching calls. Default 1, or 0 when `max` is given. */ readonly min?: number; /** At most this many. Default: no limit. */ readonly max?: number; /** Order-free tokens after the positional prefix (needs a trailing `rest`). */ readonly contains?: readonly ArgvToken[]; } /** * A check over a run's stub log: the ANSWERED invocations of `name` that match * `argv` (and `bounds.contains`) number within `[min, max]`. A call no rule * answered is not counted (it is reported as unanswered, and `vigiles eval` * fails the run on it). A trace with no stub log * FAILS — "called at most 0 times" must not pass because nothing was recorded. */ declare function called(name: string, argv: ArgvPattern, bounds?: StubCalledBounds): Check; /** Parse one stub: a throw names the bad field; the value is plain data. */ declare function stubOf(name: string, rules: readonly [StubRule, ...StubRule[]]): ToolStub; /** * A stub for the binary `name`: a non-empty list of rules over its argv, first * match wins. An invocation no rule answers fails the eval — name each command * the agent runs; do not answer everything with one output. * * ```ts * const { rest } = experimental_stub; * const gh = experimental_stub("gh", [ * { argv: ["issue", "create", rest], reply: { kind: "always", stdout: "https://github.com/o/r/issues/9001\n" } }, * { argv: ["api", /^repos\/o\/r\/issues\?/], reply: { kind: "always", stdout: "[]" } }, * ]); * ``` * * `experimental_stub.rest` — "any further tokens", last position only. * `experimental_stub.called(name, argv, { min, max, contains })` — a check over * the run's recorded calls. * * @experimental */ export declare const experimental_stub: typeof stubOf & { rest: import("./core/stub-rules.js").ArgvRest; called: typeof called; }; export {}; //# sourceMappingURL=stub.d.ts.map