@astrosheep/keiyaku 4.6.32 → 4.6.34
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 +18 -7
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +18 -11
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +8 -6
- package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +2 -1
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +18 -11
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +8 -6
- package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +2 -1
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +18 -11
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +8 -6
- package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +2 -1
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/plugins/pi/README.md +55 -97
- package/build/plugins/pi/keiyaku.ts +1 -142
- package/build/skills/keiyaku-akuma/SKILL.md +18 -11
- package/build/skills/keiyaku-babysit/SKILL.md +8 -6
- package/build/skills/keiyaku-debt/SKILL.md +2 -1
- package/build/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/src/akuma/akuma-instance.d.ts +11 -0
- package/build/src/akuma/akuma-instance.js +1 -2
- package/build/src/akuma/akuma-observe.d.ts +8 -0
- package/build/src/akuma/akuma-observe.js +81 -14
- package/build/src/akuma/akuma-owner.d.ts +1 -0
- package/build/src/akuma/akuma-owner.js +3 -5
- package/build/src/akuma/akuma-selection-execution.d.ts +82 -7
- package/build/src/akuma/akuma-selection-execution.js +26 -27
- package/build/src/akuma/akuma-wait.d.ts +155 -1
- package/build/src/akuma/akuma-wait.js +94 -34
- package/build/src/akuma/akuma.d.ts +17 -1
- package/build/src/akuma/akuma.js +37 -18
- package/build/src/akuma/body.js +13 -18
- package/build/src/akuma/call-initial-tell.d.ts +0 -1
- package/build/src/akuma/call-initial-tell.js +0 -1
- package/build/src/akuma/heart/activity-schema.d.ts +16 -0
- package/build/src/akuma/heart/activity-schema.js +7 -0
- package/build/src/akuma/heart/facts.d.ts +1 -0
- package/build/src/akuma/heart/facts.js +14 -0
- package/build/src/akuma/heart/index.d.ts +7 -1
- package/build/src/akuma/heart/index.js +35 -9
- package/build/src/akuma/heart/rows.d.ts +1 -0
- package/build/src/akuma/heart/rows.js +4 -0
- package/build/src/akuma/heart/timeline.js +4 -4
- package/build/src/akuma/lineage-cache.d.ts +7 -2
- package/build/src/akuma/lineage-cache.js +48 -24
- package/build/src/akuma/projection-read.d.ts +4 -2
- package/build/src/akuma/projection-read.js +25 -23
- package/build/src/akuma/projection.d.ts +94 -2
- package/build/src/akuma/projection.js +47 -47
- package/build/src/akuma/provider.d.ts +2 -2
- package/build/src/akuma/provider.js +27 -20
- package/build/src/akuma/providers/acp/core.js +2 -5
- package/build/src/akuma/providers/opencode-sdk/events.d.ts +2 -1
- package/build/src/akuma/providers/opencode-sdk/events.js +31 -1
- package/build/src/akuma/publication.js +3 -2
- package/build/src/akuma/selection-observation.d.ts +645 -0
- package/build/src/akuma/selection-observation.js +22 -7
- package/build/src/akuma/status-projection.d.ts +14 -1
- package/build/src/akuma/status-projection.js +40 -2
- package/build/src/akuma/turn-drive.js +21 -15
- package/build/src/body/amend.js +5 -17
- package/build/src/body/decode.js +11 -1
- package/build/src/body/envelope.d.ts +5 -1
- package/build/src/body/envelope.js +4 -2
- package/build/src/body/render.js +4 -6
- package/build/src/bounded-list.d.ts +8 -0
- package/build/src/bounded-list.js +10 -0
- package/build/src/cli/commands/akuma-grammar.d.ts +5 -8
- package/build/src/cli/commands/akuma-grammar.js +52 -77
- package/build/src/cli/commands/akuma.d.ts +1 -2
- package/build/src/cli/commands/akuma.js +12 -61
- package/build/src/cli/commands/contract-grammar.d.ts +1 -0
- package/build/src/cli/commands/contract-grammar.js +39 -42
- package/build/src/cli/commands/contract-help.d.ts +6 -5
- package/build/src/cli/commands/contract-help.js +21 -13
- package/build/src/cli/commands/contract.d.ts +3 -3
- package/build/src/cli/commands/contract.js +13 -9
- package/build/src/cli/commands/debt-grammar.js +2 -4
- package/build/src/cli/parse.d.ts +4 -10
- package/build/src/cli/parse.js +2 -5
- package/build/src/cli/render/akuma-activity.d.ts +12 -34
- package/build/src/cli/render/akuma-activity.js +99 -180
- package/build/src/cli/render/akuma.d.ts +5 -11
- package/build/src/cli/render/akuma.js +22 -30
- package/build/src/cli/render/catalog.js +4 -6
- package/build/src/cli/render/contract-history.d.ts +1 -3
- package/build/src/cli/render/contract-history.js +70 -49
- package/build/src/cli/render/contract-observation.d.ts +2 -1
- package/build/src/cli/render/contract-observation.js +25 -1
- package/build/src/cli/render/contract-wait.d.ts +2 -2
- package/build/src/cli/render/contract-wait.js +21 -17
- package/build/src/cli/render/contract.js +12 -9
- package/build/src/cli/render/debt.js +1 -2
- package/build/src/cli/render/execution-progress.js +1 -3
- package/build/src/cli/render/kanshi-akuma.d.ts +4 -3
- package/build/src/cli/render/kanshi-akuma.js +27 -23
- package/build/src/cli/render/kanshi.js +45 -60
- package/build/src/cli/render/receipt.d.ts +1 -1
- package/build/src/cli/render/receipt.js +33 -28
- package/build/src/cli/render/reconcile.js +2 -5
- package/build/src/cli/render/refusal.js +3 -6
- package/build/src/cli/render/terminal.d.ts +2 -4
- package/build/src/cli/render/terminal.js +10 -17
- package/build/src/cli/render/verbs.d.ts +1 -0
- package/build/src/cli/render/verbs.js +39 -34
- package/build/src/cli/runtime.js +12 -32
- package/build/src/core/facts/codec.js +7 -2
- package/build/src/core/facts/eligibility.d.ts +4 -4
- package/build/src/core/facts/eligibility.js +11 -0
- package/build/src/core/facts/fold.js +9 -5
- package/build/src/core/facts/gate.d.ts +5 -1
- package/build/src/core/facts/gate.js +14 -10
- package/build/src/core/facts/types.d.ts +5 -1
- package/build/src/core/facts/types.js +7 -0
- package/build/src/core/subject.d.ts +4 -1
- package/build/src/core/subject.js +10 -2
- package/build/src/core/verbs/amend.d.ts +15 -4
- package/build/src/core/verbs/amend.js +19 -9
- package/build/src/debt/board.d.ts +2 -1
- package/build/src/debt/board.js +3 -3
- package/build/src/debt/catalog.js +2 -1
- package/build/src/debt/document.d.ts +1 -0
- package/build/src/debt/document.js +3 -0
- package/build/src/debt/index.d.ts +2 -2
- package/build/src/debt/index.js +9 -14
- package/build/src/debt/input.d.ts +2 -1
- package/build/src/debt/input.js +6 -4
- package/build/src/debt/operations.d.ts +2 -1
- package/build/src/dispatch/index.d.ts +0 -17
- package/build/src/dispatch/index.js +1 -10
- package/build/src/git/identity.js +16 -45
- package/build/src/git/nuke.js +13 -23
- package/build/src/git/observe.d.ts +7 -3
- package/build/src/git/observe.js +29 -26
- package/build/src/git/process.js +11 -18
- package/build/src/git/read-observation.d.ts +5 -4
- package/build/src/git/repository.d.ts +2 -0
- package/build/src/git/repository.js +13 -1
- package/build/src/git/scratch.js +2 -14
- package/build/src/git/terminal-reconcile.js +1 -13
- package/build/src/history.d.ts +26 -0
- package/build/src/history.js +43 -0
- package/build/src/index.d.ts +6 -3
- package/build/src/kanshi/counts.d.ts +15 -1
- package/build/src/kanshi/counts.js +14 -3
- package/build/src/kanshi/index.d.ts +3 -4
- package/build/src/kanshi/index.js +2 -3
- package/build/src/kanshi/read.d.ts +21 -0
- package/build/src/kanshi/read.js +7 -3
- package/build/src/kanshi/report.d.ts +94 -0
- package/build/src/library/address.d.ts +12 -5
- package/build/src/library/address.js +18 -32
- package/build/src/library/akuma-creation.d.ts +39 -0
- package/build/src/library/akuma-creation.js +3 -9
- package/build/src/library/akumas.d.ts +5 -1
- package/build/src/library/akumas.js +11 -5
- package/build/src/library/continuation.d.ts +10 -0
- package/build/src/library/contract-composition.js +10 -10
- package/build/src/library/contract-creation.js +12 -13
- package/build/src/library/contract-outcomes.d.ts +72 -1
- package/build/src/library/contract-outcomes.js +1 -0
- package/build/src/library/contract-types.d.ts +233 -25
- package/build/src/library/contract-types.js +32 -12
- package/build/src/library/contract-wait.d.ts +212 -0
- package/build/src/library/contract-wait.js +65 -49
- package/build/src/library/delivery.d.ts +25 -0
- package/build/src/library/input.d.ts +8 -26
- package/build/src/library/input.js +17 -12
- package/build/src/library/kei.js +167 -90
- package/build/src/library/keiyaku-attribution.d.ts +1 -1
- package/build/src/library/keiyaku-attribution.js +3 -1
- package/build/src/library/keiyaku-classify.js +8 -4
- package/build/src/library/keiyaku-debt.d.ts +8 -7
- package/build/src/library/keiyaku-debt.js +1 -2
- package/build/src/library/keiyaku-identity.d.ts +4 -3
- package/build/src/library/keiyaku-identity.js +35 -7
- package/build/src/library/keiyaku-verbs.d.ts +974 -1409
- package/build/src/library/keiyaku-verbs.js +154 -161
- package/build/src/library/keiyaku-wait.d.ts +753 -0
- package/build/src/library/keiyaku-wait.js +230 -0
- package/build/src/library/keiyaku.d.ts +3110 -29
- package/build/src/library/keiyaku.js +342 -438
- package/build/src/library/model-tools.d.ts +754 -0
- package/build/src/library/model-tools.js +362 -0
- package/build/src/library/outcome.js +5 -6
- package/build/src/library/refusal.d.ts +25 -1
- package/build/src/library/refusal.js +4 -5
- package/build/src/library/selection.d.ts +18 -5
- package/build/src/library/selection.js +11 -5
- package/build/src/mcp/adapter.d.ts +0 -6
- package/build/src/mcp/adapter.js +11 -160
- package/build/src/mcp/description.d.ts +2 -0
- package/build/src/mcp/description.js +2 -0
- package/build/src/mcp/help.d.ts +1 -1
- package/build/src/mcp/help.js +10 -7
- package/build/src/pi/index.d.ts +5 -0
- package/build/src/pi/index.js +99 -0
- package/build/src/pi/status.d.ts +12 -0
- package/build/src/pi/status.js +140 -0
- package/build/src/protocol/amend.d.ts +14 -3
- package/build/src/protocol/amend.js +113 -46
- package/build/src/protocol/bind.d.ts +1 -1
- package/build/src/protocol/bind.js +5 -16
- package/build/src/protocol/completion.d.ts +30 -0
- package/build/src/protocol/completion.js +8 -5
- package/build/src/protocol/deliver.js +7 -20
- package/build/src/protocol/delivery-preview.d.ts +5 -0
- package/build/src/protocol/execution-observation.d.ts +8 -0
- package/build/src/protocol/intent.d.ts +1 -0
- package/build/src/protocol/intent.js +4 -1
- package/build/src/protocol/operations.d.ts +56 -16
- package/build/src/protocol/operations.js +18 -32
- package/build/src/protocol/placement.js +7 -1
- package/build/src/protocol/progress.js +0 -6
- package/build/src/protocol/read/status.d.ts +52 -4
- package/build/src/protocol/read/status.js +26 -22
- package/build/src/protocol/reintegrate.js +2 -2
- package/build/src/protocol/result-leaves.d.ts +56 -8
- package/build/src/protocol/result-leaves.js +11 -2
- package/build/src/protocol/run.js +1 -4
- package/build/src/protocol/verify.d.ts +10 -0
- package/build/src/protocol/verify.js +1 -0
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settlement/settle.js +19 -68
- package/package.json +7 -3
- package/plugins/paseo/plugin/index.server.ts +6 -2
- package/plugins/paseo/plugin/server/attach.ts +68 -48
- package/plugins/paseo/plugin/server/directory.ts +259 -0
- package/plugins/paseo/plugin/server/mirror-identity.ts +3 -32
- package/plugins/paseo/plugin/server/reopen.ts +52 -38
- package/plugins/pi/README.md +55 -97
- package/plugins/pi/keiyaku.ts +1 -142
- package/skills/keiyaku-akuma/SKILL.md +18 -11
- package/skills/keiyaku-babysit/SKILL.md +8 -6
- package/skills/keiyaku-debt/SKILL.md +2 -1
- package/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/plugins/pi/akuma-tools.ts +0 -283
- package/build/src/body/keys.d.ts +0 -4
- package/build/src/body/keys.js +0 -11
- package/build/src/kanshi/roster.d.ts +0 -2
- package/build/src/kanshi/roster.js +0 -2
- package/build/src/mcp/output.d.ts +0 -385
- package/build/src/mcp/output.js +0 -193
- package/plugins/pi/akuma-tools.ts +0 -283
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defaultWaitComplete } from "../../akuma/akuma-observe.js";
|
|
2
2
|
import { parseExactHistorySelector } from "../../akuma/identity.js";
|
|
3
|
-
import { renderDiffstat, toolRepr } from "../../akuma/status-projection.js";
|
|
3
|
+
import { permissionText, renderDiffstat, toolRepr, } from "../../akuma/status-projection.js";
|
|
4
4
|
import { ageText, DEFAULT_CLI_COLUMNS, diagnosticLines, displayColumns, padToDisplay, renderBoundedPayload, safeText, truncateDisplayText, } from "./terminal.js";
|
|
5
5
|
export const DEFAULT_CONTEXT = { columns: DEFAULT_CLI_COLUMNS, color: false };
|
|
6
6
|
/** The action family's fixed 3-cell state margin and minimum verb cell. */
|
|
@@ -30,9 +30,6 @@ const TOOL_BUDGET = 3;
|
|
|
30
30
|
function identity(id, alias) {
|
|
31
31
|
return `${id}${alias === undefined ? "" : ` (${alias})`}`;
|
|
32
32
|
}
|
|
33
|
-
function associatedContractId(contract) {
|
|
34
|
-
return contract.kind === "associated" ? contract.contractId : undefined;
|
|
35
|
-
}
|
|
36
33
|
/** The one human-fact separator of this family. */
|
|
37
34
|
const FACT_SEPARATOR = " · ";
|
|
38
35
|
/** A supporting fact of an action receipt or an observation panel is one indent deep. */
|
|
@@ -44,17 +41,13 @@ export function subordinateLines(lines) {
|
|
|
44
41
|
/**
|
|
45
42
|
* The one observation identity line: complete Akuma identity, optional alias as a parenthetical
|
|
46
43
|
* supplement, and a known associated Contract inline behind the shared separator.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const contractId = contract === undefined ? undefined : associatedContractId(contract);
|
|
50
|
-
return `${identity(id, alias)}${contractId === undefined ? "" : `${FACT_SEPARATOR}${contractId}`}`;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Identity and its static coordinates. The execution directory and any already-exposed effective
|
|
54
|
-
* actions belong above the content boundary; an absent coordinate is an absent line.
|
|
44
|
+
* The execution directory and any already-exposed effective actions belong above the content
|
|
45
|
+
* boundary; an absent coordinate is an absent line.
|
|
55
46
|
*/
|
|
56
47
|
export function panelHead(id, alias, contract, context = []) {
|
|
57
|
-
|
|
48
|
+
const contractId = contract?.kind === "associated" ? contract.contractId : undefined;
|
|
49
|
+
const line = `${identity(id, alias)}${contractId === undefined ? "" : `${FACT_SEPARATOR}${contractId}`}`;
|
|
50
|
+
return [line, ...subordinateLines(context)];
|
|
58
51
|
}
|
|
59
52
|
/**
|
|
60
53
|
* One action receipt: the verdict and the complete subject on the first line, every supporting fact
|
|
@@ -86,6 +79,8 @@ function rowText(row) {
|
|
|
86
79
|
lines: row.kind === "said" || row.kind === "thought" ? 2 : row.kind === "tell" || row.kind === "call" ? 1 : 2,
|
|
87
80
|
};
|
|
88
81
|
}
|
|
82
|
+
if (row.kind === "permission")
|
|
83
|
+
return { text: permissionText(row), lines: 2 };
|
|
89
84
|
if (row.kind === "outcome")
|
|
90
85
|
return row.outcome.kind === "answered"
|
|
91
86
|
? { text: row.outcome.answer, lines: 3 }
|
|
@@ -118,6 +113,8 @@ function rowPrefix(row, tool, columns, view) {
|
|
|
118
113
|
}
|
|
119
114
|
if (row.kind === "note")
|
|
120
115
|
return actionPrefix(ACTION_MARGIN, "note", columns);
|
|
116
|
+
if (row.kind === "permission")
|
|
117
|
+
return actionPrefix(ACTION_MARGIN, "approval", columns);
|
|
121
118
|
if (row.kind === "outcome")
|
|
122
119
|
return {
|
|
123
120
|
first: row.outcome.kind === "answered" ? TOP_ANSWER : row.outcome.kind === "canceled" ? "○ " : TOP_FAILURE,
|
|
@@ -222,9 +219,6 @@ function sameTool(left, right) {
|
|
|
222
219
|
function settledRows(activity) {
|
|
223
220
|
return activity.rows.filter((row) => isSettledStreamRow(row) && !inFlightSay(activity, row));
|
|
224
221
|
}
|
|
225
|
-
function isBoundedStreamTool(row) {
|
|
226
|
-
return row.kind === "tool";
|
|
227
|
-
}
|
|
228
222
|
function rememberPendingTells(state, activity) {
|
|
229
223
|
for (const row of activity.rows)
|
|
230
224
|
if (row.kind === "tell" &&
|
|
@@ -316,7 +310,7 @@ function observeActivitySnapshot(state, activity) {
|
|
|
316
310
|
continue;
|
|
317
311
|
// A failed tool is evidence, not routine progress, so it always prints and spends no budget.
|
|
318
312
|
const failed = row.kind === "tool" && typeof row.state === "object" && row.state.status === "error";
|
|
319
|
-
if (
|
|
313
|
+
if (row.kind === "tool" && !failed) {
|
|
320
314
|
if (state.checkpointTools >= TOOL_BUDGET) {
|
|
321
315
|
state.omitted += 1;
|
|
322
316
|
continue;
|
|
@@ -412,17 +406,6 @@ function lifeConclusion(life, pending) {
|
|
|
412
406
|
return { mark: "?", verb: "hung" };
|
|
413
407
|
return { mark: "!", verb: life };
|
|
414
408
|
}
|
|
415
|
-
function conclusionMarkVerb(status, outcome) {
|
|
416
|
-
if (outcome === "failed" || (status !== undefined && failedOutcomeDiagnostic(status) !== undefined))
|
|
417
|
-
return { mark: "!", verb: "failed" };
|
|
418
|
-
if (outcome === "answered")
|
|
419
|
-
return { mark: "✓", verb: "answered" };
|
|
420
|
-
if (outcome === "unanswered")
|
|
421
|
-
return { mark: "○", verb: "unanswered" };
|
|
422
|
-
if (status === undefined)
|
|
423
|
-
return { mark: "⧗", verb: "pending tell" };
|
|
424
|
-
return lifeConclusion(status.life, !defaultWaitComplete(status));
|
|
425
|
-
}
|
|
426
409
|
function durationText(durationMs) {
|
|
427
410
|
const seconds = Math.max(0, Math.round(durationMs / 1000));
|
|
428
411
|
if (seconds < 60)
|
|
@@ -433,37 +416,33 @@ function durationText(durationMs) {
|
|
|
433
416
|
* One wait-style conclusion for every observer of an input-bound Tell. A target
|
|
434
417
|
* that settled at or after this wait began keeps its duration, a target already
|
|
435
418
|
* settled names no duration, and an unfinished target carries the elapsed wait.
|
|
419
|
+
* An ended wait is the deadline itself, so it never reads a pinned completion.
|
|
436
420
|
*/
|
|
437
|
-
function
|
|
438
|
-
const
|
|
439
|
-
? input.at !== undefined && input.at >= input.startedAt
|
|
440
|
-
? ` — ${durationText(Math.max(0, input.at - input.startedAt))}`
|
|
441
|
-
: ""
|
|
442
|
-
: input.end === undefined || !Number.isFinite(input.startedAt)
|
|
443
|
-
? ""
|
|
444
|
-
: ` — waited ${durationText(Math.max(0, input.end - input.startedAt))}`;
|
|
445
|
-
return `${input.mark} ${input.verb}${duration}`;
|
|
446
|
-
}
|
|
447
|
-
export function inputWaitConclusion(observation, input) {
|
|
448
|
-
const end = input.now;
|
|
449
|
-
const complete = observation.kind !== "deadline";
|
|
421
|
+
function waitConclusion(observation, input) {
|
|
422
|
+
const ended = observation.kind === "deadline";
|
|
450
423
|
const pinned = input.completedAt == null ? Number.NaN : Date.parse(input.completedAt);
|
|
451
|
-
const at =
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
424
|
+
const at = ended ? input.now : Number.isFinite(pinned) ? pinned : undefined;
|
|
425
|
+
const failed = observation.kind === "failed" ||
|
|
426
|
+
observation.kind === "invalid-output" ||
|
|
427
|
+
(input.status !== undefined && failedOutcomeDiagnostic(input.status) !== undefined);
|
|
428
|
+
const state = failed
|
|
429
|
+
? { mark: "!", verb: "failed" }
|
|
430
|
+
: observation.kind === "answered"
|
|
431
|
+
? { mark: "✓", verb: "answered" }
|
|
456
432
|
: observation.kind === "unanswered"
|
|
457
|
-
? "unanswered"
|
|
458
|
-
:
|
|
433
|
+
? { mark: "○", verb: "unanswered" }
|
|
434
|
+
: input.status === undefined
|
|
435
|
+
? { mark: "⧗", verb: "pending tell" }
|
|
436
|
+
: lifeConclusion(input.status.life, !defaultWaitComplete(input.status));
|
|
437
|
+
const elapsed = ended
|
|
438
|
+
? at === undefined || !Number.isFinite(input.startedAt)
|
|
439
|
+
? ""
|
|
440
|
+
: ` — waited ${durationText(Math.max(0, at - input.startedAt))}`
|
|
441
|
+
: at !== undefined && at >= input.startedAt
|
|
442
|
+
? ` — ${durationText(Math.max(0, at - input.startedAt))}`
|
|
443
|
+
: "";
|
|
459
444
|
return [
|
|
460
|
-
|
|
461
|
-
...(at === undefined ? {} : { at }),
|
|
462
|
-
startedAt: input.startedAt,
|
|
463
|
-
complete,
|
|
464
|
-
...(end === undefined ? {} : { end }),
|
|
465
|
-
...conclusion,
|
|
466
|
-
}),
|
|
445
|
+
`${state.mark} ${state.verb}${elapsed}`,
|
|
467
446
|
...(observation.kind === "failed" || observation.kind === "invalid-output"
|
|
468
447
|
? [`! ${safeText(observation.diagnostic)}`]
|
|
469
448
|
: []),
|
|
@@ -538,7 +517,7 @@ export function inputWaitStream(context, head, options) {
|
|
|
538
517
|
}
|
|
539
518
|
else {
|
|
540
519
|
const currentTime = now();
|
|
541
|
-
lines.push(...
|
|
520
|
+
lines.push(...waitConclusion(result.observation, {
|
|
542
521
|
startedAt,
|
|
543
522
|
...(result.completedAt === undefined ? {} : { completedAt: result.completedAt }),
|
|
544
523
|
...(currentTime === undefined ? {} : { now: currentTime }),
|
|
@@ -550,50 +529,6 @@ export function inputWaitStream(context, head, options) {
|
|
|
550
529
|
};
|
|
551
530
|
return { admitted: admit, observe, frame, flush, conclude, opened: () => opened };
|
|
552
531
|
}
|
|
553
|
-
export function callObservationStream(context, head, options = {}) {
|
|
554
|
-
const stream = inputWaitStream(context, () => head, {
|
|
555
|
-
cursor: "empty",
|
|
556
|
-
answerSeparator: true,
|
|
557
|
-
...(options.now === undefined ? {} : { now: options.now }),
|
|
558
|
-
});
|
|
559
|
-
stream.admitted({ ...(options.admittedAt === undefined ? {} : { at: options.admittedAt }), rows: [] });
|
|
560
|
-
const settledTells = new Set();
|
|
561
|
-
return {
|
|
562
|
-
...stream,
|
|
563
|
-
observe: (observation) => {
|
|
564
|
-
for (const row of observation.rows)
|
|
565
|
-
if (row.kind === "tell" && row.state === "told")
|
|
566
|
-
settledTells.add(row.tellId);
|
|
567
|
-
return stream.observe(observation);
|
|
568
|
-
},
|
|
569
|
-
conclude: (result) => {
|
|
570
|
-
const failures = result.kind === "failed" ? callFailureLines(result.failures, context) : [];
|
|
571
|
-
const controls = [
|
|
572
|
-
...(result.tellId === undefined || callRawAnswer(result, false) !== undefined
|
|
573
|
-
? []
|
|
574
|
-
: [`input ${result.tellId}`]),
|
|
575
|
-
...tellControlLines(result.wake === undefined ? {} : { wake: result.wake }, context),
|
|
576
|
-
];
|
|
577
|
-
if (result.input !== undefined)
|
|
578
|
-
return [
|
|
579
|
-
stream.conclude({ kind: "observed", observation: result.input }),
|
|
580
|
-
...subordinateLines([...failures, ...controls]),
|
|
581
|
-
].join("\n");
|
|
582
|
-
if (result.kind !== "failed")
|
|
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
|
-
});
|
|
594
|
-
},
|
|
595
|
-
};
|
|
596
|
-
}
|
|
597
532
|
function renderReportedChangeLines(view) {
|
|
598
533
|
const changes = view.changes ?? [];
|
|
599
534
|
if (changes.length === 0 && view.moreChanges !== true && view.outsideChanges === undefined)
|
|
@@ -626,38 +561,31 @@ export function currentWorkLines(work, context) {
|
|
|
626
561
|
: [`${work.outcome.verdict} ${work.outcome.historyId} · activity ${work.outcome.activityId}`]),
|
|
627
562
|
];
|
|
628
563
|
}
|
|
629
|
-
function snapshotCore(view, context, options) {
|
|
630
|
-
const activity = currentWorkLines(view.work, context);
|
|
631
|
-
const contextFacts = [
|
|
632
|
-
safeText(view.cwd),
|
|
633
|
-
...(view.lastActivityAt === undefined
|
|
634
|
-
? []
|
|
635
|
-
: [
|
|
636
|
-
`${view.life} · last activity ${ageText(view.lastActivityAt, new Date(context.now ?? Date.now()).toISOString())} ago`,
|
|
637
|
-
]),
|
|
638
|
-
];
|
|
639
|
-
const facts = [
|
|
640
|
-
...contractFacts(view.contract ?? { kind: "none" }, context.columns - SUBORDINATE_INDENT.length),
|
|
641
|
-
...(options.facts ?? []),
|
|
642
|
-
];
|
|
643
|
-
return {
|
|
644
|
-
activity,
|
|
645
|
-
head: panelHead(view.id, options.alias, view.contract, contextFacts),
|
|
646
|
-
facts,
|
|
647
|
-
};
|
|
648
|
-
}
|
|
649
564
|
function snapshotConclusion(status) {
|
|
650
565
|
const conclusion = lifeConclusion(status.life, status.work.pending !== undefined);
|
|
651
566
|
return `${conclusion.mark} ${conclusion.verb}${status.strandedReason === undefined ? "" : ` · ${status.strandedReason}`}`;
|
|
652
567
|
}
|
|
653
568
|
export function snapshotText(view, context, options = {}) {
|
|
654
|
-
|
|
569
|
+
// A source later than the observation reads as the whole word `now`, so the surface only appends
|
|
570
|
+
// a unit suffix when the age actually names a unit.
|
|
571
|
+
const activityAge = view.lastActivityAt === undefined
|
|
572
|
+
? undefined
|
|
573
|
+
: ageText(view.lastActivityAt, new Date(context.now ?? Date.now()).toISOString());
|
|
574
|
+
const head = panelHead(view.id, options.alias, view.contract, [
|
|
575
|
+
safeText(view.cwd),
|
|
576
|
+
...(activityAge === undefined
|
|
577
|
+
? []
|
|
578
|
+
: [`${view.life} · last activity ${activityAge === "now" ? activityAge : `${activityAge} ago`}`]),
|
|
579
|
+
]);
|
|
655
580
|
const conclusion = snapshotConclusion(view);
|
|
656
|
-
const content = [...
|
|
581
|
+
const content = [...currentWorkLines(view.work, context), ...(conclusion.length === 0 ? [] : [conclusion])];
|
|
657
582
|
return [
|
|
658
|
-
...
|
|
659
|
-
...(content.length === 0 ? [] : [frameRule(
|
|
660
|
-
...subordinateLines([
|
|
583
|
+
...head,
|
|
584
|
+
...(content.length === 0 ? [] : [frameRule(head, context.columns), ...content]),
|
|
585
|
+
...subordinateLines([
|
|
586
|
+
...renderReportedChangeLines(view),
|
|
587
|
+
...contractFacts(view.contract ?? { kind: "none" }, context.columns - SUBORDINATE_INDENT.length),
|
|
588
|
+
]),
|
|
661
589
|
].join("\n");
|
|
662
590
|
}
|
|
663
591
|
function killResultLabel(evidence) {
|
|
@@ -679,29 +607,15 @@ export function killResultText(id, evidence, alias) {
|
|
|
679
607
|
evidence: label.evidence,
|
|
680
608
|
}).join("\n");
|
|
681
609
|
}
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
return result;
|
|
610
|
+
/** The settlement instant a settled observation carries; an open observation has none. */
|
|
611
|
+
export function observationCompletedAt(observation) {
|
|
612
|
+
return observation.kind === "answered" || observation.kind === "failed" || observation.kind === "invalid-output"
|
|
613
|
+
? observation.completedAt
|
|
614
|
+
: undefined;
|
|
688
615
|
}
|
|
689
616
|
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
617
|
return result.kind === "answered" ? JSON.stringify(result.answer) : undefined;
|
|
693
618
|
}
|
|
694
|
-
export function callRawAnswer(result, streamed) {
|
|
695
|
-
if (result.input?.kind !== "answered")
|
|
696
|
-
return streamed ? "" : undefined;
|
|
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;
|
|
704
|
-
}
|
|
705
619
|
export function historyRawAnswer(result, historyId) {
|
|
706
620
|
if (historyId === undefined)
|
|
707
621
|
return undefined;
|
|
@@ -722,7 +636,7 @@ export function historyRawAnswer(result, historyId) {
|
|
|
722
636
|
return `${prefix}${tool.label} ${tool.text}${tool.suffix}${tool.diagnostic === "" ? "" : ` · ${tool.diagnostic}`}`;
|
|
723
637
|
}
|
|
724
638
|
const kind = row.kind === "tell" && row.state === "pending" ? "pending-tell" : row.kind;
|
|
725
|
-
return `${kind}: ${row.text}`;
|
|
639
|
+
return `${kind}: ${rowText(row).text}`;
|
|
726
640
|
}
|
|
727
641
|
if (result.kind === "akuma-report")
|
|
728
642
|
return result.text;
|
|
@@ -733,19 +647,9 @@ export function historyRawAnswer(result, historyId) {
|
|
|
733
647
|
}
|
|
734
648
|
/** One compact wait result line: an observed life mark, the complete identity, a bounded summary. */
|
|
735
649
|
const WAIT_SUMMARY_SEPARATOR = " — ";
|
|
736
|
-
const WAIT_LIFE = {
|
|
737
|
-
running: { mark: "●", state: "running" },
|
|
738
|
-
killed: { mark: "×", state: "killed" },
|
|
739
|
-
hung: { mark: "?", state: "hung" },
|
|
740
|
-
untidy: { mark: "!", state: "untidy" },
|
|
741
|
-
stranded: { mark: "!", state: "stranded" },
|
|
742
|
-
};
|
|
743
650
|
function foldedSummary(value) {
|
|
744
651
|
return safeText(value).replace(/\s+/gu, " ").trim();
|
|
745
652
|
}
|
|
746
|
-
function preview(value, fallback) {
|
|
747
|
-
return foldedSummary(value) || fallback;
|
|
748
|
-
}
|
|
749
653
|
function waitLine(mark, subject, summary, columns) {
|
|
750
654
|
const head = `${mark} ${subject}`;
|
|
751
655
|
const room = columns - displayColumns(head) - displayColumns(WAIT_SUMMARY_SEPARATOR);
|
|
@@ -757,38 +661,31 @@ function waitLine(mark, subject, summary, columns) {
|
|
|
757
661
|
/**
|
|
758
662
|
* The final public snapshot as one wait summary. A stopped life stays explicit over any older
|
|
759
663
|
* outcome; pending input stays visible beside the life it belongs to; a sleeping member without
|
|
760
|
-
* pending input shows its
|
|
761
|
-
*
|
|
664
|
+
* pending input shows its settled outcome, else completion. The mark reports the observed life,
|
|
665
|
+
* never continuing liveness.
|
|
762
666
|
*/
|
|
763
667
|
function waitSummary(member) {
|
|
764
668
|
const pending = member.pending !== undefined;
|
|
765
669
|
const outcome = member.outcome;
|
|
766
|
-
const
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
: outcome.kind === "canceled"
|
|
775
|
-
? { mark: "○", state: "canceled" }
|
|
776
|
-
: { mark: "!", state: preview(outcome.diagnostic, "failed") });
|
|
670
|
+
const observed = member.life === "asleep" && !pending && outcome !== undefined
|
|
671
|
+
? outcome.kind === "answered"
|
|
672
|
+
? { mark: "✓", verb: "answered" }
|
|
673
|
+
: outcome.kind === "canceled"
|
|
674
|
+
? { mark: "○", verb: "canceled" }
|
|
675
|
+
: { mark: "!", verb: "failed" }
|
|
676
|
+
: lifeConclusion(member.life, pending);
|
|
677
|
+
const stopped = member.life !== "asleep";
|
|
777
678
|
return {
|
|
778
|
-
|
|
679
|
+
mark: observed.mark,
|
|
779
680
|
summary: [
|
|
780
|
-
observed.
|
|
781
|
-
...(pending &&
|
|
782
|
-
...(outcome?.kind === "failed" && (
|
|
681
|
+
observed.verb,
|
|
682
|
+
...(pending && stopped ? ["pending tell"] : []),
|
|
683
|
+
...(outcome?.kind === "failed" && (stopped || pending) ? ["failed"] : []),
|
|
783
684
|
...(member.strandedReason === undefined ? [] : [member.strandedReason]),
|
|
784
685
|
].join(FACT_SEPARATOR),
|
|
785
686
|
};
|
|
786
687
|
}
|
|
787
|
-
/**
|
|
788
|
-
* One wait's final text: one compact line per observed member, then one failure line per member
|
|
789
|
-
* the wait could not read. A wait opens no frame and extracts no separate answer, so an answer is
|
|
790
|
-
* visible only as the snapshot's own bounded summary.
|
|
791
|
-
*/
|
|
688
|
+
/** Compact final facts, actual recent events, and an exact-turn full outcome; never a live frame. */
|
|
792
689
|
export function waitText(result, presentation, context) {
|
|
793
690
|
const alias = result.results.length === 1 ? presentation.alias : undefined;
|
|
794
691
|
return result.results
|
|
@@ -798,7 +695,29 @@ export function waitText(result, presentation, context) {
|
|
|
798
695
|
if (member.kind === "unobserved")
|
|
799
696
|
return waitLine("!", identity(member.id, alias), `observation failed${FACT_SEPARATOR}${member.diagnostic}`, context.columns);
|
|
800
697
|
const { mark, summary } = waitSummary(member);
|
|
801
|
-
|
|
698
|
+
const outcome = member.outcome;
|
|
699
|
+
const payload = outcome?.kind === "answered" ? outcome.answer : outcome?.kind === "failed" ? outcome.diagnostic : undefined;
|
|
700
|
+
return [
|
|
701
|
+
waitLine(mark, identity(member.id, alias), summary, context.columns),
|
|
702
|
+
...(member.lastActivityAt === undefined ? [] : [` activity ${safeText(member.lastActivityAt)}`]),
|
|
703
|
+
...groupedRows(member.events ?? [], context),
|
|
704
|
+
...(member.eventsUnavailable === undefined
|
|
705
|
+
? []
|
|
706
|
+
: diagnosticLines("recent activity", member.eventsUnavailable, context.columns, { state: "unavailable" })),
|
|
707
|
+
...(outcome === undefined ? [] : [` ${outcome.historyId} · ${outcome.kind}`]),
|
|
708
|
+
...(payload === undefined
|
|
709
|
+
? []
|
|
710
|
+
: renderBoundedPayload({
|
|
711
|
+
text: payload,
|
|
712
|
+
first: " ",
|
|
713
|
+
continuation: " ",
|
|
714
|
+
columns: context.columns,
|
|
715
|
+
maxLines: Number.MAX_SAFE_INTEGER,
|
|
716
|
+
quote: "",
|
|
717
|
+
preserveLines: true,
|
|
718
|
+
truncated: false,
|
|
719
|
+
})),
|
|
720
|
+
].join("\n");
|
|
802
721
|
})
|
|
803
722
|
.join("\n");
|
|
804
723
|
}
|
|
@@ -806,8 +725,8 @@ export function historyText(result, presentation, context) {
|
|
|
806
725
|
if (presentation.id !== undefined) {
|
|
807
726
|
return historyRawAnswer(result, presentation.id) ?? `${presentation.id} has no matching retained history`;
|
|
808
727
|
}
|
|
809
|
-
if (presentation.
|
|
810
|
-
return result.kind === "akuma-
|
|
728
|
+
if (presentation.answer === true)
|
|
729
|
+
return result.kind === "akuma-answer" ? result.answer : "no answer retained";
|
|
811
730
|
if (result.kind !== "akuma")
|
|
812
731
|
throw new Error("history result lacks page");
|
|
813
732
|
const rows = groupedRows(result.events, context, { history: true });
|
|
@@ -1,19 +1,18 @@
|
|
|
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,
|
|
5
|
-
import type { ForkResult, SpawnResult
|
|
6
|
-
import { type ObservedCallHead } from "./akuma-activity.js";
|
|
4
|
+
import type { AkumaAskResult, AkumaKillResult } from "../../akuma/selection-observation.js";
|
|
5
|
+
import type { ForkResult, SpawnResult } from "../../library/akuma-creation.js";
|
|
7
6
|
import { type TextRenderContext } from "./terminal.js";
|
|
8
7
|
type AskProgress = Readonly<{
|
|
9
8
|
admitted: (tell: TellResult, id: AkumaId) => readonly string[];
|
|
10
9
|
observe: (observation: LiveStatusObservation) => readonly string[];
|
|
11
10
|
frame: () => readonly string[];
|
|
12
11
|
flush: () => readonly string[];
|
|
13
|
-
conclude: (result: AkumaAskResult
|
|
12
|
+
conclude: (result: AkumaAskResult) => readonly string[];
|
|
14
13
|
}>;
|
|
15
14
|
export declare function askProgressStream(akuma: AkumaId | undefined, alias: string | undefined, context: TextRenderContext, now?: () => number | undefined): AskProgress;
|
|
16
|
-
export declare function waitedTellProgress(result: AkumaAskResult
|
|
15
|
+
export declare function waitedTellProgress(result: AkumaAskResult, input: Readonly<{
|
|
17
16
|
prompt: string;
|
|
18
17
|
alias?: string;
|
|
19
18
|
}>, context: TextRenderContext): string;
|
|
@@ -23,13 +22,8 @@ type SpawnPresentation = Readonly<{
|
|
|
23
22
|
alias?: string;
|
|
24
23
|
contractId?: string;
|
|
25
24
|
}>;
|
|
26
|
-
|
|
27
|
-
export declare function callObservationHead(input: SpawnResult | (SpawnWaitHead & Readonly<{
|
|
28
|
-
akumaId: string;
|
|
29
|
-
}>), presentation?: SpawnPresentation): ObservedCallHead;
|
|
30
|
-
export declare function renderCallText(result: SpawnResult, streamed: boolean, context: TextRenderContext, input?: SpawnPresentation): string;
|
|
25
|
+
export declare function renderCallText(result: SpawnResult, context: TextRenderContext, input?: SpawnPresentation): string;
|
|
31
26
|
export declare function renderSpawnFailure(result: SpawnResult, diagnostic: string, context: TextRenderContext, input?: SpawnPresentation): string;
|
|
32
|
-
export declare function renderFailedCallObservation(result: SpawnResult, context: TextRenderContext, input?: SpawnPresentation): string;
|
|
33
27
|
export declare function renderForkText(receipt: ForkResult, input: Readonly<{
|
|
34
28
|
akuma: string;
|
|
35
29
|
at: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { actionReceipt,
|
|
1
|
+
import { actionReceipt, inputWaitStream, killResultText, subordinateLines, tellAdmissionRow, callFailureLines, askRawAnswer, observationCompletedAt, tellControlLines, tellPayloadLines, } from "./akuma-activity.js";
|
|
2
2
|
import { safeText } from "./terminal.js";
|
|
3
3
|
export function askProgressStream(akuma, alias, context, now) {
|
|
4
4
|
let target = akuma;
|
|
5
5
|
const stream = inputWaitStream(context, () => {
|
|
6
6
|
if (target === undefined)
|
|
7
|
-
throw new Error("
|
|
7
|
+
throw new Error("Ask progress used before admission");
|
|
8
8
|
return { id: target, ...(alias === undefined ? {} : { alias }), contract: { kind: "none" }, facts: [] };
|
|
9
9
|
}, { cursor: "admission", answerSeparator: true, ...(now === undefined ? {} : { now }) });
|
|
10
10
|
return {
|
|
@@ -21,8 +21,14 @@ export function askProgressStream(akuma, alias, context, now) {
|
|
|
21
21
|
flush: () => stream.flush(),
|
|
22
22
|
conclude: (result) => {
|
|
23
23
|
const controls = tellControlLines(result, context);
|
|
24
|
+
const observation = result;
|
|
25
|
+
const completedAt = observationCompletedAt(observation);
|
|
24
26
|
return [
|
|
25
|
-
stream.conclude({
|
|
27
|
+
stream.conclude({
|
|
28
|
+
kind: "observed",
|
|
29
|
+
observation,
|
|
30
|
+
...(completedAt === undefined ? {} : { completedAt }),
|
|
31
|
+
}),
|
|
26
32
|
...subordinateLines([
|
|
27
33
|
...(controls.length === 0 && askRawAnswer(result) !== undefined ? [] : [`input ${result.tellId}`]),
|
|
28
34
|
...controls,
|
|
@@ -39,31 +45,27 @@ export function waitedTellProgress(result, input, context) {
|
|
|
39
45
|
facts: [],
|
|
40
46
|
}), { cursor: "admission", answerSeparator: true, now: () => context.now });
|
|
41
47
|
const admitted = stream.admitted({ rows: [tellAdmissionRow(input.prompt, context, result.wake)] });
|
|
48
|
+
const observation = result;
|
|
49
|
+
const completedAt = observationCompletedAt(observation);
|
|
42
50
|
return [
|
|
43
51
|
...admitted,
|
|
44
52
|
stream.conclude({
|
|
45
53
|
kind: "observed",
|
|
46
|
-
observation
|
|
54
|
+
observation,
|
|
55
|
+
...(completedAt === undefined ? {} : { completedAt }),
|
|
47
56
|
}),
|
|
48
57
|
...subordinateLines([`input ${result.tellId}`, ...tellControlLines(result, context)]),
|
|
49
58
|
...(askRawAnswer(result) === undefined ? [] : [askRawAnswer(result)]),
|
|
50
59
|
...(result.kind === "invalid-output" ? ["invalid answer", result.answer] : []),
|
|
51
60
|
].join("\n");
|
|
52
61
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const failures = "failures" in input ? (input.failures ?? []) : [];
|
|
62
|
+
function spawnHead(input, presentation = {}) {
|
|
63
|
+
const failures = input.kind === "failed" ? input.failures : [];
|
|
56
64
|
const alias = failures.some((failure) => failure.stage === "dispatch" || failure.stage === "alias")
|
|
57
65
|
? undefined
|
|
58
|
-
:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const contractId = failures.some((failure) => failure.stage === "dispatch")
|
|
62
|
-
? undefined
|
|
63
|
-
: "contractId" in input
|
|
64
|
-
? input.contractId
|
|
65
|
-
: presentation.contractId;
|
|
66
|
-
const cwd = "cwd" in input ? input.cwd : presentation.cwd;
|
|
66
|
+
: presentation.alias;
|
|
67
|
+
const contractId = failures.some((failure) => failure.stage === "dispatch") ? undefined : presentation.contractId;
|
|
68
|
+
const cwd = presentation.cwd;
|
|
67
69
|
const facts = [
|
|
68
70
|
...(input.dispatchWarning === undefined ? [] : [`dispatch lag ${safeText(input.dispatchWarning)}`]),
|
|
69
71
|
...(input.alias === undefined ? [] : [`alias moved · previous ${input.alias.previousAkumaId}`]),
|
|
@@ -77,7 +79,7 @@ export function callObservationHead(input, presentation = {}) {
|
|
|
77
79
|
};
|
|
78
80
|
}
|
|
79
81
|
function spawnEvidence(result, context, input) {
|
|
80
|
-
const head =
|
|
82
|
+
const head = spawnHead(result, input);
|
|
81
83
|
return [
|
|
82
84
|
...(head.contract.kind === "associated" ? [safeText(head.contract.contractId)] : []),
|
|
83
85
|
...(head.cwd === undefined ? [] : [safeText(head.cwd)]),
|
|
@@ -90,14 +92,8 @@ function spawnEvidence(result, context, input) {
|
|
|
90
92
|
...(result.kind === "failed" ? callFailureLines(result.failures, context) : []),
|
|
91
93
|
];
|
|
92
94
|
}
|
|
93
|
-
export function renderCallText(result,
|
|
94
|
-
|
|
95
|
-
return "";
|
|
96
|
-
const head = callObservationHead(result, input);
|
|
97
|
-
if (result.input !== undefined) {
|
|
98
|
-
const stream = callObservationStream(context, head, { now: () => context.now });
|
|
99
|
-
return [stream.conclude(result), ...(result.input.kind === "answered" ? [result.input.answer] : [])].join("\n");
|
|
100
|
-
}
|
|
95
|
+
export function renderCallText(result, context, input = {}) {
|
|
96
|
+
const head = spawnHead(result, input);
|
|
101
97
|
return actionReceipt({
|
|
102
98
|
mark: result.kind === "failed" ? "!" : "✓",
|
|
103
99
|
verb: "spawned",
|
|
@@ -107,7 +103,7 @@ export function renderCallText(result, streamed, context, input = {}) {
|
|
|
107
103
|
}).join("\n");
|
|
108
104
|
}
|
|
109
105
|
export function renderSpawnFailure(result, diagnostic, context, input = {}) {
|
|
110
|
-
const head =
|
|
106
|
+
const head = spawnHead(result, input);
|
|
111
107
|
return actionReceipt({
|
|
112
108
|
mark: "!",
|
|
113
109
|
verb: "spawn failed",
|
|
@@ -116,10 +112,6 @@ export function renderSpawnFailure(result, diagnostic, context, input = {}) {
|
|
|
116
112
|
evidence: [...spawnEvidence(result, context, input), `reason ${safeText(diagnostic)}`],
|
|
117
113
|
}).join("\n");
|
|
118
114
|
}
|
|
119
|
-
export function renderFailedCallObservation(result, context, input = {}) {
|
|
120
|
-
const failure = callObservationStream(context, callObservationHead(result, input), input);
|
|
121
|
-
return failure.conclude(result);
|
|
122
|
-
}
|
|
123
115
|
export function renderForkText(receipt, input) {
|
|
124
116
|
const parent = receipt.parentAkumaId ?? input.akuma;
|
|
125
117
|
if (receipt.kind !== "forked" && receipt.kind !== "failed") {
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { contractAttentionFacts, progressStrip } from "./contract-observation.js";
|
|
1
|
+
import { contractAttentionFacts, lifecycleWord, progressStrip } from "./contract-observation.js";
|
|
2
2
|
import { ageText, emptyCatalogue, safeText } from "./terminal.js";
|
|
3
3
|
import { contractMark } from "./marks.js";
|
|
4
|
-
function formatAge(source, observedAt) {
|
|
5
|
-
return ageText(source, observedAt, "future");
|
|
6
|
-
}
|
|
7
4
|
/** One summary row names identity, age, title, and a terminal outcome or the current candidate strip. */
|
|
8
5
|
function contractCatalogueBlock(row, observedAt) {
|
|
9
|
-
const head = `${contractMark(row)} ${safeText(row.id)} · ${
|
|
10
|
-
|
|
6
|
+
const head = `${contractMark(row)} ${safeText(row.id)} · ${ageText(row.phaseAt, observedAt, "future")} · ${safeText(row.title ?? "title unavailable")}`;
|
|
7
|
+
const state = row.phase === "bound" ? progressStrip(row) : lifecycleWord(row.phase);
|
|
8
|
+
return [head, ` ${state}`, ...contractAttentionFacts(row).map((fact) => ` ${safeText(fact)}`)].join("\n");
|
|
11
9
|
}
|
|
12
10
|
export function renderContractCatalogue(list) {
|
|
13
11
|
const rows = list.rows ?? [];
|