@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.
Files changed (253) hide show
  1. package/README.md +40 -14
  2. package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
  3. package/build/plugins/claude/skills/keiyaku/SKILL.md +5 -6
  4. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +1 -1
  5. package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +8 -8
  6. package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +1 -1
  7. package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +9 -9
  8. package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +91 -0
  9. package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +2 -2
  10. package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
  11. package/build/plugins/codex/skills/keiyaku/SKILL.md +5 -6
  12. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +1 -1
  13. package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +8 -8
  14. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +1 -1
  15. package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +9 -9
  16. package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +91 -0
  17. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +2 -2
  18. package/build/plugins/opencode/index.js +1 -1
  19. package/build/plugins/opencode/skills/keiyaku/SKILL.md +5 -6
  20. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +1 -1
  21. package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +8 -8
  22. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +1 -1
  23. package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +9 -9
  24. package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +91 -0
  25. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +2 -2
  26. package/build/skills/keiyaku/SKILL.md +5 -6
  27. package/build/skills/keiyaku-akuma/SKILL.md +1 -1
  28. package/build/skills/keiyaku-akuma/references/automation.md +8 -8
  29. package/build/skills/keiyaku-babysit/SKILL.md +1 -1
  30. package/build/skills/keiyaku-bind/SKILL.md +9 -9
  31. package/build/skills/keiyaku-debt/SKILL.md +91 -0
  32. package/build/skills/keiyaku-workflow/SKILL.md +2 -2
  33. package/build/src/akuma/akuma-instance.d.ts +2 -0
  34. package/build/src/akuma/akuma-instance.js +10 -0
  35. package/build/src/akuma/akuma-observe.d.ts +33 -8
  36. package/build/src/akuma/akuma-observe.js +88 -64
  37. package/build/src/akuma/akuma-owner.d.ts +11 -2
  38. package/build/src/akuma/akuma-owner.js +45 -35
  39. package/build/src/akuma/akuma-selection-execution.js +9 -1
  40. package/build/src/akuma/akuma-stream.d.ts +22 -0
  41. package/build/src/akuma/akuma-stream.js +116 -0
  42. package/build/src/akuma/akuma-wait.d.ts +1 -40
  43. package/build/src/akuma/akuma-wait.js +23 -84
  44. package/build/src/akuma/akuma.d.ts +17 -11
  45. package/build/src/akuma/akuma.js +2 -0
  46. package/build/src/akuma/allowed.d.ts +7 -12
  47. package/build/src/akuma/allowed.js +13 -4
  48. package/build/src/akuma/body-supervisor.d.ts +5 -5
  49. package/build/src/akuma/body-supervisor.js +22 -20
  50. package/build/src/akuma/body.js +28 -1
  51. package/build/src/akuma/call-request.d.ts +12 -22
  52. package/build/src/akuma/heart/activity-schema.d.ts +12 -0
  53. package/build/src/akuma/heart/activity-schema.js +6 -0
  54. package/build/src/akuma/heart/index.d.ts +59 -2
  55. package/build/src/akuma/heart/index.js +87 -8
  56. package/build/src/akuma/heart/rows.js +5 -3
  57. package/build/src/akuma/heart/soul.d.ts +9 -0
  58. package/build/src/akuma/heart/soul.js +29 -0
  59. package/build/src/akuma/heart/storage.d.ts +15 -0
  60. package/build/src/akuma/heart/storage.js +55 -0
  61. package/build/src/akuma/heart/timeline.d.ts +7 -0
  62. package/build/src/akuma/heart/timeline.js +10 -0
  63. package/build/src/akuma/index.d.ts +1 -0
  64. package/build/src/akuma/projection.d.ts +25 -0
  65. package/build/src/akuma/projection.js +24 -7
  66. package/build/src/akuma/provider-recipe.d.ts +11 -0
  67. package/build/src/akuma/provider-recipe.js +23 -0
  68. package/build/src/akuma/provider.d.ts +25 -0
  69. package/build/src/akuma/provider.js +99 -7
  70. package/build/src/akuma/providers/acp/events.js +25 -2
  71. package/build/src/akuma/providers/claude/events.js +76 -10
  72. package/build/src/akuma/providers/claude/index.js +2 -5
  73. package/build/src/akuma/providers/codex-app-server/events.js +17 -2
  74. package/build/src/akuma/providers/codex-app-server/index.js +15 -9
  75. package/build/src/akuma/providers/decode.d.ts +8 -0
  76. package/build/src/akuma/providers/decode.js +21 -0
  77. package/build/src/akuma/providers/grok-build/index.js +10 -26
  78. package/build/src/akuma/providers/opencode-sdk/event-stream.d.ts +3 -3
  79. package/build/src/akuma/providers/opencode-sdk/event-stream.js +2 -25
  80. package/build/src/akuma/providers/opencode-sdk/events.d.ts +7 -43
  81. package/build/src/akuma/providers/opencode-sdk/events.js +147 -284
  82. package/build/src/akuma/providers/opencode-sdk/index.js +267 -421
  83. package/build/src/akuma/providers/opencode-sdk/native-http.d.ts +9 -0
  84. package/build/src/akuma/providers/opencode-sdk/native-http.js +69 -0
  85. package/build/src/akuma/providers/opencode-sdk/session.d.ts +42 -36
  86. package/build/src/akuma/providers/opencode-sdk/session.js +75 -82
  87. package/build/src/akuma/providers/paseo/events.d.ts +8 -0
  88. package/build/src/akuma/providers/paseo/events.js +58 -11
  89. package/build/src/akuma/providers/paseo/index.js +11 -7
  90. package/build/src/akuma/providers/pi/events.d.ts +2 -0
  91. package/build/src/akuma/providers/pi/events.js +32 -24
  92. package/build/src/akuma/providers/pi/index.js +21 -35
  93. package/build/src/akuma/request-lifecycle.d.ts +1 -2
  94. package/build/src/akuma/request-lifecycle.js +2 -8
  95. package/build/src/akuma/request-rendezvous.js +38 -55
  96. package/build/src/akuma/request-serve.d.ts +1 -1
  97. package/build/src/akuma/request-serve.js +77 -113
  98. package/build/src/akuma/selection-observation.d.ts +57 -51
  99. package/build/src/akuma/selection-observation.js +3 -3
  100. package/build/src/akuma/turn-drive.d.ts +3 -0
  101. package/build/src/akuma/turn-drive.js +26 -5
  102. package/build/src/akuma-body.js +12 -22
  103. package/build/src/cli/akuma-caller.js +10 -0
  104. package/build/src/cli/commands/akuma-grammar.js +3 -4
  105. package/build/src/cli/commands/akuma.js +13 -51
  106. package/build/src/cli/commands/contract-grammar.d.ts +7 -6
  107. package/build/src/cli/commands/contract-grammar.js +27 -32
  108. package/build/src/cli/commands/contract-help.d.ts +16 -7
  109. package/build/src/cli/commands/contract-help.js +20 -11
  110. package/build/src/cli/commands/contract.js +11 -11
  111. package/build/src/cli/commands/debt-grammar.d.ts +19 -0
  112. package/build/src/cli/commands/debt-grammar.js +323 -0
  113. package/build/src/cli/commands/debt-query.d.ts +5 -0
  114. package/build/src/cli/commands/{task-query.js → debt-query.js} +9 -9
  115. package/build/src/cli/commands/{task.d.ts → debt.d.ts} +2 -2
  116. package/build/src/cli/commands/{task.js → debt.js} +83 -143
  117. package/build/src/cli/coordinates.d.ts +1 -1
  118. package/build/src/cli/coordinates.js +1 -1
  119. package/build/src/cli/parse.d.ts +4 -4
  120. package/build/src/cli/parse.js +17 -16
  121. package/build/src/cli/render/akuma-activity.d.ts +11 -83
  122. package/build/src/cli/render/akuma-activity.js +20 -382
  123. package/build/src/cli/render/catalog.d.ts +2 -2
  124. package/build/src/cli/render/catalog.js +5 -5
  125. package/build/src/cli/render/contract.js +2 -2
  126. package/build/src/cli/render/debt.d.ts +28 -0
  127. package/build/src/cli/render/{task.js → debt.js} +51 -112
  128. package/build/src/cli/render/kanshi.js +28 -28
  129. package/build/src/cli/render/marks.d.ts +5 -5
  130. package/build/src/cli/render/marks.js +4 -10
  131. package/build/src/cli/render/nuke.js +1 -1
  132. package/build/src/cli/runtime.js +3 -3
  133. package/build/src/cli/scan.d.ts +1 -1
  134. package/build/src/cli/usage.d.ts +1 -1
  135. package/build/src/cli/usage.js +4 -4
  136. package/build/src/contract-worktree.js +3 -3
  137. package/build/src/debt/board.d.ts +160 -0
  138. package/build/src/{task → debt}/board.js +89 -89
  139. package/build/src/debt/catalog.d.ts +11 -0
  140. package/build/src/debt/catalog.js +59 -0
  141. package/build/src/{task → debt}/context.d.ts +1 -1
  142. package/build/src/{task → debt}/context.js +1 -1
  143. package/build/src/{task → debt}/created-observation.d.ts +6 -10
  144. package/build/src/{task → debt}/created-observation.js +7 -7
  145. package/build/src/debt/document.d.ts +37 -0
  146. package/build/src/{task → debt}/document.js +37 -37
  147. package/build/src/debt/identity.d.ts +21 -0
  148. package/build/src/{task → debt}/identity.js +35 -35
  149. package/build/src/debt/index.d.ts +111 -0
  150. package/build/src/debt/index.js +203 -0
  151. package/build/src/{task → debt}/input.d.ts +8 -8
  152. package/build/src/{task → debt}/input.js +21 -21
  153. package/build/src/debt/lifecycle-operations.d.ts +6 -0
  154. package/build/src/{task → debt}/lifecycle-operations.js +27 -31
  155. package/build/src/debt/mutation-result.d.ts +981 -0
  156. package/build/src/debt/mutation-result.js +109 -0
  157. package/build/src/debt/mutation.d.ts +424 -0
  158. package/build/src/debt/mutation.js +223 -0
  159. package/build/src/debt/operation-types.d.ts +71 -0
  160. package/build/src/debt/operations.d.ts +28 -0
  161. package/build/src/{task → debt}/operations.js +59 -60
  162. package/build/src/debt/query.d.ts +76 -0
  163. package/build/src/{task → debt}/query.js +55 -55
  164. package/build/src/{task → debt}/store.d.ts +13 -13
  165. package/build/src/{task → debt}/store.js +58 -49
  166. package/build/src/debt/view.d.ts +4 -0
  167. package/build/src/debt/view.js +7 -0
  168. package/build/src/identity/coordinates.d.ts +1 -1
  169. package/build/src/index.d.ts +13 -13
  170. package/build/src/index.js +9 -9
  171. package/build/src/kanshi/index.d.ts +1 -1
  172. package/build/src/kanshi/read.js +33 -33
  173. package/build/src/kanshi/report.d.ts +7 -7
  174. package/build/src/kanshi/select.js +4 -4
  175. package/build/src/library/akumas.d.ts +2 -3
  176. package/build/src/library/bind.d.ts +3 -3
  177. package/build/src/library/bind.js +5 -5
  178. package/build/src/library/contract-creation.js +5 -5
  179. package/build/src/library/contract-execution.js +4 -4
  180. package/build/src/library/contract-types.d.ts +2 -2
  181. package/build/src/library/input.d.ts +2 -2
  182. package/build/src/library/input.js +5 -5
  183. package/build/src/library/invocation.js +2 -2
  184. package/build/src/library/nuke.js +3 -3
  185. package/build/src/library/outcome.d.ts +126 -126
  186. package/build/src/library/outcome.js +3 -3
  187. package/build/src/library/selection.d.ts +1 -4
  188. package/build/src/library/selection.js +11 -62
  189. package/build/src/plugin/public.d.ts +5 -0
  190. package/build/src/plugin/runtime.js +3 -1
  191. package/build/src/runtime/proc/windows-launch.exe +0 -0
  192. package/build/src/settlement/fence.d.ts +3 -3
  193. package/build/src/settlement/fence.js +4 -4
  194. package/build/src/settlement/holder.d.ts +16 -16
  195. package/build/src/settlement/holder.js +69 -63
  196. package/build/src/settlement/settle.d.ts +5 -5
  197. package/build/src/settlement/settle.js +53 -53
  198. package/package.json +12 -6
  199. package/plugins/paseo/plugin/index.server.ts +17 -0
  200. package/plugins/paseo/plugin/paseo-plugin.json +4 -0
  201. package/plugins/paseo/plugin/server/attach.ts +52 -0
  202. package/plugins/paseo/plugin/server/keiyaku.ts +44 -0
  203. package/plugins/paseo/plugin/server/message.ts +60 -0
  204. package/plugins/paseo/plugin/server/mirror.ts +193 -0
  205. package/plugins/paseo/plugin/server/model.ts +14 -0
  206. package/plugins/paseo/plugin/server/provider.ts +276 -0
  207. package/plugins/paseo/plugin/server/sdk-worker.ts +237 -0
  208. package/plugins/paseo/plugin/server/sdk.ts +289 -0
  209. package/plugins/paseo/plugin/server/stop.ts +26 -0
  210. package/plugins/paseo/plugin/server/transport.ts +35 -0
  211. package/plugins/paseo/plugin/shared/attach-rpc.ts +10 -0
  212. package/plugins/paseo/plugin/shared/refresh-rpc.ts +6 -0
  213. package/plugins/paseo/plugin/tsconfig.json +6 -0
  214. package/skills/keiyaku/SKILL.md +5 -6
  215. package/skills/keiyaku-akuma/SKILL.md +1 -1
  216. package/skills/keiyaku-akuma/references/automation.md +8 -8
  217. package/skills/keiyaku-babysit/SKILL.md +1 -1
  218. package/skills/keiyaku-bind/SKILL.md +9 -9
  219. package/skills/keiyaku-debt/SKILL.md +91 -0
  220. package/skills/keiyaku-workflow/SKILL.md +2 -2
  221. package/build/plugins/claude/skills/keiyaku-task/SKILL.md +0 -104
  222. package/build/plugins/codex/skills/keiyaku-task/SKILL.md +0 -104
  223. package/build/plugins/opencode/skills/keiyaku-task/SKILL.md +0 -104
  224. package/build/skills/keiyaku-task/SKILL.md +0 -104
  225. package/build/src/cli/commands/task-grammar.d.ts +0 -19
  226. package/build/src/cli/commands/task-grammar.js +0 -384
  227. package/build/src/cli/commands/task-query.d.ts +0 -5
  228. package/build/src/cli/render/task.d.ts +0 -39
  229. package/build/src/task/board.d.ts +0 -168
  230. package/build/src/task/catalog.d.ts +0 -11
  231. package/build/src/task/catalog.js +0 -59
  232. package/build/src/task/compose-language.d.ts +0 -57
  233. package/build/src/task/compose-language.js +0 -364
  234. package/build/src/task/compose-parser.d.ts +0 -32
  235. package/build/src/task/compose-parser.js +0 -180
  236. package/build/src/task/compose.d.ts +0 -16
  237. package/build/src/task/compose.js +0 -189
  238. package/build/src/task/document.d.ts +0 -39
  239. package/build/src/task/identity.d.ts +0 -21
  240. package/build/src/task/index.d.ts +0 -138
  241. package/build/src/task/index.js +0 -269
  242. package/build/src/task/lifecycle-operations.d.ts +0 -6
  243. package/build/src/task/mutation-result.d.ts +0 -1726
  244. package/build/src/task/mutation-result.js +0 -198
  245. package/build/src/task/mutation.d.ts +0 -590
  246. package/build/src/task/mutation.js +0 -262
  247. package/build/src/task/operation-types.d.ts +0 -71
  248. package/build/src/task/operations.d.ts +0 -28
  249. package/build/src/task/query.d.ts +0 -76
  250. package/build/src/task/view.d.ts +0 -4
  251. package/build/src/task/view.js +0 -7
  252. package/skills/keiyaku-task/SKILL.md +0 -104
  253. /package/build/src/{task → debt}/operation-types.js +0 -0
