@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
@@ -14,7 +14,8 @@ export const targetWorkspaceRefusalSchema = z
14
14
  contractId: contractIdSchema,
15
15
  reason: z.enum(["unappointed", "missing", "association", "replaced", "attached", "uncommitted", "operation"]),
16
16
  })
17
- .strict();
17
+ .strict()
18
+ .readonly();
18
19
  export function targetRepository(repository, target) {
19
20
  return typeof target === "string" ? repository : { ...repository, effectiveCwd: repository.primaryWorktree };
20
21
  }
@@ -10,44 +10,16 @@ type TenderCaptureCoordinates = Readonly<{
10
10
  place?: string;
11
11
  workspacePath?: string;
12
12
  captureMergeState?: boolean;
13
- /** Opt-in real-index UU refusal. Omit or false when authorized capture must read current worktree bytes. */
14
- rejectUnmerged?: boolean;
15
13
  }>;
16
- export declare const worktreeMissingRefusalSchema: z.ZodObject<{
14
+ export declare const worktreeMissingRefusalSchema: z.ZodReadonly<z.ZodObject<{
17
15
  kind: z.ZodLiteral<"worktree-missing">;
18
- contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
19
- }, z.core.$strict>;
16
+ }, z.core.$strict>>;
20
17
  type WorktreeMissingRefusal = z.infer<typeof worktreeMissingRefusalSchema>;
21
- export declare const unmergedPathsRefusalSchema: z.ZodObject<{
22
- kind: z.ZodLiteral<"unmerged-paths">;
23
- contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
24
- paths: z.ZodReadonly<z.ZodArray<z.ZodString>>;
25
- }, z.core.$strict>;
26
- type TenderCaptureRefusal = WorktreeMissingRefusal | z.infer<typeof unmergedPathsRefusalSchema>;
27
- export declare const workspaceDirtyDeltaSchema: z.ZodObject<{
28
- staged: z.ZodReadonly<z.ZodArray<z.ZodString>>;
29
- unstaged: z.ZodReadonly<z.ZodArray<z.ZodString>>;
30
- untracked: z.ZodReadonly<z.ZodArray<z.ZodString>>;
31
- shortStat: z.ZodObject<{
32
- filesChanged: z.ZodNumber;
33
- insertions: z.ZodNumber;
34
- deletions: z.ZodNumber;
35
- }, z.core.$strict>;
36
- }, z.core.$strict>;
37
- type WorkspaceDirtyDelta = z.infer<typeof workspaceDirtyDeltaSchema>;
38
- export declare const dirtyWorkspaceRefusalSchema: z.ZodObject<{
18
+ export declare const dirtyWorkspaceRefusalSchema: z.ZodReadonly<z.ZodObject<{
39
19
  kind: z.ZodLiteral<"dirty-workspace">;
40
- contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
41
- staged: z.ZodReadonly<z.ZodArray<z.ZodString>>;
42
- unstaged: z.ZodReadonly<z.ZodArray<z.ZodString>>;
43
- untracked: z.ZodReadonly<z.ZodArray<z.ZodString>>;
44
- submodules: z.ZodReadonly<z.ZodArray<z.ZodString>>;
45
- shortStat: z.ZodObject<{
46
- filesChanged: z.ZodNumber;
47
- insertions: z.ZodNumber;
48
- deletions: z.ZodNumber;
49
- }, z.core.$strict>;
50
- }, z.core.$strict>;
20
+ paths: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
21
+ submodules: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
22
+ }, z.core.$strict>>;
51
23
  export type DirtyWorkspaceRefusal = z.infer<typeof dirtyWorkspaceRefusalSchema>;
