@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,330 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/route-failures.ts — EV-051 route-failures (judge-only handoff).
|
|
3
|
+
* ---------------------------------------------------------------------------
|
|
4
|
+
* "A judge is only a judge." The evaluator FLAGS failures and ROUTES them to
|
|
5
|
+
* diagnostics — it NEVER fixes. This emits a HandoverBundle for the diagnose
|
|
6
|
+
* stage: the failing criteria become the acceptance criteria the downstream
|
|
7
|
+
* diagnose stage must root-cause, and the failing traces/scorecard become the
|
|
8
|
+
* enumerated `inputs` that cross the boundary.
|
|
9
|
+
*
|
|
10
|
+
* Sealed-sibling: the HandoverBundle shape is RE-IMPLEMENTED here (mirroring
|
|
11
|
+
* the orchestrator's handover-contract.ts SHAPE), NEVER imported across the
|
|
12
|
+
* package boundary. This is a one-way EMIT (the evaluator produces it; some
|
|
13
|
+
* diagnose stage consumes it), not a shared frozen contract co-owned by both
|
|
14
|
+
* packages — so it stays in-package rather than escalating to templates/.
|
|
15
|
+
*
|
|
16
|
+
* PURE + deterministic: provenance (produced_by/at) is INJECTED, never a
|
|
17
|
+
* self-read clock, so the same input yields a byte-identical bundle. The
|
|
18
|
+
* bundle is a CLOSED object (additionalProperties:false at every level) so a
|
|
19
|
+
* smuggled undeclared field is caught by validateHandoverBundle.
|
|
20
|
+
*/
|
|
21
|
+
import { type Static, Type } from "@sinclair/typebox";
|
|
22
|
+
import { TypeCompiler } from "@sinclair/typebox/compiler";
|
|
23
|
+
import {
|
|
24
|
+
OutcomeVerdict,
|
|
25
|
+
type CriterionFlagValue,
|
|
26
|
+
type OutcomeVerdictValue,
|
|
27
|
+
type VerdictBlock,
|
|
28
|
+
} from "./contracts/eval-types.ts";
|
|
29
|
+
import { maskedCanonicalJson } from "./mask.ts";
|
|
30
|
+
|
|
31
|
+
/** FROZEN contract version (in-package mirror; bump only via reviewed migration). */
|
|
32
|
+
export const HANDOVER_BUNDLE_VERSION = "0.1.0" as const;
|
|
33
|
+
|
|
34
|
+
export const AdlStage = {
|
|
35
|
+
Build: "build",
|
|
36
|
+
Evaluate: "evaluate",
|
|
37
|
+
Diagnose: "diagnose",
|
|
38
|
+
Improve: "improve",
|
|
39
|
+
Audit: "audit",
|
|
40
|
+
} as const;
|
|
41
|
+
export type AdlStageValue = (typeof AdlStage)[keyof typeof AdlStage];
|
|
42
|
+
|
|
43
|
+
// Mirrors the orchestrator handover-contract SubjectKind. The CANONICAL inter-stage
|
|
44
|
+
// subject vocabulary is `agent | skill | code` (matches config-schema TargetSubject).
|
|
45
|
+
// `code` (Wave-2 follow-up) is ADDITIVE — every existing skill/agent handoff still
|
|
46
|
+
// validates; it only lets a `code` subject route through *evaluate's failure handoff
|
|
47
|
+
// the SAME way it flows through the orchestrator handover-contract (the two are kept
|
|
48
|
+
// in lock-step by design; the evaluator re-implements the shape, never imports it).
|
|
49
|
+
export const SubjectKind = { Skill: "skill", Agent: "agent", Code: "code" } as const;
|
|
50
|
+
export type SubjectKindValue = (typeof SubjectKind)[keyof typeof SubjectKind];
|
|
51
|
+
|
|
52
|
+
export const ArtifactKind = {
|
|
53
|
+
Trace: "trace",
|
|
54
|
+
Dataset: "dataset",
|
|
55
|
+
Verdict: "verdict",
|
|
56
|
+
Scorecard: "scorecard",
|
|
57
|
+
Findings: "findings",
|
|
58
|
+
Report: "report",
|
|
59
|
+
Source: "source",
|
|
60
|
+
Spec: "spec",
|
|
61
|
+
Config: "config",
|
|
62
|
+
} as const;
|
|
63
|
+
export type ArtifactKindValue = (typeof ArtifactKind)[keyof typeof ArtifactKind];
|
|
64
|
+
|
|
65
|
+
export const EscalationPolicy = {
|
|
66
|
+
Escalate: "escalate",
|
|
67
|
+
Abort: "abort",
|
|
68
|
+
Proceed: "proceed",
|
|
69
|
+
} as const;
|
|
70
|
+
export type EscalationPolicyValue =
|
|
71
|
+
(typeof EscalationPolicy)[keyof typeof EscalationPolicy];
|
|
72
|
+
|
|
73
|
+
// ── TypeBox schemas (closed objects — auditable boundary) ───────────────────
|
|
74
|
+
const SubjectSchema = Type.Object(
|
|
75
|
+
{
|
|
76
|
+
kind: Type.Union([
|
|
77
|
+
Type.Literal(SubjectKind.Skill),
|
|
78
|
+
Type.Literal(SubjectKind.Agent),
|
|
79
|
+
Type.Literal(SubjectKind.Code),
|
|
80
|
+
]),
|
|
81
|
+
name: Type.String({ minLength: 1 }),
|
|
82
|
+
path: Type.String({ minLength: 1 }),
|
|
83
|
+
},
|
|
84
|
+
{ additionalProperties: false },
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const IntentSchema = Type.Object(
|
|
88
|
+
{ command: Type.String({ minLength: 1 }), utterance: Type.Optional(Type.String()) },
|
|
89
|
+
{ additionalProperties: false },
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const ArtifactRefSchema = Type.Object(
|
|
93
|
+
{
|
|
94
|
+
id: Type.String({ minLength: 1 }),
|
|
95
|
+
kind: Type.Union([
|
|
96
|
+
Type.Literal(ArtifactKind.Trace),
|
|
97
|
+
Type.Literal(ArtifactKind.Dataset),
|
|
98
|
+
Type.Literal(ArtifactKind.Verdict),
|
|
99
|
+
Type.Literal(ArtifactKind.Scorecard),
|
|
100
|
+
Type.Literal(ArtifactKind.Findings),
|
|
101
|
+
Type.Literal(ArtifactKind.Report),
|
|
102
|
+
Type.Literal(ArtifactKind.Source),
|
|
103
|
+
Type.Literal(ArtifactKind.Spec),
|
|
104
|
+
Type.Literal(ArtifactKind.Config),
|
|
105
|
+
]),
|
|
106
|
+
path: Type.Optional(Type.String({ minLength: 1 })),
|
|
107
|
+
uri: Type.Optional(Type.String({ minLength: 1 })),
|
|
108
|
+
sha: Type.Optional(Type.String({ minLength: 1 })),
|
|
109
|
+
bytes: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
110
|
+
},
|
|
111
|
+
{ additionalProperties: false },
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
const PartialLoadSchema = Type.Object(
|
|
115
|
+
{ path: Type.String({ minLength: 1 }), reason: Type.String({ minLength: 1 }) },
|
|
116
|
+
{ additionalProperties: false },
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const ContextPackSchema = Type.Object(
|
|
120
|
+
{
|
|
121
|
+
rules: Type.Array(Type.String()),
|
|
122
|
+
memory: Type.Array(Type.String()),
|
|
123
|
+
partial_loads: Type.Array(PartialLoadSchema),
|
|
124
|
+
},
|
|
125
|
+
{ additionalProperties: false },
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
const AcceptanceSchema = Type.Object(
|
|
129
|
+
{ goal: Type.String({ minLength: 1 }), criteria: Type.Array(Type.String()) },
|
|
130
|
+
{ additionalProperties: false },
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const ProvenanceSchema = Type.Object(
|
|
134
|
+
{ produced_by: Type.String({ minLength: 1 }), produced_at: Type.String({ minLength: 1 }) },
|
|
135
|
+
{ additionalProperties: false },
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
const HandoverBundleSchema = Type.Object(
|
|
139
|
+
{
|
|
140
|
+
bundle_version: Type.Literal(HANDOVER_BUNDLE_VERSION),
|
|
141
|
+
adl_stage: Type.Union([
|
|
142
|
+
Type.Literal(AdlStage.Build),
|
|
143
|
+
Type.Literal(AdlStage.Evaluate),
|
|
144
|
+
Type.Literal(AdlStage.Diagnose),
|
|
145
|
+
Type.Literal(AdlStage.Improve),
|
|
146
|
+
Type.Literal(AdlStage.Audit),
|
|
147
|
+
]),
|
|
148
|
+
subject: SubjectSchema,
|
|
149
|
+
intent: IntentSchema,
|
|
150
|
+
inputs: Type.Array(ArtifactRefSchema),
|
|
151
|
+
context_pack: ContextPackSchema,
|
|
152
|
+
acceptance: AcceptanceSchema,
|
|
153
|
+
provenance: ProvenanceSchema,
|
|
154
|
+
escalation_policy: Type.Union([
|
|
155
|
+
Type.Literal(EscalationPolicy.Escalate),
|
|
156
|
+
Type.Literal(EscalationPolicy.Abort),
|
|
157
|
+
Type.Literal(EscalationPolicy.Proceed),
|
|
158
|
+
]),
|
|
159
|
+
},
|
|
160
|
+
{ additionalProperties: false },
|
|
161
|
+
);
|
|
162
|
+
export type HandoverBundle = Static<typeof HandoverBundleSchema>;
|
|
163
|
+
export type ArtifactRef = Static<typeof ArtifactRefSchema>;
|
|
164
|
+
|
|
165
|
+
const BundleChecker = TypeCompiler.Compile(HandoverBundleSchema);
|
|
166
|
+
|
|
167
|
+
// ── Input ───────────────────────────────────────────────────────────────────
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* One routed failure. NOTE: there is deliberately NO `fix`/`remediation`/
|
|
171
|
+
* `patch` field — the evaluator is judge-only. The downstream diagnose stage
|
|
172
|
+
* decides remedies; the evaluator only states WHAT failed and WHY (critique).
|
|
173
|
+
*/
|
|
174
|
+
export interface FailureRef {
|
|
175
|
+
criterionId: string;
|
|
176
|
+
severity: string;
|
|
177
|
+
flag: CriterionFlagValue;
|
|
178
|
+
traceId: string;
|
|
179
|
+
result: OutcomeVerdictValue;
|
|
180
|
+
critique: string;
|
|
181
|
+
/** GA — set iff `result === uncertain` (indeterminate); types the calibration route. */
|
|
182
|
+
blockedBy?: VerdictBlock;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* GA — partition routed rows by verdict: a true FAIL routes to diagnostics
|
|
187
|
+
* (root-cause it), an INDETERMINATE (`uncertain`) routes to the CALIBRATION loop
|
|
188
|
+
* (re-ground / operator-ratify / re-scope by `blockedBy.kind`) — NEVER to
|
|
189
|
+
* diagnostics, because there is no confirmed defect to root-cause yet. PURE.
|
|
190
|
+
*/
|
|
191
|
+
export interface RoutingPartition {
|
|
192
|
+
toDiagnostics: FailureRef[];
|
|
193
|
+
toCalibrate: FailureRef[];
|
|
194
|
+
}
|
|
195
|
+
export function partitionRouting(failures: FailureRef[]): RoutingPartition {
|
|
196
|
+
const toDiagnostics: FailureRef[] = [];
|
|
197
|
+
const toCalibrate: FailureRef[] = [];
|
|
198
|
+
for (const f of failures) {
|
|
199
|
+
if (f.result === OutcomeVerdict.Uncertain) toCalibrate.push(f);
|
|
200
|
+
else if (f.result === OutcomeVerdict.Fail) toDiagnostics.push(f);
|
|
201
|
+
// pass rows never appear in a failure list; ignore defensively.
|
|
202
|
+
}
|
|
203
|
+
return { toDiagnostics, toCalibrate };
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** GA — one calibration-loop item for an indeterminate verdict. The route is the
|
|
207
|
+
* `blockedBy.kind`: factual-intent→re-ground · normative→operator · scope→re-scope. */
|
|
208
|
+
export interface CalibrationItem {
|
|
209
|
+
criterionId: string;
|
|
210
|
+
severity: string;
|
|
211
|
+
traceId: string;
|
|
212
|
+
blockedBy: VerdictBlock;
|
|
213
|
+
route: "re-ground" | "operator" | "re-scope";
|
|
214
|
+
}
|
|
215
|
+
const KIND_ROUTE: Record<string, CalibrationItem["route"]> = {
|
|
216
|
+
"factual-intent": "re-ground",
|
|
217
|
+
normative: "operator",
|
|
218
|
+
scope: "re-scope",
|
|
219
|
+
};
|
|
220
|
+
export function calibrationItems(failures: FailureRef[]): CalibrationItem[] {
|
|
221
|
+
return partitionRouting(failures).toCalibrate.map((f) => {
|
|
222
|
+
const blockedBy: VerdictBlock = f.blockedBy ?? {
|
|
223
|
+
kind: "factual-intent",
|
|
224
|
+
text: f.critique,
|
|
225
|
+
};
|
|
226
|
+
return {
|
|
227
|
+
criterionId: f.criterionId,
|
|
228
|
+
severity: f.severity,
|
|
229
|
+
traceId: f.traceId,
|
|
230
|
+
blockedBy,
|
|
231
|
+
route: KIND_ROUTE[blockedBy.kind] ?? "re-ground",
|
|
232
|
+
};
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export interface RouteFailuresInput {
|
|
237
|
+
subject: { kind: SubjectKindValue; name: string; path: string };
|
|
238
|
+
failures: FailureRef[];
|
|
239
|
+
artifacts: ArtifactRef[];
|
|
240
|
+
/** INJECTED provenance — never a self-read clock (determinism). */
|
|
241
|
+
producedBy: string;
|
|
242
|
+
producedAt: string;
|
|
243
|
+
escalationPolicy?: EscalationPolicyValue;
|
|
244
|
+
/** optional curated context that crossed the boundary. */
|
|
245
|
+
contextRules?: string[];
|
|
246
|
+
contextMemory?: string[];
|
|
247
|
+
partialLoads?: { path: string; reason: string }[];
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Build the diagnose-stage HandoverBundle for the routed failures. Judge-only:
|
|
252
|
+
* no remedy is emitted — the failing criteria become the acceptance criteria
|
|
253
|
+
* the diagnose stage must root-cause. PURE + deterministic.
|
|
254
|
+
*/
|
|
255
|
+
export function routeFailures(input: RouteFailuresInput): HandoverBundle {
|
|
256
|
+
// GA — only true FAILs are root-causable defects. Indeterminates route to the
|
|
257
|
+
// calibration loop (see `calibrationItems`), never into a diagnose handoff.
|
|
258
|
+
const criteria = partitionRouting(input.failures).toDiagnostics.map(
|
|
259
|
+
(f) =>
|
|
260
|
+
`${f.criterionId} [${f.severity}/${f.flag}] FAILED on trace ${f.traceId}: ${f.critique}`,
|
|
261
|
+
);
|
|
262
|
+
return {
|
|
263
|
+
bundle_version: HANDOVER_BUNDLE_VERSION,
|
|
264
|
+
adl_stage: AdlStage.Diagnose,
|
|
265
|
+
subject: { kind: input.subject.kind, name: input.subject.name, path: input.subject.path },
|
|
266
|
+
intent: { command: "*diagnose" },
|
|
267
|
+
inputs: input.artifacts,
|
|
268
|
+
context_pack: {
|
|
269
|
+
rules: input.contextRules ?? [],
|
|
270
|
+
memory: input.contextMemory ?? [],
|
|
271
|
+
partial_loads: input.partialLoads ?? [],
|
|
272
|
+
},
|
|
273
|
+
acceptance: {
|
|
274
|
+
goal:
|
|
275
|
+
"Root-cause the routed eval failures. JUDGE-ONLY handoff: the evaluator " +
|
|
276
|
+
"flags + routes, it does not repair — the diagnose stage owns the " +
|
|
277
|
+
"downstream repair.",
|
|
278
|
+
criteria,
|
|
279
|
+
},
|
|
280
|
+
provenance: { produced_by: input.producedBy, produced_at: input.producedAt },
|
|
281
|
+
escalation_policy: input.escalationPolicy ?? EscalationPolicy.Escalate,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* MASK-ON-HANDOFF (carry). Serialize the handover bundle for EMIT through the
|
|
287
|
+
* byte-identity masker (`mask.ts`): `provenance.produced_at` (an injected
|
|
288
|
+
* timestamp) → `<TS>` and any absolute home path that slipped into an artifact
|
|
289
|
+
* locator → `<ABSPATH>`. RELATIVE artifact paths survive untouched (they are
|
|
290
|
+
* portable, not a leak).
|
|
291
|
+
*
|
|
292
|
+
* WHY: the evaluator's OWN diagnose handoff is itself a run-bundle the data-leak
|
|
293
|
+
* audit inspects. An un-masked `produced_at` + abs home path is exactly the
|
|
294
|
+
* operational leak the audit flags — so the evaluator dogfoods its own audit by
|
|
295
|
+
* masking on emit. It also preserves C-PIN: two runs (or two machines) that
|
|
296
|
+
* differ ONLY in timestamp / home-root serialize to a BYTE-IDENTICAL handoff.
|
|
297
|
+
*
|
|
298
|
+
* The in-memory `routeFailures` bundle keeps its real values (the structured
|
|
299
|
+
* object is unchanged); ONLY the emitted serialization is masked.
|
|
300
|
+
*/
|
|
301
|
+
export function serializeHandoverBundle(bundle: HandoverBundle): string {
|
|
302
|
+
return maskedCanonicalJson(bundle);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export interface ValidationResult {
|
|
306
|
+
ok: boolean;
|
|
307
|
+
errors: string[];
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Validate a candidate bundle against the closed contract + the "every
|
|
312
|
+
* artifact has at least one locator (path|uri)" rule TypeBox alone can't
|
|
313
|
+
* express. A smuggled undeclared field fails (additionalProperties:false).
|
|
314
|
+
*/
|
|
315
|
+
export function validateHandoverBundle(candidate: unknown): ValidationResult {
|
|
316
|
+
const errors: string[] = [];
|
|
317
|
+
if (!BundleChecker.Check(candidate)) {
|
|
318
|
+
for (const e of BundleChecker.Errors(candidate)) {
|
|
319
|
+
errors.push(`${e.path}: ${e.message}`);
|
|
320
|
+
}
|
|
321
|
+
return { ok: false, errors };
|
|
322
|
+
}
|
|
323
|
+
const bundle = candidate as HandoverBundle;
|
|
324
|
+
bundle.inputs.forEach((a, i) => {
|
|
325
|
+
if (a.path === undefined && a.uri === undefined) {
|
|
326
|
+
errors.push(`inputs/${i}: artifact '${a.id}' has neither path nor uri`);
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
return { ok: errors.length === 0, errors };
|
|
330
|
+
}
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/run-deterministic.ts
|
|
3
|
+
* ---------------------------------------------------------------------------
|
|
4
|
+
* The deterministic executor — Tab-1 deterministic rows (decision #4). Walks the
|
|
5
|
+
* subject eval-matrix; for every criterion whose checkMethod is in the
|
|
6
|
+
* DETERMINISTIC track (deterministic-script | typebox-schema | gate) it runs a
|
|
7
|
+
* binary pass/fail check with NO model. Judge-track rows (trace-cross-ref |
|
|
8
|
+
* trajectory-diff) are emitted as `track:judge, result:skip` placeholders that
|
|
9
|
+
* the pinned-judge seam (run-judge.ts) fills in.
|
|
10
|
+
*
|
|
11
|
+
* The deterministic checks are REAL and grounded in the loaded run-bundle:
|
|
12
|
+
* - typebox-schema : the relevant produced artifact must be present + parse as
|
|
13
|
+
* a non-empty object/array (the schema-conformance proxy the
|
|
14
|
+
* bundle can answer offline).
|
|
15
|
+
* - gate : the gate's evidence must be present (e.g. an evidence/
|
|
16
|
+
* file set, a wave6 stamp) — absence => fail-loud.
|
|
17
|
+
* - deterministic-script : the artifact the script produces must be present and
|
|
18
|
+
* non-empty in the bundle.
|
|
19
|
+
*
|
|
20
|
+
* Where a criterion's deep semantic check genuinely needs to re-execute the
|
|
21
|
+
* subject's own script against live data (beyond presence/shape), that is an
|
|
22
|
+
* EXPLICIT, documented integration seam (see `evaluateDeterministic` -> the
|
|
23
|
+
* `needsLiveReexec` path) rather than a silent pass. Such rows return result
|
|
24
|
+
* `skip` with a detail explaining the seam, so they never FALSE-PASS.
|
|
25
|
+
*
|
|
26
|
+
* Pure + deterministic: components/criteria are processed in matrix order; no
|
|
27
|
+
* clock/random/network.
|
|
28
|
+
*/
|
|
29
|
+
import {
|
|
30
|
+
type Component,
|
|
31
|
+
type Criterion,
|
|
32
|
+
type EvalMatrix,
|
|
33
|
+
type RowResultValue,
|
|
34
|
+
type ScorecardCriterion,
|
|
35
|
+
CheckMethod,
|
|
36
|
+
RowResult,
|
|
37
|
+
Track,
|
|
38
|
+
trackForCheckMethod,
|
|
39
|
+
} from "./contracts/types.ts";
|
|
40
|
+
import { type RunBundle } from "./contracts/types.ts";
|
|
41
|
+
|
|
42
|
+
export interface DeterministicRowResult {
|
|
43
|
+
componentId: string;
|
|
44
|
+
criterion: ScorecardCriterion;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Map a criterion to the artifact whose presence/shape proves it. Subject-
|
|
49
|
+
* agnostic heuristic: the bundle's well-known artifacts cover the produced
|
|
50
|
+
* outputs an audit can verify offline. A criterion that references no bundle
|
|
51
|
+
* artifact is a live-reexec seam.
|
|
52
|
+
*/
|
|
53
|
+
function evidenceArtifactFor(
|
|
54
|
+
criterion: Criterion,
|
|
55
|
+
bundle: RunBundle,
|
|
56
|
+
): string | null {
|
|
57
|
+
// Gate rows about evidence/aggregate require the evidence dir.
|
|
58
|
+
const s = criterion.statement.toLowerCase();
|
|
59
|
+
if (s.includes("evidence file") || s.includes("evidence/")) {
|
|
60
|
+
return bundle.data.evidence ? "evidence" : null;
|
|
61
|
+
}
|
|
62
|
+
if (s.includes("wave-6") || s.includes("wave6") || s.includes("stamp")) {
|
|
63
|
+
return bundle.data.wave6 ? "wave6" : null;
|
|
64
|
+
}
|
|
65
|
+
if (s.includes("runmeta") || s.includes("runmeta.")) {
|
|
66
|
+
return bundle.data.runMeta ? "runMeta" : null;
|
|
67
|
+
}
|
|
68
|
+
if (s.includes("entity") || s.includes("diagnosedentity")) {
|
|
69
|
+
return bundle.data.entityContext ? "entityContext" : null;
|
|
70
|
+
}
|
|
71
|
+
if (s.includes("renderinput") || s.includes("render input") || s.includes("heatmap")) {
|
|
72
|
+
return bundle.data.renderInput ? "renderInput" : null;
|
|
73
|
+
}
|
|
74
|
+
if (s.includes("traces-metadata") || s.includes("traces metadata")) {
|
|
75
|
+
return bundle.data.tracesMetadata ? "tracesMetadata" : null;
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function isNonEmpty(value: unknown): boolean {
|
|
81
|
+
if (value == null) return false;
|
|
82
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
83
|
+
if (typeof value === "object") return Object.keys(value).length > 0;
|
|
84
|
+
if (typeof value === "string") return value.length > 0;
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** A STRUCTURED, non-empty value: a non-empty object or array. A present-but-
|
|
89
|
+
* scalar/empty artifact is NOT structured — the typebox-schema re-exec fails it
|
|
90
|
+
* (a hollow presence-pass under the old proxy). PURE. */
|
|
91
|
+
function isStructuredNonEmpty(value: unknown): boolean {
|
|
92
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
93
|
+
if (value !== null && typeof value === "object") return Object.keys(value).length > 0;
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Scan a produced artifact for an EXPLICIT gate-failure marker: a falsy pass
|
|
98
|
+
* flag (`pass`/`ok`/`passed` === false) or a failing `status` stamp
|
|
99
|
+
* (`fail`/`failed`/`error`). Conservative + shallow so it stays deterministic
|
|
100
|
+
* and does not false-fail on unrelated substrings. PURE. */
|
|
101
|
+
function hasFailureMarker(value: unknown): boolean {
|
|
102
|
+
if (value === null || typeof value !== "object") return false;
|
|
103
|
+
const obj = value as Record<string, unknown>;
|
|
104
|
+
for (const flag of ["pass", "ok", "passed"] as const) {
|
|
105
|
+
if (obj[flag] === false) return true;
|
|
106
|
+
}
|
|
107
|
+
const status = obj["status"];
|
|
108
|
+
if (typeof status === "string") {
|
|
109
|
+
const s = status.toLowerCase();
|
|
110
|
+
if (s === "fail" || s === "failed" || s === "error") return true;
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Item #4 — the REAL live re-execution of a deterministic row. Replaces the
|
|
117
|
+
* presence-proxy (`the artifact exists → mark it covered`) with an ACTUAL
|
|
118
|
+
* checkMethod-keyed predicate over the artifact's LIVE content:
|
|
119
|
+
* - typebox-schema : the produced artifact must be a STRUCTURED, non-empty
|
|
120
|
+
* object/array — a present-but-malformed scalar now FAILS
|
|
121
|
+
* instead of hollow-passing (real shape conformance).
|
|
122
|
+
* - gate : the evidence must be present AND carry NO explicit
|
|
123
|
+
* failure marker (fail-loud gate — `hasFailureMarker`).
|
|
124
|
+
* - deterministic-script: the produced artifact must be present + non-empty
|
|
125
|
+
* (the script actually emitted its output).
|
|
126
|
+
* Returns pass/fail when the criterion maps to a live bundle artifact; returns
|
|
127
|
+
* `null` when NO artifact answers it offline — the caller then records the
|
|
128
|
+
* documented seam-skip. A genuinely un-runnable row would require executing the
|
|
129
|
+
* SUBJECT'S OWN script, which the judge-only cell never does (EV-051) and which
|
|
130
|
+
* dispatches NO sub-agents (PR-ORCH-01). PURE + deterministic (no clock/random/
|
|
131
|
+
* network) ⇒ C-PIN byte-identical reruns.
|
|
132
|
+
*/
|
|
133
|
+
export function reexecDeterministicCheck(
|
|
134
|
+
criterion: Criterion,
|
|
135
|
+
bundle: RunBundle,
|
|
136
|
+
): RowResultValue | null {
|
|
137
|
+
const artifactKey = evidenceArtifactFor(criterion, bundle);
|
|
138
|
+
if (artifactKey == null) return null; // no live artifact → not re-executable here
|
|
139
|
+
const value = bundle.data[artifactKey];
|
|
140
|
+
// HONESTY on the depth of each re-exec (do NOT mistake these for deep checks):
|
|
141
|
+
// - typebox-schema : a real SHAPE upgrade over presence (rejects a present-but-
|
|
142
|
+
// scalar), but it is NOT a full TypeBox `Value.Check` against
|
|
143
|
+
// the produced artifact's declared schema — it asserts
|
|
144
|
+
// "structured + non-empty", not field-level conformance.
|
|
145
|
+
// - gate : `hasFailureMarker` is TOP-LEVEL-ONLY (scans the object's own
|
|
146
|
+
// pass/ok/passed/status keys) — it does NOT recurse into nested
|
|
147
|
+
// gate evidence, so a failure buried in a child object is missed.
|
|
148
|
+
// - deterministic-script : semantically ≡ the OLD presence proxy (present +
|
|
149
|
+
// non-empty). It is re-run against LIVE data (so it is a real
|
|
150
|
+
// re-execution, not a cached verdict), but carries no deeper
|
|
151
|
+
// predicate than presence. Deepening any of these to a true
|
|
152
|
+
// re-run of the subject's own script is the documented seam
|
|
153
|
+
// (out of scope for a judge-only / no-sub-agent cell).
|
|
154
|
+
switch (criterion.checkMethod) {
|
|
155
|
+
case CheckMethod.TypeboxSchema:
|
|
156
|
+
return isStructuredNonEmpty(value) ? RowResult.Pass : RowResult.Fail;
|
|
157
|
+
case CheckMethod.Gate:
|
|
158
|
+
return isNonEmpty(value) && !hasFailureMarker(value) ? RowResult.Pass : RowResult.Fail;
|
|
159
|
+
case CheckMethod.DeterministicScript:
|
|
160
|
+
default:
|
|
161
|
+
return isNonEmpty(value) ? RowResult.Pass : RowResult.Fail;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface EvaluateOptions {
|
|
166
|
+
/**
|
|
167
|
+
* Item #4 — the LIVE RE-EXEC executor. When supplied it RUNS the real
|
|
168
|
+
* deterministic check against live bundle data (see `reexecDeterministicCheck`,
|
|
169
|
+
* the default) and its pass/fail return is authoritative — replacing the
|
|
170
|
+
* presence-proxy that marked a row covered from mere artifact existence. A
|
|
171
|
+
* `null` return means "this executor cannot answer this row" ⇒ the legacy
|
|
172
|
+
* (byte-stable) path runs. ABSENT ⇒ no re-exec wired: fully back-compatible,
|
|
173
|
+
* byte-identical to before (the presence proxy + documented seam-skip). The
|
|
174
|
+
* executor is PURE + dispatches NO sub-agents (PR-ORCH-01) + never fixes the
|
|
175
|
+
* subject (EV-051).
|
|
176
|
+
*/
|
|
177
|
+
liveReexec?: (criterion: Criterion, bundle: RunBundle) => RowResultValue | null;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Evaluate ONE deterministic criterion against the bundle. Never throws; returns
|
|
182
|
+
* a binary pass/fail, or `skip` with a documented reason for a live-reexec seam.
|
|
183
|
+
*/
|
|
184
|
+
export function evaluateDeterministic(
|
|
185
|
+
criterion: Criterion,
|
|
186
|
+
bundle: RunBundle,
|
|
187
|
+
opts: EvaluateOptions = {},
|
|
188
|
+
): ScorecardCriterion {
|
|
189
|
+
const track = Track.Deterministic;
|
|
190
|
+
|
|
191
|
+
// Item #4 — LIVE RE-EXEC FIRST. When an executor is wired it RUNS the real
|
|
192
|
+
// deterministic check against live data; a pass/fail is authoritative and
|
|
193
|
+
// REPLACES the presence-proxy (no more "an artifact exists → covered"). A null
|
|
194
|
+
// return means the executor could not answer this row ⇒ fall through to the
|
|
195
|
+
// (byte-stable) legacy path below.
|
|
196
|
+
const live = opts.liveReexec?.(criterion, bundle) ?? null;
|
|
197
|
+
if (live === RowResult.Pass || live === RowResult.Fail || live === RowResult.Incomplete) {
|
|
198
|
+
return {
|
|
199
|
+
dimension: criterion.dimension,
|
|
200
|
+
severity: criterion.severity,
|
|
201
|
+
checkMethod: criterion.checkMethod,
|
|
202
|
+
track,
|
|
203
|
+
result: live,
|
|
204
|
+
detail: `live re-exec (${criterion.checkMethod}): real deterministic check over the produced artifact → ${live}`,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const artifactKey = evidenceArtifactFor(criterion, bundle);
|
|
209
|
+
|
|
210
|
+
if (artifactKey == null) {
|
|
211
|
+
// No bundle artifact answers this row offline -> documented seam-skip. NOT
|
|
212
|
+
// silent: the coverage-honesty warning (computeCoverage) surfaces it, and
|
|
213
|
+
// fully executing it would require running the subject's OWN script — which
|
|
214
|
+
// the judge-only cell never does (EV-051) and which dispatches no sub-agents.
|
|
215
|
+
return {
|
|
216
|
+
dimension: criterion.dimension,
|
|
217
|
+
severity: criterion.severity,
|
|
218
|
+
checkMethod: criterion.checkMethod,
|
|
219
|
+
track,
|
|
220
|
+
result: RowResult.Skip,
|
|
221
|
+
detail:
|
|
222
|
+
"INTEGRATION SEAM: requires live re-exec of the subject's own script (no bundle artifact answers this row offline); skipped rather than false-passed",
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// LEGACY presence proxy — reached ONLY when no live-reexec executor is wired
|
|
227
|
+
// (kept for byte-identity with pre-Item-#4 callers). With the default executor
|
|
228
|
+
// wired (audit-run.ts) this branch is never taken for a mapped row.
|
|
229
|
+
const present = isNonEmpty(bundle.data[artifactKey]);
|
|
230
|
+
return {
|
|
231
|
+
dimension: criterion.dimension,
|
|
232
|
+
severity: criterion.severity,
|
|
233
|
+
checkMethod: criterion.checkMethod,
|
|
234
|
+
track,
|
|
235
|
+
result: present ? RowResult.Pass : RowResult.Fail,
|
|
236
|
+
detail: present
|
|
237
|
+
? `evidence artifact '${artifactKey}' present + non-empty (presence proxy — no live re-exec wired)`
|
|
238
|
+
: `evidence artifact '${artifactKey}' MISSING/empty in bundle (fail-loud)`,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** Judge-track placeholder — filled in by the pinned-judge seam. */
|
|
243
|
+
export function judgePlaceholder(criterion: Criterion): ScorecardCriterion {
|
|
244
|
+
return {
|
|
245
|
+
dimension: criterion.dimension,
|
|
246
|
+
severity: criterion.severity,
|
|
247
|
+
checkMethod: criterion.checkMethod,
|
|
248
|
+
track: Track.Judge,
|
|
249
|
+
result: RowResult.Skip,
|
|
250
|
+
detail:
|
|
251
|
+
"PINNED-JUDGE SEAM: requires pinned model (id + temp=0) reading transcript vs behavior-tree; deferred to run-judge.ts",
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export interface RunDeterministicResult {
|
|
256
|
+
rows: DeterministicRowResult[];
|
|
257
|
+
deterministicCount: number;
|
|
258
|
+
judgeCount: number;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// ── Coverage honesty (EV-OUT-002) ──────────────────────────────────────────
|
|
262
|
+
/**
|
|
263
|
+
* Default skip-rate at/above which a coverage WARNING is raised. Conservative
|
|
264
|
+
* (0.5) so a run where more rows were skipped than graded can no longer claim a
|
|
265
|
+
* silent PASS. This is a WARNING threshold ONLY — it never flips gate pass/fail.
|
|
266
|
+
*/
|
|
267
|
+
export const DEFAULT_SKIP_RATE_WARN_THRESHOLD = 0.5;
|
|
268
|
+
|
|
269
|
+
/** Fixed precision for skipRate so two audits serialize byte-identically. */
|
|
270
|
+
const SKIP_RATE_PRECISION = 4;
|
|
271
|
+
|
|
272
|
+
/** The pass/fail/skip tally `assembleScorecard` derives from the graded rows. */
|
|
273
|
+
export interface CoverageTotals {
|
|
274
|
+
pass: number;
|
|
275
|
+
fail: number;
|
|
276
|
+
skip: number;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export interface CoverageOptions {
|
|
280
|
+
/**
|
|
281
|
+
* Skip-rate STRICTLY ABOVE which `coverageWarning` is set. Default
|
|
282
|
+
* {@link DEFAULT_SKIP_RATE_WARN_THRESHOLD}. Warning-only — this never alters
|
|
283
|
+
* the GATE's pass/fail decision; the honesty mechanism is the surfaced
|
|
284
|
+
* warning, not a gate flip.
|
|
285
|
+
*/
|
|
286
|
+
skipRateWarnThreshold?: number;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export interface Coverage {
|
|
290
|
+
/** rows actually graded (pass + fail) — the non-vacuous denominator. */
|
|
291
|
+
graded: number;
|
|
292
|
+
/** every criterion (pass + fail + skip). */
|
|
293
|
+
total: number;
|
|
294
|
+
/** rows skipped (seam / no-bundle-artifact / judge placeholder). */
|
|
295
|
+
skipped: number;
|
|
296
|
+
/** skipped / total, rounded to fixed precision (0 when total is 0). */
|
|
297
|
+
skipRate: number;
|
|
298
|
+
/** the threshold that was applied. */
|
|
299
|
+
skipRateWarnThreshold: number;
|
|
300
|
+
/** true iff skipRate exceeds the threshold — surfaces a near-vacuous PASS. */
|
|
301
|
+
coverageWarning: boolean;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Derive the coverage-honesty stat from a pass/fail/skip tally. Pure +
|
|
306
|
+
* deterministic: integer counts in, fixed-precision ratio out, no clock/random.
|
|
307
|
+
*
|
|
308
|
+
* A high skip-rate means most criteria were never graded — so a `gateRunPass`
|
|
309
|
+
* of true is near-vacuous. `coverageWarning` makes that LOUD without changing
|
|
310
|
+
* pass/fail semantics (the gate is decided entirely upstream by fail counts).
|
|
311
|
+
*/
|
|
312
|
+
export function computeCoverage(
|
|
313
|
+
totals: CoverageTotals,
|
|
314
|
+
opts: CoverageOptions = {},
|
|
315
|
+
): Coverage {
|
|
316
|
+
const skipRateWarnThreshold =
|
|
317
|
+
opts.skipRateWarnThreshold ?? DEFAULT_SKIP_RATE_WARN_THRESHOLD;
|
|
318
|
+
const graded = totals.pass + totals.fail;
|
|
319
|
+
const skipped = totals.skip;
|
|
320
|
+
const total = graded + skipped;
|
|
321
|
+
const rawRate = total === 0 ? 0 : skipped / total;
|
|
322
|
+
const factor = 10 ** SKIP_RATE_PRECISION;
|
|
323
|
+
const skipRate = Math.round(rawRate * factor) / factor;
|
|
324
|
+
return {
|
|
325
|
+
graded,
|
|
326
|
+
total,
|
|
327
|
+
skipped,
|
|
328
|
+
skipRate,
|
|
329
|
+
skipRateWarnThreshold,
|
|
330
|
+
coverageWarning: skipRate > skipRateWarnThreshold,
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Run the full deterministic pass over a matrix + bundle. Emits one row per
|
|
336
|
+
* criterion: deterministic rows are graded now; judge rows are placeholders.
|
|
337
|
+
*/
|
|
338
|
+
export function runDeterministic(
|
|
339
|
+
matrix: EvalMatrix,
|
|
340
|
+
bundle: RunBundle,
|
|
341
|
+
opts: EvaluateOptions = {},
|
|
342
|
+
): RunDeterministicResult {
|
|
343
|
+
const rows: DeterministicRowResult[] = [];
|
|
344
|
+
let deterministicCount = 0;
|
|
345
|
+
let judgeCount = 0;
|
|
346
|
+
|
|
347
|
+
for (const component of matrix.components as Component[]) {
|
|
348
|
+
for (const criterion of component.criteria) {
|
|
349
|
+
const track = trackForCheckMethod(criterion.checkMethod);
|
|
350
|
+
if (track === Track.Deterministic) {
|
|
351
|
+
deterministicCount += 1;
|
|
352
|
+
rows.push({
|
|
353
|
+
componentId: component.componentId,
|
|
354
|
+
criterion: evaluateDeterministic(criterion, bundle, opts),
|
|
355
|
+
});
|
|
356
|
+
} else {
|
|
357
|
+
judgeCount += 1;
|
|
358
|
+
rows.push({
|
|
359
|
+
componentId: component.componentId,
|
|
360
|
+
criterion: judgePlaceholder(criterion),
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
return { rows, deterministicCount, judgeCount };
|
|
367
|
+
}
|