@tangle-network/agent-bench 0.14.2 → 1.0.0

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.
Files changed (218) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +2 -3
  3. package/dist/adapters.d.ts +2 -5
  4. package/dist/adapters.js +3 -4
  5. package/dist/benchmarks/_harness.d.ts +17 -20
  6. package/dist/benchmarks/_harness.js +4 -4
  7. package/dist/benchmarks/_harness.js.map +1 -1
  8. package/dist/benchmarks/aec-bench.d.ts +1 -4
  9. package/dist/benchmarks/aec-bench.js +1 -2
  10. package/dist/benchmarks/agentbench.d.ts +2 -5
  11. package/dist/benchmarks/agentbench.js +1 -2
  12. package/dist/benchmarks/appworld.d.ts +8 -10
  13. package/dist/benchmarks/appworld.js +23 -23
  14. package/dist/benchmarks/appworld.js.map +1 -1
  15. package/dist/benchmarks/bfcl.d.ts +2 -5
  16. package/dist/benchmarks/bfcl.js +1 -2
  17. package/dist/benchmarks/cad-design.d.ts +2 -5
  18. package/dist/benchmarks/cad-design.js +2 -3
  19. package/dist/benchmarks/cad-design.js.map +1 -1
  20. package/dist/benchmarks/cadbench.d.ts +1 -4
  21. package/dist/benchmarks/cadbench.js +1 -2
  22. package/dist/benchmarks/cadgenbench.d.ts +1 -4
  23. package/dist/benchmarks/cadgenbench.js +1 -2
  24. package/dist/benchmarks/commit0.d.ts +2 -5
  25. package/dist/benchmarks/commit0.js +1 -2
  26. package/dist/benchmarks/crag.d.ts +1 -4
  27. package/dist/benchmarks/crag.js +3 -3
  28. package/dist/benchmarks/crag.js.map +1 -1
  29. package/dist/benchmarks/dabstep.d.ts +2 -5
  30. package/dist/benchmarks/dabstep.js +2 -3
  31. package/dist/benchmarks/dabstep.js.map +1 -1
  32. package/dist/benchmarks/enterpriseops-gym.d.ts +2 -5
  33. package/dist/benchmarks/enterpriseops-gym.js +1 -2
  34. package/dist/benchmarks/finresearchbench.d.ts +2 -5
  35. package/dist/benchmarks/finresearchbench.js +2 -3
  36. package/dist/benchmarks/finsearchcomp.d.ts +2 -5
  37. package/dist/benchmarks/finsearchcomp.js +4 -4
  38. package/dist/benchmarks/finsearchcomp.js.map +1 -1
  39. package/dist/benchmarks/frames.d.ts +3 -19
  40. package/dist/benchmarks/frames.js +13 -39
  41. package/dist/benchmarks/frames.js.map +1 -1
  42. package/dist/benchmarks/hotpotqa.d.ts +4 -14
  43. package/dist/benchmarks/hotpotqa.js +12 -32
  44. package/dist/benchmarks/hotpotqa.js.map +1 -1
  45. package/dist/benchmarks/humaneval.d.ts +9 -12
  46. package/dist/benchmarks/humaneval.js +2 -3
  47. package/dist/benchmarks/humaneval.js.map +1 -1
  48. package/dist/benchmarks/mcad-bench.d.ts +13 -16
  49. package/dist/benchmarks/mcad-bench.js +2 -3
  50. package/dist/benchmarks/mcad-bench.js.map +1 -1
  51. package/dist/benchmarks/mcad-cq-bench.d.ts +17 -20
  52. package/dist/benchmarks/mcad-cq-bench.js +2 -3
  53. package/dist/benchmarks/mcad-cq-bench.js.map +1 -1
  54. package/dist/benchmarks/mcad-cq-golds.d.ts +2 -5
  55. package/dist/benchmarks/mcad-cq-golds.js +1 -2
  56. package/dist/benchmarks/mcad-golds.d.ts +1 -4
  57. package/dist/benchmarks/mcad-golds.js +0 -1
  58. package/dist/benchmarks/mcad-tasks.d.ts +5 -8
  59. package/dist/benchmarks/mcad-tasks.js +7 -8
  60. package/dist/benchmarks/mcad-tasks.js.map +1 -1
  61. package/dist/benchmarks/mind2web.d.ts +3 -5
  62. package/dist/benchmarks/mind2web.js +2 -3
  63. package/dist/benchmarks/mind2web.js.map +1 -1
  64. package/dist/benchmarks/nomiracl.d.ts +1 -4
  65. package/dist/benchmarks/nomiracl.js +1 -2
  66. package/dist/benchmarks/open-rag-bench.d.ts +1 -4
  67. package/dist/benchmarks/open-rag-bench.js +3 -3
  68. package/dist/benchmarks/open-rag-bench.js.map +1 -1
  69. package/dist/benchmarks/programbench.d.ts +2 -5
  70. package/dist/benchmarks/programbench.js +1 -2
  71. package/dist/benchmarks/rag-shared.d.ts +30 -22
  72. package/dist/benchmarks/rag-shared.js +8 -2
  73. package/dist/benchmarks/rag-shared.js.map +1 -1
  74. package/dist/benchmarks/ragbench.d.ts +1 -4
  75. package/dist/benchmarks/ragbench.js +3 -3
  76. package/dist/benchmarks/ragbench.js.map +1 -1
  77. package/dist/benchmarks/simpleqa.d.ts +2 -18
  78. package/dist/benchmarks/simpleqa.js +5 -31
  79. package/dist/benchmarks/simpleqa.js.map +1 -1
  80. package/dist/benchmarks/swe-bench.d.ts +7 -10
  81. package/dist/benchmarks/swe-bench.js +4 -4
  82. package/dist/benchmarks/swe-bench.js.map +1 -1
  83. package/dist/benchmarks/t2-ragbench.d.ts +1 -4
  84. package/dist/benchmarks/t2-ragbench.js +3 -3
  85. package/dist/benchmarks/t2-ragbench.js.map +1 -1
  86. package/dist/benchmarks/tau-bench-shared.d.ts +5 -8
  87. package/dist/benchmarks/tau-bench-shared.js +4 -4
  88. package/dist/benchmarks/tau-bench-shared.js.map +1 -1
  89. package/dist/benchmarks/tau2-bench.d.ts +2 -5
  90. package/dist/benchmarks/tau2-bench.js +1 -2
  91. package/dist/benchmarks/tau3-banking.d.ts +1 -4
  92. package/dist/benchmarks/tau3-banking.js +1 -2
  93. package/dist/benchmarks/terminal-bench.d.ts +1 -4
  94. package/dist/benchmarks/terminal-bench.js +4 -4
  95. package/dist/benchmarks/terminal-bench.js.map +1 -1
  96. package/dist/benchmarks/toollm.d.ts +2 -5
  97. package/dist/benchmarks/toollm.js +1 -2
  98. package/dist/benchmarks/trata-hedge.d.ts +1 -4
  99. package/dist/benchmarks/trata-hedge.js +2 -3
  100. package/dist/benchmarks/types.d.ts +6 -9
  101. package/dist/benchmarks/webarena-verified.d.ts +2 -5
  102. package/dist/benchmarks/webarena-verified.js +1 -2
  103. package/dist/{cadbench-BRF-59Mt.js → cadbench-DhAndllg.js} +4 -6
  104. package/dist/cadbench-DhAndllg.js.map +1 -0
  105. package/dist/{cadgenbench-DXtGkuW3.js → cadgenbench-Tvk16YKT.js} +15 -5
  106. package/dist/cadgenbench-Tvk16YKT.js.map +1 -0
  107. package/dist/index.d.ts +8 -18
  108. package/dist/index.js +16 -24
  109. package/dist/index.js.map +1 -1
  110. package/dist/{router-turn-uTYO6KQ1.js → router-turn-DNbQ_GjQ.js} +2 -3
  111. package/dist/router-turn-DNbQ_GjQ.js.map +1 -0
  112. package/fixtures/pier-agent/no-model-task/pre_artifacts.sh +0 -0
  113. package/fixtures/pier-agent/no-model-task/tests/test.sh +0 -0
  114. package/package.json +10 -10
  115. package/pier_agents/tangle_candidate.py +15 -23
  116. package/scripts/run-package-tests.mjs +8 -15
  117. package/scripts/verify-packed-consumer.mjs +0 -1
  118. package/src/atom-mcp-e2e.mts +16 -4
  119. package/src/benchmarks/frames.ts +10 -44
  120. package/src/benchmarks/hotpotqa.ts +9 -29
  121. package/src/benchmarks/rag-shared.ts +12 -0
  122. package/src/benchmarks/simpleqa.ts +2 -36
  123. package/src/commit0-prereqs.sh +0 -0
  124. package/src/corpus-replay.mts +8 -8
  125. package/src/corpus-report.mts +21 -21
  126. package/src/corpus.test.mts +5 -5
  127. package/src/corpus.ts +16 -16
  128. package/src/directives.ts +0 -38
  129. package/src/examples/lean-verify.ts +1 -1
  130. package/src/gate.ts +8 -8
  131. package/src/generate-eval/certify.ts +2 -2
  132. package/src/index.ts +1 -0
  133. package/src/refine-loop.ts +5 -5
  134. package/src/resolve-client.ts +1 -1
  135. package/src/router-turn.ts +3 -11
  136. package/src/run-benchmarks.test.mts +0 -4
  137. package/src/run-pool.ts +1 -1
  138. package/src/runtime-hook-recorder.ts +2 -2
  139. package/src/search-bench/tasks.ts +1 -1
  140. package/src/selector.test.mts +13 -13
  141. package/src/selector.ts +19 -19
  142. package/src/swe-bench-env.ts +4 -12
  143. package/src/swe-jail.ts +5 -156
  144. package/src/swe-structural-judge-policy.ts +3 -3
  145. package/src/swe-structural-policy.ts +3 -3
  146. package/src/swe-structural-provenance.ts +4 -4
  147. package/src/terminal-compare.ts +10 -10
  148. package/src/worker-blender.ts +2 -106
  149. package/src/worker-build123d.ts +2 -81
  150. package/tb_agents/opencode_router_agent.py +1 -1
  151. package/dist/cadbench-BRF-59Mt.js.map +0 -1
  152. package/dist/cadgenbench-DXtGkuW3.js.map +0 -1
  153. package/dist/router-turn-uTYO6KQ1.js.map +0 -1
  154. package/scripts/cadbench_prepare.py +0 -22
  155. package/scripts/cadgenbench_hard_parts.py +0 -48
  156. package/scripts/clbench_codebase_judge.py +0 -73
  157. package/scripts/render-gate-chart.mjs +0 -176
  158. package/scripts/trata-hedge/README.md +0 -57
  159. package/scripts/trata-hedge/run.sh +0 -64
  160. package/src/browser/adapters/bad-design-audit.ts +0 -153
  161. package/src/browser/adapters/bad-design-audit.verify.ts +0 -85
  162. package/src/browser/adapters/bad.ts +0 -165
  163. package/src/browser/agent-adapter.ts +0 -145
  164. package/src/browser/process-adapter.ts +0 -146
  165. package/src/browser/run-to-spans.ts +0 -105
  166. package/src/browser/run-to-spans.verify.ts +0 -89
  167. package/src/browser/ui-reviewer.ts +0 -200
  168. package/src/browser/ui-reviewer.verify.ts +0 -94
  169. package/src/browser/verify.ts +0 -96
  170. package/src/clbench-codebase-gate.mts +0 -314
  171. package/src/clbench-context-gate.mts +0 -341
  172. package/src/cloud-loop.mts +0 -156
  173. package/src/commit0-env-run.mts +0 -62
  174. package/src/commit0-env.ts +0 -172
  175. package/src/commit0-gate.mts +0 -558
  176. package/src/coordination-mcp-container-reach.mts +0 -182
  177. package/src/egress-probe.mts +0 -26
  178. package/src/fleet.mts +0 -143
  179. package/src/hev-structural.mts +0 -697
  180. package/src/humaneval-gate.mts +0 -220
  181. package/src/humaneval-repair-gate.mts +0 -182
  182. package/src/mbpp-structural.mts +0 -676
  183. package/src/mcp-mount-probe.mts +0 -139
  184. package/src/profile-coordinates.ts +0 -134
  185. package/src/profiles.ts +0 -128
  186. package/src/research-gate.mts +0 -132
  187. package/src/research-shot.ts +0 -144
  188. package/src/router-executor.ts +0 -51
  189. package/src/run-benchmarks-report.ts +0 -66
  190. package/src/sandbox-run.ts +0 -108
  191. package/src/search-bench/bridge.ts +0 -182
  192. package/src/search-bench/export.mts +0 -0
  193. package/src/search-bench/parametric-check.mts +0 -78
  194. package/src/search-bench/profiles.ts +0 -113
  195. package/src/search-bench/run.mts +0 -286
  196. package/src/search-bench/tasks-fresh.ts +0 -688
  197. package/src/skill-sandbox-smoke.mts +0 -101
  198. package/src/smoke-structural-rollout.mts +0 -415
  199. package/src/stats.mts +0 -90
  200. package/src/supervisor-arena.mts +0 -825
  201. package/src/swe-code-improve.mts +0 -306
  202. package/src/swe-emit-patch.mts +0 -125
  203. package/src/swe-improve.mts +0 -284
  204. package/src/swe-local-proof.mts +0 -265
  205. package/src/swe-repro-calibrate.mts +0 -451
  206. package/src/swe-stream.mts +0 -1561
  207. package/src/swe-structural.mts +0 -707
  208. package/src/tb-container-executor.mts +0 -266
  209. package/src/tb-container-executor.test.mts +0 -134
  210. package/src/tb-supervisor-sidecar.mts +0 -208
  211. package/src/trajectory-assemble.mjs +0 -130
  212. package/src/trata-gepa.mts +0 -381
  213. package/src/trata-hedge-solve.mts +0 -81
  214. package/src/worker-browser.ts +0 -115
  215. package/src/worker-cad.ts +0 -470
  216. package/src/workspace-loop.mts +0 -133
  217. package/tb_agents/opencode_refine_agent.py +0 -117
  218. package/tb_agents/opencode_supervisor_agent.py +0 -239
