@astrosheep/keiyaku 4.6.31 → 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 +34 -17
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +16 -11
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +5 -3
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +4 -3
- package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +17 -17
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +16 -11
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +5 -3
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +4 -3
- package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +17 -17
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +16 -11
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +5 -3
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +4 -3
- package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +17 -17
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/plugins/pi/README.md +16 -18
- package/build/plugins/pi/akuma-tools.ts +31 -38
- package/build/plugins/pi/keiyaku.ts +15 -4
- package/build/skills/keiyaku-akuma/SKILL.md +16 -11
- package/build/skills/keiyaku-babysit/SKILL.md +5 -3
- package/build/skills/keiyaku-bind/SKILL.md +4 -3
- package/build/skills/keiyaku-debt/SKILL.md +17 -17
- package/build/skills/keiyaku-workflow/SKILL.md +4 -3
- package/build/src/akuma/akuma-call.d.ts +3 -5
- package/build/src/akuma/akuma-call.js +7 -10
- package/build/src/akuma/akuma-errors.d.ts +7 -4
- package/build/src/akuma/akuma-errors.js +16 -12
- package/build/src/akuma/akuma-instance.d.ts +39 -303
- package/build/src/akuma/akuma-instance.js +48 -48
- package/build/src/akuma/akuma-observe.d.ts +5 -4
- package/build/src/akuma/akuma-observe.js +1 -7
- package/build/src/akuma/akuma-owner.d.ts +14 -6
- package/build/src/akuma/akuma-owner.js +33 -27
- package/build/src/akuma/akuma-selection-execution.d.ts +22 -19
- package/build/src/akuma/akuma-selection-execution.js +71 -124
- package/build/src/akuma/akuma-wait.d.ts +3 -3
- package/build/src/akuma/akuma.d.ts +47 -384
- package/build/src/akuma/akuma.js +8 -58
- package/build/src/akuma/archetype.d.ts +16 -19
- package/build/src/akuma/archetype.js +48 -49
- package/build/src/akuma/body.js +31 -26
- package/build/src/akuma/call-initial-tell.d.ts +4 -1
- package/build/src/akuma/call-initial-tell.js +9 -1
- package/build/src/akuma/call-input.d.ts +8 -1
- package/build/src/akuma/call-input.js +27 -18
- package/build/src/akuma/caller.js +2 -1
- package/build/src/akuma/detached-body.js +1 -1
- package/build/src/akuma/heart/facts.d.ts +5 -4
- package/build/src/akuma/heart/facts.js +5 -5
- package/build/src/akuma/heart/soul.js +20 -4
- package/build/src/akuma/identity.d.ts +1 -1
- package/build/src/akuma/identity.js +9 -4
- package/build/src/akuma/index.d.ts +6 -7
- package/build/src/akuma/index.js +2 -3
- package/build/src/akuma/projection.d.ts +3 -0
- 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 +2 -1
- package/build/src/akuma/providers/codex-app-server/index.js +7 -1
- 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 +1 -2
- package/build/src/akuma/publication.js +16 -14
- 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 +281 -240
- package/build/src/akuma/selection-observation.js +122 -68
- package/build/src/akuma/status-projection.d.ts +49 -285
- package/build/src/akuma/status-projection.js +178 -138
- 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.js +2 -1
- package/build/src/cli/commands/akuma-grammar.d.ts +109 -66
- package/build/src/cli/commands/akuma-grammar.js +75 -95
- package/build/src/cli/commands/akuma.d.ts +8 -3
- package/build/src/cli/commands/akuma.js +63 -122
- package/build/src/cli/commands/contract-grammar.d.ts +3 -135
- package/build/src/cli/commands/contract-grammar.js +125 -218
- package/build/src/cli/commands/contract-help.d.ts +24 -21
- package/build/src/cli/commands/contract-help.js +43 -35
- package/build/src/cli/commands/contract.d.ts +6 -18
- package/build/src/cli/commands/contract.js +65 -272
- 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.js +10 -87
- package/build/src/cli/commands/report.d.ts +2 -4
- package/build/src/cli/coordinates.d.ts +1 -1
- package/build/src/cli/coordinates.js +1 -1
- package/build/src/cli/main.js +9 -3
- package/build/src/cli/parse.d.ts +80 -3
- package/build/src/cli/parse.js +76 -16
- package/build/src/cli/render/akuma-activity.d.ts +19 -24
- package/build/src/cli/render/akuma-activity.js +164 -259
- package/build/src/cli/render/akuma.d.ts +3 -3
- package/build/src/cli/render/akuma.js +36 -43
- package/build/src/cli/render/catalog.d.ts +2 -5
- package/build/src/cli/render/catalog.js +2 -33
- package/build/src/cli/render/contract-history.js +1 -2
- package/build/src/cli/render/contract-observation.d.ts +0 -7
- package/build/src/cli/render/contract-observation.js +0 -3
- package/build/src/cli/render/contract.d.ts +7 -9
- package/build/src/cli/render/contract.js +35 -64
- package/build/src/cli/render/debt.d.ts +3 -11
- package/build/src/cli/render/debt.js +17 -88
- package/build/src/cli/render/delivery-preview.js +4 -4
- package/build/src/cli/render/kanshi-akuma.d.ts +5 -3
- package/build/src/cli/render/kanshi-akuma.js +22 -18
- package/build/src/cli/render/kanshi.d.ts +1 -3
- package/build/src/cli/render/kanshi.js +16 -39
- package/build/src/cli/render/receipt.d.ts +21 -12
- package/build/src/cli/render/receipt.js +49 -44
- package/build/src/cli/render/refusal.d.ts +4 -3
- package/build/src/cli/render/refusal.js +15 -17
- package/build/src/cli/render/settings.d.ts +1 -1
- package/build/src/cli/render/terminal.d.ts +9 -8
- package/build/src/cli/render/terminal.js +48 -32
- package/build/src/cli/render/verbs.d.ts +3 -1
- package/build/src/cli/render/verbs.js +74 -116
- package/build/src/cli/runtime.js +66 -65
- package/build/src/cli/streams.d.ts +2 -9
- package/build/src/cli/streams.js +8 -1
- package/build/src/cli/usage.d.ts +2 -1
- package/build/src/cli/usage.js +3 -2
- package/build/src/contract-worktree.js +2 -10
- 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/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 -2
- 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 -2
- package/build/src/core/verbs/deliver.d.ts +1 -2
- package/build/src/core/verbs/placement.d.ts +1 -2
- package/build/src/core/verbs/reintegrate.d.ts +1 -2
- package/build/src/debt/board.d.ts +14 -94
- package/build/src/debt/board.js +25 -160
- package/build/src/debt/catalog.d.ts +0 -2
- package/build/src/debt/catalog.js +1 -22
- package/build/src/debt/document.d.ts +8 -11
- package/build/src/debt/document.js +19 -62
- package/build/src/debt/identity.d.ts +2 -14
- package/build/src/debt/identity.js +19 -49
- package/build/src/debt/index.d.ts +81 -219
- package/build/src/debt/index.js +61 -110
- package/build/src/debt/input.d.ts +19 -5
- package/build/src/debt/input.js +51 -177
- package/build/src/debt/lifecycle-operations.d.ts +1 -3
- package/build/src/debt/lifecycle-operations.js +1 -73
- package/build/src/debt/operation-types.d.ts +24 -128
- package/build/src/debt/operation-types.js +6 -62
- package/build/src/debt/operations.d.ts +8 -17
- package/build/src/debt/operations.js +58 -154
- package/build/src/debt/store.d.ts +0 -2
- package/build/src/debt/store.js +32 -87
- package/build/src/errors.d.ts +28 -0
- package/build/src/errors.js +26 -0
- package/build/src/git/hooks.d.ts +1 -1
- package/build/src/git/observe.d.ts +3 -0
- package/build/src/git/observe.js +19 -5
- package/build/src/git/reconcile.d.ts +3 -16
- package/build/src/git/reconcile.js +0 -18
- package/build/src/git/repository.d.ts +2 -1
- package/build/src/git/repository.js +3 -3
- package/build/src/git/target-placement.d.ts +4 -4
- package/build/src/git/target.d.ts +2 -2
- package/build/src/git/tender.d.ts +1 -2
- package/build/src/git/tender.js +5 -12
- 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.js +4 -3
- package/build/src/index.d.ts +34 -57
- package/build/src/index.js +11 -36
- package/build/src/kanshi/counts.d.ts +3 -8
- package/build/src/kanshi/counts.js +6 -14
- package/build/src/kanshi/index.d.ts +22 -7
- package/build/src/kanshi/index.js +30 -4
- package/build/src/kanshi/read.d.ts +81 -270
- package/build/src/kanshi/read.js +39 -199
- package/build/src/kanshi/report.d.ts +340 -1619
- package/build/src/kanshi/report.js +19 -31
- package/build/src/library/address.d.ts +11 -11
- package/build/src/library/address.js +34 -27
- package/build/src/library/akuma-creation.d.ts +210 -79
- package/build/src/library/akuma-creation.js +201 -242
- package/build/src/library/akumas.d.ts +24 -5
- package/build/src/library/akumas.js +96 -29
- package/build/src/library/bind.d.ts +7 -10
- package/build/src/library/bind.js +2 -8
- package/build/src/library/continuation.d.ts +141 -231
- package/build/src/library/continuation.js +22 -31
- package/build/src/library/contract-address.d.ts +6 -9
- package/build/src/library/contract-address.js +11 -16
- package/build/src/library/contract-composition.d.ts +2 -3
- package/build/src/library/contract-composition.js +12 -19
- package/build/src/library/contract-creation.js +33 -34
- package/build/src/library/contract-outcomes.d.ts +1278 -806
- package/build/src/library/contract-outcomes.js +11 -37
- package/build/src/library/contract-settings.d.ts +1 -2
- package/build/src/library/contract-settings.js +5 -7
- package/build/src/library/contract-types.d.ts +42 -67
- package/build/src/library/contract-types.js +15 -56
- package/build/src/library/contract-wait.d.ts +40 -3
- package/build/src/library/contract-wait.js +28 -21
- package/build/src/library/delivery.d.ts +366 -389
- package/build/src/library/delivery.js +5 -25
- package/build/src/library/input.d.ts +31 -5
- package/build/src/library/input.js +40 -40
- package/build/src/library/invocation.d.ts +13 -11
- package/build/src/library/invocation.js +69 -58
- package/build/src/library/kei.d.ts +16 -8
- package/build/src/library/kei.js +459 -19
- package/build/src/library/keiyaku-attribution.d.ts +0 -8
- package/build/src/library/keiyaku-attribution.js +0 -11
- package/build/src/library/keiyaku-classify.d.ts +2 -2
- package/build/src/library/keiyaku-classify.js +40 -59
- package/build/src/library/keiyaku-coordinates.d.ts +3 -8
- package/build/src/library/keiyaku-coordinates.js +6 -26
- package/build/src/library/keiyaku-debt.d.ts +21 -93
- package/build/src/library/keiyaku-debt.js +8 -157
- package/build/src/library/keiyaku-identity.js +5 -4
- package/build/src/library/keiyaku-verbs.d.ts +4004 -3885
- package/build/src/library/keiyaku-verbs.js +309 -271
- package/build/src/library/keiyaku.d.ts +30 -860
- package/build/src/library/keiyaku.js +169 -256
- package/build/src/library/nuke.d.ts +4 -2
- package/build/src/library/nuke.js +5 -1
- package/build/src/library/outcome.d.ts +424 -307
- package/build/src/library/outcome.js +167 -362
- package/build/src/library/reconcile.d.ts +331 -143
- package/build/src/library/reconcile.js +38 -72
- package/build/src/library/refusal.d.ts +20 -28
- package/build/src/library/refusal.js +1 -11
- package/build/src/library/repo.js +4 -3
- package/build/src/library/selection.d.ts +32 -21
- package/build/src/library/selection.js +63 -87
- package/build/src/mcp/adapter.d.ts +6 -0
- package/build/src/mcp/adapter.js +177 -42
- package/build/src/mcp/help.d.ts +1 -1
- package/build/src/mcp/help.js +12 -7
- package/build/src/mcp/output.d.ts +385 -0
- package/build/src/mcp/output.js +193 -0
- package/build/src/plugin/public.d.ts +4 -0
- package/build/src/plugin/runtime.d.ts +1 -1
- package/build/src/plugin/runtime.js +2 -2
- package/build/src/protocol/amend.d.ts +1 -1
- package/build/src/protocol/amend.js +2 -2
- package/build/src/protocol/bind.d.ts +5 -7
- package/build/src/protocol/bind.js +3 -3
- package/build/src/protocol/completion.d.ts +158 -195
- package/build/src/protocol/completion.js +55 -19
- package/build/src/protocol/deliver.d.ts +11 -6
- package/build/src/protocol/deliver.js +30 -30
- package/build/src/protocol/delivery-preview.d.ts +13 -11
- package/build/src/protocol/delivery-preview.js +2 -2
- package/build/src/protocol/execution-observation.d.ts +5 -13
- package/build/src/protocol/intent.d.ts +6 -9
- package/build/src/protocol/intent.js +18 -31
- package/build/src/protocol/operations.d.ts +48 -53
- package/build/src/protocol/operations.js +16 -25
- package/build/src/protocol/outcome.d.ts +3 -1
- package/build/src/protocol/placement.d.ts +1 -2
- package/build/src/protocol/placement.js +1 -1
- package/build/src/protocol/progress.d.ts +1 -0
- package/build/src/protocol/read/status.d.ts +29 -112
- package/build/src/protocol/read/status.js +52 -78
- package/build/src/protocol/reintegrate.d.ts +1 -2
- package/build/src/protocol/reintegrate.js +0 -1
- package/build/src/protocol/result-leaves.d.ts +11 -32
- package/build/src/protocol/result-leaves.js +18 -57
- package/build/src/protocol/result-reasons.d.ts +6 -6
- package/build/src/protocol/review.js +0 -1
- package/build/src/protocol/verify.d.ts +192 -146
- package/build/src/protocol/verify.js +60 -47
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settings.d.ts +8 -9
- package/build/src/settings.js +16 -13
- package/build/src/settlement/holder.js +2 -2
- package/build/src/settlement/settle.d.ts +0 -6
- package/build/src/settlement/settle.js +0 -4
- package/build/src/verification/declaration.d.ts +3 -6
- package/build/src/verification/declaration.js +3 -5
- package/build/src/verification/observation.d.ts +2 -2
- package/build/src/world.d.ts +3 -2
- package/build/src/world.js +5 -6
- package/package.json +1 -1
- 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 +80 -14
- package/plugins/paseo/plugin/server/message.ts +2 -1
- package/plugins/paseo/plugin/server/mirror-identity.ts +6 -4
- package/plugins/paseo/plugin/server/sdk.ts +9 -11
- package/plugins/paseo/plugin/server/transport.ts +24 -1
- package/plugins/pi/README.md +16 -18
- package/plugins/pi/akuma-tools.ts +31 -38
- package/plugins/pi/keiyaku.ts +15 -4
- package/skills/keiyaku-akuma/SKILL.md +16 -11
- package/skills/keiyaku-babysit/SKILL.md +5 -3
- package/skills/keiyaku-bind/SKILL.md +4 -3
- package/skills/keiyaku-debt/SKILL.md +17 -17
- package/skills/keiyaku-workflow/SKILL.md +4 -3
- 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/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 -29
- package/build/src/cli/render/akuma-tool.js +0 -225
- package/build/src/debt/context.d.ts +0 -28
- package/build/src/debt/context.js +0 -102
- package/build/src/debt/created-observation.d.ts +0 -26
- package/build/src/debt/created-observation.js +0 -38
- package/build/src/debt/query.d.ts +0 -80
- package/build/src/debt/query.js +0 -283
- package/build/src/library/contract-execution.d.ts +0 -28
- package/build/src/library/contract-execution.js +0 -506
- package/build/src/library/keiyaku-policy.d.ts +0 -27
- package/build/src/library/keiyaku-policy.js +0 -44
- package/build/src/library/keiyaku-status.d.ts +0 -1487
- package/build/src/library/keiyaku-status.js +0 -92
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { defaultWaitComplete } from "../../akuma/akuma-observe.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { ageText, 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,14 +74,13 @@ 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" ||
|
|
82
81
|
row.kind === "note" ||
|
|
83
82
|
row.kind === "call" ||
|
|
84
|
-
row.kind === "tell"
|
|
85
|
-
row.kind === "pending-tell") {
|
|
83
|
+
row.kind === "tell") {
|
|
86
84
|
return {
|
|
87
85
|
text: row.text,
|
|
88
86
|
lines: row.kind === "said" || row.kind === "thought" ? 2 : row.kind === "tell" || row.kind === "call" ? 1 : 2,
|
|
@@ -92,18 +90,7 @@ function rowText(row, tool) {
|
|
|
92
90
|
return row.outcome.kind === "answered"
|
|
93
91
|
? { text: row.outcome.answer, lines: 3 }
|
|
94
92
|
: { text: row.outcome.kind === "canceled" ? "canceled" : row.outcome.diagnostic, lines: 2 };
|
|
95
|
-
|
|
96
|
-
return { text: "", lines: 1 };
|
|
97
|
-
if (row.kind !== "tool")
|
|
98
|
-
return { text: "", lines: 1 };
|
|
99
|
-
if (row.call.kind === "other")
|
|
100
|
-
return { text: "", lines: 1 };
|
|
101
|
-
const repr = tool;
|
|
102
|
-
return {
|
|
103
|
-
text: repr.text,
|
|
104
|
-
lines: 1,
|
|
105
|
-
...(repr.suffix === undefined ? {} : { suffix: repr.suffix }),
|
|
106
|
-
};
|
|
93
|
+
return { text: "", lines: 1 };
|
|
107
94
|
}
|
|
108
95
|
/**
|
|
109
96
|
* The action family's one prefix: a state margin, a verb cell at least six cells wide and as wide as a
|
|
@@ -113,15 +100,22 @@ function actionPrefix(margin, verb, columns) {
|
|
|
113
100
|
const available = Math.max(0, columns - displayColumns(margin) - 1);
|
|
114
101
|
const width = Math.min(Math.max(ACTION_VERB_WIDTH, displayColumns(verb)), available);
|
|
115
102
|
const label = truncateDisplayText(verb, width);
|
|
116
|
-
return {
|
|
103
|
+
return {
|
|
104
|
+
first: `${margin}${padToDisplay(label, width)} `,
|
|
105
|
+
continuation: " ".repeat(displayColumns(margin) + width + 1),
|
|
106
|
+
};
|
|
117
107
|
}
|
|
118
108
|
function rowPrefix(row, tool, columns, view) {
|
|
119
109
|
if (row.kind === "tool")
|
|
120
110
|
return actionPrefix(toolMargin(row, view.live === true), tool.label, columns);
|
|
121
111
|
if (row.kind === "thought")
|
|
122
112
|
return actionPrefix(ACTION_MARGIN, "think", columns);
|
|
123
|
-
if (row.kind === "report")
|
|
124
|
-
|
|
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
|
+
}
|
|
125
119
|
if (row.kind === "note")
|
|
126
120
|
return actionPrefix(ACTION_MARGIN, "note", columns);
|
|
127
121
|
if (row.kind === "outcome")
|
|
@@ -131,128 +125,60 @@ function rowPrefix(row, tool, columns, view) {
|
|
|
131
125
|
};
|
|
132
126
|
if (row.kind === "said")
|
|
133
127
|
return { first: TOP_SPEAK, continuation: TOP_SPEAK };
|
|
134
|
-
if (row.kind === "
|
|
128
|
+
if (row.kind === "tell" && row.state === "pending")
|
|
135
129
|
return { first: TOP_PENDING, continuation: TOP_CONTINUATION };
|
|
136
130
|
return { first: TOP_INPUT, continuation: TOP_CONTINUATION };
|
|
137
131
|
}
|
|
138
|
-
function pathTail(path, maximum) {
|
|
139
|
-
if (displayColumns(path) <= maximum)
|
|
140
|
-
return path;
|
|
141
|
-
if (maximum <= 1)
|
|
142
|
-
return maximum === 1 ? "…" : "";
|
|
143
|
-
const separator = path.includes("\\") && !path.includes("/") ? "\\" : "/";
|
|
144
|
-
const parts = path.split(/[\\/]/u);
|
|
145
|
-
const basename = parts.pop() ?? path;
|
|
146
|
-
let tail = basename;
|
|
147
|
-
const marker = `…${separator}`;
|
|
148
|
-
for (const parent of parts.reverse()) {
|
|
149
|
-
if (parent.length === 0)
|
|
150
|
-
continue;
|
|
151
|
-
const candidate = `${parent}${separator}${tail}`;
|
|
152
|
-
if (displayColumns(`${marker}${candidate}`) > maximum)
|
|
153
|
-
break;
|
|
154
|
-
tail = candidate;
|
|
155
|
-
}
|
|
156
|
-
if (displayColumns(`${marker}${tail}`) <= maximum)
|
|
157
|
-
return `${marker}${tail}`;
|
|
158
|
-
return `…${takeDisplayColumnsFromEnd(path, maximum - 1).text}`;
|
|
159
|
-
}
|
|
160
|
-
function renderPathPreview(first, text, pathPreview, columns) {
|
|
161
|
-
const available = Math.max(0, columns - displayColumns(first));
|
|
162
|
-
if (displayColumns(text) <= available)
|
|
163
|
-
return `${first}${text}`;
|
|
164
|
-
const before = pathPreview.before;
|
|
165
|
-
const detail = pathPreview.detail;
|
|
166
|
-
const diagnostic = pathPreview.diagnostic ?? "";
|
|
167
|
-
const descriptorWidth = displayColumns(before) + displayColumns(detail);
|
|
168
|
-
let renderedDetail = detail;
|
|
169
|
-
if (descriptorWidth >= available) {
|
|
170
|
-
const detailBudget = Math.max(0, available - displayColumns(before) - 1);
|
|
171
|
-
renderedDetail = truncateDisplayText(detail, detailBudget);
|
|
172
|
-
}
|
|
173
|
-
const pathWidth = Math.max(0, available - displayColumns(before) - displayColumns(renderedDetail));
|
|
174
|
-
const renderedPath = pathTail(pathPreview.path, pathWidth);
|
|
175
|
-
const base = `${before}${renderedPath}${renderedDetail}`;
|
|
176
|
-
const remainder = Math.max(0, available - displayColumns(base));
|
|
177
|
-
const renderedDiagnostic = remainder > 0 ? truncateDisplayText(diagnostic, remainder) : "";
|
|
178
|
-
return `${first}${base}${renderedDiagnostic}`;
|
|
179
|
-
}
|
|
180
|
-
function renderRunCommand(first, continuation, text, suffix, columns) {
|
|
181
|
-
const firstBudget = Math.max(0, columns - displayColumns(first));
|
|
182
|
-
const secondBudget = Math.max(0, columns - displayColumns(continuation));
|
|
183
|
-
if (displayColumns(`${text}${suffix}`) <= firstBudget)
|
|
184
|
-
return [`${first}${text}${suffix}`];
|
|
185
|
-
const command = text.startsWith("$ ") ? text.slice(2) : text;
|
|
186
|
-
const firstPart = takeDisplayColumns(command, Math.max(0, firstBudget - 2));
|
|
187
|
-
const restWidth = displayColumns(firstPart.rest) + displayColumns(suffix);
|
|
188
|
-
if (restWidth <= secondBudget) {
|
|
189
|
-
return [`${first}$ ${firstPart.text}`, `${continuation}${firstPart.rest}${suffix}`];
|
|
190
|
-
}
|
|
191
|
-
const suffixBudget = Math.min(displayColumns(suffix), Math.max(0, secondBudget - 8));
|
|
192
|
-
const keptSuffix = suffixBudget > 0 ? truncateDisplayText(suffix, suffixBudget) : "";
|
|
193
|
-
const tailBudget = Math.max(0, secondBudget - displayColumns(keptSuffix) - 1);
|
|
194
|
-
const headBudget = Math.max(0, firstBudget - 3);
|
|
195
|
-
const head = takeDisplayColumns(command, headBudget).text;
|
|
196
|
-
const tail = takeDisplayColumnsFromEnd(command, tailBudget).text;
|
|
197
|
-
return [`${first}$ ${head}…`, `${continuation}…${tail}${keptSuffix}`];
|
|
198
|
-
}
|
|
199
132
|
function omissionMarker(text, columns) {
|
|
200
133
|
return `${actionPrefix(ACTION_MARGIN, OMISSION, columns).first}${text}`;
|
|
201
134
|
}
|
|
202
|
-
function rowBody(row, text, columns) {
|
|
203
|
-
if (row.kind !== "tool" || row.call.kind !== "other")
|
|
204
|
-
return text;
|
|
205
|
-
return toolContent(row, columns);
|
|
206
|
-
}
|
|
207
|
-
function tailAnswerPreview(first, text, columns) {
|
|
208
|
-
const readable = safeText(text).replace(/\s+/gu, " ").trim();
|
|
209
|
-
const budget = Math.max(0, columns - displayColumns(first));
|
|
210
|
-
const tail = takeDisplayColumnsFromEnd(readable, budget).text;
|
|
211
|
-
const preview = tail.length === readable.length ? tail : `…${takeDisplayColumnsFromEnd(readable, Math.max(0, budget - 1)).text}`;
|
|
212
|
-
return [`${first}${preview}`];
|
|
213
|
-
}
|
|
214
|
-
function renderCommandOverflow(first, continuation, value, columns, view) {
|
|
215
|
-
const suffix = value.suffix ?? "";
|
|
216
|
-
if (view.compact !== true && view.history !== true)
|
|
217
|
-
return renderRunCommand(first, continuation, value.text, suffix, columns);
|
|
218
|
-
const remaining = columns - displayColumns(first);
|
|
219
|
-
const withSuffix = remaining - displayColumns(suffix);
|
|
220
|
-
const showSuffix = suffix.length > 0 && withSuffix >= 6;
|
|
221
|
-
return [
|
|
222
|
-
`${first}${truncateMiddleDisplayText(value.text, Math.max(0, showSuffix ? withSuffix : remaining))}${showSuffix ? suffix : ""}`,
|
|
223
|
-
];
|
|
224
|
-
}
|
|
225
135
|
/** Every selected timeline row renders through here: one prefix family per row class. */
|
|
226
136
|
function renderRow(row, context, view = {}) {
|
|
227
137
|
const tool = row.kind === "tool" ? toolRepr(row) : undefined;
|
|
228
|
-
const value = rowText(row, tool);
|
|
229
138
|
const { first, continuation } = rowPrefix(row, tool, context.columns, view);
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
return
|
|
237
|
-
|
|
238
|
-
|
|
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";
|
|
239
162
|
return renderBoundedPayload({
|
|
240
|
-
text
|
|
163
|
+
text,
|
|
241
164
|
first,
|
|
242
165
|
continuation,
|
|
243
166
|
columns: context.columns,
|
|
244
167
|
maxLines: singleLine ? 1 : view.history === true ? Number.MAX_SAFE_INTEGER : value.lines,
|
|
245
168
|
quote: "",
|
|
246
169
|
truncated: "truncated" in row && row.truncated === true,
|
|
247
|
-
...(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
|
+
}),
|
|
248
180
|
});
|
|
249
181
|
}
|
|
250
|
-
/** One native activity row through the shared row grammar. */
|
|
251
|
-
export function activityRowLines(row, context, view = {}) {
|
|
252
|
-
return renderRow(row.kind === "answered" || row.kind === "failed" || row.kind === "canceled"
|
|
253
|
-
? { kind: "outcome", outcome: row }
|
|
254
|
-
: row, context, view);
|
|
255
|
-
}
|
|
256
182
|
function groupedEntries(entries, context, view = {}) {
|
|
257
183
|
const lines = [];
|
|
258
184
|
for (const entry of entries) {
|
|
@@ -267,23 +193,6 @@ function groupedEntries(entries, context, view = {}) {
|
|
|
267
193
|
function groupedRows(rows, context, view = {}) {
|
|
268
194
|
return groupedEntries(rows.filter((row) => row.kind !== "turn").map((row) => ({ kind: "row", row })), context, view);
|
|
269
195
|
}
|
|
270
|
-
/** Ordered entry stream of one retained snapshot; an idle outcome keeps its sequence position. */
|
|
271
|
-
function orderedSnapshotEntries(snapshot) {
|
|
272
|
-
if (snapshot.kind !== "idle" || snapshot.outcome === undefined)
|
|
273
|
-
return snapshot.entries;
|
|
274
|
-
const entries = [];
|
|
275
|
-
let outcomeInserted = false;
|
|
276
|
-
for (const entry of snapshot.entries) {
|
|
277
|
-
if (!outcomeInserted && entry.kind === "row" && entry.row.sequence > snapshot.outcome.sequence) {
|
|
278
|
-
entries.push({ kind: "row", row: snapshot.outcome });
|
|
279
|
-
outcomeInserted = true;
|
|
280
|
-
}
|
|
281
|
-
entries.push(entry);
|
|
282
|
-
}
|
|
283
|
-
if (!outcomeInserted)
|
|
284
|
-
entries.push({ kind: "row", row: snapshot.outcome });
|
|
285
|
-
return entries;
|
|
286
|
-
}
|
|
287
196
|
function currentTurnBoundary(activity) {
|
|
288
197
|
const snapshot = activity.snapshot;
|
|
289
198
|
if (snapshot.kind !== "open" || snapshot.openingSequence === undefined)
|
|
@@ -296,42 +205,6 @@ function currentTurnBoundary(activity) {
|
|
|
296
205
|
return undefined;
|
|
297
206
|
return { row, turnSequence: snapshot.turn.sequence };
|
|
298
207
|
}
|
|
299
|
-
/** Open status hides internal thought narration without selecting a second activity window. */
|
|
300
|
-
function visibleOpenSnapshotEntries(snapshot) {
|
|
301
|
-
return snapshot.entries.filter((entry) => entry.kind !== "row" || entry.row.kind !== "thought");
|
|
302
|
-
}
|
|
303
|
-
/** Adjacent omitted spans are one continuous unknown portion of the retained timeline. */
|
|
304
|
-
function coalesceAdjacentGaps(entries) {
|
|
305
|
-
return entries.reduce((coalesced, entry) => {
|
|
306
|
-
const previous = coalesced.at(-1);
|
|
307
|
-
if (entry.kind === "gap" && previous?.kind === "gap") {
|
|
308
|
-
coalesced[coalesced.length - 1] = { kind: "gap", count: previous.count + entry.count };
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
coalesced.push(entry);
|
|
312
|
-
}
|
|
313
|
-
return coalesced;
|
|
314
|
-
}, []);
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Shared snapshot activity rendering. Full snapshots render the selected
|
|
318
|
-
* activity evidence; an idle snapshot is settled evidence. `latest` preserves
|
|
319
|
-
* compact callers' established newest-entry selection.
|
|
320
|
-
*/
|
|
321
|
-
export function snapshotActivityLines(snapshot, context, selection = {}) {
|
|
322
|
-
const entries = orderedSnapshotEntries(snapshot);
|
|
323
|
-
if (selection.latest !== true) {
|
|
324
|
-
const full = snapshot.kind === "open" ? visibleOpenSnapshotEntries(snapshot) : entries;
|
|
325
|
-
return groupedEntries(coalesceAdjacentGaps(full), context);
|
|
326
|
-
}
|
|
327
|
-
const latest = entries.filter((entry) => entry.kind === "row").at(-1);
|
|
328
|
-
return latest === undefined
|
|
329
|
-
? []
|
|
330
|
-
: groupedEntries([latest], context, {
|
|
331
|
-
compact: true,
|
|
332
|
-
...(selection.tailAnswer === true ? { tailAnswer: true } : {}),
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
208
|
function isSettledStreamRow(row) {
|
|
336
209
|
if (row.kind === "turn" || row.kind === "outcome")
|
|
337
210
|
return false;
|
|
@@ -659,8 +532,10 @@ export function inputWaitStream(context, head, options) {
|
|
|
659
532
|
if (result.kind === "failed" && result.evidence !== undefined)
|
|
660
533
|
lines.push(...result.evidence);
|
|
661
534
|
lines.push(...activity.flush());
|
|
662
|
-
if (result.kind === "failed")
|
|
663
|
-
|
|
535
|
+
if (result.kind === "failed") {
|
|
536
|
+
if (result.diagnostic !== undefined)
|
|
537
|
+
lines.push(`! ${safeText(result.diagnostic)}`);
|
|
538
|
+
}
|
|
664
539
|
else {
|
|
665
540
|
const currentTime = now();
|
|
666
541
|
lines.push(...inputWaitConclusion(result.observation, {
|
|
@@ -682,7 +557,6 @@ export function callObservationStream(context, head, options = {}) {
|
|
|
682
557
|
...(options.now === undefined ? {} : { now: options.now }),
|
|
683
558
|
});
|
|
684
559
|
stream.admitted({ ...(options.admittedAt === undefined ? {} : { at: options.admittedAt }), rows: [] });
|
|
685
|
-
/** Tell rows already settled on the timeline, so a failed close never replays one. */
|
|
686
560
|
const settledTells = new Set();
|
|
687
561
|
return {
|
|
688
562
|
...stream,
|
|
@@ -693,17 +567,30 @@ export function callObservationStream(context, head, options = {}) {
|
|
|
693
567
|
return stream.observe(observation);
|
|
694
568
|
},
|
|
695
569
|
conclude: (result) => {
|
|
696
|
-
|
|
697
|
-
|
|
570
|
+
const failures = result.kind === "failed" ? callFailureLines(result.failures, context) : [];
|
|
571
|
+
const controls = [
|
|
572
|
+
...(result.tellId === undefined || callRawAnswer(result, false) !== undefined
|
|
698
573
|
? []
|
|
699
|
-
: [
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
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")
|
|
583
|
+
return "";
|
|
584
|
+
return stream.conclude({
|
|
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
|
+
],
|
|
593
|
+
});
|
|
707
594
|
},
|
|
708
595
|
};
|
|
709
596
|
}
|
|
@@ -719,48 +606,28 @@ function renderReportedChangeLines(view) {
|
|
|
719
606
|
...(view.outsideChanges === undefined ? [] : [` ${view.outsideChanges} outside worktree`]),
|
|
720
607
|
];
|
|
721
608
|
}
|
|
722
|
-
function
|
|
723
|
-
const
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
}
|
|
742
|
-
function selectedStatusActivity(snapshot, context) {
|
|
743
|
-
let omitted = false;
|
|
744
|
-
let marked = false;
|
|
745
|
-
return (snapshot.entries ?? []).flatMap((entry) => {
|
|
746
|
-
if (entry.kind === "gap") {
|
|
747
|
-
omitted = true;
|
|
748
|
-
return [];
|
|
749
|
-
}
|
|
750
|
-
const row = entry.kind === "answered" || entry.kind === "failed" || entry.kind === "canceled"
|
|
751
|
-
? { kind: "outcome", outcome: entry }
|
|
752
|
-
: entry;
|
|
753
|
-
const lines = renderRow(row, context);
|
|
754
|
-
if (lines.length === 0)
|
|
755
|
-
return [];
|
|
756
|
-
const marker = omitted && !marked ? [omissionMarker("earlier activity in history", context.columns)] : [];
|
|
757
|
-
if (omitted)
|
|
758
|
-
marked = true;
|
|
759
|
-
return [...marker, ...lines];
|
|
760
|
-
});
|
|
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
|
+
];
|
|
761
628
|
}
|
|
762
629
|
function snapshotCore(view, context, options) {
|
|
763
|
-
const activity =
|
|
630
|
+
const activity = currentWorkLines(view.work, context);
|
|
764
631
|
const contextFacts = [
|
|
765
632
|
safeText(view.cwd),
|
|
766
633
|
...(view.lastActivityAt === undefined
|
|
@@ -780,11 +647,7 @@ function snapshotCore(view, context, options) {
|
|
|
780
647
|
};
|
|
781
648
|
}
|
|
782
649
|
function snapshotConclusion(status) {
|
|
783
|
-
const
|
|
784
|
-
if (status.timeline.kind === "idle" &&
|
|
785
|
-
entries.some((entry) => entry.kind === "answered" || entry.kind === "failed" || entry.kind === "canceled"))
|
|
786
|
-
return "";
|
|
787
|
-
const conclusion = lifeConclusion(status.life, entries.some((entry) => entry.kind === "pending-tell"));
|
|
650
|
+
const conclusion = lifeConclusion(status.life, status.work.pending !== undefined);
|
|
788
651
|
return `${conclusion.mark} ${conclusion.verb}${status.strandedReason === undefined ? "" : ` · ${status.strandedReason}`}`;
|
|
789
652
|
}
|
|
790
653
|
export function snapshotText(view, context, options = {}) {
|
|
@@ -794,11 +657,7 @@ export function snapshotText(view, context, options = {}) {
|
|
|
794
657
|
return [
|
|
795
658
|
...core.head,
|
|
796
659
|
...(content.length === 0 ? [] : [frameRule(core.head, context.columns), ...content]),
|
|
797
|
-
...subordinateLines([
|
|
798
|
-
...renderReportedChangeLines(view),
|
|
799
|
-
...renderDebtContextLines(view.createdDebts, context.columns - SUBORDINATE_INDENT.length),
|
|
800
|
-
...core.facts,
|
|
801
|
-
]),
|
|
660
|
+
...subordinateLines([...renderReportedChangeLines(view), ...core.facts]),
|
|
802
661
|
].join("\n");
|
|
803
662
|
}
|
|
804
663
|
function killResultLabel(evidence) {
|
|
@@ -820,23 +679,51 @@ export function killResultText(id, evidence, alias) {
|
|
|
820
679
|
evidence: label.evidence,
|
|
821
680
|
}).join("\n");
|
|
822
681
|
}
|
|
823
|
-
function
|
|
824
|
-
|
|
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;
|
|
825
688
|
}
|
|
826
|
-
export function askRawAnswer(result
|
|
827
|
-
if (result.kind
|
|
828
|
-
return "";
|
|
829
|
-
return result.
|
|
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;
|
|
830
693
|
}
|
|
831
|
-
export function callRawAnswer(result,
|
|
832
|
-
|
|
833
|
-
if (input?.kind !== "answered")
|
|
694
|
+
export function callRawAnswer(result, streamed) {
|
|
695
|
+
if (result.input?.kind !== "answered")
|
|
834
696
|
return streamed ? "" : undefined;
|
|
835
|
-
|
|
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;
|
|
836
704
|
}
|
|
837
705
|
export function historyRawAnswer(result, historyId) {
|
|
838
706
|
if (historyId === undefined)
|
|
839
707
|
return undefined;
|
|
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
|
+
}
|
|
840
727
|
if (result.kind === "akuma-report")
|
|
841
728
|
return result.text;
|
|
842
729
|
if (result.kind !== "akuma-exact")
|
|
@@ -962,20 +849,38 @@ export function tellAdmissionRow(text, context, wake) {
|
|
|
962
849
|
truncated: false,
|
|
963
850
|
})[0];
|
|
964
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
|
+
}
|
|
965
873
|
export function tellControlLines(result, context) {
|
|
966
|
-
const lines = [];
|
|
874
|
+
const lines = [...callFailureLines(result.failures ?? [], context)];
|
|
967
875
|
const wake = result.wake;
|
|
968
876
|
if (wake?.kind === "failed") {
|
|
969
|
-
lines.push(...
|
|
970
|
-
state: "failed",
|
|
971
|
-
suffix: wake.logPath === undefined ? "" : ` · log ${wake.logPath}`,
|
|
972
|
-
}));
|
|
877
|
+
lines.push(...callFailureLines([{ ...wake, stage: "wake" }], context));
|
|
973
878
|
}
|
|
974
879
|
else if (wake?.kind === "pending")
|
|
975
880
|
lines.push("wake pending");
|
|
976
881
|
const interrupt = result.interrupt;
|
|
977
882
|
if (interrupt !== undefined)
|
|
978
|
-
lines.push(`interrupt ${interrupt.kind}
|
|
883
|
+
lines.push(`interrupt ${interrupt.kind}${interrupt.kind === "unavailable" ? ` · ${interrupt.evidence}` : ""}`);
|
|
979
884
|
return lines;
|
|
980
885
|
}
|
|
981
886
|
/**
|
|
@@ -986,8 +891,8 @@ export function tellControlLines(result, context) {
|
|
|
986
891
|
*/
|
|
987
892
|
export function tellText(result, prompt, alias, context) {
|
|
988
893
|
const wake = result.wake;
|
|
989
|
-
const mark =
|
|
990
|
-
const verb =
|
|
894
|
+
const mark = result.kind === "failed" ? "!" : wake?.kind === "pending" ? "⧗" : "✓";
|
|
895
|
+
const verb = result.kind === "failed" || wake?.kind === "pending" ? "tell" : "told";
|
|
991
896
|
const head = actionReceipt({
|
|
992
897
|
mark,
|
|
993
898
|
verb,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LiveStatusObservation } from "../../akuma/akuma-observe.js";
|
|
2
2
|
import type { TellResult } from "../../akuma/body.js";
|
|
3
3
|
import type { AkumaId } from "../../akuma/identity.js";
|
|
4
|
-
import type { AkumaAskResult, AkumaKillResult } from "../../akuma/selection-observation.js";
|
|
4
|
+
import type { AkumaAskResult, AkumaTellResult, AkumaKillResult } from "../../akuma/selection-observation.js";
|
|
5
5
|
import type { ForkResult, SpawnResult, SpawnWaitHead } from "../../library/akuma-creation.js";
|
|
6
6
|
import { type ObservedCallHead } from "./akuma-activity.js";
|
|
7
7
|
import { type TextRenderContext } from "./terminal.js";
|
|
@@ -10,10 +10,10 @@ type AskProgress = Readonly<{
|
|
|
10
10
|
observe: (observation: LiveStatusObservation) => readonly string[];
|
|
11
11
|
frame: () => readonly string[];
|
|
12
12
|
flush: () => readonly string[];
|
|
13
|
-
conclude: (result: AkumaAskResult) => readonly string[];
|
|
13
|
+
conclude: (result: AkumaAskResult | AkumaTellResult) => readonly string[];
|
|
14
14
|
}>;
|
|
15
15
|
export declare function askProgressStream(akuma: AkumaId | undefined, alias: string | undefined, context: TextRenderContext, now?: () => number | undefined): AskProgress;
|
|
16
|
-
export declare function waitedTellProgress(result: AkumaAskResult, input: Readonly<{
|
|
16
|
+
export declare function waitedTellProgress(result: AkumaAskResult | AkumaTellResult, input: Readonly<{
|
|
17
17
|
prompt: string;
|
|
18
18
|
alias?: string;
|
|
19
19
|
}>, context: TextRenderContext): string;
|