@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
@@ -1,13 +1,13 @@
1
1
  /** @architectureCompositionRoot */
2
2
  import { z } from "zod";
3
3
  import { contractIdSchema, snapshotIdSchema } from "../git/identity.js";
4
- import { compactReason, retrySchema } from "../protocol/result-reasons.js";
4
+ import { retrySchema } from "../protocol/result-reasons.js";
5
5
  import { deliveryPreviewReportSchema } from "../protocol/delivery-preview.js";
6
6
  import { placementSchema } from "../protocol/completion.js";
7
- import { verifyValueSchema } from "../protocol/verify.js";
7
+ import { verifyValueSchema, verifyNormalValueSchema } from "../protocol/verify.js";
8
8
  import { deliveredValueSchema } from "./delivery.js";
9
- import { continuationReportSchema } from "./continuation.js";
10
- import { handoffOutcomeSchema, operationOutcomeSchema, invocationIssueSchema, localIssueSchema, completionIssueSchema, previewIssueSchema, } from "./outcome.js";
9
+ import { continuationReportSchema, continuationNormalReportSchema } from "./continuation.js";
10
+ import { handoffOutcomeSchema, operationOutcomeSchema, acceptedOutcomeSchema, optionalInvocationIssueSchema, optionalLocalIssueSchema, invocationIssueSchema, localIssueSchema, previewIssueSchema, } from "./outcome.js";
11
11
  import { operationRefusalSchemas } from "./refusal.js";
12
12
  import { regionOverlapResultSchema } from "./region.js";
