@astrosheep/keiyaku 4.6.33 → 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.
Files changed (118) hide show
  1. package/README.md +10 -1
  2. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +5 -2
  3. package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +2 -1
  4. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +5 -2
  5. package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +2 -1
  6. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +5 -2
  7. package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +2 -1
  8. package/build/plugins/pi/keiyaku.ts +1 -135
  9. package/build/skills/keiyaku-akuma/SKILL.md +5 -2
  10. package/build/skills/keiyaku-debt/SKILL.md +2 -1
  11. package/build/src/akuma/akuma-observe.d.ts +8 -0
  12. package/build/src/akuma/akuma-observe.js +8 -0
  13. package/build/src/akuma/akuma-owner.d.ts +1 -0
  14. package/build/src/akuma/akuma-owner.js +3 -5
  15. package/build/src/akuma/akuma-wait.d.ts +117 -2
  16. package/build/src/akuma/akuma-wait.js +53 -22
  17. package/build/src/akuma/akuma.d.ts +6 -1
  18. package/build/src/akuma/akuma.js +37 -18
  19. package/build/src/akuma/heart/facts.d.ts +1 -0
  20. package/build/src/akuma/heart/facts.js +14 -0
  21. package/build/src/akuma/heart/index.d.ts +6 -0
  22. package/build/src/akuma/heart/index.js +27 -9
  23. package/build/src/akuma/heart/rows.d.ts +1 -0
  24. package/build/src/akuma/heart/rows.js +4 -0
  25. package/build/src/akuma/lineage-cache.d.ts +7 -2
  26. package/build/src/akuma/lineage-cache.js +48 -24
  27. package/build/src/akuma/projection-read.js +4 -9
  28. package/build/src/akuma/selection-observation.d.ts +622 -0
  29. package/build/src/akuma/selection-observation.js +7 -3
  30. package/build/src/bounded-list.d.ts +8 -0
  31. package/build/src/bounded-list.js +10 -0
  32. package/build/src/cli/commands/akuma-grammar.d.ts +2 -3
  33. package/build/src/cli/commands/akuma-grammar.js +32 -39
  34. package/build/src/cli/commands/akuma.js +6 -3
  35. package/build/src/cli/commands/contract-grammar.js +32 -31
  36. package/build/src/cli/commands/contract-help.d.ts +3 -3
  37. package/build/src/cli/commands/contract-help.js +10 -8
  38. package/build/src/cli/commands/contract.d.ts +3 -3
  39. package/build/src/cli/commands/contract.js +11 -10
  40. package/build/src/cli/parse.d.ts +4 -10
  41. package/build/src/cli/parse.js +1 -1
  42. package/build/src/cli/render/akuma-activity.d.ts +9 -19
  43. package/build/src/cli/render/akuma-activity.js +83 -110
  44. package/build/src/cli/render/catalog.js +3 -2
  45. package/build/src/cli/render/contract-history.d.ts +1 -3
  46. package/build/src/cli/render/contract-history.js +68 -49
  47. package/build/src/cli/render/contract-wait.js +9 -1
  48. package/build/src/cli/render/kanshi-akuma.d.ts +4 -3
  49. package/build/src/cli/render/kanshi-akuma.js +26 -21
  50. package/build/src/cli/render/kanshi.js +34 -43
  51. package/build/src/cli/render/verbs.js +20 -17
  52. package/build/src/cli/runtime.js +9 -23
  53. package/build/src/debt/board.d.ts +2 -1
  54. package/build/src/debt/board.js +3 -3
  55. package/build/src/debt/catalog.js +2 -1
  56. package/build/src/debt/document.d.ts +1 -0
  57. package/build/src/debt/document.js +3 -0
  58. package/build/src/debt/index.d.ts +2 -1
  59. package/build/src/debt/index.js +3 -3
  60. package/build/src/debt/operations.d.ts +2 -1
  61. package/build/src/git/observe.d.ts +4 -3
  62. package/build/src/git/observe.js +8 -7
  63. package/build/src/history.d.ts +26 -0
  64. package/build/src/history.js +43 -0
  65. package/build/src/index.d.ts +4 -3
  66. package/build/src/kanshi/counts.d.ts +15 -1
  67. package/build/src/kanshi/counts.js +14 -3
  68. package/build/src/kanshi/index.d.ts +3 -3
  69. package/build/src/kanshi/index.js +2 -2
  70. package/build/src/kanshi/read.js +5 -2
  71. package/build/src/library/akumas.d.ts +5 -1
  72. package/build/src/library/akumas.js +11 -5
  73. package/build/src/library/contract-composition.js +10 -10
  74. package/build/src/library/contract-creation.js +2 -2
  75. package/build/src/library/contract-types.d.ts +215 -25
  76. package/build/src/library/contract-types.js +31 -13
  77. package/build/src/library/contract-wait.d.ts +205 -0
  78. package/build/src/library/contract-wait.js +15 -3
  79. package/build/src/library/input.d.ts +3 -3
  80. package/build/src/library/input.js +5 -5
  81. package/build/src/library/kei.js +134 -76
  82. package/build/src/library/keiyaku-attribution.d.ts +1 -1
  83. package/build/src/library/keiyaku-attribution.js +3 -1
  84. package/build/src/library/keiyaku-classify.js +5 -1
  85. package/build/src/library/keiyaku-debt.d.ts +8 -7
  86. package/build/src/library/keiyaku-identity.d.ts +4 -3
  87. package/build/src/library/keiyaku-identity.js +30 -7
  88. package/build/src/library/keiyaku-verbs.d.ts +515 -44
  89. package/build/src/library/keiyaku-verbs.js +84 -79
  90. package/build/src/library/keiyaku-wait.d.ts +570 -0
  91. package/build/src/library/keiyaku-wait.js +25 -8
  92. package/build/src/library/keiyaku.d.ts +3110 -31
  93. package/build/src/library/keiyaku.js +335 -407
  94. package/build/src/library/model-tools.d.ts +268 -70
  95. package/build/src/library/model-tools.js +110 -95
  96. package/build/src/library/selection.d.ts +6 -5
  97. package/build/src/library/selection.js +10 -3
  98. package/build/src/mcp/adapter.js +1 -1
  99. package/build/src/mcp/help.d.ts +1 -1
  100. package/build/src/mcp/help.js +4 -3
  101. package/build/src/pi/index.d.ts +2 -0
  102. package/build/src/pi/index.js +23 -7
  103. package/build/src/pi/status.d.ts +12 -0
  104. package/build/src/pi/status.js +140 -0
  105. package/build/src/protocol/operations.d.ts +2 -0
  106. package/build/src/protocol/operations.js +1 -1
  107. package/build/src/protocol/read/status.d.ts +12 -4
  108. package/build/src/protocol/read/status.js +19 -12
  109. package/build/src/runtime/proc/windows-launch.exe +0 -0
  110. package/package.json +1 -1
  111. package/plugins/paseo/plugin/index.server.ts +6 -2
  112. package/plugins/paseo/plugin/server/attach.ts +68 -48
  113. package/plugins/paseo/plugin/server/directory.ts +259 -0
  114. package/plugins/paseo/plugin/server/mirror-identity.ts +3 -32
  115. package/plugins/paseo/plugin/server/reopen.ts +52 -38
  116. package/plugins/pi/keiyaku.ts +1 -135
  117. package/skills/keiyaku-akuma/SKILL.md +5 -2
  118. package/skills/keiyaku-debt/SKILL.md +2 -1
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { akumaStatusSchema } from "./akuma.js";
3
3
  import { currentWorkSchema } from "./status-projection.js";
