@astrosheep/keiyaku 4.6.4 → 4.6.7

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 (247) hide show
  1. package/README.md +7 -0
  2. package/build/{integrations/marketplace → plugins}/.agents/plugins/marketplace.json +1 -1
  3. package/build/plugins/.claude-plugin/marketplace.json +5 -0
  4. package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/.claude-plugin/plugin.json +1 -1
  5. package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/skills/keiyaku-akuma/SKILL.md +43 -8
  6. package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/skills/keiyaku-bind/SKILL.md +7 -8
  7. package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/skills/keiyaku-workflow/SKILL.md +3 -3
  8. package/build/{integrations/marketplace/plugins/keiyaku → plugins/codex}/.codex-plugin/plugin.json +1 -1
  9. package/build/plugins/codex/skills/keiyaku/SKILL.md +44 -0
  10. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +130 -0
  11. package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +269 -0
  12. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +65 -0
  13. package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +216 -0
  14. package/build/plugins/codex/skills/keiyaku-bind/agents/openai.yaml +4 -0
  15. package/build/plugins/codex/skills/keiyaku-task/SKILL.md +104 -0
  16. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +129 -0
  17. package/build/plugins/opencode/package.json +6 -0
  18. package/build/plugins/opencode/skills/keiyaku/SKILL.md +44 -0
  19. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +130 -0
  20. package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +269 -0
  21. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +65 -0
  22. package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +216 -0
  23. package/build/plugins/opencode/skills/keiyaku-bind/agents/openai.yaml +4 -0
  24. package/build/plugins/opencode/skills/keiyaku-task/SKILL.md +104 -0
  25. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +129 -0
  26. package/build/skills/keiyaku/SKILL.md +44 -0
  27. package/build/skills/keiyaku-akuma/SKILL.md +130 -0
  28. package/build/skills/keiyaku-akuma/references/automation.md +269 -0
  29. package/build/skills/keiyaku-babysit/SKILL.md +65 -0
  30. package/build/skills/keiyaku-bind/SKILL.md +216 -0
  31. package/build/skills/keiyaku-bind/agents/openai.yaml +4 -0
  32. package/build/skills/keiyaku-task/SKILL.md +104 -0
  33. package/build/skills/keiyaku-workflow/SKILL.md +129 -0
  34. package/build/src/akuma/akuma-instance.js +7 -5
  35. package/build/src/akuma/akuma-observe.d.ts +22 -15
  36. package/build/src/akuma/akuma-observe.js +87 -16
  37. package/build/src/akuma/akuma-owner.d.ts +3 -2
  38. package/build/src/akuma/akuma-owner.js +28 -10
  39. package/build/src/akuma/akuma-selection-execution.d.ts +3 -1
  40. package/build/src/akuma/akuma-selection-execution.js +2 -1
  41. package/build/src/akuma/akuma-wait.d.ts +6 -4
  42. package/build/src/akuma/akuma-wait.js +78 -53
  43. package/build/src/akuma/akuma.d.ts +6 -4
  44. package/build/src/akuma/akuma.js +4 -0
  45. package/build/src/akuma/body.d.ts +1 -0
  46. package/build/src/akuma/body.js +12 -23
  47. package/build/src/akuma/call-initial-tell.d.ts +2 -2
  48. package/build/src/akuma/call-initial-tell.js +1 -1
  49. package/build/src/akuma/call-request.d.ts +2 -2
  50. package/build/src/akuma/heart/index.d.ts +7 -2
  51. package/build/src/akuma/heart/index.js +50 -5
  52. package/build/src/akuma/heart/tells.d.ts +33 -2
  53. package/build/src/akuma/heart/tells.js +24 -18
  54. package/build/src/akuma/heart/timeline.d.ts +23 -1
  55. package/build/src/akuma/heart/timeline.js +28 -21
  56. package/build/src/akuma/projection.d.ts +10 -10
  57. package/build/src/akuma/providers/pi/index.js +72 -39
  58. package/build/src/akuma/selection-observation.d.ts +20 -20
  59. package/build/src/akuma/selection-owner-port.d.ts +1 -1
  60. package/build/src/akuma/selection-owner-port.js +16 -5
  61. package/build/src/akuma/selection-request.d.ts +2 -0
  62. package/build/src/akuma/selection-request.js +2 -1
  63. package/build/src/akuma-body.js +5 -2
  64. package/build/src/alias/index.d.ts +0 -1
  65. package/build/src/alias/index.js +0 -4
  66. package/build/src/body/amend.d.ts +0 -4
  67. package/build/src/body/amend.js +0 -3
  68. package/build/src/body/region.d.ts +0 -1
  69. package/build/src/body/region.js +0 -3
  70. package/build/src/body/verification.d.ts +0 -1
  71. package/build/src/cli/commands/akuma-grammar.js +23 -66
  72. package/build/src/cli/commands/akuma.js +23 -42
  73. package/build/src/cli/commands/contract-grammar.d.ts +14 -1
  74. package/build/src/cli/commands/contract-grammar.js +54 -21
  75. package/build/src/cli/commands/contract-help.d.ts +9 -8
  76. package/build/src/cli/commands/contract-help.js +14 -7
  77. package/build/src/cli/commands/contract.js +57 -117
  78. package/build/src/cli/commands/install.d.ts +5 -5
  79. package/build/src/cli/commands/install.js +4 -7
  80. package/build/src/cli/commands/task-grammar.js +10 -66
  81. package/build/src/cli/commands/task.d.ts +0 -1
  82. package/build/src/cli/commands/task.js +34 -53
  83. package/build/src/cli/coordinates.d.ts +1 -2
  84. package/build/src/cli/coordinates.js +1 -4
  85. package/build/src/cli/parse.d.ts +2 -3
  86. package/build/src/cli/parse.js +24 -66
  87. package/build/src/cli/render/akuma.d.ts +3 -16
  88. package/build/src/cli/render/akuma.js +1 -13
  89. package/build/src/cli/render/audit.js +1 -1
  90. package/build/src/cli/render/contract.js +34 -32
  91. package/build/src/cli/render/kanshi-akuma.d.ts +8 -2
  92. package/build/src/cli/render/kanshi-akuma.js +14 -7
  93. package/build/src/cli/render/kanshi.d.ts +3 -1
  94. package/build/src/cli/render/kanshi.js +44 -32
  95. package/build/src/cli/render/receipt.js +6 -1
  96. package/build/src/cli/render/task.d.ts +1 -1
  97. package/build/src/cli/render/task.js +3 -27
  98. package/build/src/cli/render/terminal.d.ts +6 -2
  99. package/build/src/cli/render/terminal.js +8 -2
  100. package/build/src/cli/runtime.js +3 -16
  101. package/build/src/cli/scan.d.ts +26 -0
  102. package/build/src/cli/scan.js +82 -0
  103. package/build/src/cli/streams.d.ts +5 -0
  104. package/build/src/cli/streams.js +11 -0
  105. package/build/src/contract-worktree.js +38 -21
  106. package/build/src/core/facts/codec.d.ts +1 -2
  107. package/build/src/core/facts/codec.js +5 -11
  108. package/build/src/core/facts/types.d.ts +16 -2
  109. package/build/src/core/facts/types.js +15 -0
  110. package/build/src/core/verbs/abandon.js +3 -9
  111. package/build/src/core/verbs/amend.js +2 -9
  112. package/build/src/core/verbs/arc.js +6 -13
  113. package/build/src/core/verbs/attestation.js +2 -9
  114. package/build/src/core/verbs/bind.js +2 -9
  115. package/build/src/core/verbs/deliver.js +2 -9
  116. package/build/src/core/verbs/placement.d.ts +1 -1
  117. package/build/src/core/verbs/placement.js +2 -9
  118. package/build/src/core/verbs/reintegrate.d.ts +1 -1
  119. package/build/src/core/verbs/reintegrate.js +2 -9
  120. package/build/src/dispatch/index.d.ts +2 -2
  121. package/build/src/dispatch/index.js +33 -11
  122. package/build/src/git/hooks.d.ts +2 -4
  123. package/build/src/git/hooks.js +0 -12
  124. package/build/src/git/integration.d.ts +5 -3
  125. package/build/src/git/integration.js +36 -25
  126. package/build/src/git/nuke.js +4 -4
  127. package/build/src/git/observe.d.ts +4 -4
  128. package/build/src/git/observe.js +5 -5
  129. package/build/src/git/process.d.ts +1 -4
  130. package/build/src/git/process.js +1 -11
  131. package/build/src/git/read-observation.js +1 -1
  132. package/build/src/git/reconcile.d.ts +1 -1
  133. package/build/src/git/reconcile.js +15 -13
  134. package/build/src/git/repository.d.ts +2 -6
  135. package/build/src/git/repository.js +18 -31
  136. package/build/src/git/scratch.d.ts +6 -6
  137. package/build/src/git/scratch.js +110 -46
  138. package/build/src/git/target-placement.d.ts +5 -5
  139. package/build/src/git/target-placement.js +18 -33
  140. package/build/src/git/tender.d.ts +6 -2
  141. package/build/src/git/tender.js +19 -12
  142. package/build/src/git/terminal-reconcile.js +24 -13
  143. package/build/src/git/terminal-seal.d.ts +2 -5
  144. package/build/src/git/terminal-seal.js +5 -3
  145. package/build/src/git/workspace.d.ts +17 -13
  146. package/build/src/git/workspace.js +58 -41
  147. package/build/src/kanshi/index.d.ts +2 -2
  148. package/build/src/kanshi/index.js +1 -1
  149. package/build/src/kanshi/read.d.ts +8 -1
  150. package/build/src/kanshi/read.js +72 -7
  151. package/build/src/kanshi/report.d.ts +12 -0
  152. package/build/src/library/akuma-creation.d.ts +4 -4
  153. package/build/src/library/akuma-creation.js +21 -19
  154. package/build/src/library/bind.d.ts +1 -63
  155. package/build/src/library/bind.js +3 -9
  156. package/build/src/library/contract-creation.js +2 -30
  157. package/build/src/library/contract-execution.d.ts +0 -1
  158. package/build/src/library/contract-execution.js +9 -34
  159. package/build/src/library/contract-operations.d.ts +5 -1
  160. package/build/src/library/contract-operations.js +7 -3
  161. package/build/src/library/contract-types.d.ts +1 -1
  162. package/build/src/library/delivery.d.ts +91 -93
  163. package/build/src/library/delivery.js +2 -1
  164. package/build/src/library/input.d.ts +0 -2
  165. package/build/src/library/input.js +0 -4
  166. package/build/src/library/invocation.d.ts +0 -1
  167. package/build/src/library/invocation.js +3 -25
  168. package/build/src/library/outcome.d.ts +651 -602
  169. package/build/src/library/outcome.js +4 -4
  170. package/build/src/library/reconcile.d.ts +6 -0
  171. package/build/src/library/reconcile.js +31 -1
  172. package/build/src/library/repo.d.ts +0 -1
  173. package/build/src/library/selection.d.ts +1 -10
  174. package/build/src/library/selection.js +19 -17
  175. package/build/src/plugin/akuma-signals.d.ts +10 -11
  176. package/build/src/plugin/akuma-signals.js +36 -20
  177. package/build/src/plugin/public.d.ts +5 -0
  178. package/build/src/plugin/runtime.d.ts +1 -0
  179. package/build/src/plugin/runtime.js +34 -23
  180. package/build/src/protocol/abandon.d.ts +1 -1
  181. package/build/src/protocol/abandon.js +3 -10
  182. package/build/src/protocol/amend.js +2 -5
  183. package/build/src/protocol/arc.d.ts +1 -1
  184. package/build/src/protocol/arc.js +2 -9
  185. package/build/src/protocol/attempt.d.ts +3 -20
  186. package/build/src/protocol/attempt.js +6 -5
  187. package/build/src/protocol/audit.d.ts +1 -0
  188. package/build/src/protocol/audit.js +10 -11
  189. package/build/src/protocol/completion.d.ts +129 -55
  190. package/build/src/protocol/completion.js +62 -73
  191. package/build/src/protocol/deliver.d.ts +7 -5
  192. package/build/src/protocol/deliver.js +74 -44
  193. package/build/src/protocol/execution-observation.d.ts +2 -4
  194. package/build/src/protocol/execution-observation.js +3 -7
  195. package/build/src/protocol/intent.d.ts +1 -1
  196. package/build/src/protocol/intent.js +1 -0
  197. package/build/src/protocol/operations.d.ts +24 -12
  198. package/build/src/protocol/operations.js +36 -15
  199. package/build/src/protocol/placement.d.ts +2 -1
  200. package/build/src/protocol/placement.js +21 -5
  201. package/build/src/protocol/progress.d.ts +1 -1
  202. package/build/src/protocol/read/status.js +58 -41
  203. package/build/src/protocol/reintegrate.d.ts +1 -1
  204. package/build/src/protocol/reintegrate.js +10 -19
  205. package/build/src/protocol/review.d.ts +3 -28
  206. package/build/src/protocol/review.js +10 -37
  207. package/build/src/protocol/run.d.ts +19 -7
  208. package/build/src/protocol/run.js +19 -9
  209. package/build/src/runtime/proc/windows-launch.exe +0 -0
  210. package/build/src/settlement/holder.d.ts +2 -4
  211. package/build/src/settlement/holder.js +3 -6
  212. package/build/src/task/board.d.ts +6 -0
  213. package/build/src/task/board.js +30 -1
  214. package/build/src/task/catalog.js +1 -4
  215. package/build/src/task/compose.d.ts +0 -1
  216. package/build/src/task/compose.js +0 -1
  217. package/build/src/task/context.d.ts +0 -1
  218. package/build/src/task/context.js +0 -3
  219. package/build/src/task/created-observation.d.ts +5 -1
  220. package/build/src/task/created-observation.js +12 -5
  221. package/build/src/task/index.d.ts +1 -1
  222. package/build/src/task/index.js +7 -6
  223. package/build/src/task/input.d.ts +0 -6
  224. package/build/src/task/input.js +2 -14
  225. package/build/src/task/mutation.d.ts +3 -4
  226. package/build/src/task/mutation.js +11 -39
  227. package/build/src/task/operations.d.ts +2 -7
  228. package/build/src/task/operations.js +37 -49
  229. package/build/src/task/query.d.ts +0 -1
  230. package/build/src/task/query.js +1 -4
  231. package/build/src/task/store.d.ts +0 -2
  232. package/build/src/task/store.js +27 -11
  233. package/build/src/verification/declaration.js +3 -2
  234. package/build/src/verification/execution.d.ts +3 -2
  235. package/build/src/verification/execution.js +10 -6
  236. package/build/src/workspace-place.d.ts +0 -1
  237. package/build/src/workspace-place.js +0 -11
  238. package/package.json +13 -9
  239. package/build/integrations/marketplace/.claude-plugin/marketplace.json +0 -5
  240. package/build/integrations/marketplace/plugins/keiyaku/package.json +0 -17
  241. /package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/skills/keiyaku/SKILL.md +0 -0
  242. /package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/skills/keiyaku-akuma/references/automation.md +0 -0
  243. /package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/skills/keiyaku-babysit/SKILL.md +0 -0
  244. /package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/skills/keiyaku-bind/agents/openai.yaml +0 -0
  245. /package/build/{integrations/marketplace/plugins/keiyaku → plugins/claude}/skills/keiyaku-task/SKILL.md +0 -0
  246. /package/build/{integrations/marketplace/plugins/keiyaku/opencode.js → plugins/opencode/index.js} +0 -0
  247. /package/build/{integrations → plugins}/pi/keiyaku.ts +0 -0
