@north-light/cli 0.3.764 → 0.3.766

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 (969) hide show
  1. package/dist/api/contract.d.ts +1 -1
  2. package/dist/api/contract.js +1 -1
  3. package/dist/api/index.d.ts +0 -1
  4. package/dist/api/index.js +1 -1
  5. package/dist/builtin-memory/internal/nodes-and-canvas.md +7 -8
  6. package/dist/builtin-memory/internal/storage-tiers.md +5 -4
  7. package/dist/builtin-memory/northlight-apps/guides/test-your-app.md +1 -1
  8. package/dist/clients/attach/viewer.js +437 -437
  9. package/dist/commands/sys/signin.d.ts +2 -0
  10. package/dist/commands/sys/signin.js +4 -2
  11. package/dist/commands/sys.js +1 -1
  12. package/dist/core/canvas/db.js +4 -4
  13. package/dist/core/directory/issuer.d.ts +1 -1
  14. package/dist/core/grants/shadow.js +1 -1
  15. package/dist/core/graph/documents.js +1 -1
  16. package/dist/daemon/api/handlers/app-environments.d.ts +1 -0
  17. package/dist/daemon/api/handlers/app-environments.js +1 -1
  18. package/dist/daemon/api/handlers/environments.d.ts +1 -0
  19. package/dist/daemon/api/handlers/environments.js +1 -1
  20. package/dist/daemon/api/operations.js +1 -1
  21. package/dist/daemon/api/server.d.ts +1 -0
  22. package/dist/daemon/api/server.js +1 -1
  23. package/dist/daemon/cron/passes.d.ts +0 -2
  24. package/dist/daemon/cron-run.js +2 -2
  25. package/dist/daemon/crtrd-cli.js +1 -1
  26. package/dist/daemon/crtrd.d.ts +5 -5
  27. package/dist/daemon/crtrd.js +7 -19
  28. package/dist/daemon/due-sources.d.ts +1 -1
  29. package/dist/daemon/due-sources.js +1 -1
  30. package/dist/daemon/due.js +4 -4
  31. package/dist/daemon/machine-link/holder.js +5 -5
  32. package/dist/daemon/manage.d.ts +0 -12
  33. package/dist/daemon/manage.js +3 -3
  34. package/dist/daemon/postgres/index.d.ts +1 -1
  35. package/dist/daemon/postgres/index.js +1 -1
  36. package/dist/daemon/postgres/supervisor.d.ts +0 -62
  37. package/dist/daemon/postgres/supervisor.js +1 -2
  38. package/dist/daemon/reconcilers/broker-supervision.d.ts +0 -2
  39. package/dist/daemon/reconcilers/broker-supervision.js +1 -1
  40. package/dist/daemon/reconcilers/controller-death.d.ts +0 -2
  41. package/dist/daemon/reconcilers/controller-death.js +1 -1
  42. package/dist/daemon/reconcilers/cron-lane.d.ts +0 -1
  43. package/dist/daemon/reconcilers/cron-lane.js +1 -1
  44. package/dist/daemon/reconcilers/live-obligation.d.ts +1 -6
  45. package/dist/daemon/reconcilers/live-obligation.js +1 -1
  46. package/dist/daemon/reconcilers/node-deadline.d.ts +1 -2
  47. package/dist/daemon/reconcilers/node-deadline.js +1 -1
  48. package/dist/daemon/reconcilers/storage-maintenance.d.ts +0 -2
  49. package/dist/daemon/reconcilers/storage-maintenance.js +1 -1
  50. package/dist/daemon/reconcilers/structured-request-lane.d.ts +1 -2
  51. package/dist/daemon/reconcilers/structured-request-lane.js +1 -1
  52. package/docs/apps/guides/test-your-app.md +1 -1
  53. package/docs/ci-runner.md +3 -3
  54. package/package.json +3 -3
  55. package/packages/crouter-api/dist/api/contract.js +1 -1
  56. package/packages/crouter-api/dist/api/index.js +0 -1
  57. package/packages/crouter-api/dist/daemon/manage.js +0 -12
  58. package/packages/crouter-api/package.json +1 -1
  59. package/packages/crouter-identity/package.json +1 -1
  60. package/packages/crouter-plugin/package.json +3 -3
  61. package/runtime.lock.json +14 -14
  62. package/dist/api/dto/imports.d.ts +0 -156
  63. package/dist/api/dto/imports.js +0 -0
  64. package/dist/commands/sys/import/move.d.ts +0 -29
  65. package/dist/commands/sys/import/move.js +0 -6
  66. package/dist/commands/sys/import/resume.d.ts +0 -1
  67. package/dist/commands/sys/import/resume.js +0 -1
  68. package/dist/commands/sys/import/start.d.ts +0 -1
  69. package/dist/commands/sys/import/start.js +0 -1
  70. package/dist/core/canvas/daemon-owner.d.ts +0 -75
  71. package/dist/core/canvas/daemon-owner.js +0 -1
  72. package/dist/core/import/bundle/blob-keys.d.ts +0 -12
  73. package/dist/core/import/bundle/blob-keys.js +0 -1
  74. package/dist/core/import/bundle/layout.d.ts +0 -89
  75. package/dist/core/import/bundle/layout.js +0 -4
  76. package/dist/core/import/export/archive.d.ts +0 -11
  77. package/dist/core/import/export/archive.js +0 -1
  78. package/dist/core/import/export/cloud.d.ts +0 -41
  79. package/dist/core/import/export/cloud.js +0 -1
  80. package/dist/core/import/export/dump.d.ts +0 -34
  81. package/dist/core/import/export/dump.js +0 -4
  82. package/dist/core/import/export/files.d.ts +0 -23
  83. package/dist/core/import/export/files.js +0 -1
  84. package/dist/core/import/export/inline.d.ts +0 -3
  85. package/dist/core/import/export/inline.js +0 -1
  86. package/dist/core/import/export/source.d.ts +0 -2
  87. package/dist/core/import/export/source.js +0 -1
  88. package/dist/core/import/export/stores.d.ts +0 -9
  89. package/dist/core/import/export/stores.js +0 -4
  90. package/dist/core/import/load/bind.d.ts +0 -42
  91. package/dist/core/import/load/bind.js +0 -20
  92. package/dist/core/import/load/blobs.d.ts +0 -27
  93. package/dist/core/import/load/blobs.js +0 -1
  94. package/dist/core/import/load/catalog.d.ts +0 -39
  95. package/dist/core/import/load/catalog.js +0 -9
  96. package/dist/core/import/load/copy.d.ts +0 -29
  97. package/dist/core/import/load/copy.js +0 -11
  98. package/dist/core/import/load/keys.d.ts +0 -5
  99. package/dist/core/import/load/keys.js +0 -8
  100. package/dist/core/import/load/open-grants.d.ts +0 -1
  101. package/dist/core/import/load/open-grants.js +0 -1
  102. package/dist/core/import/load/path-map.d.ts +0 -7
  103. package/dist/core/import/load/path-map.js +0 -1
  104. package/dist/core/import/load/prepare.d.ts +0 -70
  105. package/dist/core/import/load/prepare.js +0 -14
  106. package/dist/core/import/load/publish-plugins.d.ts +0 -10
  107. package/dist/core/import/load/publish-plugins.js +0 -1
  108. package/dist/core/import/load/rewrite.d.ts +0 -54
  109. package/dist/core/import/load/rewrite.js +0 -15
  110. package/dist/core/import/load/rollback.d.ts +0 -3
  111. package/dist/core/import/load/rollback.js +0 -7
  112. package/dist/core/import/load/run.d.ts +0 -26
  113. package/dist/core/import/load/run.js +0 -2
  114. package/dist/core/import/load/stage.d.ts +0 -15
  115. package/dist/core/import/load/stage.js +0 -1
  116. package/dist/core/import/load/stores.d.ts +0 -32
  117. package/dist/core/import/load/stores.js +0 -2
  118. package/dist/core/import/load/verify.d.ts +0 -4
  119. package/dist/core/import/load/verify.js +0 -13
  120. package/dist/daemon/api/handlers/imports.d.ts +0 -2
  121. package/dist/daemon/api/handlers/imports.js +0 -1
  122. package/dist/daemon/api/handlers/machine-credential.d.ts +0 -2
  123. package/dist/daemon/api/handlers/machine-credential.js +0 -1
  124. package/dist/daemon/api/import-auth.d.ts +0 -6
  125. package/dist/daemon/api/import-auth.js +0 -1
  126. package/dist/daemon/import-dump-run.d.ts +0 -1
  127. package/dist/daemon/import-dump-run.js +0 -5
  128. package/dist/daemon/reconcilers/import-lane.d.ts +0 -17
  129. package/dist/daemon/reconcilers/import-lane.js +0 -1
  130. package/packages/crouter-api/dist/api/dto/imports.js +0 -2
  131. package/packages/crouter-api/dist/build-root.js +0 -402
  132. package/packages/crouter-api/dist/clients/attach/ansi-cells.js +0 -137
  133. package/packages/crouter-api/dist/clients/attach/chrome/bash-jobs.js +0 -34
  134. package/packages/crouter-api/dist/clients/attach/chrome/canvas-panels.js +0 -285
  135. package/packages/crouter-api/dist/clients/attach/chrome/completion-bell.js +0 -89
  136. package/packages/crouter-api/dist/clients/attach/chrome/cron-wait.js +0 -34
  137. package/packages/crouter-api/dist/clients/attach/chrome/header.js +0 -30
  138. package/packages/crouter-api/dist/clients/attach/chrome/inbox-strip.js +0 -221
  139. package/packages/crouter-api/dist/clients/attach/chrome/key-hint.js +0 -16
  140. package/packages/crouter-api/dist/clients/attach/chrome/object-wait.js +0 -24
  141. package/packages/crouter-api/dist/clients/attach/chrome/recap.js +0 -19
  142. package/packages/crouter-api/dist/clients/attach/chrome/review-wait.js +0 -22
  143. package/packages/crouter-api/dist/clients/attach/chrome/roster.js +0 -283
  144. package/packages/crouter-api/dist/clients/attach/chrome/run-facts.js +0 -76
  145. package/packages/crouter-api/dist/clients/attach/chrome/status-line.js +0 -122
  146. package/packages/crouter-api/dist/clients/attach/chrome/ticket-panel.js +0 -261
  147. package/packages/crouter-api/dist/clients/attach/chrome/widgets.js +0 -60
  148. package/packages/crouter-api/dist/clients/attach/command.js +0 -107
  149. package/packages/crouter-api/dist/clients/attach/config.js +0 -280
  150. package/packages/crouter-api/dist/clients/attach/input/capabilities.js +0 -114
  151. package/packages/crouter-api/dist/clients/attach/input/clipboard-image.js +0 -237
  152. package/packages/crouter-api/dist/clients/attach/input/completion-frecency.js +0 -141
  153. package/packages/crouter-api/dist/clients/attach/input/controller.js +0 -432
  154. package/packages/crouter-api/dist/clients/attach/input/local-files.js +0 -113
  155. package/packages/crouter-api/dist/clients/attach/input/overlay-owner.js +0 -192
  156. package/packages/crouter-api/dist/clients/attach/input/ref-autocomplete.js +0 -176
  157. package/packages/crouter-api/dist/clients/attach/input/titled-editor.js +0 -859
  158. package/packages/crouter-api/dist/clients/attach/overlays/auth.js +0 -247
  159. package/packages/crouter-api/dist/clients/attach/overlays/dialogs.js +0 -102
  160. package/packages/crouter-api/dist/clients/attach/overlays/graph.js +0 -743
  161. package/packages/crouter-api/dist/clients/attach/overlays/help.js +0 -214
  162. package/packages/crouter-api/dist/clients/attach/overlays/mcp.js +0 -302
  163. package/packages/crouter-api/dist/clients/attach/overlays/pickers.js +0 -163
  164. package/packages/crouter-api/dist/clients/attach/render/activity-slot.js +0 -13
  165. package/packages/crouter-api/dist/clients/attach/render/assistant-message.js +0 -56
  166. package/packages/crouter-api/dist/clients/attach/render/card-presentation.js +0 -232
  167. package/packages/crouter-api/dist/clients/attach/render/chat-view.js +0 -1956
  168. package/packages/crouter-api/dist/clients/attach/render/context-message.js +0 -63
  169. package/packages/crouter-api/dist/clients/attach/render/crtr-output.js +0 -721
  170. package/packages/crouter-api/dist/clients/attach/render/diagram.js +0 -111
  171. package/packages/crouter-api/dist/clients/attach/render/doc-links.js +0 -78
  172. package/packages/crouter-api/dist/clients/attach/render/edit-diff.js +0 -304
  173. package/packages/crouter-api/dist/clients/attach/render/glyph-codepoints.js +0 -42
  174. package/packages/crouter-api/dist/clients/attach/render/group-activity.js +0 -276
  175. package/packages/crouter-api/dist/clients/attach/render/group-recap.js +0 -146
  176. package/packages/crouter-api/dist/clients/attach/render/markdown-source.js +0 -279
  177. package/packages/crouter-api/dist/clients/attach/render/measured-container.js +0 -322
  178. package/packages/crouter-api/dist/clients/attach/render/page-block.js +0 -187
  179. package/packages/crouter-api/dist/clients/attach/render/scroll-animation.js +0 -80
  180. package/packages/crouter-api/dist/clients/attach/render/tool-calls.js +0 -350
  181. package/packages/crouter-api/dist/clients/attach/render/transcript-copy.js +0 -81
  182. package/packages/crouter-api/dist/clients/attach/render/transcript-search.js +0 -152
  183. package/packages/crouter-api/dist/clients/attach/render/viewport.js +0 -184
  184. package/packages/crouter-api/dist/clients/attach/session/banner.js +0 -33
  185. package/packages/crouter-api/dist/clients/attach/session/bindings.js +0 -72
  186. package/packages/crouter-api/dist/clients/attach/session/chrome-refresh.js +0 -169
  187. package/packages/crouter-api/dist/clients/attach/session/connection.js +0 -185
  188. package/packages/crouter-api/dist/clients/attach/session/context.js +0 -16
  189. package/packages/crouter-api/dist/clients/attach/session/document-links.js +0 -48
  190. package/packages/crouter-api/dist/clients/attach/session/editor-frame.js +0 -161
  191. package/packages/crouter-api/dist/clients/attach/session/editor-inventory.js +0 -156
  192. package/packages/crouter-api/dist/clients/attach/session/file-links.js +0 -73
  193. package/packages/crouter-api/dist/clients/attach/session/focus-events.js +0 -12
  194. package/packages/crouter-api/dist/clients/attach/session/frame.js +0 -214
  195. package/packages/crouter-api/dist/clients/attach/session/frames.js +0 -203
  196. package/packages/crouter-api/dist/clients/attach/session/identity.js +0 -27
  197. package/packages/crouter-api/dist/clients/attach/session/input-wiring.js +0 -153
  198. package/packages/crouter-api/dist/clients/attach/session/invariant.js +0 -15
  199. package/packages/crouter-api/dist/clients/attach/session/keys.js +0 -84
  200. package/packages/crouter-api/dist/clients/attach/session/layout-record.js +0 -52
  201. package/packages/crouter-api/dist/clients/attach/session/layout.js +0 -59
  202. package/packages/crouter-api/dist/clients/attach/session/mouse.js +0 -78
  203. package/packages/crouter-api/dist/clients/attach/session/pane-focus.js +0 -42
  204. package/packages/crouter-api/dist/clients/attach/session/pane-tag.js +0 -118
  205. package/packages/crouter-api/dist/clients/attach/session/pi-assets.js +0 -24
  206. package/packages/crouter-api/dist/clients/attach/session/pi-oauth-flows.js +0 -21
  207. package/packages/crouter-api/dist/clients/attach/session/profile-files.js +0 -208
  208. package/packages/crouter-api/dist/clients/attach/session/readonly-popup.js +0 -25
  209. package/packages/crouter-api/dist/clients/attach/session/reconnect.js +0 -237
  210. package/packages/crouter-api/dist/clients/attach/session/selection.js +0 -108
  211. package/packages/crouter-api/dist/clients/attach/session/state-sync.js +0 -67
  212. package/packages/crouter-api/dist/clients/attach/session/surface-frame.js +0 -73
  213. package/packages/crouter-api/dist/clients/attach/session/surface-host.js +0 -239
  214. package/packages/crouter-api/dist/clients/attach/session/teardown.js +0 -102
  215. package/packages/crouter-api/dist/clients/attach/session/transcript-search.js +0 -151
  216. package/packages/crouter-api/dist/clients/attach/session/whip-achievements.js +0 -145
  217. package/packages/crouter-api/dist/clients/attach/session/whip.js +0 -362
  218. package/packages/crouter-api/dist/clients/attach/slash/dispatch.js +0 -759
  219. package/packages/crouter-api/dist/clients/attach/slash/prompt-preview.js +0 -121
  220. package/packages/crouter-api/dist/clients/attach/slash/recover.js +0 -133
  221. package/packages/crouter-api/dist/clients/attach/viewer.js +0 -1026
  222. package/packages/crouter-api/dist/clients/conversation/projection.js +0 -324
  223. package/packages/crouter-api/dist/clients/conversation/submit.js +0 -51
  224. package/packages/crouter-api/dist/clients/dashboard/app.js +0 -439
  225. package/packages/crouter-api/dist/clients/dashboard/model.js +0 -77
  226. package/packages/crouter-api/dist/clients/dashboard/render.js +0 -148
  227. package/packages/crouter-api/dist/clients/editor-roundtrip.js +0 -41
  228. package/packages/crouter-api/dist/clients/inbox/controller.js +0 -772
  229. package/packages/crouter-api/dist/clients/inbox/dto-adapt.js +0 -94
  230. package/packages/crouter-api/dist/clients/inbox/layout.js +0 -9
  231. package/packages/crouter-api/dist/clients/inbox/page-adapter.js +0 -56
  232. package/packages/crouter-api/dist/clients/inbox/resolve.js +0 -35
  233. package/packages/crouter-api/dist/clients/inbox/surface.js +0 -190
  234. package/packages/crouter-api/dist/clients/inbox/tui/ansi.js +0 -321
  235. package/packages/crouter-api/dist/clients/inbox/tui/input.js +0 -392
  236. package/packages/crouter-api/dist/clients/inbox/tui/keys.js +0 -104
  237. package/packages/crouter-api/dist/clients/inbox/tui/page-body.js +0 -62
  238. package/packages/crouter-api/dist/clients/inbox/tui/panel.js +0 -92
  239. package/packages/crouter-api/dist/clients/inbox/tui/render.js +0 -382
  240. package/packages/crouter-api/dist/clients/inbox/tui/slots.js +0 -134
  241. package/packages/crouter-api/dist/clients/inbox/tui/types.js +0 -1
  242. package/packages/crouter-api/dist/clients/inbox/tui.js +0 -91
  243. package/packages/crouter-api/dist/clients/open-browser.js +0 -6
  244. package/packages/crouter-api/dist/clients/surfaces/host.js +0 -1
  245. package/packages/crouter-api/dist/commands/api-client.js +0 -432
  246. package/packages/crouter-api/dist/commands/attention.js +0 -215
  247. package/packages/crouter-api/dist/commands/canvas/edges.js +0 -41
  248. package/packages/crouter-api/dist/commands/canvas/list.js +0 -81
  249. package/packages/crouter-api/dist/commands/canvas/read.js +0 -97
  250. package/packages/crouter-api/dist/commands/canvas/search.js +0 -51
  251. package/packages/crouter-api/dist/commands/canvas/share.js +0 -80
  252. package/packages/crouter-api/dist/commands/canvas/unwatch.js +0 -42
  253. package/packages/crouter-api/dist/commands/canvas/watch.js +0 -63
  254. package/packages/crouter-api/dist/commands/canvas-analytics/chart.js +0 -124
  255. package/packages/crouter-api/dist/commands/canvas-analytics/drilldown.js +0 -96
  256. package/packages/crouter-api/dist/commands/canvas-analytics/format.js +0 -106
  257. package/packages/crouter-api/dist/commands/canvas-analytics/graph-detail.js +0 -307
  258. package/packages/crouter-api/dist/commands/canvas-analytics/graphs.js +0 -365
  259. package/packages/crouter-api/dist/commands/canvas-analytics/memory.js +0 -211
  260. package/packages/crouter-api/dist/commands/canvas-analytics/overview.js +0 -189
  261. package/packages/crouter-api/dist/commands/canvas-analytics/shell.js +0 -416
  262. package/packages/crouter-api/dist/commands/canvas-analytics/time.js +0 -228
  263. package/packages/crouter-api/dist/commands/canvas-analytics/usage.js +0 -305
  264. package/packages/crouter-api/dist/commands/canvas-analytics/view.js +0 -102
  265. package/packages/crouter-api/dist/commands/canvas-analytics.js +0 -28
  266. package/packages/crouter-api/dist/commands/canvas-browse.js +0 -71
  267. package/packages/crouter-api/dist/commands/canvas-config.js +0 -192
  268. package/packages/crouter-api/dist/commands/canvas-history/grep.js +0 -85
  269. package/packages/crouter-api/dist/commands/canvas-history/read.js +0 -48
  270. package/packages/crouter-api/dist/commands/canvas-history/search.js +0 -99
  271. package/packages/crouter-api/dist/commands/canvas-history/shared.js +0 -135
  272. package/packages/crouter-api/dist/commands/canvas-history/stats.js +0 -68
  273. package/packages/crouter-api/dist/commands/canvas-history.js +0 -29
  274. package/packages/crouter-api/dist/commands/canvas-issue.js +0 -148
  275. package/packages/crouter-api/dist/commands/canvas-prune.js +0 -111
  276. package/packages/crouter-api/dist/commands/canvas-roster.js +0 -69
  277. package/packages/crouter-api/dist/commands/canvas-snapshot.js +0 -34
  278. package/packages/crouter-api/dist/commands/canvas-use.js +0 -61
  279. package/packages/crouter-api/dist/commands/canvas.js +0 -57
  280. package/packages/crouter-api/dist/commands/chord.js +0 -242
  281. package/packages/crouter-api/dist/commands/cron.js +0 -541
  282. package/packages/crouter-api/dist/commands/custom-object/ack.js +0 -30
  283. package/packages/crouter-api/dist/commands/custom-object/publish.js +0 -39
  284. package/packages/crouter-api/dist/commands/custom-object/receive.js +0 -69
  285. package/packages/crouter-api/dist/commands/custom-object/register.js +0 -69
  286. package/packages/crouter-api/dist/commands/custom-object/shared.js +0 -14
  287. package/packages/crouter-api/dist/commands/custom-object/unregister.js +0 -26
  288. package/packages/crouter-api/dist/commands/custom-object.js +0 -21
  289. package/packages/crouter-api/dist/commands/dashboard.js +0 -86
  290. package/packages/crouter-api/dist/commands/doc/delete.js +0 -30
  291. package/packages/crouter-api/dist/commands/doc/edit.js +0 -83
  292. package/packages/crouter-api/dist/commands/doc/history.js +0 -38
  293. package/packages/crouter-api/dist/commands/doc/lint.js +0 -36
  294. package/packages/crouter-api/dist/commands/doc/list.js +0 -19
  295. package/packages/crouter-api/dist/commands/doc/move.js +0 -37
  296. package/packages/crouter-api/dist/commands/doc/read.js +0 -19
  297. package/packages/crouter-api/dist/commands/doc/replace-blocks.js +0 -40
  298. package/packages/crouter-api/dist/commands/doc/shared.js +0 -156
  299. package/packages/crouter-api/dist/commands/doc/write.js +0 -53
  300. package/packages/crouter-api/dist/commands/doc.js +0 -27
  301. package/packages/crouter-api/dist/commands/human/components.js +0 -78
  302. package/packages/crouter-api/dist/commands/human/feedback.js +0 -112
  303. package/packages/crouter-api/dist/commands/human/prompts.js +0 -319
  304. package/packages/crouter-api/dist/commands/human/queue.js +0 -191
  305. package/packages/crouter-api/dist/commands/human/request.js +0 -269
  306. package/packages/crouter-api/dist/commands/human/review.js +0 -287
  307. package/packages/crouter-api/dist/commands/human/shared.js +0 -67
  308. package/packages/crouter-api/dist/commands/human.js +0 -63
  309. package/packages/crouter-api/dist/commands/node/bash.js +0 -398
  310. package/packages/crouter-api/dist/commands/node/create.js +0 -363
  311. package/packages/crouter-api/dist/commands/node/inspect.js +0 -305
  312. package/packages/crouter-api/dist/commands/node/lifecycle.js +0 -577
  313. package/packages/crouter-api/dist/commands/node/message.js +0 -170
  314. package/packages/crouter-api/dist/commands/node/outcome.js +0 -133
  315. package/packages/crouter-api/dist/commands/node/pyramid.js +0 -79
  316. package/packages/crouter-api/dist/commands/node/subscription.js +0 -78
  317. package/packages/crouter-api/dist/commands/node/wait.js +0 -157
  318. package/packages/crouter-api/dist/commands/node-context.js +0 -145
  319. package/packages/crouter-api/dist/commands/node-lifecycle-revive.js +0 -222
  320. package/packages/crouter-api/dist/commands/node-snapshot.js +0 -37
  321. package/packages/crouter-api/dist/commands/node-transcript.js +0 -59
  322. package/packages/crouter-api/dist/commands/node-worktree.js +0 -134
  323. package/packages/crouter-api/dist/commands/node.js +0 -29
  324. package/packages/crouter-api/dist/commands/person-settings.js +0 -30
  325. package/packages/crouter-api/dist/commands/pkg/app-installs.js +0 -125
  326. package/packages/crouter-api/dist/commands/pkg/browse/actions.js +0 -198
  327. package/packages/crouter-api/dist/commands/pkg/browse/catalog.js +0 -461
  328. package/packages/crouter-api/dist/commands/pkg/browse/command-view.js +0 -217
  329. package/packages/crouter-api/dist/commands/pkg/browse/detail-panel.js +0 -402
  330. package/packages/crouter-api/dist/commands/pkg/browse/doc-view.js +0 -84
  331. package/packages/crouter-api/dist/commands/pkg/browse/list-panel.js +0 -168
  332. package/packages/crouter-api/dist/commands/pkg/browse/model.js +0 -36
  333. package/packages/crouter-api/dist/commands/pkg/browse/shell.js +0 -640
  334. package/packages/crouter-api/dist/commands/pkg/browse.js +0 -27
  335. package/packages/crouter-api/dist/commands/pkg/market-inspect.js +0 -145
  336. package/packages/crouter-api/dist/commands/pkg/market-manage.js +0 -343
  337. package/packages/crouter-api/dist/commands/pkg/market.js +0 -14
  338. package/packages/crouter-api/dist/commands/pkg/plugin-env.js +0 -65
  339. package/packages/crouter-api/dist/commands/pkg/plugin-inspect.js +0 -178
  340. package/packages/crouter-api/dist/commands/pkg/plugin-manage.js +0 -1040
  341. package/packages/crouter-api/dist/commands/pkg/plugin.js +0 -14
  342. package/packages/crouter-api/dist/commands/pkg/shared.js +0 -62
  343. package/packages/crouter-api/dist/commands/pkg.js +0 -21
  344. package/packages/crouter-api/dist/commands/profile/daemon-profiles.js +0 -38
  345. package/packages/crouter-api/dist/commands/profile/default.js +0 -183
  346. package/packages/crouter-api/dist/commands/profile/delete.js +0 -66
  347. package/packages/crouter-api/dist/commands/profile/env.js +0 -188
  348. package/packages/crouter-api/dist/commands/profile/environment.js +0 -111
  349. package/packages/crouter-api/dist/commands/profile/kind.js +0 -27
  350. package/packages/crouter-api/dist/commands/profile/list.js +0 -45
  351. package/packages/crouter-api/dist/commands/profile/meta.js +0 -65
  352. package/packages/crouter-api/dist/commands/profile/new.js +0 -107
  353. package/packages/crouter-api/dist/commands/profile/pause.js +0 -59
  354. package/packages/crouter-api/dist/commands/profile/project.js +0 -147
  355. package/packages/crouter-api/dist/commands/profile/rename.js +0 -41
  356. package/packages/crouter-api/dist/commands/profile/show.js +0 -55
  357. package/packages/crouter-api/dist/commands/profile.js +0 -36
  358. package/packages/crouter-api/dist/commands/push.js +0 -357
  359. package/packages/crouter-api/dist/commands/revive.js +0 -183
  360. package/packages/crouter-api/dist/commands/surface/node/cycle.js +0 -83
  361. package/packages/crouter-api/dist/commands/surface/node/focus.js +0 -60
  362. package/packages/crouter-api/dist/commands/surface/node/id.js +0 -38
  363. package/packages/crouter-api/dist/commands/surface/node/pin.js +0 -42
  364. package/packages/crouter-api/dist/commands/surface/node/placement.js +0 -49
  365. package/packages/crouter-api/dist/commands/surface-dashboard.js +0 -138
  366. package/packages/crouter-api/dist/commands/surface-edit.js +0 -157
  367. package/packages/crouter-api/dist/commands/surface-inbox.js +0 -98
  368. package/packages/crouter-api/dist/commands/surface-inspect.js +0 -41
  369. package/packages/crouter-api/dist/commands/surface-node.js +0 -19
  370. package/packages/crouter-api/dist/commands/surface-tmux-spread.js +0 -214
  371. package/packages/crouter-api/dist/commands/surface.js +0 -28
  372. package/packages/crouter-api/dist/commands/sys/branch.js +0 -19
  373. package/packages/crouter-api/dist/commands/sys/config.js +0 -353
  374. package/packages/crouter-api/dist/commands/sys/context/admin/actions.js +0 -89
  375. package/packages/crouter-api/dist/commands/sys/context/admin/detail-panel.js +0 -233
  376. package/packages/crouter-api/dist/commands/sys/context/admin/docs-panel.js +0 -185
  377. package/packages/crouter-api/dist/commands/sys/context/admin/list-view.js +0 -170
  378. package/packages/crouter-api/dist/commands/sys/context/admin/model.js +0 -179
  379. package/packages/crouter-api/dist/commands/sys/context/admin/rail-panel.js +0 -229
  380. package/packages/crouter-api/dist/commands/sys/context/admin/read-view.js +0 -172
  381. package/packages/crouter-api/dist/commands/sys/context/admin/shell.js +0 -870
  382. package/packages/crouter-api/dist/commands/sys/context/admin.js +0 -148
  383. package/packages/crouter-api/dist/commands/sys/context/doc.js +0 -126
  384. package/packages/crouter-api/dist/commands/sys/context/expose.js +0 -66
  385. package/packages/crouter-api/dist/commands/sys/context/prompt-review.js +0 -244
  386. package/packages/crouter-api/dist/commands/sys/context/resolve.js +0 -326
  387. package/packages/crouter-api/dist/commands/sys/context/sysprompt.js +0 -95
  388. package/packages/crouter-api/dist/commands/sys/context.js +0 -21
  389. package/packages/crouter-api/dist/commands/sys/daemon.js +0 -354
  390. package/packages/crouter-api/dist/commands/sys/desktop.js +0 -201
  391. package/packages/crouter-api/dist/commands/sys/doctor.js +0 -650
  392. package/packages/crouter-api/dist/commands/sys/env.js +0 -39
  393. package/packages/crouter-api/dist/commands/sys/feedback.js +0 -238
  394. package/packages/crouter-api/dist/commands/sys/import/move.js +0 -205
  395. package/packages/crouter-api/dist/commands/sys/import/resume.js +0 -23
  396. package/packages/crouter-api/dist/commands/sys/import/start.js +0 -57
  397. package/packages/crouter-api/dist/commands/sys/join.js +0 -53
  398. package/packages/crouter-api/dist/commands/sys/limits.js +0 -133
  399. package/packages/crouter-api/dist/commands/sys/logs.js +0 -129
  400. package/packages/crouter-api/dist/commands/sys/machine/rotate.js +0 -49
  401. package/packages/crouter-api/dist/commands/sys/panels/broker-limits-panel.js +0 -110
  402. package/packages/crouter-api/dist/commands/sys/panels/dependencies-panel.js +0 -80
  403. package/packages/crouter-api/dist/commands/sys/panels/keybindings-panel.js +0 -703
  404. package/packages/crouter-api/dist/commands/sys/panels/models-panel.js +0 -1160
  405. package/packages/crouter-api/dist/commands/sys/panels/plugin-env-panel.js +0 -70
  406. package/packages/crouter-api/dist/commands/sys/panels/plugins-panel.js +0 -87
  407. package/packages/crouter-api/dist/commands/sys/panels/prefs-panel.js +0 -97
  408. package/packages/crouter-api/dist/commands/sys/panels/profiles-panel.js +0 -656
  409. package/packages/crouter-api/dist/commands/sys/panels/provider-panel.js +0 -534
  410. package/packages/crouter-api/dist/commands/sys/panels/terminal-panel.js +0 -67
  411. package/packages/crouter-api/dist/commands/sys/provider-login.js +0 -99
  412. package/packages/crouter-api/dist/commands/sys/retry-delivery.js +0 -33
  413. package/packages/crouter-api/dist/commands/sys/settings-shell.js +0 -400
  414. package/packages/crouter-api/dist/commands/sys/settings.js +0 -46
  415. package/packages/crouter-api/dist/commands/sys/setup-core.js +0 -882
  416. package/packages/crouter-api/dist/commands/sys/setup-settings-runner.js +0 -15
  417. package/packages/crouter-api/dist/commands/sys/setup-wizard.js +0 -351
  418. package/packages/crouter-api/dist/commands/sys/setup.js +0 -41
  419. package/packages/crouter-api/dist/commands/sys/shared.js +0 -81
  420. package/packages/crouter-api/dist/commands/sys/signin.js +0 -169
  421. package/packages/crouter-api/dist/commands/sys/spaces.js +0 -22
  422. package/packages/crouter-api/dist/commands/sys/spend.js +0 -144
  423. package/packages/crouter-api/dist/commands/sys/support/prepare.js +0 -239
  424. package/packages/crouter-api/dist/commands/sys/support/submit.js +0 -524
  425. package/packages/crouter-api/dist/commands/sys/support.js +0 -18
  426. package/packages/crouter-api/dist/commands/sys/sync-deps.js +0 -445
  427. package/packages/crouter-api/dist/commands/sys/sync-project-guidance.js +0 -320
  428. package/packages/crouter-api/dist/commands/sys/sync-shared.js +0 -139
  429. package/packages/crouter-api/dist/commands/sys/sync-skills.js +0 -297
  430. package/packages/crouter-api/dist/commands/sys/sync.js +0 -17
  431. package/packages/crouter-api/dist/commands/sys/terminal-option.js +0 -542
  432. package/packages/crouter-api/dist/commands/sys/tutorial/branch.js +0 -15
  433. package/packages/crouter-api/dist/commands/sys/tutorial/lessons.js +0 -107
  434. package/packages/crouter-api/dist/commands/sys/tutorial/scenario.js +0 -432
  435. package/packages/crouter-api/dist/commands/sys/tutorial/tracks.js +0 -96
  436. package/packages/crouter-api/dist/commands/sys/update.js +0 -158
  437. package/packages/crouter-api/dist/commands/sys/worktrees.js +0 -53
  438. package/packages/crouter-api/dist/commands/sys.js +0 -28
  439. package/packages/crouter-api/dist/core/activity-signal.js +0 -38
  440. package/packages/crouter-api/dist/core/async-array.js +0 -48
  441. package/packages/crouter-api/dist/core/auth-file.js +0 -89
  442. package/packages/crouter-api/dist/core/auth-interaction.js +0 -94
  443. package/packages/crouter-api/dist/core/bash-guard.js +0 -527
  444. package/packages/crouter-api/dist/core/bash-job-supervisor.js +0 -170
  445. package/packages/crouter-api/dist/core/bash-jobs.js +0 -460
  446. package/packages/crouter-api/dist/core/blobs/directory.js +0 -264
  447. package/packages/crouter-api/dist/core/blobs/fault.js +0 -6
  448. package/packages/crouter-api/dist/core/blobs/index.js +0 -30
  449. package/packages/crouter-api/dist/core/blobs/r2.js +0 -169
  450. package/packages/crouter-api/dist/core/broker-client/client.js +0 -186
  451. package/packages/crouter-api/dist/core/broker-client/index.js +0 -14
  452. package/packages/crouter-api/dist/core/broker-client/transport-relay.js +0 -256
  453. package/packages/crouter-api/dist/core/broker-client/transport-socket.js +0 -187
  454. package/packages/crouter-api/dist/core/broker-client/transport.js +0 -40
  455. package/packages/crouter-api/dist/core/canvas/app-run.js +0 -4
  456. package/packages/crouter-api/dist/core/canvas/attention.js +0 -47
  457. package/packages/crouter-api/dist/core/canvas/browse/app.js +0 -1050
  458. package/packages/crouter-api/dist/core/canvas/browse/model.js +0 -477
  459. package/packages/crouter-api/dist/core/canvas/browse/pins.js +0 -29
  460. package/packages/crouter-api/dist/core/canvas/browse/render.js +0 -1058
  461. package/packages/crouter-api/dist/core/canvas/canvas.js +0 -1260
  462. package/packages/crouter-api/dist/core/canvas/crons.js +0 -557
  463. package/packages/crouter-api/dist/core/canvas/daemon-actions.js +0 -99
  464. package/packages/crouter-api/dist/core/canvas/db.js +0 -442
  465. package/packages/crouter-api/dist/core/canvas/deliveries.js +0 -402
  466. package/packages/crouter-api/dist/core/canvas/delivery-contract.js +0 -30
  467. package/packages/crouter-api/dist/core/canvas/executions.js +0 -270
  468. package/packages/crouter-api/dist/core/canvas/extensions.js +0 -90
  469. package/packages/crouter-api/dist/core/canvas/focuses.js +0 -82
  470. package/packages/crouter-api/dist/core/canvas/history.js +0 -480
  471. package/packages/crouter-api/dist/core/canvas/index.js +0 -16
  472. package/packages/crouter-api/dist/core/canvas/install-id.js +0 -64
  473. package/packages/crouter-api/dist/core/canvas/labels.js +0 -43
  474. package/packages/crouter-api/dist/core/canvas/legacy-person.js +0 -4
  475. package/packages/crouter-api/dist/core/canvas/memory-reads.js +0 -37
  476. package/packages/crouter-api/dist/core/canvas/meta-file.js +0 -89
  477. package/packages/crouter-api/dist/core/canvas/nav-render.js +0 -224
  478. package/packages/crouter-api/dist/core/canvas/node-agent-paths.js +0 -30
  479. package/packages/crouter-api/dist/core/canvas/node-order.js +0 -37
  480. package/packages/crouter-api/dist/core/canvas/node-recap.js +0 -62
  481. package/packages/crouter-api/dist/core/canvas/node-tokens.js +0 -53
  482. package/packages/crouter-api/dist/core/canvas/outcome-actions.js +0 -71
  483. package/packages/crouter-api/dist/core/canvas/person.js +0 -239
  484. package/packages/crouter-api/dist/core/canvas/reconciler-leases.js +0 -44
  485. package/packages/crouter-api/dist/core/canvas/recovery.js +0 -715
  486. package/packages/crouter-api/dist/core/canvas/remote-canvas-source.js +0 -290
  487. package/packages/crouter-api/dist/core/canvas/remote-transport.js +0 -57
  488. package/packages/crouter-api/dist/core/canvas/render-source.js +0 -518
  489. package/packages/crouter-api/dist/core/canvas/schema-chain.js +0 -110
  490. package/packages/crouter-api/dist/core/canvas/schema-version.js +0 -58
  491. package/packages/crouter-api/dist/core/canvas/sessions.js +0 -128
  492. package/packages/crouter-api/dist/core/canvas/source.js +0 -57
  493. package/packages/crouter-api/dist/core/canvas/status-glyph.js +0 -147
  494. package/packages/crouter-api/dist/core/canvas/structured-requests.js +0 -176
  495. package/packages/crouter-api/dist/core/canvas/telemetry.js +0 -35
  496. package/packages/crouter-api/dist/core/canvas/tree.js +0 -150
  497. package/packages/crouter-api/dist/core/canvas/types.js +0 -6
  498. package/packages/crouter-api/dist/core/canvas/waits.js +0 -113
  499. package/packages/crouter-api/dist/core/canvas/worktrees.js +0 -97
  500. package/packages/crouter-api/dist/core/checkout-identities.js +0 -107
  501. package/packages/crouter-api/dist/core/clipboard-text.js +0 -57
  502. package/packages/crouter-api/dist/core/command-hooks/artifact.js +0 -145
  503. package/packages/crouter-api/dist/core/command-hooks/catalog.js +0 -38
  504. package/packages/crouter-api/dist/core/command-hooks/compose.js +0 -101
  505. package/packages/crouter-api/dist/core/command-hooks/discovery.js +0 -246
  506. package/packages/crouter-api/dist/core/command-hooks/help.js +0 -18
  507. package/packages/crouter-api/dist/core/command-hooks/lifecycle-catalog.js +0 -9
  508. package/packages/crouter-api/dist/core/command-hooks/lifecycle-create.js +0 -51
  509. package/packages/crouter-api/dist/core/command-hooks/report.js +0 -28
  510. package/packages/crouter-api/dist/core/command-hooks/schema.js +0 -157
  511. package/packages/crouter-api/dist/core/command-hooks/transport/exec-invoke.js +0 -315
  512. package/packages/crouter-api/dist/core/command-hooks/transport/exec-lifecycle.js +0 -248
  513. package/packages/crouter-api/dist/core/command-hooks/transport/plan.js +0 -30
  514. package/packages/crouter-api/dist/core/command-manifests/registry.js +0 -118
  515. package/packages/crouter-api/dist/core/command-plugins/caller-header.js +0 -15
  516. package/packages/crouter-api/dist/core/command-plugins/compose.js +0 -263
  517. package/packages/crouter-api/dist/core/command-plugins/discovery.js +0 -240
  518. package/packages/crouter-api/dist/core/command-plugins/extensions.js +0 -166
  519. package/packages/crouter-api/dist/core/command-plugins/help-addenda.js +0 -55
  520. package/packages/crouter-api/dist/core/command-plugins/presence.js +0 -36
  521. package/packages/crouter-api/dist/core/command-plugins/transport/exec-invoke.js +0 -138
  522. package/packages/crouter-api/dist/core/command-plugins/transport/http-fetch.js +0 -68
  523. package/packages/crouter-api/dist/core/command-plugins/transport/http-invoke.js +0 -333
  524. package/packages/crouter-api/dist/core/command-plugins/transport/http-plan.js +0 -349
  525. package/packages/crouter-api/dist/core/command-plugins/transport/sign.js +0 -115
  526. package/packages/crouter-api/dist/core/command.js +0 -896
  527. package/packages/crouter-api/dist/core/conversation-store/row-store.js +0 -420
  528. package/packages/crouter-api/dist/core/directory/issuer.js +0 -15
  529. package/packages/crouter-api/dist/core/directory/person-credential.js +0 -237
  530. package/packages/crouter-api/dist/core/directory/reach.js +0 -19
  531. package/packages/crouter-api/dist/core/document-lines.js +0 -6
  532. package/packages/crouter-api/dist/core/editor-resolver.js +0 -77
  533. package/packages/crouter-api/dist/core/environment-recipe.js +0 -62
  534. package/packages/crouter-api/dist/core/environment-starter-script.js +0 -64
  535. package/packages/crouter-api/dist/core/environments.js +0 -24
  536. package/packages/crouter-api/dist/core/events/outbound.js +0 -92
  537. package/packages/crouter-api/dist/core/events/read.js +0 -625
  538. package/packages/crouter-api/dist/core/fault-classifier.js +0 -101
  539. package/packages/crouter-api/dist/core/feed/feed.js +0 -190
  540. package/packages/crouter-api/dist/core/feed/inbox.js +0 -93
  541. package/packages/crouter-api/dist/core/feed/messages.js +0 -234
  542. package/packages/crouter-api/dist/core/feed/reports.js +0 -58
  543. package/packages/crouter-api/dist/core/frontmatter.js +0 -35
  544. package/packages/crouter-api/dist/core/git.js +0 -103
  545. package/packages/crouter-api/dist/core/grants/cover.js +0 -66
  546. package/packages/crouter-api/dist/core/grants/hosted-endpoint.js +0 -70
  547. package/packages/crouter-api/dist/core/grants/local.js +0 -26
  548. package/packages/crouter-api/dist/core/grants/mirror.js +0 -506
  549. package/packages/crouter-api/dist/core/grants/on-sync.js +0 -163
  550. package/packages/crouter-api/dist/core/grants/owner.js +0 -21
  551. package/packages/crouter-api/dist/core/grants/shadow.js +0 -128
  552. package/packages/crouter-api/dist/core/grants/sync.js +0 -220
  553. package/packages/crouter-api/dist/core/grants/terminal.js +0 -25
  554. package/packages/crouter-api/dist/core/graph/access.js +0 -37
  555. package/packages/crouter-api/dist/core/graph/bodies.js +0 -68
  556. package/packages/crouter-api/dist/core/graph/custom.js +0 -298
  557. package/packages/crouter-api/dist/core/graph/deletion.js +0 -115
  558. package/packages/crouter-api/dist/core/graph/documents.js +0 -663
  559. package/packages/crouter-api/dist/core/graph/edges.js +0 -83
  560. package/packages/crouter-api/dist/core/graph/events.js +0 -432
  561. package/packages/crouter-api/dist/core/graph/exposures.js +0 -164
  562. package/packages/crouter-api/dist/core/graph/jobs.js +0 -184
  563. package/packages/crouter-api/dist/core/graph/kinds/action.js +0 -20
  564. package/packages/crouter-api/dist/core/graph/kinds/custom.js +0 -23
  565. package/packages/crouter-api/dist/core/graph/kinds/document.js +0 -115
  566. package/packages/crouter-api/dist/core/graph/kinds/dto.js +0 -20
  567. package/packages/crouter-api/dist/core/graph/kinds/environment.js +0 -19
  568. package/packages/crouter-api/dist/core/graph/kinds/job.js +0 -22
  569. package/packages/crouter-api/dist/core/graph/kinds/kind.js +0 -15
  570. package/packages/crouter-api/dist/core/graph/kinds/node.js +0 -85
  571. package/packages/crouter-api/dist/core/graph/kinds/owner.js +0 -24
  572. package/packages/crouter-api/dist/core/graph/kinds/registry.js +0 -58
  573. package/packages/crouter-api/dist/core/graph/kinds/render.js +0 -17
  574. package/packages/crouter-api/dist/core/graph/names.js +0 -225
  575. package/packages/crouter-api/dist/core/graph/objects.js +0 -277
  576. package/packages/crouter-api/dist/core/graph/package-docs.js +0 -153
  577. package/packages/crouter-api/dist/core/graph/package-files.js +0 -146
  578. package/packages/crouter-api/dist/core/graph/package-publish.js +0 -165
  579. package/packages/crouter-api/dist/core/graph/package-reconcile.js +0 -99
  580. package/packages/crouter-api/dist/core/graph/reader.js +0 -315
  581. package/packages/crouter-api/dist/core/graph/receiver-url.js +0 -83
  582. package/packages/crouter-api/dist/core/graph/receivers.js +0 -66
  583. package/packages/crouter-api/dist/core/graph/repo-sync/identity.js +0 -147
  584. package/packages/crouter-api/dist/core/graph/repo-sync/repos.js +0 -134
  585. package/packages/crouter-api/dist/core/graph/rules.js +0 -144
  586. package/packages/crouter-api/dist/core/graph/types.js +0 -10
  587. package/packages/crouter-api/dist/core/graph/watches.js +0 -223
  588. package/packages/crouter-api/dist/core/human/action-binding.js +0 -41
  589. package/packages/crouter-api/dist/core/human/answer-text.js +0 -100
  590. package/packages/crouter-api/dist/core/human/answer.js +0 -119
  591. package/packages/crouter-api/dist/core/human/completion.js +0 -27
  592. package/packages/crouter-api/dist/core/human/component-docs.js +0 -442
  593. package/packages/crouter-api/dist/core/human/convention.js +0 -75
  594. package/packages/crouter-api/dist/core/human/feedback-companion.js +0 -92
  595. package/packages/crouter-api/dist/core/human/feedback.js +0 -88
  596. package/packages/crouter-api/dist/core/human/page-authoring.js +0 -19
  597. package/packages/crouter-api/dist/core/human/page-errors.js +0 -14
  598. package/packages/crouter-api/dist/core/human/page-eval.js +0 -125
  599. package/packages/crouter-api/dist/core/human/page-html-markdown.js +0 -260
  600. package/packages/crouter-api/dist/core/human/page-markdown.js +0 -291
  601. package/packages/crouter-api/dist/core/human/page-schema.js +0 -381
  602. package/packages/crouter-api/dist/core/human/page.js +0 -251
  603. package/packages/crouter-api/dist/core/human/request-files.js +0 -54
  604. package/packages/crouter-api/dist/core/human/requests.js +0 -647
  605. package/packages/crouter-api/dist/core/human/root.js +0 -11
  606. package/packages/crouter-api/dist/core/human/summary.js +0 -5
  607. package/packages/crouter-api/dist/core/human/tickets.js +0 -166
  608. package/packages/crouter-api/dist/core/human/types.js +0 -1
  609. package/packages/crouter-api/dist/core/human/visible-paths.js +0 -74
  610. package/packages/crouter-api/dist/core/human-actions.js +0 -101
  611. package/packages/crouter-api/dist/core/import/bundle/blob-keys.js +0 -25
  612. package/packages/crouter-api/dist/core/import/bundle/layout.js +0 -111
  613. package/packages/crouter-api/dist/core/import/export/archive.js +0 -22
  614. package/packages/crouter-api/dist/core/import/export/cloud.js +0 -175
  615. package/packages/crouter-api/dist/core/import/export/dump.js +0 -245
  616. package/packages/crouter-api/dist/core/import/export/files.js +0 -169
  617. package/packages/crouter-api/dist/core/import/export/inline.js +0 -15
  618. package/packages/crouter-api/dist/core/import/export/source.js +0 -5
  619. package/packages/crouter-api/dist/core/import/export/stores.js +0 -73
  620. package/packages/crouter-api/dist/core/import/load/catalog.js +0 -70
  621. package/packages/crouter-api/dist/core/import/load/copy.js +0 -173
  622. package/packages/crouter-api/dist/core/import/load/keys.js +0 -77
  623. package/packages/crouter-api/dist/core/import/load/prepare.js +0 -262
  624. package/packages/crouter-api/dist/core/import/load/rewrite.js +0 -314
  625. package/packages/crouter-api/dist/core/import/load/stage.js +0 -99
  626. package/packages/crouter-api/dist/core/inspector/chrome.js +0 -14
  627. package/packages/crouter-api/dist/core/inspector/contract.js +0 -1
  628. package/packages/crouter-api/dist/core/inspector/core.js +0 -296
  629. package/packages/crouter-api/dist/core/inspector/host.js +0 -538
  630. package/packages/crouter-api/dist/core/inspector/model.js +0 -225
  631. package/packages/crouter-api/dist/core/inspector/text.js +0 -45
  632. package/packages/crouter-api/dist/core/inspector/transport.js +0 -36
  633. package/packages/crouter-api/dist/core/inspector/tui.js +0 -295
  634. package/packages/crouter-api/dist/core/keybindings/background-bash.js +0 -33
  635. package/packages/crouter-api/dist/core/keybindings/inbox.js +0 -25
  636. package/packages/crouter-api/dist/core/keybindings/index.js +0 -7
  637. package/packages/crouter-api/dist/core/keybindings/match.js +0 -146
  638. package/packages/crouter-api/dist/core/keybindings/persistence.js +0 -47
  639. package/packages/crouter-api/dist/core/keybindings/resolve.js +0 -348
  640. package/packages/crouter-api/dist/core/ledger/account.js +0 -13
  641. package/packages/crouter-api/dist/core/ledger/charges.js +0 -44
  642. package/packages/crouter-api/dist/core/ledger/check.js +0 -40
  643. package/packages/crouter-api/dist/core/ledger/chunks.js +0 -47
  644. package/packages/crouter-api/dist/core/ledger/environment-payer.js +0 -15
  645. package/packages/crouter-api/dist/core/ledger/index.js +0 -11
  646. package/packages/crouter-api/dist/core/ledger/infra-allowance.js +0 -31
  647. package/packages/crouter-api/dist/core/ledger/limits.js +0 -35
  648. package/packages/crouter-api/dist/core/ledger/months.js +0 -19
  649. package/packages/crouter-api/dist/core/ledger/payer.js +0 -23
  650. package/packages/crouter-api/dist/core/ledger/read.js +0 -211
  651. package/packages/crouter-api/dist/core/ledger/totals.js +0 -34
  652. package/packages/crouter-api/dist/core/ledger/types.js +0 -2
  653. package/packages/crouter-api/dist/core/llm/app-rungs.js +0 -64
  654. package/packages/crouter-api/dist/core/llm/body-limits.js +0 -7
  655. package/packages/crouter-api/dist/core/llm/owner-candidates.js +0 -79
  656. package/packages/crouter-api/dist/core/llm/refusal.js +0 -22
  657. package/packages/crouter-api/dist/core/llm/run.js +0 -571
  658. package/packages/crouter-api/dist/core/logged-step-timings.js +0 -52
  659. package/packages/crouter-api/dist/core/manifest-stale.js +0 -39
  660. package/packages/crouter-api/dist/core/model-auth/api-credential-store.js +0 -49
  661. package/packages/crouter-api/dist/core/model-auth/daemon-login.js +0 -156
  662. package/packages/crouter-api/dist/core/model-auth/readiness.js +0 -83
  663. package/packages/crouter-api/dist/core/model-routes-pool.js +0 -57
  664. package/packages/crouter-api/dist/core/model-routes.js +0 -212
  665. package/packages/crouter-api/dist/core/northlight/previews.js +0 -87
  666. package/packages/crouter-api/dist/core/nvim-launch.js +0 -45
  667. package/packages/crouter-api/dist/core/output.js +0 -99
  668. package/packages/crouter-api/dist/core/packages/eligibility.js +0 -34
  669. package/packages/crouter-api/dist/core/packages/launch-kinds.js +0 -20
  670. package/packages/crouter-api/dist/core/packages/source-url.js +0 -17
  671. package/packages/crouter-api/dist/core/pagination.js +0 -88
  672. package/packages/crouter-api/dist/core/peer/client.js +0 -168
  673. package/packages/crouter-api/dist/core/peer/directory.js +0 -193
  674. package/packages/crouter-api/dist/core/peer/envelope.js +0 -99
  675. package/packages/crouter-api/dist/core/peer/names.js +0 -8
  676. package/packages/crouter-api/dist/core/peer/outbox-store.js +0 -84
  677. package/packages/crouter-api/dist/core/peer/receiver.js +0 -54
  678. package/packages/crouter-api/dist/core/peer/stubs.js +0 -212
  679. package/packages/crouter-api/dist/core/peer/token.js +0 -30
  680. package/packages/crouter-api/dist/core/peer/version.js +0 -23
  681. package/packages/crouter-api/dist/core/permissions/builtin.js +0 -29
  682. package/packages/crouter-api/dist/core/permissions/ceiling.js +0 -345
  683. package/packages/crouter-api/dist/core/permissions/compile.js +0 -175
  684. package/packages/crouter-api/dist/core/permissions/errors.js +0 -13
  685. package/packages/crouter-api/dist/core/permissions/evaluator.js +0 -139
  686. package/packages/crouter-api/dist/core/permissions/facts.js +0 -102
  687. package/packages/crouter-api/dist/core/permissions/schema-parser.js +0 -151
  688. package/packages/crouter-api/dist/core/permissions/schemas.js +0 -83
  689. package/packages/crouter-api/dist/core/permissions/sql.js +0 -31
  690. package/packages/crouter-api/dist/core/plugin-app.js +0 -58
  691. package/packages/crouter-api/dist/core/plugin-quarantine.js +0 -70
  692. package/packages/crouter-api/dist/core/pool-credential-store.js +0 -135
  693. package/packages/crouter-api/dist/core/predicate.js +0 -191
  694. package/packages/crouter-api/dist/core/preview-registry.js +0 -399
  695. package/packages/crouter-api/dist/core/profiles/default-binding.js +0 -29
  696. package/packages/crouter-api/dist/core/profiles/deletion-reservation.js +0 -42
  697. package/packages/crouter-api/dist/core/profiles/select.js +0 -750
  698. package/packages/crouter-api/dist/core/provider-credential.js +0 -17
  699. package/packages/crouter-api/dist/core/provider-error-recognition.js +0 -82
  700. package/packages/crouter-api/dist/core/provider-failure.js +0 -166
  701. package/packages/crouter-api/dist/core/provider-management.js +0 -9
  702. package/packages/crouter-api/dist/core/providers/approval.js +0 -146
  703. package/packages/crouter-api/dist/core/providers/audit.js +0 -52
  704. package/packages/crouter-api/dist/core/providers/bundles.js +0 -643
  705. package/packages/crouter-api/dist/core/providers/call.js +0 -503
  706. package/packages/crouter-api/dist/core/providers/description.js +0 -1
  707. package/packages/crouter-api/dist/core/providers/device-libs.js +0 -202
  708. package/packages/crouter-api/dist/core/providers/device.js +0 -95
  709. package/packages/crouter-api/dist/core/providers/errors.js +0 -137
  710. package/packages/crouter-api/dist/core/providers/files.js +0 -461
  711. package/packages/crouter-api/dist/core/providers/inflight.js +0 -14
  712. package/packages/crouter-api/dist/core/providers/mint.js +0 -248
  713. package/packages/crouter-api/dist/core/providers/receipts.js +0 -50
  714. package/packages/crouter-api/dist/core/providers/request.js +0 -173
  715. package/packages/crouter-api/dist/core/providers/roots.js +0 -118
  716. package/packages/crouter-api/dist/core/providers/token-cache.js +0 -203
  717. package/packages/crouter-api/dist/core/remote-canvas-target.js +0 -30
  718. package/packages/crouter-api/dist/core/review/anchors.js +0 -91
  719. package/packages/crouter-api/dist/core/review/comments.js +0 -277
  720. package/packages/crouter-api/dist/core/review/companion.js +0 -207
  721. package/packages/crouter-api/dist/core/review/document.js +0 -71
  722. package/packages/crouter-api/dist/core/review/project.js +0 -46
  723. package/packages/crouter-api/dist/core/review/store.js +0 -178
  724. package/packages/crouter-api/dist/core/review/types.js +0 -23
  725. package/packages/crouter-api/dist/core/runs/activity.js +0 -57
  726. package/packages/crouter-api/dist/core/runs/events.js +0 -179
  727. package/packages/crouter-api/dist/core/runs/initial-input.js +0 -27
  728. package/packages/crouter-api/dist/core/runs/node-sub.js +0 -10
  729. package/packages/crouter-api/dist/core/runs/operations.js +0 -800
  730. package/packages/crouter-api/dist/core/runs/questions.js +0 -151
  731. package/packages/crouter-api/dist/core/runtime/banner.js +0 -53
  732. package/packages/crouter-api/dist/core/runtime/bearings-render.js +0 -284
  733. package/packages/crouter-api/dist/core/runtime/bearings.js +0 -208
  734. package/packages/crouter-api/dist/core/runtime/bin-contributions.js +0 -186
  735. package/packages/crouter-api/dist/core/runtime/blaxel-environment.js +0 -17
  736. package/packages/crouter-api/dist/core/runtime/broker/bash-job-launch.js +0 -65
  737. package/packages/crouter-api/dist/core/runtime/broker/model-adapter.js +0 -453
  738. package/packages/crouter-api/dist/core/runtime/broker/read-ops.js +0 -174
  739. package/packages/crouter-api/dist/core/runtime/broker/turn-cause.js +0 -44
  740. package/packages/crouter-api/dist/core/runtime/broker-ownership.js +0 -6
  741. package/packages/crouter-api/dist/core/runtime/broker-protocol.js +0 -166
  742. package/packages/crouter-api/dist/core/runtime/broker-request.js +0 -86
  743. package/packages/crouter-api/dist/core/runtime/broker-sdk.js +0 -130
  744. package/packages/crouter-api/dist/core/runtime/broker-wedge.js +0 -97
  745. package/packages/crouter-api/dist/core/runtime/canvas-extensions.js +0 -100
  746. package/packages/crouter-api/dist/core/runtime/close.js +0 -266
  747. package/packages/crouter-api/dist/core/runtime/command-expansion.js +0 -104
  748. package/packages/crouter-api/dist/core/runtime/command-surface.js +0 -117
  749. package/packages/crouter-api/dist/core/runtime/crtr-theme.js +0 -146
  750. package/packages/crouter-api/dist/core/runtime/deliver-live.js +0 -85
  751. package/packages/crouter-api/dist/core/runtime/fault-recovery.js +0 -72
  752. package/packages/crouter-api/dist/core/runtime/fault.js +0 -17
  753. package/packages/crouter-api/dist/core/runtime/fleet.js +0 -75
  754. package/packages/crouter-api/dist/core/runtime/focus-viewer.js +0 -151
  755. package/packages/crouter-api/dist/core/runtime/front-door-env.js +0 -16
  756. package/packages/crouter-api/dist/core/runtime/headless-pi.js +0 -176
  757. package/packages/crouter-api/dist/core/runtime/host.js +0 -717
  758. package/packages/crouter-api/dist/core/runtime/interactive-deliver.js +0 -51
  759. package/packages/crouter-api/dist/core/runtime/invocation.js +0 -10
  760. package/packages/crouter-api/dist/core/runtime/kickoff.js +0 -263
  761. package/packages/crouter-api/dist/core/runtime/launch-prompt.js +0 -13
  762. package/packages/crouter-api/dist/core/runtime/launch-recipe.js +0 -45
  763. package/packages/crouter-api/dist/core/runtime/launch-target.js +0 -87
  764. package/packages/crouter-api/dist/core/runtime/launch.js +0 -505
  765. package/packages/crouter-api/dist/core/runtime/ledger.js +0 -55
  766. package/packages/crouter-api/dist/core/runtime/lifecycle.js +0 -286
  767. package/packages/crouter-api/dist/core/runtime/managed-provider-cooling.js +0 -62
  768. package/packages/crouter-api/dist/core/runtime/memory-admission.js +0 -68
  769. package/packages/crouter-api/dist/core/runtime/model-registry.js +0 -13
  770. package/packages/crouter-api/dist/core/runtime/model-selection.js +0 -135
  771. package/packages/crouter-api/dist/core/runtime/model-swap.js +0 -76
  772. package/packages/crouter-api/dist/core/runtime/naming.js +0 -300
  773. package/packages/crouter-api/dist/core/runtime/nerd-font.js +0 -162
  774. package/packages/crouter-api/dist/core/runtime/nodes.js +0 -506
  775. package/packages/crouter-api/dist/core/runtime/outcome-document.js +0 -86
  776. package/packages/crouter-api/dist/core/runtime/output-result.js +0 -32
  777. package/packages/crouter-api/dist/core/runtime/output-schema-refs.js +0 -100
  778. package/packages/crouter-api/dist/core/runtime/package-health.js +0 -100
  779. package/packages/crouter-api/dist/core/runtime/persona.js +0 -54
  780. package/packages/crouter-api/dist/core/runtime/pi-cli.js +0 -65
  781. package/packages/crouter-api/dist/core/runtime/pi-vendored.js +0 -63
  782. package/packages/crouter-api/dist/core/runtime/placement-tmux.js +0 -81
  783. package/packages/crouter-api/dist/core/runtime/placement.js +0 -418
  784. package/packages/crouter-api/dist/core/runtime/progress-bar.js +0 -50
  785. package/packages/crouter-api/dist/core/runtime/provider-credential-gate.js +0 -48
  786. package/packages/crouter-api/dist/core/runtime/recovery-hold.js +0 -46
  787. package/packages/crouter-api/dist/core/runtime/reopen.js +0 -165
  788. package/packages/crouter-api/dist/core/runtime/revive-all.js +0 -108
  789. package/packages/crouter-api/dist/core/runtime/revive.js +0 -762
  790. package/packages/crouter-api/dist/core/runtime/roadmap.js +0 -86
  791. package/packages/crouter-api/dist/core/runtime/runner/blaxel/client.js +0 -150
  792. package/packages/crouter-api/dist/core/runtime/runner/blaxel/image-build.js +0 -280
  793. package/packages/crouter-api/dist/core/runtime/runner/blaxel/release-image.js +0 -97
  794. package/packages/crouter-api/dist/core/runtime/runner/blaxel/runner.js +0 -214
  795. package/packages/crouter-api/dist/core/runtime/runner/delete-sandboxes.js +0 -88
  796. package/packages/crouter-api/dist/core/runtime/runner/index.js +0 -37
  797. package/packages/crouter-api/dist/core/runtime/runner/machine/call.js +0 -110
  798. package/packages/crouter-api/dist/core/runtime/runner/machine/environment.js +0 -7
  799. package/packages/crouter-api/dist/core/runtime/runner/machine/executor.js +0 -235
  800. package/packages/crouter-api/dist/core/runtime/runner/machine/ops.js +0 -37
  801. package/packages/crouter-api/dist/core/runtime/runner/machine/runner.js +0 -72
  802. package/packages/crouter-api/dist/core/runtime/runner/process.js +0 -70
  803. package/packages/crouter-api/dist/core/runtime/runner/types.js +0 -16
  804. package/packages/crouter-api/dist/core/runtime/session-branch.js +0 -16
  805. package/packages/crouter-api/dist/core/runtime/session-cycles.js +0 -144
  806. package/packages/crouter-api/dist/core/runtime/session-list-cache.js +0 -302
  807. package/packages/crouter-api/dist/core/runtime/session-visibility.js +0 -99
  808. package/packages/crouter-api/dist/core/runtime/setup-marker.js +0 -46
  809. package/packages/crouter-api/dist/core/runtime/situational-context.js +0 -54
  810. package/packages/crouter-api/dist/core/runtime/situational-live.js +0 -41
  811. package/packages/crouter-api/dist/core/runtime/spawn-env-rows.js +0 -15
  812. package/packages/crouter-api/dist/core/runtime/spawn-env.js +0 -260
  813. package/packages/crouter-api/dist/core/runtime/spawn.js +0 -867
  814. package/packages/crouter-api/dist/core/runtime/stamp/protocol.js +0 -113
  815. package/packages/crouter-api/dist/core/runtime/start-check.js +0 -43
  816. package/packages/crouter-api/dist/core/runtime/stop-guard.js +0 -150
  817. package/packages/crouter-api/dist/core/runtime/stop-signals.js +0 -46
  818. package/packages/crouter-api/dist/core/runtime/structured-output.js +0 -112
  819. package/packages/crouter-api/dist/core/runtime/surface-bg.js +0 -85
  820. package/packages/crouter-api/dist/core/runtime/tmux-bindings.js +0 -738
  821. package/packages/crouter-api/dist/core/runtime/tmux-chrome.js +0 -5
  822. package/packages/crouter-api/dist/core/runtime/tmux-driver.js +0 -706
  823. package/packages/crouter-api/dist/core/runtime/unsandboxed.js +0 -18
  824. package/packages/crouter-api/dist/core/runtime/view-socket.js +0 -195
  825. package/packages/crouter-api/dist/core/runtime/warm-pool.js +0 -479
  826. package/packages/crouter-api/dist/core/scoped-state/person-rows.js +0 -185
  827. package/packages/crouter-api/dist/core/scopes.js +0 -48
  828. package/packages/crouter-api/dist/core/secrets/blaxel-launch.js +0 -104
  829. package/packages/crouter-api/dist/core/secrets/env-rows.js +0 -40
  830. package/packages/crouter-api/dist/core/secrets/environment-owner.js +0 -31
  831. package/packages/crouter-api/dist/core/secrets/environment-secrets.js +0 -14
  832. package/packages/crouter-api/dist/core/secrets/index.js +0 -2
  833. package/packages/crouter-api/dist/core/secrets/key.js +0 -33
  834. package/packages/crouter-api/dist/core/secrets/seal.js +0 -43
  835. package/packages/crouter-api/dist/core/secrets.js +0 -137
  836. package/packages/crouter-api/dist/core/self-update.js +0 -77
  837. package/packages/crouter-api/dist/core/session-model/session-state.js +0 -180
  838. package/packages/crouter-api/dist/core/shell-segments.js +0 -169
  839. package/packages/crouter-api/dist/core/spaces/cache-env.js +0 -15
  840. package/packages/crouter-api/dist/core/spaces/file-root.js +0 -68
  841. package/packages/crouter-api/dist/core/spaces/mounts.js +0 -126
  842. package/packages/crouter-api/dist/core/spaces/permissions.js +0 -83
  843. package/packages/crouter-api/dist/core/spaces/process.js +0 -175
  844. package/packages/crouter-api/dist/core/spaces/runtime-home.js +0 -8
  845. package/packages/crouter-api/dist/core/spaces/space.js +0 -58
  846. package/packages/crouter-api/dist/core/spaces/stop.js +0 -138
  847. package/packages/crouter-api/dist/core/spaces/users.js +0 -43
  848. package/packages/crouter-api/dist/core/sqlite-statements.js +0 -17
  849. package/packages/crouter-api/dist/core/statements.js +0 -81
  850. package/packages/crouter-api/dist/core/step-timings.js +0 -63
  851. package/packages/crouter-api/dist/core/storage/attachments.js +0 -141
  852. package/packages/crouter-api/dist/core/storage/caller-file.js +0 -84
  853. package/packages/crouter-api/dist/core/storage/client.js +0 -220
  854. package/packages/crouter-api/dist/core/storage/media-types.js +0 -22
  855. package/packages/crouter-api/dist/core/storage/node-transfer.js +0 -100
  856. package/packages/crouter-api/dist/core/storage/purge.js +0 -55
  857. package/packages/crouter-api/dist/core/storage/tables.js +0 -129
  858. package/packages/crouter-api/dist/core/subscription-state.js +0 -470
  859. package/packages/crouter-api/dist/core/substrate/delivery/corpus.js +0 -239
  860. package/packages/crouter-api/dist/core/substrate/delivery/deliver.js +0 -370
  861. package/packages/crouter-api/dist/core/substrate/delivery/listings.js +0 -75
  862. package/packages/crouter-api/dist/core/substrate/delivery/match.js +0 -146
  863. package/packages/crouter-api/dist/core/substrate/delivery/plan.js +0 -132
  864. package/packages/crouter-api/dist/core/substrate/delivery/render-boot.js +0 -330
  865. package/packages/crouter-api/dist/core/substrate/delivery/render-event.js +0 -186
  866. package/packages/crouter-api/dist/core/substrate/delivery/sub-persona-menu.js +0 -24
  867. package/packages/crouter-api/dist/core/substrate/delivery/types.js +0 -1
  868. package/packages/crouter-api/dist/core/substrate/gate-explain.js +0 -397
  869. package/packages/crouter-api/dist/core/substrate/schema.js +0 -81
  870. package/packages/crouter-api/dist/core/substrate/subject-fields.js +0 -39
  871. package/packages/crouter-api/dist/core/substrate/subject.js +0 -60
  872. package/packages/crouter-api/dist/core/termrender/display.js +0 -56
  873. package/packages/crouter-api/dist/core/termrender/termrender.js +0 -719
  874. package/packages/crouter-api/dist/core/termrender/version.js +0 -1
  875. package/packages/crouter-api/dist/core/timing.js +0 -108
  876. package/packages/crouter-api/dist/core/tui/draw.js +0 -378
  877. package/packages/crouter-api/dist/core/tui/fuzzy.js +0 -38
  878. package/packages/crouter-api/dist/core/tui/markdown.js +0 -407
  879. package/packages/crouter-api/dist/core/tui/page-host.js +0 -74
  880. package/packages/crouter-api/dist/core/tui/panel.js +0 -142
  881. package/packages/crouter-api/dist/core/tui/terminal.js +0 -100
  882. package/packages/crouter-api/dist/core/wake.js +0 -296
  883. package/packages/crouter-api/dist/core/worktree-close.js +0 -205
  884. package/packages/crouter-api/dist/core/worktree-containment.js +0 -48
  885. package/packages/crouter-api/dist/core/worktree-landing.js +0 -8
  886. package/packages/crouter-api/dist/core/worktree-machine.js +0 -112
  887. package/packages/crouter-api/dist/core/worktree-mutation-async.js +0 -393
  888. package/packages/crouter-api/dist/core/worktree-remove.js +0 -84
  889. package/packages/crouter-api/dist/core/worktree-scripts.js +0 -72
  890. package/packages/crouter-api/dist/core/worktree-sweep.js +0 -448
  891. package/packages/crouter-api/dist/core/worktree.js +0 -844
  892. package/packages/crouter-api/dist/daemon/api/deferred-head.js +0 -117
  893. package/packages/crouter-api/dist/daemon/api/environment-of.js +0 -67
  894. package/packages/crouter-api/dist/daemon/api/handlers/bash-jobs.js +0 -352
  895. package/packages/crouter-api/dist/daemon/api/handlers/broker-ops.js +0 -705
  896. package/packages/crouter-api/dist/daemon/api/handlers/broker-recovery.js +0 -266
  897. package/packages/crouter-api/dist/daemon/api/handlers/execution-start.js +0 -120
  898. package/packages/crouter-api/dist/daemon/api/handlers/git-credential.js +0 -76
  899. package/packages/crouter-api/dist/daemon/api/handlers/node-records.js +0 -113
  900. package/packages/crouter-api/dist/daemon/api/handlers/providers.js +0 -290
  901. package/packages/crouter-api/dist/daemon/api/handlers/telemetry-record.js +0 -34
  902. package/packages/crouter-api/dist/daemon/api/handlers/validate.js +0 -58
  903. package/packages/crouter-api/dist/daemon/api/map.js +0 -750
  904. package/packages/crouter-api/dist/daemon/api/operations.js +0 -325
  905. package/packages/crouter-api/dist/daemon/api/principal.js +0 -166
  906. package/packages/crouter-api/dist/daemon/api/reader.js +0 -133
  907. package/packages/crouter-api/dist/daemon/api/router.js +0 -568
  908. package/packages/crouter-api/dist/daemon/api/sync-notice.js +0 -46
  909. package/packages/crouter-api/dist/daemon/api/viewer-presence.js +0 -100
  910. package/packages/crouter-api/dist/daemon/companion-retire.js +0 -44
  911. package/packages/crouter-api/dist/daemon/control.js +0 -22
  912. package/packages/crouter-api/dist/daemon/cron/armed-context.js +0 -140
  913. package/packages/crouter-api/dist/daemon/cron/authority.js +0 -101
  914. package/packages/crouter-api/dist/daemon/cron/capture.js +0 -50
  915. package/packages/crouter-api/dist/daemon/cron/closed.js +0 -108
  916. package/packages/crouter-api/dist/daemon/cron/disposition.js +0 -63
  917. package/packages/crouter-api/dist/daemon/cron/ended.js +0 -91
  918. package/packages/crouter-api/dist/daemon/cron/escalation.js +0 -136
  919. package/packages/crouter-api/dist/daemon/cron/held.js +0 -20
  920. package/packages/crouter-api/dist/daemon/cron/live-runs.js +0 -65
  921. package/packages/crouter-api/dist/daemon/cron/machine-fire.js +0 -240
  922. package/packages/crouter-api/dist/daemon/cron/narrowed.js +0 -34
  923. package/packages/crouter-api/dist/daemon/cron/recurrence.js +0 -38
  924. package/packages/crouter-api/dist/daemon/cron/run-socket.js +0 -170
  925. package/packages/crouter-api/dist/daemon/cron/run-token.js +0 -37
  926. package/packages/crouter-api/dist/daemon/cron/settle.js +0 -78
  927. package/packages/crouter-api/dist/daemon/cron/sinks.js +0 -70
  928. package/packages/crouter-api/dist/daemon/drain.js +0 -76
  929. package/packages/crouter-api/dist/daemon/http-dispatcher.js +0 -37
  930. package/packages/crouter-api/dist/daemon/human/finish.js +0 -179
  931. package/packages/crouter-api/dist/daemon/human/settle.js +0 -98
  932. package/packages/crouter-api/dist/daemon/machine-link/credential.js +0 -24
  933. package/packages/crouter-api/dist/daemon/machine-link/forward.js +0 -201
  934. package/packages/crouter-api/dist/daemon/machine-link/frames.js +0 -33
  935. package/packages/crouter-api/dist/daemon/machine-link/holder.js +0 -395
  936. package/packages/crouter-api/dist/daemon/park-activity.js +0 -33
  937. package/packages/crouter-api/dist/daemon/park-pending.js +0 -76
  938. package/packages/crouter-api/dist/daemon/postgres/binary.js +0 -193
  939. package/packages/crouter-api/dist/daemon/postgres/cluster.js +0 -111
  940. package/packages/crouter-api/dist/daemon/postgres/pins.js +0 -16
  941. package/packages/crouter-api/dist/daemon/postgres/supervisor.js +0 -177
  942. package/packages/crouter-api/dist/daemon/readiness.js +0 -37
  943. package/packages/crouter-api/dist/daemon/reconcilers/broker-supervision.js +0 -746
  944. package/packages/crouter-api/dist/daemon/reconcilers/ledger-sandbox.js +0 -249
  945. package/packages/crouter-api/dist/daemon/reconcilers/live-obligation.js +0 -125
  946. package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/launch-failure.js +0 -8
  947. package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/node-person.js +0 -40
  948. package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/remote-wake.js +0 -166
  949. package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/respawn-policy.js +0 -59
  950. package/packages/crouter-api/dist/daemon/reconcilers/recipe-image.js +0 -204
  951. package/packages/crouter-api/dist/daemon/reconcilers/throttled-lane.js +0 -63
  952. package/packages/crouter-api/dist/daemon/review/companion.js +0 -29
  953. package/packages/crouter-api/dist/daemon/review/deliver.js +0 -14
  954. package/packages/crouter-api/dist/daemon/review/finish.js +0 -149
  955. package/packages/crouter-api/dist/daemon/runs/append-section.js +0 -129
  956. package/packages/crouter-api/dist/daemon/runs/observer.js +0 -440
  957. package/packages/crouter-api/dist/daemon/runs/view-transport.js +0 -81
  958. package/packages/crouter-api/dist/daemon/structured-requests/sidecar.js +0 -5
  959. package/packages/crouter-api/dist/hook-authoring.js +0 -447
  960. package/packages/crouter-api/dist/hook-process.js +0 -34
  961. package/packages/crouter-api/dist/launcher/limits/settings.js +0 -94
  962. package/packages/crouter-api/dist/migrations/004-canvas-documents/fields.js +0 -52
  963. package/packages/crouter-api/dist/shared/git-status.js +0 -44
  964. package/packages/crouter-api/dist/shared/inline-ref-grammar.js +0 -99
  965. package/packages/crouter-api/dist/shared/shell-quote.js +0 -5
  966. package/packages/crouter-api/dist/shared/strip-cd-prefix.js +0 -13
  967. package/packages/crouter-api/dist/shared/tool-groups.js +0 -64
  968. package/packages/crouter-api/dist/shared/traceparent.js +0 -28
  969. package/packages/crouter-api/dist/shared/turn-replies.js +0 -66
