@astrosheep/keiyaku 4.6.31 → 4.6.32

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 (335) hide show
  1. package/README.md +34 -17
  2. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +16 -11
  3. package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +5 -3
  4. package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +4 -3
  5. package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +17 -17
  6. package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +4 -3
  7. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +16 -11
  8. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +5 -3
  9. package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +4 -3
  10. package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +17 -17
  11. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +4 -3
  12. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +16 -11
  13. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +5 -3
  14. package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +4 -3
  15. package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +17 -17
  16. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +4 -3
  17. package/build/plugins/pi/README.md +16 -18
  18. package/build/plugins/pi/akuma-tools.ts +31 -38
  19. package/build/plugins/pi/keiyaku.ts +15 -4
  20. package/build/skills/keiyaku-akuma/SKILL.md +16 -11
  21. package/build/skills/keiyaku-babysit/SKILL.md +5 -3
  22. package/build/skills/keiyaku-bind/SKILL.md +4 -3
  23. package/build/skills/keiyaku-debt/SKILL.md +17 -17
  24. package/build/skills/keiyaku-workflow/SKILL.md +4 -3
  25. package/build/src/akuma/akuma-call.d.ts +3 -5
  26. package/build/src/akuma/akuma-call.js +7 -10
  27. package/build/src/akuma/akuma-errors.d.ts +7 -4
  28. package/build/src/akuma/akuma-errors.js +16 -12
  29. package/build/src/akuma/akuma-instance.d.ts +39 -303
  30. package/build/src/akuma/akuma-instance.js +48 -48
  31. package/build/src/akuma/akuma-observe.d.ts +5 -4
  32. package/build/src/akuma/akuma-observe.js +1 -7
  33. package/build/src/akuma/akuma-owner.d.ts +14 -6
  34. package/build/src/akuma/akuma-owner.js +33 -27
  35. package/build/src/akuma/akuma-selection-execution.d.ts +22 -19
  36. package/build/src/akuma/akuma-selection-execution.js +71 -124
  37. package/build/src/akuma/akuma-wait.d.ts +3 -3
  38. package/build/src/akuma/akuma.d.ts +47 -384
  39. package/build/src/akuma/akuma.js +8 -58
  40. package/build/src/akuma/archetype.d.ts +16 -19
  41. package/build/src/akuma/archetype.js +48 -49
  42. package/build/src/akuma/body.js +31 -26
  43. package/build/src/akuma/call-initial-tell.d.ts +4 -1
  44. package/build/src/akuma/call-initial-tell.js +9 -1
  45. package/build/src/akuma/call-input.d.ts +8 -1
  46. package/build/src/akuma/call-input.js +27 -18
  47. package/build/src/akuma/caller.js +2 -1
  48. package/build/src/akuma/detached-body.js +1 -1
  49. package/build/src/akuma/heart/facts.d.ts +5 -4
  50. package/build/src/akuma/heart/facts.js +5 -5
  51. package/build/src/akuma/heart/soul.js +20 -4
  52. package/build/src/akuma/identity.d.ts +1 -1
  53. package/build/src/akuma/identity.js +9 -4
  54. package/build/src/akuma/index.d.ts +6 -7
  55. package/build/src/akuma/index.js +2 -3
  56. package/build/src/akuma/projection.d.ts +3 -0
  57. package/build/src/akuma/provider-recipe.js +3 -2
  58. package/build/src/akuma/providers/acp/config.js +11 -10
  59. package/build/src/akuma/providers/acp/index.js +2 -1
  60. package/build/src/akuma/providers/codex-app-server/index.js +7 -1
  61. package/build/src/akuma/providers/grok-build/index.js +2 -1
  62. package/build/src/akuma/providers/index.d.ts +0 -1
  63. package/build/src/akuma/providers/index.js +0 -8
  64. package/build/src/akuma/providers/paseo/index.js +7 -4
  65. package/build/src/akuma/providers/pi/index.js +4 -3
  66. package/build/src/akuma/publication.d.ts +1 -2
  67. package/build/src/akuma/publication.js +16 -14
  68. package/build/src/akuma/schema.d.ts +3 -49
  69. package/build/src/akuma/schema.js +6 -147
  70. package/build/src/akuma/selection-observation.d.ts +281 -240
  71. package/build/src/akuma/selection-observation.js +122 -68
  72. package/build/src/akuma/status-projection.d.ts +49 -285
  73. package/build/src/akuma/status-projection.js +178 -138
  74. package/build/src/body/amend.js +2 -1
  75. package/build/src/body/arc.js +3 -2
  76. package/build/src/body/criteria.js +4 -3
  77. package/build/src/body/decode.js +2 -1
  78. package/build/src/body/envelope.js +2 -1
  79. package/build/src/body/region.d.ts +1 -3
  80. package/build/src/body/region.js +3 -8
  81. package/build/src/body-host.d.ts +4 -11
  82. package/build/src/body-host.js +5 -4
  83. package/build/src/bounded-list.js +2 -1
  84. package/build/src/cli/commands/akuma-grammar.d.ts +109 -66
  85. package/build/src/cli/commands/akuma-grammar.js +75 -95
  86. package/build/src/cli/commands/akuma.d.ts +8 -3
  87. package/build/src/cli/commands/akuma.js +63 -122
  88. package/build/src/cli/commands/contract-grammar.d.ts +3 -135
  89. package/build/src/cli/commands/contract-grammar.js +125 -218
  90. package/build/src/cli/commands/contract-help.d.ts +24 -21
  91. package/build/src/cli/commands/contract-help.js +43 -35
  92. package/build/src/cli/commands/contract.d.ts +6 -18
  93. package/build/src/cli/commands/contract.js +65 -272
  94. package/build/src/cli/commands/debt-grammar.d.ts +2 -4
  95. package/build/src/cli/commands/debt-grammar.js +22 -190
  96. package/build/src/cli/commands/debt.js +10 -87
  97. package/build/src/cli/commands/report.d.ts +2 -4
  98. package/build/src/cli/coordinates.d.ts +1 -1
  99. package/build/src/cli/coordinates.js +1 -1
  100. package/build/src/cli/main.js +9 -3
  101. package/build/src/cli/parse.d.ts +80 -3
  102. package/build/src/cli/parse.js +76 -16
  103. package/build/src/cli/render/akuma-activity.d.ts +19 -24
  104. package/build/src/cli/render/akuma-activity.js +164 -259
  105. package/build/src/cli/render/akuma.d.ts +3 -3
  106. package/build/src/cli/render/akuma.js +36 -43
  107. package/build/src/cli/render/catalog.d.ts +2 -5
  108. package/build/src/cli/render/catalog.js +2 -33
  109. package/build/src/cli/render/contract-history.js +1 -2
  110. package/build/src/cli/render/contract-observation.d.ts +0 -7
  111. package/build/src/cli/render/contract-observation.js +0 -3
  112. package/build/src/cli/render/contract.d.ts +7 -9
  113. package/build/src/cli/render/contract.js +35 -64
  114. package/build/src/cli/render/debt.d.ts +3 -11
  115. package/build/src/cli/render/debt.js +17 -88
  116. package/build/src/cli/render/delivery-preview.js +4 -4
  117. package/build/src/cli/render/kanshi-akuma.d.ts +5 -3
  118. package/build/src/cli/render/kanshi-akuma.js +22 -18
  119. package/build/src/cli/render/kanshi.d.ts +1 -3
  120. package/build/src/cli/render/kanshi.js +16 -39
  121. package/build/src/cli/render/receipt.d.ts +21 -12
  122. package/build/src/cli/render/receipt.js +49 -44
  123. package/build/src/cli/render/refusal.d.ts +4 -3
  124. package/build/src/cli/render/refusal.js +15 -17
  125. package/build/src/cli/render/settings.d.ts +1 -1
  126. package/build/src/cli/render/terminal.d.ts +9 -8
  127. package/build/src/cli/render/terminal.js +48 -32
  128. package/build/src/cli/render/verbs.d.ts +3 -1
  129. package/build/src/cli/render/verbs.js +74 -116
  130. package/build/src/cli/runtime.js +66 -65
  131. package/build/src/cli/streams.d.ts +2 -9
  132. package/build/src/cli/streams.js +8 -1
  133. package/build/src/cli/usage.d.ts +2 -1
  134. package/build/src/cli/usage.js +3 -2
  135. package/build/src/contract-worktree.js +2 -10
  136. package/build/src/core/facts/codec.js +9 -23
  137. package/build/src/core/facts/errors.d.ts +2 -1
  138. package/build/src/core/facts/errors.js +3 -3
  139. package/build/src/core/facts/types.d.ts +2 -13
  140. package/build/src/core/facts/types.js +1 -6
  141. package/build/src/core/verbs/abandon.d.ts +1 -2
  142. package/build/src/core/verbs/amend.d.ts +1 -2
  143. package/build/src/core/verbs/arc.d.ts +1 -2
  144. package/build/src/core/verbs/attestation.d.ts +1 -2
  145. package/build/src/core/verbs/bind.d.ts +1 -2
  146. package/build/src/core/verbs/deliver.d.ts +1 -2
  147. package/build/src/core/verbs/placement.d.ts +1 -2
  148. package/build/src/core/verbs/reintegrate.d.ts +1 -2
  149. package/build/src/debt/board.d.ts +14 -94
  150. package/build/src/debt/board.js +25 -160
  151. package/build/src/debt/catalog.d.ts +0 -2
  152. package/build/src/debt/catalog.js +1 -22
  153. package/build/src/debt/document.d.ts +8 -11
  154. package/build/src/debt/document.js +19 -62
  155. package/build/src/debt/identity.d.ts +2 -14
  156. package/build/src/debt/identity.js +19 -49
  157. package/build/src/debt/index.d.ts +81 -219
  158. package/build/src/debt/index.js +61 -110
  159. package/build/src/debt/input.d.ts +19 -5
  160. package/build/src/debt/input.js +51 -177
  161. package/build/src/debt/lifecycle-operations.d.ts +1 -3
  162. package/build/src/debt/lifecycle-operations.js +1 -73
  163. package/build/src/debt/operation-types.d.ts +24 -128
  164. package/build/src/debt/operation-types.js +6 -62
  165. package/build/src/debt/operations.d.ts +8 -17
  166. package/build/src/debt/operations.js +58 -154
  167. package/build/src/debt/store.d.ts +0 -2
  168. package/build/src/debt/store.js +32 -87
  169. package/build/src/errors.d.ts +28 -0
  170. package/build/src/errors.js +26 -0
  171. package/build/src/git/hooks.d.ts +1 -1
  172. package/build/src/git/observe.d.ts +3 -0
  173. package/build/src/git/observe.js +19 -5
  174. package/build/src/git/reconcile.d.ts +3 -16
  175. package/build/src/git/reconcile.js +0 -18
  176. package/build/src/git/repository.d.ts +2 -1
  177. package/build/src/git/repository.js +3 -3
  178. package/build/src/git/target-placement.d.ts +4 -4
  179. package/build/src/git/target.d.ts +2 -2
  180. package/build/src/git/tender.d.ts +1 -2
  181. package/build/src/git/tender.js +5 -12
  182. package/build/src/identity/coordinates.d.ts +1 -1
  183. package/build/src/identity/coordinates.js +3 -2
  184. package/build/src/identity/normalize.js +2 -1
  185. package/build/src/identity/selector.js +4 -3
  186. package/build/src/index.d.ts +34 -57
  187. package/build/src/index.js +11 -36
  188. package/build/src/kanshi/counts.d.ts +3 -8
  189. package/build/src/kanshi/counts.js +6 -14
  190. package/build/src/kanshi/index.d.ts +22 -7
  191. package/build/src/kanshi/index.js +30 -4
  192. package/build/src/kanshi/read.d.ts +81 -270
  193. package/build/src/kanshi/read.js +39 -199
  194. package/build/src/kanshi/report.d.ts +340 -1619
  195. package/build/src/kanshi/report.js +19 -31
  196. package/build/src/library/address.d.ts +11 -11
  197. package/build/src/library/address.js +34 -27
  198. package/build/src/library/akuma-creation.d.ts +210 -79
  199. package/build/src/library/akuma-creation.js +201 -242
  200. package/build/src/library/akumas.d.ts +24 -5
  201. package/build/src/library/akumas.js +96 -29
  202. package/build/src/library/bind.d.ts +7 -10
  203. package/build/src/library/bind.js +2 -8
  204. package/build/src/library/continuation.d.ts +141 -231
  205. package/build/src/library/continuation.js +22 -31
  206. package/build/src/library/contract-address.d.ts +6 -9
  207. package/build/src/library/contract-address.js +11 -16
  208. package/build/src/library/contract-composition.d.ts +2 -3
  209. package/build/src/library/contract-composition.js +12 -19
  210. package/build/src/library/contract-creation.js +33 -34
  211. package/build/src/library/contract-outcomes.d.ts +1278 -806
  212. package/build/src/library/contract-outcomes.js +11 -37
  213. package/build/src/library/contract-settings.d.ts +1 -2
  214. package/build/src/library/contract-settings.js +5 -7
  215. package/build/src/library/contract-types.d.ts +42 -67
  216. package/build/src/library/contract-types.js +15 -56
  217. package/build/src/library/contract-wait.d.ts +40 -3
  218. package/build/src/library/contract-wait.js +28 -21
  219. package/build/src/library/delivery.d.ts +366 -389
  220. package/build/src/library/delivery.js +5 -25
  221. package/build/src/library/input.d.ts +31 -5
  222. package/build/src/library/input.js +40 -40
  223. package/build/src/library/invocation.d.ts +13 -11
  224. package/build/src/library/invocation.js +69 -58
  225. package/build/src/library/kei.d.ts +16 -8
  226. package/build/src/library/kei.js +459 -19
  227. package/build/src/library/keiyaku-attribution.d.ts +0 -8
  228. package/build/src/library/keiyaku-attribution.js +0 -11
  229. package/build/src/library/keiyaku-classify.d.ts +2 -2
  230. package/build/src/library/keiyaku-classify.js +40 -59
  231. package/build/src/library/keiyaku-coordinates.d.ts +3 -8
  232. package/build/src/library/keiyaku-coordinates.js +6 -26
  233. package/build/src/library/keiyaku-debt.d.ts +21 -93
  234. package/build/src/library/keiyaku-debt.js +8 -157
  235. package/build/src/library/keiyaku-identity.js +5 -4
  236. package/build/src/library/keiyaku-verbs.d.ts +4004 -3885
  237. package/build/src/library/keiyaku-verbs.js +309 -271
  238. package/build/src/library/keiyaku.d.ts +30 -860
  239. package/build/src/library/keiyaku.js +169 -256
  240. package/build/src/library/nuke.d.ts +4 -2
  241. package/build/src/library/nuke.js +5 -1
  242. package/build/src/library/outcome.d.ts +424 -307
  243. package/build/src/library/outcome.js +167 -362
  244. package/build/src/library/reconcile.d.ts +331 -143
  245. package/build/src/library/reconcile.js +38 -72
  246. package/build/src/library/refusal.d.ts +20 -28
  247. package/build/src/library/refusal.js +1 -11
  248. package/build/src/library/repo.js +4 -3
  249. package/build/src/library/selection.d.ts +32 -21
  250. package/build/src/library/selection.js +63 -87
  251. package/build/src/mcp/adapter.d.ts +6 -0
  252. package/build/src/mcp/adapter.js +177 -42
  253. package/build/src/mcp/help.d.ts +1 -1
  254. package/build/src/mcp/help.js +12 -7
  255. package/build/src/mcp/output.d.ts +385 -0
  256. package/build/src/mcp/output.js +193 -0
  257. package/build/src/plugin/public.d.ts +4 -0
  258. package/build/src/plugin/runtime.d.ts +1 -1
  259. package/build/src/plugin/runtime.js +2 -2
  260. package/build/src/protocol/amend.d.ts +1 -1
  261. package/build/src/protocol/amend.js +2 -2
  262. package/build/src/protocol/bind.d.ts +5 -7
  263. package/build/src/protocol/bind.js +3 -3
  264. package/build/src/protocol/completion.d.ts +158 -195
  265. package/build/src/protocol/completion.js +55 -19
  266. package/build/src/protocol/deliver.d.ts +11 -6
  267. package/build/src/protocol/deliver.js +30 -30
  268. package/build/src/protocol/delivery-preview.d.ts +13 -11
  269. package/build/src/protocol/delivery-preview.js +2 -2
  270. package/build/src/protocol/execution-observation.d.ts +5 -13
  271. package/build/src/protocol/intent.d.ts +6 -9
  272. package/build/src/protocol/intent.js +18 -31
  273. package/build/src/protocol/operations.d.ts +48 -53
  274. package/build/src/protocol/operations.js +16 -25
  275. package/build/src/protocol/outcome.d.ts +3 -1
  276. package/build/src/protocol/placement.d.ts +1 -2
  277. package/build/src/protocol/placement.js +1 -1
  278. package/build/src/protocol/progress.d.ts +1 -0
  279. package/build/src/protocol/read/status.d.ts +29 -112
  280. package/build/src/protocol/read/status.js +52 -78
  281. package/build/src/protocol/reintegrate.d.ts +1 -2
  282. package/build/src/protocol/reintegrate.js +0 -1
  283. package/build/src/protocol/result-leaves.d.ts +11 -32
  284. package/build/src/protocol/result-leaves.js +18 -57
  285. package/build/src/protocol/result-reasons.d.ts +6 -6
  286. package/build/src/protocol/review.js +0 -1
  287. package/build/src/protocol/verify.d.ts +192 -146
  288. package/build/src/protocol/verify.js +60 -47
  289. package/build/src/runtime/proc/windows-launch.exe +0 -0
  290. package/build/src/settings.d.ts +8 -9
  291. package/build/src/settings.js +16 -13
  292. package/build/src/settlement/holder.js +2 -2
  293. package/build/src/settlement/settle.d.ts +0 -6
  294. package/build/src/settlement/settle.js +0 -4
  295. package/build/src/verification/declaration.d.ts +3 -6
  296. package/build/src/verification/declaration.js +3 -5
  297. package/build/src/verification/observation.d.ts +2 -2
  298. package/build/src/world.d.ts +3 -2
  299. package/build/src/world.js +5 -6
  300. package/package.json +1 -1
  301. package/plugins/paseo/plugin/index.server.ts +1 -1
  302. package/plugins/paseo/plugin/server/attach.ts +74 -67
  303. package/plugins/paseo/plugin/server/keiyaku.ts +80 -14
  304. package/plugins/paseo/plugin/server/message.ts +2 -1
  305. package/plugins/paseo/plugin/server/mirror-identity.ts +6 -4
  306. package/plugins/paseo/plugin/server/sdk.ts +9 -11
  307. package/plugins/paseo/plugin/server/transport.ts +24 -1
  308. package/plugins/pi/README.md +16 -18
  309. package/plugins/pi/akuma-tools.ts +31 -38
  310. package/plugins/pi/keiyaku.ts +15 -4
  311. package/skills/keiyaku-akuma/SKILL.md +16 -11
  312. package/skills/keiyaku-babysit/SKILL.md +5 -3
  313. package/skills/keiyaku-bind/SKILL.md +4 -3
  314. package/skills/keiyaku-debt/SKILL.md +17 -17
  315. package/skills/keiyaku-workflow/SKILL.md +4 -3
  316. package/build/src/akuma/providers/codex-app-server/configuration.d.ts +0 -5
  317. package/build/src/akuma/providers/codex-app-server/configuration.js +0 -72
  318. package/build/src/cli/commands/debt-query.d.ts +0 -5
  319. package/build/src/cli/commands/debt-query.js +0 -194
  320. package/build/src/cli/render/akuma-tool-command.d.ts +0 -6
  321. package/build/src/cli/render/akuma-tool-command.js +0 -143
  322. package/build/src/cli/render/akuma-tool.d.ts +0 -29
  323. package/build/src/cli/render/akuma-tool.js +0 -225
  324. package/build/src/debt/context.d.ts +0 -28
  325. package/build/src/debt/context.js +0 -102
  326. package/build/src/debt/created-observation.d.ts +0 -26
  327. package/build/src/debt/created-observation.js +0 -38
  328. package/build/src/debt/query.d.ts +0 -80
  329. package/build/src/debt/query.js +0 -283
  330. package/build/src/library/contract-execution.d.ts +0 -28
  331. package/build/src/library/contract-execution.js +0 -506
  332. package/build/src/library/keiyaku-policy.d.ts +0 -27
  333. package/build/src/library/keiyaku-policy.js +0 -44
  334. package/build/src/library/keiyaku-status.d.ts +0 -1487
  335. package/build/src/library/keiyaku-status.js +0 -92
