@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
@@ -1,11 +1,13 @@
1
+ import { decodeAkumaCaller } from "./caller.js";
1
2
  import { randomUUID } from "node:crypto";
2
3
  import { AkumaNotBornError, AkumaProviderError } from "./akuma-errors.js";
3
- import { bornLiveStatus, bornStatus, defaultWaitComplete, observeOutcomeRows, observeStatusOutcome, waitForObservation, } from "./akuma-observe.js";
4
+ import { createLiveStatusReader, bornStatus, defaultWaitComplete, executionProgress, observeOutcomeRows, observeStatusOutcome, waitForObservation, } from "./akuma-observe.js";
4
5
  import { executeWaitAkuma } from "./akuma-wait.js";
6
+ import { createAkumaStream } from "./akuma-stream.js";
5
7
  import { handoffPendingTells, spawnAkumaBody, wakeRecordedTell, } from "./body.js";
6
8
  import { admitCallInitialTell } from "./call-initial-tell.js";
7
9
  import { acquireLeash } from "./control.js";
8
- import { HeldAkumaLeash, activitySlice, projectTell, readForkPoint, readHeart, readKill, readLastAnsweredTurn, readSoul, readTell, readTurn, recordTell, requestPause, requestStop, } from "./heart/index.js";
10
+ import { HeldAkumaLeash, activitySlice, projectTell, readForkPoint, readHeart, readKill, readLastAnsweredTurn, readSoul, readTell, recordTell, requestPause, requestStop, } from "./heart/index.js";
9
11
  import { parsePublicHistoryId, pathsForAkuId } from "./identity.js";
10
12
  import { projectTurns, selectExactHistory, selectHistory } from "./projection.js";
11
13
  import { resolveProviderExecution } from "./providers/index.js";
