@dreamlake/dreamlake-cli 0.88.0 → 0.89.0

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 (535) hide show
  1. package/dist/api/access.d.ts +83 -0
  2. package/dist/api/access.js +77 -0
  3. package/dist/api/agent.d.ts +156 -0
  4. package/dist/api/agent.js +111 -0
  5. package/dist/api/browser.d.ts +90 -0
  6. package/dist/api/browser.js +102 -0
  7. package/dist/api/client.d.ts +53 -0
  8. package/dist/api/client.js +102 -0
  9. package/dist/api/common.d.ts +28 -0
  10. package/dist/api/common.js +16 -0
  11. package/dist/api/content.d.ts +195 -0
  12. package/dist/api/content.js +147 -0
  13. package/dist/api/execution.d.ts +84 -0
  14. package/dist/api/execution.js +73 -0
  15. package/dist/api/http.d.ts +19 -0
  16. package/dist/api/http.js +66 -0
  17. package/dist/api/index.d.ts +2330 -0
  18. package/dist/api/index.js +114 -0
  19. package/dist/api/infra.d.ts +2 -0
  20. package/dist/api/infra.js +2 -0
  21. package/dist/api/jobs.d.ts +2 -0
  22. package/dist/api/jobs.js +2 -0
  23. package/dist/api/layout.d.ts +2 -0
  24. package/dist/api/layout.js +2 -0
  25. package/dist/api/library-edit.d.ts +3 -0
  26. package/dist/api/library-edit.js +3 -0
  27. package/dist/api/library-manifest.d.ts +2 -0
  28. package/dist/api/library-manifest.js +2 -0
  29. package/dist/api/note-character-plan.d.ts +2 -0
  30. package/dist/api/note-character-plan.js +2 -0
  31. package/dist/api/note-editing.d.ts +2 -0
  32. package/dist/api/note-editing.js +2 -0
  33. package/dist/api/note-edits.d.ts +21 -0
  34. package/dist/api/note-edits.js +10 -0
  35. package/dist/api/note-events.d.ts +5 -0
  36. package/dist/api/note-events.js +11 -0
  37. package/dist/api/note-files.d.ts +75 -0
  38. package/dist/api/note-files.js +65 -0
  39. package/dist/api/note-html-read.d.ts +2 -0
  40. package/dist/api/note-html-read.js +2 -0
  41. package/dist/api/note-html.d.ts +2 -0
  42. package/dist/api/note-html.js +2 -0
  43. package/dist/api/note-toc.d.ts +2 -0
  44. package/dist/api/note-toc.js +2 -0
  45. package/dist/api/notes.d.ts +304 -0
  46. package/dist/api/notes.js +181 -0
  47. package/dist/api/open-resources.d.ts +27 -0
  48. package/dist/api/open-resources.js +102 -0
  49. package/dist/api/ownership.d.ts +12 -0
  50. package/dist/api/ownership.js +24 -0
  51. package/dist/api/platform.d.ts +83 -0
  52. package/dist/api/platform.js +56 -0
  53. package/dist/api/presigned-transfer.d.ts +2 -0
  54. package/dist/api/presigned-transfer.js +2 -0
  55. package/dist/api/registered-runs.d.ts +48 -0
  56. package/dist/api/registered-runs.js +33 -0
  57. package/dist/api/sessions.d.ts +299 -0
  58. package/dist/api/sessions.js +105 -0
  59. package/dist/api/storage.d.ts +46 -0
  60. package/dist/api/storage.js +34 -0
  61. package/dist/api/streams.d.ts +18 -0
  62. package/dist/api/streams.js +70 -0
  63. package/dist/api/vault.d.ts +93 -0
  64. package/dist/api/vault.js +79 -0
  65. package/dist/api/workspace.d.ts +180 -0
  66. package/dist/api/workspace.js +146 -0
  67. package/dist/cli/agent-identity.d.ts +4 -0
  68. package/dist/cli/agent-identity.js +21 -0
  69. package/dist/cli/agents/identity.d.ts +50 -0
  70. package/dist/cli/agents/identity.js +105 -0
  71. package/dist/cli/agents/index.d.ts +31 -0
  72. package/dist/cli/agents/index.js +580 -0
  73. package/dist/cli/agents/manage.d.ts +43 -0
  74. package/dist/cli/agents/manage.js +376 -0
  75. package/dist/cli/agents/spec.d.ts +104 -0
  76. package/dist/cli/agents/spec.js +280 -0
  77. package/dist/cli/agents/web.d.ts +7 -0
  78. package/dist/cli/agents/web.js +109 -0
  79. package/dist/cli/artifact/incremental.d.ts +21 -0
  80. package/dist/cli/artifact/incremental.js +80 -0
  81. package/dist/cli/artifact/index.d.ts +52 -0
  82. package/dist/cli/artifact/index.js +405 -0
  83. package/dist/cli/artifact/meta.d.ts +69 -0
  84. package/dist/cli/artifact/meta.js +189 -0
  85. package/dist/cli/auth/commands.d.ts +29 -0
  86. package/dist/cli/auth/commands.js +327 -0
  87. package/dist/cli/auth/constants.d.ts +13 -0
  88. package/dist/cli/auth/constants.js +18 -0
  89. package/dist/cli/auth/credentials.d.ts +37 -0
  90. package/dist/cli/auth/credentials.js +155 -0
  91. package/dist/cli/auth/device-flow.d.ts +32 -0
  92. package/dist/cli/auth/device-flow.js +154 -0
  93. package/dist/cli/auth/device-secret.d.ts +6 -0
  94. package/dist/cli/auth/device-secret.js +26 -0
  95. package/dist/cli/auth/machine.d.ts +15 -0
  96. package/dist/cli/auth/machine.js +126 -0
  97. package/dist/cli/auth/materialized.d.ts +32 -0
  98. package/dist/cli/auth/materialized.js +102 -0
  99. package/dist/cli/auth/migrate.d.ts +10 -0
  100. package/dist/cli/auth/migrate.js +75 -0
  101. package/dist/cli/client.d.ts +102 -0
  102. package/dist/cli/client.js +206 -0
  103. package/dist/cli/collection-list.d.ts +3 -0
  104. package/dist/cli/collection-list.js +25 -0
  105. package/dist/cli/compat/ctx.d.ts +26 -0
  106. package/dist/cli/compat/ctx.js +76 -0
  107. package/dist/cli/compat/dreamdb-wasm-embedded.d.ts +2 -0
  108. package/dist/cli/compat/dreamdb-wasm-embedded.js +8 -0
  109. package/dist/cli/compat/dreamdb-wasm.d.ts +1 -0
  110. package/dist/cli/compat/dreamdb-wasm.js +26 -0
  111. package/dist/cli/compat/dreamdb.d.ts +112 -0
  112. package/dist/cli/compat/dreamdb.js +219 -0
  113. package/dist/cli/compat/flags.d.ts +2 -0
  114. package/dist/cli/compat/flags.js +13 -0
  115. package/dist/cli/compat/http.d.ts +23 -0
  116. package/dist/cli/compat/http.js +137 -0
  117. package/dist/cli/compat/presignedTransfer.d.ts +139 -0
  118. package/dist/cli/compat/presignedTransfer.js +580 -0
  119. package/dist/cli/compat/s3-backend.d.ts +73 -0
  120. package/dist/cli/compat/s3-backend.js +132 -0
  121. package/dist/cli/config.d.ts +22 -0
  122. package/dist/cli/config.js +96 -0
  123. package/dist/cli/connection/dto.d.ts +159 -0
  124. package/dist/cli/connection/dto.js +497 -0
  125. package/dist/cli/connection/index.d.ts +50 -0
  126. package/dist/cli/connection/index.js +413 -0
  127. package/dist/cli/connection/oauth.d.ts +23 -0
  128. package/dist/cli/connection/oauth.js +290 -0
  129. package/dist/cli/connection/write.d.ts +47 -0
  130. package/dist/cli/connection/write.js +573 -0
  131. package/dist/cli/create/index.d.ts +19 -0
  132. package/dist/cli/create/index.js +209 -0
  133. package/dist/cli/declare/index.d.ts +29 -0
  134. package/dist/cli/declare/index.js +304 -0
  135. package/dist/cli/delete/index.d.ts +18 -0
  136. package/dist/cli/delete/index.js +232 -0
  137. package/dist/cli/download/index.d.ts +9 -0
  138. package/dist/cli/download/index.js +128 -0
  139. package/dist/cli/env/compose.d.ts +88 -0
  140. package/dist/cli/env/compose.js +402 -0
  141. package/dist/cli/env/index.d.ts +176 -0
  142. package/dist/cli/env/index.js +1011 -0
  143. package/dist/cli/experiments/index.d.ts +11 -0
  144. package/dist/cli/experiments/index.js +168 -0
  145. package/dist/cli/glob.d.ts +1 -0
  146. package/dist/cli/glob.js +45 -0
  147. package/dist/cli/graphql-helpers.d.ts +23 -0
  148. package/dist/cli/graphql-helpers.js +42 -0
  149. package/dist/cli/graphql.d.ts +10 -0
  150. package/dist/cli/graphql.js +47 -0
  151. package/dist/cli/help-examples.generated.d.ts +1 -0
  152. package/dist/cli/help-examples.generated.js +192 -0
  153. package/dist/cli/helpers.d.ts +8 -0
  154. package/dist/cli/helpers.js +106 -0
  155. package/dist/cli/hosts/api.d.ts +29 -0
  156. package/dist/cli/hosts/api.js +54 -0
  157. package/dist/cli/hosts/bootstrap-source.d.ts +1 -0
  158. package/dist/cli/hosts/bootstrap-source.js +2 -0
  159. package/dist/cli/hosts/catalog.d.ts +26 -0
  160. package/dist/cli/hosts/catalog.js +55 -0
  161. package/dist/cli/hosts/config.d.ts +45 -0
  162. package/dist/cli/hosts/config.js +179 -0
  163. package/dist/cli/hosts/credentials.d.ts +19 -0
  164. package/dist/cli/hosts/credentials.js +173 -0
  165. package/dist/cli/hosts/enroll.d.ts +17 -0
  166. package/dist/cli/hosts/enroll.js +109 -0
  167. package/dist/cli/hosts/enrollments.d.ts +25 -0
  168. package/dist/cli/hosts/enrollments.js +54 -0
  169. package/dist/cli/hosts/index.d.ts +6 -0
  170. package/dist/cli/hosts/index.js +279 -0
  171. package/dist/cli/hosts/inventory.d.ts +40 -0
  172. package/dist/cli/hosts/inventory.js +91 -0
  173. package/dist/cli/hosts/lifecycle.d.ts +15 -0
  174. package/dist/cli/hosts/lifecycle.js +108 -0
  175. package/dist/cli/hosts/metrics-source.d.ts +12 -0
  176. package/dist/cli/hosts/metrics-source.js +89 -0
  177. package/dist/cli/hosts/observations.d.ts +39 -0
  178. package/dist/cli/hosts/observations.js +102 -0
  179. package/dist/cli/hosts/remote.d.ts +5 -0
  180. package/dist/cli/hosts/remote.js +66 -0
  181. package/dist/cli/hosts/ssh.d.ts +63 -0
  182. package/dist/cli/hosts/ssh.js +276 -0
  183. package/dist/cli/index.d.ts +1 -0
  184. package/dist/cli/index.js +288 -0
  185. package/dist/cli/infra/api.d.ts +95 -0
  186. package/dist/cli/infra/api.js +291 -0
  187. package/dist/cli/infra/index.d.ts +5 -0
  188. package/dist/cli/infra/index.js +102 -0
  189. package/dist/cli/infra/move.d.ts +15 -0
  190. package/dist/cli/infra/move.js +123 -0
  191. package/dist/cli/infra/transfer.d.ts +15 -0
  192. package/dist/cli/infra/transfer.js +280 -0
  193. package/dist/cli/jobs/api.d.ts +69 -0
  194. package/dist/cli/jobs/api.js +121 -0
  195. package/dist/cli/jobs/index.d.ts +5 -0
  196. package/dist/cli/jobs/index.js +140 -0
  197. package/dist/cli/lakeshore/index.d.ts +98 -0
  198. package/dist/cli/lakeshore/index.js +502 -0
  199. package/dist/cli/launch/index.d.ts +43 -0
  200. package/dist/cli/launch/index.js +270 -0
  201. package/dist/cli/layout/index.d.ts +2 -0
  202. package/dist/cli/layout/index.js +44 -0
  203. package/dist/cli/layout/transport.d.ts +12 -0
  204. package/dist/cli/layout/transport.js +70 -0
  205. package/dist/cli/library/add.d.ts +60 -0
  206. package/dist/cli/library/add.js +348 -0
  207. package/dist/cli/library/cache.d.ts +26 -0
  208. package/dist/cli/library/cache.js +88 -0
  209. package/dist/cli/library/config.d.ts +75 -0
  210. package/dist/cli/library/config.js +198 -0
  211. package/dist/cli/library/digest.d.ts +5 -0
  212. package/dist/cli/library/digest.js +19 -0
  213. package/dist/cli/library/discover.d.ts +87 -0
  214. package/dist/cli/library/discover.js +534 -0
  215. package/dist/cli/library/freshness.d.ts +35 -0
  216. package/dist/cli/library/freshness.js +109 -0
  217. package/dist/cli/library/generation.d.ts +35 -0
  218. package/dist/cli/library/generation.js +211 -0
  219. package/dist/cli/library/index.d.ts +2 -0
  220. package/dist/cli/library/index.js +36 -0
  221. package/dist/cli/library/info.d.ts +69 -0
  222. package/dist/cli/library/info.js +311 -0
  223. package/dist/cli/library/list.d.ts +33 -0
  224. package/dist/cli/library/list.js +86 -0
  225. package/dist/cli/library/manifest.d.ts +81 -0
  226. package/dist/cli/library/manifest.js +200 -0
  227. package/dist/cli/library/manifestCache.d.ts +45 -0
  228. package/dist/cli/library/manifestCache.js +169 -0
  229. package/dist/cli/library/pull.d.ts +30 -0
  230. package/dist/cli/library/pull.js +438 -0
  231. package/dist/cli/library/push.d.ts +72 -0
  232. package/dist/cli/library/push.js +642 -0
  233. package/dist/cli/library/rm.d.ts +31 -0
  234. package/dist/cli/library/rm.js +200 -0
  235. package/dist/cli/library/search.d.ts +18 -0
  236. package/dist/cli/library/search.js +181 -0
  237. package/dist/cli/library/stat.d.ts +15 -0
  238. package/dist/cli/library/stat.js +127 -0
  239. package/dist/cli/library/tools.d.ts +104 -0
  240. package/dist/cli/library/tools.js +163 -0
  241. package/dist/cli/library/wire.d.ts +47 -0
  242. package/dist/cli/library/wire.js +120 -0
  243. package/dist/cli/list/index.d.ts +26 -0
  244. package/dist/cli/list/index.js +256 -0
  245. package/dist/cli/notes/character-plan.d.ts +22 -0
  246. package/dist/cli/notes/character-plan.js +232 -0
  247. package/dist/cli/notes/document.d.ts +73 -0
  248. package/dist/cli/notes/document.js +306 -0
  249. package/dist/cli/notes/edit-commands.d.ts +106 -0
  250. package/dist/cli/notes/edit-commands.js +623 -0
  251. package/dist/cli/notes/editing.d.ts +81 -0
  252. package/dist/cli/notes/editing.js +305 -0
  253. package/dist/cli/notes/events.d.ts +36 -0
  254. package/dist/cli/notes/events.js +54 -0
  255. package/dist/cli/notes/files-commands.d.ts +120 -0
  256. package/dist/cli/notes/files-commands.js +554 -0
  257. package/dist/cli/notes/html-read.d.ts +9 -0
  258. package/dist/cli/notes/html-read.js +90 -0
  259. package/dist/cli/notes/html.d.ts +73 -0
  260. package/dist/cli/notes/html.js +381 -0
  261. package/dist/cli/notes/index.d.ts +123 -0
  262. package/dist/cli/notes/index.js +1303 -0
  263. package/dist/cli/notes/linger.d.ts +59 -0
  264. package/dist/cli/notes/linger.js +339 -0
  265. package/dist/cli/notes/media-commands.d.ts +5 -0
  266. package/dist/cli/notes/media-commands.js +51 -0
  267. package/dist/cli/notes/move-command.d.ts +83 -0
  268. package/dist/cli/notes/move-command.js +259 -0
  269. package/dist/cli/notes/rm-command.d.ts +22 -0
  270. package/dist/cli/notes/rm-command.js +110 -0
  271. package/dist/cli/notes/select-command.d.ts +12 -0
  272. package/dist/cli/notes/select-command.js +84 -0
  273. package/dist/cli/notes/suggest-diff.d.ts +56 -0
  274. package/dist/cli/notes/suggest-diff.js +311 -0
  275. package/dist/cli/notes/toc.d.ts +38 -0
  276. package/dist/cli/notes/toc.js +144 -0
  277. package/dist/cli/notes/transfer-command.d.ts +6 -0
  278. package/dist/cli/notes/transfer-command.js +9 -0
  279. package/dist/cli/notes/version-commands.d.ts +19 -0
  280. package/dist/cli/notes/version-commands.js +178 -0
  281. package/dist/cli/nymph/index.d.ts +74 -0
  282. package/dist/cli/nymph/index.js +349 -0
  283. package/dist/cli/org/index.d.ts +34 -0
  284. package/dist/cli/org/index.js +341 -0
  285. package/dist/cli/ownership/index.d.ts +12 -0
  286. package/dist/cli/ownership/index.js +122 -0
  287. package/dist/cli/ownership/metadata-transfer.d.ts +20 -0
  288. package/dist/cli/ownership/metadata-transfer.js +159 -0
  289. package/dist/cli/page/index.d.ts +58 -0
  290. package/dist/cli/page/index.js +387 -0
  291. package/dist/cli/pipeline/index.d.ts +69 -0
  292. package/dist/cli/pipeline/index.js +604 -0
  293. package/dist/cli/progress.d.ts +60 -0
  294. package/dist/cli/progress.js +276 -0
  295. package/dist/cli/project/attachments.d.ts +10 -0
  296. package/dist/cli/project/attachments.js +39 -0
  297. package/dist/cli/project/grants.d.ts +10 -0
  298. package/dist/cli/project/grants.js +39 -0
  299. package/dist/cli/project/index.d.ts +8 -0
  300. package/dist/cli/project/index.js +92 -0
  301. package/dist/cli/project/move.d.ts +57 -0
  302. package/dist/cli/project/move.js +242 -0
  303. package/dist/cli/project/output.d.ts +2 -0
  304. package/dist/cli/project/output.js +29 -0
  305. package/dist/cli/project/stream.d.ts +55 -0
  306. package/dist/cli/project/stream.js +207 -0
  307. package/dist/cli/project/transfer-preview.d.ts +8 -0
  308. package/dist/cli/project/transfer-preview.js +10 -0
  309. package/dist/cli/prompt.d.ts +1 -0
  310. package/dist/cli/prompt.js +17 -0
  311. package/dist/cli/provider/dreamdir.d.ts +52 -0
  312. package/dist/cli/provider/dreamdir.js +138 -0
  313. package/dist/cli/provider/index.d.ts +4 -0
  314. package/dist/cli/provider/index.js +419 -0
  315. package/dist/cli/provider/jump-worker.d.ts +9 -0
  316. package/dist/cli/provider/jump-worker.js +141 -0
  317. package/dist/cli/provider/lifecycle.d.ts +149 -0
  318. package/dist/cli/provider/lifecycle.js +1390 -0
  319. package/dist/cli/provider/machine.d.ts +17 -0
  320. package/dist/cli/provider/machine.js +116 -0
  321. package/dist/cli/provider/ssh.d.ts +105 -0
  322. package/dist/cli/provider/ssh.js +305 -0
  323. package/dist/cli/provider/terraform.d.ts +140 -0
  324. package/dist/cli/provider/terraform.js +288 -0
  325. package/dist/cli/providers/index.d.ts +18 -0
  326. package/dist/cli/providers/index.js +422 -0
  327. package/dist/cli/python.d.ts +61 -0
  328. package/dist/cli/python.js +255 -0
  329. package/dist/cli/queues/index.d.ts +33 -0
  330. package/dist/cli/queues/index.js +248 -0
  331. package/dist/cli/queues/slurm.d.ts +10 -0
  332. package/dist/cli/queues/slurm.js +134 -0
  333. package/dist/cli/resources.d.ts +72 -0
  334. package/dist/cli/resources.js +137 -0
  335. package/dist/cli/run/index.d.ts +15 -0
  336. package/dist/cli/run/index.js +163 -0
  337. package/dist/cli/run/input.d.ts +34 -0
  338. package/dist/cli/run/input.js +135 -0
  339. package/dist/cli/run/recovery.d.ts +2 -0
  340. package/dist/cli/run/recovery.js +18 -0
  341. package/dist/cli/run/setup.d.ts +3 -0
  342. package/dist/cli/run/setup.js +62 -0
  343. package/dist/cli/runconfig/index.d.ts +12 -0
  344. package/dist/cli/runconfig/index.js +130 -0
  345. package/dist/cli/runnable/index.d.ts +35 -0
  346. package/dist/cli/runnable/index.js +575 -0
  347. package/dist/cli/runnable/path.d.ts +115 -0
  348. package/dist/cli/runnable/path.js +288 -0
  349. package/dist/cli/runnable/run.d.ts +91 -0
  350. package/dist/cli/runnable/run.js +239 -0
  351. package/dist/cli/runnable/upload.d.ts +43 -0
  352. package/dist/cli/runnable/upload.js +342 -0
  353. package/dist/cli/runnable/worker.d.ts +1 -0
  354. package/dist/cli/runnable/worker.js +44 -0
  355. package/dist/cli/schemas/workflow-spec.schema.json +335 -0
  356. package/dist/cli/self-update/index.d.ts +5 -0
  357. package/dist/cli/self-update/index.js +107 -0
  358. package/dist/cli/self-update/install.d.ts +60 -0
  359. package/dist/cli/self-update/install.js +428 -0
  360. package/dist/cli/self-update/paths.d.ts +40 -0
  361. package/dist/cli/self-update/paths.js +87 -0
  362. package/dist/cli/self-update/releases.d.ts +41 -0
  363. package/dist/cli/self-update/releases.js +153 -0
  364. package/dist/cli/self-update/settings.d.ts +16 -0
  365. package/dist/cli/self-update/settings.js +68 -0
  366. package/dist/cli/self-update/update.d.ts +18 -0
  367. package/dist/cli/self-update/update.js +241 -0
  368. package/dist/cli/service-accounts/index.d.ts +3 -0
  369. package/dist/cli/service-accounts/index.js +149 -0
  370. package/dist/cli/session-affiliation.d.ts +26 -0
  371. package/dist/cli/session-affiliation.js +135 -0
  372. package/dist/cli/sessions/affiliation.d.ts +8 -0
  373. package/dist/cli/sessions/affiliation.js +66 -0
  374. package/dist/cli/sessions/api.d.ts +55 -0
  375. package/dist/cli/sessions/api.js +88 -0
  376. package/dist/cli/sessions/control.d.ts +6 -0
  377. package/dist/cli/sessions/control.js +159 -0
  378. package/dist/cli/sessions/conversation.d.ts +15 -0
  379. package/dist/cli/sessions/conversation.js +118 -0
  380. package/dist/cli/sessions/index.d.ts +2 -0
  381. package/dist/cli/sessions/index.js +209 -0
  382. package/dist/cli/sessions/managed.d.ts +39 -0
  383. package/dist/cli/sessions/managed.js +63 -0
  384. package/dist/cli/sessions/redaction.d.ts +2 -0
  385. package/dist/cli/sessions/redaction.js +11 -0
  386. package/dist/cli/sessions/runner/exec.d.ts +108 -0
  387. package/dist/cli/sessions/runner/exec.js +335 -0
  388. package/dist/cli/sessions/runner/journal.d.ts +26 -0
  389. package/dist/cli/sessions/runner/journal.js +49 -0
  390. package/dist/cli/sessions/runner/native.d.ts +48 -0
  391. package/dist/cli/sessions/runner/native.js +170 -0
  392. package/dist/cli/sessions/runner/pod.d.ts +30 -0
  393. package/dist/cli/sessions/runner/pod.js +129 -0
  394. package/dist/cli/sessions/runner/serve.d.ts +85 -0
  395. package/dist/cli/sessions/runner/serve.js +558 -0
  396. package/dist/cli/sessions/sync.d.ts +47 -0
  397. package/dist/cli/sessions/sync.js +80 -0
  398. package/dist/cli/sessions/transport.d.ts +14 -0
  399. package/dist/cli/sessions/transport.js +116 -0
  400. package/dist/cli/share.d.ts +15 -0
  401. package/dist/cli/share.js +139 -0
  402. package/dist/cli/skill/catalog.d.ts +141 -0
  403. package/dist/cli/skill/catalog.js +442 -0
  404. package/dist/cli/skill/files.d.ts +89 -0
  405. package/dist/cli/skill/files.js +264 -0
  406. package/dist/cli/skill/index.d.ts +268 -0
  407. package/dist/cli/skill/index.js +1216 -0
  408. package/dist/cli/skill/manifest.d.ts +30 -0
  409. package/dist/cli/skill/manifest.js +101 -0
  410. package/dist/cli/skill/prefs.d.ts +9 -0
  411. package/dist/cli/skill/prefs.js +32 -0
  412. package/dist/cli/skill/reminders.d.ts +15 -0
  413. package/dist/cli/skill/reminders.js +105 -0
  414. package/dist/cli/skill/tar.d.ts +17 -0
  415. package/dist/cli/skill/tar.js +195 -0
  416. package/dist/cli/snapshot/index.d.ts +24 -0
  417. package/dist/cli/snapshot/index.js +146 -0
  418. package/dist/cli/source/access.d.ts +45 -0
  419. package/dist/cli/source/access.js +563 -0
  420. package/dist/cli/source/control.d.ts +103 -0
  421. package/dist/cli/source/control.js +546 -0
  422. package/dist/cli/source/delete.d.ts +89 -0
  423. package/dist/cli/source/delete.js +463 -0
  424. package/dist/cli/source/index.d.ts +288 -0
  425. package/dist/cli/source/index.js +1348 -0
  426. package/dist/cli/source/share.d.ts +65 -0
  427. package/dist/cli/source/share.js +530 -0
  428. package/dist/cli/source/upload.d.ts +62 -0
  429. package/dist/cli/source/upload.js +258 -0
  430. package/dist/cli/source/write.d.ts +77 -0
  431. package/dist/cli/source/write.js +335 -0
  432. package/dist/cli/spawn.d.ts +28 -0
  433. package/dist/cli/spawn.js +81 -0
  434. package/dist/cli/target.d.ts +22 -0
  435. package/dist/cli/target.js +85 -0
  436. package/dist/cli/tasks/index.d.ts +38 -0
  437. package/dist/cli/tasks/index.js +365 -0
  438. package/dist/cli/team/index.d.ts +37 -0
  439. package/dist/cli/team/index.js +407 -0
  440. package/dist/cli/telemetry.d.ts +23 -0
  441. package/dist/cli/telemetry.js +262 -0
  442. package/dist/cli/telemetryJournal.d.ts +26 -0
  443. package/dist/cli/telemetryJournal.js +104 -0
  444. package/dist/cli/update/index.d.ts +21 -0
  445. package/dist/cli/update/index.js +284 -0
  446. package/dist/cli/upload/index.d.ts +11 -0
  447. package/dist/cli/upload/index.js +261 -0
  448. package/dist/cli/upload/kinds.d.ts +10 -0
  449. package/dist/cli/upload/kinds.js +85 -0
  450. package/dist/cli/upload/multipart.d.ts +21 -0
  451. package/dist/cli/upload/multipart.js +248 -0
  452. package/dist/cli/vault/affected-preview.d.ts +15 -0
  453. package/dist/cli/vault/affected-preview.js +38 -0
  454. package/dist/cli/vault/cloud.d.ts +55 -0
  455. package/dist/cli/vault/cloud.js +287 -0
  456. package/dist/cli/vault/format.d.ts +18 -0
  457. package/dist/cli/vault/format.js +104 -0
  458. package/dist/cli/vault/hostCredentials.d.ts +21 -0
  459. package/dist/cli/vault/hostCredentials.js +71 -0
  460. package/dist/cli/vault/hostSupersessions.d.ts +18 -0
  461. package/dist/cli/vault/hostSupersessions.js +68 -0
  462. package/dist/cli/vault/import.d.ts +3 -0
  463. package/dist/cli/vault/import.js +79 -0
  464. package/dist/cli/vault/index.d.ts +14 -0
  465. package/dist/cli/vault/index.js +225 -0
  466. package/dist/cli/vault/keys.d.ts +5 -0
  467. package/dist/cli/vault/keys.js +165 -0
  468. package/dist/cli/vault/kms.d.ts +6 -0
  469. package/dist/cli/vault/kms.js +169 -0
  470. package/dist/cli/vault/list.d.ts +13 -0
  471. package/dist/cli/vault/list.js +60 -0
  472. package/dist/cli/vault/listView.d.ts +21 -0
  473. package/dist/cli/vault/listView.js +123 -0
  474. package/dist/cli/vault/managementMetadata.d.ts +2 -0
  475. package/dist/cli/vault/managementMetadata.js +23 -0
  476. package/dist/cli/vault/mutations.d.ts +8 -0
  477. package/dist/cli/vault/mutations.js +151 -0
  478. package/dist/cli/vault/otp.d.ts +6 -0
  479. package/dist/cli/vault/otp.js +62 -0
  480. package/dist/cli/vault/otpIntent.d.ts +23 -0
  481. package/dist/cli/vault/otpIntent.js +76 -0
  482. package/dist/cli/vault/passImport.d.ts +25 -0
  483. package/dist/cli/vault/passImport.js +129 -0
  484. package/dist/cli/vault/passOtp.d.ts +51 -0
  485. package/dist/cli/vault/passOtp.js +101 -0
  486. package/dist/cli/vault/passStore.d.ts +26 -0
  487. package/dist/cli/vault/passStore.js +134 -0
  488. package/dist/cli/vault/passwordCommand.d.ts +39 -0
  489. package/dist/cli/vault/passwordCommand.js +101 -0
  490. package/dist/cli/vault/passwordProbe.d.ts +27 -0
  491. package/dist/cli/vault/passwordProbe.js +282 -0
  492. package/dist/cli/vault/passwordRotation.d.ts +9 -0
  493. package/dist/cli/vault/passwordRotation.js +273 -0
  494. package/dist/cli/vault/rotationApi.d.ts +13 -0
  495. package/dist/cli/vault/rotationApi.js +58 -0
  496. package/dist/cli/vault/rotationCommand.d.ts +2 -0
  497. package/dist/cli/vault/rotationCommand.js +75 -0
  498. package/dist/cli/vault/rotationEngine.d.ts +19 -0
  499. package/dist/cli/vault/rotationEngine.js +65 -0
  500. package/dist/cli/vault/rotationHelperSource.d.ts +2 -0
  501. package/dist/cli/vault/rotationHelperSource.js +3 -0
  502. package/dist/cli/vault/rotationInput.d.ts +11 -0
  503. package/dist/cli/vault/rotationInput.js +48 -0
  504. package/dist/cli/vault/rotationJournal.d.ts +16 -0
  505. package/dist/cli/vault/rotationJournal.js +183 -0
  506. package/dist/cli/vault/rotationKeys.d.ts +4 -0
  507. package/dist/cli/vault/rotationKeys.js +48 -0
  508. package/dist/cli/vault/rotationPrepare.d.ts +17 -0
  509. package/dist/cli/vault/rotationPrepare.js +108 -0
  510. package/dist/cli/vault/rotationRemote.d.ts +33 -0
  511. package/dist/cli/vault/rotationRemote.js +156 -0
  512. package/dist/cli/vault/rotationState.d.ts +42 -0
  513. package/dist/cli/vault/rotationState.js +115 -0
  514. package/dist/cli/vault/rotationTransport.d.ts +18 -0
  515. package/dist/cli/vault/rotationTransport.js +71 -0
  516. package/dist/cli/vault/sshSource.d.ts +18 -0
  517. package/dist/cli/vault/sshSource.js +196 -0
  518. package/dist/cli/vault/sshSync.d.ts +17 -0
  519. package/dist/cli/vault/sshSync.js +224 -0
  520. package/dist/cli/vault/sshTransfer.d.ts +22 -0
  521. package/dist/cli/vault/sshTransfer.js +140 -0
  522. package/dist/cli/vault/terraformState.d.ts +66 -0
  523. package/dist/cli/vault/terraformState.js +252 -0
  524. package/dist/cli/vault/terraformStateCommand.d.ts +2 -0
  525. package/dist/cli/vault/terraformStateCommand.js +61 -0
  526. package/dist/cli/vault/tree.d.ts +43 -0
  527. package/dist/cli/vault/tree.js +292 -0
  528. package/dist/cli/version.d.ts +1 -0
  529. package/dist/cli/version.js +9 -0
  530. package/dist/cli/workflow/index.d.ts +76 -0
  531. package/dist/cli/workflow/index.js +826 -0
  532. package/dist/cli/workflow/validate.d.ts +19 -0
  533. package/dist/cli/workflow/validate.js +353 -0
  534. package/dist/package.json +1 -0
  535. package/package.json +28 -10
