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,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.agentListFn = exports.NO_RUN_LOG_WARNING = void 0;
|
|
4
|
+
exports.diagnosticWarning = diagnosticWarning;
|
|
5
|
+
exports.agentListAtHead = agentListAtHead;
|
|
6
|
+
exports.renderAgentListConsole = renderAgentListConsole;
|
|
7
|
+
/**
|
|
8
|
+
* `wingfoil agent list [--past] [--waiting] [--element <type>:<id>] [--phase <name>]` (task-240,
|
|
9
|
+
* `spec-016` §5; P5.3.4): the recorded agent runs, and the workflow steps waiting for an agent.
|
|
10
|
+
*
|
|
11
|
+
* **Two sources, one baseline** (`dl-135` point 1; `spec-016` §5.1, approver ruling R15; `spec-006` §6
|
|
12
|
+
* item 6):
|
|
13
|
+
* - **past** = the run log (task-206's `src/agent/run-log.ts`, read strictly, §4.5) at `HEAD`;
|
|
14
|
+
* - **waiting** = every frontier step of every open instance whose role an agent executes (`Step.agentRole`,
|
|
15
|
+
* `spec-017` §6.3), in `spec-017` §1.3's frontier order — the steps `workflow status` reports
|
|
16
|
+
* (`StatusResult.open[].frontier`), built by the same `readNextInputs` + `buildStep` (task-225).
|
|
17
|
+
*
|
|
18
|
+
* When the waiting section is selected, the deduction snapshot is read first and its commit is the one the
|
|
19
|
+
* run logs are read at too, so both sections answer from the one `HEAD` the payload's `baseline` names.
|
|
20
|
+
* The working tree only explains: a run log that differs from `HEAD` is a `W_UNCOMMITTED_INPUTS` diagnostic
|
|
21
|
+
* (`spec-017` §1.2), one per dirty path — the deduction's own when it runs, this module's (through the same
|
|
22
|
+
* builder) when `--past` alone runs none.
|
|
23
|
+
*
|
|
24
|
+
* v0.3 limit (§5): with no active registry, a step an agent is running on right now is still listed as
|
|
25
|
+
* waiting; `--active` is v0.4 and refused as an unknown option.
|
|
26
|
+
*/
|
|
27
|
+
const run_log_1 = require("../agent/run-log");
|
|
28
|
+
const validation_1 = require("../validation");
|
|
29
|
+
const deduce_1 = require("../workflow/deduce");
|
|
30
|
+
const element_ref_1 = require("./element-ref");
|
|
31
|
+
const init_1 = require("./init");
|
|
32
|
+
const loaders_1 = require("./loaders");
|
|
33
|
+
const revision_1 = require("./revision");
|
|
34
|
+
const types_1 = require("./types");
|
|
35
|
+
const usage_error_1 = require("./usage-error");
|
|
36
|
+
const workflow_deduction_1 = require("./workflow-deduction");
|
|
37
|
+
const workflow_next_1 = require("./workflow-next");
|
|
38
|
+
/** The warning of a project whose `dna.yaml` declares no run log (§5: not an error for `list`). */
|
|
39
|
+
exports.NO_RUN_LOG_WARNING = 'dna.yaml declares no run log (paths.runs)';
|
|
40
|
+
/** A single option value: the last occurrence, as Commander gives a non-repeatable option. */
|
|
41
|
+
function single(value) {
|
|
42
|
+
return typeof value === 'string' ? value : value?.[value.length - 1];
|
|
43
|
+
}
|
|
44
|
+
/** A diagnostic as the console's `warning:` line: `<code> (<file>): <message>` (`spec-008` §6's form). */
|
|
45
|
+
function diagnosticWarning(diagnostic) {
|
|
46
|
+
return diagnostic.file === undefined || diagnostic.file === '' ? `${diagnostic.code}: ${diagnostic.message}` : `${diagnostic.code} (${diagnostic.file}): ${diagnostic.message}`;
|
|
47
|
+
}
|
|
48
|
+
/** The agents of `dna.yaml`, in declared order, that execute `role` and declare an adapter (§5). */
|
|
49
|
+
function agentsFor(dnaYaml, role) {
|
|
50
|
+
return (dnaYaml?.team?.agents ?? []).filter((agent) => agent.adapter !== undefined && agent.executes_as.includes(role)).map((agent) => agent.name);
|
|
51
|
+
}
|
|
52
|
+
/** The run log directory `dna.yaml` declares, or `undefined` for none (absent, empty, or blank). */
|
|
53
|
+
function runLogDir(dnaYaml) {
|
|
54
|
+
const dir = dnaYaml?.paths?.['runs']?.[0];
|
|
55
|
+
return dir === undefined || dir.trim() === '' ? undefined : dir;
|
|
56
|
+
}
|
|
57
|
+
/** The waiting section from one deduction (§5): agent-role frontier steps, filtered, in frontier order. */
|
|
58
|
+
function waitingSteps(root, snapshot, deduction, selection) {
|
|
59
|
+
const inputs = (0, workflow_next_1.readNextInputs)(root, snapshot, deduction);
|
|
60
|
+
const steps = [];
|
|
61
|
+
for (const entry of deduction.instances) {
|
|
62
|
+
for (const deduced of entry.frontier) {
|
|
63
|
+
const step = (0, workflow_next_1.buildStep)(deduced, inputs);
|
|
64
|
+
if (!step.agentRole)
|
|
65
|
+
continue;
|
|
66
|
+
// `spec-016` §3.2 step 2 (task-235's `stepTargetElement`): the scope element, else the bound element.
|
|
67
|
+
const target = step.scope !== null && 'element' in step.scope ? step.scope.element : entry.instance.element;
|
|
68
|
+
const element = target === null ? null : `${target.type}:${target.id}`;
|
|
69
|
+
if (selection.element !== undefined && element !== selection.element)
|
|
70
|
+
continue;
|
|
71
|
+
if (selection.phase !== undefined && step.phase !== selection.phase)
|
|
72
|
+
continue;
|
|
73
|
+
const role = step.role; // an agent role is a role: `agentRole` is false for a step with none
|
|
74
|
+
steps.push({ instance: step.instance, key: step.key, workflow: step.workflow, phase: step.phase, element, role, allowedModes: step.allowedModes, agents: agentsFor(inputs.dnaYaml, role) });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return steps;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* `agent list` at `HEAD` (`spec-016` §5, §5.1).
|
|
81
|
+
*
|
|
82
|
+
* @returns the payload and its success warnings (each diagnostic, and the missing-run-log warning); a §4.5
|
|
83
|
+
* violation of a committed run log is `VALIDATION` (exit `1`); `dna.yaml` not committed when the past
|
|
84
|
+
* section is selected is `NOT_FOUND`, as `agent show`.
|
|
85
|
+
* @throws `DiagnosticsError` / `ValidationError` from the deduction (mapped by {@link agentListFn}).
|
|
86
|
+
*/
|
|
87
|
+
function agentListAtHead(root, selection) {
|
|
88
|
+
let commit;
|
|
89
|
+
let dnaYaml;
|
|
90
|
+
let waiting;
|
|
91
|
+
const diagnostics = [];
|
|
92
|
+
if (selection.waiting) {
|
|
93
|
+
const snapshot = (0, workflow_deduction_1.readDeductionSnapshotAtHead)(root);
|
|
94
|
+
if (snapshot.commit === '')
|
|
95
|
+
(0, revision_1.resolveRevision)(root, 'HEAD'); // no commit: the RevisionError agent show gives
|
|
96
|
+
const deduction = (0, deduce_1.deduceWorkflowState)(snapshot);
|
|
97
|
+
commit = snapshot.commit;
|
|
98
|
+
dnaYaml = snapshot.dnaYaml ?? null;
|
|
99
|
+
waiting = waitingSteps(root, snapshot, deduction, selection);
|
|
100
|
+
diagnostics.push(...deduction.diagnostics);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
commit = (0, revision_1.resolveRevision)(root, 'HEAD');
|
|
104
|
+
dnaYaml = (0, loaders_1.loadDnaYamlAtRev)(root, commit);
|
|
105
|
+
}
|
|
106
|
+
let past;
|
|
107
|
+
const warnings = [];
|
|
108
|
+
if (selection.past) {
|
|
109
|
+
if (dnaYaml === null) {
|
|
110
|
+
return (0, types_1.coreErr)({ code: 'NOT_FOUND', message: `${loaders_1.DNA_YAML_PATH} is not committed at HEAD, which agent list reads: commit it first` });
|
|
111
|
+
}
|
|
112
|
+
const dir = runLogDir(dnaYaml);
|
|
113
|
+
if (dir === undefined) {
|
|
114
|
+
past = [];
|
|
115
|
+
warnings.push(exports.NO_RUN_LOG_WARNING);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
const records = (0, run_log_1.readRunLogsAt)(root, commit, dir);
|
|
119
|
+
if (!records.ok)
|
|
120
|
+
return records;
|
|
121
|
+
past = records.value.filter((record) => (selection.element === undefined || record.element === selection.element) && (selection.phase === undefined || record.phase === selection.phase));
|
|
122
|
+
// §5: with no deduction, `agent list` emits the deduction's code itself, once per dirty path.
|
|
123
|
+
if (!selection.waiting)
|
|
124
|
+
diagnostics.push(...(0, workflow_deduction_1.readDirtyRunLogs)(root, dir).map(deduce_1.uncommittedInputDiagnostic));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return (0, types_1.coreOk)({
|
|
128
|
+
baseline: { rev: 'HEAD', commit },
|
|
129
|
+
...(past === undefined ? {} : { past }),
|
|
130
|
+
...(waiting === undefined ? {} : { waiting }),
|
|
131
|
+
diagnostics,
|
|
132
|
+
}, undefined, [...warnings, ...diagnostics.map(diagnosticWarning)]);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* `agent list` `CoreOperation.fn` (`mutates: false`; `spec-006` §3, `spec-016` §8).
|
|
136
|
+
*
|
|
137
|
+
* 1. The selection: `--past`, `--waiting`; neither or both select both sections. A malformed `--element`
|
|
138
|
+
* (`spec-008` §7) is a usage error (exit `2`), refused before the project is read.
|
|
139
|
+
* 2. {@link agentListAtHead}; a `spec-003` error in the registry at `HEAD` is `VALIDATION` with every
|
|
140
|
+
* diagnostic in `details`, an invalid committed file `VALIDATION` with its issues, as `workflow status`.
|
|
141
|
+
*/
|
|
142
|
+
const agentListFn = async (params) => {
|
|
143
|
+
const { root, past, waiting, options } = params;
|
|
144
|
+
const elementOption = single(options?.element);
|
|
145
|
+
const phase = single(options?.phase);
|
|
146
|
+
if (elementOption !== undefined) {
|
|
147
|
+
const parsed = (0, element_ref_1.parseElementRef)(elementOption);
|
|
148
|
+
if (!parsed.ok)
|
|
149
|
+
throw new usage_error_1.UsageError(parsed.error.message);
|
|
150
|
+
}
|
|
151
|
+
const both = past !== true && waiting !== true;
|
|
152
|
+
const selection = {
|
|
153
|
+
past: both || past === true,
|
|
154
|
+
waiting: both || waiting === true,
|
|
155
|
+
...(elementOption === undefined ? {} : { element: elementOption }),
|
|
156
|
+
...(phase === undefined ? {} : { phase }),
|
|
157
|
+
};
|
|
158
|
+
const initialized = (0, init_1.requireInitializedProject)(root);
|
|
159
|
+
if (!initialized.ok)
|
|
160
|
+
return initialized;
|
|
161
|
+
try {
|
|
162
|
+
return agentListAtHead(root, selection);
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
if (error instanceof revision_1.RevisionError)
|
|
166
|
+
return (0, types_1.coreErr)(error.toCoreError());
|
|
167
|
+
if (error instanceof validation_1.DiagnosticsError)
|
|
168
|
+
return (0, types_1.coreErr)({ code: 'VALIDATION', message: error.message, details: { diagnostics: error.diagnostics } });
|
|
169
|
+
if (error instanceof validation_1.ValidationError)
|
|
170
|
+
return (0, types_1.coreErr)({ code: 'VALIDATION', message: error.message, details: { issues: error.issues } });
|
|
171
|
+
throw error;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
exports.agentListFn = agentListFn;
|
|
175
|
+
// --- console --------------------------------------------------------------------------------------
|
|
176
|
+
/** `<duration>`: seconds with one decimal, as `agent execute`'s run summary prints it (`0.5s`). */
|
|
177
|
+
function duration(ms) {
|
|
178
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
179
|
+
}
|
|
180
|
+
/** `<tokens>`: `in/out`, or `not-reported` when the agent reported neither (§5). */
|
|
181
|
+
function tokens(record) {
|
|
182
|
+
const { input, output } = record.tokens;
|
|
183
|
+
return input === 'not-reported' && output === 'not-reported' ? 'not-reported' : `${input}/${output}`;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* `agent list`'s `--format console` (`spec-016` §5): one section per selected source, past first — a
|
|
187
|
+
* heading with the count, then one line per item, or `no past runs` / `no waiting steps` for an empty one.
|
|
188
|
+
* Diagnostics are not here: they print on stderr as `warning:` lines (the success warnings).
|
|
189
|
+
*/
|
|
190
|
+
function renderAgentListConsole(value) {
|
|
191
|
+
const { past, waiting } = value;
|
|
192
|
+
const lines = [];
|
|
193
|
+
if (past !== undefined) {
|
|
194
|
+
if (past.length === 0)
|
|
195
|
+
lines.push('no past runs');
|
|
196
|
+
else
|
|
197
|
+
lines.push(`past runs: ${past.length}`, ...past.map((record) => [record.id, record.role, record.agent, String(record.exit_status), duration(record.duration_ms), tokens(record)].join(' ')));
|
|
198
|
+
}
|
|
199
|
+
if (waiting !== undefined) {
|
|
200
|
+
if (waiting.length === 0)
|
|
201
|
+
lines.push('no waiting steps');
|
|
202
|
+
else
|
|
203
|
+
lines.push(`waiting steps: ${waiting.length}`, ...waiting.map((step) => [step.key, step.role, step.agents.length === 0 ? 'none' : step.agents.join(', ')].join(' ')));
|
|
204
|
+
}
|
|
205
|
+
return `${lines.join('\n')}\n`;
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=agent-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-list.js","sourceRoot":"","sources":["../../src/core/agent-list.ts"],"names":[],"mappings":";;;AA+EA,8CAEC;AAiDD,0CAkDC;AAyDD,wDAYC;AAzPD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8CAAiE;AAEjE,8CAAmF;AACnF,+CAAoG;AAEpG,+CAAgD;AAChD,iCAAmD;AACnD,uCAA4D;AAE5D,yCAA4D;AAC5D,mCAA2D;AAC3D,+CAA2C;AAC3C,6DAAqF;AACrF,mDAA4D;AAE5D,mGAAmG;AACtF,QAAA,kBAAkB,GAAG,2CAA2C,CAAC;AAqC9E,8FAA8F;AAC9F,SAAS,MAAM,CAAC,KAA6C;IAC3D,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACvE,CAAC;AAED,0GAA0G;AAC1G,SAAgB,iBAAiB,CAAC,UAAsB;IACtD,OAAO,UAAU,CAAC,IAAI,KAAK,SAAS,IAAI,UAAU,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC;AAClL,CAAC;AAED,oGAAoG;AACpG,SAAS,SAAS,CAAC,OAAuB,EAAE,IAAY;IACtD,OAA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BAAkB,CAAC,CAAC;;YACpD,KAAK,CAAC,IAAI,CAAC,kBAAkB,OAAO,CAAC,MAAM,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9K,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type RunRecord } from '../agent/run-log';
|
|
2
|
+
import { type CoreFn } from './registry';
|
|
3
|
+
/** `agent show` params: the run id rides the bare positional (`spec-008` §1). */
|
|
4
|
+
export interface AgentShowParams {
|
|
5
|
+
readonly root: string;
|
|
6
|
+
readonly positional?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* `agent show`'s payload (`spec-016` §6): the baseline it answered from (`spec-017` §8's shape,
|
|
10
|
+
* `dl-084` (A)), the record as the log holds it (§4.2 key order), and the full sha of the commit that
|
|
11
|
+
* added the record's line — for a record `agent execute` wrote, its `agent: record <run-id>` commit.
|
|
12
|
+
*/
|
|
13
|
+
export interface AgentShowResult {
|
|
14
|
+
readonly baseline: {
|
|
15
|
+
readonly rev: 'HEAD';
|
|
16
|
+
readonly commit: string;
|
|
17
|
+
};
|
|
18
|
+
readonly run: RunRecord;
|
|
19
|
+
readonly commit: string;
|
|
20
|
+
}
|
|
21
|
+
/** The usage refusal of a positional that is not a run id (exit `2`, `spec-016` §6). */
|
|
22
|
+
export declare const invalidRunIdReason: (value: string) => string;
|
|
23
|
+
/**
|
|
24
|
+
* `agent show` `CoreOperation.fn` (`mutates: false`; `spec-006` §3, `spec-016` §8).
|
|
25
|
+
*
|
|
26
|
+
* 1. The operand: absent is the one missing-operand form; anything but a run id (§4.3) is
|
|
27
|
+
* `invalid run id "<value>", expected <element-id>/<phase>/<n>`. Both are usage errors (exit `2`),
|
|
28
|
+
* refused before the project is read.
|
|
29
|
+
* 2. `HEAD`, resolved once; `dna.yaml` at that commit, and its `paths.runs` (`dna.yaml declares no run
|
|
30
|
+
* log (paths.runs)` when absent, the recorder's own refusal).
|
|
31
|
+
* 3. `<runs>/<element-id>.jsonl` at that commit, through the strict reader (a §4.5 violation is
|
|
32
|
+
* `VALIDATION`). No record with that id is `NOT_FOUND` `run not found: <run-id>`, with a `hint` when
|
|
33
|
+
* the working tree's log holds it.
|
|
34
|
+
* 4. The adding commit, by `git log -S`.
|
|
35
|
+
*/
|
|
36
|
+
export declare const agentShowFn: CoreFn<unknown, AgentShowResult>;
|
|
37
|
+
/**
|
|
38
|
+
* `agent show`'s `--format console` (`spec-016` §6): one `key: value` line per record field in §4.2
|
|
39
|
+
* order, `tokens` flattened to `tokens.input`, `tokens.output`, `tokens.cache_read` and
|
|
40
|
+
* `tokens.cache_write`, then `commit: <sha>`. Values print as they are stored: a string verbatim, an
|
|
41
|
+
* integer in decimal.
|
|
42
|
+
*/
|
|
43
|
+
export declare function renderAgentShowConsole(value: unknown): string;
|
|
44
|
+
//# sourceMappingURL=agent-show.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-show.d.ts","sourceRoot":"","sources":["../../src/core/agent-show.ts"],"names":[],"mappings":"AAkBA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EAAwB,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AAK/D,iFAAiF;AACjF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACrE,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,wFAAwF;AACxF,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,KAAG,MAAwE,CAAC;AAmE5H;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,OAAO,EAAE,eAAe,CA6CxD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAY7D"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.agentShowFn = exports.invalidRunIdReason = void 0;
|
|
4
|
+
exports.renderAgentShowConsole = renderAgentShowConsole;
|
|
5
|
+
/**
|
|
6
|
+
* `wingfoil agent show <run-id>` (task-220, `spec-016` §6; P5.3.5): one recorded agent run, read from
|
|
7
|
+
* the run log at `HEAD`, and the commit that added its line.
|
|
8
|
+
*
|
|
9
|
+
* **Baseline: `HEAD`, declared** (`spec-016` §5.1, approver ruling R15; `spec-006` §6 item 6;
|
|
10
|
+
* `spec-008` §11). `dna.yaml`'s `paths.runs` and the run log are both read at the one `HEAD` commit the
|
|
11
|
+
* payload's `baseline` names, so `agent show` answers from the baseline `agent execute` counts run ids
|
|
12
|
+
* at (§4.3) and `agent list` lists from. The working tree is opened only to explain a refusal — a run
|
|
13
|
+
* that only an uncommitted log holds gets a `hint:` — never to decide one (the `command-baseline`
|
|
14
|
+
* directive).
|
|
15
|
+
*
|
|
16
|
+
* The reading itself is task-206's run-log library (`src/agent/run-log.ts`): its strict §4.5 reader,
|
|
17
|
+
* its run-id grammar and its path resolution. This module adds the lookup, the `git log -S` search for
|
|
18
|
+
* the adding commit (§4.2 chose JSON Lines so that this search works), and the console rendering.
|
|
19
|
+
*/
|
|
20
|
+
const node_fs_1 = require("node:fs");
|
|
21
|
+
const node_path_1 = require("node:path");
|
|
22
|
+
const run_log_1 = require("../agent/run-log");
|
|
23
|
+
const storage_1 = require("../storage");
|
|
24
|
+
const validation_1 = require("../validation");
|
|
25
|
+
const init_1 = require("./init");
|
|
26
|
+
const loaders_1 = require("./loaders");
|
|
27
|
+
const registry_1 = require("./registry");
|
|
28
|
+
const revision_1 = require("./revision");
|
|
29
|
+
const types_1 = require("./types");
|
|
30
|
+
const usage_error_1 = require("./usage-error");
|
|
31
|
+
/** The usage refusal of a positional that is not a run id (exit `2`, `spec-016` §6). */
|
|
32
|
+
const invalidRunIdReason = (value) => `invalid run id "${value}", expected <element-id>/<phase>/<n>`;
|
|
33
|
+
exports.invalidRunIdReason = invalidRunIdReason;
|
|
34
|
+
/**
|
|
35
|
+
* The `hint:` of a run the working tree's log holds and `HEAD`'s does not, or `undefined`. The file is
|
|
36
|
+
* read only when it is a regular file (a symbolic link is not followed), and a log that does not parse
|
|
37
|
+
* gives no hint: the hint explains, it never decides (the `command-baseline` directive).
|
|
38
|
+
*/
|
|
39
|
+
function workingTreeHint(root, logPath, runId) {
|
|
40
|
+
const absolute = (0, node_path_1.join)(root, logPath);
|
|
41
|
+
let text;
|
|
42
|
+
try {
|
|
43
|
+
if (!(0, node_fs_1.lstatSync)(absolute).isFile())
|
|
44
|
+
return undefined;
|
|
45
|
+
text = (0, node_fs_1.readFileSync)(absolute, 'utf-8');
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
const parsed = (0, run_log_1.parseRunLog)(text, logPath);
|
|
51
|
+
if (!parsed.ok || !parsed.value.some((record) => record.id === runId))
|
|
52
|
+
return undefined;
|
|
53
|
+
return `the working tree's ${logPath} holds ${runId}, but HEAD does not: agent show reads HEAD; commit the run log to show it`;
|
|
54
|
+
}
|
|
55
|
+
/** A full object name as `--format=%H` prints it: SHA-1 (40 hex) or SHA-256 (64 hex). */
|
|
56
|
+
const FULL_SHA_RE = /^[0-9a-f]{40}([0-9a-f]{24})?$/;
|
|
57
|
+
/**
|
|
58
|
+
* The commit that added `record`'s line to `logPath`, searched from `commit` back.
|
|
59
|
+
*
|
|
60
|
+
* `git log -S` (the search §4.2 names) lists every commit that changed how often the needle
|
|
61
|
+
* `{"id":"<run-id>",` occurs — the line opens with its `id`, §4.2 key 1, written with no whitespace —
|
|
62
|
+
* newest first. That list holds the commits that removed a copy of the line too: a side branch that
|
|
63
|
+
* dropped or reverted it and was merged keeping it, since a merge that equals neither parent makes
|
|
64
|
+
* git walk both (task-220 review F2). So each listed commit is checked in order, and the first whose
|
|
65
|
+
* log blob holds the line's exact bytes — as `commit`'s blob stores them, never re-serialized (R1) —
|
|
66
|
+
* is the one that added the line `HEAD` holds. A merge itself
|
|
67
|
+
* is not diffed, so a record that arrived through one is attributed to the commit on its branch that
|
|
68
|
+
* wrote it.
|
|
69
|
+
*
|
|
70
|
+
* `--no-show-signature` keeps a `log.showSignature` configuration from printing signature text in
|
|
71
|
+
* place of the names, and every name is checked to be a full sha (review F1); anything else is `IO`.
|
|
72
|
+
*/
|
|
73
|
+
function addingCommit(root, commit, logPath, record) {
|
|
74
|
+
const needle = `{"id":${JSON.stringify(record.id)},`;
|
|
75
|
+
// The line's bytes as `commit` stores them (re-review R1). Since bug-288 (task-228) the reader accepts
|
|
76
|
+
// only the writer's serialization, so they equal a re-serialization; they are still read as stored.
|
|
77
|
+
// The reader has accepted that blob, so it holds exactly one line of this id (§4.5: ids are unique)
|
|
78
|
+
// and it opens with the needle.
|
|
79
|
+
const lines = ((0, storage_1.readPathAtRev)(root, commit, logPath) ?? '').split('\n');
|
|
80
|
+
const line = lines.find((candidate) => candidate.startsWith(needle));
|
|
81
|
+
if (line === undefined)
|
|
82
|
+
return (0, types_1.coreErr)({ code: 'IO', message: `run ${record.id}: its line is not in ${logPath} at ${commit}` });
|
|
83
|
+
let stdout;
|
|
84
|
+
try {
|
|
85
|
+
stdout = (0, storage_1.runGitRead)(root, ['log', '--no-show-signature', '-S', needle, '--format=%H', commit, '--', logPath]).stdout;
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
if (!(error instanceof storage_1.StorageError))
|
|
89
|
+
throw error;
|
|
90
|
+
return (0, types_1.coreErr)({ code: 'IO', message: error.message });
|
|
91
|
+
}
|
|
92
|
+
const shas = stdout.split('\n').filter((name) => name !== '');
|
|
93
|
+
for (const sha of shas) {
|
|
94
|
+
if (!FULL_SHA_RE.test(sha)) {
|
|
95
|
+
return (0, types_1.coreErr)({ code: 'IO', message: `run ${record.id}: git log printed '${sha}' where a commit name was expected` });
|
|
96
|
+
}
|
|
97
|
+
const text = (0, storage_1.readPathAtRev)(root, sha, logPath);
|
|
98
|
+
if (text !== null && text.split('\n').includes(line))
|
|
99
|
+
return (0, types_1.coreOk)(sha);
|
|
100
|
+
}
|
|
101
|
+
return (0, types_1.coreErr)({ code: 'IO', message: `run ${record.id}: no commit in the history of HEAD adds its line to ${logPath}` });
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* `agent show` `CoreOperation.fn` (`mutates: false`; `spec-006` §3, `spec-016` §8).
|
|
105
|
+
*
|
|
106
|
+
* 1. The operand: absent is the one missing-operand form; anything but a run id (§4.3) is
|
|
107
|
+
* `invalid run id "<value>", expected <element-id>/<phase>/<n>`. Both are usage errors (exit `2`),
|
|
108
|
+
* refused before the project is read.
|
|
109
|
+
* 2. `HEAD`, resolved once; `dna.yaml` at that commit, and its `paths.runs` (`dna.yaml declares no run
|
|
110
|
+
* log (paths.runs)` when absent, the recorder's own refusal).
|
|
111
|
+
* 3. `<runs>/<element-id>.jsonl` at that commit, through the strict reader (a §4.5 violation is
|
|
112
|
+
* `VALIDATION`). No record with that id is `NOT_FOUND` `run not found: <run-id>`, with a `hint` when
|
|
113
|
+
* the working tree's log holds it.
|
|
114
|
+
* 4. The adding commit, by `git log -S`.
|
|
115
|
+
*/
|
|
116
|
+
const agentShowFn = async (params) => {
|
|
117
|
+
const { root, positional } = params;
|
|
118
|
+
if (positional === undefined)
|
|
119
|
+
throw new usage_error_1.UsageError((0, registry_1.missingOperandReason)('run-id'));
|
|
120
|
+
const elementId = (0, run_log_1.runIdElementId)(positional);
|
|
121
|
+
if (elementId === null)
|
|
122
|
+
throw new usage_error_1.UsageError((0, exports.invalidRunIdReason)(positional));
|
|
123
|
+
const runId = positional;
|
|
124
|
+
const initialized = (0, init_1.requireInitializedProject)(root);
|
|
125
|
+
if (!initialized.ok)
|
|
126
|
+
return initialized;
|
|
127
|
+
let commit;
|
|
128
|
+
try {
|
|
129
|
+
commit = (0, revision_1.resolveRevision)(root, 'HEAD');
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
if (error instanceof revision_1.RevisionError)
|
|
133
|
+
return (0, types_1.coreErr)(error.toCoreError());
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
let runs;
|
|
137
|
+
try {
|
|
138
|
+
const dna = (0, loaders_1.loadDnaYamlAtRev)(root, commit);
|
|
139
|
+
if (dna === null) {
|
|
140
|
+
return (0, types_1.coreErr)({ code: 'NOT_FOUND', message: `${loaders_1.DNA_YAML_PATH} is not committed at HEAD, which agent show reads: commit it first` });
|
|
141
|
+
}
|
|
142
|
+
runs = dna.paths['runs'];
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
if (!(error instanceof validation_1.ValidationError))
|
|
146
|
+
throw error;
|
|
147
|
+
return (0, types_1.coreErr)({ code: 'VALIDATION', message: error.message, details: { issues: error.issues } });
|
|
148
|
+
}
|
|
149
|
+
const logPath = (0, run_log_1.resolveRunLogPath)(root, runs, elementId, 'read');
|
|
150
|
+
if (!logPath.ok)
|
|
151
|
+
return logPath;
|
|
152
|
+
const records = (0, run_log_1.readRunLogAt)(root, commit, logPath.value);
|
|
153
|
+
if (!records.ok)
|
|
154
|
+
return records;
|
|
155
|
+
const run = records.value.find((record) => record.id === runId);
|
|
156
|
+
if (run === undefined) {
|
|
157
|
+
const hint = workingTreeHint(root, logPath.value, runId);
|
|
158
|
+
return (0, types_1.coreErr)({ code: 'NOT_FOUND', message: `run not found: ${runId}`, ...(hint === undefined ? {} : { hint }) });
|
|
159
|
+
}
|
|
160
|
+
const added = addingCommit(root, commit, logPath.value, run);
|
|
161
|
+
if (!added.ok)
|
|
162
|
+
return added;
|
|
163
|
+
// `run` is the parsed line, so its keys are in §4.2's order: the strict reader accepts no other.
|
|
164
|
+
return (0, types_1.coreOk)({ baseline: { rev: 'HEAD', commit }, run, commit: added.value });
|
|
165
|
+
};
|
|
166
|
+
exports.agentShowFn = agentShowFn;
|
|
167
|
+
/**
|
|
168
|
+
* `agent show`'s `--format console` (`spec-016` §6): one `key: value` line per record field in §4.2
|
|
169
|
+
* order, `tokens` flattened to `tokens.input`, `tokens.output`, `tokens.cache_read` and
|
|
170
|
+
* `tokens.cache_write`, then `commit: <sha>`. Values print as they are stored: a string verbatim, an
|
|
171
|
+
* integer in decimal.
|
|
172
|
+
*/
|
|
173
|
+
function renderAgentShowConsole(value) {
|
|
174
|
+
const { run, commit } = value;
|
|
175
|
+
const lines = [];
|
|
176
|
+
for (const key of run_log_1.RUN_RECORD_KEYS) {
|
|
177
|
+
if (key === 'tokens') {
|
|
178
|
+
for (const token of run_log_1.RUN_TOKEN_KEYS)
|
|
179
|
+
lines.push(`tokens.${token}: ${run.tokens[token]}`);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
lines.push(`${key}: ${run[key]}`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
lines.push(`commit: ${commit}`);
|
|
186
|
+
return `${lines.join('\n')}\n`;
|
|
187
|
+
}
|
|
188
|
+
//# sourceMapping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C,IAAI,CAAC,UAAU,KAAK,KAAK,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC1F,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,WAAW,MAAM,EAAE,CAAC,CAAC;IAChC,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC"}
|
|
@@ -10,29 +10,31 @@
|
|
|
10
10
|
* `.wingfoil/workflows/custom/*.yaml` already gates on the single `approver` role, so this module
|
|
11
11
|
* does the same rather than inventing a per-type mapping no spec defines.
|
|
12
12
|
*
|
|
13
|
-
* "Who is asking" is
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* authority is checked against the exact
|
|
13
|
+
* "Who is asking" is the identity `requireGitIdentity` (REQ-SEC-01, `./git-identity.ts`) resolved and
|
|
14
|
+
* returned, handed in by the caller rather than read again here (`dl-064` B.1, task-132) — git
|
|
15
|
+
* identity is WingFoil's sole attribution mechanism (adr-001/adr-006), and the transition verbs pin
|
|
16
|
+
* that same value as the commit's author, so authority is checked against the exact "who" the
|
|
17
|
+
* resulting approval commit records (`bug-149`). This
|
|
17
18
|
* is why `team.agents` is deliberately NOT consulted here: an AI agent has no git identity of its own
|
|
18
19
|
* distinct from whichever human account runs the command, so there is no code-level signal this
|
|
19
20
|
* git-identity-keyed check could use to single an agent out. Structurally preventing agents from
|
|
20
21
|
* holding approval authority is instead a `dna.yaml` fact (`team.agents[].approval_authority: false`)
|
|
21
|
-
* enforced by process/governance (
|
|
22
|
+
* enforced by process/governance (AGENTS.md §4/§8: "AI agents ... never hold approval authority"), not
|
|
22
23
|
* by this predicate.
|
|
23
24
|
*
|
|
24
25
|
* **"Who is authorized" is read from the COMMITTED `dna.yaml`, never from the working tree**
|
|
25
26
|
* (task-090, `bug-079-uncommitted-dna-yaml-grants-approval-authority`). The two halves of the check
|
|
26
27
|
* therefore take deliberately different baselines, and each takes the only one it can:
|
|
27
28
|
*
|
|
28
|
-
* - *who is asking* — the live git
|
|
29
|
-
*
|
|
29
|
+
* - *who is asking* — the live git identity (environment, then config), a local setting git never
|
|
30
|
+
* commits, and exactly what the resulting commit records as its author;
|
|
30
31
|
* - *who may approve* — `HEAD`'s `.wingfoil/dna.yaml`, because an approval is evidence and evidence
|
|
31
32
|
* is worth what an independent reader can re-derive from the artefact of record. An uncommitted
|
|
32
33
|
* grant used to be enough to put `Approver: … (approver)` into a permanent commit that the
|
|
33
34
|
* repository's own record, at that very commit, contradicted.
|
|
34
35
|
*/
|
|
35
36
|
import type { DnaYaml } from '../dna/schema';
|
|
37
|
+
import type { GitIdentity } from './git-identity';
|
|
36
38
|
import { type CoreResult } from './types';
|
|
37
39
|
/** The one role that carries approval authority, uniformly across every Memory type (adr-006). */
|
|
38
40
|
export declare const APPROVER_ROLE: "approver";
|
|
@@ -40,14 +42,13 @@ export declare const APPROVER_ROLE: "approver";
|
|
|
40
42
|
* The roles held by the `dna.yaml` `team.members[]` entry whose `email` matches `email`
|
|
41
43
|
* (case-insensitively — git identities are free-form and casing is not semantically meaningful),
|
|
42
44
|
* or `[]` when `email` is empty or matches no member. Pure lookup — no git/filesystem access; callers
|
|
43
|
-
* needing the live git identity
|
|
44
|
-
* (`./git-identity.ts`) themselves.
|
|
45
|
+
* needing the live git identity get it from `requireGitIdentity` (`./git-identity.ts`).
|
|
45
46
|
*/
|
|
46
47
|
export declare function resolveMemberRoles(dna: DnaYaml, email: string): readonly string[];
|
|
47
48
|
/** Whether the `dna.yaml` team member matching `email` holds the {@link APPROVER_ROLE}. */
|
|
48
49
|
export declare function hasApproverRole(dna: DnaYaml, email: string): boolean;
|
|
49
50
|
/**
|
|
50
|
-
* Verify the principal
|
|
51
|
+
* Verify the principal `identity` holds the `approver` role — **as
|
|
51
52
|
* the committed `.wingfoil/dna.yaml` records it** — before an approval (`memory.approve`, P1.7) or a
|
|
52
53
|
* rejection (`memory.reject`, P1.8) proceeds. Returns a `CoreResult.error` (code `VALIDATION` — a
|
|
53
54
|
* failed authorization precondition, mapped to exit `1` by `exitCodeForError`, mirroring
|
|
@@ -75,9 +76,11 @@ export declare function hasApproverRole(dna: DnaYaml, email: string): boolean;
|
|
|
75
76
|
* configuration even by accident, which is what makes the committed baseline a property of the read
|
|
76
77
|
* itself rather than of a precondition someone must remember to run (task-090, AC2).
|
|
77
78
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
79
|
+
* It takes the `identity`, by contrast, rather than reading it: the value must be the one
|
|
80
|
+
* `requireGitIdentity` (REQ-SEC-01) validated and the one the commit will carry, and the way to
|
|
81
|
+
* guarantee that is to leave this function nothing to read (`dl-064` B.1, task-132). Callers obtain it
|
|
82
|
+
* from `beginMemoryTransition` (`./memory-transition.ts`), which runs the identity check first — an
|
|
83
|
+
* unconfigured identity surfaces as REQ-SEC-01's own message, not this one.
|
|
81
84
|
*/
|
|
82
|
-
export declare function requireApprovalAuthority(root: string, typeName: string): CoreResult<void>;
|
|
85
|
+
export declare function requireApprovalAuthority(root: string, typeName: string, identity: GitIdentity): CoreResult<void>;
|
|
83
86
|
//# sourceMappingURL=approval-authority.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval-authority.d.ts","sourceRoot":"","sources":["../../src/core/approval-authority.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"approval-authority.d.ts","sourceRoot":"","sources":["../../src/core/approval-authority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAE3D,kGAAkG;AAClG,eAAO,MAAM,aAAa,EAAG,UAAmB,CAAC;AAEjD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAKjF;AAED,2FAA2F;AAC3F,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpE;AAiBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,CAmChH"}
|
|
@@ -5,7 +5,6 @@ exports.resolveMemberRoles = resolveMemberRoles;
|
|
|
5
5
|
exports.hasApproverRole = hasApproverRole;
|
|
6
6
|
exports.requireApprovalAuthority = requireApprovalAuthority;
|
|
7
7
|
const validation_1 = require("../validation");
|
|
8
|
-
const git_identity_1 = require("./git-identity");
|
|
9
8
|
const loaders_1 = require("./loaders");
|
|
10
9
|
const types_1 = require("./types");
|
|
11
10
|
/** The one role that carries approval authority, uniformly across every Memory type (adr-006). */
|
|
@@ -14,8 +13,7 @@ exports.APPROVER_ROLE = 'approver';
|
|
|
14
13
|
* The roles held by the `dna.yaml` `team.members[]` entry whose `email` matches `email`
|
|
15
14
|
* (case-insensitively — git identities are free-form and casing is not semantically meaningful),
|
|
16
15
|
* or `[]` when `email` is empty or matches no member. Pure lookup — no git/filesystem access; callers
|
|
17
|
-
* needing the live git identity
|
|
18
|
-
* (`./git-identity.ts`) themselves.
|
|
16
|
+
* needing the live git identity get it from `requireGitIdentity` (`./git-identity.ts`).
|
|
19
17
|
*/
|
|
20
18
|
function resolveMemberRoles(dna, email) {
|
|
21
19
|
if (email.length === 0)
|
|
@@ -44,7 +42,7 @@ function workingTreeWouldGrant(root, email) {
|
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
44
|
/**
|
|
47
|
-
* Verify the principal
|
|
45
|
+
* Verify the principal `identity` holds the `approver` role — **as
|
|
48
46
|
* the committed `.wingfoil/dna.yaml` records it** — before an approval (`memory.approve`, P1.7) or a
|
|
49
47
|
* rejection (`memory.reject`, P1.8) proceeds. Returns a `CoreResult.error` (code `VALIDATION` — a
|
|
50
48
|
* failed authorization precondition, mapped to exit `1` by `exitCodeForError`, mirroring
|
|
@@ -72,12 +70,14 @@ function workingTreeWouldGrant(root, email) {
|
|
|
72
70
|
* configuration even by accident, which is what makes the committed baseline a property of the read
|
|
73
71
|
* itself rather than of a precondition someone must remember to run (task-090, AC2).
|
|
74
72
|
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
73
|
+
* It takes the `identity`, by contrast, rather than reading it: the value must be the one
|
|
74
|
+
* `requireGitIdentity` (REQ-SEC-01) validated and the one the commit will carry, and the way to
|
|
75
|
+
* guarantee that is to leave this function nothing to read (`dl-064` B.1, task-132). Callers obtain it
|
|
76
|
+
* from `beginMemoryTransition` (`./memory-transition.ts`), which runs the identity check first — an
|
|
77
|
+
* unconfigured identity surfaces as REQ-SEC-01's own message, not this one.
|
|
78
78
|
*/
|
|
79
|
-
function requireApprovalAuthority(root, typeName) {
|
|
80
|
-
const { email } =
|
|
79
|
+
function requireApprovalAuthority(root, typeName, identity) {
|
|
80
|
+
const { email } = identity;
|
|
81
81
|
let committed;
|
|
82
82
|
try {
|
|
83
83
|
committed = (0, loaders_1.loadDnaYamlAtHead)(root);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval-authority.js","sourceRoot":"","sources":["../../src/core/approval-authority.ts"],"names":[],"mappings":";;;AAmDA,gDAKC;AAGD,0CAEC;
|
|
1
|
+
{"version":3,"file":"approval-authority.js","sourceRoot":"","sources":["../../src/core/approval-authority.ts"],"names":[],"mappings":";;;AAmDA,gDAKC;AAGD,0CAEC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