@astrosheep/keiyaku 4.6.7 → 4.6.9

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 (336) hide show
  1. package/README.md +46 -16
  2. package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
  3. package/build/plugins/claude/skills/keiyaku/SKILL.md +5 -6
  4. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +1 -1
  5. package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +8 -8
  6. package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +1 -1
  7. package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +9 -9
  8. package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +91 -0
  9. package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +2 -2
  10. package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
  11. package/build/plugins/codex/skills/keiyaku/SKILL.md +5 -6
  12. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +1 -1
  13. package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +8 -8
  14. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +1 -1
  15. package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +9 -9
  16. package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +91 -0
  17. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +2 -2
  18. package/build/plugins/opencode/index.js +1 -1
  19. package/build/plugins/opencode/skills/keiyaku/SKILL.md +5 -6
  20. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +1 -1
  21. package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +8 -8
  22. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +1 -1
  23. package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +9 -9
  24. package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +91 -0
  25. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +2 -2
  26. package/build/plugins/pi/keiyaku.ts +0 -5
  27. package/build/skills/keiyaku/SKILL.md +5 -6
  28. package/build/skills/keiyaku-akuma/SKILL.md +1 -1
  29. package/build/skills/keiyaku-akuma/references/automation.md +8 -8
  30. package/build/skills/keiyaku-babysit/SKILL.md +1 -1
  31. package/build/skills/keiyaku-bind/SKILL.md +9 -9
  32. package/build/skills/keiyaku-debt/SKILL.md +91 -0
  33. package/build/skills/keiyaku-workflow/SKILL.md +2 -2
  34. package/build/src/akuma/akuma-call.d.ts +2 -0
  35. package/build/src/akuma/akuma-call.js +8 -2
  36. package/build/src/akuma/akuma-instance.d.ts +14 -1
  37. package/build/src/akuma/akuma-instance.js +37 -7
  38. package/build/src/akuma/akuma-observe.d.ts +33 -8
  39. package/build/src/akuma/akuma-observe.js +89 -63
  40. package/build/src/akuma/akuma-owner.d.ts +14 -2
  41. package/build/src/akuma/akuma-owner.js +49 -35
  42. package/build/src/akuma/akuma-selection-execution.js +9 -1
  43. package/build/src/akuma/akuma-stream.d.ts +22 -0
  44. package/build/src/akuma/akuma-stream.js +116 -0
  45. package/build/src/akuma/akuma-wait.d.ts +1 -40
  46. package/build/src/akuma/akuma-wait.js +23 -84
  47. package/build/src/akuma/akuma.d.ts +52 -16
  48. package/build/src/akuma/akuma.js +10 -10
  49. package/build/src/akuma/allowed.d.ts +7 -12
  50. package/build/src/akuma/allowed.js +13 -4
  51. package/build/src/akuma/archetype.d.ts +7 -15
  52. package/build/src/akuma/archetype.js +36 -35
  53. package/build/src/akuma/body-supervisor.d.ts +5 -5
  54. package/build/src/akuma/body-supervisor.js +22 -20
  55. package/build/src/akuma/body.d.ts +5 -3
  56. package/build/src/akuma/body.js +57 -8
  57. package/build/src/akuma/call-request.d.ts +30 -32
  58. package/build/src/akuma/call-request.js +10 -3
  59. package/build/src/akuma/caller.d.ts +39 -0
  60. package/build/src/akuma/caller.js +36 -0
  61. package/build/src/akuma/dispatch-association.d.ts +0 -1
  62. package/build/src/akuma/dispatch-association.js +0 -3
  63. package/build/src/akuma/heart/activity-schema.d.ts +12 -0
  64. package/build/src/akuma/heart/activity-schema.js +6 -0
  65. package/build/src/akuma/heart/facts.d.ts +16 -12
  66. package/build/src/akuma/heart/facts.js +8 -0
  67. package/build/src/akuma/heart/index.d.ts +61 -9
  68. package/build/src/akuma/heart/index.js +89 -24
  69. package/build/src/akuma/heart/rows.d.ts +3 -3
  70. package/build/src/akuma/heart/rows.js +5 -3
  71. package/build/src/akuma/heart/soul.d.ts +10 -1
  72. package/build/src/akuma/heart/soul.js +34 -24
  73. package/build/src/akuma/heart/storage.d.ts +20 -0
  74. package/build/src/akuma/heart/storage.js +62 -3
  75. package/build/src/akuma/heart/timeline.d.ts +7 -0
  76. package/build/src/akuma/heart/timeline.js +10 -0
  77. package/build/src/akuma/identity.d.ts +0 -1
  78. package/build/src/akuma/identity.js +2 -5
  79. package/build/src/akuma/index.d.ts +6 -2
  80. package/build/src/akuma/index.js +1 -0
  81. package/build/src/akuma/nuke.js +6 -28
  82. package/build/src/akuma/projection.d.ts +25 -11
  83. package/build/src/akuma/projection.js +24 -7
  84. package/build/src/akuma/provider-recipe.d.ts +18 -6
  85. package/build/src/akuma/provider-recipe.js +24 -1
  86. package/build/src/akuma/provider.d.ts +31 -10
  87. package/build/src/akuma/provider.js +105 -14
  88. package/build/src/akuma/providers/acp/events.js +29 -19
  89. package/build/src/akuma/providers/acp/index.js +2 -3
  90. package/build/src/akuma/providers/claude/events.js +110 -69
  91. package/build/src/akuma/providers/claude/index.d.ts +2 -2
  92. package/build/src/akuma/providers/claude/index.js +4 -8
  93. package/build/src/akuma/providers/codex-app-server/events.js +17 -2
  94. package/build/src/akuma/providers/codex-app-server/index.js +17 -11
  95. package/build/src/akuma/providers/decode.d.ts +33 -0
  96. package/build/src/akuma/providers/decode.js +65 -0
  97. package/build/src/akuma/providers/execution-environment.d.ts +2 -1
  98. package/build/src/akuma/providers/execution-environment.js +3 -0
  99. package/build/src/akuma/providers/grok-build/index.js +16 -48
  100. package/build/src/akuma/providers/index.js +2 -0
  101. package/build/src/akuma/providers/lifecycle.d.ts +9 -0
  102. package/build/src/akuma/providers/lifecycle.js +10 -0
  103. package/build/src/akuma/providers/opencode-sdk/event-stream.d.ts +3 -3
  104. package/build/src/akuma/providers/opencode-sdk/event-stream.js +2 -25
  105. package/build/src/akuma/providers/opencode-sdk/events.d.ts +7 -43
  106. package/build/src/akuma/providers/opencode-sdk/events.js +146 -296
  107. package/build/src/akuma/providers/opencode-sdk/index.js +270 -431
  108. package/build/src/akuma/providers/opencode-sdk/native-http.d.ts +9 -0
  109. package/build/src/akuma/providers/opencode-sdk/native-http.js +69 -0
  110. package/build/src/akuma/providers/opencode-sdk/session.d.ts +42 -36
  111. package/build/src/akuma/providers/opencode-sdk/session.js +75 -84
  112. package/build/src/akuma/providers/paseo/events.d.ts +33 -0
  113. package/build/src/akuma/providers/paseo/events.js +204 -0
  114. package/build/src/akuma/providers/paseo/index.d.ts +9 -0
  115. package/build/src/akuma/providers/paseo/index.js +357 -0
  116. package/build/src/akuma/providers/pi/events.d.ts +2 -0
  117. package/build/src/akuma/providers/pi/events.js +36 -38
  118. package/build/src/akuma/providers/pi/index.js +21 -35
  119. package/build/src/akuma/publication.d.ts +2 -0
  120. package/build/src/akuma/publication.js +5 -0
  121. package/build/src/akuma/request-lifecycle.d.ts +4 -2
  122. package/build/src/akuma/request-lifecycle.js +27 -12
  123. package/build/src/akuma/request-rendezvous.js +38 -55
  124. package/build/src/akuma/request-serve.d.ts +1 -1
  125. package/build/src/akuma/request-serve.js +77 -113
  126. package/build/src/akuma/requests.d.ts +3 -1
  127. package/build/src/akuma/requests.js +32 -0
  128. package/build/src/akuma/selection-observation.d.ts +129 -53
  129. package/build/src/akuma/selection-observation.js +3 -9
  130. package/build/src/akuma/turn-drive.d.ts +3 -0
  131. package/build/src/akuma/turn-drive.js +28 -10
  132. package/build/src/akuma-body.js +12 -22
  133. package/build/src/cli/akuma-caller.d.ts +3 -0
  134. package/build/src/cli/akuma-caller.js +31 -0
  135. package/build/src/cli/commands/akuma-grammar.js +10 -16
  136. package/build/src/cli/commands/akuma.js +25 -55
  137. package/build/src/cli/commands/contract-grammar.d.ts +9 -7
  138. package/build/src/cli/commands/contract-grammar.js +40 -47
  139. package/build/src/cli/commands/contract-help.d.ts +17 -7
  140. package/build/src/cli/commands/contract-help.js +50 -11
  141. package/build/src/cli/commands/contract.js +34 -63
  142. package/build/src/cli/commands/debt-grammar.d.ts +19 -0
  143. package/build/src/cli/commands/debt-grammar.js +323 -0
  144. package/build/src/cli/commands/debt-query.d.ts +5 -0
  145. package/build/src/cli/commands/{task-query.js → debt-query.js} +9 -9
  146. package/build/src/cli/commands/{task.d.ts → debt.d.ts} +2 -2
  147. package/build/src/cli/commands/{task.js → debt.js} +87 -164
  148. package/build/src/cli/coordinates.d.ts +1 -1
  149. package/build/src/cli/coordinates.js +1 -1
  150. package/build/src/cli/parse.d.ts +5 -5
  151. package/build/src/cli/parse.js +17 -16
  152. package/build/src/cli/render/akuma-activity.d.ts +11 -83
  153. package/build/src/cli/render/akuma-activity.js +20 -382
  154. package/build/src/cli/render/catalog.d.ts +4 -7
  155. package/build/src/cli/render/catalog.js +5 -5
  156. package/build/src/cli/render/contract-history.js +3 -6
  157. package/build/src/cli/render/contract.js +17 -52
  158. package/build/src/cli/render/debt.d.ts +28 -0
  159. package/build/src/cli/render/{task.js → debt.js} +55 -133
  160. package/build/src/cli/render/kanshi.js +28 -28
  161. package/build/src/cli/render/marks.d.ts +5 -5
  162. package/build/src/cli/render/marks.js +4 -10
  163. package/build/src/cli/render/nuke.js +1 -1
  164. package/build/src/cli/render/receipt.js +3 -10
  165. package/build/src/cli/runtime.d.ts +1 -1
  166. package/build/src/cli/runtime.js +14 -20
  167. package/build/src/cli/scan.d.ts +1 -1
  168. package/build/src/cli/selectors.d.ts +3 -6
  169. package/build/src/cli/selectors.js +22 -53
  170. package/build/src/cli/usage.d.ts +1 -1
  171. package/build/src/cli/usage.js +4 -4
  172. package/build/src/contract-worktree.js +3 -3
  173. package/build/src/debt/board.d.ts +160 -0
  174. package/build/src/{task → debt}/board.js +89 -89
  175. package/build/src/debt/catalog.d.ts +11 -0
  176. package/build/src/debt/catalog.js +59 -0
  177. package/build/src/{task → debt}/context.d.ts +1 -1
  178. package/build/src/{task → debt}/context.js +1 -1
  179. package/build/src/{task → debt}/created-observation.d.ts +6 -10
  180. package/build/src/{task → debt}/created-observation.js +7 -7
  181. package/build/src/debt/document.d.ts +37 -0
  182. package/build/src/{task → debt}/document.js +37 -37
  183. package/build/src/debt/identity.d.ts +21 -0
  184. package/build/src/{task → debt}/identity.js +35 -35
  185. package/build/src/debt/index.d.ts +111 -0
  186. package/build/src/debt/index.js +203 -0
  187. package/build/src/{task → debt}/input.d.ts +8 -8
  188. package/build/src/{task → debt}/input.js +21 -21
  189. package/build/src/debt/lifecycle-operations.d.ts +6 -0
  190. package/build/src/{task → debt}/lifecycle-operations.js +27 -31
  191. package/build/src/debt/mutation-result.d.ts +981 -0
  192. package/build/src/debt/mutation-result.js +109 -0
  193. package/build/src/debt/mutation.d.ts +424 -0
  194. package/build/src/debt/mutation.js +223 -0
  195. package/build/src/debt/operation-types.d.ts +71 -0
  196. package/build/src/debt/operations.d.ts +28 -0
  197. package/build/src/{task → debt}/operations.js +59 -60
  198. package/build/src/debt/query.d.ts +76 -0
  199. package/build/src/{task → debt}/query.js +55 -55
  200. package/build/src/{task → debt}/store.d.ts +13 -13
  201. package/build/src/{task → debt}/store.js +58 -49
  202. package/build/src/debt/view.d.ts +4 -0
  203. package/build/src/debt/view.js +7 -0
  204. package/build/src/dispatch/index.d.ts +3 -3
  205. package/build/src/dispatch/index.js +1 -2
  206. package/build/src/git/observe.d.ts +6 -2
  207. package/build/src/git/observe.js +6 -2
  208. package/build/src/identity/coordinates.d.ts +1 -1
  209. package/build/src/index.d.ts +17 -17
  210. package/build/src/index.js +11 -11
  211. package/build/src/kanshi/index.d.ts +2 -2
  212. package/build/src/kanshi/read.js +54 -39
  213. package/build/src/kanshi/report.d.ts +7 -7
  214. package/build/src/kanshi/select.js +4 -4
  215. package/build/src/library/address.js +2 -4
  216. package/build/src/library/akuma-creation.d.ts +5 -1
  217. package/build/src/library/akuma-creation.js +27 -47
  218. package/build/src/library/akumas.d.ts +7 -7
  219. package/build/src/library/akumas.js +13 -9
  220. package/build/src/library/bind.d.ts +17 -17
  221. package/build/src/library/bind.js +16 -12
  222. package/build/src/library/contract-address.d.ts +9 -0
  223. package/build/src/library/contract-address.js +71 -0
  224. package/build/src/library/contract-composition.d.ts +4 -7
  225. package/build/src/library/contract-composition.js +6 -18
  226. package/build/src/library/contract-creation.d.ts +3 -5
  227. package/build/src/library/contract-creation.js +24 -22
  228. package/build/src/library/contract-execution.js +21 -26
  229. package/build/src/library/contract-outcomes.d.ts +2 -14
  230. package/build/src/library/contract-outcomes.js +2 -13
  231. package/build/src/library/contract-types.d.ts +38 -4
  232. package/build/src/library/delivery.d.ts +0 -2
  233. package/build/src/library/delivery.js +2 -5
  234. package/build/src/library/input.d.ts +2 -2
  235. package/build/src/library/input.js +5 -5
  236. package/build/src/library/invocation.js +2 -2
  237. package/build/src/library/keiyaku.d.ts +0 -5
  238. package/build/src/library/keiyaku.js +6 -12
  239. package/build/src/library/nuke.js +3 -3
  240. package/build/src/library/outcome.d.ts +626 -625
  241. package/build/src/library/outcome.js +13 -3
  242. package/build/src/library/reconcile.js +8 -16
  243. package/build/src/library/refusal.d.ts +2 -2
  244. package/build/src/library/repo.d.ts +3 -2
  245. package/build/src/library/repo.js +10 -5
  246. package/build/src/library/selection.d.ts +5 -8
  247. package/build/src/library/selection.js +22 -73
  248. package/build/src/plugin/akuma-signals.d.ts +2 -0
  249. package/build/src/plugin/akuma-signals.js +4 -0
  250. package/build/src/plugin/public.d.ts +32 -2
  251. package/build/src/plugin/runtime.js +5 -3
  252. package/build/src/protocol/amend.js +3 -2
  253. package/build/src/protocol/attempt.js +3 -8
  254. package/build/src/protocol/bind.d.ts +2 -2
  255. package/build/src/protocol/bind.js +1 -1
  256. package/build/src/protocol/deliver.js +3 -3
  257. package/build/src/protocol/operations.d.ts +1 -3
  258. package/build/src/protocol/operations.js +0 -8
  259. package/build/src/protocol/outcome.d.ts +1 -2
  260. package/build/src/protocol/outcome.js +1 -13
  261. package/build/src/protocol/placement.js +3 -10
  262. package/build/src/protocol/read/status.js +31 -70
  263. package/build/src/protocol/reintegrate.js +3 -10
  264. package/build/src/protocol/review.js +3 -3
  265. package/build/src/protocol/run.d.ts +5 -1
  266. package/build/src/protocol/run.js +3 -3
  267. package/build/src/runtime/proc/windows-launch.exe +0 -0
  268. package/build/src/settlement/fence.d.ts +3 -3
  269. package/build/src/settlement/fence.js +4 -4
  270. package/build/src/settlement/holder.d.ts +16 -16
  271. package/build/src/settlement/holder.js +69 -63
  272. package/build/src/settlement/settle.d.ts +5 -5
  273. package/build/src/settlement/settle.js +53 -53
  274. package/package.json +19 -9
  275. package/plugins/paseo/plugin/index.server.ts +17 -0
  276. package/plugins/paseo/plugin/paseo-plugin.json +4 -0
  277. package/plugins/paseo/plugin/server/attach.ts +52 -0
  278. package/plugins/paseo/plugin/server/keiyaku.ts +44 -0
  279. package/plugins/paseo/plugin/server/message.ts +60 -0
  280. package/plugins/paseo/plugin/server/mirror.ts +193 -0
  281. package/plugins/paseo/plugin/server/model.ts +14 -0
  282. package/plugins/paseo/plugin/server/provider.ts +276 -0
  283. package/plugins/paseo/plugin/server/sdk-worker.ts +237 -0
  284. package/plugins/paseo/plugin/server/sdk.ts +289 -0
  285. package/plugins/paseo/plugin/server/stop.ts +26 -0
  286. package/plugins/paseo/plugin/server/transport.ts +35 -0
  287. package/plugins/paseo/plugin/shared/attach-rpc.ts +10 -0
  288. package/plugins/paseo/plugin/shared/refresh-rpc.ts +6 -0
  289. package/plugins/paseo/plugin/tsconfig.json +6 -0
  290. package/plugins/pi/keiyaku.ts +57 -0
  291. package/skills/keiyaku/SKILL.md +43 -0
  292. package/skills/keiyaku-akuma/SKILL.md +130 -0
  293. package/skills/keiyaku-akuma/references/automation.md +269 -0
  294. package/skills/keiyaku-babysit/SKILL.md +65 -0
  295. package/skills/keiyaku-bind/SKILL.md +216 -0
  296. package/skills/keiyaku-bind/agents/openai.yaml +4 -0
  297. package/skills/keiyaku-debt/SKILL.md +91 -0
  298. package/skills/keiyaku-workflow/SKILL.md +129 -0
  299. package/build/plugins/claude/skills/keiyaku-task/SKILL.md +0 -104
  300. package/build/plugins/codex/skills/keiyaku-task/SKILL.md +0 -104
  301. package/build/plugins/opencode/skills/keiyaku-task/SKILL.md +0 -104
  302. package/build/skills/keiyaku-task/SKILL.md +0 -104
  303. package/build/src/cli/commands/amend.d.ts +0 -12
  304. package/build/src/cli/commands/amend.js +0 -10
  305. package/build/src/cli/commands/bind.d.ts +0 -11
  306. package/build/src/cli/commands/bind.js +0 -23
  307. package/build/src/cli/commands/task-grammar.d.ts +0 -19
  308. package/build/src/cli/commands/task-grammar.js +0 -384
  309. package/build/src/cli/commands/task-query.d.ts +0 -5
  310. package/build/src/cli/render/task.d.ts +0 -41
  311. package/build/src/dispatch/association.d.ts +0 -1
  312. package/build/src/dispatch/association.js +0 -1
  313. package/build/src/task/board.d.ts +0 -168
  314. package/build/src/task/catalog.d.ts +0 -11
  315. package/build/src/task/catalog.js +0 -59
  316. package/build/src/task/compose-language.d.ts +0 -57
  317. package/build/src/task/compose-language.js +0 -364
  318. package/build/src/task/compose-parser.d.ts +0 -32
  319. package/build/src/task/compose-parser.js +0 -180
  320. package/build/src/task/compose.d.ts +0 -16
  321. package/build/src/task/compose.js +0 -189
  322. package/build/src/task/document.d.ts +0 -39
  323. package/build/src/task/identity.d.ts +0 -21
  324. package/build/src/task/index.d.ts +0 -138
  325. package/build/src/task/index.js +0 -269
  326. package/build/src/task/lifecycle-operations.d.ts +0 -6
  327. package/build/src/task/mutation-result.d.ts +0 -1726
  328. package/build/src/task/mutation-result.js +0 -198
  329. package/build/src/task/mutation.d.ts +0 -590
  330. package/build/src/task/mutation.js +0 -262
  331. package/build/src/task/operation-types.d.ts +0 -71
  332. package/build/src/task/operations.d.ts +0 -28
  333. package/build/src/task/query.d.ts +0 -76
  334. package/build/src/task/view.d.ts +0 -4
  335. package/build/src/task/view.js +0 -7
  336. /package/build/src/{task → debt}/operation-types.js +0 -0
