@astrosheep/keiyaku 4.5.29 → 4.6.2
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/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +0 -13
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +47 -78
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/references/automation.md +54 -41
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-babysit/SKILL.md +10 -0
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +27 -9
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +68 -71
- package/build/src/akuma/akuma-call.d.ts +53 -0
- package/build/src/akuma/akuma-call.js +113 -0
- package/build/src/akuma/akuma-instance.d.ts +20 -18
- package/build/src/akuma/akuma-instance.js +65 -175
- package/build/src/akuma/akuma-observe.d.ts +3 -21
- package/build/src/akuma/akuma-observe.js +7 -24
- package/build/src/akuma/{akuma-handle.d.ts → akuma-owner.d.ts} +55 -27
- package/build/src/akuma/{akuma-handle.js → akuma-owner.js} +24 -23
- package/build/src/akuma/akuma-selection-execution.d.ts +51 -0
- package/build/src/akuma/akuma-selection-execution.js +134 -0
- package/build/src/akuma/{fleet-execution.d.ts → akuma-wait.d.ts} +24 -44
- package/build/src/akuma/akuma-wait.js +113 -0
- package/build/src/akuma/akuma.d.ts +35 -89
- package/build/src/akuma/akuma.js +148 -30
- package/build/src/akuma/archetype.d.ts +12 -0
- package/build/src/akuma/archetype.js +47 -19
- package/build/src/akuma/body.d.ts +76 -36
- package/build/src/akuma/body.js +84 -49
- package/build/src/akuma/call-initial-tell.d.ts +131 -22
- package/build/src/akuma/call-initial-tell.js +31 -1
- package/build/src/akuma/call-request.d.ts +237 -31
- package/build/src/akuma/call-request.js +67 -94
- package/build/src/akuma/coordinate.d.ts +15 -5
- package/build/src/akuma/coordinate.js +12 -22
- package/build/src/akuma/dispatch-association.d.ts +1 -1
- package/build/src/akuma/dispatch-association.js +1 -10
- package/build/src/akuma/heart/activity-schema.d.ts +325 -0
- package/build/src/akuma/heart/activity-schema.js +53 -0
- package/build/src/akuma/heart/facts.d.ts +1 -6
- package/build/src/akuma/heart/index.d.ts +3 -1
- package/build/src/akuma/heart/index.js +4 -1
- package/build/src/akuma/heart/rows.d.ts +49 -2
- package/build/src/akuma/heart/rows.js +16 -2
- package/build/src/akuma/heart/soul.d.ts +1 -0
- package/build/src/akuma/heart/soul.js +6 -4
- package/build/src/akuma/heart/tells.d.ts +1 -0
- package/build/src/akuma/heart/tells.js +18 -0
- package/build/src/akuma/identity.d.ts +10 -7
- package/build/src/akuma/identity.js +23 -0
- package/build/src/akuma/index.d.ts +10 -8
- package/build/src/akuma/index.js +2 -2
- package/build/src/akuma/nuke.d.ts +3 -0
- package/build/src/akuma/nuke.js +13 -7
- package/build/src/akuma/projection.d.ts +0 -5
- package/build/src/akuma/projection.js +22 -43
- package/build/src/akuma/provider-recipe.d.ts +58 -13
- package/build/src/akuma/provider-recipe.js +62 -80
- package/build/src/akuma/provider.d.ts +6 -76
- package/build/src/akuma/provider.js +11 -219
- package/build/src/akuma/providers/acp/config.d.ts +2 -0
- package/build/src/akuma/providers/acp/config.js +26 -1
- package/build/src/akuma/providers/acp/core.d.ts +7 -0
- package/build/src/akuma/providers/acp/core.js +49 -18
- package/build/src/akuma/providers/acp/index.js +14 -6
- package/build/src/akuma/providers/grok-build/index.js +44 -13
- package/build/src/akuma/providers/index.d.ts +3 -3
- package/build/src/akuma/providers/index.js +2 -13
- package/build/src/akuma/providers/opencode-sdk/event-stream.d.ts +28 -0
- package/build/src/akuma/providers/opencode-sdk/event-stream.js +92 -0
- package/build/src/akuma/providers/opencode-sdk/events.d.ts +0 -1
- package/build/src/akuma/providers/opencode-sdk/index.js +200 -64
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +41 -1
- package/build/src/akuma/providers/opencode-sdk/session.js +69 -2
- package/build/src/akuma/providers/pi/events.js +5 -2
- package/build/src/akuma/providers/pi/index.d.ts +3 -4
- package/build/src/akuma/providers/pi/index.js +99 -45
- package/build/src/akuma/publication.d.ts +84 -3
- package/build/src/akuma/publication.js +145 -2
- package/build/src/akuma/read-pool.d.ts +2 -0
- package/build/src/akuma/read-pool.js +15 -0
- package/build/src/akuma/request-rendezvous.js +10 -0
- package/build/src/akuma/request-serve.js +7 -0
- package/build/src/akuma/request-wire.d.ts +14 -26
- package/build/src/akuma/request-wire.js +4 -0
- package/build/src/akuma/requests.d.ts +0 -2
- package/build/src/akuma/requests.js +0 -17
- package/build/src/akuma/{fleet-observation.d.ts → selection-observation.d.ts} +37 -36
- package/build/src/akuma/selection-observation.js +65 -0
- package/build/src/akuma/{fleet-owner-port.d.ts → selection-owner-port.d.ts} +3 -3
- package/build/src/akuma/{fleet-owner-port.js → selection-owner-port.js} +11 -17
- package/build/src/akuma/{fleet-request.d.ts → selection-request.d.ts} +42 -82
- package/build/src/akuma/{fleet-request.js → selection-request.js} +92 -136
- package/build/src/akuma/turn-drive.js +73 -14
- package/build/src/akuma-body.js +91 -56
- package/build/src/body/amend.d.ts +5 -0
- package/build/src/body/amend.js +26 -50
- package/build/src/body/arc.d.ts +4 -2
- package/build/src/body/arc.js +19 -26
- package/build/src/body/criteria.d.ts +6 -0
- package/build/src/body/criteria.js +37 -0
- package/build/src/body/decode.js +5 -42
- package/build/src/body/region.d.ts +5 -0
- package/build/src/body/region.js +45 -2
- package/build/src/body/render.js +2 -4
- package/build/src/cli/activity.d.ts +26 -0
- package/build/src/cli/activity.js +75 -0
- package/build/src/cli/actor.d.ts +3 -1
- package/build/src/cli/actor.js +15 -2
- package/build/src/cli/commands/akuma-grammar.d.ts +75 -0
- package/build/src/cli/commands/akuma-grammar.js +414 -0
- package/build/src/cli/commands/akuma.d.ts +5 -69
- package/build/src/cli/commands/akuma.js +352 -319
- package/build/src/cli/commands/amend.d.ts +4 -5
- package/build/src/cli/commands/amend.js +1 -2
- package/build/src/cli/commands/bind.d.ts +4 -5
- package/build/src/cli/commands/bind.js +7 -10
- package/build/src/cli/commands/contract-grammar.d.ts +112 -0
- package/build/src/cli/commands/contract-grammar.js +282 -0
- package/build/src/cli/commands/contract-help.d.ts +17 -22
- package/build/src/cli/commands/contract-help.js +37 -24
- package/build/src/cli/commands/contract.d.ts +18 -97
- package/build/src/cli/commands/contract.js +621 -233
- package/build/src/cli/commands/install.d.ts +1 -1
- package/build/src/cli/commands/install.js +2 -2
- package/build/src/cli/commands/task-grammar.d.ts +19 -0
- package/build/src/cli/commands/task-grammar.js +438 -0
- package/build/src/cli/commands/task-query.js +23 -104
- package/build/src/cli/commands/task.d.ts +5 -20
- package/build/src/cli/commands/task.js +414 -364
- package/build/src/cli/coordinates.d.ts +10 -0
- package/build/src/cli/coordinates.js +20 -0
- package/build/src/cli/draft.d.ts +7 -1
- package/build/src/cli/main.js +10 -1
- package/build/src/cli/parse.d.ts +8 -9
- package/build/src/cli/parse.js +62 -62
- package/build/src/cli/render/akuma-activity.d.ts +54 -36
- package/build/src/cli/render/akuma-activity.js +262 -242
- package/build/src/cli/render/akuma-tool.d.ts +8 -4
- package/build/src/cli/render/akuma-tool.js +6 -5
- package/build/src/cli/render/akuma.d.ts +36 -16
- package/build/src/cli/render/akuma.js +65 -132
- package/build/src/cli/render/audit.d.ts +6 -2
- package/build/src/cli/render/audit.js +59 -28
- package/build/src/cli/render/catalog.d.ts +11 -2
- package/build/src/cli/render/catalog.js +75 -95
- package/build/src/cli/render/contract-history.d.ts +3 -1
- package/build/src/cli/render/contract-history.js +215 -22
- package/build/src/cli/render/contract-observation.d.ts +10 -5
- package/build/src/cli/render/contract-observation.js +29 -46
- package/build/src/cli/render/contract.d.ts +10 -3
- package/build/src/cli/render/contract.js +252 -103
- package/build/src/cli/render/effects.d.ts +26 -0
- package/build/src/cli/render/effects.js +41 -0
- package/build/src/cli/render/execution-progress.d.ts +18 -6
- package/build/src/cli/render/execution-progress.js +34 -31
- package/build/src/cli/render/kanshi-akuma.d.ts +1 -2
- package/build/src/cli/render/kanshi-akuma.js +5 -26
- package/build/src/cli/render/kanshi.js +107 -128
- package/build/src/cli/render/marks.d.ts +13 -0
- package/build/src/cli/render/marks.js +74 -0
- package/build/src/cli/render/nuke.js +18 -7
- package/build/src/cli/render/receipt.d.ts +10 -4
- package/build/src/cli/render/receipt.js +124 -44
- package/build/src/cli/render/reconcile.d.ts +5 -0
- package/build/src/cli/render/reconcile.js +152 -0
- package/build/src/cli/render/refusal.d.ts +21 -4
- package/build/src/cli/render/refusal.js +60 -33
- package/build/src/cli/render/region.js +3 -2
- package/build/src/cli/render/settings.js +2 -12
- package/build/src/cli/render/task.d.ts +37 -6
- package/build/src/cli/render/task.js +161 -157
- package/build/src/cli/render/terminal.d.ts +20 -1
- package/build/src/cli/render/terminal.js +92 -18
- package/build/src/cli/runtime.d.ts +32 -8
- package/build/src/cli/runtime.js +157 -165
- package/build/src/cli/selectors.d.ts +5 -2
- package/build/src/cli/selectors.js +11 -3
- package/build/src/cli/streams.d.ts +11 -0
- package/build/src/cli/streams.js +32 -0
- package/build/src/cli/usage.d.ts +2 -0
- package/build/src/cli/usage.js +12 -8
- package/build/src/contract-guidance.js +3 -7
- package/build/src/contract-worktree.d.ts +20 -28
- package/build/src/contract-worktree.js +18 -70
- package/build/src/coordination/durable-file.d.ts +2 -2
- package/build/src/coordination/durable-file.js +0 -27
- package/build/src/core/facts/codec.d.ts +1 -2
- package/build/src/core/facts/codec.js +6 -7
- package/build/src/core/facts/gate.d.ts +0 -1
- package/build/src/core/facts/gate.js +0 -82
- package/build/src/core/facts/types.d.ts +1 -2
- package/build/src/core/verbs/abandon.d.ts +2 -6
- package/build/src/core/verbs/abandon.js +0 -16
- package/build/src/core/verbs/amend.d.ts +0 -1
- package/build/src/core/verbs/amend.js +0 -20
- package/build/src/core/verbs/arc.d.ts +7 -8
- package/build/src/core/verbs/arc.js +2 -19
- package/build/src/core/verbs/attestation.d.ts +2 -6
- package/build/src/core/verbs/attestation.js +0 -16
- package/build/src/core/verbs/bind.d.ts +0 -1
- package/build/src/core/verbs/bind.js +0 -16
- package/build/src/core/verbs/deliver.d.ts +0 -1
- package/build/src/core/verbs/deliver.js +0 -16
- package/build/src/core/verbs/placement.d.ts +2 -1
- package/build/src/core/verbs/placement.js +10 -59
- package/build/src/git/admission.d.ts +6 -4
- package/build/src/git/admission.js +4 -0
- package/build/src/git/hooks.d.ts +55 -30
- package/build/src/git/hooks.js +30 -3
- package/build/src/git/identity.d.ts +6 -0
- package/build/src/git/identity.js +47 -0
- package/build/src/git/integration.d.ts +31 -13
- package/build/src/git/integration.js +32 -1
- package/build/src/git/nuke.d.ts +10 -1
- package/build/src/git/nuke.js +31 -11
- package/build/src/git/observe.js +2 -15
- package/build/src/git/private-state-seat.d.ts +6 -7
- package/build/src/git/private-state-seat.js +8 -6
- package/build/src/git/read-observation.d.ts +6 -1
- package/build/src/git/read-observation.js +81 -46
- package/build/src/git/reconcile.d.ts +117 -40
- package/build/src/git/reconcile.js +169 -40
- package/build/src/git/scratch.d.ts +7 -4
- package/build/src/git/scratch.js +28 -6
- package/build/src/git/target-placement.d.ts +53 -38
- package/build/src/git/target-placement.js +69 -54
- package/build/src/git/tender.d.ts +37 -28
- package/build/src/git/tender.js +39 -0
- package/build/src/git/terminal-reconcile.js +21 -23
- package/build/src/git/terminal-seal.d.ts +8 -6
- package/build/src/git/terminal-seal.js +10 -0
- package/build/src/git/workspace.d.ts +29 -15
- package/build/src/git/workspace.js +28 -2
- package/build/src/identity/normalize.js +19 -6
- package/build/src/index.d.ts +78 -7
- package/build/src/index.js +52 -4
- package/build/src/kanshi/read.d.ts +3 -3
- package/build/src/kanshi/read.js +21 -21
- package/build/src/kanshi/report.d.ts +9 -8
- package/build/src/kanshi/roster.d.ts +2 -0
- package/build/src/kanshi/roster.js +2 -0
- package/build/src/kanshi/select.js +7 -3
- package/build/src/library/address.d.ts +3 -7
- package/build/src/library/address.js +7 -7
- package/build/src/library/akuma-creation.d.ts +21 -32
- package/build/src/library/akuma-creation.js +148 -165
- package/build/src/library/akumas.d.ts +20 -22
- package/build/src/library/akumas.js +43 -20
- package/build/src/library/bind.d.ts +107 -13
- package/build/src/library/bind.js +29 -23
- package/build/src/library/continuation.d.ts +556 -28
- package/build/src/library/continuation.js +29 -54
- package/build/src/library/contract-composition.d.ts +40 -0
- package/build/src/library/contract-composition.js +105 -0
- package/build/src/library/contract-creation.d.ts +7 -0
- package/build/src/library/contract-creation.js +192 -0
- package/build/src/library/contract-execution.d.ts +29 -40
- package/build/src/library/contract-execution.js +503 -128
- package/build/src/library/contract-operations.d.ts +275 -134
- package/build/src/library/contract-operations.js +83 -92
- package/build/src/library/contract-outcomes.d.ts +71 -0
- package/build/src/library/contract-outcomes.js +32 -0
- package/build/src/library/contract-settings.d.ts +25 -0
- package/build/src/library/contract-settings.js +135 -0
- package/build/src/library/contract-types.d.ts +17 -38
- package/build/src/library/delivery.d.ts +530 -10
- package/build/src/library/delivery.js +20 -45
- package/build/src/library/input.d.ts +3 -1
- package/build/src/library/input.js +11 -16
- package/build/src/library/invocation.d.ts +87 -0
- package/build/src/library/invocation.js +290 -0
- package/build/src/library/keiyaku.d.ts +45 -22
- package/build/src/library/keiyaku.js +134 -8
- package/build/src/library/nuke.d.ts +2 -11
- package/build/src/library/nuke.js +70 -57
- package/build/src/library/outcome.d.ts +13196 -0
- package/build/src/library/outcome.js +487 -0
- package/build/src/library/reconcile.d.ts +96 -24
- package/build/src/library/reconcile.js +102 -42
- package/build/src/library/refusal.d.ts +470 -42
- package/build/src/library/refusal.js +55 -143
- package/build/src/library/region.d.ts +15 -7
- package/build/src/library/region.js +23 -3
- package/build/src/library/repo.d.ts +2 -12
- package/build/src/library/repo.js +1 -22
- package/build/src/library/selection.d.ts +121 -0
- package/build/src/library/{fleet.js → selection.js} +169 -152
- package/build/src/plugin/public.d.ts +2 -0
- package/build/src/protocol/abandon.d.ts +2 -2
- package/build/src/protocol/abandon.js +1 -0
- package/build/src/protocol/amend.js +1 -0
- package/build/src/protocol/arc.d.ts +6 -4
- package/build/src/protocol/attempt.d.ts +4 -2
- package/build/src/protocol/attempt.js +10 -0
- package/build/src/protocol/audit.d.ts +255 -52
- package/build/src/protocol/audit.js +63 -5
- package/build/src/protocol/bind.d.ts +18 -17
- package/build/src/protocol/bind.js +9 -28
- package/build/src/protocol/completion.d.ts +256 -22
- package/build/src/protocol/completion.js +100 -12
- package/build/src/protocol/deliver.d.ts +34 -23
- package/build/src/protocol/deliver.js +39 -25
- package/build/src/protocol/execution-observation.d.ts +36 -37
- package/build/src/protocol/execution-observation.js +7 -9
- package/build/src/protocol/intent.d.ts +101 -30
- package/build/src/protocol/intent.js +74 -1
- package/build/src/protocol/operations.d.ts +570 -64
- package/build/src/protocol/operations.js +189 -9
- package/build/src/protocol/outcome.d.ts +2 -1
- package/build/src/protocol/placement.d.ts +2 -2
- package/build/src/protocol/placement.js +3 -1
- package/build/src/protocol/progress.d.ts +108 -65
- package/build/src/protocol/progress.js +82 -132
- package/build/src/protocol/read/status.d.ts +4 -3
- package/build/src/protocol/read/status.js +6 -5
- package/build/src/protocol/reconcile.d.ts +3 -3
- package/build/src/protocol/reconcile.js +4 -0
- package/build/src/protocol/reintegrate.d.ts +2 -2
- package/build/src/protocol/review.d.ts +30 -12
- package/build/src/protocol/review.js +15 -24
- package/build/src/protocol/run.d.ts +34 -5
- package/build/src/protocol/run.js +24 -12
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settings.d.ts +0 -10
- package/build/src/settings.js +0 -76
- package/build/src/settlement/holder.d.ts +1 -1
- package/build/src/settlement/settle.d.ts +25 -16
- package/build/src/settlement/settle.js +80 -20
- package/build/src/task/board.d.ts +3 -1
- package/build/src/task/board.js +13 -17
- package/build/src/task/catalog.d.ts +0 -4
- package/build/src/task/catalog.js +0 -15
- package/build/src/task/compose-language.d.ts +19 -9
- package/build/src/task/compose-language.js +30 -20
- package/build/src/task/compose.d.ts +7 -37
- package/build/src/task/compose.js +20 -2
- package/build/src/task/created-observation.d.ts +0 -1
- package/build/src/task/created-observation.js +1 -4
- package/build/src/task/document.d.ts +12 -2
- package/build/src/task/document.js +4 -0
- package/build/src/task/identity.d.ts +4 -1
- package/build/src/task/identity.js +21 -17
- package/build/src/task/index.d.ts +36 -16
- package/build/src/task/index.js +103 -96
- package/build/src/task/lifecycle-operations.d.ts +1 -1
- package/build/src/task/mutation-result.d.ts +647 -586
- package/build/src/task/mutation-result.js +79 -46
- package/build/src/task/mutation.d.ts +298 -270
- package/build/src/task/mutation.js +93 -110
- package/build/src/task/operation-types.d.ts +6 -49
- package/build/src/task/operations.d.ts +2 -1
- package/build/src/task/operations.js +35 -12
- package/build/src/task/query.d.ts +9 -3
- package/build/src/task/query.js +42 -16
- package/build/src/task/store.d.ts +2 -1
- package/build/src/task/store.js +10 -14
- package/build/src/verification/declaration.d.ts +0 -1
- package/build/src/verification/declaration.js +1 -18
- package/build/src/verification/execution.d.ts +6 -2
- package/build/src/verification/observation.d.ts +1 -1
- package/package.json +2 -18
- package/build/src/akuma/akuma-product.d.ts +0 -58
- package/build/src/akuma/akuma-product.js +0 -276
- package/build/src/akuma/fleet-execution.js +0 -234
- package/build/src/akuma/fleet-observation.js +0 -97
- package/build/src/cli/accepted.d.ts +0 -24
- package/build/src/cli/accepted.js +0 -167
- package/build/src/cli/catalog.d.ts +0 -45
- package/build/src/cli/catalog.js +0 -1
- package/build/src/cli/commands/akuma-invoke.d.ts +0 -114
- package/build/src/cli/commands/akuma-invoke.js +0 -375
- package/build/src/cli/commands/contract-invoke.d.ts +0 -34
- package/build/src/cli/commands/contract-invoke.js +0 -259
- package/build/src/cli/commands/nuke.d.ts +0 -10
- package/build/src/cli/commands/nuke.js +0 -20
- package/build/src/cli/commands/status-set.d.ts +0 -4
- package/build/src/cli/commands/status-set.js +0 -52
- package/build/src/cli/commands/task-invoke.d.ts +0 -49
- package/build/src/cli/commands/task-invoke.js +0 -306
- package/build/src/cli/invoke.d.ts +0 -27
- package/build/src/cli/invoke.js +0 -521
- package/build/src/cli/render/board.d.ts +0 -3
- package/build/src/cli/render/board.js +0 -25
- package/build/src/cli/render/status-set.d.ts +0 -5
- package/build/src/cli/render/status-set.js +0 -19
- package/build/src/cli/render/text.d.ts +0 -3
- package/build/src/cli/render/text.js +0 -33
- package/build/src/cli/result.d.ts +0 -240
- package/build/src/cli/result.js +0 -1
- package/build/src/git/result-codec.d.ts +0 -29
- package/build/src/git/result-codec.js +0 -309
- package/build/src/kanshi/fleet.d.ts +0 -6
- package/build/src/kanshi/fleet.js +0 -27
- package/build/src/library/audit.d.ts +0 -29
- package/build/src/library/audit.js +0 -41
- package/build/src/library/composition.d.ts +0 -15
- package/build/src/library/composition.js +0 -28
- package/build/src/library/configuration.d.ts +0 -4
- package/build/src/library/configuration.js +0 -2
- package/build/src/library/contract-bind.d.ts +0 -31
- package/build/src/library/contract-bind.js +0 -140
- package/build/src/library/contract-forwarding.d.ts +0 -55
- package/build/src/library/contract-forwarding.js +0 -67
- package/build/src/library/contract-handle.d.ts +0 -50
- package/build/src/library/contract-handle.js +0 -385
- package/build/src/library/contract.d.ts +0 -46
- package/build/src/library/contract.js +0 -73
- package/build/src/library/execution-result.d.ts +0 -243
- package/build/src/library/execution-result.js +0 -101
- package/build/src/library/execution.d.ts +0 -8
- package/build/src/library/execution.js +0 -102
- package/build/src/library/fleet.d.ts +0 -83
- package/build/src/library/mutation.d.ts +0 -501
- package/build/src/library/mutation.js +0 -248
- package/build/src/library/result-codec.d.ts +0 -2
- package/build/src/library/result-codec.js +0 -12
- package/build/src/protocol/result-codec.d.ts +0 -23
- package/build/src/protocol/result-codec.js +0 -488
- package/build/src/settlement/result-codec.d.ts +0 -2
- package/build/src/settlement/result-codec.js +0 -56
- package/build/src/task/public.d.ts +0 -2
- package/build/src/task/public.js +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defaultWaitComplete } from "../../akuma/akuma-observe.js";
|
|
2
|
-
import { toolContent, toolRepr } from "./akuma-tool.js";
|
|
3
|
-
import {
|
|
2
|
+
import { renderDiffstat, toolContent, toolRepr } from "./akuma-tool.js";
|
|
3
|
+
import { taskDispositionMark } from "./marks.js";
|
|
4
|
+
import { DEFAULT_CLI_COLUMNS, displayColumns, padToDisplay, renderBoundedPayload, renderBoundedTextBlock, safeText, takeDisplayColumns, takeDisplayColumnsFromEnd, truncateDisplayText, truncateMiddleDisplayText, } from "./terminal.js";
|
|
4
5
|
export const DEFAULT_CONTEXT = { columns: DEFAULT_CLI_COLUMNS, color: false };
|
|
5
6
|
const TIME_WIDTH = 5;
|
|
6
7
|
const VERB_WIDTH = 6;
|
|
@@ -21,8 +22,9 @@ function identity(id, alias) {
|
|
|
21
22
|
function associatedContractId(contract) {
|
|
22
23
|
return contract.kind === "associated" ? contract.contractId : undefined;
|
|
23
24
|
}
|
|
24
|
-
export function associatedIdentity(id, alias,
|
|
25
|
-
|
|
25
|
+
export function associatedIdentity(id, alias, contract) {
|
|
26
|
+
const contractId = contract === undefined ? undefined : associatedContractId(contract);
|
|
27
|
+
return `${identity(id, alias)}${contractId === undefined ? "" : `\n└─ ${contractId}`}`;
|
|
26
28
|
}
|
|
27
29
|
export function snapshotHeading(id, alias, contract) {
|
|
28
30
|
const contractId = contract === undefined ? undefined : associatedContractId(contract);
|
|
@@ -39,17 +41,6 @@ function contractFacts(contract) {
|
|
|
39
41
|
function unobservedText(id, diagnostic) {
|
|
40
42
|
return `× Akuma observation failed ${safeText(id)} — ${safeText(diagnostic)}`;
|
|
41
43
|
}
|
|
42
|
-
function lifeLabel(life) {
|
|
43
|
-
if (life === "running")
|
|
44
|
-
return "● running";
|
|
45
|
-
if (life === "asleep")
|
|
46
|
-
return "✓ came back";
|
|
47
|
-
if (life === "killed")
|
|
48
|
-
return "× killed";
|
|
49
|
-
if (life === "hung")
|
|
50
|
-
return "? hung";
|
|
51
|
-
return "! stranded";
|
|
52
|
-
}
|
|
53
44
|
function clock(at) {
|
|
54
45
|
const date = new Date(at);
|
|
55
46
|
return Number.isFinite(date.getTime())
|
|
@@ -75,16 +66,14 @@ function label(row, tool) {
|
|
|
75
66
|
return row.kind;
|
|
76
67
|
return tool.label;
|
|
77
68
|
}
|
|
78
|
-
function mark(row) {
|
|
69
|
+
function mark(row, live = false) {
|
|
79
70
|
if (row.kind === "outcome")
|
|
80
71
|
return row.outcome.kind === "answered" ? "✓" : "!";
|
|
81
|
-
if (row.kind === "tell" && row.state === "told")
|
|
82
|
-
return "✓";
|
|
83
72
|
if (row.kind === "tell" && row.state === "pending")
|
|
84
73
|
return "⧗";
|
|
85
74
|
if (row.kind === "tool") {
|
|
86
75
|
if (row.state === "active")
|
|
87
|
-
return "
|
|
76
|
+
return live ? "●" : "?";
|
|
88
77
|
if (row.state === "unsettled")
|
|
89
78
|
return "?";
|
|
90
79
|
return row.state.status === "ok" ? "✓" : "!";
|
|
@@ -141,11 +130,6 @@ function actionCell(head, verb, columns) {
|
|
|
141
130
|
function continuationPrefix() {
|
|
142
131
|
return " ".repeat(TIME_WIDTH) + " │ " + " ".repeat(VERB_WIDTH) + " ";
|
|
143
132
|
}
|
|
144
|
-
/** Pad to a terminal-column width; raw string length is never the measuring stick. */
|
|
145
|
-
function padToDisplay(text, width) {
|
|
146
|
-
const remaining = width - displayColumns(text);
|
|
147
|
-
return remaining > 0 ? `${text}${" ".repeat(remaining)}` : text;
|
|
148
|
-
}
|
|
149
133
|
function timelineMarker(text) {
|
|
150
134
|
return `${" ".repeat(TIME_WIDTH)} ⋮ ${text}`;
|
|
151
135
|
}
|
|
@@ -166,7 +150,6 @@ function sourceLayout(source, width, clock) {
|
|
|
166
150
|
const gutter = () => `${" ".repeat(TIME_WIDTH)} ${padToDisplay(source, width())} `;
|
|
167
151
|
return {
|
|
168
152
|
head: (time, glyph, verb, columns) => actionCell(`${time === undefined ? " ".repeat(TIME_WIDTH) : time.padEnd(TIME_WIDTH)} ${padToDisplay(source, width())} ${glyph}`, verb, columns),
|
|
169
|
-
// Continuations blank the time and source columns and align under the mark.
|
|
170
153
|
continuation: () => `${" ".repeat(TIME_WIDTH)} ${" ".repeat(width())} │ ${" ".repeat(VERB_WIDTH)} `,
|
|
171
154
|
marker: (count) => `${gutter()}⋮ ${count} omitted`,
|
|
172
155
|
clock,
|
|
@@ -179,16 +162,6 @@ function quotedBody(row) {
|
|
|
179
162
|
row.kind === "tell" ||
|
|
180
163
|
(row.kind === "outcome" && row.outcome.kind === "answered"));
|
|
181
164
|
}
|
|
182
|
-
/** Quote every rendered body line, slicing each line's prefix by its display width. */
|
|
183
|
-
function quoteLines(lines, prefix) {
|
|
184
|
-
const prefixWidth = displayColumns(prefix);
|
|
185
|
-
return lines.map((line) => {
|
|
186
|
-
const { text: head, rest: body } = takeDisplayColumns(line, prefixWidth);
|
|
187
|
-
if (body.length === 0)
|
|
188
|
-
return line;
|
|
189
|
-
return `${head}“${body}”`;
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
165
|
function pathTail(path, maximum) {
|
|
193
166
|
if (displayColumns(path) <= maximum)
|
|
194
167
|
return path;
|
|
@@ -231,28 +204,16 @@ function renderPathPreview(first, text, pathPreview, columns) {
|
|
|
231
204
|
const renderedDiagnostic = remainder > 0 ? truncateDisplayText(diagnostic, remainder) : "";
|
|
232
205
|
return `${first}${base}${renderedDiagnostic}`;
|
|
233
206
|
}
|
|
234
|
-
function takeWordPrefix(value, maximum) {
|
|
235
|
-
const taken = takeDisplayColumns(value, maximum);
|
|
236
|
-
if (taken.rest.length === 0)
|
|
237
|
-
return { head: taken.text, rest: "" };
|
|
238
|
-
const split = taken.text.lastIndexOf(" ");
|
|
239
|
-
if (split <= 0)
|
|
240
|
-
return { head: taken.text, rest: taken.rest };
|
|
241
|
-
return {
|
|
242
|
-
head: taken.text.slice(0, split).trimEnd(),
|
|
243
|
-
rest: `${taken.text.slice(split)}${taken.rest}`.trimStart(),
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
207
|
function renderRunCommand(first, continuation, text, suffix, columns) {
|
|
247
208
|
const firstBudget = Math.max(0, columns - displayColumns(first));
|
|
248
209
|
const secondBudget = Math.max(0, columns - displayColumns(continuation));
|
|
249
210
|
if (displayColumns(`${text}${suffix}`) <= firstBudget)
|
|
250
211
|
return [`${first}${text}${suffix}`];
|
|
251
212
|
const command = text.startsWith("$ ") ? text.slice(2) : text;
|
|
252
|
-
const firstPart =
|
|
213
|
+
const firstPart = takeDisplayColumns(command, Math.max(0, firstBudget - 2));
|
|
253
214
|
const restWidth = displayColumns(firstPart.rest) + displayColumns(suffix);
|
|
254
215
|
if (restWidth <= secondBudget) {
|
|
255
|
-
return [`${first}$ ${firstPart.
|
|
216
|
+
return [`${first}$ ${firstPart.text}`, `${continuation}${firstPart.rest}${suffix}`];
|
|
256
217
|
}
|
|
257
218
|
const suffixBudget = Math.min(displayColumns(suffix), Math.max(0, secondBudget - 8));
|
|
258
219
|
const keptSuffix = suffixBudget > 0 ? truncateDisplayText(suffix, suffixBudget) : "";
|
|
@@ -267,67 +228,66 @@ function rowBody(row, text, columns) {
|
|
|
267
228
|
return text;
|
|
268
229
|
return toolContent(row, columns);
|
|
269
230
|
}
|
|
270
|
-
function
|
|
271
|
-
const
|
|
272
|
-
const
|
|
273
|
-
const
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
const
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
first,
|
|
291
|
-
continuation,
|
|
292
|
-
columns: context.columns - quoteWidth,
|
|
293
|
-
lines: history ? Number.MAX_SAFE_INTEGER : value.lines,
|
|
294
|
-
...("truncated" in row && row.truncated === true ? { truncated: true } : {}),
|
|
295
|
-
});
|
|
296
|
-
return quoted ? quoteLines(lines, first) : lines;
|
|
231
|
+
function tailAnswerPreview(first, text, columns) {
|
|
232
|
+
const readable = safeText(text).replace(/\s+/gu, " ").trim();
|
|
233
|
+
const budget = Math.max(0, columns - displayColumns(first + "“”"));
|
|
234
|
+
const tail = takeDisplayColumnsFromEnd(readable, budget).text;
|
|
235
|
+
const preview = tail.length === readable.length ? tail : `…${takeDisplayColumnsFromEnd(readable, Math.max(0, budget - 1)).text}`;
|
|
236
|
+
return [`${first}“${preview}”`];
|
|
237
|
+
}
|
|
238
|
+
function toolOverflowPreview(options, value, columns) {
|
|
239
|
+
const { tool, layout, first, continuation } = options;
|
|
240
|
+
if (tool?.overflow !== "command")
|
|
241
|
+
return undefined;
|
|
242
|
+
if (layout.compactRun !== true)
|
|
243
|
+
return renderRunCommand(first, continuation, value.text, value.suffix ?? "", columns);
|
|
244
|
+
const remaining = columns - displayColumns(first);
|
|
245
|
+
const suffix = value.suffix ?? "";
|
|
246
|
+
const withSuffix = remaining - displayColumns(suffix);
|
|
247
|
+
const showSuffix = suffix.length > 0 && withSuffix >= 6;
|
|
248
|
+
return [
|
|
249
|
+
`${first}${truncateMiddleDisplayText(value.text, Math.max(0, showSuffix ? withSuffix : remaining))}${showSuffix ? suffix : ""}`,
|
|
250
|
+
];
|
|
297
251
|
}
|
|
298
252
|
function renderRow(row, context, options) {
|
|
299
253
|
const { layout, first, continuation, tool, inFlightSay = false } = options;
|
|
300
254
|
const value = rowText(row, tool);
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
const remaining = context.columns - displayColumns(first);
|
|
305
|
-
const suffix = value.suffix ?? "";
|
|
306
|
-
const withSuffix = remaining - displayColumns(suffix);
|
|
307
|
-
const showSuffix = suffix.length > 0 && withSuffix >= 6;
|
|
308
|
-
return [
|
|
309
|
-
`${first}${truncateMiddleDisplayText(value.text, Math.max(0, showSuffix ? withSuffix : remaining))}${showSuffix ? suffix : ""}`,
|
|
310
|
-
];
|
|
311
|
-
}
|
|
255
|
+
const overflow = toolOverflowPreview(options, value, context.columns);
|
|
256
|
+
if (overflow !== undefined)
|
|
257
|
+
return overflow;
|
|
312
258
|
if (tool?.pathPreview !== undefined)
|
|
313
259
|
return [renderPathPreview(first, value.text, tool.pathPreview, context.columns)];
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
260
|
+
if (layout.tailAnswer === true && row.kind === "outcome" && row.outcome.kind === "answered")
|
|
261
|
+
return tailAnswerPreview(first, value.text, context.columns);
|
|
262
|
+
const available = context.columns - displayColumns(first) - displayColumns(value.suffix ?? "");
|
|
263
|
+
return renderBoundedPayload({
|
|
264
|
+
text: rowBody(row, value.text, available),
|
|
265
|
+
first,
|
|
266
|
+
continuation,
|
|
267
|
+
columns: context.columns,
|
|
268
|
+
maxLines: layout.singleLine === true && row.kind !== "said"
|
|
269
|
+
? 1
|
|
270
|
+
: layout.history === true
|
|
271
|
+
? Number.MAX_SAFE_INTEGER
|
|
272
|
+
: value.lines,
|
|
273
|
+
quote: quotedBody(row) ? (layout.singleLine === true && row.kind !== "said" ? '"' : "“") : "",
|
|
274
|
+
openQuote: row.kind === "said" && inFlightSay,
|
|
275
|
+
truncated: "truncated" in row && row.truncated === true,
|
|
276
|
+
});
|
|
318
277
|
}
|
|
319
|
-
|
|
320
|
-
|
|
278
|
+
function renderTimelineRow(row, context, layout, time, options = {}) {
|
|
279
|
+
const { inFlightSay = false, live = false, unsettled = false } = options;
|
|
321
280
|
const tool = row.kind === "tool" ? toolRepr(row) : undefined;
|
|
281
|
+
const glyph = inFlightSay ? (live ? "●" : "?") : unsettled ? "?" : mark(row, live);
|
|
322
282
|
return renderRow(row, context, {
|
|
323
283
|
layout,
|
|
324
|
-
first: layout.head(time,
|
|
284
|
+
first: layout.head(time, glyph, label(row, tool), context.columns),
|
|
325
285
|
continuation: layout.continuation(),
|
|
326
286
|
tool,
|
|
327
287
|
inFlightSay,
|
|
328
288
|
});
|
|
329
289
|
}
|
|
330
|
-
function groupedEntries(entries, context, layout = plainLayout()) {
|
|
290
|
+
function groupedEntries(entries, context, layout = plainLayout(), options = {}) {
|
|
331
291
|
const lines = [];
|
|
332
292
|
let previousClock;
|
|
333
293
|
for (const entry of entries) {
|
|
@@ -338,7 +298,11 @@ function groupedEntries(entries, context, layout = plainLayout()) {
|
|
|
338
298
|
const row = entry.row;
|
|
339
299
|
const at = clock(row.at);
|
|
340
300
|
const changed = previousClock === undefined || at !== previousClock;
|
|
341
|
-
lines.push(...renderTimelineRow(row, context, layout, changed ? at : undefined
|
|
301
|
+
lines.push(...renderTimelineRow(row, context, layout, changed ? at : undefined, {
|
|
302
|
+
inFlightSay: options.inFlightSay?.(row) ?? false,
|
|
303
|
+
live: options.live === true,
|
|
304
|
+
unsettled: options.unsettled?.(row) ?? false,
|
|
305
|
+
}));
|
|
342
306
|
previousClock = at;
|
|
343
307
|
}
|
|
344
308
|
return lines;
|
|
@@ -404,7 +368,12 @@ export function snapshotActivityLines(snapshot, context, selection = {}) {
|
|
|
404
368
|
return groupedEntries(coalesceAdjacentGaps(full), context);
|
|
405
369
|
}
|
|
406
370
|
const latest = entries.filter((entry) => entry.kind === "row").at(-1);
|
|
407
|
-
return latest === undefined
|
|
371
|
+
return latest === undefined
|
|
372
|
+
? []
|
|
373
|
+
: groupedEntries([latest], context, {
|
|
374
|
+
...compactLayout(),
|
|
375
|
+
...(selection.tailAnswer === true ? { tailAnswer: true } : {}),
|
|
376
|
+
});
|
|
408
377
|
}
|
|
409
378
|
function isSettledStreamRow(row) {
|
|
410
379
|
if (row.kind === "turn" || row.kind === "outcome")
|
|
@@ -413,49 +382,57 @@ function isSettledStreamRow(row) {
|
|
|
413
382
|
return row.state === "told";
|
|
414
383
|
return row.kind !== "tool" || (row.state !== "active" && row.state !== "unsettled");
|
|
415
384
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
385
|
+
function sameTool(left, right) {
|
|
386
|
+
return (left.kind === "tool" &&
|
|
387
|
+
right.kind === "tool" &&
|
|
388
|
+
left.turnSequence === right.turnSequence &&
|
|
389
|
+
left.name === right.name &&
|
|
390
|
+
JSON.stringify(left.call) === JSON.stringify(right.call));
|
|
419
391
|
}
|
|
420
392
|
function settledRows(activity) {
|
|
421
|
-
return activity.rows.filter(isSettledStreamRow);
|
|
393
|
+
return activity.rows.filter((row) => isSettledStreamRow(row) && !inFlightSay(activity, row));
|
|
422
394
|
}
|
|
423
395
|
function isBoundedStreamTool(row) {
|
|
424
396
|
return row.kind === "tool";
|
|
425
397
|
}
|
|
426
|
-
function
|
|
398
|
+
function rememberPendingTells(state, activity) {
|
|
427
399
|
for (const row of activity.rows)
|
|
428
|
-
if (
|
|
429
|
-
|
|
400
|
+
if (row.kind === "tell" &&
|
|
401
|
+
row.state === "pending" &&
|
|
402
|
+
(state.admissionSequence === undefined || row.sequence >= state.admissionSequence))
|
|
403
|
+
state.pendingTellSequences.add(row.sequence);
|
|
430
404
|
}
|
|
431
|
-
/**
|
|
432
|
-
function baselineOmissionCount(activity,
|
|
433
|
-
|
|
434
|
-
let count = 0;
|
|
435
|
-
for (const row of activity.rows) {
|
|
436
|
-
if (!afterBoundary) {
|
|
437
|
-
if (row.sequence === boundary.row.sequence)
|
|
438
|
-
afterBoundary = true;
|
|
439
|
-
continue;
|
|
440
|
-
}
|
|
441
|
-
if (isSettledStreamRow(row))
|
|
442
|
-
count += 1;
|
|
443
|
-
}
|
|
444
|
-
return count;
|
|
405
|
+
/** Count skipped settled rows within the eligible part of a seeded baseline. */
|
|
406
|
+
function baselineOmissionCount(activity, after, before) {
|
|
407
|
+
return activity.rows.filter((row) => row.sequence > after && (before === undefined || row.sequence < before) && isSettledStreamRow(row)).length;
|
|
445
408
|
}
|
|
446
409
|
function renderStreamRow(state, row, lines, options) {
|
|
447
|
-
const { context, layout, inFlightSay = false } = options;
|
|
410
|
+
const { context, layout, inFlightSay = false, unsettled = false } = options;
|
|
448
411
|
const at = clock(row.at);
|
|
449
412
|
const previousClock = layout.clock?.previous ?? state.previousClock;
|
|
450
413
|
const changed = previousClock === undefined || at !== previousClock;
|
|
451
|
-
lines.push(...renderTimelineRow(row, context, layout, changed ? at : undefined,
|
|
414
|
+
lines.push(...renderTimelineRow(row, context, layout, changed ? at : undefined, {
|
|
415
|
+
inFlightSay,
|
|
416
|
+
unsettled,
|
|
417
|
+
}));
|
|
452
418
|
if (layout.clock !== undefined)
|
|
453
419
|
layout.clock.previous = at;
|
|
454
420
|
else
|
|
455
421
|
state.previousClock = at;
|
|
456
422
|
}
|
|
423
|
+
/**
|
|
424
|
+
* A say is in-flight only while it is the newest row of the open turn: it may still be streaming, so it
|
|
425
|
+
* stays in the redrawable frame. A say with any successor row is settled evidence and renders on the rail.
|
|
426
|
+
*/
|
|
457
427
|
function inFlightSay(activity, row) {
|
|
458
|
-
|
|
428
|
+
if (activity.snapshot.kind !== "open" || row.kind !== "said")
|
|
429
|
+
return false;
|
|
430
|
+
let newest;
|
|
431
|
+
for (const candidate of activity.rows) {
|
|
432
|
+
if (newest === undefined || candidate.sequence > newest.sequence)
|
|
433
|
+
newest = candidate;
|
|
434
|
+
}
|
|
435
|
+
return newest !== undefined && newest.sequence === row.sequence;
|
|
459
436
|
}
|
|
460
437
|
function coalesceDeferredGaps(state) {
|
|
461
438
|
state.deferred = state.deferred.reduce((entries, entry) => {
|
|
@@ -476,6 +453,11 @@ function omitOldestDeferredTool(state) {
|
|
|
476
453
|
state.deferred[index] = { kind: "gap", count: 1 };
|
|
477
454
|
coalesceDeferredGaps(state);
|
|
478
455
|
}
|
|
456
|
+
/** A say is a checkpoint: only tools after the last say may occupy the recent tail. */
|
|
457
|
+
function omitPreSayTools(state) {
|
|
458
|
+
state.deferred = state.deferred.map((entry) => entry.kind === "row" && isBoundedStreamTool(entry.row) ? { kind: "gap", count: 1 } : entry);
|
|
459
|
+
coalesceDeferredGaps(state);
|
|
460
|
+
}
|
|
479
461
|
/** Emit only a prefix whose omission runs can no longer join an unresolved tail tool. */
|
|
480
462
|
function flushSafeActivityPrefix(state, lines, context, layout) {
|
|
481
463
|
for (;;) {
|
|
@@ -503,33 +485,53 @@ function renderCurrentTurnBoundary(state, activity, lines, context, layout) {
|
|
|
503
485
|
}
|
|
504
486
|
return boundary;
|
|
505
487
|
}
|
|
488
|
+
function rememberLiveRows(state, activity) {
|
|
489
|
+
for (const row of activity.rows) {
|
|
490
|
+
if (row.kind === "tool" && row.state === "active")
|
|
491
|
+
state.liveRows.set(row.sequence, row);
|
|
492
|
+
else if (row.kind === "said" && inFlightSay(activity, row))
|
|
493
|
+
state.liveRows.set(row.sequence, row);
|
|
494
|
+
else if (row.kind === "tool" && isSettledStreamRow(row)) {
|
|
495
|
+
for (const [sequence, live] of state.liveRows) {
|
|
496
|
+
if (sameTool(live, row)) {
|
|
497
|
+
state.liveRows.delete(sequence);
|
|
498
|
+
break;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
else if (isSettledStreamRow(row))
|
|
503
|
+
state.liveRows.delete(row.sequence);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
506
|
function observeActivitySnapshot(state, activity, context, layout) {
|
|
507
507
|
const lines = [];
|
|
508
508
|
const boundary = currentTurnBoundary(activity);
|
|
509
|
-
|
|
509
|
+
rememberPendingTells(state, activity);
|
|
510
510
|
// A row newly selected as this Turn's typed opening must still respect the
|
|
511
|
-
// settled cursor, even if its earlier pending form was remembered
|
|
511
|
+
// settled cursor, even if its earlier pending form was remembered.
|
|
512
512
|
if (boundary !== undefined)
|
|
513
|
-
state.
|
|
513
|
+
state.pendingTellSequences.delete(boundary.row.sequence);
|
|
514
514
|
const observedRows = settledRows(activity)
|
|
515
|
+
.filter((row) => state.admissionSequence === undefined || row.sequence >= state.admissionSequence)
|
|
515
516
|
.filter((row) => !state.admittedTellSequences.has(row.sequence))
|
|
516
517
|
.filter((row) => boundary === undefined ||
|
|
517
518
|
!state.renderedBoundaries.has(boundary.turnSequence) ||
|
|
518
519
|
row.sequence !== boundary.row.sequence)
|
|
519
|
-
.filter((row) => state.
|
|
520
|
+
.filter((row) => state.pendingTellSequences.has(row.sequence) ||
|
|
520
521
|
state.newestSettledSequence === undefined ||
|
|
521
522
|
row.sequence > state.newestSettledSequence);
|
|
523
|
+
rememberLiveRows(state, activity);
|
|
522
524
|
if (observedRows.length === 0)
|
|
523
525
|
return lines;
|
|
524
526
|
for (const row of observedRows)
|
|
525
|
-
state.
|
|
527
|
+
state.pendingTellSequences.delete(row.sequence);
|
|
526
528
|
state.newestSettledSequence = observedRows.reduce((newest, row) => Math.max(newest, row.sequence), state.newestSettledSequence ?? observedRows[0].sequence);
|
|
527
529
|
const rows = observedRows.filter((row) => row.kind !== "thought");
|
|
528
530
|
for (const row of rows) {
|
|
529
531
|
if (row.kind === "said") {
|
|
532
|
+
omitPreSayTools(state);
|
|
530
533
|
lines.push(...flushActivityTail(state, context, layout));
|
|
531
534
|
renderStreamRow(state, row, lines, { context, layout, inFlightSay: inFlightSay(activity, row) });
|
|
532
|
-
state.openingTools = 0;
|
|
533
535
|
continue;
|
|
534
536
|
}
|
|
535
537
|
if (isBoundedStreamTool(row) && state.openingTools < OPENING_TOOL_BUDGET) {
|
|
@@ -564,53 +566,87 @@ function flushActivityTail(state, context, layout) {
|
|
|
564
566
|
}
|
|
565
567
|
/**
|
|
566
568
|
* Append-only live view over one command's successive settled snapshots. The
|
|
567
|
-
* first three tools stream immediately; later tools wait in a two-row tail
|
|
568
|
-
*
|
|
569
|
-
*
|
|
570
|
-
*
|
|
569
|
+
* first three tools stream immediately; later tools wait in a two-row tail.
|
|
570
|
+
* A say omits the earlier tail, so only the last two extra tools after the
|
|
571
|
+
* final say can print at closing. Newer tools displace older tail candidates
|
|
572
|
+
* in place. Other narrative rows wait behind undecided tail tools.
|
|
571
573
|
*/
|
|
572
574
|
export function activityStream(context, layout = plainLayout()) {
|
|
573
575
|
const state = {
|
|
574
576
|
newestSettledSequence: undefined,
|
|
575
|
-
|
|
577
|
+
admissionSequence: undefined,
|
|
578
|
+
pendingTellSequences: new Set(),
|
|
576
579
|
previousClock: undefined,
|
|
577
580
|
renderedBoundaries: new Set(),
|
|
578
581
|
admittedTellSequences: new Set(),
|
|
579
582
|
openingTools: 0,
|
|
580
583
|
deferred: [],
|
|
584
|
+
liveRows: new Map(),
|
|
581
585
|
};
|
|
582
586
|
const seed = (activity, alreadyRenderedSequence) => {
|
|
583
587
|
const lines = [];
|
|
584
|
-
if (alreadyRenderedSequence !== undefined)
|
|
588
|
+
if (alreadyRenderedSequence !== undefined) {
|
|
589
|
+
state.admissionSequence = alreadyRenderedSequence;
|
|
585
590
|
state.admittedTellSequences.add(alreadyRenderedSequence);
|
|
591
|
+
}
|
|
586
592
|
const boundary = currentTurnBoundary(activity);
|
|
587
593
|
const unseenBoundary = boundary !== undefined && !state.renderedBoundaries.has(boundary.turnSequence);
|
|
588
594
|
if (unseenBoundary) {
|
|
589
|
-
if (boundary.row.sequence
|
|
595
|
+
if (alreadyRenderedSequence !== undefined && boundary.row.sequence > alreadyRenderedSequence) {
|
|
596
|
+
const beforeBoundary = baselineOmissionCount(activity, alreadyRenderedSequence, boundary.row.sequence);
|
|
597
|
+
if (beforeBoundary > 0)
|
|
598
|
+
lines.push(layout.marker(beforeBoundary));
|
|
599
|
+
}
|
|
600
|
+
if (alreadyRenderedSequence !== undefined && boundary.row.sequence <= alreadyRenderedSequence)
|
|
590
601
|
state.renderedBoundaries.add(boundary.turnSequence);
|
|
591
602
|
else
|
|
592
603
|
renderCurrentTurnBoundary(state, activity, lines, context, layout);
|
|
593
|
-
|
|
604
|
+
rememberLiveRows(state, activity);
|
|
605
|
+
const omitted = baselineOmissionCount(activity, alreadyRenderedSequence === undefined
|
|
606
|
+
? boundary.row.sequence
|
|
607
|
+
: Math.max(boundary.row.sequence, alreadyRenderedSequence));
|
|
594
608
|
if (omitted > 0)
|
|
595
609
|
lines.push(layout.marker(omitted));
|
|
596
610
|
}
|
|
597
|
-
|
|
611
|
+
rememberPendingTells(state, activity);
|
|
612
|
+
rememberLiveRows(state, activity);
|
|
598
613
|
const rows = settledRows(activity);
|
|
599
614
|
if (rows.length > 0)
|
|
600
615
|
state.newestSettledSequence = rows.reduce((newest, row) => Math.max(newest, row.sequence), rows[0].sequence);
|
|
601
616
|
return lines;
|
|
602
617
|
};
|
|
603
618
|
const observe = (activity) => observeActivitySnapshot(state, activity, context, layout);
|
|
604
|
-
const
|
|
605
|
-
|
|
619
|
+
const frame = () => groupedEntries([...state.liveRows.values()]
|
|
620
|
+
.sort((left, right) => left.sequence - right.sequence)
|
|
621
|
+
.map((row) => ({ kind: "row", row })), context, layout, { live: true, inFlightSay: (row) => row.kind === "said" });
|
|
622
|
+
const flush = () => {
|
|
623
|
+
if ([...state.liveRows.values()].some((row) => row.kind === "said"))
|
|
624
|
+
omitPreSayTools(state);
|
|
625
|
+
const lines = [...flushActivityTail(state, context, layout)];
|
|
626
|
+
for (const row of [...state.liveRows.values()].sort((left, right) => left.sequence - right.sequence)) {
|
|
627
|
+
const unresolved = row.kind === "tool" && row.state === "active" ? { ...row, state: "unsettled" } : row;
|
|
628
|
+
renderStreamRow(state, unresolved, lines, {
|
|
629
|
+
context,
|
|
630
|
+
layout,
|
|
631
|
+
unsettled: true,
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
state.liveRows.clear();
|
|
635
|
+
return lines;
|
|
636
|
+
};
|
|
637
|
+
return Object.assign(observe, { seed, frame, flush });
|
|
606
638
|
}
|
|
607
|
-
function conclusionMarkVerb(status,
|
|
608
|
-
if (failedOutcomeDiagnostic(status) !== undefined)
|
|
639
|
+
function conclusionMarkVerb(status, outcome) {
|
|
640
|
+
if (outcome === "failed" || (status !== undefined && failedOutcomeDiagnostic(status) !== undefined))
|
|
609
641
|
return { mark: "!", verb: "failed" };
|
|
610
|
-
if (answered)
|
|
642
|
+
if (outcome === "answered")
|
|
611
643
|
return { mark: "✓", verb: "answered" };
|
|
644
|
+
if (outcome === "unanswered")
|
|
645
|
+
return { mark: "○", verb: "unanswered" };
|
|
646
|
+
if (status === undefined)
|
|
647
|
+
return { mark: "⧗", verb: "pending tell" };
|
|
612
648
|
if (status.life === "running")
|
|
613
|
-
return { mark: "●", verb: "
|
|
649
|
+
return { mark: "●", verb: "running" };
|
|
614
650
|
if (!defaultWaitComplete(status)) {
|
|
615
651
|
return { mark: "⧗", verb: "pending tell" };
|
|
616
652
|
}
|
|
@@ -777,13 +813,13 @@ export function inputWaitConclusion(observation, input) {
|
|
|
777
813
|
const complete = observation.reason !== "deadline";
|
|
778
814
|
const pinned = input.completedAt == null ? Number.NaN : Date.parse(input.completedAt);
|
|
779
815
|
const at = complete ? (Number.isFinite(pinned) ? pinned : undefined) : end;
|
|
780
|
-
const conclusion = observation.reason === "answered"
|
|
781
|
-
?
|
|
816
|
+
const conclusion = conclusionMarkVerb(input.status, observation.reason === "answered"
|
|
817
|
+
? "answered"
|
|
782
818
|
: observation.reason === "failed" || observation.reason === "invalid-output"
|
|
783
|
-
?
|
|
819
|
+
? "failed"
|
|
784
820
|
: observation.reason === "unanswered"
|
|
785
|
-
?
|
|
786
|
-
:
|
|
821
|
+
? "unanswered"
|
|
822
|
+
: "life");
|
|
787
823
|
return [
|
|
788
824
|
waitConclusionRow({
|
|
789
825
|
...(at === undefined ? {} : { at }),
|
|
@@ -841,14 +877,14 @@ function concludeWaitStream(state, result, startedAt, now) {
|
|
|
841
877
|
const status = observation.status;
|
|
842
878
|
const complete = defaultWaitComplete(status);
|
|
843
879
|
const at = complete ? (state.settledAt.get(id) ?? end) : end;
|
|
844
|
-
const { mark, verb } = conclusionMarkVerb(status, statusAnswer(observation) !== undefined);
|
|
880
|
+
const { mark, verb } = conclusionMarkVerb(status, statusAnswer(observation) !== undefined ? "answered" : "life");
|
|
845
881
|
const target = multi ? ` ${padToDisplay(sourceTag(state, id), state.sourceWidth)}` : "";
|
|
846
882
|
return [waitConclusionRow({ at, startedAt, complete, end, mark, verb, target })];
|
|
847
883
|
});
|
|
848
884
|
const answeredSingle = !multi && result.observations.length === 1 && statusAnswer(result.observations[0]) !== undefined;
|
|
849
885
|
const blocks = [
|
|
886
|
+
...(conclusions.length > 0 ? [conclusions.join("\n")] : []),
|
|
850
887
|
...(unobservedLines.length > 0 ? [unobservedLines.join("\n")] : []),
|
|
851
|
-
...(conclusions.length > 0 ? [(multi ? [""] : []).concat(conclusions).join("\n")] : []),
|
|
852
888
|
];
|
|
853
889
|
const body = [...tail, ...blocks].join("\n");
|
|
854
890
|
// One blank line keeps the bare stdout answer visually separate from the stream.
|
|
@@ -876,8 +912,10 @@ export function waitObservationStream(context, options = {}) {
|
|
|
876
912
|
freezeWaitTags(state);
|
|
877
913
|
};
|
|
878
914
|
const observe = (round) => observeWaitRound(state, round, context, now);
|
|
915
|
+
const frame = () => [...state.streams.values()].flatMap((stream) => stream.frame());
|
|
916
|
+
const flush = () => [...state.streams.values()].flatMap((stream) => stream.flush());
|
|
879
917
|
const conclude = (result) => concludeWaitStream(state, result, startedAt, now);
|
|
880
|
-
return { select, observe, conclude, streamed: () => state.observed };
|
|
918
|
+
return { select, observe, frame, flush, conclude, streamed: () => state.observed };
|
|
881
919
|
}
|
|
882
920
|
function failedOutcomeDiagnostic(status) {
|
|
883
921
|
const outcome = status.timeline.kind === "idle" ? status.timeline.outcome : undefined;
|
|
@@ -895,6 +933,8 @@ export function inputWaitStream(context, head, options) {
|
|
|
895
933
|
let admittedSequence;
|
|
896
934
|
let opened = false;
|
|
897
935
|
let cursorSeeded = false;
|
|
936
|
+
/** The last observed life, so a caller deadline concludes on the target's status rather than naming the deadline. */
|
|
937
|
+
let lastStatus;
|
|
898
938
|
const admit = (input) => {
|
|
899
939
|
if (admitted)
|
|
900
940
|
throw new Error("input wait admitted more than once");
|
|
@@ -916,10 +956,11 @@ export function inputWaitStream(context, head, options) {
|
|
|
916
956
|
throw new Error("input wait observed before admission");
|
|
917
957
|
opened = true;
|
|
918
958
|
const identity = head();
|
|
919
|
-
lines.push(...snapshotHeading(identity.id, identity.alias, identity.contract)
|
|
959
|
+
lines.push(...snapshotHeading(identity.id, identity.alias, identity.contract));
|
|
920
960
|
};
|
|
921
961
|
const observe = (observation) => {
|
|
922
962
|
const lines = [];
|
|
963
|
+
lastStatus = observation.status;
|
|
923
964
|
open(lines);
|
|
924
965
|
const activityInput = { snapshot: observation.status.timeline, rows: observation.rows };
|
|
925
966
|
if (!cursorSeeded && options.cursor === "admission")
|
|
@@ -929,6 +970,8 @@ export function inputWaitStream(context, head, options) {
|
|
|
929
970
|
cursorSeeded = true;
|
|
930
971
|
return lines;
|
|
931
972
|
};
|
|
973
|
+
const frame = () => activity.frame();
|
|
974
|
+
const flush = () => activity.flush();
|
|
932
975
|
const conclude = (result) => {
|
|
933
976
|
const lines = [];
|
|
934
977
|
open(lines, result.kind === "failed");
|
|
@@ -940,10 +983,12 @@ export function inputWaitStream(context, head, options) {
|
|
|
940
983
|
startedAt,
|
|
941
984
|
...(result.completedAt === undefined ? {} : { completedAt: result.completedAt }),
|
|
942
985
|
now: now(),
|
|
986
|
+
...(lastStatus === undefined ? {} : { status: lastStatus }),
|
|
943
987
|
}));
|
|
988
|
+
lines.push(...head().facts);
|
|
944
989
|
return `${lines.join("\n")}${options.answerSeparator === true ? "\n\n" : ""}`;
|
|
945
990
|
};
|
|
946
|
-
return { admitted: admit, observe, conclude, opened: () => opened };
|
|
991
|
+
return { admitted: admit, observe, frame, flush, conclude, opened: () => opened };
|
|
947
992
|
}
|
|
948
993
|
export function callObservationStream(context, head, options = {}) {
|
|
949
994
|
const stream = inputWaitStream(context, () => head, {
|
|
@@ -953,7 +998,7 @@ export function callObservationStream(context, head, options = {}) {
|
|
|
953
998
|
});
|
|
954
999
|
stream.admitted({ ...(options.admittedAt === undefined ? {} : { at: options.admittedAt }), rows: [] });
|
|
955
1000
|
return {
|
|
956
|
-
|
|
1001
|
+
...stream,
|
|
957
1002
|
conclude: (observation) => {
|
|
958
1003
|
if (observation.kind === "failed")
|
|
959
1004
|
return stream.conclude({ kind: "failed", diagnostic: observation.failure.diagnostic });
|
|
@@ -965,30 +1010,15 @@ export function callObservationStream(context, head, options = {}) {
|
|
|
965
1010
|
...(observation.completedAt === undefined ? {} : { completedAt: observation.completedAt }),
|
|
966
1011
|
});
|
|
967
1012
|
},
|
|
968
|
-
opened: stream.opened,
|
|
969
1013
|
};
|
|
970
1014
|
}
|
|
971
|
-
function taskDispositionMark(disposition) {
|
|
972
|
-
if (disposition === "done")
|
|
973
|
-
return "✓";
|
|
974
|
-
if (disposition === "drop")
|
|
975
|
-
return "×";
|
|
976
|
-
if (disposition === "on_hold")
|
|
977
|
-
return "⧗";
|
|
978
|
-
if (disposition === "in_progress")
|
|
979
|
-
return "●";
|
|
980
|
-
return disposition === "blocked" ? "‖" : "○";
|
|
981
|
-
}
|
|
982
|
-
function changeStat(change) {
|
|
983
|
-
return change.diffstat === undefined ? "+? -?" : `+${change.diffstat.added} -${change.diffstat.removed}`;
|
|
984
|
-
}
|
|
985
1015
|
function renderReportedChangeLines(snapshot) {
|
|
986
1016
|
if (snapshot.reportedChanges.length === 0 && snapshot.reportedChangesOmitted === 0)
|
|
987
1017
|
return [];
|
|
988
|
-
const width = snapshot.reportedChanges.reduce((max, change) => Math.max(max,
|
|
1018
|
+
const width = snapshot.reportedChanges.reduce((max, change) => Math.max(max, renderDiffstat(change.diffstat).length), 0);
|
|
989
1019
|
return [
|
|
990
1020
|
`changes ${snapshot.reportedChanges.length + snapshot.reportedChangesOmitted}`,
|
|
991
|
-
...snapshot.reportedChanges.map((change) => ` ${
|
|
1021
|
+
...snapshot.reportedChanges.map((change) => ` ${renderDiffstat(change.diffstat).padEnd(width)} ${safeText(change.path)}`),
|
|
992
1022
|
...(snapshot.reportedChangesOmitted > 0 ? [` ⋮ ${snapshot.reportedChangesOmitted} more files`] : []),
|
|
993
1023
|
];
|
|
994
1024
|
}
|
|
@@ -1031,32 +1061,40 @@ function answeredBlock(observation, answer, alias, columns) {
|
|
|
1031
1061
|
function snapshotCore(view, context, options) {
|
|
1032
1062
|
const activity = snapshotActivityLines(view.status.timeline, context);
|
|
1033
1063
|
const facts = [
|
|
1034
|
-
...(view.status.cwd === undefined ? [] : [`cwd ${safeText(view.status.cwd)}`]),
|
|
1035
1064
|
...(options.showAllowed === true ? [`allowed ${view.status.allowed.join(", ") || "none"}`] : []),
|
|
1036
1065
|
...contractFacts(view.contract),
|
|
1037
1066
|
...(options.facts ?? []),
|
|
1067
|
+
...(view.status.cwd === undefined ? [] : [`cwd ${safeText(view.status.cwd)}`]),
|
|
1038
1068
|
];
|
|
1039
1069
|
return {
|
|
1040
1070
|
activity,
|
|
1041
|
-
lines: [...snapshotHeading(view.status.id, options.alias, view.contract), ...
|
|
1071
|
+
lines: [...snapshotHeading(view.status.id, options.alias, view.contract), ...activity],
|
|
1072
|
+
facts,
|
|
1042
1073
|
};
|
|
1043
1074
|
}
|
|
1075
|
+
function snapshotConclusion(status) {
|
|
1076
|
+
const timeline = status.timeline;
|
|
1077
|
+
// The outcome row (`✓ answer` / `! error`) is already the ending; a closer would be a second mark
|
|
1078
|
+
// carrying no new information, so it is absent exactly then.
|
|
1079
|
+
if (timeline.kind === "idle" && timeline.outcome !== undefined)
|
|
1080
|
+
return "";
|
|
1081
|
+
const last = [...timeline.entries].reverse().find((entry) => entry.kind === "row")?.row;
|
|
1082
|
+
const { mark, verb } = conclusionMarkVerb(status, "life");
|
|
1083
|
+
return `${last === undefined ? "unknown" : clock(last.at)} ${mark} ${verb}`;
|
|
1084
|
+
}
|
|
1044
1085
|
export function snapshotText(view, context, options = {}) {
|
|
1045
1086
|
const core = snapshotCore(view, context, options);
|
|
1046
1087
|
const taskContext = renderTaskContextLines(view.createdTasks, context.columns);
|
|
1088
|
+
const conclusion = snapshotConclusion(view.status);
|
|
1047
1089
|
return [
|
|
1048
1090
|
...core.lines,
|
|
1049
|
-
...(
|
|
1050
|
-
...taskContext,
|
|
1091
|
+
...(conclusion.length === 0 ? [] : [conclusion]),
|
|
1092
|
+
...(taskContext.length > 0 ? ["", ...taskContext] : []),
|
|
1093
|
+
...(view.status.timeline.reportedChanges.length > 0 || view.status.timeline.reportedChangesOmitted > 0 ? [""] : []),
|
|
1051
1094
|
...renderReportedChangeLines(view.status.timeline),
|
|
1052
|
-
"",
|
|
1053
|
-
lifeLabel(view.status.life),
|
|
1095
|
+
...(core.facts.length > 0 ? ["", ...core.facts] : []),
|
|
1054
1096
|
].join("\n");
|
|
1055
1097
|
}
|
|
1056
|
-
function mutationSnapshotText(view, context, options = {}) {
|
|
1057
|
-
const core = snapshotCore(view, context, options);
|
|
1058
|
-
return [...core.lines, ...(options.showLife === false ? [] : ["", lifeLabel(view.status.life)])].join("\n");
|
|
1059
|
-
}
|
|
1060
1098
|
function killResultLabel(evidence) {
|
|
1061
1099
|
if (evidence === "killed")
|
|
1062
1100
|
return "✓ killed";
|
|
@@ -1069,11 +1107,6 @@ function killResultLabel(evidence) {
|
|
|
1069
1107
|
export function killResultText(id, evidence, alias) {
|
|
1070
1108
|
return [...snapshotHeading(id, alias, undefined), "", killResultLabel(evidence)].join("\n");
|
|
1071
1109
|
}
|
|
1072
|
-
export function mutationObservationStageText(id, observation, context, options = {}) {
|
|
1073
|
-
if (observation.kind === "unobserved")
|
|
1074
|
-
return unobservedText(id, observation.diagnostic);
|
|
1075
|
-
return mutationSnapshotText(observation, context, options);
|
|
1076
|
-
}
|
|
1077
1110
|
export function statusAnswer(view) {
|
|
1078
1111
|
if (!defaultWaitComplete(view.status))
|
|
1079
1112
|
return undefined;
|
|
@@ -1087,56 +1120,40 @@ export function statusAnswer(view) {
|
|
|
1087
1120
|
function answerBytes(answer, structured) {
|
|
1088
1121
|
return !structured && typeof answer === "string" ? answer : JSON.stringify(answer);
|
|
1089
1122
|
}
|
|
1090
|
-
function
|
|
1091
|
-
if (result.
|
|
1092
|
-
return undefined;
|
|
1093
|
-
if (result.result.observation.reason !== "answered")
|
|
1123
|
+
export function askRawAnswer(result, structured) {
|
|
1124
|
+
if (result.observation.reason !== "answered")
|
|
1094
1125
|
return "";
|
|
1095
|
-
return answerBytes(result.
|
|
1126
|
+
return answerBytes(result.observation.answer, structured === true);
|
|
1096
1127
|
}
|
|
1097
|
-
function
|
|
1098
|
-
const observation = result.
|
|
1128
|
+
export function callRawAnswer(result, streamed) {
|
|
1129
|
+
const observation = result.observation;
|
|
1099
1130
|
if (observation.kind !== "observed" || observation.observation.reason !== "answered")
|
|
1100
|
-
return
|
|
1101
|
-
return answerBytes(observation.observation.answer, result.
|
|
1131
|
+
return streamed ? "" : undefined;
|
|
1132
|
+
return answerBytes(observation.observation.answer, result.structured === true);
|
|
1102
1133
|
}
|
|
1103
|
-
function
|
|
1104
|
-
const total = result.
|
|
1105
|
-
if (
|
|
1134
|
+
export function waitRawAnswer(result, streamed) {
|
|
1135
|
+
const total = result.observations.length + result.unobserved.length;
|
|
1136
|
+
if (streamed) {
|
|
1106
1137
|
// Plural waits leave stdout empty so one answer can never be mistaken for the whole result.
|
|
1107
1138
|
if (total !== 1)
|
|
1108
1139
|
return "";
|
|
1109
|
-
const single = result.
|
|
1140
|
+
const single = result.observations[0];
|
|
1110
1141
|
return single === undefined ? "" : (statusAnswer(single) ?? "");
|
|
1111
1142
|
}
|
|
1112
1143
|
if (total !== 1)
|
|
1113
1144
|
return undefined;
|
|
1114
|
-
return statusAnswer(result.
|
|
1145
|
+
return statusAnswer(result.observations[0]);
|
|
1115
1146
|
}
|
|
1116
|
-
function
|
|
1117
|
-
if (
|
|
1147
|
+
export function historyRawAnswer(result, historyId) {
|
|
1148
|
+
if (historyId === undefined || result.kind !== "exact")
|
|
1118
1149
|
return undefined;
|
|
1119
|
-
const outcome = result.
|
|
1150
|
+
const outcome = result.outcome.outcome;
|
|
1120
1151
|
return outcome.kind === "answered" ? outcome.answer : outcome.diagnostic;
|
|
1121
1152
|
}
|
|
1122
|
-
export function
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
case "call":
|
|
1127
|
-
return callAnswer(result);
|
|
1128
|
-
case "wait":
|
|
1129
|
-
return waitAnswer(result);
|
|
1130
|
-
case "history":
|
|
1131
|
-
return historyAnswer(result);
|
|
1132
|
-
default:
|
|
1133
|
-
return undefined;
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
export function waitText(result, context) {
|
|
1137
|
-
const alias = result.alias;
|
|
1138
|
-
const observations = result.result.observations;
|
|
1139
|
-
const unobserved = result.result.unobserved;
|
|
1153
|
+
export function waitText(result, presentation, context) {
|
|
1154
|
+
const alias = presentation.alias;
|
|
1155
|
+
const observations = result.observations;
|
|
1156
|
+
const unobserved = result.unobserved;
|
|
1140
1157
|
const total = observations.length + unobserved.length;
|
|
1141
1158
|
if (total <= 1) {
|
|
1142
1159
|
const single = [
|
|
@@ -1151,13 +1168,13 @@ export function waitText(result, context) {
|
|
|
1151
1168
|
return single.join("\n\n");
|
|
1152
1169
|
}
|
|
1153
1170
|
const end = Date.now();
|
|
1154
|
-
const startedAt =
|
|
1171
|
+
const startedAt = presentation.startedAt ?? end;
|
|
1155
1172
|
const order = [];
|
|
1156
1173
|
const remember = (id) => {
|
|
1157
1174
|
if (!order.includes(id))
|
|
1158
1175
|
order.push(id);
|
|
1159
1176
|
};
|
|
1160
|
-
for (const member of
|
|
1177
|
+
for (const member of presentation.selection ?? [])
|
|
1161
1178
|
remember(member.id);
|
|
1162
1179
|
for (const observation of observations)
|
|
1163
1180
|
remember(observation.status.id);
|
|
@@ -1192,23 +1209,24 @@ export function waitText(result, context) {
|
|
|
1192
1209
|
const status = observation.status;
|
|
1193
1210
|
const complete = defaultWaitComplete(status);
|
|
1194
1211
|
const at = complete ? (settleMoment(status) ?? end) : end;
|
|
1195
|
-
const { mark, verb } = conclusionMarkVerb(status, statusAnswer(observation) !== undefined);
|
|
1212
|
+
const { mark, verb } = conclusionMarkVerb(status, statusAnswer(observation) !== undefined ? "answered" : "life");
|
|
1196
1213
|
return [
|
|
1197
1214
|
`${clockFromMs(at)} ${padToDisplay(waitIdentityTag(id, order), sourceWidth)} ${mark} ${verb}${conclusionClause(at, startedAt, complete, end)}`,
|
|
1198
1215
|
];
|
|
1199
1216
|
});
|
|
1200
1217
|
return rows.length > 0 ? [...blocks, rows.join("\n")].join("\n\n") : blocks.join("\n\n");
|
|
1201
1218
|
}
|
|
1202
|
-
export function historyText(
|
|
1203
|
-
if (
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1219
|
+
export function historyText(result, presentation, context) {
|
|
1220
|
+
if (presentation.id !== undefined) {
|
|
1221
|
+
if (result.kind !== "exact")
|
|
1222
|
+
return `${result.kind === "unknown-history" ? result.historyId : "unknown"} has no matching retained outcome`;
|
|
1223
|
+
return result.outcome.outcome.kind === "answered"
|
|
1224
|
+
? result.outcome.outcome.answer
|
|
1225
|
+
: result.outcome.outcome.diagnostic;
|
|
1208
1226
|
}
|
|
1209
|
-
if (
|
|
1210
|
-
return result.
|
|
1211
|
-
if (result.
|
|
1227
|
+
if (presentation.last === true)
|
|
1228
|
+
return result.kind === "last" ? result.answer : "no answer retained";
|
|
1229
|
+
if (result.kind !== "history")
|
|
1212
1230
|
throw new Error("history result lacks page");
|
|
1213
1231
|
const rows = groupedRows(result.history.rows, context, historyLayout());
|
|
1214
1232
|
const paging = result.history.omitted > 0
|
|
@@ -1218,22 +1236,24 @@ export function historyText(command, result, context) {
|
|
|
1218
1236
|
: `${result.history.omitted} earlier events · showing last ${result.history.rows.length}`),
|
|
1219
1237
|
]
|
|
1220
1238
|
: [];
|
|
1221
|
-
return [...snapshotHeading(result.
|
|
1222
|
-
}
|
|
1223
|
-
export function tellText(result, context, options = {}) {
|
|
1224
|
-
const wake = result.
|
|
1225
|
-
const target = identity(result.
|
|
1226
|
-
const
|
|
1239
|
+
return [...snapshotHeading(result.id, presentation.alias, result.contract), ...paging, ...rows].join("\n");
|
|
1240
|
+
}
|
|
1241
|
+
export function tellText(result, alias, context, options = {}) {
|
|
1242
|
+
const wake = result.tell.wake;
|
|
1243
|
+
const target = identity(result.akuma, alias);
|
|
1244
|
+
const glyph = wake.kind === "failed" ? "!" : wake.kind === "held" ? "⧗" : "✓";
|
|
1245
|
+
const verb = wake.kind === "failed" || wake.kind === "held" ? "tell" : "told";
|
|
1246
|
+
const row = groupedRows([result.tell.row], context, {
|
|
1227
1247
|
...plainLayout(),
|
|
1228
|
-
head: (time, _glyph, _verb, columns) => eventPrefix(
|
|
1248
|
+
head: (time, _glyph, _verb, columns) => eventPrefix(glyph, verb, time, columns),
|
|
1229
1249
|
singleLine: true,
|
|
1230
1250
|
}).join("\n");
|
|
1231
|
-
const
|
|
1251
|
+
const heading = options.identity === false ? [] : snapshotHeading(target, undefined, undefined);
|
|
1232
1252
|
if (wake.kind === "failed") {
|
|
1233
1253
|
const child = "child" in wake ? wake.child : undefined;
|
|
1234
1254
|
const failure = `! tell delivery failed · ${safeText(wake.diagnostic)}${child === undefined ? "" : ` · log ${child.log.path} ${child.log.from}..${child.log.to}`}`;
|
|
1235
1255
|
return [
|
|
1236
|
-
...
|
|
1256
|
+
...heading,
|
|
1237
1257
|
row,
|
|
1238
1258
|
...renderBoundedTextBlock(failure, {
|
|
1239
1259
|
first: "",
|
|
@@ -1243,5 +1263,5 @@ export function tellText(result, context, options = {}) {
|
|
|
1243
1263
|
}),
|
|
1244
1264
|
].join("\n");
|
|
1245
1265
|
}
|
|
1246
|
-
return [...
|
|
1266
|
+
return [...heading, row].join("\n");
|
|
1247
1267
|
}
|