@astrosheep/keiyaku 4.6.30 → 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 (464) hide show
  1. package/README.md +39 -22
  2. package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
  3. package/build/plugins/claude/skills/keiyaku/SKILL.md +12 -12
  4. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +27 -22
  5. package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +14 -14
  6. package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +15 -13
  7. package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +18 -17
  8. package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +30 -30
  9. package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +24 -23
  10. package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
  11. package/build/plugins/codex/skills/keiyaku/SKILL.md +12 -12
  12. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +27 -22
  13. package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +14 -14
  14. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +15 -13
  15. package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +18 -17
  16. package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +30 -30
  17. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +24 -23
  18. package/build/plugins/opencode/package.json +1 -1
  19. package/build/plugins/opencode/skills/keiyaku/SKILL.md +12 -12
  20. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +27 -22
  21. package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +14 -14
  22. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +15 -13
  23. package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +18 -17
  24. package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +30 -30
  25. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +24 -23
  26. package/build/plugins/pi/README.md +20 -22
  27. package/build/plugins/pi/akuma-tools.ts +43 -56
  28. package/build/plugins/pi/keiyaku.ts +15 -4
  29. package/build/skills/keiyaku/SKILL.md +12 -12
  30. package/build/skills/keiyaku-akuma/SKILL.md +27 -22
  31. package/build/skills/keiyaku-akuma/references/automation.md +14 -14
  32. package/build/skills/keiyaku-babysit/SKILL.md +15 -13
  33. package/build/skills/keiyaku-bind/SKILL.md +18 -17
  34. package/build/skills/keiyaku-debt/SKILL.md +30 -30
  35. package/build/skills/keiyaku-workflow/SKILL.md +24 -23
  36. package/build/src/akuma/akuma-call.d.ts +4 -6
  37. package/build/src/akuma/akuma-call.js +12 -15
  38. package/build/src/akuma/akuma-errors.d.ts +12 -9
  39. package/build/src/akuma/akuma-errors.js +16 -12
  40. package/build/src/akuma/akuma-instance.d.ts +102 -23
  41. package/build/src/akuma/akuma-instance.js +66 -66
  42. package/build/src/akuma/akuma-observe.d.ts +15 -15
  43. package/build/src/akuma/akuma-observe.js +34 -32
  44. package/build/src/akuma/akuma-owner.d.ts +46 -17
  45. package/build/src/akuma/akuma-owner.js +68 -43
  46. package/build/src/akuma/akuma-probe.d.ts +3 -3
  47. package/build/src/akuma/akuma-probe.js +2 -2
  48. package/build/src/akuma/akuma-selection-execution.d.ts +992 -5
  49. package/build/src/akuma/akuma-selection-execution.js +96 -125
  50. package/build/src/akuma/akuma-stream.d.ts +2 -2
  51. package/build/src/akuma/akuma-stream.js +1 -1
  52. package/build/src/akuma/akuma-wait.d.ts +7 -7
  53. package/build/src/akuma/akuma-wait.js +52 -14
  54. package/build/src/akuma/akuma.d.ts +88 -451
  55. package/build/src/akuma/akuma.js +58 -56
  56. package/build/src/akuma/archetype.d.ts +31 -21
  57. package/build/src/akuma/archetype.js +67 -52
  58. package/build/src/akuma/body-launch.d.ts +2 -2
  59. package/build/src/akuma/body.js +35 -30
  60. package/build/src/akuma/call-initial-tell.d.ts +63 -44
  61. package/build/src/akuma/call-initial-tell.js +50 -3
  62. package/build/src/akuma/call-input.d.ts +8 -1
  63. package/build/src/akuma/call-input.js +27 -18
  64. package/build/src/akuma/caller.d.ts +26 -17
  65. package/build/src/akuma/caller.js +24 -10
  66. package/build/src/akuma/coordinate.d.ts +9 -0
  67. package/build/src/akuma/coordinate.js +13 -0
  68. package/build/src/akuma/detached-body.js +3 -3
  69. package/build/src/akuma/dispatch-association.d.ts +4 -4
  70. package/build/src/akuma/dispatch-association.js +12 -3
  71. package/build/src/akuma/execution-instructions.js +2 -2
  72. package/build/src/akuma/heart/facts.d.ts +32 -9
  73. package/build/src/akuma/heart/facts.js +18 -5
  74. package/build/src/akuma/heart/index.d.ts +0 -3
  75. package/build/src/akuma/heart/index.js +3 -6
  76. package/build/src/akuma/heart/rows.js +2 -2
  77. package/build/src/akuma/heart/soul.js +25 -9
  78. package/build/src/akuma/identity.d.ts +18 -17
  79. package/build/src/akuma/identity.js +29 -23
  80. package/build/src/akuma/index.d.ts +7 -9
  81. package/build/src/akuma/index.js +2 -3
  82. package/build/src/akuma/lineage-cache.d.ts +4 -4
  83. package/build/src/akuma/lineage-cache.js +10 -10
  84. package/build/src/akuma/projection-read.d.ts +2 -5
  85. package/build/src/akuma/projection-read.js +34 -47
  86. package/build/src/akuma/projection.d.ts +662 -569
  87. package/build/src/akuma/projection.js +203 -94
  88. package/build/src/akuma/provider-recipe.js +3 -2
  89. package/build/src/akuma/providers/acp/config.js +11 -10
  90. package/build/src/akuma/providers/acp/index.js +3 -2
  91. package/build/src/akuma/providers/codex-app-server/index.js +7 -1
  92. package/build/src/akuma/providers/execution-environment.d.ts +1 -3
  93. package/build/src/akuma/providers/execution-environment.js +0 -4
  94. package/build/src/akuma/providers/grok-build/index.js +2 -1
  95. package/build/src/akuma/providers/index.d.ts +0 -1
  96. package/build/src/akuma/providers/index.js +0 -8
  97. package/build/src/akuma/providers/paseo/index.js +7 -4
  98. package/build/src/akuma/providers/pi/index.js +4 -3
  99. package/build/src/akuma/publication.d.ts +3 -4
  100. package/build/src/akuma/publication.js +19 -17
  101. package/build/src/akuma/retention.js +2 -2
  102. package/build/src/akuma/schema.d.ts +3 -49
  103. package/build/src/akuma/schema.js +6 -147
  104. package/build/src/akuma/selection-observation.d.ts +559 -54
  105. package/build/src/akuma/selection-observation.js +207 -1
  106. package/build/src/akuma/status-projection.d.ts +52 -0
  107. package/build/src/akuma/status-projection.js +194 -0
  108. package/build/src/akuma/turn-drive.js +0 -3
  109. package/build/src/alias/index.d.ts +9 -4
  110. package/build/src/alias/index.js +11 -9
  111. package/build/src/body/amend.js +2 -1
  112. package/build/src/body/arc.js +3 -2
  113. package/build/src/body/criteria.js +4 -3
  114. package/build/src/body/decode.js +2 -1
  115. package/build/src/body/envelope.js +2 -1
  116. package/build/src/body/region.d.ts +1 -3
  117. package/build/src/body/region.js +3 -8
  118. package/build/src/body-host.d.ts +4 -11
  119. package/build/src/body-host.js +5 -4
  120. package/build/src/bounded-list.d.ts +8 -0
  121. package/build/src/bounded-list.js +11 -1
  122. package/build/src/cli/commands/akuma-grammar.d.ts +109 -66
  123. package/build/src/cli/commands/akuma-grammar.js +90 -110
  124. package/build/src/cli/commands/akuma.d.ts +8 -4
  125. package/build/src/cli/commands/akuma.js +92 -287
  126. package/build/src/cli/commands/contract-grammar.d.ts +3 -134
  127. package/build/src/cli/commands/contract-grammar.js +127 -203
  128. package/build/src/cli/commands/contract-help.d.ts +26 -21
  129. package/build/src/cli/commands/contract-help.js +45 -36
  130. package/build/src/cli/commands/contract.d.ts +6 -15
  131. package/build/src/cli/commands/contract.js +80 -518
  132. package/build/src/cli/commands/debt-grammar.d.ts +2 -4
  133. package/build/src/cli/commands/debt-grammar.js +22 -190
  134. package/build/src/cli/commands/debt.d.ts +2 -3
  135. package/build/src/cli/commands/debt.js +41 -334
  136. package/build/src/cli/commands/report.d.ts +2 -4
  137. package/build/src/cli/commands/report.js +11 -28
  138. package/build/src/cli/commands/whoami.d.ts +3 -43
  139. package/build/src/cli/commands/whoami.js +8 -121
  140. package/build/src/cli/coordinates.d.ts +3 -34
  141. package/build/src/cli/coordinates.js +13 -129
  142. package/build/src/cli/main.js +9 -3
  143. package/build/src/cli/parse.d.ts +78 -7
  144. package/build/src/cli/parse.js +49 -32
  145. package/build/src/cli/render/akuma-activity.d.ts +41 -31
  146. package/build/src/cli/render/akuma-activity.js +262 -349
  147. package/build/src/cli/render/akuma.d.ts +26 -27
  148. package/build/src/cli/render/akuma.js +99 -135
  149. package/build/src/cli/render/catalog.d.ts +3 -9
  150. package/build/src/cli/render/catalog.js +27 -105
  151. package/build/src/cli/render/contract-history.d.ts +3 -1
  152. package/build/src/cli/render/contract-history.js +139 -215
  153. package/build/src/cli/render/contract-observation.d.ts +36 -30
  154. package/build/src/cli/render/contract-observation.js +64 -34
  155. package/build/src/cli/render/contract-wait.js +6 -6
  156. package/build/src/cli/render/contract.d.ts +39 -6
  157. package/build/src/cli/render/contract.js +249 -374
  158. package/build/src/cli/render/debt.d.ts +7 -25
  159. package/build/src/cli/render/debt.js +74 -210
  160. package/build/src/cli/render/delivery-preview.d.ts +4 -3
  161. package/build/src/cli/render/delivery-preview.js +68 -96
  162. package/build/src/cli/render/kanshi-akuma.d.ts +8 -6
  163. package/build/src/cli/render/kanshi-akuma.js +77 -62
  164. package/build/src/cli/render/kanshi.d.ts +2 -4
  165. package/build/src/cli/render/kanshi.js +184 -223
  166. package/build/src/cli/render/marks.d.ts +11 -2
  167. package/build/src/cli/render/marks.js +13 -3
  168. package/build/src/cli/render/nuke.d.ts +3 -3
  169. package/build/src/cli/render/nuke.js +13 -16
  170. package/build/src/cli/render/receipt.d.ts +46 -43
  171. package/build/src/cli/render/receipt.js +318 -236
  172. package/build/src/cli/render/reconcile.d.ts +6 -4
  173. package/build/src/cli/render/reconcile.js +53 -137
  174. package/build/src/cli/render/refusal.d.ts +6 -4
  175. package/build/src/cli/render/refusal.js +82 -65
  176. package/build/src/cli/render/region.d.ts +11 -2
  177. package/build/src/cli/render/region.js +17 -23
  178. package/build/src/cli/render/settings.d.ts +1 -2
  179. package/build/src/cli/render/settings.js +8 -17
  180. package/build/src/cli/render/terminal.d.ts +11 -8
  181. package/build/src/cli/render/terminal.js +48 -32
  182. package/build/src/cli/render/verbs.d.ts +6 -0
  183. package/build/src/cli/render/verbs.js +270 -0
  184. package/build/src/cli/render/whoami.d.ts +1 -1
  185. package/build/src/cli/render/whoami.js +24 -31
  186. package/build/src/cli/runtime.d.ts +3 -11
  187. package/build/src/cli/runtime.js +119 -101
  188. package/build/src/cli/scan.d.ts +1 -1
  189. package/build/src/cli/streams.d.ts +2 -9
  190. package/build/src/cli/streams.js +9 -1
  191. package/build/src/cli/usage.d.ts +2 -1
  192. package/build/src/cli/usage.js +3 -2
  193. package/build/src/contract-guidance.js +2 -2
  194. package/build/src/contract-worktree.d.ts +2 -15
  195. package/build/src/contract-worktree.js +20 -44
  196. package/build/src/core/facts/codec.js +9 -23
  197. package/build/src/core/facts/errors.d.ts +2 -1
  198. package/build/src/core/facts/errors.js +3 -3
  199. package/build/src/core/facts/observation.d.ts +4 -5
  200. package/build/src/core/facts/observation.js +7 -9
  201. package/build/src/core/facts/types.d.ts +2 -13
  202. package/build/src/core/facts/types.js +1 -6
  203. package/build/src/core/verbs/abandon.d.ts +1 -2
  204. package/build/src/core/verbs/amend.d.ts +1 -3
  205. package/build/src/core/verbs/amend.js +3 -3
  206. package/build/src/core/verbs/arc.d.ts +1 -2
  207. package/build/src/core/verbs/attestation.d.ts +1 -2
  208. package/build/src/core/verbs/bind.d.ts +1 -3
  209. package/build/src/core/verbs/bind.js +5 -5
  210. package/build/src/core/verbs/deliver.d.ts +4 -4
  211. package/build/src/core/verbs/deliver.js +2 -2
  212. package/build/src/core/verbs/placement.d.ts +1 -7
  213. package/build/src/core/verbs/placement.js +4 -6
  214. package/build/src/core/verbs/reintegrate.d.ts +1 -3
  215. package/build/src/core/verbs/reintegrate.js +2 -2
  216. package/build/src/debt/board.d.ts +70 -134
  217. package/build/src/debt/board.js +99 -190
  218. package/build/src/debt/catalog.d.ts +4 -6
  219. package/build/src/debt/catalog.js +3 -40
  220. package/build/src/debt/document.d.ts +23 -21
  221. package/build/src/debt/document.js +32 -58
  222. package/build/src/debt/identity.d.ts +2 -14
  223. package/build/src/debt/identity.js +19 -49
  224. package/build/src/debt/index.d.ts +239 -54
  225. package/build/src/debt/index.js +85 -88
  226. package/build/src/debt/input.d.ts +21 -6
  227. package/build/src/debt/input.js +57 -169
  228. package/build/src/debt/lifecycle-operations.d.ts +1 -3
  229. package/build/src/debt/lifecycle-operations.js +6 -86
  230. package/build/src/debt/operation-types.d.ts +97 -79
  231. package/build/src/debt/operation-types.js +57 -1
  232. package/build/src/debt/operations.d.ts +11 -19
  233. package/build/src/debt/operations.js +70 -191
  234. package/build/src/debt/store.d.ts +4 -4
  235. package/build/src/debt/store.js +40 -95
  236. package/build/src/debt/view.d.ts +0 -3
  237. package/build/src/debt/view.js +0 -4
  238. package/build/src/dispatch/index.d.ts +22 -5
  239. package/build/src/dispatch/index.js +46 -37
  240. package/build/src/errors.d.ts +28 -0
  241. package/build/src/errors.js +26 -0
  242. package/build/src/git/admission.d.ts +2 -2
  243. package/build/src/git/admission.js +2 -1
  244. package/build/src/git/hooks.d.ts +15 -36
  245. package/build/src/git/hooks.js +45 -25
  246. package/build/src/git/integration.d.ts +6 -24
  247. package/build/src/git/integration.js +10 -16
  248. package/build/src/git/observe.d.ts +3 -0
  249. package/build/src/git/observe.js +19 -5
  250. package/build/src/git/private-state-seat.d.ts +2 -2
  251. package/build/src/git/private-state-seat.js +2 -1
  252. package/build/src/git/reconcile.d.ts +20 -95
  253. package/build/src/git/reconcile.js +37 -70
  254. package/build/src/git/repository.d.ts +2 -1
  255. package/build/src/git/repository.js +3 -3
  256. package/build/src/git/scratch.d.ts +3 -3
  257. package/build/src/git/scratch.js +4 -1
  258. package/build/src/git/target-placement.d.ts +27 -35
  259. package/build/src/git/target-placement.js +42 -27
  260. package/build/src/git/target.d.ts +4 -4
  261. package/build/src/git/target.js +2 -1
  262. package/build/src/git/tender.d.ts +8 -41
  263. package/build/src/git/tender.js +26 -66
  264. package/build/src/git/terminal-reconcile.js +15 -18
  265. package/build/src/git/terminal-seal.d.ts +2 -4
  266. package/build/src/git/terminal-seal.js +7 -33
  267. package/build/src/git/workspace.d.ts +65 -41
  268. package/build/src/git/workspace.js +45 -14
  269. package/build/src/identity/coordinates.d.ts +1 -1
  270. package/build/src/identity/coordinates.js +3 -2
  271. package/build/src/identity/normalize.js +2 -1
  272. package/build/src/identity/selector.d.ts +2 -0
  273. package/build/src/identity/selector.js +17 -6
  274. package/build/src/index.d.ts +37 -66
  275. package/build/src/index.js +10 -47
  276. package/build/src/kanshi/counts.d.ts +44 -15
  277. package/build/src/kanshi/counts.js +18 -15
  278. package/build/src/kanshi/index.d.ts +22 -7
  279. package/build/src/kanshi/index.js +30 -3
  280. package/build/src/kanshi/read.d.ts +309 -15
  281. package/build/src/kanshi/read.js +226 -535
  282. package/build/src/kanshi/report.d.ts +1225 -103
  283. package/build/src/kanshi/report.js +153 -1
  284. package/build/src/kanshi/select.d.ts +0 -8
  285. package/build/src/kanshi/select.js +20 -59
  286. package/build/src/library/address.d.ts +17 -17
  287. package/build/src/library/address.js +41 -34
  288. package/build/src/library/akuma-creation.d.ts +828 -91
  289. package/build/src/library/akuma-creation.js +292 -273
  290. package/build/src/library/akuma-retention.d.ts +2 -2
  291. package/build/src/library/akuma-retention.js +2 -2
  292. package/build/src/library/akumas.d.ts +33 -10
  293. package/build/src/library/akumas.js +109 -25
  294. package/build/src/library/bind.d.ts +32 -61
  295. package/build/src/library/bind.js +8 -12
  296. package/build/src/library/continuation.d.ts +133 -505
  297. package/build/src/library/continuation.js +37 -29
  298. package/build/src/library/contract-address.d.ts +8 -10
  299. package/build/src/library/contract-address.js +16 -23
  300. package/build/src/library/contract-composition.d.ts +18 -13
  301. package/build/src/library/contract-composition.js +62 -61
  302. package/build/src/library/contract-creation.d.ts +3 -2
  303. package/build/src/library/contract-creation.js +54 -49
  304. package/build/src/library/contract-outcomes.d.ts +2365 -43
  305. package/build/src/library/contract-outcomes.js +73 -16
  306. package/build/src/library/contract-settings.d.ts +3 -4
  307. package/build/src/library/contract-settings.js +21 -19
  308. package/build/src/library/contract-types.d.ts +227 -75
  309. package/build/src/library/contract-types.js +90 -1
  310. package/build/src/library/contract-wait.d.ts +75 -17
  311. package/build/src/library/contract-wait.js +61 -24
  312. package/build/src/library/delivery.d.ts +566 -37
  313. package/build/src/library/delivery.js +16 -28
  314. package/build/src/library/input.d.ts +31 -5
  315. package/build/src/library/input.js +40 -41
  316. package/build/src/library/invocation.d.ts +18 -12
  317. package/build/src/library/invocation.js +98 -96
  318. package/build/src/library/kei.d.ts +56 -0
  319. package/build/src/library/kei.js +696 -0
  320. package/build/src/{cli/delivery-identity.js → library/keiyaku-attribution.js} +1 -1
  321. package/build/src/library/keiyaku-classify.d.ts +11 -0
  322. package/build/src/library/keiyaku-classify.js +127 -0
  323. package/build/src/library/keiyaku-coordinates.d.ts +26 -0
  324. package/build/src/library/keiyaku-coordinates.js +83 -0
  325. package/build/src/library/keiyaku-debt.d.ts +70 -0
  326. package/build/src/library/keiyaku-debt.js +39 -0
  327. package/build/src/library/keiyaku-identity.d.ts +58 -0
  328. package/build/src/library/keiyaku-identity.js +177 -0
  329. package/build/src/library/keiyaku-verbs.d.ts +6893 -0
  330. package/build/src/library/keiyaku-verbs.js +496 -0
  331. package/build/src/library/keiyaku.d.ts +41 -38
  332. package/build/src/library/keiyaku.js +590 -127
  333. package/build/src/library/nuke.d.ts +25 -1
  334. package/build/src/library/nuke.js +9 -2
  335. package/build/src/library/outcome.d.ts +867 -736
  336. package/build/src/library/outcome.js +431 -211
  337. package/build/src/library/reconcile.d.ts +652 -116
  338. package/build/src/library/reconcile.js +146 -108
  339. package/build/src/library/refusal.d.ts +118 -590
  340. package/build/src/library/refusal.js +54 -51
  341. package/build/src/library/region.d.ts +5 -24
  342. package/build/src/library/region.js +6 -21
  343. package/build/src/library/repo.js +4 -3
  344. package/build/src/library/selection.d.ts +205 -45
  345. package/build/src/library/selection.js +139 -128
  346. package/build/src/mcp/adapter.d.ts +17 -0
  347. package/build/src/mcp/adapter.js +241 -0
  348. package/build/src/mcp/help.d.ts +1 -0
  349. package/build/src/mcp/help.js +31 -0
  350. package/build/src/mcp/index.d.ts +2 -0
  351. package/build/src/mcp/index.js +37 -0
  352. package/build/src/mcp/output.d.ts +385 -0
  353. package/build/src/mcp/output.js +193 -0
  354. package/build/src/plugin/public.d.ts +5 -1
  355. package/build/src/plugin/runtime.d.ts +1 -1
  356. package/build/src/plugin/runtime.js +19 -16
  357. package/build/src/protocol/amend.d.ts +1 -1
  358. package/build/src/protocol/amend.js +2 -2
  359. package/build/src/protocol/arc.d.ts +4 -1
  360. package/build/src/protocol/arc.js +7 -1
  361. package/build/src/protocol/attempt.d.ts +2 -3
  362. package/build/src/protocol/attempt.js +1 -10
  363. package/build/src/protocol/bind.d.ts +10 -13
  364. package/build/src/protocol/bind.js +12 -8
  365. package/build/src/protocol/completion.d.ts +412 -13
  366. package/build/src/protocol/completion.js +202 -28
  367. package/build/src/protocol/deliver.d.ts +35 -28
  368. package/build/src/protocol/deliver.js +52 -80
  369. package/build/src/protocol/delivery-preview.d.ts +102 -250
  370. package/build/src/protocol/delivery-preview.js +134 -130
  371. package/build/src/protocol/execution-observation.d.ts +136 -121
  372. package/build/src/protocol/execution-observation.js +9 -6
  373. package/build/src/protocol/intent.d.ts +14 -56
  374. package/build/src/protocol/intent.js +46 -73
  375. package/build/src/protocol/operations.d.ts +240 -543
  376. package/build/src/protocol/operations.js +89 -151
  377. package/build/src/protocol/outcome.d.ts +3 -1
  378. package/build/src/protocol/placement.d.ts +1 -3
  379. package/build/src/protocol/placement.js +6 -3
  380. package/build/src/protocol/progress.d.ts +8 -97
  381. package/build/src/protocol/progress.js +7 -55
  382. package/build/src/protocol/read/observation.d.ts +13 -6
  383. package/build/src/protocol/read/observation.js +10 -9
  384. package/build/src/protocol/read/status.d.ts +386 -98
  385. package/build/src/protocol/read/status.js +400 -139
  386. package/build/src/protocol/reconcile.d.ts +2 -0
  387. package/build/src/protocol/reconcile.js +12 -11
  388. package/build/src/protocol/reintegrate.d.ts +1 -3
  389. package/build/src/protocol/reintegrate.js +4 -5
  390. package/build/src/protocol/result-leaves.d.ts +507 -0
  391. package/build/src/protocol/result-leaves.js +156 -0
  392. package/build/src/protocol/result-reasons.d.ts +129 -0
  393. package/build/src/protocol/result-reasons.js +87 -0
  394. package/build/src/protocol/review.d.ts +14 -11
  395. package/build/src/protocol/review.js +30 -15
  396. package/build/src/protocol/run.d.ts +4 -4
  397. package/build/src/protocol/run.js +4 -1
  398. package/build/src/protocol/verify.d.ts +406 -31
  399. package/build/src/protocol/verify.js +137 -34
  400. package/build/src/region.d.ts +26 -0
  401. package/build/src/region.js +28 -0
  402. package/build/src/runtime/proc/diagnostic.d.ts +11 -0
  403. package/build/src/runtime/proc/diagnostic.js +20 -0
  404. package/build/src/runtime/proc/windows-launch.exe +0 -0
  405. package/build/src/settings.d.ts +133 -40
  406. package/build/src/settings.js +122 -46
  407. package/build/src/settlement/holder.js +2 -2
  408. package/build/src/settlement/settle.d.ts +29 -18
  409. package/build/src/settlement/settle.js +22 -19
  410. package/build/src/verification/declaration.d.ts +4 -9
  411. package/build/src/verification/declaration.js +5 -10
  412. package/build/src/verification/execution.d.ts +7 -19
  413. package/build/src/verification/execution.js +37 -16
  414. package/build/src/verification/observation.d.ts +11 -11
  415. package/build/src/verification/observation.js +9 -7
  416. package/build/src/world.d.ts +11 -2
  417. package/build/src/world.js +12 -6
  418. package/package.json +6 -5
  419. package/plugins/paseo/plugin/index.server.ts +1 -1
  420. package/plugins/paseo/plugin/server/attach.ts +74 -67
  421. package/plugins/paseo/plugin/server/keiyaku.ts +73 -40
  422. package/plugins/paseo/plugin/server/message.ts +9 -30
  423. package/plugins/paseo/plugin/server/mirror-identity.ts +6 -4
  424. package/plugins/paseo/plugin/server/mirror.ts +16 -20
  425. package/plugins/paseo/plugin/server/provider.ts +1 -1
  426. package/plugins/paseo/plugin/server/sdk.ts +12 -6
  427. package/plugins/paseo/plugin/server/transport.ts +24 -1
  428. package/plugins/pi/README.md +20 -22
  429. package/plugins/pi/akuma-tools.ts +43 -56
  430. package/plugins/pi/keiyaku.ts +15 -4
  431. package/skills/keiyaku/SKILL.md +12 -12
  432. package/skills/keiyaku-akuma/SKILL.md +27 -22
  433. package/skills/keiyaku-akuma/references/automation.md +14 -14
  434. package/skills/keiyaku-babysit/SKILL.md +15 -13
  435. package/skills/keiyaku-bind/SKILL.md +18 -17
  436. package/skills/keiyaku-debt/SKILL.md +30 -30
  437. package/skills/keiyaku-workflow/SKILL.md +24 -23
  438. package/build/src/akuma/providers/codex-app-server/configuration.d.ts +0 -5
  439. package/build/src/akuma/providers/codex-app-server/configuration.js +0 -72
  440. package/build/src/cli/actor.d.ts +0 -10
  441. package/build/src/cli/actor.js +0 -24
  442. package/build/src/cli/akuma-caller.d.ts +0 -3
  443. package/build/src/cli/akuma-caller.js +0 -31
  444. package/build/src/cli/commands/debt-query.d.ts +0 -5
  445. package/build/src/cli/commands/debt-query.js +0 -194
  446. package/build/src/cli/render/akuma-tool-command.d.ts +0 -6
  447. package/build/src/cli/render/akuma-tool-command.js +0 -143
  448. package/build/src/cli/render/akuma-tool.d.ts +0 -32
  449. package/build/src/cli/render/akuma-tool.js +0 -219
  450. package/build/src/cli/render/effects.d.ts +0 -26
  451. package/build/src/cli/render/effects.js +0 -41
  452. package/build/src/cli/selectors.d.ts +0 -10
  453. package/build/src/cli/selectors.js +0 -42
  454. package/build/src/debt/context.d.ts +0 -16
  455. package/build/src/debt/context.js +0 -91
  456. package/build/src/debt/created-observation.d.ts +0 -38
  457. package/build/src/debt/created-observation.js +0 -30
  458. package/build/src/debt/query.d.ts +0 -76
  459. package/build/src/debt/query.js +0 -292
  460. package/build/src/library/contract-execution.d.ts +0 -28
  461. package/build/src/library/contract-execution.js +0 -467
  462. package/build/src/markdown/diff.d.ts +0 -1
  463. package/build/src/markdown/diff.js +0 -4
  464. /package/build/src/{cli/delivery-identity.d.ts → library/keiyaku-attribution.d.ts} +0 -0