@@ -83,7 +85,7 @@ export async function killAkumaWithRecovery(paths, recover, signal) {
83
85
  * The one lower native Akuma owner: standalone identity, plural selection and
84
86
  * the request service all consume these same single-target algorithms. It reads
85
87
  * only Heart, leash, provider and filesystem state; optional Alias, Dispatch,
86
- * Task and Contract associations are composed above this boundary.
88
+ * Debt and Contract associations are composed above this boundary.
87
89
  */
88
90
  export class AkumaOwner {
89
91
  id;
@@ -145,6 +147,14 @@ export class AkumaOwner {
145
147
  await observeOutcomeRows(this.id, history.rows, this.outcomeObserved);
146
148
  return history;
147
149
  }
150
+ /**
151
+ * Continuously observe that same retained timeline. Each emission is the whole
152
+ * latest bounded window through the existing history projection, and the
153
+ * operation observes until its caller stops pulling or aborts.
154
+ */
155
+ stream(options = {}) {
156
+ return createAkumaStream(this.paths, this.id, options, this.outcomeObserved);
157
+ }
148
158
  async waitReceipt(predicate = defaultWaitComplete, options = {}) {
149
159
  if (options.timeoutMs !== undefined && (!Number.isFinite(options.timeoutMs) || options.timeoutMs < 0)) {
150
160
  throw new TypeError("Akuma wait timeoutMs must be a nonnegative finite millisecond duration");
@@ -223,38 +233,39 @@ export class AkumaOwner {
223
233
  }
224
234
  /** Observe the exact admitted Tell's bound Turn without substituting Akuma-wide idleness. */
225
235
  async tellOutcome(tellId, options = {}) {
226
- const waited = await waitForObservation({
227
- ...(options.timeoutMs === undefined ? {} : { timeoutMs: options.timeoutMs }),
228
- ...(options.signal === undefined ? {} : { signal: options.signal }),
229
- observe: async () => {
230
- const tell = await readTell(this.paths, tellId);
231
- if (tell === null)
232
- throw new AkumaProviderError(`recorded Tell ${tellId} is missing from Heart`);
233
- const outcome = await this.boundTellOutcome(tell);
234
- if (outcome.historyId !== undefined)
235
- await this.outcomeObserved?.(this.id, [outcome.historyId]);
236
- if (options.observe !== undefined) {
237
- await options.observe(await bornLiveStatus(this.paths, this.id, { aperture: "monitoring", admittedTellId: tellId }));
238
- }
239
- return { ...outcome, terminalWithoutTurn: tell.state === "told" && tell.binding === undefined };
240
- },
241
- complete: (observed) => observed.outcome !== null || observed.terminalWithoutTurn,
242
- });
243
- return {
244
- reason: waited.reason,
245
- outcome: waited.value.outcome,
246
- completedAt: waited.value.completedAt,
247
- };
248
- }
249
- async boundTellOutcome(tell) {
250
- if (tell.binding === undefined)
251
- return { outcome: null, completedAt: null };
252
- const end = (await readTurn(this.paths, tell.binding.turnSequence))?.end;
253
- return {
254
- outcome: end?.outcome ?? null,
255
- completedAt: end?.completedAt ?? null,
256
- ...(end === undefined ? {} : { historyId: `turn/${tell.binding.turnSequence}` }),
257
- };
236
+ const reader = createLiveStatusReader(this.paths, this.id);
237
+ try {
238
+ const waited = await waitForObservation({
239
+ ...(options.timeoutMs === undefined ? {} : { timeoutMs: options.timeoutMs }),
240
+ ...(options.signal === undefined ? {} : { signal: options.signal }),
241
+ observe: async () => {
242
+ const currentLife = await reader.execution(options.signal);
243
+ const progress = executionProgress(currentLife, true, options.wake?.());
244
+ const { tell, end } = await reader.tellOutcome(tellId, options.signal);
245
+ if (tell === null)
246
+ throw new AkumaProviderError(`recorded Tell ${tellId} is missing from Heart`);
247
+ if (end !== undefined)
248
+ await this.outcomeObserved?.(this.id, [`turn/${end.turnSequence}`]);
249
+ if (options.observe !== undefined) {
250
+ await options.observe(await reader.read({ aperture: "monitoring", admittedTellId: tellId }, options.signal));
251
+ }
252
+ return {
253
+ outcome: end?.outcome ?? null,
254
+ completedAt: end?.completedAt ?? null,
255
+ terminalWithoutTurn: (tell.state === "told" && tell.binding === undefined) || progress === "stopped",
256
+ };
257
+ },
258
+ complete: (observed) => observed.outcome !== null || observed.terminalWithoutTurn,
259
+ });
260
+ return {
261
+ reason: waited.reason,
262
+ outcome: waited.value.outcome,
263
+ completedAt: waited.value.completedAt,
264
+ };
265
+ }
266
+ finally {
267
+ reader.clear();
268
+ }
258
269
  }
259
270
  async interrupt(body, options = {}) {
260
271
  const admitted = await this.admitInterrupt(body, options);
@@ -319,6 +330,7 @@ export class AkumaOwner {
319
330
  };
320
331
  }
321
332
  async fork(input) {
333
+ const caller = decodeAkumaCaller(input.caller);
322
334
  const source = await readSoul(this.paths);
323
335
  if (source === null)
324
336
  throw new AkumaNotBornError(this.id);
@@ -366,8 +378,10 @@ export class AkumaOwner {
366
378
  allowed: source.allowed,
367
379
  cwd: source.cwd,
368
380
  origin: { kind: "fork", parent: this.id, at: input.at },
381
+ ...(caller === undefined ? {} : { caller }),
369
382
  },
370
383
  birthSession,
384
+ ...(input.initiator === undefined ? {} : { birthInitiator: input.initiator }),
371
385
  });
372
386
  },
373
387
  });
@@ -68,9 +68,12 @@ export async function observeAdmittedAskAkuma(input) {
68
68
  const tell = input.receipt ?? (await owner.admittedReceipt(input.tellId));
69
69
  await input.onObserve?.admitted?.(tell, input.id);
70
70
  let settled;
71
+ let wakeError;
72
+ let wakeState = input.wake === undefined ? "settled" : "launching";
71
73
  void input.wake?.then((receipt) => {
72
74
  settled = receipt;
73
- }, () => undefined);
75
+ wakeState = receipt.wake.kind === "failed" ? "failed" : "settled";
76
+ }, (error) => { wakeError = { error }; wakeState = "failed"; });
74
77
  const admittedAt = Date.parse(tell.row.at);
75
78
  const observedAt = performance.timeOrigin + performance.now();
76
79
  const elapsed = input.startedAt === undefined
