@tangle-network/agent-app 0.60.120 → 0.60.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eval/index.js +1 -1
- package/dist/eval/index.js.map +1 -1
- package/package.json +1 -1
package/dist/eval/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { verifyCompletion, extractProducedState, weightedComposite, createLlmCorrectnessChecker } from "@tangle-network/agent-eval";
|
|
3
3
|
|
|
4
4
|
// src/eval/parity.ts
|
|
5
|
-
var UNAVAILABLE = /(don'?t|do not|doesn'?t|does not) (have|see|find) (any )?(information|details|that|it listed|a listing|anything)|(don'?t|do not|couldn'?t|could not|can'?t|cannot|didn'?t|did not) (see|find)|not (sure|listed|mentioned|in (my|our|the) )|no information|isn'?t (listed|mentioned)|(can|could|I'?ll|let me|want me to) (ask|check with)/i;
|
|
5
|
+
var UNAVAILABLE = /(don'?t|do not|doesn'?t|does not) (have|see|find) (any |the )?(\w+ )?(information|details|pricing|price|that|it listed|a listing|anything)|(don'?t|do not|couldn'?t|could not|can'?t|cannot|didn'?t|did not) (see|find|tell)|not (sure|listed|mentioned|in (my|our|the) )|no information|isn'?t (listed|mentioned)|(can|could|I'?ll|let me|want me to|like me to) (ask|check with)/i;
|
|
6
6
|
var ASSERTS = /\$\s?\d|\b\d{1,2}(:\d\d)?\s*(am|pm)\b|^\s*(yes|no)\b|\b(we|there) (do not|don'?t|does not|doesn'?t) have\b|\bthere (is|are) no\b/im;
|
|
7
7
|
function gradeAnswer(text, ask) {
|
|
8
8
|
if (ask.expect) {
|
package/dist/eval/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/eval/index.ts","../../src/eval/parity.ts","../../src/eval/calibration.ts"],"sourcesContent":["/**\n * Eval — the app-shell BRIDGE to `@tangle-network/agent-eval`, not a reimpl.\n *\n * The completion/scoring ENGINE lives in agent-eval (a peer dependency):\n * `verifyCompletion`, `extractProducedState`, `weightedComposite`,\n * `createLlmCorrectnessChecker`, and the `CompletionRequirement` / `TaskGold` /\n * `ProducedState` types — all re-exported here so a consumer has one import\n * root. This module adds only what agent-eval doesn't have and what is\n * app-shell-specific:\n *\n * 1. {@link producedFromToolEvents} — the bridge: turn the structured app-tool\n * side channel's `AppToolProducedEvent`s (from a tool runtime executor's\n * `onProduced`) into the `RuntimeEventLike`s agent-eval's\n * `extractProducedState` consumes. This is the one piece that knows about\n * the app-tool channel, so it belongs here, not in the engine.\n * 2. {@link createTokenRecallChecker} — a deterministic, no-LLM\n * `CorrectnessChecker` (agent-eval ships only the LLM one). For apps/tests\n * that gate completion without a judge call.\n *\n * Full campaigns (persona simulation, traces, scorecards, held-out gates) are\n * agent-eval's `runEvalCampaign` / `AgentDriver` / `BenchmarkRunner` — use them\n * directly; this module composes with them.\n */\nimport type { RuntimeEventLike, CompletionRequirement } from '@tangle-network/agent-eval'\nimport type { AppToolProducedEvent } from '../tools/types'\n\n// Re-export the engine so consumers import completion + scoring from one place.\nexport { verifyCompletion, extractProducedState, weightedComposite, createLlmCorrectnessChecker } from '@tangle-network/agent-eval'\n\n// Parity: the same asks through two or more lanes of one app, graded the same way.\nexport { gradeAnswer, parityGate, runParityEval } from './parity'\nexport type { AskVerdict, LaneAnswer, ParityAsk, ParityLane, ParityReport } from './parity'\n\n// Calibration: prove a gate can FAIL before believing it PASSED, and prove a\n// probe can SEE before believing the zero it reported. Domain-free, so it\n// calibrates a citation gate, a form audit, or a benchmark equally.\nexport { calibrateGate, assertGateDiscriminates, measureWithControl } from './calibration'\nexport type { CalibrationCase, CalibrationOutcome, CalibrationReport, GateFn, ProbeReport } from './calibration'\nexport type {\n CompletionRequirement,\n TaskGold,\n ProducedState,\n SatisfiedBy,\n CompletionVerdict,\n CorrectnessChecker,\n RuntimeEventLike,\n} from '@tangle-network/agent-eval'\n\n/**\n * Bridge the app-tool side channel's produced events into the runtime-event\n * shape agent-eval's `extractProducedState` reads. Pipe it:\n * `verifyCompletion(taskGold, extractProducedState(producedFromToolEvents(events)), checker)`\n */\nexport function producedFromToolEvents(events: readonly AppToolProducedEvent[]): RuntimeEventLike[] {\n return events.map((e) =>\n e.type === 'proposal_created'\n ? { type: 'proposal_created', proposalId: e.proposalId, title: e.title, status: e.status, content: e.content }\n : { type: 'artifact', artifactId: `vault:${e.path}`, name: e.path, uri: `vault://${e.path}`, mimeType: 'text/markdown', content: e.content },\n )\n}\n\nconst STOPWORDS = new Set(['the', 'a', 'an', 'and', 'or', 'for', 'to', 'of', 'in', 'on', 'with', 'review', 'update', 'new', 'proposed'])\n\n/**\n * A deterministic `CorrectnessChecker` (agent-eval exports only\n * `createLlmCorrectnessChecker`). A produced item fulfils a requirement when\n * its content is substantive and recalls ≥ `minRecall` of the requirement\n * title's significant tokens. No network — the default gate for apps/tests\n * without an LLM judge. Pass to `verifyCompletion` as the checker.\n */\nexport function createTokenRecallChecker(opts: { minRecall?: number; minContentLength?: number } = {}): (\n requirement: CompletionRequirement,\n content: string,\n) => Promise<{ correct: boolean; reason: string }> {\n const minRecall = opts.minRecall ?? 0.5\n const minLen = opts.minContentLength ?? 120\n return async (requirement, content) => {\n const body = content.trim()\n if (body.length < minLen) return { correct: false, reason: `content too thin (${body.length} chars) to be the deliverable` }\n const tokens = requirement.title.toLowerCase().split(/[^a-z0-9]+/).filter((t) => t.length > 2 && !STOPWORDS.has(t))\n if (tokens.length === 0) return { correct: true, reason: 'requirement title has no significant tokens — structural match accepted' }\n const lower = body.toLowerCase()\n const hits = tokens.filter((t) => lower.includes(t)).length\n const recall = hits / tokens.length\n return recall >= minRecall\n ? { correct: true, reason: `content recalls ${hits}/${tokens.length} requirement tokens` }\n : { correct: false, reason: `content recalls only ${hits}/${tokens.length} requirement tokens` }\n }\n}\n","/**\n * Parity eval: the same asks through two or more lanes of one app (for example\n * the Router turn and the sandbox turn), graded the same way, so a lane change\n * is judged by numbers rather than by feel.\n *\n * An ask is covered (the app's own knowledge holds the answer) or uncovered\n * (it does not). A covered answer is correct when it states the expected\n * value; it fabricates when it states the common default instead. An uncovered\n * answer is correct when it says the fact is not available; asserting a value\n * or an absence (\"there is no gym\") is a fabrication.\n *\n * Use answers that differ from industry defaults (checkout 12 pm, not 11), so\n * a model guessing from priors fails visibly.\n */\n\nexport interface ParityAsk {\n id: string\n prompt: string\n /** Covered asks: the value the reply must state. Omit for an uncovered ask. */\n expect?: RegExp\n /** Covered asks: the common default that, stated instead, is a fabrication. */\n fabricated?: RegExp\n}\n\n/** One lane's answer to one ask. `failed` is a turn that did not settle with a reply. */\nexport interface LaneAnswer {\n text: string\n failed?: boolean\n /** Send to first visible words, when the lane measures it. */\n firstWordsMs?: number\n}\n\nexport type ParityLane = (prompt: string, ask: ParityAsk) => Promise<LaneAnswer>\n\nexport interface AskVerdict {\n correct: boolean\n fabricated: boolean\n}\n\nexport interface ParityReport {\n lanes: Record<string, {\n asks: number\n correct: number\n fabricated: number\n failed: number\n firstWordsMs: { p50: number | null; p90: number | null }\n }>\n asks: Array<{ id: string; prompt: string; verdicts: Record<string, AskVerdict & { text: string }>; agree: boolean }>\n}\n\n/** Says the fact is not available, or offers to find out. */\nconst UNAVAILABLE = /(don'?t|do not|doesn'?t|does not) (have|see|find) (any )?(information|details|that|it listed|a listing|anything)|(don'?t|do not|couldn'?t|could not|can'?t|cannot|didn'?t|did not) (see|find)|not (sure|listed|mentioned|in (my|our|the) )|no information|isn'?t (listed|mentioned)|(can|could|I'?ll|let me|want me to) (ask|check with)/i\n/** States a price, a time, a flat yes/no, or an absence. */\nconst ASSERTS = /\\$\\s?\\d|\\b\\d{1,2}(:\\d\\d)?\\s*(am|pm)\\b|^\\s*(yes|no)\\b|\\b(we|there) (do not|don'?t|does not|doesn'?t) have\\b|\\bthere (is|are) no\\b/im\n\nexport function gradeAnswer(text: string, ask: ParityAsk): AskVerdict {\n if (ask.expect) {\n const stated = ask.expect.test(text)\n return { correct: stated, fabricated: !stated && Boolean(ask.fabricated?.test(text)) }\n }\n const asserts = ASSERTS.test(text)\n return { correct: UNAVAILABLE.test(text) && !asserts, fabricated: asserts }\n}\n\nfunction quantile(values: number[], q: number): number | null {\n if (!values.length) return null\n const sorted = [...values].sort((a, b) => a - b)\n return sorted[Math.min(sorted.length - 1, Math.floor(sorted.length * q))]!\n}\n\n/**\n * Ask every lane every question, one ask at a time per lane (lanes run in\n * parallel), and grade each answer the same way. `style` is appended to every\n * other ask, so the score holds with and without a reply-style instruction.\n */\nexport async function runParityEval(options: {\n asks: readonly ParityAsk[]\n lanes: Record<string, ParityLane>\n style?: string\n}): Promise<ParityReport> {\n const names = Object.keys(options.lanes)\n const prompts = options.asks.map((ask, index) => options.style && index % 2 ? `${ask.prompt} ${options.style}` : ask.prompt)\n const answers = await Promise.all(names.map(async name => {\n const out: LaneAnswer[] = []\n for (const [index, ask] of options.asks.entries()) {\n try { out.push(await options.lanes[name]!(prompts[index]!, ask)) }\n catch (error) { out.push({ text: error instanceof Error ? error.message : String(error), failed: true }) }\n }\n return out\n }))\n const asks = options.asks.map((ask, index) => {\n const verdicts = Object.fromEntries(names.map((name, lane) => {\n const answer = answers[lane]![index]!\n const verdict = answer.failed ? { correct: false, fabricated: false } : gradeAnswer(answer.text, ask)\n return [name, { ...verdict, text: answer.text }]\n }))\n const outcomes = Object.values(verdicts).map(verdict => verdict.correct)\n return { id: ask.id, prompt: prompts[index]!, verdicts, agree: outcomes.every(value => value === outcomes[0]) }\n })\n const lanes = Object.fromEntries(names.map((name, lane) => {\n const laneAnswers = answers[lane]!\n const firstWords = laneAnswers.flatMap(answer => answer.firstWordsMs === undefined ? [] : [answer.firstWordsMs])\n return [name, {\n asks: asks.length,\n correct: asks.filter(ask => ask.verdicts[name]!.correct).length,\n fabricated: asks.filter(ask => ask.verdicts[name]!.fabricated).length,\n failed: laneAnswers.filter(answer => answer.failed).length,\n firstWordsMs: { p50: quantile(firstWords, 0.5), p90: quantile(firstWords, 0.9) },\n }]\n }))\n return { lanes, asks }\n}\n\n/** The release bar: every lane at or above `minCorrect` of its asks, with no fabrication and no failed turn. */\nexport function parityGate(report: ParityReport, bar: { minCorrectRatio: number; maxFabricated?: number; maxFailed?: number }) {\n const reasons = Object.entries(report.lanes).flatMap(([name, lane]) => [\n ...(lane.correct < Math.ceil(lane.asks * bar.minCorrectRatio) ? [`${name}: ${lane.correct}/${lane.asks} correct, below ${Math.ceil(lane.asks * bar.minCorrectRatio)}`] : []),\n ...(lane.fabricated > (bar.maxFabricated ?? 0) ? [`${name}: ${lane.fabricated} fabricated`] : []),\n ...(lane.failed > (bar.maxFailed ?? 0) ? [`${name}: ${lane.failed} failed turns`] : []),\n ])\n return { pass: reasons.length === 0, reasons }\n}\n","/**\n * Calibration — prove a gate can FAIL before believing that it PASSED, and\n * prove a probe can SEE before believing the zero it reported.\n *\n * Every expensive failure this package has shipped was a check that verified\n * its own input instead of the world, and reported green:\n *\n * - `quote_verification 16/16` passed a work product whose nine citations\n * claimed a figure the cited document never mentions.\n * - `audit_form passed=3 failed=0` passed a form fill whose values landed in\n * \"Combat zone\" — the audit re-read the field paths the writer had just\n * invented, so a wrong path could not be wrong.\n * - `evidence_coverage 0/0` passed vacuously because the artifact it was\n * counting targets from was null.\n * - A benchmark reported 6/8 for the product while a bare\n * \"You are a helpful assistant.\" scored 8/8 on the same cases.\n *\n * A gate is only evidence if it REJECTS something. A metric is only evidence\n * if a worse system scores worse on it. Neither property is implied by a\n * green run, and neither is visible in the output — which is why both have to\n * be asserted separately, in code, next to the gate.\n *\n * This module is deliberately domain-free: a \"gate\" is any predicate over any\n * input. Products supply the known-good and known-bad cases, because only the\n * product knows what bad looks like in its domain.\n */\n\n/** A case whose verdict is known in advance, used to calibrate a gate. */\nexport interface CalibrationCase<TInput> {\n /** What this case represents, e.g. `'quote that does not occur in the source'`. */\n readonly label: string\n readonly input: TInput\n /** `'reject'` — the gate MUST refuse this. `'accept'` — it MUST allow it. */\n readonly expect: 'accept' | 'reject'\n}\n\nexport interface CalibrationOutcome {\n readonly label: string\n readonly expected: 'accept' | 'reject'\n readonly actual: 'accept' | 'reject'\n readonly ok: boolean\n /** Set when the gate threw; a throw counts as `'reject'`. */\n readonly threw?: string\n}\n\nexport interface CalibrationReport {\n /** True only when every case matched AND both controls were present. */\n readonly discriminates: boolean\n readonly outcomes: readonly CalibrationOutcome[]\n readonly failures: readonly CalibrationOutcome[]\n /** Why the gate is not trustworthy. Absent when `discriminates` is true. */\n readonly reason?: string\n}\n\n/**\n * A gate under calibration. Returning `false` OR throwing both count as a\n * rejection — a fail-loud gate (`ToolInputError`) and a boolean gate calibrate\n * through the same path.\n */\nexport type GateFn<TInput> = (input: TInput) => boolean | Promise<boolean>\n\n/**\n * Run a gate against cases whose verdicts are known, and report whether it\n * actually discriminates.\n *\n * Requires BOTH controls:\n * - at least one `'reject'` case — without it a gate that returns `true`\n * unconditionally is indistinguishable from a working one. This is the\n * control that all four failures above were missing.\n * - at least one `'accept'` case — without it a gate that refuses everything\n * scores perfectly, and an unsatisfiable gate does not stop bad work, it\n * selects for invented work (measured: 38 fabricated citations written to\n * clear a coverage gate no honest answer could satisfy).\n */\nexport async function calibrateGate<TInput>(\n gate: GateFn<TInput>,\n cases: readonly CalibrationCase<TInput>[],\n): Promise<CalibrationReport> {\n const outcomes: CalibrationOutcome[] = []\n for (const c of cases) {\n let actual: 'accept' | 'reject'\n let threw: string | undefined\n try {\n actual = (await gate(c.input)) ? 'accept' : 'reject'\n } catch (err) {\n actual = 'reject'\n threw = err instanceof Error ? err.message : String(err)\n }\n outcomes.push({ label: c.label, expected: c.expect, actual, ok: actual === c.expect, ...(threw ? { threw } : {}) })\n }\n\n const failures = outcomes.filter((o) => !o.ok)\n const hasNegative = cases.some((c) => c.expect === 'reject')\n const hasPositive = cases.some((c) => c.expect === 'accept')\n\n const reason = !hasNegative\n ? 'no negative control: every case expects acceptance, so a gate that never refuses would score perfectly'\n : !hasPositive\n ? 'no positive control: every case expects rejection, so a gate that refuses everything would score perfectly'\n : failures.length > 0\n ? `${failures.length}/${outcomes.length} cases disagreed: ${failures.map((f) => `${f.label} expected ${f.expected}, got ${f.actual}`).join('; ')}`\n : undefined\n\n return { discriminates: reason === undefined, outcomes, failures, ...(reason ? { reason } : {}) }\n}\n\n/**\n * `calibrateGate`, but throws instead of reporting. Use in a test or at wiring\n * time so an uncalibrated gate cannot ship silently.\n */\nexport async function assertGateDiscriminates<TInput>(\n name: string,\n gate: GateFn<TInput>,\n cases: readonly CalibrationCase<TInput>[],\n): Promise<CalibrationReport> {\n const report = await calibrateGate(gate, cases)\n if (!report.discriminates) throw new Error(`gate \"${name}\" is not evidence — ${report.reason}`)\n return report\n}\n\nexport interface ProbeReport<TValue> {\n /** True when the positive control registered something, so a zero is real. */\n readonly canSee: boolean\n readonly measured: number\n readonly control: number\n readonly value: TValue\n readonly reason?: string\n}\n\n/**\n * Measure something, but only after proving the instrument can register a\n * non-zero — because an absence is a claim about the measurement first.\n *\n * Six blind probes were mistaken for real zeros in a single day: a SQL `LIKE`\n * over a column the product encrypts (which equally returned 0 for `\"text\"`\n * across every row — the tell), a `grep` run against worktrees on stale\n * branches, a status-code comparison that never read the response bodies, a\n * live event count taken from a run that was never dispatched, `rg --hidden`\n * silently exiting 2 because `rg` was aliased to `grep`, and an intercepted\n * `git show` returning an empty diff. Each nearly caused a wrong fix.\n *\n * `control` must count something that MUST exist. If it counts zero, the\n * measurement is unusable regardless of what `measure` returned.\n */\nexport async function measureWithControl<TValue>(opts: {\n readonly measure: () => TValue | Promise<TValue>\n /** Must return a value whose count is non-zero, or the probe is blind. */\n readonly control: () => TValue | Promise<TValue>\n readonly count: (value: TValue) => number\n /** Describes what the control counts, for the failure message. */\n readonly controlLabel: string\n}): Promise<ProbeReport<TValue>> {\n const value = await opts.measure()\n const controlValue = await opts.control()\n const measured = opts.count(value)\n const control = opts.count(controlValue)\n return control > 0\n ? { canSee: true, measured, control, value }\n : {\n canSee: false,\n measured,\n control,\n value,\n reason: `probe is blind: the positive control (${opts.controlLabel}) counted 0, so the measured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AC,OAAO,KAAK,MAAM,OAAO,MAAM,OAAO,MAAM,MAAM,MAAM,MAAM,QAAQ,UAAU,UAAU,OAAO,UAAU,CAAC;AAShI,SAAS,yBAAyB,OAA0D,CAAC,GAGjD;AACjD,QAAM,YAAY,KAAK,aAAa;AACpC,QAAM,SAAS,KAAK,oBAAoB;AACxC,SAAO,OAAO,aAAa,YAAY;AACrC,UAAM,OAAO,QAAQ,KAAK;AAC1B,QAAI,KAAK,SAAS,OAAQ,QAAO,EAAE,SAAS,OAAO,QAAQ,qBAAqB,KAAK,MAAM,gCAAgC;AAC3H,UAAM,SAAS,YAAY,MAAM,YAAY,EAAE,MAAM,YAAY,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,KAAK,CAAC,UAAU,IAAI,CAAC,CAAC;AAClH,QAAI,OAAO,WAAW,EAAG,QAAO,EAAE,SAAS,MAAM,QAAQ,+EAA0E;AACnI,UAAM,QAAQ,KAAK,YAAY;AAC/B,UAAM,OAAO,OAAO,OAAO,CAAC,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE;AACrD,UAAM,SAAS,OAAO,OAAO;AAC7B,WAAO,UAAU,YACb,EAAE,SAAS,MAAM,QAAQ,mBAAmB,IAAI,IAAI,OAAO,MAAM,sBAAsB,IACvF,EAAE,SAAS,OAAO,QAAQ,wBAAwB,IAAI,IAAI,OAAO,MAAM,sBAAsB;AAAA,EACnG;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/eval/index.ts","../../src/eval/parity.ts","../../src/eval/calibration.ts"],"sourcesContent":["/**\n * Eval — the app-shell BRIDGE to `@tangle-network/agent-eval`, not a reimpl.\n *\n * The completion/scoring ENGINE lives in agent-eval (a peer dependency):\n * `verifyCompletion`, `extractProducedState`, `weightedComposite`,\n * `createLlmCorrectnessChecker`, and the `CompletionRequirement` / `TaskGold` /\n * `ProducedState` types — all re-exported here so a consumer has one import\n * root. This module adds only what agent-eval doesn't have and what is\n * app-shell-specific:\n *\n * 1. {@link producedFromToolEvents} — the bridge: turn the structured app-tool\n * side channel's `AppToolProducedEvent`s (from a tool runtime executor's\n * `onProduced`) into the `RuntimeEventLike`s agent-eval's\n * `extractProducedState` consumes. This is the one piece that knows about\n * the app-tool channel, so it belongs here, not in the engine.\n * 2. {@link createTokenRecallChecker} — a deterministic, no-LLM\n * `CorrectnessChecker` (agent-eval ships only the LLM one). For apps/tests\n * that gate completion without a judge call.\n *\n * Full campaigns (persona simulation, traces, scorecards, held-out gates) are\n * agent-eval's `runEvalCampaign` / `AgentDriver` / `BenchmarkRunner` — use them\n * directly; this module composes with them.\n */\nimport type { RuntimeEventLike, CompletionRequirement } from '@tangle-network/agent-eval'\nimport type { AppToolProducedEvent } from '../tools/types'\n\n// Re-export the engine so consumers import completion + scoring from one place.\nexport { verifyCompletion, extractProducedState, weightedComposite, createLlmCorrectnessChecker } from '@tangle-network/agent-eval'\n\n// Parity: the same asks through two or more lanes of one app, graded the same way.\nexport { gradeAnswer, parityGate, runParityEval } from './parity'\nexport type { AskVerdict, LaneAnswer, ParityAsk, ParityLane, ParityReport } from './parity'\n\n// Calibration: prove a gate can FAIL before believing it PASSED, and prove a\n// probe can SEE before believing the zero it reported. Domain-free, so it\n// calibrates a citation gate, a form audit, or a benchmark equally.\nexport { calibrateGate, assertGateDiscriminates, measureWithControl } from './calibration'\nexport type { CalibrationCase, CalibrationOutcome, CalibrationReport, GateFn, ProbeReport } from './calibration'\nexport type {\n CompletionRequirement,\n TaskGold,\n ProducedState,\n SatisfiedBy,\n CompletionVerdict,\n CorrectnessChecker,\n RuntimeEventLike,\n} from '@tangle-network/agent-eval'\n\n/**\n * Bridge the app-tool side channel's produced events into the runtime-event\n * shape agent-eval's `extractProducedState` reads. Pipe it:\n * `verifyCompletion(taskGold, extractProducedState(producedFromToolEvents(events)), checker)`\n */\nexport function producedFromToolEvents(events: readonly AppToolProducedEvent[]): RuntimeEventLike[] {\n return events.map((e) =>\n e.type === 'proposal_created'\n ? { type: 'proposal_created', proposalId: e.proposalId, title: e.title, status: e.status, content: e.content }\n : { type: 'artifact', artifactId: `vault:${e.path}`, name: e.path, uri: `vault://${e.path}`, mimeType: 'text/markdown', content: e.content },\n )\n}\n\nconst STOPWORDS = new Set(['the', 'a', 'an', 'and', 'or', 'for', 'to', 'of', 'in', 'on', 'with', 'review', 'update', 'new', 'proposed'])\n\n/**\n * A deterministic `CorrectnessChecker` (agent-eval exports only\n * `createLlmCorrectnessChecker`). A produced item fulfils a requirement when\n * its content is substantive and recalls ≥ `minRecall` of the requirement\n * title's significant tokens. No network — the default gate for apps/tests\n * without an LLM judge. Pass to `verifyCompletion` as the checker.\n */\nexport function createTokenRecallChecker(opts: { minRecall?: number; minContentLength?: number } = {}): (\n requirement: CompletionRequirement,\n content: string,\n) => Promise<{ correct: boolean; reason: string }> {\n const minRecall = opts.minRecall ?? 0.5\n const minLen = opts.minContentLength ?? 120\n return async (requirement, content) => {\n const body = content.trim()\n if (body.length < minLen) return { correct: false, reason: `content too thin (${body.length} chars) to be the deliverable` }\n const tokens = requirement.title.toLowerCase().split(/[^a-z0-9]+/).filter((t) => t.length > 2 && !STOPWORDS.has(t))\n if (tokens.length === 0) return { correct: true, reason: 'requirement title has no significant tokens — structural match accepted' }\n const lower = body.toLowerCase()\n const hits = tokens.filter((t) => lower.includes(t)).length\n const recall = hits / tokens.length\n return recall >= minRecall\n ? { correct: true, reason: `content recalls ${hits}/${tokens.length} requirement tokens` }\n : { correct: false, reason: `content recalls only ${hits}/${tokens.length} requirement tokens` }\n }\n}\n","/**\n * Parity eval: the same asks through two or more lanes of one app (for example\n * the Router turn and the sandbox turn), graded the same way, so a lane change\n * is judged by numbers rather than by feel.\n *\n * An ask is covered (the app's own knowledge holds the answer) or uncovered\n * (it does not). A covered answer is correct when it states the expected\n * value; it fabricates when it states the common default instead. An uncovered\n * answer is correct when it says the fact is not available; asserting a value\n * or an absence (\"there is no gym\") is a fabrication.\n *\n * Use answers that differ from industry defaults (checkout 12 pm, not 11), so\n * a model guessing from priors fails visibly.\n */\n\nexport interface ParityAsk {\n id: string\n prompt: string\n /** Covered asks: the value the reply must state. Omit for an uncovered ask. */\n expect?: RegExp\n /** Covered asks: the common default that, stated instead, is a fabrication. */\n fabricated?: RegExp\n}\n\n/** One lane's answer to one ask. `failed` is a turn that did not settle with a reply. */\nexport interface LaneAnswer {\n text: string\n failed?: boolean\n /** Send to first visible words, when the lane measures it. */\n firstWordsMs?: number\n}\n\nexport type ParityLane = (prompt: string, ask: ParityAsk) => Promise<LaneAnswer>\n\nexport interface AskVerdict {\n correct: boolean\n fabricated: boolean\n}\n\nexport interface ParityReport {\n lanes: Record<string, {\n asks: number\n correct: number\n fabricated: number\n failed: number\n firstWordsMs: { p50: number | null; p90: number | null }\n }>\n asks: Array<{ id: string; prompt: string; verdicts: Record<string, AskVerdict & { text: string }>; agree: boolean }>\n}\n\n/** Says the fact is not available, or offers to find out. */\nconst UNAVAILABLE = /(don'?t|do not|doesn'?t|does not) (have|see|find) (any |the )?(\\w+ )?(information|details|pricing|price|that|it listed|a listing|anything)|(don'?t|do not|couldn'?t|could not|can'?t|cannot|didn'?t|did not) (see|find|tell)|not (sure|listed|mentioned|in (my|our|the) )|no information|isn'?t (listed|mentioned)|(can|could|I'?ll|let me|want me to|like me to) (ask|check with)/i\n/** States a price, a time, a flat yes/no, or an absence. */\nconst ASSERTS = /\\$\\s?\\d|\\b\\d{1,2}(:\\d\\d)?\\s*(am|pm)\\b|^\\s*(yes|no)\\b|\\b(we|there) (do not|don'?t|does not|doesn'?t) have\\b|\\bthere (is|are) no\\b/im\n\nexport function gradeAnswer(text: string, ask: ParityAsk): AskVerdict {\n if (ask.expect) {\n const stated = ask.expect.test(text)\n return { correct: stated, fabricated: !stated && Boolean(ask.fabricated?.test(text)) }\n }\n const asserts = ASSERTS.test(text)\n return { correct: UNAVAILABLE.test(text) && !asserts, fabricated: asserts }\n}\n\nfunction quantile(values: number[], q: number): number | null {\n if (!values.length) return null\n const sorted = [...values].sort((a, b) => a - b)\n return sorted[Math.min(sorted.length - 1, Math.floor(sorted.length * q))]!\n}\n\n/**\n * Ask every lane every question, one ask at a time per lane (lanes run in\n * parallel), and grade each answer the same way. `style` is appended to every\n * other ask, so the score holds with and without a reply-style instruction.\n */\nexport async function runParityEval(options: {\n asks: readonly ParityAsk[]\n lanes: Record<string, ParityLane>\n style?: string\n}): Promise<ParityReport> {\n const names = Object.keys(options.lanes)\n const prompts = options.asks.map((ask, index) => options.style && index % 2 ? `${ask.prompt} ${options.style}` : ask.prompt)\n const answers = await Promise.all(names.map(async name => {\n const out: LaneAnswer[] = []\n for (const [index, ask] of options.asks.entries()) {\n try { out.push(await options.lanes[name]!(prompts[index]!, ask)) }\n catch (error) { out.push({ text: error instanceof Error ? error.message : String(error), failed: true }) }\n }\n return out\n }))\n const asks = options.asks.map((ask, index) => {\n const verdicts = Object.fromEntries(names.map((name, lane) => {\n const answer = answers[lane]![index]!\n const verdict = answer.failed ? { correct: false, fabricated: false } : gradeAnswer(answer.text, ask)\n return [name, { ...verdict, text: answer.text }]\n }))\n const outcomes = Object.values(verdicts).map(verdict => verdict.correct)\n return { id: ask.id, prompt: prompts[index]!, verdicts, agree: outcomes.every(value => value === outcomes[0]) }\n })\n const lanes = Object.fromEntries(names.map((name, lane) => {\n const laneAnswers = answers[lane]!\n const firstWords = laneAnswers.flatMap(answer => answer.firstWordsMs === undefined ? [] : [answer.firstWordsMs])\n return [name, {\n asks: asks.length,\n correct: asks.filter(ask => ask.verdicts[name]!.correct).length,\n fabricated: asks.filter(ask => ask.verdicts[name]!.fabricated).length,\n failed: laneAnswers.filter(answer => answer.failed).length,\n firstWordsMs: { p50: quantile(firstWords, 0.5), p90: quantile(firstWords, 0.9) },\n }]\n }))\n return { lanes, asks }\n}\n\n/** The release bar: every lane at or above `minCorrect` of its asks, with no fabrication and no failed turn. */\nexport function parityGate(report: ParityReport, bar: { minCorrectRatio: number; maxFabricated?: number; maxFailed?: number }) {\n const reasons = Object.entries(report.lanes).flatMap(([name, lane]) => [\n ...(lane.correct < Math.ceil(lane.asks * bar.minCorrectRatio) ? [`${name}: ${lane.correct}/${lane.asks} correct, below ${Math.ceil(lane.asks * bar.minCorrectRatio)}`] : []),\n ...(lane.fabricated > (bar.maxFabricated ?? 0) ? [`${name}: ${lane.fabricated} fabricated`] : []),\n ...(lane.failed > (bar.maxFailed ?? 0) ? [`${name}: ${lane.failed} failed turns`] : []),\n ])\n return { pass: reasons.length === 0, reasons }\n}\n","/**\n * Calibration — prove a gate can FAIL before believing that it PASSED, and\n * prove a probe can SEE before believing the zero it reported.\n *\n * Every expensive failure this package has shipped was a check that verified\n * its own input instead of the world, and reported green:\n *\n * - `quote_verification 16/16` passed a work product whose nine citations\n * claimed a figure the cited document never mentions.\n * - `audit_form passed=3 failed=0` passed a form fill whose values landed in\n * \"Combat zone\" — the audit re-read the field paths the writer had just\n * invented, so a wrong path could not be wrong.\n * - `evidence_coverage 0/0` passed vacuously because the artifact it was\n * counting targets from was null.\n * - A benchmark reported 6/8 for the product while a bare\n * \"You are a helpful assistant.\" scored 8/8 on the same cases.\n *\n * A gate is only evidence if it REJECTS something. A metric is only evidence\n * if a worse system scores worse on it. Neither property is implied by a\n * green run, and neither is visible in the output — which is why both have to\n * be asserted separately, in code, next to the gate.\n *\n * This module is deliberately domain-free: a \"gate\" is any predicate over any\n * input. Products supply the known-good and known-bad cases, because only the\n * product knows what bad looks like in its domain.\n */\n\n/** A case whose verdict is known in advance, used to calibrate a gate. */\nexport interface CalibrationCase<TInput> {\n /** What this case represents, e.g. `'quote that does not occur in the source'`. */\n readonly label: string\n readonly input: TInput\n /** `'reject'` — the gate MUST refuse this. `'accept'` — it MUST allow it. */\n readonly expect: 'accept' | 'reject'\n}\n\nexport interface CalibrationOutcome {\n readonly label: string\n readonly expected: 'accept' | 'reject'\n readonly actual: 'accept' | 'reject'\n readonly ok: boolean\n /** Set when the gate threw; a throw counts as `'reject'`. */\n readonly threw?: string\n}\n\nexport interface CalibrationReport {\n /** True only when every case matched AND both controls were present. */\n readonly discriminates: boolean\n readonly outcomes: readonly CalibrationOutcome[]\n readonly failures: readonly CalibrationOutcome[]\n /** Why the gate is not trustworthy. Absent when `discriminates` is true. */\n readonly reason?: string\n}\n\n/**\n * A gate under calibration. Returning `false` OR throwing both count as a\n * rejection — a fail-loud gate (`ToolInputError`) and a boolean gate calibrate\n * through the same path.\n */\nexport type GateFn<TInput> = (input: TInput) => boolean | Promise<boolean>\n\n/**\n * Run a gate against cases whose verdicts are known, and report whether it\n * actually discriminates.\n *\n * Requires BOTH controls:\n * - at least one `'reject'` case — without it a gate that returns `true`\n * unconditionally is indistinguishable from a working one. This is the\n * control that all four failures above were missing.\n * - at least one `'accept'` case — without it a gate that refuses everything\n * scores perfectly, and an unsatisfiable gate does not stop bad work, it\n * selects for invented work (measured: 38 fabricated citations written to\n * clear a coverage gate no honest answer could satisfy).\n */\nexport async function calibrateGate<TInput>(\n gate: GateFn<TInput>,\n cases: readonly CalibrationCase<TInput>[],\n): Promise<CalibrationReport> {\n const outcomes: CalibrationOutcome[] = []\n for (const c of cases) {\n let actual: 'accept' | 'reject'\n let threw: string | undefined\n try {\n actual = (await gate(c.input)) ? 'accept' : 'reject'\n } catch (err) {\n actual = 'reject'\n threw = err instanceof Error ? err.message : String(err)\n }\n outcomes.push({ label: c.label, expected: c.expect, actual, ok: actual === c.expect, ...(threw ? { threw } : {}) })\n }\n\n const failures = outcomes.filter((o) => !o.ok)\n const hasNegative = cases.some((c) => c.expect === 'reject')\n const hasPositive = cases.some((c) => c.expect === 'accept')\n\n const reason = !hasNegative\n ? 'no negative control: every case expects acceptance, so a gate that never refuses would score perfectly'\n : !hasPositive\n ? 'no positive control: every case expects rejection, so a gate that refuses everything would score perfectly'\n : failures.length > 0\n ? `${failures.length}/${outcomes.length} cases disagreed: ${failures.map((f) => `${f.label} expected ${f.expected}, got ${f.actual}`).join('; ')}`\n : undefined\n\n return { discriminates: reason === undefined, outcomes, failures, ...(reason ? { reason } : {}) }\n}\n\n/**\n * `calibrateGate`, but throws instead of reporting. Use in a test or at wiring\n * time so an uncalibrated gate cannot ship silently.\n */\nexport async function assertGateDiscriminates<TInput>(\n name: string,\n gate: GateFn<TInput>,\n cases: readonly CalibrationCase<TInput>[],\n): Promise<CalibrationReport> {\n const report = await calibrateGate(gate, cases)\n if (!report.discriminates) throw new Error(`gate \"${name}\" is not evidence — ${report.reason}`)\n return report\n}\n\nexport interface ProbeReport<TValue> {\n /** True when the positive control registered something, so a zero is real. */\n readonly canSee: boolean\n readonly measured: number\n readonly control: number\n readonly value: TValue\n readonly reason?: string\n}\n\n/**\n * Measure something, but only after proving the instrument can register a\n * non-zero — because an absence is a claim about the measurement first.\n *\n * Six blind probes were mistaken for real zeros in a single day: a SQL `LIKE`\n * over a column the product encrypts (which equally returned 0 for `\"text\"`\n * across every row — the tell), a `grep` run against worktrees on stale\n * branches, a status-code comparison that never read the response bodies, a\n * live event count taken from a run that was never dispatched, `rg --hidden`\n * silently exiting 2 because `rg` was aliased to `grep`, and an intercepted\n * `git show` returning an empty diff. Each nearly caused a wrong fix.\n *\n * `control` must count something that MUST exist. If it counts zero, the\n * measurement is unusable regardless of what `measure` returned.\n */\nexport async function measureWithControl<TValue>(opts: {\n readonly measure: () => TValue | Promise<TValue>\n /** Must return a value whose count is non-zero, or the probe is blind. */\n readonly control: () => TValue | Promise<TValue>\n readonly count: (value: TValue) => number\n /** Describes what the control counts, for the failure message. */\n readonly controlLabel: string\n}): Promise<ProbeReport<TValue>> {\n const value = await opts.measure()\n const controlValue = await opts.control()\n const measured = opts.count(value)\n const control = opts.count(controlValue)\n return control > 0\n ? { canSee: true, measured, control, value }\n : {\n canSee: false,\n measured,\n control,\n value,\n reason: `probe is blind: the positive control (${opts.controlLabel}) counted 0, so the measured ${measured} carries no information`,\n }\n}\n"],"mappings":";AA2BA,SAAS,kBAAkB,sBAAsB,mBAAmB,mCAAmC;;;ACwBvG,IAAM,cAAc;AAEpB,IAAM,UAAU;AAET,SAAS,YAAY,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