@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,44 @@
|
|
|
1
|
+
// packages/contracts/src/scaffolding/template-manifest.ts
|
|
2
|
+
//
|
|
3
|
+
// Template manifest contract (M8 Phase D — M8-20, M8-21).
|
|
4
|
+
//
|
|
5
|
+
// A template is a versioned project skeleton. Templates live under
|
|
6
|
+
// `templates/<name>/` and are tested as actual applications in CI. The
|
|
7
|
+
// manifest declares what the template produces, what variables it expects,
|
|
8
|
+
// and what compatibility range it supports.
|
|
9
|
+
//
|
|
10
|
+
// Per post-M7 roadmap §2.3 Phase D: "These templates should be versioned
|
|
11
|
+
// and tested as actual applications. They must not become collections of
|
|
12
|
+
// stale snippets."
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
export const TEMPLATE_MANIFEST_SCHEMA_VERSION = 1;
|
|
15
|
+
export const TemplateVariableSchema = z.object({
|
|
16
|
+
name: z.string().min(1),
|
|
17
|
+
description: z.string().min(1),
|
|
18
|
+
required: z.boolean(),
|
|
19
|
+
// Regex the value must match; e.g., project name format.
|
|
20
|
+
pattern: z.string().optional(),
|
|
21
|
+
defaultValue: z.string().optional(),
|
|
22
|
+
});
|
|
23
|
+
export const TemplateManifestSchema = z.object({
|
|
24
|
+
schemaVersion: z.literal(TEMPLATE_MANIFEST_SCHEMA_VERSION),
|
|
25
|
+
id: z.string().regex(/^[a-z][a-z0-9-]*$/, 'template id must be kebab-case'),
|
|
26
|
+
name: z.string().min(1),
|
|
27
|
+
description: z.string().min(1),
|
|
28
|
+
version: z.string().regex(/^\d+\.\d+\.\d+$/, 'semver'),
|
|
29
|
+
// Stacks this template produces.
|
|
30
|
+
stacks: z.array(z.string()).min(1),
|
|
31
|
+
// Variables the template expects when rendered.
|
|
32
|
+
variables: z.array(TemplateVariableSchema).default([]),
|
|
33
|
+
// Files the template will generate (relative paths).
|
|
34
|
+
files: z.array(z.object({
|
|
35
|
+
path: z.string().min(1),
|
|
36
|
+
// True if the file is a template (needs variable substitution).
|
|
37
|
+
templated: z.boolean(),
|
|
38
|
+
// True if the file should not be overwritten on re-generation.
|
|
39
|
+
preserve: z.boolean().default(false),
|
|
40
|
+
})),
|
|
41
|
+
// Compatibility range for the kit itself.
|
|
42
|
+
kitCompatibility: z.string().min(1),
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=template-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-manifest.js","sourceRoot":"","sources":["../../src/scaffolding/template-manifest.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,EAAE;AACF,0DAA0D;AAC1D,EAAE;AACF,mEAAmE;AACnE,uEAAuE;AACvE,2EAA2E;AAC3E,4CAA4C;AAC5C,EAAE;AACF,yEAAyE;AACzE,yEAAyE;AACzE,mBAAmB;AAEnB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAU,CAAC;AAE3D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,yDAAyD;IACzD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,gCAAgC,CAAC;IAC1D,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mBAAmB,EAAE,gCAAgC,CAAC;IAC3E,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,iBAAiB,EAAE,QAAQ,CAAC;IACtD,iCAAiC;IACjC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAClC,gDAAgD;IAChD,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACtD,qDAAqD;IACrD,KAAK,EAAE,CAAC,CAAC,KAAK,CACZ,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACvB,gEAAgE;QAChE,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;QACtB,+DAA+D;QAC/D,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;KACrC,CAAC,CACH;IACD,0CAA0C;IAC1C,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACpC,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const DetectionRuleSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
kind: z.ZodEnum<["aws-access-key", "aws-secret-key", "github-token", "gitlab-token", "google-api-key", "google-oauth-id", "stripe-key", "slack-token", "generic-api-key", "private-key-pem", "jwt", "connection-string", "bearer-token", "unknown"]>;
|
|
6
|
+
pattern: z.ZodString;
|
|
7
|
+
checksumValidator: z.ZodOptional<z.ZodString>;
|
|
8
|
+
severity: z.ZodEnum<["low", "medium", "high", "critical"]>;
|
|
9
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
name: string;
|
|
12
|
+
id: string;
|
|
13
|
+
severity: "low" | "medium" | "high" | "critical";
|
|
14
|
+
kind: "unknown" | "jwt" | "aws-access-key" | "aws-secret-key" | "github-token" | "gitlab-token" | "google-api-key" | "google-oauth-id" | "stripe-key" | "slack-token" | "generic-api-key" | "private-key-pem" | "connection-string" | "bearer-token";
|
|
15
|
+
pattern: string;
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
checksumValidator?: string | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
name: string;
|
|
20
|
+
id: string;
|
|
21
|
+
severity: "low" | "medium" | "high" | "critical";
|
|
22
|
+
kind: "unknown" | "jwt" | "aws-access-key" | "aws-secret-key" | "github-token" | "gitlab-token" | "google-api-key" | "google-oauth-id" | "stripe-key" | "slack-token" | "generic-api-key" | "private-key-pem" | "connection-string" | "bearer-token";
|
|
23
|
+
pattern: string;
|
|
24
|
+
checksumValidator?: string | undefined;
|
|
25
|
+
enabled?: boolean | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
export type DetectionRule = z.infer<typeof DetectionRuleSchema>;
|
|
28
|
+
/**
|
|
29
|
+
* Built-in detection rules. The M11 detector ships these by default;
|
|
30
|
+
// additional rules can be loaded from a user configuration.
|
|
31
|
+
*/
|
|
32
|
+
export declare const BUILTIN_DETECTION_RULES: ReadonlyArray<DetectionRule>;
|
|
33
|
+
//# sourceMappingURL=detection-rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detection-rule.d.ts","sourceRoot":"","sources":["../../src/secret-guard/detection-rule.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;EAc9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,aAAa,CAAC,aAAa,CAiFhE,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// packages/contracts/src/secret-guard/detection-rule.ts
|
|
2
|
+
//
|
|
3
|
+
// Detection rule contract (M11 — M11-02).
|
|
4
|
+
//
|
|
5
|
+
// A detection rule is a named pattern + optional checksum validation that
|
|
6
|
+
// the detector applies to input. Built-in rules cover the common cloud and
|
|
7
|
+
// VCS tokens; the M11 Mod adds Gitleaks as an optional extended scanner.
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { SecretKindSchema } from './finding.js';
|
|
10
|
+
export const DetectionRuleSchema = z.object({
|
|
11
|
+
id: z.string(),
|
|
12
|
+
name: z.string().min(1),
|
|
13
|
+
kind: SecretKindSchema,
|
|
14
|
+
// ECMAScript regex source (string form). The detector compiles and
|
|
15
|
+
// applies this with the global flag.
|
|
16
|
+
pattern: z.string().min(1),
|
|
17
|
+
// Optional checksum validator function name (e.g., "aws-key-checksum").
|
|
18
|
+
// The detector looks up the named validator in a registry; if absent,
|
|
19
|
+
// confidence is downgraded to "medium".
|
|
20
|
+
checksumValidator: z.string().optional(),
|
|
21
|
+
severity: z.enum(['low', 'medium', 'high', 'critical']),
|
|
22
|
+
// Whether this rule is enabled by default.
|
|
23
|
+
enabled: z.boolean().default(true),
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Built-in detection rules. The M11 detector ships these by default;
|
|
27
|
+
// additional rules can be loaded from a user configuration.
|
|
28
|
+
*/
|
|
29
|
+
export const BUILTIN_DETECTION_RULES = [
|
|
30
|
+
{
|
|
31
|
+
id: 'aws-access-key',
|
|
32
|
+
name: 'AWS Access Key ID',
|
|
33
|
+
kind: 'aws-access-key',
|
|
34
|
+
pattern: 'AKIA[0-9A-Z]{16}',
|
|
35
|
+
checksumValidator: 'aws-key-checksum',
|
|
36
|
+
severity: 'high',
|
|
37
|
+
enabled: true,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 'aws-secret-key',
|
|
41
|
+
name: 'AWS Secret Access Key',
|
|
42
|
+
kind: 'aws-secret-key',
|
|
43
|
+
// 40-char base64-ish string after an assignment with aws_secret hint.
|
|
44
|
+
pattern: '(?:aws_secret|secretAccessKey|secret_access_key)["\']?\\s*[:=]\\s*["\']?([A-Za-z0-9/+]{40})',
|
|
45
|
+
severity: 'critical',
|
|
46
|
+
enabled: true,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'github-token',
|
|
50
|
+
name: 'GitHub Personal Access Token',
|
|
51
|
+
kind: 'github-token',
|
|
52
|
+
pattern: 'gh[pousr]_[A-Za-z0-9]{36,}',
|
|
53
|
+
severity: 'critical',
|
|
54
|
+
enabled: true,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'gitlab-token',
|
|
58
|
+
name: 'GitLab Token',
|
|
59
|
+
kind: 'gitlab-token',
|
|
60
|
+
pattern: 'glpat-[A-Za-z0-9_-]{20}',
|
|
61
|
+
severity: 'high',
|
|
62
|
+
enabled: true,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'google-api-key',
|
|
66
|
+
name: 'Google API Key',
|
|
67
|
+
kind: 'google-api-key',
|
|
68
|
+
pattern: 'AIza[0-9A-Za-z_-]{35}',
|
|
69
|
+
severity: 'high',
|
|
70
|
+
enabled: true,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 'stripe-key',
|
|
74
|
+
name: 'Stripe Secret Key',
|
|
75
|
+
kind: 'stripe-key',
|
|
76
|
+
pattern: 'sk_(?:live|test)_[0-9a-zA-Z]{24,}',
|
|
77
|
+
severity: 'critical',
|
|
78
|
+
enabled: true,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'slack-token',
|
|
82
|
+
name: 'Slack Token',
|
|
83
|
+
kind: 'slack-token',
|
|
84
|
+
pattern: 'xox[baprs]-[0-9A-Za-z-]{10,}',
|
|
85
|
+
severity: 'high',
|
|
86
|
+
enabled: true,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'private-key-pem',
|
|
90
|
+
name: 'PEM Private Key',
|
|
91
|
+
kind: 'private-key-pem',
|
|
92
|
+
pattern: '-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY-----',
|
|
93
|
+
severity: 'critical',
|
|
94
|
+
enabled: true,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'generic-api-key',
|
|
98
|
+
name: 'Generic API Key Assignment',
|
|
99
|
+
kind: 'generic-api-key',
|
|
100
|
+
// Heuristic: a variable name containing "key"/"token"/"secret"
|
|
101
|
+
// assigned to a 32+ char string. Low confidence by design.
|
|
102
|
+
// Note: ECMAScript regex does not support the (?i) inline flag, so we
|
|
103
|
+
// use explicit case-insensitive character classes for the variable name.
|
|
104
|
+
pattern: '(?:[Aa][Pp][Ii][_\\-]?[Kk][Ee][Yy]|[Aa][Uu][Tt][Hh][_\\-]?[Tt][Oo][Kk][Ee][Nn]|[Ss][Ee][Cc][Rr][Ee][Tt])\\s*[:=]\\s*["\']([A-Za-z0-9_+/=-]{32,})["\']',
|
|
105
|
+
severity: 'medium',
|
|
106
|
+
enabled: true,
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
//# sourceMappingURL=detection-rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detection-rule.js","sourceRoot":"","sources":["../../src/secret-guard/detection-rule.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SecretKindSchema: z.ZodEnum<["aws-access-key", "aws-secret-key", "github-token", "gitlab-token", "google-api-key", "google-oauth-id", "stripe-key", "slack-token", "generic-api-key", "private-key-pem", "jwt", "connection-string", "bearer-token", "unknown"]>;
|
|
3
|
+
export declare const SecretSeveritySchema: z.ZodEnum<["low", "medium", "high", "critical"]>;
|
|
4
|
+
export declare const SecretFindingSchema: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
kind: z.ZodEnum<["aws-access-key", "aws-secret-key", "github-token", "gitlab-token", "google-api-key", "google-oauth-id", "stripe-key", "slack-token", "generic-api-key", "private-key-pem", "jwt", "connection-string", "bearer-token", "unknown"]>;
|
|
7
|
+
location: z.ZodEffects<z.ZodObject<{
|
|
8
|
+
filePath: z.ZodOptional<z.ZodString>;
|
|
9
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
length: z.ZodNumber;
|
|
13
|
+
source: z.ZodEnum<["file-read", "file-write", "tool-output", "git-staged", "git-commit", "git-push", "mcp-response"]>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
length: number;
|
|
16
|
+
source: "file-read" | "file-write" | "tool-output" | "git-staged" | "git-commit" | "git-push" | "mcp-response";
|
|
17
|
+
filePath?: string | undefined;
|
|
18
|
+
line?: number | undefined;
|
|
19
|
+
column?: number | undefined;
|
|
20
|
+
offset?: number | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
length: number;
|
|
23
|
+
source: "file-read" | "file-write" | "tool-output" | "git-staged" | "git-commit" | "git-push" | "mcp-response";
|
|
24
|
+
filePath?: string | undefined;
|
|
25
|
+
line?: number | undefined;
|
|
26
|
+
column?: number | undefined;
|
|
27
|
+
offset?: number | undefined;
|
|
28
|
+
}>, {
|
|
29
|
+
length: number;
|
|
30
|
+
source: "file-read" | "file-write" | "tool-output" | "git-staged" | "git-commit" | "git-push" | "mcp-response";
|
|
31
|
+
filePath?: string | undefined;
|
|
32
|
+
line?: number | undefined;
|
|
33
|
+
column?: number | undefined;
|
|
34
|
+
offset?: number | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
length: number;
|
|
37
|
+
source: "file-read" | "file-write" | "tool-output" | "git-staged" | "git-commit" | "git-push" | "mcp-response";
|
|
38
|
+
filePath?: string | undefined;
|
|
39
|
+
line?: number | undefined;
|
|
40
|
+
column?: number | undefined;
|
|
41
|
+
offset?: number | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
detector: z.ZodEnum<["builtin", "gitleaks", "trufflehog", "custom"]>;
|
|
44
|
+
confidence: z.ZodEnum<["low", "medium", "high"]>;
|
|
45
|
+
severity: z.ZodEnum<["low", "medium", "high", "critical"]>;
|
|
46
|
+
redactedPreview: z.ZodString;
|
|
47
|
+
redacted: z.ZodDefault<z.ZodBoolean>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
id: string;
|
|
50
|
+
severity: "low" | "medium" | "high" | "critical";
|
|
51
|
+
kind: "unknown" | "jwt" | "aws-access-key" | "aws-secret-key" | "github-token" | "gitlab-token" | "google-api-key" | "google-oauth-id" | "stripe-key" | "slack-token" | "generic-api-key" | "private-key-pem" | "connection-string" | "bearer-token";
|
|
52
|
+
location: {
|
|
53
|
+
length: number;
|
|
54
|
+
source: "file-read" | "file-write" | "tool-output" | "git-staged" | "git-commit" | "git-push" | "mcp-response";
|
|
55
|
+
filePath?: string | undefined;
|
|
56
|
+
line?: number | undefined;
|
|
57
|
+
column?: number | undefined;
|
|
58
|
+
offset?: number | undefined;
|
|
59
|
+
};
|
|
60
|
+
detector: "custom" | "builtin" | "gitleaks" | "trufflehog";
|
|
61
|
+
confidence: "low" | "medium" | "high";
|
|
62
|
+
redactedPreview: string;
|
|
63
|
+
redacted: boolean;
|
|
64
|
+
}, {
|
|
65
|
+
id: string;
|
|
66
|
+
severity: "low" | "medium" | "high" | "critical";
|
|
67
|
+
kind: "unknown" | "jwt" | "aws-access-key" | "aws-secret-key" | "github-token" | "gitlab-token" | "google-api-key" | "google-oauth-id" | "stripe-key" | "slack-token" | "generic-api-key" | "private-key-pem" | "connection-string" | "bearer-token";
|
|
68
|
+
location: {
|
|
69
|
+
length: number;
|
|
70
|
+
source: "file-read" | "file-write" | "tool-output" | "git-staged" | "git-commit" | "git-push" | "mcp-response";
|
|
71
|
+
filePath?: string | undefined;
|
|
72
|
+
line?: number | undefined;
|
|
73
|
+
column?: number | undefined;
|
|
74
|
+
offset?: number | undefined;
|
|
75
|
+
};
|
|
76
|
+
detector: "custom" | "builtin" | "gitleaks" | "trufflehog";
|
|
77
|
+
confidence: "low" | "medium" | "high";
|
|
78
|
+
redactedPreview: string;
|
|
79
|
+
redacted?: boolean | undefined;
|
|
80
|
+
}>;
|
|
81
|
+
export type SecretKind = z.infer<typeof SecretKindSchema>;
|
|
82
|
+
export type SecretSeverity = z.infer<typeof SecretSeveritySchema>;
|
|
83
|
+
export type SecretFinding = z.infer<typeof SecretFindingSchema>;
|
|
84
|
+
/**
|
|
85
|
+
* Produce a redacted preview of a secret value. NEVER returns the full
|
|
86
|
+
* value. For secrets shorter than 12 chars, returns "[REDACTED:<n>]".
|
|
87
|
+
*/
|
|
88
|
+
export declare function redactedPreview(value: string): string;
|
|
89
|
+
//# sourceMappingURL=finding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finding.d.ts","sourceRoot":"","sources":["../../src/secret-guard/finding.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB,gPAe3B,CAAC;AAMH,eAAO,MAAM,oBAAoB,kDAAgD,CAAC;AAElF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2C9B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKrD"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// packages/contracts/src/secret-guard/finding.ts
|
|
2
|
+
//
|
|
3
|
+
// Secret finding contract (M11 — M11-01).
|
|
4
|
+
//
|
|
5
|
+
// A SecretFinding is the scanner-neutral representation of a detected
|
|
6
|
+
// secret. Different scanners (built-in, Gitleaks, TruffleHog) produce
|
|
7
|
+
// findings in this common shape so that downstream redaction and reporting
|
|
8
|
+
// do not depend on which scanner ran.
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
export const SecretKindSchema = z.enum([
|
|
11
|
+
'aws-access-key',
|
|
12
|
+
'aws-secret-key',
|
|
13
|
+
'github-token',
|
|
14
|
+
'gitlab-token',
|
|
15
|
+
'google-api-key',
|
|
16
|
+
'google-oauth-id',
|
|
17
|
+
'stripe-key',
|
|
18
|
+
'slack-token',
|
|
19
|
+
'generic-api-key',
|
|
20
|
+
'private-key-pem',
|
|
21
|
+
'jwt',
|
|
22
|
+
'connection-string',
|
|
23
|
+
'bearer-token',
|
|
24
|
+
'unknown',
|
|
25
|
+
]);
|
|
26
|
+
// Renamed to SecretSeveritySchema to avoid collision with the
|
|
27
|
+
// specification.ts SeveritySchema (which is 3-level "low|medium|high" for
|
|
28
|
+
// risk severity). Secret severity is 4-level because secrets can be
|
|
29
|
+
// "critical" (e.g., production keys).
|
|
30
|
+
export const SecretSeveritySchema = z.enum(['low', 'medium', 'high', 'critical']);
|
|
31
|
+
export const SecretFindingSchema = z.object({
|
|
32
|
+
id: z.string(),
|
|
33
|
+
kind: SecretKindSchema,
|
|
34
|
+
// Where the secret was found.
|
|
35
|
+
location: z
|
|
36
|
+
.object({
|
|
37
|
+
// File path (if file-based).
|
|
38
|
+
filePath: z.string().optional(),
|
|
39
|
+
// 1-indexed line number (if known).
|
|
40
|
+
line: z.number().int().positive().optional(),
|
|
41
|
+
// 1-indexed column (if known).
|
|
42
|
+
column: z.number().int().nonnegative().optional(),
|
|
43
|
+
// 0-indexed offset (if known).
|
|
44
|
+
offset: z.number().int().nonnegative().optional(),
|
|
45
|
+
// Length of the matched secret in bytes.
|
|
46
|
+
length: z.number().int().positive(),
|
|
47
|
+
// Source: where the secret was observed.
|
|
48
|
+
source: z.enum([
|
|
49
|
+
'file-read',
|
|
50
|
+
'file-write',
|
|
51
|
+
'tool-output',
|
|
52
|
+
'git-staged',
|
|
53
|
+
'git-commit',
|
|
54
|
+
'git-push',
|
|
55
|
+
'mcp-response',
|
|
56
|
+
]),
|
|
57
|
+
})
|
|
58
|
+
.refine((l) => l.filePath !== undefined || l.offset !== undefined, {
|
|
59
|
+
message: 'location must have filePath or offset',
|
|
60
|
+
}),
|
|
61
|
+
// The detector that produced this finding.
|
|
62
|
+
detector: z.enum(['builtin', 'gitleaks', 'trufflehog', 'custom']),
|
|
63
|
+
// Confidence: high = pattern + checksum valid; medium = pattern only;
|
|
64
|
+
// low = heuristic match.
|
|
65
|
+
confidence: z.enum(['low', 'medium', 'high']),
|
|
66
|
+
severity: SecretSeveritySchema,
|
|
67
|
+
// A redacted preview: first 4 chars + "…" + last 4 chars, only if the
|
|
68
|
+
// secret is long enough. NEVER the full secret.
|
|
69
|
+
redactedPreview: z.string(),
|
|
70
|
+
// Whether the finding was confirmed to be redacted in the output.
|
|
71
|
+
// INVARIANT (post-M7 §5): a finding does not prove redaction. This flag
|
|
72
|
+
// is set only after the redactor has verified the value is gone.
|
|
73
|
+
redacted: z.boolean().default(false),
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* Produce a redacted preview of a secret value. NEVER returns the full
|
|
77
|
+
* value. For secrets shorter than 12 chars, returns "[REDACTED:<n>]".
|
|
78
|
+
*/
|
|
79
|
+
export function redactedPreview(value) {
|
|
80
|
+
if (value.length < 12) {
|
|
81
|
+
return `[REDACTED:${value.length}]`;
|
|
82
|
+
}
|
|
83
|
+
return `${value.slice(0, 4)}…${value.slice(-4)}`;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=finding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finding.js","sourceRoot":"","sources":["../../src/secret-guard/finding.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/secret-guard/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/secret-guard/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const REDACTION_POLICY_SCHEMA_VERSION: 1;
|
|
3
|
+
export declare const RedactionPolicySchema: z.ZodObject<{
|
|
4
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
5
|
+
placeholderFormat: z.ZodDefault<z.ZodEnum<["[REDACTED]", "[REDACTED:<kind>]", "[REDACTED:<kind>:<id>]"]>>;
|
|
6
|
+
redactPartial: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
+
redactRepeated: z.ZodDefault<z.ZodBoolean>;
|
|
8
|
+
maxInputBytes: z.ZodDefault<z.ZodNumber>;
|
|
9
|
+
ignorePaths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
schemaVersion: 1;
|
|
12
|
+
placeholderFormat: "[REDACTED]" | "[REDACTED:<kind>]" | "[REDACTED:<kind>:<id>]";
|
|
13
|
+
redactPartial: boolean;
|
|
14
|
+
redactRepeated: boolean;
|
|
15
|
+
maxInputBytes: number;
|
|
16
|
+
ignorePaths: string[];
|
|
17
|
+
}, {
|
|
18
|
+
schemaVersion: 1;
|
|
19
|
+
placeholderFormat?: "[REDACTED]" | "[REDACTED:<kind>]" | "[REDACTED:<kind>:<id>]" | undefined;
|
|
20
|
+
redactPartial?: boolean | undefined;
|
|
21
|
+
redactRepeated?: boolean | undefined;
|
|
22
|
+
maxInputBytes?: number | undefined;
|
|
23
|
+
ignorePaths?: string[] | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
export type RedactionPolicy = z.infer<typeof RedactionPolicySchema>;
|
|
26
|
+
//# sourceMappingURL=redaction-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redaction-policy.d.ts","sourceRoot":"","sources":["../../src/secret-guard/redaction-policy.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,+BAA+B,EAAG,CAAU,CAAC;AAE1D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;EAmBhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// packages/contracts/src/secret-guard/redaction-policy.ts
|
|
2
|
+
//
|
|
3
|
+
// Redaction policy (M11 — M11-04).
|
|
4
|
+
//
|
|
5
|
+
// The redactor replaces detected secret values with a placeholder in tool
|
|
6
|
+
// output, file writes, and git operations. The policy declares what
|
|
7
|
+
// placeholder to use and how to handle repeated and partial occurrences.
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
export const REDACTION_POLICY_SCHEMA_VERSION = 1;
|
|
10
|
+
export const RedactionPolicySchema = z.object({
|
|
11
|
+
schemaVersion: z.literal(REDACTION_POLICY_SCHEMA_VERSION),
|
|
12
|
+
// Placeholder format: "[REDACTED:<kind>:<id>]" by default.
|
|
13
|
+
placeholderFormat: z
|
|
14
|
+
.enum(['[REDACTED]', '[REDACTED:<kind>]', '[REDACTED:<kind>:<id>]'])
|
|
15
|
+
.default('[REDACTED:<kind>:<id>]'),
|
|
16
|
+
// Whether to redact partial occurrences (e.g., a secret that spans
|
|
17
|
+
// multiple lines or appears in a base64-encoded payload).
|
|
18
|
+
redactPartial: z.boolean().default(true),
|
|
19
|
+
// Whether to redact repeated occurrences in the same output.
|
|
20
|
+
redactRepeated: z.boolean().default(true),
|
|
21
|
+
// Maximum input size (bytes) the redactor will process. Inputs larger
|
|
22
|
+
// than this are returned with a "REDACTION_SKIPPED_TOO_LARGE" notice
|
|
23
|
+
// rather than being silently passed through.
|
|
24
|
+
maxInputBytes: z.number().int().positive().default(1_000_000),
|
|
25
|
+
// Explicit ignore paths (e.g., test fixtures that intentionally contain
|
|
26
|
+
// synthetic secrets). MUST be specific paths, not globs that could
|
|
27
|
+
// match arbitrary files.
|
|
28
|
+
ignorePaths: z.array(z.string()).default([]),
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=redaction-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redaction-policy.js","sourceRoot":"","sources":["../../src/secret-guard/redaction-policy.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,EAAE;AACF,mCAAmC;AACnC,EAAE;AACF,0EAA0E;AAC1E,oEAAoE;AACpE,yEAAyE;AAEzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAU,CAAC;AAE1D,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,+BAA+B,CAAC;IACzD,2DAA2D;IAC3D,iBAAiB,EAAE,CAAC;SACjB,IAAI,CAAC,CAAC,YAAY,EAAE,mBAAmB,EAAE,wBAAwB,CAAC,CAAC;SACnE,OAAO,CAAC,wBAAwB,CAAC;IACpC,mEAAmE;IACnE,0DAA0D;IAC1D,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACxC,6DAA6D;IAC7D,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACzC,sEAAsE;IACtE,qEAAqE;IACrE,6CAA6C;IAC7C,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;IAC7D,wEAAwE;IACxE,mEAAmE;IACnE,yBAAyB;IACzB,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CAC7C,CAAC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ScannerOutcomeSchema: z.ZodEnum<["clean", "findings", "failed", "skipped-too-large", "skipped-ignored"]>;
|
|
3
|
+
export declare const ScannerResultSchema: z.ZodObject<{
|
|
4
|
+
outcome: z.ZodEnum<["clean", "findings", "failed", "skipped-too-large", "skipped-ignored"]>;
|
|
5
|
+
findings: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
kind: z.ZodString;
|
|
8
|
+
redactedPreview: z.ZodString;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
id: string;
|
|
11
|
+
kind: string;
|
|
12
|
+
redactedPreview: string;
|
|
13
|
+
}, {
|
|
14
|
+
id: string;
|
|
15
|
+
kind: string;
|
|
16
|
+
redactedPreview: string;
|
|
17
|
+
}>, "many">>;
|
|
18
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
code: z.ZodString;
|
|
20
|
+
message: z.ZodString;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
code: string;
|
|
23
|
+
message: string;
|
|
24
|
+
}, {
|
|
25
|
+
code: string;
|
|
26
|
+
message: string;
|
|
27
|
+
}>>;
|
|
28
|
+
bytesProcessed: z.ZodNumber;
|
|
29
|
+
durationMs: z.ZodNumber;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
durationMs: number;
|
|
32
|
+
outcome: "failed" | "clean" | "findings" | "skipped-too-large" | "skipped-ignored";
|
|
33
|
+
findings: {
|
|
34
|
+
id: string;
|
|
35
|
+
kind: string;
|
|
36
|
+
redactedPreview: string;
|
|
37
|
+
}[];
|
|
38
|
+
bytesProcessed: number;
|
|
39
|
+
error?: {
|
|
40
|
+
code: string;
|
|
41
|
+
message: string;
|
|
42
|
+
} | undefined;
|
|
43
|
+
}, {
|
|
44
|
+
durationMs: number;
|
|
45
|
+
outcome: "failed" | "clean" | "findings" | "skipped-too-large" | "skipped-ignored";
|
|
46
|
+
bytesProcessed: number;
|
|
47
|
+
findings?: {
|
|
48
|
+
id: string;
|
|
49
|
+
kind: string;
|
|
50
|
+
redactedPreview: string;
|
|
51
|
+
}[] | undefined;
|
|
52
|
+
error?: {
|
|
53
|
+
code: string;
|
|
54
|
+
message: string;
|
|
55
|
+
} | undefined;
|
|
56
|
+
}>;
|
|
57
|
+
export type ScannerOutcome = z.infer<typeof ScannerOutcomeSchema>;
|
|
58
|
+
export type ScannerResult = z.infer<typeof ScannerResultSchema>;
|
|
59
|
+
//# sourceMappingURL=scanner-failure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanner-failure.d.ts","sourceRoot":"","sources":["../../src/secret-guard/scanner-failure.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,oBAAoB,oFAM/B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwB9B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// packages/contracts/src/secret-guard/scanner-failure.ts
|
|
2
|
+
//
|
|
3
|
+
// Scanner failure behavior (M11 — M11-09).
|
|
4
|
+
//
|
|
5
|
+
// INVARIANT (post-M7 §5): a scanner failure MUST be visible. It MUST NOT
|
|
6
|
+
// be reported as a clean result. The ScannerOutcome contract makes this
|
|
7
|
+
// explicit: the outcome is one of "clean", "findings", "failed", or
|
|
8
|
+
// "skipped-too-large" — never an implicit "clean" when the scanner errored.
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
export const ScannerOutcomeSchema = z.enum([
|
|
11
|
+
'clean', // scanner ran successfully and found no secrets
|
|
12
|
+
'findings', // scanner ran successfully and found secrets
|
|
13
|
+
'failed', // scanner errored; results are NOT trustworthy
|
|
14
|
+
'skipped-too-large', // input exceeded maxInputBytes; not scanned
|
|
15
|
+
'skipped-ignored', // path was in ignorePaths; not scanned
|
|
16
|
+
]);
|
|
17
|
+
export const ScannerResultSchema = z.object({
|
|
18
|
+
outcome: ScannerOutcomeSchema,
|
|
19
|
+
// Present only when outcome === "findings".
|
|
20
|
+
findings: z
|
|
21
|
+
.array(z.object({
|
|
22
|
+
id: z.string(),
|
|
23
|
+
kind: z.string(),
|
|
24
|
+
redactedPreview: z.string(),
|
|
25
|
+
}))
|
|
26
|
+
.default([]),
|
|
27
|
+
// Present only when outcome === "failed". NEVER includes the input that
|
|
28
|
+
// caused the failure (could contain a secret).
|
|
29
|
+
error: z
|
|
30
|
+
.object({
|
|
31
|
+
code: z.string(),
|
|
32
|
+
message: z.string(),
|
|
33
|
+
})
|
|
34
|
+
.optional(),
|
|
35
|
+
// The number of bytes scanned (or skipped).
|
|
36
|
+
bytesProcessed: z.number().int().nonnegative(),
|
|
37
|
+
// Duration in milliseconds.
|
|
38
|
+
durationMs: z.number().int().nonnegative(),
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=scanner-failure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanner-failure.js","sourceRoot":"","sources":["../../src/secret-guard/scanner-failure.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,EAAE;AACF,2CAA2C;AAC3C,EAAE;AACF,yEAAyE;AACzE,wEAAwE;AACxE,oEAAoE;AACpE,4EAA4E;AAE5E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC;IACzC,OAAO,EAAE,gDAAgD;IACzD,UAAU,EAAE,6CAA6C;IACzD,QAAQ,EAAE,+CAA+C;IACzD,mBAAmB,EAAE,4CAA4C;IACjE,iBAAiB,EAAE,uCAAuC;CAC3D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,OAAO,EAAE,oBAAoB;IAC7B,4CAA4C;IAC5C,QAAQ,EAAE,CAAC;SACR,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;KAC5B,CAAC,CACH;SACA,OAAO,CAAC,EAAE,CAAC;IACd,wEAAwE;IACxE,+CAA+C;IAC/C,KAAK,EAAE,CAAC;SACL,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC;SACD,QAAQ,EAAE;IACb,4CAA4C;IAC5C,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC9C,4BAA4B;IAC5B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;CAC3C,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/specification/index.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/specification/index.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,cAAc,oBAAoB,CAAC"}
|