@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
|
@@ -2,7 +2,7 @@ import { defaultWaitComplete } from "../../akuma/akuma-observe.js";
|
|
|
2
2
|
import { renderDiffstat, toolContent, toolRepr } from "./akuma-tool.js";
|
|
3
3
|
import { dispositionText } from "./debt.js";
|
|
4
4
|
import { debtDispositionMark } from "./marks.js";
|
|
5
|
-
import { DEFAULT_CLI_COLUMNS, diagnosticLines, displayColumns, padToDisplay, renderBoundedPayload, renderBoundedTextBlock, safeText, takeDisplayColumns, takeDisplayColumnsFromEnd, truncateDisplayText, truncateMiddleDisplayText, } from "./terminal.js";
|
|
5
|
+
import { ageText, DEFAULT_CLI_COLUMNS, diagnosticLines, displayColumns, padToDisplay, renderBoundedPayload, renderBoundedTextBlock, safeText, takeDisplayColumns, takeDisplayColumnsFromEnd, truncateDisplayText, truncateMiddleDisplayText, } from "./terminal.js";
|
|
6
6
|
export const DEFAULT_CONTEXT = { columns: DEFAULT_CLI_COLUMNS, color: false };
|
|
7
7
|
/** The action family's fixed 3-cell state margin and minimum verb cell. */
|
|
8
8
|
const ACTION_MARGIN = " ";
|
|
@@ -81,7 +81,8 @@ function rowText(row, tool) {
|
|
|
81
81
|
row.kind === "thought" ||
|
|
82
82
|
row.kind === "note" ||
|
|
83
83
|
row.kind === "call" ||
|
|
84
|
-
row.kind === "tell"
|
|
84
|
+
row.kind === "tell" ||
|
|
85
|
+
row.kind === "pending-tell") {
|
|
85
86
|
return {
|
|
86
87
|
text: row.text,
|
|
87
88
|
lines: row.kind === "said" || row.kind === "thought" ? 2 : row.kind === "tell" || row.kind === "call" ? 1 : 2,
|
|
@@ -130,7 +131,7 @@ function rowPrefix(row, tool, columns, view) {
|
|
|
130
131
|
};
|
|
131
132
|
if (row.kind === "said")
|
|
132
133
|
return { first: TOP_SPEAK, continuation: TOP_SPEAK };
|
|
133
|
-
if (row.kind === "tell" && row.state === "pending")
|
|
134
|
+
if (row.kind === "pending-tell" || (row.kind === "tell" && "state" in row && row.state === "pending"))
|
|
134
135
|
return { first: TOP_PENDING, continuation: TOP_CONTINUATION };
|
|
135
136
|
return { first: TOP_INPUT, continuation: TOP_CONTINUATION };
|
|
136
137
|
}
|
|
@@ -234,7 +235,7 @@ function renderRow(row, context, view = {}) {
|
|
|
234
235
|
if (view.tailAnswer === true && row.kind === "outcome" && row.outcome.kind === "answered")
|
|
235
236
|
return tailAnswerPreview(first, value.text, context.columns);
|
|
236
237
|
const available = context.columns - displayColumns(first) - displayColumns(value.suffix ?? "");
|
|
237
|
-
const singleLine = compact || row.kind === "call" || row.kind === "tell" || row.kind === "turn";
|
|
238
|
+
const singleLine = compact || row.kind === "call" || row.kind === "tell" || row.kind === "pending-tell" || row.kind === "turn";
|
|
238
239
|
return renderBoundedPayload({
|
|
239
240
|
text: rowBody(row, value.text, available),
|
|
240
241
|
first,
|
|
@@ -246,6 +247,12 @@ function renderRow(row, context, view = {}) {
|
|
|
246
247
|
...(singleLine || row.kind === "tool" ? {} : { preserveLines: true }),
|
|
247
248
|
});
|
|
248
249
|
}
|
|
250
|
+
/** One native activity row through the shared row grammar. */
|
|
251
|
+
export function activityRowLines(row, context, view = {}) {
|
|
252
|
+
return renderRow(row.kind === "answered" || row.kind === "failed" || row.kind === "canceled"
|
|
253
|
+
? { kind: "outcome", outcome: row }
|
|
254
|
+
: row, context, view);
|
|
255
|
+
}
|
|
249
256
|
function groupedEntries(entries, context, view = {}) {
|
|
250
257
|
const lines = [];
|
|
251
258
|
for (const entry of entries) {
|
|
@@ -287,7 +294,7 @@ function currentTurnBoundary(activity) {
|
|
|
287
294
|
// The projector selects a typed opening: its call or delivered launch Tell.
|
|
288
295
|
if (row.kind !== "call" && !(row.kind === "tell" && row.state === "told"))
|
|
289
296
|
return undefined;
|
|
290
|
-
return { row, turnSequence: snapshot.turn.
|
|
297
|
+
return { row, turnSequence: snapshot.turn.sequence };
|
|
291
298
|
}
|
|
292
299
|
/** Open status hides internal thought narration without selecting a second activity window. */
|
|
293
300
|
function visibleOpenSnapshotEntries(snapshot) {
|
|
@@ -521,6 +528,17 @@ export function activityStream(context) {
|
|
|
521
528
|
flush: () => render(flush()),
|
|
522
529
|
});
|
|
523
530
|
}
|
|
531
|
+
function lifeConclusion(life, pending) {
|
|
532
|
+
if (life === "running")
|
|
533
|
+
return { mark: "●", verb: "running" };
|
|
534
|
+
if (life === "asleep")
|
|
535
|
+
return pending ? { mark: "⧗", verb: "pending tell" } : { mark: "✓", verb: "completed" };
|
|
536
|
+
if (life === "killed")
|
|
537
|
+
return { mark: "×", verb: "killed" };
|
|
538
|
+
if (life === "hung")
|
|
539
|
+
return { mark: "?", verb: "hung" };
|
|
540
|
+
return { mark: "!", verb: life };
|
|
541
|
+
}
|
|
524
542
|
function conclusionMarkVerb(status, outcome) {
|
|
525
543
|
if (outcome === "failed" || (status !== undefined && failedOutcomeDiagnostic(status) !== undefined))
|
|
526
544
|
return { mark: "!", verb: "failed" };
|
|
@@ -530,20 +548,7 @@ function conclusionMarkVerb(status, outcome) {
|
|
|
530
548
|
return { mark: "○", verb: "unanswered" };
|
|
531
549
|
if (status === undefined)
|
|
532
550
|
return { mark: "⧗", verb: "pending tell" };
|
|
533
|
-
|
|
534
|
-
return { mark: "●", verb: "running" };
|
|
535
|
-
if (!defaultWaitComplete(status)) {
|
|
536
|
-
return { mark: "⧗", verb: "pending tell" };
|
|
537
|
-
}
|
|
538
|
-
if (status.life === "asleep")
|
|
539
|
-
return { mark: "✓", verb: "completed" };
|
|
540
|
-
if (status.life === "killed")
|
|
541
|
-
return { mark: "×", verb: "killed" };
|
|
542
|
-
if (status.life === "hung")
|
|
543
|
-
return { mark: "?", verb: "hung" };
|
|
544
|
-
if (status.life === "untidy")
|
|
545
|
-
return { mark: "!", verb: "untidy" };
|
|
546
|
-
return { mark: "!", verb: "stranded" };
|
|
551
|
+
return lifeConclusion(status.life, !defaultWaitComplete(status));
|
|
547
552
|
}
|
|
548
553
|
function durationText(durationMs) {
|
|
549
554
|
const seconds = Math.max(0, Math.round(durationMs / 1000));
|
|
@@ -561,19 +566,21 @@ function waitConclusionRow(input) {
|
|
|
561
566
|
? input.at !== undefined && input.at >= input.startedAt
|
|
562
567
|
? ` — ${durationText(Math.max(0, input.at - input.startedAt))}`
|
|
563
568
|
: ""
|
|
564
|
-
:
|
|
569
|
+
: input.end === undefined || !Number.isFinite(input.startedAt)
|
|
570
|
+
? ""
|
|
571
|
+
: ` — waited ${durationText(Math.max(0, input.end - input.startedAt))}`;
|
|
565
572
|
return `${input.mark} ${input.verb}${duration}`;
|
|
566
573
|
}
|
|
567
574
|
export function inputWaitConclusion(observation, input) {
|
|
568
|
-
const end = input.now
|
|
569
|
-
const complete = observation.
|
|
575
|
+
const end = input.now;
|
|
576
|
+
const complete = observation.kind !== "deadline";
|
|
570
577
|
const pinned = input.completedAt == null ? Number.NaN : Date.parse(input.completedAt);
|
|
571
578
|
const at = complete ? (Number.isFinite(pinned) ? pinned : undefined) : end;
|
|
572
|
-
const conclusion = conclusionMarkVerb(input.status, observation.
|
|
579
|
+
const conclusion = conclusionMarkVerb(input.status, observation.kind === "answered"
|
|
573
580
|
? "answered"
|
|
574
|
-
: observation.
|
|
581
|
+
: observation.kind === "failed" || observation.kind === "invalid-output"
|
|
575
582
|
? "failed"
|
|
576
|
-
: observation.
|
|
583
|
+
: observation.kind === "unanswered"
|
|
577
584
|
? "unanswered"
|
|
578
585
|
: "life");
|
|
579
586
|
return [
|
|
@@ -581,10 +588,10 @@ export function inputWaitConclusion(observation, input) {
|
|
|
581
588
|
...(at === undefined ? {} : { at }),
|
|
582
589
|
startedAt: input.startedAt,
|
|
583
590
|
complete,
|
|
584
|
-
end,
|
|
591
|
+
...(end === undefined ? {} : { end }),
|
|
585
592
|
...conclusion,
|
|
586
593
|
}),
|
|
587
|
-
...(observation.
|
|
594
|
+
...(observation.kind === "failed" || observation.kind === "invalid-output"
|
|
588
595
|
? [`! ${safeText(observation.diagnostic)}`]
|
|
589
596
|
: []),
|
|
590
597
|
];
|
|
@@ -611,7 +618,7 @@ export function inputWaitStream(context, head, options) {
|
|
|
611
618
|
if (admitted)
|
|
612
619
|
throw new Error("input wait admitted more than once");
|
|
613
620
|
const pinned = input.at === undefined ? Number.NaN : Date.parse(input.at);
|
|
614
|
-
startedAt = Number.isFinite(pinned) ? pinned : now();
|
|
621
|
+
startedAt = Number.isFinite(pinned) ? pinned : (now() ?? Number.NaN);
|
|
615
622
|
admittedSequence = input.sequence;
|
|
616
623
|
admitted = true;
|
|
617
624
|
if (input.rows.length === 0)
|
|
@@ -654,13 +661,15 @@ export function inputWaitStream(context, head, options) {
|
|
|
654
661
|
lines.push(...activity.flush());
|
|
655
662
|
if (result.kind === "failed")
|
|
656
663
|
lines.push(`! ${safeText(result.diagnostic)}`);
|
|
657
|
-
else
|
|
664
|
+
else {
|
|
665
|
+
const currentTime = now();
|
|
658
666
|
lines.push(...inputWaitConclusion(result.observation, {
|
|
659
667
|
startedAt,
|
|
660
668
|
...(result.completedAt === undefined ? {} : { completedAt: result.completedAt }),
|
|
661
|
-
now:
|
|
669
|
+
...(currentTime === undefined ? {} : { now: currentTime }),
|
|
662
670
|
...(lastStatus === undefined ? {} : { status: lastStatus }),
|
|
663
671
|
}));
|
|
672
|
+
}
|
|
664
673
|
lines.push(...subordinateLines(head().facts));
|
|
665
674
|
return `${lines.join("\n")}${options.answerSeparator === true ? "\n\n" : ""}`;
|
|
666
675
|
};
|
|
@@ -680,37 +689,34 @@ export function callObservationStream(context, head, options = {}) {
|
|
|
680
689
|
observe: (observation) => {
|
|
681
690
|
for (const row of observation.rows)
|
|
682
691
|
if (row.kind === "tell" && row.state === "told")
|
|
683
|
-
settledTells.add(row.
|
|
692
|
+
settledTells.add(row.tellId);
|
|
684
693
|
return stream.observe(observation);
|
|
685
694
|
},
|
|
686
|
-
conclude: (
|
|
687
|
-
if (
|
|
688
|
-
const
|
|
689
|
-
|
|
695
|
+
conclude: (result) => {
|
|
696
|
+
if (result.failure !== undefined) {
|
|
697
|
+
const evidence = result.tellId === undefined || settledTells.has(result.tellId) || options.prompt === undefined
|
|
698
|
+
? []
|
|
699
|
+
: [tellAdmissionRow(options.prompt, context, result.wake)];
|
|
690
700
|
return stream.conclude({
|
|
691
701
|
kind: "failed",
|
|
692
|
-
diagnostic:
|
|
702
|
+
diagnostic: result.failure.diagnostic,
|
|
693
703
|
...(evidence.length === 0 ? {} : { evidence }),
|
|
694
704
|
});
|
|
695
705
|
}
|
|
696
|
-
|
|
697
|
-
return "";
|
|
698
|
-
return stream.conclude({
|
|
699
|
-
kind: "observed",
|
|
700
|
-
observation: observation.observation,
|
|
701
|
-
...(observation.completedAt === undefined ? {} : { completedAt: observation.completedAt }),
|
|
702
|
-
});
|
|
706
|
+
return result.input === undefined ? "" : stream.conclude({ kind: "observed", observation: result.input });
|
|
703
707
|
},
|
|
704
708
|
};
|
|
705
709
|
}
|
|
706
|
-
function renderReportedChangeLines(
|
|
707
|
-
|
|
710
|
+
function renderReportedChangeLines(view) {
|
|
711
|
+
const changes = view.changes ?? [];
|
|
712
|
+
if (changes.length === 0 && view.moreChanges !== true && view.outsideChanges === undefined)
|
|
708
713
|
return [];
|
|
709
|
-
const width =
|
|
714
|
+
const width = changes.reduce((max, change) => Math.max(max, renderDiffstat(change.diffstat).length), 0);
|
|
710
715
|
return [
|
|
711
|
-
|
|
712
|
-
...
|
|
713
|
-
...(
|
|
716
|
+
"changes",
|
|
717
|
+
...changes.map((change) => ` ${renderDiffstat(change.diffstat).padEnd(width)} ${safeText(change.path)}`),
|
|
718
|
+
...(view.moreChanges === true ? [` ${OMISSION} more files`] : []),
|
|
719
|
+
...(view.outsideChanges === undefined ? [] : [` ${view.outsideChanges} outside worktree`]),
|
|
714
720
|
];
|
|
715
721
|
}
|
|
716
722
|
function renderDebtRow(row, columns) {
|
|
@@ -729,76 +735,67 @@ function renderDebtRow(row, columns) {
|
|
|
729
735
|
function renderDebtContextLines(created, columns) {
|
|
730
736
|
if (created === undefined)
|
|
731
737
|
return [];
|
|
732
|
-
if (
|
|
738
|
+
if ("kind" in created)
|
|
733
739
|
return diagnosticLines("created debts", created.diagnostic, columns);
|
|
734
|
-
|
|
735
|
-
return [];
|
|
736
|
-
return [`debts ${created.rows.length}`, ...created.rows.flatMap((row) => renderDebtRow(row, columns))];
|
|
740
|
+
return [`debts ${created.length}`, ...created.flatMap((row) => renderDebtRow(row, columns))];
|
|
737
741
|
}
|
|
738
742
|
function selectedStatusActivity(snapshot, context) {
|
|
739
|
-
|
|
740
|
-
const rendered = entries.map((entry) => {
|
|
741
|
-
if (entry.kind === "gap")
|
|
742
|
-
return { exempt: true, lines: [omissionMarker(`${entry.count} omitted`, context.columns)] };
|
|
743
|
-
const row = entry.row;
|
|
744
|
-
const exempt = row.kind === "outcome" ||
|
|
745
|
-
(row.kind === "tell" && row.state === "pending") ||
|
|
746
|
-
(row.kind === "tool" && (row.state === "active" || row.state === "unsettled" || row.state.status === "error"));
|
|
747
|
-
return { exempt, lines: renderRow(row, context) };
|
|
748
|
-
});
|
|
749
|
-
const kept = rendered.map(({ lines }) => lines);
|
|
750
|
-
// Allocate the budget backwards without changing the order of the resulting lines.
|
|
751
|
-
let remaining = 3;
|
|
752
|
-
for (let i = rendered.length - 1; i >= 0; i -= 1) {
|
|
753
|
-
const item = rendered[i];
|
|
754
|
-
if (item.exempt)
|
|
755
|
-
continue;
|
|
756
|
-
const take = Math.min(remaining, item.lines.length);
|
|
757
|
-
remaining -= take;
|
|
758
|
-
kept[i] = take === 0 ? [] : item.lines.slice(-take);
|
|
759
|
-
}
|
|
743
|
+
let omitted = false;
|
|
760
744
|
let marked = false;
|
|
761
|
-
return
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
return [omissionMarker("earlier activity omitted", context.columns), ...lines];
|
|
745
|
+
return (snapshot.entries ?? []).flatMap((entry) => {
|
|
746
|
+
if (entry.kind === "gap") {
|
|
747
|
+
omitted = true;
|
|
748
|
+
return [];
|
|
766
749
|
}
|
|
767
|
-
|
|
750
|
+
const row = entry.kind === "answered" || entry.kind === "failed" || entry.kind === "canceled"
|
|
751
|
+
? { kind: "outcome", outcome: entry }
|
|
752
|
+
: entry;
|
|
753
|
+
const lines = renderRow(row, context);
|
|
754
|
+
if (lines.length === 0)
|
|
755
|
+
return [];
|
|
756
|
+
const marker = omitted && !marked ? [omissionMarker("earlier activity in history", context.columns)] : [];
|
|
757
|
+
if (omitted)
|
|
758
|
+
marked = true;
|
|
759
|
+
return [...marker, ...lines];
|
|
768
760
|
});
|
|
769
761
|
}
|
|
770
762
|
function snapshotCore(view, context, options) {
|
|
771
|
-
const activity = selectedStatusActivity(view.
|
|
772
|
-
|
|
773
|
-
|
|
763
|
+
const activity = selectedStatusActivity(view.timeline, context);
|
|
764
|
+
const contextFacts = [
|
|
765
|
+
safeText(view.cwd),
|
|
766
|
+
...(view.lastActivityAt === undefined
|
|
767
|
+
? []
|
|
768
|
+
: [
|
|
769
|
+
`${view.life} · last activity ${ageText(view.lastActivityAt, new Date(context.now ?? Date.now()).toISOString())} ago`,
|
|
770
|
+
]),
|
|
771
|
+
];
|
|
774
772
|
const facts = [
|
|
775
|
-
...contractFacts(view.contract, context.columns - SUBORDINATE_INDENT.length),
|
|
773
|
+
...contractFacts(view.contract ?? { kind: "none" }, context.columns - SUBORDINATE_INDENT.length),
|
|
776
774
|
...(options.facts ?? []),
|
|
777
775
|
];
|
|
778
776
|
return {
|
|
779
777
|
activity,
|
|
780
|
-
head: panelHead(view.
|
|
778
|
+
head: panelHead(view.id, options.alias, view.contract, contextFacts),
|
|
781
779
|
facts,
|
|
782
780
|
};
|
|
783
781
|
}
|
|
784
782
|
function snapshotConclusion(status) {
|
|
785
|
-
const
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
if (timeline.kind === "idle" && timeline.outcome !== undefined)
|
|
783
|
+
const entries = status.timeline.entries ?? [];
|
|
784
|
+
if (status.timeline.kind === "idle" &&
|
|
785
|
+
entries.some((entry) => entry.kind === "answered" || entry.kind === "failed" || entry.kind === "canceled"))
|
|
789
786
|
return "";
|
|
790
|
-
const
|
|
791
|
-
return `${mark} ${verb}`;
|
|
787
|
+
const conclusion = lifeConclusion(status.life, entries.some((entry) => entry.kind === "pending-tell"));
|
|
788
|
+
return `${conclusion.mark} ${conclusion.verb}${status.strandedReason === undefined ? "" : ` · ${status.strandedReason}`}`;
|
|
792
789
|
}
|
|
793
790
|
export function snapshotText(view, context, options = {}) {
|
|
794
791
|
const core = snapshotCore(view, context, options);
|
|
795
|
-
const conclusion = snapshotConclusion(view
|
|
792
|
+
const conclusion = snapshotConclusion(view);
|
|
796
793
|
const content = [...core.activity, ...(conclusion.length === 0 ? [] : [conclusion])];
|
|
797
794
|
return [
|
|
798
795
|
...core.head,
|
|
799
796
|
...(content.length === 0 ? [] : [frameRule(core.head, context.columns), ...content]),
|
|
800
797
|
...subordinateLines([
|
|
801
|
-
...renderReportedChangeLines(view
|
|
798
|
+
...renderReportedChangeLines(view),
|
|
802
799
|
...renderDebtContextLines(view.createdDebts, context.columns - SUBORDINATE_INDENT.length),
|
|
803
800
|
...core.facts,
|
|
804
801
|
]),
|
|
@@ -827,24 +824,24 @@ function answerBytes(answer, structured) {
|
|
|
827
824
|
return !structured && typeof answer === "string" ? answer : JSON.stringify(answer);
|
|
828
825
|
}
|
|
829
826
|
export function askRawAnswer(result, structured) {
|
|
830
|
-
if (result.
|
|
827
|
+
if (result.kind !== "answered")
|
|
831
828
|
return "";
|
|
832
|
-
return answerBytes(result.
|
|
829
|
+
return result.answerUndefined === true ? "undefined" : answerBytes(result.answer, structured === true);
|
|
833
830
|
}
|
|
834
|
-
export function callRawAnswer(result, streamed) {
|
|
835
|
-
const
|
|
836
|
-
if (
|
|
831
|
+
export function callRawAnswer(result, structured, streamed) {
|
|
832
|
+
const input = result.input;
|
|
833
|
+
if (input?.kind !== "answered")
|
|
837
834
|
return streamed ? "" : undefined;
|
|
838
|
-
return answerBytes(
|
|
835
|
+
return "answerUndefined" in input ? "undefined" : answerBytes(input.answer, structured);
|
|
839
836
|
}
|
|
840
837
|
export function historyRawAnswer(result, historyId) {
|
|
841
838
|
if (historyId === undefined)
|
|
842
839
|
return undefined;
|
|
843
|
-
if (result.kind === "
|
|
844
|
-
return result.
|
|
845
|
-
if (result.kind !== "exact")
|
|
840
|
+
if (result.kind === "akuma-report")
|
|
841
|
+
return result.text;
|
|
842
|
+
if (result.kind !== "akuma-exact")
|
|
846
843
|
return undefined;
|
|
847
|
-
const outcome = result.outcome
|
|
844
|
+
const outcome = result.outcome;
|
|
848
845
|
return outcome.kind === "answered" ? outcome.answer : outcome.kind === "canceled" ? "canceled" : outcome.diagnostic;
|
|
849
846
|
}
|
|
850
847
|
/** One compact wait result line: an observed life mark, the complete identity, a bounded summary. */
|
|
@@ -876,10 +873,11 @@ function waitLine(mark, subject, summary, columns) {
|
|
|
876
873
|
* pending input shows its current answered preview or failed diagnostic, else completion. The
|
|
877
874
|
* mark reports the observed life, never continuing liveness.
|
|
878
875
|
*/
|
|
879
|
-
function waitSummary(
|
|
880
|
-
const pending =
|
|
881
|
-
const outcome =
|
|
882
|
-
const
|
|
876
|
+
function waitSummary(member) {
|
|
877
|
+
const pending = member.pending !== undefined;
|
|
878
|
+
const outcome = member.outcome;
|
|
879
|
+
const life = WAIT_LIFE[member.life];
|
|
880
|
+
const observed = life ??
|
|
883
881
|
(pending
|
|
884
882
|
? { mark: "⧗", state: "pending tell" }
|
|
885
883
|
: outcome === undefined
|
|
@@ -893,8 +891,9 @@ function waitSummary(status) {
|
|
|
893
891
|
...observed,
|
|
894
892
|
summary: [
|
|
895
893
|
observed.state,
|
|
896
|
-
...(pending &&
|
|
897
|
-
...(
|
|
894
|
+
...(pending && life !== undefined ? ["pending tell"] : []),
|
|
895
|
+
...(outcome?.kind === "failed" && (life !== undefined || pending) ? [preview(outcome.diagnostic, "failed")] : []),
|
|
896
|
+
...(member.strandedReason === undefined ? [] : [member.strandedReason]),
|
|
898
897
|
].join(FACT_SEPARATOR),
|
|
899
898
|
};
|
|
900
899
|
}
|
|
@@ -904,36 +903,38 @@ function waitSummary(status) {
|
|
|
904
903
|
* visible only as the snapshot's own bounded summary.
|
|
905
904
|
*/
|
|
906
905
|
export function waitText(result, presentation, context) {
|
|
907
|
-
const alias = result.
|
|
908
|
-
return
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
return waitLine(
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
906
|
+
const alias = result.results.length === 1 ? presentation.alias : undefined;
|
|
907
|
+
return result.results
|
|
908
|
+
.map((member) => {
|
|
909
|
+
if (member.kind === "missing")
|
|
910
|
+
return waitLine("!", identity(member.id, alias), "Akuma not found", context.columns);
|
|
911
|
+
if (member.kind === "unobserved")
|
|
912
|
+
return waitLine("!", identity(member.id, alias), `observation failed${FACT_SEPARATOR}${member.diagnostic}`, context.columns);
|
|
913
|
+
const { mark, summary } = waitSummary(member);
|
|
914
|
+
return waitLine(mark, identity(member.id, alias), summary, context.columns);
|
|
915
|
+
})
|
|
916
|
+
.join("\n");
|
|
915
917
|
}
|
|
916
918
|
export function historyText(result, presentation, context) {
|
|
917
919
|
if (presentation.id !== undefined) {
|
|
918
|
-
return
|
|
919
|
-
`${result.kind === "unknown-history" ? result.historyId : "unknown"} has no matching retained history`);
|
|
920
|
+
return historyRawAnswer(result, presentation.id) ?? `${presentation.id} has no matching retained history`;
|
|
920
921
|
}
|
|
921
922
|
if (presentation.last === true)
|
|
922
|
-
return result.kind === "last" ? result.answer : "no answer retained";
|
|
923
|
-
if (result.kind !== "
|
|
923
|
+
return result.kind === "akuma-last" ? result.answer : "no answer retained";
|
|
924
|
+
if (result.kind !== "akuma")
|
|
924
925
|
throw new Error("history result lacks page");
|
|
925
|
-
const rows = groupedRows(result.
|
|
926
|
-
const paging = result.
|
|
927
|
-
? [
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
926
|
+
const rows = groupedRows(result.events, context, { history: true });
|
|
927
|
+
const paging = result.omitted === undefined
|
|
928
|
+
? []
|
|
929
|
+
: [
|
|
930
|
+
omissionMarker(presentation.since !== undefined
|
|
931
|
+
? `${result.omitted} later events · showing first ${result.events.length}`
|
|
932
|
+
: `${result.omitted} earlier events · showing last ${result.events.length}`, context.columns),
|
|
933
|
+
];
|
|
933
934
|
// History is an immutable timeline, so it takes the shared heading and content boundary and
|
|
934
935
|
// never gains a fabricated current-state conclusion or a live mark.
|
|
935
936
|
const content = [...paging, ...rows];
|
|
936
|
-
const head = panelHead(result.
|
|
937
|
+
const head = panelHead(result.akumaId, presentation.alias, undefined);
|
|
937
938
|
return [...head, ...(content.length === 0 ? [] : [frameRule(head, context.columns), ...content])].join("\n");
|
|
938
939
|
}
|
|
939
940
|
/** One bounded, quoted preview of a Tell an outer receipt already admitted, indented beneath it. */
|
|
@@ -949,10 +950,10 @@ export function tellPayloadLines(text, context) {
|
|
|
949
950
|
});
|
|
950
951
|
}
|
|
951
952
|
/** One admitted Tell as a timeline input row inside a shared panel; the panel owns the identity. */
|
|
952
|
-
export function tellAdmissionRow(
|
|
953
|
-
const lead =
|
|
953
|
+
export function tellAdmissionRow(text, context, wake) {
|
|
954
|
+
const lead = wake?.kind === "failed" ? TOP_FAILURE : wake?.kind === "held" || wake?.kind === "pending" ? TOP_PENDING : TOP_INPUT;
|
|
954
955
|
return renderBoundedPayload({
|
|
955
|
-
text
|
|
956
|
+
text,
|
|
956
957
|
first: lead,
|
|
957
958
|
continuation: TOP_CONTINUATION,
|
|
958
959
|
columns: context.columns,
|
|
@@ -961,36 +962,43 @@ export function tellAdmissionRow(tell, context) {
|
|
|
961
962
|
truncated: false,
|
|
962
963
|
})[0];
|
|
963
964
|
}
|
|
965
|
+
export function tellControlLines(result, context) {
|
|
966
|
+
const lines = [];
|
|
967
|
+
const wake = result.wake;
|
|
968
|
+
if (wake?.kind === "failed") {
|
|
969
|
+
lines.push(...diagnosticLines("tell delivery", wake.diagnostic, context.columns - SUBORDINATE_INDENT.length, {
|
|
970
|
+
state: "failed",
|
|
971
|
+
suffix: wake.logPath === undefined ? "" : ` · log ${wake.logPath}`,
|
|
972
|
+
}));
|
|
973
|
+
}
|
|
974
|
+
else if (wake?.kind === "pending")
|
|
975
|
+
lines.push("wake pending");
|
|
976
|
+
const interrupt = result.interrupt;
|
|
977
|
+
if (interrupt !== undefined)
|
|
978
|
+
lines.push(`interrupt ${interrupt.kind} · body/${interrupt.bodySequence}${interrupt.kind === "unavailable" ? ` · ${interrupt.evidence}` : ""}`);
|
|
979
|
+
return lines;
|
|
980
|
+
}
|
|
964
981
|
/**
|
|
965
982
|
* One Tell action receipt: the delivery verdict and complete subject stand whole on the first line
|
|
966
983
|
* with the submitted payload folded onto that same line, bounded so only its preview truncates. A
|
|
967
984
|
* held Tell keeps neutral vocabulary; a failed delivery keeps its concrete diagnosis and native log
|
|
968
985
|
* coordinates as separate supporting facts.
|
|
969
986
|
*/
|
|
970
|
-
export function tellText(result, alias, context) {
|
|
971
|
-
const wake = result.
|
|
972
|
-
const mark = wake
|
|
973
|
-
const verb = wake
|
|
987
|
+
export function tellText(result, prompt, alias, context) {
|
|
988
|
+
const wake = result.wake;
|
|
989
|
+
const mark = wake?.kind === "failed" ? "!" : wake?.kind === "pending" ? "⧗" : "✓";
|
|
990
|
+
const verb = wake?.kind === "failed" || wake?.kind === "pending" ? "tell" : "told";
|
|
974
991
|
const head = actionReceipt({
|
|
975
992
|
mark,
|
|
976
993
|
verb,
|
|
977
|
-
id: result.
|
|
994
|
+
id: result.akumaId,
|
|
978
995
|
...(alias === undefined ? {} : { alias }),
|
|
979
996
|
})[0];
|
|
980
|
-
const preview = safeText(
|
|
997
|
+
const preview = safeText(prompt).replace(/\s+/gu, " ").trim();
|
|
981
998
|
const prefix = `${head} — `;
|
|
982
999
|
// The verdict and identity never truncate, so an over-wide identity still keeps one visible
|
|
983
1000
|
// ellipsis for the input it could not show.
|
|
984
1001
|
const room = Math.max(1, context.columns - displayColumns(prefix));
|
|
985
1002
|
const verdict = preview.length === 0 ? head : `${prefix}${truncateDisplayText(preview, room)}`;
|
|
986
|
-
|
|
987
|
-
return verdict;
|
|
988
|
-
const child = "child" in wake ? wake.child : undefined;
|
|
989
|
-
return [
|
|
990
|
-
verdict,
|
|
991
|
-
...subordinateLines(diagnosticLines("tell delivery", wake.diagnostic, context.columns - SUBORDINATE_INDENT.length, {
|
|
992
|
-
state: "failed",
|
|
993
|
-
suffix: child === undefined ? "" : ` · log ${child.log.path} ${child.log.from}..${child.log.to}`,
|
|
994
|
-
})),
|
|
995
|
-
].join("\n");
|
|
1003
|
+
return [verdict, ...subordinateLines(tellControlLines(result, context))].join("\n");
|
|
996
1004
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import type { ActivityRow
|
|
2
|
-
import type {
|
|
3
|
-
type
|
|
4
|
-
kind: "row";
|
|
5
|
-
}>["row"];
|
|
6
|
-
type ToolRow = Extract<ActivityRow | SnapshotRow | StatusTimelineRow, {
|
|
1
|
+
import type { ActivityRow } from "../../akuma/projection.js";
|
|
2
|
+
import type { StatusPreview } from "../../akuma/status-projection.js";
|
|
3
|
+
type ToolRow = Extract<ActivityRow | StatusPreview, {
|
|
7
4
|
kind: "tool";
|
|
8
5
|
}>;
|
|
9
6
|
/** The bounded body of a generic tool row, including its terminal diagnostic. */
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { normalizeToolCommand } from "./akuma-tool-command.js";
|
|
2
2
|
import { displayColumns, truncateDisplayText } from "./terminal.js";
|
|
3
|
+
function toolInput(row) {
|
|
4
|
+
const input = row.call.kind === "other" ? row.call.input : undefined;
|
|
5
|
+
return typeof input === "string" ? { json: input } : input;
|
|
6
|
+
}
|
|
7
|
+
function toolName(row) {
|
|
8
|
+
return "name" in row ? row.name : row.call.kind;
|
|
9
|
+
}
|
|
3
10
|
/** The bounded body of a generic tool row, including its terminal diagnostic. */
|
|
4
11
|
export function toolContent(row, columns) {
|
|
5
|
-
const input = row
|
|
12
|
+
const input = toolInput(row);
|
|
6
13
|
const diagnostic = toolDiagnostic(row);
|
|
7
14
|
const width = Math.max(0, columns - displayColumns(diagnostic));
|
|
8
15
|
let text;
|
|
@@ -79,13 +86,11 @@ function duration(milliseconds) {
|
|
|
79
86
|
function result(row) {
|
|
80
87
|
if (row.state === "active" || row.state === "unsettled")
|
|
81
88
|
return undefined;
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
: `exit ${row.state.exitCode}`
|
|
86
|
-
: row.state.status;
|
|
89
|
+
const exitCode = "exitCode" in row.state ? row.state.exitCode : undefined;
|
|
90
|
+
const durationMs = "durationMs" in row ? row.durationMs : undefined;
|
|
91
|
+
const disposition = exitCode !== undefined ? (exitCode === 0 ? "ok" : `exit ${exitCode}`) : row.state.status;
|
|
87
92
|
const parts = [
|
|
88
|
-
...(row.call.kind === "run" &&
|
|
93
|
+
...(row.call.kind === "run" && durationMs !== undefined ? [duration(durationMs)] : []),
|
|
89
94
|
...(disposition === "ok" ? [] : [disposition]),
|
|
90
95
|
...(row.state.message === undefined ? [] : [oneLine(row.state.message)]),
|
|
91
96
|
];
|
|
@@ -117,9 +122,10 @@ function searchText(call) {
|
|
|
117
122
|
].join(" · ");
|
|
118
123
|
}
|
|
119
124
|
function inputObject(row) {
|
|
120
|
-
|
|
125
|
+
const input = toolInput(row);
|
|
126
|
+
if (row.call.kind !== "other" || input?.truncated === true)
|
|
121
127
|
return undefined;
|
|
122
|
-
return jsonObject(
|
|
128
|
+
return jsonObject(input?.json ?? "");
|
|
123
129
|
}
|
|
124
130
|
function suppliedSlice(value) {
|
|
125
131
|
const offset = typeof value.offset_chars === "number" ? `from ${value.offset_chars}` : "";
|
|
@@ -130,22 +136,22 @@ function commonOtherText(row) {
|
|
|
130
136
|
const input = inputObject(row);
|
|
131
137
|
if (input === undefined)
|
|
132
138
|
return undefined;
|
|
133
|
-
if (row
|
|
139
|
+
if (toolName(row) === "get_context_remaining")
|
|
134
140
|
return undefined;
|
|
135
|
-
if (row
|
|
141
|
+
if (toolName(row) === "notes_read") {
|
|
136
142
|
const address = typeof input.address === "string" ? input.address : typeof input.path === "string" ? input.path : undefined;
|
|
137
143
|
return [address, suppliedSlice(input)]
|
|
138
144
|
.filter((value) => value !== undefined && value !== "")
|
|
139
145
|
.join(" · ");
|
|
140
146
|
}
|
|
141
|
-
if (row
|
|
147
|
+
if (toolName(row) === "history_read") {
|
|
142
148
|
const item = typeof input.item_id === "string" ? input.item_id : undefined;
|
|
143
149
|
const window = typeof input.window_id === "string" ? input.window_id : undefined;
|
|
144
150
|
return [item, window, suppliedSlice(input)]
|
|
145
151
|
.filter((value) => value !== undefined && value !== "")
|
|
146
152
|
.join(" · ");
|
|
147
153
|
}
|
|
148
|
-
if (row
|
|
154
|
+
if (toolName(row) === "history_list") {
|
|
149
155
|
const role = typeof input.role === "string" ? `role ${input.role}` : undefined;
|
|
150
156
|
const order = input.recent_first === true ? "newest first" : input.recent_first === false ? "oldest first" : undefined;
|
|
151
157
|
const limit = typeof input.limit === "number" ? `${input.limit} rows` : undefined;
|
|
@@ -194,7 +200,7 @@ function toolCore(row) {
|
|
|
194
200
|
case "fileChange":
|
|
195
201
|
return fileChange(row.call, row.state);
|
|
196
202
|
case "other":
|
|
197
|
-
return { label: row
|
|
203
|
+
return { label: toolName(row), text: "" };
|
|
198
204
|
}
|
|
199
205
|
}
|
|
200
206
|
/** Pure provider-neutral tool presentation; it performs no activity selection. */
|