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
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agent adapter manifest schema (`spec-016-agent-execution` §2.2, task-177): how to launch one
|
|
3
|
+
* agent CLI, declared in `.wingfoil/agents/{built-in,custom}/<name>.yaml`.
|
|
4
|
+
*
|
|
5
|
+
* Unlike every pillar file, each object node is **strict** (`z.strictObject`), so an unknown key is a
|
|
6
|
+
* Pass-1 validation error rather than `spec-009` §2's tolerated warning: a misspelt `args` would
|
|
7
|
+
* otherwise launch the agent without its MCP registration (§2.2). This is the one structural layer.
|
|
8
|
+
* The rules that cross fields — what a value of one field makes required in another (§2.2's "Req."
|
|
9
|
+
* column), and where each placeholder is legal (§2.3) — are Pass-2 checks in `./manifest.ts`, because
|
|
10
|
+
* they read several fields at once and must name the field they fault.
|
|
11
|
+
*
|
|
12
|
+
* There is deliberately no `env:` field (§2.2): credentials stay inside the agent CLI (`adr-012` point 1).
|
|
13
|
+
* The TypeScript type is derived with `z.infer`.
|
|
14
|
+
*/
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
import { ADAPTER_MANIFEST_FORMAT } from '../validation/format';
|
|
17
|
+
/**
|
|
18
|
+
* The manifest format this build reads (`spec-016` §2.2 `format`). A new manifest field bumps it.
|
|
19
|
+
* Declared in `src/validation/format.ts` beside every other file kind's format (task-251, `dl-149`).
|
|
20
|
+
*/
|
|
21
|
+
export { ADAPTER_MANIFEST_FORMAT };
|
|
22
|
+
/**
|
|
23
|
+
* One adapter manifest, `spec-016` §2.2, field for field. A field the table marks "required with"
|
|
24
|
+
* another field's value is optional here and enforced in Pass 2 (`adapterManifestIssues`,
|
|
25
|
+
* `./manifest.ts`).
|
|
26
|
+
*/
|
|
27
|
+
export declare const AdapterManifest: z.ZodObject<{
|
|
28
|
+
name: z.ZodString;
|
|
29
|
+
format: z.ZodLiteral<1>;
|
|
30
|
+
command: z.ZodString;
|
|
31
|
+
verified_with: z.ZodOptional<z.ZodString>;
|
|
32
|
+
version_args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
|
+
launch: z.ZodObject<{
|
|
34
|
+
interactive: z.ZodObject<{
|
|
35
|
+
args: z.ZodArray<z.ZodString>;
|
|
36
|
+
terminal: z.ZodDefault<z.ZodEnum<{
|
|
37
|
+
optional: "optional";
|
|
38
|
+
required: "required";
|
|
39
|
+
}>>;
|
|
40
|
+
}, z.core.$strict>;
|
|
41
|
+
headless: z.ZodOptional<z.ZodObject<{
|
|
42
|
+
args: z.ZodArray<z.ZodString>;
|
|
43
|
+
output: z.ZodEnum<{
|
|
44
|
+
none: "none";
|
|
45
|
+
json: "json";
|
|
46
|
+
}>;
|
|
47
|
+
}, z.core.$strict>>;
|
|
48
|
+
}, z.core.$strict>;
|
|
49
|
+
prompt: z.ZodObject<{
|
|
50
|
+
via: z.ZodEnum<{
|
|
51
|
+
file: "file";
|
|
52
|
+
arg: "arg";
|
|
53
|
+
stdin: "stdin";
|
|
54
|
+
}>;
|
|
55
|
+
}, z.core.$strict>;
|
|
56
|
+
mcp: z.ZodObject<{
|
|
57
|
+
via: z.ZodEnum<{
|
|
58
|
+
args: "args";
|
|
59
|
+
"config-file": "config-file";
|
|
60
|
+
"config-arg": "config-arg";
|
|
61
|
+
}>;
|
|
62
|
+
template: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strict>;
|
|
64
|
+
session: z.ZodObject<{
|
|
65
|
+
id: z.ZodEnum<{
|
|
66
|
+
output: "output";
|
|
67
|
+
assign: "assign";
|
|
68
|
+
none: "none";
|
|
69
|
+
lookup: "lookup";
|
|
70
|
+
}>;
|
|
71
|
+
assign_args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
72
|
+
lookup_args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
73
|
+
field: z.ZodOptional<z.ZodString>;
|
|
74
|
+
resume: z.ZodObject<{
|
|
75
|
+
supported: z.ZodBoolean;
|
|
76
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
77
|
+
}, z.core.$strict>;
|
|
78
|
+
}, z.core.$strict>;
|
|
79
|
+
usage: z.ZodObject<{
|
|
80
|
+
from: z.ZodEnum<{
|
|
81
|
+
output: "output";
|
|
82
|
+
none: "none";
|
|
83
|
+
lookup: "lookup";
|
|
84
|
+
}>;
|
|
85
|
+
lookup_args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
86
|
+
fields: z.ZodOptional<z.ZodObject<{
|
|
87
|
+
model: z.ZodOptional<z.ZodString>;
|
|
88
|
+
input: z.ZodOptional<z.ZodString>;
|
|
89
|
+
output: z.ZodOptional<z.ZodString>;
|
|
90
|
+
cache_read: z.ZodOptional<z.ZodString>;
|
|
91
|
+
cache_write: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strict>>;
|
|
93
|
+
}, z.core.$strict>;
|
|
94
|
+
summary: z.ZodOptional<z.ZodObject<{
|
|
95
|
+
export_args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
96
|
+
}, z.core.$strict>>;
|
|
97
|
+
}, z.core.$strict>;
|
|
98
|
+
/** A validated adapter manifest (`spec-016` §2.2), `launch.interactive.terminal` defaulted. */
|
|
99
|
+
export type AdapterManifest = z.infer<typeof AdapterManifest>;
|
|
100
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/agent/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAG/D;;;GAGG;AACH,OAAO,EAAE,uBAAuB,EAAE,CAAC;AA8BnC;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAsC1B,CAAC;AAEH,+FAA+F;AAC/F,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AdapterManifest = exports.ADAPTER_MANIFEST_FORMAT = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The agent adapter manifest schema (`spec-016-agent-execution` §2.2, task-177): how to launch one
|
|
6
|
+
* agent CLI, declared in `.wingfoil/agents/{built-in,custom}/<name>.yaml`.
|
|
7
|
+
*
|
|
8
|
+
* Unlike every pillar file, each object node is **strict** (`z.strictObject`), so an unknown key is a
|
|
9
|
+
* Pass-1 validation error rather than `spec-009` §2's tolerated warning: a misspelt `args` would
|
|
10
|
+
* otherwise launch the agent without its MCP registration (§2.2). This is the one structural layer.
|
|
11
|
+
* The rules that cross fields — what a value of one field makes required in another (§2.2's "Req."
|
|
12
|
+
* column), and where each placeholder is legal (§2.3) — are Pass-2 checks in `./manifest.ts`, because
|
|
13
|
+
* they read several fields at once and must name the field they fault.
|
|
14
|
+
*
|
|
15
|
+
* There is deliberately no `env:` field (§2.2): credentials stay inside the agent CLI (`adr-012` point 1).
|
|
16
|
+
* The TypeScript type is derived with `z.infer`.
|
|
17
|
+
*/
|
|
18
|
+
const zod_1 = require("zod");
|
|
19
|
+
const format_1 = require("../validation/format");
|
|
20
|
+
Object.defineProperty(exports, "ADAPTER_MANIFEST_FORMAT", { enumerable: true, get: function () { return format_1.ADAPTER_MANIFEST_FORMAT; } });
|
|
21
|
+
const id_1 = require("../validation/id");
|
|
22
|
+
/** An argv template: a list of whole arguments, never a shell string (`dl-090` Q3 (a)). */
|
|
23
|
+
const Argv = zod_1.z.array(zod_1.z.string());
|
|
24
|
+
/** A non-empty string: a field whose empty value could only be a mistake. */
|
|
25
|
+
const NonEmpty = zod_1.z.string().min(1, 'must not be empty');
|
|
26
|
+
/** `launch.interactive` — the v0.3 launch, the agent owning the terminal (`adr-012` point 4). */
|
|
27
|
+
const InteractiveLaunch = zod_1.z.strictObject({
|
|
28
|
+
args: Argv,
|
|
29
|
+
/** Whether the launch needs a terminal on stdin and stdout (§3.3 step 12); `required` when absent. */
|
|
30
|
+
terminal: zod_1.z.enum(['required', 'optional']).default('required'),
|
|
31
|
+
});
|
|
32
|
+
/** `launch.headless` — no terminal, a structured result; read from v1.0 (§3.5). */
|
|
33
|
+
const HeadlessLaunch = zod_1.z.strictObject({
|
|
34
|
+
args: Argv,
|
|
35
|
+
output: zod_1.z.enum(['json', 'none']),
|
|
36
|
+
});
|
|
37
|
+
/** The JSON paths `usage.fields` may declare (§2.2); an undeclared one yields `not-reported`. */
|
|
38
|
+
const UsageFields = zod_1.z.strictObject({
|
|
39
|
+
model: NonEmpty.optional(),
|
|
40
|
+
input: NonEmpty.optional(),
|
|
41
|
+
output: NonEmpty.optional(),
|
|
42
|
+
cache_read: NonEmpty.optional(),
|
|
43
|
+
cache_write: NonEmpty.optional(),
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* One adapter manifest, `spec-016` §2.2, field for field. A field the table marks "required with"
|
|
47
|
+
* another field's value is optional here and enforced in Pass 2 (`adapterManifestIssues`,
|
|
48
|
+
* `./manifest.ts`).
|
|
49
|
+
*/
|
|
50
|
+
exports.AdapterManifest = zod_1.z.strictObject({
|
|
51
|
+
name: zod_1.z.string().refine(id_1.isIdPiece, { message: `must be an id: characters [${id_1.ID_CHAR_CLASS}] only (spec-009 §1)` }),
|
|
52
|
+
format: zod_1.z.literal(format_1.ADAPTER_MANIFEST_FORMAT),
|
|
53
|
+
command: NonEmpty,
|
|
54
|
+
verified_with: NonEmpty.optional(),
|
|
55
|
+
version_args: Argv.optional(),
|
|
56
|
+
launch: zod_1.z.strictObject({
|
|
57
|
+
interactive: InteractiveLaunch,
|
|
58
|
+
headless: HeadlessLaunch.optional(),
|
|
59
|
+
}),
|
|
60
|
+
prompt: zod_1.z.strictObject({
|
|
61
|
+
via: zod_1.z.enum(['arg', 'stdin', 'file']),
|
|
62
|
+
}),
|
|
63
|
+
mcp: zod_1.z.strictObject({
|
|
64
|
+
// No `none`: an adapter that cannot register the `wingfoil` MCP server is refused (`adr-012`).
|
|
65
|
+
via: zod_1.z.enum(['config-file', 'config-arg', 'args']),
|
|
66
|
+
template: NonEmpty.optional(),
|
|
67
|
+
}),
|
|
68
|
+
session: zod_1.z.strictObject({
|
|
69
|
+
id: zod_1.z.enum(['assign', 'output', 'lookup', 'none']),
|
|
70
|
+
assign_args: Argv.optional(),
|
|
71
|
+
lookup_args: Argv.optional(),
|
|
72
|
+
field: NonEmpty.optional(),
|
|
73
|
+
resume: zod_1.z.strictObject({
|
|
74
|
+
supported: zod_1.z.boolean(),
|
|
75
|
+
args: Argv.optional(),
|
|
76
|
+
}),
|
|
77
|
+
}),
|
|
78
|
+
usage: zod_1.z.strictObject({
|
|
79
|
+
from: zod_1.z.enum(['output', 'lookup', 'none']),
|
|
80
|
+
lookup_args: Argv.optional(),
|
|
81
|
+
fields: UsageFields.optional(),
|
|
82
|
+
}),
|
|
83
|
+
summary: zod_1.z
|
|
84
|
+
.strictObject({
|
|
85
|
+
export_args: Argv.optional(),
|
|
86
|
+
})
|
|
87
|
+
.optional(),
|
|
88
|
+
});
|
|
89
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/agent/schema.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACH,6BAAwB;AAExB,iDAA+D;AAOtD,wGAPA,gCAAuB,OAOA;AANhC,yCAA4D;AAQ5D,2FAA2F;AAC3F,MAAM,IAAI,GAAG,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC;AAEjC,6EAA6E;AAC7E,MAA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+1,41 @@
|
|
|
1
|
+
import type { DnaYaml } from '../dna/schema';
|
|
2
|
+
import type { ExecutionContextElement } from '../core/context';
|
|
3
|
+
import { type CoreResult } from '../core/types';
|
|
4
|
+
import { type NextResult, type Step } from '../core/workflow-next';
|
|
5
|
+
import type { Instance } from '../workflow/deduce';
|
|
6
|
+
/** P5.3.1 sc. 3, verbatim (§3.7 `NO_NEXT_STEP`). */
|
|
7
|
+
export declare const NO_NEXT_STEP_MESSAGE = "no next step to execute";
|
|
8
|
+
/** Which step a run takes (§3.1): absent fields select the active instance and its next step. */
|
|
9
|
+
export interface StepSelector {
|
|
10
|
+
/** `--workflow <ref>`: a workflow name (its most recently started open instance) or an open instance id. */
|
|
11
|
+
readonly workflow?: string;
|
|
12
|
+
/** `--step <key>`: a `spec-017` §4.9 step key on the selected instance's frontier. */
|
|
13
|
+
readonly key?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* `workflow next`'s deduction for `ref` at `HEAD` (`workflowNextAtHead`), its throws mapped as `workflow
|
|
17
|
+
* next` maps them: a `spec-003` error in the registry is `VALIDATION`, its first error the message and every
|
|
18
|
+
* diagnostic in `details.diagnostics`; another invalid committed file (`roles.yaml`, a directive) is
|
|
19
|
+
* `VALIDATION` with its issues. A `ref` naming no workflow, or no open instance, is the `NOT_FOUND` it returns.
|
|
20
|
+
*/
|
|
21
|
+
export declare function readNextAtHead(root: string, ref: string | undefined): CoreResult<NextResult>;
|
|
22
|
+
/**
|
|
23
|
+
* §3.2 step 1: the frontier step `key` names — `NextResult.next` or one of the further ready steps — else,
|
|
24
|
+
* without `key`, `NextResult.next`. No open instance, or an empty frontier without `key`, is `NO_NEXT_STEP`;
|
|
25
|
+
* a `key` that is not on the selected instance's frontier is `spec-017` §10's `CONFLICT`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function selectFrontierStep(next: NextResult, key: string | undefined): CoreResult<Step>;
|
|
28
|
+
/**
|
|
29
|
+
* §3.2 step 2: `--element` if given, else the step's scope element, else the instance's bound element
|
|
30
|
+
* (`spec-017` §3.4). A step with none of the three — a collection-entry or empty scope on an instance with no
|
|
31
|
+
* bound element — is `NO_STEP_ELEMENT`. Whether the element exists at `HEAD` is the pipeline's check.
|
|
32
|
+
*/
|
|
33
|
+
export declare function stepTargetElement(step: Step, instance: Instance | null, override: ExecutionContextElement | undefined): CoreResult<ExecutionContextElement>;
|
|
34
|
+
/**
|
|
35
|
+
* §3.2 step 3 (P5.3.2): `--role` if given — the pipeline checks it as it checks every `--role` — else the
|
|
36
|
+
* step's role. A step with no role is `NO_STEP_ROLE`; a step role `dna.yaml` does not define is refused here as a
|
|
37
|
+
* defence only: the registry refuses such a role at load (`E_PHASE_ROLE_UNKNOWN`, task-194, P5.3.2 sc. 3) against
|
|
38
|
+
* the same `dna.yaml`, so this check holds only for a step deduced from a registry that did not check it.
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveStepRole(dna: DnaYaml, step: Step, override: string | undefined): CoreResult<string>;
|
|
41
|
+
//# sourceMappingURL=step.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/agent/step.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAsB,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAEvF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,oDAAoD;AACpD,eAAO,MAAM,oBAAoB,4BAA4B,CAAC;AAE9D,iGAAiG;AACjG,MAAM,WAAW,YAAY;IAC3B,4GAA4G;IAC5G,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,sFAAsF;IACtF,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC,UAAU,CAAC,CAQ5F;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAQ9F;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,EAAE,QAAQ,EAAE,uBAAuB,GAAG,SAAS,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAK3J;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,CAK1G"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NO_NEXT_STEP_MESSAGE = void 0;
|
|
4
|
+
exports.readNextAtHead = readNextAtHead;
|
|
5
|
+
exports.selectFrontierStep = selectFrontierStep;
|
|
6
|
+
exports.stepTargetElement = stepTargetElement;
|
|
7
|
+
exports.resolveStepRole = resolveStepRole;
|
|
8
|
+
/**
|
|
9
|
+
* `agent execute`'s step forms (task-235; `spec-016-agent-execution` §3.1 `--next`, `--workflow <ref>`,
|
|
10
|
+
* `--step <key>`; §3.2 steps 1–3; §3.7's step rows; approver ruling R16): the step comes from `spec-017`'s
|
|
11
|
+
* `workflow next` deduction (`NextResult`, task-216), and gives the run its workflow, phase, element and
|
|
12
|
+
* role.
|
|
13
|
+
*
|
|
14
|
+
* - {@link readNextAtHead}: the deduction for the instance `--workflow <ref>` selects, else the active
|
|
15
|
+
* instance (`spec-017` §3.3), at `HEAD`; a `spec-003` error in the registry is `VALIDATION` with every
|
|
16
|
+
* diagnostic in `details`, as `workflow next` refuses it (§3.7's second row).
|
|
17
|
+
* - {@link selectFrontierStep}: `--step <key>` on that instance's frontier, else `NextResult.next`.
|
|
18
|
+
* - {@link stepTargetElement}: `--element`, else the step's scope element, else the instance's bound element.
|
|
19
|
+
* - {@link resolveStepRole}: `--role`, else the step's role, which `dna.yaml` must define.
|
|
20
|
+
*
|
|
21
|
+
* All four are pure but the first, which reads `HEAD` only (`dl-080` (B)): the step a run takes is a
|
|
22
|
+
* function of committed state and the request (`REQ-SYS-07`). The phase's separation of executors is not
|
|
23
|
+
* checked (P4.12, v1.0) and every v0.3 run is `fresh` whatever the phase allows (§3.2 step 6, `dl-135`
|
|
24
|
+
* point 3): neither executor attribute of the step is read here.
|
|
25
|
+
*/
|
|
26
|
+
const roles_1 = require("../dna/roles");
|
|
27
|
+
const types_1 = require("../core/types");
|
|
28
|
+
const workflow_next_1 = require("../core/workflow-next");
|
|
29
|
+
const validation_1 = require("../validation");
|
|
30
|
+
/** P5.3.1 sc. 3, verbatim (§3.7 `NO_NEXT_STEP`). */
|
|
31
|
+
exports.NO_NEXT_STEP_MESSAGE = 'no next step to execute';
|
|
32
|
+
/**
|
|
33
|
+
* `workflow next`'s deduction for `ref` at `HEAD` (`workflowNextAtHead`), its throws mapped as `workflow
|
|
34
|
+
* next` maps them: a `spec-003` error in the registry is `VALIDATION`, its first error the message and every
|
|
35
|
+
* diagnostic in `details.diagnostics`; another invalid committed file (`roles.yaml`, a directive) is
|
|
36
|
+
* `VALIDATION` with its issues. A `ref` naming no workflow, or no open instance, is the `NOT_FOUND` it returns.
|
|
37
|
+
*/
|
|
38
|
+
function readNextAtHead(root, ref) {
|
|
39
|
+
try {
|
|
40
|
+
return (0, workflow_next_1.workflowNextAtHead)(root, ref);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
if (error instanceof validation_1.DiagnosticsError)
|
|
44
|
+
return (0, types_1.coreErr)({ code: 'VALIDATION', message: error.message, details: { diagnostics: error.diagnostics } });
|
|
45
|
+
if (error instanceof validation_1.ValidationError)
|
|
46
|
+
return (0, types_1.coreErr)({ code: 'VALIDATION', message: error.message, details: { issues: error.issues } });
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* §3.2 step 1: the frontier step `key` names — `NextResult.next` or one of the further ready steps — else,
|
|
52
|
+
* without `key`, `NextResult.next`. No open instance, or an empty frontier without `key`, is `NO_NEXT_STEP`;
|
|
53
|
+
* a `key` that is not on the selected instance's frontier is `spec-017` §10's `CONFLICT`.
|
|
54
|
+
*/
|
|
55
|
+
function selectFrontierStep(next, key) {
|
|
56
|
+
const noNextStep = (0, types_1.coreErr)({ code: 'NOT_FOUND', message: exports.NO_NEXT_STEP_MESSAGE });
|
|
57
|
+
if (next.instance === null)
|
|
58
|
+
return noNextStep;
|
|
59
|
+
if (key === undefined)
|
|
60
|
+
return next.next === null ? noNextStep : (0, types_1.coreOk)(next.next);
|
|
61
|
+
const found = [...(next.next === null ? [] : [next.next]), ...next.more].find((step) => step.key === key);
|
|
62
|
+
if (found !== undefined)
|
|
63
|
+
return (0, types_1.coreOk)(found);
|
|
64
|
+
const instance = next.instance.id;
|
|
65
|
+
return (0, types_1.coreErr)({ code: 'CONFLICT', message: `step '${key}' is not on the frontier of ${instance}`, details: { step: key, instance } });
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* §3.2 step 2: `--element` if given, else the step's scope element, else the instance's bound element
|
|
69
|
+
* (`spec-017` §3.4). A step with none of the three — a collection-entry or empty scope on an instance with no
|
|
70
|
+
* bound element — is `NO_STEP_ELEMENT`. Whether the element exists at `HEAD` is the pipeline's check.
|
|
71
|
+
*/
|
|
72
|
+
function stepTargetElement(step, instance, override) {
|
|
73
|
+
if (override !== undefined)
|
|
74
|
+
return (0, types_1.coreOk)(override);
|
|
75
|
+
const scope = step.scope !== null && 'element' in step.scope ? step.scope.element : (instance?.element ?? null);
|
|
76
|
+
if (scope !== null)
|
|
77
|
+
return (0, types_1.coreOk)({ type: scope.type, id: scope.id });
|
|
78
|
+
return (0, types_1.coreErr)({ code: 'VALIDATION', message: `step '${step.key}' has no element: give --element <type>:<id>` });
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* §3.2 step 3 (P5.3.2): `--role` if given — the pipeline checks it as it checks every `--role` — else the
|
|
82
|
+
* step's role. A step with no role is `NO_STEP_ROLE`; a step role `dna.yaml` does not define is refused here as a
|
|
83
|
+
* defence only: the registry refuses such a role at load (`E_PHASE_ROLE_UNKNOWN`, task-194, P5.3.2 sc. 3) against
|
|
84
|
+
* the same `dna.yaml`, so this check holds only for a step deduced from a registry that did not check it.
|
|
85
|
+
*/
|
|
86
|
+
function resolveStepRole(dna, step, override) {
|
|
87
|
+
if (override !== undefined)
|
|
88
|
+
return (0, types_1.coreOk)(override);
|
|
89
|
+
if (step.role === null)
|
|
90
|
+
return (0, types_1.coreErr)({ code: 'VALIDATION', message: `step '${step.key}' declares no role: give --role <role>` });
|
|
91
|
+
if (!(0, roles_1.isRoleDefined)(dna, step.role))
|
|
92
|
+
return (0, types_1.coreErr)({ code: 'VALIDATION', message: `step role '${step.role}' not defined in dna.yaml` });
|
|
93
|
+
return (0, types_1.coreOk)(step.role);
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step.js","sourceRoot":"","sources":["../../src/agent/step.ts"],"names":[],"mappings":";;;AA2CA,wCAQC;AAOD,gDAQC;AAOD,8CAKC;AAQD,0CAKC;AA3FD;;;;;;;;;;;;;;;;;GAiBG;AACH,wCAA6C;AAG7C,yCAAiE;AACjE,yDAAuF;AACvF,8CAAkE;AAGlE,oDAAoD;AACvC,QAAA,oBAAoB,GAAG,yB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,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,IAAA,eAAO,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,IAAI,CAAC,GAAG,wCAAwC,EAAE,CAAC,CAAC;IACnI,IAAI,CAAC,IAAA,qBAAa,EAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAA,eAAO,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,IAAI,CAAC,IAAI,2BAA2B,EAAE,CAAC,CAAC;IACxI,OAAO,IAAA,cAAM,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC"}
|
package/dist/cli/error.d.ts
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
import type { ErrorDetail } from '../core/error-details';
|
|
1
2
|
import type { OutputFormat } from './output';
|
|
2
3
|
/**
|
|
3
4
|
* Write an error to stderr in the consistent spec-005 §3 format for the active `--format`: a
|
|
4
|
-
* `{error, hint?}` object for `json`/`yaml`, or `error: <reason>` (+ optional `hint:` line
|
|
5
|
-
* `console`. Writes only; the caller terminates via
|
|
5
|
+
* `{error, hint?, details?}` object for `json`/`yaml`, or `error: <reason>` (+ optional `hint:` line,
|
|
6
|
+
* + one indented line per detail) for `console`. Writes only; the caller terminates via
|
|
7
|
+
* {@link exitWith}.
|
|
8
|
+
*
|
|
9
|
+
* `details` (task-130, `dl-055` option 1) is additive in every format: the `error:` line stays the
|
|
10
|
+
* first line and byte-identical, and the structured `details` key is omitted when the list is empty,
|
|
11
|
+
* so a consumer that reads only `error` is unaffected. A detail line is indented, and so is every
|
|
12
|
+
* continuation line of a multi-line detail, so no line of it can begin with the greppable `error: `
|
|
13
|
+
* or `hint: ` token.
|
|
6
14
|
*/
|
|
7
15
|
export declare function emitError(reason: string, opts: {
|
|
8
16
|
format: OutputFormat;
|
|
9
17
|
hint?: string;
|
|
18
|
+
details?: readonly ErrorDetail[];
|
|
10
19
|
}): void;
|
|
11
20
|
//# sourceMappingURL=error.d.ts.map
|
package/dist/cli/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/cli/error.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/cli/error.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,SAAS,WAAW,EAAE,CAAA;CAAE,GAC9E,IAAI,CAgBN"}
|
package/dist/cli/error.js
CHANGED
|
@@ -2,26 +2,47 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.emitError = emitError;
|
|
4
4
|
/**
|
|
5
|
-
* The consistent error format (spec-005-cli-command-contract §3, REQ-INT-08). Written
|
|
6
|
-
*
|
|
5
|
+
* The consistent error format (spec-005-cli-command-contract §3, REQ-INT-08). Written from the
|
|
6
|
+
* spec's own code listing so `src/cli` and the spec cannot drift.
|
|
7
7
|
*/
|
|
8
8
|
const js_yaml_1 = require("js-yaml");
|
|
9
9
|
/**
|
|
10
10
|
* Write an error to stderr in the consistent spec-005 §3 format for the active `--format`: a
|
|
11
|
-
* `{error, hint?}` object for `json`/`yaml`, or `error: <reason>` (+ optional `hint:` line
|
|
12
|
-
* `console`. Writes only; the caller terminates via
|
|
11
|
+
* `{error, hint?, details?}` object for `json`/`yaml`, or `error: <reason>` (+ optional `hint:` line,
|
|
12
|
+
* + one indented line per detail) for `console`. Writes only; the caller terminates via
|
|
13
|
+
* {@link exitWith}.
|
|
14
|
+
*
|
|
15
|
+
* `details` (task-130, `dl-055` option 1) is additive in every format: the `error:` line stays the
|
|
16
|
+
* first line and byte-identical, and the structured `details` key is omitted when the list is empty,
|
|
17
|
+
* so a consumer that reads only `error` is unaffected. A detail line is indented, and so is every
|
|
18
|
+
* continuation line of a multi-line detail, so no line of it can begin with the greppable `error: `
|
|
19
|
+
* or `hint: ` token.
|
|
13
20
|
*/
|
|
14
21
|
function emitError(reason, opts) {
|
|
22
|
+
const details = opts.details ?? [];
|
|
23
|
+
const payload = {
|
|
24
|
+
error: reason,
|
|
25
|
+
...(opts.hint ? { hint: opts.hint } : {}),
|
|
26
|
+
...(details.length > 0 ? { details } : {}),
|
|
27
|
+
};
|
|
15
28
|
if (opts.format === 'json') {
|
|
16
|
-
process.stderr.write(JSON.stringify(
|
|
29
|
+
process.stderr.write(JSON.stringify(payload) + '\n');
|
|
17
30
|
}
|
|
18
31
|
else if (opts.format === 'yaml') {
|
|
19
|
-
process.stderr.write((0, js_yaml_1.dump)(
|
|
32
|
+
process.stderr.write((0, js_yaml_1.dump)(payload));
|
|
20
33
|
}
|
|
21
34
|
else {
|
|
22
35
|
process.stderr.write(`error: ${reason}\n`);
|
|
23
36
|
if (opts.hint)
|
|
24
37
|
process.stderr.write(`hint: ${opts.hint}\n`);
|
|
38
|
+
for (const detail of details)
|
|
39
|
+
process.stderr.write(` ${detailLine(detail).replace(/\n/g, '\n ')}\n`);
|
|
25
40
|
}
|
|
26
41
|
}
|
|
42
|
+
/** One console detail line: `<file>: <detail>`, or whichever of the two the entry has. */
|
|
43
|
+
function detailLine(detail) {
|
|
44
|
+
if (detail.file !== undefined && detail.detail !== undefined)
|
|
45
|
+
return `${detail.file}: ${detail.detail}`;
|
|
46
|
+
return detail.file ?? detail.detail ?? '';
|
|
47
|
+
}
|
|
27
48
|
//# sourceMappingURL=error.js.map
|
package/dist/cli/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/cli/error.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/cli/error.ts"],"names":[],"mappings":";;AAsBA,8BAmBC;AAzCD;;;GAGG;AACH,qCAA2C;AAM3C;;;;;;;;;;;GAWG;AACH,SAAgB,SAAS,CACvB,MAAc,EACd,IAA+E;IAE/E,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;IACnC,MAAM,OAAO,GAAG;QACd,KAAK,EAAE,MAAM;QACb,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3C,CAAC;IACF,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;IACvD,CAAC;SAAM,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAA,cAAQ,EAAC,OAAO,CAAC,CAAC,CAAC;IAC1C,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,MAAM,IAAI,CAAC,CAAC;QAC3C,IAAI,IAAI,CAAC,IAAI;YAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;QAC5D,KAAK,MAAM,MAAM,IAAI,OAAO;YAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,UAAU,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3G,CAAC;AACH,CAAC;AAED,0FAA0F;AAC1F,SAAS,UAAU,CAAC,MAAmB;IACrC,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,GAAG,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;IACxG,OAAO,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;AAC5C,CAAC"}
|
package/dist/cli/exit.d.ts
CHANGED
|
@@ -7,13 +7,43 @@
|
|
|
7
7
|
* which outcome maps to which code — lives in `src/core` (`exitCodeForError`/`exitCodeForResult`),
|
|
8
8
|
* shared with the MCP surface per REQ-SYS-05 (task-012); `ExitCode` is re-exported from there so the
|
|
9
9
|
* CLI never redeclares the contract's shape.
|
|
10
|
+
*
|
|
11
|
+
* The mechanism lets the output drain first (task-249, `bug-222`). A write to a pipe is asynchronous
|
|
12
|
+
* in Node: the kernel takes what fits in the pipe buffer (64 KiB on Linux) and the rest stays queued
|
|
13
|
+
* in the stream. `process.exit` drops whatever is queued, so a payload larger than the buffer reached
|
|
14
|
+
* a `| jq` cut short while the process still exited `0`. A file or a TTY is written synchronously and
|
|
15
|
+
* never has anything queued, which is why the same command redirected to a file was complete.
|
|
10
16
|
*/
|
|
11
17
|
import type { ExitCode } from '../core';
|
|
12
18
|
export type { ExitCode };
|
|
19
|
+
/**
|
|
20
|
+
* Thrown by a caller that cannot simply return after {@link exitWith} deferred the exit — today only
|
|
21
|
+
* the Commander `exitOverride` in `./program.ts`, because Commander calls `process.exit` itself, with
|
|
22
|
+
* its own code, as soon as that callback returns. The entry points (`src/cli.ts`, the test harness)
|
|
23
|
+
* recognise it by its `name` (a copy of this module loaded elsewhere throws the same name) and let the
|
|
24
|
+
* deferred exit happen instead of reporting an error.
|
|
25
|
+
*/
|
|
26
|
+
export declare class DeferredExit extends Error {
|
|
27
|
+
readonly code: ExitCode;
|
|
28
|
+
constructor(code: ExitCode);
|
|
29
|
+
}
|
|
13
30
|
/**
|
|
14
31
|
* The single process-exit mechanism for the CLI (spec-005 §1, REQ-INT-04): optionally write
|
|
15
|
-
* `message` to stderr, then
|
|
16
|
-
*
|
|
32
|
+
* `message` to stderr, then end the process with `code` through the one `process.exit` call.
|
|
33
|
+
*
|
|
34
|
+
* When stdout and stderr have nothing queued — a file, a TTY, or a pipe that took everything — the
|
|
35
|
+
* process ends here and now. When either still holds output for a pipe (task-249, `bug-222`), the exit
|
|
36
|
+
* is deferred until each has written it: `process.exitCode` is set to `code` at once, and
|
|
37
|
+
* `process.exit(code)` runs when the last queued write completes — or fails, as when the reader has
|
|
38
|
+
* gone away (`EPIPE`), which ends the process with the same `code` rather than an unhandled stream
|
|
39
|
+
* error. Either way the code is the one passed here, and the exit is the single `process.exit` call.
|
|
40
|
+
*
|
|
41
|
+
* Every caller returns right after this call, so which of the two happened does not matter to it; the
|
|
42
|
+
* one caller that cannot return normally reads the result.
|
|
43
|
+
*
|
|
44
|
+
* @returns `true` when the exit is deferred until the output drains — the process is still running
|
|
45
|
+
* only to finish writing, and the caller must do nothing else. (When the exit happened, nothing returns
|
|
46
|
+
* at all outside a test that stubs `process.exit`.)
|
|
17
47
|
*/
|
|
18
|
-
export declare function exitWith(code: ExitCode, message?: string):
|
|
48
|
+
export declare function exitWith(code: ExitCode, message?: string): boolean;
|
|
19
49
|
//# sourceMappingURL=exit.d.ts.map
|
package/dist/cli/exit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit.d.ts","sourceRoot":"","sources":["../../src/cli/exit.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"exit.d.ts","sourceRoot":"","sources":["../../src/cli/exit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,YAAY,EAAE,QAAQ,EAAE,CAAC;AAEzB;;;;;;GAMG;AACH,qBAAa,YAAa,SAAQ,KAAK;IACzB,QAAQ,CAAC,IAAI,EAAE,QAAQ;gBAAd,IAAI,EAAE,QAAQ;CAIpC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAsBlE"}
|
package/dist/cli/exit.js
CHANGED
|
@@ -1,14 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeferredExit = void 0;
|
|
3
4
|
exports.exitWith = exitWith;
|
|
5
|
+
/**
|
|
6
|
+
* Thrown by a caller that cannot simply return after {@link exitWith} deferred the exit — today only
|
|
7
|
+
* the Commander `exitOverride` in `./program.ts`, because Commander calls `process.exit` itself, with
|
|
8
|
+
* its own code, as soon as that callback returns. The entry points (`src/cli.ts`, the test harness)
|
|
9
|
+
* recognise it by its `name` (a copy of this module loaded elsewhere throws the same name) and let the
|
|
10
|
+
* deferred exit happen instead of reporting an error.
|
|
11
|
+
*/
|
|
12
|
+
class DeferredExit extends Error {
|
|
13
|
+
code;
|
|
14
|
+
constructor(code) {
|
|
15
|
+
super(`exit ${String(code)} deferred until the output drains`);
|
|
16
|
+
this.code = code;
|
|
17
|
+
this.name = 'DeferredExit';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.DeferredExit = DeferredExit;
|
|
4
21
|
/**
|
|
5
22
|
* The single process-exit mechanism for the CLI (spec-005 §1, REQ-INT-04): optionally write
|
|
6
|
-
* `message` to stderr, then
|
|
7
|
-
*
|
|
23
|
+
* `message` to stderr, then end the process with `code` through the one `process.exit` call.
|
|
24
|
+
*
|
|
25
|
+
* When stdout and stderr have nothing queued — a file, a TTY, or a pipe that took everything — the
|
|
26
|
+
* process ends here and now. When either still holds output for a pipe (task-249, `bug-222`), the exit
|
|
27
|
+
* is deferred until each has written it: `process.exitCode` is set to `code` at once, and
|
|
28
|
+
* `process.exit(code)` runs when the last queued write completes — or fails, as when the reader has
|
|
29
|
+
* gone away (`EPIPE`), which ends the process with the same `code` rather than an unhandled stream
|
|
30
|
+
* error. Either way the code is the one passed here, and the exit is the single `process.exit` call.
|
|
31
|
+
*
|
|
32
|
+
* Every caller returns right after this call, so which of the two happened does not matter to it; the
|
|
33
|
+
* one caller that cannot return normally reads the result.
|
|
34
|
+
*
|
|
35
|
+
* @returns `true` when the exit is deferred until the output drains — the process is still running
|
|
36
|
+
* only to finish writing, and the caller must do nothing else. (When the exit happened, nothing returns
|
|
37
|
+
* at all outside a test that stubs `process.exit`.)
|
|
8
38
|
*/
|
|
9
39
|
function exitWith(code, message) {
|
|
10
40
|
if (message)
|
|
11
41
|
process.stderr.write(message + '\n');
|
|
12
|
-
process.
|
|
42
|
+
const queued = [process.stdout, process.stderr].filter((stream) => stream.writableLength > 0);
|
|
43
|
+
if (queued.length === 0) {
|
|
44
|
+
process.exit(code);
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
process.exitCode = code;
|
|
48
|
+
let waiting = queued.length;
|
|
49
|
+
for (const stream of queued) {
|
|
50
|
+
let settled = false;
|
|
51
|
+
const settle = () => {
|
|
52
|
+
if (settled)
|
|
53
|
+
return;
|
|
54
|
+
settled = true;
|
|
55
|
+
waiting -= 1;
|
|
56
|
+
if (waiting === 0)
|
|
57
|
+
process.exit(code);
|
|
58
|
+
};
|
|
59
|
+
// An empty write completes after every write queued before it; an `error` (EPIPE) ends the wait too.
|
|
60
|
+
stream.once('error', settle);
|
|
61
|
+
stream.write('', settle);
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
13
64
|
}
|
|
14
65
|
//# sourceMappingURL=exit.js.map
|
package/dist/cli/exit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit.js","sourceRoot":"","sources":["../../src/cli/exit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exit.js","sourceRoot":"","sources":["../../src/cli/exit.ts"],"names":[],"mappings":";;;AAoDA,4BAsBC;AAtDD;;;;;;GAMG;AACH,MAAa,YAAa,SAAQ,KAAK;IAChB;IAArB,YAAqB,IAAc;QACjC,KAAK,CAAC,QAAQ,MAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QAD5C,SAAI,GAAJ,IAAI,CAAU;QAEjC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AALD,oCAKC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,QAAQ,CAAC,IAAc,EAAE,OAAgB;IACvD,IAAI,OAAO;QAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;IAC9F,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IACxB,IAAI,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5B,KAAK,MAAM,MAAM,IAAI,MAAM,EAAE,CAAC;QAC5B,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,MAAM,GAAG,GAAS,EAAE;YACxB,IAAI,OAAO;gBAAE,OAAO;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,OAAO,IAAI,CAAC,CAAC;YACb,IAAI,OAAO,KAAK,CAAC;gBAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,CAAC,CAAC;QACF,qGAAqG;QACrG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC7B,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `cli` module — human interface (Commander.js
|
|
2
|
+
* `cli` module — human interface (Commander.js); the `wingfoil` command surface.
|
|
3
3
|
*
|
|
4
4
|
* task-006-dual-interface-shared-core adds the thin adapter (spec-006 §2): `buildCliCommands`
|
|
5
5
|
* (`./registrar.ts`) derives one `wingfoil <noun> <verb>` command descriptor per operation from a
|
|
@@ -16,7 +16,7 @@ export declare const MODULE_NAME: "cli";
|
|
|
16
16
|
export { buildCliCommands, listRegisteredCliCommands } from './registrar';
|
|
17
17
|
export type { BuildCommandsOptions, CliCommand } from './registrar';
|
|
18
18
|
export { buildProgram } from './program';
|
|
19
|
-
export { exitWith } from './exit';
|
|
19
|
+
export { DeferredExit, exitWith } from './exit';
|
|
20
20
|
export type { ExitCode } from './exit';
|
|
21
21
|
export { isValidFormat, renderSuccess } from './output';
|
|
22
22
|
export type { OutputFormat } from './output';
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,EAAG,KAAc,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAC1E,YAAY,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,EAAG,KAAc,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAC1E,YAAY,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAChD,YAAY,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runMcp = exports.createReadlinePrompt = exports.runInit = exports.emitError = exports.renderSuccess = exports.isValidFormat = exports.exitWith = exports.buildProgram = exports.listRegisteredCliCommands = exports.buildCliCommands = exports.MODULE_NAME = void 0;
|
|
3
|
+
exports.runMcp = exports.createReadlinePrompt = exports.runInit = exports.emitError = exports.renderSuccess = exports.isValidFormat = exports.exitWith = exports.DeferredExit = exports.buildProgram = exports.listRegisteredCliCommands = exports.buildCliCommands = exports.MODULE_NAME = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* `cli` module — human interface (Commander.js
|
|
5
|
+
* `cli` module — human interface (Commander.js); the `wingfoil` command surface.
|
|
6
6
|
*
|
|
7
7
|
* task-006-dual-interface-shared-core adds the thin adapter (spec-006 §2): `buildCliCommands`
|
|
8
8
|
* (`./registrar.ts`) derives one `wingfoil <noun> <verb>` command descriptor per operation from a
|
|
@@ -22,6 +22,7 @@ Object.defineProperty(exports, "listRegisteredCliCommands", { enumerable: true,
|
|
|
22
22
|
var program_1 = require("./program");
|
|
23
23
|
Object.defineProperty(exports, "buildProgram", { enumerable: true, get: function () { return program_1.buildProgram; } });
|
|
24
24
|
var exit_1 = require("./exit");
|
|
25
|
+
Object.defineProperty(exports, "DeferredExit", { enumerable: true, get: function () { return exit_1.DeferredExit; } });
|
|
25
26
|
Object.defineProperty(exports, "exitWith", { enumerable: true, get: function () { return exit_1.exitWith; } });
|
|
26
27
|
var output_1 = require("./output");
|
|
27
28
|
Object.defineProperty(exports, "isValidFormat", { enumerable: true, get: function () { return output_1.isValidFormat; } });
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACU,QAAA,WAAW,GAAG,KAAc,CAAC;AAE1C,yCAA0E;AAAjE,6GAAA,gBAAgB,OAAA;AAAE,sHAAA,yBAAyB,OAAA;AAEpD,qCAAyC;AAAhC,uGAAA,YAAY,OAAA;AACrB,+
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACU,QAAA,WAAW,GAAG,KAAc,CAAC;AAE1C,yCAA0E;AAAjE,6GAAA,gBAAgB,OAAA;AAAE,sHAAA,yBAAyB,OAAA;AAEpD,qCAAyC;AAAhC,uGAAA,YAAY,OAAA;AACrB,+BAAgD;AAAvC,oGAAA,YAAY,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAE/B,mCAAwD;AAA/C,uGAAA,aAAa,OAAA;AAAE,uGAAA,aAAa,OAAA;AAErC,iCAAoC;AAA3B,kGAAA,SAAS,OAAA;AAClB,+CAA+D;AAAtD,uGAAA,OAAO,OAAA;AAAE,oHAAA,oBAAoB,OAAA;AAEtC,6CAAuC;AAA9B,qGAAA,MAAM,OAAA"}
|