@astrosheep/keiyaku 4.6.30 → 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 (398) 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 +12 -12
  4. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +16 -16
  5. package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +14 -14
  6. package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +10 -10
  7. package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +15 -15
  8. package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +16 -16
  9. package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +21 -21
  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 +16 -16
  13. package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +14 -14
  14. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +10 -10
  15. package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +15 -15
  16. package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +16 -16
  17. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +21 -21
  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 +16 -16
  21. package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +14 -14
  22. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +10 -10
  23. package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +15 -15
  24. package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +16 -16
  25. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +21 -21
  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 +12 -12
  29. package/build/skills/keiyaku-akuma/SKILL.md +16 -16
  30. package/build/skills/keiyaku-akuma/references/automation.md +14 -14
  31. package/build/skills/keiyaku-babysit/SKILL.md +10 -10
  32. package/build/skills/keiyaku-bind/SKILL.md +15 -15
  33. package/build/skills/keiyaku-debt/SKILL.md +16 -16
  34. package/build/skills/keiyaku-workflow/SKILL.md +21 -21
  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 +157 -149
  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 +4 -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 -221
  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 +19 -35
  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/private-state-seat.d.ts +2 -2
  213. package/build/src/git/private-state-seat.js +2 -1
  214. package/build/src/git/reconcile.d.ts +17 -79
  215. package/build/src/git/reconcile.js +37 -52
  216. package/build/src/git/scratch.d.ts +3 -3
  217. package/build/src/git/scratch.js +4 -1
  218. package/build/src/git/target-placement.d.ts +23 -31
  219. package/build/src/git/target-placement.js +42 -27
  220. package/build/src/git/target.d.ts +2 -2
  221. package/build/src/git/target.js +2 -1
  222. package/build/src/git/tender.d.ts +7 -39
  223. package/build/src/git/tender.js +21 -54
  224. package/build/src/git/terminal-reconcile.js +15 -18
  225. package/build/src/git/terminal-seal.d.ts +2 -4
  226. package/build/src/git/terminal-seal.js +7 -33
  227. package/build/src/git/workspace.d.ts +65 -41
  228. package/build/src/git/workspace.js +45 -14
  229. package/build/src/identity/selector.d.ts +2 -0
  230. package/build/src/identity/selector.js +13 -3
  231. package/build/src/index.d.ts +48 -54
  232. package/build/src/index.js +31 -43
  233. package/build/src/kanshi/counts.d.ts +42 -8
  234. package/build/src/kanshi/counts.js +13 -2
  235. package/build/src/kanshi/index.d.ts +5 -5
  236. package/build/src/kanshi/index.js +4 -3
  237. package/build/src/kanshi/read.d.ts +489 -6
  238. package/build/src/kanshi/read.js +334 -483
  239. package/build/src/kanshi/report.d.ts +2504 -103
  240. package/build/src/kanshi/report.js +165 -1
  241. package/build/src/kanshi/select.d.ts +0 -8
  242. package/build/src/kanshi/select.js +20 -59
  243. package/build/src/library/address.d.ts +8 -8
  244. package/build/src/library/address.js +7 -7
  245. package/build/src/library/akuma-creation.d.ts +690 -84
  246. package/build/src/library/akuma-creation.js +202 -142
  247. package/build/src/library/akuma-retention.d.ts +2 -2
  248. package/build/src/library/akuma-retention.js +2 -2
  249. package/build/src/library/akumas.d.ts +10 -6
  250. package/build/src/library/akumas.js +24 -7
  251. package/build/src/library/bind.d.ts +28 -54
  252. package/build/src/library/bind.js +6 -4
  253. package/build/src/library/continuation.d.ts +197 -479
  254. package/build/src/library/continuation.js +40 -23
  255. package/build/src/library/contract-address.d.ts +6 -5
  256. package/build/src/library/contract-address.js +5 -7
  257. package/build/src/library/contract-composition.d.ts +18 -12
  258. package/build/src/library/contract-composition.js +55 -47
  259. package/build/src/library/contract-creation.d.ts +3 -2
  260. package/build/src/library/contract-creation.js +38 -32
  261. package/build/src/library/contract-execution.js +77 -38
  262. package/build/src/library/contract-outcomes.d.ts +1877 -27
  263. package/build/src/library/contract-outcomes.js +93 -10
  264. package/build/src/library/contract-settings.d.ts +2 -2
  265. package/build/src/library/contract-settings.js +18 -14
  266. package/build/src/library/contract-types.d.ts +238 -61
  267. package/build/src/library/contract-types.js +131 -1
  268. package/build/src/library/contract-wait.d.ts +38 -17
  269. package/build/src/library/contract-wait.js +40 -10
  270. package/build/src/library/delivery.d.ts +588 -36
  271. package/build/src/library/delivery.js +35 -27
  272. package/build/src/library/input.d.ts +1 -1
  273. package/build/src/library/input.js +1 -2
  274. package/build/src/library/invocation.d.ts +11 -7
  275. package/build/src/library/invocation.js +42 -51
  276. package/build/src/library/kei.d.ts +48 -0
  277. package/build/src/library/kei.js +256 -0
  278. package/build/src/library/keiyaku-attribution.d.ts +11 -0
  279. package/build/src/{cli/delivery-identity.js → library/keiyaku-attribution.js} +12 -1
  280. package/build/src/library/keiyaku-classify.d.ts +11 -0
  281. package/build/src/library/keiyaku-classify.js +146 -0
  282. package/build/src/library/keiyaku-coordinates.d.ts +31 -0
  283. package/build/src/library/keiyaku-coordinates.js +103 -0
  284. package/build/src/library/keiyaku-debt.d.ts +142 -0
  285. package/build/src/library/keiyaku-debt.js +188 -0
  286. package/build/src/library/keiyaku-identity.d.ts +58 -0
  287. package/build/src/library/keiyaku-identity.js +176 -0
  288. package/build/src/library/keiyaku-policy.d.ts +27 -0
  289. package/build/src/library/keiyaku-policy.js +44 -0
  290. package/build/src/library/keiyaku-status.d.ts +1487 -0
  291. package/build/src/library/keiyaku-status.js +92 -0
  292. package/build/src/library/keiyaku-verbs.d.ts +6774 -0
  293. package/build/src/library/keiyaku-verbs.js +458 -0
  294. package/build/src/library/keiyaku.d.ts +871 -38
  295. package/build/src/library/keiyaku.js +677 -127
  296. package/build/src/library/nuke.d.ts +22 -0
  297. package/build/src/library/nuke.js +4 -1
  298. package/build/src/library/outcome.d.ts +706 -692
  299. package/build/src/library/outcome.js +582 -167
  300. package/build/src/library/reconcile.d.ts +464 -116
  301. package/build/src/library/reconcile.js +174 -102
  302. package/build/src/library/refusal.d.ts +113 -577
  303. package/build/src/library/refusal.js +64 -51
  304. package/build/src/library/region.d.ts +5 -24
  305. package/build/src/library/region.js +6 -21
  306. package/build/src/library/selection.d.ts +181 -32
  307. package/build/src/library/selection.js +99 -64
  308. package/build/src/mcp/adapter.d.ts +11 -0
  309. package/build/src/mcp/adapter.js +106 -0
  310. package/build/src/mcp/help.d.ts +1 -0
  311. package/build/src/mcp/help.js +26 -0
  312. package/build/src/mcp/index.d.ts +2 -0
  313. package/build/src/mcp/index.js +37 -0
  314. package/build/src/plugin/public.d.ts +1 -1
  315. package/build/src/plugin/runtime.js +17 -14
  316. package/build/src/protocol/arc.d.ts +4 -1
  317. package/build/src/protocol/arc.js +7 -1
  318. package/build/src/protocol/attempt.d.ts +2 -3
  319. package/build/src/protocol/attempt.js +1 -10
  320. package/build/src/protocol/bind.d.ts +6 -7
  321. package/build/src/protocol/bind.js +9 -5
  322. package/build/src/protocol/completion.d.ts +448 -12
  323. package/build/src/protocol/completion.js +164 -26
  324. package/build/src/protocol/deliver.d.ts +26 -24
  325. package/build/src/protocol/deliver.js +24 -52
  326. package/build/src/protocol/delivery-preview.d.ts +97 -247
  327. package/build/src/protocol/delivery-preview.js +132 -128
  328. package/build/src/protocol/execution-observation.d.ts +146 -123
  329. package/build/src/protocol/execution-observation.js +9 -6
  330. package/build/src/protocol/intent.d.ts +9 -48
  331. package/build/src/protocol/intent.js +32 -46
  332. package/build/src/protocol/operations.d.ts +207 -505
  333. package/build/src/protocol/operations.js +81 -134
  334. package/build/src/protocol/placement.d.ts +0 -1
  335. package/build/src/protocol/placement.js +5 -2
  336. package/build/src/protocol/progress.d.ts +7 -97
  337. package/build/src/protocol/progress.js +7 -55
  338. package/build/src/protocol/read/observation.d.ts +13 -6
  339. package/build/src/protocol/read/observation.js +10 -9
  340. package/build/src/protocol/read/status.d.ts +464 -93
  341. package/build/src/protocol/read/status.js +372 -85
  342. package/build/src/protocol/reconcile.d.ts +2 -0
  343. package/build/src/protocol/reconcile.js +12 -11
  344. package/build/src/protocol/reintegrate.d.ts +0 -1
  345. package/build/src/protocol/reintegrate.js +4 -4
  346. package/build/src/protocol/result-leaves.d.ts +528 -0
  347. package/build/src/protocol/result-leaves.js +195 -0
  348. package/build/src/protocol/result-reasons.d.ts +129 -0
  349. package/build/src/protocol/result-reasons.js +87 -0
  350. package/build/src/protocol/review.d.ts +14 -11
  351. package/build/src/protocol/review.js +30 -14
  352. package/build/src/protocol/run.d.ts +4 -4
  353. package/build/src/protocol/run.js +4 -1
  354. package/build/src/protocol/verify.d.ts +359 -30
  355. package/build/src/protocol/verify.js +118 -28
  356. package/build/src/region.d.ts +26 -0
  357. package/build/src/region.js +28 -0
  358. package/build/src/runtime/proc/diagnostic.d.ts +11 -0
  359. package/build/src/runtime/proc/diagnostic.js +20 -0
  360. package/build/src/runtime/proc/windows-launch.exe +0 -0
  361. package/build/src/settings.d.ts +126 -32
  362. package/build/src/settings.js +107 -34
  363. package/build/src/settlement/settle.d.ts +29 -12
  364. package/build/src/settlement/settle.js +22 -15
  365. package/build/src/verification/declaration.d.ts +1 -3
  366. package/build/src/verification/declaration.js +2 -5
  367. package/build/src/verification/execution.d.ts +7 -19
  368. package/build/src/verification/execution.js +37 -16
  369. package/build/src/verification/observation.d.ts +13 -13
  370. package/build/src/verification/observation.js +9 -7
  371. package/build/src/world.d.ts +8 -0
  372. package/build/src/world.js +7 -0
  373. package/package.json +6 -5
  374. package/plugins/paseo/plugin/server/keiyaku.ts +13 -46
  375. package/plugins/paseo/plugin/server/message.ts +8 -30
  376. package/plugins/paseo/plugin/server/mirror.ts +16 -20
  377. package/plugins/paseo/plugin/server/provider.ts +1 -1
  378. package/plugins/paseo/plugin/server/sdk.ts +14 -6
  379. package/plugins/pi/README.md +5 -5
  380. package/plugins/pi/akuma-tools.ts +17 -23
  381. package/skills/keiyaku/SKILL.md +12 -12
  382. package/skills/keiyaku-akuma/SKILL.md +16 -16
  383. package/skills/keiyaku-akuma/references/automation.md +14 -14
  384. package/skills/keiyaku-babysit/SKILL.md +10 -10
  385. package/skills/keiyaku-bind/SKILL.md +15 -15
  386. package/skills/keiyaku-debt/SKILL.md +16 -16
  387. package/skills/keiyaku-workflow/SKILL.md +21 -21
  388. package/build/src/cli/actor.d.ts +0 -10
  389. package/build/src/cli/actor.js +0 -24
  390. package/build/src/cli/akuma-caller.d.ts +0 -3
  391. package/build/src/cli/akuma-caller.js +0 -31
  392. package/build/src/cli/delivery-identity.d.ts +0 -3
  393. package/build/src/cli/render/effects.d.ts +0 -26
  394. package/build/src/cli/render/effects.js +0 -41
  395. package/build/src/cli/selectors.d.ts +0 -10
  396. package/build/src/cli/selectors.js +0 -42
  397. package/build/src/markdown/diff.d.ts +0 -1
  398. package/build/src/markdown/diff.js +0 -4
