@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
@@ -49,8 +49,12 @@ export type BindTargetSelection = Readonly<{
49
49
  export declare function normalizeTargetBranch(repository: GitRepository, input: string): Promise<string | null>;
50
50
  /** Read one worktree's attached branch, or null for detached HEAD. */
51
51
  export declare function currentBranch(repository: GitRepository, path?: string): Promise<string | null>;
52
- /** Observe bind's tender start and optional reward target without creating persistent state. */
53
- export declare function observeBindCoordinates(repository: GitRepository, selection?: BindTargetSelection): Promise<BindCoordinatesObservation | UnbornHeadObservation | null>;
52
+ /**
53
+ * Observe bind's tender start and optional reward target without creating persistent state.
54
+ * `current-branch` reads the observed worktree coordinate's own attached branch; the caller names
55
+ * which coordinate it wants observed.
56
+ */
57
+ export declare function observeBindCoordinates(repository: GitRepository, selection: BindTargetSelection): Promise<BindCoordinatesObservation | UnbornHeadObservation | null>;
54
58
  export declare function observeActiveContractWorld(observation: GitReadObservation): Promise<ActiveContractWorldObservation>;
55
59
  export declare function observeContractWorld(observation: GitReadObservation, requested?: readonly ContractId[]): Promise<ContractWorldObservation>;
56
60
  export declare function observeContractsForAdmissionAt(repository: GitRepository, channel: GitDecodeChannel, ids: readonly ContractId[], selection?: GitTreeSelection): Promise<GitDecisionObservation>;
@@ -77,8 +77,12 @@ async function observeHeadCoordinates(repository) {
77
77
  throw error;
78
78
  }
79
79
  }
