@astrosheep/keiyaku 4.6.29 → 4.6.31

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 (400) hide show
  1. package/README.md +5 -5
  2. package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
  3. package/build/plugins/claude/skills/keiyaku/SKILL.md +24 -24
  4. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +44 -168
  5. package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +61 -231
  6. package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +47 -58
  7. package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +44 -185
  8. package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +40 -89
  9. package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +56 -116
  10. package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
  11. package/build/plugins/codex/skills/keiyaku/SKILL.md +24 -24
  12. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +44 -168
  13. package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +61 -231
  14. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +47 -58
  15. package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +44 -185
  16. package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +40 -89
  17. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +56 -116
  18. package/build/plugins/opencode/package.json +1 -1
  19. package/build/plugins/opencode/skills/keiyaku/SKILL.md +24 -24
  20. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +44 -168
  21. package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +61 -231
  22. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +47 -58
  23. package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +44 -185
  24. package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +40 -89
  25. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +56 -116
  26. package/build/plugins/pi/README.md +5 -5
  27. package/build/plugins/pi/akuma-tools.ts +17 -23
  28. package/build/skills/keiyaku/SKILL.md +24 -24
  29. package/build/skills/keiyaku-akuma/SKILL.md +44 -168
  30. package/build/skills/keiyaku-akuma/references/automation.md +61 -231
  31. package/build/skills/keiyaku-babysit/SKILL.md +47 -58
  32. package/build/skills/keiyaku-bind/SKILL.md +44 -185
  33. package/build/skills/keiyaku-debt/SKILL.md +40 -89
  34. package/build/skills/keiyaku-workflow/SKILL.md +56 -116
  35. package/build/src/akuma/akuma-call.d.ts +1 -1
  36. package/build/src/akuma/akuma-call.js +9 -9
  37. package/build/src/akuma/akuma-errors.d.ts +5 -5
  38. package/build/src/akuma/akuma-instance.d.ts +355 -12
  39. package/build/src/akuma/akuma-instance.js +20 -20
  40. package/build/src/akuma/akuma-observe.d.ts +11 -12
  41. package/build/src/akuma/akuma-observe.js +34 -26
  42. package/build/src/akuma/akuma-owner.d.ts +32 -11
  43. package/build/src/akuma/akuma-owner.js +35 -16
  44. package/build/src/akuma/akuma-probe.d.ts +3 -3
  45. package/build/src/akuma/akuma-probe.js +2 -2
  46. package/build/src/akuma/akuma-selection-execution.d.ts +985 -1
  47. package/build/src/akuma/akuma-selection-execution.js +42 -18
  48. package/build/src/akuma/akuma-stream.d.ts +2 -2
  49. package/build/src/akuma/akuma-stream.js +1 -1
  50. package/build/src/akuma/akuma-wait.d.ts +5 -5
  51. package/build/src/akuma/akuma-wait.js +52 -14
  52. package/build/src/akuma/akuma.d.ts +245 -271
  53. package/build/src/akuma/akuma.js +98 -46
  54. package/build/src/akuma/archetype.d.ts +19 -6
  55. package/build/src/akuma/archetype.js +25 -9
  56. package/build/src/akuma/body-launch.d.ts +2 -2
  57. package/build/src/akuma/body.js +4 -4
  58. package/build/src/akuma/call-initial-tell.d.ts +60 -44
  59. package/build/src/akuma/call-initial-tell.js +41 -2
  60. package/build/src/akuma/caller.d.ts +26 -17
  61. package/build/src/akuma/caller.js +22 -9
  62. package/build/src/akuma/coordinate.d.ts +9 -0
  63. package/build/src/akuma/coordinate.js +13 -0
  64. package/build/src/akuma/detached-body.js +2 -2
  65. package/build/src/akuma/dispatch-association.d.ts +4 -4
  66. package/build/src/akuma/dispatch-association.js +12 -3
  67. package/build/src/akuma/execution-instructions.js +2 -2
  68. package/build/src/akuma/heart/facts.d.ts +29 -7
  69. package/build/src/akuma/heart/facts.js +13 -0
  70. package/build/src/akuma/heart/index.d.ts +0 -3
  71. package/build/src/akuma/heart/index.js +3 -6
  72. package/build/src/akuma/heart/rows.js +2 -2
  73. package/build/src/akuma/heart/soul.js +5 -5
  74. package/build/src/akuma/identity.d.ts +17 -16
  75. package/build/src/akuma/identity.js +20 -19
  76. package/build/src/akuma/index.d.ts +1 -2
  77. package/build/src/akuma/lineage-cache.d.ts +4 -4
  78. package/build/src/akuma/lineage-cache.js +10 -10
  79. package/build/src/akuma/projection-read.d.ts +2 -5
  80. package/build/src/akuma/projection-read.js +34 -47
  81. package/build/src/akuma/projection.d.ts +659 -569
  82. package/build/src/akuma/projection.js +203 -94
  83. package/build/src/akuma/providers/acp/index.js +1 -1
  84. package/build/src/akuma/providers/execution-environment.d.ts +1 -3
  85. package/build/src/akuma/providers/execution-environment.js +0 -4
  86. package/build/src/akuma/publication.d.ts +2 -2
  87. package/build/src/akuma/publication.js +3 -3
  88. package/build/src/akuma/retention.js +2 -2
  89. package/build/src/akuma/selection-observation.d.ts +507 -43
  90. package/build/src/akuma/selection-observation.js +153 -1
  91. package/build/src/akuma/status-projection.d.ts +288 -0
  92. package/build/src/akuma/status-projection.js +154 -0
  93. package/build/src/akuma/turn-drive.js +0 -3
  94. package/build/src/alias/index.d.ts +9 -4
  95. package/build/src/alias/index.js +11 -9
  96. package/build/src/bounded-list.d.ts +8 -0
  97. package/build/src/bounded-list.js +9 -0
  98. package/build/src/cli/commands/akuma-grammar.d.ts +2 -2
  99. package/build/src/cli/commands/akuma-grammar.js +21 -21
  100. package/build/src/cli/commands/akuma.d.ts +1 -2
  101. package/build/src/cli/commands/akuma.js +115 -251
  102. package/build/src/cli/commands/contract-grammar.d.ts +4 -3
  103. package/build/src/cli/commands/contract-grammar.js +39 -22
  104. package/build/src/cli/commands/contract-help.d.ts +3 -1
  105. package/build/src/cli/commands/contract-help.js +4 -3
  106. package/build/src/cli/commands/contract.d.ts +6 -3
  107. package/build/src/cli/commands/contract.js +203 -434
  108. package/build/src/cli/commands/debt.d.ts +2 -3
  109. package/build/src/cli/commands/debt.js +101 -317
  110. package/build/src/cli/commands/report.js +11 -28
  111. package/build/src/cli/commands/whoami.d.ts +3 -43
  112. package/build/src/cli/commands/whoami.js +8 -121
  113. package/build/src/cli/coordinates.d.ts +4 -35
  114. package/build/src/cli/coordinates.js +13 -129
  115. package/build/src/cli/parse.d.ts +0 -6
  116. package/build/src/cli/parse.js +5 -48
  117. package/build/src/cli/render/akuma-activity.d.ts +31 -16
  118. package/build/src/cli/render/akuma-activity.js +162 -122
  119. package/build/src/cli/render/akuma-tool.d.ts +3 -6
  120. package/build/src/cli/render/akuma-tool.js +20 -14
  121. package/build/src/cli/render/akuma.d.ts +25 -26
  122. package/build/src/cli/render/akuma.js +100 -129
  123. package/build/src/cli/render/catalog.d.ts +4 -7
  124. package/build/src/cli/render/catalog.js +52 -99
  125. package/build/src/cli/render/contract-history.d.ts +3 -1
  126. package/build/src/cli/render/contract-history.js +140 -215
  127. package/build/src/cli/render/contract-observation.d.ts +43 -30
  128. package/build/src/cli/render/contract-observation.js +64 -31
  129. package/build/src/cli/render/contract-wait.js +6 -6
  130. package/build/src/cli/render/contract.d.ts +41 -6
  131. package/build/src/cli/render/contract.js +274 -370
  132. package/build/src/cli/render/debt.d.ts +9 -19
  133. package/build/src/cli/render/debt.js +120 -185
  134. package/build/src/cli/render/delivery-preview.d.ts +4 -3
  135. package/build/src/cli/render/delivery-preview.js +68 -96
  136. package/build/src/cli/render/kanshi-akuma.d.ts +5 -4
  137. package/build/src/cli/render/kanshi-akuma.js +70 -59
  138. package/build/src/cli/render/kanshi.d.ts +4 -4
  139. package/build/src/cli/render/kanshi.js +205 -207
  140. package/build/src/cli/render/marks.d.ts +11 -2
  141. package/build/src/cli/render/marks.js +13 -3
  142. package/build/src/cli/render/nuke.d.ts +3 -3
  143. package/build/src/cli/render/nuke.js +13 -16
  144. package/build/src/cli/render/receipt.d.ts +37 -43
  145. package/build/src/cli/render/receipt.js +313 -236
  146. package/build/src/cli/render/reconcile.d.ts +6 -4
  147. package/build/src/cli/render/reconcile.js +53 -137
  148. package/build/src/cli/render/refusal.d.ts +3 -2
  149. package/build/src/cli/render/refusal.js +73 -54
  150. package/build/src/cli/render/region.d.ts +11 -2
  151. package/build/src/cli/render/region.js +17 -23
  152. package/build/src/cli/render/settings.d.ts +0 -1
  153. package/build/src/cli/render/settings.js +8 -17
  154. package/build/src/cli/render/terminal.d.ts +2 -0
  155. package/build/src/cli/render/verbs.d.ts +4 -0
  156. package/build/src/cli/render/verbs.js +312 -0
  157. package/build/src/cli/render/whoami.d.ts +1 -1
  158. package/build/src/cli/render/whoami.js +24 -31
  159. package/build/src/cli/runtime.d.ts +3 -11
  160. package/build/src/cli/runtime.js +96 -79
  161. package/build/src/cli/scan.d.ts +1 -1
  162. package/build/src/cli/streams.js +1 -0
  163. package/build/src/contract-guidance.js +2 -2
  164. package/build/src/contract-worktree.d.ts +2 -15
  165. package/build/src/contract-worktree.js +35 -36
  166. package/build/src/core/facts/observation.d.ts +4 -5
  167. package/build/src/core/facts/observation.js +7 -9
  168. package/build/src/core/verbs/amend.d.ts +0 -1
  169. package/build/src/core/verbs/amend.js +3 -3
  170. package/build/src/core/verbs/bind.d.ts +0 -1
  171. package/build/src/core/verbs/bind.js +5 -5
  172. package/build/src/core/verbs/deliver.d.ts +3 -2
  173. package/build/src/core/verbs/deliver.js +2 -2
  174. package/build/src/core/verbs/placement.d.ts +0 -5
  175. package/build/src/core/verbs/placement.js +4 -6
  176. package/build/src/core/verbs/reintegrate.d.ts +0 -1
  177. package/build/src/core/verbs/reintegrate.js +2 -2
  178. package/build/src/debt/board.d.ts +132 -116
  179. package/build/src/debt/board.js +138 -94
  180. package/build/src/debt/catalog.d.ts +4 -4
  181. package/build/src/debt/catalog.js +2 -18
  182. package/build/src/debt/context.d.ts +15 -3
  183. package/build/src/debt/context.js +12 -1
  184. package/build/src/debt/created-observation.d.ts +5 -17
  185. package/build/src/debt/created-observation.js +14 -6
  186. package/build/src/debt/document.d.ts +20 -15
  187. package/build/src/debt/document.js +18 -1
  188. package/build/src/debt/index.d.ts +346 -23
  189. package/build/src/debt/index.js +68 -22
  190. package/build/src/debt/input.d.ts +2 -1
  191. package/build/src/debt/input.js +14 -0
  192. package/build/src/debt/lifecycle-operations.d.ts +2 -2
  193. package/build/src/debt/lifecycle-operations.js +14 -22
  194. package/build/src/debt/operation-types.d.ts +188 -66
  195. package/build/src/debt/operation-types.js +113 -1
  196. package/build/src/debt/operations.d.ts +11 -10
  197. package/build/src/debt/operations.js +46 -71
  198. package/build/src/debt/query.d.ts +14 -10
  199. package/build/src/debt/query.js +3 -12
  200. package/build/src/debt/store.d.ts +4 -2
  201. package/build/src/debt/store.js +8 -8
  202. package/build/src/debt/view.d.ts +0 -3
  203. package/build/src/debt/view.js +0 -4
  204. package/build/src/dispatch/index.d.ts +22 -5
  205. package/build/src/dispatch/index.js +46 -37
  206. package/build/src/git/admission.d.ts +2 -2
  207. package/build/src/git/admission.js +2 -1
  208. package/build/src/git/hooks.d.ts +14 -35
  209. package/build/src/git/hooks.js +45 -25
  210. package/build/src/git/integration.d.ts +6 -24
  211. package/build/src/git/integration.js +10 -16
  212. package/build/src/git/observe.d.ts +2 -1
  213. package/build/src/git/observe.js +29 -20
  214. package/build/src/git/private-state-seat.d.ts +2 -2
  215. package/build/src/git/private-state-seat.js +2 -1
  216. package/build/src/git/reconcile.d.ts +17 -79
  217. package/build/src/git/reconcile.js +37 -52
  218. package/build/src/git/scratch.d.ts +3 -3
  219. package/build/src/git/scratch.js +4 -1
  220. package/build/src/git/target-placement.d.ts +23 -31
  221. package/build/src/git/target-placement.js +42 -27
  222. package/build/src/git/target.d.ts +2 -2
  223. package/build/src/git/target.js +2 -1
  224. package/build/src/git/tender.d.ts +7 -39
  225. package/build/src/git/tender.js +21 -54
  226. package/build/src/git/terminal-reconcile.js +15 -18
  227. package/build/src/git/terminal-seal.d.ts +2 -4
  228. package/build/src/git/terminal-seal.js +7 -33
  229. package/build/src/git/workspace.d.ts +65 -41
  230. package/build/src/git/workspace.js +45 -14
  231. package/build/src/identity/selector.d.ts +2 -0
  232. package/build/src/identity/selector.js +13 -3
  233. package/build/src/index.d.ts +48 -54
  234. package/build/src/index.js +31 -43
  235. package/build/src/kanshi/counts.d.ts +42 -8
  236. package/build/src/kanshi/counts.js +13 -2
  237. package/build/src/kanshi/index.d.ts +5 -5
  238. package/build/src/kanshi/index.js +4 -3
  239. package/build/src/kanshi/read.d.ts +489 -6
  240. package/build/src/kanshi/read.js +334 -483
  241. package/build/src/kanshi/report.d.ts +2504 -103
  242. package/build/src/kanshi/report.js +165 -1
  243. package/build/src/kanshi/select.d.ts +0 -8
  244. package/build/src/kanshi/select.js +20 -59
  245. package/build/src/library/address.d.ts +8 -8
  246. package/build/src/library/address.js +7 -7
  247. package/build/src/library/akuma-creation.d.ts +690 -84
  248. package/build/src/library/akuma-creation.js +202 -142
  249. package/build/src/library/akuma-retention.d.ts +2 -2
  250. package/build/src/library/akuma-retention.js +2 -2
  251. package/build/src/library/akumas.d.ts +10 -6
  252. package/build/src/library/akumas.js +24 -7
  253. package/build/src/library/bind.d.ts +28 -54
  254. package/build/src/library/bind.js +6 -4
  255. package/build/src/library/continuation.d.ts +197 -479
  256. package/build/src/library/continuation.js +40 -23
  257. package/build/src/library/contract-address.d.ts +6 -5
  258. package/build/src/library/contract-address.js +5 -7
  259. package/build/src/library/contract-composition.d.ts +18 -12
  260. package/build/src/library/contract-composition.js +55 -47
  261. package/build/src/library/contract-creation.d.ts +3 -2
  262. package/build/src/library/contract-creation.js +38 -32
  263. package/build/src/library/contract-execution.js +77 -38
  264. package/build/src/library/contract-outcomes.d.ts +1877 -27
  265. package/build/src/library/contract-outcomes.js +93 -10
  266. package/build/src/library/contract-settings.d.ts +2 -2
  267. package/build/src/library/contract-settings.js +18 -14
  268. package/build/src/library/contract-types.d.ts +238 -61
  269. package/build/src/library/contract-types.js +131 -1
  270. package/build/src/library/contract-wait.d.ts +38 -17
  271. package/build/src/library/contract-wait.js +40 -10
  272. package/build/src/library/delivery.d.ts +588 -36
  273. package/build/src/library/delivery.js +35 -27
  274. package/build/src/library/input.d.ts +1 -1
  275. package/build/src/library/input.js +1 -2
  276. package/build/src/library/invocation.d.ts +11 -7
  277. package/build/src/library/invocation.js +42 -51
  278. package/build/src/library/kei.d.ts +48 -0
  279. package/build/src/library/kei.js +256 -0
  280. package/build/src/library/keiyaku-attribution.d.ts +11 -0
  281. package/build/src/{cli/delivery-identity.js → library/keiyaku-attribution.js} +12 -1
  282. package/build/src/library/keiyaku-classify.d.ts +11 -0
  283. package/build/src/library/keiyaku-classify.js +146 -0
  284. package/build/src/library/keiyaku-coordinates.d.ts +31 -0
  285. package/build/src/library/keiyaku-coordinates.js +103 -0
  286. package/build/src/library/keiyaku-debt.d.ts +142 -0
  287. package/build/src/library/keiyaku-debt.js +188 -0
  288. package/build/src/library/keiyaku-identity.d.ts +58 -0
  289. package/build/src/library/keiyaku-identity.js +176 -0
  290. package/build/src/library/keiyaku-policy.d.ts +27 -0
  291. package/build/src/library/keiyaku-policy.js +44 -0
  292. package/build/src/library/keiyaku-status.d.ts +1487 -0
  293. package/build/src/library/keiyaku-status.js +92 -0
  294. package/build/src/library/keiyaku-verbs.d.ts +6774 -0
  295. package/build/src/library/keiyaku-verbs.js +458 -0
  296. package/build/src/library/keiyaku.d.ts +871 -38
  297. package/build/src/library/keiyaku.js +677 -127
  298. package/build/src/library/nuke.d.ts +22 -0
  299. package/build/src/library/nuke.js +4 -1
  300. package/build/src/library/outcome.d.ts +706 -692
  301. package/build/src/library/outcome.js +582 -167
  302. package/build/src/library/reconcile.d.ts +464 -116
  303. package/build/src/library/reconcile.js +174 -102
  304. package/build/src/library/refusal.d.ts +113 -577
  305. package/build/src/library/refusal.js +64 -51
  306. package/build/src/library/region.d.ts +5 -24
  307. package/build/src/library/region.js +6 -21
  308. package/build/src/library/selection.d.ts +181 -32
  309. package/build/src/library/selection.js +99 -64
  310. package/build/src/mcp/adapter.d.ts +11 -0
  311. package/build/src/mcp/adapter.js +106 -0
  312. package/build/src/mcp/help.d.ts +1 -0
  313. package/build/src/mcp/help.js +26 -0
  314. package/build/src/mcp/index.d.ts +2 -0
  315. package/build/src/mcp/index.js +37 -0
  316. package/build/src/plugin/public.d.ts +1 -1
  317. package/build/src/plugin/runtime.js +17 -14
  318. package/build/src/protocol/arc.d.ts +4 -1
  319. package/build/src/protocol/arc.js +7 -1
  320. package/build/src/protocol/attempt.d.ts +2 -3
  321. package/build/src/protocol/attempt.js +1 -10
  322. package/build/src/protocol/bind.d.ts +6 -7
  323. package/build/src/protocol/bind.js +9 -5
  324. package/build/src/protocol/completion.d.ts +448 -12
  325. package/build/src/protocol/completion.js +164 -26
  326. package/build/src/protocol/deliver.d.ts +26 -24
  327. package/build/src/protocol/deliver.js +24 -52
  328. package/build/src/protocol/delivery-preview.d.ts +97 -247
  329. package/build/src/protocol/delivery-preview.js +132 -128
  330. package/build/src/protocol/execution-observation.d.ts +146 -123
  331. package/build/src/protocol/execution-observation.js +9 -6
  332. package/build/src/protocol/intent.d.ts +9 -48
  333. package/build/src/protocol/intent.js +32 -46
  334. package/build/src/protocol/operations.d.ts +207 -505
  335. package/build/src/protocol/operations.js +81 -134
  336. package/build/src/protocol/placement.d.ts +0 -1
  337. package/build/src/protocol/placement.js +5 -2
  338. package/build/src/protocol/progress.d.ts +7 -97
  339. package/build/src/protocol/progress.js +7 -55
  340. package/build/src/protocol/read/observation.d.ts +13 -6
  341. package/build/src/protocol/read/observation.js +10 -9
  342. package/build/src/protocol/read/status.d.ts +466 -95
  343. package/build/src/protocol/read/status.js +380 -91
  344. package/build/src/protocol/reconcile.d.ts +2 -0
  345. package/build/src/protocol/reconcile.js +12 -11
  346. package/build/src/protocol/reintegrate.d.ts +0 -1
  347. package/build/src/protocol/reintegrate.js +4 -4
  348. package/build/src/protocol/result-leaves.d.ts +528 -0
  349. package/build/src/protocol/result-leaves.js +195 -0
  350. package/build/src/protocol/result-reasons.d.ts +129 -0
  351. package/build/src/protocol/result-reasons.js +87 -0
  352. package/build/src/protocol/review.d.ts +14 -11
  353. package/build/src/protocol/review.js +30 -14
  354. package/build/src/protocol/run.d.ts +4 -4
  355. package/build/src/protocol/run.js +4 -1
  356. package/build/src/protocol/verify.d.ts +359 -30
  357. package/build/src/protocol/verify.js +118 -28
  358. package/build/src/region.d.ts +26 -0
  359. package/build/src/region.js +28 -0
  360. package/build/src/runtime/proc/diagnostic.d.ts +11 -0
  361. package/build/src/runtime/proc/diagnostic.js +20 -0
  362. package/build/src/runtime/proc/windows-launch.exe +0 -0
  363. package/build/src/settings.d.ts +126 -32
  364. package/build/src/settings.js +107 -34
  365. package/build/src/settlement/settle.d.ts +29 -12
  366. package/build/src/settlement/settle.js +22 -15
  367. package/build/src/verification/declaration.d.ts +1 -3
  368. package/build/src/verification/declaration.js +2 -5
  369. package/build/src/verification/execution.d.ts +7 -19
  370. package/build/src/verification/execution.js +37 -16
  371. package/build/src/verification/observation.d.ts +13 -13
  372. package/build/src/verification/observation.js +9 -7
  373. package/build/src/world.d.ts +8 -0
  374. package/build/src/world.js +7 -0
  375. package/package.json +6 -5
  376. package/plugins/paseo/plugin/server/keiyaku.ts +13 -46
  377. package/plugins/paseo/plugin/server/message.ts +8 -30
  378. package/plugins/paseo/plugin/server/mirror.ts +16 -20
  379. package/plugins/paseo/plugin/server/provider.ts +1 -1
  380. package/plugins/paseo/plugin/server/sdk.ts +14 -6
  381. package/plugins/pi/README.md +5 -5
  382. package/plugins/pi/akuma-tools.ts +17 -23
  383. package/skills/keiyaku/SKILL.md +24 -24
  384. package/skills/keiyaku-akuma/SKILL.md +44 -168
  385. package/skills/keiyaku-akuma/references/automation.md +61 -231
  386. package/skills/keiyaku-babysit/SKILL.md +47 -58
  387. package/skills/keiyaku-bind/SKILL.md +44 -185
  388. package/skills/keiyaku-debt/SKILL.md +40 -89
  389. package/skills/keiyaku-workflow/SKILL.md +56 -116
  390. package/build/src/cli/actor.d.ts +0 -10
  391. package/build/src/cli/actor.js +0 -24
  392. package/build/src/cli/akuma-caller.d.ts +0 -3
  393. package/build/src/cli/akuma-caller.js +0 -31
  394. package/build/src/cli/delivery-identity.d.ts +0 -3
  395. package/build/src/cli/render/effects.d.ts +0 -26
  396. package/build/src/cli/render/effects.js +0 -41
  397. package/build/src/cli/selectors.d.ts +0 -10
  398. package/build/src/cli/selectors.js +0 -42
  399. package/build/src/markdown/diff.d.ts +0 -1
  400. package/build/src/markdown/diff.js +0 -4
