@north-light/cli 0.3.529 → 0.3.531

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 (509) hide show
  1. package/dist/api/dto/lifecycle.d.ts +3 -1
  2. package/dist/api/dto/messages.d.ts +5 -3
  3. package/dist/builtin-memory/crouter-plugin/bundles-and-memory.md +1 -1
  4. package/dist/builtin-memory/crouter-plugin/commands.md +1 -1
  5. package/dist/clients/attach/session/connection.js +1 -1
  6. package/dist/clients/attach/session/reconnect.js +1 -1
  7. package/dist/clients/attach/viewer.js +508 -508
  8. package/dist/commands/node/message.js +1 -1
  9. package/dist/commands/sys/join.js +1 -1
  10. package/dist/core/async-array.d.ts +7 -0
  11. package/dist/core/async-array.js +1 -0
  12. package/dist/core/audit.d.ts +1 -1
  13. package/dist/core/audit.js +2 -2
  14. package/dist/core/canvas/attention.d.ts +4 -4
  15. package/dist/core/canvas/attention.js +1 -1
  16. package/dist/core/canvas/boot.d.ts +4 -4
  17. package/dist/core/canvas/boot.js +1 -1
  18. package/dist/core/canvas/canvas.d.ts +59 -59
  19. package/dist/core/canvas/canvas.js +19 -19
  20. package/dist/core/canvas/context-strip.js +2 -2
  21. package/dist/core/canvas/crons.d.ts +27 -27
  22. package/dist/core/canvas/crons.js +11 -11
  23. package/dist/core/canvas/daemon-actions.d.ts +10 -10
  24. package/dist/core/canvas/daemon-actions.js +8 -8
  25. package/dist/core/canvas/daemon-owner.d.ts +3 -3
  26. package/dist/core/canvas/daemon-owner.js +2 -2
  27. package/dist/core/canvas/db.d.ts +19 -30
  28. package/dist/core/canvas/db.js +3 -2
  29. package/dist/core/canvas/deliveries.d.ts +16 -16
  30. package/dist/core/canvas/deliveries.js +24 -24
  31. package/dist/core/canvas/executions.d.ts +8 -8
  32. package/dist/core/canvas/executions.js +1 -1
  33. package/dist/core/canvas/focuses.d.ts +8 -8
  34. package/dist/core/canvas/focuses.js +1 -1
  35. package/dist/core/canvas/history.d.ts +3 -3
  36. package/dist/core/canvas/history.js +9 -9
  37. package/dist/core/canvas/install-id.d.ts +1 -1
  38. package/dist/core/canvas/install-id.js +1 -1
  39. package/dist/core/canvas/managed-worktree-sweep-candidates.d.ts +1 -1
  40. package/dist/core/canvas/managed-worktree-sweep-candidates.js +2 -2
  41. package/dist/core/canvas/memory-reads.d.ts +6 -6
  42. package/dist/core/canvas/memory-reads.js +1 -1
  43. package/dist/core/canvas/nav-model.d.ts +13 -13
  44. package/dist/core/canvas/nav-model.js +1 -1
  45. package/dist/core/canvas/node-agent-paths.d.ts +6 -6
  46. package/dist/core/canvas/node-agent-paths.js +1 -1
  47. package/dist/core/canvas/node-tokens.d.ts +7 -7
  48. package/dist/core/canvas/node-tokens.js +3 -3
  49. package/dist/core/canvas/outcome-actions.d.ts +5 -5
  50. package/dist/core/canvas/outcome-actions.js +3 -3
  51. package/dist/core/canvas/recovery.d.ts +26 -26
  52. package/dist/core/canvas/recovery.js +2 -2
  53. package/dist/core/canvas/render-source.d.ts +1 -1
  54. package/dist/core/canvas/render-source.js +1 -1
  55. package/dist/core/canvas/sessions.d.ts +10 -10
  56. package/dist/core/canvas/sessions.js +4 -4
  57. package/dist/core/canvas/source.js +1 -1
  58. package/dist/core/canvas/structured-requests.d.ts +15 -15
  59. package/dist/core/canvas/structured-requests.js +5 -5
  60. package/dist/core/canvas/tree.d.ts +9 -9
  61. package/dist/core/canvas/tree.js +5 -5
  62. package/dist/core/canvas/waits.d.ts +13 -13
  63. package/dist/core/canvas/waits.js +6 -6
  64. package/dist/core/canvas/worktrees.d.ts +15 -15
  65. package/dist/core/canvas/worktrees.js +1 -1
  66. package/dist/core/command-hooks/lifecycle-catalog.d.ts +4 -4
  67. package/dist/core/command-hooks/lifecycle-catalog.js +1 -1
  68. package/dist/core/command-hooks/transport/exec-lifecycle.js +1 -1
  69. package/dist/core/command-plugins/bundle.d.ts +1 -1
  70. package/dist/core/command-plugins/bundle.js +1 -1
  71. package/dist/core/conversation-store/file-store.d.ts +7 -7
  72. package/dist/core/conversation-store/file-store.js +9 -9
  73. package/dist/core/conversation-store/index.d.ts +16 -14
  74. package/dist/core/conversation-store/index.js +1 -1
  75. package/dist/core/conversation-store/listener.js +5 -5
  76. package/dist/core/conversation-store/patch.d.ts +3 -1
  77. package/dist/core/conversation-store/patch.js +1 -1
  78. package/dist/core/directory/join.d.ts +1 -1
  79. package/dist/core/feed/feed.js +3 -3
  80. package/dist/core/feed/inbox.d.ts +2 -2
  81. package/dist/core/feed/inbox.js +1 -1
  82. package/dist/core/feed/messages.d.ts +11 -12
  83. package/dist/core/feed/messages.js +5 -5
  84. package/dist/core/feed/reports.d.ts +4 -4
  85. package/dist/core/feed/reports.js +2 -2
  86. package/dist/core/grants/cover.d.ts +1 -1
  87. package/dist/core/grants/cover.js +1 -1
  88. package/dist/core/grants/local.d.ts +1 -1
  89. package/dist/core/grants/local.js +1 -1
  90. package/dist/core/grants/mirror.d.ts +19 -19
  91. package/dist/core/grants/mirror.js +2 -2
  92. package/dist/core/grants/on-sync.d.ts +1 -1
  93. package/dist/core/grants/on-sync.js +1 -1
  94. package/dist/core/grants/remove.js +1 -1
  95. package/dist/core/grants/sync.js +1 -1
  96. package/dist/core/graph/access.d.ts +17 -17
  97. package/dist/core/graph/access.js +3 -3
  98. package/dist/core/graph/custom.d.ts +16 -16
  99. package/dist/core/graph/custom.js +9 -9
  100. package/dist/core/graph/deletion.d.ts +3 -7
  101. package/dist/core/graph/deletion.js +4 -4
  102. package/dist/core/graph/documents.d.ts +24 -27
  103. package/dist/core/graph/documents.js +7 -7
  104. package/dist/core/graph/edges.d.ts +13 -13
  105. package/dist/core/graph/edges.js +1 -1
  106. package/dist/core/graph/events.d.ts +7 -9
  107. package/dist/core/graph/events.js +8 -8
  108. package/dist/core/graph/exposures.d.ts +6 -6
  109. package/dist/core/graph/exposures.js +4 -4
  110. package/dist/core/graph/jobs.d.ts +6 -8
  111. package/dist/core/graph/jobs.js +2 -2
  112. package/dist/core/graph/kinds/action.js +1 -1
  113. package/dist/core/graph/kinds/custom.js +2 -2
  114. package/dist/core/graph/kinds/document.d.ts +1 -0
  115. package/dist/core/graph/kinds/document.js +4 -4
  116. package/dist/core/graph/kinds/dto.d.ts +2 -2
  117. package/dist/core/graph/kinds/dto.js +1 -1
  118. package/dist/core/graph/kinds/job.js +2 -2
  119. package/dist/core/graph/kinds/kind.d.ts +6 -8
  120. package/dist/core/graph/kinds/kind.js +1 -1
  121. package/dist/core/graph/kinds/node.js +5 -5
  122. package/dist/core/graph/kinds/owner.js +2 -2
  123. package/dist/core/graph/kinds/registry.d.ts +6 -9
  124. package/dist/core/graph/kinds/registry.js +1 -1
  125. package/dist/core/graph/names.d.ts +6 -6
  126. package/dist/core/graph/names.js +3 -3
  127. package/dist/core/graph/object-waits.d.ts +4 -7
  128. package/dist/core/graph/object-waits.js +1 -1
  129. package/dist/core/graph/objects.d.ts +14 -14
  130. package/dist/core/graph/objects.js +9 -9
  131. package/dist/core/graph/package-docs.d.ts +2 -7
  132. package/dist/core/graph/package-docs.js +5 -5
  133. package/dist/core/graph/package-kinds.d.ts +2 -5
  134. package/dist/core/graph/package-kinds.js +1 -1
  135. package/dist/core/graph/package-reconcile.d.ts +2 -5
  136. package/dist/core/graph/package-reconcile.js +1 -1
  137. package/dist/core/graph/reader.d.ts +18 -18
  138. package/dist/core/graph/reader.js +3 -3
  139. package/dist/core/graph/receivers.d.ts +4 -4
  140. package/dist/core/graph/receivers.js +5 -5
  141. package/dist/core/graph/repo-sync/exchange.d.ts +3 -7
  142. package/dist/core/graph/repo-sync/exchange.js +2 -2
  143. package/dist/core/graph/repo-sync/repos.d.ts +7 -5
  144. package/dist/core/graph/repo-sync/repos.js +3 -3
  145. package/dist/core/graph/repo-sync/sync.d.ts +3 -6
  146. package/dist/core/graph/repo-sync/sync.js +2 -2
  147. package/dist/core/graph/rules.d.ts +5 -5
  148. package/dist/core/graph/rules.js +3 -3
  149. package/dist/core/graph/spaces/app.js +1 -1
  150. package/dist/core/graph/spaces/index.d.ts +4 -5
  151. package/dist/core/graph/spaces/index.js +1 -1
  152. package/dist/core/graph/spaces/own-memory.d.ts +4 -4
  153. package/dist/core/graph/spaces/own-memory.js +1 -1
  154. package/dist/core/graph/spaces/person.js +3 -3
  155. package/dist/core/graph/spaces/repo.d.ts +1 -1
  156. package/dist/core/graph/spaces/repo.js +1 -1
  157. package/dist/core/graph/watches.d.ts +15 -15
  158. package/dist/core/graph/watches.js +10 -10
  159. package/dist/core/human/feedback-companion.d.ts +2 -2
  160. package/dist/core/human/feedback-companion.js +1 -1
  161. package/dist/core/human/feedback.d.ts +3 -3
  162. package/dist/core/human/feedback.js +1 -1
  163. package/dist/core/human/requests.d.ts +34 -33
  164. package/dist/core/human/requests.js +20 -20
  165. package/dist/core/human/scan.d.ts +2 -2
  166. package/dist/core/human/scan.js +1 -1
  167. package/dist/core/human/tickets.d.ts +9 -9
  168. package/dist/core/human/tickets.js +1 -1
  169. package/dist/core/llm/app-rungs.d.ts +1 -1
  170. package/dist/core/llm/app-rungs.js +1 -1
  171. package/dist/core/llm/run.js +1 -1
  172. package/dist/core/peer/directory.d.ts +1 -1
  173. package/dist/core/peer/directory.js +1 -1
  174. package/dist/core/peer/envelope.d.ts +3 -3
  175. package/dist/core/peer/envelope.js +1 -1
  176. package/dist/core/peer/home.d.ts +7 -7
  177. package/dist/core/peer/home.js +2 -2
  178. package/dist/core/peer/ingest.d.ts +6 -6
  179. package/dist/core/peer/ingest.js +1 -1
  180. package/dist/core/peer/outbox-store.d.ts +14 -14
  181. package/dist/core/peer/outbox-store.js +5 -5
  182. package/dist/core/peer/receiver.d.ts +2 -2
  183. package/dist/core/peer/receiver.js +1 -1
  184. package/dist/core/peer/stubs.d.ts +10 -10
  185. package/dist/core/peer/stubs.js +1 -1
  186. package/dist/core/providers/approval.d.ts +2 -2
  187. package/dist/core/providers/approval.js +2 -2
  188. package/dist/core/providers/audit.d.ts +3 -3
  189. package/dist/core/providers/audit.js +2 -2
  190. package/dist/core/providers/bundles.js +2 -2
  191. package/dist/core/providers/call.d.ts +2 -2
  192. package/dist/core/providers/call.js +1 -1
  193. package/dist/core/providers/files.d.ts +1 -1
  194. package/dist/core/providers/files.js +1 -1
  195. package/dist/core/providers/mint.js +1 -1
  196. package/dist/core/providers/receipts.d.ts +1 -1
  197. package/dist/core/providers/receipts.js +2 -2
  198. package/dist/core/review/birth.js +1 -1
  199. package/dist/core/review/comments.d.ts +19 -19
  200. package/dist/core/review/comments.js +5 -5
  201. package/dist/core/review/companion.d.ts +1 -1
  202. package/dist/core/review/companion.js +1 -1
  203. package/dist/core/review/document.d.ts +3 -3
  204. package/dist/core/review/document.js +2 -2
  205. package/dist/core/review/fork.js +2 -2
  206. package/dist/core/review/realize.js +1 -1
  207. package/dist/core/review/remap.d.ts +2 -2
  208. package/dist/core/review/remap.js +4 -4
  209. package/dist/core/review/stage.d.ts +1 -1
  210. package/dist/core/review/stage.js +1 -1
  211. package/dist/core/review/store.d.ts +21 -21
  212. package/dist/core/review/store.js +1 -1
  213. package/dist/core/runs/activity.d.ts +1 -1
  214. package/dist/core/runs/activity.js +5 -5
  215. package/dist/core/runs/confinement.d.ts +7 -7
  216. package/dist/core/runs/confinement.js +2 -2
  217. package/dist/core/runs/events.d.ts +12 -12
  218. package/dist/core/runs/events.js +4 -4
  219. package/dist/core/runs/operations.d.ts +11 -11
  220. package/dist/core/runs/operations.js +5 -5
  221. package/dist/core/runs/questions.d.ts +10 -10
  222. package/dist/core/runs/questions.js +3 -3
  223. package/dist/core/runtime/auth-reload.js +1 -1
  224. package/dist/core/runtime/bearings.d.ts +5 -5
  225. package/dist/core/runtime/bearings.js +6 -6
  226. package/dist/core/runtime/broker-inventory.js +1 -1
  227. package/dist/core/runtime/broker-request.js +1 -1
  228. package/dist/core/runtime/broker.js +1 -1
  229. package/dist/core/runtime/close.d.ts +3 -3
  230. package/dist/core/runtime/close.js +1 -1
  231. package/dist/core/runtime/deliver-live.js +1 -1
  232. package/dist/core/runtime/fleet.d.ts +2 -2
  233. package/dist/core/runtime/host.d.ts +3 -3
  234. package/dist/core/runtime/host.js +3 -3
  235. package/dist/core/runtime/kickoff.d.ts +12 -12
  236. package/dist/core/runtime/kickoff.js +17 -17
  237. package/dist/core/runtime/launch-target.d.ts +1 -1
  238. package/dist/core/runtime/launch-target.js +1 -1
  239. package/dist/core/runtime/ledger.d.ts +3 -3
  240. package/dist/core/runtime/ledger.js +3 -3
  241. package/dist/core/runtime/lifecycle.d.ts +1 -1
  242. package/dist/core/runtime/lifecycle.js +2 -2
  243. package/dist/core/runtime/memory-admission.js +1 -1
  244. package/dist/core/runtime/model-swap.d.ts +2 -2
  245. package/dist/core/runtime/model-swap.js +1 -1
  246. package/dist/core/runtime/node-read.d.ts +1 -1
  247. package/dist/core/runtime/node-read.js +2 -2
  248. package/dist/core/runtime/nodes.d.ts +6 -6
  249. package/dist/core/runtime/nodes.js +1 -1
  250. package/dist/core/runtime/outcome-document.d.ts +1 -1
  251. package/dist/core/runtime/outcome-document.js +1 -1
  252. package/dist/core/runtime/persona.d.ts +3 -3
  253. package/dist/core/runtime/persona.js +2 -2
  254. package/dist/core/runtime/placement.d.ts +11 -11
  255. package/dist/core/runtime/placement.js +1 -1
  256. package/dist/core/runtime/promote.d.ts +3 -3
  257. package/dist/core/runtime/promote.js +1 -1
  258. package/dist/core/runtime/recycle.js +1 -1
  259. package/dist/core/runtime/reopen.d.ts +21 -10
  260. package/dist/core/runtime/reopen.js +1 -1
  261. package/dist/core/runtime/reset.d.ts +4 -4
  262. package/dist/core/runtime/reset.js +1 -1
  263. package/dist/core/runtime/revive-all.d.ts +2 -2
  264. package/dist/core/runtime/revive-all.js +1 -1
  265. package/dist/core/runtime/revive.d.ts +4 -4
  266. package/dist/core/runtime/revive.js +2 -2
  267. package/dist/core/runtime/roadmap.d.ts +6 -6
  268. package/dist/core/runtime/roadmap.js +5 -5
  269. package/dist/core/runtime/session-branch.d.ts +1 -1
  270. package/dist/core/runtime/session-branch.js +1 -1
  271. package/dist/core/runtime/session-list-cache.js +1 -1
  272. package/dist/core/runtime/situational-live.js +1 -1
  273. package/dist/core/runtime/spawn.d.ts +2 -2
  274. package/dist/core/runtime/spawn.js +2 -2
  275. package/dist/core/runtime/stop-guard.d.ts +2 -2
  276. package/dist/core/runtime/stop-guard.js +3 -3
  277. package/dist/core/runtime/warm-pool.d.ts +2 -2
  278. package/dist/core/runtime/warm-pool.js +1 -1
  279. package/dist/core/spaces/mounts.d.ts +2 -2
  280. package/dist/core/spaces/mounts.js +1 -1
  281. package/dist/core/spaces/permissions.d.ts +1 -1
  282. package/dist/core/spaces/permissions.js +1 -1
  283. package/dist/core/spaces/process.d.ts +1 -1
  284. package/dist/core/spaces/process.js +1 -1
  285. package/dist/core/spaces/space.js +1 -1
  286. package/dist/core/spaces/stop.d.ts +3 -3
  287. package/dist/core/spaces/stop.js +2 -2
  288. package/dist/core/spaces/users.d.ts +6 -6
  289. package/dist/core/spaces/users.js +1 -1
  290. package/dist/core/storage/attachments.d.ts +2 -2
  291. package/dist/core/storage/attachments.js +1 -1
  292. package/dist/core/storage/shares.d.ts +2 -2
  293. package/dist/core/storage/shares.js +1 -1
  294. package/dist/core/storage/tables.d.ts +21 -21
  295. package/dist/core/storage/tables.js +3 -3
  296. package/dist/core/substrate/delivery/corpus.d.ts +5 -8
  297. package/dist/core/substrate/delivery/corpus.js +3 -3
  298. package/dist/core/substrate/delivery/deliver.d.ts +10 -15
  299. package/dist/core/substrate/delivery/deliver.js +3 -3
  300. package/dist/core/substrate/delivery/plan.d.ts +2 -12
  301. package/dist/core/substrate/delivery/plan.js +3 -3
  302. package/dist/core/substrate/delivery/render-boot.d.ts +4 -4
  303. package/dist/core/substrate/delivery/render-boot.js +18 -18
  304. package/dist/core/substrate/delivery/render-event.d.ts +7 -14
  305. package/dist/core/substrate/delivery/render-event.js +4 -4
  306. package/dist/core/substrate/subject.d.ts +2 -2
  307. package/dist/core/substrate/subject.js +1 -1
  308. package/dist/core/usage/ledger.d.ts +6 -6
  309. package/dist/core/usage/ledger.js +4 -4
  310. package/dist/core/worktree-close.js +4 -4
  311. package/dist/core/worktree-mutation-async.js +7 -7
  312. package/dist/core/worktree-quarantine.js +1 -1
  313. package/dist/core/worktree-sweep.d.ts +1 -1
  314. package/dist/core/worktree-sweep.js +6 -6
  315. package/dist/core/worktree.d.ts +5 -5
  316. package/dist/core/worktree.js +13 -13
  317. package/dist/daemon/analytics/compute.d.ts +2 -2
  318. package/dist/daemon/analytics/compute.js +1 -1
  319. package/dist/daemon/api/app-listener.d.ts +4 -4
  320. package/dist/daemon/api/app-listener.js +13 -13
  321. package/dist/daemon/api/bridge.js +5 -5
  322. package/dist/daemon/api/document-listener.js +6 -6
  323. package/dist/daemon/api/handlers/analytics.js +1 -1
  324. package/dist/daemon/api/handlers/attach.js +1 -1
  325. package/dist/daemon/api/handlers/bash-jobs.js +1 -1
  326. package/dist/daemon/api/handlers/bash.js +1 -1
  327. package/dist/daemon/api/handlers/broker-ops.d.ts +1 -1
  328. package/dist/daemon/api/handlers/broker-ops.js +1 -1
  329. package/dist/daemon/api/handlers/broker-recovery.d.ts +1 -1
  330. package/dist/daemon/api/handlers/broker-recovery.js +1 -1
  331. package/dist/daemon/api/handlers/broker-signals.d.ts +2 -2
  332. package/dist/daemon/api/handlers/broker-signals.js +2 -2
  333. package/dist/daemon/api/handlers/canvas.d.ts +1 -1
  334. package/dist/daemon/api/handlers/canvas.js +4 -4
  335. package/dist/daemon/api/handlers/chat-inventory.js +1 -1
  336. package/dist/daemon/api/handlers/crons.js +1 -1
  337. package/dist/daemon/api/handlers/custom-objects.d.ts +4 -4
  338. package/dist/daemon/api/handlers/custom-objects.js +3 -3
  339. package/dist/daemon/api/handlers/delivery-retry.js +1 -1
  340. package/dist/daemon/api/handlers/delivery.js +1 -1
  341. package/dist/daemon/api/handlers/docs.d.ts +4 -4
  342. package/dist/daemon/api/handlers/docs.js +1 -1
  343. package/dist/daemon/api/handlers/feedback-comments.js +3 -3
  344. package/dist/daemon/api/handlers/files.js +1 -1
  345. package/dist/daemon/api/handlers/focus.js +1 -1
  346. package/dist/daemon/api/handlers/health.js +3 -3
  347. package/dist/daemon/api/handlers/hook-exec.js +1 -1
  348. package/dist/daemon/api/handlers/human-requests.js +1 -1
  349. package/dist/daemon/api/handlers/inbox-page.d.ts +1 -1
  350. package/dist/daemon/api/handlers/inbox-page.js +1 -1
  351. package/dist/daemon/api/handlers/inbox.d.ts +1 -1
  352. package/dist/daemon/api/handlers/inbox.js +1 -1
  353. package/dist/daemon/api/handlers/llm.d.ts +1 -1
  354. package/dist/daemon/api/handlers/llm.js +3 -3
  355. package/dist/daemon/api/handlers/memory-reads.js +1 -1
  356. package/dist/daemon/api/handlers/memory.d.ts +5 -5
  357. package/dist/daemon/api/handlers/memory.js +5 -5
  358. package/dist/daemon/api/handlers/messages.js +2 -2
  359. package/dist/daemon/api/handlers/node-events.d.ts +2 -2
  360. package/dist/daemon/api/handlers/node-events.js +3 -3
  361. package/dist/daemon/api/handlers/node-outcomes.js +1 -1
  362. package/dist/daemon/api/handlers/node-records.js +2 -2
  363. package/dist/daemon/api/handlers/nodes.d.ts +1 -1
  364. package/dist/daemon/api/handlers/nodes.js +1 -1
  365. package/dist/daemon/api/handlers/objects.js +3 -3
  366. package/dist/daemon/api/handlers/package-docs.js +1 -1
  367. package/dist/daemon/api/handlers/plugin-app-token.d.ts +1 -1
  368. package/dist/daemon/api/handlers/plugin-app-token.js +1 -1
  369. package/dist/daemon/api/handlers/profiles.d.ts +3 -3
  370. package/dist/daemon/api/handlers/profiles.js +1 -1
  371. package/dist/daemon/api/handlers/providers.d.ts +1 -1
  372. package/dist/daemon/api/handlers/providers.js +1 -1
  373. package/dist/daemon/api/handlers/questions.js +1 -1
  374. package/dist/daemon/api/handlers/reports.d.ts +1 -1
  375. package/dist/daemon/api/handlers/reports.js +5 -5
  376. package/dist/daemon/api/handlers/review-comments.js +1 -1
  377. package/dist/daemon/api/handlers/reviews.js +1 -1
  378. package/dist/daemon/api/handlers/runs.js +1 -1
  379. package/dist/daemon/api/handlers/structured-requests.js +1 -1
  380. package/dist/daemon/api/handlers/subscriptions.js +1 -1
  381. package/dist/daemon/api/handlers/transfer.js +1 -1
  382. package/dist/daemon/api/map.d.ts +3 -3
  383. package/dist/daemon/api/map.js +1 -1
  384. package/dist/daemon/api/principal.d.ts +1 -1
  385. package/dist/daemon/api/principal.js +1 -1
  386. package/dist/daemon/api/reader.d.ts +5 -5
  387. package/dist/daemon/api/reader.js +1 -1
  388. package/dist/daemon/api/router.d.ts +5 -5
  389. package/dist/daemon/api/router.js +1 -1
  390. package/dist/daemon/api/server.js +1 -1
  391. package/dist/daemon/broker-signals/bus.d.ts +1 -1
  392. package/dist/daemon/broker-signals/bus.js +1 -1
  393. package/dist/daemon/companion-retire.js +1 -1
  394. package/dist/daemon/cron/armed-context.d.ts +2 -2
  395. package/dist/daemon/cron/armed-context.js +1 -1
  396. package/dist/daemon/cron/authority.d.ts +2 -2
  397. package/dist/daemon/cron/authority.js +1 -1
  398. package/dist/daemon/cron/disposition.js +1 -1
  399. package/dist/daemon/cron/ended.d.ts +1 -1
  400. package/dist/daemon/cron/ended.js +2 -2
  401. package/dist/daemon/cron/escalation.js +3 -3
  402. package/dist/daemon/cron/folders.d.ts +1 -1
  403. package/dist/daemon/cron/folders.js +1 -1
  404. package/dist/daemon/cron/held.d.ts +1 -1
  405. package/dist/daemon/cron/held.js +1 -1
  406. package/dist/daemon/cron/lease-recovery.d.ts +1 -1
  407. package/dist/daemon/cron/lease-recovery.js +1 -1
  408. package/dist/daemon/cron/passes.d.ts +2 -2
  409. package/dist/daemon/cron/passes.js +1 -1
  410. package/dist/daemon/cron/run-socket.d.ts +1 -1
  411. package/dist/daemon/cron/run-socket.js +1 -1
  412. package/dist/daemon/cron/settle.js +1 -1
  413. package/dist/daemon/cron/sinks.d.ts +1 -1
  414. package/dist/daemon/cron/sinks.js +2 -2
  415. package/dist/daemon/cron-run.d.ts +12 -3
  416. package/dist/daemon/cron-run.js +2 -2
  417. package/dist/daemon/crtrd.js +6 -6
  418. package/dist/daemon/delivery/run-delivery.js +1 -1
  419. package/dist/daemon/due-sources.d.ts +3 -3
  420. package/dist/daemon/due-sources.js +1 -1
  421. package/dist/daemon/due.d.ts +3 -3
  422. package/dist/daemon/due.js +7 -7
  423. package/dist/daemon/fleet.d.ts +2 -2
  424. package/dist/daemon/fleet.js +11 -11
  425. package/dist/daemon/human/finish.js +3 -3
  426. package/dist/daemon/human/settle.d.ts +1 -1
  427. package/dist/daemon/human/settle.js +1 -1
  428. package/dist/daemon/human/sweep.js +1 -1
  429. package/dist/daemon/joined-owner.d.ts +3 -3
  430. package/dist/daemon/joined-owner.js +1 -1
  431. package/dist/daemon/messaging/node-message.js +1 -1
  432. package/dist/daemon/park-activity.d.ts +2 -2
  433. package/dist/daemon/park-activity.js +1 -1
  434. package/dist/daemon/peer/authority.js +1 -1
  435. package/dist/daemon/peer/forward.d.ts +6 -6
  436. package/dist/daemon/peer/forward.js +1 -1
  437. package/dist/daemon/peer/handlers.js +1 -1
  438. package/dist/daemon/peer/ingress.d.ts +4 -4
  439. package/dist/daemon/peer/ingress.js +1 -1
  440. package/dist/daemon/peer/outbox.d.ts +2 -2
  441. package/dist/daemon/peer/outbox.js +1 -1
  442. package/dist/daemon/peer/relay-service.js +1 -1
  443. package/dist/daemon/plugin-objects/read-leaf.d.ts +2 -2
  444. package/dist/daemon/plugin-objects/read-leaf.js +2 -2
  445. package/dist/daemon/profile-delete.js +1 -1
  446. package/dist/daemon/readiness.d.ts +2 -2
  447. package/dist/daemon/readiness.js +1 -1
  448. package/dist/daemon/reconcilers/action-lane.d.ts +1 -1
  449. package/dist/daemon/reconcilers/action-lane.js +1 -1
  450. package/dist/daemon/reconcilers/bash-deadline.js +2 -2
  451. package/dist/daemon/reconcilers/broker-supervision.d.ts +1 -1
  452. package/dist/daemon/reconcilers/broker-supervision.js +4 -4
  453. package/dist/daemon/reconcilers/controller-death.d.ts +1 -1
  454. package/dist/daemon/reconcilers/controller-death.js +1 -1
  455. package/dist/daemon/reconcilers/cron-lane.d.ts +1 -1
  456. package/dist/daemon/reconcilers/cron-lane.js +1 -1
  457. package/dist/daemon/reconcilers/delivery-lane.d.ts +1 -1
  458. package/dist/daemon/reconcilers/delivery-lane.js +2 -2
  459. package/dist/daemon/reconcilers/fault-retry-backstop.d.ts +3 -3
  460. package/dist/daemon/reconcilers/fault-retry-backstop.js +1 -1
  461. package/dist/daemon/reconcilers/grove-instance-sweep.d.ts +2 -2
  462. package/dist/daemon/reconcilers/grove-instance-sweep.js +1 -1
  463. package/dist/daemon/reconcilers/live-obligation.d.ts +6 -6
  464. package/dist/daemon/reconcilers/live-obligation.js +1 -1
  465. package/dist/daemon/reconcilers/managed-worktree-sweep.js +1 -1
  466. package/dist/daemon/reconcilers/node-deadline.d.ts +1 -1
  467. package/dist/daemon/reconcilers/node-deadline.js +1 -1
  468. package/dist/daemon/reconcilers/node-lifecycle/freeze-lane.js +1 -1
  469. package/dist/daemon/reconcilers/node-lifecycle/respawn-policy.d.ts +3 -3
  470. package/dist/daemon/reconcilers/node-lifecycle/respawn-policy.js +1 -1
  471. package/dist/daemon/reconcilers/node-lifecycle/terminating.js +1 -1
  472. package/dist/daemon/reconcilers/node-lifecycle/tick.js +1 -1
  473. package/dist/daemon/reconcilers/node-lifecycle/wants-execution.d.ts +1 -1
  474. package/dist/daemon/reconcilers/node-lifecycle/wants-execution.js +1 -1
  475. package/dist/daemon/reconcilers/pending-review-submit.d.ts +1 -1
  476. package/dist/daemon/reconcilers/pending-review-submit.js +1 -1
  477. package/dist/daemon/reconcilers/storage-due-work.js +1 -1
  478. package/dist/daemon/reconcilers/storage-maintenance.d.ts +1 -1
  479. package/dist/daemon/reconcilers/storage-maintenance.js +2 -2
  480. package/dist/daemon/reconcilers/structured-request-lane.d.ts +1 -1
  481. package/dist/daemon/reconcilers/structured-request-lane.js +1 -1
  482. package/dist/daemon/review/comment-notify.js +2 -2
  483. package/dist/daemon/review/companion.d.ts +3 -3
  484. package/dist/daemon/review/companion.js +1 -1
  485. package/dist/daemon/review/finish.js +1 -1
  486. package/dist/daemon/review/sweep.js +1 -1
  487. package/dist/daemon/run-notices.d.ts +4 -4
  488. package/dist/daemon/run-notices.js +1 -1
  489. package/dist/daemon/runs/append-section.d.ts +2 -2
  490. package/dist/daemon/runs/append-section.js +2 -2
  491. package/dist/daemon/runs/observer.d.ts +2 -2
  492. package/dist/daemon/runs/observer.js +2 -2
  493. package/dist/daemon/structured-requests/boot.d.ts +1 -1
  494. package/dist/daemon/structured-requests/boot.js +1 -1
  495. package/dist/daemon/structured-requests/effects.js +1 -1
  496. package/dist/daemon/structured-requests/sidecar.d.ts +1 -1
  497. package/dist/daemon/structured-requests/sidecar.js +1 -1
  498. package/dist/launcher/run.js +1 -1
  499. package/dist/migrations/004-canvas-documents/apply.d.ts +3 -3
  500. package/dist/migrations/004-canvas-documents/apply.js +1 -1
  501. package/dist/migrations/004-canvas-documents/index.d.ts +2 -2
  502. package/dist/migrations/004-canvas-documents/index.js +2 -2
  503. package/dist/migrations/activation.js +2 -2
  504. package/docs/plugin/bundles-and-memory.md +1 -1
  505. package/docs/plugin/commands.md +1 -1
  506. package/docs/public-api.md +11 -0
  507. package/package.json +4 -3
  508. package/packages/crouter-identity/package.json +1 -1
  509. package/runtime.lock.json +12 -12
