@astrosheep/keiyaku 4.6.31 → 4.6.32

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 (335) hide show
  1. package/README.md +34 -17
  2. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +16 -11
  3. package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +5 -3
  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 +4 -3
  7. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +16 -11
  8. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +5 -3
  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 +4 -3
  12. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +16 -11
  13. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +5 -3
  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 +4 -3
  17. package/build/plugins/pi/README.md +16 -18
  18. package/build/plugins/pi/akuma-tools.ts +31 -38
  19. package/build/plugins/pi/keiyaku.ts +15 -4
  20. package/build/skills/keiyaku-akuma/SKILL.md +16 -11
  21. package/build/skills/keiyaku-babysit/SKILL.md +5 -3
  22. package/build/skills/keiyaku-bind/SKILL.md +4 -3
  23. package/build/skills/keiyaku-debt/SKILL.md +17 -17
  24. package/build/skills/keiyaku-workflow/SKILL.md +4 -3
  25. package/build/src/akuma/akuma-call.d.ts +3 -5
  26. package/build/src/akuma/akuma-call.js +7 -10
  27. package/build/src/akuma/akuma-errors.d.ts +7 -4
  28. package/build/src/akuma/akuma-errors.js +16 -12
  29. package/build/src/akuma/akuma-instance.d.ts +39 -303
  30. package/build/src/akuma/akuma-instance.js +48 -48
  31. package/build/src/akuma/akuma-observe.d.ts +5 -4
  32. package/build/src/akuma/akuma-observe.js +1 -7
  33. package/build/src/akuma/akuma-owner.d.ts +14 -6
  34. package/build/src/akuma/akuma-owner.js +33 -27
  35. package/build/src/akuma/akuma-selection-execution.d.ts +22 -19
  36. package/build/src/akuma/akuma-selection-execution.js +71 -124
  37. package/build/src/akuma/akuma-wait.d.ts +3 -3
  38. package/build/src/akuma/akuma.d.ts +47 -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 +31 -26
  43. package/build/src/akuma/call-initial-tell.d.ts +4 -1
  44. package/build/src/akuma/call-initial-tell.js +9 -1
  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/facts.d.ts +5 -4
  50. package/build/src/akuma/heart/facts.js +5 -5
  51. package/build/src/akuma/heart/soul.js +20 -4
  52. package/build/src/akuma/identity.d.ts +1 -1
  53. package/build/src/akuma/identity.js +9 -4
  54. package/build/src/akuma/index.d.ts +6 -7
  55. package/build/src/akuma/index.js +2 -3
  56. package/build/src/akuma/projection.d.ts +3 -0
  57. package/build/src/akuma/provider-recipe.js +3 -2
  58. package/build/src/akuma/providers/acp/config.js +11 -10
  59. package/build/src/akuma/providers/acp/index.js +2 -1
  60. package/build/src/akuma/providers/codex-app-server/index.js +7 -1
  61. package/build/src/akuma/providers/grok-build/index.js +2 -1
  62. package/build/src/akuma/providers/index.d.ts +0 -1
  63. package/build/src/akuma/providers/index.js +0 -8
  64. package/build/src/akuma/providers/paseo/index.js +7 -4
  65. package/build/src/akuma/providers/pi/index.js +4 -3
  66. package/build/src/akuma/publication.d.ts +1 -2
  67. package/build/src/akuma/publication.js +16 -14
  68. package/build/src/akuma/schema.d.ts +3 -49
  69. package/build/src/akuma/schema.js +6 -147
  70. package/build/src/akuma/selection-observation.d.ts +281 -240
  71. package/build/src/akuma/selection-observation.js +122 -68
  72. package/build/src/akuma/status-projection.d.ts +49 -285
  73. package/build/src/akuma/status-projection.js +178 -138
  74. package/build/src/body/amend.js +2 -1
  75. package/build/src/body/arc.js +3 -2
  76. package/build/src/body/criteria.js +4 -3
  77. package/build/src/body/decode.js +2 -1
  78. package/build/src/body/envelope.js +2 -1
  79. package/build/src/body/region.d.ts +1 -3
  80. package/build/src/body/region.js +3 -8
  81. package/build/src/body-host.d.ts +4 -11
  82. package/build/src/body-host.js +5 -4
  83. package/build/src/bounded-list.js +2 -1
  84. package/build/src/cli/commands/akuma-grammar.d.ts +109 -66
  85. package/build/src/cli/commands/akuma-grammar.js +75 -95
  86. package/build/src/cli/commands/akuma.d.ts +8 -3
  87. package/build/src/cli/commands/akuma.js +63 -122
  88. package/build/src/cli/commands/contract-grammar.d.ts +3 -135
  89. package/build/src/cli/commands/contract-grammar.js +125 -218
  90. package/build/src/cli/commands/contract-help.d.ts +24 -21
  91. package/build/src/cli/commands/contract-help.js +43 -35
  92. package/build/src/cli/commands/contract.d.ts +6 -18
  93. package/build/src/cli/commands/contract.js +65 -272
  94. package/build/src/cli/commands/debt-grammar.d.ts +2 -4
  95. package/build/src/cli/commands/debt-grammar.js +22 -190
  96. package/build/src/cli/commands/debt.js +10 -87
  97. package/build/src/cli/commands/report.d.ts +2 -4
  98. package/build/src/cli/coordinates.d.ts +1 -1
  99. package/build/src/cli/coordinates.js +1 -1
  100. package/build/src/cli/main.js +9 -3
  101. package/build/src/cli/parse.d.ts +80 -3
  102. package/build/src/cli/parse.js +76 -16
  103. package/build/src/cli/render/akuma-activity.d.ts +19 -24
  104. package/build/src/cli/render/akuma-activity.js +164 -259
  105. package/build/src/cli/render/akuma.d.ts +3 -3
  106. package/build/src/cli/render/akuma.js +36 -43
  107. package/build/src/cli/render/catalog.d.ts +2 -5
  108. package/build/src/cli/render/catalog.js +2 -33
  109. package/build/src/cli/render/contract-history.js +1 -2
  110. package/build/src/cli/render/contract-observation.d.ts +0 -7
  111. package/build/src/cli/render/contract-observation.js +0 -3
  112. package/build/src/cli/render/contract.d.ts +7 -9
  113. package/build/src/cli/render/contract.js +35 -64
  114. package/build/src/cli/render/debt.d.ts +3 -11
  115. package/build/src/cli/render/debt.js +17 -88
  116. package/build/src/cli/render/delivery-preview.js +4 -4
  117. package/build/src/cli/render/kanshi-akuma.d.ts +5 -3
  118. package/build/src/cli/render/kanshi-akuma.js +22 -18
  119. package/build/src/cli/render/kanshi.d.ts +1 -3
  120. package/build/src/cli/render/kanshi.js +16 -39
  121. package/build/src/cli/render/receipt.d.ts +21 -12
  122. package/build/src/cli/render/receipt.js +49 -44
  123. package/build/src/cli/render/refusal.d.ts +4 -3
  124. package/build/src/cli/render/refusal.js +15 -17
  125. package/build/src/cli/render/settings.d.ts +1 -1
  126. package/build/src/cli/render/terminal.d.ts +9 -8
  127. package/build/src/cli/render/terminal.js +48 -32
  128. package/build/src/cli/render/verbs.d.ts +3 -1
  129. package/build/src/cli/render/verbs.js +74 -116
  130. package/build/src/cli/runtime.js +66 -65
  131. package/build/src/cli/streams.d.ts +2 -9
  132. package/build/src/cli/streams.js +8 -1
  133. package/build/src/cli/usage.d.ts +2 -1
  134. package/build/src/cli/usage.js +3 -2
  135. package/build/src/contract-worktree.js +2 -10
  136. package/build/src/core/facts/codec.js +9 -23
  137. package/build/src/core/facts/errors.d.ts +2 -1
  138. package/build/src/core/facts/errors.js +3 -3
  139. package/build/src/core/facts/types.d.ts +2 -13
  140. package/build/src/core/facts/types.js +1 -6
  141. package/build/src/core/verbs/abandon.d.ts +1 -2
  142. package/build/src/core/verbs/amend.d.ts +1 -2
  143. package/build/src/core/verbs/arc.d.ts +1 -2
  144. package/build/src/core/verbs/attestation.d.ts +1 -2
  145. package/build/src/core/verbs/bind.d.ts +1 -2
  146. package/build/src/core/verbs/deliver.d.ts +1 -2
  147. package/build/src/core/verbs/placement.d.ts +1 -2
  148. package/build/src/core/verbs/reintegrate.d.ts +1 -2
  149. package/build/src/debt/board.d.ts +14 -94
  150. package/build/src/debt/board.js +25 -160
  151. package/build/src/debt/catalog.d.ts +0 -2
  152. package/build/src/debt/catalog.js +1 -22
  153. package/build/src/debt/document.d.ts +8 -11
  154. package/build/src/debt/document.js +19 -62
  155. package/build/src/debt/identity.d.ts +2 -14
  156. package/build/src/debt/identity.js +19 -49
  157. package/build/src/debt/index.d.ts +81 -219
  158. package/build/src/debt/index.js +61 -110
  159. package/build/src/debt/input.d.ts +19 -5
  160. package/build/src/debt/input.js +51 -177
  161. package/build/src/debt/lifecycle-operations.d.ts +1 -3
  162. package/build/src/debt/lifecycle-operations.js +1 -73
  163. package/build/src/debt/operation-types.d.ts +24 -128
  164. package/build/src/debt/operation-types.js +6 -62
  165. package/build/src/debt/operations.d.ts +8 -17
  166. package/build/src/debt/operations.js +58 -154
  167. package/build/src/debt/store.d.ts +0 -2
  168. package/build/src/debt/store.js +32 -87
  169. package/build/src/errors.d.ts +28 -0
  170. package/build/src/errors.js +26 -0
  171. package/build/src/git/hooks.d.ts +1 -1
  172. package/build/src/git/observe.d.ts +3 -0
  173. package/build/src/git/observe.js +19 -5
  174. package/build/src/git/reconcile.d.ts +3 -16
  175. package/build/src/git/reconcile.js +0 -18
  176. package/build/src/git/repository.d.ts +2 -1
  177. package/build/src/git/repository.js +3 -3
  178. package/build/src/git/target-placement.d.ts +4 -4
  179. package/build/src/git/target.d.ts +2 -2
  180. package/build/src/git/tender.d.ts +1 -2
  181. package/build/src/git/tender.js +5 -12
  182. package/build/src/identity/coordinates.d.ts +1 -1
  183. package/build/src/identity/coordinates.js +3 -2
  184. package/build/src/identity/normalize.js +2 -1
  185. package/build/src/identity/selector.js +4 -3
  186. package/build/src/index.d.ts +34 -57
  187. package/build/src/index.js +11 -36
  188. package/build/src/kanshi/counts.d.ts +3 -8
  189. package/build/src/kanshi/counts.js +6 -14
  190. package/build/src/kanshi/index.d.ts +22 -7
  191. package/build/src/kanshi/index.js +30 -4
  192. package/build/src/kanshi/read.d.ts +81 -270
  193. package/build/src/kanshi/read.js +39 -199
  194. package/build/src/kanshi/report.d.ts +340 -1619
  195. package/build/src/kanshi/report.js +19 -31
  196. package/build/src/library/address.d.ts +11 -11
  197. package/build/src/library/address.js +34 -27
  198. package/build/src/library/akuma-creation.d.ts +210 -79
  199. package/build/src/library/akuma-creation.js +201 -242
  200. package/build/src/library/akumas.d.ts +24 -5
  201. package/build/src/library/akumas.js +96 -29
  202. package/build/src/library/bind.d.ts +7 -10
  203. package/build/src/library/bind.js +2 -8
  204. package/build/src/library/continuation.d.ts +141 -231
  205. package/build/src/library/continuation.js +22 -31
  206. package/build/src/library/contract-address.d.ts +6 -9
  207. package/build/src/library/contract-address.js +11 -16
  208. package/build/src/library/contract-composition.d.ts +2 -3
  209. package/build/src/library/contract-composition.js +12 -19
  210. package/build/src/library/contract-creation.js +33 -34
  211. package/build/src/library/contract-outcomes.d.ts +1278 -806
  212. package/build/src/library/contract-outcomes.js +11 -37
  213. package/build/src/library/contract-settings.d.ts +1 -2
  214. package/build/src/library/contract-settings.js +5 -7
  215. package/build/src/library/contract-types.d.ts +42 -67
  216. package/build/src/library/contract-types.js +15 -56
  217. package/build/src/library/contract-wait.d.ts +40 -3
  218. package/build/src/library/contract-wait.js +28 -21
  219. package/build/src/library/delivery.d.ts +366 -389
  220. package/build/src/library/delivery.js +5 -25
  221. package/build/src/library/input.d.ts +31 -5
  222. package/build/src/library/input.js +40 -40
  223. package/build/src/library/invocation.d.ts +13 -11
  224. package/build/src/library/invocation.js +69 -58
  225. package/build/src/library/kei.d.ts +16 -8
  226. package/build/src/library/kei.js +459 -19
  227. package/build/src/library/keiyaku-attribution.d.ts +0 -8
  228. package/build/src/library/keiyaku-attribution.js +0 -11
  229. package/build/src/library/keiyaku-classify.d.ts +2 -2
  230. package/build/src/library/keiyaku-classify.js +40 -59
  231. package/build/src/library/keiyaku-coordinates.d.ts +3 -8
  232. package/build/src/library/keiyaku-coordinates.js +6 -26
  233. package/build/src/library/keiyaku-debt.d.ts +21 -93
  234. package/build/src/library/keiyaku-debt.js +8 -157
  235. package/build/src/library/keiyaku-identity.js +5 -4
  236. package/build/src/library/keiyaku-verbs.d.ts +4004 -3885
  237. package/build/src/library/keiyaku-verbs.js +309 -271
  238. package/build/src/library/keiyaku.d.ts +30 -860
  239. package/build/src/library/keiyaku.js +169 -256
  240. package/build/src/library/nuke.d.ts +4 -2
  241. package/build/src/library/nuke.js +5 -1
  242. package/build/src/library/outcome.d.ts +424 -307
  243. package/build/src/library/outcome.js +167 -362
  244. package/build/src/library/reconcile.d.ts +331 -143
  245. package/build/src/library/reconcile.js +38 -72
  246. package/build/src/library/refusal.d.ts +20 -28
  247. package/build/src/library/refusal.js +1 -11
  248. package/build/src/library/repo.js +4 -3
  249. package/build/src/library/selection.d.ts +32 -21
  250. package/build/src/library/selection.js +63 -87
  251. package/build/src/mcp/adapter.d.ts +6 -0
  252. package/build/src/mcp/adapter.js +177 -42
  253. package/build/src/mcp/help.d.ts +1 -1
  254. package/build/src/mcp/help.js +12 -7
  255. package/build/src/mcp/output.d.ts +385 -0
  256. package/build/src/mcp/output.js +193 -0
  257. package/build/src/plugin/public.d.ts +4 -0
  258. package/build/src/plugin/runtime.d.ts +1 -1
  259. package/build/src/plugin/runtime.js +2 -2
  260. package/build/src/protocol/amend.d.ts +1 -1
  261. package/build/src/protocol/amend.js +2 -2
  262. package/build/src/protocol/bind.d.ts +5 -7
  263. package/build/src/protocol/bind.js +3 -3
  264. package/build/src/protocol/completion.d.ts +158 -195
  265. package/build/src/protocol/completion.js +55 -19
  266. package/build/src/protocol/deliver.d.ts +11 -6
  267. package/build/src/protocol/deliver.js +30 -30
  268. package/build/src/protocol/delivery-preview.d.ts +13 -11
  269. package/build/src/protocol/delivery-preview.js +2 -2
  270. package/build/src/protocol/execution-observation.d.ts +5 -13
  271. package/build/src/protocol/intent.d.ts +6 -9
  272. package/build/src/protocol/intent.js +18 -31
  273. package/build/src/protocol/operations.d.ts +48 -53
  274. package/build/src/protocol/operations.js +16 -25
  275. package/build/src/protocol/outcome.d.ts +3 -1
  276. package/build/src/protocol/placement.d.ts +1 -2
  277. package/build/src/protocol/placement.js +1 -1
  278. package/build/src/protocol/progress.d.ts +1 -0
  279. package/build/src/protocol/read/status.d.ts +29 -112
  280. package/build/src/protocol/read/status.js +52 -78
  281. package/build/src/protocol/reintegrate.d.ts +1 -2
  282. package/build/src/protocol/reintegrate.js +0 -1
  283. package/build/src/protocol/result-leaves.d.ts +11 -32
  284. package/build/src/protocol/result-leaves.js +18 -57
  285. package/build/src/protocol/result-reasons.d.ts +6 -6
  286. package/build/src/protocol/review.js +0 -1
  287. package/build/src/protocol/verify.d.ts +192 -146
  288. package/build/src/protocol/verify.js +60 -47
  289. package/build/src/runtime/proc/windows-launch.exe +0 -0
  290. package/build/src/settings.d.ts +8 -9
  291. package/build/src/settings.js +16 -13
  292. package/build/src/settlement/holder.js +2 -2
  293. package/build/src/settlement/settle.d.ts +0 -6
  294. package/build/src/settlement/settle.js +0 -4
  295. package/build/src/verification/declaration.d.ts +3 -6
  296. package/build/src/verification/declaration.js +3 -5
  297. package/build/src/verification/observation.d.ts +2 -2
  298. package/build/src/world.d.ts +3 -2
  299. package/build/src/world.js +5 -6
  300. package/package.json +1 -1
  301. package/plugins/paseo/plugin/index.server.ts +1 -1
  302. package/plugins/paseo/plugin/server/attach.ts +74 -67
  303. package/plugins/paseo/plugin/server/keiyaku.ts +80 -14
  304. package/plugins/paseo/plugin/server/message.ts +2 -1
  305. package/plugins/paseo/plugin/server/mirror-identity.ts +6 -4
  306. package/plugins/paseo/plugin/server/sdk.ts +9 -11
  307. package/plugins/paseo/plugin/server/transport.ts +24 -1
  308. package/plugins/pi/README.md +16 -18
  309. package/plugins/pi/akuma-tools.ts +31 -38
  310. package/plugins/pi/keiyaku.ts +15 -4
  311. package/skills/keiyaku-akuma/SKILL.md +16 -11
  312. package/skills/keiyaku-babysit/SKILL.md +5 -3
  313. package/skills/keiyaku-bind/SKILL.md +4 -3
  314. package/skills/keiyaku-debt/SKILL.md +17 -17
  315. package/skills/keiyaku-workflow/SKILL.md +4 -3
  316. package/build/src/akuma/providers/codex-app-server/configuration.d.ts +0 -5
  317. package/build/src/akuma/providers/codex-app-server/configuration.js +0 -72
  318. package/build/src/cli/commands/debt-query.d.ts +0 -5
  319. package/build/src/cli/commands/debt-query.js +0 -194
  320. package/build/src/cli/render/akuma-tool-command.d.ts +0 -6
  321. package/build/src/cli/render/akuma-tool-command.js +0 -143
  322. package/build/src/cli/render/akuma-tool.d.ts +0 -29
  323. package/build/src/cli/render/akuma-tool.js +0 -225
  324. package/build/src/debt/context.d.ts +0 -28
  325. package/build/src/debt/context.js +0 -102
  326. package/build/src/debt/created-observation.d.ts +0 -26
  327. package/build/src/debt/created-observation.js +0 -38
  328. package/build/src/debt/query.d.ts +0 -80
  329. package/build/src/debt/query.js +0 -283
  330. package/build/src/library/contract-execution.d.ts +0 -28
  331. package/build/src/library/contract-execution.js +0 -506
  332. package/build/src/library/keiyaku-policy.d.ts +0 -27
  333. package/build/src/library/keiyaku-policy.js +0 -44
  334. package/build/src/library/keiyaku-status.d.ts +0 -1487
  335. package/build/src/library/keiyaku-status.js +0 -92
