@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,108 @@
|
|
|
1
|
+
// packages/contracts/src/product/product-brief.test.ts
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import { ProductBriefSchema } from './product-brief.js';
|
|
4
|
+
import { RequirementsDocumentSchema } from './requirements.js';
|
|
5
|
+
import { MvpScopeSchema } from './mvp-scope.js';
|
|
6
|
+
import { TraceabilityMatrixSchema } from './traceability.js';
|
|
7
|
+
|
|
8
|
+
const validBrief = {
|
|
9
|
+
id: 'BRIEF-001',
|
|
10
|
+
title: 'Project Management App',
|
|
11
|
+
description: 'A subscription-based project management application.',
|
|
12
|
+
problemStatement: 'Teams lack a lightweight project management tool.',
|
|
13
|
+
targetUsers: [{ name: 'PM', role: 'manager', need: 'track tasks' }],
|
|
14
|
+
businessGoals: ['reduce onboarding time'],
|
|
15
|
+
assumptions: [{ id: 'A-1', assumption: 'users have email', requiresApproval: false }],
|
|
16
|
+
unresolvedDecisions: [{ id: 'Q-1', question: 'billing provider?', blocking: true }],
|
|
17
|
+
outOfScope: ['mobile app'],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
describe('ProductBriefSchema', () => {
|
|
21
|
+
it('accepts a valid brief', () => {
|
|
22
|
+
expect(ProductBriefSchema.safeParse(validBrief).success).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
it('rejects an invalid id', () => {
|
|
25
|
+
expect(ProductBriefSchema.safeParse({ ...validBrief, id: 'brief-1' }).success).toBe(false);
|
|
26
|
+
});
|
|
27
|
+
it('rejects a brief with no target users', () => {
|
|
28
|
+
expect(ProductBriefSchema.safeParse({ ...validBrief, targetUsers: [] }).success).toBe(false);
|
|
29
|
+
});
|
|
30
|
+
it('rejects unknown top-level keys (.strict())', () => {
|
|
31
|
+
expect(ProductBriefSchema.safeParse({ ...validBrief, bogus: true }).success).toBe(false);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const validDoc = {
|
|
36
|
+
schemaVersion: 1,
|
|
37
|
+
briefId: 'BRIEF-001',
|
|
38
|
+
functional: [
|
|
39
|
+
{
|
|
40
|
+
id: 'FR-1',
|
|
41
|
+
kind: 'functional',
|
|
42
|
+
statement: 'Users can create projects.',
|
|
43
|
+
priority: 'must',
|
|
44
|
+
source: 'BRIEF-001',
|
|
45
|
+
acceptanceCriterionIds: ['AC-1'],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
nonFunctional: [],
|
|
49
|
+
business: [],
|
|
50
|
+
technicalConstraints: [],
|
|
51
|
+
assumptions: [],
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
describe('RequirementsDocumentSchema', () => {
|
|
55
|
+
it('accepts a valid doc', () => {
|
|
56
|
+
expect(RequirementsDocumentSchema.safeParse(validDoc).success).toBe(true);
|
|
57
|
+
});
|
|
58
|
+
it('rejects an invalid priority', () => {
|
|
59
|
+
expect(
|
|
60
|
+
RequirementsDocumentSchema.safeParse({
|
|
61
|
+
...validDoc,
|
|
62
|
+
functional: [{ ...validDoc.functional[0], priority: 'maybe' }],
|
|
63
|
+
}).success,
|
|
64
|
+
).toBe(false);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
describe('MvpScopeSchema', () => {
|
|
69
|
+
it('accepts a valid scope', () => {
|
|
70
|
+
expect(
|
|
71
|
+
MvpScopeSchema.safeParse({
|
|
72
|
+
schemaVersion: 1,
|
|
73
|
+
briefId: 'BRIEF-001',
|
|
74
|
+
inScopeRequirementIds: ['FR-1'],
|
|
75
|
+
outOfScopeRequirementIds: [],
|
|
76
|
+
releaseBoundary: 'mvp',
|
|
77
|
+
rationale: 'MVP focuses on core project management.',
|
|
78
|
+
}).success,
|
|
79
|
+
).toBe(true);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe('TraceabilityMatrixSchema', () => {
|
|
84
|
+
it('accepts a valid matrix', () => {
|
|
85
|
+
expect(
|
|
86
|
+
TraceabilityMatrixSchema.safeParse({
|
|
87
|
+
schemaVersion: 1,
|
|
88
|
+
briefId: 'BRIEF-001',
|
|
89
|
+
entries: [
|
|
90
|
+
{
|
|
91
|
+
requirementId: 'FR-1',
|
|
92
|
+
acceptanceCriterionIds: ['AC-1'],
|
|
93
|
+
taskIds: ['TASK-001'],
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
}).success,
|
|
97
|
+
).toBe(true);
|
|
98
|
+
});
|
|
99
|
+
it('rejects an entry with no acceptance criteria', () => {
|
|
100
|
+
expect(
|
|
101
|
+
TraceabilityMatrixSchema.safeParse({
|
|
102
|
+
schemaVersion: 1,
|
|
103
|
+
briefId: 'BRIEF-001',
|
|
104
|
+
entries: [{ requirementId: 'FR-1', acceptanceCriterionIds: [], taskIds: [] }],
|
|
105
|
+
}).success,
|
|
106
|
+
).toBe(false);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// packages/contracts/src/product/product-brief.ts
|
|
2
|
+
//
|
|
3
|
+
// Product brief contract (M8 Phase B — M8-06, M8-07).
|
|
4
|
+
//
|
|
5
|
+
// Captures the developer's product idea and the kit's analysis of the
|
|
6
|
+
// problem and users. The brief is the input to the requirements engine.
|
|
7
|
+
//
|
|
8
|
+
// INVARIANT (post-M7 roadmap §2.3 Phase B): the kit must NOT silently
|
|
9
|
+
// invent business rules when the developer provides an incomplete product
|
|
10
|
+
// idea. Assumptions are recorded and flagged as decisions requiring
|
|
11
|
+
// approval.
|
|
12
|
+
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
|
|
15
|
+
export const ProductBriefSchema = z
|
|
16
|
+
.object({
|
|
17
|
+
id: z.string().regex(/^[A-Z]+-[0-9]{3,}$/, 'id must match BRIEF-NNN'),
|
|
18
|
+
title: z.string().min(1).max(200),
|
|
19
|
+
description: z.string().min(1),
|
|
20
|
+
problemStatement: z.string().min(1),
|
|
21
|
+
targetUsers: z
|
|
22
|
+
.array(
|
|
23
|
+
z.object({
|
|
24
|
+
name: z.string().min(1),
|
|
25
|
+
role: z.string().min(1),
|
|
26
|
+
need: z.string().min(1),
|
|
27
|
+
}),
|
|
28
|
+
)
|
|
29
|
+
.min(1, 'at least one target user is required'),
|
|
30
|
+
businessGoals: z.array(z.string().min(1)),
|
|
31
|
+
assumptions: z
|
|
32
|
+
.array(
|
|
33
|
+
z.object({
|
|
34
|
+
id: z.string(),
|
|
35
|
+
assumption: z.string().min(1),
|
|
36
|
+
requiresApproval: z.boolean(),
|
|
37
|
+
}),
|
|
38
|
+
)
|
|
39
|
+
.default([]),
|
|
40
|
+
unresolvedDecisions: z
|
|
41
|
+
.array(
|
|
42
|
+
z.object({
|
|
43
|
+
id: z.string(),
|
|
44
|
+
question: z.string().min(1),
|
|
45
|
+
blocking: z.boolean(),
|
|
46
|
+
}),
|
|
47
|
+
)
|
|
48
|
+
.default([]),
|
|
49
|
+
outOfScope: z.array(z.string().min(1)).default([]),
|
|
50
|
+
})
|
|
51
|
+
.strict();
|
|
52
|
+
|
|
53
|
+
export type ProductBrief = z.infer<typeof ProductBriefSchema>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// packages/contracts/src/product/requirements.ts
|
|
2
|
+
//
|
|
3
|
+
// Functional and non-functional requirements (M8 Phase B — M8-08, M8-09).
|
|
4
|
+
//
|
|
5
|
+
// Distinguishes:
|
|
6
|
+
// - Business requirements (what the business needs).
|
|
7
|
+
// - Functional requirements (what the system does).
|
|
8
|
+
// - Non-functional requirements (security, performance, reliability).
|
|
9
|
+
// - Technical constraints (e.g., must run on PostgreSQL).
|
|
10
|
+
// - Assumptions (carried from the brief; require approval if blocking).
|
|
11
|
+
// - Unresolved decisions.
|
|
12
|
+
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
|
|
15
|
+
export const RequirementKindSchema = z.enum([
|
|
16
|
+
'business',
|
|
17
|
+
'functional',
|
|
18
|
+
'non-functional',
|
|
19
|
+
'technical-constraint',
|
|
20
|
+
'assumption',
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
// Named ProductRequirementSchema to avoid collision with the
|
|
24
|
+
// specification.ts RequirementSchema (which is a simpler { id, statement }
|
|
25
|
+
// used inside FeatureSpecification). This one carries the full M8
|
|
26
|
+
// requirements-engineering shape (kind, priority, source, traceability).
|
|
27
|
+
export const ProductRequirementSchema = z.object({
|
|
28
|
+
id: z.string(),
|
|
29
|
+
kind: RequirementKindSchema,
|
|
30
|
+
statement: z.string().min(1),
|
|
31
|
+
priority: z.enum(['must', 'should', 'could', 'wont']),
|
|
32
|
+
source: z.string().min(1), // brief id or "inferred"
|
|
33
|
+
acceptanceCriterionIds: z.array(z.string()),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const RequirementsDocumentSchema = z
|
|
37
|
+
.object({
|
|
38
|
+
schemaVersion: z.literal(1),
|
|
39
|
+
briefId: z.string(),
|
|
40
|
+
functional: z.array(ProductRequirementSchema),
|
|
41
|
+
nonFunctional: z.array(ProductRequirementSchema),
|
|
42
|
+
business: z.array(ProductRequirementSchema),
|
|
43
|
+
technicalConstraints: z.array(ProductRequirementSchema),
|
|
44
|
+
assumptions: z.array(ProductRequirementSchema),
|
|
45
|
+
unresolvedDecisions: z
|
|
46
|
+
.array(
|
|
47
|
+
z.object({
|
|
48
|
+
id: z.string(),
|
|
49
|
+
question: z.string().min(1),
|
|
50
|
+
blocking: z.boolean(),
|
|
51
|
+
}),
|
|
52
|
+
)
|
|
53
|
+
.default([]),
|
|
54
|
+
})
|
|
55
|
+
.strict();
|
|
56
|
+
|
|
57
|
+
export type RequirementKind = z.infer<typeof RequirementKindSchema>;
|
|
58
|
+
export type ProductRequirement = z.infer<typeof ProductRequirementSchema>;
|
|
59
|
+
export type RequirementsDocument = z.infer<typeof RequirementsDocumentSchema>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// packages/contracts/src/product/traceability.ts
|
|
2
|
+
//
|
|
3
|
+
// Requirement-to-acceptance-to-task traceability (M8 Phase B — M8-11).
|
|
4
|
+
//
|
|
5
|
+
// Every requirement MUST map to at least one acceptance criterion. Every
|
|
6
|
+
// acceptance criterion MUST map to at least one task in the implementation
|
|
7
|
+
// plan. The traceability matrix is produced by the requirements engine and
|
|
8
|
+
// validated by kit validate-plan (M4) and kit audit (M9+).
|
|
9
|
+
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
|
|
12
|
+
export const TraceabilityEntrySchema = z.object({
|
|
13
|
+
requirementId: z.string(),
|
|
14
|
+
acceptanceCriterionIds: z.array(z.string()).min(1),
|
|
15
|
+
taskIds: z.array(z.string()),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const TraceabilityMatrixSchema = z.object({
|
|
19
|
+
schemaVersion: z.literal(1),
|
|
20
|
+
briefId: z.string(),
|
|
21
|
+
entries: z.array(TraceabilityEntrySchema),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export type TraceabilityEntry = z.infer<typeof TraceabilityEntrySchema>;
|
|
25
|
+
export type TraceabilityMatrix = z.infer<typeof TraceabilityMatrixSchema>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// packages/contracts/src/project/project-profile.test.ts
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import {
|
|
4
|
+
PROJECT_PROFILE_SCHEMA_VERSION,
|
|
5
|
+
ProjectProfileSchema,
|
|
6
|
+
makeProfile,
|
|
7
|
+
} from './project-profile.js';
|
|
8
|
+
|
|
9
|
+
const validProfile = {
|
|
10
|
+
schemaVersion: PROJECT_PROFILE_SCHEMA_VERSION,
|
|
11
|
+
name: 'fixture-node-fullstack',
|
|
12
|
+
stack: ['node-typescript', 'react'],
|
|
13
|
+
commands: {
|
|
14
|
+
test: [['pnpm', 'test']],
|
|
15
|
+
lint: [['pnpm', 'lint']],
|
|
16
|
+
typecheck: [['pnpm', 'typecheck']],
|
|
17
|
+
build: [['pnpm', 'build']],
|
|
18
|
+
},
|
|
19
|
+
} as const;
|
|
20
|
+
|
|
21
|
+
describe('ProjectProfileSchema', () => {
|
|
22
|
+
it('accepts a valid profile', () => {
|
|
23
|
+
const parsed = ProjectProfileSchema.safeParse(validProfile);
|
|
24
|
+
expect(parsed.success).toBe(true);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('rejects wrong schemaVersion', () => {
|
|
28
|
+
const r = ProjectProfileSchema.safeParse({ ...validProfile, schemaVersion: 2 });
|
|
29
|
+
expect(r.success).toBe(false);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('rejects missing schemaVersion', () => {
|
|
33
|
+
const { schemaVersion: _omit, ...rest } = validProfile;
|
|
34
|
+
void _omit;
|
|
35
|
+
const r = ProjectProfileSchema.safeParse(rest);
|
|
36
|
+
expect(r.success).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('rejects empty name', () => {
|
|
40
|
+
const r = ProjectProfileSchema.safeParse({ ...validProfile, name: '' });
|
|
41
|
+
expect(r.success).toBe(false);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('rejects empty stack', () => {
|
|
45
|
+
const r = ProjectProfileSchema.safeParse({ ...validProfile, stack: [] });
|
|
46
|
+
expect(r.success).toBe(false);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('rejects mixed-case stack entry', () => {
|
|
50
|
+
const r = ProjectProfileSchema.safeParse({ ...validProfile, stack: ['Node-TypeScript'] });
|
|
51
|
+
expect(r.success).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('rejects a string command (shell string is a contract violation)', () => {
|
|
55
|
+
const r = ProjectProfileSchema.safeParse({
|
|
56
|
+
...validProfile,
|
|
57
|
+
commands: { test: 'pnpm test' },
|
|
58
|
+
});
|
|
59
|
+
expect(r.success).toBe(false);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('rejects an empty command array', () => {
|
|
63
|
+
const r = ProjectProfileSchema.safeParse({
|
|
64
|
+
...validProfile,
|
|
65
|
+
commands: { test: [[]] },
|
|
66
|
+
});
|
|
67
|
+
expect(r.success).toBe(false);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('rejects unknown top-level keys (.strict())', () => {
|
|
71
|
+
const r = ProjectProfileSchema.safeParse({ ...validProfile, extra: true });
|
|
72
|
+
expect(r.success).toBe(false);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('rejects unknown commands keys (.strict())', () => {
|
|
76
|
+
const r = ProjectProfileSchema.safeParse({
|
|
77
|
+
...validProfile,
|
|
78
|
+
commands: { ...validProfile.commands, deploy: [['echo', 'hi']] },
|
|
79
|
+
});
|
|
80
|
+
expect(r.success).toBe(false);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe('makeProfile', () => {
|
|
85
|
+
it('injects the current schemaVersion and validates', () => {
|
|
86
|
+
const { schemaVersion: _omit, ...rest } = validProfile;
|
|
87
|
+
void _omit;
|
|
88
|
+
const p = makeProfile(rest);
|
|
89
|
+
expect(p.schemaVersion).toBe(PROJECT_PROFILE_SCHEMA_VERSION);
|
|
90
|
+
expect(p.name).toBe(validProfile.name);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('throws on invalid input (programmer-error path)', () => {
|
|
94
|
+
const { schemaVersion: _omit, ...rest } = validProfile;
|
|
95
|
+
void _omit;
|
|
96
|
+
expect(() => makeProfile({ ...rest, stack: [] })).toThrow();
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Schema version for the ProjectProfile contract. Bumped on breaking
|
|
14
|
+
// changes; requires an ADR and a migration function in
|
|
15
|
+
// core/artifacts/migrations/.
|
|
16
|
+
*/
|
|
17
|
+
export const PROJECT_PROFILE_SCHEMA_VERSION = 1 as const;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A single command is an array of arguments. The executor MUST run with
|
|
21
|
+
* shell: false. Empty arrays are rejected.
|
|
22
|
+
*/
|
|
23
|
+
export const CommandSchema = z
|
|
24
|
+
.array(z.string().min(1))
|
|
25
|
+
.min(1, 'command must be a non-empty array of arguments');
|
|
26
|
+
|
|
27
|
+
export const CommandsMapSchema = z
|
|
28
|
+
.object({
|
|
29
|
+
test: z.array(CommandSchema).optional(),
|
|
30
|
+
lint: z.array(CommandSchema).optional(),
|
|
31
|
+
typecheck: z.array(CommandSchema).optional(),
|
|
32
|
+
build: z.array(CommandSchema).optional(),
|
|
33
|
+
})
|
|
34
|
+
.strict();
|
|
35
|
+
|
|
36
|
+
export const ProjectProfileSchema = z
|
|
37
|
+
.object({
|
|
38
|
+
schemaVersion: z.literal(PROJECT_PROFILE_SCHEMA_VERSION),
|
|
39
|
+
name: z.string().min(1).max(128, 'name must be 1-128 chars'),
|
|
40
|
+
stack: z
|
|
41
|
+
.array(
|
|
42
|
+
z
|
|
43
|
+
.string()
|
|
44
|
+
.min(1)
|
|
45
|
+
.max(64)
|
|
46
|
+
.regex(/^[a-z][a-z0-9-]*$/, 'stack entry must be lowercase kebab-case'),
|
|
47
|
+
)
|
|
48
|
+
.min(1, 'stack must contain at least one entry'),
|
|
49
|
+
commands: CommandsMapSchema,
|
|
50
|
+
})
|
|
51
|
+
.strict();
|
|
52
|
+
|
|
53
|
+
export type ProjectProfile = z.infer<typeof ProjectProfileSchema>;
|
|
54
|
+
|
|
55
|
+
export type CommandsMap = z.infer<typeof CommandsMapSchema>;
|
|
56
|
+
export type Command = z.infer<typeof CommandSchema>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Convenience constructor: builds a profile and validates it. Throws
|
|
60
|
+
* (programmer error) if invalid — production callers should use the schema
|
|
61
|
+
* directly and surface a PROFILE_INVALID Result.
|
|
62
|
+
*/
|
|
63
|
+
export function makeProfile(input: Omit<ProjectProfile, 'schemaVersion'>): ProjectProfile {
|
|
64
|
+
return ProjectProfileSchema.parse({ ...input, schemaVersion: PROJECT_PROFILE_SCHEMA_VERSION });
|
|
65
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
|
|
11
|
+
export const GitStateSchema = z.object({
|
|
12
|
+
/** Whether the scanned root is inside a git work tree at all. */
|
|
13
|
+
isRepo: z.boolean(),
|
|
14
|
+
/** Branch name; empty string when isRepo is false. */
|
|
15
|
+
branch: z.string(),
|
|
16
|
+
dirty: z.boolean(),
|
|
17
|
+
/** HEAD commit SHA-1 (40 hex chars); empty string when isRepo is false. */
|
|
18
|
+
headSha: z.string().regex(/^([0-9a-f]{40})?$/, 'headSha must be a 40-char SHA-1 or empty'),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const RepositoryScanSchema = z.object({
|
|
22
|
+
root: z.string().min(1),
|
|
23
|
+
detectedStacks: z.array(z.string()),
|
|
24
|
+
packageManagers: z.array(z.string()),
|
|
25
|
+
entryPoints: z.array(z.string()),
|
|
26
|
+
testFrameworks: z.array(z.string()),
|
|
27
|
+
hasMigrations: z.boolean(),
|
|
28
|
+
hasCi: z.boolean(),
|
|
29
|
+
agentInstructionFiles: z.array(z.string()),
|
|
30
|
+
git: GitStateSchema,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export type RepositoryScan = z.infer<typeof RepositoryScanSchema>;
|
|
34
|
+
export type GitState = z.infer<typeof GitStateSchema>;
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
|
|
8
|
+
export const ModelCapabilitiesSchema = z.object({
|
|
9
|
+
model: z.string().min(1),
|
|
10
|
+
// Provider: anthropic, openai, etc.
|
|
11
|
+
provider: z.string().min(1),
|
|
12
|
+
// Max context window in tokens.
|
|
13
|
+
maxContextTokens: z.number().int().positive(),
|
|
14
|
+
// Supported effort levels.
|
|
15
|
+
supportedEfforts: z.array(z.enum(['low', 'medium', 'high'])),
|
|
16
|
+
// Capabilities (e.g., ["code-edit", "tool-use", "vision", "long-context"]).
|
|
17
|
+
capabilities: z.array(z.string()),
|
|
18
|
+
// Rough relative cost per 1M input tokens (illustrative; not authoritative).
|
|
19
|
+
relativeCostPer1MIn: z.number().positive(),
|
|
20
|
+
relativeCostPer1MOut: z.number().positive(),
|
|
21
|
+
// Whether this model supports subagent spawning.
|
|
22
|
+
supportsSubagents: z.boolean().default(true),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const ModelCapabilityRegistrySchema = z.object({
|
|
26
|
+
schemaVersion: z.literal(1),
|
|
27
|
+
models: z.array(ModelCapabilitiesSchema),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export type ModelCapabilities = z.infer<typeof ModelCapabilitiesSchema>;
|
|
31
|
+
export type ModelCapabilityRegistry = z.infer<typeof ModelCapabilityRegistrySchema>;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { EffortSchema } from './routing-request.js';
|
|
9
|
+
|
|
10
|
+
export const EscalationRuleSchema = z.object({
|
|
11
|
+
id: z.string(),
|
|
12
|
+
// The failure outcome that triggers this rule.
|
|
13
|
+
trigger: z.enum(['failed-verification', 'failed-review']),
|
|
14
|
+
// The maximum number of retries before escalating to human review.
|
|
15
|
+
maxRetries: z.number().int().min(0).max(5),
|
|
16
|
+
// The effort to use on retry (typically higher than the original).
|
|
17
|
+
retryEffort: EffortSchema,
|
|
18
|
+
// Whether to switch to a stronger model on retry.
|
|
19
|
+
switchToStrongerModel: z.boolean().default(false),
|
|
20
|
+
// After maxRetries, escalate to human review.
|
|
21
|
+
escalateToHuman: z.boolean().default(true),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export type EscalationRule = z.infer<typeof EscalationRuleSchema>;
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { ComplexitySchema, RoutingRiskSchema, EffortSchema } from './routing-request.js';
|
|
8
|
+
|
|
9
|
+
export const ROUTING_POLICY_SCHEMA_VERSION = 1 as const;
|
|
10
|
+
|
|
11
|
+
export const RoutingRuleSchema = z.object({
|
|
12
|
+
id: z.string(),
|
|
13
|
+
// Matchers; "*" matches any.
|
|
14
|
+
taskType: z.union([z.string(), z.literal('*')]),
|
|
15
|
+
complexity: z.union([ComplexitySchema, z.literal('*')]),
|
|
16
|
+
risk: z.union([RoutingRiskSchema, z.literal('*')]),
|
|
17
|
+
// The model to select (or "auto" to let the registry pick by capability).
|
|
18
|
+
model: z.string().min(1),
|
|
19
|
+
effort: EffortSchema,
|
|
20
|
+
// Required verification for this class of task.
|
|
21
|
+
verification: z.enum(['none', 'structural', 'tests', 'independent-review', 'mandatory-security']),
|
|
22
|
+
reason: z.string().min(1),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const RoutingPolicySchema = z.object({
|
|
26
|
+
schemaVersion: z.literal(ROUTING_POLICY_SCHEMA_VERSION),
|
|
27
|
+
id: z.string(),
|
|
28
|
+
version: z.string().regex(/^\d+\.\d+\.\d+$/, 'semver'),
|
|
29
|
+
rules: z.array(RoutingRuleSchema),
|
|
30
|
+
// Default model when no rule matches.
|
|
31
|
+
defaultModel: z.string().min(1),
|
|
32
|
+
defaultEffort: EffortSchema,
|
|
33
|
+
// Whether the router starts in suggest-only mode (per post-M7 §6).
|
|
34
|
+
suggestOnly: z.boolean().default(true),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export type RoutingRule = z.infer<typeof RoutingRuleSchema>;
|
|
38
|
+
export type RoutingPolicy = z.infer<typeof RoutingPolicySchema>;
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
|
|
11
|
+
export const ComplexitySchema = z.enum(['low', 'medium', 'high']);
|
|
12
|
+
// Named RoutingRiskSchema to avoid collision with specification.ts
|
|
13
|
+
// RiskSchema (3-level "low|medium|high" for spec risk severity). Routing
|
|
14
|
+
// risk is 4-level because production database deletion is "critical".
|
|
15
|
+
export const RoutingRiskSchema = z.enum(['low', 'medium', 'high', 'critical']);
|
|
16
|
+
export const EffortSchema = z.enum(['low', 'medium', 'high']);
|
|
17
|
+
|
|
18
|
+
export const RoutingContextSchema = z.object({
|
|
19
|
+
// Whether this is a main-turn request or a subagent spawn.
|
|
20
|
+
scope: z.enum(['main-turn', 'subagent']),
|
|
21
|
+
// The task type, classified by the classifier module.
|
|
22
|
+
taskType: z.string().min(1),
|
|
23
|
+
complexity: ComplexitySchema,
|
|
24
|
+
risk: RoutingRiskSchema,
|
|
25
|
+
// The size of the context being routed (rough token estimate).
|
|
26
|
+
contextTokens: z.number().int().nonnegative().optional(),
|
|
27
|
+
// Required capabilities (e.g., ["code-edit", "tool-use"]).
|
|
28
|
+
requiredCapabilities: z.array(z.string()).default([]),
|
|
29
|
+
// If the user explicitly selected a model, the router MUST preserve it.
|
|
30
|
+
explicitUserModel: z.string().optional(),
|
|
31
|
+
explicitUserEffort: EffortSchema.optional(),
|
|
32
|
+
// Previous execution outcome (for verification-driven escalation).
|
|
33
|
+
previousOutcome: z
|
|
34
|
+
.enum(['none', 'passed', 'failed-verification', 'failed-review'])
|
|
35
|
+
.default('none'),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const RoutingDecisionSchema = z.object({
|
|
39
|
+
model: z.string().min(1),
|
|
40
|
+
effort: EffortSchema,
|
|
41
|
+
// The reason this decision was made (for explainability).
|
|
42
|
+
reason: z.string().min(1),
|
|
43
|
+
// Whether this decision was a fallback (provider/model unavailable).
|
|
44
|
+
isFallback: z.boolean().default(false),
|
|
45
|
+
// Whether this decision was an escalation (previous attempt failed).
|
|
46
|
+
isEscalation: z.boolean().default(false),
|
|
47
|
+
// The matched rule id (if a static policy matched).
|
|
48
|
+
matchedRuleId: z.string().optional(),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export type Complexity = z.infer<typeof ComplexitySchema>;
|
|
52
|
+
export type RoutingRisk = z.infer<typeof RoutingRiskSchema>;
|
|
53
|
+
export type Effort = z.infer<typeof EffortSchema>;
|
|
54
|
+
export type RoutingContext = z.infer<typeof RoutingContextSchema>;
|
|
55
|
+
export type RoutingDecision = z.infer<typeof RoutingDecisionSchema>;
|