@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,7 +1,9 @@
1
+ import { resolve } from "node:path";
1
2
  import { AkumaNotBornError, AkumaObservationError } from "../akuma/akuma-errors.js";
2
- import { AkumaArchetypeError } from "../index.js";
3
+ import { AkumaArchetypeError, Keiyaku, KeiyakuUsageError } from "../index.js";
3
4
  import { AkumaAddressError, AkumaWorldScopeError } from "../library/address.js";
4
5
  import { projectFailure, KeiyakuError } from "../library/outcome.js";
6
+ import { classifyVerb } from "../library/keiyaku-verbs.js";
5
7
  import { isParsedAkumaCommand, runAkumaCommand } from "./commands/akuma.js";
6
8
  import { admitBindMarkdown, runContractCommand, runContractHistoryCommand } from "./commands/contract.js";
7
9
  import { installOutcome, installHarnesses, renderInstallText } from "./commands/install.js";
@@ -12,10 +14,11 @@ import { resolveInvocationCoordinates } from "./coordinates.js";
12
14
  import { BindDraftError } from "./draft.js";
13
15
  import { assertExplicitRepoUse, CliUsageError, usageGuideForCommand, } from "./parse.js";
14
16
  import { createExecutionProgressRenderer } from "./render/execution-progress.js";
15
- import { executionFailureLines } from "./render/receipt.js";
16
- import { renderRefusal, renderStructuredRefusal } from "./render/refusal.js";
17
+ import { renderVerb } from "./render/verbs.js";
18
+ import { renderRefusal } from "./render/refusal.js";
17
19
  import { DEFAULT_CLI_COLUMNS, safeText } from "./render/terminal.js";
18
20
  import { cliExitCode, displayContext, emit, writeJson, writeStderr, writeStdout } from "./streams.js";
21
+ import { usageAcceptanceLines } from "./usage.js";
19
22
  async function processStdin() {
20
23
  const chunks = [];
21
24
  for await (const chunk of process.stdin)
@@ -59,42 +62,32 @@ function cliCancellation(signal) {
59
62
  },
60
63
  };
61
64
  }
