wingfoil 0.2.1 → 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 +88 -42
- 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 +2 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +3 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init-command.d.ts.map +1 -1
- package/dist/cli/init-command.js +6 -3
- 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 +270 -60
- package/dist/cli/program.js.map +1 -1
- package/dist/cli/registrar.d.ts +16 -7
- package/dist/cli/registrar.d.ts.map +1 -1
- package/dist/cli/registrar.js +71 -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.js +6 -6
- 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 +189 -14
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1241 -238
- package/dist/core/index.js.map +1 -1
- package/dist/core/init.d.ts +50 -8
- package/dist/core/init.d.ts.map +1 -1
- package/dist/core/init.js +139 -27
- 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 +147 -23
- 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 +35 -30
- package/dist/directives/schema.d.ts.map +1 -1
- package/dist/directives/schema.js +36 -30
- 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 +9 -5
- 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 +160 -17
- package/dist/memory/add.d.ts.map +1 -1
- package/dist/memory/add.js +361 -51
- package/dist/memory/add.js.map +1 -1
- package/dist/memory/audit.d.ts +165 -32
- package/dist/memory/audit.d.ts.map +1 -1
- package/dist/memory/audit.js +267 -97
- 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 +74 -13
- package/dist/memory/history.d.ts.map +1 -1
- package/dist/memory/history.js +129 -45
- 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 +38 -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 +136 -48
- 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 +182 -17
- 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 +40 -0
- package/dist/validation/id.d.ts.map +1 -1
- package/dist/validation/id.js +99 -12
- 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 +33 -1
- package/dist/validation/index.js.map +1 -1
- package/dist/validation/secret-scan.d.ts +10 -7
- package/dist/validation/secret-scan.d.ts.map +1 -1
- package/dist/validation/secret-scan.js +39 -16
- 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 +190 -16
- package/dist/workflow/schema.js.map +1 -1
- package/package.json +37 -13
package/dist/mcp/registrar.js
CHANGED
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.deriveMcpToolName = deriveMcpToolName;
|
|
4
4
|
exports.deriveMcpResourceUri = deriveMcpResourceUri;
|
|
5
5
|
exports.registerCoreModules = registerCoreModules;
|
|
6
|
+
const error_details_1 = require("../core/error-details");
|
|
6
7
|
const registry_1 = require("../core/registry");
|
|
8
|
+
const read_only_1 = require("./read-only");
|
|
7
9
|
/**
|
|
8
10
|
* `{module}.{verb}` — spec-004 §4.1's Tool naming convention (mechanical transform of the CLI verb).
|
|
9
11
|
* An empty `verb` (`deriveVerb`'s flat/no-verb form, task-028-implement-paths-category) collapses to
|
|
@@ -27,14 +29,27 @@ function deriveMcpResourceUri(moduleName, verb) {
|
|
|
27
29
|
* response (spec-004 §4.3's "rejected identically to the CLI path") or, for a Resource read (which
|
|
28
30
|
* has no `isError` flag in the MCP protocol), a thrown error surfaced as a protocol-level read
|
|
29
31
|
* failure (spec-004 §2.2's "resource not found"-style refusal, generalized to any read failure).
|
|
32
|
+
* Either way the error's operator-facing details (`../core/error-details.ts`) travel with it — as the
|
|
33
|
+
* read error's JSON-RPC `error.data.details`, or as the tool result's `structuredContent` (task-130).
|
|
34
|
+
* A successful Tool result carries the operation's `CoreResult.warnings`, when it has any, as
|
|
35
|
+
* `structuredContent: {value, warnings}` (task-169). A successful Resource read carries them as a
|
|
36
|
+
* top-level `warnings` array beside `contents` (task-195, `bug-231`: since task-171 a read-only scan does
|
|
37
|
+
* report the documents it left out). Note that the shipped
|
|
38
|
+
* `wingfoil mcp` server (`./server.ts`) does not call this function and registers no Tools (P5.2.3,
|
|
39
|
+
* v0.4), so the Tool warning field is reachable only where this registrar is used; when Tools ship,
|
|
40
|
+
* `directive.assign` and the four `dna` write Tools (task-193) also need `force` as a Tool input
|
|
41
|
+
* (`spec-004` §4.3).
|
|
30
42
|
*/
|
|
31
43
|
function registerCoreModules(server, modules, options) {
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
44
|
+
// Declare both channels (spec-004 §1: Resources and Tools are fixed channel types of the MCP
|
|
45
|
+
// surface), even when `modules` has zero operations of one kind. Declaring a capability installs no
|
|
46
|
+
// request handler, though: the SDK installs `tools/list` / `tools/call` on the first `registerTool`
|
|
47
|
+
// (and the Resources handlers on the first `registerResource`). So with zero `mutates: true`
|
|
48
|
+
// operations in the `modules` passed (as in the parity test's read-only fixtures), `initialize`
|
|
49
|
+
// advertises `tools` while `tools/list` still answers JSON-RPC -32601 "Method not found" (task-174
|
|
50
|
+
// corrected this comment, which claimed the opposite; `test/core/parity.test.ts` documents the same
|
|
51
|
+
// and skips the call). The production server does not use this registrar; it answers `tools/list`
|
|
52
|
+
// with an empty list itself (`./server.ts`, `bug-151`).
|
|
38
53
|
server.server.registerCapabilities({ tools: {}, resources: {} });
|
|
39
54
|
for (const { module, operation } of (0, registry_1.enumerateOperations)(modules)) {
|
|
40
55
|
const verb = (0, registry_1.deriveVerb)(module.name, operation.name);
|
|
@@ -45,15 +60,32 @@ function registerCoreModules(server, modules, options) {
|
|
|
45
60
|
root: options.resolveRoot(),
|
|
46
61
|
});
|
|
47
62
|
const result = await operation.fn(params);
|
|
48
|
-
return result.ok
|
|
63
|
+
return result.ok
|
|
64
|
+
? { ok: true, value: result.value, text: JSON.stringify(result.value), warnings: result.warnings ?? [] }
|
|
65
|
+
: { ok: false, message: result.error.message, details: (0, error_details_1.errorDetails)(result.error) };
|
|
49
66
|
};
|
|
50
67
|
if (operation.mutates) {
|
|
51
68
|
const toolName = deriveMcpToolName(module.name, verb);
|
|
52
69
|
server.registerTool(toolName, { description: `${module.name} ${verb} (mutating)` }, async () => {
|
|
53
70
|
const outcome = await callCore();
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
71
|
+
if (outcome.ok) {
|
|
72
|
+
// The success-warning channel (task-169, `dl-062`): a Tool has no stderr, so the warnings ride
|
|
73
|
+
// as `structuredContent: {value, warnings}` — the success twin of the refusal's `{error,
|
|
74
|
+
// details}` below. The text stays the payload's JSON, so a client reading only `content` sees
|
|
75
|
+
// what it always saw. No warnings, no `structuredContent`.
|
|
76
|
+
return {
|
|
77
|
+
content: [{ type: 'text', text: outcome.text }],
|
|
78
|
+
...(outcome.warnings.length > 0 ? { structuredContent: { value: outcome.value, warnings: outcome.warnings } } : {}),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
// A tool error is a RESULT, not a JSON-RPC error, so it has no `error.data`: the details ride as
|
|
82
|
+
// `structuredContent`, in the CLI's `--format json` error shape (task-130, `dl-055` option 1).
|
|
83
|
+
// The text stays the bare reason, identical to the CLI's (spec-004 §4.3).
|
|
84
|
+
return {
|
|
85
|
+
content: [{ type: 'text', text: outcome.message }],
|
|
86
|
+
isError: true,
|
|
87
|
+
...(outcome.details.length > 0 ? { structuredContent: { error: outcome.message, details: outcome.details } } : {}),
|
|
88
|
+
};
|
|
57
89
|
});
|
|
58
90
|
}
|
|
59
91
|
else {
|
|
@@ -62,9 +94,13 @@ function registerCoreModules(server, modules, options) {
|
|
|
62
94
|
server.registerResource(resourceName, uri, { description: `${module.name} ${verb} (read-only)` }, async (readUri) => {
|
|
63
95
|
const outcome = await callCore();
|
|
64
96
|
if (outcome.ok) {
|
|
65
|
-
|
|
97
|
+
// Its warnings ride beside `contents` (task-195, same class as `bug-231`): `memorySearch`
|
|
98
|
+
// reports the documents its scan left out (task-171), which a client must not lose.
|
|
99
|
+
return (0, read_only_1.withWarnings)({ contents: [{ uri: readUri.toString(), mimeType: 'application/json', text: outcome.text }] }, outcome.warnings);
|
|
66
100
|
}
|
|
67
|
-
|
|
101
|
+
// A failed read IS a JSON-RPC error; the SDK forwards an `Error`'s `data` as `error.data`
|
|
102
|
+
// (task-130, `dl-055` option 1). No details, no `data` — the shape it always had.
|
|
103
|
+
throw (0, read_only_1.readRefusalError)(outcome.message, outcome.details);
|
|
68
104
|
});
|
|
69
105
|
}
|
|
70
106
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registrar.js","sourceRoot":"","sources":["../../src/mcp/registrar.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"registrar.js","sourceRoot":"","sources":["../../src/mcp/registrar.ts"],"names":[],"mappings":";;AA6CA,8CAEC;AAOD,oDAEC;AAoBD,kDA8EC;AAhID,yDAAqD;AAErD,+CAAmE;AAEnE,2CAA6D;AAU7D;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,UAAkB,EAAE,IAAY;IAChE,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,UAAU,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;AACrD,CAAC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,UAAkB,EAAE,IAAY;IACnE,OAAO,IAAI,CAAC,CAAC,CAAC,cAAc,UAAU,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,cAAc,UAAU,EAAE,CAAC;AAChF,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,mBAAmB,CACjC,MAAiB,EACjB,OAA8B,EAC9B,OAAmC;IAEnC,6FAA6F;IAC7F,oGAAoG;IACpG,oGAAoG;IACpG,6FAA6F;IAC7F,gGAAgG;IAChG,mGAAmG;IACnG,oGAAoG;IACpG,kGAAkG;IAClG,wDAAwD;IACxD,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;IAEjE,KAAK,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,IAAA,8BAAmB,EAAC,OAAO,CAAC,EAAE,CAAC;QACjE,MAAM,IAAI,GAAG,IAAA,qBAAU,EAAC,MAAM,CAAC,IAAI,EA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Q,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACvI,CAAC;gBACD,0FAA0F;gBAC1F,kFAAkF;gBAClF,MAAM,IAAA,4BAAgB,EAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YAC3D,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/mcp/server.d.ts
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* pattern `src/cli/program.ts`'s `commander` wiring and `src/cli/init-command.ts`'s `createReadlinePrompt`
|
|
10
10
|
* already use, and for the same reason:
|
|
11
11
|
*
|
|
12
|
-
* - {@link createMcpServer} does all the wiring (construct the `McpServer`, register
|
|
13
|
-
*
|
|
12
|
+
* - {@link createMcpServer} does all the wiring (construct the `McpServer`, register its channel set)
|
|
13
|
+
* and performs NO transport / stdio / process I/O, so it is exercised end-to-end over the SDK's
|
|
14
14
|
* in-memory transport + a real `Client` in `test/mcp/server.test.ts` (the three P5.2.1 acceptance
|
|
15
15
|
* criteria + the read-only-only scope assertion).
|
|
16
16
|
* - {@link startMcpServer} adds the single line that cannot be unit-tested without opening a real
|
|
@@ -18,12 +18,13 @@
|
|
|
18
18
|
* never by an automated test (a test must never open a real stdio server against a repo).
|
|
19
19
|
*
|
|
20
20
|
* Channel scope (spec-014 §3): `createMcpServer` registers the read-only Resources channel
|
|
21
|
-
* (`registerReadOnlyResources` — spec-004 §2, P5.2.1)
|
|
22
|
-
* (
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* (
|
|
26
|
-
*
|
|
21
|
+
* (`registerReadOnlyResources` — spec-004 §2, P5.2.1), the read-only role Prompts channel
|
|
22
|
+
* (`registerRolePrompts` — spec-004 §3, P5.2.2, since task-058-mcp-prompts-role-based), and an **empty
|
|
23
|
+
* Tools channel** ({@link registerEmptyToolsChannel}, task-174, `bug-151`). It deliberately does NOT
|
|
24
|
+
* call `registerCoreModules`, which would advertise a mutating Tool for every `mutates: true`
|
|
25
|
+
* CoreOperation (as of task-025, `dnaSet` -> the `dna.set` Tool) — Tools are P5.2.3 (v0.4) scope and
|
|
26
|
+
* will replace the empty channel here later; the entry point (`wingfoil mcp` + this transport wiring)
|
|
27
|
+
* is unchanged by those additions.
|
|
27
28
|
*/
|
|
28
29
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
29
30
|
/** Construction/connection options for the production MCP server. */
|
|
@@ -34,18 +35,24 @@ export interface McpServerOptions {
|
|
|
34
35
|
* resolves the root once up front and passes a closure returning that value (spec-014 §1).
|
|
35
36
|
*/
|
|
36
37
|
readonly resolveRoot: () => string;
|
|
38
|
+
/**
|
|
39
|
+
* The DNA role set the Prompts channel serves, one `{role}-session` Prompt each, fixed for the
|
|
40
|
+
* server's life (spec-004 §3.1, `dl-049` (b)). `wingfoil mcp` reads it in its pre-flight
|
|
41
|
+
* (`loadDnaRoleSet`), so construction itself reads nothing (spec-014 §2).
|
|
42
|
+
*/
|
|
43
|
+
readonly roles: readonly string[];
|
|
37
44
|
/** Server identity `name`; defaults to `wingfoil`. */
|
|
38
45
|
readonly name?: string;
|
|
39
46
|
/** Server identity `version`; defaults to `0.0.0` (the `wingfoil mcp` command passes the real package version). */
|
|
40
47
|
readonly version?: string;
|
|
41
48
|
}
|
|
42
49
|
/**
|
|
43
|
-
* Construct the production `McpServer` and register
|
|
44
|
-
*
|
|
45
|
-
* side effects (spec-014 §2: "no
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
50
|
+
* Construct the production `McpServer` and register its channel set on it (spec-014 §3): the read-only
|
|
51
|
+
* Resources, the role Prompts over the given role set, and the empty Tools channel. Pure and
|
|
52
|
+
* synchronous — no transport, no stdio, no filesystem read, no process side effects (spec-014 §2: "no
|
|
53
|
+
* I/O at construction time beyond wiring handlers"); the role set arrives already read, and every
|
|
54
|
+
* handler resolves the root and reads the project per request. So a test can connect it over the SDK's
|
|
55
|
+
* in-memory transport and drive it with a real `Client`.
|
|
49
56
|
*/
|
|
50
57
|
export declare function createMcpServer(options: McpServerOptions): McpServer;
|
|
51
58
|
/**
|
package/dist/mcp/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOpE,qEAAqE;AACrE,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,sDAAsD;IACtD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,mHAAmH;IACnH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AA4BD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAUpE;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAKlF"}
|
package/dist/mcp/server.js
CHANGED
|
@@ -13,8 +13,8 @@ exports.startMcpServer = startMcpServer;
|
|
|
13
13
|
* pattern `src/cli/program.ts`'s `commander` wiring and `src/cli/init-command.ts`'s `createReadlinePrompt`
|
|
14
14
|
* already use, and for the same reason:
|
|
15
15
|
*
|
|
16
|
-
* - {@link createMcpServer} does all the wiring (construct the `McpServer`, register
|
|
17
|
-
*
|
|
16
|
+
* - {@link createMcpServer} does all the wiring (construct the `McpServer`, register its channel set)
|
|
17
|
+
* and performs NO transport / stdio / process I/O, so it is exercised end-to-end over the SDK's
|
|
18
18
|
* in-memory transport + a real `Client` in `test/mcp/server.test.ts` (the three P5.2.1 acceptance
|
|
19
19
|
* criteria + the read-only-only scope assertion).
|
|
20
20
|
* - {@link startMcpServer} adds the single line that cannot be unit-tested without opening a real
|
|
@@ -22,23 +22,47 @@ exports.startMcpServer = startMcpServer;
|
|
|
22
22
|
* never by an automated test (a test must never open a real stdio server against a repo).
|
|
23
23
|
*
|
|
24
24
|
* Channel scope (spec-014 §3): `createMcpServer` registers the read-only Resources channel
|
|
25
|
-
* (`registerReadOnlyResources` — spec-004 §2, P5.2.1)
|
|
26
|
-
* (
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* (
|
|
30
|
-
*
|
|
25
|
+
* (`registerReadOnlyResources` — spec-004 §2, P5.2.1), the read-only role Prompts channel
|
|
26
|
+
* (`registerRolePrompts` — spec-004 §3, P5.2.2, since task-058-mcp-prompts-role-based), and an **empty
|
|
27
|
+
* Tools channel** ({@link registerEmptyToolsChannel}, task-174, `bug-151`). It deliberately does NOT
|
|
28
|
+
* call `registerCoreModules`, which would advertise a mutating Tool for every `mutates: true`
|
|
29
|
+
* CoreOperation (as of task-025, `dnaSet` -> the `dna.set` Tool) — Tools are P5.2.3 (v0.4) scope and
|
|
30
|
+
* will replace the empty channel here later; the entry point (`wingfoil mcp` + this transport wiring)
|
|
31
|
+
* is unchanged by those additions.
|
|
31
32
|
*/
|
|
32
33
|
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
33
34
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
35
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
34
36
|
const index_1 = require("./index");
|
|
35
37
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
38
|
+
* Declare the Tools channel and answer it with no Tools (task-174, `bug-151`), until P5.2.3 (v0.4)
|
|
39
|
+
* registers real ones. A client that probes `tools/list` gets `{tools: []}` rather than the JSON-RPC
|
|
40
|
+
* `-32601` it got while the channel was undeclared, and `initialize` advertises `tools: {}` — without
|
|
41
|
+
* `listChanged`, since the list cannot change during a session.
|
|
42
|
+
*
|
|
43
|
+
* A `tools/call` necessarily names a Tool that does not exist. It is answered the way spec-004 §4.3
|
|
44
|
+
* item 4 answers every Tool refusal — an `isError: true` result, not a JSON-RPC error — with the SDK's
|
|
45
|
+
* own wording for an unknown Tool, `Tool <name> not found`.
|
|
46
|
+
*
|
|
47
|
+
* Owned on the low-level server, like the Prompts handlers (`./prompt.ts`): the SDK installs its own
|
|
48
|
+
* Tools handlers only on the first `registerTool`, and a later `registerTool` on this server fails
|
|
49
|
+
* loudly ("A request handler for tools/list already exists") instead of being silently shadowed.
|
|
50
|
+
*/
|
|
51
|
+
function registerEmptyToolsChannel(server) {
|
|
52
|
+
server.server.registerCapabilities({ tools: {} });
|
|
53
|
+
server.server.setRequestHandler(types_js_1.ListToolsRequestSchema, () => ({ tools: [] }));
|
|
54
|
+
server.server.setRequestHandler(types_js_1.CallToolRequestSchema, (request) => ({
|
|
55
|
+
content: [{ type: 'text', text: `Tool ${request.params.name} not found` }],
|
|
56
|
+
isError: true,
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Construct the production `McpServer` and register its channel set on it (spec-014 §3): the read-only
|
|
61
|
+
* Resources, the role Prompts over the given role set, and the empty Tools channel. Pure and
|
|
62
|
+
* synchronous — no transport, no stdio, no filesystem read, no process side effects (spec-014 §2: "no
|
|
63
|
+
* I/O at construction time beyond wiring handlers"); the role set arrives already read, and every
|
|
64
|
+
* handler resolves the root and reads the project per request. So a test can connect it over the SDK's
|
|
65
|
+
* in-memory transport and drive it with a real `Client`.
|
|
42
66
|
*/
|
|
43
67
|
function createMcpServer(options) {
|
|
44
68
|
const server = new mcp_js_1.McpServer({
|
|
@@ -46,7 +70,9 @@ function createMcpServer(options) {
|
|
|
46
70
|
version: options.version ?? '0.0.0',
|
|
47
71
|
});
|
|
48
72
|
(0, index_1.registerReadOnlyResources)(server, { resolveRoot: options.resolveRoot });
|
|
49
|
-
(0, index_1.registerRolePrompts)(server, { resolveRoot: options.resolveRoot });
|
|
73
|
+
(0, index_1.registerRolePrompts)(server, { resolveRoot: options.resolveRoot, roles: options.roles });
|
|
74
|
+
(0, index_1.registerSessionContextResource)(server, { resolveRoot: options.resolveRoot, roles: options.roles });
|
|
75
|
+
registerEmptyToolsChannel(server);
|
|
50
76
|
return server;
|
|
51
77
|
}
|
|
52
78
|
/**
|
package/dist/mcp/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";;AAyFA,0CAUC;AAQD,wCAKC;AAhHD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,oEAAoE;AACpE,wEAAiF;AACjF,iEAAmG;AAGnG,mCAAyG;AAsBzG;;;;;;;;;;;;;GAaG;AACH,SAAS,yBAAyB,CAAC,MAAiB;IAClD,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAClD,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,iCAAsB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/E,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAC7B,gCAAqB,EACrB,CAAC,OAAO,EAAkB,EAAE,CAAC,CAAC;QAC5B,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,OAAO,CAAC,MAAM,CAAC,IAAI,YAAY,EAAE,CAAC;QAC1E,OAAO,EAAE,IAAI;KACd,CAAC,CACH,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,eAAe,CAAC,OAAyB;IACvD,MAAM,MAAM,GAAG,IAAI,kBAAS,CAAC;QAC3B,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,UAAU;QAChC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,OAAO;KACpC,CAAC,CAAC;IACH,IAAA,iCAAyB,EAAC,MAAM,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACxE,IAAA,2BAAmB,EAAC,MAAM,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IACxF,IAAA,sCAA8B,EAAC,MAAM,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IACnG,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,cAAc,CAAC,OAAyB;IAC5D,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
/** `spec-004` §2.1 — the execution context of `role` on `element` at the commit `state` (task-236). */
|
|
3
|
+
export declare const SESSION_CONTEXT_URI_TEMPLATE = "wingfoil://session/{role}/{element}/{state}";
|
|
4
|
+
/** Options for {@link registerSessionContextResource}. */
|
|
5
|
+
export interface RegisterSessionContextResourceOptions {
|
|
6
|
+
/** Resolves the project root each read is served from. */
|
|
7
|
+
readonly resolveRoot: () => string;
|
|
8
|
+
/** The DNA role set, fixed at server start (`spec-004` §3.1), the same set the Prompts are registered for. */
|
|
9
|
+
readonly roles: readonly string[];
|
|
10
|
+
}
|
|
11
|
+
/** Register the session Resource template on `server` (task-236). */
|
|
12
|
+
export declare function registerSessionContextResource(server: McpServer, options: RegisterSessionContextResourceOptions): void;
|
|
13
|
+
//# sourceMappingURL=session-resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-resource.d.ts","sourceRoot":"","sources":["../../src/mcp/session-resource.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,uGAAuG;AACvG,eAAO,MAAM,4BAA4B,gDAAgD,CAAC;AAE1F,0DAA0D;AAC1D,MAAM,WAAW,qCAAqC;IACpD,0DAA0D;IAC1D,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,CAAC;IACnC,8GAA8G;IAC9G,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAgBD,qEAAqE;AACrE,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,qCAAqC,GAAG,IAAI,CAoBtH"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SESSION_CONTEXT_URI_TEMPLATE = void 0;
|
|
4
|
+
exports.registerSessionContextResource = registerSessionContextResource;
|
|
5
|
+
/**
|
|
6
|
+
* The session Resource `wingfoil://session/{role}/{element}/{state}` (task-236; approver ruling (a) of
|
|
7
|
+
* 2026-10-13 and D-E…D-G of 2026-10-14; `spec-016` §2.4, `spec-004` §2.1/§3.4): the execution context of the
|
|
8
|
+
* `{role}-session` Prompt for `(role, element, state)`, served also as a read-only Resource, byte for byte.
|
|
9
|
+
*
|
|
10
|
+
* **Why both.** An agent CLI may let its model read MCP Resources but not get MCP Prompts: the by-hand pass of
|
|
11
|
+
* the `claude-code` built-in found Claude Code 2.1.296's model has `ListMcpResourcesTool` and
|
|
12
|
+
* `ReadMcpResourceTool` and no way to get a Prompt, which Claude Code offers only as a command the user types.
|
|
13
|
+
* `agent execute`'s bootstrap therefore names this Resource; the Prompt stays served, unchanged.
|
|
14
|
+
*
|
|
15
|
+
* **Never listed.** `state` is any commit, so the template has no `list` callback: `resources/list` names no
|
|
16
|
+
* `wingfoil://session/` URI and `resources/templates/list` declares the template. A client reads it by the full
|
|
17
|
+
* URI the bootstrap gives; the SDK matches a read against every registered template.
|
|
18
|
+
*
|
|
19
|
+
* **The variables.** `{element}` is the Prompt's `element` argument, `<type>:<id>` (`spec-008` §7), in one
|
|
20
|
+
* segment (`:` is a legal path character; no id holds `/` or `,`). Each variable is percent-decoded before it
|
|
21
|
+
* is checked, so `task%3Atask-042-foo` reads as `task:task-042-foo`.
|
|
22
|
+
*
|
|
23
|
+
* **Refusals**, in order: a write intent (`spec-004` §2.3), before anything is read; a role outside the role set
|
|
24
|
+
* fixed at server start (`spec-004` §3.1) → `no session context for undefined role '<role>'`; then the
|
|
25
|
+
* Prompt's own (§3.4): a malformed element-ref, a malformed revision, a revision naming no commit and an element
|
|
26
|
+
* the commit does not hold are `-32602`; a context the repository refuses is a failed read.
|
|
27
|
+
*/
|
|
28
|
+
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
29
|
+
const core_1 = require("../core");
|
|
30
|
+
const prompt_1 = require("./prompt");
|
|
31
|
+
const read_only_1 = require("./read-only");
|
|
32
|
+
/** `spec-004` §2.1 — the execution context of `role` on `element` at the commit `state` (task-236). */
|
|
33
|
+
exports.SESSION_CONTEXT_URI_TEMPLATE = 'wingfoil://session/{role}/{element}/{state}';
|
|
34
|
+
/**
|
|
35
|
+
* A URI variable, percent-decoded; left as sent when it is not valid percent-encoding (the check then refuses
|
|
36
|
+
* it). The SDK types a variable `string | string[]`; none of this template's variables has the explode
|
|
37
|
+
* modifier, so it is always one string (as `memory-resource.ts` notes for its own).
|
|
38
|
+
*/
|
|
39
|
+
function decoded(value) {
|
|
40
|
+
const text = value;
|
|
41
|
+
try {
|
|
42
|
+
return decodeURIComponent(text);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return text;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Register the session Resource template on `server` (task-236). */
|
|
49
|
+
function registerSessionContextResource(server, options) {
|
|
50
|
+
server.registerResource('session.context', new mcp_js_1.ResourceTemplate(exports.SESSION_CONTEXT_URI_TEMPLATE, { list: undefined }), {
|
|
51
|
+
description: "the execution context of a role on a Memory element at a commit, as the '{role}-session' prompt returns it with element and state (read-only)",
|
|
52
|
+
mimeType: 'text/markdown',
|
|
53
|
+
}, (uri, variables, extra) => (0, read_only_1.withRefusalDetails)(() => {
|
|
54
|
+
(0, read_only_1.refuseIfWriteIntent)(extra._meta);
|
|
55
|
+
const role = decoded(variables.role);
|
|
56
|
+
if (!options.roles.includes(role))
|
|
57
|
+
throw (0, prompt_1.promptRequestError)(`no session context for undefined role '${role}'`);
|
|
58
|
+
const element = (0, core_1.parseElementRef)(decoded(variables.element));
|
|
59
|
+
if (!element.ok)
|
|
60
|
+
throw (0, prompt_1.promptRequestError)(element.error.message);
|
|
61
|
+
const { text, warnings } = (0, prompt_1.buildSessionContext)(options.resolveRoot(), role, element.value, decoded(variables.state));
|
|
62
|
+
return (0, read_only_1.withWarnings)({ contents: [{ uri: uri.toString(), mimeType: 'text/markdown', text }] }, warnings);
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=session-resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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C,KAAK,CAAC,OAAO,CAAC,CAAC;QACjE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAA,4BAAmB,EAAC,OAAO,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QACrH,OAAO,IAAA,wBAAY,EAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC1G,CAAC,CAAC,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -14,4 +14,22 @@ export declare const WORKFLOW_DOCUMENT_URI_TEMPLATE = "wingfoil://workflows/{nam
|
|
|
14
14
|
* task registers.
|
|
15
15
|
*/
|
|
16
16
|
export declare function registerWorkflowResources(server: McpServer, options: RegisterWorkflowResourcesOptions): void;
|
|
17
|
+
/** spec-017 §9 — the active instance's next step: `wingfoil workflow next --format json`'s `NextResult`, at `HEAD`. */
|
|
18
|
+
export declare const WORKFLOW_NEXT_URI = "wingfoil://workflows/-/next";
|
|
19
|
+
/** spec-017 §9 — every open instance: `wingfoil workflow status --format json`'s `StatusResult`, at `HEAD`. */
|
|
20
|
+
export declare const WORKFLOW_STATUS_URI = "wingfoil://workflows/-/status";
|
|
21
|
+
/**
|
|
22
|
+
* Register the two workflow-state Resources on `server` (task-239; `spec-017` §9, ruling R12; `spec-004` §2.1).
|
|
23
|
+
* They cannot collide with `wingfoil://workflows/{name}`: their second segment is `-`, which no workflow name
|
|
24
|
+
* can be (`spec-003` names start with a letter), and they have a third segment, which the single-segment
|
|
25
|
+
* `{name}` template never matches — so a workflow named `next` stays `wingfoil://workflows/next`. Each read runs the core
|
|
26
|
+
* function the CLI command runs with no operand — `workflowNextAtHead` / `workflowStatusAtHead`, the
|
|
27
|
+
* deduction at `HEAD` — and returns its value serialized as the CLI's `--format json` prints it (without the
|
|
28
|
+
* final newline). Nothing is cached: every read deduces again. A refusal is a failed read carrying the CLI's
|
|
29
|
+
* message and details (spec-004 §4.3 item 4), whether core returns it (`CoreResult.error`, through
|
|
30
|
+
* `coreResultResource`) or a loader throws it (`withRefusalDetails`); a read carrying a write intent is refused
|
|
31
|
+
* first (spec-004 §2.3). With no operand neither function returns a `CoreResult.error` today (only an
|
|
32
|
+
* unresolvable `<ref>` does, `spec-017` §10), so the first path is the shared helper's, tested on its own.
|
|
33
|
+
*/
|
|
34
|
+
export declare function registerWorkflowStateResources(server: McpServer, options: RegisterWorkflowResourcesOptions): void;
|
|
17
35
|
//# sourceMappingURL=workflow-resource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-resource.d.ts","sourceRoot":"","sources":["../../src/mcp/workflow-resource.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflow-resource.d.ts","sourceRoot":"","sources":["../../src/mcp/workflow-resource.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMzE,qDAAqD;AACrD,MAAM,WAAW,gCAAgC;IAC/C,0HAA0H;IAC1H,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,CAAC;CACpC;AAED,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAC/D,oFAAoF;AACpF,eAAO,MAAM,8BAA8B,gCAAgC,CAAC;AAE5E;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,gCAAgC,GAAG,IAAI,CAuC5G;AAED,uHAAuH;AACvH,eAAO,MAAM,iBAAiB,gCAAgC,CAAC;AAC/D,+GAA+G;AAC/G,eAAO,MAAM,mBAAmB,kCAAkC,CAAC;AAEnE;;;;;;;;;;;;GAYG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,gCAAgC,GAAG,IAAI,CAejH"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WORKFLOW_DOCUMENT_URI_TEMPLATE = exports.WORKFLOWS_COLLECTION_URI = void 0;
|
|
3
|
+
exports.WORKFLOW_STATUS_URI = exports.WORKFLOW_NEXT_URI = exports.WORKFLOW_DOCUMENT_URI_TEMPLATE = exports.WORKFLOWS_COLLECTION_URI = void 0;
|
|
4
4
|
exports.registerWorkflowResources = registerWorkflowResources;
|
|
5
|
+
exports.registerWorkflowStateResources = registerWorkflowStateResources;
|
|
5
6
|
/**
|
|
6
|
-
* `wingfoil://workflows` (collection)
|
|
7
|
-
*
|
|
7
|
+
* `wingfoil://workflows` (collection), `wingfoil://workflows/{name}` (one workflow definition) and,
|
|
8
|
+
* since task-239, `wingfoil://workflows/-/next` and `-/status` Resources — task-011, REQ-INT-01,
|
|
8
9
|
* spec-004-mcp-surface-contract §2.1. Distinct from `registerCoreModules`'s existing
|
|
9
10
|
* `wingfoil://workflow/list` Resource (task-006-dual-interface-shared-core, the generic
|
|
10
11
|
* `wingfoil://{module}/{verb}` transform of the `workflowList` `CoreOperation`) — both coexist; this
|
|
@@ -18,7 +19,8 @@ exports.registerWorkflowResources = registerWorkflowResources;
|
|
|
18
19
|
* here distinguishes them beyond what each workflow's own `kind` field already reports.
|
|
19
20
|
*
|
|
20
21
|
* Registered directly via `McpServer.registerResource`, not through `registerCoreModules`'s
|
|
21
|
-
* `CoreModule[]` registry —
|
|
22
|
+
* `CoreModule[]` registry — `workflowList` / `workflowShow` answer from `HEAD` with another payload, while
|
|
23
|
+
* the first two keep theirs and the working tree in v0.3, the state Resources answer at `HEAD` (spec-017 §9); same
|
|
22
24
|
* spec-006-core-domain-api §4 parity deviation `memory-resource.ts`/`dna-resource.ts` document for
|
|
23
25
|
* their own Resources, for the same reason (task-030-implement-mcp-resources' scope).
|
|
24
26
|
*/
|
|
@@ -35,7 +37,7 @@ exports.WORKFLOW_DOCUMENT_URI_TEMPLATE = 'wingfoil://workflows/{name}';
|
|
|
35
37
|
* task registers.
|
|
36
38
|
*/
|
|
37
39
|
function registerWorkflowResources(server, options) {
|
|
38
|
-
server.registerResource('workflows.list', exports.WORKFLOWS_COLLECTION_URI, { description: 'every loaded workflow definition, summary only (read-only)' },
|
|
40
|
+
server.registerResource('workflows.list', exports.WORKFLOWS_COLLECTION_URI, { description: 'every loaded workflow definition, summary only (read-only)' }, (uri, extra) => (0, read_only_1.withRefusalDetails)(() => {
|
|
39
41
|
(0, read_only_1.refuseIfWriteIntent)(extra._meta);
|
|
40
42
|
const root = options.resolveRoot();
|
|
41
43
|
const { workflows } = (0, core_1.loadWorkflowsYaml)(root);
|
|
@@ -44,9 +46,9 @@ function registerWorkflowResources(server, options) {
|
|
|
44
46
|
.map(({ name, kind, description }) => ({ name, kind, description }))
|
|
45
47
|
.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
46
48
|
return (0, read_only_1.jsonResourceResult)(uri, summaries);
|
|
47
|
-
});
|
|
49
|
+
}));
|
|
48
50
|
const documentTemplate = new mcp_js_1.ResourceTemplate(exports.WORKFLOW_DOCUMENT_URI_TEMPLATE, { list: undefined });
|
|
49
|
-
server.registerResource('workflows.show', documentTemplate, { description: 'one workflow definition, full content (read-only)' },
|
|
51
|
+
server.registerResource('workflows.show', documentTemplate, { description: 'one workflow definition, full content (read-only)' }, (uri, variables, extra) => (0, read_only_1.withRefusalDetails)(() => {
|
|
50
52
|
(0, read_only_1.refuseIfWriteIntent)(extra._meta);
|
|
51
53
|
const root = options.resolveRoot();
|
|
52
54
|
const { workflows } = (0, core_1.loadWorkflowsYaml)(root);
|
|
@@ -58,6 +60,33 @@ function registerWorkflowResources(server, options) {
|
|
|
58
60
|
if (!workflow)
|
|
59
61
|
throw (0, read_only_1.resourceNotFoundError)(`workflows/${name}`);
|
|
60
62
|
return (0, read_only_1.jsonResourceResult)(uri, workflow);
|
|
61
|
-
});
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
/** spec-017 §9 — the active instance's next step: `wingfoil workflow next --format json`'s `NextResult`, at `HEAD`. */
|
|
66
|
+
exports.WORKFLOW_NEXT_URI = 'wingfoil://workflows/-/next';
|
|
67
|
+
/** spec-017 §9 — every open instance: `wingfoil workflow status --format json`'s `StatusResult`, at `HEAD`. */
|
|
68
|
+
exports.WORKFLOW_STATUS_URI = 'wingfoil://workflows/-/status';
|
|
69
|
+
/**
|
|
70
|
+
* Register the two workflow-state Resources on `server` (task-239; `spec-017` §9, ruling R12; `spec-004` §2.1).
|
|
71
|
+
* They cannot collide with `wingfoil://workflows/{name}`: their second segment is `-`, which no workflow name
|
|
72
|
+
* can be (`spec-003` names start with a letter), and they have a third segment, which the single-segment
|
|
73
|
+
* `{name}` template never matches — so a workflow named `next` stays `wingfoil://workflows/next`. Each read runs the core
|
|
74
|
+
* function the CLI command runs with no operand — `workflowNextAtHead` / `workflowStatusAtHead`, the
|
|
75
|
+
* deduction at `HEAD` — and returns its value serialized as the CLI's `--format json` prints it (without the
|
|
76
|
+
* final newline). Nothing is cached: every read deduces again. A refusal is a failed read carrying the CLI's
|
|
77
|
+
* message and details (spec-004 §4.3 item 4), whether core returns it (`CoreResult.error`, through
|
|
78
|
+
* `coreResultResource`) or a loader throws it (`withRefusalDetails`); a read carrying a write intent is refused
|
|
79
|
+
* first (spec-004 §2.3). With no operand neither function returns a `CoreResult.error` today (only an
|
|
80
|
+
* unresolvable `<ref>` does, `spec-017` §10), so the first path is the shared helper's, tested on its own.
|
|
81
|
+
*/
|
|
82
|
+
function registerWorkflowStateResources(server, options) {
|
|
83
|
+
const register = (name, uri, description, read) => {
|
|
84
|
+
server.registerResource(name, uri, { description }, (readUri, extra) => (0, read_only_1.withRefusalDetails)(() => {
|
|
85
|
+
(0, read_only_1.refuseIfWriteIntent)(extra._meta);
|
|
86
|
+
return (0, read_only_1.coreResultResource)(readUri, read(options.resolveRoot()));
|
|
87
|
+
}));
|
|
88
|
+
};
|
|
89
|
+
register('workflows.next', exports.WORKFLOW_NEXT_URI, 'the next step of the active workflow instance, as committed at HEAD (read-only)', (root) => (0, core_1.workflowNextAtHead)(root));
|
|
90
|
+
register('workflows.status', exports.WORKFLOW_STATUS_URI, 'every open workflow instance, its pending approvals and the elements waiting at a gate, as committed at HEAD (read-only)', (root) => (0, core_1.workflowStatusAtHead)(root));
|
|
62
91
|
}
|
|
63
92
|
//# sourceMappingURL=workflow-resource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-resource.js","sourceRoot":"","sources":["../../src/mcp/workflow-resource.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"workflow-resource.js","sourceRoot":"","sources":["../../src/mcp/workflow-resource.ts"],"names":[],"mappings":";;;AA4CA,8DAuCC;AAoBD,wEAeC;AAtHD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,oEAA2E;AAG3E,kCAAuG;AAEvG,2CAAqI;AAQrI,wEAAwE;AAC3D,QAAA,wBAAwB,GAAG,sBAAsB,CAAC;AAC/D,oFAAoF;AACvE,QAAA,8BAA8B,GAAG,6BAA6B,CAAC;AAE5E;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,MAAiB,EAAE,OAAyC;IACpG,MAAM,CAAC,gBAAgB,CACrB,gBAAgB,EAChB,gCAAwB,EACxB,EAAE,WAAW,EAAE,4DAA4D,EAAE,EAC7E,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CACb,IAAA,8BAAkB,EAAC,GAAG,EAAE;QACtB,IAAA,+BAAmB,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACjC,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;QACnC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,wBAAiB,EAAC,IAAI,CAAC,CAAC;QAC9C,2FAA2F;QAC3F,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