@@ -0,0 +1,642 @@
1
+ // `dreamlake library push <dir>` — publish an Asset Library from a PLAIN
2
+ // source directory.
3
+ //
4
+ // The authoring model: the user's input is their files plus one optional
5
+ // dreamlake.yml. There is no assets.json to author or maintain. At push the
6
+ // CLI discovers assets by convention (or the yml's discover globs), overlays
7
+ // yml metadata, hashes through the disposable cache, and GENERATES the wire
8
+ // manifest — plus optional thumbnails (--thumbnails) and CLIP vectors
9
+ // (--embed) — into a cache directory under ~/.dreamlake, never into the
10
+ // source tree. User files upload at their own paths; generated artifacts
11
+ // upload under the reserved `.dreamlake/` prefix; the manifest itself goes
12
+ // to `.dreamlake/manifest.json`.
13
+ //
14
+ // A library has NO versioning: the server keeps exactly what the last push
15
+ // registered, and `revision` is a CAS counter, not an address. A push is
16
+ // therefore a reconciliation:
17
+ //
18
+ // 1. read the REMOTE manifest (the /manifest route falls back to the
19
+ // legacy assets.json location transparently) and diff USER files by
20
+ // (path, sha256) — only new or changed files upload, and the generated
21
+ // manifest always does, because registering serves whatever manifest
22
+ // was last uploaded;
23
+ // 2. platform artifacts a previous push generated are CARRIED FORWARD when
24
+ // not regenerated (wire.ts) — their objects are already in storage and
25
+ // stay listed, so reconcile keeps them;
26
+ // 3. upload through server-minted presigned batches (≤1000 files and
27
+ // ≤10 GiB per authorization call), executed by the shared transfer
28
+ // executor;
29
+ // 4. register with the revision this push diffed against. The server
30
+ // reconciles REMOVED files away at register — this CLI never deletes —
31
+ // and answers 409 when another push advanced the revision first: re-read
32
+ // and retry ONCE, then hand the race to the user.
33
+ import { libraryGenerationRequired, publishLibraryGeneration, stageCarriedGenerationFiles } from './generation.js';
34
+ import { existsSync, mkdirSync, statSync, writeFileSync } from "node:fs";
35
+ import path from "node:path";
36
+ import { emitJson, fail, humanSize, ok, renderTable, warn } from "../helpers.js";
37
+ import { resolveCtx } from "../compat/ctx.js";
38
+ import { errorMessage, jsonRequest, requireNamespace, requireToken } from "../compat/http.js";
39
+ import { assertPresignedTransfer, executePresignedBatch, isRecord, } from "../compat/presignedTransfer.js";
40
+ import { BarProgress } from "../progress.js";
41
+ import { DREAMLAKE_YML, loadLibraryYml } from "./config.js";
42
+ import { discoverAssets } from "./discover.js";
43
+ import { readLastRegisteredRevision, writeLastRegisteredRevision } from "./freshness.js";
44
+ import { hashFiles, pushCacheDir } from "./cache.js";
45
+ import { GENERATED_VECTORS_F32, GENERATED_VECTORS_JSON, MANIFEST_PATH_LEGACY, MANIFEST_PATH_PRIMARY, assertLibraryManifest, diffFileMaps, manifestFileMap, } from "./manifest.js";
46
+ import { fetchManifestCached } from "./manifestCache.js";
47
+ import { EMBED_MODULE, RENDER_MODULE, describeEmbedModel, embedModelWarning, findAssetTool, runEmbed, runRenderThumbnails, } from "./tools.js";
48
+ import { buildWireManifest, carryForwardGenerated, thumbnailGeneratedPath } from "./wire.js";
49
+ // Server-side mirror: keep byte-identical with the library routes' name rule.
50
+ export const LIBRARY_NAME_RE = /^[a-z0-9][a-z0-9._-]{0,63}$/;
51
+ /** The per-authorization-call limits the server enforces with a 400. */
52
+ export const MAX_BATCH_FILES = 1000;
53
+ export const MAX_BATCH_BYTES = 10 * 1024 * 1024 * 1024;
54
+ const PUSH_CONCURRENCY = 4;
55
+ /**
56
+ * Split the upload set into authorization-call batches: at most `maxFiles`
57
+ * files AND `maxBytes` total per call, order preserved. A single file past
58
+ * `maxBytes` can never fit any batch — that is a refusal, not a batch of one,
59
+ * because the server would 400 it and the failure should carry the filename.
60
+ */
61
+ export function planBatches(files, maxFiles = MAX_BATCH_FILES, maxBytes = MAX_BATCH_BYTES) {
62
+ const batches = [];
63
+ let batch = [];
64
+ let bytes = 0;
65
+ for (const f of files) {
66
+ if (f.size > maxBytes) {
67
+ throw new Error(`'${f.relativePath}' is ${f.size} bytes — larger than the ${maxBytes}-byte per-call limit`);
68
+ }
69
+ if (batch.length >= maxFiles || (batch.length > 0 && bytes + f.size > maxBytes)) {
70
+ batches.push(batch);
71
+ batch = [];
72
+ bytes = 0;
73
+ }
74
+ batch.push(f);
75
+ bytes += f.size;
76
+ }
77
+ if (batch.length > 0)
78
+ batches.push(batch);
79
+ return batches;
80
+ }
81
+ function libraryBad(what) {
82
+ throw new Error(`incompatible library API response: ${what}`);
83
+ }
84
+ /**
85
+ * Check one authorization against the batch it answers. The envelope here is
86
+ * the library route's — positional, no canonicalPath (the server owns the
87
+ * prefix outright) — and each file's transfer plan goes through the shared
88
+ * validator before a byte moves.
89
+ */
90
+ export function assertLibraryAuthorization(res, request) {
91
+ if (!isRecord(res))
92
+ libraryBad("upload-authorizations: expected an object");
93
+ if (res.mode !== "s3-presigned-batch")
94
+ libraryBad("upload-authorizations: unexpected mode");
95
+ if (typeof res.expiresAt !== "string" || Number.isNaN(Date.parse(res.expiresAt))) {
96
+ libraryBad("upload-authorizations: missing or unreadable expiresAt");
97
+ }
98
+ if (!Array.isArray(res.files) || res.files.length !== request.files.length) {
99
+ libraryBad("upload-authorizations: the answer does not cover the request");
100
+ }
101
+ res.files.forEach((granted, i) => {
102
+ const want = request.files[i];
103
+ const where = `upload-authorizations.files[${i}]`;
104
+ if (!isRecord(granted))
105
+ libraryBad(`${where}: expected an object`);
106
+ if (granted.relativePath !== want.relativePath) {
107
+ // Positional: a reordered answer would send each file under its
108
+ // neighbour's signature.
109
+ libraryBad(`${where}: expected ${want.relativePath}`);
110
+ }
111
+ if (granted.size !== want.size)
112
+ libraryBad(`${where}: size does not match the request`);
113
+ assertPresignedTransfer(granted.transfer, want.size, where, libraryBad);
114
+ });
115
+ return res;
116
+ }
117
+ /**
118
+ * The render-job list for `--thumbnails`. One job per asset with something
119
+ * renderable; the entry PREFERS a robot-kind entryPoint file over a scene
120
+ * entry — the renderer frames a lone robot better than a full scene.
121
+ *
122
+ * Assets that already carry a USER thumbnail (yml `thumbnail:` or a shipped
123
+ * thumbnail/preview image auto-detected at discovery) are excluded: the user
124
+ * file always wins in the manifest, so rendering one would be wasted work.
125
+ */
126
+ export function buildRenderJobs(srcDir, assets) {
127
+ const jobs = [];
128
+ for (const a of assets) {
129
+ if (a.thumbnail)
130
+ continue;
131
+ let entryRel = a.entry;
132
+ if (a.entryPoints) {
133
+ const robot = Object.keys(a.entryPoints)
134
+ .sort()
135
+ .map((name) => a.entryPoints[name])
136
+ .find((ep) => ep.kind === "robot");
137
+ if (robot)
138
+ entryRel = robot.file;
139
+ }
140
+ if (!entryRel)
141
+ continue;
142
+ jobs.push({
143
+ id: a.id,
144
+ entry: path.resolve(srcDir, entryRel),
145
+ kind: a.kind,
146
+ ...(a.category ? { category: a.category } : {}),
147
+ });
148
+ }
149
+ return jobs;
150
+ }
151
+ export async function runLibraryPush(args, deps = {}) {
152
+ // 1) local: yml, discovery, name — all before any network I/O.
153
+ const srcDir = path.resolve(args.dir);
154
+ if (!existsSync(srcDir) || !statSync(srcDir).isDirectory()) {
155
+ fail(`not a directory: ${args.dir}`);
156
+ return 1;
157
+ }
158
+ if (args.visibility && args.visibility !== "public" && args.visibility !== "private") {
159
+ fail(`--visibility must be public or private (got '${args.visibility}')`);
160
+ return 1;
161
+ }
162
+ if (args.embed && !args.thumbnails) {
163
+ // Vectors embed the freshly rendered thumbnails; a remote render is not
164
+ // usable locally, so the pair must be generated in the same push.
165
+ fail("--embed needs --thumbnails in the same push (image vectors embed the fresh renders)");
166
+ return 1;
167
+ }
168
+ if (args.model && !args.embed) {
169
+ // --model only selects the embed encoder; accepting it silently without
170
+ // --embed would look like it did something.
171
+ fail("--model only applies to --embed (it selects the embedding encoder)");
172
+ return 1;
173
+ }
174
+ // Informational/diagnostic lines: stdout normally, stderr under --json so
175
+ // stdout carries exactly one JSON document.
176
+ const info = (line) => {
177
+ (args.json ? process.stderr : process.stdout).write(line);
178
+ };
179
+ const note = (line) => {
180
+ if (args.json)
181
+ process.stderr.write(`⚠ ${line}\n`);
182
+ else
183
+ warn(line);
184
+ };
185
+ let yml = null;
186
+ try {
187
+ yml = loadLibraryYml(srcDir)?.yml ?? null;
188
+ }
189
+ catch (e) {
190
+ fail(e instanceof Error ? e.message : String(e));
191
+ return 1;
192
+ }
193
+ if (existsSync(path.join(srcDir, MANIFEST_PATH_LEGACY))) {
194
+ note(`${MANIFEST_PATH_LEGACY} in the source directory is treated as a plain user file ` +
195
+ `(a stale importer artifact?) — the wire manifest is generated at push now`);
196
+ }
197
+ let assets;
198
+ try {
199
+ assets = discoverAssets(srcDir, yml);
200
+ }
201
+ catch (e) {
202
+ fail(e instanceof Error ? e.message : String(e));
203
+ return 1;
204
+ }
205
+ const name = args.library ?? path.basename(srcDir);
206
+ if (!LIBRARY_NAME_RE.test(name)) {
207
+ fail(`library name must match ^[a-z0-9][a-z0-9._-]{0,63}$ (got '${name}') — pass --library <name>`);
208
+ return 1;
209
+ }
210
+ // 2) hashes, through the cache. dreamlake.yml is a user file and rides in
211
+ // the closure so a pull → push round-trip keeps the metadata.
212
+ const includeYml = yml !== null;
213
+ const userPaths = new Set();
214
+ for (const a of assets)
215
+ for (const f of a.files)
216
+ userPaths.add(f);
217
+ if (includeYml)
218
+ userPaths.add(DREAMLAKE_YML);
219
+ let hashes;
220
+ try {
221
+ hashes = await hashFiles(srcDir, [...userPaths].sort(), {
222
+ verify: args.verify,
223
+ cacheFile: deps.hashCacheFile,
224
+ });
225
+ }
226
+ catch (e) {
227
+ fail(e instanceof Error ? e.message : String(e));
228
+ return 1;
229
+ }
230
+ const localUserMap = new Map([...hashes].map(([rel, h]) => [rel, { size: h.size, sha256: h.sha256 }]));
231
+ const ctx = resolveCtx(args);
232
+ const token = requireToken(ctx);
233
+ if (!token)
234
+ return 1;
235
+ const namespace = await requireNamespace(ctx, args.namespace);
236
+ if (!namespace)
237
+ return 1;
238
+ const base = `${ctx.remote}/namespaces/${encodeURIComponent(namespace)}/libraries/${encodeURIComponent(name)}`;
239
+ let generation = false;
240
+ try {
241
+ generation = await libraryGenerationRequired(base, token);
242
+ }
243
+ catch (error) {
244
+ fail(error instanceof Error ? error.message : String(error));
245
+ return 1;
246
+ }
247
+ // 3) remote state: the detail row's revision as the CAS token (404 ⇒ 0),
248
+ // read FIRST because it also keys the local manifest cache
249
+ // (manifestCache.ts) — then the manifest to diff against (404 ⇒ new;
250
+ // the route reads legacy-layout libraries transparently). An unchanged
251
+ // revision diffs against the cached copy without a download; --verify
252
+ // re-downloads it.
253
+ let expectedRevision = 0;
254
+ let detailRevision = null;
255
+ const detail = await jsonRequest("GET", base, token);
256
+ if (detail.status === 200) {
257
+ const rev = detail.body?.revision;
258
+ if (typeof rev === "number") {
259
+ expectedRevision = rev;
260
+ detailRevision = rev;
261
+ }
262
+ }
263
+ else if (detail.status !== 404) {
264
+ fail(`could not read the library → ${detail.status}: ${errorMessage(detail)}`);
265
+ return 1;
266
+ }
267
+ let remote = null;
268
+ const { res: remoteManifest } = await fetchManifestCached({
269
+ remote: ctx.remote,
270
+ namespace,
271
+ name,
272
+ token,
273
+ revision: detailRevision,
274
+ bypass: args.verify,
275
+ });
276
+ if (remoteManifest.status === 200) {
277
+ try {
278
+ remote = assertLibraryManifest(remoteManifest.body, "the remote manifest");
279
+ }
280
+ catch (e) {
281
+ fail(`could not read the remote manifest: ${e instanceof Error ? e.message : String(e)}`);
282
+ return 1;
283
+ }
284
+ }
285
+ else if (remoteManifest.status !== 404) {
286
+ fail(`could not read the remote manifest → ${remoteManifest.status}: ${errorMessage(remoteManifest)}`);
287
+ return 1;
288
+ }
289
+ // 4) the user-file diff, and what earlier pushes' artifacts survive.
290
+ const remoteUserMap = remote ? manifestFileMap(remote) : null;
291
+ const diff = diffFileMaps(localUserMap, remoteUserMap);
292
+ const localIds = new Set(assets.map((a) => a.id));
293
+ const carried = carryForwardGenerated(remote, localIds, { regenVectors: args.embed });
294
+ // Assets whose thumbnail the user provided are never rendered over —
295
+ // buildRenderJobs skips them; the count feeds the plan/summary lines.
296
+ const userThumbCount = assets.reduce((n, a) => (a.thumbnail ? n + 1 : n), 0);
297
+ info(`Pushing library ${namespace}/${name} from ${args.dir}\n`);
298
+ info(` assets: ${assets.length}\n`);
299
+ info(` files: ${diff.upload.length} to upload, ${diff.unchanged.length} unchanged, ${diff.removed.length} removed\n`);
300
+ if (diff.removed.length > 0) {
301
+ info(` removed at register (server-side — nothing is deleted from here):\n`);
302
+ for (const p of diff.removed)
303
+ info(` ${p}\n`);
304
+ }
305
+ if (args.dryRun) {
306
+ const uploadBytes = diff.upload.reduce((s, p) => s + (localUserMap.get(p)?.size ?? 0), 0);
307
+ if (args.json) {
308
+ emitJson({
309
+ dryRun: true,
310
+ library: `${namespace}/${name}`,
311
+ assets: assets.length,
312
+ plan: { upload: diff.upload, unchanged: diff.unchanged, removed: diff.removed },
313
+ bytesToUpload: uploadBytes,
314
+ });
315
+ return 0;
316
+ }
317
+ // The discovery table: what a push WOULD register, one row per asset.
318
+ process.stdout.write("\n");
319
+ process.stdout.write(renderTable(assets.map((a) => ({
320
+ id: a.id,
321
+ kind: a.kind,
322
+ entry: a.entry ?? null,
323
+ files: a.files.length,
324
+ })), ["id", "kind", "entry", "files"]));
325
+ process.stdout.write(`\n plan: ${diff.upload.length} file(s) to upload (${humanSize(uploadBytes)}) + the manifest` +
326
+ `${args.thumbnails
327
+ ? `, thumbnails for ${buildRenderJobs(srcDir, assets).length} asset(s)` +
328
+ (userThumbCount > 0 ? `, ${userThumbCount} user-provided` : "")
329
+ : ""}` +
330
+ `${args.embed ? ", vectors" : ""}\n`);
331
+ if (carried.generated.length > 0) {
332
+ process.stdout.write(` carried: ${carried.generated.length} generated artifact(s) kept from the remote\n`);
333
+ }
334
+ ok("dry run — nothing generated, nothing uploaded, nothing registered");
335
+ return 0;
336
+ }
337
+ // Drift guard (RFC 0008 §5.7, ruling #9): a push is wholesale — the local
338
+ // directory is the truth — so a removal-bearing plan against a remote this
339
+ // directory did NOT last register would delete assets someone added
340
+ // elsewhere (`library add`, or a push from another machine). Removals are
341
+ // PHYSICAL at register (no version history), so that combination aborts
342
+ // here, before anything is generated or uploaded. A marker recorded for a
343
+ // different library is no baseline for this one.
344
+ if (diff.removed.length > 0 && !args.force) {
345
+ const marker = readLastRegisteredRevision(srcDir);
346
+ const recorded = marker !== null && marker.library === `${namespace}/${name}` ? marker : null;
347
+ if (recorded === null || recorded.revision !== expectedRevision) {
348
+ fail(`remote ${namespace}/${name} is at revision ${expectedRevision} but this directory ` +
349
+ (recorded === null
350
+ ? "has never registered it"
351
+ : `last registered revision ${recorded.revision}`) +
352
+ ` — pushing would delete ${diff.removed.length} asset file(s) added elsewhere:`);
353
+ const CAP = 20;
354
+ for (const p of diff.removed.slice(0, CAP))
355
+ process.stderr.write(` ${p}\n`);
356
+ if (diff.removed.length > CAP) {
357
+ process.stderr.write(` … and ${diff.removed.length - CAP} more\n`);
358
+ }
359
+ process.stderr.write(` pull to merge, or re-run with --force to delete them.\n`);
360
+ return 1;
361
+ }
362
+ }
363
+ // 5) generated artifacts, into the per-source cache dir — NEVER the source
364
+ // tree. A missing Python toolchain degrades to a warning: the push is
365
+ // complete without them.
366
+ const cacheDir = deps.cacheDir ?? pushCacheDir(srcDir);
367
+ mkdirSync(cacheDir, { recursive: true });
368
+ const renderedThumbnails = new Map();
369
+ const thumbnailUploads = [];
370
+ const thumbsDir = path.join(cacheDir, "thumbnails");
371
+ if (args.thumbnails) {
372
+ const jobs = buildRenderJobs(srcDir, assets);
373
+ if (jobs.length === 0) {
374
+ if (userThumbCount > 0) {
375
+ info(` thumbnails: 0 rendered, ${userThumbCount} user-provided\n`);
376
+ }
377
+ else {
378
+ note("--thumbnails: no asset has a renderable entry — nothing to render");
379
+ }
380
+ }
381
+ else {
382
+ const tool = findAssetTool(RENDER_MODULE, deps);
383
+ if ("message" in tool) {
384
+ note(`${tool.message}\n continuing without thumbnails`);
385
+ }
386
+ else {
387
+ const jobsPath = path.join(cacheDir, "jobs.json");
388
+ writeFileSync(jobsPath, JSON.stringify(jobs, null, 2));
389
+ mkdirSync(thumbsDir, { recursive: true });
390
+ const run = runRenderThumbnails(tool.py, jobsPath, thumbsDir, deps);
391
+ if ("message" in run) {
392
+ note(`${run.message}\n continuing without thumbnails`);
393
+ }
394
+ else {
395
+ for (const f of run.report.failed) {
396
+ note(`thumbnail render failed for '${f.id}': ${f.reason}`);
397
+ }
398
+ for (const id of run.report.rendered) {
399
+ const abs = path.join(thumbsDir, `${id}.webp`);
400
+ if (!existsSync(abs)) {
401
+ note(`the renderer reported '${id}' but wrote no ${id}.webp — skipping it`);
402
+ continue;
403
+ }
404
+ renderedThumbnails.set(id, thumbnailGeneratedPath(id));
405
+ thumbnailUploads.push({
406
+ relativePath: thumbnailGeneratedPath(id),
407
+ size: statSync(abs).size,
408
+ absPath: abs,
409
+ });
410
+ }
411
+ info(` thumbnails: ${run.report.rendered.length} rendered` +
412
+ `${run.report.skipped.length > 0 ? `, ${run.report.skipped.length} skipped` : ""}` +
413
+ `${run.report.failed.length > 0 ? `, ${run.report.failed.length} failed` : ""}` +
414
+ `${userThumbCount > 0 ? `, ${userThumbCount} user-provided` : ""}\n`);
415
+ }
416
+ }
417
+ }
418
+ }
419
+ // 6) the wire manifest — written to the cache, uploaded to the reserved
420
+ // location. Built twice when --embed extends generated[]: the embed tool
421
+ // reads the manifest to know the assets, so it must exist first.
422
+ const manifestPath = path.join(cacheDir, "manifest.json");
423
+ const build = (extraGenerated) => buildWireManifest({
424
+ name,
425
+ yml,
426
+ includeYml,
427
+ assets,
428
+ hashes,
429
+ renderedThumbnails,
430
+ carried,
431
+ extraGenerated,
432
+ });
433
+ let manifest;
434
+ try {
435
+ manifest = build([]);
436
+ }
437
+ catch (e) {
438
+ fail(e instanceof Error ? e.message : String(e));
439
+ return 1;
440
+ }
441
+ writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
442
+ const vectorUploads = [];
443
+ /** The encoder id the embed tool reported, for the --json result. */
444
+ let embedModel;
445
+ if (args.embed) {
446
+ const tool = findAssetTool(EMBED_MODULE, deps);
447
+ if ("message" in tool) {
448
+ note(`${tool.message}\n continuing without vectors`);
449
+ }
450
+ else {
451
+ const run = runEmbed(tool.py, {
452
+ manifestPath,
453
+ filesRoot: srcDir,
454
+ thumbsDir,
455
+ outDir: cacheDir,
456
+ ...(args.model ? { model: args.model } : {}),
457
+ }, deps);
458
+ if ("message" in run) {
459
+ note(`${run.message}\n continuing without vectors`);
460
+ }
461
+ else {
462
+ const jsonAbs = path.resolve(cacheDir, run.stats.json);
463
+ const f32Abs = path.resolve(cacheDir, run.stats.f32);
464
+ vectorUploads.push({ relativePath: GENERATED_VECTORS_JSON, size: statSync(jsonAbs).size, absPath: jsonAbs }, { relativePath: GENERATED_VECTORS_F32, size: statSync(f32Abs).size, absPath: f32Abs });
465
+ manifest = build([GENERATED_VECTORS_JSON, GENERATED_VECTORS_F32]);
466
+ writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
467
+ // Name the encoder: whether the vectors are searchable on DreamLake
468
+ // depends on it, and nothing else in the output reveals it.
469
+ embedModel = typeof run.stats.model === "string" ? run.stats.model : undefined;
470
+ info(` vectors: ${GENERATED_VECTORS_JSON} + ${GENERATED_VECTORS_F32}` +
471
+ `${describeEmbedModel(run.stats)}\n`);
472
+ const stale = embedModelWarning(run.stats);
473
+ if (stale)
474
+ note(stale);
475
+ }
476
+ }
477
+ }
478
+ // 7) the upload set: changed user files, the manifest (ALWAYS — register
479
+ // serves whatever manifest was last uploaded), and whatever was
480
+ // regenerated this push. Carried artifacts are already in storage.
481
+ const absByRel = new Map();
482
+ const uploads = [];
483
+ for (const rel of generation ? [...localUserMap.keys()] : diff.upload) {
484
+ uploads.push({ relativePath: rel, size: localUserMap.get(rel).size });
485
+ absByRel.set(rel, path.join(srcDir, rel));
486
+ }
487
+ uploads.push({ relativePath: MANIFEST_PATH_PRIMARY, size: statSync(manifestPath).size });
488
+ absByRel.set(MANIFEST_PATH_PRIMARY, manifestPath);
489
+ for (const t of [...thumbnailUploads, ...vectorUploads]) {
490
+ uploads.push({ relativePath: t.relativePath, size: t.size });
491
+ absByRel.set(t.relativePath, t.absPath);
492
+ }
493
+ if (generation) {
494
+ try {
495
+ const wanted = (manifest.generated ?? []).filter(rel => !absByRel.has(rel));
496
+ for (const file of await stageCarriedGenerationFiles(base, token, wanted, path.join(cacheDir, 'carried'), deps.fetchFn)) {
497
+ uploads.push({ relativePath: file.relativePath, size: file.size });
498
+ absByRel.set(file.relativePath, file.absPath);
499
+ }
500
+ }
501
+ catch (error) {
502
+ fail(error instanceof Error ? error.message : String(error));
503
+ return 1;
504
+ }
505
+ }
506
+ const uploadBytes = uploads.reduce((s, f) => s + f.size, 0);
507
+ // 8) authorize + upload, batch by batch.
508
+ let batches;
509
+ try {
510
+ batches = planBatches(uploads);
511
+ }
512
+ catch (e) {
513
+ fail(e instanceof Error ? e.message : String(e));
514
+ return 1;
515
+ }
516
+ // The bar repaints on stderr; under --json a scripted caller wants neither.
517
+ const bar = args.json ? null : new BarProgress(uploadBytes, uploads.length, "uploading");
518
+ try {
519
+ for (const batch of generation ? [] : batches) {
520
+ const authRes = await jsonRequest("POST", `${base}/upload-authorizations`, token, {
521
+ files: batch.map(({ relativePath, size }) => ({ relativePath, size })),
522
+ });
523
+ if (authRes.status < 200 || authRes.status >= 300) {
524
+ bar?.abort();
525
+ fail(`could not authorize the upload → ${authRes.status}: ${errorMessage(authRes)}`);
526
+ return 1;
527
+ }
528
+ const authorization = assertLibraryAuthorization(authRes.body, { files: batch });
529
+ await executePresignedBatch(authorization.files, {
530
+ localPath: (f) => absByRel.get(f.relativePath) ?? path.join(srcDir, f.relativePath),
531
+ concurrency: PUSH_CONCURRENCY,
532
+ fetchFn: deps.fetchFn,
533
+ onFileDone: (_f, bytes) => {
534
+ bar?.addBytes(bytes);
535
+ bar?.fileDone();
536
+ },
537
+ });
538
+ }
539
+ }
540
+ catch (e) {
541
+ bar?.abort();
542
+ fail(`upload failed: ${e instanceof Error ? e.message : String(e)}`);
543
+ return 1;
544
+ }
545
+ bar?.finish();
546
+ // 9) register — the write that makes the upload real. One 409 retry: the
547
+ // conflict means another push advanced the revision after this one read
548
+ // it, so re-read and try once with the fresh counter.
549
+ let reg;
550
+ if (generation) {
551
+ try {
552
+ reg = await publishLibraryGeneration({ base, token, uploads, localPath: file => absByRel.get(file.relativePath), cacheDir, expectedRevision, visibility: args.visibility, fetchFn: deps.fetchFn });
553
+ }
554
+ catch (error) {
555
+ fail(`generation push interrupted: ${error instanceof Error ? error.message : String(error)}; re-run the same command to recover`);
556
+ return 1;
557
+ }
558
+ }
559
+ else {
560
+ const registerBody = {
561
+ expectedRevision,
562
+ ...(args.visibility ? { visibility: args.visibility } : {}),
563
+ };
564
+ reg = await jsonRequest("POST", `${base}/register`, token, registerBody);
565
+ if (reg.status === 409) {
566
+ const conflict = reg.body;
567
+ const fresh = await jsonRequest("GET", base, token);
568
+ const freshRevision = fresh.status === 200 && typeof fresh.body?.revision === "number"
569
+ ? fresh.body.revision
570
+ : typeof conflict?.revision === "number"
571
+ ? conflict.revision
572
+ : expectedRevision;
573
+ reg = await jsonRequest("POST", `${base}/register`, token, {
574
+ ...registerBody,
575
+ expectedRevision: freshRevision,
576
+ });
577
+ }
578
+ }
579
+ if (reg.status < 200 || reg.status >= 300) {
580
+ fail(`uploaded ${uploads.length} file(s) but could not register the library → ${reg.status}: ${errorMessage(reg)}`);
581
+ if (reg.status === 409) {
582
+ process.stderr.write(` another push is racing this one — re-run \`dreamlake library push\`.\n`);
583
+ }
584
+ return 1;
585
+ }
586
+ const revision = generation ? reg.body?.publishedRevision ?? reg.body?.revision : reg.body?.revision;
587
+ // The drift-guard baseline (RFC 0008 §5.7): this directory is now the last
588
+ // writer of this library. The marker is disposable cache — a write failure
589
+ // must not fail a push that already registered.
590
+ if (typeof revision === "number") {
591
+ try {
592
+ writeLastRegisteredRevision(srcDir, `${namespace}/${name}`, revision);
593
+ }
594
+ catch {
595
+ /* disposable cache */
596
+ }
597
+ }
598
+ if (args.json) {
599
+ emitJson({
600
+ library: `${namespace}/${name}`,
601
+ revision: typeof revision === "number" ? revision : null,
602
+ uploaded: diff.upload.length,
603
+ unchanged: diff.unchanged.length,
604
+ removed: diff.removed.length,
605
+ bytesUploaded: uploadBytes,
606
+ ...(thumbnailUploads.length > 0 ? { thumbnails: thumbnailUploads.length } : {}),
607
+ ...(vectorUploads.length > 0 ? { vectors: true } : {}),
608
+ ...(embedModel ? { embedModel } : {}),
609
+ });
610
+ return 0;
611
+ }
612
+ const extras = [];
613
+ if (thumbnailUploads.length > 0)
614
+ extras.push(`${thumbnailUploads.length} thumbnails`);
615
+ if (vectorUploads.length > 0)
616
+ extras.push("vectors");
617
+ ok(`${namespace}/${name} revision ${typeof revision === "number" ? revision : "?"} — ` +
618
+ `${diff.upload.length} uploaded, ${diff.unchanged.length} unchanged, ${diff.removed.length} removed` +
619
+ (extras.length > 0 ? ` (+ ${extras.join(", ")})` : ""));
620
+ return 0;
621
+ }
622
+ export function registerLibraryPushCommand(library, withConnFlags) {
623
+ withConnFlags(library
624
+ .command("push")
625
+ .description("push a source directory as a library (assets discovered by convention + optional dreamlake.yml; " +
626
+ "diffs by sha256 against the remote manifest, removed files reconciled away server-side)")
627
+ .argument("<dir>", `library source root — user files plus an optional ${DREAMLAKE_YML}`)
628
+ .option("--library <name>", "library name (default: the directory basename)")
629
+ .option("--namespace <slug>", "namespace (default: active login)")
630
+ .option("--visibility <visibility>", "read visibility: public | private")
631
+ .option("--verify", "re-hash every local file and re-download the remote manifest, ignoring the local caches")
632
+ .option("--dry-run", "print the discovery table and transfer plan, then exit")
633
+ .option("--thumbnails", "render asset thumbnails at push (Python: dreamlake.assets_tools)")
634
+ .option("--embed", "generate the semantic-search vectors sidecar (requires --thumbnails)")
635
+ .option("--model <name>", "embedding encoder for --embed: siglip2 (the default, the only space DreamLake " +
636
+ "search queries), clip (legacy — yields keyword-only search here), or a raw " +
637
+ "open_clip model name; default: $DREAMLAKE_EMBED_MODEL, else the Python tool's")
638
+ .option("--force", "push even when the remote moved under this directory and the plan deletes files (drift guard override)")
639
+ .option("--json", "emit the machine-readable result on stdout (informational lines go to stderr)")).action(async (dir, opts) => {
640
+ process.exit(await runLibraryPush({ ...opts, dir }));
641
+ });
642
+ }
@@ -0,0 +1,31 @@
1
+ import type { Command } from "commander";
2
+ import { type DreamlakeOpts } from "../compat/ctx.js";
3
+ import { type LibraryManifest } from "./manifest.js";
4
+ export interface LibraryRmArgs extends DreamlakeOpts {
5
+ spec: string;
6
+ assetIds: string[];
7
+ dryRun?: boolean;
8
+ json?: boolean;
9
+ }
10
+ export interface LibraryRmDeps {
11
+ fetchFn?: typeof fetch;
12
+ }
13
+ export interface RemovalPlan {
14
+ manifest: LibraryManifest;
15
+ /** Ids actually present and removed (a subset of the request on retry). */
16
+ removed: string[];
17
+ /** Paths no remaining asset references — server reconcile deletes these. */
18
+ reclaimed: string[];
19
+ /** The stored tree carries a dreamlake.yml that may reference removed ids. */
20
+ hasAuthoringYml: boolean;
21
+ }
22
+ /**
23
+ * The merged document minus `ids`. Generated thumbnail renders
24
+ * (`.dreamlake/thumbnails/<id>.webp`) of removed assets leave generated[]
25
+ * unless a REMAINING asset's thumbnail points at that exact path; the
26
+ * vectors sidecar entries stay — their stale per-asset rows are tolerated
27
+ * (search reads assets from the manifest and looks vectors up by id).
28
+ */
29
+ export declare function planRemoval(remote: LibraryManifest, ids: readonly string[]): RemovalPlan;
30
+ export declare function runLibraryRm(args: LibraryRmArgs, deps?: LibraryRmDeps): Promise<number>;
31
+ export declare function registerLibraryRmCommand(library: Command, withConnFlags: (c: Command) => Command): void;