@dreamlake/dreamlake-cli 0.88.1 → 0.90.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 +54 -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 +2362 -0
- package/dist/api/index.js +116 -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 +102 -0
- package/dist/api/note-files.js +107 -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-linger.d.ts +83 -0
- package/dist/api/note-linger.js +270 -0
- package/dist/api/note-presence.d.ts +82 -0
- package/dist/api/note-presence.js +72 -0
- package/dist/api/note-toc.d.ts +2 -0
- package/dist/api/note-toc.js +2 -0
- package/dist/api/notes.d.ts +329 -0
- package/dist/api/notes.js +209 -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/api-transport.d.ts +5 -0
- package/dist/cli/notes/api-transport.js +20 -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 +97 -0
- package/dist/cli/notes/files-commands.js +548 -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 +1300 -0
- package/dist/cli/notes/linger.d.ts +4 -0
- package/dist/cli/notes/linger.js +96 -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 +63 -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,270 @@
|
|
|
1
|
+
// `dreamlake launch <script>` — run a repo script on the fabric. The control
|
|
2
|
+
// plane picks the node; nothing here names a machine, and that is the point.
|
|
3
|
+
//
|
|
4
|
+
// The script is put on a QUEUE as an `Invocation`. A worker whose host key
|
|
5
|
+
// matches claims it, extracts the snapshot, and runs the script as a child
|
|
6
|
+
// process inside the extracted repo. What comes back is
|
|
7
|
+
// `{script, exit_code, stdout, stderr}` — a non-zero script is a RESULT, not an
|
|
8
|
+
// exception, which is why this command can print the script's own streams and
|
|
9
|
+
// still tell you what happened.
|
|
10
|
+
//
|
|
11
|
+
// THREE DECISIONS WORTH THE PARAGRAPH THEY COST:
|
|
12
|
+
//
|
|
13
|
+
// 1. IT SNAPSHOTS IMPLICITLY when `--snapshot` is absent. Otherwise the
|
|
14
|
+
// common case is two commands, which defeats the point. The mechanism is
|
|
15
|
+
// free: submitting already pushes code, and the push dedupes on
|
|
16
|
+
// (remote, commit) — an implicit snapshot of an unchanged tree is one
|
|
17
|
+
// lookup GET, not an upload. `--snapshot <id>` skips the push entirely.
|
|
18
|
+
//
|
|
19
|
+
// 2. `--queue` IS RESOLVED, NEVER DEFAULTED. A wrong queue name does not
|
|
20
|
+
// error anywhere: the invocation sits `queued` forever with nothing
|
|
21
|
+
// logged. Inventing a default would manufacture exactly that silence, so
|
|
22
|
+
// a missing queue fails BEFORE any network call, naming all three ways
|
|
23
|
+
// out.
|
|
24
|
+
//
|
|
25
|
+
// 3. THE EXIT CODE IS 1 WHEN THE SCRIPT FAILED. `launch --wait` that returns
|
|
26
|
+
// 0 after `train.py` exited 3 is a lie a CI job will believe. The real
|
|
27
|
+
// number survives under `--json` as `exitCode`.
|
|
28
|
+
import { emitJson, fail, humanSize, loadStructuredFile, ok } from "../helpers.js";
|
|
29
|
+
import { bool, callBridge, findDreamRc, num, NO_SERVER_MESSAGE, obj, resolveCpNamespace, resolveServer, str, } from "../python.js";
|
|
30
|
+
// ─── local validation ────────────────────────────────────────────────────────
|
|
31
|
+
/**
|
|
32
|
+
* The three spellings `--snapshot` accepts, all resolvable with today's routes:
|
|
33
|
+
* a 24-hex `CodeRepo` id, a 40-hex commit (looked up against this repo's
|
|
34
|
+
* origin, else "local"), or `<remote>@<commit>` with the remote given
|
|
35
|
+
* explicitly. Anything else is a typo and is refused before a single spawn.
|
|
36
|
+
*/
|
|
37
|
+
const OBJECT_ID = /^[0-9a-f]{24}$/i;
|
|
38
|
+
const COMMIT = /^[0-9a-f]{40}$/i;
|
|
39
|
+
const REMOTE_AT_COMMIT = /^.+@[0-9a-f]{40}$/i;
|
|
40
|
+
export function isSnapshotRef(value) {
|
|
41
|
+
return OBJECT_ID.test(value) || COMMIT.test(value) || REMOTE_AT_COMMIT.test(value);
|
|
42
|
+
}
|
|
43
|
+
function noQueueMessage(script) {
|
|
44
|
+
return [
|
|
45
|
+
"no queue — a launch has to say where it runs. Any one of:",
|
|
46
|
+
` dreamlake launch ${script} --queue cpu`,
|
|
47
|
+
" export LAKESHORE_QUEUE=cpu",
|
|
48
|
+
" queue: cpu # at the top level of .dreamrc",
|
|
49
|
+
].join("\n");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* `--queue` → `LAKESHORE_QUEUE` → the `queue:` key of the nearest `.dreamrc`.
|
|
53
|
+
*
|
|
54
|
+
* A `.dreamrc` that will not parse is treated as "no queue here" rather than as
|
|
55
|
+
* a crash: the operator's next move is the same either way, and the three-way
|
|
56
|
+
* message says it better than a YAML error would.
|
|
57
|
+
*/
|
|
58
|
+
export function resolveQueue(flag) {
|
|
59
|
+
if (flag)
|
|
60
|
+
return flag;
|
|
61
|
+
const fromEnv = process.env.LAKESHORE_QUEUE;
|
|
62
|
+
if (fromEnv)
|
|
63
|
+
return fromEnv;
|
|
64
|
+
const rc = findDreamRc();
|
|
65
|
+
if (!rc)
|
|
66
|
+
return null;
|
|
67
|
+
try {
|
|
68
|
+
const parsed = loadStructuredFile(rc);
|
|
69
|
+
const q = parsed.queue;
|
|
70
|
+
return typeof q === "string" && q.trim() ? q.trim() : null;
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function shortCommit(commit) {
|
|
77
|
+
return commit ? commit.slice(0, 7) : "(unknown)";
|
|
78
|
+
}
|
|
79
|
+
// ─── dreamlake launch ────────────────────────────────────────────────────────
|
|
80
|
+
export async function runLaunch(script, opts, deps = {}) {
|
|
81
|
+
// ── ALL local validation first. Each of these returns 1 having spawned
|
|
82
|
+
// nothing at all: a missing queue must not cost an upload. ──
|
|
83
|
+
const namespace = resolveCpNamespace(opts.namespace);
|
|
84
|
+
if (!script || !script.trim()) {
|
|
85
|
+
return reject(opts, "no script given — usage: dreamlake launch <script>", {
|
|
86
|
+
script: script ?? "",
|
|
87
|
+
server: "",
|
|
88
|
+
namespace,
|
|
89
|
+
queue: "",
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const server = resolveServer(opts.server);
|
|
93
|
+
if (!server) {
|
|
94
|
+
return reject(opts, NO_SERVER_MESSAGE, {
|
|
95
|
+
script,
|
|
96
|
+
server: "",
|
|
97
|
+
namespace,
|
|
98
|
+
queue: opts.queue ?? "",
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
const queue = resolveQueue(opts.queue);
|
|
102
|
+
if (!queue) {
|
|
103
|
+
return reject(opts, noQueueMessage(script), {
|
|
104
|
+
script,
|
|
105
|
+
server,
|
|
106
|
+
namespace,
|
|
107
|
+
queue: "",
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
if (opts.snapshot !== undefined && !isSnapshotRef(opts.snapshot)) {
|
|
111
|
+
return reject(opts, `--snapshot must be a 24-hex snapshot id, a 40-hex commit, or ` +
|
|
112
|
+
`<remote>@<commit> (got '${opts.snapshot}')`, { script, server, namespace, queue });
|
|
113
|
+
}
|
|
114
|
+
const args = opts.arg ?? [];
|
|
115
|
+
const waited = opts.wait !== false;
|
|
116
|
+
// ── the target, printed BEFORE the launch ──
|
|
117
|
+
if (!opts.json) {
|
|
118
|
+
process.stdout.write(`launch ${script}\n`);
|
|
119
|
+
process.stdout.write(` server: ${server}\n`);
|
|
120
|
+
process.stdout.write(` namespace: ${namespace}\n`);
|
|
121
|
+
process.stdout.write(` queue: ${queue}\n`);
|
|
122
|
+
process.stdout.write(` snapshot: ${opts.snapshot ?? "(from this working tree)"}\n`);
|
|
123
|
+
}
|
|
124
|
+
const argv = [
|
|
125
|
+
"--server", server,
|
|
126
|
+
"--namespace", namespace,
|
|
127
|
+
"--queue", queue,
|
|
128
|
+
"--script", script,
|
|
129
|
+
...(opts.snapshot ? ["--snapshot", opts.snapshot] : []),
|
|
130
|
+
// `--arg=<value>`, never `--arg <value>`: the space form makes any
|
|
131
|
+
// dash-leading script argument (`--lr`, `--epochs`) look like an option to
|
|
132
|
+
// the bridge's argparse, which exits 2. `=` binds the value to the flag
|
|
133
|
+
// regardless of what it starts with, and parses identically for plain
|
|
134
|
+
// values, so it is always the wire form.
|
|
135
|
+
...args.map((a) => `--arg=${a}`),
|
|
136
|
+
...(waited ? [] : ["--no-wait"]),
|
|
137
|
+
];
|
|
138
|
+
const outcome = callBridge("launch", argv, {
|
|
139
|
+
...deps,
|
|
140
|
+
quiet: opts.json ?? deps.quiet,
|
|
141
|
+
});
|
|
142
|
+
if (!outcome.ok) {
|
|
143
|
+
return reject(opts, outcome.message, { script, server, namespace, queue }, outcome.kind);
|
|
144
|
+
}
|
|
145
|
+
const d = outcome.data;
|
|
146
|
+
const snapRaw = obj(d, "snapshot");
|
|
147
|
+
const snapshot = snapRaw
|
|
148
|
+
? {
|
|
149
|
+
id: str(snapRaw, "id"),
|
|
150
|
+
commit: str(snapRaw, "commit"),
|
|
151
|
+
created: bool(snapRaw, "created"),
|
|
152
|
+
sizeBytes: num(snapRaw, "sizeBytes"),
|
|
153
|
+
}
|
|
154
|
+
: undefined;
|
|
155
|
+
const resultRaw = obj(d, "result");
|
|
156
|
+
const didWait = bool(d, "waited") ?? waited;
|
|
157
|
+
const exitCode = resultRaw ? num(resultRaw, "exit_code") : undefined;
|
|
158
|
+
const record = {
|
|
159
|
+
status: "launched",
|
|
160
|
+
script: str(d, "script") ?? script,
|
|
161
|
+
server,
|
|
162
|
+
namespace,
|
|
163
|
+
queue: str(d, "queue") ?? queue,
|
|
164
|
+
waited: didWait,
|
|
165
|
+
invocationId: str(d, "invocationId"),
|
|
166
|
+
snapshot,
|
|
167
|
+
exitCode,
|
|
168
|
+
stdout: resultRaw ? str(resultRaw, "stdout") : undefined,
|
|
169
|
+
stderr: resultRaw ? str(resultRaw, "stderr") : undefined,
|
|
170
|
+
};
|
|
171
|
+
// A wait that produced no result is a broken contract, not a success — say so
|
|
172
|
+
// rather than reporting a launch that may never have run.
|
|
173
|
+
if (didWait && exitCode === undefined) {
|
|
174
|
+
return reject(opts, "the dreamlake-lakeshore bridge produced no result", { script, server, namespace, queue }, "BridgeNoResult");
|
|
175
|
+
}
|
|
176
|
+
if (didWait)
|
|
177
|
+
record.status = exitCode === 0 ? "completed" : "failed";
|
|
178
|
+
if (opts.json) {
|
|
179
|
+
emitJson(record);
|
|
180
|
+
return exitCode === undefined || exitCode === 0 ? 0 : 1;
|
|
181
|
+
}
|
|
182
|
+
// ── what the implicit snapshot did, before the launch line ──
|
|
183
|
+
if (snapshot?.id) {
|
|
184
|
+
const size = snapshot.sizeBytes !== undefined ? `, uploaded ${humanSize(snapshot.sizeBytes)}` : "";
|
|
185
|
+
ok(snapshot.created === false
|
|
186
|
+
? `snapshot ${snapshot.id} (commit ${shortCommit(snapshot.commit)}, unchanged)`
|
|
187
|
+
: `snapshot ${snapshot.id} (commit ${shortCommit(snapshot.commit)}${size})`);
|
|
188
|
+
}
|
|
189
|
+
ok(`launched ${record.invocationId ?? "(no id)"} on queue '${record.queue}'`);
|
|
190
|
+
if (!didWait) {
|
|
191
|
+
process.stdout.write(` dreamlake launch ${script} --queue ${record.queue} # re-run\n`);
|
|
192
|
+
return 0;
|
|
193
|
+
}
|
|
194
|
+
// The script's own streams, verbatim and unwrapped. Anything this command
|
|
195
|
+
// adds around them would be noise in a log the operator came here to read.
|
|
196
|
+
if (record.stdout)
|
|
197
|
+
process.stdout.write(record.stdout);
|
|
198
|
+
if (record.stderr)
|
|
199
|
+
process.stderr.write(record.stderr);
|
|
200
|
+
if (exitCode === 0) {
|
|
201
|
+
ok(`${record.script} exited 0`);
|
|
202
|
+
return 0;
|
|
203
|
+
}
|
|
204
|
+
fail(`${record.script} exited ${exitCode}`);
|
|
205
|
+
return 1;
|
|
206
|
+
}
|
|
207
|
+
/** The one error exit: prose to stderr, or folded into the `--json` object. */
|
|
208
|
+
function reject(opts, message, where, kind) {
|
|
209
|
+
if (opts.json) {
|
|
210
|
+
const result = {
|
|
211
|
+
status: "error",
|
|
212
|
+
script: where.script,
|
|
213
|
+
server: where.server,
|
|
214
|
+
namespace: where.namespace,
|
|
215
|
+
queue: where.queue,
|
|
216
|
+
waited: opts.wait !== false,
|
|
217
|
+
error: message,
|
|
218
|
+
kind,
|
|
219
|
+
};
|
|
220
|
+
emitJson(result);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
fail(message);
|
|
224
|
+
}
|
|
225
|
+
return 1;
|
|
226
|
+
}
|
|
227
|
+
// ─── registration ────────────────────────────────────────────────────────────
|
|
228
|
+
//
|
|
229
|
+
// NO `--version` OPTION HERE, EVER — `program.version()` resolves from any
|
|
230
|
+
// descendant, so one would make `dreamlake launch --version` print 0.6.0 and
|
|
231
|
+
// exit 0 without launching anything.
|
|
232
|
+
function collect(value, previous) {
|
|
233
|
+
return [...previous, value];
|
|
234
|
+
}
|
|
235
|
+
export function registerLaunchCommand(program) {
|
|
236
|
+
program
|
|
237
|
+
.command("launch")
|
|
238
|
+
.description("run a repo script on the fabric — snapshots this working tree, queues it, and waits for the result")
|
|
239
|
+
.argument("<script>", "repo-relative path of the script to run, e.g. train.py")
|
|
240
|
+
.option("--queue <name>", "queue to submit to (default: $LAKESHORE_QUEUE, else `queue:` in .dreamrc). Never guessed")
|
|
241
|
+
.option("--snapshot <ref>", [
|
|
242
|
+
"launch an existing snapshot instead of this working tree.",
|
|
243
|
+
"Accepts a 24-hex snapshot id, a 40-hex commit, or <remote>@<commit>.",
|
|
244
|
+
"Omit it and the tree is snapshotted implicitly, which uploads nothing",
|
|
245
|
+
"when the commit is already registered.",
|
|
246
|
+
].join(" "))
|
|
247
|
+
.option("--arg <value>", "argument to pass to the script; repeat for more", collect, [])
|
|
248
|
+
.option("--no-wait", "submit and print the invocation id instead of waiting for the result")
|
|
249
|
+
.option("--server <url>", "control plane base URL (default: $LAKESHORE_URL; local: cd dreamlake-starter-kit && make up)")
|
|
250
|
+
.option("--namespace <slug>", "control-plane namespace (default: $LAKESHORE_NAMESPACE, else 'default')")
|
|
251
|
+
.option("--json", "emit one { status, invocationId, exitCode, stdout, stderr, … } object instead of prose")
|
|
252
|
+
.addHelpText("after", [
|
|
253
|
+
"",
|
|
254
|
+
"The control plane picks the node — a launch names a QUEUE, never a machine.",
|
|
255
|
+
"A queue name that no worker serves is not an error anywhere: the invocation",
|
|
256
|
+
"just sits there. That is why the queue is resolved and never defaulted.",
|
|
257
|
+
"",
|
|
258
|
+
"EXIT CODE: 0 when the script exited 0, 1 when it did not. The script's own",
|
|
259
|
+
"stdout and stderr are printed through verbatim; under --json they are the",
|
|
260
|
+
"`stdout` / `stderr` fields and the real number is `exitCode`.",
|
|
261
|
+
"",
|
|
262
|
+
"This talks to the control plane only — it needs no `dreamlake login`.",
|
|
263
|
+
"",
|
|
264
|
+
"Examples:",
|
|
265
|
+
" dreamlake launch train.py --queue cpu",
|
|
266
|
+
" dreamlake launch train.py --arg --epochs --arg 10",
|
|
267
|
+
" dreamlake launch eval.py --snapshot 665f0a1b2c3d4e5f60718293 --no-wait",
|
|
268
|
+
].join("\n"))
|
|
269
|
+
.action(async (script, opts) => process.exit(await runLaunch(script, opts)));
|
|
270
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { collectionList } from "../collection-list.js";
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { evaluateLayout, listPages } from './transport.js';
|
|
4
|
+
export function registerLayoutCommand(program) {
|
|
5
|
+
const layout = program.command('layout').description('inspect and control an explicitly selected browser layout');
|
|
6
|
+
const common = (command, page = true, target = true) => {
|
|
7
|
+
command.requiredOption('--cdp <url>', 'explicit loopback browser debugging endpoint');
|
|
8
|
+
if (page)
|
|
9
|
+
command.requiredOption('--page <id>', 'page ID from layout pages');
|
|
10
|
+
if (target)
|
|
11
|
+
command.requiredOption('--layout <id>', 'layout ID from layout list');
|
|
12
|
+
return command;
|
|
13
|
+
};
|
|
14
|
+
const execute = async (fn, operation) => {
|
|
15
|
+
try {
|
|
16
|
+
const result = await fn();
|
|
17
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
18
|
+
if (operation === 'resolve' || operation === 'apply') {
|
|
19
|
+
const status = result?.status;
|
|
20
|
+
if (status !== (operation === 'apply' ? 'applied' : 'ready'))
|
|
21
|
+
process.exitCode = 1;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
process.stderr.write(`${JSON.stringify({ status: 'error', message: error instanceof Error ? error.message : String(error) })}\n`);
|
|
26
|
+
process.exitCode = 1;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
common(layout.command('pages').description('list browser page IDs'), false, false).action(opts => execute(async () => (await listPages(opts.cdp)).map(({ id, title, url }) => ({ id, title, url }))));
|
|
30
|
+
common(collectionList(layout, 'list').description('list registered layouts in a page'), true, false).action(opts => execute(() => evaluateLayout(opts.cdp, opts.page, 'list')));
|
|
31
|
+
common(layout.command('inspect').description('inspect regions, tabs, bounds and revision')).action(opts => execute(() => evaluateLayout(opts.cdp, opts.page, 'inspect', opts.layout)));
|
|
32
|
+
for (const operation of ['resolve', 'apply']) {
|
|
33
|
+
common(layout.command(operation).argument('<request.json>', 'path to a declarative JSON request').description(operation === 'resolve' ? 'explain a request without changing layout' : 'apply a request with revision and disposal guards'))
|
|
34
|
+
.action((file, opts) => execute(async () => {
|
|
35
|
+
const source = await readFile(file, 'utf8');
|
|
36
|
+
if (source.length > 65536)
|
|
37
|
+
throw new Error('Layout request exceeds 64 KiB');
|
|
38
|
+
const request = JSON.parse(source);
|
|
39
|
+
if (!request || typeof request !== 'object' || Array.isArray(request))
|
|
40
|
+
throw new Error('Layout request must be an object');
|
|
41
|
+
return evaluateLayout(opts.cdp, opts.page, operation, opts.layout, request);
|
|
42
|
+
}, operation));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Explicit loopback CDP attachment. Never guesses a page or enables debugging. */
|
|
2
|
+
export declare function localEndpoint(raw: string, protocols?: string[]): URL;
|
|
3
|
+
export interface BrowserPage {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
url: string;
|
|
7
|
+
webSocketDebuggerUrl?: string;
|
|
8
|
+
type: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function listPages(endpoint: string): Promise<BrowserPage[]>;
|
|
11
|
+
export declare function registryExpression(operation: 'list' | 'inspect' | 'resolve' | 'apply', layoutId?: string, request?: unknown): string;
|
|
12
|
+
export declare function evaluateLayout(endpoint: string, pageId: string, operation: 'list' | 'inspect' | 'resolve' | 'apply', layoutId?: string, request?: unknown): Promise<unknown>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** Explicit loopback CDP attachment. Never guesses a page or enables debugging. */
|
|
2
|
+
export function localEndpoint(raw, protocols = ['http:', 'https:']) {
|
|
3
|
+
const url = new URL(raw);
|
|
4
|
+
if (!protocols.includes(url.protocol) || !['localhost', '127.0.0.1', '[::1]'].includes(url.hostname) || url.username || url.password) {
|
|
5
|
+
throw new Error('Layout control requires an explicit loopback CDP endpoint without credentials');
|
|
6
|
+
}
|
|
7
|
+
return url;
|
|
8
|
+
}
|
|
9
|
+
export async function listPages(endpoint) {
|
|
10
|
+
const base = localEndpoint(endpoint);
|
|
11
|
+
const response = await fetch(new URL('/json/list', base), { signal: AbortSignal.timeout(10000), redirect: 'error' });
|
|
12
|
+
if (!response.ok)
|
|
13
|
+
throw new Error(`CDP page listing failed (${response.status})`);
|
|
14
|
+
const data = await response.json();
|
|
15
|
+
if (!Array.isArray(data))
|
|
16
|
+
throw new Error('CDP returned an invalid page list');
|
|
17
|
+
return data.filter((p) => p && p.type === 'page' && typeof p.id === 'string' && typeof p.url === 'string');
|
|
18
|
+
}
|
|
19
|
+
export function registryExpression(operation, layoutId, request) {
|
|
20
|
+
// All variable inputs are JSON values, never executable source.
|
|
21
|
+
return `(async () => { const registry = window.dreamlakeLayouts;
|
|
22
|
+
if (!registry || registry.version !== 1) throw new Error('This page has no layout-control protocol v1');
|
|
23
|
+
if (${JSON.stringify(operation)} === 'list') return registry.list();
|
|
24
|
+
return await registry.dispatch(${JSON.stringify(layoutId)}, ${JSON.stringify(operation)}, ${JSON.stringify(request ?? null)});
|
|
25
|
+
})()`;
|
|
26
|
+
}
|
|
27
|
+
export async function evaluateLayout(endpoint, pageId, operation, layoutId, request) {
|
|
28
|
+
const pages = await listPages(endpoint);
|
|
29
|
+
const page = pages.find(p => p.id === pageId);
|
|
30
|
+
if (!page?.webSocketDebuggerUrl)
|
|
31
|
+
throw new Error('Selected browser page is not available; list pages again');
|
|
32
|
+
const socketUrl = localEndpoint(page.webSocketDebuggerUrl, ['ws:', 'wss:']);
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
const socket = new WebSocket(socketUrl);
|
|
35
|
+
let done = false;
|
|
36
|
+
const finish = (error, value) => {
|
|
37
|
+
if (done)
|
|
38
|
+
return;
|
|
39
|
+
done = true;
|
|
40
|
+
clearTimeout(timer);
|
|
41
|
+
socket.close();
|
|
42
|
+
if (error)
|
|
43
|
+
reject(error);
|
|
44
|
+
else
|
|
45
|
+
resolve(value);
|
|
46
|
+
};
|
|
47
|
+
const timer = setTimeout(() => finish(new Error('Layout command timed out; inspect before retrying because an apply may have completed')), 15000);
|
|
48
|
+
socket.addEventListener('open', () => socket.send(JSON.stringify({ id: 1, method: 'Runtime.evaluate', params: { expression: registryExpression(operation, layoutId, request), awaitPromise: true, returnByValue: true } })));
|
|
49
|
+
socket.addEventListener('error', () => finish(new Error('Could not connect to the selected browser page')));
|
|
50
|
+
socket.addEventListener('close', () => finish(new Error('Browser connection closed; inspect before retrying an apply')));
|
|
51
|
+
socket.addEventListener('message', event => {
|
|
52
|
+
try {
|
|
53
|
+
const message = JSON.parse(String(event.data));
|
|
54
|
+
if (message.id !== 1)
|
|
55
|
+
return;
|
|
56
|
+
if (message.error)
|
|
57
|
+
return finish(new Error(`CDP request failed: ${message.error.message}`));
|
|
58
|
+
const result = message.result;
|
|
59
|
+
if (result?.exceptionDetails)
|
|
60
|
+
return finish(new Error(result.exceptionDetails.exception?.description ?? result.exceptionDetails.text ?? 'Layout operation failed'));
|
|
61
|
+
if (!result?.result || !('value' in result.result))
|
|
62
|
+
return finish(new Error('Layout protocol returned no serializable result'));
|
|
63
|
+
finish(undefined, result.result.value);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
finish(error instanceof Error ? error : new Error(String(error)));
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { type DreamlakeOpts } from "../compat/ctx.js";
|
|
3
|
+
import { type LibraryAsset, type LibraryManifest } from "./manifest.js";
|
|
4
|
+
import { type UploadItem } from "./push.js";
|
|
5
|
+
export interface RemoteLibrary {
|
|
6
|
+
revision: number;
|
|
7
|
+
manifest: LibraryManifest;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The remote document a single-asset edit merges against: the detail row's
|
|
11
|
+
* revision (the CAS token) and the manifest. A library that answers 404 on
|
|
12
|
+
* either has never been pushed — remote edits need an existing library.
|
|
13
|
+
*/
|
|
14
|
+
export declare function fetchRemoteLibrary(base: string, token: string, spec: string): Promise<RemoteLibrary | {
|
|
15
|
+
error: string;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Upload `items` (positional, already batch-safe sizes) through the library
|
|
19
|
+
* presign flow. `absByRel` maps each relativePath to the local file that
|
|
20
|
+
* carries its bytes.
|
|
21
|
+
*/
|
|
22
|
+
export declare function uploadLibraryFiles(base: string, token: string, items: readonly UploadItem[], absByRel: ReadonlyMap<string, string>, fetchFn?: typeof fetch): Promise<void>;
|
|
23
|
+
/** Serialize a merged manifest into `dir` for upload at the reserved path. */
|
|
24
|
+
export declare function writeManifestFile(dir: string, manifest: LibraryManifest): {
|
|
25
|
+
abs: string;
|
|
26
|
+
size: number;
|
|
27
|
+
};
|
|
28
|
+
export interface LibraryAddArgs extends DreamlakeOpts {
|
|
29
|
+
spec: string;
|
|
30
|
+
assetPath: string;
|
|
31
|
+
id?: string;
|
|
32
|
+
title?: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
category?: string;
|
|
35
|
+
tags?: string;
|
|
36
|
+
license?: string;
|
|
37
|
+
attribution?: string;
|
|
38
|
+
replace?: boolean;
|
|
39
|
+
dryRun?: boolean;
|
|
40
|
+
json?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface LibraryAddDeps {
|
|
43
|
+
fetchFn?: typeof fetch;
|
|
44
|
+
/** Test override for the hash-cache file (defaults under ~/.dreamlake). */
|
|
45
|
+
hashCacheFile?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The merged document: remote manifest verbatim with the new entry appended
|
|
49
|
+
* (or swapped in place under --replace). generated[] is carried verbatim —
|
|
50
|
+
* the objects are still in storage and reconcile keeps what the manifest
|
|
51
|
+
* lists. A replaced asset that loses its own thumbnail keeps pointing at its
|
|
52
|
+
* still-listed generated render, matching push's carry-forward.
|
|
53
|
+
*/
|
|
54
|
+
export declare function mergeAssetEntry(remote: LibraryManifest, entry: LibraryAsset, replace: boolean): {
|
|
55
|
+
merged: LibraryManifest;
|
|
56
|
+
} | {
|
|
57
|
+
error: string;
|
|
58
|
+
};
|
|
59
|
+
export declare function runLibraryAdd(args: LibraryAddArgs, deps?: LibraryAddDeps): Promise<number>;
|
|
60
|
+
export declare function registerLibraryAddCommand(library: Command, withConnFlags: (c: Command) => Command): void;
|