@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,173 @@
|
|
|
1
|
+
import { bindHostCredential } from '../vault/hostCredentials.js';
|
|
2
|
+
import { confirm, input, password, select } from '@inquirer/prompts';
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
import { readSync, fstatSync } from 'node:fs';
|
|
5
|
+
import { resolve } from 'node:path';
|
|
6
|
+
import { resolveRemote, resolveToken } from '../config.js';
|
|
7
|
+
import { request } from '../vault/index.js';
|
|
8
|
+
import { entryName, secretValue, writeReceipt } from '../vault/mutations.js';
|
|
9
|
+
import { readSshFile } from '../vault/sshSource.js';
|
|
10
|
+
import { validateKey } from '../vault/sshTransfer.js';
|
|
11
|
+
const promptContext = { output: process.stderr };
|
|
12
|
+
function descriptor(fd) {
|
|
13
|
+
if (!Number.isInteger(fd) || fd < 0)
|
|
14
|
+
throw new Error('Invalid password descriptor');
|
|
15
|
+
const info = fstatSync(fd);
|
|
16
|
+
if (info.isFile() && (info.mode & 0o077 || info.uid !== process.getuid?.()))
|
|
17
|
+
throw new Error('Password file must be private');
|
|
18
|
+
if (!info.isFile() && !info.isFIFO())
|
|
19
|
+
throw new Error('Password descriptor must be a pipe or private file');
|
|
20
|
+
const chunks = [];
|
|
21
|
+
let size = 0;
|
|
22
|
+
try {
|
|
23
|
+
while (size <= 65536) {
|
|
24
|
+
const b = Buffer.alloc(4096);
|
|
25
|
+
const n = readSync(fd, b, 0, b.length, null);
|
|
26
|
+
if (!n)
|
|
27
|
+
break;
|
|
28
|
+
chunks.push(b.subarray(0, n));
|
|
29
|
+
size += n;
|
|
30
|
+
}
|
|
31
|
+
if (size > 65536)
|
|
32
|
+
throw new Error('Password too large');
|
|
33
|
+
const all = Buffer.concat(chunks);
|
|
34
|
+
try {
|
|
35
|
+
return new TextDecoder('utf-8', { fatal: true }).decode(all);
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
all.fill(0);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
for (const chunk of chunks)
|
|
43
|
+
chunk.fill(0);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export function selectedSources(opts, target) {
|
|
47
|
+
const sources = [];
|
|
48
|
+
const split = (value) => { const at = value.indexOf('='); if (at < 1 || at === value.length - 1)
|
|
49
|
+
throw new Error('Invalid credential selection'); return [value.slice(0, at), value.slice(at + 1)]; };
|
|
50
|
+
for (const name of opts.targetPassword ?? [])
|
|
51
|
+
sources.push({ role: 'target', endpoint: target, kind: 'password', name });
|
|
52
|
+
for (const v of opts.targetKey ?? []) {
|
|
53
|
+
const [name, keyFile] = split(v);
|
|
54
|
+
sources.push({ role: 'target', endpoint: target, kind: 'private_key', name, keyFile });
|
|
55
|
+
}
|
|
56
|
+
for (const v of opts.jumpPassword ?? []) {
|
|
57
|
+
const [endpoint, name] = split(v);
|
|
58
|
+
sources.push({ role: 'jump', endpoint, kind: 'password', name });
|
|
59
|
+
}
|
|
60
|
+
for (const v of opts.jumpKey ?? []) {
|
|
61
|
+
const [endpoint, rest] = split(v);
|
|
62
|
+
const [name, keyFile] = split(rest);
|
|
63
|
+
sources.push({ role: 'jump', endpoint, kind: 'private_key', name, keyFile });
|
|
64
|
+
}
|
|
65
|
+
const fds = new Map();
|
|
66
|
+
for (const v of opts.passwordFd ?? []) {
|
|
67
|
+
const [name, value] = split(v);
|
|
68
|
+
if (!/^\d+$/.test(value) || fds.has(name))
|
|
69
|
+
throw new Error('Invalid password descriptor');
|
|
70
|
+
fds.set(name, Number(value));
|
|
71
|
+
}
|
|
72
|
+
const slots = new Set(), names = new Set();
|
|
73
|
+
for (const source of sources) {
|
|
74
|
+
entryName(source.name);
|
|
75
|
+
if (!/^[A-Za-z0-9_.@:\[\]-]{1,255}$/.test(source.endpoint))
|
|
76
|
+
throw new Error('Invalid endpoint');
|
|
77
|
+
const slot = `${source.role}/${source.endpoint}/${source.kind}`;
|
|
78
|
+
if (slots.has(slot) || names.has(source.name))
|
|
79
|
+
throw new Error('Duplicate credential selection');
|
|
80
|
+
slots.add(slot);
|
|
81
|
+
names.add(source.name);
|
|
82
|
+
if (source.kind === 'password' && fds.has(source.name)) {
|
|
83
|
+
source.fd = fds.get(source.name);
|
|
84
|
+
fds.delete(source.name);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (fds.size || sources.length > 32)
|
|
88
|
+
throw new Error('Invalid credential selection');
|
|
89
|
+
return sources;
|
|
90
|
+
}
|
|
91
|
+
async function interactiveSources(target) {
|
|
92
|
+
const result = [];
|
|
93
|
+
do {
|
|
94
|
+
const role = await select({ message: 'Save a credential for', choices: [{ name: 'Target host', value: 'target' }, { name: 'Jump host (select separately)', value: 'jump' }] }, promptContext);
|
|
95
|
+
const endpoint = role === 'target' ? target : await input({ message: 'Jump host alias or user@host' }, promptContext);
|
|
96
|
+
const kind = await select({ message: 'Credential source', choices: [{ name: 'Password (re-enter securely)', value: 'password' }, { name: 'Selected private-key file', value: 'private_key' }] }, promptContext);
|
|
97
|
+
const name = await input({ message: 'Personal vault entry path (owner/prefix/name)' }, promptContext);
|
|
98
|
+
const keyFile = kind === 'private_key' ? await input({ message: 'Private-key file to export' }, promptContext) : undefined;
|
|
99
|
+
result.push({ role, endpoint, kind, name, keyFile });
|
|
100
|
+
} while (result.length < 32 && await confirm({ message: 'Select another target/jump credential?', default: false }, promptContext));
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
export async function saveCredentials(result, plan, opts, pinned) {
|
|
104
|
+
const entries = [];
|
|
105
|
+
if (plan.local)
|
|
106
|
+
return { status: 'not_requested', entries };
|
|
107
|
+
const interactive = !!process.stdin.isTTY && !!process.stderr.isTTY && !opts.json;
|
|
108
|
+
if (opts.saveCredentials === false)
|
|
109
|
+
return { status: 'declined', entries };
|
|
110
|
+
if (!result.enrolled)
|
|
111
|
+
return { status: opts.saveCredentials ? 'enrollment_pending' : 'not_requested', entries };
|
|
112
|
+
try {
|
|
113
|
+
let consent = opts.saveCredentials;
|
|
114
|
+
if (consent === undefined && interactive)
|
|
115
|
+
consent = await confirm({ message: 'DreamLake does not have your SSH credentials. Save selected credentials for access from your other devices? This does not authorize backend SSH.', default: false }, promptContext);
|
|
116
|
+
if (!consent)
|
|
117
|
+
return { status: consent === false ? 'declined' : 'not_requested', entries };
|
|
118
|
+
const remote = pinned?.remote ?? resolveRemote(), token = pinned ? pinned.token : resolveToken();
|
|
119
|
+
const url = new URL(remote);
|
|
120
|
+
if (!token || url.username || url.password || url.search || url.hash || !['https:', 'http:'].includes(url.protocol) || url.protocol === 'http:' && !['localhost', '127.0.0.1', '[::1]'].includes(url.hostname))
|
|
121
|
+
throw new Error('Vault unavailable');
|
|
122
|
+
if (!opts.requestId || !/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/.test(opts.requestId))
|
|
123
|
+
throw new Error('Enrollment request ID required');
|
|
124
|
+
const connection = { remote, token };
|
|
125
|
+
let sources = selectedSources(opts, plan.ssh.args.at(-1));
|
|
126
|
+
if (!sources.length && interactive) {
|
|
127
|
+
sources = await interactiveSources(plan.ssh.args.at(-1));
|
|
128
|
+
// Apply the same validation to interactively collected metadata.
|
|
129
|
+
sources = selectedSources({ targetPassword: sources.filter(s => s.role === 'target' && s.kind === 'password').map(s => s.name), targetKey: sources.filter(s => s.role === 'target' && s.kind === 'private_key').map(s => `${s.name}=${s.keyFile}`), jumpPassword: sources.filter(s => s.role === 'jump' && s.kind === 'password').map(s => `${s.endpoint}=${s.name}`), jumpKey: sources.filter(s => s.role === 'jump' && s.kind === 'private_key').map(s => `${s.endpoint}=${s.name}=${s.keyFile}`) }, plan.ssh.args.at(-1));
|
|
130
|
+
}
|
|
131
|
+
if (!sources.length || sources.some(s => s.kind === 'password' && s.fd === undefined && !interactive))
|
|
132
|
+
return { status: 'needs_input', entries };
|
|
133
|
+
for (const source of sources) {
|
|
134
|
+
const requestId = 'host_' + createHash('sha256').update([opts.requestId, source.role, source.endpoint, source.kind, source.name].join('\0')).digest('hex');
|
|
135
|
+
const item = { role: source.role, endpoint: source.endpoint, kind: source.kind, name: source.name, requestId, status: 'failed' };
|
|
136
|
+
entries.push(item);
|
|
137
|
+
let writing = false;
|
|
138
|
+
try {
|
|
139
|
+
let value = source.kind === 'private_key' ? await readSshFile(resolve(source.keyFile), true) : source.fd !== undefined ? descriptor(source.fd) : await password({ message: `${source.role} ${source.endpoint} password (OpenSSH input is not recoverable)`, mask: '*' }, promptContext);
|
|
140
|
+
if (!value)
|
|
141
|
+
throw new Error('Empty credential');
|
|
142
|
+
if (source.kind === 'private_key')
|
|
143
|
+
validateKey(value);
|
|
144
|
+
secretValue(value);
|
|
145
|
+
writing = true;
|
|
146
|
+
const receipt = writeReceipt(await request('/v1/vault/entry', { name: source.name, type: 'string', value }, 'PUT', undefined, { 'Idempotency-Key': requestId }, connection), requestId);
|
|
147
|
+
value = '';
|
|
148
|
+
const entry = receipt.entry;
|
|
149
|
+
if (entry.name !== source.name || typeof entry.id !== 'string')
|
|
150
|
+
throw new Error('Invalid entry receipt');
|
|
151
|
+
item.status = 'saved_unbound';
|
|
152
|
+
item.entryId = entry.id;
|
|
153
|
+
item.revision = entry.revision;
|
|
154
|
+
writing = false;
|
|
155
|
+
const data = { hostId: result.host.id, enrollmentId: result.enrollment.id, role: source.role, endpoint: source.endpoint, kind: source.kind, entryId: entry.id, entryRevision: entry.revision };
|
|
156
|
+
item.binding = data; // exact safe recovery arguments, no source reread
|
|
157
|
+
const binding = await bindHostCredential(data, connection);
|
|
158
|
+
item.status = 'saved';
|
|
159
|
+
item.bindingId = binding.id;
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
if (writing)
|
|
163
|
+
item.status = 'unknown';
|
|
164
|
+
if (error instanceof Error && ['ExitPromptError', 'AbortPromptError'].includes(error.name))
|
|
165
|
+
return { status: 'cancelled', entries };
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return { status: entries.every(e => e.status === 'saved') ? 'saved' : entries.some(e => ['saved', 'saved_unbound'].includes(e.status)) ? 'partial' : entries.some(e => e.status === 'unknown') ? 'unknown' : 'failed', entries };
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
return { status: error instanceof Error && ['ExitPromptError', 'AbortPromptError'].includes(error.name) ? 'cancelled' : 'failed', entries };
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { hostRequest } from "./api.js";
|
|
2
|
+
import { localBootstrap, remoteBootstrap } from "./remote.js";
|
|
3
|
+
import type { EnrollmentPlan, EnrollOptions } from "./config.js";
|
|
4
|
+
export interface EnrollmentDeps {
|
|
5
|
+
request?: typeof hostRequest;
|
|
6
|
+
remote?: typeof remoteBootstrap;
|
|
7
|
+
local?: typeof localBootstrap;
|
|
8
|
+
sleep?: (ms: number) => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare function enrollHost(plan: EnrollmentPlan, opts: EnrollOptions, deps?: EnrollmentDeps): Promise<Record<string, unknown>>;
|
|
11
|
+
export declare function hostStatus(selector: string, opts?: {
|
|
12
|
+
namespace?: string;
|
|
13
|
+
page?: string | number;
|
|
14
|
+
pageSize?: string | number;
|
|
15
|
+
}, request?: typeof hostRequest): Promise<any>;
|
|
16
|
+
/** Uses the owner's login only on the client; never passes it to Nymph. */
|
|
17
|
+
export declare function waitForWebTerminal(namespace: string, hostId: string, enrollmentId: string, deadline: number, request?: typeof hostRequest, sleep?: (ms: number) => Promise<void>): Promise<Record<string, unknown>>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { hostApiPath, hostRequest, HostApiError } from "./api.js";
|
|
3
|
+
import { localBootstrap, remoteBootstrap } from "./remote.js";
|
|
4
|
+
import { resolveHostNamespace } from "./inventory.js";
|
|
5
|
+
export async function enrollHost(plan, opts, deps = {}) {
|
|
6
|
+
const timeoutSeconds = Number(opts.waitSeconds ?? 60);
|
|
7
|
+
if (!Number.isFinite(timeoutSeconds) || timeoutSeconds < 0 || timeoutSeconds > 600)
|
|
8
|
+
throw new Error("--wait-seconds must be between 0 and 600");
|
|
9
|
+
const requestId = opts.requestId ?? randomUUID();
|
|
10
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/.test(requestId))
|
|
11
|
+
throw new Error("Invalid enrollment request ID");
|
|
12
|
+
const request = deps.request ?? hostRequest;
|
|
13
|
+
const bootstrap = (payload) => plan.local
|
|
14
|
+
? (deps.local ?? localBootstrap)(payload)
|
|
15
|
+
: (deps.remote ?? remoteBootstrap)(plan.ssh.args, payload);
|
|
16
|
+
// Authenticate namespace access before creating any remote identity material.
|
|
17
|
+
await request(`${hostApiPath(plan.namespace)}?prefix=${encodeURIComponent(`${plan.namespace}/${plan.group}`)}`);
|
|
18
|
+
const probe = await bootstrap({ action: "probe", name: plan.name, managedAccess: opts.managedAccess === true });
|
|
19
|
+
if (typeof probe.unixUser !== "string" || !probe.unixUser || typeof probe.publicKey !== "string" || !/^[A-Za-z0-9_-]{43}$/.test(probe.publicKey))
|
|
20
|
+
throw new Error("Remote host returned invalid identity");
|
|
21
|
+
const response = await request(`${hostApiPath(plan.namespace)}/enrollments`, "POST", {
|
|
22
|
+
name: plan.name, unixUser: probe.unixUser, publicKey: probe.publicKey,
|
|
23
|
+
requestId,
|
|
24
|
+
...(opts.lakeshoreId ? { lakeshoreId: opts.lakeshoreId } : {}),
|
|
25
|
+
});
|
|
26
|
+
if (response.host?.name !== plan.name || !response.host?.id || !response.enrollment?.id || !response.enrollment.machineId ||
|
|
27
|
+
typeof response.bootstrap?.namespace !== "string" || !/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(response.bootstrap.namespace) ||
|
|
28
|
+
!response.bootstrap.controlPlaneUrl)
|
|
29
|
+
throw new Error("Host API returned inconsistent enrollment identity");
|
|
30
|
+
let cpUrl;
|
|
31
|
+
try {
|
|
32
|
+
cpUrl = new URL(response.bootstrap.controlPlaneUrl);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
throw new Error("Host API returned an invalid control-plane URL");
|
|
36
|
+
}
|
|
37
|
+
if (!["http:", "https:"].includes(cpUrl.protocol) || cpUrl.username || cpUrl.password || cpUrl.search || cpUrl.hash ||
|
|
38
|
+
typeof response.bootstrap.token !== "string" || response.bootstrap.token.length < 16 || response.bootstrap.token.length > 4096 ||
|
|
39
|
+
!Number.isFinite(Date.parse(response.bootstrap.expiresAt)) || Date.parse(response.bootstrap.expiresAt) <= Date.now()) {
|
|
40
|
+
throw new Error("Host API returned an invalid or expired bootstrap grant");
|
|
41
|
+
}
|
|
42
|
+
await bootstrap({ action: "configure", name: plan.name, publicKey: probe.publicKey,
|
|
43
|
+
...response.bootstrap, machineId: response.enrollment.machineId, managedAccess: opts.managedAccess === true, webTerminal: plan.webTerminal, version: opts.nymphVersion ?? "latest" });
|
|
44
|
+
const deadline = Date.now() + timeoutSeconds * 1000;
|
|
45
|
+
while (true) {
|
|
46
|
+
const detail = await request(`${hostApiPath(plan.namespace)}/${encodeURIComponent(response.host.id)}`);
|
|
47
|
+
const enrollment = detail.enrollments?.find((e) => e.id === response.enrollment.id);
|
|
48
|
+
if (enrollment?.state === "online" && enrollment.statusVerified === true && enrollment.machineId === response.enrollment.machineId) {
|
|
49
|
+
const webTerminal = plan.webTerminal ? await waitForWebTerminal(plan.namespace, response.host.id, enrollment.id, deadline, request, deps.sleep) : { status: "disabled" };
|
|
50
|
+
return { status: "online", enrolled: true, host: response.host,
|
|
51
|
+
enrollment: { id: enrollment.id, machineId: enrollment.machineId, state: enrollment.state }, operationId: response.operationId, webTerminal,
|
|
52
|
+
...(webTerminal.status === "pending" ? { message: "Nymph is online; web terminal setup is pending. Retry enrollment with the same request ID." } : {}) };
|
|
53
|
+
}
|
|
54
|
+
if (Date.now() >= deadline)
|
|
55
|
+
return { status: "pending", enrolled: false, host: response.host, enrollment: { id: response.enrollment.id, machineId: response.enrollment.machineId }, operationId: response.operationId,
|
|
56
|
+
message: "Nymph was started but the backend has not confirmed this enrollment online. Inspect host status and the target user service." };
|
|
57
|
+
await (deps.sleep ?? (ms => new Promise(resolve => setTimeout(resolve, ms))))(1000);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export async function hostStatus(selector, opts = {}, request = hostRequest) {
|
|
61
|
+
if (/^[a-f0-9]{24}$/i.test(selector)) {
|
|
62
|
+
const namespace = await resolveHostNamespace(opts.namespace);
|
|
63
|
+
return request(`${hostApiPath(namespace)}/${selector.toLowerCase()}`);
|
|
64
|
+
}
|
|
65
|
+
const parts = selector.split("/");
|
|
66
|
+
if (parts.length !== 3 || !parts.slice(0, 2).every(s => /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(s)) || !(parts[2] === "*" || /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(parts[2])))
|
|
67
|
+
throw new Error("Host selector must be a 24-character host ID, namespace/group/host or namespace/group/*");
|
|
68
|
+
if (opts.namespace !== undefined && opts.namespace !== parts[0])
|
|
69
|
+
throw new Error("--namespace conflicts with the host selector");
|
|
70
|
+
const prefix = `${parts[0]}/${parts[1]}`;
|
|
71
|
+
const pageSize = Number(opts.pageSize ?? 100);
|
|
72
|
+
let page = Number(opts.page ?? 1);
|
|
73
|
+
if (!Number.isInteger(page) || page < 1 || page > 100_000 || !Number.isInteger(pageSize) || pageSize < 1 || pageSize > 100)
|
|
74
|
+
throw new Error("--page must be between 1 and 100000 and --page-size must be between 1 and 100");
|
|
75
|
+
if (parts[2] !== "*")
|
|
76
|
+
page = 1;
|
|
77
|
+
while (true) {
|
|
78
|
+
const result = await request(`${hostApiPath(parts[0])}?prefix=${encodeURIComponent(prefix)}&page=${page}&pageSize=${pageSize}${parts[2] === "*" ? "" : "&archived=include"}`);
|
|
79
|
+
if (parts[2] === "*")
|
|
80
|
+
return result;
|
|
81
|
+
const host = result.hosts?.find((h) => h.name === selector);
|
|
82
|
+
if (host)
|
|
83
|
+
return request(`${hostApiPath(parts[0])}/${encodeURIComponent(host.id)}`);
|
|
84
|
+
if (!Number.isInteger(result.totalPages) || page >= result.totalPages)
|
|
85
|
+
throw new Error("Host not found or not accessible");
|
|
86
|
+
if (page >= 100_000)
|
|
87
|
+
throw new Error("Host API returned invalid listing pagination");
|
|
88
|
+
page += 1;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/** Uses the owner's login only on the client; never passes it to Nymph. */
|
|
92
|
+
export async function waitForWebTerminal(namespace, hostId, enrollmentId, deadline, request = hostRequest, sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms))) {
|
|
93
|
+
while (true) {
|
|
94
|
+
try {
|
|
95
|
+
const result = await request(`/namespaces/${encodeURIComponent(namespace)}/hosts/terminal-targets`);
|
|
96
|
+
const target = result.targets?.find((entry) => entry.hostId === hostId && entry.enrollmentId === enrollmentId);
|
|
97
|
+
if (typeof target?.id === "string")
|
|
98
|
+
return { status: "ready", targetId: target.id };
|
|
99
|
+
if (Date.now() >= deadline)
|
|
100
|
+
return { status: "pending" };
|
|
101
|
+
await sleep(1000);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
if (!(error instanceof HostApiError) || ![409, 429, 503].includes(error.status ?? 0) || Date.now() >= deadline)
|
|
105
|
+
return { status: "pending" };
|
|
106
|
+
await sleep(1000);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { hostRequest } from "./api.js";
|
|
2
|
+
export interface EnrollmentInspection {
|
|
3
|
+
id: string;
|
|
4
|
+
machineId: string | null;
|
|
5
|
+
unixUser: string | null;
|
|
6
|
+
state: string | null;
|
|
7
|
+
statusVerified: boolean | null;
|
|
8
|
+
lastSeenAt: string | null;
|
|
9
|
+
presenceFreshness: "fresh" | "stale" | "unknown";
|
|
10
|
+
lastSeenAgeSeconds: number | null;
|
|
11
|
+
}
|
|
12
|
+
export interface HostEnrollments {
|
|
13
|
+
host: {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
};
|
|
17
|
+
readAt: string;
|
|
18
|
+
presenceWindowSeconds: number;
|
|
19
|
+
enrollments: EnrollmentInspection[];
|
|
20
|
+
}
|
|
21
|
+
/** Inspect one owner's scoped host detail; this never changes enrollment state. */
|
|
22
|
+
export declare function inspectHostEnrollments(selector: string, opts?: {
|
|
23
|
+
namespace?: string;
|
|
24
|
+
}, request?: typeof hostRequest, now?: () => number): Promise<HostEnrollments>;
|
|
25
|
+
export declare function formatHostEnrollments(result: HostEnrollments): string;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { hostRequest } from "./api.js";
|
|
2
|
+
import { hostStatus } from "./enroll.js";
|
|
3
|
+
// Matches the backend's enrollment presence window, not an action-readiness TTL.
|
|
4
|
+
const PRESENCE_WINDOW_SECONDS = 60;
|
|
5
|
+
function textOrNull(value) {
|
|
6
|
+
return typeof value === "string" && value.length > 0 ? value : null;
|
|
7
|
+
}
|
|
8
|
+
/** Inspect one owner's scoped host detail; this never changes enrollment state. */
|
|
9
|
+
export async function inspectHostEnrollments(selector, opts = {}, request = hostRequest, now = Date.now) {
|
|
10
|
+
if (selector.includes("*"))
|
|
11
|
+
throw new Error("Select one host by ID or full name; enrollment inspection does not accept wildcards");
|
|
12
|
+
const detail = await hostStatus(selector, opts, request);
|
|
13
|
+
if (!detail || !textOrNull(detail.host?.id) || !textOrNull(detail.host?.name) || !Array.isArray(detail.enrollments)) {
|
|
14
|
+
throw new Error("Host API returned invalid enrollment details");
|
|
15
|
+
}
|
|
16
|
+
const readTime = now();
|
|
17
|
+
const enrollments = detail.enrollments.map((entry) => {
|
|
18
|
+
if (!entry || typeof entry !== "object" || !("id" in entry) || !textOrNull(entry.id)) {
|
|
19
|
+
throw new Error("Host API returned an invalid enrollment identity");
|
|
20
|
+
}
|
|
21
|
+
const enrollment = entry;
|
|
22
|
+
const lastSeenAt = textOrNull(enrollment.lastSeenAt);
|
|
23
|
+
const seenTime = lastSeenAt === null ? NaN : Date.parse(lastSeenAt);
|
|
24
|
+
const verified = typeof enrollment.statusVerified === "boolean" ? enrollment.statusVerified : null;
|
|
25
|
+
// A future client-relative timestamp or an unverified record cannot establish freshness.
|
|
26
|
+
const age = verified === true && Number.isFinite(seenTime) && seenTime <= readTime ? (readTime - seenTime) / 1000 : null;
|
|
27
|
+
return {
|
|
28
|
+
id: enrollment.id,
|
|
29
|
+
machineId: textOrNull(enrollment.machineId),
|
|
30
|
+
unixUser: textOrNull(enrollment.unixUser),
|
|
31
|
+
state: textOrNull(enrollment.state),
|
|
32
|
+
statusVerified: verified,
|
|
33
|
+
lastSeenAt,
|
|
34
|
+
presenceFreshness: age === null ? "unknown" : age <= PRESENCE_WINDOW_SECONDS ? "fresh" : "stale",
|
|
35
|
+
lastSeenAgeSeconds: age === null ? null : Math.floor(age),
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
return { host: { id: detail.host.id, name: detail.host.name }, readAt: new Date(readTime).toISOString(),
|
|
39
|
+
presenceWindowSeconds: PRESENCE_WINDOW_SECONDS, enrollments };
|
|
40
|
+
}
|
|
41
|
+
function cell(value) {
|
|
42
|
+
return value === null ? "unknown" : value.replace(/[\x00-\x1f\x7f-\x9f]/g, " ");
|
|
43
|
+
}
|
|
44
|
+
export function formatHostEnrollments(result) {
|
|
45
|
+
const lines = [`Host ID: ${cell(result.host.id)}`, `Name: ${cell(result.host.name)}`, `Read at: ${result.readAt}`];
|
|
46
|
+
for (const enrollment of result.enrollments) {
|
|
47
|
+
lines.push("", `Enrollment ID: ${cell(enrollment.id)}`, `Machine ID: ${cell(enrollment.machineId)}`, `Unix user: ${cell(enrollment.unixUser)}`, `Observed state: ${cell(enrollment.state)}`, `Status verified: ${enrollment.statusVerified === null ? "unknown" : enrollment.statusVerified ? "yes" : "no"}`, `Last seen: ${cell(enrollment.lastSeenAt)}`, `Observed presence: ${enrollment.presenceFreshness}${enrollment.lastSeenAgeSeconds === null ? "" : ` (${enrollment.lastSeenAgeSeconds}s ago)`}`);
|
|
48
|
+
}
|
|
49
|
+
if (!result.enrollments.length)
|
|
50
|
+
lines.push("No enrollments.");
|
|
51
|
+
else
|
|
52
|
+
lines.push("", "Observed presence does not establish SSH or job readiness.");
|
|
53
|
+
return lines.join("\n");
|
|
54
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { type EnrollOptions } from "./config.js";
|
|
3
|
+
/** Human enrollment summary. JSON callers receive the original structured receipt. */
|
|
4
|
+
export declare function formatEnrollmentText(output: Record<string, any>): string;
|
|
5
|
+
export declare function runHostsEnroll(opts: EnrollOptions): Promise<number>;
|
|
6
|
+
export declare function registerHostsCommand(program: Command): void;
|