@@ -2,7 +2,7 @@ import { CliUsageError, isBlankInput } from "../usage.js";
2
2
  import { readFile } from "node:fs/promises";
3
3
  import { resolve } from "node:path";
4
4
  import { squareAssignedParticipantName } from "@astrosheep/square";
5
- import { emitInitiatingPluginSignal } from "../../plugin/akuma-signals.js";
5
+ import { emitPluginSignal } from "../../plugin/akuma-signals.js";
6
6
  import { canonicalBirthCwd } from "../../akuma/call-input.js";
7
7
  import { Schema } from "../../akuma/index.js";
8
8
  import { executionChannel } from "../../akuma/requests.js";
@@ -12,10 +12,10 @@ import { akumasWithExecution } from "../../library/akumas.js";
12
12
  import { World } from "../../world.js";
13
13
  import { contractFromInput } from "../selectors.js";
14
14
  import { ActivityDriver } from "../activity.js";
15
- import { displayContext, resultContext, writeJson, writeStderr, writeStdout } from "../streams.js";
15
+ import { displayContext, emit, resultContext, writeJson, writeStderr, writeStdout } from "../streams.js";
16
16
  import { callObservationStream, inputWaitStream, waitObservationStream, } from "../render/akuma-activity.js";
17
- import { askRawAnswer, callRawAnswer, historyRawAnswer, waitRawAnswer } from "../render/akuma-activity.js";
18
- import { askExitCode, askProgressStream, callExitCode, callObservationHead, forkExitCode, historyExitCode, killExitCode, renderCallText, renderForkText, renderHistoryText, renderKillText, renderTellText, renderWaitText, tellExitCode, waitedTellProgress, } from "../render/akuma.js";
17
+ import { askRawAnswer, callRawAnswer, historyRawAnswer, historyText, tellText, waitRawAnswer, waitText, } from "../render/akuma-activity.js";
18
+ import { askExitCode, askProgressStream, callExitCode, callObservationHead, forkExitCode, historyExitCode, killExitCode, renderCallText, renderForkText, renderKillText, tellExitCode, waitedTellProgress, } from "../render/akuma.js";
19
19
  export { isParsedAkumaCommand, renderAkumaHelp } from "./akuma-grammar.js";