@@ -1 +1 @@
1
- var _=Object.defineProperty;var i=(e,n)=>_(e,"name",{value:n,configurable:!0});import{envNodeId as y}from"../../shared/env.js";import{defineBranch as C,defineLeaf as w}from"../../core/command.js";import{InputError as o}from"../../core/io.js";import{requireScope as N}from"../../core/errors.js";import{OUTPUT_SCHEMA_CONSTRAINTS as R,OUTPUT_SCHEMA_TRANSPORT as P,parseOutputSchemaValue as E}from"../../core/runtime/structured-output.js";import{cliClient as A,getNodeOrNull as O,rethrowAsCliError as $}from"../api-client.js";function D(e,n){const t=e[n];if(t!==void 0&&(typeof t!="string"||t.trim()==="")){const r=n.replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`);throw new o({error:"empty_discriminant",message:`--${r} must contain non-whitespace text`,received:typeof t=="string"?t:String(t),field:r,next:`Pass a non-empty --${r} value, or omit the flag.`})}}i(D,"requireNonBlankDiscriminant");async function U(e,n){const t=e.to?.trim(),r=e.self===!0,a=t!==void 0&&t!=="";if(a===r)throw new o({error:"bad_target",message:a&&r?"--to and --self are mutually exclusive":n?"no target given \u2014 the message body is not a node id":"exactly one of --to or --self is required",field:a?void 0:"to",next:a?"Pass --to <node-id> or --self.":n?"Pass the node id with --to <node-id> and provide the message body as a positional argument or on stdin, or use --self.":"Pass --to <node-id> or --self."});if(r){const s=y();if(s===void 0||s==="")throw new o({error:"no_node",message:"no node to target with --self (CRTR_NODE_ID unset)",next:"Run from inside a node, or pass --to <node-id>."});return{targetId:s,isSelf:!0}}if(await O(t)===null)throw new o({error:"not_found",message:`no node: ${t}`,field:"to",next:"List nodes with `crtr node inspect list`."});return{targetId:t,isSelf:!1}}i(U,"resolveMsgTarget");function v(){return[{name:"revived",type:"boolean",required:!1,constraint:"True when this request synchronously revived the target; ordinary durable delivery to an active or idle dormant target queues lifecycle revival instead."},{name:"guidance",type:"string",required:!0,constraint:"Immediate action confirmation."}]}i(v,"messageOutput");function b(e){const n=e.to?.trim();if(!(n!==void 0&&n!==""||e.self===!0))return{message:"no target given \u2014 the positional argument is the message body, not a node id",field:"to",next:"Pass the node id with --to <node-id> and pipe the message body on stdin, or use --self."}}i(b,"missingMessageTargetForBody");function I(){return[{kind:"stdin",name:"body",required:!1,constraint:"Visible message body. Required unless --situational-context is supplied.",positionalStdinConflict:b},{kind:"flag",name:"to",type:"string",required:!1,constraint:"Target an existing node by id. Exactly one of --to or --self is required."},{kind:"flag",name:"self",type:"bool",required:!1,constraint:"Target the calling node. Exactly one of --to or --self is required."},{kind:"flag",name:"tier",type:"enum",choices:["critical","urgent","normal","deferred"],required:!1,default:"normal",constraint:"Delivery urgency. Deferred never wakes an idle node, except a terminal one, which has no later cycle to read it on and is raised to urgent."},{kind:"flag",name:"situational-context",type:"string",required:!1,constraint:"Non-empty hidden ambient context delivered beside the message, or alone."},{kind:"flag",name:"reopen",type:"bool",required:!1,constraint:"Re-task the target: commits it resident and clears any finalization latch before delivery. Valid for live, parked, and finalized targets."}]}i(I,"messageSendParams");function M(){return[{kind:"stdin",name:"body",required:!1,constraint:"Visible message body. The schema alone is a complete request.",positionalStdinConflict:b},{kind:"flag",name:"to",type:"string",required:!1,constraint:"Target an existing node by id. Exactly one of --to or --self is required."},{kind:"flag",name:"self",type:"bool",required:!1,constraint:"Target the calling node. Exactly one of --to or --self is required."},{kind:"flag",name:"tier",type:"enum",choices:["critical","urgent","normal"],required:!1,default:"normal",constraint:"Delivery urgency. Every accepted tier queues lifecycle revival for an active or idle dormant target because the request must be answered; deferred is rejected for that reason."},{kind:"flag",name:"output-schema",type:"string",required:!0,constraint:`JSON Schema the result must satisfy. ${P} The target answers with \`crtr push result\` (or declines with \`crtr push result --decline "<reason>" --code <token>\`), then keeps working. ${R}`},{kind:"flag",name:"situational-context",type:"string",required:!1,constraint:"Non-empty hidden ambient context delivered beside the message, or alone."},{kind:"flag",name:"reopen",type:"bool",required:!1,hidden:!0,constraint:"Clear a finalized target latch before delivery or fresh revive."}]}i(M,"messageRequestParams");async function x(e){N("crtr:act","crtr node message");const n=e.situationalContext!==void 0,t=e.situationalContext?.trim();if(n&&t==="")throw new o({error:"empty_situational_context",message:"--situational-context must contain non-whitespace text",field:"situational-context",next:"Pass non-whitespace text, or omit --situational-context."});const r=e.body,a=r!==void 0?r.trim():void 0,m=a!==void 0&&a!=="",{targetId:s}=await U(e,m),u=e.tier,q=u!==void 0&&u!=="",f=E(e.outputSchema),c=f!==null?JSON.stringify(f):null,g=t!==void 0&&t!=="",k=e.reopen===!0;if(c!==null&&u==="deferred")throw new o({error:"output_schema_deferred_tier",message:"--output-schema cannot combine with --tier deferred because the target must answer",field:"tier",next:"Use normal, urgent, or critical tier, or drop --output-schema."});const h=y(),T=A();if(!m&&!g&&c===null)throw new o({error:"empty_body",message:"a message body is required unless --output-schema or --situational-context is supplied",field:"body",next:"Pass the message on stdin, or supply one of the documented alternatives."});const p=q?u:"normal",d=await T.sendMessage(s,{body:a??"",tier:p,...k?{reopen:!0}:{},...g?{situational_context:t}:{},...c!==null?{output_schema:c}:{},...h!==void 0?{from:h}:{}}).catch($);if(d.wake_failed!==void 0){const l=d.wake_failed;return{revived:!1,guidance:`Accepted but NOT delivered to a running node \u2014 waking the target failed (${l.error}): ${l.message}${l.next===void 0?"":` ${l.next}`} The message is queued durably (${l.message_id}); do not resend it.`}}const S=d.revived?"Delivered \u2014 the dormant target was revived to receive it.":p!=="deferred"?"Delivered.":d.delivered_tier===void 0?"Delivered \u2014 held for the target's next natural cycle; not revived.":"Delivered \u2014 the target is terminal and takes no later cycle, so it was raised to urgent rather than held.";return{revived:d.revived,guidance:S}}i(x,"runMessageEngine");const j=w({name:"send",description:"deliver an inbox message to an existing node immediately",whenToUse:"a target chosen with `--to <node-id>` or `--self` should have information or new direction now \u2014 steering a worker mid-task, handing over a finding it needs, correcting a wrong turn, or waking a dormant node with fresh work. The target reads it and decides what to do with it. Use `node message request` instead when you need an answer back in a shape you specify, and `node subscription add` when the target should keep receiving this node\u2019s pushes rather than this one delivery",help:{name:"node message send",summary:"deliver an inbox message to an existing node immediately",params:I(),output:v(),outputKind:"object",effects:["Appends one inbox entry. Critical, urgent, and normal delivery queues lifecycle revival for an active or idle dormant target; deferred waits for its next natural cycle.","--reopen commits the target resident and clears any finalization latch before delivery, allowing it to take a new mandate; it is valid for live, parked, and finalized targets. Without it, a finalized target rejects delivery before an inbox entry is appended or a revive is attempted."]},run:i(e=>x(e),"run"),render:i(e=>String(e.guidance),"render")}),z=w({name:"request",description:"deliver an immediate typed-output request to an existing node",whenToUse:"a target chosen with `--to <node-id>` or `--self` must hand back one answer in a shape you fix \u2014 a choice among options, a structured extraction, a verdict your own logic will branch on \u2014 or must be held to answering at all before it goes quiet. Use `node message send` instead when prose in the target\u2019s own judgment is enough, and `node new --output-schema` when no node holds the context yet and the work needs a fresh agent",help:{name:"node message request",summary:"deliver an immediate typed-output request to an existing node",params:M(),output:v(),outputKind:"object",effects:["Installs the one-off output schema before appending the request."]},run:i(e=>(D(e,"outputSchema"),x(e)),"run"),render:i(e=>String(e.guidance),"render")}),G=C({name:"message",description:"deliver immediate inbox work to an existing node",whenToUse:"you need one immediate delivery: send ordinary information, or request one schema-constrained result",help:{name:"node message",summary:"deliver one immediate inbox entry to an existing node",model:"Both children append one inbox entry to a node that already exists, targeted with `--to <node-id>` or `--self`, and may revive it if it is dormant. They differ in what the delivery obligates. An ordinary message obligates nothing: the target reads it and acts however it judges best. A request installs a one-off output schema and holds the target awake and owing until it answers; the answer is validated against the schema, written to the target\u2019s result file, and pushed as an update report to the TARGET\u2019S subscribers, so subscribe to it first if the answer has to reach you. Neither child creates that standing relationship \u2014 a durable delivery edge is `node subscription`, and work that needs a fresh agent is `node new`."},children:[j,z]});export{G as nodeMessage};
1
+ var _=Object.defineProperty;var i=(e,n)=>_(e,"name",{value:n,configurable:!0});import{envNodeId as y}from"../../shared/env.js";import{defineBranch as C,defineLeaf as w}from"../../core/command.js";import{InputError as o}from"../../core/io.js";import{requireScope as N}from"../../core/errors.js";import{OUTPUT_SCHEMA_CONSTRAINTS as R,OUTPUT_SCHEMA_TRANSPORT as P,parseOutputSchemaValue as E}from"../../core/runtime/structured-output.js";import{cliClient as A,getNodeOrNull as I,rethrowAsCliError as O}from"../api-client.js";function $(e,n){const t=e[n];if(t!==void 0&&(typeof t!="string"||t.trim()==="")){const a=n.replace(/[A-Z]/g,r=>`-${r.toLowerCase()}`);throw new o({error:"empty_discriminant",message:`--${a} must contain non-whitespace text`,received:typeof t=="string"?t:String(t),field:a,next:`Pass a non-empty --${a} value, or omit the flag.`})}}i($,"requireNonBlankDiscriminant");async function D(e,n){const t=e.to?.trim(),a=e.self===!0,r=t!==void 0&&t!=="";if(r===a)throw new o({error:"bad_target",message:r&&a?"--to and --self are mutually exclusive":n?"no target given \u2014 the message body is not a node id":"exactly one of --to or --self is required",field:r?void 0:"to",next:r?"Pass --to <node-id> or --self.":n?"Pass the node id with --to <node-id> and provide the message body as a positional argument or on stdin, or use --self.":"Pass --to <node-id> or --self."});if(a){const s=y();if(s===void 0||s==="")throw new o({error:"no_node",message:"no node to target with --self (CRTR_NODE_ID unset)",next:"Run from inside a node, or pass --to <node-id>."});return{targetId:s,isSelf:!0}}if(await I(t)===null)throw new o({error:"not_found",message:`no node: ${t}`,field:"to",next:"List nodes with `crtr node inspect list`."});return{targetId:t,isSelf:!1}}i(D,"resolveMsgTarget");function v(){return[{name:"revived",type:"boolean",required:!1,constraint:"True when this request synchronously revived the target; ordinary durable delivery to an active or idle dormant target queues lifecycle revival instead."},{name:"guidance",type:"string",required:!0,constraint:"Immediate action confirmation."}]}i(v,"messageOutput");function b(e){const n=e.to?.trim();if(!(n!==void 0&&n!==""||e.self===!0))return{message:"no target given \u2014 the positional argument is the message body, not a node id",field:"to",next:"Pass the node id with --to <node-id> and pipe the message body on stdin, or use --self."}}i(b,"missingMessageTargetForBody");function U(){return[{kind:"stdin",name:"body",required:!1,constraint:"Visible message body. Required unless --situational-context is supplied.",positionalStdinConflict:b},{kind:"flag",name:"to",type:"string",required:!1,constraint:"Target an existing node by id. Exactly one of --to or --self is required."},{kind:"flag",name:"self",type:"bool",required:!1,constraint:"Target the calling node. Exactly one of --to or --self is required."},{kind:"flag",name:"tier",type:"enum",choices:["critical","urgent","normal","deferred"],required:!1,default:"normal",constraint:"Delivery urgency. Deferred never wakes an idle node, except a terminal one, which has no later cycle to read it on and is raised to urgent."},{kind:"flag",name:"situational-context",type:"string",required:!1,constraint:"Non-empty hidden ambient context delivered beside the message, or alone."},{kind:"flag",name:"reopen",type:"bool",required:!1,constraint:"Re-task the target: clears any finalization latch before delivery and brings a done target back to active. Commits the target resident, except when you are its manager (the node that spawned it): then it keeps its lifecycle, so a terminal child still owes a final report. Valid for live, parked, and finalized targets."}]}i(U,"messageSendParams");function M(){return[{kind:"stdin",name:"body",required:!1,constraint:"Visible message body. The schema alone is a complete request.",positionalStdinConflict:b},{kind:"flag",name:"to",type:"string",required:!1,constraint:"Target an existing node by id. Exactly one of --to or --self is required."},{kind:"flag",name:"self",type:"bool",required:!1,constraint:"Target the calling node. Exactly one of --to or --self is required."},{kind:"flag",name:"tier",type:"enum",choices:["critical","urgent","normal"],required:!1,default:"normal",constraint:"Delivery urgency. Every accepted tier queues lifecycle revival for an active or idle dormant target because the request must be answered; deferred is rejected for that reason."},{kind:"flag",name:"output-schema",type:"string",required:!0,constraint:`JSON Schema the result must satisfy. ${P} The target answers with \`crtr push result\` (or declines with \`crtr push result --decline "<reason>" --code <token>\`), then keeps working. ${R}`},{kind:"flag",name:"situational-context",type:"string",required:!1,constraint:"Non-empty hidden ambient context delivered beside the message, or alone."},{kind:"flag",name:"reopen",type:"bool",required:!1,hidden:!0,constraint:"Clear a finalized target latch before delivery or fresh revive."}]}i(M,"messageRequestParams");async function x(e){N("crtr:act","crtr node message");const n=e.situationalContext!==void 0,t=e.situationalContext?.trim();if(n&&t==="")throw new o({error:"empty_situational_context",message:"--situational-context must contain non-whitespace text",field:"situational-context",next:"Pass non-whitespace text, or omit --situational-context."});const a=e.body,r=a!==void 0?a.trim():void 0,m=r!==void 0&&r!=="",{targetId:s}=await D(e,m),u=e.tier,q=u!==void 0&&u!=="",f=E(e.outputSchema),c=f!==null?JSON.stringify(f):null,h=t!==void 0&&t!=="",k=e.reopen===!0;if(c!==null&&u==="deferred")throw new o({error:"output_schema_deferred_tier",message:"--output-schema cannot combine with --tier deferred because the target must answer",field:"tier",next:"Use normal, urgent, or critical tier, or drop --output-schema."});const g=y(),T=A();if(!m&&!h&&c===null)throw new o({error:"empty_body",message:"a message body is required unless --output-schema or --situational-context is supplied",field:"body",next:"Pass the message on stdin, or supply one of the documented alternatives."});const p=q?u:"normal",d=await T.sendMessage(s,{body:r??"",tier:p,...k?{reopen:!0}:{},...h?{situational_context:t}:{},...c!==null?{output_schema:c}:{},...g!==void 0?{from:g}:{}}).catch(O);if(d.wake_failed!==void 0){const l=d.wake_failed;return{revived:!1,guidance:`Accepted but NOT delivered to a running node \u2014 waking the target failed (${l.error}): ${l.message}${l.next===void 0?"":` ${l.next}`} The message is queued durably (${l.message_id}); do not resend it.`}}const S=d.revived?"Delivered \u2014 the dormant target was revived to receive it.":p!=="deferred"?"Delivered.":d.delivered_tier===void 0?"Delivered \u2014 held for the target's next natural cycle; not revived.":"Delivered \u2014 the target is terminal and takes no later cycle, so it was raised to urgent rather than held.";return{revived:d.revived,guidance:S}}i(x,"runMessageEngine");const j=w({name:"send",description:"deliver an inbox message to an existing node immediately",whenToUse:"a target chosen with `--to <node-id>` or `--self` should have information or new direction now \u2014 steering a worker mid-task, handing over a finding it needs, correcting a wrong turn, or waking a dormant node with fresh work. The target reads it and decides what to do with it. Use `node message request` instead when you need an answer back in a shape you specify, and `node subscription add` when the target should keep receiving this node\u2019s pushes rather than this one delivery",help:{name:"node message send",summary:"deliver an inbox message to an existing node immediately",params:U(),output:v(),outputKind:"object",effects:["Appends one inbox entry. Critical, urgent, and normal delivery queues lifecycle revival for an active or idle dormant target; deferred waits for its next natural cycle.","--reopen clears any finalization latch before delivery, allowing the target to take a new mandate. It commits the target resident unless you are its manager (the node that spawned it), in which case the target keeps its lifecycle and a terminal child still owes a final report. It is valid for live, parked, and finalized targets. Without it, a finalized target rejects delivery before an inbox entry is appended or a revive is attempted."]},run:i(e=>x(e),"run"),render:i(e=>String(e.guidance),"render")}),z=w({name:"request",description:"deliver an immediate typed-output request to an existing node",whenToUse:"a target chosen with `--to <node-id>` or `--self` must hand back one answer in a shape you fix \u2014 a choice among options, a structured extraction, a verdict your own logic will branch on \u2014 or must be held to answering at all before it goes quiet. Use `node message send` instead when prose in the target\u2019s own judgment is enough, and `node new --output-schema` when no node holds the context yet and the work needs a fresh agent",help:{name:"node message request",summary:"deliver an immediate typed-output request to an existing node",params:M(),output:v(),outputKind:"object",effects:["Installs the one-off output schema before appending the request."]},run:i(e=>($(e,"outputSchema"),x(e)),"run"),render:i(e=>String(e.guidance),"render")}),G=C({name:"message",description:"deliver immediate inbox work to an existing node",whenToUse:"you need one immediate delivery: send ordinary information, or request one schema-constrained result",help:{name:"node message",summary:"deliver one immediate inbox entry to an existing node",model:"Both children append one inbox entry to a node that already exists, targeted with `--to <node-id>` or `--self`, and may revive it if it is dormant. They differ in what the delivery obligates. An ordinary message obligates nothing: the target reads it and acts however it judges best. A request installs a one-off output schema and holds the target awake and owing until it answers; the answer is validated against the schema, written to the target\u2019s result file, and pushed as an update report to the TARGET\u2019S subscribers, so subscribe to it first if the answer has to reach you. Neither child creates that standing relationship \u2014 a durable delivery edge is `node subscription`, and work that needs a fresh agent is `node new`."},children:[j,z]});export{G as nodeMessage};
@@ -1 +1 @@
1
- var s=Object.defineProperty;var n=(e,r)=>s(e,"name",{value:r,configurable:!0});import{defineLeaf as o}from"../../core/command.js";import{existsSync as a}from"node:fs";import{join as d}from"node:path";import{pluginsDir as l}from"../../core/scope.js";import{joinDirectory as u}from"../../core/directory/join.js";import{apiSocketPath as c}from"../../core/canvas/paths.js";import{listProcessTable as m}from"../../core/canvas/pid.js";import{daemonAnswers as h}from"../../core/layout-migrate/index.js";import{envNodeId as p}from"../../shared/env.js";import{isDaemonRunning as f}from"../../daemon/pidfile.js";import{findDaemonPids as w,spawnDaemon as y,stopAllDaemons as g}from"../../daemon/manage.js";function k(){const e=m();if(e===null||(p()??"")!=="")return!0;const r=new Map(e.map(t=>[t.pid,t])),i=new Set;for(let t=process.ppid;t>1&&!i.has(t);t=r.get(t)?.ppid??0)if(i.add(t),r.get(t)?.command.includes("broker-cli"))return!0;return!1}n(k,"insideBroker");function b(){if(!(process.platform==="linux"&&a("/run/crtr/launcher.sock")))return{running:n(async()=>f()||w().length>0||await h(c()),"running"),stop:n(async()=>{await g()},"stop"),start:n(async()=>{await y()},"start"),firstSync:n(async()=>{const e=l("user"),r=Date.now()+2e4;for(;e&&Date.now()<r&&!a(d(e,"cloud","commands.json"));)await new Promise(i=>setTimeout(i,250))},"firstSync"),insideNode:k}}n(b,"daemonControl");const T=o({name:"join",description:"register this runtime with its directory using an enrollment token, offline",whenToUse:"on your own computer, with a token from `<issuer>/account/machines`: run it from a plain terminal, with any viewers open. It stops the daemon, joins, and starts it again. Also at a hosted runtime's first boot, before the daemon starts, with the enrollment token provisioning passed in.",help:{name:"sys join",summary:"exchange a directory enrollment token for a new runtime client key and record the returned identity",guide:"Generates a new ES256 client key, sends only its public key to `PUT <directory>/v1/runtimes/registration` with the token as bearer, and learns the runtime id, client id, issuer, owner and URL from the answer. Only after that answer does it write the key file, set the user settings `runtime.issuer` and `runtime.audience`, and rewrite `user:local` profile grantees to `app:terminal`. canvas.db belongs to the daemon: its next start rewrites `user:local` there, before it serves anything. On your own computer a running daemon is no obstacle: join takes a `join.lock` in the runtime directory (so no open viewer's redial can autostart a daemon while it works), registers with the directory while the daemon still serves, stops the daemon, writes the identity, and starts the daemon again, whose start applies the canvas.db rewrite. Run it from a plain terminal, not from inside a node: a node's broker dies with the daemon, so join refuses `join_inside_node` instead. Where the launcher owns the daemon (a hosted container) join keeps the offline contract and refuses `daemon_running`. Presenting the token of the stored successful registration again finishes those local writes without calling the directory. Any other token generates a new key and registers again.",params:[{kind:"flag",name:"directory",type:"string",required:!0,constraint:"Directory base URL (http or https) that minted the token."},{kind:"flag",name:"token",type:"string",required:!0,sensitive:!0,constraint:"Single-use enrollment token. Sensitive: never echoed in output or errors."},{kind:"flag",name:"name",type:"string",required:!1,constraint:"Label shown for this machine on the account page. Default: this computer's hostname."}],output:[{name:"runtime",type:"string",required:!0,constraint:"Runtime principal from the directory, `runtime:<id>`."},{name:"client_id",type:"string",required:!0,constraint:"OAuth client id registered for the new key."},{name:"issuer",type:"string",required:!0,constraint:"Canonical issuer, written to `runtime.issuer`."},{name:"owner",type:"string",required:!0,constraint:"Owner principal, `user:<id>`, that replaces `user:local` subjects."},{name:"canvas_rewrite",type:"string",required:!0,constraint:"Always `next daemon start`: when canvas.db identity fields are rewritten."},{name:"url",type:"string",required:!0,constraint:"Runtime URL, written to `runtime.audience`."},{name:"registered",type:"boolean",required:!0,constraint:"False when the token matched the stored registration and the directory was not called."},{name:"daemon",type:"string",required:!0,constraint:"`restarted` (a daemon was stopped and started on the joined settings), `started` (none was running; join started one and waited, up to 20s, for its first grant sync to install the account's provider plugins, so `crtr cloud \u2026` resolves), `not_running` (none was started: a hosted container's launcher owns its daemon), or `restart_failed` (joined, but the new daemon did not start: see `daemon_error`, then run `crtr sys daemon start`)."},{name:"daemon_error",type:"string",required:!1,constraint:"Why the new daemon did not start, with `daemon: restart_failed`."}],outputKind:"object",effects:["Holds `<runtime>/join.lock` (its pid) from the start until the daemon is back; `ensureDaemon` and `sys daemon start` (without `--force`) decline to start a daemon while a live process holds it (including a start already in flight when the join began). A lock whose holder died is reclaimed.","A running daemon is stopped (SIGTERM, then SIGKILL, plus strays) after the directory accepts the registration and before the local writes, then started again. Every broker dies with it and is revived by the new daemon. If the join fails after the stop, the daemon is started again anyway. With no daemon running join starts one anyway, because a bare `crtr cloud \u2026` is an unknown command (it never autostarts a daemon) until a daemon's grant sync has installed the provider plugins. Refuses `join_inside_node` when run from inside a node and a daemon is running; refuses `daemon_running` where a container launcher owns the daemon.","On a new token: calls the directory once; on success writes `<runtime>/secrets/runtime-client.json` (mode 0600) with the private key, registration and the token's SHA-256, replacing any earlier key file. A refused or failed call writes nothing.","Sends name, platform, crtr version, installed plugin ids and sandbox state with the public key. Before the request it writes `runtime-client.pending.json` (mode 0600); a rerun with the same token and directory reuses that key, so a lost reply is retried safely. The file is deleted on success or a refusal.","Sets `runtime.issuer` and `runtime.audience` in user settings. When the directory says this machine is not the account's default (`is_default: false`) it replaces the whole `runtime` setting with `{issuer, audience, unsandboxed: true}`: no app listener, and only `app:terminal` nodes run.","Rewrites `user:local` profile grantees to `app:terminal`.","At every later daemon start, before any listener: exact `user:local` subjects in canvas.db nodes and node_tokens become the owner (as do missing subjects on `app:terminal` nodes), `user:local` grantees in nodes, run_events, idempotency_keys and node_tokens become `app:terminal`, references to the unjoined runtime's `local:terminal` grant are cleared, and that local grant mirror is deleted so grant sync installs the directory's. Application grantees and free text are unchanged; a start with nothing left to rewrite changes no rows."]},run:n(async e=>({...await u(e.directory,e.token,e.name||void 0,b()),canvas_rewrite:"next daemon start"}),"run")});export{T as sysJoinLeaf};
1
+ var s=Object.defineProperty;var n=(e,r)=>s(e,"name",{value:r,configurable:!0});import{defineLeaf as o}from"../../core/command.js";import{existsSync as a}from"node:fs";import{join as d}from"node:path";import{pluginsDir as u}from"../../core/scope.js";import{joinDirectory as l}from"../../core/directory/join.js";import{apiSocketPath as c}from"../../core/canvas/paths.js";import{listProcessTable as m}from"../../core/canvas/pid.js";import{daemonAnswers as h}from"../../core/layout-migrate/index.js";import{envNodeId as p}from"../../shared/env.js";import{isDaemonRunning as f}from"../../daemon/pidfile.js";import{findDaemonPids as w,spawnDaemon as y,stopAllDaemons as g}from"../../daemon/manage.js";function k(){const e=m();if(e===null||(p()??"")!=="")return!0;const r=new Map(e.map(t=>[t.pid,t])),i=new Set;for(let t=process.ppid;t>1&&!i.has(t);t=r.get(t)?.ppid??0)if(i.add(t),r.get(t)?.command.includes("broker-cli"))return!0;return!1}n(k,"insideBroker");function b(){if(!(process.platform==="linux"&&a("/run/crtr/launcher.sock")))return{running:n(async()=>f()||w().length>0||await h(c()),"running"),stop:n(async()=>{await g()},"stop"),start:n(async()=>{await y()},"start"),firstSync:n(async()=>{const e=u("user"),r=Date.now()+2e4;for(;e&&Date.now()<r&&!a(d(e,"cloud","commands.json"));)await new Promise(i=>setTimeout(i,250))},"firstSync"),insideNode:k}}n(b,"daemonControl");const T=o({name:"join",description:"register this runtime with its directory using an enrollment token, offline",whenToUse:"on your own computer, with a token from `<issuer>/account/machines`: run it from a plain terminal, with any viewers open. It stops the daemon, joins, and starts it again. Also at a hosted runtime's first boot, before the daemon starts, with the enrollment token provisioning passed in.",help:{name:"sys join",summary:"exchange a directory enrollment token for a new runtime client key and record the returned identity",guide:"Generates a new ES256 client key, sends only its public key to `PUT <directory>/v1/runtimes/registration` with the token as bearer, and learns the runtime id, client id, issuer, owner and URL from the answer. Only after that answer does it write the key file, set the user settings `runtime.issuer` and `runtime.audience`, and rewrite `user:local` profile grantees to `app:terminal`. canvas.db belongs to the daemon: its next start rewrites `user:local` there, before it serves anything. On your own computer a running daemon is no obstacle: join takes a `join.lock` in the runtime directory (so no open viewer's redial can autostart a daemon while it works), registers with the directory while the daemon still serves, stops the daemon, writes the identity, and starts the daemon again, whose start applies the canvas.db rewrite. Run it from a plain terminal, not from inside a node: a node's broker dies with the daemon, so join refuses `join_inside_node` instead. Where the launcher owns the daemon (a hosted container) join keeps the offline contract and refuses `daemon_running`. Presenting the token of the stored successful registration again finishes those local writes without calling the directory. Any other token generates a new key and registers again.",params:[{kind:"flag",name:"directory",type:"string",required:!0,constraint:"Directory base URL (http or https) that minted the token."},{kind:"flag",name:"token",type:"string",required:!0,sensitive:!0,constraint:"Single-use enrollment token. Sensitive: never echoed in output or errors."},{kind:"flag",name:"name",type:"string",required:!1,constraint:"Label shown for this machine on the account page. Default: this computer's hostname."}],output:[{name:"runtime",type:"string",required:!0,constraint:"Runtime principal from the directory, `runtime:<id>`."},{name:"client_id",type:"string",required:!0,constraint:"OAuth client id registered for the new key."},{name:"issuer",type:"string",required:!0,constraint:"Canonical issuer, written to `runtime.issuer`."},{name:"owner",type:"string",required:!0,constraint:"Owner principal, `user:<id>`, that replaces `user:local` subjects."},{name:"canvas_rewrite",type:"string",required:!0,constraint:"Always `next daemon start`: when canvas.db identity fields are rewritten."},{name:"url",type:"string",required:!0,constraint:"Runtime URL, written to `runtime.audience`."},{name:"registered",type:"boolean",required:!0,constraint:"False when the token matched the stored registration and the directory was not called."},{name:"daemon",type:"string",required:!0,constraint:"`restarted` (a daemon was stopped and started on the joined settings), `started` (none was running; join started one and waited, up to 20s, for its first grant sync to install the account's provider plugins, so `crtr cloud \u2026` resolves), `not_running` (none was started: a hosted container's launcher owns its daemon), or `restart_failed` (joined, but the new daemon did not start: see `daemon_error`, then run `crtr sys daemon start`)."},{name:"daemon_error",type:"string",required:!1,constraint:"Why the new daemon did not start, with `daemon: restart_failed`."}],outputKind:"object",effects:["Holds `<runtime>/join.lock` (its pid) from the start until the daemon is back; `ensureDaemon` and `sys daemon start` (without `--force`) decline to start a daemon while a live process holds it (including a start already in flight when the join began). A lock whose holder died is reclaimed.","A running daemon is stopped (SIGTERM, then SIGKILL, plus strays) after the directory accepts the registration and before the local writes, then started again. Every broker dies with it and is revived by the new daemon. If the join fails after the stop, the daemon is started again anyway. With no daemon running join starts one anyway, because a bare `crtr cloud \u2026` is an unknown command (it never autostarts a daemon) until a daemon's grant sync has installed the provider plugins. Refuses `join_inside_node` when run from inside a node and a daemon is running; refuses `daemon_running` where a container launcher owns the daemon.","On a new token: calls the directory once; on success writes `<runtime>/secrets/runtime-client.json` (mode 0600) with the private key, registration and the token's SHA-256, replacing any earlier key file. A refused or failed call writes nothing.","Sends name, platform, crtr version, installed plugin ids and sandbox state with the public key. Before the request it writes `runtime-client.pending.json` (mode 0600); a rerun with the same token and directory reuses that key, so a lost reply is retried safely. The file is deleted on success or a refusal.","Sets `runtime.issuer` and `runtime.audience` in user settings. When the directory says this machine is not the account's default (`is_default: false`) it replaces the whole `runtime` setting with `{issuer, audience, unsandboxed: true}`: no app listener, and only `app:terminal` nodes run.","Rewrites `user:local` profile grantees to `app:terminal`.","At the first daemon start after a join as this owner, before any listener (a later start under the same owner skips it): exact `user:local` subjects in canvas.db nodes and node_tokens become the owner (as do missing subjects on `app:terminal` nodes), `user:local` grantees in nodes, run_events, idempotency_keys and node_tokens become `app:terminal`, references to the unjoined runtime's `local:terminal` grant are cleared, and that local grant mirror is deleted so grant sync installs the directory's. Application grantees and free text are unchanged; a join as a different owner runs it again."]},run:n(async e=>({...await l(e.directory,e.token,e.name||void 0,b()),canvas_rewrite:"next daemon start"}),"run")});export{T as sysJoinLeaf};
@@ -0,0 +1,7 @@
1
+ export declare function mapAsync<T, U>(items: readonly T[], fn: (item: T, index: number, items: readonly T[]) => Promise<U>): Promise<U[]>;
2
+ export declare function flatMapAsync<T, U>(items: readonly T[], fn: (item: T, index: number, items: readonly T[]) => Promise<U | readonly U[]>): Promise<U[]>;
3
+ export declare function filterAsync<T>(items: readonly T[], fn: (item: T, index: number, items: readonly T[]) => Promise<unknown>): Promise<T[]>;
4
+ export declare function someAsync<T>(items: readonly T[], fn: (item: T, index: number, items: readonly T[]) => Promise<unknown>): Promise<boolean>;
5
+ export declare function everyAsync<T>(items: readonly T[], fn: (item: T, index: number, items: readonly T[]) => Promise<unknown>): Promise<boolean>;
6
+ export declare function findAsync<T>(items: readonly T[], fn: (item: T, index: number, items: readonly T[]) => Promise<unknown>): Promise<T | undefined>;
7
+ export declare function forEachAsync<T>(items: readonly T[], fn: (item: T, index: number, items: readonly T[]) => Promise<unknown>): Promise<void>;
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty;var a=(n,t)=>e(n,"name",{value:t,configurable:!0});async function u(n,t){const r=[];for(let o=0;o<n.length;o++)r.push(await t(n[o],o,n));return r}a(u,"mapAsync");async function l(n,t){const r=[];for(let o=0;o<n.length;o++){const c=await t(n[o],o,n);Array.isArray(c)?r.push(...c):r.push(c)}return r}a(l,"flatMapAsync");async function y(n,t){const r=[];for(let o=0;o<n.length;o++)await t(n[o],o,n)&&r.push(n[o]);return r}a(y,"filterAsync");async function i(n,t){for(let r=0;r<n.length;r++)if(await t(n[r],r,n))return!0;return!1}a(i,"someAsync");async function p(n,t){for(let r=0;r<n.length;r++)if(!await t(n[r],r,n))return!1;return!0}a(p,"everyAsync");async function h(n,t){for(let r=0;r<n.length;r++)if(await t(n[r],r,n))return n[r]}a(h,"findAsync");async function s(n,t){for(let r=0;r<n.length;r++)await t(n[r],r,n)}a(s,"forEachAsync");export{p as everyAsync,y as filterAsync,h as findAsync,l as flatMapAsync,s as forEachAsync,u as mapAsync,i as someAsync};
@@ -18,6 +18,6 @@ export interface PeerAuditRow {
18
18
  resource?: string | null;
19
19
  }
