@north-light/cli 0.3.765 → 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 (967) 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/daemon/api/handlers/app-environments.d.ts +1 -0
  15. package/dist/daemon/api/handlers/app-environments.js +1 -1
  16. package/dist/daemon/api/handlers/environments.d.ts +1 -0
  17. package/dist/daemon/api/handlers/environments.js +1 -1
  18. package/dist/daemon/api/operations.js +1 -1
  19. package/dist/daemon/api/server.d.ts +1 -0
  20. package/dist/daemon/api/server.js +1 -1
  21. package/dist/daemon/cron/passes.d.ts +0 -2
  22. package/dist/daemon/cron-run.js +2 -2
  23. package/dist/daemon/crtrd-cli.js +1 -1
  24. package/dist/daemon/crtrd.d.ts +5 -5
  25. package/dist/daemon/crtrd.js +7 -19
  26. package/dist/daemon/due-sources.d.ts +1 -1
  27. package/dist/daemon/due-sources.js +1 -1
  28. package/dist/daemon/due.js +4 -4
  29. package/dist/daemon/machine-link/holder.js +5 -5
  30. package/dist/daemon/manage.d.ts +0 -12
  31. package/dist/daemon/manage.js +3 -3
  32. package/dist/daemon/postgres/index.d.ts +1 -1
  33. package/dist/daemon/postgres/index.js +1 -1
  34. package/dist/daemon/postgres/supervisor.d.ts +0 -62
  35. package/dist/daemon/postgres/supervisor.js +1 -2
  36. package/dist/daemon/reconcilers/broker-supervision.d.ts +0 -2
  37. package/dist/daemon/reconcilers/broker-supervision.js +1 -1
  38. package/dist/daemon/reconcilers/controller-death.d.ts +0 -2
  39. package/dist/daemon/reconcilers/controller-death.js +1 -1
  40. package/dist/daemon/reconcilers/cron-lane.d.ts +0 -1
  41. package/dist/daemon/reconcilers/cron-lane.js +1 -1
  42. package/dist/daemon/reconcilers/live-obligation.d.ts +1 -6
  43. package/dist/daemon/reconcilers/live-obligation.js +1 -1
  44. package/dist/daemon/reconcilers/node-deadline.d.ts +1 -2
  45. package/dist/daemon/reconcilers/node-deadline.js +1 -1
  46. package/dist/daemon/reconcilers/storage-maintenance.d.ts +0 -2
  47. package/dist/daemon/reconcilers/storage-maintenance.js +1 -1
  48. package/dist/daemon/reconcilers/structured-request-lane.d.ts +1 -2
  49. package/dist/daemon/reconcilers/structured-request-lane.js +1 -1
  50. package/docs/apps/guides/test-your-app.md +1 -1
  51. package/docs/ci-runner.md +3 -3
  52. package/package.json +3 -3
  53. package/packages/crouter-api/dist/api/contract.js +1 -1
  54. package/packages/crouter-api/dist/api/index.js +0 -1
  55. package/packages/crouter-api/dist/daemon/manage.js +0 -12
  56. package/packages/crouter-api/package.json +1 -1
  57. package/packages/crouter-identity/package.json +1 -1
  58. package/packages/crouter-plugin/package.json +3 -3
  59. package/runtime.lock.json +14 -14
  60. package/dist/api/dto/imports.d.ts +0 -156
  61. package/dist/api/dto/imports.js +0 -0
  62. package/dist/commands/sys/import/move.d.ts +0 -29
  63. package/dist/commands/sys/import/move.js +0 -6
  64. package/dist/commands/sys/import/resume.d.ts +0 -1
  65. package/dist/commands/sys/import/resume.js +0 -1
  66. package/dist/commands/sys/import/start.d.ts +0 -1
  67. package/dist/commands/sys/import/start.js +0 -1
  68. package/dist/core/canvas/daemon-owner.d.ts +0 -75
  69. package/dist/core/canvas/daemon-owner.js +0 -1
  70. package/dist/core/import/bundle/blob-keys.d.ts +0 -12
  71. package/dist/core/import/bundle/blob-keys.js +0 -1
  72. package/dist/core/import/bundle/layout.d.ts +0 -89
  73. package/dist/core/import/bundle/layout.js +0 -4
  74. package/dist/core/import/export/archive.d.ts +0 -11
  75. package/dist/core/import/export/archive.js +0 -1
  76. package/dist/core/import/export/cloud.d.ts +0 -41
  77. package/dist/core/import/export/cloud.js +0 -1
  78. package/dist/core/import/export/dump.d.ts +0 -34
  79. package/dist/core/import/export/dump.js +0 -4
  80. package/dist/core/import/export/files.d.ts +0 -23
  81. package/dist/core/import/export/files.js +0 -1
  82. package/dist/core/import/export/inline.d.ts +0 -3
  83. package/dist/core/import/export/inline.js +0 -1
  84. package/dist/core/import/export/source.d.ts +0 -2
  85. package/dist/core/import/export/source.js +0 -1
  86. package/dist/core/import/export/stores.d.ts +0 -9
  87. package/dist/core/import/export/stores.js +0 -4
  88. package/dist/core/import/load/bind.d.ts +0 -42
  89. package/dist/core/import/load/bind.js +0 -20
  90. package/dist/core/import/load/blobs.d.ts +0 -27
  91. package/dist/core/import/load/blobs.js +0 -1
  92. package/dist/core/import/load/catalog.d.ts +0 -39
  93. package/dist/core/import/load/catalog.js +0 -9
  94. package/dist/core/import/load/copy.d.ts +0 -29
  95. package/dist/core/import/load/copy.js +0 -11
  96. package/dist/core/import/load/keys.d.ts +0 -5
  97. package/dist/core/import/load/keys.js +0 -8
  98. package/dist/core/import/load/open-grants.d.ts +0 -1
  99. package/dist/core/import/load/open-grants.js +0 -1
  100. package/dist/core/import/load/path-map.d.ts +0 -7
  101. package/dist/core/import/load/path-map.js +0 -1
  102. package/dist/core/import/load/prepare.d.ts +0 -70
  103. package/dist/core/import/load/prepare.js +0 -14
  104. package/dist/core/import/load/publish-plugins.d.ts +0 -10
  105. package/dist/core/import/load/publish-plugins.js +0 -1
  106. package/dist/core/import/load/rewrite.d.ts +0 -54
  107. package/dist/core/import/load/rewrite.js +0 -15
  108. package/dist/core/import/load/rollback.d.ts +0 -3
  109. package/dist/core/import/load/rollback.js +0 -7
  110. package/dist/core/import/load/run.d.ts +0 -26
  111. package/dist/core/import/load/run.js +0 -2
  112. package/dist/core/import/load/stage.d.ts +0 -15
  113. package/dist/core/import/load/stage.js +0 -1
  114. package/dist/core/import/load/stores.d.ts +0 -32
  115. package/dist/core/import/load/stores.js +0 -2
  116. package/dist/core/import/load/verify.d.ts +0 -4
  117. package/dist/core/import/load/verify.js +0 -13
  118. package/dist/daemon/api/handlers/imports.d.ts +0 -2
  119. package/dist/daemon/api/handlers/imports.js +0 -1
  120. package/dist/daemon/api/handlers/machine-credential.d.ts +0 -2
  121. package/dist/daemon/api/handlers/machine-credential.js +0 -1
  122. package/dist/daemon/api/import-auth.d.ts +0 -6
  123. package/dist/daemon/api/import-auth.js +0 -1
  124. package/dist/daemon/import-dump-run.d.ts +0 -1
  125. package/dist/daemon/import-dump-run.js +0 -5
  126. package/dist/daemon/reconcilers/import-lane.d.ts +0 -17
  127. package/dist/daemon/reconcilers/import-lane.js +0 -1
  128. package/packages/crouter-api/dist/api/dto/imports.js +0 -2
  129. package/packages/crouter-api/dist/build-root.js +0 -402
  130. package/packages/crouter-api/dist/clients/attach/ansi-cells.js +0 -137
  131. package/packages/crouter-api/dist/clients/attach/chrome/bash-jobs.js +0 -34
  132. package/packages/crouter-api/dist/clients/attach/chrome/canvas-panels.js +0 -285
  133. package/packages/crouter-api/dist/clients/attach/chrome/completion-bell.js +0 -89
  134. package/packages/crouter-api/dist/clients/attach/chrome/cron-wait.js +0 -34
  135. package/packages/crouter-api/dist/clients/attach/chrome/header.js +0 -30
  136. package/packages/crouter-api/dist/clients/attach/chrome/inbox-strip.js +0 -221
  137. package/packages/crouter-api/dist/clients/attach/chrome/key-hint.js +0 -16
  138. package/packages/crouter-api/dist/clients/attach/chrome/object-wait.js +0 -24
  139. package/packages/crouter-api/dist/clients/attach/chrome/recap.js +0 -19
  140. package/packages/crouter-api/dist/clients/attach/chrome/review-wait.js +0 -22
  141. package/packages/crouter-api/dist/clients/attach/chrome/roster.js +0 -283
  142. package/packages/crouter-api/dist/clients/attach/chrome/run-facts.js +0 -76
  143. package/packages/crouter-api/dist/clients/attach/chrome/status-line.js +0 -122
  144. package/packages/crouter-api/dist/clients/attach/chrome/ticket-panel.js +0 -261
  145. package/packages/crouter-api/dist/clients/attach/chrome/widgets.js +0 -60
  146. package/packages/crouter-api/dist/clients/attach/command.js +0 -107
  147. package/packages/crouter-api/dist/clients/attach/config.js +0 -280
  148. package/packages/crouter-api/dist/clients/attach/input/capabilities.js +0 -114
  149. package/packages/crouter-api/dist/clients/attach/input/clipboard-image.js +0 -237
  150. package/packages/crouter-api/dist/clients/attach/input/completion-frecency.js +0 -141
  151. package/packages/crouter-api/dist/clients/attach/input/controller.js +0 -432
  152. package/packages/crouter-api/dist/clients/attach/input/local-files.js +0 -113
  153. package/packages/crouter-api/dist/clients/attach/input/overlay-owner.js +0 -192
  154. package/packages/crouter-api/dist/clients/attach/input/ref-autocomplete.js +0 -176
  155. package/packages/crouter-api/dist/clients/attach/input/titled-editor.js +0 -859
  156. package/packages/crouter-api/dist/clients/attach/overlays/auth.js +0 -247
  157. package/packages/crouter-api/dist/clients/attach/overlays/dialogs.js +0 -102
  158. package/packages/crouter-api/dist/clients/attach/overlays/graph.js +0 -743
  159. package/packages/crouter-api/dist/clients/attach/overlays/help.js +0 -214
  160. package/packages/crouter-api/dist/clients/attach/overlays/mcp.js +0 -302
  161. package/packages/crouter-api/dist/clients/attach/overlays/pickers.js +0 -163
  162. package/packages/crouter-api/dist/clients/attach/render/activity-slot.js +0 -13
  163. package/packages/crouter-api/dist/clients/attach/render/assistant-message.js +0 -56
  164. package/packages/crouter-api/dist/clients/attach/render/card-presentation.js +0 -232
  165. package/packages/crouter-api/dist/clients/attach/render/chat-view.js +0 -1956
  166. package/packages/crouter-api/dist/clients/attach/render/context-message.js +0 -63
  167. package/packages/crouter-api/dist/clients/attach/render/crtr-output.js +0 -721
  168. package/packages/crouter-api/dist/clients/attach/render/diagram.js +0 -111
  169. package/packages/crouter-api/dist/clients/attach/render/doc-links.js +0 -78
  170. package/packages/crouter-api/dist/clients/attach/render/edit-diff.js +0 -304
  171. package/packages/crouter-api/dist/clients/attach/render/glyph-codepoints.js +0 -42
  172. package/packages/crouter-api/dist/clients/attach/render/group-activity.js +0 -276
  173. package/packages/crouter-api/dist/clients/attach/render/group-recap.js +0 -146
  174. package/packages/crouter-api/dist/clients/attach/render/markdown-source.js +0 -279
  175. package/packages/crouter-api/dist/clients/attach/render/measured-container.js +0 -322
  176. package/packages/crouter-api/dist/clients/attach/render/page-block.js +0 -187
  177. package/packages/crouter-api/dist/clients/attach/render/scroll-animation.js +0 -80
  178. package/packages/crouter-api/dist/clients/attach/render/tool-calls.js +0 -350
  179. package/packages/crouter-api/dist/clients/attach/render/transcript-copy.js +0 -81
  180. package/packages/crouter-api/dist/clients/attach/render/transcript-search.js +0 -152
  181. package/packages/crouter-api/dist/clients/attach/render/viewport.js +0 -184
  182. package/packages/crouter-api/dist/clients/attach/session/banner.js +0 -33
  183. package/packages/crouter-api/dist/clients/attach/session/bindings.js +0 -72
  184. package/packages/crouter-api/dist/clients/attach/session/chrome-refresh.js +0 -169
  185. package/packages/crouter-api/dist/clients/attach/session/connection.js +0 -185
  186. package/packages/crouter-api/dist/clients/attach/session/context.js +0 -16
  187. package/packages/crouter-api/dist/clients/attach/session/document-links.js +0 -48
  188. package/packages/crouter-api/dist/clients/attach/session/editor-frame.js +0 -161
  189. package/packages/crouter-api/dist/clients/attach/session/editor-inventory.js +0 -156
  190. package/packages/crouter-api/dist/clients/attach/session/file-links.js +0 -73
  191. package/packages/crouter-api/dist/clients/attach/session/focus-events.js +0 -12
  192. package/packages/crouter-api/dist/clients/attach/session/frame.js +0 -214
  193. package/packages/crouter-api/dist/clients/attach/session/frames.js +0 -203
  194. package/packages/crouter-api/dist/clients/attach/session/identity.js +0 -27
  195. package/packages/crouter-api/dist/clients/attach/session/input-wiring.js +0 -153
  196. package/packages/crouter-api/dist/clients/attach/session/invariant.js +0 -15
  197. package/packages/crouter-api/dist/clients/attach/session/keys.js +0 -84
  198. package/packages/crouter-api/dist/clients/attach/session/layout-record.js +0 -52
  199. package/packages/crouter-api/dist/clients/attach/session/layout.js +0 -59
  200. package/packages/crouter-api/dist/clients/attach/session/mouse.js +0 -78
  201. package/packages/crouter-api/dist/clients/attach/session/pane-focus.js +0 -42
  202. package/packages/crouter-api/dist/clients/attach/session/pane-tag.js +0 -118
  203. package/packages/crouter-api/dist/clients/attach/session/pi-assets.js +0 -24
  204. package/packages/crouter-api/dist/clients/attach/session/pi-oauth-flows.js +0 -21
  205. package/packages/crouter-api/dist/clients/attach/session/profile-files.js +0 -208
  206. package/packages/crouter-api/dist/clients/attach/session/readonly-popup.js +0 -25
  207. package/packages/crouter-api/dist/clients/attach/session/reconnect.js +0 -237
  208. package/packages/crouter-api/dist/clients/attach/session/selection.js +0 -108
  209. package/packages/crouter-api/dist/clients/attach/session/state-sync.js +0 -67
  210. package/packages/crouter-api/dist/clients/attach/session/surface-frame.js +0 -73
  211. package/packages/crouter-api/dist/clients/attach/session/surface-host.js +0 -239
  212. package/packages/crouter-api/dist/clients/attach/session/teardown.js +0 -102
  213. package/packages/crouter-api/dist/clients/attach/session/transcript-search.js +0 -151
  214. package/packages/crouter-api/dist/clients/attach/session/whip-achievements.js +0 -145
  215. package/packages/crouter-api/dist/clients/attach/session/whip.js +0 -362
  216. package/packages/crouter-api/dist/clients/attach/slash/dispatch.js +0 -759
  217. package/packages/crouter-api/dist/clients/attach/slash/prompt-preview.js +0 -121
  218. package/packages/crouter-api/dist/clients/attach/slash/recover.js +0 -133
  219. package/packages/crouter-api/dist/clients/attach/viewer.js +0 -1026
  220. package/packages/crouter-api/dist/clients/conversation/projection.js +0 -324
  221. package/packages/crouter-api/dist/clients/conversation/submit.js +0 -51
  222. package/packages/crouter-api/dist/clients/dashboard/app.js +0 -439
  223. package/packages/crouter-api/dist/clients/dashboard/model.js +0 -77
  224. package/packages/crouter-api/dist/clients/dashboard/render.js +0 -148
  225. package/packages/crouter-api/dist/clients/editor-roundtrip.js +0 -41
  226. package/packages/crouter-api/dist/clients/inbox/controller.js +0 -772
  227. package/packages/crouter-api/dist/clients/inbox/dto-adapt.js +0 -94
  228. package/packages/crouter-api/dist/clients/inbox/layout.js +0 -9
  229. package/packages/crouter-api/dist/clients/inbox/page-adapter.js +0 -56
  230. package/packages/crouter-api/dist/clients/inbox/resolve.js +0 -35
  231. package/packages/crouter-api/dist/clients/inbox/surface.js +0 -190
  232. package/packages/crouter-api/dist/clients/inbox/tui/ansi.js +0 -321
  233. package/packages/crouter-api/dist/clients/inbox/tui/input.js +0 -392
  234. package/packages/crouter-api/dist/clients/inbox/tui/keys.js +0 -104
  235. package/packages/crouter-api/dist/clients/inbox/tui/page-body.js +0 -62
  236. package/packages/crouter-api/dist/clients/inbox/tui/panel.js +0 -92
  237. package/packages/crouter-api/dist/clients/inbox/tui/render.js +0 -382
  238. package/packages/crouter-api/dist/clients/inbox/tui/slots.js +0 -134
  239. package/packages/crouter-api/dist/clients/inbox/tui/types.js +0 -1
  240. package/packages/crouter-api/dist/clients/inbox/tui.js +0 -91
  241. package/packages/crouter-api/dist/clients/open-browser.js +0 -6
  242. package/packages/crouter-api/dist/clients/surfaces/host.js +0 -1
  243. package/packages/crouter-api/dist/commands/api-client.js +0 -432
  244. package/packages/crouter-api/dist/commands/attention.js +0 -215
  245. package/packages/crouter-api/dist/commands/canvas/edges.js +0 -41
  246. package/packages/crouter-api/dist/commands/canvas/list.js +0 -81
  247. package/packages/crouter-api/dist/commands/canvas/read.js +0 -97
  248. package/packages/crouter-api/dist/commands/canvas/search.js +0 -51
  249. package/packages/crouter-api/dist/commands/canvas/share.js +0 -80
  250. package/packages/crouter-api/dist/commands/canvas/unwatch.js +0 -42
  251. package/packages/crouter-api/dist/commands/canvas/watch.js +0 -63
  252. package/packages/crouter-api/dist/commands/canvas-analytics/chart.js +0 -124
  253. package/packages/crouter-api/dist/commands/canvas-analytics/drilldown.js +0 -96
  254. package/packages/crouter-api/dist/commands/canvas-analytics/format.js +0 -106
  255. package/packages/crouter-api/dist/commands/canvas-analytics/graph-detail.js +0 -307
  256. package/packages/crouter-api/dist/commands/canvas-analytics/graphs.js +0 -365
  257. package/packages/crouter-api/dist/commands/canvas-analytics/memory.js +0 -211
  258. package/packages/crouter-api/dist/commands/canvas-analytics/overview.js +0 -189
  259. package/packages/crouter-api/dist/commands/canvas-analytics/shell.js +0 -416
  260. package/packages/crouter-api/dist/commands/canvas-analytics/time.js +0 -228
  261. package/packages/crouter-api/dist/commands/canvas-analytics/usage.js +0 -305
  262. package/packages/crouter-api/dist/commands/canvas-analytics/view.js +0 -102
  263. package/packages/crouter-api/dist/commands/canvas-analytics.js +0 -28
  264. package/packages/crouter-api/dist/commands/canvas-browse.js +0 -71
  265. package/packages/crouter-api/dist/commands/canvas-config.js +0 -192
  266. package/packages/crouter-api/dist/commands/canvas-history/grep.js +0 -85
  267. package/packages/crouter-api/dist/commands/canvas-history/read.js +0 -48
  268. package/packages/crouter-api/dist/commands/canvas-history/search.js +0 -99
  269. package/packages/crouter-api/dist/commands/canvas-history/shared.js +0 -135
  270. package/packages/crouter-api/dist/commands/canvas-history/stats.js +0 -68
  271. package/packages/crouter-api/dist/commands/canvas-history.js +0 -29
  272. package/packages/crouter-api/dist/commands/canvas-issue.js +0 -148
  273. package/packages/crouter-api/dist/commands/canvas-prune.js +0 -111
  274. package/packages/crouter-api/dist/commands/canvas-roster.js +0 -69
  275. package/packages/crouter-api/dist/commands/canvas-snapshot.js +0 -34
  276. package/packages/crouter-api/dist/commands/canvas-use.js +0 -61
  277. package/packages/crouter-api/dist/commands/canvas.js +0 -57
  278. package/packages/crouter-api/dist/commands/chord.js +0 -242
  279. package/packages/crouter-api/dist/commands/cron.js +0 -541
  280. package/packages/crouter-api/dist/commands/custom-object/ack.js +0 -30
  281. package/packages/crouter-api/dist/commands/custom-object/publish.js +0 -39
  282. package/packages/crouter-api/dist/commands/custom-object/receive.js +0 -69
  283. package/packages/crouter-api/dist/commands/custom-object/register.js +0 -69
  284. package/packages/crouter-api/dist/commands/custom-object/shared.js +0 -14
  285. package/packages/crouter-api/dist/commands/custom-object/unregister.js +0 -26
  286. package/packages/crouter-api/dist/commands/custom-object.js +0 -21
  287. package/packages/crouter-api/dist/commands/dashboard.js +0 -86
  288. package/packages/crouter-api/dist/commands/doc/delete.js +0 -30
  289. package/packages/crouter-api/dist/commands/doc/edit.js +0 -83
  290. package/packages/crouter-api/dist/commands/doc/history.js +0 -38
  291. package/packages/crouter-api/dist/commands/doc/lint.js +0 -36
  292. package/packages/crouter-api/dist/commands/doc/list.js +0 -19
  293. package/packages/crouter-api/dist/commands/doc/move.js +0 -37
  294. package/packages/crouter-api/dist/commands/doc/read.js +0 -19
  295. package/packages/crouter-api/dist/commands/doc/replace-blocks.js +0 -40
  296. package/packages/crouter-api/dist/commands/doc/shared.js +0 -156
  297. package/packages/crouter-api/dist/commands/doc/write.js +0 -53
  298. package/packages/crouter-api/dist/commands/doc.js +0 -27
  299. package/packages/crouter-api/dist/commands/human/components.js +0 -78
  300. package/packages/crouter-api/dist/commands/human/feedback.js +0 -112
  301. package/packages/crouter-api/dist/commands/human/prompts.js +0 -319
  302. package/packages/crouter-api/dist/commands/human/queue.js +0 -191
  303. package/packages/crouter-api/dist/commands/human/request.js +0 -269
  304. package/packages/crouter-api/dist/commands/human/review.js +0 -287
  305. package/packages/crouter-api/dist/commands/human/shared.js +0 -67
  306. package/packages/crouter-api/dist/commands/human.js +0 -63
  307. package/packages/crouter-api/dist/commands/node/bash.js +0 -398
  308. package/packages/crouter-api/dist/commands/node/create.js +0 -363
  309. package/packages/crouter-api/dist/commands/node/inspect.js +0 -305
  310. package/packages/crouter-api/dist/commands/node/lifecycle.js +0 -577
  311. package/packages/crouter-api/dist/commands/node/message.js +0 -170
  312. package/packages/crouter-api/dist/commands/node/outcome.js +0 -133
  313. package/packages/crouter-api/dist/commands/node/pyramid.js +0 -79
  314. package/packages/crouter-api/dist/commands/node/subscription.js +0 -78
  315. package/packages/crouter-api/dist/commands/node/wait.js +0 -157
  316. package/packages/crouter-api/dist/commands/node-context.js +0 -145
  317. package/packages/crouter-api/dist/commands/node-lifecycle-revive.js +0 -222
  318. package/packages/crouter-api/dist/commands/node-snapshot.js +0 -37
  319. package/packages/crouter-api/dist/commands/node-transcript.js +0 -59
  320. package/packages/crouter-api/dist/commands/node-worktree.js +0 -134
  321. package/packages/crouter-api/dist/commands/node.js +0 -29
  322. package/packages/crouter-api/dist/commands/person-settings.js +0 -30
  323. package/packages/crouter-api/dist/commands/pkg/app-installs.js +0 -125
  324. package/packages/crouter-api/dist/commands/pkg/browse/actions.js +0 -198
  325. package/packages/crouter-api/dist/commands/pkg/browse/catalog.js +0 -461
  326. package/packages/crouter-api/dist/commands/pkg/browse/command-view.js +0 -217
  327. package/packages/crouter-api/dist/commands/pkg/browse/detail-panel.js +0 -402
  328. package/packages/crouter-api/dist/commands/pkg/browse/doc-view.js +0 -84
  329. package/packages/crouter-api/dist/commands/pkg/browse/list-panel.js +0 -168
  330. package/packages/crouter-api/dist/commands/pkg/browse/model.js +0 -36
  331. package/packages/crouter-api/dist/commands/pkg/browse/shell.js +0 -640
  332. package/packages/crouter-api/dist/commands/pkg/browse.js +0 -27
  333. package/packages/crouter-api/dist/commands/pkg/market-inspect.js +0 -145
  334. package/packages/crouter-api/dist/commands/pkg/market-manage.js +0 -343
  335. package/packages/crouter-api/dist/commands/pkg/market.js +0 -14
  336. package/packages/crouter-api/dist/commands/pkg/plugin-env.js +0 -65
  337. package/packages/crouter-api/dist/commands/pkg/plugin-inspect.js +0 -178
  338. package/packages/crouter-api/dist/commands/pkg/plugin-manage.js +0 -1040
  339. package/packages/crouter-api/dist/commands/pkg/plugin.js +0 -14
  340. package/packages/crouter-api/dist/commands/pkg/shared.js +0 -62
  341. package/packages/crouter-api/dist/commands/pkg.js +0 -21
  342. package/packages/crouter-api/dist/commands/profile/daemon-profiles.js +0 -38
  343. package/packages/crouter-api/dist/commands/profile/default.js +0 -183
  344. package/packages/crouter-api/dist/commands/profile/delete.js +0 -66
  345. package/packages/crouter-api/dist/commands/profile/env.js +0 -188
  346. package/packages/crouter-api/dist/commands/profile/environment.js +0 -111
  347. package/packages/crouter-api/dist/commands/profile/kind.js +0 -27
  348. package/packages/crouter-api/dist/commands/profile/list.js +0 -45
  349. package/packages/crouter-api/dist/commands/profile/meta.js +0 -65
  350. package/packages/crouter-api/dist/commands/profile/new.js +0 -107
  351. package/packages/crouter-api/dist/commands/profile/pause.js +0 -59
  352. package/packages/crouter-api/dist/commands/profile/project.js +0 -147
  353. package/packages/crouter-api/dist/commands/profile/rename.js +0 -41
  354. package/packages/crouter-api/dist/commands/profile/show.js +0 -55
  355. package/packages/crouter-api/dist/commands/profile.js +0 -36
  356. package/packages/crouter-api/dist/commands/push.js +0 -357
  357. package/packages/crouter-api/dist/commands/revive.js +0 -183
  358. package/packages/crouter-api/dist/commands/surface/node/cycle.js +0 -83
  359. package/packages/crouter-api/dist/commands/surface/node/focus.js +0 -60
  360. package/packages/crouter-api/dist/commands/surface/node/id.js +0 -38
  361. package/packages/crouter-api/dist/commands/surface/node/pin.js +0 -42
  362. package/packages/crouter-api/dist/commands/surface/node/placement.js +0 -49
  363. package/packages/crouter-api/dist/commands/surface-dashboard.js +0 -138
  364. package/packages/crouter-api/dist/commands/surface-edit.js +0 -157
  365. package/packages/crouter-api/dist/commands/surface-inbox.js +0 -98
  366. package/packages/crouter-api/dist/commands/surface-inspect.js +0 -41
  367. package/packages/crouter-api/dist/commands/surface-node.js +0 -19
  368. package/packages/crouter-api/dist/commands/surface-tmux-spread.js +0 -214
  369. package/packages/crouter-api/dist/commands/surface.js +0 -28
  370. package/packages/crouter-api/dist/commands/sys/branch.js +0 -19
  371. package/packages/crouter-api/dist/commands/sys/config.js +0 -353
  372. package/packages/crouter-api/dist/commands/sys/context/admin/actions.js +0 -89
  373. package/packages/crouter-api/dist/commands/sys/context/admin/detail-panel.js +0 -233
  374. package/packages/crouter-api/dist/commands/sys/context/admin/docs-panel.js +0 -185
  375. package/packages/crouter-api/dist/commands/sys/context/admin/list-view.js +0 -170
  376. package/packages/crouter-api/dist/commands/sys/context/admin/model.js +0 -179
  377. package/packages/crouter-api/dist/commands/sys/context/admin/rail-panel.js +0 -229
  378. package/packages/crouter-api/dist/commands/sys/context/admin/read-view.js +0 -172
  379. package/packages/crouter-api/dist/commands/sys/context/admin/shell.js +0 -870
  380. package/packages/crouter-api/dist/commands/sys/context/admin.js +0 -148
  381. package/packages/crouter-api/dist/commands/sys/context/doc.js +0 -126
  382. package/packages/crouter-api/dist/commands/sys/context/expose.js +0 -66
  383. package/packages/crouter-api/dist/commands/sys/context/prompt-review.js +0 -244
  384. package/packages/crouter-api/dist/commands/sys/context/resolve.js +0 -326
  385. package/packages/crouter-api/dist/commands/sys/context/sysprompt.js +0 -95
  386. package/packages/crouter-api/dist/commands/sys/context.js +0 -21
  387. package/packages/crouter-api/dist/commands/sys/daemon.js +0 -354
  388. package/packages/crouter-api/dist/commands/sys/desktop.js +0 -201
  389. package/packages/crouter-api/dist/commands/sys/doctor.js +0 -650
  390. package/packages/crouter-api/dist/commands/sys/env.js +0 -39
  391. package/packages/crouter-api/dist/commands/sys/feedback.js +0 -238
  392. package/packages/crouter-api/dist/commands/sys/import/move.js +0 -205
  393. package/packages/crouter-api/dist/commands/sys/import/resume.js +0 -23
  394. package/packages/crouter-api/dist/commands/sys/import/start.js +0 -57
  395. package/packages/crouter-api/dist/commands/sys/join.js +0 -53
  396. package/packages/crouter-api/dist/commands/sys/limits.js +0 -133
  397. package/packages/crouter-api/dist/commands/sys/logs.js +0 -129
  398. package/packages/crouter-api/dist/commands/sys/machine/rotate.js +0 -49
  399. package/packages/crouter-api/dist/commands/sys/panels/broker-limits-panel.js +0 -110
  400. package/packages/crouter-api/dist/commands/sys/panels/dependencies-panel.js +0 -80
  401. package/packages/crouter-api/dist/commands/sys/panels/keybindings-panel.js +0 -703
  402. package/packages/crouter-api/dist/commands/sys/panels/models-panel.js +0 -1160
  403. package/packages/crouter-api/dist/commands/sys/panels/plugin-env-panel.js +0 -70
  404. package/packages/crouter-api/dist/commands/sys/panels/plugins-panel.js +0 -87
  405. package/packages/crouter-api/dist/commands/sys/panels/prefs-panel.js +0 -97
  406. package/packages/crouter-api/dist/commands/sys/panels/profiles-panel.js +0 -656
  407. package/packages/crouter-api/dist/commands/sys/panels/provider-panel.js +0 -534
  408. package/packages/crouter-api/dist/commands/sys/panels/terminal-panel.js +0 -67
  409. package/packages/crouter-api/dist/commands/sys/provider-login.js +0 -99
  410. package/packages/crouter-api/dist/commands/sys/retry-delivery.js +0 -33
  411. package/packages/crouter-api/dist/commands/sys/settings-shell.js +0 -400
  412. package/packages/crouter-api/dist/commands/sys/settings.js +0 -46
  413. package/packages/crouter-api/dist/commands/sys/setup-core.js +0 -882
  414. package/packages/crouter-api/dist/commands/sys/setup-settings-runner.js +0 -15
  415. package/packages/crouter-api/dist/commands/sys/setup-wizard.js +0 -351
  416. package/packages/crouter-api/dist/commands/sys/setup.js +0 -41
  417. package/packages/crouter-api/dist/commands/sys/shared.js +0 -81
  418. package/packages/crouter-api/dist/commands/sys/signin.js +0 -169
  419. package/packages/crouter-api/dist/commands/sys/spaces.js +0 -22
  420. package/packages/crouter-api/dist/commands/sys/spend.js +0 -144
  421. package/packages/crouter-api/dist/commands/sys/support/prepare.js +0 -239
  422. package/packages/crouter-api/dist/commands/sys/support/submit.js +0 -524
  423. package/packages/crouter-api/dist/commands/sys/support.js +0 -18
  424. package/packages/crouter-api/dist/commands/sys/sync-deps.js +0 -445
  425. package/packages/crouter-api/dist/commands/sys/sync-project-guidance.js +0 -320
  426. package/packages/crouter-api/dist/commands/sys/sync-shared.js +0 -139
  427. package/packages/crouter-api/dist/commands/sys/sync-skills.js +0 -297
  428. package/packages/crouter-api/dist/commands/sys/sync.js +0 -17
  429. package/packages/crouter-api/dist/commands/sys/terminal-option.js +0 -542
  430. package/packages/crouter-api/dist/commands/sys/tutorial/branch.js +0 -15
  431. package/packages/crouter-api/dist/commands/sys/tutorial/lessons.js +0 -107
  432. package/packages/crouter-api/dist/commands/sys/tutorial/scenario.js +0 -432
  433. package/packages/crouter-api/dist/commands/sys/tutorial/tracks.js +0 -96
  434. package/packages/crouter-api/dist/commands/sys/update.js +0 -158
  435. package/packages/crouter-api/dist/commands/sys/worktrees.js +0 -53
  436. package/packages/crouter-api/dist/commands/sys.js +0 -28
  437. package/packages/crouter-api/dist/core/activity-signal.js +0 -38
  438. package/packages/crouter-api/dist/core/async-array.js +0 -48
  439. package/packages/crouter-api/dist/core/auth-file.js +0 -89
  440. package/packages/crouter-api/dist/core/auth-interaction.js +0 -94
  441. package/packages/crouter-api/dist/core/bash-guard.js +0 -527
  442. package/packages/crouter-api/dist/core/bash-job-supervisor.js +0 -170
  443. package/packages/crouter-api/dist/core/bash-jobs.js +0 -460
  444. package/packages/crouter-api/dist/core/blobs/directory.js +0 -264
  445. package/packages/crouter-api/dist/core/blobs/fault.js +0 -6
  446. package/packages/crouter-api/dist/core/blobs/index.js +0 -30
  447. package/packages/crouter-api/dist/core/blobs/r2.js +0 -169
  448. package/packages/crouter-api/dist/core/broker-client/client.js +0 -186
  449. package/packages/crouter-api/dist/core/broker-client/index.js +0 -14
  450. package/packages/crouter-api/dist/core/broker-client/transport-relay.js +0 -256
  451. package/packages/crouter-api/dist/core/broker-client/transport-socket.js +0 -187
  452. package/packages/crouter-api/dist/core/broker-client/transport.js +0 -40
  453. package/packages/crouter-api/dist/core/canvas/app-run.js +0 -4
  454. package/packages/crouter-api/dist/core/canvas/attention.js +0 -47
  455. package/packages/crouter-api/dist/core/canvas/browse/app.js +0 -1050
  456. package/packages/crouter-api/dist/core/canvas/browse/model.js +0 -477
  457. package/packages/crouter-api/dist/core/canvas/browse/pins.js +0 -29
  458. package/packages/crouter-api/dist/core/canvas/browse/render.js +0 -1058
  459. package/packages/crouter-api/dist/core/canvas/canvas.js +0 -1260
  460. package/packages/crouter-api/dist/core/canvas/crons.js +0 -557
  461. package/packages/crouter-api/dist/core/canvas/daemon-actions.js +0 -99
  462. package/packages/crouter-api/dist/core/canvas/db.js +0 -442
  463. package/packages/crouter-api/dist/core/canvas/deliveries.js +0 -402
  464. package/packages/crouter-api/dist/core/canvas/delivery-contract.js +0 -30
  465. package/packages/crouter-api/dist/core/canvas/executions.js +0 -270
  466. package/packages/crouter-api/dist/core/canvas/extensions.js +0 -90
  467. package/packages/crouter-api/dist/core/canvas/focuses.js +0 -82
  468. package/packages/crouter-api/dist/core/canvas/history.js +0 -480
  469. package/packages/crouter-api/dist/core/canvas/index.js +0 -16
  470. package/packages/crouter-api/dist/core/canvas/install-id.js +0 -64
  471. package/packages/crouter-api/dist/core/canvas/labels.js +0 -43
  472. package/packages/crouter-api/dist/core/canvas/legacy-person.js +0 -4
  473. package/packages/crouter-api/dist/core/canvas/memory-reads.js +0 -37
  474. package/packages/crouter-api/dist/core/canvas/meta-file.js +0 -89
  475. package/packages/crouter-api/dist/core/canvas/nav-render.js +0 -224
  476. package/packages/crouter-api/dist/core/canvas/node-agent-paths.js +0 -30
  477. package/packages/crouter-api/dist/core/canvas/node-order.js +0 -37
  478. package/packages/crouter-api/dist/core/canvas/node-recap.js +0 -62
  479. package/packages/crouter-api/dist/core/canvas/node-tokens.js +0 -53
  480. package/packages/crouter-api/dist/core/canvas/outcome-actions.js +0 -71
  481. package/packages/crouter-api/dist/core/canvas/person.js +0 -239
  482. package/packages/crouter-api/dist/core/canvas/reconciler-leases.js +0 -44
  483. package/packages/crouter-api/dist/core/canvas/recovery.js +0 -715
  484. package/packages/crouter-api/dist/core/canvas/remote-canvas-source.js +0 -290
  485. package/packages/crouter-api/dist/core/canvas/remote-transport.js +0 -57
  486. package/packages/crouter-api/dist/core/canvas/render-source.js +0 -518
  487. package/packages/crouter-api/dist/core/canvas/schema-chain.js +0 -110
  488. package/packages/crouter-api/dist/core/canvas/schema-version.js +0 -58
  489. package/packages/crouter-api/dist/core/canvas/sessions.js +0 -128
  490. package/packages/crouter-api/dist/core/canvas/source.js +0 -57
  491. package/packages/crouter-api/dist/core/canvas/status-glyph.js +0 -147
  492. package/packages/crouter-api/dist/core/canvas/structured-requests.js +0 -176
  493. package/packages/crouter-api/dist/core/canvas/telemetry.js +0 -35
  494. package/packages/crouter-api/dist/core/canvas/tree.js +0 -150
  495. package/packages/crouter-api/dist/core/canvas/types.js +0 -6
  496. package/packages/crouter-api/dist/core/canvas/waits.js +0 -113
  497. package/packages/crouter-api/dist/core/canvas/worktrees.js +0 -97
  498. package/packages/crouter-api/dist/core/checkout-identities.js +0 -107
  499. package/packages/crouter-api/dist/core/clipboard-text.js +0 -57
  500. package/packages/crouter-api/dist/core/command-hooks/artifact.js +0 -145
  501. package/packages/crouter-api/dist/core/command-hooks/catalog.js +0 -38
  502. package/packages/crouter-api/dist/core/command-hooks/compose.js +0 -101
  503. package/packages/crouter-api/dist/core/command-hooks/discovery.js +0 -246
  504. package/packages/crouter-api/dist/core/command-hooks/help.js +0 -18
  505. package/packages/crouter-api/dist/core/command-hooks/lifecycle-catalog.js +0 -9
  506. package/packages/crouter-api/dist/core/command-hooks/lifecycle-create.js +0 -51
  507. package/packages/crouter-api/dist/core/command-hooks/report.js +0 -28
  508. package/packages/crouter-api/dist/core/command-hooks/schema.js +0 -157
  509. package/packages/crouter-api/dist/core/command-hooks/transport/exec-invoke.js +0 -315
  510. package/packages/crouter-api/dist/core/command-hooks/transport/exec-lifecycle.js +0 -248
  511. package/packages/crouter-api/dist/core/command-hooks/transport/plan.js +0 -30
  512. package/packages/crouter-api/dist/core/command-manifests/registry.js +0 -118
  513. package/packages/crouter-api/dist/core/command-plugins/caller-header.js +0 -15
  514. package/packages/crouter-api/dist/core/command-plugins/compose.js +0 -263
  515. package/packages/crouter-api/dist/core/command-plugins/discovery.js +0 -240
  516. package/packages/crouter-api/dist/core/command-plugins/extensions.js +0 -166
  517. package/packages/crouter-api/dist/core/command-plugins/help-addenda.js +0 -55
  518. package/packages/crouter-api/dist/core/command-plugins/presence.js +0 -36
  519. package/packages/crouter-api/dist/core/command-plugins/transport/exec-invoke.js +0 -138
  520. package/packages/crouter-api/dist/core/command-plugins/transport/http-fetch.js +0 -68
  521. package/packages/crouter-api/dist/core/command-plugins/transport/http-invoke.js +0 -333
  522. package/packages/crouter-api/dist/core/command-plugins/transport/http-plan.js +0 -349
  523. package/packages/crouter-api/dist/core/command-plugins/transport/sign.js +0 -115
  524. package/packages/crouter-api/dist/core/command.js +0 -896
  525. package/packages/crouter-api/dist/core/conversation-store/row-store.js +0 -420
  526. package/packages/crouter-api/dist/core/directory/issuer.js +0 -15
  527. package/packages/crouter-api/dist/core/directory/person-credential.js +0 -237
  528. package/packages/crouter-api/dist/core/directory/reach.js +0 -19
  529. package/packages/crouter-api/dist/core/document-lines.js +0 -6
  530. package/packages/crouter-api/dist/core/editor-resolver.js +0 -77
  531. package/packages/crouter-api/dist/core/environment-recipe.js +0 -62
  532. package/packages/crouter-api/dist/core/environment-starter-script.js +0 -64
  533. package/packages/crouter-api/dist/core/environments.js +0 -24
  534. package/packages/crouter-api/dist/core/events/outbound.js +0 -92
  535. package/packages/crouter-api/dist/core/events/read.js +0 -625
  536. package/packages/crouter-api/dist/core/fault-classifier.js +0 -101
  537. package/packages/crouter-api/dist/core/feed/feed.js +0 -190
  538. package/packages/crouter-api/dist/core/feed/inbox.js +0 -93
  539. package/packages/crouter-api/dist/core/feed/messages.js +0 -234
  540. package/packages/crouter-api/dist/core/feed/reports.js +0 -58
  541. package/packages/crouter-api/dist/core/frontmatter.js +0 -35
  542. package/packages/crouter-api/dist/core/git.js +0 -103
  543. package/packages/crouter-api/dist/core/grants/cover.js +0 -66
  544. package/packages/crouter-api/dist/core/grants/hosted-endpoint.js +0 -70
  545. package/packages/crouter-api/dist/core/grants/local.js +0 -26
  546. package/packages/crouter-api/dist/core/grants/mirror.js +0 -506
  547. package/packages/crouter-api/dist/core/grants/on-sync.js +0 -163
  548. package/packages/crouter-api/dist/core/grants/owner.js +0 -21
  549. package/packages/crouter-api/dist/core/grants/shadow.js +0 -138
  550. package/packages/crouter-api/dist/core/grants/sync.js +0 -220
  551. package/packages/crouter-api/dist/core/grants/terminal.js +0 -25
  552. package/packages/crouter-api/dist/core/graph/access.js +0 -37
  553. package/packages/crouter-api/dist/core/graph/bodies.js +0 -68
  554. package/packages/crouter-api/dist/core/graph/custom.js +0 -298
  555. package/packages/crouter-api/dist/core/graph/deletion.js +0 -115
  556. package/packages/crouter-api/dist/core/graph/documents.js +0 -666
  557. package/packages/crouter-api/dist/core/graph/edges.js +0 -83
  558. package/packages/crouter-api/dist/core/graph/events.js +0 -432
  559. package/packages/crouter-api/dist/core/graph/exposures.js +0 -164
  560. package/packages/crouter-api/dist/core/graph/jobs.js +0 -184
  561. package/packages/crouter-api/dist/core/graph/kinds/action.js +0 -20
  562. package/packages/crouter-api/dist/core/graph/kinds/custom.js +0 -23
  563. package/packages/crouter-api/dist/core/graph/kinds/document.js +0 -115
  564. package/packages/crouter-api/dist/core/graph/kinds/dto.js +0 -20
  565. package/packages/crouter-api/dist/core/graph/kinds/environment.js +0 -19
  566. package/packages/crouter-api/dist/core/graph/kinds/job.js +0 -22
  567. package/packages/crouter-api/dist/core/graph/kinds/kind.js +0 -15
  568. package/packages/crouter-api/dist/core/graph/kinds/node.js +0 -85
  569. package/packages/crouter-api/dist/core/graph/kinds/owner.js +0 -24
  570. package/packages/crouter-api/dist/core/graph/kinds/registry.js +0 -58
  571. package/packages/crouter-api/dist/core/graph/kinds/render.js +0 -17
  572. package/packages/crouter-api/dist/core/graph/names.js +0 -225
  573. package/packages/crouter-api/dist/core/graph/objects.js +0 -277
  574. package/packages/crouter-api/dist/core/graph/package-docs.js +0 -153
  575. package/packages/crouter-api/dist/core/graph/package-files.js +0 -146
  576. package/packages/crouter-api/dist/core/graph/package-publish.js +0 -165
  577. package/packages/crouter-api/dist/core/graph/package-reconcile.js +0 -99
  578. package/packages/crouter-api/dist/core/graph/reader.js +0 -315
  579. package/packages/crouter-api/dist/core/graph/receiver-url.js +0 -83
  580. package/packages/crouter-api/dist/core/graph/receivers.js +0 -66
  581. package/packages/crouter-api/dist/core/graph/repo-sync/identity.js +0 -147
  582. package/packages/crouter-api/dist/core/graph/repo-sync/repos.js +0 -134
  583. package/packages/crouter-api/dist/core/graph/rules.js +0 -144
  584. package/packages/crouter-api/dist/core/graph/types.js +0 -10
  585. package/packages/crouter-api/dist/core/graph/watches.js +0 -223
  586. package/packages/crouter-api/dist/core/human/action-binding.js +0 -41
  587. package/packages/crouter-api/dist/core/human/answer-text.js +0 -100
  588. package/packages/crouter-api/dist/core/human/answer.js +0 -119
  589. package/packages/crouter-api/dist/core/human/completion.js +0 -27
  590. package/packages/crouter-api/dist/core/human/component-docs.js +0 -442
  591. package/packages/crouter-api/dist/core/human/convention.js +0 -75
  592. package/packages/crouter-api/dist/core/human/feedback-companion.js +0 -92
  593. package/packages/crouter-api/dist/core/human/feedback.js +0 -88
  594. package/packages/crouter-api/dist/core/human/page-authoring.js +0 -19
  595. package/packages/crouter-api/dist/core/human/page-errors.js +0 -14
  596. package/packages/crouter-api/dist/core/human/page-eval.js +0 -125
  597. package/packages/crouter-api/dist/core/human/page-html-markdown.js +0 -260
  598. package/packages/crouter-api/dist/core/human/page-markdown.js +0 -291
  599. package/packages/crouter-api/dist/core/human/page-schema.js +0 -381
  600. package/packages/crouter-api/dist/core/human/page.js +0 -251
  601. package/packages/crouter-api/dist/core/human/request-files.js +0 -54
  602. package/packages/crouter-api/dist/core/human/requests.js +0 -647
  603. package/packages/crouter-api/dist/core/human/root.js +0 -11
  604. package/packages/crouter-api/dist/core/human/summary.js +0 -5
  605. package/packages/crouter-api/dist/core/human/tickets.js +0 -166
  606. package/packages/crouter-api/dist/core/human/types.js +0 -1
  607. package/packages/crouter-api/dist/core/human/visible-paths.js +0 -74
  608. package/packages/crouter-api/dist/core/human-actions.js +0 -101
  609. package/packages/crouter-api/dist/core/import/bundle/blob-keys.js +0 -25
  610. package/packages/crouter-api/dist/core/import/bundle/layout.js +0 -111
  611. package/packages/crouter-api/dist/core/import/export/archive.js +0 -22
  612. package/packages/crouter-api/dist/core/import/export/cloud.js +0 -175
  613. package/packages/crouter-api/dist/core/import/export/dump.js +0 -245
  614. package/packages/crouter-api/dist/core/import/export/files.js +0 -169
  615. package/packages/crouter-api/dist/core/import/export/inline.js +0 -15
  616. package/packages/crouter-api/dist/core/import/export/source.js +0 -5
  617. package/packages/crouter-api/dist/core/import/export/stores.js +0 -73
  618. package/packages/crouter-api/dist/core/import/load/catalog.js +0 -70
  619. package/packages/crouter-api/dist/core/import/load/copy.js +0 -173
  620. package/packages/crouter-api/dist/core/import/load/keys.js +0 -77
  621. package/packages/crouter-api/dist/core/import/load/prepare.js +0 -262
  622. package/packages/crouter-api/dist/core/import/load/rewrite.js +0 -314
  623. package/packages/crouter-api/dist/core/import/load/stage.js +0 -99
  624. package/packages/crouter-api/dist/core/inspector/chrome.js +0 -14
  625. package/packages/crouter-api/dist/core/inspector/contract.js +0 -1
  626. package/packages/crouter-api/dist/core/inspector/core.js +0 -296
  627. package/packages/crouter-api/dist/core/inspector/host.js +0 -538
  628. package/packages/crouter-api/dist/core/inspector/model.js +0 -225
  629. package/packages/crouter-api/dist/core/inspector/text.js +0 -45
  630. package/packages/crouter-api/dist/core/inspector/transport.js +0 -36
  631. package/packages/crouter-api/dist/core/inspector/tui.js +0 -295
  632. package/packages/crouter-api/dist/core/keybindings/background-bash.js +0 -33
  633. package/packages/crouter-api/dist/core/keybindings/inbox.js +0 -25
  634. package/packages/crouter-api/dist/core/keybindings/index.js +0 -7
  635. package/packages/crouter-api/dist/core/keybindings/match.js +0 -146
  636. package/packages/crouter-api/dist/core/keybindings/persistence.js +0 -47
  637. package/packages/crouter-api/dist/core/keybindings/resolve.js +0 -348
  638. package/packages/crouter-api/dist/core/ledger/account.js +0 -13
  639. package/packages/crouter-api/dist/core/ledger/charges.js +0 -44
  640. package/packages/crouter-api/dist/core/ledger/check.js +0 -40
  641. package/packages/crouter-api/dist/core/ledger/chunks.js +0 -47
  642. package/packages/crouter-api/dist/core/ledger/environment-payer.js +0 -15
  643. package/packages/crouter-api/dist/core/ledger/index.js +0 -11
  644. package/packages/crouter-api/dist/core/ledger/infra-allowance.js +0 -31
  645. package/packages/crouter-api/dist/core/ledger/limits.js +0 -35
  646. package/packages/crouter-api/dist/core/ledger/months.js +0 -19
  647. package/packages/crouter-api/dist/core/ledger/payer.js +0 -23
  648. package/packages/crouter-api/dist/core/ledger/read.js +0 -211
  649. package/packages/crouter-api/dist/core/ledger/totals.js +0 -34
  650. package/packages/crouter-api/dist/core/ledger/types.js +0 -2
  651. package/packages/crouter-api/dist/core/llm/app-rungs.js +0 -64
  652. package/packages/crouter-api/dist/core/llm/body-limits.js +0 -7
  653. package/packages/crouter-api/dist/core/llm/owner-candidates.js +0 -79
  654. package/packages/crouter-api/dist/core/llm/refusal.js +0 -22
  655. package/packages/crouter-api/dist/core/llm/run.js +0 -571
  656. package/packages/crouter-api/dist/core/logged-step-timings.js +0 -52
  657. package/packages/crouter-api/dist/core/manifest-stale.js +0 -39
  658. package/packages/crouter-api/dist/core/model-auth/api-credential-store.js +0 -49
  659. package/packages/crouter-api/dist/core/model-auth/daemon-login.js +0 -156
  660. package/packages/crouter-api/dist/core/model-auth/readiness.js +0 -83
  661. package/packages/crouter-api/dist/core/model-routes-pool.js +0 -57
  662. package/packages/crouter-api/dist/core/model-routes.js +0 -212
  663. package/packages/crouter-api/dist/core/northlight/previews.js +0 -87
  664. package/packages/crouter-api/dist/core/nvim-launch.js +0 -45
  665. package/packages/crouter-api/dist/core/output.js +0 -99
  666. package/packages/crouter-api/dist/core/packages/eligibility.js +0 -34
  667. package/packages/crouter-api/dist/core/packages/launch-kinds.js +0 -20
  668. package/packages/crouter-api/dist/core/packages/source-url.js +0 -17
  669. package/packages/crouter-api/dist/core/pagination.js +0 -88
  670. package/packages/crouter-api/dist/core/peer/client.js +0 -168
  671. package/packages/crouter-api/dist/core/peer/directory.js +0 -193
  672. package/packages/crouter-api/dist/core/peer/envelope.js +0 -99
  673. package/packages/crouter-api/dist/core/peer/names.js +0 -8
  674. package/packages/crouter-api/dist/core/peer/outbox-store.js +0 -84
  675. package/packages/crouter-api/dist/core/peer/receiver.js +0 -54
  676. package/packages/crouter-api/dist/core/peer/stubs.js +0 -212
  677. package/packages/crouter-api/dist/core/peer/token.js +0 -30
  678. package/packages/crouter-api/dist/core/peer/version.js +0 -23
  679. package/packages/crouter-api/dist/core/permissions/builtin.js +0 -29
  680. package/packages/crouter-api/dist/core/permissions/ceiling.js +0 -345
  681. package/packages/crouter-api/dist/core/permissions/compile.js +0 -175
  682. package/packages/crouter-api/dist/core/permissions/errors.js +0 -13
  683. package/packages/crouter-api/dist/core/permissions/evaluator.js +0 -139
  684. package/packages/crouter-api/dist/core/permissions/facts.js +0 -102
  685. package/packages/crouter-api/dist/core/permissions/schema-parser.js +0 -151
  686. package/packages/crouter-api/dist/core/permissions/schemas.js +0 -83
  687. package/packages/crouter-api/dist/core/permissions/sql.js +0 -31
  688. package/packages/crouter-api/dist/core/plugin-app.js +0 -58
  689. package/packages/crouter-api/dist/core/plugin-quarantine.js +0 -70
  690. package/packages/crouter-api/dist/core/pool-credential-store.js +0 -135
  691. package/packages/crouter-api/dist/core/predicate.js +0 -191
  692. package/packages/crouter-api/dist/core/preview-registry.js +0 -399
  693. package/packages/crouter-api/dist/core/profiles/default-binding.js +0 -29
  694. package/packages/crouter-api/dist/core/profiles/deletion-reservation.js +0 -42
  695. package/packages/crouter-api/dist/core/profiles/select.js +0 -750
  696. package/packages/crouter-api/dist/core/provider-credential.js +0 -17
  697. package/packages/crouter-api/dist/core/provider-error-recognition.js +0 -82
  698. package/packages/crouter-api/dist/core/provider-failure.js +0 -166
  699. package/packages/crouter-api/dist/core/provider-management.js +0 -9
  700. package/packages/crouter-api/dist/core/providers/approval.js +0 -146
  701. package/packages/crouter-api/dist/core/providers/audit.js +0 -52
  702. package/packages/crouter-api/dist/core/providers/bundles.js +0 -643
  703. package/packages/crouter-api/dist/core/providers/call.js +0 -503
  704. package/packages/crouter-api/dist/core/providers/description.js +0 -1
  705. package/packages/crouter-api/dist/core/providers/device-libs.js +0 -202
  706. package/packages/crouter-api/dist/core/providers/device.js +0 -95
  707. package/packages/crouter-api/dist/core/providers/errors.js +0 -137
  708. package/packages/crouter-api/dist/core/providers/files.js +0 -461
  709. package/packages/crouter-api/dist/core/providers/inflight.js +0 -14
  710. package/packages/crouter-api/dist/core/providers/mint.js +0 -248
  711. package/packages/crouter-api/dist/core/providers/receipts.js +0 -50
  712. package/packages/crouter-api/dist/core/providers/request.js +0 -173
  713. package/packages/crouter-api/dist/core/providers/roots.js +0 -118
  714. package/packages/crouter-api/dist/core/providers/token-cache.js +0 -203
  715. package/packages/crouter-api/dist/core/remote-canvas-target.js +0 -30
  716. package/packages/crouter-api/dist/core/review/anchors.js +0 -91
  717. package/packages/crouter-api/dist/core/review/comments.js +0 -277
  718. package/packages/crouter-api/dist/core/review/companion.js +0 -207
  719. package/packages/crouter-api/dist/core/review/document.js +0 -71
  720. package/packages/crouter-api/dist/core/review/project.js +0 -46
  721. package/packages/crouter-api/dist/core/review/store.js +0 -178
  722. package/packages/crouter-api/dist/core/review/types.js +0 -23
  723. package/packages/crouter-api/dist/core/runs/activity.js +0 -57
  724. package/packages/crouter-api/dist/core/runs/events.js +0 -179
  725. package/packages/crouter-api/dist/core/runs/initial-input.js +0 -27
  726. package/packages/crouter-api/dist/core/runs/node-sub.js +0 -10
  727. package/packages/crouter-api/dist/core/runs/operations.js +0 -800
  728. package/packages/crouter-api/dist/core/runs/questions.js +0 -151
  729. package/packages/crouter-api/dist/core/runtime/banner.js +0 -53
  730. package/packages/crouter-api/dist/core/runtime/bearings-render.js +0 -284
  731. package/packages/crouter-api/dist/core/runtime/bearings.js +0 -208
  732. package/packages/crouter-api/dist/core/runtime/bin-contributions.js +0 -186
  733. package/packages/crouter-api/dist/core/runtime/blaxel-environment.js +0 -17
  734. package/packages/crouter-api/dist/core/runtime/broker/bash-job-launch.js +0 -65
  735. package/packages/crouter-api/dist/core/runtime/broker/model-adapter.js +0 -453
  736. package/packages/crouter-api/dist/core/runtime/broker/read-ops.js +0 -174
  737. package/packages/crouter-api/dist/core/runtime/broker/turn-cause.js +0 -44
  738. package/packages/crouter-api/dist/core/runtime/broker-ownership.js +0 -6
  739. package/packages/crouter-api/dist/core/runtime/broker-protocol.js +0 -166
  740. package/packages/crouter-api/dist/core/runtime/broker-request.js +0 -86
  741. package/packages/crouter-api/dist/core/runtime/broker-sdk.js +0 -130
  742. package/packages/crouter-api/dist/core/runtime/broker-wedge.js +0 -97
  743. package/packages/crouter-api/dist/core/runtime/canvas-extensions.js +0 -100
  744. package/packages/crouter-api/dist/core/runtime/close.js +0 -266
  745. package/packages/crouter-api/dist/core/runtime/command-expansion.js +0 -104
  746. package/packages/crouter-api/dist/core/runtime/command-surface.js +0 -117
  747. package/packages/crouter-api/dist/core/runtime/crtr-theme.js +0 -146
  748. package/packages/crouter-api/dist/core/runtime/deliver-live.js +0 -85
  749. package/packages/crouter-api/dist/core/runtime/fault-recovery.js +0 -72
  750. package/packages/crouter-api/dist/core/runtime/fault.js +0 -17
  751. package/packages/crouter-api/dist/core/runtime/fleet.js +0 -75
  752. package/packages/crouter-api/dist/core/runtime/focus-viewer.js +0 -151
  753. package/packages/crouter-api/dist/core/runtime/front-door-env.js +0 -16
  754. package/packages/crouter-api/dist/core/runtime/headless-pi.js +0 -176
  755. package/packages/crouter-api/dist/core/runtime/host.js +0 -717
  756. package/packages/crouter-api/dist/core/runtime/interactive-deliver.js +0 -51
  757. package/packages/crouter-api/dist/core/runtime/invocation.js +0 -10
  758. package/packages/crouter-api/dist/core/runtime/kickoff.js +0 -263
  759. package/packages/crouter-api/dist/core/runtime/launch-prompt.js +0 -13
  760. package/packages/crouter-api/dist/core/runtime/launch-recipe.js +0 -45
  761. package/packages/crouter-api/dist/core/runtime/launch-target.js +0 -87
  762. package/packages/crouter-api/dist/core/runtime/launch.js +0 -505
  763. package/packages/crouter-api/dist/core/runtime/ledger.js +0 -55
  764. package/packages/crouter-api/dist/core/runtime/lifecycle.js +0 -286
  765. package/packages/crouter-api/dist/core/runtime/managed-provider-cooling.js +0 -62
  766. package/packages/crouter-api/dist/core/runtime/memory-admission.js +0 -68
  767. package/packages/crouter-api/dist/core/runtime/model-registry.js +0 -13
  768. package/packages/crouter-api/dist/core/runtime/model-selection.js +0 -135
  769. package/packages/crouter-api/dist/core/runtime/model-swap.js +0 -76
  770. package/packages/crouter-api/dist/core/runtime/naming.js +0 -300
  771. package/packages/crouter-api/dist/core/runtime/nerd-font.js +0 -162
  772. package/packages/crouter-api/dist/core/runtime/nodes.js +0 -506
  773. package/packages/crouter-api/dist/core/runtime/outcome-document.js +0 -86
  774. package/packages/crouter-api/dist/core/runtime/output-result.js +0 -32
  775. package/packages/crouter-api/dist/core/runtime/output-schema-refs.js +0 -100
  776. package/packages/crouter-api/dist/core/runtime/package-health.js +0 -100
  777. package/packages/crouter-api/dist/core/runtime/persona.js +0 -54
  778. package/packages/crouter-api/dist/core/runtime/pi-cli.js +0 -65
  779. package/packages/crouter-api/dist/core/runtime/pi-vendored.js +0 -63
  780. package/packages/crouter-api/dist/core/runtime/placement-tmux.js +0 -81
  781. package/packages/crouter-api/dist/core/runtime/placement.js +0 -418
  782. package/packages/crouter-api/dist/core/runtime/progress-bar.js +0 -50
  783. package/packages/crouter-api/dist/core/runtime/provider-credential-gate.js +0 -48
  784. package/packages/crouter-api/dist/core/runtime/recovery-hold.js +0 -46
  785. package/packages/crouter-api/dist/core/runtime/reopen.js +0 -165
  786. package/packages/crouter-api/dist/core/runtime/revive-all.js +0 -108
  787. package/packages/crouter-api/dist/core/runtime/revive.js +0 -762
  788. package/packages/crouter-api/dist/core/runtime/roadmap.js +0 -86
  789. package/packages/crouter-api/dist/core/runtime/runner/blaxel/client.js +0 -150
  790. package/packages/crouter-api/dist/core/runtime/runner/blaxel/image-build.js +0 -280
  791. package/packages/crouter-api/dist/core/runtime/runner/blaxel/release-image.js +0 -97
  792. package/packages/crouter-api/dist/core/runtime/runner/blaxel/runner.js +0 -214
  793. package/packages/crouter-api/dist/core/runtime/runner/delete-sandboxes.js +0 -88
  794. package/packages/crouter-api/dist/core/runtime/runner/index.js +0 -37
  795. package/packages/crouter-api/dist/core/runtime/runner/machine/call.js +0 -110
  796. package/packages/crouter-api/dist/core/runtime/runner/machine/environment.js +0 -7
  797. package/packages/crouter-api/dist/core/runtime/runner/machine/executor.js +0 -235
  798. package/packages/crouter-api/dist/core/runtime/runner/machine/ops.js +0 -37
  799. package/packages/crouter-api/dist/core/runtime/runner/machine/runner.js +0 -72
  800. package/packages/crouter-api/dist/core/runtime/runner/process.js +0 -70
  801. package/packages/crouter-api/dist/core/runtime/runner/types.js +0 -16
  802. package/packages/crouter-api/dist/core/runtime/session-branch.js +0 -16
  803. package/packages/crouter-api/dist/core/runtime/session-cycles.js +0 -144
  804. package/packages/crouter-api/dist/core/runtime/session-list-cache.js +0 -302
  805. package/packages/crouter-api/dist/core/runtime/session-visibility.js +0 -99
  806. package/packages/crouter-api/dist/core/runtime/setup-marker.js +0 -46
  807. package/packages/crouter-api/dist/core/runtime/situational-context.js +0 -54
  808. package/packages/crouter-api/dist/core/runtime/situational-live.js +0 -41
  809. package/packages/crouter-api/dist/core/runtime/spawn-env-rows.js +0 -15
  810. package/packages/crouter-api/dist/core/runtime/spawn-env.js +0 -260
  811. package/packages/crouter-api/dist/core/runtime/spawn.js +0 -867
  812. package/packages/crouter-api/dist/core/runtime/stamp/protocol.js +0 -113
  813. package/packages/crouter-api/dist/core/runtime/start-check.js +0 -43
  814. package/packages/crouter-api/dist/core/runtime/stop-guard.js +0 -150
  815. package/packages/crouter-api/dist/core/runtime/stop-signals.js +0 -46
  816. package/packages/crouter-api/dist/core/runtime/structured-output.js +0 -112
  817. package/packages/crouter-api/dist/core/runtime/surface-bg.js +0 -85
  818. package/packages/crouter-api/dist/core/runtime/tmux-bindings.js +0 -738
  819. package/packages/crouter-api/dist/core/runtime/tmux-chrome.js +0 -5
  820. package/packages/crouter-api/dist/core/runtime/tmux-driver.js +0 -706
  821. package/packages/crouter-api/dist/core/runtime/unsandboxed.js +0 -18
  822. package/packages/crouter-api/dist/core/runtime/view-socket.js +0 -195
  823. package/packages/crouter-api/dist/core/runtime/warm-pool.js +0 -479
  824. package/packages/crouter-api/dist/core/scoped-state/person-rows.js +0 -185
  825. package/packages/crouter-api/dist/core/scopes.js +0 -48
  826. package/packages/crouter-api/dist/core/secrets/blaxel-launch.js +0 -104
  827. package/packages/crouter-api/dist/core/secrets/env-rows.js +0 -40
  828. package/packages/crouter-api/dist/core/secrets/environment-owner.js +0 -31
  829. package/packages/crouter-api/dist/core/secrets/environment-secrets.js +0 -14
  830. package/packages/crouter-api/dist/core/secrets/index.js +0 -2
  831. package/packages/crouter-api/dist/core/secrets/key.js +0 -33
  832. package/packages/crouter-api/dist/core/secrets/seal.js +0 -43
  833. package/packages/crouter-api/dist/core/secrets.js +0 -137
  834. package/packages/crouter-api/dist/core/self-update.js +0 -77
  835. package/packages/crouter-api/dist/core/session-model/session-state.js +0 -180
  836. package/packages/crouter-api/dist/core/shell-segments.js +0 -169
  837. package/packages/crouter-api/dist/core/spaces/cache-env.js +0 -15
  838. package/packages/crouter-api/dist/core/spaces/file-root.js +0 -68
  839. package/packages/crouter-api/dist/core/spaces/mounts.js +0 -126
  840. package/packages/crouter-api/dist/core/spaces/permissions.js +0 -83
  841. package/packages/crouter-api/dist/core/spaces/process.js +0 -175
  842. package/packages/crouter-api/dist/core/spaces/runtime-home.js +0 -8
  843. package/packages/crouter-api/dist/core/spaces/space.js +0 -58
  844. package/packages/crouter-api/dist/core/spaces/stop.js +0 -138
  845. package/packages/crouter-api/dist/core/spaces/users.js +0 -43
  846. package/packages/crouter-api/dist/core/sqlite-statements.js +0 -17
  847. package/packages/crouter-api/dist/core/statements.js +0 -81
  848. package/packages/crouter-api/dist/core/step-timings.js +0 -63
  849. package/packages/crouter-api/dist/core/storage/attachments.js +0 -141
  850. package/packages/crouter-api/dist/core/storage/caller-file.js +0 -84
  851. package/packages/crouter-api/dist/core/storage/client.js +0 -220
  852. package/packages/crouter-api/dist/core/storage/media-types.js +0 -22
  853. package/packages/crouter-api/dist/core/storage/node-transfer.js +0 -100
  854. package/packages/crouter-api/dist/core/storage/purge.js +0 -55
  855. package/packages/crouter-api/dist/core/storage/tables.js +0 -129
  856. package/packages/crouter-api/dist/core/subscription-state.js +0 -470
  857. package/packages/crouter-api/dist/core/substrate/delivery/corpus.js +0 -239
  858. package/packages/crouter-api/dist/core/substrate/delivery/deliver.js +0 -370
  859. package/packages/crouter-api/dist/core/substrate/delivery/listings.js +0 -75
  860. package/packages/crouter-api/dist/core/substrate/delivery/match.js +0 -146
  861. package/packages/crouter-api/dist/core/substrate/delivery/plan.js +0 -132
  862. package/packages/crouter-api/dist/core/substrate/delivery/render-boot.js +0 -330
  863. package/packages/crouter-api/dist/core/substrate/delivery/render-event.js +0 -186
  864. package/packages/crouter-api/dist/core/substrate/delivery/sub-persona-menu.js +0 -24
  865. package/packages/crouter-api/dist/core/substrate/delivery/types.js +0 -1
  866. package/packages/crouter-api/dist/core/substrate/gate-explain.js +0 -397
  867. package/packages/crouter-api/dist/core/substrate/schema.js +0 -81
  868. package/packages/crouter-api/dist/core/substrate/subject-fields.js +0 -39
  869. package/packages/crouter-api/dist/core/substrate/subject.js +0 -60
  870. package/packages/crouter-api/dist/core/termrender/display.js +0 -56
  871. package/packages/crouter-api/dist/core/termrender/termrender.js +0 -719
  872. package/packages/crouter-api/dist/core/termrender/version.js +0 -1
  873. package/packages/crouter-api/dist/core/timing.js +0 -108
  874. package/packages/crouter-api/dist/core/tui/draw.js +0 -378
  875. package/packages/crouter-api/dist/core/tui/fuzzy.js +0 -38
  876. package/packages/crouter-api/dist/core/tui/markdown.js +0 -407
  877. package/packages/crouter-api/dist/core/tui/page-host.js +0 -74
  878. package/packages/crouter-api/dist/core/tui/panel.js +0 -142
  879. package/packages/crouter-api/dist/core/tui/terminal.js +0 -100
  880. package/packages/crouter-api/dist/core/wake.js +0 -296
  881. package/packages/crouter-api/dist/core/worktree-close.js +0 -205
  882. package/packages/crouter-api/dist/core/worktree-containment.js +0 -48
  883. package/packages/crouter-api/dist/core/worktree-landing.js +0 -8
  884. package/packages/crouter-api/dist/core/worktree-machine.js +0 -112
  885. package/packages/crouter-api/dist/core/worktree-mutation-async.js +0 -393
  886. package/packages/crouter-api/dist/core/worktree-remove.js +0 -84
  887. package/packages/crouter-api/dist/core/worktree-scripts.js +0 -72
  888. package/packages/crouter-api/dist/core/worktree-sweep.js +0 -448
  889. package/packages/crouter-api/dist/core/worktree.js +0 -844
  890. package/packages/crouter-api/dist/daemon/api/deferred-head.js +0 -117
  891. package/packages/crouter-api/dist/daemon/api/environment-of.js +0 -67
  892. package/packages/crouter-api/dist/daemon/api/handlers/bash-jobs.js +0 -352
  893. package/packages/crouter-api/dist/daemon/api/handlers/broker-ops.js +0 -705
  894. package/packages/crouter-api/dist/daemon/api/handlers/broker-recovery.js +0 -266
  895. package/packages/crouter-api/dist/daemon/api/handlers/execution-start.js +0 -120
  896. package/packages/crouter-api/dist/daemon/api/handlers/git-credential.js +0 -76
  897. package/packages/crouter-api/dist/daemon/api/handlers/node-records.js +0 -113
  898. package/packages/crouter-api/dist/daemon/api/handlers/providers.js +0 -290
  899. package/packages/crouter-api/dist/daemon/api/handlers/telemetry-record.js +0 -34
  900. package/packages/crouter-api/dist/daemon/api/handlers/validate.js +0 -58
  901. package/packages/crouter-api/dist/daemon/api/map.js +0 -750
  902. package/packages/crouter-api/dist/daemon/api/operations.js +0 -325
  903. package/packages/crouter-api/dist/daemon/api/principal.js +0 -166
  904. package/packages/crouter-api/dist/daemon/api/reader.js +0 -133
  905. package/packages/crouter-api/dist/daemon/api/router.js +0 -568
  906. package/packages/crouter-api/dist/daemon/api/sync-notice.js +0 -46
  907. package/packages/crouter-api/dist/daemon/api/viewer-presence.js +0 -100
  908. package/packages/crouter-api/dist/daemon/companion-retire.js +0 -44
  909. package/packages/crouter-api/dist/daemon/control.js +0 -22
  910. package/packages/crouter-api/dist/daemon/cron/armed-context.js +0 -140
  911. package/packages/crouter-api/dist/daemon/cron/authority.js +0 -101
  912. package/packages/crouter-api/dist/daemon/cron/capture.js +0 -50
  913. package/packages/crouter-api/dist/daemon/cron/closed.js +0 -108
  914. package/packages/crouter-api/dist/daemon/cron/disposition.js +0 -63
  915. package/packages/crouter-api/dist/daemon/cron/ended.js +0 -91
  916. package/packages/crouter-api/dist/daemon/cron/escalation.js +0 -136
  917. package/packages/crouter-api/dist/daemon/cron/held.js +0 -20
  918. package/packages/crouter-api/dist/daemon/cron/live-runs.js +0 -65
  919. package/packages/crouter-api/dist/daemon/cron/machine-fire.js +0 -240
  920. package/packages/crouter-api/dist/daemon/cron/narrowed.js +0 -34
  921. package/packages/crouter-api/dist/daemon/cron/recurrence.js +0 -38
  922. package/packages/crouter-api/dist/daemon/cron/run-socket.js +0 -170
  923. package/packages/crouter-api/dist/daemon/cron/run-token.js +0 -37
  924. package/packages/crouter-api/dist/daemon/cron/settle.js +0 -78
  925. package/packages/crouter-api/dist/daemon/cron/sinks.js +0 -70
  926. package/packages/crouter-api/dist/daemon/drain.js +0 -76
  927. package/packages/crouter-api/dist/daemon/http-dispatcher.js +0 -37
  928. package/packages/crouter-api/dist/daemon/human/finish.js +0 -179
  929. package/packages/crouter-api/dist/daemon/human/settle.js +0 -98
  930. package/packages/crouter-api/dist/daemon/machine-link/credential.js +0 -24
  931. package/packages/crouter-api/dist/daemon/machine-link/forward.js +0 -201
  932. package/packages/crouter-api/dist/daemon/machine-link/frames.js +0 -33
  933. package/packages/crouter-api/dist/daemon/machine-link/holder.js +0 -395
  934. package/packages/crouter-api/dist/daemon/park-activity.js +0 -33
  935. package/packages/crouter-api/dist/daemon/park-pending.js +0 -76
  936. package/packages/crouter-api/dist/daemon/postgres/binary.js +0 -193
  937. package/packages/crouter-api/dist/daemon/postgres/cluster.js +0 -111
  938. package/packages/crouter-api/dist/daemon/postgres/pins.js +0 -16
  939. package/packages/crouter-api/dist/daemon/postgres/supervisor.js +0 -177
  940. package/packages/crouter-api/dist/daemon/readiness.js +0 -37
  941. package/packages/crouter-api/dist/daemon/reconcilers/broker-supervision.js +0 -746
  942. package/packages/crouter-api/dist/daemon/reconcilers/ledger-sandbox.js +0 -249
  943. package/packages/crouter-api/dist/daemon/reconcilers/live-obligation.js +0 -125
  944. package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/launch-failure.js +0 -8
  945. package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/node-person.js +0 -40
  946. package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/remote-wake.js +0 -166
  947. package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/respawn-policy.js +0 -59
  948. package/packages/crouter-api/dist/daemon/reconcilers/recipe-image.js +0 -204
  949. package/packages/crouter-api/dist/daemon/reconcilers/throttled-lane.js +0 -63
  950. package/packages/crouter-api/dist/daemon/review/companion.js +0 -29
  951. package/packages/crouter-api/dist/daemon/review/deliver.js +0 -14
  952. package/packages/crouter-api/dist/daemon/review/finish.js +0 -149
  953. package/packages/crouter-api/dist/daemon/runs/append-section.js +0 -129
  954. package/packages/crouter-api/dist/daemon/runs/observer.js +0 -440
  955. package/packages/crouter-api/dist/daemon/runs/view-transport.js +0 -81
  956. package/packages/crouter-api/dist/daemon/structured-requests/sidecar.js +0 -5
  957. package/packages/crouter-api/dist/hook-authoring.js +0 -447
  958. package/packages/crouter-api/dist/hook-process.js +0 -34
  959. package/packages/crouter-api/dist/launcher/limits/settings.js +0 -94
  960. package/packages/crouter-api/dist/migrations/004-canvas-documents/fields.js +0 -52
  961. package/packages/crouter-api/dist/shared/git-status.js +0 -44
  962. package/packages/crouter-api/dist/shared/inline-ref-grammar.js +0 -99
  963. package/packages/crouter-api/dist/shared/shell-quote.js +0 -5
  964. package/packages/crouter-api/dist/shared/strip-cd-prefix.js +0 -13
  965. package/packages/crouter-api/dist/shared/tool-groups.js +0 -64
  966. package/packages/crouter-api/dist/shared/traceparent.js +0 -28
  967. package/packages/crouter-api/dist/shared/turn-replies.js +0 -66