20
20
  // ---------------------------------------------------------------------------
21
21
  // Leaf dispatch: acquisition, one public SDK invocation, direct rendering
@@ -73,20 +73,14 @@ async function inputInitiator(input) {
73
73
  // The initiator still travels with the request either way.
74
74
  if (!(await World.established(input.path)))
75
75
  return { initiator };
76
- try {
77
- await emitInitiatingPluginSignal({
78
- world: input.path,
79
- ...(input.settings === undefined ? {} : { settings: input.settings }),
80
- initiator,
81
- reportDiagnostic: (message) => writeStderr(message),
82
- });
83
- }
84
- catch (error) {
85
- writeStderr(`! plugin initiation: ${error instanceof Error ? error.message : String(error)}`);
86
- }
76
+ await emitPluginSignal({
77
+ world: input.path,
78
+ ...(input.settings === undefined ? {} : { settings: input.settings }),
79
+ reportDiagnostic: (message) => writeStderr(message),
80
+ }, { kind: "akuma.initiating", initiator });
87
81
  return { initiator };
88
82
  }
89
- function emitResult(body, exact) {
83
+ function emitAnswer(body, exact) {
90
84
  if (exact)
91
85
  process.stdout.write(body);
92
86
  else
@@ -152,9 +146,9 @@ async function runCall(command, input) {
152
146
  }
153
147
  const raw = callRawAnswer(result, streamed);
154
148
  if (raw === undefined)
155
- emitResult(renderCallText(result, streamed, displayContext()), false);
149
+ emitAnswer(renderCallText(result, streamed, displayContext()), false);
156
150
  else
157
- emitResult(raw, true);
151
+ emitAnswer(raw, true);
158
152
  return callExitCode(result);
159
153
  }
160
154
  finally {
@@ -195,9 +189,9 @@ async function runWait(command, input) {
195
189
  }
196
190
  const raw = waitRawAnswer(result, streamed);
197
191
  if (raw === undefined)
198
- emitResult(renderWaitText(result, presentation, displayContext()), false);
192
+ emitAnswer(waitText(result, presentation, displayContext()), false);
199
193
  else
200
- emitResult(raw, true);
194
+ emitAnswer(raw, true);
201
195
  return 0;
202
196
  }
203
197
  finally {
@@ -214,12 +208,8 @@ async function runTell(command, input) {
214
208
  ...(input.repo === undefined ? {} : { repo: input.repo }),
215
209
  ...(input.signal === undefined ? {} : { signal: input.signal }),
216
210
  });
217
- if (command.output === "json") {
218
- writeJson(result);
219
- return tellExitCode(result);
220
- }
221
- emitResult(renderTellText(result, inputAlias(command.akuma), displayContext()), false);
222
- return tellExitCode(result);
211
+ const text = () => tellText(result, inputAlias(command.akuma), displayContext());
212
+ return emit(command.output, result, text, tellExitCode(result));
223
213
  }