20
20
  /** Write one audit row. A failure to write is logged by the caller's wrapper and never changes the answer. */
21
- export declare function writePeerAudit(row: PeerAuditRow): void;
21
+ export declare function writePeerAudit(row: PeerAuditRow): Promise<void>;
22
22
  /** The outcome string for an HTTP status. */
23
23
  export declare const auditOutcome: (status: number) => string;
@@ -1,3 +1,3 @@
1
- var n=Object.defineProperty;var i=(e,t)=>n(e,"name",{value:t,configurable:!0});import{prepared as u}from"./sqlite-statements.js";import{withCanvasWrite as r}from"./canvas/db.js";function s(e){r(t=>{u(t,`INSERT INTO audit_rows
1
+ var n=Object.defineProperty;var t=(e,i)=>n(e,"name",{value:i,configurable:!0});import{openDb as u}from"./canvas/db.js";async function r(e){await(await u()).prepare(`INSERT INTO audit_rows
2
2
  (request_id, time, grantee, sub, class, operation, outcome, node_id, run_id, resource, via)
3
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(e.request_id,new Date().toISOString(),e.grantee,e.sub,e.class,e.operation,e.outcome,e.node_id??null,e.run_id??null,e.resource??null,e.via)})}i(s,"writePeerAudit");const c=i(e=>e>=200&&e<300?"ok":`status:${e}`,"auditOutcome");export{c as auditOutcome,s as writePeerAudit};
3
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(e.request_id,new Date().toISOString(),e.grantee,e.sub,e.class,e.operation,e.outcome,e.node_id??null,e.run_id??null,e.resource??null,e.via)}t(r,"writePeerAudit");const d=t(e=>e>=200&&e<300?"ok":`status:${e}`,"auditOutcome");export{d as auditOutcome,r as writePeerAudit};
@@ -9,10 +9,10 @@ export interface TicketEntry {
9
9
  /** Kept for callers that reset a canvas home in process. SQL has no directory-scan cache to invalidate. */
10
10
  export declare function invalidateTicketCounts(): void;
11
11
  /** Count pending tickets asked by one node. */
12
- export declare function countTickets(nodeId: string): number;
12
+ export declare function countTickets(nodeId: string): Promise<number>;
13
13
  /** Pending tickets for every reachable asking node, including the root. */
14
- export declare function pendingTicketsForView(rootId: string): TicketEntry[];
14
+ export declare function pendingTicketsForView(rootId: string): Promise<TicketEntry[]>;
15
15
  /** Per-node pending ticket counts for an explicit node set. */
16
- export declare function ticketCountsForNodes(ids: string[]): Record<string, number>;
16
+ export declare function ticketCountsForNodes(ids: string[]): Promise<Record<string, number>>;
17
17
  /** Pending tickets across the entire canvas, attributed to asking nodes. */
18
- export declare function ticketsAcrossCanvas(): TicketEntry[];
18
+ export declare function ticketsAcrossCanvas(): Promise<TicketEntry[]>;
@@ -1 +1 @@
1
- var u=Object.defineProperty;var s=(t,n)=>u(t,"name",{value:n,configurable:!0});import{listOpenReplyBearingRequests as d}from"../human/requests.js";import{getNode as f,listNodes as l,view as p}from"./canvas.js";function h(){}s(h,"invalidateTicketCounts");function c(){const t=new Map;for(const n of d()){const e=n.requester_node_id,o=t.get(e);o===void 0?t.set(e,[n.title]):o.push(n.title)}return t}s(c,"ticketSubjects");function w(t){return c().get(t)?.length??0}s(w,"countTickets");function k(t){const n=c(),e=[];for(const o of[t,...p(t)]){const i=f(o),r=n.get(o)??[];i!==null&&r.length>0&&e.push({node_id:o,name:i.name,cwd:i.cwd,count:r.length,subjects:r})}return e}s(k,"pendingTicketsForView");function _(t){const n=c();return Object.fromEntries(t.map(e=>[e,n.get(e)?.length??0]))}s(_,"ticketCountsForNodes");function b(){const t=c(),n=[];for(const e of l()){const o=t.get(e.node_id)??[];o.length>0&&n.push({node_id:e.node_id,name:e.name,cwd:e.cwd,count:o.length,subjects:o})}return n}s(b,"ticketsAcrossCanvas");export{w as countTickets,h as invalidateTicketCounts,k as pendingTicketsForView,_ as ticketCountsForNodes,b as ticketsAcrossCanvas};
1
+ var r=Object.defineProperty;var s=(t,n)=>r(t,"name",{value:n,configurable:!0});import{listOpenReplyBearingRequests as u}from"../human/requests.js";import{getNode as d,listNodes as f,view as l}from"./canvas.js";function m(){}s(m,"invalidateTicketCounts");async function i(){const t=new Map;for(const n of await u()){const e=n.requester_node_id,o=t.get(e);o===void 0?t.set(e,[n.title]):o.push(n.title)}return t}s(i,"ticketSubjects");async function h(t){return(await i()).get(t)?.length??0}s(h,"countTickets");async function k(t){const n=await i(),e=[];for(const o of[t,...await l(t)]){const c=await d(o),a=n.get(o)??[];c!==null&&a.length>0&&e.push({node_id:o,name:c.name,cwd:c.cwd,count:a.length,subjects:a})}return e}s(k,"pendingTicketsForView");async function y(t){const n=await i();return Object.fromEntries(t.map(e=>[e,n.get(e)?.length??0]))}s(y,"ticketCountsForNodes");async function _(){const t=await i(),n=[];for(const e of await f()){const o=t.get(e.node_id)??[];o.length>0&&n.push({node_id:e.node_id,name:e.name,cwd:e.cwd,count:o.length,subjects:o})}return n}s(_,"ticketsAcrossCanvas");export{h as countTickets,m as invalidateTicketCounts,k as pendingTicketsForView,y as ticketCountsForNodes,_ as ticketsAcrossCanvas};
@@ -64,14 +64,14 @@ export interface BootReconcileResult {
64
64
  *
65
65
  * `current` defaults to the real identity; tests inject a synthetic one against
66
66
  * an isolated CRTR_HOME to simulate a boot change without a real reboot. */
67
- export declare function reconcileBootLiveness(current?: BootIdentity): BootReconcileResult;
67
+ export declare function reconcileBootLiveness(current?: BootIdentity): Promise<BootReconcileResult>;
68
68
  /** The one-time execution-identity migration, injected into the startup
69
69
  * composition. In production this is `migrateLegacyExecutionIdentities` from
70
70
  * executions.ts. It remains injected so tests can exercise this composition
71
71
  * without reaching process inspection. */
72
- export type MigrateLegacyExecutionIdentities = (captureIdentity?: (pid: number) => string | undefined) => {
72
+ export type MigrateLegacyExecutionIdentities = (captureIdentity?: (pid: number) => string | undefined) => Promise<{
73
73
  migrated: string[];
74
- };
74
+ }>;
75
75
  export interface BootStartupResult {
76
76
  /** The pid-liveness reconciliation result (boot-change sweep + provenance). */
77
77
  reconcile: BootReconcileResult;
@@ -89,4 +89,4 @@ export interface BootStartupResult {
89
89
  *
90
90
  * `migrate` is injected (see `MigrateLegacyPidIdentities`); `current` and
91
91
  * `captureIdentity` pass through to the two steps for test injection. */
92
- export declare function reconcileAndMigrateBoot(migrate: MigrateLegacyExecutionIdentities, current?: BootIdentity, captureIdentity?: (pid: number) => string | undefined): BootStartupResult;
92
+ export declare function reconcileAndMigrateBoot(migrate: MigrateLegacyExecutionIdentities, current?: BootIdentity, captureIdentity?: (pid: number) => string | undefined): Promise<BootStartupResult>;
@@ -1 +1 @@
1
- var E=Object.defineProperty;var n=(e,o)=>E(e,"name",{value:o,configurable:!0});import{prepared as d}from"../sqlite-statements.js";import{uptime as f}from"node:os";import{openDb as p}from"./db.js";import{readKernelBootId as b}from"./boot-id.js";import{readKernelBootId as R}from"./boot-id.js";const I=6e4;function M(e=Date.now()){return{bootId:b(),bootEpochMs:e-Math.round(f()*1e3)}}n(M,"currentBootIdentity");function m(e,o){return o===null?!1:e.bootId!==null&&o.bootId!==null?e.bootId!==o.bootId:Math.abs(e.bootEpochMs-o.bootEpochMs)>I}n(m,"bootChanged");function x(e,o){return o!==null&&e.bootId!==null&&o.bootId!==null&&e.bootId===o.bootId}n(x,"bootProvenSame");const s="boot_identity";function h(e){const o=d(e,"SELECT value FROM canvas_meta WHERE key = ?").get(s);if(o===void 0)return null;try{const t=JSON.parse(o.value);return typeof t.bootEpochMs!="number"?null:{bootId:typeof t.bootId=="string"?t.bootId:null,bootEpochMs:t.bootEpochMs}}catch{return null}}n(h,"readBootMarker");function u(e,o){e.prepare("INSERT INTO canvas_meta (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value").run(s,JSON.stringify(o))}n(u,"writeBootMarker");function O(e=M()){const o=p();o.exec("BEGIN IMMEDIATE");try{const t=h(o);if(!m(e,t)){t===null&&u(o,e);const a=x(e,t);return o.exec("COMMIT"),{changed:!1,cleared:[],sameBootProven:a}}const r=d(o,"SELECT execution_id, node_id FROM executions WHERE state != 'exited'").all(),c=d(o,"UPDATE executions SET state = 'exited', ended_at = ?, exit_reason = 'boot-change' WHERE execution_id = ? AND state != 'exited'"),i=[],l=new Date().toISOString();for(const a of r)c.run(l,a.execution_id).changes>0&&i.push(a.node_id);return u(o,e),o.exec("COMMIT"),{changed:!0,cleared:i,sameBootProven:!1}}catch(t){try{o.exec("ROLLBACK")}catch{}throw t}}n(O,"reconcileBootLiveness");function v(e,o,t){const r=O(o),c=r.sameBootProven?e(t).migrated:[];return{reconcile:r,migrated:c}}n(v,"reconcileAndMigrateBoot");export{m as bootChanged,x as bootProvenSame,M as currentBootIdentity,R as readKernelBootId,v as reconcileAndMigrateBoot,O as reconcileBootLiveness};
1
+ var l=Object.defineProperty;var n=(t,o)=>l(t,"name",{value:o,configurable:!0});import{uptime as p}from"node:os";import{withCanvasWrite as f}from"./db.js";import{readKernelBootId as E}from"./boot-id.js";import{readKernelBootId as S}from"./boot-id.js";const b=6e4;function I(t=Date.now()){return{bootId:E(),bootEpochMs:t-Math.round(p()*1e3)}}n(I,"currentBootIdentity");function h(t,o){return o===null?!1:t.bootId!==null&&o.bootId!==null?t.bootId!==o.bootId:Math.abs(t.bootEpochMs-o.bootEpochMs)>b}n(h,"bootChanged");function m(t,o){return o!==null&&t.bootId!==null&&o.bootId!==null&&t.bootId===o.bootId}n(m,"bootProvenSame");const s="boot_identity";async function x(t){const o=await t.prepare("SELECT value FROM canvas_meta WHERE key = ?").get(s);if(o===void 0)return null;try{const e=JSON.parse(o.value);return typeof e.bootEpochMs!="number"?null:{bootId:typeof e.bootId=="string"?e.bootId:null,bootEpochMs:e.bootEpochMs}}catch{return null}}n(x,"readBootMarker");async function u(t,o){await t.prepareUncached("INSERT INTO canvas_meta (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value").run(s,JSON.stringify(o))}n(u,"writeBootMarker");async function _(t=I()){return f(async o=>{const e=await x(o);if(!h(t,e)){e===null&&await u(o,t);const r=m(t,e);return{changed:!1,cleared:[],sameBootProven:r}}const a=await o.prepare("SELECT execution_id, node_id FROM executions WHERE state != 'exited'").all(),i=o.prepare("UPDATE executions SET state = 'exited', ended_at = ?, exit_reason = 'boot-change' WHERE execution_id = ? AND state != 'exited'"),c=[],d=new Date().toISOString();for(const r of a)(await i.run(d,r.execution_id)).changes>0&&c.push(r.node_id);return await u(o,t),{changed:!0,cleared:c,sameBootProven:!1}})}n(_,"reconcileBootLiveness");async function g(t,o,e){const a=await _(o),i=a.sameBootProven?(await t(e)).migrated:[];return{reconcile:a,migrated:i}}n(g,"reconcileAndMigrateBoot");export{h as bootChanged,m as bootProvenSame,I as currentBootIdentity,S as readKernelBootId,g as reconcileAndMigrateBoot,_ as reconcileBootLiveness};
@@ -1,4 +1,4 @@
1
- import type { DatabaseSync } from 'node:sqlite';
1
+ import { type CanvasDb } from './db.js';
2
2
  import type { ExitIntent, Lifecycle, Mode, NodeIdentity, NodeMeta, NodeOutcomeKind, NodeRow, NodeStatus, TerminalReason } from './types.js';
3
3
  export interface OutcomeDeliveryBinding {
4
4
  actionName: string;
@@ -7,65 +7,65 @@ export interface OutcomeDeliveryBinding {
7
7
  configOrigin: string;
8
8
  payload?: unknown;
9
9
  }
10
- export declare function assertRunNotDeleting(db: DatabaseSync, runId: string): void;
10
+ export declare function assertRunNotDeleting(db: CanvasDb, runId: string): Promise<void>;
11
11
  /** Create a SQL-authoritative node, then ensure its artifact directories exist. */
12
12
  export declare function createNode(meta: NodeMeta, opts?: {
13
13
  outcomeDelivery?: OutcomeDeliveryBinding;
14
- withinCreate?: (db: DatabaseSync, row: NodeMeta) => void;
15
- }): NodeMeta;
14
+ withinCreate?: (db: CanvasDb, row: NodeMeta) => Promise<void> | void;
15
+ }): Promise<NodeMeta>;
16
16
  /** The canonical node record, hydrated from SQL. Null if unknown. */
17
- export declare function getNode(nodeId: string): NodeMeta | null;
17
+ export declare function getNode(nodeId: string): Promise<NodeMeta | null>;
18
18
  export type CreateRequestState = 'reserved' | 'warm_claimed' | 'complete';
19
19
  export interface CreateRequestRecord {
20
20
  requestKey: string;
21
21
  nodeId: string | null;
22
22
  state: CreateRequestState;
23
23
  }
24
- export declare function findCreateRequest(requestKey: string): CreateRequestRecord | null;
24
+ export declare function findCreateRequest(requestKey: string): Promise<CreateRequestRecord | null>;
25
25
  /** Reserve an idempotency key before creation. A null node id means the request
26
26
  * has not yet selected a cold-birth identity or claimed a warm spare. */
27
- export declare function reserveCreateRequest(requestKey: string): CreateRequestRecord;
27
+ export declare function reserveCreateRequest(requestKey: string): Promise<CreateRequestRecord>;
28
28
  /** Delete keys past their recovery window; returns how many were removed. */
29
- export declare function pruneExpiredCreateRequests(now?: number): number;
29
+ export declare function pruneExpiredCreateRequests(now?: number): Promise<number>;
30
30
  /** Bind a reserved key to the node it created (state `complete`). The mapping is
31
31
  * durable so a retry after a daemon handover returns the original node. */
32
- export declare function recordCreateRequestNode(requestKey: string, nodeId: string): void;
32
+ export declare function recordCreateRequestNode(requestKey: string, nodeId: string): Promise<void>;
33
33
  /** Reserve a cold-birth node id for a key (state stays `reserved`) so a retry
34
34
  * after a daemon restart resumes the same identity instead of minting another. */
35
- export declare function reserveCreateRequestNode(requestKey: string, nodeId: string): void;
36
- export declare function completeCreateRequest(requestKey: string, nodeId: string): void;
35
+ export declare function reserveCreateRequestNode(requestKey: string, nodeId: string): Promise<void>;
36
+ export declare function completeCreateRequest(requestKey: string, nodeId: string): Promise<void>;
37
37
  /** Forget an unserved reservation after a pre-birth failure. A record that
38
38
  * names a durable node is never removed by this path. */
39
- export declare function abandonCreateRequest(requestKey: string, nodeId: string | null): void;
39
+ export declare function abandonCreateRequest(requestKey: string, nodeId: string | null): Promise<void>;
40
40
  export declare function canonicalSessionFile(sessionFile: string): string;
41
41
  /** Resolve the crouter node that owns one exact Pi session file. */
42
- export declare function findNodeBySessionFile(sessionFile: string): NodeMeta | null;
42
+ export declare function findNodeBySessionFile(sessionFile: string): Promise<NodeMeta | null>;
43
43
  /** The indexed row (from the db) — cheap for queries that don't need full meta. */
44
- export declare function getRow(nodeId: string): NodeRow | null;
44
+ export declare function getRow(nodeId: string): Promise<NodeRow | null>;
45
45
  /** The node row whose durable LOCATION pane is `pane`, or null. Lets placement
46
46
  * resolve "who sits in this pane" by the first-class `%pane_id` handle (e.g.
47
47
  * to adopt a caller's pane as a focus). pane is not UNIQUE in the schema, but a
48
48
  * live pane backs at most one node, so this returns the single match. */
49
- export declare function getRowByPane(pane: string): NodeRow | null;
49
+ export declare function getRowByPane(pane: string): Promise<NodeRow | null>;
50
50
  /** Nodes whose persisted spawn deadline has elapsed and that remain live work. */
51
- export declare function dueNodeDeadlines(nowIso: string): NodeRow[];
51
+ export declare function dueNodeDeadlines(nowIso: string): Promise<NodeRow[]>;
52
52
  /** Write a claimed warm spare's deadline before it is handed to its caller. */
53
- export declare function setNodeDeadline(nodeId: string, deadlineAt: string | null): boolean;
53
+ export declare function setNodeDeadline(nodeId: string, deadlineAt: string | null): Promise<boolean>;
54
54
  /** Shift active/idle profile deadlines by a completed profile pause duration. */
55
- export declare function shiftProfileNodeDeadlines(profileId: string, pauseDurationMs: number): number;
55
+ export declare function shiftProfileNodeDeadlines(profileId: string, pauseDurationMs: number): Promise<number>;
56
56
  /** OWN-11 for a joined runtime: a `user:local` subject becomes the owner, a
57
57
  * `user:local` grantee becomes `app:terminal` (no node has the owner as grantee),
58
58
  * a terminal node born before the local grant mirror (no subject) gets the owner,
59
59
  * and a reference to the dropped local grant is cleared so the node resolves the
60
60
  * synced grant by grantee and subject. */
61
- export declare function rewriteLocalNodeIdentity(db: DatabaseSync, owner: string, localGrantId: string): number;
61
+ export declare function rewriteLocalNodeIdentity(db: CanvasDb, owner: string, localGrantId: string): Promise<number>;
62
62
  type NodeUpdate = Partial<Omit<NodeIdentity, 'node_id' | 'pi_session_id' | 'pi_session_file' | 'managed_worktree'>>;
63
63
  /** Update node identity/configuration columns. Sessions and worktrees have named stores. */
64
- export declare function updateNode(nodeId: string, patch: NodeUpdate): NodeMeta;
64
+ export declare function updateNode(nodeId: string, patch: NodeUpdate): Promise<NodeMeta>;
65
65
  /** Set a node's status. Atomic single-column write. */
66
- export declare function setStatus(nodeId: string, status: NodeStatus): void;
66
+ export declare function setStatus(nodeId: string, status: NodeStatus): Promise<void>;
67
67
  /** Set a node's exit intent. Atomic single-column write. */
68
- export declare function setIntent(nodeId: string, intent: ExitIntent): void;
68
+ export declare function setIntent(nodeId: string, intent: ExitIntent): Promise<void>;
69
69
  /** Atomically write status and/or intent, gated on an optional from-status set
70
70
  * and/or on the row carrying no committed final_report. The lifecycle state
71
71
  * machine (runtime/lifecycle.ts) is the one caller: it owns the legality
@@ -92,14 +92,14 @@ export declare function transitionStatusIntent(nodeId: string, fields: {
92
92
  /** Action-independent document composed before the conditional latch. */
93
93
  documentJson?: string | null;
94
94
  };
95
- }): number;
95
+ }): Promise<number>;
96
96
  /** Read a node's committed-final latch pointer. Pure read, no side effect. */