4
+ import { activityRowSchema } from "./projection.js";
4
5
  import { diffstatSchema } from "./heart/activity-schema.js";
5
6
  import { dispatchAssociationSchema } from "./dispatch-association.js";
6
7
  import { killEvidenceSchema } from "./heart/facts.js";
@@ -62,18 +63,21 @@ const waitOutcomeSchema = z.union([
62
63
  z.strictObject({ kind: z.literal("failed"), historyId: turnHistoryIdSchema, diagnostic: z.string() }).readonly(),
63
64
  z.strictObject({ kind: z.literal("canceled"), historyId: turnHistoryIdSchema }).readonly(),
64
65
  ]);
65
- const observedWaitItemSchema = z
66
+ export const observedAkumaWaitItemSchema = z
66
67
  .strictObject({
67
68
  kind: z.literal("observed"),
68
69
  id: akumaIdSchema,
69
70
  life: akumaStatusSchema.unwrap().shape.life,
71
+ lastActivityAt: akumaCatalogueRowSchema.unwrap().shape.lastActivityAt,
72
+ events: z.array(activityRowSchema).max(3).readonly().exactOptional(),
73
+ eventsUnavailable: z.string().exactOptional(),
70
74
  pending: z.literal(true).exactOptional(),
71
75
  outcome: waitOutcomeSchema.exactOptional(),
72
76
  strandedReason: z.literal("resume-unsupported").exactOptional(),
73
77
  })
74
78
  .readonly();
75
79
  export const akumaWaitItemSchema = z.union([
76
- observedWaitItemSchema,
80
+ observedAkumaWaitItemSchema,
77
81
  z.strictObject({ kind: z.literal("unobserved"), id: akumaIdSchema, diagnostic: z.string() }).readonly(),
78
82
  z.strictObject({ kind: z.literal("missing"), id: akumaIdSchema }).readonly(),
79
83
  ]);
@@ -86,7 +90,7 @@ function waitResultSchema(item) {
86
90
  })
87
91
  .readonly();
88
92
  }
89
- export const akumaWaitNormalResultSchema = waitResultSchema(observedWaitItemSchema);
93
+ export const akumaWaitNormalResultSchema = waitResultSchema(observedAkumaWaitItemSchema);
90
94
  export const akumaWaitResultSchema = waitResultSchema(akumaWaitItemSchema);
91
95
  export const akumaKillResultSchema = z