@@ -1,152 +1,68 @@
1
- import { reconcileLagIsFailure } from "../../library/reconcile.js";
1
+ import { invocationIssueIsFailure } from "../../library/outcome.js";
2
+ import { contractIssueLines } from "./contract.js";
2
3
  import { abbreviateGitIds, displayGitId } from "./contract-observation.js";
3
- import { receiptPayload, receiptRow } from "./receipt.js";
4
- import { DEFAULT_CLI_COLUMNS } from "./terminal.js";
5
- function effectText(effect) {
6
- if (effect.action === "unchanged")
7
- return null;
8
- const ids = effect.kind === "ref"
9
- ? [effect.before ?? "", effect.after ?? ""]
10
- : effect.kind === "worktree" && effect.action === "followed"
11
- ? [effect.before, effect.after]
12
- : effect.kind === "recovery-snapshot"
13
- ? [effect.snapshot]
14
- : [];
15
- const abbreviations = abbreviateGitIds(ids);
16
- const state = effect.kind === "ref"
17
- ? `${effect.action}${effect.before === null ? "" : ` · ${displayGitId(effect.before, abbreviations)}`}${effect.after === null ? "" : ` → ${displayGitId(effect.after, abbreviations)}`}`
18
- : effect.kind === "worktree" && effect.action === "followed"
19
- ? `followed · ${displayGitId(effect.before, abbreviations)} → ${displayGitId(effect.after, abbreviations)}`
20
- : effect.action;
21
- const path = effect.kind === "ref"
22
- ? effect.name
23
- : effect.kind === "recovery-snapshot"
24
- ? displayGitId(effect.snapshot, abbreviations)
25
- : effect.path;
26
- return [effect.kind, state, path];
4
+ import { receiptRow } from "./receipt.js";
5
+ import { DEFAULT_CLI_COLUMNS, safeText } from "./terminal.js";
6
+ function words(kind) {
7
+ return kind.replaceAll("-", " ");
27
8
  }
28
- function worktreeHookLagRows(lines, lag, columns, contract) {
29
- receiptRow(lines, "!", "reconcile", [
30
- ...(contract === undefined ? [] : [{ text: contract, opaque: true }]),
31
- { text: "hook", opaque: true },
32
- { text: lag.phase, opaque: true },
33
- { text: lag.path, opaque: true },
34
- { text: lag.name, opaque: true },
35
- { text: `command ${lag.command}`, opaque: true },
36
- { text: lag.failure.kind === "exit" ? `exit ${lag.failure.code}` : lag.failure.kind, opaque: true },
37
- ], columns);
38
- const output = "stdout" in lag.failure ? lag.failure.stdout : undefined;
39
- const error = "stderr" in lag.failure ? lag.failure.stderr : undefined;
40
- if (lag.failure.kind === "spawn-error") {
41
- receiptRow(lines, "!", "reason", [{ text: lag.failure.diagnostic, opaque: true }], columns);
42
- }
43
- if (output !== undefined && output.length > 0)
44
- receiptPayload(lines, "stdout", output);
45
- if (error !== undefined && error.length > 0)
46
- receiptPayload(lines, "stderr", error);
47
- }
48
- function lagRow(lines, lag, columns, contract) {
49
- switch (lag.kind) {
50
- case "worktree-hook-failed":
51
- worktreeHookLagRows(lines, lag, columns, contract);
52
- break;
53
- case "reconcile-failed":
54
- receiptRow(lines, "!", "reconcile", [
55
- ...(contract === undefined ? [] : [{ text: contract, opaque: true }]),
56
- { text: lag.stage, opaque: true },
57
- { text: lag.diagnostic, opaque: true },
58
- ], columns);
59
- break;
60
- case "worktree-retained":
61
- receiptRow(lines, " ", "worktree retained at", [{ text: lag.path, opaque: true }], columns);
62
- if (lag.diagnostic !== undefined)
63
- receiptRow(lines, " ", "reason", [{ text: lag.diagnostic, opaque: true }], columns);
64
- break;
65
- case "worktree-follow-retained":
66
- receiptRow(lines, " ", "worktree follow kept at", [{ text: lag.path, opaque: true }, { text: `· ${lag.reason.replaceAll("-", " ")}` }], columns);
67
- break;
68
- case "unsealed-bytes":
69
- receiptRow(lines, " ", "unsealed bytes kept at", [{ text: lag.path, opaque: true }], columns);
70
- break;
71
- case "target-checkout-retained":
72
- receiptRow(lines, "!", "target checkout kept at", [
73
- { text: lag.path, opaque: true },
74
- { text: `· ${lag.target}`, opaque: true },
75
- ], columns);
76
- receiptRow(lines, " ", "reason", [{ text: lag.diagnostic, opaque: true }], columns);
77
- break;
78
- case "target-workspace-retained":
79
- receiptRow(lines, "!", "target workspace unavailable", [{ text: lag.contractId, opaque: true }, { text: `· ${lag.reason.replaceAll("-", " ")}` }], columns);
80
- break;
81
- case "contract-file-failed":
82
- receiptRow(lines, "!", "contract file unavailable", [
83
- { text: lag.worktree, opaque: true },
84
- { text: `· ${lag.path}`, opaque: true },
85
- ], columns);
86
- receiptRow(lines, " ", "reason", [{ text: lag.diagnostic, opaque: true }], columns);
87
- break;
88
- default: {
89
- const exhaustive = lag;
90
- return exhaustive;
9
+ function effectSegments(effect) {
10
+ switch (effect.kind) {
11
+ case "ref": {
12
+ const ids = abbreviateGitIds([effect.before ?? "", effect.after ?? ""]);
13
+ return [
14
+ { text: "ref" },
15
+ {
16
+ text: `${effect.before === null ? "absent" : displayGitId(effect.before, ids)} → ${effect.after === null ? "absent" : displayGitId(effect.after, ids)}`,
17
+ },
18
+ { text: effect.name, opaque: true },
19
+ ];
91
20
  }
21
+ case "target-checkout":
22
+ return [{ text: "target checkout" }, { text: effect.target, opaque: true }, { text: effect.path, opaque: true }];
23
+ case "recovery-snapshot":
24
+ return [
25
+ { text: "recovery snapshot" },
26
+ { text: displayGitId(effect.snapshot, abbreviateGitIds([effect.snapshot])), opaque: true },
27
+ ];
28
+ case "debt-settled":
29
+ return [{ text: "debt settled" }, { text: effect.debtId, opaque: true }];
30
+ case "worktree-created":
31
+ case "worktree-removed":
32
+ return [{ text: words(effect.kind) }, { text: effect.path, opaque: true }];
92
33
  }
93
34
  }
94
- function appendReport(lines, report, columns, seen, contract) {
95
- for (const effect of report.effects) {
96
- const parts = effectText(effect);
97
- if (parts === null)
98
- continue;
99
- const key = JSON.stringify([contract, effect]);
35
+ function nativeDisposition(report) {
36
+ if (report.kind === "missing")
37
+ return "refused";
38
+ if (report.kind === "world-observation-failed")
39
+ return "failed";
40
+ const rows = report.kind === "world" ? (report.contracts ?? []) : [report];
41
+ return rows.some((row) => row.issues?.some(invocationIssueIsFailure) === true) ? "failed" : "accepted";
42
+ }
43
+ function appendReport(lines, report, columns, seen) {
44
+ for (const effect of report.effects ?? []) {
45
+ const key = JSON.stringify([report.contractId, effect]);
100
46
  if (seen.has(key))
101
47
  continue;
102
48
  seen.add(key);
103
- receiptRow(lines, " ", "effect", parts.map((text) => ({ text, opaque: true })), columns);
104
- }
105
- for (const lag of report.lag)
106
- lagRow(lines, lag, columns, contract);
107
- for (const action of report.settlement?.actions ?? []) {
108
- receiptRow(lines, " ", "settlement", [{ text: action.kind, opaque: true }], columns);
109
- }
110
- for (const lag of report.settlement?.lags ?? []) {
111
- receiptRow(lines, "!", "settlement", Object.entries(lag)
112
- .filter(([key]) => key !== "kind")
113
- .map(([key, value]) => ({ text: `${key} ${String(value)}`, opaque: true })), columns);
49
+ receiptRow(lines, " ", "effect", effectSegments(effect), columns);
114
50
  }
115
- for (const failure of report.settlement?.seatClose ?? []) {
116
- receiptRow(lines, "!", "settlement", [{ text: failure.kind, opaque: true }], columns);
117
- receiptRow(lines, "!", "reason", [{ text: failure.diagnostic, opaque: true }], columns);
118
- }
119
- }
120
- function isRepoReport(report) {
121
- return "kind" in report && (report.kind === "completed" || report.kind === "world-observation-failed");
51
+ lines.push(...contractIssueLines(report, columns));
122
52
  }
123
- export function reconcileHasFailure(report) {
124
- if (isRepoReport(report)) {
125
- if (report.kind === "world-observation-failed")
126
- return true;
127
- return report.contracts.some((item) => reconcileHasFailure(item.report));
128
- }
129
- return (report.lag.some((lag) => reconcileLagIsFailure(lag)) ||
130
- (report.settlement?.lags.length ?? 0) > 0 ||
131
- (report.settlement?.seatClose?.length ?? 0) > 0);
132
- }
133
- export function renderReconcile(report, context) {
53
+ /** Reconcile reports only native disposition, movement, and repair issues; it never re-adjudicates them. */
54
+ export function renderReconcile(report, context, disposition) {
134
55
  const columns = context?.columns ?? DEFAULT_CLI_COLUMNS;
135
- const lines = [
136
- isRepoReport(report) && report.kind === "world-observation-failed"
137
- ? "! reconcile failed"
138
- : reconcileHasFailure(report)
139
- ? "! reconcile incomplete"
140
- : "✓ reconcile",
141
- ];
56
+ if (report.kind === "world-observation-failed")
57
+ return [`! reconcile failed`, `! reconcile ${safeText(report.diagnostic)}`].join("\n");
58
+ if (report.kind === "missing")
59
+ return `× reconcile refused\n reason contract missing\n contract ${safeText(report.contractId)}`;
60
+ const verdict = disposition ?? nativeDisposition(report);
61
+ const lines = [verdict === "failed" ? "! reconcile incomplete" : "✓ reconcile"];
142
62
  const seen = new Set();
143
- if (isRepoReport(report)) {
144
- if (report.kind === "world-observation-failed") {
145
- receiptRow(lines, "!", "reconcile", [{ text: report.diagnostic, opaque: true }], columns);
146
- return lines.join("\n");
147
- }
148
- for (const item of report.contracts)
149
- appendReport(lines, item.report, columns, seen, item.contractId);
63
+ if (report.kind === "world") {
64
+ for (const item of report.contracts ?? [])
65
+ appendReport(lines, item, columns, seen);
150
66
  }
151
67
  else
152
68
  appendReport(lines, report, columns, seen);
@@ -1,6 +1,7 @@
1
1
  import type { BindDraftReceipt } from "../draft.js";
2
2
  import { type CliUsageGuide } from "../usage.js";
3
- import type { ContractId, IntegrationConflictMaterialized, KeiyakuRefusal } from "../../index.js";
3
+ import type { ContractId, KeiyakuRefusal } from "../../index.js";
4
+ import type { HandoffOutcome } from "../../library/outcome.js";
4
5
  import { type TextRenderContext } from "./terminal.js";
5
6
  type DirtyWithOption = Extract<KeiyakuRefusal, {
6
7
  kind: "dirty-workspace";
@@ -29,6 +30,6 @@ type RefusedInvocation = Readonly<{
29
30
  refusal: RenderableRefusal;
30
31
  }>;
31
32
  export declare function renderRefusal(refused: RefusedInvocation, draft?: BindDraftReceipt, context?: TextRenderContext): string;
32
- export declare function renderConflictMaterialized(result: IntegrationConflictMaterialized, _context?: TextRenderContext): string;
33
+ export declare function renderConflictMaterialized(result: HandoffOutcome, _context?: TextRenderContext): string;
33
34
  export declare function renderBindDraftReceipt(receipt: BindDraftReceipt): string;
34
35
  export {};
@@ -1,40 +1,37 @@
1
1
  import { usageAcceptanceLines } from "../usage.js";
2
- import { shortGitId, contractOperationName } from "./contract-observation.js";
3
- import { DEFAULT_CLI_COLUMNS, checkoutNotFollowableLines, gitShortStat, orderRefusalFacts, renderOpaqueBlock, safeText, } from "./terminal.js";
2
+ import { contractOperationName, shortGitId } from "./contract-observation.js";
3
+ import { DEFAULT_CLI_COLUMNS, orderRefusalFacts, renderOpaqueBlock, safeText, } from "./terminal.js";
4
4
  function wrap(lines, text, indent, columns) {
5
5
  lines.push(...renderOpaqueBlock(text, indent, columns));
6
6
  }
7
+ function words(kind) {
8
+ return kind.replaceAll("-", " ");
9
+ }
7
10
  function collectionLines(name, members, indent) {
8
11
  if (members.length === 0)
9
12
  return [];
10
13
  return [`${indent}${name}`, ...members.map((member) => `${indent} ${safeText(member)}`)];
11
14
  }
12
- function skipAddressedContract(addressed, contractId) {
13
- return addressed !== undefined && contractId === addressed;
15
+ function addressedContract(addressed, contractId) {
16
+ return contractId !== undefined && contractId !== addressed ? contractId : undefined;
14
17
  }
15
18
  function refusalIdentity(refusal, addressed) {
16
- const contractId = "contractId" in refusal ? refusal.contractId : undefined;
17
- return skipAddressedContract(addressed, contractId) ? undefined : contractId;
19
+ const contractId = "contractId" in refusal && typeof refusal.contractId === "string" ? refusal.contractId : undefined;
20
+ return addressedContract(addressed, contractId);
18
21
  }
19
22
  const REFUSAL_WORDS = {
20
23
  "contract-missing": "contract missing",
21
24
  };
22
25
  function refusalWords(kind) {
23
- return REFUSAL_WORDS[kind] ?? kind.replaceAll("-", " ");
24
- }
25
- function refusalHead(kind, identity, details) {
26
- return [refusalWords(kind), identity, ...details].filter((part) => part !== undefined).join(" ");
26
+ return REFUSAL_WORDS[kind] ?? words(kind);
27
27
  }
28
- function renderDirtyRefusal(refusal, indent, columns, identity) {
28
+ function renderDirtyRefusal(refusal, indent, columns) {
29
29
  const lines = [];
30
- wrap(lines, refusalHead(refusal.kind, identity, []), indent, columns);
31
30
  wrap(lines, "reason worktree has uncommitted changes", indent, columns);
32
- for (const name of ["staged", "unstaged", "untracked", "submodules"]) {
33
- lines.push(...collectionLines(name, refusal[name], indent));
34
- }
35
- wrap(lines, gitShortStat(refusal.shortStat), indent, columns);
31
+ lines.push(...collectionLines("paths", refusal.paths ?? [], indent));
32
+ lines.push(...collectionLines("submodules", refusal.submodules ?? [], indent));
36
33
  if (refusal.option === undefined) {
37
- if (refusal.submodules.length > 0)
34
+ if ((refusal.submodules ?? []).length > 0)
38
35
  wrap(lines, "reason submodule changes cannot be captured for review", indent, columns);
39
36
  }
40
37
  else if (!refusal.option.available) {
@@ -60,70 +57,92 @@ function verificationRefusalFacts(refusal, indent, identity) {
60
57
  return [
61
58
  `${indent}reason Verification declaration index is out of range`,
62
59
  ...contract,
63
- `${indent}index ${refusal.index}`,
64
60
  `${indent}declarations ${refusal.total}`,
65
61
  ];
66
62
  return undefined;
67
63
  }
68
- // eslint-disable-next-line complexity -- one closed projection preserves every refusal fact.
64
+ function targetRefusalLines(target, indent, identity, contract) {
65
+ return [
66
+ ...(identity === undefined ? [] : [`${indent}contract ${safeText(identity)}`]),
67
+ ...(target === undefined ? [] : [`${indent}target ${safeText(target)}`]),
68
+ ...(contract === undefined ? [] : [`${indent}detail ${safeText(contract)}`]),
69
+ ];
70
+ }
71
+ function nukeRefusalFacts(refusal, indent) {
72
+ const world = safeText(refusal.world);
73
+ return [
74
+ `${indent}reason ${refusalWords(refusal.kind)}`,
75
+ `${indent}world ${world}`,
76
+ ...(refusal.kind === "nuke-confirmation-mismatch"
77
+ ? [`${indent}confirmation ${safeText(refusal.confirmation)}`]
78
+ : []),
79
+ `${indent}option keiyaku nuke --confirm '${world.replaceAll("'", "'\"'\"'")}'`,
80
+ ];
81
+ }
69
82
  function refusalFacts(refusal, indent, columns, addressed) {
70
83
  const identity = refusalIdentity(refusal, addressed);
71
- if (refusal.kind === "nuke-confirmation-mismatch" || refusal.kind === "nuke-confirmation-required") {
72
- const world = safeText(refusal.world);
73
- return [
74
- `${indent}reason ${refusalWords(refusal.kind)}`,
75
- `${indent}world ${world}`,
76
- ...(refusal.kind === "nuke-confirmation-mismatch"
77
- ? [`${indent}confirmation ${safeText(refusal.confirmation)}`]
78
- : []),
79
- `${indent}option keiyaku nuke --confirm '${world.replaceAll("'", "'\"'\"'")}'`,
80
- ];
81
- }
84
+ const target = "targetContractId" in refusal ? refusal.targetContractId : undefined;
85
+ if (refusal.kind === "nuke-confirmation-mismatch" || refusal.kind === "nuke-confirmation-required")
86
+ return nukeRefusalFacts(refusal, indent);
82
87
  const verification = verificationRefusalFacts(refusal, indent, identity);
83
88
  if (verification !== undefined)
84
89
  return verification;
85
90
  if (refusal.kind === "dirty-workspace")
86
- return renderDirtyRefusal(refusal, indent, columns, identity);
87
- if (refusal.kind === "unmerged-paths") {
88
- return [`${indent}reason ${refusalWords(refusal.kind)}`, ...collectionLines("paths", refusal.paths, indent)];
91
+ return renderDirtyRefusal(refusal, indent, columns);
92
+ if (refusal.kind === "dirty-submodules") {
93
+ return [
94
+ `${indent}reason submodule changes cannot be captured for review`,
95
+ ...collectionLines("paths", refusal.paths, indent),
96
+ ];
97
+ }
98
+ if (refusal.kind === "integration-conflict") {
99
+ return [
100
+ `${indent}reason integration conflict`,
101
+ ...targetRefusalLines(undefined, indent, identity, undefined),
102
+ `${indent}target ${safeText(refusal.targetHead)}`,
103
+ ...collectionLines("conflicts", refusal.conflictPaths, indent),
104
+ `${indent}option materialize deliver --materialize-conflict --include-dirty`,
105
+ `${indent}option deliver deliver --include-dirty`,
106
+ ];
89
107
  }
90
- if (refusal.kind === "integration-failed") {
91
- const lines = [
108
+ if (refusal.kind === "not-based-on-target" || refusal.kind === "unrelated-histories") {
109
+ return [
92
110
  `${indent}reason ${refusalWords(refusal.kind)}`,
93
- ...(identity === undefined ? [] : [`${indent}contract ${safeText(identity)}`]),
111
+ ...targetRefusalLines(undefined, indent, identity, undefined),
112
+ `${indent}target ${safeText(refusal.targetHead)}`,
94
113
  ];
95
- lines.push(`${indent}reason ${safeText(refusal.reason)}`, `${indent}target ${safeText(refusal.targetHead)}`);
96
- if (refusal.conflictPaths !== undefined)
97
- lines.push(...collectionLines("conflicts", refusal.conflictPaths, indent));
98
- if ("recovery" in refusal && refusal.recovery !== undefined) {
99
- lines.push(`${indent}option materialize ${safeText(refusal.recovery.materialize)}`);
100
- lines.push(`${indent}option deliver ${safeText(refusal.recovery.deliver)}`);
101
- }
102
- return lines;
103
114
  }
104
115
  if (refusal.kind === "merge-state-present") {
105
116
  return [
106
117
  `${indent}reason ${refusalWords(refusal.kind)}`,
107
- ...(identity === undefined ? [] : [`${indent}contract ${safeText(identity)}`]),
108
- `${indent}workspace kind ${refusal.workspace.kind}`,
109
- `${indent}workspace ${safeText(refusal.workspace.path)}`,
118
+ ...targetRefusalLines(undefined, indent, identity, undefined),
119
+ `${indent}worktree ${safeText(refusal.worktreePath)}`,
110
120
  ];
111
121
  }
112
122
  if (refusal.kind === "integration-unsupported") {
113
123
  return [
114
124
  `${indent}reason ${refusalWords(refusal.kind)}`,
115
- ...(identity === undefined ? [] : [`${indent}contract ${safeText(identity)}`]),
116
- `${indent}required Git ${safeText(refusal.requiredGit)}`,
125
+ ...targetRefusalLines(undefined, indent, identity, undefined),
117
126
  ];
118
127
  }
119
128
  if (refusal.kind === "checkout-not-followable") {
120
- return checkoutNotFollowableLines(refusal);
129
+ return [
130
+ `${indent}reason checkout not followable`,
131
+ ...targetRefusalLines(refusal.target, indent, identity, undefined),
132
+ `${indent}checkout ${safeText(refusal.path)}`,
133
+ ...collectionLines("paths", refusal.paths, indent),
134
+ ];
121
135
  }
122
136
  if (refusal.kind === "target-workspace-unavailable") {
123
137
  return [
124
138
  `${indent}reason target workspace unavailable`,
125
- `${indent}contract ${safeText(refusal.contractId)}`,
126
- `${indent}detail ${safeText(refusal.reason.replaceAll("-", " "))}`,
139
+ ...targetRefusalLines(target, indent, identity, words(refusal.reason)),
140
+ ];
141
+ }
142
+ if (refusal.kind === "target-contract-missing" || refusal.kind === "target-contract-terminal") {
143
+ return [
144
+ `${indent}reason ${refusalWords(refusal.kind)}`,
145
+ ...targetRefusalLines(target, indent, identity, undefined),
127
146
  ];
128
147
  }
129
148
  const lines = [`${indent}reason ${refusalWords(refusal.kind)}`];
@@ -169,8 +188,8 @@ export function renderConflictMaterialized(result, _context) {
169
188
  `${indent}saved worktree bytes before projection`,
170
189
  `${indent}handoff base ${shortGitId(result.handoffBase)}`,
171
190
  ...collectionLines("conflicts", result.conflictPaths, indent),
172
- `${indent}workspace ${safeText(result.workspace.path)}`,
173
- `${indent}option deliver ${safeText(result.recovery.deliver)} · reads worktree bytes, not index`,
191
+ `${indent}workspace ${safeText(result.worktreePath)}`,
192
+ `${indent}option deliver deliver --include-dirty · reads worktree bytes, not index`,
174
193
  ].join("\n");
175
194
  }
176
195
  export function renderBindDraftReceipt(receipt) {
@@ -1,2 +1,11 @@
1
- import type { RegionRead, Section } from "../../kanshi/index.js";
2
- export declare function renderRegionText(section: Section<RegionRead>): string;
1
+ import type { RegionRead } from "../../kanshi/index.js";
2
+ /** The edge refusals are rendered by the CLI refusal grammar; this owns the owner observation. */
3
+ export type RegionObservation = Exclude<RegionRead, {
4
+ kind: "contract-missing";
5
+ } | {
6
+ kind: "contract-terminal";
7
+ }>;
8
+ export declare function renderRegionText(result: RegionObservation, input?: Readonly<{
9
+ contract?: string;
10
+ paths?: readonly string[];
11
+ }>): string;
@@ -3,35 +3,29 @@ function overlapBlocks(overlaps) {
3
3
  return overlaps.flatMap((overlap) => {
4
4
  const patterns = overlap.patterns.filter((pattern) => pattern.mine !== pattern.theirs);
5
5
  if (patterns.length === 0)
6
- return [`overlap ${overlap.contract} exact match`];
6
+ return [`overlap ${overlap.contractId} exact match`];
7
7
  const count = patterns.length;
8
8
  return [
9
- `overlap ${overlap.contract} ${count} ${count === 1 ? "pair" : "pairs"}`,
9
+ `overlap ${overlap.contractId} ${count} ${count === 1 ? "pair" : "pairs"}`,
10
10
  ...patterns.map((pattern) => ` ${pattern.mine} ~ ${pattern.theirs}`),
11
11
  ];
12
12
  });
13
13
  }
14
- function rows(section) {
15
- if (section.kind === "absent")
16
- return [];
17
- if (section.kind === "failed")
18
- return [`× region`, ` reason ${section.failure.message}`];
19
- const value = section.value;
20
- if (value.kind === "declarations") {
21
- if (value.declarations.length === 0)
22
- return [emptyCatalogue("region")];
23
- return value.declarations.map((declaration) => `region ${declaration.contract} ${declaration.patterns.join(" ")}`);
14
+ export function renderRegionText(result, input = {}) {
15
+ if (result.kind === "absent")
16
+ return emptyCatalogue("region");
17
+ if (result.kind === "failed")
18
+ return [`× region`, ` reason ${result.diagnostic}`].join("\n");
19
+ if ("id" in result) {
20
+ const header = `region ${result.id} ${result.patterns.join(" ")}`;
21
+ return [header, ...(result.overlaps === undefined ? [" overlap none"] : overlapBlocks(result.overlaps))].join("\n");
24
22
  }
25
- if (value.kind === "contract") {
26
- const header = `region ${value.declaration.contract} ${value.declaration.patterns.join(" ")}`;
27
- if (value.overlaps.length === 0)
28
- return [header, " overlap none"];
29
- return [header, ...overlapBlocks(value.overlaps)];
23
+ if (input.paths !== undefined) {
24
+ const overlaps = "overlaps" in result ? result.overlaps : undefined;
25
+ return (overlaps === undefined ? ["region none"] : overlapBlocks(overlaps)).join("\n");
30
26
  }
31
- if (value.overlaps.length === 0)
32
- return ["region none", ` patterns ${value.patterns.join(" ")}`];
33
- return [...overlapBlocks(value.overlaps)];
34
- }
35
- export function renderRegionText(section) {
36
- return rows(section).join("\n");
27
+ const declarations = "declarations" in result ? (result.declarations ?? []) : [];
28
+ return declarations.length === 0
29
+ ? emptyCatalogue("region")
30
+ : declarations.map((declaration) => `region ${declaration.id} ${declaration.patterns.join(" ")}`).join("\n");
37
31
  }
@@ -1,3 +1,2 @@
1
1
  import type { Settings } from "../../settings.js";
2
- export declare function settingsJsonValue(value: Settings): unknown;
3
2
  export declare function renderSettingsText(value: Settings, columns?: number): string;
@@ -1,10 +1,5 @@
1
1
  import { DEFAULT_CLI_COLUMNS, displayColumns, renderTextBlock } from "./terminal.js";
2
2
  import { fieldName, namedValueLines } from "./value.js";
3
- function namespaceNames(value) {
4
- return [
5
- ...new Set([value.scopes.user, value.scopes.project].flatMap((scope) => (scope.kind === "read" ? scope.namespaces : []))),
6
- ].sort();
7
- }
8
3
  function labeledTokens(label, tokens, indent, columns) {
9
4
  const inline = [label, ...tokens].filter((part) => part.length > 0).join(" ");
10
5
  if (displayColumns(`${indent}${inline}`) <= columns)
@@ -17,27 +12,23 @@ function labeledTokens(label, tokens, indent, columns) {
17
12
  }
18
13
  return [...renderTextBlock(label, indent, columns), ...tokens.map((token) => `${indent} ${token}`)];
19
14
  }
20
- export function settingsJsonValue(value) {
21
- return {
22
- scopes: value.scopes,
23
- namespaces: namespaceNames(value).map((name) => value.namespace(name)),
24
- };
25
- }
26
15
  export function renderSettingsText(value, columns = DEFAULT_CLI_COLUMNS) {
27
16
  const lines = [
28
17
  "settings",
29
18
  ...scopeLines("user", value.scopes.user, columns),
30
19
  ...scopeLines("project", value.scopes.project, columns),
31
20
  ];
32
- for (const name of namespaceNames(value)) {
33
- const view = value.namespace(name);
21
+ for (const [name, view] of Object.entries(value.namespaces ?? {})) {
34
22
  lines.push(` namespace ${fieldName(name)} ${view.kind}`);
35
23
  if (view.kind === "failed") {
36
- for (const failure of view.failures)
37
- lines.push(` failure ${failure.scope} ${failure.diagnostic}`);
24
+ for (const failure of view.failures) {
25
+ const scope = value.scopes[failure.scope];
26
+ const diagnostic = failure.diagnostic ?? (scope.kind === "failed" ? scope.diagnostic : undefined);
27
+ lines.push(` failure ${failure.scope}${diagnostic === undefined ? "" : ` ${diagnostic}`}`);
28
+ }
38
29
  }
39
- for (const entry of view.entries) {
40
- lines.push(` entry ${fieldName(entry.name)} · ${entry.source}${entry.shadows ? " · shadows user" : ""}`);
30
+ for (const [entryName, entry] of Object.entries(view.entries ?? {})) {
31
+ lines.push(` entry ${fieldName(entryName)} · ${entry.source}${entry.shadows ? " · shadows user" : ""}`);
41
32
  lines.push(...namedValueLines("value", entry.value, " "));
42
33
  }
43
34
  }
@@ -4,6 +4,8 @@ export declare function orderRefusalFacts(facts: readonly string[]): readonly st
4
4
  export type TextRenderContext = Readonly<{
5
5
  columns: number;
6
6
  color: boolean;
7
+ actor?: string;
8
+ now?: number;
7
9
  }>;
8
10
  type GitShortStat = Readonly<{
9
11
  filesChanged: number;
@@ -0,0 +1,4 @@
1
+ import type { VerbCompletion, VerbInput, VerbName, VerbOutput } from "../../library/keiyaku-verbs.js";
2
+ import { type TextRenderContext } from "./terminal.js";
3
+ /** Render native completion values without observing the World or parsing output. */
4
+ export declare function renderVerb<K extends VerbName>(name: K, input: VerbInput<K>, completion: VerbCompletion<VerbOutput<K>>, context: TextRenderContext): string;