@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,580 @@
|
|
|
1
|
+
// `dreamlake agents create` — author an agent and declare it.
|
|
2
|
+
//
|
|
3
|
+
// AN AGENT IS A NAME AND A PROMPT. That is the whole minimum, and the command
|
|
4
|
+
// is built around making that the easy case:
|
|
5
|
+
//
|
|
6
|
+
// dreamlake agents create triage --prompt 'You triage failed runs. …'
|
|
7
|
+
//
|
|
8
|
+
// Everything else is OPTIONAL and layered on when the agent earns it: Claude's
|
|
9
|
+
// `tools` / `model` / `permissions` when it should be constrained, a
|
|
10
|
+
// `run_config` when it needs a machine, `arguments` when its prompt has holes
|
|
11
|
+
// in it. An agent with none of those is not a degraded agent — it is the normal
|
|
12
|
+
// one.
|
|
13
|
+
//
|
|
14
|
+
// AN AGENT IS NOT A UDF. The two share a storage table and nothing else worth
|
|
15
|
+
// knowing. A UDF is addressed as `<module>.<qualname>` because it is *code* and
|
|
16
|
+
// that is where the code lives; an agent has a name, the way a person does. So
|
|
17
|
+
// the surface here is a plain name, scoped to the repository you are standing
|
|
18
|
+
// in, and the dotted form is an implementation detail printed once and then
|
|
19
|
+
// left alone. Nothing in this command asks you to think in module paths.
|
|
20
|
+
//
|
|
21
|
+
// WHY IT EXISTS WHEN `dreamlake declare` ALREADY POSTS RUNNABLES. `declare`
|
|
22
|
+
// takes a finished JSON object and posts it verbatim — the right shape for a
|
|
23
|
+
// payload a tool generated, the wrong shape for a page of prose a human is
|
|
24
|
+
// writing. This command takes the prose, from a file, a heredoc or $EDITOR,
|
|
25
|
+
// invents the identity, folds the flags in, and refuses the handful of mistakes
|
|
26
|
+
// that are only visible once the prompt and the spec are read together.
|
|
27
|
+
//
|
|
28
|
+
// WHAT IT WRITES. One row with `kind: "agent"`. `markdown` and `channel` are
|
|
29
|
+
// real columns; the Claude half beyond them (`tools`, `model`, `permissions`,
|
|
30
|
+
// `run_config`, `queue`, `grants`, `arguments`) has no columns and rides in
|
|
31
|
+
// `metadata`, which round-trips unchanged. That is the honest state of the
|
|
32
|
+
// server, not a preference.
|
|
33
|
+
//
|
|
34
|
+
// WHAT IT DOES NOT DO. It does not run anything. There is no agent API in the
|
|
35
|
+
// SDK and no agent route on the control plane; DreamLake stores declarations
|
|
36
|
+
// and the control plane is what would drive one.
|
|
37
|
+
import { spawnSync } from "node:child_process";
|
|
38
|
+
import { mkdtempSync, readFileSync, writeFileSync } from "node:fs";
|
|
39
|
+
import { tmpdir } from "node:os";
|
|
40
|
+
import path from "node:path";
|
|
41
|
+
import { HttpError, requestJson } from "../client.js";
|
|
42
|
+
import { resolveNamespace, resolveRemote, resolveToken } from "../config.js";
|
|
43
|
+
import { emitJson, fail, ok, warn } from "../helpers.js";
|
|
44
|
+
import { registerAgentManagement, projectSlugs, validateProjects, validateContext } from "./manage.js";
|
|
45
|
+
import { deriveName, deriveScope, snake } from "./identity.js";
|
|
46
|
+
import { ARGUMENT_TYPES, PERMISSION_MODES, SpecError, checkPermissionKeys, checkPlaceholders, parseAgentFile, parseArgumentFlag, parseChannelFlag, parseToolList, scanForCredentials, validateRules, } from "./spec.js";
|
|
47
|
+
// ─── the scaffold `--edit` opens ─────────────────────────────────────────────
|
|
48
|
+
//
|
|
49
|
+
// It is a complete, valid agent — not a set of TODOs — so that saving it
|
|
50
|
+
// unchanged produces something that declares cleanly. The commented lines are
|
|
51
|
+
// the fields most people want second.
|
|
52
|
+
const SCAFFOLD = `---
|
|
53
|
+
name: {{NAME}}
|
|
54
|
+
description: One line on WHEN to use this agent. Written for whatever is choosing between agents.
|
|
55
|
+
tools: [Read, Grep, Glob]
|
|
56
|
+
model: claude-opus-5
|
|
57
|
+
|
|
58
|
+
permissions:
|
|
59
|
+
allow: [Read(./**)]
|
|
60
|
+
deny: [Read(./.env), Read(./secrets/**), Bash(rm:*)]
|
|
61
|
+
defaultMode: default
|
|
62
|
+
|
|
63
|
+
# run_config: gpu-a10g # which machine it lands on
|
|
64
|
+
# queue: gpu-a10g
|
|
65
|
+
# arguments:
|
|
66
|
+
# - { name: target, type: string, required: true }
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
# {{NAME}}
|
|
70
|
+
|
|
71
|
+
Describe the job, the procedure, and the rules. This body IS the system prompt.
|
|
72
|
+
|
|
73
|
+
Reference an argument with a placeholder: the target is \`{{ target }}\`.
|
|
74
|
+
`;
|
|
75
|
+
// ─── shared context resolution ───────────────────────────────────────────────
|
|
76
|
+
async function ctx(nsFlag) {
|
|
77
|
+
const token = resolveToken();
|
|
78
|
+
if (!token) {
|
|
79
|
+
fail("not authenticated — run 'dreamlake login' first");
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
const remote = resolveRemote();
|
|
83
|
+
const ns = await resolveNamespace(nsFlag, { token, remote });
|
|
84
|
+
if (!ns) {
|
|
85
|
+
fail("could not resolve namespace — run 'dreamlake login' or pass --namespace");
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
return { token, remote, ns };
|
|
89
|
+
}
|
|
90
|
+
// ─── input ───────────────────────────────────────────────────────────────────
|
|
91
|
+
async function readStdin() {
|
|
92
|
+
const chunks = [];
|
|
93
|
+
for await (const chunk of process.stdin)
|
|
94
|
+
chunks.push(Buffer.from(chunk));
|
|
95
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Open $EDITOR on a scaffold and hand back what was saved.
|
|
99
|
+
*
|
|
100
|
+
* `stdio: "inherit"` is load-bearing: a terminal editor needs the real tty, and
|
|
101
|
+
* piping it produces a hung process with no cursor. An editor that exits
|
|
102
|
+
* non-zero means "I did not save that" and is treated as a cancel, not as a
|
|
103
|
+
* reason to post an empty agent.
|
|
104
|
+
*/
|
|
105
|
+
function editInEditor(seed) {
|
|
106
|
+
const editor = process.env.VISUAL || process.env.EDITOR;
|
|
107
|
+
if (!editor) {
|
|
108
|
+
fail("--edit needs $EDITOR (or $VISUAL) to be set — e.g. export EDITOR=vim");
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
const dir = mkdtempSync(path.join(tmpdir(), "dreamlake-agent-"));
|
|
112
|
+
const file = path.join(dir, "agent.md");
|
|
113
|
+
writeFileSync(file, seed, "utf8");
|
|
114
|
+
const res = spawnSync(editor, [file], { stdio: "inherit", shell: true });
|
|
115
|
+
if (res.status !== 0) {
|
|
116
|
+
fail(`editor exited with status ${res.status ?? "unknown"} — nothing was declared`);
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
return readFileSync(file, "utf8");
|
|
120
|
+
}
|
|
121
|
+
// ─── dreamlake agents create ─────────────────────────────────────────────────
|
|
122
|
+
export async function runAgentsCreate(positional, opts) {
|
|
123
|
+
try {
|
|
124
|
+
return await createAgent(positional, opts);
|
|
125
|
+
}
|
|
126
|
+
catch (err) {
|
|
127
|
+
if (err instanceof SpecError) {
|
|
128
|
+
fail(err.message);
|
|
129
|
+
return 1;
|
|
130
|
+
}
|
|
131
|
+
throw err;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async function createAgent(positional, opts) {
|
|
135
|
+
// ── 1 · where the prose comes from ──────────────────────────────────────
|
|
136
|
+
//
|
|
137
|
+
// Four sources, one precedence order, and at most one of them may be a
|
|
138
|
+
// stream. `--file -` and a pipe are the same thing spelled two ways, so both
|
|
139
|
+
// land here.
|
|
140
|
+
let text = null;
|
|
141
|
+
let origin = "flags";
|
|
142
|
+
if (opts.edit) {
|
|
143
|
+
if (opts.file || opts.prompt) {
|
|
144
|
+
fail("--edit cannot be combined with --file or --prompt — pick one source for the prompt");
|
|
145
|
+
return 1;
|
|
146
|
+
}
|
|
147
|
+
const seed = SCAFFOLD.replaceAll("{{NAME}}", positional?.trim() || "my-agent");
|
|
148
|
+
text = editInEditor(seed);
|
|
149
|
+
if (text === null)
|
|
150
|
+
return 1;
|
|
151
|
+
origin = "$EDITOR";
|
|
152
|
+
}
|
|
153
|
+
else if (opts.file === "-") {
|
|
154
|
+
text = opts.stdinText ?? (await readStdin());
|
|
155
|
+
origin = "stdin";
|
|
156
|
+
}
|
|
157
|
+
else if (opts.file) {
|
|
158
|
+
try {
|
|
159
|
+
text = readFileSync(path.resolve(opts.file), "utf8");
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
fail(`cannot read --file: ${opts.file}`);
|
|
163
|
+
return 1;
|
|
164
|
+
}
|
|
165
|
+
origin = opts.file;
|
|
166
|
+
}
|
|
167
|
+
else if (opts.prompt) {
|
|
168
|
+
text = opts.prompt;
|
|
169
|
+
origin = "--prompt";
|
|
170
|
+
}
|
|
171
|
+
else if (opts.stdinText !== undefined) {
|
|
172
|
+
text = opts.stdinText;
|
|
173
|
+
origin = "stdin";
|
|
174
|
+
}
|
|
175
|
+
else if (!process.stdin.isTTY) {
|
|
176
|
+
// A pipe with no --file is still a pipe. Reading it is what makes
|
|
177
|
+
// cat agent.md | dreamlake agents create
|
|
178
|
+
// behave the way every other CLI has taught people to expect.
|
|
179
|
+
text = await readStdin();
|
|
180
|
+
origin = "stdin";
|
|
181
|
+
}
|
|
182
|
+
if (text === null || text.trim().length === 0) {
|
|
183
|
+
fail("no prompt given. The body of an agent IS its system prompt, so there is nothing " +
|
|
184
|
+
"to declare without one.\n" +
|
|
185
|
+
" dreamlake agents create --edit # open $EDITOR on a scaffold\n" +
|
|
186
|
+
" dreamlake agents create --file agent.md # a Claude agent file\n" +
|
|
187
|
+
" dreamlake agents create --file - <<'AGENT' # a heredoc\n" +
|
|
188
|
+
" dreamlake agents create --prompt 'You triage failed runs. …'");
|
|
189
|
+
return 1;
|
|
190
|
+
}
|
|
191
|
+
const { frontmatter, body } = parseAgentFile(text);
|
|
192
|
+
const prompt = body.trim();
|
|
193
|
+
if (prompt.length === 0) {
|
|
194
|
+
fail("the file has frontmatter but no body. The body below the closing '---' is the " +
|
|
195
|
+
"system prompt, and an agent without one has no behaviour.");
|
|
196
|
+
return 1;
|
|
197
|
+
}
|
|
198
|
+
// ── 2 · merge frontmatter with flags. Flags win. ────────────────────────
|
|
199
|
+
//
|
|
200
|
+
// Scan the RAW frontmatter first, before any merge. The merge below is an
|
|
201
|
+
// allowlist, so a key it does not recognise never reaches the spec — and a
|
|
202
|
+
// credential parked under an unrecognised key would sail straight past a scan
|
|
203
|
+
// that only looked at the merged result.
|
|
204
|
+
scanForCredentials("frontmatter", frontmatter);
|
|
205
|
+
const fmSpec = frontmatter;
|
|
206
|
+
const description = opts.description?.trim() ||
|
|
207
|
+
(typeof fmSpec.description === "string" ? fmSpec.description.trim() : "");
|
|
208
|
+
const derivedName = deriveName({
|
|
209
|
+
positional,
|
|
210
|
+
flag: opts.name,
|
|
211
|
+
frontmatter: typeof fmSpec.name === "string" ? fmSpec.name : undefined,
|
|
212
|
+
description,
|
|
213
|
+
});
|
|
214
|
+
// The agent's identity is its NAME, scoped to the repository. The stored row
|
|
215
|
+
// still needs the two-segment form the table is keyed on, so it is derived
|
|
216
|
+
// here and printed once — but nothing above this line, and nothing a user
|
|
217
|
+
// types, is expressed as a module path. An agent is not code in a package.
|
|
218
|
+
const derived = deriveScope(opts.scope);
|
|
219
|
+
const scope = derived.scope;
|
|
220
|
+
const scopeSource = derived.source === "repo" ? `repo ${derived.root}` : derived.source;
|
|
221
|
+
const qualname = opts.qualname?.trim() || snake(derivedName.name);
|
|
222
|
+
const storedAs = `${scope}.${qualname}`;
|
|
223
|
+
const tools = parseToolList(opts.tools) ?? parseToolList(fmSpec.tools);
|
|
224
|
+
const model = opts.model?.trim() || (typeof fmSpec.model === "string" ? fmSpec.model : undefined);
|
|
225
|
+
// ── permissions ──
|
|
226
|
+
const fmPerms = (fmSpec.permissions ?? {});
|
|
227
|
+
if (fmSpec.permissions && typeof fmSpec.permissions === "object")
|
|
228
|
+
checkPermissionKeys(fmSpec.permissions);
|
|
229
|
+
const permissions = {};
|
|
230
|
+
const allow = [...(fmPerms.allow ?? []), ...(opts.allow ?? [])];
|
|
231
|
+
const ask = [...(fmPerms.ask ?? []), ...(opts.ask ?? [])];
|
|
232
|
+
const deny = [...(fmPerms.deny ?? []), ...(opts.deny ?? [])];
|
|
233
|
+
const addDirs = [...(fmPerms.additionalDirectories ?? []), ...(opts.addDir ?? [])];
|
|
234
|
+
const mode = opts.permissionMode?.trim() || fmPerms.defaultMode;
|
|
235
|
+
const warnings = [];
|
|
236
|
+
if (allow.length) {
|
|
237
|
+
warnings.push(...validateRules("allow", allow, tools));
|
|
238
|
+
permissions.allow = allow;
|
|
239
|
+
}
|
|
240
|
+
if (ask.length) {
|
|
241
|
+
warnings.push(...validateRules("ask", ask, tools));
|
|
242
|
+
permissions.ask = ask;
|
|
243
|
+
}
|
|
244
|
+
if (deny.length) {
|
|
245
|
+
warnings.push(...validateRules("deny", deny, tools));
|
|
246
|
+
permissions.deny = deny;
|
|
247
|
+
}
|
|
248
|
+
if (addDirs.length)
|
|
249
|
+
permissions.additionalDirectories = addDirs;
|
|
250
|
+
if (mode) {
|
|
251
|
+
if (!PERMISSION_MODES.includes(mode)) {
|
|
252
|
+
fail(`--permission-mode '${mode}' is not one of: ${PERMISSION_MODES.join(" | ")}`);
|
|
253
|
+
return 1;
|
|
254
|
+
}
|
|
255
|
+
permissions.defaultMode = mode;
|
|
256
|
+
}
|
|
257
|
+
// The trap that costs an afternoon: denying the destination while leaving the
|
|
258
|
+
// route open. A Bash rule matches the COMMAND STRING, not the effect.
|
|
259
|
+
const deniedPaths = deny.filter((r) => /^(Read|Edit|Write)\(/.test(r));
|
|
260
|
+
const bashAllowed = allow.some((r) => r === "Bash" || r.startsWith("Bash("));
|
|
261
|
+
if (deniedPaths.length > 0 && bashAllowed) {
|
|
262
|
+
warnings.push(`deny blocks ${deniedPaths.length} path rule(s) while allow permits Bash. A Bash rule ` +
|
|
263
|
+
`matches the command string, not the effect — Read(./.env) in deny does not stop ` +
|
|
264
|
+
`\`cat .env\`. Deny the route, not only the destination.`);
|
|
265
|
+
}
|
|
266
|
+
// ── arguments ──
|
|
267
|
+
const fmArgs = Array.isArray(fmSpec.arguments) ? fmSpec.arguments : [];
|
|
268
|
+
const flagArgs = (opts.arg ?? []).map(parseArgumentFlag);
|
|
269
|
+
const args = [...fmArgs];
|
|
270
|
+
for (const a of flagArgs) {
|
|
271
|
+
const at = args.findIndex((existing) => existing.name === a.name);
|
|
272
|
+
if (at === -1)
|
|
273
|
+
args.push(a);
|
|
274
|
+
else
|
|
275
|
+
args[at] = a;
|
|
276
|
+
}
|
|
277
|
+
for (const a of args) {
|
|
278
|
+
if (!ARGUMENT_TYPES.includes(a.type)) {
|
|
279
|
+
fail(`argument '${a.name}': type '${a.type}' is not one of ${ARGUMENT_TYPES.join(" | ")}`);
|
|
280
|
+
return 1;
|
|
281
|
+
}
|
|
282
|
+
if (a.required && "default" in a) {
|
|
283
|
+
fail(`argument '${a.name}' is required AND carries a default. One of those is a lie: ` +
|
|
284
|
+
`a default means the caller may omit it. Drop one.`);
|
|
285
|
+
return 1;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
const placeholders = checkPlaceholders(prompt, args);
|
|
289
|
+
warnings.push(...placeholders.warnings);
|
|
290
|
+
// ── channel ──
|
|
291
|
+
const channel = opts.channel
|
|
292
|
+
? parseChannelFlag(opts.channel)
|
|
293
|
+
: fmSpec.channel;
|
|
294
|
+
// ── 3 · assemble ────────────────────────────────────────────────────────
|
|
295
|
+
const spec = { spec: "claude/v1+lakeshore", name: derivedName.name };
|
|
296
|
+
if (tools)
|
|
297
|
+
spec.tools = tools;
|
|
298
|
+
if (model)
|
|
299
|
+
spec.model = model;
|
|
300
|
+
if (Object.keys(permissions).length > 0)
|
|
301
|
+
spec.permissions = permissions;
|
|
302
|
+
if (opts.runConfig?.trim() || fmSpec.run_config)
|
|
303
|
+
spec.run_config = opts.runConfig?.trim() || fmSpec.run_config;
|
|
304
|
+
if (opts.queue?.trim() || fmSpec.queue)
|
|
305
|
+
spec.queue = opts.queue?.trim() || fmSpec.queue;
|
|
306
|
+
const grants = [...(fmSpec.grants ?? []), ...(opts.grant ?? [])];
|
|
307
|
+
if (grants.length)
|
|
308
|
+
spec.grants = grants;
|
|
309
|
+
if (args.length)
|
|
310
|
+
spec.arguments = args;
|
|
311
|
+
const projects = projectSlugs(opts.project?.length ? opts.project : fmSpec.projects);
|
|
312
|
+
if (projects.length)
|
|
313
|
+
spec.projects = projects;
|
|
314
|
+
if (fmSpec.context !== undefined) {
|
|
315
|
+
validateContext(fmSpec.context);
|
|
316
|
+
spec.context = fmSpec.context;
|
|
317
|
+
}
|
|
318
|
+
// The server walks `channel` for credentials and nothing else, so everything
|
|
319
|
+
// under `metadata` is unguarded on the wire. Refuse locally.
|
|
320
|
+
scanForCredentials("agent", spec);
|
|
321
|
+
if (channel)
|
|
322
|
+
scanForCredentials("channel", channel);
|
|
323
|
+
const payload = {
|
|
324
|
+
module: scope,
|
|
325
|
+
qualname,
|
|
326
|
+
kind: "agent",
|
|
327
|
+
markdown: prompt,
|
|
328
|
+
metadata: { agent: spec },
|
|
329
|
+
};
|
|
330
|
+
if (description)
|
|
331
|
+
payload.description = description;
|
|
332
|
+
if (channel)
|
|
333
|
+
payload.channel = channel;
|
|
334
|
+
// ── 4 · print the target BEFORE the write ───────────────────────────────
|
|
335
|
+
//
|
|
336
|
+
// Same rule as `dreamlake declare`: if the operator is about to hit the wrong
|
|
337
|
+
// server, or is about to store a generated name they did not intend, the line
|
|
338
|
+
// that tells them has to come first.
|
|
339
|
+
const c = await ctx(opts.namespace);
|
|
340
|
+
if (!c)
|
|
341
|
+
return 1;
|
|
342
|
+
if (!opts.json) {
|
|
343
|
+
process.stdout.write(`agent ${derivedName.name}\n`);
|
|
344
|
+
process.stdout.write(` remote: ${c.remote}\n`);
|
|
345
|
+
process.stdout.write(` namespace: ${c.ns}\n`);
|
|
346
|
+
process.stdout.write(` scope: ${scope} (from ${scopeSource})\n`);
|
|
347
|
+
if (derivedName.source !== "argument" && derivedName.source !== "file") {
|
|
348
|
+
process.stdout.write(` agent name ${derivedName.source} — rename with --name\n`);
|
|
349
|
+
}
|
|
350
|
+
process.stdout.write(` prompt: ${prompt.length} characters, from ${origin}\n`);
|
|
351
|
+
process.stdout.write(` tools: ${tools && tools.length ? tools.join(", ") : "(omitted — Claude reads that as inherit all)"}\n`);
|
|
352
|
+
process.stdout.write(` permissions: ${allow.length} allow / ${ask.length} ask / ${deny.length} deny` +
|
|
353
|
+
` defaultMode=${permissions.defaultMode ?? "default"}\n`);
|
|
354
|
+
process.stdout.write(` run_config: ${spec.run_config ?? "—"} queue: ${spec.queue ?? "—"}\n`);
|
|
355
|
+
process.stdout.write(` arguments: ${args.length} declared, ${placeholders.used.length} substituted` +
|
|
356
|
+
`${placeholders.used.length ? ` (${placeholders.used.join(", ")})` : ""}\n`);
|
|
357
|
+
}
|
|
358
|
+
if (opts.dryRun) {
|
|
359
|
+
if (opts.json)
|
|
360
|
+
emitJson({ status: "dry-run", agentName: derivedName.name, storedAs, payload });
|
|
361
|
+
else {
|
|
362
|
+
for (const w of warnings)
|
|
363
|
+
warn(w);
|
|
364
|
+
process.stdout.write(" (dry run — nothing was posted)\n");
|
|
365
|
+
}
|
|
366
|
+
return 0;
|
|
367
|
+
}
|
|
368
|
+
await validateProjects(c, projects);
|
|
369
|
+
// ── 5 · write ───────────────────────────────────────────────────────────
|
|
370
|
+
const ifExists = opts.ifExists ?? "fail";
|
|
371
|
+
if (ifExists !== "ok" && ifExists !== "fail") {
|
|
372
|
+
fail(`--if-exists must be 'ok' or 'fail' (got '${ifExists}')`);
|
|
373
|
+
return 1;
|
|
374
|
+
}
|
|
375
|
+
try {
|
|
376
|
+
const created = await requestJson(c.remote, `/namespaces/${c.ns}/runnables`, { method: "POST", token: c.token, json: payload });
|
|
377
|
+
if (opts.json) {
|
|
378
|
+
emitJson({ status: "created", id: created?.id, agentName: derivedName.name, storedAs: created?.name ?? storedAs, agent: spec });
|
|
379
|
+
return 0;
|
|
380
|
+
}
|
|
381
|
+
ok(`declared agent ${derivedName.name}${created?.id ? ` (id ${created.id})` : ""}`);
|
|
382
|
+
for (const w of warnings)
|
|
383
|
+
warn(w);
|
|
384
|
+
process.stdout.write(` inspect it: dreamlake runnable show ${created?.name ?? storedAs}\n`);
|
|
385
|
+
process.stdout.write(" nothing runs it yet — there is no agent route on the control plane.\n");
|
|
386
|
+
return 0;
|
|
387
|
+
}
|
|
388
|
+
catch (err) {
|
|
389
|
+
if (err instanceof HttpError && err.status === 409) {
|
|
390
|
+
if (ifExists === "ok") {
|
|
391
|
+
if (opts.json)
|
|
392
|
+
emitJson({ status: "exists", agentName: derivedName.name, storedAs });
|
|
393
|
+
else
|
|
394
|
+
warn(`agent '${derivedName.name}' already exists here — nothing was overwritten`);
|
|
395
|
+
return 0;
|
|
396
|
+
}
|
|
397
|
+
fail(`an agent named '${derivedName.name}' already exists in this repo's scope ` +
|
|
398
|
+
`(stored as '${storedAs}' in namespace '${c.ns}'). Rows are create-only: pass ` +
|
|
399
|
+
`--if-exists ok to treat that as success, or give it a different name.`);
|
|
400
|
+
return 1;
|
|
401
|
+
}
|
|
402
|
+
if (err instanceof HttpError && err.status === 403) {
|
|
403
|
+
fail(`creating an agent needs runnable:create on namespace '${c.ns}' — READ is not enough`);
|
|
404
|
+
return 1;
|
|
405
|
+
}
|
|
406
|
+
if (err instanceof HttpError && err.status === 404) {
|
|
407
|
+
fail(`namespace '${c.ns}' not found on ${c.remote}`);
|
|
408
|
+
return 1;
|
|
409
|
+
}
|
|
410
|
+
fail(err.message);
|
|
411
|
+
return 1;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
// ─── registration ────────────────────────────────────────────────────────────
|
|
415
|
+
export function registerAgentsCommand(program) {
|
|
416
|
+
const agents = program
|
|
417
|
+
.command("agents")
|
|
418
|
+
.alias("agent")
|
|
419
|
+
.description("author agents — Claude's agent spec, plus a run config and typed arguments");
|
|
420
|
+
registerAgentManagement(agents);
|
|
421
|
+
agents
|
|
422
|
+
.command("create")
|
|
423
|
+
.description("declare an agent from a Claude agent file, a heredoc, or $EDITOR")
|
|
424
|
+
.argument("[name]", "the agent's name, kebab-case. Omit it and one is generated.")
|
|
425
|
+
// ── where the prose comes from ──
|
|
426
|
+
.option("--file <path>", "a Claude agent file: YAML frontmatter, then the prompt. '-' reads stdin.")
|
|
427
|
+
.option("--edit", "open $EDITOR on a scaffold and declare what you save")
|
|
428
|
+
.option("--prompt <text>", "the prompt inline, for one-liners")
|
|
429
|
+
// ── Claude's fields ──
|
|
430
|
+
.option("--name <kebab>", "the agent's name, if it is not in the file or the argument")
|
|
431
|
+
.option("--description <text>", "one line on WHEN to use this agent")
|
|
432
|
+
.option("--tools <csv>", "comma-separated tool list, e.g. Read,Grep,Glob,Bash. Omit to inherit all.")
|
|
433
|
+
.option("--model <id>", "model to run it on, e.g. claude-opus-5 (or an alias: opus | sonnet | haiku | inherit)")
|
|
434
|
+
.option("--allow <rule>", "permission rule that runs without asking (repeatable)", collect, [])
|
|
435
|
+
.option("--ask <rule>", "permission rule that pauses for confirmation (repeatable)", collect, [])
|
|
436
|
+
.option("--deny <rule>", "permission rule that is refused outright (repeatable)", collect, [])
|
|
437
|
+
.option("--add-dir <path>", "extra root the agent may read and write (repeatable)", collect, [])
|
|
438
|
+
.option("--permission-mode <mode>", `what happens to a call no rule matches: ${PERMISSION_MODES.join(" | ")}`)
|
|
439
|
+
// ── the extensions ──
|
|
440
|
+
.option("--run-config <name>", "ATTACH a RunConfig — the machine it lands on. Omit for a prompt-only agent.")
|
|
441
|
+
.option("--queue <name>", "the queue to submit on")
|
|
442
|
+
.option("--grant <string>", "a domain.resource.verb resource grant (repeatable)", collect, [])
|
|
443
|
+
.option("--arg <spec>", "a typed prompt argument, e.g. invocation_id:string! (repeatable)", collect, [])
|
|
444
|
+
.option("--channel <kind[:target]>", "the channel declaration, e.g. http-sse:/v1/agents/triage/stream")
|
|
445
|
+
// ── identity + write ──
|
|
446
|
+
.option("--scope <name>", "override the repo scope it is stored under (default: the repo you are in)")
|
|
447
|
+
.option("--qualname <name>", "override the stored leaf name (default: snake_case of the agent name)")
|
|
448
|
+
.option("--project <slug>", "affiliate with an existing project (repeatable; does not grant access)", collect, [])
|
|
449
|
+
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
450
|
+
.option("--if-exists <mode>", "what a 409 means: fail (default) | ok", "fail")
|
|
451
|
+
.option("--dry-run", "resolve, validate and print — send no request at all")
|
|
452
|
+
.option("--json", "emit JSON instead of prose")
|
|
453
|
+
.addHelpText("after", [
|
|
454
|
+
"",
|
|
455
|
+
"THE MINIMUM IS A NAME AND A PROMPT",
|
|
456
|
+
"",
|
|
457
|
+
" An agent is a prompt with a name. Nothing else is required, and an agent",
|
|
458
|
+
" with nothing else is the normal case, not a degraded one:",
|
|
459
|
+
"",
|
|
460
|
+
" dreamlake agents create triage --prompt 'You triage failed runs. Read the",
|
|
461
|
+
" terminal event first, classify the failure, quote the line that decided it.'",
|
|
462
|
+
"",
|
|
463
|
+
" Everything below is optional, added when the agent earns it.",
|
|
464
|
+
"",
|
|
465
|
+
"WRITING THE PROMPT IN THE TERMINAL",
|
|
466
|
+
"",
|
|
467
|
+
" A prompt longer than one line wants a quoted heredoc. Quote the delimiter —",
|
|
468
|
+
" <<'AGENT', not <<AGENT — or the shell expands $VARIABLES and backticks",
|
|
469
|
+
" inside your prose before the CLI ever sees it:",
|
|
470
|
+
"",
|
|
471
|
+
" dreamlake agents create triage --file - <<'AGENT'",
|
|
472
|
+
" # Run triage",
|
|
473
|
+
"",
|
|
474
|
+
" You triage failed invocations. Read the terminal event before the logs —",
|
|
475
|
+
" it says whether the worker died, the container exited, or the body raised,",
|
|
476
|
+
" and those three send you to different places.",
|
|
477
|
+
"",
|
|
478
|
+
" Quote the single log line that decided your classification. One line.",
|
|
479
|
+
" AGENT",
|
|
480
|
+
"",
|
|
481
|
+
" That file has no frontmatter and it does not need any. Add frontmatter when",
|
|
482
|
+
" you want to constrain the agent or give it a machine:",
|
|
483
|
+
"",
|
|
484
|
+
" dreamlake agents create --file - <<'AGENT'",
|
|
485
|
+
" ---",
|
|
486
|
+
" name: run-triage",
|
|
487
|
+
" description: Triages a failed invocation and proposes the smallest fix.",
|
|
488
|
+
" tools: [Read, Grep, Bash]",
|
|
489
|
+
" model: claude-opus-5",
|
|
490
|
+
" permissions:",
|
|
491
|
+
" allow: [Read(./runs/**), Bash(lakeshore logs:*)]",
|
|
492
|
+
" deny: [Read(./.env), Bash(rm:*)]",
|
|
493
|
+
" run_config: gpu-a10g",
|
|
494
|
+
" arguments:",
|
|
495
|
+
" - { name: invocation_id, type: string, required: true }",
|
|
496
|
+
" ---",
|
|
497
|
+
"",
|
|
498
|
+
" Triage invocation {{ invocation_id }}. Read its terminal event first.",
|
|
499
|
+
" AGENT",
|
|
500
|
+
"",
|
|
501
|
+
" Or let $EDITOR open a filled-in scaffold and declare what you save:",
|
|
502
|
+
"",
|
|
503
|
+
" dreamlake agents create run-triage --edit",
|
|
504
|
+
"",
|
|
505
|
+
" Or stay on one line, with each property as a flag:",
|
|
506
|
+
"",
|
|
507
|
+
" dreamlake agents create run-triage \\",
|
|
508
|
+
" --description 'Triages a failed invocation.' \\",
|
|
509
|
+
" --tools Read,Grep,Bash --model claude-opus-5 \\",
|
|
510
|
+
" --allow 'Read(./runs/**)' --deny 'Bash(rm:*)' \\",
|
|
511
|
+
" --run-config gpu-a10g --queue gpu-a10g \\",
|
|
512
|
+
" --arg 'invocation_id:string!' \\",
|
|
513
|
+
" --arg 'max_log_lines:integer=200' \\",
|
|
514
|
+
" --prompt 'Triage {{ invocation_id }}. Read at most {{ max_log_lines }} lines.'",
|
|
515
|
+
"",
|
|
516
|
+
" Quote every rule and every --arg. `Bash(npm run test:*)` contains a glob and",
|
|
517
|
+
" parentheses; unquoted, the shell gets there first.",
|
|
518
|
+
"",
|
|
519
|
+
"ATTACHING A RUN CONFIG",
|
|
520
|
+
"",
|
|
521
|
+
" A prompt-only agent needs no machine, and most do not. Attach one when the",
|
|
522
|
+
" agent has to run somewhere in particular — a GPU, a specific image, a",
|
|
523
|
+
" prepared host:",
|
|
524
|
+
"",
|
|
525
|
+
" dreamlake agents create colmap-driver --file agent.md \\",
|
|
526
|
+
" --run-config colmap-docker-gpu --queue colmap-gpu",
|
|
527
|
+
"",
|
|
528
|
+
" --run-config names an existing RunConfig by name; it is a reference, not a",
|
|
529
|
+
" copy, so the machine can be re-tuned without touching the agent. Placement",
|
|
530
|
+
" is then derived from that RunConfig's host key — there is no second field",
|
|
531
|
+
" where you say \"and this needs a GPU\".",
|
|
532
|
+
"",
|
|
533
|
+
"NAMING",
|
|
534
|
+
"",
|
|
535
|
+
" An agent has a name, not a module path — it is not a UDF and nothing here",
|
|
536
|
+
" asks you to think in packages. The name is scoped to the repository you are",
|
|
537
|
+
" standing in, so two repos can each hold a `triage` without colliding.",
|
|
538
|
+
"",
|
|
539
|
+
" dreamlake agents create triage # in dreamlake-starter-kit",
|
|
540
|
+
" → agent `triage`, scope `dreamlake_starter_kit`",
|
|
541
|
+
"",
|
|
542
|
+
" With no name at all, one is generated — from the description if there is",
|
|
543
|
+
" one, otherwise as `agent-<8 hex>`. The generated form is meant to look",
|
|
544
|
+
" generated, so it invites being renamed rather than being left forever.",
|
|
545
|
+
" Scope and name are both printed before anything is sent; override with",
|
|
546
|
+
" --scope / --qualname / --name.",
|
|
547
|
+
"",
|
|
548
|
+
"ARGUMENTS",
|
|
549
|
+
"",
|
|
550
|
+
" A {{ placeholder }} in the prompt must have a matching --arg or the create",
|
|
551
|
+
" is refused — a typo'd {{ invocaton_id }} must never reach a model as literal",
|
|
552
|
+
" braces. The mini-syntax:",
|
|
553
|
+
"",
|
|
554
|
+
" invocation_id:string! required",
|
|
555
|
+
" max_log_lines:integer=200 defaulted",
|
|
556
|
+
" verdict_detail:enum(terse|normal|forensic)=normal fixed set",
|
|
557
|
+
" dry_run:boolean=false",
|
|
558
|
+
"",
|
|
559
|
+
" `!` and `=` are mutually exclusive: required plus a default are two",
|
|
560
|
+
" statements that contradict each other.",
|
|
561
|
+
"",
|
|
562
|
+
"WHAT GETS STORED",
|
|
563
|
+
"",
|
|
564
|
+
" `markdown` and `channel` are real columns; `tools`, `model`, `permissions`,",
|
|
565
|
+
" `run_config`, `queue`, `grants` and `arguments` have none and ride in",
|
|
566
|
+
" `metadata`, which round-trips unchanged.",
|
|
567
|
+
"",
|
|
568
|
+
" The server walks `channel` for credentials at full depth and walks nothing",
|
|
569
|
+
" else, so a token under `metadata` would be stored in plaintext and returned",
|
|
570
|
+
" by GET. This command refuses one locally, because the server will not.",
|
|
571
|
+
"",
|
|
572
|
+
" Nothing runs the result. There is no agent API in the SDK and no agent route",
|
|
573
|
+
" on the control plane; DreamLake stores declarations.",
|
|
574
|
+
].join("\n"))
|
|
575
|
+
.action(async (name, opts) => process.exit(await runAgentsCreate(name, opts)));
|
|
576
|
+
}
|
|
577
|
+
/** Commander's repeatable-option accumulator. */
|
|
578
|
+
function collect(value, previous) {
|
|
579
|
+
return previous.concat([value]);
|
|
580
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
export type AgentRow = {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
kind: string;
|
|
6
|
+
markdown?: string | null;
|
|
7
|
+
description?: string | null;
|
|
8
|
+
channel?: unknown;
|
|
9
|
+
metadata?: Record<string, any> | null;
|
|
10
|
+
updatedAt: string;
|
|
11
|
+
};
|
|
12
|
+
export type AgentDraft = {
|
|
13
|
+
prompt: string;
|
|
14
|
+
parameters: Record<string, any>;
|
|
15
|
+
};
|
|
16
|
+
export type AgentContext = {
|
|
17
|
+
remote: string;
|
|
18
|
+
token: string;
|
|
19
|
+
ns: string;
|
|
20
|
+
};
|
|
21
|
+
export type ManageOptions = {
|
|
22
|
+
namespace?: string;
|
|
23
|
+
prefix?: string;
|
|
24
|
+
project?: string;
|
|
25
|
+
json?: boolean;
|
|
26
|
+
plain?: boolean;
|
|
27
|
+
web?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export declare const terminalText: (s: string) => string;
|
|
30
|
+
export declare function agentContext(namespace?: string): Promise<AgentContext>;
|
|
31
|
+
export declare function projectSlugs(value: unknown): string[];
|
|
32
|
+
export declare function validateContext(value: unknown): void;
|
|
33
|
+
export declare function validateProjects(c: AgentContext, projects: string[]): Promise<void>;
|
|
34
|
+
export declare function listAgents(c: AgentContext, opts: ManageOptions): Promise<AgentRow[]>;
|
|
35
|
+
export declare function resolveAgent(rows: AgentRow[], prefix: string): AgentRow;
|
|
36
|
+
export declare function draftOf(row: AgentRow): AgentDraft;
|
|
37
|
+
export declare function validateDraft(draft: AgentDraft): void;
|
|
38
|
+
export declare const agentFingerprint: (row: AgentRow) => string;
|
|
39
|
+
export declare function saveAgent(c: AgentContext, original: AgentRow, draft: AgentDraft): Promise<AgentRow>;
|
|
40
|
+
export declare function showAgent(row: AgentRow): void;
|
|
41
|
+
export declare function editAgent(c: AgentContext, row: AgentRow): Promise<void>;
|
|
42
|
+
export declare function runAgentsManage(action: "list" | "show" | "edit", prefix: string | undefined, opts: ManageOptions): Promise<number>;
|
|
43
|
+
export declare function registerAgentManagement(agents: Command): void;
|