@astrosheep/keiyaku 4.6.29 → 4.6.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (400) hide show
  1. package/README.md +5 -5
  2. package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
  3. package/build/plugins/claude/skills/keiyaku/SKILL.md +24 -24
  4. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +44 -168
  5. package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +61 -231
  6. package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +47 -58
  7. package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +44 -185
  8. package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +40 -89
  9. package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +56 -116
  10. package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
  11. package/build/plugins/codex/skills/keiyaku/SKILL.md +24 -24
  12. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +44 -168
  13. package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +61 -231
  14. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +47 -58
  15. package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +44 -185
  16. package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +40 -89
  17. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +56 -116
  18. package/build/plugins/opencode/package.json +1 -1
  19. package/build/plugins/opencode/skills/keiyaku/SKILL.md +24 -24
  20. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +44 -168
  21. package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +61 -231
  22. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +47 -58
  23. package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +44 -185
  24. package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +40 -89
  25. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +56 -116
  26. package/build/plugins/pi/README.md +5 -5
  27. package/build/plugins/pi/akuma-tools.ts +17 -23
  28. package/build/skills/keiyaku/SKILL.md +24 -24
  29. package/build/skills/keiyaku-akuma/SKILL.md +44 -168
  30. package/build/skills/keiyaku-akuma/references/automation.md +61 -231
  31. package/build/skills/keiyaku-babysit/SKILL.md +47 -58
  32. package/build/skills/keiyaku-bind/SKILL.md +44 -185
  33. package/build/skills/keiyaku-debt/SKILL.md +40 -89
  34. package/build/skills/keiyaku-workflow/SKILL.md +56 -116
  35. package/build/src/akuma/akuma-call.d.ts +1 -1
  36. package/build/src/akuma/akuma-call.js +9 -9
  37. package/build/src/akuma/akuma-errors.d.ts +5 -5
  38. package/build/src/akuma/akuma-instance.d.ts +355 -12
  39. package/build/src/akuma/akuma-instance.js +20 -20
  40. package/build/src/akuma/akuma-observe.d.ts +11 -12
  41. package/build/src/akuma/akuma-observe.js +34 -26
  42. package/build/src/akuma/akuma-owner.d.ts +32 -11
  43. package/build/src/akuma/akuma-owner.js +35 -16
  44. package/build/src/akuma/akuma-probe.d.ts +3 -3
  45. package/build/src/akuma/akuma-probe.js +2 -2
  46. package/build/src/akuma/akuma-selection-execution.d.ts +985 -1
  47. package/build/src/akuma/akuma-selection-execution.js +42 -18
  48. package/build/src/akuma/akuma-stream.d.ts +2 -2
  49. package/build/src/akuma/akuma-stream.js +1 -1
  50. package/build/src/akuma/akuma-wait.d.ts +5 -5
  51. package/build/src/akuma/akuma-wait.js +52 -14
  52. package/build/src/akuma/akuma.d.ts +245 -271
  53. package/build/src/akuma/akuma.js +98 -46
  54. package/build/src/akuma/archetype.d.ts +19 -6
  55. package/build/src/akuma/archetype.js +25 -9
  56. package/build/src/akuma/body-launch.d.ts +2 -2
  57. package/build/src/akuma/body.js +4 -4
  58. package/build/src/akuma/call-initial-tell.d.ts +60 -44
  59. package/build/src/akuma/call-initial-tell.js +41 -2
  60. package/build/src/akuma/caller.d.ts +26 -17
  61. package/build/src/akuma/caller.js +22 -9
  62. package/build/src/akuma/coordinate.d.ts +9 -0
  63. package/build/src/akuma/coordinate.js +13 -0
  64. package/build/src/akuma/detached-body.js +2 -2
  65. package/build/src/akuma/dispatch-association.d.ts +4 -4
  66. package/build/src/akuma/dispatch-association.js +12 -3
  67. package/build/src/akuma/execution-instructions.js +2 -2
  68. package/build/src/akuma/heart/facts.d.ts +29 -7
  69. package/build/src/akuma/heart/facts.js +13 -0
  70. package/build/src/akuma/heart/index.d.ts +0 -3
  71. package/build/src/akuma/heart/index.js +3 -6
  72. package/build/src/akuma/heart/rows.js +2 -2
  73. package/build/src/akuma/heart/soul.js +5 -5
  74. package/build/src/akuma/identity.d.ts +17 -16
  75. package/build/src/akuma/identity.js +20 -19
  76. package/build/src/akuma/index.d.ts +1 -2
  77. package/build/src/akuma/lineage-cache.d.ts +4 -4
  78. package/build/src/akuma/lineage-cache.js +10 -10
  79. package/build/src/akuma/projection-read.d.ts +2 -5
  80. package/build/src/akuma/projection-read.js +34 -47
  81. package/build/src/akuma/projection.d.ts +659 -569
  82. package/build/src/akuma/projection.js +203 -94
  83. package/build/src/akuma/providers/acp/index.js +1 -1
  84. package/build/src/akuma/providers/execution-environment.d.ts +1 -3
  85. package/build/src/akuma/providers/execution-environment.js +0 -4
  86. package/build/src/akuma/publication.d.ts +2 -2
  87. package/build/src/akuma/publication.js +3 -3
  88. package/build/src/akuma/retention.js +2 -2
  89. package/build/src/akuma/selection-observation.d.ts +507 -43
  90. package/build/src/akuma/selection-observation.js +153 -1
  91. package/build/src/akuma/status-projection.d.ts +288 -0
  92. package/build/src/akuma/status-projection.js +154 -0
  93. package/build/src/akuma/turn-drive.js +0 -3
  94. package/build/src/alias/index.d.ts +9 -4
  95. package/build/src/alias/index.js +11 -9
  96. package/build/src/bounded-list.d.ts +8 -0
  97. package/build/src/bounded-list.js +9 -0
  98. package/build/src/cli/commands/akuma-grammar.d.ts +2 -2
  99. package/build/src/cli/commands/akuma-grammar.js +21 -21
  100. package/build/src/cli/commands/akuma.d.ts +1 -2
  101. package/build/src/cli/commands/akuma.js +115 -251
  102. package/build/src/cli/commands/contract-grammar.d.ts +4 -3
  103. package/build/src/cli/commands/contract-grammar.js +39 -22
  104. package/build/src/cli/commands/contract-help.d.ts +3 -1
  105. package/build/src/cli/commands/contract-help.js +4 -3
  106. package/build/src/cli/commands/contract.d.ts +6 -3
  107. package/build/src/cli/commands/contract.js +203 -434
  108. package/build/src/cli/commands/debt.d.ts +2 -3
  109. package/build/src/cli/commands/debt.js +101 -317
  110. package/build/src/cli/commands/report.js +11 -28
  111. package/build/src/cli/commands/whoami.d.ts +3 -43
  112. package/build/src/cli/commands/whoami.js +8 -121
  113. package/build/src/cli/coordinates.d.ts +4 -35
  114. package/build/src/cli/coordinates.js +13 -129
  115. package/build/src/cli/parse.d.ts +0 -6
  116. package/build/src/cli/parse.js +5 -48
  117. package/build/src/cli/render/akuma-activity.d.ts +31 -16
  118. package/build/src/cli/render/akuma-activity.js +162 -122
  119. package/build/src/cli/render/akuma-tool.d.ts +3 -6
  120. package/build/src/cli/render/akuma-tool.js +20 -14
  121. package/build/src/cli/render/akuma.d.ts +25 -26
  122. package/build/src/cli/render/akuma.js +100 -129
  123. package/build/src/cli/render/catalog.d.ts +4 -7
  124. package/build/src/cli/render/catalog.js +52 -99
  125. package/build/src/cli/render/contract-history.d.ts +3 -1
  126. package/build/src/cli/render/contract-history.js +140 -215
  127. package/build/src/cli/render/contract-observation.d.ts +43 -30
  128. package/build/src/cli/render/contract-observation.js +64 -31
  129. package/build/src/cli/render/contract-wait.js +6 -6
  130. package/build/src/cli/render/contract.d.ts +41 -6
  131. package/build/src/cli/render/contract.js +274 -370
  132. package/build/src/cli/render/debt.d.ts +9 -19
  133. package/build/src/cli/render/debt.js +120 -185
  134. package/build/src/cli/render/delivery-preview.d.ts +4 -3
  135. package/build/src/cli/render/delivery-preview.js +68 -96
  136. package/build/src/cli/render/kanshi-akuma.d.ts +5 -4
  137. package/build/src/cli/render/kanshi-akuma.js +70 -59
  138. package/build/src/cli/render/kanshi.d.ts +4 -4
  139. package/build/src/cli/render/kanshi.js +205 -207
  140. package/build/src/cli/render/marks.d.ts +11 -2
  141. package/build/src/cli/render/marks.js +13 -3
  142. package/build/src/cli/render/nuke.d.ts +3 -3
  143. package/build/src/cli/render/nuke.js +13 -16
  144. package/build/src/cli/render/receipt.d.ts +37 -43
  145. package/build/src/cli/render/receipt.js +313 -236
  146. package/build/src/cli/render/reconcile.d.ts +6 -4
  147. package/build/src/cli/render/reconcile.js +53 -137
  148. package/build/src/cli/render/refusal.d.ts +3 -2
  149. package/build/src/cli/render/refusal.js +73 -54
  150. package/build/src/cli/render/region.d.ts +11 -2
  151. package/build/src/cli/render/region.js +17 -23
  152. package/build/src/cli/render/settings.d.ts +0 -1
  153. package/build/src/cli/render/settings.js +8 -17
  154. package/build/src/cli/render/terminal.d.ts +2 -0
  155. package/build/src/cli/render/verbs.d.ts +4 -0
  156. package/build/src/cli/render/verbs.js +312 -0
  157. package/build/src/cli/render/whoami.d.ts +1 -1
  158. package/build/src/cli/render/whoami.js +24 -31
  159. package/build/src/cli/runtime.d.ts +3 -11
  160. package/build/src/cli/runtime.js +96 -79
  161. package/build/src/cli/scan.d.ts +1 -1
  162. package/build/src/cli/streams.js +1 -0
  163. package/build/src/contract-guidance.js +2 -2
  164. package/build/src/contract-worktree.d.ts +2 -15
  165. package/build/src/contract-worktree.js +35 -36
  166. package/build/src/core/facts/observation.d.ts +4 -5
  167. package/build/src/core/facts/observation.js +7 -9
  168. package/build/src/core/verbs/amend.d.ts +0 -1
  169. package/build/src/core/verbs/amend.js +3 -3
  170. package/build/src/core/verbs/bind.d.ts +0 -1
  171. package/build/src/core/verbs/bind.js +5 -5
  172. package/build/src/core/verbs/deliver.d.ts +3 -2
  173. package/build/src/core/verbs/deliver.js +2 -2
  174. package/build/src/core/verbs/placement.d.ts +0 -5
  175. package/build/src/core/verbs/placement.js +4 -6
  176. package/build/src/core/verbs/reintegrate.d.ts +0 -1
  177. package/build/src/core/verbs/reintegrate.js +2 -2
  178. package/build/src/debt/board.d.ts +132 -116
  179. package/build/src/debt/board.js +138 -94
  180. package/build/src/debt/catalog.d.ts +4 -4
  181. package/build/src/debt/catalog.js +2 -18
  182. package/build/src/debt/context.d.ts +15 -3
  183. package/build/src/debt/context.js +12 -1
  184. package/build/src/debt/created-observation.d.ts +5 -17
  185. package/build/src/debt/created-observation.js +14 -6
  186. package/build/src/debt/document.d.ts +20 -15
  187. package/build/src/debt/document.js +18 -1
  188. package/build/src/debt/index.d.ts +346 -23
  189. package/build/src/debt/index.js +68 -22
  190. package/build/src/debt/input.d.ts +2 -1
  191. package/build/src/debt/input.js +14 -0
  192. package/build/src/debt/lifecycle-operations.d.ts +2 -2
  193. package/build/src/debt/lifecycle-operations.js +14 -22
  194. package/build/src/debt/operation-types.d.ts +188 -66
  195. package/build/src/debt/operation-types.js +113 -1
  196. package/build/src/debt/operations.d.ts +11 -10
  197. package/build/src/debt/operations.js +46 -71
  198. package/build/src/debt/query.d.ts +14 -10
  199. package/build/src/debt/query.js +3 -12
  200. package/build/src/debt/store.d.ts +4 -2
  201. package/build/src/debt/store.js +8 -8
  202. package/build/src/debt/view.d.ts +0 -3
  203. package/build/src/debt/view.js +0 -4
  204. package/build/src/dispatch/index.d.ts +22 -5
  205. package/build/src/dispatch/index.js +46 -37
  206. package/build/src/git/admission.d.ts +2 -2
  207. package/build/src/git/admission.js +2 -1
  208. package/build/src/git/hooks.d.ts +14 -35
  209. package/build/src/git/hooks.js +45 -25
  210. package/build/src/git/integration.d.ts +6 -24
  211. package/build/src/git/integration.js +10 -16
  212. package/build/src/git/observe.d.ts +2 -1
  213. package/build/src/git/observe.js +29 -20
  214. package/build/src/git/private-state-seat.d.ts +2 -2
  215. package/build/src/git/private-state-seat.js +2 -1
  216. package/build/src/git/reconcile.d.ts +17 -79
  217. package/build/src/git/reconcile.js +37 -52
  218. package/build/src/git/scratch.d.ts +3 -3
  219. package/build/src/git/scratch.js +4 -1
  220. package/build/src/git/target-placement.d.ts +23 -31
  221. package/build/src/git/target-placement.js +42 -27
  222. package/build/src/git/target.d.ts +2 -2
  223. package/build/src/git/target.js +2 -1
  224. package/build/src/git/tender.d.ts +7 -39
  225. package/build/src/git/tender.js +21 -54
  226. package/build/src/git/terminal-reconcile.js +15 -18
  227. package/build/src/git/terminal-seal.d.ts +2 -4
  228. package/build/src/git/terminal-seal.js +7 -33
  229. package/build/src/git/workspace.d.ts +65 -41
  230. package/build/src/git/workspace.js +45 -14
  231. package/build/src/identity/selector.d.ts +2 -0
  232. package/build/src/identity/selector.js +13 -3
  233. package/build/src/index.d.ts +48 -54
  234. package/build/src/index.js +31 -43
  235. package/build/src/kanshi/counts.d.ts +42 -8
  236. package/build/src/kanshi/counts.js +13 -2
  237. package/build/src/kanshi/index.d.ts +5 -5
  238. package/build/src/kanshi/index.js +4 -3
  239. package/build/src/kanshi/read.d.ts +489 -6
  240. package/build/src/kanshi/read.js +334 -483
  241. package/build/src/kanshi/report.d.ts +2504 -103
  242. package/build/src/kanshi/report.js +165 -1
  243. package/build/src/kanshi/select.d.ts +0 -8
  244. package/build/src/kanshi/select.js +20 -59
  245. package/build/src/library/address.d.ts +8 -8
  246. package/build/src/library/address.js +7 -7
  247. package/build/src/library/akuma-creation.d.ts +690 -84
  248. package/build/src/library/akuma-creation.js +202 -142
  249. package/build/src/library/akuma-retention.d.ts +2 -2
  250. package/build/src/library/akuma-retention.js +2 -2
  251. package/build/src/library/akumas.d.ts +10 -6
  252. package/build/src/library/akumas.js +24 -7
  253. package/build/src/library/bind.d.ts +28 -54
  254. package/build/src/library/bind.js +6 -4
  255. package/build/src/library/continuation.d.ts +197 -479
  256. package/build/src/library/continuation.js +40 -23
  257. package/build/src/library/contract-address.d.ts +6 -5
  258. package/build/src/library/contract-address.js +5 -7
  259. package/build/src/library/contract-composition.d.ts +18 -12
  260. package/build/src/library/contract-composition.js +55 -47
  261. package/build/src/library/contract-creation.d.ts +3 -2
  262. package/build/src/library/contract-creation.js +38 -32
  263. package/build/src/library/contract-execution.js +77 -38
  264. package/build/src/library/contract-outcomes.d.ts +1877 -27
  265. package/build/src/library/contract-outcomes.js +93 -10
  266. package/build/src/library/contract-settings.d.ts +2 -2
  267. package/build/src/library/contract-settings.js +18 -14
  268. package/build/src/library/contract-types.d.ts +238 -61
  269. package/build/src/library/contract-types.js +131 -1
  270. package/build/src/library/contract-wait.d.ts +38 -17
  271. package/build/src/library/contract-wait.js +40 -10
  272. package/build/src/library/delivery.d.ts +588 -36
  273. package/build/src/library/delivery.js +35 -27
  274. package/build/src/library/input.d.ts +1 -1
  275. package/build/src/library/input.js +1 -2
  276. package/build/src/library/invocation.d.ts +11 -7
  277. package/build/src/library/invocation.js +42 -51
  278. package/build/src/library/kei.d.ts +48 -0
  279. package/build/src/library/kei.js +256 -0
  280. package/build/src/library/keiyaku-attribution.d.ts +11 -0
  281. package/build/src/{cli/delivery-identity.js → library/keiyaku-attribution.js} +12 -1
  282. package/build/src/library/keiyaku-classify.d.ts +11 -0
  283. package/build/src/library/keiyaku-classify.js +146 -0
  284. package/build/src/library/keiyaku-coordinates.d.ts +31 -0
  285. package/build/src/library/keiyaku-coordinates.js +103 -0
  286. package/build/src/library/keiyaku-debt.d.ts +142 -0
  287. package/build/src/library/keiyaku-debt.js +188 -0
  288. package/build/src/library/keiyaku-identity.d.ts +58 -0
  289. package/build/src/library/keiyaku-identity.js +176 -0
  290. package/build/src/library/keiyaku-policy.d.ts +27 -0
  291. package/build/src/library/keiyaku-policy.js +44 -0
  292. package/build/src/library/keiyaku-status.d.ts +1487 -0
  293. package/build/src/library/keiyaku-status.js +92 -0
  294. package/build/src/library/keiyaku-verbs.d.ts +6774 -0
  295. package/build/src/library/keiyaku-verbs.js +458 -0
  296. package/build/src/library/keiyaku.d.ts +871 -38
  297. package/build/src/library/keiyaku.js +677 -127
  298. package/build/src/library/nuke.d.ts +22 -0
  299. package/build/src/library/nuke.js +4 -1
  300. package/build/src/library/outcome.d.ts +706 -692
  301. package/build/src/library/outcome.js +582 -167
  302. package/build/src/library/reconcile.d.ts +464 -116
  303. package/build/src/library/reconcile.js +174 -102
  304. package/build/src/library/refusal.d.ts +113 -577
  305. package/build/src/library/refusal.js +64 -51
  306. package/build/src/library/region.d.ts +5 -24
  307. package/build/src/library/region.js +6 -21
  308. package/build/src/library/selection.d.ts +181 -32
  309. package/build/src/library/selection.js +99 -64
  310. package/build/src/mcp/adapter.d.ts +11 -0
  311. package/build/src/mcp/adapter.js +106 -0
  312. package/build/src/mcp/help.d.ts +1 -0
  313. package/build/src/mcp/help.js +26 -0
  314. package/build/src/mcp/index.d.ts +2 -0
  315. package/build/src/mcp/index.js +37 -0
  316. package/build/src/plugin/public.d.ts +1 -1
  317. package/build/src/plugin/runtime.js +17 -14
  318. package/build/src/protocol/arc.d.ts +4 -1
  319. package/build/src/protocol/arc.js +7 -1
  320. package/build/src/protocol/attempt.d.ts +2 -3
  321. package/build/src/protocol/attempt.js +1 -10
  322. package/build/src/protocol/bind.d.ts +6 -7
  323. package/build/src/protocol/bind.js +9 -5
  324. package/build/src/protocol/completion.d.ts +448 -12
  325. package/build/src/protocol/completion.js +164 -26
  326. package/build/src/protocol/deliver.d.ts +26 -24
  327. package/build/src/protocol/deliver.js +24 -52
  328. package/build/src/protocol/delivery-preview.d.ts +97 -247
  329. package/build/src/protocol/delivery-preview.js +132 -128
  330. package/build/src/protocol/execution-observation.d.ts +146 -123
  331. package/build/src/protocol/execution-observation.js +9 -6
  332. package/build/src/protocol/intent.d.ts +9 -48
  333. package/build/src/protocol/intent.js +32 -46
  334. package/build/src/protocol/operations.d.ts +207 -505
  335. package/build/src/protocol/operations.js +81 -134
  336. package/build/src/protocol/placement.d.ts +0 -1
  337. package/build/src/protocol/placement.js +5 -2
  338. package/build/src/protocol/progress.d.ts +7 -97
  339. package/build/src/protocol/progress.js +7 -55
  340. package/build/src/protocol/read/observation.d.ts +13 -6
  341. package/build/src/protocol/read/observation.js +10 -9
  342. package/build/src/protocol/read/status.d.ts +466 -95
  343. package/build/src/protocol/read/status.js +380 -91
  344. package/build/src/protocol/reconcile.d.ts +2 -0
  345. package/build/src/protocol/reconcile.js +12 -11
  346. package/build/src/protocol/reintegrate.d.ts +0 -1
  347. package/build/src/protocol/reintegrate.js +4 -4
  348. package/build/src/protocol/result-leaves.d.ts +528 -0
  349. package/build/src/protocol/result-leaves.js +195 -0
  350. package/build/src/protocol/result-reasons.d.ts +129 -0
  351. package/build/src/protocol/result-reasons.js +87 -0
  352. package/build/src/protocol/review.d.ts +14 -11
  353. package/build/src/protocol/review.js +30 -14
  354. package/build/src/protocol/run.d.ts +4 -4
  355. package/build/src/protocol/run.js +4 -1
  356. package/build/src/protocol/verify.d.ts +359 -30
  357. package/build/src/protocol/verify.js +118 -28
  358. package/build/src/region.d.ts +26 -0
  359. package/build/src/region.js +28 -0
  360. package/build/src/runtime/proc/diagnostic.d.ts +11 -0
  361. package/build/src/runtime/proc/diagnostic.js +20 -0
  362. package/build/src/runtime/proc/windows-launch.exe +0 -0
  363. package/build/src/settings.d.ts +126 -32
  364. package/build/src/settings.js +107 -34
  365. package/build/src/settlement/settle.d.ts +29 -12
  366. package/build/src/settlement/settle.js +22 -15
  367. package/build/src/verification/declaration.d.ts +1 -3
  368. package/build/src/verification/declaration.js +2 -5
  369. package/build/src/verification/execution.d.ts +7 -19
  370. package/build/src/verification/execution.js +37 -16
  371. package/build/src/verification/observation.d.ts +13 -13
  372. package/build/src/verification/observation.js +9 -7
  373. package/build/src/world.d.ts +8 -0
  374. package/build/src/world.js +7 -0
  375. package/package.json +6 -5
  376. package/plugins/paseo/plugin/server/keiyaku.ts +13 -46
  377. package/plugins/paseo/plugin/server/message.ts +8 -30
  378. package/plugins/paseo/plugin/server/mirror.ts +16 -20
  379. package/plugins/paseo/plugin/server/provider.ts +1 -1
  380. package/plugins/paseo/plugin/server/sdk.ts +14 -6
  381. package/plugins/pi/README.md +5 -5
  382. package/plugins/pi/akuma-tools.ts +17 -23
  383. package/skills/keiyaku/SKILL.md +24 -24
  384. package/skills/keiyaku-akuma/SKILL.md +44 -168
  385. package/skills/keiyaku-akuma/references/automation.md +61 -231
  386. package/skills/keiyaku-babysit/SKILL.md +47 -58
  387. package/skills/keiyaku-bind/SKILL.md +44 -185
  388. package/skills/keiyaku-debt/SKILL.md +40 -89
  389. package/skills/keiyaku-workflow/SKILL.md +56 -116
  390. package/build/src/cli/actor.d.ts +0 -10
  391. package/build/src/cli/actor.js +0 -24
  392. package/build/src/cli/akuma-caller.d.ts +0 -3
  393. package/build/src/cli/akuma-caller.js +0 -31
  394. package/build/src/cli/delivery-identity.d.ts +0 -3
  395. package/build/src/cli/render/effects.d.ts +0 -26
  396. package/build/src/cli/render/effects.js +0 -41
  397. package/build/src/cli/selectors.d.ts +0 -10
  398. package/build/src/cli/selectors.js +0 -42
  399. package/build/src/markdown/diff.d.ts +0 -1
  400. package/build/src/markdown/diff.js +0 -4
