@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,279 @@
1
+ import { collectionList } from "../collection-list.js";
2
+ import { inspectHostCatalog, changeHostCatalog, formatHostCatalog } from "./catalog.js";
3
+ import { registerHostLifecycleCommands } from "./lifecycle.js";
4
+ import { registerHostSshCommands } from "./ssh.js";
5
+ import { resolveRemote, resolveToken } from '../config.js';
6
+ import { saveCredentials } from './credentials.js';
7
+ import { enrollHost, hostStatus } from "./enroll.js";
8
+ import { resolveEnrollment } from "./config.js";
9
+ import { randomUUID } from "node:crypto";
10
+ import { hostRequest, HostApiError } from "./api.js";
11
+ import { listHosts, resolveHostNamespace, formatHostsList, formatHostStatus } from "./inventory.js";
12
+ import { inspectHostEnrollments, formatHostEnrollments } from "./enrollments.js";
13
+ import { readHostMetrics, checkHostAction, formatHostMetrics, formatHostActionCheck } from "./observations.js";
14
+ /** Human enrollment summary. JSON callers receive the original structured receipt. */
15
+ export function formatEnrollmentText(output) {
16
+ const lines = [output.enrolled
17
+ ? `Registered ${output.host?.name ?? "host"}. Nymph is online.`
18
+ : `Enrollment pending for ${output.host?.name ?? "host"}.`];
19
+ for (const [label, value] of [
20
+ ["Host ID", output.host?.id], ["Enrollment ID", output.enrollment?.id],
21
+ ["Machine ID", output.enrollment?.machineId], ["Request ID", output.requestId],
22
+ ["Operation ID", output.operationId],
23
+ ])
24
+ if (value)
25
+ lines.push(`${label}: ${value}`);
26
+ if (output.webTerminal?.status)
27
+ lines.push(`Web terminal: ${output.webTerminal.status}`);
28
+ if (output.message)
29
+ lines.push(output.message);
30
+ if (output.credentials?.status && !["not_requested", "declined"].includes(output.credentials.status)) {
31
+ lines.push(`Credential saving: ${output.credentials.status}`);
32
+ }
33
+ return lines.join("\n");
34
+ }
35
+ export async function runHostsEnroll(opts) {
36
+ const warnings = opts.local ? [] : ['Saving selected SSH credentials enables account access from other devices; it does not authorize DreamLake backend services to initiate SSH. Normal nymph operation needs no saved SSH credential.'];
37
+ const credentialState = { credentialSaveRequested: opts.saveCredentials === true, credentialsSaved: false, warnings };
38
+ if (!opts.json && opts.saveCredentials && warnings.length)
39
+ console.error(warnings[0]);
40
+ let inputValidated = false;
41
+ try {
42
+ const plan = resolveEnrollment(opts);
43
+ if (plan.local)
44
+ warnings.length = 0;
45
+ inputValidated = true;
46
+ if (!opts.dryRun) {
47
+ opts.requestId ??= randomUUID();
48
+ if (!/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/.test(opts.requestId))
49
+ throw new Error("Invalid enrollment request ID");
50
+ if (!opts.json && !opts.quiet)
51
+ console.error(`Enrollment request ID: ${opts.requestId}. Reuse --request-id with the same inputs after an interrupted request.`);
52
+ const connection = { remote: resolveRemote(), token: resolveToken() };
53
+ const result = await enrollHost(plan, opts, { request: (path, method, body) => hostRequest(path, method, body, connection) });
54
+ const credentials = await saveCredentials(result, plan, opts, connection);
55
+ const output = { ...result, requestId: opts.requestId, ...credentialState, credentials, credentialsSaved: credentials.status === 'saved' };
56
+ if (opts.json)
57
+ console.log(JSON.stringify(output, null, 2));
58
+ else
59
+ console.log(formatEnrollmentText(output));
60
+ return result.enrolled && result.webTerminal?.status !== 'pending' && ['saved', 'declined', 'not_requested'].includes(credentials.status) ? 0 : 1;
61
+ }
62
+ const result = { status: "validated", enrolled: false, authorizationVerified: false, ...credentialState, plan };
63
+ if (opts.json)
64
+ console.log(JSON.stringify(result, null, 2));
65
+ else {
66
+ console.log(`Validated enrollment input for ${plan.name}.`);
67
+ console.log(plan.local ? "Register this computer as the current Unix user (no SSH)." : `SSH arguments: ${JSON.stringify(plan.ssh.args)}`);
68
+ console.log("No host was contacted or enrolled; namespace authorization and runtime readiness have not been checked.");
69
+ }
70
+ return 0;
71
+ }
72
+ catch (error) {
73
+ const message = error instanceof Error ? error.message : String(error);
74
+ const recovery = {
75
+ ...(opts.requestId && /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/.test(opts.requestId) ? { requestId: opts.requestId } : {}),
76
+ ...(error instanceof HostApiError ? { operationId: error.operationId, retryAt: error.retryAt } : {}),
77
+ };
78
+ if (opts.json)
79
+ console.log(JSON.stringify({ status: inputValidated ? "error" : "invalid", enrolled: false, ...credentialState, ...recovery, error: message }));
80
+ else {
81
+ console.error(`Host enrollment: ${message}`);
82
+ if (recovery.requestId)
83
+ console.error(`Request ID: ${recovery.requestId}. Retry the same inputs with --request-id ${recovery.requestId}.`);
84
+ if (recovery.operationId)
85
+ console.error(`Operation ID: ${recovery.operationId}`);
86
+ if (recovery.retryAt)
87
+ console.error(`Retry after: ${recovery.retryAt}`);
88
+ }
89
+ return 1;
90
+ }
91
+ }
92
+ export function registerHostsCommand(program) {
93
+ const group = program.command("hosts").description("enroll, inspect, connect to, and manage hosts");
94
+ const consentFlags = new Set();
95
+ const repeat = (value, previous) => [...previous, value];
96
+ group
97
+ .command("enroll")
98
+ .description("install and enroll nymph locally or through SSH, then verify its connection; readable text by default, JSON with --json")
99
+ .option("-n, --name <name>", "namespace/group/host, or host with --prefix")
100
+ .option("-p, --prefix <namespace/group>", "prefix for the host name")
101
+ .option("--local", "register this Linux or macOS computer as the current user without SSH")
102
+ .option("--ssh <arguments>", "SSH destination or quoted SSH arguments followed by destination")
103
+ .option("--web-terminal", "enable web terminal and authorize access for this enrollment (default)")
104
+ .option("--no-web-terminal", "enroll without web terminal access")
105
+ .option("--config <path>", "enrollment JSON file; explicit CLI fields override file fields")
106
+ .option("--wait-seconds <seconds>", "wait for backend-confirmed online status (default 60)")
107
+ .option("--request-id <id>", "idempotency key for enrollment API retries")
108
+ .option("--lakeshore-id <id>", "select the namespace control-plane connection")
109
+ .option("--nymph-version <version>", "installer version when nymph is missing (default latest)")
110
+ .option("--dry-run", "validate configuration without contacting the host or checking authorization")
111
+ .option("--save-credentials", "consent to saving explicitly selected target/jump credentials after enrollment")
112
+ .option("--no-save-credentials", "decline credential saving")
113
+ .option("-q, --quiet", "suppress progress; does not grant or suppress saving consent")
114
+ .option("--target-password <name>", "personal vault path for target password (masked input)", repeat, [])
115
+ .option("--target-key <name=path>", "explicit target private-key export", repeat, [])
116
+ .option("--jump-password <endpoint=name>", "separately selected jump password", repeat, [])
117
+ .option("--jump-key <endpoint=name=path>", "separately selected jump private-key export", repeat, [])
118
+ .option("--password-fd <name=fd>", "read selected password from inherited pipe/private-file descriptor", repeat, [])
119
+ .option("--json", "emit a machine-readable JSON result (default: readable text)")
120
+ .on('option:save-credentials', () => consentFlags.add('save'))
121
+ .on('option:no-save-credentials', () => consentFlags.add('no-save'))
122
+ .action(async (opts, command) => {
123
+ if (command.getOptionValueSource("webTerminal") === "default")
124
+ delete opts.webTerminal;
125
+ const conflict = consentFlags.size > 1;
126
+ consentFlags.clear();
127
+ if (conflict) {
128
+ console.error('Choose --save-credentials or --no-save-credentials');
129
+ process.exitCode = 1;
130
+ return;
131
+ }
132
+ process.exitCode = await runHostsEnroll(opts);
133
+ });
134
+ collectionList(group, "list").description("list active (verified online) hosts across all groups and pages in one namespace")
135
+ .option("--namespace <namespace>", "namespace slug (default: signed-in personal namespace)")
136
+ .option("--group <group>", "limit to one group")
137
+ .option("--archived <mode>", "catalog visibility: exclude (default), include, or only")
138
+ .option("--all", "include offline hosts and hosts with unknown connection state")
139
+ .option("--json", "emit machine-readable output")
140
+ .action(async (opts) => {
141
+ try {
142
+ const result = await listHosts({ namespace: await resolveHostNamespace(opts.namespace), group: opts.group, archived: opts.archived, all: opts.all });
143
+ console.log(opts.json ? JSON.stringify(result, null, 2) : formatHostsList(result, opts.all));
144
+ }
145
+ catch (error) {
146
+ const message = error instanceof Error ? error.message : "Host listing failed";
147
+ if (opts.json)
148
+ console.log(JSON.stringify({ status: "error", error: message }));
149
+ else
150
+ console.error(message);
151
+ process.exitCode = 1;
152
+ }
153
+ });
154
+ group.command("enrollments").description("inspect enrollment identities and observed presence for one host; read-only")
155
+ .argument("<selector>", "host ID or namespace/group/host")
156
+ .option("--namespace <namespace>", "namespace for a host ID (default: signed-in personal namespace)")
157
+ .option("--json", "emit machine-readable enrollment details and observed presence freshness")
158
+ .action(async (selector, opts) => {
159
+ try {
160
+ const result = await inspectHostEnrollments(selector, opts);
161
+ console.log(opts.json ? JSON.stringify(result, null, 2) : formatHostEnrollments(result));
162
+ }
163
+ catch (error) {
164
+ const message = error instanceof HostApiError && [403, 404].includes(error.status ?? 0)
165
+ ? "Host not found or not accessible" : error instanceof Error ? error.message : "Enrollment inspection failed";
166
+ if (opts.json)
167
+ console.log(JSON.stringify({ status: "error", error: message }));
168
+ else
169
+ console.error(message);
170
+ process.exitCode = 1;
171
+ }
172
+ });
173
+ group.command("metrics").description("read timestamped CPU, RAM, and disk observations for one enrollment")
174
+ .argument("<selector>", "host ID or namespace/group/host")
175
+ .requiredOption("--enrollment <id>", "exact enrollment ID from hosts enrollments")
176
+ .option("--namespace <namespace>", "namespace for a host ID (default: signed-in personal namespace)")
177
+ .option("--resolution <seconds>", "history resolution: 10, 60, 900, or 3600 seconds", "60")
178
+ .option("--json", "emit latest sample, retained history, and freshness")
179
+ .action(async (selector, opts) => {
180
+ try {
181
+ const result = await readHostMetrics(selector, opts);
182
+ console.log(opts.json ? JSON.stringify(result, null, 2) : formatHostMetrics(result));
183
+ }
184
+ catch (error) {
185
+ const message = error instanceof Error ? error.message : "Host metrics failed";
186
+ if (opts.json)
187
+ console.log(JSON.stringify({ status: "error", error: message }));
188
+ else
189
+ console.error(message);
190
+ process.exitCode = 1;
191
+ }
192
+ });
193
+ group.command("check").description("read observed action capability for one enrollment; does not execute the action")
194
+ .argument("<selector>", "host ID or namespace/group/host")
195
+ .requiredOption("--enrollment <id>", "exact enrollment ID from hosts enrollments")
196
+ .requiredOption("--action <action>", "ssh or tracked-run (ordinary uv-run/uvx)")
197
+ .option("--namespace <namespace>", "namespace for a host ID (default: signed-in personal namespace)")
198
+ .option("--json", "emit the backend readiness verdict and observation timestamps")
199
+ .action(async (selector, opts) => {
200
+ try {
201
+ const result = await checkHostAction(selector, opts);
202
+ console.log(opts.json ? JSON.stringify(result, null, 2) : formatHostActionCheck(result));
203
+ process.exitCode = result.readiness === "ready" ? 0 : 1;
204
+ }
205
+ catch (error) {
206
+ const message = error instanceof Error ? error.message : "Host action check failed";
207
+ if (opts.json)
208
+ console.log(JSON.stringify({ status: "error", error: message }));
209
+ else
210
+ console.error(message);
211
+ process.exitCode = 1;
212
+ }
213
+ });
214
+ group.command("lifecycle").description("read catalog archive state; not runtime retirement")
215
+ .argument("<host-id>", "exact lowercase Host ID")
216
+ .option("--namespace <namespace>", "namespace slug")
217
+ .option("--json", "emit the catalog state")
218
+ .action(async (id, opts) => {
219
+ try {
220
+ const result = await inspectHostCatalog(id, opts);
221
+ console.log(opts.json ? JSON.stringify(result, null, 2) : formatHostCatalog(result));
222
+ }
223
+ catch (error) {
224
+ const message = error instanceof Error ? error.message : "Host catalog read failed";
225
+ if (opts.json)
226
+ console.log(JSON.stringify({ status: "error", error: message }));
227
+ else
228
+ console.error(message);
229
+ process.exitCode = 1;
230
+ }
231
+ });
232
+ for (const action of ["archive", "restore"]) {
233
+ group.command(action).description(`${action} catalog visibility only; runtime and future work remain active`)
234
+ .argument("<host-id>", "exact lowercase Host ID")
235
+ .requiredOption("--request-id <id>", "stable request ID; preserve for exact retries")
236
+ .requiredOption("--expected-revision <number>", "revision from hosts lifecycle; never auto-refreshed")
237
+ .option("--namespace <namespace>", "namespace slug")
238
+ .option("--json", "emit the stored operation receipt")
239
+ .action(async (id, opts) => {
240
+ try {
241
+ const result = await changeHostCatalog(id, action, opts);
242
+ console.log(opts.json ? JSON.stringify(result, null, 2) : formatHostCatalog(result));
243
+ }
244
+ catch (error) {
245
+ const message = error instanceof Error ? error.message : "Host catalog change failed";
246
+ const retry = { hostId: id, action, requestId: opts.requestId, expectedRevision: opts.expectedRevision };
247
+ if (opts.json)
248
+ console.log(JSON.stringify({ status: "error", error: message, retry }));
249
+ else
250
+ console.error(`${message}\nIf the outcome is unknown, retry the same host/action/request ID/expected revision.`);
251
+ process.exitCode = 1;
252
+ }
253
+ });
254
+ }
255
+ group.command("status").description("inspect a host's backend-reported connection and enrollments")
256
+ .argument("<selector>", "host ID, namespace/group/host or quoted namespace/group/*")
257
+ .option("--namespace <namespace>", "namespace for a host ID (default: signed-in personal namespace)")
258
+ .option("--page <number>", "group listing page (default 1)")
259
+ .option("--page-size <number>", "listing page size (default 100, maximum 100)")
260
+ .option("--json", "emit machine-readable output")
261
+ .action(async (selector, opts) => {
262
+ try {
263
+ const result = await hostStatus(selector, opts);
264
+ // Preserve the existing paginated group response, including without --json.
265
+ console.log(opts.json || selector.endsWith("/*") ? JSON.stringify(result, null, 2) : formatHostStatus(result));
266
+ }
267
+ catch (error) {
268
+ const message = error instanceof HostApiError && [403, 404].includes(error.status ?? 0)
269
+ ? "Host not found or not accessible" : error instanceof Error ? error.message : "Host status failed";
270
+ if (opts.json)
271
+ console.log(JSON.stringify({ status: "error", error: message }));
272
+ else
273
+ console.error(message);
274
+ process.exitCode = 1;
275
+ }
276
+ });
277
+ registerHostSshCommands(group, program);
278
+ registerHostLifecycleCommands(group);
279
+ }
@@ -0,0 +1,40 @@
1
+ import { hostRequest } from "./api.js";
2
+ export declare function resolveHostNamespace(explicit?: string): Promise<string>;
3
+ export interface HostEnrollmentStatus {
4
+ id: string;
5
+ machineId?: string;
6
+ unixUser?: string;
7
+ state?: string;
8
+ statusVerified?: boolean;
9
+ lastSeenAt?: string | null;
10
+ }
11
+ export interface HostSummary {
12
+ id: string;
13
+ name: string;
14
+ enrollments?: HostEnrollmentStatus[];
15
+ catalog?: {
16
+ catalogState: "active" | "archived";
17
+ revision: number;
18
+ archivedAt: string | null;
19
+ };
20
+ }
21
+ export interface HostInventory {
22
+ namespace: string;
23
+ group?: string;
24
+ hosts: HostSummary[];
25
+ total: number;
26
+ }
27
+ /** The namespace-scoped API enforces ownership; an omitted prefix spans groups. */
28
+ export declare function listHosts(opts: {
29
+ namespace: string;
30
+ group?: string;
31
+ archived?: string;
32
+ all?: boolean;
33
+ }, request?: typeof hostRequest): Promise<HostInventory>;
34
+ /** A stored state without a verified runtime observation is not availability. */
35
+ export declare function hostConnection(enrollments?: HostEnrollmentStatus[]): string;
36
+ export declare function formatHostsList(result: HostInventory, all?: boolean): string;
37
+ export declare function formatHostStatus(result: {
38
+ host: HostSummary;
39
+ enrollments?: HostEnrollmentStatus[];
40
+ }): string;
@@ -0,0 +1,91 @@
1
+ import { resolveNamespace, resolveRemote, resolveToken } from "../config.js";
2
+ import { hostApiPath, hostRequest } from "./api.js";
3
+ const segment = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
4
+ export async function resolveHostNamespace(explicit) {
5
+ if (explicit !== undefined) {
6
+ if (!segment.test(explicit))
7
+ throw new Error("Invalid --namespace; use one namespace slug");
8
+ return explicit;
9
+ }
10
+ const token = resolveToken();
11
+ if (!token)
12
+ throw new Error("Log in to DreamLake before inspecting hosts");
13
+ const namespace = await resolveNamespace(undefined, { token, remote: resolveRemote() });
14
+ if (!namespace || !segment.test(namespace))
15
+ throw new Error("Could not resolve a namespace; pass --namespace");
16
+ return namespace;
17
+ }
18
+ /** The namespace-scoped API enforces ownership; an omitted prefix spans groups. */
19
+ export async function listHosts(opts, request = hostRequest) {
20
+ if (!segment.test(opts.namespace))
21
+ throw new Error("Invalid --namespace; use one namespace slug");
22
+ if (opts.group !== undefined && !segment.test(opts.group))
23
+ throw new Error("Invalid --group; use one group name");
24
+ if (opts.archived !== undefined && !["exclude", "include", "only"].includes(opts.archived))
25
+ throw new Error("--archived must be exclude, include, or only");
26
+ const hosts = [];
27
+ const seen = new Set();
28
+ for (let page = 1;; page++) {
29
+ const query = new URLSearchParams({ page: String(page), pageSize: "100" });
30
+ if (opts.archived !== undefined)
31
+ query.set("archived", opts.archived);
32
+ if (opts.group !== undefined)
33
+ query.set("prefix", `${opts.namespace}/${opts.group}`);
34
+ const result = await request(`${hostApiPath(opts.namespace)}?${query}`);
35
+ if (!result || !Array.isArray(result.hosts) || !Number.isInteger(result.totalPages) ||
36
+ result.totalPages < 0 || result.totalPages > 100_000 || result.page !== page ||
37
+ (result.totalPages === 0 && result.hosts.length > 0)) {
38
+ throw new Error("Host API returned invalid listing pagination");
39
+ }
40
+ for (const host of result.hosts) {
41
+ if (!host || typeof host.id !== "string" || typeof host.name !== "string") {
42
+ throw new Error("Host API returned an invalid host");
43
+ }
44
+ // Offset pages may overlap if the inventory changes during this read.
45
+ if (!seen.has(host.id)) {
46
+ seen.add(host.id);
47
+ hosts.push(host);
48
+ }
49
+ }
50
+ if (page >= result.totalPages)
51
+ break;
52
+ }
53
+ const visible = opts.all ? hosts : hosts.filter(host => hostConnection(host.enrollments) === "online");
54
+ return { namespace: opts.namespace, ...(opts.group !== undefined ? { group: opts.group } : {}), hosts: visible, total: visible.length };
55
+ }
56
+ /** A stored state without a verified runtime observation is not availability. */
57
+ export function hostConnection(enrollments = []) {
58
+ if (enrollments.some(e => e.statusVerified === true && e.state === "online"))
59
+ return "online";
60
+ if (!enrollments.length || enrollments.some(e => e.statusVerified !== true))
61
+ return "unknown";
62
+ return enrollments.every(e => e.state === "offline") ? "offline" : "unknown";
63
+ }
64
+ function cell(value) {
65
+ return typeof value === "string" && value ? value.replace(/[\x00-\x1f\x7f-\x9f]/g, " ") : "unknown";
66
+ }
67
+ function table(rows) {
68
+ const widths = rows[0].map((_, i) => rows.reduce((width, row) => Math.max(width, row[i].length), 0));
69
+ return rows.map(row => row.map((value, i) => i === row.length - 1 ? value : value.padEnd(widths[i])).join(" ")).join("\n");
70
+ }
71
+ export function formatHostsList(result, all = false) {
72
+ const rows = [["ID", "NAME", "CATALOG", "CONNECTION"], ...result.hosts.map(host => [cell(host.id), cell(host.name), cell(host.catalog?.catalogState), hostConnection(host.enrollments)])];
73
+ return `Namespace: ${result.namespace}\n${table(rows)}\n${result.total} hosts. ${result.group ? `Group: ${result.group}.` : "All groups."} All pages.\n${all ? "All connection states." : "Active (verified online) only. Use --all to include offline and unknown hosts."}`;
74
+ }
75
+ export function formatHostStatus(result) {
76
+ const enrollments = result.enrollments ?? [];
77
+ const lines = [
78
+ `Host: ${cell(result.host.id)}`, `Name: ${cell(result.host.name)}`,
79
+ `Connection: ${hostConnection(enrollments)}`,
80
+ ...(result.host.catalog ? [`Catalog: ${result.host.catalog.catalogState}`, `Catalog revision: ${result.host.catalog.revision}`] : []),
81
+ "Power: unknown", "SSH: unknown", "Jobs: unknown",
82
+ ];
83
+ if (enrollments.length)
84
+ lines.push("", table([
85
+ ["ENROLLMENT", "USER", "REPORTED STATE", "VERIFIED", "LAST SEEN"],
86
+ ...enrollments.map(e => [cell(e.id), cell(e.unixUser), cell(e.state), e.statusVerified === true ? "yes" : "no", cell(e.lastSeenAt)]),
87
+ ]));
88
+ else
89
+ lines.push("No enrollments.");
90
+ return lines.join("\n");
91
+ }
@@ -0,0 +1,15 @@
1
+ import type { Command } from "commander";
2
+ import { hostRequest } from "./api.js";
3
+ export type PowerAction = "start" | "stop" | "restart" | "terminate";
4
+ export interface PowerOptions {
5
+ namespace?: string;
6
+ enrollment?: string;
7
+ requestId?: string;
8
+ allowActiveWork?: boolean;
9
+ volumes?: string;
10
+ json?: boolean;
11
+ }
12
+ export declare function readHostPower(selector: string, opts: PowerOptions, request?: typeof hostRequest): Promise<any>;
13
+ export declare function changeHostPower(selector: string, action: PowerAction, opts: PowerOptions, request?: typeof hostRequest): Promise<any>;
14
+ export declare function formatHostPower(result: any): string;
15
+ export declare function registerHostLifecycleCommands(group: Command): void;
@@ -0,0 +1,108 @@
1
+ import { hostApiPath, hostRequest, HostApiError } from "./api.js";
2
+ import { hostStatus } from "./enroll.js";
3
+ import { resolveHostNamespace } from "./inventory.js";
4
+ import { registerProviderLaunchCommand } from "../providers/index.js";
5
+ const ID = /^[a-f0-9]{24}$/i;
6
+ const REQUEST = /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/;
7
+ async function target(selector, opts, request) {
8
+ if (selector.includes("*"))
9
+ throw new Error("Select one host by ID or full name; wildcards are not supported");
10
+ if (selector.includes("/") && opts.namespace && selector.split("/")[0] !== opts.namespace)
11
+ throw new Error("--namespace conflicts with the host selector");
12
+ const namespace = await resolveHostNamespace(selector.includes("/") ? selector.split("/")[0] : opts.namespace);
13
+ const detail = await hostStatus(selector, { namespace }, request);
14
+ if (!ID.test(detail?.host?.id ?? ""))
15
+ throw new Error("Host API returned an invalid host identity");
16
+ const id = detail.host.id.toLowerCase();
17
+ if ((ID.test(selector) && id !== selector.toLowerCase()) || (!ID.test(selector) && detail.host.name !== selector))
18
+ throw new Error("Host API returned a different host identity");
19
+ return { id, path: `${hostApiPath(namespace)}/${id}/power` };
20
+ }
21
+ export async function readHostPower(selector, opts, request = hostRequest) {
22
+ const selected = await target(selector, opts, request);
23
+ const result = await request(selected.path);
24
+ if (result?.host?.id !== selected.id)
25
+ throw new Error("Host API returned a different host identity");
26
+ return result;
27
+ }
28
+ export async function changeHostPower(selector, action, opts, request = hostRequest) {
29
+ if (!["start", "stop", "restart", "terminate"].includes(action))
30
+ throw new Error("Invalid host power action");
31
+ if (!ID.test(opts.enrollment ?? ""))
32
+ throw new Error("--enrollment must be an exact enrollment ID");
33
+ if (!REQUEST.test(opts.requestId ?? ""))
34
+ throw new Error("--request-id must be a stable request ID (1–128 characters)");
35
+ if (action === "terminate" && opts.volumes !== "delete-on-termination")
36
+ throw new Error("terminate requires --volumes delete-on-termination (use the instance's AWS volume settings)");
37
+ if (action !== "terminate" && opts.volumes !== undefined)
38
+ throw new Error("--volumes applies only to terminate");
39
+ const selected = await target(selector, opts, request);
40
+ // One submission only. The server owns binding, active-work checks and replay.
41
+ const result = await request(`${selected.path}/${action}`, "POST", {
42
+ requestId: opts.requestId, enrollmentId: opts.enrollment.toLowerCase(), allowActiveWork: opts.allowActiveWork === true,
43
+ ...(action === "terminate" ? { volumes: opts.volumes } : {}),
44
+ });
45
+ if (result?.host?.id !== selected.id || result?.enrollmentId !== opts.enrollment.toLowerCase() || result?.action !== action ||
46
+ result?.receipt?.requestId !== opts.requestId || !ID.test(result?.receipt?.operationId ?? "") ||
47
+ result?.receipt?.status !== "committed") {
48
+ throw new Error("Invalid power receipt; recover with the same request ID and inputs");
49
+ }
50
+ return result;
51
+ }
52
+ export function formatHostPower(result) {
53
+ const lines = [`Host: ${result.host.name} (${result.host.id})`];
54
+ if (result.action) {
55
+ lines.push(`Power action: ${result.action}`, `Enrollment: ${result.enrollmentId}`);
56
+ if (result.receipt?.status)
57
+ lines.push(`Operation status: ${result.receipt.status}`);
58
+ if (result.receipt?.operationId)
59
+ lines.push(`Operation ID: ${result.receipt.operationId}`);
60
+ lines.push("Power request recorded; use hosts power to inspect the observed instance state.");
61
+ }
62
+ else {
63
+ lines.push(`Management: ${result.management}`, `Power: ${result.instance?.state ?? "unknown"}`);
64
+ if (result.observation?.error)
65
+ lines.push(`Observation: ${result.observation.error}`);
66
+ if (result.observation?.checkedAt)
67
+ lines.push(`Checked at: ${result.observation.checkedAt}`);
68
+ for (const binding of result.bindings ?? [])
69
+ lines.push(`Enrollment: ${binding.enrollmentId} → ${binding.providerId}/${binding.instanceId}`);
70
+ lines.push(`Recorded active tracked runs: ${result.activeWork?.trackedRuns ?? "unknown"}; other work may exist.`);
71
+ }
72
+ return lines.join("\n");
73
+ }
74
+ export function registerHostLifecycleCommands(group) {
75
+ registerProviderLaunchCommand(group, "create");
76
+ const common = (command) => command.argument("<selector>", "host ID or namespace/group/host")
77
+ .option("--namespace <namespace>", "namespace for a host ID")
78
+ .option("--json", "emit the full structured receipt");
79
+ const execute = async (opts, work) => {
80
+ try {
81
+ const result = await work();
82
+ console.log(opts.json ? JSON.stringify(result, null, 2) : formatHostPower(result));
83
+ }
84
+ catch (error) {
85
+ const message = error instanceof Error ? error.message : "Host power request failed";
86
+ const requestId = REQUEST.test(opts.requestId ?? "") ? opts.requestId : undefined;
87
+ if (opts.json)
88
+ console.log(JSON.stringify({ status: "error", error: message, requestId, ...(error instanceof HostApiError ? { code: error.code, operationId: error.operationId, retryAt: error.retryAt } : {}) }));
89
+ else {
90
+ console.error(message);
91
+ if (requestId)
92
+ console.error(`Request ID: ${requestId}. After an uncertain response, reuse this ID with identical inputs.`);
93
+ }
94
+ process.exitCode = 1;
95
+ }
96
+ };
97
+ common(group.command("power").description("inspect provider binding and observed machine power; read-only"))
98
+ .action((selector, opts) => execute(opts, () => readHostPower(selector, opts)));
99
+ for (const action of ["start", "stop", "restart", "terminate"]) {
100
+ const command = common(group.command(action).description(`${action} the provider-backed machine; does not stop only its daemon`))
101
+ .requiredOption("--enrollment <id>", "exact provider-bound enrollment from hosts power")
102
+ .requiredOption("--request-id <id>", "stable ID; reuse identical inputs after an uncertain response")
103
+ .option("--allow-active-work", "permit disrupting recorded active tracked runs; other work may also exist");
104
+ if (action === "terminate")
105
+ command.requiredOption("--volumes <policy>", "delete-on-termination: use AWS per-volume deletion settings");
106
+ command.action((selector, opts) => execute(opts, () => changeHostPower(selector, action, opts)));
107
+ }
108
+ }
@@ -0,0 +1,12 @@
1
+ /** Capabilities stay inside this read; the command returns only observations. */
2
+ export declare function readMetricsSource(descriptor: any, resolution: number, now: () => number, fetcher: typeof fetch): Promise<{
3
+ latest: null;
4
+ tiers: {};
5
+ stale: boolean;
6
+ } | {
7
+ latest: any;
8
+ tiers: {
9
+ [resolution]: any;
10
+ };
11
+ stale: boolean;
12
+ }>;
@@ -0,0 +1,89 @@
1
+ const MAX_BYTES = 2 * 1024 * 1024;
2
+ const SCALES = [10, 60, 900, 3600];
3
+ const record = (v) => !!v && typeof v === "object" && !Array.isArray(v);
4
+ const exact = (v, keys) => record(v) && Object.keys(v).length === keys.length && keys.every(k => Object.hasOwn(v, k));
5
+ const number = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0;
6
+ const integer = (v) => Number.isSafeInteger(v) && v >= 0;
7
+ const empty = () => ({ latest: null, tiers: {}, stale: true });
8
+ /** Capabilities stay inside this read; the command returns only observations. */
9
+ export async function readMetricsSource(descriptor, resolution, now, fetcher) {
10
+ if (descriptor.maxBytes !== MAX_BYTES)
11
+ throw new Error("Host API returned an invalid metrics Source");
12
+ if (descriptor.state === "pending" && descriptor.capability === null)
13
+ return empty();
14
+ const cap = descriptor.capability;
15
+ let url;
16
+ try {
17
+ url = new URL(cap?.url);
18
+ }
19
+ catch {
20
+ throw new Error("Host API returned an invalid metrics capability");
21
+ }
22
+ if (descriptor.state !== "ready" || cap.method !== "GET" || url.protocol !== "https:" || url.username || url.password || url.hash ||
23
+ cap.url.length > 16384 || !(Date.parse(cap.expiresAt) > now()) ||
24
+ (cap.allowedHeaders !== undefined && (!record(cap.allowedHeaders) || Object.keys(cap.allowedHeaders).length > 32 ||
25
+ Object.values(cap.allowedHeaders).some(v => typeof v !== "string" || v.length > 4096))))
26
+ throw new Error("Host API returned an invalid metrics capability");
27
+ let raw;
28
+ try {
29
+ const request = { method: "GET", headers: cap.allowedHeaders ?? {}, credentials: "omit",
30
+ redirect: "error", referrerPolicy: "no-referrer", cache: "no-store", signal: AbortSignal.timeout(30_000) };
31
+ const response = await fetcher(url, request);
32
+ if (response.status === 404) {
33
+ await response.body?.cancel();
34
+ return empty();
35
+ }
36
+ if (!response.ok || !response.body) {
37
+ await response.body?.cancel();
38
+ throw new Error();
39
+ }
40
+ const reader = response.body.getReader();
41
+ const chunks = [];
42
+ let bytes = 0;
43
+ try {
44
+ for (;;) {
45
+ const { done, value } = await reader.read();
46
+ if (done)
47
+ break;
48
+ bytes += value.byteLength;
49
+ if (bytes > MAX_BYTES) {
50
+ await reader.cancel();
51
+ throw new Error();
52
+ }
53
+ chunks.push(value);
54
+ }
55
+ }
56
+ finally {
57
+ reader.releaseLock();
58
+ }
59
+ raw = JSON.parse(Buffer.concat(chunks).toString("utf8"));
60
+ }
61
+ catch {
62
+ throw new Error("Metrics Source could not be read; no legacy fallback was attempted");
63
+ }
64
+ if (!exact(raw, ["latest", "tiers"]) || !record(raw.tiers))
65
+ throw new Error("Metrics Source returned invalid history");
66
+ if (raw.latest === null && Object.keys(raw.tiers).length === 0)
67
+ return empty();
68
+ const values = (v) => record(v) && Object.keys(v).length <= 256 && Object.entries(v).every(([k, n]) => k.length <= 96 && number(n));
69
+ if (!exact(raw.latest, ["timestamp", "values"]) || !integer(raw.latest.timestamp) || raw.latest.timestamp > now() / 1000 + 60 ||
70
+ !values(raw.latest.values) || !exact(raw.tiers, SCALES.map(String)))
71
+ throw new Error("Metrics Source returned invalid history");
72
+ for (const scale of SCALES) {
73
+ const tier = raw.tiers[scale];
74
+ let previous = -1;
75
+ if (!Array.isArray(tier) || tier.length > 1441)
76
+ throw new Error("Metrics Source returned invalid history");
77
+ for (const bucket of tier) {
78
+ // Restarts sample immediately; strictly increasing integer seconds bound samples by bucket width.
79
+ if (!exact(bucket, ["timestamp", "samples", "values"]) || !integer(bucket.timestamp) || bucket.timestamp <= previous ||
80
+ bucket.timestamp > raw.latest.timestamp || bucket.timestamp % scale !== 0 || !integer(bucket.samples) ||
81
+ bucket.samples < 1 || bucket.samples > scale || !record(bucket.values) || Object.keys(bucket.values).length > 256 ||
82
+ Object.entries(bucket.values).some(([key, v]) => key.length > 96 || !exact(v, ["mean", "peak", "count"]) ||
83
+ !number(v.mean) || !number(v.peak) || v.peak < v.mean || !integer(v.count) || v.count < 1 || v.count > bucket.samples))
84
+ throw new Error("Metrics Source returned invalid history");
85
+ previous = bucket.timestamp;
86
+ }
87
+ }
88
+ return { latest: raw.latest, tiers: { [resolution]: raw.tiers[resolution] }, stale: now() / 1000 - raw.latest.timestamp > 90 };
89
+ }