224
214
  async function runAsk(command, input) {
225
215
  const body = await promptBody("ask", command, input);
@@ -261,7 +251,7 @@ async function runAsk(command, input) {
261
251
  writeJson(result);
262
252
  return askExitCode(result);
263
253
  }
264
- emitResult(askRawAnswer(result, schema !== undefined) ?? "", true);
254
+ emitAnswer(askRawAnswer(result, schema !== undefined) ?? "", true);
265
255
  return askExitCode(result);
266
256
  }
267
257
  finally {
@@ -289,11 +279,11 @@ async function runHistory(command, input) {
289
279
  last: command.last,
290
280
  };
291
281
  if (raw !== undefined)
292
- emitResult(raw, true);
282
+ emitAnswer(raw, true);
293
283
  else if (command.last && result.kind === "last")
294
- emitResult(result.answer, true);
284
+ emitAnswer(result.answer, true);
295
285
  else
296
- emitResult(renderHistoryText(result, presentation, displayContext()), false);
286
+ emitAnswer(historyText(result, presentation, displayContext()), false);
297
287
  return historyExitCode(result, command.id);
298
288
  }
299
289
  async function runFork(command, input) {
@@ -302,12 +292,7 @@ async function runFork(command, input) {
302
292
  at: command.at,
303
293
  ...(input.repo === undefined ? {} : { repo: input.repo }),
304
294
  });
