@astrosheep/keiyaku 4.6.30 → 4.6.31
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 +5 -5
- package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/build/plugins/claude/skills/keiyaku/SKILL.md +12 -12
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +16 -16
- package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +14 -14
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +10 -10
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +15 -15
- package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +16 -16
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +21 -21
- package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
- package/build/plugins/codex/skills/keiyaku/SKILL.md +12 -12
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +16 -16
- package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +14 -14
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +10 -10
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +15 -15
- package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +16 -16
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +21 -21
- package/build/plugins/opencode/package.json +1 -1
- package/build/plugins/opencode/skills/keiyaku/SKILL.md +12 -12
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +16 -16
- package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +14 -14
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +10 -10
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +15 -15
- package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +16 -16
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +21 -21
- package/build/plugins/pi/README.md +5 -5
- package/build/plugins/pi/akuma-tools.ts +17 -23
- package/build/skills/keiyaku/SKILL.md +12 -12
- package/build/skills/keiyaku-akuma/SKILL.md +16 -16
- package/build/skills/keiyaku-akuma/references/automation.md +14 -14
- package/build/skills/keiyaku-babysit/SKILL.md +10 -10
- package/build/skills/keiyaku-bind/SKILL.md +15 -15
- package/build/skills/keiyaku-debt/SKILL.md +16 -16
- package/build/skills/keiyaku-workflow/SKILL.md +21 -21
- package/build/src/akuma/akuma-call.d.ts +1 -1
- package/build/src/akuma/akuma-call.js +9 -9
- package/build/src/akuma/akuma-errors.d.ts +5 -5
- package/build/src/akuma/akuma-instance.d.ts +355 -12
- package/build/src/akuma/akuma-instance.js +20 -20
- package/build/src/akuma/akuma-observe.d.ts +11 -12
- package/build/src/akuma/akuma-observe.js +34 -26
- package/build/src/akuma/akuma-owner.d.ts +32 -11
- package/build/src/akuma/akuma-owner.js +35 -16
- package/build/src/akuma/akuma-probe.d.ts +3 -3
- package/build/src/akuma/akuma-probe.js +2 -2
- package/build/src/akuma/akuma-selection-execution.d.ts +985 -1
- package/build/src/akuma/akuma-selection-execution.js +42 -18
- package/build/src/akuma/akuma-stream.d.ts +2 -2
- package/build/src/akuma/akuma-stream.js +1 -1
- package/build/src/akuma/akuma-wait.d.ts +5 -5
- package/build/src/akuma/akuma-wait.js +52 -14
- package/build/src/akuma/akuma.d.ts +245 -271
- package/build/src/akuma/akuma.js +98 -46
- package/build/src/akuma/archetype.d.ts +19 -6
- package/build/src/akuma/archetype.js +25 -9
- package/build/src/akuma/body-launch.d.ts +2 -2
- package/build/src/akuma/body.js +4 -4
- package/build/src/akuma/call-initial-tell.d.ts +60 -44
- package/build/src/akuma/call-initial-tell.js +41 -2
- package/build/src/akuma/caller.d.ts +26 -17
- package/build/src/akuma/caller.js +22 -9
- package/build/src/akuma/coordinate.d.ts +9 -0
- package/build/src/akuma/coordinate.js +13 -0
- package/build/src/akuma/detached-body.js +2 -2
- package/build/src/akuma/dispatch-association.d.ts +4 -4
- package/build/src/akuma/dispatch-association.js +12 -3
- package/build/src/akuma/execution-instructions.js +2 -2
- package/build/src/akuma/heart/facts.d.ts +29 -7
- package/build/src/akuma/heart/facts.js +13 -0
- package/build/src/akuma/heart/index.d.ts +0 -3
- package/build/src/akuma/heart/index.js +3 -6
- package/build/src/akuma/heart/rows.js +2 -2
- package/build/src/akuma/heart/soul.js +5 -5
- package/build/src/akuma/identity.d.ts +17 -16
- package/build/src/akuma/identity.js +20 -19
- package/build/src/akuma/index.d.ts +1 -2
- package/build/src/akuma/lineage-cache.d.ts +4 -4
- package/build/src/akuma/lineage-cache.js +10 -10
- package/build/src/akuma/projection-read.d.ts +2 -5
- package/build/src/akuma/projection-read.js +34 -47
- package/build/src/akuma/projection.d.ts +659 -569
- package/build/src/akuma/projection.js +203 -94
- package/build/src/akuma/providers/acp/index.js +1 -1
- package/build/src/akuma/providers/execution-environment.d.ts +1 -3
- package/build/src/akuma/providers/execution-environment.js +0 -4
- package/build/src/akuma/publication.d.ts +2 -2
- package/build/src/akuma/publication.js +3 -3
- package/build/src/akuma/retention.js +2 -2
- package/build/src/akuma/selection-observation.d.ts +507 -43
- package/build/src/akuma/selection-observation.js +153 -1
- package/build/src/akuma/status-projection.d.ts +288 -0
- package/build/src/akuma/status-projection.js +154 -0
- package/build/src/akuma/turn-drive.js +0 -3
- package/build/src/alias/index.d.ts +9 -4
- package/build/src/alias/index.js +11 -9
- package/build/src/bounded-list.d.ts +8 -0
- package/build/src/bounded-list.js +9 -0
- package/build/src/cli/commands/akuma-grammar.d.ts +2 -2
- package/build/src/cli/commands/akuma-grammar.js +21 -21
- package/build/src/cli/commands/akuma.d.ts +1 -2
- package/build/src/cli/commands/akuma.js +115 -251
- package/build/src/cli/commands/contract-grammar.d.ts +4 -3
- package/build/src/cli/commands/contract-grammar.js +39 -22
- package/build/src/cli/commands/contract-help.d.ts +3 -1
- package/build/src/cli/commands/contract-help.js +4 -3
- package/build/src/cli/commands/contract.d.ts +6 -3
- package/build/src/cli/commands/contract.js +203 -434
- package/build/src/cli/commands/debt.d.ts +2 -3
- package/build/src/cli/commands/debt.js +101 -317
- package/build/src/cli/commands/report.js +11 -28
- package/build/src/cli/commands/whoami.d.ts +3 -43
- package/build/src/cli/commands/whoami.js +8 -121
- package/build/src/cli/coordinates.d.ts +4 -35
- package/build/src/cli/coordinates.js +13 -129
- package/build/src/cli/parse.d.ts +0 -6
- package/build/src/cli/parse.js +5 -48
- package/build/src/cli/render/akuma-activity.d.ts +31 -16
- package/build/src/cli/render/akuma-activity.js +157 -149
- package/build/src/cli/render/akuma-tool.d.ts +3 -6
- package/build/src/cli/render/akuma-tool.js +20 -14
- package/build/src/cli/render/akuma.d.ts +25 -26
- package/build/src/cli/render/akuma.js +100 -129
- package/build/src/cli/render/catalog.d.ts +4 -7
- package/build/src/cli/render/catalog.js +52 -99
- package/build/src/cli/render/contract-history.d.ts +3 -1
- package/build/src/cli/render/contract-history.js +140 -215
- package/build/src/cli/render/contract-observation.d.ts +43 -30
- package/build/src/cli/render/contract-observation.js +64 -31
- package/build/src/cli/render/contract-wait.js +6 -6
- package/build/src/cli/render/contract.d.ts +41 -6
- package/build/src/cli/render/contract.js +274 -370
- package/build/src/cli/render/debt.d.ts +9 -19
- package/build/src/cli/render/debt.js +120 -185
- package/build/src/cli/render/delivery-preview.d.ts +4 -3
- package/build/src/cli/render/delivery-preview.js +68 -96
- package/build/src/cli/render/kanshi-akuma.d.ts +4 -4
- package/build/src/cli/render/kanshi-akuma.js +70 -59
- package/build/src/cli/render/kanshi.d.ts +4 -4
- package/build/src/cli/render/kanshi.js +205 -221
- package/build/src/cli/render/marks.d.ts +11 -2
- package/build/src/cli/render/marks.js +13 -3
- package/build/src/cli/render/nuke.d.ts +3 -3
- package/build/src/cli/render/nuke.js +13 -16
- package/build/src/cli/render/receipt.d.ts +37 -43
- package/build/src/cli/render/receipt.js +313 -236
- package/build/src/cli/render/reconcile.d.ts +6 -4
- package/build/src/cli/render/reconcile.js +53 -137
- package/build/src/cli/render/refusal.d.ts +3 -2
- package/build/src/cli/render/refusal.js +73 -54
- package/build/src/cli/render/region.d.ts +11 -2
- package/build/src/cli/render/region.js +17 -23
- package/build/src/cli/render/settings.d.ts +0 -1
- package/build/src/cli/render/settings.js +8 -17
- package/build/src/cli/render/terminal.d.ts +2 -0
- package/build/src/cli/render/verbs.d.ts +4 -0
- package/build/src/cli/render/verbs.js +312 -0
- package/build/src/cli/render/whoami.d.ts +1 -1
- package/build/src/cli/render/whoami.js +24 -31
- package/build/src/cli/runtime.d.ts +3 -11
- package/build/src/cli/runtime.js +96 -79
- package/build/src/cli/scan.d.ts +1 -1
- package/build/src/cli/streams.js +1 -0
- package/build/src/contract-guidance.js +2 -2
- package/build/src/contract-worktree.d.ts +2 -15
- package/build/src/contract-worktree.js +19 -35
- package/build/src/core/facts/observation.d.ts +4 -5
- package/build/src/core/facts/observation.js +7 -9
- package/build/src/core/verbs/amend.d.ts +0 -1
- package/build/src/core/verbs/amend.js +3 -3
- package/build/src/core/verbs/bind.d.ts +0 -1
- package/build/src/core/verbs/bind.js +5 -5
- package/build/src/core/verbs/deliver.d.ts +3 -2
- package/build/src/core/verbs/deliver.js +2 -2
- package/build/src/core/verbs/placement.d.ts +0 -5
- package/build/src/core/verbs/placement.js +4 -6
- package/build/src/core/verbs/reintegrate.d.ts +0 -1
- package/build/src/core/verbs/reintegrate.js +2 -2
- package/build/src/debt/board.d.ts +132 -116
- package/build/src/debt/board.js +138 -94
- package/build/src/debt/catalog.d.ts +4 -4
- package/build/src/debt/catalog.js +2 -18
- package/build/src/debt/context.d.ts +15 -3
- package/build/src/debt/context.js +12 -1
- package/build/src/debt/created-observation.d.ts +5 -17
- package/build/src/debt/created-observation.js +14 -6
- package/build/src/debt/document.d.ts +20 -15
- package/build/src/debt/document.js +18 -1
- package/build/src/debt/index.d.ts +346 -23
- package/build/src/debt/index.js +68 -22
- package/build/src/debt/input.d.ts +2 -1
- package/build/src/debt/input.js +14 -0
- package/build/src/debt/lifecycle-operations.d.ts +2 -2
- package/build/src/debt/lifecycle-operations.js +14 -22
- package/build/src/debt/operation-types.d.ts +188 -66
- package/build/src/debt/operation-types.js +113 -1
- package/build/src/debt/operations.d.ts +11 -10
- package/build/src/debt/operations.js +46 -71
- package/build/src/debt/query.d.ts +14 -10
- package/build/src/debt/query.js +3 -12
- package/build/src/debt/store.d.ts +4 -2
- package/build/src/debt/store.js +8 -8
- package/build/src/debt/view.d.ts +0 -3
- package/build/src/debt/view.js +0 -4
- package/build/src/dispatch/index.d.ts +22 -5
- package/build/src/dispatch/index.js +46 -37
- package/build/src/git/admission.d.ts +2 -2
- package/build/src/git/admission.js +2 -1
- package/build/src/git/hooks.d.ts +14 -35
- package/build/src/git/hooks.js +45 -25
- package/build/src/git/integration.d.ts +6 -24
- package/build/src/git/integration.js +10 -16
- package/build/src/git/private-state-seat.d.ts +2 -2
- package/build/src/git/private-state-seat.js +2 -1
- package/build/src/git/reconcile.d.ts +17 -79
- package/build/src/git/reconcile.js +37 -52
- package/build/src/git/scratch.d.ts +3 -3
- package/build/src/git/scratch.js +4 -1
- package/build/src/git/target-placement.d.ts +23 -31
- package/build/src/git/target-placement.js +42 -27
- package/build/src/git/target.d.ts +2 -2
- package/build/src/git/target.js +2 -1
- package/build/src/git/tender.d.ts +7 -39
- package/build/src/git/tender.js +21 -54
- package/build/src/git/terminal-reconcile.js +15 -18
- package/build/src/git/terminal-seal.d.ts +2 -4
- package/build/src/git/terminal-seal.js +7 -33
- package/build/src/git/workspace.d.ts +65 -41
- package/build/src/git/workspace.js +45 -14
- package/build/src/identity/selector.d.ts +2 -0
- package/build/src/identity/selector.js +13 -3
- package/build/src/index.d.ts +48 -54
- package/build/src/index.js +31 -43
- package/build/src/kanshi/counts.d.ts +42 -8
- package/build/src/kanshi/counts.js +13 -2
- package/build/src/kanshi/index.d.ts +5 -5
- package/build/src/kanshi/index.js +4 -3
- package/build/src/kanshi/read.d.ts +489 -6
- package/build/src/kanshi/read.js +334 -483
- package/build/src/kanshi/report.d.ts +2504 -103
- package/build/src/kanshi/report.js +165 -1
- package/build/src/kanshi/select.d.ts +0 -8
- package/build/src/kanshi/select.js +20 -59
- package/build/src/library/address.d.ts +8 -8
- package/build/src/library/address.js +7 -7
- package/build/src/library/akuma-creation.d.ts +690 -84
- package/build/src/library/akuma-creation.js +202 -142
- package/build/src/library/akuma-retention.d.ts +2 -2
- package/build/src/library/akuma-retention.js +2 -2
- package/build/src/library/akumas.d.ts +10 -6
- package/build/src/library/akumas.js +24 -7
- package/build/src/library/bind.d.ts +28 -54
- package/build/src/library/bind.js +6 -4
- package/build/src/library/continuation.d.ts +197 -479
- package/build/src/library/continuation.js +40 -23
- package/build/src/library/contract-address.d.ts +6 -5
- package/build/src/library/contract-address.js +5 -7
- package/build/src/library/contract-composition.d.ts +18 -12
- package/build/src/library/contract-composition.js +55 -47
- package/build/src/library/contract-creation.d.ts +3 -2
- package/build/src/library/contract-creation.js +38 -32
- package/build/src/library/contract-execution.js +77 -38
- package/build/src/library/contract-outcomes.d.ts +1877 -27
- package/build/src/library/contract-outcomes.js +93 -10
- package/build/src/library/contract-settings.d.ts +2 -2
- package/build/src/library/contract-settings.js +18 -14
- package/build/src/library/contract-types.d.ts +238 -61
- package/build/src/library/contract-types.js +131 -1
- package/build/src/library/contract-wait.d.ts +38 -17
- package/build/src/library/contract-wait.js +40 -10
- package/build/src/library/delivery.d.ts +588 -36
- package/build/src/library/delivery.js +35 -27
- package/build/src/library/input.d.ts +1 -1
- package/build/src/library/input.js +1 -2
- package/build/src/library/invocation.d.ts +11 -7
- package/build/src/library/invocation.js +42 -51
- package/build/src/library/kei.d.ts +48 -0
- package/build/src/library/kei.js +256 -0
- package/build/src/library/keiyaku-attribution.d.ts +11 -0
- package/build/src/{cli/delivery-identity.js → library/keiyaku-attribution.js} +12 -1
- package/build/src/library/keiyaku-classify.d.ts +11 -0
- package/build/src/library/keiyaku-classify.js +146 -0
- package/build/src/library/keiyaku-coordinates.d.ts +31 -0
- package/build/src/library/keiyaku-coordinates.js +103 -0
- package/build/src/library/keiyaku-debt.d.ts +142 -0
- package/build/src/library/keiyaku-debt.js +188 -0
- package/build/src/library/keiyaku-identity.d.ts +58 -0
- package/build/src/library/keiyaku-identity.js +176 -0
- package/build/src/library/keiyaku-policy.d.ts +27 -0
- package/build/src/library/keiyaku-policy.js +44 -0
- package/build/src/library/keiyaku-status.d.ts +1487 -0
- package/build/src/library/keiyaku-status.js +92 -0
- package/build/src/library/keiyaku-verbs.d.ts +6774 -0
- package/build/src/library/keiyaku-verbs.js +458 -0
- package/build/src/library/keiyaku.d.ts +871 -38
- package/build/src/library/keiyaku.js +677 -127
- package/build/src/library/nuke.d.ts +22 -0
- package/build/src/library/nuke.js +4 -1
- package/build/src/library/outcome.d.ts +706 -692
- package/build/src/library/outcome.js +582 -167
- package/build/src/library/reconcile.d.ts +464 -116
- package/build/src/library/reconcile.js +174 -102
- package/build/src/library/refusal.d.ts +113 -577
- package/build/src/library/refusal.js +64 -51
- package/build/src/library/region.d.ts +5 -24
- package/build/src/library/region.js +6 -21
- package/build/src/library/selection.d.ts +181 -32
- package/build/src/library/selection.js +99 -64
- package/build/src/mcp/adapter.d.ts +11 -0
- package/build/src/mcp/adapter.js +106 -0
- package/build/src/mcp/help.d.ts +1 -0
- package/build/src/mcp/help.js +26 -0
- package/build/src/mcp/index.d.ts +2 -0
- package/build/src/mcp/index.js +37 -0
- package/build/src/plugin/public.d.ts +1 -1
- package/build/src/plugin/runtime.js +17 -14
- package/build/src/protocol/arc.d.ts +4 -1
- package/build/src/protocol/arc.js +7 -1
- package/build/src/protocol/attempt.d.ts +2 -3
- package/build/src/protocol/attempt.js +1 -10
- package/build/src/protocol/bind.d.ts +6 -7
- package/build/src/protocol/bind.js +9 -5
- package/build/src/protocol/completion.d.ts +448 -12
- package/build/src/protocol/completion.js +164 -26
- package/build/src/protocol/deliver.d.ts +26 -24
- package/build/src/protocol/deliver.js +24 -52
- package/build/src/protocol/delivery-preview.d.ts +97 -247
- package/build/src/protocol/delivery-preview.js +132 -128
- package/build/src/protocol/execution-observation.d.ts +146 -123
- package/build/src/protocol/execution-observation.js +9 -6
- package/build/src/protocol/intent.d.ts +9 -48
- package/build/src/protocol/intent.js +32 -46
- package/build/src/protocol/operations.d.ts +207 -505
- package/build/src/protocol/operations.js +81 -134
- package/build/src/protocol/placement.d.ts +0 -1
- package/build/src/protocol/placement.js +5 -2
- package/build/src/protocol/progress.d.ts +7 -97
- package/build/src/protocol/progress.js +7 -55
- package/build/src/protocol/read/observation.d.ts +13 -6
- package/build/src/protocol/read/observation.js +10 -9
- package/build/src/protocol/read/status.d.ts +464 -93
- package/build/src/protocol/read/status.js +372 -85
- package/build/src/protocol/reconcile.d.ts +2 -0
- package/build/src/protocol/reconcile.js +12 -11
- package/build/src/protocol/reintegrate.d.ts +0 -1
- package/build/src/protocol/reintegrate.js +4 -4
- package/build/src/protocol/result-leaves.d.ts +528 -0
- package/build/src/protocol/result-leaves.js +195 -0
- package/build/src/protocol/result-reasons.d.ts +129 -0
- package/build/src/protocol/result-reasons.js +87 -0
- package/build/src/protocol/review.d.ts +14 -11
- package/build/src/protocol/review.js +30 -14
- package/build/src/protocol/run.d.ts +4 -4
- package/build/src/protocol/run.js +4 -1
- package/build/src/protocol/verify.d.ts +359 -30
- package/build/src/protocol/verify.js +118 -28
- package/build/src/region.d.ts +26 -0
- package/build/src/region.js +28 -0
- package/build/src/runtime/proc/diagnostic.d.ts +11 -0
- package/build/src/runtime/proc/diagnostic.js +20 -0
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settings.d.ts +126 -32
- package/build/src/settings.js +107 -34
- package/build/src/settlement/settle.d.ts +29 -12
- package/build/src/settlement/settle.js +22 -15
- package/build/src/verification/declaration.d.ts +1 -3
- package/build/src/verification/declaration.js +2 -5
- package/build/src/verification/execution.d.ts +7 -19
- package/build/src/verification/execution.js +37 -16
- package/build/src/verification/observation.d.ts +13 -13
- package/build/src/verification/observation.js +9 -7
- package/build/src/world.d.ts +8 -0
- package/build/src/world.js +7 -0
- package/package.json +6 -5
- package/plugins/paseo/plugin/server/keiyaku.ts +13 -46
- package/plugins/paseo/plugin/server/message.ts +8 -30
- package/plugins/paseo/plugin/server/mirror.ts +16 -20
- package/plugins/paseo/plugin/server/provider.ts +1 -1
- package/plugins/paseo/plugin/server/sdk.ts +14 -6
- package/plugins/pi/README.md +5 -5
- package/plugins/pi/akuma-tools.ts +17 -23
- package/skills/keiyaku/SKILL.md +12 -12
- package/skills/keiyaku-akuma/SKILL.md +16 -16
- package/skills/keiyaku-akuma/references/automation.md +14 -14
- package/skills/keiyaku-babysit/SKILL.md +10 -10
- package/skills/keiyaku-bind/SKILL.md +15 -15
- package/skills/keiyaku-debt/SKILL.md +16 -16
- package/skills/keiyaku-workflow/SKILL.md +21 -21
- package/build/src/cli/actor.d.ts +0 -10
- package/build/src/cli/actor.js +0 -24
- package/build/src/cli/akuma-caller.d.ts +0 -3
- package/build/src/cli/akuma-caller.js +0 -31
- package/build/src/cli/delivery-identity.d.ts +0 -3
- package/build/src/cli/render/effects.d.ts +0 -26
- package/build/src/cli/render/effects.js +0 -41
- package/build/src/cli/selectors.d.ts +0 -10
- package/build/src/cli/selectors.js +0 -42
- package/build/src/markdown/diff.d.ts +0 -1
- package/build/src/markdown/diff.js +0 -4
|
@@ -1,41 +1,20 @@
|
|
|
1
|
-
import { akumaCallerFromEnvironment } from "../akuma-caller.js";
|
|
2
1
|
import { CliUsageError, isBlankInput } from "../usage.js";
|
|
3
2
|
import { readFile } from "node:fs/promises";
|
|
4
|
-
import { resolve } from "node:path";
|
|
5
|
-
import { deliveryOwner } from "../delivery-identity.js";
|
|
6
|
-
import { canonicalBirthCwd } from "../../akuma/call-input.js";
|
|
7
3
|
import { Schema } from "../../akuma/index.js";
|
|
8
|
-
import {
|
|
9
|
-
import { Akumas, AkumaWorldScopeError, } from "../../index.js";
|
|
10
|
-
import { Keiyaku } from "../../index.js";
|
|
11
|
-
import { World } from "../../world.js";
|
|
12
|
-
import { contractFromInput } from "../selectors.js";
|
|
4
|
+
import { classifyVerb } from "../../library/keiyaku-verbs.js";
|
|
13
5
|
import { ActivityDriver } from "../activity.js";
|
|
14
6
|
import { displayContext, emit, resultContext, writeJson, writeStderr, writeStdout, } from "../streams.js";
|
|
15
|
-
import { callObservationStream } from "../render/akuma-activity.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { askOutcome, askProgressStream, callOutcome, callObservationHead, forkOutcome, historyOutcome, killOutcome, renderCallText, renderFailedCallObservation, renderForkText, renderKillText, tellOutcome, } from "../render/akuma.js";
|
|
7
|
+
import { askRawAnswer, callObservationStream, callRawAnswer, historyRawAnswer } from "../render/akuma-activity.js";
|
|
8
|
+
import { askProgressStream, callObservationHead, renderFailedCallObservation } from "../render/akuma.js";
|
|
9
|
+
import { renderVerb } from "../render/verbs.js";
|
|
19
10
|
export { isParsedAkumaCommand, renderAkumaHelp } from "./akuma-grammar.js";
|
|
20
|
-
// ---------------------------------------------------------------------------
|
|
21
|
-
// Leaf dispatch: acquisition, one public SDK invocation, direct rendering
|
|
22
|
-
// ---------------------------------------------------------------------------
|
|
23
|
-
async function settingsAt(root, home) {
|
|
24
|
-
return settings({
|
|
25
|
-
...(root === undefined ? {} : { root }),
|
|
26
|
-
...(home === undefined ? {} : { home }),
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
function akumas(input) {
|
|
30
|
-
return Akumas.of(input.path, { reportDiagnostic: writeStderr });
|
|
31
|
-
}
|
|
32
11
|
async function schemaFromFile(path) {
|
|
33
12
|
try {
|
|
34
13
|
const parsed = JSON.parse(await readFile(path, "utf8"));
|
|
35
14
|
return Schema.json(parsed, (value) => value);
|
|
36
15
|
}
|
|
37
16
|
catch (error) {
|
|
38
|
-
throw new
|
|
17
|
+
throw new CliUsageError(`cannot read JSON Schema file ${path}: ${error instanceof Error ? error.message : String(error)}`);
|
|
39
18
|
}
|
|
40
19
|
}
|
|
41
20
|
function inputAlias(selector) {
|
|
@@ -44,302 +23,187 @@ function inputAlias(selector) {
|
|
|
44
23
|
async function promptBody(action, command, input) {
|
|
45
24
|
if (command.prompt.kind !== "stdin")
|
|
46
25
|
return command.prompt.value;
|
|
47
|
-
const bytes = await input.readStdin();
|
|
26
|
+
const bytes = await input.runtime.readStdin();
|
|
48
27
|
if (isBlankInput(bytes))
|
|
49
28
|
throw new CliUsageError(`${action} requires a nonblank prompt`);
|
|
50
29
|
return bytes;
|
|
51
30
|
}
|
|
52
|
-
function inputInitiator(input) {
|
|
53
|
-
const initiator = deliveryOwner(input.environment);
|
|
54
|
-
return initiator === undefined ? {} : { initiator };
|
|
55
|
-
}
|
|
56
31
|
function emitAnswer(body, exact) {
|
|
57
32
|
if (exact)
|
|
58
33
|
process.stdout.write(body);
|
|
59
34
|
else
|
|
60
35
|
writeStdout(body);
|
|
61
36
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const caller = akumas(input);
|
|
69
|
-
const request = {
|
|
70
|
-
...(await inputInitiator(input)),
|
|
71
|
-
...(declaredCaller === undefined ? {} : { caller: declaredCaller }),
|
|
72
|
-
archetype: command.archetype,
|
|
73
|
-
...(body === undefined ? {} : { body }),
|
|
74
|
-
...(input.home === undefined ? {} : { home: input.home }),
|
|
75
|
-
...(input.settings === undefined ? {} : { settings: input.settings }),
|
|
76
|
-
...(input.executionCwd === undefined ? {} : { cwd: input.executionCwd }),
|
|
77
|
-
...(input.contract === undefined ? {} : { contract: input.contract }),
|
|
37
|
+
function spawnWire(command, input, body, schema) {
|
|
38
|
+
return {
|
|
39
|
+
akumaName: command.akumaName,
|
|
40
|
+
...(body === undefined ? {} : { prompt: body }),
|
|
41
|
+
...(command.contract === undefined ? {} : { contract: command.contract }),
|
|
42
|
+
...(input.workdir === undefined ? {} : { workdir: input.workdir }),
|
|
78
43
|
...(command.alias === undefined ? {} : { alias: command.alias }),
|
|
79
|
-
...(
|
|
44
|
+
...(command.writableDirectories === undefined ? {} : { writableDirectories: command.writableDirectories }),
|
|
80
45
|
...(command.bare === undefined ? {} : { bare: command.bare }),
|
|
81
|
-
...(schema === undefined ? {} : { schema }),
|
|
82
|
-
|
|
46
|
+
...(schema === undefined ? {} : { schema: schema.jsonSchema }),
|
|
47
|
+
mode: command.mode,
|
|
48
|
+
...(command.timeoutMs === undefined ? {} : { timeoutMs: command.timeoutMs }),
|
|
83
49
|
};
|
|
50
|
+
}
|
|
51
|
+
async function runSpawn(command, input) {
|
|
52
|
+
const body = command.prompt === undefined ? undefined : await promptBody("spawn", { prompt: command.prompt }, input);
|
|
53
|
+
const schema = command.schema === undefined ? undefined : await schemaFromFile(command.schema);
|
|
54
|
+
const wire = spawnWire(command, input, body, schema);
|
|
84
55
|
let stream;
|
|
85
56
|
const driver = new ActivityDriver(process.stderr);
|
|
86
57
|
const observing = command.mode === "wait" && command.output === "text";
|
|
87
58
|
const observe = observing
|
|
88
|
-
? {
|
|
89
|
-
|
|
90
|
-
stream = callObservationStream(resultContext(), callObservationHead({
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
...(input.executionCwd === undefined ? {} : { cwd: input.executionCwd }),
|
|
94
|
-
}), { admittedAt: tell.row.at });
|
|
59
|
+
? (event) => {
|
|
60
|
+
if (event.kind === "admitted") {
|
|
61
|
+
stream = callObservationStream(resultContext(), callObservationHead({ akumaId: event.id, ...event.head }), {
|
|
62
|
+
admittedAt: event.tell.row.at,
|
|
63
|
+
});
|
|
95
64
|
driver.redraw(stream.frame());
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
driver.settle(stream?.observe(observation) ?? [], stream?.frame() ?? []);
|
|
99
|
-
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
driver.settle(stream?.observe(event.observation) ?? [], stream?.frame() ?? []);
|
|
68
|
+
}
|
|
100
69
|
}
|
|
101
70
|
: undefined;
|
|
102
71
|
try {
|
|
103
|
-
const result = await
|
|
104
|
-
|
|
105
|
-
mode: command.mode,
|
|
106
|
-
...(command.timeoutMs === undefined ? {} : { timeoutMs: command.timeoutMs }),
|
|
72
|
+
const result = await input.runtime.facet.run("spawn", wire, {
|
|
73
|
+
signal: input.runtime.signal,
|
|
107
74
|
...(observe === undefined ? {} : { observe }),
|
|
75
|
+
...(schema === undefined ? {} : { decode: schema.decode }),
|
|
108
76
|
});
|
|
109
77
|
let streamed = stream !== undefined;
|
|
110
|
-
if (stream !== undefined)
|
|
111
|
-
driver.conclude(stream.conclude(result
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
writeStderr(renderFailedCallObservation(result, resultContext()));
|
|
78
|
+
if (stream !== undefined)
|
|
79
|
+
driver.conclude(stream.conclude(result));
|
|
80
|
+
else if (observing && result.failure !== undefined) {
|
|
81
|
+
writeStderr(renderFailedCallObservation(result, resultContext(), body === undefined ? {} : { prompt: body }));
|
|
115
82
|
streamed = true;
|
|
116
83
|
}
|
|
84
|
+
const completion = { kind: "returned", value: result };
|
|
117
85
|
if (command.output === "json")
|
|
118
86
|
writeJson(result);
|
|
87
|
+
else if (streamed)
|
|
88
|
+
emitAnswer(callRawAnswer(result, schema !== undefined, true) ?? "", callRawAnswer(result, schema !== undefined, true) !== undefined);
|
|
119
89
|
else {
|
|
120
|
-
const raw = callRawAnswer(result,
|
|
121
|
-
|
|
122
|
-
emitAnswer(renderCallText(result, streamed, displayContext()), false);
|
|
123
|
-
else
|
|
124
|
-
emitAnswer(raw, true);
|
|
90
|
+
const raw = callRawAnswer(result, schema !== undefined, false);
|
|
91
|
+
emitAnswer(renderVerb("spawn", wire, completion, displayContext()), raw !== undefined);
|
|
125
92
|
}
|
|
126
|
-
return
|
|
93
|
+
return classifyVerb("spawn", wire, completion);
|
|
127
94
|
}
|
|
128
95
|
finally {
|
|
129
96
|
driver.close(stream?.flush() ?? []);
|
|
130
97
|
}
|
|
131
98
|
}
|
|
132
99
|
async function runWait(command, input) {
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
akuma: command.akuma,
|
|
136
|
-
...(input.repo === undefined ? {} : { repo: input.repo }),
|
|
100
|
+
const wire = {
|
|
101
|
+
selectors: command.akuma,
|
|
137
102
|
...(command.completion === undefined ? {} : { completion: command.completion }),
|
|
138
103
|
...(command.timeoutMs === undefined ? {} : { timeoutMs: command.timeoutMs }),
|
|
139
|
-
|
|
140
|
-
});
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
writeJson(result);
|
|
144
|
-
else
|
|
145
|
-
emitAnswer(waitText(result, { ...(alias === undefined ? {} : { alias }) }, displayContext()), false);
|
|
146
|
-
return outcome;
|
|
104
|
+
};
|
|
105
|
+
const result = await input.runtime.facet.run("wait", wire, { signal: input.runtime.signal });
|
|
106
|
+
const completion = { kind: "returned", value: result };
|
|
107
|
+
return emit(command.output, result, () => renderVerb("wait", wire, completion, displayContext()), classifyVerb("wait", wire, completion));
|
|
147
108
|
}
|
|
148
109
|
async function runTell(command, input) {
|
|
149
|
-
const
|
|
150
|
-
const result = await akumas(input).tell({
|
|
151
|
-
...(await inputInitiator(input)),
|
|
110
|
+
const wire = {
|
|
152
111
|
akuma: command.akuma,
|
|
153
|
-
|
|
112
|
+
prompt: await promptBody("tell", command, input),
|
|
154
113
|
...(command.interrupt ? { interrupt: true } : {}),
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return emit(command.output, result, text, tellOutcome(result));
|
|
114
|
+
};
|
|
115
|
+
const result = await input.runtime.facet.run("tell", wire, { signal: input.runtime.signal });
|
|
116
|
+
const completion = { kind: "returned", value: result };
|
|
117
|
+
return emit(command.output, result, () => renderVerb("tell", wire, completion, displayContext()), classifyVerb("tell", wire, completion));
|
|
160
118
|
}
|
|
161
119
|
async function runAsk(command, input) {
|
|
162
120
|
const body = await promptBody("ask", command, input);
|
|
163
121
|
const schema = command.schema === undefined ? undefined : await schemaFromFile(command.schema);
|
|
164
|
-
const
|
|
165
|
-
|
|
122
|
+
const wire = {
|
|
123
|
+
akuma: command.akuma,
|
|
124
|
+
prompt: body,
|
|
125
|
+
...(command.timeoutMs === undefined ? {} : { timeoutMs: command.timeoutMs }),
|
|
126
|
+
...(schema === undefined ? {} : { schema: schema.jsonSchema }),
|
|
127
|
+
...(command.interrupt ? { interrupt: true } : {}),
|
|
128
|
+
};
|
|
129
|
+
const progress = command.output === "text" ? askProgressStream(undefined, inputAlias(command.akuma), resultContext()) : undefined;
|
|
166
130
|
const driver = new ActivityDriver(process.stderr);
|
|
131
|
+
const observe = progress === undefined
|
|
132
|
+
? undefined
|
|
133
|
+
: (event) => {
|
|
134
|
+
if (event.kind === "admitted")
|
|
135
|
+
driver.settle(progress.admitted(event.tell, event.id), progress.frame());
|
|
136
|
+
else
|
|
137
|
+
driver.settle(progress.observe(event.observation), progress.frame());
|
|
138
|
+
};
|
|
167
139
|
try {
|
|
168
|
-
const result = await
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
...(command.timeoutMs === undefined ? {} : { timeoutMs: command.timeoutMs }),
|
|
173
|
-
...(schema === undefined ? {} : { schema }),
|
|
174
|
-
...(command.interrupt ? { interrupt: true } : {}),
|
|
175
|
-
...(input.repo === undefined ? {} : { repo: input.repo }),
|
|
176
|
-
...(input.signal === undefined ? {} : { signal: input.signal }),
|
|
177
|
-
...(progress === undefined
|
|
178
|
-
? {}
|
|
179
|
-
: {
|
|
180
|
-
observe: {
|
|
181
|
-
admitted: (tell, id) => {
|
|
182
|
-
driver.settle(progress.admitted(tell, id), progress.frame());
|
|
183
|
-
},
|
|
184
|
-
observe: (observation) => {
|
|
185
|
-
driver.settle(progress.observe(observation), progress.frame());
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
}),
|
|
140
|
+
const result = await input.runtime.facet.run("ask", wire, {
|
|
141
|
+
signal: input.runtime.signal,
|
|
142
|
+
...(observe === undefined ? {} : { observe }),
|
|
143
|
+
...(schema === undefined ? {} : { decode: schema.decode }),
|
|
189
144
|
});
|
|
190
145
|
if (progress !== undefined)
|
|
191
146
|
driver.conclude(progress.conclude(result).join("\n"));
|
|
147
|
+
const completion = { kind: "returned", value: result };
|
|
192
148
|
if (command.output === "json")
|
|
193
149
|
writeJson(result);
|
|
194
150
|
else
|
|
195
151
|
emitAnswer(askRawAnswer(result, schema !== undefined) ?? "", true);
|
|
196
|
-
return
|
|
152
|
+
return classifyVerb("ask", wire, completion);
|
|
197
153
|
}
|
|
198
154
|
finally {
|
|
199
155
|
driver.close(progress?.flush() ?? []);
|
|
200
156
|
}
|
|
201
157
|
}
|
|
202
158
|
async function runHistory(command, input) {
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
...(input.repo === undefined ? {} : { repo: input.repo }),
|
|
159
|
+
const wire = {
|
|
160
|
+
selector: command.akuma,
|
|
206
161
|
...(command.before === undefined ? {} : { before: command.before }),
|
|
207
162
|
...(command.since === undefined ? {} : { since: command.since }),
|
|
208
163
|
...(command.limit === undefined ? {} : { limit: command.limit }),
|
|
209
164
|
...(command.id === undefined ? {} : { id: command.id }),
|
|
210
165
|
last: command.last,
|
|
211
|
-
}
|
|
212
|
-
|
|
166
|
+
};
|
|
167
|
+
const result = await input.runtime.facet.run("history", wire, { signal: input.runtime.signal });
|
|
168
|
+
if (result.kind === "contract" || result.kind === "contract-missing")
|
|
169
|
+
throw new Error("Akuma history returned a non-Akuma result");
|
|
170
|
+
const completion = { kind: "returned", value: result };
|
|
171
|
+
if (command.output === "json")
|
|
213
172
|
writeJson(result);
|
|
214
|
-
|
|
173
|
+
else {
|
|
174
|
+
const raw = historyRawAnswer(result, command.id) !== undefined || (command.last && result.kind === "akuma-last");
|
|
175
|
+
emitAnswer(renderVerb("history", wire, completion, displayContext()), raw);
|
|
215
176
|
}
|
|
216
|
-
|
|
217
|
-
const presentation = {
|
|
218
|
-
...(inputAlias(command.akuma) === undefined ? {} : { alias: command.akuma }),
|
|
219
|
-
...(command.id === undefined ? {} : { id: command.id }),
|
|
220
|
-
last: command.last,
|
|
221
|
-
};
|
|
222
|
-
if (raw !== undefined)
|
|
223
|
-
emitAnswer(raw, true);
|
|
224
|
-
else if (command.last && result.kind === "last")
|
|
225
|
-
emitAnswer(result.answer, true);
|
|
226
|
-
else
|
|
227
|
-
emitAnswer(historyText(result, presentation, displayContext()), false);
|
|
228
|
-
return historyOutcome(result, command.id);
|
|
177
|
+
return classifyVerb("history", wire, completion);
|
|
229
178
|
}
|
|
230
179
|
async function runFork(command, input) {
|
|
231
|
-
const
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
akuma: command.akuma,
|
|
236
|
-
at: command.at,
|
|
237
|
-
...(command.bare === undefined ? {} : { bare: command.bare }),
|
|
238
|
-
...(input.repo === undefined ? {} : { repo: input.repo }),
|
|
239
|
-
});
|
|
240
|
-
return emit(command.output, receipt, () => renderForkText(receipt), forkOutcome(receipt));
|
|
180
|
+
const wire = { akuma: command.akuma, at: command.at, ...(command.bare === undefined ? {} : { bare: command.bare }) };
|
|
181
|
+
const result = await input.runtime.facet.run("fork", wire, { signal: input.runtime.signal });
|
|
182
|
+
const completion = { kind: "returned", value: result };
|
|
183
|
+
return emit(command.output, result, () => renderVerb("fork", wire, completion, displayContext()), classifyVerb("fork", wire, completion));
|
|
241
184
|
}
|
|
242
185
|
async function runKill(command, input) {
|
|
243
|
-
const
|
|
244
|
-
const result = await
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
:
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
return cwd;
|
|
266
|
-
}
|
|
267
|
-
async function akumaInput(command, coordinates, workdir, runtime) {
|
|
268
|
-
const path = await akumaWorld(command, coordinates);
|
|
269
|
-
const executionCwd = await callExecutionCwd(command, coordinates.cwd, workdir);
|
|
270
|
-
const writableDirectories = command.command !== "call" || command.writableDirectories === undefined
|
|
271
|
-
? undefined
|
|
272
|
-
: await Promise.all(command.writableDirectories.map((path) => {
|
|
273
|
-
if (path.trim() === "")
|
|
274
|
-
throw new TypeError("--add-dir requires a nonblank directory");
|
|
275
|
-
return canonicalBirthCwd(resolve(coordinates.cwd, path));
|
|
276
|
-
}));
|
|
277
|
-
const home = command.command === "call" ? runtime.home : undefined;
|
|
278
|
-
const configuration = command.command === "call" ? await settingsAt(path, home) : undefined;
|
|
279
|
-
if (command.command === "call" && command.contract !== undefined && coordinates.repo === undefined)
|
|
280
|
-
throw new Error("call with Contract requires a resolved Repo");
|
|
281
|
-
const contract = command.command === "call" && command.contract !== undefined
|
|
282
|
-
? contractFromInput(coordinates.repo, command.contract).contract
|
|
283
|
-
: undefined;
|
|
284
|
-
return {
|
|
285
|
-
path,
|
|
286
|
-
...(executionCwd === undefined ? {} : { executionCwd }),
|
|
287
|
-
...(writableDirectories === undefined ? {} : { writableDirectories }),
|
|
288
|
-
...(home === undefined ? {} : { home }),
|
|
289
|
-
...(configuration === undefined ? {} : { settings: configuration }),
|
|
290
|
-
...(contract === undefined ? {} : { contract }),
|
|
291
|
-
...(coordinates.repo === undefined ? {} : { repo: coordinates.repo }),
|
|
292
|
-
environment: runtime.environment,
|
|
293
|
-
readStdin: runtime.readStdin,
|
|
294
|
-
...(runtime.signal === undefined ? {} : { signal: runtime.signal }),
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
export async function runAkumaCommand(command, coordinates, workdir, runtime) {
|
|
298
|
-
try {
|
|
299
|
-
if (command.command === "wait") {
|
|
300
|
-
const contracts = command.akuma.filter((selector) => selector.startsWith("kei/"));
|
|
301
|
-
if (contracts.length > 0) {
|
|
302
|
-
if (coordinates.repo === undefined)
|
|
303
|
-
throw new CliUsageError("Contract wait requires a repository");
|
|
304
|
-
const result = await Keiyaku.with().wait({
|
|
305
|
-
repo: coordinates.repo,
|
|
306
|
-
contracts,
|
|
307
|
-
...(command.completion === undefined ? {} : { completion: command.completion }),
|
|
308
|
-
...(command.timeoutMs === undefined ? {} : { timeoutMs: command.timeoutMs }),
|
|
309
|
-
...(runtime.signal === undefined ? {} : { signal: runtime.signal }),
|
|
310
|
-
});
|
|
311
|
-
if (command.output === "json")
|
|
312
|
-
writeJson(result);
|
|
313
|
-
else
|
|
314
|
-
writeStdout(contractWaitText(result));
|
|
315
|
-
return result.kind === "missing" ? "refused" : "accepted";
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
const input = await akumaInput(command, coordinates, workdir, runtime);
|
|
319
|
-
switch (command.command) {
|
|
320
|
-
case "call":
|
|
321
|
-
return await runCall(command, input);
|
|
322
|
-
case "wait":
|
|
323
|
-
return await runWait(command, input);
|
|
324
|
-
case "tell":
|
|
325
|
-
return await runTell(command, input);
|
|
326
|
-
case "ask":
|
|
327
|
-
return await runAsk(command, input);
|
|
328
|
-
case "history":
|
|
329
|
-
return await runHistory(command, input);
|
|
330
|
-
case "fork":
|
|
331
|
-
return await runFork(command, input);
|
|
332
|
-
case "kill":
|
|
333
|
-
return await runKill(command, input);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
catch (error) {
|
|
337
|
-
if (error instanceof Error && "executionReceipt" in error)
|
|
338
|
-
throw error;
|
|
339
|
-
if (error instanceof AkumaWorldScopeError)
|
|
340
|
-
throw error;
|
|
341
|
-
if (error instanceof TypeError)
|
|
342
|
-
throw new CliUsageError(error.message);
|
|
343
|
-
throw error;
|
|
186
|
+
const wire = { akuma: command.akuma };
|
|
187
|
+
const result = await input.runtime.facet.run("kill", wire, { signal: input.runtime.signal });
|
|
188
|
+
const completion = { kind: "returned", value: result };
|
|
189
|
+
return emit(command.output, result, () => renderVerb("kill", wire, completion, displayContext()), classifyVerb("kill", wire, completion));
|
|
190
|
+
}
|
|
191
|
+
export async function runAkumaCommand(command, workdir, runtime) {
|
|
192
|
+
const input = { ...(workdir === undefined ? {} : { workdir }), runtime };
|
|
193
|
+
switch (command.command) {
|
|
194
|
+
case "spawn":
|
|
195
|
+
return runSpawn(command, input);
|
|
196
|
+
case "wait":
|
|
197
|
+
return runWait(command, input);
|
|
198
|
+
case "tell":
|
|
199
|
+
return runTell(command, input);
|
|
200
|
+
case "ask":
|
|
201
|
+
return runAsk(command, input);
|
|
202
|
+
case "history":
|
|
203
|
+
return runHistory(command, input);
|
|
204
|
+
case "fork":
|
|
205
|
+
return runFork(command, input);
|
|
206
|
+
case "kill":
|
|
207
|
+
return runKill(command, input);
|
|
344
208
|
}
|
|
345
209
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AkumaCaller } from "../../akuma/caller.js";
|
|
2
|
-
import { type
|
|
2
|
+
import { type AkumaId } from "../../akuma/identity.js";
|
|
3
3
|
import { type ContractCommand } from "./contract-help.js";
|
|
4
4
|
type AkumaCallerSelector = Readonly<{
|
|
5
5
|
kind: "mine";
|
|
@@ -8,12 +8,13 @@ type AkumaCallerSelector = Readonly<{
|
|
|
8
8
|
caller: AkumaCaller;
|
|
9
9
|
}> | Readonly<{
|
|
10
10
|
kind: "akuma";
|
|
11
|
-
|
|
11
|
+
akumaId: AkumaId;
|
|
12
12
|
}>;
|
|
13
13
|
type CatalogQuery = Readonly<{
|
|
14
14
|
kind: "debts";
|
|
15
15
|
namespace?: readonly string[];
|
|
16
16
|
limit?: number;
|
|
17
|
+
selection?: "closed" | "all";
|
|
17
18
|
}> | Readonly<{
|
|
18
19
|
kind: "contracts";
|
|
19
20
|
limit?: number;
|
|
@@ -22,7 +23,7 @@ type CatalogQuery = Readonly<{
|
|
|
22
23
|
limit?: number;
|
|
23
24
|
}> | Readonly<{
|
|
24
25
|
kind: "akuma";
|
|
25
|
-
|
|
26
|
+
akumaName?: string;
|
|
26
27
|
caller?: AkumaCallerSelector;
|
|
27
28
|
limit?: number;
|
|
28
29
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { validateAkumaName } from "../../identity/normalize.js";
|
|
2
2
|
import { decodeAkumaCaller } from "../../akuma/caller.js";
|
|
3
|
-
import {
|
|
3
|
+
import { parseAkumaId } from "../../akuma/identity.js";
|
|
4
4
|
import { parseDebtNamespaceSelector } from "../../debt/catalog.js";
|
|
5
5
|
import { CliUsageError, commandGuide } from "../usage.js";
|
|
6
6
|
import { CONTRACT_COMMAND_SPECS } from "./contract-help.js";
|
|
@@ -11,11 +11,11 @@ function parseAkumaCatalogPath(value) {
|
|
|
11
11
|
return { kind: "akuma" };
|
|
12
12
|
const scopedGlob = /^aku\/([^/]+)\/\*$/u.exec(value);
|
|
13
13
|
if (scopedGlob !== null)
|
|
14
|
-
return { kind: "akuma",
|
|
14
|
+
return { kind: "akuma", akumaName: validateAkumaName(scopedGlob[1]) };
|
|
15
15
|
const match = /^aku\/([^/]+)\/?$/u.exec(value);
|
|
16
16
|
if (match === null)
|
|
17
17
|
return null;
|
|
18
|
-
return { kind: "akuma",
|
|
18
|
+
return { kind: "akuma", akumaName: validateAkumaName(match[1]) };
|
|
19
19
|
}
|
|
20
20
|
function optionalFlag(flags, name) {
|
|
21
21
|
const value = flags[name];
|
|
@@ -258,7 +258,7 @@ function parseCallerSelector(parts) {
|
|
|
258
258
|
const text = value.trim();
|
|
259
259
|
if (text.startsWith("aku/")) {
|
|
260
260
|
try {
|
|
261
|
-
return { kind: "akuma",
|
|
261
|
+
return { kind: "akuma", akumaId: parseAkumaId(text).id };
|
|
262
262
|
}
|
|
263
263
|
catch (error) {
|
|
264
264
|
refuse("ls", `--caller has an invalid Akuma identity: ${error instanceof Error ? error.message : text}`);
|
|
@@ -281,18 +281,49 @@ function parseCallerSelector(parts) {
|
|
|
281
281
|
refuse("ls", `--caller is invalid: ${error instanceof Error ? error.message : String(error)}`);
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
|
+
function parseAkumaLs(parts, path, limit, caller) {
|
|
285
|
+
if (path === undefined && caller === undefined)
|
|
286
|
+
refuse("ls", "ls requires a selector");
|
|
287
|
+
try {
|
|
288
|
+
const query = path === undefined ? { kind: "akuma" } : parseAkumaCatalogPath(path);
|
|
289
|
+
if (query === null)
|
|
290
|
+
refuse("ls", "ls requires a supported identity directory selector");
|
|
291
|
+
return {
|
|
292
|
+
command: "ls",
|
|
293
|
+
query: { ...query, ...(limit === undefined ? {} : { limit }), ...(caller === undefined ? {} : { caller }) },
|
|
294
|
+
output: parts.output,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
catch (error) {
|
|
298
|
+
if (error instanceof CliUsageError)
|
|
299
|
+
throw error;
|
|
300
|
+
refuse("ls", error instanceof Error ? error.message : "invalid ls directory");
|
|
301
|
+
}
|
|
302
|
+
}
|
|
284
303
|
function parseLs(parts) {
|
|
285
304
|
const path = parts.positionals[0];
|
|
286
305
|
const limit = listLimit(parts);
|
|
287
306
|
const caller = parseCallerSelector(parts);
|
|
288
307
|
const callerRefusal = "--mine and --caller select Akuma instances only";
|
|
308
|
+
const all = parts.flags.all === true, closed = parts.flags.closed === true;
|
|
309
|
+
if (all && closed)
|
|
310
|
+
refuse("ls", "--all and --closed are mutually exclusive");
|
|
289
311
|
if (path !== undefined) {
|
|
290
312
|
const debtQuery = debtCatalogQuery(path, limit);
|
|
291
313
|
if (debtQuery !== null) {
|
|
292
314
|
if (caller !== undefined)
|
|
293
315
|
refuse("ls", callerRefusal);
|
|
294
|
-
return {
|
|
316
|
+
return {
|
|
317
|
+
command: "ls",
|
|
318
|
+
query: {
|
|
319
|
+
...debtQuery,
|
|
320
|
+
...(all ? { selection: "all" } : closed ? { selection: "closed" } : {}),
|
|
321
|
+
},
|
|
322
|
+
output: parts.output,
|
|
323
|
+
};
|
|
295
324
|
}
|
|
325
|
+
if (all || closed)
|
|
326
|
+
refuse("ls", "--all and --closed select Debts only");
|
|
296
327
|
if (path === "kei" || path === "kei/") {
|
|
297
328
|
if (caller !== undefined)
|
|
298
329
|
refuse("ls", callerRefusal);
|
|
@@ -305,23 +336,9 @@ function parseLs(parts) {
|
|
|
305
336
|
if (caller !== undefined && (path === "aku" || path === "aku/"))
|
|
306
337
|
refuse("ls", "--mine and --caller need an Akuma instance catalogue, not Akuma names");
|
|
307
338
|
}
|
|
308
|
-
if (
|
|
309
|
-
refuse("ls", "
|
|
310
|
-
|
|
311
|
-
const query = path === undefined ? { kind: "akuma" } : parseAkumaCatalogPath(path);
|
|
312
|
-
if (query === null)
|
|
313
|
-
refuse("ls", "ls requires a supported identity directory selector");
|
|
314
|
-
return {
|
|
315
|
-
command: "ls",
|
|
316
|
-
query: { ...query, ...(limit === undefined ? {} : { limit }), ...(caller === undefined ? {} : { caller }) },
|
|
317
|
-
output: parts.output,
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
catch (error) {
|
|
321
|
-
if (error instanceof CliUsageError)
|
|
322
|
-
throw error;
|
|
323
|
-
refuse("ls", error instanceof Error ? error.message : "invalid ls directory");
|
|
324
|
-
}
|
|
339
|
+
if (all || closed)
|
|
340
|
+
refuse("ls", "--all and --closed select Debts only");
|
|
341
|
+
return parseAkumaLs(parts, path, limit, caller);
|
|
325
342
|
}
|
|
326
343
|
export function parseContractCommand(parts) {
|
|
327
344
|
switch (parts.command) {
|
|
@@ -132,8 +132,10 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
132
132
|
readonly json: "boolean";
|
|
133
133
|
readonly mine: "boolean";
|
|
134
134
|
readonly caller: "value";
|
|
135
|
+
readonly closed: "boolean";
|
|
136
|
+
readonly all: "boolean";
|
|
135
137
|
};
|
|
136
|
-
readonly usage: "ls debt[/] [--limit <count>]\nls debt/<namespace>/ [--limit <count>]\nls kei[/] [--limit <count>]\nls aku[/] [--limit <count>]\nls aku/<name>[/] [--limit <count>]\nls \"aku/<name>/*\" [--limit <count>]\nls \"aku/*/*\" [--limit <count>]\nls [aku/<name>[/] | \"aku/<name>/*\" | \"aku/*/*\"] (--mine | --caller (<integration>:<id> | aku/<name>/<suffix>)) [--limit <count>]";
|
|
138
|
+
readonly usage: "ls debt[/] [--closed | --all] [--limit <count>]\nls debt/<namespace>/ [--closed | --all] [--limit <count>]\nls kei[/] [--limit <count>]\nls aku[/] [--limit <count>]\nls aku/<name>[/] [--limit <count>]\nls \"aku/<name>/*\" [--limit <count>]\nls \"aku/*/*\" [--limit <count>]\nls [aku/<name>[/] | \"aku/<name>/*\" | \"aku/*/*\"] (--mine | --caller (<integration>:<id> | aku/<name>/<suffix>)) [--limit <count>]";
|
|
137
139
|
readonly purpose: "List debts (ls debt), contracts (ls kei), or akumas (ls aku).";
|
|
138
140
|
readonly details: string;
|
|
139
141
|
};
|
|
@@ -218,12 +218,13 @@ export const CONTRACT_COMMAND_SPECS = {
|
|
|
218
218
|
ls: {
|
|
219
219
|
positional: "optional",
|
|
220
220
|
stdin: "none",
|
|
221
|
-
flags: { limit: "value", json: "boolean", mine: "boolean", caller: "value" },
|
|
222
|
-
usage: 'ls debt[/] [--limit <count>]\nls debt/<namespace>/ [--limit <count>]\nls kei[/] [--limit <count>]\nls aku[/] [--limit <count>]\nls aku/<name>[/] [--limit <count>]\nls "aku/<name>/*" [--limit <count>]\nls "aku/*/*" [--limit <count>]\nls [aku/<name>[/] | "aku/<name>/*" | "aku/*/*"] (--mine | --caller (<integration>:<id> | aku/<name>/<suffix>)) [--limit <count>]',
|
|
221
|
+
flags: { limit: "value", json: "boolean", mine: "boolean", caller: "value", closed: "boolean", all: "boolean" },
|
|
222
|
+
usage: 'ls debt[/] [--closed | --all] [--limit <count>]\nls debt/<namespace>/ [--closed | --all] [--limit <count>]\nls kei[/] [--limit <count>]\nls aku[/] [--limit <count>]\nls aku/<name>[/] [--limit <count>]\nls "aku/<name>/*" [--limit <count>]\nls "aku/*/*" [--limit <count>]\nls [aku/<name>[/] | "aku/<name>/*" | "aku/*/*"] (--mine | --caller (<integration>:<id> | aku/<name>/<suffix>)) [--limit <count>]',
|
|
223
223
|
purpose: "List debts (ls debt), contracts (ls kei), or akumas (ls aku).",
|
|
224
224
|
details: [
|
|
225
|
+
"Debt lists open work by default; --closed selects terminal work and --all selects both.",
|
|
225
226
|
"ls kei lists active Contracts; accepted and abandoned ones leave the list, and their record stays in history and Git.",
|
|
226
|
-
"ls aku/ lists the
|
|
227
|
+
"ls aku/ lists the spawnable Akuma-name catalog; ls aku/<name> lists recent retained Akuma instances under one name.",
|
|
227
228
|
'ls "aku/<name>/*" is the same roster in glob form; ls "aku/*/*" lists recent retained Akuma instances across names.',
|
|
228
229
|
"--mine selects the caller identity of this process and lists that caller's direct and transitive descendants in this World.",
|
|
229
230
|
"--caller selects an explicit caller instead; both selectors are World-local and refuse for Contract, Debt, or Akuma-name catalogues.",
|