13
13
  const regionFields = {
@@ -20,6 +20,7 @@ const bindFields = {
20
20
  ...regionFields,
21
21
  };
22
22
  const amendFields = {
23
+ target: z.string().exactOptional(),
23
24
  changedSections: z.array(z.string()).min(1).readonly().exactOptional(),
24
25
  gatesChanged: z.literal(true).exactOptional(),
25
26
  afterChanged: z.literal(true).exactOptional(),
@@ -41,40 +42,24 @@ const reviewFields = {
41
42
  const bindValueSchema = z.strictObject(bindFields).readonly();
42
43
  const amendValueSchema = z.strictObject(amendFields).readonly();
43
44
  const localRecoveries = { recoverySnapshots: z.array(snapshotIdSchema).min(1).readonly().exactOptional() };
45
+ export const bindNormalOutcomeSchema = acceptedOutcomeSchema({ ...bindFields, ...localRecoveries }, optionalLocalIssueSchema);
44
46
  const bindOutcomes = operationOutcomeSchema(bindFields, operationRefusalSchemas.bind, localIssueSchema);
45
47
  export const bindOutcomeSchema = z.union([
46
48
  bindOutcomes.options[0].unwrap().extend(localRecoveries).readonly(),
47
49
  bindOutcomes.options[1].unwrap().omit({ contractId: true }).readonly(),
48
50
  ...retrySchema.options,
49
51
  ]);
50
- const amendOutcomes = operationOutcomeSchema(amendFields, operationRefusalSchemas.amend, localIssueSchema);
51
- export const amendOutcomeSchema = z.union([
52
- amendOutcomes.options[0].unwrap().extend(localRecoveries).readonly(),
53
- amendOutcomes.options[1],
54
- amendOutcomes.options[2],
55
- amendOutcomes.options[3],
56
- ]);
52
+ export const amendOutcomeSchema = operationOutcomeSchema({ ...amendFields, ...localRecoveries }, operationRefusalSchemas.amend, localIssueSchema);
57
53
  export const deliverOutcomeSchema = z.union([
58
- operationOutcomeSchema(deliveredValueSchema.unwrap().shape, operationRefusalSchemas.deliver, completionIssueSchema),
54
+ operationOutcomeSchema(deliveredValueSchema.unwrap().shape, operationRefusalSchemas.deliver, invocationIssueSchema),
59
55
  handoffOutcomeSchema,
60
56
  ]);
61
57
  const verifyOutcomes = operationOutcomeSchema({ ...verifyValueSchema.unwrap().shape, continuation: continuationReportSchema.exactOptional() }, operationRefusalSchemas.verify, invocationIssueSchema);
58
+ export const verifyNormalOutcomeSchema = acceptedOutcomeSchema({ ...verifyNormalValueSchema.unwrap().shape, continuation: continuationNormalReportSchema.exactOptional() }, optionalInvocationIssueSchema);
62
59
  export const verifyOutcomeSchema = z.union([verifyOutcomes.options[0], verifyOutcomes.options[1]]);
63
- export const reviewOutcomeSchema = operationOutcomeSchema(reviewFields, operationRefusalSchemas.review, completionIssueSchema);
64
- const arcOutcomes = operationOutcomeSchema({ chapter: z.number().int().positive() }, operationRefusalSchemas.arc, localIssueSchema);
65
- export const arcOutcomeSchema = z.union([
66
- arcOutcomes.options[0].unwrap().extend(localRecoveries).readonly(),
67
- arcOutcomes.options[1],
68
- arcOutcomes.options[2],
69
- arcOutcomes.options[3],
70
- ]);
71
- const abandonOutcomes = operationOutcomeSchema({}, operationRefusalSchemas.abandon, localIssueSchema);
72
- export const abandonOutcomeSchema = z.union([
73
- abandonOutcomes.options[0].unwrap().extend(localRecoveries).readonly(),
74
- abandonOutcomes.options[1],
75
- abandonOutcomes.options[2],
76
- abandonOutcomes.options[3],
77
- ]);
60
+ export const reviewOutcomeSchema = operationOutcomeSchema(reviewFields, operationRefusalSchemas.review, invocationIssueSchema);
61
+ export const arcOutcomeSchema = operationOutcomeSchema({ chapter: z.number().int().positive(), ...localRecoveries }, operationRefusalSchemas.arc, localIssueSchema);
62
+ export const abandonOutcomeSchema = operationOutcomeSchema(localRecoveries, operationRefusalSchemas.abandon, localIssueSchema);
78
63
  const previewIssues = { issues: z.array(previewIssueSchema).min(1).readonly().exactOptional() };
79
64
  export const deliveryPreviewOutcomeSchema = z.union([
80
65
  deliveryPreviewReportSchema.options[0].unwrap().extend(previewIssues).readonly(),
@@ -87,16 +72,6 @@ export const deliveryPreviewOutcomeSchema = z.union([
87
72
  })
88
73
  .readonly(),
89
74
  ]);
90
- export function expected(contract, admission) {
91
- return admission.kind === "refused"
92
- ? { kind: "refused", ...(contract === undefined ? {} : { contract }), refusal: compactReason(admission.refusal) }
93
- : { kind: "retry", ...(contract === undefined ? {} : { contract }), reason: admission.reason };
94
- }
95
- export function acceptedOutcome(contract, accumulator, value) {
96
- if (accumulator.head(contract) === undefined)
97
- throw new Error("missing leading admission receipt");
98
- return { kind: "accepted", contract, value };
99
- }
100
75
  export function retainAdmission(accumulator, contract, leading) {
101
76
  accumulator.recordPublication(contract, leading.head, leading.facts);
102
77
  accumulator.recordResidue(contract, leading);
@@ -1,12 +1,11 @@
1
1
  /** @architectureCompositionRoot */
2
- import { type ActorId, type Gate } from "../core/facts/types.js";
2
+ import { type Gate } from "../core/facts/types.js";
3
3
  import { type WorktreeHooks } from "../git/hooks.js";
4
4
  import { type Settings } from "../settings.js";
5
5
  import type { KeisOptions } from "./contract-types.js";
6
6
  /** The one immutable Contract-local composition captured at construction. */
7
7
  export type LocalContractCompositionCapture = Readonly<{
8
8
  settings?: Settings;
9
- actor?: ActorId;
10
9
  }>;
11
10
  /**
12
11
  * Hooks, freshness, and gate bundles are read from the captured Settings only at the operation
@@ -2,7 +2,7 @@
2
2
  import { gate, gateWord } from "../core/facts/types.js";
3
3
  import { EMPTY_WORKTREE_HOOKS, worktreeHooksFrom } from "../git/hooks.js";
4
4
  import { SettingsError } from "../settings.js";
5
- import { actorOption, requireInput } from "./input.js";
5
+ import { requireInput } from "./input.js";
6
6
  import { KeiyakuError } from "./outcome.js";
7
7
  /** One scoped Settings lookup: its native failure stays the cause of caller-invalid input. */
8
8
  function settingsScopedFailure(error) {
@@ -57,10 +57,10 @@ export function gateNames(value) {
57
57
  if (value === undefined)
58
58
  return undefined;
59
59
  if (!Array.isArray(value))
60
- throw new TypeError("gates must be an array");
60
+ throw new KeiyakuError("invalid-input", "gates must be an array");
61
61
  return value.map((item, index) => {
62
62
  if (typeof item !== "string")
63
- throw new TypeError(`gates[${index}] must be a string`);
63
+ throw new KeiyakuError("invalid-input", `gates[${index}] must be a string`);
64
64
  return item;
65
65
  });
66
66
  }
@@ -135,14 +135,12 @@ export function derivedGates(composition, names) {
135
135
  }
136
136
  }
137
137
  export function captureLocalContractComposition(input) {
138
- const values = requireInput(input === undefined ? {} : input, "Keis.of input", ["settings", "actor"]);
139
- const actor = actorOption(values.actor).actor;
138
+ const values = requireInput(input === undefined ? {} : input, "Keis.of input", ["settings"]);
140
139
  const settings = values.settings;
141
140
  if (settings !== undefined && (settings === null || typeof settings !== "object")) {
142
- throw new TypeError("Keis.of settings must be a Settings value");
141
+ throw new KeiyakuError("invalid-input", "Keis.of settings must be a Settings value");
143
142
  }
144
143
  return Object.freeze({
145
- ...(actor === undefined ? {} : { actor }),
146
144
  ...(settings === undefined ? {} : { settings: settings }),
147
145
  });
148
146
  }
@@ -1,58 +1,64 @@
1
1
  /** @architectureCompositionRoot */
2
2
  import { z } from "zod";
3
- import type { ActorId, AttestationData, ContractId } from "../core/facts/types.js";
3
+ import type { AttestationData, ContractId } from "../core/facts/types.js";
4
4
  import type { ContractCatalogue } from "../protocol/read/status.js";
5
5
  import type { Settings } from "../settings.js";
6
6
  import type { DebtId } from "../debt/identity.js";
7
7
  /** Public gate words remain ordinary strings; private policy interprets them. */
8
- export type Gate = string;
8
+ export type { Gate } from "../core/facts/types.js";
9
9
  export declare const contractHistoryEventSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
10
10
  kind: z.ZodLiteral<"bind">;
11
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
12
+ at: z.ZodString;
11
13
  start: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
12
14
  target: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodString, z.ZodReadonly<z.ZodObject<{
13
15
  kind: z.ZodLiteral<"contract">;
14
16
  contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
15
17
  }, z.core.$strict>>]>>;
16
- gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").Gate, string>>>>>;
18
+ gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>>;
17
19
  after: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>>>>;
18
20
  document: z.ZodExactOptional<z.ZodString>;
19
21
  targetIncarnation: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
20
22
  id: z.ZodString;
21
23
  identity: z.ZodString;
22
24
  }, z.core.$strict>>>;
23
- id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
24
- at: z.ZodString;
25
- actor: z.ZodExactOptional<z.ZodString>;
26
25
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
27
26
  kind: z.ZodLiteral<"amend">;
27
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
28
+ at: z.ZodString;
29
+ target: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodString, z.ZodReadonly<z.ZodObject<{
30
+ kind: z.ZodLiteral<"contract">;
31
+ contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
32
+ }, z.core.$strict>>]>>;
33
+ targetIncarnation: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
34
+ id: z.ZodString;
35
+ identity: z.ZodString;
36
+ }, z.core.$strict>>>;
28
37
  changedSections: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
