@tangle-network/browser-agent-driver 0.33.3 → 0.35.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.
- package/README.md +42 -1
- package/discovery/llms.txt +27 -0
- package/discovery/tangle-agent.json +36 -0
- package/dist/brain/action-parse.d.ts +16 -0
- package/dist/brain/action-parse.d.ts.map +1 -0
- package/dist/brain/action-parse.js +191 -0
- package/dist/brain/action-parse.js.map +1 -0
- package/dist/brain/decide.d.ts +58 -0
- package/dist/brain/decide.d.ts.map +1 -0
- package/dist/brain/decide.js +418 -0
- package/dist/brain/decide.js.map +1 -0
- package/dist/brain/history-compact.d.ts +19 -0
- package/dist/brain/history-compact.d.ts.map +1 -0
- package/dist/brain/history-compact.js +153 -0
- package/dist/brain/history-compact.js.map +1 -0
- package/dist/brain/index.d.ts +78 -152
- package/dist/brain/index.d.ts.map +1 -1
- package/dist/brain/index.js +62 -2268
- package/dist/brain/index.js.map +1 -1
- package/dist/brain/model-client.d.ts +101 -0
- package/dist/brain/model-client.d.ts.map +1 -0
- package/dist/brain/model-client.js +391 -0
- package/dist/brain/model-client.js.map +1 -0
- package/dist/brain/plan.d.ts +57 -0
- package/dist/brain/plan.d.ts.map +1 -0
- package/dist/brain/plan.js +194 -0
- package/dist/brain/plan.js.map +1 -0
- package/dist/brain/prompts.d.ts +37 -0
- package/dist/brain/prompts.d.ts.map +1 -0
- package/dist/brain/prompts.js +455 -0
- package/dist/brain/prompts.js.map +1 -0
- package/dist/brain/provider-fetch.d.ts +26 -0
- package/dist/brain/provider-fetch.d.ts.map +1 -0
- package/dist/brain/provider-fetch.js +45 -0
- package/dist/brain/provider-fetch.js.map +1 -0
- package/dist/brain/snapshot-budget.d.ts +20 -0
- package/dist/brain/snapshot-budget.d.ts.map +1 -0
- package/dist/brain/snapshot-budget.js +202 -0
- package/dist/brain/snapshot-budget.js.map +1 -0
- package/dist/brain/system-prompt.d.ts +67 -0
- package/dist/brain/system-prompt.d.ts.map +1 -0
- package/dist/brain/system-prompt.js +128 -0
- package/dist/brain/system-prompt.js.map +1 -0
- package/dist/brain/tasks/design-audit.d.ts +33 -0
- package/dist/brain/tasks/design-audit.d.ts.map +1 -0
- package/dist/brain/tasks/design-audit.js +100 -0
- package/dist/brain/tasks/design-audit.js.map +1 -0
- package/dist/brain/tasks/evaluate.d.ts +25 -0
- package/dist/brain/tasks/evaluate.d.ts.map +1 -0
- package/dist/brain/tasks/evaluate.js +55 -0
- package/dist/brain/tasks/evaluate.js.map +1 -0
- package/dist/brain/tasks/goal-verification.d.ts +32 -0
- package/dist/brain/tasks/goal-verification.d.ts.map +1 -0
- package/dist/brain/tasks/goal-verification.js +68 -0
- package/dist/brain/tasks/goal-verification.js.map +1 -0
- package/dist/brain/tasks/knowledge.d.ts +26 -0
- package/dist/brain/tasks/knowledge.d.ts.map +1 -0
- package/dist/brain/tasks/knowledge.js +56 -0
- package/dist/brain/tasks/knowledge.js.map +1 -0
- package/dist/brain/tasks/link-scout.d.ts +37 -0
- package/dist/brain/tasks/link-scout.d.ts.map +1 -0
- package/dist/brain/tasks/link-scout.js +69 -0
- package/dist/brain/tasks/link-scout.js.map +1 -0
- package/dist/brain/types.d.ts +55 -0
- package/dist/brain/types.d.ts.map +1 -0
- package/dist/brain/types.js +7 -0
- package/dist/brain/types.js.map +1 -0
- package/dist/browser/stealth-init-script.d.ts +9 -0
- package/dist/browser/stealth-init-script.d.ts.map +1 -0
- package/dist/browser/stealth-init-script.js +128 -0
- package/dist/browser/stealth-init-script.js.map +1 -0
- package/dist/browser/storage-state.d.ts +29 -0
- package/dist/browser/storage-state.d.ts.map +1 -0
- package/dist/browser/storage-state.js +47 -0
- package/dist/browser/storage-state.js.map +1 -0
- package/dist/browser-launch.d.ts +6 -0
- package/dist/browser-launch.d.ts.map +1 -1
- package/dist/browser-launch.js +3 -0
- package/dist/browser-launch.js.map +1 -1
- package/dist/cli/args.d.ts +141 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +167 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/benchmark-sync.d.ts +9 -0
- package/dist/cli/benchmark-sync.d.ts.map +1 -0
- package/dist/cli/benchmark-sync.js +43 -0
- package/dist/cli/benchmark-sync.js.map +1 -0
- package/dist/cli/build-config.d.ts +11 -0
- package/dist/cli/build-config.d.ts.map +1 -0
- package/dist/cli/build-config.js +355 -0
- package/dist/cli/build-config.js.map +1 -0
- package/dist/cli/commands/auth.d.ts +3 -0
- package/dist/cli/commands/auth.d.ts.map +1 -0
- package/dist/cli/commands/auth.js +36 -0
- package/dist/cli/commands/auth.js.map +1 -0
- package/dist/cli/commands/chrome-debug.d.ts +7 -0
- package/dist/cli/commands/chrome-debug.d.ts.map +1 -0
- package/dist/cli/commands/chrome-debug.js +11 -0
- package/dist/cli/commands/chrome-debug.js.map +1 -0
- package/dist/cli/commands/design-audit.d.ts +3 -0
- package/dist/cli/commands/design-audit.d.ts.map +1 -0
- package/dist/cli/commands/design-audit.js +68 -0
- package/dist/cli/commands/design-audit.js.map +1 -0
- package/dist/cli/commands/preview.d.ts +14 -0
- package/dist/cli/commands/preview.d.ts.map +1 -0
- package/dist/cli/commands/preview.js +31 -0
- package/dist/cli/commands/preview.js.map +1 -0
- package/dist/cli/commands/run.d.ts +3 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +740 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/commands/runs.d.ts +8 -0
- package/dist/cli/commands/runs.d.ts.map +1 -0
- package/dist/cli/commands/runs.js +35 -0
- package/dist/cli/commands/runs.js.map +1 -0
- package/dist/cli/commands/share.d.ts +10 -0
- package/dist/cli/commands/share.d.ts.map +1 -0
- package/dist/cli/commands/share.js +32 -0
- package/dist/cli/commands/share.js.map +1 -0
- package/dist/cli/commands/showcase.d.ts +17 -0
- package/dist/cli/commands/showcase.d.ts.map +1 -0
- package/dist/cli/commands/showcase.js +20 -0
- package/dist/cli/commands/showcase.js.map +1 -0
- package/dist/cli/commands/snapshot.d.ts +12 -0
- package/dist/cli/commands/snapshot.d.ts.map +1 -0
- package/dist/cli/commands/snapshot.js +24 -0
- package/dist/cli/commands/snapshot.js.map +1 -0
- package/dist/cli/commands/view.d.ts +7 -0
- package/dist/cli/commands/view.d.ts.map +1 -0
- package/dist/cli/commands/view.js +23 -0
- package/dist/cli/commands/view.js.map +1 -0
- package/dist/cli/constants.d.ts +6 -0
- package/dist/cli/constants.d.ts.map +1 -0
- package/dist/cli/constants.js +3 -0
- package/dist/cli/constants.js.map +1 -0
- package/dist/cli/version.d.ts +7 -0
- package/dist/cli/version.d.ts.map +1 -0
- package/dist/cli/version.js +16 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/cli-design-audit.d.ts +44 -36
- package/dist/cli-design-audit.d.ts.map +1 -1
- package/dist/cli-design-audit.js +137 -1646
- package/dist/cli-design-audit.js.map +1 -1
- package/dist/cli-jobs.js +2 -1
- package/dist/cli-jobs.js.map +1 -1
- package/dist/cli.js +66 -1697
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +20 -2
- package/dist/config.js.map +1 -1
- package/dist/design/audit/evolve/agent.d.ts +23 -0
- package/dist/design/audit/evolve/agent.d.ts.map +1 -0
- package/dist/design/audit/evolve/agent.js +273 -0
- package/dist/design/audit/evolve/agent.js.map +1 -0
- package/dist/design/audit/evolve/css.d.ts +10 -0
- package/dist/design/audit/evolve/css.d.ts.map +1 -0
- package/dist/design/audit/evolve/css.js +206 -0
- package/dist/design/audit/evolve/css.js.map +1 -0
- package/dist/design/audit/evolve/index.d.ts +13 -0
- package/dist/design/audit/evolve/index.d.ts.map +1 -0
- package/dist/design/audit/evolve/index.js +12 -0
- package/dist/design/audit/evolve/index.js.map +1 -0
- package/dist/design/audit/evolve/report.d.ts +3 -0
- package/dist/design/audit/evolve/report.d.ts.map +1 -0
- package/dist/design/audit/evolve/report.js +45 -0
- package/dist/design/audit/evolve/report.js.map +1 -0
- package/dist/design/audit/evolve/types.d.ts +14 -0
- package/dist/design/audit/evolve/types.d.ts.map +1 -0
- package/dist/design/audit/evolve/types.js +2 -0
- package/dist/design/audit/evolve/types.js.map +1 -0
- package/dist/design/audit/pipeline.d.ts +12 -0
- package/dist/design/audit/pipeline.d.ts.map +1 -1
- package/dist/design/audit/pipeline.js +43 -27
- package/dist/design/audit/pipeline.js.map +1 -1
- package/dist/design/audit/reference/artifact/build.d.ts +33 -0
- package/dist/design/audit/reference/artifact/build.d.ts.map +1 -0
- package/dist/design/audit/reference/artifact/build.js +64 -0
- package/dist/design/audit/reference/artifact/build.js.map +1 -0
- package/dist/design/audit/reference/artifact/render.d.ts +39 -0
- package/dist/design/audit/reference/artifact/render.d.ts.map +1 -0
- package/dist/design/audit/reference/artifact/render.js +213 -0
- package/dist/design/audit/reference/artifact/render.js.map +1 -0
- package/dist/design/audit/reference/artifact/text.d.ts +11 -0
- package/dist/design/audit/reference/artifact/text.d.ts.map +1 -0
- package/dist/design/audit/reference/artifact/text.js +20 -0
- package/dist/design/audit/reference/artifact/text.js.map +1 -0
- package/dist/design/audit/reference/artifact/to-findings.d.ts +57 -0
- package/dist/design/audit/reference/artifact/to-findings.d.ts.map +1 -0
- package/dist/design/audit/reference/artifact/to-findings.js +314 -0
- package/dist/design/audit/reference/artifact/to-findings.js.map +1 -0
- package/dist/design/audit/reference/config.d.ts +50 -0
- package/dist/design/audit/reference/config.d.ts.map +1 -0
- package/dist/design/audit/reference/config.js +108 -0
- package/dist/design/audit/reference/config.js.map +1 -0
- package/dist/design/audit/reference/contracts.d.ts +1030 -0
- package/dist/design/audit/reference/contracts.d.ts.map +1 -0
- package/dist/design/audit/reference/contracts.js +28 -0
- package/dist/design/audit/reference/contracts.js.map +1 -0
- package/dist/design/audit/reference/corpus/build.d.ts +115 -0
- package/dist/design/audit/reference/corpus/build.d.ts.map +1 -0
- package/dist/design/audit/reference/corpus/build.js +152 -0
- package/dist/design/audit/reference/corpus/build.js.map +1 -0
- package/dist/design/audit/reference/corpus/schema.d.ts +33 -0
- package/dist/design/audit/reference/corpus/schema.d.ts.map +1 -0
- package/dist/design/audit/reference/corpus/schema.js +249 -0
- package/dist/design/audit/reference/corpus/schema.js.map +1 -0
- package/dist/design/audit/reference/corpus/store.d.ts +26 -0
- package/dist/design/audit/reference/corpus/store.d.ts.map +1 -0
- package/dist/design/audit/reference/corpus/store.js +104 -0
- package/dist/design/audit/reference/corpus/store.js.map +1 -0
- package/dist/design/audit/reference/dna/delta.d.ts +21 -0
- package/dist/design/audit/reference/dna/delta.d.ts.map +1 -0
- package/dist/design/audit/reference/dna/delta.js +126 -0
- package/dist/design/audit/reference/dna/delta.js.map +1 -0
- package/dist/design/audit/reference/dna/derive.d.ts +31 -0
- package/dist/design/audit/reference/dna/derive.d.ts.map +1 -0
- package/dist/design/audit/reference/dna/derive.js +381 -0
- package/dist/design/audit/reference/dna/derive.js.map +1 -0
- package/dist/design/audit/reference/dna/descriptor.d.ts +36 -0
- package/dist/design/audit/reference/dna/descriptor.d.ts.map +1 -0
- package/dist/design/audit/reference/dna/descriptor.js +209 -0
- package/dist/design/audit/reference/dna/descriptor.js.map +1 -0
- package/dist/design/audit/reference/dna/page-adapter.d.ts +17 -0
- package/dist/design/audit/reference/dna/page-adapter.d.ts.map +1 -0
- package/dist/design/audit/reference/dna/page-adapter.js +35 -0
- package/dist/design/audit/reference/dna/page-adapter.js.map +1 -0
- package/dist/design/audit/reference/dna/scroll-capture.d.ts +93 -0
- package/dist/design/audit/reference/dna/scroll-capture.d.ts.map +1 -0
- package/dist/design/audit/reference/dna/scroll-capture.js +374 -0
- package/dist/design/audit/reference/dna/scroll-capture.js.map +1 -0
- package/dist/design/audit/reference/engine/budget.d.ts +63 -0
- package/dist/design/audit/reference/engine/budget.d.ts.map +1 -0
- package/dist/design/audit/reference/engine/budget.js +110 -0
- package/dist/design/audit/reference/engine/budget.js.map +1 -0
- package/dist/design/audit/reference/engine/core.d.ts +32 -0
- package/dist/design/audit/reference/engine/core.d.ts.map +1 -0
- package/dist/design/audit/reference/engine/core.js +261 -0
- package/dist/design/audit/reference/engine/core.js.map +1 -0
- package/dist/design/audit/reference/engine/guard.d.ts +43 -0
- package/dist/design/audit/reference/engine/guard.d.ts.map +1 -0
- package/dist/design/audit/reference/engine/guard.js +43 -0
- package/dist/design/audit/reference/engine/guard.js.map +1 -0
- package/dist/design/audit/reference/engine/score-core.d.ts +48 -0
- package/dist/design/audit/reference/engine/score-core.d.ts.map +1 -0
- package/dist/design/audit/reference/engine/score-core.js +134 -0
- package/dist/design/audit/reference/engine/score-core.js.map +1 -0
- package/dist/design/audit/reference/engine/wiring.d.ts +35 -0
- package/dist/design/audit/reference/engine/wiring.d.ts.map +1 -0
- package/dist/design/audit/reference/engine/wiring.js +80 -0
- package/dist/design/audit/reference/engine/wiring.js.map +1 -0
- package/dist/design/audit/reference/eval/taste-core.d.ts +77 -0
- package/dist/design/audit/reference/eval/taste-core.d.ts.map +1 -0
- package/dist/design/audit/reference/eval/taste-core.js +95 -0
- package/dist/design/audit/reference/eval/taste-core.js.map +1 -0
- package/dist/design/audit/reference/generate/generator.d.ts +49 -0
- package/dist/design/audit/reference/generate/generator.d.ts.map +1 -0
- package/dist/design/audit/reference/generate/generator.js +100 -0
- package/dist/design/audit/reference/generate/generator.js.map +1 -0
- package/dist/design/audit/reference/generate/parse.d.ts +28 -0
- package/dist/design/audit/reference/generate/parse.d.ts.map +1 -0
- package/dist/design/audit/reference/generate/parse.js +220 -0
- package/dist/design/audit/reference/generate/parse.js.map +1 -0
- package/dist/design/audit/reference/generate/prompt.d.ts +36 -0
- package/dist/design/audit/reference/generate/prompt.d.ts.map +1 -0
- package/dist/design/audit/reference/generate/prompt.js +172 -0
- package/dist/design/audit/reference/generate/prompt.js.map +1 -0
- package/dist/design/audit/reference/index.d.ts +26 -0
- package/dist/design/audit/reference/index.d.ts.map +1 -0
- package/dist/design/audit/reference/index.js +31 -0
- package/dist/design/audit/reference/index.js.map +1 -0
- package/dist/design/audit/reference/judge/image-clamp.d.ts +34 -0
- package/dist/design/audit/reference/judge/image-clamp.d.ts.map +1 -0
- package/dist/design/audit/reference/judge/image-clamp.js +88 -0
- package/dist/design/audit/reference/judge/image-clamp.js.map +1 -0
- package/dist/design/audit/reference/judge/pairwise.d.ts +34 -0
- package/dist/design/audit/reference/judge/pairwise.d.ts.map +1 -0
- package/dist/design/audit/reference/judge/pairwise.js +105 -0
- package/dist/design/audit/reference/judge/pairwise.js.map +1 -0
- package/dist/design/audit/reference/judge/parse.d.ts +31 -0
- package/dist/design/audit/reference/judge/parse.d.ts.map +1 -0
- package/dist/design/audit/reference/judge/parse.js +113 -0
- package/dist/design/audit/reference/judge/parse.js.map +1 -0
- package/dist/design/audit/reference/judge/prompt.d.ts +38 -0
- package/dist/design/audit/reference/judge/prompt.d.ts.map +1 -0
- package/dist/design/audit/reference/judge/prompt.js +123 -0
- package/dist/design/audit/reference/judge/prompt.js.map +1 -0
- package/dist/design/audit/reference/judge/quality.d.ts +28 -0
- package/dist/design/audit/reference/judge/quality.d.ts.map +1 -0
- package/dist/design/audit/reference/judge/quality.js +62 -0
- package/dist/design/audit/reference/judge/quality.js.map +1 -0
- package/dist/design/audit/reference/judge/rank.d.ts +41 -0
- package/dist/design/audit/reference/judge/rank.d.ts.map +1 -0
- package/dist/design/audit/reference/judge/rank.js +196 -0
- package/dist/design/audit/reference/judge/rank.js.map +1 -0
- package/dist/design/audit/reference/judge/text-judge.d.ts +31 -0
- package/dist/design/audit/reference/judge/text-judge.d.ts.map +1 -0
- package/dist/design/audit/reference/judge/text-judge.js +43 -0
- package/dist/design/audit/reference/judge/text-judge.js.map +1 -0
- package/dist/design/audit/reference/judge/vision-judge.d.ts +59 -0
- package/dist/design/audit/reference/judge/vision-judge.d.ts.map +1 -0
- package/dist/design/audit/reference/judge/vision-judge.js +150 -0
- package/dist/design/audit/reference/judge/vision-judge.js.map +1 -0
- package/dist/design/audit/reference/judge/vision-model.d.ts +65 -0
- package/dist/design/audit/reference/judge/vision-model.d.ts.map +1 -0
- package/dist/design/audit/reference/judge/vision-model.js +110 -0
- package/dist/design/audit/reference/judge/vision-model.js.map +1 -0
- package/dist/design/audit/reference/pipeline/evaluate-reference.d.ts +68 -0
- package/dist/design/audit/reference/pipeline/evaluate-reference.d.ts.map +1 -0
- package/dist/design/audit/reference/pipeline/evaluate-reference.js +52 -0
- package/dist/design/audit/reference/pipeline/evaluate-reference.js.map +1 -0
- package/dist/design/audit/reference/reference-context.d.ts +31 -0
- package/dist/design/audit/reference/reference-context.d.ts.map +1 -0
- package/dist/design/audit/reference/reference-context.js +73 -0
- package/dist/design/audit/reference/reference-context.js.map +1 -0
- package/dist/design/audit/reference/retrieval/embedding-hash.d.ts +30 -0
- package/dist/design/audit/reference/retrieval/embedding-hash.d.ts.map +1 -0
- package/dist/design/audit/reference/retrieval/embedding-hash.js +87 -0
- package/dist/design/audit/reference/retrieval/embedding-hash.js.map +1 -0
- package/dist/design/audit/reference/retrieval/embedding-openai.d.ts +38 -0
- package/dist/design/audit/reference/retrieval/embedding-openai.d.ts.map +1 -0
- package/dist/design/audit/reference/retrieval/embedding-openai.js +73 -0
- package/dist/design/audit/reference/retrieval/embedding-openai.js.map +1 -0
- package/dist/design/audit/reference/retrieval/matcher.d.ts +34 -0
- package/dist/design/audit/reference/retrieval/matcher.d.ts.map +1 -0
- package/dist/design/audit/reference/retrieval/matcher.js +107 -0
- package/dist/design/audit/reference/retrieval/matcher.js.map +1 -0
- package/dist/design/audit/reference/run.d.ts +59 -0
- package/dist/design/audit/reference/run.d.ts.map +1 -0
- package/dist/design/audit/reference/run.js +99 -0
- package/dist/design/audit/reference/run.js.map +1 -0
- package/dist/design/audit/report.d.ts +35 -0
- package/dist/design/audit/report.d.ts.map +1 -0
- package/dist/design/audit/report.js +195 -0
- package/dist/design/audit/report.js.map +1 -0
- package/dist/design/audit/tokens/extract.d.ts +71 -0
- package/dist/design/audit/tokens/extract.d.ts.map +1 -0
- package/dist/design/audit/tokens/extract.js +1034 -0
- package/dist/design/audit/tokens/extract.js.map +1 -0
- package/dist/design/audit/types.d.ts +8 -0
- package/dist/design/audit/types.d.ts.map +1 -1
- package/dist/design/compare.d.ts.map +1 -1
- package/dist/design/compare.js +2 -6
- package/dist/design/compare.js.map +1 -1
- package/dist/design/cookie-consent.d.ts +3 -0
- package/dist/design/cookie-consent.d.ts.map +1 -0
- package/dist/design/cookie-consent.js +26 -0
- package/dist/design/cookie-consent.js.map +1 -0
- package/dist/design/viewports.d.ts +18 -0
- package/dist/design/viewports.d.ts.map +1 -0
- package/dist/design/viewports.js +10 -0
- package/dist/design/viewports.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/memory/store.d.ts +19 -1
- package/dist/memory/store.d.ts.map +1 -1
- package/dist/memory/store.js +47 -0
- package/dist/memory/store.js.map +1 -1
- package/dist/provider-defaults.d.ts +18 -0
- package/dist/provider-defaults.d.ts.map +1 -1
- package/dist/provider-defaults.js +33 -0
- package/dist/provider-defaults.js.map +1 -1
- package/dist/runner/allowed-domains.d.ts +11 -0
- package/dist/runner/allowed-domains.d.ts.map +1 -0
- package/dist/runner/allowed-domains.js +14 -0
- package/dist/runner/allowed-domains.js.map +1 -0
- package/dist/runner/batch-fill.d.ts +28 -0
- package/dist/runner/batch-fill.d.ts.map +1 -0
- package/dist/runner/batch-fill.js +80 -0
- package/dist/runner/batch-fill.js.map +1 -0
- package/dist/runner/completion-policy.d.ts +26 -0
- package/dist/runner/completion-policy.d.ts.map +1 -0
- package/dist/runner/completion-policy.js +76 -0
- package/dist/runner/completion-policy.js.map +1 -0
- package/dist/runner/constants.d.ts +14 -0
- package/dist/runner/constants.d.ts.map +1 -0
- package/dist/runner/constants.js +23 -0
- package/dist/runner/constants.js.map +1 -0
- package/dist/runner/decision-screenshot.d.ts +24 -0
- package/dist/runner/decision-screenshot.d.ts.map +1 -0
- package/dist/runner/decision-screenshot.js +23 -0
- package/dist/runner/decision-screenshot.js.map +1 -0
- package/dist/runner/domain-boundary.d.ts +36 -0
- package/dist/runner/domain-boundary.d.ts.map +1 -0
- package/dist/runner/domain-boundary.js +81 -0
- package/dist/runner/domain-boundary.js.map +1 -0
- package/dist/runner/effect-verify.d.ts +28 -0
- package/dist/runner/effect-verify.d.ts.map +1 -0
- package/dist/runner/effect-verify.js +42 -0
- package/dist/runner/effect-verify.js.map +1 -0
- package/dist/runner/execute-plan.d.ts +58 -0
- package/dist/runner/execute-plan.d.ts.map +1 -0
- package/dist/runner/execute-plan.js +426 -0
- package/dist/runner/execute-plan.js.map +1 -0
- package/dist/runner/max-turns-extension.d.ts +19 -0
- package/dist/runner/max-turns-extension.d.ts.map +1 -0
- package/dist/runner/max-turns-extension.js +25 -0
- package/dist/runner/max-turns-extension.js.map +1 -0
- package/dist/runner/micro-plan.d.ts +11 -0
- package/dist/runner/micro-plan.d.ts.map +1 -0
- package/dist/runner/micro-plan.js +29 -0
- package/dist/runner/micro-plan.js.map +1 -0
- package/dist/runner/prompt-snippets.d.ts +5 -0
- package/dist/runner/prompt-snippets.d.ts.map +1 -0
- package/dist/runner/prompt-snippets.js +13 -0
- package/dist/runner/prompt-snippets.js.map +1 -0
- package/dist/runner/replay/contracts.d.ts +300 -0
- package/dist/runner/replay/contracts.d.ts.map +1 -0
- package/dist/runner/replay/contracts.js +42 -0
- package/dist/runner/replay/contracts.js.map +1 -0
- package/dist/runner/replay/controller.d.ts +27 -0
- package/dist/runner/replay/controller.d.ts.map +1 -0
- package/dist/runner/replay/controller.js +197 -0
- package/dist/runner/replay/controller.js.map +1 -0
- package/dist/runner/replay/guard.d.ts +28 -0
- package/dist/runner/replay/guard.d.ts.map +1 -0
- package/dist/runner/replay/guard.js +100 -0
- package/dist/runner/replay/guard.js.map +1 -0
- package/dist/runner/runner.d.ts +44 -51
- package/dist/runner/runner.d.ts.map +1 -1
- package/dist/runner/runner.js +155 -851
- package/dist/runner/runner.js.map +1 -1
- package/dist/runner/scout-feedback.d.ts +51 -0
- package/dist/runner/scout-feedback.d.ts.map +1 -0
- package/dist/runner/scout-feedback.js +149 -0
- package/dist/runner/scout-feedback.js.map +1 -0
- package/dist/skills/macro-loader.d.ts +1 -1
- package/dist/test-runner.d.ts.map +1 -1
- package/dist/test-runner.js +27 -1
- package/dist/test-runner.js.map +1 -1
- package/dist/types/actions.d.ts +241 -0
- package/dist/types/actions.d.ts.map +1 -0
- package/dist/types/actions.js +5 -0
- package/dist/types/actions.js.map +1 -0
- package/dist/types/config.d.ts +211 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +2 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/design-audit.d.ts +92 -0
- package/dist/types/design-audit.d.ts.map +1 -0
- package/dist/types/design-audit.js +5 -0
- package/dist/types/design-audit.js.map +1 -0
- package/dist/types/design-tokens.d.ts +138 -0
- package/dist/types/design-tokens.d.ts.map +1 -0
- package/dist/types/design-tokens.js +5 -0
- package/dist/types/design-tokens.js.map +1 -0
- package/dist/types/page.d.ts +16 -0
- package/dist/types/page.d.ts.map +1 -0
- package/dist/types/page.js +2 -0
- package/dist/types/page.js.map +1 -0
- package/dist/types/plan.d.ts +50 -0
- package/dist/types/plan.d.ts.map +1 -0
- package/dist/types/plan.js +2 -0
- package/dist/types/plan.js.map +1 -0
- package/dist/types/preview.d.ts +9 -0
- package/dist/types/preview.d.ts.map +1 -0
- package/dist/types/preview.js +5 -0
- package/dist/types/preview.js.map +1 -0
- package/dist/types/result.d.ts +62 -0
- package/dist/types/result.d.ts.map +1 -0
- package/dist/types/result.js +2 -0
- package/dist/types/result.js.map +1 -0
- package/dist/types/scenario.d.ts +20 -0
- package/dist/types/scenario.d.ts.map +1 -0
- package/dist/types/scenario.js +5 -0
- package/dist/types/scenario.js.map +1 -0
- package/dist/types/test-runner.d.ts +145 -0
- package/dist/types/test-runner.d.ts.map +1 -0
- package/dist/types/test-runner.js +10 -0
- package/dist/types/test-runner.js.map +1 -0
- package/dist/types/trajectory.d.ts +38 -0
- package/dist/types/trajectory.d.ts.map +1 -0
- package/dist/types/trajectory.js +2 -0
- package/dist/types/trajectory.js.map +1 -0
- package/dist/types/turn.d.ts +50 -0
- package/dist/types/turn.d.ts.map +1 -0
- package/dist/types/turn.js +2 -0
- package/dist/types/turn.js.map +1 -0
- package/dist/types.d.ts +16 -1017
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +15 -8
- package/dist/types.js.map +1 -1
- package/dist/wallet/rpc-interception.d.ts +15 -0
- package/dist/wallet/rpc-interception.d.ts.map +1 -0
- package/dist/wallet/rpc-interception.js +95 -0
- package/dist/wallet/rpc-interception.js.map +1 -0
- package/package.json +23 -5
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vision-image clamp — the one pre-flight a screenshot needs before a vision API
|
|
3
|
+
* call. PURE (Buffer in → Buffer out, no IO): the disk read lives in the
|
|
4
|
+
* `vision-model` adapter, this only does pixel math, so it unit-tests with
|
|
5
|
+
* synthesised PNGs and no model.
|
|
6
|
+
*
|
|
7
|
+
* Why it exists: corpus exemplars are FULL-PAGE captures (e.g. 1440×14739). The
|
|
8
|
+
* Anthropic vision API rejects any image whose longest edge exceeds 8000px with a
|
|
9
|
+
* 400 `invalid_request_error`, and it internally downscales anything past ~1568px
|
|
10
|
+
* on the long edge regardless — so an un-clamped full-page screenshot either hard-
|
|
11
|
+
* fails (Anthropic-family providers) or burns tokens encoding detail the model
|
|
12
|
+
* never sees. Clamping the longest edge to {@link VISION_MAX_EDGE_PX} both clears
|
|
13
|
+
* the hard limit AND matches the API's own effective resolution, at a fraction of
|
|
14
|
+
* the base64 size.
|
|
15
|
+
*
|
|
16
|
+
* Fail-soft by design: an image already within the limit is returned BYTE-FOR-BYTE
|
|
17
|
+
* unchanged (no decode/re-encode), and a buffer that is not decodable as PNG is
|
|
18
|
+
* passed through untouched rather than thrown — the downstream model call is the
|
|
19
|
+
* place a genuinely bad image surfaces, not this size guard.
|
|
20
|
+
*/
|
|
21
|
+
import { PNG } from 'pngjs';
|
|
22
|
+
/**
|
|
23
|
+
* Longest-edge ceiling, in px. 1568 is the resolution the Anthropic vision API
|
|
24
|
+
* downscales to internally, and is comfortably under its 8000px hard limit — so
|
|
25
|
+
* clamping here is lossless relative to what the model would actually see while
|
|
26
|
+
* cutting the encoded payload by orders of magnitude on tall captures.
|
|
27
|
+
*/
|
|
28
|
+
export const VISION_MAX_EDGE_PX = 1568;
|
|
29
|
+
/**
|
|
30
|
+
* Downscale a PNG so its longest edge is ≤ `maxEdge`, preserving aspect ratio with
|
|
31
|
+
* an area-average (box) filter. Returns the ORIGINAL buffer unchanged when the
|
|
32
|
+
* image is already within bounds or cannot be parsed as PNG.
|
|
33
|
+
*/
|
|
34
|
+
export function clampPngLongestEdge(buf, maxEdge = VISION_MAX_EDGE_PX) {
|
|
35
|
+
let png;
|
|
36
|
+
try {
|
|
37
|
+
png = PNG.sync.read(buf);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
// Not a decodable PNG — leave it to the model call to reject; this guard only
|
|
41
|
+
// shrinks oversized images, it does not validate them.
|
|
42
|
+
return buf;
|
|
43
|
+
}
|
|
44
|
+
const { width, height } = png;
|
|
45
|
+
const longest = Math.max(width, height);
|
|
46
|
+
if (longest <= maxEdge)
|
|
47
|
+
return buf;
|
|
48
|
+
const scale = maxEdge / longest;
|
|
49
|
+
const newW = Math.max(1, Math.round(width * scale));
|
|
50
|
+
const newH = Math.max(1, Math.round(height * scale));
|
|
51
|
+
const out = new PNG({ width: newW, height: newH });
|
|
52
|
+
// Each destination pixel averages the source rectangle it maps to. The
|
|
53
|
+
// rectangles tile the source exactly, so every source pixel is read once —
|
|
54
|
+
// O(source pixels), independent of the downscale factor.
|
|
55
|
+
const src = png.data;
|
|
56
|
+
const dst = out.data;
|
|
57
|
+
for (let y = 0; y < newH; y++) {
|
|
58
|
+
const sy0 = Math.floor((y * height) / newH);
|
|
59
|
+
const sy1 = Math.max(sy0 + 1, Math.floor(((y + 1) * height) / newH));
|
|
60
|
+
for (let x = 0; x < newW; x++) {
|
|
61
|
+
const sx0 = Math.floor((x * width) / newW);
|
|
62
|
+
const sx1 = Math.max(sx0 + 1, Math.floor(((x + 1) * width) / newW));
|
|
63
|
+
let r = 0;
|
|
64
|
+
let g = 0;
|
|
65
|
+
let b = 0;
|
|
66
|
+
let a = 0;
|
|
67
|
+
let n = 0;
|
|
68
|
+
for (let sy = sy0; sy < sy1; sy++) {
|
|
69
|
+
const rowBase = sy * width;
|
|
70
|
+
for (let sx = sx0; sx < sx1; sx++) {
|
|
71
|
+
const idx = (rowBase + sx) << 2;
|
|
72
|
+
r += src[idx];
|
|
73
|
+
g += src[idx + 1];
|
|
74
|
+
b += src[idx + 2];
|
|
75
|
+
a += src[idx + 3];
|
|
76
|
+
n++;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const o = (y * newW + x) << 2;
|
|
80
|
+
dst[o] = Math.round(r / n);
|
|
81
|
+
dst[o + 1] = Math.round(g / n);
|
|
82
|
+
dst[o + 2] = Math.round(b / n);
|
|
83
|
+
dst[o + 3] = Math.round(a / n);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return PNG.sync.write(out);
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=image-clamp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-clamp.js","sourceRoot":"","sources":["../../../../../src/design/audit/reference/judge/image-clamp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAE3B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAA;AAEtC;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAW,EAAE,UAAkB,kBAAkB;IACnF,IAAI,GA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AAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAA;YAC7B,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;YAC1B,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;YAC9B,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;YAC9B,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;QAChC,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;AAC5B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Position-swapped pairwise debias — the core that cancels slot bias.
|
|
3
|
+
*
|
|
4
|
+
* A single judge call is contaminated by position bias: models systematically
|
|
5
|
+
* over-prefer whichever design sits in slot A. `judgePair` neutralises it by
|
|
6
|
+
* running BOTH slot orders through the INJECTED `TasteJudge` (A-vs-B and
|
|
7
|
+
* B-vs-A) and reconciling. The model call is the only impure part and it is
|
|
8
|
+
* injected, so `reconcileVerdicts` — where all the debias logic lives — is fully
|
|
9
|
+
* pure and unit-tests with stub verdicts and zero live model.
|
|
10
|
+
*
|
|
11
|
+
* Reconciliation rule (measures taste, not slot):
|
|
12
|
+
* - both orders pick the SAME id ⇒ that id wins (margin = mean confidence)
|
|
13
|
+
* - the preferred id FLIPS with the slot ⇒ pure position bias ⇒ tie
|
|
14
|
+
* - only one order separates them ⇒ a low-confidence win (margin halved)
|
|
15
|
+
* - both orders tie ⇒ tie
|
|
16
|
+
*
|
|
17
|
+
* `swapped` re-labels the subjects (a↔b) while preserving `dimension`,
|
|
18
|
+
* `reference`, and `rubricBody`, so the judge sees the same comparison from the
|
|
19
|
+
* other side — the second call is a genuine slot swap, not a different question.
|
|
20
|
+
*/
|
|
21
|
+
import type { JudgePairInput, RawVerdict, TasteJudge, TasteVerdict } from '../contracts.js';
|
|
22
|
+
/**
|
|
23
|
+
* Reconcile the two slot-order verdicts into a stable, id-keyed `TasteVerdict`.
|
|
24
|
+
* Pure: no IO, no model. `ab` presented a→SLOT A, b→SLOT B; `ba` presented
|
|
25
|
+
* b→SLOT A, a→SLOT B.
|
|
26
|
+
*/
|
|
27
|
+
export declare function reconcileVerdicts(ab: RawVerdict, ba: RawVerdict, aId: string, bId: string): TasteVerdict;
|
|
28
|
+
/**
|
|
29
|
+
* Run a single comparison through both slot orders (× `reps`) and reconcile to a
|
|
30
|
+
* position-debiased `TasteVerdict`. The `TasteJudge` is injected, so this is the
|
|
31
|
+
* only impure boundary; all aggregation is deterministic.
|
|
32
|
+
*/
|
|
33
|
+
export declare function judgePair(judge: TasteJudge, input: JudgePairInput, reps?: number): Promise<TasteVerdict>;
|
|
34
|
+
//# sourceMappingURL=pairwise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pairwise.d.ts","sourceRoot":"","sources":["../../../../../src/design/audit/reference/judge/pairwise.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAmB3F;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,UAAU,EACd,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,YAAY,CA+Bd;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,cAAc,EACrB,IAAI,SAAI,GACP,OAAO,CAAC,YAAY,CAAC,CAsBvB"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Position-swapped pairwise debias — the core that cancels slot bias.
|
|
3
|
+
*
|
|
4
|
+
* A single judge call is contaminated by position bias: models systematically
|
|
5
|
+
* over-prefer whichever design sits in slot A. `judgePair` neutralises it by
|
|
6
|
+
* running BOTH slot orders through the INJECTED `TasteJudge` (A-vs-B and
|
|
7
|
+
* B-vs-A) and reconciling. The model call is the only impure part and it is
|
|
8
|
+
* injected, so `reconcileVerdicts` — where all the debias logic lives — is fully
|
|
9
|
+
* pure and unit-tests with stub verdicts and zero live model.
|
|
10
|
+
*
|
|
11
|
+
* Reconciliation rule (measures taste, not slot):
|
|
12
|
+
* - both orders pick the SAME id ⇒ that id wins (margin = mean confidence)
|
|
13
|
+
* - the preferred id FLIPS with the slot ⇒ pure position bias ⇒ tie
|
|
14
|
+
* - only one order separates them ⇒ a low-confidence win (margin halved)
|
|
15
|
+
* - both orders tie ⇒ tie
|
|
16
|
+
*
|
|
17
|
+
* `swapped` re-labels the subjects (a↔b) while preserving `dimension`,
|
|
18
|
+
* `reference`, and `rubricBody`, so the judge sees the same comparison from the
|
|
19
|
+
* other side — the second call is a genuine slot swap, not a different question.
|
|
20
|
+
*/
|
|
21
|
+
const round4 = (n) => Math.round(n * 10000) / 10000;
|
|
22
|
+
const clamp01 = (n) => (n < 0 ? 0 : n > 1 ? 1 : n);
|
|
23
|
+
function slotToId(slot, idForSlotA, idForSlotB) {
|
|
24
|
+
if (slot === 'A')
|
|
25
|
+
return idForSlotA;
|
|
26
|
+
if (slot === 'B')
|
|
27
|
+
return idForSlotB;
|
|
28
|
+
return 'tie';
|
|
29
|
+
}
|
|
30
|
+
function mergeReasons(...lists) {
|
|
31
|
+
const out = [];
|
|
32
|
+
for (const list of lists) {
|
|
33
|
+
for (const r of list)
|
|
34
|
+
if (!out.includes(r))
|
|
35
|
+
out.push(r);
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Reconcile the two slot-order verdicts into a stable, id-keyed `TasteVerdict`.
|
|
41
|
+
* Pure: no IO, no model. `ab` presented a→SLOT A, b→SLOT B; `ba` presented
|
|
42
|
+
* b→SLOT A, a→SLOT B.
|
|
43
|
+
*/
|
|
44
|
+
export function reconcileVerdicts(ab, ba, aId, bId) {
|
|
45
|
+
const w1 = slotToId(ab.winnerSlot, aId, bId);
|
|
46
|
+
const w2 = slotToId(ba.winnerSlot, bId, aId);
|
|
47
|
+
const reasons = mergeReasons(ab.reasons, ba.reasons);
|
|
48
|
+
if (w1 === 'tie' && w2 === 'tie') {
|
|
49
|
+
return { aId, bId, winner: 'tie', margin: 0, reasons };
|
|
50
|
+
}
|
|
51
|
+
if (w1 !== 'tie' && w2 !== 'tie') {
|
|
52
|
+
if (w1 === w2) {
|
|
53
|
+
const margin = clamp01(round4((ab.confidence + ba.confidence) / 2));
|
|
54
|
+
return { aId, bId, winner: w1, margin, reasons };
|
|
55
|
+
}
|
|
56
|
+
// The preferred id flipped with the slot ⇒ the signal is position, not taste.
|
|
57
|
+
return {
|
|
58
|
+
aId,
|
|
59
|
+
bId,
|
|
60
|
+
winner: 'tie',
|
|
61
|
+
margin: 0,
|
|
62
|
+
reasons: mergeReasons(reasons, [
|
|
63
|
+
'position bias: preferred slot flipped across orders; collapsed to tie',
|
|
64
|
+
]),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
// Exactly one order expressed a preference; the other could not separate them.
|
|
68
|
+
// Honour the uncontradicted signal but at halved confidence.
|
|
69
|
+
const decided = w1 !== 'tie' ? w1 : w2;
|
|
70
|
+
const conf = w1 !== 'tie' ? ab.confidence : ba.confidence;
|
|
71
|
+
return { aId, bId, winner: decided, margin: clamp01(round4(conf / 2)), reasons };
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Run a single comparison through both slot orders (× `reps`) and reconcile to a
|
|
75
|
+
* position-debiased `TasteVerdict`. The `TasteJudge` is injected, so this is the
|
|
76
|
+
* only impure boundary; all aggregation is deterministic.
|
|
77
|
+
*/
|
|
78
|
+
export async function judgePair(judge, input, reps = 1) {
|
|
79
|
+
const aId = input.a.id;
|
|
80
|
+
const bId = input.b.id;
|
|
81
|
+
const swapped = { ...input, a: input.b, b: input.a };
|
|
82
|
+
const effReps = Math.max(1, Math.floor(reps));
|
|
83
|
+
let scoreA = 0;
|
|
84
|
+
let scoreB = 0;
|
|
85
|
+
const reasons = [];
|
|
86
|
+
for (let i = 0; i < effReps; i++) {
|
|
87
|
+
const ab = await judge.compare(input);
|
|
88
|
+
const ba = await judge.compare(swapped);
|
|
89
|
+
const v = reconcileVerdicts(ab, ba, aId, bId);
|
|
90
|
+
if (v.winner === aId)
|
|
91
|
+
scoreA += v.margin;
|
|
92
|
+
else if (v.winner === bId)
|
|
93
|
+
scoreB += v.margin;
|
|
94
|
+
for (const r of v.reasons)
|
|
95
|
+
if (!reasons.includes(r))
|
|
96
|
+
reasons.push(r);
|
|
97
|
+
}
|
|
98
|
+
const net = (scoreA - scoreB) / effReps;
|
|
99
|
+
if (net > 1e-9)
|
|
100
|
+
return { aId, bId, winner: aId, margin: clamp01(round4(net)), reasons };
|
|
101
|
+
if (net < -1e-9)
|
|
102
|
+
return { aId, bId, winner: bId, margin: clamp01(round4(-net)), reasons };
|
|
103
|
+
return { aId, bId, winner: 'tie', margin: 0, reasons };
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=pairwise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pairwise.js","sourceRoot":"","sources":["../../../../../src/design/audit/reference/judge/pairwise.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,MAAM,MAAM,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAA;AACnE,MAAM,OAAO,GAAG,CAAC,CAAS,EAAU,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AAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,CAAA;IACzF,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAA;AACxD,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Judge-response parsing — the PURE parse core. Turns one model response into a
|
|
3
|
+
* slot-relative `RawVerdict`. Fail-closed by contract: any unparseable or
|
|
4
|
+
* winner-less response collapses to a `tie` with confidence 0 and an explicit
|
|
5
|
+
* reason, never a fabricated A/B verdict. Slot bias is only neutralisable if a
|
|
6
|
+
* garbage response counts as "no signal", so this NEVER guesses a winner.
|
|
7
|
+
*
|
|
8
|
+
* It is deliberately tolerant of the noise real gateways add (markdown fences,
|
|
9
|
+
* prose preambles around the object) — mirroring `brain.parse` — but it is
|
|
10
|
+
* strict about the one field that matters: the winner must be an unambiguous
|
|
11
|
+
* A / B / tie token, or the verdict is a tie.
|
|
12
|
+
*/
|
|
13
|
+
import type { RawVerdict } from '../contracts.js';
|
|
14
|
+
/**
|
|
15
|
+
* STRICT parse: return a `RawVerdict` ONLY when the response carries an
|
|
16
|
+
* unambiguous winner token, else `null` ("no usable verdict"). This is the
|
|
17
|
+
* single source of truth for the happy path; both consumers build on it:
|
|
18
|
+
* - the text judge wraps it with a fail-closed tie (see `parseRawVerdict`), so a
|
|
19
|
+
* garbage single-model response is treated as "no signal" and the outer
|
|
20
|
+
* position-swap can cancel it;
|
|
21
|
+
* - the vision ENSEMBLE judge uses the `null` to DROP a non-responding model
|
|
22
|
+
* (exclude it from the majority tally + denominator), rather than diluting the
|
|
23
|
+
* agreement fraction with a phantom tie vote.
|
|
24
|
+
*/
|
|
25
|
+
export declare function parseVerdictOrNull(raw: string): RawVerdict | null;
|
|
26
|
+
/**
|
|
27
|
+
* Parse a judge response into a slot-relative `RawVerdict`. Garbage in →
|
|
28
|
+
* `{ winnerSlot: 'tie', confidence: 0, reasons: [<why>] }`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseRawVerdict(raw: string): RawVerdict;
|
|
31
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../../src/design/audit/reference/judge/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AA2DjD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAUjE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAWvD"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Judge-response parsing — the PURE parse core. Turns one model response into a
|
|
3
|
+
* slot-relative `RawVerdict`. Fail-closed by contract: any unparseable or
|
|
4
|
+
* winner-less response collapses to a `tie` with confidence 0 and an explicit
|
|
5
|
+
* reason, never a fabricated A/B verdict. Slot bias is only neutralisable if a
|
|
6
|
+
* garbage response counts as "no signal", so this NEVER guesses a winner.
|
|
7
|
+
*
|
|
8
|
+
* It is deliberately tolerant of the noise real gateways add (markdown fences,
|
|
9
|
+
* prose preambles around the object) — mirroring `brain.parse` — but it is
|
|
10
|
+
* strict about the one field that matters: the winner must be an unambiguous
|
|
11
|
+
* A / B / tie token, or the verdict is a tie.
|
|
12
|
+
*/
|
|
13
|
+
const DEFAULT_CONFIDENCE = 0.5;
|
|
14
|
+
function stripFences(raw) {
|
|
15
|
+
let t = raw.trim();
|
|
16
|
+
if (t.startsWith('```')) {
|
|
17
|
+
t = t
|
|
18
|
+
.replace(/^```(?:json)?\s*/i, '')
|
|
19
|
+
.replace(/```$/i, '')
|
|
20
|
+
.trim();
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
}
|
|
24
|
+
function extractObject(text) {
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(text);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// Some gateways wrap the object in prose ("Here's the verdict: {…}"); fall
|
|
30
|
+
// back to the outermost brace pair before giving up.
|
|
31
|
+
const first = text.indexOf('{');
|
|
32
|
+
const last = text.lastIndexOf('}');
|
|
33
|
+
if (first >= 0 && last > first) {
|
|
34
|
+
try {
|
|
35
|
+
return JSON.parse(text.slice(first, last + 1));
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function normalizeWinner(raw) {
|
|
45
|
+
if (typeof raw !== 'string')
|
|
46
|
+
return null;
|
|
47
|
+
const w = raw.trim().toUpperCase();
|
|
48
|
+
if (w === 'A')
|
|
49
|
+
return 'A';
|
|
50
|
+
if (w === 'B')
|
|
51
|
+
return 'B';
|
|
52
|
+
if (w === 'TIE' || w === 'DRAW' || w === 'EQUAL' || w === 'NEITHER' || w === 'NONE')
|
|
53
|
+
return 'tie';
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
function normalizeConfidence(raw) {
|
|
57
|
+
const n = typeof raw === 'number' ? raw : typeof raw === 'string' ? parseFloat(raw) : NaN;
|
|
58
|
+
if (!Number.isFinite(n))
|
|
59
|
+
return DEFAULT_CONFIDENCE;
|
|
60
|
+
return n < 0 ? 0 : n > 1 ? 1 : n;
|
|
61
|
+
}
|
|
62
|
+
function normalizeReasons(raw) {
|
|
63
|
+
if (Array.isArray(raw)) {
|
|
64
|
+
return raw
|
|
65
|
+
.filter((r) => typeof r === 'string' && r.trim().length > 0)
|
|
66
|
+
.map((r) => r.trim());
|
|
67
|
+
}
|
|
68
|
+
if (typeof raw === 'string' && raw.trim().length > 0)
|
|
69
|
+
return [raw.trim()];
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* STRICT parse: return a `RawVerdict` ONLY when the response carries an
|
|
74
|
+
* unambiguous winner token, else `null` ("no usable verdict"). This is the
|
|
75
|
+
* single source of truth for the happy path; both consumers build on it:
|
|
76
|
+
* - the text judge wraps it with a fail-closed tie (see `parseRawVerdict`), so a
|
|
77
|
+
* garbage single-model response is treated as "no signal" and the outer
|
|
78
|
+
* position-swap can cancel it;
|
|
79
|
+
* - the vision ENSEMBLE judge uses the `null` to DROP a non-responding model
|
|
80
|
+
* (exclude it from the majority tally + denominator), rather than diluting the
|
|
81
|
+
* agreement fraction with a phantom tie vote.
|
|
82
|
+
*/
|
|
83
|
+
export function parseVerdictOrNull(raw) {
|
|
84
|
+
const obj = extractObject(stripFences(raw));
|
|
85
|
+
if (!obj)
|
|
86
|
+
return null;
|
|
87
|
+
const winnerSlot = normalizeWinner(obj.winner ?? obj.winnerSlot ?? obj.choice);
|
|
88
|
+
if (!winnerSlot)
|
|
89
|
+
return null;
|
|
90
|
+
return {
|
|
91
|
+
winnerSlot,
|
|
92
|
+
confidence: normalizeConfidence(obj.confidence),
|
|
93
|
+
reasons: normalizeReasons(obj.reasons ?? obj.reason),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Parse a judge response into a slot-relative `RawVerdict`. Garbage in →
|
|
98
|
+
* `{ winnerSlot: 'tie', confidence: 0, reasons: [<why>] }`.
|
|
99
|
+
*/
|
|
100
|
+
export function parseRawVerdict(raw) {
|
|
101
|
+
const verdict = parseVerdictOrNull(raw);
|
|
102
|
+
if (verdict)
|
|
103
|
+
return verdict;
|
|
104
|
+
// No usable winner ⇒ fail closed to a tie, preserving the specific reason: an
|
|
105
|
+
// object with no valid winner vs. a response with no object at all.
|
|
106
|
+
const hasObject = extractObject(stripFences(raw)) !== null;
|
|
107
|
+
return {
|
|
108
|
+
winnerSlot: 'tie',
|
|
109
|
+
confidence: 0,
|
|
110
|
+
reasons: [hasObject ? 'judge response missing a valid winner' : 'unparseable judge response'],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../../src/design/audit/reference/judge/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,MAAM,kBAAkB,GAAG,GAAG,CAAA;AAE9B,SAAS,WAAW,CAAC,GAAW;IAC9B,IAAI,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAA;IAClB,IAAI,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,CAAC,GAAG,CAAC;aACF,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC;aAChC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;aACpB,IAAI,EAAE,CAAA;IACX,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC;AAED,SAAS,aAAa,CAAC,IAAY;IACjC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAA4B,CAAA;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,2EAA2E;QAC3E,qDAAqD;QACrD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;QAClC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;YAC/B,IAAI,CAAC;gBACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,GAAG,CAAC,CAAC,CAA4B,CAAA;YAC3E,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,IAAI,CAAA;YACb,CAAC;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,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pairwise / absolute-quality judge prompts — the PURE prompt core of the taste
|
|
3
|
+
* judge. No IO, no LLM, no browser: every output is a deterministic function of
|
|
4
|
+
* the `JudgePairInput` + the chosen presentation `slot`, so identical inputs
|
|
5
|
+
* always yield byte-identical prompts (a hard requirement for reproducibility and
|
|
6
|
+
* for the position-swapped double run to cancel bias rather than introduce it).
|
|
7
|
+
*
|
|
8
|
+
* Two builders, one per judging leg:
|
|
9
|
+
* - `buildPairwisePrompt` — the RELATIVE leg: two redesign directions judged
|
|
10
|
+
* against a named reference (holistic taste/craft/fit).
|
|
11
|
+
* - `buildQualityPrompt` — the ABSOLUTE leg: page vs world-class exemplar,
|
|
12
|
+
* optionally narrowed to ONE product `Dimension` so the per-dimension win-rate
|
|
13
|
+
* is genuinely judge-resolved, never one overall number stamped across dims.
|
|
14
|
+
*
|
|
15
|
+
* Both carry an explicit anti-position-bias clause: SLOT A/B order is declared
|
|
16
|
+
* information-free so the model is told to judge on merit alone. The `slot`
|
|
17
|
+
* argument decides which logical subject (`input.a` / `input.b`) is physically
|
|
18
|
+
* rendered as SLOT A — the debias core drives both orders through here.
|
|
19
|
+
*/
|
|
20
|
+
import type { JudgePairInput } from '../contracts.js';
|
|
21
|
+
/** Presentation order: 'AB' renders input.a as SLOT A; 'BA' swaps them. */
|
|
22
|
+
export type Slot = 'AB' | 'BA';
|
|
23
|
+
/**
|
|
24
|
+
* The RELATIVE leg prompt: two redesign directions judged against a reference.
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildPairwisePrompt(input: JudgePairInput, slot: Slot): {
|
|
27
|
+
system: string;
|
|
28
|
+
user: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The ABSOLUTE leg prompt: page vs world-class exemplar, optionally narrowed to
|
|
32
|
+
* a single product `Dimension`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildQualityPrompt(input: JudgePairInput, slot: Slot): {
|
|
35
|
+
system: string;
|
|
36
|
+
user: string;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../../src/design/audit/reference/judge/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAA6C,MAAM,iBAAiB,CAAA;AAEhG,2EAA2E;AAC3E,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAmF9B;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAUvG;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAatG"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pairwise / absolute-quality judge prompts — the PURE prompt core of the taste
|
|
3
|
+
* judge. No IO, no LLM, no browser: every output is a deterministic function of
|
|
4
|
+
* the `JudgePairInput` + the chosen presentation `slot`, so identical inputs
|
|
5
|
+
* always yield byte-identical prompts (a hard requirement for reproducibility and
|
|
6
|
+
* for the position-swapped double run to cancel bias rather than introduce it).
|
|
7
|
+
*
|
|
8
|
+
* Two builders, one per judging leg:
|
|
9
|
+
* - `buildPairwisePrompt` — the RELATIVE leg: two redesign directions judged
|
|
10
|
+
* against a named reference (holistic taste/craft/fit).
|
|
11
|
+
* - `buildQualityPrompt` — the ABSOLUTE leg: page vs world-class exemplar,
|
|
12
|
+
* optionally narrowed to ONE product `Dimension` so the per-dimension win-rate
|
|
13
|
+
* is genuinely judge-resolved, never one overall number stamped across dims.
|
|
14
|
+
*
|
|
15
|
+
* Both carry an explicit anti-position-bias clause: SLOT A/B order is declared
|
|
16
|
+
* information-free so the model is told to judge on merit alone. The `slot`
|
|
17
|
+
* argument decides which logical subject (`input.a` / `input.b`) is physically
|
|
18
|
+
* rendered as SLOT A — the debias core drives both orders through here.
|
|
19
|
+
*/
|
|
20
|
+
// Plain-language guidance per product-quality dimension, injected only when the
|
|
21
|
+
// absolute leg scopes a comparison to one `Dimension`. Lives here (with the
|
|
22
|
+
// prompt logic) — never in the logic-free contracts hub.
|
|
23
|
+
const DIMENSION_GUIDANCE = {
|
|
24
|
+
product_intent: 'how clearly and directly the design serves its core job-to-be-done',
|
|
25
|
+
visual_craft: 'typographic precision, colour discipline, spacing rhythm, and overall polish',
|
|
26
|
+
trust_clarity: 'legibility, contrast, restraint, and signals of credibility',
|
|
27
|
+
workflow: 'how efficiently a user can complete the primary task with minimal friction',
|
|
28
|
+
content_ia: 'information hierarchy, scannability, and content organisation',
|
|
29
|
+
};
|
|
30
|
+
const ANTI_POSITION_BIAS = 'SLOT A and SLOT B are presented in a randomized order that carries NO information. ' +
|
|
31
|
+
'Do not favour a design because of its slot — judge only on merit.';
|
|
32
|
+
// Both pairwise subjects redesign the SAME real page, so "richer" content is not
|
|
33
|
+
// a virtue when it is fabricated. Without this, the judge rewards a direction for
|
|
34
|
+
// importing the reference's content (e.g. an invented activity feed) — exactly
|
|
35
|
+
// the failure that inflates sparse-page redesigns. Fidelity to the page's real
|
|
36
|
+
// content is the floor; "fit to the reference" is aesthetic, not content, fit.
|
|
37
|
+
const CONTENT_FIDELITY = 'Both directions redesign the SAME real page. Judge them as faithful redesigns of that page, not as new pages. ' +
|
|
38
|
+
'A direction that invents content the page does not have — fabricated metrics, counts, dates, statuses, activity ' +
|
|
39
|
+
'feeds, or whole sections of made-up data — is LESS faithful and must be penalised, never rewarded as "richer". ' +
|
|
40
|
+
'"Fit to the reference" means matching its visual craft (type, colour, motion, spacing, hierarchy), not importing its content.';
|
|
41
|
+
const RESPONSE_CONTRACT = [
|
|
42
|
+
'Respond with ONLY a JSON object and no surrounding prose:',
|
|
43
|
+
'{"winner": "A" | "B" | "tie", "confidence": <number 0-1>, "reasons": [<short strings>]}',
|
|
44
|
+
].join('\n');
|
|
45
|
+
function orderedSubjects(input, slot) {
|
|
46
|
+
return slot === 'AB' ? [input.a, input.b] : [input.b, input.a];
|
|
47
|
+
}
|
|
48
|
+
function renderReference(ref) {
|
|
49
|
+
if (!ref)
|
|
50
|
+
return '';
|
|
51
|
+
return `REFERENCE (${ref.kind}) — judge both designs against this world-class target:\n${ref.summary}`;
|
|
52
|
+
}
|
|
53
|
+
function renderRubric(body) {
|
|
54
|
+
if (!body)
|
|
55
|
+
return '';
|
|
56
|
+
return `SCORING CRITERIA:\n${body}`;
|
|
57
|
+
}
|
|
58
|
+
function renderSubject(label, s) {
|
|
59
|
+
const lines = [`SLOT ${label} (identity withheld):`];
|
|
60
|
+
if (s.directionSummary)
|
|
61
|
+
lines.push(s.directionSummary);
|
|
62
|
+
lines.push(s.dnaSummary);
|
|
63
|
+
return lines.join('\n');
|
|
64
|
+
}
|
|
65
|
+
function joinSections(sections) {
|
|
66
|
+
return sections.filter((s) => s.length > 0).join('\n\n');
|
|
67
|
+
}
|
|
68
|
+
function pairwiseSystem() {
|
|
69
|
+
return [
|
|
70
|
+
'You are a senior product designer choosing which redesign direction serves the page\'s real users better at their tasks.',
|
|
71
|
+
'Judge in PRIORITY ORDER: (1) TASK FITNESS — does it make the primary user\'s job easier and faster? (2) FUNCTIONAL PRESERVATION — a direction that removes navigation or wayfinding, reduces information density, or shows fewer items/sections than the page needs is WORSE for users, however polished it looks. (3) VISUAL CRAFT — type, colour, spacing rhythm, hierarchy, polish.',
|
|
72
|
+
'"Fit to the reference" counts only as visual craft; never reward a direction for importing the reference\'s structure or content.',
|
|
73
|
+
CONTENT_FIDELITY,
|
|
74
|
+
ANTI_POSITION_BIAS,
|
|
75
|
+
RESPONSE_CONTRACT,
|
|
76
|
+
'Use "tie" only when the two are genuinely indistinguishable in quality.',
|
|
77
|
+
].join('\n');
|
|
78
|
+
}
|
|
79
|
+
function qualitySystem(dimension) {
|
|
80
|
+
const focus = dimension
|
|
81
|
+
? ` Focus ONLY on the "${dimension}" dimension: ${DIMENSION_GUIDANCE[dimension]}.`
|
|
82
|
+
: '';
|
|
83
|
+
return [
|
|
84
|
+
`You are a senior product designer and design critic judging which of two designs is closer to world-class quality FOR ITS USERS' TASKS.${focus}`,
|
|
85
|
+
'Reward fitness for the page\'s job — task efficiency, preserved navigation, and appropriate information density — not decoration. A design that looks cleaner by removing wayfinding or content the users need is worse, not better.',
|
|
86
|
+
ANTI_POSITION_BIAS,
|
|
87
|
+
RESPONSE_CONTRACT,
|
|
88
|
+
'Use "tie" only when the two are genuinely on par.',
|
|
89
|
+
].join('\n');
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The RELATIVE leg prompt: two redesign directions judged against a reference.
|
|
93
|
+
*/
|
|
94
|
+
export function buildPairwisePrompt(input, slot) {
|
|
95
|
+
const [first, second] = orderedSubjects(input, slot);
|
|
96
|
+
const user = joinSections([
|
|
97
|
+
renderReference(input.reference),
|
|
98
|
+
renderRubric(input.rubricBody),
|
|
99
|
+
renderSubject('A', first),
|
|
100
|
+
renderSubject('B', second),
|
|
101
|
+
'Which slot is the stronger redesign direction?',
|
|
102
|
+
]);
|
|
103
|
+
return { system: pairwiseSystem(), user };
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The ABSOLUTE leg prompt: page vs world-class exemplar, optionally narrowed to
|
|
107
|
+
* a single product `Dimension`.
|
|
108
|
+
*/
|
|
109
|
+
export function buildQualityPrompt(input, slot) {
|
|
110
|
+
const [first, second] = orderedSubjects(input, slot);
|
|
111
|
+
const question = input.dimension
|
|
112
|
+
? `Which slot better exemplifies world-class "${input.dimension}"?`
|
|
113
|
+
: 'Which slot is the higher-quality design overall?';
|
|
114
|
+
const user = joinSections([
|
|
115
|
+
renderReference(input.reference),
|
|
116
|
+
renderRubric(input.rubricBody),
|
|
117
|
+
renderSubject('A', first),
|
|
118
|
+
renderSubject('B', second),
|
|
119
|
+
question,
|
|
120
|
+
]);
|
|
121
|
+
return { system: qualitySystem(input.dimension), user };
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../src/design/audit/reference/judge/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAOH,gFAAgF;AAChF,4EAA4E;AAC5E,yDAAyD;AACzD,MAAM,kBAAkB,GAA8B;IACpD,cAAc,EAAE,oEAAoE;IACpF,YAAY,EAAE,8EAA8E;IAC5F,aAAa,EAAE,6DAA6D;IAC5E,QAAQ,EAAE,4EAA4E;IACtF,UAAU,EAAE,+DAA+D;CAC5E,CAAA;AAED,MAAM,kBAAkB,GACtB,qFAAqF;IACrF,mEAAmE,CAAA;AAErE,iFAAiF;AACjF,kFAAkF;AAClF,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,MAAM,gBAAgB,GACpB,gHAAgH;IAChH,kHAAkH;IAClH,iHAAiH;IACjH,+HAA+H,CAAA;AAEjI,MAAM,iBAAiB,GAAG;IACxB,2DAA2D;IAC3D,yFAAyF;CAC1F,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAEZ,SAAS,eAAe,CAAC,KAAqB,EAAE,IAAU;IACxD,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;AAChE,CAAC;AAED,SAAS,eAAe,CAAC,GAAsB;IAC7C,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAA;IAC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ACH,MAAM,UAAU,mBAAmB,CAAC,KAAqB,EAAE,IAAU;IACnE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IACpD,MAAM,IAAI,GAAG,YAAY,CAAC;QACxB,eAAe,CAAC,KAAK,CAAC,SAAS,CAAC;QAChC,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC;QAC9B,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC;QACzB,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC;QAC1B,gDAAgD;KACjD,CAAC,CAAA;IACF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,CAAA;AAC3C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAqB,EAAE,IAAU;IAClE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IACpD,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS;QAC9B,CAAC,CAAC,8CAA8C,KAAK,CAAC,SAAS,IAAI;QACnE,CAAC,CAAC,kDAAkD,CAAA;IACtD,MAAM,IAAI,GAAG,YAAY,CAAC;QACxB,eAAe,CAAC,KAAK,CAAC,SAAS,CAAC;QAChC,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC;QAC9B,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC;QACzB,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC;QAC1B,QAAQ;KACT,CAAC,CAAA;IACF,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAA;AACzD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Absolute quality assessment — the single honest scoring leg.
|
|
3
|
+
*
|
|
4
|
+
* `assessPageQuality` judges the page-under-audit against the retrieved
|
|
5
|
+
* world-class exemplars with the same position-swapped `judgePair` debias, and
|
|
6
|
+
* reports the page's win-rate. This — NOT the relative direction ranking — is
|
|
7
|
+
* what `score-core` turns into the headline 0-10 and the per-`Dimension` scores.
|
|
8
|
+
*
|
|
9
|
+
* Overall leg: one debiased comparison per exemplar → `overallWinRate`.
|
|
10
|
+
* Optional per-dimension leg (`opts.dimensions`): one dimension-scoped
|
|
11
|
+
* comparison SET per `Dimension`, so each `dimensionWinRates` entry is genuinely
|
|
12
|
+
* judge-resolved (the judge narrows its rubric to that dimension), never the
|
|
13
|
+
* overall number stamped across dims. A dimension with no decisive comparison is
|
|
14
|
+
* OMITTED — callers must not fabricate a per-dim score from `overallWinRate`.
|
|
15
|
+
*
|
|
16
|
+
* Pure¹: the `TasteJudge` is injected, so this unit-tests with a stub judge and
|
|
17
|
+
* no live model. Comparisons run sequentially for deterministic accounting;
|
|
18
|
+
* concurrency/budget is the orchestrator's concern, not this leg's.
|
|
19
|
+
*/
|
|
20
|
+
import type { Dimension, JudgeSubject, QualityAssessment, TasteJudge } from '../contracts.js';
|
|
21
|
+
/**
|
|
22
|
+
* Assess the absolute quality of `page` against `exemplars` → a `win-rate`-keyed
|
|
23
|
+
* `QualityAssessment`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function assessPageQuality(judge: TasteJudge, page: JudgeSubject, exemplars: JudgeSubject[], opts?: {
|
|
26
|
+
dimensions?: Dimension[];
|
|
27
|
+
}): Promise<QualityAssessment>;
|
|
28
|
+
//# sourceMappingURL=quality.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quality.d.ts","sourceRoot":"","sources":["../../../../../src/design/audit/reference/judge/quality.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACX,MAAM,iBAAiB,CAAA;AAgCxB;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,YAAY,EAAE,EACzB,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,SAAS,EAAE,CAAA;CAAO,GACtC,OAAO,CAAC,iBAAiB,CAAC,CAoB5B"}
|