@astrosheep/keiyaku 4.6.31 → 4.6.33

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 (384) hide show
  1. package/README.md +42 -23
  2. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +24 -15
  3. package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +12 -8
  4. package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +4 -3
  5. package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +17 -17
  6. package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +6 -4
  7. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +24 -15
  8. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +12 -8
  9. package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +4 -3
  10. package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +17 -17
  11. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +6 -4
  12. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +24 -15
  13. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +12 -8
  14. package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +4 -3
  15. package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +17 -17
  16. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +6 -4
  17. package/build/plugins/pi/README.md +53 -97
  18. package/build/plugins/pi/keiyaku.ts +10 -6
  19. package/build/skills/keiyaku-akuma/SKILL.md +24 -15
  20. package/build/skills/keiyaku-babysit/SKILL.md +12 -8
  21. package/build/skills/keiyaku-bind/SKILL.md +4 -3
  22. package/build/skills/keiyaku-debt/SKILL.md +17 -17
  23. package/build/skills/keiyaku-workflow/SKILL.md +6 -4
  24. package/build/src/akuma/akuma-call.d.ts +3 -5
  25. package/build/src/akuma/akuma-call.js +7 -10
  26. package/build/src/akuma/akuma-errors.d.ts +7 -4
  27. package/build/src/akuma/akuma-errors.js +16 -12
  28. package/build/src/akuma/akuma-instance.d.ts +50 -303
  29. package/build/src/akuma/akuma-instance.js +48 -49
  30. package/build/src/akuma/akuma-observe.d.ts +5 -4
  31. package/build/src/akuma/akuma-observe.js +74 -21
  32. package/build/src/akuma/akuma-owner.d.ts +14 -6
  33. package/build/src/akuma/akuma-owner.js +33 -27
  34. package/build/src/akuma/akuma-selection-execution.d.ts +97 -19
  35. package/build/src/akuma/akuma-selection-execution.js +79 -133
  36. package/build/src/akuma/akuma-wait.d.ts +43 -4
  37. package/build/src/akuma/akuma-wait.js +58 -29
  38. package/build/src/akuma/akuma.d.ts +58 -384
  39. package/build/src/akuma/akuma.js +8 -58
  40. package/build/src/akuma/archetype.d.ts +16 -19
  41. package/build/src/akuma/archetype.js +48 -49
  42. package/build/src/akuma/body.js +44 -44
  43. package/build/src/akuma/call-initial-tell.d.ts +4 -2
  44. package/build/src/akuma/call-initial-tell.js +9 -2
  45. package/build/src/akuma/call-input.d.ts +8 -1
  46. package/build/src/akuma/call-input.js +27 -18
  47. package/build/src/akuma/caller.js +2 -1
  48. package/build/src/akuma/detached-body.js +1 -1
  49. package/build/src/akuma/heart/activity-schema.d.ts +16 -0
  50. package/build/src/akuma/heart/activity-schema.js +7 -0
  51. package/build/src/akuma/heart/facts.d.ts +5 -4
  52. package/build/src/akuma/heart/facts.js +5 -5
  53. package/build/src/akuma/heart/index.d.ts +1 -1
  54. package/build/src/akuma/heart/index.js +9 -1
  55. package/build/src/akuma/heart/soul.js +20 -4
  56. package/build/src/akuma/heart/timeline.js +4 -4
  57. package/build/src/akuma/identity.d.ts +1 -1
  58. package/build/src/akuma/identity.js +9 -4
  59. package/build/src/akuma/index.d.ts +6 -7
  60. package/build/src/akuma/index.js +2 -3
  61. package/build/src/akuma/projection-read.d.ts +4 -2
  62. package/build/src/akuma/projection-read.js +21 -14
  63. package/build/src/akuma/projection.d.ts +97 -2
  64. package/build/src/akuma/projection.js +47 -47
  65. package/build/src/akuma/provider-recipe.js +3 -2
  66. package/build/src/akuma/provider.d.ts +2 -2
  67. package/build/src/akuma/provider.js +27 -20
  68. package/build/src/akuma/providers/acp/config.js +11 -10
  69. package/build/src/akuma/providers/acp/core.js +2 -5
  70. package/build/src/akuma/providers/acp/index.js +2 -1
  71. package/build/src/akuma/providers/codex-app-server/index.js +7 -1
  72. package/build/src/akuma/providers/grok-build/index.js +2 -1
  73. package/build/src/akuma/providers/index.d.ts +0 -1
  74. package/build/src/akuma/providers/index.js +0 -8
  75. package/build/src/akuma/providers/opencode-sdk/events.d.ts +2 -1
  76. package/build/src/akuma/providers/opencode-sdk/events.js +31 -1
  77. package/build/src/akuma/providers/paseo/index.js +7 -4
  78. package/build/src/akuma/providers/pi/index.js +4 -3
  79. package/build/src/akuma/publication.d.ts +1 -2
  80. package/build/src/akuma/publication.js +19 -16
  81. package/build/src/akuma/schema.d.ts +3 -49
  82. package/build/src/akuma/schema.js +6 -147
  83. package/build/src/akuma/selection-observation.d.ts +304 -240
  84. package/build/src/akuma/selection-observation.js +135 -70
  85. package/build/src/akuma/status-projection.d.ts +61 -284
  86. package/build/src/akuma/status-projection.js +216 -138
  87. package/build/src/akuma/turn-drive.js +21 -15
  88. package/build/src/body/amend.js +7 -18
  89. package/build/src/body/arc.js +3 -2
  90. package/build/src/body/criteria.js +4 -3
  91. package/build/src/body/decode.js +13 -2
  92. package/build/src/body/envelope.d.ts +5 -1
  93. package/build/src/body/envelope.js +6 -3
  94. package/build/src/body/region.d.ts +1 -3
  95. package/build/src/body/region.js +3 -8
  96. package/build/src/body/render.js +4 -6
  97. package/build/src/body-host.d.ts +4 -11
  98. package/build/src/body-host.js +5 -4
  99. package/build/src/bounded-list.js +2 -1
  100. package/build/src/cli/commands/akuma-grammar.d.ts +107 -66
  101. package/build/src/cli/commands/akuma-grammar.js +66 -104
  102. package/build/src/cli/commands/akuma.d.ts +7 -3
  103. package/build/src/cli/commands/akuma.js +49 -160
  104. package/build/src/cli/commands/contract-grammar.d.ts +4 -135
  105. package/build/src/cli/commands/contract-grammar.js +126 -223
  106. package/build/src/cli/commands/contract-help.d.ts +26 -22
  107. package/build/src/cli/commands/contract-help.js +52 -38
  108. package/build/src/cli/commands/contract.d.ts +6 -18
  109. package/build/src/cli/commands/contract.js +68 -272
  110. package/build/src/cli/commands/debt-grammar.d.ts +2 -4
  111. package/build/src/cli/commands/debt-grammar.js +23 -193
  112. package/build/src/cli/commands/debt.js +10 -87
  113. package/build/src/cli/commands/report.d.ts +2 -4
  114. package/build/src/cli/coordinates.d.ts +1 -1
  115. package/build/src/cli/coordinates.js +1 -1
  116. package/build/src/cli/main.js +9 -3
  117. package/build/src/cli/parse.d.ts +80 -3
  118. package/build/src/cli/parse.js +76 -19
  119. package/build/src/cli/render/akuma-activity.d.ts +18 -35
  120. package/build/src/cli/render/akuma-activity.js +141 -290
  121. package/build/src/cli/render/akuma.d.ts +2 -8
  122. package/build/src/cli/render/akuma.js +50 -65
  123. package/build/src/cli/render/catalog.d.ts +2 -5
  124. package/build/src/cli/render/catalog.js +3 -37
  125. package/build/src/cli/render/contract-history.js +3 -2
  126. package/build/src/cli/render/contract-observation.d.ts +2 -8
  127. package/build/src/cli/render/contract-observation.js +25 -4
  128. package/build/src/cli/render/contract-wait.d.ts +2 -2
  129. package/build/src/cli/render/contract-wait.js +13 -17
  130. package/build/src/cli/render/contract.d.ts +7 -9
  131. package/build/src/cli/render/contract.js +46 -72
  132. package/build/src/cli/render/debt.d.ts +3 -11
  133. package/build/src/cli/render/debt.js +17 -89
  134. package/build/src/cli/render/delivery-preview.js +4 -4
  135. package/build/src/cli/render/execution-progress.js +1 -3
  136. package/build/src/cli/render/kanshi-akuma.d.ts +5 -3
  137. package/build/src/cli/render/kanshi-akuma.js +23 -20
  138. package/build/src/cli/render/kanshi.d.ts +1 -3
  139. package/build/src/cli/render/kanshi.js +27 -56
  140. package/build/src/cli/render/receipt.d.ts +21 -12
  141. package/build/src/cli/render/receipt.js +78 -68
  142. package/build/src/cli/render/reconcile.js +2 -5
  143. package/build/src/cli/render/refusal.d.ts +4 -3
  144. package/build/src/cli/render/refusal.js +17 -22
  145. package/build/src/cli/render/settings.d.ts +1 -1
  146. package/build/src/cli/render/terminal.d.ts +11 -12
  147. package/build/src/cli/render/terminal.js +53 -44
  148. package/build/src/cli/render/verbs.d.ts +4 -1
  149. package/build/src/cli/render/verbs.js +88 -128
  150. package/build/src/cli/runtime.js +65 -70
  151. package/build/src/cli/streams.d.ts +2 -9
  152. package/build/src/cli/streams.js +8 -1
  153. package/build/src/cli/usage.d.ts +2 -1
  154. package/build/src/cli/usage.js +3 -2
  155. package/build/src/contract-worktree.js +2 -10
  156. package/build/src/core/facts/codec.js +16 -25
  157. package/build/src/core/facts/eligibility.d.ts +4 -4
  158. package/build/src/core/facts/eligibility.js +11 -0
  159. package/build/src/core/facts/errors.d.ts +2 -1
  160. package/build/src/core/facts/errors.js +3 -3
  161. package/build/src/core/facts/fold.js +9 -5
  162. package/build/src/core/facts/gate.d.ts +5 -1
  163. package/build/src/core/facts/gate.js +14 -10
  164. package/build/src/core/facts/types.d.ts +7 -14
  165. package/build/src/core/facts/types.js +8 -6
  166. package/build/src/core/subject.d.ts +4 -1
  167. package/build/src/core/subject.js +10 -2
  168. package/build/src/core/verbs/abandon.d.ts +1 -2
  169. package/build/src/core/verbs/amend.d.ts +16 -6
  170. package/build/src/core/verbs/amend.js +19 -9
  171. package/build/src/core/verbs/arc.d.ts +1 -2
  172. package/build/src/core/verbs/attestation.d.ts +1 -2
  173. package/build/src/core/verbs/bind.d.ts +1 -2
  174. package/build/src/core/verbs/deliver.d.ts +1 -2
  175. package/build/src/core/verbs/placement.d.ts +1 -2
  176. package/build/src/core/verbs/reintegrate.d.ts +1 -2
  177. package/build/src/debt/board.d.ts +14 -94
  178. package/build/src/debt/board.js +25 -160
  179. package/build/src/debt/catalog.d.ts +0 -2
  180. package/build/src/debt/catalog.js +1 -22
  181. package/build/src/debt/document.d.ts +8 -11
  182. package/build/src/debt/document.js +19 -62
  183. package/build/src/debt/identity.d.ts +2 -14
  184. package/build/src/debt/identity.js +19 -49
  185. package/build/src/debt/index.d.ts +81 -220
  186. package/build/src/debt/index.js +61 -115
  187. package/build/src/debt/input.d.ts +21 -6
  188. package/build/src/debt/input.js +56 -180
  189. package/build/src/debt/lifecycle-operations.d.ts +1 -3
  190. package/build/src/debt/lifecycle-operations.js +1 -73
  191. package/build/src/debt/operation-types.d.ts +24 -128
  192. package/build/src/debt/operation-types.js +6 -62
  193. package/build/src/debt/operations.d.ts +8 -17
  194. package/build/src/debt/operations.js +58 -154
  195. package/build/src/debt/store.d.ts +0 -2
  196. package/build/src/debt/store.js +32 -87
  197. package/build/src/dispatch/index.d.ts +0 -17
  198. package/build/src/dispatch/index.js +1 -10
  199. package/build/src/errors.d.ts +28 -0
  200. package/build/src/errors.js +26 -0
  201. package/build/src/git/hooks.d.ts +1 -1
  202. package/build/src/git/identity.js +16 -45
  203. package/build/src/git/nuke.js +13 -23
  204. package/build/src/git/observe.d.ts +6 -0
  205. package/build/src/git/observe.js +40 -24
  206. package/build/src/git/process.js +11 -18
  207. package/build/src/git/read-observation.d.ts +5 -4
  208. package/build/src/git/reconcile.d.ts +3 -16
  209. package/build/src/git/reconcile.js +0 -18
  210. package/build/src/git/repository.d.ts +4 -1
  211. package/build/src/git/repository.js +16 -4
  212. package/build/src/git/scratch.js +2 -14
  213. package/build/src/git/target-placement.d.ts +4 -4
  214. package/build/src/git/target.d.ts +2 -2
  215. package/build/src/git/tender.d.ts +1 -2
  216. package/build/src/git/tender.js +5 -12
  217. package/build/src/git/terminal-reconcile.js +1 -13
  218. package/build/src/identity/coordinates.d.ts +1 -1
  219. package/build/src/identity/coordinates.js +3 -2
  220. package/build/src/identity/normalize.js +2 -1
  221. package/build/src/identity/selector.js +4 -3
  222. package/build/src/index.d.ts +36 -57
  223. package/build/src/index.js +11 -36
  224. package/build/src/kanshi/counts.d.ts +3 -8
  225. package/build/src/kanshi/counts.js +6 -14
  226. package/build/src/kanshi/index.d.ts +21 -7
  227. package/build/src/kanshi/index.js +29 -4
  228. package/build/src/kanshi/read.d.ts +101 -269
  229. package/build/src/kanshi/read.js +41 -200
  230. package/build/src/kanshi/report.d.ts +443 -1628
  231. package/build/src/kanshi/report.js +19 -31
  232. package/build/src/library/address.d.ts +20 -13
  233. package/build/src/library/address.js +48 -55
  234. package/build/src/library/akuma-creation.d.ts +249 -79
  235. package/build/src/library/akuma-creation.js +200 -247
  236. package/build/src/library/akumas.d.ts +24 -5
  237. package/build/src/library/akumas.js +96 -29
  238. package/build/src/library/bind.d.ts +7 -10
  239. package/build/src/library/bind.js +2 -8
  240. package/build/src/library/continuation.d.ts +151 -231
  241. package/build/src/library/continuation.js +22 -31
  242. package/build/src/library/contract-address.d.ts +6 -9
  243. package/build/src/library/contract-address.js +11 -16
  244. package/build/src/library/contract-composition.d.ts +2 -3
  245. package/build/src/library/contract-composition.js +12 -19
  246. package/build/src/library/contract-creation.js +35 -37
  247. package/build/src/library/contract-outcomes.d.ts +1349 -806
  248. package/build/src/library/contract-outcomes.js +12 -37
  249. package/build/src/library/contract-settings.d.ts +1 -2
  250. package/build/src/library/contract-settings.js +5 -7
  251. package/build/src/library/contract-types.d.ts +60 -67
  252. package/build/src/library/contract-types.js +17 -56
  253. package/build/src/library/contract-wait.d.ts +47 -3
  254. package/build/src/library/contract-wait.js +81 -70
  255. package/build/src/library/delivery.d.ts +391 -389
  256. package/build/src/library/delivery.js +5 -25
  257. package/build/src/library/input.d.ts +13 -5
  258. package/build/src/library/input.js +43 -38
  259. package/build/src/library/invocation.d.ts +13 -11
  260. package/build/src/library/invocation.js +69 -58
  261. package/build/src/library/kei.d.ts +16 -8
  262. package/build/src/library/kei.js +484 -25
  263. package/build/src/library/keiyaku-attribution.d.ts +0 -8
  264. package/build/src/library/keiyaku-attribution.js +0 -11
  265. package/build/src/library/keiyaku-classify.d.ts +2 -2
  266. package/build/src/library/keiyaku-classify.js +43 -62
  267. package/build/src/library/keiyaku-coordinates.d.ts +3 -8
  268. package/build/src/library/keiyaku-coordinates.js +6 -26
  269. package/build/src/library/keiyaku-debt.d.ts +21 -93
  270. package/build/src/library/keiyaku-debt.js +9 -159
  271. package/build/src/library/keiyaku-identity.d.ts +3 -3
  272. package/build/src/library/keiyaku-identity.js +16 -10
  273. package/build/src/library/keiyaku-verbs.d.ts +4102 -4889
  274. package/build/src/library/keiyaku-verbs.js +317 -291
  275. package/build/src/library/keiyaku-wait.d.ts +183 -0
  276. package/build/src/library/keiyaku-wait.js +213 -0
  277. package/build/src/library/keiyaku.d.ts +32 -860
  278. package/build/src/library/keiyaku.js +203 -314
  279. package/build/src/library/model-tools.d.ts +556 -0
  280. package/build/src/library/model-tools.js +347 -0
  281. package/build/src/library/nuke.d.ts +4 -2
  282. package/build/src/library/nuke.js +5 -1
  283. package/build/src/library/outcome.d.ts +424 -307
  284. package/build/src/library/outcome.js +166 -362
  285. package/build/src/library/reconcile.d.ts +331 -143
  286. package/build/src/library/reconcile.js +38 -72
  287. package/build/src/library/refusal.d.ts +45 -29
  288. package/build/src/library/refusal.js +5 -16
  289. package/build/src/library/repo.js +4 -3
  290. package/build/src/library/selection.d.ts +44 -21
  291. package/build/src/library/selection.js +63 -88
  292. package/build/src/mcp/adapter.js +37 -51
  293. package/build/src/mcp/description.d.ts +2 -0
  294. package/build/src/mcp/description.js +2 -0
  295. package/build/src/mcp/help.d.ts +1 -1
  296. package/build/src/mcp/help.js +16 -9
  297. package/build/src/pi/index.d.ts +3 -0
  298. package/build/src/pi/index.js +83 -0
  299. package/build/src/plugin/public.d.ts +4 -0
  300. package/build/src/plugin/runtime.d.ts +1 -1
  301. package/build/src/plugin/runtime.js +2 -2
  302. package/build/src/protocol/amend.d.ts +15 -4
  303. package/build/src/protocol/amend.js +114 -47
  304. package/build/src/protocol/bind.d.ts +5 -7
  305. package/build/src/protocol/bind.js +8 -19
  306. package/build/src/protocol/completion.d.ts +188 -195
  307. package/build/src/protocol/completion.js +63 -24
  308. package/build/src/protocol/deliver.d.ts +11 -6
  309. package/build/src/protocol/deliver.js +37 -50
  310. package/build/src/protocol/delivery-preview.d.ts +18 -11
  311. package/build/src/protocol/delivery-preview.js +2 -2
  312. package/build/src/protocol/execution-observation.d.ts +13 -13
  313. package/build/src/protocol/intent.d.ts +7 -9
  314. package/build/src/protocol/intent.js +22 -32
  315. package/build/src/protocol/operations.d.ts +102 -69
  316. package/build/src/protocol/operations.js +33 -56
  317. package/build/src/protocol/outcome.d.ts +3 -1
  318. package/build/src/protocol/placement.d.ts +1 -2
  319. package/build/src/protocol/placement.js +7 -1
  320. package/build/src/protocol/progress.d.ts +1 -0
  321. package/build/src/protocol/progress.js +0 -6
  322. package/build/src/protocol/read/status.d.ts +69 -112
  323. package/build/src/protocol/read/status.js +59 -88
  324. package/build/src/protocol/reintegrate.d.ts +1 -2
  325. package/build/src/protocol/reintegrate.js +2 -3
  326. package/build/src/protocol/result-leaves.d.ts +67 -40
  327. package/build/src/protocol/result-leaves.js +28 -58
  328. package/build/src/protocol/result-reasons.d.ts +6 -6
  329. package/build/src/protocol/review.js +0 -1
  330. package/build/src/protocol/run.js +1 -4
  331. package/build/src/protocol/verify.d.ts +202 -146
  332. package/build/src/protocol/verify.js +61 -47
  333. package/build/src/runtime/proc/windows-launch.exe +0 -0
  334. package/build/src/settings.d.ts +8 -9
  335. package/build/src/settings.js +16 -13
  336. package/build/src/settlement/holder.js +2 -2
  337. package/build/src/settlement/settle.d.ts +0 -6
  338. package/build/src/settlement/settle.js +19 -72
  339. package/build/src/verification/declaration.d.ts +3 -6
  340. package/build/src/verification/declaration.js +3 -5
  341. package/build/src/verification/observation.d.ts +2 -2
  342. package/build/src/world.d.ts +3 -2
  343. package/build/src/world.js +5 -6
  344. package/package.json +7 -3
  345. package/plugins/paseo/plugin/index.server.ts +1 -1
  346. package/plugins/paseo/plugin/server/attach.ts +74 -67
  347. package/plugins/paseo/plugin/server/keiyaku.ts +80 -14
  348. package/plugins/paseo/plugin/server/message.ts +2 -1
  349. package/plugins/paseo/plugin/server/mirror-identity.ts +6 -4
  350. package/plugins/paseo/plugin/server/sdk.ts +9 -11
  351. package/plugins/paseo/plugin/server/transport.ts +24 -1
  352. package/plugins/pi/README.md +53 -97
  353. package/plugins/pi/keiyaku.ts +10 -6
  354. package/skills/keiyaku-akuma/SKILL.md +24 -15
  355. package/skills/keiyaku-babysit/SKILL.md +12 -8
  356. package/skills/keiyaku-bind/SKILL.md +4 -3
  357. package/skills/keiyaku-debt/SKILL.md +17 -17
  358. package/skills/keiyaku-workflow/SKILL.md +6 -4
  359. package/build/plugins/pi/akuma-tools.ts +0 -290
  360. package/build/src/akuma/providers/codex-app-server/configuration.d.ts +0 -5
  361. package/build/src/akuma/providers/codex-app-server/configuration.js +0 -72
  362. package/build/src/body/keys.d.ts +0 -4
  363. package/build/src/body/keys.js +0 -11
  364. package/build/src/cli/commands/debt-query.d.ts +0 -5
  365. package/build/src/cli/commands/debt-query.js +0 -194
  366. package/build/src/cli/render/akuma-tool-command.d.ts +0 -6
  367. package/build/src/cli/render/akuma-tool-command.js +0 -143
  368. package/build/src/cli/render/akuma-tool.d.ts +0 -29
  369. package/build/src/cli/render/akuma-tool.js +0 -225
  370. package/build/src/debt/context.d.ts +0 -28
  371. package/build/src/debt/context.js +0 -102
  372. package/build/src/debt/created-observation.d.ts +0 -26
  373. package/build/src/debt/created-observation.js +0 -38
  374. package/build/src/debt/query.d.ts +0 -80
  375. package/build/src/debt/query.js +0 -283
  376. package/build/src/kanshi/roster.d.ts +0 -2
  377. package/build/src/kanshi/roster.js +0 -2
  378. package/build/src/library/contract-execution.d.ts +0 -28
  379. package/build/src/library/contract-execution.js +0 -506
  380. package/build/src/library/keiyaku-policy.d.ts +0 -27
  381. package/build/src/library/keiyaku-policy.js +0 -44
  382. package/build/src/library/keiyaku-status.d.ts +0 -1487
  383. package/build/src/library/keiyaku-status.js +0 -92
  384. package/plugins/pi/akuma-tools.ts +0 -290