@@ -14,8 +14,8 @@ import { World } from "../../world.js";
14
14
  import { contractFromInput } from "../selectors.js";
15
15
  import { ActivityDriver } from "../activity.js";
16
16
  import { displayContext, emit, resultContext, writeJson, writeStderr, writeStdout } from "../streams.js";
17
- import { callObservationStream, inputWaitStream, waitObservationStream, } from "../render/akuma-activity.js";
18
- import { askRawAnswer, callRawAnswer, historyRawAnswer, historyText, tellText, waitRawAnswer, waitText, } from "../render/akuma-activity.js";
17
+ import { callObservationStream, inputWaitStream } from "../render/akuma-activity.js";
18
+ import { askRawAnswer, callRawAnswer, historyRawAnswer, historyText, tellText, waitText, } from "../render/akuma-activity.js";
19
19
  import { askExitCode, askProgressStream, callExitCode, callObservationHead, forkExitCode, historyExitCode, killExitCode, renderCallText, renderForkText, renderKillText, tellExitCode, waitedTellProgress, } from "../render/akuma.js";
20
20
  export { isParsedAkumaCommand, renderAkumaHelp } from "./akuma-grammar.js";
21
21
  // ---------------------------------------------------------------------------
@@ -50,17 +50,6 @@ async function promptBody(action, command, input) {
50
50
  throw new CliUsageError(`${action} requires a nonblank prompt`);
51
51
  return bytes;
52
52
  }