62
- /** Projection of one native Akuma addressing/observation failure into its stated refusal body. */
63
- export async function akumaFailureProjection(error, command) {
64
- if (error instanceof AkumaNotBornError) {
65
- return {
66
- body: command.output === "json"
67
- ? error.message
68
- : renderStructuredRefusal(command.command, "Akuma not found", [`id ${safeText(error.id)}`], usageGuideForCommand(command)),
69
- outcome: "refused",
70
- };
71
- }
72
- if (error instanceof AkumaAddressError) {
73
- const body = error.refusal.kind === "akuma-alias-not-found"
74
- ? renderStructuredRefusal(command.command, "Akuma alias not found", [`alias ${safeText(error.refusal.alias)}`], usageGuideForCommand(command))
75
- : renderStructuredRefusal(command.command, "invalid Akuma address", [`selector ${safeText(error.refusal.selector)}`], usageGuideForCommand(command));
76
- return { body: command.output === "json" ? error.message : body, outcome: "refused" };
77
- }
78
- if (error instanceof AkumaWorldScopeError) {
79
- return {
80
- body: command.output === "json"
81
- ? JSON.stringify(error.refusal)
82
- : renderStructuredRefusal(command.command, "Akuma not in this World", [
83
- `ids ${error.refusal.ids.map((id) => safeText(id)).join(" · ")}`,
84
- `world ${safeText(error.refusal.world)}`,
85
- ], usageGuideForCommand(command)),
86
- outcome: "refused",
87
- };
88
- }
89
- if (error instanceof AkumaObservationError) {
90
- return {
91
- body: command.output === "json"
92
- ? error.message
93
- : `× Akuma observation failed ${safeText(error.id)} — ${safeText(error.diagnostic)}`,
94
- outcome: "failed",
95
- };
96
- }
97
- return undefined;
65
+ // A thrown completion does not consult input; acquisition may have failed before
66
+ // there was a wire input. The name still selects operation-specific judgment.
67
+ function thrownCompletion(error, command) {
68
+ const name = (command.command === "debt"
69
+ ? command.action === "ls"
70
+ ? "ls"
71
+ : command.action === "add" && command.stdin === "document"
72
+ ? "debt.addDocument"
73
+ : `debt.${command.action}`
74
+ : command.command === "deliver" && command.dryRun
75
+ ? "deliver.preview"
76
+ : command.command);
77
+ const input = undefined;
78
+ const completion = { kind: "threw", error };
79
+ return {
80
+ outcome: classifyVerb(name, input, completion),
81
+ text: () => renderVerb(name, input, completion, displayContext()),
82
+ };
83
+ }
84
+ /** Install is a CLI-only operation, not a facet verb. */
85
+ function writeInstallFailure(error, command) {
86
+ if (command.output === "json")
87
+ writeJson(projectFailure(error));
88
+ else
89
+ writeStderr(`× install failed\n reason ${safeText(error instanceof Error ? error.message : String(error))}`);
90
+ return "failed";
98
91
  }
99
92
  function writeBindDraftFailure(error, command) {
100
93
  const refusal = {
@@ -102,48 +95,62 @@ function writeBindDraftFailure(error, command) {
102
95
  diagnostic: error.original instanceof Error ? error.original.message : String(error.original),
103
96
  };
104
97
  if (command.output === "json")
105
- writeJson({ kind: "refused", operation: "bind", refusal, draft: error.draft });
98
+ writeJson({ kind: "refused", reason: refusal, draft: error.draft });
106
99
  else
107
100
  writeStdout(renderRefusal({ operation: "bind", refusal }, error.draft, displayContext()));
108
101
  return error.original instanceof CliUsageError ? "usage" : "refused";
109
102
  }
103
+ function writeAkumaFailure(error, command, shared) {
104
+ if (command.output === "json")
105
+ writeStderr(error instanceof AkumaWorldScopeError ? JSON.stringify(error.refusal) : error.message);
106
+ else {
107
+ const guide = error instanceof AkumaObservationError ? [] : usageAcceptanceLines(usageGuideForCommand(command));
108
+ writeStderr([shared.text(), ...guide].join("\n"));
109
+ }
110
+ return shared.outcome;
111
+ }
112
+ function writeArchetypeFailure(error, command, shared) {
113
+ const missing = error.reason === "was not found";
114
+ if (command.output === "json") {
115
+ writeJson({
116
+ kind: "refused",
117
+ diagnostic: missing ? "Akuma not found" : error.reason,
118
+ akumaName: error.akumaName,
119
+ searched: error.searched,
120
+ ...(missing ? { available: "keiyaku ls aku/" } : {}),
121
+ });
122
+ }
123
+ else
124
+ writeStdout([shared.text(), ...usageAcceptanceLines(usageGuideForCommand(command))].join("\n"));
125
+ return shared.outcome;
126
+ }
110
127
  async function writeFailure(error, command) {
111
128
  if (error instanceof BindDraftError)
112
129
  return writeBindDraftFailure(error, command);
113
- if (error instanceof KeiyakuError) {
114
- const diagnostic = error.message;
130
+ if (error instanceof CliUsageError) {
115
131
  if (command.output === "json")
116
132
  writeJson(projectFailure(error));
117
- else if (error.outcome !== undefined) {
118
- writeStdout(executionFailureLines(error.outcome, error.category, diagnostic, displayContext().columns).join("\n"));
119
- }
120
133
  else
121
- writeStderr(`× ${command.command} failed\n reason ${safeText(diagnostic)}`);
122
- return "failed";
123
- }
124
- const akumaFailure = await akumaFailureProjection(error, command);
125
- if (akumaFailure !== undefined) {
126
- writeStderr(akumaFailure.body);
127
- return akumaFailure.outcome;
128
- }
129
- if (error instanceof AkumaArchetypeError && command.command === "call") {
130
- const missing = error.reason === "was not found";
131
- const diagnostic = missing ? "Akuma not found" : error.reason;
132
- return emit(command.output, {
133
- kind: "refused",
134
- diagnostic,
135
- archetype: error.archetype,
136
- searched: error.searched,
137
- ...(missing ? { available: "keiyaku ls aku/" } : {}),
138
- }, () => renderStructuredRefusal("call", `${diagnostic} · ${error.archetype}`, [...error.searched.map((path) => `searched ${path}`), ...(missing ? ["available keiyaku ls aku/"] : [])], usageGuideForCommand(command)), "refused");
134
+ writeStderr(error.message);
135
+ return "usage";
139
136
  }
137
+ if (command.command === "install")
138
+ return writeInstallFailure(error, command);
139
+ const shared = thrownCompletion(error, command);
140
+ if (error instanceof AkumaNotBornError ||
141
+ error instanceof AkumaAddressError ||
142
+ error instanceof AkumaWorldScopeError ||
143
+ error instanceof AkumaObservationError)
144
+ return writeAkumaFailure(error, command, shared);
145
+ if (error instanceof AkumaArchetypeError && command.command === "spawn")
146
+ return writeArchetypeFailure(error, command, shared);
140
147
  if (command.output === "json")
141
148
  writeJson(projectFailure(error));
142
- else {
143
- const diagnostic = error instanceof Error ? error.message : String(error);
144
- writeStderr(error instanceof CliUsageError ? diagnostic : `× ${command.command} failed\n reason ${safeText(diagnostic)}`);
145
- }
146
- return error instanceof CliUsageError ? "usage" : "failed";
149
+ else if (error instanceof KeiyakuError && error.outcome !== undefined)
150
+ writeStdout(shared.text());
151
+ else
152
+ writeStderr(shared.text());
153
+ return shared.outcome;
147
154
  }
148
155
  export async function runCliCommand(invocation, input = {}) {
149
156
  return cliExitCode(await runCommand(invocation, input));
@@ -153,10 +160,10 @@ function invocationCoordinates(invocation, input, environment) {
153
160
  processCwd: input.cwd ?? process.cwd(),
154
161
  ...(invocation.cwd === undefined ? {} : { cwd: invocation.cwd }),
155
162
  ...(invocation.repo === undefined ? {} : { repo: invocation.repo }),
156
- ...(invocation.workdir === undefined ? {} : { workdir: invocation.workdir }),
157
163
  command: invocation.command,
158
164
  }, environment);
159
165
  }
166
+ // eslint-disable-next-line complexity -- dispatch keeps acquisition, the facet, and process outcome in one edge.
160
167
  async function runCommand(invocation, input) {
161
168
  const command = invocation.command;
162
169
  assertExplicitRepoUse(command, invocation.repo);
@@ -167,11 +174,16 @@ async function runCommand(invocation, input) {
167
174
  try {
168
175
  const runtime = {
169
176
  environment,
170
- ...(home === undefined ? {} : { home }),
177
+ facet: Keiyaku.at({
178
+ cwd: resolve(input.cwd ?? process.cwd(), invocation.cwd ?? "."),
179
+ environment,
180
+ ...(home === undefined ? {} : { home }),
181
+ ...(invocation.repo === undefined ? {} : { repo: invocation.repo }),
182
+ }),
171
183
  readStdin: memoized(input.readStdin ?? processStdin),
184
+ draftWorld: async () => (await invocationCoordinates(invocation, input, environment)).establishWorld(),
172
185
  signal: cancellation.signal,
173
186
  progress: () => (progress ??= writeExecutionProgress()),
174
- ...(input.actor === undefined ? {} : { actor: input.actor }),
175
187
  };
176
188
  if (command.command === "install") {
177
189
  const result = await installHarnesses(command.harnesses, environment);
@@ -186,18 +198,23 @@ async function runCommand(invocation, input) {
186
198
  }
187
199
  if (command.command === "report")
188
200
  return await runReport(command, runtime);
189
- const coordinates = await invocationCoordinates(invocation, input, environment);
190
201
  if (command.command === "whoami")
191
- return await runWhoami(command, coordinates, environment);
192
- if (command.command === "debt")
193
- return await runDebtCommand(command, coordinates, runtime);
194
- if (isParsedAkumaCommand(command))
195
- return await runAkumaCommand(command, coordinates, invocation.workdir, runtime);
202
+ return await runWhoami(command, runtime);
196
203
  if (command.command === "history" && "contract" in command)
197
- return await runContractHistoryCommand(command, coordinates);
198
- return await runContractCommand(command, coordinates, runtime);
204
+ return await runContractHistoryCommand(command, runtime);
205
+ if (isParsedAkumaCommand(command))
206
+ return await runAkumaCommand(command, invocation.workdir, runtime);
207
+ if (command.command === "debt")
208
+ return await runDebtCommand(command, runtime);
209
+ return await runContractCommand(command, runtime);
199
210
  }
200
211
  catch (error) {
212
+ if (error instanceof KeiyakuUsageError) {
213
+ const usage = new CliUsageError(error.message, usageGuideForCommand(command));
214
+ if (command.command === "ls" && command.query.kind === "akuma" && command.query.caller?.kind === "mine")
215
+ return await writeFailure(usage, command);
216
+ throw usage;
217
+ }
201
218
  if (error instanceof CliUsageError && error.guide === undefined) {
202
219
  throw new CliUsageError(error.diagnostic, usageGuideForCommand(command));
203
220
  }
@@ -1,7 +1,7 @@
1
1
  /** One surface's option table, named the way its refusal text names the surface. */
2
2
  export type ScanFlagKind = "boolean" | "value" | "raw-value" | "repeat";
3
3
  export type ScanSpec<Reader extends string = string> = Readonly<{
4
- /** Names this surface in refusal text: `bind`, `call`, `debt add`. */
4
+ /** Names this surface in refusal text: `bind`, `spawn`, `debt add`. */
5
5
  subject: string;
6
6
  flags: Readonly<Record<string, ScanFlagKind>>;
7
7
  /** The reader that consumes `-` input; absent makes `-` invalid here. */
@@ -20,6 +20,7 @@ export function displayContext() {
20
20
  ? process.stdout.columns
21
21
  : DEFAULT_CLI_COLUMNS,
22
22
  color: process.stdout.isTTY === true && process.env.NO_COLOR === undefined,
23
+ now: Date.now(),
23
24
  };
24
25
  }
25
26
  /** The live-progress context, measured from stderr where activity rows are written. */
@@ -31,7 +31,7 @@ export const CONTRACT_DELIVERER_SKILL = [
31
31
  "",
32
32
  "# Deliverer",
33
33
  "",
34
- "You are appointed Deliverer for the Contract in this worktree. The Contract document in `KEIYAKU.md` carries the journaled terms: Objective, Design, Region, Criteria, Verification. Your commission — the call and any tells — genuinely directs this round: what to build or investigate first, what evidence to gather, what to return. Both bind you; neither replaces the other. The terms are the standing acceptance floor; the commission is the round's direction and can never quietly add to that floor.",
34
+ "You are appointed Deliverer for the Contract in this worktree. The Contract document in `KEIYAKU.md` carries the journaled terms: Objective, Design, Region, Criteria, Verification. Your commission — the spawn prompt and any tells — genuinely directs this round: what to build or investigate first, what evidence to gather, what to return. Both bind you; neither replaces the other. The terms are the standing acceptance floor; the commission is the round's direction and can never quietly add to that floor.",
35
35
  "",
36
36
  "## Common Workflow",
37
37
  "",
@@ -68,7 +68,7 @@ export const CONTRACT_REVIEWER_SKILL = [
68
68
  "",
69
69
  "# Reviewer",
70
70
  "",
71
- "You are appointed Reviewer for the Contract in this worktree. Your commission — the call and any tells — owns the question: what to examine, how deep, which risks to watch, what evidence to demand, what to return. Follow it; it is why this review exists. You own the answer: every observation, finding, and the verdict are yours alone. An expectation stated in your commission is never evidence — it may tell you where to look, never what you found.",
71
+ "You are appointed Reviewer for the Contract in this worktree. Your commission — the spawn prompt and any tells — owns the question: what to examine, how deep, which risks to watch, what evidence to demand, what to return. Follow it; it is why this review exists. You own the answer: every observation, finding, and the verdict are yours alone. An expectation stated in your commission is never evidence — it may tell you where to look, never what you found.",
72
72
  "",
73
73
  "## Common Workflow",
74
74
  "",
@@ -2,26 +2,13 @@ import { z } from "zod";
2
2
  import { type ContractState } from "./core/facts/types.js";
3
3
  import { type GitRepository } from "./git/process.js";
4
4
  import { type PlaceRegister } from "./workspace-place.js";
5
- export declare const contractFileEffectSchema: z.ZodObject<{
6
- kind: z.ZodLiteral<"contract-file">;
7
- path: z.ZodString;
8
- action: z.ZodEnum<{
9
- removed: "removed";
10
- unchanged: "unchanged";
11
- updated: "updated";
12
- created: "created";
13
- }>;
14
- }, z.core.$strict>;
15
- export type ContractFileEffect = z.infer<typeof contractFileEffectSchema>;
16
- export declare const contractFileLagSchema: z.ZodObject<{
5
+ export declare const contractFileLagSchema: z.ZodReadonly<z.ZodObject<{
17
6
  kind: z.ZodLiteral<"contract-file-failed">;
18
- worktree: z.ZodString;
19
7
  path: z.ZodString;
20
8
  diagnostic: z.ZodString;
21
- }, z.core.$strict>;
9
+ }, z.core.$strict>>;
22
10
  export type ContractFileLag = z.infer<typeof contractFileLagSchema>;
23
11
  export type ContractWorktreeResult = Readonly<{
24
- effects: readonly ContractFileEffect[];
25
12
  lag: readonly ContractFileLag[];
26
13
  }>;
27
14
  export declare function projectContractWorktree(repository: GitRepository, state: ContractState | null, register?: PlaceRegister, _onConflict?: (diagnostic: string) => never): Promise<ContractWorktreeResult>;
@@ -22,21 +22,14 @@ const GENERATED_PATHS = [
22
22
  ".keiyaku/KEIYAKU.md",
23
23
  ...SEAT_SKILLS.flatMap(([seat]) => [`.agents/skills/${seat}/.gitignore`, `.agents/skills/${seat}/SKILL.md`]),
24
24
  ];
25
- export const contractFileEffectSchema = z
26
- .object({
27
- kind: z.literal("contract-file"),
28
- path: z.string().refine((value) => value.trim() !== ""),
29
- action: z.enum(["created", "updated", "unchanged", "removed"]),
30
- })
31
- .strict();
32
25
  export const contractFileLagSchema = z
33
26
  .object({
34
27
  kind: z.literal("contract-file-failed"),
35
- worktree: z.string().refine((value) => value.trim() !== ""),
36
28
  path: z.string().refine((value) => value.trim() !== ""),
37
29
  diagnostic: z.string().refine((value) => value.trim() !== ""),
38
30
  })
39
- .strict();
31
+ .strict()
32
+ .readonly();
40
33
  async function readTrackedPaths(repository, worktree, paths) {
41
34
  const output = await executeGit({ ...repository, effectiveCwd: worktree }, [
42
35
  "ls-files",
@@ -57,7 +50,8 @@ async function repair(worktree, relativePath, bytes, tracked) {
57
50
  if (tracked.has(relativePath))
58
51
  throw new Error(`generated path is tracked by Git: ${path}`);
59
52
  if (relativePath !== ".keiyaku/KEIYAKU.md") {
60
- return { kind: "contract-file", path, action: await repairDerivedFile(path, bytes) };
53
+ await repairDerivedFile(path, bytes);
54
+ return;
61
55
  }
62
56
  try {
63
57
  const stat = await lstat(path).catch((error) => {
@@ -68,8 +62,7 @@ async function repair(worktree, relativePath, bytes, tracked) {
68
62
  if (stat?.isFile() && !stat.isSymbolicLink() && !(await readFile(path)).equals(Buffer.from(bytes))) {
69
63
  await chmod(path, stat.mode | 0o200);
70
64
  }
71
- const action = await repairDerivedFile(path, bytes);
72
- return { kind: "contract-file", path, action };
65
+ await repairDerivedFile(path, bytes);
73
66
  }
74
67
  finally {
75
68
  try {
@@ -93,20 +86,15 @@ async function materializeSeatSkill(worktree, seat, bytes, tracked) {
93
86
  const skillPath = join(worktree, skill);
94
87
  const skillExists = await lstat(skillPath).catch((error) => error.code === "ENOENT" ? false : Promise.reject(error));
95
88
  if (!(await isKeiyakuSeatLeaf(worktree, seat)) && skillExists)
96
- return [];
97
- return [
98
- await repair(worktree, `${leaf}/.gitignore`, SEAT_IGNORE_BYTES, tracked),
99
- await repair(worktree, skill, bytes, tracked),
100
- ];
89
+ return;
90
+ await repair(worktree, `${leaf}/.gitignore`, SEAT_IGNORE_BYTES, tracked);
91
+ await repair(worktree, skill, bytes, tracked);
101
92
  }
102
93
  async function materialize(repository, worktree, guidance, namespace) {
103
- const effects = [];
104
- const failed = (target, path, error) => ({
105
- effects,
94
+ const failed = (path, error) => ({
106
95
  lag: [
107
96
  {
108
97
  kind: "contract-file-failed",
109
- worktree: target,
110
98
  path,
111
99
  diagnostic: error instanceof Error ? error.message : String(error),
112
100
  },
@@ -116,10 +104,10 @@ async function materialize(repository, worktree, guidance, namespace) {
116
104
  let tracked;
117
105
  try {
118
106
  tracked = await readTrackedPaths(repository, primaryWorktree, worktree === primaryWorktree ? GENERATED_PATHS : PRIMARY_GENERATED_PATHS);
119
- effects.push(await repair(primaryWorktree, ".keiyaku/.gitignore", PRIMARY_IGNORE_BYTES, tracked));
107
+ await repair(primaryWorktree, ".keiyaku/.gitignore", PRIMARY_IGNORE_BYTES, tracked);
120
108
  }
121
109
  catch (error) {
122
- return failed(primaryWorktree, join(primaryWorktree, ".keiyaku", ".gitignore"), error);
110
+ return failed(join(primaryWorktree, ".keiyaku", ".gitignore"), error);
123
111
  }
124
112
  const stat = await lstat(worktree).catch((error) => {
125
113
  if (error.code === "ENOENT")
@@ -128,11 +116,9 @@ async function materialize(repository, worktree, guidance, namespace) {
128
116
  });
129
117
  if (stat === undefined || !stat.isDirectory()) {
130
118
  return {
131
- effects,
132
119
  lag: [
133
120
  {
134
121
  kind: "contract-file-failed",
135
- worktree,
136
122
  path: generatedPath(worktree, "KEIYAKU.md"),
137
123
  diagnostic: "Contract worktree is unavailable",
138
124
  },
@@ -143,14 +129,14 @@ async function materialize(repository, worktree, guidance, namespace) {
143
129
  await repairNamespaceContext(worktree, namespace);
144
130
  }
145
131
  catch (error) {
146
- return failed(worktree, join(worktree, ".keiyaku", "namespace", "current"), error);
132
+ return failed(join(worktree, ".keiyaku", "namespace", "current"), error);
147
133
  }
148
134
  if (worktree !== primaryWorktree) {
149
135
  try {
150
136
  tracked = await readTrackedPaths(repository, worktree, GENERATED_PATHS);
151
137
  }
152
138
  catch (error) {
153
- return failed(worktree, join(worktree, ".keiyaku", ".gitignore"), error);
139
+ return failed(join(worktree, ".keiyaku", ".gitignore"), error);
154
140
  }
155
141
  }
156
142
  for (const [relativePath, bytes] of [
@@ -158,33 +144,31 @@ async function materialize(repository, worktree, guidance, namespace) {
158
144
  [".keiyaku/KEIYAKU.md", guidance],
159
145
  ]) {
160
146
  try {
161
- effects.push(await repair(worktree, relativePath, bytes, tracked));
147
+ await repair(worktree, relativePath, bytes, tracked);
162
148
  }
163
149
  catch (error) {
164
- return failed(worktree, join(worktree, relativePath), error);
150
+ return failed(join(worktree, relativePath), error);
165
151
  }
166
152
  }
167
153
  for (const [seat, bytes] of SEAT_SKILLS) {
168
154
  try {
169
- effects.push(...(await materializeSeatSkill(worktree, seat, bytes, tracked)));
155
+ await materializeSeatSkill(worktree, seat, bytes, tracked);
170
156
  }
171
157
  catch (error) {
172
- return failed(worktree, join(worktree, ".agents", "skills", seat), error);
158
+ return failed(join(worktree, ".agents", "skills", seat), error);
173
159
  }
174
160
  }
175
- return { effects, lag: [] };
161
+ return { lag: [] };
176
162
  }
177
163
  export async function projectContractWorktree(repository, state, register, _onConflict) {
178
164
  if (state === null || state.terminal)
179
- return { effects: [], lag: [] };
165
+ return { lag: [] };
180
166
  const appointed = register === undefined ? undefined : appointmentFor(register, state.id);
181
167
  if (appointed === undefined) {
182
168
  return {
183
- effects: [],
184
169
  lag: [
185
170
  {
186
171
  kind: "contract-file-failed",
187
- worktree: repository.primaryWorktree,
188
172
  path: placeRegisterPath(repository),
189
173
  diagnostic: "managed Contract is unappointed",
190
174
  },
@@ -8,14 +8,13 @@ export declare function contractState(observation: ContractsObservation, contrac
8
8
  export declare function prerequisiteStatus(prerequisites: readonly ContractId[], observation: ContractsObservation): PrerequisiteStatus;
9
9
  export type ActiveContractRefusal = Readonly<{
10
10
  kind: "contract-missing" | "terminal";
11
- contractId: ContractId;
12
11
  }>;
13
12
  export type TargetContractRefusal = Readonly<{
14
- kind: "target-contract-missing" | "target-contract-terminal" | "target-contract-self";
15
- contractId: ContractId;
13
+ kind: "target-contract-missing" | "target-contract-terminal";
14
+ targetContractId: ContractId;
16
15
  }>;
17
- export declare function targetContractRefusal(observation: ContractsObservation, owner: ContractId, target: ContractTarget | undefined): TargetContractRefusal | undefined;
18
- export declare function targetContractIdRefusal(observation: ContractsObservation, owner: ContractId, target: ContractId): TargetContractRefusal | undefined;
16
+ export declare function targetContractRefusal(observation: ContractsObservation, target: ContractTarget | undefined): TargetContractRefusal | undefined;
17
+ export declare function targetContractIdRefusal(observation: ContractsObservation, target: ContractId): TargetContractRefusal | undefined;
19
18
  /** The single lifecycle guard shared by every operation on an existing contract. */
20
19
  export declare function activeContract(observation: ContractsObservation, contract: ContractId): ContractState | ActiveContractRefusal;
21
20
  export declare function documentIsCurrent(state: ContractState, document: DocumentKey): boolean;
@@ -21,28 +21,26 @@ export function prerequisiteStatus(prerequisites, observation) {
21
21
  }
22
22
  return pending ? "pending" : "claimed";
23
23
  }
24
- export function targetContractRefusal(observation, owner, target) {
24
+ export function targetContractRefusal(observation, target) {
25
25
  if (target === undefined || typeof target === "string")
26
26
  return undefined;
27
- return targetContractIdRefusal(observation, owner, target.contractId);
27
+ return targetContractIdRefusal(observation, target.contractId);
28
28
  }
29
- export function targetContractIdRefusal(observation, owner, target) {
30
- if (owner === target)
31
- return { kind: "target-contract-self", contractId: owner };
29
+ export function targetContractIdRefusal(observation, target) {
32
30
  const state = contractState(observation, target);
33
31
  if (state === null)
34
- return { kind: "target-contract-missing", contractId: target };
32
+ return { kind: "target-contract-missing", targetContractId: target };
35
33
  if (state.terminal !== null)
36
- return { kind: "target-contract-terminal", contractId: target };
34
+ return { kind: "target-contract-terminal", targetContractId: target };
37
35
  return undefined;
38
36
  }
39
37
  /** The single lifecycle guard shared by every operation on an existing contract. */
40
38
  export function activeContract(observation, contract) {
41
39
  const state = contractState(observation, contract);
42
40
  if (state === null)
43
- return { kind: "contract-missing", contractId: contract };
41
+ return { kind: "contract-missing" };
44
42
  if (state.terminal)
45
- return { kind: "terminal", contractId: contract };
43
+ return { kind: "terminal" };
46
44
  return state;
47
45
  }
48
46
  export function documentIsCurrent(state, document) {
@@ -9,6 +9,5 @@ export type AmendInput<Failure = never> = Readonly<{
9
9
  }>;
10
10
  export type AmendRefusal = Readonly<{
11
11
  kind: "contract-missing" | "terminal" | "terms-moved" | "unknown-prerequisite" | "cyclic-prerequisite";
12
- contractId: ContractId;
13
12
  }>;
14
13
  export declare function decideAmend<Failure>({ input, attempt, observation, }: DecideInput<AmendInput<Failure>>): OfferDecision<AmendRefusal | Failure>;
@@ -25,17 +25,17 @@ export function decideAmend({ input, attempt, observation, }) {
25
25
  }) &&
26
26
  samePrerequisites(source.after, current.terms.after);
27
27
  if (!termsCurrent) {
28
- return { kind: "refused", refusal: { kind: "terms-moved", contractId: id } };
28
+ return { kind: "refused", refusal: { kind: "terms-moved" } };
29
29
  }
30
30
  if (input.preparation.kind === "refused")
31
31
  return { kind: "refused", refusal: input.preparation.refusal };
32
32
  const { data } = input.preparation;
33
33
  const prerequisites = prerequisiteStatus(data.after, observation);
34
34
  if (prerequisites === "unknown") {
35
- return { kind: "refused", refusal: { kind: "unknown-prerequisite", contractId: id } };
35
+ return { kind: "refused", refusal: { kind: "unknown-prerequisite" } };
36
36
  }
37
37
  if (prerequisitesReach(id, data.after, observation)) {
38
- return { kind: "refused", refusal: { kind: "cyclic-prerequisite", contractId: id } };
38
+ return { kind: "refused", refusal: { kind: "cyclic-prerequisite" } };
39
39
  }
40
40
  const entry = journalEntry("amend", input, attempt.entryUlids[0], data);
41
41
  return { kind: "offer", offer: { facts: [{ contractId: id, entries: [entry] }] } };
@@ -10,6 +10,5 @@ export type BindInput<Failure = never> = Readonly<{
10
10
  }>;
11
11
  export type BindRefusal = Readonly<{
12
12
  kind: "contract-exists" | "invalid-after" | "unknown-prerequisite";
13
- contractId: ContractId;
14
13
  }> | TargetContractRefusal;
15
14
  export declare function decideBind<Failure>({ input, attempt, observation, }: DecideInput<BindInput<Failure>>): OfferDecision<BindRefusal | Failure>;
@@ -4,23 +4,23 @@ export function decideBind({ input, attempt, observation, }) {
4
4
  const id = input.contractId;
5
5
  const current = contractState(observation, id);
6
6
  if (current !== null)
7
- return { kind: "refused", refusal: { kind: "contract-exists", contractId: id } };
7
+ return { kind: "refused", refusal: { kind: "contract-exists" } };
8
8
  if (input.targetContract !== undefined) {
9
- const refusal = targetContractIdRefusal(observation, id, input.targetContract);
9
+ const refusal = targetContractIdRefusal(observation, input.targetContract);
10
10
  if (refusal !== undefined)
11
11
  return { kind: "refused", refusal };
12
12
  }
13
13
  if (input.preparation.kind === "refused")
14
14
  return { kind: "refused", refusal: input.preparation.refusal };
15
15
  const { data } = input.preparation;
16
- const targetRefusal = targetContractRefusal(observation, id, data.coordinates.target);
16
+ const targetRefusal = targetContractRefusal(observation, data.coordinates.target);
17
17
  if (targetRefusal !== undefined)
18
18
  return { kind: "refused", refusal: targetRefusal };
19
19
  if (data.terms.after.includes(id))
20
- return { kind: "refused", refusal: { kind: "invalid-after", contractId: id } };
20
+ return { kind: "refused", refusal: { kind: "invalid-after" } };
21
21
  const prerequisites = prerequisiteStatus(data.terms.after, observation);
22
22
  if (prerequisites === "unknown") {
23
- return { kind: "refused", refusal: { kind: "unknown-prerequisite", contractId: id } };
23
+ return { kind: "refused", refusal: { kind: "unknown-prerequisite" } };
24
24
  }
25
25
  const bind = journalEntry("bind", input, attempt.entryUlids[0], data);
26
26
  return { kind: "offer", offer: { facts: [{ contractId: id, entries: [bind] }] } };
@@ -8,7 +8,8 @@ export type DeliverInput<Failure = never> = Readonly<{
8
8
  preparation: StampedPreparation<DeliverData, Failure>;
9
9
  }>;
10
10
  export type DeliverRefusal = Readonly<{
11
- kind: "contract-missing" | "terminal" | "document-moved";
12
- contractId: ContractId;
11
+ kind: "contract-missing" | "terminal";
12
+ }> | Readonly<{
13
+ kind: "document-moved";
13
14
  }> | TargetContractRefusal;
14
15
  export declare function decideDeliver<Failure>({ input, attempt, observation, }: DecideInput<DeliverInput<Failure>>): OfferDecision<DeliverRefusal | Failure>;
@@ -4,14 +4,14 @@ export function decideDeliver({ input, attempt, observation, }) {
4
4
  const state = activeContract(observation, input.contractId);
5
5
  if ("kind" in state)
6
6
  return { kind: "refused", refusal: state };
7
- const targetRefusal = targetContractRefusal(observation, state.id, state.coordinates.target);
7
+ const targetRefusal = targetContractRefusal(observation, state.coordinates.target);
8
8
  if (targetRefusal !== undefined)
9
9
  return { kind: "refused", refusal: targetRefusal };
10
10
  if (input.preparation.kind === "unavailable") {
11
11
  throw new Error("existing contract requires a stamped delivery preparation");
12
12
  }
13
13
  if (!documentIsCurrent(state, input.preparation.document)) {
14
- return { kind: "refused", refusal: { kind: "document-moved", contractId: input.contractId } };
14
+ return { kind: "refused", refusal: { kind: "document-moved" } };
15
15
  }
16
16
  if (input.preparation.kind === "refused")
17
17
  return { kind: "refused", refusal: input.preparation.refusal };
@@ -13,16 +13,11 @@ type UnmetPrerequisite = Readonly<{
13
13
  }>;
14
14
  export type PlacementRefusal = TargetContractRefusal | Readonly<{
15
15
  kind: "contract-missing" | "delivery-missing" | "terminal";
16
- contractId: ContractId;
17
16
  }> | Readonly<{
18
17
  kind: "gates-unsatisfied";
19
- contractId: ContractId;
20
18
  unmet: readonly GateReport[];
21
- /** The reference the refused placement attempted to advance, when the Contract has one. */
22
- target?: string;
23
19
  }> | Readonly<{
24
20
  kind: "prerequisites-unsatisfied";
25
- contractId: ContractId;
26
21
  unmet: readonly UnmetPrerequisite[];
27
22
  }>;
28
23
  export declare function unmetPrerequisites(prerequisites: readonly ContractId[], observation: ReadonlyMap<ContractId, ContractState | null>): readonly UnmetPrerequisite[];