@@ -1,4 +1,4 @@
1
- import { actionReceipt, callObservationStream, inputWaitStream, killResultText, subordinateLines, tellAdmissionRow, tellControlLines, tellPayloadLines, } from "./akuma-activity.js";
1
+ import { actionReceipt, callObservationStream, inputWaitStream, killResultText, subordinateLines, tellAdmissionRow, callFailureLines, askRawAnswer, inputObservation, tellControlLines, tellPayloadLines, } from "./akuma-activity.js";
2
2
  import { safeText } from "./terminal.js";
3
3
  export function askProgressStream(akuma, alias, context, now) {
4
4
  let target = akuma;
@@ -19,10 +19,16 @@ export function askProgressStream(akuma, alias, context, now) {
19
19
  observe: (observation) => stream.observe(observation),
20
20
  frame: () => stream.frame(),
21
21
  flush: () => stream.flush(),
22
- conclude: (result) => [
23
- stream.conclude({ kind: "observed", observation: result }),
24
- ...subordinateLines(tellControlLines(result, context)),
25
- ],
22
+ conclude: (result) => {
23
+ const controls = tellControlLines(result, context);
24
+ return [
25
+ stream.conclude({ kind: "observed", observation: inputObservation(result) }),
26
+ ...subordinateLines([
27
+ ...(controls.length === 0 && askRawAnswer(result) !== undefined ? [] : [`input ${result.tellId}`]),
28
+ ...controls,
29
+ ]),
30
+ ];
31
+ },
26
32
  };
27
33
  }