97
- export declare function getFinalReport(nodeId: string): string | null;
97
+ export declare function getFinalReport(nodeId: string): Promise<string | null>;
98
98
  /** CAS-clear a node's finalization latch (final_report + finalized_at) —
99
99
  * retract-pointer-only. Gated on the exact final_report value the caller
100
100
  * observed via getFinalReport, so a concurrent clear/refinalize can never be
101
101
  * clobbered. Returns true iff the CAS matched and cleared. */
102
- export declare function clearFinalReportIfMatches(nodeId: string, expectedFinalReport: string): boolean;
102
+ export declare function clearFinalReportIfMatches(nodeId: string, expectedFinalReport: string): Promise<boolean>;
103
103
  /** Set a node's tmux presence in one atomic write: the durable LOCATION anchor
104
104
  * `pane` (the `%pane_id`) plus its derived cache (`tmux_session` + `window`).
105
105
  * All three move together — `pane` joins the others inside the single UPDATE so
@@ -110,27 +110,27 @@ export declare function setPresence(nodeId: string, presence: {
110
110
  tmux_session?: string | null;
111
111
  window?: string | null;
112
112
  pane?: string | null;
113
- }): void;
114
- export declare function recordLaunch(nodeId: string, at: string): void;
115
- export declare function recordSettledTurn(nodeId: string, at: string): void;
116
- export declare function setFrozen(nodeId: string, at: string): void;
117
- export declare function clearFrozen(nodeId: string): void;
113
+ }): Promise<void>;
114
+ export declare function recordLaunch(nodeId: string, at: string): Promise<void>;
115
+ export declare function recordSettledTurn(nodeId: string, at: string): Promise<void>;
116
+ export declare function setFrozen(nodeId: string, at: string): Promise<void>;
117
+ export declare function clearFrozen(nodeId: string): Promise<void>;
118
118
  export declare function recordRespawnAttempt(nodeId: string, attempt: {
119
119
  failures: number;
120
120
  notBefore: string | null;
121
- }): void;
122
- export declare function listNodesByProfile(profileId: string): NodeMeta[];
121
+ }): Promise<void>;
122
+ export declare function listNodesByProfile(profileId: string): Promise<NodeMeta[]>;
123
123
  /** Browse's first frame: select only fields its rows/tree use. Keep the fault and
124
124
  * turn columns for rowFrom's live fault/streaming semantics, but never hydrate
125
125
  * outcomes, placement, metadata or the (often large) telemetry activity text. */
