@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,1078 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/normalize/trace.ts
|
|
3
|
+
* Canonical TraceMetadata, TraceBody, and Finding types.
|
|
4
|
+
* Every per-platform normalizer converts to these shapes.
|
|
5
|
+
* Type A — Pure Script (type definitions only — no I/O)
|
|
6
|
+
*
|
|
7
|
+
* Wave-3 Phase 3-C additions:
|
|
8
|
+
* - I-023: Finding.assumptions? — explicit assumption enumeration (optional field)
|
|
9
|
+
* - I-025: Remedy.applyTarget? — file/module/agent the remedy patches
|
|
10
|
+
* - I-012: TraceMetadata.skillBehaviorDeviationCount? — tier0 skill-deviation signal
|
|
11
|
+
* - I-013: TraceFilter.skill_agent_scope lives in scripts/config/schema.ts (TraceFilterSchema)
|
|
12
|
+
*
|
|
13
|
+
* Wave-8 PRD-SO-07: TraceMetadata.totalCostUsd? — total run cost in USD for bigStat tile
|
|
14
|
+
* Wave-8 PRD-CC-01: Remedy.rationale? / whyWorks? / applyInstructions? / changeType?
|
|
15
|
+
* Wave-8 PRD-CC-02: FeedbackSource type + Finding.feedbackSources[]
|
|
16
|
+
*
|
|
17
|
+
* Wave-9 W9-F (PR-046): Two-layer feedback schema
|
|
18
|
+
* - Finding.translatedFeedback[] — symptom → component-level translation records
|
|
19
|
+
* - Remedy.feedbackOnFix[] — outcome records for applied fixes
|
|
20
|
+
* Wave-9 W9-09 (PR-048): Trace-Hungry escalation telemetry
|
|
21
|
+
* - RunMeta.deepRead — tier reached, llmReadCount, batches, stopReason
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
// ── Canonical trace types ────────────────────────────────────────────────────
|
|
25
|
+
|
|
26
|
+
export interface TraceMetadata {
|
|
27
|
+
/** Platform-native trace/session identifier */
|
|
28
|
+
traceId: string;
|
|
29
|
+
/** Session identifier (may equal traceId for single-thread platforms) */
|
|
30
|
+
sessionId: string;
|
|
31
|
+
/** Agent name or identifier */
|
|
32
|
+
agentId?: string;
|
|
33
|
+
/** Trace start time (ISO8601) */
|
|
34
|
+
startTime?: string;
|
|
35
|
+
/** Trace end time (ISO8601) */
|
|
36
|
+
endTime?: string;
|
|
37
|
+
/** Latency in milliseconds */
|
|
38
|
+
latencyMs?: number;
|
|
39
|
+
/** Token usage (total input + output) */
|
|
40
|
+
totalTokens?: number;
|
|
41
|
+
/** Whether trace contains error events */
|
|
42
|
+
hasError: boolean;
|
|
43
|
+
/** Whether trace has associated feedback */
|
|
44
|
+
hasFeedback: boolean;
|
|
45
|
+
/** Numeric score if present (raw, before scale normalization) */
|
|
46
|
+
rawScore?: number;
|
|
47
|
+
/** Scale type — populated after score-scale auto-discovery (iter-8) */
|
|
48
|
+
scaleType?: ScaleType;
|
|
49
|
+
/** Normalized score in [0, 1] range (0 = worst, 1 = best) */
|
|
50
|
+
normalizedScore?: number;
|
|
51
|
+
/** Tags or labels from the source platform */
|
|
52
|
+
tags?: string[];
|
|
53
|
+
/** Source platform identifier */
|
|
54
|
+
sourcePlatform: SourcePlatform;
|
|
55
|
+
|
|
56
|
+
// ── R-SELF-06-a: provider-side + harness-side event metadata ──────────────
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* API error events with retry tracking (from JSONL subtype:"api_error").
|
|
60
|
+
* Used by tier0-scan to detect provider-exhaustion as a primary signal.
|
|
61
|
+
*/
|
|
62
|
+
apiErrors?: Array<{
|
|
63
|
+
retryAttempt: number;
|
|
64
|
+
maxRetries: number;
|
|
65
|
+
timestamp: string;
|
|
66
|
+
}>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Compaction/context-trim events (from JSONL compact_boundary events).
|
|
70
|
+
* Useful for diagnosing context-overflow failure patterns.
|
|
71
|
+
*/
|
|
72
|
+
compactionEvents?: Array<{
|
|
73
|
+
preTokens: number;
|
|
74
|
+
postTokens: number;
|
|
75
|
+
durationMs: number;
|
|
76
|
+
}>;
|
|
77
|
+
|
|
78
|
+
// ── R-SELF-09-a: provenance + team-member context ─────────────────────────
|
|
79
|
+
|
|
80
|
+
/** Parent session ID — populated when this session was spawned by another agent */
|
|
81
|
+
parentSessionId?: string;
|
|
82
|
+
/** Agent setting/role identifier (from first agent-setting event in transcript) */
|
|
83
|
+
agentSetting?: string;
|
|
84
|
+
/** True if this session was dispatched as a team-member agent (not the lead) */
|
|
85
|
+
isTeammate?: boolean;
|
|
86
|
+
|
|
87
|
+
// ── I-012: skill workflow deviation counter ───────────────────────────────
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* I-012: Count of skill workflow deviation events detected in this trace session.
|
|
91
|
+
* A value > 0 indicates the skill deviated from its documented workflow
|
|
92
|
+
* (e.g., skipped signal census, omitted assumption enumeration, bypassed scope construct).
|
|
93
|
+
* Populated by per-platform normalizers when deviation markers are found in the trace.
|
|
94
|
+
*/
|
|
95
|
+
skillBehaviorDeviationCount?: number;
|
|
96
|
+
|
|
97
|
+
// ── PRD-SO-07: total cost field ───────────────────────────────────────────
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* PRD-SO-07: Total cost for this trace in USD.
|
|
101
|
+
* Populated by the langfuse normalizer from raw.totalCost.
|
|
102
|
+
* The enricher's buildBigStat aggregates this as a SUM across the session window
|
|
103
|
+
* and renders it as "$N.NN / window" (red > $50, yellow > $10, muted <= $10).
|
|
104
|
+
* USD-only for now (Q10 recommendation).
|
|
105
|
+
*/
|
|
106
|
+
totalCostUsd?: number;
|
|
107
|
+
|
|
108
|
+
// ── W12-12: de-double-counted billed tokens ───────────────────────────────
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* W12-12: Billed INPUT tokens for this trace, computed from doGenerate-only
|
|
112
|
+
* generation spans (the leaf LLM calls). The parent `ai.generateText` wrapper
|
|
113
|
+
* span repeats its children's usage, so a naive sum across all generation
|
|
114
|
+
* spans double-counts (~2.2×). This field counts ONLY the leaf doGenerate
|
|
115
|
+
* spans, giving the true billed figure. Undefined when no usage is present.
|
|
116
|
+
*/
|
|
117
|
+
billedInputTokens?: number;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* W12-12: Billed OUTPUT tokens for this trace (doGenerate-only, de-double-counted).
|
|
121
|
+
* See `billedInputTokens` for the double-count rationale.
|
|
122
|
+
*/
|
|
123
|
+
billedOutputTokens?: number;
|
|
124
|
+
|
|
125
|
+
// ── W18-cache: GROUNDED prompt-caching detection ──────────────────────────
|
|
126
|
+
//
|
|
127
|
+
// CORE RULE: cache state is read ONLY from the source's cache-token fields
|
|
128
|
+
// (Langfuse usageDetails.input_cached_tokens / Anthropic cache_read_input_tokens /
|
|
129
|
+
// cache_creation_input_tokens, OTel gen_ai.usage.cache_* attrs, and usage.* equivalents).
|
|
130
|
+
// It is NEVER inferred from flat promptTokens or byte sizes. The motivating miss:
|
|
131
|
+
// a client agent's caching was active ~89%, but the skill inferred "uncached →
|
|
132
|
+
// 408M billed tokens" from byte sizes. ABSENCE OF A CACHE FIELD ≠ NO CACHING.
|
|
133
|
+
//
|
|
134
|
+
// When NO cache-token field is present on ANY usage-bearing generation span,
|
|
135
|
+
// cacheStatus is "unknown" — NOT "uncached". A grounded hit-rate is only emitted
|
|
136
|
+
// when the cache fields are present.
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* W18-cache: Cached INPUT tokens served from the prompt cache (cache READ),
|
|
140
|
+
* summed across the same doGenerate-only generation spans as billedInputTokens.
|
|
141
|
+
* Sourced ONLY from cache-token fields (e.g. Langfuse usageDetails.input_cached_tokens,
|
|
142
|
+
* Anthropic cache_read_input_tokens). Undefined when no span carried a cache-read
|
|
143
|
+
* field — undefined means "unknown", NOT "zero cached" (that is the core W18 rule).
|
|
144
|
+
*/
|
|
145
|
+
cachedInputTokens?: number;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* W18-cache: Cache-CREATION input tokens (tokens written into the cache on a
|
|
149
|
+
* cache-miss write), summed across the doGenerate-only spans. Sourced ONLY from
|
|
150
|
+
* cache-creation fields (e.g. Anthropic cache_creation_input_tokens,
|
|
151
|
+
* Langfuse usageDetails.cache_creation_input_tokens). Undefined when absent.
|
|
152
|
+
* Cache-creation tokens are billed input but are NOT cache HITS — they are the
|
|
153
|
+
* write side of the cache and are excluded from the hit-rate numerator.
|
|
154
|
+
*/
|
|
155
|
+
cacheCreationTokens?: number;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* W18-cache: GROUNDED cache status for this trace's billed generation spans.
|
|
159
|
+
* - 'hit' -- cache fields present AND cachedInputTokens > 0 (cache was read).
|
|
160
|
+
* - 'miss' -- cache fields present but cachedInputTokens === 0 (caching is
|
|
161
|
+
* observable on this provider/shape, but nothing was served from
|
|
162
|
+
* cache for this trace — a GROUNDED miss, distinct from unknown).
|
|
163
|
+
* - 'unknown' -- NO cache-token field present on any usage-bearing span. We do
|
|
164
|
+
* NOT know whether caching was active. NEVER report this as
|
|
165
|
+
* "uncached" — absence of a cache field is not evidence of no cache.
|
|
166
|
+
* Undefined only when the trace carries no billed generation usage at all.
|
|
167
|
+
*/
|
|
168
|
+
cacheStatus?: CacheStatus;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* W18-cache: Cache-hit rate in [0, 1] = cachedInputTokens / (total cache-attributed
|
|
172
|
+
* input tokens). Populated ONLY when cacheStatus is 'hit' or 'miss' (i.e. cache
|
|
173
|
+
* fields were present). Undefined when cacheStatus is 'unknown' or absent — there
|
|
174
|
+
* is no grounded basis to compute a rate without the cache fields.
|
|
175
|
+
*
|
|
176
|
+
* Denominator = cachedInputTokens + (uncached billed input) + cacheCreationTokens,
|
|
177
|
+
* reconstructing the provider's total input from the grounded token fields. This
|
|
178
|
+
* is computed ONLY from cache-token fields — never from promptTokens flatness or
|
|
179
|
+
* byte sizes.
|
|
180
|
+
*/
|
|
181
|
+
cacheHitRate?: number;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* W18-cache: grounded cache state. `unknown` is a first-class, load-bearing value:
|
|
186
|
+
* it means the cache-token fields were absent, so cache state is genuinely unknown.
|
|
187
|
+
* It is deliberately distinct from `miss` (cache fields present, nothing served) so
|
|
188
|
+
* downstream renders never collapse "we don't know" into "no caching happened".
|
|
189
|
+
*/
|
|
190
|
+
export type CacheStatus = "hit" | "miss" | "unknown";
|
|
191
|
+
|
|
192
|
+
export type SourcePlatform =
|
|
193
|
+
| "langfuse"
|
|
194
|
+
| "otel"
|
|
195
|
+
| "local-jsonl"
|
|
196
|
+
| "claude-code"
|
|
197
|
+
| "codex";
|
|
198
|
+
|
|
199
|
+
export type ScaleType =
|
|
200
|
+
| "boolean"
|
|
201
|
+
| "discrete-1-5"
|
|
202
|
+
| "discrete-1-10"
|
|
203
|
+
| "continuous-0-1"
|
|
204
|
+
| "categorical";
|
|
205
|
+
|
|
206
|
+
export interface TraceMessage {
|
|
207
|
+
/** Message index within the trace */
|
|
208
|
+
index: number;
|
|
209
|
+
/** Role: user | assistant | tool | system */
|
|
210
|
+
role: "user" | "assistant" | "tool" | "system";
|
|
211
|
+
/** Message content (may be truncated for large messages) */
|
|
212
|
+
content: string;
|
|
213
|
+
/** Tool name if this is a tool call or tool result */
|
|
214
|
+
toolName?: string;
|
|
215
|
+
/** Tool call arguments (JSON string) */
|
|
216
|
+
toolArgs?: string;
|
|
217
|
+
/** Tool result content */
|
|
218
|
+
toolResult?: string;
|
|
219
|
+
/** Whether this is an error result */
|
|
220
|
+
isError?: boolean;
|
|
221
|
+
/** Timestamp (ISO8601) */
|
|
222
|
+
timestamp?: string;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface TraceBody {
|
|
226
|
+
metadata: TraceMetadata;
|
|
227
|
+
messages: TraceMessage[];
|
|
228
|
+
/** Raw user feedback text if present */
|
|
229
|
+
userFeedback?: string;
|
|
230
|
+
/** Embedded score value if present */
|
|
231
|
+
score?: number;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// ── EntityContext (Wave-5 R1.7 / APPENDIX-A) ──────────────────────────────────
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* A long text field with its size metadata, so the renderer can decide whether
|
|
238
|
+
* to wrap it in an ExpandableSection (>1 KB) and surface size + token counts in
|
|
239
|
+
* the summary. All fields are content-derived at ingest — DETERMINISTIC, no LLM.
|
|
240
|
+
*
|
|
241
|
+
* INVARIANT (APPENDIX §A.4): `sizeBytes === byteLength(text)`.
|
|
242
|
+
*/
|
|
243
|
+
export interface SizedText {
|
|
244
|
+
/** The (PII-sanitized where applicable) text content. */
|
|
245
|
+
text: string;
|
|
246
|
+
/** UTF-8 byte length of `text`. MUST equal byteLength(text). */
|
|
247
|
+
sizeBytes: number;
|
|
248
|
+
/** Approximate token count (≈ chars/4 heuristic — deterministic, no tokenizer). */
|
|
249
|
+
tokensApprox?: number;
|
|
250
|
+
/**
|
|
251
|
+
* F-S2c (PR-055 proposed): OPTIONAL marker letting a consumer distinguish
|
|
252
|
+
* "content existed but was sanitized away" from "content was genuinely empty".
|
|
253
|
+
* Set true when a non-empty source value was PII-redacted down to empty/zero
|
|
254
|
+
* (sizeBytes 0 + fullyRedacted true) — vs the field simply being absent on the
|
|
255
|
+
* parent (e.g. EntityContext.systemPrompt undefined = "no prompt found").
|
|
256
|
+
* Schema only — Block A sets it; absent on normal sized text (backward-compat).
|
|
257
|
+
*/
|
|
258
|
+
fullyRedacted?: boolean;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** Per-tool usage stats aggregated from trace observations (deterministic). */
|
|
262
|
+
export interface ToolInventoryEntry {
|
|
263
|
+
name: string;
|
|
264
|
+
/** Total invocations across all traces. */
|
|
265
|
+
callCount: number;
|
|
266
|
+
/** Mean invocations per trace (callCount / traceCount), rounded to 2dp. */
|
|
267
|
+
callsPerTrace: number;
|
|
268
|
+
/** Mean latency in ms (endTime-startTime per observation), when timing present. */
|
|
269
|
+
avgLatencyMs?: number;
|
|
270
|
+
/** 95th-percentile latency in ms (nearest-rank), when timing present. */
|
|
271
|
+
p95LatencyMs?: number;
|
|
272
|
+
/** Tool signature / arg-shape sample, when derivable from the trace. */
|
|
273
|
+
signature?: string;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Wave-5 R1.7 (APPENDIX-A §A.2): rich, content-derived context for the diagnosed
|
|
278
|
+
* entity, extracted by each per-platform normalizer ALONGSIDE TraceBody[] at ingest.
|
|
279
|
+
* The renderer consumes this via RenderInput.diagnosedEntity. NO LLM calls —
|
|
280
|
+
* every field is derived from trace content so re-runs are byte-identical.
|
|
281
|
+
*/
|
|
282
|
+
export interface EntityContext {
|
|
283
|
+
/** Display name — trace.name majority vote (or skill name for self-diag). */
|
|
284
|
+
name: string;
|
|
285
|
+
/** Category: agent, tool, skill, or model. */
|
|
286
|
+
entityType: "agent" | "tool" | "skill" | "model";
|
|
287
|
+
/** Whether source code is accessible for diagnostics (true for self-diag skill). */
|
|
288
|
+
codeAccess: boolean;
|
|
289
|
+
/** Model identifier — first GENERATION observation's .model. */
|
|
290
|
+
model?: string;
|
|
291
|
+
/** System prompt (sanitized) — system-role message OR <system>…</system> regex. */
|
|
292
|
+
systemPrompt?: SizedText;
|
|
293
|
+
/** Aggregated tool-usage inventory (grouped by name). */
|
|
294
|
+
toolInventory?: ToolInventoryEntry[];
|
|
295
|
+
/**
|
|
296
|
+
* F-S2b (PR-055 proposed): OPTIONAL aggregate counter on the tool inventory —
|
|
297
|
+
* number of tool-call/tool-result messages SKIPPED during aggregation because
|
|
298
|
+
* they had no resolvable `toolName`. A non-zero value warns the operator the
|
|
299
|
+
* inventory undercounts. Companion to `toolInventory` (NOT a per-tool field).
|
|
300
|
+
* Schema only — Block A sets it (absent = not computed yet).
|
|
301
|
+
*/
|
|
302
|
+
skippedCount?: number;
|
|
303
|
+
/**
|
|
304
|
+
* F-S2b (PR-055 proposed): OPTIONAL aggregate counter on the tool inventory —
|
|
305
|
+
* number of distinct tools in `toolInventory` that have NO latency data
|
|
306
|
+
* (avgLatencyMs/p95LatencyMs undefined). Lets the renderer caveat latency
|
|
307
|
+
* coverage. Companion to `toolInventory` (NOT a per-tool field). Schema only —
|
|
308
|
+
* Block A sets it (absent = not computed yet).
|
|
309
|
+
*/
|
|
310
|
+
toolsWithoutLatency?: number;
|
|
311
|
+
/** Sanitized input sample (first prompt, sliced). */
|
|
312
|
+
inputSample?: SizedText & { sanitized: boolean };
|
|
313
|
+
/** Provenance string: "langfuse-export" | "claude-code-jsonl" | …. */
|
|
314
|
+
source: string;
|
|
315
|
+
/** Where remedies apply (e.g. "config.yaml / skill assets (NEVER source)"). */
|
|
316
|
+
applyTarget?: string;
|
|
317
|
+
/**
|
|
318
|
+
* W11-07: Cross-platform identity pointers for this entity, resolved from
|
|
319
|
+
* config.agents[] at Step 3.7. Absent when the entity is not declared in
|
|
320
|
+
* config.agents (run proceeds with trace-name-based matching only).
|
|
321
|
+
*
|
|
322
|
+
* The normalizer populates all other fields; identity is a post-ingest annotation
|
|
323
|
+
* injected by resolveEntityIdentity() after config is loaded.
|
|
324
|
+
*/
|
|
325
|
+
identity?: EntityIdentityPointers;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* W11-07: Resolved cross-platform identity pointers for a named entity.
|
|
330
|
+
* Derived from config.agents[N].langfuse + config.agents[N].otel via
|
|
331
|
+
* resolveEntityIdentity() in scripts/normalize/platforms/entity-context.ts.
|
|
332
|
+
*/
|
|
333
|
+
export interface EntityIdentityPointers {
|
|
334
|
+
/** Langfuse trace.name / tags / agentIdField overrides for this entity. */
|
|
335
|
+
langfuse?: {
|
|
336
|
+
traceName?: string;
|
|
337
|
+
tags?: string[];
|
|
338
|
+
agentIdField?: string;
|
|
339
|
+
};
|
|
340
|
+
/** OTel service.name + resource attribute overrides for this entity. */
|
|
341
|
+
otel?: {
|
|
342
|
+
serviceName?: string;
|
|
343
|
+
resourceAttrs?: Record<string, string>;
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// ── Wave-9 W9-F: Two-layer feedback schema (PR-046) ──────────────────────────
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* W9-F (PR-046 Layer 2): A single translated-feedback entry bridging raw user
|
|
351
|
+
* symptom → component-level RCA target. Captures the translation step explicitly
|
|
352
|
+
* so the renderer can show "what the user said" vs "what it means for the agent".
|
|
353
|
+
*
|
|
354
|
+
* Optional/backward-compatible: absent when no feedback was translated for the finding.
|
|
355
|
+
*/
|
|
356
|
+
export interface TranslatedFeedback {
|
|
357
|
+
/**
|
|
358
|
+
* Index into Finding.feedbackSources (0-based) that this translation derives from.
|
|
359
|
+
* When feedbackSources is absent, this is an index into a legacy userFeedback string
|
|
360
|
+
* split (treat as 0 in that case).
|
|
361
|
+
*/
|
|
362
|
+
sourceIndex: number;
|
|
363
|
+
/** Verbatim excerpt from the raw feedback that drove this translation. */
|
|
364
|
+
rawQuote: string;
|
|
365
|
+
/**
|
|
366
|
+
* The system component to which the symptom was translated (the RCA target).
|
|
367
|
+
* Examples: "tool-definition", "system-prompt", "routing-config".
|
|
368
|
+
*/
|
|
369
|
+
component: string;
|
|
370
|
+
/**
|
|
371
|
+
* The specific location affected, expressed as a WhereCategory value.
|
|
372
|
+
* Drives the per-finding taxonomy strip in the renderer.
|
|
373
|
+
*/
|
|
374
|
+
affectedComponent: WhereCategory;
|
|
375
|
+
/** One-sentence explanation of the translation reasoning. */
|
|
376
|
+
reasoning: string;
|
|
377
|
+
/** Translator's confidence in the mapping. */
|
|
378
|
+
confidence: "high" | "medium" | "low";
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* W9-F (PR-046 Layer 3 — fix-feedback): Outcome record for an applied remedy.
|
|
383
|
+
* Accumulated in Remedy.feedbackOnFix[] after the operator tests the fix in a
|
|
384
|
+
* subsequent session. Enables the renderer to show a per-remedy fix history.
|
|
385
|
+
*
|
|
386
|
+
* Optional/backward-compatible: absent until a fix has been tested.
|
|
387
|
+
*/
|
|
388
|
+
export interface FeedbackOnFix {
|
|
389
|
+
/** Trace session ID of the test run that produced this feedback. */
|
|
390
|
+
testSessionId: string;
|
|
391
|
+
/** ISO8601 timestamp when the fix was tested. */
|
|
392
|
+
testedAt: string;
|
|
393
|
+
/**
|
|
394
|
+
* Observed outcome after applying the remedy:
|
|
395
|
+
* - 'closed' — the finding is fully resolved.
|
|
396
|
+
* - 'partial' — the finding is partially resolved (still occurs, less severe).
|
|
397
|
+
* - 'ineffective' — the fix was applied but had no measurable effect.
|
|
398
|
+
* - 'regressed' — the fix introduced a new problem.
|
|
399
|
+
*/
|
|
400
|
+
outcome: "closed" | "partial" | "ineffective" | "regressed";
|
|
401
|
+
/** Optional free-text comment from the tester or operator. */
|
|
402
|
+
comment?: string;
|
|
403
|
+
/**
|
|
404
|
+
* Recommended follow-up steps when outcome !== 'closed'.
|
|
405
|
+
* Empty or absent when the finding is fully closed.
|
|
406
|
+
*/
|
|
407
|
+
nextSteps?: string[];
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// ── Finding types (output of RCA layer) ──────────────────────────────────────
|
|
411
|
+
|
|
412
|
+
export type WhatCategory =
|
|
413
|
+
| "wrong-output"
|
|
414
|
+
| "missing-output"
|
|
415
|
+
| "loop"
|
|
416
|
+
| "latency-spike"
|
|
417
|
+
| "cost-overshoot"
|
|
418
|
+
| "format-violation"
|
|
419
|
+
| "hallucination"
|
|
420
|
+
| "user-complaint"
|
|
421
|
+
| "low-score"
|
|
422
|
+
| "missing-context";
|
|
423
|
+
|
|
424
|
+
export type WhyCategory =
|
|
425
|
+
| "prompt-underspec"
|
|
426
|
+
| "prompt-overspec"
|
|
427
|
+
| "tool-misuse"
|
|
428
|
+
| "tool-missing"
|
|
429
|
+
| "context-overflow"
|
|
430
|
+
| "provider-limit"
|
|
431
|
+
| "data-staleness"
|
|
432
|
+
| "handoff-loss"
|
|
433
|
+
| "dependency-failure";
|
|
434
|
+
|
|
435
|
+
export type WhereCategory =
|
|
436
|
+
| "system-prompt"
|
|
437
|
+
| "tool-definition"
|
|
438
|
+
| "agent-config"
|
|
439
|
+
| "routing-config"
|
|
440
|
+
| "upstream-data"
|
|
441
|
+
| "provider-side"
|
|
442
|
+
| "harness-side"
|
|
443
|
+
| "user-input";
|
|
444
|
+
|
|
445
|
+
export interface FailureOrigin {
|
|
446
|
+
what: WhatCategory;
|
|
447
|
+
why: WhyCategory;
|
|
448
|
+
where: WhereCategory;
|
|
449
|
+
/** Pointer to specific evidence: file:line, trace message slice, code pointer */
|
|
450
|
+
evidence: string;
|
|
451
|
+
/**
|
|
452
|
+
* F-EV1 (PR-055 proposed): plain-words narration of the event that actually
|
|
453
|
+
* happened in the cited trace — the human-readable companion to the `evidence`
|
|
454
|
+
* pointer. Example: "the agent called the summarize tool, received a 429,
|
|
455
|
+
* retried 3×, then returned empty output". REQUIRED going forward so the renderer can
|
|
456
|
+
* tell the operator WHAT happened, not just WHERE to look (`evidence`). The
|
|
457
|
+
* `evidence` field stays as the file:line / message-slice / code pointer.
|
|
458
|
+
*/
|
|
459
|
+
whatHappened: string;
|
|
460
|
+
/**
|
|
461
|
+
* F-EV1 (PR-055 proposed): OPTIONAL verbatim excerpt/quote from the trace body
|
|
462
|
+
* that illustrates `whatHappened`. Carries the raw illustrative quote only —
|
|
463
|
+
* the consumer (Block A/C) PII-sanitizes this before emit.
|
|
464
|
+
*/
|
|
465
|
+
example?: string;
|
|
466
|
+
confidence: "high" | "medium" | "low";
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// ── Assumption (R1.3 / Wave-5 — assumptions block) ────────────────────────────
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Wave-5 R1.3 (PR-030 Assumption Explicitness, structured form): a single
|
|
473
|
+
* assumption made during RCA, with an explicit verification status and the
|
|
474
|
+
* basis for that status. Replaces the old free-text `string[]` form so the
|
|
475
|
+
* renderer can emit verified / unverified / hypothesis-pending pills
|
|
476
|
+
* (gold-standard `.assumptions` block).
|
|
477
|
+
*
|
|
478
|
+
* - "verified" → confirmed against trace evidence or population stats
|
|
479
|
+
* - "unverified" → asserted but not directly confirmed (needs follow-up)
|
|
480
|
+
* - "hypothesis-pending" → a hypothesis whose confirmation requires a source we
|
|
481
|
+
* do not have access to yet (e.g. client code)
|
|
482
|
+
*/
|
|
483
|
+
export interface Assumption {
|
|
484
|
+
/** The assumption statement (objective, single sentence). */
|
|
485
|
+
text: string;
|
|
486
|
+
/** Verification status — drives the pill class in the renderer. */
|
|
487
|
+
status: "verified" | "unverified" | "hypothesis-pending";
|
|
488
|
+
/** Why the status holds: the evidence basis or the source still required. */
|
|
489
|
+
basis: string;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export interface WhyChainEntry {
|
|
493
|
+
why: string;
|
|
494
|
+
evidence: string;
|
|
495
|
+
/**
|
|
496
|
+
* F-EV1 (PR-055 proposed): plain-words narration of the event that actually
|
|
497
|
+
* happened at this why-chain step, in the cited trace. Human-readable companion
|
|
498
|
+
* to the `evidence` pointer (which stays as the file:line / message-slice
|
|
499
|
+
* pointer). REQUIRED going forward.
|
|
500
|
+
*/
|
|
501
|
+
whatHappened: string;
|
|
502
|
+
/**
|
|
503
|
+
* F-EV1 (PR-055 proposed): OPTIONAL verbatim excerpt/quote from the trace body
|
|
504
|
+
* illustrating `whatHappened`. Raw quote only — the consumer (Block A/C)
|
|
505
|
+
* PII-sanitizes before emit.
|
|
506
|
+
*/
|
|
507
|
+
example?: string;
|
|
508
|
+
/** True for the deepest/original failure origin */
|
|
509
|
+
isOrigin?: boolean;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* R-SELF-15-a (PR-023): Clipboard payloads = self-contained actionable plans.
|
|
514
|
+
* Every remedy that ships a clipboard payload MUST embed a plan so the
|
|
515
|
+
* operator can apply it without re-reading the trace.
|
|
516
|
+
*/
|
|
517
|
+
export interface ActionablePlan {
|
|
518
|
+
/** Files this remedy touches — NEW | EDIT | DELETE */
|
|
519
|
+
files: Array<{
|
|
520
|
+
path: string;
|
|
521
|
+
lineRange?: string;
|
|
522
|
+
action: "NEW" | "EDIT" | "DELETE";
|
|
523
|
+
}>;
|
|
524
|
+
/** Minimal before/after diff for the primary change */
|
|
525
|
+
diff?: { before: string; after: string };
|
|
526
|
+
/** Bash commands to run to verify the fix (e.g. bun run test) */
|
|
527
|
+
verify: string[];
|
|
528
|
+
/** Single sentence stating what must be true after apply for the remedy to be accepted */
|
|
529
|
+
acceptance: string;
|
|
530
|
+
/** Remedy IDs that must be applied before this one */
|
|
531
|
+
dependsOn?: string[];
|
|
532
|
+
/** Milestone tag (v0.2, v0.3, …) */
|
|
533
|
+
milestone?: string;
|
|
534
|
+
/** Suggested git commit message */
|
|
535
|
+
commitMessage?: string;
|
|
536
|
+
/** Free-form notes for the apply actor (ai-engineer + shared mutagent-cli apply) */
|
|
537
|
+
extraNotes?: string;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* W12-08 (PR-052 proposed): explicit marker for a remedy whose Before/After diff
|
|
542
|
+
* could NOT be authored because the source/origin is not findable. Honors
|
|
543
|
+
* `feedback_model_intent_sacred` — a remedy with no findable source MUST carry
|
|
544
|
+
* this marker rather than a fabricated/guessed diff.
|
|
545
|
+
*
|
|
546
|
+
* - "source-unavailable" -- the apply target exists but its current source is
|
|
547
|
+
* not accessible to the analyzer (e.g. client code the
|
|
548
|
+
* skill cannot read), so a Before/After cannot be cited.
|
|
549
|
+
* - "origin-unknown" -- the failure origin itself could not be pinned to a
|
|
550
|
+
* concrete source location; the remedy is a hypothesis.
|
|
551
|
+
*
|
|
552
|
+
* The renderer shows a labeled "source not found — hypothesis" caveat block in
|
|
553
|
+
* place of the Before/After grid when this is set. EXACTLY ONE of `diff` /
|
|
554
|
+
* `diffStatus` must be present on every remedy (enforced by findings-contract.ts).
|
|
555
|
+
*/
|
|
556
|
+
export type DiffStatus = "source-unavailable" | "origin-unknown";
|
|
557
|
+
|
|
558
|
+
export interface Remedy {
|
|
559
|
+
remedyId: string;
|
|
560
|
+
title: string;
|
|
561
|
+
failureOrigin: FailureOrigin;
|
|
562
|
+
/**
|
|
563
|
+
* W12-08 (PR-052 proposed): Before/After diff for the primary change.
|
|
564
|
+
* REQUIRED WHEN A SOURCE IS FINDABLE. When the source/origin is not findable,
|
|
565
|
+
* OMIT this and set `diffStatus` instead — NEVER fabricate a diff. The
|
|
566
|
+
* findings-contract validator enforces that exactly one of `diff` / `diffStatus`
|
|
567
|
+
* is present.
|
|
568
|
+
*/
|
|
569
|
+
diff?: { before: string; after: string };
|
|
570
|
+
/**
|
|
571
|
+
* W12-08 (PR-052 proposed): explicit absence marker, set IFF `diff` is omitted
|
|
572
|
+
* because the source/origin is not findable. See DiffStatus. Renderer shows a
|
|
573
|
+
* "source not found — hypothesis" caveat block instead of the Before/After grid.
|
|
574
|
+
*/
|
|
575
|
+
diffStatus?: DiffStatus;
|
|
576
|
+
/**
|
|
577
|
+
* W13-C (D-1): REQUIRED categorical — analyzer-emitted, contract-enforced at
|
|
578
|
+
* Step 7.1 (findings-contract.ts). Implementation/operational cost of the fix.
|
|
579
|
+
*/
|
|
580
|
+
cost: "low" | "medium" | "high";
|
|
581
|
+
/**
|
|
582
|
+
* W13-C (D-1): REQUIRED categorical — analyzer-emitted, contract-enforced at
|
|
583
|
+
* Step 7.1. Confidence the fix resolves the root cause.
|
|
584
|
+
*/
|
|
585
|
+
correctness: "low" | "medium" | "high";
|
|
586
|
+
/**
|
|
587
|
+
* Lower = higher priority.
|
|
588
|
+
* W13-C (D-1): enricher-DERIVED from `cost × correctness` (orchestrator-protocol
|
|
589
|
+
* §8 / scripts/enrich/rank-remedies.ts). NOT analyzer-supplied — the enricher
|
|
590
|
+
* always backfills it, so it can never reach the renderer undefined. Deterministic
|
|
591
|
+
* (no LLM judgment) → reproducible ranking.
|
|
592
|
+
*/
|
|
593
|
+
rank: number;
|
|
594
|
+
/**
|
|
595
|
+
* W12-08 (PR-052 proposed): REQUIRED — routing class for the apply target.
|
|
596
|
+
* local-agent | local-code-construct | remote. Pairs with applyTarget: the
|
|
597
|
+
* target says WHERE, the class says HOW the apply actor (ai-engineer) writes there.
|
|
598
|
+
*/
|
|
599
|
+
targetClass: string;
|
|
600
|
+
/**
|
|
601
|
+
* R-SELF-15-a: Self-contained actionable plan embedded in the clipboard payload.
|
|
602
|
+
* Renderer puts this in data-payload so the operator's copy-back markdown
|
|
603
|
+
* contains everything the apply actor (ai-engineer) needs to act without context re-read.
|
|
604
|
+
*/
|
|
605
|
+
plan?: ActionablePlan;
|
|
606
|
+
/**
|
|
607
|
+
* I-025 / W12-08 (PR-052 proposed): HARD-REQUIRED — file, module, or agent that
|
|
608
|
+
* this remedy patches. EVERY remedy MUST link to a target: a code location, or
|
|
609
|
+
* (per target platform) the agent prompt / agent definition. Drives the
|
|
610
|
+
* applyTarget pill in the renderer. Absent → rejected by findings-contract.ts.
|
|
611
|
+
* Examples: "scripts/tier0-scan.ts", ".claude/agents/search-agent.md:34"
|
|
612
|
+
*/
|
|
613
|
+
applyTarget: string;
|
|
614
|
+
|
|
615
|
+
// ── PRD-CC-01: Two-rationale + apply-instructions + changeType fields ──────
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* PRD-CC-01 (D1) / W12-08 (PR-052 proposed): REQUIRED — comparative rationale:
|
|
619
|
+
* WHY pick this remedy over alternatives. Purple block in the renderer
|
|
620
|
+
* ("Why this remedy"). Distinct from whyWorks (causal mechanism) per D1.
|
|
621
|
+
* Absent → rejected by findings-contract.ts.
|
|
622
|
+
*/
|
|
623
|
+
rationale: string;
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* PRD-CC-01 (D1) / W12-08 (PR-052 proposed): REQUIRED — causal mechanism:
|
|
627
|
+
* WHY the fix actually closes the failure (focus on the ORIGIN). Cyan block in
|
|
628
|
+
* the renderer ("Why this works"). Distinct from rationale (comparative) per D1.
|
|
629
|
+
* Absent → rejected by findings-contract.ts.
|
|
630
|
+
*/
|
|
631
|
+
whyWorks: string;
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* PRD-CC-01 (D4) / W12-08 (PR-052 proposed): REQUIRED (≥1) — ordered list of
|
|
635
|
+
* apply instructions (numbered steps). Rendered in the right column of the
|
|
636
|
+
* apply-grid. The apply actor executes these in order after the ActionablePlan.
|
|
637
|
+
* Empty/absent → rejected by findings-contract.ts.
|
|
638
|
+
*/
|
|
639
|
+
applyInstructions: string[];
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* PRD-CC-01: Type of change this remedy makes to the target file or construct.
|
|
643
|
+
* Drives the changeType pill in the renderer's meta strip.
|
|
644
|
+
* - 'add' -- new file, class, function, or config entry
|
|
645
|
+
* - 'modify' -- patch to existing code/config
|
|
646
|
+
* - 'delete' -- remove file, function, or config entry
|
|
647
|
+
* - 'replace' -- full rewrite of existing construct (supersedes modify when scope > 50%)
|
|
648
|
+
*/
|
|
649
|
+
changeType?: "add" | "modify" | "delete" | "replace";
|
|
650
|
+
|
|
651
|
+
// ── Wave-9 W9-F: Fix-feedback layer (PR-046 Layer 3) ─────────────────────
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* W9-F (PR-046 Layer 3): Accumulated fix-outcome records from post-apply test
|
|
655
|
+
* sessions. Each entry is appended after the remedy is applied and retested.
|
|
656
|
+
*
|
|
657
|
+
* Absent on new/unapplied remedies (backward-compatible). The renderer shows a
|
|
658
|
+
* per-remedy fix history when this array is non-empty.
|
|
659
|
+
*/
|
|
660
|
+
feedbackOnFix?: FeedbackOnFix[];
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
// ── PRD-CC-02: Structured feedback source ────────────────────────────────────
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* PRD-CC-02 (D5): One structured feedback entry grounding a finding.
|
|
667
|
+
* Three source types -- chat (operator messages), trace-score (Langfuse/OTel scores with
|
|
668
|
+
* comments), external (third-party feedback platform or issue tracker).
|
|
669
|
+
*
|
|
670
|
+
* Renderer color-codes by sourceType (cyan=chat, yellow=trace-score, purple=external).
|
|
671
|
+
* NO emojis on headers or source-type labels (D9).
|
|
672
|
+
*/
|
|
673
|
+
export interface FeedbackSource {
|
|
674
|
+
/**
|
|
675
|
+
* Where this feedback originated.
|
|
676
|
+
* - 'chat' -- operator chat session (Claude Code session transcript)
|
|
677
|
+
* - 'trace-score' -- Langfuse/OTel score with an attached comment
|
|
678
|
+
* - 'external' -- third-party issue tracker, Slack DM, PR review, etc.
|
|
679
|
+
*/
|
|
680
|
+
sourceType: "chat" | "trace-score" | "external";
|
|
681
|
+
/**
|
|
682
|
+
* Human-readable provenance label (shown in the renderer's fb-head).
|
|
683
|
+
* Examples: "Operator feedback (2026-06-02)", "Langfuse score: latency-eval", "GitHub Issue #42"
|
|
684
|
+
*/
|
|
685
|
+
provenance: string;
|
|
686
|
+
/** Verbatim body of the feedback -- displayed inside a <blockquote>. */
|
|
687
|
+
body: string;
|
|
688
|
+
/** ISO8601 timestamp when this feedback was captured (optional). */
|
|
689
|
+
capturedAt?: string;
|
|
690
|
+
/** Trace ID referenced by the feedback (for trace-score sources). */
|
|
691
|
+
traceId?: string;
|
|
692
|
+
/**
|
|
693
|
+
* Score information for trace-score sources.
|
|
694
|
+
* Only populated when sourceType === 'trace-score'.
|
|
695
|
+
*/
|
|
696
|
+
score?: {
|
|
697
|
+
name: string;
|
|
698
|
+
value: number;
|
|
699
|
+
scorerType?: string;
|
|
700
|
+
};
|
|
701
|
+
/**
|
|
702
|
+
* Name of the external platform for sourceType === 'external'.
|
|
703
|
+
* Examples: "GitHub Issues", "Slack", "Linear", "Jira"
|
|
704
|
+
*/
|
|
705
|
+
externalPlatform?: string;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
export interface Finding {
|
|
709
|
+
findingId: string;
|
|
710
|
+
/** Actionable summary (objective, evidence-grounded — not raw subjective feedback) */
|
|
711
|
+
actionable: string;
|
|
712
|
+
/**
|
|
713
|
+
* I-042: Raw subjective user feedback (operator notes, tester observations, verbal reports).
|
|
714
|
+
* Distinct from `actionable` (objective). Renderer shows "User Feedback" block IFF non-empty.
|
|
715
|
+
* Restores the User-Feedback (subjective) vs System-Feedback (objective) distinction
|
|
716
|
+
* that was dropped in the iter9-flat rewrite.
|
|
717
|
+
*
|
|
718
|
+
* LEGACY COMPAT (PRD-CC-02): When feedbackSources is absent, consumers SHOULD auto-promote
|
|
719
|
+
* this field to a single FeedbackSource entry:
|
|
720
|
+
* { sourceType: 'chat', provenance: 'legacy userFeedback field', body: userFeedback }
|
|
721
|
+
* The promotion logic belongs to CONSUMERS (renderer / enricher), not this type definition.
|
|
722
|
+
*/
|
|
723
|
+
userFeedback?: string;
|
|
724
|
+
/**
|
|
725
|
+
* I-023 / Wave-5 R1.3 (PR-030 Assumption Explicitness): Explicit assumptions
|
|
726
|
+
* made during RCA, in STRUCTURED form ({ text, status, basis }). Constraints,
|
|
727
|
+
* preconditions, or domain facts surfaced during RCA, each tagged with a
|
|
728
|
+
* verification status so the renderer can emit verified / unverified /
|
|
729
|
+
* hypothesis-pending pills (gold-standard `.assumptions` block).
|
|
730
|
+
*
|
|
731
|
+
* Must be enumerated before finalizing the finding (see rca.md §Assumption
|
|
732
|
+
* enumeration). The enricher (scripts/enrich/build-render-input.ts) converts
|
|
733
|
+
* legacy free-text `string[]` (with inline VERIFIED/UNVERIFIED/hypothesis-pending
|
|
734
|
+
* markers) into this structured form.
|
|
735
|
+
*
|
|
736
|
+
* W12-08 (PR-052 proposed): REQUIRED — every finding MUST enumerate ≥1 structured
|
|
737
|
+
* assumption before it is finalized. A finding with zero assumptions is rejected
|
|
738
|
+
* by findings-contract.ts. (Was optional pre-W12 for backward-compat.)
|
|
739
|
+
*/
|
|
740
|
+
assumptions: Assumption[];
|
|
741
|
+
/**
|
|
742
|
+
* Wave-5 R1.3 — gold-standard story-led display fields (all OPTIONAL; the
|
|
743
|
+
* enricher derives them, the renderer falls back gracefully when absent).
|
|
744
|
+
*/
|
|
745
|
+
/** Severity badge for the gold-standard finding head (CRIT / HIGH / MED / RULE-OUT / LOW). */
|
|
746
|
+
severity?: "crit" | "high" | "med" | "info";
|
|
747
|
+
/** Story-led h2 title (e.g. "The draft tool is the latency sink"). Falls back to actionable. */
|
|
748
|
+
title?: string;
|
|
749
|
+
/** One-line sub-description under the finding h2 (gold-standard `.sub`). */
|
|
750
|
+
subDesc?: string;
|
|
751
|
+
/** Worst-case callout shown in a `.crit` / `.warn` box at the top of the finding panel. */
|
|
752
|
+
worstCaseCallout?: string;
|
|
753
|
+
/** Apply-target label for the taxonomy strip (e.g. "code-change (client)", "prompt-update"). */
|
|
754
|
+
applyLabel?: string;
|
|
755
|
+
/**
|
|
756
|
+
* Wave-18 (W18-problem): REQUIRED descriptive problem statement — the PRIMARY block
|
|
757
|
+
* of every finding panel (always rendered, at the TOP, before Evidence / why-chain /
|
|
758
|
+
* remedies).
|
|
759
|
+
*
|
|
760
|
+
* Format: `<subject> <observed behavior, declarative> — <quantified impact + evidence>
|
|
761
|
+
* [— scope: N/total traces]`.
|
|
762
|
+
*
|
|
763
|
+
* Describes WHAT is wrong and HOW BAD it is — NOT what to do about it. It is a
|
|
764
|
+
* declarative description of observed behavior and its measured impact, grounded in
|
|
765
|
+
* evidence. The fix/recommendation lives ONLY in `remedies`; `problem` must never be
|
|
766
|
+
* phrased as a task or todo (e.g. NOT "Make X faster — use a smaller model" but rather
|
|
767
|
+
* "X takes 4.2s p95 — 3.1x the 1.4s session median — on 12/40 traces").
|
|
768
|
+
*
|
|
769
|
+
* Was OPTIONAL pre-W18 (renderer silently fell back to the action-biased `actionable`
|
|
770
|
+
* field, which is why reports rendered todos in the Problem slot). Now required so the
|
|
771
|
+
* descriptive statement is always present and the fallback can be killed.
|
|
772
|
+
*/
|
|
773
|
+
problem: string;
|
|
774
|
+
/** Evidence prose/HTML shown under the Evidence h3 (gold-standard `<h3>Evidence</h3> + p/table`). */
|
|
775
|
+
evidenceHtml?: string;
|
|
776
|
+
failureOrigin: FailureOrigin;
|
|
777
|
+
/** Recursive why-chain until failure origin */
|
|
778
|
+
whyChain: WhyChainEntry[];
|
|
779
|
+
remedies: Remedy[];
|
|
780
|
+
/** Source trace IDs that produced this finding */
|
|
781
|
+
sourceTraceIds: string[];
|
|
782
|
+
/** Reference IDs: trace.id → session.id → finding.id */
|
|
783
|
+
referenceIds: { traceId: string; sessionId: string; findingId: string };
|
|
784
|
+
/**
|
|
785
|
+
* Wave-4: Optional criterion result when diagnostics runs against a target
|
|
786
|
+
* that declares a self-diagnosis-contract.yaml (opt-in structured-report mode).
|
|
787
|
+
* Open-ended findings leave this undefined.
|
|
788
|
+
*/
|
|
789
|
+
criterion?: CriterionResult;
|
|
790
|
+
/**
|
|
791
|
+
* Wave-6 R2.5 — Sampling representativeness proof for THIS finding's evidence.
|
|
792
|
+
* The deterministic shape computed by scripts/sample/representative.ts
|
|
793
|
+
* (buildCoverageProof). Renders a per-finding `coverageConfidence` widget below
|
|
794
|
+
* the why-chain. WARN-only: a "low" level never blocks the report — it surfaces
|
|
795
|
+
* the caveat honestly (design philosophy §2.3). Optional (backward-compat).
|
|
796
|
+
*/
|
|
797
|
+
coverageProof?: FindingCoverageProof;
|
|
798
|
+
|
|
799
|
+
// ── PRD-CC-02: Structured feedback sources ────────────────────────────────
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* PRD-CC-02 (D5): Structured feedback sources grounding this finding.
|
|
803
|
+
* Displayed between Problem and Evidence in the renderer as a Feedback block.
|
|
804
|
+
* Each source is color-coded by sourceType (cyan=chat / yellow=trace-score / purple=external).
|
|
805
|
+
*
|
|
806
|
+
* When absent, consumers SHOULD check `userFeedback` for a legacy string and
|
|
807
|
+
* promote it to [{sourceType:'chat', provenance:'legacy userFeedback field', body: userFeedback}].
|
|
808
|
+
* The promotion logic lives in consumers (renderer/enricher), not here.
|
|
809
|
+
*/
|
|
810
|
+
feedbackSources?: FeedbackSource[];
|
|
811
|
+
|
|
812
|
+
// ── Wave-9 W9-F: Translated feedback layer (PR-046) ──────────────────────
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
* W9-F (PR-046 Layer 2): Translated-feedback entries for this finding — one per
|
|
816
|
+
* raw feedback excerpt that was mapped to a component-level RCA target.
|
|
817
|
+
*
|
|
818
|
+
* Absent when no feedback translation has been performed (backward-compatible).
|
|
819
|
+
* Rendered as a "Translated Feedback" block between feedbackSources and Evidence.
|
|
820
|
+
*/
|
|
821
|
+
translatedFeedback?: TranslatedFeedback[];
|
|
822
|
+
|
|
823
|
+
// ── PRD-SD-04: Audience tagging ───────────────────────────────────────────
|
|
824
|
+
/**
|
|
825
|
+
* PRD-SD-04 (PR-033): Audience classification for this finding.
|
|
826
|
+
* - 'PRODUCT' -- user-facing; the default for client diagnoses
|
|
827
|
+
* - 'META' -- internal-only; applies to skill self-diagnosis findings
|
|
828
|
+
* - 'CORE' -- schema/CLI/contract surface findings
|
|
829
|
+
*
|
|
830
|
+
* Self-diagnosis dispatcher force-sets 'META' on every finding (PRD-SD-04).
|
|
831
|
+
* For client diagnoses, the analyzer determines audience case-by-case.
|
|
832
|
+
*/
|
|
833
|
+
audience?: "PRODUCT" | "META" | "CORE";
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* Wave-6 R2.5 — render-facing mirror of scripts/sample/representative.ts CoverageProof.
|
|
838
|
+
* Defined here (not imported from sample/) so trace.ts stays dependency-light and the
|
|
839
|
+
* renderer can consume it via the Finding type. The sampler produces this shape;
|
|
840
|
+
* the renderer reads it. Numbers are deterministic (no clock/random).
|
|
841
|
+
*/
|
|
842
|
+
export interface FindingCoverageProof {
|
|
843
|
+
/** Per-finding confidence 0..100 (mean of the 4 dimension coveragePcts). */
|
|
844
|
+
coverageConfidence: number;
|
|
845
|
+
/** high (≥90) · medium (≥70) · low (else). */
|
|
846
|
+
level: "high" | "medium" | "low";
|
|
847
|
+
/** Per-dimension coverage rows (latency · score · temporal · tool-trajectory). */
|
|
848
|
+
dimensions: Array<{
|
|
849
|
+
dimension: "latency" | "score" | "temporal" | "tool-trajectory";
|
|
850
|
+
populationBuckets: number;
|
|
851
|
+
coveredBuckets: number;
|
|
852
|
+
coveragePct: number;
|
|
853
|
+
}>;
|
|
854
|
+
/** Population vs sample bias proof. */
|
|
855
|
+
population: {
|
|
856
|
+
populationSize: number;
|
|
857
|
+
sampleSize: number;
|
|
858
|
+
sampleFraction: number;
|
|
859
|
+
populationMeanBadness: number;
|
|
860
|
+
sampleMeanBadness: number;
|
|
861
|
+
};
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
// ── PRD-MP-05: RunMeta decision-logging ──────────────────────────────────────
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* PRD-MP-05 (PR-027): Append-only decision-logging fields for a diagnostic run.
|
|
868
|
+
* Every methodology decision is recorded here as an audit row.
|
|
869
|
+
* All fields are OPTIONAL for backward-compat with existing run-meta JSON files.
|
|
870
|
+
*
|
|
871
|
+
* NOTE: render.ts also defines a RunMeta interface (renderer-level, with signalCensus +
|
|
872
|
+
* mermaidTopology). This type in trace.ts is the CANONICAL definition for decision
|
|
873
|
+
* logging and is intended to be the shared base. Phase-2 agents (w8-render, w8-selfdiag)
|
|
874
|
+
* should extend or union this with render.ts RunMeta as needed.
|
|
875
|
+
*/
|
|
876
|
+
export interface RunMeta {
|
|
877
|
+
// ── Step 5b -- sampling override decision ───────────────────────────────
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* PRD-MP-05 / Step 5b: Records when the orchestrator switched from the slicer's
|
|
881
|
+
* window-based plan to a representative-sample approach because focus was set.
|
|
882
|
+
* from -- original sampling strategy (e.g. 'window-based')
|
|
883
|
+
* to -- overriding strategy (e.g. 'representative-sample')
|
|
884
|
+
* reason -- free-text explanation (e.g. 'focus=cost-loops')
|
|
885
|
+
*/
|
|
886
|
+
samplingOverride?: {
|
|
887
|
+
from: string;
|
|
888
|
+
to: string;
|
|
889
|
+
reason: string;
|
|
890
|
+
};
|
|
891
|
+
|
|
892
|
+
// ── Step 6 -- dispatch shape decision ───────────────────────────────────
|
|
893
|
+
|
|
894
|
+
/**
|
|
895
|
+
* PRD-MP-05 / Step 6: Records the single-shot vs fan-out analyzer dispatch decision.
|
|
896
|
+
* analyzerCount -- number of analyzer sub-agents dispatched (1..5)
|
|
897
|
+
* reason -- one-liner explaining which criterion fired (see protocol Step 6)
|
|
898
|
+
* slicesUsed -- slice IDs passed to each analyzer
|
|
899
|
+
*/
|
|
900
|
+
dispatch?: {
|
|
901
|
+
analyzerCount: number;
|
|
902
|
+
reason: string;
|
|
903
|
+
slicesUsed: string[];
|
|
904
|
+
};
|
|
905
|
+
|
|
906
|
+
// ── Step 7.1 -- redispatch tracking ─────────────────────────────────────
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* PRD-MP-05 / Step 7.1: Tracks redispatch events when a finding is missing
|
|
910
|
+
* required fields and the orchestrator issues a "RESEND with missing: X, Y, Z".
|
|
911
|
+
* Capped at 2 redispatches per finding (Q4 recommendation).
|
|
912
|
+
*/
|
|
913
|
+
redispatches?: Array<{
|
|
914
|
+
findingId: string;
|
|
915
|
+
missingFields: string[];
|
|
916
|
+
attemptCount: number;
|
|
917
|
+
}>;
|
|
918
|
+
|
|
919
|
+
// ── Step 8.9 -- wave-6 checklist exemptions ─────────────────────────────
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* PRD-MP-05 / Step 8.9: Records when a wave-6 checklist step was skipped under
|
|
923
|
+
* an approved exemption. Required when skipping; surfaced in the Methodology tab.
|
|
924
|
+
* stepId -- the checklist step that was skipped (e.g. 'awareness-sample')
|
|
925
|
+
* reason -- why it was skipped
|
|
926
|
+
* declaredBy -- who declared the exemption (e.g. 'orchestrator', 'operator')
|
|
927
|
+
*/
|
|
928
|
+
exemptions?: Array<{
|
|
929
|
+
stepId: string;
|
|
930
|
+
reason: string;
|
|
931
|
+
declaredBy: string;
|
|
932
|
+
}>;
|
|
933
|
+
|
|
934
|
+
// ── Step 11.0 -- apply skip ──────────────────────────────────────────────
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* PRD-MP-05 / Step 11.0 + PRD-SO-04: Populated when config.target.platform === 'report-only'.
|
|
938
|
+
* The apply-confirm AskUserQuestion is skipped; the run halts after Step 10 HITL review.
|
|
939
|
+
* reason -- why apply was skipped (e.g. 'config target = report-only')
|
|
940
|
+
*/
|
|
941
|
+
applySkipped?: {
|
|
942
|
+
reason: string;
|
|
943
|
+
};
|
|
944
|
+
|
|
945
|
+
// ── General decision log ─────────────────────────────────────────────────
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* PRD-MP-05 (PR-027, PR-043): General append-only decision log.
|
|
949
|
+
* Every methodology decision that does not fit a typed field above is recorded here.
|
|
950
|
+
* step -- enum key for grep-ability (Q17 recommendation):
|
|
951
|
+
* '5b-override' | '6-dispatch' | '7.1-redispatch' | '8.9-exemption' | '11.0-skip'
|
|
952
|
+
* choice -- what was decided
|
|
953
|
+
* rationale -- why this choice was made
|
|
954
|
+
* timestamp -- ISO8601 when the decision was made
|
|
955
|
+
*/
|
|
956
|
+
decisions?: Array<{
|
|
957
|
+
step:
|
|
958
|
+
| "5b-override"
|
|
959
|
+
| "6-dispatch"
|
|
960
|
+
| "7.1-redispatch"
|
|
961
|
+
| "8.9-exemption"
|
|
962
|
+
| "11.0-skip";
|
|
963
|
+
choice: string;
|
|
964
|
+
rationale: string;
|
|
965
|
+
timestamp: string;
|
|
966
|
+
}>;
|
|
967
|
+
|
|
968
|
+
// ── Wave-9 W9-09: Trace-Hungry escalation telemetry (PR-048) ─────────────
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* W9-09 (PR-048): Deep-read escalation record.
|
|
972
|
+
* Populated at the end of the tiered-escalation loop (orchestrator Step 6).
|
|
973
|
+
* Surfaced in the report header bigStat row (tier reached · tier0 scanned ·
|
|
974
|
+
* llmReadCount · coverageConfidence · stopReason).
|
|
975
|
+
*
|
|
976
|
+
* Optional/backward-compatible: absent in runs predating Wave-9.
|
|
977
|
+
*/
|
|
978
|
+
deepRead?: {
|
|
979
|
+
/** Total traces in scope when the escalation loop ran. */
|
|
980
|
+
population: number;
|
|
981
|
+
/** The highest tier actually reached (read count, not the rung label). */
|
|
982
|
+
tierReached: 100 | 250 | 500 | 1000 | number;
|
|
983
|
+
/** Cumulative traces LLM-read across all batches. */
|
|
984
|
+
llmReadCount: number;
|
|
985
|
+
/** Overall coverage confidence after the final batch. */
|
|
986
|
+
coverageConfidence: "high" | "medium" | "low";
|
|
987
|
+
/** Why the escalation loop terminated. */
|
|
988
|
+
stopReason: "evidence-sufficient" | "ceiling-reached" | "time-budget";
|
|
989
|
+
/** Per-batch escalation records (one entry per rung reached). */
|
|
990
|
+
batches: Array<{
|
|
991
|
+
/** The tier/rung read up to (e.g. 50, 100, 250, 500, 1000). */
|
|
992
|
+
tier: number;
|
|
993
|
+
/** Count of distinct new failureOrigin.what categories surfaced in this batch. */
|
|
994
|
+
newFailureCategories: number;
|
|
995
|
+
/** Coverage confidence after this batch. */
|
|
996
|
+
coverageConfidence: string;
|
|
997
|
+
}>;
|
|
998
|
+
};
|
|
999
|
+
|
|
1000
|
+
// ── F-S7: local-jsonl dropped-line surface (PR-055 proposed) ─────────────
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* F-S7 (PR-055 proposed): partial-load accounting per source. Records when a
|
|
1004
|
+
* source could not be fully ingested — e.g. the local-jsonl loader skipped
|
|
1005
|
+
* malformed NDJSON lines that failed JSON.parse. Surfacing dropped lines lets
|
|
1006
|
+
* the report caveat coverage honestly instead of silently undercounting.
|
|
1007
|
+
*
|
|
1008
|
+
* One entry per affected source. Optional/backward-compatible: absent when no
|
|
1009
|
+
* lines were dropped. Schema only — Block A populates it.
|
|
1010
|
+
* source -- provenance label (e.g. 'local-jsonl: traces.ndjson')
|
|
1011
|
+
* droppedLineCount -- total NDJSON lines dropped for this source
|
|
1012
|
+
* droppedSamples -- first-N raw bad lines (verbatim), for operator triage
|
|
1013
|
+
*/
|
|
1014
|
+
partial_loads?: Array<{
|
|
1015
|
+
source: string;
|
|
1016
|
+
droppedLineCount: number;
|
|
1017
|
+
droppedSamples: string[];
|
|
1018
|
+
}>;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
// ── Score-scale types (iter-8) ────────────────────────────────────────────────
|
|
1022
|
+
|
|
1023
|
+
export interface ScaleProbeResult {
|
|
1024
|
+
scaleType: ScaleType;
|
|
1025
|
+
min: number;
|
|
1026
|
+
max: number;
|
|
1027
|
+
distinctValues?: number[];
|
|
1028
|
+
/** For categorical: list of known category strings */
|
|
1029
|
+
categories?: string[];
|
|
1030
|
+
/** Computed "negative" threshold for the given scale */
|
|
1031
|
+
negativeThreshold?: number | string;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
// ── I-013 note ────────────────────────────────────────────────────────────────
|
|
1035
|
+
// TraceFilter.skill_agent_scope is in scripts/config/schema.ts (TraceFilterSchema),
|
|
1036
|
+
// NOT here. trace.ts stays plain TypeScript interfaces — no TypeBox, no runtime schemas.
|
|
1037
|
+
|
|
1038
|
+
// ── Wave-4: Contract-aware types (opt-in structured-report mode) ──────────────
|
|
1039
|
+
|
|
1040
|
+
/**
|
|
1041
|
+
* 10-category Hybrid set — operator-locked 2026-05-31.
|
|
1042
|
+
* MUST match the categories declared in self-diagnosis-contract.v0.1.0.yaml.tpl.
|
|
1043
|
+
*/
|
|
1044
|
+
export type SuccessCriteriaCategory =
|
|
1045
|
+
| "operational"
|
|
1046
|
+
| "onboarding"
|
|
1047
|
+
| "behavioral"
|
|
1048
|
+
| "hitl"
|
|
1049
|
+
| "output"
|
|
1050
|
+
| "methodology"
|
|
1051
|
+
| "tier-performance"
|
|
1052
|
+
| "source-platform"
|
|
1053
|
+
| "target-platform"
|
|
1054
|
+
| "maintenance";
|
|
1055
|
+
|
|
1056
|
+
/**
|
|
1057
|
+
* Per-criterion result when diagnostics runs against a target that declares
|
|
1058
|
+
* a self-diagnosis-contract.yaml. Open-ended path does NOT populate this.
|
|
1059
|
+
*/
|
|
1060
|
+
export interface CriterionResult {
|
|
1061
|
+
category: SuccessCriteriaCategory;
|
|
1062
|
+
id: string;
|
|
1063
|
+
statement: string;
|
|
1064
|
+
status: "pass" | "fail" | "not-applicable" | "pending";
|
|
1065
|
+
evidenceRef?: {
|
|
1066
|
+
kind: "trace" | "commit" | "cmd-output" | "file:line" | "screenshot";
|
|
1067
|
+
value: string;
|
|
1068
|
+
};
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
/**
|
|
1072
|
+
* Extension marker for the opt-in structured-report mode.
|
|
1073
|
+
* The `criterion` optional field on Finding is the runtime surface.
|
|
1074
|
+
* Targets that do not declare a self-diagnosis-contract.yaml never populate it.
|
|
1075
|
+
*/
|
|
1076
|
+
export interface ContractAwareFinding {
|
|
1077
|
+
criterion?: CriterionResult;
|
|
1078
|
+
}
|