29
- gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").Gate, string>>>>>;
38
+ gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>>;
30
39
  after: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>>>>;
31
40
  document: z.ZodExactOptional<z.ZodString>;
32
- id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
33
- at: z.ZodString;
34
- actor: z.ZodExactOptional<z.ZodString>;
35
41
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
36
42
  kind: z.ZodLiteral<"deliver">;
43
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
44
+ at: z.ZodString;
37
45
  candidate: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
38
46
  integration: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
39
47
  contentId: z.ZodString;
40
48
  predecessor: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
41
49
  note: z.ZodExactOptional<z.ZodString>;
42
50
  requireBranchesToBeUpToDate: z.ZodExactOptional<z.ZodBoolean>;
43
- id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
44
- at: z.ZodString;
45
- actor: z.ZodExactOptional<z.ZodString>;
46
51
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
47
52
  kind: z.ZodLiteral<"reintegrated">;
48
- predecessor: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
49
- integration: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
50
53
  id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
51
54
  at: z.ZodString;
52
- actor: z.ZodExactOptional<z.ZodString>;
55
+ predecessor: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
56
+ integration: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
53
57
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
54
58
  kind: z.ZodLiteral<"attestation">;
55
- gate: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").Gate, string>>;
59
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
60
+ at: z.ZodString;
61
+ gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
56
62
  requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