@@ -1,5 +1,8 @@
1
1
  /** @architectureCompositionRoot */
2
- import { observeStatusOutcome } from "../akuma/akuma-observe.js";
2
+ import { z } from "zod";
3
+ import { akumaIdSchema } from "../akuma/identity.js";
4
+ import { activityRowSchema, outcomeRowSchema, reportRowSchema } from "../akuma/projection.js";
5
+ import { projectStatusTimeline } from "../akuma/status-projection.js";
3
6
  import { withoutReportedChanges } from "../akuma/projection.js";
4
7
  import { AkumaNotBornError, AkumaObservationError } from "../akuma/akuma-errors.js";
5
8
  import { AkumaOwner } from "../akuma/akuma-owner.js";
@@ -15,13 +18,41 @@ import { outcomePluginObserver, stderrPluginDiagnostic, withAkumaWaitDeferrals }
15
18
  import { addressAkuma, addressAkumaSet } from "./address.js";
16
19
  import { requireInput } from "./input.js";
17
20
  import { scopeForRepo } from "./repo.js";
18
- function observationDiagnostic(error) {
19
- return error instanceof Error ? error.message : String(error);
20
- }
21
+ const historyCommon = { akumaId: akumaIdSchema };
22
+ export const akumaHistoryResultSchema = z.union([
23
+ z
24
+ .strictObject({
25
+ kind: z.literal("akuma"),
26
+ ...historyCommon,
27
+ events: z.array(activityRowSchema).readonly(),
28
+ omitted: z.number().int().positive().exactOptional(),
29
+ retentionLost: z.literal(true).exactOptional(),
30
+ lowestRetainedSequence: z.number().int().positive().exactOptional(),
31
+ highestSequence: z.number().int().positive().exactOptional(),
32
+ })
33
+ .readonly(),
34
+ z
35
+ .strictObject({
36
+ ...outcomeRowSchema.unwrap().omit({ kind: true }).shape,
37
+ kind: z.literal("akuma-exact"),
38
+ ...historyCommon,
39
+ })
40
+ .readonly(),
41
+ z
42
+ .strictObject({
43
+ ...reportRowSchema.unwrap().omit({ kind: true }).shape,
44
+ kind: z.literal("akuma-report"),
45
+ ...historyCommon,
46
+ })
47
+ .readonly(),
48
+ z.strictObject({ kind: z.literal("akuma-unknown-history"), ...historyCommon }).readonly(),
49
+ z.strictObject({ kind: z.literal("akuma-last"), ...historyCommon, answer: z.string() }).readonly(),
50
+ z.strictObject({ kind: z.literal("akuma-no-answer"), ...historyCommon }).readonly(),
51
+ ]);
21
52
  function observationError(id, error) {
22
53
  if (error instanceof AkumaNotBornError || error instanceof AkumaObservationError)
23
54
  return error;
24
- return new AkumaObservationError(id, observationDiagnostic(error));
55
+ return new AkumaObservationError(id, error instanceof Error ? error.message : String(error));
25
56
  }