@@ -1,200 +0,0 @@
1
- /**
2
- * Driver-agnostic UI-REVIEWER PANEL — the design-review analogue of the
3
- * browser-agent harness (./agent-adapter.ts).
4
- *
5
- * "More reviewers, the better": run a PANEL of UI reviewers over the same target
6
- * and union their findings — #114's runAgentRounds ui-auditor, browser-agent-driver's
7
- * `bad design-audit`, a future reviewer — each a pluggable `UiReviewerAdapter`,
8
- * none of them owning the verdict.
9
- *
10
- * Attestability is the spine, exactly as in agent-adapter.ts: a UI design verdict
11
- * is SUBJECTIVE if it comes from an LLM/heuristic, so the panel NEVER lets a
12
- * reviewer's own findings or headline score (e.g. a `healthScore`) be the verdict.
13
- * The attestable verdict is derived ONLY from the DETERMINISTIC floor a reviewer
14
- * MEASURES — axe a11y violations + WCAG AA contrast — re-applied by `judgeUiFloor`.
15
- * Subjective findings are surfaced (deduped, attributed) but never gate.
16
- *
17
- * A reviewer that contributes no deterministic measurements adds findings to the
18
- * panel but cannot, by itself, produce an attestable verdict — that is fail-loud,
19
- * not a silent pass.
20
- */
21
-
22
- /** What to review: a site + the routes to visit. */
23
- export interface UiReviewTarget {
24
- url: string
25
- /** Route labels/paths to audit; defaults to a single 'home' at `url`. */
26
- routes?: { label: string; url: string }[]
27
- viewport?: { width: number; height: number }
28
- /** Playwright storageState for authenticated review. */
29
- storageState?: string
30
- }
31
-
32
- /** A SUBJECTIVE finding (LLM/heuristic). Surfaced + deduped, never the verdict. */
33
- export interface UiFinding {
34
- reviewerId: string
35
- /** Lens/category (consistency, hierarchy, accessibility, contrast, ux-flow, …). */
36
- lens: string
37
- severity: 'critical' | 'major' | 'minor'
38
- route: string
39
- title: string
40
- observation: string
41
- impact?: string
42
- suggestedFix?: string
43
- /** CSS/Playwright selector, when the reviewer pins one — used for dedup. */
44
- selector?: string
45
- }
46
-
47
- /** The DETERMINISTIC floor — MEASURED, not judged. This is the attestable layer
48
- * (mirrors browser-agent-driver's `measurements`: axe + WCAG contrast). */
49
- export interface DesignMeasurements {
50
- /** axe a11y violations with rule id + impact. */
51
- a11yViolations: { id: string; impact?: string }[]
52
- /** WCAG AA contrast pass rate in [0,1] over `contrastTotalChecked` text elements. */
53
- contrastAaPassRate: number
54
- contrastAaFailures: number
55
- contrastTotalChecked: number
56
- }
57
-
58
- /** One reviewer's result for one route. */
59
- export interface UiReviewRun {
60
- reviewerId: string
61
- route: string
62
- findings: UiFinding[]
63
- /** Present only if the reviewer measured the deterministic floor. */
64
- measurements?: DesignMeasurements
65
- /** The reviewer's OWN headline score (e.g. healthScore 0-100). Recorded for
66
- * comparison, NEVER the verdict. */
67
- selfReportedScore?: number
68
- usage?: { input: number; output: number }
69
- costUsd?: number
70
- }
71
-
72
- /** The general seam every UI reviewer implements — `bad design-audit`, the #114
73
- * ui-auditor, a hosted service. `review` returns one run per route. */
74
- export interface UiReviewerAdapter {
75
- readonly id: string
76
- review(target: UiReviewTarget): Promise<UiReviewRun[]>
77
- }
78
-
79
- /** Thresholds for the deterministic blocking gate (defaults mirror the
80
- * browser-agent-driver design-audit floor: 5+ critical a11y OR >25% contrast fail). */
81
- export interface UiFloorGateConfig {
82
- maxCriticalA11y?: number
83
- maxContrastFailRate?: number
84
- }
85
-
86
- const A11Y_CRITICAL = new Set(['critical', 'serious'])
87
-
88
- /**
89
- * The ATTESTABLE verdict — derived ONLY from the deterministic floor across the
90
- * runs that measured it. Ignores subjective findings AND selfReportedScore.
91
- * resolved = no blocking deterministic issues; score = deterministic design-health
92
- * in [0,1] (contrast pass rate × a11y cleanliness). Fail-loud if NO run measured
93
- * the floor — a panel of purely-subjective reviewers cannot attest a verdict.
94
- */
95
- export function judgeUiFloor(
96
- runs: ReadonlyArray<UiReviewRun>,
97
- cfg: UiFloorGateConfig = {},
98
- ): { resolved: boolean; score: number; detail: string } {
99
- const maxCriticalA11y = cfg.maxCriticalA11y ?? 5
100
- const maxContrastFailRate = cfg.maxContrastFailRate ?? 0.25
101
- const measured = runs.filter((r) => r.measurements)
102
- if (measured.length === 0) {
103
- throw new Error(
104
- 'judgeUiFloor: no reviewer produced deterministic measurements (axe/contrast) — ' +
105
- 'subjective findings are not attestable; add a reviewer with a measured floor',
106
- )
107
- }
108
- let criticalA11y = 0
109
- let worstContrastFailRate = 0
110
- let passRateSum = 0
111
- for (const r of measured) {
112
- const m = r.measurements as DesignMeasurements
113
- criticalA11y += m.a11yViolations.filter((v) => v.impact != null && A11Y_CRITICAL.has(v.impact)).length
114
- const failRate = 1 - m.contrastAaPassRate
115
- if (failRate > worstContrastFailRate) worstContrastFailRate = failRate
116
- passRateSum += m.contrastAaPassRate
117
- }
118
- const blocking = criticalA11y >= maxCriticalA11y || worstContrastFailRate > maxContrastFailRate
119
- const avgContrastPass = passRateSum / measured.length
120
- // a11y cleanliness: 1 when no critical issues, decaying toward 0 as they approach the cap.
121
- const a11yHealth = Math.max(0, 1 - criticalA11y / maxCriticalA11y)
122
- const score = Number((0.6 * avgContrastPass + 0.4 * a11yHealth).toFixed(4))
123
- return {
124
- resolved: !blocking,
125
- score,
126
- detail: JSON.stringify({
127
- criticalA11y,
128
- worstContrastFailRate: Number(worstContrastFailRate.toFixed(4)),
129
- avgContrastPass: Number(avgContrastPass.toFixed(4)),
130
- measuredReviewers: measured.map((r) => r.reviewerId),
131
- blocking,
132
- }),
133
- }
134
- }
135
-
136
- /** Dedup key for a finding across reviewers: same lens + route + (selector or a
137
- * normalized title) is one issue, regardless of how many reviewers flagged it. */
138
- function findingKey(f: UiFinding): string {
139
- const anchor = f.selector?.trim() || f.title.toLowerCase().replace(/\s+/g, ' ').trim()
140
- return `${f.lens.toLowerCase()}|${f.route}|${anchor}`
141
- }
142
-
143
- export interface UiPanelFinding extends UiFinding {
144
- /** All reviewers that independently flagged this issue (consensus signal). */
145
- flaggedBy: string[]
146
- }
147
-
148
- export interface UiPanelResult {
149
- perReviewer: Record<string, UiReviewRun[]>
150
- /** Deduped union of findings across reviewers, each tagged with who flagged it. */
151
- findings: UiPanelFinding[]
152
- /** The attestable deterministic-floor verdict (NOT a vote over findings). */
153
- verdict: { resolved: boolean; score: number; detail: string }
154
- }
155
-
156
- /**
157
- * Run a PANEL of reviewers over one target, union+dedup their subjective findings
158
- * (attributed, with a consensus count), and attest the deterministic floor. A
159
- * reviewer that throws is recorded as empty (its absence is visible in
160
- * perReviewer), never silently merged as a pass.
161
- */
162
- export async function runUiReviewerPanel(
163
- target: UiReviewTarget,
164
- reviewers: ReadonlyArray<UiReviewerAdapter>,
165
- cfg: UiFloorGateConfig = {},
166
- ): Promise<UiPanelResult> {
167
- if (reviewers.length === 0) throw new Error('runUiReviewerPanel: no reviewers given')
168
- const settled = await Promise.all(
169
- reviewers.map(async (rev) => {
170
- try {
171
- return { id: rev.id, runs: await rev.review(target) }
172
- } catch (err) {
173
- return { id: rev.id, runs: [] as UiReviewRun[], error: err instanceof Error ? err.message : String(err) }
174
- }
175
- }),
176
- )
177
- const perReviewer: Record<string, UiReviewRun[]> = {}
178
- const allRuns: UiReviewRun[] = []
179
- for (const s of settled) {
180
- perReviewer[s.id] = s.runs
181
- allRuns.push(...s.runs)
182
- }
183
- const byKey = new Map<string, UiPanelFinding>()
184
- for (const run of allRuns) {
185
- for (const f of run.findings) {
186
- const key = findingKey(f)
187
- const existing = byKey.get(key)
188
- if (existing) {
189
- if (!existing.flaggedBy.includes(f.reviewerId)) existing.flaggedBy.push(f.reviewerId)
190
- } else {
191
- byKey.set(key, { ...f, flaggedBy: [f.reviewerId] })
192
- }
193
- }
194
- }
195
- return {
196
- perReviewer,
197
- findings: [...byKey.values()],
198
- verdict: judgeUiFloor(allRuns, cfg),
199
- }
200
- }
@@ -1,94 +0,0 @@
1
- /**
2
- * Deterministic self-check for the UI-reviewer panel — `tsx src/browser/ui-reviewer.verify.ts`.
3
- *
4
- * Defends the same property as the browser harness: the verdict is ATTESTABLE —
5
- * it comes from the measured deterministic floor (axe + contrast), never a
6
- * reviewer's subjective findings or self-reported headline score.
7
- */
8
-
9
- import {
10
- judgeUiFloor,
11
- runUiReviewerPanel,
12
- type UiReviewRun,
13
- type UiReviewerAdapter,
14
- type UiReviewTarget,
15
- } from './ui-reviewer'
16
-
17
- let failures = 0
18
- function check(name: string, cond: boolean, detail = '') {
19
- if (cond) console.log(` ✓ ${name}`)
20
- else {
21
- failures += 1
22
- console.log(` ✗ ${name} ${detail}`)
23
- }
24
- }
25
-
26
- const clean: UiReviewRun = {
27
- reviewerId: 'bad',
28
- route: 'home',
29
- findings: [],
30
- measurements: { a11yViolations: [], contrastAaPassRate: 0.99, contrastAaFailures: 1, contrastTotalChecked: 120 },
31
- selfReportedScore: 92,
32
- }
33
- // A reviewer SCREAMING success (healthScore 100) while the measured floor is blocking.
34
- const liar: UiReviewRun = {
35
- reviewerId: 'bad',
36
- route: 'home',
37
- findings: [],
38
- selfReportedScore: 100,
39
- measurements: {
40
- a11yViolations: [
41
- { id: 'color-contrast', impact: 'serious' },
42
- { id: 'aria-required', impact: 'critical' },
43
- { id: 'label', impact: 'critical' },
44
- { id: 'button-name', impact: 'critical' },
45
- { id: 'link-name', impact: 'serious' },
46
- ],
47
- contrastAaPassRate: 0.5,
48
- contrastAaFailures: 60,
49
- contrastTotalChecked: 120,
50
- },
51
- }
52
-
53
- console.log('ui-reviewer panel verify:')
54
-
55
- const okV = judgeUiFloor([clean])
56
- check('clean floor → resolved=true, high score', okV.resolved === true && okV.score > 0.9, okV.detail)
57
-
58
- const liarV = judgeUiFloor([liar])
59
- check('self-reported 100 IGNORED — measured floor blocks → resolved=false', liarV.resolved === false, liarV.detail)
60
- check('blocking score is low', liarV.score < 0.6, liarV.detail)
61
-
62
- // fail-loud: a purely-subjective panel (no measurements) cannot attest.
63
- let threw = false
64
- try {
65
- judgeUiFloor([{ reviewerId: 'ui-auditor', route: 'home', findings: [], selfReportedScore: 80 }])
66
- } catch {
67
- threw = true
68
- }
69
- check('no measured floor → throws (subjective findings are not attestable)', threw)
70
-
71
- // panel dedup + consensus across two reviewers flagging the same issue.
72
- const finding = (reviewerId: string) => ({
73
- reviewerId,
74
- lens: 'contrast',
75
- severity: 'major' as const,
76
- route: 'home',
77
- title: 'Low contrast on primary CTA',
78
- observation: 'x',
79
- selector: 'button.cta',
80
- })
81
- const revA: UiReviewerAdapter = { id: 'bad', async review() { return [{ ...clean, reviewerId: 'bad', findings: [finding('bad')] }] } }
82
- const revB: UiReviewerAdapter = { id: 'ui-auditor', async review() { return [{ reviewerId: 'ui-auditor', route: 'home', findings: [finding('ui-auditor')] }] } }
83
- const target: UiReviewTarget = { url: 'https://example.com' }
84
- const panel = await runUiReviewerPanel(target, [revA, revB])
85
- check('panel dedups the same issue across reviewers to ONE finding', panel.findings.length === 1, `got ${panel.findings.length}`)
86
- check('deduped finding records BOTH reviewers (consensus)', (panel.findings[0]?.flaggedBy ?? []).length === 2, JSON.stringify(panel.findings[0]?.flaggedBy))
87
- check('panel verdict comes from the measured reviewer (bad), resolved=true', panel.verdict.resolved === true, panel.verdict.detail)
88
- check('perReviewer records both reviewers', Object.keys(panel.perReviewer).length === 2)
89
-
90
- if (failures > 0) {
91
- console.log(`\n❌ ${failures} check(s) failed`)
92
- process.exit(1)
93
- }
94
- console.log('\n✅ UI-reviewer panel verified — verdict is the measured floor, self-report ignored, findings deduped across reviewers')
@@ -1,96 +0,0 @@
1
- /**
2
- * Deterministic self-check for the driver-agnostic browser harness — run with
3
- * `tsx src/browser/verify.ts` (bench convention: a verify script, not a live run).
4
- *
5
- * The regression it defends: the verdict is ATTESTABLE — derived from the run's
6
- * final observable state, NEVER the driver's self-reported success. A driver can
7
- * claim success=true; if the deterministic criteria fail, resolved MUST be false.
8
- */
9
-
10
- import { judgeBrowserRun, type BrowserTask } from './agent-adapter'
11
- import { badReportToRun } from './adapters/bad'
12
-
13
- let failures = 0
14
- function check(name: string, cond: boolean, detail = '') {
15
- if (cond) {
16
- console.log(` ✓ ${name}`)
17
- } else {
18
- failures += 1
19
- console.log(` ✗ ${name} ${detail}`)
20
- }
21
- }
22
-
23
- // A bad report.json shaped exactly like the real one, with the OpenSCAD page reached.
24
- const successReport = {
25
- results: [
26
- {
27
- testCase: { id: 'wiki-openscad' },
28
- agentResult: {
29
- success: true,
30
- result: "The 'OpenSCAD' article is open on Wikipedia.",
31
- turns: [
32
- { turn: 1, state: { url: 'https://en.wikipedia.org/wiki/Main_Page', snapshot: 'search box' }, action: { action: 'type', text: 'OpenSCAD' } },
33
- { turn: 2, state: { url: 'https://en.wikipedia.org/wiki/Main_Page' }, action: { action: 'click', selector: '@result' } },
34
- { turn: 3, state: { url: 'https://en.wikipedia.org/wiki/OpenSCAD', snapshot: 'OpenSCAD - Wikipedia. Constructive Solid Geometry modeller.' }, action: { action: 'complete' } },
35
- ],
36
- },
37
- },
38
- ],
39
- }
40
-
41
- // The SAME driver claiming success, but the browser never left Main_Page.
42
- const liarReport = {
43
- results: [
44
- {
45
- testCase: { id: 'wiki-openscad' },
46
- agentResult: {
47
- success: true, // self-reported — must be IGNORED
48
- result: 'Done!',
49
- turns: [{ turn: 1, state: { url: 'https://en.wikipedia.org/wiki/Main_Page', snapshot: 'main page' }, action: { action: 'complete' } }],
50
- },
51
- },
52
- ],
53
- }
54
-
55
- const task: BrowserTask = {
56
- id: 'wiki-openscad',
57
- goal: 'Open the OpenSCAD article',
58
- startUrl: 'https://en.wikipedia.org',
59
- success: [{ type: 'url-contains', value: 'OpenSCAD' }],
60
- }
61
-
62
- console.log('browser harness verify:')
63
-
64
- const okRun = badReportToRun(successReport, 'wiki-openscad')
65
- check('mapper extracts final url from last turn', okRun.finalUrl === 'https://en.wikipedia.org/wiki/OpenSCAD', okRun.finalUrl)
66
- check('mapper records all steps', okRun.steps.length === 3)
67
- check('mapper carries selfReportedSuccess', okRun.selfReportedSuccess === true)
68
- const okV = judgeBrowserRun(task, okRun)
69
- check('genuine success attests resolved=true score=1', okV.resolved === true && okV.score === 1, okV.detail)
70
-
71
- const liarRun = badReportToRun(liarReport, 'wiki-openscad')
72
- const liarV = judgeBrowserRun(task, liarRun)
73
- check('SELF-REPORTED success is IGNORED — failed criteria → resolved=false', liarV.resolved === false && liarV.score === 0, liarV.detail)
74
-
75
- // Partial credit + dom check: 2 criteria, only url passes (snapshot lacks the phrase).
76
- const twoCrit: BrowserTask = {
77
- ...task,
78
- success: [{ type: 'url-contains', value: 'OpenSCAD' }, { type: 'dom-contains', value: 'Marching Cubes' }],
79
- }
80
- const partialV = judgeBrowserRun(twoCrit, okRun)
81
- check('partial credit: 1 of 2 criteria → score=0.5 resolved=false', partialV.score === 0.5 && partialV.resolved === false, partialV.detail)
82
-
83
- // Fail loud: no criteria is a harness error, not a silent pass.
84
- let threw = false
85
- try {
86
- judgeBrowserRun({ ...task, success: [] }, okRun)
87
- } catch {
88
- threw = true
89
- }
90
- check('empty success spec throws (fail-loud, never silent-attest)', threw)
91
-
92
- if (failures > 0) {
93
- console.log(`\n❌ ${failures} check(s) failed`)
94
- process.exit(1)
95
- }
96
- console.log('\n✅ browser harness verified — verdict is attestable, self-report ignored')