126
- export declare function browseNodes(): NodeRow[];
126
+ export declare function browseNodes(): Promise<NodeRow[]>;
127
127
  /** All rows, optionally filtered by status and terminal execution traces. Unclaimed warm spares are excluded. */
128
128
  export declare function updateNodeTelemetry(nodeId: string, telemetry: {
129
129
  tokensIn: number;
130
130
  contextTokens: number | null;
131
131
  lastActivity: string | null;
132
132
  updatedAt: string;
133
- }): void;
133
+ }): Promise<void>;
134
134
  export interface GraphNodeRow {
135
135
  node_id: string;
136
136
  name: string;
@@ -148,39 +148,39 @@ export interface GraphNodeRow {
148
148
  /** Stored fields the attach graph displays, plus the two live execution cues it
149
149
  * needs. This keeps the interactive graph off the full node-summary projection
150
150
  * and its unused runtime, outcome, and placement fields. */
151
- export declare function graphNodes(): GraphNodeRow[];
151
+ export declare function graphNodes(): Promise<GraphNodeRow[]>;
152
152
  export declare function listNodes(filter?: {
153
153
  status?: NodeStatus | NodeStatus[];
154
154
  withRecordedPid?: boolean;
155
155
  withRecordedPidOrFrozen?: boolean;
156
- }): NodeRow[];
156
+ }): Promise<NodeRow[]>;
157
157
  /** Placement-only terminal rows for the daemon's residue pass. These columns
158
158
  * preserve lastActivityMs's timestamp inputs and the teardown event fields;
159
159
  * unlike node_rows, the nodes table needs no execution/session/fault joins. */