26
57
  export async function dispatchAssociations(repo, ids) {
27
58
  return await observeDispatchAssociations(repo === undefined ? undefined : scopeForRepo(repo), ids);
@@ -55,32 +86,37 @@ function placementDischarged(repo) {
55
86
  return claimed;
56
87
  };
57
88
  }
58
- async function composeObservation(status, contract, discharged) {
59
- return (await discharged(contract)) ? { ...status, timeline: withoutReportedChanges(status.timeline) } : status;
60
- }
61
- async function createdDebtsFor(path, statuses) {
62
- return await observeCreatedDebtObservations(path, statuses.map((status) => status.id));
63
- }
64
89
  async function observeAkuma(status, path, repo) {
65
- return (await composeAkumaAssociations([status], path, repo))[0];
66
- }
67
- /**
68
- * The one upper composition of association-free native status evidence into its
69
- * public observation shape. It reads Alias-independent Dispatch and Debt
70
- * associations after the lower values, never before or inside them.
71
- */
72
- async function composeAkumaAssociations(statuses, path, repo) {
73
- const created = await createdDebtsFor(path, statuses);
74
- const discharged = placementDischarged(repo);
75
- const contracts = await dispatchAssociations(repo, statuses.map((status) => status.id));
76
- return await Promise.all(statuses.map(async (status, index) => {
77
- const contract = contracts.get(status.id);
78
- return {
79
- status: await composeObservation(status, contract, discharged),
80
- contract,
81
- createdDebts: created[index],
82
- };
83
- }));
90
+ const contract = (await dispatchAssociations(repo, [status.id])).get(status.id);
91
+ const createdDebts = (await observeCreatedDebtObservations(path, [status.id]))[0];
92
+ if (status.cwd === undefined || status.provider === undefined)
93
+ throw new Error(`Born Akuma ${status.id} lacks its frozen execution context`);
94
+ const composed = (await placementDischarged(repo)(contract))
95
+ ? { ...status, timeline: withoutReportedChanges(status.timeline) }
96
+ : status;
97
+ const changes = composed.timeline.reportedChanges;
98
+ return {
99
+ kind: "akuma",
100
+ id: status.id,
101
+ life: status.life,
102
+ cwd: status.cwd,
103
+ provider: status.provider,
104
+ ...(status.model === undefined ? {} : { model: status.model }),
105
+ timeline: projectStatusTimeline(composed.timeline),
106
+ ...(status.lastActivityAt === undefined ? {} : { lastActivityAt: status.lastActivityAt }),
107
+ ...(status.strandedReason === undefined ? {} : { strandedReason: status.strandedReason }),
108
+ ...(contract.kind === "none" ? {} : { contract }),
109
+ ...(createdDebts.kind === "failed"
110
+ ? { createdDebts }
111
+ : createdDebts.rows === undefined
112
+ ? {}
113
+ : { createdDebts: createdDebts.rows }),
114
+ ...(changes.length === 0 ? {} : { changes }),
115
+ ...(composed.timeline.reportedChangesOmitted === 0 ? {} : { moreChanges: true }),
116
+ ...(composed.timeline.reportedChangesOutside === undefined
117
+ ? {}
118
+ : { outsideChanges: composed.timeline.reportedChangesOutside }),
119
+ };
84
120
  }
