@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,122 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { renderWhoami } from "../render/whoami.js";
|
|
10
|
-
import { emit } from "../streams.js";
|
|
11
|
-
function reason(error) {
|
|
12
|
-
return error instanceof Error ? error.message : String(error);
|
|
13
|
-
}
|
|
14
|
-
async function selfFrom(environment) {
|
|
15
|
-
try {
|
|
16
|
-
return (await akumaCallerFromEnvironment(environment)) ?? { kind: "none" };
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
return { kind: "invalid", reason: reason(error) };
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
async function contextualContract(coordinates, world) {
|
|
23
|
-
if (world === null || coordinates.repo === undefined)
|
|
24
|
-
return { kind: "none" };
|
|
25
|
-
try {
|
|
26
|
-
const result = await Keiyaku.with().resolve({ repo: coordinates.repo, cwd: coordinates.cwd });
|
|
27
|
-
if (result.kind === "resolved")
|
|
28
|
-
return result;
|
|
29
|
-
return { kind: result.refusal.kind === "ambiguous-selector" ? "ambiguous" : "none" };
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
return { kind: "unavailable", reason: reason(error) };
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
async function callerRepo(world, coordinates, environment) {
|
|
36
|
-
if (coordinates.repo?.root === world)
|
|
37
|
-
return coordinates.repo;
|
|
38
|
-
try {
|
|
39
|
-
const repo = await Repo.at({
|
|
40
|
-
path: world,
|
|
41
|
-
...(environment.KEIYAKU_GIT_PATH === undefined ? {} : { gitPath: environment.KEIYAKU_GIT_PATH }),
|
|
42
|
-
});
|
|
43
|
-
return repo.root === world ? repo : undefined;
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
if (error instanceof NoGitWorldError)
|
|
47
|
-
return undefined;
|
|
48
|
-
throw error;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async function currentTurn(self) {
|
|
52
|
-
let bornAt = null;
|
|
53
|
-
try {
|
|
54
|
-
const paths = pathsForAkuId(self.world, self.akuId);
|
|
55
|
-
const heart = await readHeart(paths);
|
|
56
|
-
bornAt = heart.soul?.createdAt ?? null;
|
|
57
|
-
const body = heart.latestBody;
|
|
58
|
-
if (body === null || body.end !== undefined || body.hung !== undefined)
|
|
59
|
-
return { initiator: null, bornAt };
|
|
60
|
-
const turn = await readLatestTurnForBody(paths, body.sequence);
|
|
61
|
-
if (turn === null || turn.end !== undefined)
|
|
62
|
-
return { initiator: null, bornAt };
|
|
63
|
-
// Confirm that the Body was still current and open when this Turn was observed.
|
|
64
|
-
const latest = (await readHeart(paths)).latestBody;
|
|
65
|
-
const initiator = latest?.sequence === body.sequence && latest.end === undefined && latest.hung === undefined
|
|
66
|
-
? (turn.initiator ?? null)
|
|
67
|
-
: null;
|
|
68
|
-
return { initiator, bornAt };
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
return { initiator: null, bornAt, unavailable: reason(error) };
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
async function callerProfile(caller, coordinates, environment, bornAt) {
|
|
75
|
-
try {
|
|
76
|
-
if (!(await World.established(caller.world)))
|
|
77
|
-
throw new Error("caller World is not established");
|
|
78
|
-
const id = parseAkuId(caller.akuId);
|
|
79
|
-
// This is the same status owner as the public read, without its plugin outcome observer.
|
|
80
|
-
const [status, aliases, repo] = await Promise.all([
|
|
81
|
-
new AkumaOwner(id.id, caller.world).status(),
|
|
82
|
-
observeNamedAddress({ world: caller.world, repo: null }),
|
|
83
|
-
callerRepo(caller.world, coordinates, environment),
|
|
84
|
-
]);
|
|
85
|
-
if (aliases.aliases.kind !== "present") {
|
|
86
|
-
throw new Error(aliases.aliases.kind === "failed" ? aliases.aliases.failure.message : "aliases unavailable");
|
|
87
|
-
}
|
|
88
|
-
const dispatch = (await dispatchAssociations(repo, [id.id])).get(id.id);
|
|
89
|
-
if (dispatch.kind === "failed")
|
|
90
|
-
throw new Error(dispatch.diagnostic);
|
|
91
|
-
return {
|
|
92
|
-
kind: "available",
|
|
93
|
-
archetype: id.archetype,
|
|
94
|
-
aliases: aliases.aliases.value.filter((binding) => binding.akuId === id.id).map((binding) => binding.alias),
|
|
95
|
-
provider: status.provider ?? null,
|
|
96
|
-
model: status.model ?? null,
|
|
97
|
-
workdir: status.cwd ?? null,
|
|
98
|
-
birth: status.birth,
|
|
99
|
-
bornAt,
|
|
100
|
-
contracts: dispatch.kind === "associated" ? [dispatch.contractId] : [],
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
return { kind: "unavailable", reason: reason(error) };
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
export async function runWhoami(command, coordinates, environment) {
|
|
108
|
-
const world = coordinates.world !== null && (await World.established(coordinates.world)) ? coordinates.world : null;
|
|
109
|
-
const [self, contract] = await Promise.all([selfFrom(environment), contextualContract(coordinates, world)]);
|
|
110
|
-
const turn = self.kind === "akuma" ? await currentTurn(self) : undefined;
|
|
111
|
-
const facts = {
|
|
112
|
-
world,
|
|
113
|
-
self,
|
|
114
|
-
initiator: turn?.initiator ?? null,
|
|
115
|
-
...(turn?.unavailable === undefined ? {} : { initiatorUnavailable: turn.unavailable }),
|
|
116
|
-
contract,
|
|
117
|
-
...(self.kind === "akuma"
|
|
118
|
-
? { profile: await callerProfile(self, coordinates, environment, turn?.bornAt ?? null) }
|
|
119
|
-
: {}),
|
|
120
|
-
};
|
|
121
|
-
return emit(command.output, facts, () => renderWhoami(facts), "accepted");
|
|
1
|
+
import { classifyVerb } from "../../library/keiyaku-verbs.js";
|
|
2
|
+
import { renderVerb } from "../render/verbs.js";
|
|
3
|
+
import { displayContext, emit } from "../streams.js";
|
|
4
|
+
export async function runWhoami(command, runtime) {
|
|
5
|
+
const wire = {};
|
|
6
|
+
const facts = await runtime.facet.run("whoami", wire, { signal: runtime.signal });
|
|
7
|
+
const completion = { kind: "returned", value: facts };
|
|
8
|
+
return emit(command.output, facts, () => renderVerb("whoami", wire, completion, displayContext()), classifyVerb("whoami", wire, completion));
|
|
122
9
|
}
|
|
@@ -1,47 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export type CliCoordinates = Readonly<{
|
|
5
|
-
cwd: string;
|
|
6
|
-
cwdSource: "input" | "process";
|
|
7
|
-
repo?: Repo;
|
|
8
|
-
world: WorldRoot | null;
|
|
9
|
-
candidateWorld: WorldRoot | null;
|
|
10
|
-
debtContext: Readonly<{
|
|
11
|
-
directory: string;
|
|
12
|
-
boundary: string;
|
|
13
|
-
writeRoot: string;
|
|
14
|
-
managed: boolean;
|
|
15
|
-
}>;
|
|
16
|
-
establishWorld: () => Promise<WorldRoot>;
|
|
17
|
-
}>;
|
|
18
|
-
type CliCoordinateInput = Readonly<{
|
|
19
|
-
processCwd?: string;
|
|
20
|
-
cwd?: string;
|
|
21
|
-
repo?: string;
|
|
22
|
-
gitPath?: string;
|
|
23
|
-
command: ParsedCommand;
|
|
24
|
-
}>;
|
|
1
|
+
import { type InvocationCoordinates } from "../library/keiyaku-coordinates.js";
|
|
2
|
+
import type { ParsedCommand } from "./parse.js";
|
|
3
|
+
export type CliCoordinates = InvocationCoordinates;
|
|
25
4
|
export declare function resolveInvocationCwd(input: Readonly<{
|
|
26
5
|
processCwd?: string;
|
|
27
6
|
cwd?: string;
|
|
28
7
|
}>): Promise<string>;
|
|
29
|
-
export declare const cliCoordinateDiscovery: {
|
|
30
|
-
repoAt(coordinate: string, gitPath?: string): Promise<Repo>;
|
|
31
|
-
worldResolve(cwd: string, repositoryRoot?: string): Promise<Readonly<{
|
|
32
|
-
root: WorldRoot | null;
|
|
33
|
-
candidate: WorldRoot | null;
|
|
34
|
-
establish: () => Promise<WorldRoot>;
|
|
35
|
-
}>>;
|
|
36
|
-
resolve(input: CliCoordinateInput): Promise<CliCoordinates>;
|
|
37
|
-
};
|
|
38
8
|
type InvocationCoordinatesInput = Readonly<{
|
|
39
9
|
processCwd?: string;
|
|
40
10
|
cwd?: string;
|
|
41
11
|
repo?: string;
|
|
42
|
-
workdir?: string;
|
|
43
12
|
command: ParsedCommand;
|
|
44
13
|
}>;
|
|
45
|
-
/**
|
|
14
|
+
/** Adapt process-edge path spelling and semantic Repo policy to invocation coordinates. */
|
|
46
15
|
export declare function resolveInvocationCoordinates(invocation: InvocationCoordinatesInput, environment: NodeJS.ProcessEnv): Promise<CliCoordinates>;
|
|
47
16
|
export {};
|
|
@@ -1,140 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { realpath } from "node:fs/promises";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { CliUsageError, commandRepoPolicy } from "./parse.js";
|
|
6
|
-
async function canonicalInvocationCwd(input) {
|
|
7
|
-
try {
|
|
8
|
-
return await realpath(input);
|
|
9
|
-
}
|
|
10
|
-
catch {
|
|
11
|
-
throw new CliUsageError(`invocation cwd is not an existing directory: ${input}`);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
3
|
+
import { invocationCoordinates, KeiyakuUsageError, } from "../library/keiyaku-coordinates.js";
|
|
4
|
+
import { commandRepoPolicy } from "../library/keiyaku-policy.js";
|
|
14
5
|
export async function resolveInvocationCwd(input) {
|
|
15
6
|
const processCwd = resolve(input.processCwd ?? ".");
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
async function discoverRepoAt(coordinate, gitPath) {
|
|
7
|
+
const cwd = resolve(processCwd, input.cwd ?? ".");
|
|
19
8
|
try {
|
|
20
|
-
return
|
|
21
|
-
kind: "present",
|
|
22
|
-
repo: await cliCoordinateDiscovery.repoAt(coordinate, gitPath),
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
if (error instanceof NoGitWorldError)
|
|
27
|
-
return { kind: "absent", error };
|
|
28
|
-
throw error;
|
|
9
|
+
return await realpath(cwd);
|
|
29
10
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
try {
|
|
33
|
-
const stat = await lstat(resolve(root, ".keiyaku", "KEIYAKU.md"));
|
|
34
|
-
return stat.isFile() && !stat.isSymbolicLink();
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
if (error.code === "ENOENT")
|
|
38
|
-
return false;
|
|
39
|
-
throw error;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function repoFor(use, discovery) {
|
|
43
|
-
if (use === "none")
|
|
44
|
-
return undefined;
|
|
45
|
-
if (discovery.kind === "present")
|
|
46
|
-
return discovery.repo;
|
|
47
|
-
if (use === "required")
|
|
48
|
-
throw discovery.error;
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
export const cliCoordinateDiscovery = {
|
|
52
|
-
async repoAt(coordinate, gitPath) {
|
|
53
|
-
return Repo.at({ path: coordinate, ...(gitPath === undefined ? {} : { gitPath }) });
|
|
54
|
-
},
|
|
55
|
-
async worldResolve(cwd, repositoryRoot) {
|
|
56
|
-
return World.resolve({ cwd, ...(repositoryRoot === undefined ? {} : { repositoryRoot }) });
|
|
57
|
-
},
|
|
58
|
-
async resolve(input) {
|
|
59
|
-
const cwd = await resolveInvocationCwd(input);
|
|
60
|
-
if (input.command.command === "wait" && input.command.akuma.every((selector) => selector.startsWith("kei/"))) {
|
|
61
|
-
const selectedRepo = await discoverRepoAt(input.repo === undefined ? cwd : resolve(cwd, input.repo), input.gitPath);
|
|
62
|
-
const repo = repoFor("required", selectedRepo);
|
|
63
|
-
return {
|
|
64
|
-
cwd,
|
|
65
|
-
cwdSource: input.cwd === undefined ? "process" : "input",
|
|
66
|
-
repo,
|
|
67
|
-
world: null,
|
|
68
|
-
candidateWorld: null,
|
|
69
|
-
debtContext: { directory: cwd, boundary: cwd, writeRoot: cwd, managed: false },
|
|
70
|
-
establishWorld: async () => {
|
|
71
|
-
throw new Error("Contract wait has no World");
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
const invocationRepo = await discoverRepoAt(cwd, input.gitPath);
|
|
76
|
-
const selectedRepo = input.repo === undefined ? invocationRepo : await discoverRepoAt(resolve(cwd, input.repo), input.gitPath);
|
|
77
|
-
const worldRepo = invocationRepo.kind === "present" ? invocationRepo.repo : undefined;
|
|
78
|
-
const repo = repoFor(commandRepoPolicy(input.command).use, selectedRepo);
|
|
79
|
-
const world = await resolveWorld(cwd, worldRepo);
|
|
80
|
-
const boundary = worldRepo === undefined ? (world.root ?? world.candidate ?? cwd) : worldRepo.cwd;
|
|
81
|
-
return {
|
|
82
|
-
cwd,
|
|
83
|
-
cwdSource: input.cwd === undefined ? "process" : "input",
|
|
84
|
-
...(repo === undefined ? {} : { repo }),
|
|
85
|
-
world: world.root,
|
|
86
|
-
candidateWorld: world.candidate,
|
|
87
|
-
debtContext: {
|
|
88
|
-
directory: cwd,
|
|
89
|
-
boundary,
|
|
90
|
-
writeRoot: worldRepo === undefined ? boundary : cwd,
|
|
91
|
-
managed: await managedContractWorktree(boundary),
|
|
92
|
-
},
|
|
93
|
-
establishWorld: world.establish,
|
|
94
|
-
};
|
|
95
|
-
},
|
|
96
|
-
};
|
|
97
|
-
async function resolveWorld(cwd, repo) {
|
|
98
|
-
try {
|
|
99
|
-
const resolution = await cliCoordinateDiscovery.worldResolve(cwd, repo?.root);
|
|
100
|
-
return {
|
|
101
|
-
root: resolution.root,
|
|
102
|
-
candidate: resolution.candidate,
|
|
103
|
-
async establish() {
|
|
104
|
-
try {
|
|
105
|
-
return await resolution.establish();
|
|
106
|
-
}
|
|
107
|
-
catch (error) {
|
|
108
|
-
if (error instanceof WorldError)
|
|
109
|
-
throw new CliUsageError(error.message);
|
|
110
|
-
throw error;
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
if (error instanceof WorldError)
|
|
117
|
-
throw new CliUsageError(error.message);
|
|
118
|
-
throw error;
|
|
11
|
+
catch {
|
|
12
|
+
throw new KeiyakuUsageError(`invocation cwd is not an existing directory: ${cwd}`);
|
|
119
13
|
}
|
|
120
14
|
}
|
|
121
|
-
/**
|
|
122
|
-
function gitPathFromEdge(environment) {
|
|
123
|
-
const value = environment.KEIYAKU_GIT_PATH;
|
|
124
|
-
if (value === undefined)
|
|
125
|
-
return undefined;
|
|
126
|
-
if (value.trim().length === 0)
|
|
127
|
-
throw new CliUsageError("KEIYAKU_GIT_PATH requires a nonblank value");
|
|
128
|
-
return value;
|
|
129
|
-
}
|
|
130
|
-
/** The one process-edge coordinate resolution: explicit filesystem inputs plus the command's Repo policy. */
|
|
15
|
+
/** Adapt process-edge path spelling and semantic Repo policy to invocation coordinates. */
|
|
131
16
|
export async function resolveInvocationCoordinates(invocation, environment) {
|
|
132
|
-
const
|
|
133
|
-
return
|
|
134
|
-
|
|
135
|
-
...(invocation.cwd === undefined ? {} : { cwd: invocation.cwd }),
|
|
17
|
+
const cwd = resolve(resolve(invocation.processCwd ?? "."), invocation.cwd ?? ".");
|
|
18
|
+
return invocationCoordinates({
|
|
19
|
+
cwd,
|
|
136
20
|
...(invocation.repo === undefined ? {} : { repo: invocation.repo }),
|
|
137
|
-
|
|
138
|
-
|
|
21
|
+
environment,
|
|
22
|
+
use: commandRepoPolicy(invocation.command).use,
|
|
139
23
|
});
|
|
140
24
|
}
|
package/build/src/cli/parse.d.ts
CHANGED
|
@@ -41,11 +41,5 @@ export type ParsedInvocation = Readonly<{
|
|
|
41
41
|
}> | Readonly<{
|
|
42
42
|
version: true;
|
|
43
43
|
}>;
|
|
44
|
-
type RepoUse = "none" | "optional" | "required";
|
|
45
|
-
type CommandRepoPolicy = Readonly<{
|
|
46
|
-
use: RepoUse;
|
|
47
|
-
acceptsExplicit: boolean;
|
|
48
|
-
}>;
|
|
49
|
-
export declare function commandRepoPolicy(command: ParsedCommand): CommandRepoPolicy;
|
|
50
44
|
export declare function assertExplicitRepoUse(command: ParsedCommand, repo: string | undefined): void;
|
|
51
45
|
export declare function parseArgv(argv: readonly string[]): ParsedInvocation;
|
package/build/src/cli/parse.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { commandRepoPolicy } from "../library/keiyaku-policy.js";
|
|
1
2
|
import { isDebtAction, parseDebtCommand, renderDebtHelp, debtUsageGuide, } from "./commands/debt-grammar.js";
|
|
2
3
|
import { akumaUsageGuide, isAkumaAction, parseAkumaCommand, renderAkumaHelp, renderAkumaRootRows, } from "./commands/akuma-grammar.js";
|
|
3
4
|
import { INSTALL_ROOT_PURPOSE, INSTALL_USAGE, parseInstallCommand, renderInstallHelp, } from "./commands/install.js";
|
|
@@ -42,7 +43,7 @@ export function renderRootHelp(columns) {
|
|
|
42
43
|
"Global options:",
|
|
43
44
|
" -C, --cwd <path> Set the invocation working directory.",
|
|
44
45
|
" --repo <path> Select the Git repository coordinate.",
|
|
45
|
-
" --workdir <path> Set the execution directory for
|
|
46
|
+
" --workdir <path> Set the execution directory for spawn only.",
|
|
46
47
|
"",
|
|
47
48
|
"Outcomes: exit 0 accepted · 1 refused · 2 retryable · 3 failed · 64 usage",
|
|
48
49
|
].join("\n"), columns);
|
|
@@ -87,59 +88,15 @@ export function renderHelp(coordinate, columns) {
|
|
|
87
88
|
case "install":
|
|
88
89
|
return renderInstallHelp();
|
|
89
90
|
case "whoami":
|
|
90
|
-
return `${WHOAMI_PURPOSE}\n\n${usageLine(WHOAMI_USAGE)}\n\nRead-only. For an Akuma, who started its current turn is shown apart from who
|
|
91
|
+
return `${WHOAMI_PURPOSE}\n\n${usageLine(WHOAMI_USAGE)}\n\nRead-only. For an Akuma, who started its current turn is shown apart from who spawned it. Missing or unreadable facts stay explicit.`;
|
|
91
92
|
case "akuma":
|
|
92
93
|
return renderAkumaHelp(coordinate.action);
|
|
93
94
|
}
|
|
94
95
|
})();
|
|
95
96
|
return renderHelpText(help, columns);
|
|
96
97
|
}
|
|
97
|
-
export function commandRepoPolicy(command) {
|
|
98
|
-
switch (command.command) {
|
|
99
|
-
case "bind":
|
|
100
|
-
case "amend":
|
|
101
|
-
case "deliver":
|
|
102
|
-
case "verify":
|
|
103
|
-
case "review":
|
|
104
|
-
case "arc":
|
|
105
|
-
case "abandon":
|
|
106
|
-
case "reconcile":
|
|
107
|
-
case "region":
|
|
108
|
-
case "show":
|
|
109
|
-
return { use: "required", acceptsExplicit: true };
|
|
110
|
-
case "ls":
|
|
111
|
-
return { use: command.query.kind === "contracts" ? "required" : "none", acceptsExplicit: false };
|
|
112
|
-
case "status":
|
|
113
|
-
case "whoami":
|
|
114
|
-
case "tell":
|
|
115
|
-
case "ask":
|
|
116
|
-
return { use: "optional", acceptsExplicit: false };
|
|
117
|
-
case "history":
|
|
118
|
-
return "contract" in command
|
|
119
|
-
? { use: "required", acceptsExplicit: true }
|
|
120
|
-
: { use: "optional", acceptsExplicit: false };
|
|
121
|
-
case "fork":
|
|
122
|
-
return { use: "optional", acceptsExplicit: true };
|
|
123
|
-
case "wait":
|
|
124
|
-
case "kill": {
|
|
125
|
-
const contractSelector = command.akuma.some((selector) => selector.startsWith("kei/"));
|
|
126
|
-
return { use: contractSelector ? "required" : "optional", acceptsExplicit: contractSelector };
|
|
127
|
-
}
|
|
128
|
-
case "call":
|
|
129
|
-
return {
|
|
130
|
-
use: command.contract === undefined ? "none" : "required",
|
|
131
|
-
acceptsExplicit: command.contract !== undefined,
|
|
132
|
-
};
|
|
133
|
-
case "report":
|
|
134
|
-
case "settings":
|
|
135
|
-
case "nuke":
|
|
136
|
-
case "debt":
|
|
137
|
-
case "install":
|
|
138
|
-
return { use: "none", acceptsExplicit: false };
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
98
|
function refuseUnusedRepo(command) {
|
|
142
|
-
if (command.command === "
|
|
99
|
+
if (command.command === "spawn")
|
|
143
100
|
throw new CliUsageError("--repo has no consumer without --contract");
|
|
144
101
|
throw new CliUsageError(`--repo has no consumer for ${command.command}`);
|
|
145
102
|
}
|
|
@@ -285,7 +242,7 @@ export function parseArgv(argv) {
|
|
|
285
242
|
const install = invocation.commandArgv[0] === "install" ? parseInstallCommand(invocation.commandArgv.slice(1)) : undefined;
|
|
286
243
|
const akuma = isAkumaAction(invocation.commandArgv[0]) ? parseAkumaCommand(invocation.commandArgv) : undefined;
|
|
287
244
|
const command = whoami ?? debt ?? akuma ?? install ?? parseContractCommand(scanArgv(invocation.commandArgv));
|
|
288
|
-
if (invocation.workdir !== undefined && command.command !== "
|
|
245
|
+
if (invocation.workdir !== undefined && command.command !== "spawn") {
|
|
289
246
|
throw new CliUsageError(`option --workdir is not valid for ${command.command}`, usageGuideForCommand(command));
|
|
290
247
|
}
|
|
291
248
|
return {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { AkumaStatus } from "../../akuma/akuma.js";
|
|
2
2
|
import type { KillEvidence } from "../../akuma/heart/index.js";
|
|
3
3
|
import type { ActivityRow } from "../../akuma/projection.js";
|
|
4
|
+
import type { CompactOutcome, StatusPreview } from "../../akuma/status-projection.js";
|
|
4
5
|
import type { AkumaAskObservation, AkumaAskResult, AkumaTellResult, AkumaWaitResult } from "../../akuma/selection-observation.js";
|
|
5
|
-
import type { AkumaObservation
|
|
6
|
-
import type {
|
|
6
|
+
import type { AkumaObservation } from "../../index.js";
|
|
7
|
+
import type { SpawnResult } from "../../library/akuma-creation.js";
|
|
8
|
+
import type { TellResult } from "../../akuma/body.js";
|
|
7
9
|
import type { AkumaHistoryResult } from "../../library/selection.js";
|
|
8
10
|
import { type TextRenderContext } from "./terminal.js";
|
|
9
11
|
export declare const DEFAULT_CONTEXT: TextRenderContext;
|
|
@@ -13,19 +15,28 @@ export declare const DEFAULT_CONTEXT: TextRenderContext;
|
|
|
13
15
|
* frame and its content.
|
|
14
16
|
*/
|
|
15
17
|
export declare function frameRule(headLines: readonly string[], columns?: number): string;
|
|
16
|
-
type StatusTimeline =
|
|
18
|
+
type StatusTimeline = AkumaStatus["timeline"];
|
|
17
19
|
type RenderedSnapshot = StatusTimeline;
|
|
18
20
|
type RenderedActivity = Readonly<{
|
|
19
21
|
snapshot: RenderedSnapshot;
|
|
20
22
|
rows: readonly ActivityRow[];
|
|
21
23
|
}>;
|
|
24
|
+
type DisplayAssociation = Readonly<{
|
|
25
|
+
kind: "none";
|
|
26
|
+
}> | Readonly<{
|
|
27
|
+
kind: "associated";
|
|
28
|
+
contractId: string;
|
|
29
|
+
}> | Readonly<{
|
|
30
|
+
kind: "failed";
|
|
31
|
+
diagnostic: string;
|
|
32
|
+
}>;
|
|
22
33
|
/** Indent already-decided supporting lines one level, for every caller of this family. */
|
|
23
34
|
export declare function subordinateLines(lines: readonly string[]): readonly string[];
|
|
24
35
|
/**
|
|
25
36
|
* Identity and its static coordinates. The execution directory and any already-exposed effective
|
|
26
37
|
* actions belong above the content boundary; an absent coordinate is an absent line.
|
|
27
38
|
*/
|
|
28
|
-
export declare function panelHead(id: string, alias: string | undefined, contract:
|
|
39
|
+
export declare function panelHead(id: string, alias: string | undefined, contract: DisplayAssociation | undefined, context?: readonly string[]): readonly string[];
|
|
29
40
|
/**
|
|
30
41
|
* One action receipt: the verdict and the complete subject on the first line, every supporting fact
|
|
31
42
|
* indented beneath it. Identity and evidence are never merged into one punctuation run.
|
|
@@ -37,6 +48,11 @@ export declare function actionReceipt(input: Readonly<{
|
|
|
37
48
|
alias?: string;
|
|
38
49
|
evidence?: readonly string[];
|
|
39
50
|
}>): readonly string[];
|
|
51
|
+
/** One native activity row through the shared row grammar. */
|
|
52
|
+
export declare function activityRowLines(row: ActivityRow | StatusPreview | CompactOutcome, context: TextRenderContext, view?: Readonly<{
|
|
53
|
+
compact?: true;
|
|
54
|
+
tailAnswer?: true;
|
|
55
|
+
}>): readonly string[];
|
|
40
56
|
/**
|
|
41
57
|
* Shared snapshot activity rendering. Full snapshots render the selected
|
|
42
58
|
* activity evidence; an idle snapshot is settled evidence. `latest` preserves
|
|
@@ -72,7 +88,7 @@ export declare function inputWaitConclusion(observation: AkumaAskObservation, in
|
|
|
72
88
|
export type ObservedCallHead = Readonly<{
|
|
73
89
|
id: string;
|
|
74
90
|
alias?: string;
|
|
75
|
-
contract:
|
|
91
|
+
contract: DisplayAssociation;
|
|
76
92
|
facts: readonly string[];
|
|
77
93
|
/** A directory the invocation already resolved; never read here to fill the panel. */
|
|
78
94
|
cwd?: string;
|
|
@@ -106,10 +122,10 @@ export type InputWaitStream = Readonly<{
|
|
|
106
122
|
}>;
|
|
107
123
|
/**
|
|
108
124
|
* The call-observation projection of one input wait: the same admitted/observe/frame/flush/opened
|
|
109
|
-
* lifetime with the closing judgment
|
|
125
|
+
* lifetime with the closing judgment from the native compact spawn result.
|
|
110
126
|
*/
|
|
111
127
|
export type CallObservationStream = Readonly<Omit<InputWaitStream, "conclude"> & {
|
|
112
|
-
conclude: (
|
|
128
|
+
conclude: (result: SpawnResult) => string;
|
|
113
129
|
}>;
|
|
114
130
|
/**
|
|
115
131
|
* Live view over one observing input: its identity frame opens once, selected
|
|
@@ -117,18 +133,15 @@ export type CallObservationStream = Readonly<Omit<InputWaitStream, "conclude"> &
|
|
|
117
133
|
*/
|
|
118
134
|
export declare function inputWaitStream(context: TextRenderContext, head: () => ObservedCallHead, options: Readonly<{
|
|
119
135
|
cursor: "empty" | "admission";
|
|
120
|
-
now?: () => number;
|
|
136
|
+
now?: () => number | undefined;
|
|
121
137
|
answerSeparator?: true;
|
|
122
138
|
}>): InputWaitStream;
|
|
123
139
|
export declare function callObservationStream(context: TextRenderContext, head: ObservedCallHead, options?: Readonly<{
|
|
124
140
|
now?: () => number;
|
|
125
141
|
admittedAt?: string;
|
|
142
|
+
prompt?: string;
|
|
126
143
|
}>): CallObservationStream;
|
|
127
|
-
type SnapshotView =
|
|
128
|
-
status: AkumaObservation["status"];
|
|
129
|
-
contract: DispatchAssociation;
|
|
130
|
-
createdDebts?: CreatedDebtObservation;
|
|
131
|
-
}>;
|
|
144
|
+
type SnapshotView = AkumaObservation;
|
|
132
145
|
type SnapshotCoreOptions = Readonly<{
|
|
133
146
|
alias?: string;
|
|
134
147
|
facts?: readonly string[];
|
|
@@ -140,7 +153,7 @@ type AkumaPresentation = Readonly<{
|
|
|
140
153
|
alias?: string;
|
|
141
154
|
}>;
|
|
142
155
|
export declare function askRawAnswer(result: AkumaAskResult, structured: boolean | undefined): string | undefined;
|
|
143
|
-
export declare function callRawAnswer(result:
|
|
156
|
+
export declare function callRawAnswer(result: SpawnResult, structured: boolean, streamed: boolean): string | undefined;
|
|
144
157
|
export declare function historyRawAnswer(result: AkumaHistoryResult, historyId: string | undefined): string | undefined;
|
|
145
158
|
/**
|
|
146
159
|
* One wait's final text: one compact line per observed member, then one failure line per member
|
|
@@ -151,16 +164,18 @@ export declare function waitText(result: AkumaWaitResult, presentation: AkumaPre
|
|
|
151
164
|
export declare function historyText(result: AkumaHistoryResult, presentation: AkumaPresentation & Readonly<{
|
|
152
165
|
id?: string;
|
|
153
166
|
last?: boolean;
|
|
167
|
+
since?: number;
|
|
154
168
|
}>, context: TextRenderContext): string;
|
|
155
169
|
/** One bounded, quoted preview of a Tell an outer receipt already admitted, indented beneath it. */
|
|
156
170
|
export declare function tellPayloadLines(text: string, context: TextRenderContext): readonly string[];
|
|
157
171
|
/** One admitted Tell as a timeline input row inside a shared panel; the panel owns the identity. */
|
|
158
|
-
export declare function tellAdmissionRow(
|
|
172
|
+
export declare function tellAdmissionRow(text: string, context: TextRenderContext, wake?: TellResult["wake"] | AkumaTellResult["wake"]): string;
|
|
173
|
+
export declare function tellControlLines(result: Pick<AkumaAskResult, "wake" | "interrupt">, context: TextRenderContext): readonly string[];
|
|
159
174
|
/**
|
|
160
175
|
* One Tell action receipt: the delivery verdict and complete subject stand whole on the first line
|
|
161
176
|
* with the submitted payload folded onto that same line, bounded so only its preview truncates. A
|
|
162
177
|
* held Tell keeps neutral vocabulary; a failed delivery keeps its concrete diagnosis and native log
|
|
163
178
|
* coordinates as separate supporting facts.
|
|
164
179
|
*/
|
|
165
|
-
export declare function tellText(result: AkumaTellResult, alias: string | undefined, context: TextRenderContext): string;
|
|
180
|
+
export declare function tellText(result: AkumaTellResult, prompt: string, alias: string | undefined, context: TextRenderContext): string;
|
|
166
181
|
export {};
|