160
160
  export type TerminalPlacementResidue = Pick<NodeRow, 'node_id' | 'created' | 'launched_at' | 'last_settled_at' | 'finalized_at' | 'outcome_at' | 'last_activity_at' | 'pane' | 'window' | 'tmux_session'>;
161
161
  export declare const terminalPlacementResidueSql = "SELECT\n node_id, created, launched_at, last_settled_at, finalized_at,\n outcome_at, last_activity_at, pane, \"window\", tmux_session\n FROM nodes INDEXED BY idx_nodes_terminal_placement_created\n WHERE node_id NOT IN (SELECT node_id FROM warm_pool)\n AND status IN ('done', 'canceled', 'dead')\n AND (pane IS NOT NULL OR \"window\" IS NOT NULL OR tmux_session IS NOT NULL)\n ORDER BY created";
162
- export declare function listTerminalPlacementResidue(): TerminalPlacementResidue[];
162
+ export declare function listTerminalPlacementResidue(): Promise<TerminalPlacementResidue[]>;
163
163
  /** The daemon's complete supervision set. Live rows participate regardless of
164
164
  * PID; terminal rows participate only while they retain a PID or freeze mark. */
165
165
  export declare const nodesForSupervisionSql = "WITH candidates AS MATERIALIZED (\n SELECT node_id FROM nodes WHERE status IN ('active', 'idle')\n UNION\n SELECT node_id FROM nodes INDEXED BY idx_nodes_supervision_frozen\n WHERE frozen_at IS NOT NULL AND status IN ('done', 'canceled', 'dead')\n UNION\n SELECT node_id FROM executions\n WHERE state != 'exited' AND state = 'running' AND pid IS NOT NULL\n )\n SELECT v.* FROM candidates c CROSS JOIN node_rows v\n WHERE v.node_id = c.node_id\n AND v.node_id NOT IN (SELECT node_id FROM warm_pool)\n AND v.kind != 'human'\n AND (v.status IN ('active', 'idle') OR (v.status IN ('done', 'canceled', 'dead') AND (v.pi_pid IS NOT NULL OR v.frozen_at IS NOT NULL)))\n ORDER BY v.created";