57
63
  verdict: z.ZodEnum<{
58
64
  satisfied: "satisfied";
@@ -60,29 +66,23 @@ export declare const contractHistoryEventSchema: z.ZodUnion<readonly [z.ZodReado
60
66
  }>;
61
67
  subject: z.ZodString;
62
68
  summary: z.ZodExactOptional<z.ZodString>;
63
- id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
64
- at: z.ZodString;
65
- actor: z.ZodExactOptional<z.ZodString>;
66
69
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
67
70
  kind: z.ZodLiteral<"claimed">;
68
- deliveryId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
69
71
  id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
70
72
  at: z.ZodString;
71
- actor: z.ZodExactOptional<z.ZodString>;
73
+ deliveryId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
72
74
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
73
75
  kind: z.ZodLiteral<"arc">;
76
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
77
+ at: z.ZodString;
74
78
  chapter: z.ZodNumber;
75
79
  title: z.ZodString;
76
80
  body: z.ZodExactOptional<z.ZodString>;
77
- id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
78
- at: z.ZodString;
79
- actor: z.ZodExactOptional<z.ZodString>;
80
81
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
81
82
  kind: z.ZodLiteral<"abandoned">;
82
- note: z.ZodExactOptional<z.ZodString>;
83
83
  id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
84
84
  at: z.ZodString;
85
- actor: z.ZodExactOptional<z.ZodString>;
85
+ note: z.ZodExactOptional<z.ZodString>;
86
86
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
87
87
  kind: z.ZodLiteral<"dispatch">;
88
88
  at: z.ZodString;
@@ -93,51 +93,57 @@ export declare const contractHistorySchema: z.ZodUnion<readonly [z.ZodReadonly<z
93
93
  contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
94
94
  events: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
95
95
  kind: z.ZodLiteral<"bind">;
96
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
97
+ at: z.ZodString;
96
98
  start: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
97
99
  target: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodString, z.ZodReadonly<z.ZodObject<{
98
100
  kind: z.ZodLiteral<"contract">;
99
101
  contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
100
102
  }, z.core.$strict>>]>>;
101
- gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").Gate, string>>>>>;
103
+ gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>>;
102
104
  after: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>>>>;
103
105
  document: z.ZodExactOptional<z.ZodString>;
104
106
  targetIncarnation: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
105
107
  id: z.ZodString;
106
108
  identity: z.ZodString;
107
109
  }, z.core.$strict>>>;
