@mutagent/helix 0.1.0-alpha.14
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/.claude/skills/mutagent-helix/SKILL.md +113 -0
- package/.claude/skills/mutagent-helix/scripts/cli/codex-transcode.ts +143 -0
- package/.claude/skills/mutagent-helix/scripts/cli/doctor.ts +111 -0
- package/.claude/skills/mutagent-helix/scripts/cli/init.ts +382 -0
- package/.claude/skills/mutagent-helix/scripts/cli/run.sh +61 -0
- package/CLAUDE.md +193 -0
- package/LICENSE +201 -0
- package/NOTICE +22 -0
- package/README.md +209 -0
- package/assets/adl-loop.svg +162 -0
- package/assets/system-status.svg +422 -0
- package/bin/mutagent-cli.mjs +9950 -0
- package/bin/mutagent-helix.mjs +78 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/CLAUDE.md +28 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/SKILL.md +138 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/assets/templates/agentspec.yaml.tpl +247 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/references/frameworks/doc-pins.md +53 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/references/principles.md +91 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/references/requirements.yaml +295 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/references/workflows/orchestrator-protocol.md +302 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/cli/doctor.ts +116 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/cli/init.ts +230 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/cli/run.sh +60 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/config/resolve-spec-dir.ts +199 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/contract/agentspec.schema.ts +455 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/setup/detect.ts +67 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/validate/validate-spec.ts +93 -0
- package/mutagent-agentspec/LICENSE +201 -0
- package/mutagent-agentspec/NOTICE +19 -0
- package/mutagent-agentspec/README.md +44 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/SKILL.md +100 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/assets/agents/ai-architect.md +312 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/assets/agents/ai-engineer.md +357 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/assets/templates/build-report.md.tpl +39 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/references/principles.md +31 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/references/workflows/build-protocol.md +61 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/references/workflows/improve-handoff.md +23 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/scripts/cli/run.sh +60 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/scripts/handoff/validate-build-input.ts +72 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/scripts/sync-spec/check-sync-spec.ts +499 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/scripts/verify/spec-impl-coverage.ts +182 -0
- package/mutagent-builder/CLAUDE.md +25 -0
- package/mutagent-builder/README.md +26 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/README.md +192 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/SKILL.md +352 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/agents/ai-architect.md +256 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/agents/ai-engineer.md +344 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/agents/diagnostics-analyzer.md +576 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/agents/discovery.md +425 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/audit.json.tpl +24 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/audit.md.tpl +49 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/config.yaml.tpl +100 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/pr-body.md.tpl +56 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/report.html.tpl +327 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/README.md +27 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/iter-N-handover.md.tpl +125 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/self-diagnosis-contract.v0.1.0.yaml.tpl +234 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/spec.yaml.tpl +152 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/team.yaml.tpl +127 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/wave-N-dashboard.html.tpl +1712 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.1-nl-query.md +59 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.2-tier0-progress.md +58 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.3-analysis-progress.md +44 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.4-html-report.md +61 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.5-rca-detail.md +69 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.6-stale-warning.md +53 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.1-welcome.md +60 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.2-source-platform-picker.md +41 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.3-source-auth.md +75 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.4-target-picker.md +48 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.5-ask-tool.md +43 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.6-config-review.md +57 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.7-filter-defaults.md +52 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.8-first-run.md +59 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/examples/sample-findings.json +92 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/examples/sample-meta.json +47 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/adapter-strategy.md +75 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/config-migration.md +84 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/config.md +159 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/filter-search-matrix.md +66 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/harness-knowledge.md +22 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/memory-format.md +78 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/onboarding-decisions.yaml +187 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/operation-inventory.md +59 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/overview.md +167 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/reference.md +119 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/script-index.md +101 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-adapter-contract.md +93 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/claude-code-transcripts.md +66 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/codex-transcripts.md +78 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/codex.md +145 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/install-paths.md +57 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/langfuse.md +178 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/local-jsonl.md +55 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/openobserve.md +102 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/otel.md +63 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/cloud-rest.md +84 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-claude.md +65 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-cloud-agent-sdk.md +92 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-codex.md +72 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-cursor.md +108 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-mastra.md +77 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-opencode.md +70 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/apply-pr-comment-format.md +82 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/diagnostics.md +35 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/handover-contract.md +247 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/onboarding.md +300 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/orchestrator-protocol.md +1861 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/rca.md +331 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/rendering-anatomy.md +314 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/schedule-prep.md +100 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/scope-model.md +128 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/verification-methodology.md +174 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/aggregate/sort-findings.ts +0 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/awareness/blind-spots.ts +167 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/awareness/llm-sample.ts +681 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/doctor.ts +215 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/init.ts +1013 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/install-agents.ts +350 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/run.sh +61 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/shared-templates.ts +79 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/config/load.ts +392 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/config/resolve-credential.ts +120 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/config/schema.ts +641 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/config/validate.ts +134 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/context/build-diagnosis-context.ts +417 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/context/load-context.ts +105 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/contract/types.ts +166 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/build-render-input.ts +1964 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/corpus-severity.ts +172 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/dismissal-match.ts +270 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/rank-remedies.ts +75 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/hooks/install-hooks.sh +46 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/hooks/pre-push.sh +78 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/invocation/parse-brief.ts +188 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/library/match.ts +114 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/library/paths.ts +95 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/library/store.ts +535 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/library/types.ts +181 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/lint/template-inline-js.ts +267 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/memory/append.ts +188 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/memory/read.ts +218 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/platforms/entity-context.ts +686 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/read-unitf.ts +267 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/trace.ts +1078 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/unitf-adapter.ts +0 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/unitf-types.ts +213 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/report/persist-selections.ts +174 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/report/render.ts +3254 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/run/diagnose.ts +64 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/run/session.ts +167 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/sample/caps.ts +345 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/sample/deep-read-gate.ts +424 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/sample/representative.ts +584 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/scan/objection.ts +224 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/scan/trajectory.ts +489 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/self-diagnostics/dispatch.ts +135 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/self-diagnostics/probe.ts +170 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/setup/detect.ts +307 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/setup/ensure-cli.ts +315 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/setup/reconfigure.ts +77 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/setup/verify-agents.ts +207 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/slicer.ts +166 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/claude-code.ts +17 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/codex.ts +11 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/langfuse.ts +17 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/local-jsonl.ts +12 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/otel.ts +12 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/index.ts +54 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/registry.ts +45 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/types.ts +86 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/stale-detector.ts +74 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/test/render-playwright.cli.ts +477 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/tier0/claude-code.ts +133 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/tier0/langfuse.ts +143 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/tier0-scan.ts +423 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/completeness-check.ts +436 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/doc-refs.ts +190 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/finalize-gate.ts +417 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/findings-contract.ts +628 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/render-js-syntax.ts +188 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/report-checklist.yaml +217 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/trace-shape.ts +262 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/wave6-checklist.ts +326 -0
- package/mutagent-diagnostics/CLAUDE.md +41 -0
- package/mutagent-diagnostics/LICENSE +201 -0
- package/mutagent-diagnostics/NOTICE +18 -0
- package/mutagent-diagnostics/README.md +343 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/SKILL.md +548 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/agents/audit-executor.md +169 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/agents/dataset-builder.md +160 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/agents/discovery.md +425 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/agents/evaluator.md +1108 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/brand/theme.css +213 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/brand/wordmark.html +9 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/context-flow-lens.md +85 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/data-lens.md +47 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/decision-lens.md +48 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/methodology-critic-lens.md +53 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/trajectory-lens.md +44 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/build-review-interface.md +83 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/edd-loop.md +134 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/error-analysis.md +113 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/eval-audit.md +154 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/eval-stage.md +168 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/generate-synthetic-data.md +81 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/grounded-adjudication.md +221 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/memory-format.md +65 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/methodology.md +201 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/operation-inventory.md +197 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/validate-evaluator.md +125 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/workflows/orchestrator-protocol.md +300 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/write-judge-prompt.md +123 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/behavior-tree.schema.yaml +73 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/dataset.schema.yaml +66 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/edd-change-request.schema.yaml +114 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/eval-matrix.schema.yaml +74 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/flow-graph.schema.yaml +69 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/flow-profile.schema.yaml +49 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/methodology-review.schema.yaml +40 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/scorecard.schema.yaml +85 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/agent-dispatch.ts +0 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/aggregate-discover.ts +543 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/artifact-paths.ts +115 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/assemble-scorecard.ts +172 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/build-dataset.ts +186 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/build-evals.ts +93 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/build-review-ui.ts +393 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/check-method-router.ts +170 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/aggregate.ts +112 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/audit-run.ts +182 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/doctor.ts +211 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/dogfood.ts +133 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/init.ts +601 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/methodology-review.ts +122 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/prep.ts +295 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/profile-subject.ts +165 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/run.sh +56 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/variance-check.ts +105 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/code-eval.ts +248 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/code-quality-verdict.ts +285 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/codegen-evals.ts +173 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cold-start-project.ts +151 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cold-start-sampler.ts +267 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/config/load.ts +343 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/config/schema.ts +380 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/agentspec-evals.ts +85 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/dataset.ts +149 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/eval-engine.ts +118 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/eval-matrix.ts +577 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/eval-types.ts +1074 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/flow-graph.ts +194 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/types.ts +303 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/validation.ts +193 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/derive-dataset.ts +152 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/determine-outcome.ts +219 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/diff-discriminate.ts +160 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/discover-criteria.ts +348 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/edd/change-request.ts +232 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/edd/edd-types.ts +210 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/edd/variance-gate.ts +186 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/emit-completeness.ts +111 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/eval-engine.ts +160 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/evaluate.ts +333 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/flow-graph.ts +230 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/judge-prompt-template.ts +253 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/judge-provider.ts +135 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/lint-grounding.ts +229 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/lint-uniformity.ts +168 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/living-suite.ts +109 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/load-bundle.ts +203 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/load-profile-vocab.ts +64 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/load-profile.ts +106 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/mask.ts +138 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/materialize-dataset.ts +113 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/matrix-judge.ts +750 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/memory/append.ts +215 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/memory/read.ts +168 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/persist-eval-criteria.ts +232 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/prep-tasks.ts +125 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/profile-subject.ts +310 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/publish-report.ts +131 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/read-unitf-traces.ts +81 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/render-build-cards.ts +195 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/render-discover-report.ts +1640 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/render-eval-report.ts +3838 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/render-report.ts +212 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/resolve-credential.ts +110 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/resolve-ref.ts +98 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/result-verify.ts +129 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/route-failures.ts +330 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/run-deterministic.ts +367 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/run-evaluate.ts +719 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/run-judge.ts +155 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/run-pipeline.ts +175 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/sample-traces.ts +210 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/self-audit.ts +387 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/source-map.ts +106 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/subject-profile.ts +134 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/substrate.ts +162 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/sync-eval-criteria.ts +244 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/ui-slots.ts +119 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/unitf-to-evaltrace.ts +284 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/validate-judge.ts +358 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/variance-compare.ts +177 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/subjects/mutagent-diagnostics/behavior-tree.yaml +140 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/subjects/mutagent-diagnostics/eval-matrix.yaml +1270 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/subjects/mutagent-diagnostics/methodology-review.yaml +105 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/workflows/audit.workflow.js +82 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/workflows/data-leak.workflow.js +236 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/workflows/variance.workflow.js +163 -0
- package/mutagent-evaluator/CLAUDE.md +45 -0
- package/mutagent-evaluator/LICENSE +201 -0
- package/mutagent-evaluator/NOTICE +23 -0
- package/mutagent-evaluator/README.md +88 -0
- package/mutagent-optimize/.claude/skills/mutagent-optimize/SKILL.md +287 -0
- package/mutagent-optimize/.claude/skills/mutagent-optimize/scripts/contracts/amend-request.ts +503 -0
- package/mutagent-optimize/.claude/skills/mutagent-optimize/scripts/improve-loop-run.ts +304 -0
- package/mutagent-optimize/.claude/skills/mutagent-optimize/scripts/loop-state-cli.ts +300 -0
- package/mutagent-optimize/.claude/skills/mutagent-optimize/scripts/loop-state.ts +440 -0
- package/mutagent-optimize/CLAUDE.md +49 -0
- package/mutagent-optimize/README.md +26 -0
- package/mutagent-orchestrator/CLAUDE.md +102 -0
- package/mutagent-orchestrator/README.md +20 -0
- package/mutagent-orchestrator/assets/agents/discovery.md +425 -0
- package/mutagent-orchestrator/assets/agents/dogfood-monitor.md +266 -0
- package/mutagent-orchestrator/assets/agents/monitor.md +258 -0
- package/mutagent-orchestrator/orchestrator.md +782 -0
- package/mutagent-orchestrator/references/MONITORING.md +209 -0
- package/mutagent-orchestrator/references/config-fields.md +132 -0
- package/mutagent-orchestrator/references/config-migration.md +132 -0
- package/mutagent-orchestrator/references/index-registry.md +92 -0
- package/mutagent-orchestrator/routing.yaml +391 -0
- package/mutagent-orchestrator/scripts/config-schema.ts +1010 -0
- package/mutagent-orchestrator/scripts/dispatch.ts +439 -0
- package/mutagent-orchestrator/scripts/dogfood/extract-feedback.ts +203 -0
- package/mutagent-orchestrator/scripts/dogfood/reconstruct-trajectory.ts +327 -0
- package/mutagent-orchestrator/scripts/dogfood/render-dogfood-report.ts +347 -0
- package/mutagent-orchestrator/scripts/dogfood/resolve-subagents.ts +160 -0
- package/mutagent-orchestrator/scripts/dogfood/run-report.ts +264 -0
- package/mutagent-orchestrator/scripts/dogfood/slack-thread.ts +106 -0
- package/mutagent-orchestrator/scripts/dogfood/types.ts +257 -0
- package/mutagent-orchestrator/scripts/eval-routing.ts +753 -0
- package/mutagent-orchestrator/scripts/gate.ts +219 -0
- package/mutagent-orchestrator/scripts/handover-contract.ts +362 -0
- package/mutagent-orchestrator/scripts/index/build-index.ts +351 -0
- package/mutagent-orchestrator/scripts/index/render-index.ts +110 -0
- package/mutagent-orchestrator/scripts/monitor/slack-notify.ts +111 -0
- package/mutagent-orchestrator/scripts/monitor/triggers.ts +162 -0
- package/mutagent-orchestrator/scripts/onboarding-check.ts +369 -0
- package/mutagent-orchestrator/scripts/render-roster.ts +308 -0
- package/mutagent-orchestrator/scripts/resolve-credential.ts +185 -0
- package/mutagent-orchestrator/scripts/resolve-paths.ts +114 -0
- package/mutagent-orchestrator/scripts/slack/format.ts +63 -0
- package/mutagent-orchestrator/scripts/slack/post.ts +115 -0
- package/mutagent-orchestrator/scripts/sync-index.ts +311 -0
- package/package.json +64 -0
|
@@ -0,0 +1,577 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/contracts/eval-matrix.ts — the v2 EVAL-MATRIX × TRAJECTORY judging contract.
|
|
3
|
+
* ---------------------------------------------------------------------------
|
|
4
|
+
* The executable (TypeBox) companion to `schemas/eval-matrix.schema.yaml`. This
|
|
5
|
+
* file defines the DATA shapes for the **headline judging cell** — the Judge
|
|
6
|
+
* Agent (`assets/agents/eval-matrix-judge.md`): a host-runtime subagent that
|
|
7
|
+
* takes a subject's EVAL MATRIX (the criteria set) + ONE agent TRAJECTORY +
|
|
8
|
+
* TRANSCRIPT and emits a per-criterion verdict for that trajectory. Fan-out is
|
|
9
|
+
* per-TRAJECTORY (one judge scores the WHOLE matrix for one session) — high
|
|
10
|
+
* throughput for evaluating many sessions.
|
|
11
|
+
*
|
|
12
|
+
* Strict austerity (operator directive): this file is **Type A — data contract
|
|
13
|
+
* only**. It holds NO judge prompt and NO LLM-reasoning logic — the judging
|
|
14
|
+
* RUBRIC lives in the Judge Agent def. Here we only declare + validate the
|
|
15
|
+
* packet the parent PREPs (DATA) and the verdict file the subagent writes, and
|
|
16
|
+
* map verdicts into the deterministic GATE rollup (`evaluate.ts`).
|
|
17
|
+
*
|
|
18
|
+
* Bridges the v1 `subjects/<name>/eval-matrix.yaml` concept: a MatrixCriterion
|
|
19
|
+
* is one eval-matrix row reduced to the fields a per-trajectory judge needs.
|
|
20
|
+
*/
|
|
21
|
+
import { type Static, Type } from "@sinclair/typebox";
|
|
22
|
+
import { Value } from "@sinclair/typebox/value";
|
|
23
|
+
import { AssumptionKind, AssumptionStatus, CheckMethod, CodeEvalSpecSchema, OutcomeVerdict, type MinedCriterion } from "./eval-types.ts";
|
|
24
|
+
import { Severity } from "./types.ts";
|
|
25
|
+
|
|
26
|
+
// ── T1 (B-U3) tier-0 code-eval spec — the deterministic pre-pass primitive ───
|
|
27
|
+
// The executable companion of `scripts/code-eval.ts` `CodeEvalSpec`. A matrix row
|
|
28
|
+
// typed `checkMethod: deterministic | hybrid` carries one of these so the tier-0
|
|
29
|
+
// pre-pass can run it via the generic code-eval primitives (NO judge, zero tokens,
|
|
30
|
+
// byte-identical). REUSES the canonical `CodeEvalSpecSchema` (the uniform-standard
|
|
31
|
+
// single source of truth in eval-types) so the matrix row and the MinedCriterion
|
|
32
|
+
// accept BYTE-IDENTICAL specs — extending the registry (e.g. the new
|
|
33
|
+
// recovery-after-failure / tool-output-failure primitives) lands on BOTH at once,
|
|
34
|
+
// with no drift.
|
|
35
|
+
export const MatrixCodeEvalSchema = CodeEvalSpecSchema;
|
|
36
|
+
export type MatrixCodeEval = Static<typeof MatrixCodeEvalSchema>;
|
|
37
|
+
|
|
38
|
+
// ── GA shared sub-schemas (structured refs · typed assumptions · blockedBy) ──
|
|
39
|
+
/** GA-1 structured grounding ref (closed). */
|
|
40
|
+
export const GaRefSchema = Type.Object(
|
|
41
|
+
{ obs: Type.String({ minLength: 1 }), path: Type.String(), value: Type.String({ minLength: 1 }) },
|
|
42
|
+
{ additionalProperties: false },
|
|
43
|
+
);
|
|
44
|
+
/** GA-3 typed assumption (closed; kind optional for grandfather). */
|
|
45
|
+
export const GaAssumptionSchema = Type.Object(
|
|
46
|
+
{
|
|
47
|
+
text: Type.String({ minLength: 1 }),
|
|
48
|
+
status: Type.Union([
|
|
49
|
+
Type.Literal(AssumptionStatus.Verified),
|
|
50
|
+
Type.Literal(AssumptionStatus.Unverified),
|
|
51
|
+
Type.Literal(AssumptionStatus.Hypothesis),
|
|
52
|
+
Type.Literal(AssumptionStatus.Eliminated),
|
|
53
|
+
]),
|
|
54
|
+
kind: Type.Optional(
|
|
55
|
+
Type.Union([
|
|
56
|
+
Type.Literal(AssumptionKind.FactualIntent),
|
|
57
|
+
Type.Literal(AssumptionKind.Normative),
|
|
58
|
+
Type.Literal(AssumptionKind.Scope),
|
|
59
|
+
]),
|
|
60
|
+
),
|
|
61
|
+
},
|
|
62
|
+
{ additionalProperties: false },
|
|
63
|
+
);
|
|
64
|
+
/** GA-4 the assumption-blocked payload on an indeterminate verdict (closed). */
|
|
65
|
+
export const GaBlockedBySchema = Type.Object(
|
|
66
|
+
{
|
|
67
|
+
kind: Type.Union([
|
|
68
|
+
Type.Literal(AssumptionKind.FactualIntent),
|
|
69
|
+
Type.Literal(AssumptionKind.Normative),
|
|
70
|
+
Type.Literal(AssumptionKind.Scope),
|
|
71
|
+
]),
|
|
72
|
+
text: Type.String({ minLength: 1 }),
|
|
73
|
+
},
|
|
74
|
+
{ additionalProperties: false },
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
// ── MatrixCriterion — one eval-matrix row as judging DATA ────────────────────
|
|
78
|
+
export const MatrixCriterionSchema = Type.Object(
|
|
79
|
+
{
|
|
80
|
+
criterionId: Type.String({ minLength: 1 }),
|
|
81
|
+
/** the conformance assertion for this row (eval-matrix `statement`). */
|
|
82
|
+
statement: Type.String({ minLength: 1 }),
|
|
83
|
+
/** the concrete binary pass condition (eval-matrix `passCondition`). */
|
|
84
|
+
passCondition: Type.String({ minLength: 1 }),
|
|
85
|
+
/** gating severity (reuse v1 Severity enum). */
|
|
86
|
+
severity: Type.Union([
|
|
87
|
+
Type.Literal(Severity.Crit),
|
|
88
|
+
Type.Literal(Severity.High),
|
|
89
|
+
Type.Literal(Severity.Med),
|
|
90
|
+
Type.Literal(Severity.Low),
|
|
91
|
+
]),
|
|
92
|
+
/** the 3-dimension MECE coverage tag (optional context for the judge). */
|
|
93
|
+
dimension: Type.Optional(Type.String()),
|
|
94
|
+
/** what the judge should read for this row (write-judge-prompt "choose what to pass"). */
|
|
95
|
+
judgeInputs: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),
|
|
96
|
+
// ── T1 (B-U3) tier-0 router (ADDITIVE, OPTIONAL — grandfather) ──────────────
|
|
97
|
+
/**
|
|
98
|
+
* The §5b code-vs-judge router for the tier-0 pre-pass. ABSENT ⇒ `llm-judge`
|
|
99
|
+
* (the legacy behavior — every row is dispatched to a judge), so existing
|
|
100
|
+
* all-judge matrices are byte-stable. `deterministic` runs the row's `codeEval`
|
|
101
|
+
* in the tier-0 pre-pass (NO judge, zero tokens); `hybrid` runs the code
|
|
102
|
+
* pre-filter then judges the residual; `llm-judge` dispatches to the judge.
|
|
103
|
+
*/
|
|
104
|
+
checkMethod: Type.Optional(
|
|
105
|
+
Type.Union([
|
|
106
|
+
Type.Literal(CheckMethod.Deterministic),
|
|
107
|
+
Type.Literal(CheckMethod.LlmJudge),
|
|
108
|
+
Type.Literal(CheckMethod.Hybrid),
|
|
109
|
+
]),
|
|
110
|
+
),
|
|
111
|
+
/** the extracted code-eval spec — REQUIRED iff checkMethod ∈ {deterministic, hybrid}. */
|
|
112
|
+
codeEval: Type.Optional(MatrixCodeEvalSchema),
|
|
113
|
+
},
|
|
114
|
+
{ additionalProperties: false },
|
|
115
|
+
);
|
|
116
|
+
export type MatrixCriterion = Static<typeof MatrixCriterionSchema>;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Bridge a MINED criterion (the `*discover-evals` / living-suite shape) → a judging
|
|
120
|
+
* MATRIX row, carrying the UNIFORM-STANDARD fields end-to-end: the `check_method`
|
|
121
|
+
* router AND its executable `codeEval` flow onto the matrix row so the tier-0
|
|
122
|
+
* pre-pass runs the code-check deterministically (zero judge tokens) instead of
|
|
123
|
+
* dispatching a code/hybrid row to the LLM judge. This is the explicit wiring
|
|
124
|
+
* point between the mined suite and the `*evaluate` tier-0 path — without it a
|
|
125
|
+
* mined criterion's `codeEval` would be dropped at matrix-build time (tier-0
|
|
126
|
+
* inert). PURE — a pure structural projection; no clock/random/network.
|
|
127
|
+
*
|
|
128
|
+
* `passCondition` defaults to the criterion `statement` (the binary Pass=… ); the
|
|
129
|
+
* judge inputs prefer the §5b `metadata.judge_inputs`, falling back to the base
|
|
130
|
+
* `judgeInputs`. A criterion with NO `codeEval` simply omits it (a pure judge row).
|
|
131
|
+
*/
|
|
132
|
+
export function minedToMatrixCriterion(c: MinedCriterion): MatrixCriterion {
|
|
133
|
+
const judgeInputs =
|
|
134
|
+
c.metadata.judge_inputs.length > 0 ? c.metadata.judge_inputs : c.judgeInputs;
|
|
135
|
+
const row: MatrixCriterion = {
|
|
136
|
+
criterionId: c.id,
|
|
137
|
+
statement: c.statement,
|
|
138
|
+
passCondition: c.statement,
|
|
139
|
+
severity: c.metadata.severity,
|
|
140
|
+
dimension: c.metadata.dimension,
|
|
141
|
+
checkMethod: c.metadata.check_method,
|
|
142
|
+
...(judgeInputs.length > 0 ? { judgeInputs } : {}),
|
|
143
|
+
...(c.codeEval !== undefined ? { codeEval: c.codeEval } : {}),
|
|
144
|
+
};
|
|
145
|
+
return row;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// ── Trajectory + transcript (platform-agnostic, DATA only) ───────────────────
|
|
149
|
+
export const TrajectoryStepSchema = Type.Object(
|
|
150
|
+
{
|
|
151
|
+
/** tool / step name in call order. */
|
|
152
|
+
name: Type.String({ minLength: 1 }),
|
|
153
|
+
input: Type.Optional(Type.Unknown()),
|
|
154
|
+
output: Type.Optional(Type.Unknown()),
|
|
155
|
+
},
|
|
156
|
+
{ additionalProperties: false },
|
|
157
|
+
);
|
|
158
|
+
export type TrajectoryStep = Static<typeof TrajectoryStepSchema>;
|
|
159
|
+
|
|
160
|
+
export const TranscriptTurnSchema = Type.Object(
|
|
161
|
+
{
|
|
162
|
+
role: Type.String({ minLength: 1 }),
|
|
163
|
+
content: Type.String(),
|
|
164
|
+
},
|
|
165
|
+
{ additionalProperties: false },
|
|
166
|
+
);
|
|
167
|
+
export type TranscriptTurn = Static<typeof TranscriptTurnSchema>;
|
|
168
|
+
|
|
169
|
+
// ── §9.4.4 v2.2 — M1 Subject Profile (the judge-packet identity card) ─────────
|
|
170
|
+
//
|
|
171
|
+
// M1: the judge gets WHO the agent is BEFORE it judges — identity · purpose · tools
|
|
172
|
+
// · skill · scope. Either GIVEN (code/metadata access) or RECONSTRUCTED from the
|
|
173
|
+
// trace batch (no access). version-aware. The `harness` is MARKED UNKNOWN when it
|
|
174
|
+
// cannot be known from the inputs — NEVER confabulated. ADDITIVE/OPTIONAL: a packet
|
|
175
|
+
// without a profile still validates (the judge reconstructs at reason-time).
|
|
176
|
+
export const SubjectProfileProvenance = {
|
|
177
|
+
Given: "given",
|
|
178
|
+
Reconstructed: "reconstructed",
|
|
179
|
+
} as const;
|
|
180
|
+
export type SubjectProfileProvenanceValue =
|
|
181
|
+
(typeof SubjectProfileProvenance)[keyof typeof SubjectProfileProvenance];
|
|
182
|
+
|
|
183
|
+
/** The sentinel a profile field carries when the input cannot establish it (M1 —
|
|
184
|
+
* harness/skill marked UNKNOWN, never confabulated). */
|
|
185
|
+
export const PROFILE_UNKNOWN = "unknown" as const;
|
|
186
|
+
|
|
187
|
+
export const SubjectProfileSchema = Type.Object(
|
|
188
|
+
{
|
|
189
|
+
/** what the agent IS (name / role identity). */
|
|
190
|
+
identity: Type.String({ minLength: 1 }),
|
|
191
|
+
/** the KIND of subject (e.g. `autonomous-agent` · `skill` · `tool`), when known
|
|
192
|
+
* (GIVEN — code/metadata access). ABSENT ⇒ the renderer marks it `unknown`. */
|
|
193
|
+
entityType: Type.Optional(Type.String()),
|
|
194
|
+
/** what the agent is FOR (its purpose / goal). */
|
|
195
|
+
purpose: Type.String({ minLength: 1 }),
|
|
196
|
+
/** the tools the agent wields (GIVEN inventory or reconstructed from the trace batch). */
|
|
197
|
+
tools: Type.Array(Type.String({ minLength: 1 })),
|
|
198
|
+
/** the skill the agent runs under, when known (`unknown` ≠ confabulated). */
|
|
199
|
+
skill: Type.Optional(Type.String()),
|
|
200
|
+
/** the agent's responsibility boundary / scope. */
|
|
201
|
+
scope: Type.String({ minLength: 1 }),
|
|
202
|
+
/** the agent's system prompt, when GIVEN (code access) — rendered COLLAPSED in the
|
|
203
|
+
* hero card. ABSENT ⇒ the renderer marks it not-supplied (never confabulated). */
|
|
204
|
+
systemPrompt: Type.Optional(Type.String()),
|
|
205
|
+
/** the execution harness — MARKED `unknown` when unknowable, NEVER guessed. */
|
|
206
|
+
harness: Type.String({ minLength: 1 }),
|
|
207
|
+
/** GIVEN (code access) vs RECONSTRUCTED (from traces) — the judge must know which. */
|
|
208
|
+
provenance: Type.Union([
|
|
209
|
+
Type.Literal(SubjectProfileProvenance.Given),
|
|
210
|
+
Type.Literal(SubjectProfileProvenance.Reconstructed),
|
|
211
|
+
]),
|
|
212
|
+
/** version-aware: the subject version this profile describes (when known). */
|
|
213
|
+
version: Type.Optional(Type.String()),
|
|
214
|
+
/** the fields that are INFERRED (not given) — honesty about what is reconstructed. */
|
|
215
|
+
inferredFields: Type.Optional(Type.Array(Type.String())),
|
|
216
|
+
},
|
|
217
|
+
{ additionalProperties: false },
|
|
218
|
+
);
|
|
219
|
+
export type SubjectProfile = Static<typeof SubjectProfileSchema>;
|
|
220
|
+
|
|
221
|
+
// ── MatrixPacket — the Judge Agent INPUT (one per trajectory) ────────────────
|
|
222
|
+
export const MatrixPacketSchema = Type.Object(
|
|
223
|
+
{
|
|
224
|
+
subject: Type.String({ minLength: 1 }),
|
|
225
|
+
/** the agent session under evaluation. */
|
|
226
|
+
trajectoryId: Type.String({ minLength: 1 }),
|
|
227
|
+
/** the WHOLE matrix this trajectory is scored against. */
|
|
228
|
+
criteria: Type.Array(MatrixCriterionSchema, { minItems: 1 }),
|
|
229
|
+
/** ordered tool-call steps (DATA from the trace). */
|
|
230
|
+
trajectory: Type.Array(TrajectoryStepSchema),
|
|
231
|
+
/** the session messages (DATA from the trace). */
|
|
232
|
+
transcript: Type.Array(TranscriptTurnSchema),
|
|
233
|
+
/**
|
|
234
|
+
* §9.4.4 M1 — the SUBJECT PROFILE (identity·purpose·tools·skill·scope) the judge
|
|
235
|
+
* reads BEFORE it judges. GIVEN or RECONSTRUCTED, version-aware, harness marked
|
|
236
|
+
* `unknown` when unknowable. ADDITIVE/OPTIONAL: a packet without it still validates
|
|
237
|
+
* (the judge reconstructs the profile at reason-time) → byte-stable for legacy.
|
|
238
|
+
*/
|
|
239
|
+
subjectProfile: Type.Optional(SubjectProfileSchema),
|
|
240
|
+
/** the pinned envelope the host runtime must honor (C-PIN). */
|
|
241
|
+
pin: Type.Object(
|
|
242
|
+
{ model: Type.String({ minLength: 1 }), temperature: Type.Literal(0) },
|
|
243
|
+
{ additionalProperties: false },
|
|
244
|
+
),
|
|
245
|
+
},
|
|
246
|
+
{ additionalProperties: false },
|
|
247
|
+
);
|
|
248
|
+
export type MatrixPacket = Static<typeof MatrixPacketSchema>;
|
|
249
|
+
|
|
250
|
+
// ── MatrixVerdict — one criterion verdict for one trajectory ─────────────────
|
|
251
|
+
export const MatrixVerdictSchema = Type.Object(
|
|
252
|
+
{
|
|
253
|
+
criterionId: Type.String({ minLength: 1 }),
|
|
254
|
+
/** critique BEFORE verdict — a bare verdict is rejected (see parseMatrixVerdictFile). */
|
|
255
|
+
critique: Type.String({ minLength: 1 }),
|
|
256
|
+
result: Type.Union([
|
|
257
|
+
Type.Literal(OutcomeVerdict.Pass),
|
|
258
|
+
Type.Literal(OutcomeVerdict.Fail),
|
|
259
|
+
Type.Literal(OutcomeVerdict.Uncertain),
|
|
260
|
+
]),
|
|
261
|
+
confidence: Type.Number({ minimum: 0, maximum: 1 }),
|
|
262
|
+
/**
|
|
263
|
+
* Judge DAG v2 node 6 (CONFIDENCE band) — a side-signal BESIDE the binary
|
|
264
|
+
* verdict, NOT a Likert verdict. OPTIONAL/additive: present when the judge
|
|
265
|
+
* emits the v2 walk; `confidence` (the scalar) is unchanged. Reported for
|
|
266
|
+
* calibration; it NEVER alters the binary `result` or the gate.
|
|
267
|
+
*/
|
|
268
|
+
confidenceBand: Type.Optional(
|
|
269
|
+
Type.Union([Type.Literal("high"), Type.Literal("med"), Type.Literal("low")]),
|
|
270
|
+
),
|
|
271
|
+
// ── GA additive (OPTIONAL — grandfather; NO silent drop downstream) ──────
|
|
272
|
+
/** GA-1 the field-level resolvable evidence the claim cites. */
|
|
273
|
+
refs: Type.Optional(Type.Array(GaRefSchema)),
|
|
274
|
+
/** GA-3 the typed assumptions the judge surfaced. */
|
|
275
|
+
assumptions: Type.Optional(Type.Array(GaAssumptionSchema)),
|
|
276
|
+
/** GA-4 set iff `result === uncertain` AND the abstain is assumption-driven. */
|
|
277
|
+
blockedBy: Type.Optional(GaBlockedBySchema),
|
|
278
|
+
},
|
|
279
|
+
{ additionalProperties: false },
|
|
280
|
+
);
|
|
281
|
+
export type MatrixVerdict = Static<typeof MatrixVerdictSchema>;
|
|
282
|
+
|
|
283
|
+
// ── §9.4.2 Judge DAG v2 shapes (ADDITIVE, OPTIONAL — the B-U2 emit contract) ──
|
|
284
|
+
// The 2026-06-23 §9.4.2 judge-contract: judges EMIT an ordered, agent-step-anchored
|
|
285
|
+
// reasoning WALK (`judgeSteps[]`, kind ∈ the DAG node names) + the target-agent
|
|
286
|
+
// step lane (`agentSteps[]`) so the report draws the Target-Agent‖Judge side-by-side,
|
|
287
|
+
// PLUS a dense na-explicit per-criterion map, a fidelity gate (early-INCOMPLETE on a
|
|
288
|
+
// truncated trace), a confidence band beside each binary verdict, and CANDIDATE
|
|
289
|
+
// items for unmatched detections (node 2.5 → *build-dataset). All OPTIONAL
|
|
290
|
+
// (grandfather): a judge that does NOT emit them still validates, and the renderer
|
|
291
|
+
// degrades to the per-trajectory scorecard. NO silent drop downstream.
|
|
292
|
+
//
|
|
293
|
+
// §9.4-judge-emit CLOSED (T2): the JUDGE AGENT now MANDATES these in
|
|
294
|
+
// `evaluator.md #mode-judge-trajectory` (+ the criterion-axis output contract in
|
|
295
|
+
// `judge-prompt-template.ts`); the schema (here) + the renderer CONSUMPTION
|
|
296
|
+
// (render-eval-report.ts) carry them as additive optional contract fields.
|
|
297
|
+
|
|
298
|
+
/** The Judge DAG v2 node names — `judgeSteps[].kind` SHOULD be one of these.
|
|
299
|
+
* v2.2 (§9.4.4) ADDS two pre-examine train-of-thought nodes: `gather` (node 0 —
|
|
300
|
+
* M2 gather-context = understand the agent/does/scope/skill + intent, rephrase to
|
|
301
|
+
* prove understanding) and `expect` (node 0.5 — M3 build-expected-trajectory: how
|
|
302
|
+
* the target SHOULD have acted, decided BEFORE examine). Both ADDITIVE — a v2.1
|
|
303
|
+
* judge that omits them still validates (`kind` is a free string). */
|
|
304
|
+
export const JudgeStepKind = {
|
|
305
|
+
Gather: "gather",
|
|
306
|
+
Expect: "expect",
|
|
307
|
+
Context: "context",
|
|
308
|
+
Examine: "examine",
|
|
309
|
+
Detect: "detect",
|
|
310
|
+
Bind: "bind",
|
|
311
|
+
Ground: "ground",
|
|
312
|
+
Critique: "critique",
|
|
313
|
+
Decide: "decide",
|
|
314
|
+
Verify: "verify",
|
|
315
|
+
Localize: "localize",
|
|
316
|
+
} as const;
|
|
317
|
+
export type JudgeStepKindValue = (typeof JudgeStepKind)[keyof typeof JudgeStepKind];
|
|
318
|
+
|
|
319
|
+
// ── §9.4.4 v2.2 — M2 understanding (node-0 train-of-thought) ──────────────────
|
|
320
|
+
/** The judge's node-0 GATHER-CONTEXT train-of-thought: a rephrase that proves it
|
|
321
|
+
* understood the agent/does/scope/intent, plus an explicit given-vs-inferred split
|
|
322
|
+
* (M2 + M4). ADDITIVE/OPTIONAL. */
|
|
323
|
+
export const UnderstandingSchema = Type.Object(
|
|
324
|
+
{
|
|
325
|
+
/** rephrase the agent's job in the judge's own words — proves understanding (M2). */
|
|
326
|
+
rephrase: Type.String({ minLength: 1 }),
|
|
327
|
+
/** what was GIVEN (read from the packet / profile / code). */
|
|
328
|
+
given: Type.Optional(Type.Array(Type.String())),
|
|
329
|
+
/** what was INFERRED (reconstructed from the trace, not handed to the judge). */
|
|
330
|
+
inferred: Type.Optional(Type.Array(Type.String())),
|
|
331
|
+
},
|
|
332
|
+
{ additionalProperties: false },
|
|
333
|
+
);
|
|
334
|
+
export type Understanding = Static<typeof UnderstandingSchema>;
|
|
335
|
+
|
|
336
|
+
// ── §9.4.4 v2.2 — M3 expected-trajectory (node-0.5) ───────────────────────────
|
|
337
|
+
/** One node-0.5 EXPECTED step: how the target SHOULD have acted at this point,
|
|
338
|
+
* decided BEFORE examine. `examine` then compares actual-vs-expected (M3). */
|
|
339
|
+
export const ExpectedStepSchema = Type.Object(
|
|
340
|
+
{
|
|
341
|
+
/** the ordered position in the expected decision-tree. */
|
|
342
|
+
step: Type.Optional(Type.Number()),
|
|
343
|
+
/** what the target SHOULD do here (the expected action / decision). */
|
|
344
|
+
expected: Type.String({ minLength: 1 }),
|
|
345
|
+
/** why this is the right move (the decision-tree rationale). */
|
|
346
|
+
rationale: Type.Optional(Type.String()),
|
|
347
|
+
},
|
|
348
|
+
{ additionalProperties: false },
|
|
349
|
+
);
|
|
350
|
+
export type ExpectedStep = Static<typeof ExpectedStepSchema>;
|
|
351
|
+
|
|
352
|
+
/** One target-agent step (the left lane of the §2 side-by-side). */
|
|
353
|
+
export const AgentStepSchema = Type.Object(
|
|
354
|
+
{
|
|
355
|
+
n: Type.Number(),
|
|
356
|
+
tool: Type.Optional(Type.String()),
|
|
357
|
+
/** ok | error | warn | false-success */
|
|
358
|
+
status: Type.Optional(Type.String()),
|
|
359
|
+
detail: Type.Optional(Type.String()),
|
|
360
|
+
},
|
|
361
|
+
{ additionalProperties: false },
|
|
362
|
+
);
|
|
363
|
+
|
|
364
|
+
/** One ordered judge micro-step, anchored to an agent step (§9.4.2 `judge_steps[]`).
|
|
365
|
+
* `kind` is a free string for grandfather-compat but SHOULD be a `JudgeStepKind`. */
|
|
366
|
+
export const JudgeStepSchema = Type.Object(
|
|
367
|
+
{
|
|
368
|
+
/** context | examine | detect | bind | ground | critique | decide | verify | localize */
|
|
369
|
+
kind: Type.String({ minLength: 1 }),
|
|
370
|
+
text: Type.Optional(Type.String()),
|
|
371
|
+
/**
|
|
372
|
+
* a grounding citation for this micro-step. TOLERANT (string | structured ref):
|
|
373
|
+
* real judges emit EITHER a verbatim "obs:detail" string OR the same structured
|
|
374
|
+
* `{obs, path, value}` ref shape they use on verdicts — accept both (the renderer
|
|
375
|
+
* coerces a structured ref to a readable string) so a strict-string schema does
|
|
376
|
+
* not reject an otherwise-valid real verdict file.
|
|
377
|
+
*/
|
|
378
|
+
ref: Type.Optional(Type.Union([Type.String(), GaRefSchema])),
|
|
379
|
+
/**
|
|
380
|
+
* the agent-step index this judge step anchors to (0 / context = gather band).
|
|
381
|
+
* TOLERANT (number | string): real judges naturally emit string anchors —
|
|
382
|
+
* a stringified index ("4"), a step label ("step-3"), or a RANGE ("1-6"). The
|
|
383
|
+
* renderer coerces a numeric-string anchor to match its agent step and ignores
|
|
384
|
+
* non-numeric ones (graceful degrade) — so a strict-number schema must not
|
|
385
|
+
* reject an otherwise-valid real verdict file.
|
|
386
|
+
*/
|
|
387
|
+
anchor: Type.Optional(Type.Union([Type.Number(), Type.String()])),
|
|
388
|
+
},
|
|
389
|
+
{ additionalProperties: false },
|
|
390
|
+
);
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* §9.4.2 node 2.5 — a CANDIDATE eval/dataset item the judge emits for an UNMATCHED
|
|
394
|
+
* detection (a real behaviour with no matching criterion). Consumed by the discover
|
|
395
|
+
* → dataset-candidates handoff (T6) → `*build-dataset`. OPTIONAL/additive.
|
|
396
|
+
*/
|
|
397
|
+
export const CandidateItemSchema = Type.Object(
|
|
398
|
+
{
|
|
399
|
+
/** `eval` = a candidate criterion to mine · `dataset` = a candidate test case. */
|
|
400
|
+
kind: Type.Union([Type.Literal("eval"), Type.Literal("dataset")]),
|
|
401
|
+
/** the detected behaviour (the would-be criterion statement / case description). */
|
|
402
|
+
detection: Type.String({ minLength: 1 }),
|
|
403
|
+
/** the agent-step the detection anchors to (number | string — see JudgeStep.anchor). */
|
|
404
|
+
anchor: Type.Optional(Type.Union([Type.Number(), Type.String()])),
|
|
405
|
+
/** a grounding citation for the detection — a string OR a structured {obs,path,value} ref. */
|
|
406
|
+
ref: Type.Optional(Type.Union([Type.String(), GaRefSchema])),
|
|
407
|
+
},
|
|
408
|
+
{ additionalProperties: false },
|
|
409
|
+
);
|
|
410
|
+
export type CandidateItem = Static<typeof CandidateItemSchema>;
|
|
411
|
+
|
|
412
|
+
// ── MatrixVerdictFile — the Judge Agent OUTPUT (one per trajectory) ──────────
|
|
413
|
+
export const MatrixVerdictFileSchema = Type.Object(
|
|
414
|
+
{
|
|
415
|
+
trajectoryId: Type.String({ minLength: 1 }),
|
|
416
|
+
/** C-PIN provenance — the pinned host model + temperature the judge ran under. */
|
|
417
|
+
judgeModel: Type.String({ minLength: 1 }),
|
|
418
|
+
temperature: Type.Literal(0),
|
|
419
|
+
verdicts: Type.Array(MatrixVerdictSchema),
|
|
420
|
+
// ── §9.4 judge-walk (OPTIONAL — present iff the judge emitted it) ──
|
|
421
|
+
/** the route cohort this trajectory falls in (drives the §3 heatmap columns). */
|
|
422
|
+
route: Type.Optional(Type.String()),
|
|
423
|
+
/** §9.4.5 E3 — the trace's wall-clock timestamp (ISO), when the source carried it.
|
|
424
|
+
* Powers the Overview eval-HEALTH temporal heatmap (correctness over time). When the
|
|
425
|
+
* source provides no timestamp the field is simply absent → that trajectory falls into
|
|
426
|
+
* the heatmap's data-pending bucket (the structure renders, never faked). OPTIONAL/additive. */
|
|
427
|
+
timestamp: Type.Optional(Type.String()),
|
|
428
|
+
/**
|
|
429
|
+
* §9.4.4 M1 — the subject profile the judge reasoned UNDER (echoed from the packet,
|
|
430
|
+
* or RECONSTRUCTED at reason-time when the packet carried none). Powers the INTERNAL
|
|
431
|
+
* calibration tab's "who is the agent" lens. OPTIONAL/additive.
|
|
432
|
+
*/
|
|
433
|
+
subjectProfile: Type.Optional(SubjectProfileSchema),
|
|
434
|
+
/**
|
|
435
|
+
* §9.4.4 M2 — the node-0 GATHER-CONTEXT train-of-thought: a rephrase proving the
|
|
436
|
+
* judge understood the agent + an explicit given-vs-inferred split. OPTIONAL/additive.
|
|
437
|
+
*/
|
|
438
|
+
understanding: Type.Optional(UnderstandingSchema),
|
|
439
|
+
/**
|
|
440
|
+
* §9.4.4 M3 — the node-0.5 EXPECTED-TRAJECTORY: how the target SHOULD have acted,
|
|
441
|
+
* built BEFORE examine. `examine` then compares actual-vs-expected. OPTIONAL/additive.
|
|
442
|
+
*/
|
|
443
|
+
expectedTrajectory: Type.Optional(Type.Array(ExpectedStepSchema)),
|
|
444
|
+
/** the judge's gather-context band (harness / scenario / exit states). TOLERANT
|
|
445
|
+
* (string | string[]): real judges naturally emit exit-states / scenarios as a
|
|
446
|
+
* LIST — accept both so a strict-string schema does not reject an otherwise-valid
|
|
447
|
+
* verdict file (the renderer coerces an array to a readable string). */
|
|
448
|
+
context: Type.Optional(
|
|
449
|
+
Type.Object(
|
|
450
|
+
{
|
|
451
|
+
harness: Type.Optional(Type.Union([Type.String(), Type.Array(Type.String())])),
|
|
452
|
+
scenario: Type.Optional(Type.Union([Type.String(), Type.Array(Type.String())])),
|
|
453
|
+
exitStates: Type.Optional(Type.Union([Type.String(), Type.Array(Type.String())])),
|
|
454
|
+
},
|
|
455
|
+
{ additionalProperties: false },
|
|
456
|
+
),
|
|
457
|
+
),
|
|
458
|
+
/** the target-agent step lane. */
|
|
459
|
+
agentSteps: Type.Optional(Type.Array(AgentStepSchema)),
|
|
460
|
+
/** the ordered, agent-step-anchored judge reasoning walk. */
|
|
461
|
+
judgeSteps: Type.Optional(Type.Array(JudgeStepSchema)),
|
|
462
|
+
/** the root-not-symptom localization (the §2 localize band). TOLERANT (string |
|
|
463
|
+
* structured band): real judges naturally emit a `{root, symptom?, ref?, routeTo?}`
|
|
464
|
+
* object rather than a bare string — accept both so a strict-string schema does not
|
|
465
|
+
* reject an otherwise-valid verdict file (consumers coerce to a readable string via
|
|
466
|
+
* `localizeText`). The `root` is what consolidate-by-locus clusters on. */
|
|
467
|
+
localize: Type.Optional(
|
|
468
|
+
Type.Union([
|
|
469
|
+
Type.String(),
|
|
470
|
+
Type.Object(
|
|
471
|
+
{
|
|
472
|
+
root: Type.String({ minLength: 1 }),
|
|
473
|
+
symptom: Type.Optional(Type.String()),
|
|
474
|
+
ref: Type.Optional(Type.Union([Type.String(), GaRefSchema])),
|
|
475
|
+
routeTo: Type.Optional(Type.String()),
|
|
476
|
+
},
|
|
477
|
+
{ additionalProperties: false },
|
|
478
|
+
),
|
|
479
|
+
]),
|
|
480
|
+
),
|
|
481
|
+
/**
|
|
482
|
+
* §9.4.2 node 9 — the DENSE, na-explicit per-criterion map (`cid → pass | fail |
|
|
483
|
+
* uncertain | na`). Every matrix criterion appears (na = not-applicable to this
|
|
484
|
+
* trajectory, ≠ fail). When present the renderer uses it verbatim; when absent
|
|
485
|
+
* the renderer synthesizes it from `verdicts[]` (na for any unjudged row).
|
|
486
|
+
*/
|
|
487
|
+
denseMap: Type.Optional(
|
|
488
|
+
Type.Record(
|
|
489
|
+
Type.String(),
|
|
490
|
+
Type.Union([
|
|
491
|
+
Type.Literal(OutcomeVerdict.Pass),
|
|
492
|
+
Type.Literal(OutcomeVerdict.Fail),
|
|
493
|
+
Type.Literal(OutcomeVerdict.Uncertain),
|
|
494
|
+
Type.Literal("na"),
|
|
495
|
+
]),
|
|
496
|
+
),
|
|
497
|
+
),
|
|
498
|
+
/**
|
|
499
|
+
* §9.4.2 node 1 — the EXAMINE fidelity gate. `complete:false` means the trace
|
|
500
|
+
* was truncated / unreadable → the trajectory EXITS early as INCOMPLETE (no
|
|
501
|
+
* fabricated pass/fail from a partial trace). OPTIONAL/additive.
|
|
502
|
+
*/
|
|
503
|
+
fidelity: Type.Optional(
|
|
504
|
+
Type.Object(
|
|
505
|
+
{ complete: Type.Boolean(), reason: Type.Optional(Type.String()) },
|
|
506
|
+
{ additionalProperties: false },
|
|
507
|
+
),
|
|
508
|
+
),
|
|
509
|
+
/** §9.4.2 node 2.5 — candidate eval/dataset items for UNMATCHED detections. */
|
|
510
|
+
candidates: Type.Optional(Type.Array(CandidateItemSchema)),
|
|
511
|
+
/**
|
|
512
|
+
* the per-trajectory judge SELF-REPORTED health micro-summary. NOTE: this is
|
|
513
|
+
* IGNORED for the report's health roll-up — T4 DERIVES health from the walk
|
|
514
|
+
* (`deriveWalkHealth`), never trusting the self-graded field. TOLERANT shapes:
|
|
515
|
+
* real judges emit `grounded`/`assumed` as EITHER a count (number) OR a boolean
|
|
516
|
+
* — accept both so a strict schema does not reject an otherwise-valid verdict.
|
|
517
|
+
*/
|
|
518
|
+
health: Type.Optional(
|
|
519
|
+
Type.Object(
|
|
520
|
+
{
|
|
521
|
+
contextGathered: Type.Optional(Type.Boolean()),
|
|
522
|
+
grounded: Type.Optional(Type.Union([Type.Number(), Type.Boolean()])),
|
|
523
|
+
assumed: Type.Optional(Type.Union([Type.Number(), Type.Boolean()])),
|
|
524
|
+
stoppedAtSymptom: Type.Optional(Type.Boolean()),
|
|
525
|
+
},
|
|
526
|
+
{ additionalProperties: false },
|
|
527
|
+
),
|
|
528
|
+
),
|
|
529
|
+
},
|
|
530
|
+
{ additionalProperties: false },
|
|
531
|
+
);
|
|
532
|
+
export type MatrixVerdictFile = Static<typeof MatrixVerdictFileSchema>;
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Coerce a tolerant `localize` band (string | `{root, symptom?, …}`) to a single
|
|
536
|
+
* readable root string. The structured form's `root` is authoritative (it is what
|
|
537
|
+
* consolidate-by-locus clusters on); a bare string passes through. PURE.
|
|
538
|
+
*/
|
|
539
|
+
export function localizeText(localize: MatrixVerdictFile["localize"]): string {
|
|
540
|
+
if (localize === undefined) return "";
|
|
541
|
+
if (typeof localize === "string") return localize;
|
|
542
|
+
return localize.symptom !== undefined ? `${localize.root} (symptom: ${localize.symptom})` : localize.root;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Validate + parse a Judge Agent verdict file (raw JSON text). ENFORCES the
|
|
547
|
+
* schema (critique non-empty → critique-before-verdict, result in the closed
|
|
548
|
+
* set, temperature pinned 0). THROWS on any violation — a malformed verdict is
|
|
549
|
+
* never silently accepted. PURE (no clock/random/network).
|
|
550
|
+
*/
|
|
551
|
+
export function parseMatrixVerdictFile(raw: string): MatrixVerdictFile {
|
|
552
|
+
let parsed: unknown;
|
|
553
|
+
try {
|
|
554
|
+
parsed = JSON.parse(raw);
|
|
555
|
+
} catch {
|
|
556
|
+
throw new Error(`parseMatrixVerdictFile: not valid JSON: ${raw.slice(0, 120)}`);
|
|
557
|
+
}
|
|
558
|
+
if (!Value.Check(MatrixVerdictFileSchema, parsed)) {
|
|
559
|
+
const first = [...Value.Errors(MatrixVerdictFileSchema, parsed)][0];
|
|
560
|
+
throw new Error(
|
|
561
|
+
`parseMatrixVerdictFile: schema violation at '${first?.path ?? "?"}': ` +
|
|
562
|
+
`${first?.message ?? "invalid MatrixVerdictFile"}`,
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
return parsed;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/** Assert a MatrixPacket conforms (used by PREP before emit). THROWS on violation. */
|
|
569
|
+
export function assertMatrixPacket(packet: unknown): asserts packet is MatrixPacket {
|
|
570
|
+
if (!Value.Check(MatrixPacketSchema, packet)) {
|
|
571
|
+
const first = [...Value.Errors(MatrixPacketSchema, packet)][0];
|
|
572
|
+
throw new Error(
|
|
573
|
+
`assertMatrixPacket: schema violation at '${first?.path ?? "?"}': ` +
|
|
574
|
+
`${first?.message ?? "invalid MatrixPacket"}`,
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
}
|