@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,239 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { requestJson } from "../client.js";
|
|
4
|
+
import { resolveRemote, resolveToken } from "../config.js";
|
|
5
|
+
import { runRequest } from "../run/index.js";
|
|
6
|
+
import { UDF_WORKER } from "./worker.js";
|
|
7
|
+
const HASH = /^[a-f0-9]{64}$/;
|
|
8
|
+
const ID = /^[a-f0-9]{24}$/;
|
|
9
|
+
const NAME = /^[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*$/;
|
|
10
|
+
const NS = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
|
|
11
|
+
const PREFIX = "DREAMLAKE_UDF_V1 ";
|
|
12
|
+
const TERMINAL = new Set(["succeeded", "failed", "cancelled", "timed_out"]);
|
|
13
|
+
const RUNNER_PATH = "__dreamlake_udf_v1.py";
|
|
14
|
+
export const RUNTIME_ARGV = ["--offline", "--no-project", "--no-python-downloads", "--python", "python3", "python", "-I", "-S", RUNNER_PATH];
|
|
15
|
+
export const sha256 = (value) => createHash("sha256").update(value).digest("hex");
|
|
16
|
+
const seg = encodeURIComponent;
|
|
17
|
+
function object(value) {
|
|
18
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
19
|
+
}
|
|
20
|
+
// Stable payload bytes on retry, including nested JSON inputs. Never persist a token.
|
|
21
|
+
export function canonical(value) {
|
|
22
|
+
if (value === null || typeof value === "boolean" || typeof value === "string")
|
|
23
|
+
return JSON.stringify(value);
|
|
24
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
25
|
+
return JSON.stringify(value);
|
|
26
|
+
if (Array.isArray(value))
|
|
27
|
+
return `[${value.map(canonical).join(",")}]`;
|
|
28
|
+
if (object(value))
|
|
29
|
+
return `{${Object.keys(value).sort().map(k => `${JSON.stringify(k)}:${canonical(value[k])}`).join(",")}}`;
|
|
30
|
+
throw new Error("Expected finite JSON inputs");
|
|
31
|
+
}
|
|
32
|
+
function validateInputs(value) {
|
|
33
|
+
if (!object(value) || Object.keys(value).some(k => !["args", "kwargs"].includes(k)) ||
|
|
34
|
+
!Array.isArray(value.args) || !object(value.kwargs))
|
|
35
|
+
throw new Error('Inputs must be {"args": [...], "kwargs": {...}}');
|
|
36
|
+
if (Buffer.byteLength(canonical(value)) > 16384)
|
|
37
|
+
throw new Error("Inputs exceed 16 KiB");
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
export function pinnedReference(ref) {
|
|
41
|
+
const match = /^udf\/([^/]+)\/([^/@]+)@([a-f0-9]{64})$/.exec(ref);
|
|
42
|
+
if (!match || !NS.test(match[1]) || !NAME.test(match[2]))
|
|
43
|
+
throw new Error("Use udf/NAMESPACE/NAME@FULL_SHA256; latest and prefixes are not execution identities");
|
|
44
|
+
return { namespace: match[1], name: match[2], version: match[3] };
|
|
45
|
+
}
|
|
46
|
+
export function buildRegisteredRun(ref, head, version, repo, options) {
|
|
47
|
+
const pin = pinnedReference(ref);
|
|
48
|
+
if (!head || head.kind !== "udf" || head.name !== pin.name || !ID.test(head.id) || !ID.test(head.namespaceId) ||
|
|
49
|
+
!version || !ID.test(version.id) || version.runnableId !== head.id || version.namespaceId !== head.namespaceId ||
|
|
50
|
+
version.version !== pin.version)
|
|
51
|
+
throw new Error("Registry identity mismatch");
|
|
52
|
+
if (typeof version.source !== "string" || !version.source ||
|
|
53
|
+
Buffer.from(version.source, "utf8").toString("utf8") !== version.source || sha256(version.source) !== pin.version)
|
|
54
|
+
throw new Error("Registered source digest mismatch");
|
|
55
|
+
const meta = version.metadata;
|
|
56
|
+
if (!object(meta) || !ID.test(meta.repo_id) || !object(repo) || repo.id !== meta.repo_id || repo.namespaceId !== head.namespaceId ||
|
|
57
|
+
typeof repo.name !== "string" || typeof repo.remote !== "string")
|
|
58
|
+
throw new Error("Immutable version needs an authorized repository binding");
|
|
59
|
+
// A registry archive pointer is not verified tree delivery. This slice delivers
|
|
60
|
+
// the registered module itself and must not claim to execute a pinned tree.
|
|
61
|
+
if (meta.snapshot_id != null)
|
|
62
|
+
throw new Error("Registry archive snapshot delivery is not supported by this single-module bridge");
|
|
63
|
+
if (typeof meta.entrypoint !== "string" || !/^[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*:[A-Za-z_][A-Za-z0-9_]*$/.test(meta.entrypoint) ||
|
|
64
|
+
typeof meta.source_file !== "string" || meta.source_file !== meta.entrypoint.split(":")[0].replaceAll(".", "/") + ".py" ||
|
|
65
|
+
meta.source_file === RUNNER_PATH)
|
|
66
|
+
throw new Error("Immutable version needs matching source_file and module:function entrypoint");
|
|
67
|
+
if (!new RegExp(`^${pin.namespace}/[A-Za-z0-9][A-Za-z0-9_-]{0,63}/[A-Za-z0-9][A-Za-z0-9_-]{0,63}$`).test(options.target) ||
|
|
68
|
+
!ID.test(options.enrollmentId) || !/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/.test(options.requestId))
|
|
69
|
+
throw new Error("An exact same-namespace target, enrollment ID and stable request ID are required");
|
|
70
|
+
const timeoutSeconds = options.timeoutSeconds ?? 60;
|
|
71
|
+
if (!Number.isInteger(timeoutSeconds) || timeoutSeconds < 1 || timeoutSeconds > 86400)
|
|
72
|
+
throw new Error("Invalid timeout");
|
|
73
|
+
const inputs = canonical(validateInputs(options.inputs));
|
|
74
|
+
const binding = {
|
|
75
|
+
protocol: "dreamlake-registered-udf-v1", ...pin, namespaceId: head.namespaceId,
|
|
76
|
+
runnableId: head.id, versionId: version.id, codeDigest: pin.version,
|
|
77
|
+
repo: { id: repo.id, name: repo.name, remote: repo.remote },
|
|
78
|
+
registrySnapshotId: null, executionSnapshotId: null, sourceFile: meta.source_file, entrypoint: meta.entrypoint,
|
|
79
|
+
delivery: { kind: "tracked-run-inline-source", path: meta.source_file, sha256: pin.version },
|
|
80
|
+
runtime: { kind: "uv-run", argv: RUNTIME_ARGV, runnerDigest: sha256(UDF_WORKER), timeoutSeconds },
|
|
81
|
+
inputsDigest: sha256(inputs),
|
|
82
|
+
};
|
|
83
|
+
const bindingJson = canonical(binding);
|
|
84
|
+
if (Buffer.byteLength(bindingJson) > 8192)
|
|
85
|
+
throw new Error("Registry binding exceeds 8 KiB");
|
|
86
|
+
const files = [[meta.source_file, version.source], [RUNNER_PATH, UDF_WORKER]].map(([path, content]) => ({
|
|
87
|
+
path, contentBase64: Buffer.from(content, "utf8").toString("base64"), sha256: sha256(content), mode: 420,
|
|
88
|
+
}));
|
|
89
|
+
if (Buffer.byteLength(version.source) + Buffer.byteLength(UDF_WORKER) > 1048576)
|
|
90
|
+
throw new Error("Source exceeds tracked-run 1 MiB limit");
|
|
91
|
+
return { binding, payload: { requestId: options.requestId, target: options.target, enrollmentId: options.enrollmentId,
|
|
92
|
+
execution: { kind: "uv-run", argv: [...RUNTIME_ARGV, bindingJson, inputs] }, source: { files }, timeoutSeconds } };
|
|
93
|
+
}
|
|
94
|
+
export async function submitRegisteredRun(ref, options) {
|
|
95
|
+
const pin = pinnedReference(ref);
|
|
96
|
+
const token = resolveToken();
|
|
97
|
+
if (!token)
|
|
98
|
+
throw new Error("Log in to DreamLake first");
|
|
99
|
+
const remote = resolveRemote();
|
|
100
|
+
const base = `/namespaces/${seg(pin.namespace)}`;
|
|
101
|
+
const get = (path) => requestJson(remote, path, { token, redirect: "error" });
|
|
102
|
+
const head = await get(`${base}/runnables/${seg(pin.name)}`);
|
|
103
|
+
const version = await get(`${base}/runnables/${seg(pin.name)}/versions/${pin.version}`);
|
|
104
|
+
if (!object(version?.metadata) || !ID.test(version.metadata.repo_id))
|
|
105
|
+
throw new Error("Version has no immutable repository binding; register source with metadata first");
|
|
106
|
+
const repo = await get(`${base}/repos/${version.metadata.repo_id}`);
|
|
107
|
+
const { payload } = buildRegisteredRun(ref, head, version, repo, options);
|
|
108
|
+
// Existing server authorization, worker readiness and request fingerprinting
|
|
109
|
+
// remain authoritative. Network failure never generates another request ID.
|
|
110
|
+
const result = await runRequest(`${base}/runs`, "POST", payload);
|
|
111
|
+
if (!result?.run || !ID.test(result.run.id) || result.run.requestId !== options.requestId ||
|
|
112
|
+
result.run.target !== options.target || result.run.enrollmentId !== options.enrollmentId ||
|
|
113
|
+
canonical(result.run.execution) !== canonical(payload.execution))
|
|
114
|
+
throw new Error("Unexpected submission receipt; recover with the same request ID and payload");
|
|
115
|
+
return result.run;
|
|
116
|
+
}
|
|
117
|
+
export async function readRegisteredReceipt(ref, request = runRequest) {
|
|
118
|
+
const parts = ref.split("/");
|
|
119
|
+
if (parts.length !== 2 || !NS.test(parts[0]) || !ID.test(parts[1]))
|
|
120
|
+
throw new Error("Expected NAMESPACE/RUN_ID");
|
|
121
|
+
const base = `/namespaces/${seg(parts[0])}/runs/${parts[1]}`;
|
|
122
|
+
const { run } = await request(base);
|
|
123
|
+
const argv = run?.execution?.argv;
|
|
124
|
+
if (run?.id !== parts[1] || run?.execution?.kind !== "uv-run" || !Array.isArray(argv) ||
|
|
125
|
+
argv.length !== RUNTIME_ARGV.length + 2 || canonical(argv.slice(0, -2)) !== canonical(RUNTIME_ARGV))
|
|
126
|
+
throw new Error("Run is not a registered UDF bridge receipt");
|
|
127
|
+
const binding = JSON.parse(argv.at(-2));
|
|
128
|
+
if (binding.protocol !== "dreamlake-registered-udf-v1" || binding.namespace !== parts[0] ||
|
|
129
|
+
!HASH.test(binding.version) || binding.codeDigest !== binding.version ||
|
|
130
|
+
binding.delivery?.sha256 !== binding.codeDigest || binding.inputsDigest !== sha256(argv.at(-1)) ||
|
|
131
|
+
binding.runtime?.runnerDigest !== sha256(UDF_WORKER))
|
|
132
|
+
throw new Error("Invalid retained registry binding");
|
|
133
|
+
let cursor;
|
|
134
|
+
const stdout = [];
|
|
135
|
+
let bytes = 0;
|
|
136
|
+
let done = false;
|
|
137
|
+
for (let pageCount = 0; pageCount < 256; pageCount++) {
|
|
138
|
+
const page = await request(`${base}/logs${cursor === undefined ? "" : `?cursor=${seg(cursor)}`}`);
|
|
139
|
+
if (!Array.isArray(page?.entries) || typeof page.nextCursor !== "string" || typeof page.done !== "boolean")
|
|
140
|
+
throw new Error("Invalid retained logs");
|
|
141
|
+
for (const entry of page.entries) {
|
|
142
|
+
if (!["stdout", "stderr"].includes(entry.stream) || typeof entry.dataBase64 !== "string")
|
|
143
|
+
throw new Error("Invalid retained log entry");
|
|
144
|
+
const data = Buffer.from(entry.dataBase64, "base64");
|
|
145
|
+
if (data.toString("base64") !== entry.dataBase64)
|
|
146
|
+
throw new Error("Invalid log encoding");
|
|
147
|
+
bytes += data.length;
|
|
148
|
+
if (bytes > 4194304)
|
|
149
|
+
throw new Error("Logs exceed tracked-run limit");
|
|
150
|
+
if (entry.stream === "stdout")
|
|
151
|
+
stdout.push(data);
|
|
152
|
+
}
|
|
153
|
+
if (page.done) {
|
|
154
|
+
done = true;
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
if (!page.entries.length)
|
|
158
|
+
break; // Still running; caller can poll the receipt.
|
|
159
|
+
if (page.nextCursor === cursor)
|
|
160
|
+
throw new Error("Log cursor did not advance");
|
|
161
|
+
cursor = page.nextCursor;
|
|
162
|
+
}
|
|
163
|
+
const reports = Buffer.concat(stdout).toString("utf8").split("\n").filter(line => line.startsWith(PREFIX));
|
|
164
|
+
let report = null;
|
|
165
|
+
if (done && reports.length) {
|
|
166
|
+
if (reports.length !== 1)
|
|
167
|
+
throw new Error("Ambiguous UDF result records");
|
|
168
|
+
report = JSON.parse(reports[0].slice(PREFIX.length));
|
|
169
|
+
if (report.protocol !== binding.protocol || report.bindingDigest !== sha256(argv.at(-2)) ||
|
|
170
|
+
(report.status === "succeeded" && report.verifiedCodeDigest !== binding.codeDigest) ||
|
|
171
|
+
!["succeeded", "failed"].includes(report.status) ||
|
|
172
|
+
typeof report.worker?.hostname !== "string" || !Number.isSafeInteger(report.worker?.pid) || report.worker.pid < 1 ||
|
|
173
|
+
["implementation", "pythonVersion", "executable"].some(key => typeof report.runtime?.[key] !== "string" || !report.runtime[key]) ||
|
|
174
|
+
(report.status === "succeeded" ? !Object.hasOwn(report, "result") : !object(report.error)))
|
|
175
|
+
throw new Error("Worker result does not match retained binding");
|
|
176
|
+
}
|
|
177
|
+
if (TERMINAL.has(run.status) && !done)
|
|
178
|
+
throw new Error("Terminal logs incomplete; retry receipt retrieval");
|
|
179
|
+
if (run.status === "succeeded" && (!report || report.status !== "succeeded"))
|
|
180
|
+
throw new Error("Successful execution has no verified UDF result");
|
|
181
|
+
return {
|
|
182
|
+
binding, execution: { kind: "managed-host-run", id: run.id, namespace: parts[0] },
|
|
183
|
+
requestId: run.requestId, target: run.target,
|
|
184
|
+
worker: { hostId: run.hostId, enrollmentId: run.enrollmentId, machineId: run.machineId,
|
|
185
|
+
...(run.workerId ? { workerId: run.workerId } : {}), ...(report?.worker ?? {}) },
|
|
186
|
+
status: run.status, exitCode: run.exitCode, createdAt: run.createdAt, completedAt: run.completedAt,
|
|
187
|
+
resolvedRuntime: report?.runtime ?? null,
|
|
188
|
+
verifiedCodeDigest: report?.verifiedCodeDigest ?? null,
|
|
189
|
+
result: run.status === "succeeded" ? report.result : null,
|
|
190
|
+
error: report?.error ?? run.error ?? (TERMINAL.has(run.status) && run.status !== "succeeded" ? { type: "ExecutionFailed", message: `Inspect retained run logs (${run.status}, exit ${run.exitCode})` } : null),
|
|
191
|
+
receiptRef: ref, logsRef: `${ref}/logs`,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
export function registerRunnableRun(runnable) {
|
|
195
|
+
runnable.command("run <ref>").description("execute one pinned registered Python module on an existing enrolled host")
|
|
196
|
+
.requiredOption("--target <namespace/group/host>", "owned same-namespace host")
|
|
197
|
+
.requiredOption("--enrollment-id <id>", "exact enrollment")
|
|
198
|
+
.requiredOption("--request-id <id>", "stable identity; reuse only for the same uncertain submission")
|
|
199
|
+
.option("--inputs <file>", 'JSON {"args": [], "kwargs": {}}; defaults to no arguments')
|
|
200
|
+
.option("--timeout-seconds <seconds>", "worker timeout", "60")
|
|
201
|
+
.option("--no-wait", "return after durable submission")
|
|
202
|
+
.option("--json", "emit JSON receipt (also the default)")
|
|
203
|
+
.action(async (ref, opts) => {
|
|
204
|
+
try {
|
|
205
|
+
const run = await submitRegisteredRun(ref, { ...opts, timeoutSeconds: Number(opts.timeoutSeconds),
|
|
206
|
+
inputs: opts.inputs ? JSON.parse(readFileSync(opts.inputs, "utf8")) : { args: [], kwargs: {} } });
|
|
207
|
+
const receiptRef = `${pinnedReference(ref).namespace}/${run.id}`;
|
|
208
|
+
// Print the recoverable ID before waiting; disconnect never loses it.
|
|
209
|
+
process.stderr.write(`Receipt: ${receiptRef}\nRequest ID: ${opts.requestId}\n`);
|
|
210
|
+
const deadline = Date.now() + (Number(opts.timeoutSeconds) + 60) * 1000;
|
|
211
|
+
let receipt;
|
|
212
|
+
do {
|
|
213
|
+
receipt = await readRegisteredReceipt(receiptRef);
|
|
214
|
+
if (!opts.wait || TERMINAL.has(receipt.status))
|
|
215
|
+
break;
|
|
216
|
+
if (Date.now() >= deadline)
|
|
217
|
+
throw new Error(`Wait expired; inspect runnable receipt ${receiptRef}. Do not create another request ID`);
|
|
218
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
219
|
+
} while (true);
|
|
220
|
+
process.stdout.write(JSON.stringify(receipt) + "\n");
|
|
221
|
+
if (opts.wait && receipt.status !== "succeeded")
|
|
222
|
+
process.exitCode = 1;
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
process.stderr.write(`${error.message}\nRequest ID: ${opts.requestId}; retain the same inputs and options for recovery\n`);
|
|
226
|
+
process.exitCode = 1;
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
runnable.command("receipt <namespace/run-id>").description("retrieve retained registry binding, execution identity and UDF result")
|
|
230
|
+
.option("--json", "emit JSON (default)").action(async (ref) => {
|
|
231
|
+
try {
|
|
232
|
+
process.stdout.write(JSON.stringify(await readRegisteredReceipt(ref)) + "\n");
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
process.stderr.write(`${error.message}\n`);
|
|
236
|
+
process.exitCode = 1;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
type Definition = {
|
|
3
|
+
name: string;
|
|
4
|
+
source: string;
|
|
5
|
+
entrypoint?: string;
|
|
6
|
+
projects?: string[];
|
|
7
|
+
};
|
|
8
|
+
export type UploadManifest = {
|
|
9
|
+
repo?: {
|
|
10
|
+
name: string;
|
|
11
|
+
remote: string;
|
|
12
|
+
snapshot?: {
|
|
13
|
+
commit: string;
|
|
14
|
+
backend: "s3" | "github";
|
|
15
|
+
archive_key: string;
|
|
16
|
+
storage_name?: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
udfs?: Definition[];
|
|
20
|
+
agents?: Definition[];
|
|
21
|
+
};
|
|
22
|
+
type UploadOptions = {
|
|
23
|
+
namespace?: string;
|
|
24
|
+
dryRun?: boolean;
|
|
25
|
+
json?: boolean;
|
|
26
|
+
name?: string;
|
|
27
|
+
source?: string;
|
|
28
|
+
entrypoint?: string;
|
|
29
|
+
kind?: string;
|
|
30
|
+
};
|
|
31
|
+
export declare function readUploadManifest(file: string, explicit?: UploadOptions): {
|
|
32
|
+
manifest: UploadManifest;
|
|
33
|
+
entries: {
|
|
34
|
+
kind: "udf" | "agent";
|
|
35
|
+
definition: Definition;
|
|
36
|
+
source: string;
|
|
37
|
+
prompt?: string;
|
|
38
|
+
parameters?: Record<string, any>;
|
|
39
|
+
}[];
|
|
40
|
+
};
|
|
41
|
+
export declare function runRunnableUpload(file: string, opts: UploadOptions): Promise<number>;
|
|
42
|
+
export declare function registerRunnableUpload(runnable: Command): void;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { readFileSync, realpathSync } from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import YAML from "yaml";
|
|
6
|
+
import { requestJson, HttpError } from "../client.js";
|
|
7
|
+
import { emitJson, fail } from "../helpers.js";
|
|
8
|
+
import { agentContext, validateDraft, validateProjects, projectSlugs, } from "../agents/manage.js";
|
|
9
|
+
import { parseAgentFile, scanForCredentials } from "../agents/spec.js";
|
|
10
|
+
const sameJson = (a, b) => {
|
|
11
|
+
const canonical = (v) => Array.isArray(v)
|
|
12
|
+
? v.map(canonical)
|
|
13
|
+
: v && typeof v === "object"
|
|
14
|
+
? Object.fromEntries(Object.keys(v)
|
|
15
|
+
.sort()
|
|
16
|
+
.map((k) => [k, canonical(v[k])]))
|
|
17
|
+
: v;
|
|
18
|
+
return JSON.stringify(canonical(a)) === JSON.stringify(canonical(b));
|
|
19
|
+
};
|
|
20
|
+
const hash = (text) => createHash("sha256").update(text, "utf8").digest("hex");
|
|
21
|
+
function parseManifestYaml(file) {
|
|
22
|
+
const doc = YAML.parseDocument(readFileSync(file, "utf8"), {
|
|
23
|
+
logLevel: "silent",
|
|
24
|
+
customTags: ["SSH", "EC2", "GCE", "SLURM", "Kube"].map((name) => ({
|
|
25
|
+
tag: `!providers.${name}`,
|
|
26
|
+
collection: "map",
|
|
27
|
+
resolve: (value) => value,
|
|
28
|
+
})),
|
|
29
|
+
});
|
|
30
|
+
if (doc.errors.length || doc.warnings.length)
|
|
31
|
+
throw new Error(".dreamrc contains invalid YAML or unsupported tags; config includes are not resolved by registration");
|
|
32
|
+
return doc.toJS();
|
|
33
|
+
}
|
|
34
|
+
export function readUploadManifest(file, explicit) {
|
|
35
|
+
const direct = explicit?.name !== undefined ||
|
|
36
|
+
explicit?.source !== undefined ||
|
|
37
|
+
explicit?.entrypoint !== undefined ||
|
|
38
|
+
explicit?.kind !== undefined;
|
|
39
|
+
if (direct &&
|
|
40
|
+
(!explicit?.name ||
|
|
41
|
+
!explicit.source ||
|
|
42
|
+
(explicit.kind !== undefined &&
|
|
43
|
+
!["udf", "agent"].includes(explicit.kind))))
|
|
44
|
+
throw new Error("direct registration needs --name, --source, and kind udf/agent");
|
|
45
|
+
const root = direct
|
|
46
|
+
? realpathSync(process.cwd())
|
|
47
|
+
: path.dirname(realpathSync(file));
|
|
48
|
+
const manifest = direct
|
|
49
|
+
? {
|
|
50
|
+
[explicit.kind === "agent" ? "agents" : "udfs"]: [
|
|
51
|
+
{
|
|
52
|
+
name: explicit.name,
|
|
53
|
+
source: explicit.source,
|
|
54
|
+
entrypoint: explicit.entrypoint,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
}
|
|
58
|
+
: parseManifestYaml(file);
|
|
59
|
+
if (!manifest || typeof manifest !== "object" || Array.isArray(manifest))
|
|
60
|
+
throw new Error(".dreamrc must be a YAML mapping");
|
|
61
|
+
for (const key of ["imports", "includes", "extends", "layers"])
|
|
62
|
+
if (key in manifest)
|
|
63
|
+
throw new Error(`${key} is not supported by the registration loader; resolve configuration explicitly first`);
|
|
64
|
+
if (manifest.repo &&
|
|
65
|
+
(typeof manifest.repo.name !== "string" ||
|
|
66
|
+
!manifest.repo.name.trim() ||
|
|
67
|
+
typeof manifest.repo.remote !== "string" ||
|
|
68
|
+
!manifest.repo.remote.trim()))
|
|
69
|
+
throw new Error("repo requires name and remote");
|
|
70
|
+
if (manifest.repo) {
|
|
71
|
+
const remote = manifest.repo.remote;
|
|
72
|
+
if (!/^https:\/\/[^/@\s]+\/[^\s?#]+$/.test(remote) &&
|
|
73
|
+
!/^git@[^:\s]+:[^\s?#]+$/.test(remote))
|
|
74
|
+
throw new Error("repo.remote must be a credential-free HTTPS or SSH Git URL");
|
|
75
|
+
}
|
|
76
|
+
if (manifest.repo?.snapshot) {
|
|
77
|
+
const snapshot = manifest.repo.snapshot;
|
|
78
|
+
if (!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(snapshot.commit) ||
|
|
79
|
+
!["s3", "github"].includes(snapshot.backend) ||
|
|
80
|
+
!snapshot.archive_key?.trim())
|
|
81
|
+
throw new Error("snapshot requires a full commit/digest, backend s3/github, and archive_key");
|
|
82
|
+
if (snapshot.backend === "s3" && !snapshot.storage_name?.trim())
|
|
83
|
+
throw new Error("S3 archive pointer requires storage_name");
|
|
84
|
+
}
|
|
85
|
+
const entries = [];
|
|
86
|
+
const names = new Set();
|
|
87
|
+
for (const [field, kind] of [
|
|
88
|
+
["udfs", "udf"],
|
|
89
|
+
["agents", "agent"],
|
|
90
|
+
]) {
|
|
91
|
+
const defs = manifest[field] ?? [];
|
|
92
|
+
if (!Array.isArray(defs))
|
|
93
|
+
throw new Error(`${field} must be a list`);
|
|
94
|
+
for (const definition of defs) {
|
|
95
|
+
if (!definition ||
|
|
96
|
+
typeof definition.name !== "string" ||
|
|
97
|
+
!/^[A-Za-z_][\w.]*\.[A-Za-z_]\w*$/.test(definition.name) ||
|
|
98
|
+
names.has(definition.name))
|
|
99
|
+
throw new Error("each runnable needs a unique dotted name");
|
|
100
|
+
names.add(definition.name);
|
|
101
|
+
if (typeof definition.source !== "string" ||
|
|
102
|
+
path.isAbsolute(definition.source))
|
|
103
|
+
throw new Error("source must be relative to .dreamrc");
|
|
104
|
+
const resolved = realpathSync(path.resolve(root, definition.source));
|
|
105
|
+
const relative = path.relative(root, resolved);
|
|
106
|
+
if (relative.startsWith(".." + path.sep) ||
|
|
107
|
+
relative === ".." ||
|
|
108
|
+
path.isAbsolute(relative))
|
|
109
|
+
throw new Error("source must stay inside the manifest directory");
|
|
110
|
+
const bytes = readFileSync(resolved);
|
|
111
|
+
if (bytes.length > 512 * 1024)
|
|
112
|
+
throw new Error("definition source exceeds 512 KiB");
|
|
113
|
+
new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
114
|
+
const source = bytes.toString("utf8");
|
|
115
|
+
projectSlugs(definition.projects);
|
|
116
|
+
if (kind === "udf") {
|
|
117
|
+
if (typeof definition.entrypoint !== "string" ||
|
|
118
|
+
!/^[A-Za-z_][\w.]*:[A-Za-z_]\w*$/.test(definition.entrypoint))
|
|
119
|
+
throw new Error("UDF requires a module:function entrypoint");
|
|
120
|
+
entries.push({ kind, definition, source });
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
const parsed = parseAgentFile(source);
|
|
124
|
+
const parameters = {
|
|
125
|
+
...parsed.frontmatter,
|
|
126
|
+
...(definition.projects ? { projects: definition.projects } : {}),
|
|
127
|
+
};
|
|
128
|
+
validateDraft({ prompt: parsed.body, parameters });
|
|
129
|
+
entries.push({
|
|
130
|
+
kind,
|
|
131
|
+
definition,
|
|
132
|
+
source,
|
|
133
|
+
prompt: parsed.body,
|
|
134
|
+
parameters,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (!entries.length)
|
|
140
|
+
throw new Error(".dreamrc has no udfs or agents to upload");
|
|
141
|
+
return { manifest, entries };
|
|
142
|
+
}
|
|
143
|
+
export async function runRunnableUpload(file, opts) {
|
|
144
|
+
try {
|
|
145
|
+
const { manifest, entries } = readUploadManifest(file, opts);
|
|
146
|
+
const plan = entries.map((e) => ({
|
|
147
|
+
name: e.definition.name,
|
|
148
|
+
kind: e.kind,
|
|
149
|
+
source: e.definition.source,
|
|
150
|
+
version: hash(e.source),
|
|
151
|
+
}));
|
|
152
|
+
let capturedFiles;
|
|
153
|
+
if (manifest.repo?.snapshot?.backend === "github") {
|
|
154
|
+
const commit = manifest.repo.snapshot.commit;
|
|
155
|
+
if (!/^[a-f0-9]{40}$/.test(commit) ||
|
|
156
|
+
manifest.repo.snapshot.archive_key !== commit)
|
|
157
|
+
throw new Error("GitHub snapshots require the same full commit in commit and archive_key");
|
|
158
|
+
const cwd = path.dirname(realpathSync(file));
|
|
159
|
+
const root = execFileSync("git", ["rev-parse", "--show-toplevel"], {
|
|
160
|
+
cwd,
|
|
161
|
+
encoding: "utf8",
|
|
162
|
+
}).trim();
|
|
163
|
+
if (realpathSync(root) !== cwd)
|
|
164
|
+
throw new Error("Pinned GitHub upload requires .dreamrc at the Git repository root");
|
|
165
|
+
const names = execFileSync("git", ["ls-tree", "-rz", "--name-only", commit], { cwd, encoding: "utf8", maxBuffer: 4 * 1024 * 1024 })
|
|
166
|
+
.split("\0")
|
|
167
|
+
.filter(Boolean);
|
|
168
|
+
if (names.length > 10000)
|
|
169
|
+
throw new Error("Snapshot display manifest exceeds 10,000 paths");
|
|
170
|
+
const sources = new Map();
|
|
171
|
+
for (const entry of entries) {
|
|
172
|
+
const pinned = execFileSync("git", ["show", `${commit}:${entry.definition.source}`], { cwd, encoding: "utf8", maxBuffer: 1024 * 1024 });
|
|
173
|
+
if (pinned !== entry.source)
|
|
174
|
+
throw new Error(`'${entry.definition.source}' differs from the pinned Git snapshot; capture new code first`);
|
|
175
|
+
sources.set(entry.definition.source, entry.source);
|
|
176
|
+
}
|
|
177
|
+
capturedFiles = names.map((path) => ({
|
|
178
|
+
path,
|
|
179
|
+
...(sources.has(path) ? { source: sources.get(path) } : {}),
|
|
180
|
+
}));
|
|
181
|
+
if (Buffer.byteLength(JSON.stringify(capturedFiles), "utf8") > 768 * 1024)
|
|
182
|
+
throw new Error("Snapshot display manifest exceeds 768 KiB");
|
|
183
|
+
}
|
|
184
|
+
if (opts.dryRun) {
|
|
185
|
+
emitJson({ status: "dry-run", repo: manifest.repo, entries: plan });
|
|
186
|
+
return 0;
|
|
187
|
+
}
|
|
188
|
+
const c = await agentContext(opts.namespace);
|
|
189
|
+
const base = `/namespaces/${encodeURIComponent(c.ns)}`;
|
|
190
|
+
// Validate every project before creating any registry records.
|
|
191
|
+
for (const e of entries)
|
|
192
|
+
await validateProjects(c, projectSlugs(e.parameters?.projects ?? e.definition.projects));
|
|
193
|
+
let repoId;
|
|
194
|
+
let snapshotId;
|
|
195
|
+
if (manifest.repo) {
|
|
196
|
+
const repoBase = `${base}/repos`;
|
|
197
|
+
let repo;
|
|
198
|
+
try {
|
|
199
|
+
repo = await requestJson(c.remote, `${repoBase}/${encodeURIComponent(manifest.repo.name)}`, { token: c.token });
|
|
200
|
+
}
|
|
201
|
+
catch (e) {
|
|
202
|
+
if (!(e instanceof HttpError) || e.status !== 404)
|
|
203
|
+
throw e;
|
|
204
|
+
repo = await requestJson(c.remote, repoBase, {
|
|
205
|
+
method: "POST",
|
|
206
|
+
token: c.token,
|
|
207
|
+
json: manifest.repo,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
if (repo.remote
|
|
211
|
+
.toLowerCase()
|
|
212
|
+
.replace(/\.git$/, "")
|
|
213
|
+
.replace(/\/$/, "") !==
|
|
214
|
+
manifest.repo.remote
|
|
215
|
+
.toLowerCase()
|
|
216
|
+
.replace(/\.git$/, "")
|
|
217
|
+
.replace(/\/$/, ""))
|
|
218
|
+
throw new Error("existing repo has a different remote");
|
|
219
|
+
repoId = repo.id;
|
|
220
|
+
if (manifest.repo.snapshot) {
|
|
221
|
+
const snapshot = manifest.repo.snapshot;
|
|
222
|
+
const record = await requestJson(c.remote, `${repoBase}/${encodeURIComponent(repo.id)}/snapshots`, {
|
|
223
|
+
method: "POST",
|
|
224
|
+
token: c.token,
|
|
225
|
+
json: {
|
|
226
|
+
commit: snapshot.commit,
|
|
227
|
+
backend: snapshot.backend,
|
|
228
|
+
archiveKey: snapshot.archive_key,
|
|
229
|
+
storageName: snapshot.storage_name,
|
|
230
|
+
...(capturedFiles
|
|
231
|
+
? {
|
|
232
|
+
metadata: {
|
|
233
|
+
files: capturedFiles,
|
|
234
|
+
manifest_scope: "paths-with-registered-definition-contents",
|
|
235
|
+
},
|
|
236
|
+
}
|
|
237
|
+
: {}),
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
if ((capturedFiles && !sameJson(record.metadata?.files, capturedFiles)) ||
|
|
241
|
+
record.commit !== snapshot.commit ||
|
|
242
|
+
record.archiveKey !== snapshot.archive_key ||
|
|
243
|
+
record.backend !== snapshot.backend ||
|
|
244
|
+
(snapshot.backend === "s3" &&
|
|
245
|
+
record.storageName !== snapshot.storage_name))
|
|
246
|
+
throw new Error("existing snapshot differs from requested archive pointer; inspect before proceeding");
|
|
247
|
+
snapshotId = record.id;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
const receipts = [];
|
|
251
|
+
for (const e of entries) {
|
|
252
|
+
const name = e.definition.name;
|
|
253
|
+
const cut = name.lastIndexOf(".");
|
|
254
|
+
const agentParameters = e.parameters
|
|
255
|
+
? Object.fromEntries(Object.entries(e.parameters).filter(([key]) => !["description", "channel"].includes(key)))
|
|
256
|
+
: undefined;
|
|
257
|
+
const metadata = {
|
|
258
|
+
...(repoId ? { repo_id: repoId } : {}),
|
|
259
|
+
source_file: e.definition.source,
|
|
260
|
+
...(snapshotId ? { snapshot_id: snapshotId } : {}),
|
|
261
|
+
...(e.definition.entrypoint
|
|
262
|
+
? { entrypoint: e.definition.entrypoint }
|
|
263
|
+
: {}),
|
|
264
|
+
...(agentParameters ? { agent: agentParameters } : {}),
|
|
265
|
+
...(e.definition.projects && !e.parameters
|
|
266
|
+
? { projects: e.definition.projects }
|
|
267
|
+
: {}),
|
|
268
|
+
};
|
|
269
|
+
scanForCredentials("metadata", metadata);
|
|
270
|
+
const payload = {
|
|
271
|
+
module: name.slice(0, cut),
|
|
272
|
+
qualname: name.slice(cut + 1),
|
|
273
|
+
kind: e.kind,
|
|
274
|
+
metadata,
|
|
275
|
+
...(e.kind === "agent"
|
|
276
|
+
? {
|
|
277
|
+
markdown: e.prompt,
|
|
278
|
+
description: e.parameters?.description,
|
|
279
|
+
channel: e.parameters?.channel,
|
|
280
|
+
}
|
|
281
|
+
: {}),
|
|
282
|
+
};
|
|
283
|
+
let registered;
|
|
284
|
+
const endpoint = `${base}/runnables/${encodeURIComponent(name)}`;
|
|
285
|
+
try {
|
|
286
|
+
registered = await requestJson(c.remote, endpoint, { token: c.token });
|
|
287
|
+
// Never overwrite an existing mutable head during bulk upload.
|
|
288
|
+
if (registered.kind !== e.kind ||
|
|
289
|
+
!sameJson(registered.metadata ?? {}, metadata) ||
|
|
290
|
+
(e.kind === "agent" && registered.markdown !== e.prompt))
|
|
291
|
+
throw new Error(`'${name}' already exists with different declaration fields; edit it explicitly before uploading`);
|
|
292
|
+
}
|
|
293
|
+
catch (e2) {
|
|
294
|
+
if (!(e2 instanceof HttpError) || e2.status !== 404)
|
|
295
|
+
throw e2;
|
|
296
|
+
registered = await requestJson(c.remote, `${base}/runnables`, {
|
|
297
|
+
method: "POST",
|
|
298
|
+
token: c.token,
|
|
299
|
+
json: payload,
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
const version = hash(e.source);
|
|
303
|
+
const receipt = await requestJson(c.remote, `${base}/runnables/${encodeURIComponent(registered.id)}/versions`, {
|
|
304
|
+
method: "POST",
|
|
305
|
+
token: c.token,
|
|
306
|
+
json: { version, source: e.source, metadata },
|
|
307
|
+
});
|
|
308
|
+
if (receipt.version !== version ||
|
|
309
|
+
receipt.source !== e.source ||
|
|
310
|
+
!sameJson(receipt.metadata, metadata))
|
|
311
|
+
throw new Error(`unexpected version receipt for '${name}'; inspect before retrying`);
|
|
312
|
+
receipts.push({ name, id: registered.id, version });
|
|
313
|
+
}
|
|
314
|
+
if (opts.json)
|
|
315
|
+
emitJson({ repoId, runnables: receipts });
|
|
316
|
+
else
|
|
317
|
+
for (const r of receipts)
|
|
318
|
+
process.stdout.write(`${r.name} ${r.version}\n`);
|
|
319
|
+
return 0;
|
|
320
|
+
}
|
|
321
|
+
catch (e) {
|
|
322
|
+
fail(`${e.message}\nUpload may have registered earlier entries; inspect receipts before retrying.`);
|
|
323
|
+
return 1;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
export function registerRunnableUpload(runnable) {
|
|
327
|
+
runnable
|
|
328
|
+
.command("register")
|
|
329
|
+
.alias("upload")
|
|
330
|
+
.description("register repo, UDFs and agents from .dreamrc; upload exact definition source")
|
|
331
|
+
.argument("[manifest]", "YAML manifest path", ".dreamrc")
|
|
332
|
+
.option("--name <name>", "register one definition without a manifest")
|
|
333
|
+
.option("--source <path>", "source file for direct registration")
|
|
334
|
+
.option("--entrypoint <module:function>", "UDF entrypoint for direct registration")
|
|
335
|
+
.option("--kind <kind>", "udf or agent for direct registration (default udf)")
|
|
336
|
+
.option("--namespace <slug>", "registry namespace")
|
|
337
|
+
.option("--dry-run", "validate local files and print plan without network calls")
|
|
338
|
+
.option("--json", "print registration receipts as JSON")
|
|
339
|
+
.action(async (manifest, opts) => {
|
|
340
|
+
process.exitCode = await runRunnableUpload(manifest, opts);
|
|
341
|
+
});
|
|
342
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const UDF_WORKER: string;
|