@@ -1,34 +0,0 @@
1
- import { type SourceJson } from '../bundle/layout.js';
2
- export interface DumpRequestRef {
3
- id: string;
4
- dir: string;
5
- file: string | null;
6
- }
7
- export interface DumpRunningNode {
8
- node: string;
9
- app: string;
10
- cwd: string;
11
- worktree: string | null;
12
- }
13
- export interface DumpResult {
14
- source: SourceJson;
15
- /** Human requests (page and review) with the folder and reviewed file their rows name. */
16
- requests: DumpRequestRef[];
17
- /** Nodes with status active or idle, for the hosted node-file archives. */
18
- runningNodes: DumpRunningNode[];
19
- /** `body_ref` files that could not be read and stayed as references. */
20
- bodiesMissing: number;
21
- bodiesInlined: number;
22
- }
23
- /** A row part file holds about this much JSON (the encoded lines, before compression); a row that alone exceeds it is a part of its own. */
24
- export declare const PART_JSON_BYTES: number;
25
- /** A body longer than this many UTF-8 bytes fails the export. The largest body on Silas's Mac is 5.2 MB. JSON escapes one character into at most six (`\u0001`), so a body at
26
- * the ceiling is a line of at most 192 MiB, well inside V8's ~512 MiB string limit. */
27
- export declare const BODY_MAX_BYTES: number;
28
- /** The pre-pause dump of `bodies` (design-import cutover step 2): every row, while nodes still run. Rows are never updated or deleted, so the pause dump
29
- * needs only the rows whose hash is not in the list this leaves in `<out>/bodies-pre.json`. */
30
- export declare function dumpBodiesPre(out: string): Promise<{
31
- parts: string[];
32
- count: number;
33
- }>;
34
- export declare function dumpRows(out: string, kind: SourceJson['kind'], maxPageRows?: number): Promise<DumpResult>;
@@ -1,4 +0,0 @@
1
- var Q=Object.defineProperty;var s=(t,e)=>Q(t,"name",{value:e,configurable:!0});import{mkdirSync as Z,readFileSync as $,writeFileSync as K}from"node:fs";import{join as w}from"node:path";import{openDb as ee,withCanvasWrite as te}from"../../canvas/db.js";import{hashOf as re}from"../../graph/bodies.js";import{personIdAsync as ne}from"../../canvas/person.js";import{CANVAS_SCHEMA_VERSION as ae}from"../../canvas/schema-version.js";import{crtrVersion as se}from"../../../shared/crtr-version.js";import{BODIES_TABLE as O,DUMPED_TABLES as k,RowFileWriter as oe,SEQ_TABLES as ie,rowLine as W}from"../bundle/layout.js";import{inlineMessageBody as ce}from"./inline.js";const le=16*1024*1024,he=8*1024*1024,Y=32*1024*1024,de=500,j=5e3,g="bodies-pre.json";class v{static{s(this,"PartWriter")}dir;prefix;parts=[];file=null;constructor(e,a){this.dir=e,this.prefix=a,Z(e,{recursive:!0})}async add(e){const a=Buffer.byteLength(e,"utf8");if(this.file!==null&&this.file.bytes>0&&this.file.bytes+a>le&&await this.close(),this.file===null){const o=`${this.prefix}${this.parts.length}`;this.file=new oe(w(this.dir,`${o}.jsonl.zst`)),this.parts.push(o)}await this.file.write(e,a)}async close(){const e=this.file;this.file=null,e!==null&&await e.close()}destroy(){this.file?.destroy(),this.file=null}}const b=s(t=>`"${t.replace(/"/g,'""')}"`,"q");function pe(t){try{const e=$(t,"utf8");return e.trim()===""?null:e}catch(e){if(e.code==="ENOENT")return null;throw e}}s(pe,"readText");function ue(t,e){return new Error(`revision text ${t} is ${e} bytes; the import carries at most ${Y} bytes of text per body`)}s(ue,"tooLarge");function Ee(t){const e=re(t.text);if(e!==t.hash)throw new Error(`body ${t.hash} does not hash to its key (its text hashes to ${e}); upgrade and restart the daemon so its boot repair rekeys the row, then export again`)}s(Ee,"assertCanonical");async function H(t,e,a,o){const n=new v(w(e,"rows",O),`${a}-`),y=s(async i=>{Ee(i),await n.add(W(i))},"add");try{for(let i=0;i<o.length;){const S=await t.prepare("SELECT hash, octet_length(text) AS n FROM bodies WHERE hash = ANY(?::text[]) ORDER BY hash").all(o.slice(i,i+j));let h=[],u=0;const m=s(async()=>{if(h.length===0)return;const l=await t.prepare("SELECT hash, text FROM bodies WHERE hash = ANY(?::text[]) ORDER BY hash").all(h);for(const d of l)await y(d);h=[],u=0},"fetchPage");for(const{hash:l,n:d}of S){const p=Number(d);if(p>Y)throw ue(l,p);h.length>0&&u+p>he&&await m(),h.push(l),u+=p}await m(),i+=j}await n.close()}catch(i){throw n.destroy(),i}return n.parts}s(H,"writeBodyParts");const P=s(async t=>(await t.prepare("SELECT hash FROM bodies ORDER BY hash").all()).map(e=>e.hash),"allHashes");async function Le(t){const e=await ee(),a=await P(e),o=await H(e,t,"pre",a),n={hashes:a,parts:o,count:a.length,canonical:!0};return K(w(t,g),JSON.stringify(n)),{parts:o,count:a.length}}s(Le,"dumpBodiesPre");function fe(t){try{return JSON.parse($(w(t,g),"utf8"))}catch(e){if(e.code==="ENOENT")return{hashes:[],parts:[],count:0};throw e}}s(fe,"readPre");function we(t,e){if(t.count===0&&t.parts.length===0)return;if(t.canonical!==!0)throw new Error(`${g} was written before bodies were checked against their keys; discard the export directory and run the pre-pause dump again`);const a=t.hashes.filter(o=>!e.has(o));if(a.length>0)throw new Error(`the pre-pause dump holds ${a.length} body row(s) the database no longer has (first: ${a[0]}); the boot repair ran after it. Discard the export directory and run the pre-pause dump again`)}s(we,"assertPreCurrent");async function Ae(t,e,a=de){const o=await ne();return te(async n=>{await n.exec("SET TRANSACTION ISOLATION LEVEL REPEATABLE READ");const y=new Set((await n.prepareUncached("SELECT table_name FROM information_schema.tables WHERE table_schema = current_schema()").all()).map(r=>r.table_name)),i=k.filter(r=>!y.has(r));if(i.length>0)throw new Error(`the canvas database lacks tables the bundle needs: ${i.join(", ")}`);const S=await n.prepareUncached(`SELECT c.conrelid::regclass::text AS tbl, (SELECT array_agg(a.attname::text ORDER BY k.ord) FROM unnest(c.conkey) WITH ORDINALITY k(attnum, ord)
2
- JOIN pg_attribute a ON a.attrelid = c.conrelid AND a.attnum = k.attnum) AS cols FROM pg_constraint c WHERE c.contype = 'p' AND c.connamespace = current_schema()::regnamespace`).all(),h=new Map(S.map(r=>[r.tbl.replace(/"/g,"").replace(/^.*\./,""),r.cols])),u=await n.prepareUncached("SELECT table_name, column_name FROM information_schema.columns WHERE table_schema = current_schema() ORDER BY table_name, ordinal_position").all(),m=new Set(ie),l={},d={};let p=0,T=0;for(const r of k.filter(E=>E!==O)){const E=m.has(r)?["seq"]:h.get(r),D=E!==void 0&&E.length>0?E.map(c=>`t.${b(c)}`):u.filter(c=>c.table_name===r).map(c=>`t.${b(c.column_name)}::text`);if(D.length===0)throw new Error(`table ${r} has no columns to order its dump by`);const _=new v(w(t,"rows",r),"");let F=0;try{for(await n.exec(`DECLARE dump_cursor NO SCROLL CURSOR FOR SELECT row_to_json(t)::text AS j FROM ${b(r)} t ORDER BY ${D.join(", ")}`);;){const c=await n.prepareUncached(`FETCH FORWARD ${a} FROM dump_cursor`).all();for(const G of c){let f=JSON.parse(G.j);if(r==="messages"){const I=f.body_ref,M=ce(f,pe);typeof I=="string"&&I.startsWith("/")&&(M===f?T+=1:p+=1),f=M}await _.add(W(f))}if(F+=c.length,c.length<a)break}await n.exec("CLOSE dump_cursor"),await _.close()}catch(c){throw _.destroy(),c}l[r]=F,d[r]=_.parts}const N=(await n.prepare("SELECT value FROM canvas_meta WHERE key = 'install_id'").get())?.value;if(N===void 0)throw new Error("this canvas database has no install id");const L=await n.prepare("SELECT object FROM environments WHERE kind = 'machine' ORDER BY object LIMIT 1").get(),A={installId:N,kind:e,person:o,release:se(),schemaVersion:ae,counts:l,rowParts:d,...L===void 0?{}:{environmentObject:L.object}},q=await n.prepare("SELECT request_id, request_dir, file FROM human_requests ORDER BY request_id").all(),J=await n.prepare(`SELECT d.object, r.body_hash FROM documents d JOIN revisions r ON r.document = d.object
3
- WHERE d.source_path IS NOT NULL AND NOT EXISTS (SELECT 1 FROM revision_parents p WHERE p.parent = r.rev_id) ORDER BY d.object, r.number DESC, r.rev_id`).all(),C={};for(const r of J)C[r.object]??=r.body_hash;const R=fe(t),U=new Set(R.hashes),x=await P(n);we(R,new Set(x));const B=x.filter(r=>!U.has(r)),V=await H(n,t,"pause",B),z=R.count+B.length;l[O]=z,d[O]=[...R.parts,...V];const X=await n.prepare(`SELECT n.node_id, r.grantee, n.cwd, w.path AS worktree FROM nodes n JOIN node_rows r ON r.node_id = n.node_id LEFT JOIN worktrees w ON w.node_id = n.node_id AND w.state = 'open'
4
- WHERE n.status IN ('active', 'idle') ORDER BY n.node_id`).all();return A.shippedBodies=C,{source:A,requests:q.map(r=>({id:r.request_id,dir:r.request_dir,file:r.file})),runningNodes:X.map(r=>({node:r.node_id,app:r.grantee,cwd:r.cwd,worktree:r.worktree})),bodiesInlined:p,bodiesMissing:T}})}s(Ae,"dumpRows");export{Y as BODY_MAX_BYTES,le as PART_JSON_BYTES,Le as dumpBodiesPre,Ae as dumpRows};
@@ -1,23 +0,0 @@
1
- import type { ImportCloud } from './cloud.js';
2
- export interface LocalObject {
3
- key: string;
4
- path: string;
5
- }
6
- /** Every file the runtime holds that the cloud serves from a blob key. */
7
- export declare function localObjects(): LocalObject[];
8
- /** The reviewed file of a review that lies outside the review's own directory, at the key the lane rewrites `file` to. */
9
- export declare function reviewSourceObject(requestId: string, requestDir: string, file: string | null): LocalObject | null;
10
- export declare class Uploader {
11
- private readonly cloud;
12
- private readonly run;
13
- private readonly progress;
14
- private readonly sent;
15
- uploaded: number;
16
- missing: string[];
17
- constructor(cloud: ImportCloud, run: string, progress: (line: string) => void);
18
- /** Upload source blobs, each to `imports/<run>/blobs/<its key>`: the upload route signs only under the run's own prefix, and the lane moves each blob to its key. */
19
- upload(objects: readonly LocalObject[]): Promise<void>;
20
- private freshUrl;
21
- /** Upload bytes held in memory (row files, source.json, node archives). */
22
- uploadBytes(key: string, data: Buffer): Promise<void>;
23
- }
@@ -1 +0,0 @@
1
- var N=Object.defineProperty;var a=(i,e)=>N(i,"name",{value:e,configurable:!0});import{readFileSync as j,readdirSync as M,statSync as R}from"node:fs";import{basename as z,join as w,relative as S,sep as T}from"node:path";import{runtimeRoot as x}from"../../layout.js";import{bundleKeys as k}from"../bundle/layout.js";import{runBlobKey as O}from"../bundle/blob-keys.js";function y(i,e,t=i){let n;try{n=M(i,{withFileTypes:!0})}catch(o){if(o.code==="ENOENT")return;throw o}for(const o of n){const u=w(i,o.name);o.isDirectory()?y(u,e,t):o.isFile()&&!o.name.endsWith(".tmp")&&!o.name.includes(".tmp-")&&e(u,S(t,u).split(T).join("/"))}}a(y,"walk");function _(){const i=x(),e=[];y(w(i,"blobs"),(t,n)=>e.push({key:n,path:t}));for(const t of["requests","reviews"])y(w(i,t),(n,o)=>{const[u,...c]=o.split("/");c.length>0&&e.push({key:k.request(u,c.join("/")),path:n})});return e}a(_,"localObjects");function Y(i,e,t){return t===null||!t.startsWith("/")||t.startsWith(e.endsWith("/")?e:`${e}/`)?null:{key:k.request(i,`source/${z(t)}`),path:t}}a(Y,"reviewSourceObject");const d=100,L=128,v=128*1024*1024;class K{static{a(this,"Uploader")}cloud;run;progress;sent=new Map;uploaded=0;missing=[];constructor(e,t,n){this.cloud=e,this.run=t,this.progress=n}async upload(e){const t=[];for(const r of e){let s;try{s=R(r.path)}catch(h){if(h.code==="ENOENT"){this.missing.push(r.path);continue}throw h}const l=`${s.size}:${s.mtimeMs}`;this.sent.get(r.key)!==l&&t.push({...r,stamp:l,size:s.size})}const n=new Map,o=a(r=>{let s=n.get(r);return s===void 0&&(s=this.cloud.uploadUrls(this.run,t.slice(r*d,(r+1)*d).map(l=>O(this.run,l.key))).then(l=>l.urls),s.catch(()=>{}),n.set(r,s)),s},"urlsFor");let u=0,c=!1,p=0,m=[];const g=a(()=>{const r=m;m=[];for(const s of r)s()},"wake"),$=a(async()=>{try{for(;!c&&u<t.length;){const r=u++,s=t[r],l=Math.floor(r/d);n.delete(l-1),(l+1)*d<t.length&&o(l+1);const h=O(this.run,s.key),U=(await o(l))[h];if(U===void 0)throw new Error(`no upload URL returned for ${s.key}`);for(;!c&&p>0&&p+s.size>v;)await new Promise(f=>m.push(f));if(c)return;p+=s.size;try{let f;try{f=j(s.path)}catch(E){if(E.code==="ENOENT"){this.missing.push(s.path);continue}throw E}await this.cloud.put(U,f,h,()=>this.freshUrl(h))}finally{p-=s.size,g()}this.sent.set(s.key,s.stamp),this.uploaded+=1,this.uploaded%d===0&&this.progress(`uploaded ${this.uploaded}`)}}catch(r){throw c=!0,g(),r}},"worker"),b=await Promise.allSettled(Array.from({length:Math.min(L,t.length)},$));for(const r of b)if(r.status==="rejected")throw r.reason;t.length>0&&this.progress(`uploaded ${t.length}/${t.length}`)}async freshUrl(e){const t=(await this.cloud.uploadUrls(this.run,[e])).urls[e];if(t===void 0)throw new Error(`no upload URL returned for ${e}`);return t}async uploadBytes(e,t){await this.cloud.put(await this.freshUrl(e),t,e,()=>this.freshUrl(e))}}export{K as Uploader,_ as localObjects,Y as reviewSourceObject};
@@ -1,3 +0,0 @@
1
- import type { RowObject } from '../bundle/layout.js';
2
- /** `read` returns the file's text, or null when the file is absent or empty. */
3
- export declare function inlineMessageBody(row: RowObject, read: (path: string) => string | null): RowObject;
@@ -1 +0,0 @@
1
- var f=Object.defineProperty;var r=(t,e)=>f(t,"name",{value:e,configurable:!0});function i(t,e){const o=t.body_ref;if(typeof o!="string"||!o.startsWith("/"))return t;const s=e(o);if(s===null)return t;const n=t.body_json,y=n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{};return{...t,body_ref:null,body_json:{...y,body_full:s}}}r(i,"inlineMessageBody");export{i as inlineMessageBody};
@@ -1,2 +0,0 @@
1
- import type { PathPrefix, SourceJson } from '../bundle/layout.js';
2
- export declare function buildSourceJson(dump: SourceJson, prefixes: readonly PathPrefix[]): SourceJson;
@@ -1 +0,0 @@
1
- var o=Object.defineProperty;var e=(t,n)=>o(t,"name",{value:n,configurable:!0});function u(t,n){return{...t,...n.length>0?{pathPrefixes:[...n]}:{}}}e(u,"buildSourceJson");export{u as buildSourceJson};
@@ -1,9 +0,0 @@
1
- import type { ImportAuthStoreDTO, ImportCredentialsStoreDTO, ImportEnvStoreDTO, ImportPluginsStoreDTO, ImportSettingsStoreDTO } from '../../../api/dto/imports.js';
2
- export interface ExportedStores {
3
- auth: ImportAuthStoreDTO;
4
- credentials: ImportCredentialsStoreDTO;
5
- env: ImportEnvStoreDTO;
6
- settings: ImportSettingsStoreDTO;
7
- plugins: ImportPluginsStoreDTO;
8
- }
9
- export declare function readStores(): Promise<ExportedStores>;
@@ -1,4 +0,0 @@
1
- var w=Object.defineProperty;var d=(r,t)=>w(r,"name",{value:t,configurable:!0});import{openDb as k}from"../../canvas/db.js";import{personIdAsync as h}from"../../canvas/person.js";import{loadSecretsKey as y,open as c}from"../../secrets/index.js";import{aadOf as S}from"../../subscription-state.js";import{aadOf as O}from"../../secrets/env-rows.js";const a=d(r=>r==null?null:String(r),"str"),o=d(r=>Number(r??0),"num");async function W(){const r=await h(),t=await k(),_=y(),u={};for(const e of await t.prepare("SELECT provider_id, credential_sealed, key_id FROM model_api_keys WHERE person = ? ORDER BY provider_id").all(r)){const i=String(e.provider_id);u[i]=JSON.parse(c(e.credential_sealed,String(e.key_id),_,`model_api_keys|${r}|${i}`))}const R=await t.prepare("SELECT provider_id, account_id, family, rate_limited_until, last_rate_limited_at FROM model_account_cooldowns WHERE person = ? ORDER BY family").all(r),E=[];for(const e of await t.prepare("SELECT * FROM model_accounts WHERE person = ? ORDER BY provider_id, position").all(r)){const i=String(e.provider_id),l=String(e.id);if(e.refresh_sealed===null||e.access_sealed===null||e.key_id===null)throw new Error(`managed ${i} account ${l} has no credential record`);const g=String(e.key_id);E.push({provider:i,id:l,label:String(e.label),labelKey:String(e.label_key),position:o(e.position),lastAttemptAt:o(e.last_attempt_at),lastRateLimitedAt:o(e.last_rate_limited_at),rateLimitedUntil:o(e.rate_limited_until),...e.auth_failure==="invalid_grant"?{authFailure:"invalid_grant"}:{},refresh:c(e.refresh_sealed,g,_,S(r,i,l,"refresh")),access:c(e.access_sealed,g,_,S(r,i,l,"access")),expires:o(e.expires),...a(e.vendor_account_id)===null?{}:{accountId:a(e.vendor_account_id)},...a(e.client_id)===null?{}:{clientId:a(e.client_id)},cooldowns:R.filter(s=>s.provider_id===i&&s.account_id===l).map(s=>({family:String(s.family),until:o(s.rate_limited_until),at:o(s.last_rate_limited_at)}))})}const n=await t.prepare("SELECT default_fallback_strength, revert_when_available, openai_device_id FROM model_settings WHERE person = ?").get(r),v={accounts:E,...n===void 0||n.default_fallback_strength===null&&n.revert_when_available===null?{}:{rotation:{defaultFallbackStrength:a(n.default_fallback_strength),revertWhenAvailable:n.revert_when_available===null?null:o(n.revert_when_available)===1}},...n===void 0||a(n.openai_device_id)===null?{}:{openaiDeviceId:a(n.openai_device_id)}},m={};for(const e of await t.prepare("SELECT owner_id, name, value_sealed, key_id FROM env_vars WHERE person = ? AND owner_kind = 'profile' ORDER BY owner_id, name").all(r)){const i=String(e.owner_id),l=String(e.name);(m[i]??={})[l]=c(e.value_sealed,String(e.key_id),_,O({person:r,kind:"profile",id:i},l))}const p={settings:{},state:{},profileProjects:{},defaults:{}};for(const e of await t.prepare("SELECT owner_key, raw_json FROM scope_settings WHERE person = ?").all(r))p.settings[String(e.owner_key)]=JSON.parse(String(e.raw_json));for(const e of await t.prepare("SELECT owner_key, last_self_check, active_canvas FROM scope_bookkeeping WHERE person = ?").all(r))p.state[String(e.owner_key)]={last_self_check:a(e.last_self_check),activeCanvas:a(e.active_canvas)};for(const e of await t.prepare(`SELECT profile_id, path, repo FROM (
2
- SELECT pp.profile_id, pp.path, pp.repo, pp.position FROM profile_projects pp JOIN profiles p ON p.id = pp.profile_id WHERE p.person = ?
3
- UNION ALL SELECT pr.profile_id, NULL AS path, pr.repo, pr.position FROM profile_project_repos pr JOIN profiles p ON p.id = pr.profile_id WHERE p.person = ?) e
4
- ORDER BY profile_id, position`).all(r,r))(p.profileProjects[String(e.profile_id)]??=[]).push({...a(e.repo)===null?{}:{repo:a(e.repo)},...a(e.path)===null?{}:{path:a(e.path)}});for(const e of await t.prepare("SELECT directory, profile_id FROM profile_defaults WHERE person = ?").all(r))p.defaults[String(e.directory)]=String(e.profile_id);const f={marketplaces:[],plugins:[]};for(const e of await t.prepare("SELECT * FROM scope_marketplaces WHERE person = ? ORDER BY owner_key, name").all(r))f.marketplaces.push({owner:String(e.owner_key),name:String(e.name),url:a(e.url),ref:a(e.ref),installed_at:a(e.installed_at),last_updated:a(e.last_updated)});for(const e of await t.prepare("SELECT * FROM scope_plugins WHERE person = ? ORDER BY owner_key, name").all(r))f.plugins.push({owner:String(e.owner_key),name:String(e.name),enabled:o(e.enabled)===1,source_marketplace:a(e.source_marketplace),version:a(e.version),source_path:a(e.source_path),last_updated:a(e.last_updated),etag:a(e.etag),checked_at:a(e.checked_at)});return{auth:{apiKeys:u},credentials:v,env:{profiles:m},settings:p,plugins:f}}d(W,"readStores");export{W as readStores};
@@ -1,42 +0,0 @@
1
- import type { CanvasDb } from '../../canvas/db.js';
2
- import { type RewriteInput } from './rewrite.js';
3
- /** A grant's or row's `sub` as the run sees it: the source's person is the run's, no other person is allowed. */
4
- export declare function boundSub(sub: string, source: string, run: string, where: string): string;
5
- /** Before anything is staged: the bundle's person has the shape of a person, and when it differs from the run's it is not already someone else in the target. */
6
- export declare function checkSourcePerson(db: CanvasDb, target: string, source: string, run: string): Promise<void>;
7
- /** After staging, before rewrite 1: every person the staged rows name is the bundle's or the run's. Drops the directory's own team facts
8
- * (`crtr/group` relations). Returns rows dropped per table. */
9
- export declare function checkStagedPersons(input: RewriteInput): Promise<Record<string, number>>;
10
- /** After rewrite 2 and the drop: every reference from a staged row to a target row reaches a row the run's person owns or acts for (an app, a shipped
11
- * document, the person's own object, an object with an `acts_for` fact for the person, an object a group the person is a member of is granted (a repo document its team shares), an object this person's earlier run of the same install inserted,
12
- * or anything below those that is not directly under an app), and no profile or grant the rows name belongs to another person.
13
- *
14
- * The earlier run's objects are the person's by construction, and a re-load must accept them: the drop step removes every staged document the target already
15
- * holds, so the bundle's edges to them reach the target's rows, and a soft-deleted document of a reaped node directly under an app has no `acts_for` fact to reach. */
16
- export declare function checkStagedReferences(input: RewriteInput, own: {
17
- installId: string;
18
- person: string;
19
- runId: string;
20
- }): Promise<void>;
21
- /** Before `checkStagedReferences`: a staged row, in any table but `objects`, that names a target object `checkStagedReferences` would refuse (another account's: a shared
22
- * repo document, a soft-deleted object of an earlier import from a different install) is dropped, with the rows that depend on it (the `deliveries` and `message_causes` of a
23
- * dropped message, then every row whose foreign key names a dropped row). Ids with no target row keep the stub treatment. An `objects` row that names such an object (a
24
- * document parented under it) is still refused. Returns rows dropped per table. */
25
- export declare function dropForeignReferences(input: RewriteInput, own: {
26
- installId: string;
27
- person: string;
28
- runId: string;
29
- }): Promise<Record<string, number>>;
30
- /** After staging, before rewrite 1: every blob key a staged row names has the shape its row would produce and an owner (node) that is in this bundle or is the
31
- * importing person's own node in the target. A key naming a node of another person is `person_mismatch`; a key of no known shape is `bundle_invalid`. Without this,
32
- * the importer's own node would read, and compaction would delete, a blob of someone else's conversation. (Human requests are checked by `checkStagedRequestKeys`,
33
- * after their dirs are rewritten to blob keys.)
34
- *
35
- * A row whose owner node is in neither the bundle nor the target, and that no live row of the bundle holds, is what a deleted node left behind (the purge of a node
36
- * keeps a conversation or attachment row and its blob; a deleted node's job rows stay too). It is dropped, not refused: a conversation no staged `sessions` row binds
37
- * (its `conversation_parts` and `conversation_entries` rows), an `upload_uses` row whose `run_id` is not a node of the bundle, a `jobs` row whose job object is not
38
- * owned by a node of the bundle. `moveRunBlobs` leaves the blob of such an owner where it was uploaded. A conversation's owner is the owner of its part keys; a
39
- * `conversation_entries` row with no part names no owner and is copied as before. Returns rows dropped per table. */
40
- export declare function checkStagedBlobKeys(input: RewriteInput): Promise<Record<string, number>>;
41
- /** After rewrite 4b: a human request's `request_dir`, `presentation_dir` and `file` that are blob keys (`requests/…`) are under the request's own `requests/<its id>`. */
42
- export declare function checkStagedRequestKeys(input: RewriteInput): Promise<void>;
@@ -1,20 +0,0 @@
1
- var P=Object.defineProperty;var i=(r,o)=>P(r,"name",{value:o,configurable:!0});import{parseBlobKey as R}from"../bundle/blob-keys.js";import{q as N}from"./catalog.js";import{decodeKeys as J}from"./copy.js";import{objectIdColumns as K}from"./rewrite.js";import{ImportLaneError as W}from"./stage.js";const Y=/^user:[A-Za-z0-9._-]+$/,k=i(r=>r.replace(/^user:/,""),"bare"),S=i((r,o)=>`${N(r)}.${N(o)}`,"sq"),m=i(async(r,o,...c)=>await r.prepareUncached(o).all(...c),"all");function T(r,o){return new W("bind","person_mismatch",r,o)}i(T,"mismatch");function ne(r,o,c,p){if(r===o||r===c)return c;throw T(`${p} names ${r}, which is neither the bundle's person nor the importing person`,{where:p,value:r})}i(ne,"boundSub");async function se(r,o,c,p){if(!Y.test(c))throw T(`the bundle's person ${JSON.stringify(c)} is not a user:<id> principal`,{where:"source.json person",value:c});if(c===p)return;const a=i(l=>S(o,l),"T"),n=await r.prepareUncached(`SELECT 'identities' AS tbl FROM ${a("identities")} WHERE scheme IN ('user', 'local-user') AND external_id = ?
2
- UNION ALL SELECT 'grants' FROM ${a("grants")} WHERE sub = ? UNION ALL SELECT 'profiles' FROM ${a("profiles")} WHERE person = ?
3
- UNION ALL SELECT 'nodes' FROM ${a("nodes")} WHERE sub = ? LIMIT 1`).get(c,c,c,c);if(n!==void 0)throw T(`the bundle's person ${c} is already a person in the target (${n.tbl}), not the importing person ${p}`,{where:`${n.tbl}`,value:c})}i(se,"checkSourcePerson");const B=[["nodes","sub"],["crons","sub"],["grants","sub"],["profiles","person"],["charges","sub"],["limits","sub"],["audit_rows","sub"],["provider_approvals","sub"],["uploads","sub"],["files","sub"],["shares","sub"]],G=[["charges","payer"],["limits","payer"],["audit_rows","payer"],["audit_rows","grantee"],["charges","grantee"],["run_events","grantee"],["idempotency_keys","grantee"],["uploads","grantee"],["files","grantee"],["provider_approvals","grantee"],["profiles","grantee"],["crons","grantee"]];async function re(r){const{db:o,schema:c,sourcePerson:p,targetPerson:a}=r,n=i(t=>S(c,t),"S"),l=i((t,s)=>{throw T(`${t} names ${s.join(", ")}, who is neither the bundle's person ${p} nor the importing person ${a}`,{where:t,values:s})},"refuse");for(const[t,s]of B){const _=await m(o,`SELECT DISTINCT ${N(s)} AS v FROM ${n(t)} WHERE ${N(s)} IS NOT NULL AND ${N(s)} <> '' AND ${N(s)} NOT IN (?, ?) LIMIT 5`,p,a);_.length>0&&l(`${t}.${s}`,_.map(h=>h.v))}for(const[t,s]of G){const _=await m(o,`SELECT DISTINCT ${N(s)} AS v FROM ${n(t)} WHERE ${N(s)} LIKE 'user:%' AND ${N(s)} NOT IN (?, ?) LIMIT 5`,p,a);_.length>0&&l(`${t}.${s}`,_.map(h=>h.v))}const f=await m(o,`SELECT DISTINCT external_id AS v FROM ${n("identities")} WHERE scheme IN ('user', 'local-user') AND external_id NOT IN (?, ?) LIMIT 5`,p,a);f.length>0&&l("identities.external_id",f.map(t=>t.v));const b=await m(o,`SELECT DISTINCT adapter_json::jsonb #>> '{principal,sub}' AS v FROM ${n("daemon_actions")}
4
- WHERE adapter_json::jsonb #>> '{principal,sub}' IS NOT NULL AND adapter_json::jsonb #>> '{principal,sub}' NOT IN (?, ?) LIMIT 5`,p,a);b.length>0&&l("daemon_actions principal.sub",b.map(t=>t.v));const d=await m(o,`SELECT DISTINCT subject_id AS v FROM ${n("relations")} WHERE relation = 'acts_for' AND subject_type = 'user' AND subject_id NOT IN (?, ?) LIMIT 5`,k(p),k(a));d.length>0&&l("relations acts_for subject",d.map(t=>t.v));const E=Number((await o.prepareUncached(`DELETE FROM ${n("relations")} WHERE resource_type = 'crtr/group'`).run()).changes);return E>0?{relations:E}:{}}i(re,"checkStagedPersons");async function z(r,o){return(await m(r,`SELECT m.inserted_keys FROM import_manifest m JOIN import_runs r ON r.run_id = m.run_id
5
- WHERE m.table_name = 'objects' AND r.source_install_id = ? AND r.person = ? AND r.run_id <> ? AND r.state IN ('committed', 'done', 'failed')`,o.installId,o.person,o.runId)).flatMap(p=>J(p.inserted_keys).map(a=>a[0]))}i(z,"earlierImportedObjects");async function ae(r,o){const{db:c,schema:p,catalog:a,targetPerson:n}=r,l=await H(r,o);if(l.length>0)throw T(`the bundle refers to objects that are not ${n}'s: ${l.slice(0,10).map(f=>`${f.tbl}.${f.col}=${f.value}`).join(", ")}`,{references:l.slice(0,10)});await V(r)}i(ae,"checkStagedReferences");async function ie(r,o){const{db:c,schema:p,catalog:a}=r,n=i(t=>S(p,t),"S"),l=(await H(r,o)).filter(t=>t.tbl!=="objects"),f={},b=new Map;for(const t of l){const s=`${t.tbl}.${t.col}`;b.has(s)||b.set(s,{tbl:t.tbl,col:t.col,values:new Set}),b.get(s).values.add(t.value)}const d=i(t=>{const s=a.tables.get(t)?.primaryKey??[];return s.length===1?N(s[0]):null},"keysOf"),E=i(async(t,s,..._)=>{const h=d(t),g=await c.prepareUncached(`DELETE FROM ${n(t)} WHERE ${s} RETURNING ${h===null?"1 AS k":`${h}::text AS k`}`).all(..._);if(g.length===0||(f[t]=(f[t]??0)+g.length,h===null))return;const L=g.map($=>$.k),O=a.foreignKeys.filter($=>$.parent===t&&$.columns.length===1&&$.parentColumns.length===1&&$.parentColumns[0]===h.replace(/"/g,"")&&a.tables.has($.table));for(const $ of O)await E($.table,`${N($.columns[0])}::text = ANY(?::text[])`,L);if(t==="messages")for(const $ of["deliveries","message_causes"])a.tables.has($)&&!O.some(j=>j.table===$)&&await E($,"message_id = ANY(?::text[])",L)},"removeWhere");for(const{tbl:t,col:s,values:_}of b.values()){if(!a.tables.has(t))continue;const h=t==="relations"?" AND resource_type = 'crtr/object'":"";await E(t,`${N(s)}::text = ANY(?::text[])${h}`,[..._])}return f}i(ie,"dropForeignReferences");async function H(r,o){const{db:c,schema:p,target:a,catalog:n,targetPerson:l}=r,f=i(_=>S(p,_),"S"),b=i(_=>S(a,_),"T"),d=k(l);await c.exec(`CREATE TABLE ${f("_refs")} (tbl text NOT NULL, col text NOT NULL, value text NOT NULL)`);const E=[];for(const[_,h]of K(n))if(!(!n.tables.has(_)||_==="relations"))for(const g of h)!(_==="nodes"&&g==="profile_id")&&!(_==="crons"&&g==="profile")&&E.push([_,g,""]);E.push(["relations","resource_id","WHERE resource_type = 'crtr/object'"]);for(const[_,h,g]of E)await c.prepareUncached(`INSERT INTO ${f("_refs")} SELECT ?, ?, ${N(h)}::text FROM ${f(_)} ${g===""?"WHERE":`${g} AND`} ${N(h)} IS NOT NULL
6
- AND ${N(h)}::text NOT IN (SELECT id FROM ${f("objects")}) AND ${N(h)}::text IN (SELECT id FROM ${b("objects")})`).run(_,h);const t=await z(c,o),s=await m(c,`WITH RECURSIVE chain(start, id) AS (
7
- SELECT DISTINCT value, value FROM ${f("_refs")}
8
- UNION SELECT c.start, o.owner FROM chain c JOIN ${b("objects")} o ON o.id = c.id JOIN ${b("objects")} up ON up.id = o.owner AND up.type <> 'app'),
9
- ok(id) AS (
10
- SELECT o.id FROM ${b("objects")} o WHERE o.type = 'app'
11
- UNION SELECT d.object FROM ${b("documents")} d WHERE d.source_path IS NOT NULL
12
- UNION SELECT i.object FROM ${b("identities")} i WHERE i.scheme IN ('user', 'local-user') AND i.external_id = ?
13
- UNION SELECT r.resource_id FROM ${b("relations")} r WHERE r.resource_type = 'crtr/object' AND r.relation = 'acts_for' AND r.subject_type = 'user' AND r.subject_id = ?
14
- UNION SELECT r.resource_id FROM ${b("relations")} r JOIN ${b("relations")} m ON m.resource_type = 'crtr/group' AND m.relation = 'member' AND m.resource_id = r.subject_id
15
- AND m.subject_type = 'user' AND m.subject_id = ?
16
- WHERE r.resource_type = 'crtr/object' AND r.relation IN ('reader', 'editor', 'messenger', 'user_of') AND r.subject_type = 'crtr/group' AND r.subject_relation = 'member'
17
- UNION SELECT unnest(?::text[]))
18
- SELECT r.tbl, r.col, r.value FROM ${f("_refs")} r
19
- WHERE NOT EXISTS (SELECT 1 FROM chain c JOIN ok ON ok.id = c.id WHERE c.start = r.value)`,l,d,d,t);return await c.exec(`DROP TABLE ${f("_refs")}`),s}i(H,"foreignReferences");async function V(r){const{db:o,schema:c,target:p,targetPerson:a}=r,n=i(d=>S(c,d),"S"),l=i(d=>S(p,d),"T"),f=[["nodes","profile_id"],["crons","profile"],["profiles","id"]];for(const[d,E]of f){const t=await m(o,`SELECT DISTINCT s.${N(E)} AS v FROM ${n(d)} s JOIN ${l("profiles")} p ON p.id = s.${N(E)} WHERE p.person <> ? LIMIT 5`,a);if(t.length>0)throw T(`${d}.${E} names profiles that belong to another person: ${t.map(s=>s.v).join(", ")}`,{where:`${d}.${E}`,values:t.map(s=>s.v)})}for(const[d,E]of[["nodes","grant_id"],["crons","grant_id"]]){const t=await m(o,`SELECT DISTINCT s.${N(E)} AS v FROM ${n(d)} s JOIN ${l("grants")} g ON g.id = s.${N(E)} WHERE g.sub <> ? LIMIT 5`,a);if(t.length>0)throw T(`${d}.${E} names grants that belong to another person: ${t.map(s=>s.v).join(", ")}`,{where:`${d}.${E}`,values:t.map(s=>s.v)})}const b=await m(o,`SELECT DISTINCT d.adapter_json::jsonb #>> '{principal,grant_id}' AS v FROM ${n("daemon_actions")} d
20
- JOIN ${l("grants")} g ON g.id = d.adapter_json::jsonb #>> '{principal,grant_id}' WHERE g.sub <> ? LIMIT 5`,a);if(b.length>0)throw T(`a queued action names grants that belong to another person: ${b.map(d=>d.v).join(", ")}`,{where:"daemon_actions principal.grant_id",values:b.map(d=>d.v)})}i(V,"checkStagedProfilesAndGrants");const D=i((r,o)=>new W("bind","bundle_invalid",r,o),"bundleInvalid");async function ce(r){const{db:o,schema:c,target:p,targetPerson:a}=r,n=i(e=>S(c,e),"S"),l=new Set((await m(o,`SELECT node_id AS v FROM ${n("nodes")}`)).map(e=>e.v)),f=await m(o,`SELECT conversation_id, seq::text AS seq, blob_key FROM ${n("conversation_parts")}`),b=await m(o,`SELECT run_id, path, blob_key FROM ${n("upload_uses")} WHERE blob_key IS NOT NULL`),d=await m(o,`SELECT object, output_key FROM ${n("jobs")} WHERE output_key IS NOT NULL`),E=i(e=>e.split("/")[1]??"","jobOwner"),t=i((e,u,w,I)=>{const F=R(u);if(F===null||F.kind!==w||I!==void 0&&u!==I)throw D(`${e} holds ${JSON.stringify(u)}, which is not a ${w} blob key${I===void 0?"":` of the shape ${I}`}`,{where:e,value:u})},"shaped");for(const e of f)if(t("conversation_parts.blob_key",e.blob_key,"conversation"),e.blob_key.split("/")[2]!==e.conversation_id)throw D(`conversation_parts.blob_key ${e.blob_key} is not under its conversation ${e.conversation_id}`,{where:"conversation_parts.blob_key",value:e.blob_key});for(const e of b)t("upload_uses.blob_key",e.blob_key,"attachment");for(const e of d)t("jobs.output_key",e.output_key,"job",`jobs/${E(e.output_key)}/${e.object}/output`);const s=new Set;for(const{blob_key:e}of f){const u=R(e);u!==null&&u.kind==="conversation"&&!l.has(u.owner)&&s.add(u.owner)}for(const{blob_key:e}of b){const u=R(e);u!==null&&u.kind==="attachment"&&!l.has(u.owner)&&s.add(u.owner)}for(const{output_key:e}of d)l.has(E(e))||s.add(E(e));const _=new Map((s.size===0?[]:await m(o,`SELECT node_id, sub FROM ${S(p,"nodes")} WHERE node_id = ANY(?::text[])`,[...s])).map(e=>[e.node_id,e.sub])),h=i(e=>l.has(e)||_.get(e)===a,"held"),g=i(e=>!l.has(e)&&!_.has(e),"gone"),L={},O=i((e,u)=>{u>0&&(L[e]=(L[e]??0)+u)},"count"),$=i(async(e,...u)=>Number((await o.prepareUncached(e).run(...u)).changes),"drop"),j=new Set((await m(o,`SELECT DISTINCT session_id AS v FROM ${n("sessions")} WHERE session_id IS NOT NULL`)).map(e=>e.v)),y=new Map;for(const{conversation_id:e,blob_key:u}of f){const w=R(u),I=y.get(e);I!==null&&(w===null||w.kind!=="conversation"?y.set(e,null):y.set(e,[...I??[],w.owner]))}const v=[...y].filter(([e,u])=>u!==null&&!j.has(e)&&u.every(g)).map(([e])=>e);v.length>0&&(O("conversation_parts",await $(`DELETE FROM ${n("conversation_parts")} WHERE conversation_id = ANY(?::text[])`,v)),O("conversation_entries",await $(`DELETE FROM ${n("conversation_entries")} WHERE conversation_id = ANY(?::text[])`,v)));const x=new Set(v),M=i((e,u)=>{const w=R(u).owner;if(!h(w))throw T(`${e} holds ${u}, which belongs to node ${w}, who is not in the bundle`,{where:e,value:u})},"owned");for(const e of f)x.has(e.conversation_id)||M("conversation_parts.blob_key",e.blob_key);const A=b.filter(e=>{const u=R(e.blob_key);return u!==null&&u.kind==="attachment"&&g(u.owner)&&!l.has(e.run_id)});A.length>0&&O("upload_uses",await $(`DELETE FROM ${n("upload_uses")} u USING unnest(?::text[], ?::text[]) d(run_id, path) WHERE u.run_id = d.run_id AND u.path = d.path`,A.map(e=>e.run_id),A.map(e=>e.path)));const U=new Set(A);for(const e of b)U.has(e)||M("upload_uses.blob_key",e.blob_key);const C=d.filter(e=>e.output_key===`jobs/${E(e.output_key)}/${e.object}/output`&&g(E(e.output_key)));C.length>0&&O("jobs",await $(`DELETE FROM ${n("jobs")} WHERE object = ANY(?::text[])`,C.map(e=>e.object)));const q=new Set(C);for(const e of d)q.has(e)||M("jobs.output_key",e.output_key);return L}i(ce,"checkStagedBlobKeys");async function le(r){const{db:o,schema:c}=r;for(const p of await m(o,`SELECT request_id, request_dir, presentation_dir, file FROM ${S(c,"human_requests")}`))for(const a of["request_dir","presentation_dir","file"]){const n=p[a];if(n===null||!n.startsWith("requests/"))continue;const l=R(n.includes("/",9)?n:`${n}/x`);if(l===null||l.kind!=="request")throw D(`human_requests.${a} holds ${JSON.stringify(n)}, which is not a request blob key`,{where:`human_requests.${a}`,value:n});if(l.owner!==p.request_id)throw T(`human_requests.${a} of ${p.request_id} holds ${n}, which belongs to request ${l.owner}`,{where:`human_requests.${a}`,value:n})}}i(le,"checkStagedRequestKeys");export{ne as boundSub,se as checkSourcePerson,ce as checkStagedBlobKeys,re as checkStagedPersons,ae as checkStagedReferences,le as checkStagedRequestKeys,ie as dropForeignReferences};
@@ -1,27 +0,0 @@
1
- import type { BlobStore } from '../../blobs/index.js';
2
- import type { CanvasDb } from '../../canvas/db.js';
3
- export interface MovedBlobs {
4
- moved: number;
5
- left: number;
6
- }
7
- /** `created` collects the keys this call wrote, so the caller can delete them if the run fails before its copy commits. */
8
- export declare function moveRunBlobs(db: CanvasDb, schema: string, target: string, person: string, blobs: BlobStore, runId: string, created: string[]): Promise<MovedBlobs>;
9
- /** Delete the keys, concurrently. With `bestEffort`, a key that cannot be deleted is logged and skipped and the rest still go; otherwise the first failure is thrown. */
10
- export declare function deleteBlobs(blobs: BlobStore, keys: readonly string[], bestEffort?: boolean): Promise<void>;
11
- /** Delete every blob `moveRunBlobs` can have moved for these owners (the keys `parseBlobKey` accepts under each owner's prefixes): one paged listing per owner and kind, then the deletes, with no request per key to check. */
12
- export declare function deleteOwnedBlobs(blobs: BlobStore, nodes: readonly string[], requests: readonly string[]): Promise<void>;
13
- /** Delete the run's uploaded copies (after the run is done). */
14
- export declare function deleteRunBlobs(blobs: BlobStore, runId: string): Promise<void>;
15
- /** Delete everything the run uploaded under `imports/<run>/` once the run can never be loaded again. The node-file archives are kept (`keepNodeFiles`) for a run that failed after its
16
- * copy committed: its `import_node_files` rows stay until rollback, and a hosted node's start reads the archive. By default a storage error is thrown (rollback reports it to its caller).
17
- * With `bestEffort`, a run whose state is already settled keeps that state: a list error is logged, and a key that cannot be deleted is logged and skipped while the rest still go. */
18
- export declare function deleteRunPrefix(blobs: BlobStore, runId: string, options?: {
19
- keepNodeFiles?: boolean;
20
- bestEffort?: boolean;
21
- }): Promise<void>;
22
- /** A run that failed before its copy committed keeps its uploaded bundle so `crtr sys import retry` can load it again; the storage sweep deletes it this many days after the failure. */
23
- export declare const FAILED_UPLOAD_RETENTION_DAYS = 7;
24
- /** `import_runs.step` of a failed run whose kept upload the sweep deleted. */
25
- export declare const UPLOAD_DELETED_STEP = "upload_deleted";
26
- /** Deletes the kept uploads of runs that failed before their copy committed and have been failed for `FAILED_UPLOAD_RETENTION_DAYS`. Returns how many runs were cleared. */
27
- export declare function sweepFailedUploads(db: CanvasDb, blobs: BlobStore, now: number): Promise<number>;
@@ -1 +0,0 @@
1
- var v=Object.defineProperty;var l=(e,t)=>v(e,"name",{value:t,configurable:!0});import{R2_MAX_CONNECTIONS as A}from"../../blobs/r2.js";import{ownerBlobPrefixes as O,parseBlobKey as R,runBlobPrefix as S}from"../bundle/blob-keys.js";import{bundleKeys as g}from"../bundle/layout.js";import{emitEvent as T}from"../../events/emit.js";import{q as m}from"./catalog.js";import{ImportLaneError as N}from"./stage.js";const M=A;function D(){const e=process.env.CRTR_IMPORT_BLOB_WORKERS;if(e===void 0||e==="")return M;const t=Number(e);if(!Number.isInteger(t)||t<1||t>1024)throw new Error(`CRTR_IMPORT_BLOB_WORKERS must be an integer from 1 to 1024, got ${JSON.stringify(e)}`);return t}l(D,"workerLimit");async function w(e,t){if(e.length===0)return;let i=0,n;const a=l(async()=>{for(;n===void 0&&i<e.length;)try{await t(e[i++])}catch(r){n??={error:r}}},"worker");if(await Promise.all(Array.from({length:Math.min(D(),e.length)},a)),n!==void 0)throw n.error}l(w,"forEachBounded");async function j(e,t,i,n,a,r,f){const p={nodes:new Set((await e.prepareUncached(`SELECT node_id AS v FROM ${m(t)}.nodes UNION SELECT node_id FROM ${m(i)}.nodes WHERE sub = ?`).all(n)).map(o=>o.v)),human_requests:new Set((await e.prepareUncached(`SELECT request_id AS v FROM ${m(t)}.human_requests`).all()).map(o=>o.v))},c=S(r),u={moved:0,left:0},d=[];for(const o of await a.listObjects(c)){const s=R(o.key.slice(c.length));s===null||!p[s.ownerTable].has(s.owner)?u.left+=1:d.push(o)}const h=new Map,E=new Set(d.map(o=>o.key.slice(c.length)));return await w([...new Set([...E].map(I))],async o=>{for(const s of await a.listObjects(o))E.has(s.key)&&h.set(s.key,s)}),await w(d,async o=>{const s=o.key.slice(c.length),y=h.get(s);if(y===void 0){if(f.push(s),!await a.copy(o.key,s))throw L(o.key)}else if(!await P(a,o,y))throw new N("blobs","unique_conflict",`${s} already exists with other contents; the import does not replace it`,{key:s});u.moved+=1}),u}l(j,"moveRunBlobs");const I=l(e=>e.split("/").slice(0,2).join("/")+"/","ownerPrefix"),L=l(e=>new N("blobs","bundle_invalid",`${e} was listed and is gone`),"gone");async function P(e,t,i){if(t.size!==i.size)return!1;if(t.etag!==null&&i.etag!==null)return t.etag===i.etag;for(let n=0;n<t.size;n+=k){const a={start:n,length:Math.min(k,t.size-n)},[r,f]=await Promise.all([e.get(t.key,a),e.get(i.key,a)]);if(r===null)throw L(t.key);if(f===null||!r.equals(f))return!1}return!0}l(P,"sameObject");const k=256*1024;async function _(e,t,i=!1){await w(t,i?n=>e.delete(n).catch(a=>{T({level:"warn",event:"import.blob_delete_failed",error:a,fields:{key:n}})}):n=>e.delete(n))}l(_,"deleteBlobs");async function z(e,t,i){const n=[...t.flatMap(r=>O("nodes",r).map(f=>({prefix:f,owner:r,table:"nodes"}))),...i.flatMap(r=>O("human_requests",r).map(f=>({prefix:f,owner:r,table:"human_requests"})))],a=[];await w(n,async({prefix:r,owner:f,table:p})=>{for(const c of await e.list(r)){const u=R(c);u!==null&&u.ownerTable===p&&u.owner===f&&a.push(c)}}),await _(e,a)}l(z,"deleteOwnedBlobs");async function H(e,t){await _(e,await e.list(S(t)))}l(H,"deleteRunBlobs");async function b(e,t,i={}){const n=`${g.prefix(t)}node-files/`;let a;try{a=await e.list(g.prefix(t))}catch(r){if(i.bestEffort!==!0)throw r;T({level:"warn",event:"import.prefix_delete_failed",error:r,fields:{run_id:t}});return}await _(e,i.keepNodeFiles===!0?a.filter(r=>!r.startsWith(n)):a,i.bestEffort===!0)}l(b,"deleteRunPrefix");const B=7,x="upload_deleted";async function J(e,t,i){const n=new Date(i-B*864e5).toISOString(),a=await e.prepare("SELECT run_id FROM import_runs WHERE state = 'failed' AND committed_at IS NULL AND finished_at IS NOT NULL AND finished_at <= ? AND step IS DISTINCT FROM ? LIMIT 20").all(n,x);for(const{run_id:r}of a)await b(t,r),await e.prepare("UPDATE import_runs SET step = ? WHERE run_id = ?").run(x,r);return a.length}l(J,"sweepFailedUploads");export{B as FAILED_UPLOAD_RETENTION_DAYS,x as UPLOAD_DELETED_STEP,_ as deleteBlobs,z as deleteOwnedBlobs,H as deleteRunBlobs,b as deleteRunPrefix,j as moveRunBlobs,J as sweepFailedUploads};
@@ -1,39 +0,0 @@
1
- import type { CanvasDb } from '../../canvas/db.js';
2
- /** `cascade`: the database deletes the row when its parent row goes (`ON DELETE CASCADE`). */
3
- export interface ForeignKey {
4
- table: string;
5
- columns: string[];
6
- parent: string;
7
- parentColumns: string[];
8
- cascade: boolean;
9
- }
10
- export interface UniqueKey {
11
- table: string;
12
- name: string;
13
- columns: string[];
14
- predicate: string | null;
15
- }
16
- /** The columns that identify a row of `info`: its primary key, or every column in order for a table with none (`memory_reads`). */
17
- export declare const rowKey: (info: TableInfo) => string[];
18
- /** `types` maps a column to its type name (`udt_name`), so a manifest key (the row key's columns as text) can be cast back and compared through the column's index. */
19
- export interface TableInfo {
20
- name: string;
21
- columns: string[];
22
- types: Record<string, string>;
23
- primaryKey: string[];
24
- identity: string[];
25
- }
26
- export interface Catalog {
27
- schema: string;
28
- tables: Map<string, TableInfo>;
29
- foreignKeys: ForeignKey[];
30
- uniqueKeys: UniqueKey[];
31
- }
32
- export declare const q: (name: string) => string;
33
- /** True when `alias`'s `columns` equal the manifest key held in `keyColumn` (a jsonb array of the key's columns as text, `m.k`). Each column is compared as itself against the key's
34
- * element cast to the column's type, so the table's index on the key serves the join; building the key from the table's rows instead would defeat every index. */
35
- export declare const keyMatch: (info: TableInfo, columns: readonly string[], alias: string, keyColumn: string) => string;
36
- /** Read the catalog of `schema` for `tables`. */
37
- export declare function readCatalog(db: CanvasDb, schema: string, tables: readonly string[]): Promise<Catalog>;
38
- /** Parents before children. Cycles (none in the schema today) are broken by the table list's order. */
39
- export declare function topologicalOrder(catalog: Catalog, tables: readonly string[]): string[];
@@ -1,9 +0,0 @@
1
- var g=Object.defineProperty;var c=(a,n)=>g(a,"name",{value:n,configurable:!0});const x=c(a=>a.primaryKey.length>0?a.primaryKey:a.columns,"rowKey"),u=c(a=>`"${a.replace(/"/g,'""')}"`,"q"),_=c((a,n,l,r)=>n.map((s,o)=>`${l}.${u(s)} = (${r} ->> ${o})::${u(a.types[s])}`).join(" AND "),"keyMatch");async function N(a,n,l){const r=[...l],s=await a.prepareUncached(`SELECT table_name, column_name, is_identity, udt_name FROM information_schema.columns
2
- WHERE table_schema = ? AND table_name = ANY(?::text[]) ORDER BY table_name, ordinal_position`).all(n,`{${r.map(e=>`"${e}"`).join(",")}}`),o=new Map;for(const e of r)o.set(e,{name:e,columns:[],types:{},primaryKey:[],identity:[]});for(const e of s){const i=o.get(e.table_name);i.columns.push(e.column_name),i.types[e.column_name]=e.udt_name,e.is_identity==="YES"&&i.identity.push(e.column_name)}const d=await a.prepareUncached(`SELECT c.conrelid::regclass::text AS tbl, c.contype, c.conname,
3
- (SELECT array_agg(a.attname::text ORDER BY k.ord) FROM unnest(c.conkey) WITH ORDINALITY k(attnum, ord) JOIN pg_attribute a ON a.attrelid = c.conrelid AND a.attnum = k.attnum) AS cols,
4
- c.confrelid::regclass::text AS ptbl, c.confdeltype = 'c' AS cascade,
5
- (SELECT array_agg(a.attname::text ORDER BY k.ord) FROM unnest(c.confkey) WITH ORDINALITY k(attnum, ord) JOIN pg_attribute a ON a.attrelid = c.confrelid AND a.attnum = k.attnum) AS pcols
6
- FROM pg_constraint c WHERE c.connamespace = ?::regnamespace AND c.contype IN ('p', 'f')`).all(n),p=c(e=>e.replace(/^.*\./,"").replace(/"/g,""),"bare"),t=[];for(const e of d){const i=p(e.tbl);o.has(i)&&(e.contype==="p"?o.get(i).primaryKey=e.cols:o.has(p(e.ptbl))&&t.push({table:i,columns:e.cols,parent:p(e.ptbl),parentColumns:e.pcols,cascade:e.cascade===!0}))}const y=(await a.prepareUncached(`SELECT t.relname AS tbl, i.relname AS name, pg_get_expr(x.indpred, x.indrelid) AS predicate, x.indexprs IS NOT NULL AS has_expr,
7
- (SELECT array_agg(a.attname::text ORDER BY k.ord) FROM unnest(x.indkey::int2[]) WITH ORDINALITY k(attnum, ord) JOIN pg_attribute a ON a.attrelid = x.indrelid AND a.attnum = k.attnum) AS cols
8
- FROM pg_index x JOIN pg_class t ON t.oid = x.indrelid JOIN pg_class i ON i.oid = x.indexrelid
9
- WHERE t.relnamespace = ?::regnamespace AND x.indisunique AND NOT x.indisprimary`).all(n)).filter(e=>o.has(e.tbl)&&!e.has_expr).map(e=>({table:e.tbl,name:e.name,columns:e.cols,predicate:e.predicate}));return{schema:n,tables:o,foreignKeys:t,uniqueKeys:y}}c(N,"readCatalog");function O(a,n){const l=new Set(n),r=new Map(n.map(t=>[t,new Set]));for(const t of a.foreignKeys)l.has(t.table)&&l.has(t.parent)&&t.table!==t.parent&&r.get(t.table).add(t.parent);const s=[],o=new Set,d=new Set,p=c(t=>{if(!(o.has(t)||d.has(t))){d.add(t);for(const m of[...r.get(t)].sort())p(m);d.delete(t),o.add(t),s.push(t)}},"visit");for(const t of n)p(t);return s}c(O,"topologicalOrder");export{_ as keyMatch,u as q,N as readCatalog,x as rowKey,O as topologicalOrder};
@@ -1,29 +0,0 @@
1
- import type { CanvasDb } from '../../canvas/db.js';
2
- import { type PathMap } from '../bundle/layout.js';
3
- import { type Catalog } from './catalog.js';
4
- import type { IdMap } from './rewrite.js';
5
- import type { SourceJson } from '../bundle/layout.js';
6
- export interface CopyResult {
7
- inserted: Record<string, number>;
8
- mapped: Record<string, number>;
9
- }
10
- /** `import_manifest.inserted_keys`: a zstd-compressed JSON array of primary-key tuples (each value as text). */
11
- export declare const encodeKeys: (keys: string[][]) => Buffer;
12
- export declare const decodeKeys: (data: Buffer) => string[][];
13
- export declare function nodesAwaitingVerify(db: CanvasDb): Promise<Set<string>>;
14
- export interface CopyInput {
15
- db: CanvasDb;
16
- runId: string;
17
- schema: string;
18
- target: string;
19
- catalog: Catalog;
20
- source: SourceJson;
21
- person: string;
22
- idMap: IdMap;
23
- pathMap: PathMap;
24
- }
25
- export declare const copyOrder: (catalog: Catalog) => string[];
26
- /** Must run inside `withCanvasWrite`. */
27
- export declare function copyRows(input: CopyInput): Promise<CopyResult>;
28
- /** Adds keys to a table's manifest row, creating it when the copy inserted no row of that table. */
29
- export declare function appendManifest(tx: CanvasDb, runId: string, table: string, keys: string[][]): Promise<void>;
@@ -1,11 +0,0 @@
1
- var W=Object.defineProperty;var E=(r,t)=>W(r,"name",{value:t,configurable:!0});import{zstdCompressSync as v,zstdDecompressSync as q}from"node:zlib";import{BODIES_TABLE as b,COPIED_TABLES as P,KEY_MAPPED_TABLES as k}from"../bundle/layout.js";import{q as s,rowKey as G,topologicalOrder as V}from"./catalog.js";import{fillEnvironments as Y}from"./prepare.js";import{ImportLaneError as D}from"./stage.js";import{encodeKeyBatches as J}from"./keys.js";const M=2e4,U=E((r,t)=>`${s(r)}.${s(t)}`,"sq"),$=E(r=>v(Buffer.from(JSON.stringify(r))),"encodeKeys"),F=E(r=>JSON.parse(q(r).toString("utf8")),"decodeKeys"),H=new Map;async function ae(r){const t=await r.prepare("SELECT run_id FROM import_runs WHERE state = 'committed' OR (state = 'failed' AND committed_at IS NOT NULL)").all(),i=new Set;for(const{run_id:p}of t){let m=H.get(p);if(m===void 0){const u=await r.prepare("SELECT inserted_keys FROM import_manifest WHERE run_id = ? AND table_name = 'nodes'").get(p);if(u===void 0)continue;m=new Set(F(u.inserted_keys).map(N=>N[0])),H.set(p,m)}for(const u of m)i.add(u)}return i}E(ae,"nodesAwaitingVerify");const K=E(r=>V(r,P),"copyOrder");async function se(r){const{db:t,runId:i,schema:p,target:m,catalog:u,source:N}=r,o=E(e=>U(p,e),"S"),l=E(e=>U(m,e),"T"),O={inserted:{},mapped:{}},x=E(async(e,n)=>{O.inserted[e]=n.length,await t.prepare("INSERT INTO import_manifest (run_id, table_name, inserted_keys) VALUES (?, ?, ?)").run(i,e,$(n))},"manifest"),w=E(async(e,n,T)=>(await t.exec(`DROP TABLE IF EXISTS ${o("_ord")}; CREATE TABLE ${o("_ord")} AS SELECT s.ctid AS row_id, (row_number() OVER (ORDER BY ${n}))::bigint AS n FROM ${o(e)} s${T}; CREATE INDEX ON ${o("_ord")} (n)`),Number((await t.prepareUncached(`SELECT count(*) AS n FROM ${o("_ord")}`).get()).n)),"number"),A=E(async(e,n,T,c=!0)=>{let f=0;const R=(async function*(){for(let _=0;_<n;_+=M){const d=await T(_,_+M);f+=d.length,yield d}})(),S=await J(R);return c&&await t.prepare("INSERT INTO import_manifest (run_id, table_name, inserted_keys) VALUES (?, ?, ?)").run(i,e,S),f},"inBatches");for(const[e,n]of Object.entries(k)){const c=u.tables.get(e).columns.filter(S=>S!==n),f=await w(e,`s.${s(n)}::bigint`,""),R=await A(e,f,async(S,_)=>(await t.prepareUncached(`WITH src AS MATERIALIZED (
2
- SELECT s.source_key, nextval(pg_get_serial_sequence(?, ?)::regclass) AS target_key, ${c.map(d=>`s.${s(d)}`).join(", ")}
3
- FROM (SELECT s.${s(n)}::text AS source_key, ${c.map(d=>`s.${s(d)}`).join(", ")}, o.n FROM ${o(e)} s JOIN ${o("_ord")} o ON o.row_id = s.ctid WHERE o.n > ${S} AND o.n <= ${_} ORDER BY o.n) s),
4
- ins AS (INSERT INTO ${l(e)} (${s(n)}, ${c.map(s).join(", ")}) SELECT target_key, ${c.map(s).join(", ")} FROM src RETURNING 1),
5
- km AS (INSERT INTO import_key_map (source_install_id, table_name, source_key, target_key) SELECT ?, ?, source_key, target_key::text FROM src RETURNING target_key)
6
- SELECT target_key FROM km ORDER BY target_key::bigint`).all(l(e),n,N.installId,e)).map(d=>[d.target_key]));O.inserted[e]=R}await t.prepareUncached(`UPDATE ${o("review_comments")} c SET created_seq = m.target_key::bigint FROM import_key_map m
7
- WHERE m.source_install_id = ? AND m.table_name = 'review_comment_events' AND m.source_key = c.created_seq::text`).run(N.installId);const g=K(u);await t.exec(`CREATE TABLE IF NOT EXISTS ${o("_filled")} (tbl text NOT NULL, k jsonb NOT NULL)`);const y=[];for(const e of g){if(e in k)continue;if(e==="profiles"){if(g.indexOf("identities")>g.indexOf("profiles"))throw new D("copy","bundle_invalid","identities must be copied before profiles");y.push(...await Y(t,p,m,N,r.person))}const n=u.tables.get(e),T=Number((await t.prepareUncached(`SELECT count(*) AS n FROM ${o(e)}`).get()).n);if(T===0){O.inserted[e]=0;continue}const c=G(n),f=n.columns.filter(a=>!n.identity.includes(a)),R=n.identity.length>0?n.identity.map(a=>`s.${s(a)}`).join(", "):c.map(a=>`s.${s(a)}`).join(", ");let S=f.map(a=>`s.${s(a)}`),_="",d=0;e==="messages"&&(_=` WHERE NOT EXISTS (SELECT 1 FROM ${l("messages")} t WHERE t.message_id = s.message_id)`);const L=n.primaryKey.length===0;L&&(_=` WHERE NOT EXISTS (SELECT 1 FROM ${l(e)} t WHERE ${c.map(a=>`t.${s(a)} IS NOT DISTINCT FROM s.${s(a)}`).join(" AND ")})`);const I=await w(e,e==="messages"?"s.seq":R,_);if(e==="messages"){if(I===0){O.inserted[e]=0,await x(e,[]);continue}d=Number((await t.prepare("UPDATE message_sequence SET seq = seq + ? WHERE id = 1 RETURNING seq").get(I)).seq),S=f.map(a=>a==="seq"?`${d-I} + o.n`:`s.${s(a)}`)}const B=c.map(a=>`${s(a)}::text`).join(", "),C=await A(e,I,async(a,h)=>(await t.prepareUncached(`INSERT INTO ${l(e)} (${f.map(s).join(", ")}) SELECT ${S.join(", ")} FROM ${o(e)} s JOIN ${o("_ord")} o ON o.row_id = s.ctid WHERE o.n > ${a} AND o.n <= ${h}
8
- ORDER BY o.n${L?"":` ON CONFLICT (${c.map(s).join(", ")}) DO NOTHING`} RETURNING ${B}`).all()).map(j=>Object.values(j)),e!==b);if(e===b){const a=await t.prepareUncached(`SELECT s.hash FROM ${o(e)} s JOIN ${l(e)} t ON t.hash = s.hash WHERE t.text IS DISTINCT FROM s.text LIMIT 10`).all();if(a.length>0)throw new D("copy","unique_conflict",`the target holds other text under body ${a[0].hash}; its boot repair has not rekeyed that row`,{table:e,hashes:a.map(h=>h.hash)})}O.inserted[e]=C,O.mapped[e]=T-C}for(const e of y)await t.prepare(`INSERT INTO ${o("_filled")} VALUES (?, ?::jsonb)`).run(e.table,JSON.stringify(e.key));for(const e of new Set(y.map(n=>n.table)))await X(t,i,e,y.filter(n=>n.table===e).map(n=>n.key));await t.prepareUncached(`DELETE FROM ${l("charge_totals")} t WHERE (t.month, t.payer) IN (SELECT DISTINCT month, payer FROM ${o("charges")})`).run(),await t.prepareUncached(`INSERT INTO ${l("charge_totals")} (month, payer, funding, sub, grantee, provider, usd, billed_usd)
9
- SELECT month, payer, funding, COALESCE(sub, ''), grantee, COALESCE(provider, ''), COALESCE(SUM(usd), 0), COALESCE(SUM(billed_usd), 0)
10
- FROM ${l("charges")} WHERE refused IS NULL AND kind <> 'take' AND (month, payer) IN (SELECT DISTINCT month, payer FROM ${o("charges")})
11
- GROUP BY month, payer, funding, COALESCE(sub, ''), grantee, COALESCE(provider, '')`).run();for(const[e,n]of[["object",r.idMap.object],["grant",r.idMap.grant],["kind",r.idMap.kind]])for(const[T,c]of n)await t.prepare("INSERT INTO import_id_map (run_id, kind, source_value, target_value) VALUES (?, ?, ?, ?) ON CONFLICT DO NOTHING").run(i,e,T,c);for(const e of r.pathMap)await t.prepare("INSERT INTO import_id_map (run_id, kind, source_value, target_value) VALUES (?, 'path', ?, ?) ON CONFLICT DO NOTHING").run(i,e.from,e.to);return await t.prepare("UPDATE import_runs SET state = 'committed', committed_at = ?, step = 'copy' WHERE run_id = ?").run(new Date().toISOString(),i),O}E(se,"copyRows");async function X(r,t,i,p){if(p.length===0)return;const m=await r.prepare("SELECT inserted_keys FROM import_manifest WHERE run_id = ? AND table_name = ?").get(t,i);m===void 0?await r.prepare("INSERT INTO import_manifest (run_id, table_name, inserted_keys) VALUES (?, ?, ?)").run(t,i,$(p)):await r.prepare("UPDATE import_manifest SET inserted_keys = ? WHERE run_id = ? AND table_name = ?").run($([...F(m.inserted_keys),...p]),t,i)}E(X,"appendManifest");export{X as appendManifest,K as copyOrder,se as copyRows,F as decodeKeys,$ as encodeKeys,ae as nodesAwaitingVerify};
@@ -1,5 +0,0 @@
1
- export declare const KEY_BATCH = 5000;
2
- /** Compress the batches into one `inserted_keys` value. */
3
- export declare function encodeKeyBatches(batches: AsyncIterable<string[][]>): Promise<Buffer>;
4
- /** The tuples of an `inserted_keys` value, `size` at a time. */
5
- export declare function keyBatches(data: Buffer, size?: number): AsyncGenerator<string[][]>;
@@ -1,8 +0,0 @@
1
- var d=Object.defineProperty;var u=(c,e)=>d(c,"name",{value:e,configurable:!0});import{createZstdCompress as h,createZstdDecompress as g}from"node:zlib";import{once as p}from"node:events";const m=5e3;async function O(c){const e=h(),f=[];e.on("data",i=>f.push(i));const t=p(e,"end"),n=u(async i=>{e.write(i,"utf8")||await p(e,"drain")},"put");await n(`[
2
- `);let a=!0;for await(const i of c)i.length!==0&&(await n((a?"":`,
3
- `)+i.map(s=>JSON.stringify(s)).join(`,
4
- `)),a=!1);return await n(`
5
- ]`),e.end(),await t,Buffer.concat(f)}u(O,"encodeKeyBatches");async function*B(c,e=m){const f=g({chunkSize:1048576});f.end(c);let t="",n=[],a,i=[];for await(const r of f){if(a===!1){i.push(r);continue}if(t+=r.toString("utf8"),a===void 0){if(t.length<2)continue;if(a=t.startsWith(`[
6
- `)||t==="[]",!a){i.push(Buffer.from(t)),t="";continue}}let o=t.indexOf(`
7
- `);for(;o!==-1;){const l=t.slice(0,o).replace(/,$/,"");t=t.slice(o+1),l!=="["&&l!=="]"&&l!==""&&(n.push(JSON.parse(l)),n.length>=e&&(yield n,n=[])),o=t.indexOf(`
8
- `)}}if(a===!1||a===void 0){const r=i.length>0?JSON.parse(Buffer.concat(i).toString("utf8")):t===""?[]:JSON.parse(t);for(let o=0;o<r.length;o+=e)yield r.slice(o,o+e);return}const s=t.replace(/,$/,"").trim();s!==""&&s!=="]"&&s!=="["&&n.push(JSON.parse(s)),n.length>0&&(yield n)}u(B,"keyBatches");export{m as KEY_BATCH,O as encodeKeyBatches,B as keyBatches};
@@ -1 +0,0 @@
1
- export declare function openImportGrants(runId: string): Promise<void>;
@@ -1 +0,0 @@
1
- var a=Object.defineProperty;var s=(o,t)=>a(o,"name",{value:t,configurable:!0});import{directoryIssuer as c}from"../../directory/issuer.js";import{outboundFetch as p}from"../../events/outbound.js";import{mintDirectoryToken as m}from"../../grants/sync.js";import{ImportLaneError as n}from"./stage.js";async function y(o){const t=c();if(t===null)throw new n("open-grants","directory_refused","the directory is not configured, so the person's grants cannot be copied onto the fleet runtime");const i=`${t}/v1/runtime/imports/${encodeURIComponent(o)}/open`;let r;try{const e=await m(t);r=await p("import_open_grants",i,{method:"POST",headers:{Authorization:`Bearer ${e.access_token}`},signal:AbortSignal.timeout(12e4)})}catch(e){throw new n("open-grants","directory_refused",`the directory could not be asked to copy the grants: ${e instanceof Error?e.message:String(e)}`)}if(!r.ok)throw new n("open-grants","directory_refused",`the directory refused to copy the person's grants onto the fleet runtime: ${r.status}`)}s(y,"openImportGrants");export{y as openImportGrants};
@@ -1,7 +0,0 @@
1
- import type { CanvasDb } from '../../canvas/db.js';
2
- import { type PathMap, type PathPrefix, type SourceJson } from '../bundle/layout.js';
3
- /** A directory two nodes share (a cwd outside both worktrees) maps once, to the first node's folder: both nodes' rows read the same target and each
4
- * sandbox unpacks its own archive there. */
5
- export declare function sandboxPathMap(prefixes: readonly PathPrefix[]): PathMap;
6
- /** One `import_node_files` row per hosted running node the exporter archived. Runs in the copy transaction, after the nodes are copied. */
7
- export declare function writeNodeFiles(tx: CanvasDb, schema: string, runId: string, source: SourceJson): Promise<number>;
@@ -1 +0,0 @@
1
- var s=Object.defineProperty;var d=(n,o)=>s(n,"name",{value:o,configurable:!0});import{basename as m,dirname as l}from"node:path";import{nodeAgentDir as c}from"../../canvas/paths.js";import{bundleKeys as u}from"../bundle/layout.js";import{q as p}from"./catalog.js";import{ImportLaneError as a}from"./stage.js";const h="/work/imported";function A(n){const o=n.map(e=>{if(!e.from.startsWith("/")||e.from.split("/").includes(".."))throw new a("stage","bundle_invalid",`path prefix ${e.from} of node ${e.node} is not an absolute path`);const r=e.app.replace(/^app:/,"");if(!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(r)||!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(e.node))throw new a("stage","bundle_invalid",`path prefix names app ${e.app} and node ${e.node}`);const t=c(e.node,e.app);if(e.role==="context"){if(m(e.from)!=="context")throw new a("stage","bundle_invalid",`the context prefix ${e.from} of node ${e.node} is not a context directory`);return{from:l(e.from),to:t}}return{from:e.from,to:e.role==="worktree"?`${t}/worktree`:`${h}/${e.node}`}});return o.filter((e,r)=>o.findIndex(t=>t.from===e.from)===r)}d(A,"sandboxPathMap");async function E(n,o,e,r){if(r.kind!=="hosted")return 0;const t=[...new Set((r.pathPrefixes??[]).map(i=>i.node))];let f=0;for(const i of t){if(await n.prepareUncached(`SELECT 1 AS found FROM ${p(o)}.nodes WHERE node_id = ? AND status IN ('active', 'idle')`).get(i)===void 0)throw new a("copy","bundle_invalid",`an archive was uploaded for node ${i}, which is not a running node of the bundle`);f+=Number((await n.prepare("INSERT INTO import_node_files (node, blob_key) VALUES (?, ?) ON CONFLICT DO NOTHING").run(i,u.nodeFiles(e,i))).changes)}return f}d(E,"writeNodeFiles");export{A as sandboxPathMap,E as writeNodeFiles};
@@ -1,70 +0,0 @@
1
- import type { CanvasDb } from '../../canvas/db.js';
2
- import { type PathMap, type SourceJson } from '../bundle/layout.js';
3
- import type { BlobStore } from '../../blobs/index.js';
4
- import { type Catalog } from './catalog.js';
5
- /** A revision of a document the target already holds, to be added through repo sync's own arrival path. */
6
- export interface ArrivingRevision {
7
- document: string;
8
- rev_id: string;
9
- parents: string[];
10
- body_hash: string;
11
- rationale: string | null;
12
- created_at: string;
13
- }
14
- /** Rewrite 4: for rows of running nodes of a hosted source, path columns go through the run's map. Ended nodes' rows stay as historical text. */
15
- export declare function rewritePaths(db: CanvasDb, schema: string, map: PathMap): Promise<number>;
16
- /** Rewrite 4, conversations: pi refuses to open a session whose header `cwd` does not exist, so the header of part 0 of each conversation of a running node goes through the
17
- * run's map like `nodes.cwd`. The run's uploaded copy of the blob is rewritten (the move step copies it to its key) and the staged row's `bytes` follows, so verify and the
18
- * pre-check compare the rewritten rows. A bundle loaded again, or a run retried after an earlier attempt rewrote the upload, ends with the same bytes. Runs after `rewritePaths`, before the pre-check. Returns conversations rewritten. */
19
- export declare function rewriteConversationHeaders(db: CanvasDb, schema: string, map: PathMap, blobs: BlobStore, runId: string): Promise<number>;
20
- /** Rewrite 4b: a human request's files live in the blob store under `requests/<id>/` (the exporter uploaded the request dir there). `request_dir` becomes that
21
- * prefix; a `file` or `presentation_dir` inside the old dir keeps its relative path, one outside it was uploaded to `source/<basename>`. A path that is not
22
- * absolute is already a blob path and stays. */
23
- export declare function rewriteRequestPaths(db: CanvasDb, schema: string): Promise<number>;
24
- /** A profile whose name another profile already holds is renamed `<name>-<install id>` (staging only; runs before the pre-check), in its `profiles` row and in its `profile`
25
- * object's handle. The name clashes when the person already uses it for another profile, or when the object's handle is held by any other live profile object: `objects_handle`
26
- * is unique per type across the whole fleet, so another person's profile counts. Only a handle that is the profile's name moves (a cloud role's handle is the profile id).
27
- * The new name is a function of the install, so a second load of the bundle derives the same one. Runs after `mapProfileIds`, which leaves the staged identity at the profile's id. */
28
- export declare function renameClashingProfiles(db: CanvasDb, schema: string, target: string, installId: string, person: string): Promise<number>;
29
- /** A migrated usage charge (`legacy:` id, `importLegacyUsage`) has no install id, so two Macs of one person with usage in the same month and model produce one id with
30
- * different amounts. A staged one whose id the target holds with a different payer, units or usd is renamed `<id>:install-<install id>`; one the target holds unchanged keeps its
31
- * id and is skipped by the copy. A second load of the same bundle derives the same id. Runs before the pre-check. */
32
- export declare function renameClashingLegacyCharges(db: CanvasDb, schema: string, target: string, installId: string): Promise<number>;
33
- /** A staged watch whose (watcher, object) the target already holds is already imported (a hosted person's nodes watching shared objects): it and its subscriptions are
34
- * dropped, the target's rows stand. Only this key is skipped; any other unique conflict still fails the pre-check. Returns the dropped watches and subscriptions. Runs before the pre-check. */
35
- export declare function dropExistingWatches(db: CanvasDb, schema: string, target: string): Promise<{
36
- watches: number;
37
- watch_subscriptions: number;
38
- }>;
39
- /** A hosted cron runs in its anchor node's sandbox and fails with no anchor. A Mac cron made without `--anchor` has none, so a staged cron of a hosted source with no anchor
40
- * takes its creator as anchor when that node is staged (still in the bundle after the drops). The anchor's `ON DELETE CASCADE` then removes the cron with its creator. Runs after the drops. Returns the crons anchored. */
41
- export declare function anchorCronsToCreator(db: CanvasDb, schema: string): Promise<number>;
42
- /** A staged idempotency key whose (grantee, key) the target already holds is already imported (a hosted person's runs the control plane has since served): it is dropped, the target's
43
- * row stands, so the copy never inserts it and verify never compares it. Only this key is skipped; any other difference still fails. Returns the dropped rows. Runs before the pre-check. */
44
- export declare function dropExistingIdempotencyKeys(db: CanvasDb, schema: string, target: string): Promise<number>;
45
- /** A staged idempotency key at least `IDEMPOTENCY_WINDOW_MS` old is already expired (`findIdempotent` ignores it and the daemon's sweep deletes it within a minute), so it is dropped before
46
- * the copy: otherwise the sweep removes it between copy and verify and verify reports a difference. Returns the dropped rows. Runs before the pre-check. */
47
- export declare function dropExpiredIdempotencyKeys(db: CanvasDb, schema: string): Promise<number>;
48
- /** The rows `fillEnvironments` created, as manifest keys per table, so rollback removes them and verify (which has no staged row for them) skips them. */
49
- export interface FilledRow {
50
- table: string;
51
- key: string[];
52
- }
53
- /** Fill: a staged profile with no environment gets the source's machine environment (a Mac) or the person's Blaxel environment (hosted, created if
54
- * absent). Runs in the copy transaction: it writes target objects. */
55
- export declare function fillEnvironments(tx: CanvasDb, schema: string, target: string, source: SourceJson, person: string): Promise<FilledRow[]>;
56
- /** Staged edits that need nothing from the target but its key map: limits the directory or an operator wrote stay out, a hosted source's own
57
- * machine environment is marked for the drop step, claims of the old runtime's lanes are cleared, and rows of the identity-keyed tables already in
58
- * `import_key_map` are not staged again. Returns the rows removed per table. */
59
- export declare function pruneStaged(db: CanvasDb, schema: string, catalog: Catalog, source: SourceJson): Promise<Record<string, number>>;
60
- /** A staged document whose id the target already holds (repo sync keeps the id across runtimes) is not inserted: its revisions arrive through
61
- * `insertImportedRevisions`. Removes its staged object, document, revision and parent rows and returns the revisions. Runs before the pre-check. */
62
- export declare function takeRepoSyncedDocuments(db: CanvasDb, schema: string, target: string): Promise<ArrivingRevision[]>;
63
- export interface Collision {
64
- table: string;
65
- key: string;
66
- values: string[]; /** Two staged rows collide with each other, not with the target. */
67
- staged?: true;
68
- }
69
- /** Pre-check (I9): every non-primary unique key and every text primary key the target already holds, and every unique key two staged rows share. Throws `unique_conflict` naming the first 10 values. */
70
- export declare function precheck(db: CanvasDb, schema: string, target: string, catalog: Catalog, tables: readonly string[], skip: ReadonlySet<string>, seqLike: ReadonlyMap<string, string[]>): Promise<void>;
@@ -1,14 +0,0 @@
1
- var A=Object.defineProperty;var d=(e,a)=>A(e,"name",{value:a,configurable:!0});import{createProfileBlaxelEnvironment as U}from"../../environments.js";import{KEY_MAPPED_TABLES as M,mapPath as S}from"../bundle/layout.js";import{IDEMPOTENCY_WINDOW_MS as C}from"../../runs/operations.js";import{ImportLaneError as N}from"./stage.js";import{withHeaderCwd as g}from"../../conversation-store/row-store.js";import{runBlobKey as H}from"../bundle/blob-keys.js";import{q as l}from"./catalog.js";const c=d((e,a)=>`${l(e)}.${l(a)}`,"sq");async function J(e,a,o){if(o.length===0)return 0;const n=d(E=>c(a,E),"S"),i=`(SELECT node_id FROM ${n("nodes")} WHERE status IN ('active', 'idle'))`;let s=0;const p=d(async(E,r,t,$=!1)=>{const _=await e.prepareUncached(`SELECT ${l(r)}::text AS value FROM ${n(E)} WHERE ${t} AND ${l(r)} IS NOT NULL`).all();for(const{value:m}of _){const T=$?b(m,o):S(o,m);T!==m&&(await e.prepareUncached(`UPDATE ${n(E)} SET ${l(r)} = ? WHERE ${l(r)}::text = ? AND ${t}`).run(T,m),s+=1)}},"apply");return await p("nodes","cwd",`node_id IN ${i}`),await p("worktrees","path",`node_id IN ${i}`),await p("worktrees","repo_root",`node_id IN ${i}`),await p("crons","cwd",`anchor_node IN ${i}`),await p("provider_approvals","prepared_files","TRUE",!0),await p("upload_uses","path",`run_id IN ${i}`),s}d(J,"rewritePaths");async function Y(e,a,o,n,i){if(o.length===0)return 0;const s=d(r=>c(a,r),"S"),p=await e.prepareUncached(`SELECT conversation_id, blob_key FROM ${s("conversation_parts")} WHERE seq = 0
2
- AND split_part(blob_key, '/', 2) IN (SELECT node_id FROM ${s("nodes")} WHERE status IN ('active', 'idle'))`).all();let E=0;for(const{conversation_id:r,blob_key:t}of p){const $=H(i,t),_=await n.get($);if(_===null)throw new N("rewrite-paths","bundle_invalid",`${$} is missing: the header of conversation ${r} cannot be rewritten`);const m=g(_,r,T=>S(o,T));m!==null&&(await n.put($,m),E+=1),await e.prepareUncached(`UPDATE ${s("conversation_parts")} SET bytes = ?, cycle_offset = NULL WHERE conversation_id = ? AND seq = 0`).run((m??_).length,r)}return E}d(Y,"rewriteConversationHeaders");async function X(e,a){const o=c(a,"human_requests"),n=d(s=>`CASE WHEN ${s} IS NULL OR ${s} NOT LIKE '/%' THEN ${s}
3
- WHEN rtrim(${s}, '/') = rtrim(request_dir, '/') THEN 'requests/' || request_id
4
- WHEN ${s} LIKE rtrim(request_dir, '/') || '/%' THEN 'requests/' || request_id || '/' || substr(${s}, length(rtrim(request_dir, '/')) + 2)
5
- ELSE 'requests/' || request_id || '/source/' || regexp_replace(${s}, '^.*/', '') END`,"moved"),i=await e.prepareUncached(`UPDATE ${o} SET file = ${n("file")}, presentation_dir = ${n("presentation_dir")},
6
- request_dir = CASE WHEN request_dir LIKE '/%' THEN 'requests/' || request_id ELSE request_dir END`).run();return Number(i.changes)}d(X,"rewriteRequestPaths");function b(e,a){const o=d(n=>typeof n=="string"?S(a,n):Array.isArray(n)?n.map(o):n!==null&&typeof n=="object"?Object.fromEntries(Object.entries(n).map(([i,s])=>[i,o(s)])):n,"walk");try{return JSON.stringify(o(JSON.parse(e)))}catch{return S(a,e)}}d(b,"rewriteJsonPaths");async function G(e,a,o,n,i){const s=d(r=>c(a,r),"S"),p=await e.prepareUncached(`SELECT id, name FROM ${s("profiles")} ORDER BY id`).all();let E=0;for(const r of p){const t=await e.prepareUncached(`SELECT o.id FROM ${s("objects")} o JOIN ${s("identities")} i ON i.object = o.id AND i.scheme = 'profile' AND i.external_id = ?
7
- WHERE o.type = 'profile' AND o.name = ?`).get(r.id,r.name),$=await e.prepareUncached(`SELECT 1 AS found FROM ${c(o,"profiles")} WHERE person = ? AND name = ? AND id <> ?`).get(i,r.name,r.id),_=t===void 0?void 0:await e.prepareUncached(`SELECT 1 AS found FROM ${c(o,"objects")} WHERE type = 'profile' AND home_machine IS NULL AND name = ? AND id <> ?`).get(r.name,t.id);if($===void 0&&_===void 0)continue;const m=`${r.name}-${n}`;await e.prepareUncached(`UPDATE ${s("profiles")} SET name = ? WHERE id = ?`).run(m,r.id),t!==void 0&&await e.prepareUncached(`UPDATE ${s("objects")} SET name = ? WHERE id = ?`).run(m,t.id),E+=1}return E}d(G,"renameClashingProfiles");async function z(e,a,o,n){const i=await e.prepareUncached(`UPDATE ${c(a,"charges")} s SET id = s.id || ':install-' || ?::text FROM ${c(o,"charges")} t
8
- WHERE s.id LIKE 'legacy:%' AND t.id = s.id AND (s.payer IS DISTINCT FROM t.payer OR s.units IS DISTINCT FROM t.units OR s.usd IS DISTINCT FROM t.usd)`).run(n);return Number(i.changes)}d(z,"renameClashingLegacyCharges");async function Q(e,a,o){const n=`FROM ${c(o,"watches")} t WHERE t.watcher = s.watcher AND t.object = s.object`,i=await e.prepareUncached(`DELETE FROM ${c(a,"watch_subscriptions")} u USING ${c(a,"watches")} s WHERE u.watch = s.watch_id AND EXISTS (SELECT 1 ${n})`).run(),s=await e.prepareUncached(`DELETE FROM ${c(a,"watches")} s WHERE EXISTS (SELECT 1 ${n})`).run();return{watches:Number(s.changes),watch_subscriptions:Number(i.changes)}}d(Q,"dropExistingWatches");async function V(e,a){const o=await e.prepareUncached(`UPDATE ${c(a,"crons")} c SET anchor_node = c.created_by WHERE c.anchor_node IS NULL AND c.created_by IN (SELECT node_id FROM ${c(a,"nodes")})`).run();return Number(o.changes)}d(V,"anchorCronsToCreator");async function Z(e,a,o){const n=await e.prepareUncached(`DELETE FROM ${c(a,"idempotency_keys")} s WHERE EXISTS (SELECT 1 FROM ${c(o,"idempotency_keys")} t WHERE t.grantee = s.grantee AND t.key = s.key)`).run();return Number(n.changes)}d(Z,"dropExistingIdempotencyKeys");async function ee(e,a){const o=await e.prepareUncached(`DELETE FROM ${c(a,"idempotency_keys")} WHERE created_at <= ?`).run(new Date(Date.now()-C).toISOString());return Number(o.changes)}d(ee,"dropExpiredIdempotencyKeys");async function ne(e,a,o,n,i){const s=d(r=>c(a,r),"S"),p=[],E=await e.prepareUncached(`SELECT id, grantee FROM ${s("profiles")} WHERE environment_id IS NULL ORDER BY id`).all();for(const r of E){let t=n.kind==="machine"?n.environmentObject??null:null;if(n.kind==="hosted"){const $=await e.prepareUncached(`SELECT environment_id FROM ${c(o,"profiles")} WHERE id = ?`).get(r.id);if($?.environment_id!=null)t=$.environment_id;else{t=await U(e,{profileId:r.id,grantee:r.grantee??"app:terminal",person:i}),p.push({table:"objects",key:[t]},{table:"environments",key:[t]});for(const _ of await e.prepareUncached("SELECT resource_type, resource_id, relation, subject_type, subject_id, subject_relation FROM relations WHERE resource_id = ?").all(t))p.push({table:"relations",key:[_.resource_type,_.resource_id,_.relation,_.subject_type,_.subject_id,_.subject_relation]})}}if(t===null)throw new N("fill","bundle_invalid",`profile ${r.id} has no environment and the source names none`);await e.prepareUncached(`UPDATE ${s("profiles")} SET environment_id = ? WHERE id = ?`).run(t,r.id)}return p}d(ne,"fillEnvironments");async function te(e,a,o,n){const i=d(E=>c(a,E),"S"),s={},p=d(async(E,r,...t)=>{const $=Number((await e.prepareUncached(r).run(...t)).changes);$>0&&(s[E]=(s[E]??0)+$)},"del");await p("limits",`DELETE FROM ${i("limits")} WHERE source <> 'person'`),n.kind==="hosted"&&(await e.prepareUncached(`UPDATE ${i("profiles")} SET environment_id = NULL WHERE environment_id IN (SELECT object FROM ${i("environments")})`).run(),await e.prepareUncached(`UPDATE ${i("objects")} SET home_machine = 'import-hosted-source' WHERE id IN (SELECT object FROM ${i("environments")})`).run());for(const[E,r]of Object.entries(M))await p(E,`DELETE FROM ${i(E)} WHERE ${l(r)}::text IN (SELECT source_key FROM import_key_map WHERE source_install_id = ? AND table_name = ?)`,n.installId,E);for(const E of o.tables.values())E.columns.includes("claimed_by")&&E.columns.includes("lease_expires_at")&&await e.prepareUncached(`UPDATE ${i(E.name)} SET claimed_by = NULL, lease_expires_at = NULL WHERE claimed_by IS NOT NULL OR lease_expires_at IS NOT NULL`).run();return s}d(te,"pruneStaged");async function re(e,a,o){const n=d(p=>c(a,p),"S"),i=`(SELECT d.object FROM ${n("documents")} d WHERE EXISTS (SELECT 1 FROM ${c(o,"documents")} t WHERE t.object = d.object))`;await e.exec(`CREATE TABLE ${n("_arr_revisions")} AS SELECT r.* FROM ${n("revisions")} r WHERE r.document IN ${i};
9
- CREATE TABLE ${n("_arr_parents")} AS SELECT p.* FROM ${n("revision_parents")} p WHERE p.child IN (SELECT rev_id FROM ${n("revisions")} WHERE document IN ${i})`);const s=await e.prepareUncached(`SELECT r.document, r.rev_id, r.body_hash, r.rationale, r.created_at,
10
- COALESCE((SELECT array_agg(p.parent) FROM ${n("revision_parents")} p WHERE p.child = r.rev_id), ARRAY[]::text[]) AS parents
11
- FROM ${n("revisions")} r WHERE r.document IN ${i} ORDER BY r.document, r.number`).all();return await e.prepareUncached(`DELETE FROM ${n("revision_parents")} WHERE child IN (SELECT rev_id FROM ${n("revisions")} WHERE document IN ${i})`).run(),await e.prepareUncached(`DELETE FROM ${n("revisions")} WHERE document IN ${i}`).run(),await e.prepareUncached(`DELETE FROM ${n("objects")} WHERE id IN ${i}`).run(),await e.prepareUncached(`DELETE FROM ${n("documents")} WHERE object IN ${i}`).run(),s.map(p=>({...p}))}d(re,"takeRepoSyncedDocuments");const v={edges:["created_at"],relations:["created_at","written_by"]},W={charges:["payer","units","usd"]};async function ae(e,a,o,n,i,s,p){const E=d(t=>[...p.get(t)??[],...t==="profiles"?["environment_id"]:[],...v[t]??[],"claimed_by","lease_expires_at"],"ignored"),r=[];for(const t of i){const $=n.tables.get(t);if($===void 0||s.has(t)||$.primaryKey.length===0)continue;const _=$.primaryKey,m=_.some(u=>$.identity.includes(u)),T=_.map(u=>`s.${l(u)} = t.${l(u)}`).join(" AND "),L=m?"TRUE":_.map(u=>`s.${l(u)} IS DISTINCT FROM t.${l(u)}`).join(" OR "),I=new Set([...$.identity,...p.get(t)??[]]);for(const u of n.uniqueKeys.filter(h=>h.table===t&&!h.columns.every(f=>I.has(f)))){const h=u.predicate===null?"":` WHERE ${u.predicate}`,f=u.columns.map(R=>`s.${l(R)} = t.${l(R)}`).join(" AND "),y=await e.prepareUncached(`SELECT ${u.columns.map(R=>`s.${l(R)}::text`).join(" || ',' || ")} AS value
12
- FROM (SELECT * FROM ${c(a,t)}${h}) s JOIN (SELECT * FROM ${c(o,t)}${h}) t ON ${f} AND (${L}) LIMIT 10`).all();y.length>0&&r.push({table:t,key:u.name,values:y.map(R=>R.value)});const D=m?"TRUE":_.map(R=>`a.${l(R)} IS DISTINCT FROM b.${l(R)}`).join(" OR "),O=await e.prepareUncached(`SELECT DISTINCT ${u.columns.map(R=>`a.${l(R)}::text`).join(" || ',' || ")} AS value
13
- FROM (SELECT ctid AS row_id, * FROM ${c(a,t)}${h}) a JOIN (SELECT ctid AS row_id, * FROM ${c(a,t)}${h}) b ON ${u.columns.map(R=>`a.${l(R)} = b.${l(R)}`).join(" AND ")} AND a.row_id < b.row_id AND (${D}) LIMIT 10`).all();O.length>0&&r.push({table:t,key:u.name,values:O.map(R=>R.value),staged:!0})}const w=$.columns.filter(u=>!$.identity.includes(u)&&!E(t).includes(u)&&(W[t]?.includes(u)??!0));if(w.length>0&&!m){const u=w.map(f=>`s.${l(f)} IS DISTINCT FROM t.${l(f)}`).join(" OR "),h=await e.prepareUncached(`SELECT ${_.map(f=>`s.${l(f)}::text`).join(" || ',' || ")} AS value
14
- FROM ${c(a,t)} s JOIN ${c(o,t)} t ON ${T} WHERE ${u} LIMIT 10`).all();h.length>0&&r.push({table:t,key:"primary key payload",values:h.map(f=>f.value)})}}if(r.length>0){const t=r[0];throw new N("pre-check","unique_conflict",`${t.table} ${t.key} collides ${t.staged===!0?"within the bundle":"with the target"}: ${t.values.join(", ")}`,{collisions:r})}}d(ae,"precheck");export{V as anchorCronsToCreator,Z as dropExistingIdempotencyKeys,Q as dropExistingWatches,ee as dropExpiredIdempotencyKeys,ne as fillEnvironments,ae as precheck,te as pruneStaged,z as renameClashingLegacyCharges,G as renameClashingProfiles,Y as rewriteConversationHeaders,J as rewritePaths,X as rewriteRequestPaths,re as takeRepoSyncedDocuments};
@@ -1,10 +0,0 @@
1
- import type { ImportRunDTO } from '../../../api/dto/imports.js';
2
- import type { ImportPluginsStoreDTO } from '../../../api/dto/imports.js';
3
- export type RefusedPlugin = NonNullable<ImportRunDTO['refused_plugins']>[number];
4
- export interface PublishOutcome {
5
- /** Plugins the directory refused: still imported as installs, their documents fall to I23. */
6
- refused: RefusedPlugin[];
7
- /** Plugins the directory could not answer for (unreachable): the run must not go on, or I23 would shadow the shared copy. */
8
- unavailable: string[];
9
- }
10
- export declare function publishImportedPlugins(plugins: ImportPluginsStoreDTO | null): Promise<PublishOutcome>;
@@ -1 +0,0 @@
1
- var i=Object.defineProperty;var t=(o,n)=>i(o,"name",{value:n,configurable:!0});import{reportPublished as f,syncInstall as c}from"../../packages/directory-sync.js";import{normalizeSourceUrl as d}from"../../packages/source-url.js";import{hasFleetSource as p}from"./stores.js";async function $(o){const n={refused:[],unavailable:[]};if(o===null)return n;const s=new Map(o.marketplaces.filter(e=>e.url!=null).map(e=>[`${e.owner}\0${e.name}`,d(e.url)])),l=new Map;for(const e of o.plugins){if(!e.enabled||!p(e))continue;const a=s.get(`${e.owner}\0${e.source_marketplace}`);a!==void 0&&l.set(`${e.name}\0${a}`,{name:e.name,url:a})}for(const{name:e,url:a}of l.values()){const{out:r,published:u}=await c(e,a);u!==void 0&&f(e,u),!r.ok&&(r.reason==="unavailable"?n.unavailable.push(e):n.refused.push({plugin:e,reason:r.reason,...r.reason==="name_taken"&&r.holder!==void 0?{holder:r.holder}:{}}))}return n}t($,"publishImportedPlugins");export{$ as publishImportedPlugins};