@@ -7,26 +7,32 @@ import { withGitDecodeChannel } from "../git/read-observation.js";
7
7
  import { executionStop, isOperationalFailure, isOperationalStop } from "../protocol/progress.js";
8
8
  import { readManagedWorktreeAppointment } from "../workspace-place.js";
9
9
  import { admitForkBindWithAppointment, prepareMarkdownBind } from "./bind.js";
10
- import { acceptedOutcome, conclusions, expected, retainAdmission } from "./contract-outcomes.js";
10
+ import { acceptedOutcome, expected, retainAdmission } from "./contract-outcomes.js";
11
11
  import { captureLocalContractComposition, derivedGates, derivedHooks, gateNames, } from "./contract-settings.js";
12
- import { actorOption, normalizedList, requireInput, requireMarkdown, taskOption } from "./input.js";
12
+ import { actorOption, normalizedList, requireInput, requireMarkdown, debtOption } from "./input.js";
13
13
  import { InvocationAccumulator } from "./invocation.js";
14
14
  import { project, validated } from "./outcome.js";
15
15
  import { reconcileAffectedContracts } from "./reconcile.js";
16
16
  import { observeRegion } from "./region.js";
17
17
  import { scopeForRepo } from "./repo.js";
18
+ /** The one place a caller's omitted target becomes product behavior. */
19
+ function bindTargetSelection(target) {
20
+ if (target === undefined)
21
+ return { kind: "current-branch" };
22
+ return target === null ? { kind: "targetless" } : { kind: "explicit", target };
23
+ }
18
24
  function bindInput(input, composition) {
19
25
  return validated(() => {
20
26
  const values = requireInput(input, "Keiyaku.bind input");
21
27
  const forkOf = values.forkOf;
22
28
  const allowed = forkOf === undefined
23
- ? ["repo", "markdown", "task", "target", "workspace", "actor", "after", "gates"]
29
+ ? ["repo", "markdown", "debt", "target", "workspace", "actor", "after", "gates"]
24
30
  : ["repo", "forkOf", "target", "workspace", "actor"];
25
31
  requireInput(input, "Keiyaku.bind input", allowed);
26
32
  if ((values.workspace ?? "worktree") !== "worktree")
27
33
  throw new TypeError("workspace must be worktree");
28
- if (values.target !== undefined && typeof values.target !== "string")
29
- throw new TypeError("target must be a string");
34
+ if (values.target !== undefined && values.target !== null && typeof values.target !== "string")
35
+ throw new TypeError("target must be a string or null");
30
36
  const actor = actorOption(values.actor);
31
37
  const document = forkOf === undefined ? parseMarkdown(requireMarkdown(values.markdown)) : undefined;
32
38
  if (forkOf !== undefined) {
@@ -40,18 +46,17 @@ function bindInput(input, composition) {
40
46
  document,
41
47
  actor,
42
48
  target: values.target,
43
- task: forkOf === undefined ? taskOption(values.task) : undefined,
49
+ debt: forkOf === undefined ? debtOption(values.debt) : undefined,
44
50
  gates: derived,
45
51
  after: forkOf === undefined ? normalizedList(values.after, "after", contractId) : undefined,
46
52
  };
47
53
  });
48
54
  }
49
55
  /**
50
- * One Contract bind. `omittedMarkdownTarget` is the internal composition input an edge
51
- * supplies for a Markdown bind whose caller omitted the target: the public package-root
52
- * composition leaves it targetless, while the CLI names the invocation branch.
56
+ * One Contract bind. An omitted Markdown target names the current branch of the caller's explicit
57
+ * Repo worktree coordinate, `null` is deliberately targetless, and a string is that literal target.
53
58
  */
54
- export async function bindKeiyaku(input, createHandle, execution = localExecutionContext(), composition = captureLocalContractComposition(), omittedMarkdownTarget = { kind: "targetless" }) {
59
+ export async function bindKeiyaku(input, createHandle, execution = localExecutionContext(), composition = captureLocalContractComposition()) {
55
60
  const prepared = bindInput(input, composition);
56
61
  const hooks = derivedHooks(composition);
57
62
  const { forkOf, scope, document, target, actor } = prepared;
@@ -84,7 +89,7 @@ export async function bindKeiyaku(input, createHandle, execution = localExecutio
84
89
  }
85
90
  if (document === undefined)
86
91
  throw new Error("Markdown bind requires its prepared document");
87
- return await markdownBind(prepared, document, hooks, scope, channel, accumulator, handle, omittedMarkdownTarget);
92
+ return await markdownBind(prepared, document, hooks, scope, channel, accumulator, handle);
88
93
  })();
89
94
  return completed;
90
95
  }, (error) => {
@@ -109,19 +114,16 @@ export async function bindKeiyaku(input, createHandle, execution = localExecutio
109
114
  throw projected.error;
110
115
  return projected.outcome;
111
116
  }
112
- function bindValue(keiyaku, region, warnings, workspace, appointmentLag) {
113
- const base = {
117
+ function bindValue(keiyaku, region, warnings) {
118
+ return {
114
119
  keiyaku,
115
- ...(workspace === undefined ? {} : { workspace }),
116
120
  ...(warnings.length === 0 ? {} : { warnings }),
117
121
  ...region,
118
122
  };
119
- void appointmentLag;
120
- return base;
121
123
  }
122
124
  // eslint-disable-next-line max-params -- Keep this local operation's custody, admission, and policy witnesses explicit.
123
125
  async function bindComplete(accumulator, id, scope, channel, leading, hooks, value) {
124
- retainAdmission(accumulator, id, leading, false);
126
+ retainAdmission(accumulator, id, leading);
125
127
  await reconcileAffectedContracts(accumulator, id, scope, channel, hooks);
126
128
  try {
127
129
  const appointment = await readManagedWorktreeAppointment(scope, id);
@@ -136,15 +138,15 @@ async function bindComplete(accumulator, id, scope, channel, leading, hooks, val
136
138
  accumulator.recordStop(executionStop(id, "reconciliation", error, scope.signal));
137
139
  }
138
140
  const built = { ...(await value()), ...accumulator.conclusions(id) };
139
- accumulator.extendConclusions(id, conclusions(built));
141
+ accumulator.extendConclusions(id, built);
140
142
  return built;
141
143
  }
142
144
  // eslint-disable-next-line max-params -- Keep this local operation's custody, admission, and policy witnesses explicit.
143
- async function markdownBind(prepared, document, hooks, scope, channel, accumulator, handle, omittedMarkdownTarget) {
144
- const { task, target, actor, gates, after } = prepared;
145
+ async function markdownBind(prepared, document, hooks, scope, channel, accumulator, handle) {
146
+ const { debt, target, actor, gates, after } = prepared;
145
147
  if (gates === undefined || after === undefined)
146
148
  throw new Error("Markdown bind requires prepared terms");
147
- const targetSelection = target !== undefined ? { kind: "explicit", target } : omittedMarkdownTarget;
149
+ const targetSelection = bindTargetSelection(target);
148
150
  const admission = await prepareMarkdownBind({
149
151
  scope,
150
152
  channel,
@@ -154,7 +156,7 @@ async function markdownBind(prepared, document, hooks, scope, channel, accumulat
154
156
  after,
155
157
  workspace: "worktree",
156
158
  targetSelection,
157
- ...(task === undefined ? {} : { task }),
159
+ ...(debt === undefined ? {} : { debt }),
158
160
  ...actor,
159
161
  });
160
162
  const leading = admission.admission === null ? admission.result : admission.admission.result;
@@ -16,10 +16,10 @@ import { admitDeliveryOperation } from "../protocol/deliver.js";
16
16
  import { withScopeAbortSignal, } from "../protocol/operations.js";
17
17
  import { executionStop, isOperationalFailure, isOperationalStop, } from "../protocol/progress.js";
18
18
  import { admitReviewOperation } from "../protocol/review.js";
19
- import { releaseTaskHolder, releaseTaskHolderWithFence, taskHolderObservationSelection } from "../settlement/holder.js";
19
+ import { releaseDebtHolder, releaseDebtHolderWithFence, debtHolderObservationSelection } from "../settlement/holder.js";
20
20
  import { continueDeliveredDependents } from "./continuation.js";
21
21
  import { requestForwardedContractLive } from "./contract-operations.js";
22
- import { acceptedOutcome, admissionOf, conclusions, expected, retainAdmission } from "./contract-outcomes.js";
22
+ import { acceptedOutcome, expected, retainAdmission } from "./contract-outcomes.js";
23
23
  import { derivedContractPolicy, derivedGates, derivedHooks, gateNames, } from "./contract-settings.js";
24
24
  import { deliveryForContract } from "./delivery.js";
25
25
  import { actorOption, contractTerms, documentDerivation, normalizedList, optionalBoolean, optionalNonblank, optionalSignal, requireInput, requireMarkdown, } from "./input.js";
@@ -66,7 +66,7 @@ export class ContractExecution {
66
66
  });
67
67
  let changedSections;
68
68
  return await this.local("amend", async (accumulator, channel, scope) => {
69
- const admission = admissionOf(await amendOperation({
69
+ const admission = await amendOperation({
70
70
  scope,
71
71
  channel,
72
72
  contractId: this.id,
@@ -87,20 +87,18 @@ export class ContractExecution {
87
87
  : contractTerms(amended, gates ?? source.gates, prerequisites ?? source.after);
88
88
  return { terms, verification: documentDerivation(amended, terms.gates, this.id).verification };
89
89
  },
90
- }));
90
+ });
91
91
  if (admission.kind !== "accepted")
92
92
  return expected(this.id, admission);
93
- const accepted = admission.accepted;
94
- const changes = changedAmendTerms(accepted.value.source, accepted.value.terms);
95
- const diff = documentDiff("before", "after", accepted.value.source.document.bytes, accepted.value.terms.document.bytes);
93
+ const changes = changedAmendTerms(admission.value.source, admission.value.terms);
94
+ const diff = documentDiff("before", "after", admission.value.source.document.bytes, admission.value.terms.document.bytes);
96
95
  accumulator.extendConclusions(this.id, { documentDiff: diff, changes });
97
- const region = await observeChangedRegion(scope, this.id, changedSections, decodeContractDocument(accepted.value.terms.document.bytes).region);
96
+ const region = await observeChangedRegion(scope, this.id, changedSections, decodeContractDocument(admission.value.terms.document.bytes).region);
98
97
  const value = await this.conclude(accumulator, {
99
98
  scope,
100
99
  channel,
101
- leading: accepted,
100
+ leading: admission,
102
101
  hooks,
103
- verificationResidueRecorded: false,
104
102
  value: () => ({
105
103
  documentDiff: diff,
106
104
  changes,
@@ -247,27 +245,26 @@ export class ContractExecution {
247
245
  });
248
246
  const hooks = derivedHooks(this.composition);
249
247
  return await this.local("abandon", async (accumulator, channel, scope) => {
250
- const admission = admissionOf((await releaseTaskHolderWithFence(scope, channel, this.id, () => abandonOperation({
248
+ const admission = (await releaseDebtHolderWithFence(scope, channel, this.id, () => abandonOperation({
251
249
  scope,
252
250
  channel,
253
251
  contractId: this.id,
254
252
  ...actor,
255
253
  ...(note === undefined ? {} : { note }),
256
- observationSelection: taskHolderObservationSelection(),
254
+ observationSelection: debtHolderObservationSelection(),
257
255
  progress: accumulator,
258
256
  decorateOffer: async ({ observation, contractId: owner }) => {
259
- const companion = await releaseTaskHolder(channel, observation, owner);
257
+ const companion = await releaseDebtHolder(channel, observation, owner);
260
258
  return companion === null ? [] : [companion];
261
259
  },
262
- }))).result);
260
+ }))).result;
263
261
  if (admission.kind !== "accepted")
264
262
  return expected(this.id, admission);
265
263
  await this.conclude(accumulator, {
266
264
  scope,
267
265
  channel,
268
- leading: admission.accepted,
266
+ leading: admission,
269
267
  hooks,
270
- verificationResidueRecorded: false,
271
268
  value: () => ({}),
272
269
  });
273
270
  return acceptedOutcome("abandon", this.id, accumulator, undefined);
@@ -283,22 +280,21 @@ export class ContractExecution {
283
280
  });
284
281
  const hooks = derivedHooks(this.composition);
285
282
  return await this.local("arc", async (accumulator, channel, scope) => {
286
- const admission = admissionOf(await arcOperation({
283
+ const admission = await arcOperation({
287
284
  scope,
288
285
  channel,
289
286
  contractId: this.id,
290
287
  ...actor,
291
288
  chapter,
292
289
  progress: accumulator,
293
- }));
290
+ });
294
291
  if (admission.kind !== "accepted")
295
292
  return expected(this.id, admission);
296
293
  await this.conclude(accumulator, {
297
294
  scope,
298
295
  channel,
299
- leading: admission.accepted,
296
+ leading: admission,
300
297
  hooks,
301
- verificationResidueRecorded: false,
302
298
  value: () => ({}),
303
299
  });
304
300
  return acceptedOutcome("arc", this.id, accumulator, undefined);
@@ -327,7 +323,7 @@ export class ContractExecution {
327
323
  });
328
324
  const { hooks, requireBranchesToBeUpToDate } = derivedContractPolicy(this.composition);
329
325
  return await this.local("audit", async (accumulator, localChannel, scope) => {
330
- const admission = admissionOf(await auditOperation({
326
+ const admission = await auditOperation({
331
327
  scope,
332
328
  channel: localChannel,
333
329
  progress: accumulator,
@@ -338,15 +334,14 @@ export class ContractExecution {
338
334
  requireBranchesToBeUpToDate,
339
335
  ...(signal === undefined ? {} : { signal }),
340
336
  ...(this.composition.actor === undefined ? {} : { actor: this.composition.actor }),
341
- }));
337
+ });
342
338
  if (admission.kind !== "accepted")
343
339
  return expected(this.id, admission);
344
340
  const report = await this.conclude(accumulator, {
345
341
  scope,
346
342
  channel: localChannel,
347
- leading: admission.accepted,
343
+ leading: admission,
348
344
  hooks,
349
- verificationResidueRecorded: false,
350
345
  value: (value) => value,
351
346
  });
352
347
  return acceptedOutcome("audit", this.id, accumulator, report);
@@ -380,9 +375,9 @@ export class ContractExecution {
380
375
  return projected.outcome;
381
376
  }
382
377
  async conclude(accumulator, input) {
383
- retainAdmission(accumulator, this.id, input.leading, input.verificationResidueRecorded);
378
+ retainAdmission(accumulator, this.id, input.leading);
384
379
  const value = input.value(input.leading.value);
385
- accumulator.extendConclusions(this.id, conclusions(value));
380
+ accumulator.extendConclusions(this.id, value);
386
381
  await reconcileAffectedContracts(accumulator, this.id, input.scope, input.channel, input.hooks);
387
382
  return value;
388
383
  }
@@ -41,17 +41,6 @@ export type BindResult = BindOutcome;
41
41
  type AcceptedIntent<Value> = Extract<IntentOutcome<Value>, {
42
42
  kind: "accepted";
43
43
  }>;
44
- type Admission<Value, Refusal> = Readonly<{
45
- kind: "accepted";
46
- accepted: AcceptedIntent<Value>;
47
- }> | Readonly<{
48
- kind: "refused";
49
- refusal: Refusal;
50
- }> | Readonly<{
51
- kind: "retry";
52
- reason: IntentRetry;
53
- }>;
54
- export declare function admissionOf<Value, Refusal>(outcome: IntentOutcome<Value, Refusal>): Admission<Value, Refusal>;
55
44
  /** The refused/retry arms are value-agnostic, so every operation can return them unchanged. */
56
45
  type ExpectedProjection<Refusal> = Readonly<{
57
46
  kind: "refused";
@@ -62,10 +51,9 @@ type ExpectedProjection<Refusal> = Readonly<{
62
51
  contract?: ContractId;
63
52
  reason: IntentRetry;
64
53
  }>;
65
- export declare function expected<Refusal>(contract: ContractId | undefined, admission: Exclude<Admission<unknown, Refusal>, {
54
+ export declare function expected<Refusal>(contract: ContractId | undefined, admission: Exclude<IntentOutcome<unknown, Refusal>, {
66
55
  kind: "accepted";
67
56
  }>): ExpectedProjection<Refusal>;
68
57
  export declare function acceptedOutcome<Operation extends ContractVerb, Value>(operation: Operation, contract: ContractId, accumulator: InvocationAccumulator, value: Value): OutcomeProjection<Operation, Value, never>;
69
- export declare function conclusions(value: object): Readonly<Record<string, unknown>>;
70
- export declare function retainAdmission<Value>(accumulator: InvocationAccumulator, contract: ContractId, leading: AcceptedIntent<Value>, verificationResidueRecorded: boolean): void;
58
+ export declare function retainAdmission<Value>(accumulator: InvocationAccumulator, contract: ContractId, leading: AcceptedIntent<Value>): void;
71
59
  export {};
@@ -1,10 +1,3 @@
1
- export function admissionOf(outcome) {
2
- if (outcome.kind === "accepted")
3
- return { kind: "accepted", accepted: outcome };
4
- return outcome.kind === "refused"
5
- ? { kind: "refused", refusal: outcome.refusal }
6
- : { kind: "retry", reason: outcome.reason };
7
- }
8
1
  export function expected(contract, admission) {
9
2
  return admission.kind === "refused"
10
3
  ? {
@@ -21,12 +14,8 @@ export function acceptedOutcome(operation, contract, accumulator, value) {
21
14
  throw new Error("missing leading admission receipt");
22
15
  return { kind: "accepted", contract, head, value };
23
16
  }
24
- export function conclusions(value) {
25
- return value;
26
- }
27
- export function retainAdmission(accumulator, contract, leading, verificationResidueRecorded) {
17
+ export function retainAdmission(accumulator, contract, leading) {
28
18
  accumulator.recordPublication(contract, leading.head, leading.facts);
29
19
  accumulator.recordResidue(contract, leading);
30
- if (!verificationResidueRecorded)
31
- accumulator.recordVerification(contract, undefined, leading);
20
+ accumulator.recordVerification(contract, undefined, leading);
32
21
  }
@@ -2,7 +2,7 @@ import type { AttestationData, ContractId, JournalEntry, SnapshotId } from "../c
2
2
  import type { Dispatch } from "../dispatch/index.js";
3
3
  import type { ContractBoard, ContractRow } from "../protocol/read/status.js";
4
4
  import type { Settings } from "../settings.js";
5
- import type { TaskId } from "../task/identity.js";
5
+ import type { DebtId } from "../debt/identity.js";
6
6
  import type { Repo } from "./repo.js";
7
7
  /** Public gate words remain ordinary strings; private policy interprets them. */
8
8
  export type Gate = string;
@@ -25,8 +25,9 @@ export type ContractHistory = Readonly<{
25
25
  type MarkdownBindInput = Readonly<{
26
26
  repo: Repo;
27
27
  markdown: string;
28
- task?: TaskId;
29
- target?: string;
28
+ debt?: DebtId;
29
+ /** A literal target branch; `null` is deliberately targetless; omitted is the Repo worktree's current branch. */
30
+ target?: string | null;
30
31
  workspace?: "worktree";
31
32
  actor?: string;
32
33
  after?: readonly ContractId[];
@@ -35,7 +36,8 @@ type MarkdownBindInput = Readonly<{
35
36
  type ForkBindInput = Readonly<{
36
37
  repo: Repo;
37
38
  forkOf: ContractId;
38
- target?: string;
39
+ /** A literal target branch; `null` clears the source target; omitted inherits it. */
40
+ target?: string | null;
39
41
  workspace?: "worktree";
40
42
  actor?: string;
41
43
  }>;
@@ -72,6 +74,38 @@ export type KeiyakuSelectInput = Readonly<{
72
74
  repo: Repo;
73
75
  id: ContractId;
74
76
  }>;
77
+ export type ContractResolveInput = Readonly<{
78
+ repo: Repo;
79
+ selector?: string;
80
+ cwd?: string;
81
+ }>;
82
+ export type ContractSelectorRefusal = Readonly<{
83
+ kind: "invalid-selector";
84
+ selector: string;
85
+ diagnostic: string;
86
+ }> | Readonly<{
87
+ kind: "redundant-short-selector";
88
+ selector: string;
89
+ }> | Readonly<{
90
+ kind: "unknown-short-selector";
91
+ selector: string;
92
+ }> | Readonly<{
93
+ kind: "ambiguous-selector";
94
+ selector: string;
95
+ }> | Readonly<{
96
+ kind: "ambiguous-selector";
97
+ cwd: string;
98
+ }> | Readonly<{
99
+ kind: "no-contextual-match";
100
+ cwd: string;
101
+ }>;
102
+ export type ContractResolution = Readonly<{
103
+ kind: "resolved";
104
+ id: ContractId;
105
+ }> | Readonly<{
106
+ kind: "refused";
107
+ refusal: ContractSelectorRefusal;
108
+ }>;
75
109
  export type ReviewInput = ActorOptions & Readonly<{
76
110
  verdict: AttestationData["verdict"];
77
111
  summary?: string;
@@ -544,8 +544,6 @@ type HandleType<T extends object> = Readonly<{
544
544
  [Symbol.hasInstance](value: unknown): boolean;
545
545
  }>;
546
546
  export declare const Delivery: HandleType<DeliveryHandle>;
547
- export declare function deliveryHandle(delivery: DeliveryValue, readDiff: () => Promise<string | null>): Delivery & DeliveryValue;
548
- export declare function deliveryHandle(delivery: Pick<DeliveryValue, "tenderSnapshot" | "integration" | "method" | "policy"> & Partial<DeliveryValue>, readDiff: () => Promise<string | null>): Delivery;
549
547
  export declare function deliveryForContract(scope: RepositoryScope, delivery: DeliveryValue): Delivery & DeliveryValue;
550
548
  export declare function deliveryForContract(scope: RepositoryScope, delivery: Pick<DeliveryValue, "tenderSnapshot" | "integration" | "method" | "policy">): Delivery;
551
549
  export {};
@@ -30,13 +30,10 @@ export const Delivery = Object.freeze({
30
30
  prototype: DeliveryHandle.prototype,
31
31
  [Symbol.hasInstance]: (value) => value instanceof DeliveryHandle,
32
32
  });
33
- export function deliveryHandle(delivery, readDiff) {
34
- return new DeliveryHandle(delivery, readDiff, delivery);
35
- }
36
33
  export function deliveryForContract(scope, delivery) {
37
- return deliveryHandle(delivery, () => deliveryDiffOperation({
34
+ return new DeliveryHandle(delivery, () => deliveryDiffOperation({
38
35
  scope,
39
36
  integrationPredecessor: delivery.integration.predecessor,
40
37
  integrationSnapshot: delivery.integration.snapshot,
41
- }));
38
+ }), delivery);
42
39
  }
@@ -1,13 +1,13 @@
1
1
  import type { DecodedContractDocument } from "../body/types.js";
2
2
  import { type ActorId, type ContractId, type ContractTerms, type Gate } from "../core/facts/types.js";
3
- import { type TaskId } from "../task/identity.js";
3
+ import { type DebtId } from "../debt/identity.js";
4
4
  import type { DocumentDerivation } from "../protocol/operations.js";
5
5
  export declare function actorOption(actor: unknown): Readonly<{
6
6
  actor?: ActorId;
7
7
  }>;
8
8
  export declare function requireMarkdown(value: unknown, label?: string): string;
9
9
  export declare function requireInput(value: unknown, label: string, allowed?: readonly string[]): Record<string, unknown>;
10
- export declare function taskOption(value: unknown): TaskId | undefined;
10
+ export declare function debtOption(value: unknown): DebtId | undefined;
11
11
  export declare function optionalNonblank(value: unknown, label: string): string | undefined;
12
12
  export declare function optionalBoolean(value: unknown, label: string): boolean | undefined;
13
13
  export declare function optionalSignal(value: unknown): AbortSignal | undefined;
@@ -3,7 +3,7 @@ import { decodeContractDocument } from "../body/decode.js";
3
3
  import { validated } from "./outcome.js";
4
4
  import { verificationDefinition } from "../body/decode.js";
5
5
  import { actorId } from "../core/facts/types.js";
6
- import { parseTaskId } from "../task/identity.js";
6
+ import { parseDebtId } from "../debt/identity.js";
7
7
  import { prepareVerificationDeclaration } from "../verification/declaration.js";
8
8
  export function actorOption(actor) {
9
9
  if (actor === undefined)
@@ -32,16 +32,16 @@ export function requireInput(value, label, allowed) {
32
32
  }
33
33
  return value;
34
34
  }
35
- export function taskOption(value) {
35
+ export function debtOption(value) {
36
36
  if (value === undefined)
37
37
  return undefined;
38
38
  if (typeof value !== "string")
39
- throw new TypeError("task must be a TaskId");
39
+ throw new TypeError("debt must be a DebtId");
40
40
  try {
41
- parseTaskId(value);
41
+ parseDebtId(value);
42
42
  }
43
43
  catch (error) {
44
- throw new TypeError(error instanceof Error ? error.message : "task must be a TaskId");
44
+ throw new TypeError(error instanceof Error ? error.message : "debt must be a DebtId");
45
45
  }
46
46
  return value;
47
47
  }
@@ -27,12 +27,12 @@ export class InvocationAccumulator {
27
27
  this.observer = observer;
28
28
  }
29
29
  beginReset(world) {
30
- this.resetState = { world, removed: { refs: 0, worktrees: 0, tasks: 0 } };
30
+ this.resetState = { world, removed: { refs: 0, worktrees: 0, debts: 0 } };
31
31
  }
32
32
  recordResetRemoved(counts) {
33
33
  if (this.resetState === undefined)
34
34
  throw new Error("reset progress requires its World");
35
- for (const key of ["refs", "worktrees", "tasks"])
35
+ for (const key of ["refs", "worktrees", "debts"])
36
36
  this.resetState.removed[key] += counts[key] ?? 0;
37
37
  }
38
38
  observe(event) {
@@ -32,11 +32,6 @@ export declare class Keiyaku {
32
32
  abandon(input?: AbandonInput): Promise<AbandonOutcome>;
33
33
  arc(input: ArcInput): Promise<ArcOutcome>;
34
34
  audit(input?: AuditInput, options?: MutationObservation): Promise<AuditOutcome>;
35
- /**
36
- * Reads answer with a value or `null` for legitimate absence. Corrupt authority stays exceptional
37
- * and keeps its original native cause instead of being disguised as a raw native exception.
38
- */
39
- private read;
40
35
  }
41
36
  /** Internal constructor capability; callers select a Contract through Keiyaku.with. */
42
37
  export declare function createKeiyakuHandle(id: ContractId, scope: RepositoryScope, execution: ExecutionContext, composition: LocalContractCompositionCapture): Keiyaku;
@@ -7,7 +7,8 @@ import { observeContractsForAdmissionInObservationAt } from "../git/observe.js";
7
7
  import { withGitDecodeChannel, withGitReadObservation } from "../git/read-observation.js";
8
8
  import { contractObservationOperation, deliveryOperation, stateOperation, } from "../protocol/operations.js";
9
9
  import { readManagedWorktreeAppointment } from "../workspace-place.js";
10
- import { composeContractLibrary, readContractValue } from "./contract-composition.js";
10
+ import { composeContractLibrary } from "./contract-composition.js";
11
+ import { readContractValue } from "./outcome.js";
11
12
  import { ContractExecution } from "./contract-execution.js";
12
13
  import { deliveryForContract } from "./delivery.js";
13
14
  const KEIYAKU_HANDLE = Symbol("Keiyaku handle");
@@ -41,10 +42,10 @@ export class Keiyaku {
41
42
  return { contract: this.id };
42
43
  }
43
44
  async state() {
44
- return await this.read(() => withGitDecodeChannel(this.scope, (channel) => stateOperation({ scope: this.scope, channel, contractId: this.id })));
45
+ return await readContractValue(() => withGitDecodeChannel(this.scope, (channel) => stateOperation({ scope: this.scope, channel, contractId: this.id })));
45
46
  }
46
47
  async history() {
47
- return await this.read(() => withGitDecodeChannel(this.scope, (channel) => withGitReadObservation(this.scope, channel, async (observation) => {
48
+ return await readContractValue(() => withGitDecodeChannel(this.scope, (channel) => withGitReadObservation(this.scope, channel, async (observation) => {
48
49
  const [journals, dispatches] = await Promise.all([
49
50
  observeContractsForAdmissionInObservationAt(observation, [this.id]),
50
51
  readDispatchesAt(observation),
@@ -84,7 +85,7 @@ export class Keiyaku {
84
85
  })));
85
86
  }
86
87
  async guidance() {
87
- return await this.read(() => withGitDecodeChannel(this.scope, async (channel) => {
88
+ return await readContractValue(() => withGitDecodeChannel(this.scope, async (channel) => {
88
89
  const observed = await contractObservationOperation({ scope: this.scope, channel, contractId: this.id });
89
90
  if (observed.kind === "missing")
90
91
  return null;
@@ -93,7 +94,7 @@ export class Keiyaku {
93
94
  }));
94
95
  }
95
96
  async delivery() {
96
- const delivery = await this.read(() => withGitDecodeChannel(this.scope, (channel) => deliveryOperation({ scope: this.scope, channel, contractId: this.id })));
97
+ const delivery = await readContractValue(() => withGitDecodeChannel(this.scope, (channel) => deliveryOperation({ scope: this.scope, channel, contractId: this.id })));
97
98
  return delivery === null ? null : deliveryForContract(this.scope, delivery);
98
99
  }
99
100
  async amend(input) {
@@ -114,13 +115,6 @@ export class Keiyaku {
114
115
  async audit(input, options) {
115
116
  return await this.operations.audit(input, options);
116
117
  }
117
- /**
118
- * Reads answer with a value or `null` for legitimate absence. Corrupt authority stays exceptional
119
- * and keeps its original native cause instead of being disguised as a raw native exception.
120
- */
121
- async read(operation) {
122
- return await readContractValue(operation);
123
- }
124
118
  }
125
119
  /** Internal constructor capability; callers select a Contract through Keiyaku.with. */
126
120
  export function createKeiyakuHandle(id, scope, execution, composition) {
@@ -4,7 +4,7 @@ import { resolve } from "node:path";
4
4
  import { AkumaResetStopError, stopAkuma } from "../akuma/nuke.js";
5
5
  import { GitResetStopError, nukeGit } from "../git/nuke.js";
6
6
  import { isOperationalFailure } from "../protocol/progress.js";
7
- import { nukeTask } from "../task/operations.js";
7
+ import { nukeDebt } from "../debt/operations.js";
8
8
  import { World } from "../world.js";
9
9
  import { requireInput, requireMarkdown } from "./input.js";
10
10
  import { InvocationAccumulator } from "./invocation.js";
@@ -73,8 +73,8 @@ export async function nukeKeiyaku(input, gitOptions) {
73
73
  diagnostic: result.closeLag.diagnostic,
74
74
  });
75
75
  }),
76
- runOwner("task", async () => {
77
- await nukeTask(world, { onRemoved: (tasks) => accumulator.recordResetRemoved({ tasks }) });
76
+ runOwner("debt", async () => {
77
+ await nukeDebt(world, { onRemoved: (debts) => accumulator.recordResetRemoved({ debts }) });
78
78
  }),
79
79
  ]);
80
80
  await runOwner("world", () => removeEmptyWorldMarker(world));