@@ -1,5 +1,7 @@
1
- import type { ReconcileReport } from "../../library/reconcile.js";
2
- import { type RepoReconcileReport } from "../../library/reconcile.js";
1
+ import type { ReconcileCompletion, RepoReconcileReport } from "../../library/reconcile.js";
2
+ import type { VerbDisposition } from "../../library/keiyaku-verbs.js";
3
3
  import { type TextRenderContext } from "./terminal.js";
4
- export declare function reconcileHasFailure(report: ReconcileReport | RepoReconcileReport): boolean;
5
- export declare function renderReconcile(report: ReconcileReport | RepoReconcileReport, context?: TextRenderContext): string;
4
+ type ReconcileReport = ReconcileCompletion | RepoReconcileReport;
5
+ /** Reconcile reports only native disposition, movement, and repair issues; it never re-adjudicates them. */
6
+ export declare function renderReconcile(report: ReconcileReport, context?: TextRenderContext, disposition?: VerbDisposition): string;
7
+ export {};
@@ -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,12 +1,14 @@
1
+ import type { NextCall } from "../../errors.js";
1
2
  import type { BindDraftReceipt } from "../draft.js";
2
3
  import { type CliUsageGuide } from "../usage.js";
3
- import type { ContractId, IntegrationConflictMaterialized, KeiyakuRefusal } from "../../index.js";
4
+ import type { ContractId, KeiyakuRefusal } from "../../index.js";
5
+ import type { HandoffOutcome } from "../../library/outcome.js";
4
6
  import { type TextRenderContext } from "./terminal.js";
