@dreamlake/dreamlake-cli 0.88.1 → 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,81 @@
1
+ /**
2
+ * Locating and changing text in a document snapshot.
3
+ *
4
+ * The same rules as the Python SDK's `dreamlake.api._editing`, because the two
5
+ * have to agree: an agent that works out a `replace` in Python and runs it
6
+ * through the CLI must get the same document back, or neither is trustworthy.
7
+ *
8
+ * Two implementations of one contract is a hazard, and the honest mitigation
9
+ * is a shared fixture file both suites read — see `editing.fixtures.json` and
10
+ * the Python test that loads the same one. Anything asserted in prose here is
11
+ * asserted as data there.
12
+ *
13
+ * Node runs the regexes natively, so the JavaScript dialect needs no
14
+ * translation on this side; what needs care is the opposite direction, which
15
+ * the Python module handles. The one place they must be made to agree
16
+ * explicitly is character indices: JavaScript string offsets are UTF-16 code
17
+ * units, and this API specifies Unicode CODE POINTS, so every index that
18
+ * crosses the boundary is converted.
19
+ */
20
+ export declare class EditError extends Error {
21
+ }
22
+ export declare class NoMatch extends EditError {
23
+ }
24
+ export declare class AmbiguousMatch extends EditError {
25
+ }
26
+ export declare class InvalidRange extends EditError {
27
+ }
28
+ export interface Match {
29
+ text: string;
30
+ /** 0-based, end-exclusive code points. */
31
+ ind: [number, number];
32
+ /** 1-based, inclusive. */
33
+ line: [number, number];
34
+ captures?: Record<string, string | null>;
35
+ captureSpans?: Record<string, [number, number] | null>;
36
+ }
37
+ declare function cpLength(s: string): number;
38
+ /** UTF-16 offset → code point offset. */
39
+ declare function toCp(s: string, utf16: number): number;
40
+ /** Code point offset → UTF-16 offset. */
41
+ declare function toUtf16(s: string, cp: number): number;
42
+ /** Slice by code point, the way Python's `s[a:b]` does. */
43
+ export declare function cpSlice(s: string, start: number, end?: number): string;
44
+ /** The 1-based line holding a code point index. */
45
+ export declare function lineOf(source: string, ind: number): number;
46
+ /** Code point range covering lines `first`..`last` inclusive, with newline. */
47
+ export declare function lineSpan(source: string, first: number, last: number): [number, number];
48
+ export interface FindOpts {
49
+ regex?: string;
50
+ flags?: string;
51
+ limit?: number;
52
+ }
53
+ export declare function find(source: string, query?: string, opts?: FindOpts): Match[];
54
+ export interface Where {
55
+ query?: string;
56
+ regex?: string;
57
+ flags?: string;
58
+ line?: number | [number, number];
59
+ ind?: number | [number, number];
60
+ count?: number;
61
+ all?: boolean;
62
+ }
63
+ /** Apply non-overlapping edits computed on ONE snapshot, in code point space. */
64
+ export type EditPlan = Array<[number, number, string]>;
65
+ export declare function applyEditPlan(source: string, edits: EditPlan): string;
66
+ export declare function replacementPlan(source: string, text: string, w: Where): EditPlan;
67
+ export declare function replace(source: string, text: string, w: Where): string;
68
+ export declare function insertPlacement(source: string, text: string, where: {
69
+ line?: number;
70
+ ind?: number;
71
+ }): {
72
+ at: number;
73
+ text: string;
74
+ };
75
+ export declare function insert(source: string, text: string, where: {
76
+ line?: number;
77
+ ind?: number;
78
+ }): string;
79
+ export declare function removalPlan(source: string, w: Where): EditPlan;
80
+ export declare function remove(source: string, w: Where): string;
81
+ export { toUtf16, toCp, cpLength };
@@ -0,0 +1,305 @@
1
+ /**
2
+ * Locating and changing text in a document snapshot.
3
+ *
4
+ * The same rules as the Python SDK's `dreamlake.api._editing`, because the two
5
+ * have to agree: an agent that works out a `replace` in Python and runs it
6
+ * through the CLI must get the same document back, or neither is trustworthy.
7
+ *
8
+ * Two implementations of one contract is a hazard, and the honest mitigation
9
+ * is a shared fixture file both suites read — see `editing.fixtures.json` and
10
+ * the Python test that loads the same one. Anything asserted in prose here is
11
+ * asserted as data there.
12
+ *
13
+ * Node runs the regexes natively, so the JavaScript dialect needs no
14
+ * translation on this side; what needs care is the opposite direction, which
15
+ * the Python module handles. The one place they must be made to agree
16
+ * explicitly is character indices: JavaScript string offsets are UTF-16 code
17
+ * units, and this API specifies Unicode CODE POINTS, so every index that
18
+ * crosses the boundary is converted.
19
+ */
20
+ export class EditError extends Error {
21
+ }
22
+ export class NoMatch extends EditError {
23
+ }
24
+ export class AmbiguousMatch extends EditError {
25
+ }
26
+ export class InvalidRange extends EditError {
27
+ }
28
+ // ── Code points vs UTF-16 ────────────────────────────────────────────────────
29
+ //
30
+ // `"a😀b".length` is 4 in JavaScript and 3 in Python. Every offset this module
31
+ // reports or accepts is a code point, so a range computed here means the same
32
+ // characters a Python caller would address.
33
+ /** Code points as an array, so an index into it is a code point index. */
34
+ function points(s) {
35
+ return Array.from(s);
36
+ }
37
+ function cpLength(s) {
38
+ return points(s).length;
39
+ }
40
+ /** UTF-16 offset → code point offset. */
41
+ function toCp(s, utf16) {
42
+ return cpLength(s.slice(0, utf16));
43
+ }
44
+ /** Code point offset → UTF-16 offset. */
45
+ function toUtf16(s, cp) {
46
+ return points(s).slice(0, cp).join("").length;
47
+ }
48
+ /** Slice by code point, the way Python's `s[a:b]` does. */
49
+ export function cpSlice(s, start, end) {
50
+ return points(s).slice(start, end).join("");
51
+ }
52
+ // ── Lines ────────────────────────────────────────────────────────────────────
53
+ function lineStarts(source) {
54
+ const starts = [0];
55
+ const pts = points(source);
56
+ for (let i = 0; i < pts.length; i++)
57
+ if (pts[i] === "\n")
58
+ starts.push(i + 1);
59
+ return starts;
60
+ }
61
+ /** The 1-based line holding a code point index. */
62
+ export function lineOf(source, ind) {
63
+ const starts = lineStarts(source);
64
+ let lo = 0;
65
+ let hi = starts.length - 1;
66
+ while (lo < hi) {
67
+ const mid = Math.ceil((lo + hi) / 2);
68
+ if (starts[mid] <= ind)
69
+ lo = mid;
70
+ else
71
+ hi = mid - 1;
72
+ }
73
+ return lo + 1;
74
+ }
75
+ /** Code point range covering lines `first`..`last` inclusive, with newline. */
76
+ export function lineSpan(source, first, last) {
77
+ const starts = lineStarts(source);
78
+ const total = starts.length;
79
+ if (first < 1 || last < first) {
80
+ throw new InvalidRange(`line range (${first}, ${last}) is not a range; lines are 1-based and inclusive`);
81
+ }
82
+ if (first > total) {
83
+ throw new InvalidRange(`line ${first} is past the end of a ${total}-line document`);
84
+ }
85
+ // Refused, not clamped. Clamping makes `--line 10:400` on a 12-line document
86
+ // mean "lines 10 to the end" — a reasonable thing to want and a terrible
87
+ // thing to guess, because the caller who wrote 400 by misreading the length
88
+ // gets the same silent success as the one who meant it, and the difference
89
+ // is the lines that got deleted.
90
+ if (last > total) {
91
+ throw new InvalidRange(`line ${last} is past the end of a ${total}-line document; to reach the end, say ${total}`);
92
+ }
93
+ const end = last < total ? starts[Math.min(last, total)] : cpLength(source);
94
+ return [starts[first - 1], end];
95
+ }
96
+ /** The document's own line ending, so an edit does not convert the file. */
97
+ function newlineStyle(source) {
98
+ return source.includes("\r\n") ? "\r\n" : "\n";
99
+ }
100
+ // ── Finding ──────────────────────────────────────────────────────────────────
101
+ function asMatch(source, start, end, m) {
102
+ const out = {
103
+ text: cpSlice(source, start, end),
104
+ ind: [start, end],
105
+ line: [lineOf(source, start), lineOf(source, Math.max(start, end - 1))],
106
+ };
107
+ if (m && (m.length > 1 || m.groups)) {
108
+ const captures = {};
109
+ for (let i = 1; i < m.length; i++)
110
+ captures[String(i)] = m[i] ?? null;
111
+ if (m.groups)
112
+ for (const [k, v] of Object.entries(m.groups))
113
+ captures[k] = v ?? null;
114
+ out.captures = captures;
115
+ }
116
+ return out;
117
+ }
118
+ export function find(source, query, opts = {}) {
119
+ const { regex, flags = "", limit = 1000 } = opts;
120
+ if ((query === undefined) === (regex === undefined)) {
121
+ throw new EditError("give exactly one of query or regex");
122
+ }
123
+ const out = [];
124
+ if (query !== undefined) {
125
+ if (query === "")
126
+ throw new EditError("an empty query matches everywhere; say what to look for");
127
+ let from = 0;
128
+ while (out.length < limit) {
129
+ const at = source.indexOf(query, from);
130
+ if (at < 0)
131
+ break;
132
+ out.push(asMatch(source, toCp(source, at), toCp(source, at + query.length)));
133
+ from = at + query.length;
134
+ }
135
+ return out;
136
+ }
137
+ // `g` is not a caller-supplied flag — whether every match is replaced belongs
138
+ // to the call (`all`, `count`), not to the pattern. It is added here only to
139
+ // walk the string.
140
+ checkFlags(flags);
141
+ const rx = new RegExp(regex, flags.includes("g") ? flags : flags + "g");
142
+ let m;
143
+ while ((m = rx.exec(source)) !== null && out.length < limit) {
144
+ out.push(asMatch(source, toCp(source, m.index), toCp(source, m.index + m[0].length), m));
145
+ if (m[0] === "")
146
+ rx.lastIndex += 1; // a zero-width match would loop forever
147
+ }
148
+ return out;
149
+ }
150
+ const KNOWN_FLAGS = new Set(["i", "m", "s", "u", "v"]);
151
+ function checkFlags(flags) {
152
+ const unknown = [...flags].filter((f) => !KNOWN_FLAGS.has(f));
153
+ if (unknown.length) {
154
+ const extra = unknown.includes("g") ? " ('g' is not a flag here — use --all or --count N)" : "";
155
+ throw new EditError(`unsupported regex flags: ${unknown.sort().join("")}${extra}`);
156
+ }
157
+ }
158
+ function checkTargets(w) {
159
+ const given = ["query", "regex", "line", "ind"].filter((k) => w[k] !== undefined);
160
+ if (given.length === 0)
161
+ throw new EditError("say where: query, regex, line or ind");
162
+ if (given.length > 1) {
163
+ throw new EditError(`conflicting targets: ${given.join(", ")} — give one`);
164
+ }
165
+ return given[0];
166
+ }
167
+ function resolveSpan(source, w) {
168
+ if (w.line !== undefined) {
169
+ const [first, last] = typeof w.line === "number" ? [w.line, w.line] : w.line;
170
+ return lineSpan(source, first, last);
171
+ }
172
+ const [start, end] = typeof w.ind === "number" ? [w.ind, w.ind] : w.ind;
173
+ const n = cpLength(source);
174
+ if (start < 0 || end < start) {
175
+ throw new InvalidRange(`character range (${start}, ${end}) is not a range; indices are 0-based, end-exclusive code points`);
176
+ }
177
+ if (end > n) {
178
+ throw new InvalidRange(`character index ${end} is past the end of a ${n}-character document`);
179
+ }
180
+ return [start, end];
181
+ }
182
+ function selectMatches(matches, w, what) {
183
+ if (w.all && w.count !== undefined) {
184
+ throw new EditError("count and all say different things; give one");
185
+ }
186
+ const n = matches.length;
187
+ if (n === 0)
188
+ throw new NoMatch(`${what} matched nothing`);
189
+ if (w.all)
190
+ return matches;
191
+ const wanted = w.count ?? 1;
192
+ if (wanted < 1)
193
+ throw new EditError(`count must be at least 1, got ${wanted}`);
194
+ if (n !== wanted) {
195
+ throw new AmbiguousMatch(`expected ${wanted} match${wanted === 1 ? "" : "es"}, found ${n} — ` +
196
+ `narrow the query, or pass --all or --count ${n}`);
197
+ }
198
+ return matches;
199
+ }
200
+ export function applyEditPlan(source, edits) {
201
+ const pts = points(source);
202
+ const out = [];
203
+ let last = 0;
204
+ for (const [start, end, text] of edits) {
205
+ if (start < last)
206
+ throw new EditError("overlapping edits");
207
+ out.push(pts.slice(last, start).join(""), text);
208
+ last = end;
209
+ }
210
+ out.push(pts.slice(last).join(""));
211
+ return out.join("");
212
+ }
213
+ // ── Edits ────────────────────────────────────────────────────────────────────
214
+ export function replacementPlan(source, text, w) {
215
+ const mode = checkTargets(w);
216
+ if (mode === "line" || mode === "ind") {
217
+ if (w.count !== undefined || w.all) {
218
+ throw new EditError("count and all apply to query/regex matching, not to a range");
219
+ }
220
+ const [start, end] = resolveSpan(source, w);
221
+ let body = text;
222
+ // A line edit yields whole lines, including at end of file — but never two
223
+ // terminators where the caller already wrote one.
224
+ if (mode === "line" && !body.endsWith("\n"))
225
+ body += newlineStyle(source);
226
+ return [[start, end, body]];
227
+ }
228
+ const matches = find(source, w.query, { regex: w.regex, flags: w.flags });
229
+ const chosen = selectMatches(matches, w, w.query !== undefined ? "query" : "regex");
230
+ if (w.regex !== undefined) {
231
+ checkFlags(w.flags ?? "");
232
+ const edits = [];
233
+ // Expanded against the ORIGINAL source, so a replacement can never see
234
+ // text an earlier replacement introduced.
235
+ const rx = new RegExp(w.regex, (w.flags ?? "") + "g");
236
+ let m;
237
+ const wanted = new Set(chosen.map((c) => `${c.ind[0]}:${c.ind[1]}`));
238
+ while ((m = rx.exec(source)) !== null) {
239
+ const start = toCp(source, m.index);
240
+ const end = toCp(source, m.index + m[0].length);
241
+ if (m[0] === "") {
242
+ throw new EditError("zero-width regex match: use insert with --line/--ind instead");
243
+ }
244
+ if (wanted.has(`${start}:${end}`)) {
245
+ // `String.replace` on the matched text alone gives JavaScript's own
246
+ // token expansion, which is the dialect this API documents.
247
+ edits.push([start, end, m[0].replace(new RegExp(w.regex, w.flags ?? ""), text)]);
248
+ }
249
+ }
250
+ return edits;
251
+ }
252
+ return chosen.map((m) => [m.ind[0], m.ind[1], text]);
253
+ }
254
+ export function replace(source, text, w) {
255
+ return applyEditPlan(source, replacementPlan(source, text, w));
256
+ }
257
+ export function insertPlacement(source, text, where) {
258
+ if ((where.line === undefined) === (where.ind === undefined)) {
259
+ throw new EditError("give exactly one of line or ind");
260
+ }
261
+ if (where.line !== undefined) {
262
+ const line = where.line;
263
+ if (line < 1)
264
+ throw new InvalidRange(`line ${line} is not a line; lines are 1-based`);
265
+ const starts = lineStarts(source);
266
+ if (line > starts.length + 1) {
267
+ throw new InvalidRange(`line ${line} is past the end of a ${starts.length}-line document`);
268
+ }
269
+ const at = line <= starts.length ? starts[line - 1] : cpLength(source);
270
+ let body = text.endsWith("\n") ? text : text + newlineStyle(source);
271
+ if (at === cpLength(source) && source && !/[\n\r]$/.test(source)) {
272
+ // Appending past a file with no final newline: start a new line rather
273
+ // than joining onto the last one.
274
+ body = newlineStyle(source) + body;
275
+ }
276
+ return { at, text: body };
277
+ }
278
+ const ind = where.ind;
279
+ const n = cpLength(source);
280
+ if (ind < 0 || ind > n) {
281
+ throw new InvalidRange(`character index ${ind} is outside 0..${n}; insertion positions are inclusive of both ends`);
282
+ }
283
+ return { at: ind, text };
284
+ }
285
+ export function insert(source, text, where) {
286
+ const placement = insertPlacement(source, text, where);
287
+ return cpSlice(source, 0, placement.at) + placement.text + cpSlice(source, placement.at);
288
+ }
289
+ export function removalPlan(source, w) {
290
+ const mode = checkTargets(w);
291
+ if (mode === "line" || mode === "ind") {
292
+ if (w.count !== undefined || w.all) {
293
+ throw new EditError("count and all apply to query/regex matching, not to a range");
294
+ }
295
+ const [start, end] = resolveSpan(source, w);
296
+ return [[start, end, ""]];
297
+ }
298
+ const matches = find(source, w.query, { regex: w.regex, flags: w.flags });
299
+ const chosen = selectMatches(matches, w, w.query !== undefined ? "query" : "regex");
300
+ return chosen.map((m) => [m.ind[0], m.ind[1], ""]);
301
+ }
302
+ export function remove(source, w) {
303
+ return applyEditPlan(source, removalPlan(source, w));
304
+ }
305
+ export { toUtf16, toCp, cpLength };
@@ -0,0 +1,36 @@
1
+ import { requestRaw } from '../client.js';
2
+ export type Selection = null | {
3
+ status: 'unresolved';
4
+ } | {
5
+ status: 'resolved';
6
+ anchor: number;
7
+ head: number;
8
+ start: number;
9
+ end: number;
10
+ unit: 'unicode-code-point';
11
+ text: string;
12
+ truncated: boolean;
13
+ };
14
+ export interface Participant {
15
+ client: string;
16
+ user: {
17
+ id: string;
18
+ name: string;
19
+ kind: 'human' | 'agent';
20
+ owner?: {
21
+ id: string;
22
+ name: string;
23
+ };
24
+ };
25
+ selection?: Selection;
26
+ }
27
+ export interface NoteEvent {
28
+ type: 'observation';
29
+ note: string;
30
+ hash: string;
31
+ observedAt: number;
32
+ participants: Participant[];
33
+ activityVersion: string;
34
+ }
35
+ /** Fetch SSE with auth headers, abort/idle bounds, and no automatic replay across gaps. */
36
+ export declare function readNoteEvents(url: string, token: string, note: string, signal: AbortSignal, receive: (event: NoteEvent) => void, request?: typeof requestRaw): Promise<void>;
@@ -0,0 +1,54 @@
1
+ import { requestRaw } from '../client.js';
2
+ /** Fetch SSE with auth headers, abort/idle bounds, and no automatic replay across gaps. */
3
+ export async function readNoteEvents(url, token, note, signal, receive, request = requestRaw) {
4
+ const idle = new AbortController();
5
+ let timer;
6
+ const touch = () => { clearTimeout(timer); timer = setTimeout(() => idle.abort(new Error('Notes event stream timed out')), 45000); };
7
+ touch();
8
+ let reader;
9
+ try {
10
+ const res = await request(url, { token, headers: { Accept: 'text/event-stream' },
11
+ signal: AbortSignal.any([signal, idle.signal]), followRedirects: false });
12
+ if (!/^text\/event-stream(?:;|$)/i.test(res.headers.get('content-type') ?? '') || !res.body)
13
+ throw new Error('server does not support Notes events; upgrade the server');
14
+ reader = res.body.getReader();
15
+ const decoder = new TextDecoder('utf-8', { fatal: true });
16
+ let buffer = '', data = [], frameSize = 0;
17
+ while (!signal.aborted) {
18
+ const { done, value } = await reader.read();
19
+ if (done)
20
+ throw new Error('Notes event stream disconnected; run --linger again for a fresh snapshot');
21
+ touch();
22
+ buffer += decoder.decode(value, { stream: true });
23
+ if (buffer.length > 4_000_000)
24
+ throw new Error('Notes event frame exceeds limit');
25
+ let newline;
26
+ while ((newline = buffer.indexOf('\n')) >= 0) {
27
+ const line = buffer.slice(0, newline).replace(/\r$/, '');
28
+ buffer = buffer.slice(newline + 1);
29
+ if (line.startsWith('data:')) {
30
+ const part = line.slice(5).replace(/^ /, '');
31
+ frameSize += part.length;
32
+ if (frameSize > 4_000_000)
33
+ throw new Error('Notes event frame exceeds limit');
34
+ data.push(part);
35
+ }
36
+ else if (!line && data.length) {
37
+ const event = JSON.parse(data.join('\n'));
38
+ data = [];
39
+ frameSize = 0;
40
+ if (event.type === 'error')
41
+ throw new Error(`Notes event stream ended (${String(event.error)})`);
42
+ if (event.type !== 'observation' || event.note !== note || !/^sha256:[a-f0-9]{64}$/.test(event.hash) ||
43
+ !Array.isArray(event.participants) || typeof event.activityVersion !== 'string')
44
+ throw new Error('invalid Notes event response');
45
+ receive(event);
46
+ }
47
+ }
48
+ }
49
+ }
50
+ finally {
51
+ clearTimeout(timer);
52
+ await reader?.cancel().catch(() => { });
53
+ }
54
+ }
@@ -0,0 +1,120 @@
1
+ /**
2
+ * `dreamlake notes files …` — list, upload, download, move, copy, trash.
3
+ *
4
+ * Bytes are never decoded on this path. Upload reads the local file as a
5
+ * Buffer and sends it raw; download writes the response body straight out.
6
+ * Only `--text` touches a string, and the server refuses that for anything not
7
+ * text-typed rather than round-tripping it through UTF-8.
8
+ *
9
+ * Downloads refuse to replace a local file unless asked. Everything else here
10
+ * goes to a recoverable trash; something overwritten on the caller's disk does
11
+ * not come back.
12
+ */
13
+ import { type ConnOpts, ctx } from "./index.js";
14
+ export interface FileRow {
15
+ id: string;
16
+ path: string;
17
+ contentType: string;
18
+ sizeBytes: number;
19
+ etag: string;
20
+ createdBy: string;
21
+ createdAt: string;
22
+ updatedAt: string;
23
+ trashed: boolean;
24
+ previewKind: string | null;
25
+ text: boolean;
26
+ }
27
+ /** Exit code for "the file or path was wrong", distinct from a transport failure. */
28
+ export declare const EXIT_NO_FILE = 6;
29
+ /** Exit code for a refused overwrite — a script can branch on it and retry. */
30
+ export declare const EXIT_EXISTS = 7;
31
+ type Conn = Awaited<ReturnType<typeof ctx>>;
32
+ export declare function runFilesList(glob: string | undefined, opts: ConnOpts & {
33
+ note?: string;
34
+ trashed?: boolean;
35
+ contentType?: string;
36
+ limit?: string;
37
+ offset?: string;
38
+ json?: boolean;
39
+ }): Promise<number>;
40
+ export declare function runFilesUpload(localPath: string, opts: ConnOpts & {
41
+ note?: string;
42
+ path?: string;
43
+ contentType?: string;
44
+ overwrite?: boolean;
45
+ json?: boolean;
46
+ }): Promise<number>;
47
+ export declare function runFilesDownload(ref: string, opts: ConnOpts & {
48
+ note?: string;
49
+ output?: string;
50
+ overwrite?: boolean;
51
+ }): Promise<number>;
52
+ export declare function runFilesCat(ref: string, opts: ConnOpts & {
53
+ note?: string;
54
+ json?: boolean;
55
+ }): Promise<number>;
56
+ export declare function runFilesWrite(remotePath: string, opts: ConnOpts & {
57
+ note?: string;
58
+ text?: string;
59
+ file?: string;
60
+ contentType?: string;
61
+ overwrite?: boolean;
62
+ ifMatch?: string;
63
+ idempotencyKey?: string;
64
+ json?: boolean;
65
+ }): Promise<number>;
66
+ export declare function runFilesMove(ref: string, to: string, opts: ConnOpts & {
67
+ note?: string;
68
+ overwrite?: boolean;
69
+ ifMatch?: string;
70
+ json?: boolean;
71
+ }): Promise<number>;
72
+ export declare function runFilesCopy(ref: string, to: string, opts: ConnOpts & {
73
+ note?: string;
74
+ overwrite?: boolean;
75
+ idempotencyKey?: string;
76
+ json?: boolean;
77
+ }): Promise<number>;
78
+ export declare function runFilesOperation(action: "status" | "reconcile" | "cancel", operationId: string, opts: ConnOpts & {
79
+ note?: string;
80
+ json?: boolean;
81
+ }): Promise<number>;
82
+ export declare function runFilesRm(ref: string, opts: ConnOpts & {
83
+ note?: string;
84
+ purge?: boolean;
85
+ ifMatch?: string;
86
+ json?: boolean;
87
+ }): Promise<number>;
88
+ export declare function runFilesRestore(ref: string, opts: ConnOpts & {
89
+ note?: string;
90
+ path?: string;
91
+ json?: boolean;
92
+ }): Promise<number>;
93
+ /**
94
+ * Accept an id OR a path, because both are things a person has in hand.
95
+ *
96
+ * A path is looked up in the listing; an id is used as it is. An ambiguous
97
+ * input cannot happen — an id is an ObjectId and a path is not — so this never
98
+ * has to guess.
99
+ */
100
+ export declare function resolveFile(c: Conn, noteId: string, ref: string, opts?: {
101
+ includeTrashed?: boolean;
102
+ }): Promise<FileRow | null>;
103
+ /**
104
+ * `dreamlake notes files preview <file> --note N [--share] [--open]`
105
+ *
106
+ * Prints a link that renders the file. The default needs the reader signed in
107
+ * and grants nothing by itself; `--share` returns one that works without
108
+ * signing in and lasts until `--revoke` withdraws it.
109
+ *
110
+ * The URL goes to stdout alone so it can be piped or copied; everything else
111
+ * is on stderr.
112
+ */
113
+ export declare function runFilesPreview(ref: string, opts: ConnOpts & {
114
+ note?: string;
115
+ share?: boolean;
116
+ revoke?: boolean;
117
+ open?: boolean;
118
+ json?: boolean;
119
+ }): Promise<number>;
120
+ export {};