@@ -1,11 +1,163 @@
1
+ import { z } from "zod";
1
2
  import { targetName } from "../core/facts/types.js";
2
- import { gateReports } from "../core/facts/gate.js";
3
- import { readDeliveryScope } from "../git/integration.js";
3
+ import { snapshotIdSchema, contractIdSchema } from "../git/identity.js";
4
+ import { requirementIdSchema, gateSchema } from "./result-leaves.js";
4
5
  import { admitPlacement, observeTargetPlacement, observeIntegrationTargetMovement } from "./placement.js";
5
6
  import { reintegrateOperation } from "./reintegrate.js";
6
7
  import { contractCheckpoint, executionStop, isOperationalFailure, isOperationalStop, } from "./progress.js";
7
8
  import { placementStop, timestamp } from "./operations.js";
9
+ import { activeReasonSchema, targetLifecycleReasonSchema, targetWorkspaceReasonSchema, checkoutCollisionSchema, integrationProblemSchema, retrySchema, compactRetry, compactReason, } from "./result-reasons.js";
8
10
  const MAX_REINTEGRATION_CYCLES = 3;
11
+ const requirementCoordinate = { gate: gateSchema, requirement: requirementIdSchema };
12
+ export const requirementProblemSchema = z.union([
13
+ z.strictObject({ ...requirementCoordinate, state: z.literal("missing") }).readonly(),
14
+ z
15
+ .strictObject({ ...requirementCoordinate, state: z.literal("unsatisfied"), summary: z.string().exactOptional() })
16
+ .readonly(),
17
+ z
18
+ .strictObject({
19
+ ...requirementCoordinate,
20
+ state: z.literal("stale"),
21
+ previousContentId: z.string().min(1).exactOptional(),
22
+ currentContentId: z.string().min(1).exactOptional(),
23
+ })
24
+ .readonly(),
25
+ ]);
26
+ /** Select already-adjudicated unmet requirements; never recompute currentness. */
27
+ export function unmetGateProblems(reports) {
28
+ return reports
29
+ .filter((report) => !report.satisfied)
30
+ .flatMap((report) => report.requirements.flatMap(({ requirement, current }) => {
31
+ const coordinate = { gate: report.gate, requirement };
32
+ if (current.kind === "missing")
33
+ return [{ ...coordinate, state: "missing" }];
34
+ if (current.kind === "attested")
35
+ return current.verdict === "satisfied"
36
+ ? []
37
+ : [
38
+ {
39
+ ...coordinate,
40
+ state: "unsatisfied",
41
+ ...(current.summary === undefined ? {} : { summary: current.summary }),
42
+ },
43
+ ];
44
+ return [
45
+ {
46
+ ...coordinate,
47
+ state: "stale",
48
+ ...(current.reason === undefined
49
+ ? {}
50
+ : {
51
+ previousContentId: current.reason.previousChange,
52
+ currentContentId: current.reason.currentChange,
53
+ }),
54
+ },
55
+ ];
56
+ }));
57
+ }
58
+ export const unmetPrerequisiteSchema = z
59
+ .strictObject({
60
+ contractId: contractIdSchema,
61
+ state: z.enum(["missing", "active", "abandoned"]),
62
+ })
63
+ .readonly();
64
+ export const placementReasonSchema = z.union([
65
+ activeReasonSchema,
66
+ targetLifecycleReasonSchema,
67
+ targetWorkspaceReasonSchema,
68
+ z.strictObject({ kind: z.enum(["delivery-missing", "target-missing"]) }).readonly(),
69
+ z
70
+ .strictObject({
71
+ kind: z.literal("prerequisites-unsatisfied"),
72
+ unmet: z.array(unmetPrerequisiteSchema).min(1).readonly(),
73
+ })
74
+ .readonly(),
75
+ z
76
+ .strictObject({ kind: z.literal("gates-unsatisfied"), unmet: z.array(requirementProblemSchema).min(1).readonly() })
77
+ .readonly(),
78
+ checkoutCollisionSchema,
79
+ ...integrationProblemSchema.options,
80
+ ]);
81
+ export const placementFailureSchema = z.union([
82
+ retrySchema,
83
+ z.strictObject({ kind: z.literal("failed"), diagnostic: z.string().min(1) }).readonly(),
84
+ z
85
+ .strictObject({
86
+ kind: z.literal("target-content-identical"),
87
+ target: z.string().min(1),
88
+ expected: snapshotIdSchema,
89
+ observed: snapshotIdSchema,
90
+ })
91
+ .readonly(),
92
+ z
93
+ .strictObject({
94
+ kind: z.literal("target-moved"),
95
+ target: z.string().min(1),
96
+ integration: snapshotIdSchema,
97
+ observed: snapshotIdSchema.nullable(),
98
+ })
99
+ .readonly(),
100
+ ]);
101
+ export const placementStopLeaves = [
102
+ ...placementReasonSchema.options,
103
+ ...retrySchema.options,
104
+ placementFailureSchema.options[1],
105
+ placementFailureSchema.options[2],
106
+ placementFailureSchema.options[3],
107
+ ];
108
+ export const placementStopSchema = z.union(placementStopLeaves);
109
+ export const compactScopeSchema = z
110
+ .strictObject({
111
+ filesChanged: z.number().int().positive().exactOptional(),
112
+ insertions: z.number().int().positive().exactOptional(),
113
+ deletions: z.number().int().positive().exactOptional(),
114
+ paths: z.array(z.string()).min(1).readonly().exactOptional(),
115
+ })
116
+ .readonly();
117
+ export const placedSchema = z
118
+ .strictObject({
119
+ kind: z.literal("placed"),
120
+ integration: snapshotIdSchema,
121
+ target: z.string().exactOptional(),
122
+ predecessor: snapshotIdSchema.exactOptional(),
123
+ })
124
+ .readonly();
125
+ export const placementSchema = z.union([placedSchema, placementStopSchema]);
126
+ export function compactScope(scope) {
127
+ return {
128
+ ...(scope.filesChanged === 0 ? {} : { filesChanged: scope.filesChanged }),
129
+ ...(scope.insertions === 0 ? {} : { insertions: scope.insertions }),
130
+ ...(scope.deletions === 0 ? {} : { deletions: scope.deletions }),
131
+ ...(scope.paths === undefined || scope.paths.length === 0 ? {} : { paths: scope.paths }),
132
+ };
133
+ }
134
+ export function compactPlacementStop(stop) {
135
+ if ("refusal" in stop) {
136
+ const reason = stop.refusal;
137
+ if (reason.kind === "gates-unsatisfied")
138
+ return { kind: reason.kind, unmet: unmetGateProblems(reason.unmet) };
139
+ if (reason.kind === "prerequisites-unsatisfied")
140
+ return { kind: reason.kind, unmet: reason.unmet };
141
+ if (reason.kind === "checkout-not-followable")
142
+ return reason;
143
+ return compactReason(reason);
144
+ }
145
+ if ("retry" in stop)
146
+ return compactRetry(stop.retry);
147
+ if (stop.failure === "target-placement-failed")
148
+ return { kind: "failed", diagnostic: stop.diagnostic };
149
+ if ("integratedAt" in stop)
150
+ return { kind: "target-moved", target: stop.target, integration: stop.integratedAt, observed: stop.observed };
151
+ if (!stop.observedTreeEqualsCandidate || stop.observed === null)
152
+ throw new Error("unexhausted returned target movement requires identical content");
153
+ return { kind: "target-content-identical", target: stop.target, expected: stop.expected, observed: stop.observed };
154
+ }
155
+ export function compactPlacement(evidence) {
156
+ if (evidence.completion !== undefined)
157
+ return { kind: "placed", ...evidence.completion };
158
+ return evidence.placement === undefined ? undefined : compactPlacementStop(evidence.placement);
159
+ }
160
+ export const candidateCompletionSchema = placedSchema.unwrap().omit({ kind: true }).readonly();
9
161
  function reintegrationStop(result) {
10
162
  if (result.kind === "placement-failed")
11
163
  return { failure: "target-placement-failed", diagnostic: result.diagnostic };
@@ -42,25 +194,14 @@ async function completedResult(input, cursor) {
42
194
  throw new Error("accepted placement requires its integration snapshot");
43
195
  const target = state.coordinates.target;
44
196
  const predecessor = state.currentIntegration?.predecessor;
45
- // Movement and the completion base are known before this optional observation; a failed scope
46
- // read must never erase an already-claimed candidate.
47
- cursor.completion = {
48
- integration,
49
- ...(predecessor === undefined || target === undefined ? {} : { predecessor, target: targetName(target) }),
50
- };
51
- input.progress.recordCompletion(state.id, cursor.completion);
52
- cursor.evidence = { gates: gateReports(state).reports };
53
- input.progress.recordCandidate(state.id, { ...cursor.evidence, completion: cursor.completion });
54
- const scope = predecessor === undefined ? undefined : await readDeliveryScope(input.repository, predecessor, integration, false);
55
197
  const completion = {
56
198
  integration,
57
199
  ...(predecessor === undefined || target === undefined ? {} : { predecessor, target: targetName(target) }),
58
- ...(scope === undefined
59
- ? {}
60
- : { scope: { filesChanged: scope.filesChanged, insertions: scope.insertions, deletions: scope.deletions } }),
61
200
  };
62
201
  cursor.completion = completion;
63
202
  input.progress.recordCompletion(state.id, completion);
203
+ cursor.evidence = {};
204
+ input.progress.recordCandidate(state.id, { ...cursor.evidence, completion });
64
205
  return {
65
206
  kind: "completed",
66
207
  checkpoint: cursor.checkpoint,
@@ -68,13 +209,10 @@ async function completedResult(input, cursor) {
68
209
  };
69
210
  }
70
211
  function stoppedResult(cursor, stop) {
71
- const evidence = "kind" in stop && stop.kind === "execution-stopped"
72
- ? cursor.evidence
73
- : { ...cursor.evidence, placement: stop };
212
+ const evidence = "kind" in stop ? cursor.evidence : { ...cursor.evidence, placement: stop };
74
213
  return { kind: "stopped", checkpoint: cursor.checkpoint, evidence, stop };
75
214
  }
76
215
  async function placeCurrentCandidate(input, cursor) {
77
- cursor.stage = "placement";
78
216
  input.signal?.throwIfAborted();
79
217
  input.progress.observe({
80
218
  kind: "stage",
@@ -123,7 +261,7 @@ async function advanceCandidate(input, cursor) {
123
261
  const target = cursor.checkpoint.state.coordinates.target;
124
262
  for (let cycles = 0;; cycles += 1) {
125
263
  input.signal?.throwIfAborted();
126
- cursor.evidence = { gates: gateReports(cursor.checkpoint.state).reports };
264
+ cursor.evidence = {};
127
265
  input.progress.recordCandidate(cursor.checkpoint.state.id, cursor.evidence);
128
266
  let placement = await observeIntegrationTargetMovement(input.repository, cursor.checkpoint.state);
129
267
  if (placement === undefined) {
@@ -131,7 +269,7 @@ async function advanceCandidate(input, cursor) {
131
269
  if (targetStop !== undefined)
132
270
  return stoppedResult(cursor, targetStop);
133
271
  placement = await placeCurrentCandidate(input, cursor);
134
- cursor.evidence = { gates: gateReports(cursor.checkpoint.state).reports };
272
+ cursor.evidence = {};
135
273
  input.progress.recordCandidate(cursor.checkpoint.state.id, cursor.evidence);
136
274
  }
137
275
  if (placement.kind === "accepted")
@@ -145,15 +283,12 @@ async function advanceCandidate(input, cursor) {
145
283
  if (cycles === MAX_REINTEGRATION_CYCLES) {
146
284
  return stoppedResult(cursor, {
147
285
  failure: "target-moved",
148
- contractId: cursor.checkpoint.state.id,
149
286
  target: targetName(target),
150
287
  integratedAt: cursor.checkpoint.state.currentIntegration.snapshot,
151
288
  observed: placement.observed,
152
- attempts: cycles,
153
289
  observedTreeEqualsCandidate: placement.observedTreeEqualsCandidate,
154
290
  });
155
291
  }
156
- cursor.stage = "reintegration";
157
292
  input.signal?.throwIfAborted();
158
293
  const reintegrated = await reintegrateOperation({
159
294
  channel: input.channel,
@@ -171,7 +306,10 @@ async function advanceCandidate(input, cursor) {
171
306
  }
172
307
  /** Advance one contract. The trigger owns the leading act; this node owns no other contract. */
173
308
  export async function completeCandidate(input) {
174
- const cursor = { checkpoint: input.checkpoint, evidence: {}, stage: "placement" };
309
+ const cursor = {
310
+ checkpoint: input.checkpoint,
311
+ evidence: {},
312
+ };
175
313
  try {
176
314
  return await advanceCandidate(input, cursor);
177
315
  }
@@ -179,7 +317,7 @@ export async function completeCandidate(input) {
179
317
  if (!isOperationalStop(error, input.signal))
180
318
  throw error;
181
319
  const contractId = input.checkpoint.state.id;
182
- const stop = executionStop(contractId, cursor.stage, error, input.signal);
320
+ const stop = executionStop(contractId, error, input.signal);
183
321
  input.progress.recordStop(stop);
184
322
  const admitted = input.progress.checkpoint(contractId);
185
323
  if (admitted !== undefined)
@@ -1,41 +1,41 @@
1
1
  import { z } from "zod";
2
- import { candidateContentChangeSchema } from "./operations.js";
3
- import type { ActorId, ContractId, ContractState, DeliverData, JournalEntry, SnapshotId } from "../core/facts/types.js";
2
+ import type { ActorId, ChangeId, ContractId, ContractState, DeliverData, EntryUlid, JournalEntry, SnapshotId } from "../core/facts/types.js";
4
3
  import type { LeadingOutcome } from "./outcome.js";
5
4
  import type { CompletionEvidence } from "./completion.js";
6
5
  import { type ManagedWorktreeAppointment } from "../workspace-place.js";
7
- import type { DeliveryPreparationRefusal, DocumentDerivation, MutationOperationInput } from "./operations.js";
6
+ import type { DeliveryPreparationRefusal, DocumentDerivation, MechanicalPreparationRefusal, MutationOperationInput } from "./operations.js";
8
7
  type DeliveryIdentity = DeliverData;
9
8
  /** Known prospective and delivered integrations, newest first, without giving Git producer vocabulary. */
10
9
  export declare function deliveryIntegrationSnapshots(journal: readonly JournalEntry[]): readonly SnapshotId[];
11
- export declare const deliverLeadingSchema: z.ZodObject<{
12
- kind: z.ZodEnum<{
13
- "admitted-now": "admitted-now";
14
- "already-admitted": "already-admitted";
15
- }>;
16
- fact: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
17
- reusedIntegration: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>>;
18
- }, z.core.$strict>;
19
- type DeliverLeading = z.infer<typeof deliverLeadingSchema>;
10
+ export type DeliverLeading = Readonly<{
11
+ kind: "admitted-now" | "already-admitted";
12
+ fact: EntryUlid;
13
+ }>;
20
14
  type DeliverValue = DeliveryIdentity & CompletionEvidence & Readonly<{
21
15
  leading: DeliverLeading;
22
- contentChange?: z.infer<typeof candidateContentChangeSchema>;
16
+ previousContentId?: ChangeId;
23
17
  }>;
24
- export declare const materializedConflictSchema: z.ZodObject<{
18
+ export declare const materializedConflictSchema: z.ZodReadonly<z.ZodObject<{
25
19
  kind: z.ZodLiteral<"integration-conflict-materialized">;
26
20
  targetHead: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
27
21
  conflictPaths: z.ZodReadonly<z.ZodArray<z.ZodString>>;
28
- workspace: z.ZodObject<{
22
+ workspace: z.ZodReadonly<z.ZodObject<{
29
23
  kind: z.ZodLiteral<"worktree">;
30
24
  path: z.ZodString;
31
- }, z.core.$strict>;
25
+ }, z.core.$strict>>;
32
26
  handoffBase: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
33
- recovery: z.ZodObject<{
34
- materialize: z.ZodLiteral<"deliver --materialize-conflict --include-dirty">;
35
- deliver: z.ZodLiteral<"deliver --include-dirty">;
36
- staging: z.ZodLiteral<"not-required">;
37
- }, z.core.$strict>;
38
- }, z.core.$strict>;
27
+ recovery: z.ZodReadonly<z.ZodObject<{
28
+ materialize: z.ZodReadonly<z.ZodObject<{
29
+ kind: z.ZodLiteral<"deliver">;
30
+ materializeConflict: z.ZodLiteral<true>;
31
+ includeDirty: z.ZodLiteral<true>;
32
+ }, z.core.$strict>>;
33
+ deliver: z.ZodReadonly<z.ZodObject<{
34
+ kind: z.ZodLiteral<"deliver">;
35
+ includeDirty: z.ZodLiteral<true>;
36
+ }, z.core.$strict>>;
37
+ }, z.core.$strict>>;
38
+ }, z.core.$strict>>;
39
39
  export type IntegrationConflictMaterialized = z.infer<typeof materializedConflictSchema>;
40
40
  type DeliverOperationInput = MutationOperationInput & Readonly<{
41
41
  deriveDocument: (state: ContractState) => DocumentDerivation;
@@ -46,7 +46,9 @@ type DeliverOperationInput = MutationOperationInput & Readonly<{
46
46
  overwrite?: boolean;
47
47
  signal?: AbortSignal;
48
48
  }>;
49
- type DeliverOperationRefusal = import("../core/verbs/deliver.js").DeliverRefusal | DeliveryPreparationRefusal | import("./operations.js").DeliverConflictRefusal | import("../verification/declaration.js").VerificationDeclarationRefusal;
49
+ type DeliverOperationRefusal = Exclude<import("../core/verbs/deliver.js").DeliverRefusal, {
50
+ kind: "document-moved";
51
+ }> | DeliveryPreparationRefusal | import("./operations.js").DeliverConflictRefusal | import("../verification/declaration.js").VerificationDeclarationRefusal;
50
52
  export declare function prepareDelivery(repository: import("../git/process.js").GitRepository, stage: Readonly<{
51
53
  contractId: ContractId;
52
54
  coordinates: ContractState["coordinates"];
@@ -66,7 +68,7 @@ export declare function prepareDelivery(repository: import("../git/process.js").
66
68
  data: DeliverData;
67
69
  } | {
68
70
  kind: "refused";
69
- refusal: DeliveryPreparationRefusal;
71
+ refusal: MechanicalPreparationRefusal;
70
72
  }>;
71
73
  export declare function admitDeliveryOperation(input: DeliverOperationInput): Promise<LeadingOutcome<DeliverValue, DeliverOperationRefusal> | IntegrationConflictMaterialized>;
72
74
  export {};
@@ -1,4 +1,3 @@
1
- import { entryUlidSchema } from "./attempt.js";
2
1
  import { z } from "zod";
3
2
  import { snapshotIdSchema } from "./operations.js";
4
3
  import { conflictRecoverySchema, worktreeWorkspaceSchema } from "../git/workspace.js";
@@ -7,9 +6,8 @@ import { captureTender, dirtyTenderRefusal, materializeTenderSnapshot, prepareDe
7
6
  import { checkoutDetachedSnapshot, recordConflictHandoff, retireConflictHandoff, workspaceMergeStatePresent, worktreePath, conflictRecovery, } from "../git/workspace.js";
8
7
  import { observeContractsForAdmissionAt } from "../git/observe.js";
9
8
  import { externalPreparation, privateStateSeatAttempt, protocolSeatClose, runBoundedAttempts, sameWorktreeWitness, STALE_PRIVATE_STATE_PREPARATION, } from "./run.js";
10
- import { contractState, documentIsCurrent, targetContractRefusal } from "../core/facts/observation.js";
9
+ import { contractState, targetContractRefusal } from "../core/facts/observation.js";
11
10
  import { dependencyKeys } from "../core/subject.js";
12
- import { targetName } from "../core/facts/types.js";
13
11
  import { resolveContractTarget } from "../git/target.js";
14
12
  import { acquireTargetPlacementFence } from "../git/target-placement.js";
15
13
  import { decideDeliver } from "../core/verbs/deliver.js";
@@ -31,13 +29,6 @@ export function deliveryIntegrationSnapshots(journal) {
31
29
  })
32
30
  .reverse();
33
31
  }
34
- export const deliverLeadingSchema = z
35
- .object({
36
- kind: z.enum(["admitted-now", "already-admitted"]),
37
- fact: entryUlidSchema,
38
- reusedIntegration: snapshotIdSchema.optional(),
39
- })
40
- .strict();
41
32
  export const materializedConflictSchema = z
42
33
  .object({
43
34
  kind: z.literal("integration-conflict-materialized"),
@@ -47,7 +38,8 @@ export const materializedConflictSchema = z
47
38
  handoffBase: snapshotIdSchema,
48
39
  recovery: conflictRecoverySchema,
49
40
  })
50
- .strict();
41
+ .strict()
42
+ .readonly();
51
43
  const DELIVER_CONFLICT_RECOVERY = conflictRecovery;
52
44
  async function captureAuthorizedDeliveryTender(repository, stage, includeDirty) {
53
45
  const { contractId, coordinates } = stage;
@@ -66,7 +58,7 @@ async function captureAuthorizedDeliveryTender(repository, stage, includeDirty)
66
58
  return tender;
67
59
  if (((tender.data.dirty || tender.data.mergeHead !== undefined) && includeDirty !== true) ||
68
60
  tender.data.changes.submodules.length > 0) {
69
- return { kind: "refused", refusal: await dirtyTenderRefusal(repository, contractId, tender.data) };
61
+ return { kind: "refused", refusal: dirtyTenderRefusal(tender.data) };
70
62
  }
71
63
  return { kind: "prepared", data: tender.data };
72
64
  }
@@ -87,10 +79,10 @@ async function prepareDeliveryWithWorktree(repository, stage, input, captured) {
87
79
  });
88
80
  const tenderSnapshot = await materializeTenderSnapshot(repository, tender.data, commit);
89
81
  const requireBranchesToBeUpToDate = input.requireBranchesToBeUpToDate ?? false;
90
- const integration = await planIntegration(repository, { contractId, coordinates }, { ...tender.data, head: tenderSnapshot }, requireBranchesToBeUpToDate);
82
+ const integration = await planIntegration(repository, { coordinates }, { ...tender.data, head: tenderSnapshot }, requireBranchesToBeUpToDate);
91
83
  if (integration.kind === "refused")
92
84
  return integration;
93
- const changeId = await worktreeChangeId(repository, { contractId, coordinates }, tender.data);
85
+ const changeId = await worktreeChangeId(repository, { coordinates }, tender.data);
94
86
  // A targetless dirty integration is the captured tender, whose sole parent is the worktree head.
95
87
  const reusedIntegration = await reusableIntegrationSnapshot(repository, integration.data.tree, coordinates.target === undefined && tender.data.dirty ? tender.data.head : integration.data.predecessor, stage.recordedIntegrations ?? []);
96
88
  const integrationSnapshot = reusedIntegration ??
@@ -99,7 +91,6 @@ async function prepareDeliveryWithWorktree(repository, stage, input, captured) {
99
91
  : await materializeIntegrationSnapshot(repository, integration.data.tree, integration.data.predecessor, commit));
100
92
  return {
101
93
  kind: "prepared",
102
- ...(reusedIntegration === undefined ? {} : { reusedIntegration }),
103
94
  data: {
104
95
  ...(input.message === undefined ? {} : { note: input.message }),
105
96
  tenderSnapshot,
@@ -143,7 +134,7 @@ async function recaptureDeliveryWorktree(input, state) {
143
134
  head: tender.data.head,
144
135
  ...(tender.data.mergeHead === undefined ? {} : { mergeHead: tender.data.mergeHead }),
145
136
  dirty: tender.data.dirty,
146
- changeId: await worktreeChangeId(input.scope, { contractId: state.id, coordinates: state.coordinates }, tender.data),
137
+ changeId: await worktreeChangeId(input.scope, { coordinates: state.coordinates }, tender.data),
147
138
  };
148
139
  }
149
140
  async function mechanicalDeliveryPreparation(input, state, derivation, journal, captured) {
@@ -160,11 +151,10 @@ async function mechanicalDeliveryPreparation(input, state, derivation, journal,
160
151
  document: derivation.document,
161
152
  data: prepared.data,
162
153
  worktree: prepared.worktree,
163
- ...(prepared.reusedIntegration === undefined ? {} : { reusedIntegration: prepared.reusedIntegration }),
164
154
  };
165
155
  }
166
156
  function worktreeInput(repository, state, tender) {
167
- return worktreeChangeId(repository, { contractId: state.id, coordinates: state.coordinates }, tender).then((changeId) => ({
157
+ return worktreeChangeId(repository, { coordinates: state.coordinates }, tender).then((changeId) => ({
168
158
  tree: tender.tree,
169
159
  head: tender.head,
170
160
  ...(tender.mergeHead === undefined ? {} : { mergeHead: tender.mergeHead }),
@@ -198,7 +188,6 @@ async function prepareDeliveryArtifacts(input, observation, state) {
198
188
  kind: "mechanical",
199
189
  data: prepared.data,
200
190
  worktree: prepared.worktree,
201
- ...(prepared.reusedIntegration === undefined ? {} : { reusedIntegration: prepared.reusedIntegration }),
202
191
  }
203
192
  : { kind: "refused", refusal: prepared.refusal };
204
193
  }
@@ -250,7 +239,6 @@ async function assembleDeliveryAttempt(input, observation, external) {
250
239
  state,
251
240
  derivation,
252
241
  preparation: { kind: "prepared", document: derivation.document, data: artifacts.data },
253
- ...(artifacts.reusedIntegration === undefined ? {} : { reusedIntegration: artifacts.reusedIntegration }),
254
242
  };
255
243
  }
256
244
  /**
@@ -279,9 +267,6 @@ async function completeDeferredDelivery(input, state, derivation, journal) {
279
267
  kind: "assembled",
280
268
  state,
281
269
  derivation,
282
- ...(prepared.kind !== "prepared" || prepared.reusedIntegration === undefined
283
- ? {}
284
- : { reusedIntegration: prepared.reusedIntegration }),
285
270
  preparation: prepared.kind === "prepared"
286
271
  ? { kind: "prepared", document: derivation.document, data: prepared.data }
287
272
  : prepared,
@@ -298,9 +283,6 @@ function currentCandidateDeliveryDecision(input, observation, assembled) {
298
283
  const state = assembled.state;
299
284
  if (state === null || assembled.derivation === undefined || assembled.reuse !== true)
300
285
  return undefined;
301
- if (!documentIsCurrent(state, assembled.derivation.document)) {
302
- return { kind: "refused", refusal: { kind: "document-moved", contractId: state.id } };
303
- }
304
286
  const record = observation.journals.get(input.contractId);
305
287
  const delivery = record?.entries.findLast((entry) => entry.kind === "deliver");
306
288
  if (record === undefined || delivery === undefined)
@@ -319,7 +301,7 @@ function currentCandidateDeliveryDecision(input, observation, assembled) {
319
301
  }
320
302
  async function validateDeliveryTarget(input, observation, assembled) {
321
303
  const target = assembled.state?.coordinates.target;
322
- const targetRefusal = targetContractRefusal(observation.decision, input.contractId, target);
304
+ const targetRefusal = targetContractRefusal(observation.decision, target);
323
305
  if (targetRefusal !== undefined)
324
306
  return { kind: "refused", refusal: targetRefusal };
325
307
  if (target === undefined || typeof target === "string")
@@ -352,8 +334,11 @@ async function decideAndAdmitDelivery(input, attempt, seat, observation, assembl
352
334
  attempt,
353
335
  observation: observation.decision,
354
336
  });
355
- if (decision.kind === "refused")
356
- return { kind: "refused", refusal: decision.refusal };
337
+ if (decision.kind === "refused") {
338
+ return decision.refusal.kind === "document-moved"
339
+ ? STALE_PRIVATE_STATE_PREPARATION
340
+ : { kind: "refused", refusal: decision.refusal };
341
+ }
357
342
  if (preparation.kind !== "prepared")
358
343
  throw new Error("offered delivery is missing its mechanical preparation");
359
344
  const admission = await admitDecidedOffer({ ...input, seat, observation, attempt, offer: decision.offer });
@@ -362,8 +347,7 @@ async function decideAndAdmitDelivery(input, attempt, seat, observation, assembl
362
347
  const deliverFact = admission.facts.find((fact) => fact.contract === input.contractId && fact.kind === "deliver");
363
348
  if (deliverFact?.kind !== "deliver")
364
349
  throw new Error("confirmed delivery requires its own receipt");
365
- const previousChange = assembled.state?.delivery?.data.integration.changeId;
366
- const currentChange = preparation.data.integration.changeId;
350
+ const previousContentId = assembled.state?.delivery?.data.integration.changeId;
367
351
  return {
368
352
  ...admission,
369
353
  value: {
@@ -371,20 +355,10 @@ async function decideAndAdmitDelivery(input, attempt, seat, observation, assembl
371
355
  leading: {
372
356
  kind: "admitted-now",
373
357
  fact: deliverFact.entry,
374
- ...(assembled.reusedIntegration === undefined ? {} : { reusedIntegration: assembled.reusedIntegration }),
375
358
  },
376
- ...(previousChange === undefined || previousChange === currentChange
359
+ ...(previousContentId === undefined || previousContentId === preparation.data.integration.changeId
377
360
  ? {}
378
- : {
379
- contentChange: {
380
- kind: "candidate-content-changed",
381
- ...(assembled.state?.coordinates.target === undefined
382
- ? {}
383
- : { target: targetName(assembled.state.coordinates.target) }),
384
- previousChange,
385
- currentChange,
386
- },
387
- }),
361
+ : { previousContentId }),
388
362
  },
389
363
  };
390
364
  }
@@ -410,21 +384,19 @@ function conflictDeliverRefusal(refusal) {
410
384
  throw new Error("conflicted integration is missing conflict paths");
411
385
  return {
412
386
  kind: "integration-failed",
413
- contractId: refusal.contractId,
414
387
  reason: "conflict",
415
388
  targetHead: refusal.targetHead,
416
389
  conflictPaths: refusal.conflictPaths,
417
- recovery: DELIVER_CONFLICT_RECOVERY,
418
390
  };
419
391
  }
420
392
  async function appointedDeliverWorkspace(input) {
421
393
  const observation = await observeContractsForAdmissionAt(input.scope, input.channel, [input.contractId]);
422
394
  const state = contractState(observation.decision, input.contractId);
423
395
  if (state === null)
424
- return { kind: "refused", refusal: { kind: "worktree-missing", contractId: input.contractId } };
396
+ return { kind: "refused", refusal: { kind: "worktree-missing" } };
425
397
  const appointment = appointmentFor(await readPlaceRegister(input.scope), input.contractId);
426
398
  if (appointment === undefined) {
427
- return { kind: "refused", refusal: { kind: "worktree-missing", contractId: input.contractId } };
399
+ return { kind: "refused", refusal: { kind: "worktree-missing" } };
428
400
  }
429
401
  return {
430
402
  workspace: { kind: "worktree", path: worktreePath(input.scope, appointment.place) },
@@ -438,7 +410,7 @@ async function materializationMergeStateRefusal(input) {
438
410
  return appointed.refusal;
439
411
  const appointment = appointmentFor(await readPlaceRegister(input.scope), input.contractId);
440
412
  if (appointment === undefined)
441
- return { kind: "worktree-missing", contractId: input.contractId };
413
+ return { kind: "worktree-missing" };
442
414
  const retirement = await retireConflictHandoff(input.scope, {
443
415
  contractId: input.contractId,
444
416
  place: appointment.place,
@@ -446,13 +418,13 @@ async function materializationMergeStateRefusal(input) {
446
418
  consume: true,
447
419
  });
448
420
  if (retirement.kind === "retained")
449
- return { kind: "merge-state-present", contractId: input.contractId, workspace: appointed.workspace };
421
+ return { kind: "merge-state-present", worktreePath: appointed.workspace.path };
450
422
  return await mergeStatePresentRefusal(input, appointed.workspace);
451
423
  }
452
424
  async function mergeStatePresentRefusal(input, workspace) {
453
425
  if (!(await workspaceMergeStatePresent(input.scope, workspace.path)))
454
426
  return undefined;
455
- return { kind: "merge-state-present", contractId: input.contractId, workspace };
427
+ return { kind: "merge-state-present", worktreePath: workspace.path };
456
428
  }
457
429
  async function materializeDeliverConflict(input, refusal) {
458
430
  if (refusal.conflictPaths === undefined)
@@ -463,7 +435,7 @@ async function materializeDeliverConflict(input, refusal) {
463
435
  const { workspace, coordinates } = appointed;
464
436
  const appointment = appointmentFor(await readPlaceRegister(input.scope), input.contractId);
465
437
  if (appointment === undefined)
466
- return { kind: "refused", refusal: { kind: "worktree-missing", contractId: input.contractId } };
438
+ return { kind: "refused", refusal: { kind: "worktree-missing" } };
467
439
  const mergeState = await mergeStatePresentRefusal(input, workspace);
468
440
  if (mergeState !== undefined)
469
441
  return { kind: "refused", refusal: mergeState };
@@ -475,7 +447,7 @@ async function materializeDeliverConflict(input, refusal) {
475
447
  if (tender.kind === "refused")
476
448
  return tender;
477
449
  if (tender.data.changes.submodules.length > 0 || (tender.data.dirty && input.includeDirty !== true)) {
478
- return { kind: "refused", refusal: await dirtyTenderRefusal(input.scope, input.contractId, tender.data) };
450
+ return { kind: "refused", refusal: dirtyTenderRefusal(tender.data) };
479
451
  }
480
452
  let handoffHead = tender.data.head;
481
453
  if (tender.data.dirty) {