92
96
  .strictObject({
@@ -5,6 +5,14 @@ declare function boundedListBase<Row extends z.ZodType>(row: Row): z.ZodObject<{
5
5
  }, z.core.$strict>;
6
6
  export declare function boundedListSchema<Row extends z.ZodType>(row: Row): z.ZodReadonly<ReturnType<typeof boundedListBase<Row>>>;
7
7
  export declare function boundedListSchema<Row extends z.ZodType, Envelope extends z.ZodRawShape>(row: Row, envelope: Envelope): z.ZodReadonly<z.ZodObject<z.util.Extend<Envelope, ReturnType<typeof boundedListBase<Row>>["shape"]>, z.core.$strict>>;
8
+ /** Catalogue selection; each product owns the classification of its lifecycle. */
9
+ export declare const lifecycleSelectionSchema: z.ZodEnum<{
10
+ active: "active";
11
+ settled: "settled";
12
+ all: "all";
13
+ }>;
14
+ export type LifecycleSelection = z.output<typeof lifecycleSelectionSchema>;
15
+ export declare function lifecycleSelection(value?: unknown): LifecycleSelection;
8
16
  export declare const DEFAULT_BOUNDED_LIST_LIMIT = 50;
9
17
  export declare const MAX_BOUNDED_LIST_LIMIT = 500;
10
18
  export type BoundedList<Row> = Readonly<{
@@ -8,6 +8,16 @@ export function boundedListSchema(row, envelope) {
8
8
  ? boundedListBase(row).readonly()
9
9
  : z.strictObject(envelope).extend(boundedListBase(row).shape).readonly();
10
10
  }
11
+ /** Catalogue selection; each product owns the classification of its lifecycle. */
12
+ export const lifecycleSelectionSchema = z.enum(["active", "settled", "all"]);
13
+ export function lifecycleSelection(value = undefined) {
14
+ if (value === undefined)
15
+ return "active";
16
+ const parsed = lifecycleSelectionSchema.safeParse(value);
17
+ if (!parsed.success)
18
+ throw new KeiyakuError("invalid-input", "selection must be active, settled, or all");
19
+ return parsed.data;
20
+ }
11
21
  export const DEFAULT_BOUNDED_LIST_LIMIT = 50;
12
22
  export const MAX_BOUNDED_LIST_LIMIT = 500;
13
23
  export function boundedListLimit(value = undefined) {
@@ -82,11 +82,10 @@ declare const AKUMA_COMMAND_SPECS: {
82
82
  readonly before: "value";
83
83
  readonly since: "value";
84
84
  readonly limit: "value";
85
- readonly last: "boolean";
86
- readonly full: "boolean";
85
+ readonly answer: "boolean";
87
86
  readonly json: "boolean";
88
87
  };
89
- readonly usage: "history <aku/...|@name> [--before <index> | --since <index>] [--limit <count>]\nhistory <aku/...|@name> --id <historyId>\nhistory <aku/...|@name> --last\nhistory <kei/...> [--full] [--repo <path>]";
88
+ readonly usage: "history <kei/...|aku/...|@name> [--before <index> | --since <index>] [--limit <count>]\nhistory <kei/...|aku/...|@name> --id <historyId>\nhistory <aku/...|@name> --answer";
90
89
  readonly purpose: "Read an Akuma's answers and activity, or a Contract's history of changes and assigned work.";
91
90
  readonly details: string;
92
91
  };
@@ -2,6 +2,7 @@ import { CliUsageError, commandGuide, usageLine } from "../usage.js";
2
2
  import { scanArgs } from "../scan.js";
3
3
  import { parseDuration as decodeDuration } from "../../duration.js";
4
4
  import { parseAkumaAlias, parseAkumaGlob } from "../../identity/selector.js";
5
+ import { canonicalDecimalSchema } from "../../history.js";
5
6
  import { parseExactHistorySelector } from "../../akuma/identity.js";
6
7
  const SET_SELECTORS = '(<aku/...> | @name | <kei/...> | "aku/<name-pattern>/<hex-pattern>")...';
7
8
  const SET_DETAILS = "Globs contain * and use lowercase hex digits or * in the suffix. --repo requires at least one Contract (kei/...) selector.";
@@ -79,19 +80,18 @@ const AKUMA_COMMAND_SPECS = {
79
80
  before: "value",
80
81
  since: "value",
81
82
  limit: "value",
82
- last: "boolean",
83
- full: "boolean",
83
+ answer: "boolean",
84
84
  json: "boolean",
85
85
  },
86
- usage: "history <aku/...|@name> [--before <index> | --since <index>] [--limit <count>]\nhistory <aku/...|@name> --id <historyId>\nhistory <aku/...|@name> --last\nhistory <kei/...> [--full] [--repo <path>]",
86
+ usage: "history <kei/...|aku/...|@name> [--before <index> | --since <index>] [--limit <count>]\nhistory <kei/...|aku/...|@name> --id <historyId>\nhistory <aku/...|@name> --answer",
87
87
  purpose: "Read an Akuma's answers and activity, or a Contract's history of changes and assigned work.",
88
88
  details: [
89
- "--id reads exact retained activity by its positive decimal id, a terminal turn (turn/<number>), or a report (report/<number>).",
90
- "--before <index> pages older rows before that sequence; --since <index> pages newer rows after it.",
91
- "--limit bounds page size (default 12); without --since, the latest rows are shown.",
92
- "With --since, paging starts at the earliest newer rows.",
93
- "--last returns only the most recent answer, if one exists; it is not a history page.",
94
- "Contract history defaults to a causal skeleton; --full prints every event with complete fields.",
89
+ "--id opens one complete Contract record by its decimal address, or retained Akuma activity by a decimal address, turn/<number>, or report/<number>.",
90
+ "--before <index> pages older entries before that sequence; --since <index> pages newer entries after it.",
91
+ "--limit bounds page size (1..5000, default 12); without --since, the latest entries are shown.",
92
+ "With --since, paging starts at the earliest newer entries.",
93
+ "--answer returns the latest retained answered Turn, even after later failed or cancelled work; it is not a history page.",
94
+ "Exact reads cannot be combined with paging. --repo selects the repository for Contract history.",
95
95
  ].join("\n"),
96
96
  },
97
97
  fork: {
@@ -190,42 +190,34 @@ function parseWait(rawSelectors, flags, output, fail) {
190
190
  };
191
191
  }
192
192
  function parseHistory(selector, flags, output, fail) {
193
- if (selector.startsWith("kei/")) {
194
- if ([flags.id, flags.before, flags.since, flags.limit, flags.last].some((value) => value !== undefined)) {
195
- fail("history kei/... does not accept --id, --before, --since, --limit, or --last");
196
- }
197
- return { name: "history", input: { selector, full: flags.full === true }, output };
198
- }
199
- return parseAkumaHistory(selector, flags, output, fail);
200
- }
201
- function refuseHistoryIdConflict(flags, bounded, fail) {
202
- if (flags.id !== undefined && (flags.last === true || bounded))
203
- fail("history --id cannot be combined with --last, --before, --since, or --limit");
204
- }
205
- function parseAkumaHistory(selector, flags, output, fail) {
206
- if (flags.full === true)
207
- fail("history --full is only valid for kei/...");
208
- const bounded = flags.before !== undefined || flags.since !== undefined || flags.limit !== undefined;
193
+ const bounded = ["before", "since", "limit"].some((key) => flags[key] !== undefined);
209
194
  if (flags.before !== undefined && flags.since !== undefined)
210
195
  fail("history --before and --since are mutually exclusive");
211
- refuseHistoryIdConflict(flags, bounded, fail);
212
- if (flags.last === true && bounded)
213
- fail("history --last cannot be combined with --before, --since, or --limit");
214
- const limit = flags.limit === undefined ? undefined : positiveIndex(flags.limit, "--limit", fail);
215
- if (limit !== undefined && limit > 5_000)
196
+ if (flags.id !== undefined && (flags.answer === true || bounded))
197
+ fail("history --id cannot be combined with --answer, --before, --since, or --limit");
198
+ if (flags.answer === true && bounded)
199
+ fail("history --answer cannot be combined with --before, --since, or --limit");
200
+ if (selector.startsWith("kei/") && flags.answer === true)
201
+ fail("history --answer requires an Akuma");
202
+ const page = {};
203
+ for (const key of ["before", "since", "limit"]) {
204
+ if (flags[key] !== undefined)
205
+ page[key] = positiveIndex(flags[key], `--${key}`, fail);
206
+ }
207
+ if (page.limit !== undefined && page.limit > 5_000)
216
208
  fail("--limit must be no greater than 5000");
217
209
  const id = flags.id === undefined ? undefined : stringFlag(flags.id, "history --id requires a nonblank historyId", fail);
218
- if (id !== undefined && parseExactHistorySelector(id) === null)
219
- fail("history --id requires a positive safe decimal integer, turn/<positive safe integer> or report/<positive safe integer>");
210
+ if (id !== undefined &&
211
+ (selector.startsWith("kei/")
212
+ ? !canonicalDecimalSchema.safeParse(id).success
213
+ : parseExactHistorySelector(id) === null))
214
+ fail("history --id requires a positive safe decimal integer for a Contract; Akumas also accept turn/<positive safe integer> or report/<positive safe integer>");
220
215
  return {
221
216
  name: "history",
222
217
  input: {
223
218
  selector,
224
- ...(id === undefined ? {} : { id }),
225
- last: flags.last === true,
226
- ...(flags.before === undefined ? {} : { before: positiveIndex(flags.before, "--before", fail) }),
227
- ...(flags.since === undefined ? {} : { since: positiveIndex(flags.since, "--since", fail) }),
228
- ...(limit === undefined ? {} : { limit }),
219
+ ...(id === undefined ? (flags.answer === true ? { item: "answer" } : {}) : { item: id }),
220
+ ...page,
229
221
  },
230
222
  output,
231
223
  };
@@ -273,10 +265,11 @@ function parseTell(action, flags, subject, prompt, fail) {
273
265
  if (action === "tell")
274
266
  return { name: action, input, acquire: { prompt }, output };
275
267
  const wait = flags.wait === undefined ? undefined : stringFlag(flags.wait, "--wait requires a duration", fail);
276
- const timeoutMs = wait === undefined ? undefined : parseDuration(wait, "--wait", fail);
268
+ if (wait !== undefined)
269
+ parseDuration(wait, "--wait", fail);
277
270
  return {
278
271
  name: action,
279
- input: { ...input, ...(timeoutMs === undefined ? {} : { timeoutMs }) },
272
+ input: { ...input, ...(wait === undefined ? {} : { timeout: wait }) },
280
273
  acquire: { prompt, schema: stringFlag(flags.schema, "ask requires --schema <file>", fail) },
281
274
  output,
282
275
  };
@@ -84,14 +84,17 @@ export async function runAsk(request, runtime) {
84
84
  export async function runAkumaHistory(request, runtime) {
85
85
  const { input, output } = request;
86
86
  const result = await runtime.facet.run("history", input, { signal: runtime.signal });
87
- if (result.kind === "contract" || result.kind === "contract-missing")
87
+ if (result.kind === "contract" ||
88
+ result.kind === "contract-exact" ||
89
+ result.kind === "contract-unknown-history" ||
90
+ result.kind === "contract-missing")
88
91
  throw new Error("Akuma history returned a non-Akuma result");
89
92
  const completion = { kind: "returned", value: result };
90
93
  if (output === "json")
91
94
  writeJson(result);
92
95
  else {
93
- const raw = historyRawAnswer(result, "id" in input ? input.id : undefined) !== undefined ||
94
- ("last" in input && input.last === true && result.kind === "akuma-last");
96
+ const raw = historyRawAnswer(result, "item" in input && input.item !== "answer" ? input.item : undefined) !== undefined ||
97
+ ("item" in input && input.item === "answer" && result.kind === "akuma-answer");
95
98
  emitAnswer(renderVerb("history", input, completion, displayContext()), raw);
96
99
  }
97
100
  return classifyVerb("history", input, completion);
@@ -1,7 +1,8 @@
1
1
  import { validateAkumaName } from "../../identity/normalize.js";
2
2
  import { parseAkumaId } from "../../akuma/identity.js";
3
- import { canonicalDebtId } from "../../debt/identity.js";
4
3
  import { contractId } from "../../core/facts/types.js";
4
+ import { parseReadableAkumaAlias } from "../../identity/selector.js";
5
+ import { canonicalDebtId } from "../../debt/identity.js";
5
6
  import { CliUsageError, commandGuide } from "../usage.js";
6
7
  import { CONTRACT_COMMAND_SPECS } from "./contract-help.js";
7
8
  function optionalFlag(flags, name) {
@@ -158,11 +159,13 @@ function showSelector(parts) {
158
159
  if (parts.positionals.length > 1)
159
160
  refuse("show", "show accepts at most one selector");
160
161
  const selected = parts.positionals[0];
161
- if (selected !== undefined && ["aku/", "kei", "kei/", "kei/*"].includes(selected))
162
+ if (selected === undefined)
163
+ refuse("show", "show requires one explicit selector");
164
+ if (["aku/", "kei", "kei/", "kei/*"].includes(selected))
162
165
  refuse("show", "show cannot select a category");
163
- if (selected === "aku" || selected?.startsWith("aku/") === true)
166
+ if (selected === "aku" || selected.startsWith("aku/"))
164
167
  refuse("show", "show cannot select an Akuma");
165
- if (selected !== undefined && !selected.startsWith("@") && /[*?\[\]]/u.test(selected))
168
+ if (!selected.startsWith("@") && /[*?\[\]]/u.test(selected))
166
169
  refuse("show", `unsupported show glob: ${selected}`);
167
170
  return selected;
168
171
  }
@@ -174,18 +177,20 @@ function parseStatus(parts) {
174
177
  refuse("status", "status requires one subject; use kanshi for the World board");
175
178
  if (/[*?\[\]]/u.test(selector))
176
179
  refuse("status", `unsupported status glob: ${selector}`);
177
- if (selector.startsWith("@"))
178
- return { name: "status", input: {}, acquire: { selector }, output: parts.output };
179
180
  try {
180
- if (selector.startsWith("kei/"))
181
- return { name: "status", input: { id: contractId(selector) }, output: parts.output };
182
- if (selector.startsWith("aku/"))
183
- return { name: "status", input: { id: parseAkumaId(selector).id }, output: parts.output };
181
+ if (selector.startsWith("@"))
182
+ parseReadableAkumaAlias(selector);
183
+ else if (selector.startsWith("kei/"))
184
+ contractId(selector);
185
+ else if (selector.startsWith("aku/"))
186
+ parseAkumaId(selector);
187
+ else
188
+ refuse("status", "status requires one complete Contract or Akuma identity or @name");
184
189
  }
185
190
  catch (error) {
186
191
  refuse("status", error instanceof Error ? error.message : String(error));
187
192
  }
188
- refuse("status", "status requires one complete Contract or Akuma identity or @name");
193
+ return { name: "status", input: { selector }, output: parts.output };
189
194
  }
190
195
  function parseRegion(parts) {
191
196
  const contract = parts.positionals[0];
@@ -225,21 +230,12 @@ function parseLs(parts) {
225
230
  const limit = listLimit(parts);
226
231
  const bound = limit === undefined ? {} : { limit };
227
232
  const mine = parts.flags.mine === true;
228
- const all = parts.flags.all === true, closed = parts.flags.closed === true;
229
- if (all && closed)
230
- refuse("ls", "--all and --closed are mutually exclusive");
231
- if (selector === "debt" || selector === "debt/") {
232
- if (mine)
233
- refuse("ls", "--mine selects Akuma instances only");
234
- return {
235
- name: "ls",
236
- input: { selector, ...bound, ...(all ? { selection: "all" } : closed ? { selection: "closed" } : {}) },
237
- output: parts.output,
238
- };
239
- }
240
- if (all || closed)
241
- refuse("ls", "--all and --closed select Debts only");
242
- if (["kei", "kei/", "aku", "aku/"].includes(selector)) {
233
+ const all = parts.flags.all === true, settled = parts.flags.settled === true;
234
+ if (all && settled)
235
+ refuse("ls", "--all and --settled are mutually exclusive");
236
+ if ((all || settled) && (selector === "aku" || selector === "aku/"))
237
+ refuse("ls", "--all and --settled select Contract, Debt, or Akuma-instance lifecycles only");
238
+ if (["debt", "debt/", "kei", "kei/", "aku", "aku/"].includes(selector)) {
243
239
  if (mine)
244
240
  refuse("ls", "--mine selects Akuma instances only");
245
241
  }
@@ -247,7 +243,12 @@ function parseLs(parts) {
247
243
  validateInstanceCatalogue(selector);
248
244
  return {
249
245
  name: "ls",
250
- input: { selector, ...bound, ...(mine ? { mine: true } : {}) },
246
+ input: {
247
+ selector,
248
+ ...bound,
249
+ ...(mine ? { mine: true } : {}),
250
+ ...(all ? { lifecycle: "all" } : settled ? { lifecycle: "settled" } : {}),
251
+ },
251
252
  output: parts.output,
252
253
  };
253
254
  }
@@ -273,16 +274,16 @@ export function parseContractCommand(parts) {
273
274
  return { name: "abandon", input: { ...selected, ...(note === undefined ? {} : { note }) }, output };
274
275
  }
275
276
  case "show": {
276
- const id = showSelector(parts);
277
- if (id?.startsWith("debt/") === true) {
277
+ const selector = showSelector(parts);
278
+ if (selector.startsWith("debt/")) {
278
279
  try {
279
- canonicalDebtId(id);
280
+ canonicalDebtId(selector);
280
281
  }
281
282
  catch (error) {
282
283
  refuse("show", error instanceof Error ? error.message : String(error));
283
284
  }
284
285
  }
285
- return { name: "show", input: id === undefined ? {} : { id }, output };
286
+ return { name: "show", input: { selector }, output };
286
287
  }
287
288
  case "kanshi":
288
289
  return { name: "kanshi", input: {}, output };
@@ -105,7 +105,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
105
105
  readonly flags: {
106
106
  readonly json: "boolean";
107
107
  };
108
- readonly usage: "show [<contract>|@name] [--repo <path>]\nshow <debt/...>";
108
+ readonly usage: "show <contract|@name> [--repo <path>]\nshow <debt/...>";
109
109
  readonly purpose: "Read one Contract's guidance or one Debt and its prerequisites.";
110
110
  readonly details: string;
111
111
  };
@@ -136,10 +136,10 @@ export declare const CONTRACT_COMMAND_SPECS: {
136
136
  readonly limit: "value";
137
137
  readonly json: "boolean";
138
138
  readonly mine: "boolean";
139
- readonly closed: "boolean";
139
+ readonly settled: "boolean";
140
140
  readonly all: "boolean";
141
141
  };
142
- readonly usage: "ls debt[/] [--closed | --all] [--limit <count>]\nls kei[/] [--limit <count>]\nls aku[/] [--limit <count>]\nls aku/<name>[/] [--limit <count>]\nls \"aku/<name>/*\" [--limit <count>]\nls \"aku/*\" [--limit <count>]\nls \"aku/*/*\" [--limit <count>]\nls [aku/<name>[/] | \"aku/<name>/*\" | \"aku/*/*\"] --mine [--limit <count>]";
142
+ readonly usage: "ls debt[/] [--settled | --all] [--limit <count>]\nls kei[/] [--settled | --all] [--limit <count>]\nls aku[/] [--limit <count>]\nls aku/<name>[/] [--settled | --all] [--limit <count>]\nls \"aku/<name>/*\" [--settled | --all] [--limit <count>]\nls \"aku/*\" [--settled | --all] [--limit <count>]\nls \"aku/*/*\" [--settled | --all] [--limit <count>]\nls [aku/<name>[/] | \"aku/<name>/*\" | \"aku/*/*\"] --mine [--settled | --all] [--limit <count>]";
143
143
  readonly purpose: "List debts (ls debt), contracts (ls kei), or akumas (ls aku).";
144
144
  readonly details: string;
145
145
  };
@@ -198,11 +198,11 @@ export const CONTRACT_COMMAND_SPECS = {
198
198
  positional: "optional",
199
199
  stdin: "none",
200
200
  flags: { json: "boolean" },
201
- usage: "show [<contract>|@name] [--repo <path>]\nshow <debt/...>",
201
+ usage: "show <contract|@name> [--repo <path>]\nshow <debt/...>",
202
202
  purpose: "Read one Contract's guidance or one Debt and its prerequisites.",
203
203
  details: [
204
204
  "Accepts a complete Contract identity, exact @name short selector, or one complete Debt identity.",
205
- "Omitted selection uses the exact managed worktree's installed Contract context.",
205
+ "An explicit selector is required, including inside a Contract worktree.",
206
206
  "Akuma, category, glob, and plural selections are refused before reading.",
207
207
  "Debt reads use the invocation World and do not accept --repo.",
208
208
  "Text returns Contract guidance directly or renders the Debt owner's detail; --json serializes the same native value.",
@@ -224,7 +224,8 @@ export const CONTRACT_COMMAND_SPECS = {
224
224
  purpose: "Show one Contract or Akuma status.",
225
225
  details: [
226
226
  "Use kanshi for the selector-free World board.",
227
- "Addressed status accepts one complete identity or resolves one @name.",
227
+ "The selector accepts one complete identity or @name (Contract shorthand or World-local Akuma alias).",
228
+ "Names use the shared invocation resolver; a Contract/Akuma collision is refused. Results keep the full canonical id.",
228
229
  "Plural selectors, categories, globs and --limit are refused before reading.",
229
230
  "Akuma entries show the directory each Akuma was started in.",
230
231
  ].join("\n"),
@@ -232,16 +233,17 @@ export const CONTRACT_COMMAND_SPECS = {
232
233
  ls: {
233
234
  positional: "optional",
234
235
  stdin: "none",
235
- flags: { limit: "value", json: "boolean", mine: "boolean", closed: "boolean", all: "boolean" },
236
- usage: 'ls debt[/] [--closed | --all] [--limit <count>]\nls kei[/] [--limit <count>]\nls aku[/] [--limit <count>]\nls aku/<name>[/] [--limit <count>]\nls "aku/<name>/*" [--limit <count>]\nls "aku/*" [--limit <count>]\nls "aku/*/*" [--limit <count>]\nls [aku/<name>[/] | "aku/<name>/*" | "aku/*/*"] --mine [--limit <count>]',
236
+ flags: { limit: "value", json: "boolean", mine: "boolean", settled: "boolean", all: "boolean" },
237
+ usage: 'ls debt[/] [--settled | --all] [--limit <count>]\nls kei[/] [--settled | --all] [--limit <count>]\nls aku[/] [--limit <count>]\nls aku/<name>[/] [--settled | --all] [--limit <count>]\nls "aku/<name>/*" [--settled | --all] [--limit <count>]\nls "aku/*" [--settled | --all] [--limit <count>]\nls "aku/*/*" [--settled | --all] [--limit <count>]\nls [aku/<name>[/] | "aku/<name>/*" | "aku/*/*"] --mine [--settled | --all] [--limit <count>]',
237
238
  purpose: "List debts (ls debt), contracts (ls kei), or akumas (ls aku).",
238
239
  details: [
239
- "Debt lists open work by default; --closed selects terminal work and --all selects both.",
240
- "ls kei lists active Contracts; accepted and abandoned ones leave the list, and their record stays in history and Git.",
240
+ "Contract, Debt, and Akuma-instance lists select active work by default; --settled selects work at rest and --all selects both.",
241
+ "Contracts are active while bound; accepted and abandoned Contracts are settled. Open Debts are active; done and dropped Debts are settled.",
242
+ "Asleep, killed, and stillborn Akumas are settled; running, unborn, stranded, hung, and untidy Akumas remain active.",
241
243
  "ls aku/ lists the spawnable Akuma-name catalog; ls aku/<name> lists recent retained Akuma instances under one name.",
242
244
  'ls "aku/<name>/*" is the same roster in glob form; ls "aku/*/*" lists recent retained Akuma instances across names.',
243
245
  "--mine selects the caller identity of this process and lists that caller's direct and transitive descendants in this World.",
244
- "Caller scoping is World-local and refuses for Contract, Debt, or Akuma-name catalogues.",
246
+ "Caller scoping is World-local, composes with lifecycle selection, and refuses for Contract, Debt, or Akuma-name catalogues. Lifecycle selection also refuses for Akuma-name catalogues.",
245
247
  "Descendant rows name their immediate calling Akuma beside the row.",
246
248
  ].join("\n"),
247
249
  },
@@ -3,11 +3,11 @@ import type { PendingRequest, VerbRequest } from "../parse.js";
3
3
  import { type CliOutcome } from "../streams.js";
4
4
  /** Admit bind Markdown before coordinate resolution and retain a malformed draft. */
5
5
  export declare function admitBindMarkdown(input: Readonly<{
6
- markdown: string;
6
+ terms: string;
7
7
  processCwd?: string;
8
8
  cwd?: string;
9
9
  }>): Promise<void>;
10
10
  export declare function acquireContractRequest(request: Exclude<PendingRequest, {
11
- name: "spawn" | "tell" | "ask" | "status";
11
+ name: "spawn" | "tell" | "ask";
12
12
  }>, runtime: CliRuntime): Promise<VerbRequest>;
13
- export declare function runContractRequest(request: VerbRequest, runtime: CliRuntime, alias?: string): Promise<CliOutcome>;
13
+ export declare function runContractRequest(request: VerbRequest, runtime: CliRuntime): Promise<CliOutcome>;
@@ -15,17 +15,17 @@ function draftWarning(error) {
15
15
  }
16
16
  /** Admit bind Markdown before coordinate resolution and retain a malformed draft. */
17
17
  export async function admitBindMarkdown(input) {
18
- if (isBlankInput(input.markdown))
18
+ if (isBlankInput(input.terms))
19
19
  throw new CliUsageError("bind requires a nonblank stdin document");
20
20
  try {
21
- validateContractMarkdown(input.markdown);
21
+ validateContractMarkdown(input.terms);
22
22
  }
23
23
  catch (error) {
24
24
  if (error instanceof Error && "executionReceipt" in error)
25
25
  throw error;
26
26
  if (errorCategory(error) !== "invalid-input")
27
27
  throw error;
28
- throw new BindDraftError(error, await bindDraftReceipt(() => resolveInvocationCwd(input), input.markdown));
28
+ throw new BindDraftError(error, await bindDraftReceipt(() => resolveInvocationCwd(input), input.terms));
29
29
  }
30
30
  }
31
31
  async function bindDraftReceipt(world, markdown) {
@@ -48,10 +48,12 @@ export async function acquireContractRequest(request, runtime) {
48
48
  if (request.name === "amend" && isBlankInput(bytes))
49
49
  throw new CliUsageError("amend requires a nonblank stdin document");
50
50
  if (request.name === "bind")
51
- return { name: request.name, input: { ...request.input, markdown: bytes }, output: request.output };
52
- return { name: request.name, input: { ...request.input, markdown: bytes }, output: request.output };
51
+ return { name: request.name, input: { ...request.input, terms: bytes }, output: request.output };
52
+ if (request.name === "amend")
53
+ return { name: request.name, input: { ...request.input, edits: bytes }, output: request.output };
54
+ return { name: request.name, input: { ...request.input, body: bytes }, output: request.output };
53
55
  }
54
- async function invokeAndFinish(request, runtime, alias) {
56
+ async function invokeAndFinish(request, runtime) {
55
57
  const progressing = request.name === "deliver" || request.name === "verify" || request.name === "review";
56
58
  const driver = progressing && request.output === "text" ? await runtime.progress() : undefined;
57
59
  const cancellable = progressing ||
@@ -72,7 +74,6 @@ async function invokeAndFinish(request, runtime, alias) {
72
74
  const completion = { kind: "returned", value };
73
75
  return emit(request.output, value, () => renderVerb(request.name, request.input, completion, {
74
76
  ...displayContext(),
75
- ...(alias === undefined ? {} : { alias }),
76
77
  ...(request.name === "ls" &&
77
78
  "mine" in request.input &&
78
79
  request.input.mine === true &&
@@ -85,7 +86,7 @@ async function runBind(request, runtime) {
85
86
  const { input, output } = request;
86
87
  if ("forkOf" in input)
87
88
  return invokeAndFinish(request, runtime);
88
- const markdown = input.markdown;
89
+ const markdown = input.terms;
89
90
  try {
90
91
  const answer = await runtime.facet.run("bind", input);
91
92
  const completion = { kind: "returned", value: answer };
@@ -105,7 +106,7 @@ async function runBind(request, runtime) {
105
106
  throw new BindDraftError(error, await bindDraftReceipt(runtime.draftWorld, markdown));
106
107
  }
107
108
  }
108
- export async function runContractRequest(request, runtime, alias) {
109
+ export async function runContractRequest(request, runtime) {
109
110
  if (request.name === "bind")
110
111
  return runBind(request, runtime);
111
112
  if (request.name === "arc") {
@@ -122,5 +123,5 @@ export async function runContractRequest(request, runtime, alias) {
122
123
  }
123
124
  if (request.name === "review" && isBlankInput(request.input.summary))
124
125
  throw new CliUsageError("review requires a nonblank summary");
125
- return invokeAndFinish(request, runtime, alias);
126
+ return invokeAndFinish(request, runtime);
126
127
  }
@@ -21,23 +21,23 @@ export type VerbRequest<K extends CliVerb = CliVerb> = {
21
21
  }>;
22
22
  }[K];
23
23
  type DocumentBind = Extract<VerbInput<"bind">, {
24
- markdown: string;
24
+ terms: string;
25
25
  }>;
26
26
  type Acquisitions = {
27
27
  bind: {
28
- input: Omit<DocumentBind, "markdown">;
28
+ input: Omit<DocumentBind, "terms">;
29
29
  acquire: {
30
30
  markdown: true;
31
31
  };
32
32
  };
33
33
  amend: {
34
- input: Omit<VerbInput<"amend">, "markdown">;
34
+ input: Omit<VerbInput<"amend">, "edits">;
35
35
  acquire: {
36
36
  markdown: true;
37
37
  };
38
38
  };
39
39
  arc: {
40
- input: Omit<VerbInput<"arc">, "markdown">;
40
+ input: Omit<VerbInput<"arc">, "body">;
41
41
  acquire: {
42
42
  markdown: true;
43
43
  };
@@ -54,12 +54,6 @@ type Acquisitions = {
54
54
  prompt?: AkumaPromptSource;
55
55
  };
56
56
  };
57
- status: {
58
- input: Record<string, never>;
59
- acquire: {
60
- selector: string;
61
- };
62
- };
63
57
  tell: {
64
58
  input: Omit<VerbInput<"tell">, "prompt">;
65
59
  acquire: {
@@ -113,7 +113,7 @@ export function commandRepoPolicy(command) {
113
113
  case "region":
114
114
  return { use: "required", acceptsExplicit: true };
115
115
  case "show": {
116
- const debt = command.input.id?.startsWith("debt/") === true;
116
+ const debt = command.input.selector.startsWith("debt/");
117
117
  return { use: debt ? "none" : "required", acceptsExplicit: !debt };
118
118
  }
119
119
  case "ls":
@@ -33,8 +33,10 @@ type DisplayAssociation = Readonly<{
33
33
  /** Indent already-decided supporting lines one level, for every caller of this family. */
34
34
  export declare function subordinateLines(lines: readonly string[]): readonly string[];
35
35
  /**
36
- * Identity and its static coordinates. The execution directory and any already-exposed effective
37
- * actions belong above the content boundary; an absent coordinate is an absent line.
36
+ * The one observation identity line: complete Akuma identity, optional alias as a parenthetical
37
+ * supplement, and a known associated Contract inline behind the shared separator.
38
+ * The execution directory and any already-exposed effective actions belong above the content
39
+ * boundary; an absent coordinate is an absent line.
38
40
  */
39
41
  export declare function panelHead(id: string, alias: string | undefined, contract: DisplayAssociation | undefined, context?: readonly string[]): readonly string[];
40
42
  /**
@@ -64,12 +66,6 @@ export type ActivityStream = ((activity: RenderedActivity) => readonly string[])
64
66
  * always print.
65
67
  */
66
68
  export declare function activityStream(context: TextRenderContext): ActivityStream;
67
- export declare function inputWaitConclusion(observation: AkumaAskObservation, input: Readonly<{
68
- startedAt: number;
69
- completedAt?: string | null;
70
- now?: number;
71
- status?: LiveStatusObservation["status"];
72
- }>): readonly string[];
73
69
  /** The identity a streamed observing call's head frame renders from its resolved birth. */
74
70
  export type ObservedCallHead = Readonly<{
75
71
  id: string;
@@ -116,12 +112,10 @@ export declare function inputWaitStream(context: TextRenderContext, head: () =>
116
112
  answerSeparator?: true;
117
113
  }>): InputWaitStream;
118
114
  type SnapshotView = AkumaObservation;
119
- type SnapshotCoreOptions = Readonly<{
120
- alias?: string;
121
- facts?: readonly string[];
122
- }>;
123
115
  export declare function currentWorkLines(work: CurrentWork, context: TextRenderContext): readonly string[];
124
- export declare function snapshotText(view: SnapshotView, context: TextRenderContext, options?: SnapshotCoreOptions): string;
116
+ export declare function snapshotText(view: SnapshotView, context: TextRenderContext, options?: Readonly<{
117
+ alias?: string;
118
+ }>): string;
125
119
  export declare function killResultText(id: string, evidence: KillEvidence, alias?: string): string;
126
120
  /** Presentation-only state for one akuma invocation; it never reaches JSON. */
127
121
  type AkumaPresentation = Readonly<{
@@ -131,15 +125,11 @@ type AkumaPresentation = Readonly<{
131
125
  export declare function observationCompletedAt(observation: AkumaAskObservation): string | undefined;
132
126
  export declare function askRawAnswer(result: AkumaAskResult): string | undefined;
133
127
  export declare function historyRawAnswer(result: AkumaHistoryResult, historyId: string | undefined): string | undefined;
134
- /**
135
- * One wait's final text: one compact line per observed member, then one failure line per member
136
- * the wait could not read. A wait opens no frame and extracts no separate answer, so an answer is
137
- * visible only as the snapshot's own bounded summary.
138
- */
128
+ /** Compact final facts, actual recent events, and an exact-turn full outcome; never a live frame. */
139
129
  export declare function waitText(result: AkumaWaitResult, presentation: AkumaPresentation, context: TextRenderContext): string;
140
130
  export declare function historyText(result: AkumaHistoryResult, presentation: AkumaPresentation & Readonly<{
141
131
  id?: string;
142
- last?: boolean;
132
+ answer?: boolean;
143
133
  since?: number;
144
134
  }>, context: TextRenderContext): string;
145
135
  /** One bounded, quoted preview of a Tell an outer receipt already admitted, indented beneath it. */