305
- if (command.output === "json") {
306
- writeJson(receipt);
307
- return forkExitCode(receipt);
308
- }
309
- emitResult(renderForkText(receipt), false);
310
- return forkExitCode(receipt);
295
+ return emit(command.output, receipt, () => renderForkText(receipt), forkExitCode(receipt));
311
296
  }
312
297
  async function runKill(command, input) {
313
298
  const alias = command.akuma.length === 1 ? inputAlias(command.akuma[0]) : undefined;
@@ -316,12 +301,8 @@ async function runKill(command, input) {
316
301
  ...(input.repo === undefined ? {} : { repo: input.repo }),
317
302
  ...(input.signal === undefined ? {} : { signal: input.signal }),
318
303
  });
319
- if (command.output === "json") {
320
- writeJson(result);
321
- return killExitCode(result);
322
- }
323
- emitResult(renderKillText(result, alias, displayContext()), false);
324
- return killExitCode(result);
304
+ const text = () => renderKillText(result, alias, displayContext());
305
+ return emit(command.output, result, text, killExitCode(result));
325
306
  }
326
307
  async function akumaWorld(command, coordinates) {
327
308
  const world = command.command === "call"
@@ -44,7 +44,7 @@ export type ParsedDeliver = Output & Readonly<{
44
44
  materializeConflict: boolean;
45
45
  overwrite: boolean;
46
46
  }>;
47
- export type ParsedReview = Output & Readonly<{
47
+ export type ParsedReview = Output & Actor & Readonly<{
48
48
  command: "review";
49
49
  contract?: string;
50
50
  verdict: "satisfied" | "unsatisfied";
@@ -66,11 +66,23 @@ export type ParsedStatus = Output & (Readonly<{
66
66
  selectors?: readonly string[];
67
67
  akuma?: never;
68
68
  guidance?: true;
69
+ category?: never;
70
+ limit?: never;
69
71
  }> | Readonly<{
70
72
  command: "status";
71
73
  contract: string;
72
74
  akuma: true;
73
75
  guidance?: never;
76
+ category?: never;
77
+ limit?: never;
78
+ }> | Readonly<{
79
+ command: "status";
80
+ category: StatusCategory;
81
+ limit?: number;
82
+ contract?: never;
83
+ selectors?: never;
84
+ akuma?: never;
85
+ guidance?: never;
74
86
  }>);
75
87
  export type ParsedLs = Output & Readonly<{
76
88
  command: "ls";
@@ -108,5 +120,6 @@ export type ParsedContractParts = Readonly<{
108
120
  actor?: string;
109
121
  }>;
110
122
  export type ParsedContractCommand = ParsedBind | ParsedAmend | ParsedDeliver | ParsedReview | ParsedArc | ParsedAbandon | ParsedStatus | ParsedLs | ParsedAudit | ParsedReconcile | ParsedNuke | ParsedSettings | ParsedRegion;
123
+ export type StatusCategory = "akuma" | "contract";
111
124
  export declare function parseContractCommand(parts: ParsedContractParts): ParsedContractCommand;
112
125
  export {};
@@ -123,32 +123,65 @@ function parseReview(parts) {
123
123
  verdict: parts.flags.satisfied === true ? "satisfied" : "unsatisfied",
124
124
  ...(summary === undefined ? {} : { summary }),
125
125
  ...(parts.stdin ? { summaryFromStdin: true } : {}),
126
+ ...(parts.actor === undefined ? {} : { actor: parts.actor }),
126
127
  output: parts.output,
127
128
  };
128
129
  }
129
- function parseStatus(parts) {
130
- const guidance = parts.flags.guidance === true;
131
- if (guidance) {
132
- const selected = parts.positionals[0];
133
- if (parts.positionals.length > 1)
134
- refuse("status", "--guidance accepts at most one Contract selector");
135
- if (selected?.startsWith("aku/") === true)
136
- refuse("status", "--guidance cannot select an Akuma");
137
- return {
138
- command: "status",
139
- ...(selected === undefined ? {} : { contract: selected }),
140
- guidance: true,
141
- output: parts.output,
142
- };
130
+ // Only these fixed category forms are status selectors.
131
+ const STATUS_CATEGORY_SELECTORS = new Map([
132
+ ["aku", "akuma"],
133
+ ["aku/", "akuma"],
134
+ ["aku/*", "akuma"],
135
+ ["kei", "contract"],
136
+ ["kei/", "contract"],
137
+ ["kei/*", "contract"],
138
+ ]);
139
+ function rejectStatusGlobs(positionals) {
140
+ for (const selector of positionals) {
141
+ if (!STATUS_CATEGORY_SELECTORS.has(selector) && !selector.startsWith("@") && /[*?\[\]]/u.test(selector))
142
+ refuse("status", `unsupported status glob: ${selector}`);
143
143
  }
144
+ }
145
+ function parseStatusGuidance(parts, limit) {
146
+ if (limit !== undefined)
147
+ refuse("status", "--limit is not valid with --guidance");
148
+ const selected = parts.positionals[0];
149
+ if (selected !== undefined && STATUS_CATEGORY_SELECTORS.has(selected))
150
+ refuse("status", "--guidance cannot select a category");
151
+ if (parts.positionals.length > 1)
152
+ refuse("status", "--guidance accepts at most one Contract selector");
153
+ if (selected?.startsWith("aku/") === true)
154
+ refuse("status", "--guidance cannot select an Akuma");
155
+ if (selected !== undefined && !selected.startsWith("@") && /[*?\[\]]/u.test(selected))
156
+ refuse("status", `unsupported status glob: ${selected}`);
157
+ return {
158
+ command: "status",
159
+ ...(selected === undefined ? {} : { contract: selected }),
160
+ guidance: true,
161
+ output: parts.output,
162
+ };
163
+ }
164
+ function parseStatus(parts) {
165
+ const limit = listLimit(parts, "status");
166
+ if (parts.flags.guidance === true)
167
+ return parseStatusGuidance(parts, limit);
168
+ rejectStatusGlobs(parts.positionals);
144
169
  if (parts.positionals.length > 1) {
170
+ if (limit !== undefined)
171
+ refuse("status", "--limit is valid only for one category selector");
172
+ if (parts.positionals.some((selector) => STATUS_CATEGORY_SELECTORS.has(selector)))
173
+ refuse("status", "a category selector cannot combine with other selectors");
145
174
  return { command: "status", selectors: parts.positionals, output: parts.output };
146
175
  }
147
- const contract = parts.positionals[0];
148
- if (contract?.startsWith("aku/") === true) {
149
- return { command: "status", contract, akuma: true, output: parts.output };
150
- }
151
- return { command: "status", ...(contract === undefined ? {} : { contract }), output: parts.output };
176
+ const selected = parts.positionals[0];
177
+ const category = selected === undefined ? undefined : STATUS_CATEGORY_SELECTORS.get(selected);
178
+ if (category !== undefined)
179
+ return { command: "status", category, ...(limit === undefined ? {} : { limit }), output: parts.output };
180
+ if (limit !== undefined)
181
+ refuse("status", "--limit is valid only for a category selector");
182
+ if (selected?.startsWith("aku/") === true)
183
+ return { command: "status", contract: selected, akuma: true, output: parts.output };
184
+ return { command: "status", ...(selected === undefined ? {} : { contract: selected }), output: parts.output };
152
185
  }
153
186
  function parseRegion(parts) {
154
187
  const contract = parts.positionals[0];
@@ -172,10 +205,10 @@ function akumaCatalogQuery(query, parts) {
172
205
  ...(limit === undefined ? {} : { limit: Number(limit) }),
173
206
  };
174
207
  }
175
- function listLimit(parts) {
208
+ function listLimit(parts, command = "ls") {
176
209
  const limit = optionalFlag(parts.flags, "limit");
177
210
  if (limit !== undefined && (!/^[1-9][0-9]*$/u.test(limit) || !Number.isSafeInteger(Number(limit))))
178
- refuse("ls", "--limit requires a positive safe integer");
211
+ refuse(command, "--limit requires a positive safe integer");
179
212
  return limit === undefined ? undefined : Number(limit);
180
213
  }
181
214
  function taskCatalogQuery(path, limit) {
@@ -1,8 +1,8 @@
1
- type ContractFlagKind = "boolean" | "value" | "raw-value" | "repeat-value";
1
+ import type { ScanFlagKind } from "../scan.js";
2
2
  export type ContractCommandSpec = Readonly<{
3
3
  positional: "none" | "optional";
4
4
  stdin: "none" | "optional" | "required";
5
- flags: Readonly<Record<string, ContractFlagKind>>;
5
+ flags: Readonly<Record<string, ScanFlagKind>>;
6
6
  usage: string;
7
7
  purpose: string;
8
8
  details?: string;
@@ -15,7 +15,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
15
15
  readonly actor: "value";
16
16
  readonly task: "value";
17
17
  readonly target: "value";
18
- readonly after: "repeat-value";
18
+ readonly after: "repeat";
19
19
  readonly gates: "raw-value";
20
20
  readonly "fork-of": "value";
21
21
  readonly json: "boolean";
@@ -29,7 +29,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
29
29
  readonly stdin: "optional";
30
30
  readonly flags: {
31
31
  readonly actor: "value";
32
- readonly after: "repeat-value";
32
+ readonly after: "repeat";
33
33
  readonly "clear-after": "boolean";
34
34
  readonly gates: "raw-value";
35
35
  readonly json: "boolean";
@@ -56,12 +56,13 @@ export declare const CONTRACT_COMMAND_SPECS: {
56
56
  readonly positional: "optional";
57
57
  readonly stdin: "optional";
58
58
  readonly flags: {
59
+ readonly actor: "value";
59
60
  readonly satisfied: "boolean";
60
61
  readonly unsatisfied: "boolean";
61
62
  readonly summary: "value";
62
63
  readonly json: "boolean";
63
64
  };
64
- readonly usage: "review [<contract>|@<contract>] (--satisfied | --unsatisfied) (--summary <text> | -)";
65
+ readonly usage: "review [<contract>|@<contract>] (--satisfied | --unsatisfied) (--summary <text> | -) [--actor <actor>]";
65
66
  readonly purpose: "Record whether a Contract meets its acceptance criteria.";
66
67
  readonly details: string;
67
68
  };
@@ -92,9 +93,10 @@ export declare const CONTRACT_COMMAND_SPECS: {
92
93
  readonly stdin: "none";
93
94
  readonly flags: {
94
95
  readonly guidance: "boolean";
96
+ readonly limit: "value";
95
97
  readonly json: "boolean";
96
98
  };
97
- readonly usage: "status [<contract>|@name|<aku/...>]...\nstatus --guidance [<contract>|@<contract>]";
99
+ readonly usage: "status [<contract>|@name|<aku/...>]...\nstatus (aku|aku/|aku/*) [--limit <count>]\nstatus (kei|kei/|kei/*) [--limit <count>]\nstatus --guidance [<contract>|@<contract>]";
98
100
  readonly purpose: "Show the world overview or selected Contract and Akuma status.";
99
101
  readonly details: string;
100
102
  };
@@ -156,7 +158,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
156
158
  readonly positional: "optional";
157
159
  readonly stdin: "none";
158
160
  readonly flags: {
159
- readonly path: "repeat-value";
161
+ readonly path: "repeat";
160
162
  readonly json: "boolean";
161
163
  };
162
164
  readonly usage: "region [<contract>]\nregion --path <pattern> [--path <pattern> ...]";
@@ -166,4 +168,3 @@ export declare const CONTRACT_COMMAND_SPECS: {
166
168
  };
167
169
  export type ContractCommand = keyof typeof CONTRACT_COMMAND_SPECS;
168
170
  export declare function renderContractHelp(command: ContractCommand): string;
169
- export {};
@@ -7,7 +7,7 @@ export const CONTRACT_COMMAND_SPECS = {
7
7
  actor: "value",
8
8
  task: "value",
9
9
  target: "value",
10
- after: "repeat-value",
10
+ after: "repeat",
11
11
  gates: "raw-value",
12
12
  "fork-of": "value",
13
13
  json: "boolean",
@@ -47,6 +47,7 @@ export const CONTRACT_COMMAND_SPECS = {
47
47
  "A pattern containing whitespace binds with a warning. A fence carries no",
48
48
  "info string or exactly 'txt'.",
49
49
  "",
50
+ "Verification runs only with the verified gate; without it the section is inert text.",
50
51
  "Verification uses one or more closed bash, zsh, or pwsh fences. Its fence",
51
52
  "may add timeout=<integer><ms|s|m|h>; the section contains no other prose.",
52
53
  "Unknown ## sections are retained as extensions; reserved section names are refused.",
@@ -55,7 +56,7 @@ export const CONTRACT_COMMAND_SPECS = {
55
56
  amend: {
56
57
  positional: "optional",
57
58
  stdin: "optional",
58
- flags: { actor: "value", after: "repeat-value", "clear-after": "boolean", gates: "raw-value", json: "boolean" },
59
+ flags: { actor: "value", after: "repeat", "clear-after": "boolean", gates: "raw-value", json: "boolean" },
59
60
  usage: "amend [<contract>|@<contract>] [--after <kei/...> ... | --clear-after] [--gates <name,...>] [--actor <actor>] [-]",
60
61
  purpose: "Change a Contract's document, prerequisites, or acceptance gates.",
61
62
  details: [
@@ -91,6 +92,7 @@ export const CONTRACT_COMMAND_SPECS = {
91
92
  purpose: "Submit work for a Contract and integrate it when its requirements are met.",
92
93
  details: [
93
94
  "The Contract, not the current Arc, sets what delivery must satisfy. An Arc records progress; it does not narrow acceptance.",
95
+ "With the verified gate, delivery runs Verification or reuses current satisfied evidence.",
94
96
  "Verification, integration, and cleanup progress appears on stderr; stdout contains one final result.",
95
97
  "By default, delivery uses HEAD. --include-dirty includes all non-ignored worktree changes, staged or not; it leaves your branch and index unchanged, so staging or committing is unnecessary.",
96
98
  "Repeating delivery with unchanged work resumes unfinished verification or integration. Changed work replaces the candidate.",
@@ -107,8 +109,8 @@ export const CONTRACT_COMMAND_SPECS = {
107
109
  review: {
108
110
  positional: "optional",
109
111
  stdin: "optional",
110
- flags: { satisfied: "boolean", unsatisfied: "boolean", summary: "value", json: "boolean" },
111
- usage: "review [<contract>|@<contract>] (--satisfied | --unsatisfied) (--summary <text> | -)",
112
+ flags: { actor: "value", satisfied: "boolean", unsatisfied: "boolean", summary: "value", json: "boolean" },
113
+ usage: "review [<contract>|@<contract>] (--satisfied | --unsatisfied) (--summary <text> | -) [--actor <actor>]",
112
114
  purpose: "Record whether a Contract meets its acceptance criteria.",
113
115
  details: [
114
116
  "A review checks the whole Contract, not just one Arc. After delivery it checks the candidate; before delivery it checks the current Contract and worktree, but cannot integrate.",
@@ -141,12 +143,16 @@ export const CONTRACT_COMMAND_SPECS = {
141
143
  status: {
142
144
  positional: "optional",
143
145
  stdin: "none",
144
- flags: { guidance: "boolean", json: "boolean" },
145
- usage: "status [<contract>|@name|<aku/...>]...\nstatus --guidance [<contract>|@<contract>]",
146
+ flags: { guidance: "boolean", limit: "value", json: "boolean" },
147
+ usage: "status [<contract>|@name|<aku/...>]...\nstatus (aku|aku/|aku/*) [--limit <count>]\nstatus (kei|kei/|kei/*) [--limit <count>]\nstatus --guidance [<contract>|@<contract>]",
146
148
  purpose: "Show the world overview or selected Contract and Akuma status.",
147
149
  details: [
148
150
  "Akuma entries show the directory each Akuma was started in.",
149
151
  "",
152
+ "aku, aku/, and aku/* show the recent Akuma board; kei, kei/, and kei/* show the",
153
+ "recent active Contract board. --limit bounds the board to that many recent rows",
154
+ "(default 10). The Contract category requires a Repo; the Akuma category does not.",
155
+ "",
150
156
  "--guidance reads one Contract's guidance instead of status. It accepts one Contract",
151
157
  "selector or the installed Contract selection context, and refuses an Akuma, plural,",
152
158
  "or world selection before the read.",
@@ -173,6 +179,7 @@ export const CONTRACT_COMMAND_SPECS = {
173
179
  details: [
174
180
  "--include-dirty checks all non-ignored worktree changes, staged or not.",
175
181
  "--show-diff includes the proposed candidate diff when one can be prepared.",
182
+ "Verification runs only with the verified gate; without it the section is inert text.",
176
183
  "Content identity names the change's content hash, never a commit; it survives rebase and Git cannot look it up.",
177
184
  "Progress appears on stderr; stdout contains one final result.",
178
185
  ].join("\n"),
@@ -203,7 +210,7 @@ export const CONTRACT_COMMAND_SPECS = {
203
210
  region: {
204
211
  positional: "optional",
205
212
  stdin: "none",
206
- flags: { path: "repeat-value", json: "boolean" },
213
+ flags: { path: "repeat", json: "boolean" },
207
214
  usage: "region [<contract>]\nregion --path <pattern> [--path <pattern> ...]",
208
215
  purpose: "Show declared Contract write patterns — all, one Contract's, or those overlapping given paths.",
209
216
  details: "Check overlap before starting parallel work.",