@astrosheep/keiyaku 4.6.30 → 4.6.32
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 +39 -22
- 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 +27 -22
- package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +14 -14
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +15 -13
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +18 -17
- package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +30 -30
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +24 -23
- 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 +27 -22
- package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +14 -14
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +15 -13
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +18 -17
- package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +30 -30
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +24 -23
- 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 +27 -22
- package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +14 -14
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +15 -13
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +18 -17
- package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +30 -30
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +24 -23
- package/build/plugins/pi/README.md +20 -22
- package/build/plugins/pi/akuma-tools.ts +43 -56
- package/build/plugins/pi/keiyaku.ts +15 -4
- package/build/skills/keiyaku/SKILL.md +12 -12
- package/build/skills/keiyaku-akuma/SKILL.md +27 -22
- package/build/skills/keiyaku-akuma/references/automation.md +14 -14
- package/build/skills/keiyaku-babysit/SKILL.md +15 -13
- package/build/skills/keiyaku-bind/SKILL.md +18 -17
- package/build/skills/keiyaku-debt/SKILL.md +30 -30
- package/build/skills/keiyaku-workflow/SKILL.md +24 -23
- package/build/src/akuma/akuma-call.d.ts +4 -6
- package/build/src/akuma/akuma-call.js +12 -15
- package/build/src/akuma/akuma-errors.d.ts +12 -9
- package/build/src/akuma/akuma-errors.js +16 -12
- package/build/src/akuma/akuma-instance.d.ts +102 -23
- package/build/src/akuma/akuma-instance.js +66 -66
- package/build/src/akuma/akuma-observe.d.ts +15 -15
- package/build/src/akuma/akuma-observe.js +34 -32
- package/build/src/akuma/akuma-owner.d.ts +46 -17
- package/build/src/akuma/akuma-owner.js +68 -43
- 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 +992 -5
- package/build/src/akuma/akuma-selection-execution.js +96 -125
- 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 +7 -7
- package/build/src/akuma/akuma-wait.js +52 -14
- package/build/src/akuma/akuma.d.ts +88 -451
- package/build/src/akuma/akuma.js +58 -56
- package/build/src/akuma/archetype.d.ts +31 -21
- package/build/src/akuma/archetype.js +67 -52
- package/build/src/akuma/body-launch.d.ts +2 -2
- package/build/src/akuma/body.js +35 -30
- package/build/src/akuma/call-initial-tell.d.ts +63 -44
- package/build/src/akuma/call-initial-tell.js +50 -3
- package/build/src/akuma/call-input.d.ts +8 -1
- package/build/src/akuma/call-input.js +27 -18
- package/build/src/akuma/caller.d.ts +26 -17
- package/build/src/akuma/caller.js +24 -10
- package/build/src/akuma/coordinate.d.ts +9 -0
- package/build/src/akuma/coordinate.js +13 -0
- package/build/src/akuma/detached-body.js +3 -3
- 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 +32 -9
- package/build/src/akuma/heart/facts.js +18 -5
- 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 +25 -9
- package/build/src/akuma/identity.d.ts +18 -17
- package/build/src/akuma/identity.js +29 -23
- package/build/src/akuma/index.d.ts +7 -9
- package/build/src/akuma/index.js +2 -3
- 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 +662 -569
- package/build/src/akuma/projection.js +203 -94
- package/build/src/akuma/provider-recipe.js +3 -2
- package/build/src/akuma/providers/acp/config.js +11 -10
- package/build/src/akuma/providers/acp/index.js +3 -2
- package/build/src/akuma/providers/codex-app-server/index.js +7 -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/providers/grok-build/index.js +2 -1
- package/build/src/akuma/providers/index.d.ts +0 -1
- package/build/src/akuma/providers/index.js +0 -8
- package/build/src/akuma/providers/paseo/index.js +7 -4
- package/build/src/akuma/providers/pi/index.js +4 -3
- package/build/src/akuma/publication.d.ts +3 -4
- package/build/src/akuma/publication.js +19 -17
- package/build/src/akuma/retention.js +2 -2
- package/build/src/akuma/schema.d.ts +3 -49
- package/build/src/akuma/schema.js +6 -147
- package/build/src/akuma/selection-observation.d.ts +559 -54
- package/build/src/akuma/selection-observation.js +207 -1
- package/build/src/akuma/status-projection.d.ts +52 -0
- package/build/src/akuma/status-projection.js +194 -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/body/amend.js +2 -1
- package/build/src/body/arc.js +3 -2
- package/build/src/body/criteria.js +4 -3
- package/build/src/body/decode.js +2 -1
- package/build/src/body/envelope.js +2 -1
- package/build/src/body/region.d.ts +1 -3
- package/build/src/body/region.js +3 -8
- package/build/src/body-host.d.ts +4 -11
- package/build/src/body-host.js +5 -4
- package/build/src/bounded-list.d.ts +8 -0
- package/build/src/bounded-list.js +11 -1
- package/build/src/cli/commands/akuma-grammar.d.ts +109 -66
- package/build/src/cli/commands/akuma-grammar.js +90 -110
- package/build/src/cli/commands/akuma.d.ts +8 -4
- package/build/src/cli/commands/akuma.js +92 -287
- package/build/src/cli/commands/contract-grammar.d.ts +3 -134
- package/build/src/cli/commands/contract-grammar.js +127 -203
- package/build/src/cli/commands/contract-help.d.ts +26 -21
- package/build/src/cli/commands/contract-help.js +45 -36
- package/build/src/cli/commands/contract.d.ts +6 -15
- package/build/src/cli/commands/contract.js +80 -518
- package/build/src/cli/commands/debt-grammar.d.ts +2 -4
- package/build/src/cli/commands/debt-grammar.js +22 -190
- package/build/src/cli/commands/debt.d.ts +2 -3
- package/build/src/cli/commands/debt.js +41 -334
- package/build/src/cli/commands/report.d.ts +2 -4
- 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 +3 -34
- package/build/src/cli/coordinates.js +13 -129
- package/build/src/cli/main.js +9 -3
- package/build/src/cli/parse.d.ts +78 -7
- package/build/src/cli/parse.js +49 -32
- package/build/src/cli/render/akuma-activity.d.ts +41 -31
- package/build/src/cli/render/akuma-activity.js +262 -349
- package/build/src/cli/render/akuma.d.ts +26 -27
- package/build/src/cli/render/akuma.js +99 -135
- package/build/src/cli/render/catalog.d.ts +3 -9
- package/build/src/cli/render/catalog.js +27 -105
- package/build/src/cli/render/contract-history.d.ts +3 -1
- package/build/src/cli/render/contract-history.js +139 -215
- package/build/src/cli/render/contract-observation.d.ts +36 -30
- package/build/src/cli/render/contract-observation.js +64 -34
- package/build/src/cli/render/contract-wait.js +6 -6
- package/build/src/cli/render/contract.d.ts +39 -6
- package/build/src/cli/render/contract.js +249 -374
- package/build/src/cli/render/debt.d.ts +7 -25
- package/build/src/cli/render/debt.js +74 -210
- 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 +8 -6
- package/build/src/cli/render/kanshi-akuma.js +77 -62
- package/build/src/cli/render/kanshi.d.ts +2 -4
- package/build/src/cli/render/kanshi.js +184 -223
- 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 +46 -43
- package/build/src/cli/render/receipt.js +318 -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 +6 -4
- package/build/src/cli/render/refusal.js +82 -65
- 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 +1 -2
- package/build/src/cli/render/settings.js +8 -17
- package/build/src/cli/render/terminal.d.ts +11 -8
- package/build/src/cli/render/terminal.js +48 -32
- package/build/src/cli/render/verbs.d.ts +6 -0
- package/build/src/cli/render/verbs.js +270 -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 +119 -101
- package/build/src/cli/scan.d.ts +1 -1
- package/build/src/cli/streams.d.ts +2 -9
- package/build/src/cli/streams.js +9 -1
- package/build/src/cli/usage.d.ts +2 -1
- package/build/src/cli/usage.js +3 -2
- package/build/src/contract-guidance.js +2 -2
- package/build/src/contract-worktree.d.ts +2 -15
- package/build/src/contract-worktree.js +20 -44
- package/build/src/core/facts/codec.js +9 -23
- package/build/src/core/facts/errors.d.ts +2 -1
- package/build/src/core/facts/errors.js +3 -3
- package/build/src/core/facts/observation.d.ts +4 -5
- package/build/src/core/facts/observation.js +7 -9
- package/build/src/core/facts/types.d.ts +2 -13
- package/build/src/core/facts/types.js +1 -6
- package/build/src/core/verbs/abandon.d.ts +1 -2
- package/build/src/core/verbs/amend.d.ts +1 -3
- package/build/src/core/verbs/amend.js +3 -3
- package/build/src/core/verbs/arc.d.ts +1 -2
- package/build/src/core/verbs/attestation.d.ts +1 -2
- package/build/src/core/verbs/bind.d.ts +1 -3
- package/build/src/core/verbs/bind.js +5 -5
- package/build/src/core/verbs/deliver.d.ts +4 -4
- package/build/src/core/verbs/deliver.js +2 -2
- package/build/src/core/verbs/placement.d.ts +1 -7
- package/build/src/core/verbs/placement.js +4 -6
- package/build/src/core/verbs/reintegrate.d.ts +1 -3
- package/build/src/core/verbs/reintegrate.js +2 -2
- package/build/src/debt/board.d.ts +70 -134
- package/build/src/debt/board.js +99 -190
- package/build/src/debt/catalog.d.ts +4 -6
- package/build/src/debt/catalog.js +3 -40
- package/build/src/debt/document.d.ts +23 -21
- package/build/src/debt/document.js +32 -58
- package/build/src/debt/identity.d.ts +2 -14
- package/build/src/debt/identity.js +19 -49
- package/build/src/debt/index.d.ts +239 -54
- package/build/src/debt/index.js +85 -88
- package/build/src/debt/input.d.ts +21 -6
- package/build/src/debt/input.js +57 -169
- package/build/src/debt/lifecycle-operations.d.ts +1 -3
- package/build/src/debt/lifecycle-operations.js +6 -86
- package/build/src/debt/operation-types.d.ts +97 -79
- package/build/src/debt/operation-types.js +57 -1
- package/build/src/debt/operations.d.ts +11 -19
- package/build/src/debt/operations.js +70 -191
- package/build/src/debt/store.d.ts +4 -4
- package/build/src/debt/store.js +40 -95
- 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/errors.d.ts +28 -0
- package/build/src/errors.js +26 -0
- package/build/src/git/admission.d.ts +2 -2
- package/build/src/git/admission.js +2 -1
- package/build/src/git/hooks.d.ts +15 -36
- 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/observe.d.ts +3 -0
- package/build/src/git/observe.js +19 -5
- 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 +20 -95
- package/build/src/git/reconcile.js +37 -70
- package/build/src/git/repository.d.ts +2 -1
- package/build/src/git/repository.js +3 -3
- 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 +27 -35
- package/build/src/git/target-placement.js +42 -27
- package/build/src/git/target.d.ts +4 -4
- package/build/src/git/target.js +2 -1
- package/build/src/git/tender.d.ts +8 -41
- package/build/src/git/tender.js +26 -66
- 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/coordinates.d.ts +1 -1
- package/build/src/identity/coordinates.js +3 -2
- package/build/src/identity/normalize.js +2 -1
- package/build/src/identity/selector.d.ts +2 -0
- package/build/src/identity/selector.js +17 -6
- package/build/src/index.d.ts +37 -66
- package/build/src/index.js +10 -47
- package/build/src/kanshi/counts.d.ts +44 -15
- package/build/src/kanshi/counts.js +18 -15
- package/build/src/kanshi/index.d.ts +22 -7
- package/build/src/kanshi/index.js +30 -3
- package/build/src/kanshi/read.d.ts +309 -15
- package/build/src/kanshi/read.js +226 -535
- package/build/src/kanshi/report.d.ts +1225 -103
- package/build/src/kanshi/report.js +153 -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 +17 -17
- package/build/src/library/address.js +41 -34
- package/build/src/library/akuma-creation.d.ts +828 -91
- package/build/src/library/akuma-creation.js +292 -273
- 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 +33 -10
- package/build/src/library/akumas.js +109 -25
- package/build/src/library/bind.d.ts +32 -61
- package/build/src/library/bind.js +8 -12
- package/build/src/library/continuation.d.ts +133 -505
- package/build/src/library/continuation.js +37 -29
- package/build/src/library/contract-address.d.ts +8 -10
- package/build/src/library/contract-address.js +16 -23
- package/build/src/library/contract-composition.d.ts +18 -13
- package/build/src/library/contract-composition.js +62 -61
- package/build/src/library/contract-creation.d.ts +3 -2
- package/build/src/library/contract-creation.js +54 -49
- package/build/src/library/contract-outcomes.d.ts +2365 -43
- package/build/src/library/contract-outcomes.js +73 -16
- package/build/src/library/contract-settings.d.ts +3 -4
- package/build/src/library/contract-settings.js +21 -19
- package/build/src/library/contract-types.d.ts +227 -75
- package/build/src/library/contract-types.js +90 -1
- package/build/src/library/contract-wait.d.ts +75 -17
- package/build/src/library/contract-wait.js +61 -24
- package/build/src/library/delivery.d.ts +566 -37
- package/build/src/library/delivery.js +16 -28
- package/build/src/library/input.d.ts +31 -5
- package/build/src/library/input.js +40 -41
- package/build/src/library/invocation.d.ts +18 -12
- package/build/src/library/invocation.js +98 -96
- package/build/src/library/kei.d.ts +56 -0
- package/build/src/library/kei.js +696 -0
- package/build/src/{cli/delivery-identity.js → library/keiyaku-attribution.js} +1 -1
- package/build/src/library/keiyaku-classify.d.ts +11 -0
- package/build/src/library/keiyaku-classify.js +127 -0
- package/build/src/library/keiyaku-coordinates.d.ts +26 -0
- package/build/src/library/keiyaku-coordinates.js +83 -0
- package/build/src/library/keiyaku-debt.d.ts +70 -0
- package/build/src/library/keiyaku-debt.js +39 -0
- package/build/src/library/keiyaku-identity.d.ts +58 -0
- package/build/src/library/keiyaku-identity.js +177 -0
- package/build/src/library/keiyaku-verbs.d.ts +6893 -0
- package/build/src/library/keiyaku-verbs.js +496 -0
- package/build/src/library/keiyaku.d.ts +41 -38
- package/build/src/library/keiyaku.js +590 -127
- package/build/src/library/nuke.d.ts +25 -1
- package/build/src/library/nuke.js +9 -2
- package/build/src/library/outcome.d.ts +867 -736
- package/build/src/library/outcome.js +431 -211
- package/build/src/library/reconcile.d.ts +652 -116
- package/build/src/library/reconcile.js +146 -108
- package/build/src/library/refusal.d.ts +118 -590
- package/build/src/library/refusal.js +54 -51
- package/build/src/library/region.d.ts +5 -24
- package/build/src/library/region.js +6 -21
- package/build/src/library/repo.js +4 -3
- package/build/src/library/selection.d.ts +205 -45
- package/build/src/library/selection.js +139 -128
- package/build/src/mcp/adapter.d.ts +17 -0
- package/build/src/mcp/adapter.js +241 -0
- package/build/src/mcp/help.d.ts +1 -0
- package/build/src/mcp/help.js +31 -0
- package/build/src/mcp/index.d.ts +2 -0
- package/build/src/mcp/index.js +37 -0
- package/build/src/mcp/output.d.ts +385 -0
- package/build/src/mcp/output.js +193 -0
- package/build/src/plugin/public.d.ts +5 -1
- package/build/src/plugin/runtime.d.ts +1 -1
- package/build/src/plugin/runtime.js +19 -16
- package/build/src/protocol/amend.d.ts +1 -1
- package/build/src/protocol/amend.js +2 -2
- 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 +10 -13
- package/build/src/protocol/bind.js +12 -8
- package/build/src/protocol/completion.d.ts +412 -13
- package/build/src/protocol/completion.js +202 -28
- package/build/src/protocol/deliver.d.ts +35 -28
- package/build/src/protocol/deliver.js +52 -80
- package/build/src/protocol/delivery-preview.d.ts +102 -250
- package/build/src/protocol/delivery-preview.js +134 -130
- package/build/src/protocol/execution-observation.d.ts +136 -121
- package/build/src/protocol/execution-observation.js +9 -6
- package/build/src/protocol/intent.d.ts +14 -56
- package/build/src/protocol/intent.js +46 -73
- package/build/src/protocol/operations.d.ts +240 -543
- package/build/src/protocol/operations.js +89 -151
- package/build/src/protocol/outcome.d.ts +3 -1
- package/build/src/protocol/placement.d.ts +1 -3
- package/build/src/protocol/placement.js +6 -3
- package/build/src/protocol/progress.d.ts +8 -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 +386 -98
- package/build/src/protocol/read/status.js +400 -139
- package/build/src/protocol/reconcile.d.ts +2 -0
- package/build/src/protocol/reconcile.js +12 -11
- package/build/src/protocol/reintegrate.d.ts +1 -3
- package/build/src/protocol/reintegrate.js +4 -5
- package/build/src/protocol/result-leaves.d.ts +507 -0
- package/build/src/protocol/result-leaves.js +156 -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 -15
- package/build/src/protocol/run.d.ts +4 -4
- package/build/src/protocol/run.js +4 -1
- package/build/src/protocol/verify.d.ts +406 -31
- package/build/src/protocol/verify.js +137 -34
- 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 +133 -40
- package/build/src/settings.js +122 -46
- package/build/src/settlement/holder.js +2 -2
- package/build/src/settlement/settle.d.ts +29 -18
- package/build/src/settlement/settle.js +22 -19
- package/build/src/verification/declaration.d.ts +4 -9
- package/build/src/verification/declaration.js +5 -10
- package/build/src/verification/execution.d.ts +7 -19
- package/build/src/verification/execution.js +37 -16
- package/build/src/verification/observation.d.ts +11 -11
- package/build/src/verification/observation.js +9 -7
- package/build/src/world.d.ts +11 -2
- package/build/src/world.js +12 -6
- package/package.json +6 -5
- package/plugins/paseo/plugin/index.server.ts +1 -1
- package/plugins/paseo/plugin/server/attach.ts +74 -67
- package/plugins/paseo/plugin/server/keiyaku.ts +73 -40
- package/plugins/paseo/plugin/server/message.ts +9 -30
- package/plugins/paseo/plugin/server/mirror-identity.ts +6 -4
- 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 +12 -6
- package/plugins/paseo/plugin/server/transport.ts +24 -1
- package/plugins/pi/README.md +20 -22
- package/plugins/pi/akuma-tools.ts +43 -56
- package/plugins/pi/keiyaku.ts +15 -4
- package/skills/keiyaku/SKILL.md +12 -12
- package/skills/keiyaku-akuma/SKILL.md +27 -22
- package/skills/keiyaku-akuma/references/automation.md +14 -14
- package/skills/keiyaku-babysit/SKILL.md +15 -13
- package/skills/keiyaku-bind/SKILL.md +18 -17
- package/skills/keiyaku-debt/SKILL.md +30 -30
- package/skills/keiyaku-workflow/SKILL.md +24 -23
- package/build/src/akuma/providers/codex-app-server/configuration.d.ts +0 -5
- package/build/src/akuma/providers/codex-app-server/configuration.js +0 -72
- 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/commands/debt-query.d.ts +0 -5
- package/build/src/cli/commands/debt-query.js +0 -194
- package/build/src/cli/render/akuma-tool-command.d.ts +0 -6
- package/build/src/cli/render/akuma-tool-command.js +0 -143
- package/build/src/cli/render/akuma-tool.d.ts +0 -32
- package/build/src/cli/render/akuma-tool.js +0 -219
- 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/debt/context.d.ts +0 -16
- package/build/src/debt/context.js +0 -91
- package/build/src/debt/created-observation.d.ts +0 -38
- package/build/src/debt/created-observation.js +0 -30
- package/build/src/debt/query.d.ts +0 -76
- package/build/src/debt/query.js +0 -292
- package/build/src/library/contract-execution.d.ts +0 -28
- package/build/src/library/contract-execution.js +0 -467
- package/build/src/markdown/diff.d.ts +0 -1
- package/build/src/markdown/diff.js +0 -4
- /package/build/src/{cli/delivery-identity.d.ts → library/keiyaku-attribution.d.ts} +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { defaultWaitComplete } from "../../akuma/akuma-observe.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { DEFAULT_CLI_COLUMNS, diagnosticLines, displayColumns, padToDisplay, renderBoundedPayload, renderBoundedTextBlock, safeText, takeDisplayColumns, takeDisplayColumnsFromEnd, truncateDisplayText, truncateMiddleDisplayText, } from "./terminal.js";
|
|
2
|
+
import { parseExactHistorySelector } from "../../akuma/identity.js";
|
|
3
|
+
import { renderDiffstat, toolRepr } from "../../akuma/status-projection.js";
|
|
4
|
+
import { ageText, DEFAULT_CLI_COLUMNS, diagnosticLines, displayColumns, padToDisplay, renderBoundedPayload, safeText, truncateDisplayText, } from "./terminal.js";
|
|
6
5
|
export const DEFAULT_CONTEXT = { columns: DEFAULT_CLI_COLUMNS, color: false };
|
|
7
6
|
/** The action family's fixed 3-cell state margin and minimum verb cell. */
|
|
8
7
|
const ACTION_MARGIN = " ";
|
|
@@ -75,7 +74,7 @@ function toolMargin(row, live) {
|
|
|
75
74
|
return "? ";
|
|
76
75
|
return row.state.status === "ok" ? ACTION_MARGIN : "! ";
|
|
77
76
|
}
|
|
78
|
-
function rowText(row
|
|
77
|
+
function rowText(row) {
|
|
79
78
|
if (row.kind === "report" ||
|
|
80
79
|
row.kind === "said" ||
|
|
81
80
|
row.kind === "thought" ||
|
|
@@ -91,18 +90,7 @@ function rowText(row, tool) {
|
|
|
91
90
|
return row.outcome.kind === "answered"
|
|
92
91
|
? { text: row.outcome.answer, lines: 3 }
|
|
93
92
|
: { text: row.outcome.kind === "canceled" ? "canceled" : row.outcome.diagnostic, lines: 2 };
|
|
94
|
-
|
|
95
|
-
return { text: "", lines: 1 };
|
|
96
|
-
if (row.kind !== "tool")
|
|
97
|
-
return { text: "", lines: 1 };
|
|
98
|
-
if (row.call.kind === "other")
|
|
99
|
-
return { text: "", lines: 1 };
|
|
100
|
-
const repr = tool;
|
|
101
|
-
return {
|
|
102
|
-
text: repr.text,
|
|
103
|
-
lines: 1,
|
|
104
|
-
...(repr.suffix === undefined ? {} : { suffix: repr.suffix }),
|
|
105
|
-
};
|
|
93
|
+
return { text: "", lines: 1 };
|
|
106
94
|
}
|
|
107
95
|
/**
|
|
108
96
|
* The action family's one prefix: a state margin, a verb cell at least six cells wide and as wide as a
|
|
@@ -112,15 +100,22 @@ function actionPrefix(margin, verb, columns) {
|
|
|
112
100
|
const available = Math.max(0, columns - displayColumns(margin) - 1);
|
|
113
101
|
const width = Math.min(Math.max(ACTION_VERB_WIDTH, displayColumns(verb)), available);
|
|
114
102
|
const label = truncateDisplayText(verb, width);
|
|
115
|
-
return {
|
|
103
|
+
return {
|
|
104
|
+
first: `${margin}${padToDisplay(label, width)} `,
|
|
105
|
+
continuation: " ".repeat(displayColumns(margin) + width + 1),
|
|
106
|
+
};
|
|
116
107
|
}
|
|
117
108
|
function rowPrefix(row, tool, columns, view) {
|
|
118
109
|
if (row.kind === "tool")
|
|
119
110
|
return actionPrefix(toolMargin(row, view.live === true), tool.label, columns);
|
|
120
111
|
if (row.kind === "thought")
|
|
121
112
|
return actionPrefix(ACTION_MARGIN, "think", columns);
|
|
122
|
-
if (row.kind === "report")
|
|
123
|
-
|
|
113
|
+
if (row.kind === "report") {
|
|
114
|
+
if (view.history !== true)
|
|
115
|
+
return actionPrefix(ACTION_MARGIN, "report", columns);
|
|
116
|
+
const first = `${ACTION_MARGIN}report/${row.sequence} `;
|
|
117
|
+
return { first, continuation: " ".repeat(displayColumns(first)) };
|
|
118
|
+
}
|
|
124
119
|
if (row.kind === "note")
|
|
125
120
|
return actionPrefix(ACTION_MARGIN, "note", columns);
|
|
126
121
|
if (row.kind === "outcome")
|
|
@@ -134,116 +129,54 @@ function rowPrefix(row, tool, columns, view) {
|
|
|
134
129
|
return { first: TOP_PENDING, continuation: TOP_CONTINUATION };
|
|
135
130
|
return { first: TOP_INPUT, continuation: TOP_CONTINUATION };
|
|
136
131
|
}
|
|
137
|
-
function pathTail(path, maximum) {
|
|
138
|
-
if (displayColumns(path) <= maximum)
|
|
139
|
-
return path;
|
|
140
|
-
if (maximum <= 1)
|
|
141
|
-
return maximum === 1 ? "…" : "";
|
|
142
|
-
const separator = path.includes("\\") && !path.includes("/") ? "\\" : "/";
|
|
143
|
-
const parts = path.split(/[\\/]/u);
|
|
144
|
-
const basename = parts.pop() ?? path;
|
|
145
|
-
let tail = basename;
|
|
146
|
-
const marker = `…${separator}`;
|
|
147
|
-
for (const parent of parts.reverse()) {
|
|
148
|
-
if (parent.length === 0)
|
|
149
|
-
continue;
|
|
150
|
-
const candidate = `${parent}${separator}${tail}`;
|
|
151
|
-
if (displayColumns(`${marker}${candidate}`) > maximum)
|
|
152
|
-
break;
|
|
153
|
-
tail = candidate;
|
|
154
|
-
}
|
|
155
|
-
if (displayColumns(`${marker}${tail}`) <= maximum)
|
|
156
|
-
return `${marker}${tail}`;
|
|
157
|
-
return `…${takeDisplayColumnsFromEnd(path, maximum - 1).text}`;
|
|
158
|
-
}
|
|
159
|
-
function renderPathPreview(first, text, pathPreview, columns) {
|
|
160
|
-
const available = Math.max(0, columns - displayColumns(first));
|
|
161
|
-
if (displayColumns(text) <= available)
|
|
162
|
-
return `${first}${text}`;
|
|
163
|
-
const before = pathPreview.before;
|
|
164
|
-
const detail = pathPreview.detail;
|
|
165
|
-
const diagnostic = pathPreview.diagnostic ?? "";
|
|
166
|
-
const descriptorWidth = displayColumns(before) + displayColumns(detail);
|
|
167
|
-
let renderedDetail = detail;
|
|
168
|
-
if (descriptorWidth >= available) {
|
|
169
|
-
const detailBudget = Math.max(0, available - displayColumns(before) - 1);
|
|
170
|
-
renderedDetail = truncateDisplayText(detail, detailBudget);
|
|
171
|
-
}
|
|
172
|
-
const pathWidth = Math.max(0, available - displayColumns(before) - displayColumns(renderedDetail));
|
|
173
|
-
const renderedPath = pathTail(pathPreview.path, pathWidth);
|
|
174
|
-
const base = `${before}${renderedPath}${renderedDetail}`;
|
|
175
|
-
const remainder = Math.max(0, available - displayColumns(base));
|
|
176
|
-
const renderedDiagnostic = remainder > 0 ? truncateDisplayText(diagnostic, remainder) : "";
|
|
177
|
-
return `${first}${base}${renderedDiagnostic}`;
|
|
178
|
-
}
|
|
179
|
-
function renderRunCommand(first, continuation, text, suffix, columns) {
|
|
180
|
-
const firstBudget = Math.max(0, columns - displayColumns(first));
|
|
181
|
-
const secondBudget = Math.max(0, columns - displayColumns(continuation));
|
|
182
|
-
if (displayColumns(`${text}${suffix}`) <= firstBudget)
|
|
183
|
-
return [`${first}${text}${suffix}`];
|
|
184
|
-
const command = text.startsWith("$ ") ? text.slice(2) : text;
|
|
185
|
-
const firstPart = takeDisplayColumns(command, Math.max(0, firstBudget - 2));
|
|
186
|
-
const restWidth = displayColumns(firstPart.rest) + displayColumns(suffix);
|
|
187
|
-
if (restWidth <= secondBudget) {
|
|
188
|
-
return [`${first}$ ${firstPart.text}`, `${continuation}${firstPart.rest}${suffix}`];
|
|
189
|
-
}
|
|
190
|
-
const suffixBudget = Math.min(displayColumns(suffix), Math.max(0, secondBudget - 8));
|
|
191
|
-
const keptSuffix = suffixBudget > 0 ? truncateDisplayText(suffix, suffixBudget) : "";
|
|
192
|
-
const tailBudget = Math.max(0, secondBudget - displayColumns(keptSuffix) - 1);
|
|
193
|
-
const headBudget = Math.max(0, firstBudget - 3);
|
|
194
|
-
const head = takeDisplayColumns(command, headBudget).text;
|
|
195
|
-
const tail = takeDisplayColumnsFromEnd(command, tailBudget).text;
|
|
196
|
-
return [`${first}$ ${head}…`, `${continuation}…${tail}${keptSuffix}`];
|
|
197
|
-
}
|
|
198
132
|
function omissionMarker(text, columns) {
|
|
199
133
|
return `${actionPrefix(ACTION_MARGIN, OMISSION, columns).first}${text}`;
|
|
200
134
|
}
|
|
201
|
-
function rowBody(row, text, columns) {
|
|
202
|
-
if (row.kind !== "tool" || row.call.kind !== "other")
|
|
203
|
-
return text;
|
|
204
|
-
return toolContent(row, columns);
|
|
205
|
-
}
|
|
206
|
-
function tailAnswerPreview(first, text, columns) {
|
|
207
|
-
const readable = safeText(text).replace(/\s+/gu, " ").trim();
|
|
208
|
-
const budget = Math.max(0, columns - displayColumns(first));
|
|
209
|
-
const tail = takeDisplayColumnsFromEnd(readable, budget).text;
|
|
210
|
-
const preview = tail.length === readable.length ? tail : `…${takeDisplayColumnsFromEnd(readable, Math.max(0, budget - 1)).text}`;
|
|
211
|
-
return [`${first}${preview}`];
|
|
212
|
-
}
|
|
213
|
-
function renderCommandOverflow(first, continuation, value, columns, view) {
|
|
214
|
-
const suffix = value.suffix ?? "";
|
|
215
|
-
if (view.compact !== true && view.history !== true)
|
|
216
|
-
return renderRunCommand(first, continuation, value.text, suffix, columns);
|
|
217
|
-
const remaining = columns - displayColumns(first);
|
|
218
|
-
const withSuffix = remaining - displayColumns(suffix);
|
|
219
|
-
const showSuffix = suffix.length > 0 && withSuffix >= 6;
|
|
220
|
-
return [
|
|
221
|
-
`${first}${truncateMiddleDisplayText(value.text, Math.max(0, showSuffix ? withSuffix : remaining))}${showSuffix ? suffix : ""}`,
|
|
222
|
-
];
|
|
223
|
-
}
|
|
224
135
|
/** Every selected timeline row renders through here: one prefix family per row class. */
|
|
225
136
|
function renderRow(row, context, view = {}) {
|
|
226
137
|
const tool = row.kind === "tool" ? toolRepr(row) : undefined;
|
|
227
|
-
const value = rowText(row, tool);
|
|
228
138
|
const { first, continuation } = rowPrefix(row, tool, context.columns, view);
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
return
|
|
236
|
-
|
|
237
|
-
|
|
139
|
+
const value = row.kind === "tool" ? undefined : rowText(row);
|
|
140
|
+
const text = tool === undefined ? value.text : tool.text;
|
|
141
|
+
if (view.history === true && row.kind === "outcome") {
|
|
142
|
+
const heading = `${first}turn/${row.turnSequence}`;
|
|
143
|
+
if (row.outcome.kind === "canceled")
|
|
144
|
+
return [`${heading} · canceled`];
|
|
145
|
+
return [
|
|
146
|
+
heading,
|
|
147
|
+
...(text === ""
|
|
148
|
+
? []
|
|
149
|
+
: renderBoundedPayload({
|
|
150
|
+
text,
|
|
151
|
+
first: TOP_CONTINUATION,
|
|
152
|
+
continuation: TOP_CONTINUATION,
|
|
153
|
+
columns: context.columns,
|
|
154
|
+
maxLines: Number.MAX_SAFE_INTEGER,
|
|
155
|
+
quote: "",
|
|
156
|
+
preserveLines: true,
|
|
157
|
+
truncated: "truncated" in row && row.truncated === true,
|
|
158
|
+
})),
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
const singleLine = tool !== undefined || row.kind === "call" || row.kind === "tell" || row.kind === "turn";
|
|
238
162
|
return renderBoundedPayload({
|
|
239
|
-
text
|
|
163
|
+
text,
|
|
240
164
|
first,
|
|
241
165
|
continuation,
|
|
242
166
|
columns: context.columns,
|
|
243
167
|
maxLines: singleLine ? 1 : view.history === true ? Number.MAX_SAFE_INTEGER : value.lines,
|
|
244
168
|
quote: "",
|
|
245
169
|
truncated: "truncated" in row && row.truncated === true,
|
|
246
|
-
...(singleLine
|
|
170
|
+
...(singleLine ? {} : { preserveLines: true }),
|
|
171
|
+
...(tool === undefined
|
|
172
|
+
? {}
|
|
173
|
+
: {
|
|
174
|
+
trailer: {
|
|
175
|
+
text: tool.suffix,
|
|
176
|
+
diagnostic: tool.diagnostic,
|
|
177
|
+
complete: view.history === true,
|
|
178
|
+
},
|
|
179
|
+
}),
|
|
247
180
|
});
|
|
248
181
|
}
|
|
249
182
|
function groupedEntries(entries, context, view = {}) {
|
|
@@ -260,23 +193,6 @@ function groupedEntries(entries, context, view = {}) {
|
|
|
260
193
|
function groupedRows(rows, context, view = {}) {
|
|
261
194
|
return groupedEntries(rows.filter((row) => row.kind !== "turn").map((row) => ({ kind: "row", row })), context, view);
|
|
262
195
|
}
|
|
263
|
-
/** Ordered entry stream of one retained snapshot; an idle outcome keeps its sequence position. */
|
|
264
|
-
function orderedSnapshotEntries(snapshot) {
|
|
265
|
-
if (snapshot.kind !== "idle" || snapshot.outcome === undefined)
|
|
266
|
-
return snapshot.entries;
|
|
267
|
-
const entries = [];
|
|
268
|
-
let outcomeInserted = false;
|
|
269
|
-
for (const entry of snapshot.entries) {
|
|
270
|
-
if (!outcomeInserted && entry.kind === "row" && entry.row.sequence > snapshot.outcome.sequence) {
|
|
271
|
-
entries.push({ kind: "row", row: snapshot.outcome });
|
|
272
|
-
outcomeInserted = true;
|
|
273
|
-
}
|
|
274
|
-
entries.push(entry);
|
|
275
|
-
}
|
|
276
|
-
if (!outcomeInserted)
|
|
277
|
-
entries.push({ kind: "row", row: snapshot.outcome });
|
|
278
|
-
return entries;
|
|
279
|
-
}
|
|
280
196
|
function currentTurnBoundary(activity) {
|
|
281
197
|
const snapshot = activity.snapshot;
|
|
282
198
|
if (snapshot.kind !== "open" || snapshot.openingSequence === undefined)
|
|
@@ -287,43 +203,7 @@ function currentTurnBoundary(activity) {
|
|
|
287
203
|
// The projector selects a typed opening: its call or delivered launch Tell.
|
|
288
204
|
if (row.kind !== "call" && !(row.kind === "tell" && row.state === "told"))
|
|
289
205
|
return undefined;
|
|
290
|
-
return { row, turnSequence: snapshot.turn.
|
|
291
|
-
}
|
|
292
|
-
/** Open status hides internal thought narration without selecting a second activity window. */
|
|
293
|
-
function visibleOpenSnapshotEntries(snapshot) {
|
|
294
|
-
return snapshot.entries.filter((entry) => entry.kind !== "row" || entry.row.kind !== "thought");
|
|
295
|
-
}
|
|
296
|
-
/** Adjacent omitted spans are one continuous unknown portion of the retained timeline. */
|
|
297
|
-
function coalesceAdjacentGaps(entries) {
|
|
298
|
-
return entries.reduce((coalesced, entry) => {
|
|
299
|
-
const previous = coalesced.at(-1);
|
|
300
|
-
if (entry.kind === "gap" && previous?.kind === "gap") {
|
|
301
|
-
coalesced[coalesced.length - 1] = { kind: "gap", count: previous.count + entry.count };
|
|
302
|
-
}
|
|
303
|
-
else {
|
|
304
|
-
coalesced.push(entry);
|
|
305
|
-
}
|
|
306
|
-
return coalesced;
|
|
307
|
-
}, []);
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Shared snapshot activity rendering. Full snapshots render the selected
|
|
311
|
-
* activity evidence; an idle snapshot is settled evidence. `latest` preserves
|
|
312
|
-
* compact callers' established newest-entry selection.
|
|
313
|
-
*/
|
|
314
|
-
export function snapshotActivityLines(snapshot, context, selection = {}) {
|
|
315
|
-
const entries = orderedSnapshotEntries(snapshot);
|
|
316
|
-
if (selection.latest !== true) {
|
|
317
|
-
const full = snapshot.kind === "open" ? visibleOpenSnapshotEntries(snapshot) : entries;
|
|
318
|
-
return groupedEntries(coalesceAdjacentGaps(full), context);
|
|
319
|
-
}
|
|
320
|
-
const latest = entries.filter((entry) => entry.kind === "row").at(-1);
|
|
321
|
-
return latest === undefined
|
|
322
|
-
? []
|
|
323
|
-
: groupedEntries([latest], context, {
|
|
324
|
-
compact: true,
|
|
325
|
-
...(selection.tailAnswer === true ? { tailAnswer: true } : {}),
|
|
326
|
-
});
|
|
206
|
+
return { row, turnSequence: snapshot.turn.sequence };
|
|
327
207
|
}
|
|
328
208
|
function isSettledStreamRow(row) {
|
|
329
209
|
if (row.kind === "turn" || row.kind === "outcome")
|
|
@@ -521,6 +401,17 @@ export function activityStream(context) {
|
|
|
521
401
|
flush: () => render(flush()),
|
|
522
402
|
});
|
|
523
403
|
}
|
|
404
|
+
function lifeConclusion(life, pending) {
|
|
405
|
+
if (life === "running")
|
|
406
|
+
return { mark: "●", verb: "running" };
|
|
407
|
+
if (life === "asleep")
|
|
408
|
+
return pending ? { mark: "⧗", verb: "pending tell" } : { mark: "✓", verb: "completed" };
|
|
409
|
+
if (life === "killed")
|
|
410
|
+
return { mark: "×", verb: "killed" };
|
|
411
|
+
if (life === "hung")
|
|
412
|
+
return { mark: "?", verb: "hung" };
|
|
413
|
+
return { mark: "!", verb: life };
|
|
414
|
+
}
|
|
524
415
|
function conclusionMarkVerb(status, outcome) {
|
|
525
416
|
if (outcome === "failed" || (status !== undefined && failedOutcomeDiagnostic(status) !== undefined))
|
|
526
417
|
return { mark: "!", verb: "failed" };
|
|
@@ -530,20 +421,7 @@ function conclusionMarkVerb(status, outcome) {
|
|
|
530
421
|
return { mark: "○", verb: "unanswered" };
|
|
531
422
|
if (status === undefined)
|
|
532
423
|
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" };
|
|
424
|
+
return lifeConclusion(status.life, !defaultWaitComplete(status));
|
|
547
425
|
}
|
|
548
426
|
function durationText(durationMs) {
|
|
549
427
|
const seconds = Math.max(0, Math.round(durationMs / 1000));
|
|
@@ -561,19 +439,21 @@ function waitConclusionRow(input) {
|
|
|
561
439
|
? input.at !== undefined && input.at >= input.startedAt
|
|
562
440
|
? ` — ${durationText(Math.max(0, input.at - input.startedAt))}`
|
|
563
441
|
: ""
|
|
564
|
-
:
|
|
442
|
+
: input.end === undefined || !Number.isFinite(input.startedAt)
|
|
443
|
+
? ""
|
|
444
|
+
: ` — waited ${durationText(Math.max(0, input.end - input.startedAt))}`;
|
|
565
445
|
return `${input.mark} ${input.verb}${duration}`;
|
|
566
446
|
}
|
|
567
447
|
export function inputWaitConclusion(observation, input) {
|
|
568
|
-
const end = input.now
|
|
569
|
-
const complete = observation.
|
|
448
|
+
const end = input.now;
|
|
449
|
+
const complete = observation.kind !== "deadline";
|
|
570
450
|
const pinned = input.completedAt == null ? Number.NaN : Date.parse(input.completedAt);
|
|
571
451
|
const at = complete ? (Number.isFinite(pinned) ? pinned : undefined) : end;
|
|
572
|
-
const conclusion = conclusionMarkVerb(input.status, observation.
|
|
452
|
+
const conclusion = conclusionMarkVerb(input.status, observation.kind === "answered"
|
|
573
453
|
? "answered"
|
|
574
|
-
: observation.
|
|
454
|
+
: observation.kind === "failed" || observation.kind === "invalid-output"
|
|
575
455
|
? "failed"
|
|
576
|
-
: observation.
|
|
456
|
+
: observation.kind === "unanswered"
|
|
577
457
|
? "unanswered"
|
|
578
458
|
: "life");
|
|
579
459
|
return [
|
|
@@ -581,10 +461,10 @@ export function inputWaitConclusion(observation, input) {
|
|
|
581
461
|
...(at === undefined ? {} : { at }),
|
|
582
462
|
startedAt: input.startedAt,
|
|
583
463
|
complete,
|
|
584
|
-
end,
|
|
464
|
+
...(end === undefined ? {} : { end }),
|
|
585
465
|
...conclusion,
|
|
586
466
|
}),
|
|
587
|
-
...(observation.
|
|
467
|
+
...(observation.kind === "failed" || observation.kind === "invalid-output"
|
|
588
468
|
? [`! ${safeText(observation.diagnostic)}`]
|
|
589
469
|
: []),
|
|
590
470
|
];
|
|
@@ -611,7 +491,7 @@ export function inputWaitStream(context, head, options) {
|
|
|
611
491
|
if (admitted)
|
|
612
492
|
throw new Error("input wait admitted more than once");
|
|
613
493
|
const pinned = input.at === undefined ? Number.NaN : Date.parse(input.at);
|
|
614
|
-
startedAt = Number.isFinite(pinned) ? pinned : now();
|
|
494
|
+
startedAt = Number.isFinite(pinned) ? pinned : (now() ?? Number.NaN);
|
|
615
495
|
admittedSequence = input.sequence;
|
|
616
496
|
admitted = true;
|
|
617
497
|
if (input.rows.length === 0)
|
|
@@ -652,15 +532,19 @@ export function inputWaitStream(context, head, options) {
|
|
|
652
532
|
if (result.kind === "failed" && result.evidence !== undefined)
|
|
653
533
|
lines.push(...result.evidence);
|
|
654
534
|
lines.push(...activity.flush());
|
|
655
|
-
if (result.kind === "failed")
|
|
656
|
-
|
|
657
|
-
|
|
535
|
+
if (result.kind === "failed") {
|
|
536
|
+
if (result.diagnostic !== undefined)
|
|
537
|
+
lines.push(`! ${safeText(result.diagnostic)}`);
|
|
538
|
+
}
|
|
539
|
+
else {
|
|
540
|
+
const currentTime = now();
|
|
658
541
|
lines.push(...inputWaitConclusion(result.observation, {
|
|
659
542
|
startedAt,
|
|
660
543
|
...(result.completedAt === undefined ? {} : { completedAt: result.completedAt }),
|
|
661
|
-
now:
|
|
544
|
+
...(currentTime === undefined ? {} : { now: currentTime }),
|
|
662
545
|
...(lastStatus === undefined ? {} : { status: lastStatus }),
|
|
663
546
|
}));
|
|
547
|
+
}
|
|
664
548
|
lines.push(...subordinateLines(head().facts));
|
|
665
549
|
return `${lines.join("\n")}${options.answerSeparator === true ? "\n\n" : ""}`;
|
|
666
550
|
};
|
|
@@ -673,135 +557,107 @@ export function callObservationStream(context, head, options = {}) {
|
|
|
673
557
|
...(options.now === undefined ? {} : { now: options.now }),
|
|
674
558
|
});
|
|
675
559
|
stream.admitted({ ...(options.admittedAt === undefined ? {} : { at: options.admittedAt }), rows: [] });
|
|
676
|
-
/** Tell rows already settled on the timeline, so a failed close never replays one. */
|
|
677
560
|
const settledTells = new Set();
|
|
678
561
|
return {
|
|
679
562
|
...stream,
|
|
680
563
|
observe: (observation) => {
|
|
681
564
|
for (const row of observation.rows)
|
|
682
565
|
if (row.kind === "tell" && row.state === "told")
|
|
683
|
-
settledTells.add(row.
|
|
566
|
+
settledTells.add(row.tellId);
|
|
684
567
|
return stream.observe(observation);
|
|
685
568
|
},
|
|
686
|
-
conclude: (
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
569
|
+
conclude: (result) => {
|
|
570
|
+
const failures = result.kind === "failed" ? callFailureLines(result.failures, context) : [];
|
|
571
|
+
const controls = [
|
|
572
|
+
...(result.tellId === undefined || callRawAnswer(result, false) !== undefined
|
|
573
|
+
? []
|
|
574
|
+
: [`input ${result.tellId}`]),
|
|
575
|
+
...tellControlLines(result.wake === undefined ? {} : { wake: result.wake }, context),
|
|
576
|
+
];
|
|
577
|
+
if (result.input !== undefined)
|
|
578
|
+
return [
|
|
579
|
+
stream.conclude({ kind: "observed", observation: result.input }),
|
|
580
|
+
...subordinateLines([...failures, ...controls]),
|
|
581
|
+
].join("\n");
|
|
582
|
+
if (result.kind !== "failed")
|
|
697
583
|
return "";
|
|
698
584
|
return stream.conclude({
|
|
699
|
-
kind: "
|
|
700
|
-
|
|
701
|
-
|
|
585
|
+
kind: "failed",
|
|
586
|
+
evidence: [
|
|
587
|
+
...(result.tellId === undefined || settledTells.has(result.tellId) || options.prompt === undefined
|
|
588
|
+
? []
|
|
589
|
+
: [tellAdmissionRow(options.prompt, context, result.wake)]),
|
|
590
|
+
...failures,
|
|
591
|
+
...controls,
|
|
592
|
+
],
|
|
702
593
|
});
|
|
703
594
|
},
|
|
704
595
|
};
|
|
705
596
|
}
|
|
706
|
-
function renderReportedChangeLines(
|
|
707
|
-
|
|
597
|
+
function renderReportedChangeLines(view) {
|
|
598
|
+
const changes = view.changes ?? [];
|
|
599
|
+
if (changes.length === 0 && view.moreChanges !== true && view.outsideChanges === undefined)
|
|
708
600
|
return [];
|
|
709
|
-
const width =
|
|
601
|
+
const width = changes.reduce((max, change) => Math.max(max, renderDiffstat(change.diffstat).length), 0);
|
|
710
602
|
return [
|
|
711
|
-
|
|
712
|
-
...
|
|
713
|
-
...(
|
|
603
|
+
"changes",
|
|
604
|
+
...changes.map((change) => ` ${renderDiffstat(change.diffstat).padEnd(width)} ${safeText(change.path)}`),
|
|
605
|
+
...(view.moreChanges === true ? [` ${OMISSION} more files`] : []),
|
|
606
|
+
...(view.outsideChanges === undefined ? [] : [` ${view.outsideChanges} outside worktree`]),
|
|
714
607
|
];
|
|
715
608
|
}
|
|
716
|
-
function
|
|
717
|
-
const
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
return [];
|
|
736
|
-
return [`debts ${created.rows.length}`, ...created.rows.flatMap((row) => renderDebtRow(row, columns))];
|
|
737
|
-
}
|
|
738
|
-
function selectedStatusActivity(snapshot, context) {
|
|
739
|
-
const entries = coalesceAdjacentGaps(snapshot.kind === "open" ? visibleOpenSnapshotEntries(snapshot) : orderedSnapshotEntries(snapshot));
|
|
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
|
-
}
|
|
760
|
-
let marked = false;
|
|
761
|
-
return rendered.flatMap((item, index) => {
|
|
762
|
-
const lines = kept[index];
|
|
763
|
-
if (!item.exempt && lines.length < item.lines.length && !marked) {
|
|
764
|
-
marked = true;
|
|
765
|
-
return [omissionMarker("earlier activity omitted", context.columns), ...lines];
|
|
766
|
-
}
|
|
767
|
-
return lines;
|
|
768
|
-
});
|
|
609
|
+
export function currentWorkLines(work, context) {
|
|
610
|
+
const summary = work.summary;
|
|
611
|
+
return [
|
|
612
|
+
...(summary === undefined
|
|
613
|
+
? []
|
|
614
|
+
: renderBoundedPayload({
|
|
615
|
+
text: summary.text,
|
|
616
|
+
first: `${summary.id} `,
|
|
617
|
+
continuation: " ",
|
|
618
|
+
columns: context.columns,
|
|
619
|
+
maxLines: 1,
|
|
620
|
+
quote: "",
|
|
621
|
+
truncated: summary.clipped === true,
|
|
622
|
+
})),
|
|
623
|
+
...(work.pending === undefined ? [] : [`pending input ${work.pending.map((item) => item.id).join(" ")}`]),
|
|
624
|
+
...(work.outcome === undefined
|
|
625
|
+
? []
|
|
626
|
+
: [`${work.outcome.verdict} ${work.outcome.historyId} · activity ${work.outcome.activityId}`]),
|
|
627
|
+
];
|
|
769
628
|
}
|
|
770
629
|
function snapshotCore(view, context, options) {
|
|
771
|
-
const activity =
|
|
772
|
-
|
|
773
|
-
|
|
630
|
+
const activity = currentWorkLines(view.work, context);
|
|
631
|
+
const contextFacts = [
|
|
632
|
+
safeText(view.cwd),
|
|
633
|
+
...(view.lastActivityAt === undefined
|
|
634
|
+
? []
|
|
635
|
+
: [
|
|
636
|
+
`${view.life} · last activity ${ageText(view.lastActivityAt, new Date(context.now ?? Date.now()).toISOString())} ago`,
|
|
637
|
+
]),
|
|
638
|
+
];
|
|
774
639
|
const facts = [
|
|
775
|
-
...contractFacts(view.contract, context.columns - SUBORDINATE_INDENT.length),
|
|
640
|
+
...contractFacts(view.contract ?? { kind: "none" }, context.columns - SUBORDINATE_INDENT.length),
|
|
776
641
|
...(options.facts ?? []),
|
|
777
642
|
];
|
|
778
643
|
return {
|
|
779
644
|
activity,
|
|
780
|
-
head: panelHead(view.
|
|
645
|
+
head: panelHead(view.id, options.alias, view.contract, contextFacts),
|
|
781
646
|
facts,
|
|
782
647
|
};
|
|
783
648
|
}
|
|
784
649
|
function snapshotConclusion(status) {
|
|
785
|
-
const
|
|
786
|
-
|
|
787
|
-
// new information, so it is absent exactly then.
|
|
788
|
-
if (timeline.kind === "idle" && timeline.outcome !== undefined)
|
|
789
|
-
return "";
|
|
790
|
-
const { mark, verb } = conclusionMarkVerb(status, "life");
|
|
791
|
-
return `${mark} ${verb}`;
|
|
650
|
+
const conclusion = lifeConclusion(status.life, status.work.pending !== undefined);
|
|
651
|
+
return `${conclusion.mark} ${conclusion.verb}${status.strandedReason === undefined ? "" : ` · ${status.strandedReason}`}`;
|
|
792
652
|
}
|
|
793
653
|
export function snapshotText(view, context, options = {}) {
|
|
794
654
|
const core = snapshotCore(view, context, options);
|
|
795
|
-
const conclusion = snapshotConclusion(view
|
|
655
|
+
const conclusion = snapshotConclusion(view);
|
|
796
656
|
const content = [...core.activity, ...(conclusion.length === 0 ? [] : [conclusion])];
|
|
797
657
|
return [
|
|
798
658
|
...core.head,
|
|
799
659
|
...(content.length === 0 ? [] : [frameRule(core.head, context.columns), ...content]),
|
|
800
|
-
...subordinateLines([
|
|
801
|
-
...renderReportedChangeLines(view.status.timeline),
|
|
802
|
-
...renderDebtContextLines(view.createdDebts, context.columns - SUBORDINATE_INDENT.length),
|
|
803
|
-
...core.facts,
|
|
804
|
-
]),
|
|
660
|
+
...subordinateLines([...renderReportedChangeLines(view), ...core.facts]),
|
|
805
661
|
].join("\n");
|
|
806
662
|
}
|
|
807
663
|
function killResultLabel(evidence) {
|
|
@@ -823,28 +679,56 @@ export function killResultText(id, evidence, alias) {
|
|
|
823
679
|
evidence: label.evidence,
|
|
824
680
|
}).join("\n");
|
|
825
681
|
}
|
|
826
|
-
function
|
|
827
|
-
|
|
682
|
+
export function inputObservation(result) {
|
|
683
|
+
if (result.kind === "admitted")
|
|
684
|
+
return result.input ?? { kind: "unanswered" };
|
|
685
|
+
if (result.kind === "failed" && "failures" in result)
|
|
686
|
+
return result.input ?? { kind: "failed", diagnostic: result.failures[0].diagnostic };
|
|
687
|
+
return result;
|
|
828
688
|
}
|
|
829
|
-
export function askRawAnswer(result
|
|
830
|
-
if (result.
|
|
831
|
-
return "";
|
|
832
|
-
return
|
|
689
|
+
export function askRawAnswer(result) {
|
|
690
|
+
if (result.kind === "admitted" || (result.kind === "failed" && "failures" in result))
|
|
691
|
+
return result.input?.kind === "answered" ? result.input.answer : undefined;
|
|
692
|
+
return result.kind === "answered" ? JSON.stringify(result.answer) : undefined;
|
|
833
693
|
}
|
|
834
694
|
export function callRawAnswer(result, streamed) {
|
|
835
|
-
|
|
836
|
-
if (observation.kind !== "observed" || observation.observation.reason !== "answered")
|
|
695
|
+
if (result.input?.kind !== "answered")
|
|
837
696
|
return streamed ? "" : undefined;
|
|
838
|
-
|
|
697
|
+
if (!streamed &&
|
|
698
|
+
(result.kind === "failed" ||
|
|
699
|
+
result.wake !== undefined ||
|
|
700
|
+
result.alias !== undefined ||
|
|
701
|
+
result.dispatchWarning !== undefined))
|
|
702
|
+
return undefined;
|
|
703
|
+
return result.input.answer;
|
|
839
704
|
}
|
|
840
705
|
export function historyRawAnswer(result, historyId) {
|
|
841
706
|
if (historyId === undefined)
|
|
842
707
|
return undefined;
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
708
|
+
const selector = parseExactHistorySelector(historyId);
|
|
709
|
+
if (selector?.kind === "activity" && result.kind === "akuma" && result.events.length === 1) {
|
|
710
|
+
const row = result.events[0];
|
|
711
|
+
if (row.sequence !== selector.sequence || row.kind === "turn" || row.kind === "outcome")
|
|
712
|
+
return undefined;
|
|
713
|
+
if (row.kind === "tool") {
|
|
714
|
+
const tool = toolRepr(row);
|
|
715
|
+
const prefix = row.state === "unsettled"
|
|
716
|
+
? "unknown: "
|
|
717
|
+
: row.state === "active"
|
|
718
|
+
? "active: "
|
|
719
|
+
: row.state.status === "error"
|
|
720
|
+
? "error: "
|
|
721
|
+
: "";
|
|
722
|
+
return `${prefix}${tool.label} ${tool.text}${tool.suffix}${tool.diagnostic === "" ? "" : ` · ${tool.diagnostic}`}`;
|
|
723
|
+
}
|
|
724
|
+
const kind = row.kind === "tell" && row.state === "pending" ? "pending-tell" : row.kind;
|
|
725
|
+
return `${kind}: ${row.text}`;
|
|
726
|
+
}
|
|
727
|
+
if (result.kind === "akuma-report")
|
|
728
|
+
return result.text;
|
|
729
|
+
if (result.kind !== "akuma-exact")
|
|
846
730
|
return undefined;
|
|
847
|
-
const outcome = result.outcome
|
|
731
|
+
const outcome = result.outcome;
|
|
848
732
|
return outcome.kind === "answered" ? outcome.answer : outcome.kind === "canceled" ? "canceled" : outcome.diagnostic;
|
|
849
733
|
}
|
|
850
734
|
/** One compact wait result line: an observed life mark, the complete identity, a bounded summary. */
|
|
@@ -876,10 +760,11 @@ function waitLine(mark, subject, summary, columns) {
|
|
|
876
760
|
* pending input shows its current answered preview or failed diagnostic, else completion. The
|
|
877
761
|
* mark reports the observed life, never continuing liveness.
|
|
878
762
|
*/
|
|
879
|
-
function waitSummary(
|
|
880
|
-
const pending =
|
|
881
|
-
const outcome =
|
|
882
|
-
const
|
|
763
|
+
function waitSummary(member) {
|
|
764
|
+
const pending = member.pending !== undefined;
|
|
765
|
+
const outcome = member.outcome;
|
|
766
|
+
const life = WAIT_LIFE[member.life];
|
|
767
|
+
const observed = life ??
|
|
883
768
|
(pending
|
|
884
769
|
? { mark: "⧗", state: "pending tell" }
|
|
885
770
|
: outcome === undefined
|
|
@@ -893,8 +778,9 @@ function waitSummary(status) {
|
|
|
893
778
|
...observed,
|
|
894
779
|
summary: [
|
|
895
780
|
observed.state,
|
|
896
|
-
...(pending &&
|
|
897
|
-
...(
|
|
781
|
+
...(pending && life !== undefined ? ["pending tell"] : []),
|
|
782
|
+
...(outcome?.kind === "failed" && (life !== undefined || pending) ? [preview(outcome.diagnostic, "failed")] : []),
|
|
783
|
+
...(member.strandedReason === undefined ? [] : [member.strandedReason]),
|
|
898
784
|
].join(FACT_SEPARATOR),
|
|
899
785
|
};
|
|
900
786
|
}
|
|
@@ -904,36 +790,38 @@ function waitSummary(status) {
|
|
|
904
790
|
* visible only as the snapshot's own bounded summary.
|
|
905
791
|
*/
|
|
906
792
|
export function waitText(result, presentation, context) {
|
|
907
|
-
const alias = result.
|
|
908
|
-
return
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
return waitLine(
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
793
|
+
const alias = result.results.length === 1 ? presentation.alias : undefined;
|
|
794
|
+
return result.results
|
|
795
|
+
.map((member) => {
|
|
796
|
+
if (member.kind === "missing")
|
|
797
|
+
return waitLine("!", identity(member.id, alias), "Akuma not found", context.columns);
|
|
798
|
+
if (member.kind === "unobserved")
|
|
799
|
+
return waitLine("!", identity(member.id, alias), `observation failed${FACT_SEPARATOR}${member.diagnostic}`, context.columns);
|
|
800
|
+
const { mark, summary } = waitSummary(member);
|
|
801
|
+
return waitLine(mark, identity(member.id, alias), summary, context.columns);
|
|
802
|
+
})
|
|
803
|
+
.join("\n");
|
|
915
804
|
}
|
|
916
805
|
export function historyText(result, presentation, context) {
|
|
917
806
|
if (presentation.id !== undefined) {
|
|
918
|
-
return
|
|
919
|
-
`${result.kind === "unknown-history" ? result.historyId : "unknown"} has no matching retained history`);
|
|
807
|
+
return historyRawAnswer(result, presentation.id) ?? `${presentation.id} has no matching retained history`;
|
|
920
808
|
}
|
|
921
809
|
if (presentation.last === true)
|
|
922
|
-
return result.kind === "last" ? result.answer : "no answer retained";
|
|
923
|
-
if (result.kind !== "
|
|
810
|
+
return result.kind === "akuma-last" ? result.answer : "no answer retained";
|
|
811
|
+
if (result.kind !== "akuma")
|
|
924
812
|
throw new Error("history result lacks page");
|
|
925
|
-
const rows = groupedRows(result.
|
|
926
|
-
const paging = result.
|
|
927
|
-
? [
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
813
|
+
const rows = groupedRows(result.events, context, { history: true });
|
|
814
|
+
const paging = result.omitted === undefined
|
|
815
|
+
? []
|
|
816
|
+
: [
|
|
817
|
+
omissionMarker(presentation.since !== undefined
|
|
818
|
+
? `${result.omitted} later events · showing first ${result.events.length}`
|
|
819
|
+
: `${result.omitted} earlier events · showing last ${result.events.length}`, context.columns),
|
|
820
|
+
];
|
|
933
821
|
// History is an immutable timeline, so it takes the shared heading and content boundary and
|
|
934
822
|
// never gains a fabricated current-state conclusion or a live mark.
|
|
935
823
|
const content = [...paging, ...rows];
|
|
936
|
-
const head = panelHead(result.
|
|
824
|
+
const head = panelHead(result.akumaId, presentation.alias, undefined);
|
|
937
825
|
return [...head, ...(content.length === 0 ? [] : [frameRule(head, context.columns), ...content])].join("\n");
|
|
938
826
|
}
|
|
939
827
|
/** One bounded, quoted preview of a Tell an outer receipt already admitted, indented beneath it. */
|
|
@@ -949,10 +837,10 @@ export function tellPayloadLines(text, context) {
|
|
|
949
837
|
});
|
|
950
838
|
}
|
|
951
839
|
/** One admitted Tell as a timeline input row inside a shared panel; the panel owns the identity. */
|
|
952
|
-
export function tellAdmissionRow(
|
|
953
|
-
const lead =
|
|
840
|
+
export function tellAdmissionRow(text, context, wake) {
|
|
841
|
+
const lead = wake?.kind === "failed" ? TOP_FAILURE : wake?.kind === "held" || wake?.kind === "pending" ? TOP_PENDING : TOP_INPUT;
|
|
954
842
|
return renderBoundedPayload({
|
|
955
|
-
text
|
|
843
|
+
text,
|
|
956
844
|
first: lead,
|
|
957
845
|
continuation: TOP_CONTINUATION,
|
|
958
846
|
columns: context.columns,
|
|
@@ -961,36 +849,61 @@ export function tellAdmissionRow(tell, context) {
|
|
|
961
849
|
truncated: false,
|
|
962
850
|
})[0];
|
|
963
851
|
}
|
|
852
|
+
export function callFailureLines(failures, context) {
|
|
853
|
+
return failures.flatMap((failure) => {
|
|
854
|
+
if (failure.stage === "dispatch")
|
|
855
|
+
return [
|
|
856
|
+
failure.failure.kind === "conflict"
|
|
857
|
+
? `! dispatch failed conflict ${failure.failure.currentContractId}`
|
|
858
|
+
: `! dispatch failed ${failure.failure.kind} ${safeText(failure.failure.diagnostic)}`,
|
|
859
|
+
];
|
|
860
|
+
if (failure.stage === "wake")
|
|
861
|
+
return diagnosticLines("tell delivery", failure.diagnostic, context.columns - SUBORDINATE_INDENT.length, {
|
|
862
|
+
state: "failed",
|
|
863
|
+
suffix: failure.logPath === undefined ? "" : ` · log ${failure.logPath}`,
|
|
864
|
+
});
|
|
865
|
+
return [
|
|
866
|
+
`! ${failure.stage} failed ${"kind" in failure ? `${failure.kind} ` : ""}${safeText(failure.diagnostic)}`,
|
|
867
|
+
...("attemptedTellId" in failure && failure.attemptedTellId !== undefined
|
|
868
|
+
? [`attempted input ${safeText(failure.attemptedTellId)}`]
|
|
869
|
+
: []),
|
|
870
|
+
];
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
export function tellControlLines(result, context) {
|
|
874
|
+
const lines = [...callFailureLines(result.failures ?? [], context)];
|
|
875
|
+
const wake = result.wake;
|
|
876
|
+
if (wake?.kind === "failed") {
|
|
877
|
+
lines.push(...callFailureLines([{ ...wake, stage: "wake" }], context));
|
|
878
|
+
}
|
|
879
|
+
else if (wake?.kind === "pending")
|
|
880
|
+
lines.push("wake pending");
|
|
881
|
+
const interrupt = result.interrupt;
|
|
882
|
+
if (interrupt !== undefined)
|
|
883
|
+
lines.push(`interrupt ${interrupt.kind}${interrupt.kind === "unavailable" ? ` · ${interrupt.evidence}` : ""}`);
|
|
884
|
+
return lines;
|
|
885
|
+
}
|
|
964
886
|
/**
|
|
965
887
|
* One Tell action receipt: the delivery verdict and complete subject stand whole on the first line
|
|
966
888
|
* with the submitted payload folded onto that same line, bounded so only its preview truncates. A
|
|
967
889
|
* held Tell keeps neutral vocabulary; a failed delivery keeps its concrete diagnosis and native log
|
|
968
890
|
* coordinates as separate supporting facts.
|
|
969
891
|
*/
|
|
970
|
-
export function tellText(result, alias, context) {
|
|
971
|
-
const wake = result.
|
|
972
|
-
const mark =
|
|
973
|
-
const verb =
|
|
892
|
+
export function tellText(result, prompt, alias, context) {
|
|
893
|
+
const wake = result.wake;
|
|
894
|
+
const mark = result.kind === "failed" ? "!" : wake?.kind === "pending" ? "⧗" : "✓";
|
|
895
|
+
const verb = result.kind === "failed" || wake?.kind === "pending" ? "tell" : "told";
|
|
974
896
|
const head = actionReceipt({
|
|
975
897
|
mark,
|
|
976
898
|
verb,
|
|
977
|
-
id: result.
|
|
899
|
+
id: result.akumaId,
|
|
978
900
|
...(alias === undefined ? {} : { alias }),
|
|
979
901
|
})[0];
|
|
980
|
-
const preview = safeText(
|
|
902
|
+
const preview = safeText(prompt).replace(/\s+/gu, " ").trim();
|
|
981
903
|
const prefix = `${head} — `;
|
|
982
904
|
// The verdict and identity never truncate, so an over-wide identity still keeps one visible
|
|
983
905
|
// ellipsis for the input it could not show.
|
|
984
906
|
const room = Math.max(1, context.columns - displayColumns(prefix));
|
|
985
907
|
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");
|
|
908
|
+
return [verdict, ...subordinateLines(tellControlLines(result, context))].join("\n");
|
|
996
909
|
}
|