@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,80 @@
1
+ import { requestJson, readSession, sessionPath, validateSessionInput, validId } from './api.js';
2
+ const iso = (value) => typeof value === 'string' && /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/.test(value) && Number.isFinite(Date.parse(value)) && new Date(value).toISOString() === value;
3
+ export function readDiscovery(value, target) {
4
+ if (!value || value.targetId !== target.id || value.enrollmentId !== target.enrollmentId ||
5
+ !iso(value.observedAt) || !['ok', 'python_missing', 'index_missing', 'unsupported_schema', 'unavailable'].includes(value.status) ||
6
+ typeof value.cached !== 'boolean' || value.lookbackDays !== 7 || !Array.isArray(value.candidates) || value.candidates.length > 25 ||
7
+ value.scope !== 'default_codex_home' || typeof value.partial !== 'boolean' || !Number.isSafeInteger(value.skippedCount) || value.skippedCount < 0 || value.skippedCount + value.candidates.length > 25 ||
8
+ !Number.isSafeInteger(value.metadataOmittedCount) || value.metadataOmittedCount < 0 || value.metadataOmittedCount > value.candidates.length ||
9
+ !(value.nextCursor === null || (typeof value.nextCursor === 'string' && /^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(value.nextCursor) && value.nextCursor.length <= 2048))) {
10
+ throw new Error('Terminal gateway returned invalid or mismatched discovery metadata');
11
+ }
12
+ const seen = new Set();
13
+ const candidates = value.candidates.map((c) => {
14
+ if (!c || typeof c.codexSessionId !== 'string' || typeof c.cwd !== 'string' || typeof c.name !== 'string' || !iso(c.lastActivityAt) || seen.has(c.codexSessionId))
15
+ throw new Error('Terminal gateway returned an invalid discovery candidate');
16
+ validateSessionInput({ targetId: target.id, enrollmentId: target.enrollmentId, cwd: c.cwd, codexSessionId: c.codexSessionId, name: c.name });
17
+ seen.add(c.codexSessionId);
18
+ let metadata;
19
+ if (c.metadata !== undefined) {
20
+ const m = c.metadata;
21
+ if (!m || !['git', 'not_repository', 'unavailable'].includes(m.repositoryStatus) || m.activityStatus !== 'available' || m.lastActivityAt !== c.lastActivityAt || !iso(m.metadataObservedAt) ||
22
+ (m.repositoryStatus === 'git' ? typeof m.repositoryRoot !== 'string' || !m.repositoryRoot.startsWith('/') || Buffer.byteLength(m.repositoryRoot) > 4096 || /[\x00-\x1f\x7f]/.test(m.repositoryRoot) ||
23
+ !(m.repositoryIdentity === null || (typeof m.repositoryIdentity === 'string' && m.repositoryIdentity.length <= 512 && /^git:[a-z0-9.-]+(?::[0-9]+)?\/[A-Za-z0-9._/-]+$/.test(m.repositoryIdentity))) : m.repositoryRoot !== null || m.repositoryIdentity !== null))
24
+ throw new Error('Terminal gateway returned invalid discovery observations');
25
+ metadata = { repositoryStatus: m.repositoryStatus, repositoryRoot: m.repositoryRoot, repositoryIdentity: m.repositoryIdentity,
26
+ activityStatus: 'available', lastActivityAt: c.lastActivityAt, metadataObservedAt: m.metadataObservedAt };
27
+ }
28
+ return { codexSessionId: c.codexSessionId, cwd: c.cwd, name: c.name, lastActivityAt: c.lastActivityAt, ...(metadata ? { metadata } : {}) };
29
+ });
30
+ if (value.metadataOmittedCount !== candidates.filter(c => !c.metadata).length ||
31
+ value.partial !== (!!value.nextCursor || value.skippedCount > 0 || value.metadataOmittedCount > 0 || value.status !== 'ok'))
32
+ throw new Error('Terminal gateway returned inconsistent discovery coverage');
33
+ return { ...value, candidates };
34
+ }
35
+ export async function syncTarget(conn, gateway, namespace, target, cursor, visibility) {
36
+ if (!validId(target.enrollmentId))
37
+ throw new Error('Selected target has no enrolled identity');
38
+ const result = { targetId: target.id, enrollmentId: target.enrollmentId, status: 'unavailable', observedAt: null, lookbackDays: 7, discovered: 0, savedIds: [], activityObservations: [], metadataUpdated: 0, newerMetadataPreserved: 0, nextCursor: null, cached: false, scope: 'default_codex_home', skippedCount: 0, metadataOmittedCount: 0, partial: true };
39
+ try {
40
+ const response = await requestJson(conn, `/namespaces/${encodeURIComponent(namespace)}/terminal/discovery`, 'POST', {
41
+ targetId: target.id, enrollmentId: target.enrollmentId, ...(cursor ? { cursor } : {}),
42
+ }, gateway);
43
+ const discovery = readDiscovery(response?.discovery, target);
44
+ Object.assign(result, { status: discovery.status, discovered: discovery.candidates.length, nextCursor: discovery.nextCursor, cached: discovery.cached,
45
+ observedAt: discovery.observedAt,
46
+ skippedCount: discovery.skippedCount, metadataOmittedCount: discovery.metadataOmittedCount, partial: discovery.partial,
47
+ activityObservations: discovery.candidates.map(c => ({ codexSessionId: c.codexSessionId, lastActivityAt: c.lastActivityAt })) });
48
+ if (discovery.status !== 'ok')
49
+ return result;
50
+ for (const candidate of discovery.candidates) {
51
+ const saved = readSession((await requestJson(conn, sessionPath(namespace), 'POST', {
52
+ targetId: target.id, enrollmentId: target.enrollmentId, cwd: candidate.cwd, codexSessionId: candidate.codexSessionId, nameIfNew: candidate.name, ...(visibility ? { visibility } : {}),
53
+ })).session);
54
+ if (saved.targetId !== target.id || saved.enrollmentId !== target.enrollmentId || saved.machineId !== target.machineId || saved.username !== target.username || saved.cwd !== candidate.cwd || saved.codexSessionId !== candidate.codexSessionId)
55
+ throw new Error('Saved session does not match the discovered enrolled host and conversation');
56
+ result.savedIds.push(saved.id);
57
+ if (candidate.metadata) {
58
+ const binding = { enrollmentId: saved.enrollmentId, machineId: saved.machineId, username: saved.username, cwd: saved.cwd, codexSessionId: saved.codexSessionId };
59
+ try {
60
+ const readback = readSession((await requestJson(conn, sessionPath(namespace, saved.id) + '/metadata', 'PATCH', { ...candidate.metadata, binding })).session);
61
+ if (readback.id !== saved.id || readback.targetId !== saved.targetId || readback.machineId !== saved.machineId || readback.username !== saved.username || readback.enrollmentId !== saved.enrollmentId || readback.cwd !== saved.cwd || readback.codexSessionId !== saved.codexSessionId)
62
+ throw new Error('Metadata response did not match the saved session');
63
+ result.metadataUpdated++;
64
+ }
65
+ catch (error) {
66
+ if (error instanceof Error && /HTTP 409\): terminal_session_metadata_stale$/.test(error.message))
67
+ result.newerMetadataPreserved++;
68
+ else
69
+ throw error;
70
+ }
71
+ }
72
+ }
73
+ }
74
+ catch (error) {
75
+ result.status = 'error';
76
+ result.partial = true;
77
+ result.error = error instanceof Error ? error.message : 'Session sync failed';
78
+ }
79
+ return result;
80
+ }
@@ -0,0 +1,14 @@
1
+ import { type Connection, type Gateway, type TerminalSession } from './api.js';
2
+ export declare function requireTerminal(): void;
3
+ export declare const terminalSize: (cols?: number, rows?: number) => {
4
+ cols: number;
5
+ rows: number;
6
+ };
7
+ /** One attachment only. Direct processes belong to this connection; no retry. */
8
+ export declare function attachSession(connection: Connection, gateway: Gateway, namespace: string, session: TerminalSession, kind?: 'tmux' | 'direct'): Promise<void>;
9
+ export interface TerminalIO {
10
+ input: NodeJS.ReadStream;
11
+ output: NodeJS.WriteStream;
12
+ signals: Pick<NodeJS.Process, 'on' | 'removeListener'>;
13
+ }
14
+ export declare function streamTerminal(gateway: Gateway, ticket: string, io?: TerminalIO, kind?: 'tmux' | 'direct'): Promise<void>;
@@ -0,0 +1,116 @@
1
+ import WebSocket from 'ws';
2
+ import { StringDecoder } from 'node:string_decoder';
3
+ import { requestJson } from './api.js';
4
+ export function requireTerminal() {
5
+ if (!process.stdin.isTTY || !process.stdout.isTTY)
6
+ throw new Error('Interactive sessions require a terminal. Use sessions create or resume --json to save without executing');
7
+ }
8
+ export const terminalSize = (cols = 80, rows = 24) => ({ cols: Math.max(2, Math.min(500, cols)), rows: Math.max(2, Math.min(200, rows)) });
9
+ /** One attachment only. Direct processes belong to this connection; no retry. */
10
+ export async function attachSession(connection, gateway, namespace, session, kind = 'tmux') {
11
+ requireTerminal();
12
+ const size = terminalSize(process.stdout.columns, process.stdout.rows);
13
+ const grant = await requestJson(connection, `/namespaces/${encodeURIComponent(namespace)}/terminal/tickets`, 'POST', {
14
+ targetId: session.targetId, ...size, launch: session.launch, managedSessionId: session.id,
15
+ ...(kind === 'direct' ? { runtime: 'direct' } : {}),
16
+ }, gateway);
17
+ if (typeof grant?.ticket !== 'string' || !/^[A-Za-z0-9_-]{43}$/.test(grant.ticket) || grant.path !== '/terminal/stream')
18
+ throw new Error('Terminal gateway returned an invalid ticket');
19
+ await streamTerminal(gateway, grant.ticket, undefined, kind);
20
+ }
21
+ export async function streamTerminal(gateway, ticket, io = { input: process.stdin, output: process.stdout, signals: process }, kind = 'tmux') {
22
+ const url = new URL('/terminal/stream', gateway.url);
23
+ url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:';
24
+ return new Promise((resolve, reject) => {
25
+ const recovery = kind === 'direct' ? 'the direct process may have ended; use sessions open to resume explicitly' : 'reopen the saved session to reattach';
26
+ // Bun's native ws compatibility layer ignores the `origin` option. An
27
+ // explicit header preserves the gateway's Origin check in both runtimes.
28
+ const socket = new WebSocket(url, { headers: { Origin: gateway.origin }, perMessageDeflate: false, maxPayload: 262144, handshakeTimeout: 15_000, followRedirects: false });
29
+ let ready = false, done = false, localDetach = false;
30
+ let closeError;
31
+ const previousRaw = io.input.isRaw;
32
+ const decoder = new StringDecoder('utf8');
33
+ const send = (value) => { if (socket.readyState === WebSocket.OPEN)
34
+ socket.send(JSON.stringify(value)); };
35
+ const finish = (error) => {
36
+ if (done)
37
+ return;
38
+ done = true;
39
+ clearTimeout(timer);
40
+ io.input.removeListener('data', input);
41
+ io.input.removeListener('end', detach);
42
+ io.output.removeListener('resize', resize);
43
+ io.signals.removeListener('SIGTERM', terminate);
44
+ io.signals.removeListener('SIGINT', detach);
45
+ if (ready) {
46
+ io.input.setRawMode(previousRaw ?? false);
47
+ io.input.pause();
48
+ }
49
+ socket.terminate();
50
+ if (error)
51
+ reject(error);
52
+ else
53
+ resolve();
54
+ };
55
+ const timer = setTimeout(() => finish(new Error(`Terminal connection timed out; ${recovery}`)), 45_000);
56
+ const detach = () => { localDetach = true; send({ type: 'disconnect' }); finish(); };
57
+ const terminate = () => finish(new Error(`Terminal client terminated; ${recovery}`));
58
+ const input = (chunk) => {
59
+ const data = typeof chunk === 'string' ? chunk : decoder.write(chunk);
60
+ // Ctrl-] is a client-only detach key. Ctrl-C remains remote program input.
61
+ const boundary = data.indexOf('\x1d');
62
+ const forward = boundary < 0 ? data : data.slice(0, boundary);
63
+ if (Buffer.byteLength(forward) > 16384 || socket.bufferedAmount > 65536)
64
+ return finish(new Error('Terminal input exceeded the gateway limit; reopen the session'));
65
+ if (forward)
66
+ send({ type: 'input', data: forward });
67
+ if (boundary >= 0)
68
+ detach();
69
+ };
70
+ const resize = () => send({ type: 'resize', ...terminalSize(io.output.columns, io.output.rows) });
71
+ socket.on('open', () => send({ type: 'attach', ticket }));
72
+ socket.on('error', () => finish(new Error('Terminal connection failed; check the configured gateway and saved session')));
73
+ socket.on('close', () => finish(localDetach ? undefined : closeError ?? new Error(`Terminal connection closed; ${recovery}`)));
74
+ socket.on('message', (raw, binary) => {
75
+ if (done)
76
+ return;
77
+ if (binary) {
78
+ const bytes = Buffer.isBuffer(raw) ? raw : Buffer.from(raw);
79
+ if (!ready)
80
+ return finish(new Error('Terminal gateway sent output before connection readiness'));
81
+ io.output.write(bytes, error => error ? finish(new Error('Could not write terminal output')) : send({ type: 'ack', bytes: bytes.length }));
82
+ return;
83
+ }
84
+ try {
85
+ const message = JSON.parse(raw.toString());
86
+ if (message.type !== 'status')
87
+ throw new Error();
88
+ if (message.state === 'connected' && !ready) {
89
+ ready = true;
90
+ clearTimeout(timer);
91
+ io.input.setRawMode(true);
92
+ io.input.resume();
93
+ io.input.on('data', input);
94
+ io.input.on('end', detach);
95
+ io.output.on('resize', resize);
96
+ io.signals.on('SIGTERM', terminate);
97
+ io.signals.on('SIGINT', detach);
98
+ }
99
+ else if (message.state === 'failed' || message.state === 'disconnected') {
100
+ const reason = typeof message.reason === 'string' && /^[a-z_]{1,60}$/.test(message.reason) ? message.reason : 'connection_closed';
101
+ if (reason === 'shell_exited' || (localDetach && reason === 'disconnected'))
102
+ finish();
103
+ else {
104
+ closeError = new Error(`Terminal disconnected: ${reason}; ${recovery}`);
105
+ finish(closeError);
106
+ }
107
+ }
108
+ else if (message.state !== 'connecting')
109
+ throw new Error();
110
+ }
111
+ catch {
112
+ finish(new Error('Terminal gateway sent an invalid status'));
113
+ }
114
+ });
115
+ });
116
+ }
@@ -0,0 +1,15 @@
1
+ /** Share management uses catalog metadata only; it never reads or rewrites content. */
2
+ import type { Command } from "commander";
3
+ import { type ConnOpts } from "./notes/index.js";
4
+ type Kind = "notes" | "artifact";
5
+ type Operation = "get" | "create" | "revoke" | "access" | "remove" | "visibility";
6
+ interface ShareOptions extends ConnOpts {
7
+ json?: boolean;
8
+ role?: string;
9
+ revokeAccepted?: boolean;
10
+ userId?: string;
11
+ visibility?: string;
12
+ }
13
+ export declare function runShare(kind: Kind, operation: Operation, ref: string, opts: ShareOptions): Promise<number>;
14
+ export declare function registerShareCommands(parent: Command, kind: Kind): void;
15
+ export {};
@@ -0,0 +1,139 @@
1
+ import { requestJson } from "./client.js";
2
+ import { resolveCtx } from "./compat/ctx.js";
3
+ import { withConnFlags } from "./compat/flags.js";
4
+ import { requireNamespace, requireToken } from "./compat/http.js";
5
+ import { emitJson, fail, renderTable } from "./helpers.js";
6
+ import { resolveNote } from "./notes/index.js";
7
+ import { webBase } from "./workflow/index.js";
8
+ export async function runShare(kind, operation, ref, opts) {
9
+ if (operation === "create" && kind === "notes" && !["read", "write"].includes(opts.role ?? "read")) {
10
+ fail("--role must be read or write");
11
+ return 1;
12
+ }
13
+ if (operation === "visibility" && !["private", "public"].includes(opts.visibility ?? "")) {
14
+ fail("visibility must be private or public");
15
+ return 1;
16
+ }
17
+ const c = resolveCtx(opts);
18
+ const token = requireToken(c);
19
+ if (!token)
20
+ return 1;
21
+ try {
22
+ let ns;
23
+ let id = ref;
24
+ let row;
25
+ if (kind === "notes") {
26
+ if (!/^[a-f0-9]{24}$/i.test(ref)) {
27
+ ns = await requireNamespace(c, opts.namespace) || undefined;
28
+ if (!ns)
29
+ return 1;
30
+ const resolved = await resolveNote({ remote: c.remote, token, ns }, ref);
31
+ if (!resolved)
32
+ return 1;
33
+ id = resolved;
34
+ }
35
+ row = await requestJson(c.remote, `/notes/${encodeURIComponent(id)}`, { token });
36
+ ns = row.namespaceSlug;
37
+ if (!ns || (opts.namespace && opts.namespace !== ns)) {
38
+ fail("note namespace missing or does not match --namespace");
39
+ return 1;
40
+ }
41
+ }
42
+ else {
43
+ ns = await requireNamespace(c, opts.namespace) || undefined;
44
+ if (!ns)
45
+ return 1;
46
+ row = await requestJson(c.remote, `/namespaces/${encodeURIComponent(ns)}/artifacts/${encodeURIComponent(id)}`, { token });
47
+ }
48
+ const base = `/namespaces/${encodeURIComponent(ns)}/${kind === "notes" ? "notes" : "artifacts"}/${encodeURIComponent(id)}`;
49
+ const canManage = kind === "notes" ? row.permissions?.share : row.viewerCanManage;
50
+ // The artifact mutation endpoint is an upsert: preflight avoids creating a
51
+ // catalog stub or restoring an already-deleted artifact on an ordinary call.
52
+ if (operation !== "get" && !canManage) {
53
+ fail("not allowed to manage sharing for this resource");
54
+ return 1;
55
+ }
56
+ if (operation === "access") {
57
+ const result = await requestJson(c.remote, `${base}/share/access`, { token });
58
+ if (opts.json)
59
+ emitJson(result);
60
+ else {
61
+ process.stdout.write(renderTable(result.access.map(person => ({
62
+ "USER ID": person.userId, NAME: person.name ?? person.email ?? "",
63
+ "STORED ROLE": person.role, "LAST SEEN": person.lastSeenAt,
64
+ })), ["USER ID", "NAME", "STORED ROLE", "LAST SEEN"]));
65
+ process.stdout.write("Stored roles may lag the live link role; inspect it with share get.\n");
66
+ }
67
+ return 0;
68
+ }
69
+ if (operation === "remove") {
70
+ if (!opts.userId) {
71
+ fail("user id required");
72
+ return 1;
73
+ }
74
+ await requestJson(c.remote, `${base}/share/access/${encodeURIComponent(opts.userId)}`, { token, method: "DELETE" });
75
+ if (opts.json)
76
+ emitJson({ removed: opts.userId });
77
+ else
78
+ process.stdout.write(`Removed accepted access for ${opts.userId}. A valid link can admit them again.\n`);
79
+ return 0;
80
+ }
81
+ if (operation !== "get") {
82
+ const isNote = kind === "notes";
83
+ row = await requestJson(c.remote, base + (isNote && operation !== "visibility" ? "/share" : ""), {
84
+ token,
85
+ method: isNote ? (operation === "visibility" ? "PATCH" : operation === "revoke" ? "DELETE" : "PUT") : "POST",
86
+ ...(operation === "visibility" ? { json: { visibility: opts.visibility } }
87
+ : isNote ? operation === "create" ? { json: { role: opts.role ?? "read" } }
88
+ : { query: { revokeAccepted: opts.revokeAccepted ? "true" : undefined } }
89
+ : { json: { share: operation === "create" } }),
90
+ });
91
+ }
92
+ const url = `${webBase(c.remote)}/${encodeURIComponent(ns)}/${kind === "notes" ? "notes" : "artifacts"}/${encodeURIComponent(id)}`;
93
+ const result = {
94
+ url, visibility: row.visibility,
95
+ publicUrl: row.visibility === "public" ? url : null,
96
+ shareUrl: row.shareToken ? `${url}?share=${encodeURIComponent(row.shareToken)}` : null,
97
+ shareRole: kind === "notes" ? row.shareRole ?? null : row.shareToken ? "read" : null,
98
+ // An omitted token is redacted, not evidence that sharing is disabled.
99
+ shareStatus: row.shareToken === undefined ? "unavailable" : row.shareToken ? "enabled" : "disabled",
100
+ };
101
+ if (opts.json)
102
+ emitJson(result);
103
+ else {
104
+ process.stdout.write(`Resource: ${url}\nVisibility: ${row.visibility ?? "unknown"}\n`);
105
+ process.stdout.write(result.shareUrl ? `Share (${result.shareRole}): ${result.shareUrl}\n` : `Share link: ${result.shareStatus}\n`);
106
+ if (kind === "notes" && operation === "revoke")
107
+ process.stdout.write(opts.revokeAccepted
108
+ ? "Link revoked and acceptance records deleted. Existing room sessions may continue until the room is rotated.\n"
109
+ : "Link revoked; link-derived access is disabled. Acceptance records remain and can regain access if sharing is re-enabled. Existing room sessions may continue until the room is rotated.\n");
110
+ }
111
+ return 0;
112
+ }
113
+ catch (error) {
114
+ fail(error instanceof Error ? error.message : String(error));
115
+ return 1;
116
+ }
117
+ }
118
+ export function registerShareCommands(parent, kind) {
119
+ const share = parent.command("share").description("get and manage share links without changing content");
120
+ for (const operation of ["get", "create", "revoke", ...(kind === "notes" ? ["access", "remove"] : [])]) {
121
+ let cmd = share.command(operation).argument("<resource>", "resource id (Notes also accept a name or slug)")
122
+ .description({ get: "inspect existing links without enabling sharing", create: "enable a share link (reuse an existing token)", revoke: "disable the share link", access: "list Note acceptance records (stored roles may lag)", remove: "remove one accepted Note grant", visibility: "set visibility" }[operation]);
123
+ if (operation === "create" && kind === "notes")
124
+ cmd.option("--role <role>", "read or write; applies to all link-derived access on subsequent requests", "read");
125
+ if (operation === "revoke" && kind === "notes")
126
+ cmd.option("--revoke-accepted", "also delete acceptance records; re-enabling will require fresh acceptance");
127
+ if (operation === "remove")
128
+ cmd.argument("<user-id>", "user id from share access");
129
+ cmd = withConnFlags(cmd.option("--namespace <slug>", "namespace").option("--json", "emit structured JSON"));
130
+ if (operation === "remove")
131
+ cmd.action(async (ref, userId, opts) => { process.exit(await runShare(kind, operation, ref, { ...opts, userId })); });
132
+ else
133
+ cmd.action(async (ref, opts) => { process.exit(await runShare(kind, operation, ref, opts)); });
134
+ }
135
+ withConnFlags(parent.command("visibility").argument("<resource>").argument("<visibility>", "private or public")
136
+ .description("set read visibility; does not revoke share links or accepted access")
137
+ .option("--namespace <slug>", "namespace").option("--json", "emit structured JSON"))
138
+ .action(async (ref, visibility, opts) => { process.exit(await runShare(kind, "visibility", ref, { ...opts, visibility })); });
139
+ }
@@ -0,0 +1,141 @@
1
+ import type { SkillSourceKind } from "./manifest.js";
2
+ export interface CatalogSkill {
3
+ description: string;
4
+ requires: string[];
5
+ tools?: unknown;
6
+ /** Number of files, or their paths, when the catalog carries it. */
7
+ files?: unknown;
8
+ }
9
+ /** What the release says about one of its assets, when it does. */
10
+ export interface CatalogAsset {
11
+ /** Lower-case hex sha256 of the asset's bytes. */
12
+ sha256?: string;
13
+ bytes?: number;
14
+ }
15
+ export interface SkillCatalog {
16
+ schema: number;
17
+ /** The release tag, e.g. `v2026.10.27`. */
18
+ version: string;
19
+ skills: Record<string, CatalogSkill>;
20
+ /** Old name → new name. */
21
+ renamed: Record<string, string>;
22
+ /**
23
+ * Release assets by file name. The release's `catalog.json` must carry
24
+ * `skills.tar.gz` here (the skills repository's package.py always writes
25
+ * it) or no tarball is downloaded; the committed copy in the skills
26
+ * repository (and so the embedded snapshot) does not have it and is never
27
+ * used to fetch.
28
+ */
29
+ assets?: Record<string, CatalogAsset>;
30
+ }
31
+ export interface EmbeddedManifest {
32
+ tag: string | null;
33
+ commit: string | null;
34
+ /** `<skill>/<relative path>` → sha256 hex. */
35
+ files: Record<string, string>;
36
+ }
37
+ /** A skill's files in memory, with where they came from. */
38
+ export interface SkillPayload {
39
+ name: string;
40
+ version: string | null;
41
+ source: SkillSourceKind;
42
+ files: Map<string, Buffer>;
43
+ }
44
+ export declare const SKILLS_ENV = "DREAMLAKE_SKILLS_DIR";
45
+ export declare const MANIFEST_ENV = "DREAMLAKE_SKILLS_MANIFEST_FILE";
46
+ export declare const CATALOG_ENV = "DREAMLAKE_SKILLS_CATALOG_FILE";
47
+ export declare const RELEASE_ENV = "DREAMLAKE_SKILLS_RELEASE_URL";
48
+ export declare const RELEASE_BASE = "https://github.com/dreamlake-ai/dreamlake-skills/releases";
49
+ export declare const EMBEDDED_ROOT = "embedded-skills";
50
+ export declare const EMBEDDED_SKILL = "dreamlake-cli";
51
+ /** The release asset holding every skill directory. */
52
+ export declare const TARBALL_ASSET = "skills.tar.gz";
53
+ /**
54
+ * Side files `scripts/fetch-skills.mjs` leaves beside the skill directory.
55
+ * The names are a contract with that script and with `scripts/native-skills.ts`,
56
+ * which embeds the same manifest; change all three together.
57
+ */
58
+ export declare const BUNDLE_MANIFEST_FILE = ".manifest.json";
59
+ export declare const BUNDLE_CATALOG_FILE = "catalog.json";
60
+ export declare function resolveBundleDir(): string | null;
61
+ /**
62
+ * Bundled skill names — directories only. A loose `.md` is not a skill, and
63
+ * neither is a dot-directory (the fetch script stages into one before it
64
+ * swaps the real directory in).
65
+ */
66
+ export declare function listBundledSkills(bundleDir: string): string[];
67
+ export declare function bundledFiles(bundleDir: string, name: string): string[];
68
+ export declare function bundledBytes(bundleDir: string, name: string, rel: string): Buffer;
69
+ /**
70
+ * The embedded manifest: tag, commit and per-file hashes of the bundled
71
+ * skill. From the define, else `DREAMLAKE_SKILLS_MANIFEST_FILE`, else
72
+ * `<bundle>/.manifest.json`, else computed from the files with no version.
73
+ */
74
+ export declare function embeddedManifest(bundleDir?: string | null): EmbeddedManifest | null;
75
+ /** The version the embedded bundle was cut from: its tag, else its commit. */
76
+ export declare function embeddedVersion(bundleDir?: string | null): string | null;
77
+ /**
78
+ * The catalog snapshot the CLI carries. From the define, else
79
+ * `DREAMLAKE_SKILLS_CATALOG_FILE`, else `<bundle>/catalog.json`, else null.
80
+ */
81
+ export declare function embeddedCatalog(bundleDir?: string | null): SkillCatalog | null;
82
+ export declare function embeddedPayload(bundleDir: string, name: string): SkillPayload;
83
+ export declare function normalizeCatalog(raw: unknown): SkillCatalog;
84
+ /** File count a catalog entry advertises, when it does. */
85
+ export declare function catalogFileCount(entry: CatalogSkill | undefined): number | null;
86
+ /** `v2026.10.27` and `2026.10.27` are the same release. */
87
+ export declare function versionsEqual(a: string | null | undefined, b: string | null | undefined): boolean;
88
+ /** Display form: one leading `v` for a tag; a commit pin shows its first 12 hex digits. */
89
+ export declare function fmtVersion(v: string | null | undefined): string;
90
+ /** `-1`: candidate is older. `0`: the same version. `1`: candidate is newer. `null`: not comparable. */
91
+ export type VersionOrder = -1 | 0 | 1 | null;
92
+ /**
93
+ * Order two versions. Identical strings (modulo the leading `v`) are the
94
+ * same version whatever their form, and two absent versions are too; two
95
+ * different release tags `vYYYY.MM.DD[.N]` order by date; anything else —
96
+ * a commit pin, an unknown format, one side missing — is not comparable,
97
+ * and the installer never guesses which is newer.
98
+ */
99
+ export declare function compareVersions(candidate: string | null | undefined, installed: string | null | undefined): VersionOrder;
100
+ /** True only when both are release tags and `candidate` is strictly newer. */
101
+ export declare function isNewerVersion(candidate: string | null | undefined, installed: string | null | undefined): boolean;
102
+ /**
103
+ * `catalog-unreachable`: the release could not be read at all — a person can
104
+ * download by hand. `integrity`: it was read, but the tarball's bytes are not
105
+ * the ones its catalog names — nothing from it may be written.
106
+ */
107
+ export type ReleaseErrorKind = "catalog-unreachable" | "integrity";
108
+ export declare class ReleaseError extends Error {
109
+ readonly url: string;
110
+ readonly kind: ReleaseErrorKind;
111
+ constructor(message: string, url: string, kind?: ReleaseErrorKind);
112
+ }
113
+ export type ReleaseSource = {
114
+ kind: "http";
115
+ base: string;
116
+ } | {
117
+ kind: "dir";
118
+ dir: string;
119
+ };
120
+ export declare function releaseSource(): ReleaseSource;
121
+ export declare function catalogUrl(source?: ReleaseSource): string;
122
+ export declare function tarballUrl(version: string | null, source?: ReleaseSource): string;
123
+ /** The address a person can download by hand when the CLI cannot. */
124
+ export declare function manualDownloadUrl(source?: ReleaseSource): string;
125
+ /** The latest `catalog.json`. Throws `ReleaseError` when it cannot be had. */
126
+ export declare function fetchLatestCatalog(source?: ReleaseSource): Promise<SkillCatalog>;
127
+ /**
128
+ * `skills.tar.gz` for the catalog's version, falling back to the latest asset
129
+ * when the tagged one is missing. The release catalog must name the
130
+ * tarball's sha256 under `assets["skills.tar.gz"]`: without it nothing is
131
+ * downloaded, and a download whose bytes do not hash to it is refused. Both
132
+ * are a `ReleaseError` of kind `integrity`. (The committed catalog, and so
133
+ * the embedded snapshot, never carries `assets`; it is never used to fetch.)
134
+ */
135
+ export declare function fetchSkillsTarball(catalog: Pick<SkillCatalog, "version" | "assets">, source?: ReleaseSource): Promise<Buffer>;
136
+ /**
137
+ * Pull `names` out of a release tarball as payloads. The tarball's top-level
138
+ * entries are skill directories; anything else is ignored. A name missing
139
+ * from the archive is simply absent from the result.
140
+ */
141
+ export declare function extractSkills(tgz: Buffer, names: Iterable<string>, version: string | null): Map<string, SkillPayload>;