@@ -1,3 +1,3 @@
1
- var J=Object.defineProperty;var o=(t,e)=>J(t,"name",{value:e,configurable:!0});import{spawn as K,execFileSync as q}from"node:child_process";import{createRequire as Q}from"node:module";import{dirname as x,join as T}from"node:path";import{fileURLToPath as Z,pathToFileURL as N}from"node:url";import{existsSync as F,lstatSync as tt,mkdirSync as et,openSync as H,closeSync as G,fstatSync as W,readSync as rt}from"node:fs";import{apiSocketPath as nt,crtrHome as S}from"../core/canvas/paths.js";import{listProcessTable as ot}from"../core/canvas/pid.js";import{bindDaemonEventSource as at,eventSource as it}from"../core/events/source.js";import{hostExecPath as I}from"../core/runtime/branded-host.js";import{isDaemonRunning as st,readPidfile as w,isPidAlive as R}from"./pidfile.js";import{DAEMON_STARTUP_WINDOW_MS as V}from"./startup-policy.js";import{computerIsUnset as ct,readMachineConfig as ut}from"./machine-link/config.js";import{exclusiveLockOwnerPid as lt}from"../core/exclusive-lock.js";import{onDiskMigrationLockPath as dt}from"../core/canvas/paths.js";import{envNoDaemonAutostart as _t}from"../shared/env.js";import{waitForDaemonAvailability as pt}from"../api/index.js";import{localClient as Rt}from"../api/node-transport.js";const ft=["TMUX","TMUX_PANE","NODE_OPTIONS"],mt=new Set(["CRTR_HOME","CRTR_RUNTIME_HOME","CRTR_PIDFILE","CRTR_RUNTIME","CRTR_INSTALL_ID","CRTR_LOG","CRTR_DEBUG","CRTR_DEBUG_PID_LIVENESS","CRTR_TIMING","CRTR_TIMING_PROC","CRTR_NO_DAEMON_AUTOSTART","CRTR_NO_AUTO_UPDATE","CRTR_NO_AUTO_INIT","CRTR_NO_EXPORTS","CRTR_POSTGRES_HOME","CRTR_DATABASE_URL","CRTR_DATABASE_SCHEMA","CRTR_DATABASE_POOL_MAX","CRTR_SCHEMA_DATABASE_URL","CRTR_DOCUMENT_PORT","CRTR_LAUNCHER_SOCKET","CRTR_API_ADDRESS","CRTR_DIRECTORY_URL","CRTR_PUBLIC_API_URL","CRTR_CANVAS_URL","CRTR_CANVAS_CLIENT_ID","CRTR_CANVAS_JWK_FILE","CRTR_SECRETS_KEY","CRTR_IMPORT_SERVICE_TOKEN","CRTR_PACKAGES_TOKEN","CRTR_FEEDBACK_ENDPOINT","CRTR_FEEDBACK_TOKEN","CRTR_SUPPORT_REPO","CRTR_BRANDED_HOST","CRTR_CODESIGN_IDENTITY","CRTR_PLUGIN_REVALIDATE_TTL_MS","CRTR_IMPORT_BLOB_WORKERS","CRTR_MAX_LIVE_BROKERS","CRTR_WARN_LIVE_BROKERS","CRTR_BROKER_RSS_CAP_MB","CRTR_UNATTENDED_PARK_MS","CRTR_WARM_POOL","CRTR_STREAM_WATCHDOG_MS","CRTR_CONVERSATION_COMMIT_DEADLINE_MS","CRTR_NAME_MODEL","CRTR_MODEL_PROVIDER","CRTR_BROKER_SIGNAL_LONG_PROOF"]),ht=["CRTR_DB_","CRTR_BOOT_","CRTR_R2_","CRTR_LEDGER_","CRTR_BASH_","CRTR_WATCHER_","CRTR_RECAP_","CRTR_MODEL_AUTH_","CRTR_TEST_","CRTR_FAULT_"];function Et(t){return ft.includes(t)?!1:t.startsWith("CRTR_")?mt.has(t)||ht.some(e=>t.startsWith(e)):!0}o(Et,"daemonKeepsEnv");function y(){const t={};for(const[e,r]of Object.entries(process.env))Et(e)&&(t[e]=r);return t}o(y,"sanitizedDaemonEnv");function Tt(){for(let t=x(Z(import.meta.url));;t=x(t)){if(F(T(t,"bin","runtime-generation-manifest.mjs")))return t;if(x(t)===t)throw new Error(`cannot locate the crouter generation root from ${import.meta.url}`)}}o(Tt,"generationRoot");async function g(){const t=Tt(),e=N(T(t,"bin","runtime-generation-manifest.mjs")).href,{runtimeHome:r}=await import(e);try{tt(T(r(),"selected"))}catch(u){if(u.code!=="ENOENT")throw u;return["--conditions","crtr-src","--import",N(Q(import.meta.url).resolve("tsx/esm")).href,T(t,"src","daemon","crtrd-cli.ts")]}const n=N(T(t,"bin","runtime-selector.mjs")).href,{tryResolveRuntime:a}=await import(n),s=a("daemon");if(!s.ok)throw new Error(`cannot resolve the selected runtime generation's daemon entry: ${s.error}`);return[s.runtime.entryPath]}o(g,"resolveDaemonLaunch");function wt(t,e){return t.includes(` --canvas-home ${e} `)||t.endsWith(` --canvas-home ${e}`)}o(wt,"daemonCommandDeclaresCanvasHome");function Dt(){const t=ot();if(t===null)return[];const e=S(),r=[];for(const{pid:n,command:a}of t)a.includes("daemon/crtrd")&&wt(a,e)&&n!==process.pid&&r.push(n);return r}o(Dt,"findDaemonPids");function St(t){const e=Dt().filter(n=>n!==t);for(const n of e)try{process.kill(n,"SIGTERM")}catch{}if(e.length===0)return e;const r=Date.now()+2e3;for(;Date.now()<r&&e.some(n=>R(n));)q("sleep",["0.1"]);for(const n of e)if(R(n))try{process.kill(n,"SIGKILL")}catch{}return e}o(St,"sweepStrayDaemons");async function Zt(){const t=process.execve;if(t===void 0)throw new Error(`this Node.js ${process.version} runtime cannot replace PID 1 with the successor daemon`);const e=I(),r=await g();return t(e,[e,...r,"--canvas-home",S()],y())}o(Zt,"execDaemon");async function P(t){const e=await g(),r=K(I(),[...e,...t],{stdio:["ignore","pipe","pipe"],env:y()});let n="",a="";r.stdout.setEncoding("utf8").on("data",c=>{n+=c}),r.stderr.setEncoding("utf8").on("data",c=>{a+=c});const s=await new Promise((c,_)=>{r.once("error",_),r.once("close",f=>c(f))});if(s!==0)throw new Error(a.trim()||`the ${t[0]} process exited with code ${s}`);const u=n.trim().split(`
2
- `).at(-1)??"";return JSON.parse(u)}o(P,"runDaemonEntry");function te(t,e){return P(["import-dump",t,e])}o(te,"runDaemonImportDump");function ee(t){return P(["import-dump",t,"bodies"])}o(ee,"runDaemonBodiesDump");function re(){return P(["import-dump","","install-id"])}o(re,"runDaemonInstallId");const j=2e4,L=10,v=1e3;async function b(t=v){const e=Math.min(t,v);return Rt({autostart:!1,timeoutMs:e,socketPath:nt()}).probeHealthz(e)}o(b,"probeDaemonHealth");function At(t){const e=t instanceof Error?t.message:String(t);if(typeof t!="object"||t===null)return e;const r=t.code,n=t.cause,a=typeof r=="string"?r:n?.code;return typeof a=="string"&&!e.includes(a)?`${e}: ${a}`:e}o(At,"probeErrorMessage");async function X(t=v){const e=await b(t);if(e.startup_phase==="blocked"){const r=w()??process.pid;throw new C(r,e.startup_blocked??"daemon startup is blocked")}if(!e.ok)throw new Error(e.startup_blocked??"crtrd health check reported not ready")}o(X,"probeDaemonServing");async function ne(){try{return await X(),!0}catch{return!1}}o(ne,"isDaemonServing");function k(t){return new Promise(e=>{setTimeout(e,t)})}o(k,"sleepMs");class U extends Error{static{o(this,"DaemonExitedBeforeReadyError")}stderrTail;constructor(e,r){super(r===""?e:`${e}
3
- ${r}`),this.name="DaemonExitedBeforeReadyError",this.stderrTail=r}}class z extends Error{static{o(this,"DaemonLaunchError")}constructor(e){super(e instanceof Error?e.message:String(e),{cause:e}),this.name="DaemonLaunchError"}}class C extends Error{static{o(this,"DaemonStartupBlockedError")}constructor(e,r){super(`daemon ${e} is running but normal startup is blocked: ${r}`),this.name="DaemonStartupBlockedError"}}class B extends Error{static{o(this,"DaemonNotPreparedError")}constructor(e,r){super(r===void 0?`daemon ${e} is serving but did not report the prepared startup phase`:`daemon ${e} reported startup phase ${r}, not prepared`),this.name="DaemonNotPreparedError"}}async function Ct(t,e=V,r={},n="ready"){const a=r.readPidfile??w,s=r.isPidAlive??R,u=r.childExited,c=r.isDaemonServing,_=r.probeDaemonServing??(async h=>{if(c!==void 0){if(await c())return;throw new Error("crtrd health check reported not ready")}await X(h)}),f=r.probeDaemonHealth??b,D=r.sleepMs??k,i=r.now??Date.now;let p=null,l=null;return await pt({windowMs:e,pollIntervalMs:L,now:i,sleep:D,retry:o(h=>h!==l,"retry"),probe:o(async h=>{const m=a();if(m===null||!s(m)){const d=u?.();throw d!=null&&(d.signal!==null?l=new U(`daemon ${t} exited before becoming ready (by ${d.signal})`,r.childStderrTail?.()??""):d.code!==0&&(l=new U(`daemon ${t} exited before becoming ready (with exit code ${d.code??"?"})`,r.childStderrTail?.()??"")),l!==null)?l:new Error(`daemon ${t} has no live pidfile owner`)}if(n==="ready"){try{await _(h)}catch(d){throw d instanceof C&&(l=d),d}p=m;return}const E=await f(h);if(E.startup_phase==="prepared"){p=m;return}throw E.startup_phase==="blocked"?(l=new C(m,E.startup_blocked??"on-disk migration is blocked"),l):E.startup_phase==="ready"?(l=new B(m,E.startup_phase),l):new Error(`daemon ${m} is ${E.startup_phase??"not reporting a startup phase"}; waiting for prepared`)},"probe")}),p===t?null:p}o(Ct,"verifyDaemonStartup");async function Ot(t,e=j,r={}){const n=r.readPidfile??w,a=r.isPidAlive??R,s=r.sleepMs??k,u=r.now??Date.now,c=u()+e;for(;u()<=c;){if(!a(t)&&n()!==t)return;await s(L)}throw new Error(`daemon ${t} did not exit and release its pidfile within ${e}ms`)}o(Ot,"waitForDaemonExit");const Mt=2e3,xt=5e3;async function Y(t,e=j,r={}){const n=r.isPidAlive??R,a=r.sleepMs??k,s=r.now??Date.now;try{process.kill(t,"SIGTERM")}catch{}try{return await Ot(t,e,r),"terminated"}catch{}try{process.kill(t,"SIGKILL")}catch{}const u=s()+Mt;for(;s()<=u;){if(!n(t))return"killed";await a(L)}throw new Error(`daemon ${t} survived both SIGTERM and SIGKILL`)}o(Y,"stopDaemonProcess");async function oe(){const t=w(),e=t!==null&&R(t),r=e&&await Y(t)==="killed",n=St(null);return{stopped:e||n.length>0,...e?{pid:t}:{},strays_killed:n,force_killed:r}}o(oe,"stopAllDaemons");function Nt(t,e,r=2048){let n;try{n=H(t,"r");const{size:a}=W(n),s=Math.max(e,a-r),u=a-s;if(u<=0)return"";const c=Buffer.alloc(u);return rt(n,c,0,u,s),c.toString("utf8").trim()}catch{return""}finally{if(n!==void 0)try{G(n)}catch{}}}o(Nt,"readLogTailFrom");async function It(t={}){if(process.platform==="linux"&&F("/run/crtr/launcher.sock")&&!R(w()??-1)&&ut()===void 0)throw new Error("crtrd is managed by the root launcher; it cannot self-daemonize");const e=t.targetPhase??"ready",r=w();if(r!==null&&R(r))try{const i=await b();if(e==="prepared"){if(i.startup_phase==="prepared")return{started:!1,existing_pid:r,startup_phase:i.startup_phase};throw new B(r,i.startup_phase)}return i.ok?{started:!1,existing_pid:r,...i.startup_phase===void 0?{}:{startup_phase:i.startup_phase}}:{started:!1,existing_pid:r,running:!0,serving:!1,probe_error:i.startup_blocked??"crtrd health check reported not ready",...i.startup_phase===void 0?{}:{startup_phase:i.startup_phase}}}catch(i){if(i instanceof B)throw i;return{started:!1,existing_pid:r,running:!0,serving:!1,probe_error:At(i)}}et(S(),{recursive:!0});const n=await g().catch(i=>{throw new z(i)}),a=T(S(),"crtrd.err"),s=H(a,"a"),u=(()=>{try{return W(s).size}catch{return 0}})();it()===void 0&&at();const c=K(I(),[...n,"--canvas-home",S(),...e==="prepared"?["--prepare"]:[]],{detached:!0,stdio:["ignore",s,s],env:y()});G(s);const _=c.pid;if(_===void 0)throw new Error("daemon spawn did not return a pid");let f=null;c.once("exit",(i,p)=>{f={code:i,signal:p}}),c.unref();let D;try{D=await Ct(_,V,{childExited:o(()=>f,"childExited"),childStderrTail:o(()=>Nt(a,u),"childStderrTail")},e)}catch(i){const p=lt(dt())===_;if(f===null&&!p&&!(i instanceof C))try{await Y(_,xt)}catch{}throw i}return D!==null?{started:!1,existing_pid:D,startup_phase:e}:{started:!0,pid:_,startup_phase:e}}o(It,"spawnDaemon");function yt(){return _t()||process.argv.includes("--no-autostart")}o(yt,"autostartDisabled");const gt=5e3,Pt=6e4;let $=!1,A,O=0,M=0;function Lt(t){return Math.min(gt*2**(t-1),Pt)}o(Lt,"autostartBackoffMs");function vt(){A=void 0,O=0,M=0}o(vt,"resetDaemonAutostart");function ae(){return A}o(ae,"daemonAutostartStartupFailure");function ie(t={}){const e=t.isDaemonRunning??st,r=t.spawnDaemon??It,n=t.now??Date.now;if(!yt()&&!(!t.spawnDaemon&&ct())&&!$&&!(n()<M)){if(e()){vt();return}A=void 0,$=!0,r().then(()=>{A=void 0,O=0,M=0},a=>{(a instanceof U||a instanceof z)&&(A=a.message),O+=1,M=n()+Lt(O)}).finally(()=>{$=!1})}}o(ie,"ensureDaemon");export{ft as DAEMON_ENV_STRIP_KEYS,U as DaemonExitedBeforeReadyError,z as DaemonLaunchError,B as DaemonNotPreparedError,C as DaemonStartupBlockedError,yt as autostartDisabled,ae as daemonAutostartStartupFailure,wt as daemonCommandDeclaresCanvasHome,Et as daemonKeepsEnv,ie as ensureDaemon,Zt as execDaemon,Dt as findDaemonPids,ne as isDaemonServing,b as probeDaemonHealth,X as probeDaemonServing,At as probeErrorMessage,vt as resetDaemonAutostart,ee as runDaemonBodiesDump,te as runDaemonImportDump,re as runDaemonInstallId,y as sanitizedDaemonEnv,It as spawnDaemon,oe as stopAllDaemons,Y as stopDaemonProcess,St as sweepStrayDaemons,Ct as verifyDaemonStartup,Ot as waitForDaemonExit};
1
+ var Y=Object.defineProperty;var o=(e,t)=>Y(e,"name",{value:t,configurable:!0});import{spawn as $,execFileSync as J}from"node:child_process";import{createRequire as q}from"node:module";import{dirname as N,join as T}from"node:path";import{fileURLToPath as Q,pathToFileURL as x}from"node:url";import{existsSync as K,lstatSync as Z,mkdirSync as ee,openSync as F,closeSync as H,fstatSync as G,readSync as te}from"node:fs";import{apiSocketPath as re,crtrHome as D}from"../core/canvas/paths.js";import{listProcessTable as ne}from"../core/canvas/pid.js";import{bindDaemonEventSource as oe,eventSource as ae}from"../core/events/source.js";import{hostExecPath as y}from"../core/runtime/branded-host.js";import{isDaemonRunning as se,readPidfile as w,isPidAlive as p}from"./pidfile.js";import{DAEMON_STARTUP_WINDOW_MS as W}from"./startup-policy.js";import{computerIsUnset as ie,readMachineConfig as ce}from"./machine-link/config.js";import{exclusiveLockOwnerPid as ue}from"../core/exclusive-lock.js";import{onDiskMigrationLockPath as le}from"../core/canvas/paths.js";import{envNoDaemonAutostart as _e}from"../shared/env.js";import{waitForDaemonAvailability as de}from"../api/index.js";import{localClient as Re}from"../api/node-transport.js";const pe=["TMUX","TMUX_PANE","NODE_OPTIONS"],fe=new Set(["CRTR_HOME","CRTR_RUNTIME_HOME","CRTR_PIDFILE","CRTR_RUNTIME","CRTR_INSTALL_ID","CRTR_LOG","CRTR_DEBUG","CRTR_DEBUG_PID_LIVENESS","CRTR_TIMING","CRTR_TIMING_PROC","CRTR_NO_DAEMON_AUTOSTART","CRTR_NO_AUTO_UPDATE","CRTR_NO_AUTO_INIT","CRTR_NO_EXPORTS","CRTR_POSTGRES_HOME","CRTR_DATABASE_URL","CRTR_DATABASE_SCHEMA","CRTR_DATABASE_POOL_MAX","CRTR_SCHEMA_DATABASE_URL","CRTR_DOCUMENT_PORT","CRTR_LAUNCHER_SOCKET","CRTR_API_ADDRESS","CRTR_DIRECTORY_URL","CRTR_PUBLIC_API_URL","CRTR_CANVAS_URL","CRTR_CANVAS_CLIENT_ID","CRTR_CANVAS_JWK_FILE","CRTR_SECRETS_KEY","CRTR_IMPORT_SERVICE_TOKEN","CRTR_PACKAGES_TOKEN","CRTR_FEEDBACK_ENDPOINT","CRTR_FEEDBACK_TOKEN","CRTR_SUPPORT_REPO","CRTR_BRANDED_HOST","CRTR_CODESIGN_IDENTITY","CRTR_PLUGIN_REVALIDATE_TTL_MS","CRTR_IMPORT_BLOB_WORKERS","CRTR_MAX_LIVE_BROKERS","CRTR_WARN_LIVE_BROKERS","CRTR_BROKER_RSS_CAP_MB","CRTR_UNATTENDED_PARK_MS","CRTR_WARM_POOL","CRTR_STREAM_WATCHDOG_MS","CRTR_CONVERSATION_COMMIT_DEADLINE_MS","CRTR_NAME_MODEL","CRTR_MODEL_PROVIDER","CRTR_BROKER_SIGNAL_LONG_PROOF"]),me=["CRTR_DB_","CRTR_BOOT_","CRTR_R2_","CRTR_LEDGER_","CRTR_BASH_","CRTR_WATCHER_","CRTR_RECAP_","CRTR_MODEL_AUTH_","CRTR_TEST_","CRTR_FAULT_"];function he(e){return pe.includes(e)?!1:e.startsWith("CRTR_")?fe.has(e)||me.some(t=>e.startsWith(t)):!0}o(he,"daemonKeepsEnv");function g(){const e={};for(const[t,r]of Object.entries(process.env))he(t)&&(e[t]=r);return e}o(g,"sanitizedDaemonEnv");function Ee(){for(let e=N(Q(import.meta.url));;e=N(e)){if(K(T(e,"bin","runtime-generation-manifest.mjs")))return e;if(N(e)===e)throw new Error(`cannot locate the crouter generation root from ${import.meta.url}`)}}o(Ee,"generationRoot");async function I(){const e=Ee(),t=x(T(e,"bin","runtime-generation-manifest.mjs")).href,{runtimeHome:r}=await import(t);try{Z(T(r(),"selected"))}catch(u){if(u.code!=="ENOENT")throw u;return["--conditions","crtr-src","--import",x(q(import.meta.url).resolve("tsx/esm")).href,T(e,"src","daemon","crtrd-cli.ts")]}const n=x(T(e,"bin","runtime-selector.mjs")).href,{tryResolveRuntime:a}=await import(n),i=a("daemon");if(!i.ok)throw new Error(`cannot resolve the selected runtime generation's daemon entry: ${i.error}`);return[i.runtime.entryPath]}o(I,"resolveDaemonLaunch");function Te(e,t){return e.includes(` --canvas-home ${t} `)||e.endsWith(` --canvas-home ${t}`)}o(Te,"daemonCommandDeclaresCanvasHome");function we(){const e=ne();if(e===null)return[];const t=D(),r=[];for(const{pid:n,command:a}of e)a.includes("daemon/crtrd")&&Te(a,t)&&n!==process.pid&&r.push(n);return r}o(we,"findDaemonPids");function Se(e){const t=we().filter(n=>n!==e);for(const n of t)try{process.kill(n,"SIGTERM")}catch{}if(t.length===0)return t;const r=Date.now()+2e3;for(;Date.now()<r&&t.some(n=>p(n));)J("sleep",["0.1"]);for(const n of t)if(p(n))try{process.kill(n,"SIGKILL")}catch{}return t}o(Se,"sweepStrayDaemons");async function Qe(){const e=process.execve;if(e===void 0)throw new Error(`this Node.js ${process.version} runtime cannot replace PID 1 with the successor daemon`);const t=y(),r=await I();return e(t,[t,...r,"--canvas-home",D()],g())}o(Qe,"execDaemon");async function Ze(e){const t=await I(),r=$(y(),[...t,...e],{stdio:["ignore","pipe","pipe"],env:g()});let n="",a="";r.stdout.setEncoding("utf8").on("data",c=>{n+=c}),r.stderr.setEncoding("utf8").on("data",c=>{a+=c});const i=await new Promise((c,d)=>{r.once("error",d),r.once("close",f=>c(f))});if(i!==0)throw new Error(a.trim()||`the ${e[0]} process exited with code ${i}`);const u=n.trim().split(`
2
+ `).at(-1)??"";return JSON.parse(u)}o(Ze,"runDaemonEntry");const V=2e4,P=10,L=1e3;async function v(e=L){const t=Math.min(e,L);return Re({autostart:!1,timeoutMs:t,socketPath:re()}).probeHealthz(t)}o(v,"probeDaemonHealth");function De(e){const t=e instanceof Error?e.message:String(e);if(typeof e!="object"||e===null)return t;const r=e.code,n=e.cause,a=typeof r=="string"?r:n?.code;return typeof a=="string"&&!t.includes(a)?`${t}: ${a}`:t}o(De,"probeErrorMessage");async function j(e=L){const t=await v(e);if(t.startup_phase==="blocked"){const r=w()??process.pid;throw new C(r,t.startup_blocked??"daemon startup is blocked")}if(!t.ok)throw new Error(t.startup_blocked??"crtrd health check reported not ready")}o(j,"probeDaemonServing");async function et(){try{return await j(),!0}catch{return!1}}o(et,"isDaemonServing");function b(e){return new Promise(t=>{setTimeout(t,e)})}o(b,"sleepMs");class k extends Error{static{o(this,"DaemonExitedBeforeReadyError")}stderrTail;constructor(t,r){super(r===""?t:`${t}
3
+ ${r}`),this.name="DaemonExitedBeforeReadyError",this.stderrTail=r}}class X extends Error{static{o(this,"DaemonLaunchError")}constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="DaemonLaunchError"}}class C extends Error{static{o(this,"DaemonStartupBlockedError")}constructor(t,r){super(`daemon ${t} is running but normal startup is blocked: ${r}`),this.name="DaemonStartupBlockedError"}}class U extends Error{static{o(this,"DaemonNotPreparedError")}constructor(t,r){super(r===void 0?`daemon ${t} is serving but did not report the prepared startup phase`:`daemon ${t} reported startup phase ${r}, not prepared`),this.name="DaemonNotPreparedError"}}async function Ae(e,t=W,r={},n="ready"){const a=r.readPidfile??w,i=r.isPidAlive??p,u=r.childExited,c=r.isDaemonServing,d=r.probeDaemonServing??(async h=>{if(c!==void 0){if(await c())return;throw new Error("crtrd health check reported not ready")}await j(h)}),f=r.probeDaemonHealth??v,S=r.sleepMs??b,s=r.now??Date.now;let R=null,l=null;return await de({windowMs:t,pollIntervalMs:P,now:s,sleep:S,retry:o(h=>h!==l,"retry"),probe:o(async h=>{const m=a();if(m===null||!i(m)){const _=u?.();throw _!=null&&(_.signal!==null?l=new k(`daemon ${e} exited before becoming ready (by ${_.signal})`,r.childStderrTail?.()??""):_.code!==0&&(l=new k(`daemon ${e} exited before becoming ready (with exit code ${_.code??"?"})`,r.childStderrTail?.()??"")),l!==null)?l:new Error(`daemon ${e} has no live pidfile owner`)}if(n==="ready"){try{await d(h)}catch(_){throw _ instanceof C&&(l=_),_}R=m;return}const E=await f(h);if(E.startup_phase==="prepared"){R=m;return}throw E.startup_phase==="blocked"?(l=new C(m,E.startup_blocked??"on-disk migration is blocked"),l):E.startup_phase==="ready"?(l=new U(m,E.startup_phase),l):new Error(`daemon ${m} is ${E.startup_phase??"not reporting a startup phase"}; waiting for prepared`)},"probe")}),R===e?null:R}o(Ae,"verifyDaemonStartup");async function Ce(e,t=V,r={}){const n=r.readPidfile??w,a=r.isPidAlive??p,i=r.sleepMs??b,u=r.now??Date.now,c=u()+t;for(;u()<=c;){if(!a(e)&&n()!==e)return;await i(P)}throw new Error(`daemon ${e} did not exit and release its pidfile within ${t}ms`)}o(Ce,"waitForDaemonExit");const Oe=2e3,Me=5e3;async function z(e,t=V,r={}){const n=r.isPidAlive??p,a=r.sleepMs??b,i=r.now??Date.now;try{process.kill(e,"SIGTERM")}catch{}try{return await Ce(e,t,r),"terminated"}catch{}try{process.kill(e,"SIGKILL")}catch{}const u=i()+Oe;for(;i()<=u;){if(!n(e))return"killed";await a(P)}throw new Error(`daemon ${e} survived both SIGTERM and SIGKILL`)}o(z,"stopDaemonProcess");async function tt(){const e=w(),t=e!==null&&p(e),r=t&&await z(e)==="killed",n=Se(null);return{stopped:t||n.length>0,...t?{pid:e}:{},strays_killed:n,force_killed:r}}o(tt,"stopAllDaemons");function Ne(e,t,r=2048){let n;try{n=F(e,"r");const{size:a}=G(n),i=Math.max(t,a-r),u=a-i;if(u<=0)return"";const c=Buffer.alloc(u);return te(n,c,0,u,i),c.toString("utf8").trim()}catch{return""}finally{if(n!==void 0)try{H(n)}catch{}}}o(Ne,"readLogTailFrom");async function xe(e={}){if(process.platform==="linux"&&K("/run/crtr/launcher.sock")&&!p(w()??-1)&&ce()===void 0)throw new Error("crtrd is managed by the root launcher; it cannot self-daemonize");const t=e.targetPhase??"ready",r=w();if(r!==null&&p(r))try{const s=await v();if(t==="prepared"){if(s.startup_phase==="prepared")return{started:!1,existing_pid:r,startup_phase:s.startup_phase};throw new U(r,s.startup_phase)}return s.ok?{started:!1,existing_pid:r,...s.startup_phase===void 0?{}:{startup_phase:s.startup_phase}}:{started:!1,existing_pid:r,running:!0,serving:!1,probe_error:s.startup_blocked??"crtrd health check reported not ready",...s.startup_phase===void 0?{}:{startup_phase:s.startup_phase}}}catch(s){if(s instanceof U)throw s;return{started:!1,existing_pid:r,running:!0,serving:!1,probe_error:De(s)}}ee(D(),{recursive:!0});const n=await I().catch(s=>{throw new X(s)}),a=T(D(),"crtrd.err"),i=F(a,"a"),u=(()=>{try{return G(i).size}catch{return 0}})();ae()===void 0&&oe();const c=$(y(),[...n,"--canvas-home",D(),...t==="prepared"?["--prepare"]:[]],{detached:!0,stdio:["ignore",i,i],env:g()});H(i);const d=c.pid;if(d===void 0)throw new Error("daemon spawn did not return a pid");let f=null;c.once("exit",(s,R)=>{f={code:s,signal:R}}),c.unref();let S;try{S=await Ae(d,W,{childExited:o(()=>f,"childExited"),childStderrTail:o(()=>Ne(a,u),"childStderrTail")},t)}catch(s){const R=ue(le())===d;if(f===null&&!R&&!(s instanceof C))try{await z(d,Me)}catch{}throw s}return S!==null?{started:!1,existing_pid:S,startup_phase:t}:{started:!0,pid:d,startup_phase:t}}o(xe,"spawnDaemon");function ye(){return _e()||process.argv.includes("--no-autostart")}o(ye,"autostartDisabled");const ge=5e3,Ie=6e4;let B=!1,A,O=0,M=0;function Pe(e){return Math.min(ge*2**(e-1),Ie)}o(Pe,"autostartBackoffMs");function Le(){A=void 0,O=0,M=0}o(Le,"resetDaemonAutostart");function rt(){return A}o(rt,"daemonAutostartStartupFailure");function nt(e={}){const t=e.isDaemonRunning??se,r=e.spawnDaemon??xe,n=e.now??Date.now;if(!ye()&&!(!e.spawnDaemon&&ie())&&!B&&!(n()<M)){if(t()){Le();return}A=void 0,B=!0,r().then(()=>{A=void 0,O=0,M=0},a=>{(a instanceof k||a instanceof X)&&(A=a.message),O+=1,M=n()+Pe(O)}).finally(()=>{B=!1})}}o(nt,"ensureDaemon");export{pe as DAEMON_ENV_STRIP_KEYS,k as DaemonExitedBeforeReadyError,X as DaemonLaunchError,U as DaemonNotPreparedError,C as DaemonStartupBlockedError,ye as autostartDisabled,rt as daemonAutostartStartupFailure,Te as daemonCommandDeclaresCanvasHome,he as daemonKeepsEnv,nt as ensureDaemon,Qe as execDaemon,we as findDaemonPids,et as isDaemonServing,v as probeDaemonHealth,j as probeDaemonServing,De as probeErrorMessage,Le as resetDaemonAutostart,g as sanitizedDaemonEnv,xe as spawnDaemon,tt as stopAllDaemons,z as stopDaemonProcess,Se as sweepStrayDaemons,Ae as verifyDaemonStartup,Ce as waitForDaemonExit};
@@ -1,2 +1,2 @@
1
1
  export { ensurePostgresBinaries } from './binary.js';