@@ -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 = {
@@ -41,40 +41,24 @@ const reviewFields = {
41
41
  const bindValueSchema = z.strictObject(bindFields).readonly();
42
42
  const amendValueSchema = z.strictObject(amendFields).readonly();
43
43
  const localRecoveries = { recoverySnapshots: z.array(snapshotIdSchema).min(1).readonly().exactOptional() };
44
+ export const bindNormalOutcomeSchema = acceptedOutcomeSchema({ ...bindFields, ...localRecoveries }, optionalLocalIssueSchema);
44
45
  const bindOutcomes = operationOutcomeSchema(bindFields, operationRefusalSchemas.bind, localIssueSchema);
45
46
  export const bindOutcomeSchema = z.union([
46
47
  bindOutcomes.options[0].unwrap().extend(localRecoveries).readonly(),
47
48
  bindOutcomes.options[1].unwrap().omit({ contractId: true }).readonly(),
48
49
  ...retrySchema.options,
49
50
  ]);
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
- ]);
51
+ export const amendOutcomeSchema = operationOutcomeSchema({ ...amendFields, ...localRecoveries }, operationRefusalSchemas.amend, localIssueSchema);
57
52
  export const deliverOutcomeSchema = z.union([
58
- operationOutcomeSchema(deliveredValueSchema.unwrap().shape, operationRefusalSchemas.deliver, completionIssueSchema),
53
+ operationOutcomeSchema(deliveredValueSchema.unwrap().shape, operationRefusalSchemas.deliver, invocationIssueSchema),
59
54
  handoffOutcomeSchema,
60
55
  ]);