166
- export declare function listNodesForSupervision(): NodeRow[];
166
+ export declare function listNodesForSupervision(): Promise<NodeRow[]>;
167
167
  /** Identity-only projection of every user-visible row: the broker's report
168
168
  * resolver needs only "does this sender exist, and what is it called", and a
169
169
  * three-column read stays cheap against a canvas of thousands of rows where a
170
170
  * full `listNodes()` hydration does not. */
171
- export declare function listNodeIdentities(): Array<Pick<NodeRow, 'node_id' | 'name' | 'created'> & {
171
+ export declare function listNodeIdentities(): Promise<Array<Pick<NodeRow, 'node_id' | 'name' | 'created'> & {
172
172
  grantee: string;
173
- }>;
173
+ }>>;
174
174
  /** Mark an already-spawned node as an unclaimed spare for `recipeKey`. Hides it
175
175
  * from every listing until it is claimed. */
176
- export declare function registerWarmSpare(nodeId: string, recipeKey: string): void;
176
+ export declare function registerWarmSpare(nodeId: string, recipeKey: string): Promise<void>;
177
177
  /** Take a parked spare OUT of the pool without claiming it — the reaper's
178
178
  * first move. Returns false when the marker was already gone (a concurrent
179
179
  * claim won it), which is the reaper's signal to leave that node alone: it is
180
180
  * somebody's live conversation now, not a spare. Deleting the marker under the
181
181
  * write lock is exactly what `claimWarmSpare` does, so the two can never both
182
182
  * succeed on the same node. */