2
- export { ensurePostgres, ensurePostgresHealthy, startScratchCluster, stopPostgres, withPostgresStartLock } from './supervisor.js';
2
+ export { startScratchCluster } from './supervisor.js';
@@ -1 +1 @@
1
- import{ensurePostgresBinaries as e}from"./binary.js";import{ensurePostgres as o,ensurePostgresHealthy as a,startScratchCluster as g,stopPostgres as P,withPostgresStartLock as n}from"./supervisor.js";export{o as ensurePostgres,e as ensurePostgresBinaries,a as ensurePostgresHealthy,g as startScratchCluster,P as stopPostgres,n as withPostgresStartLock};
1
+ import{ensurePostgresBinaries as t}from"./binary.js";import{startScratchCluster as o}from"./supervisor.js";export{t as ensurePostgresBinaries,o as startScratchCluster};
@@ -1,68 +1,6 @@
1
- /** Where the daemon's database is and whether this process started it. */
2
- export interface PostgresEndpoint {
3
- /** Connection string for `pg`. */
4
- url: string;
5
- /** True when this call started the postmaster; false when it adopted a running one (or the URL is external). */
6
- started: boolean;
7
- }
8
1
  type Log = (message: string) => void;
9
2
  /** The URL of an external Postgres, when `CRTR_DATABASE_URL` names one. */
