wingfoil 0.2.2 → 0.3.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/README.md +83 -43
- package/dist/agent/discovery.d.ts +72 -0
- package/dist/agent/discovery.d.ts.map +1 -0
- package/dist/agent/discovery.js +210 -0
- package/dist/agent/discovery.js.map +1 -0
- package/dist/agent/execute.d.ts +206 -0
- package/dist/agent/execute.d.ts.map +1 -0
- package/dist/agent/execute.js +581 -0
- package/dist/agent/execute.js.map +1 -0
- package/dist/agent/index.d.ts +23 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +85 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/launch.d.ts +133 -0
- package/dist/agent/launch.d.ts.map +1 -0
- package/dist/agent/launch.js +380 -0
- package/dist/agent/launch.js.map +1 -0
- package/dist/agent/manifest.d.ts +30 -0
- package/dist/agent/manifest.d.ts.map +1 -0
- package/dist/agent/manifest.js +93 -0
- package/dist/agent/manifest.js.map +1 -0
- package/dist/agent/placeholders.d.ts +49 -0
- package/dist/agent/placeholders.d.ts.map +1 -0
- package/dist/agent/placeholders.js +177 -0
- package/dist/agent/placeholders.js.map +1 -0
- package/dist/agent/run-log.d.ts +254 -0
- package/dist/agent/run-log.d.ts.map +1 -0
- package/dist/agent/run-log.js +612 -0
- package/dist/agent/run-log.js.map +1 -0
- package/dist/agent/schema.d.ts +100 -0
- package/dist/agent/schema.d.ts.map +1 -0
- package/dist/agent/schema.js +89 -0
- package/dist/agent/schema.js.map +1 -0
- package/dist/agent/step.d.ts +41 -0
- package/dist/agent/step.d.ts.map +1 -0
- package/dist/agent/step.js +95 -0
- package/dist/agent/step.js.map +1 -0
- package/dist/build-info.json +4 -0
- package/dist/cli/error.d.ts +11 -2
- package/dist/cli/error.d.ts.map +1 -1
- package/dist/cli/error.js +27 -6
- package/dist/cli/error.js.map +1 -1
- package/dist/cli/exit.d.ts +33 -3
- package/dist/cli/exit.d.ts.map +1 -1
- package/dist/cli/exit.js +54 -3
- package/dist/cli/exit.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init-command.d.ts.map +1 -1
- package/dist/cli/init-command.js +4 -2
- package/dist/cli/init-command.js.map +1 -1
- package/dist/cli/mcp-command.d.ts +13 -4
- package/dist/cli/mcp-command.d.ts.map +1 -1
- package/dist/cli/mcp-command.js +25 -8
- package/dist/cli/mcp-command.js.map +1 -1
- package/dist/cli/output.d.ts +12 -4
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +15 -4
- package/dist/cli/output.js.map +1 -1
- package/dist/cli/program.d.ts +1 -1
- package/dist/cli/program.d.ts.map +1 -1
- package/dist/cli/program.js +162 -40
- package/dist/cli/program.js.map +1 -1
- package/dist/cli/registrar.d.ts +1 -1
- package/dist/cli/registrar.d.ts.map +1 -1
- package/dist/cli/registrar.js +67 -6
- package/dist/cli/registrar.js.map +1 -1
- package/dist/cli/suggest.d.ts +20 -0
- package/dist/cli/suggest.d.ts.map +1 -0
- package/dist/cli/suggest.js +49 -0
- package/dist/cli/suggest.js.map +1 -0
- package/dist/cli/warning.d.ts +26 -0
- package/dist/cli/warning.d.ts.map +1 -0
- package/dist/cli/warning.js +66 -0
- package/dist/cli/warning.js.map +1 -0
- package/dist/cli.js +11 -2
- package/dist/cli.js.map +1 -1
- package/dist/core/agent-execute.d.ts +44 -0
- package/dist/core/agent-execute.d.ts.map +1 -0
- package/dist/core/agent-execute.js +71 -0
- package/dist/core/agent-execute.js.map +1 -0
- package/dist/core/agent-list.d.ts +95 -0
- package/dist/core/agent-list.d.ts.map +1 -0
- package/dist/core/agent-list.js +207 -0
- package/dist/core/agent-list.js.map +1 -0
- package/dist/core/agent-show.d.ts +44 -0
- package/dist/core/agent-show.d.ts.map +1 -0
- package/dist/core/agent-show.js +188 -0
- package/dist/core/agent-show.js.map +1 -0
- package/dist/core/approval-authority.d.ts +17 -14
- package/dist/core/approval-authority.d.ts.map +1 -1
- package/dist/core/approval-authority.js +9 -9
- package/dist/core/approval-authority.js.map +1 -1
- package/dist/core/builtin-asset.d.ts +18 -15
- package/dist/core/builtin-asset.d.ts.map +1 -1
- package/dist/core/builtin-asset.js +17 -14
- package/dist/core/builtin-asset.js.map +1 -1
- package/dist/core/builtin-integrity.d.ts +12 -2
- package/dist/core/builtin-integrity.d.ts.map +1 -1
- package/dist/core/builtin-integrity.js +85 -9
- package/dist/core/builtin-integrity.js.map +1 -1
- package/dist/core/confinement.d.ts +3 -1
- package/dist/core/confinement.d.ts.map +1 -1
- package/dist/core/confinement.js +7 -4
- package/dist/core/confinement.js.map +1 -1
- package/dist/core/context.d.ts +150 -98
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/context.js +602 -66
- package/dist/core/context.js.map +1 -1
- package/dist/core/directive-assign.d.ts +33 -7
- package/dist/core/directive-assign.d.ts.map +1 -1
- package/dist/core/directive-assign.js +67 -27
- package/dist/core/directive-assign.js.map +1 -1
- package/dist/core/directive-scope.d.ts +36 -0
- package/dist/core/directive-scope.d.ts.map +1 -0
- package/dist/core/directive-scope.js +34 -0
- package/dist/core/directive-scope.js.map +1 -0
- package/dist/core/directives-list.d.ts +13 -3
- package/dist/core/directives-list.d.ts.map +1 -1
- package/dist/core/directives-list.js +18 -6
- package/dist/core/directives-list.js.map +1 -1
- package/dist/core/dry-run.d.ts +33 -0
- package/dist/core/dry-run.d.ts.map +1 -0
- package/dist/core/dry-run.js +45 -0
- package/dist/core/dry-run.js.map +1 -0
- package/dist/core/element-ref.d.ts +23 -0
- package/dist/core/element-ref.d.ts.map +1 -0
- package/dist/core/element-ref.js +24 -0
- package/dist/core/element-ref.js.map +1 -0
- package/dist/core/error-details.d.ts +20 -0
- package/dist/core/error-details.d.ts.map +1 -0
- package/dist/core/error-details.js +65 -0
- package/dist/core/error-details.js.map +1 -0
- package/dist/core/exit-code.d.ts.map +1 -1
- package/dist/core/exit-code.js +6 -7
- package/dist/core/exit-code.js.map +1 -1
- package/dist/core/git-identity.d.ts +46 -11
- package/dist/core/git-identity.d.ts.map +1 -1
- package/dist/core/git-identity.js +140 -27
- package/dist/core/git-identity.js.map +1 -1
- package/dist/core/index.d.ts +184 -10
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1045 -185
- package/dist/core/index.js.map +1 -1
- package/dist/core/init.d.ts +45 -5
- package/dist/core/init.d.ts.map +1 -1
- package/dist/core/init.js +134 -24
- package/dist/core/init.js.map +1 -1
- package/dist/core/loaders.d.ts +170 -14
- package/dist/core/loaders.d.ts.map +1 -1
- package/dist/core/loaders.js +570 -89
- package/dist/core/loaders.js.map +1 -1
- package/dist/core/memory-add-link.d.ts +28 -0
- package/dist/core/memory-add-link.d.ts.map +1 -0
- package/dist/core/memory-add-link.js +67 -0
- package/dist/core/memory-add-link.js.map +1 -0
- package/dist/core/memory-add-type.d.ts +25 -1
- package/dist/core/memory-add-type.d.ts.map +1 -1
- package/dist/core/memory-add-type.js +59 -1
- package/dist/core/memory-add-type.js.map +1 -1
- package/dist/core/memory-amend.d.ts +80 -0
- package/dist/core/memory-amend.d.ts.map +1 -0
- package/dist/core/memory-amend.js +160 -0
- package/dist/core/memory-amend.js.map +1 -0
- package/dist/core/memory-supersede.d.ts +28 -0
- package/dist/core/memory-supersede.d.ts.map +1 -0
- package/dist/core/memory-supersede.js +79 -0
- package/dist/core/memory-supersede.js.map +1 -0
- package/dist/core/memory-transition.d.ts +190 -30
- package/dist/core/memory-transition.d.ts.map +1 -1
- package/dist/core/memory-transition.js +480 -59
- package/dist/core/memory-transition.js.map +1 -1
- package/dist/core/registry.d.ts +82 -10
- package/dist/core/registry.d.ts.map +1 -1
- package/dist/core/registry.js +50 -0
- package/dist/core/registry.js.map +1 -1
- package/dist/core/relevance.d.ts +74 -12
- package/dist/core/relevance.d.ts.map +1 -1
- package/dist/core/relevance.js +45 -27
- package/dist/core/relevance.js.map +1 -1
- package/dist/core/require-reason.d.ts.map +1 -1
- package/dist/core/require-reason.js +6 -5
- package/dist/core/require-reason.js.map +1 -1
- package/dist/core/required-fields.d.ts +28 -0
- package/dist/core/required-fields.d.ts.map +1 -0
- package/dist/core/required-fields.js +60 -0
- package/dist/core/required-fields.js.map +1 -0
- package/dist/core/revision.d.ts +82 -0
- package/dist/core/revision.d.ts.map +1 -0
- package/dist/core/revision.js +144 -0
- package/dist/core/revision.js.map +1 -0
- package/dist/core/types.d.ts +28 -2
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +12 -3
- package/dist/core/types.js.map +1 -1
- package/dist/core/workflow-core-checks.d.ts +34 -0
- package/dist/core/workflow-core-checks.d.ts.map +1 -0
- package/dist/core/workflow-core-checks.js +403 -0
- package/dist/core/workflow-core-checks.js.map +1 -0
- package/dist/core/workflow-create-remove.d.ts +65 -0
- package/dist/core/workflow-create-remove.d.ts.map +1 -0
- package/dist/core/workflow-create-remove.js +277 -0
- package/dist/core/workflow-create-remove.js.map +1 -0
- package/dist/core/workflow-deduction.d.ts +48 -0
- package/dist/core/workflow-deduction.d.ts.map +1 -0
- package/dist/core/workflow-deduction.js +523 -0
- package/dist/core/workflow-deduction.js.map +1 -0
- package/dist/core/workflow-diagnostics.d.ts +83 -0
- package/dist/core/workflow-diagnostics.d.ts.map +1 -0
- package/dist/core/workflow-diagnostics.js +375 -0
- package/dist/core/workflow-diagnostics.js.map +1 -0
- package/dist/core/workflow-exit-state.d.ts +125 -0
- package/dist/core/workflow-exit-state.d.ts.map +1 -0
- package/dist/core/workflow-exit-state.js +243 -0
- package/dist/core/workflow-exit-state.js.map +1 -0
- package/dist/core/workflow-finalize.d.ts +37 -0
- package/dist/core/workflow-finalize.d.ts.map +1 -0
- package/dist/core/workflow-finalize.js +153 -0
- package/dist/core/workflow-finalize.js.map +1 -0
- package/dist/core/workflow-list-show.d.ts +176 -0
- package/dist/core/workflow-list-show.d.ts.map +1 -0
- package/dist/core/workflow-list-show.js +268 -0
- package/dist/core/workflow-list-show.js.map +1 -0
- package/dist/core/workflow-next.d.ts +268 -0
- package/dist/core/workflow-next.d.ts.map +1 -0
- package/dist/core/workflow-next.js +503 -0
- package/dist/core/workflow-next.js.map +1 -0
- package/dist/core/workflow-registry.d.ts +52 -0
- package/dist/core/workflow-registry.d.ts.map +1 -0
- package/dist/core/workflow-registry.js +158 -0
- package/dist/core/workflow-registry.js.map +1 -0
- package/dist/core/workflow-start-end.d.ts +71 -0
- package/dist/core/workflow-start-end.d.ts.map +1 -0
- package/dist/core/workflow-start-end.js +298 -0
- package/dist/core/workflow-start-end.js.map +1 -0
- package/dist/core/workflow-status.d.ts +83 -0
- package/dist/core/workflow-status.d.ts.map +1 -0
- package/dist/core/workflow-status.js +125 -0
- package/dist/core/workflow-status.js.map +1 -0
- package/dist/core/write-guard.d.ts +51 -8
- package/dist/core/write-guard.d.ts.map +1 -1
- package/dist/core/write-guard.js +139 -9
- package/dist/core/write-guard.js.map +1 -1
- package/dist/directives/index.d.ts +3 -2
- package/dist/directives/index.d.ts.map +1 -1
- package/dist/directives/index.js +5 -3
- package/dist/directives/index.js.map +1 -1
- package/dist/directives/schema.d.ts +34 -29
- package/dist/directives/schema.d.ts.map +1 -1
- package/dist/directives/schema.js +35 -29
- package/dist/directives/schema.js.map +1 -1
- package/dist/directives/version.d.ts +28 -0
- package/dist/directives/version.d.ts.map +1 -0
- package/dist/directives/version.js +51 -0
- package/dist/directives/version.js.map +1 -0
- package/dist/dna/edit.d.ts +7 -6
- package/dist/dna/edit.d.ts.map +1 -1
- package/dist/dna/edit.js +96 -41
- package/dist/dna/edit.js.map +1 -1
- package/dist/dna/mutate.js +18 -3
- package/dist/dna/mutate.js.map +1 -1
- package/dist/dna/path.d.ts +2 -2
- package/dist/dna/roles.d.ts +1 -1
- package/dist/dna/schema.d.ts +61 -3
- package/dist/dna/schema.d.ts.map +1 -1
- package/dist/dna/schema.js +121 -6
- package/dist/dna/schema.js.map +1 -1
- package/dist/mcp/dna-resource.d.ts.map +1 -1
- package/dist/mcp/dna-resource.js +4 -4
- package/dist/mcp/dna-resource.js.map +1 -1
- package/dist/mcp/index.d.ts +8 -4
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +13 -2
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/memory-resource.d.ts.map +1 -1
- package/dist/mcp/memory-resource.js +30 -19
- package/dist/mcp/memory-resource.js.map +1 -1
- package/dist/mcp/prompt.d.ts +61 -24
- package/dist/mcp/prompt.d.ts.map +1 -1
- package/dist/mcp/prompt.js +176 -47
- package/dist/mcp/prompt.js.map +1 -1
- package/dist/mcp/read-only.d.ts +39 -0
- package/dist/mcp/read-only.d.ts.map +1 -1
- package/dist/mcp/read-only.js +61 -0
- package/dist/mcp/read-only.js.map +1 -1
- package/dist/mcp/registrar.d.ts +10 -0
- package/dist/mcp/registrar.d.ts.map +1 -1
- package/dist/mcp/registrar.js +48 -12
- package/dist/mcp/registrar.js.map +1 -1
- package/dist/mcp/server.d.ts +21 -14
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +41 -15
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session-resource.d.ts +13 -0
- package/dist/mcp/session-resource.d.ts.map +1 -0
- package/dist/mcp/session-resource.js +65 -0
- package/dist/mcp/session-resource.js.map +1 -0
- package/dist/mcp/workflow-resource.d.ts +18 -0
- package/dist/mcp/workflow-resource.d.ts.map +1 -1
- package/dist/mcp/workflow-resource.js +37 -8
- package/dist/mcp/workflow-resource.js.map +1 -1
- package/dist/memory/add.d.ts +110 -24
- package/dist/memory/add.d.ts.map +1 -1
- package/dist/memory/add.js +251 -64
- package/dist/memory/add.js.map +1 -1
- package/dist/memory/audit.d.ts +152 -39
- package/dist/memory/audit.d.ts.map +1 -1
- package/dist/memory/audit.js +257 -103
- package/dist/memory/audit.js.map +1 -1
- package/dist/memory/commit-message.d.ts +60 -38
- package/dist/memory/commit-message.d.ts.map +1 -1
- package/dist/memory/commit-message.js +167 -21
- package/dist/memory/commit-message.js.map +1 -1
- package/dist/memory/entry.d.ts.map +1 -1
- package/dist/memory/entry.js +1 -2
- package/dist/memory/entry.js.map +1 -1
- package/dist/memory/frontmatter-edit.d.ts +16 -4
- package/dist/memory/frontmatter-edit.d.ts.map +1 -1
- package/dist/memory/frontmatter-edit.js +13 -1
- package/dist/memory/frontmatter-edit.js.map +1 -1
- package/dist/memory/git-log.d.ts +18 -6
- package/dist/memory/git-log.d.ts.map +1 -1
- package/dist/memory/git-log.js +40 -13
- package/dist/memory/git-log.js.map +1 -1
- package/dist/memory/history.d.ts +73 -12
- package/dist/memory/history.d.ts.map +1 -1
- package/dist/memory/history.js +128 -44
- package/dist/memory/history.js.map +1 -1
- package/dist/memory/index.d.ts +13 -11
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/index.js +34 -3
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/query.d.ts +161 -19
- package/dist/memory/query.d.ts.map +1 -1
- package/dist/memory/query.js +435 -55
- package/dist/memory/query.js.map +1 -1
- package/dist/memory/schema.d.ts +52 -3
- package/dist/memory/schema.d.ts.map +1 -1
- package/dist/memory/schema.js +132 -8
- package/dist/memory/schema.js.map +1 -1
- package/dist/memory/state-machine.d.ts +65 -10
- package/dist/memory/state-machine.d.ts.map +1 -1
- package/dist/memory/state-machine.js +134 -46
- package/dist/memory/state-machine.js.map +1 -1
- package/dist/memory/submit.d.ts +52 -3
- package/dist/memory/submit.d.ts.map +1 -1
- package/dist/memory/submit.js +118 -11
- package/dist/memory/submit.js.map +1 -1
- package/dist/storage/build-stamp.d.ts +18 -0
- package/dist/storage/build-stamp.d.ts.map +1 -0
- package/dist/storage/build-stamp.js +68 -0
- package/dist/storage/build-stamp.js.map +1 -0
- package/dist/storage/builtin-adapters.d.ts +32 -0
- package/dist/storage/builtin-adapters.d.ts.map +1 -0
- package/dist/storage/builtin-adapters.js +100 -0
- package/dist/storage/builtin-adapters.js.map +1 -0
- package/dist/storage/builtin-directives.d.ts +0 -29
- package/dist/storage/builtin-directives.d.ts.map +1 -1
- package/dist/storage/builtin-directives.js +9 -4
- package/dist/storage/builtin-directives.js.map +1 -1
- package/dist/storage/commit.d.ts +310 -3
- package/dist/storage/commit.d.ts.map +1 -1
- package/dist/storage/commit.js +807 -33
- package/dist/storage/commit.js.map +1 -1
- package/dist/storage/document.d.ts +6 -0
- package/dist/storage/document.d.ts.map +1 -1
- package/dist/storage/document.js +10 -1
- package/dist/storage/document.js.map +1 -1
- package/dist/storage/dry-run.d.ts +65 -0
- package/dist/storage/dry-run.d.ts.map +1 -0
- package/dist/storage/dry-run.js +150 -0
- package/dist/storage/dry-run.js.map +1 -0
- package/dist/storage/errors.d.ts +26 -0
- package/dist/storage/errors.d.ts.map +1 -1
- package/dist/storage/errors.js +27 -1
- package/dist/storage/errors.js.map +1 -1
- package/dist/storage/frontmatter.d.ts +1 -1
- package/dist/storage/frontmatter.js +1 -1
- package/dist/storage/git-read.d.ts +64 -0
- package/dist/storage/git-read.d.ts.map +1 -0
- package/dist/storage/git-read.js +107 -0
- package/dist/storage/git-read.js.map +1 -0
- package/dist/storage/index.d.ts +13 -5
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +39 -2
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/layout.d.ts +2 -2
- package/dist/storage/layout.d.ts.map +1 -1
- package/dist/storage/layout.js +2 -7
- package/dist/storage/layout.js.map +1 -1
- package/dist/storage/memory-path.d.ts +18 -5
- package/dist/storage/memory-path.d.ts.map +1 -1
- package/dist/storage/memory-path.js +41 -5
- package/dist/storage/memory-path.js.map +1 -1
- package/dist/storage/snapshot.js +1 -1
- package/dist/storage/templates.d.ts +33 -6
- package/dist/storage/templates.d.ts.map +1 -1
- package/dist/storage/templates.js +170 -16
- package/dist/storage/templates.js.map +1 -1
- package/dist/validation/config-version.d.ts +19 -0
- package/dist/validation/config-version.d.ts.map +1 -0
- package/dist/validation/config-version.js +53 -0
- package/dist/validation/config-version.js.map +1 -0
- package/dist/validation/diagnostic.d.ts +40 -0
- package/dist/validation/diagnostic.d.ts.map +1 -0
- package/dist/validation/diagnostic.js +41 -0
- package/dist/validation/diagnostic.js.map +1 -0
- package/dist/validation/format.d.ts +74 -0
- package/dist/validation/format.d.ts.map +1 -0
- package/dist/validation/format.js +104 -0
- package/dist/validation/format.js.map +1 -0
- package/dist/validation/id.d.ts +14 -0
- package/dist/validation/id.d.ts.map +1 -1
- package/dist/validation/id.js +35 -11
- package/dist/validation/id.js.map +1 -1
- package/dist/validation/identity.d.ts +40 -0
- package/dist/validation/identity.d.ts.map +1 -0
- package/dist/validation/identity.js +78 -0
- package/dist/validation/identity.js.map +1 -0
- package/dist/validation/index.d.ts +9 -3
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +30 -1
- package/dist/validation/index.js.map +1 -1
- package/dist/validation/secret-scan.d.ts +3 -2
- package/dist/validation/secret-scan.d.ts.map +1 -1
- package/dist/validation/secret-scan.js +32 -11
- package/dist/validation/secret-scan.js.map +1 -1
- package/dist/validation/warning.d.ts +30 -16
- package/dist/validation/warning.d.ts.map +1 -1
- package/dist/validation/warning.js +74 -7
- package/dist/validation/warning.js.map +1 -1
- package/dist/workflow/bindings.d.ts +152 -0
- package/dist/workflow/bindings.d.ts.map +1 -0
- package/dist/workflow/bindings.js +249 -0
- package/dist/workflow/bindings.js.map +1 -0
- package/dist/workflow/create.d.ts +13 -0
- package/dist/workflow/create.d.ts.map +1 -0
- package/dist/workflow/create.js +41 -0
- package/dist/workflow/create.js.map +1 -0
- package/dist/workflow/deduce.d.ts +400 -0
- package/dist/workflow/deduce.d.ts.map +1 -0
- package/dist/workflow/deduce.js +1109 -0
- package/dist/workflow/deduce.js.map +1 -0
- package/dist/workflow/manifest-edit.d.ts +19 -0
- package/dist/workflow/manifest-edit.d.ts.map +1 -0
- package/dist/workflow/manifest-edit.js +124 -0
- package/dist/workflow/manifest-edit.js.map +1 -0
- package/dist/workflow/schema.d.ts +158 -19
- package/dist/workflow/schema.d.ts.map +1 -1
- package/dist/workflow/schema.js +163 -15
- package/dist/workflow/schema.js.map +1 -1
- package/package.json +18 -8
|
@@ -5,6 +5,10 @@ exports.isArchivedStatus = isArchivedStatus;
|
|
|
5
5
|
exports.resolveStateMachine = resolveStateMachine;
|
|
6
6
|
exports.resolveTransitionTarget = resolveTransitionTarget;
|
|
7
7
|
exports.resolveTypeTransition = resolveTypeTransition;
|
|
8
|
+
exports.supersedesEdgeFrom = supersedesEdgeFrom;
|
|
9
|
+
exports.resolveSupersedeTarget = resolveSupersedeTarget;
|
|
10
|
+
exports.resolveWaitingTarget = resolveWaitingTarget;
|
|
11
|
+
exports.isMachineEdge = isMachineEdge;
|
|
8
12
|
exports.validateFrontmatterState = validateFrontmatterState;
|
|
9
13
|
/**
|
|
10
14
|
* State-machine transition-legality engine (REQ-SYS-04, task-005-per-type-state-machines).
|
|
@@ -20,7 +24,8 @@ exports.validateFrontmatterState = validateFrontmatterState;
|
|
|
20
24
|
* This is spec-009-validation-strategy §1's Pass 2 (semantic / cross-file): the transition rule
|
|
21
25
|
* needs the type's registered machine (loaded from `memory.yaml`) plus the document's own `status`
|
|
22
26
|
* field — neither is decidable from the document's frontmatter schema alone, matching spec-009's own
|
|
23
|
-
* worked example ("`wingfoil.status` must be a
|
|
27
|
+
* worked example ("`wingfoil.status` must be a state of that type's machine — a member of its
|
|
28
|
+
* `sequence`, a `gates` reject target, or `deprecated`"; {@link validateFrontmatterState}). An illegal
|
|
24
29
|
* transition throws the shared `ValidationError` (exit code `1` — a business-rule failure, not an
|
|
25
30
|
* integrity one, per spec-009 §3 as rewritten under `dl-032-illegal-transition-message-contract`)
|
|
26
31
|
* and — critically — throws *before* returning any target, so a caller can never reach
|
|
@@ -42,6 +47,8 @@ exports.validateFrontmatterState = validateFrontmatterState;
|
|
|
42
47
|
* - `reject`: legal only from a state that IS a `gates` key (regardless of `waiting` membership —
|
|
43
48
|
* spec-001: a gate+waiting state "still exposes a manual `reject`/decline path"). Target:
|
|
44
49
|
* `gates[<state>].reject`, always taken verbatim (it need not be a `sequence` member).
|
|
50
|
+
* - `park` (task-180, `dl-110` P1 (a)): legal only from a state that is a `returns` key. Target:
|
|
51
|
+
* `returns[<state>]`, an earlier state of `sequence` (the schema guarantees it).
|
|
45
52
|
* - `deprecate`: the implicit wildcard edge — always legal from any current state, target is the
|
|
46
53
|
* reserved `"deprecated"` state. Never declared in `sequence`/`gates`/`waiting` (enforced
|
|
47
54
|
* structurally by task-004's `.superRefine()`; this engine does not need to re-check it).
|
|
@@ -53,8 +60,8 @@ exports.validateFrontmatterState = validateFrontmatterState;
|
|
|
53
60
|
* independent of any transition attempt. `resolveTransitionTarget` only answers "is verb `op` legal
|
|
54
61
|
* FROM `currentState`"; it never asserts that an arbitrary `status` string read off a document's
|
|
55
62
|
* frontmatter is itself a member of the type's declared state set at all — the check
|
|
56
|
-
* spec-010-memory-frontmatter-schema's "Validation rules" table names ("`status` must be a
|
|
57
|
-
* the type's
|
|
63
|
+
* spec-010-memory-frontmatter-schema's "Validation rules" table names ("`status` must be a state of
|
|
64
|
+
* the type's machine" → failure "invalid state for type") and BDD
|
|
58
65
|
* `P4.11-deliverables.feature`/`P4.13-state-deduction.feature` both exercise (`"invalid state
|
|
59
66
|
* 'shipped' for type 'task'"`). A state is legal for a type iff it belongs to that machine's full
|
|
60
67
|
* reachable set — `sequence` ∪ every `gates.<state>.reject` target (spec-001 permits those to be
|
|
@@ -79,10 +86,14 @@ const schema_1 = require("./schema");
|
|
|
79
86
|
/** The reserved implicit-wildcard target state (spec-001) — never declared explicitly anywhere. */
|
|
80
87
|
exports.DEPRECATED_STATE = 'deprecated';
|
|
81
88
|
/**
|
|
82
|
-
* The terminal state of the `adr` and `tech-spec` machines (`memory.yaml`)
|
|
83
|
-
* `
|
|
84
|
-
*
|
|
85
|
-
*
|
|
89
|
+
* The terminal state of the `adr` and `tech-spec` machines (`memory.yaml`). The state before it is a
|
|
90
|
+
* `waiting` state, so no verb drives the edge into it — not `approve` and not `memory deprecate`
|
|
91
|
+
* (`spec-001`: "`submit`/`approve` on a `waiting` state is illegal"). It is reached only through the
|
|
92
|
+
* `supersedes:` engine trigger: approving an element whose `supersedes:` names another element of its
|
|
93
|
+
* type moves that element along this edge ({@link supersedesEdgeFrom}, `dl-065` Q1.1, task-162). A
|
|
94
|
+
* superseded decision is archived content — a later element explicitly replaced it — which is why
|
|
95
|
+
* `dl-028-archived-states-excluded-from-context` puts it in {@link ARCHIVED_STATUSES} alongside
|
|
96
|
+
* {@link DEPRECATED_STATE}.
|
|
86
97
|
*/
|
|
87
98
|
exports.SUPERSEDED_STATE = 'superseded';
|
|
88
99
|
/**
|
|
@@ -147,8 +158,9 @@ exports.E_INVALID_STATE = 'E_INVALID_STATE';
|
|
|
147
158
|
* block", and its `Then` names the machine by value — so its title ("uses the defaults block")
|
|
148
159
|
* describes the common case rather than a precondition.
|
|
149
160
|
*
|
|
150
|
-
* **Why this value.** It is `spec-001`'s own worked `defaults` example, verbatim
|
|
151
|
-
*
|
|
161
|
+
* **Why this value.** It is `spec-001`'s own worked `defaults` example, verbatim, and the machine
|
|
162
|
+
* REQ-STATE-08 names since task-153 reconciled it (`bug-052`) — not the earlier
|
|
163
|
+
* `draft → pending → approved/rejected → deprecated` wording, which `spec-001` §Consequences
|
|
152
164
|
* deliberately superseded: the default machine "loses its `rejected` state" ("no document ever records
|
|
153
165
|
* `status: rejected` again" — a `reject` from the `pending` gate lands straight back on `draft`), and
|
|
154
166
|
* `deprecated` is the reserved implicit wildcard reachable from any state, never declared in a
|
|
@@ -270,48 +282,35 @@ function resolveTransitionTarget(machine, currentState, op, filePath = '') {
|
|
|
270
282
|
// `reject` target is taken verbatim — need not be a `sequence` member (spec-001).
|
|
271
283
|
return gate.reject;
|
|
272
284
|
}
|
|
285
|
+
case 'park': {
|
|
286
|
+
const target = (machine.returns ?? {})[currentState];
|
|
287
|
+
if (target === undefined) {
|
|
288
|
+
return illegal(currentState, op, 'not a `returns` state — `park` is only legal from a state that declares a return edge', filePath);
|
|
289
|
+
}
|
|
290
|
+
return target;
|
|
291
|
+
}
|
|
273
292
|
default: {
|
|
274
293
|
const exhaustive = op;
|
|
275
294
|
return illegal(currentState, exhaustive, 'unknown operation', filePath);
|
|
276
295
|
}
|
|
277
296
|
}
|
|
278
297
|
}
|
|
279
|
-
/** What the contract message prints for `<to>` when a verb has no legal edge anywhere in the machine. */
|
|
280
|
-
const NO_TARGET = '(none)';
|
|
281
298
|
/**
|
|
282
|
-
* The `<to>` of the illegal-transition contract message
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
* target
|
|
286
|
-
* `
|
|
287
|
-
* machine, where the literal forward edge out of `approved` is `done`.
|
|
288
|
-
*
|
|
289
|
-
* What happens when that canonical target IS `currentState` — printing it would be a self-loop — is
|
|
290
|
-
* ratified by `dl-053-illegal-transition-target-for-verbless-edges` (option 1): **keep walking
|
|
291
|
-
* `sequence` for the next legal edge of the SAME verb**, and render {@link NO_TARGET} when the verb
|
|
292
|
-
* has no other target. It must never name the next state in `sequence` regardless of verb — the
|
|
293
|
-
* earlier fallback did, printing `draft -> pending` for a `reject` (a rejection shown as a forward
|
|
294
|
-
* move) and `backlog -> in-progress` for an `approve` (a `waiting` edge no verb drives), misinforming
|
|
295
|
-
* exactly the user who has just made an illegal call. Every `<to>` printed here is therefore a real
|
|
296
|
-
* target of the verb the user typed, on this type's own machine.
|
|
299
|
+
* The `<to>` of the illegal-transition contract message — what the verb the user typed reaches from
|
|
300
|
+
* `<from>`. A transition verb names no target of its own, and {@link resolveTransitionTarget} refuses a
|
|
301
|
+
* call exactly when the verb has no edge from the current state (`deprecate` is never refused), so on a
|
|
302
|
+
* refusal that target is always nothing, rendered `(none)` (`dl-154` option A; `task-181`, `bug-165`,
|
|
303
|
+
* `bug-127`; REQ-STATE-01).
|
|
297
304
|
*
|
|
298
|
-
*
|
|
305
|
+
* It replaces the verb's **canonical edge** (`dl-053` option 1, replaced by `dl-154`): the target the
|
|
306
|
+
* verb reaches from the first state in `sequence` where it is legal. That edge starts somewhere else in the machine, so it
|
|
307
|
+
* printed backward moves (`approve` on a `planned` bug → `planned -> triaged`; `submit` on the last
|
|
308
|
+
* state of the default machine → `approved -> pending`) and skips (`triaged -> resolved`), naming a move
|
|
309
|
+
* nobody attempted to exactly the user who has just made an illegal call. Why the verb has no edge is
|
|
310
|
+
* the issue's `detail` (`dl-032` option (c)), which reaches the operator under the message
|
|
311
|
+
* (`dl-055`, task-130).
|
|
299
312
|
*/
|
|
300
|
-
|
|
301
|
-
for (const state of machine.sequence) {
|
|
302
|
-
let target;
|
|
303
|
-
try {
|
|
304
|
-
target = resolveTransitionTarget(machine, state, op);
|
|
305
|
-
}
|
|
306
|
-
catch {
|
|
307
|
-
continue; // `op` is not legal from this state — keep walking the chain
|
|
308
|
-
}
|
|
309
|
-
// dl-053: a self-loop is not a transition; keep looking for a different target of this same verb.
|
|
310
|
-
if (target !== currentState)
|
|
311
|
-
return target;
|
|
312
|
-
}
|
|
313
|
-
return NO_TARGET;
|
|
314
|
-
}
|
|
313
|
+
const NO_TARGET = '(none)';
|
|
315
314
|
/**
|
|
316
315
|
* Resolve the legal target of verb `op` for a document of type `typeName` currently in `currentState`
|
|
317
316
|
* — the entry point every Memory transition verb (`submit`, and `approve`/`reject`/`deprecate` after
|
|
@@ -322,7 +321,7 @@ function contractTarget(machine, currentState, op) {
|
|
|
322
321
|
* `dl-032-illegal-transition-message-contract` (option (c)) — `message` is the pinned
|
|
323
322
|
* `` illegal transition <from> -> <to> for type '<type>' `` (REQ-STATE-01 Fit Criterion; BDD `P1.6`
|
|
324
323
|
* sc.2, `P5.2.3` sc.2), `detail` carries the engine's explanation of *why* the edge is illegal, and the
|
|
325
|
-
* exit code is `1`. `<to>` is
|
|
324
|
+
* exit code is `1`. `<to>` is always {@link NO_TARGET}: the verb reaches nothing from `<from>`.
|
|
326
325
|
*
|
|
327
326
|
* @throws {@link ../validation.ValidationError} `E_INVALID_TRANSITION` (exit `1`) as above.
|
|
328
327
|
* @throws `Error` when `typeName` is not registered (see {@link resolveStateMachine}). A registered type
|
|
@@ -342,12 +341,100 @@ function resolveTypeTransition(memoryYaml, typeName, currentState, op, filePath
|
|
|
342
341
|
code: exports.E_INVALID_TRANSITION,
|
|
343
342
|
path: 'status',
|
|
344
343
|
file: filePath,
|
|
345
|
-
message: `illegal transition ${currentState} -> ${
|
|
344
|
+
message: `illegal transition ${currentState} -> ${NO_TARGET} for type '${typeName}'`,
|
|
346
345
|
detail,
|
|
347
346
|
},
|
|
348
347
|
]);
|
|
349
348
|
}
|
|
350
349
|
}
|
|
350
|
+
/**
|
|
351
|
+
* True when `state`'s forward edge leads into {@link SUPERSEDED_STATE} and no verb drives it: `state`
|
|
352
|
+
* is a `waiting` state and the next `sequence` entry is `superseded` (`accepted` for `adr`, `approved`
|
|
353
|
+
* for `tech-spec`). This is the edge the `supersedes:` trigger fires (`dl-065` Q1.1, `spec-001`), read
|
|
354
|
+
* from the machine rather than from a type name, so a project type with the same shape gets the same
|
|
355
|
+
* trigger. Pure (REQ-SYS-07).
|
|
356
|
+
*/
|
|
357
|
+
function supersedesEdgeFrom(machine, state) {
|
|
358
|
+
const index = machine.sequence.indexOf(state);
|
|
359
|
+
return index !== -1 && (machine.waiting ?? []).includes(state) && machine.sequence[index + 1] === exports.SUPERSEDED_STATE;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* The target of the `supersedes:` trigger on a document of type `typeName` in `currentState` —
|
|
363
|
+
* always {@link SUPERSEDED_STATE} — or a thrown `E_INVALID_TRANSITION` with `dl-032`'s contract
|
|
364
|
+
* message, `illegal transition <from> -> superseded for type '<type>'`, when the document is not in
|
|
365
|
+
* the state whose `waiting` edge leads there ({@link supersedesEdgeFrom}). The trigger is not a verb,
|
|
366
|
+
* so this is not a {@link TransitionOp}, and its `<to>` is the one state it can ever reach.
|
|
367
|
+
*
|
|
368
|
+
* @throws {@link ../validation.ValidationError} `E_INVALID_TRANSITION` as above.
|
|
369
|
+
* @throws `Error` when `typeName` is not registered (see {@link resolveStateMachine}).
|
|
370
|
+
*/
|
|
371
|
+
function resolveSupersedeTarget(memoryYaml, typeName, currentState, filePath) {
|
|
372
|
+
const machine = resolveStateMachine(memoryYaml, typeName);
|
|
373
|
+
if (supersedesEdgeFrom(machine, currentState))
|
|
374
|
+
return exports.SUPERSEDED_STATE;
|
|
375
|
+
throw new validation_1.ValidationError([
|
|
376
|
+
{
|
|
377
|
+
code: exports.E_INVALID_TRANSITION,
|
|
378
|
+
path: 'status',
|
|
379
|
+
file: filePath,
|
|
380
|
+
message: `illegal transition ${currentState} -> ${exports.SUPERSEDED_STATE} for type '${typeName}'`,
|
|
381
|
+
detail: `only an element in the \`waiting\` state whose forward edge leads to '${exports.SUPERSEDED_STATE}' can be superseded ` +
|
|
382
|
+
`(spec-001); '${currentState}' is not that state`,
|
|
383
|
+
},
|
|
384
|
+
]);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* The target of the forward `waiting` edge out of `currentState` for a document of type `typeName` — the
|
|
388
|
+
* next `sequence` entry after a state listed in `waiting`, which no verb drives and a workflow action fires
|
|
389
|
+
* (`spec-001`). `workflow end` takes it to close a plan, `active → done` (task-217, `spec-017` §7.2): the
|
|
390
|
+
* commit is `wf(plan): finalize <id> [active → done]` (`spec-008` §2's `finalize` row). A `superseded`
|
|
391
|
+
* target is not this edge's: it is the `supersedes:` trigger's ({@link resolveSupersedeTarget}).
|
|
392
|
+
*
|
|
393
|
+
* @throws {@link ../validation.ValidationError} `E_INVALID_TRANSITION` with `dl-032`'s contract message,
|
|
394
|
+
* `illegal transition <from> -> (none) for type '<type>'` (`dl-154`), when `currentState` has no such edge.
|
|
395
|
+
* @throws `Error` when `typeName` is not registered (see {@link resolveStateMachine}).
|
|
396
|
+
*/
|
|
397
|
+
function resolveWaitingTarget(memoryYaml, typeName, currentState, filePath) {
|
|
398
|
+
const machine = resolveStateMachine(memoryYaml, typeName);
|
|
399
|
+
const index = machine.sequence.indexOf(currentState);
|
|
400
|
+
const next = index === -1 ? undefined : machine.sequence[index + 1];
|
|
401
|
+
if ((machine.waiting ?? []).includes(currentState) && next !== undefined && next !== exports.SUPERSEDED_STATE)
|
|
402
|
+
return next;
|
|
403
|
+
throw new validation_1.ValidationError([
|
|
404
|
+
{
|
|
405
|
+
code: exports.E_INVALID_TRANSITION,
|
|
406
|
+
path: 'status',
|
|
407
|
+
file: filePath,
|
|
408
|
+
message: `illegal transition ${currentState} -> ${NO_TARGET} for type '${typeName}'`,
|
|
409
|
+
detail: `only a \`waiting\` state followed by another \`sequence\` state can be finalized (spec-001); '${currentState}' is not one`,
|
|
410
|
+
},
|
|
411
|
+
]);
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* True when `from → to` is an edge of `machine`, whichever verb or engine action drives it — the
|
|
415
|
+
* question a hop of a chained transition bracket asks (`[a → b → c]`, `task-126`, `bug-155`), where
|
|
416
|
+
* the commit names states and no verb per hop. The edges are exactly the targets
|
|
417
|
+
* {@link resolveTransitionTarget} can return, plus the verb-less forward edges it refuses to drive:
|
|
418
|
+
*
|
|
419
|
+
* 1. the **forward edge** `sequence[i] → sequence[i + 1]`, for every `i` — including out of a `gates`
|
|
420
|
+
* or `waiting` state, whose forward edge is taken by `approve` or by a workflow action rather than
|
|
421
|
+
* by `submit`, but is an edge all the same;
|
|
422
|
+
* 2. every **`gates.<from>.reject`** target;
|
|
423
|
+
* 3. every **`returns.<from>`** target, the edge `memory park` takes (task-180);
|
|
424
|
+
* 4. the implicit wildcard edge to {@link DEPRECATED_STATE}, from any state.
|
|
425
|
+
*
|
|
426
|
+
* A self-loop is not an edge. Pure; no ordering dependence (REQ-SYS-07).
|
|
427
|
+
*/
|
|
428
|
+
function isMachineEdge(machine, from, to) {
|
|
429
|
+
if (to === exports.DEPRECATED_STATE)
|
|
430
|
+
return true;
|
|
431
|
+
const index = machine.sequence.indexOf(from);
|
|
432
|
+
if (index !== -1 && machine.sequence[index + 1] === to)
|
|
433
|
+
return true;
|
|
434
|
+
if ((machine.returns ?? {})[from] === to)
|
|
435
|
+
return true;
|
|
436
|
+
return (machine.gates ?? {})[from]?.reject === to;
|
|
437
|
+
}
|
|
351
438
|
/**
|
|
352
439
|
* True when `status` is a state a document of this type may legitimately carry — the **full**
|
|
353
440
|
* reachable state set of `machine`, which is the union of three sources:
|
|
@@ -369,7 +456,8 @@ function resolveTypeTransition(memoryYaml, typeName, currentState, op, filePath
|
|
|
369
456
|
* any `sequence` (the `StateMachine` schema's own `.superRefine()` forbids declaring it).
|
|
370
457
|
*
|
|
371
458
|
* `machine.waiting` contributes nothing: every `waiting` entry is required to be a `sequence` member
|
|
372
|
-
* already, so it is covered by (1).
|
|
459
|
+
* already, so it is covered by (1). Nor does `machine.returns`: the schema requires every `returns`
|
|
460
|
+
* target to be an earlier `sequence` state (task-180).
|
|
373
461
|
*
|
|
374
462
|
* Iteration over `gates` is sorted (REQ-SYS-07 — no unordered iteration in any output-affecting path);
|
|
375
463
|
* the predicate's boolean result is order-independent, but keeping the traversal deterministic keeps
|
|
@@ -387,7 +475,7 @@ function isDeclaredState(machine, status) {
|
|
|
387
475
|
/**
|
|
388
476
|
* Assert that `status` — a value read straight off a document's frontmatter — is a legal state for
|
|
389
477
|
* `typeName` under `machine` (REQ-STATE-01: state is derived from frontmatter; spec-010's "Validation
|
|
390
|
-
* rules": *"`status` must be a
|
|
478
|
+
* rules": *"`status` must be a state of the type's machine"*). The legal set is exactly
|
|
391
479
|
* {@link isDeclaredState}'s: `sequence` ∪ every `gates.<state>.reject` target ∪ `deprecated`.
|
|
392
480
|
*
|
|
393
481
|
* This is a distinct check from {@link resolveTransitionTarget}: that function asks "is verb `op`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-machine.js","sourceRoot":"","sources":["../../src/memory/state-machine.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"state-machine.js","sourceRoot":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,CAAC;IACpE,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IACtD,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,EAAE,CAAC;AACpD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAS,eAAe,CAAC,OAAqB,EAAE,MAAc;IAC5D,IAAI,MAAM,KAAK,wBAAgB,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACrE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;IAClC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;SACtB,IAAI,EAAE;SACN,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,SAAgB,wBAAwB,CACtC,OAAqB,EACrB,QAAgB,EAChB,MAAc,EACd,QAAQ,GAAG,EAAE;IAEb,IAAI,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC;QACrC,OAAO;IACT,CAAC;IACD,MAAM,IAAI,4BAAe,CAAC;QACxB;YACE,IAAI,EAAE,uBAAe;YACrB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,kBAAkB,MAAM,eAAe,QAAQ,GAAG;SAC5D;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/dist/memory/submit.d.ts
CHANGED
|
@@ -1,11 +1,60 @@
|
|
|
1
1
|
/** The frontmatter key `memory.reject` sets and `memory.submit` removes (spec-010). */
|
|
2
2
|
export declare const REJECTION_REASON_FIELD = "rejection_reason";
|
|
3
|
+
/**
|
|
4
|
+
* Why a required field's not-applicable value is refused: the type does not declare it, it gives no
|
|
5
|
+
* reason, or it separates the reason with something other than an em dash (`n/a - x`, `n/a: x`).
|
|
6
|
+
*/
|
|
7
|
+
export type NotApplicableProblem = 'undeclared' | 'no-reason' | 'bad-form';
|
|
8
|
+
/** One refused not-applicable value, by field. */
|
|
9
|
+
export interface NotApplicableRefusal {
|
|
10
|
+
readonly field: string;
|
|
11
|
+
readonly problem: NotApplicableProblem;
|
|
12
|
+
}
|
|
3
13
|
/**
|
|
4
14
|
* The fields that must be filled before a submit but are not: `title` first (spec-010 requires it of
|
|
5
|
-
* every type), then each of `required` in its declared order, without duplicates. `[]` means
|
|
6
|
-
*
|
|
15
|
+
* every type), then each of `required` in its declared order, without duplicates. `[]` means no field
|
|
16
|
+
* is missing. `listFields` are the type's `template.frontmatter.lists`: on those alone a list, `[]`
|
|
17
|
+
* included, is filled; `title` is never one. A not-applicable value counts as present here — whether it is *accepted* is
|
|
18
|
+
* {@link notApplicableRefusals}'s question, so a field is reported by one of the two, never both.
|
|
7
19
|
*/
|
|
8
|
-
export declare function missingRequiredFields(frontmatter: Readonly<Record<string, unknown>>, required: readonly string[]): string[];
|
|
20
|
+
export declare function missingRequiredFields(frontmatter: Readonly<Record<string, unknown>>, required: readonly string[], listFields?: readonly string[]): string[];
|
|
21
|
+
/**
|
|
22
|
+
* The required fields holding a not-applicable value that may not stand (`dl-124`, task-168), in the
|
|
23
|
+
* same order as {@link missingRequiredFields}:
|
|
24
|
+
* - `undeclared` — the type's `template.frontmatter.not_applicable_allowed` does not list the field
|
|
25
|
+
* (`title` never counts as listed: spec-010 requires it of every type);
|
|
26
|
+
* - `no-reason` — the field is listed, but the value is bare `n/a` or `n/a —` with a blank reason;
|
|
27
|
+
* - `bad-form` — the field is listed, but the reason follows another separator than the em dash.
|
|
28
|
+
*
|
|
29
|
+
* Optional fields are not checked: what they hold is the type's own business.
|
|
30
|
+
*/
|
|
31
|
+
export declare function notApplicableRefusals(frontmatter: Readonly<Record<string, unknown>>, required: readonly string[], notApplicableAllowed?: readonly string[]): NotApplicableRefusal[];
|
|
9
32
|
/** The submitted document: `status` set to `target` and `rejection_reason` removed; nothing else changes. */
|
|
10
33
|
export declare function renderSubmitDocument(content: string, target: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* What a submit carries besides its own edit (task-209, `dl-106` W1 (a)): every way the author's
|
|
36
|
+
* working-tree document differs from the one committed at `HEAD`, worded by `describeDocumentChanges`
|
|
37
|
+
* — "the body", a `frontmatter field '<name>'` per moved field, sorted by name — the function that
|
|
38
|
+
* already words the gated verbs' refusal of the same edits. Both copies are first rendered by the same
|
|
39
|
+
* transition ({@link renderSubmitDocument}), so the submit's own fields, `status` and a cleared
|
|
40
|
+
* `rejection_reason`, never count: a pure transition carries nothing (`[]`).
|
|
41
|
+
*
|
|
42
|
+
* `committed` is `null` when no commit holds the document; the verb refuses that case before asking.
|
|
43
|
+
* Pure and deterministic (REQ-SYS-07).
|
|
44
|
+
*/
|
|
45
|
+
export declare function describeSubmitContent(committed: string | null, content: string, target: string): string[];
|
|
46
|
+
/**
|
|
47
|
+
* `text` rewritten in the line-ending style of `like`: CRLF when `like` holds any CRLF, LF otherwise
|
|
48
|
+
* (task-209 re-review 1). `memory submit` compares the blob git would store for its rendering with the
|
|
49
|
+
* blob of the same rendering in the committed document's style, which isolates a line-ending
|
|
50
|
+
* conversion from the content edits made with it. Pure.
|
|
51
|
+
*/
|
|
52
|
+
export declare function withLineEndingsOf(text: string, like: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* The item a submit declares, after every other item, when git — after its own line-ending filters —
|
|
55
|
+
* would store the rendered document with line endings other than the committed one's (`storesAsBlob`,
|
|
56
|
+
* `src/storage`): the one change {@link describeSubmitContent} cannot see, because it compares
|
|
57
|
+
* line-ending-normalized text.
|
|
58
|
+
*/
|
|
59
|
+
export declare const LINE_ENDINGS_ITEM = "the line endings";
|
|
11
60
|
//# sourceMappingURL=submit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit.d.ts","sourceRoot":"","sources":["../../src/memory/submit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"submit.d.ts","sourceRoot":"","sources":["../../src/memory/submit.ts"],"names":[],"mappings":"AAgBA,uFAAuF;AACvF,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AA8CzD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG,WAAW,GAAG,UAAU,CAAC;AAE3E,kDAAkD;AAClD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC;CACxC;AAOD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC9C,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,UAAU,GAAE,SAAS,MAAM,EAAO,GACjC,MAAM,EAAE,CAGV;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC9C,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,oBAAoB,GAAE,SAAS,MAAM,EAAO,GAC3C,oBAAoB,EAAE,CAWxB;AAED,6GAA6G;AAC7G,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAIzG;AAOD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAGpE;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,qBAAqB,CAAC"}
|
package/dist/memory/submit.js
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REJECTION_REASON_FIELD = void 0;
|
|
3
|
+
exports.LINE_ENDINGS_ITEM = exports.REJECTION_REASON_FIELD = void 0;
|
|
4
4
|
exports.missingRequiredFields = missingRequiredFields;
|
|
5
|
+
exports.notApplicableRefusals = notApplicableRefusals;
|
|
5
6
|
exports.renderSubmitDocument = renderSubmitDocument;
|
|
7
|
+
exports.describeSubmitContent = describeSubmitContent;
|
|
8
|
+
exports.withLineEndingsOf = withLineEndingsOf;
|
|
6
9
|
/**
|
|
7
10
|
* Pure helpers behind `wingfoil memory submit` (P1.6, task-045-memory-submit), kept out of the
|
|
8
11
|
* `CoreResult`-wrapped operation in `src/core` the same way `./add.ts` serves `memory add`.
|
|
9
12
|
*
|
|
10
13
|
* Both implement `spec-010-memory-frontmatter-schema`:
|
|
11
14
|
* - "Validation rules": `title`, and every field in the type's `template.frontmatter.required`, must
|
|
12
|
-
* be non-empty once `status` is anything other than `draft` — so a submit checks them first.
|
|
15
|
+
* be non-empty once `status` is anything other than `draft` — so a submit checks them first. A field
|
|
16
|
+
* the type lists in `template.frontmatter.not_applicable_allowed` may instead hold
|
|
17
|
+
* `"n/a — <reason>"` (`dl-124`, task-168); no other field may hold a not-applicable value.
|
|
13
18
|
* - "Field-write ownership": `memory.submit` moves `status` to the next state and clears
|
|
14
19
|
* `rejection_reason` by removing the key (it mirrors only the most recent reject).
|
|
15
20
|
*
|
|
@@ -18,27 +23,129 @@ exports.renderSubmitDocument = renderSubmitDocument;
|
|
|
18
23
|
const frontmatter_edit_1 = require("./frontmatter-edit");
|
|
19
24
|
/** The frontmatter key `memory.reject` sets and `memory.submit` removes (spec-010). */
|
|
20
25
|
exports.REJECTION_REASON_FIELD = 'rejection_reason';
|
|
21
|
-
/**
|
|
22
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Whether a required field's value counts as "not filled in" (`spec-010` § Validation rules,
|
|
28
|
+
* `bug-147`, approver rulings 2026-10-02 at `task-168`'s review): absent, `null` (an empty YAML value,
|
|
29
|
+
* `features:`), a blank string, or a mapping. A list is a value only on a field the type declares in
|
|
30
|
+
* `template.frontmatter.lists`, and there any list is, `[]` included (the author declared "none"); on
|
|
31
|
+
* every other field a list is missing. A date (YAML timestamp) is a value.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* The frontmatter's own value for `field`, or `undefined`: a field named like an `Object.prototype`
|
|
35
|
+
* member (`constructor`, `toString`) is an ordinary field, never the prototype's function (task-279
|
|
36
|
+
* review F1).
|
|
37
|
+
*/
|
|
38
|
+
function ownValue(frontmatter, field) {
|
|
39
|
+
return Object.hasOwn(frontmatter, field) ? frontmatter[field] : undefined;
|
|
40
|
+
}
|
|
41
|
+
function isEmptyValue(value, isListField) {
|
|
23
42
|
if (value === undefined || value === null)
|
|
24
43
|
return true;
|
|
25
44
|
if (typeof value === 'string')
|
|
26
45
|
return value.trim().length === 0;
|
|
27
46
|
if (Array.isArray(value))
|
|
28
|
-
return
|
|
29
|
-
|
|
47
|
+
return !isListField;
|
|
48
|
+
if (value instanceof Date)
|
|
49
|
+
return false;
|
|
50
|
+
return typeof value === 'object';
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A value that says "this field does not apply" (`dl-124` Q1 (A)): a string whose text starts with
|
|
54
|
+
* `n/a`, in any case, not followed by a letter, digit or `_` — so `n/a`, `N/A` and
|
|
55
|
+
* `n/a — patch release` are, while `n/available` or `P1 (n/a for docs)` are ordinary data.
|
|
56
|
+
*/
|
|
57
|
+
const NOT_APPLICABLE_SHAPE = /^n\/a(?![\w])/i;
|
|
58
|
+
/**
|
|
59
|
+
* The one accepted form (`dl-124` Q3 (ii)): `n/a`, an em dash, then a non-blank reason. Case, and
|
|
60
|
+
* whitespace around the em dash, do not matter (task-168 review fix 3): `N/A — x` and `n/a—x` pass.
|
|
61
|
+
*/
|
|
62
|
+
const NOT_APPLICABLE_WITH_REASON = /^n\/a\s*—\s*\S/i;
|
|
63
|
+
/** Bare `n/a`, or `n/a —` with nothing after it: the form is right, the reason is missing. */
|
|
64
|
+
const NOT_APPLICABLE_WITHOUT_REASON = /^n\/a\s*(—\s*)?$/i;
|
|
65
|
+
function isNotApplicableShaped(value) {
|
|
66
|
+
return typeof value === 'string' && NOT_APPLICABLE_SHAPE.test(value.trim());
|
|
67
|
+
}
|
|
68
|
+
/** `title` first (spec-010 requires it of every type), then `required` in declared order, deduplicated. */
|
|
69
|
+
function requiredFieldOrder(required) {
|
|
70
|
+
return [...new Set(['title', ...required])];
|
|
30
71
|
}
|
|
31
72
|
/**
|
|
32
73
|
* The fields that must be filled before a submit but are not: `title` first (spec-010 requires it of
|
|
33
|
-
* every type), then each of `required` in its declared order, without duplicates. `[]` means
|
|
34
|
-
*
|
|
74
|
+
* every type), then each of `required` in its declared order, without duplicates. `[]` means no field
|
|
75
|
+
* is missing. `listFields` are the type's `template.frontmatter.lists`: on those alone a list, `[]`
|
|
76
|
+
* included, is filled; `title` is never one. A not-applicable value counts as present here — whether it is *accepted* is
|
|
77
|
+
* {@link notApplicableRefusals}'s question, so a field is reported by one of the two, never both.
|
|
35
78
|
*/
|
|
36
|
-
function missingRequiredFields(frontmatter, required) {
|
|
37
|
-
const
|
|
38
|
-
return
|
|
79
|
+
function missingRequiredFields(frontmatter, required, listFields = []) {
|
|
80
|
+
const lists = new Set(listFields.filter((field) => field !== 'title'));
|
|
81
|
+
return requiredFieldOrder(required).filter((field) => isEmptyValue(ownValue(frontmatter, field), lists.has(field)));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The required fields holding a not-applicable value that may not stand (`dl-124`, task-168), in the
|
|
85
|
+
* same order as {@link missingRequiredFields}:
|
|
86
|
+
* - `undeclared` — the type's `template.frontmatter.not_applicable_allowed` does not list the field
|
|
87
|
+
* (`title` never counts as listed: spec-010 requires it of every type);
|
|
88
|
+
* - `no-reason` — the field is listed, but the value is bare `n/a` or `n/a —` with a blank reason;
|
|
89
|
+
* - `bad-form` — the field is listed, but the reason follows another separator than the em dash.
|
|
90
|
+
*
|
|
91
|
+
* Optional fields are not checked: what they hold is the type's own business.
|
|
92
|
+
*/
|
|
93
|
+
function notApplicableRefusals(frontmatter, required, notApplicableAllowed = []) {
|
|
94
|
+
const allowed = new Set(notApplicableAllowed.filter((field) => field !== 'title'));
|
|
95
|
+
const refusals = [];
|
|
96
|
+
for (const field of requiredFieldOrder(required)) {
|
|
97
|
+
const value = ownValue(frontmatter, field);
|
|
98
|
+
if (!isNotApplicableShaped(value))
|
|
99
|
+
continue;
|
|
100
|
+
if (!allowed.has(field))
|
|
101
|
+
refusals.push({ field, problem: 'undeclared' });
|
|
102
|
+
else if (NOT_APPLICABLE_WITHOUT_REASON.test(value.trim()))
|
|
103
|
+
refusals.push({ field, problem: 'no-reason' });
|
|
104
|
+
else if (!NOT_APPLICABLE_WITH_REASON.test(value.trim()))
|
|
105
|
+
refusals.push({ field, problem: 'bad-form' });
|
|
106
|
+
}
|
|
107
|
+
return refusals;
|
|
39
108
|
}
|
|
40
109
|
/** The submitted document: `status` set to `target` and `rejection_reason` removed; nothing else changes. */
|
|
41
110
|
function renderSubmitDocument(content, target) {
|
|
42
111
|
return (0, frontmatter_edit_1.removeFrontmatterField)((0, frontmatter_edit_1.setFrontmatterField)(content, 'status', target), exports.REJECTION_REASON_FIELD);
|
|
43
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* What a submit carries besides its own edit (task-209, `dl-106` W1 (a)): every way the author's
|
|
115
|
+
* working-tree document differs from the one committed at `HEAD`, worded by `describeDocumentChanges`
|
|
116
|
+
* — "the body", a `frontmatter field '<name>'` per moved field, sorted by name — the function that
|
|
117
|
+
* already words the gated verbs' refusal of the same edits. Both copies are first rendered by the same
|
|
118
|
+
* transition ({@link renderSubmitDocument}), so the submit's own fields, `status` and a cleared
|
|
119
|
+
* `rejection_reason`, never count: a pure transition carries nothing (`[]`).
|
|
120
|
+
*
|
|
121
|
+
* `committed` is `null` when no commit holds the document; the verb refuses that case before asking.
|
|
122
|
+
* Pure and deterministic (REQ-SYS-07).
|
|
123
|
+
*/
|
|
124
|
+
function describeSubmitContent(committed, content, target) {
|
|
125
|
+
const after = renderSubmitDocument(toLf(content), target);
|
|
126
|
+
if (committed === null)
|
|
127
|
+
return (0, frontmatter_edit_1.describeDocumentChanges)(null, after);
|
|
128
|
+
return (0, frontmatter_edit_1.describeDocumentChanges)(renderSubmitDocument(toLf(committed), target), after);
|
|
129
|
+
}
|
|
130
|
+
/** CRLF → LF: the comparison is of content, so line endings are compared separately (task-209 review F1). */
|
|
131
|
+
function toLf(text) {
|
|
132
|
+
return text.replace(/\r\n/g, '\n');
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* `text` rewritten in the line-ending style of `like`: CRLF when `like` holds any CRLF, LF otherwise
|
|
136
|
+
* (task-209 re-review 1). `memory submit` compares the blob git would store for its rendering with the
|
|
137
|
+
* blob of the same rendering in the committed document's style, which isolates a line-ending
|
|
138
|
+
* conversion from the content edits made with it. Pure.
|
|
139
|
+
*/
|
|
140
|
+
function withLineEndingsOf(text, like) {
|
|
141
|
+
const lf = toLf(text);
|
|
142
|
+
return like.includes('\r\n') ? lf.replace(/\n/g, '\r\n') : lf;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The item a submit declares, after every other item, when git — after its own line-ending filters —
|
|
146
|
+
* would store the rendered document with line endings other than the committed one's (`storesAsBlob`,
|
|
147
|
+
* `src/storage`): the one change {@link describeSubmitContent} cannot see, because it compares
|
|
148
|
+
* line-ending-normalized text.
|
|
149
|
+
*/
|
|
150
|
+
exports.LINE_ENDINGS_ITEM = 'the line endings';
|
|
44
151
|
//# sourceMappingURL=submit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit.js","sourceRoot":"","sources":["../../src/memory/submit.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"submit.js","sourceRoot":"","sources":["../../src/memory/submit.ts"],"names":[],"mappings":";;;AAuFA,sDAOC;AAYD,sDAeC;AAGD,oDAEC;AAaD,sDAIC;AAaD,8CAGC;AA/JD;;;;;;;;;;;;;GAaG;AACH,yDAA0G;AAE1G,uFAAuF;AAC1E,QAAA,sBAAsB,GAAG,kBAAkB,CAAC;AAEzD;;;;;;GAMG;AACH;;;;GAIG;AACH,SAAS,QAAQ,CAAC,WAA8C,EAAE,KAAa;IAC7E,OAAO,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5E,CAAC;AAED,SAAS,YAAY,CAAC,KAAc,EAAE,WAAoB;IACxD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACvD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,CAAC;IAChE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,WAAW,CAAC;IAC9C,IAAI,KAAK,YAAY,IAAI;QAAE,OAAO,KAAK,CAAC;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAED;;;;GAIG;AACH,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;AAE9C;;;GAGG;AACH,MAAM,0BAA0B,GAAG,iBAAiB,CAAC;AAErD,8FAA8F;AAC9F,MAAM,6BAA6B,GAAG,mBAAmB,CAAC;AAE1D,SAAS,qBAAqB,CAAC,KAAc;IAC3C,OAAO,OAAO,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IACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAChE,CAAC;AAED;;;;;GAKG;AACU,QAAA,iBAAiB,GAAG,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** The trailer key `dl-111` reserves for the build signature (refused in a `--reason`, `dl-067` clause 4). */
|
|
2
|
+
export declare const WINGFOIL_VERSION_TRAILER_KEY = "WingFoil-Version";
|
|
3
|
+
/**
|
|
4
|
+
* The running build's stamp, `<semver> (<sha>)` — `<semver>` from `package.json`, `<sha>` from the
|
|
5
|
+
* build record, or `unknown`.
|
|
6
|
+
*
|
|
7
|
+
* Both files are located from `moduleDir`, the directory of a module one level below the compiled
|
|
8
|
+
* root: `build-info.json` one level up (`dist/build-info.json` from `dist/storage/`), `package.json`
|
|
9
|
+
* two levels up, which is the package root in the `src/` and the `dist/` layout alike and where npm
|
|
10
|
+
* installs the manifest. The version is the manifest's, never the record's: `package.json` is what
|
|
11
|
+
* npm installed, and the record only adds the commit.
|
|
12
|
+
*
|
|
13
|
+
* @param moduleDir - Defaults to this module's own directory; a test passes a fixture's.
|
|
14
|
+
*/
|
|
15
|
+
export declare function readBuildStamp(moduleDir?: string): string;
|
|
16
|
+
/** The trailer line for `stamp`: `WingFoil-Version: <stamp>`. */
|
|
17
|
+
export declare function formatVersionTrailer(stamp: string): string;
|
|
18
|
+
//# sourceMappingURL=build-stamp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-stamp.d.ts","sourceRoot":"","sources":["../../src/storage/build-stamp.ts"],"names":[],"mappings":"AAoBA,8GAA8G;AAC9G,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAwB/D;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,SAAS,GAAE,MAAkB,GAAG,MAAM,CAIpE;AAED,iEAAiE;AACjE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE1D"}
|