@agentic-sdlc-kit/contracts 0.0.0-stage → 0.9.1
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 +86 -0
- package/dist/installer/ownership-manifest.d.ts.map +1 -0
- package/dist/installer/ownership-manifest.js +34 -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 +153 -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 +87 -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 +40 -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 +168 -0
- package/src/secret-guard/finding.ts +95 -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,80 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const PerformanceProblemSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
description: z.ZodString;
|
|
5
|
+
targetOperation: z.ZodString;
|
|
6
|
+
baseline: z.ZodObject<{
|
|
7
|
+
command: z.ZodArray<z.ZodString, "many">;
|
|
8
|
+
metric: z.ZodEnum<["p50", "p95", "p99", "throughput", "rss", "heap", "cpu", "custom"]>;
|
|
9
|
+
customMetricName: z.ZodOptional<z.ZodString>;
|
|
10
|
+
repetitions: z.ZodNumber;
|
|
11
|
+
environment: z.ZodString;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
command: string[];
|
|
14
|
+
environment: string;
|
|
15
|
+
metric: "custom" | "p50" | "p95" | "p99" | "throughput" | "rss" | "heap" | "cpu";
|
|
16
|
+
repetitions: number;
|
|
17
|
+
customMetricName?: string | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
command: string[];
|
|
20
|
+
environment: string;
|
|
21
|
+
metric: "custom" | "p50" | "p95" | "p99" | "throughput" | "rss" | "heap" | "cpu";
|
|
22
|
+
repetitions: number;
|
|
23
|
+
customMetricName?: string | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
target: z.ZodObject<{
|
|
26
|
+
metric: z.ZodString;
|
|
27
|
+
value: z.ZodNumber;
|
|
28
|
+
unit: z.ZodString;
|
|
29
|
+
direction: z.ZodEnum<["lower-is-better", "higher-is-better"]>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
value: number;
|
|
32
|
+
metric: string;
|
|
33
|
+
unit: string;
|
|
34
|
+
direction: "lower-is-better" | "higher-is-better";
|
|
35
|
+
}, {
|
|
36
|
+
value: number;
|
|
37
|
+
metric: string;
|
|
38
|
+
unit: string;
|
|
39
|
+
direction: "lower-is-better" | "higher-is-better";
|
|
40
|
+
}>;
|
|
41
|
+
bottleneckHypothesis: z.ZodString;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
id: string;
|
|
44
|
+
description: string;
|
|
45
|
+
target: {
|
|
46
|
+
value: number;
|
|
47
|
+
metric: string;
|
|
48
|
+
unit: string;
|
|
49
|
+
direction: "lower-is-better" | "higher-is-better";
|
|
50
|
+
};
|
|
51
|
+
targetOperation: string;
|
|
52
|
+
baseline: {
|
|
53
|
+
command: string[];
|
|
54
|
+
environment: string;
|
|
55
|
+
metric: "custom" | "p50" | "p95" | "p99" | "throughput" | "rss" | "heap" | "cpu";
|
|
56
|
+
repetitions: number;
|
|
57
|
+
customMetricName?: string | undefined;
|
|
58
|
+
};
|
|
59
|
+
bottleneckHypothesis: string;
|
|
60
|
+
}, {
|
|
61
|
+
id: string;
|
|
62
|
+
description: string;
|
|
63
|
+
target: {
|
|
64
|
+
value: number;
|
|
65
|
+
metric: string;
|
|
66
|
+
unit: string;
|
|
67
|
+
direction: "lower-is-better" | "higher-is-better";
|
|
68
|
+
};
|
|
69
|
+
targetOperation: string;
|
|
70
|
+
baseline: {
|
|
71
|
+
command: string[];
|
|
72
|
+
environment: string;
|
|
73
|
+
metric: "custom" | "p50" | "p95" | "p99" | "throughput" | "rss" | "heap" | "cpu";
|
|
74
|
+
repetitions: number;
|
|
75
|
+
customMetricName?: string | undefined;
|
|
76
|
+
};
|
|
77
|
+
bottleneckHypothesis: string;
|
|
78
|
+
}>;
|
|
79
|
+
export type PerformanceProblem = z.infer<typeof PerformanceProblemSchema>;
|
|
80
|
+
//# sourceMappingURL=performance-baseline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performance-baseline.d.ts","sourceRoot":"","sources":["../../src/maintenance/performance-baseline.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// packages/contracts/src/maintenance/performance-baseline.ts
|
|
2
|
+
//
|
|
3
|
+
// Performance optimization contract (M9 optional extension — §3.3).
|
|
4
|
+
//
|
|
5
|
+
// Declared in 0.6.0; full /kit:optimize workflow lands in a later release.
|
|
6
|
+
//
|
|
7
|
+
// INVARIANT: performance optimization requires baseline measurements. The
|
|
8
|
+
// kit MUST NOT propose an optimization without an established baseline.
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
export const PerformanceProblemSchema = z.object({
|
|
11
|
+
id: z.string().regex(/^[A-Z]+-[0-9]{3,}$/, 'id must match PERF-NNN'),
|
|
12
|
+
description: z.string().min(1),
|
|
13
|
+
targetOperation: z.string().min(1),
|
|
14
|
+
// Reproducible baseline: the command(s) to run and the metric to record.
|
|
15
|
+
baseline: z.object({
|
|
16
|
+
command: z.array(z.string().min(1)).min(1),
|
|
17
|
+
metric: z.enum(['p50', 'p95', 'p99', 'throughput', 'rss', 'heap', 'cpu', 'custom']),
|
|
18
|
+
customMetricName: z.string().optional(),
|
|
19
|
+
repetitions: z.number().int().min(1).max(100),
|
|
20
|
+
environment: z.string().min(1),
|
|
21
|
+
}),
|
|
22
|
+
// Measurable target. Must be a number with a unit.
|
|
23
|
+
target: z.object({
|
|
24
|
+
metric: z.string(),
|
|
25
|
+
value: z.number(),
|
|
26
|
+
unit: z.string(),
|
|
27
|
+
direction: z.enum(['lower-is-better', 'higher-is-better']),
|
|
28
|
+
}),
|
|
29
|
+
// Bottleneck hypothesis, to be validated by profiling.
|
|
30
|
+
bottleneckHypothesis: z.string().min(1),
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=performance-baseline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performance-baseline.js","sourceRoot":"","sources":["../../src/maintenance/performance-baseline.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,EAAE;AACF,oEAAoE;AACpE,EAAE;AACF,2EAA2E;AAC3E,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AAExE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,oBAAoB,EAAE,wBAAwB,CAAC;IACpE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAClC,yEAAyE;IACzE,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;QACjB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1C,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QACnF,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACvC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;QAC7C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;KAC/B,CAAC;IACF,mDAAmD;IACnD,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,CAAC;KAC3D,CAAC;IACF,uDAAuD;IACvD,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACxC,CAAC,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const RefactorGoalSchema: z.ZodEnum<["reduce-coupling", "improve-testability", "improve-readability", "extract-module", "extract-component", "simplify-control-flow", "introduce-pattern", "remove-dead-code", "modernize-syntax", "other"]>;
|
|
3
|
+
export declare const PublicContractSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
kind: z.ZodEnum<["api-endpoint", "function-signature", "data-shape", "cli", "event", "side-effect"]>;
|
|
6
|
+
description: z.ZodString;
|
|
7
|
+
characterizationTestPath: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
id: string;
|
|
10
|
+
description: string;
|
|
11
|
+
kind: "api-endpoint" | "function-signature" | "data-shape" | "cli" | "event" | "side-effect";
|
|
12
|
+
characterizationTestPath?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
id: string;
|
|
15
|
+
description: string;
|
|
16
|
+
kind: "api-endpoint" | "function-signature" | "data-shape" | "cli" | "event" | "side-effect";
|
|
17
|
+
characterizationTestPath?: string | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const RefactorContractSchema: z.ZodEffects<z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
title: z.ZodString;
|
|
22
|
+
targetModule: z.ZodString;
|
|
23
|
+
goal: z.ZodEnum<["reduce-coupling", "improve-testability", "improve-readability", "extract-module", "extract-component", "simplify-control-flow", "introduce-pattern", "remove-dead-code", "modernize-syntax", "other"]>;
|
|
24
|
+
targetStructure: z.ZodString;
|
|
25
|
+
rationale: z.ZodString;
|
|
26
|
+
publicContracts: z.ZodArray<z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
kind: z.ZodEnum<["api-endpoint", "function-signature", "data-shape", "cli", "event", "side-effect"]>;
|
|
29
|
+
description: z.ZodString;
|
|
30
|
+
characterizationTestPath: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
id: string;
|
|
33
|
+
description: string;
|
|
34
|
+
kind: "api-endpoint" | "function-signature" | "data-shape" | "cli" | "event" | "side-effect";
|
|
35
|
+
characterizationTestPath?: string | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
id: string;
|
|
38
|
+
description: string;
|
|
39
|
+
kind: "api-endpoint" | "function-signature" | "data-shape" | "cli" | "event" | "side-effect";
|
|
40
|
+
characterizationTestPath?: string | undefined;
|
|
41
|
+
}>, "many">;
|
|
42
|
+
candidatePatterns: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
43
|
+
pattern: z.ZodString;
|
|
44
|
+
whyItApplies: z.ZodString;
|
|
45
|
+
whenNotToUse: z.ZodString;
|
|
46
|
+
simplerAlternative: z.ZodString;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
pattern: string;
|
|
49
|
+
whyItApplies: string;
|
|
50
|
+
whenNotToUse: string;
|
|
51
|
+
simplerAlternative: string;
|
|
52
|
+
}, {
|
|
53
|
+
pattern: string;
|
|
54
|
+
whyItApplies: string;
|
|
55
|
+
whenNotToUse: string;
|
|
56
|
+
simplerAlternative: string;
|
|
57
|
+
}>, "many">>;
|
|
58
|
+
behaviorChangeApproved: z.ZodDefault<z.ZodBoolean>;
|
|
59
|
+
behaviorChangeRationale: z.ZodOptional<z.ZodString>;
|
|
60
|
+
inScopePaths: z.ZodArray<z.ZodString, "many">;
|
|
61
|
+
outOfScopePaths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
62
|
+
}, "strict", z.ZodTypeAny, {
|
|
63
|
+
id: string;
|
|
64
|
+
title: string;
|
|
65
|
+
rationale: string;
|
|
66
|
+
targetModule: string;
|
|
67
|
+
goal: "other" | "reduce-coupling" | "improve-testability" | "improve-readability" | "extract-module" | "extract-component" | "simplify-control-flow" | "introduce-pattern" | "remove-dead-code" | "modernize-syntax";
|
|
68
|
+
targetStructure: string;
|
|
69
|
+
publicContracts: {
|
|
70
|
+
id: string;
|
|
71
|
+
description: string;
|
|
72
|
+
kind: "api-endpoint" | "function-signature" | "data-shape" | "cli" | "event" | "side-effect";
|
|
73
|
+
characterizationTestPath?: string | undefined;
|
|
74
|
+
}[];
|
|
75
|
+
candidatePatterns: {
|
|
76
|
+
pattern: string;
|
|
77
|
+
whyItApplies: string;
|
|
78
|
+
whenNotToUse: string;
|
|
79
|
+
simplerAlternative: string;
|
|
80
|
+
}[];
|
|
81
|
+
behaviorChangeApproved: boolean;
|
|
82
|
+
inScopePaths: string[];
|
|
83
|
+
outOfScopePaths: string[];
|
|
84
|
+
behaviorChangeRationale?: string | undefined;
|
|
85
|
+
}, {
|
|
86
|
+
id: string;
|
|
87
|
+
title: string;
|
|
88
|
+
rationale: string;
|
|
89
|
+
targetModule: string;
|
|
90
|
+
goal: "other" | "reduce-coupling" | "improve-testability" | "improve-readability" | "extract-module" | "extract-component" | "simplify-control-flow" | "introduce-pattern" | "remove-dead-code" | "modernize-syntax";
|
|
91
|
+
targetStructure: string;
|
|
92
|
+
publicContracts: {
|
|
93
|
+
id: string;
|
|
94
|
+
description: string;
|
|
95
|
+
kind: "api-endpoint" | "function-signature" | "data-shape" | "cli" | "event" | "side-effect";
|
|
96
|
+
characterizationTestPath?: string | undefined;
|
|
97
|
+
}[];
|
|
98
|
+
inScopePaths: string[];
|
|
99
|
+
candidatePatterns?: {
|
|
100
|
+
pattern: string;
|
|
101
|
+
whyItApplies: string;
|
|
102
|
+
whenNotToUse: string;
|
|
103
|
+
simplerAlternative: string;
|
|
104
|
+
}[] | undefined;
|
|
105
|
+
behaviorChangeApproved?: boolean | undefined;
|
|
106
|
+
behaviorChangeRationale?: string | undefined;
|
|
107
|
+
outOfScopePaths?: string[] | undefined;
|
|
108
|
+
}>, {
|
|
109
|
+
id: string;
|
|
110
|
+
title: string;
|
|
111
|
+
rationale: string;
|
|
112
|
+
targetModule: string;
|
|
113
|
+
goal: "other" | "reduce-coupling" | "improve-testability" | "improve-readability" | "extract-module" | "extract-component" | "simplify-control-flow" | "introduce-pattern" | "remove-dead-code" | "modernize-syntax";
|
|
114
|
+
targetStructure: string;
|
|
115
|
+
publicContracts: {
|
|
116
|
+
id: string;
|
|
117
|
+
description: string;
|
|
118
|
+
kind: "api-endpoint" | "function-signature" | "data-shape" | "cli" | "event" | "side-effect";
|
|
119
|
+
characterizationTestPath?: string | undefined;
|
|
120
|
+
}[];
|
|
121
|
+
candidatePatterns: {
|
|
122
|
+
pattern: string;
|
|
123
|
+
whyItApplies: string;
|
|
124
|
+
whenNotToUse: string;
|
|
125
|
+
simplerAlternative: string;
|
|
126
|
+
}[];
|
|
127
|
+
behaviorChangeApproved: boolean;
|
|
128
|
+
inScopePaths: string[];
|
|
129
|
+
outOfScopePaths: string[];
|
|
130
|
+
behaviorChangeRationale?: string | undefined;
|
|
131
|
+
}, {
|
|
132
|
+
id: string;
|
|
133
|
+
title: string;
|
|
134
|
+
rationale: string;
|
|
135
|
+
targetModule: string;
|
|
136
|
+
goal: "other" | "reduce-coupling" | "improve-testability" | "improve-readability" | "extract-module" | "extract-component" | "simplify-control-flow" | "introduce-pattern" | "remove-dead-code" | "modernize-syntax";
|
|
137
|
+
targetStructure: string;
|
|
138
|
+
publicContracts: {
|
|
139
|
+
id: string;
|
|
140
|
+
description: string;
|
|
141
|
+
kind: "api-endpoint" | "function-signature" | "data-shape" | "cli" | "event" | "side-effect";
|
|
142
|
+
characterizationTestPath?: string | undefined;
|
|
143
|
+
}[];
|
|
144
|
+
inScopePaths: string[];
|
|
145
|
+
candidatePatterns?: {
|
|
146
|
+
pattern: string;
|
|
147
|
+
whyItApplies: string;
|
|
148
|
+
whenNotToUse: string;
|
|
149
|
+
simplerAlternative: string;
|
|
150
|
+
}[] | undefined;
|
|
151
|
+
behaviorChangeApproved?: boolean | undefined;
|
|
152
|
+
behaviorChangeRationale?: string | undefined;
|
|
153
|
+
outOfScopePaths?: string[] | undefined;
|
|
154
|
+
}>;
|
|
155
|
+
export type RefactorGoal = z.infer<typeof RefactorGoalSchema>;
|
|
156
|
+
export type PublicContract = z.infer<typeof PublicContractSchema>;
|
|
157
|
+
export type RefactorContract = z.infer<typeof RefactorContractSchema>;
|
|
158
|
+
//# sourceMappingURL=refactor-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refactor-contract.d.ts","sourceRoot":"","sources":["../../src/maintenance/refactor-contract.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,kBAAkB,oNAW7B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;EAO/B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmChC,CAAC;AAEJ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// packages/contracts/src/maintenance/refactor-contract.ts
|
|
2
|
+
//
|
|
3
|
+
// Refactoring contract (M9 — M9-11, M9-12).
|
|
4
|
+
//
|
|
5
|
+
// A refactor contract captures the structural-change specification: what
|
|
6
|
+
// is being refactored, the target structure, and the public contracts that
|
|
7
|
+
// MUST be preserved.
|
|
8
|
+
//
|
|
9
|
+
// INVARIANT (post-M7 roadmap §3.2): preserve observable behavior unless
|
|
10
|
+
// behavior changes are explicitly approved. The contract's
|
|
11
|
+
// `behaviorChangeApproved` field defaults to false; if any change
|
|
12
|
+
// modifies public behavior, it must be set to true with rationale.
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
export const RefactorGoalSchema = z.enum([
|
|
15
|
+
'reduce-coupling',
|
|
16
|
+
'improve-testability',
|
|
17
|
+
'improve-readability',
|
|
18
|
+
'extract-module',
|
|
19
|
+
'extract-component',
|
|
20
|
+
'simplify-control-flow',
|
|
21
|
+
'introduce-pattern',
|
|
22
|
+
'remove-dead-code',
|
|
23
|
+
'modernize-syntax',
|
|
24
|
+
'other',
|
|
25
|
+
]);
|
|
26
|
+
export const PublicContractSchema = z.object({
|
|
27
|
+
id: z.string(),
|
|
28
|
+
// API surface, data shape, observable side effect, etc.
|
|
29
|
+
kind: z.enum(['api-endpoint', 'function-signature', 'data-shape', 'cli', 'event', 'side-effect']),
|
|
30
|
+
description: z.string().min(1),
|
|
31
|
+
// The characterization test that pins this contract.
|
|
32
|
+
characterizationTestPath: z.string().optional(),
|
|
33
|
+
});
|
|
34
|
+
export const RefactorContractSchema = z
|
|
35
|
+
.object({
|
|
36
|
+
id: z.string().regex(/^[A-Z]+-[0-9]{3,}$/, 'id must match REFACTOR-NNN'),
|
|
37
|
+
title: z.string().min(1).max(200),
|
|
38
|
+
targetModule: z.string().min(1),
|
|
39
|
+
goal: RefactorGoalSchema,
|
|
40
|
+
targetStructure: z.string().min(1),
|
|
41
|
+
rationale: z.string().min(1),
|
|
42
|
+
// The public contracts that MUST be preserved.
|
|
43
|
+
publicContracts: z.array(PublicContractSchema).min(1, 'at least one public contract required'),
|
|
44
|
+
// Candidate design patterns (with justification per post-M7 §3.2:
|
|
45
|
+
// "Do not use a design pattern simply because it exists").
|
|
46
|
+
candidatePatterns: z
|
|
47
|
+
.array(z.object({
|
|
48
|
+
pattern: z.string(),
|
|
49
|
+
whyItApplies: z.string().min(1),
|
|
50
|
+
whenNotToUse: z.string().min(1),
|
|
51
|
+
simplerAlternative: z.string().min(1),
|
|
52
|
+
}))
|
|
53
|
+
.default([]),
|
|
54
|
+
// Default false. If true, the refactor is allowed to change observable
|
|
55
|
+
// behavior; the rationale MUST be present.
|
|
56
|
+
behaviorChangeApproved: z.boolean().default(false),
|
|
57
|
+
behaviorChangeRationale: z.string().optional(),
|
|
58
|
+
// Files / modules in scope.
|
|
59
|
+
inScopePaths: z.array(z.string()),
|
|
60
|
+
// Files / modules explicitly out of scope.
|
|
61
|
+
outOfScopePaths: z.array(z.string()).default([]),
|
|
62
|
+
})
|
|
63
|
+
.strict()
|
|
64
|
+
.refine((c) => !c.behaviorChangeApproved || c.behaviorChangeRationale, 'behaviorChangeApproved=true requires behaviorChangeRationale');
|
|
65
|
+
//# sourceMappingURL=refactor-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refactor-contract.js","sourceRoot":"","sources":["../../src/maintenance/refactor-contract.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const REFACTOR_STAGE: z.ZodEnum<["contract", "discover-deps", "characterization-tests", "target-structure", "identify-patterns", "incremental-refactor", "contract-validation", "regression-testing", "quality-comparison", "review"]>;
|
|
3
|
+
export type RefactorStage = z.infer<typeof REFACTOR_STAGE>;
|
|
4
|
+
export declare const REFACTOR_STATUS: z.ZodEnum<["pending", "in_progress", "blocked", "completed", "failed"]>;
|
|
5
|
+
export type RefactorStatus = z.infer<typeof REFACTOR_STATUS>;
|
|
6
|
+
export declare const REFACTOR_TRANSITION: z.ZodEnum<["start", "advance", "block", "resume", "complete", "fail"]>;
|
|
7
|
+
export type RefactorTransition = z.infer<typeof REFACTOR_TRANSITION>;
|
|
8
|
+
export declare const RefactorStateSchema: z.ZodObject<{
|
|
9
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
10
|
+
runId: z.ZodString;
|
|
11
|
+
refactorId: z.ZodString;
|
|
12
|
+
status: z.ZodEnum<["pending", "in_progress", "blocked", "completed", "failed"]>;
|
|
13
|
+
stage: z.ZodEnum<["contract", "discover-deps", "characterization-tests", "target-structure", "identify-patterns", "incremental-refactor", "contract-validation", "regression-testing", "quality-comparison", "review"]>;
|
|
14
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
15
|
+
dependencyMapPath: z.ZodOptional<z.ZodString>;
|
|
16
|
+
characterizationTestPaths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
17
|
+
incrementsApplied: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
18
|
+
id: z.ZodString;
|
|
19
|
+
summary: z.ZodString;
|
|
20
|
+
affectedFiles: z.ZodArray<z.ZodString, "many">;
|
|
21
|
+
regressionPassed: z.ZodBoolean;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
id: string;
|
|
24
|
+
summary: string;
|
|
25
|
+
affectedFiles: string[];
|
|
26
|
+
regressionPassed: boolean;
|
|
27
|
+
}, {
|
|
28
|
+
id: string;
|
|
29
|
+
summary: string;
|
|
30
|
+
affectedFiles: string[];
|
|
31
|
+
regressionPassed: boolean;
|
|
32
|
+
}>, "many">>;
|
|
33
|
+
beforeAfterReportPath: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
status: "failed" | "blocked" | "pending" | "in_progress" | "completed";
|
|
36
|
+
schemaVersion: 1;
|
|
37
|
+
runId: string;
|
|
38
|
+
stage: "review" | "contract" | "discover-deps" | "characterization-tests" | "target-structure" | "identify-patterns" | "incremental-refactor" | "contract-validation" | "regression-testing" | "quality-comparison";
|
|
39
|
+
refactorId: string;
|
|
40
|
+
characterizationTestPaths: string[];
|
|
41
|
+
incrementsApplied: {
|
|
42
|
+
id: string;
|
|
43
|
+
summary: string;
|
|
44
|
+
affectedFiles: string[];
|
|
45
|
+
regressionPassed: boolean;
|
|
46
|
+
}[];
|
|
47
|
+
startedAt?: string | undefined;
|
|
48
|
+
dependencyMapPath?: string | undefined;
|
|
49
|
+
beforeAfterReportPath?: string | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
status: "failed" | "blocked" | "pending" | "in_progress" | "completed";
|
|
52
|
+
schemaVersion: 1;
|
|
53
|
+
runId: string;
|
|
54
|
+
stage: "review" | "contract" | "discover-deps" | "characterization-tests" | "target-structure" | "identify-patterns" | "incremental-refactor" | "contract-validation" | "regression-testing" | "quality-comparison";
|
|
55
|
+
refactorId: string;
|
|
56
|
+
startedAt?: string | undefined;
|
|
57
|
+
dependencyMapPath?: string | undefined;
|
|
58
|
+
characterizationTestPaths?: string[] | undefined;
|
|
59
|
+
incrementsApplied?: {
|
|
60
|
+
id: string;
|
|
61
|
+
summary: string;
|
|
62
|
+
affectedFiles: string[];
|
|
63
|
+
regressionPassed: boolean;
|
|
64
|
+
}[] | undefined;
|
|
65
|
+
beforeAfterReportPath?: string | undefined;
|
|
66
|
+
}>;
|
|
67
|
+
export type RefactorState = z.infer<typeof RefactorStateSchema>;
|
|
68
|
+
export declare const REFACTOR_STAGE_ORDER: ReadonlyArray<RefactorStage>;
|
|
69
|
+
export declare const REFACTOR_TRANSITIONS_BY_STATUS: Readonly<Record<RefactorStatus, ReadonlyArray<RefactorTransition>>>;
|
|
70
|
+
export declare const REFACTOR_TARGET_STATUS: Readonly<Record<RefactorTransition, RefactorStatus>>;
|
|
71
|
+
export declare const REFACTOR_COMPLETABLE_STAGES: ReadonlyArray<RefactorStage>;
|
|
72
|
+
/**
|
|
73
|
+
* INVARIANT: the incremental-refactor stage cannot be entered until
|
|
74
|
+
* characterization tests have been recorded. This is the most important
|
|
75
|
+
* invariant in the refactor workflow — without a baseline, "preserve
|
|
76
|
+
* observable behavior" is meaningless.
|
|
77
|
+
*/
|
|
78
|
+
export declare function characterizationRequiredBeforeRefactor(state: RefactorState, toStage: RefactorStage): boolean;
|
|
79
|
+
//# sourceMappingURL=refactor-workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refactor-workflow.d.ts","sourceRoot":"","sources":["../../src/maintenance/refactor-workflow.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc,kNAWzB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE3D,eAAO,MAAM,eAAe,yEAAuE,CAAC;AACpG,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE7D,eAAO,MAAM,mBAAmB,wEAO9B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAErE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwB9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,aAAa,CAW7D,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CACnD,MAAM,CAAC,cAAc,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC,CAO1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAOvF,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,aAAa,CAAC,aAAa,CAAc,CAAC;AAEpF;;;;;GAKG;AACH,wBAAgB,sCAAsC,CACpD,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,aAAa,GACrB,OAAO,CAKT"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// packages/contracts/src/maintenance/refactor-workflow.ts
|
|
2
|
+
//
|
|
3
|
+
// Refactor workflow state and transitions (M9 — M9-13 through M9-20).
|
|
4
|
+
//
|
|
5
|
+
// Lifecycle (post-M7 roadmap §3.2):
|
|
6
|
+
// Contract → Discover Deps → Characterization Tests → Target Structure →
|
|
7
|
+
// Identify Patterns → Incremental Refactor → Public-Contract Validation →
|
|
8
|
+
// Regression Testing → Quality Comparison → Review
|
|
9
|
+
//
|
|
10
|
+
// INVARIANT (post-M7 roadmap §3.2): characterization tests MUST exist
|
|
11
|
+
// before structural changes. The workflow enforces this: the
|
|
12
|
+
// `incremental-refactor` stage cannot be entered from a stage other than
|
|
13
|
+
// `characterization-tests` (or `target-structure` if characterization
|
|
14
|
+
// tests have already been recorded).
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
export const REFACTOR_STAGE = z.enum([
|
|
17
|
+
'contract',
|
|
18
|
+
'discover-deps',
|
|
19
|
+
'characterization-tests',
|
|
20
|
+
'target-structure',
|
|
21
|
+
'identify-patterns',
|
|
22
|
+
'incremental-refactor',
|
|
23
|
+
'contract-validation',
|
|
24
|
+
'regression-testing',
|
|
25
|
+
'quality-comparison',
|
|
26
|
+
'review',
|
|
27
|
+
]);
|
|
28
|
+
export const REFACTOR_STATUS = z.enum(['pending', 'in_progress', 'blocked', 'completed', 'failed']);
|
|
29
|
+
export const REFACTOR_TRANSITION = z.enum([
|
|
30
|
+
'start',
|
|
31
|
+
'advance',
|
|
32
|
+
'block',
|
|
33
|
+
'resume',
|
|
34
|
+
'complete',
|
|
35
|
+
'fail',
|
|
36
|
+
]);
|
|
37
|
+
export const RefactorStateSchema = z.object({
|
|
38
|
+
schemaVersion: z.literal(1),
|
|
39
|
+
runId: z.string(),
|
|
40
|
+
refactorId: z.string(),
|
|
41
|
+
status: REFACTOR_STATUS,
|
|
42
|
+
stage: REFACTOR_STAGE,
|
|
43
|
+
startedAt: z.string().optional(),
|
|
44
|
+
// Filled in during discover-deps:
|
|
45
|
+
dependencyMapPath: z.string().optional(),
|
|
46
|
+
// Filled in during characterization-tests:
|
|
47
|
+
characterizationTestPaths: z.array(z.string()).default([]),
|
|
48
|
+
// Filled in during incremental-refactor:
|
|
49
|
+
incrementsApplied: z
|
|
50
|
+
.array(z.object({
|
|
51
|
+
id: z.string(),
|
|
52
|
+
summary: z.string(),
|
|
53
|
+
affectedFiles: z.array(z.string()),
|
|
54
|
+
regressionPassed: z.boolean(),
|
|
55
|
+
}))
|
|
56
|
+
.default([]),
|
|
57
|
+
// Filled in during quality-comparison:
|
|
58
|
+
beforeAfterReportPath: z.string().optional(),
|
|
59
|
+
});
|
|
60
|
+
export const REFACTOR_STAGE_ORDER = [
|
|
61
|
+
'contract',
|
|
62
|
+
'discover-deps',
|
|
63
|
+
'characterization-tests',
|
|
64
|
+
'target-structure',
|
|
65
|
+
'identify-patterns',
|
|
66
|
+
'incremental-refactor',
|
|
67
|
+
'contract-validation',
|
|
68
|
+
'regression-testing',
|
|
69
|
+
'quality-comparison',
|
|
70
|
+
'review',
|
|
71
|
+
];
|
|
72
|
+
export const REFACTOR_TRANSITIONS_BY_STATUS = {
|
|
73
|
+
pending: ['start'],
|
|
74
|
+
in_progress: ['advance', 'block', 'complete', 'fail'],
|
|
75
|
+
blocked: ['resume', 'fail'],
|
|
76
|
+
completed: [],
|
|
77
|
+
failed: [],
|
|
78
|
+
};
|
|
79
|
+
export const REFACTOR_TARGET_STATUS = {
|
|
80
|
+
start: 'in_progress',
|
|
81
|
+
advance: 'in_progress',
|
|
82
|
+
block: 'blocked',
|
|
83
|
+
resume: 'in_progress',
|
|
84
|
+
complete: 'completed',
|
|
85
|
+
fail: 'failed',
|
|
86
|
+
};
|
|
87
|
+
export const REFACTOR_COMPLETABLE_STAGES = ['review'];
|
|
88
|
+
/**
|
|
89
|
+
* INVARIANT: the incremental-refactor stage cannot be entered until
|
|
90
|
+
* characterization tests have been recorded. This is the most important
|
|
91
|
+
* invariant in the refactor workflow — without a baseline, "preserve
|
|
92
|
+
* observable behavior" is meaningless.
|
|
93
|
+
*/
|
|
94
|
+
export function characterizationRequiredBeforeRefactor(state, toStage) {
|
|
95
|
+
if (toStage === 'incremental-refactor') {
|
|
96
|
+
return state.characterizationTestPaths.length === 0;
|
|
97
|
+
}
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=refactor-workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refactor-workflow.js","sourceRoot":"","sources":["../../src/maintenance/refactor-workflow.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const OBSERVER_EVENT_SCHEMA_VERSION: 1;
|
|
3
|
+
export declare const ObserverEventKindSchema: z.ZodEnum<["session-start", "session-end", "turn-start", "turn-step", "turn-complete", "agent-spawn", "agent-complete", "tool-call", "tool-result", "verification", "escalation", "failure", "blocked-action"]>;
|
|
4
|
+
export declare const ObserverEventSchema: z.ZodObject<{
|
|
5
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
runId: z.ZodString;
|
|
8
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
9
|
+
at: z.ZodString;
|
|
10
|
+
kind: z.ZodEnum<["session-start", "session-end", "turn-start", "turn-step", "turn-complete", "agent-spawn", "agent-complete", "tool-call", "tool-result", "verification", "escalation", "failure", "blocked-action"]>;
|
|
11
|
+
model: z.ZodOptional<z.ZodString>;
|
|
12
|
+
effort: z.ZodOptional<z.ZodString>;
|
|
13
|
+
tokensIn: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
tokensOut: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
estimatedCostUnits: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
summary: z.ZodString;
|
|
17
|
+
partial: z.ZodDefault<z.ZodBoolean>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
at: string;
|
|
20
|
+
schemaVersion: 1;
|
|
21
|
+
id: string;
|
|
22
|
+
runId: string;
|
|
23
|
+
summary: string;
|
|
24
|
+
kind: "verification" | "session-start" | "session-end" | "turn-start" | "turn-step" | "turn-complete" | "agent-spawn" | "agent-complete" | "tool-call" | "tool-result" | "escalation" | "failure" | "blocked-action";
|
|
25
|
+
partial: boolean;
|
|
26
|
+
model?: string | undefined;
|
|
27
|
+
effort?: string | undefined;
|
|
28
|
+
sessionId?: string | undefined;
|
|
29
|
+
tokensIn?: number | undefined;
|
|
30
|
+
tokensOut?: number | undefined;
|
|
31
|
+
estimatedCostUnits?: number | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
at: string;
|
|
34
|
+
schemaVersion: 1;
|
|
35
|
+
id: string;
|
|
36
|
+
runId: string;
|
|
37
|
+
summary: string;
|
|
38
|
+
kind: "verification" | "session-start" | "session-end" | "turn-start" | "turn-step" | "turn-complete" | "agent-spawn" | "agent-complete" | "tool-call" | "tool-result" | "escalation" | "failure" | "blocked-action";
|
|
39
|
+
model?: string | undefined;
|
|
40
|
+
effort?: string | undefined;
|
|
41
|
+
sessionId?: string | undefined;
|
|
42
|
+
tokensIn?: number | undefined;
|
|
43
|
+
tokensOut?: number | undefined;
|
|
44
|
+
estimatedCostUnits?: number | undefined;
|
|
45
|
+
partial?: boolean | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
export type ObserverEvent = z.infer<typeof ObserverEventSchema>;
|
|
48
|
+
export type ObserverEventKind = z.infer<typeof ObserverEventKindSchema>;
|
|
49
|
+
//# sourceMappingURL=event-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-schema.d.ts","sourceRoot":"","sources":["../../src/observer/event-schema.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,6BAA6B,EAAG,CAAU,CAAC;AAExD,eAAO,MAAM,uBAAuB,iNAclC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwB9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// packages/contracts/src/observer/event-schema.ts
|
|
2
|
+
//
|
|
3
|
+
// M13 event contract (M13-01, M13-02). Versioned event schema for the
|
|
4
|
+
// run-observer Mod. Every event has a stable id and schema; missing
|
|
5
|
+
// telemetry is represented honestly (never as zero).
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
export const OBSERVER_EVENT_SCHEMA_VERSION = 1;
|
|
8
|
+
export const ObserverEventKindSchema = z.enum([
|
|
9
|
+
'session-start',
|
|
10
|
+
'session-end',
|
|
11
|
+
'turn-start',
|
|
12
|
+
'turn-step',
|
|
13
|
+
'turn-complete',
|
|
14
|
+
'agent-spawn',
|
|
15
|
+
'agent-complete',
|
|
16
|
+
'tool-call',
|
|
17
|
+
'tool-result',
|
|
18
|
+
'verification',
|
|
19
|
+
'escalation',
|
|
20
|
+
'failure',
|
|
21
|
+
'blocked-action',
|
|
22
|
+
]);
|
|
23
|
+
export const ObserverEventSchema = z.object({
|
|
24
|
+
schemaVersion: z.literal(OBSERVER_EVENT_SCHEMA_VERSION),
|
|
25
|
+
id: z.string(),
|
|
26
|
+
// The run this event belongs to.
|
|
27
|
+
runId: z.string(),
|
|
28
|
+
// The session this event belongs to (may differ from run if a session
|
|
29
|
+
// spans multiple runs).
|
|
30
|
+
sessionId: z.string().optional(),
|
|
31
|
+
// ISO 8601 timestamp.
|
|
32
|
+
at: z.string(),
|
|
33
|
+
kind: ObserverEventKindSchema,
|
|
34
|
+
// The model and effort in effect when the event occurred (if applicable).
|
|
35
|
+
model: z.string().optional(),
|
|
36
|
+
effort: z.string().optional(),
|
|
37
|
+
// Token usage (only present for turn-complete events where the host
|
|
38
|
+
// exposes it).
|
|
39
|
+
tokensIn: z.number().int().nonnegative().optional(),
|
|
40
|
+
tokensOut: z.number().int().nonnegative().optional(),
|
|
41
|
+
// Estimated cost in arbitrary units (only where reliable data exists).
|
|
42
|
+
estimatedCostUnits: z.number().nonnegative().optional(),
|
|
43
|
+
// A redacted summary of the event payload (never raw secrets).
|
|
44
|
+
summary: z.string(),
|
|
45
|
+
// Whether telemetry for this event is partial (some fields missing).
|
|
46
|
+
partial: z.boolean().default(false),
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=event-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-schema.js","sourceRoot":"","sources":["../../src/observer/event-schema.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,qDAAqD;AAErD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAU,CAAC;AAExD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC5C,eAAe;IACf,aAAa;IACb,YAAY;IACZ,WAAW;IACX,eAAe;IACf,aAAa;IACb,gBAAgB;IAChB,WAAW;IACX,aAAa;IACb,cAAc;IACd,YAAY;IACZ,SAAS;IACT,gBAAgB;CACjB,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,iCAAiC;IACjC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,sEAAsE;IACtE,wBAAwB;IACxB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,sBAAsB;IACtB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,uBAAuB;IAC7B,0EAA0E;IAC1E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,oEAAoE;IACpE,eAAe;IACf,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IACnD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IACpD,uEAAuE;IACvE,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IACvD,+DAA+D;IAC/D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,qEAAqE;IACrE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;CACpC,CAAC,CAAC"}
|