108
- id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
109
- at: z.ZodString;
110
- actor: z.ZodExactOptional<z.ZodString>;
111
110
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
112
111
  kind: z.ZodLiteral<"amend">;
112
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
113
+ at: z.ZodString;
114
+ target: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodString, z.ZodReadonly<z.ZodObject<{
115
+ kind: z.ZodLiteral<"contract">;
116
+ contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
117
+ }, z.core.$strict>>]>>;
118
+ targetIncarnation: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
119
+ id: z.ZodString;
120
+ identity: z.ZodString;
121
+ }, z.core.$strict>>>;
113
122
  changedSections: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
114
- gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").Gate, string>>>>>;
123
+ gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>>;
115
124
  after: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>>>>;
116
125
  document: z.ZodExactOptional<z.ZodString>;
117
- id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
118
- at: z.ZodString;
119
- actor: z.ZodExactOptional<z.ZodString>;
120
126
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
121
127
  kind: z.ZodLiteral<"deliver">;
128
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
129
+ at: z.ZodString;
122
130
  candidate: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
123
131
  integration: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
124
132
  contentId: z.ZodString;
125
133
  predecessor: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
126
134
  note: z.ZodExactOptional<z.ZodString>;
127
135
  requireBranchesToBeUpToDate: z.ZodExactOptional<z.ZodBoolean>;
128
- id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
129
- at: z.ZodString;
130
- actor: z.ZodExactOptional<z.ZodString>;
131
136
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
132
137
  kind: z.ZodLiteral<"reintegrated">;
133
- predecessor: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
134
- integration: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
135
138
  id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
136
139
  at: z.ZodString;
137
- actor: z.ZodExactOptional<z.ZodString>;
140
+ predecessor: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
141
+ integration: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
138
142
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
139
143
  kind: z.ZodLiteral<"attestation">;
140
- gate: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").Gate, string>>;
144
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
145
+ at: z.ZodString;
146
+ gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
141
147
  requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