@@ -7,14 +7,14 @@ import { prepareDelivery, deliveryIntegrationSnapshots } from "./deliver.js";
7
7
  import { verifyRequirement } from "./intent.js";
8
8
  import { timestamp, unpackVerificationOutcome } from "./operations.js";
9
9
  import { executionStop } from "./progress.js";
10
- import { compactPlacement, placementSchema } from "./completion.js";
10
+ import { placementSchema, normalPlacementSchema } from "./completion.js";
11
11
  import { activeReasonSchema, retrySchema, compactRetry, compactReason } from "./result-reasons.js";
12
12
  const checkCoordinate = {
13
13
  index: z.number().int().positive(),
14
14
  requirement: z.string().min(1),
15
15
  retainedPath: z.string().exactOptional(),
16
16
  };
17
- export const runtimeStopSchema = z.union([
17
+ const runtimeStopSchema = z.union([
18
18
  z
19
19
  .strictObject({ kind: z.enum(["unknown-exit", "cancelled"]), diagnostic: z.string().min(1).exactOptional() })
20
20
  .readonly(),
@@ -32,36 +32,58 @@ export const runtimeStopSchema = z.union([
32
32
  })
33
33
  .readonly(),
34
34
  ]);
35
- export const checkAdmissionStopSchema = z.union([
35
+ const checkAdmissionStopSchema = z
36
+ .union([
36
37
  z.strictObject({ kind: z.literal("refused"), reason: activeReasonSchema }).readonly(),
37
38
  ...retrySchema.options,
38
39
  z.strictObject({ kind: z.literal("cancelled") }).readonly(),
40
+ ])
41
+ .meta({ id: "verificationAdmissionStop" });
42
+ const normalAdmissionSchema = z.enum(["admitted", "reused", "unrecorded"]);
43
+ export function verificationAdmissionOutcome(admission) {
44
+ switch (admission) {
45
+ case "admitted":
46
+ case "reused":
47
+ case "unrecorded":
48
+ return "benign";
49
+ default:
50
+ switch (admission.kind) {
51
+ case "retry":
52
+ return "retry";
53
+ case "refused":
54
+ case "cancelled":
55
+ return "failed";
56
+ default: {
57
+ const exhaustive = admission;
58
+ return exhaustive;
59
+ }
60
+ }
61
+ }
62
+ }
63
+ function terminalCheckSchemas(admission) {
64
+ const terminal = { ...checkCoordinate, kind: z.literal("terminal"), admission };
65
+ return [
66
+ z.strictObject({ ...terminal, verdict: z.literal("satisfied") }).readonly(),
67
+ z.strictObject({ ...terminal, verdict: z.literal("unsatisfied"), summary: z.string() }).readonly(),
68
+ ];
69
+ }
70
+ const normalVerificationCheckSchema = z.union(terminalCheckSchemas(normalAdmissionSchema));
71
+ const verificationCheckSchema = z.union([
72
+ ...terminalCheckSchemas(z.union([normalAdmissionSchema, checkAdmissionStopSchema])),
73
+ z.strictObject({ ...checkCoordinate, kind: z.literal("stopped"), stop: runtimeStopSchema }).readonly(),
39
74
  ]);
40
- export const verificationStopSchema = z.union([runtimeStopSchema, checkAdmissionStopSchema]);
41
- const admission = z.union([z.literal("reused"), checkAdmissionStopSchema]).exactOptional();
42
- export const verificationCheckSchema = z.union([
43
- z
44
- .strictObject({ ...checkCoordinate, kind: z.literal("terminal"), verdict: z.literal("satisfied"), admission })
45
- .readonly(),
46
- z
75
+ function verifyValue(check, placement) {
76
+ return z
47
77
  .strictObject({
48
- ...checkCoordinate,
49
- kind: z.literal("terminal"),
50
- verdict: z.literal("unsatisfied"),
51
- summary: z.string(),
52
- admission,
78
+ snapshot: snapshotIdSchema,
79
+ checks: z.array(check).readonly(),
80
+ placement: placement.exactOptional(),
53
81
  })
54
- .readonly(),
55
- ...runtimeStopSchema.options.map((schema) => schema.unwrap().extend(checkCoordinate).readonly()),
56
- ]);
57
- export const verifyValueSchema = z
58
- .strictObject({
59
- snapshot: snapshotIdSchema,
60
- checks: z.array(verificationCheckSchema).readonly(),
61
- placement: placementSchema.exactOptional(),
62
- })
63
- .readonly();
64
- export function compactVerificationStop(stop) {
82
+ .readonly();
83
+ }
84
+ export const verifyNormalValueSchema = verifyValue(normalVerificationCheckSchema, normalPlacementSchema);
85
+ export const verifyValueSchema = verifyValue(verificationCheckSchema, placementSchema);
86
+ function compactVerificationStop(stop) {
65
87
  if ("refusal" in stop)
66
88
  return { kind: "refused", reason: compactReason(stop.refusal) };
67
89
  if ("retry" in stop)
@@ -81,14 +103,6 @@ export function compactVerificationStop(stop) {
81
103
  return { kind: stop.failure, diagnostic: stop.diagnostic };
82
104
  }
83
105
  }
84
- export function compactVerify(value) {
85
- const placement = compactPlacement(value);
86
- return {
87
- snapshot: value.snapshot,
88
- checks: value.checks,
89
- ...(placement === undefined ? {} : { placement }),
90
- };
91
- }
92
106
  async function prepareVerification(input) {
93
107
  input.signal?.throwIfAborted();
94
108
  const observed = await observeGitForAdmissionAt(input.scope, input.channel, [input.contractId]);
@@ -102,8 +116,6 @@ async function prepareVerification(input) {
102
116
  if (derivation.verification.kind === "refused")
103
117
  return { kind: "refused", refusal: derivation.verification.refusal };
104
118
  const definition = derivation.verification.data;
105
- if (definition === null)
106
- return { kind: "refused", refusal: { kind: "verification-not-selected" } };
107
119
  if (input.index !== undefined && input.index > definition.declarations.length)
108
120
  return {
109
121
  kind: "refused",
@@ -124,7 +136,6 @@ async function prepareVerification(input) {
124
136
  document: derivation.bytes,
125
137
  includeDirty: input.includeDirty,
126
138
  requireBranchesToBeUpToDate: input.requireBranchesToBeUpToDate,
127
- ...(input.actor === undefined ? {} : { actor: input.actor }),
128
139
  });
129
140
  if (prepared.kind === "refused")
130
141
  return prepared;
@@ -139,15 +150,13 @@ function checkReport(coordinate, checked) {
139
150
  const stop = compactVerificationStop(checked.stop);
140
151
  if (stop.kind === "refused" || stop.kind === "retry")
141
152
  throw new Error("nonterminal check requires a runtime stop");
142
- return { ...fields, ...stop };
153
+ return { ...fields, kind: "stopped", stop };
143
154
  }
144
- // A terminal verdict only proves admission when custody holds the matching attestation, reuse, or stop.
145
- const attested = checked.admission?.facts.some((fact) => fact.kind === "attestation" && fact.data.gate === VERIFIED && fact.data.requirement === requirement);
146
155
  let admission;
147
156
  if (checked.reuse !== undefined)
148
157
  admission = "reused";
149
- else if (attested === true)
150
- admission = undefined;
158
+ else if (checked.admission !== undefined)
159
+ admission = "admitted";
151
160
  else if (checked.stop !== undefined) {
152
161
  const stop = compactVerificationStop(checked.stop);
153
162
  if (stop.kind === "refused" || stop.kind === "retry")
@@ -158,15 +167,15 @@ function checkReport(coordinate, checked) {
158
167
  throw new Error("terminal check admission can only refuse, retry or cancel");
159
168
  }
160
169
  else
161
- throw new Error("terminal verification requires its admission conclusion");
162
- const terminal = { ...fields, kind: "terminal", ...(admission === undefined ? {} : { admission }) };
170
+ admission = "unrecorded";
171
+ const terminal = { ...fields, kind: "terminal", admission };
163
172
  if (checked.counts.verdict === "satisfied")
164
173
  return { ...terminal, verdict: "satisfied" };
165
174
  if (checked.counts.summary === undefined)
166
175
  throw new Error("unsatisfied terminal check requires its diagnosis");
167
176
  return { ...terminal, verdict: "unsatisfied", summary: checked.counts.summary };
168
177
  }
169
- /** Capture a prospective delivery without admitting a candidate, then independently attest each check. */
178
+ /** Capture a prospective delivery, then independently execute each selected declaration. */
170
179
  export async function verifyOperation(input) {
171
180
  const prepared = await prepareVerification(input);
172
181
  if (prepared.kind === "refused")
@@ -190,13 +199,14 @@ export async function verifyOperation(input) {
190
199
  channel: input.channel,
191
200
  repository: input.scope,
192
201
  contractId: state.id,
202
+ gates: state.terms.gates,
203
+ ...(state.targetRevision === undefined ? {} : { targetRevision: state.targetRevision }),
193
204
  at: timestamp(),
194
205
  snapshot,
195
206
  declaration,
196
207
  requirement,
197
208
  index,
198
209
  total: definition.declarations.length,
199
- ...(input.actor === undefined ? {} : { actor: input.actor }),
200
210
  ...(input.signal === undefined ? {} : { signal: input.signal }),
201
211
  ...(input.progress === undefined ? {} : { progress: input.progress }),
202
212
  });
@@ -214,5 +224,9 @@ export async function verifyOperation(input) {
214
224
  if (checked.stop !== undefined)
215
225
  break;
216
226
  }
217
- return { kind: "accepted", checkpoint, value: { snapshot, checks } };
227
+ return {
228
+ kind: "accepted",
229
+ ...(state.terms.gates.includes(VERIFIED) ? { checkpoint } : {}),
230
+ value: { snapshot, checks },
231
+ };
218
232
  }
@@ -1,15 +1,11 @@
1
+ import { KeiyakuError } from "./errors.js";
1
2
  import { z } from "zod";
2
3
  export type SettingsScope = "project" | "user";
3
4
  export type SettingsScopeState = z.output<typeof settingsScopeStateSchema>;
4
5
  export type SettingsEntry = z.output<typeof settingsEntrySchema>;
5
6
  export type SettingsNamespaceFailure = z.output<typeof settingsNamespaceFailureSchema>;
6
7
  export type SettingsNamespaceView = z.output<typeof settingsNamespaceViewSchema>;
7
- export type Settings = Readonly<{
8
- scopes: Readonly<{
9
- project: SettingsScopeState;
10
- user: SettingsScopeState;
11
- }>;
12
- namespaces?: Readonly<Record<string, SettingsNamespaceView>>;
8
+ export type Settings = z.output<typeof settingsSchema> & Readonly<{
13
9
  namespace(name: string): SettingsNamespaceView;
14
10
  }>;
15
11
  export declare const settingsScopeStateSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
@@ -132,14 +128,17 @@ export declare const settingsSchema: z.ZodReadonly<z.ZodObject<{
132
128
  }>>>>>;
133
129
  }, z.core.$strict>>;
134
130
  export type SettingsInput = Readonly<{
135
- root?: string;
131
+ cwd?: string;
136
132
  home?: string;
137
133
  }>;
138
- export declare class SettingsError extends Error {
134
+ export declare class SettingsError extends KeiyakuError {
139
135
  readonly kind = "settings";
140
136
  constructor(message: string);
141
137
  }
142
- export declare function settings(input?: SettingsInput): Promise<Settings>;
138
+ declare function loadSettings(input?: SettingsInput): Promise<Settings>;
139
+ export declare const Settings: Readonly<{
140
+ load: typeof loadSettings;
141
+ }>;
143
142
  /** Read only the project scope owned by a materialized candidate snapshot. */
144
143
  export declare function projectSettings(root: string): Promise<Settings>;
145
144
  export {};
@@ -1,3 +1,4 @@
1
+ import { KeiyakuError } from "./errors.js";
1
2
  import { z } from "zod";
2
3
  import { readFile, realpath } from "node:fs/promises";
3
4
  import { homedir } from "node:os";
@@ -60,11 +61,10 @@ export const settingsSchema = z
60
61
  namespaces: keyedValues(settingsNamespaceViewSchema).exactOptional(),
61
62
  })
62
63
  .readonly();
63
- export class SettingsError extends Error {
64
+ export class SettingsError extends KeiyakuError {
64
65
  kind = "settings";
65
66
  constructor(message) {
66
- super(message);
67
- this.name = "SettingsError";
67
+ super("invalid-input", message);
68
68
  }
69
69
  }
70
70
  function object(value) {
@@ -155,7 +155,7 @@ function settingsFromScopes(project, user) {
155
155
  }
156
156
  function namespace(name) {
157
157
  if (typeof name !== "string" || name.trim().length === 0)
158
- throw new TypeError("settings namespace must be nonblank");
158
+ throw new KeiyakuError("invalid-input", "settings namespace must be nonblank");
159
159
  return resolveNamespace(name);
160
160
  }
161
161
  const names = [...new Set([user, project].flatMap((scope) => Object.keys(scope.root ?? {})))].sort();
@@ -176,16 +176,18 @@ async function canonicalCoordinate(path) {
176
176
  return resolvedPath;
177
177
  }
178
178
  }
179
- export async function settings(input = {}) {
179
+ async function loadSettings(input = {}) {
180
180
  if (!object(input))
181
- throw new TypeError("settings input must be an object");
182
- if (input.root !== undefined && (typeof input.root !== "string" || input.root.trim().length === 0)) {
183
- throw new TypeError("settings root must be a nonblank string");
181
+ throw new KeiyakuError("invalid-input", "settings input must be an object");
182
+ for (const key of Object.keys(input))
183
+ if (key !== "cwd" && key !== "home")
184
+ throw new KeiyakuError("invalid-input", `settings input has unknown field: ${key}`);
185
+ for (const field of ["cwd", "home"]) {
186
+ const value = input[field];
187
+ if (value !== undefined && (typeof value !== "string" || value.trim().length === 0))
188
+ throw new KeiyakuError("invalid-input", `settings ${field} must be a nonblank string`);
184
189
  }
185
- if (input.home !== undefined && (typeof input.home !== "string" || input.home.trim().length === 0)) {
186
- throw new TypeError("settings home must be a nonblank string");
187
- }
188
- const projectDirectory = input.root === undefined ? undefined : await canonicalCoordinate(join(input.root, ".keiyaku"));
190
+ const projectDirectory = input.cwd === undefined ? undefined : await canonicalCoordinate(join(input.cwd, ".keiyaku"));
189
191
  const userDirectory = await canonicalCoordinate(input.home ?? join(homedir(), ".keiyaku"));
190
192
  const project = projectDirectory === undefined || projectDirectory === userDirectory
191
193
  ? { state: { kind: "absent" } }
@@ -193,10 +195,11 @@ export async function settings(input = {}) {
193
195
  const user = await readScope(join(userDirectory, "settings.json"));
194
196
  return settingsFromScopes(project, user);
195
197
  }
198
+ export const Settings = Object.freeze({ load: loadSettings });
196
199
  /** Read only the project scope owned by a materialized candidate snapshot. */
197
200
  export async function projectSettings(root) {
198
201
  if (typeof root !== "string" || root.trim().length === 0)
199
- throw new TypeError("settings root must be a nonblank string");
202
+ throw new KeiyakuError("invalid-input", "settings root must be a nonblank string");
200
203
  return settingsFromScopes(await readScope(join(resolve(root), ".keiyaku", "settings.json")), {
201
204
  state: { kind: "absent" },
202
205
  });
@@ -4,7 +4,7 @@ import { contractId } from "../core/facts/types.js";
4
4
  import { GIT_REF, updateGitTree, updateRefsAtomically, writeBlob, writeStateCommit } from "../git/repository.js";
5
5
  import { confirmPrivateStatePublication } from "../git/private-state-seat.js";
6
6
  import { withGitTargetedReadObservation, } from "../git/read-observation.js";
7
- import { parseDebtId } from "../debt/identity.js";
7
+ import { canonicalDebtId } from "../debt/identity.js";
8
8
  import { acquireDebtSettlementFence } from "./fence.js";
9
9
  // The private persisted spelling predates the product rename. Keep its bytes
10
10
  // and path stable so an existing held association still settles after upgrade.
@@ -58,7 +58,7 @@ function decodeHolder(path, bytes) {
58
58
  let owner;
59
59
  try {
60
60
  debtId = `debt/${record.taskId.slice("task/".length)}`;
61
- parseDebtId(debtId);
61
+ canonicalDebtId(debtId);
62
62
  owner = contractId(record.contractId);
63
63
  }
64
64
  catch (error) {
@@ -54,11 +54,5 @@ export type SettlementInput = Readonly<{
54
54
  effects: readonly Effect[];
55
55
  progress?: SettlementProgress;
56
56
  }>;
57
- export type SettlementBatchInput = Readonly<{
58
- repository: GitRepository;
59
- channel: GitDecodeChannel;
60
- contracts: readonly Readonly<Pick<SettlementInput, "state" | "effects">>[];
61
- }>;
62
57
  export declare function settle(input: SettlementInput): Promise<SettlementReport>;
63
- export declare function settleAll(input: SettlementBatchInput): Promise<readonly SettlementReport[]>;
64
58
  export {};
@@ -58,6 +58,15 @@ function recordAction(input, action) {
58
58
  input.actions.push(action);
59
59
  input.progress?.recordSettlement(input.candidate.id, { actions: [action], lags: [] });
60
60
  }
61
+ function settleFailure(candidate, surface, diagnostic, debtId) {
62
+ return {
63
+ kind: "settlement-failed",
64
+ surface,
65
+ contractId: candidate.id,
66
+ ...(debtId === undefined ? {} : { debtId }),
67
+ diagnostic,
68
+ };
69
+ }
61
70
  async function observeApplicableHolder(input) {
62
71
  const { repository, channel, candidate } = input;
63
72
  let observation;
@@ -72,12 +81,7 @@ async function observeApplicableHolder(input) {
72
81
  catch (error) {
73
82
  if (!operational(error))
74
83
  throw error;
75
- recordLag(input, {
76
- kind: "settlement-failed",
77
- surface: "debt-holder",
78
- contractId: candidate.id,
79
- diagnostic: diagnostic(error),
80
- });
84
+ recordLag(input, settleFailure(candidate, "debt-holder", diagnostic(error)));
81
85
  return null;
82
86
  }
83
87
  }
@@ -90,13 +94,7 @@ async function completeHeldDebt(input) {
90
94
  catch (error) {
91
95
  if (!operational(error))
92
96
  throw error;
93
- recordLag(input, {
94
- kind: "settlement-failed",
95
- surface: "debt",
96
- contractId: candidate.id,
97
- debtId,
98
- diagnostic: diagnostic(error),
99
- });
97
+ recordLag(input, settleFailure(candidate, "debt", diagnostic(error), debtId));
100
98
  return false;
101
99
  }
102
100
  let result;
@@ -106,35 +104,17 @@ async function completeHeldDebt(input) {
106
104
  catch (error) {
107
105
  if (!operational(error))
108
106
  throw error;
109
- recordLag(input, {
110
- kind: "settlement-failed",
111
- surface: "debt",
112
- contractId: candidate.id,
113
- debtId,
114
- diagnostic: diagnostic(error),
115
- });
107
+ recordLag(input, settleFailure(candidate, "debt", diagnostic(error), debtId));
116
108
  return false;
117
109
  }
118
110
  if (result.kind === "changed")
119
111
  recordAction(input, { kind: "debt", debtId, action: "done" });
120
112
  if (result.kind === "changed" && result.cleanup !== undefined) {
121
- recordLag(input, {
122
- kind: "settlement-failed",
123
- surface: "debt",
124
- contractId: candidate.id,
125
- debtId,
126
- diagnostic: result.cleanup,
127
- });
113
+ recordLag(input, settleFailure(candidate, "debt", result.cleanup, debtId));
128
114
  }
129
115
  if (result.kind === "changed" || result.kind === "unchanged")
130
116
  return true;
131
- recordLag(input, {
132
- kind: "settlement-failed",
133
- surface: "debt",
134
- contractId: candidate.id,
135
- debtId,
136
- diagnostic: debtFailure(result),
137
- });
117
+ recordLag(input, settleFailure(candidate, "debt", debtFailure(result), debtId));
138
118
  return false;
139
119
  }
140
120
  async function releaseHeldDebtHolder(input) {
@@ -150,13 +130,7 @@ async function releaseHeldDebtHolder(input) {
150
130
  return "inert";
151
131
  const publication = await publishDebtHolderRelease(repository, channel, observation, candidate.id, seat);
152
132
  if (publication.kind === "non-published") {
153
- recordLag(input, {
154
- kind: "settlement-failed",
155
- surface: "debt-holder",
156
- contractId: candidate.id,
157
- debtId,
158
- diagnostic: `Debt holder release requires retry: ${publication.diagnostic}`,
159
- });
133
+ recordLag(input, settleFailure(candidate, "debt-holder", `Debt holder release requires retry: ${publication.diagnostic}`, debtId));
160
134
  return "held";
161
135
  }
162
136
  return publication.kind === "released" ? "released" : "inert";
@@ -170,13 +144,7 @@ async function releaseHeldDebtHolder(input) {
170
144
  catch (error) {
171
145
  if (!operational(error))
172
146
  throw error;
173
- recordLag(input, {
174
- kind: "settlement-failed",
175
- surface: "debt-holder",
176
- contractId: candidate.id,
177
- debtId,
178
- diagnostic: diagnostic(error),
179
- });
147
+ recordLag(input, settleFailure(candidate, "debt-holder", diagnostic(error), debtId));
180
148
  return "held";
181
149
  }
182
150
  }
@@ -193,13 +161,7 @@ async function settleDebts(input) {
193
161
  catch (error) {
194
162
  if (!operational(error))
195
163
  throw error;
196
- recordLag(input, {
197
- kind: "settlement-failed",
198
- surface: "debt",
199
- contractId: candidate.id,
200
- debtId,
201
- diagnostic: diagnostic(error),
202
- });
164
+ recordLag(input, settleFailure(candidate, "debt", diagnostic(error), debtId));
203
165
  return true;
204
166
  }
205
167
  let failure;
@@ -240,13 +202,7 @@ async function settleDebts(input) {
240
202
  throw error;
241
203
  // Post-release fence teardown is custodial residue, not an owed holder publication.
242
204
  if (holderDisposition !== "released") {
243
- recordLag(input, {
244
- kind: "settlement-failed",
245
- surface: "debt-holder",
246
- contractId: candidate.id,
247
- debtId,
248
- diagnostic: diagnostic(error),
249
- });
205
+ recordLag(input, settleFailure(candidate, "debt-holder", diagnostic(error), debtId));
250
206
  }
251
207
  }
252
208
  }
@@ -278,12 +234,7 @@ async function settleObserved(input) {
278
234
  catch (error) {
279
235
  if (!operational(error))
280
236
  throw error;
281
- recordLag({ candidate, lags, ...(input.progress === undefined ? {} : { progress: input.progress }) }, {
282
- kind: "settlement-failed",
283
- surface: "debt",
284
- contractId: candidate.id,
285
- diagnostic: diagnostic(error),
286
- });
237
+ recordLag({ candidate, lags, ...(input.progress === undefined ? {} : { progress: input.progress }) }, settleFailure(candidate, "debt", diagnostic(error)));
287
238
  }
288
239
  }
289
240
  return settlementReport(actions, lags, seatClose);
@@ -295,7 +246,3 @@ export async function settle(input) {
295
246
  const repository = onPrimaryWorktree(input.repository);
296
247
  return await settleObserved({ ...input, repository });
297
248
  }
298
- export async function settleAll(input) {
299
- const repository = onPrimaryWorktree(input.repository);
300
- return await Promise.all(input.contracts.map((contract) => settleObserved({ repository, channel: input.channel, ...contract })));
301
- }
@@ -13,13 +13,10 @@ export type VerificationDefinition = Readonly<{
13
13
  export type VerificationDeclarationRefusal = Readonly<{
14
14
  kind: "verification-declaration-invalid";
15
15
  }>;
16
- export type VerificationDeclarationPreparation = Preparation<VerificationDefinition | null, VerificationDeclarationRefusal>;
17
- export declare const VERIFIED: Gate;
16
+ export type VerificationDeclarationPreparation = Preparation<VerificationDefinition, VerificationDeclarationRefusal>;
17
+ export declare const VERIFIED: string;
18
18
  /** The display index and surrounding document never participate in execution identity. */
19
19
  export declare function verificationRequirement(declaration: VerificationDeclaration): RequirementId;
20
20
  export declare function singletonRequirement(declaredGate: Gate): RequirementId;
21
21
  export declare function gateRequirements(gates: readonly Gate[], definition: VerificationDefinition | null): Readonly<Record<string, readonly RequirementId[]>>;
22
- export declare function prepareVerificationDeclaration(input: Readonly<{
23
- gates: readonly Gate[];
24
- definition: VerificationDefinition | null;
25
- }>): VerificationDeclarationPreparation;
22
+ export declare function prepareVerificationDeclaration(definition: VerificationDefinition | null): VerificationDeclarationPreparation;
@@ -17,11 +17,9 @@ export function gateRequirements(gates, definition) {
17
17
  : [singletonRequirement(declaredGate)],
18
18
  ]));
19
19
  }
20
- export function prepareVerificationDeclaration(input) {
21
- if (!input.gates.includes(VERIFIED))
22
- return { kind: "prepared", data: null };
23
- if (input.definition !== null && input.definition.declarations.length > 0)
24
- return { kind: "prepared", data: input.definition };
20
+ export function prepareVerificationDeclaration(definition) {
21
+ if (definition !== null && definition.declarations.length > 0)
22
+ return { kind: "prepared", data: definition };
25
23
  return {
26
24
  kind: "refused",
27
25
  refusal: { kind: "verification-declaration-invalid" },
@@ -7,8 +7,8 @@ export declare const verificationObservationSchema: z.ZodDiscriminatedUnion<[z.Z
7
7
  outcome: z.ZodExactOptional<z.ZodString>;
8
8
  elapsedMs: z.ZodExactOptional<z.ZodNumber>;
9
9
  phase: z.ZodEnum<{
10
- cleanup: "cleanup";
11
10
  materialize: "materialize";
11
+ cleanup: "cleanup";
12
12
  setup: "setup";
13
13
  declaration: "declaration";
14
14
  }>;
@@ -27,8 +27,8 @@ export declare const verificationObservationSchema: z.ZodDiscriminatedUnion<[z.Z
27
27
  }>;
28
28
  text: z.ZodString;
29
29
  phase: z.ZodEnum<{
30
- cleanup: "cleanup";
31
30
  materialize: "materialize";
31
+ cleanup: "cleanup";
32
32
  setup: "setup";
33
33
  declaration: "declaration";
34
34
  }>;
@@ -1,3 +1,4 @@
1
+ import { KeiyakuError } from "./errors.js";
1
2
  import { z } from "zod";
2
3
  declare const WORLD_BRAND: unique symbol;
3
4
  export type WorldRoot = string & {
@@ -19,11 +20,11 @@ export type WorldResolution = Readonly<{
19
20
  candidate: WorldRoot | null;
20
21
  establish: () => Promise<WorldRoot>;
21
22
  }>;
22
- export declare class WorldError extends Error {
23
+ export declare class WorldError extends KeiyakuError {
23
24
  readonly kind: "invalid-world";
24
25
  constructor(message: string);
25
26
  }
26
- type WorldInput = string | WorldResolutionInput;
27
+ export type WorldInput = string | WorldResolutionInput;
27
28
  export declare const World: Readonly<{
28
29
  resolve(input: WorldInput): Promise<WorldResolution>;
29
30
  locate(input: WorldInput): Promise<WorldRoot | null>;
@@ -1,3 +1,4 @@
1
+ import { KeiyakuError } from "./errors.js";
1
2
  import { z } from "zod";
2
3
  import { lstat, mkdir, realpath, stat } from "node:fs/promises";
3
4
  import { dirname, join, parse, resolve } from "node:path";
@@ -8,17 +9,15 @@ export const worldResolutionSchema = z
8
9
  .readonly();
9
10
  export const worldLocationSchema = worldRootSchema.nullable();
10
11
  export const worldEstablishedSchema = z.boolean();
11
- export class WorldError extends Error {
12
+ export class WorldError extends KeiyakuError {
12
13
  kind = "invalid-world";
13
14
  constructor(message) {
14
- super(message);
15
- this.name = "WorldError";
16
- this.kind = "invalid-world";
15
+ super("internal", message);
17
16
  }
18
17
  }
19
18
  async function directory(input, label) {
20
19
  if (typeof input !== "string" || input.trim().length === 0) {
21
- throw new TypeError(`${label} must be a nonblank path`);
20
+ throw new KeiyakuError("invalid-input", `${label} must be a nonblank path`);
22
21
  }
23
22
  const path = resolve(input);
24
23
  let real;
@@ -61,7 +60,7 @@ async function inputValues(input, label) {
61
60
  if (typeof input === "string")
62
61
  return { cwd: await directory(input, label) };
63
62
  if (input === null || typeof input !== "object")
64
- throw new TypeError(`${label} must be a path or resolution input`);
63
+ throw new KeiyakuError("invalid-input", `${label} must be a path or resolution input`);
65
64
  const cwd = await directory(input.cwd, `${label} cwd`);
66
65
  if (input.repositoryRoot === undefined)
67
66
  return { cwd };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrosheep/keiyaku",
3
- "version": "4.6.31",
3
+ "version": "4.6.33",
4
4
  "workspaces": [
5
5
  "plugins/square",
6
6
  "plugins/paseo/forwarder"
@@ -21,6 +21,10 @@
21
21
  "./plugin": {
22
22
  "types": "./build/src/plugin/public.d.ts",
23
23
  "import": "./build/src/plugin/public.js"
24
+ },
25
+ "./pi": {
26
+ "types": "./build/src/pi/index.d.ts",
27
+ "import": "./build/src/pi/index.js"
24
28
  }
25
29
  },
26
30
  "bin": {
@@ -65,7 +69,7 @@
65
69
  "@earendil-works/pi-coding-agent": "*"
66
70
  },
67
71
  "devDependencies": {
68
- "@earendil-works/pi-coding-agent": "^1.4.0",
72
+ "@earendil-works/pi-coding-agent": "^1.5.2",
69
73
  "@getpaseo/plugin": "0.14.0",
70
74
  "@getpaseo/server": "0.14.0",
71
75
  "@types/cross-spawn": "^6.0.6",
@@ -83,7 +87,7 @@
83
87
  "@agentclientprotocol/sdk": "^1.3.0",
84
88
  "@anthropic-ai/claude-agent-sdk": "^0.3.226",
85
89
  "@astrosheep/keiyaku-plugin-square": "0.1.23",
86
- "@astrosheep/square": "^0.4.1",
90
+ "@astrosheep/square": "^0.4.9",
87
91
  "@getpaseo/client": "0.14.0",
88
92
  "@getpaseo/protocol": "0.14.0",
89
93
  "@modelcontextprotocol/sdk": "^1.32.1",
@@ -14,7 +14,7 @@ export default function contribute(server: PluginServerContext) {
14
14
  const mirror = createProvider(transport, handoff);
15
15
  server.registerProvider(mirror.provider);
16
16
  server.handle(refreshRpc, (input, context) => refreshOrReopen(context.paseo, input, mirror.refresh));
17
- server.handle(attachRpc, (input, context) => attach(input, context));
17
+ server.handle(attachRpc, (input, context) => attach(input, context, transport.status));
18
18
  const removeModelCorrection = registerModelCorrection(server, transport.status);
19
19
  const removeHooks = registerRegistrationHooks(server, handoff);
20
20
  return async () => {