85
121
  function timeout(value) {
86
122
  if (value === undefined)
@@ -97,19 +133,6 @@ function signal(value) {
97
133
  throw new TypeError("signal must be an AbortSignal");
98
134
  return value;
99
135
  }
100
- /**
101
- * Compose one wait's association-free native evidence into its public
102
- * observation shape, attaching the same upper associations as a single-status
103
- * observation.
104
- */
105
- async function composeWaitResult(path, repo, result) {
106
- return {
107
- mode: result.mode,
108
- reason: result.reason,
109
- observations: await composeAkumaAssociations(result.observations, path, repo),
110
- unobserved: result.unobserved,
111
- };
112
- }
113
136
  function directAddress(values) {
114
137
  return {
115
138
  path: values.path,
@@ -143,13 +166,15 @@ function completionMode(value) {
143
166
  }
144
167
  async function localWait(addressed, input) {
145
168
  try {
146
- return await composeWaitResult(addressed.path, input.repo, await executeWaitAkuma({
169
+ const native = await executeWaitAkuma({
147
170
  path: addressed.path,
148
171
  ids: addressed.orderedIds,
149
172
  completion: input.completion,
150
173
  ...(input.timeoutMs === undefined ? {} : { timeoutMs: input.timeoutMs }),
151
174
  ...(input.signal === undefined ? {} : { signal: input.signal }),
152
- }));
175
+ outcomeObserved: outcomePluginObserver({ world: addressed.path, reportDiagnostic: input.reportDiagnostic }),
176
+ });
177
+ return { kind: "akuma", reason: native.reason, results: native.results };
153
178
  }
154
179
  catch (error) {
155
180
  if (input.signal?.aborted === true || addressed.orderedIds.length !== 1)
@@ -166,23 +191,19 @@ export async function waitAkuma(input, reportDiagnostic = stderrPluginDiagnostic
166
191
  }
167
192
  if (Array.isArray(values.akuma) &&
168
193
  values.akuma.some((selector) => typeof selector === "string" && selector.startsWith("kei/"))) {
169
- throw new TypeError("Akumas.wait does not accept Contract selectors; use Keiyaku.with().wait");
194
+ throw new TypeError("Akumas.wait does not accept Contract selectors; use Keis.wait");
170
195
  }
171
196
  const selected = completionMode(values.completion);
172
197
  const timeoutMs = timeout(values.timeoutMs);
173
198
  const callerSignal = signal(values.signal);
174
- const repo = values.repo;
175
199
  const addressed = await addressAkumaSet(setAddress(values));
176
200
  return await withAkumaWaitDeferrals({ world: addressed.path, reportDiagnostic }, { akumaIds: addressed.orderedIds }, callerSignal, async () => {
177
- const result = await localWait(addressed, {
201
+ return await localWait(addressed, {
178
202
  completion: selected,
203
+ reportDiagnostic,
179
204
  ...(timeoutMs === undefined ? {} : { timeoutMs }),
180
205
  ...(callerSignal === undefined ? {} : { signal: callerSignal }),
181
- ...(repo === undefined ? {} : { repo }),
182
206
  });
183
- const observer = outcomePluginObserver({ world: addressed.path, reportDiagnostic });
184
- await Promise.all(result.observations.map(({ status }) => observeStatusOutcome(status, observer)));
185
- return result;
186
207
  });
187
208
  }
188
209
  export async function killAkuma(input, spawn) {
@@ -263,9 +284,7 @@ export async function askAkuma(input, spawn, reportDiagnostic = stderrPluginDiag
263
284
  ...(input.observe === undefined ? {} : { onObserve: input.observe }),
264
285
  ...(callerSignal === undefined ? {} : { signal: callerSignal }),
265
286
  });
266
- return (input.schema === undefined
267
- ? result
268
- : { ...result, observation: decodeAskObservation(result.observation, input.schema) });
287
+ return (input.schema === undefined ? result : decodeAskObservation(result, input.schema));
269
288
  });
270
289
  }
271
290
  function validateHistoryInput(values) {
@@ -283,18 +302,29 @@ function validateHistoryInput(values) {
283
302
  (values.last === true || values.before !== undefined || values.since !== undefined || values.limit !== undefined))
284
303
  throw new TypeError("id cannot be combined with last, before, since, or limit");
285
304
  }
305
+ function historyPage(subject, page) {
306
+ return {
307
+ kind: "akuma",
308
+ ...subject,
309
+ events: page.rows,
310
+ ...(page.omitted === 0 ? {} : { omitted: page.omitted }),
311
+ ...(page.historyLost ? { retentionLost: true } : {}),
312
+ ...(page.lowestRetained === null ? {} : { lowestRetainedSequence: page.lowestRetained }),
313
+ ...(page.highest === null ? {} : { highestSequence: page.highest }),
314
+ };
315
+ }
286
316
  export async function historyAkuma(input, reportDiagnostic = stderrPluginDiagnostic) {
287
317
  const values = requireInput(input, "Akumas.history input");
288
318
  validateHistoryInput(values);
289
319
  const addressed = await addressAkuma(directAddress(values));
290
320
  try {
291
321
  const handle = new AkumaOwner(addressed.id, addressed.path, outcomePluginObserver({ world: addressed.path, reportDiagnostic }));
292
- const contract = (await dispatchAssociations(values.repo, [addressed.id])).get(addressed.id);
322
+ const subject = { akumaId: addressed.id };
293
323
  if (values.last === true) {
294
324
  const answer = await handle.lastAnswer();
295
325
  return answer.kind === "answer"
296
- ? { kind: "last", id: addressed.id, answer: answer.answer, contract }
297
- : { kind: "no-answer", id: addressed.id, contract };
326
+ ? { kind: "akuma-last", ...subject, answer: answer.answer }
327
+ : { kind: "akuma-no-answer", ...subject };
298
328
  }
299
329
  const history = await handle.history({
300
330
  ...(values.id === undefined ? {} : { id: values.id }),
@@ -303,13 +333,18 @@ export async function historyAkuma(input, reportDiagnostic = stderrPluginDiagnos
303
333
  ...(values.limit === undefined ? {} : { limit: values.limit }),
304
334
  });
305
335
  if (values.id !== undefined) {
306
- if ("kind" in history && history.kind === "exact")
307
- return { kind: "exact", id: addressed.id, outcome: history.outcome, contract };
308
- if ("kind" in history && history.kind === "exact-report")
309
- return { kind: "exact-report", id: addressed.id, report: history.report, contract };
310
- return { kind: "unknown-history", id: addressed.id, historyId: values.id, contract };
336
+ if ("kind" in history && history.kind === "exact") {
337
+ const { kind: _kind, ...row } = history.outcome;
338
+ return { kind: "akuma-exact", ...subject, ...row };
339
+ }
340
+ if ("kind" in history && history.kind === "exact-report") {
341
+ const { kind: _kind, ...row } = history.report;
342
+ return { kind: "akuma-report", ...subject, ...row };
343
+ }
344
+ return { kind: "akuma-unknown-history", ...subject };
311
345
  }
312
- return { kind: "history", id: addressed.id, history: history, contract };
346
+ const page = history;
347
+ return historyPage(subject, page);
313
348
  }
314
349
  catch (error) {
315
350
  throw observationError(addressed.id, error);
@@ -0,0 +1,11 @@
1
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
+ type McpAdapterInput = Readonly<{
3
+ cwd: string;
4
+ environment: Readonly<Record<string, string | undefined>>;
5
+ version: string;
6
+ }>;
7
+ export declare function createKeiyakuMcpServer(input: McpAdapterInput): Readonly<{
8
+ server: Server;
9
+ close(): Promise<void>;
10
+ }>;
11
+ export {};
@@ -0,0 +1,106 @@
1
+ import { resolve } from "node:path";
2
+ import { z } from "zod";
3
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
4
+ import { CallToolRequestSchema, ListToolsRequestSchema, McpError, ErrorCode, } from "@modelcontextprotocol/sdk/types.js";
5
+ import { Keiyaku, KeiyakuUsageError } from "../library/keiyaku.js";
6
+ import { classifyVerb, } from "../library/keiyaku-verbs.js";
7
+ import { projectFailure } from "../library/outcome.js";
8
+ import { renderVerb } from "../cli/render/verbs.js";
9
+ import { DEFAULT_CLI_COLUMNS } from "../cli/render/terminal.js";
10
+ function describeTools() {
11
+ return Object.entries(Keiyaku.verbs).map(([name, entry]) => {
12
+ const schema = z.toJSONSchema(z.object({ cwd: z.string().min(1).optional(), repo: z.string().min(1).optional(), input: entry.input }).strict(), { io: "input" });
13
+ const output = z.toJSONSchema(entry.output, { io: "input" });
14
+ return {
15
+ name,
16
+ description: entry.description,
17
+ inputSchema: schema,
18
+ ...(output.type === "object" ? { outputSchema: output } : {}),
19
+ annotations: { readOnlyHint: entry.effect === "read", destructiveHint: entry.effect !== "read" },
20
+ };
21
+ });
22
+ }
23
+ function validateArguments(args) {
24
+ if (args === undefined ||
25
+ !Object.hasOwn(args, "input") ||
26
+ Object.keys(args).some((key) => !["cwd", "repo", "input"].includes(key)) ||
27
+ (args.cwd !== undefined && (typeof args.cwd !== "string" || !args.cwd.trim())) ||
28
+ (args.repo !== undefined && (typeof args.repo !== "string" || !args.repo.trim()))) {
29
+ throw new KeiyakuUsageError("expected input and optional nonblank cwd and repo");
30
+ }
31
+ }
32
+ export function createKeiyakuMcpServer(input) {
33
+ const cwd = input.cwd;
34
+ const environment = { ...input.environment };
35
+ const home = environment.KEIYAKU_HOME?.trim() || undefined;
36
+ const server = new Server({ name: "keiyaku", version: input.version }, { capabilities: { tools: {} } });
37
+ const tools = describeTools();
38
+ const pending = new Set();
39
+ let closing;
40
+ server.setRequestHandler(ListToolsRequestSchema, () => ({ tools }));
41
+ server.setRequestHandler(CallToolRequestSchema, (request, extra) => {
42
+ const name = request.params.name;
43
+ if (!Object.hasOwn(Keiyaku.verbs, name))
44
+ throw new McpError(ErrorCode.InvalidParams, `Unknown tool: ${name}`);
45
+ const operation = call(name, request.params.arguments, extra.signal);
46
+ pending.add(operation);
47
+ void operation.then(() => pending.delete(operation), () => pending.delete(operation));
48
+ return operation;
49
+ });
50
+ async function call(name, args, signal) {
51
+ const value = args?.input;
52
+ let completion;
53
+ try {
54
+ validateArguments(args);
55
+ const facet = Keiyaku.at({
56
+ cwd: resolve(cwd, args.cwd ?? "."),
57
+ environment,
58
+ ...(args.repo === undefined ? {} : { repo: args.repo }),
59
+ ...(home === undefined ? {} : { home }),
60
+ });
61
+ completion = { kind: "returned", value: await facet.run(name, value, { signal }) };
62
+ }
63
+ catch (error) {
64
+ completion = { kind: "threw", error };
65
+ }
66
+ try {
67
+ const disposition = classifyVerb(name, value, completion);
68
+ const text = renderVerb(name, value, completion, {
69
+ columns: DEFAULT_CLI_COLUMNS,
70
+ color: false,
71
+ now: Date.now(),
72
+ ...(name === "report" && environment.KEIYAKU_ACTOR_ID !== undefined
73
+ ? { actor: environment.KEIYAKU_ACTOR_ID }
74
+ : {}),
75
+ });
76
+ const projected = completion.kind === "threw" ? projectFailure(completion.error) : JSON.parse(JSON.stringify(completion.value));
77
+ return {
78
+ content: [
79
+ { type: "text", text },
80
+ ...(completion.kind === "threw" ? [{ type: "text", text: JSON.stringify(projected) }] : []),
81
+ ],
82
+ isError: disposition !== "accepted",
83
+ _meta: { "keiyaku/disposition": disposition },
84
+ ...(completion.kind === "returned" &&
85
+ typeof projected === "object" &&
86
+ projected !== null &&
87
+ !Array.isArray(projected)
88
+ ? { structuredContent: projected }
89
+ : {}),
90
+ };
91
+ }
92
+ catch (error) {
93
+ console.error("keiyaku-mcp: failed to project result", error);
94
+ throw error;
95
+ }
96
+ }
97
+ return {
98
+ server,
99
+ close() {
100
+ return (closing ??= (async () => {
101
+ await server.close();
102
+ await Promise.allSettled([...pending]);
103
+ })());
104
+ },
105
+ };
106
+ }
@@ -0,0 +1 @@
1
+ export declare const MCP_HELP = "keiyaku-mcp \u2014 standalone Keiyaku MCP server over stdio\n\nusage keiyaku-mcp [--help]\n\nEach tool accepts { cwd?, repo?, input }. Input is required, even when empty.\nRelative cwd is resolved from the server startup directory. Tool results share\nKeiyaku's CLI text and native JSON facts.\n\nPi has built-in MCP. Add a server to ~/.pi/agent/mcp.json or the project's\n.pi/mcp.json, for example:\n\n{\n \"mcpServers\": {\n \"keiyaku\": {\n \"command\": \"keiyaku-mcp\",\n \"exposure\": \"direct\",\n \"timeout\": 600\n }\n }\n}\n\nExposure applies to the whole server; direct exposes every tool. The example's\n600-second client request timeout is independent of Keiyaku timeoutMs. Long\nask, wait, or verify calls may need a larger client timeout. Reload Pi after\nchanging configuration. This command never changes configuration.\n";
@@ -0,0 +1,26 @@
1
+ export const MCP_HELP = `keiyaku-mcp — standalone Keiyaku MCP server over stdio
2
+
3
+ usage keiyaku-mcp [--help]
4
+
5
+ Each tool accepts { cwd?, repo?, input }. Input is required, even when empty.
6
+ Relative cwd is resolved from the server startup directory. Tool results share
7
+ Keiyaku's CLI text and native JSON facts.
8
+
9
+ Pi has built-in MCP. Add a server to ~/.pi/agent/mcp.json or the project's
10
+ .pi/mcp.json, for example:
11
+
12
+ {
13
+ "mcpServers": {
14
+ "keiyaku": {
15
+ "command": "keiyaku-mcp",
16
+ "exposure": "direct",
17
+ "timeout": 600
18
+ }
19
+ }
20
+ }
21
+
22
+ Exposure applies to the whole server; direct exposes every tool. The example's
23
+ 600-second client request timeout is independent of Keiyaku timeoutMs. Long
24
+ ask, wait, or verify calls may need a larger client timeout. Reload Pi after
25
+ changing configuration. This command never changes configuration.
26
+ `;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
+ import { installedPackageVersion } from "../cli/version.js";
4
+ import { createKeiyakuMcpServer } from "./adapter.js";
5
+ import { MCP_HELP } from "./help.js";
6
+ const args = process.argv.slice(2);
7
+ if (args.length === 1 && (args[0] === "--help" || args[0] === "-h")) {
8
+ process.stdout.write(MCP_HELP);
9
+ }
10
+ else if (args.length !== 0) {
11
+ process.stderr.write("usage: keiyaku-mcp [--help]\n");
12
+ process.exitCode = 64;
13
+ }
14
+ else {
15
+ const cwd = process.cwd();
16
+ const environment = { ...process.env };
17
+ try {
18
+ const adapter = createKeiyakuMcpServer({ cwd, environment, version: await installedPackageVersion() });
19
+ const shutdown = () => {
20
+ process.stdin.off("end", shutdown);
21
+ process.off("SIGINT", shutdown);
22
+ process.off("SIGTERM", shutdown);
23
+ void adapter.close().catch((error) => {
24
+ console.error("keiyaku-mcp: shutdown failed", error);
25
+ process.exitCode = 1;
26
+ });
27
+ };
28
+ process.stdin.once("end", shutdown);
29
+ process.once("SIGINT", shutdown);
30
+ process.once("SIGTERM", shutdown);
31
+ await adapter.server.connect(new StdioServerTransport());
32
+ }
33
+ catch (error) {
34
+ console.error("keiyaku-mcp: startup failed", error);
35
+ process.exitCode = 1;
36
+ }
37
+ }
@@ -27,7 +27,7 @@ export type PluginAkumaOrigin = Readonly<{
27
27
  export type PluginAkumaCaller = Readonly<{
28
28
  kind: "akuma";
29
29
  world: string;
30
- akuId: string;
30
+ akumaId: string;
31
31
  }> | Readonly<{
32
32
  kind: "external";
33
33
  integration: string;
@@ -65,51 +65,54 @@ async function settleBefore(promise, cancellation) {
65
65
  cancellation.removeEventListener("abort", releaseAbort);
66
66
  }
67
67
  }
68
- function selectedEntry(entry, report) {
69
- if (entry.name.trim().length === 0) {
68
+ function selectedEntry(name, entry, report) {
69
+ if (name.trim().length === 0) {
70
70
  reportPluginDiagnostic(report, "<unnamed>", "selection", new TypeError("plugin setting name must be nonblank"));
71
71
  return null;
72
72
  }
73
73
  if (!object(entry.value)) {
74
- reportPluginDiagnostic(report, entry.name, "selection", new TypeError("plugin setting must be an object"));
74
+ reportPluginDiagnostic(report, name, "selection", new TypeError("plugin setting must be an object"));
75
75
  return null;
76
76
  }
77
77
  const names = Object.keys(entry.value);
78
78
  if (!names.includes("package") || names.some((name) => !["package", "enabled", "config"].includes(name))) {
79
- reportPluginDiagnostic(report, entry.name, "selection", new TypeError("plugin setting has unknown or missing fields"));
79
+ reportPluginDiagnostic(report, name, "selection", new TypeError("plugin setting has unknown or missing fields"));
80
80
  return null;
81
81
  }
82
82
  const packageName = entry.value.package;
83
83
  if (typeof packageName !== "string" || packageName.trim().length === 0) {
84
- reportPluginDiagnostic(report, entry.name, "selection", new TypeError("plugin package must be a nonblank string"));
84
+ reportPluginDiagnostic(report, name, "selection", new TypeError("plugin package must be a nonblank string"));
85
85
  return null;
86
86
  }
87
87
  if (packageName !== packageName.trim()) {
88
- reportPluginDiagnostic(report, entry.name, "selection", new TypeError("plugin package must not have surrounding whitespace"));
88
+ reportPluginDiagnostic(report, name, "selection", new TypeError("plugin package must not have surrounding whitespace"));
89
89
  return null;
90
90
  }
91
91
  const enabled = entry.value.enabled;
92
92
  if (enabled !== undefined && typeof enabled !== "boolean") {
93
- reportPluginDiagnostic(report, entry.name, "selection", new TypeError("plugin enabled must be a boolean"));
93
+ reportPluginDiagnostic(report, name, "selection", new TypeError("plugin enabled must be a boolean"));
94
94
  return null;
95
95
  }
96
96
  if (enabled === false)
97
97
  return null;
98
- return Object.freeze({ id: entry.name, package: packageName, config: entry.value.config });
98
+ return Object.freeze({ id: name, package: packageName, config: entry.value.config });
99
99
  }
100
100
  function selectedPlugins(input, report) {
101
101
  const view = input.namespace(PLUGIN_NAMESPACE);
102
102
  if (view.kind === "failed") {
103
- for (const failure of view.failures)
104
- reportPluginDiagnostic(report, "settings", failure.scope, failure.diagnostic);
103
+ for (const failure of view.failures) {
104
+ const scope = input.scopes[failure.scope];
105
+ reportPluginDiagnostic(report, "settings", failure.scope, failure.diagnostic ?? (scope.kind === "failed" ? scope.diagnostic : "namespace unavailable"));
106
+ }
105
107
  return BUILTIN_PLUGINS;
106
108
  }
107
- if (view.entries.length === 0)
109
+ const entries = Object.entries(view.entries ?? {});
110
+ if (entries.length === 0)
108
111
  return BUILTIN_PLUGINS;
109
- const configured = new Map(view.entries
110
- .map((entry) => [entry.name, selectedEntry(entry, report)])
112
+ const configured = new Map(entries
113
+ .map(([name, entry]) => [name, selectedEntry(name, entry, report)])
111
114
  .filter((entry) => entry[1] !== null));
112
- const disabled = new Set(view.entries.filter((entry) => object(entry.value) && entry.value.enabled === false).map((entry) => entry.name));
115
+ const disabled = new Set(entries.filter(([, entry]) => object(entry.value) && entry.value.enabled === false).map(([name]) => name));
113
116
  const selected = [
114
117
  ...BUILTIN_PLUGINS.filter((entry) => !configured.has(entry.id) && !disabled.has(entry.id)),
115
118
  ...configured.values(),
@@ -5,4 +5,7 @@ export declare function arcOperation(input: MutationOperationInput & Readonly<{
5
5
  title: string;
6
6
  body: string;
7
7
  }>;
8
- }>): Promise<IntentOutcome<void, ActiveContractRefusal>>;
8
+ }>): Promise<IntentOutcome<Readonly<{
9
+ chapter: number;
10
+ title: string;
11
+ }>, ActiveContractRefusal>>;
@@ -1,5 +1,11 @@
1
1
  import { decideArc } from "../core/verbs/arc.js";
2
2
  import { admitVoidIntent } from "./operations.js";
3
3
  export async function arcOperation(input) {
4
- return admitVoidIntent(input, { data: input.chapter }, decideArc);
4
+ const result = await admitVoidIntent(input, { data: input.chapter }, decideArc);
5
+ if (result.kind !== "accepted")
6
+ return result;
7
+ const arc = result.facts.find((fact) => fact.kind === "arc" && fact.contract === input.contractId);
8
+ if (arc?.kind !== "arc")
9
+ throw new Error("arc receipt requires its admitted sequence");
10
+ return { ...result, value: { chapter: arc.data.seq, title: input.chapter.title } };
5
11
  }
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ export { entryUlidSchema } from "./result-leaves.js";
2
2
  import type { ProtocolProgress } from "./progress.js";
3
3
  import { type PublicationFailed } from "../git/admission.js";
4
4
  import { type GitDecisionObservation } from "../git/observe.js";
@@ -8,8 +8,7 @@ import { type GitRefAssertion } from "../git/repository.js";
8
8
  import type { GitRepository } from "../git/process.js";
9
9
  import type { AttemptContext } from "../core/decide.js";
10
10
  import type { Offer } from "../core/facts/offer.js";
11
- import { type ContractId, type ContractState, type EntryUlid, type JournalEntry } from "../core/facts/types.js";
12
- export declare const entryUlidSchema: z.ZodPipe<z.ZodString, z.ZodTransform<EntryUlid, string>>;
11
+ import { type ContractId, type ContractState, type JournalEntry } from "../core/facts/types.js";
13
12
  export declare function mintAttempts(input: Readonly<{
14
13
  entryCount: number;
15
14
  }>): readonly AttemptContext[];
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ export { entryUlidSchema } from "./result-leaves.js";
2
2
  import { randomBytes } from "node:crypto";
3
3
  import { encodeEntry } from "../core/facts/codec.js";
4
4
  import { admit } from "../git/admission.js";
@@ -10,15 +10,6 @@ import { targetRef } from "../git/target.js";
10
10
  import { foldJournal } from "../core/facts/fold.js";
11
11
  import { AuthorityCorruptionError } from "../core/facts/errors.js";
12
12
  import { entryUlid, } from "../core/facts/types.js";
13
- export const entryUlidSchema = z.string().transform((value, context) => {
14
- try {
15
- return entryUlid(value);
16
- }
17
- catch {
18
- context.addIssue({ code: "custom", message: "invalid entryUlid" });
19
- return z.NEVER;
20
- }
21
- });
22
13
  const ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
23
14
  const MAX_SEMANTIC_ATTEMPTS = 3;
24
15
  function nextEntryUlid() {
@@ -10,13 +10,13 @@ import { type IntentOutcome } from "./outcome.js";
10
10
  import type { CompanionDecorator } from "./run.js";
11
11
  export type { BindRefusal } from "../core/verbs/bind.js";
12
12
  export type { BindTargetSelection };
13
- export declare const targetInputRefusalSchema: z.ZodUnion<readonly [z.ZodObject<{
13
+ export declare const targetInputRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
14
14
  kind: z.ZodEnum<{
15
- "target-missing": "target-missing";
16
15
  "unborn-head": "unborn-head";
16
+ "target-missing": "target-missing";
17
17
  "invalid-target": "invalid-target";
18
18
  }>;
19
- }, z.core.$strict>, z.ZodObject<{
19
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
20
20
  kind: z.ZodLiteral<"target-workspace-unavailable">;
21
21
  contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
22
22
  reason: z.ZodEnum<{
@@ -28,12 +28,11 @@ export declare const targetInputRefusalSchema: z.ZodUnion<readonly [z.ZodObject<
28
28
  uncommitted: "uncommitted";
29
29
  operation: "operation";
30
30
  }>;
31
- }, z.core.$strict>]>;
31
+ }, z.core.$strict>>]>;
32
32
  type TargetInputRefusal = z.infer<typeof targetInputRefusalSchema>;
33
- export declare const forkSourceMovedRefusalSchema: z.ZodObject<{
33
+ export declare const forkSourceMovedRefusalSchema: z.ZodReadonly<z.ZodObject<{
34
34
  kind: z.ZodLiteral<"fork-source-moved">;
35
- contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
36
- }, z.core.$strict>;
35
+ }, z.core.$strict>>;
37
36
  type ForkSourceMovedRefusal = z.infer<typeof forkSourceMovedRefusalSchema>;
38
37
  type BindOperationInput = Readonly<{
39
38
  scope: GitRepository;