@dreamlake/dreamlake-cli 0.88.1 → 0.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/access.d.ts +83 -0
- package/dist/api/access.js +77 -0
- package/dist/api/agent.d.ts +156 -0
- package/dist/api/agent.js +111 -0
- package/dist/api/browser.d.ts +90 -0
- package/dist/api/browser.js +102 -0
- package/dist/api/client.d.ts +53 -0
- package/dist/api/client.js +102 -0
- package/dist/api/common.d.ts +28 -0
- package/dist/api/common.js +16 -0
- package/dist/api/content.d.ts +195 -0
- package/dist/api/content.js +147 -0
- package/dist/api/execution.d.ts +84 -0
- package/dist/api/execution.js +73 -0
- package/dist/api/http.d.ts +19 -0
- package/dist/api/http.js +66 -0
- package/dist/api/index.d.ts +2330 -0
- package/dist/api/index.js +114 -0
- package/dist/api/infra.d.ts +2 -0
- package/dist/api/infra.js +2 -0
- package/dist/api/jobs.d.ts +2 -0
- package/dist/api/jobs.js +2 -0
- package/dist/api/layout.d.ts +2 -0
- package/dist/api/layout.js +2 -0
- package/dist/api/library-edit.d.ts +3 -0
- package/dist/api/library-edit.js +3 -0
- package/dist/api/library-manifest.d.ts +2 -0
- package/dist/api/library-manifest.js +2 -0
- package/dist/api/note-character-plan.d.ts +2 -0
- package/dist/api/note-character-plan.js +2 -0
- package/dist/api/note-editing.d.ts +2 -0
- package/dist/api/note-editing.js +2 -0
- package/dist/api/note-edits.d.ts +21 -0
- package/dist/api/note-edits.js +10 -0
- package/dist/api/note-events.d.ts +5 -0
- package/dist/api/note-events.js +11 -0
- package/dist/api/note-files.d.ts +75 -0
- package/dist/api/note-files.js +65 -0
- package/dist/api/note-html-read.d.ts +2 -0
- package/dist/api/note-html-read.js +2 -0
- package/dist/api/note-html.d.ts +2 -0
- package/dist/api/note-html.js +2 -0
- package/dist/api/note-toc.d.ts +2 -0
- package/dist/api/note-toc.js +2 -0
- package/dist/api/notes.d.ts +304 -0
- package/dist/api/notes.js +181 -0
- package/dist/api/open-resources.d.ts +27 -0
- package/dist/api/open-resources.js +102 -0
- package/dist/api/ownership.d.ts +12 -0
- package/dist/api/ownership.js +24 -0
- package/dist/api/platform.d.ts +83 -0
- package/dist/api/platform.js +56 -0
- package/dist/api/presigned-transfer.d.ts +2 -0
- package/dist/api/presigned-transfer.js +2 -0
- package/dist/api/registered-runs.d.ts +48 -0
- package/dist/api/registered-runs.js +33 -0
- package/dist/api/sessions.d.ts +299 -0
- package/dist/api/sessions.js +105 -0
- package/dist/api/storage.d.ts +46 -0
- package/dist/api/storage.js +34 -0
- package/dist/api/streams.d.ts +18 -0
- package/dist/api/streams.js +70 -0
- package/dist/api/vault.d.ts +93 -0
- package/dist/api/vault.js +79 -0
- package/dist/api/workspace.d.ts +180 -0
- package/dist/api/workspace.js +146 -0
- package/dist/cli/agent-identity.d.ts +4 -0
- package/dist/cli/agent-identity.js +21 -0
- package/dist/cli/agents/identity.d.ts +50 -0
- package/dist/cli/agents/identity.js +105 -0
- package/dist/cli/agents/index.d.ts +31 -0
- package/dist/cli/agents/index.js +580 -0
- package/dist/cli/agents/manage.d.ts +43 -0
- package/dist/cli/agents/manage.js +376 -0
- package/dist/cli/agents/spec.d.ts +104 -0
- package/dist/cli/agents/spec.js +280 -0
- package/dist/cli/agents/web.d.ts +7 -0
- package/dist/cli/agents/web.js +109 -0
- package/dist/cli/artifact/incremental.d.ts +21 -0
- package/dist/cli/artifact/incremental.js +80 -0
- package/dist/cli/artifact/index.d.ts +52 -0
- package/dist/cli/artifact/index.js +405 -0
- package/dist/cli/artifact/meta.d.ts +69 -0
- package/dist/cli/artifact/meta.js +189 -0
- package/dist/cli/auth/commands.d.ts +29 -0
- package/dist/cli/auth/commands.js +327 -0
- package/dist/cli/auth/constants.d.ts +13 -0
- package/dist/cli/auth/constants.js +18 -0
- package/dist/cli/auth/credentials.d.ts +37 -0
- package/dist/cli/auth/credentials.js +155 -0
- package/dist/cli/auth/device-flow.d.ts +32 -0
- package/dist/cli/auth/device-flow.js +154 -0
- package/dist/cli/auth/device-secret.d.ts +6 -0
- package/dist/cli/auth/device-secret.js +26 -0
- package/dist/cli/auth/machine.d.ts +15 -0
- package/dist/cli/auth/machine.js +126 -0
- package/dist/cli/auth/materialized.d.ts +32 -0
- package/dist/cli/auth/materialized.js +102 -0
- package/dist/cli/auth/migrate.d.ts +10 -0
- package/dist/cli/auth/migrate.js +75 -0
- package/dist/cli/client.d.ts +102 -0
- package/dist/cli/client.js +206 -0
- package/dist/cli/collection-list.d.ts +3 -0
- package/dist/cli/collection-list.js +25 -0
- package/dist/cli/compat/ctx.d.ts +26 -0
- package/dist/cli/compat/ctx.js +76 -0
- package/dist/cli/compat/dreamdb-wasm-embedded.d.ts +2 -0
- package/dist/cli/compat/dreamdb-wasm-embedded.js +8 -0
- package/dist/cli/compat/dreamdb-wasm.d.ts +1 -0
- package/dist/cli/compat/dreamdb-wasm.js +26 -0
- package/dist/cli/compat/dreamdb.d.ts +112 -0
- package/dist/cli/compat/dreamdb.js +219 -0
- package/dist/cli/compat/flags.d.ts +2 -0
- package/dist/cli/compat/flags.js +13 -0
- package/dist/cli/compat/http.d.ts +23 -0
- package/dist/cli/compat/http.js +137 -0
- package/dist/cli/compat/presignedTransfer.d.ts +139 -0
- package/dist/cli/compat/presignedTransfer.js +580 -0
- package/dist/cli/compat/s3-backend.d.ts +73 -0
- package/dist/cli/compat/s3-backend.js +132 -0
- package/dist/cli/config.d.ts +22 -0
- package/dist/cli/config.js +96 -0
- package/dist/cli/connection/dto.d.ts +159 -0
- package/dist/cli/connection/dto.js +497 -0
- package/dist/cli/connection/index.d.ts +50 -0
- package/dist/cli/connection/index.js +413 -0
- package/dist/cli/connection/oauth.d.ts +23 -0
- package/dist/cli/connection/oauth.js +290 -0
- package/dist/cli/connection/write.d.ts +47 -0
- package/dist/cli/connection/write.js +573 -0
- package/dist/cli/create/index.d.ts +19 -0
- package/dist/cli/create/index.js +209 -0
- package/dist/cli/declare/index.d.ts +29 -0
- package/dist/cli/declare/index.js +304 -0
- package/dist/cli/delete/index.d.ts +18 -0
- package/dist/cli/delete/index.js +232 -0
- package/dist/cli/download/index.d.ts +9 -0
- package/dist/cli/download/index.js +128 -0
- package/dist/cli/env/compose.d.ts +88 -0
- package/dist/cli/env/compose.js +402 -0
- package/dist/cli/env/index.d.ts +176 -0
- package/dist/cli/env/index.js +1011 -0
- package/dist/cli/experiments/index.d.ts +11 -0
- package/dist/cli/experiments/index.js +168 -0
- package/dist/cli/glob.d.ts +1 -0
- package/dist/cli/glob.js +45 -0
- package/dist/cli/graphql-helpers.d.ts +23 -0
- package/dist/cli/graphql-helpers.js +42 -0
- package/dist/cli/graphql.d.ts +10 -0
- package/dist/cli/graphql.js +47 -0
- package/dist/cli/help-examples.generated.d.ts +1 -0
- package/dist/cli/help-examples.generated.js +192 -0
- package/dist/cli/helpers.d.ts +8 -0
- package/dist/cli/helpers.js +106 -0
- package/dist/cli/hosts/api.d.ts +29 -0
- package/dist/cli/hosts/api.js +54 -0
- package/dist/cli/hosts/bootstrap-source.d.ts +1 -0
- package/dist/cli/hosts/bootstrap-source.js +2 -0
- package/dist/cli/hosts/catalog.d.ts +26 -0
- package/dist/cli/hosts/catalog.js +55 -0
- package/dist/cli/hosts/config.d.ts +45 -0
- package/dist/cli/hosts/config.js +179 -0
- package/dist/cli/hosts/credentials.d.ts +19 -0
- package/dist/cli/hosts/credentials.js +173 -0
- package/dist/cli/hosts/enroll.d.ts +17 -0
- package/dist/cli/hosts/enroll.js +109 -0
- package/dist/cli/hosts/enrollments.d.ts +25 -0
- package/dist/cli/hosts/enrollments.js +54 -0
- package/dist/cli/hosts/index.d.ts +6 -0
- package/dist/cli/hosts/index.js +279 -0
- package/dist/cli/hosts/inventory.d.ts +40 -0
- package/dist/cli/hosts/inventory.js +91 -0
- package/dist/cli/hosts/lifecycle.d.ts +15 -0
- package/dist/cli/hosts/lifecycle.js +108 -0
- package/dist/cli/hosts/metrics-source.d.ts +12 -0
- package/dist/cli/hosts/metrics-source.js +89 -0
- package/dist/cli/hosts/observations.d.ts +39 -0
- package/dist/cli/hosts/observations.js +102 -0
- package/dist/cli/hosts/remote.d.ts +5 -0
- package/dist/cli/hosts/remote.js +66 -0
- package/dist/cli/hosts/ssh.d.ts +63 -0
- package/dist/cli/hosts/ssh.js +276 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +288 -0
- package/dist/cli/infra/api.d.ts +95 -0
- package/dist/cli/infra/api.js +291 -0
- package/dist/cli/infra/index.d.ts +5 -0
- package/dist/cli/infra/index.js +102 -0
- package/dist/cli/infra/move.d.ts +15 -0
- package/dist/cli/infra/move.js +123 -0
- package/dist/cli/infra/transfer.d.ts +15 -0
- package/dist/cli/infra/transfer.js +280 -0
- package/dist/cli/jobs/api.d.ts +69 -0
- package/dist/cli/jobs/api.js +121 -0
- package/dist/cli/jobs/index.d.ts +5 -0
- package/dist/cli/jobs/index.js +140 -0
- package/dist/cli/lakeshore/index.d.ts +98 -0
- package/dist/cli/lakeshore/index.js +502 -0
- package/dist/cli/launch/index.d.ts +43 -0
- package/dist/cli/launch/index.js +270 -0
- package/dist/cli/layout/index.d.ts +2 -0
- package/dist/cli/layout/index.js +44 -0
- package/dist/cli/layout/transport.d.ts +12 -0
- package/dist/cli/layout/transport.js +70 -0
- package/dist/cli/library/add.d.ts +60 -0
- package/dist/cli/library/add.js +348 -0
- package/dist/cli/library/cache.d.ts +26 -0
- package/dist/cli/library/cache.js +88 -0
- package/dist/cli/library/config.d.ts +75 -0
- package/dist/cli/library/config.js +198 -0
- package/dist/cli/library/digest.d.ts +5 -0
- package/dist/cli/library/digest.js +19 -0
- package/dist/cli/library/discover.d.ts +87 -0
- package/dist/cli/library/discover.js +534 -0
- package/dist/cli/library/freshness.d.ts +35 -0
- package/dist/cli/library/freshness.js +109 -0
- package/dist/cli/library/generation.d.ts +35 -0
- package/dist/cli/library/generation.js +211 -0
- package/dist/cli/library/index.d.ts +2 -0
- package/dist/cli/library/index.js +36 -0
- package/dist/cli/library/info.d.ts +69 -0
- package/dist/cli/library/info.js +311 -0
- package/dist/cli/library/list.d.ts +33 -0
- package/dist/cli/library/list.js +86 -0
- package/dist/cli/library/manifest.d.ts +81 -0
- package/dist/cli/library/manifest.js +200 -0
- package/dist/cli/library/manifestCache.d.ts +45 -0
- package/dist/cli/library/manifestCache.js +169 -0
- package/dist/cli/library/pull.d.ts +30 -0
- package/dist/cli/library/pull.js +438 -0
- package/dist/cli/library/push.d.ts +72 -0
- package/dist/cli/library/push.js +642 -0
- package/dist/cli/library/rm.d.ts +31 -0
- package/dist/cli/library/rm.js +200 -0
- package/dist/cli/library/search.d.ts +18 -0
- package/dist/cli/library/search.js +181 -0
- package/dist/cli/library/stat.d.ts +15 -0
- package/dist/cli/library/stat.js +127 -0
- package/dist/cli/library/tools.d.ts +104 -0
- package/dist/cli/library/tools.js +163 -0
- package/dist/cli/library/wire.d.ts +47 -0
- package/dist/cli/library/wire.js +120 -0
- package/dist/cli/list/index.d.ts +26 -0
- package/dist/cli/list/index.js +256 -0
- package/dist/cli/notes/character-plan.d.ts +22 -0
- package/dist/cli/notes/character-plan.js +232 -0
- package/dist/cli/notes/document.d.ts +73 -0
- package/dist/cli/notes/document.js +306 -0
- package/dist/cli/notes/edit-commands.d.ts +106 -0
- package/dist/cli/notes/edit-commands.js +623 -0
- package/dist/cli/notes/editing.d.ts +81 -0
- package/dist/cli/notes/editing.js +305 -0
- package/dist/cli/notes/events.d.ts +36 -0
- package/dist/cli/notes/events.js +54 -0
- package/dist/cli/notes/files-commands.d.ts +120 -0
- package/dist/cli/notes/files-commands.js +554 -0
- package/dist/cli/notes/html-read.d.ts +9 -0
- package/dist/cli/notes/html-read.js +90 -0
- package/dist/cli/notes/html.d.ts +73 -0
- package/dist/cli/notes/html.js +381 -0
- package/dist/cli/notes/index.d.ts +123 -0
- package/dist/cli/notes/index.js +1303 -0
- package/dist/cli/notes/linger.d.ts +59 -0
- package/dist/cli/notes/linger.js +339 -0
- package/dist/cli/notes/media-commands.d.ts +5 -0
- package/dist/cli/notes/media-commands.js +51 -0
- package/dist/cli/notes/move-command.d.ts +83 -0
- package/dist/cli/notes/move-command.js +259 -0
- package/dist/cli/notes/rm-command.d.ts +22 -0
- package/dist/cli/notes/rm-command.js +110 -0
- package/dist/cli/notes/select-command.d.ts +12 -0
- package/dist/cli/notes/select-command.js +84 -0
- package/dist/cli/notes/suggest-diff.d.ts +56 -0
- package/dist/cli/notes/suggest-diff.js +311 -0
- package/dist/cli/notes/toc.d.ts +38 -0
- package/dist/cli/notes/toc.js +144 -0
- package/dist/cli/notes/transfer-command.d.ts +6 -0
- package/dist/cli/notes/transfer-command.js +9 -0
- package/dist/cli/notes/version-commands.d.ts +19 -0
- package/dist/cli/notes/version-commands.js +178 -0
- package/dist/cli/nymph/index.d.ts +74 -0
- package/dist/cli/nymph/index.js +349 -0
- package/dist/cli/org/index.d.ts +34 -0
- package/dist/cli/org/index.js +341 -0
- package/dist/cli/ownership/index.d.ts +12 -0
- package/dist/cli/ownership/index.js +122 -0
- package/dist/cli/ownership/metadata-transfer.d.ts +20 -0
- package/dist/cli/ownership/metadata-transfer.js +159 -0
- package/dist/cli/page/index.d.ts +58 -0
- package/dist/cli/page/index.js +387 -0
- package/dist/cli/pipeline/index.d.ts +69 -0
- package/dist/cli/pipeline/index.js +604 -0
- package/dist/cli/progress.d.ts +60 -0
- package/dist/cli/progress.js +276 -0
- package/dist/cli/project/attachments.d.ts +10 -0
- package/dist/cli/project/attachments.js +39 -0
- package/dist/cli/project/grants.d.ts +10 -0
- package/dist/cli/project/grants.js +39 -0
- package/dist/cli/project/index.d.ts +8 -0
- package/dist/cli/project/index.js +92 -0
- package/dist/cli/project/move.d.ts +57 -0
- package/dist/cli/project/move.js +242 -0
- package/dist/cli/project/output.d.ts +2 -0
- package/dist/cli/project/output.js +29 -0
- package/dist/cli/project/stream.d.ts +55 -0
- package/dist/cli/project/stream.js +207 -0
- package/dist/cli/project/transfer-preview.d.ts +8 -0
- package/dist/cli/project/transfer-preview.js +10 -0
- package/dist/cli/prompt.d.ts +1 -0
- package/dist/cli/prompt.js +17 -0
- package/dist/cli/provider/dreamdir.d.ts +52 -0
- package/dist/cli/provider/dreamdir.js +138 -0
- package/dist/cli/provider/index.d.ts +4 -0
- package/dist/cli/provider/index.js +419 -0
- package/dist/cli/provider/jump-worker.d.ts +9 -0
- package/dist/cli/provider/jump-worker.js +141 -0
- package/dist/cli/provider/lifecycle.d.ts +149 -0
- package/dist/cli/provider/lifecycle.js +1390 -0
- package/dist/cli/provider/machine.d.ts +17 -0
- package/dist/cli/provider/machine.js +116 -0
- package/dist/cli/provider/ssh.d.ts +105 -0
- package/dist/cli/provider/ssh.js +305 -0
- package/dist/cli/provider/terraform.d.ts +140 -0
- package/dist/cli/provider/terraform.js +288 -0
- package/dist/cli/providers/index.d.ts +18 -0
- package/dist/cli/providers/index.js +422 -0
- package/dist/cli/python.d.ts +61 -0
- package/dist/cli/python.js +255 -0
- package/dist/cli/queues/index.d.ts +33 -0
- package/dist/cli/queues/index.js +248 -0
- package/dist/cli/queues/slurm.d.ts +10 -0
- package/dist/cli/queues/slurm.js +134 -0
- package/dist/cli/resources.d.ts +72 -0
- package/dist/cli/resources.js +137 -0
- package/dist/cli/run/index.d.ts +15 -0
- package/dist/cli/run/index.js +163 -0
- package/dist/cli/run/input.d.ts +34 -0
- package/dist/cli/run/input.js +135 -0
- package/dist/cli/run/recovery.d.ts +2 -0
- package/dist/cli/run/recovery.js +18 -0
- package/dist/cli/run/setup.d.ts +3 -0
- package/dist/cli/run/setup.js +62 -0
- package/dist/cli/runconfig/index.d.ts +12 -0
- package/dist/cli/runconfig/index.js +130 -0
- package/dist/cli/runnable/index.d.ts +35 -0
- package/dist/cli/runnable/index.js +575 -0
- package/dist/cli/runnable/path.d.ts +115 -0
- package/dist/cli/runnable/path.js +288 -0
- package/dist/cli/runnable/run.d.ts +91 -0
- package/dist/cli/runnable/run.js +239 -0
- package/dist/cli/runnable/upload.d.ts +43 -0
- package/dist/cli/runnable/upload.js +342 -0
- package/dist/cli/runnable/worker.d.ts +1 -0
- package/dist/cli/runnable/worker.js +44 -0
- package/dist/cli/schemas/workflow-spec.schema.json +335 -0
- package/dist/cli/self-update/index.d.ts +5 -0
- package/dist/cli/self-update/index.js +107 -0
- package/dist/cli/self-update/install.d.ts +60 -0
- package/dist/cli/self-update/install.js +428 -0
- package/dist/cli/self-update/paths.d.ts +40 -0
- package/dist/cli/self-update/paths.js +87 -0
- package/dist/cli/self-update/releases.d.ts +41 -0
- package/dist/cli/self-update/releases.js +153 -0
- package/dist/cli/self-update/settings.d.ts +16 -0
- package/dist/cli/self-update/settings.js +68 -0
- package/dist/cli/self-update/update.d.ts +18 -0
- package/dist/cli/self-update/update.js +241 -0
- package/dist/cli/service-accounts/index.d.ts +3 -0
- package/dist/cli/service-accounts/index.js +149 -0
- package/dist/cli/session-affiliation.d.ts +26 -0
- package/dist/cli/session-affiliation.js +135 -0
- package/dist/cli/sessions/affiliation.d.ts +8 -0
- package/dist/cli/sessions/affiliation.js +66 -0
- package/dist/cli/sessions/api.d.ts +55 -0
- package/dist/cli/sessions/api.js +88 -0
- package/dist/cli/sessions/control.d.ts +6 -0
- package/dist/cli/sessions/control.js +159 -0
- package/dist/cli/sessions/conversation.d.ts +15 -0
- package/dist/cli/sessions/conversation.js +118 -0
- package/dist/cli/sessions/index.d.ts +2 -0
- package/dist/cli/sessions/index.js +209 -0
- package/dist/cli/sessions/managed.d.ts +39 -0
- package/dist/cli/sessions/managed.js +63 -0
- package/dist/cli/sessions/redaction.d.ts +2 -0
- package/dist/cli/sessions/redaction.js +11 -0
- package/dist/cli/sessions/runner/exec.d.ts +108 -0
- package/dist/cli/sessions/runner/exec.js +335 -0
- package/dist/cli/sessions/runner/journal.d.ts +26 -0
- package/dist/cli/sessions/runner/journal.js +49 -0
- package/dist/cli/sessions/runner/native.d.ts +48 -0
- package/dist/cli/sessions/runner/native.js +170 -0
- package/dist/cli/sessions/runner/pod.d.ts +30 -0
- package/dist/cli/sessions/runner/pod.js +129 -0
- package/dist/cli/sessions/runner/serve.d.ts +85 -0
- package/dist/cli/sessions/runner/serve.js +558 -0
- package/dist/cli/sessions/sync.d.ts +47 -0
- package/dist/cli/sessions/sync.js +80 -0
- package/dist/cli/sessions/transport.d.ts +14 -0
- package/dist/cli/sessions/transport.js +116 -0
- package/dist/cli/share.d.ts +15 -0
- package/dist/cli/share.js +139 -0
- package/dist/cli/skill/catalog.d.ts +141 -0
- package/dist/cli/skill/catalog.js +442 -0
- package/dist/cli/skill/files.d.ts +89 -0
- package/dist/cli/skill/files.js +264 -0
- package/dist/cli/skill/index.d.ts +268 -0
- package/dist/cli/skill/index.js +1216 -0
- package/dist/cli/skill/manifest.d.ts +30 -0
- package/dist/cli/skill/manifest.js +101 -0
- package/dist/cli/skill/prefs.d.ts +9 -0
- package/dist/cli/skill/prefs.js +32 -0
- package/dist/cli/skill/reminders.d.ts +15 -0
- package/dist/cli/skill/reminders.js +105 -0
- package/dist/cli/skill/tar.d.ts +17 -0
- package/dist/cli/skill/tar.js +195 -0
- package/dist/cli/snapshot/index.d.ts +24 -0
- package/dist/cli/snapshot/index.js +146 -0
- package/dist/cli/source/access.d.ts +45 -0
- package/dist/cli/source/access.js +563 -0
- package/dist/cli/source/control.d.ts +103 -0
- package/dist/cli/source/control.js +546 -0
- package/dist/cli/source/delete.d.ts +89 -0
- package/dist/cli/source/delete.js +463 -0
- package/dist/cli/source/index.d.ts +288 -0
- package/dist/cli/source/index.js +1348 -0
- package/dist/cli/source/share.d.ts +65 -0
- package/dist/cli/source/share.js +530 -0
- package/dist/cli/source/upload.d.ts +62 -0
- package/dist/cli/source/upload.js +258 -0
- package/dist/cli/source/write.d.ts +77 -0
- package/dist/cli/source/write.js +335 -0
- package/dist/cli/spawn.d.ts +28 -0
- package/dist/cli/spawn.js +81 -0
- package/dist/cli/target.d.ts +22 -0
- package/dist/cli/target.js +85 -0
- package/dist/cli/tasks/index.d.ts +38 -0
- package/dist/cli/tasks/index.js +365 -0
- package/dist/cli/team/index.d.ts +37 -0
- package/dist/cli/team/index.js +407 -0
- package/dist/cli/telemetry.d.ts +23 -0
- package/dist/cli/telemetry.js +262 -0
- package/dist/cli/telemetryJournal.d.ts +26 -0
- package/dist/cli/telemetryJournal.js +104 -0
- package/dist/cli/update/index.d.ts +21 -0
- package/dist/cli/update/index.js +284 -0
- package/dist/cli/upload/index.d.ts +11 -0
- package/dist/cli/upload/index.js +261 -0
- package/dist/cli/upload/kinds.d.ts +10 -0
- package/dist/cli/upload/kinds.js +85 -0
- package/dist/cli/upload/multipart.d.ts +21 -0
- package/dist/cli/upload/multipart.js +248 -0
- package/dist/cli/vault/affected-preview.d.ts +15 -0
- package/dist/cli/vault/affected-preview.js +38 -0
- package/dist/cli/vault/cloud.d.ts +55 -0
- package/dist/cli/vault/cloud.js +287 -0
- package/dist/cli/vault/format.d.ts +18 -0
- package/dist/cli/vault/format.js +104 -0
- package/dist/cli/vault/hostCredentials.d.ts +21 -0
- package/dist/cli/vault/hostCredentials.js +71 -0
- package/dist/cli/vault/hostSupersessions.d.ts +18 -0
- package/dist/cli/vault/hostSupersessions.js +68 -0
- package/dist/cli/vault/import.d.ts +3 -0
- package/dist/cli/vault/import.js +79 -0
- package/dist/cli/vault/index.d.ts +14 -0
- package/dist/cli/vault/index.js +225 -0
- package/dist/cli/vault/keys.d.ts +5 -0
- package/dist/cli/vault/keys.js +165 -0
- package/dist/cli/vault/kms.d.ts +6 -0
- package/dist/cli/vault/kms.js +169 -0
- package/dist/cli/vault/list.d.ts +13 -0
- package/dist/cli/vault/list.js +60 -0
- package/dist/cli/vault/listView.d.ts +21 -0
- package/dist/cli/vault/listView.js +123 -0
- package/dist/cli/vault/managementMetadata.d.ts +2 -0
- package/dist/cli/vault/managementMetadata.js +23 -0
- package/dist/cli/vault/mutations.d.ts +8 -0
- package/dist/cli/vault/mutations.js +151 -0
- package/dist/cli/vault/otp.d.ts +6 -0
- package/dist/cli/vault/otp.js +62 -0
- package/dist/cli/vault/otpIntent.d.ts +23 -0
- package/dist/cli/vault/otpIntent.js +76 -0
- package/dist/cli/vault/passImport.d.ts +25 -0
- package/dist/cli/vault/passImport.js +129 -0
- package/dist/cli/vault/passOtp.d.ts +51 -0
- package/dist/cli/vault/passOtp.js +101 -0
- package/dist/cli/vault/passStore.d.ts +26 -0
- package/dist/cli/vault/passStore.js +134 -0
- package/dist/cli/vault/passwordCommand.d.ts +39 -0
- package/dist/cli/vault/passwordCommand.js +101 -0
- package/dist/cli/vault/passwordProbe.d.ts +27 -0
- package/dist/cli/vault/passwordProbe.js +282 -0
- package/dist/cli/vault/passwordRotation.d.ts +9 -0
- package/dist/cli/vault/passwordRotation.js +273 -0
- package/dist/cli/vault/rotationApi.d.ts +13 -0
- package/dist/cli/vault/rotationApi.js +58 -0
- package/dist/cli/vault/rotationCommand.d.ts +2 -0
- package/dist/cli/vault/rotationCommand.js +75 -0
- package/dist/cli/vault/rotationEngine.d.ts +19 -0
- package/dist/cli/vault/rotationEngine.js +65 -0
- package/dist/cli/vault/rotationHelperSource.d.ts +2 -0
- package/dist/cli/vault/rotationHelperSource.js +3 -0
- package/dist/cli/vault/rotationInput.d.ts +11 -0
- package/dist/cli/vault/rotationInput.js +48 -0
- package/dist/cli/vault/rotationJournal.d.ts +16 -0
- package/dist/cli/vault/rotationJournal.js +183 -0
- package/dist/cli/vault/rotationKeys.d.ts +4 -0
- package/dist/cli/vault/rotationKeys.js +48 -0
- package/dist/cli/vault/rotationPrepare.d.ts +17 -0
- package/dist/cli/vault/rotationPrepare.js +108 -0
- package/dist/cli/vault/rotationRemote.d.ts +33 -0
- package/dist/cli/vault/rotationRemote.js +156 -0
- package/dist/cli/vault/rotationState.d.ts +42 -0
- package/dist/cli/vault/rotationState.js +115 -0
- package/dist/cli/vault/rotationTransport.d.ts +18 -0
- package/dist/cli/vault/rotationTransport.js +71 -0
- package/dist/cli/vault/sshSource.d.ts +18 -0
- package/dist/cli/vault/sshSource.js +196 -0
- package/dist/cli/vault/sshSync.d.ts +17 -0
- package/dist/cli/vault/sshSync.js +224 -0
- package/dist/cli/vault/sshTransfer.d.ts +22 -0
- package/dist/cli/vault/sshTransfer.js +140 -0
- package/dist/cli/vault/terraformState.d.ts +66 -0
- package/dist/cli/vault/terraformState.js +252 -0
- package/dist/cli/vault/terraformStateCommand.d.ts +2 -0
- package/dist/cli/vault/terraformStateCommand.js +61 -0
- package/dist/cli/vault/tree.d.ts +43 -0
- package/dist/cli/vault/tree.js +292 -0
- package/dist/cli/version.d.ts +1 -0
- package/dist/cli/version.js +9 -0
- package/dist/cli/workflow/index.d.ts +76 -0
- package/dist/cli/workflow/index.js +826 -0
- package/dist/cli/workflow/validate.d.ts +19 -0
- package/dist/cli/workflow/validate.js +353 -0
- package/dist/package.json +1 -0
- package/package.json +28 -10
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { redactSessionText } from './redaction.js';
|
|
2
|
+
import { open } from 'node:fs/promises';
|
|
3
|
+
import { constants } from 'node:fs';
|
|
4
|
+
import { resolveHostNamespace } from '../hosts/inventory.js';
|
|
5
|
+
import { connection, requestJson, sessionPath } from './api.js';
|
|
6
|
+
const limit = 8 * 1024 * 1024;
|
|
7
|
+
/** Explicitly selected export only. Never search home directories or upload environment/configuration. */
|
|
8
|
+
export function parseConversation(source, provider, nativeId) {
|
|
9
|
+
const messages = [];
|
|
10
|
+
const add = (role, text, timestamp) => {
|
|
11
|
+
messages.push({ role, text: redactSessionText(text), ...(typeof timestamp === 'string' && Number.isFinite(Date.parse(timestamp)) ? { timestamp } : {}) });
|
|
12
|
+
};
|
|
13
|
+
let document;
|
|
14
|
+
try {
|
|
15
|
+
document = JSON.parse(source);
|
|
16
|
+
}
|
|
17
|
+
catch { /* Native exports are JSONL. */ }
|
|
18
|
+
if (document?.version === 1 && Array.isArray(document.messages)) {
|
|
19
|
+
if (document.provider !== provider || document.nativeSessionId !== nativeId)
|
|
20
|
+
throw new Error('Conversation identity does not match the saved session');
|
|
21
|
+
for (const message of document.messages) {
|
|
22
|
+
if (!message || !['user', 'assistant', 'tool', 'system'].includes(message.role) || typeof message.text !== 'string')
|
|
23
|
+
throw new Error('Invalid conversation message');
|
|
24
|
+
add(message.role, message.text, message.timestamp);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
let identified = false;
|
|
29
|
+
const rows = source.split('\n').filter(line => line.trim()).map(line => JSON.parse(line));
|
|
30
|
+
const text = (blocks) => typeof blocks === 'string' ? blocks : Array.isArray(blocks) ? blocks.map(block => {
|
|
31
|
+
if (['text', 'input_text', 'output_text'].includes(block?.type) && typeof block.text === 'string')
|
|
32
|
+
return block.text;
|
|
33
|
+
if (block?.type === 'tool_use')
|
|
34
|
+
return `${block.name}\n${JSON.stringify(block.input)}`;
|
|
35
|
+
if (block?.type === 'tool_result')
|
|
36
|
+
return text(block.content);
|
|
37
|
+
// Binary attachments and private reasoning are not conversation text.
|
|
38
|
+
return '';
|
|
39
|
+
}).filter(Boolean).join('\n') : '';
|
|
40
|
+
for (const row of rows) {
|
|
41
|
+
const id = provider === 'codex' && row.type === 'session_meta' ? row.payload?.id : provider === 'claude' ? row.sessionId : undefined;
|
|
42
|
+
if (id !== undefined) {
|
|
43
|
+
if (typeof id !== 'string' || id.toLowerCase() !== nativeId)
|
|
44
|
+
throw new Error('Export contains a different session identity');
|
|
45
|
+
identified = true;
|
|
46
|
+
}
|
|
47
|
+
if (provider === 'codex' && row.type === 'response_item') {
|
|
48
|
+
const p = row.payload;
|
|
49
|
+
if (p?.type === 'message' && ['user', 'assistant', 'system', 'developer'].includes(p.role))
|
|
50
|
+
add(p.role === 'developer' ? 'system' : p.role, text(p.content), row.timestamp);
|
|
51
|
+
if (['function_call', 'custom_tool_call'].includes(p?.type))
|
|
52
|
+
add('tool', `${p.name}\n${p.arguments ?? p.input ?? ''}`, row.timestamp);
|
|
53
|
+
if (['function_call_output', 'custom_tool_call_output'].includes(p?.type))
|
|
54
|
+
add('tool', typeof p.output === 'string' ? p.output : Array.isArray(p.output) ? text(p.output) : JSON.stringify(p.output), row.timestamp);
|
|
55
|
+
}
|
|
56
|
+
else if (provider === 'claude' && ['user', 'assistant'].includes(row.type) && row.message)
|
|
57
|
+
add(row.type, text(row.message.content), row.timestamp);
|
|
58
|
+
}
|
|
59
|
+
if (!identified)
|
|
60
|
+
throw new Error('Export must contain the exact native session identity');
|
|
61
|
+
}
|
|
62
|
+
const conversation = { version: 1, provider, nativeSessionId: nativeId, messages };
|
|
63
|
+
if (!messages.length || messages.length > 20000)
|
|
64
|
+
throw new Error('Conversation must contain 1–20000 messages');
|
|
65
|
+
if (Buffer.byteLength(JSON.stringify(conversation)) > limit)
|
|
66
|
+
throw new Error('Conversation exceeds 8 MiB; nothing was uploaded');
|
|
67
|
+
return conversation;
|
|
68
|
+
}
|
|
69
|
+
export async function readConversationFile(path, provider, nativeId) {
|
|
70
|
+
// A misconfigured FIFO must not hold a successful note upload waiting for a writer.
|
|
71
|
+
const file = await open(path, constants.O_RDONLY | constants.O_NONBLOCK);
|
|
72
|
+
try {
|
|
73
|
+
const stat = await file.stat();
|
|
74
|
+
if (!stat.isFile() || stat.size > 32 * 1024 * 1024)
|
|
75
|
+
throw new Error('Select a regular conversation export up to 32 MiB');
|
|
76
|
+
const buffer = Buffer.alloc(stat.size + 1);
|
|
77
|
+
let offset = 0;
|
|
78
|
+
while (offset < buffer.length) {
|
|
79
|
+
const { bytesRead } = await file.read(buffer, offset, buffer.length - offset, null);
|
|
80
|
+
if (!bytesRead)
|
|
81
|
+
break;
|
|
82
|
+
offset += bytesRead;
|
|
83
|
+
}
|
|
84
|
+
if (offset > stat.size)
|
|
85
|
+
throw new Error('Conversation changed during read; retry the snapshot');
|
|
86
|
+
return parseConversation(buffer.subarray(0, offset).toString('utf8'), provider, nativeId);
|
|
87
|
+
}
|
|
88
|
+
finally {
|
|
89
|
+
await file.close();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
export function registerSessionConversation(group) {
|
|
93
|
+
group.command('upload-conversation <id>').description('upload an explicitly selected conversation export; never start a terminal')
|
|
94
|
+
.option('--namespace <namespace>', 'saved session namespace')
|
|
95
|
+
.requiredOption('--file <path>', 'Codex/Claude JSONL or DreamLake conversation JSON; contents become visible to session readers')
|
|
96
|
+
.option('--json').action(async (id, opts) => {
|
|
97
|
+
try {
|
|
98
|
+
const ns = await resolveHostNamespace(opts.namespace), conn = connection(), base = sessionPath(ns, id);
|
|
99
|
+
// The conversation endpoint remains usable without a live host. The export provides the native identity.
|
|
100
|
+
const current = await requestJson(conn, base + '/conversation?metadata=true');
|
|
101
|
+
if (!['codex', 'claude'].includes(current.provider) || typeof current.nativeSessionId !== 'string' || !/^[a-f0-9-]{36}$/.test(current.nativeSessionId))
|
|
102
|
+
throw new Error('Invalid saved conversation identity');
|
|
103
|
+
const conversation = await readConversationFile(opts.file, current.provider, current.nativeSessionId);
|
|
104
|
+
const receipt = await requestJson(conn, base + '/conversation', 'PUT', { conversation, expectedRevision: current.revision });
|
|
105
|
+
if (receipt.sessionId !== id || !/^[a-f0-9]{64}$/.test(receipt.revision))
|
|
106
|
+
throw new Error('Invalid conversation upload receipt');
|
|
107
|
+
console.log(JSON.stringify(receipt, null, opts.json ? 2 : undefined));
|
|
108
|
+
}
|
|
109
|
+
catch (e) {
|
|
110
|
+
const error = e instanceof Error ? e.message : 'Conversation upload failed';
|
|
111
|
+
if (opts.json)
|
|
112
|
+
console.log(JSON.stringify({ error }));
|
|
113
|
+
else
|
|
114
|
+
console.error(error);
|
|
115
|
+
process.exitCode = 1;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { collectionList } from "../collection-list.js";
|
|
2
|
+
import { resolveHostNamespace } from '../hosts/inventory.js';
|
|
3
|
+
import { connection, gatewayFor, readSession, requestJson, sessionPath, validateSessionInput } from './api.js';
|
|
4
|
+
import { attachSession, requireTerminal } from './transport.js';
|
|
5
|
+
import { attachmentKind, managedOperation, stopGuard } from './managed.js';
|
|
6
|
+
import { syncTarget } from './sync.js';
|
|
7
|
+
import { registerSessionConversation } from './conversation.js';
|
|
8
|
+
import { registerSessionAffiliations } from './affiliation.js';
|
|
9
|
+
import { registerSessionControl } from './control.js';
|
|
10
|
+
const cell = (value) => value.replace(/[\x00-\x1f\x7f-\x9f]/g, ' ');
|
|
11
|
+
const summary = (s) => `${cell(s.id)} ${cell(s.name)}\n ${cell(s.username)}@${cell(s.machineId)} ${cell(s.cwd)}\n ${s.provider === 'claude' ? 'Claude' : 'Codex'} ${cell(s.codexSessionId)}${s.runState ? ` · ${cell(s.runState)}` : ''}`;
|
|
12
|
+
const runtimeSummary = (s, r) => `${summary(s)}\n Runtime: ${r.kind === 'direct' ? 'Direct' : `tmux ${cell(s.tmuxSession)}`}\n State: ${r.status}${r.reason ? ` (${r.reason})` : ''} · managed: ${r.managed ? 'yes' : 'no'} · viewers: ${r.clients ?? 'unknown'}\n Observed: ${r.observedAt}${r.pane ? ` · pane ${r.pane.id} · PID ${r.pane.pid}` : ''}`;
|
|
13
|
+
const openingMessage = (id, kind) => kind === 'direct'
|
|
14
|
+
? `Opening session ${id} directly. Ctrl-] disconnects; disconnecting may end the process. Use sessions open to resume explicitly.`
|
|
15
|
+
: `Opening session ${id}. Ctrl-] detaches; reopen the same ID to reattach.`;
|
|
16
|
+
export function registerSessionsCommand(program) {
|
|
17
|
+
const group = program.command('sessions').description('save and reopen agent terminal sessions on an explicitly selected enrolled host');
|
|
18
|
+
registerSessionAffiliations(group);
|
|
19
|
+
registerSessionConversation(group);
|
|
20
|
+
registerSessionControl(group);
|
|
21
|
+
const common = (c) => c.option('--namespace <namespace>', 'personal namespace (default: signed-in personal namespace)');
|
|
22
|
+
const gateway = (c) => c.option('--gateway <url>', 'explicit terminal gateway HTTPS origin; requires --origin').option('--origin <url>', 'allowed web origin for the selected gateway');
|
|
23
|
+
const target = (c) => c.requiredOption('--target <id>', 'exact target ID from sessions targets').option('--enrollment <id>', 'pin exact enrollment ID (default: discover the selected target enrollment)').requiredOption('--cwd <path>', 'absolute working directory on the target host').option('--name <name>', 'readable session name').option('--provider <provider>', 'agent tool: codex (default) or claude').option('--claude-config-dir <path>', 'absolute Claude configuration root on the target host');
|
|
24
|
+
const run = async (opts, operation) => {
|
|
25
|
+
try {
|
|
26
|
+
await operation();
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
const message = error instanceof Error ? error.message : 'Terminal session operation failed';
|
|
30
|
+
if (opts.json)
|
|
31
|
+
console.log(JSON.stringify({ status: 'error', error: message }));
|
|
32
|
+
else
|
|
33
|
+
console.error(message);
|
|
34
|
+
process.exitCode = 1;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
group.command('register').description('register native session metadata without an enrolled host or terminal launch')
|
|
38
|
+
.requiredOption('--provider <provider>', 'codex or claude').requiredOption('--session <uuid>', 'native conversation UUID')
|
|
39
|
+
.requiredOption('--cwd <path>', 'original absolute working directory').option('--name <name>')
|
|
40
|
+
.option('--visibility <visibility>', 'public (default for new sessions) or private').option('--json')
|
|
41
|
+
.action(opts => run(opts, async () => {
|
|
42
|
+
if (!['codex', 'claude'].includes(opts.provider) || !/^[a-f0-9-]{36}$/i.test(opts.session) || !opts.cwd.startsWith('/') ||
|
|
43
|
+
(opts.visibility !== undefined && !['public', 'private'].includes(opts.visibility)))
|
|
44
|
+
throw new Error('Use codex/claude, an exact native UUID, an absolute cwd, and public/private visibility');
|
|
45
|
+
const result = await requestJson(connection(), '/terminal-sessions/register', 'POST', { provider: opts.provider,
|
|
46
|
+
nativeSessionId: opts.session.toLowerCase(), cwd: opts.cwd, ...(opts.name ? { name: opts.name } : {}),
|
|
47
|
+
...(opts.visibility ? { visibility: opts.visibility } : {}) });
|
|
48
|
+
if (!result?.session?.id || result.session.codexSessionId !== opts.session.toLowerCase() || result.session.canManage !== true)
|
|
49
|
+
throw new Error('Invalid registration receipt');
|
|
50
|
+
console.log(JSON.stringify({ ...result, executed: false }, null, opts.json ? 2 : undefined));
|
|
51
|
+
}));
|
|
52
|
+
common(group.command('visibility <id>')).requiredOption('--visibility <visibility>', 'public or private').option('--json')
|
|
53
|
+
.action((id, opts) => run(opts, async () => {
|
|
54
|
+
if (!['public', 'private'].includes(opts.visibility))
|
|
55
|
+
throw new Error('Choose public or private');
|
|
56
|
+
const ns = await resolveHostNamespace(opts.namespace);
|
|
57
|
+
console.log(JSON.stringify(await requestJson(connection(), sessionPath(ns, id) + '/visibility', 'PATCH', { visibility: opts.visibility }), null, 2));
|
|
58
|
+
}));
|
|
59
|
+
gateway(common(group.command('targets').description('list authorized terminal target IDs and exact host enrollments'))).option('--json').action(opts => run(opts, async () => {
|
|
60
|
+
const ns = await resolveHostNamespace(opts.namespace), conn = connection(), endpoint = gatewayFor(conn.remote, opts);
|
|
61
|
+
const result = await requestJson(conn, `/namespaces/${encodeURIComponent(ns)}/terminal/targets`, 'GET', undefined, endpoint);
|
|
62
|
+
if (!Array.isArray(result?.targets))
|
|
63
|
+
throw new Error('Terminal API returned an invalid target list');
|
|
64
|
+
const targets = result.targets;
|
|
65
|
+
if (targets.some(t => !t || typeof t.id !== 'string' || typeof t.name !== 'string' || typeof t.username !== 'string' || typeof t.machineId !== 'string'))
|
|
66
|
+
throw new Error('Terminal API returned an invalid target');
|
|
67
|
+
console.log(opts.json ? JSON.stringify({ namespace: ns, targets }, null, 2) : targets.map(t => `${cell(t.id)} ${cell(t.name)} ${cell(t.username)}@${cell(t.machineId)}\n enrollment: ${cell(t.enrollmentId ?? 'unavailable (cannot save session)')}`).join('\n') || 'No available terminal targets.');
|
|
68
|
+
}));
|
|
69
|
+
common(collectionList(group, 'list').description('list saved descriptors; this does not probe or start remote processes'))
|
|
70
|
+
.option('--page-size <count>', 'bounded registry page size, 1–100')
|
|
71
|
+
.option('--cursor <cursor>', 'continue a registry page using its nextCursor')
|
|
72
|
+
.option('--query <text>', 'search saved session and repository metadata')
|
|
73
|
+
.option('--machine <id...>', 'filter exact machine IDs')
|
|
74
|
+
.option('--sort <order>', 'created or recent observed activity')
|
|
75
|
+
.option('--archived <mode>', 'exclude (default), include, or only archived sessions')
|
|
76
|
+
.option('--json').action(opts => run(opts, async () => {
|
|
77
|
+
if (opts.pageSize !== undefined && (!/^\d+$/.test(opts.pageSize) || Number(opts.pageSize) < 1 || Number(opts.pageSize) > 100))
|
|
78
|
+
throw new Error('--page-size must be 1–100');
|
|
79
|
+
if (opts.sort !== undefined && !['created', 'recent'].includes(opts.sort))
|
|
80
|
+
throw new Error('--sort must be created or recent');
|
|
81
|
+
if (opts.archived !== undefined && !['exclude', 'include', 'only'].includes(opts.archived))
|
|
82
|
+
throw new Error('--archived must be exclude, include or only');
|
|
83
|
+
if (opts.cursor !== undefined && (!/^[A-Za-z0-9_-]+$/.test(opts.cursor) || opts.cursor.length > 1024))
|
|
84
|
+
throw new Error('Use the registry nextCursor from sessions list');
|
|
85
|
+
if (opts.query !== undefined && (opts.query.length > 200 || /[\x00-\x1f\x7f]/.test(opts.query)))
|
|
86
|
+
throw new Error('--query must contain at most 200 printable characters');
|
|
87
|
+
if (opts.machine && (opts.machine.length > 32 || opts.machine.some((m) => !m || m.length > 512 || /[\x00-\x1f\x7f]/.test(m))))
|
|
88
|
+
throw new Error('Use up to 32 exact printable machine IDs');
|
|
89
|
+
const query = new URLSearchParams();
|
|
90
|
+
for (const [name, value] of [['pageSize', opts.pageSize], ['cursor', opts.cursor], ['q', opts.query], ['sort', opts.sort], ['archived', opts.archived]])
|
|
91
|
+
if (value !== undefined)
|
|
92
|
+
query.set(name, value);
|
|
93
|
+
for (const machine of opts.machine ?? [])
|
|
94
|
+
query.append('machineId', machine);
|
|
95
|
+
const ns = await resolveHostNamespace(opts.namespace), result = await requestJson(connection(), sessionPath(ns) + (query.size ? '?' + query.toString() : ''));
|
|
96
|
+
if (!Array.isArray(result?.sessions))
|
|
97
|
+
throw new Error('Terminal API returned an invalid session list');
|
|
98
|
+
const sessions = result.sessions.map(readSession);
|
|
99
|
+
const nextCursor = typeof result.nextCursor === 'string' && /^[A-Za-z0-9_-]{1,1024}$/.test(result.nextCursor) ? result.nextCursor : null;
|
|
100
|
+
console.log(opts.json ? JSON.stringify({ namespace: ns, sessions, hasMore: result.hasMore === true, nextCursor }, null, 2) : (sessions.map(summary).join('\n') || 'No saved terminal sessions.') + (result.hasMore === true ? `\nAdditional saved sessions exist.${nextCursor ? ` Continue with --cursor ${nextCursor} and the same filters/sort.` : ' Server did not return a continuation cursor.'}` : ''));
|
|
101
|
+
}));
|
|
102
|
+
common(group.command('show <id>').description('show one saved terminal descriptor')).option('--json').action((id, opts) => run(opts, async () => {
|
|
103
|
+
const ns = await resolveHostNamespace(opts.namespace), session = readSession((await requestJson(connection(), sessionPath(ns, id) + '/metadata')).session);
|
|
104
|
+
console.log(opts.json ? JSON.stringify({ session }, null, 2) : summary(session));
|
|
105
|
+
}));
|
|
106
|
+
const save = async (codexSessionId, opts, attach) => {
|
|
107
|
+
if (attach)
|
|
108
|
+
requireTerminal(); // Fail before any write when no terminal is present.
|
|
109
|
+
// Validate all user-supplied fields before any discovery request.
|
|
110
|
+
validateSessionInput({ targetId: opts.target, enrollmentId: opts.enrollment ?? '0'.repeat(24), cwd: opts.cwd, codexSessionId, ...(opts.provider === undefined ? {} : { provider: opts.provider }), ...(opts.claudeConfigDir === undefined ? {} : { claudeConfigDir: opts.claudeConfigDir }), ...(opts.name !== undefined ? { name: opts.name } : {}) });
|
|
111
|
+
const ns = await resolveHostNamespace(opts.namespace), conn = connection();
|
|
112
|
+
const endpoint = attach || !opts.enrollment ? gatewayFor(conn.remote, opts) : undefined;
|
|
113
|
+
let enrollmentId = opts.enrollment;
|
|
114
|
+
if (!enrollmentId) {
|
|
115
|
+
const catalog = await requestJson(conn, `/namespaces/${encodeURIComponent(ns)}/terminal/targets`, 'GET', undefined, endpoint);
|
|
116
|
+
if (!Array.isArray(catalog?.targets))
|
|
117
|
+
throw new Error('Terminal API returned an invalid target list');
|
|
118
|
+
const selected = catalog.targets.filter((t) => t?.id === opts.target);
|
|
119
|
+
if (selected.length !== 1 || typeof selected[0].enrollmentId !== 'string')
|
|
120
|
+
throw new Error('Selected target has no unique enrolled identity; inspect sessions targets');
|
|
121
|
+
enrollmentId = selected[0].enrollmentId;
|
|
122
|
+
}
|
|
123
|
+
const input = validateSessionInput({ targetId: opts.target, enrollmentId, cwd: opts.cwd, codexSessionId, ...(opts.provider === undefined ? {} : { provider: opts.provider }), ...(opts.claudeConfigDir === undefined ? {} : { claudeConfigDir: opts.claudeConfigDir }), ...(opts.name !== undefined ? { name: opts.name } : {}) });
|
|
124
|
+
if (opts.visibility !== undefined && !['public', 'private'].includes(opts.visibility))
|
|
125
|
+
throw new Error('Choose public or private visibility');
|
|
126
|
+
const session = readSession((await requestJson(conn, sessionPath(ns), 'POST', { ...input, ...(opts.visibility ? { visibility: opts.visibility } : {}) })).session);
|
|
127
|
+
if (session.targetId !== input.targetId || session.enrollmentId !== input.enrollmentId || session.cwd !== input.cwd || session.codexSessionId !== input.codexSessionId || (session.provider ?? 'codex') !== (input.provider ?? 'codex') || (session.claudeConfigDir ?? null) !== (input.claudeConfigDir ?? null))
|
|
128
|
+
throw new Error('Saved session does not match the requested host and conversation; no attachment attempted');
|
|
129
|
+
if (!attach)
|
|
130
|
+
console.log(opts.json ? JSON.stringify({ session, executed: false }, null, 2) : `${summary(session)}\nSaved. Open with: dreamlake sessions open ${session.id} --namespace ${ns}`);
|
|
131
|
+
else {
|
|
132
|
+
const kind = attachmentKind(await managedOperation(conn, endpoint, ns, session, 'start'));
|
|
133
|
+
console.error(openingMessage(session.id, kind));
|
|
134
|
+
await attachSession(conn, endpoint, ns, session, kind);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
gateway(target(common(group.command('create').description('save or find a matching session without starting it')))).option('--visibility <visibility>', 'public (new session default) or private').option('--session <uuid>', 'existing session UUID for the selected provider').option('--codex-session <uuid>', 'existing Codex session UUID (legacy alias)').option('--json').action(opts => run(opts, () => { if (opts.session && opts.codexSession && opts.session !== opts.codexSession)
|
|
138
|
+
throw new Error('Provide one session UUID'); return save(opts.session ?? opts.codexSession, opts, false); }));
|
|
139
|
+
gateway(target(common(group.command('resume <session-id>').description('save/find the exact agent session and attach; --json saves only')))).option('--json', 'save descriptor only; never start or attach to a process').action((id, opts) => run(opts, () => save(id, opts, !opts.json)));
|
|
140
|
+
gateway(common(group.command('open <id>').description('open an interactive terminal for a saved session; Ctrl-] detaches'))).action((id, opts) => run(opts, async () => {
|
|
141
|
+
requireTerminal();
|
|
142
|
+
const ns = await resolveHostNamespace(opts.namespace), conn = connection(), endpoint = gatewayFor(conn.remote, opts);
|
|
143
|
+
const session = readSession((await requestJson(conn, sessionPath(ns, id))).session);
|
|
144
|
+
const kind = attachmentKind(await managedOperation(conn, endpoint, ns, session, 'start'));
|
|
145
|
+
console.error(openingMessage(session.id, kind));
|
|
146
|
+
await attachSession(conn, endpoint, ns, session, kind);
|
|
147
|
+
}));
|
|
148
|
+
for (const action of ['status', 'start']) {
|
|
149
|
+
gateway(common(group.command(`${action} <id>`).description(action === 'status' ? 'observe the exact remote tmux runtime without starting it' : 'start persistent tmux when available, or check readiness for direct open'))).option('--json', 'print runtime JSON; start can execute a persistent process').action((id, opts) => run(opts, async () => {
|
|
150
|
+
const ns = await resolveHostNamespace(opts.namespace), conn = connection(), endpoint = gatewayFor(conn.remote, opts);
|
|
151
|
+
const session = readSession((await requestJson(conn, sessionPath(ns, id))).session);
|
|
152
|
+
const runtime = await managedOperation(conn, endpoint, ns, session, action);
|
|
153
|
+
const direct = runtime.kind === 'direct' && runtime.status === 'ready';
|
|
154
|
+
console.log(opts.json ? JSON.stringify({ session, runtime, ...(direct ? { executed: false } : {}) }, null, 2) : runtimeSummary(session, runtime) + (direct ? `\nDirect connection ready; no detached process started. Use sessions open ${session.id} --namespace ${ns}. Disconnecting may end the process.` : ''));
|
|
155
|
+
if (action === 'start' && !direct && (!['running', 'legacy'].includes(runtime.status) || !runtime.pane || runtime.pane.dead))
|
|
156
|
+
process.exitCode = 1;
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
gateway(common(group.command('reconnect <id>').description('attach only to an existing runtime; never start or restart it'))).action((id, opts) => run(opts, async () => {
|
|
160
|
+
requireTerminal();
|
|
161
|
+
const ns = await resolveHostNamespace(opts.namespace), conn = connection(), endpoint = gatewayFor(conn.remote, opts);
|
|
162
|
+
const session = readSession((await requestJson(conn, sessionPath(ns, id))).session);
|
|
163
|
+
console.error(`Reconnecting session ${session.id}. Ctrl-] detaches.`);
|
|
164
|
+
await attachSession(conn, endpoint, ns, session);
|
|
165
|
+
}));
|
|
166
|
+
gateway(common(group.command('stop <id>').description('stop the verified managed tmux runtime; preserve its saved descriptor and conversation'))).option('--yes', 'confirm stopping the remote program and disconnecting all its viewers').option('--json').action((id, opts) => run(opts, async () => {
|
|
167
|
+
if (!opts.yes)
|
|
168
|
+
throw new Error('Stopping ends the remote program for all viewers. Pass --yes to explicitly confirm');
|
|
169
|
+
const ns = await resolveHostNamespace(opts.namespace), conn = connection(), endpoint = gatewayFor(conn.remote, opts);
|
|
170
|
+
const session = readSession((await requestJson(conn, sessionPath(ns, id))).session);
|
|
171
|
+
const before = await managedOperation(conn, endpoint, ns, session, 'status');
|
|
172
|
+
const runtime = before.status === 'absent' ? before : await managedOperation(conn, endpoint, ns, session, 'stop', stopGuard(before));
|
|
173
|
+
if (runtime.status !== 'absent')
|
|
174
|
+
throw new Error('Terminal gateway did not verify the stopped runtime; inspect sessions status before retrying');
|
|
175
|
+
console.log(opts.json ? JSON.stringify({ session, runtime, stopped: before.status !== 'absent' }, null, 2) : `${runtimeSummary(session, runtime)}\n${before.status === 'absent' ? 'Already absent.' : 'Stopped. Saved session and conversation retained.'}`);
|
|
176
|
+
}));
|
|
177
|
+
gateway(common(group.command('sync').description('explicitly discover and save recent root Codex sessions; never launch terminals'))).option('--visibility <visibility>', 'public (new session default) or private')
|
|
178
|
+
.option('--target <id>', 'one exact authorized target to discover')
|
|
179
|
+
.option('--all', 'explicitly discover one bounded page on every available enrolled target')
|
|
180
|
+
.option('--enrollment <id>', 'pin the selected target enrollment (requires --target)')
|
|
181
|
+
.option('--cursor <cursor>', 'continue one selected target discovery snapshot (requires --target)')
|
|
182
|
+
.option('--json').action(opts => run(opts, async () => {
|
|
183
|
+
if (!!opts.target === !!opts.all || ((opts.cursor || opts.enrollment) && !opts.target))
|
|
184
|
+
throw new Error('Choose exactly one --target or --all; --cursor and --enrollment require --target');
|
|
185
|
+
const ns = await resolveHostNamespace(opts.namespace), conn = connection(), endpoint = gatewayFor(conn.remote, opts);
|
|
186
|
+
const catalog = await requestJson(conn, `/namespaces/${encodeURIComponent(ns)}/terminal/targets`, 'GET', undefined, endpoint);
|
|
187
|
+
if (!Array.isArray(catalog?.targets) || catalog.targets.length > 100)
|
|
188
|
+
throw new Error('Terminal API returned an invalid target list');
|
|
189
|
+
const targets = catalog.targets.filter((t) => opts.all ? t?.enrollmentId : t?.id === opts.target);
|
|
190
|
+
if (opts.target && (targets.length !== 1 || (opts.enrollment && targets[0].enrollmentId !== opts.enrollment)))
|
|
191
|
+
throw new Error('Select one exact authorized target and matching enrollment');
|
|
192
|
+
if (targets.some(t => !t || typeof t.id !== 'string' || typeof t.machineId !== 'string' || typeof t.username !== 'string' || typeof t.enrollmentId !== 'string' || !/^[a-f0-9]{24}$/.test(t.enrollmentId)))
|
|
193
|
+
throw new Error('Terminal API returned an invalid enrolled target');
|
|
194
|
+
const results = new Array(targets.length);
|
|
195
|
+
let next = 0;
|
|
196
|
+
if (opts.visibility !== undefined && !['public', 'private'].includes(opts.visibility))
|
|
197
|
+
throw new Error('Choose public or private visibility');
|
|
198
|
+
const worker = async () => { for (;;) {
|
|
199
|
+
const i = next++;
|
|
200
|
+
if (i >= targets.length)
|
|
201
|
+
return;
|
|
202
|
+
results[i] = await syncTarget(conn, endpoint, ns, targets[i], opts.cursor, opts.visibility);
|
|
203
|
+
} };
|
|
204
|
+
await Promise.all([worker(), worker()]);
|
|
205
|
+
if (results.some(r => r.status !== 'ok'))
|
|
206
|
+
process.exitCode = 1;
|
|
207
|
+
console.log(opts.json ? JSON.stringify({ namespace: ns, results, terminalLaunches: 0 }, null, 2) : results.map(r => `${cell(r.targetId)}: ${r.status} · ${r.savedIds.length}/${r.discovered} saved · ${r.metadataUpdated} observations updated${r.cached ? ' (cached)' : ''} · observed ${r.observedAt ?? 'unavailable'} (last ${r.lookbackDays} days)${r.partial ? ` · partial (${r.skippedCount} skipped, ${r.metadataOmittedCount} Git observations omitted)` : ''}${r.error ? `\n ${cell(r.error)}` : ''}${r.status === 'python_missing' ? '\n Python 3 is required on this machine; no package was installed.' : ''}${r.nextCursor ? `\n More results: sessions sync --target ${cell(r.targetId)} --namespace ${ns} --cursor ${r.nextCursor}` : ''}`).join('\n') || 'No available enrolled terminal targets.');
|
|
208
|
+
}));
|
|
209
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type Connection, type Gateway, type TerminalSession } from './api.js';
|
|
2
|
+
export interface ManagedRuntime {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
targetId: string;
|
|
5
|
+
enrollmentId: string;
|
|
6
|
+
tmuxSession: string;
|
|
7
|
+
observedAt: string;
|
|
8
|
+
status: 'absent' | 'running' | 'exited' | 'unavailable' | 'dependency_missing' | 'legacy' | 'ready';
|
|
9
|
+
kind?: 'tmux' | 'direct';
|
|
10
|
+
capabilities?: {
|
|
11
|
+
persistent: boolean;
|
|
12
|
+
canStop: boolean;
|
|
13
|
+
canShare: boolean;
|
|
14
|
+
};
|
|
15
|
+
managed: boolean;
|
|
16
|
+
generation: string | null;
|
|
17
|
+
pane: {
|
|
18
|
+
id: string;
|
|
19
|
+
pid: number;
|
|
20
|
+
dead: boolean;
|
|
21
|
+
exitStatus: number | null;
|
|
22
|
+
} | null;
|
|
23
|
+
clients: number | null;
|
|
24
|
+
dependencies: {
|
|
25
|
+
tmux: boolean;
|
|
26
|
+
codex: boolean | null;
|
|
27
|
+
};
|
|
28
|
+
reason?: string;
|
|
29
|
+
created?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare function readRuntime(value: any, session: TerminalSession): ManagedRuntime;
|
|
32
|
+
export declare function managedOperation(connection: Connection, gateway: Gateway, namespace: string, session: TerminalSession, action: 'status' | 'start' | 'stop', body?: object): Promise<ManagedRuntime>;
|
|
33
|
+
export declare function stopGuard(runtime: ManagedRuntime): {
|
|
34
|
+
generation: string;
|
|
35
|
+
paneId: string;
|
|
36
|
+
panePid: number;
|
|
37
|
+
};
|
|
38
|
+
export declare function requireRunning(runtime: ManagedRuntime): void;
|
|
39
|
+
export declare function attachmentKind(runtime: ManagedRuntime): 'tmux' | 'direct';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { requestJson, sessionPath } from './api.js';
|
|
2
|
+
export function readRuntime(value, session) {
|
|
3
|
+
const integer = (v, min) => Number.isSafeInteger(v) && v >= min;
|
|
4
|
+
if (!value || value.sessionId !== session.id || value.targetId !== session.targetId ||
|
|
5
|
+
value.enrollmentId !== session.enrollmentId || value.tmuxSession !== session.tmuxSession ||
|
|
6
|
+
typeof value.observedAt !== 'string' || !Number.isFinite(Date.parse(value.observedAt)) ||
|
|
7
|
+
!['absent', 'running', 'exited', 'unavailable', 'dependency_missing', 'legacy', 'ready'].includes(value.status) ||
|
|
8
|
+
!(value.kind === undefined || value.kind === 'tmux' || value.kind === 'direct') ||
|
|
9
|
+
!(value.capabilities === undefined || (typeof value.capabilities?.persistent === 'boolean' &&
|
|
10
|
+
typeof value.capabilities.canStop === 'boolean' && typeof value.capabilities.canShare === 'boolean')) ||
|
|
11
|
+
typeof value.managed !== 'boolean' ||
|
|
12
|
+
!(value.generation === null || (typeof value.generation === 'string' && /^[a-f0-9]{32}$/.test(value.generation))) ||
|
|
13
|
+
!(value.clients === null || integer(value.clients, 0)) ||
|
|
14
|
+
typeof value.dependencies?.tmux !== 'boolean' ||
|
|
15
|
+
!(value.dependencies.codex === null || typeof value.dependencies.codex === 'boolean') ||
|
|
16
|
+
!(value.pane === null || (typeof value.pane?.id === 'string' && /^%[0-9]{1,12}$/.test(value.pane.id) &&
|
|
17
|
+
integer(value.pane.pid, 1) && typeof value.pane.dead === 'boolean' &&
|
|
18
|
+
(value.pane.exitStatus === null || integer(value.pane.exitStatus, 0)))) ||
|
|
19
|
+
!(value.reason === undefined || ['tmux_missing', 'codex_missing', 'claude_missing', 'config_unavailable', 'cwd_unavailable', 'ownership_unverified',
|
|
20
|
+
'pane_identity_changed', 'session_absent', 'runtime_changed', 'runtime_unavailable', 'runtime_output_invalid'].includes(value.reason)) ||
|
|
21
|
+
!(value.created === undefined || typeof value.created === 'boolean')) {
|
|
22
|
+
throw new Error('Terminal gateway returned an invalid or mismatched managed runtime');
|
|
23
|
+
}
|
|
24
|
+
if ((value.managed && (!value.generation || !value.pane)) ||
|
|
25
|
+
(['running', 'exited', 'legacy'].includes(value.status) && !value.pane)) {
|
|
26
|
+
throw new Error('Terminal gateway returned an invalid or mismatched managed runtime');
|
|
27
|
+
}
|
|
28
|
+
// Direct readiness is a preflight only: it must never imply persistence,
|
|
29
|
+
// a detached process, or authority to stop/share a managed pane.
|
|
30
|
+
if (value.kind === 'direct' || value.status === 'ready') {
|
|
31
|
+
const validState = value.status === 'ready' ? value.reason === undefined && value.dependencies.codex === true :
|
|
32
|
+
value.status === 'dependency_missing' ? ['codex_missing', 'claude_missing'].includes(value.reason) && value.dependencies.codex === false :
|
|
33
|
+
value.status === 'unavailable' && ['cwd_unavailable', 'config_unavailable'].includes(value.reason) && value.dependencies.codex === true;
|
|
34
|
+
if (value.kind !== 'direct' || !validState || value.managed !== false ||
|
|
35
|
+
value.generation !== null || value.pane !== null || value.clients !== null || value.created !== false ||
|
|
36
|
+
value.capabilities?.persistent !== false || value.capabilities?.canStop !== false || value.capabilities?.canShare !== false) {
|
|
37
|
+
throw new Error('Terminal gateway returned an invalid direct runtime');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return { ...value, observedAt: new Date(value.observedAt).toISOString() };
|
|
41
|
+
}
|
|
42
|
+
export async function managedOperation(connection, gateway, namespace, session, action, body = {}) {
|
|
43
|
+
sessionPath(namespace, session.id); // Validate identifiers before constructing a gateway path.
|
|
44
|
+
const value = await requestJson(connection, `/namespaces/${encodeURIComponent(namespace)}/terminal/sessions/${session.id}/${action}`, 'POST', body, gateway);
|
|
45
|
+
return readRuntime(value?.runtime, session);
|
|
46
|
+
}
|
|
47
|
+
export function stopGuard(runtime) {
|
|
48
|
+
if (!runtime.managed || !runtime.generation || !runtime.pane || !['running', 'exited'].includes(runtime.status)) {
|
|
49
|
+
throw new Error('Cannot stop this runtime: managed ownership and an exact pane must be verified; inspect sessions status');
|
|
50
|
+
}
|
|
51
|
+
return { generation: runtime.generation, paneId: runtime.pane.id, panePid: runtime.pane.pid };
|
|
52
|
+
}
|
|
53
|
+
export function requireRunning(runtime) {
|
|
54
|
+
if (!['running', 'legacy'].includes(runtime.status) || !runtime.pane || runtime.pane.dead) {
|
|
55
|
+
throw new Error(`Terminal is ${runtime.status}${runtime.reason ? `: ${runtime.reason}` : ''}; inspect sessions status before retrying`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export function attachmentKind(runtime) {
|
|
59
|
+
if (runtime.kind === 'direct' && runtime.status === 'ready')
|
|
60
|
+
return 'direct';
|
|
61
|
+
requireRunning(runtime);
|
|
62
|
+
return 'tmux';
|
|
63
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Defense in depth for conversation publication. Never returns detected credential values. */
|
|
2
|
+
export function redactSessionText(text) {
|
|
3
|
+
return text
|
|
4
|
+
.replace(/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g, '[REDACTED PRIVATE KEY]')
|
|
5
|
+
.replace(/\b(?:Bearer|Basic)\s+[A-Za-z0-9+/_.=:-]+/gi, '[REDACTED AUTHORIZATION]')
|
|
6
|
+
.replace(/\b(?:sk-(?:proj-|ant-)?[A-Za-z0-9_-]{16,}|gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|(?:AKIA|ASIA)[A-Z0-9]{16}|xox[baprs]-[A-Za-z0-9-]{10,})\b/g, '[REDACTED TOKEN]')
|
|
7
|
+
.replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g, '[REDACTED JWT]')
|
|
8
|
+
.replace(/(\b(?:[A-Za-z0-9_-]{0,64}(?:api[_-]?key|access[_-]?key|secret|token|password|passwd|credential)[A-Za-z0-9_-]{0,64})["']?\s*(?:=|:)\s*)(?:"[^"\n]*"|'[^'\n]*'|[^\s,;&}\]]+)/gi, '$1[REDACTED]')
|
|
9
|
+
.replace(/(https?:\/\/)[^\s/@]+:[^\s/@]+@/gi, '$1[REDACTED]@')
|
|
10
|
+
.replace(/([?&](?:X-Amz-[^=&\s]+|sig|signature|key|token)=)[^&\s"']+/gi, '$1[REDACTED]');
|
|
11
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { type Provider } from './native.js';
|
|
2
|
+
export interface RunResult {
|
|
3
|
+
code: number | null;
|
|
4
|
+
signal?: NodeJS.Signals | null;
|
|
5
|
+
spawned?: boolean;
|
|
6
|
+
stdout: string;
|
|
7
|
+
stderr: string;
|
|
8
|
+
timedOut: boolean;
|
|
9
|
+
aborted: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface RunOptions {
|
|
12
|
+
cwd?: string;
|
|
13
|
+
timeoutMs?: number;
|
|
14
|
+
env?: NodeJS.ProcessEnv;
|
|
15
|
+
input?: string;
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
onStdout?: (chunk: string) => void;
|
|
18
|
+
}
|
|
19
|
+
export type Run = (command: string, args: string[], options?: RunOptions) => Promise<RunResult>;
|
|
20
|
+
/** Default process runner: own process group, bounded output and time, killable through `signal`. */
|
|
21
|
+
export declare const run: Run;
|
|
22
|
+
export declare class RunnerError extends Error {
|
|
23
|
+
readonly code: string;
|
|
24
|
+
readonly uncertain: boolean;
|
|
25
|
+
readonly checkpoint: Record<string, unknown>;
|
|
26
|
+
constructor(code: string, message?: string, uncertain?: boolean, checkpoint?: Record<string, unknown>);
|
|
27
|
+
}
|
|
28
|
+
export type PermissionLevel = 'read-only' | 'workspace-write' | 'full-access';
|
|
29
|
+
export declare function hasTmux(exec: Run): Promise<boolean>;
|
|
30
|
+
export declare function tmuxAlive(exec: Run, name: string): Promise<boolean>;
|
|
31
|
+
/** The owner marker is written by this runner at creation; a session with another or no marker is not ours to type into or kill. */
|
|
32
|
+
export declare const ownerMarker: (runnerKey: string, nativeSessionId: string) => string;
|
|
33
|
+
export declare function markOwnership(exec: Run, name: string, marker: string): Promise<void>;
|
|
34
|
+
export declare function verifyOwnership(exec: Run, name: string, marker: string): Promise<'absent' | 'owned' | 'foreign'>;
|
|
35
|
+
/** One message, pasted whole (bracketed) and submitted once; every step's exit code counts. */
|
|
36
|
+
export declare function tmuxSend(exec: Run, name: string, marker: string, text: string, signal?: AbortSignal): Promise<void>;
|
|
37
|
+
export declare function tmuxStop(exec: Run, name: string, marker: string): Promise<boolean>;
|
|
38
|
+
/** A fresh worktree next to the user's other DreamLake worktrees, never inside the source checkout. */
|
|
39
|
+
export declare function createWorktree(exec: Run, input: {
|
|
40
|
+
repo: string;
|
|
41
|
+
branch?: string;
|
|
42
|
+
baseRef?: string;
|
|
43
|
+
home: string;
|
|
44
|
+
signal?: AbortSignal;
|
|
45
|
+
checkpoint?: (value: Record<string, unknown>) => void;
|
|
46
|
+
}): Promise<{
|
|
47
|
+
path: string;
|
|
48
|
+
branch: string;
|
|
49
|
+
root: string;
|
|
50
|
+
}>;
|
|
51
|
+
export interface Launch {
|
|
52
|
+
provider: Provider;
|
|
53
|
+
cwd: string;
|
|
54
|
+
permissionLevel: PermissionLevel;
|
|
55
|
+
prompt?: string;
|
|
56
|
+
nativeSessionId?: string;
|
|
57
|
+
claudeConfigDir?: string | null;
|
|
58
|
+
codexRoot: string;
|
|
59
|
+
signal?: AbortSignal;
|
|
60
|
+
checkpoint?: (value: Record<string, unknown>) => void;
|
|
61
|
+
}
|
|
62
|
+
/** Headless: one provider turn that creates the session; the prompt travels on stdin. */
|
|
63
|
+
export declare function startHeadless(exec: Run, launch: Launch): Promise<{
|
|
64
|
+
nativeSessionId: string;
|
|
65
|
+
reply: string | null;
|
|
66
|
+
}>;
|
|
67
|
+
/** Interactive: a detached, owner-marked tmux session. Prompts sit behind `--`. */
|
|
68
|
+
export declare function startTmux(exec: Run, launch: Launch & {
|
|
69
|
+
marker: (nativeSessionId: string) => string;
|
|
70
|
+
}): Promise<{
|
|
71
|
+
nativeSessionId: string;
|
|
72
|
+
tmuxSession: string;
|
|
73
|
+
}>;
|
|
74
|
+
export interface Resume {
|
|
75
|
+
provider: Provider;
|
|
76
|
+
cwd: string;
|
|
77
|
+
nativeSessionId: string;
|
|
78
|
+
permissionLevel: PermissionLevel;
|
|
79
|
+
claudeConfigDir?: string | null;
|
|
80
|
+
prompt?: string;
|
|
81
|
+
marker: string;
|
|
82
|
+
signal?: AbortSignal;
|
|
83
|
+
checkpoint?: (value: Record<string, unknown>) => void;
|
|
84
|
+
}
|
|
85
|
+
/** Resume in tmux, re-applying the session's permission ceiling; a live session receives the prompt instead.
|
|
86
|
+
* Cancellation is honoured before and during the launch; a launch cancelled mid-way is torn down. */
|
|
87
|
+
export declare function resumeTmux(exec: Run, input: Resume): Promise<{
|
|
88
|
+
tmuxSession: string;
|
|
89
|
+
created: boolean;
|
|
90
|
+
delivered: boolean;
|
|
91
|
+
}>;
|
|
92
|
+
/** Headless message: one resumed turn under the session's permission ceiling; the text travels on stdin. */
|
|
93
|
+
export declare function sendHeadless(exec: Run, input: {
|
|
94
|
+
provider: Provider;
|
|
95
|
+
cwd: string;
|
|
96
|
+
nativeSessionId: string;
|
|
97
|
+
permissionLevel: PermissionLevel;
|
|
98
|
+
claudeConfigDir?: string | null;
|
|
99
|
+
text: string;
|
|
100
|
+
signal?: AbortSignal;
|
|
101
|
+
}): Promise<{
|
|
102
|
+
reply: string | null;
|
|
103
|
+
}>;
|
|
104
|
+
/** Someone (a person, another runner) is writing this conversation right now. */
|
|
105
|
+
export declare function nativeWriterBusy(transcriptPath: string | null, now?: number, windowMs?: number): boolean;
|
|
106
|
+
export declare function claudeReply(stdout: string): string | null;
|
|
107
|
+
export declare function codexThreadId(stdout: string): string | null;
|
|
108
|
+
export declare function codexReply(stdout: string): string | null;
|