80
- /** Observe bind's tender start and optional reward target without creating persistent state. */
81
- export async function observeBindCoordinates(repository, selection = { kind: "targetless" }) {
80
+ /**
81
+ * Observe bind's tender start and optional reward target without creating persistent state.
82
+ * `current-branch` reads the observed worktree coordinate's own attached branch; the caller names
83
+ * which coordinate it wants observed.
84
+ */
85
+ export async function observeBindCoordinates(repository, selection) {
82
86
  if (selection.kind === "explicit") {
83
87
  const requestedTarget = selection.target;
84
88
  if (isKeiyakuOwnedRef(requestedTarget)) {
@@ -1,4 +1,4 @@
1
- export type IdentityFamily = "aku" | "kei" | "task" | "resp";
1
+ export type IdentityFamily = "aku" | "kei" | "debt" | "resp";
2
2
  export declare function identityCoordinate(input: Readonly<{
3
3
  family: IdentityFamily;
4
4
  segments: readonly string[];
@@ -1,61 +1,61 @@
1
1
  /**
2
- * The package root: the curated Contract, Akuma, Akumas, Task, Kanshi, World,
2
+ * The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
3
3
  * Settings, and Plugin surfaces. Internal composition, execution, and
4
4
  * configuration helpers stay off this entry; only CLI and Body import them.
5
5
  */
6
6
  /**
7
- * The package root: the curated Contract, Akuma, Akumas, Task, Kanshi, World,
7
+ * The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
8
8
  * Settings, and Plugin surfaces. Internal composition, execution, and
9
9
  * configuration helpers stay off this entry; only CLI and Body import them.
10
10
  */
11
11
  export { AuthorityCorruptionError } from "./core/facts/errors.js";
12
12
  /**
13
- * The package root: the curated Contract, Akuma, Akumas, Task, Kanshi, World,
13
+ * The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
14
14
  * Settings, and Plugin surfaces. Internal composition, execution, and
15
15
  * configuration helpers stay off this entry; only CLI and Body import them.
16
16
  */
17
17
  export { Delivery } from "./library/delivery.js";
18
18
  /**
19
- * The package root: the curated Contract, Akuma, Akumas, Task, Kanshi, World,
19
+ * The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
20
20
  * Settings, and Plugin surfaces. Internal composition, execution, and
21
21
  * configuration helpers stay off this entry; only CLI and Body import them.
22
22
  */
23
23
  export { Keiyaku } from "./library/keiyaku.js";
24
24
  /**
25
- * The package root: the curated Contract, Akuma, Akumas, Task, Kanshi, World,
25
+ * The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
26
26
  * Settings, and Plugin surfaces. Internal composition, execution, and
27
27
  * configuration helpers stay off this entry; only CLI and Body import them.
28
28
  */
29
29
  export { KeiyakuError } from "./library/outcome.js";
30
30
  /**
31
- * The package root: the curated Contract, Akuma, Akumas, Task, Kanshi, World,
31
+ * The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
32
32
  * Settings, and Plugin surfaces. Internal composition, execution, and
33
33
  * configuration helpers stay off this entry; only CLI and Body import them.
34
34
  */
35
35
  export { NoGitWorldError, Repo } from "./library/repo.js";
36
36
  /**
37
- * The package root: the curated Contract, Akuma, Akumas, Task, Kanshi, World,
37
+ * The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
38
38
  * Settings, and Plugin surfaces. Internal composition, execution, and
39
39
  * configuration helpers stay off this entry; only CLI and Body import them.
40
40
  */
41
41
  export { actorId } from "./core/facts/types.js";
42
42
  /**
43
- * The package root: the curated Contract, Akuma, Akumas, Task, Kanshi, World,
43
+ * The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
44
44
  * Settings, and Plugin surfaces. Internal composition, execution, and
45
45
  * configuration helpers stay off this entry; only CLI and Body import them.
46
46
  */
47
47
  export { z } from "zod";
48
- export { ALLOWED_ACTIONS, Akuma, AkumaBusyError, AkumaDecodeError, AkumaNotBornError, AkumaProviderError, Schema, } from "./akuma/index.js";
49
- export type { ActivityHistory, ActivityRow, AkuId, AkumaAskObservation, AkumaAskOptions, AkumaAskResult, AkumaBirthInput, AkumaHistoryOptions, AkumaIdleOptions, AkumaIdleResult, AkumaSignalOptions, AkumaStatus, AkumaTellOptions, AkumaTellResult, AllowedAction, AllowedActions, InterruptReceipt, JsonSchema, JsonSchemaDocument, KillEvidence, SchemaLike, StandardSchemaV1, } from "./akuma/index.js";
48
+ export { ALLOWED_ACTIONS, Akuma, AkumaArchetypeError, AkumaBusyError, AkumaDecodeError, AkumaNotBornError, AkumaProviderError, Schema, listArchetypeDefinitions, } from "./akuma/index.js";
49
+ export type { AkumaCaller, AkumaOrigin, ActivityHistory, ActivityRow, AkuId, AkumaAskObservation, AkumaAskOptions, AkumaAskResult, AkumaBirthInput, AkumaHistoryOptions, AkumaHostOptions, AkumaIdleOptions, AkumaIdleResult, AkumaSignalOptions, AkumaStatus, AkumaStreamSnapshot, AkumaTellOptions, AkumaTellResult, AllowedAction, AllowedActions, ArchetypeCatalog, ArchetypeCatalogInput, ArchetypeCatalogRow, InterruptReceipt, JsonSchema, JsonSchemaDocument, KillEvidence, SchemaLike, StandardSchemaV1, } from "./akuma/index.js";
50
50
  export type { ActorId, ChangeId, ContractHead, ContractId, ContractState, JournalEntry as Fact, FactKind, SnapshotId, } from "./core/facts/types.js";
51
- export { kanshi, observeKanshi, selectKanshi, selectRegion } from "./kanshi/index.js";
52
- export type { AkumaKanshiRow, AkumaKanshiWorld, ContractEndpointObservation, ContractHolderObservation, ContractKanshiBoard, ContractKanshiRow, KanshiInput, KanshiRegionSelection, KanshiReport, KanshiSelection, RegionDeclaration, RegionRead, Section, TaskKanshiRow, TaskKanshiWorld, } from "./kanshi/index.js";
51
+ export { kanshi, kanshiCategory, observeKanshi, selectKanshi, selectRegion } from "./kanshi/index.js";
52
+ export type { AkumaKanshiRow, AkumaKanshiWorld, ContractEndpointObservation, ContractHolderObservation, ContractKanshiBoard, ContractKanshiRow, KanshiCategoryInput, KanshiCategoryReport, KanshiInput, KanshiRegionSelection, KanshiReport, KanshiSelection, RegionDeclaration, RegionRead, Section, DebtKanshiRow, DebtKanshiWorld, } from "./kanshi/index.js";
53
53
  export { AkumaAddressError, AkumaWorldScopeError, Akumas } from "./library/akumas.js";
54
- export type { AkumaAddressInput, AkumaAskInput, AkumaHistoryInput, AkumaHistoryResult, AkumaKillInput, AkumaKillResult, AkumaList, AkumaListInput, AkumaObservation, AkumaObservationStage, AkumaTellInput, AkumaWaitInput, AkumaWaitResult, AkumaWorldScopeRefusal, CallInput, CallResult, CallWaitHead, CreatedTaskObservation, DispatchAssociation, DispatchStage, ForkInput, ForkResult, TellResult, TellWake, WaitObservedAkuma, WaitObserver, WaitSelectedAkuma, } from "./library/akumas.js";
54
+ export type { AkumaAddressInput, AkumaAskInput, AkumaHistoryInput, AkumaHistoryResult, AkumaKillInput, AkumaKillResult, AkumaList, AkumaListInput, AkumaObservation, AkumaObservationStage, AkumaTellInput, AkumaWaitInput, AkumaWaitResult, AkumaWorldScopeRefusal, CallInput, CallResult, CallWaitHead, CreatedDebtObservation, DispatchAssociation, DispatchStage, ForkInput, ForkResult, TellResult, TellWake, } from "./library/akumas.js";
55
55
  export type { ContinuationReport } from "./library/continuation.js";
56
56
  export type { KeiyakuLibrary, ReconcileInput } from "./library/contract-composition.js";
57
57
  export type { AbandonOutcome, AmendOutcome, ArcOutcome, AuditOutcome, BindOutcome, BindResult, DeliverOutcome, ReviewOutcome, } from "./library/contract-outcomes.js";
58
- export type { AbandonInput, AmendInput, ArcInput, BindInput, ContractHistory, ContractHistoryEvent, ContractList, ContractListInput, ContractObservationInput, DeliverInput, KeiyakuSelectInput, LocalContractComposition, ReviewInput, } from "./library/contract-types.js";
58
+ export type { AbandonInput, AmendInput, ArcInput, BindInput, ContractHistory, ContractHistoryEvent, ContractList, ContractListInput, ContractObservationInput, ContractResolveInput, ContractResolution, ContractSelectorRefusal, DeliverInput, KeiyakuSelectInput, LocalContractComposition, ReviewInput, } from "./library/contract-types.js";
59
59
  export { nukeKeiyaku as nuke } from "./library/nuke.js";
60
60
  export type { NukeInput, NukeResult } from "./library/nuke.js";
61
61
  export type { InvocationEffect, KeiyakuErrorCategory, PartialOutcomeEnvelope, PendingSurface, ReconciliationLag, Review, } from "./library/outcome.js";
@@ -63,7 +63,7 @@ export type { ReconcileCompletion, RepoContractReconcileReport, RepoReconcileRep
63
63
  export type { KeiyakuRefusal, KeiyakuRetryReason, NukeConfirmationRefusal, NukeConfirmationRequiredRefusal, OperationRetries, } from "./library/refusal.js";
64
64
  export type { RegionOverlap } from "./library/region.js";
65
65
  export type { RepoAtInput } from "./library/repo.js";
66
- export type { KeiyakuPlugin, PluginBodyEnd, PluginContext, PluginHooks, PluginInstance, PluginManifest, PluginOutcome, PluginSignal, PluginSignalMap, } from "./plugin/public.js";
66
+ export type { KeiyakuPlugin, PluginAkumaCaller, PluginAkumaOrigin, PluginBodyEnd, PluginContext, PluginHooks, PluginInstance, PluginManifest, PluginOutcome, PluginSignal, PluginSignalMap, } from "./plugin/public.js";
67
67
  export type { AuditReport } from "./protocol/audit.js";
68
68
  export type { IntegrationConflictMaterialized, VerificationReuse } from "./protocol/deliver.js";
69
69
  export type { ExecutionObservation, ExecutionObserver } from "./protocol/execution-observation.js";
@@ -74,8 +74,8 @@ export { SettingsError, settings } from "./settings.js";
74
74
  export type { Gate } from "./library/contract-types.js";
75
75
  export type { Settings, SettingsEntry, SettingsInput, SettingsNamespaceFailure, SettingsNamespaceView, SettingsScope, SettingsScopeState, } from "./settings.js";
76
76
  export type { SettlementAction, SettlementLag, SettlementReport } from "./settlement/settle.js";
77
- export type * from "./task/index.js";
78
- export { TASK_RELATION_PREDICATE_FIELDS, TaskAuthorityCorruptionError, Tasks } from "./task/index.js";
77
+ export type * from "./debt/index.js";
78
+ export { DEBT_RELATION_PREDICATE_FIELDS, DebtAuthorityCorruptionError, Debts } from "./debt/index.js";
79
79
  export { World, WorldError } from "./world.js";
80
80
  export type { WorldResolution, WorldResolutionInput, WorldRoot } from "./world.js";
81
81
  export type { ReconcileReport, TopologyEffect } from "./library/reconcile.js";
@@ -1,54 +1,54 @@
1
1
  /**
2
- * The package root: the curated Contract, Akuma, Akumas, Task, Kanshi, World,
2
+ * The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
3
3
  * Settings, and Plugin surfaces. Internal composition, execution, and
4
4
  * configuration helpers stay off this entry; only CLI and Body import them.
5
5
  */
6
6
  /**
7
- * The package root: the curated Contract, Akuma, Akumas, Task, Kanshi, World,
7
+ * The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
8
8
  * Settings, and Plugin surfaces. Internal composition, execution, and
9
9
  * configuration helpers stay off this entry; only CLI and Body import them.
10
10
  */
11
11
  export { AuthorityCorruptionError } from "./core/facts/errors.js";
12
12
  /**
13
- * The package root: the curated Contract, Akuma, Akumas, Task, Kanshi, World,
13
+ * The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
14
14
  * Settings, and Plugin surfaces. Internal composition, execution, and
15
15
  * configuration helpers stay off this entry; only CLI and Body import them.
16
16
  */
17
17
  export { Delivery } from "./library/delivery.js";
18
18
  /**
19
- * The package root: the curated Contract, Akuma, Akumas, Task, Kanshi, World,
19
+ * The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
20
20
  * Settings, and Plugin surfaces. Internal composition, execution, and
21
21
  * configuration helpers stay off this entry; only CLI and Body import them.
22
22
  */
23
23
  export { Keiyaku } from "./library/keiyaku.js";
24
24
  /**
25
- * The package root: the curated Contract, Akuma, Akumas, Task, Kanshi, World,
25
+ * The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
26
26
  * Settings, and Plugin surfaces. Internal composition, execution, and
27
27
  * configuration helpers stay off this entry; only CLI and Body import them.
28
28
  */
29
29
  export { KeiyakuError } from "./library/outcome.js";
30
30
  /**
31
- * The package root: the curated Contract, Akuma, Akumas, Task, Kanshi, World,
31
+ * The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
32
32
  * Settings, and Plugin surfaces. Internal composition, execution, and
33
33
  * configuration helpers stay off this entry; only CLI and Body import them.
34
34
  */
35
35
  export { NoGitWorldError, Repo } from "./library/repo.js";
36
36
  /**
37
- * The package root: the curated Contract, Akuma, Akumas, Task, Kanshi, World,
37
+ * The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
38
38
  * Settings, and Plugin surfaces. Internal composition, execution, and
39
39
  * configuration helpers stay off this entry; only CLI and Body import them.
40
40
  */
41
41
  export { actorId } from "./core/facts/types.js";
42
42
  /**
43
- * The package root: the curated Contract, Akuma, Akumas, Task, Kanshi, World,
43
+ * The package root: the curated Contract, Akuma, Akumas, Debt, Kanshi, World,
44
44
  * Settings, and Plugin surfaces. Internal composition, execution, and
45
45
  * configuration helpers stay off this entry; only CLI and Body import them.
46
46
  */
47
47
  export { z } from "zod";
48
- export { ALLOWED_ACTIONS, Akuma, AkumaBusyError, AkumaDecodeError, AkumaNotBornError, AkumaProviderError, Schema, } from "./akuma/index.js";
49
- export { kanshi, observeKanshi, selectKanshi, selectRegion } from "./kanshi/index.js";
48
+ export { ALLOWED_ACTIONS, Akuma, AkumaArchetypeError, AkumaBusyError, AkumaDecodeError, AkumaNotBornError, AkumaProviderError, Schema, listArchetypeDefinitions, } from "./akuma/index.js";
49
+ export { kanshi, kanshiCategory, observeKanshi, selectKanshi, selectRegion } from "./kanshi/index.js";
50
50
  export { AkumaAddressError, AkumaWorldScopeError, Akumas } from "./library/akumas.js";
51
51
  export { nukeKeiyaku as nuke } from "./library/nuke.js";
52
52
  export { SettingsError, settings } from "./settings.js";
53
- export { TASK_RELATION_PREDICATE_FIELDS, TaskAuthorityCorruptionError, Tasks } from "./task/index.js";
53
+ export { DEBT_RELATION_PREDICATE_FIELDS, DebtAuthorityCorruptionError, Debts } from "./debt/index.js";
54
54
  export { World, WorldError } from "./world.js";
@@ -1,5 +1,5 @@
1
1
  export { kanshi, kanshiCategory, observeKanshi } from "./read.js";
2
2
  export { selectKanshi, selectRegion } from "./select.js";
3
- export type { KanshiInput } from "./read.js";
4
- export type { AkumaKanshiRow, AkumaKanshiWorld, ContractEndpointObservation, ContractHolderObservation, ContractKanshiBoard, ContractKanshiRow, KanshiCategoryReport, KanshiReport, Section, TaskKanshiRow, TaskKanshiWorld, KanshiRegionSelection, RegionDeclaration, RegionOverlap, RegionRead, } from "./report.js";
3
+ export type { KanshiCategoryInput, KanshiInput } from "./read.js";
4
+ export type { AkumaKanshiRow, AkumaKanshiWorld, ContractEndpointObservation, ContractHolderObservation, ContractKanshiBoard, ContractKanshiRow, KanshiCategoryReport, KanshiReport, Section, DebtKanshiRow, DebtKanshiWorld, KanshiRegionSelection, RegionDeclaration, RegionOverlap, RegionRead, } from "./report.js";
5
5
  export type { KanshiSelection } from "./select.js";
@@ -10,10 +10,10 @@ import { Repo, scopeForRepo } from "../library/repo.js";
10
10
  import { readDocuments } from "../protocol/read/documents.js";
11
11
  import { observeCurrentPhysicalIssue } from "../protocol/read/observation.js";
12
12
  import { readContractBoard, readContractCatalogue, readContractPhase } from "../protocol/read/status.js";
13
- import { readTaskHolderProjectionAt } from "../settlement/holder.js";
14
- import { contractNamespace } from "../task/identity.js";
15
- import { observeRecentTaskStatus, TaskAuthorityCorruptionError } from "../task/index.js";
16
- import { observeTaskBoard } from "../task/operations.js";
13
+ import { readDebtHolderProjectionAt } from "../settlement/holder.js";
14
+ import { contractNamespace } from "../debt/identity.js";
15
+ import { observeRecentDebtStatus, DebtAuthorityCorruptionError } from "../debt/index.js";
16
+ import { observeDebtBoard } from "../debt/operations.js";
17
17
  import { ROSTER_SNAPSHOT_ROWS, ROSTER_VISIBLE_ROWS } from "./roster.js";
18
18
  import { selectKanshi, selectRegion } from "./select.js";
19
19
  const WORLD_CONTRACT_ROWS = 10;
@@ -89,6 +89,12 @@ function regionSelection(value) {
89
89
  }
90
90
  throw new TypeError(`kanshi region selection kind is invalid: ${selection.kind}`);
91
91
  }
92
+ function worldCoordinate(world, repo) {
93
+ if (world !== null && (typeof world !== "string" || world.trim().length === 0))
94
+ throw new TypeError("kanshi world must be a WorldRoot or null");
95
+ if (repo !== undefined && !(repo instanceof Repo))
96
+ throw new TypeError("kanshi repo must be a Repo");
97
+ }
92
98
  function coordinate(input) {
93
99
  if (typeof input !== "object" || input === null || Array.isArray(input))
94
100
  throw new TypeError("kanshi input must be an object");
@@ -97,11 +103,7 @@ function coordinate(input) {
97
103
  throw new TypeError(`kanshi input has unknown field: ${key}`);
98
104
  }
99
105
  }
100
- if (input.world !== null && (typeof input.world !== "string" || input.world.trim().length === 0)) {
101
- throw new TypeError("kanshi world must be a WorldRoot or null");
102
- }
103
- if (input.repo !== undefined && !(input.repo instanceof Repo))
104
- throw new TypeError("kanshi repo must be a Repo");
106
+ worldCoordinate(input.world, input.repo);
105
107
  return {
106
108
  ...input,
107
109
  ...(input.region === undefined ? {} : { region: regionSelection(input.region) }),
@@ -144,7 +146,7 @@ async function readContracts(observation, include, limit = WORLD_CONTRACT_ROWS)
144
146
  }
145
147
  async function readHolders(observation) {
146
148
  try {
147
- return { kind: "present", value: await readTaskHolderProjectionAt(observation) };
149
+ return { kind: "present", value: await readDebtHolderProjectionAt(observation) };
148
150
  }
149
151
  catch (error) {
150
152
  return { kind: "failed", failure: { message: diagnostic(error) } };
@@ -171,7 +173,7 @@ function attachRoster(contracts, akuma) {
171
173
  },
172
174
  };
173
175
  }
174
- function decorateContracts(contracts, holders, namespaceTasks) {
176
+ function decorateContracts(contracts, holders, namespaceDebts) {
175
177
  if (contracts.kind !== "present")
176
178
  return contracts;
177
179
  return {
@@ -179,22 +181,22 @@ function decorateContracts(contracts, holders, namespaceTasks) {
179
181
  value: {
180
182
  ...contracts.value,
181
183
  rows: contracts.value.rows.map((row) => {
182
- const selected = namespaceTasks?.(row.id);
184
+ const selected = namespaceDebts?.(row.id);
183
185
  if (holders.kind === "failed") {
184
186
  return {
185
187
  ...row,
186
188
  holder: { kind: "unavailable" },
187
189
  roster: [],
188
- ...(selected === undefined ? {} : { namespaceTasks: selected }),
190
+ ...(selected === undefined ? {} : { namespaceDebts: selected }),
189
191
  };
190
192
  }
191
193
  const holder = holders.kind === "present" ? holders.value.get(row.id) : undefined;
192
194
  return {
193
195
  ...row,
194
196
  roster: [],
195
- ...(selected === undefined ? {} : { namespaceTasks: selected }),
197
+ ...(selected === undefined ? {} : { namespaceDebts: selected }),
196
198
  holder: holder?.disposition === "held"
197
- ? { kind: "held", taskId: holder.taskId }
199
+ ? { kind: "held", debtId: holder.debtId }
198
200
  : { kind: "none" },
199
201
  };
200
202
  }),
@@ -212,11 +214,11 @@ function contractEndpointObserver(contracts) {
212
214
  return "hasMore" in contracts.value ? "unavailable" : "missing";
213
215
  };
214
216
  }
215
- function joinTasks(rows, holders, observeContract) {
217
+ function joinDebts(rows, holders, observeContract) {
216
218
  const associations = new Map(holders.kind === "present"
217
219
  ? [...holders.value.values()]
218
220
  .filter((holder) => holder.disposition === "held")
219
- .map((holder) => [holder.taskId, holder.contractId])
221
+ .map((holder) => [holder.debtId, holder.contractId])
220
222
  : []);
221
223
  return rows.map((row) => {
222
224
  const contractId = associations.get(row.id);
@@ -225,43 +227,43 @@ function joinTasks(rows, holders, observeContract) {
225
227
  return { ...row, contract: { id: contractId, observed: observeContract(contractId) } };
226
228
  });
227
229
  }
228
- /** Attribute a Task board failure to the malformed document that caused it, when one is known. */
229
- function taskFailure(error) {
230
+ /** Attribute a Debt board failure to the malformed document that caused it, when one is known. */
231
+ function debtFailure(error) {
230
232
  return {
231
233
  message: diagnostic(error),
232
- ...(error instanceof TaskAuthorityCorruptionError && error.coordinate !== undefined
234
+ ...(error instanceof DebtAuthorityCorruptionError && error.coordinate !== undefined
233
235
  ? { coordinate: error.coordinate }
234
236
  : {}),
235
237
  };
236
238
  }
237
- async function readTaskWorld(path) {
239
+ async function readDebtWorld(path) {
238
240
  if (path === null)
239
241
  return { kind: "absent" };
240
242
  try {
241
- return { kind: "present", observation: await observeTaskBoard(path) };
243
+ return { kind: "present", observation: await observeDebtBoard(path) };
242
244
  }
243
245
  catch (error) {
244
- return { kind: "failed", failure: taskFailure(error) };
246
+ return { kind: "failed", failure: debtFailure(error) };
245
247
  }
246
248
  }
247
249
  /**
248
- * A selected Contract's own Task namespace view. A failed Task board is reported once by the
249
- * board's Task section, so the entity block omits it rather than repeating the same row.
250
+ * A selected Contract's own Debt namespace view. A failed Debt board is reported once by the
251
+ * board's Debt section, so the entity block omits it rather than repeating the same row.
250
252
  */
251
- function namespaceTaskSection(board, id) {
253
+ function namespaceDebtSection(board, id) {
252
254
  if (board.kind === "absent")
253
255
  return { kind: "absent" };
254
256
  if (board.kind === "failed")
255
257
  return undefined;
256
258
  return { kind: "present", value: board.observation.selectNamespace(contractNamespace(id)) };
257
259
  }
258
- async function readTasks(path, holders, observeContract) {
260
+ async function readDebts(path, holders, observeContract) {
259
261
  if (holders.kind === "failed")
260
262
  return { kind: "failed", failure: holders.failure };
261
- return observeRecentTaskStatus(path, { limit: 10 }).then((recent) => ({
263
+ return observeRecentDebtStatus(path, { limit: 10 }).then((recent) => ({
262
264
  kind: "present",
263
- value: { root: path, hasMore: recent.hasMore, rows: joinTasks(recent.rows, holders, observeContract) },
264
- }), (error) => ({ kind: "failed", failure: taskFailure(error) }));
265
+ value: { root: path, hasMore: recent.hasMore, rows: joinDebts(recent.rows, holders, observeContract) },
266
+ }), (error) => ({ kind: "failed", failure: debtFailure(error) }));
265
267
  }
266
268
  /**
267
269
  * Placement discharge for the observed roster snapshots: an associated Contract
@@ -355,7 +357,7 @@ async function observeWithoutRepo(world, region, observedAt, branch) {
355
357
  const contracts = { kind: "absent" };
356
358
  const holders = { kind: "absent" };
357
359
  const observeContract = contractEndpointObserver(contracts);
358
- const tasks = world === null ? { kind: "absent" } : await readTasks(world, holders, observeContract);
360
+ const debts = world === null ? { kind: "absent" } : await readDebts(world, holders, observeContract);
359
361
  const aliases = world === null ? { kind: "absent" } : await readAliasBindings(world);
360
362
  const akuma = world === null
361
363
  ? { kind: "absent" }
@@ -366,7 +368,7 @@ async function observeWithoutRepo(world, region, observedAt, branch) {
366
368
  observedAt,
367
369
  branch,
368
370
  contracts,
369
- tasks,
371
+ debts,
370
372
  akuma,
371
373
  ...(region === undefined ? {} : { region: { kind: "absent" } }),
372
374
  },
@@ -386,11 +388,11 @@ async function observeRepo(input) {
386
388
  const selectedContract = contract !== undefined &&
387
389
  contractSection.kind === "present" &&
388
390
  contractSection.value.rows.some((row) => row.id === contract);
389
- const board = selectedContract ? await readTaskWorld(world) : undefined;
390
- const contracts = decorateContracts(contractSection, holders, selectedContract ? (id) => (id === contract ? namespaceTaskSection(board, id) : undefined) : undefined);
391
+ const board = selectedContract ? await readDebtWorld(world) : undefined;
392
+ const contracts = decorateContracts(contractSection, holders, selectedContract ? (id) => (id === contract ? namespaceDebtSection(board, id) : undefined) : undefined);
391
393
  const observeContract = contractEndpointObserver(contracts);
392
394
  const aliases = world === null ? { kind: "absent" } : await readAliasBindings(world);
393
- const tasks = world === null ? { kind: "absent" } : await readTasks(world, holders, observeContract);
395
+ const debts = world === null ? { kind: "absent" } : await readDebts(world, holders, observeContract);
394
396
  const claimed = dispatches.kind === "present"
395
397
  ? await claimedAssociatedContracts(observation, dispatches.value)
396
398
  : new Set();
@@ -404,7 +406,7 @@ async function observeRepo(input) {
404
406
  observedAt,
405
407
  branch,
406
408
  contracts: attachRoster(contracts, akuma),
407
- tasks,
409
+ debts,
408
410
  akuma,
409
411
  ...(regionSection === undefined ? {} : { region: regionSection }),
410
412
  };
@@ -428,7 +430,7 @@ async function observeRepo(input) {
428
430
  observedAt,
429
431
  branch,
430
432
  contracts: failure,
431
- tasks: world === null ? { kind: "absent" } : failure,
433
+ debts: world === null ? { kind: "absent" } : failure,
432
434
  akuma: world === null ? { kind: "absent" } : failure,
433
435
  ...(region === undefined ? {} : { region: failure }),
434
436
  },
@@ -447,7 +449,7 @@ export async function observeKanshi(input) {
447
449
  export async function kanshi(input) {
448
450
  return (await observeKanshi(input)).report;
449
451
  }
450
- /** Category observations reuse owner rows without reading the Task board. */
452
+ /** Category observations reuse owner rows without reading the Debt board. */
451
453
  async function observeAkumaCategory(world, repo, limit, observedAt) {
452
454
  const report = (akuma) => ({
453
455
  category: "akuma",
@@ -498,9 +500,22 @@ async function observeContractCategory(world, repo, limit, observedAt) {
498
500
  return report({ kind: "failed", failure: { message: diagnostic(error) } });
499
501
  }
500
502
  }
503
+ const DEFAULT_CATEGORY_LIMIT = 10;
504
+ /** Caller-invalid category requests are refused here, before any owner observation runs. */
505
+ function validateCategoryInput(input) {
506
+ const value = record(input, "category input");
507
+ exactKeys(value, ["world", "repo", "category", "limit"], "category input");
508
+ worldCoordinate(value.world, value.repo);
509
+ if (value.category !== "akuma" && value.category !== "contract")
510
+ throw new TypeError(`kanshi category is invalid: ${String(value.category)}`);
511
+ const { limit } = value;
512
+ if (limit !== undefined && (typeof limit !== "number" || !Number.isSafeInteger(limit) || limit < 1))
513
+ throw new TypeError("kanshi category limit must be a positive safe integer");
514
+ }
501
515
  export async function kanshiCategory(input) {
502
516
  const observedAt = new Date().toISOString();
503
- const { world, repo, category, limit = 10 } = input;
517
+ validateCategoryInput(input);
518
+ const { world, repo, category, limit = DEFAULT_CATEGORY_LIMIT } = input;
504
519
  if (category === "contract") {
505
520
  if (repo === undefined)
506
521
  throw new TypeError("kanshi contract category requires a Repo");
@@ -6,7 +6,7 @@ import type { ContractId } from "../index.js";
6
6
  import type { RegionOverlap } from "../library/region.js";
7
7
  import type { CurrentPhysicalIssue } from "../protocol/read/observation.js";
8
8
  import type { ContractBoard, ContractDisposition, ContractPhase } from "../protocol/read/status.js";
9
- import type { TaskId, TaskRef, TaskRow } from "../task/index.js";
9
+ import type { DebtId, DebtRef, DebtRow } from "../debt/index.js";
10
10
  import type { WorldRoot } from "../world.js";
11
11
  export type { RegionOverlap };
12
12
  export type Section<Value> = Readonly<{
@@ -24,7 +24,7 @@ export type Section<Value> = Readonly<{
24
24
  export type ContractEndpointObservation = ContractDisposition | "missing" | "unavailable";
25
25
  export type ContractHolderObservation = Readonly<{
26
26
  kind: "held";
27
- taskId: TaskId;
27
+ debtId: DebtId;
28
28
  }> | Readonly<{
29
29
  kind: "none";
30
30
  }> | Readonly<{
@@ -38,21 +38,21 @@ export type ContractKanshiRow = ContractBoard["rows"][number] & Readonly<{
38
38
  phase: ContractPhase;
39
39
  holder: ContractHolderObservation;
40
40
  roster: readonly ContractRosterAttachment[];
41
- namespaceTasks?: Section<readonly TaskRow[]>;
41
+ namespaceDebts?: Section<readonly DebtRow[]>;
42
42
  issue?: CurrentPhysicalIssue;
43
43
  }>;
44
44
  export type ContractKanshiBoard = Omit<ContractBoard, "rows"> & Readonly<{
45
45
  rows: readonly ContractKanshiRow[];
46
46
  hasMore?: boolean;
47
47
  }>;
48
- export type TaskKanshiRow = TaskRow & Readonly<{
48
+ export type DebtKanshiRow = DebtRow & Readonly<{
49
49
  contract?: Readonly<{
50
50
  id: string;
51
51
  observed: ContractEndpointObservation;
52
52
  }>;
53
- blockers?: readonly TaskRef[];
53
+ blockers?: readonly DebtRef[];
54
54
  }>;
55
- export type TaskKanshiWorld = BoundedList<TaskKanshiRow> & Readonly<{
55
+ export type DebtKanshiWorld = BoundedList<DebtKanshiRow> & Readonly<{
56
56
  root: WorldRoot;
57
57
  }>;
58
58
  export type AkumaKanshiRow = (AkumaListRow | UnbornAkumaListRow) & Readonly<{
@@ -96,7 +96,7 @@ export type KanshiReport = Readonly<{
96
96
  observedAt: string;
97
97
  branch: string | null;
98
98
  contracts: Section<ContractKanshiBoard>;
99
- tasks: Section<TaskKanshiWorld>;
99
+ debts: Section<DebtKanshiWorld>;
100
100
  akuma: Section<AkumaKanshiWorld>;
101
101
  region?: Section<RegionRead>;
102
102
  }>;
@@ -29,15 +29,15 @@ export function selectKanshi(input) {
29
29
  },
30
30
  }
31
31
  : report.contracts,
32
- tasks: report.tasks.kind === "present"
32
+ debts: report.debts.kind === "present"
33
33
  ? {
34
34
  kind: "present",
35
35
  value: {
36
- ...report.tasks.value,
37
- rows: report.tasks.value.rows.filter((row) => row.contract?.id === contract),
36
+ ...report.debts.value,
37
+ rows: report.debts.value.rows.filter((row) => row.contract?.id === contract),
38
38
  },
39
39
  }
40
- : report.tasks,
40
+ : report.debts,
41
41
  akuma: report.akuma.kind === "present"
42
42
  ? {
43
43
  kind: "present",
@@ -7,6 +7,7 @@ import { contractId } from "../core/facts/types.js";
7
7
  import { readDispatches } from "../dispatch/index.js";
8
8
  import { matchesAkumaGlob, parseReadableAkumaAlias, parseAkumaGlob, } from "../identity/selector.js";
9
9
  import { World } from "../world.js";
10
+ import { matchContractCandidates } from "./contract-address.js";
10
11
  import { requireInput } from "./input.js";
11
12
  import { scopeForRepo } from "./repo.js";
12
13
  export class AkumaAddressError extends Error {
@@ -69,10 +70,7 @@ export function resolveNamedAddress(input) {
69
70
  if (selector.startsWith("aku/"))
70
71
  return { kind: "akuma", id: parseAddressId(selector).id };
71
72
  const alias = parseAddressAlias(selector);
72
- const contractMatches = (input.report.contracts.kind === "present" ? input.report.contracts.value.rows : []).filter((row) => row.disposition === "active" &&
73
- row.workspace === "worktree" &&
74
- row.worktreePath !== null &&
75
- `@${row.id.slice("kei/".length)}` === alias);
73
+ const contractMatches = matchContractCandidates(input.report.contracts.kind === "present" ? input.report.contracts.value.rows : [], { selector: alias });
76
74
  const aliasId = input.aliases.kind === "present"
77
75
  ? (input.aliases.value.find((binding) => binding.alias === alias)?.akuId ?? null)
78
76
  : null;
@@ -1,3 +1,4 @@
1
+ import { type AkumaCaller } from "../akuma/caller.js";
1
2
  import { type ForkReceipt } from "../akuma/akuma-owner.js";
2
3
  import { type AskObserver } from "../akuma/akuma-selection-execution.js";
3
4
  import type { AkumaStatus } from "../akuma/akuma.js";
@@ -63,6 +64,7 @@ export type CallInput = Readonly<{
63
64
  allowed?: readonly AllowedAction[];
64
65
  schema?: Schema<unknown>;
65
66
  initiator?: string;
67
+ caller?: AkumaCaller;
66
68
  signal?: AbortSignal;
67
69
  observe?: CallWaitObserver;
68
70
  }>;
@@ -98,6 +100,8 @@ export type ForkInput = Readonly<{
98
100
  akuma: string;
99
101
  at: string;
100
102
  repo?: Repo;
103
+ caller?: AkumaCaller;
104
+ initiator?: string;
101
105
  }>;
102
106
  export type ForkResult = Readonly<{
103
107
  kind: "forked";
@@ -112,7 +116,7 @@ export type ForkResult = Readonly<{
112
116
  }>);
113
117
  export declare function callAkumas(input: CallInput & Readonly<{
114
118
  path: WorldRoot;
115
- }>, execution?: ExecutionContext): Promise<CallResult>;
119
+ }>, execution?: ExecutionContext, reportDiagnostic?: (message: string) => void): Promise<CallResult>;
116
120
  export declare function forkAkumas(input: ForkInput & Readonly<{
117
121
  path: WorldRoot;
118
122
  }>): Promise<ForkResult>;