@dreamlake/dreamlake-cli 0.88.0 → 0.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,33 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { type DreamlakeOpts } from "../compat/ctx.js";
|
|
3
|
+
export interface LibraryListArgs extends DreamlakeOpts {
|
|
4
|
+
namespace?: string;
|
|
5
|
+
/** GET /libraries — all visible libraries across namespaces. */
|
|
6
|
+
all?: boolean;
|
|
7
|
+
json?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface LibraryRow {
|
|
10
|
+
namespace?: unknown;
|
|
11
|
+
name?: unknown;
|
|
12
|
+
type?: unknown;
|
|
13
|
+
title?: unknown;
|
|
14
|
+
description?: unknown;
|
|
15
|
+
assetCount?: unknown;
|
|
16
|
+
totalBytes?: unknown;
|
|
17
|
+
visibility?: unknown;
|
|
18
|
+
updatedAt?: unknown;
|
|
19
|
+
[k: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The table, hand-rendered rather than through renderTable: a library's
|
|
23
|
+
* description hangs as an indented line under its row, which a rectangular
|
|
24
|
+
* renderer cannot interleave. The description stays — it is what an agent
|
|
25
|
+
* reads to decide which library to search. With `all`, the first column is
|
|
26
|
+
* the namespace-qualified name, pasteable into pull/search.
|
|
27
|
+
*/
|
|
28
|
+
export declare function renderLibraryTable(libraries: LibraryRow[], opts?: {
|
|
29
|
+
all?: boolean;
|
|
30
|
+
}): string;
|
|
31
|
+
export declare function runLibraryList(args: LibraryListArgs): Promise<number>;
|
|
32
|
+
export declare function registerLibraryListCommand(library: Command, withConnFlags: (c: Command) => Command): void;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { collectionList } from "../collection-list.js";
|
|
2
|
+
import { emitJson, fail, humanSize } from "../helpers.js";
|
|
3
|
+
import { resolveCtx } from "../compat/ctx.js";
|
|
4
|
+
import { errorMessage, jsonRequest, requireNamespace } from "../compat/http.js";
|
|
5
|
+
const TAIL_COLUMNS = ["TYPE", "TITLE", "ASSETS", "SIZE", "VISIBILITY", "UPDATED"];
|
|
6
|
+
function cell(v) {
|
|
7
|
+
if (v === null || v === undefined || v === "")
|
|
8
|
+
return "—";
|
|
9
|
+
return String(v);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The table, hand-rendered rather than through renderTable: a library's
|
|
13
|
+
* description hangs as an indented line under its row, which a rectangular
|
|
14
|
+
* renderer cannot interleave. The description stays — it is what an agent
|
|
15
|
+
* reads to decide which library to search. With `all`, the first column is
|
|
16
|
+
* the namespace-qualified name, pasteable into pull/search.
|
|
17
|
+
*/
|
|
18
|
+
export function renderLibraryTable(libraries, opts = {}) {
|
|
19
|
+
const columns = [opts.all ? "NAMESPACE/LIBRARY" : "NAME", ...TAIL_COLUMNS];
|
|
20
|
+
const rows = libraries.map((lib) => ({
|
|
21
|
+
cells: [
|
|
22
|
+
opts.all ? `${cell(lib.namespace)}/${cell(lib.name)}` : cell(lib.name),
|
|
23
|
+
cell(lib.type),
|
|
24
|
+
cell(lib.title),
|
|
25
|
+
cell(typeof lib.assetCount === "number" ? lib.assetCount : undefined),
|
|
26
|
+
typeof lib.totalBytes === "number" ? humanSize(lib.totalBytes) : "—",
|
|
27
|
+
cell(lib.visibility),
|
|
28
|
+
typeof lib.updatedAt === "string" ? lib.updatedAt.slice(0, 10) : "—",
|
|
29
|
+
],
|
|
30
|
+
description: typeof lib.description === "string" && lib.description !== "" ? lib.description : null,
|
|
31
|
+
}));
|
|
32
|
+
const widths = columns.map((c, i) => Math.max(c.length, ...rows.map((r) => r.cells[i].length)));
|
|
33
|
+
const line = (cells) => cells.map((c, i) => c.padEnd(widths[i])).join(" ").trimEnd();
|
|
34
|
+
const out = [line(columns)];
|
|
35
|
+
for (const r of rows) {
|
|
36
|
+
out.push(line(r.cells));
|
|
37
|
+
if (r.description)
|
|
38
|
+
out.push(` ${r.description}`);
|
|
39
|
+
}
|
|
40
|
+
return out.join("\n") + "\n";
|
|
41
|
+
}
|
|
42
|
+
export async function runLibraryList(args) {
|
|
43
|
+
if (args.all && args.namespace) {
|
|
44
|
+
fail("--all lists every visible namespace — drop --namespace, or drop --all");
|
|
45
|
+
return 1;
|
|
46
|
+
}
|
|
47
|
+
const ctx = resolveCtx(args);
|
|
48
|
+
let namespace = null;
|
|
49
|
+
let url;
|
|
50
|
+
if (args.all) {
|
|
51
|
+
url = `${ctx.remote}/libraries`;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
namespace = await requireNamespace(ctx, args.namespace);
|
|
55
|
+
if (!namespace)
|
|
56
|
+
return 1;
|
|
57
|
+
url = `${ctx.remote}/namespaces/${encodeURIComponent(namespace)}/libraries`;
|
|
58
|
+
}
|
|
59
|
+
const r = await jsonRequest("GET", url, ctx.token);
|
|
60
|
+
if (r.status !== 200) {
|
|
61
|
+
fail(`could not list libraries → ${r.status}: ${errorMessage(r)}`);
|
|
62
|
+
return 1;
|
|
63
|
+
}
|
|
64
|
+
const body = (r.body ?? {});
|
|
65
|
+
if (args.json) {
|
|
66
|
+
emitJson(body);
|
|
67
|
+
return 0;
|
|
68
|
+
}
|
|
69
|
+
const libraries = Array.isArray(body.libraries) ? body.libraries : [];
|
|
70
|
+
if (libraries.length === 0) {
|
|
71
|
+
process.stdout.write(args.all ? "no libraries visible.\n" : `no libraries in namespace '${namespace}'.\n`);
|
|
72
|
+
return 0;
|
|
73
|
+
}
|
|
74
|
+
process.stdout.write(args.all ? "Libraries (all public + yours):\n" : `Libraries in ${namespace}:\n`);
|
|
75
|
+
process.stdout.write(renderLibraryTable(libraries, { all: args.all }));
|
|
76
|
+
return 0;
|
|
77
|
+
}
|
|
78
|
+
export function registerLibraryListCommand(library, withConnFlags) {
|
|
79
|
+
withConnFlags(collectionList(library, "list")
|
|
80
|
+
.description("list asset libraries in a namespace")
|
|
81
|
+
.option("--namespace <slug>", "namespace (default: active login)")
|
|
82
|
+
.option("--all", "list all visible libraries (public + yours) across namespaces")
|
|
83
|
+
.option("--json", "emit raw JSON")).action(async (opts) => {
|
|
84
|
+
process.exit(await runLibraryList(opts));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export declare const LIBRARY_MANIFEST_SCHEMA = "dreamlake.assets/v1";
|
|
2
|
+
/** The reserved dot-directory for platform-generated artifacts. User file
|
|
3
|
+
* paths may never enter it; `generated[]` paths may never leave it. */
|
|
4
|
+
export declare const RESERVED_PREFIX = ".dreamlake/";
|
|
5
|
+
/** Where the wire manifest uploads to (server MANIFEST_PATH_PRIMARY), and
|
|
6
|
+
* the legacy root location old pushes registered (still served by the
|
|
7
|
+
* server's /manifest fallback). */
|
|
8
|
+
export declare const MANIFEST_PATH_PRIMARY = ".dreamlake/manifest.json";
|
|
9
|
+
export declare const MANIFEST_PATH_LEGACY = "assets.json";
|
|
10
|
+
/** Generated-artifact locations under the reserved dot-dir. */
|
|
11
|
+
export declare const GENERATED_VECTORS_JSON = ".dreamlake/vectors.json";
|
|
12
|
+
export declare const GENERATED_VECTORS_F32 = ".dreamlake/vectors.f32";
|
|
13
|
+
export declare const GENERATED_THUMBNAILS_PREFIX = ".dreamlake/thumbnails/";
|
|
14
|
+
/** The pre-dot-dir generated trio at the files/ root — never user content,
|
|
15
|
+
* so default pulls skip these names too. */
|
|
16
|
+
export declare const LEGACY_GENERATED_PATHS: readonly ["assets.json", "assets.vectors.json", "assets.vectors.f32"];
|
|
17
|
+
export interface LibraryAssetFile {
|
|
18
|
+
path: string;
|
|
19
|
+
size: number;
|
|
20
|
+
sha256: string;
|
|
21
|
+
}
|
|
22
|
+
export interface LibraryAsset {
|
|
23
|
+
id: string;
|
|
24
|
+
entry?: string;
|
|
25
|
+
thumbnail?: string;
|
|
26
|
+
files: LibraryAssetFile[];
|
|
27
|
+
[k: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
export interface LibraryManifest {
|
|
30
|
+
schema: typeof LIBRARY_MANIFEST_SCHEMA;
|
|
31
|
+
library?: {
|
|
32
|
+
name?: string;
|
|
33
|
+
type?: string;
|
|
34
|
+
title?: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
[k: string]: unknown;
|
|
37
|
+
};
|
|
38
|
+
assets: LibraryAsset[];
|
|
39
|
+
/** Platform artifacts uploaded beside the files — every path under
|
|
40
|
+
* `.dreamlake/`. Absent on legacy manifests. */
|
|
41
|
+
generated?: string[];
|
|
42
|
+
[k: string]: unknown;
|
|
43
|
+
}
|
|
44
|
+
/** Reject a manifest path that could escape the library directory. The same
|
|
45
|
+
* rule env manifests apply — POSIX-relative, no empty/./.. segments. */
|
|
46
|
+
export declare function invalidRelPath(p: string): string | null;
|
|
47
|
+
/**
|
|
48
|
+
* Refuse a value that is not a dreamlake.assets/v1 manifest this CLI can act
|
|
49
|
+
* on. `where` names the document in errors.
|
|
50
|
+
*/
|
|
51
|
+
export declare function assertLibraryManifest(v: unknown, where?: string): LibraryManifest;
|
|
52
|
+
export interface ManifestFileStat {
|
|
53
|
+
size: number;
|
|
54
|
+
sha256: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The manifest's USER-file closure: every distinct asset-file path →
|
|
58
|
+
* {size, sha256}. generated[] is deliberately not part of this map — it has
|
|
59
|
+
* no hashes and no membership in the diff.
|
|
60
|
+
*
|
|
61
|
+
* Assets may legitimately share a file (a common texture); what they may NOT
|
|
62
|
+
* do is disagree about it — two declarations of one path with different
|
|
63
|
+
* content would make the diff, the upload and the register describe three
|
|
64
|
+
* different libraries.
|
|
65
|
+
*/
|
|
66
|
+
export declare function manifestFileMap(manifest: LibraryManifest): Map<string, ManifestFileStat>;
|
|
67
|
+
/** Streamed sha256 of one file, hex — never the whole file in memory. */
|
|
68
|
+
export declare function sha256File(absPath: string): Promise<string>;
|
|
69
|
+
export interface LibraryDiff {
|
|
70
|
+
/** Local paths missing remotely, or whose sha256 differs. */
|
|
71
|
+
upload: string[];
|
|
72
|
+
/** Local paths whose remote copy already matches. */
|
|
73
|
+
unchanged: string[];
|
|
74
|
+
/** Remote paths absent locally — the server reconciles these away at register. */
|
|
75
|
+
removed: string[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The push plan, by (path, sha256). `remote` null means "never pushed":
|
|
79
|
+
* everything is new and nothing can be removed.
|
|
80
|
+
*/
|
|
81
|
+
export declare function diffFileMaps(local: Map<string, ManifestFileStat>, remote: Map<string, ManifestFileStat> | null): LibraryDiff;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// Wire-manifest handling for `dreamlake library` — the dreamlake.assets/v1
|
|
2
|
+
// document the CLI GENERATES at push (into the cache dir, uploaded to
|
|
3
|
+
// `files/.dreamlake/manifest.json`) and reads back from the server for
|
|
4
|
+
// diffing and pulling. Users never author this file: their input is the
|
|
5
|
+
// source directory plus an optional dreamlake.yml (config.ts / discover.ts).
|
|
6
|
+
//
|
|
7
|
+
// Validation here is deliberately LIGHT: the schema string, the assets
|
|
8
|
+
// array, the per-asset id and files[{path,size,sha256}] closure, entry
|
|
9
|
+
// membership in that closure and thumbnail membership in closure ∪
|
|
10
|
+
// generated. The server owns the full schema; refusing here on fields this
|
|
11
|
+
// CLI never reads would reject manifests newer tools write.
|
|
12
|
+
import { createHash } from "node:crypto";
|
|
13
|
+
import { createReadStream } from "node:fs";
|
|
14
|
+
export const LIBRARY_MANIFEST_SCHEMA = "dreamlake.assets/v1";
|
|
15
|
+
/** The reserved dot-directory for platform-generated artifacts. User file
|
|
16
|
+
* paths may never enter it; `generated[]` paths may never leave it. */
|
|
17
|
+
export const RESERVED_PREFIX = ".dreamlake/";
|
|
18
|
+
/** Where the wire manifest uploads to (server MANIFEST_PATH_PRIMARY), and
|
|
19
|
+
* the legacy root location old pushes registered (still served by the
|
|
20
|
+
* server's /manifest fallback). */
|
|
21
|
+
export const MANIFEST_PATH_PRIMARY = ".dreamlake/manifest.json";
|
|
22
|
+
export const MANIFEST_PATH_LEGACY = "assets.json";
|
|
23
|
+
/** Generated-artifact locations under the reserved dot-dir. */
|
|
24
|
+
export const GENERATED_VECTORS_JSON = ".dreamlake/vectors.json";
|
|
25
|
+
export const GENERATED_VECTORS_F32 = ".dreamlake/vectors.f32";
|
|
26
|
+
export const GENERATED_THUMBNAILS_PREFIX = ".dreamlake/thumbnails/";
|
|
27
|
+
/** The pre-dot-dir generated trio at the files/ root — never user content,
|
|
28
|
+
* so default pulls skip these names too. */
|
|
29
|
+
export const LEGACY_GENERATED_PATHS = [
|
|
30
|
+
MANIFEST_PATH_LEGACY,
|
|
31
|
+
"assets.vectors.json",
|
|
32
|
+
"assets.vectors.f32",
|
|
33
|
+
];
|
|
34
|
+
/** Reject a manifest path that could escape the library directory. The same
|
|
35
|
+
* rule env manifests apply — POSIX-relative, no empty/./.. segments. */
|
|
36
|
+
export function invalidRelPath(p) {
|
|
37
|
+
if (!p)
|
|
38
|
+
return "empty path";
|
|
39
|
+
if (p.length > 1024)
|
|
40
|
+
return "path too long";
|
|
41
|
+
if (p.startsWith("/") || p.includes("\\") || p.includes("://"))
|
|
42
|
+
return `invalid path '${p}'`;
|
|
43
|
+
if (p.split("/").some((seg) => seg === "" || seg === "." || seg === "..")) {
|
|
44
|
+
return `invalid path '${p}'`;
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
function isRecord(v) {
|
|
49
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Refuse a value that is not a dreamlake.assets/v1 manifest this CLI can act
|
|
53
|
+
* on. `where` names the document in errors.
|
|
54
|
+
*/
|
|
55
|
+
export function assertLibraryManifest(v, where = "the manifest") {
|
|
56
|
+
const bad = (what) => {
|
|
57
|
+
throw new Error(`${where}: ${what}`);
|
|
58
|
+
};
|
|
59
|
+
if (!isRecord(v))
|
|
60
|
+
bad("expected a JSON object");
|
|
61
|
+
const m = v;
|
|
62
|
+
if (m.schema !== LIBRARY_MANIFEST_SCHEMA) {
|
|
63
|
+
bad(`schema must be '${LIBRARY_MANIFEST_SCHEMA}' (got ${JSON.stringify(m.schema ?? null)})`);
|
|
64
|
+
}
|
|
65
|
+
if (m.library !== undefined && !isRecord(m.library))
|
|
66
|
+
bad("'library' must be an object");
|
|
67
|
+
if (!Array.isArray(m.assets))
|
|
68
|
+
bad("'assets' must be an array");
|
|
69
|
+
const generated = new Set();
|
|
70
|
+
if (m.generated !== undefined && m.generated !== null) {
|
|
71
|
+
if (!Array.isArray(m.generated))
|
|
72
|
+
bad("'generated' must be an array of paths");
|
|
73
|
+
m.generated.forEach((g, i) => {
|
|
74
|
+
if (typeof g !== "string")
|
|
75
|
+
bad(`generated[${i}]: expected a path string`);
|
|
76
|
+
const badPath = invalidRelPath(g);
|
|
77
|
+
if (badPath)
|
|
78
|
+
bad(`generated[${i}]: ${badPath}`);
|
|
79
|
+
if (!g.startsWith(RESERVED_PREFIX)) {
|
|
80
|
+
bad(`generated[${i}] ('${g}'): must live under '${RESERVED_PREFIX}'`);
|
|
81
|
+
}
|
|
82
|
+
generated.add(g);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
m.assets.forEach((raw, i) => {
|
|
86
|
+
const at = `assets[${i}]`;
|
|
87
|
+
if (!isRecord(raw))
|
|
88
|
+
bad(`${at}: expected an object`);
|
|
89
|
+
const asset = raw;
|
|
90
|
+
if (typeof asset.id !== "string" || asset.id === "")
|
|
91
|
+
bad(`${at}: missing 'id'`);
|
|
92
|
+
if (!Array.isArray(asset.files) || asset.files.length === 0) {
|
|
93
|
+
bad(`${at} ('${String(asset.id)}'): 'files' must be a non-empty array`);
|
|
94
|
+
}
|
|
95
|
+
const paths = new Set();
|
|
96
|
+
asset.files.forEach((f, j) => {
|
|
97
|
+
const fat = `${at}.files[${j}]`;
|
|
98
|
+
if (!isRecord(f))
|
|
99
|
+
bad(`${fat}: expected an object`);
|
|
100
|
+
const file = f;
|
|
101
|
+
if (typeof file.path !== "string")
|
|
102
|
+
bad(`${fat}: missing 'path'`);
|
|
103
|
+
const badPath = invalidRelPath(file.path);
|
|
104
|
+
if (badPath)
|
|
105
|
+
bad(`${fat}: ${badPath}`);
|
|
106
|
+
if (typeof file.size !== "number" ||
|
|
107
|
+
!Number.isSafeInteger(file.size) ||
|
|
108
|
+
file.size < 0) {
|
|
109
|
+
bad(`${fat} ('${String(file.path)}'): 'size' must be a non-negative integer`);
|
|
110
|
+
}
|
|
111
|
+
if (typeof file.sha256 !== "string" || !/^[0-9a-f]{64}$/i.test(file.sha256)) {
|
|
112
|
+
bad(`${fat} ('${String(file.path)}'): 'sha256' must be a 64-hex-digit string`);
|
|
113
|
+
}
|
|
114
|
+
paths.add(file.path);
|
|
115
|
+
});
|
|
116
|
+
// entry points INTO the closure; a thumbnail may instead be a platform
|
|
117
|
+
// artifact listed in top-level generated[] (.dreamlake/thumbnails/…).
|
|
118
|
+
const entry = asset.entry;
|
|
119
|
+
if (entry !== undefined && entry !== null) {
|
|
120
|
+
if (typeof entry !== "string")
|
|
121
|
+
bad(`${at} ('${String(asset.id)}'): 'entry' must be a string`);
|
|
122
|
+
else if (!paths.has(entry)) {
|
|
123
|
+
bad(`${at} ('${String(asset.id)}'): entry '${entry}' is not one of the asset's files`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const thumbnail = asset.thumbnail;
|
|
127
|
+
if (thumbnail !== undefined && thumbnail !== null) {
|
|
128
|
+
if (typeof thumbnail !== "string") {
|
|
129
|
+
bad(`${at} ('${String(asset.id)}'): 'thumbnail' must be a string`);
|
|
130
|
+
}
|
|
131
|
+
else if (!paths.has(thumbnail) && !generated.has(thumbnail)) {
|
|
132
|
+
bad(`${at} ('${String(asset.id)}'): thumbnail '${thumbnail}' is not one of the asset's files or generated`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
return v;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The manifest's USER-file closure: every distinct asset-file path →
|
|
140
|
+
* {size, sha256}. generated[] is deliberately not part of this map — it has
|
|
141
|
+
* no hashes and no membership in the diff.
|
|
142
|
+
*
|
|
143
|
+
* Assets may legitimately share a file (a common texture); what they may NOT
|
|
144
|
+
* do is disagree about it — two declarations of one path with different
|
|
145
|
+
* content would make the diff, the upload and the register describe three
|
|
146
|
+
* different libraries.
|
|
147
|
+
*/
|
|
148
|
+
export function manifestFileMap(manifest) {
|
|
149
|
+
const out = new Map();
|
|
150
|
+
for (const asset of manifest.assets) {
|
|
151
|
+
for (const f of asset.files) {
|
|
152
|
+
const prev = out.get(f.path);
|
|
153
|
+
if (prev === undefined) {
|
|
154
|
+
out.set(f.path, { size: f.size, sha256: f.sha256.toLowerCase() });
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
if (prev.size !== f.size || prev.sha256 !== f.sha256.toLowerCase()) {
|
|
158
|
+
throw new Error(`the manifest declares '${f.path}' twice with different content ` +
|
|
159
|
+
`(${prev.size}B ${prev.sha256.slice(0, 12)}… vs ${f.size}B ${f.sha256.slice(0, 12)}…)`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return out;
|
|
164
|
+
}
|
|
165
|
+
/** Streamed sha256 of one file, hex — never the whole file in memory. */
|
|
166
|
+
export function sha256File(absPath) {
|
|
167
|
+
return new Promise((resolve, reject) => {
|
|
168
|
+
const hash = createHash("sha256");
|
|
169
|
+
const stream = createReadStream(absPath);
|
|
170
|
+
stream.on("error", reject);
|
|
171
|
+
stream.on("data", (chunk) => hash.update(chunk));
|
|
172
|
+
stream.on("end", () => resolve(hash.digest("hex")));
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The push plan, by (path, sha256). `remote` null means "never pushed":
|
|
177
|
+
* everything is new and nothing can be removed.
|
|
178
|
+
*/
|
|
179
|
+
export function diffFileMaps(local, remote) {
|
|
180
|
+
const upload = [];
|
|
181
|
+
const unchanged = [];
|
|
182
|
+
const removed = [];
|
|
183
|
+
for (const [p, stat] of local) {
|
|
184
|
+
const theirs = remote?.get(p);
|
|
185
|
+
if (theirs !== undefined && theirs.sha256 === stat.sha256)
|
|
186
|
+
unchanged.push(p);
|
|
187
|
+
else
|
|
188
|
+
upload.push(p);
|
|
189
|
+
}
|
|
190
|
+
if (remote) {
|
|
191
|
+
for (const p of remote.keys()) {
|
|
192
|
+
if (!local.has(p))
|
|
193
|
+
removed.push(p);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
upload.sort();
|
|
197
|
+
unchanged.sort();
|
|
198
|
+
removed.sort();
|
|
199
|
+
return { upload, unchanged, removed };
|
|
200
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type JsonResult } from "../compat/http.js";
|
|
2
|
+
import { type LibraryManifest } from "./manifest.js";
|
|
3
|
+
/** The global size cap over every cached manifest, all libraries together. */
|
|
4
|
+
export declare const MANIFEST_CACHE_MAX_BYTES: number;
|
|
5
|
+
export declare function manifestsCacheDir(): string;
|
|
6
|
+
/** `host` (plus any path prefix, flattened) — the cache's first level, so
|
|
7
|
+
* the same `acme/props` on two remotes never share an entry. */
|
|
8
|
+
export declare function remoteCacheKey(remote: string): string;
|
|
9
|
+
export declare function manifestCacheFile(cacheDir: string, remote: string, namespace: string, name: string, revision: number): string;
|
|
10
|
+
/** The cached manifest at `file`, or undefined. Corrupt or schema-invalid
|
|
11
|
+
* content is a MISS — deleted and refetched, never an error. */
|
|
12
|
+
export declare function readCachedManifest(file: string): LibraryManifest | undefined;
|
|
13
|
+
/** Write-through: atomic store, then keep only this revision for this
|
|
14
|
+
* library, then enforce the global cap over the whole cache tree. */
|
|
15
|
+
export declare function storeCachedManifest(file: string, body: unknown, cacheDir: string, maxBytes?: number): void;
|
|
16
|
+
/** LRU eviction by mtime until the tree fits `maxBytes`. `keep` (the file
|
|
17
|
+
* just written) is never evicted, even when it alone exceeds the cap. */
|
|
18
|
+
export declare function pruneManifestCache(cacheDir: string, maxBytes: number, keep?: string): void;
|
|
19
|
+
export interface FetchManifestOpts {
|
|
20
|
+
remote: string;
|
|
21
|
+
namespace: string;
|
|
22
|
+
name: string;
|
|
23
|
+
token: string | null;
|
|
24
|
+
/** The catalog row's revision — the cache key. null (unknown) always
|
|
25
|
+
* fetches, and never stores. */
|
|
26
|
+
revision: number | null;
|
|
27
|
+
/** Skip the cache read (`--verify`); a fresh 200 still refreshes the store. */
|
|
28
|
+
bypass?: boolean;
|
|
29
|
+
/** Test override for the cache root (default: ~/.dreamlake/cache/libraries/manifests). */
|
|
30
|
+
cacheDir?: string;
|
|
31
|
+
maxBytes?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface FetchManifestResult {
|
|
34
|
+
res: JsonResult;
|
|
35
|
+
fromCache: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* GET `.../manifest`, through the revision-keyed cache. The caller has just
|
|
39
|
+
* read the catalog row; with its `revision` in hand a cached copy of that
|
|
40
|
+
* exact revision answers with zero network I/O. On a miss the real response
|
|
41
|
+
* is returned verbatim (non-200s included) and a 200 body is stored. Cache
|
|
42
|
+
* failures never fail the command — the worst case is the fetch that would
|
|
43
|
+
* have happened anyway.
|
|
44
|
+
*/
|
|
45
|
+
export declare function fetchManifestCached(opts: FetchManifestOpts): Promise<FetchManifestResult>;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// Revision-keyed local cache for remote wire manifests — M1.5 of the asset
|
|
2
|
+
// API. A library's manifest grows with the library (the production
|
|
3
|
+
// supersplat manifest is ~60MB for 14k assets), and every read verb needs
|
|
4
|
+
// it: stat, info, pull's planning and push's remote diff each paid a full
|
|
5
|
+
// download per invocation. The catalog row's `revision` is a CAS counter
|
|
6
|
+
// that changes on EVERY register, which makes it a perfect cache key: read
|
|
7
|
+
// the small detail row first, and serve the manifest from
|
|
8
|
+
//
|
|
9
|
+
// ~/.dreamlake/cache/libraries/manifests/<remote>/<ns>/<name>/<revision>.json
|
|
10
|
+
//
|
|
11
|
+
// when a copy for that exact revision is present. DISPOSABLE, like
|
|
12
|
+
// everything under cache/libraries/: a corrupt or schema-invalid file reads
|
|
13
|
+
// as a miss (and is deleted), a failed store never fails the command. Only
|
|
14
|
+
// the most recently stored revision per library is kept — the counter only
|
|
15
|
+
// moves forward, so any sibling can never be current again — plus a global
|
|
16
|
+
// size cap enforced by LRU over file mtimes (hits re-touch their file).
|
|
17
|
+
import { mkdirSync, readdirSync, readFileSync, renameSync, rmSync, statSync, utimesSync, writeFileSync, } from "node:fs";
|
|
18
|
+
import path from "node:path";
|
|
19
|
+
import { jsonRequest } from "../compat/http.js";
|
|
20
|
+
import { librariesCacheDir } from "./cache.js";
|
|
21
|
+
import { assertLibraryManifest } from "./manifest.js";
|
|
22
|
+
/** The global size cap over every cached manifest, all libraries together. */
|
|
23
|
+
export const MANIFEST_CACHE_MAX_BYTES = 1024 * 1024 * 1024; // 1 GiB
|
|
24
|
+
export function manifestsCacheDir() {
|
|
25
|
+
return path.join(librariesCacheDir(), "manifests");
|
|
26
|
+
}
|
|
27
|
+
/** One path segment, filesystem-safe on every platform. */
|
|
28
|
+
function fsSegment(s) {
|
|
29
|
+
const safe = s.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
30
|
+
return safe === "" || safe === "." || safe === ".." ? `_${safe}_` : safe;
|
|
31
|
+
}
|
|
32
|
+
/** `host` (plus any path prefix, flattened) — the cache's first level, so
|
|
33
|
+
* the same `acme/props` on two remotes never share an entry. */
|
|
34
|
+
export function remoteCacheKey(remote) {
|
|
35
|
+
try {
|
|
36
|
+
const u = new URL(remote);
|
|
37
|
+
const suffix = u.pathname.replace(/\/+$/, "").replace(/\//g, "_");
|
|
38
|
+
return fsSegment(`${u.host}${suffix}`);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return fsSegment(remote);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export function manifestCacheFile(cacheDir, remote, namespace, name, revision) {
|
|
45
|
+
return path.join(cacheDir, remoteCacheKey(remote), fsSegment(namespace), fsSegment(name), `${revision}.json`);
|
|
46
|
+
}
|
|
47
|
+
/** The cached manifest at `file`, or undefined. Corrupt or schema-invalid
|
|
48
|
+
* content is a MISS — deleted and refetched, never an error. */
|
|
49
|
+
export function readCachedManifest(file) {
|
|
50
|
+
let raw;
|
|
51
|
+
try {
|
|
52
|
+
raw = readFileSync(file, "utf8");
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return undefined; // absent — the common miss
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
return assertLibraryManifest(JSON.parse(raw), "the cached manifest");
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
// Corrupt: clear it so the size accounting stays honest and the next
|
|
62
|
+
// read does not re-parse a file that can never hit.
|
|
63
|
+
rmSync(file, { force: true });
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** Write-through: atomic store, then keep only this revision for this
|
|
68
|
+
* library, then enforce the global cap over the whole cache tree. */
|
|
69
|
+
export function storeCachedManifest(file, body, cacheDir, maxBytes = MANIFEST_CACHE_MAX_BYTES) {
|
|
70
|
+
const dir = path.dirname(file);
|
|
71
|
+
mkdirSync(dir, { recursive: true });
|
|
72
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
73
|
+
writeFileSync(tmp, JSON.stringify(body));
|
|
74
|
+
renameSync(tmp, file);
|
|
75
|
+
// One revision per library: the CAS counter only moves forward, so every
|
|
76
|
+
// sibling (older revisions, stale .tmp files) is dead weight at 60MB each.
|
|
77
|
+
for (const entry of readdirSync(dir)) {
|
|
78
|
+
if (entry !== path.basename(file)) {
|
|
79
|
+
rmSync(path.join(dir, entry), { recursive: true, force: true });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
pruneManifestCache(cacheDir, maxBytes, file);
|
|
83
|
+
}
|
|
84
|
+
/** LRU eviction by mtime until the tree fits `maxBytes`. `keep` (the file
|
|
85
|
+
* just written) is never evicted, even when it alone exceeds the cap. */
|
|
86
|
+
export function pruneManifestCache(cacheDir, maxBytes, keep) {
|
|
87
|
+
const rows = [];
|
|
88
|
+
const walk = (dir) => {
|
|
89
|
+
let entries;
|
|
90
|
+
try {
|
|
91
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
for (const e of entries) {
|
|
97
|
+
const abs = path.join(dir, e.name);
|
|
98
|
+
if (e.isDirectory())
|
|
99
|
+
walk(abs);
|
|
100
|
+
else if (e.isFile()) {
|
|
101
|
+
try {
|
|
102
|
+
const st = statSync(abs);
|
|
103
|
+
rows.push({ file: abs, size: st.size, mtimeMs: st.mtimeMs });
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
/* raced away — fine */
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
walk(cacheDir);
|
|
112
|
+
let total = rows.reduce((s, r) => s + r.size, 0);
|
|
113
|
+
if (total <= maxBytes)
|
|
114
|
+
return;
|
|
115
|
+
rows.sort((a, b) => a.mtimeMs - b.mtimeMs);
|
|
116
|
+
const keepAbs = keep ? path.resolve(keep) : null;
|
|
117
|
+
for (const r of rows) {
|
|
118
|
+
if (total <= maxBytes)
|
|
119
|
+
break;
|
|
120
|
+
if (keepAbs !== null && path.resolve(r.file) === keepAbs)
|
|
121
|
+
continue;
|
|
122
|
+
try {
|
|
123
|
+
rmSync(r.file, { force: true });
|
|
124
|
+
total -= r.size;
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
/* disposable */
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* GET `.../manifest`, through the revision-keyed cache. The caller has just
|
|
133
|
+
* read the catalog row; with its `revision` in hand a cached copy of that
|
|
134
|
+
* exact revision answers with zero network I/O. On a miss the real response
|
|
135
|
+
* is returned verbatim (non-200s included) and a 200 body is stored. Cache
|
|
136
|
+
* failures never fail the command — the worst case is the fetch that would
|
|
137
|
+
* have happened anyway.
|
|
138
|
+
*/
|
|
139
|
+
export async function fetchManifestCached(opts) {
|
|
140
|
+
const cacheDir = opts.cacheDir ?? manifestsCacheDir();
|
|
141
|
+
const file = typeof opts.revision === "number" && Number.isSafeInteger(opts.revision) && opts.revision >= 0
|
|
142
|
+
? manifestCacheFile(cacheDir, opts.remote, opts.namespace, opts.name, opts.revision)
|
|
143
|
+
: null;
|
|
144
|
+
if (file !== null && !opts.bypass) {
|
|
145
|
+
const cached = readCachedManifest(file);
|
|
146
|
+
if (cached !== undefined) {
|
|
147
|
+
try {
|
|
148
|
+
const now = new Date();
|
|
149
|
+
utimesSync(file, now, now); // LRU freshness — hits must not evict first
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
/* the hit stands either way */
|
|
153
|
+
}
|
|
154
|
+
return { res: { status: 200, body: cached }, fromCache: true };
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const url = `${opts.remote}/namespaces/${encodeURIComponent(opts.namespace)}` +
|
|
158
|
+
`/libraries/${encodeURIComponent(opts.name)}/manifest`;
|
|
159
|
+
const res = await jsonRequest("GET", url, opts.token);
|
|
160
|
+
if (file !== null && res.status === 200) {
|
|
161
|
+
try {
|
|
162
|
+
storeCachedManifest(file, res.body, cacheDir, opts.maxBytes ?? MANIFEST_CACHE_MAX_BYTES);
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
/* disposable — a failed store must not fail the read */
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return { res, fromCache: false };
|
|
169
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { type DreamlakeOpts } from "../compat/ctx.js";
|
|
3
|
+
export interface LibraryPullArgs extends DreamlakeOpts {
|
|
4
|
+
/** `<namespace>/<name>`, or a bare `<name>` under the active login. */
|
|
5
|
+
spec: string;
|
|
6
|
+
asset?: string;
|
|
7
|
+
output?: string;
|
|
8
|
+
/** No longer required — pulls are incremental into non-empty directories.
|
|
9
|
+
* Accepted (and ignored) for compatibility with older invocations. */
|
|
10
|
+
force?: boolean;
|
|
11
|
+
/** Include platform-generated artifacts (.dreamlake/**, legacy trio). */
|
|
12
|
+
all?: boolean;
|
|
13
|
+
/** Machine-readable result on stdout; informational lines go to stderr. */
|
|
14
|
+
json?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function parseLibrarySpec(spec: string): {
|
|
17
|
+
namespace: string | null;
|
|
18
|
+
name: string;
|
|
19
|
+
} | {
|
|
20
|
+
error: string;
|
|
21
|
+
};
|
|
22
|
+
/** The default pull's skip rule: platform artifacts, current and legacy. */
|
|
23
|
+
export declare function isGeneratedPath(rel: string): boolean;
|
|
24
|
+
export interface LibraryPullDeps {
|
|
25
|
+
fetchFn?: typeof fetch;
|
|
26
|
+
/** Test override for the hash-cache file (defaults under ~/.dreamlake). */
|
|
27
|
+
hashCacheFile?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function runLibraryPull(args: LibraryPullArgs, deps?: LibraryPullDeps): Promise<number>;
|
|
30
|
+
export declare function registerLibraryPullCommand(library: Command, withConnFlags: (c: Command) => Command): void;
|