28
34
  export function waitedTellProgress(result, input, context) {
@@ -35,35 +41,32 @@ export function waitedTellProgress(result, input, context) {
35
41
  const admitted = stream.admitted({ rows: [tellAdmissionRow(input.prompt, context, result.wake)] });
36
42
  return [
37
43
  ...admitted,
38
- stream.conclude({ kind: "observed", observation: result }),
39
- ...subordinateLines(tellControlLines(result, context)),
44
+ stream.conclude({
45
+ kind: "observed",
46
+ observation: inputObservation(result),
47
+ }),
48
+ ...subordinateLines([`input ${result.tellId}`, ...tellControlLines(result, context)]),
49
+ ...(askRawAnswer(result) === undefined ? [] : [askRawAnswer(result)]),
50
+ ...(result.kind === "invalid-output" ? ["invalid answer", result.answer] : []),
40
51
  ].join("\n");
41
52
  }
42
- function dispatchFailureLine(failure) {
43
- return failure.kind === "conflict"
44
- ? `! dispatch failed conflict ${failure.currentContractId}`
45
- : `! dispatch failed ${failure.kind} ${safeText(failure.diagnostic)}`;
46
- }
47
53
  /** The shared frame consumes owner evidence and explicit invocation context. */
48
54
  export function callObservationHead(input, presentation = {}) {
49
- const alias = input.alias !== undefined && input.alias.kind !== "moved"
55
+ const failures = "failures" in input ? (input.failures ?? []) : [];
56
+ const alias = failures.some((failure) => failure.stage === "dispatch" || failure.stage === "alias")
50
57
  ? undefined
51
58
  : "aliasName" in input
52
59
  ? input.aliasName
53
60
  : presentation.alias;
54
- const contractId = input.dispatchFailure !== undefined
61
+ const contractId = failures.some((failure) => failure.stage === "dispatch")
55
62
  ? undefined
56
63
  : "contractId" in input
57
64
  ? input.contractId
58
65
  : presentation.contractId;
59
66
  const cwd = "cwd" in input ? input.cwd : presentation.cwd;
60
67
  const facts = [
61
- ...(input.dispatchFailure === undefined ? [] : [dispatchFailureLine(input.dispatchFailure)]),
62
68
  ...(input.dispatchWarning === undefined ? [] : [`dispatch lag ${safeText(input.dispatchWarning)}`]),
63
- ...(input.alias !== undefined && input.alias.kind !== "moved"
64
- ? [`! alias failed ${input.alias.kind} ${safeText(input.alias.diagnostic)}`]
65
- : []),
66
- ...(input.alias?.kind === "moved" ? [`alias moved · previous ${input.alias.previousAkumaId}`] : []),
69
+ ...(input.alias === undefined ? [] : [`alias moved · previous ${input.alias.previousAkumaId}`]),
67
70
  ];
68
71
  return {
69
72
  id: input.akumaId,
@@ -79,37 +82,24 @@ function spawnEvidence(result, context, input) {
79
82
  ...(head.contract.kind === "associated" ? [safeText(head.contract.contractId)] : []),
80
83
  ...(head.cwd === undefined ? [] : [safeText(head.cwd)]),
81
84
  ...head.facts,
82
- ...tellControlLines(result, context),
85
+ ...tellControlLines(result.wake === undefined ? {} : { wake: result.wake }, context),
86
+ ...(result.tellId === undefined ? [] : [`input ${result.tellId}`]),
83
87
  ...(result.tellId === undefined || input.prompt === undefined
84
88
  ? []
85
89
  : tellPayloadLines(input.prompt, context).map((line) => line.trimStart())),
86
- ...(result.failure === undefined
87
- ? []
88
- : [
89
- `! ${result.failure.kind} · ${safeText(result.failure.diagnostic)}`,
90
- ...(result.failure.attemptedTellId === undefined
91
- ? []
92
- : [`attempted input ${safeText(result.failure.attemptedTellId)}`]),
93
- ]),
90
+ ...(result.kind === "failed" ? callFailureLines(result.failures, context) : []),
94
91
  ];
95
92
  }
96
93
  export function renderCallText(result, streamed, context, input = {}) {
97
94
  if (streamed)
98
95
  return "";
99
96
  const head = callObservationHead(result, input);
100
- if (result.input !== undefined && result.failure === undefined) {
101
- const stream = inputWaitStream(context, () => head, { cursor: "empty", now: () => context.now });
102
- stream.admitted({ rows: [] });
103
- return [
104
- stream.conclude({ kind: "observed", observation: result.input }),
105
- ...subordinateLines(tellControlLines(result, context)),
106
- ].join("\n");
97
+ if (result.input !== undefined) {
98
+ const stream = callObservationStream(context, head, { now: () => context.now });
99
+ return [stream.conclude(result), ...(result.input.kind === "answered" ? [result.input.answer] : [])].join("\n");
107
100
  }
108
- const failed = result.failure !== undefined ||
109
- result.dispatchFailure !== undefined ||
110
- (result.alias !== undefined && result.alias.kind !== "moved");
111
101
  return actionReceipt({
112
- mark: failed ? "!" : "✓",
102
+ mark: result.kind === "failed" ? "!" : "✓",
113
103
  verb: "spawned",
114
104
  id: result.akumaId,
115
105
  ...(head.alias === undefined ? {} : { alias: head.alias }),
@@ -132,7 +122,7 @@ export function renderFailedCallObservation(result, context, input = {}) {
132
122
  }
133
123
  export function renderForkText(receipt, input) {
134
124
  const parent = receipt.parentAkumaId ?? input.akuma;
135
- if (receipt.kind !== "forked") {
125
+ if (receipt.kind !== "forked" && receipt.kind !== "failed") {
136
126
  const reason = receipt.kind === "unknown-history"
137
127
  ? `${input.at} has no matching retained answered turn`
138
128
  : receipt.kind === "provider-cannot-fork"
@@ -142,13 +132,16 @@ export function renderForkText(receipt, input) {
142
132
  return actionReceipt({ mark: "!", verb: "fork", id: parent, evidence: [reason, ...session] }).join("\n");
143
133
  }
144
134
  return actionReceipt({
145
- mark: receipt.dispatchFailure === undefined ? "✓" : "!",
135
+ mark: receipt.kind === "forked" ? "✓" : "!",
146
136
  verb: "forked",
147
137
  id: receipt.childAkumaId,
148
138
  evidence: [
149
139
  `from ${parent}`,
150
- ...(receipt.dispatchFailure === undefined ? [] : [dispatchFailureLine(receipt.dispatchFailure)]),
151
- ...(receipt.dispatchWarning === undefined ? [] : [`dispatch lag ${safeText(receipt.dispatchWarning)}`]),
140
+ ...(receipt.kind === "failed"
141
+ ? callFailureLines([receipt.failure], { columns: 100, color: false })
142
+ : receipt.dispatchWarning === undefined
143
+ ? []
144
+ : [`dispatch lag ${safeText(receipt.dispatchWarning)}`]),
152
145
  ],
153
146
  }).join("\n");
154
147
  }
@@ -1,6 +1,3 @@
1
- import type { AkumaList } from "../../akuma/akuma.js";
2
- import type { AkumaCaller } from "../../akuma/caller.js";
3
- import type { ArchetypeCatalog, ContractCatalogue } from "../../index.js";
4
- export declare function renderAkumaCatalogue(list: AkumaList, akumaName: string | null, caller?: AkumaCaller): string;
1
+ import type { AkumaNameCatalog, ContractCatalogue } from "../../index.js";
5
2
  export declare function renderContractCatalogue(list: ContractCatalogue): string;
6
- export declare function renderArchetypeCatalogue(list: ArchetypeCatalog): string;
3
+ export declare function renderAkumaNameCatalogue(list: AkumaNameCatalog): string;
@@ -1,37 +1,6 @@
1
1
  import { contractAttentionFacts, progressStrip } from "./contract-observation.js";
2
2
  import { ageText, emptyCatalogue, safeText } from "./terminal.js";
3
- import { akumaMark, contractMark } from "./marks.js";
4
- function relativeAge(source, observedAt) {
5
- return source === undefined ? null : ageText(source, observedAt);
6
- }
7
- function akumaAgeFacts(row, observedAt) {
8
- const lifeAge = relativeAge("lifeAt" in row ? row.lifeAt : undefined, observedAt);
9
- const activityAge = relativeAge("lastActivityAt" in row ? row.lastActivityAt : undefined, observedAt);
10
- return [
11
- ...(lifeAge === null ? [] : [lifeAge]),
12
- ...(activityAge === null || activityAge === lifeAge ? [] : [`activity ${activityAge}`]),
13
- ];
14
- }
15
- function akumaCatalogueRow(row, observedAt, root) {
16
- const ages = akumaAgeFacts(row, observedAt);
17
- const aliases = row.aliases === undefined ? "" : ` (${row.aliases.map((alias) => safeText(alias)).join(" ")})`;
18
- const by = root !== undefined && "parentAkumaId" in row && row.parentAkumaId !== undefined && row.parentAkumaId !== root
19
- ? ` · by ${safeText(row.parentAkumaId)}`
20
- : "";
21
- return `${akumaMark(row.life)} ${safeText(row.id)}${aliases} · ${row.life}${ages.length === 0 ? "" : ` · ${ages.join(" · ")}`}${by}`;
22
- }
23
- export function renderAkumaCatalogue(list, akumaName, caller) {
24
- const rows = list.rows ?? [];
25
- if (rows.length === 0)
26
- return emptyCatalogue("akuma");
27
- const root = caller === undefined ? undefined : caller.kind === "akuma" ? caller.akumaId : "external";
28
- return [
29
- akumaName === null ? "AKUMA // recent" : `AKUMA // ${safeText(akumaName)}`,
30
- "",
31
- ...rows.map((row) => akumaCatalogueRow(row, list.observedAt, root)),
32
- ...(list.more === true ? ["…"] : []),
33
- ].join("\n");
34
- }
3
+ import { contractMark } from "./marks.js";
35
4
  function formatAge(source, observedAt) {
36
5
  return ageText(source, observedAt, "future");
37
6
  }
@@ -51,7 +20,7 @@ export function renderContractCatalogue(list) {
51
20
  ...(list.more === true ? ["…"] : []),
52
21
  ].join("\n");
53
22
  }
54
- export function renderArchetypeCatalogue(list) {
23
+ export function renderAkumaNameCatalogue(list) {
55
24
  const rows = list.rows ?? [];
56
25
  if (rows.length === 0)
57
26
  return emptyCatalogue("akuma names");
@@ -116,8 +116,7 @@ function semanticBody(event) {
116
116
  /** Full mode exposes supplied historical facts, never a current-state reread. */
117
117
  function fullEventLines(event) {
118
118
  const identity = event.kind === "dispatch" ? event.akumaId : event.id;
119
- const actor = event.kind !== "dispatch" && event.actor !== undefined ? ` · ${event.actor}` : "";
120
- const header = `${event.at} ${event.kind} · ${identity}${actor}`;
119
+ const header = `${event.at} ${event.kind} · ${identity}`;
121
120
  const detail = [
122
121
  ...semanticBody(event),
123
122
  ...(event.kind === "bind" || event.kind === "amend"
@@ -17,13 +17,6 @@ export declare function gateGlyph(report: Readonly<{
17
17
  verdict?: string;
18
18
  };
19
19
  }>): string;
20
- export declare function gateFact(report: Readonly<{
21
- gate: string;
22
- current: {
23
- kind: string;
24
- verdict?: string;
25
- };
26
- }>): string;
27
20
  export declare function requirementDisplayName(gate: string, requirement: Readonly<{
28
21
  requirement?: string | undefined;
29
22
  index?: number | undefined;
@@ -64,9 +64,6 @@ export function gateGlyph(report) {
64
64
  return "○";
65
65
  return report.current.verdict === "satisfied" ? "✓" : "×";
66
66
  }
67
- export function gateFact(report) {
68
- return `${gateGlyph(report)} ${gateDisplayName(report.gate)}${report.current.kind === "stale" ? " · stale" : ""}`;
69
- }
70
67
  export function requirementDisplayName(gate, requirement) {
71
68
  const name = gateDisplayName(gate);
72
69
  if (gate === "verified")
@@ -1,12 +1,10 @@
1
- import type { z, abandonOutcomeSchema, amendOutcomeSchema, arcOutcomeSchema, bindOutcomeSchema, deliverOutcomeSchema, reviewOutcomeSchema, verifyOutcomeSchema, ContractId, InvocationIssue } from "../../index.js";
1
+ import type { AbandonOutcome, AmendOutcome, ArcOutcome, BindOutcome as NativeBindOutcome, DeliverOutcome, ReviewOutcome, VerifyOutcome, ContractId, InvocationIssue } from "../../index.js";
2
2
  import { type TextRenderContext } from "./terminal.js";
3
- type BindOutcome = z.output<typeof bindOutcomeSchema>;
4
- type AmendOutcome = z.output<typeof amendOutcomeSchema>;
5
- type ArcOutcome = z.output<typeof arcOutcomeSchema>;
6
- type AbandonOutcome = z.output<typeof abandonOutcomeSchema>;
7
- type DeliverOutcome = z.output<typeof deliverOutcomeSchema>;
8
- type ReviewOutcome = z.output<typeof reviewOutcomeSchema>;
9
- type VerifyOutcome = z.output<typeof verifyOutcomeSchema>;
3
+ type BindOutcome = Exclude<NativeBindOutcome, {
4
+ kind: "accepted";
5
+ }> | Omit<Extract<NativeBindOutcome, {
6
+ kind: "accepted";
7
+ }>, "kei">;
10
8
  type ContractAnswers = {
11
9
  bind: BindOutcome;
12
10
  amend: AmendOutcome;
@@ -41,7 +39,7 @@ type IssuePresentation = Readonly<{
41
39
  export declare function contractIssueLines(result: ContractReceipt, columns: number, presentation?: IssuePresentation): readonly string[];
42
40
  /** The operation and supplied input stay renderer context, never fields manufactured on the native result. */
43
41
  export declare function renderAccepted<K extends ContractMutationName>(operation: K, result: AcceptedOf<K>, context?: TextRenderContext, input?: PresentationInput): string;
44
- export declare function renderRetry(operation: ContractMutationName | "deliver.preview", result: Extract<ContractOutcome, {
42
+ export declare function renderRetry(operation: ContractMutationName | "deliver --dry-run", result: Extract<ContractOutcome, {
45
43
  kind: "retry";
46
44
  }>, context?: TextRenderContext): string;
47
45
  export { renderContractHistory } from "./contract-history.js";
@@ -1,4 +1,4 @@
1
- import { gatesAwaitLines, placementLines, receiptPayload, receiptRow, recoverySnapshotLines, stopLines, titleLines, verificationCheckLines, outcomeLines, } from "./receipt.js";
1
+ import { deliveryIdentityRows, gatesAwaitLines, targetMovementRows, receiptPayload, receiptRow, recoverySnapshotLines, stopLines, titleLines, verificationCheckLines, outcomeLines, } from "./receipt.js";
2
2
  import { abbreviateGitIds, displayGitId } from "./contract-observation.js";
3
3
  import { DEFAULT_CLI_COLUMNS, quotedText, renderOpaqueBlock, safeText, tone, } from "./terminal.js";
4
4
  function words(kind) {
@@ -57,24 +57,12 @@ function retainedIssueRows(issue, columns) {
57
57
  function residualIssueRows(issue, columns) {
58
58
  const lines = [];
59
59
  switch (issue.kind) {
60
- case "decode-channel-retirement":
61
- receiptPayload(lines, "cleanup", issue.diagnostic);
62
- return lines;
63
- case "verification-cleanup":
60
+ case "diagnostic":
64
61
  lines.push(...cleanupResourceRows(issue, columns));
65
- receiptRow(lines, "!", "cleanup", [{ text: `name ${quotedText(issue.name)}` }], columns);
66
- receiptPayload(lines, "reason", issue.diagnostic);
67
- return lines;
68
- case "worktree-leak":
69
- lines.push(...cleanupResourceRows(issue, columns));
70
- if (issue.path === undefined)
71
- receiptRow(lines, " ", "verification scratch not retained", [], columns);
72
- else
73
- receiptRow(lines, " ", "verification scratch kept at", [{ text: issue.path, opaque: true }], columns);
74
- receiptPayload(lines, "reason", issue.diagnostic);
75
- return lines;
76
- case "private-state-seat-close":
77
- receiptRow(lines, "!", "lag", [{ text: "private-state-seat-close-failed", opaque: true }], columns);
62
+ receiptRow(lines, issue.severity === "required" ? "!" : " ", issue.severity === "required" ? "stopped" : "residue", [
63
+ ...(issue.name === undefined ? [] : [{ text: `name ${quotedText(issue.name)}` }]),
64
+ ...(issue.path === undefined ? [] : [{ text: issue.path, opaque: true }]),
65
+ ], columns);
78
66
  receiptPayload(lines, "reason", issue.diagnostic);
79
67
  return lines;
80
68
  case "execution-stopped":
@@ -210,60 +198,42 @@ function amend(result, columns, color) {
210
198
  lines.push(...deviations(result, columns, color), ...contractIssueLines(result, columns, { mode: "receipt" }), ...recoverySnapshotLines(result.recoverySnapshots, columns, result.contractId));
211
199
  return lines.join("\n");
212
200
  }
213
- function placedIntegration(placement, fallback) {
214
- return placement.integration ?? fallback;
215
- }
216
- function placedMovementLines(placement, integration, columns) {
217
- if (placement.target === undefined)
218
- return [];
219
- const ids = abbreviateGitIds([placement.predecessor ?? "", integration]);
220
- const lines = [];
221
- const movement = placement.predecessor === undefined
222
- ? displayGitId(integration, ids)
223
- : `${displayGitId(placement.predecessor, ids)}..${displayGitId(integration, ids)}`;
224
- receiptRow(lines, " ", "target", [{ text: movement }, { text: placement.target, opaque: true }], columns);
225
- receiptRow(lines, "✓", "accepted", [], columns);
226
- return lines;
227
- }
228
- function continuationLines(continuation, columns) {
201
+ function continuationLines(continuation, columns, surface) {
229
202
  if (continuation === undefined)
230
203
  return [];
231
204
  const lines = [];
232
205
  for (const contractId of continuation.claimed ?? [])
233
206
  receiptRow(lines, "✓", "dependent", [{ text: "complete" }, { text: contractId, opaque: true }], columns);
234
- for (const stop of continuation.stopped ?? []) {
235
- if (stop.kind === "already-terminal")
236
- receiptRow(lines, "!", stop.contractId, [{ text: "already terminal" }], columns);
237
- else if (stop.kind === "physical-lag")
238
- receiptRow(lines, "!", "dependent", [{ text: stop.contractId, opaque: true }, { text: "physical follow stopped" }], columns);
239
- else
240
- lines.push(...stopLines(stop, columns, stop.contractId, stop.contractId));
241
- }
207
+ for (const { contractId, stop } of continuation.stopped ?? [])
208
+ lines.push(...stopLines(stop, columns, contractId, contractId, surface));
242
209
  return lines;
243
210
  }
244
- function completionPlacementLines(result, columns) {
211
+ function completionPlacementLines(result, columns, surface) {
245
212
  const placement = result.placement;
246
213
  if (placement === undefined)
247
214
  return [];
248
215
  if (placement.kind !== "placed")
249
- return placementLines(placement, columns, result.contractId);
216
+ return stopLines(placement, columns, result.contractId, undefined, surface);
250
217
  const fallback = "integration" in result ? result.integration : undefined;
251
- const integration = placedIntegration(placement, fallback);
252
- if (integration === undefined)
218
+ const integration = ("integration" in placement ? placement.integration : undefined) ?? fallback;
219
+ if (integration === undefined || placement.target === undefined)
253
220
  return [];
254
- return placedMovementLines(placement, integration, columns);
221
+ const lines = [];
222
+ targetMovementRows(lines, { ...placement, integration }, columns);
223
+ receiptRow(lines, "✓", "accepted", [], columns);
224
+ return lines;
255
225
  }
256
- function trailingPlacementLines(result, columns) {
226
+ function trailingPlacementLines(result, columns, surface) {
257
227
  const placement = result.placement;
258
228
  return [
259
- ...completionPlacementLines(result, columns),
260
- ...continuationLines(result.continuation, columns),
229
+ ...completionPlacementLines(result, columns, surface),
230
+ ...continuationLines(result.continuation, columns, surface),
261
231
  ...recoverySnapshotLines(result.recoverySnapshots, columns, result.contractId),
262
232
  ...contractIssueLines(result, columns, { mode: "receipt", follow: placement !== undefined }),
263
233
  ...gatesAwaitLines(placement?.kind === "placed" ? undefined : placement),
264
234
  ];
265
235
  }
266
- function deliver(result, columns, input) {
236
+ function deliver(result, columns, input, surface) {
267
237
  const lines = titleLines("✓", "delivered", result.contractId, columns);
268
238
  const placement = result.placement;
269
239
  const ids = abbreviateGitIds([
@@ -272,19 +242,20 @@ function deliver(result, columns, input) {
272
242
  result.contentId,
273
243
  result.previousContentId ?? "",
274
244
  placement?.kind === "placed" ? (placement.predecessor ?? "") : "",
275
- placement?.kind === "placed" ? (placedIntegration(placement, result.integration) ?? "") : "",
245
+ placement?.kind === "placed" ? (placement.integration ?? result.integration) : "",
276
246
  ]);
277
247
  if (result.admission === "reused")
278
248
  receiptRow(lines, " ", "admission", [{ text: "reused" }], columns);
279
- receiptRow(lines, " ", "candidate", [{ text: `${displayGitId(result.candidate, ids)}${placement?.kind === "placed" ? "" : " · kept"}`, opaque: true }], columns);
280
- receiptRow(lines, " ", "integration result", [{ text: displayGitId(result.integration, ids), opaque: true }], columns);
281
- if (!/^0{40}$/u.test(result.contentId))
282
- receiptRow(lines, " ", "content identity", [{ text: displayGitId(result.contentId, ids), opaque: true }], columns);
249
+ deliveryIdentityRows(lines, {
250
+ candidate: `${displayGitId(result.candidate, ids)}${placement?.kind === "placed" ? "" : " · kept"}`,
251
+ integration: displayGitId(result.integration, ids),
252
+ contentId: /^0{40}$/u.test(result.contentId) ? undefined : displayGitId(result.contentId, ids),
253
+ }, columns);
283
254
  if (result.previousContentId !== undefined)
284
255
  receiptRow(lines, " ", "candidate content changed", [{ text: `previous ${displayGitId(result.previousContentId, ids)}`, opaque: true }], columns);
285
256
  if (input.message !== undefined && result.admission !== "reused")
286
257
  receiptPayload(lines, "note", input.message);
287
- lines.push(...trailingPlacementLines(result, columns));
258
+ lines.push(...trailingPlacementLines(result, columns, surface));
288
259
  return lines.join("\n");
289
260
  }
290
261
  function worktreeChangeLines(result, columns) {
@@ -294,16 +265,16 @@ function worktreeChangeLines(result, columns) {
294
265
  receiptRow(lines, " ", field === "unmergedPaths" ? "unmerged" : field, [{ text: path, opaque: true }], columns);
295
266
  return lines;
296
267
  }
297
- function review(result, columns, input) {
268
+ function review(result, columns, input, surface) {
298
269
  if (input.verdict === undefined)
299
270
  throw new Error("review renderer requires its invocation verdict");
300
271
  const lines = titleLines("✓", `review ${input.verdict}`, result.contractId, columns);
301
- lines.push(...worktreeChangeLines(result, columns), ...trailingPlacementLines(result, columns));
272
+ lines.push(...worktreeChangeLines(result, columns), ...trailingPlacementLines(result, columns, surface));
302
273
  return lines.join("\n");
303
274
  }
304
- function verify(result, columns) {
275
+ function verify(result, columns, surface) {
305
276
  const lines = titleLines("✓", "verify", result.contractId, columns);
306
- lines.push(...verificationCheckLines(result.checks, result.snapshot, columns, result.contractId), ...trailingPlacementLines(result, columns));
277
+ lines.push(...verificationCheckLines(result.checks, result.snapshot, columns, result.contractId, surface), ...trailingPlacementLines(result, columns, surface));
307
278
  return lines.join("\n");
308
279
  }
309
280
  /** The operation and supplied input stay renderer context, never fields manufactured on the native result. */
@@ -315,11 +286,11 @@ export function renderAccepted(operation, result, context, input = {}) {
315
286
  case "amend":
316
287
  return amend(result, columns, context?.color === true);
317
288
  case "deliver":
318
- return deliver(result, columns, input);
289
+ return deliver(result, columns, input, context?.surface);
319
290
  case "review":
320
- return review(result, columns, input);
291
+ return review(result, columns, input, context?.surface);
321
292
  case "verify":
322
- return verify(result, columns);
293
+ return verify(result, columns, context?.surface);
323
294
  case "arc": {
324
295
  const arc = result;
325
296
  return [
@@ -1,19 +1,11 @@
1
- import type { BlockedDebtRow, DebtAbsent, DebtBatchResult, DebtCatalogue, DebtContextResult, DebtDoctorReport, DebtMutationResult, DebtParentReadRefusal, DebtReadPage, DebtReadRefusal, DebtShowResult, DebtSummary, DebtTreeResult, DebtUpdateResult, ReadyDebtRow } from "../../debt/index.js";
1
+ import type { DebtAbsent, DebtCatalogue, DebtDoctorReport, DebtMutationResult, DebtShowResult, DebtUpdateResult } from "../../debt/index.js";
2
2
  import { type TextRenderContext } from "./terminal.js";
3
3
  export { debtMark } from "./marks.js";
4
- /** Presentation-only list scope the leaf acquired; never part of a product value. */
5
- export type DebtListScope = "world" | "current" | Readonly<{
6
- namespace: string;
7
- }>;
8
4
  export declare function dispositionText(word: string): string;
9
- export declare function debtFrameHead(view: string, scope: string): string;
10
- export declare function renderDebtList(action: "ls" | "ready" | "blocked" | "query", scope: DebtListScope, result: DebtCatalogue | DebtReadPage<DebtSummary | BlockedDebtRow | ReadyDebtRow, DebtReadRefusal | DebtParentReadRefusal>, context?: TextRenderContext): string;
5
+ export declare function renderDebtList(result: DebtCatalogue, context?: TextRenderContext): string;
11
6
  /** Each item corresponds to the same invocation position, including missing targets. */
12
- export declare function renderDebtShow(ids: readonly string[], result: DebtShowResult | DebtAbsent, context?: TextRenderContext): string;
7
+ export declare function renderDebtShow(result: DebtShowResult | DebtAbsent, context?: TextRenderContext): string;
13
8
  export declare function renderDoctor(report: DebtDoctorReport | DebtAbsent): string;
14
9
  export declare function renderDebtUpdate(id: string | undefined, result: DebtUpdateResult, context?: TextRenderContext): string;
15
- export declare function renderDebtTree(id: string, result: DebtTreeResult | DebtAbsent, context?: TextRenderContext): string;
16
- export declare function renderDebtContext(result: DebtContextResult, context?: TextRenderContext): string;
17
10
  /** Creation retains its minted identity in the native answer. */
18
11
  export declare function renderDebtMutation(verb: string, result: DebtMutationResult, context?: TextRenderContext): string;
19
- export declare function renderDebtLifecycle(verb: string, ids: readonly string[], result: DebtBatchResult, context?: TextRenderContext): string;
@@ -1,5 +1,5 @@
1
1
  import { debtMark } from "./marks.js";
2
- import { outcomeLines, receiptPayload, receiptRow, refusalLines } from "./receipt.js";
2
+ import { outcomeLines, receiptRow, refusalLines } from "./receipt.js";
3
3
  import { DEFAULT_CLI_COLUMNS, displayColumns, emptyCatalogue, renderOpaqueBlock, renderTextBlock, safeText, } from "./terminal.js";
4
4
  export { debtMark } from "./marks.js";
5
5
  const DEFAULT_CONTEXT = { columns: DEFAULT_CLI_COLUMNS, color: false };
@@ -22,13 +22,7 @@ function entityLines(entity, columns, indent = "") {
22
22
  function projectRefusal(refusal) {
23
23
  const diagnostic = refusal.reason.replaceAll("-", " ");
24
24
  if (refusal.reason === "debt-missing")
25
- return { diagnostic, ...("debtId" in refusal ? { facts: [`debt ${refusal.debtId}`] } : {}) };
26
- if (refusal.reason === "invalid-lifecycle-transition")
27
- return { diagnostic, facts: [`state ${dispositionText(refusal.state)}`] };
28
- if (refusal.reason === "invalid-namespace-context")
29
- return { diagnostic, ...(refusal.path === undefined ? {} : { facts: [`path ${refusal.path}`] }) };
30
- if (refusal.reason === "relation-owned-by-other")
31
- return { diagnostic, facts: [`related debt ${refusal.related}`] };
25
+ return { diagnostic };
32
26
  return { diagnostic, facts: [`detail ${refusal.diagnostic}`] };
33
27
  }
34
28
  function renderFailure(verb, result, columns, id) {
@@ -44,44 +38,18 @@ function warningLines(warning, columns) {
44
38
  function edge(label, ref) {
45
39
  return ` ${label} ${ref.id} · ${dispositionText(ref.state)}`;
46
40
  }
47
- export function debtFrameHead(view, scope) {
48
- return `${view.toUpperCase()} // ${scope}`;
49
- }
50
- function renderListRow(item, columns, action) {
51
- const disposition = "disposition" in item ? item.disposition : action === "blocked" ? "blocked" : "ready";
52
- const lines = [
53
- ...entityLines({
54
- ...item,
55
- mark: debtMark(disposition),
56
- ...(action === "ready" || action === "blocked" ? {} : { word: disposition }),
57
- }, columns),
58
- ];
59
- if ("blockers" in item)
60
- for (const blocker of item.blockers)
61
- lines.push(` needs ${blocker.id} · ${blocker.missing === true ? "missing" : "open"}`);
62
- return lines;
63
- }
64
- export function renderDebtList(action, scope, result, context = DEFAULT_CONTEXT) {
41
+ export function renderDebtList(result, context = DEFAULT_CONTEXT) {
65
42
  const page = result;
66
43
  const columns = context.columns;
67
- if (page.kind === "absent")
44
+ if ("absent" in page)
68
45
  return "debt world absent";
69
- if (page.kind === "invalid-namespace-context")
70
- return refusalLines(action, ["reason invalid namespace context", `path ${page.path}`], columns).join("\n");
71
- if (page.kind === "refused")
72
- return renderFailure(action, page, columns);
73
46
  const rows = page.rows ?? [];
74
- const view = action === "ls" ? "debts" : action;
47
+ const view = "debts";
75
48
  if (rows.length === 0)
76
49
  return emptyCatalogue(view);
77
- const scopeText = scope === "world"
78
- ? "world"
79
- : scope === "current"
80
- ? "current namespace"
81
- : `namespace ${scope.namespace.replace(/^debt\//u, "").replace(/\/$/u, "") || "root"}`;
82
50
  return [
83
- debtFrameHead(view, scopeText),
84
- ...rows.flatMap((row) => renderListRow(row, columns, action)),
51
+ "DEBTS // world",
52
+ ...rows.flatMap((row) => entityLines({ ...row, mark: debtMark(row.disposition), word: row.disposition }, columns)),
85
53
  ...(page.more === true ? ["…"] : []),
86
54
  ].join("\n");
87
55
  }
@@ -93,41 +61,26 @@ function renderShowDetail(id, debt, columns) {
93
61
  ...entityLines({ id, priority: debt.priority, mark: debtMark(debt.state), word: debt.state, title: debt.title }, columns),
94
62
  ` created ${textTimestamp(debt.createdAt)}`,
95
63
  ` updated ${textTimestamp(debt.updatedAt)}`,
96
- ...(debt.createdBy === undefined ? [] : [` created by ${debt.createdBy}`]),
97
64
  ];
98
65
  for (const need of debt.needs ?? [])
99
66
  lines.push(edge("needs", need));
100
- if (debt.parent !== undefined)
101
- lines.push(edge("parent", debt.parent));
102
- for (const item of debt.supersedes ?? [])
103
- lines.push(edge("supersedes", item));
104
- for (const item of debt.relates ?? [])
105
- lines.push(edge("relates", item));
106
- if (debt.note !== undefined)
107
- receiptPayload(lines, "note", debt.note);
108
- if (debt.body !== undefined)
109
- receiptPayload(lines, "body", debt.body);
67
+ for (const label of ["note", "body"]) {
68
+ const payload = debt[label];
69
+ if (payload !== undefined)
70
+ lines.push(` ${label}`, ...payload.split("\n").map((line) => ` ${safeText(line)}`), "");
71
+ }
110
72
  return lines.join("\n");
111
73
  }
112
74
  /** Each item corresponds to the same invocation position, including missing targets. */
113
- export function renderDebtShow(ids, result, context = DEFAULT_CONTEXT) {
75
+ export function renderDebtShow(result, context = DEFAULT_CONTEXT) {
114
76
  if (result.kind === "absent")
115
77
  return "debt world absent";
116
78
  return result.items
117
- .map((item, index) => item.kind === "found"
118
- ? renderShowDetail(ids[index], item, context.columns)
119
- : refusalLines("show", ["reason debt missing", `debt ${ids[index]}`], context.columns).join("\n"))
79
+ .map((item) => item.kind === "found"
80
+ ? renderShowDetail(item.id, item, context.columns)
81
+ : refusalLines("show", ["reason debt missing", `debt ${item.id}`], context.columns).join("\n"))
120
82
  .join("\n\n");
121
83
  }
122
- function treeLines(id, node, columns, depth = 0) {
123
- const indent = " ".repeat(depth);
124
- if ("kind" in node && node.kind === "cycle")
125
- return [`${indent}! ${node.id} · cycle`];
126
- return [
127
- ...entityLines({ id, priority: node.priority, mark: debtMark(node.state), word: node.state, title: node.title }, columns, indent),
128
- ...(node.children ?? []).flatMap((child) => treeLines(child.id, child, columns, depth + 1)),
129
- ];
130
- }
131
84
  function doctorIssue(issue) {
132
85
  if (issue.kind === "missing-target")
133
86
  return `! missing-target ${issue.debtId} ${issue.relation} ${issue.target}`;
@@ -143,7 +96,7 @@ export function renderDoctor(report) {
143
96
  const noun = report.issues.length === 1 ? "issue" : "issues";
144
97
  return [`! doctor ${report.issues.length} ${noun}`, ...report.issues.map(doctorIssue)].join("\n");
145
98
  }
146
- const PAST_VERBS = { add: "added", done: "done", drop: "dropped", update: "updated" };
99
+ const PAST_VERBS = { add: "added", update: "updated" };
147
100
  export function renderDebtUpdate(id, result, context = DEFAULT_CONTEXT) {
148
101
  const columns = context.columns;
149
102
  if (result.kind !== "accepted")
@@ -156,27 +109,6 @@ export function renderDebtUpdate(id, result, context = DEFAULT_CONTEXT) {
156
109
  lines.push(...warningLines(result.warning, columns));
157
110
  return lines.join("\n");
158
111
  }
159
- function renderBatchItem(verb, id, item, columns) {
160
- if (item.kind !== "accepted")
161
- return renderFailure(verb, item, columns, id).split("\n");
162
- return [
163
- `✓ ${PAST_VERBS[verb] ?? verb} ${id}`,
164
- ...(item.warning === undefined ? [] : warningLines(item.warning, columns)),
165
- ];
166
- }
167
- export function renderDebtTree(id, result, context = DEFAULT_CONTEXT) {
168
- if (result.kind === "absent")
169
- return "debt world absent";
170
- if (result.kind === "missing")
171
- return refusalLines("tree", ["reason debt missing", `debt ${id}`], context.columns).join("\n");
172
- return treeLines(id, result, context.columns).join("\n");
173
- }
174
- export function renderDebtContext(result, context = DEFAULT_CONTEXT) {
175
- if (result.kind === "refused")
176
- return refusalLines("context", ["reason invalid namespace context", `path ${result.path}`], context.columns).join("\n");
177
- const value = "namespace" in result ? (result.namespace ?? "root") : "root";
178
- return `context ${value} · ${result.source}`;
179
- }
180
112
  /** Creation retains its minted identity in the native answer. */
181
113
  export function renderDebtMutation(verb, result, context = DEFAULT_CONTEXT) {
182
114
  if (result.kind !== "accepted")
@@ -187,6 +119,3 @@ export function renderDebtMutation(verb, result, context = DEFAULT_CONTEXT) {
187
119
  lines.push(...warningLines(result.warning, context.columns));
188
120
  return lines.join("\n");
189
121
  }
190
- export function renderDebtLifecycle(verb, ids, result, context = DEFAULT_CONTEXT) {
191
- return result.items.flatMap((item, index) => renderBatchItem(verb, ids[index], item, context.columns)).join("\n");
192
- }