52
24
  export type TenderCapture = Readonly<{
53
25
  tree: GitObjectId;
@@ -58,12 +30,8 @@ export type TenderCapture = Readonly<{
58
30
  changes: Awaited<ReturnType<typeof captureWorkspaceTree>>["changes"];
59
31
  }>;
60
32
  /** Capture the complete workspace tree through Git's private index mechanics. */
61
- export declare function captureTender(repository: GitRepository, input: TenderCaptureCoordinates & Readonly<{
62
- rejectUnmerged: true;
63
- }>): Promise<Preparation<TenderCapture, TenderCaptureRefusal>>;
64
33
  export declare function captureTender(repository: GitRepository, input: TenderCaptureCoordinates): Promise<Preparation<TenderCapture, WorktreeMissingRefusal>>;
65
- export declare function dirtyTenderRefusal(repository: GitRepository, contractId: ContractId, tender: TenderCapture): Promise<DirtyWorkspaceRefusal>;
66
- export declare function dirtyTenderDelta(repository: GitRepository, tender: TenderCapture): Promise<WorkspaceDirtyDelta | undefined>;
34
+ export declare function dirtyTenderRefusal(tender: TenderCapture): DirtyWorkspaceRefusal;
67
35
  type GitCommitIdentity = Readonly<{
68
36
  name: string;
69
37
  email: string;
@@ -1,47 +1,27 @@
1
- import { contractIdSchema } from "./identity.js";
2
1
  import { z } from "zod";
3
2
  import { access } from "node:fs/promises";
4
3
  import { gitObjectIdForSnapshot, mintSnapshotId } from "./identity.js";
5
- import { decodeGitNumstat, registeredWorktreePaths } from "./repository.js";
4
+ import { registeredWorktreePaths } from "./repository.js";
6
5
  import { executeGit, GitPlumbingError } from "./process.js";
7
- import { captureWorkspaceTree, unmergedWorkspacePaths, workspaceMergeHead, worktreePath } from "./workspace.js";
6
+ import { captureWorkspaceTree, workspaceMergeHead, worktreePath } from "./workspace.js";
8
7
  export const worktreeMissingRefusalSchema = z
9
- .object({ kind: z.literal("worktree-missing"), contractId: contractIdSchema })
10
- .strict();
11
- export const unmergedPathsRefusalSchema = z
12
- .object({
13
- kind: z.literal("unmerged-paths"),
14
- contractId: contractIdSchema,
15
- paths: z.array(z.string().refine((value) => value.trim() !== "")).readonly(),
16
- })
17
- .strict();
18
- export const workspaceDirtyDeltaSchema = z
19
- .object({
20
- staged: z.array(z.string()).readonly(),
21
- unstaged: z.array(z.string()).readonly(),
22
- untracked: z.array(z.string()).readonly(),
23
- shortStat: z
24
- .object({ filesChanged: z.number().int(), insertions: z.number().int(), deletions: z.number().int() })
25
- .strict(),
26
- })
27
- .strict();
8
+ .object({ kind: z.literal("worktree-missing") })
9
+ .strict()
10
+ .readonly();
28
11
  export const dirtyWorkspaceRefusalSchema = z
29
12
  .object({
30
13
  kind: z.literal("dirty-workspace"),
31
- contractId: contractIdSchema,
32
- staged: z.array(z.string().refine((value) => value.trim() !== "")).readonly(),
33
- unstaged: z.array(z.string().refine((value) => value.trim() !== "")).readonly(),
34
- untracked: z.array(z.string().refine((value) => value.trim() !== "")).readonly(),
35
- submodules: z.array(z.string().refine((value) => value.trim() !== "")).readonly(),
36
- shortStat: z
37
- .object({
38
- filesChanged: z.number().int().nonnegative(),
39
- insertions: z.number().int().nonnegative(),
40
- deletions: z.number().int().nonnegative(),
41
- })
42
- .strict(),
14
+ paths: z
15
+ .array(z.string().refine((value) => value.trim() !== ""))
16
+ .readonly()
17
+ .exactOptional(),
18
+ submodules: z
19
+ .array(z.string().refine((value) => value.trim() !== ""))
20
+ .readonly()
21
+ .exactOptional(),
43
22
  })
44
- .strict();
23
+ .strict()
24
+ .readonly();
45
25
  async function workspaceExists(repository, path) {
46
26
  const exists = await access(path).then(() => true, () => false);
47
27
  return exists && (await registeredWorktreePaths(repository)).includes(path);
@@ -51,15 +31,11 @@ function workspaceFor(repository, input) {
51
31
  return input.workspacePath;
52
32
  return input.place === undefined ? undefined : worktreePath(repository, input.place);
53
33
  }
34
+ /** Capture the complete workspace tree through Git's private index mechanics. */
54
35
  export async function captureTender(repository, input) {
55
36
  const workspace = workspaceFor(repository, input);
56
37
  if (workspace === undefined || !(await workspaceExists(repository, workspace))) {
57
- return { kind: "refused", refusal: { kind: "worktree-missing", contractId: input.contractId } };
58
- }
59
- if (input.rejectUnmerged === true) {
60
- const paths = await unmergedWorkspacePaths(repository, workspace);
61
- if (paths.length > 0)
62
- return { kind: "refused", refusal: { kind: "unmerged-paths", contractId: input.contractId, paths } };
38
+ return { kind: "refused", refusal: { kind: "worktree-missing" } };
63
39
  }
64
40
  const captured = await captureWorkspaceTree(repository, workspace);
65
41
  const mergeHead = input.captureMergeState === true ? await workspaceMergeHead(repository, workspace) : undefined;
@@ -68,23 +44,14 @@ export async function captureTender(repository, input) {
68
44
  data: { ...captured, ...(mergeHead === undefined ? {} : { mergeHead }) },
69
45
  };
70
46
  }
71
- async function dirtyShortStat(repository, tender) {
72
- return decodeGitNumstat(await executeGit(repository, ["diff", "--numstat", "-z", gitObjectIdForSnapshot(tender.head), tender.tree]));
73
- }
74
- export async function dirtyTenderRefusal(repository, contractId, tender) {
47
+ export function dirtyTenderRefusal(tender) {
48
+ const paths = [...new Set([...tender.changes.staged, ...tender.changes.unstaged, ...tender.changes.untracked])];
75
49
  return {
76
50
  kind: "dirty-workspace",
77
- contractId,
78
- ...tender.changes,
79
- shortStat: await dirtyShortStat(repository, tender),
51
+ ...(paths.length === 0 ? {} : { paths }),
52
+ ...(tender.changes.submodules.length === 0 ? {} : { submodules: tender.changes.submodules }),
80
53
  };
81
54
  }
82
- export async function dirtyTenderDelta(repository, tender) {
83
- if (!tender.dirty)
84
- return undefined;
85
- const { staged, unstaged, untracked } = tender.changes;
86
- return { staged, unstaged, untracked, shortStat: await dirtyShortStat(repository, tender) };
87
- }
88
55
  async function effectiveConfig(repository, key) {
89
56
  try {
90
57
  const value = (await executeGit(repository, ["config", "--get", key])).toString("utf8").trim();
@@ -49,7 +49,7 @@ async function removeTerminalWorktree(repository, topology, path) {
49
49
  export async function updateRef(repository, ref, desired) {
50
50
  const before = await readRef(repository, ref);
51
51
  if (before === desired)
52
- return { kind: "ref", name: ref, action: "unchanged", before, after: desired };
52
+ return { kind: "ref", name: ref, before, after: desired };
53
53
  await executeGit(repository, [
54
54
  "update-ref",
55
55
  "--no-deref",
@@ -57,21 +57,21 @@ export async function updateRef(repository, ref, desired) {
57
57
  gitObjectIdForSnapshot(desired),
58
58
  before ?? "0".repeat(desired.length),
59
59
  ]);
60
- return { kind: "ref", name: ref, action: before === null ? "created" : "updated", before, after: desired };
60
+ return { kind: "ref", name: ref, before, after: desired };
61
61
  }
62
62
  export async function removeRef(repository, ref) {
63
63
  const before = await readRef(repository, ref);
64
64
  if (before === null)
65
- return { kind: "ref", name: ref, action: "unchanged", before: null, after: null };
65
+ return { kind: "ref", name: ref, before: null, after: null };
66
66
  await executeGit(repository, ["update-ref", "--no-deref", "-d", ref, before]);
67
- return { kind: "ref", name: ref, action: "removed", before, after: null };
67
+ return { kind: "ref", name: ref, before, after: null };
68
68
  }
69
69
  async function removeRefWithCustody(repository, ref, custodian, expectedCustodian) {
70
70
  const before = await readRef(repository, ref);
71
71
  if (before === null)
72
- return { kind: "ref", name: ref, action: "unchanged", before: null, after: null };
72
+ return { kind: "ref", name: ref, before: null, after: null };
73
73
  if ((await readRef(repository, custodian)) !== expectedCustodian) {
74
- return { kind: "ref", name: ref, action: "unchanged", before, after: before };
74
+ return { kind: "ref", name: ref, before, after: before };
75
75
  }
76
76
  await executeGit(repository, ["update-ref", "--stdin", "--no-deref"], [
77
77
  "start",
@@ -81,10 +81,10 @@ async function removeRefWithCustody(repository, ref, custodian, expectedCustodia
81
81
  "commit",
82
82
  "",
83
83
  ].join("\n"));
84
- return { kind: "ref", name: ref, action: "removed", before, after: null };
84
+ return { kind: "ref", name: ref, before, after: null };
85
85
  }
86
86
  function retainedRefEffect(ref, snapshot) {
87
- return { kind: "ref", name: ref, action: "unchanged", before: snapshot, after: snapshot };
87
+ return { kind: "ref", name: ref, before: snapshot, after: snapshot };
88
88
  }
89
89
  async function refRows(repository) {
90
90
  const output = (await executeGit(repository, ["for-each-ref", "--format=%(refname)%00%(objectname)"])).toString("utf8");
@@ -142,13 +142,13 @@ async function hasIncomingLanding(repository, channel, state, head) {
142
142
  function fromPrimaryWorktree(repository) {
143
143
  return { ...repository, effectiveCwd: repository.primaryWorktree };
144
144
  }
145
- function complete(effects = [], lag = [], hookRuns = []) {
146
- return hookRuns.length === 0 ? { effects, lag } : { effects, lag, hookRuns };
145
+ function complete(effects = [], lag = []) {
146
+ return { effects, lag };
147
147
  }
148
148
  function retainTerminalWorktree(path, retainedLag, acc) {
149
149
  acc.recordEffect({ kind: "worktree", path, action: "unchanged" });
150
150
  acc.recordLag(retainedLag);
151
- return complete(acc.effects, acc.lag, acc.hookRuns);
151
+ return complete(acc.effects, acc.lag);
152
152
  }
153
153
  async function terminalSealExpectations(channel, state) {
154
154
  const snapshots = terminalSealSnapshots(state);
@@ -178,9 +178,7 @@ async function removeSealedTerminalWorktree({ repository, channel, topology, pat
178
178
  }));
179
179
  const effect = {
180
180
  kind: "recovery-snapshot",
181
- action: "created",
182
181
  snapshot,
183
- retention: "ephemeral",
184
182
  };
185
183
  acc.recordEffect(effect);
186
184
  return { snapshot, workspace };
@@ -195,7 +193,6 @@ async function removeSealedTerminalWorktree({ repository, channel, topology, pat
195
193
  recovery = await recordRecovery(beforeWorkspace);
196
194
  }
197
195
  const hookRun = await runDestroyHooks(path, hooks);
198
- acc.hookRuns.push(...hookRun.runs.map((name) => ({ phase: "destroy", name })));
199
196
  if (hookRun.lag !== null)
200
197
  return retainTerminalWorktree(path, hookRun.lag, acc);
201
198
  const after = await observeTerminalWorkspace(repository, path, expected);
@@ -219,7 +216,7 @@ async function removeSealedTerminalWorktree({ repository, channel, topology, pat
219
216
  const removal = await removeTerminalWorktree(repository, topology, path);
220
217
  if (removal.retainedLag !== undefined) {
221
218
  acc.recordLag(removal.retainedLag);
222
- return complete(acc.effects, acc.lag, acc.hookRuns);
219
+ return complete(acc.effects, acc.lag);
223
220
  }
224
221
  if (removal.effect !== undefined)
225
222
  acc.recordEffect(removal.effect);
@@ -292,9 +289,9 @@ export async function reconcileTerminalManagedWorktree({ repository, channel, ho
292
289
  const resolveSeal = async () => await terminalSealExpectations(channel, state);
293
290
  if (path === undefined) {
294
291
  if (retainTerminalWorktree === true)
295
- return complete(acc.effects, acc.lag, acc.hookRuns);
292
+ return complete(acc.effects, acc.lag);
296
293
  await releaseTerminalCustody({ repository: primary, state, resolveSeal, ref, pin, acc });
297
- return complete(acc.effects, acc.lag, acc.hookRuns);
294
+ return complete(acc.effects, acc.lag);
298
295
  }
299
296
  const expected = await resolveSeal();
300
297
  acc.recordEffect(await updateRef(primary, ref, state.delivery?.data.tenderSnapshot ?? state.coordinates.start));
@@ -320,5 +317,5 @@ export async function reconcileTerminalManagedWorktree({ repository, channel, ho
320
317
  if (retained !== null)
321
318
  return retained;
322
319
  await releaseTerminalCustody({ repository: primary, state, resolveSeal: async () => expected, ref, pin, acc });
323
- return complete(acc.effects, acc.lag, acc.hookRuns);
320
+ return complete(acc.effects, acc.lag);
324
321
  }
@@ -3,12 +3,10 @@ import type { ContractState, SnapshotId } from "../core/facts/types.js";
3
3
  import { type GitObjectId } from "./identity.js";
4
4
  import type { GitOid } from "./repository.js";
5
5
  import { type GitRepository } from "./process.js";
6
- export declare const unsealedBytesSchema: z.ZodObject<{
6
+ export declare const unsealedBytesSchema: z.ZodReadonly<z.ZodObject<{
7
7
  kind: z.ZodLiteral<"unsealed-bytes">;
8
8
  path: z.ZodString;
9
- paths: z.ZodReadonly<z.ZodArray<z.ZodString>>;
10
- head: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>>;
11
- }, z.core.$strict>;
9
+ }, z.core.$strict>>;
12
10
  type UnsealedBytes = z.infer<typeof unsealedBytesSchema>;
13
11
  export type TerminalSealExpectations = Readonly<{
14
12
  heads: readonly SnapshotId[];
@@ -1,16 +1,13 @@
1
- import { mintedSnapshotInputSchema } from "./identity.js";
2
1
  import { z } from "zod";
3
2
  import { gitObjectId, gitObjectIdForSnapshot, mintSnapshotId } from "./identity.js";
4
- import { executeGit } from "./process.js";
5
3
  import { captureWorkspaceTree } from "./workspace.js";
6
4
  export const unsealedBytesSchema = z
7
5
  .object({
8
6
  kind: z.literal("unsealed-bytes"),
9
7
  path: z.string().refine((value) => value.trim() !== ""),
10
- paths: z.array(z.string().refine((value) => value.trim() !== "")).readonly(),
11
- head: mintedSnapshotInputSchema.optional(),
12
8
  })
13
- .strict();
9
+ .strict()
10
+ .readonly();
14
11
  export function terminalSealSnapshots(state) {
15
12
  return [
16
13
  ...new Set([
@@ -70,36 +67,13 @@ export function terminalSealExpectations(state, objects) {
70
67
  treeBySnapshot,
71
68
  };
72
69
  }
73
- async function changedPaths(repository, left, right) {
74
- const fields = (await executeGit(repository, ["diff", "--name-only", "-z", left, right]))
75
- .toString("utf8")
76
- .split("\0");
77
- if (fields.at(-1) !== "")
78
- throw new Error("Git tree diff paths are not NUL terminated");
79
- return fields.slice(0, -1).sort();
80
- }
81
- async function unsealedWorkspaceBytes(repository, path, expected, workspace) {
70
+ async function unsealedWorkspaceBytes(path, expected, workspace) {
82
71
  const headIsSealed = expected.heads.includes(workspace.head);
83
- if (workspace.changes.submodules.length > 0) {
84
- return {
85
- kind: "unsealed-bytes",
86
- path,
87
- paths: workspace.changes.submodules,
88
- ...(headIsSealed ? {} : { head: workspace.head }),
89
- };
90
- }
72
+ if (workspace.changes.submodules.length > 0)
73
+ return { kind: "unsealed-bytes", path };
91
74
  if (headIsSealed && expected.trees.includes(workspace.tree))
92
75
  return null;
93
- const alternatives = [];
94
- for (const tree of expected.trees)
95
- alternatives.push(await changedPaths(repository, tree, workspace.tree));
96
- alternatives.sort((left, right) => left.length - right.length || left.join("\0").localeCompare(right.join("\0")));
97
- return {
98
- kind: "unsealed-bytes",
99
- path,
100
- paths: alternatives[0] ?? [],
101
- ...(headIsSealed ? {} : { head: workspace.head }),
102
- };
76
+ return { kind: "unsealed-bytes", path };
103
77
  }
104
78
  export async function observeTerminalWorkspace(repository, path, expected) {
105
79
  const captured = await captureWorkspaceTree(repository, path);
@@ -109,6 +83,6 @@ export async function observeTerminalWorkspace(repository, path, expected) {
109
83
  head: captured.head,
110
84
  submodules: captured.changes.submodules,
111
85
  },
112
- unsealed: await unsealedWorkspaceBytes(repository, path, expected, captured),
86
+ unsealed: await unsealedWorkspaceBytes(path, expected, captured),
113
87
  };
114
88
  }
@@ -43,59 +43,83 @@ export declare function workspaceMergeHead(repository: GitRepository, workspace:
43
43
  export declare function workspaceMergeStatePresent(repository: GitRepository, workspace: string): Promise<boolean>;
44
44
  /** Sorted unique unmerged index paths from porcelain status. */
45
45
  export declare function unmergedWorkspacePaths(repository: GitRepository, workspace: string): Promise<readonly string[]>;
46
- type WorkspaceChangeCounts = Readonly<{
47
- staged: number;
48
- unstaged: number;
49
- untracked: number;
50
- submodules: number;
51
- }>;
52
- export declare const conflictRecoverySchema: z.ZodObject<{
53
- materialize: z.ZodLiteral<"deliver --materialize-conflict --include-dirty">;
54
- deliver: z.ZodLiteral<"deliver --include-dirty">;
55
- staging: z.ZodLiteral<"not-required">;
56
- }, z.core.$strict>;
46
+ export declare const conflictRecoverySchema: z.ZodReadonly<z.ZodObject<{
47
+ materialize: z.ZodReadonly<z.ZodObject<{
48
+ kind: z.ZodLiteral<"deliver">;
49
+ materializeConflict: z.ZodLiteral<true>;
50
+ includeDirty: z.ZodLiteral<true>;
51
+ }, z.core.$strict>>;
52
+ deliver: z.ZodReadonly<z.ZodObject<{
53
+ kind: z.ZodLiteral<"deliver">;
54
+ includeDirty: z.ZodLiteral<true>;
55
+ }, z.core.$strict>>;
56
+ }, z.core.$strict>>;
57
57
  type ConflictRecovery = z.infer<typeof conflictRecoverySchema>;
58
58
  export declare const conflictRecovery: ConflictRecovery;
59
- type ContractWorkspaceMerge = Readonly<{
60
- head: SnapshotId;
61
- unmergedPaths: readonly string[];
62
- handoffBase?: SnapshotId;
63
- recovery?: ConflictRecovery;
64
- }>;
65
- export type ContractWorkspaceObservation = Readonly<{
66
- kind: "clean" | "dirty";
67
- location: ContractWorkspaceLocation;
68
- counts: WorkspaceChangeCounts;
69
- merge: ContractWorkspaceMerge | null;
70
- }> | Readonly<{
71
- kind: "unavailable";
72
- location: ContractWorkspaceLocation;
73
- }> | Readonly<{
74
- kind: "unappointed";
75
- }> | Readonly<{
76
- kind: "failed";
77
- diagnostic: string;
78
- }>;
79
- export declare const worktreeWorkspaceSchema: z.ZodObject<{
59
+ export type ContractWorkspaceObservation = z.output<typeof contractWorkspaceObservationSchema>;
60
+ export declare const worktreeWorkspaceSchema: z.ZodReadonly<z.ZodObject<{
80
61
  kind: z.ZodLiteral<"worktree">;
81
62
  path: z.ZodString;
82
- }, z.core.$strict>;
83
- export declare const contractTargetLagSchema: z.ZodUnion<readonly [z.ZodObject<{
63
+ }, z.core.$strict>>;
64
+ export declare const contractWorkspaceObservationSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
65
+ kind: z.ZodEnum<{
66
+ clean: "clean";
67
+ dirty: "dirty";
68
+ }>;
69
+ location: z.ZodReadonly<z.ZodObject<{
70
+ kind: z.ZodLiteral<"worktree">;
71
+ path: z.ZodString;
72
+ }, z.core.$strict>>;
73
+ counts: z.ZodReadonly<z.ZodObject<{
74
+ staged: z.ZodNumber;
75
+ unstaged: z.ZodNumber;
76
+ untracked: z.ZodNumber;
77
+ submodules: z.ZodNumber;
78
+ }, z.core.$strict>>;
79
+ merge: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
80
+ head: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
81
+ unmergedPaths: z.ZodReadonly<z.ZodArray<z.ZodString>>;
82
+ handoffBase: z.ZodExactOptional<z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>>;
83
+ recovery: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
84
+ materialize: z.ZodReadonly<z.ZodObject<{
85
+ kind: z.ZodLiteral<"deliver">;
86
+ materializeConflict: z.ZodLiteral<true>;
87
+ includeDirty: z.ZodLiteral<true>;
88
+ }, z.core.$strict>>;
89
+ deliver: z.ZodReadonly<z.ZodObject<{
90
+ kind: z.ZodLiteral<"deliver">;
91
+ includeDirty: z.ZodLiteral<true>;
92
+ }, z.core.$strict>>;
93
+ }, z.core.$strict>>>;
94
+ }, z.core.$strict>>>;
95
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
96
+ kind: z.ZodLiteral<"unavailable">;
97
+ location: z.ZodReadonly<z.ZodObject<{
98
+ kind: z.ZodLiteral<"worktree">;
99
+ path: z.ZodString;
100
+ }, z.core.$strict>>;
101
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
102
+ kind: z.ZodLiteral<"unappointed">;
103
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
104
+ kind: z.ZodLiteral<"failed">;
105
+ diagnostic: z.ZodString;
106
+ }, z.core.$strict>>]>;
107
+ export declare const contractTargetLagSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
84
108
  kind: z.ZodLiteral<"none">;
85
- }, z.core.$strict>, z.ZodObject<{
109
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
86
110
  kind: z.ZodLiteral<"unknown">;
87
- subject: z.ZodOptional<z.ZodObject<{
111
+ subject: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
88
112
  kind: z.ZodLiteral<"worktree">;
89
113
  path: z.ZodString;
90
- }, z.core.$strict>>;
91
- }, z.core.$strict>, z.ZodObject<{
114
+ }, z.core.$strict>>>;
115
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
92
116
  kind: z.ZodLiteral<"counted">;
93
117
  behind: z.ZodNumber;
94
- subject: z.ZodOptional<z.ZodObject<{
118
+ subject: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
95
119
  kind: z.ZodLiteral<"worktree">;
96
120
  path: z.ZodString;
97
- }, z.core.$strict>>;
98
- }, z.core.$strict>]>;
121
+ }, z.core.$strict>>>;
122
+ }, z.core.$strict>>]>;
99
123
  export type ContractTargetLag = z.infer<typeof contractTargetLagSchema>;
100
124
  export declare function observeWorkspace(repository: GitRepository, location: ContractWorkspaceLocation, workspace: string): Promise<ContractWorkspaceObservation>;
101
125
  export declare function observeTargetLag(repository: GitRepository, workspace: string, head: SnapshotId | null | undefined): Promise<ContractTargetLag>;
@@ -3,7 +3,7 @@ import { access, mkdtemp, rm } from "node:fs/promises";
3
3
  import { tmpdir } from "node:os";
4
4
  import { join, resolve } from "node:path";
5
5
  import { AuthorityCorruptionError } from "../core/facts/errors.js";
6
- import { contractPhysicalName, gitObjectId, mintSnapshotId } from "./identity.js";
6
+ import { contractPhysicalName, gitObjectId, mintSnapshotId, snapshotIdSchema } from "./identity.js";
7
7
  import { executeGit, GitPlumbingError } from "./process.js";
8
8
  import { HANDOFF_RECEIPT_REF_NAMESPACE, readBlob, readRef, readRefs, worktreeGitDirectory, writeBlob, } from "./repository.js";
9
9
  const WORKTREE_DIRECTORY = [".keiyaku", "wt"];
@@ -197,30 +197,61 @@ export async function unmergedWorkspacePaths(repository, workspace) {
197
197
  return (await workspaceStatus(repository, workspace)).unmergedPaths;
198
198
  }
199
199
  export const conflictRecoverySchema = z
200
- .object({
201
- materialize: z.literal("deliver --materialize-conflict --include-dirty"),
202
- deliver: z.literal("deliver --include-dirty"),
203
- staging: z.literal("not-required"),
200
+ .strictObject({
201
+ materialize: z
202
+ .strictObject({ kind: z.literal("deliver"), materializeConflict: z.literal(true), includeDirty: z.literal(true) })
203
+ .readonly(),
204
+ deliver: z.strictObject({ kind: z.literal("deliver"), includeDirty: z.literal(true) }).readonly(),
204
205
  })
205
- .strict();
206
+ .readonly();
206
207
  export const conflictRecovery = Object.freeze({
207
- materialize: "deliver --materialize-conflict --include-dirty",
208
- deliver: "deliver --include-dirty",
209
- staging: "not-required",
208
+ materialize: { kind: "deliver", materializeConflict: true, includeDirty: true },
209
+ deliver: { kind: "deliver", includeDirty: true },
210
210
  });
211
211
  export const worktreeWorkspaceSchema = z
212
212
  .object({ kind: z.literal("worktree"), path: z.string().refine((value) => value.trim() !== "") })
213
- .strict();
213
+ .strict()
214
+ .readonly();
215
+ export const contractWorkspaceObservationSchema = z.union([
216
+ z
217
+ .strictObject({
218
+ kind: z.enum(["clean", "dirty"]),
219
+ location: worktreeWorkspaceSchema,
220
+ counts: z
221
+ .strictObject({ staged: z.number(), unstaged: z.number(), untracked: z.number(), submodules: z.number() })
222
+ .readonly(),
223
+ merge: z
224
+ .strictObject({
225
+ head: snapshotIdSchema,
226
+ unmergedPaths: z.array(z.string()).readonly(),
227
+ handoffBase: snapshotIdSchema.exactOptional(),
228
+ recovery: conflictRecoverySchema.exactOptional(),
229
+ })
230
+ .readonly()
231
+ .nullable(),
232
+ })
233
+ .readonly(),
234
+ z.strictObject({ kind: z.literal("unavailable"), location: worktreeWorkspaceSchema }).readonly(),
235
+ z.strictObject({ kind: z.literal("unappointed") }).readonly(),
236
+ z.strictObject({ kind: z.literal("failed"), diagnostic: z.string() }).readonly(),
237
+ ]);
214
238
  export const contractTargetLagSchema = z.union([
215
- z.object({ kind: z.literal("none") }).strict(),
216
- z.object({ kind: z.literal("unknown"), subject: worktreeWorkspaceSchema.optional() }).strict(),
239
+ z
240
+ .object({ kind: z.literal("none") })
241
+ .strict()
242
+ .readonly(),
243
+ z
244
+ .object({ kind: z.literal("unknown"), subject: worktreeWorkspaceSchema.exactOptional() })
245
+ .strict()
246
+ .readonly(),
217
247
  z
218
248
  .object({
219
249
  kind: z.literal("counted"),
220
250
  behind: z.number().int().nonnegative(),
221
- subject: worktreeWorkspaceSchema.optional(),
251
+ subject: worktreeWorkspaceSchema.exactOptional(),
222
252
  })
223
- .strict(),
253
+ .strict()
254
+ .readonly(),
224
255
  ]);
225
256
  function countsOf(changes) {
226
257
  return {
@@ -1,3 +1,4 @@
1
+ import { z } from "zod";
1
2
  declare const AKUMA_ALIAS: unique symbol;
2
3
  declare const AKUMA_GLOB: unique symbol;
3
4
  export type AkumaAlias = string & {
@@ -6,6 +7,7 @@ export type AkumaAlias = string & {
6
7
  export type AkumaGlob = string & {
7
8
  readonly [AKUMA_GLOB]: true;
8
9
  };
10
+ export declare const akumaAliasSchema: z.ZodPipe<z.ZodString, z.ZodTransform<AkumaAlias, string>>;
9
11
  export declare function parseReadableAkumaAlias(value: string): AkumaAlias;
10
12
  export declare function parseAkumaAlias(value: string): AkumaAlias;
11
13
  export declare function parseAkumaGlob(value: string): AkumaGlob;
@@ -1,4 +1,14 @@
1
+ import { z } from "zod";
1
2
  import { MAX_AKUMA_NAME_BYTES, normalizeIdentityStem, validateAkumaName } from "./normalize.js";
3
+ export const akumaAliasSchema = z.string().transform((value, context) => {
4
+ try {
5
+ return parseReadableAkumaAlias(value);
6
+ }
7
+ catch {
8
+ context.addIssue({ code: "custom", message: "invalid Akuma alias" });
9
+ return z.NEVER;
10
+ }
11
+ });
2
12
  const AKUMA_GLOB_SUFFIX = /^[0-9a-f*]+$/u;
3
13
  const LEGACY_AKUMA_ALIAS_PATTERN = /^@[a-z][a-z0-9-]{0,63}$/u;
4
14
  // Old alias spellings remain readable, but new bindings use canonical Akuma names.
@@ -20,12 +30,12 @@ export function parseAkumaAlias(value) {
20
30
  }
21
31
  export function parseAkumaGlob(value) {
22
32
  const segments = value.split("/");
23
- const archetype = segments[1] ?? "";
24
- const archetypeProbe = archetype.replaceAll("*", "x");
33
+ const akumaName = segments[1] ?? "";
34
+ const archetypeProbe = akumaName.replaceAll("*", "x");
25
35
  if (segments.length !== 3 ||
26
36
  segments[0] !== "aku" ||
27
37
  !value.includes("*") ||
28
- archetype.length === 0 ||
38
+ akumaName.length === 0 ||
29
39
  normalizeIdentityStem({ source: archetypeProbe }) !== archetypeProbe ||
30
40
  !AKUMA_GLOB_SUFFIX.test(segments[2] ?? "")) {
31
41
  throw new TypeError("Akuma glob must be aku/<akuma-pattern>/<hex-pattern> and contain *");