183
- export declare function unregisterWarmSpare(nodeId: string): boolean;
183
+ export declare function unregisterWarmSpare(nodeId: string): Promise<boolean>;
184
184
  /** One parked spare, joined to the node row a claim/reap needs to judge it. */
185
185
  export interface WarmSpareRow {
186
186
  node_id: string;
@@ -194,14 +194,14 @@ export interface WarmSpareRow {
194
194
  /** Every parked spare, oldest first — what the reaper (`runtime/warm-pool.ts`
195
195
  * `reapStaleSpares`) sweeps. Deliberately NOT filtered by liveness: judging a
196
196
  * spare is the caller's job. */
197
- export declare function listWarmSpares(): WarmSpareRow[];
197
+ export declare function listWarmSpares(): Promise<WarmSpareRow[]>;
198
198
  /** True while `nodeId` is an UNCLAIMED spare — nobody owns this conversation
199
199
  * yet. `registerWarmSpare` runs the instant the row exists and BEFORE the
200
200
  * broker launch, and a claim deletes the marker atomically, so this is a
201
201
  * reliable read from inside the booting engine (the context-intro extension
202
202
  * asks it at `session_start` to withhold bearings that would otherwise assert
203
203
  * the spare's placeholder persona instead of its eventual claimant's). */
204
- export declare function isWarmSpare(nodeId: string): boolean;
204
+ export declare function isWarmSpare(nodeId: string): Promise<boolean>;
205
205
  /** Hand out the oldest CLAIMABLE spare matching `recipeKey`, or null when the
206
206
  * pool has none. The select+delete run inside ONE canvas write-lock
207
207
  * transaction, so two concurrent creates can never be handed the same spare.
@@ -217,15 +217,15 @@ export declare function claimWarmSpare(recipeKey: string, created: string, opts?
217
217
  deadlineAt?: string;
218
218
  outcomeDelivery?: OutcomeDeliveryBinding;
219
219
  requestKey?: string;
220
- }): string | null;
220
+ }): Promise<string | null>;
221
221
  /** How many CLAIMABLE spares are parked for `recipeKey` (the depth check a
222
222
  * refill reads before minting). Uses the same liveness test as the claim, so a
223
223
  * spare the claim would skip can never hold the pool at depth 1 and starve
224
224
  * every later create of a warm start. */
225
- export declare function warmSpareCount(recipeKey: string): number;
225
+ export declare function warmSpareCount(recipeKey: string): Promise<number>;
226
226
  /** Direct children of `id`, oldest first — an indexed point query
227
227
  * (`idx_nodes_parent`) instead of a full-table `listNodes()` scan. */
228
- export declare function childrenOf(id: string): string[];
228
+ export declare function childrenOf(id: string): Promise<string[]>;
229
229
  /** One lean roster row: only the `nodes` columns needed by the roster. Backs
230
230
  * `GET /v1/canvas/roster` — the recurring attach /
231
231
  * browser topology poll, distinct from the enriched per-row
@@ -244,14 +244,14 @@ export interface RosterRow {
244
244
  }
245
245
  /** Every node's lean roster row, oldest first — a single scan indexed by
246
246
  * `idx_nodes_created`, with no per-row hydration or N+1 query. */
247
- export declare function rosterNodes(): RosterRow[];
247
+ export declare function rosterNodes(): Promise<RosterRow[]>;
248
248
  /** Resumable ROOT conversations pinned to `cwd`, most-recently-created first.
249
249
  * A "root" is the top of a spine (`parent IS NULL`) that is a real
250
250
  * conversation (not a `kind:'human'` ask) and still resumable (`active`/`idle`,
251
251
  * never a `done`/`dead`/`canceled` node). This backs the front-door
252
252
  * `crtr -c`/`-r` resume: cwd is the key (the Claude-Code mental model — "my
253
253
  * last session HERE"), so it never teleports across projects. */
254
- export declare function listResumableRoots(cwd: string): NodeRow[];
254
+ export declare function listResumableRoots(cwd: string): Promise<NodeRow[]>;
255
255
  export * from './tree.js';
256
256
  /** The outcome of {@link withFreshTerminalGuard} — exactly one of three
257
257
  * tagged states, never conflated:
@@ -300,7 +300,7 @@ export declare function withFreshTerminalGuard<T>(nodeId: string, isTerminal: (r
300
300
  status: NodeStatus;
301
301
  final_report: string | null;
302
302
  frozen_at: string | null;
303
- }) => boolean, body: () => T): TerminalGuardResult<T>;
303
+ }) => boolean, body: () => Promise<T> | T): Promise<TerminalGuardResult<T>>;
304
304
  /** A node selected for pruning (or that would be, under --dry-run). */
305
305
  export interface PrunedNode {
306
306
  node_id: string;
@@ -315,7 +315,7 @@ export interface PruneResult {
315
315
  /** Whether a row may be removed by an automatic collection sweep. */
316
316
  export declare function isCollectible(row: NodeRow, opts?: {
317
317
  pastTtl?: boolean;
318
- }): boolean;
318
+ }): Promise<boolean>;
319
319
  /** {@link deleteNode}'s result: whether it actually deleted the node. */
320
320
  export interface DeleteNodeResult {
321
321
  deleted: boolean;
@@ -325,10 +325,10 @@ export interface NodeFiles {
325
325
  nodeId: string;
326
326
  app: string | null;
327
327
  }
328
- export declare function nodeFiles(nodeId: string): NodeFiles;
328
+ export declare function nodeFiles(nodeId: string): Promise<NodeFiles>;
329
329
  /** Remove every directory a deleted node owned. A conversation another node
330
330
  * still references keeps its file, and so its conversations directory. */
331
- export declare function removeNodeFiles(files: NodeFiles): void;
331
+ export declare function removeNodeFiles(files: NodeFiles): Promise<void>;
332
332
  /** Delete ONE node with what it owns ({@link deleteNodeWithOwned}) and remove its on-disk `nodes/<id>/` dir. The single-node
333
333
  * analogue of {@link pruneNodes}, for IMMEDIATE reaping — e.g. an empty node the
334
334
  * user closed or detached from. An open managed worktree is never deleted: its
@@ -337,10 +337,10 @@ export declare function removeNodeFiles(files: NodeFiles): void;
337
337
  * viewer (this does not signal any process). The node row and its FK-coupled
338
338
  * state are removed in one canvas write boundary. Best-effort dir removal
339
339
  * follows the commit. */
340
- export declare function deleteNode(nodeId: string): DeleteNodeResult;
340
+ export declare function deleteNode(nodeId: string): Promise<DeleteNodeResult>;
341
341
  /** Hard-delete a validated set of nodes in one row transaction, then remove
342
342
  * their directories. The caller must tear down engines and viewers first. */
343
- export declare function deleteNodes(nodeIds: readonly string[]): string[];
343
+ export declare function deleteNodes(nodeIds: readonly string[]): Promise<string[]>;
344
344
  /** Retention sweep: remove TERMINAL nodes (status dead | done | canceled) whose
345
345
  * last activity ({@link lastActivityMs}) is older than `ttlDays`, bounding the
346
346
  * otherwise-unbounded growth of node rows + dirs. Only {@link isCollectible}
@@ -358,11 +358,11 @@ export declare function deleteNodes(nodeIds: readonly string[]): string[];
358
358
  * reports the candidate set and deletes NOTHING. */
359
359
  export declare function pruneNodes(opts: {
360
360
  ttlDays: number;
361
- held: (nodeId: string) => boolean;
361
+ held: (nodeId: string) => Promise<boolean>;
362
362
  dryRun?: boolean;
363
363
  includeStale?: boolean;
364
364
  removeDirs?: (dirs: string[]) => void;
365
- }): PruneResult;
365
+ }): Promise<PruneResult>;
366
366
  /** A node's most recent activity (epoch ms): the latest of its lifecycle
367
367
  * timestamps (created, launched, settled, finalized, outcome, last run event)
368
368
  * and the mtime of `job/telemetry.json`, which every turn_end rewrites. 0 when
@@ -379,6 +379,6 @@ export declare function lastActivityMs(row: Pick<NodeRow, 'node_id' | 'created'
379
379
  * reports the candidate set and deletes NOTHING. */
380
380
  export declare function pruneToLimit(opts: {
381
381
  maxNodes: number;
382
- held: (nodeId: string) => boolean;
382
+ held: (nodeId: string) => Promise<boolean>;
383
383
  dryRun?: boolean;
384
- }): PruneResult;
384
+ }): Promise<PruneResult>;