@astrosheep/keiyaku 4.0.1 → 4.0.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/README.md +137 -5
- package/build/integrations/marketplace/plugins/keiyaku/.claude-plugin/plugin.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/.codex-plugin/plugin.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/package.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +3 -3
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +91 -35
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +98 -58
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +152 -53
- package/build/src/akuma/abort.d.ts +2 -0
- package/build/src/akuma/abort.js +50 -0
- package/build/src/akuma/akuma.d.ts +23 -14
- package/build/src/akuma/akuma.js +120 -104
- package/build/src/akuma/archetype.d.ts +7 -6
- package/build/src/akuma/archetype.js +68 -41
- package/build/src/akuma/body.d.ts +3 -5
- package/build/src/akuma/body.js +408 -213
- package/build/src/akuma/heart/facts.d.ts +25 -34
- package/build/src/akuma/heart/facts.js +18 -7
- package/build/src/akuma/heart/index.d.ts +39 -42
- package/build/src/akuma/heart/index.js +134 -93
- package/build/src/akuma/heart/rows.d.ts +9 -31
- package/build/src/akuma/heart/rows.js +26 -44
- package/build/src/akuma/heart/schema.d.ts +1 -1
- package/build/src/akuma/heart/schema.js +7 -15
- package/build/src/akuma/heart/soul.d.ts +8 -0
- package/build/src/akuma/heart/soul.js +136 -0
- package/build/src/akuma/heart/storage.d.ts +28 -14
- package/build/src/akuma/heart/storage.js +86 -26
- package/build/src/akuma/identity.d.ts +2 -2
- package/build/src/akuma/identity.js +9 -9
- package/build/src/akuma/index.d.ts +6 -1
- package/build/src/akuma/index.js +6 -0
- package/build/src/akuma/projection.d.ts +117 -38
- package/build/src/akuma/projection.js +208 -97
- package/build/src/akuma/provider-recipe.d.ts +24 -0
- package/build/src/akuma/provider-recipe.js +100 -0
- package/build/src/akuma/provider.d.ts +12 -4
- package/build/src/akuma/provider.js +117 -70
- package/build/src/akuma/providers/acp/core.d.ts +19 -0
- package/build/src/akuma/providers/acp/core.js +159 -0
- package/build/src/akuma/providers/acp/events.d.ts +20 -0
- package/build/src/akuma/providers/acp/events.js +73 -0
- package/build/src/akuma/providers/acp/index.d.ts +12 -0
- package/build/src/akuma/providers/acp/index.js +94 -0
- package/build/src/akuma/providers/claude/events.js +66 -13
- package/build/src/akuma/providers/claude/index.d.ts +2 -1
- package/build/src/akuma/providers/claude/index.js +35 -21
- package/build/src/akuma/providers/codex-app-server/events.js +4 -1
- package/build/src/akuma/providers/codex-app-server/index.d.ts +3 -3
- package/build/src/akuma/providers/codex-app-server/index.js +24 -31
- package/build/src/akuma/providers/grok-build/index.d.ts +4 -0
- package/build/src/akuma/providers/grok-build/index.js +70 -0
- package/build/src/akuma/providers/index.d.ts +5 -3
- package/build/src/akuma/providers/index.js +24 -59
- package/build/src/akuma/providers/opencode-sdk/events.d.ts +40 -34
- package/build/src/akuma/providers/opencode-sdk/events.js +220 -101
- package/build/src/akuma/providers/opencode-sdk/index.d.ts +3 -2
- package/build/src/akuma/providers/opencode-sdk/index.js +233 -128
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +11 -26
- package/build/src/akuma/providers/opencode-sdk/session.js +10 -9
- package/build/src/akuma/providers/pi/events.js +49 -11
- package/build/src/akuma/providers/pi/index.d.ts +1 -1
- package/build/src/akuma/providers/pi/index.js +50 -21
- package/build/src/akuma/publication.d.ts +3 -3
- package/build/src/akuma/publication.js +28 -40
- package/build/src/akuma/requests.d.ts +9 -7
- package/build/src/akuma/requests.js +92 -65
- package/build/src/alias/index.d.ts +2 -2
- package/build/src/alias/index.js +10 -10
- package/build/src/body/decode.js +7 -1
- package/build/src/body/region.d.ts +2 -0
- package/build/src/body/region.js +77 -7
- package/build/src/cli/accepted.d.ts +17 -13
- package/build/src/cli/accepted.js +72 -34
- package/build/src/cli/actor.js +3 -3
- package/build/src/cli/commands/akuma-invoke.d.ts +4 -3
- package/build/src/cli/commands/akuma-invoke.js +14 -9
- package/build/src/cli/commands/akuma.d.ts +13 -3
- package/build/src/cli/commands/akuma.js +67 -34
- package/build/src/cli/commands/contract.d.ts +18 -5
- package/build/src/cli/commands/contract.js +9 -3
- package/build/src/cli/commands/task-invoke.d.ts +17 -4
- package/build/src/cli/commands/task-invoke.js +43 -20
- package/build/src/cli/commands/task-query.d.ts +5 -0
- package/build/src/cli/commands/task-query.js +247 -0
- package/build/src/cli/commands/task.d.ts +3 -1
- package/build/src/cli/commands/task.js +51 -13
- package/build/src/cli/coordinates.d.ts +18 -0
- package/build/src/cli/coordinates.js +120 -0
- package/build/src/cli/draft.d.ts +8 -0
- package/build/src/cli/draft.js +96 -0
- package/build/src/cli/invoke.d.ts +4 -3
- package/build/src/cli/invoke.js +160 -179
- package/build/src/cli/main.js +34 -6
- package/build/src/cli/parse.d.ts +9 -2
- package/build/src/cli/parse.js +29 -7
- package/build/src/cli/render/akuma-tool-command.d.ts +6 -0
- package/build/src/cli/render/akuma-tool-command.js +144 -0
- package/build/src/cli/render/akuma-tool.d.ts +2 -2
- package/build/src/cli/render/akuma-tool.js +30 -4
- package/build/src/cli/render/akuma.d.ts +1 -0
- package/build/src/cli/render/akuma.js +211 -116
- package/build/src/cli/render/audit.d.ts +3 -0
- package/build/src/cli/render/audit.js +104 -0
- package/build/src/cli/render/contract.d.ts +3 -3
- package/build/src/cli/render/contract.js +192 -79
- package/build/src/cli/render/kanshi.js +263 -168
- package/build/src/cli/render/receipt.d.ts +19 -0
- package/build/src/cli/render/receipt.js +106 -0
- package/build/src/cli/render/refusal.d.ts +16 -2
- package/build/src/cli/render/refusal.js +88 -20
- package/build/src/cli/render/region.d.ts +2 -0
- package/build/src/cli/render/region.js +17 -0
- package/build/src/cli/render/task.d.ts +2 -1
- package/build/src/cli/render/task.js +223 -60
- package/build/src/cli/render/terminal.d.ts +7 -0
- package/build/src/cli/render/terminal.js +46 -0
- package/build/src/cli/render/text.js +6 -3
- package/build/src/cli/result.d.ts +115 -20
- package/build/src/cli/usage.d.ts +1 -0
- package/build/src/cli/usage.js +3 -0
- package/build/src/contract-worktree.d.ts +6 -5
- package/build/src/contract-worktree.js +95 -57
- package/build/src/coordination/durable-file.d.ts +4 -3
- package/build/src/coordination/durable-file.js +29 -25
- package/build/src/coordination/sqlite-transaction-lock.d.ts +4 -0
- package/build/src/coordination/sqlite-transaction-lock.js +22 -5
- package/build/src/core/facts/fold.js +1 -6
- package/build/src/core/facts/gate.d.ts +1 -0
- package/build/src/core/facts/gate.js +1 -0
- package/build/src/core/verbs/amend.d.ts +1 -1
- package/build/src/core/verbs/amend.js +0 -11
- package/build/src/core/verbs/deliver.d.ts +1 -1
- package/build/src/core/verbs/deliver.js +1 -7
- package/build/src/core/verbs/placement.d.ts +1 -1
- package/build/src/core/verbs/placement.js +4 -1
- package/build/src/dispatch/index.d.ts +2 -2
- package/build/src/dispatch/index.js +17 -17
- package/build/src/git/admission.d.ts +1 -1
- package/build/src/git/admission.js +11 -11
- package/build/src/git/hooks.js +13 -13
- package/build/src/git/integration.d.ts +14 -15
- package/build/src/git/integration.js +80 -44
- package/build/src/git/observe.d.ts +5 -3
- package/build/src/git/observe.js +18 -12
- package/build/src/git/read-observation.js +9 -9
- package/build/src/git/reconcile.d.ts +2 -0
- package/build/src/git/reconcile.js +138 -95
- package/build/src/git/repository.d.ts +27 -19
- package/build/src/git/repository.js +155 -83
- package/build/src/git/scratch.d.ts +7 -3
- package/build/src/git/scratch.js +44 -37
- package/build/src/git/target-placement.d.ts +40 -4
- package/build/src/git/target-placement.js +221 -101
- package/build/src/git/tender.d.ts +6 -5
- package/build/src/git/tender.js +24 -43
- package/build/src/git/terminal-seal.d.ts +1 -1
- package/build/src/git/terminal-seal.js +7 -5
- package/build/src/git/workspace.d.ts +36 -4
- package/build/src/git/workspace.js +53 -18
- package/build/src/identity/selector.js +1 -1
- package/build/src/index.d.ts +3 -3
- package/build/src/index.js +1 -1
- package/build/src/kanshi/index.d.ts +2 -2
- package/build/src/kanshi/index.js +1 -1
- package/build/src/kanshi/read.d.ts +2 -1
- package/build/src/kanshi/read.js +118 -27
- package/build/src/kanshi/report.d.ts +50 -0
- package/build/src/kanshi/select.d.ts +5 -0
- package/build/src/kanshi/select.js +32 -0
- package/build/src/library/address.d.ts +12 -3
- package/build/src/library/address.js +77 -46
- package/build/src/library/akuma-creation.d.ts +6 -1
- package/build/src/library/akuma-creation.js +86 -13
- package/build/src/library/audit.d.ts +18 -0
- package/build/src/library/audit.js +44 -0
- package/build/src/library/bind.js +4 -4
- package/build/src/library/catalog.d.ts +1 -1
- package/build/src/library/catalog.js +5 -8
- package/build/src/library/contract.d.ts +5 -6
- package/build/src/library/contract.js +11 -35
- package/build/src/library/delivery.d.ts +2 -1
- package/build/src/library/fleet.d.ts +2 -2
- package/build/src/library/fleet.js +35 -71
- package/build/src/library/keiyaku.d.ts +3 -2
- package/build/src/library/keiyaku.js +1 -0
- package/build/src/library/mutation.d.ts +7 -6
- package/build/src/library/mutation.js +23 -25
- package/build/src/library/reconcile.d.ts +29 -0
- package/build/src/library/reconcile.js +179 -0
- package/build/src/library/region.d.ts +12 -0
- package/build/src/library/region.js +15 -1
- package/build/src/library/repo.d.ts +4 -16
- package/build/src/library/repo.js +13 -38
- package/build/src/protocol/attempt.js +6 -6
- package/build/src/protocol/bind.js +4 -4
- package/build/src/protocol/intent.d.ts +15 -2
- package/build/src/protocol/intent.js +21 -6
- package/build/src/protocol/operations.d.ts +73 -22
- package/build/src/protocol/operations.js +292 -88
- package/build/src/protocol/outcome.d.ts +9 -3
- package/build/src/protocol/outcome.js +3 -1
- package/build/src/protocol/placement.d.ts +15 -4
- package/build/src/protocol/placement.js +58 -25
- package/build/src/protocol/read/status.d.ts +8 -1
- package/build/src/protocol/read/status.js +61 -14
- package/build/src/runtime/proc/line-rpc.d.ts +3 -8
- package/build/src/runtime/proc/line-rpc.js +16 -43
- package/build/src/runtime/proc/run.d.ts +15 -29
- package/build/src/runtime/proc/run.js +113 -105
- package/build/src/runtime/proc/stdio.d.ts +18 -0
- package/build/src/runtime/proc/stdio.js +58 -0
- package/build/src/settings.d.ts +2 -2
- package/build/src/settings.js +8 -8
- package/build/src/settlement/fence.d.ts +0 -4
- package/build/src/settlement/fence.js +0 -9
- package/build/src/settlement/holder.d.ts +11 -1
- package/build/src/settlement/holder.js +25 -0
- package/build/src/settlement/settle.d.ts +1 -1
- package/build/src/settlement/settle.js +52 -89
- package/build/src/task/board.d.ts +3 -3
- package/build/src/task/board.js +6 -9
- package/build/src/task/compose.d.ts +1 -1
- package/build/src/task/compose.js +18 -10
- package/build/src/task/context.d.ts +3 -3
- package/build/src/task/context.js +14 -14
- package/build/src/task/document.d.ts +2 -1
- package/build/src/task/document.js +15 -5
- package/build/src/task/index.d.ts +19 -7
- package/build/src/task/index.js +42 -23
- package/build/src/task/operations.d.ts +15 -9
- package/build/src/task/operations.js +78 -48
- package/build/src/task/query.d.ts +67 -0
- package/build/src/task/query.js +279 -0
- package/build/src/task/store.d.ts +2 -2
- package/build/src/task/store.js +40 -25
- package/build/src/verification/execution.d.ts +4 -2
- package/build/src/verification/execution.js +9 -5
- package/build/src/workspace-place.d.ts +41 -0
- package/build/src/workspace-place.js +386 -0
- package/build/src/world.d.ts +13 -2
- package/build/src/world.js +81 -48
- package/package.json +3 -2
- package/build/src/protocol/read/audit.d.ts +0 -31
- package/build/src/protocol/read/audit.js +0 -55
|
@@ -1,102 +1,215 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { renderAcceptedAudit } from "./audit.js";
|
|
2
|
+
import { appendHookPayload, cleanupLines, hookFailureSummary, leakLines, outcomeLines, receiptPayload, receiptRow, reuseLines, stopLines, } from "./receipt.js";
|
|
3
|
+
import { gitShortStat, renderOpaqueBlock } from "./terminal.js";
|
|
4
|
+
const HANG = " ";
|
|
5
|
+
function isRecord(value) {
|
|
6
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7
|
+
}
|
|
8
|
+
function retryLines(detail, indent, columns) {
|
|
9
|
+
if (detail.kind === "publication-failed") {
|
|
10
|
+
return [...renderOpaqueBlock("publication-failed", indent, columns), ...["diagnostic", "", detail.diagnostic, ""]];
|
|
8
11
|
}
|
|
9
|
-
return
|
|
12
|
+
return renderOpaqueBlock(detail.kind, indent, columns);
|
|
13
|
+
}
|
|
14
|
+
function changedEffect(effect) {
|
|
15
|
+
return effect.action !== "unchanged";
|
|
10
16
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
const paths = lag.paths.length === 0 ? "" : ` paths=${lag.paths.join(",")}`;
|
|
17
|
-
return `lag unsealed-bytes ${lag.path}${head}${paths}`;
|
|
17
|
+
function effectRows(effect, columns) {
|
|
18
|
+
const mark = changedEffect(effect) ? "✓" : "·";
|
|
19
|
+
const lines = [];
|
|
20
|
+
if (effect.kind === "worktree") {
|
|
21
|
+
receiptRow(lines, mark, "worktree", [{ text: effect.action }, { text: effect.path, opaque: true }], columns);
|
|
18
22
|
}
|
|
19
|
-
if (
|
|
20
|
-
|
|
23
|
+
else if (effect.kind === "contract-file") {
|
|
24
|
+
receiptRow(lines, mark, "contract-file", [{ text: effect.action }, { text: effect.path, opaque: true }], columns);
|
|
21
25
|
}
|
|
22
|
-
if (
|
|
23
|
-
|
|
26
|
+
else if (effect.kind === "target-checkout") {
|
|
27
|
+
receiptRow(lines, mark, "target-checkout", [
|
|
28
|
+
{ text: effect.action },
|
|
29
|
+
{ text: effect.target, opaque: true },
|
|
30
|
+
{ text: effect.path, opaque: true },
|
|
31
|
+
], columns);
|
|
24
32
|
}
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
else {
|
|
34
|
+
receiptRow(lines, mark, "ref", [
|
|
35
|
+
{ text: effect.action },
|
|
36
|
+
{ text: effect.name, opaque: true },
|
|
37
|
+
{ text: `${effect.before ?? "null"} -> ${effect.after ?? "null"}`, opaque: true },
|
|
38
|
+
], columns);
|
|
27
39
|
}
|
|
28
|
-
return
|
|
40
|
+
return lines;
|
|
29
41
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
42
|
+
function lagRows(lag, columns) {
|
|
43
|
+
const lines = [];
|
|
44
|
+
if (lag.kind === "worktree-retained") {
|
|
45
|
+
receiptRow(lines, "!", "lag", [{ text: `worktree-retained ${lag.path}`, opaque: true }], columns);
|
|
46
|
+
}
|
|
47
|
+
else if (lag.kind === "unsealed-bytes") {
|
|
48
|
+
receiptRow(lines, "!", "lag", [{ text: `unsealed-bytes ${lag.path}${lag.head === undefined ? "" : ` head=${lag.head}`}${lag.paths.length === 0 ? "" : ` paths=${lag.paths.join(",")}`}`, opaque: true }], columns);
|
|
49
|
+
}
|
|
50
|
+
else if (lag.kind === "target-checkout-retained") {
|
|
51
|
+
receiptRow(lines, "!", "lag", [{ text: `target-checkout-retained ${lag.target} ${lag.path}`, opaque: true }], columns);
|
|
52
|
+
receiptPayload(lines, "diagnostic", lag.diagnostic);
|
|
53
|
+
}
|
|
54
|
+
else if (lag.kind === "worktree-hook-failed") {
|
|
55
|
+
receiptRow(lines, "!", "lag", [{ text: `worktree-hook-failed ${lag.phase} ${lag.path} command=${lag.command} ${hookFailureSummary(lag.failure)}`, opaque: true }], columns);
|
|
56
|
+
appendHookPayload(lines, lag.failure);
|
|
57
|
+
}
|
|
58
|
+
else if (lag.kind === "contract-file-failed") {
|
|
59
|
+
receiptRow(lines, "!", "lag", [{ text: `contract-file-failed ${lag.worktree} ${lag.path}`, opaque: true }], columns);
|
|
60
|
+
receiptPayload(lines, "diagnostic", lag.diagnostic);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
receiptRow(lines, "!", "lag", [{ text: `reconcile-failed ${lag.stage}`, opaque: true }], columns);
|
|
64
|
+
receiptPayload(lines, "diagnostic", lag.diagnostic);
|
|
65
|
+
}
|
|
66
|
+
return lines;
|
|
34
67
|
}
|
|
35
|
-
function
|
|
36
|
-
|
|
68
|
+
function settlementLagRows(lag, columns) {
|
|
69
|
+
const lines = [];
|
|
70
|
+
receiptRow(lines, "!", "settlement", [{ text: [
|
|
71
|
+
`surface=${lag.surface}`,
|
|
72
|
+
lag.taskId === undefined ? undefined : `task=${lag.taskId}`,
|
|
73
|
+
lag.path === undefined ? undefined : `path=${lag.path}`,
|
|
74
|
+
].filter((part) => part !== undefined).join(" "), opaque: true }], columns);
|
|
75
|
+
receiptPayload(lines, "diagnostic", lag.diagnostic);
|
|
76
|
+
return lines;
|
|
37
77
|
}
|
|
38
|
-
|
|
78
|
+
function workspaceRows(workspace, columns) {
|
|
39
79
|
const lines = [];
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
if (value.cleanup !== undefined)
|
|
47
|
-
lines.push(`cleanup ${value.cleanup.phase} command=${value.cleanup.command} ${JSON.stringify(value.cleanup.detail)}`);
|
|
48
|
-
const leak = leakLine(value.leak);
|
|
49
|
-
if (leak !== undefined)
|
|
50
|
-
lines.push(leak);
|
|
80
|
+
receiptRow(lines, "~", "workspace", [{ text: gitShortStat(workspace.shortStat) }], columns);
|
|
81
|
+
for (const name of ["staged", "unstaged", "untracked"]) {
|
|
82
|
+
for (const path of workspace[name]) {
|
|
83
|
+
receiptRow(lines, " ", name, [{ text: path, opaque: true }], columns);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
51
86
|
return lines;
|
|
52
87
|
}
|
|
53
|
-
function
|
|
88
|
+
function overlapRows(overlaps, columns) {
|
|
54
89
|
const lines = [];
|
|
55
|
-
|
|
56
|
-
lines.push(`target ${result.target ?? "null"}`);
|
|
57
|
-
const reportLeak = leakLine(result.report?.leak);
|
|
58
|
-
if (reportLeak !== undefined)
|
|
59
|
-
lines.push(reportLeak);
|
|
60
|
-
if (result.report?.cleanup !== undefined) {
|
|
61
|
-
const cleanup = result.report.cleanup;
|
|
62
|
-
lines.push(`cleanup ${cleanup.phase} command=${cleanup.command} ${JSON.stringify(cleanup.detail)}`);
|
|
63
|
-
}
|
|
64
|
-
for (const overlap of result.overlaps ?? []) {
|
|
90
|
+
for (const overlap of overlaps) {
|
|
65
91
|
for (const pattern of overlap.patterns) {
|
|
66
|
-
lines
|
|
92
|
+
receiptRow(lines, "~", "overlap", [
|
|
93
|
+
{ text: overlap.contract, opaque: true },
|
|
94
|
+
{ text: `${pattern.mine} ~ ${pattern.theirs}`, opaque: true },
|
|
95
|
+
], columns);
|
|
67
96
|
}
|
|
68
97
|
}
|
|
69
|
-
if (result.overlapFailure !== undefined)
|
|
70
|
-
lines.push(`overlap unavailable ${result.overlapFailure}`);
|
|
71
|
-
if (result.report !== undefined)
|
|
72
|
-
lines.push(`report ${JSON.stringify(result.report)}`);
|
|
73
|
-
const workspace = workspaceLine(result.workspace);
|
|
74
|
-
if (workspace !== undefined)
|
|
75
|
-
lines.push(workspace);
|
|
76
|
-
if (result.diff !== undefined)
|
|
77
|
-
lines.push(typeof result.diff === "string" ? result.diff : JSON.stringify(result.diff));
|
|
78
98
|
return lines;
|
|
79
99
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
for (const
|
|
89
|
-
|
|
100
|
+
function pushBlock(lines, block) {
|
|
101
|
+
if (block.length === 0)
|
|
102
|
+
return;
|
|
103
|
+
lines.push(...block);
|
|
104
|
+
}
|
|
105
|
+
function acceptedRecord(result, columns) {
|
|
106
|
+
const record = [];
|
|
107
|
+
receiptRow(record, " ", "head", [{ text: result.head, opaque: true }], columns);
|
|
108
|
+
for (const fact of result.facts) {
|
|
109
|
+
const contract = fact.contract === result.contract ? [] : [{ text: fact.contract, opaque: true }];
|
|
110
|
+
receiptRow(record, " ", "journal", [
|
|
111
|
+
...contract,
|
|
112
|
+
{ text: fact.entry, opaque: true },
|
|
113
|
+
{ text: `· ${fact.kind}` },
|
|
114
|
+
], columns);
|
|
115
|
+
}
|
|
116
|
+
if (result.verb === "bind") {
|
|
117
|
+
receiptRow(record, " ", "target", [{ text: result.target ?? "null", opaque: true }], columns);
|
|
118
|
+
}
|
|
119
|
+
if (result.verb === "deliver") {
|
|
120
|
+
pushBlock(record, reuseLines(result.verificationReuse, columns));
|
|
121
|
+
}
|
|
122
|
+
if (result.verb === "amend") {
|
|
123
|
+
receiptPayload(record, "diff", result.diff);
|
|
124
|
+
}
|
|
125
|
+
const changed = result.effects.filter(changedEffect);
|
|
126
|
+
const unchanged = result.effects.filter((effect) => !changedEffect(effect));
|
|
127
|
+
for (const effect of [...changed, ...unchanged])
|
|
128
|
+
pushBlock(record, effectRows(effect, columns));
|
|
90
129
|
for (const action of result.settlement.actions) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
:
|
|
130
|
+
receiptRow(record, "·", "settle", [
|
|
131
|
+
{ text: action.kind },
|
|
132
|
+
{ text: action.action },
|
|
133
|
+
{ text: action.kind === "task" ? action.taskId : action.path, opaque: true },
|
|
134
|
+
], columns);
|
|
135
|
+
}
|
|
136
|
+
return record;
|
|
137
|
+
}
|
|
138
|
+
function acceptedLagRows(result, columns) {
|
|
139
|
+
const obligations = [];
|
|
140
|
+
if (result.lag !== undefined) {
|
|
141
|
+
for (const lag of result.lag)
|
|
142
|
+
pushBlock(obligations, lagRows(lag, columns));
|
|
143
|
+
}
|
|
144
|
+
for (const lag of result.settlement.lags) {
|
|
145
|
+
pushBlock(obligations, settlementLagRows(lag, columns));
|
|
146
|
+
}
|
|
147
|
+
return obligations;
|
|
148
|
+
}
|
|
149
|
+
function acceptedObligations(result, columns) {
|
|
150
|
+
const obligations = [];
|
|
151
|
+
if (result.verb === "deliver" && result.verification !== undefined) {
|
|
152
|
+
obligations.push(...stopLines("verification", result.verification, columns, result.contract));
|
|
153
|
+
}
|
|
154
|
+
if (result.placement !== undefined) {
|
|
155
|
+
obligations.push(...stopLines("claim", result.placement, columns, result.contract));
|
|
156
|
+
}
|
|
157
|
+
if (result.verb === "deliver") {
|
|
158
|
+
if (result.cleanup !== undefined)
|
|
159
|
+
pushBlock(obligations, cleanupLines(result.cleanup, columns));
|
|
160
|
+
if (result.leak !== undefined)
|
|
161
|
+
pushBlock(obligations, leakLines(result.leak, columns));
|
|
94
162
|
}
|
|
95
|
-
|
|
96
|
-
|
|
163
|
+
obligations.push(...acceptedLagRows(result, columns));
|
|
164
|
+
return obligations;
|
|
165
|
+
}
|
|
166
|
+
function acceptedDeviations(result, columns) {
|
|
167
|
+
const deviations = [];
|
|
168
|
+
if (result.verb === "review") {
|
|
169
|
+
if (result.workspace !== undefined)
|
|
170
|
+
pushBlock(deviations, workspaceRows(result.workspace, columns));
|
|
171
|
+
return deviations;
|
|
172
|
+
}
|
|
173
|
+
if (result.overlaps !== undefined)
|
|
174
|
+
pushBlock(deviations, overlapRows(result.overlaps, columns));
|
|
175
|
+
if (result.overlapFailure !== undefined) {
|
|
176
|
+
receiptRow(deviations, "~", "overlap", [{ text: "unavailable" }], columns);
|
|
177
|
+
receiptPayload(deviations, "diagnostic", result.overlapFailure);
|
|
178
|
+
}
|
|
179
|
+
return deviations;
|
|
180
|
+
}
|
|
181
|
+
function renderAcceptedReceipt(result, context) {
|
|
182
|
+
const columns = context?.columns ?? 80;
|
|
183
|
+
const lines = outcomeLines("✓", result.verb, "accepted", result.contract, columns);
|
|
184
|
+
if (result.verb === "deliver" || result.verb === "review") {
|
|
185
|
+
lines.push(...acceptedObligations(result, columns));
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
lines.push(...acceptedLagRows(result, columns));
|
|
189
|
+
}
|
|
190
|
+
if (result.verb === "bind" || result.verb === "amend" || result.verb === "review") {
|
|
191
|
+
lines.push(...acceptedDeviations(result, columns));
|
|
192
|
+
}
|
|
193
|
+
lines.push(...acceptedRecord(result, columns));
|
|
97
194
|
return lines.join("\n");
|
|
98
195
|
}
|
|
99
|
-
export function
|
|
100
|
-
|
|
101
|
-
|
|
196
|
+
export function renderAccepted(result, context) {
|
|
197
|
+
switch (result.verb) {
|
|
198
|
+
case "audit":
|
|
199
|
+
return renderAcceptedAudit(result, context);
|
|
200
|
+
case "bind":
|
|
201
|
+
case "amend":
|
|
202
|
+
case "deliver":
|
|
203
|
+
case "review":
|
|
204
|
+
case "arc":
|
|
205
|
+
case "abandon":
|
|
206
|
+
return renderAcceptedReceipt(result, context);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
export function renderRetry(result, context) {
|
|
210
|
+
const columns = context?.columns ?? 80;
|
|
211
|
+
const detail = isRecord(result.detail) && typeof result.detail.kind === "string"
|
|
212
|
+
? retryLines(result.detail, HANG, columns)
|
|
213
|
+
: [];
|
|
214
|
+
return [...outcomeLines("?", result.verb, "retry", result.contract, columns), ...detail].join("\n");
|
|
102
215
|
}
|