@dreamlake/dreamlake-cli 0.111.2 → 0.112.1
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/skills.js +1 -1
- package/dist/cli/agents/index.js +20 -20
- package/dist/cli/agents/manage.js +1 -1
- package/dist/cli/artifact/index.js +5 -5
- package/dist/cli/artifact/meta.js +1 -1
- package/dist/cli/auth/commands.d.ts +2 -2
- package/dist/cli/auth/commands.js +9 -9
- package/dist/cli/auth/device-flow.js +2 -2
- package/dist/cli/auth/materialized.d.ts +1 -1
- package/dist/cli/auth/materialized.js +1 -1
- package/dist/cli/compat/http.js +2 -2
- package/dist/cli/compat/presignedTransfer.js +2 -2
- package/dist/cli/config.js +2 -2
- package/dist/cli/connection/index.js +8 -8
- package/dist/cli/connection/oauth.js +3 -3
- package/dist/cli/connection/write.js +6 -6
- package/dist/cli/create/index.js +2 -2
- package/dist/cli/declare/index.js +14 -14
- package/dist/cli/delete/index.js +4 -4
- package/dist/cli/download/index.js +3 -3
- package/dist/cli/env/compose.js +1 -1
- package/dist/cli/env/index.js +9 -9
- package/dist/cli/experiments/index.js +2 -2
- package/dist/cli/experiments/native-commands.js +1 -1
- package/dist/cli/experiments/native-run-data.js +1 -1
- package/dist/cli/graphql.js +1 -1
- package/dist/cli/help-examples.generated.js +253 -253
- package/dist/cli/hosts/bootstrap-source.d.ts +1 -1
- package/dist/cli/hosts/bootstrap-source.js +1 -1
- package/dist/cli/hosts/inventory.js +2 -2
- package/dist/cli/hosts/picker.js +2 -2
- package/dist/cli/hosts/ssh.js +1 -1
- package/dist/cli/hosts/upgrade.d.ts +2 -2
- package/dist/cli/hosts/upgrade.js +3 -3
- package/dist/cli/index.js +7 -3
- package/dist/cli/lakeshore/connections.js +1 -1
- package/dist/cli/lakeshore/index.d.ts +1 -1
- package/dist/cli/lakeshore/index.js +4 -4
- package/dist/cli/launch/index.js +10 -10
- package/dist/cli/library/add.js +4 -4
- package/dist/cli/library/cache.js +1 -1
- package/dist/cli/library/discover.js +1 -1
- package/dist/cli/library/freshness.js +1 -1
- package/dist/cli/library/index.js +1 -1
- package/dist/cli/library/info.js +1 -1
- package/dist/cli/library/manifest.js +1 -1
- package/dist/cli/library/pull.js +1 -1
- package/dist/cli/library/push.js +2 -2
- package/dist/cli/library/rm.js +2 -2
- package/dist/cli/library/search.js +2 -2
- package/dist/cli/library/stat.js +1 -1
- package/dist/cli/library/tools.js +1 -1
- package/dist/cli/library/wire.js +1 -1
- package/dist/cli/list/index.js +4 -4
- package/dist/cli/memos/document.d.ts +1 -1
- package/dist/cli/memos/document.js +1 -1
- package/dist/cli/memos/edit-commands.d.ts +2 -2
- package/dist/cli/memos/edit-commands.js +2 -2
- package/dist/cli/memos/files-commands.d.ts +1 -1
- package/dist/cli/memos/files-commands.js +2 -2
- package/dist/cli/memos/index.js +7 -7
- package/dist/cli/memos/media-commands.js +1 -1
- package/dist/cli/memos/move-command.js +2 -2
- package/dist/cli/memos/rm-command.d.ts +1 -1
- package/dist/cli/memos/rm-command.js +2 -2
- package/dist/cli/namespace.js +2 -2
- package/dist/cli/nymph/index.js +4 -4
- package/dist/cli/ownership/index.js +1 -1
- package/dist/cli/ownership/metadata-transfer.js +2 -2
- package/dist/cli/page/index.js +5 -5
- package/dist/cli/pipeline/index.js +5 -5
- package/dist/cli/project/attachments.js +1 -1
- package/dist/cli/project/grants.js +1 -1
- package/dist/cli/project/index.js +1 -1
- package/dist/cli/project/move.js +3 -3
- package/dist/cli/project/stream.js +2 -2
- package/dist/cli/provider/dreamdir.js +2 -2
- package/dist/cli/provider/index.js +18 -18
- package/dist/cli/provider/lifecycle.js +14 -14
- package/dist/cli/python.js +4 -4
- package/dist/cli/queues/index.js +4 -4
- package/dist/cli/queues/slurm.js +2 -2
- package/dist/cli/resources.js +2 -2
- package/dist/cli/run/index.js +1 -1
- package/dist/cli/runconfig/index.js +3 -3
- package/dist/cli/runnable/bound.js +3 -3
- package/dist/cli/runnable/index.js +14 -14
- package/dist/cli/runnable/path.d.ts +1 -1
- package/dist/cli/runnable/path.js +1 -1
- package/dist/cli/self-update/alias-migration.d.ts +11 -0
- package/dist/cli/self-update/alias-migration.js +56 -0
- package/dist/cli/self-update/index.d.ts +1 -1
- package/dist/cli/self-update/index.js +5 -5
- package/dist/cli/self-update/install.js +2 -2
- package/dist/cli/self-update/update.d.ts +1 -1
- package/dist/cli/self-update/update.js +7 -7
- package/dist/cli/session-affiliation.js +1 -1
- package/dist/cli/sessions/control.d.ts +1 -1
- package/dist/cli/sessions/control.js +2 -2
- package/dist/cli/sessions/index.js +5 -5
- package/dist/cli/sessions/live.js +1 -1
- package/dist/cli/sessions/runner/serve.js +1 -1
- package/dist/cli/sessions/wrap.d.ts +2 -2
- package/dist/cli/sessions/wrap.js +8 -8
- package/dist/cli/skill/index.js +22 -22
- package/dist/cli/skill/prefs.js +1 -1
- package/dist/cli/skill/read.js +3 -3
- package/dist/cli/skill/registry.js +2 -2
- package/dist/cli/snapshot/index.js +9 -9
- package/dist/cli/source/access.js +3 -3
- package/dist/cli/source/control.js +8 -8
- package/dist/cli/source/delete.js +6 -6
- package/dist/cli/source/index.js +14 -14
- package/dist/cli/source/share.js +8 -8
- package/dist/cli/source/upload.d.ts +1 -1
- package/dist/cli/source/upload.js +2 -2
- package/dist/cli/source/write.js +2 -2
- package/dist/cli/spawn.js +1 -1
- package/dist/cli/tasks/index.js +1 -1
- package/dist/cli/update/index.js +2 -2
- package/dist/cli/upload/index.js +3 -3
- package/dist/cli/upload/multipart.js +1 -1
- package/dist/cli/vault/index.js +1 -1
- package/dist/cli/vault/sshSync.js +1 -1
- package/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/dist/cli/workflow/index.d.ts +1 -1
- package/dist/cli/workflow/index.js +6 -6
- package/package.json +10 -10
package/dist/api/skills.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Skills registry: the server's pinned dreamlake-skills bundle, read-only.
|
|
2
2
|
*
|
|
3
3
|
* One business operation shared by three surfaces — `client.skills.read`,
|
|
4
|
-
* `
|
|
4
|
+
* `dl skill read` and the built-in agent's `dreamlake_skills_read` —
|
|
5
5
|
* with the same inputs, the same output fields and the same error codes.
|
|
6
6
|
* Every answer carries the bundle's `{ tag, commit }` so a caller can say
|
|
7
7
|
* which revision it read, and every content hash is verified against the
|
package/dist/cli/agents/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// `
|
|
1
|
+
// `dl agents create` — author an agent and declare it.
|
|
2
2
|
//
|
|
3
3
|
// AN AGENT IS A NAME AND A PROMPT. That is the whole minimum, and the command
|
|
4
4
|
// is built around making that the easy case:
|
|
5
5
|
//
|
|
6
|
-
//
|
|
6
|
+
// dl agents create triage --prompt 'You triage failed runs. …'
|
|
7
7
|
//
|
|
8
8
|
// Everything else is OPTIONAL and layered on when the agent earns it: Claude's
|
|
9
9
|
// `tools` / `model` / `permissions` when it should be constrained, a
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
// in, and the dotted form is an implementation detail printed once and then
|
|
19
19
|
// left alone. Nothing in this command asks you to think in module paths.
|
|
20
20
|
//
|
|
21
|
-
// WHY IT EXISTS WHEN `
|
|
21
|
+
// WHY IT EXISTS WHEN `dl declare` ALREADY POSTS RUNNABLES. `declare`
|
|
22
22
|
// takes a finished JSON object and posts it verbatim — the right shape for a
|
|
23
23
|
// payload a tool generated, the wrong shape for a page of prose a human is
|
|
24
24
|
// writing. This command takes the prose, from a file, a heredoc or $EDITOR,
|
|
@@ -75,13 +75,13 @@ Reference an argument with a placeholder: the target is \`{{ target }}\`.
|
|
|
75
75
|
async function ctx(nsFlag) {
|
|
76
76
|
const token = resolveToken();
|
|
77
77
|
if (!token) {
|
|
78
|
-
fail("not authenticated — run '
|
|
78
|
+
fail("not authenticated — run 'dl login' first");
|
|
79
79
|
return null;
|
|
80
80
|
}
|
|
81
81
|
const remote = resolveRemote();
|
|
82
82
|
const ns = await resolveNamespace(nsFlag, { token, remote });
|
|
83
83
|
if (!ns) {
|
|
84
|
-
fail("could not resolve namespace — run '
|
|
84
|
+
fail("could not resolve namespace — run 'dl login' or pass --namespace");
|
|
85
85
|
return null;
|
|
86
86
|
}
|
|
87
87
|
return { token, remote, ns };
|
|
@@ -117,7 +117,7 @@ function editInEditor(seed) {
|
|
|
117
117
|
}
|
|
118
118
|
return readFileSync(file, "utf8");
|
|
119
119
|
}
|
|
120
|
-
// ───
|
|
120
|
+
// ─── dl agents create ─────────────────────────────────────────────────
|
|
121
121
|
export async function runAgentsCreate(positional, opts) {
|
|
122
122
|
try {
|
|
123
123
|
return await createAgent(positional, opts);
|
|
@@ -179,7 +179,7 @@ async function createAgent(positional, opts) {
|
|
|
179
179
|
}
|
|
180
180
|
else if (!process.stdin.isTTY) {
|
|
181
181
|
// A pipe with no --file is still a pipe. Reading it is what makes
|
|
182
|
-
// cat agent.md |
|
|
182
|
+
// cat agent.md | dl agents create
|
|
183
183
|
// behave the way every other CLI has taught people to expect.
|
|
184
184
|
text = await readStdin();
|
|
185
185
|
origin = "stdin";
|
|
@@ -187,10 +187,10 @@ async function createAgent(positional, opts) {
|
|
|
187
187
|
if (text === null || text.trim().length === 0) {
|
|
188
188
|
fail("no prompt given. The body of an agent IS its system prompt, so there is nothing " +
|
|
189
189
|
"to declare without one.\n" +
|
|
190
|
-
"
|
|
191
|
-
"
|
|
192
|
-
"
|
|
193
|
-
"
|
|
190
|
+
" dl agents create --edit # open $EDITOR on a scaffold\n" +
|
|
191
|
+
" dl agents create --file agent.md # a Claude agent file\n" +
|
|
192
|
+
" dl agents create --file - <<'AGENT' # a heredoc\n" +
|
|
193
|
+
" dl agents create --prompt 'You triage failed runs. …'");
|
|
194
194
|
return 1;
|
|
195
195
|
}
|
|
196
196
|
const { frontmatter, body } = parseAgentFile(text);
|
|
@@ -338,7 +338,7 @@ async function createAgent(positional, opts) {
|
|
|
338
338
|
payload.channel = channel;
|
|
339
339
|
// ── 4 · print the target BEFORE the write ───────────────────────────────
|
|
340
340
|
//
|
|
341
|
-
// Same rule as `
|
|
341
|
+
// Same rule as `dl declare`: if the operator is about to hit the wrong
|
|
342
342
|
// server, or is about to store a generated name they did not intend, the line
|
|
343
343
|
// that tells them has to come first.
|
|
344
344
|
const c = await ctx(opts.namespace);
|
|
@@ -386,7 +386,7 @@ async function createAgent(positional, opts) {
|
|
|
386
386
|
ok(`declared agent ${derivedName.name}${created?.id ? ` (id ${created.id})` : ""}`);
|
|
387
387
|
for (const w of warnings)
|
|
388
388
|
warn(w);
|
|
389
|
-
process.stdout.write(` inspect it:
|
|
389
|
+
process.stdout.write(` inspect it: dl runnable show ${created?.name ?? storedAs}\n`);
|
|
390
390
|
process.stdout.write(" nothing runs it yet — there is no agent route on the control plane.\n");
|
|
391
391
|
return 0;
|
|
392
392
|
}
|
|
@@ -574,7 +574,7 @@ export function registerAgentsCommand(program) {
|
|
|
574
574
|
" An agent is a prompt with a name. Nothing else is required, and an agent",
|
|
575
575
|
" with nothing else is the normal case, not a degraded one:",
|
|
576
576
|
"",
|
|
577
|
-
"
|
|
577
|
+
" dl agents create triage --prompt 'You triage failed runs. Read the",
|
|
578
578
|
" terminal event first, classify the failure, quote the line that decided it.'",
|
|
579
579
|
"",
|
|
580
580
|
" Everything below is optional, added when the agent earns it.",
|
|
@@ -585,7 +585,7 @@ export function registerAgentsCommand(program) {
|
|
|
585
585
|
" <<'AGENT', not <<AGENT — or the shell expands $VARIABLES and backticks",
|
|
586
586
|
" inside your prose before the CLI ever sees it:",
|
|
587
587
|
"",
|
|
588
|
-
"
|
|
588
|
+
" dl agents create triage --file - <<'AGENT'",
|
|
589
589
|
" # Run triage",
|
|
590
590
|
"",
|
|
591
591
|
" You triage failed invocations. Read the terminal event before the logs —",
|
|
@@ -598,7 +598,7 @@ export function registerAgentsCommand(program) {
|
|
|
598
598
|
" That file has no frontmatter and it does not need any. Add frontmatter when",
|
|
599
599
|
" you want to constrain the agent or give it a machine:",
|
|
600
600
|
"",
|
|
601
|
-
"
|
|
601
|
+
" dl agents create --file - <<'AGENT'",
|
|
602
602
|
" ---",
|
|
603
603
|
" name: run-triage",
|
|
604
604
|
" description: Triages a failed invocation and proposes the smallest fix.",
|
|
@@ -617,11 +617,11 @@ export function registerAgentsCommand(program) {
|
|
|
617
617
|
"",
|
|
618
618
|
" Or let $EDITOR open a filled-in scaffold and declare what you save:",
|
|
619
619
|
"",
|
|
620
|
-
"
|
|
620
|
+
" dl agents create run-triage --edit",
|
|
621
621
|
"",
|
|
622
622
|
" Or stay on one line, with each property as a flag:",
|
|
623
623
|
"",
|
|
624
|
-
"
|
|
624
|
+
" dl agents create run-triage \\",
|
|
625
625
|
" --description 'Triages a failed invocation.' \\",
|
|
626
626
|
" --tools Read,Grep,Bash --model claude-opus-5 \\",
|
|
627
627
|
" --allow 'Read(./runs/**)' --deny 'Bash(rm:*)' \\",
|
|
@@ -639,7 +639,7 @@ export function registerAgentsCommand(program) {
|
|
|
639
639
|
" agent has to run somewhere in particular — a GPU, a specific image, a",
|
|
640
640
|
" prepared host:",
|
|
641
641
|
"",
|
|
642
|
-
"
|
|
642
|
+
" dl agents create colmap-driver --file agent.md \\",
|
|
643
643
|
" --run-config colmap-docker-gpu --queue colmap-gpu",
|
|
644
644
|
"",
|
|
645
645
|
" --run-config names an existing RunConfig by name; it is a reference, not a",
|
|
@@ -653,7 +653,7 @@ export function registerAgentsCommand(program) {
|
|
|
653
653
|
" asks you to think in packages. The name is scoped to the repository you are",
|
|
654
654
|
" standing in, so two repos can each hold a `triage` without colliding.",
|
|
655
655
|
"",
|
|
656
|
-
"
|
|
656
|
+
" dl agents create triage # in dreamlake-starter-kit",
|
|
657
657
|
" → agent `triage`, scope `dreamlake_starter_kit`",
|
|
658
658
|
"",
|
|
659
659
|
" With no name at all, one is generated — from the description if there is",
|
|
@@ -12,7 +12,7 @@ const base = (c) => `/namespaces/${seg(c.ns)}/runnables`;
|
|
|
12
12
|
export async function agentContext(namespace) {
|
|
13
13
|
const token = resolveToken();
|
|
14
14
|
if (!token)
|
|
15
|
-
throw new Error("not authenticated — run '
|
|
15
|
+
throw new Error("not authenticated — run 'dl login' first");
|
|
16
16
|
const remote = resolveRemote();
|
|
17
17
|
const ns = await resolveNamespace(namespace, { token, remote });
|
|
18
18
|
if (!ns)
|
|
@@ -2,7 +2,7 @@ import { registerArtifactRenameCommand } from "./rename.js";
|
|
|
2
2
|
import { readSiteConfiguration } from './siteConfig.js';
|
|
3
3
|
import { collectionList } from "../collection-list.js";
|
|
4
4
|
import { registerShareCommands } from "../share.js";
|
|
5
|
-
// `
|
|
5
|
+
// `dl artifact push|list|delete|restore`.
|
|
6
6
|
//
|
|
7
7
|
// list / delete / restore are thin dreamlake-server REST calls.
|
|
8
8
|
// `push` writes the version itself: it brokers short-lived, prefix-scoped
|
|
@@ -17,7 +17,7 @@ import { collectSite, uploadSite } from "./site.js";
|
|
|
17
17
|
import { metaError, putArtifactCover, readCoverFile, registerArtifactMetaCommand } from "./meta.js";
|
|
18
18
|
// ../prompt.js, NOT @inquirer/prompts directly. This file used to import the
|
|
19
19
|
// inquirer prompt straight, which bypassed prompt.ts's `!process.stdin.isTTY`
|
|
20
|
-
// guard — so `
|
|
20
|
+
// guard — so `dl artifact delete <id>` without `-y` could block an agent
|
|
21
21
|
// or a CI job forever, waiting at a question nothing was ever going to answer.
|
|
22
22
|
// Every other confirmation in this CLI goes through the guarded wrapper.
|
|
23
23
|
import { confirm } from "../prompt.js";
|
|
@@ -312,7 +312,7 @@ export async function runDreamlakeArtifactPush(args, deps = {}) {
|
|
|
312
312
|
// same server — never the active login's, which may differ. A token
|
|
313
313
|
// passed explicitly is the one thing it cannot repeat for you.
|
|
314
314
|
const conn = `--remote ${shellQuote(ctx.remote)}${ctx.debug ? " --debug" : ""}${args.token ? " --token <the same --token>" : ""}`;
|
|
315
|
-
process.stderr.write(` re-run:
|
|
315
|
+
process.stderr.write(` re-run: dl artifact meta set ${shellQuote(artifactId)} --namespace ${shellQuote(namespace)} ${conn} --cover ${shellQuote(args.cover)}\n`);
|
|
316
316
|
return 1;
|
|
317
317
|
}
|
|
318
318
|
process.stdout.write(` cover: ${put.summary}\n`);
|
|
@@ -386,7 +386,7 @@ export async function runDreamlakeArtifactDelete(args, deps = {}) {
|
|
|
386
386
|
ok(`permanently deleted ${args.artifactId}${typeof n === "number" ? ` (${n} objects removed)` : ""}`);
|
|
387
387
|
}
|
|
388
388
|
else {
|
|
389
|
-
ok(`deleted ${args.artifactId} (restore with \`
|
|
389
|
+
ok(`deleted ${args.artifactId} (restore with \`dl artifact restore ${args.artifactId}\`)`);
|
|
390
390
|
}
|
|
391
391
|
return 0;
|
|
392
392
|
}
|
|
@@ -408,7 +408,7 @@ export async function runDreamlakeArtifactRestore(args) {
|
|
|
408
408
|
return 0;
|
|
409
409
|
}
|
|
410
410
|
// ─── append-local (pointer stub) ──────────────────────────────────────────────
|
|
411
|
-
// dreamlake-server's artifact Apply endpoint spawns `
|
|
411
|
+
// dreamlake-server's artifact Apply endpoint spawns `dl artifact
|
|
412
412
|
// append-local` expecting the CANONICAL Python writer (DreamDB has no TS
|
|
413
413
|
// writer). If PATH resolves to THIS CLI instead, answer on stdout with
|
|
414
414
|
// the same one-line JSON error contract the server parses, so the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// `
|
|
1
|
+
// `dl artifact meta show|set` — the description and cover image an
|
|
2
2
|
// artifact's link preview is built from (and that the list/gallery card
|
|
3
3
|
// shows), plus the helpers `artifact push --cover` shares with `set`.
|
|
4
4
|
//
|
|
@@ -8,11 +8,11 @@ export interface LoginArgs {
|
|
|
8
8
|
token?: string;
|
|
9
9
|
noNymph?: boolean;
|
|
10
10
|
}
|
|
11
|
-
/** Fallback env for `
|
|
11
|
+
/** Fallback env for `dl login` on a machine with nothing logged in yet. */
|
|
12
12
|
export declare const DEFAULT_LOGIN_ENV = "prod";
|
|
13
13
|
/**
|
|
14
14
|
* Which environment `login` targets: explicit --env, else the active one,
|
|
15
|
-
* else prod. A first-time user gets prod — someone typing `
|
|
15
|
+
* else prod. A first-time user gets prod — someone typing `dl login`
|
|
16
16
|
* means the real deployment, not staging.
|
|
17
17
|
*/
|
|
18
18
|
export declare function resolveLoginEnvName(explicit?: string, filePath?: string): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { afterLogin } from "../nymph/index.js";
|
|
2
2
|
import { identityMode, machineRead } from "./machine.js";
|
|
3
|
-
// `
|
|
3
|
+
// `dl login | logout | profile`.
|
|
4
4
|
//
|
|
5
5
|
// login: runs the device-authorization flow (default) or saves a token
|
|
6
6
|
// passed via --token (lakeshore-style escape hatch). On success the env
|
|
@@ -74,11 +74,11 @@ function openBrowser(url) {
|
|
|
74
74
|
// best-effort
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
/** Fallback env for `
|
|
77
|
+
/** Fallback env for `dl login` on a machine with nothing logged in yet. */
|
|
78
78
|
export const DEFAULT_LOGIN_ENV = "prod";
|
|
79
79
|
/**
|
|
80
80
|
* Which environment `login` targets: explicit --env, else the active one,
|
|
81
|
-
* else prod. A first-time user gets prod — someone typing `
|
|
81
|
+
* else prod. A first-time user gets prod — someone typing `dl login`
|
|
82
82
|
* means the real deployment, not staging.
|
|
83
83
|
*/
|
|
84
84
|
export function resolveLoginEnvName(explicit, filePath) {
|
|
@@ -95,7 +95,7 @@ export async function runLogin(args) {
|
|
|
95
95
|
// which meant a custom environment could not be defined without naming a
|
|
96
96
|
// service this CLI no longer talks to.
|
|
97
97
|
process.stderr.write(`✗ unknown environment '${envName}'. Either use a built-in (${Object.keys(BUILTIN_ENVS).join(", ")}) ` +
|
|
98
|
-
`or define one:
|
|
98
|
+
`or define one: dl login --env ${envName} --url <api>\n`);
|
|
99
99
|
return 1;
|
|
100
100
|
}
|
|
101
101
|
process.stderr.write(`Logging into environment '${envName}' (${remote})\n`);
|
|
@@ -147,7 +147,7 @@ export async function runLogin(args) {
|
|
|
147
147
|
if (process.stderr.isTTY)
|
|
148
148
|
process.stderr.write("\n");
|
|
149
149
|
if (err instanceof DeviceCodeExpiredError) {
|
|
150
|
-
process.stderr.write("✗ Device code expired. Run '
|
|
150
|
+
process.stderr.write("✗ Device code expired. Run 'dl login' again.\n");
|
|
151
151
|
}
|
|
152
152
|
else if (err instanceof AuthorizationDeniedError) {
|
|
153
153
|
process.stderr.write("✗ Authorization denied.\n");
|
|
@@ -236,7 +236,7 @@ export async function runEnvList(opts) {
|
|
|
236
236
|
}
|
|
237
237
|
process.stdout.write("Environments\n\n");
|
|
238
238
|
if (envs.length === 0) {
|
|
239
|
-
process.stdout.write(` (none logged in)\n hint:
|
|
239
|
+
process.stdout.write(` (none logged in)\n hint: dl login (defaults to prod; built-in: ${Object.keys(BUILTIN_ENVS).join(", ")})\n`);
|
|
240
240
|
return 0;
|
|
241
241
|
}
|
|
242
242
|
const rows = envs.map((e) => ({
|
|
@@ -253,7 +253,7 @@ export async function runEnvList(opts) {
|
|
|
253
253
|
process.stdout.write(`\n ! ${note} → effective server: ${resolveRemote()}\n`);
|
|
254
254
|
else if (!effective) {
|
|
255
255
|
process.stdout.write(`\n ! effective connection (${resolveRemote()}) matches no saved env — ` +
|
|
256
|
-
`run '
|
|
256
|
+
`run 'dl auth env use <name>' to re-sync\n`);
|
|
257
257
|
}
|
|
258
258
|
return 0;
|
|
259
259
|
}
|
|
@@ -267,7 +267,7 @@ export async function runEnvUse(name) {
|
|
|
267
267
|
const known = listEnvs().map((e) => e.name);
|
|
268
268
|
process.stderr.write(`✗ environment '${name}' is not logged in.\n` +
|
|
269
269
|
(known.length ? ` logged in: ${known.join(", ")}\n` : "") +
|
|
270
|
-
` log in with:
|
|
270
|
+
` log in with: dl login --env ${name}\n`);
|
|
271
271
|
return 1;
|
|
272
272
|
}
|
|
273
273
|
export async function runEnvRemove(name) {
|
|
@@ -303,7 +303,7 @@ export async function runProfile(args) {
|
|
|
303
303
|
}
|
|
304
304
|
const token = resolveToken();
|
|
305
305
|
if (!token) {
|
|
306
|
-
process.stdout.write("Not logged in. Run:
|
|
306
|
+
process.stdout.write("Not logged in. Run: dl login\n");
|
|
307
307
|
return 1;
|
|
308
308
|
}
|
|
309
309
|
const remote = resolveRemote(args.url);
|
|
@@ -108,7 +108,7 @@ export class DeviceFlowClient {
|
|
|
108
108
|
continue;
|
|
109
109
|
}
|
|
110
110
|
if (error === "expired_token") {
|
|
111
|
-
throw new DeviceCodeExpiredError("Device code expired. Please run '
|
|
111
|
+
throw new DeviceCodeExpiredError("Device code expired. Please run 'dl login' again.");
|
|
112
112
|
}
|
|
113
113
|
if (error === "access_denied") {
|
|
114
114
|
throw new AuthorizationDeniedError("User denied authorization request.");
|
|
@@ -126,7 +126,7 @@ export class DeviceFlowClient {
|
|
|
126
126
|
await sleep(5000);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
throw new DeviceFlowError("Authorization timed out after 10 minutes. Please run '
|
|
129
|
+
throw new DeviceFlowError("Authorization timed out after 10 minutes. Please run 'dl login' again.");
|
|
130
130
|
}
|
|
131
131
|
/** Exchange a vuer-auth token for a permanent dreamlake token. */
|
|
132
132
|
async exchangeToken(vuerAuthToken) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** The token slot `
|
|
1
|
+
/** The token slot `dl login` (py) writes and `_session.py` reads. */
|
|
2
2
|
export declare const TOKEN_SLOT = "dreamlake-token";
|
|
3
3
|
/** `~/.dreamlake` — shared with dreamlake-py. Fixed, no XDG (py has none). */
|
|
4
4
|
export declare function dreamlakeDir(): string;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync, } from "node:fs";
|
|
26
26
|
import { homedir } from "node:os";
|
|
27
27
|
import path from "node:path";
|
|
28
|
-
/** The token slot `
|
|
28
|
+
/** The token slot `dl login` (py) writes and `_session.py` reads. */
|
|
29
29
|
export const TOKEN_SLOT = "dreamlake-token";
|
|
30
30
|
/** `~/.dreamlake` — shared with dreamlake-py. Fixed, no XDG (py has none). */
|
|
31
31
|
export function dreamlakeDir() {
|
package/dist/cli/compat/http.js
CHANGED
|
@@ -124,7 +124,7 @@ export async function episodeExists(ctx, token, namespace, project, episode) {
|
|
|
124
124
|
/** Resolved token or a printed error + null. */
|
|
125
125
|
export function requireToken(ctx) {
|
|
126
126
|
if (!ctx.token) {
|
|
127
|
-
fail("not authenticated. run `
|
|
127
|
+
fail("not authenticated. run `dl login` first");
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
130
130
|
return ctx.token;
|
|
@@ -136,7 +136,7 @@ export async function requireNamespace(ctx, explicit) {
|
|
|
136
136
|
return explicit;
|
|
137
137
|
const ns = await resolveNamespace(ctx);
|
|
138
138
|
if (!ns) {
|
|
139
|
-
fail("namespace not specified and no authenticated user found. run `
|
|
139
|
+
fail("namespace not specified and no authenticated user found. run `dl login`");
|
|
140
140
|
}
|
|
141
141
|
return ns;
|
|
142
142
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// The presigned-batch transfer executor, shared by `
|
|
2
|
-
// and `
|
|
1
|
+
// The presigned-batch transfer executor, shared by `dl source upload`
|
|
2
|
+
// and `dl library push`.
|
|
3
3
|
//
|
|
4
4
|
// Both surfaces answer an upload-authorizations call with the same transfer
|
|
5
5
|
// shape per file — `{kind:'single-put'}` or `{kind:'s3-multipart'}` — and this
|
package/dist/cli/config.js
CHANGED
|
@@ -38,7 +38,7 @@ export function resolveRemote(flag, dir) {
|
|
|
38
38
|
/** Bearer token, or null if unauthenticated. */
|
|
39
39
|
export function resolveToken(flag, dir) {
|
|
40
40
|
if (identityMode() === "machine")
|
|
41
|
-
throw new Error("Machine identity does not use human bearer tokens. Use
|
|
41
|
+
throw new Error("Machine identity does not use human bearer tokens. Use dl machine self|host|project, or --identity user for personal commands");
|
|
42
42
|
return flag || process.env.DREAMLAKE_API_KEY || readToken(dir) || null;
|
|
43
43
|
}
|
|
44
44
|
/** Decode a JWT payload without verifying the signature. Returns {} on failure. */
|
|
@@ -72,7 +72,7 @@ export async function resolveNamespace(explicit, opts) {
|
|
|
72
72
|
if (selected && typeof selected === 'object' && selected.remote === stripTrailingSlash(opts.remote) &&
|
|
73
73
|
selected.tokenSha256 === createHash('sha256').update(opts.token).digest('hex')) {
|
|
74
74
|
if (typeof selected.namespace !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(selected.namespace))
|
|
75
|
-
throw new Error('Saved CLI namespace is invalid; run
|
|
75
|
+
throw new Error('Saved CLI namespace is invalid; run dl su <namespace> again');
|
|
76
76
|
return selected.namespace;
|
|
77
77
|
}
|
|
78
78
|
if (cfg.namespace &&
|
|
@@ -9,13 +9,13 @@ import { registerConnectionWriteCommands } from "./write.js";
|
|
|
9
9
|
export async function ctx(nsFlag) {
|
|
10
10
|
const token = resolveToken();
|
|
11
11
|
if (!token) {
|
|
12
|
-
fail("not authenticated — run '
|
|
12
|
+
fail("not authenticated — run 'dl login' first");
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
15
15
|
const remote = resolveRemote();
|
|
16
16
|
const ns = await resolveNamespace(nsFlag, { token, remote });
|
|
17
17
|
if (!ns) {
|
|
18
|
-
fail("could not resolve namespace — run '
|
|
18
|
+
fail("could not resolve namespace — run 'dl login' or pass --namespace");
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
21
|
return { token, remote, ns };
|
|
@@ -45,7 +45,7 @@ export function connectionPath(c, id) {
|
|
|
45
45
|
export function explain(err) {
|
|
46
46
|
if (err instanceof HttpError) {
|
|
47
47
|
if (err.status === 401)
|
|
48
|
-
return "not authenticated — run '
|
|
48
|
+
return "not authenticated — run 'dl login' first";
|
|
49
49
|
if (err.status === 404) {
|
|
50
50
|
/*
|
|
51
51
|
* Two different 404s, and they were being reported as one.
|
|
@@ -57,7 +57,7 @@ export function explain(err) {
|
|
|
57
57
|
*
|
|
58
58
|
* A BARE 404 has no code because it is not a Connection envelope at all.
|
|
59
59
|
* It is the router: with `CONNECTION_V1_ENABLED` unset the whole scope is
|
|
60
|
-
* never mounted, so every `
|
|
60
|
+
* never mounted, so every `dl connection …` command hits nothing.
|
|
61
61
|
* Reporting that as "you are not a credential manager" sends someone to
|
|
62
62
|
* ask for a permission that would not help, on a server that has no
|
|
63
63
|
* Connections to be a manager of.
|
|
@@ -153,7 +153,7 @@ function printCounts(counts, ns, opts) {
|
|
|
153
153
|
* the next page of what they were reading.
|
|
154
154
|
*/
|
|
155
155
|
function listCommand(opts) {
|
|
156
|
-
const parts = ["
|
|
156
|
+
const parts = ["dl connection list"];
|
|
157
157
|
if (opts.labelContains !== undefined)
|
|
158
158
|
parts.push(`--label-contains ${quote(opts.labelContains)}`);
|
|
159
159
|
if (opts.lifecycle !== undefined)
|
|
@@ -364,7 +364,7 @@ export async function runConnectionAffected(id, opts) {
|
|
|
364
364
|
return 0;
|
|
365
365
|
}
|
|
366
366
|
if (page.items.length === 0) {
|
|
367
|
-
printEmptyPage(c, page.nextCursor, "No sources use this connection.", `
|
|
367
|
+
printEmptyPage(c, page.nextCursor, "No sources use this connection.", `dl connection affected-sources ${id}`);
|
|
368
368
|
return 0;
|
|
369
369
|
}
|
|
370
370
|
process.stdout.write(renderTable(page.items.map((x) => ({
|
|
@@ -373,7 +373,7 @@ export async function runConnectionAffected(id, opts) {
|
|
|
373
373
|
sourceId: x.sourceId,
|
|
374
374
|
})), ["name", "lifecycle", "sourceId"]));
|
|
375
375
|
process.stdout.write(`\n ${page.items.length} source(s) use this connection\n`);
|
|
376
|
-
printNextPage(c, page.nextCursor, `
|
|
376
|
+
printNextPage(c, page.nextCursor, `dl connection affected-sources ${id}`);
|
|
377
377
|
return 0;
|
|
378
378
|
}
|
|
379
379
|
catch (err) {
|
|
@@ -398,7 +398,7 @@ export function registerConnectionCommand(program) {
|
|
|
398
398
|
.action(async (opts) => process.exit(await runConnectionList(opts)));
|
|
399
399
|
strictArgs(connection.command("show"))
|
|
400
400
|
.description("show one connection")
|
|
401
|
-
.argument("<id>", "connection id (see '
|
|
401
|
+
.argument("<id>", "connection id (see 'dl connection list')")
|
|
402
402
|
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
403
403
|
.option("--json", "emit JSON")
|
|
404
404
|
.action(async (id, opts) => process.exit(await runConnectionShow(id, opts)));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The OAuth half of `
|
|
1
|
+
// The OAuth half of `dl connection …`.
|
|
2
2
|
//
|
|
3
3
|
// The division of labour is not negotiable and is worth stating plainly,
|
|
4
4
|
// because getting it wrong is how a CLI ends up holding secrets it has no
|
|
@@ -40,7 +40,7 @@ const RETURN_TO = "/settings/connections";
|
|
|
40
40
|
* authorization.
|
|
41
41
|
*/
|
|
42
42
|
function statusCommand(c, operationId) {
|
|
43
|
-
return `
|
|
43
|
+
return `dl connection oauth status ${operationId} --namespace ${c.ns}`;
|
|
44
44
|
}
|
|
45
45
|
const POLL_INTERVAL_MS = 2000;
|
|
46
46
|
const DEFAULT_TIMEOUT_MS = 5 * 60 * 1000;
|
|
@@ -92,7 +92,7 @@ async function begin(c, body) {
|
|
|
92
92
|
" This endpoint has no idempotency key, so there is nothing to repeat\n" +
|
|
93
93
|
" safely. Running the command again starts a new authorization; an\n" +
|
|
94
94
|
" operation nobody completes expires on its own and creates nothing.\n" +
|
|
95
|
-
" Check what exists first:
|
|
95
|
+
" Check what exists first: dl connection list\n" +
|
|
96
96
|
` (${err.message})`);
|
|
97
97
|
return null;
|
|
98
98
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The mutating half of `
|
|
1
|
+
// The mutating half of `dl connection …`.
|
|
2
2
|
//
|
|
3
3
|
// Two rules shape almost everything here.
|
|
4
4
|
//
|
|
@@ -352,14 +352,14 @@ export async function runConnectionCheck(id, opts) {
|
|
|
352
352
|
" This connector can only be verified against a target, which belongs\n" +
|
|
353
353
|
" to a Source rather than to the Connection — so this layer cannot ask\n" +
|
|
354
354
|
" the provider anything. It gets exercised when a Source uses it:\n" +
|
|
355
|
-
`
|
|
355
|
+
` dl source import --connector <kind> --connection ${id} --target <json>\n`);
|
|
356
356
|
}
|
|
357
357
|
else if (result.status === "unavailable") {
|
|
358
358
|
process.stdout.write(result.reason === "connection-disabled"
|
|
359
359
|
? "\n Nothing was changed. This connection is already disabled;\n" +
|
|
360
|
-
` enable it when you want to use it:
|
|
360
|
+
` enable it when you want to use it: dl connection enable ${id}\n`
|
|
361
361
|
: "\n Nothing was changed. This connection is still enabled; disable it\n" +
|
|
362
|
-
` yourself if that is what you want:
|
|
362
|
+
` yourself if that is what you want: dl connection disable ${id}\n`);
|
|
363
363
|
}
|
|
364
364
|
return 0;
|
|
365
365
|
}
|
|
@@ -490,7 +490,7 @@ export async function runConnectionDelete(id, opts) {
|
|
|
490
490
|
if (err instanceof HttpError && err.code === "CONNECTION_IN_USE") {
|
|
491
491
|
fail(`${err.message}\n` +
|
|
492
492
|
` Nothing was deleted and no source was changed. See what still uses it:\n` +
|
|
493
|
-
`
|
|
493
|
+
` dl connection affected-sources ${id}`);
|
|
494
494
|
return 1;
|
|
495
495
|
}
|
|
496
496
|
if (isAmbiguous(err))
|
|
@@ -536,7 +536,7 @@ export function registerConnectionWriteCommands(connection) {
|
|
|
536
536
|
.action(async (opts) => process.exit(await runConnectionCreate(opts)));
|
|
537
537
|
idempotent(strictArgs(connection.command("rename")))
|
|
538
538
|
.description("change a connection's label")
|
|
539
|
-
.argument("<id>", "connection id (see '
|
|
539
|
+
.argument("<id>", "connection id (see 'dl connection list')")
|
|
540
540
|
.requiredOption("--label <text>", "the new label")
|
|
541
541
|
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
542
542
|
.option("--json", "emit JSON")
|
package/dist/cli/create/index.js
CHANGED
|
@@ -129,12 +129,12 @@ export async function runCreateProject(name, opts) {
|
|
|
129
129
|
const remote = resolveRemote();
|
|
130
130
|
const token = resolveToken();
|
|
131
131
|
if (!token) {
|
|
132
|
-
fail("not authenticated. run '
|
|
132
|
+
fail("not authenticated. run 'dl login' first");
|
|
133
133
|
return 1;
|
|
134
134
|
}
|
|
135
135
|
const namespace = await resolveNamespace(opts.namespace, { token, remote });
|
|
136
136
|
if (!namespace) {
|
|
137
|
-
fail("namespace not specified and no authenticated user found. run '
|
|
137
|
+
fail("namespace not specified and no authenticated user found. run 'dl login'");
|
|
138
138
|
return 1;
|
|
139
139
|
}
|
|
140
140
|
const body = { name };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// `
|
|
1
|
+
// `dl declare <file>…` — the one writer for the five *head*
|
|
2
2
|
// declaration collections on dreamlake-server.
|
|
3
3
|
//
|
|
4
4
|
// lakeshore-providers how a machine gets launched
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
//
|
|
35
35
|
// The sub-resources — `runnables/:id/versions`, `repos/:id/snapshots` — are NOT
|
|
36
36
|
// reachable from here: they hang off a nested path and are append-only, not
|
|
37
|
-
// create-only. `
|
|
37
|
+
// create-only. `dl runnable version push` owns the one that matters.
|
|
38
38
|
import { HttpError, requestJson } from "../client.js";
|
|
39
39
|
import { resolveNamespace, resolveRemote, resolveToken } from "../config.js";
|
|
40
40
|
import { emitJson, fail, loadStructuredFile, ok, warn } from "../helpers.js";
|
|
@@ -100,13 +100,13 @@ export function inferCollection(payload) {
|
|
|
100
100
|
async function ctx(nsFlag) {
|
|
101
101
|
const token = resolveToken();
|
|
102
102
|
if (!token) {
|
|
103
|
-
fail("not authenticated — run '
|
|
103
|
+
fail("not authenticated — run 'dl login' first");
|
|
104
104
|
return null;
|
|
105
105
|
}
|
|
106
106
|
const remote = resolveRemote();
|
|
107
107
|
const ns = await resolveNamespace(nsFlag, { token, remote });
|
|
108
108
|
if (!ns) {
|
|
109
|
-
fail("could not resolve namespace — run '
|
|
109
|
+
fail("could not resolve namespace — run 'dl login' or pass --namespace");
|
|
110
110
|
return null;
|
|
111
111
|
}
|
|
112
112
|
return { token, remote, ns };
|
|
@@ -115,18 +115,18 @@ const SOURCE_REFUSAL = "Sources are no longer declared. There are now two separa
|
|
|
115
115
|
"this file cannot be mapped onto either one reliably — so it is refused " +
|
|
116
116
|
"rather than guessed at. Pick the one that matches what the Source is:\n" +
|
|
117
117
|
" managed-only — DreamLake stores the data, and a name is all it takes:\n" +
|
|
118
|
-
"
|
|
118
|
+
" dl source create <name> [--description <text>]\n" +
|
|
119
119
|
" external — the data already lives somewhere else, so the connector and\n" +
|
|
120
120
|
" its target have to be named:\n" +
|
|
121
|
-
"
|
|
121
|
+
" dl source import --connector <kind> --target <json>\n" +
|
|
122
122
|
"Nothing was sent.";
|
|
123
123
|
const HOST_KEY_REFUSAL = "hostKey is derived server-side and is never accepted from a client — " +
|
|
124
124
|
"the server recomputes it on every write, so a value here would be silently " +
|
|
125
125
|
"ignored rather than honoured. Remove it from the payload.";
|
|
126
|
-
// ───
|
|
126
|
+
// ─── dl declare ───────────────────────────────────────────────────────
|
|
127
127
|
export async function runDeclare(files, opts) {
|
|
128
128
|
if (files.length === 0) {
|
|
129
|
-
fail("no files given — usage:
|
|
129
|
+
fail("no files given — usage: dl declare <file>…");
|
|
130
130
|
return 1;
|
|
131
131
|
}
|
|
132
132
|
const ifExists = opts.ifExists ?? "fail";
|
|
@@ -284,21 +284,21 @@ export function registerDeclareCommand(program) {
|
|
|
284
284
|
"Sources are refused locally too, and for a larger reason: they are no longer",
|
|
285
285
|
"declared at all. A Source is now one of two things, and the two are made in",
|
|
286
286
|
"different ways. A managed-only Source — one whose data DreamLake stores —",
|
|
287
|
-
"needs nothing but a name: `
|
|
287
|
+
"needs nothing but a name: `dl source create <name>`. An external",
|
|
288
288
|
"Source points at data that already lives elsewhere, so it needs the connector",
|
|
289
|
-
"and the target: `
|
|
289
|
+
"and the target: `dl source import --connector <kind> --target <json>`.",
|
|
290
290
|
"A declaration file does not say which of the two it meant, so this command",
|
|
291
291
|
"will not choose on your behalf. `sources` is still recognised here — by",
|
|
292
292
|
"inference and via --collection — so that you get that message rather than an",
|
|
293
293
|
"unhelpful one about an unknown collection.",
|
|
294
294
|
"",
|
|
295
295
|
"Registering a version of a runnable is NOT a declare — versions hang off a",
|
|
296
|
-
"nested, append-only path. Use `
|
|
296
|
+
"nested, append-only path. Use `dl runnable version push`.",
|
|
297
297
|
"",
|
|
298
298
|
"Examples:",
|
|
299
|
-
"
|
|
300
|
-
"
|
|
301
|
-
"
|
|
299
|
+
" dl declare 01_gpu_udf/runnable.json",
|
|
300
|
+
" dl declare */*.json --if-exists ok",
|
|
301
|
+
" dl declare runconfig.yaml --collection run-configs --dry-run",
|
|
302
302
|
].join("\n"))
|
|
303
303
|
.action(async (files, opts) => process.exit(await runDeclare(files, opts)));
|
|
304
304
|
}
|