5
7
  type DirtyWithOption = Extract<KeiyakuRefusal, {
6
8
  kind: "dirty-workspace";
7
9
  }> & {
8
10
  option?: Readonly<{
9
- flag: string;
11
+ next: NextCall;
10
12
  available: boolean;
11
13
  }>;
12
14
  };
@@ -16,7 +18,7 @@ type CliEdgeRefusal = Readonly<{
16
18
  diagnostic: string;
17
19
  }>;
18
20
  export type RenderableRefusal = KeiyakuRefusal | DirtyWithOption | CliEdgeRefusal;
19
- export declare function renderRefusalFacts(refusal: RenderableRefusal, indent: string, columns: number, addressed?: string): readonly string[];
21
+ export declare function renderRefusalFacts(refusal: RenderableRefusal, indent: string, columns: number, addressed?: string, surface?: TextRenderContext["surface"]): readonly string[];
20
22
  /**
21
23
  * The one refusal receipt assembly: a denied-verdict title, a labeled reason, labeled facts, and the
22
24
  * applicable acceptance grammar. Typed refusals and bare command refusals both render through here.
@@ -29,6 +31,6 @@ type RefusedInvocation = Readonly<{
29
31
  refusal: RenderableRefusal;
30
32
  }>;
31
33
  export declare function renderRefusal(refused: RefusedInvocation, draft?: BindDraftReceipt, context?: TextRenderContext): string;
32
- export declare function renderConflictMaterialized(result: IntegrationConflictMaterialized, _context?: TextRenderContext): string;
34
+ export declare function renderConflictMaterialized(result: HandoffOutcome, context?: TextRenderContext): string;
33
35
  export declare function renderBindDraftReceipt(receipt: BindDraftReceipt): string;
34
36
  export {};
@@ -1,49 +1,46 @@
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, formatNextCall, 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, surface) {
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) {
41
- lines.push(`${indent}option ${refusal.option.flag} · unavailable with submodule changes`);
38
+ lines.push(`${indent}option ${formatNextCall(refusal.option.next, surface)} · unavailable with submodule changes`);
42
39
  }
43
40
  else {
44
- lines.push(`${indent}option ${refusal.option.flag} · captures complete non-ignored worktree bytes`);
41
+ lines.push(`${indent}option ${formatNextCall(refusal.option.next, surface)} · captures complete non-ignored worktree bytes`);
45
42
  lines.push(`${indent}capture index private · real index unchanged, including any unmerged entries`);
46
- lines.push(`${indent}staging not required for --include-dirty`);
43
+ lines.push(`${indent}staging not required for worktree capture`);
47
44
  }
48
45
  return lines;
49
46
  }
@@ -52,78 +49,98 @@ function verificationRefusalFacts(refusal, indent, identity) {
52
49
  if (refusal.kind === "verification-declaration-invalid")
53
50
  return [
54
51
  ...contract,
55
- `${indent}reason gate 'verified' requires a declared Verification; the Contract declares none`,
52
+ `${indent}reason Verification requires valid executable declarations; the Contract declares none`,
56
53
  ];
57
- if (refusal.kind === "verification-not-selected")
58
- return [`${indent}reason Contract does not select the verified gate`, ...contract];
59
54
  if (refusal.kind === "verification-index-out-of-range")
60
55
  return [
61
56
  `${indent}reason Verification declaration index is out of range`,
62
57
  ...contract,
63
- `${indent}index ${refusal.index}`,
64
58
  `${indent}declarations ${refusal.total}`,
65
59
  ];
66
60
  return undefined;
67
61
  }
68
- // eslint-disable-next-line complexity -- one closed projection preserves every refusal fact.
69
- function refusalFacts(refusal, indent, columns, addressed) {
62
+ function targetRefusalLines(target, indent, identity, contract) {
63
+ return [
64
+ ...(identity === undefined ? [] : [`${indent}contract ${safeText(identity)}`]),
65
+ ...(target === undefined ? [] : [`${indent}target ${safeText(target)}`]),
66
+ ...(contract === undefined ? [] : [`${indent}detail ${safeText(contract)}`]),
67
+ ];
68
+ }
69
+ function nukeRefusalFacts(refusal, indent) {
70
+ const world = safeText(refusal.world);
71
+ return [
72
+ `${indent}reason ${refusalWords(refusal.kind)}`,
73
+ `${indent}world ${world}`,
74
+ ...(refusal.kind === "nuke-confirmation-mismatch"
75
+ ? [`${indent}confirmation ${safeText(refusal.confirmation)}`]
76
+ : []),
77
+ `${indent}option keiyaku nuke --confirm '${world.replaceAll("'", "'\"'\"'")}'`,
78
+ ];
79
+ }
80
+ function refusalFacts(refusal, indent, columns, addressed, surface) {
70
81
  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
- }
82
+ const target = "targetContractId" in refusal ? refusal.targetContractId : undefined;
83
+ if (refusal.kind === "nuke-confirmation-mismatch" || refusal.kind === "nuke-confirmation-required")
84
+ return nukeRefusalFacts(refusal, indent);
82
85
  const verification = verificationRefusalFacts(refusal, indent, identity);
83
86
  if (verification !== undefined)
84
87
  return verification;
85
88
  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)];
89
+ return renderDirtyRefusal(refusal, indent, columns, surface);
90
+ if (refusal.kind === "dirty-submodules") {
91
+ return [
92
+ `${indent}reason submodule changes cannot be captured for review`,
93
+ ...collectionLines("paths", refusal.paths, indent),
94
+ ];
95
+ }
96
+ if (refusal.kind === "integration-conflict") {
97
+ return [
98
+ `${indent}reason integration conflict`,
99
+ ...targetRefusalLines(undefined, indent, identity, undefined),
100
+ `${indent}target ${safeText(refusal.targetHead)}`,
101
+ ...collectionLines("conflicts", refusal.conflictPaths, indent),
102
+ `${indent}option materialize ${formatNextCall({ verb: "deliver", input: { materializeConflict: true, includeDirty: true } }, surface)}`,
103
+ `${indent}option deliver ${formatNextCall({ verb: "deliver", input: { includeDirty: true } }, surface)}`,
104
+ ];
89
105
  }
90
- if (refusal.kind === "integration-failed") {
91
- const lines = [
106
+ if (refusal.kind === "not-based-on-target" || refusal.kind === "unrelated-histories") {
107
+ return [
92
108
  `${indent}reason ${refusalWords(refusal.kind)}`,
93
- ...(identity === undefined ? [] : [`${indent}contract ${safeText(identity)}`]),
109
+ ...targetRefusalLines(undefined, indent, identity, undefined),
110
+ `${indent}target ${safeText(refusal.targetHead)}`,
94
111
  ];
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
112
  }
104
113
  if (refusal.kind === "merge-state-present") {
105
114
  return [
106
115
  `${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)}`,
116
+ ...targetRefusalLines(undefined, indent, identity, undefined),
117
+ `${indent}worktree ${safeText(refusal.worktreePath)}`,
110
118
  ];
111
119
  }
112
120
  if (refusal.kind === "integration-unsupported") {
113
121
  return [
114
122
  `${indent}reason ${refusalWords(refusal.kind)}`,
115
- ...(identity === undefined ? [] : [`${indent}contract ${safeText(identity)}`]),
116
- `${indent}required Git ${safeText(refusal.requiredGit)}`,
123
+ ...targetRefusalLines(undefined, indent, identity, undefined),
117
124
  ];
118
125
  }
119
126
  if (refusal.kind === "checkout-not-followable") {
120
- return checkoutNotFollowableLines(refusal);
127
+ return [
128
+ `${indent}reason checkout not followable`,
129
+ ...targetRefusalLines(refusal.target, indent, identity, undefined),
130
+ `${indent}checkout ${safeText(refusal.path)}`,
131
+ ...collectionLines("paths", refusal.paths, indent),
132
+ ];
121
133
  }
122
134
  if (refusal.kind === "target-workspace-unavailable") {
123
135
  return [
124
136
  `${indent}reason target workspace unavailable`,
125
- `${indent}contract ${safeText(refusal.contractId)}`,
126
- `${indent}detail ${safeText(refusal.reason.replaceAll("-", " "))}`,
137
+ ...targetRefusalLines(target, indent, identity, words(refusal.reason)),
138
+ ];
139
+ }
140
+ if (refusal.kind === "target-contract-missing" || refusal.kind === "target-contract-terminal") {
141
+ return [
142
+ `${indent}reason ${refusalWords(refusal.kind)}`,
143
+ ...targetRefusalLines(target, indent, identity, undefined),
127
144
  ];
128
145
  }
129
146
  const lines = [`${indent}reason ${refusalWords(refusal.kind)}`];
@@ -134,8 +151,8 @@ function refusalFacts(refusal, indent, columns, addressed) {
134
151
  lines.push(`${indent}detail ${safeText(detail)}`);
135
152
  return lines;
136
153
  }
137
- export function renderRefusalFacts(refusal, indent, columns, addressed) {
138
- return orderRefusalFacts(refusalFacts(refusal, indent, columns, addressed).map((line) => line.slice(indent.length))).map((line) => `${indent}${line}`);
154
+ export function renderRefusalFacts(refusal, indent, columns, addressed, surface) {
155
+ return orderRefusalFacts(refusalFacts(refusal, indent, columns, addressed, surface).map((line) => line.slice(indent.length))).map((line) => `${indent}${line}`);
139
156
  }
140
157
  function refusalTitle(verb) {
141
158
  return `× ${contractOperationName(verb)} refused`;
@@ -155,11 +172,11 @@ export function renderRefusal(refused, draft, context) {
155
172
  const lines = [refusalTitle(refused.operation)];
156
173
  if (refused.contract !== undefined)
157
174
  lines.push(` contract ${safeText(refused.contract)}`);
158
- lines.push(...renderRefusalFacts(refused.refusal, " ", columns, refused.contract));
175
+ lines.push(...renderRefusalFacts(refused.refusal, " ", columns, refused.contract, context?.surface));
159
176
  const output = lines.join("\n");
160
177
  return draft === undefined ? output : `${output}\n${renderBindDraftReceipt(draft)}`;
161
178
  }
162
- export function renderConflictMaterialized(result, _context) {
179
+ export function renderConflictMaterialized(result, context) {
163
180
  const indent = " ";
164
181
  return [
165
182
  "! integration-conflict-materialized",
@@ -169,8 +186,8 @@ export function renderConflictMaterialized(result, _context) {
169
186
  `${indent}saved worktree bytes before projection`,
170
187
  `${indent}handoff base ${shortGitId(result.handoffBase)}`,
171
188
  ...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`,
189
+ `${indent}workspace ${safeText(result.worktreePath)}`,
190
+ `${indent}option deliver ${formatNextCall({ verb: "deliver", input: { includeDirty: true } }, context?.surface)} · reads worktree bytes, not index`,
174
191
  ].join("\n");
175
192
  }
176
193
  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
- export declare function renderSettingsText(value: Settings, columns?: number): string;
2
+ export declare function renderSettingsText(value: Omit<Settings, "namespace">, 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
  }