@dreamlake/dreamlake-cli 0.88.1 → 0.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/access.d.ts +83 -0
- package/dist/api/access.js +77 -0
- package/dist/api/agent.d.ts +156 -0
- package/dist/api/agent.js +111 -0
- package/dist/api/browser.d.ts +90 -0
- package/dist/api/browser.js +102 -0
- package/dist/api/client.d.ts +53 -0
- package/dist/api/client.js +102 -0
- package/dist/api/common.d.ts +28 -0
- package/dist/api/common.js +16 -0
- package/dist/api/content.d.ts +195 -0
- package/dist/api/content.js +147 -0
- package/dist/api/execution.d.ts +84 -0
- package/dist/api/execution.js +73 -0
- package/dist/api/http.d.ts +19 -0
- package/dist/api/http.js +66 -0
- package/dist/api/index.d.ts +2330 -0
- package/dist/api/index.js +114 -0
- package/dist/api/infra.d.ts +2 -0
- package/dist/api/infra.js +2 -0
- package/dist/api/jobs.d.ts +2 -0
- package/dist/api/jobs.js +2 -0
- package/dist/api/layout.d.ts +2 -0
- package/dist/api/layout.js +2 -0
- package/dist/api/library-edit.d.ts +3 -0
- package/dist/api/library-edit.js +3 -0
- package/dist/api/library-manifest.d.ts +2 -0
- package/dist/api/library-manifest.js +2 -0
- package/dist/api/note-character-plan.d.ts +2 -0
- package/dist/api/note-character-plan.js +2 -0
- package/dist/api/note-editing.d.ts +2 -0
- package/dist/api/note-editing.js +2 -0
- package/dist/api/note-edits.d.ts +21 -0
- package/dist/api/note-edits.js +10 -0
- package/dist/api/note-events.d.ts +5 -0
- package/dist/api/note-events.js +11 -0
- package/dist/api/note-files.d.ts +75 -0
- package/dist/api/note-files.js +65 -0
- package/dist/api/note-html-read.d.ts +2 -0
- package/dist/api/note-html-read.js +2 -0
- package/dist/api/note-html.d.ts +2 -0
- package/dist/api/note-html.js +2 -0
- package/dist/api/note-toc.d.ts +2 -0
- package/dist/api/note-toc.js +2 -0
- package/dist/api/notes.d.ts +304 -0
- package/dist/api/notes.js +181 -0
- package/dist/api/open-resources.d.ts +27 -0
- package/dist/api/open-resources.js +102 -0
- package/dist/api/ownership.d.ts +12 -0
- package/dist/api/ownership.js +24 -0
- package/dist/api/platform.d.ts +83 -0
- package/dist/api/platform.js +56 -0
- package/dist/api/presigned-transfer.d.ts +2 -0
- package/dist/api/presigned-transfer.js +2 -0
- package/dist/api/registered-runs.d.ts +48 -0
- package/dist/api/registered-runs.js +33 -0
- package/dist/api/sessions.d.ts +299 -0
- package/dist/api/sessions.js +105 -0
- package/dist/api/storage.d.ts +46 -0
- package/dist/api/storage.js +34 -0
- package/dist/api/streams.d.ts +18 -0
- package/dist/api/streams.js +70 -0
- package/dist/api/vault.d.ts +93 -0
- package/dist/api/vault.js +79 -0
- package/dist/api/workspace.d.ts +180 -0
- package/dist/api/workspace.js +146 -0
- package/dist/cli/agent-identity.d.ts +4 -0
- package/dist/cli/agent-identity.js +21 -0
- package/dist/cli/agents/identity.d.ts +50 -0
- package/dist/cli/agents/identity.js +105 -0
- package/dist/cli/agents/index.d.ts +31 -0
- package/dist/cli/agents/index.js +580 -0
- package/dist/cli/agents/manage.d.ts +43 -0
- package/dist/cli/agents/manage.js +376 -0
- package/dist/cli/agents/spec.d.ts +104 -0
- package/dist/cli/agents/spec.js +280 -0
- package/dist/cli/agents/web.d.ts +7 -0
- package/dist/cli/agents/web.js +109 -0
- package/dist/cli/artifact/incremental.d.ts +21 -0
- package/dist/cli/artifact/incremental.js +80 -0
- package/dist/cli/artifact/index.d.ts +52 -0
- package/dist/cli/artifact/index.js +405 -0
- package/dist/cli/artifact/meta.d.ts +69 -0
- package/dist/cli/artifact/meta.js +189 -0
- package/dist/cli/auth/commands.d.ts +29 -0
- package/dist/cli/auth/commands.js +327 -0
- package/dist/cli/auth/constants.d.ts +13 -0
- package/dist/cli/auth/constants.js +18 -0
- package/dist/cli/auth/credentials.d.ts +37 -0
- package/dist/cli/auth/credentials.js +155 -0
- package/dist/cli/auth/device-flow.d.ts +32 -0
- package/dist/cli/auth/device-flow.js +154 -0
- package/dist/cli/auth/device-secret.d.ts +6 -0
- package/dist/cli/auth/device-secret.js +26 -0
- package/dist/cli/auth/machine.d.ts +15 -0
- package/dist/cli/auth/machine.js +126 -0
- package/dist/cli/auth/materialized.d.ts +32 -0
- package/dist/cli/auth/materialized.js +102 -0
- package/dist/cli/auth/migrate.d.ts +10 -0
- package/dist/cli/auth/migrate.js +75 -0
- package/dist/cli/client.d.ts +102 -0
- package/dist/cli/client.js +206 -0
- package/dist/cli/collection-list.d.ts +3 -0
- package/dist/cli/collection-list.js +25 -0
- package/dist/cli/compat/ctx.d.ts +26 -0
- package/dist/cli/compat/ctx.js +76 -0
- package/dist/cli/compat/dreamdb-wasm-embedded.d.ts +2 -0
- package/dist/cli/compat/dreamdb-wasm-embedded.js +8 -0
- package/dist/cli/compat/dreamdb-wasm.d.ts +1 -0
- package/dist/cli/compat/dreamdb-wasm.js +26 -0
- package/dist/cli/compat/dreamdb.d.ts +112 -0
- package/dist/cli/compat/dreamdb.js +219 -0
- package/dist/cli/compat/flags.d.ts +2 -0
- package/dist/cli/compat/flags.js +13 -0
- package/dist/cli/compat/http.d.ts +23 -0
- package/dist/cli/compat/http.js +137 -0
- package/dist/cli/compat/presignedTransfer.d.ts +139 -0
- package/dist/cli/compat/presignedTransfer.js +580 -0
- package/dist/cli/compat/s3-backend.d.ts +73 -0
- package/dist/cli/compat/s3-backend.js +132 -0
- package/dist/cli/config.d.ts +22 -0
- package/dist/cli/config.js +96 -0
- package/dist/cli/connection/dto.d.ts +159 -0
- package/dist/cli/connection/dto.js +497 -0
- package/dist/cli/connection/index.d.ts +50 -0
- package/dist/cli/connection/index.js +413 -0
- package/dist/cli/connection/oauth.d.ts +23 -0
- package/dist/cli/connection/oauth.js +290 -0
- package/dist/cli/connection/write.d.ts +47 -0
- package/dist/cli/connection/write.js +573 -0
- package/dist/cli/create/index.d.ts +19 -0
- package/dist/cli/create/index.js +209 -0
- package/dist/cli/declare/index.d.ts +29 -0
- package/dist/cli/declare/index.js +304 -0
- package/dist/cli/delete/index.d.ts +18 -0
- package/dist/cli/delete/index.js +232 -0
- package/dist/cli/download/index.d.ts +9 -0
- package/dist/cli/download/index.js +128 -0
- package/dist/cli/env/compose.d.ts +88 -0
- package/dist/cli/env/compose.js +402 -0
- package/dist/cli/env/index.d.ts +176 -0
- package/dist/cli/env/index.js +1011 -0
- package/dist/cli/experiments/index.d.ts +11 -0
- package/dist/cli/experiments/index.js +168 -0
- package/dist/cli/glob.d.ts +1 -0
- package/dist/cli/glob.js +45 -0
- package/dist/cli/graphql-helpers.d.ts +23 -0
- package/dist/cli/graphql-helpers.js +42 -0
- package/dist/cli/graphql.d.ts +10 -0
- package/dist/cli/graphql.js +47 -0
- package/dist/cli/help-examples.generated.d.ts +1 -0
- package/dist/cli/help-examples.generated.js +192 -0
- package/dist/cli/helpers.d.ts +8 -0
- package/dist/cli/helpers.js +106 -0
- package/dist/cli/hosts/api.d.ts +29 -0
- package/dist/cli/hosts/api.js +54 -0
- package/dist/cli/hosts/bootstrap-source.d.ts +1 -0
- package/dist/cli/hosts/bootstrap-source.js +2 -0
- package/dist/cli/hosts/catalog.d.ts +26 -0
- package/dist/cli/hosts/catalog.js +55 -0
- package/dist/cli/hosts/config.d.ts +45 -0
- package/dist/cli/hosts/config.js +179 -0
- package/dist/cli/hosts/credentials.d.ts +19 -0
- package/dist/cli/hosts/credentials.js +173 -0
- package/dist/cli/hosts/enroll.d.ts +17 -0
- package/dist/cli/hosts/enroll.js +109 -0
- package/dist/cli/hosts/enrollments.d.ts +25 -0
- package/dist/cli/hosts/enrollments.js +54 -0
- package/dist/cli/hosts/index.d.ts +6 -0
- package/dist/cli/hosts/index.js +279 -0
- package/dist/cli/hosts/inventory.d.ts +40 -0
- package/dist/cli/hosts/inventory.js +91 -0
- package/dist/cli/hosts/lifecycle.d.ts +15 -0
- package/dist/cli/hosts/lifecycle.js +108 -0
- package/dist/cli/hosts/metrics-source.d.ts +12 -0
- package/dist/cli/hosts/metrics-source.js +89 -0
- package/dist/cli/hosts/observations.d.ts +39 -0
- package/dist/cli/hosts/observations.js +102 -0
- package/dist/cli/hosts/remote.d.ts +5 -0
- package/dist/cli/hosts/remote.js +66 -0
- package/dist/cli/hosts/ssh.d.ts +63 -0
- package/dist/cli/hosts/ssh.js +276 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +288 -0
- package/dist/cli/infra/api.d.ts +95 -0
- package/dist/cli/infra/api.js +291 -0
- package/dist/cli/infra/index.d.ts +5 -0
- package/dist/cli/infra/index.js +102 -0
- package/dist/cli/infra/move.d.ts +15 -0
- package/dist/cli/infra/move.js +123 -0
- package/dist/cli/infra/transfer.d.ts +15 -0
- package/dist/cli/infra/transfer.js +280 -0
- package/dist/cli/jobs/api.d.ts +69 -0
- package/dist/cli/jobs/api.js +121 -0
- package/dist/cli/jobs/index.d.ts +5 -0
- package/dist/cli/jobs/index.js +140 -0
- package/dist/cli/lakeshore/index.d.ts +98 -0
- package/dist/cli/lakeshore/index.js +502 -0
- package/dist/cli/launch/index.d.ts +43 -0
- package/dist/cli/launch/index.js +270 -0
- package/dist/cli/layout/index.d.ts +2 -0
- package/dist/cli/layout/index.js +44 -0
- package/dist/cli/layout/transport.d.ts +12 -0
- package/dist/cli/layout/transport.js +70 -0
- package/dist/cli/library/add.d.ts +60 -0
- package/dist/cli/library/add.js +348 -0
- package/dist/cli/library/cache.d.ts +26 -0
- package/dist/cli/library/cache.js +88 -0
- package/dist/cli/library/config.d.ts +75 -0
- package/dist/cli/library/config.js +198 -0
- package/dist/cli/library/digest.d.ts +5 -0
- package/dist/cli/library/digest.js +19 -0
- package/dist/cli/library/discover.d.ts +87 -0
- package/dist/cli/library/discover.js +534 -0
- package/dist/cli/library/freshness.d.ts +35 -0
- package/dist/cli/library/freshness.js +109 -0
- package/dist/cli/library/generation.d.ts +35 -0
- package/dist/cli/library/generation.js +211 -0
- package/dist/cli/library/index.d.ts +2 -0
- package/dist/cli/library/index.js +36 -0
- package/dist/cli/library/info.d.ts +69 -0
- package/dist/cli/library/info.js +311 -0
- package/dist/cli/library/list.d.ts +33 -0
- package/dist/cli/library/list.js +86 -0
- package/dist/cli/library/manifest.d.ts +81 -0
- package/dist/cli/library/manifest.js +200 -0
- package/dist/cli/library/manifestCache.d.ts +45 -0
- package/dist/cli/library/manifestCache.js +169 -0
- package/dist/cli/library/pull.d.ts +30 -0
- package/dist/cli/library/pull.js +438 -0
- package/dist/cli/library/push.d.ts +72 -0
- package/dist/cli/library/push.js +642 -0
- package/dist/cli/library/rm.d.ts +31 -0
- package/dist/cli/library/rm.js +200 -0
- package/dist/cli/library/search.d.ts +18 -0
- package/dist/cli/library/search.js +181 -0
- package/dist/cli/library/stat.d.ts +15 -0
- package/dist/cli/library/stat.js +127 -0
- package/dist/cli/library/tools.d.ts +104 -0
- package/dist/cli/library/tools.js +163 -0
- package/dist/cli/library/wire.d.ts +47 -0
- package/dist/cli/library/wire.js +120 -0
- package/dist/cli/list/index.d.ts +26 -0
- package/dist/cli/list/index.js +256 -0
- package/dist/cli/notes/character-plan.d.ts +22 -0
- package/dist/cli/notes/character-plan.js +232 -0
- package/dist/cli/notes/document.d.ts +73 -0
- package/dist/cli/notes/document.js +306 -0
- package/dist/cli/notes/edit-commands.d.ts +106 -0
- package/dist/cli/notes/edit-commands.js +623 -0
- package/dist/cli/notes/editing.d.ts +81 -0
- package/dist/cli/notes/editing.js +305 -0
- package/dist/cli/notes/events.d.ts +36 -0
- package/dist/cli/notes/events.js +54 -0
- package/dist/cli/notes/files-commands.d.ts +120 -0
- package/dist/cli/notes/files-commands.js +554 -0
- package/dist/cli/notes/html-read.d.ts +9 -0
- package/dist/cli/notes/html-read.js +90 -0
- package/dist/cli/notes/html.d.ts +73 -0
- package/dist/cli/notes/html.js +381 -0
- package/dist/cli/notes/index.d.ts +123 -0
- package/dist/cli/notes/index.js +1303 -0
- package/dist/cli/notes/linger.d.ts +59 -0
- package/dist/cli/notes/linger.js +339 -0
- package/dist/cli/notes/media-commands.d.ts +5 -0
- package/dist/cli/notes/media-commands.js +51 -0
- package/dist/cli/notes/move-command.d.ts +83 -0
- package/dist/cli/notes/move-command.js +259 -0
- package/dist/cli/notes/rm-command.d.ts +22 -0
- package/dist/cli/notes/rm-command.js +110 -0
- package/dist/cli/notes/select-command.d.ts +12 -0
- package/dist/cli/notes/select-command.js +84 -0
- package/dist/cli/notes/suggest-diff.d.ts +56 -0
- package/dist/cli/notes/suggest-diff.js +311 -0
- package/dist/cli/notes/toc.d.ts +38 -0
- package/dist/cli/notes/toc.js +144 -0
- package/dist/cli/notes/transfer-command.d.ts +6 -0
- package/dist/cli/notes/transfer-command.js +9 -0
- package/dist/cli/notes/version-commands.d.ts +19 -0
- package/dist/cli/notes/version-commands.js +178 -0
- package/dist/cli/nymph/index.d.ts +74 -0
- package/dist/cli/nymph/index.js +349 -0
- package/dist/cli/org/index.d.ts +34 -0
- package/dist/cli/org/index.js +341 -0
- package/dist/cli/ownership/index.d.ts +12 -0
- package/dist/cli/ownership/index.js +122 -0
- package/dist/cli/ownership/metadata-transfer.d.ts +20 -0
- package/dist/cli/ownership/metadata-transfer.js +159 -0
- package/dist/cli/page/index.d.ts +58 -0
- package/dist/cli/page/index.js +387 -0
- package/dist/cli/pipeline/index.d.ts +69 -0
- package/dist/cli/pipeline/index.js +604 -0
- package/dist/cli/progress.d.ts +60 -0
- package/dist/cli/progress.js +276 -0
- package/dist/cli/project/attachments.d.ts +10 -0
- package/dist/cli/project/attachments.js +39 -0
- package/dist/cli/project/grants.d.ts +10 -0
- package/dist/cli/project/grants.js +39 -0
- package/dist/cli/project/index.d.ts +8 -0
- package/dist/cli/project/index.js +92 -0
- package/dist/cli/project/move.d.ts +57 -0
- package/dist/cli/project/move.js +242 -0
- package/dist/cli/project/output.d.ts +2 -0
- package/dist/cli/project/output.js +29 -0
- package/dist/cli/project/stream.d.ts +55 -0
- package/dist/cli/project/stream.js +207 -0
- package/dist/cli/project/transfer-preview.d.ts +8 -0
- package/dist/cli/project/transfer-preview.js +10 -0
- package/dist/cli/prompt.d.ts +1 -0
- package/dist/cli/prompt.js +17 -0
- package/dist/cli/provider/dreamdir.d.ts +52 -0
- package/dist/cli/provider/dreamdir.js +138 -0
- package/dist/cli/provider/index.d.ts +4 -0
- package/dist/cli/provider/index.js +419 -0
- package/dist/cli/provider/jump-worker.d.ts +9 -0
- package/dist/cli/provider/jump-worker.js +141 -0
- package/dist/cli/provider/lifecycle.d.ts +149 -0
- package/dist/cli/provider/lifecycle.js +1390 -0
- package/dist/cli/provider/machine.d.ts +17 -0
- package/dist/cli/provider/machine.js +116 -0
- package/dist/cli/provider/ssh.d.ts +105 -0
- package/dist/cli/provider/ssh.js +305 -0
- package/dist/cli/provider/terraform.d.ts +140 -0
- package/dist/cli/provider/terraform.js +288 -0
- package/dist/cli/providers/index.d.ts +18 -0
- package/dist/cli/providers/index.js +422 -0
- package/dist/cli/python.d.ts +61 -0
- package/dist/cli/python.js +255 -0
- package/dist/cli/queues/index.d.ts +33 -0
- package/dist/cli/queues/index.js +248 -0
- package/dist/cli/queues/slurm.d.ts +10 -0
- package/dist/cli/queues/slurm.js +134 -0
- package/dist/cli/resources.d.ts +72 -0
- package/dist/cli/resources.js +137 -0
- package/dist/cli/run/index.d.ts +15 -0
- package/dist/cli/run/index.js +163 -0
- package/dist/cli/run/input.d.ts +34 -0
- package/dist/cli/run/input.js +135 -0
- package/dist/cli/run/recovery.d.ts +2 -0
- package/dist/cli/run/recovery.js +18 -0
- package/dist/cli/run/setup.d.ts +3 -0
- package/dist/cli/run/setup.js +62 -0
- package/dist/cli/runconfig/index.d.ts +12 -0
- package/dist/cli/runconfig/index.js +130 -0
- package/dist/cli/runnable/index.d.ts +35 -0
- package/dist/cli/runnable/index.js +575 -0
- package/dist/cli/runnable/path.d.ts +115 -0
- package/dist/cli/runnable/path.js +288 -0
- package/dist/cli/runnable/run.d.ts +91 -0
- package/dist/cli/runnable/run.js +239 -0
- package/dist/cli/runnable/upload.d.ts +43 -0
- package/dist/cli/runnable/upload.js +342 -0
- package/dist/cli/runnable/worker.d.ts +1 -0
- package/dist/cli/runnable/worker.js +44 -0
- package/dist/cli/schemas/workflow-spec.schema.json +335 -0
- package/dist/cli/self-update/index.d.ts +5 -0
- package/dist/cli/self-update/index.js +107 -0
- package/dist/cli/self-update/install.d.ts +60 -0
- package/dist/cli/self-update/install.js +428 -0
- package/dist/cli/self-update/paths.d.ts +40 -0
- package/dist/cli/self-update/paths.js +87 -0
- package/dist/cli/self-update/releases.d.ts +41 -0
- package/dist/cli/self-update/releases.js +153 -0
- package/dist/cli/self-update/settings.d.ts +16 -0
- package/dist/cli/self-update/settings.js +68 -0
- package/dist/cli/self-update/update.d.ts +18 -0
- package/dist/cli/self-update/update.js +241 -0
- package/dist/cli/service-accounts/index.d.ts +3 -0
- package/dist/cli/service-accounts/index.js +149 -0
- package/dist/cli/session-affiliation.d.ts +26 -0
- package/dist/cli/session-affiliation.js +135 -0
- package/dist/cli/sessions/affiliation.d.ts +8 -0
- package/dist/cli/sessions/affiliation.js +66 -0
- package/dist/cli/sessions/api.d.ts +55 -0
- package/dist/cli/sessions/api.js +88 -0
- package/dist/cli/sessions/control.d.ts +6 -0
- package/dist/cli/sessions/control.js +159 -0
- package/dist/cli/sessions/conversation.d.ts +15 -0
- package/dist/cli/sessions/conversation.js +118 -0
- package/dist/cli/sessions/index.d.ts +2 -0
- package/dist/cli/sessions/index.js +209 -0
- package/dist/cli/sessions/managed.d.ts +39 -0
- package/dist/cli/sessions/managed.js +63 -0
- package/dist/cli/sessions/redaction.d.ts +2 -0
- package/dist/cli/sessions/redaction.js +11 -0
- package/dist/cli/sessions/runner/exec.d.ts +108 -0
- package/dist/cli/sessions/runner/exec.js +335 -0
- package/dist/cli/sessions/runner/journal.d.ts +26 -0
- package/dist/cli/sessions/runner/journal.js +49 -0
- package/dist/cli/sessions/runner/native.d.ts +48 -0
- package/dist/cli/sessions/runner/native.js +170 -0
- package/dist/cli/sessions/runner/pod.d.ts +30 -0
- package/dist/cli/sessions/runner/pod.js +129 -0
- package/dist/cli/sessions/runner/serve.d.ts +85 -0
- package/dist/cli/sessions/runner/serve.js +558 -0
- package/dist/cli/sessions/sync.d.ts +47 -0
- package/dist/cli/sessions/sync.js +80 -0
- package/dist/cli/sessions/transport.d.ts +14 -0
- package/dist/cli/sessions/transport.js +116 -0
- package/dist/cli/share.d.ts +15 -0
- package/dist/cli/share.js +139 -0
- package/dist/cli/skill/catalog.d.ts +141 -0
- package/dist/cli/skill/catalog.js +442 -0
- package/dist/cli/skill/files.d.ts +89 -0
- package/dist/cli/skill/files.js +264 -0
- package/dist/cli/skill/index.d.ts +268 -0
- package/dist/cli/skill/index.js +1216 -0
- package/dist/cli/skill/manifest.d.ts +30 -0
- package/dist/cli/skill/manifest.js +101 -0
- package/dist/cli/skill/prefs.d.ts +9 -0
- package/dist/cli/skill/prefs.js +32 -0
- package/dist/cli/skill/reminders.d.ts +15 -0
- package/dist/cli/skill/reminders.js +105 -0
- package/dist/cli/skill/tar.d.ts +17 -0
- package/dist/cli/skill/tar.js +195 -0
- package/dist/cli/snapshot/index.d.ts +24 -0
- package/dist/cli/snapshot/index.js +146 -0
- package/dist/cli/source/access.d.ts +45 -0
- package/dist/cli/source/access.js +563 -0
- package/dist/cli/source/control.d.ts +103 -0
- package/dist/cli/source/control.js +546 -0
- package/dist/cli/source/delete.d.ts +89 -0
- package/dist/cli/source/delete.js +463 -0
- package/dist/cli/source/index.d.ts +288 -0
- package/dist/cli/source/index.js +1348 -0
- package/dist/cli/source/share.d.ts +65 -0
- package/dist/cli/source/share.js +530 -0
- package/dist/cli/source/upload.d.ts +62 -0
- package/dist/cli/source/upload.js +258 -0
- package/dist/cli/source/write.d.ts +77 -0
- package/dist/cli/source/write.js +335 -0
- package/dist/cli/spawn.d.ts +28 -0
- package/dist/cli/spawn.js +81 -0
- package/dist/cli/target.d.ts +22 -0
- package/dist/cli/target.js +85 -0
- package/dist/cli/tasks/index.d.ts +38 -0
- package/dist/cli/tasks/index.js +365 -0
- package/dist/cli/team/index.d.ts +37 -0
- package/dist/cli/team/index.js +407 -0
- package/dist/cli/telemetry.d.ts +23 -0
- package/dist/cli/telemetry.js +262 -0
- package/dist/cli/telemetryJournal.d.ts +26 -0
- package/dist/cli/telemetryJournal.js +104 -0
- package/dist/cli/update/index.d.ts +21 -0
- package/dist/cli/update/index.js +284 -0
- package/dist/cli/upload/index.d.ts +11 -0
- package/dist/cli/upload/index.js +261 -0
- package/dist/cli/upload/kinds.d.ts +10 -0
- package/dist/cli/upload/kinds.js +85 -0
- package/dist/cli/upload/multipart.d.ts +21 -0
- package/dist/cli/upload/multipart.js +248 -0
- package/dist/cli/vault/affected-preview.d.ts +15 -0
- package/dist/cli/vault/affected-preview.js +38 -0
- package/dist/cli/vault/cloud.d.ts +55 -0
- package/dist/cli/vault/cloud.js +287 -0
- package/dist/cli/vault/format.d.ts +18 -0
- package/dist/cli/vault/format.js +104 -0
- package/dist/cli/vault/hostCredentials.d.ts +21 -0
- package/dist/cli/vault/hostCredentials.js +71 -0
- package/dist/cli/vault/hostSupersessions.d.ts +18 -0
- package/dist/cli/vault/hostSupersessions.js +68 -0
- package/dist/cli/vault/import.d.ts +3 -0
- package/dist/cli/vault/import.js +79 -0
- package/dist/cli/vault/index.d.ts +14 -0
- package/dist/cli/vault/index.js +225 -0
- package/dist/cli/vault/keys.d.ts +5 -0
- package/dist/cli/vault/keys.js +165 -0
- package/dist/cli/vault/kms.d.ts +6 -0
- package/dist/cli/vault/kms.js +169 -0
- package/dist/cli/vault/list.d.ts +13 -0
- package/dist/cli/vault/list.js +60 -0
- package/dist/cli/vault/listView.d.ts +21 -0
- package/dist/cli/vault/listView.js +123 -0
- package/dist/cli/vault/managementMetadata.d.ts +2 -0
- package/dist/cli/vault/managementMetadata.js +23 -0
- package/dist/cli/vault/mutations.d.ts +8 -0
- package/dist/cli/vault/mutations.js +151 -0
- package/dist/cli/vault/otp.d.ts +6 -0
- package/dist/cli/vault/otp.js +62 -0
- package/dist/cli/vault/otpIntent.d.ts +23 -0
- package/dist/cli/vault/otpIntent.js +76 -0
- package/dist/cli/vault/passImport.d.ts +25 -0
- package/dist/cli/vault/passImport.js +129 -0
- package/dist/cli/vault/passOtp.d.ts +51 -0
- package/dist/cli/vault/passOtp.js +101 -0
- package/dist/cli/vault/passStore.d.ts +26 -0
- package/dist/cli/vault/passStore.js +134 -0
- package/dist/cli/vault/passwordCommand.d.ts +39 -0
- package/dist/cli/vault/passwordCommand.js +101 -0
- package/dist/cli/vault/passwordProbe.d.ts +27 -0
- package/dist/cli/vault/passwordProbe.js +282 -0
- package/dist/cli/vault/passwordRotation.d.ts +9 -0
- package/dist/cli/vault/passwordRotation.js +273 -0
- package/dist/cli/vault/rotationApi.d.ts +13 -0
- package/dist/cli/vault/rotationApi.js +58 -0
- package/dist/cli/vault/rotationCommand.d.ts +2 -0
- package/dist/cli/vault/rotationCommand.js +75 -0
- package/dist/cli/vault/rotationEngine.d.ts +19 -0
- package/dist/cli/vault/rotationEngine.js +65 -0
- package/dist/cli/vault/rotationHelperSource.d.ts +2 -0
- package/dist/cli/vault/rotationHelperSource.js +3 -0
- package/dist/cli/vault/rotationInput.d.ts +11 -0
- package/dist/cli/vault/rotationInput.js +48 -0
- package/dist/cli/vault/rotationJournal.d.ts +16 -0
- package/dist/cli/vault/rotationJournal.js +183 -0
- package/dist/cli/vault/rotationKeys.d.ts +4 -0
- package/dist/cli/vault/rotationKeys.js +48 -0
- package/dist/cli/vault/rotationPrepare.d.ts +17 -0
- package/dist/cli/vault/rotationPrepare.js +108 -0
- package/dist/cli/vault/rotationRemote.d.ts +33 -0
- package/dist/cli/vault/rotationRemote.js +156 -0
- package/dist/cli/vault/rotationState.d.ts +42 -0
- package/dist/cli/vault/rotationState.js +115 -0
- package/dist/cli/vault/rotationTransport.d.ts +18 -0
- package/dist/cli/vault/rotationTransport.js +71 -0
- package/dist/cli/vault/sshSource.d.ts +18 -0
- package/dist/cli/vault/sshSource.js +196 -0
- package/dist/cli/vault/sshSync.d.ts +17 -0
- package/dist/cli/vault/sshSync.js +224 -0
- package/dist/cli/vault/sshTransfer.d.ts +22 -0
- package/dist/cli/vault/sshTransfer.js +140 -0
- package/dist/cli/vault/terraformState.d.ts +66 -0
- package/dist/cli/vault/terraformState.js +252 -0
- package/dist/cli/vault/terraformStateCommand.d.ts +2 -0
- package/dist/cli/vault/terraformStateCommand.js +61 -0
- package/dist/cli/vault/tree.d.ts +43 -0
- package/dist/cli/vault/tree.js +292 -0
- package/dist/cli/version.d.ts +1 -0
- package/dist/cli/version.js +9 -0
- package/dist/cli/workflow/index.d.ts +76 -0
- package/dist/cli/workflow/index.js +826 -0
- package/dist/cli/workflow/validate.d.ts +19 -0
- package/dist/cli/workflow/validate.js +353 -0
- package/dist/package.json +1 -0
- package/package.json +28 -10
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { registerNymphCommand } from "./nymph/index.js";
|
|
2
|
+
import { collectionList } from "./collection-list.js";
|
|
3
|
+
import { configureTelemetryCommand, deliverTelemetry, installTelemetryOptOut, registerTelemetryCommand, startCommandTelemetry } from './telemetry.js';
|
|
4
|
+
import { identityMode, registerMachineCommand } from "./auth/machine.js";
|
|
5
|
+
import { registerProjectCommand } from './project/index.js';
|
|
6
|
+
import { registerOwnershipCommand } from './ownership/index.js';
|
|
7
|
+
import { maybeRemindStaleSkills } from "./skill/reminders.js";
|
|
8
|
+
import { registerLayoutCommand } from './layout/index.js';
|
|
9
|
+
import { helpExamples } from "./help-examples.generated.js";
|
|
10
|
+
// `dreamlake` CLI entry. Wires Commander to subcommand modules. Mirrors
|
|
11
|
+
// the command surface of dreamlake-py's `dreamlake.cli` (the data-warehouse
|
|
12
|
+
// CLI), implemented in lakeshore's TypeScript conventions.
|
|
13
|
+
import { Command } from "commander";
|
|
14
|
+
import { registerJobsCommand } from "./jobs/index.js";
|
|
15
|
+
import { registerQueuesCommand } from "./queues/index.js";
|
|
16
|
+
import { registerServiceAccountsCommand } from "./service-accounts/index.js";
|
|
17
|
+
import { registerExperimentsCommand } from "./experiments/index.js";
|
|
18
|
+
import { registerProvidersCommand } from "./providers/index.js";
|
|
19
|
+
import { executeRun, registerRunsCommands } from "./run/index.js";
|
|
20
|
+
import { authFilePath, BUILTIN_ENVS } from "./auth/credentials.js";
|
|
21
|
+
import { migrateLegacyConfig } from "./auth/migrate.js";
|
|
22
|
+
import { runLogin, runLogout, runProfile, runEnvList, runEnvUse, runEnvRemove, } from "./auth/commands.js";
|
|
23
|
+
import { registerUploadCommand } from "./upload/index.js";
|
|
24
|
+
import { registerDownloadCommand } from "./download/index.js";
|
|
25
|
+
import { registerListCommand } from "./list/index.js";
|
|
26
|
+
import { registerCreateCommand } from "./create/index.js";
|
|
27
|
+
import { registerUpdateCommand } from "./update/index.js";
|
|
28
|
+
import { registerDeleteCommand } from "./delete/index.js";
|
|
29
|
+
import { registerOrgCommand } from "./org/index.js";
|
|
30
|
+
import { registerTeamCommand } from "./team/index.js";
|
|
31
|
+
import { registerPipelineCommand } from "./pipeline/index.js";
|
|
32
|
+
import { registerWorkflowCommand } from "./workflow/index.js";
|
|
33
|
+
import { registerPageCommand } from "./page/index.js";
|
|
34
|
+
import { registerConnectionCommand } from "./connection/index.js";
|
|
35
|
+
import { registerSourceCommand } from "./source/index.js";
|
|
36
|
+
import { registerTasksCommand } from "./tasks/index.js";
|
|
37
|
+
import { registerNotesCommand } from "./notes/index.js";
|
|
38
|
+
import { registerDeclareCommand } from "./declare/index.js";
|
|
39
|
+
import { registerHostsCommand } from "./hosts/index.js";
|
|
40
|
+
import { registerSessionsCommand } from "./sessions/index.js";
|
|
41
|
+
import { registerInfraCommand } from "./infra/index.js";
|
|
42
|
+
import { registerVaultCommand } from "./vault/index.js";
|
|
43
|
+
import { registerAgentsCommand } from "./agents/index.js";
|
|
44
|
+
import { registerRunnableCommand } from "./runnable/index.js";
|
|
45
|
+
import { registerRunConfigCommand } from "./runconfig/index.js";
|
|
46
|
+
import { registerSnapshotCommand } from "./snapshot/index.js";
|
|
47
|
+
import { registerLaunchCommand } from "./launch/index.js";
|
|
48
|
+
import { registerProviderCommand, registerQueueDefCommand, registerStorageCommand, } from "./provider/index.js";
|
|
49
|
+
import { registerArtifactCommand } from "./artifact/index.js";
|
|
50
|
+
import { registerEnvCommand } from "./env/index.js";
|
|
51
|
+
import { registerLibraryCommand } from "./library/index.js";
|
|
52
|
+
import { registerSkillCommand } from "./skill/index.js";
|
|
53
|
+
import { maybeCheckForUpdates, registerDoctorCommand, registerInstallCommand, } from "./self-update/index.js";
|
|
54
|
+
import { VERSION } from "./version.js";
|
|
55
|
+
import { passwordAskpass } from "./vault/passwordProbe.js";
|
|
56
|
+
async function main(argv) {
|
|
57
|
+
if (argv[2] === '--internal-telemetry') {
|
|
58
|
+
await deliverTelemetry(argv[3] ?? '');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (argv[2] === '--vault-internal-askpass') {
|
|
62
|
+
try {
|
|
63
|
+
await passwordAskpass(argv.slice(3));
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
process.exitCode = 1;
|
|
67
|
+
}
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
// Fold any pre-consolidation state (~/.config/dreamlake) into ~/.dreamlake
|
|
71
|
+
// before anything resolves credentials. Idempotent, usually a no-op.
|
|
72
|
+
const inventory = argv[2] === '--internal-command-inventory';
|
|
73
|
+
const startupCommand = argv[2] === "--identity" ? argv[4] : argv[2];
|
|
74
|
+
if (!inventory && startupCommand !== "telemetry")
|
|
75
|
+
migrateLegacyConfig();
|
|
76
|
+
// Throttled, detached, and a no-op unless this is a native install. Kick
|
|
77
|
+
// it off before parsing so the check overlaps whatever the user came to do.
|
|
78
|
+
if (!inventory && startupCommand !== "telemetry") {
|
|
79
|
+
maybeCheckForUpdates(argv);
|
|
80
|
+
maybeRemindStaleSkills(argv);
|
|
81
|
+
}
|
|
82
|
+
// Consume only a leading global selector, never opaque workload arguments.
|
|
83
|
+
if (argv[2] === "--identity") {
|
|
84
|
+
if (!["user", "machine"].includes(argv[3] ?? ""))
|
|
85
|
+
throw new Error("Identity must be user or machine");
|
|
86
|
+
process.env.DREAMLAKE_IDENTITY = argv[3];
|
|
87
|
+
argv = [...argv.slice(0, 2), ...argv.slice(4)];
|
|
88
|
+
}
|
|
89
|
+
if (!inventory)
|
|
90
|
+
installTelemetryOptOut();
|
|
91
|
+
// Intercept before Commander so workload flags remain opaque argv.
|
|
92
|
+
if (argv[2] === "run") {
|
|
93
|
+
const args = argv.slice(3);
|
|
94
|
+
const selector = args.findIndex(arg => arg === "--uv-run" || arg === "--uvx");
|
|
95
|
+
const options = selector < 0 ? args : args.slice(0, selector);
|
|
96
|
+
if (!options.includes("--help") && !options.includes("-h"))
|
|
97
|
+
startCommandTelemetry("run");
|
|
98
|
+
process.exitCode = await executeRun(args);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const program = new Command();
|
|
102
|
+
program
|
|
103
|
+
.name("dreamlake")
|
|
104
|
+
.description("DreamLake CLI — manage data, notes, project access, and scoped Vault entries.")
|
|
105
|
+
.version(VERSION, "-v, --version", "print the version and exit")
|
|
106
|
+
.showHelpAfterError('(Add --help to see options and examples.)');
|
|
107
|
+
program.option("--identity <mode>", "select user or machine for this invocation").hook("preAction", () => {
|
|
108
|
+
const mode = program.opts().identity;
|
|
109
|
+
if (mode !== undefined) {
|
|
110
|
+
if (!["user", "machine"].includes(mode))
|
|
111
|
+
throw new Error("Identity must be user or machine");
|
|
112
|
+
process.env.DREAMLAKE_IDENTITY = mode;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
registerMachineCommand(program);
|
|
116
|
+
registerTelemetryCommand(program);
|
|
117
|
+
program.hook("preAction", (_program, action) => configureTelemetryCommand(action));
|
|
118
|
+
// ─── auth ────────────────────────────────────────────────────────
|
|
119
|
+
//
|
|
120
|
+
// The effective connection lives in `~/.dreamlake/tokens.json` +
|
|
121
|
+
// `config.json` (shared with the Python SDK); `~/.dreamlake/auth.yml`
|
|
122
|
+
// additionally caches a token per environment so `env use` can switch
|
|
123
|
+
// without a new login. All chmod 600.
|
|
124
|
+
program
|
|
125
|
+
.command("login")
|
|
126
|
+
.description(`authenticate with DreamLake (built-in envs: ${Object.keys(BUILTIN_ENVS).join(", ")})`)
|
|
127
|
+
.option("--env <name>", "environment to log into (built-in or custom; default: active, else prod)")
|
|
128
|
+
.option("--url <url>", "DreamLake server URL (for a custom env, or to override)")
|
|
129
|
+
.option("--auth <url>", "vuer-auth server URL (must match what the target server trusts)")
|
|
130
|
+
.option("--no-nymph", "skip optional Nymph setup after login")
|
|
131
|
+
.option("--no-browser", "don't open the browser automatically")
|
|
132
|
+
.option("--token <jwt>", "save a token directly instead of the device flow")
|
|
133
|
+
.action(async (opts) => {
|
|
134
|
+
const rc = await runLogin({
|
|
135
|
+
env: opts.env,
|
|
136
|
+
url: opts.url,
|
|
137
|
+
auth: opts.auth,
|
|
138
|
+
noBrowser: opts.browser === false,
|
|
139
|
+
token: opts.token,
|
|
140
|
+
noNymph: opts.nymph === false,
|
|
141
|
+
});
|
|
142
|
+
process.exit(rc);
|
|
143
|
+
});
|
|
144
|
+
program
|
|
145
|
+
.command("logout")
|
|
146
|
+
.description("log out of the active environment (removes its saved token)")
|
|
147
|
+
.action(async () => {
|
|
148
|
+
process.exit(await runLogout());
|
|
149
|
+
});
|
|
150
|
+
program
|
|
151
|
+
.command("profile")
|
|
152
|
+
.description("show the current authenticated user")
|
|
153
|
+
.option("--url <url>", "override the saved server URL")
|
|
154
|
+
.action(async (opts) => {
|
|
155
|
+
process.exit(await runProfile({ url: opts.url }));
|
|
156
|
+
});
|
|
157
|
+
// ─── auth env (switch between logged-in environments) ────────────
|
|
158
|
+
//
|
|
159
|
+
// This lived at top-level `dreamlake env` until MuJoCo environments took
|
|
160
|
+
// that name (clean cutover, no alias) — docs/pages/environments records
|
|
161
|
+
// the rename.
|
|
162
|
+
const auth = program
|
|
163
|
+
.command("auth")
|
|
164
|
+
.description("authentication utilities (login environments)");
|
|
165
|
+
auth.command("identity").description("inspect the selected identity without displaying credentials").action(() => console.log(identityMode()));
|
|
166
|
+
const authEnv = auth
|
|
167
|
+
.command("env")
|
|
168
|
+
.description(`switch between login environments (saved at ${authFilePath()})`);
|
|
169
|
+
collectionList(authEnv, "list")
|
|
170
|
+
.description("list logged-in environments (* = active)")
|
|
171
|
+
.option("--json", "emit JSON")
|
|
172
|
+
.action(async (opts) => process.exit(await runEnvList(opts)));
|
|
173
|
+
authEnv
|
|
174
|
+
.command("use")
|
|
175
|
+
.description("switch the active environment")
|
|
176
|
+
.argument("<name>", "environment name")
|
|
177
|
+
.action(async (name) => process.exit(await runEnvUse(name)));
|
|
178
|
+
authEnv
|
|
179
|
+
.command("remove")
|
|
180
|
+
.description("remove a saved environment")
|
|
181
|
+
.argument("<name>", "environment name")
|
|
182
|
+
.action(async (name) => process.exit(await runEnvRemove(name)));
|
|
183
|
+
// ─── data-warehouse commands ─────────────────────────────────────
|
|
184
|
+
registerUploadCommand(program);
|
|
185
|
+
registerDownloadCommand(program);
|
|
186
|
+
registerListCommand(program);
|
|
187
|
+
registerCreateCommand(program);
|
|
188
|
+
registerUpdateCommand(program);
|
|
189
|
+
registerDeleteCommand(program);
|
|
190
|
+
registerOrgCommand(program);
|
|
191
|
+
registerTeamCommand(program);
|
|
192
|
+
registerPipelineCommand(program);
|
|
193
|
+
registerWorkflowCommand(program);
|
|
194
|
+
registerPageCommand(program);
|
|
195
|
+
registerSourceCommand(program);
|
|
196
|
+
registerNotesCommand(program);
|
|
197
|
+
registerOwnershipCommand(program);
|
|
198
|
+
registerProjectCommand(program);
|
|
199
|
+
registerTasksCommand(program);
|
|
200
|
+
registerConnectionCommand(program);
|
|
201
|
+
// ─── declaration collections ─────────────────────────────────────
|
|
202
|
+
//
|
|
203
|
+
// `declare` writes the five head collections; `runnable` and
|
|
204
|
+
// `runconfig` read them back. Same connection model as the block
|
|
205
|
+
// above — active login plus DREAMLAKE_* env, no per-command flags.
|
|
206
|
+
registerDeclareCommand(program);
|
|
207
|
+
registerRunnableCommand(program);
|
|
208
|
+
registerRunConfigCommand(program);
|
|
209
|
+
// ─── snapshot + launch ───────────────────────────────────────────
|
|
210
|
+
//
|
|
211
|
+
// The only two commands here that talk to the LAKESHORE CONTROL
|
|
212
|
+
// PLANE rather than dreamlake-server: --server/$LAKESHORE_URL, no
|
|
213
|
+
// `dreamlake login`. They drive the Python SDK's bridge as a child
|
|
214
|
+
// process rather than reimplementing git-archive, presigning, dirty
|
|
215
|
+
// snapshots and the msgpack envelope in TypeScript — see python.ts.
|
|
216
|
+
registerSnapshotCommand(program);
|
|
217
|
+
registerLaunchCommand(program);
|
|
218
|
+
// ─── agents ──────────────────────────────────────────────────────
|
|
219
|
+
//
|
|
220
|
+
// An agent is a name and a prompt. It shares a storage table with
|
|
221
|
+
// UDFs and nothing else worth knowing, so it gets its own verb
|
|
222
|
+
// rather than a --kind flag on `declare`: authoring prose from a
|
|
223
|
+
// heredoc or $EDITOR is a different act from posting a finished
|
|
224
|
+
// JSON object, and the identity is a name, not a module path.
|
|
225
|
+
registerAgentsCommand(program);
|
|
226
|
+
registerNymphCommand(program);
|
|
227
|
+
registerHostsCommand(program);
|
|
228
|
+
registerSessionsCommand(program);
|
|
229
|
+
registerInfraCommand(program);
|
|
230
|
+
registerRunsCommands(program);
|
|
231
|
+
registerJobsCommand(program);
|
|
232
|
+
registerVaultCommand(program);
|
|
233
|
+
// ─── lakeshore resource collections ──────────────────────────────
|
|
234
|
+
//
|
|
235
|
+
// `declare` can create these three, but a create-only verb is not a
|
|
236
|
+
// lifecycle. These groups add the other four verbs — list, show,
|
|
237
|
+
// update, delete — over the one generic engine in cli/lakeshore/,
|
|
238
|
+
// because the server itself has one registrar for all three.
|
|
239
|
+
registerProviderCommand(program);
|
|
240
|
+
registerProvidersCommand(program);
|
|
241
|
+
registerServiceAccountsCommand(program);
|
|
242
|
+
registerQueuesCommand(program);
|
|
243
|
+
registerExperimentsCommand(program);
|
|
244
|
+
registerStorageCommand(program);
|
|
245
|
+
registerQueueDefCommand(program);
|
|
246
|
+
// ─── ported from the workspace CLI (@dreamlake/cli) ──────────────
|
|
247
|
+
//
|
|
248
|
+
// These carry their own --remote/--token/--debug flags; the commands above
|
|
249
|
+
// take their connection from the active login.
|
|
250
|
+
registerArtifactCommand(program);
|
|
251
|
+
registerEnvCommand(program);
|
|
252
|
+
registerLibraryCommand(program);
|
|
253
|
+
// ─── native install / self-update ────────────────────────────────
|
|
254
|
+
registerLayoutCommand(program);
|
|
255
|
+
registerSkillCommand(program);
|
|
256
|
+
registerInstallCommand(program);
|
|
257
|
+
registerDoctorCommand(program);
|
|
258
|
+
for (const [route, examples] of Object.entries(helpExamples)) {
|
|
259
|
+
let command = program;
|
|
260
|
+
for (const part of route === "dreamlake" ? [] : route.split(" ")) {
|
|
261
|
+
const child = command.commands.find(c => c.name() === part);
|
|
262
|
+
if (!child)
|
|
263
|
+
throw new Error(`Docs help references unknown command: ${route}`);
|
|
264
|
+
command = child;
|
|
265
|
+
}
|
|
266
|
+
command.addHelpText("after", `\nExamples:\n${examples}\n`);
|
|
267
|
+
}
|
|
268
|
+
// Read-only build audit: enumerate the real tree without parsing or startup effects.
|
|
269
|
+
if (inventory) {
|
|
270
|
+
const commands = [];
|
|
271
|
+
const walk = (parent, prefix) => {
|
|
272
|
+
for (const child of parent.commands) {
|
|
273
|
+
const path = [...prefix, child.name()];
|
|
274
|
+
if (child._actionHandler || path.join(' ') === 'run')
|
|
275
|
+
commands.push({ command: path.join(' '), description: child.description() });
|
|
276
|
+
walk(child, path);
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
walk(program, []);
|
|
280
|
+
console.log(JSON.stringify(commands));
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
await program.parseAsync(argv);
|
|
284
|
+
}
|
|
285
|
+
main(process.argv).catch((err) => {
|
|
286
|
+
process.stderr.write(`${err.stack ?? err}\n`);
|
|
287
|
+
process.exit(1);
|
|
288
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
export interface Stack {
|
|
2
|
+
id: string;
|
|
3
|
+
namespaceId: string;
|
|
4
|
+
projectId: string;
|
|
5
|
+
name: string;
|
|
6
|
+
/** Place in the owning Project's resource tree; null until assigned. */
|
|
7
|
+
path: string | null;
|
|
8
|
+
environment: string;
|
|
9
|
+
repository: string;
|
|
10
|
+
directory: string;
|
|
11
|
+
version: number;
|
|
12
|
+
locked: boolean;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
role?: string;
|
|
15
|
+
lock?: {
|
|
16
|
+
actorId: string | null;
|
|
17
|
+
actorLabel: string | null;
|
|
18
|
+
operation: string | null;
|
|
19
|
+
who: string | null;
|
|
20
|
+
created: string | null;
|
|
21
|
+
} | null;
|
|
22
|
+
}
|
|
23
|
+
export interface StackInput {
|
|
24
|
+
name: string;
|
|
25
|
+
environment: string;
|
|
26
|
+
repository: string;
|
|
27
|
+
directory: string;
|
|
28
|
+
path?: string;
|
|
29
|
+
}
|
|
30
|
+
/** Canonical project-relative tree path such as infra/k3s/prod. */
|
|
31
|
+
export declare function isStackPath(value: unknown): value is string;
|
|
32
|
+
export interface CreateIntent extends StackInput {
|
|
33
|
+
namespace?: string;
|
|
34
|
+
project: string;
|
|
35
|
+
}
|
|
36
|
+
export declare class InfraCreateError extends Error {
|
|
37
|
+
readonly outcome: "unknown" | "conflict" | "rejected";
|
|
38
|
+
readonly intent: CreateIntent;
|
|
39
|
+
readonly status?: number | undefined;
|
|
40
|
+
constructor(message: string, outcome: "unknown" | "conflict" | "rejected", intent: CreateIntent, status?: number | undefined);
|
|
41
|
+
}
|
|
42
|
+
export declare function stackInput(input: StackInput): StackInput;
|
|
43
|
+
export interface StateVersion {
|
|
44
|
+
version: number;
|
|
45
|
+
lineage: string;
|
|
46
|
+
serial: string;
|
|
47
|
+
digest: string;
|
|
48
|
+
bytes: number;
|
|
49
|
+
created_by: string;
|
|
50
|
+
created_at: string;
|
|
51
|
+
}
|
|
52
|
+
export interface StackEvent {
|
|
53
|
+
sequence: string;
|
|
54
|
+
kind: string;
|
|
55
|
+
actor_id: string;
|
|
56
|
+
version: number;
|
|
57
|
+
created_at: string;
|
|
58
|
+
}
|
|
59
|
+
export declare function sequenceCursor(value: string): string;
|
|
60
|
+
export interface ConnectionOptions {
|
|
61
|
+
remote?: string;
|
|
62
|
+
token?: string;
|
|
63
|
+
namespace?: string;
|
|
64
|
+
}
|
|
65
|
+
export declare function stackId(id: string): string;
|
|
66
|
+
export declare function validateStack(value: unknown, detail?: boolean): Stack;
|
|
67
|
+
export declare class InfraApi {
|
|
68
|
+
readonly remote: string;
|
|
69
|
+
private token;
|
|
70
|
+
private fetchImpl;
|
|
71
|
+
private constructor();
|
|
72
|
+
/** Explicit credentials for API consumers; never resolves a saved CLI login. */
|
|
73
|
+
static create(options: {
|
|
74
|
+
remote: string;
|
|
75
|
+
token: string;
|
|
76
|
+
fetch?: typeof fetch;
|
|
77
|
+
}): InfraApi;
|
|
78
|
+
static connect(options?: ConnectionOptions): InfraApi;
|
|
79
|
+
private get;
|
|
80
|
+
create(input: StackInput, project: string, namespace?: string): Promise<Stack>;
|
|
81
|
+
status(id: string): Promise<Stack>;
|
|
82
|
+
history(id: string): Promise<{
|
|
83
|
+
versions: StateVersion[];
|
|
84
|
+
nextCursor: null;
|
|
85
|
+
}>;
|
|
86
|
+
events(id: string, initialAfter?: string): Promise<{
|
|
87
|
+
events: StackEvent[];
|
|
88
|
+
nextCursor: string;
|
|
89
|
+
}>;
|
|
90
|
+
list(project: string, namespace?: string): Promise<{
|
|
91
|
+
stacks: Stack[];
|
|
92
|
+
nextCursor: null;
|
|
93
|
+
role: string;
|
|
94
|
+
}>;
|
|
95
|
+
}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { resolveRemote, resolveToken } from "../config.js";
|
|
2
|
+
const label = /^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$/;
|
|
3
|
+
/** Canonical project-relative tree path such as infra/k3s/prod. */
|
|
4
|
+
export function isStackPath(value) {
|
|
5
|
+
return typeof value === "string" && value.length > 0 && value.length <= 255 && value.split("/").length <= 16 && value.split("/").every(segment => label.test(segment));
|
|
6
|
+
}
|
|
7
|
+
export class InfraCreateError extends Error {
|
|
8
|
+
outcome;
|
|
9
|
+
intent;
|
|
10
|
+
status;
|
|
11
|
+
constructor(message, outcome, intent, status) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.outcome = outcome;
|
|
14
|
+
this.intent = intent;
|
|
15
|
+
this.status = status;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function stackInput(input) {
|
|
19
|
+
if (!input || !["name", "environment", "repository", "directory"].every(key => typeof input[key] === "string")) {
|
|
20
|
+
throw new Error("Stack metadata fields must be strings");
|
|
21
|
+
}
|
|
22
|
+
const { name, environment, repository, directory, path } = input;
|
|
23
|
+
if (path !== undefined && !isStackPath(path))
|
|
24
|
+
throw new Error("Invalid stack path; use canonical a/b/c segments, e.g. infra/k3s/prod");
|
|
25
|
+
let url;
|
|
26
|
+
try {
|
|
27
|
+
url = new URL(repository);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
throw new Error("Expected an HTTPS repository URL");
|
|
31
|
+
}
|
|
32
|
+
if (!label.test(name) || !label.test(environment) || typeof directory !== "string"
|
|
33
|
+
|| repository.length > 2048 || url.protocol !== "https:" || url.username || url.password || url.search || url.hash
|
|
34
|
+
|| directory.length > 512 || directory.startsWith("/") || directory.includes("\\")
|
|
35
|
+
|| directory.split("/").includes("..") || /[\x00-\x1f]/.test(directory)) {
|
|
36
|
+
throw new Error("Invalid stack labels, repository URL or relative Terraform directory");
|
|
37
|
+
}
|
|
38
|
+
// Sent only when chosen, so older servers keep accepting legacy bodies.
|
|
39
|
+
const metadata = { name, environment, repository, directory, ...(path !== undefined ? { path } : {}) };
|
|
40
|
+
if (Buffer.byteLength(JSON.stringify(metadata), "utf8") > 8192)
|
|
41
|
+
throw new Error("Stack metadata exceeds the 8192-byte request limit");
|
|
42
|
+
return metadata;
|
|
43
|
+
}
|
|
44
|
+
export function sequenceCursor(value) {
|
|
45
|
+
if (!/^\d{1,18}$/.test(value))
|
|
46
|
+
throw new Error("Expected a decimal event sequence of at most 18 digits");
|
|
47
|
+
return BigInt(value).toString();
|
|
48
|
+
}
|
|
49
|
+
function versionNumber(value) {
|
|
50
|
+
return Number.isInteger(value) && value > 0 && value < 1e9;
|
|
51
|
+
}
|
|
52
|
+
function versionMetadata(value) {
|
|
53
|
+
if (!value || !versionNumber(value.version) || typeof value.lineage !== "string"
|
|
54
|
+
|| typeof value.serial !== "string" || !/^\d+$/.test(value.serial)
|
|
55
|
+
|| typeof value.digest !== "string" || !Number.isSafeInteger(value.bytes) || value.bytes < 0
|
|
56
|
+
|| typeof value.created_by !== "string" || typeof value.created_at !== "string") {
|
|
57
|
+
throw new Error("Infrastructure API returned invalid version metadata");
|
|
58
|
+
}
|
|
59
|
+
return { version: value.version, lineage: value.lineage, serial: value.serial,
|
|
60
|
+
digest: value.digest, bytes: value.bytes, created_by: value.created_by, created_at: value.created_at };
|
|
61
|
+
}
|
|
62
|
+
function eventMetadata(value) {
|
|
63
|
+
if (!value || typeof value.sequence !== "string" || !/^[1-9]\d{0,17}$/.test(value.sequence)
|
|
64
|
+
|| typeof value.kind !== "string" || typeof value.actor_id !== "string"
|
|
65
|
+
|| !Number.isSafeInteger(value.version) || value.version < 0
|
|
66
|
+
|| typeof value.created_at !== "string")
|
|
67
|
+
throw new Error("Infrastructure API returned invalid event metadata");
|
|
68
|
+
return { sequence: value.sequence, kind: value.kind, actor_id: value.actor_id,
|
|
69
|
+
version: value.version, created_at: value.created_at };
|
|
70
|
+
}
|
|
71
|
+
export function stackId(id) {
|
|
72
|
+
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id))
|
|
73
|
+
throw new Error("Expected an immutable stack UUID");
|
|
74
|
+
return id;
|
|
75
|
+
}
|
|
76
|
+
function slug(value) {
|
|
77
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9_.-]{0,199}$/.test(value))
|
|
78
|
+
throw new Error("Expected a namespace or project slug");
|
|
79
|
+
return encodeURIComponent(value);
|
|
80
|
+
}
|
|
81
|
+
export function validateStack(value, detail = false) {
|
|
82
|
+
const s = value;
|
|
83
|
+
if (!s || typeof s !== "object" || !["id", "namespaceId", "projectId", "name", "environment", "repository", "directory", "createdAt"].every(k => typeof s[k] === "string")
|
|
84
|
+
|| !(s.path === undefined || s.path === null || isStackPath(s.path))
|
|
85
|
+
|| !Number.isSafeInteger(s.version) || s.version < 0 || typeof s.locked !== "boolean"
|
|
86
|
+
|| (detail && (!["READ", "WRITE", "ADMIN"].includes(s.role ?? "") || !(s.lock === null || (s.lock && typeof s.lock === "object" && ["actorId", "actorLabel", "operation", "who", "created"].every(k => s.lock[k] === null || typeof s.lock[k] === "string"))) || s.locked !== (s.lock !== null))))
|
|
87
|
+
throw new Error("Infrastructure API returned invalid stack metadata");
|
|
88
|
+
stackId(s.id);
|
|
89
|
+
const summary = {
|
|
90
|
+
id: s.id, namespaceId: s.namespaceId, projectId: s.projectId, path: s.path ?? null,
|
|
91
|
+
name: s.name, environment: s.environment, repository: s.repository,
|
|
92
|
+
directory: s.directory, version: s.version, locked: s.locked, createdAt: s.createdAt,
|
|
93
|
+
};
|
|
94
|
+
if (detail) {
|
|
95
|
+
summary.role = s.role;
|
|
96
|
+
summary.lock = s.lock ? {
|
|
97
|
+
actorId: s.lock.actorId, actorLabel: s.lock.actorLabel,
|
|
98
|
+
operation: s.lock.operation, who: s.lock.who, created: s.lock.created,
|
|
99
|
+
} : null;
|
|
100
|
+
}
|
|
101
|
+
return summary;
|
|
102
|
+
}
|
|
103
|
+
export class InfraApi {
|
|
104
|
+
remote;
|
|
105
|
+
token;
|
|
106
|
+
fetchImpl;
|
|
107
|
+
constructor(remote, token, fetchImpl = (input, init) => fetch(input, init)) {
|
|
108
|
+
this.remote = remote;
|
|
109
|
+
this.token = token;
|
|
110
|
+
this.fetchImpl = fetchImpl;
|
|
111
|
+
}
|
|
112
|
+
/** Explicit credentials for API consumers; never resolves a saved CLI login. */
|
|
113
|
+
static create(options) {
|
|
114
|
+
if (!options.token)
|
|
115
|
+
throw new Error("An explicit API token is required");
|
|
116
|
+
const url = new URL(options.remote);
|
|
117
|
+
if (!["https:", "http:"].includes(url.protocol) || url.username || url.password || url.search || url.hash)
|
|
118
|
+
throw new Error("API remote must be an HTTP URL without credentials, query or fragment");
|
|
119
|
+
return new InfraApi(url.toString().replace(/\/+$/, ""), options.token, options.fetch);
|
|
120
|
+
}
|
|
121
|
+
static connect(options = {}) {
|
|
122
|
+
const token = resolveToken(options.token);
|
|
123
|
+
if (!token)
|
|
124
|
+
throw new Error("Log in to DreamLake before inspecting infrastructure");
|
|
125
|
+
let url;
|
|
126
|
+
try {
|
|
127
|
+
url = new URL(resolveRemote(options.remote));
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
throw new Error("Invalid API remote");
|
|
131
|
+
}
|
|
132
|
+
if (!["https:", "http:"].includes(url.protocol) || url.username || url.password || url.search || url.hash)
|
|
133
|
+
throw new Error("API remote must be an HTTP URL without credentials, query or fragment");
|
|
134
|
+
return new InfraApi(url.toString().replace(/\/+$/, ""), token);
|
|
135
|
+
}
|
|
136
|
+
async get(path) {
|
|
137
|
+
let response;
|
|
138
|
+
try {
|
|
139
|
+
response = await this.fetchImpl(`${this.remote}${path}`, { headers: { Authorization: `Bearer ${this.token}` }, redirect: "error", signal: AbortSignal.timeout(30_000) });
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
throw new Error("Infrastructure API could not be reached");
|
|
143
|
+
}
|
|
144
|
+
if (!response.ok)
|
|
145
|
+
throw new Error(`Infrastructure API request failed (HTTP ${response.status}); resource may be inaccessible`);
|
|
146
|
+
try {
|
|
147
|
+
return await response.json();
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
throw new Error("Infrastructure API returned invalid JSON");
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
async create(input, project, namespace) {
|
|
154
|
+
const metadata = stackInput(input);
|
|
155
|
+
const projectSlug = slug(project);
|
|
156
|
+
const ns = namespace ?? (await this.get("/auth/me"))?.namespace?.slug;
|
|
157
|
+
if (typeof ns !== "string" || !ns)
|
|
158
|
+
throw new Error("Could not resolve namespace; specify --namespace");
|
|
159
|
+
const base = `/namespaces/${slug(ns)}/projects/${projectSlug}/infrastructure/stacks`;
|
|
160
|
+
const intent = { ...metadata, namespace: ns, project };
|
|
161
|
+
const reconcile = "Use infra list in this namespace/project to reconcile the existing record before retrying; do not create a duplicate stack";
|
|
162
|
+
let response;
|
|
163
|
+
try {
|
|
164
|
+
response = await this.fetchImpl(`${this.remote}${base}`, {
|
|
165
|
+
method: "POST", headers: { Authorization: `Bearer ${this.token}`, "Content-Type": "application/json" },
|
|
166
|
+
body: JSON.stringify(metadata), redirect: "error", signal: AbortSignal.timeout(30_000),
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
throw new InfraCreateError(`Stack creation outcome unknown. ${reconcile}`, "unknown", intent);
|
|
171
|
+
}
|
|
172
|
+
if (response.status === 409)
|
|
173
|
+
throw new InfraCreateError(`Stack already exists or conflicts (HTTP 409). ${reconcile}`, "conflict", intent, 409);
|
|
174
|
+
if ([400, 401, 403, 404, 413, 415, 422].includes(response.status))
|
|
175
|
+
throw new InfraCreateError(`Stack creation rejected (HTTP ${response.status})`, "rejected", intent, response.status);
|
|
176
|
+
if (response.status !== 201)
|
|
177
|
+
throw new InfraCreateError(`Stack creation outcome unknown (HTTP ${response.status}). ${reconcile}`, "unknown", intent, response.status);
|
|
178
|
+
try {
|
|
179
|
+
const result = validateStack(await response.json());
|
|
180
|
+
if (result.name !== metadata.name || result.environment !== metadata.environment
|
|
181
|
+
|| result.repository !== metadata.repository || result.directory !== metadata.directory
|
|
182
|
+
|| (metadata.path !== undefined && result.path !== metadata.path)
|
|
183
|
+
|| result.version !== 0 || result.locked)
|
|
184
|
+
throw new Error("Invalid creation receipt");
|
|
185
|
+
return result;
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
throw new InfraCreateError(`Stack creation outcome unknown: invalid receipt. ${reconcile}`, "unknown", intent, response.status);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
async status(id) {
|
|
192
|
+
const expected = stackId(id);
|
|
193
|
+
const stack = validateStack(await this.get(`/infrastructure/stacks/${expected}`), true);
|
|
194
|
+
if (stack.id.toLowerCase() !== expected.toLowerCase())
|
|
195
|
+
throw new Error("Infrastructure API returned a different stack identity");
|
|
196
|
+
return stack;
|
|
197
|
+
}
|
|
198
|
+
async history(id) {
|
|
199
|
+
const base = `/infrastructure/stacks/${stackId(id)}/versions`;
|
|
200
|
+
const versions = [];
|
|
201
|
+
let before = null;
|
|
202
|
+
let previous = 1e9;
|
|
203
|
+
for (let page = 0; page < 100; page++) {
|
|
204
|
+
const data = await this.get(`${base}${before === null ? "" : `?before=${before}`}`);
|
|
205
|
+
if (!data || !Array.isArray(data.versions) || data.versions.length > 100
|
|
206
|
+
|| !(data.nextCursor === null || (typeof data.nextCursor === "string" && /^[1-9]\d{0,8}$/.test(data.nextCursor)))) {
|
|
207
|
+
throw new Error("Infrastructure API returned invalid history pagination");
|
|
208
|
+
}
|
|
209
|
+
for (const raw of data.versions) {
|
|
210
|
+
const row = versionMetadata(raw);
|
|
211
|
+
if (row.version >= previous)
|
|
212
|
+
throw new Error("Infrastructure history did not move backwards");
|
|
213
|
+
previous = row.version;
|
|
214
|
+
versions.push(row);
|
|
215
|
+
}
|
|
216
|
+
if (data.nextCursor === null)
|
|
217
|
+
return { versions, nextCursor: null };
|
|
218
|
+
if (!data.versions.length || Number(data.nextCursor) !== previous
|
|
219
|
+
|| (before !== null && Number(data.nextCursor) >= Number(before))) {
|
|
220
|
+
throw new Error("Infrastructure API returned a repeated or inconsistent history cursor");
|
|
221
|
+
}
|
|
222
|
+
before = data.nextCursor;
|
|
223
|
+
}
|
|
224
|
+
throw new Error("Infrastructure history exceeded 100 pages");
|
|
225
|
+
}
|
|
226
|
+
async events(id, initialAfter = "0") {
|
|
227
|
+
const base = `/infrastructure/stacks/${stackId(id)}/events`;
|
|
228
|
+
const events = [];
|
|
229
|
+
let after = sequenceCursor(initialAfter);
|
|
230
|
+
for (let page = 0; page < 100; page++) {
|
|
231
|
+
const data = await this.get(`${base}?after=${after}`);
|
|
232
|
+
if (!data || !Array.isArray(data.events) || data.events.length > 100 || typeof data.nextCursor !== "string") {
|
|
233
|
+
throw new Error("Infrastructure API returned invalid events pagination");
|
|
234
|
+
}
|
|
235
|
+
const cursor = sequenceCursor(data.nextCursor);
|
|
236
|
+
if (!data.events.length) {
|
|
237
|
+
if (cursor !== after)
|
|
238
|
+
throw new Error("Infrastructure API returned an inconsistent empty events cursor");
|
|
239
|
+
return { events, nextCursor: after };
|
|
240
|
+
}
|
|
241
|
+
let previous = BigInt(after);
|
|
242
|
+
for (const raw of data.events) {
|
|
243
|
+
const row = eventMetadata(raw);
|
|
244
|
+
if (BigInt(row.sequence) <= previous)
|
|
245
|
+
throw new Error("Infrastructure events did not move forwards");
|
|
246
|
+
previous = BigInt(row.sequence);
|
|
247
|
+
events.push(row);
|
|
248
|
+
}
|
|
249
|
+
if (BigInt(cursor) !== previous)
|
|
250
|
+
throw new Error("Infrastructure API returned an inconsistent events cursor");
|
|
251
|
+
after = cursor;
|
|
252
|
+
if (data.events.length < 100)
|
|
253
|
+
return { events, nextCursor: after };
|
|
254
|
+
}
|
|
255
|
+
throw new Error("Infrastructure events exceeded 100 pages");
|
|
256
|
+
}
|
|
257
|
+
async list(project, namespace) {
|
|
258
|
+
const projectSlug = slug(project);
|
|
259
|
+
// Resolve the selected identity through the same authenticated remote, without
|
|
260
|
+
// following redirects or guessing a namespace from an unverified JWT.
|
|
261
|
+
const ns = namespace ?? (await this.get("/auth/me"))?.namespace?.slug;
|
|
262
|
+
if (typeof ns !== "string" || !ns)
|
|
263
|
+
throw new Error("Could not resolve namespace; specify --namespace");
|
|
264
|
+
const base = `/namespaces/${slug(ns)}/projects/${projectSlug}/infrastructure/stacks`;
|
|
265
|
+
const stacks = [], cursors = new Set(), ids = new Set();
|
|
266
|
+
let after = null, role;
|
|
267
|
+
for (let page = 0; page < 100; page++) {
|
|
268
|
+
const data = await this.get(`${base}${after === null ? "" : `?${new URLSearchParams({ after })}`}`);
|
|
269
|
+
if (!data || !Array.isArray(data.stacks) || data.stacks.length > 200 || !["READ", "WRITE", "ADMIN"].includes(data.role) || !(data.nextCursor === null || (typeof data.nextCursor === "string" && data.nextCursor.length > 0 && data.nextCursor.length <= 4096)))
|
|
270
|
+
throw new Error("Infrastructure API returned invalid pagination");
|
|
271
|
+
if (role !== undefined && role !== data.role)
|
|
272
|
+
throw new Error("Infrastructure access changed during pagination; retry the read");
|
|
273
|
+
role = data.role;
|
|
274
|
+
for (const raw of data.stacks) {
|
|
275
|
+
const s = validateStack(raw);
|
|
276
|
+
if (ids.has(s.id.toLowerCase()))
|
|
277
|
+
throw new Error("Infrastructure API repeated a stack during pagination");
|
|
278
|
+
ids.add(s.id.toLowerCase());
|
|
279
|
+
stacks.push(s);
|
|
280
|
+
}
|
|
281
|
+
if (data.nextCursor === null)
|
|
282
|
+
return { stacks, nextCursor: null, role: role };
|
|
283
|
+
if (cursors.has(data.nextCursor))
|
|
284
|
+
throw new Error("Infrastructure API repeated a pagination cursor");
|
|
285
|
+
stackId(data.nextCursor);
|
|
286
|
+
cursors.add(data.nextCursor);
|
|
287
|
+
after = data.nextCursor;
|
|
288
|
+
}
|
|
289
|
+
throw new Error("Infrastructure pagination exceeded 100 pages; narrow the project or retry");
|
|
290
|
+
}
|
|
291
|
+
}
|