142
148
  verdict: z.ZodEnum<{
143
149
  satisfied: "satisfied";
@@ -145,29 +151,23 @@ export declare const contractHistorySchema: z.ZodUnion<readonly [z.ZodReadonly<z
145
151
  }>;
146
152
  subject: z.ZodString;
147
153
  summary: z.ZodExactOptional<z.ZodString>;
148
- id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
149
- at: z.ZodString;
150
- actor: z.ZodExactOptional<z.ZodString>;
151
154
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
152
155
  kind: z.ZodLiteral<"claimed">;
153
- deliveryId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
154
156
  id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
155
157
  at: z.ZodString;
156
- actor: z.ZodExactOptional<z.ZodString>;
158
+ deliveryId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
157
159
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
158
160
  kind: z.ZodLiteral<"arc">;
161
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
162
+ at: z.ZodString;
159
163
  chapter: z.ZodNumber;
160
164
  title: z.ZodString;
161
165
  body: z.ZodExactOptional<z.ZodString>;
162
- id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
163
- at: z.ZodString;
164
- actor: z.ZodExactOptional<z.ZodString>;
165
166
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
166
167
  kind: z.ZodLiteral<"abandoned">;
167
- note: z.ZodExactOptional<z.ZodString>;
168
168
  id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
169
169
  at: z.ZodString;
170
- actor: z.ZodExactOptional<z.ZodString>;
170
+ note: z.ZodExactOptional<z.ZodString>;
171
171
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
172
172
  kind: z.ZodLiteral<"dispatch">;
173
173
  at: z.ZodString;
@@ -176,8 +176,8 @@ export declare const contractHistorySchema: z.ZodUnion<readonly [z.ZodReadonly<z
176
176
  dispatches: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
177
177
  kind: z.ZodLiteral<"unavailable">;
178
178
  category: z.ZodEnum<{
179
- internal: "internal";
180
179
  "authority-corruption": "authority-corruption";
180
+ internal: "internal";
181
181
  }>;
182
182
  diagnostic: z.ZodString;
183
183
  }, z.core.$strict>>>;
@@ -195,8 +195,6 @@ type MarkdownBindInput = Readonly<{
195
195
  debt?: DebtId;
196
196
  /** A literal target branch; `null` is deliberately targetless; omitted is the Repo worktree's current branch. */
197
197
  target?: string | null;
198
- workspace?: "worktree";
199
- actor?: string;
200
198
  after?: readonly ContractId[];
201
199
  gates?: readonly string[];
202
200
  }>;
@@ -204,24 +202,20 @@ type ForkBindInput = Readonly<{
204
202
  forkOf: ContractId;
205
203
  /** A literal target branch; `null` clears the source target; omitted inherits it. */
206
204
  target?: string | null;
207
- workspace?: "worktree";
208
- actor?: string;
209
205
  }>;
210
206
  export type BindInput = MarkdownBindInput | ForkBindInput;
211
- type ActorOptions = Readonly<{
212
- actor?: string;
213
- }>;
214
- /** Contract-local composition: one captured Settings selection and the operation actor. */
207
+ /** Contract-local composition: one captured Settings selection. */
215
208
  export type KeisOptions = Readonly<{
216
209
  settings?: Settings;
217
- actor?: ActorId;
218
210
  }>;
219
- export type AmendInput = ActorOptions & Readonly<{
211
+ export type AmendInput = Readonly<{
212
+ /** Explicit existing branch or active Contract; omission retains the target. */
213
+ target?: string;
220
214
  markdown?: string;
221
215
  after?: readonly ContractId[];
222
216
  gates?: readonly string[];
223
217
  }>;
224
- export type ArcInput = ActorOptions & Readonly<{
218
+ export type ArcInput = Readonly<{
225
219
  markdown: string;
226
220
  }>;
227
221
  export type ContractListInput = Readonly<{
@@ -283,12 +277,12 @@ export declare const contractResolutionSchema: z.ZodUnion<readonly [z.ZodReadonl
283
277
  }, z.core.$strict>>]>;
284
278
  export type ContractSelectorRefusal = z.output<typeof contractSelectorRefusalSchema>;
285
279
  export type ContractResolution = z.output<typeof contractResolutionSchema>;
286
- export type ReviewInput = ActorOptions & Readonly<{
280
+ export type ReviewInput = Readonly<{
287
281
  verdict: AttestationData["verdict"];
288
282
  summary: string;
289
283
  signal?: AbortSignal;
290
284
  }>;
291
- export type AbandonInput = ActorOptions & Readonly<{
285
+ export type AbandonInput = Readonly<{
292
286
  note?: string;
293
287
  }>;
294
288
  export type VerifyInput = Readonly<{
@@ -303,4 +297,3 @@ export type DeliverInput = Readonly<{
303
297
  overwrite?: boolean;
304
298
  signal?: AbortSignal;
305
299
  }>;
306
- export {};
@@ -6,7 +6,6 @@ import { akumaIdSchema } from "../akuma/identity.js";
6
6
  const historyCommon = {
7
7
  id: entryUlidSchema,
8
8
  at: z.string(),
9
- actor: z.string().exactOptional(),
10
9
  };
11
10
  const historyTarget = z.union([
12
11
  z.string(),
@@ -14,83 +13,45 @@ const historyTarget = z.union([
14
13
  ]);
15
14
  const historyGates = z.array(gateSchema).readonly().exactOptional();
16
15
  const historyAfter = z.array(contractIdSchema).readonly().exactOptional();
16
+ function historyEvent(kind, fields) {
17
+ return z.strictObject({ ...historyCommon, kind: z.literal(kind), ...fields }).readonly();
18
+ }
17
19
  export const contractHistoryEventSchema = z.union([
18
- z
19
- .strictObject({
20
- ...historyCommon,
21
- kind: z.literal("bind"),
20
+ historyEvent("bind", {
22
21
  start: snapshotIdSchema,
23
22
  target: historyTarget.exactOptional(),
24
23
  gates: historyGates,
25
24
  after: historyAfter,
26
25
  document: z.string().exactOptional(),
27
26
  targetIncarnation: z.strictObject({ id: z.string(), identity: z.string() }).readonly().exactOptional(),
28
- })
29
- .readonly(),
30
- z
31
- .strictObject({
32
- ...historyCommon,
33
- kind: z.literal("amend"),
27
+ }),
28
+ historyEvent("amend", {
29
+ target: historyTarget.exactOptional(),
30
+ targetIncarnation: z.strictObject({ id: z.string(), identity: z.string() }).readonly().exactOptional(),
34
31
  changedSections: z.array(z.string()).readonly().exactOptional(),
35
32
  gates: historyGates,
36
33
  after: historyAfter,
37
34
  document: z.string().exactOptional(),
38
- })
39
- .readonly(),
40
- z
41
- .strictObject({
42
- ...historyCommon,
43
- kind: z.literal("deliver"),
35
+ }),
36
+ historyEvent("deliver", {
44
37
  candidate: snapshotIdSchema,
45
38
  integration: snapshotIdSchema,
46
39
  contentId: z.string(),
47
40
  predecessor: snapshotIdSchema,
48
41
  note: z.string().exactOptional(),
49
42
  requireBranchesToBeUpToDate: z.boolean().exactOptional(),
50
- })
51
- .readonly(),
52
- z
53
- .strictObject({
54
- ...historyCommon,
55
- kind: z.literal("reintegrated"),
56
- predecessor: snapshotIdSchema,
57
- integration: snapshotIdSchema,
58
- })
59
- .readonly(),
60
- z
61
- .strictObject({
62
- ...historyCommon,
63
- kind: z.literal("attestation"),
43
+ }),
44
+ historyEvent("reintegrated", { predecessor: snapshotIdSchema, integration: snapshotIdSchema }),
45
+ historyEvent("attestation", {
64
46
  gate: gateSchema,
65
47
  requirement: requirementIdSchema,
66
48
  verdict: verdictSchema,
67
49
  subject: z.string(),
68
50
  summary: z.string().exactOptional(),
69
- })
70
- .readonly(),
71
- z
72
- .strictObject({
73
- ...historyCommon,
74
- kind: z.literal("claimed"),
75
- deliveryId: entryUlidSchema,
76
- })
77
- .readonly(),
78
- z
79
- .strictObject({
80
- ...historyCommon,
81
- kind: z.literal("arc"),
82
- chapter: z.number().int().positive(),
83
- title: z.string(),
84
- body: z.string().exactOptional(),
85
- })
86
- .readonly(),
87
- z
88
- .strictObject({
89
- ...historyCommon,
90
- kind: z.literal("abandoned"),
91
- note: z.string().exactOptional(),
92
- })
93
- .readonly(),
51
+ }),
52
+ historyEvent("claimed", { deliveryId: entryUlidSchema }),
53
+ historyEvent("arc", { chapter: z.number().int().positive(), title: z.string(), body: z.string().exactOptional() }),
54
+ historyEvent("abandoned", { note: z.string().exactOptional() }),
94
55
  z
95
56
  .strictObject({
96
57
  kind: z.literal("dispatch"),
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { type ContractId } from "../core/facts/types.js";
3
3
  import type { RepositoryScope } from "../protocol/operations.js";
4
+ export declare const contractWaitDurationSchema: z.ZodNumber;
4
5
  export type ContractWaitOptions = Readonly<{
5
6
  completion?: "any" | "all";
6
7
  timeoutMs?: number;
@@ -24,10 +25,10 @@ export declare const contractWaitMemberSchema: z.ZodReadonly<z.ZodObject<{
24
25
  export declare const contractWaitResultSchema: z.ZodReadonly<z.ZodObject<{
25
26
  kind: z.ZodLiteral<"contract">;
26
27
  reason: z.ZodEnum<{
27
- changed: "changed";
28
- terminal: "terminal";
29
- missing: "missing";
30
28
  deadline: "deadline";
29
+ missing: "missing";
30
+ terminal: "terminal";
31
+ changed: "changed";
31
32
  }>;
32
33
  contracts: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
33
34
  id: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
@@ -42,6 +43,42 @@ export declare const contractWaitResultSchema: z.ZodReadonly<z.ZodObject<{
42
43
  }>>;
43
44
  }, z.core.$strict>>>>;
44
45
  }, z.core.$strict>>;
46
+ export declare const contractWaitNormalResultSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
47
+ kind: z.ZodLiteral<"contract">;
48
+ reason: z.ZodLiteral<"changed">;
49
+ contracts: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
50
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
51
+ terminal: z.ZodExactOptional<z.ZodEnum<{
52
+ claimed: "claimed";
53
+ abandoned: "abandoned";
54
+ }>>;
55
+ changed: z.ZodExactOptional<z.ZodLiteral<true>>;
56
+ }, z.core.$strict>>>>;
57
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
58
+ kind: z.ZodLiteral<"contract">;
59
+ reason: z.ZodLiteral<"terminal">;
60
+ contracts: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
61
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
62
+ terminal: z.ZodExactOptional<z.ZodEnum<{
63
+ claimed: "claimed";
64
+ abandoned: "abandoned";
65
+ }>>;
66
+ }, z.core.$strict>>>>;
67
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
68
+ kind: z.ZodLiteral<"contract">;
69
+ reason: z.ZodLiteral<"deadline">;
70
+ contracts: z.ZodUnion<readonly [z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
71
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
72
+ terminal: z.ZodExactOptional<z.ZodEnum<{
73
+ claimed: "claimed";
74
+ abandoned: "abandoned";
75
+ }>>;
76
+ changed: z.ZodExactOptional<z.ZodLiteral<true>>;
77
+ }, z.core.$strict>>>>, z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
78
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
79
+ presence: z.ZodLiteral<"unknown">;
80
+ }, z.core.$strict>>>>]>;
81
+ }, z.core.$strict>>]>;
45
82
  export type ContractWaitMember = z.output<typeof contractWaitMemberSchema>;
46
83
  export type ContractWaitResult = z.output<typeof contractWaitResultSchema>;
47
84
  export type ValidatedWait = Readonly<{
@@ -53,4 +90,11 @@ export type ValidatedWait = Readonly<{
53
90
  }>;
54
91
  export declare function validateContractWait(scope: RepositoryScope, input: unknown): ValidatedWait;
55
92
  export declare function validateContractWaitHandle(scope: RepositoryScope, id: ContractId, input?: ContractWaitOptions): ValidatedWait;
93
+ /** One invocation's journal baselines and witnessed progress, shared with mixed observation. */
94
+ export declare function createContractWaitObserver(scope: RepositoryScope, ids: readonly ContractId[]): {
95
+ members: () => readonly ContractWaitMember[];
96
+ reason: (completion: "any" | "all") => "deadline" | "missing" | "terminal" | "changed" | undefined;
97
+ satisfied: () => ContractId[];
98
+ observe(signal?: AbortSignal): Promise<void>;
99
+ };
56
100
  export declare function waitContractLocal(input: ValidatedWait): Promise<ContractWaitResult>;