@agentic-sdlc-kit/contracts 0.0.0-stage → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +42 -2
- package/dist/agent/capability.d.ts +9 -0
- package/dist/agent/capability.d.ts.map +1 -0
- package/dist/agent/capability.js +31 -0
- package/dist/agent/capability.js.map +1 -0
- package/dist/agent/errors.d.ts +30 -0
- package/dist/agent/errors.d.ts.map +1 -0
- package/dist/agent/errors.js +62 -0
- package/dist/agent/errors.js.map +1 -0
- package/dist/agent/events.d.ts +222 -0
- package/dist/agent/events.d.ts.map +1 -0
- package/dist/agent/events.js +92 -0
- package/dist/agent/events.js.map +1 -0
- package/dist/agent/execution.d.ts +553 -0
- package/dist/agent/execution.d.ts.map +1 -0
- package/dist/agent/execution.js +229 -0
- package/dist/agent/execution.js.map +1 -0
- package/dist/agent/index.d.ts +8 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +19 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/policy.d.ts +135 -0
- package/dist/agent/policy.d.ts.map +1 -0
- package/dist/agent/policy.js +78 -0
- package/dist/agent/policy.js.map +1 -0
- package/dist/agent/provider.d.ts +82 -0
- package/dist/agent/provider.d.ts.map +1 -0
- package/dist/agent/provider.js +33 -0
- package/dist/agent/provider.js.map +1 -0
- package/dist/agent/session.d.ts +17 -0
- package/dist/agent/session.d.ts.map +1 -0
- package/dist/agent/session.js +23 -0
- package/dist/agent/session.js.map +1 -0
- package/dist/application/application-context.d.ts +512 -0
- package/dist/application/application-context.d.ts.map +1 -0
- package/dist/application/application-context.js +42 -0
- package/dist/application/application-context.js.map +1 -0
- package/dist/application/application-persistence.d.ts +846 -0
- package/dist/application/application-persistence.d.ts.map +1 -0
- package/dist/application/application-persistence.js +37 -0
- package/dist/application/application-persistence.js.map +1 -0
- package/dist/application/application-state.d.ts +89 -0
- package/dist/application/application-state.d.ts.map +1 -0
- package/dist/application/application-state.js +66 -0
- package/dist/application/application-state.js.map +1 -0
- package/dist/application/application-transitions.d.ts +23 -0
- package/dist/application/application-transitions.d.ts.map +1 -0
- package/dist/application/application-transitions.js +60 -0
- package/dist/application/application-transitions.js.map +1 -0
- package/dist/application/index.d.ts +5 -0
- package/dist/application/index.d.ts.map +1 -0
- package/dist/application/index.js +6 -0
- package/dist/application/index.js.map +1 -0
- package/dist/architecture/api-contract.d.ts +259 -0
- package/dist/architecture/api-contract.d.ts.map +1 -0
- package/dist/architecture/api-contract.js +43 -0
- package/dist/architecture/api-contract.js.map +1 -0
- package/dist/architecture/architecture-approval.d.ts +40 -0
- package/dist/architecture/architecture-approval.d.ts.map +1 -0
- package/dist/architecture/architecture-approval.js +24 -0
- package/dist/architecture/architecture-approval.js.map +1 -0
- package/dist/architecture/architecture-options.d.ts +103 -0
- package/dist/architecture/architecture-options.d.ts.map +1 -0
- package/dist/architecture/architecture-options.js +35 -0
- package/dist/architecture/architecture-options.js.map +1 -0
- package/dist/architecture/component-map.d.ts +76 -0
- package/dist/architecture/component-map.d.ts.map +1 -0
- package/dist/architecture/component-map.js +28 -0
- package/dist/architecture/component-map.js.map +1 -0
- package/dist/architecture/data-model.d.ts +252 -0
- package/dist/architecture/data-model.d.ts.map +1 -0
- package/dist/architecture/data-model.js +53 -0
- package/dist/architecture/data-model.js.map +1 -0
- package/dist/architecture/index.d.ts +8 -0
- package/dist/architecture/index.d.ts.map +1 -0
- package/dist/architecture/index.js +9 -0
- package/dist/architecture/index.js.map +1 -0
- package/dist/architecture/operational-design.d.ts +134 -0
- package/dist/architecture/operational-design.d.ts.map +1 -0
- package/dist/architecture/operational-design.js +46 -0
- package/dist/architecture/operational-design.js.map +1 -0
- package/dist/architecture/security-design.d.ts +107 -0
- package/dist/architecture/security-design.d.ts.map +1 -0
- package/dist/architecture/security-design.js +40 -0
- package/dist/architecture/security-design.js.map +1 -0
- package/dist/common/errors.d.ts +40 -0
- package/dist/common/errors.d.ts.map +1 -0
- package/dist/common/errors.js +45 -0
- package/dist/common/errors.js.map +1 -0
- package/dist/common/identifier.d.ts +12 -0
- package/dist/common/identifier.d.ts.map +1 -0
- package/dist/common/identifier.js +21 -0
- package/dist/common/identifier.js.map +1 -0
- package/dist/common/index.d.ts +4 -0
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/index.js +5 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/result.d.ts +28 -0
- package/dist/common/result.d.ts.map +1 -0
- package/dist/common/result.js +33 -0
- package/dist/common/result.js.map +1 -0
- package/dist/evaluation/benchmark.d.ts +88 -0
- package/dist/evaluation/benchmark.d.ts.map +1 -0
- package/dist/evaluation/benchmark.js +34 -0
- package/dist/evaluation/benchmark.js.map +1 -0
- package/dist/evaluation/index.d.ts +3 -0
- package/dist/evaluation/index.d.ts.map +1 -0
- package/dist/evaluation/index.js +4 -0
- package/dist/evaluation/index.js.map +1 -0
- package/dist/evaluation/metrics.d.ts +164 -0
- package/dist/evaluation/metrics.d.ts.map +1 -0
- package/dist/evaluation/metrics.js +64 -0
- package/dist/evaluation/metrics.js.map +1 -0
- package/dist/evolution/experiment.d.ts +85 -0
- package/dist/evolution/experiment.d.ts.map +1 -0
- package/dist/evolution/experiment.js +52 -0
- package/dist/evolution/experiment.js.map +1 -0
- package/dist/evolution/improvement-hypothesis.d.ts +98 -0
- package/dist/evolution/improvement-hypothesis.d.ts.map +1 -0
- package/dist/evolution/improvement-hypothesis.js +59 -0
- package/dist/evolution/improvement-hypothesis.js.map +1 -0
- package/dist/evolution/index.d.ts +3 -0
- package/dist/evolution/index.d.ts.map +1 -0
- package/dist/evolution/index.js +4 -0
- package/dist/evolution/index.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/installer/index.d.ts +4 -0
- package/dist/installer/index.d.ts.map +1 -0
- package/dist/installer/index.js +5 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/installer/install-plan.d.ts +168 -0
- package/dist/installer/install-plan.d.ts.map +1 -0
- package/dist/installer/install-plan.js +40 -0
- package/dist/installer/install-plan.js.map +1 -0
- package/dist/installer/ownership-manifest.d.ts +78 -0
- package/dist/installer/ownership-manifest.d.ts.map +1 -0
- package/dist/installer/ownership-manifest.js +30 -0
- package/dist/installer/ownership-manifest.js.map +1 -0
- package/dist/installer/package-manifest.d.ts +55 -0
- package/dist/installer/package-manifest.d.ts.map +1 -0
- package/dist/installer/package-manifest.js +46 -0
- package/dist/installer/package-manifest.js.map +1 -0
- package/dist/learning/engineering-lesson.d.ts +84 -0
- package/dist/learning/engineering-lesson.d.ts.map +1 -0
- package/dist/learning/engineering-lesson.js +47 -0
- package/dist/learning/engineering-lesson.js.map +1 -0
- package/dist/learning/engineering-memory.d.ts +66 -0
- package/dist/learning/engineering-memory.d.ts.map +1 -0
- package/dist/learning/engineering-memory.js +44 -0
- package/dist/learning/engineering-memory.js.map +1 -0
- package/dist/learning/experience-episode.d.ts +176 -0
- package/dist/learning/experience-episode.d.ts.map +1 -0
- package/dist/learning/experience-episode.js +68 -0
- package/dist/learning/experience-episode.js.map +1 -0
- package/dist/learning/experience.d.ts +68 -0
- package/dist/learning/experience.d.ts.map +1 -0
- package/dist/learning/experience.js +22 -0
- package/dist/learning/experience.js.map +1 -0
- package/dist/learning/hypothesis.d.ts +57 -0
- package/dist/learning/hypothesis.d.ts.map +1 -0
- package/dist/learning/hypothesis.js +27 -0
- package/dist/learning/hypothesis.js.map +1 -0
- package/dist/learning/index.d.ts +8 -0
- package/dist/learning/index.d.ts.map +1 -0
- package/dist/learning/index.js +9 -0
- package/dist/learning/index.js.map +1 -0
- package/dist/learning/memory.d.ts +42 -0
- package/dist/learning/memory.d.ts.map +1 -0
- package/dist/learning/memory.js +20 -0
- package/dist/learning/memory.js.map +1 -0
- package/dist/learning/promotion.d.ts +31 -0
- package/dist/learning/promotion.d.ts.map +1 -0
- package/dist/learning/promotion.js +16 -0
- package/dist/learning/promotion.js.map +1 -0
- package/dist/maintenance/bug-fix-workflow.d.ts +57 -0
- package/dist/maintenance/bug-fix-workflow.d.ts.map +1 -0
- package/dist/maintenance/bug-fix-workflow.js +100 -0
- package/dist/maintenance/bug-fix-workflow.js.map +1 -0
- package/dist/maintenance/bug-report.d.ts +62 -0
- package/dist/maintenance/bug-report.d.ts.map +1 -0
- package/dist/maintenance/bug-report.js +49 -0
- package/dist/maintenance/bug-report.js.map +1 -0
- package/dist/maintenance/index.d.ts +6 -0
- package/dist/maintenance/index.d.ts.map +1 -0
- package/dist/maintenance/index.js +7 -0
- package/dist/maintenance/index.js.map +1 -0
- package/dist/maintenance/performance-baseline.d.ts +80 -0
- package/dist/maintenance/performance-baseline.d.ts.map +1 -0
- package/dist/maintenance/performance-baseline.js +32 -0
- package/dist/maintenance/performance-baseline.js.map +1 -0
- package/dist/maintenance/refactor-contract.d.ts +158 -0
- package/dist/maintenance/refactor-contract.d.ts.map +1 -0
- package/dist/maintenance/refactor-contract.js +65 -0
- package/dist/maintenance/refactor-contract.js.map +1 -0
- package/dist/maintenance/refactor-workflow.d.ts +79 -0
- package/dist/maintenance/refactor-workflow.d.ts.map +1 -0
- package/dist/maintenance/refactor-workflow.js +100 -0
- package/dist/maintenance/refactor-workflow.js.map +1 -0
- package/dist/observer/event-schema.d.ts +49 -0
- package/dist/observer/event-schema.d.ts.map +1 -0
- package/dist/observer/event-schema.js +48 -0
- package/dist/observer/event-schema.js.map +1 -0
- package/dist/observer/index.d.ts +5 -0
- package/dist/observer/index.d.ts.map +1 -0
- package/dist/observer/index.js +6 -0
- package/dist/observer/index.js.map +1 -0
- package/dist/observer/journal.d.ts +83 -0
- package/dist/observer/journal.d.ts.map +1 -0
- package/dist/observer/journal.js +76 -0
- package/dist/observer/journal.js.map +1 -0
- package/dist/observer/retention.d.ts +25 -0
- package/dist/observer/retention.d.ts.map +1 -0
- package/dist/observer/retention.js +21 -0
- package/dist/observer/retention.js.map +1 -0
- package/dist/observer/run-summary.d.ts +260 -0
- package/dist/observer/run-summary.d.ts.map +1 -0
- package/dist/observer/run-summary.js +32 -0
- package/dist/observer/run-summary.js.map +1 -0
- package/dist/patterns/index.d.ts +2 -0
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/patterns/index.js +3 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/patterns/pattern.d.ts +106 -0
- package/dist/patterns/pattern.d.ts.map +1 -0
- package/dist/patterns/pattern.js +69 -0
- package/dist/patterns/pattern.js.map +1 -0
- package/dist/planning/index.d.ts +2 -0
- package/dist/planning/index.d.ts.map +1 -0
- package/dist/planning/index.js +3 -0
- package/dist/planning/index.js.map +1 -0
- package/dist/planning/task.d.ts +178 -0
- package/dist/planning/task.d.ts.map +1 -0
- package/dist/planning/task.js +35 -0
- package/dist/planning/task.js.map +1 -0
- package/dist/policy/index.d.ts +2 -0
- package/dist/policy/index.d.ts.map +1 -0
- package/dist/policy/index.js +3 -0
- package/dist/policy/index.js.map +1 -0
- package/dist/policy/policy.d.ts +83 -0
- package/dist/policy/policy.d.ts.map +1 -0
- package/dist/policy/policy.js +57 -0
- package/dist/policy/policy.js.map +1 -0
- package/dist/product/index.d.ts +5 -0
- package/dist/product/index.d.ts.map +1 -0
- package/dist/product/index.js +6 -0
- package/dist/product/index.js.map +1 -0
- package/dist/product/mvp-scope.d.ts +25 -0
- package/dist/product/mvp-scope.d.ts.map +1 -0
- package/dist/product/mvp-scope.js +18 -0
- package/dist/product/mvp-scope.js.map +1 -0
- package/dist/product/product-brief.d.ts +94 -0
- package/dist/product/product-brief.d.ts.map +1 -0
- package/dist/product/product-brief.js +44 -0
- package/dist/product/product-brief.js.map +1 -0
- package/dist/product/requirements.d.ts +251 -0
- package/dist/product/requirements.d.ts.map +1 -0
- package/dist/product/requirements.js +50 -0
- package/dist/product/requirements.js.map +1 -0
- package/dist/product/traceability.d.ts +50 -0
- package/dist/product/traceability.d.ts.map +1 -0
- package/dist/product/traceability.js +20 -0
- package/dist/product/traceability.js.map +1 -0
- package/dist/project/index.d.ts +3 -0
- package/dist/project/index.d.ts.map +1 -0
- package/dist/project/index.js +4 -0
- package/dist/project/index.js.map +1 -0
- package/dist/project/project-profile.d.ts +79 -0
- package/dist/project/project-profile.d.ts.map +1 -0
- package/dist/project/project-profile.js +53 -0
- package/dist/project/project-profile.js.map +1 -0
- package/dist/project/repository-scan.d.ts +82 -0
- package/dist/project/repository-scan.d.ts.map +1 -0
- package/dist/project/repository-scan.js +29 -0
- package/dist/project/repository-scan.js.map +1 -0
- package/dist/routing/capability-registry.d.ts +87 -0
- package/dist/routing/capability-registry.d.ts.map +1 -0
- package/dist/routing/capability-registry.js +26 -0
- package/dist/routing/capability-registry.js.map +1 -0
- package/dist/routing/escalation.d.ts +25 -0
- package/dist/routing/escalation.d.ts.map +1 -0
- package/dist/routing/escalation.js +21 -0
- package/dist/routing/escalation.js.map +1 -0
- package/dist/routing/index.d.ts +5 -0
- package/dist/routing/index.d.ts.map +1 -0
- package/dist/routing/index.js +6 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/routing/routing-policy.d.ts +103 -0
- package/dist/routing/routing-policy.d.ts.map +1 -0
- package/dist/routing/routing-policy.js +32 -0
- package/dist/routing/routing-policy.js.map +1 -0
- package/dist/routing/routing-request.d.ts +63 -0
- package/dist/routing/routing-request.d.ts.map +1 -0
- package/dist/routing/routing-request.js +46 -0
- package/dist/routing/routing-request.js.map +1 -0
- package/dist/runtime-guard/action-classification.d.ts +54 -0
- package/dist/runtime-guard/action-classification.d.ts.map +1 -0
- package/dist/runtime-guard/action-classification.js +90 -0
- package/dist/runtime-guard/action-classification.js.map +1 -0
- package/dist/runtime-guard/audit-event.d.ts +98 -0
- package/dist/runtime-guard/audit-event.d.ts.map +1 -0
- package/dist/runtime-guard/audit-event.js +45 -0
- package/dist/runtime-guard/audit-event.js.map +1 -0
- package/dist/runtime-guard/index.d.ts +4 -0
- package/dist/runtime-guard/index.d.ts.map +1 -0
- package/dist/runtime-guard/index.js +5 -0
- package/dist/runtime-guard/index.js.map +1 -0
- package/dist/runtime-guard/policy-schema.d.ts +139 -0
- package/dist/runtime-guard/policy-schema.d.ts.map +1 -0
- package/dist/runtime-guard/policy-schema.js +50 -0
- package/dist/runtime-guard/policy-schema.js.map +1 -0
- package/dist/scaffolding/index.d.ts +3 -0
- package/dist/scaffolding/index.d.ts.map +1 -0
- package/dist/scaffolding/index.js +4 -0
- package/dist/scaffolding/index.js.map +1 -0
- package/dist/scaffolding/scaffold-contract.d.ts +528 -0
- package/dist/scaffolding/scaffold-contract.d.ts.map +1 -0
- package/dist/scaffolding/scaffold-contract.js +50 -0
- package/dist/scaffolding/scaffold-contract.js.map +1 -0
- package/dist/scaffolding/template-manifest.d.ts +105 -0
- package/dist/scaffolding/template-manifest.d.ts.map +1 -0
- package/dist/scaffolding/template-manifest.js +44 -0
- package/dist/scaffolding/template-manifest.js.map +1 -0
- package/dist/secret-guard/detection-rule.d.ts +33 -0
- package/dist/secret-guard/detection-rule.d.ts.map +1 -0
- package/dist/secret-guard/detection-rule.js +109 -0
- package/dist/secret-guard/detection-rule.js.map +1 -0
- package/dist/secret-guard/finding.d.ts +89 -0
- package/dist/secret-guard/finding.d.ts.map +1 -0
- package/dist/secret-guard/finding.js +85 -0
- package/dist/secret-guard/finding.js.map +1 -0
- package/dist/secret-guard/index.d.ts +5 -0
- package/dist/secret-guard/index.d.ts.map +1 -0
- package/dist/secret-guard/index.js +6 -0
- package/dist/secret-guard/index.js.map +1 -0
- package/dist/secret-guard/redaction-policy.d.ts +26 -0
- package/dist/secret-guard/redaction-policy.d.ts.map +1 -0
- package/dist/secret-guard/redaction-policy.js +30 -0
- package/dist/secret-guard/redaction-policy.js.map +1 -0
- package/dist/secret-guard/scanner-failure.d.ts +59 -0
- package/dist/secret-guard/scanner-failure.d.ts.map +1 -0
- package/dist/secret-guard/scanner-failure.js +40 -0
- package/dist/secret-guard/scanner-failure.js.map +1 -0
- package/dist/specification/index.d.ts +2 -0
- package/dist/specification/index.d.ts.map +1 -0
- package/dist/specification/index.js +3 -0
- package/dist/specification/index.js.map +1 -0
- package/dist/specification/specification.d.ts +229 -0
- package/dist/specification/specification.d.ts.map +1 -0
- package/dist/specification/specification.js +67 -0
- package/dist/specification/specification.js.map +1 -0
- package/dist/stack-pack/index.d.ts +2 -0
- package/dist/stack-pack/index.d.ts.map +1 -0
- package/dist/stack-pack/index.js +3 -0
- package/dist/stack-pack/index.js.map +1 -0
- package/dist/stack-pack/manifest.d.ts +88 -0
- package/dist/stack-pack/manifest.d.ts.map +1 -0
- package/dist/stack-pack/manifest.js +51 -0
- package/dist/stack-pack/manifest.js.map +1 -0
- package/dist/verification/index.d.ts +2 -0
- package/dist/verification/index.d.ts.map +1 -0
- package/dist/verification/index.js +3 -0
- package/dist/verification/index.js.map +1 -0
- package/dist/verification/report.d.ts +95 -0
- package/dist/verification/report.d.ts.map +1 -0
- package/dist/verification/report.js +57 -0
- package/dist/verification/report.js.map +1 -0
- package/dist/workflow/index.d.ts +3 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +4 -0
- package/dist/workflow/index.js.map +1 -0
- package/dist/workflow/next-action.d.ts +130 -0
- package/dist/workflow/next-action.d.ts.map +1 -0
- package/dist/workflow/next-action.js +92 -0
- package/dist/workflow/next-action.js.map +1 -0
- package/dist/workflow/workflow.d.ts +68 -0
- package/dist/workflow/workflow.d.ts.map +1 -0
- package/dist/workflow/workflow.js +33 -0
- package/dist/workflow/workflow.js.map +1 -0
- package/package.json +31 -3
- package/src/agent/agent.test.ts +451 -0
- package/src/agent/capability.ts +35 -0
- package/src/agent/errors.ts +69 -0
- package/src/agent/events.ts +107 -0
- package/src/agent/execution.ts +275 -0
- package/src/agent/index.ts +19 -0
- package/src/agent/policy.ts +82 -0
- package/src/agent/provider.ts +124 -0
- package/src/agent/session.ts +29 -0
- package/src/application/application-context.ts +47 -0
- package/src/application/application-persistence.ts +44 -0
- package/src/application/application-state.test.ts +107 -0
- package/src/application/application-state.ts +81 -0
- package/src/application/application-transitions.ts +71 -0
- package/src/application/index.ts +5 -0
- package/src/architecture/api-contract.ts +56 -0
- package/src/architecture/architecture-approval.ts +27 -0
- package/src/architecture/architecture-options.ts +42 -0
- package/src/architecture/architecture.test.ts +263 -0
- package/src/architecture/component-map.ts +35 -0
- package/src/architecture/data-model.ts +66 -0
- package/src/architecture/index.ts +8 -0
- package/src/architecture/operational-design.ts +55 -0
- package/src/architecture/security-design.ts +47 -0
- package/src/common/errors.test.ts +46 -0
- package/src/common/errors.ts +114 -0
- package/src/common/identifier.test.ts +51 -0
- package/src/common/identifier.ts +33 -0
- package/src/common/index.ts +4 -0
- package/src/common/result.test.ts +52 -0
- package/src/common/result.ts +50 -0
- package/src/evaluation/benchmark.ts +42 -0
- package/src/evaluation/index.ts +3 -0
- package/src/evaluation/metrics.ts +76 -0
- package/src/evolution/experiment.ts +61 -0
- package/src/evolution/improvement-hypothesis.ts +67 -0
- package/src/evolution/index.ts +3 -0
- package/src/index.test.ts +54 -0
- package/src/index.ts +53 -0
- package/src/installer/index.ts +4 -0
- package/src/installer/install-plan.ts +49 -0
- package/src/installer/ownership-manifest.ts +36 -0
- package/src/installer/package-manifest.ts +54 -0
- package/src/learning/engineering-lesson.ts +55 -0
- package/src/learning/engineering-memory.ts +51 -0
- package/src/learning/experience-episode.ts +76 -0
- package/src/learning/experience.ts +27 -0
- package/src/learning/hypothesis.ts +33 -0
- package/src/learning/index.ts +8 -0
- package/src/learning/memory.ts +25 -0
- package/src/learning/promotion.ts +19 -0
- package/src/maintenance/bug-fix-workflow.ts +119 -0
- package/src/maintenance/bug-report.ts +58 -0
- package/src/maintenance/index.ts +6 -0
- package/src/maintenance/maintenance.test.ts +219 -0
- package/src/maintenance/performance-baseline.ts +35 -0
- package/src/maintenance/refactor-contract.ts +77 -0
- package/src/maintenance/refactor-workflow.ts +121 -0
- package/src/observer/event-schema.ts +54 -0
- package/src/observer/index.ts +5 -0
- package/src/observer/journal.test.ts +73 -0
- package/src/observer/journal.ts +84 -0
- package/src/observer/retention.ts +24 -0
- package/src/observer/run-summary.ts +37 -0
- package/src/patterns/index.ts +2 -0
- package/src/patterns/pattern.ts +80 -0
- package/src/planning/index.ts +2 -0
- package/src/planning/task.ts +47 -0
- package/src/policy/index.ts +2 -0
- package/src/policy/policy.test.ts +50 -0
- package/src/policy/policy.ts +67 -0
- package/src/product/index.ts +5 -0
- package/src/product/mvp-scope.ts +21 -0
- package/src/product/product-brief.test.ts +108 -0
- package/src/product/product-brief.ts +53 -0
- package/src/product/requirements.ts +59 -0
- package/src/product/traceability.ts +25 -0
- package/src/project/index.ts +3 -0
- package/src/project/project-profile.test.ts +98 -0
- package/src/project/project-profile.ts +65 -0
- package/src/project/repository-scan.ts +34 -0
- package/src/routing/capability-registry.ts +31 -0
- package/src/routing/escalation.ts +24 -0
- package/src/routing/index.ts +5 -0
- package/src/routing/routing-policy.ts +38 -0
- package/src/routing/routing-request.ts +55 -0
- package/src/runtime-guard/action-classification.ts +99 -0
- package/src/runtime-guard/audit-event.ts +49 -0
- package/src/runtime-guard/index.ts +4 -0
- package/src/runtime-guard/policy-schema.ts +56 -0
- package/src/runtime-guard/runtime-guard.test.ts +147 -0
- package/src/scaffolding/index.ts +3 -0
- package/src/scaffolding/scaffold-contract.test.ts +107 -0
- package/src/scaffolding/scaffold-contract.ts +63 -0
- package/src/scaffolding/template-manifest.ts +52 -0
- package/src/secret-guard/detection-rule.ts +115 -0
- package/src/secret-guard/finding.ts +93 -0
- package/src/secret-guard/index.ts +5 -0
- package/src/secret-guard/redaction-policy.ts +34 -0
- package/src/secret-guard/scanner-failure.ts +47 -0
- package/src/secret-guard/secret-guard.test.ts +130 -0
- package/src/specification/index.ts +2 -0
- package/src/specification/specification.ts +79 -0
- package/src/stack-pack/index.ts +2 -0
- package/src/stack-pack/manifest.ts +60 -0
- package/src/verification/index.ts +2 -0
- package/src/verification/report.test.ts +91 -0
- package/src/verification/report.ts +62 -0
- package/src/workflow/index.ts +3 -0
- package/src/workflow/next-action.test.ts +101 -0
- package/src/workflow/next-action.ts +101 -0
- package/src/workflow/workflow.ts +49 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// packages/contracts/src/project/project-profile.ts
|
|
2
|
+
//
|
|
3
|
+
// ProjectProfile: the versioned per-repository configuration contract.
|
|
4
|
+
//
|
|
5
|
+
// Commands are argument arrays, never shell strings. The M6 executor runs
|
|
6
|
+
// them with shell: false. A string command is a contract violation.
|
|
7
|
+
//
|
|
8
|
+
// See docs/contracts/CONTRACTS.md §2 and ADR-0008.
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
/**
|
|
11
|
+
* Schema version for the ProjectProfile contract. Bumped on breaking
|
|
12
|
+
// changes; requires an ADR and a migration function in
|
|
13
|
+
// core/artifacts/migrations/.
|
|
14
|
+
*/
|
|
15
|
+
export const PROJECT_PROFILE_SCHEMA_VERSION = 1;
|
|
16
|
+
/**
|
|
17
|
+
* A single command is an array of arguments. The executor MUST run with
|
|
18
|
+
* shell: false. Empty arrays are rejected.
|
|
19
|
+
*/
|
|
20
|
+
export const CommandSchema = z
|
|
21
|
+
.array(z.string().min(1))
|
|
22
|
+
.min(1, 'command must be a non-empty array of arguments');
|
|
23
|
+
export const CommandsMapSchema = z
|
|
24
|
+
.object({
|
|
25
|
+
test: z.array(CommandSchema).optional(),
|
|
26
|
+
lint: z.array(CommandSchema).optional(),
|
|
27
|
+
typecheck: z.array(CommandSchema).optional(),
|
|
28
|
+
build: z.array(CommandSchema).optional(),
|
|
29
|
+
})
|
|
30
|
+
.strict();
|
|
31
|
+
export const ProjectProfileSchema = z
|
|
32
|
+
.object({
|
|
33
|
+
schemaVersion: z.literal(PROJECT_PROFILE_SCHEMA_VERSION),
|
|
34
|
+
name: z.string().min(1).max(128, 'name must be 1-128 chars'),
|
|
35
|
+
stack: z
|
|
36
|
+
.array(z
|
|
37
|
+
.string()
|
|
38
|
+
.min(1)
|
|
39
|
+
.max(64)
|
|
40
|
+
.regex(/^[a-z][a-z0-9-]*$/, 'stack entry must be lowercase kebab-case'))
|
|
41
|
+
.min(1, 'stack must contain at least one entry'),
|
|
42
|
+
commands: CommandsMapSchema,
|
|
43
|
+
})
|
|
44
|
+
.strict();
|
|
45
|
+
/**
|
|
46
|
+
* Convenience constructor: builds a profile and validates it. Throws
|
|
47
|
+
* (programmer error) if invalid — production callers should use the schema
|
|
48
|
+
* directly and surface a PROFILE_INVALID Result.
|
|
49
|
+
*/
|
|
50
|
+
export function makeProfile(input) {
|
|
51
|
+
return ProjectProfileSchema.parse({ ...input, schemaVersion: PROJECT_PROFILE_SCHEMA_VERSION });
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=project-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-profile.js","sourceRoot":"","sources":["../../src/project/project-profile.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,EAAE;AACF,uEAAuE;AACvE,EAAE;AACF,0EAA0E;AAC1E,oEAAoE;AACpE,EAAE;AACF,mDAAmD;AAEnD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAU,CAAC;AAEzD;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC3B,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KACxB,GAAG,CAAC,CAAC,EAAE,gDAAgD,CAAC,CAAC;AAE5D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE;IACvC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE;IACvC,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE;IAC5C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE;CACzC,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,MAAM,CAAC;IACN,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,8BAA8B,CAAC;IACxD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,0BAA0B,CAAC;IAC5D,KAAK,EAAE,CAAC;SACL,KAAK,CACJ,CAAC;SACE,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,CAAC;SACP,KAAK,CAAC,mBAAmB,EAAE,0CAA0C,CAAC,CAC1E;SACA,GAAG,CAAC,CAAC,EAAE,uCAAuC,CAAC;IAClD,QAAQ,EAAE,iBAAiB;CAC5B,CAAC;KACD,MAAM,EAAE,CAAC;AAOZ;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,KAA4C;IACtE,OAAO,oBAAoB,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,aAAa,EAAE,8BAA8B,EAAE,CAAC,CAAC;AACjG,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const GitStateSchema: z.ZodObject<{
|
|
3
|
+
/** Whether the scanned root is inside a git work tree at all. */
|
|
4
|
+
isRepo: z.ZodBoolean;
|
|
5
|
+
/** Branch name; empty string when isRepo is false. */
|
|
6
|
+
branch: z.ZodString;
|
|
7
|
+
dirty: z.ZodBoolean;
|
|
8
|
+
/** HEAD commit SHA-1 (40 hex chars); empty string when isRepo is false. */
|
|
9
|
+
headSha: z.ZodString;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
dirty: boolean;
|
|
12
|
+
isRepo: boolean;
|
|
13
|
+
branch: string;
|
|
14
|
+
headSha: string;
|
|
15
|
+
}, {
|
|
16
|
+
dirty: boolean;
|
|
17
|
+
isRepo: boolean;
|
|
18
|
+
branch: string;
|
|
19
|
+
headSha: string;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const RepositoryScanSchema: z.ZodObject<{
|
|
22
|
+
root: z.ZodString;
|
|
23
|
+
detectedStacks: z.ZodArray<z.ZodString, "many">;
|
|
24
|
+
packageManagers: z.ZodArray<z.ZodString, "many">;
|
|
25
|
+
entryPoints: z.ZodArray<z.ZodString, "many">;
|
|
26
|
+
testFrameworks: z.ZodArray<z.ZodString, "many">;
|
|
27
|
+
hasMigrations: z.ZodBoolean;
|
|
28
|
+
hasCi: z.ZodBoolean;
|
|
29
|
+
agentInstructionFiles: z.ZodArray<z.ZodString, "many">;
|
|
30
|
+
git: z.ZodObject<{
|
|
31
|
+
/** Whether the scanned root is inside a git work tree at all. */
|
|
32
|
+
isRepo: z.ZodBoolean;
|
|
33
|
+
/** Branch name; empty string when isRepo is false. */
|
|
34
|
+
branch: z.ZodString;
|
|
35
|
+
dirty: z.ZodBoolean;
|
|
36
|
+
/** HEAD commit SHA-1 (40 hex chars); empty string when isRepo is false. */
|
|
37
|
+
headSha: z.ZodString;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
dirty: boolean;
|
|
40
|
+
isRepo: boolean;
|
|
41
|
+
branch: string;
|
|
42
|
+
headSha: string;
|
|
43
|
+
}, {
|
|
44
|
+
dirty: boolean;
|
|
45
|
+
isRepo: boolean;
|
|
46
|
+
branch: string;
|
|
47
|
+
headSha: string;
|
|
48
|
+
}>;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
root: string;
|
|
51
|
+
detectedStacks: string[];
|
|
52
|
+
packageManagers: string[];
|
|
53
|
+
entryPoints: string[];
|
|
54
|
+
testFrameworks: string[];
|
|
55
|
+
hasMigrations: boolean;
|
|
56
|
+
hasCi: boolean;
|
|
57
|
+
agentInstructionFiles: string[];
|
|
58
|
+
git: {
|
|
59
|
+
dirty: boolean;
|
|
60
|
+
isRepo: boolean;
|
|
61
|
+
branch: string;
|
|
62
|
+
headSha: string;
|
|
63
|
+
};
|
|
64
|
+
}, {
|
|
65
|
+
root: string;
|
|
66
|
+
detectedStacks: string[];
|
|
67
|
+
packageManagers: string[];
|
|
68
|
+
entryPoints: string[];
|
|
69
|
+
testFrameworks: string[];
|
|
70
|
+
hasMigrations: boolean;
|
|
71
|
+
hasCi: boolean;
|
|
72
|
+
agentInstructionFiles: string[];
|
|
73
|
+
git: {
|
|
74
|
+
dirty: boolean;
|
|
75
|
+
isRepo: boolean;
|
|
76
|
+
branch: string;
|
|
77
|
+
headSha: string;
|
|
78
|
+
};
|
|
79
|
+
}>;
|
|
80
|
+
export type RepositoryScan = z.infer<typeof RepositoryScanSchema>;
|
|
81
|
+
export type GitState = z.infer<typeof GitStateSchema>;
|
|
82
|
+
//# sourceMappingURL=repository-scan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-scan.d.ts","sourceRoot":"","sources":["../../src/project/repository-scan.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc;IACzB,iEAAiE;;IAEjE,sDAAsD;;;IAGtD,2EAA2E;;;;;;;;;;;;EAE3E,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;QAT/B,iEAAiE;;QAEjE,sDAAsD;;;QAGtD,2EAA2E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc3E,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// packages/contracts/src/project/repository-scan.ts
|
|
2
|
+
//
|
|
3
|
+
// RepositoryScan: the read-only output of inspecting a target repository.
|
|
4
|
+
// Declared in M1; produced by core.discovery in M2.
|
|
5
|
+
//
|
|
6
|
+
// Scanning is read-only. The scanner MUST NOT execute any discovered
|
|
7
|
+
// script. See docs/security/SECURITY.md §1 and ADR-0009.
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
export const GitStateSchema = z.object({
|
|
10
|
+
/** Whether the scanned root is inside a git work tree at all. */
|
|
11
|
+
isRepo: z.boolean(),
|
|
12
|
+
/** Branch name; empty string when isRepo is false. */
|
|
13
|
+
branch: z.string(),
|
|
14
|
+
dirty: z.boolean(),
|
|
15
|
+
/** HEAD commit SHA-1 (40 hex chars); empty string when isRepo is false. */
|
|
16
|
+
headSha: z.string().regex(/^([0-9a-f]{40})?$/, 'headSha must be a 40-char SHA-1 or empty'),
|
|
17
|
+
});
|
|
18
|
+
export const RepositoryScanSchema = z.object({
|
|
19
|
+
root: z.string().min(1),
|
|
20
|
+
detectedStacks: z.array(z.string()),
|
|
21
|
+
packageManagers: z.array(z.string()),
|
|
22
|
+
entryPoints: z.array(z.string()),
|
|
23
|
+
testFrameworks: z.array(z.string()),
|
|
24
|
+
hasMigrations: z.boolean(),
|
|
25
|
+
hasCi: z.boolean(),
|
|
26
|
+
agentInstructionFiles: z.array(z.string()),
|
|
27
|
+
git: GitStateSchema,
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=repository-scan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-scan.js","sourceRoot":"","sources":["../../src/project/repository-scan.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,EAAE;AACF,0EAA0E;AAC1E,oDAAoD;AACpD,EAAE;AACF,qEAAqE;AACrE,yDAAyD;AAEzD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,iEAAiE;IACjE,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,sDAAsD;IACtD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE;IAClB,2EAA2E;IAC3E,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mBAAmB,EAAE,0CAA0C,CAAC;CAC3F,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACnC,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACpC,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAChC,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACnC,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE;IAC1B,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE;IAClB,qBAAqB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1C,GAAG,EAAE,cAAc;CACpB,CAAC,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ModelCapabilitiesSchema: z.ZodObject<{
|
|
3
|
+
model: z.ZodString;
|
|
4
|
+
provider: z.ZodString;
|
|
5
|
+
maxContextTokens: z.ZodNumber;
|
|
6
|
+
supportedEfforts: z.ZodArray<z.ZodEnum<["low", "medium", "high"]>, "many">;
|
|
7
|
+
capabilities: z.ZodArray<z.ZodString, "many">;
|
|
8
|
+
relativeCostPer1MIn: z.ZodNumber;
|
|
9
|
+
relativeCostPer1MOut: z.ZodNumber;
|
|
10
|
+
supportsSubagents: z.ZodDefault<z.ZodBoolean>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
model: string;
|
|
13
|
+
provider: string;
|
|
14
|
+
maxContextTokens: number;
|
|
15
|
+
supportedEfforts: ("low" | "medium" | "high")[];
|
|
16
|
+
capabilities: string[];
|
|
17
|
+
relativeCostPer1MIn: number;
|
|
18
|
+
relativeCostPer1MOut: number;
|
|
19
|
+
supportsSubagents: boolean;
|
|
20
|
+
}, {
|
|
21
|
+
model: string;
|
|
22
|
+
provider: string;
|
|
23
|
+
maxContextTokens: number;
|
|
24
|
+
supportedEfforts: ("low" | "medium" | "high")[];
|
|
25
|
+
capabilities: string[];
|
|
26
|
+
relativeCostPer1MIn: number;
|
|
27
|
+
relativeCostPer1MOut: number;
|
|
28
|
+
supportsSubagents?: boolean | undefined;
|
|
29
|
+
}>;
|
|
30
|
+
export declare const ModelCapabilityRegistrySchema: z.ZodObject<{
|
|
31
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
32
|
+
models: z.ZodArray<z.ZodObject<{
|
|
33
|
+
model: z.ZodString;
|
|
34
|
+
provider: z.ZodString;
|
|
35
|
+
maxContextTokens: z.ZodNumber;
|
|
36
|
+
supportedEfforts: z.ZodArray<z.ZodEnum<["low", "medium", "high"]>, "many">;
|
|
37
|
+
capabilities: z.ZodArray<z.ZodString, "many">;
|
|
38
|
+
relativeCostPer1MIn: z.ZodNumber;
|
|
39
|
+
relativeCostPer1MOut: z.ZodNumber;
|
|
40
|
+
supportsSubagents: z.ZodDefault<z.ZodBoolean>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
model: string;
|
|
43
|
+
provider: string;
|
|
44
|
+
maxContextTokens: number;
|
|
45
|
+
supportedEfforts: ("low" | "medium" | "high")[];
|
|
46
|
+
capabilities: string[];
|
|
47
|
+
relativeCostPer1MIn: number;
|
|
48
|
+
relativeCostPer1MOut: number;
|
|
49
|
+
supportsSubagents: boolean;
|
|
50
|
+
}, {
|
|
51
|
+
model: string;
|
|
52
|
+
provider: string;
|
|
53
|
+
maxContextTokens: number;
|
|
54
|
+
supportedEfforts: ("low" | "medium" | "high")[];
|
|
55
|
+
capabilities: string[];
|
|
56
|
+
relativeCostPer1MIn: number;
|
|
57
|
+
relativeCostPer1MOut: number;
|
|
58
|
+
supportsSubagents?: boolean | undefined;
|
|
59
|
+
}>, "many">;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
schemaVersion: 1;
|
|
62
|
+
models: {
|
|
63
|
+
model: string;
|
|
64
|
+
provider: string;
|
|
65
|
+
maxContextTokens: number;
|
|
66
|
+
supportedEfforts: ("low" | "medium" | "high")[];
|
|
67
|
+
capabilities: string[];
|
|
68
|
+
relativeCostPer1MIn: number;
|
|
69
|
+
relativeCostPer1MOut: number;
|
|
70
|
+
supportsSubagents: boolean;
|
|
71
|
+
}[];
|
|
72
|
+
}, {
|
|
73
|
+
schemaVersion: 1;
|
|
74
|
+
models: {
|
|
75
|
+
model: string;
|
|
76
|
+
provider: string;
|
|
77
|
+
maxContextTokens: number;
|
|
78
|
+
supportedEfforts: ("low" | "medium" | "high")[];
|
|
79
|
+
capabilities: string[];
|
|
80
|
+
relativeCostPer1MIn: number;
|
|
81
|
+
relativeCostPer1MOut: number;
|
|
82
|
+
supportsSubagents?: boolean | undefined;
|
|
83
|
+
}[];
|
|
84
|
+
}>;
|
|
85
|
+
export type ModelCapabilities = z.infer<typeof ModelCapabilitiesSchema>;
|
|
86
|
+
export type ModelCapabilityRegistry = z.infer<typeof ModelCapabilityRegistrySchema>;
|
|
87
|
+
//# sourceMappingURL=capability-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability-registry.d.ts","sourceRoot":"","sources":["../../src/routing/capability-registry.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAelC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGxC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// packages/contracts/src/routing/capability-registry.ts
|
|
2
|
+
//
|
|
3
|
+
// M12 model capability registry (M12-02). Declares what each model can do
|
|
4
|
+
// so the router can match required capabilities to available models.
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
export const ModelCapabilitiesSchema = z.object({
|
|
7
|
+
model: z.string().min(1),
|
|
8
|
+
// Provider: anthropic, openai, etc.
|
|
9
|
+
provider: z.string().min(1),
|
|
10
|
+
// Max context window in tokens.
|
|
11
|
+
maxContextTokens: z.number().int().positive(),
|
|
12
|
+
// Supported effort levels.
|
|
13
|
+
supportedEfforts: z.array(z.enum(['low', 'medium', 'high'])),
|
|
14
|
+
// Capabilities (e.g., ["code-edit", "tool-use", "vision", "long-context"]).
|
|
15
|
+
capabilities: z.array(z.string()),
|
|
16
|
+
// Rough relative cost per 1M input tokens (illustrative; not authoritative).
|
|
17
|
+
relativeCostPer1MIn: z.number().positive(),
|
|
18
|
+
relativeCostPer1MOut: z.number().positive(),
|
|
19
|
+
// Whether this model supports subagent spawning.
|
|
20
|
+
supportsSubagents: z.boolean().default(true),
|
|
21
|
+
});
|
|
22
|
+
export const ModelCapabilityRegistrySchema = z.object({
|
|
23
|
+
schemaVersion: z.literal(1),
|
|
24
|
+
models: z.array(ModelCapabilitiesSchema),
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=capability-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability-registry.js","sourceRoot":"","sources":["../../src/routing/capability-registry.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,0EAA0E;AAC1E,qEAAqE;AAErE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,oCAAoC;IACpC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,gCAAgC;IAChC,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC7C,2BAA2B;IAC3B,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5D,4EAA4E;IAC5E,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjC,6EAA6E;IAC7E,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1C,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3C,iDAAiD;IACjD,iBAAiB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;CAC7C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC;CACzC,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const EscalationRuleSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
trigger: z.ZodEnum<["failed-verification", "failed-review"]>;
|
|
5
|
+
maxRetries: z.ZodNumber;
|
|
6
|
+
retryEffort: z.ZodEnum<["low", "medium", "high"]>;
|
|
7
|
+
switchToStrongerModel: z.ZodDefault<z.ZodBoolean>;
|
|
8
|
+
escalateToHuman: z.ZodDefault<z.ZodBoolean>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
id: string;
|
|
11
|
+
trigger: "failed-verification" | "failed-review";
|
|
12
|
+
maxRetries: number;
|
|
13
|
+
retryEffort: "low" | "medium" | "high";
|
|
14
|
+
switchToStrongerModel: boolean;
|
|
15
|
+
escalateToHuman: boolean;
|
|
16
|
+
}, {
|
|
17
|
+
id: string;
|
|
18
|
+
trigger: "failed-verification" | "failed-review";
|
|
19
|
+
maxRetries: number;
|
|
20
|
+
retryEffort: "low" | "medium" | "high";
|
|
21
|
+
switchToStrongerModel?: boolean | undefined;
|
|
22
|
+
escalateToHuman?: boolean | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export type EscalationRule = z.infer<typeof EscalationRuleSchema>;
|
|
25
|
+
//# sourceMappingURL=escalation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escalation.d.ts","sourceRoot":"","sources":["../../src/routing/escalation.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;EAY/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// packages/contracts/src/routing/escalation.ts
|
|
2
|
+
//
|
|
3
|
+
// M12 escalation policy (M12-10). When verification fails, the router
|
|
4
|
+
// decides whether to retry with a stronger model/effort or escalate to
|
|
5
|
+
// human review.
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { EffortSchema } from './routing-request.js';
|
|
8
|
+
export const EscalationRuleSchema = z.object({
|
|
9
|
+
id: z.string(),
|
|
10
|
+
// The failure outcome that triggers this rule.
|
|
11
|
+
trigger: z.enum(['failed-verification', 'failed-review']),
|
|
12
|
+
// The maximum number of retries before escalating to human review.
|
|
13
|
+
maxRetries: z.number().int().min(0).max(5),
|
|
14
|
+
// The effort to use on retry (typically higher than the original).
|
|
15
|
+
retryEffort: EffortSchema,
|
|
16
|
+
// Whether to switch to a stronger model on retry.
|
|
17
|
+
switchToStrongerModel: z.boolean().default(false),
|
|
18
|
+
// After maxRetries, escalate to human review.
|
|
19
|
+
escalateToHuman: z.boolean().default(true),
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=escalation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escalation.js","sourceRoot":"","sources":["../../src/routing/escalation.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,EAAE;AACF,sEAAsE;AACtE,uEAAuE;AACvE,gBAAgB;AAEhB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,+CAA+C;IAC/C,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,qBAAqB,EAAE,eAAe,CAAC,CAAC;IACzD,mEAAmE;IACnE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1C,mEAAmE;IACnE,WAAW,EAAE,YAAY;IACzB,kDAAkD;IAClD,qBAAqB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACjD,8CAA8C;IAC9C,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;CAC3C,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routing/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/routing/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ROUTING_POLICY_SCHEMA_VERSION: 1;
|
|
3
|
+
export declare const RoutingRuleSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
taskType: z.ZodUnion<[z.ZodString, z.ZodLiteral<"*">]>;
|
|
6
|
+
complexity: z.ZodUnion<[z.ZodEnum<["low", "medium", "high"]>, z.ZodLiteral<"*">]>;
|
|
7
|
+
risk: z.ZodUnion<[z.ZodEnum<["low", "medium", "high", "critical"]>, z.ZodLiteral<"*">]>;
|
|
8
|
+
model: z.ZodString;
|
|
9
|
+
effort: z.ZodEnum<["low", "medium", "high"]>;
|
|
10
|
+
verification: z.ZodEnum<["none", "structural", "tests", "independent-review", "mandatory-security"]>;
|
|
11
|
+
reason: z.ZodString;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
id: string;
|
|
14
|
+
verification: "none" | "structural" | "tests" | "independent-review" | "mandatory-security";
|
|
15
|
+
risk: "low" | "medium" | "high" | "critical" | "*";
|
|
16
|
+
reason: string;
|
|
17
|
+
model: string;
|
|
18
|
+
taskType: string;
|
|
19
|
+
complexity: "low" | "medium" | "high" | "*";
|
|
20
|
+
effort: "low" | "medium" | "high";
|
|
21
|
+
}, {
|
|
22
|
+
id: string;
|
|
23
|
+
verification: "none" | "structural" | "tests" | "independent-review" | "mandatory-security";
|
|
24
|
+
risk: "low" | "medium" | "high" | "critical" | "*";
|
|
25
|
+
reason: string;
|
|
26
|
+
model: string;
|
|
27
|
+
taskType: string;
|
|
28
|
+
complexity: "low" | "medium" | "high" | "*";
|
|
29
|
+
effort: "low" | "medium" | "high";
|
|
30
|
+
}>;
|
|
31
|
+
export declare const RoutingPolicySchema: z.ZodObject<{
|
|
32
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
33
|
+
id: z.ZodString;
|
|
34
|
+
version: z.ZodString;
|
|
35
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
36
|
+
id: z.ZodString;
|
|
37
|
+
taskType: z.ZodUnion<[z.ZodString, z.ZodLiteral<"*">]>;
|
|
38
|
+
complexity: z.ZodUnion<[z.ZodEnum<["low", "medium", "high"]>, z.ZodLiteral<"*">]>;
|
|
39
|
+
risk: z.ZodUnion<[z.ZodEnum<["low", "medium", "high", "critical"]>, z.ZodLiteral<"*">]>;
|
|
40
|
+
model: z.ZodString;
|
|
41
|
+
effort: z.ZodEnum<["low", "medium", "high"]>;
|
|
42
|
+
verification: z.ZodEnum<["none", "structural", "tests", "independent-review", "mandatory-security"]>;
|
|
43
|
+
reason: z.ZodString;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
id: string;
|
|
46
|
+
verification: "none" | "structural" | "tests" | "independent-review" | "mandatory-security";
|
|
47
|
+
risk: "low" | "medium" | "high" | "critical" | "*";
|
|
48
|
+
reason: string;
|
|
49
|
+
model: string;
|
|
50
|
+
taskType: string;
|
|
51
|
+
complexity: "low" | "medium" | "high" | "*";
|
|
52
|
+
effort: "low" | "medium" | "high";
|
|
53
|
+
}, {
|
|
54
|
+
id: string;
|
|
55
|
+
verification: "none" | "structural" | "tests" | "independent-review" | "mandatory-security";
|
|
56
|
+
risk: "low" | "medium" | "high" | "critical" | "*";
|
|
57
|
+
reason: string;
|
|
58
|
+
model: string;
|
|
59
|
+
taskType: string;
|
|
60
|
+
complexity: "low" | "medium" | "high" | "*";
|
|
61
|
+
effort: "low" | "medium" | "high";
|
|
62
|
+
}>, "many">;
|
|
63
|
+
defaultModel: z.ZodString;
|
|
64
|
+
defaultEffort: z.ZodEnum<["low", "medium", "high"]>;
|
|
65
|
+
suggestOnly: z.ZodDefault<z.ZodBoolean>;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
schemaVersion: 1;
|
|
68
|
+
id: string;
|
|
69
|
+
version: string;
|
|
70
|
+
rules: {
|
|
71
|
+
id: string;
|
|
72
|
+
verification: "none" | "structural" | "tests" | "independent-review" | "mandatory-security";
|
|
73
|
+
risk: "low" | "medium" | "high" | "critical" | "*";
|
|
74
|
+
reason: string;
|
|
75
|
+
model: string;
|
|
76
|
+
taskType: string;
|
|
77
|
+
complexity: "low" | "medium" | "high" | "*";
|
|
78
|
+
effort: "low" | "medium" | "high";
|
|
79
|
+
}[];
|
|
80
|
+
defaultModel: string;
|
|
81
|
+
defaultEffort: "low" | "medium" | "high";
|
|
82
|
+
suggestOnly: boolean;
|
|
83
|
+
}, {
|
|
84
|
+
schemaVersion: 1;
|
|
85
|
+
id: string;
|
|
86
|
+
version: string;
|
|
87
|
+
rules: {
|
|
88
|
+
id: string;
|
|
89
|
+
verification: "none" | "structural" | "tests" | "independent-review" | "mandatory-security";
|
|
90
|
+
risk: "low" | "medium" | "high" | "critical" | "*";
|
|
91
|
+
reason: string;
|
|
92
|
+
model: string;
|
|
93
|
+
taskType: string;
|
|
94
|
+
complexity: "low" | "medium" | "high" | "*";
|
|
95
|
+
effort: "low" | "medium" | "high";
|
|
96
|
+
}[];
|
|
97
|
+
defaultModel: string;
|
|
98
|
+
defaultEffort: "low" | "medium" | "high";
|
|
99
|
+
suggestOnly?: boolean | undefined;
|
|
100
|
+
}>;
|
|
101
|
+
export type RoutingRule = z.infer<typeof RoutingRuleSchema>;
|
|
102
|
+
export type RoutingPolicy = z.infer<typeof RoutingPolicySchema>;
|
|
103
|
+
//# sourceMappingURL=routing-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routing-policy.d.ts","sourceRoot":"","sources":["../../src/routing/routing-policy.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,6BAA6B,EAAG,CAAU,CAAC;AAExD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU9B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// packages/contracts/src/routing/routing-policy.ts
|
|
2
|
+
//
|
|
3
|
+
// M12 routing policy (M12-03). A static, deterministic policy that maps
|
|
4
|
+
// (taskType, complexity, risk) → (model, effort, verification).
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ComplexitySchema, RoutingRiskSchema, EffortSchema } from './routing-request.js';
|
|
7
|
+
export const ROUTING_POLICY_SCHEMA_VERSION = 1;
|
|
8
|
+
export const RoutingRuleSchema = z.object({
|
|
9
|
+
id: z.string(),
|
|
10
|
+
// Matchers; "*" matches any.
|
|
11
|
+
taskType: z.union([z.string(), z.literal('*')]),
|
|
12
|
+
complexity: z.union([ComplexitySchema, z.literal('*')]),
|
|
13
|
+
risk: z.union([RoutingRiskSchema, z.literal('*')]),
|
|
14
|
+
// The model to select (or "auto" to let the registry pick by capability).
|
|
15
|
+
model: z.string().min(1),
|
|
16
|
+
effort: EffortSchema,
|
|
17
|
+
// Required verification for this class of task.
|
|
18
|
+
verification: z.enum(['none', 'structural', 'tests', 'independent-review', 'mandatory-security']),
|
|
19
|
+
reason: z.string().min(1),
|
|
20
|
+
});
|
|
21
|
+
export const RoutingPolicySchema = z.object({
|
|
22
|
+
schemaVersion: z.literal(ROUTING_POLICY_SCHEMA_VERSION),
|
|
23
|
+
id: z.string(),
|
|
24
|
+
version: z.string().regex(/^\d+\.\d+\.\d+$/, 'semver'),
|
|
25
|
+
rules: z.array(RoutingRuleSchema),
|
|
26
|
+
// Default model when no rule matches.
|
|
27
|
+
defaultModel: z.string().min(1),
|
|
28
|
+
defaultEffort: EffortSchema,
|
|
29
|
+
// Whether the router starts in suggest-only mode (per post-M7 §6).
|
|
30
|
+
suggestOnly: z.boolean().default(true),
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=routing-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routing-policy.js","sourceRoot":"","sources":["../../src/routing/routing-policy.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,EAAE;AACF,wEAAwE;AACxE,gEAAgE;AAEhE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAU,CAAC;AAExD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,6BAA6B;IAC7B,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/C,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IACvD,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IAClD,0EAA0E;IAC1E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,MAAM,EAAE,YAAY;IACpB,gDAAgD;IAChD,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;IACjG,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC1B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,6BAA6B,CAAC;IACvD,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,iBAAiB,EAAE,QAAQ,CAAC;IACtD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;IACjC,sCAAsC;IACtC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B,aAAa,EAAE,YAAY;IAC3B,mEAAmE;IACnE,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;CACvC,CAAC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ComplexitySchema: z.ZodEnum<["low", "medium", "high"]>;
|
|
3
|
+
export declare const RoutingRiskSchema: z.ZodEnum<["low", "medium", "high", "critical"]>;
|
|
4
|
+
export declare const EffortSchema: z.ZodEnum<["low", "medium", "high"]>;
|
|
5
|
+
export declare const RoutingContextSchema: z.ZodObject<{
|
|
6
|
+
scope: z.ZodEnum<["main-turn", "subagent"]>;
|
|
7
|
+
taskType: z.ZodString;
|
|
8
|
+
complexity: z.ZodEnum<["low", "medium", "high"]>;
|
|
9
|
+
risk: z.ZodEnum<["low", "medium", "high", "critical"]>;
|
|
10
|
+
contextTokens: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
requiredCapabilities: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
12
|
+
explicitUserModel: z.ZodOptional<z.ZodString>;
|
|
13
|
+
explicitUserEffort: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
14
|
+
previousOutcome: z.ZodDefault<z.ZodEnum<["none", "passed", "failed-verification", "failed-review"]>>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
scope: "main-turn" | "subagent";
|
|
17
|
+
risk: "low" | "medium" | "high" | "critical";
|
|
18
|
+
taskType: string;
|
|
19
|
+
complexity: "low" | "medium" | "high";
|
|
20
|
+
requiredCapabilities: string[];
|
|
21
|
+
previousOutcome: "passed" | "none" | "failed-verification" | "failed-review";
|
|
22
|
+
contextTokens?: number | undefined;
|
|
23
|
+
explicitUserModel?: string | undefined;
|
|
24
|
+
explicitUserEffort?: "low" | "medium" | "high" | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
scope: "main-turn" | "subagent";
|
|
27
|
+
risk: "low" | "medium" | "high" | "critical";
|
|
28
|
+
taskType: string;
|
|
29
|
+
complexity: "low" | "medium" | "high";
|
|
30
|
+
contextTokens?: number | undefined;
|
|
31
|
+
requiredCapabilities?: string[] | undefined;
|
|
32
|
+
explicitUserModel?: string | undefined;
|
|
33
|
+
explicitUserEffort?: "low" | "medium" | "high" | undefined;
|
|
34
|
+
previousOutcome?: "passed" | "none" | "failed-verification" | "failed-review" | undefined;
|
|
35
|
+
}>;
|
|
36
|
+
export declare const RoutingDecisionSchema: z.ZodObject<{
|
|
37
|
+
model: z.ZodString;
|
|
38
|
+
effort: z.ZodEnum<["low", "medium", "high"]>;
|
|
39
|
+
reason: z.ZodString;
|
|
40
|
+
isFallback: z.ZodDefault<z.ZodBoolean>;
|
|
41
|
+
isEscalation: z.ZodDefault<z.ZodBoolean>;
|
|
42
|
+
matchedRuleId: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
reason: string;
|
|
45
|
+
model: string;
|
|
46
|
+
effort: "low" | "medium" | "high";
|
|
47
|
+
isFallback: boolean;
|
|
48
|
+
isEscalation: boolean;
|
|
49
|
+
matchedRuleId?: string | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
reason: string;
|
|
52
|
+
model: string;
|
|
53
|
+
effort: "low" | "medium" | "high";
|
|
54
|
+
matchedRuleId?: string | undefined;
|
|
55
|
+
isFallback?: boolean | undefined;
|
|
56
|
+
isEscalation?: boolean | undefined;
|
|
57
|
+
}>;
|
|
58
|
+
export type Complexity = z.infer<typeof ComplexitySchema>;
|
|
59
|
+
export type RoutingRisk = z.infer<typeof RoutingRiskSchema>;
|
|
60
|
+
export type Effort = z.infer<typeof EffortSchema>;
|
|
61
|
+
export type RoutingContext = z.infer<typeof RoutingContextSchema>;
|
|
62
|
+
export type RoutingDecision = z.infer<typeof RoutingDecisionSchema>;
|
|
63
|
+
//# sourceMappingURL=routing-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routing-request.d.ts","sourceRoot":"","sources":["../../src/routing/routing-request.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB,sCAAoC,CAAC;AAIlE,eAAO,MAAM,iBAAiB,kDAAgD,CAAC;AAC/E,eAAO,MAAM,YAAY,sCAAoC,CAAC;AAE9D,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkB/B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;EAWhC,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAClD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// packages/contracts/src/routing/routing-request.ts
|
|
2
|
+
//
|
|
3
|
+
// M12 routing request contract (M12-01). The model-router Mod consumes
|
|
4
|
+
// this to decide model + effort for a turn or subagent.
|
|
5
|
+
//
|
|
6
|
+
// Per RESEARCH.md §C and post-M7 §6: complexity and risk are separate
|
|
7
|
+
// dimensions. The router must not equate a simple task with a safe task.
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
export const ComplexitySchema = z.enum(['low', 'medium', 'high']);
|
|
10
|
+
// Named RoutingRiskSchema to avoid collision with specification.ts
|
|
11
|
+
// RiskSchema (3-level "low|medium|high" for spec risk severity). Routing
|
|
12
|
+
// risk is 4-level because production database deletion is "critical".
|
|
13
|
+
export const RoutingRiskSchema = z.enum(['low', 'medium', 'high', 'critical']);
|
|
14
|
+
export const EffortSchema = z.enum(['low', 'medium', 'high']);
|
|
15
|
+
export const RoutingContextSchema = z.object({
|
|
16
|
+
// Whether this is a main-turn request or a subagent spawn.
|
|
17
|
+
scope: z.enum(['main-turn', 'subagent']),
|
|
18
|
+
// The task type, classified by the classifier module.
|
|
19
|
+
taskType: z.string().min(1),
|
|
20
|
+
complexity: ComplexitySchema,
|
|
21
|
+
risk: RoutingRiskSchema,
|
|
22
|
+
// The size of the context being routed (rough token estimate).
|
|
23
|
+
contextTokens: z.number().int().nonnegative().optional(),
|
|
24
|
+
// Required capabilities (e.g., ["code-edit", "tool-use"]).
|
|
25
|
+
requiredCapabilities: z.array(z.string()).default([]),
|
|
26
|
+
// If the user explicitly selected a model, the router MUST preserve it.
|
|
27
|
+
explicitUserModel: z.string().optional(),
|
|
28
|
+
explicitUserEffort: EffortSchema.optional(),
|
|
29
|
+
// Previous execution outcome (for verification-driven escalation).
|
|
30
|
+
previousOutcome: z
|
|
31
|
+
.enum(['none', 'passed', 'failed-verification', 'failed-review'])
|
|
32
|
+
.default('none'),
|
|
33
|
+
});
|
|
34
|
+
export const RoutingDecisionSchema = z.object({
|
|
35
|
+
model: z.string().min(1),
|
|
36
|
+
effort: EffortSchema,
|
|
37
|
+
// The reason this decision was made (for explainability).
|
|
38
|
+
reason: z.string().min(1),
|
|
39
|
+
// Whether this decision was a fallback (provider/model unavailable).
|
|
40
|
+
isFallback: z.boolean().default(false),
|
|
41
|
+
// Whether this decision was an escalation (previous attempt failed).
|
|
42
|
+
isEscalation: z.boolean().default(false),
|
|
43
|
+
// The matched rule id (if a static policy matched).
|
|
44
|
+
matchedRuleId: z.string().optional(),
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=routing-request.js.map
|