10
3
  export declare function externalDatabaseUrl(): string | null;
11
- export interface PostgresPaths {
12
- /** `<runtime root>/pg` */
13
- dir: string;
14
- dataDir: string;
15
- /** Exclusive directory lock serializing start/adopt across processes. */
16
- lockPath: string;
17
- /** Holds the socket directory path; written at start for tools that read it without computing it. */
18
- socketDirFile: string;
19
- logFile: string;
20
- /** Directory holding `.s.PGSQL.5432`: `<runtime root>/pg`, or a short `/tmp` directory when that path is too long. */
21
- socketDir: string;
22
- }
23
- /** Pure path computation for a runtime root; touches no disk. */
24
- export declare function postgresPaths(root?: string): PostgresPaths;
25
- /**
26
- * The URL the daemon connects to, computed without starting anything: `CRTR_DATABASE_URL` when set, otherwise the
27
- * supervised cluster's socket for this runtime root. Valid once `ensurePostgres()` has returned.
28
- */
29
- export declare function resolveDatabaseUrl(root?: string): string;
30
- /**
31
- * Make sure the database for this runtime root answers, and return how to reach it. With `CRTR_DATABASE_URL` set this
32
- * does nothing. Otherwise: adopt a running postmaster on the runtime root's socket, or (under `runtime/pg/start.lock`)
33
- * download the pinned binaries if needed, `initdb` on first need, start `postgres`, and wait up to 15 s for `SELECT 1`.
34
- * Postgres is never stopped here; a handover leaves it running for the successor to adopt.
35
- */
36
- export declare function ensurePostgres(options?: {
37
- root?: string;
38
- log?: Log;
39
- startLockHeld?: boolean;
40
- }): Promise<PostgresEndpoint>;
41
- /**
42
- * Run `operation` under `runtime/pg/start.lock`, the lock that orders starting or adopting the postmaster against
43
- * stopping it. The daemon holds it across `ensurePostgres({ startLockHeld: true })` and its ownership claim, and
44
- * `stopPostgres` holds it across its "no daemon has claimed the database" check and `pg_ctl stop`, so a successor
45
- * can never adopt a postmaster that is about to be stopped. With `CRTR_DATABASE_URL` set it runs `operation` unlocked.
46
- */
47
- export declare function withPostgresStartLock<T>(operation: () => Promise<T>, root?: string): Promise<T>;
48
- /**
49
- * The daemon's health tick. Returns when the database answers. If it does not, restart it once (WAL recovery handles
50
- * the data); a second failure within a minute throws so the daemon's readiness fails.
51
- */
52
- export declare function ensurePostgresHealthy(options?: {
53
- root?: string;
54
- log?: Log;
55
- }): Promise<PostgresEndpoint>;
56
- /**
57
- * `crtr sys daemon stop`: `pg_ctl stop -m fast` for this runtime root's cluster, unless `claimed()` reports that
58
- * another daemon already owns the database. Both run under the start lock, so no daemon can adopt the postmaster
59
- * between the check and the stop. Call after this daemon's ownership claim is released. Never call on a handover.
60
- * Returns whether it stopped the cluster; a no-op for an external URL or a stopped cluster.
61
- */
62
- export declare function stopPostgres(options: {
63
- root?: string;
64
- claimed: () => Promise<boolean>;
65
- }): Promise<boolean>;
66
4
  export interface ScratchCluster {
67
5
  /** Socket URL (superuser `crtr`, database `postgres`, trust authentication). */
68
6
  url: string;
@@ -1,2 +1 @@
1
- var R=Object.defineProperty;var o=(t,r)=>R(t,"name",{value:r,configurable:!0});import{createHash as _}from"node:crypto";import{chownSync as v,chmodSync as A,existsSync as C,lstatSync as T,mkdirSync as B,rmSync as F,writeFileSync as H}from"node:fs";import{userInfo as G}from"node:os";import{join as i}from"node:path";import{withExclusiveDirectoryLockAsync as M}from"../../core/exclusive-lock.js";import{runtimeRoot as y}from"../../core/layout.js";import{ensurePostgresBinaries as f}from"./binary.js";import{MAX_SOCKET_PATH_BYTES as g,POSTGRES_PORT as D,assertNotRoot as k,clusterInitialized as O,initCluster as p,probe as m,socketUrl as P,startPostmaster as S,stopPostmaster as w,tcpUrl as z}from"./cluster.js";const h=o(()=>{},"noLog");function u(){return process.env.CRTR_DATABASE_URL||null}o(u,"externalDatabaseUrl");function l(t=y()){const r=i(t,"pg"),s=`.s.PGSQL.${D}`,e=Buffer.byteLength(i(r,s))<=g,a=e?r:`/tmp/crtr-pg-${_("sha256").update(t).digest("hex").slice(0,8)}`;if(!e&&Buffer.byteLength(i(a,s))>g)throw new Error(`socket path ${i(a,s)} is too long`);return{dir:r,dataDir:i(r,"data"),lockPath:i(r,"start.lock"),socketDirFile:i(r,"socket-dir"),logFile:i(r,"postgres.log"),socketDir:a}}o(l,"postgresPaths");function x(){return G().username}o(x,"osUser");function U(t=y()){return u()??P(x(),l(t).socketDir)}o(U,"resolveDatabaseUrl");function d(t){B(t,{recursive:!0,mode:448});const r=T(t);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${t} is not a directory`);if(typeof process.getuid=="function"&&r.uid!==process.getuid())throw new Error(`${t} is owned by uid ${r.uid}, not this process; refusing to put the Postgres socket there`);(r.mode&63)!==0&&A(t,448)}o(d,"ensurePrivateDir");async function I(t={}){const r=t.log??h,s=u();if(s!==null)return{url:s,started:!1};k("crtrd cannot start its database");const e=l(t.root),a=U(t.root);if(await m(a)===null)return{url:a,started:!1};const n=await f(r);return d(e.dir),e.socketDir!==e.dir&&d(e.socketDir),(t.startLockHeld===!0?c=>c():c=>$(c,t.root))(async()=>{if(await m(a)===null)return{url:a,started:!1};const c={dataDir:e.dataDir,socketDir:e.socketDir,maxConnections:20};if(!O(e.dataDir)){const L=Date.now();p(n,c,x(),"peer"),r(`postgres cluster initialized in ${Date.now()-L} ms`)}H(e.socketDirFile,`${e.socketDir}
2
- `);const E=Date.now();return await S(n,c,a,e.logFile),r(`postgres started in ${Date.now()-E} ms`),{url:a,started:!0}})}o(I,"ensurePostgres");async function $(t,r){if(u()!==null)return t();const s=l(r);return d(s.dir),M(s.lockPath,t,{timeoutMs:45e3,staleMs:45e3,timeoutError:o(()=>new Error(`timed out waiting for another process to start or stop Postgres (lock ${s.lockPath})`),"timeoutError")})}o($,"withPostgresStartLock");let b=0;async function Z(t={}){const r=U(t.root);if(u()!==null||await m(r,2e3)===null)return{url:r,started:!1};const s=Date.now();if(s-b<6e4)throw new Error(`Postgres stopped answering twice within a minute; see ${l(t.root).logFile}`);(t.log??h)("postgres did not answer the 2 s health probe; restarting it unless it answers now");const e=await I(t);return e.started&&(b=s),e}o(Z,"ensurePostgresHealthy");async function tt(t){if(u()!==null)return!1;const r=l(t.root);return C(i(r.dataDir,"postmaster.pid"))?$(async()=>await t.claimed()?!1:(w(await f(),{dataDir:r.dataDir}),!0),t.root):!1}o(tt,"stopPostgres");async function rt(t){const r=t.log??h;t.asUser===void 0&&k("a scratch Postgres cluster");const s=await f(r);if(d(t.dir),t.asUser&&v(t.dir,t.asUser.uid,t.asUser.gid),Buffer.byteLength(i(t.dir,`.s.PGSQL.${t.tcp?.port??D}`))>g)throw new Error(`scratch directory ${t.dir} is too long for a Postgres socket path`);const e={dataDir:i(t.dir,"data"),socketDir:t.dir,maxConnections:t.maxConnections??100,...t.tcp?{tcp:t.tcp}:{},...t.asUser?{asUser:t.asUser}:{}},a=P("crtr",t.dir,t.tcp?.port);try{p(s,e,"crtr","trust"),await S(s,e,a,i(t.dir,"postgres.log"))}catch(n){try{w(s,e)}catch{}throw n}return{url:a,tcpUrl:t.tcp?z("crtr",t.tcp.host,t.tcp.port):null,dir:t.dir,stop:o(async(n={})=>{w(s,e),n.remove!==!1&&F(t.dir,{recursive:!0,force:!0})},"stop")}}o(rt,"startScratchCluster");export{I as ensurePostgres,Z as ensurePostgresHealthy,u as externalDatabaseUrl,l as postgresPaths,U as resolveDatabaseUrl,rt as startScratchCluster,tt as stopPostgres,$ as withPostgresStartLock};
1
+ var u=Object.defineProperty;var e=(r,t)=>u(r,"name",{value:t,configurable:!0});import{chownSync as d,chmodSync as f,lstatSync as l,mkdirSync as m,rmSync as g}from"node:fs";import{join as a}from"node:path";import{ensurePostgresBinaries as y}from"./binary.js";import{MAX_SOCKET_PATH_BYTES as h,POSTGRES_PORT as S,assertNotRoot as U,initCluster as w,socketUrl as P,startPostmaster as E,stopPostmaster as n,tcpUrl as T}from"./cluster.js";const k=e(()=>{},"noLog");function x(){return process.env.CRTR_DATABASE_URL||null}e(x,"externalDatabaseUrl");function C(r){m(r,{recursive:!0,mode:448});const t=l(r);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`${r} is not a directory`);if(typeof process.getuid=="function"&&t.uid!==process.getuid())throw new Error(`${r} is owned by uid ${t.uid}, not this process; refusing to put the Postgres socket there`);(t.mode&63)!==0&&f(r,448)}e(C,"ensurePrivateDir");async function A(r){const t=r.log??k;r.asUser===void 0&&U("a scratch Postgres cluster");const c=await y(t);if(C(r.dir),r.asUser&&d(r.dir,r.asUser.uid,r.asUser.gid),Buffer.byteLength(a(r.dir,`.s.PGSQL.${r.tcp?.port??S}`))>h)throw new Error(`scratch directory ${r.dir} is too long for a Postgres socket path`);const s={dataDir:a(r.dir,"data"),socketDir:r.dir,maxConnections:r.maxConnections??100,...r.tcp?{tcp:r.tcp}:{},...r.asUser?{asUser:r.asUser}:{}},o=P("crtr",r.dir,r.tcp?.port);try{w(c,s,"crtr","trust"),await E(c,s,o,a(r.dir,"postgres.log"))}catch(i){try{n(c,s)}catch{}throw i}return{url:o,tcpUrl:r.tcp?T("crtr",r.tcp.host,r.tcp.port):null,dir:r.dir,stop:e(async(i={})=>{n(c,s),i.remove!==!1&&g(r.dir,{recursive:!0,force:!0})},"stop")}}e(A,"startScratchCluster");export{x as externalDatabaseUrl,A as startScratchCluster};
@@ -10,8 +10,6 @@ export interface BrokerSupervisionContext {
10
10
  rows: readonly NodeRow[];
11
11
  fleet: FleetRegistry;
12
12
  lifecycle: DetachedWorkLifecycle;
13
- /** Nodes of a committed, not yet `done` import run: no fatal-fault notice or park for them. */
14
- held: ReadonlySet<string>;
15
13
  }
16
14
  type TreeSample = {
17
15
  cpuPercent: number;
@@ -1,3 +1,3 @@
1
- var j=Object.defineProperty;var _=(i,e)=>j(i,"name",{value:e,configurable:!0});import{existsSync as J}from"node:fs";import{LAUNCHER_SOCKET as Q}from"../../launcher/spec.js";import{launcherRequest as X}from"../../launcher/client.js";import{execFile as Z}from"node:child_process";import{promisify as ee}from"node:util";import{getNode as S,isWarmSpare as te,subscribersOf as ne}from"../../core/canvas/index.js";import{isSafeNodeId as c}from"../../core/canvas/paths.js";import{fullName as x}from"../../core/canvas/labels.js";import{recordedPidLiveness as B}from"../../core/canvas/pid.js";import{transition as re}from"../../core/runtime/lifecycle.js";import{hasAdmittedTurn as ae,listUnnotifiedFatalFaultNodes as ie,markFaultNotified as oe,readFault as L,readLiveTurn as F,recordFault as se}from"../../core/canvas/recovery.js";import{errorClassFromFault as de}from"../../core/fault-classifier.js";import{describeVendorLimit as le}from"../../core/provider-failure.js";import{nextFaultRetry as ce}from"../../core/runtime/fault-recovery.js";import{publishNotice as W}from"../../core/runtime/close.js";import{openDb as $,withCanvasWrite as ue}from"../../core/canvas/db.js";import{getById as fe}from"../../core/graph/objects.js";import{watcherIdsOf as pe}from"../../core/graph/watches.js";import{headlessBrokerHost as me}from"../../core/runtime/host.js";import{endExecution as _e,liveExecutionForNode as N,requestExecutionStop as he}from"../../core/canvas/executions.js";import{runnerForExecution as we}from"../../core/runtime/runner/index.js";import{emitEvent as f}from"../../core/events/emit.js";import{operationIdContext as D}from"../../core/events/operation-id.js";import{hasUnseenWakeMail as ke,resetStaleExecutionMail as ge}from"../../core/canvas/deliveries.js";import{runningJobs as ve}from"../../core/graph/jobs.js";import{focusOf as ye}from"../../core/runtime/placement.js";import{hasAttachedBrokerViewers as be}from"../api/viewer-presence.js";import{deliverLive as Se}from"../../core/runtime/interactive-deliver.js";import{BrokerUnreachableError as Ae}from"../../core/runtime/broker-request.js";import{formatCard as Te,PARK_SUMMARY_PROMPT as Ie}from"../../shared/generated-context.js";import{brokerThresholdsForDaemon as Me}from"../../core/runtime/fleet.js";import{readConfig as Pe}from"../../core/config.js";import{beginPendingPark as Re,clearSupervisionMark as h,consumePendingPark as A,pendingParkIds as Ee,pendingParkStartedAt as xe,readSupervisionMark as T,writeSupervisionMark as I}from"../park-pending.js";import{shouldParkAfterSummary as Fe}from"../park-activity.js";import{applyParkEvent as M,noticeUnfinishedIdle as $e,parkVerdict as Ne}from"./live-obligation.js";import{readGoal as De}from"../../core/runtime/kickoff.js";import{memoryDeniedRecently as Oe}from"../../core/runtime/memory-admission.js";import{envNoDaemonAutostart as Ce,envTestUnattendedParkMs as Be,parkSummaryGraceMs as Le,envUnattendedParkMs as We}from"../../shared/env.js";import{KILL_ESCALATE_MS as G,sampleBrokerTree as Ge,wedgeVerdict as Ue,WEDGE_QUIET_MS as O,YIELD_STALL_GRACE_MS as U,yieldStallVerdict as q}from"../../core/runtime/broker-wedge.js";const C=ee(Z);async function qe(i){return!await ae(i)&&((await De(i))?.trim()??"")!==""}_(qe,"awaitsBirthTurn");async function Y(i){const e=await N(i);return e!==null&&e.runner!=="process"&&e.state==="running"?e:null}_(Y,"remoteExecutionOf");async function Ye(i){return(await F(i))?.busy===!0}_(Ye,"liveBusy");async function Dt(i){const e=(await F(i))?.progressAt;if(e==null)return null;const t=Date.parse(e);return Number.isNaN(t)?null:t}_(Dt,"liveTurnProgressMs");function V(i,e){return e===null?null:`${i}:${e}`}_(V,"incarnationOf");async function b(i){const e=await F(i.node_id),t=e?.busy===!0&&e.progressAt!==null?Date.parse(e.progressAt):Number.NaN,r=i.launched_at===null||i.launched_at===void 0?Number.NaN:Date.parse(i.launched_at);return!Number.isFinite(t)||!Number.isFinite(r)||t<r?null:t}_(b,"busySinceForIncarnation");const Ve=5*6e4;function He(i,e){return i===null||i.parent!=null?!1:i.lifecycle==="terminal"?!0:(e==="cap_exhausted"||e==="payment_refused"||e==="all_routes_exhausted")&&i.run_id===i.node_id}_(He,"settlesOnFatalProviderFault");function Ke(){const i=We();if(i!==void 0)return i;const e=Pe("user").lifecycle.unattendedParkMs;return Ce()?Be()??e:e}_(Ke,"unattendedParkMsForDaemon");function H(){return Le()}_(H,"parkSummaryGraceMsForDaemon");function ze(i,e,t,r,a){const n=`Child wedged \u2014 ${i} is alive and mid-turn but has shown NO engine progress for ${e}+ minutes and `;if(t)return n+"its process is near-idle. It will NOT recover on its own \u2014 read `crtr canvas read wedged-child-on-runaway-bash` and kill the runaway SUBPROCESS (not this node) so its turn can resume with no lost context.";const s="it has no subprocess to kill (the engine itself stalled). ";return r?n+s+"The daemon did not SIGTERM the broker because its PID identity cannot be confirmed alive.":a?n+s+"The daemon sent SIGTERM to the broker and will resume a cleanly aborted session with a continuation, or start a recovery cycle if the abort cannot settle.":n+s+"The daemon attempted SIGTERM to the broker, but the signal call failed."}_(ze,"wedgeLabel");async function K(i,e){f({level:"error",event:"broker.wedge.detected",...c(i)?{node_id:i}:{},fields:{...c(i)?{}:{affected_node_id:i},pid:e.pid,quiet_ms:e.quietForMs,cpu_percent:e.cpuPercent,has_descendants:e.hasDescendants,kick_attempted:e.kickAttempted,kicked:e.kicked,...e.kickSuppressionReason===null?{}:{kick_suppression_reason:e.kickSuppressionReason}}});try{await se(i,{link:"daemon\u2192node",op:"engine wedge",kind:"wedged",retry:{disposition:"manual"},message:e.label})}catch(t){f({level:"error",event:"broker.wedge.fault_record_failed",...c(i)?{node_id:i}:{fields:{affected_node_id:i}},error:t})}await W(i,"notice.crash",e.label,{reason:"child-wedged",child:i,quiet_ms:e.quietForMs,cpu_percent:e.cpuPercent,kick_attempted:e.kickAttempted,kicked:e.kicked,...e.kickSuppressionReason===null?{}:{kick_suppression_reason:e.kickSuppressionReason}})}_(K,"reportWedge");class Ot{static{_(this,"BrokerSupervisionReconciler")}yieldTermedAt=new Map;sampleTree;signal;lastOverCapWarnAt=Number.NEGATIVE_INFINITY;constructor(e={}){this.sampleTree=e.readTreeSample??Ge,this.signal=e.signal??((t,r)=>{if(process.platform==="linux"&&J(Q)){if(r!=="SIGTERM"&&r!=="SIGKILL")throw new Error(`unsupported launcher signal ${r}`);return X({operation:"stop",pid:t,signal:r}).then(()=>{})}process.kill(t,r)})}async runFleetPreamble(e){return Me()}warnIfSaturated(e){if(e.fleet.size()<e.thresholds.warning||!e.lifecycle.acceptsDetachedWork())return;const t=D.fresh(()=>this.warnOverCapInTmux(e.fleet.size(),e.thresholds,e.frozen));e.lifecycle.registerDetached(t)}async run(e,t){const r=Ke();for(const a of await ie())t.held.has(a)||await D.fresh(async()=>{try{await this.handleFatalFault(a)}catch(n){f({level:"error",event:"broker.supervision.failed",...c(a)?{node_id:a}:{fields:{affected_node_id:a}},error:n})}});for(const a of t.rows){const n=a.node_id,s=t.fleet.get(n),d=s===void 0?await Y(n):null;if(s===void 0&&d===null||a.status!=="active"&&a.status!=="idle"){await h(n,"unattended_since");continue}await D.fresh(async()=>{try{s!==void 0?(await this.handleYieldStall(a,s,t.fleet,e),await this.handleWedgeDetection(a,s,t.fleet,e)):d.runner==="blaxel"&&(await this.handleRemoteYieldStall(a,d,e),await this.handleRemoteWedge(a,d,e)),await this.handleUnattendedParking(n,await S(n),s?.pid??d.pid,d,e,t,r)}catch(l){await h(n,"unattended_since"),f({level:"error",event:"broker.supervision.failed",...c(n)?{node_id:n}:{fields:{affected_node_id:n}},error:l})}})}for(const a of await Ee())await t.fleet.has(a)||await A(a);await ge(e)}async parkResetCondition(e,t,r,a){if(t.pi_session_id==null||t.pi_pid!==r||t.status==="done"||t.status==="canceled"||t.status==="dead"||t.intent!==null||(await ve(await $(),e)).length>0||await ye(e)!==null||await be(e))return!0;const n=await L(e);return n!==null&&n.retry.disposition==="auto"&&n.retry.by==="daemon"&&(n.kind==="connection"||n.kind==="rate-limit"||n.kind==="overloaded")&&(n.retry.nextAt!==void 0||ce(n,a)!==null)?!0:await ke(e)}async handleUnattendedParking(e,t,r,a,n,s,d){if(await te(e)){await h(e,"unattended_since"),await A(e);return}if(t===null){await h(e,"unattended_since"),await A(e);return}const l=await this.parkResetCondition(e,t,r,n),o=await xe(e);if(o!==void 0){if(n-o<H())return;const v=await A(e);if(v===void 0||(await h(e,"unattended_since"),!await Fe(e,t,v)))return;f({level:"warn",event:"broker.park.summary_expired",...c(e)?{node_id:e}:{},fields:{...c(e)?{}:{affected_node_id:e},grace_ms:H()}}),await M(e,"park"),this.teardownBroker(e,a);return}if(l||await Ye(e)||await qe(e)){await h(e,"unattended_since");return}const p=await T(e,"unattended_since");if(p===void 0){await I(e,"unattended_since",n);return}const{event:u,heldOnlyBySubscriber:w}=await Ne(e,t.lifecycle),k=u!=="cancel"&&Oe(t.grantee??"app:terminal",n)?0:d;if(!(n-p<k)){if(await h(e,"unattended_since"),u==="release"){await M(e,u),w&&await $e(e),this.teardownBroker(e,a);return}if(u==="cancel"){await M(e,u),this.teardownBroker(e,a);return}if(t.grantee!==void 0&&t.grantee!=="app:terminal"){await M(e,"park"),this.teardownBroker(e,a);return}s.lifecycle.acceptsDetachedWork()&&(await Re(e,n),s.lifecycle.registerDetached(this.requestParkSummary(e,a)))}}async requestParkSummary(e,t){try{const r=await Se(e,Te("park",{},Ie),{origin:{type:"runtime",kind:"park"}});f({level:"info",event:"broker.park.summary_requested",...c(e)?{node_id:e}:{},fields:{...c(e)?{}:{affected_node_id:e},route:r}})}catch(r){if(await A(e)===void 0)return;if(r instanceof Ae){await M(e,"park"),this.teardownBroker(e,t);return}f({level:"error",event:"broker.park.summary_failed",...c(e)?{node_id:e}:{fields:{affected_node_id:e}},error:r})}}async warnOverCapInTmux(e,t,r){const a=Date.now();if(a-this.lastOverCapWarnAt<Ve)return;this.lastOverCapWarnAt=a;const{warning:n,automaticReviveCap:s}=t,d=r.stalled+r.waitingOnMail;f({level:"warn",event:"broker.capacity.warning",fields:{live_count:e,warning_threshold:n,hard_cap:s,frozen_stalled:r.stalled,frozen_waiting_on_mail:r.waitingOnMail}});const l=d===0?"":` \u2014 ${d} frozen (${r.stalled} stalled, ${r.waitingOnMail} waiting on mail)`,o=`\u26A0 crtrd: ${e} live brokers (warning ${n}; hard cap ${s})${l} \u2014 possible broker leak. ps -ax | grep broker-cli.js`;try{const p=await C("tmux",["list-clients","-F","#{client_name}"],{encoding:"utf8",timeout:2e3});if(typeof p.stdout!="string")return;await Promise.allSettled(p.stdout.split(`
1
+ var j=Object.defineProperty;var _=(i,e)=>j(i,"name",{value:e,configurable:!0});import{existsSync as J}from"node:fs";import{LAUNCHER_SOCKET as Q}from"../../launcher/spec.js";import{launcherRequest as X}from"../../launcher/client.js";import{execFile as Z}from"node:child_process";import{promisify as ee}from"node:util";import{getNode as S,isWarmSpare as te,subscribersOf as ne}from"../../core/canvas/index.js";import{isSafeNodeId as c}from"../../core/canvas/paths.js";import{fullName as x}from"../../core/canvas/labels.js";import{recordedPidLiveness as B}from"../../core/canvas/pid.js";import{transition as re}from"../../core/runtime/lifecycle.js";import{hasAdmittedTurn as ae,listUnnotifiedFatalFaultNodes as ie,markFaultNotified as oe,readFault as L,readLiveTurn as F,recordFault as se}from"../../core/canvas/recovery.js";import{errorClassFromFault as de}from"../../core/fault-classifier.js";import{describeVendorLimit as le}from"../../core/provider-failure.js";import{nextFaultRetry as ce}from"../../core/runtime/fault-recovery.js";import{publishNotice as W}from"../../core/runtime/close.js";import{openDb as $,withCanvasWrite as ue}from"../../core/canvas/db.js";import{getById as fe}from"../../core/graph/objects.js";import{watcherIdsOf as pe}from"../../core/graph/watches.js";import{headlessBrokerHost as me}from"../../core/runtime/host.js";import{endExecution as _e,liveExecutionForNode as N,requestExecutionStop as he}from"../../core/canvas/executions.js";import{runnerForExecution as we}from"../../core/runtime/runner/index.js";import{emitEvent as f}from"../../core/events/emit.js";import{operationIdContext as D}from"../../core/events/operation-id.js";import{hasUnseenWakeMail as ke,resetStaleExecutionMail as ge}from"../../core/canvas/deliveries.js";import{runningJobs as ve}from"../../core/graph/jobs.js";import{focusOf as ye}from"../../core/runtime/placement.js";import{hasAttachedBrokerViewers as be}from"../api/viewer-presence.js";import{deliverLive as Se}from"../../core/runtime/interactive-deliver.js";import{BrokerUnreachableError as Ae}from"../../core/runtime/broker-request.js";import{formatCard as Te,PARK_SUMMARY_PROMPT as Ie}from"../../shared/generated-context.js";import{brokerThresholdsForDaemon as Me}from"../../core/runtime/fleet.js";import{readConfig as Pe}from"../../core/config.js";import{beginPendingPark as Re,clearSupervisionMark as h,consumePendingPark as A,pendingParkIds as Ee,pendingParkStartedAt as xe,readSupervisionMark as T,writeSupervisionMark as I}from"../park-pending.js";import{shouldParkAfterSummary as Fe}from"../park-activity.js";import{applyParkEvent as M,noticeUnfinishedIdle as $e,parkVerdict as Ne}from"./live-obligation.js";import{readGoal as De}from"../../core/runtime/kickoff.js";import{memoryDeniedRecently as Oe}from"../../core/runtime/memory-admission.js";import{envNoDaemonAutostart as Ce,envTestUnattendedParkMs as Be,parkSummaryGraceMs as Le,envUnattendedParkMs as We}from"../../shared/env.js";import{KILL_ESCALATE_MS as G,sampleBrokerTree as Ge,wedgeVerdict as Ue,WEDGE_QUIET_MS as O,YIELD_STALL_GRACE_MS as U,yieldStallVerdict as q}from"../../core/runtime/broker-wedge.js";const C=ee(Z);async function qe(i){return!await ae(i)&&((await De(i))?.trim()??"")!==""}_(qe,"awaitsBirthTurn");async function Y(i){const e=await N(i);return e!==null&&e.runner!=="process"&&e.state==="running"?e:null}_(Y,"remoteExecutionOf");async function Ye(i){return(await F(i))?.busy===!0}_(Ye,"liveBusy");async function Dt(i){const e=(await F(i))?.progressAt;if(e==null)return null;const t=Date.parse(e);return Number.isNaN(t)?null:t}_(Dt,"liveTurnProgressMs");function V(i,e){return e===null?null:`${i}:${e}`}_(V,"incarnationOf");async function b(i){const e=await F(i.node_id),t=e?.busy===!0&&e.progressAt!==null?Date.parse(e.progressAt):Number.NaN,r=i.launched_at===null||i.launched_at===void 0?Number.NaN:Date.parse(i.launched_at);return!Number.isFinite(t)||!Number.isFinite(r)||t<r?null:t}_(b,"busySinceForIncarnation");const Ve=5*6e4;function He(i,e){return i===null||i.parent!=null?!1:i.lifecycle==="terminal"?!0:(e==="cap_exhausted"||e==="payment_refused"||e==="all_routes_exhausted")&&i.run_id===i.node_id}_(He,"settlesOnFatalProviderFault");function Ke(){const i=We();if(i!==void 0)return i;const e=Pe("user").lifecycle.unattendedParkMs;return Ce()?Be()??e:e}_(Ke,"unattendedParkMsForDaemon");function H(){return Le()}_(H,"parkSummaryGraceMsForDaemon");function ze(i,e,t,r,a){const n=`Child wedged \u2014 ${i} is alive and mid-turn but has shown NO engine progress for ${e}+ minutes and `;if(t)return n+"its process is near-idle. It will NOT recover on its own \u2014 read `crtr canvas read wedged-child-on-runaway-bash` and kill the runaway SUBPROCESS (not this node) so its turn can resume with no lost context.";const s="it has no subprocess to kill (the engine itself stalled). ";return r?n+s+"The daemon did not SIGTERM the broker because its PID identity cannot be confirmed alive.":a?n+s+"The daemon sent SIGTERM to the broker and will resume a cleanly aborted session with a continuation, or start a recovery cycle if the abort cannot settle.":n+s+"The daemon attempted SIGTERM to the broker, but the signal call failed."}_(ze,"wedgeLabel");async function K(i,e){f({level:"error",event:"broker.wedge.detected",...c(i)?{node_id:i}:{},fields:{...c(i)?{}:{affected_node_id:i},pid:e.pid,quiet_ms:e.quietForMs,cpu_percent:e.cpuPercent,has_descendants:e.hasDescendants,kick_attempted:e.kickAttempted,kicked:e.kicked,...e.kickSuppressionReason===null?{}:{kick_suppression_reason:e.kickSuppressionReason}}});try{await se(i,{link:"daemon\u2192node",op:"engine wedge",kind:"wedged",retry:{disposition:"manual"},message:e.label})}catch(t){f({level:"error",event:"broker.wedge.fault_record_failed",...c(i)?{node_id:i}:{fields:{affected_node_id:i}},error:t})}await W(i,"notice.crash",e.label,{reason:"child-wedged",child:i,quiet_ms:e.quietForMs,cpu_percent:e.cpuPercent,kick_attempted:e.kickAttempted,kicked:e.kicked,...e.kickSuppressionReason===null?{}:{kick_suppression_reason:e.kickSuppressionReason}})}_(K,"reportWedge");class Ot{static{_(this,"BrokerSupervisionReconciler")}yieldTermedAt=new Map;sampleTree;signal;lastOverCapWarnAt=Number.NEGATIVE_INFINITY;constructor(e={}){this.sampleTree=e.readTreeSample??Ge,this.signal=e.signal??((t,r)=>{if(process.platform==="linux"&&J(Q)){if(r!=="SIGTERM"&&r!=="SIGKILL")throw new Error(`unsupported launcher signal ${r}`);return X({operation:"stop",pid:t,signal:r}).then(()=>{})}process.kill(t,r)})}async runFleetPreamble(e){return Me()}warnIfSaturated(e){if(e.fleet.size()<e.thresholds.warning||!e.lifecycle.acceptsDetachedWork())return;const t=D.fresh(()=>this.warnOverCapInTmux(e.fleet.size(),e.thresholds,e.frozen));e.lifecycle.registerDetached(t)}async run(e,t){const r=Ke();for(const a of await ie())await D.fresh(async()=>{try{await this.handleFatalFault(a)}catch(n){f({level:"error",event:"broker.supervision.failed",...c(a)?{node_id:a}:{fields:{affected_node_id:a}},error:n})}});for(const a of t.rows){const n=a.node_id,s=t.fleet.get(n),d=s===void 0?await Y(n):null;if(s===void 0&&d===null||a.status!=="active"&&a.status!=="idle"){await h(n,"unattended_since");continue}await D.fresh(async()=>{try{s!==void 0?(await this.handleYieldStall(a,s,t.fleet,e),await this.handleWedgeDetection(a,s,t.fleet,e)):d.runner==="blaxel"&&(await this.handleRemoteYieldStall(a,d,e),await this.handleRemoteWedge(a,d,e)),await this.handleUnattendedParking(n,await S(n),s?.pid??d.pid,d,e,t,r)}catch(l){await h(n,"unattended_since"),f({level:"error",event:"broker.supervision.failed",...c(n)?{node_id:n}:{fields:{affected_node_id:n}},error:l})}})}for(const a of await Ee())await t.fleet.has(a)||await A(a);await ge(e)}async parkResetCondition(e,t,r,a){if(t.pi_session_id==null||t.pi_pid!==r||t.status==="done"||t.status==="canceled"||t.status==="dead"||t.intent!==null||(await ve(await $(),e)).length>0||await ye(e)!==null||await be(e))return!0;const n=await L(e);return n!==null&&n.retry.disposition==="auto"&&n.retry.by==="daemon"&&(n.kind==="connection"||n.kind==="rate-limit"||n.kind==="overloaded")&&(n.retry.nextAt!==void 0||ce(n,a)!==null)?!0:await ke(e)}async handleUnattendedParking(e,t,r,a,n,s,d){if(await te(e)){await h(e,"unattended_since"),await A(e);return}if(t===null){await h(e,"unattended_since"),await A(e);return}const l=await this.parkResetCondition(e,t,r,n),o=await xe(e);if(o!==void 0){if(n-o<H())return;const v=await A(e);if(v===void 0||(await h(e,"unattended_since"),!await Fe(e,t,v)))return;f({level:"warn",event:"broker.park.summary_expired",...c(e)?{node_id:e}:{},fields:{...c(e)?{}:{affected_node_id:e},grace_ms:H()}}),await M(e,"park"),this.teardownBroker(e,a);return}if(l||await Ye(e)||await qe(e)){await h(e,"unattended_since");return}const p=await T(e,"unattended_since");if(p===void 0){await I(e,"unattended_since",n);return}const{event:u,heldOnlyBySubscriber:w}=await Ne(e,t.lifecycle),k=u!=="cancel"&&Oe(t.grantee??"app:terminal",n)?0:d;if(!(n-p<k)){if(await h(e,"unattended_since"),u==="release"){await M(e,u),w&&await $e(e),this.teardownBroker(e,a);return}if(u==="cancel"){await M(e,u),this.teardownBroker(e,a);return}if(t.grantee!==void 0&&t.grantee!=="app:terminal"){await M(e,"park"),this.teardownBroker(e,a);return}s.lifecycle.acceptsDetachedWork()&&(await Re(e,n),s.lifecycle.registerDetached(this.requestParkSummary(e,a)))}}async requestParkSummary(e,t){try{const r=await Se(e,Te("park",{},Ie),{origin:{type:"runtime",kind:"park"}});f({level:"info",event:"broker.park.summary_requested",...c(e)?{node_id:e}:{},fields:{...c(e)?{}:{affected_node_id:e},route:r}})}catch(r){if(await A(e)===void 0)return;if(r instanceof Ae){await M(e,"park"),this.teardownBroker(e,t);return}f({level:"error",event:"broker.park.summary_failed",...c(e)?{node_id:e}:{fields:{affected_node_id:e}},error:r})}}async warnOverCapInTmux(e,t,r){const a=Date.now();if(a-this.lastOverCapWarnAt<Ve)return;this.lastOverCapWarnAt=a;const{warning:n,automaticReviveCap:s}=t,d=r.stalled+r.waitingOnMail;f({level:"warn",event:"broker.capacity.warning",fields:{live_count:e,warning_threshold:n,hard_cap:s,frozen_stalled:r.stalled,frozen_waiting_on_mail:r.waitingOnMail}});const l=d===0?"":` \u2014 ${d} frozen (${r.stalled} stalled, ${r.waitingOnMail} waiting on mail)`,o=`\u26A0 crtrd: ${e} live brokers (warning ${n}; hard cap ${s})${l} \u2014 possible broker leak. ps -ax | grep broker-cli.js`;try{const p=await C("tmux",["list-clients","-F","#{client_name}"],{encoding:"utf8",timeout:2e3});if(typeof p.stdout!="string")return;await Promise.allSettled(p.stdout.split(`
2
2
  `).map(async u=>{if(u!=="")try{await C("tmux",["display-message","-C","-d","10000","-c",u,o],{encoding:"utf8",timeout:2e3})}catch{try{await C("tmux",["display-message","-c",u,o],{encoding:"utf8",timeout:2e3})}catch(w){f({level:"error",event:"broker.capacity.tmux_display_failed",error:w,fields:{client:u}})}}}))}catch(p){f({level:"error",event:"broker.capacity.tmux_list_clients_failed",error:p})}}async teardownBroker(e,t){return t===null?await me.teardown(e):await this.stopRemote(t,"teardown")}async stopRemote(e,t){await he(e.nodeId,{afterTurn:!1,reason:t});const r=await we(e.runner).stop(e,{reason:t});return r.confirmed?await _e(e.executionId,{reason:t}):f({level:"error",event:"broker.teardown.unconfirmed",node_id:e.nodeId,error:r.error}),r}async handleRemoteYieldStall(e,t,r){const a=e.node_id;if(e.intent!=="refresh"&&e.cycle_pending!==!0||await b(e)!==null){await h(a,"stall_noticed_at");return}const n=await T(a,"stall_noticed_at");if(n===void 0){await I(a,"stall_noticed_at",r);return}q(!0,!1,r-n)==="kill"&&(await N(a))?.executionId===t.executionId&&(f({level:"warn",event:"broker.yield_stall.remote_stop",...c(a)?{node_id:a}:{},fields:{...c(a)?{}:{affected_node_id:a},execution_id:t.executionId,elapsed_ms:r-n,grace_ms:U}}),await this.stopRemote(t,"yield_stall"))}async handleRemoteWedge(e,t,r){const a=e.node_id,n=await b(e);if(n===null){await h(a,"wedge_noticed_at");return}const s=r-n;if(s<O)return;const d=await S(a);if(d===null||(await N(a))?.executionId!==t.executionId||await b(d)!==n||await T(a,"wedge_noticed_at")===n)return;await I(a,"wedge_noticed_at",n);const l=Math.round(s/6e4);await K(a,{quietForMs:s,cpuPercent:null,hasDescendants:null,kickAttempted:!1,kicked:!1,kickSuppressionReason:"remote_no_process_evidence",pid:t.pid,label:`Child wedged \u2014 ${x(d)} (${a}) runs in a sandbox and is mid-turn but has shown NO engine progress for ${l}+ minutes. The daemon cannot see its processes there, so it did not stop the broker; if it is not running a long command, interrupt or close it.`})}async handleYieldStall(e,t,r,a){const n=e.node_id,s=V(t.pid,e.pi_pid_identity);if(e.intent!=="refresh"&&e.cycle_pending!==!0||await b(e)!==null||s===null){await h(n,"stall_noticed_at"),s!==null&&this.yieldTermedAt.delete(s);return}const d=await T(n,"stall_noticed_at");if(d===void 0){await I(n,"stall_noticed_at",a);return}const l={since:d,termedAt:this.yieldTermedAt.get(s)};if(q(!0,!1,a-l.since)!=="kill")return;const o=await S(n);if(!(r.get(n)!==t||o?.pi_pid!==t.pid||o.pi_pid_identity!==e.pi_pid_identity||B(t.pid,e.pi_pid_identity)!=="alive"))if(l.termedAt===void 0){if(!await this.signalYieldStall(n,t.pid,"SIGTERM"))return;this.yieldTermedAt.set(s,a),l.termedAt=a,f({level:"warn",event:"broker.yield_stall.sigterm",...c(n)?{node_id:n}:{},fields:{...c(n)?{}:{affected_node_id:n},pid:t.pid,elapsed_ms:a-l.since,grace_ms:U}})}else a-l.termedAt>=G&&await this.signalYieldStall(n,t.pid,"SIGKILL")&&f({level:"warn",event:"broker.yield_stall.sigkill",...c(n)?{node_id:n}:{},fields:{...c(n)?{}:{affected_node_id:n},pid:t.pid,elapsed_ms:a-l.termedAt,grace_ms:G,stall_elapsed_ms:a-l.since}})}async signalYieldStall(e,t,r){try{return await this.signal(t,r),!0}catch(a){return f({level:"error",event:"broker.yield_stall.signal_failed",...c(e)?{node_id:e}:{},error:a,fields:{...c(e)?{}:{affected_node_id:e},pid:t,signal:r}}),!1}}async handleWedgeDetection(e,t,r,a){const n=e.node_id,s=V(t.pid,e.pi_pid_identity),d=await b(e);if(d===null||s===null){await h(n,"wedge_noticed_at");return}const l=a-d,o=l>=O?await this.sampleTree(t.pid):null,p=await S(n),u=p===null?null:await b(p);if(r.get(n)!==t||p===null||p.pi_pid!==t.pid||p.pi_pid_identity!==e.pi_pid_identity||u!==d)return;const w=o?.cpuPercent??null,k=o?.hasDescendants??null;if(Ue({busy:!0,quietForMs:l,cpuPercent:w,hasDescendants:k})!=="wedged"||await T(n,"wedge_noticed_at")===d)return;await I(n,"wedge_noticed_at",d);const v=x(p),E=Math.round((l??O)/6e4),g=k??!0,y=!g&&B(t.pid,e.pi_pid_identity)!=="alive"?"pid_identity_unproven":null;let P=!1,m=!1;if(!g&&y===null){P=!0;try{await this.signal(t.pid,"SIGTERM"),m=!0}catch(z){f({level:"error",event:"broker.wedge.signal_failed",...c(n)?{node_id:n}:{},error:z,fields:{...c(n)?{}:{affected_node_id:n},pid:t.pid,signal:"SIGTERM"}})}}const R=ze(`${v} (${n})`,E,g,y!==null,m);await K(n,{quietForMs:l,cpuPercent:w,hasDescendants:g,kickAttempted:P,kicked:m,kickSuppressionReason:y,pid:t.pid,label:R})}async handleFatalFault(e,t=!0){const r=await L(e);if(r===null||r.retry.disposition!=="fatal"||r.link!=="pi\u2192provider"||r.notifiedSince===r.since)return;const a=await S(e),n=await Y(e),s=a!==null?x(a):e,d=r.kind==="auth",l=(r.message.split(`
3
3
  `)[0]??"").slice(0,200),o=r.providerError,p=o===void 0?"":` Provider: ${o.provider}/${o.model}.`+(o.status===void 0?"":` HTTP status: ${o.status}.`)+(o.errno===void 0?"":` Errno: ${o.errno}.`)+(o.code===void 0?"":` Code: ${o.code}.`)+(o.body===void 0?"":` Body: ${o.body.slice(0,200)}.`)+(r.retry.nextAt===void 0?"":` Next router probe: ${r.retry.nextAt}.`)+le(o),u=r.kind==="context-overflow",w=He(a,typeof o?.code=="string"?o.code:void 0),k=u||w,v=u?`exceeded its model context window and is now dead. Shrink the task or loaded context, or choose a larger-context model before spawning it again. Error: ${l}`:`got a non-retryable ${r.kind} error and will NOT recover on its own; `+(w?"its terminal run has failed. ":"it stays alive, and waking it clears the fault as soon as one turn completes \u2014 a wake that hits the same cause fails again. "+(d?"Its provider credential is dead \u2014 re-authenticate (`/login`, or re-auth crtr); it recovers on its next wake once the auth reloads. ":""))+`Error: ${l}.${p}`,E=u?"failed":"hit a fatal provider fault",g=new Set((await ne(e)).map(m=>m.node_id)),y=await pe(await $(),await fe(await $(),e)),P=[{relation:"Child",recipients:y.filter(m=>g.has(m))},{relation:"Watched node",recipients:y.filter(m=>!g.has(m))}];f({level:"error",event:"fault.fatal.fanout",...c(e)?{node_id:e}:{},fields:{...c(e)?{}:{affected_node_id:e},kind:r.kind,link:r.link,terminal_overflow:u,terminal_provider_fault:w}}),await ue(async()=>{for(const{relation:m,recipients:R}of P)R.length!==0&&await W(e,"notice.crash",`${m} ${E} \u2014 ${s} (${e}) ${v}`,{reason:u?"child-context-overflow":"child-fault-fatal",child:e,kind:r.kind,message:l,...o===void 0?{}:{provider_error:o}},"normal",null,R);await oe(r.faultId),t&&k&&await re(e,"crash",{reason:u?"context_overflow":o?.code==="cap_exhausted"?"cap_exhausted":"provider_fatal",outcome:{detail:{schema:"crtr.node-outcome-detail/v1",message:r.message,fault_kind:r.kind,error_class:de(r).class,...typeof o?.code=="string"?{provider_code:o.code}:{},...o?.payment===void 0?{}:{payment:o.payment}}}})}),t&&k&&this.teardownBroker(e,n).then(m=>{m.confirmed||f({level:"error",event:"fault.fatal.teardown_failed",node_id:e,error:m.error??new Error("Broker teardown not confirmed")})},m=>f({level:"error",event:"fault.fatal.teardown_failed",node_id:e,error:m}))}}export{Ot as BrokerSupervisionReconciler,H as parkSummaryGraceMsForDaemon,K as reportWedge,He as settlesOnFatalProviderFault,Ke as unattendedParkMsForDaemon,ze as wedgeLabel};
@@ -1,8 +1,6 @@
1
1
  import { type NodeRow } from '../../core/canvas/index.js';
2
2
  export interface ControllerDeathContext {
3
3
  rows: readonly NodeRow[];
4
- /** Nodes of a committed, not yet `done` import run: their waits are verified rows and stay as imported. */
5
- held: ReadonlySet<string>;
6
4
  }
7
5
  export declare class ControllerDeathReconciler {
8
6
  run(now: number, ctx: ControllerDeathContext): Promise<void>;
@@ -1 +1 @@
1
- var a=Object.defineProperty;var r=(t,o)=>a(t,"name",{value:o,configurable:!0});import{liveControllerWaits as i}from"../../core/canvas/waits.js";import{operationIdContext as l}from"../../core/events/operation-id.js";import{enqueueControllerDeathNotice as c}from"../../core/feed/messages.js";class h{static{r(this,"ControllerDeathReconciler")}async run(o,n){for(const e of await i())n.held.has(e.nodeId)||await l.fresh(async()=>{await c(e.nodeId,e.controllerId)})}}export{h as ControllerDeathReconciler};
1
+ var a=Object.defineProperty;var e=(t,o)=>a(t,"name",{value:o,configurable:!0});import{liveControllerWaits as i}from"../../core/canvas/waits.js";import{operationIdContext as n}from"../../core/events/operation-id.js";import{enqueueControllerDeathNotice as l}from"../../core/feed/messages.js";class p{static{e(this,"ControllerDeathReconciler")}async run(o,c){for(const r of await i())await n.fresh(async()=>{await l(r.nodeId,r.controllerId)})}}export{p as ControllerDeathReconciler};
@@ -1,7 +1,6 @@
1
1
  import type { DetachedWorkLifecycle } from './broker-supervision.js';
2
2
  export interface CronLaneContext {
3
3
  lifecycle: DetachedWorkLifecycle;
4
- held: ReadonlySet<string>;
5
4
  }
6
5
  export declare class CronLaneReconciler {
7
6
  run(now: number, ctx: CronLaneContext): Promise<void>;
@@ -1 +1 @@
1
- var c=Object.defineProperty;var o=(i,r)=>c(i,"name",{value:r,configurable:!0});import{emitEvent as a}from"../../core/events/emit.js";import{operationIdContext as n}from"../../core/events/operation-id.js";import{sweepOrphanCronFolders as l}from"../cron/folders.js";import{reapRebuiltCronExecutions as s}from"../cron/run-socket.js";import{recoverStaleCronLeases as f,runDueCrons as p}from"../cron-run.js";import{isDrained as d}from"../drain.js";import{runThrottledLane as m}from"./throttled-lane.js";class g{static{o(this,"CronLaneReconciler")}async run(r,t){await n.fresh(async()=>{try{await f(r,{register:o(e=>t.lifecycle.registerDetached(e),"register")})}catch(e){a({level:"error",event:"cron.lease_recovery.failed",error:e})}});try{await s()}catch(e){a({level:"error",event:"cron.execution.reap_failed",error:e})}try{await m("cron-folder-sweep","",r,6e4,6e4,async()=>{await l()})}catch(e){a({level:"error",event:"cron.folder.sweep_failed",error:e})}if(t.lifecycle.acceptsDetachedWork()&&!await d())try{await p(r,{register:o(e=>t.lifecycle.registerDetached(e),"register"),held:t.held})}catch(e){a({level:"error",event:"cron.run.failed",error:e})}}}export{g as CronLaneReconciler};
1
+ var c=Object.defineProperty;var t=(i,e)=>c(i,"name",{value:e,configurable:!0});import{emitEvent as o}from"../../core/events/emit.js";import{operationIdContext as n}from"../../core/events/operation-id.js";import{sweepOrphanCronFolders as l}from"../cron/folders.js";import{reapRebuiltCronExecutions as s}from"../cron/run-socket.js";import{recoverStaleCronLeases as f,runDueCrons as p}from"../cron-run.js";import{isDrained as m}from"../drain.js";import{runThrottledLane as d}from"./throttled-lane.js";class g{static{t(this,"CronLaneReconciler")}async run(e,a){await n.fresh(async()=>{try{await f(e,{register:t(r=>a.lifecycle.registerDetached(r),"register")})}catch(r){o({level:"error",event:"cron.lease_recovery.failed",error:r})}});try{await s()}catch(r){o({level:"error",event:"cron.execution.reap_failed",error:r})}try{await d("cron-folder-sweep","",e,6e4,6e4,async()=>{await l()})}catch(r){o({level:"error",event:"cron.folder.sweep_failed",error:r})}if(a.lifecycle.acceptsDetachedWork()&&!await m())try{await p(e,{register:t(r=>a.lifecycle.registerDetached(r),"register")})}catch(r){o({level:"error",event:"cron.run.failed",error:r})}}}export{g as CronLaneReconciler};
@@ -13,17 +13,12 @@ export declare function hasLiveObligation(nodeId: string): Promise<boolean>;
13
13
  * Deferred mail deliberately does not count: it rides the node's next natural
14
14
  * cycle rather than causing one. */
15
15
  export declare function hasPendingWake(nodeId: string): Promise<boolean>;
16
- /** The nodes of an import run that has committed but is not `done` (see `nodesAwaitingVerify`). The fleet does nothing to them: the supervision tick drops them from every
17
- * lane that reads node rows, and the lanes that read other tables (deadlines, controller waits, structured requests, fatal faults, placement residue, retention) test this set. */
18
- export declare function importedNodesHeld(): Promise<ReadonlySet<string>>;
19
16
  /** The retention sweep's hold: a node with a launch claim, durable work that
20
17
  * must wake it, or a person looking at it is never pruned, whatever its age.
21
18
  * Unseen mail is deliberately not a hold: it never wakes a terminal node, and
22
19
  * children keep writing a finished manager's inbox, so it would retain most
23
20
  * finished history forever. The stale sweep checks unseen mail itself.
24
- *
25
- * A node a committed import run inserted is also held until that run's verify has compared it. The import drops the waits on machine-homed
26
- * objects, so an imported finished node can be past retention at once, and deleting a run root cascades its `run_events` under verify. */
21
+ */
27
22
  export declare function retentionHold(fleet: Pick<FleetRegistry, 'isClaimed'>): Promise<(nodeId: string) => Promise<boolean>>;
28
23
  /** Whether a person is looking at this node right now: a focused viewer pane,
29
24
  * or a broker client that declared itself attending. A client that hellos with
@@ -1 +1 @@
1
- var w=Object.defineProperty;var i=(t,e)=>w(t,"name",{value:e,configurable:!0});import{getNode as h,hasActiveLiveSubscription as m,hasLiveSubscriber as y,hasPendingCronWake as g}from"../../core/canvas/index.js";import{fullName as l}from"../../core/canvas/labels.js";import{hasLiveControllerWait as b,hasLiveObjectWait as k}from"../../core/canvas/waits.js";import{newestReportName as v}from"../../core/feed/reports.js";import{countTickets as x}from"../../core/canvas/attention.js";import{hasUnseenWakeMail as s}from"../../core/canvas/deliveries.js";import{readOutputRequest as $}from"../../core/runtime/output-result.js";import{focusOf as d}from"../../core/runtime/placement.js";import{hasAttachedBrokerViewers as O}from"../api/viewer-presence.js";import{publishNotice as u}from"../../core/runtime/close.js";import{readFault as L}from"../../core/canvas/recovery.js";import{transition as f}from"../../core/runtime/lifecycle.js";import{openDb as N}from"../../core/canvas/db.js";import{nodesAwaitingVerify as W}from"../../core/import/load/copy.js";async function o(t){return await m(t)||await b(t)||await k(t)||await g(t)||await x(t)>0||await $(t)!==null}i(o,"hasLiveObligation");async function G(t){return await o(t)||await s(t)?!0:await c(t)}i(G,"hasPendingWake");async function A(){return await W(await N())}i(A,"importedNodesHeld");async function J(t){const e=await A();return async a=>e.has(a)||await t.isClaimed(a)||await o(a)||await c(a)}i(J,"retentionHold");async function c(t,e){return(e!==void 0?e.live!==null:await d(t)!==null)||await O(t)}i(c,"hasHumanViewer");async function K(t,e,a){return(await C(t,e,a)).event}i(K,"parkEvent");async function C(t,e,a){const r=i(p=>({event:p,heldOnlyBySubscriber:!1}),"held");if(await c(t,a)||await o(t))return r("release");const n=await L(t);return n?.link==="pi\u2192provider"&&n.retry.disposition==="fatal"?r("release"):e==="resident"?r(await s(t)?"release":"park"):await s(t)?r("release"):await y(t)?{event:"release",heldOnlyBySubscriber:!0}:r("cancel")}i(C,"parkVerdict");async function Q(t,e){const a=e==="cancel"?await f(t,e,{reason:"stranded"}):await f(t,e);if(e!=="park")return;const r=await v(t),n=r===null?`It left no report behind; \`crtr node inspect show ${t}\` shows where it stands.`:`Its latest report is where it left things: \`crtr canvas read ${r}\`.`;await u(t,"notice.close",`Resident concluded \u2014 ${l(a)} (${t}) had nothing left to wake it through its unattended grace, so its conversation was concluded. It submitted no final report. ${n} A message to it reopens it on a fresh cycle.`,{reason:"child-auto-done",child:t},"deferred")}i(Q,"applyParkEvent");async function X(t){const e=await h(t);e!==null&&await u(t,"notice.crash",`Child went idle unfinished \u2014 ${l(e)} (${t}) stopped without pushing a final report and has no wait that will wake it. Its engine was released; the cause is not recorded. \`crtr node inspect show ${t}\` shows where it stands; a message to it revives it.`,{reason:"child-idle-unfinished",child:t},"urgent")}i(X,"noticeUnfinishedIdle");export{Q as applyParkEvent,c as hasHumanViewer,o as hasLiveObligation,G as hasPendingWake,A as importedNodesHeld,X as noticeUnfinishedIdle,K as parkEvent,C as parkVerdict,J as retentionHold};
1
+ var w=Object.defineProperty;var a=(t,e)=>w(t,"name",{value:e,configurable:!0});import{getNode as h,hasActiveLiveSubscription as m,hasLiveSubscriber as y,hasPendingCronWake as g}from"../../core/canvas/index.js";import{fullName as l}from"../../core/canvas/labels.js";import{hasLiveControllerWait as k,hasLiveObjectWait as b}from"../../core/canvas/waits.js";import{newestReportName as v}from"../../core/feed/reports.js";import{countTickets as x}from"../../core/canvas/attention.js";import{hasUnseenWakeMail as s}from"../../core/canvas/deliveries.js";import{readOutputRequest as $}from"../../core/runtime/output-result.js";import{focusOf as O}from"../../core/runtime/placement.js";import{hasAttachedBrokerViewers as d}from"../api/viewer-presence.js";import{publishNotice as u}from"../../core/runtime/close.js";import{readFault as L}from"../../core/canvas/recovery.js";import{transition as f}from"../../core/runtime/lifecycle.js";async function o(t){return await m(t)||await k(t)||await b(t)||await g(t)||await x(t)>0||await $(t)!==null}a(o,"hasLiveObligation");async function F(t){return await o(t)||await s(t)?!0:await c(t)}a(F,"hasPendingWake");async function M(t){return async e=>await t.isClaimed(e)||await o(e)||await c(e)}a(M,"retentionHold");async function c(t,e){return(e!==void 0?e.live!==null:await O(t)!==null)||await d(t)}a(c,"hasHumanViewer");async function T(t,e,r){return(await W(t,e,r)).event}a(T,"parkEvent");async function W(t,e,r){const i=a(p=>({event:p,heldOnlyBySubscriber:!1}),"held");if(await c(t,r)||await o(t))return i("release");const n=await L(t);return n?.link==="pi\u2192provider"&&n.retry.disposition==="fatal"?i("release"):e==="resident"?i(await s(t)?"release":"park"):await s(t)?i("release"):await y(t)?{event:"release",heldOnlyBySubscriber:!0}:i("cancel")}a(W,"parkVerdict");async function z(t,e){const r=e==="cancel"?await f(t,e,{reason:"stranded"}):await f(t,e);if(e!=="park")return;const i=await v(t),n=i===null?`It left no report behind; \`crtr node inspect show ${t}\` shows where it stands.`:`Its latest report is where it left things: \`crtr canvas read ${i}\`.`;await u(t,"notice.close",`Resident concluded \u2014 ${l(r)} (${t}) had nothing left to wake it through its unattended grace, so its conversation was concluded. It submitted no final report. ${n} A message to it reopens it on a fresh cycle.`,{reason:"child-auto-done",child:t},"deferred")}a(z,"applyParkEvent");async function D(t){const e=await h(t);e!==null&&await u(t,"notice.crash",`Child went idle unfinished \u2014 ${l(e)} (${t}) stopped without pushing a final report and has no wait that will wake it. Its engine was released; the cause is not recorded. \`crtr node inspect show ${t}\` shows where it stands; a message to it revives it.`,{reason:"child-idle-unfinished",child:t},"urgent")}a(D,"noticeUnfinishedIdle");export{z as applyParkEvent,c as hasHumanViewer,o as hasLiveObligation,F as hasPendingWake,D as noticeUnfinishedIdle,T as parkEvent,W as parkVerdict,M as retentionHold};
@@ -1,8 +1,7 @@
1
1
  import { type RowClaim } from './row-claim.js';
2
2
  /** Enforce absolute spawn deadlines independently of the tick's live-row scan. */
3
3
  export declare class NodeDeadlineReconciler {
4
- /** `held`: nodes of a committed, not yet `done` import run, which the fleet leaves alone. */
5
- run(now: number, held: ReadonlySet<string>): Promise<void>;
4
+ run(now: number): Promise<void>;
6
5
  }
7
6
  /** The one deadline terminalization path. Structured-request expiry reuses it
8
7
  * even when a profile is paused, because its dedicated broker must not resume. */
@@ -1 +1 @@
1
- var m=Object.defineProperty;var c=(r,a)=>m(r,"name",{value:a,configurable:!0});import{dueNodeDeadlines as w,getNode as u}from"../../core/canvas/index.js";import{emitEvent as d}from"../../core/events/emit.js";import{isProfilePaused as p}from"../../core/profiles/manifest.js";import{operationIdContext as h}from"../../core/events/operation-id.js";import{errorClassFromFault as v}from"../../core/fault-classifier.js";import{publishNotice as x}from"../../core/runtime/close.js";import{readFault as y}from"../../core/canvas/recovery.js";import{requestBrokerTeardown as _}from"../../core/runtime/host.js";import{transition as D}from"../../core/runtime/lifecycle.js";import{withRowClaim as N}from"./row-claim.js";const O=6e4;class z{static{c(this,"NodeDeadlineReconciler")}async run(a,n){let t;try{t=await w(new Date(a).toISOString())}catch(e){d({level:"error",event:"node_deadline.scan_failed",error:e});return}for(const e of t)n.has(e.node_id)||p(e.profile_id)||e.deadline_at===null||e.deadline_at===void 0||h.fresh(()=>{N("nodes",e.node_id,O,i=>k(e.node_id,e.deadline_at,a,i)).catch(i=>{d({level:"error",event:"node_deadline.expire_failed",node_id:e.node_id,error:i,fields:{deadline_at:e.deadline_at}})})})}}async function k(r,a,n,t){await t?.assertOwned();const e=await u(r);if(e===null||e.status==="done")return;if(e.status==="canceled"||e.status==="dead"){await t?.assertOwned();const o=await _(r);if(!o.confirmed)throw o.error??new Error("broker teardown was not confirmed");return}const i=await y(r),l=i?.retry.disposition==="fatal"?i:null;let s;await t?.assertOwned();try{s=await D(r,"cancel",{reason:"deadline_exceeded",outcome:{detail:{schema:"crtr.node-outcome-detail/v1",deadline:{deadline_at:a,elapsed_ms:n-Date.parse(a)},...l===null?{}:{message:l.message,fault_kind:l.kind,error_class:v(l).class}}}})}catch(o){throw d({level:"error",event:"node_deadline.terminalize_failed",node_id:r,error:o,fields:{deadline_at:a}}),o}if(s.status!=="canceled"||s.outcome_reason!=="deadline_exceeded")return;await t?.assertOwned();const f=await _(r);if(!f.confirmed)throw f.error??new Error("broker teardown was not confirmed");await t?.assertOwned();try{await x(r,"notice.deadline","child-deadline-exceeded",{reason:"child-deadline-exceeded",child:r})}catch(o){d({level:"error",event:"node_deadline.notify_failed",node_id:r,error:o,fields:{deadline_at:a}})}try{d({level:"error",event:"node_deadline.expired",node_id:r,fields:{deadline_at:a,elapsed_ms:n-Date.parse(a)}})}catch{}}c(k,"expireNodeDeadline");export{z as NodeDeadlineReconciler,k as expireNodeDeadline};
1
+ var m=Object.defineProperty;var s=(r,t)=>m(r,"name",{value:t,configurable:!0});import{dueNodeDeadlines as w,getNode as u}from"../../core/canvas/index.js";import{emitEvent as d}from"../../core/events/emit.js";import{isProfilePaused as p}from"../../core/profiles/manifest.js";import{operationIdContext as h}from"../../core/events/operation-id.js";import{errorClassFromFault as v}from"../../core/fault-classifier.js";import{publishNotice as x}from"../../core/runtime/close.js";import{readFault as y}from"../../core/canvas/recovery.js";import{requestBrokerTeardown as _}from"../../core/runtime/host.js";import{transition as D}from"../../core/runtime/lifecycle.js";import{withRowClaim as N}from"./row-claim.js";const O=6e4;class z{static{s(this,"NodeDeadlineReconciler")}async run(t){let i;try{i=await w(new Date(t).toISOString())}catch(e){d({level:"error",event:"node_deadline.scan_failed",error:e});return}for(const e of i)p(e.profile_id)||e.deadline_at===null||e.deadline_at===void 0||h.fresh(()=>{N("nodes",e.node_id,O,a=>k(e.node_id,e.deadline_at,t,a)).catch(a=>{d({level:"error",event:"node_deadline.expire_failed",node_id:e.node_id,error:a,fields:{deadline_at:e.deadline_at}})})})}}async function k(r,t,i,e){await e?.assertOwned();const a=await u(r);if(a===null||a.status==="done")return;if(a.status==="canceled"||a.status==="dead"){await e?.assertOwned();const o=await _(r);if(!o.confirmed)throw o.error??new Error("broker teardown was not confirmed");return}const c=await y(r),n=c?.retry.disposition==="fatal"?c:null;let l;await e?.assertOwned();try{l=await D(r,"cancel",{reason:"deadline_exceeded",outcome:{detail:{schema:"crtr.node-outcome-detail/v1",deadline:{deadline_at:t,elapsed_ms:i-Date.parse(t)},...n===null?{}:{message:n.message,fault_kind:n.kind,error_class:v(n).class}}}})}catch(o){throw d({level:"error",event:"node_deadline.terminalize_failed",node_id:r,error:o,fields:{deadline_at:t}}),o}if(l.status!=="canceled"||l.outcome_reason!=="deadline_exceeded")return;await e?.assertOwned();const f=await _(r);if(!f.confirmed)throw f.error??new Error("broker teardown was not confirmed");await e?.assertOwned();try{await x(r,"notice.deadline","child-deadline-exceeded",{reason:"child-deadline-exceeded",child:r})}catch(o){d({level:"error",event:"node_deadline.notify_failed",node_id:r,error:o,fields:{deadline_at:t}})}try{d({level:"error",event:"node_deadline.expired",node_id:r,fields:{deadline_at:t,elapsed_ms:i-Date.parse(t)}})}catch{}}s(k,"expireNodeDeadline");export{z as NodeDeadlineReconciler,k as expireNodeDeadline};
@@ -9,8 +9,6 @@ export interface StorageMaintenanceContext {
9
9
  lifecycle: DetachedWorkLifecycle;
10
10
  /** A live engine handle is the sweep's proof that a node is NOT disposable. */
11
11
  fleet: FleetRegistry;
12
- /** Nodes of a committed, not yet `done` import run: no residue reap, retention prune or context strip. */
13
- held: ReadonlySet<string>;
14
12
  }
15
13
  /** Recurring storage cleanup. Each sweep's throttle and overlap guard is a `reconciler_leases` row (`runThrottledLane`),
16
14
  * so two reconciler processes never run one sweep at once and a restart does not repeat a sweep early. */
@@ -1 +1 @@
1
- var A=Object.defineProperty;var u=(y,e)=>A(y,"name",{value:e,configurable:!0});import{rm as N}from"node:fs/promises";import{closeFocusRow as T,getFocusById as P,listFocuses as C,listNodes as D}from"../../core/canvas/index.js";import{pruneExpiredIdempotencyKeys as x}from"../../core/runs/operations.js";import{getNode as g,lastActivityMs as p,listTerminalPlacementResidue as F,pruneExpiredCreateRequests as M,pruneNodes as b}from"../../core/canvas/canvas.js";import{lastContextStripMs as L,stripContextDir as W}from"../../core/canvas/context-strip.js";import{isAppRun as G}from"../../core/canvas/app-run.js";import{isSafeNodeId as l}from"../../core/canvas/paths.js";import{emitEvent as n}from"../../core/events/emit.js";import{operationIdContext as s}from"../../core/events/operation-id.js";import{listLivePanesAsync as V,tearDownNode as k}from"../../core/runtime/placement.js";import{reapStaleSpares as q}from"../../core/runtime/warm-pool.js";import{GroveInstanceSweepReconciler as O}from"./grove-instance-sweep.js";import{ManagedWorktreeSweepReconciler as U}from"./managed-worktree-sweep.js";import{compactRunEvents as H}from"../../core/runs/events.js";import{archiveExpiredRunEvents as Y}from"../../core/events/run-event-chunks.js";import{blobStore as S}from"../../core/blobs/index.js";import{sweepFailedUploads as $}from"../../core/import/load/blobs.js";import{runThrottledLane as d}from"./throttled-lane.js";import{openDb as m}from"../../core/canvas/db.js";import{retentionHold as v}from"./live-obligation.js";import{deleteQuietNodeSandboxes as z}from"../../core/runtime/runner/delete-sandboxes.js";import{pruneMemoryReads as B}from"../../core/canvas/memory-reads.js";import{existsSync as K}from"node:fs";import{launcherRequest as Q}from"../../launcher/client.js";import{LAUNCHER_SOCKET as X}from"../../launcher/spec.js";import{cachePassDue as Z}from"../../launcher/limits/policy.js";const j=10*6e4,h=60*1e3,E=60*1e3,w=5*6e4,R=2,J=1440*6e4,ee=2e3,te=6e4;class Ce{static{u(this,"StorageMaintenanceReconciler")}focusGcInFlight=!1;lastCachePassAt=null;cachePassInFlight=!1;worktreeSweep=new U;groveInstanceSweep=new O;async run(e,r){await this.reapDeadResidue(e,r.held),this.scheduleFocusGc(r),await this.gcWarmPool(e),await this.gcCreateRequests(e),await this.gcViewerAttachments(e);try{await d("run-event-maintenance","",e,ee,te,async t=>{await Y(await S(),e);const a=await H(e,t.state===null?0:Number(t.state));await t.save(String(a.cursor))})}catch(t){console.warn(`run event maintenance failed: ${String(t)}`)}await d("memory-read-prune","",e,60*6e4,10*6e4,async()=>{try{await B(e)}catch(t){console.warn(`memory-read log prune failed: ${String(t)}`)}}),await d("import-failed-upload-sweep","",e,60*6e4,10*6e4,async()=>{try{await $(await m(),await S(),e)}catch(t){console.warn(`failed import upload sweep failed: ${String(t)}`)}}),await d("storage-analyze","",e,1440*6e4,10*6e4,async()=>{await(await m()).exec("ANALYZE")}),await this.sweepRetention(e,r),this.scheduleCachePass(e,r),this.scheduleContextStrip(e,r),this.worktreeSweep.run(e,r),this.groveInstanceSweep.run(e,r)}scheduleCachePass(e,r){this.cachePassInFlight||!Z(this.lastCachePassAt,e)||process.platform!=="linux"||!K(X)||r.lifecycle.acceptsDetachedWork()&&(this.lastCachePassAt=e,this.cachePassInFlight=!0,r.lifecycle.registerDetached(Q({operation:"cache.purge"}).then(()=>{}).catch(t=>{s.fresh(()=>{n({level:"warn",event:"app.cache.pass_failed",error:t})})}).then(()=>{this.cachePassInFlight=!1})))}msSinceTerminalActivity(e,r){const t=p(e);return t===0?Number.POSITIVE_INFINITY:r-t}async sweepRetention(e,r){r.lifecycle.acceptsDetachedWork()&&await d("retention-sweep","",e,w,w,()=>s.fresh(async()=>{try{const t=await b({ttlDays:R,held:await v(r.fleet),removeDirs:u(i=>{r.lifecycle.registerDetached(Promise.all(i.map(c=>N(c,{recursive:!0,force:!0}))).then(()=>{}).catch(c=>{s.fresh(()=>{n({level:"error",event:"canvas.retention.failed",error:c})})}))},"removeDirs")});t.pruned.length>0&&n({level:"info",event:"canvas.retention.pruned",outcome:"succeeded",fields:{pruned_count:t.pruned.length}});const a=await v(r.fleet),o=e-R*24*60*6e4,f=await z({now:e,held:a,quiet:u(async i=>{const c=await g(i);return c!==null&&p(c)<o},"quiet")});f>0&&n({level:"info",event:"canvas.retention.sandboxes_deleted",outcome:"succeeded",fields:{deleted_count:f}})}catch(t){n({level:"error",event:"canvas.retention.failed",error:t})}}))}scheduleContextStrip(e,r){r.lifecycle.acceptsDetachedWork()&&r.lifecycle.registerDetached(d("context-strip","",e,w,10*6e4,()=>this.stripFinishedContexts(e,r)).then(()=>{},t=>{n({level:"error",event:"canvas.context_strip.failed",error:t})}))}async stripFinishedContexts(e,r){const t=await v(r.fleet),a=u(async i=>i!==null&&["done","canceled","dead"].includes(i.status)&&(i.pi_pid??null)===null&&(i.frozen_at??null)===null&&!G(i)&&p(i)<e-J&&!await t(i.node_id),"eligible");let o=0,f=0;try{for(const i of await D({status:["done","canceled","dead"]})){if(!l(i.node_id)||!await a(i))continue;const c=await L(i.node_id);if(c!==null&&c>=p(i)||!await a(await g(i.node_id)))continue;let _;try{_=await W(i.node_id)}catch(I){s.fresh(()=>{n({level:"warn",event:"canvas.context_strip.node_failed",error:I,fields:{node_id:i.node_id}})});continue}_.removed.length>0&&(o+=1,f+=_.bytes)}}catch(i){s.fresh(()=>{n({level:"error",event:"canvas.context_strip.failed",error:i})})}o>0&&s.fresh(()=>{n({level:"info",event:"canvas.context_strip.completed",outcome:"succeeded",fields:{node_count:o,bytes:f}})})}async reapDeadResidue(e,r){let t;try{t=await F()}catch(a){s.fresh(()=>{n({level:"error",event:"residue.reap_scan.failed",error:a})});return}for(const a of t)if(!r.has(a.node_id)){try{if(this.msSinceTerminalActivity(a,e)<j)continue}catch(o){s.fresh(()=>{n({level:"error",event:"residue.reap.failed",...l(a.node_id)?{node_id:a.node_id}:{},error:o,fields:{...l(a.node_id)?{}:{affected_node_id:a.node_id},pane:a.pane,window:a.window,tmux_session:a.tmux_session}})});continue}await s.fresh(async()=>{try{n({level:"info",event:"residue.reaped",...l(a.node_id)?{node_id:a.node_id}:{},fields:{...l(a.node_id)?{}:{affected_node_id:a.node_id},pane:a.pane,window:a.window,tmux_session:a.tmux_session}}),await k(a.node_id)}catch(o){n({level:"error",event:"residue.reap.failed",...l(a.node_id)?{node_id:a.node_id}:{},error:o,fields:{...l(a.node_id)?{}:{affected_node_id:a.node_id},pane:a.pane,window:a.window,tmux_session:a.tmux_session}})}})}}scheduleFocusGc(e){if(this.focusGcInFlight||!e.lifecycle.acceptsDetachedWork())return;this.focusGcInFlight=!0;const r=this.gcStaleFocuses().finally(()=>{this.focusGcInFlight=!1});e.lifecycle.registerDetached(r)}async gcStaleFocuses(){let e;try{e=await C()}catch(t){s.fresh(()=>{n({level:"error",event:"focus.gc.failed",error:t})});return}if(e.length===0)return;let r;try{r=await V()}catch(t){s.fresh(()=>{n({level:"error",event:"focus.gc.failed",error:t})});return}if(r!==null)for(const t of e){if(t.pane===null||r.has(t.pane))continue;if(!await s.fresh(async()=>{try{return(await P(t.focus_id))?.pane!==t.pane||(n({level:"info",event:"focus.gc.removed",...l(t.node_id)?{node_id:t.node_id}:{},fields:{focus_id:t.focus_id,focus_node_id:t.node_id,pane:t.pane}}),await T(t.focus_id)),!0}catch(o){return n({level:"error",event:"focus.gc.failed",error:o}),!1}}))return}}async gcCreateRequests(e){await d("create-request-gc","",e,E,E,()=>s.fresh(async()=>{const r=await M(e),t=await x(e);t>0&&n({level:"info",event:"canvas.idempotency_keys.reaped",outcome:"succeeded",fields:{reaped_count:t}}),r>0&&n({level:"info",event:"canvas.create_requests.reaped",outcome:"succeeded",fields:{reaped_count:r}})}))}async gcViewerAttachments(e){await d("viewer-attachment-gc","",e,h,h,()=>s.fresh(async()=>{const r=Number((await(await m()).prepare("DELETE FROM viewer_attachments WHERE expires_at <= ?").run(new Date(e).toISOString())).changes);r>0&&n({level:"info",event:"viewer_attachments.reaped",outcome:"succeeded",fields:{reaped_count:r}})}))}async gcWarmPool(e){await d("warm-pool-gc","",e,h,h,()=>s.fresh(async()=>{const r=await q();r.length>0&&n({level:"info",event:"warm_pool.spares_reaped",outcome:"succeeded",fields:{reaped_count:r.length}})}))}}export{J as CONTEXT_STRIP_GRACE_MS,j as DEAD_REAP_GRACE_MS,w as RETENTION_SWEEP_INTERVAL_MS,R as RETENTION_TTL_DAYS,Ce as StorageMaintenanceReconciler};
1
+ var I=Object.defineProperty;var u=(w,t)=>I(w,"name",{value:t,configurable:!0});import{rm as A}from"node:fs/promises";import{closeFocusRow as N,getFocusById as T,listFocuses as P,listNodes as C}from"../../core/canvas/index.js";import{pruneExpiredIdempotencyKeys as x}from"../../core/runs/operations.js";import{getNode as y,lastActivityMs as p,listTerminalPlacementResidue as D,pruneExpiredCreateRequests as F,pruneNodes as M}from"../../core/canvas/canvas.js";import{lastContextStripMs as b,stripContextDir as L}from"../../core/canvas/context-strip.js";import{isAppRun as W}from"../../core/canvas/app-run.js";import{isSafeNodeId as c}from"../../core/canvas/paths.js";import{emitEvent as n}from"../../core/events/emit.js";import{operationIdContext as i}from"../../core/events/operation-id.js";import{listLivePanesAsync as G,tearDownNode as V}from"../../core/runtime/placement.js";import{reapStaleSpares as k}from"../../core/runtime/warm-pool.js";import{GroveInstanceSweepReconciler as q}from"./grove-instance-sweep.js";import{ManagedWorktreeSweepReconciler as O}from"./managed-worktree-sweep.js";import{compactRunEvents as U}from"../../core/runs/events.js";import{archiveExpiredRunEvents as H}from"../../core/events/run-event-chunks.js";import{blobStore as Y}from"../../core/blobs/index.js";import{runThrottledLane as d}from"./throttled-lane.js";import{openDb as g}from"../../core/canvas/db.js";import{retentionHold as m}from"./live-obligation.js";import{deleteQuietNodeSandboxes as z}from"../../core/runtime/runner/delete-sandboxes.js";import{pruneMemoryReads as B}from"../../core/canvas/memory-reads.js";import{existsSync as K}from"node:fs";import{launcherRequest as Q}from"../../launcher/client.js";import{LAUNCHER_SOCKET as $}from"../../launcher/spec.js";import{cachePassDue as X}from"../../launcher/limits/policy.js";const Z=10*6e4,h=60*1e3,S=60*1e3,v=5*6e4,E=2,j=1440*6e4,J=2e3,ee=6e4;class Te{static{u(this,"StorageMaintenanceReconciler")}focusGcInFlight=!1;lastCachePassAt=null;cachePassInFlight=!1;worktreeSweep=new O;groveInstanceSweep=new q;async run(t,r){await this.reapDeadResidue(t),this.scheduleFocusGc(r),await this.gcWarmPool(t),await this.gcCreateRequests(t),await this.gcViewerAttachments(t);try{await d("run-event-maintenance","",t,J,ee,async e=>{await H(await Y(),t);const s=await U(t,e.state===null?0:Number(e.state));await e.save(String(s.cursor))})}catch(e){console.warn(`run event maintenance failed: ${String(e)}`)}await d("memory-read-prune","",t,60*6e4,10*6e4,async()=>{try{await B(t)}catch(e){console.warn(`memory-read log prune failed: ${String(e)}`)}}),await d("storage-analyze","",t,1440*6e4,10*6e4,async()=>{await(await g()).exec("ANALYZE")}),await this.sweepRetention(t,r),this.scheduleCachePass(t,r),this.scheduleContextStrip(t,r),this.worktreeSweep.run(t,r),this.groveInstanceSweep.run(t,r)}scheduleCachePass(t,r){this.cachePassInFlight||!X(this.lastCachePassAt,t)||process.platform!=="linux"||!K($)||r.lifecycle.acceptsDetachedWork()&&(this.lastCachePassAt=t,this.cachePassInFlight=!0,r.lifecycle.registerDetached(Q({operation:"cache.purge"}).then(()=>{}).catch(e=>{i.fresh(()=>{n({level:"warn",event:"app.cache.pass_failed",error:e})})}).then(()=>{this.cachePassInFlight=!1})))}msSinceTerminalActivity(t,r){const e=p(t);return e===0?Number.POSITIVE_INFINITY:r-e}async sweepRetention(t,r){r.lifecycle.acceptsDetachedWork()&&await d("retention-sweep","",t,v,v,()=>i.fresh(async()=>{try{const e=await M({ttlDays:E,held:await m(r.fleet),removeDirs:u(a=>{r.lifecycle.registerDetached(Promise.all(a.map(o=>A(o,{recursive:!0,force:!0}))).then(()=>{}).catch(o=>{i.fresh(()=>{n({level:"error",event:"canvas.retention.failed",error:o})})}))},"removeDirs")});e.pruned.length>0&&n({level:"info",event:"canvas.retention.pruned",outcome:"succeeded",fields:{pruned_count:e.pruned.length}});const s=await m(r.fleet),l=t-E*24*60*6e4,f=await z({now:t,held:s,quiet:u(async a=>{const o=await y(a);return o!==null&&p(o)<l},"quiet")});f>0&&n({level:"info",event:"canvas.retention.sandboxes_deleted",outcome:"succeeded",fields:{deleted_count:f}})}catch(e){n({level:"error",event:"canvas.retention.failed",error:e})}}))}scheduleContextStrip(t,r){r.lifecycle.acceptsDetachedWork()&&r.lifecycle.registerDetached(d("context-strip","",t,v,10*6e4,()=>this.stripFinishedContexts(t,r)).then(()=>{},e=>{n({level:"error",event:"canvas.context_strip.failed",error:e})}))}async stripFinishedContexts(t,r){const e=await m(r.fleet),s=u(async a=>a!==null&&["done","canceled","dead"].includes(a.status)&&(a.pi_pid??null)===null&&(a.frozen_at??null)===null&&!W(a)&&p(a)<t-j&&!await e(a.node_id),"eligible");let l=0,f=0;try{for(const a of await C({status:["done","canceled","dead"]})){if(!c(a.node_id)||!await s(a))continue;const o=await b(a.node_id);if(o!==null&&o>=p(a)||!await s(await y(a.node_id)))continue;let _;try{_=await L(a.node_id)}catch(R){i.fresh(()=>{n({level:"warn",event:"canvas.context_strip.node_failed",error:R,fields:{node_id:a.node_id}})});continue}_.removed.length>0&&(l+=1,f+=_.bytes)}}catch(a){i.fresh(()=>{n({level:"error",event:"canvas.context_strip.failed",error:a})})}l>0&&i.fresh(()=>{n({level:"info",event:"canvas.context_strip.completed",outcome:"succeeded",fields:{node_count:l,bytes:f}})})}async reapDeadResidue(t){let r;try{r=await D()}catch(e){i.fresh(()=>{n({level:"error",event:"residue.reap_scan.failed",error:e})});return}for(const e of r){try{if(this.msSinceTerminalActivity(e,t)<Z)continue}catch(s){i.fresh(()=>{n({level:"error",event:"residue.reap.failed",...c(e.node_id)?{node_id:e.node_id}:{},error:s,fields:{...c(e.node_id)?{}:{affected_node_id:e.node_id},pane:e.pane,window:e.window,tmux_session:e.tmux_session}})});continue}await i.fresh(async()=>{try{n({level:"info",event:"residue.reaped",...c(e.node_id)?{node_id:e.node_id}:{},fields:{...c(e.node_id)?{}:{affected_node_id:e.node_id},pane:e.pane,window:e.window,tmux_session:e.tmux_session}}),await V(e.node_id)}catch(s){n({level:"error",event:"residue.reap.failed",...c(e.node_id)?{node_id:e.node_id}:{},error:s,fields:{...c(e.node_id)?{}:{affected_node_id:e.node_id},pane:e.pane,window:e.window,tmux_session:e.tmux_session}})}})}}scheduleFocusGc(t){if(this.focusGcInFlight||!t.lifecycle.acceptsDetachedWork())return;this.focusGcInFlight=!0;const r=this.gcStaleFocuses().finally(()=>{this.focusGcInFlight=!1});t.lifecycle.registerDetached(r)}async gcStaleFocuses(){let t;try{t=await P()}catch(e){i.fresh(()=>{n({level:"error",event:"focus.gc.failed",error:e})});return}if(t.length===0)return;let r;try{r=await G()}catch(e){i.fresh(()=>{n({level:"error",event:"focus.gc.failed",error:e})});return}if(r!==null)for(const e of t){if(e.pane===null||r.has(e.pane))continue;if(!await i.fresh(async()=>{try{return(await T(e.focus_id))?.pane!==e.pane||(n({level:"info",event:"focus.gc.removed",...c(e.node_id)?{node_id:e.node_id}:{},fields:{focus_id:e.focus_id,focus_node_id:e.node_id,pane:e.pane}}),await N(e.focus_id)),!0}catch(l){return n({level:"error",event:"focus.gc.failed",error:l}),!1}}))return}}async gcCreateRequests(t){await d("create-request-gc","",t,S,S,()=>i.fresh(async()=>{const r=await F(t),e=await x(t);e>0&&n({level:"info",event:"canvas.idempotency_keys.reaped",outcome:"succeeded",fields:{reaped_count:e}}),r>0&&n({level:"info",event:"canvas.create_requests.reaped",outcome:"succeeded",fields:{reaped_count:r}})}))}async gcViewerAttachments(t){await d("viewer-attachment-gc","",t,h,h,()=>i.fresh(async()=>{const r=Number((await(await g()).prepare("DELETE FROM viewer_attachments WHERE expires_at <= ?").run(new Date(t).toISOString())).changes);r>0&&n({level:"info",event:"viewer_attachments.reaped",outcome:"succeeded",fields:{reaped_count:r}})}))}async gcWarmPool(t){await d("warm-pool-gc","",t,h,h,()=>i.fresh(async()=>{const r=await k();r.length>0&&n({level:"info",event:"warm_pool.spares_reaped",outcome:"succeeded",fields:{reaped_count:r.length}})}))}}export{j as CONTEXT_STRIP_GRACE_MS,Z as DEAD_REAP_GRACE_MS,v as RETENTION_SWEEP_INTERVAL_MS,E as RETENTION_TTL_DAYS,Te as StorageMaintenanceReconciler};
@@ -1,5 +1,4 @@
1
1
  /** Settles rows whose waiter disappeared and retries every incomplete durable effect. */
2
2
  export declare class StructuredRequestReconciler {
3
- /** `held`: nodes of a committed, not yet `done` import run; a request of theirs stays as imported. */
4
- run(now: number, held: ReadonlySet<string>): Promise<void>;
3
+ run(now: number): Promise<void>;
5
4
  }
@@ -1 +1 @@
1
- var _=Object.defineProperty;var s=(t,r)=>_(t,"name",{value:r,configurable:!0});import{withCanvasWrite as w}from"../../core/canvas/db.js";import{incompleteStructuredRequestEffects as m,pendingStructuredRequestsPast as p,settleStructuredRequestIn as q}from"../../core/canvas/structured-requests.js";import{emitEvent as c}from"../../core/events/emit.js";import{applySettlementEffects as u}from"../structured-requests/effects.js";import{withRowClaim as a}from"./row-claim.js";const d=6e4,l=s(t=>{c({level:"error",event:"structured_request.reconcile_failed",error:t})},"reportFailure");class E{static{s(this,"StructuredRequestReconciler")}async run(r,n){try{for(const e of await p(r))e.node_id!==null&&n.has(e.node_id)||a("structured_requests",e.request_id,d,async i=>{const o=await w(async f=>(await i.assertOwned(),await q(f,e.request_id,{intended:"expired",now:r})));o.changed&&o.row!==null&&await u(o.row,i)}).catch(l);for(const e of await m())e.node_id!==null&&n.has(e.node_id)||a("structured_requests",e.request_id,d,async i=>{await u(e,i)}).catch(l)}catch(e){c({level:"error",event:"structured_request.reconcile_failed",error:e})}}}export{E as StructuredRequestReconciler};
1
+ var f=Object.defineProperty;var c=(t,r)=>f(t,"name",{value:r,configurable:!0});import{withCanvasWrite as w}from"../../core/canvas/db.js";import{incompleteStructuredRequestEffects as m,pendingStructuredRequestsPast as p,settleStructuredRequestIn as q}from"../../core/canvas/structured-requests.js";import{emitEvent as i}from"../../core/events/emit.js";import{applySettlementEffects as a}from"../structured-requests/effects.js";import{withRowClaim as u}from"./row-claim.js";const n=6e4,d=c(t=>{i({level:"error",event:"structured_request.reconcile_failed",error:t})},"reportFailure");class C{static{c(this,"StructuredRequestReconciler")}async run(r){try{for(const e of await p(r))u("structured_requests",e.request_id,n,async s=>{const o=await w(async l=>(await s.assertOwned(),await q(l,e.request_id,{intended:"expired",now:r})));o.changed&&o.row!==null&&await a(o.row,s)}).catch(d);for(const e of await m())u("structured_requests",e.request_id,n,async s=>{await a(e,s)}).catch(d)}catch(e){i({level:"error",event:"structured_request.reconcile_failed",error:e})}}}export{C as StructuredRequestReconciler};
@@ -40,7 +40,7 @@ Options: `new FakeCloud({clientId, issuer = 'https://directory.test', runtimeUrl
40
40
 
41
41
  ### Isolated runs
42
42
 
43
- The fake stands in for a Northlight guest, where the Linux root launcher always exists, so `runs.start({isolated: true})` starts a run by default and `run.params.isolated` is `true`. The checks `startRun` makes without the launcher are mirrored: `isolated` must be a boolean, `cwd` is accepted only with `isolated: true` and must be an absolute path inside the run's root folder, `/apps/<clientId>/nodes/<run id>` (else 400 `invalid_request`, `param: cwd`), and `worktree` is refused. Nothing in the fake enforces the sandbox itself (no network, no `files/` mount).
43
+ The fake stands in for a Northlight sandbox, where the Linux root launcher always exists, so `runs.start({isolated: true})` starts a run by default and `run.params.isolated` is `true`. The checks `startRun` makes without the launcher are mirrored: `isolated` must be a boolean, `cwd` is accepted only with `isolated: true` and must be an absolute path inside the run's root folder, `/apps/<clientId>/nodes/<run id>` (else 400 `invalid_request`, `param: cwd`), and `worktree` is refused. Nothing in the fake enforces the sandbox itself (no network, no `files/` mount).
44
44
 
45
45
  `isolatedRuns: 'unavailable'` models a runtime without the launcher, such as a runtime on a machine that cannot launch isolated runs: every isolated start answers 503 `isolated_unavailable` (`param: isolated`, retryable, so `runs.start` sends it three times before throwing). Use it to test your app's handling of that refusal.
46
46
 
package/docs/ci-runner.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # CI runners and the double-run gate
2
2
 
3
- The suite runs on **GitHub-hosted Linux** (ubuntu, inside a root container shaped like the hosted guest), and only the tests tagged `laptopOnly` (a macOS-only code path, or an assertion that assumes a non-root user) run on **macOS** (the Mac mini runners). macOS minutes bill at 10x Linux, so the macOS job is deliberately small. The push to `main` does not re-run a tree that already passed.
3
+ The suite runs on **GitHub-hosted Linux** (ubuntu, inside a root container with the Linux layout crouter uses in a container or sandbox), and only the tests tagged `laptopOnly` (a macOS-only code path, or an assertion that assumes a non-root user) run on **macOS** (the Mac mini runners). macOS minutes bill at 10x Linux, so the macOS job is deliberately small. The push to `main` does not re-run a tree that already passed.
4
4
 
5
5
  ## Why Linux, and why a container
6
6
 
7
- On Linux crouter assumes it is the hosted guest (`src/core/layout.ts`): sockets in `/run/crtr`, data under `/runtime`, `/user` and `/apps`, brokers started through a root launcher. A plain non-root runner has none of that (every lane failed with EACCES, which is why the suite once moved to macOS). The `linux` jobs of `test.yml` therefore run as root in a container built from `docker/ci.Dockerfile`:
7
+ On Linux crouter assumes it runs in a container or sandbox (`src/core/layout.ts`): sockets in `/run/crtr`, data under `/runtime`, `/user` and `/apps`, brokers started through a root launcher. A plain non-root runner has none of that (every lane failed with EACCES, which is why the suite once moved to macOS). The `linux` jobs of `test.yml` therefore run as root in a container built from `docker/ci.Dockerfile`:
8
8
 
9
- - **Image.** `docker/ci.Dockerfile` is the guest's runner stage (same pinned `node:24-alpine` digest, same apk list, users `crtrd` 10002 / `crtr-data` 10001, the `/run/crtr` `/runtime` `/user` `/apps` directories) plus `build-base`, `linux-headers` (native addon) and GNU `tar`. It does not contain crouter; the job checks the source out. Chosen over `hosting/guest/Dockerfile` (needs sandbox-api, chrony, the python stack and a packed crouter, so it rebuilds per commit) and `docker/unit.Dockerfile` (bakes a packed crouter). `scripts/ci-image.test.mjs` (in `test:contract`) fails when the apk list, ids, directories or node base drift from `docker/base.Dockerfile`; keep the two in step by hand when the guest changes.
9
+ - **Image.** `docker/ci.Dockerfile` is built like the container runner stage (same pinned `node:24-alpine` digest, same apk list, users `crtrd` 10002 / `crtr-data` 10001, the `/run/crtr` `/runtime` `/user` `/apps` directories) plus `build-base`, `linux-headers` (native addon) and GNU `tar`. It does not contain crouter; the job checks the source out. Chosen over `hosting/guest/Dockerfile` (needs sandbox-api, chrony, the python stack and a packed crouter, so it rebuilds per commit) and `docker/unit.Dockerfile` (bakes a packed crouter). `scripts/ci-image.test.mjs` (in `test:contract`) fails when the apk list, ids, directories or node base drift from `docker/base.Dockerfile`; keep the two in step by hand when the guest changes.
10
10
  - **Docker flags.** `--init --cgroupns=private --cap-add SYS_ADMIN --cap-add NET_ADMIN --security-opt seccomp=unconfined --security-opt apparmor=unconfined`, with the checkout mounted at `/opt/crouter` (where the guest has crouter, and the only crouter path a sandbox mounts). `--init` is tini as pid 1, which reaps the orphans the launcher and bubblewrap leave. The capabilities give mount namespaces per test file and bubblewrap's namespaces. `scripts/ci-linux-lane.sh` first delegates the memory and pids cgroup controllers as the guest entrypoint does and fails the job if it cannot, so the runner must be a cgroup2 host with `xt_owner`.
11
11
  - **One `/run/crtr`, `/etc`, cgroup subtree and root launcher per test file.** All test files would otherwise share `/run/crtr/api.sock`, `store.sock` and `nodes/`. `scripts/ci-test-files.mjs` runs each file under `unshare -m` through `scripts/ci-file-setup.sh`, which mounts a tmpfs on `/run/crtr`, binds a private copy of `/etc` (the launcher rewrites `passwd` and `group`) and a private cgroup subtree, and starts the file's own root launcher (`scripts/ci-launcher.mjs`) before the test; each file also has its own `HOME`, `TMPDIR`, `CRTR_RUNTIME_HOME` and `CRTR_HOME`. The test process, running as root, plays the daemon: the CI launcher accepts a root peer and does not start `crtrd`. The log line of each file shows the milliseconds its launcher took to open its socket. A failing file is retried once and reported as flaky if the retry passes (as `scripts/test-retry.mjs` does on macOS).
12
12
  - **Running a list of files.** `ci-test-files.mjs <lane> --files <list>` (and `scripts/ci-linux-lane.sh <lane> <shard> --files <list>`) runs exactly the files in a text file of repo paths, one per line (seam: the `dist/…/*.test.js` path); the format is in the script header. A path that is not a test file of that lane exits 2.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/cli",
3
- "version": "0.3.764",
3
+ "version": "0.3.766",
4
4
  "description": "crtr — agent runtime with memory, plugins, and marketplaces",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -157,8 +157,8 @@
157
157
  },
158
158
  "license": "UNLICENSED",
159
159
  "dependencies": {
160
- "@north-light/identity": "0.3.764",
161
- "@north-light/plugin": "0.3.764",
160
+ "@north-light/identity": "0.3.766",
161
+ "@north-light/plugin": "0.3.766",
162
162
  "@earendil-works/chord": "1.5.2",
163
163
  "@earendil-works/pi-agent-core": "1.5.2",
164
164
  "@earendil-works/pi-ai": "1.5.2",
@@ -12,7 +12,7 @@
12
12
  //
13
13
  // PURITY (spec §3.1): Node built-ins + `src/api/*` only.
14
14
  /** The contract level this build serves and requires. Written by `scripts/contract.mjs release`; never edit by hand. */
15
- export const CONTRACT_LEVEL = '1.82';
15
+ export const CONTRACT_LEVEL = '1.83';
16
16
  /** Request header naming the one contract level the caller needs, e.g. `1.3`. Optional: absent means no check. */
17
17
  export const REQUIRED_CONTRACT_HEADER = 'Crouter-Required-Contract';
18
18
  /** Response header listing the contract levels the server serves, comma-separated, one per major, e.g. `1.3`. */
@@ -15,7 +15,6 @@ export * from './dto/limits.js';
15
15
  export * from './dto/grants.js';
16
16
  export * from './dto/usage.js';
17
17
  export * from './dto/charges.js';
18
- export * from './dto/imports.js';
19
18
  export * from './dto/execution-start.js';
20
19
  export * from './dto/nodes.js';
21
20
  export * from './dto/node-outcomes.js';
@@ -224,18 +224,6 @@ async function runDaemonEntry(args) {
224
224
  const line = stdout.trim().split('\n').at(-1) ?? '';
225
225
  return JSON.parse(line);
226
226
  }
227
- /** Run the selected generation's `crtrd-cli import-dump`: the row files of the running canvas into `out`/rows. */
228
- export function runDaemonImportDump(out, kind) {
229
- return runDaemonEntry(['import-dump', out, kind]);
230
- }
231
- /** Run `crtrd-cli import-dump <out> bodies`: every `bodies` row into `out`/rows/bodies (the pre-pause dump; the later `runDaemonImportDump` adds the rows written since). */
232
- export function runDaemonBodiesDump(out) {
233
- return runDaemonEntry(['import-dump', out, 'bodies']);
234
- }
235
- /** Run `crtrd-cli import-dump <out> install-id`: this install's id, read from the running canvas. */
236
- export function runDaemonInstallId() {
237
- return runDaemonEntry(['import-dump', '', 'install-id']);
238
- }
239
227
  // Shutdown stays short even though startup may include corpus migration.
240
228
  const DAEMON_SHUTDOWN_WINDOW_MS = 20_000;
241
229
  const DAEMON_VERIFY_POLL_MS = 10;