61
56
  const verifyOutcomes = operationOutcomeSchema({ ...verifyValueSchema.unwrap().shape, continuation: continuationReportSchema.exactOptional() }, operationRefusalSchemas.verify, invocationIssueSchema);
57
+ export const verifyNormalOutcomeSchema = acceptedOutcomeSchema({ ...verifyNormalValueSchema.unwrap().shape, continuation: continuationNormalReportSchema.exactOptional() }, optionalInvocationIssueSchema);
62
58
  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
- ]);
59
+ export const reviewOutcomeSchema = operationOutcomeSchema(reviewFields, operationRefusalSchemas.review, invocationIssueSchema);
60
+ export const arcOutcomeSchema = operationOutcomeSchema({ chapter: z.number().int().positive(), ...localRecoveries }, operationRefusalSchemas.arc, localIssueSchema);
61
+ export const abandonOutcomeSchema = operationOutcomeSchema(localRecoveries, operationRefusalSchemas.abandon, localIssueSchema);
78
62
  const previewIssues = { issues: z.array(previewIssueSchema).min(1).readonly().exactOptional() };
79
63
  export const deliveryPreviewOutcomeSchema = z.union([
80
64
  deliveryPreviewReportSchema.options[0].unwrap().extend(previewIssues).readonly(),
@@ -87,16 +71,6 @@ export const deliveryPreviewOutcomeSchema = z.union([
87
71
  })
88
72
  .readonly(),
89
73
  ]);
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
74
  export function retainAdmission(accumulator, contract, leading) {
101
75
  accumulator.recordPublication(contract, leading.head, leading.facts);
102
76
  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,56 @@
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;
28
29
  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>>>>>;
30
+ gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>>;
30
31
  after: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>>>>;
31
32
  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
33
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
36
34
  kind: z.ZodLiteral<"deliver">;
35
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
36
+ at: z.ZodString;
37
37
  candidate: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
38
38
  integration: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
39
39
  contentId: z.ZodString;
40
40
  predecessor: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
41
41
  note: z.ZodExactOptional<z.ZodString>;
42
42
  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
43
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
47
44
  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
45
  id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
51
46
  at: z.ZodString;
52
- actor: z.ZodExactOptional<z.ZodString>;
47
+ predecessor: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
48
+ integration: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
53
49
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
54
50
  kind: z.ZodLiteral<"attestation">;
55
- gate: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").Gate, string>>;
51
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
52
+ at: z.ZodString;
53
+ gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
56
54
  requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
57
55
  verdict: z.ZodEnum<{
58
56
  satisfied: "satisfied";
@@ -60,29 +58,23 @@ export declare const contractHistoryEventSchema: z.ZodUnion<readonly [z.ZodReado
60
58
  }>;
61
59
  subject: z.ZodString;
62
60
  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
61
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
67
62
  kind: z.ZodLiteral<"claimed">;
68
- deliveryId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
69
63
  id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
70
64
  at: z.ZodString;
71
- actor: z.ZodExactOptional<z.ZodString>;
65
+ deliveryId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
72
66
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
73
67
  kind: z.ZodLiteral<"arc">;
68
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
69
+ at: z.ZodString;
74
70
  chapter: z.ZodNumber;
75
71
  title: z.ZodString;
76
72
  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
73
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
81
74
  kind: z.ZodLiteral<"abandoned">;
82
- note: z.ZodExactOptional<z.ZodString>;
83
75
  id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
84
76
  at: z.ZodString;
85
- actor: z.ZodExactOptional<z.ZodString>;
77
+ note: z.ZodExactOptional<z.ZodString>;
86
78
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
87
79
  kind: z.ZodLiteral<"dispatch">;
88
80
  at: z.ZodString;
@@ -93,51 +85,49 @@ export declare const contractHistorySchema: z.ZodUnion<readonly [z.ZodReadonly<z
93
85
  contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
94
86
  events: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
95
87
  kind: z.ZodLiteral<"bind">;
88
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
89
+ at: z.ZodString;
96
90
  start: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
97
91
  target: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodString, z.ZodReadonly<z.ZodObject<{
98
92
  kind: z.ZodLiteral<"contract">;
99
93
  contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
100
94
  }, z.core.$strict>>]>>;
101
- gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").Gate, string>>>>>;
95
+ gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>>;
102
96
  after: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>>>>;
103
97
  document: z.ZodExactOptional<z.ZodString>;
104
98
  targetIncarnation: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
105
99
  id: z.ZodString;
106
100
  identity: z.ZodString;
107
101
  }, 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
102
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
112
103
  kind: z.ZodLiteral<"amend">;
104
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
105
+ at: z.ZodString;
113
106
  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>>>>>;
107
+ gates: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>>;
115
108
  after: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>>>>;
116
109
  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
110
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
121
111
  kind: z.ZodLiteral<"deliver">;
112
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
113
+ at: z.ZodString;
122
114
  candidate: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
123
115
  integration: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
124
116
  contentId: z.ZodString;
125
117
  predecessor: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
126
118
  note: z.ZodExactOptional<z.ZodString>;
127
119
  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
120
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
132
121
  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
122
  id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
136
123
  at: z.ZodString;
137
- actor: z.ZodExactOptional<z.ZodString>;
124
+ predecessor: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
125
+ integration: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
138
126
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
139
127
  kind: z.ZodLiteral<"attestation">;
140
- gate: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").Gate, string>>;
128
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
129
+ at: z.ZodString;
130
+ gate: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
141
131
  requirement: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").RequirementId, string>>;
142
132
  verdict: z.ZodEnum<{
143
133
  satisfied: "satisfied";
@@ -145,29 +135,23 @@ export declare const contractHistorySchema: z.ZodUnion<readonly [z.ZodReadonly<z
145
135
  }>;
146
136
  subject: z.ZodString;
147
137
  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
138
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
152
139
  kind: z.ZodLiteral<"claimed">;
153
- deliveryId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
154
140
  id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
155
141
  at: z.ZodString;
156
- actor: z.ZodExactOptional<z.ZodString>;
142
+ deliveryId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
157
143
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
158
144
  kind: z.ZodLiteral<"arc">;
145
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
146
+ at: z.ZodString;
159
147
  chapter: z.ZodNumber;
160
148
  title: z.ZodString;
161
149
  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
150
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
166
151
  kind: z.ZodLiteral<"abandoned">;
167
- note: z.ZodExactOptional<z.ZodString>;
168
152
  id: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").EntryUlid, string>>;
169
153
  at: z.ZodString;
170
- actor: z.ZodExactOptional<z.ZodString>;
154
+ note: z.ZodExactOptional<z.ZodString>;
171
155
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
172
156
  kind: z.ZodLiteral<"dispatch">;
173
157
  at: z.ZodString;
@@ -176,8 +160,8 @@ export declare const contractHistorySchema: z.ZodUnion<readonly [z.ZodReadonly<z
176
160
  dispatches: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
177
161
  kind: z.ZodLiteral<"unavailable">;
178
162
  category: z.ZodEnum<{
179
- internal: "internal";
180
163
  "authority-corruption": "authority-corruption";
164
+ internal: "internal";
181
165
  }>;
182
166
  diagnostic: z.ZodString;
183
167
  }, z.core.$strict>>>;
@@ -195,8 +179,6 @@ type MarkdownBindInput = Readonly<{
195
179
  debt?: DebtId;
196
180
  /** A literal target branch; `null` is deliberately targetless; omitted is the Repo worktree's current branch. */
197
181
  target?: string | null;
198
- workspace?: "worktree";
199
- actor?: string;
200
182
  after?: readonly ContractId[];
201
183
  gates?: readonly string[];
202
184
  }>;
@@ -204,24 +186,18 @@ type ForkBindInput = Readonly<{
204
186
  forkOf: ContractId;
205
187
  /** A literal target branch; `null` clears the source target; omitted inherits it. */
206
188
  target?: string | null;
207
- workspace?: "worktree";
208
- actor?: string;
209
189
  }>;
210
190
  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. */
191
+ /** Contract-local composition: one captured Settings selection. */
215
192
  export type KeisOptions = Readonly<{
216
193
  settings?: Settings;
217
- actor?: ActorId;
218
194
  }>;
219
- export type AmendInput = ActorOptions & Readonly<{
195
+ export type AmendInput = Readonly<{
220
196
  markdown?: string;
221
197
  after?: readonly ContractId[];
222
198
  gates?: readonly string[];
223
199
  }>;
224
- export type ArcInput = ActorOptions & Readonly<{
200
+ export type ArcInput = Readonly<{
225
201
  markdown: string;
226
202
  }>;
227
203
  export type ContractListInput = Readonly<{
@@ -283,12 +259,12 @@ export declare const contractResolutionSchema: z.ZodUnion<readonly [z.ZodReadonl
283
259
  }, z.core.$strict>>]>;
284
260
  export type ContractSelectorRefusal = z.output<typeof contractSelectorRefusalSchema>;
285
261
  export type ContractResolution = z.output<typeof contractResolutionSchema>;
286
- export type ReviewInput = ActorOptions & Readonly<{
262
+ export type ReviewInput = Readonly<{
287
263
  verdict: AttestationData["verdict"];
288
264
  summary: string;
289
265
  signal?: AbortSignal;
290
266
  }>;
291
- export type AbandonInput = ActorOptions & Readonly<{
267
+ export type AbandonInput = Readonly<{
292
268
  note?: string;
293
269
  }>;
294
270
  export type VerifyInput = Readonly<{
@@ -303,4 +279,3 @@ export type DeliverInput = Readonly<{
303
279
  overwrite?: boolean;
304
280
  signal?: AbortSignal;
305
281
  }>;
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,43 @@ 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", {
34
29
  changedSections: z.array(z.string()).readonly().exactOptional(),
35
30
  gates: historyGates,
36
31
  after: historyAfter,
37
32
  document: z.string().exactOptional(),
38
- })
39
- .readonly(),
40
- z
41
- .strictObject({
42
- ...historyCommon,
43
- kind: z.literal("deliver"),
33
+ }),
34
+ historyEvent("deliver", {
44
35
  candidate: snapshotIdSchema,
45
36
  integration: snapshotIdSchema,
46
37
  contentId: z.string(),
47
38
  predecessor: snapshotIdSchema,
48
39
  note: z.string().exactOptional(),
49
40
  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"),
41
+ }),
42
+ historyEvent("reintegrated", { predecessor: snapshotIdSchema, integration: snapshotIdSchema }),
43
+ historyEvent("attestation", {
64
44
  gate: gateSchema,
65
45
  requirement: requirementIdSchema,
66
46
  verdict: verdictSchema,
67
47
  subject: z.string(),
68
48
  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(),
49
+ }),
50
+ historyEvent("claimed", { deliveryId: entryUlidSchema }),
51
+ historyEvent("arc", { chapter: z.number().int().positive(), title: z.string(), body: z.string().exactOptional() }),
52
+ historyEvent("abandoned", { note: z.string().exactOptional() }),
94
53
  z
95
54
  .strictObject({
96
55
  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<{