@astrosheep/keiyaku 4.6.8 → 4.6.9
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 +40 -14
- package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/build/plugins/claude/skills/keiyaku/SKILL.md +5 -6
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
- package/build/plugins/codex/skills/keiyaku/SKILL.md +5 -6
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/plugins/opencode/index.js +1 -1
- package/build/plugins/opencode/skills/keiyaku/SKILL.md +5 -6
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/skills/keiyaku/SKILL.md +5 -6
- package/build/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/src/akuma/akuma-instance.d.ts +2 -0
- package/build/src/akuma/akuma-instance.js +10 -0
- package/build/src/akuma/akuma-observe.d.ts +33 -8
- package/build/src/akuma/akuma-observe.js +88 -64
- package/build/src/akuma/akuma-owner.d.ts +11 -2
- package/build/src/akuma/akuma-owner.js +45 -35
- package/build/src/akuma/akuma-selection-execution.js +9 -1
- package/build/src/akuma/akuma-stream.d.ts +22 -0
- package/build/src/akuma/akuma-stream.js +116 -0
- package/build/src/akuma/akuma-wait.d.ts +1 -40
- package/build/src/akuma/akuma-wait.js +23 -84
- package/build/src/akuma/akuma.d.ts +17 -11
- package/build/src/akuma/akuma.js +2 -0
- package/build/src/akuma/allowed.d.ts +7 -12
- package/build/src/akuma/allowed.js +13 -4
- package/build/src/akuma/body-supervisor.d.ts +5 -5
- package/build/src/akuma/body-supervisor.js +22 -20
- package/build/src/akuma/body.js +28 -1
- package/build/src/akuma/call-request.d.ts +12 -22
- package/build/src/akuma/heart/activity-schema.d.ts +12 -0
- package/build/src/akuma/heart/activity-schema.js +6 -0
- package/build/src/akuma/heart/index.d.ts +59 -2
- package/build/src/akuma/heart/index.js +87 -8
- package/build/src/akuma/heart/rows.js +5 -3
- package/build/src/akuma/heart/soul.d.ts +9 -0
- package/build/src/akuma/heart/soul.js +29 -0
- package/build/src/akuma/heart/storage.d.ts +15 -0
- package/build/src/akuma/heart/storage.js +55 -0
- package/build/src/akuma/heart/timeline.d.ts +7 -0
- package/build/src/akuma/heart/timeline.js +10 -0
- package/build/src/akuma/index.d.ts +1 -0
- package/build/src/akuma/projection.d.ts +25 -0
- package/build/src/akuma/projection.js +24 -7
- package/build/src/akuma/provider-recipe.d.ts +11 -0
- package/build/src/akuma/provider-recipe.js +23 -0
- package/build/src/akuma/provider.d.ts +25 -0
- package/build/src/akuma/provider.js +99 -7
- package/build/src/akuma/providers/acp/events.js +25 -2
- package/build/src/akuma/providers/claude/events.js +76 -10
- package/build/src/akuma/providers/claude/index.js +2 -5
- package/build/src/akuma/providers/codex-app-server/events.js +17 -2
- package/build/src/akuma/providers/codex-app-server/index.js +15 -9
- package/build/src/akuma/providers/decode.d.ts +8 -0
- package/build/src/akuma/providers/decode.js +21 -0
- package/build/src/akuma/providers/grok-build/index.js +10 -26
- package/build/src/akuma/providers/opencode-sdk/event-stream.d.ts +3 -3
- package/build/src/akuma/providers/opencode-sdk/event-stream.js +2 -25
- package/build/src/akuma/providers/opencode-sdk/events.d.ts +7 -43
- package/build/src/akuma/providers/opencode-sdk/events.js +147 -284
- package/build/src/akuma/providers/opencode-sdk/index.js +267 -421
- package/build/src/akuma/providers/opencode-sdk/native-http.d.ts +9 -0
- package/build/src/akuma/providers/opencode-sdk/native-http.js +69 -0
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +42 -36
- package/build/src/akuma/providers/opencode-sdk/session.js +75 -82
- package/build/src/akuma/providers/paseo/events.d.ts +8 -0
- package/build/src/akuma/providers/paseo/events.js +58 -11
- package/build/src/akuma/providers/paseo/index.js +11 -7
- package/build/src/akuma/providers/pi/events.d.ts +2 -0
- package/build/src/akuma/providers/pi/events.js +32 -24
- package/build/src/akuma/providers/pi/index.js +21 -35
- package/build/src/akuma/request-lifecycle.d.ts +1 -2
- package/build/src/akuma/request-lifecycle.js +2 -8
- package/build/src/akuma/request-rendezvous.js +38 -55
- package/build/src/akuma/request-serve.d.ts +1 -1
- package/build/src/akuma/request-serve.js +77 -113
- package/build/src/akuma/selection-observation.d.ts +57 -51
- package/build/src/akuma/selection-observation.js +3 -3
- package/build/src/akuma/turn-drive.d.ts +3 -0
- package/build/src/akuma/turn-drive.js +26 -5
- package/build/src/akuma-body.js +12 -22
- package/build/src/cli/akuma-caller.js +10 -0
- package/build/src/cli/commands/akuma-grammar.js +3 -4
- package/build/src/cli/commands/akuma.js +13 -51
- package/build/src/cli/commands/contract-grammar.d.ts +7 -6
- package/build/src/cli/commands/contract-grammar.js +27 -32
- package/build/src/cli/commands/contract-help.d.ts +16 -7
- package/build/src/cli/commands/contract-help.js +20 -11
- package/build/src/cli/commands/contract.js +11 -11
- package/build/src/cli/commands/debt-grammar.d.ts +19 -0
- package/build/src/cli/commands/debt-grammar.js +323 -0
- package/build/src/cli/commands/debt-query.d.ts +5 -0
- package/build/src/cli/commands/{task-query.js → debt-query.js} +9 -9
- package/build/src/cli/commands/{task.d.ts → debt.d.ts} +2 -2
- package/build/src/cli/commands/{task.js → debt.js} +83 -143
- package/build/src/cli/coordinates.d.ts +1 -1
- package/build/src/cli/coordinates.js +1 -1
- package/build/src/cli/parse.d.ts +4 -4
- package/build/src/cli/parse.js +17 -16
- package/build/src/cli/render/akuma-activity.d.ts +11 -83
- package/build/src/cli/render/akuma-activity.js +20 -382
- package/build/src/cli/render/catalog.d.ts +2 -2
- package/build/src/cli/render/catalog.js +5 -5
- package/build/src/cli/render/contract.js +2 -2
- package/build/src/cli/render/debt.d.ts +28 -0
- package/build/src/cli/render/{task.js → debt.js} +51 -112
- package/build/src/cli/render/kanshi.js +28 -28
- package/build/src/cli/render/marks.d.ts +5 -5
- package/build/src/cli/render/marks.js +4 -10
- package/build/src/cli/render/nuke.js +1 -1
- package/build/src/cli/runtime.js +3 -3
- package/build/src/cli/scan.d.ts +1 -1
- package/build/src/cli/usage.d.ts +1 -1
- package/build/src/cli/usage.js +4 -4
- package/build/src/contract-worktree.js +3 -3
- package/build/src/debt/board.d.ts +160 -0
- package/build/src/{task → debt}/board.js +89 -89
- package/build/src/debt/catalog.d.ts +11 -0
- package/build/src/debt/catalog.js +59 -0
- package/build/src/{task → debt}/context.d.ts +1 -1
- package/build/src/{task → debt}/context.js +1 -1
- package/build/src/{task → debt}/created-observation.d.ts +6 -10
- package/build/src/{task → debt}/created-observation.js +7 -7
- package/build/src/debt/document.d.ts +37 -0
- package/build/src/{task → debt}/document.js +37 -37
- package/build/src/debt/identity.d.ts +21 -0
- package/build/src/{task → debt}/identity.js +35 -35
- package/build/src/debt/index.d.ts +111 -0
- package/build/src/debt/index.js +203 -0
- package/build/src/{task → debt}/input.d.ts +8 -8
- package/build/src/{task → debt}/input.js +21 -21
- package/build/src/debt/lifecycle-operations.d.ts +6 -0
- package/build/src/{task → debt}/lifecycle-operations.js +27 -31
- package/build/src/debt/mutation-result.d.ts +981 -0
- package/build/src/debt/mutation-result.js +109 -0
- package/build/src/debt/mutation.d.ts +424 -0
- package/build/src/debt/mutation.js +223 -0
- package/build/src/debt/operation-types.d.ts +71 -0
- package/build/src/debt/operations.d.ts +28 -0
- package/build/src/{task → debt}/operations.js +59 -60
- package/build/src/debt/query.d.ts +76 -0
- package/build/src/{task → debt}/query.js +55 -55
- package/build/src/{task → debt}/store.d.ts +13 -13
- package/build/src/{task → debt}/store.js +58 -49
- package/build/src/debt/view.d.ts +4 -0
- package/build/src/debt/view.js +7 -0
- package/build/src/identity/coordinates.d.ts +1 -1
- package/build/src/index.d.ts +13 -13
- package/build/src/index.js +9 -9
- package/build/src/kanshi/index.d.ts +1 -1
- package/build/src/kanshi/read.js +33 -33
- package/build/src/kanshi/report.d.ts +7 -7
- package/build/src/kanshi/select.js +4 -4
- package/build/src/library/akumas.d.ts +2 -3
- package/build/src/library/bind.d.ts +3 -3
- package/build/src/library/bind.js +5 -5
- package/build/src/library/contract-creation.js +5 -5
- package/build/src/library/contract-execution.js +4 -4
- package/build/src/library/contract-types.d.ts +2 -2
- package/build/src/library/input.d.ts +2 -2
- package/build/src/library/input.js +5 -5
- package/build/src/library/invocation.js +2 -2
- package/build/src/library/nuke.js +3 -3
- package/build/src/library/outcome.d.ts +126 -126
- package/build/src/library/outcome.js +3 -3
- package/build/src/library/selection.d.ts +1 -4
- package/build/src/library/selection.js +11 -62
- package/build/src/plugin/public.d.ts +5 -0
- package/build/src/plugin/runtime.js +3 -1
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settlement/fence.d.ts +3 -3
- package/build/src/settlement/fence.js +4 -4
- package/build/src/settlement/holder.d.ts +16 -16
- package/build/src/settlement/holder.js +69 -63
- package/build/src/settlement/settle.d.ts +5 -5
- package/build/src/settlement/settle.js +53 -53
- package/package.json +12 -6
- package/plugins/paseo/plugin/index.server.ts +17 -0
- package/plugins/paseo/plugin/paseo-plugin.json +4 -0
- package/plugins/paseo/plugin/server/attach.ts +52 -0
- package/plugins/paseo/plugin/server/keiyaku.ts +44 -0
- package/plugins/paseo/plugin/server/message.ts +60 -0
- package/plugins/paseo/plugin/server/mirror.ts +193 -0
- package/plugins/paseo/plugin/server/model.ts +14 -0
- package/plugins/paseo/plugin/server/provider.ts +276 -0
- package/plugins/paseo/plugin/server/sdk-worker.ts +237 -0
- package/plugins/paseo/plugin/server/sdk.ts +289 -0
- package/plugins/paseo/plugin/server/stop.ts +26 -0
- package/plugins/paseo/plugin/server/transport.ts +35 -0
- package/plugins/paseo/plugin/shared/attach-rpc.ts +10 -0
- package/plugins/paseo/plugin/shared/refresh-rpc.ts +6 -0
- package/plugins/paseo/plugin/tsconfig.json +6 -0
- package/skills/keiyaku/SKILL.md +5 -6
- package/skills/keiyaku-akuma/SKILL.md +1 -1
- package/skills/keiyaku-akuma/references/automation.md +8 -8
- package/skills/keiyaku-babysit/SKILL.md +1 -1
- package/skills/keiyaku-bind/SKILL.md +9 -9
- package/skills/keiyaku-debt/SKILL.md +91 -0
- package/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/plugins/claude/skills/keiyaku-task/SKILL.md +0 -104
- package/build/plugins/codex/skills/keiyaku-task/SKILL.md +0 -104
- package/build/plugins/opencode/skills/keiyaku-task/SKILL.md +0 -104
- package/build/skills/keiyaku-task/SKILL.md +0 -104
- package/build/src/cli/commands/task-grammar.d.ts +0 -19
- package/build/src/cli/commands/task-grammar.js +0 -384
- package/build/src/cli/commands/task-query.d.ts +0 -5
- package/build/src/cli/render/task.d.ts +0 -39
- package/build/src/task/board.d.ts +0 -168
- package/build/src/task/catalog.d.ts +0 -11
- package/build/src/task/catalog.js +0 -59
- package/build/src/task/compose-language.d.ts +0 -57
- package/build/src/task/compose-language.js +0 -364
- package/build/src/task/compose-parser.d.ts +0 -32
- package/build/src/task/compose-parser.js +0 -180
- package/build/src/task/compose.d.ts +0 -16
- package/build/src/task/compose.js +0 -189
- package/build/src/task/document.d.ts +0 -39
- package/build/src/task/identity.d.ts +0 -21
- package/build/src/task/index.d.ts +0 -138
- package/build/src/task/index.js +0 -269
- package/build/src/task/lifecycle-operations.d.ts +0 -6
- package/build/src/task/mutation-result.d.ts +0 -1726
- package/build/src/task/mutation-result.js +0 -198
- package/build/src/task/mutation.d.ts +0 -590
- package/build/src/task/mutation.js +0 -262
- package/build/src/task/operation-types.d.ts +0 -71
- package/build/src/task/operations.d.ts +0 -28
- package/build/src/task/query.d.ts +0 -76
- package/build/src/task/view.d.ts +0 -4
- package/build/src/task/view.js +0 -7
- package/skills/keiyaku-task/SKILL.md +0 -104
- /package/build/src/{task → debt}/operation-types.js +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AkumaList } from "../../akuma/akuma.js";
|
|
2
2
|
import type { ArchetypeCatalog } from "../../index.js";
|
|
3
3
|
import type { ContractList } from "../../library/contract-types.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { DebtPage, DebtRow } from "../../debt/index.js";
|
|
5
5
|
export declare function renderAkumaCatalogue(list: AkumaList, archetype: string | null): string;
|
|
6
6
|
export declare function renderContractCatalogue(list: ContractList): string;
|
|
7
7
|
export declare function renderArchetypeCatalogue(list: ArchetypeCatalog): string;
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function renderDebtCatalogue(list: DebtPage<DebtRow>, namespace: readonly string[]): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { abbreviateGitIds, displayGitId, gitIdsInRow, lifecycleWord, progressStrip } from "./contract-observation.js";
|
|
2
2
|
import { ageText, emptyCatalogue, renderBoundedPayload, safeText } from "./terminal.js";
|
|
3
3
|
import { akumaMark, contractMark } from "./marks.js";
|
|
4
|
-
import { dispositionText,
|
|
4
|
+
import { dispositionText, debtFrameHead, debtMark } from "./debt.js";
|
|
5
5
|
function relativeAge(source, observedAt) {
|
|
6
6
|
if (source === null)
|
|
7
7
|
return null;
|
|
@@ -92,14 +92,14 @@ export function renderArchetypeCatalogue(list) {
|
|
|
92
92
|
]),
|
|
93
93
|
].join("\n");
|
|
94
94
|
}
|
|
95
|
-
export function
|
|
95
|
+
export function renderDebtCatalogue(list, namespace) {
|
|
96
96
|
const scope = namespace.length === 0 ? "root" : `namespace ${namespace.join("/")}`;
|
|
97
|
-
const head =
|
|
97
|
+
const head = debtFrameHead("debts", scope);
|
|
98
98
|
if (list.rows.length === 0)
|
|
99
|
-
return emptyCatalogue("
|
|
99
|
+
return emptyCatalogue("debts");
|
|
100
100
|
return [
|
|
101
101
|
head,
|
|
102
|
-
...list.rows.map((row) => `${
|
|
102
|
+
...list.rows.map((row) => `${debtMark(row.disposition)} ${safeText(row.id)} · ${dispositionText(row.disposition)} · P${row.priority} — ${safeText(row.title)}`),
|
|
103
103
|
...(list.hasMore ? ["…"] : []),
|
|
104
104
|
].join("\n");
|
|
105
105
|
}
|
|
@@ -62,8 +62,8 @@ function lagRows(lag, columns) {
|
|
|
62
62
|
function settlementLagRows(lag, columns) {
|
|
63
63
|
const lines = [];
|
|
64
64
|
receiptRow(lines, "!", "settlement", [{ text: lag.surface.replaceAll("-", " ") }], columns);
|
|
65
|
-
if (lag.
|
|
66
|
-
receiptRow(lines, " ", "
|
|
65
|
+
if (lag.debtId !== undefined)
|
|
66
|
+
receiptRow(lines, " ", "debt", [{ text: lag.debtId, opaque: true }], columns);
|
|
67
67
|
if (lag.path !== undefined)
|
|
68
68
|
receiptRow(lines, " ", "path", [{ text: lag.path, opaque: true }], columns);
|
|
69
69
|
receiptPayload(lines, "reason", lag.diagnostic);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { BlockedDebtList, DebtBatchResult, DebtContextResult, DebtDecompositionTree, DebtDetail, DebtDoctorReport, DebtList, DebtMutationResult, DebtQueryResult, DebtUpdateResult } from "../../debt/index.js";
|
|
2
|
+
import { type TextRenderContext } from "./terminal.js";
|
|
3
|
+
export { debtMark } from "./marks.js";
|
|
4
|
+
type DebtListOutcome = DebtList | BlockedDebtList | DebtQueryResult;
|
|
5
|
+
/** One addressed show selection: native details, or a refusal naming a missing addressed read. */
|
|
6
|
+
export type DebtShowResult = DebtDetail | DebtDetail[] | Extract<DebtMutationResult, {
|
|
7
|
+
kind: "refused";
|
|
8
|
+
}>;
|
|
9
|
+
/** Presentation-only list scope the leaf acquired; never part of a product value. */
|
|
10
|
+
export type DebtListScope = "world" | "current" | Readonly<{
|
|
11
|
+
namespace: string;
|
|
12
|
+
}>;
|
|
13
|
+
/** The union of native Debt SDK answers one leaf renders directly; the CLI adds no result envelope. */
|
|
14
|
+
type DebtNativeResult = DebtMutationResult | DebtUpdateResult | DebtBatchResult | DebtShowResult | DebtList | BlockedDebtList | DebtQueryResult | DebtDecompositionTree | DebtDoctorReport | DebtContextResult;
|
|
15
|
+
/** Debt dispositions and relation states are snake_case facts; people read them as words. */
|
|
16
|
+
export declare function dispositionText(word: string): string;
|
|
17
|
+
export declare function debtFrameHead(view: string, scope: string): string;
|
|
18
|
+
export declare function renderDebtList(action: "ls" | "ready" | "blocked" | "query", scope: DebtListScope, result: DebtListOutcome, context?: TextRenderContext): string;
|
|
19
|
+
export declare function renderDebtShow(result: DebtShowResult, context?: TextRenderContext): string;
|
|
20
|
+
export declare function renderDoctor(report: DebtDoctorReport): string;
|
|
21
|
+
export declare function renderDebtUpdate(result: DebtUpdateResult, context?: TextRenderContext): string;
|
|
22
|
+
export declare function renderDebtTree(result: DebtDecompositionTree, context?: TextRenderContext): string;
|
|
23
|
+
export declare function renderDebtContext(result: DebtContextResult, context?: TextRenderContext): string;
|
|
24
|
+
/** One single-Debt mutation answer; `verb` is the literal action the leaf invoked. */
|
|
25
|
+
export declare function renderDebtMutation(verb: string, result: DebtMutationResult, context?: TextRenderContext): string;
|
|
26
|
+
/** One lifecycle answer: a single mutation or a plural batch, both native shapes. */
|
|
27
|
+
export declare function renderDebtLifecycle(verb: string, result: DebtMutationResult | DebtBatchResult, context?: TextRenderContext): string;
|
|
28
|
+
export declare function debtExitCode(result: DebtNativeResult): number;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { debtMark } from "./marks.js";
|
|
2
2
|
import { outcomeLines, receiptPayload, receiptRow, refusalLines } from "./receipt.js";
|
|
3
3
|
import { DEFAULT_CLI_COLUMNS, displayColumns, emptyCatalogue, renderTextBlock, safeText, } from "./terminal.js";
|
|
4
|
-
export {
|
|
4
|
+
export { debtMark } from "./marks.js";
|
|
5
5
|
const DEFAULT_CONTEXT = { columns: DEFAULT_CLI_COLUMNS, color: false };
|
|
6
|
-
/**
|
|
6
|
+
/** Debt dispositions and relation states are snake_case facts; people read them as words. */
|
|
7
7
|
export function dispositionText(word) {
|
|
8
8
|
return word === "drop" ? "dropped" : word.replaceAll("_", " ");
|
|
9
9
|
}
|
|
@@ -12,8 +12,8 @@ function priorityText(priority) {
|
|
|
12
12
|
}
|
|
13
13
|
function scanUnit(id, priority, word) {
|
|
14
14
|
return word === undefined
|
|
15
|
-
? `${
|
|
16
|
-
: `${
|
|
15
|
+
? `${debtMark("ready")} ${id} · ${priorityText(priority)}`
|
|
16
|
+
: `${debtMark(word)} ${id} · ${dispositionText(word)} · ${priorityText(priority)}`;
|
|
17
17
|
}
|
|
18
18
|
function entityLines(entity, columns, indent = "") {
|
|
19
19
|
const scan = `${indent}${scanUnit(entity.id, entity.priority, entity.word)}${entity.facts === undefined ? "" : ` · ${entity.facts}`}`;
|
|
@@ -25,20 +25,20 @@ function entityLines(entity, columns, indent = "") {
|
|
|
25
25
|
return [inline];
|
|
26
26
|
return [scan, ...renderTextBlock(title, `${indent} `, columns, "—")];
|
|
27
27
|
}
|
|
28
|
-
function stateEntity(
|
|
28
|
+
function stateEntity(debt) {
|
|
29
29
|
return {
|
|
30
|
-
id:
|
|
31
|
-
priority: "priority" in
|
|
32
|
-
word:
|
|
33
|
-
title:
|
|
30
|
+
id: debt.id,
|
|
31
|
+
priority: "priority" in debt && debt.priority !== undefined ? debt.priority : null,
|
|
32
|
+
word: debt.state,
|
|
33
|
+
title: debt.title,
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
function projectRefusal(refusal) {
|
|
37
37
|
const diagnostic = refusal.kind.replaceAll("-", " ");
|
|
38
|
-
if (refusal.kind === "
|
|
39
|
-
return { diagnostic, facts: [`
|
|
38
|
+
if (refusal.kind === "debt-missing")
|
|
39
|
+
return { diagnostic, facts: [`debt ${refusal.debtId}`] };
|
|
40
40
|
if (refusal.kind === "invalid-lifecycle-transition") {
|
|
41
|
-
return { diagnostic, facts: [`
|
|
41
|
+
return { diagnostic, facts: [`debt ${refusal.debtId}`, `state ${refusal.state} · verb ${refusal.verb}`] };
|
|
42
42
|
}
|
|
43
43
|
if (refusal.kind === "invalid-namespace-context")
|
|
44
44
|
return { diagnostic, facts: [`path ${refusal.path}`] };
|
|
@@ -46,14 +46,12 @@ function projectRefusal(refusal) {
|
|
|
46
46
|
return {
|
|
47
47
|
diagnostic,
|
|
48
48
|
facts: [
|
|
49
|
-
`
|
|
50
|
-
`related
|
|
51
|
-
`declaring
|
|
49
|
+
`debt ${refusal.debtId}`,
|
|
50
|
+
`related debt ${refusal.related}`,
|
|
51
|
+
`declaring debt ${refusal.declaringDebt}`,
|
|
52
52
|
],
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
if (refusal.kind === "invalid-composition")
|
|
56
|
-
return { diagnostic, compositionDiagnostics: refusal.diagnostics };
|
|
57
55
|
return refusal.diagnostic === undefined ? { diagnostic } : { diagnostic, facts: [`detail ${refusal.diagnostic}`] };
|
|
58
56
|
}
|
|
59
57
|
function renderFailure(verb, result, columns) {
|
|
@@ -61,13 +59,13 @@ function renderFailure(verb, result, columns) {
|
|
|
61
59
|
return [...outcomeLines("?", verb, "retry", undefined, columns), result.reason].join("\n");
|
|
62
60
|
}
|
|
63
61
|
const facts = projectRefusal(result.refusal);
|
|
64
|
-
return refusalLines(verb, [`reason ${facts.diagnostic}`, ...(facts.facts ?? [])], columns
|
|
62
|
+
return refusalLines(verb, [`reason ${facts.diagnostic}`, ...(facts.facts ?? [])], columns).join("\n");
|
|
65
63
|
}
|
|
66
64
|
function edge(label, ref, mark) {
|
|
67
65
|
const prefix = mark === undefined ? ` ${label}` : ` ${mark} ${label}`;
|
|
68
66
|
return `${prefix} ${ref.id} · ${dispositionText(ref.state)}`;
|
|
69
67
|
}
|
|
70
|
-
export function
|
|
68
|
+
export function debtFrameHead(view, scope) {
|
|
71
69
|
return `${view.toUpperCase()} // ${scope}`;
|
|
72
70
|
}
|
|
73
71
|
function updatedAge(updatedAt) {
|
|
@@ -103,18 +101,18 @@ function renderListRow(item, columns, omitDisposition) {
|
|
|
103
101
|
}
|
|
104
102
|
return lines;
|
|
105
103
|
}
|
|
106
|
-
export function
|
|
104
|
+
export function renderDebtList(action, scope, result, context = DEFAULT_CONTEXT) {
|
|
107
105
|
const columns = context.columns;
|
|
108
106
|
if (result.kind !== "accepted")
|
|
109
107
|
return renderFailure(action, result, columns);
|
|
110
|
-
const view = action === "ls" ? "
|
|
108
|
+
const view = action === "ls" ? "debts" : action;
|
|
111
109
|
const footer = result.value.hasMore ? ["…"] : [];
|
|
112
110
|
const scopeText = scope === "world"
|
|
113
111
|
? "world"
|
|
114
112
|
: scope === "current"
|
|
115
113
|
? "current namespace"
|
|
116
|
-
: `namespace ${scope.namespace.replace(/^
|
|
117
|
-
const heading =
|
|
114
|
+
: `namespace ${scope.namespace.replace(/^debt\//u, "").replace(/\/$/u, "") || "root"}`;
|
|
115
|
+
const heading = debtFrameHead(view, scopeText);
|
|
118
116
|
if (result.value.rows.length === 0)
|
|
119
117
|
return emptyCatalogue(view);
|
|
120
118
|
return [
|
|
@@ -127,12 +125,12 @@ function textTimestamp(timestamp) {
|
|
|
127
125
|
return timestamp.replace(/\.\d+(?=Z$)/u, "");
|
|
128
126
|
}
|
|
129
127
|
function renderShowDetail(result, columns) {
|
|
130
|
-
const
|
|
128
|
+
const debt = result.debt;
|
|
131
129
|
const lines = [
|
|
132
|
-
...entityLines(stateEntity(
|
|
133
|
-
` created ${textTimestamp(
|
|
134
|
-
` updated ${textTimestamp(
|
|
135
|
-
...(
|
|
130
|
+
...entityLines(stateEntity(debt), columns),
|
|
131
|
+
` created ${textTimestamp(debt.createdAt)}`,
|
|
132
|
+
` updated ${textTimestamp(debt.updatedAt)}`,
|
|
133
|
+
...(debt.createdBy === undefined ? [] : [` created by ${debt.createdBy}`]),
|
|
136
134
|
];
|
|
137
135
|
for (const need of result.needs.filter((item) => !item.released))
|
|
138
136
|
lines.push(edge("needs", need, "!"));
|
|
@@ -150,13 +148,13 @@ function renderShowDetail(result, columns) {
|
|
|
150
148
|
lines.push(edge("superseded-by", item));
|
|
151
149
|
for (const item of result.related)
|
|
152
150
|
lines.push(edge("related", item));
|
|
153
|
-
if (
|
|
154
|
-
receiptPayload(lines, "note",
|
|
155
|
-
if (
|
|
156
|
-
receiptPayload(lines, "body",
|
|
151
|
+
if (debt.note.length > 0)
|
|
152
|
+
receiptPayload(lines, "note", debt.note);
|
|
153
|
+
if (debt.body.length > 0)
|
|
154
|
+
receiptPayload(lines, "body", debt.body);
|
|
157
155
|
return lines.join("\n");
|
|
158
156
|
}
|
|
159
|
-
export function
|
|
157
|
+
export function renderDebtShow(result, context = DEFAULT_CONTEXT) {
|
|
160
158
|
const columns = context.columns;
|
|
161
159
|
if (Array.isArray(result))
|
|
162
160
|
return result.map((detail) => renderShowDetail(detail, columns)).join("\n\n");
|
|
@@ -167,18 +165,18 @@ export function renderTaskShow(result, context = DEFAULT_CONTEXT) {
|
|
|
167
165
|
function treeLines(node, columns, depth = 0) {
|
|
168
166
|
const indent = " ".repeat(depth);
|
|
169
167
|
if (node.cycle === true)
|
|
170
|
-
return [`${indent}! ${node.
|
|
168
|
+
return [`${indent}! ${node.debt.id} · cycle`];
|
|
171
169
|
return [
|
|
172
|
-
...entityLines(stateEntity(node.
|
|
170
|
+
...entityLines(stateEntity(node.debt), columns, indent),
|
|
173
171
|
...node.children.flatMap((child) => treeLines(child, columns, depth + 1)),
|
|
174
172
|
];
|
|
175
173
|
}
|
|
176
174
|
function doctorIssue(issue) {
|
|
177
175
|
if (issue.kind === "missing-target")
|
|
178
|
-
return `! missing-target ${issue.
|
|
176
|
+
return `! missing-target ${issue.debtId} ${issue.relation} ${issue.target}`;
|
|
179
177
|
if (issue.kind === "self-relation")
|
|
180
|
-
return `! self-relation ${issue.
|
|
181
|
-
return `! cycle ${issue.relation} ${issue.
|
|
178
|
+
return `! self-relation ${issue.debtId} ${issue.relation}`;
|
|
179
|
+
return `! cycle ${issue.relation} ${issue.debts.join(" ")}`;
|
|
182
180
|
}
|
|
183
181
|
export function renderDoctor(report) {
|
|
184
182
|
if (report.issues.length === 0)
|
|
@@ -188,18 +186,14 @@ export function renderDoctor(report) {
|
|
|
188
186
|
}
|
|
189
187
|
const PAST_VERBS = {
|
|
190
188
|
add: "added",
|
|
191
|
-
start: "started",
|
|
192
|
-
stop: "stopped",
|
|
193
|
-
hold: "held",
|
|
194
|
-
resume: "resumed",
|
|
195
189
|
done: "done",
|
|
196
190
|
drop: "dropped",
|
|
197
191
|
update: "updated",
|
|
198
192
|
};
|
|
199
|
-
function renderAcceptedMutation(verb,
|
|
193
|
+
function renderAcceptedMutation(verb, debt, columns, changes = []) {
|
|
200
194
|
const lines = [];
|
|
201
|
-
receiptRow(lines, "✓", PAST_VERBS[verb] ?? verb, [{ text:
|
|
202
|
-
lines.push(...entityLines(stateEntity(
|
|
195
|
+
receiptRow(lines, "✓", PAST_VERBS[verb] ?? verb, [{ text: debt.id, opaque: true }], columns);
|
|
196
|
+
lines.push(...entityLines(stateEntity(debt), columns));
|
|
203
197
|
for (const change of changes)
|
|
204
198
|
lines.push(` ${change.field} ${change.action}`);
|
|
205
199
|
return lines.join("\n");
|
|
@@ -209,11 +203,11 @@ function renderMutation(action, result, columns) {
|
|
|
209
203
|
return renderFailure(action, result, columns);
|
|
210
204
|
return renderAcceptedMutation(action, result.value, columns);
|
|
211
205
|
}
|
|
212
|
-
export function
|
|
206
|
+
export function renderDebtUpdate(result, context = DEFAULT_CONTEXT) {
|
|
213
207
|
const columns = context.columns;
|
|
214
208
|
if (result.kind !== "accepted")
|
|
215
209
|
return renderFailure("update", result, columns);
|
|
216
|
-
return renderAcceptedMutation("update", result.value.
|
|
210
|
+
return renderAcceptedMutation("update", result.value.debt, columns, result.value.changedFields);
|
|
217
211
|
}
|
|
218
212
|
function renderBatchItem(verb, item, columns) {
|
|
219
213
|
if (item.outcome.kind === "accepted")
|
|
@@ -221,87 +215,32 @@ function renderBatchItem(verb, item, columns) {
|
|
|
221
215
|
if (item.outcome.kind === "retry")
|
|
222
216
|
return `? ${verb} ${item.id} ${item.outcome.reason}`;
|
|
223
217
|
const facts = projectRefusal(item.outcome.refusal);
|
|
224
|
-
const rest = (facts.facts ?? []).filter((fact) => fact !== `
|
|
225
|
-
return refusalLines(verb, [`
|
|
218
|
+
const rest = (facts.facts ?? []).filter((fact) => fact !== `debt ${item.id}`);
|
|
219
|
+
return refusalLines(verb, [`debt ${item.id}`, `reason ${facts.diagnostic}`, ...rest], columns).join("\n");
|
|
226
220
|
}
|
|
227
221
|
function renderBatch(verb, batch, columns) {
|
|
228
222
|
return batch.items.map((item) => renderBatchItem(verb, item, columns)).join("\n");
|
|
229
223
|
}
|
|
230
|
-
function
|
|
231
|
-
return admissions.map((admission) => `admit ${admission.position} ${admission.kind === "new" ? "+" : `@${admission.taskId}`} ${safeText(admission.title)}${admission.kind === "new" && admission.alias !== undefined ? ` as ^${admission.alias}` : ""}`);
|
|
232
|
-
}
|
|
233
|
-
function stoppedLines(stopped) {
|
|
234
|
-
if (stopped.kind === "retry")
|
|
235
|
-
return [`? stopped ${stopped.reason}`];
|
|
236
|
-
const facts = projectRefusal(stopped);
|
|
237
|
-
return refusalLines("stopped", [`reason ${facts.diagnostic}`, ...(facts.facts ?? [])], DEFAULT_CLI_COLUMNS);
|
|
238
|
-
}
|
|
239
|
-
function aliasLines(aliases) {
|
|
240
|
-
return aliases.map((binding) => `alias ^${binding.alias} ${binding.taskId}`);
|
|
241
|
-
}
|
|
242
|
-
function planAliasLines(aliases) {
|
|
243
|
-
return aliases.map((binding) => `alias ^${binding.alias} ${binding.position}`);
|
|
244
|
-
}
|
|
245
|
-
function renderPlan(result) {
|
|
246
|
-
const lines = [
|
|
247
|
-
`compose plan · ${result.admissionOrder.length} documents`,
|
|
248
|
-
...planAliasLines(result.aliases),
|
|
249
|
-
...admissionLines(result.admissions),
|
|
250
|
-
];
|
|
251
|
-
for (const body of result.bodies) {
|
|
252
|
-
lines.push(`body ${body.position} + ${safeText(body.title)} · ${body.bytes} bytes`);
|
|
253
|
-
lines.push(` first ${safeText(body.firstLine)}`);
|
|
254
|
-
lines.push(` last ${safeText(body.lastLine)}`);
|
|
255
|
-
}
|
|
256
|
-
return lines.join("\n");
|
|
257
|
-
}
|
|
258
|
-
export function renderTaskCompose(result, context = DEFAULT_CONTEXT) {
|
|
259
|
-
const columns = context.columns;
|
|
260
|
-
if (result.kind === "incomplete")
|
|
261
|
-
return "";
|
|
262
|
-
if (result.kind === "planned")
|
|
263
|
-
return renderPlan(result);
|
|
264
|
-
if (result.kind !== "accepted")
|
|
265
|
-
return renderFailure("compose", result, columns);
|
|
266
|
-
return [
|
|
267
|
-
`✓ composed · ${result.documentChanges.length} changed`,
|
|
268
|
-
...aliasLines(result.aliases),
|
|
269
|
-
...admissionLines(result.admissions),
|
|
270
|
-
].join("\n");
|
|
271
|
-
}
|
|
272
|
-
export function renderTaskTree(result, context = DEFAULT_CONTEXT) {
|
|
224
|
+
export function renderDebtTree(result, context = DEFAULT_CONTEXT) {
|
|
273
225
|
return result.kind === "accepted"
|
|
274
226
|
? treeLines(result.value, context.columns).join("\n")
|
|
275
227
|
: renderFailure("tree", result, context.columns);
|
|
276
228
|
}
|
|
277
|
-
export function
|
|
229
|
+
export function renderDebtContext(result, context = DEFAULT_CONTEXT) {
|
|
278
230
|
if (result.kind !== "accepted")
|
|
279
231
|
return renderFailure("context", result, context.columns);
|
|
280
232
|
const value = result.value.namespace.length === 0 ? "root" : result.value.namespace.join("/");
|
|
281
233
|
return `context ${value} · ${result.value.source}`;
|
|
282
234
|
}
|
|
283
|
-
/** One single-
|
|
284
|
-
export function
|
|
235
|
+
/** One single-Debt mutation answer; `verb` is the literal action the leaf invoked. */
|
|
236
|
+
export function renderDebtMutation(verb, result, context = DEFAULT_CONTEXT) {
|
|
285
237
|
return renderMutation(verb, result, context.columns);
|
|
286
238
|
}
|
|
287
239
|
/** One lifecycle answer: a single mutation or a plural batch, both native shapes. */
|
|
288
|
-
export function
|
|
240
|
+
export function renderDebtLifecycle(verb, result, context = DEFAULT_CONTEXT) {
|
|
289
241
|
return "items" in result ? renderBatch(verb, result, context.columns) : renderMutation(verb, result, context.columns);
|
|
290
242
|
}
|
|
291
|
-
|
|
292
|
-
export function renderTaskFailure(verb, result, context = DEFAULT_CONTEXT) {
|
|
293
|
-
return renderFailure(verb, result, context.columns);
|
|
294
|
-
}
|
|
295
|
-
export function renderTaskIncompleteDiagnostic(result) {
|
|
296
|
-
if (result.kind !== "incomplete")
|
|
297
|
-
return "";
|
|
298
|
-
return [
|
|
299
|
-
`! compose incomplete ${result.documentChanges.length} admitted`,
|
|
300
|
-
...admissionLines(result.admissions.slice(0, result.documentChanges.length)),
|
|
301
|
-
...stoppedLines(result.stopped),
|
|
302
|
-
].join("\n");
|
|
303
|
-
}
|
|
304
|
-
export function taskExitCode(result) {
|
|
243
|
+
export function debtExitCode(result) {
|
|
305
244
|
if ("issues" in result)
|
|
306
245
|
return result.issues.length === 0 ? 0 : 1;
|
|
307
246
|
if ("items" in result) {
|
|
@@ -311,7 +250,7 @@ export function taskExitCode(result) {
|
|
|
311
250
|
if ("kind" in result) {
|
|
312
251
|
if (result.kind === "retry")
|
|
313
252
|
return 2;
|
|
314
|
-
if (result.kind === "refused"
|
|
253
|
+
if (result.kind === "refused")
|
|
315
254
|
return 1;
|
|
316
255
|
}
|
|
317
256
|
return 0;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { abbreviateGitIds, afterWording, progressStrip, displayGitId, gateFact, gitIdsInRow, lifecycleWord, mergeSummary, targetMovementFacts, verificationFact, } from "./contract-observation.js";
|
|
2
2
|
import { DEFAULT_CLI_COLUMNS, emptyCatalogue, entityLines, elapsedMilliseconds, identityLine, plumbFacts, RECENT_TONE_MS, renderBoundedPayload, renderSectionBlock, safeText, tone, } from "./terminal.js";
|
|
3
3
|
import { endpointFact, formatAge, NARROW_COLUMNS, renderAkuma, renderAkumaBoard } from "./kanshi-akuma.js";
|
|
4
|
-
import { contractMark,
|
|
5
|
-
import { dispositionText } from "./
|
|
4
|
+
import { contractMark, debtDispositionMark } from "./marks.js";
|
|
5
|
+
import { dispositionText } from "./debt.js";
|
|
6
6
|
const REVIEW_ATTENTION_MS = 15 * 60 * 1_000;
|
|
7
7
|
const PENDING_ATTENTION_MS = 60 * 60 * 1_000;
|
|
8
8
|
function contractHasError(row) {
|
|
@@ -52,13 +52,13 @@ function mergeFacts(row) {
|
|
|
52
52
|
const summary = mergeSummary(row.workspaceObservation);
|
|
53
53
|
return summary === undefined ? [] : [summary];
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
if (
|
|
57
|
-
return `! ${
|
|
58
|
-
const
|
|
59
|
-
return
|
|
60
|
-
? `! ${
|
|
61
|
-
: `${
|
|
55
|
+
function linkedDebt(debts, debtId) {
|
|
56
|
+
if (debts.kind !== "present")
|
|
57
|
+
return `! ${debtId} · unavailable`;
|
|
58
|
+
const debt = debts.value.rows.find((candidate) => candidate.id === debtId);
|
|
59
|
+
return debt === undefined
|
|
60
|
+
? `! ${debtId} · unavailable`
|
|
61
|
+
: `${debtDispositionMark(debt.disposition)} ${debt.id} · ${dispositionText(debt.disposition)}`;
|
|
62
62
|
}
|
|
63
63
|
function isTerminalAkuma(life) {
|
|
64
64
|
return life === "killed" || life === "stillborn";
|
|
@@ -102,12 +102,12 @@ function payload(label, text, context) {
|
|
|
102
102
|
truncated: false,
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
function liveAlarms(row,
|
|
105
|
+
function liveAlarms(row, debts) {
|
|
106
106
|
return [
|
|
107
107
|
...mergeFacts(row),
|
|
108
|
-
...(row.holder.kind === "unavailable" ? ["
|
|
109
|
-
...(row.holder.kind === "held" &&
|
|
110
|
-
? ["
|
|
108
|
+
...(row.holder.kind === "unavailable" ? ["debt unavailable"] : []),
|
|
109
|
+
...(row.holder.kind === "held" && debts !== undefined && linkedDebt(debts, row.holder.debtId).startsWith("!")
|
|
110
|
+
? ["debt unavailable"]
|
|
111
111
|
: []),
|
|
112
112
|
...(row.issue === undefined ? [] : ["pending reconciliation"]),
|
|
113
113
|
...(row.workspaceObservation.kind === "failed" || row.workspaceObservation.kind === "unavailable"
|
|
@@ -173,7 +173,7 @@ function renderSelectedContractRow(row, facts, context, abbreviations) {
|
|
|
173
173
|
lines.push(...semanticBlock("akuma", [akuma], context));
|
|
174
174
|
if (row.worktreePath !== null)
|
|
175
175
|
lines.push(...semanticBlock("worktree", [`worktree ${row.worktreePath}`], context));
|
|
176
|
-
lines.push(...semanticBlock("alarms", liveAlarms(row, facts.
|
|
176
|
+
lines.push(...semanticBlock("alarms", liveAlarms(row, facts.debts), context));
|
|
177
177
|
return lines;
|
|
178
178
|
}
|
|
179
179
|
function renderWorldContractRow(row, facts, context, abbreviations) {
|
|
@@ -185,7 +185,7 @@ function renderWorldContractRow(row, facts, context, abbreviations) {
|
|
|
185
185
|
: [
|
|
186
186
|
progressStrip(row),
|
|
187
187
|
...(linkedAkumaSummary(row, facts.akuma) === undefined ? [] : [linkedAkumaSummary(row, facts.akuma)]),
|
|
188
|
-
...liveAlarms(row, facts.
|
|
188
|
+
...liveAlarms(row, facts.debts),
|
|
189
189
|
];
|
|
190
190
|
const statusTone = contractStatusTone(row, facts.observedAt);
|
|
191
191
|
return entityLines({
|
|
@@ -217,7 +217,7 @@ function renderContractBoard(section, facts, context, emptyRows) {
|
|
|
217
217
|
return [header, ...rendered.slice(1), ...(section.value.hasMore === true ? ["…"] : [])];
|
|
218
218
|
}
|
|
219
219
|
function renderContracts(report, context) {
|
|
220
|
-
return renderContractBoard(report.contracts, { observedAt: report.observedAt, akuma: report.akuma,
|
|
220
|
+
return renderContractBoard(report.contracts, { observedAt: report.observedAt, akuma: report.akuma, debts: report.debts }, context, []);
|
|
221
221
|
}
|
|
222
222
|
function renderSelectedContract(report, context) {
|
|
223
223
|
const section = report.contracts;
|
|
@@ -228,20 +228,20 @@ function renderSelectedContract(report, context) {
|
|
|
228
228
|
const row = section.value.rows[0];
|
|
229
229
|
return row === undefined
|
|
230
230
|
? [" keiyaku absent"]
|
|
231
|
-
: renderSelectedContractRow(row, { observedAt: report.observedAt, akuma: report.akuma,
|
|
231
|
+
: renderSelectedContractRow(row, { observedAt: report.observedAt, akuma: report.akuma, debts: report.debts }, context, contractAbbreviations(section.value));
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function debtFailureFact(failure) {
|
|
234
234
|
return failure.coordinate === undefined ? failure.message : `${failure.coordinate} · failed ${failure.message}`;
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
const section = report.
|
|
236
|
+
function renderDebts(report, context) {
|
|
237
|
+
const section = report.debts;
|
|
238
238
|
if (section.kind === "absent")
|
|
239
|
-
return ["
|
|
239
|
+
return ["DEBTS // absent"];
|
|
240
240
|
if (section.kind === "failed")
|
|
241
241
|
return [
|
|
242
|
-
"
|
|
242
|
+
"DEBTS // unavailable",
|
|
243
243
|
"",
|
|
244
|
-
tone(`! ${safeText(
|
|
244
|
+
tone(`! ${safeText(debtFailureFact(section.failure))}`, "alert", context.color),
|
|
245
245
|
];
|
|
246
246
|
const rows = section.value.rows;
|
|
247
247
|
if (rows.length === 0)
|
|
@@ -253,12 +253,12 @@ function renderTasks(report, context) {
|
|
|
253
253
|
const association = relation.length === 0 ? "" : ` · ${relation.join(" · ")}`;
|
|
254
254
|
if (context.columns > NARROW_COLUMNS) {
|
|
255
255
|
return [
|
|
256
|
-
identityLine(
|
|
256
|
+
identityLine(debtDispositionMark(row.disposition), row.id, `· ${dispositionText(row.disposition)} · P${row.priority} · ${row.title}${association}`),
|
|
257
257
|
...plumbFacts([...childFacts, ...blockerFacts], context.columns),
|
|
258
258
|
];
|
|
259
259
|
}
|
|
260
260
|
return entityLines({
|
|
261
|
-
mark:
|
|
261
|
+
mark: debtDispositionMark(row.disposition),
|
|
262
262
|
identity: row.id,
|
|
263
263
|
state: `${dispositionText(row.disposition)} · P${row.priority}`,
|
|
264
264
|
title: row.title,
|
|
@@ -267,9 +267,9 @@ function renderTasks(report, context) {
|
|
|
267
267
|
});
|
|
268
268
|
});
|
|
269
269
|
return [
|
|
270
|
-
"
|
|
270
|
+
"DEBTS // recent",
|
|
271
271
|
...renderSectionBlock({
|
|
272
|
-
name: "
|
|
272
|
+
name: "DEBTS",
|
|
273
273
|
rows: rowLines,
|
|
274
274
|
}).slice(1),
|
|
275
275
|
...(section.value.hasMore ? ["…"] : []),
|
|
@@ -278,7 +278,7 @@ function renderTasks(report, context) {
|
|
|
278
278
|
export function renderKanshiText(report, context = { columns: DEFAULT_CLI_COLUMNS, color: false }, selection = "world") {
|
|
279
279
|
if (selection === "contract")
|
|
280
280
|
return renderSelectedContract(report, context).join("\n");
|
|
281
|
-
const blocks = [renderContracts(report, context), renderAkuma(report, context),
|
|
281
|
+
const blocks = [renderContracts(report, context), renderAkuma(report, context), renderDebts(report, context)].filter((block) => block.length > 0);
|
|
282
282
|
return blocks.length === 0 ? "○ world empty" : blocks.map((block) => block.join("\n")).join("\n\n");
|
|
283
283
|
}
|
|
284
284
|
/** One category board: the section the selector asked for, and nothing it did not read. */
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { AkumaLife } from "../../akuma/heart/index.js";
|
|
2
2
|
import type { ContractRow } from "../../protocol/read/status.js";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
export type
|
|
3
|
+
import type { DebtDisposition } from "../../debt/board.js";
|
|
4
|
+
import type { DebtState } from "../../debt/document.js";
|
|
5
|
+
export type DebtMarkWord = DebtDisposition | DebtState | "missing";
|
|
6
6
|
/** Akuma life marks are one vocabulary; render surfaces consume and never re-derive them. */
|
|
7
7
|
export declare function akumaMark(life: AkumaLife | "unborn" | "stillborn"): string;
|
|
8
8
|
/** Contract board marks weigh phase, gates, and target knowledge in one fixed order. */
|
|
9
9
|
export declare function contractMark(row: ContractRow): string;
|
|
10
10
|
/** The board's derived dispositions have their own exhaustive source lock. */
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function debtDispositionMark(disposition: DebtDisposition): string;
|
|
12
12
|
/** Document states and missing references reuse the board marks where they overlap. */
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function debtMark(word: DebtMarkWord): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function unreachable(value) {
|
|
2
|
-
throw new Error(`unhandled
|
|
2
|
+
throw new Error(`unhandled Debt mark word: ${String(value)}`);
|
|
3
3
|
}
|
|
4
4
|
/** Akuma life marks are one vocabulary; render surfaces consume and never re-derive them. */
|
|
5
5
|
export function akumaMark(life) {
|
|
@@ -36,16 +36,12 @@ export function contractMark(row) {
|
|
|
36
36
|
return "⧗";
|
|
37
37
|
}
|
|
38
38
|
/** The board's derived dispositions have their own exhaustive source lock. */
|
|
39
|
-
export function
|
|
39
|
+
export function debtDispositionMark(disposition) {
|
|
40
40
|
switch (disposition) {
|
|
41
41
|
case "ready":
|
|
42
42
|
return "○";
|
|
43
43
|
case "blocked":
|
|
44
44
|
return "‖";
|
|
45
|
-
case "in_progress":
|
|
46
|
-
return "●";
|
|
47
|
-
case "on_hold":
|
|
48
|
-
return "⧗";
|
|
49
45
|
case "done":
|
|
50
46
|
return "✓";
|
|
51
47
|
case "drop":
|
|
@@ -55,7 +51,7 @@ export function taskDispositionMark(disposition) {
|
|
|
55
51
|
}
|
|
56
52
|
}
|
|
57
53
|
/** Document states and missing references reuse the board marks where they overlap. */
|
|
58
|
-
export function
|
|
54
|
+
export function debtMark(word) {
|
|
59
55
|
switch (word) {
|
|
60
56
|
case "open":
|
|
61
57
|
return "○";
|
|
@@ -63,11 +59,9 @@ export function taskMark(word) {
|
|
|
63
59
|
return "!";
|
|
64
60
|
case "ready":
|
|
65
61
|
case "blocked":
|
|
66
|
-
case "in_progress":
|
|
67
|
-
case "on_hold":
|
|
68
62
|
case "done":
|
|
69
63
|
case "drop":
|
|
70
|
-
return
|
|
64
|
+
return debtDispositionMark(word);
|
|
71
65
|
default:
|
|
72
66
|
return unreachable(word);
|
|
73
67
|
}
|
|
@@ -8,7 +8,7 @@ export function renderNukeText(result) {
|
|
|
8
8
|
`✓ nuke ${result.world}`,
|
|
9
9
|
` refs removed ${result.value.removed.refs}`,
|
|
10
10
|
` worktrees removed ${result.value.removed.worktrees}`,
|
|
11
|
-
`
|
|
11
|
+
` debt stores removed ${result.value.removed.debts}`,
|
|
12
12
|
" locks may remain · SQLite coordination files cannot be removed safely while concurrent writers may still hold them",
|
|
13
13
|
...seatClose,
|
|
14
14
|
].join("\n");
|
package/build/src/cli/runtime.js
CHANGED
|
@@ -6,7 +6,7 @@ import { encodeFailureWire, KeiyakuError } from "../library/outcome.js";
|
|
|
6
6
|
import { isParsedAkumaCommand, runAkumaCommand } from "./commands/akuma.js";
|
|
7
7
|
import { admitBindMarkdown, runContractCommand, runContractHistoryCommand } from "./commands/contract.js";
|
|
8
8
|
import { installExitCode, installHarnesses, renderInstallText, } from "./commands/install.js";
|
|
9
|
-
import {
|
|
9
|
+
import { runDebtCommand } from "./commands/debt.js";
|
|
10
10
|
import { resolveInvocationCoordinates } from "./coordinates.js";
|
|
11
11
|
import { BindDraftError } from "./draft.js";
|
|
12
12
|
import { assertExplicitRepoUse, CliUsageError, usageGuideForCommand, } from "./parse.js";
|
|
@@ -189,8 +189,8 @@ export async function runCliCommand(invocation, input = {}) {
|
|
|
189
189
|
...(invocation.workdir === undefined ? {} : { workdir: invocation.workdir }),
|
|
190
190
|
command,
|
|
191
191
|
}, environment);
|
|
192
|
-
if (command.command === "
|
|
193
|
-
return await
|
|
192
|
+
if (command.command === "debt")
|
|
193
|
+
return await runDebtCommand(command, coordinates, runtime);
|
|
194
194
|
if (isParsedAkumaCommand(command))
|
|
195
195
|
return await runAkumaCommand(command, coordinates, invocation.workdir, runtime);
|
|
196
196
|
if (command.command === "history" && "contract" in command)
|
package/build/src/cli/scan.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** One surface's option table, named the way its refusal text names the surface. */
|
|
2
2
|
export type ScanFlagKind = "boolean" | "value" | "raw-value" | "repeat";
|
|
3
3
|
export type ScanSpec<Reader extends string = string> = Readonly<{
|
|
4
|
-
/** Names this surface in refusal text: `bind`, `call`, `
|
|
4
|
+
/** Names this surface in refusal text: `bind`, `call`, `debt add`. */
|
|
5
5
|
subject: string;
|
|
6
6
|
flags: Readonly<Record<string, ScanFlagKind>>;
|
|
7
7
|
/** The reader that consumes `-` input; absent makes `-` invalid here. */
|