@north-light/cli 0.3.530 → 0.3.532

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 (495) hide show
  1. package/dist/clients/attach/session/connection.js +1 -1
  2. package/dist/clients/attach/session/reconnect.js +1 -1
  3. package/dist/clients/attach/viewer.js +508 -508
  4. package/dist/core/async-array.d.ts +7 -0
  5. package/dist/core/async-array.js +1 -0
  6. package/dist/core/audit.d.ts +1 -1
  7. package/dist/core/audit.js +2 -2
  8. package/dist/core/canvas/attention.d.ts +4 -4
  9. package/dist/core/canvas/attention.js +1 -1
  10. package/dist/core/canvas/boot.d.ts +4 -4
  11. package/dist/core/canvas/boot.js +1 -1
  12. package/dist/core/canvas/canvas.d.ts +59 -59
  13. package/dist/core/canvas/canvas.js +19 -19
  14. package/dist/core/canvas/context-strip.js +2 -2
  15. package/dist/core/canvas/crons.d.ts +27 -27
  16. package/dist/core/canvas/crons.js +11 -11
  17. package/dist/core/canvas/daemon-actions.d.ts +10 -10
  18. package/dist/core/canvas/daemon-actions.js +8 -8
  19. package/dist/core/canvas/daemon-owner.d.ts +3 -3
  20. package/dist/core/canvas/daemon-owner.js +2 -2
  21. package/dist/core/canvas/db.d.ts +19 -30
  22. package/dist/core/canvas/db.js +3 -2
  23. package/dist/core/canvas/deliveries.d.ts +16 -16
  24. package/dist/core/canvas/deliveries.js +24 -24
  25. package/dist/core/canvas/executions.d.ts +8 -8
  26. package/dist/core/canvas/executions.js +1 -1
  27. package/dist/core/canvas/focuses.d.ts +8 -8
  28. package/dist/core/canvas/focuses.js +1 -1
  29. package/dist/core/canvas/history.d.ts +3 -3
  30. package/dist/core/canvas/history.js +9 -9
  31. package/dist/core/canvas/install-id.d.ts +1 -1
  32. package/dist/core/canvas/install-id.js +1 -1
  33. package/dist/core/canvas/managed-worktree-sweep-candidates.d.ts +1 -1
  34. package/dist/core/canvas/managed-worktree-sweep-candidates.js +2 -2
  35. package/dist/core/canvas/memory-reads.d.ts +6 -6
  36. package/dist/core/canvas/memory-reads.js +1 -1
  37. package/dist/core/canvas/nav-model.d.ts +13 -13
  38. package/dist/core/canvas/nav-model.js +1 -1
  39. package/dist/core/canvas/node-agent-paths.d.ts +6 -6
  40. package/dist/core/canvas/node-agent-paths.js +1 -1
  41. package/dist/core/canvas/node-tokens.d.ts +7 -7
  42. package/dist/core/canvas/node-tokens.js +3 -3
  43. package/dist/core/canvas/outcome-actions.d.ts +5 -5
  44. package/dist/core/canvas/outcome-actions.js +3 -3
  45. package/dist/core/canvas/recovery.d.ts +26 -26
  46. package/dist/core/canvas/recovery.js +2 -2
  47. package/dist/core/canvas/render-source.d.ts +1 -1
  48. package/dist/core/canvas/render-source.js +1 -1
  49. package/dist/core/canvas/sessions.d.ts +10 -10
  50. package/dist/core/canvas/sessions.js +4 -4
  51. package/dist/core/canvas/source.js +1 -1
  52. package/dist/core/canvas/structured-requests.d.ts +15 -15
  53. package/dist/core/canvas/structured-requests.js +5 -5
  54. package/dist/core/canvas/tree.d.ts +9 -9
  55. package/dist/core/canvas/tree.js +5 -5
  56. package/dist/core/canvas/waits.d.ts +13 -13
  57. package/dist/core/canvas/waits.js +6 -6
  58. package/dist/core/canvas/worktrees.d.ts +15 -15
  59. package/dist/core/canvas/worktrees.js +1 -1
  60. package/dist/core/command-hooks/transport/exec-lifecycle.js +1 -1
  61. package/dist/core/conversation-store/file-store.d.ts +7 -7
  62. package/dist/core/conversation-store/file-store.js +9 -9
  63. package/dist/core/conversation-store/index.d.ts +16 -14
  64. package/dist/core/conversation-store/index.js +1 -1
  65. package/dist/core/conversation-store/listener.js +5 -5
  66. package/dist/core/conversation-store/patch.d.ts +3 -1
  67. package/dist/core/conversation-store/patch.js +1 -1
  68. package/dist/core/feed/feed.js +3 -3
  69. package/dist/core/feed/inbox.d.ts +2 -2
  70. package/dist/core/feed/inbox.js +1 -1
  71. package/dist/core/feed/messages.d.ts +11 -12
  72. package/dist/core/feed/messages.js +5 -5
  73. package/dist/core/feed/reports.d.ts +4 -4
  74. package/dist/core/feed/reports.js +2 -2
  75. package/dist/core/grants/cover.d.ts +1 -1
  76. package/dist/core/grants/cover.js +1 -1
  77. package/dist/core/grants/local.d.ts +1 -1
  78. package/dist/core/grants/local.js +1 -1
  79. package/dist/core/grants/mirror.d.ts +19 -19
  80. package/dist/core/grants/mirror.js +2 -2
  81. package/dist/core/grants/on-sync.d.ts +1 -1
  82. package/dist/core/grants/on-sync.js +1 -1
  83. package/dist/core/grants/remove.js +1 -1
  84. package/dist/core/grants/sync.js +1 -1
  85. package/dist/core/graph/access.d.ts +17 -17
  86. package/dist/core/graph/access.js +3 -3
  87. package/dist/core/graph/custom.d.ts +16 -16
  88. package/dist/core/graph/custom.js +9 -9
  89. package/dist/core/graph/deletion.d.ts +3 -7
  90. package/dist/core/graph/deletion.js +4 -4
  91. package/dist/core/graph/documents.d.ts +24 -27
  92. package/dist/core/graph/documents.js +7 -7
  93. package/dist/core/graph/edges.d.ts +13 -13
  94. package/dist/core/graph/edges.js +1 -1
  95. package/dist/core/graph/events.d.ts +7 -9
  96. package/dist/core/graph/events.js +8 -8
  97. package/dist/core/graph/exposures.d.ts +6 -6
  98. package/dist/core/graph/exposures.js +4 -4
  99. package/dist/core/graph/jobs.d.ts +6 -8
  100. package/dist/core/graph/jobs.js +2 -2
  101. package/dist/core/graph/kinds/action.js +1 -1
  102. package/dist/core/graph/kinds/custom.js +2 -2
  103. package/dist/core/graph/kinds/document.d.ts +1 -0
  104. package/dist/core/graph/kinds/document.js +4 -4
  105. package/dist/core/graph/kinds/dto.d.ts +2 -2
  106. package/dist/core/graph/kinds/dto.js +1 -1
  107. package/dist/core/graph/kinds/job.js +2 -2
  108. package/dist/core/graph/kinds/kind.d.ts +6 -8
  109. package/dist/core/graph/kinds/kind.js +1 -1
  110. package/dist/core/graph/kinds/node.js +5 -5
  111. package/dist/core/graph/kinds/owner.js +2 -2
  112. package/dist/core/graph/kinds/registry.d.ts +6 -9
  113. package/dist/core/graph/kinds/registry.js +1 -1
  114. package/dist/core/graph/names.d.ts +6 -6
  115. package/dist/core/graph/names.js +3 -3
  116. package/dist/core/graph/object-waits.d.ts +4 -7
  117. package/dist/core/graph/object-waits.js +1 -1
  118. package/dist/core/graph/objects.d.ts +14 -14
  119. package/dist/core/graph/objects.js +9 -9
  120. package/dist/core/graph/package-docs.d.ts +2 -7
  121. package/dist/core/graph/package-docs.js +5 -5
  122. package/dist/core/graph/package-kinds.d.ts +2 -5
  123. package/dist/core/graph/package-kinds.js +1 -1
  124. package/dist/core/graph/package-reconcile.d.ts +2 -5
  125. package/dist/core/graph/package-reconcile.js +1 -1
  126. package/dist/core/graph/reader.d.ts +18 -18
  127. package/dist/core/graph/reader.js +3 -3
  128. package/dist/core/graph/receivers.d.ts +4 -4
  129. package/dist/core/graph/receivers.js +5 -5
  130. package/dist/core/graph/repo-sync/exchange.d.ts +3 -7
  131. package/dist/core/graph/repo-sync/exchange.js +2 -2
  132. package/dist/core/graph/repo-sync/repos.d.ts +7 -5
  133. package/dist/core/graph/repo-sync/repos.js +3 -3
  134. package/dist/core/graph/repo-sync/sync.d.ts +3 -6
  135. package/dist/core/graph/repo-sync/sync.js +2 -2
  136. package/dist/core/graph/rules.d.ts +5 -5
  137. package/dist/core/graph/rules.js +3 -3
  138. package/dist/core/graph/spaces/app.js +1 -1
  139. package/dist/core/graph/spaces/index.d.ts +4 -5
  140. package/dist/core/graph/spaces/index.js +1 -1
  141. package/dist/core/graph/spaces/own-memory.d.ts +4 -4
  142. package/dist/core/graph/spaces/own-memory.js +1 -1
  143. package/dist/core/graph/spaces/person.js +3 -3
  144. package/dist/core/graph/spaces/repo.d.ts +1 -1
  145. package/dist/core/graph/spaces/repo.js +1 -1
  146. package/dist/core/graph/watches.d.ts +15 -15
  147. package/dist/core/graph/watches.js +10 -10
  148. package/dist/core/human/feedback-companion.d.ts +2 -2
  149. package/dist/core/human/feedback-companion.js +1 -1
  150. package/dist/core/human/feedback.d.ts +3 -3
  151. package/dist/core/human/feedback.js +1 -1
  152. package/dist/core/human/requests.d.ts +34 -33
  153. package/dist/core/human/requests.js +20 -20
  154. package/dist/core/human/scan.d.ts +2 -2
  155. package/dist/core/human/scan.js +1 -1
  156. package/dist/core/human/tickets.d.ts +9 -9
  157. package/dist/core/human/tickets.js +1 -1
  158. package/dist/core/llm/app-rungs.d.ts +1 -1
  159. package/dist/core/llm/app-rungs.js +1 -1
  160. package/dist/core/llm/run.js +2 -2
  161. package/dist/core/peer/directory.d.ts +1 -1
  162. package/dist/core/peer/directory.js +1 -1
  163. package/dist/core/peer/envelope.d.ts +3 -3
  164. package/dist/core/peer/envelope.js +1 -1
  165. package/dist/core/peer/home.d.ts +13 -7
  166. package/dist/core/peer/home.js +2 -2
  167. package/dist/core/peer/ingest.d.ts +6 -6
  168. package/dist/core/peer/ingest.js +1 -1
  169. package/dist/core/peer/outbox-store.d.ts +14 -14
  170. package/dist/core/peer/outbox-store.js +5 -5
  171. package/dist/core/peer/receiver.d.ts +2 -2
  172. package/dist/core/peer/receiver.js +1 -1
  173. package/dist/core/peer/stubs.d.ts +10 -10
  174. package/dist/core/peer/stubs.js +1 -1
  175. package/dist/core/providers/approval.d.ts +2 -2
  176. package/dist/core/providers/approval.js +2 -2
  177. package/dist/core/providers/audit.d.ts +3 -3
  178. package/dist/core/providers/audit.js +2 -2
  179. package/dist/core/providers/bundles.js +2 -2
  180. package/dist/core/providers/call.d.ts +2 -2
  181. package/dist/core/providers/call.js +1 -1
  182. package/dist/core/providers/files.d.ts +1 -1
  183. package/dist/core/providers/files.js +1 -1
  184. package/dist/core/providers/mint.js +1 -1
  185. package/dist/core/providers/receipts.d.ts +1 -1
  186. package/dist/core/providers/receipts.js +2 -2
  187. package/dist/core/review/birth.js +1 -1
  188. package/dist/core/review/comments.d.ts +19 -19
  189. package/dist/core/review/comments.js +5 -5
  190. package/dist/core/review/companion.d.ts +1 -1
  191. package/dist/core/review/companion.js +1 -1
  192. package/dist/core/review/document.d.ts +3 -3
  193. package/dist/core/review/document.js +2 -2
  194. package/dist/core/review/fork.js +2 -2
  195. package/dist/core/review/realize.js +1 -1
  196. package/dist/core/review/remap.d.ts +2 -2
  197. package/dist/core/review/remap.js +4 -4
  198. package/dist/core/review/stage.d.ts +1 -1
  199. package/dist/core/review/stage.js +1 -1
  200. package/dist/core/review/store.d.ts +21 -21
  201. package/dist/core/review/store.js +1 -1
  202. package/dist/core/runs/activity.d.ts +1 -1
  203. package/dist/core/runs/activity.js +5 -5
  204. package/dist/core/runs/confinement.d.ts +7 -7
  205. package/dist/core/runs/confinement.js +2 -2
  206. package/dist/core/runs/events.d.ts +12 -12
  207. package/dist/core/runs/events.js +4 -4
  208. package/dist/core/runs/operations.d.ts +11 -11
  209. package/dist/core/runs/operations.js +5 -5
  210. package/dist/core/runs/questions.d.ts +10 -10
  211. package/dist/core/runs/questions.js +3 -3
  212. package/dist/core/runtime/auth-reload.js +1 -1
  213. package/dist/core/runtime/bearings.d.ts +5 -5
  214. package/dist/core/runtime/bearings.js +6 -6
  215. package/dist/core/runtime/broker-inventory.js +1 -1
  216. package/dist/core/runtime/broker-request.js +1 -1
  217. package/dist/core/runtime/broker.js +1 -1
  218. package/dist/core/runtime/close.d.ts +3 -3
  219. package/dist/core/runtime/close.js +1 -1
  220. package/dist/core/runtime/deliver-live.js +1 -1
  221. package/dist/core/runtime/fleet.d.ts +2 -2
  222. package/dist/core/runtime/host.d.ts +3 -3
  223. package/dist/core/runtime/host.js +3 -3
  224. package/dist/core/runtime/kickoff.d.ts +12 -12
  225. package/dist/core/runtime/kickoff.js +17 -17
  226. package/dist/core/runtime/launch-target.d.ts +1 -1
  227. package/dist/core/runtime/launch-target.js +1 -1
  228. package/dist/core/runtime/ledger.d.ts +3 -3
  229. package/dist/core/runtime/ledger.js +3 -3
  230. package/dist/core/runtime/lifecycle.d.ts +1 -1
  231. package/dist/core/runtime/lifecycle.js +2 -2
  232. package/dist/core/runtime/memory-admission.js +1 -1
  233. package/dist/core/runtime/model-swap.d.ts +2 -2
  234. package/dist/core/runtime/model-swap.js +1 -1
  235. package/dist/core/runtime/node-read.d.ts +1 -1
  236. package/dist/core/runtime/node-read.js +2 -2
  237. package/dist/core/runtime/nodes.d.ts +6 -6
  238. package/dist/core/runtime/nodes.js +1 -1
  239. package/dist/core/runtime/outcome-document.d.ts +1 -1
  240. package/dist/core/runtime/outcome-document.js +1 -1
  241. package/dist/core/runtime/persona.d.ts +3 -3
  242. package/dist/core/runtime/persona.js +2 -2
  243. package/dist/core/runtime/placement.d.ts +11 -11
  244. package/dist/core/runtime/placement.js +1 -1
  245. package/dist/core/runtime/promote.d.ts +3 -3
  246. package/dist/core/runtime/promote.js +1 -1
  247. package/dist/core/runtime/recycle.js +1 -1
  248. package/dist/core/runtime/reopen.d.ts +5 -5
  249. package/dist/core/runtime/reopen.js +1 -1
  250. package/dist/core/runtime/reset.d.ts +4 -4
  251. package/dist/core/runtime/reset.js +1 -1
  252. package/dist/core/runtime/revive-all.d.ts +2 -2
  253. package/dist/core/runtime/revive-all.js +1 -1
  254. package/dist/core/runtime/revive.d.ts +4 -4
  255. package/dist/core/runtime/revive.js +2 -2
  256. package/dist/core/runtime/roadmap.d.ts +6 -6
  257. package/dist/core/runtime/roadmap.js +5 -5
  258. package/dist/core/runtime/session-branch.d.ts +1 -1
  259. package/dist/core/runtime/session-branch.js +1 -1
  260. package/dist/core/runtime/session-list-cache.js +1 -1
  261. package/dist/core/runtime/situational-live.js +1 -1
  262. package/dist/core/runtime/spawn.d.ts +2 -2
  263. package/dist/core/runtime/spawn.js +2 -2
  264. package/dist/core/runtime/stop-guard.d.ts +2 -2
  265. package/dist/core/runtime/stop-guard.js +3 -3
  266. package/dist/core/runtime/warm-pool.d.ts +2 -2
  267. package/dist/core/runtime/warm-pool.js +1 -1
  268. package/dist/core/spaces/mounts.d.ts +2 -2
  269. package/dist/core/spaces/mounts.js +1 -1
  270. package/dist/core/spaces/permissions.d.ts +1 -1
  271. package/dist/core/spaces/permissions.js +1 -1
  272. package/dist/core/spaces/process.d.ts +1 -1
  273. package/dist/core/spaces/process.js +1 -1
  274. package/dist/core/spaces/space.js +1 -1
  275. package/dist/core/spaces/stop.d.ts +3 -3
  276. package/dist/core/spaces/stop.js +2 -2
  277. package/dist/core/spaces/users.d.ts +6 -6
  278. package/dist/core/spaces/users.js +1 -1
  279. package/dist/core/storage/attachments.d.ts +2 -2
  280. package/dist/core/storage/attachments.js +1 -1
  281. package/dist/core/storage/shares.d.ts +2 -2
  282. package/dist/core/storage/shares.js +1 -1
  283. package/dist/core/storage/tables.d.ts +21 -21
  284. package/dist/core/storage/tables.js +3 -3
  285. package/dist/core/substrate/delivery/corpus.d.ts +5 -8
  286. package/dist/core/substrate/delivery/corpus.js +3 -3
  287. package/dist/core/substrate/delivery/deliver.d.ts +10 -15
  288. package/dist/core/substrate/delivery/deliver.js +3 -3
  289. package/dist/core/substrate/delivery/plan.d.ts +2 -12
  290. package/dist/core/substrate/delivery/plan.js +3 -3
  291. package/dist/core/substrate/delivery/render-boot.d.ts +4 -4
  292. package/dist/core/substrate/delivery/render-boot.js +18 -18
  293. package/dist/core/substrate/delivery/render-event.d.ts +7 -14
  294. package/dist/core/substrate/delivery/render-event.js +4 -4
  295. package/dist/core/substrate/subject.d.ts +2 -2
  296. package/dist/core/substrate/subject.js +1 -1
  297. package/dist/core/usage/ledger.d.ts +6 -6
  298. package/dist/core/usage/ledger.js +4 -4
  299. package/dist/core/worktree-close.js +4 -4
  300. package/dist/core/worktree-mutation-async.js +7 -7
  301. package/dist/core/worktree-quarantine.js +1 -1
  302. package/dist/core/worktree-sweep.d.ts +1 -1
  303. package/dist/core/worktree-sweep.js +6 -6
  304. package/dist/core/worktree.d.ts +5 -5
  305. package/dist/core/worktree.js +13 -13
  306. package/dist/daemon/analytics/compute.d.ts +2 -2
  307. package/dist/daemon/analytics/compute.js +1 -1
  308. package/dist/daemon/api/app-listener.d.ts +4 -4
  309. package/dist/daemon/api/app-listener.js +13 -13
  310. package/dist/daemon/api/bridge.js +5 -5
  311. package/dist/daemon/api/document-listener.js +6 -6
  312. package/dist/daemon/api/handlers/analytics.js +1 -1
  313. package/dist/daemon/api/handlers/attach.js +1 -1
  314. package/dist/daemon/api/handlers/bash-jobs.js +1 -1
  315. package/dist/daemon/api/handlers/bash.js +1 -1
  316. package/dist/daemon/api/handlers/broker-ops.d.ts +1 -1
  317. package/dist/daemon/api/handlers/broker-ops.js +1 -1
  318. package/dist/daemon/api/handlers/broker-recovery.d.ts +1 -1
  319. package/dist/daemon/api/handlers/broker-recovery.js +1 -1
  320. package/dist/daemon/api/handlers/broker-signals.d.ts +2 -2
  321. package/dist/daemon/api/handlers/broker-signals.js +2 -2
  322. package/dist/daemon/api/handlers/canvas.d.ts +1 -1
  323. package/dist/daemon/api/handlers/canvas.js +4 -4
  324. package/dist/daemon/api/handlers/chat-inventory.js +1 -1
  325. package/dist/daemon/api/handlers/crons.js +1 -1
  326. package/dist/daemon/api/handlers/custom-objects.d.ts +4 -4
  327. package/dist/daemon/api/handlers/custom-objects.js +3 -3
  328. package/dist/daemon/api/handlers/delivery-retry.js +1 -1
  329. package/dist/daemon/api/handlers/delivery.js +1 -1
  330. package/dist/daemon/api/handlers/docs.d.ts +4 -4
  331. package/dist/daemon/api/handlers/docs.js +1 -1
  332. package/dist/daemon/api/handlers/feedback-comments.js +3 -3
  333. package/dist/daemon/api/handlers/files.js +1 -1
  334. package/dist/daemon/api/handlers/focus.js +1 -1
  335. package/dist/daemon/api/handlers/health.js +3 -3
  336. package/dist/daemon/api/handlers/hook-exec.js +1 -1
  337. package/dist/daemon/api/handlers/human-requests.js +1 -1
  338. package/dist/daemon/api/handlers/inbox-page.d.ts +1 -1
  339. package/dist/daemon/api/handlers/inbox-page.js +1 -1
  340. package/dist/daemon/api/handlers/inbox.d.ts +1 -1
  341. package/dist/daemon/api/handlers/inbox.js +1 -1
  342. package/dist/daemon/api/handlers/llm.d.ts +1 -1
  343. package/dist/daemon/api/handlers/llm.js +3 -3
  344. package/dist/daemon/api/handlers/memory-reads.js +1 -1
  345. package/dist/daemon/api/handlers/memory.d.ts +5 -5
  346. package/dist/daemon/api/handlers/memory.js +5 -5
  347. package/dist/daemon/api/handlers/messages.js +2 -2
  348. package/dist/daemon/api/handlers/node-events.d.ts +2 -2
  349. package/dist/daemon/api/handlers/node-events.js +3 -3
  350. package/dist/daemon/api/handlers/node-outcomes.js +1 -1
  351. package/dist/daemon/api/handlers/node-records.js +2 -2
  352. package/dist/daemon/api/handlers/nodes.d.ts +1 -1
  353. package/dist/daemon/api/handlers/nodes.js +1 -1
  354. package/dist/daemon/api/handlers/objects.js +3 -3
  355. package/dist/daemon/api/handlers/package-docs.js +1 -1
  356. package/dist/daemon/api/handlers/plugin-app-token.d.ts +1 -1
  357. package/dist/daemon/api/handlers/plugin-app-token.js +1 -1
  358. package/dist/daemon/api/handlers/profiles.d.ts +3 -3
  359. package/dist/daemon/api/handlers/profiles.js +1 -1
  360. package/dist/daemon/api/handlers/providers.d.ts +1 -1
  361. package/dist/daemon/api/handlers/providers.js +1 -1
  362. package/dist/daemon/api/handlers/questions.js +1 -1
  363. package/dist/daemon/api/handlers/reports.d.ts +1 -1
  364. package/dist/daemon/api/handlers/reports.js +5 -5
  365. package/dist/daemon/api/handlers/review-comments.js +1 -1
  366. package/dist/daemon/api/handlers/reviews.js +1 -1
  367. package/dist/daemon/api/handlers/runs.js +1 -1
  368. package/dist/daemon/api/handlers/structured-requests.js +1 -1
  369. package/dist/daemon/api/handlers/subscriptions.js +1 -1
  370. package/dist/daemon/api/handlers/transfer.js +1 -1
  371. package/dist/daemon/api/map.d.ts +3 -3
  372. package/dist/daemon/api/map.js +1 -1
  373. package/dist/daemon/api/principal.d.ts +1 -1
  374. package/dist/daemon/api/principal.js +1 -1
  375. package/dist/daemon/api/reader.d.ts +5 -5
  376. package/dist/daemon/api/reader.js +1 -1
  377. package/dist/daemon/api/router.d.ts +5 -5
  378. package/dist/daemon/api/router.js +1 -1
  379. package/dist/daemon/api/server.js +1 -1
  380. package/dist/daemon/broker-signals/bus.d.ts +1 -1
  381. package/dist/daemon/broker-signals/bus.js +1 -1
  382. package/dist/daemon/companion-retire.js +1 -1
  383. package/dist/daemon/cron/armed-context.d.ts +2 -2
  384. package/dist/daemon/cron/armed-context.js +1 -1
  385. package/dist/daemon/cron/authority.d.ts +2 -2
  386. package/dist/daemon/cron/authority.js +1 -1
  387. package/dist/daemon/cron/disposition.js +1 -1
  388. package/dist/daemon/cron/ended.d.ts +1 -1
  389. package/dist/daemon/cron/ended.js +2 -2
  390. package/dist/daemon/cron/escalation.js +3 -3
  391. package/dist/daemon/cron/folders.d.ts +1 -1
  392. package/dist/daemon/cron/folders.js +1 -1
  393. package/dist/daemon/cron/held.d.ts +1 -1
  394. package/dist/daemon/cron/held.js +1 -1
  395. package/dist/daemon/cron/lease-recovery.d.ts +1 -1
  396. package/dist/daemon/cron/lease-recovery.js +1 -1
  397. package/dist/daemon/cron/passes.d.ts +2 -2
  398. package/dist/daemon/cron/passes.js +1 -1
  399. package/dist/daemon/cron/run-socket.d.ts +1 -1
  400. package/dist/daemon/cron/run-socket.js +1 -1
  401. package/dist/daemon/cron/settle.js +1 -1
  402. package/dist/daemon/cron/sinks.d.ts +1 -1
  403. package/dist/daemon/cron/sinks.js +2 -2
  404. package/dist/daemon/cron-run.d.ts +12 -3
  405. package/dist/daemon/cron-run.js +2 -2
  406. package/dist/daemon/crtrd.js +6 -6
  407. package/dist/daemon/delivery/run-delivery.js +1 -1
  408. package/dist/daemon/due-sources.d.ts +3 -3
  409. package/dist/daemon/due-sources.js +1 -1
  410. package/dist/daemon/due.d.ts +3 -3
  411. package/dist/daemon/due.js +7 -7
  412. package/dist/daemon/fleet.d.ts +2 -2
  413. package/dist/daemon/fleet.js +11 -11
  414. package/dist/daemon/human/finish.js +3 -3
  415. package/dist/daemon/human/settle.d.ts +1 -1
  416. package/dist/daemon/human/settle.js +1 -1
  417. package/dist/daemon/human/sweep.js +1 -1
  418. package/dist/daemon/joined-owner.d.ts +2 -2
  419. package/dist/daemon/joined-owner.js +1 -1
  420. package/dist/daemon/messaging/node-message.js +1 -1
  421. package/dist/daemon/park-activity.d.ts +2 -2
  422. package/dist/daemon/park-activity.js +1 -1
  423. package/dist/daemon/peer/authority.js +1 -1
  424. package/dist/daemon/peer/forward.d.ts +13 -6
  425. package/dist/daemon/peer/forward.js +1 -1
  426. package/dist/daemon/peer/handlers.js +1 -1
  427. package/dist/daemon/peer/ingress.d.ts +4 -4
  428. package/dist/daemon/peer/ingress.js +1 -1
  429. package/dist/daemon/peer/outbox.d.ts +2 -2
  430. package/dist/daemon/peer/outbox.js +1 -1
  431. package/dist/daemon/peer/relay-service.js +1 -1
  432. package/dist/daemon/plugin-objects/read-leaf.d.ts +2 -2
  433. package/dist/daemon/plugin-objects/read-leaf.js +2 -2
  434. package/dist/daemon/profile-delete.js +1 -1
  435. package/dist/daemon/readiness.d.ts +2 -2
  436. package/dist/daemon/readiness.js +1 -1
  437. package/dist/daemon/reconcilers/action-lane.d.ts +1 -1
  438. package/dist/daemon/reconcilers/action-lane.js +1 -1
  439. package/dist/daemon/reconcilers/bash-deadline.js +2 -2
  440. package/dist/daemon/reconcilers/broker-supervision.d.ts +1 -1
  441. package/dist/daemon/reconcilers/broker-supervision.js +4 -4
  442. package/dist/daemon/reconcilers/controller-death.d.ts +1 -1
  443. package/dist/daemon/reconcilers/controller-death.js +1 -1
  444. package/dist/daemon/reconcilers/cron-lane.d.ts +1 -1
  445. package/dist/daemon/reconcilers/cron-lane.js +1 -1
  446. package/dist/daemon/reconcilers/delivery-lane.d.ts +1 -1
  447. package/dist/daemon/reconcilers/delivery-lane.js +2 -2
  448. package/dist/daemon/reconcilers/fault-retry-backstop.d.ts +3 -3
  449. package/dist/daemon/reconcilers/fault-retry-backstop.js +1 -1
  450. package/dist/daemon/reconcilers/grove-instance-sweep.d.ts +2 -2
  451. package/dist/daemon/reconcilers/grove-instance-sweep.js +1 -1
  452. package/dist/daemon/reconcilers/live-obligation.d.ts +6 -6
  453. package/dist/daemon/reconcilers/live-obligation.js +1 -1
  454. package/dist/daemon/reconcilers/managed-worktree-sweep.js +1 -1
  455. package/dist/daemon/reconcilers/node-deadline.d.ts +1 -1
  456. package/dist/daemon/reconcilers/node-deadline.js +1 -1
  457. package/dist/daemon/reconcilers/node-lifecycle/freeze-lane.js +1 -1
  458. package/dist/daemon/reconcilers/node-lifecycle/respawn-policy.d.ts +3 -3
  459. package/dist/daemon/reconcilers/node-lifecycle/respawn-policy.js +1 -1
  460. package/dist/daemon/reconcilers/node-lifecycle/terminating.js +1 -1
  461. package/dist/daemon/reconcilers/node-lifecycle/tick.js +1 -1
  462. package/dist/daemon/reconcilers/node-lifecycle/wants-execution.d.ts +1 -1
  463. package/dist/daemon/reconcilers/node-lifecycle/wants-execution.js +1 -1
  464. package/dist/daemon/reconcilers/pending-review-submit.d.ts +1 -1
  465. package/dist/daemon/reconcilers/pending-review-submit.js +1 -1
  466. package/dist/daemon/reconcilers/storage-due-work.js +1 -1
  467. package/dist/daemon/reconcilers/storage-maintenance.d.ts +1 -1
  468. package/dist/daemon/reconcilers/storage-maintenance.js +2 -2
  469. package/dist/daemon/reconcilers/structured-request-lane.d.ts +1 -1
  470. package/dist/daemon/reconcilers/structured-request-lane.js +1 -1
  471. package/dist/daemon/review/comment-notify.js +2 -2
  472. package/dist/daemon/review/companion.d.ts +3 -3
  473. package/dist/daemon/review/companion.js +1 -1
  474. package/dist/daemon/review/finish.js +1 -1
  475. package/dist/daemon/review/sweep.js +1 -1
  476. package/dist/daemon/run-notices.d.ts +4 -4
  477. package/dist/daemon/run-notices.js +1 -1
  478. package/dist/daemon/runs/append-section.d.ts +2 -2
  479. package/dist/daemon/runs/append-section.js +2 -2
  480. package/dist/daemon/runs/observer.d.ts +2 -2
  481. package/dist/daemon/runs/observer.js +2 -2
  482. package/dist/daemon/structured-requests/boot.d.ts +1 -1
  483. package/dist/daemon/structured-requests/boot.js +1 -1
  484. package/dist/daemon/structured-requests/effects.js +1 -1
  485. package/dist/daemon/structured-requests/sidecar.d.ts +1 -1
  486. package/dist/daemon/structured-requests/sidecar.js +1 -1
  487. package/dist/migrations/004-canvas-documents/apply.d.ts +3 -3
  488. package/dist/migrations/004-canvas-documents/apply.js +1 -1
  489. package/dist/migrations/004-canvas-documents/index.d.ts +2 -2
  490. package/dist/migrations/004-canvas-documents/index.js +2 -2
  491. package/dist/migrations/activation.js +2 -2
  492. package/docs/public-api.md +11 -0
  493. package/package.json +3 -2
  494. package/packages/crouter-identity/package.json +1 -1
  495. package/runtime.lock.json +12 -12
@@ -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>;