@@ -79,6 +82,11 @@ export async function observeAdmittedAskAkuma(input) {
79
82
  : 0
80
83
  : Math.max(0, performance.now() - input.startedAt);
81
84
  const observed = await owner.tellOutcome(input.tellId, {
85
+ wake: () => {
86
+ if (wakeError !== undefined)
87
+ throw wakeError.error;
88
+ return wakeState;
89
+ },
82
90
  ...(input.timeoutMs === undefined ? {} : { timeoutMs: Math.max(0, input.timeoutMs - elapsed) }),
83
91
  ...(input.signal === undefined ? {} : { signal: input.signal }),
84
92
  ...(input.onObserve?.observe === undefined ? {} : { observe: input.onObserve.observe }),
@@ -0,0 +1,22 @@
1
+ import { type OutcomeObserver } from "./akuma-observe.js";
2
+ import type { AkuId, AkumaPaths } from "./identity.js";
3
+ import { type ActivityHistory } from "./projection.js";
4
+ /** The complete bounded latest timeline window one stream emission carries; never a delta. */
5
+ export type AkumaStreamSnapshot = ActivityHistory;
6
+ /**
7
+ * The one continuous timeline observation as its caller sees it: pull-driven,
8
+ * so a slow consumer accumulates no queue.
9
+ *
10
+ * The observation runs behind this wrapper because a bare async generator
11
+ * cannot honour an end request while a pull is pending: `return()` would queue
12
+ * behind a pull that an idle timeline never settles, and the observation would
13
+ * hold its reader and its polling timer forever. The wrapper owns an internal
14
+ * controller instead, and the observation watches the caller's cancellation
15
+ * composed with it. `return` aborts that controller, which settles the pending
16
+ * poll and lets the loop release its reader in the same turn; because a
17
+ * composed signal keeps the reason of whichever source aborted first, an end
18
+ * request reads as completion while a caller's own abort keeps its own failure.
19
+ */
20
+ export declare function createAkumaStream(paths: AkumaPaths, id: AkuId, options?: Readonly<{
21
+ signal?: AbortSignal;
22
+ }>, observe?: OutcomeObserver): AsyncIterableIterator<AkumaStreamSnapshot>;
@@ -0,0 +1,116 @@
1
+ import { isDeepStrictEqual } from "node:util";
2
+ import { abortableDelay } from "./abort.js";
3
+ import { AkumaNotBornError } from "./akuma-errors.js";
4
+ import { OBSERVATION_POLL_MS } from "./akuma-observe.js";
5
+ import { createTimelineReader } from "./heart/index.js";
6
+ import { projectTurns, selectHistory } from "./projection.js";
7
+ /** The fixed number of projected rows one window retains. */
8
+ const STREAM_WINDOW = 500;
9
+ /**
10
+ * The private end-of-observation reason. It is deliberately not the caller's
11
+ * abort reason: a returned observation completes, while an aborted one keeps
12
+ * the caller's own failure.
13
+ */
14
+ const STREAM_RETURN = Symbol("akuma-stream-return");
15
+ /**
16
+ * Announce each retained outcome identity once per observation, keeping only
17
+ * the identities the current window still carries, so a long stream remembers
18
+ * a bounded set rather than every outcome it ever saw.
19
+ */
20
+ async function announceOutcomes(id, rows, observed, observe) {
21
+ const outcomes = new Set(rows.flatMap((row) => (row.kind === "outcome" ? [row.outcome.historyId] : [])));
22
+ const fresh = [...outcomes].filter((historyId) => !observed.has(historyId));
23
+ if (fresh.length > 0)
24
+ await observe?.(id, fresh);
25
+ return outcomes;
26
+ }
27
+ /**
28
+ * The observation loop itself. It decodes the retained timeline through the
29
+ * existing Turn projection on every pull and answers with the whole latest
30
+ * bounded window, holding only that window and one reader. Complete windows
31
+ * coalesce; they are not lossless event delivery, and the existing retention
32
+ * metadata keeps its honest meaning.
33
+ */
34
+ async function* observeTimeline(paths, id, signal, observe) {
35
+ const reader = createTimelineReader(paths);
36
+ let released = false;
37
+ const release = () => {
38
+ if (released)
39
+ return;
40
+ released = true;
41
+ reader.clear();
42
+ };
43
+ let observedOutcomes = new Set();
44
+ let previous;
45
+ signal.addEventListener("abort", release, { once: true });
46
+ try {
47
+ for (;;) {
48
+ signal.throwIfAborted();
49
+ const read = await reader.read(signal);
50
+ signal.throwIfAborted();
51
+ if (read.changed) {
52
+ if (!read.born)
53
+ throw new AkumaNotBornError(id);
54
+ const { rows, lowestRetained, highest } = read.slice;
55
+ const snapshot = selectHistory(projectTurns(rows, { lowestRetained, highest }), { limit: STREAM_WINDOW });
56
+ if (previous === undefined || !isDeepStrictEqual(snapshot, previous)) {
57
+ observedOutcomes = await announceOutcomes(id, snapshot.rows, observedOutcomes, observe);
58
+ previous = snapshot;
59
+ yield snapshot;
60
+ }
61
+ }
62
+ await abortableDelay(OBSERVATION_POLL_MS, signal);
63
+ }
64
+ }
65
+ finally {
66
+ signal.removeEventListener("abort", release);
67
+ release();
68
+ }
69
+ }
70
+ /**
71
+ * The one continuous timeline observation as its caller sees it: pull-driven,
72
+ * so a slow consumer accumulates no queue.
73
+ *
74
+ * The observation runs behind this wrapper because a bare async generator
75
+ * cannot honour an end request while a pull is pending: `return()` would queue
76
+ * behind a pull that an idle timeline never settles, and the observation would
77
+ * hold its reader and its polling timer forever. The wrapper owns an internal
78
+ * controller instead, and the observation watches the caller's cancellation
79
+ * composed with it. `return` aborts that controller, which settles the pending
80
+ * poll and lets the loop release its reader in the same turn; because a
81
+ * composed signal keeps the reason of whichever source aborted first, an end
82
+ * request reads as completion while a caller's own abort keeps its own failure.
83
+ */
84
+ export function createAkumaStream(paths, id, options = {}, observe) {
85
+ const caller = options.signal;
86
+ const control = new AbortController();
87
+ const signal = caller === undefined ? control.signal : AbortSignal.any([caller, control.signal]);
88
+ const observation = observeTimeline(paths, id, signal, observe);
89
+ let returning;
90
+ const next = async () => {
91
+ if (returning !== undefined)
92
+ return { done: true, value: undefined };
93
+ try {
94
+ return await observation.next();
95
+ }
96
+ catch (error) {
97
+ // An end request is completion, not the caller's failure to see.
98
+ if (signal.reason === STREAM_RETURN)
99
+ return { done: true, value: undefined };
100
+ throw error;
101
+ }
102
+ };
103
+ const end = (value) => {
104
+ if (returning === undefined) {
105
+ control.abort(STREAM_RETURN);
106
+ returning = observation.return(value).then((result) => ({ done: true, value: result.value }));
107
+ }
108
+ return returning;
109
+ };
110
+ const iterator = {
111
+ [Symbol.asyncIterator]: () => iterator,
112
+ next,
113
+ return: end,
114
+ };
115
+ return iterator;
116
+ }
@@ -1,30 +1,7 @@
1
- import type { AkumaAlias } from "../identity/selector.js";
2
1
  import type { WorldRoot } from "../world.js";
3
2
  import { type OutcomeObserver, type WaitReason } from "./akuma-observe.js";
4
3
  import type { AkumaStatus } from "./akuma.js";
5
- import type { DispatchAssociation } from "./dispatch-association.js";
6
- import type { ActivityRow } from "./projection.js";
7
4
  import type { AkumaUnobserved } from "./selection-observation.js";
8
- export type WaitIdentityFacts = Readonly<{
9
- /** The alias currently addressing this Akuma in its world, when one is bound to it. */
10
- alias?: AkumaAlias;
11
- /** This Akuma's Dispatch association, read from the observing repository. */
12
- contract: DispatchAssociation;
13
- }>;
14
- /** One observed Akuma as a live wait viewer sees it: its status plus its identity facts. */
15
- export type WaitObservedAkuma = Readonly<{
16
- status: AkumaStatus;
17
- rows: readonly ActivityRow[];
18
- }> & WaitIdentityFacts;
19
- /** One selected Akuma's frozen identity, resolved before the first observation round. */
20
- export type WaitSelectedAkuma = Readonly<{
21
- id: AkumaStatus["id"];
22
- }> & WaitIdentityFacts;
23
- /** A live wait viewer: the frozen selected set, then every observation round. */
24
- export type WaitObserver = Readonly<{
25
- selected?: (selected: readonly WaitSelectedAkuma[]) => void;
26
- observe?: (observed: readonly WaitObservedAkuma[]) => void;
27
- }>;
28
5
  type WaitExecutionInput = Readonly<{
29
6
  path: WorldRoot;
30
7
  ids: readonly AkumaStatus["id"][];
@@ -34,14 +11,6 @@ type WaitExecutionInput = Readonly<{
34
11
  /** Internal custom completion judge over the full final observation where supplied. */
35
12
  predicate?: (status: AkumaStatus) => boolean;
36
13
  outcomeObserved?: OutcomeObserver;
37
- /** Resolves one Akuma's identity facts; consulted once per Akuma a viewer first sees. */
38
- identity?: (id: AkumaStatus["id"]) => Promise<WaitIdentityFacts>;
39
- /** The selected set in the caller's order; a viewer's head and scoreboard follow it. */
40
- selectionOrder?: readonly AkumaStatus["id"][];
41
- /** Reports the frozen selected set before the first round, so a viewer can fix its layout. */
42
- onSelected?: (selected: readonly WaitSelectedAkuma[]) => void;
43
- /** Reports every observation round to a live viewer. */
44
- observe?: (observed: readonly WaitObservedAkuma[]) => void;
45
14
  }>;
46
15
  /** One wait's association-free native evidence; upper composition attaches cross-product context. */
47
16
  export type NativeWaitResult = Readonly<{
@@ -50,14 +19,6 @@ export type NativeWaitResult = Readonly<{
50
19
  observations: readonly AkumaStatus[];
51
20
  unobserved: readonly AkumaUnobserved[];
52
21
  }>;
53
- /**
54
- * The one lower set-observation owner for Akuma wait completion. It serves the
55
- * standalone one-ID association-free face and the plural any/all face with one
56
- * ordered round algorithm, one shared ordinary-detail budget, transient
57
- * unreadable peers, and an honest final deadline edge. A silent observation —
58
- * no live row callback and no custom judge — decides which running rounds to
59
- * skip with the owner's lightweight completion probe over the selected set; a
60
- * live viewer or a custom judge always observes full rounds.
61
- */
22
+ /** Wait observes completion and returns final status snapshots, never a live stream. */
62
23
  export declare function executeWaitAkuma(input: WaitExecutionInput): Promise<NativeWaitResult>;
63
24
  export {};
@@ -1,19 +1,9 @@
1
1
  import { AkumaNotBornError } from "./akuma-errors.js";
2
- import { createLiveStatusReader, defaultWaitComplete, readLiveStatus, readWaitComplete, observeOutcomeRows, observeStatusOutcome, waitForObservation, } from "./akuma-observe.js";
2
+ import { createLiveStatusReader, defaultWaitComplete, readWaitComplete, observeStatusOutcome, waitForObservation, } from "./akuma-observe.js";
3
3
  import { pathsForAkuId } from "./identity.js";
4
4
  const SHARED_ORDINARY_BUDGET = 30;
5
- async function observeWaitRound(path, ids, signal, readers) {
6
- const read = async (id, ordinaryBudget) => {
7
- const options = { aperture: "monitoring", ...(ordinaryBudget === undefined ? {} : { ordinaryBudget }) };
8
- if (readers === undefined)
9
- return await readLiveStatus(path, id, options, signal);
10
- let reader = readers.get(id);
11
- if (reader === undefined) {
12
- reader = createLiveStatusReader(pathsForAkuId(path, id), id);
13
- readers.set(id, reader);
14
- }
15
- return await reader.read(options, signal);
16
- };
5
+ async function observeWaitRound(ids, readerFor, signal) {
6
+ const read = (id, ordinaryBudget) => readerFor(id).read({ aperture: "monitoring", ...(ordinaryBudget === undefined ? {} : { ordinaryBudget }) }, signal);
17
7
  signal?.throwIfAborted();
18
8
  if (ids.length <= 1) {
19
9
  const observations = await Promise.all(ids.map(async (id) => await read(id)));
@@ -30,8 +20,6 @@ async function observeWaitRound(path, ids, signal, readers) {
30
20
  remaining -= observed.ordinarySelected;
31
21
  }
32
22
  catch (error) {
33
- readers?.get(id)?.clear();
34
- readers?.delete(id);
35
23
  if (error instanceof AkumaNotBornError)
36
24
  throw error;
37
25
  unobserved.push({ id, diagnostic: diagnostic(error) });
@@ -45,80 +33,32 @@ function roundComplete(round, completion, predicate) {
45
33
  return (settled.length > 0 &&
46
34
  (completion === "any" ? settled.some(Boolean) : round.unobserved.length === 0 && settled.every(Boolean)));
47
35
  }
48
- /** Canonical ids in the caller's selection order, appending any id the caller never named. */
49
- function selectionOrderedIds(ids, order) {
50
- const present = new Set(ids);
51
- const seen = new Set();
52
- const ordered = [];
53
- for (const id of order) {
54
- if (present.has(id) && !seen.has(id)) {
55
- seen.add(id);
56
- ordered.push(id);
57
- }
58
- }
59
- for (const id of ids) {
60
- if (!seen.has(id)) {
61
- seen.add(id);
62
- ordered.push(id);
63
- }
64
- }
65
- return ordered;
66
- }
67
- /**
68
- * The one lower set-observation owner for Akuma wait completion. It serves the
69
- * standalone one-ID association-free face and the plural any/all face with one
70
- * ordered round algorithm, one shared ordinary-detail budget, transient
71
- * unreadable peers, and an honest final deadline edge. A silent observation —
72
- * no live row callback and no custom judge — decides which running rounds to
73
- * skip with the owner's lightweight completion probe over the selected set; a
74
- * live viewer or a custom judge always observes full rounds.
75
- */
36
+ /** Wait observes completion and returns final status snapshots, never a live stream. */
76
37
  export async function executeWaitAkuma(input) {
77
- const readers = input.observe === undefined ? undefined : new Map();
78
- try {
79
- // Identity facts are read once per observed Akuma, not once per 100ms round.
80
- const facts = new Map();
81
- if (input.onSelected !== undefined) {
82
- for (const id of input.ids) {
83
- input.signal?.throwIfAborted();
84
- const known = input.identity === undefined ? undefined : await input.identity(id);
85
- facts.set(id, known ?? { contract: { kind: "none" } });
86
- }
87
- const ordered = input.selectionOrder === undefined ? input.ids : selectionOrderedIds(input.ids, input.selectionOrder);
88
- input.onSelected(ordered.map((id) => ({ id, ...facts.get(id) })));
38
+ const readers = new Map();
39
+ const readerFor = (id) => {
40
+ let reader = readers.get(id);
41
+ if (reader === undefined) {
42
+ reader = createLiveStatusReader(pathsForAkuId(input.path, id), id);
43
+ readers.set(id, reader);
89
44
  }
90
- const observeRound = async (round) => {
91
- await Promise.all(round.observations.map(({ status, rows }) => input.observe === undefined
92
- ? observeStatusOutcome(status, input.outcomeObserved)
93
- : observeOutcomeRows(status.id, rows, input.outcomeObserved)));
94
- if (input.observe === undefined)
95
- return;
96
- const observed = [];
97
- for (const observation of round.observations) {
98
- input.signal?.throwIfAborted();
99
- const { status, rows } = observation;
100
- let known = facts.get(status.id);
101
- if (known === undefined && input.identity !== undefined) {
102
- known = await input.identity(status.id);
103
- facts.set(status.id, known);
104
- }
105
- if (known === undefined) {
106
- observed.push({ status, rows, contract: { kind: "none" } });
107
- continue;
108
- }
109
- observed.push({ status, rows, ...known });
110
- }
111
- input.observe(structuredClone(observed));
112
- };
45
+ return reader;
46
+ };
47
+ try {
113
48
  const waited = await waitForObservation({
49
+ pollMs: 250,
114
50
  ...(input.timeoutMs === undefined ? {} : { timeoutMs: input.timeoutMs }),
115
51
  ...(input.signal === undefined ? {} : { signal: input.signal }),
116
- ...(input.predicate === undefined && input.observe === undefined
117
- ? { probe: async () => await readWaitComplete(input.path, input.ids, input.completion, input.signal) }
52
+ ...(input.predicate === undefined
53
+ ? {
54
+ probe: async () => await readWaitComplete(input.path, input.ids, input.completion, input.signal, (id) => readerFor(id).complete(input.signal)),
55
+ }
118
56
  : {}),
119
- observe: async () => await observeWaitRound(input.path, input.ids, input.signal, readers),
57
+ observe: async () => await observeWaitRound(input.ids, readerFor, input.signal),
120
58
  complete: (round) => roundComplete(round, input.completion, input.predicate),
121
- onObserve: async (round) => await observeRound(round),
59
+ onObserve: async (round) => {
60
+ await Promise.all(round.observations.map(({ status }) => observeStatusOutcome(status, input.outcomeObserved)));
61
+ },
122
62
  });
123
63
  return {
124
64
  mode: input.completion,
@@ -128,9 +68,8 @@ export async function executeWaitAkuma(input) {
128
68
  };
129
69
  }
130
70
  finally {
131
- for (const reader of readers?.values() ?? [])
71
+ for (const reader of readers.values())
132
72
  reader.clear();
133
- readers?.clear();
134
73
  }
135
74
  }
136
75
  function diagnostic(error) {
@@ -3,7 +3,7 @@ import { type BoundedList } from "../bounded-list.js";
3
3
  import type { AkumaAlias } from "../identity/selector.js";
4
4
  import type { WorldRoot } from "../world.js";
5
5
  import type { AkumaLife } from "./heart/index.js";
6
- import { type AkuId } from "./identity.js";
6
+ import { type AkuId, type AkumaPaths } from "./identity.js";
7
7
  export type AkumaListRow = Readonly<{
8
8
  id: AkuId;
9
9
  archetype: string;
@@ -34,6 +34,30 @@ export type AkumaListInput = Readonly<{
34
34
  }>;
35
35
  export declare const akumaStatusSchema: z.ZodObject<{
36
36
  id: z.ZodPipe<z.ZodString, z.ZodTransform<AkuId, string>>;
37
+ birth: z.ZodObject<{
38
+ origin: z.ZodDiscriminatedUnion<[z.ZodObject<{
39
+ kind: z.ZodLiteral<"direct">;
40
+ }, z.core.$strip>, z.ZodObject<{
41
+ kind: z.ZodLiteral<"request">;
42
+ parent: z.ZodPipe<z.ZodString, z.ZodTransform<AkuId, string>>;
43
+ requestId: z.ZodString;
44
+ }, z.core.$strip>, z.ZodObject<{
45
+ kind: z.ZodLiteral<"fork">;
46
+ parent: z.ZodPipe<z.ZodString, z.ZodTransform<AkuId, string>>;
47
+ at: z.ZodString;
48
+ }, z.core.$strip>], "kind">;
49
+ caller: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
50
+ kind: z.ZodLiteral<"akuma">;
51
+ world: z.ZodCustom<WorldRoot, WorldRoot>;
52
+ akuId: z.ZodPipe<z.ZodString, z.ZodTransform<AkuId, string>>;
53
+ }, z.core.$strict>, z.ZodObject<{
54
+ kind: z.ZodLiteral<"external">;
55
+ integration: z.ZodString;
56
+ id: z.ZodString;
57
+ }, z.core.$strict>], "kind">, z.ZodObject<{
58
+ kind: z.ZodLiteral<"unknown">;
59
+ }, z.core.$strict>]>;
60
+ }, z.core.$strict>;
37
61
  life: z.ZodEnum<{
38
62
  killed: "killed";
39
63
  hung: "hung";
@@ -43,24 +67,21 @@ export declare const akumaStatusSchema: z.ZodObject<{
43
67
  stranded: "stranded";
44
68
  }>;
45
69
  cwd: z.ZodOptional<z.ZodString>;
70
+ provider: z.ZodOptional<z.ZodString>;
71
+ model: z.ZodOptional<z.ZodString>;
46
72
  allowed: z.ZodPipe<z.ZodArray<z.ZodEnum<{
47
- "task.add": "task.add";
48
- "task.addDocument": "task.addDocument";
49
- "task.compose": "task.compose";
50
- "task.done": "task.done";
51
- "task.drop": "task.drop";
52
- "task.hold": "task.hold";
53
- "task.resume": "task.resume";
54
- "task.start": "task.start";
55
- "task.stop": "task.stop";
56
- "task.update": "task.update";
73
+ "debt.add": "debt.add";
74
+ "debt.addDocument": "debt.addDocument";
75
+ "debt.done": "debt.done";
76
+ "debt.drop": "debt.drop";
77
+ "debt.update": "debt.update";
57
78
  "akuma.call": "akuma.call";
58
79
  "akuma.kill": "akuma.kill";
59
80
  "akuma.tell": "akuma.tell";
60
81
  "contract.audit": "contract.audit";
61
82
  "contract.deliver": "contract.deliver";
62
83
  "contract.review": "contract.review";
63
- }>>, z.ZodTransform<import("./allowed.js").AllowedActions, ("task.add" | "task.addDocument" | "task.compose" | "task.done" | "task.drop" | "task.hold" | "task.resume" | "task.start" | "task.stop" | "task.update" | "akuma.call" | "akuma.kill" | "akuma.tell" | "contract.audit" | "contract.deliver" | "contract.review")[]>>;
84
+ }>>, z.ZodTransform<import("./allowed.js").AllowedActions, ("debt.add" | "debt.addDocument" | "debt.done" | "debt.drop" | "debt.update" | "akuma.call" | "akuma.kill" | "akuma.tell" | "contract.audit" | "contract.deliver" | "contract.review")[]>>;
64
85
  timeline: z.ZodUnion<readonly [z.ZodObject<{
65
86
  reportedChanges: z.ZodReadonly<z.ZodArray<z.ZodObject<{
66
87
  sequence: z.ZodNumber;
@@ -204,6 +225,7 @@ export declare const akumaStatusSchema: z.ZodObject<{
204
225
  unspecified: "unspecified";
205
226
  }>;
206
227
  path: z.ZodString;
228
+ patch: z.ZodOptional<z.ZodString>;
207
229
  diffstat: z.ZodOptional<z.ZodObject<{
208
230
  added: z.ZodNumber;
209
231
  removed: z.ZodNumber;
@@ -218,6 +240,7 @@ export declare const akumaStatusSchema: z.ZodObject<{
218
240
  }, z.core.$strict>>;
219
241
  }, z.core.$strict>]>;
220
242
  state: z.ZodLiteral<"active">;
243
+ toolId: z.ZodOptional<z.ZodString>;
221
244
  truncated: z.ZodOptional<z.ZodLiteral<true>>;
222
245
  }, z.core.$strict>, z.ZodObject<{
223
246
  kind: z.ZodLiteral<"tool">;
@@ -254,6 +277,7 @@ export declare const akumaStatusSchema: z.ZodObject<{
254
277
  unspecified: "unspecified";
255
278
  }>;
256
279
  path: z.ZodString;
280
+ patch: z.ZodOptional<z.ZodString>;
257
281
  diffstat: z.ZodOptional<z.ZodObject<{
258
282
  added: z.ZodNumber;
259
283
  removed: z.ZodNumber;
@@ -273,8 +297,10 @@ export declare const akumaStatusSchema: z.ZodObject<{
273
297
  ok: "ok";
274
298
  }>;
275
299
  message: z.ZodOptional<z.ZodString>;
300
+ output: z.ZodOptional<z.ZodString>;
276
301
  exitCode: z.ZodOptional<z.ZodNumber>;
277
302
  }, z.core.$strict>;
303
+ toolId: z.ZodOptional<z.ZodString>;
278
304
  truncated: z.ZodOptional<z.ZodLiteral<true>>;
279
305
  }, z.core.$strict>]>;
280
306
  }, z.core.$strict>]>>>;
@@ -307,6 +333,7 @@ export declare const akumaStatusSchema: z.ZodObject<{
307
333
  kind: z.ZodLiteral<"answered">;
308
334
  historyId: z.ZodString;
309
335
  answer: z.ZodString;
336
+ foldedSaidSequence: z.ZodOptional<z.ZodNumber>;
310
337
  }, z.core.$strict>, z.ZodObject<{
311
338
  kind: z.ZodLiteral<"failed">;
312
339
  historyId: z.ZodString;
@@ -412,6 +439,7 @@ export declare const akumaStatusSchema: z.ZodObject<{
412
439
  unspecified: "unspecified";
413
440
  }>;
414
441
  path: z.ZodString;
442
+ patch: z.ZodOptional<z.ZodString>;
415
443
  diffstat: z.ZodOptional<z.ZodObject<{
416
444
  added: z.ZodNumber;
417
445
  removed: z.ZodNumber;
@@ -431,8 +459,10 @@ export declare const akumaStatusSchema: z.ZodObject<{
431
459
  ok: "ok";
432
460
  }>;
433
461
  message: z.ZodOptional<z.ZodString>;
462
+ output: z.ZodOptional<z.ZodString>;
434
463
  exitCode: z.ZodOptional<z.ZodNumber>;
435
464
  }, z.core.$strict>;
465
+ toolId: z.ZodOptional<z.ZodString>;
436
466
  truncated: z.ZodOptional<z.ZodLiteral<true>>;
437
467
  }, z.core.$strict>]>;
438
468
  }, z.core.$strict>]>>>;
@@ -441,10 +471,16 @@ export declare const akumaStatusSchema: z.ZodObject<{
441
471
  strandedReason: z.ZodOptional<z.ZodLiteral<"resume-unsupported">>;
442
472
  }, z.core.$strict>;
443
473
  export type AkumaStatus = z.infer<typeof akumaStatusSchema>;
444
- export declare function parseAkumaStatus(value: unknown): AkumaStatus;
445
- export declare function listAkumaArchetypes(path: WorldRoot, input?: Readonly<{
446
- home?: string;
447
- }>): Promise<readonly string[]>;
474
+ /** One recognized Akuma directory under this World's run root. */
475
+ export type KnownAkuma = Readonly<{
476
+ id: AkuId;
477
+ paths: AkumaPaths;
478
+ }>;
479
+ /** Enumerate the recognized Akuma directories under this World's run root. */
480
+ export declare function knownAkuma(path: WorldRoot, selected?: string): Promise<Readonly<{
481
+ runRoot: string;
482
+ rows: readonly KnownAkuma[];
483
+ }>>;
448
484
  /**
449
485
  * The bounded recent-activity roster: native membership, semantic order and
450
486
  * observed extent. World Alias context is attached by the upper composition.