53
- function waitObserver(stream, driver, onSelected) {
54
- return {
55
- selected: (selected) => {
56
- onSelected?.(selected);
57
- stream.select(selected);
58
- },
59
- observe: (observed) => {
60
- driver.settle(stream.observe(observed), stream.frame());
61
- },
62
- };
63
- }
64
53
  async function inputInitiator(input) {
65
54
  let initiator;
66
55
  try {
@@ -162,46 +151,19 @@ async function runCall(command, input) {
162
151
  }
163
152
  async function runWait(command, input) {
164
153
  const alias = command.akuma.length === 1 ? inputAlias(command.akuma[0]) : undefined;
165
- const stream = command.output === "text" ? waitObservationStream(resultContext()) : undefined;
166
- const driver = new ActivityDriver(process.stderr);
167
- const startedAt = Date.now();
168
- let selection;
169
- const observer = stream === undefined
170
- ? undefined
171
- : waitObserver(stream, driver, (selected) => {
172
- selection = selected;
173
- });
174
- try {
175
- const result = await akumas(input).wait({
176
- akuma: command.akuma,
177
- ...(input.repo === undefined ? {} : { repo: input.repo }),
178
- ...(command.completion === undefined ? {} : { completion: command.completion }),
179
- ...(command.timeoutMs === undefined ? {} : { timeoutMs: command.timeoutMs }),
180
- ...(input.signal === undefined ? {} : { signal: input.signal }),
181
- ...(observer === undefined ? {} : { observe: observer }),
182
- });
183
- const streamed = stream !== undefined && stream.streamed();
184
- if (stream !== undefined && streamed)
185
- driver.conclude(stream.conclude(result));
186
- const presentation = {
187
- ...(alias === undefined ? {} : { alias }),
188
- ...(selection === undefined ? {} : { selection }),
189
- startedAt,
190
- };
191
- if (command.output === "json") {
192
- writeJson(result);
193
- return 0;
194
- }
195
- const raw = waitRawAnswer(result, streamed);
196
- if (raw === undefined)
197
- emitAnswer(waitText(result, presentation, displayContext()), false);
198
- else
199
- emitAnswer(raw, true);
154
+ const result = await akumas(input).wait({
155
+ akuma: command.akuma,
156
+ ...(input.repo === undefined ? {} : { repo: input.repo }),
157
+ ...(command.completion === undefined ? {} : { completion: command.completion }),
158
+ ...(command.timeoutMs === undefined ? {} : { timeoutMs: command.timeoutMs }),
159
+ ...(input.signal === undefined ? {} : { signal: input.signal }),
160
+ });
161
+ if (command.output === "json") {
162
+ writeJson(result);
200
163
  return 0;
201
164
  }
202
- finally {
203
- driver.close(stream?.flush() ?? []);
204
- }
165
+ emitAnswer(waitText(result, { ...(alias === undefined ? {} : { alias }) }, displayContext()), false);
166
+ return 0;
205
167
  }
206
168
  async function runTell(command, input) {
207
169
  const body = await promptBody("tell", command, input);
@@ -1,6 +1,6 @@
1
1
  import { type ContractCommand } from "./contract-help.js";
2
2
  type CatalogQuery = Readonly<{
3
- kind: "tasks";
3
+ kind: "debts";
4
4
  namespace?: readonly string[];
5
5
  limit?: number;
6
6
  }> | Readonly<{
@@ -23,7 +23,7 @@ type Actor = Readonly<{
23
23
  export type ParsedBind = Output & Actor & Readonly<{
24
24
  command: "bind";
25
25
  forkOf?: string;
26
- task?: string;
26
+ debt?: string;
27
27
  /** A literal target branch, or `null` for a deliberately targetless bind. */
28
28
  target?: string | null;
29
29
  after?: readonly string[];
@@ -61,19 +61,21 @@ export type ParsedAbandon = Output & Actor & Readonly<{
61
61
  contract?: string;
62
62
  note?: string;
63
63
  }>;
64
+ export type ParsedShow = Output & Readonly<{
65
+ command: "show";
66
+ contract?: string;
67
+ }>;
64
68
  export type ParsedStatus = Output & (Readonly<{
65
69
  command: "status";
66
70
  contract?: string;
67
71
  selectors?: readonly string[];
68
72
  akuma?: never;
69
- guidance?: true;
70
73
  category?: never;
71
74
  limit?: never;
72
75
  }> | Readonly<{
73
76
  command: "status";
74
77
  contract: string;
75
78
  akuma: true;
76
- guidance?: never;
77
79
  category?: never;
78
80
  limit?: never;
79
81
  }> | Readonly<{
@@ -83,7 +85,6 @@ export type ParsedStatus = Output & (Readonly<{
83
85
  contract?: never;
84
86
  selectors?: never;
85
87
  akuma?: never;
86
- guidance?: never;
87
88
  }>);
88
89
  export type ParsedLs = Output & Readonly<{
89
90
  command: "ls";
@@ -120,7 +121,7 @@ export type ParsedContractParts = Readonly<{
120
121
  output: "text" | "json";
121
122
  actor?: string;
122
123
  }>;
123
- export type ParsedContractCommand = ParsedBind | ParsedAmend | ParsedDeliver | ParsedReview | ParsedArc | ParsedAbandon | ParsedStatus | ParsedLs | ParsedAudit | ParsedReconcile | ParsedNuke | ParsedSettings | ParsedRegion;
124
+ export type ParsedContractCommand = ParsedBind | ParsedAmend | ParsedDeliver | ParsedReview | ParsedArc | ParsedAbandon | ParsedShow | ParsedStatus | ParsedLs | ParsedAudit | ParsedReconcile | ParsedNuke | ParsedSettings | ParsedRegion;
124
125
  export type StatusCategory = "akuma" | "contract";
125
126
  export declare function parseContractCommand(parts: ParsedContractParts): ParsedContractCommand;
126
127
  export {};
@@ -1,5 +1,5 @@
1
1
  import { validateAkumaName } from "../../identity/normalize.js";
2
- import { parseTaskNamespaceSelector } from "../../task/catalog.js";
2
+ import { parseDebtNamespaceSelector } from "../../debt/catalog.js";
3
3
  import { CliUsageError, commandGuide } from "../usage.js";
4
4
  import { CONTRACT_COMMAND_SPECS } from "./contract-help.js";
5
5
  function parseAkumaCatalogPath(value) {
@@ -53,7 +53,7 @@ function parseBind(parts) {
53
53
  if (forkOf !== undefined) {
54
54
  if (parts.stdin)
55
55
  refuse("bind", "fork bind reads no stdin");
56
- for (const option of ["task", "after", "gates"]) {
56
+ for (const option of ["debt", "after", "gates"]) {
57
57
  if (parts.flags[option] !== undefined)
58
58
  refuse("bind", `--${option} is not valid with --fork-of`);
59
59
  }
@@ -68,13 +68,13 @@ function parseBind(parts) {
68
68
  }
69
69
  if (!parts.stdin)
70
70
  refuse("bind", "bind requires stdin");
71
- const task = optionalFlag(parts.flags, "task");
71
+ const debt = optionalFlag(parts.flags, "debt");
72
72
  const target = parseBindTarget(parts);
73
73
  const after = parts.flags.after === undefined ? [] : Array.isArray(parts.flags.after) ? parts.flags.after : [parts.flags.after];
74
74
  const gates = parseGateNames(parts, "bind");
75
75
  return {
76
76
  command: "bind",
77
- ...(task === undefined ? {} : { task }),
77
+ ...(debt === undefined ? {} : { debt }),
78
78
  ...(target === undefined ? {} : { target }),
79
79
  ...(parts.flags.after === undefined ? {} : { after }),
80
80
  ...(gates === undefined ? {} : { gates }),
@@ -149,29 +149,20 @@ function rejectStatusGlobs(positionals) {
149
149
  refuse("status", `unsupported status glob: ${selector}`);
150
150
  }
151
151
  }
152
- function parseStatusGuidance(parts, limit) {
153
- if (limit !== undefined)
154
- refuse("status", "--limit is not valid with --guidance");
152
+ function showSelector(parts) {
155
153
  const selected = parts.positionals[0];
156
154
  if (selected !== undefined && STATUS_CATEGORY_SELECTORS.has(selected))
157
- refuse("status", "--guidance cannot select a category");
155
+ refuse("show", "show cannot select a category");
158
156
  if (parts.positionals.length > 1)
159
- refuse("status", "--guidance accepts at most one Contract selector");
157
+ refuse("show", "show accepts at most one Contract selector");
160
158
  if (selected?.startsWith("aku/") === true)
161
- refuse("status", "--guidance cannot select an Akuma");
159
+ refuse("show", "show cannot select an Akuma");
162
160
  if (selected !== undefined && !selected.startsWith("@") && /[*?\[\]]/u.test(selected))
163
- refuse("status", `unsupported status glob: ${selected}`);
164
- return {
165
- command: "status",
166
- ...(selected === undefined ? {} : { contract: selected }),
167
- guidance: true,
168
- output: parts.output,
169
- };
161
+ refuse("show", `unsupported show glob: ${selected}`);
162
+ return selected;
170
163
  }
171
164
  function parseStatus(parts) {
172
165
  const limit = listLimit(parts, "status");
173
- if (parts.flags.guidance === true)
174
- return parseStatusGuidance(parts, limit);
175
166
  rejectStatusGlobs(parts.positionals);
176
167
  if (parts.positionals.length > 1) {
177
168
  if (limit !== undefined)
@@ -209,23 +200,23 @@ function listLimit(parts, command = "ls") {
209
200
  refuse(command, "--limit requires a positive safe integer");
210
201
  return limit === undefined ? undefined : Number(limit);
211
202
  }
212
- function taskCatalogQuery(path, limit) {
213
- if (path === "task" || path === "task/") {
214
- return { kind: "tasks", namespace: [], ...(limit === undefined ? {} : { limit }) };
203
+ function debtCatalogQuery(path, limit) {
204
+ if (path === "debt" || path === "debt/") {
205
+ return { kind: "debts", namespace: [], ...(limit === undefined ? {} : { limit }) };
215
206
  }
216
- if (!path.startsWith("task/"))
207
+ if (!path.startsWith("debt/"))
217
208
  return null;
218
209
  if (!path.endsWith("/"))
219
- refuse("ls", `invalid Task namespace selector: ${path}`);
220
- const body = path.slice("task/".length, -1);
210
+ refuse("ls", `invalid Debt namespace selector: ${path}`);
211
+ const body = path.slice("debt/".length, -1);
221
212
  if (body.length === 0 || body.split("/").some((segment) => segment.length === 0))
222
- refuse("ls", `invalid Task namespace selector: ${path}`);
213
+ refuse("ls", `invalid Debt namespace selector: ${path}`);
223
214
  try {
224
- const namespace = parseTaskNamespaceSelector(path);
225
- return { kind: "tasks", namespace, ...(limit === undefined ? {} : { limit }) };
215
+ const namespace = parseDebtNamespaceSelector(path);
216
+ return { kind: "debts", namespace, ...(limit === undefined ? {} : { limit }) };
226
217
  }
227
218
  catch (error) {
228
- refuse("ls", error instanceof Error ? error.message : `invalid Task namespace selector: ${path}`);
219
+ refuse("ls", error instanceof Error ? error.message : `invalid Debt namespace selector: ${path}`);
229
220
  }
230
221
  }
231
222
  function parseLs(parts) {
@@ -233,9 +224,9 @@ function parseLs(parts) {
233
224
  if (path === undefined)
234
225
  refuse("ls", "ls requires a selector");
235
226
  const limit = listLimit(parts);
236
- const taskQuery = taskCatalogQuery(path, limit);
237
- if (taskQuery !== null)
238
- return { command: "ls", query: taskQuery, output: parts.output };
227
+ const debtQuery = debtCatalogQuery(path, limit);
228
+ if (debtQuery !== null)
229
+ return { command: "ls", query: debtQuery, output: parts.output };
239
230
  if (path === "kei" || path === "kei/") {
240
231
  return {
241
232
  command: "ls",
@@ -285,6 +276,10 @@ export function parseContractCommand(parts) {
285
276
  output: parts.output,
286
277
  };
287
278
  }
279
+ case "show": {
280
+ const contract = showSelector(parts);
281
+ return { command: "show", ...(contract === undefined ? {} : { contract }), output: parts.output };
282
+ }
288
283
  case "status":
289
284
  return parseStatus(parts);
290
285
  case "ls":
@@ -13,7 +13,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
13
13
  readonly stdin: "optional";
14
14
  readonly flags: {
15
15
  readonly actor: "value";
16
- readonly task: "value";
16
+ readonly debt: "value";
17
17
  readonly target: "value";
18
18
  readonly "no-target": "boolean";
19
19
  readonly after: "repeat";
@@ -21,7 +21,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
21
21
  readonly "fork-of": "value";
22
22
  readonly json: "boolean";
23
23
  };
24
- readonly usage: "bind [--task <task/...>] [--target <ref> | --no-target] [--after <kei/...> ...] [--gates <name,...>] [--actor <actor>] - | bind --fork-of <kei/...> [--target <ref> | --no-target] [--actor <actor>]";
24
+ readonly usage: "bind [--debt <debt/...>] [--target <ref> | --no-target] [--after <kei/...> ...] [--gates <name,...>] [--actor <actor>] - | bind --fork-of <kei/...> [--target <ref> | --no-target] [--actor <actor>]";
25
25
  readonly purpose: "Create a Contract from stdin Markdown or copy an existing Contract as a starting point.";
26
26
  readonly details: string;
27
27
  };
@@ -89,15 +89,24 @@ export declare const CONTRACT_COMMAND_SPECS: {
89
89
  readonly usage: "abandon [<contract>|@<contract>] [--note <text>] [--actor <actor>]";
90
90
  readonly purpose: "End work on a Contract without delivering it; optionally record why.";
91
91
  };
92
+ readonly show: {
93
+ readonly positional: "optional";
94
+ readonly stdin: "none";
95
+ readonly flags: {
96
+ readonly json: "boolean";
97
+ };
98
+ readonly usage: "show [<contract>|@<contract>]";
99
+ readonly purpose: "Read one Contract's guidance.";
100
+ readonly details: string;
101
+ };
92
102
  readonly status: {
93
103
  readonly positional: "optional";
94
104
  readonly stdin: "none";
95
105
  readonly flags: {
96
- readonly guidance: "boolean";
97
106
  readonly limit: "value";
98
107
  readonly json: "boolean";
99
108
  };
100
- readonly usage: "status [<contract>|@name|<aku/...>]...\nstatus (aku|aku/|aku/*) [--limit <count>]\nstatus (kei|kei/|kei/*) [--limit <count>]\nstatus --guidance [<contract>|@<contract>]";
109
+ readonly usage: "status [<contract>|@name|<aku/...>]...\nstatus (aku|aku/|aku/*) [--limit <count>]\nstatus (kei|kei/|kei/*) [--limit <count>]";
101
110
  readonly purpose: "Show the world overview or selected Contract and Akuma status.";
102
111
  readonly details: string;
103
112
  };
@@ -108,8 +117,8 @@ export declare const CONTRACT_COMMAND_SPECS: {
108
117
  readonly limit: "value";
109
118
  readonly json: "boolean";
110
119
  };
111
- readonly usage: "ls task[/] [--limit <count>]\nls kei[/] [--limit <count>]\nls aku[/] [--limit <count>]\nls aku/<name>[/] [--limit <count>]\nls \"aku/<name>/*\" [--limit <count>]\nls \"aku/*/*\" [--limit <count>]";
112
- readonly purpose: "List tasks (ls task), contracts (ls kei), or akumas (ls aku).";
120
+ readonly usage: "ls debt[/] [--limit <count>]\nls kei[/] [--limit <count>]\nls aku[/] [--limit <count>]\nls aku/<name>[/] [--limit <count>]\nls \"aku/<name>/*\" [--limit <count>]\nls \"aku/*/*\" [--limit <count>]";
121
+ readonly purpose: "List debts (ls debt), contracts (ls kei), or akumas (ls aku).";
113
122
  readonly details: string;
114
123
  };
115
124
  readonly audit: {
@@ -144,7 +153,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
144
153
  };
145
154
  readonly usage: "nuke [--confirm <world-directory>]";
146
155
  readonly purpose: "Remove Keiyaku-owned data from this World.";
147
- readonly details: "Stops Akumas and removes this World's Tasks and Keiyaku-created worktrees and Git references. --confirm must exactly match this World's directory; source files are not deleted.";
156
+ readonly details: "Stops Akumas and removes this World's Debts and Keiyaku-created worktrees and Git references. --confirm must exactly match this World's directory; source files are not deleted.";
148
157
  };
149
158
  readonly settings: {
150
159
  readonly positional: "none";
@@ -5,7 +5,7 @@ export const CONTRACT_COMMAND_SPECS = {
5
5
  stdin: "optional",
6
6
  flags: {
7
7
  actor: "value",
8
- task: "value",
8
+ debt: "value",
9
9
  target: "value",
10
10
  "no-target": "boolean",
11
11
  after: "repeat",
@@ -13,7 +13,7 @@ export const CONTRACT_COMMAND_SPECS = {
13
13
  "fork-of": "value",
14
14
  json: "boolean",
15
15
  },
16
- usage: "bind [--task <task/...>] [--target <ref> | --no-target] [--after <kei/...> ...] [--gates <name,...>] [--actor <actor>] - | bind --fork-of <kei/...> [--target <ref> | --no-target] [--actor <actor>]",
16
+ usage: "bind [--debt <debt/...>] [--target <ref> | --no-target] [--after <kei/...> ...] [--gates <name,...>] [--actor <actor>] - | bind --fork-of <kei/...> [--target <ref> | --no-target] [--actor <actor>]",
17
17
  purpose: "Create a Contract from stdin Markdown or copy an existing Contract as a starting point.",
18
18
  details: [
19
19
  "--target names one existing local branch literally; it is never created and never",
@@ -147,11 +147,24 @@ export const CONTRACT_COMMAND_SPECS = {
147
147
  usage: "abandon [<contract>|@<contract>] [--note <text>] [--actor <actor>]",
148
148
  purpose: "End work on a Contract without delivering it; optionally record why.",
149
149
  },
150
+ show: {
151
+ positional: "optional",
152
+ stdin: "none",
153
+ flags: { json: "boolean" },
154
+ usage: "show [<contract>|@<contract>]",
155
+ purpose: "Read one Contract's guidance.",
156
+ details: [
157
+ "Accepts a complete Contract identity or exact @<contract> short selector.",
158
+ "Omitted selection uses the exact managed worktree's installed Contract context.",
159
+ "Akuma, category, and plural selections are refused before reading guidance.",
160
+ "Text returns guidance directly; --json serializes the same native value.",
161
+ ].join("\n"),
162
+ },
150
163
  status: {
151
164
  positional: "optional",
152
165
  stdin: "none",
153
- flags: { guidance: "boolean", limit: "value", json: "boolean" },
154
- usage: "status [<contract>|@name|<aku/...>]...\nstatus (aku|aku/|aku/*) [--limit <count>]\nstatus (kei|kei/|kei/*) [--limit <count>]\nstatus --guidance [<contract>|@<contract>]",
166
+ flags: { limit: "value", json: "boolean" },
167
+ usage: "status [<contract>|@name|<aku/...>]...\nstatus (aku|aku/|aku/*) [--limit <count>]\nstatus (kei|kei/|kei/*) [--limit <count>]",
155
168
  purpose: "Show the world overview or selected Contract and Akuma status.",
156
169
  details: [
157
170
  "Akuma entries show the directory each Akuma was started in.",
@@ -159,18 +172,14 @@ export const CONTRACT_COMMAND_SPECS = {
159
172
  "aku, aku/, and aku/* show the recent Akuma board; kei, kei/, and kei/* show the",
160
173
  "recent active Contract board. --limit bounds the board to that many recent rows",
161
174
  "(default 10). The Contract category requires a Repo; the Akuma category does not.",
162
- "",
163
- "--guidance reads one Contract's guidance instead of status. It accepts one Contract",
164
- "selector or the installed Contract selection context, and refuses an Akuma, plural,",
165
- "or world selection before the read.",
166
175
  ].join("\n"),
167
176
  },
168
177
  ls: {
169
178
  positional: "optional",
170
179
  stdin: "none",
171
180
  flags: { limit: "value", json: "boolean" },
172
- usage: 'ls task[/] [--limit <count>]\nls kei[/] [--limit <count>]\nls aku[/] [--limit <count>]\nls aku/<name>[/] [--limit <count>]\nls "aku/<name>/*" [--limit <count>]\nls "aku/*/*" [--limit <count>]',
173
- purpose: "List tasks (ls task), contracts (ls kei), or akumas (ls aku).",
181
+ usage: 'ls debt[/] [--limit <count>]\nls kei[/] [--limit <count>]\nls aku[/] [--limit <count>]\nls aku/<name>[/] [--limit <count>]\nls "aku/<name>/*" [--limit <count>]\nls "aku/*/*" [--limit <count>]',
182
+ purpose: "List debts (ls debt), contracts (ls kei), or akumas (ls aku).",
174
183
  details: [
175
184
  "ls kei lists active Contracts; accepted and abandoned ones leave the list, and their record stays in history and Git.",
176
185
  "ls aku/ lists the callable Akuma-name catalog; ls aku/<name> lists the living Akumas under one name.",
@@ -205,7 +214,7 @@ export const CONTRACT_COMMAND_SPECS = {
205
214
  flags: { confirm: "value", json: "boolean" },
206
215
  usage: "nuke [--confirm <world-directory>]",
207
216
  purpose: "Remove Keiyaku-owned data from this World.",
208
- details: "Stops Akumas and removes this World's Tasks and Keiyaku-created worktrees and Git references. --confirm must exactly match this World's directory; source files are not deleted.",
217
+ details: "Stops Akumas and removes this World's Debts and Keiyaku-created worktrees and Git references. --confirm must exactly match this World's directory; source files are not deleted.",
209
218
  },
210
219
  settings: {
211
220
  positional: "none",
@@ -6,12 +6,12 @@ import { composeContractLibrary, observeKeiyaku } from "../../library/contract-c
6
6
  import { validateArcMarkdown, validateContractMarkdown } from "../../library/input.js";
7
7
  import { createKeiyakuHandle } from "../../library/keiyaku.js";
8
8
  import { SettingsError, settings } from "../../settings.js";
9
- import { Tasks } from "../../task/index.js";
9
+ import { Debts } from "../../debt/index.js";
10
10
  import { actorFromEdge } from "../actor.js";
11
11
  import { resolveInvocationCwd } from "../coordinates.js";
12
12
  import { BindDraftError, preserveBindDraft } from "../draft.js";
13
13
  import { snapshotText } from "../render/akuma-activity.js";
14
- import { renderAkumaCatalogue, renderArchetypeCatalogue, renderContractCatalogue, renderTaskCatalogue, } from "../render/catalog.js";
14
+ import { renderAkumaCatalogue, renderArchetypeCatalogue, renderContractCatalogue, renderDebtCatalogue, } from "../render/catalog.js";
15
15
  import { renderAccepted, renderContractHistory, renderRetry } from "../render/contract.js";
16
16
  import { renderKanshiCategoryText, renderKanshiText } from "../render/kanshi.js";
17
17
  import { nukeExitCode, renderNukeText } from "../render/nuke.js";
@@ -152,7 +152,7 @@ async function runBind(command, input, library) {
152
152
  const answer = await library.bind({
153
153
  repo,
154
154
  markdown,
155
- ...(command.task === undefined ? {} : { task: command.task }),
155
+ ...(command.debt === undefined ? {} : { debt: command.debt }),
156
156
  ...(command.target === undefined ? {} : { target: command.target }),
157
157
  ...(actor === undefined ? {} : { actor }),
158
158
  ...(after === undefined ? {} : { after }),
@@ -324,15 +324,15 @@ async function runLs(command, coordinates, home) {
324
324
  }
325
325
  if (coordinates.world === null)
326
326
  throw new CliUsageError("no Keiyaku world contains the invocation cwd");
327
- if (query.kind === "tasks") {
328
- const listed = await Tasks.of(coordinates.world).list({
327
+ if (query.kind === "debts") {
328
+ const listed = await Debts.of(coordinates.world).list({
329
329
  selection: "all",
330
330
  namespace: query.namespace ?? [],
331
331
  ...(query.limit === undefined ? {} : { limit: query.limit }),
332
332
  });
333
333
  if (listed.kind !== "accepted")
334
- throw new Error("Task list did not return an accepted observation");
335
- return emit(command.output, listed, () => renderTaskCatalogue(listed.value, query.namespace ?? []), 0);
334
+ throw new Error("Debt list did not return an accepted observation");
335
+ return emit(command.output, listed, () => renderDebtCatalogue(listed.value, query.namespace ?? []), 0);
336
336
  }
337
337
  const listed = await Akumas.of(coordinates.world).list({
338
338
  ...(query.archetype === undefined ? {} : { archetype: query.archetype }),
@@ -375,14 +375,14 @@ async function namedStatus(selector, coordinates, named) {
375
375
  return await readAkumaStatus(address.id, selector, coordinates);
376
376
  return await readContractStatus(address.id, coordinates, named);
377
377
  }
378
- async function runStatusGuidance(command, coordinates) {
378
+ async function runShow(command, coordinates) {
379
379
  const repo = coordinates.repo;
380
380
  if (repo === undefined)
381
381
  throw new CliUsageError("cannot select a contract while the Contract world is absent");
382
382
  const selected = await selectedContract(repo, command.contract, coordinates.cwd);
383
383
  const guidance = await selected.contract.guidance();
384
384
  if (guidance === null) {
385
- const refusal = statusRefusal("status", selected.id);
385
+ const refusal = statusRefusal(command.command, selected.id);
386
386
  return emit(command.output, null, () => renderRefusal(refusal, undefined, displayContext()), 1);
387
387
  }
388
388
  return emit(command.output, guidance, () => guidance, 0);
@@ -453,8 +453,6 @@ async function runStatusIdentity(command, coordinates) {
453
453
  throw new CliUsageError(`contract selector must use kei/: ${command.contract}`);
454
454
  }
455
455
  async function runStatus(command, coordinates) {
456
- if (command.guidance === true)
457
- return await runStatusGuidance(command, coordinates);
458
456
  if (command.category !== undefined)
459
457
  return await runStatusCategory(command, coordinates);
460
458
  if ("selectors" in command && command.selectors !== undefined)
@@ -550,6 +548,8 @@ export async function runContractCommand(command, coordinates, runtime) {
550
548
  return await runNuke(command, coordinates);
551
549
  case "ls":
552
550
  return await runLs(command, coordinates, home);
551
+ case "show":
552
+ return await runShow(command, coordinates);
553
553
  case "status":
554
554
  return await runStatus(command, coordinates);
555
555
  case "region":
@@ -0,0 +1,19 @@
1
+ import { type CliUsageGuide } from "../usage.js";
2
+ import { type DebtQueryExpression } from "./debt-query.js";
3
+ export type DebtAction = "add" | "show" | "ls" | "ready" | "blocked" | "tree" | "doctor" | "update" | "query" | "done" | "drop" | "context";
4
+ type DebtFlagValue = string | true | readonly string[];
5
+ type DebtStdin = "document" | "body" | "append" | "note";
6
+ export type ParsedDebtCommand = Readonly<{
7
+ command: "debt";
8
+ action: DebtAction;
9
+ output: "text" | "json";
10
+ positionals: readonly string[];
11
+ flags: Readonly<Record<string, DebtFlagValue>>;
12
+ stdin?: DebtStdin;
13
+ where?: DebtQueryExpression;
14
+ }>;
15
+ export declare function isDebtAction(value: string | undefined): value is DebtAction;
16
+ export declare function renderDebtHelp(action?: DebtAction): string;
17
+ export declare function debtUsageGuide(action: DebtAction): CliUsageGuide;
18
+ export declare function parseDebtCommand(argv: readonly string[]): ParsedDebtCommand;
19
+ export {};