@dreamlake/dreamlake-cli 0.102.3 → 0.104.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 +5 -0
- package/dist/api/access.js +2 -0
- package/dist/api/content.d.ts +42 -6
- package/dist/api/content.js +3 -0
- package/dist/api/index.d.ts +28 -12
- package/dist/cli/agents/index.d.ts +4 -0
- package/dist/cli/agents/index.js +122 -5
- package/dist/cli/help-examples.generated.js +2 -0
- package/dist/cli/hosts/api.js +3 -0
- package/dist/cli/hosts/config.js +4 -4
- package/dist/cli/hosts/enroll.js +4 -2
- package/dist/cli/hosts/index.js +7 -5
- package/dist/cli/hosts/inventory.d.ts +1 -1
- package/dist/cli/hosts/inventory.js +1 -1
- package/dist/cli/hosts/lifecycle.js +1 -1
- package/dist/cli/hosts/observations.js +2 -2
- package/dist/cli/hosts/rename.d.ts +8 -0
- package/dist/cli/hosts/rename.js +32 -0
- package/dist/cli/hosts/ssh-usage.d.ts +17 -0
- package/dist/cli/hosts/ssh-usage.js +19 -0
- package/dist/cli/hosts/ssh.js +2 -2
- package/dist/cli/hosts/upgrade.js +5 -5
- package/dist/cli/nymph/index.js +7 -7
- package/dist/cli/providers/index.js +3 -3
- package/dist/cli/queues/index.js +2 -2
- package/dist/cli/run/index.js +1 -1
- package/dist/cli/run/input.js +2 -2
- package/dist/cli/runnable/bound-target.js +3 -3
- package/dist/cli/runnable/bound.js +3 -3
- package/dist/cli/runnable/run.js +1 -1
- package/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/package.json +9 -9
package/dist/api/access.d.ts
CHANGED
|
@@ -7,6 +7,11 @@ export declare function hostsApi(t: Transport, namespace: string): {
|
|
|
7
7
|
page?: number;
|
|
8
8
|
pageSize?: number;
|
|
9
9
|
}) => Promise<unknown>;
|
|
10
|
+
/** Preserve the Host ID and enrollment; reuse identical inputs after uncertainty. */
|
|
11
|
+
rename: (id: string, input: {
|
|
12
|
+
name: string;
|
|
13
|
+
expectedName: string;
|
|
14
|
+
}) => Promise<unknown>;
|
|
10
15
|
status: (id: string) => Promise<unknown>;
|
|
11
16
|
enroll: (input: JsonObject) => Promise<unknown>;
|
|
12
17
|
enrollments: (id: string) => Promise<unknown>;
|
package/dist/api/access.js
CHANGED
|
@@ -6,6 +6,8 @@ export function hostsApi(t, namespace) {
|
|
|
6
6
|
return {
|
|
7
7
|
...hostMoveApi(t, namespace),
|
|
8
8
|
list: (query = {}) => call(t, "GET", base, undefined, query),
|
|
9
|
+
/** Preserve the Host ID and enrollment; reuse identical inputs after uncertainty. */
|
|
10
|
+
rename: (id, input) => call(t, "POST", p(id) + "/rename", input),
|
|
9
11
|
status: (id) => call(t, "GET", p(id)),
|
|
10
12
|
enroll: (input) => call(t, "POST", base + "/enrollments", input),
|
|
11
13
|
enrollments: (id) => call(t, "GET", p(id)),
|
package/dist/api/content.d.ts
CHANGED
|
@@ -93,7 +93,46 @@ export declare function workflowsApi(t: Transport, namespace: string): {
|
|
|
93
93
|
receipt: unknown;
|
|
94
94
|
}>;
|
|
95
95
|
};
|
|
96
|
+
/** A runnable owns identity and execution history; agents may reference authored Notes. */
|
|
97
|
+
export interface RunnableContent {
|
|
98
|
+
instructionNoteId: string;
|
|
99
|
+
skills?: Array<{
|
|
100
|
+
kind: "note" | "folder";
|
|
101
|
+
id: string;
|
|
102
|
+
}>;
|
|
103
|
+
}
|
|
104
|
+
export interface RunnableInput {
|
|
105
|
+
name?: string;
|
|
106
|
+
module?: string;
|
|
107
|
+
qualname?: string;
|
|
108
|
+
kind?: string;
|
|
109
|
+
description?: string | null;
|
|
110
|
+
markdown?: string | null;
|
|
111
|
+
content?: RunnableContent | null;
|
|
112
|
+
projects?: string[];
|
|
113
|
+
metadata?: JsonObject | null;
|
|
114
|
+
channel?: JsonObject | null;
|
|
115
|
+
}
|
|
116
|
+
export interface RunnableRecord extends RunnableInput {
|
|
117
|
+
id: string;
|
|
118
|
+
name: string;
|
|
119
|
+
kind: string;
|
|
120
|
+
updatedAt: string;
|
|
121
|
+
archivedAt?: string | null;
|
|
122
|
+
[key: string]: unknown;
|
|
123
|
+
}
|
|
124
|
+
export type RunnableUpdate = Partial<Omit<RunnableInput, "projects">> & {
|
|
125
|
+
archived?: boolean;
|
|
126
|
+
expectedUpdatedAt?: string;
|
|
127
|
+
};
|
|
96
128
|
export declare function runnablesApi(t: Transport, namespace: string): {
|
|
129
|
+
list: (query?: Query) => Promise<{
|
|
130
|
+
runnables: RunnableRecord[];
|
|
131
|
+
totalPages: number;
|
|
132
|
+
total: number;
|
|
133
|
+
}>;
|
|
134
|
+
archive: (id: string) => Promise<RunnableRecord>;
|
|
135
|
+
restore: (id: string) => Promise<RunnableRecord>;
|
|
97
136
|
versions: (name: string) => Promise<unknown>;
|
|
98
137
|
version: (name: string, version: string) => Promise<unknown>;
|
|
99
138
|
pushVersion: (name: string, input: {
|
|
@@ -101,12 +140,9 @@ export declare function runnablesApi(t: Transport, namespace: string): {
|
|
|
101
140
|
source: string;
|
|
102
141
|
metadata?: JsonObject;
|
|
103
142
|
}) => Promise<unknown>;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
get: (id: string) => Promise<import("./common.js").Resource>;
|
|
108
|
-
create: (input: JsonObject) => Promise<import("./common.js").Resource>;
|
|
109
|
-
update: (id: string, input: Partial<JsonObject>) => Promise<import("./common.js").Resource>;
|
|
143
|
+
get: (id: string) => Promise<RunnableRecord>;
|
|
144
|
+
create: (input: RunnableInput) => Promise<RunnableRecord>;
|
|
145
|
+
update: (id: string, input: RunnableUpdate) => Promise<RunnableRecord>;
|
|
110
146
|
delete: (id: string) => Promise<unknown>;
|
|
111
147
|
};
|
|
112
148
|
export declare function librariesApi(t: Transport, namespace: string): {
|
package/dist/api/content.js
CHANGED
|
@@ -89,6 +89,9 @@ export function runnablesApi(t, namespace) {
|
|
|
89
89
|
const base = namespacePath(namespace) + "/runnables", path = (name) => base + "/" + seg(name);
|
|
90
90
|
return {
|
|
91
91
|
...resourceApi(t, base),
|
|
92
|
+
list: (query = {}) => call(t, "GET", base, undefined, query),
|
|
93
|
+
archive: (id) => call(t, "PATCH", path(id), { archived: true }),
|
|
94
|
+
restore: (id) => call(t, "PATCH", path(id), { archived: false }),
|
|
92
95
|
versions: (name) => call(t, "GET", path(name) + "/versions", undefined, { pageSize: 200 }),
|
|
93
96
|
version: (name, version) => call(t, "GET", path(name) + "/versions/" + seg(version)),
|
|
94
97
|
pushVersion: (name, input) => call(t, "POST", path(name) + "/versions", input),
|
package/dist/api/index.d.ts
CHANGED
|
@@ -352,6 +352,10 @@ export declare function createApi(transport: Transport): {
|
|
|
352
352
|
page?: number;
|
|
353
353
|
pageSize?: number;
|
|
354
354
|
}) => Promise<unknown>;
|
|
355
|
+
rename: (id: string, input: {
|
|
356
|
+
name: string;
|
|
357
|
+
expectedName: string;
|
|
358
|
+
}) => Promise<unknown>;
|
|
355
359
|
status: (id: string) => Promise<unknown>;
|
|
356
360
|
enroll: (input: import("./common.js").JsonObject) => Promise<unknown>;
|
|
357
361
|
enrollments: (id: string) => Promise<unknown>;
|
|
@@ -846,6 +850,13 @@ export declare function createApi(transport: Transport): {
|
|
|
846
850
|
}>;
|
|
847
851
|
};
|
|
848
852
|
runnables: (namespace: string) => {
|
|
853
|
+
list: (query?: import("./common.js").Query) => Promise<{
|
|
854
|
+
runnables: import("./content.js").RunnableRecord[];
|
|
855
|
+
totalPages: number;
|
|
856
|
+
total: number;
|
|
857
|
+
}>;
|
|
858
|
+
archive: (id: string) => Promise<import("./content.js").RunnableRecord>;
|
|
859
|
+
restore: (id: string) => Promise<import("./content.js").RunnableRecord>;
|
|
849
860
|
versions: (name: string) => Promise<unknown>;
|
|
850
861
|
version: (name: string, version: string) => Promise<unknown>;
|
|
851
862
|
pushVersion: (name: string, input: {
|
|
@@ -853,12 +864,9 @@ export declare function createApi(transport: Transport): {
|
|
|
853
864
|
source: string;
|
|
854
865
|
metadata?: import("./common.js").JsonObject;
|
|
855
866
|
}) => Promise<unknown>;
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
get: (id: string) => Promise<import("./common.js").Resource>;
|
|
860
|
-
create: (input: import("./common.js").JsonObject) => Promise<import("./common.js").Resource>;
|
|
861
|
-
update: (id: string, input: Partial<import("./common.js").JsonObject>) => Promise<import("./common.js").Resource>;
|
|
867
|
+
get: (id: string) => Promise<import("./content.js").RunnableRecord>;
|
|
868
|
+
create: (input: import("./content.js").RunnableInput) => Promise<import("./content.js").RunnableRecord>;
|
|
869
|
+
update: (id: string, input: import("./content.js").RunnableUpdate) => Promise<import("./content.js").RunnableRecord>;
|
|
862
870
|
delete: (id: string) => Promise<unknown>;
|
|
863
871
|
};
|
|
864
872
|
libraries: (namespace: string) => {
|
|
@@ -1429,6 +1437,10 @@ export declare function createClient(options: ClientOptions): {
|
|
|
1429
1437
|
page?: number;
|
|
1430
1438
|
pageSize?: number;
|
|
1431
1439
|
}) => Promise<unknown>;
|
|
1440
|
+
rename: (id: string, input: {
|
|
1441
|
+
name: string;
|
|
1442
|
+
expectedName: string;
|
|
1443
|
+
}) => Promise<unknown>;
|
|
1432
1444
|
status: (id: string) => Promise<unknown>;
|
|
1433
1445
|
enroll: (input: import("./common.js").JsonObject) => Promise<unknown>;
|
|
1434
1446
|
enrollments: (id: string) => Promise<unknown>;
|
|
@@ -1923,6 +1935,13 @@ export declare function createClient(options: ClientOptions): {
|
|
|
1923
1935
|
}>;
|
|
1924
1936
|
};
|
|
1925
1937
|
runnables: (namespace: string) => {
|
|
1938
|
+
list: (query?: import("./common.js").Query) => Promise<{
|
|
1939
|
+
runnables: import("./content.js").RunnableRecord[];
|
|
1940
|
+
totalPages: number;
|
|
1941
|
+
total: number;
|
|
1942
|
+
}>;
|
|
1943
|
+
archive: (id: string) => Promise<import("./content.js").RunnableRecord>;
|
|
1944
|
+
restore: (id: string) => Promise<import("./content.js").RunnableRecord>;
|
|
1926
1945
|
versions: (name: string) => Promise<unknown>;
|
|
1927
1946
|
version: (name: string, version: string) => Promise<unknown>;
|
|
1928
1947
|
pushVersion: (name: string, input: {
|
|
@@ -1930,12 +1949,9 @@ export declare function createClient(options: ClientOptions): {
|
|
|
1930
1949
|
source: string;
|
|
1931
1950
|
metadata?: import("./common.js").JsonObject;
|
|
1932
1951
|
}) => Promise<unknown>;
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
get: (id: string) => Promise<import("./common.js").Resource>;
|
|
1937
|
-
create: (input: import("./common.js").JsonObject) => Promise<import("./common.js").Resource>;
|
|
1938
|
-
update: (id: string, input: Partial<import("./common.js").JsonObject>) => Promise<import("./common.js").Resource>;
|
|
1952
|
+
get: (id: string) => Promise<import("./content.js").RunnableRecord>;
|
|
1953
|
+
create: (input: import("./content.js").RunnableInput) => Promise<import("./content.js").RunnableRecord>;
|
|
1954
|
+
update: (id: string, input: import("./content.js").RunnableUpdate) => Promise<import("./content.js").RunnableRecord>;
|
|
1939
1955
|
delete: (id: string) => Promise<unknown>;
|
|
1940
1956
|
};
|
|
1941
1957
|
libraries: (namespace: string) => {
|
package/dist/cli/agents/index.js
CHANGED
|
@@ -31,9 +31,8 @@
|
|
|
31
31
|
// `metadata`, which round-trips unchanged. That is the honest state of the
|
|
32
32
|
// server, not a preference.
|
|
33
33
|
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
// and the control plane is what would drive one.
|
|
34
|
+
// Creation writes a definition. Running the built-in assistant is a separate
|
|
35
|
+
// invocation; external Claude declarations keep their existing runtime contract.
|
|
37
36
|
import { spawnSync } from "node:child_process";
|
|
38
37
|
import { mkdtempSync, readFileSync, writeFileSync } from "node:fs";
|
|
39
38
|
import { tmpdir } from "node:os";
|
|
@@ -132,6 +131,12 @@ export async function runAgentsCreate(positional, opts) {
|
|
|
132
131
|
}
|
|
133
132
|
}
|
|
134
133
|
async function createAgent(positional, opts) {
|
|
134
|
+
if (opts.runtime && !["builtin-v1", "claude"].includes(opts.runtime))
|
|
135
|
+
throw new SpecError("--runtime must be builtin-v1 or claude");
|
|
136
|
+
if (opts.runtime === "builtin-v1" || opts.instructionNote)
|
|
137
|
+
return createBuiltinAgent(positional, opts);
|
|
138
|
+
if (opts.skillNote?.length || opts.skillFolder?.length)
|
|
139
|
+
throw new SpecError("Skills require --instruction-note");
|
|
135
140
|
// ── 1 · where the prose comes from ──────────────────────────────────────
|
|
136
141
|
//
|
|
137
142
|
// Four sources, one precedence order, and at most one of them may be a
|
|
@@ -411,6 +416,114 @@ async function createAgent(positional, opts) {
|
|
|
411
416
|
return 1;
|
|
412
417
|
}
|
|
413
418
|
}
|
|
419
|
+
async function createBuiltinAgent(positional, opts) {
|
|
420
|
+
if (opts.runtime === "claude")
|
|
421
|
+
throw new SpecError("Note-backed agents require --runtime builtin-v1");
|
|
422
|
+
if (opts.edit || opts.model || opts.permissionMode || opts.runConfig || opts.queue ||
|
|
423
|
+
opts.channel || opts.allow?.length || opts.ask?.length || opts.deny?.length ||
|
|
424
|
+
opts.grant?.length || opts.addDir?.length)
|
|
425
|
+
throw new SpecError("Built-in agents use DreamLake tool scopes; external runtime, permission and machine options do not apply.");
|
|
426
|
+
if (opts.ifExists && !["ok", "fail"].includes(opts.ifExists))
|
|
427
|
+
throw new SpecError("--if-exists must be ok or fail");
|
|
428
|
+
const name = (opts.name ?? positional)?.trim();
|
|
429
|
+
if (!name)
|
|
430
|
+
throw new SpecError("Provide a name for the built-in agent.");
|
|
431
|
+
const sources = Number(opts.prompt !== undefined) + Number(opts.file !== undefined) +
|
|
432
|
+
Number(opts.stdinText !== undefined && opts.file !== "-");
|
|
433
|
+
if (sources > 1 || (opts.instructionNote && sources))
|
|
434
|
+
throw new SpecError("Choose one instruction source: --instruction-note, --prompt, --file, or stdin.");
|
|
435
|
+
const skills = [
|
|
436
|
+
...(opts.skillNote ?? []).map(id => ({ kind: "note", id: id.toLowerCase() })),
|
|
437
|
+
...(opts.skillFolder ?? []).map(id => ({ kind: "folder", id: id.toLowerCase() })),
|
|
438
|
+
];
|
|
439
|
+
if (skills.length && !opts.instructionNote)
|
|
440
|
+
throw new SpecError("Skills require --instruction-note.");
|
|
441
|
+
if (skills.length > 20 || [opts.instructionNote, ...skills.map(s => s.id)]
|
|
442
|
+
.filter(Boolean).some(id => !/^[a-f0-9]{24}$/i.test(id)))
|
|
443
|
+
throw new SpecError("Note/folder IDs must be 24 hexadecimal characters; at most 20 skills.");
|
|
444
|
+
if (new Set(skills.map(skill => `${skill.kind}:${skill.id}`)).size !== skills.length)
|
|
445
|
+
throw new SpecError("Skill references must be unique.");
|
|
446
|
+
const tools = opts.tools !== undefined
|
|
447
|
+
? [...new Set(opts.tools.split(",").map(tool => tool.trim()).filter(Boolean))]
|
|
448
|
+
: ["dreamlake_notes_read"];
|
|
449
|
+
if (!tools.length || tools.length > 80 || tools.some(tool => !/^dreamlake_[a-z0-9_]{1,60}$/.test(tool)))
|
|
450
|
+
throw new SpecError("Choose 1–80 built-in tool names with the dreamlake_ prefix.");
|
|
451
|
+
let markdown;
|
|
452
|
+
if (!opts.instructionNote) {
|
|
453
|
+
if (opts.prompt !== undefined)
|
|
454
|
+
markdown = opts.prompt;
|
|
455
|
+
else if (opts.file && opts.file !== "-") {
|
|
456
|
+
try {
|
|
457
|
+
markdown = readFileSync(path.resolve(opts.file), "utf8");
|
|
458
|
+
}
|
|
459
|
+
catch {
|
|
460
|
+
throw new SpecError(`cannot read --file: ${opts.file}`);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
else
|
|
464
|
+
markdown = opts.stdinText ??
|
|
465
|
+
(opts.file === "-" || !process.stdin.isTTY ? await readStdin() : "");
|
|
466
|
+
if (markdown.length > 16000)
|
|
467
|
+
throw new SpecError("Built-in instructions must be at most 16000 characters.");
|
|
468
|
+
if (!markdown.trim())
|
|
469
|
+
throw new SpecError("Provide nonempty instructions with --prompt, --file or --instruction-note.");
|
|
470
|
+
}
|
|
471
|
+
const args = (opts.arg ?? []).map(parseArgumentFlag);
|
|
472
|
+
if (args.length > 20 || new Set(args.map(arg => arg.name)).size !== args.length)
|
|
473
|
+
throw new SpecError("Choose at most 20 uniquely named arguments.");
|
|
474
|
+
for (const arg of args) {
|
|
475
|
+
if (["__proto__", "constructor", "prototype"].includes(arg.name) ||
|
|
476
|
+
/token|secret|password|api_?key|credential|authorization/i.test(arg.name))
|
|
477
|
+
throw new SpecError(`Argument '${arg.name}' is not supported by the built-in runtime.`);
|
|
478
|
+
if (arg.type === "enum" && (arg.values.length > 30 ||
|
|
479
|
+
arg.values.some(value => typeof value !== "string" || value.length > 200)))
|
|
480
|
+
throw new SpecError(`Argument '${arg.name}' needs at most 30 enum values of at most 200 characters.`);
|
|
481
|
+
if ((arg.type === "string" && typeof arg.default === "string" && arg.default.length > 4000) ||
|
|
482
|
+
(arg.type === "integer" && arg.default !== undefined && !Number.isSafeInteger(arg.default)))
|
|
483
|
+
throw new SpecError(`Argument '${arg.name}' has a default outside the built-in runtime limits.`);
|
|
484
|
+
}
|
|
485
|
+
const warnings = markdown ? checkPlaceholders(markdown, args).warnings : [];
|
|
486
|
+
const spec = { runtime: "builtin-v1", name, tools, ...(args.length ? { arguments: args } : {}) };
|
|
487
|
+
scanForCredentials("agent", spec);
|
|
488
|
+
const payload = {
|
|
489
|
+
name, module: opts.scope ?? "agents", qualname: opts.qualname ?? snake(name), kind: "agent",
|
|
490
|
+
description: opts.description,
|
|
491
|
+
...(opts.instructionNote
|
|
492
|
+
? { content: { instructionNoteId: opts.instructionNote.toLowerCase(), skills } }
|
|
493
|
+
: { markdown }),
|
|
494
|
+
projects: projectSlugs(opts.project), metadata: { agent: spec },
|
|
495
|
+
};
|
|
496
|
+
if (opts.dryRun) {
|
|
497
|
+
emitJson({ status: "dry-run", agentName: name, payload, warnings });
|
|
498
|
+
return 0;
|
|
499
|
+
}
|
|
500
|
+
const c = await ctx(opts.namespace);
|
|
501
|
+
if (!c)
|
|
502
|
+
return 1;
|
|
503
|
+
if (!opts.json)
|
|
504
|
+
for (const message of warnings)
|
|
505
|
+
warn(message);
|
|
506
|
+
try {
|
|
507
|
+
const row = await requestJson(c.remote, `/namespaces/${encodeURIComponent(c.ns)}/runnables`, { method: "POST", token: c.token, json: payload });
|
|
508
|
+
const href = `https://dreamlake.ai/${encodeURIComponent(c.ns)}/agents?agent=${encodeURIComponent(row.id)}`;
|
|
509
|
+
if (opts.json)
|
|
510
|
+
emitJson({ status: "created", id: row.id, agentName: name, href });
|
|
511
|
+
else
|
|
512
|
+
ok(`Created agent ${name}. Open ${href}`);
|
|
513
|
+
return 0;
|
|
514
|
+
}
|
|
515
|
+
catch (error) {
|
|
516
|
+
if (error instanceof HttpError && error.status === 409 && opts.ifExists === "ok") {
|
|
517
|
+
if (opts.json)
|
|
518
|
+
emitJson({ status: "exists", agentName: name });
|
|
519
|
+
else
|
|
520
|
+
ok(`Agent ${name} already exists.`);
|
|
521
|
+
return 0;
|
|
522
|
+
}
|
|
523
|
+
fail(error instanceof Error ? error.message : String(error));
|
|
524
|
+
return 1;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
414
527
|
// ─── registration ────────────────────────────────────────────────────────────
|
|
415
528
|
export function registerAgentsCommand(program) {
|
|
416
529
|
const agents = program
|
|
@@ -423,9 +536,13 @@ export function registerAgentsCommand(program) {
|
|
|
423
536
|
.description("declare an agent from a Claude agent file, a heredoc, or $EDITOR")
|
|
424
537
|
.argument("[name]", "the agent's name, kebab-case. Omit it and one is generated.")
|
|
425
538
|
// ── where the prose comes from ──
|
|
426
|
-
.option("--file <path>", "
|
|
539
|
+
.option("--file <path>", "Claude agent file, or plain Markdown with builtin-v1. '-' reads stdin.")
|
|
427
540
|
.option("--edit", "open $EDITOR on a scaffold and declare what you save")
|
|
428
541
|
.option("--prompt <text>", "the prompt inline, for one-liners")
|
|
542
|
+
.option("--runtime <runtime>", "builtin-v1 for the DreamLake assistant, or claude (default)")
|
|
543
|
+
.option("--instruction-note <id>", "main instruction Note; selects builtin-v1 unless --runtime is given")
|
|
544
|
+
.option("--skill-note <id>", "optional skill Note (repeatable, requires --instruction-note)", collect, [])
|
|
545
|
+
.option("--skill-folder <id>", "optional skill folder (repeatable, requires --instruction-note)", collect, [])
|
|
429
546
|
// ── Claude's fields ──
|
|
430
547
|
.option("--name <kebab>", "the agent's name, if it is not in the file or the argument")
|
|
431
548
|
.option("--description <text>", "one line on WHEN to use this agent")
|
|
@@ -445,7 +562,7 @@ export function registerAgentsCommand(program) {
|
|
|
445
562
|
// ── identity + write ──
|
|
446
563
|
.option("--scope <name>", "override the repo scope it is stored under (default: the repo you are in)")
|
|
447
564
|
.option("--qualname <name>", "override the stored leaf name (default: snake_case of the agent name)")
|
|
448
|
-
.option("--project <slug>", "
|
|
565
|
+
.option("--project <slug>", "project slug (repeatable): builtin-v1 files the resource; claude stores affiliation", collect, [])
|
|
449
566
|
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
450
567
|
.option("--if-exists <mode>", "what a 409 means: fail (default) | ok", "fail")
|
|
451
568
|
.option("--dry-run", "resolve, validate and print — send no request at all")
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Generated by docs/scripts/gen-help-examples.mjs. Edit docs code blocks with cli-help metadata.
|
|
2
2
|
export const helpExamples = {
|
|
3
|
+
"agents create": "dreamlake agents create reviewer --runtime builtin-v1 \\\n --prompt 'Read the evidence and summarize it with citations.' \\\n --tools dreamlake_notes_read --project dreamlake --namespace fortyfive\n\n# Existing Note/folder IDs; references remain live and are authorized per caller.\ndreamlake agents create researcher --instruction-note \"$MAIN_NOTE_ID\" \\\n --skill-note \"$SKILL_NOTE_ID\" --skill-folder \"$SKILLS_FOLDER_ID\" \\\n --project dreamlake --namespace fortyfive",
|
|
3
4
|
"agents list": "dreamlake agents list --namespace my-workspace\n# Stable text, even in a terminal; redirected output also defaults to text.\ndreamlake agents list --namespace my-workspace --plain\n# Prefixes match the beginning of a scoped agent name or registry ID.\ndreamlake agents list --prefix my_repo. --project research",
|
|
4
5
|
"agents show": "dreamlake agents show my_repo.tri --namespace my-workspace",
|
|
5
6
|
"agents edit": "dreamlake agents edit my_repo.tri --namespace my-workspace\n# Browser form: follow the localhost URL printed by the command.\ndreamlake agents edit my_repo.tri --namespace my-workspace --web",
|
|
@@ -55,6 +56,7 @@ export const helpExamples = {
|
|
|
55
56
|
"hosts upgrade": "dreamlake hosts upgrade geyang/dev/worker --nymph-version 0.1.32 --dry-run\ndreamlake hosts upgrade geyang/dev/worker --nymph-version 0.1.32\ndreamlake hosts upgrade 'geyang/lab/*' --nymph-version 0.1.32 --concurrency 4 --max-failures 2\ndreamlake hosts upgrade --all --namespace geyang --nymph-version 0.1.32 --json",
|
|
56
57
|
"hosts rollback": "dreamlake hosts rollback geyang/dev/worker\ndreamlake hosts rollback geyang/dev/worker --upgrade-id 20261029-001 --json",
|
|
57
58
|
"hosts move": "dreamlake hosts move HOST_ID --namespace alice --to acme --dry-run --json",
|
|
59
|
+
"hosts rename": "dreamlake hosts rename HOST_ID --name fortyfive/bos14/bos14-ctrl/geyang --expected-name fortyfive/bos14/bos14-ctrl-geyang",
|
|
58
60
|
"infra list": "dreamlake infra list --namespace fortyfive --project dreamlake-infra --json",
|
|
59
61
|
"infra status": "dreamlake infra status da8e49cf-1b37-446f-9494-9620faf3192d --json",
|
|
60
62
|
"infra connect": "dreamlake infra connect da8e49cf-1b37-446f-9494-9620faf3192d",
|
package/dist/cli/hosts/api.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parseSshUsage, sshLimitMessage } from './ssh-usage.js';
|
|
1
2
|
import { resolveRemote, resolveToken } from "../config.js";
|
|
2
3
|
const SAFE_POWER_CODES = new Set([
|
|
3
4
|
"host_move_blocked", "move_preview_conflict", "catalog_revision_conflict", "move_conflict", "move_busy", "enrollment_moved", "connection_access_denied",
|
|
@@ -38,6 +39,8 @@ export async function hostRequest(path, method = "GET", body, connection) {
|
|
|
38
39
|
// Do not echo backend errors that may contain grants or credentials.
|
|
39
40
|
if (!result.ok) {
|
|
40
41
|
const data = await result.json().catch(() => ({}));
|
|
42
|
+
if (result.status === 429 && data.error === 'session_limit')
|
|
43
|
+
throw new HostApiError(sshLimitMessage(parseSshUsage(data.usage)), 429, undefined, undefined, 'session_limit');
|
|
41
44
|
const operationId = typeof data.operationId === "string" && /^[a-f0-9]{24}$/i.test(data.operationId) ? data.operationId : undefined;
|
|
42
45
|
const retryAt = typeof data.retryAt === "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(data.retryAt) && Number.isFinite(Date.parse(data.retryAt)) ? data.retryAt : undefined;
|
|
43
46
|
// A busy control plane refused the write before running it, so the caller may resubmit after Retry-After.
|
package/dist/cli/hosts/config.js
CHANGED
|
@@ -165,13 +165,13 @@ export function resolveEnrollment(opts) {
|
|
|
165
165
|
const p = string(prefix, "prefix").split("/");
|
|
166
166
|
if (p.length !== 2 || !p.every(s => segment.test(s)))
|
|
167
167
|
throw new Error("prefix must be namespace/group");
|
|
168
|
-
if (parts.length
|
|
169
|
-
parts = [...p,
|
|
168
|
+
if (parts.length <= 2)
|
|
169
|
+
parts = [...p, ...parts];
|
|
170
170
|
else if (parts.slice(0, 2).join("/") !== p.join("/"))
|
|
171
171
|
throw new Error("name and prefix conflict");
|
|
172
172
|
}
|
|
173
|
-
if (parts.length
|
|
174
|
-
throw new Error("name must be namespace/group/host, or use --prefix namespace/group with --name host; wildcards are not enrollment names");
|
|
173
|
+
if (![3, 4].includes(parts.length) || !parts.slice(0, 3).every(s => segment.test(s)) || (parts.length === 4 && !/^[A-Za-z_][A-Za-z0-9_.-]{0,63}\$?$/.test(parts[3])))
|
|
174
|
+
throw new Error("name must be namespace/group/host[/user], or use --prefix namespace/group with --name host; wildcards are not enrollment names");
|
|
175
175
|
if (local)
|
|
176
176
|
return { name: parts.join("/"), webTerminal, namespace: parts[0], group: parts[1], hostName: parts[2], local: true };
|
|
177
177
|
const args = opts.ssh !== undefined ? validateSshArguments(splitSshArguments(opts.ssh)) : structuredSsh(config.ssh);
|
package/dist/cli/hosts/enroll.js
CHANGED
|
@@ -18,6 +18,8 @@ export async function enrollHost(plan, opts, deps = {}) {
|
|
|
18
18
|
const probe = await bootstrap({ action: "probe", name: plan.name, managedAccess: opts.managedAccess === true });
|
|
19
19
|
if (typeof probe.unixUser !== "string" || !probe.unixUser || typeof probe.publicKey !== "string" || !/^[A-Za-z0-9_-]{43}$/.test(probe.publicKey))
|
|
20
20
|
throw new Error("Remote host returned invalid identity");
|
|
21
|
+
if (plan.name.split("/").length === 4 && plan.name.split("/")[3] !== probe.unixUser)
|
|
22
|
+
throw new Error("Host path user must match the enrolled Unix user");
|
|
21
23
|
const response = await request(`${hostApiPath(plan.namespace)}/enrollments`, "POST", {
|
|
22
24
|
name: plan.name, unixUser: probe.unixUser, publicKey: probe.publicKey,
|
|
23
25
|
requestId,
|
|
@@ -63,8 +65,8 @@ export async function hostStatus(selector, opts = {}, request = hostRequest) {
|
|
|
63
65
|
return request(`${hostApiPath(namespace)}/${selector.toLowerCase()}`);
|
|
64
66
|
}
|
|
65
67
|
const parts = selector.split("/");
|
|
66
|
-
if (parts.length
|
|
67
|
-
throw new Error("Host selector must be a 24-character host ID, namespace/group/host or namespace/group/*");
|
|
68
|
+
if (![3, 4].includes(parts.length) || !parts.slice(0, 2).every(s => /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(s)) || !(parts[2] === "*" && parts.length === 3 || /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(parts[2])) || (parts.length === 4 && !/^[A-Za-z_][A-Za-z0-9_.-]{0,63}\$?$/.test(parts[3])))
|
|
69
|
+
throw new Error("Host selector must be a 24-character host ID, namespace/group/host[/user] or namespace/group/*");
|
|
68
70
|
if (opts.namespace !== undefined && opts.namespace !== parts[0])
|
|
69
71
|
throw new Error("--namespace conflicts with the host selector");
|
|
70
72
|
const prefix = `${parts[0]}/${parts[1]}`;
|
package/dist/cli/hosts/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { registerHostRenameCommand } from './rename.js';
|
|
1
2
|
import { registerHostMoveCommand } from './move.js';
|
|
2
3
|
import { collectionList } from "../collection-list.js";
|
|
3
4
|
import { inspectHostCatalog, changeHostCatalog, formatHostCatalog } from "./catalog.js";
|
|
@@ -98,7 +99,7 @@ export function registerHostsCommand(program) {
|
|
|
98
99
|
group
|
|
99
100
|
.command("enroll")
|
|
100
101
|
.description("install and enroll nymph locally or through SSH, then verify its connection; readable text by default, JSON with --json")
|
|
101
|
-
.option("-n, --name <name>", "namespace/group/host, or host with --prefix")
|
|
102
|
+
.option("-n, --name <name>", "namespace/group/host[/user], or host with --prefix")
|
|
102
103
|
.option("-p, --prefix <namespace/group>", "prefix for the host name")
|
|
103
104
|
.option("--local", "register this Linux or macOS computer as the current user without SSH")
|
|
104
105
|
.option("--ssh <arguments>", "SSH destination or quoted SSH arguments followed by destination")
|
|
@@ -154,7 +155,7 @@ export function registerHostsCommand(program) {
|
|
|
154
155
|
}
|
|
155
156
|
});
|
|
156
157
|
group.command("enrollments").description("inspect enrollment identities and observed presence for one host; read-only")
|
|
157
|
-
.argument("<selector>", "host ID or namespace/group/host")
|
|
158
|
+
.argument("<selector>", "host ID or namespace/group/host[/user]")
|
|
158
159
|
.option("--namespace <namespace>", "namespace for a host ID (default: selected CLI namespace, otherwise personal)")
|
|
159
160
|
.option("--json", "emit machine-readable enrollment details and observed presence freshness")
|
|
160
161
|
.action(async (selector, opts) => {
|
|
@@ -173,7 +174,7 @@ export function registerHostsCommand(program) {
|
|
|
173
174
|
}
|
|
174
175
|
});
|
|
175
176
|
group.command("metrics").description("read timestamped CPU, RAM, and disk observations for one enrollment")
|
|
176
|
-
.argument("<selector>", "host ID or namespace/group/host")
|
|
177
|
+
.argument("<selector>", "host ID or namespace/group/host[/user]")
|
|
177
178
|
.requiredOption("--enrollment <id>", "exact enrollment ID from hosts enrollments")
|
|
178
179
|
.option("--namespace <namespace>", "namespace for a host ID (default: selected CLI namespace, otherwise personal)")
|
|
179
180
|
.option("--resolution <seconds>", "history resolution: 10, 60, 900, or 3600 seconds", "60")
|
|
@@ -193,7 +194,7 @@ export function registerHostsCommand(program) {
|
|
|
193
194
|
}
|
|
194
195
|
});
|
|
195
196
|
group.command("check").description("read observed action capability for one enrollment; does not execute the action")
|
|
196
|
-
.argument("<selector>", "host ID or namespace/group/host")
|
|
197
|
+
.argument("<selector>", "host ID or namespace/group/host[/user]")
|
|
197
198
|
.requiredOption("--enrollment <id>", "exact enrollment ID from hosts enrollments")
|
|
198
199
|
.requiredOption("--action <action>", "ssh or tracked-run (ordinary uv-run/uvx)")
|
|
199
200
|
.option("--namespace <namespace>", "namespace for a host ID (default: selected CLI namespace, otherwise personal)")
|
|
@@ -255,7 +256,7 @@ export function registerHostsCommand(program) {
|
|
|
255
256
|
});
|
|
256
257
|
}
|
|
257
258
|
group.command("status").description("inspect a host's backend-reported connection and enrollments")
|
|
258
|
-
.argument("<selector>", "host ID, namespace/group/host or quoted namespace/group/*")
|
|
259
|
+
.argument("<selector>", "host ID, namespace/group/host[/user] or quoted namespace/group/*")
|
|
259
260
|
.option("--namespace <namespace>", "namespace for a host ID (default: selected CLI namespace, otherwise personal)")
|
|
260
261
|
.option("--page <number>", "group listing page (default 1)")
|
|
261
262
|
.option("--page-size <number>", "listing page size (default 100, maximum 100)")
|
|
@@ -278,6 +279,7 @@ export function registerHostsCommand(program) {
|
|
|
278
279
|
});
|
|
279
280
|
registerHostSshCommands(group, program);
|
|
280
281
|
registerHostMoveCommand(group);
|
|
282
|
+
registerHostRenameCommand(group);
|
|
281
283
|
registerHostLifecycleCommands(group);
|
|
282
284
|
registerHostUpgradeCommands(group);
|
|
283
285
|
}
|
|
@@ -55,7 +55,7 @@ export interface HostMatches {
|
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* Hosts whose ID or name contains the keyword, case-insensitively, best match first. A
|
|
58
|
-
* `namespace/group/host` selector that matches nothing as a whole falls back to its last segment.
|
|
58
|
+
* `namespace/group/host[/user]` selector that matches nothing as a whole falls back to its last segment.
|
|
59
59
|
*/
|
|
60
60
|
export declare function matchHosts(hosts: HostSummary[], selector: string): HostMatches;
|
|
61
61
|
/**
|
|
@@ -107,7 +107,7 @@ function matchRank(host, needle) {
|
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* Hosts whose ID or name contains the keyword, case-insensitively, best match first. A
|
|
110
|
-
* `namespace/group/host` selector that matches nothing as a whole falls back to its last segment.
|
|
110
|
+
* `namespace/group/host[/user]` selector that matches nothing as a whole falls back to its last segment.
|
|
111
111
|
*/
|
|
112
112
|
export function matchHosts(hosts, selector) {
|
|
113
113
|
const keywords = [...new Set([selector, selector.split("/").filter(Boolean).at(-1) ?? ""].filter(Boolean))];
|
|
@@ -73,7 +73,7 @@ export function formatHostPower(result) {
|
|
|
73
73
|
}
|
|
74
74
|
export function registerHostLifecycleCommands(group) {
|
|
75
75
|
registerProviderLaunchCommand(group, "create");
|
|
76
|
-
const common = (command) => command.argument("<selector>", "host ID or namespace/group/host")
|
|
76
|
+
const common = (command) => command.argument("<selector>", "host ID or namespace/group/host[/user]")
|
|
77
77
|
.option("--namespace <namespace>", "namespace for a host ID")
|
|
78
78
|
.option("--json", "emit the full structured receipt");
|
|
79
79
|
const execute = async (opts, work) => {
|
|
@@ -7,8 +7,8 @@ async function enrollmentTarget(selector, opts, request) {
|
|
|
7
7
|
throw new Error("--enrollment must be a 24-character enrollment ID");
|
|
8
8
|
if (selector.includes("*"))
|
|
9
9
|
throw new Error("Select one host by ID or full name; wildcards are not supported");
|
|
10
|
-
if (!/^[a-f0-9]{24}$/i.test(selector) && !(selector.split("/").length
|
|
11
|
-
throw new Error("Host selector must be a 24-character host ID or namespace/group/host");
|
|
10
|
+
if (!/^[a-f0-9]{24}$/i.test(selector) && !([3, 4].includes(selector.split("/").length) && selector.split("/").slice(0, 3).every(part => /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(part)) && (selector.split("/").length === 3 || /^[A-Za-z_][A-Za-z0-9_.-]{0,63}\$?$/.test(selector.split("/")[3])))) {
|
|
11
|
+
throw new Error("Host selector must be a 24-character host ID or namespace/group/host[/user]");
|
|
12
12
|
}
|
|
13
13
|
const namespace = await resolveHostNamespace(selector.includes("/") ? selector.split("/")[0] : opts.namespace);
|
|
14
14
|
let hostId;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import { hostRequest } from './api.js';
|
|
3
|
+
export declare function renameHost(hostId: string, opts: {
|
|
4
|
+
namespace?: string;
|
|
5
|
+
name: string;
|
|
6
|
+
expectedName: string;
|
|
7
|
+
}, request?: typeof hostRequest): Promise<any>;
|
|
8
|
+
export declare function registerHostRenameCommand(group: Command): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { hostApiPath, hostRequest } from './api.js';
|
|
2
|
+
import { resolveEnrollment } from './config.js';
|
|
3
|
+
import { resolveHostNamespace } from './inventory.js';
|
|
4
|
+
export async function renameHost(hostId, opts, request = hostRequest) {
|
|
5
|
+
if (!/^[a-f0-9]{24}$/.test(hostId))
|
|
6
|
+
throw new Error('Use an exact lowercase Host ID');
|
|
7
|
+
const plan = resolveEnrollment({ local: true, name: opts.name });
|
|
8
|
+
const previous = resolveEnrollment({ local: true, name: opts.expectedName });
|
|
9
|
+
const namespace = opts.namespace ?? plan.namespace;
|
|
10
|
+
if (plan.namespace !== namespace || previous.namespace !== namespace)
|
|
11
|
+
throw new Error('Rename must stay in the same namespace; use hosts move to change namespaces');
|
|
12
|
+
await resolveHostNamespace(namespace);
|
|
13
|
+
const result = await request(`${hostApiPath(namespace)}/${hostId}/rename`, 'POST', { name: plan.name, expectedName: previous.name });
|
|
14
|
+
if (result?.host?.id !== hostId || result?.host?.name !== plan.name || result?.executionAffected !== false)
|
|
15
|
+
throw new Error('Invalid rename receipt; reconcile before retrying');
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
export function registerHostRenameCommand(group) {
|
|
19
|
+
group.command('rename').description('rename an owned host in place, preserving its enrollment and keys')
|
|
20
|
+
.argument('<host-id>', 'exact lowercase Host ID').requiredOption('--name <name>', 'new namespace/group/host/user name')
|
|
21
|
+
.requiredOption('--expected-name <name>', 'current name; reused unchanged after an uncertain response')
|
|
22
|
+
.option('--namespace <namespace>').option('--json').action(async (id, opts) => {
|
|
23
|
+
try {
|
|
24
|
+
const result = await renameHost(id, opts);
|
|
25
|
+
console.log(opts.json ? JSON.stringify(result, null, 2) : `Renamed host: ${result.host.name}`);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error(error instanceof Error ? error.message : 'Host rename failed');
|
|
29
|
+
process.exitCode = 1;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface SshUsage {
|
|
2
|
+
sessions: {
|
|
3
|
+
used: number;
|
|
4
|
+
limit: number;
|
|
5
|
+
};
|
|
6
|
+
tunnels: {
|
|
7
|
+
used: number;
|
|
8
|
+
limit: number;
|
|
9
|
+
};
|
|
10
|
+
namespace: {
|
|
11
|
+
used: number;
|
|
12
|
+
limit: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** Copy only validated numeric quota fields, never upstream text or credentials. */
|
|
16
|
+
export declare function parseSshUsage(value: unknown): SshUsage | undefined;
|
|
17
|
+
export declare function sshLimitMessage(usage?: SshUsage): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Copy only validated numeric quota fields, never upstream text or credentials. */
|
|
2
|
+
export function parseSshUsage(value) {
|
|
3
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
4
|
+
return undefined;
|
|
5
|
+
const result = {};
|
|
6
|
+
for (const key of ['sessions', 'tunnels', 'namespace']) {
|
|
7
|
+
const pair = value[key];
|
|
8
|
+
if (!pair || typeof pair !== 'object' || !Number.isSafeInteger(pair.used) || pair.used < 0 ||
|
|
9
|
+
!Number.isSafeInteger(pair.limit) || pair.limit < 1 || pair.limit > 4096)
|
|
10
|
+
return undefined;
|
|
11
|
+
result[key] = { used: pair.used, limit: pair.limit };
|
|
12
|
+
}
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
export function sshLimitMessage(usage) {
|
|
16
|
+
if (!usage)
|
|
17
|
+
return 'SSH session limit reached. Close an unused SSH connection or tunnel, then retry.';
|
|
18
|
+
return `SSH session limit reached. This host: ${usage.sessions.used} of ${usage.sessions.limit} SSH sessions and ${usage.tunnels.used} of ${usage.tunnels.limit} tunnels in use. Namespace total: ${usage.namespace.used} of ${usage.namespace.limit}. Close an unused connection or tunnel, then retry.`;
|
|
19
|
+
}
|
package/dist/cli/hosts/ssh.js
CHANGED
|
@@ -41,7 +41,7 @@ export function isHostLookupMiss(error) {
|
|
|
41
41
|
*/
|
|
42
42
|
export async function suggestionInventory(selector, opts, io = defaultSshIO) {
|
|
43
43
|
const parts = selector.split('/');
|
|
44
|
-
const namespace = parts.length
|
|
44
|
+
const namespace = [3, 4].includes(parts.length) && /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(parts[0]) && !opts.namespace ? parts[0] : await resolveHostNamespace(opts.namespace);
|
|
45
45
|
return listHosts({ namespace, all: true }, io.request);
|
|
46
46
|
}
|
|
47
47
|
/** The `hosts list` table filtered to the selector's keyword, with every match highlighted, for a terminal reader who cannot type back. */
|
|
@@ -350,7 +350,7 @@ export function registerHostSshCommands(hosts, program) {
|
|
|
350
350
|
for (const parent of [hosts, program])
|
|
351
351
|
for (const name of ['ssh', 'exec']) {
|
|
352
352
|
const c = parent.command(name).description(name === 'ssh' ? 'open a pinned SSH shell through the enrolled Nymph relay' : 'run a command over SSH; stream output and return its exit code')
|
|
353
|
-
.argument('<host>', 'host ID or namespace/group/host').option('--namespace <slug>').option('--enrollment <id>', 'select an exact SSH enrollment')
|
|
353
|
+
.argument('<host>', 'host ID or namespace/group/host[/user]').option('--namespace <slug>').option('--enrollment <id>', 'select an exact SSH enrollment')
|
|
354
354
|
.option('--duration <seconds>', 'maximum session lifetime (120–1800)', '1800').option('--timeout <seconds>', 'close after this many seconds; does not guarantee detached process termination');
|
|
355
355
|
if (name === 'exec')
|
|
356
356
|
c.argument('<command...>', 'command and literal arguments after --');
|
|
@@ -92,7 +92,7 @@ const resolveDefaults = { status: hostStatus, list: listHosts, namespace: resolv
|
|
|
92
92
|
/** Expands selectors into distinct hosts, in order. A host appears at most once. */
|
|
93
93
|
export async function resolveFleetHosts(selectors, opts, deps = resolveDefaults) {
|
|
94
94
|
if (opts.all ? selectors.length > 0 : selectors.length === 0)
|
|
95
|
-
throw new Error("Select hosts by ID, namespace/group/host or namespace/group/*, or use --all (not both)");
|
|
95
|
+
throw new Error("Select hosts by ID, namespace/group/host[/user] or namespace/group/*, or use --all (not both)");
|
|
96
96
|
const hosts = [];
|
|
97
97
|
const seen = new Set();
|
|
98
98
|
const add = (host, namespace, enrollments = host.enrollments) => {
|
|
@@ -121,10 +121,10 @@ export async function resolveFleetHosts(selectors, opts, deps = resolveDefaults)
|
|
|
121
121
|
}
|
|
122
122
|
if (selector.includes("*"))
|
|
123
123
|
throw new Error("Wildcards select a whole group: namespace/group/*");
|
|
124
|
-
if (parts.length
|
|
124
|
+
if ([3, 4].includes(parts.length) && opts.namespace !== undefined && opts.namespace !== parts[0])
|
|
125
125
|
throw new Error("--namespace conflicts with the host selector");
|
|
126
|
-
const namespace = parts.length
|
|
127
|
-
const detail = await deps.status(selector, { namespace: parts.length
|
|
126
|
+
const namespace = [3, 4].includes(parts.length) ? parts[0] : await deps.namespace(opts.namespace);
|
|
127
|
+
const detail = await deps.status(selector, { namespace: [3, 4].includes(parts.length) ? undefined : namespace });
|
|
128
128
|
add(detail?.host, namespace, detail?.enrollments);
|
|
129
129
|
}
|
|
130
130
|
return hosts;
|
|
@@ -343,7 +343,7 @@ export async function runHostsUpgrade(selectors, opts, overrides = {}) {
|
|
|
343
343
|
}
|
|
344
344
|
export function registerHostUpgradeCommands(group) {
|
|
345
345
|
const common = (command) => command
|
|
346
|
-
.argument("[selectors...]", "host IDs, namespace/group/host, or quoted namespace/group/*")
|
|
346
|
+
.argument("[selectors...]", "host IDs, namespace/group/host[/user], or quoted namespace/group/*")
|
|
347
347
|
.option("--all", "every host in --namespace (offline hosts are reported as skipped)")
|
|
348
348
|
.option("--namespace <namespace>", "namespace for --all and host IDs (default: signed-in personal namespace)")
|
|
349
349
|
.option("--enrollment <id>", "exact SSH enrollment when one host has several")
|
package/dist/cli/nymph/index.js
CHANGED
|
@@ -306,7 +306,7 @@ export function editConfig(c, opts, inspect = invoke) {
|
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
export function registerNymphCommand(program) {
|
|
309
|
-
const root = program.command("nymph").description("Nymph overview: local configuration, separate access permissions and service observations").option("--name <namespace/group/host>", "select this computer's managed enrollment").option("--json", "emit JSON").action(opts => renderOverview(context(opts.name), opts.json));
|
|
309
|
+
const root = program.command("nymph").description("Nymph overview: local configuration, separate access permissions and service observations").option("--name <namespace/group/host[/user]>", "select this computer's managed enrollment").option("--json", "emit JSON").action(opts => renderOverview(context(opts.name), opts.json));
|
|
310
310
|
root.enablePositionalOptions();
|
|
311
311
|
// Enrollment selectors apply throughout the subtree. Never silently fall
|
|
312
312
|
// back to the default profile when a parent selected another enrollment.
|
|
@@ -323,16 +323,16 @@ export function registerNymphCommand(program) {
|
|
|
323
323
|
if (selected !== undefined)
|
|
324
324
|
action.setOptionValueWithSource("name", selected, "cli");
|
|
325
325
|
});
|
|
326
|
-
root.command("setup").description("enable a background service with upload and command execution denied initially").option("--name <namespace/group/host>").option("--lakeshore-id <id>").action(async (opts) => { console.log(JSON.stringify(await setup(context(opts.name), opts), null, 2)); });
|
|
327
|
-
const config = root.command("config").description("inspect redacted service configuration without reading credentials").option("--name <namespace/group/host>").action(opts => { console.log(JSON.stringify(overview(context(opts.name)).configuration, null, 2)); });
|
|
326
|
+
root.command("setup").description("enable a background service with upload and command execution denied initially").option("--name <namespace/group/host[/user]>").option("--lakeshore-id <id>").action(async (opts) => { console.log(JSON.stringify(await setup(context(opts.name), opts), null, 2)); });
|
|
327
|
+
const config = root.command("config").description("inspect redacted service configuration without reading credentials").option("--name <namespace/group/host[/user]>").action(opts => { console.log(JSON.stringify(overview(context(opts.name)).configuration, null, 2)); });
|
|
328
328
|
config.enablePositionalOptions();
|
|
329
|
-
config.command("set").description("edit service pacing; access permissions remain unchanged").option("--name <namespace/group/host>").option("--poll-seconds <seconds>").option("--max-invocations <count>").action(opts => { const c = context(opts.name); editConfig(c, opts); console.log(`Configuration saved for ${c.name}; restart this enrollment to apply. Access permissions unchanged.`); });
|
|
329
|
+
config.command("set").description("edit service pacing; access permissions remain unchanged").option("--name <namespace/group/host[/user]>").option("--poll-seconds <seconds>").option("--max-invocations <count>").action(opts => { const c = context(opts.name); editConfig(c, opts); console.log(`Configuration saved for ${c.name}; restart this enrollment to apply. Access permissions unchanged.`); });
|
|
330
330
|
const access = root.command("access").description("manage local consent separately from server authorization");
|
|
331
|
-
access.command("show").option("--name <namespace/group/host>").action(opts => console.log(JSON.stringify(overview(context(opts.name)).access, null, 2)));
|
|
331
|
+
access.command("show").option("--name <namespace/group/host[/user]>").action(opts => console.log(JSON.stringify(overview(context(opts.name)).access, null, 2)));
|
|
332
332
|
for (const [verb, allow] of [["grant", true], ["revoke", false]])
|
|
333
|
-
access.command(`${verb} <tool>`).description(`${verb} automatic upload or command-execution consent; restart required`).option("--name <namespace/group/host>").option("--yes", "explicitly approve this one permission").action(async (tool, opts) => { const c = context(opts.name); if (await setPermission(c, tool, allow, opts.yes))
|
|
333
|
+
access.command(`${verb} <tool>`).description(`${verb} automatic upload or command-execution consent; restart required`).option("--name <namespace/group/host[/user]>").option("--yes", "explicitly approve this one permission").action(async (tool, opts) => { const c = context(opts.name); if (await setPermission(c, tool, allow, opts.yes))
|
|
334
334
|
console.log(`Access saved for ${c.name}. Restart this enrollment to apply; the running daemon has not changed yet.`); });
|
|
335
|
-
root.command("restart").description("restart only the selected managed enrollment to apply configuration and access").option("--name <namespace/group/host>").action(opts => {
|
|
335
|
+
root.command("restart").description("restart only the selected managed enrollment to apply configuration and access").option("--name <namespace/group/host[/user]>").action(opts => {
|
|
336
336
|
const c = context(opts.name), p = locations(c);
|
|
337
337
|
if (!readPrivate(p.record))
|
|
338
338
|
throw new Error("No managed enrollment selected");
|
|
@@ -349,7 +349,7 @@ export function registerProviderLaunchCommand(parent, name = "launch") {
|
|
|
349
349
|
.option("--no-web-terminal", "launch without browser SSH access")
|
|
350
350
|
.option("--wait-seconds <seconds>", "wait for enrollment and web terminal setup (default 300)")
|
|
351
351
|
.option("--service-account <id>", "unused service account for this Nymph (default create a dedicated account)")
|
|
352
|
-
.option("--host-name <name>", "namespace/group/host name for automatic Nymph enrollment")
|
|
352
|
+
.option("--host-name <name>", "namespace/group/host[/user] name for automatic Nymph enrollment")
|
|
353
353
|
.option("--unix-user <name>", "Nymph operating-system user (default ubuntu)")
|
|
354
354
|
.option("--lakeshore-id <id>", "namespace control-plane connection for automatic enrollment")
|
|
355
355
|
.option("--layer <name>", "named layer to apply; repeat to stack layers in order", collect, [])
|
|
@@ -371,8 +371,8 @@ export function registerProviderLaunchCommand(parent, name = "launch") {
|
|
|
371
371
|
if (opts.serviceAccount !== undefined && !ID.test(opts.serviceAccount))
|
|
372
372
|
throw new Error("Invalid service account ID");
|
|
373
373
|
const parts = opts.hostName.split("/");
|
|
374
|
-
if (parts.length
|
|
375
|
-
throw new Error("Host name must be namespace/group/host in the provider namespace");
|
|
374
|
+
if (![3, 4].includes(parts.length) || parts.slice(0, 3).some((p) => !/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(p)) || (parts.length === 4 && !/^[A-Za-z_][A-Za-z0-9_.-]{0,63}\$?$/.test(parts[3])) || `/namespaces/${encodeURIComponent(parts[0])}` !== ns)
|
|
375
|
+
throw new Error("Host name must be namespace/group/host[/user] in the provider namespace");
|
|
376
376
|
if (count !== 1)
|
|
377
377
|
throw new Error("Automatic enrollment requires --count 1; each Nymph needs its own service account");
|
|
378
378
|
if (opts.unixUser !== undefined && (!/^[a-z_][a-z0-9_-]{0,31}$/.test(opts.unixUser) || opts.unixUser === "root"))
|
package/dist/cli/queues/index.js
CHANGED
|
@@ -269,7 +269,7 @@ export async function runQueuesWorkerPin(prefix, workerId, opts, deps = {}) {
|
|
|
269
269
|
const mount = await requestJson(c.remote, path, { token: c.token });
|
|
270
270
|
if (queues.length || opts.clear) {
|
|
271
271
|
if (!opts.host)
|
|
272
|
-
throw new Error("--host <namespace/group/host> is required to change a pin: you must own the worker's host");
|
|
272
|
+
throw new Error("--host <namespace/group/host[/user]> is required to change a pin: you must own the worker's host");
|
|
273
273
|
const target = await (deps.resolve ?? resolveTarget)(opts.host, opts.enrollment);
|
|
274
274
|
if (target.workerId !== workerId || target.lakeshoreId !== mount.id)
|
|
275
275
|
throw new Error(`${opts.host} is not bound to worker ${workerId} on ${prefix}`);
|
|
@@ -343,7 +343,7 @@ export function registerQueuesCommand(program) {
|
|
|
343
343
|
common(queues.command("worker-pin <prefix> <worker-id>").description("show or set which queues one owned worker claims from; nothing else is claimed while pinned")
|
|
344
344
|
.option("--queue <name>", "pin to this queue (repeatable, up to 4)", (v, prev = []) => [...prev, v])
|
|
345
345
|
.option("--clear", "remove the pin (disable the worker's job claims first)")
|
|
346
|
-
.option("--host <selector>", "namespace/group/host you own, bound to this worker (required to change the pin)")
|
|
346
|
+
.option("--host <selector>", "namespace/group/host[/user] you own, bound to this worker (required to change the pin)")
|
|
347
347
|
.option("--enrollment <id>", "the host enrollment, when it has more than one"))
|
|
348
348
|
.action(async (prefix, workerId, opts) => { process.exitCode = await runQueuesWorkerPin(prefix, workerId, opts); });
|
|
349
349
|
common(queues.command("create <prefix> <name>").description("create one queue on a mounted server (fifo, active, no pool)"))
|
package/dist/cli/run/index.js
CHANGED
|
@@ -52,7 +52,7 @@ export async function drainLogs(path, cursor, json = false) {
|
|
|
52
52
|
}
|
|
53
53
|
return { cursor: page.nextCursor, done: page.done };
|
|
54
54
|
}
|
|
55
|
-
const help = `Usage: dreamlake run --target namespace/group/host [options] --uv-run <args...>\n dreamlake run --target namespace/group/host [options] --uvx <args...>\n\nAll DreamLake options precede the execution selector; everything after it is workload argv.\n --setup <metadata.json> Pinned repository + reviewed vault mappings (private mode)\n --allow-vault-delivery Explicit consent; requires setup + enrollment, no includes\n --include <file> Explicit relative file to upload (repeatable; 100 files, 1 MiB total)\n --enrollment-id <id> Select a host enrollment when ambiguous\n --request-id <id> Stable retry ID (generated otherwise)\n --timeout-seconds <n> Remote timeout, 1–86400 (default 3600)\n --provider-id <id> Select provider with --association-id and --association-revision\n --association-id <id> Owned Slurm association (--uv-run only)\n --association-revision <n> Expected association revision\n --cpus <n> --memory-mib <n> --gpus <n> Placement resource requests\n --no-wait Return the persisted receipt after submission\n --json Output JSON receipt; use runs logs for output\n\nNo files are inferred from workload arguments. Include your script and dependencies explicitly.\nRequires a compatible server and an online nymph with tracked-run and uv capabilities.\n`;
|
|
55
|
+
const help = `Usage: dreamlake run --target namespace/group/host[/user] [options] --uv-run <args...>\n dreamlake run --target namespace/group/host[/user] [options] --uvx <args...>\n\nAll DreamLake options precede the execution selector; everything after it is workload argv.\n --setup <metadata.json> Pinned repository + reviewed vault mappings (private mode)\n --allow-vault-delivery Explicit consent; requires setup + enrollment, no includes\n --include <file> Explicit relative file to upload (repeatable; 100 files, 1 MiB total)\n --enrollment-id <id> Select a host enrollment when ambiguous\n --request-id <id> Stable retry ID (generated otherwise)\n --timeout-seconds <n> Remote timeout, 1–86400 (default 3600)\n --provider-id <id> Select provider with --association-id and --association-revision\n --association-id <id> Owned Slurm association (--uv-run only)\n --association-revision <n> Expected association revision\n --cpus <n> --memory-mib <n> --gpus <n> Placement resource requests\n --no-wait Return the persisted receipt after submission\n --json Output JSON receipt; use runs logs for output\n\nNo files are inferred from workload arguments. Include your script and dependencies explicitly.\nRequires a compatible server and an online nymph with tracked-run and uv capabilities.\n`;
|
|
56
56
|
export async function executeRun(args) {
|
|
57
57
|
const selector = args.findIndex(arg => arg === "--uv-run" || arg === "--uvx");
|
|
58
58
|
const before = selector < 0 ? args : args.slice(0, selector);
|
package/dist/cli/run/input.js
CHANGED
|
@@ -50,8 +50,8 @@ export function parseRunArgs(args) {
|
|
|
50
50
|
if (flag === "--timeout-seconds")
|
|
51
51
|
result.timeoutSeconds = Number(value);
|
|
52
52
|
}
|
|
53
|
-
if (!/^[A-Za-z0-9][A-Za-z0-9_.-]*\/[A-Za-z0-9][A-Za-z0-9_.-]*\/[A-Za-z0-9][A-Za-z0-9_.-]
|
|
54
|
-
throw new Error("--target must be namespace/group/host");
|
|
53
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9_.-]*\/[A-Za-z0-9][A-Za-z0-9_.-]*\/[A-Za-z0-9][A-Za-z0-9_.-]*(?:\/[A-Za-z_][A-Za-z0-9_.-]{0,63}\$?)?$/.test(result.target))
|
|
54
|
+
throw new Error("--target must be namespace/group/host[/user]");
|
|
55
55
|
if (!result.execution.argv.length)
|
|
56
56
|
throw new Error("Supply workload arguments after the execution selector");
|
|
57
57
|
if (result.execution.argv.some(arg => arg.includes("\0")))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// DreamLake-mediated bound executions (`--target <namespace/group/host>`).
|
|
1
|
+
// DreamLake-mediated bound executions (`--target <namespace/group/host[/user]>`).
|
|
2
2
|
//
|
|
3
3
|
// Unlike the `--server` path, no control-plane credential is used here: the
|
|
4
4
|
// DreamLake server holds the target enrollment's connection, uploads the small
|
|
@@ -35,8 +35,8 @@ function session() {
|
|
|
35
35
|
/** Host selector → owned Host, its one (or the selected) enrollment, its connection and the CP worker bound to it. */
|
|
36
36
|
export async function resolveTarget(selector, enrollment, deps = {}) {
|
|
37
37
|
const parts = selector.split("/");
|
|
38
|
-
if (parts.length
|
|
39
|
-
throw new Error("--target must be one host: namespace/group/host");
|
|
38
|
+
if (![3, 4].includes(parts.length) || selector.includes("*"))
|
|
39
|
+
throw new Error("--target must be one host: namespace/group/host[/user]");
|
|
40
40
|
const detail = await (deps.status ?? hostStatus)(selector, {});
|
|
41
41
|
const hostId = String(detail?.host?.id ?? "");
|
|
42
42
|
const rows = (detail?.enrollments ?? []).filter((e) => !enrollment || e.id === enrollment);
|
|
@@ -291,7 +291,7 @@ export function registerRunnableBound(runnable) {
|
|
|
291
291
|
runnable.command("bind <ref>")
|
|
292
292
|
.description("bind a registered UDF version to one configured snapshot and locked runtime (immutable execution binding)")
|
|
293
293
|
.option("--snapshot <id>", "24-hex configured CodeRepo id from `dreamlake snapshot` (control-plane path)")
|
|
294
|
-
.option("--target <host>", "namespace/group/host you own: build this checkout's configured archive and upload it through DreamLake (no control-plane credential)")
|
|
294
|
+
.option("--target <host>", "namespace/group/host[/user] you own: build this checkout's configured archive and upload it through DreamLake (no control-plane credential)")
|
|
295
295
|
.option("--enrollment <id>", "with --target: the host enrollment, when it has more than one")
|
|
296
296
|
.option("--config <path>", "with --target: explicit .dreamrc (default: walk up from the current directory)")
|
|
297
297
|
.requiredOption("--project <path>", "snapshot code path holding pyproject.toml, uv.lock and .python-version")
|
|
@@ -309,7 +309,7 @@ export function registerRunnableBound(runnable) {
|
|
|
309
309
|
else if (opts.target)
|
|
310
310
|
process.exitCode = await runBindViaDreamLake(ref, opts);
|
|
311
311
|
else if (!opts.snapshot) {
|
|
312
|
-
fail("pass --snapshot <CodeRepo id> (control-plane path) or --target <namespace/group/host>");
|
|
312
|
+
fail("pass --snapshot <CodeRepo id> (control-plane path) or --target <namespace/group/host[/user]>");
|
|
313
313
|
process.exitCode = 1;
|
|
314
314
|
}
|
|
315
315
|
else
|
|
@@ -328,7 +328,7 @@ export function registerRunnableBound(runnable) {
|
|
|
328
328
|
.option("--wait-seconds <s>", name === "execute" ? "client wait (default: timeout + 60)" : "client wait (default: 0, read once)")
|
|
329
329
|
.option("--server <url>", "control plane base URL (default: $LAKESHORE_URL; must equal the binding's origin)")
|
|
330
330
|
.option("--cp-namespace <slug>", "control-plane namespace (default: the binding's)")
|
|
331
|
-
.option("--target <host>", "namespace/group/host you own: run through DreamLake on that host's pinned queue (no control-plane credential)")
|
|
331
|
+
.option("--target <host>", "namespace/group/host[/user] you own: run through DreamLake on that host's pinned queue (no control-plane credential)")
|
|
332
332
|
.option("--enrollment <id>", "with --target: the host enrollment, when it has more than one")
|
|
333
333
|
.option("--json", "emit JSON");
|
|
334
334
|
if (name === "execute")
|
package/dist/cli/runnable/run.js
CHANGED
|
@@ -193,7 +193,7 @@ export async function readRegisteredReceipt(ref, request = runRequest) {
|
|
|
193
193
|
}
|
|
194
194
|
export function registerRunnableRun(runnable) {
|
|
195
195
|
runnable.command("run <ref>").description("execute one pinned registered Python module on an existing enrolled host")
|
|
196
|
-
.requiredOption("--target <namespace/group/host>", "owned same-namespace host")
|
|
196
|
+
.requiredOption("--target <namespace/group/host[/user]>", "owned same-namespace host")
|
|
197
197
|
.requiredOption("--enrollment-id <id>", "exact enrollment")
|
|
198
198
|
.requiredOption("--request-id <id>", "stable identity; reuse only for the same uncertain submission")
|
|
199
199
|
.option("--inputs <file>", 'JSON {"args": [], "kwargs": {}}; defaults to no arguments')
|
package/dist/cli/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.104.0";
|
package/dist/cli/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dreamlake/dreamlake-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.104.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dreamlake-ai/dreamlake-cli.git"
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"node": ">=18"
|
|
37
37
|
},
|
|
38
38
|
"optionalDependencies": {
|
|
39
|
-
"@dreamlake/dreamlake-cli-darwin-arm64": "0.
|
|
40
|
-
"@dreamlake/dreamlake-cli-darwin-x64": "0.
|
|
41
|
-
"@dreamlake/dreamlake-cli-linux-x64": "0.
|
|
42
|
-
"@dreamlake/dreamlake-cli-linux-arm64": "0.
|
|
43
|
-
"@dreamlake/dreamlake-cli-linux-x64-musl": "0.
|
|
44
|
-
"@dreamlake/dreamlake-cli-linux-arm64-musl": "0.
|
|
45
|
-
"@dreamlake/dreamlake-cli-win32-x64": "0.
|
|
46
|
-
"@dreamlake/dreamlake-cli-win32-arm64": "0.
|
|
39
|
+
"@dreamlake/dreamlake-cli-darwin-arm64": "0.104.0",
|
|
40
|
+
"@dreamlake/dreamlake-cli-darwin-x64": "0.104.0",
|
|
41
|
+
"@dreamlake/dreamlake-cli-linux-x64": "0.104.0",
|
|
42
|
+
"@dreamlake/dreamlake-cli-linux-arm64": "0.104.0",
|
|
43
|
+
"@dreamlake/dreamlake-cli-linux-x64-musl": "0.104.0",
|
|
44
|
+
"@dreamlake/dreamlake-cli-linux-arm64-musl": "0.104.0",
|
|
45
|
+
"@dreamlake/dreamlake-cli-win32-x64": "0.104.0",
|
|
46
|
+
"@dreamlake/dreamlake-cli-win32-arm64": "0.104.0"
|
|
47
47
|
}
|
|
48
48
|
}
|