@dreamlake/dreamlake-cli 0.102.3 → 0.103.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.
@@ -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>;
@@ -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)),
@@ -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>;
@@ -1429,6 +1433,10 @@ export declare function createClient(options: ClientOptions): {
1429
1433
  page?: number;
1430
1434
  pageSize?: number;
1431
1435
  }) => Promise<unknown>;
1436
+ rename: (id: string, input: {
1437
+ name: string;
1438
+ expectedName: string;
1439
+ }) => Promise<unknown>;
1432
1440
  status: (id: string) => Promise<unknown>;
1433
1441
  enroll: (input: import("./common.js").JsonObject) => Promise<unknown>;
1434
1442
  enrollments: (id: string) => Promise<unknown>;
@@ -55,6 +55,7 @@ export const helpExamples = {
55
55
  "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
56
  "hosts rollback": "dreamlake hosts rollback geyang/dev/worker\ndreamlake hosts rollback geyang/dev/worker --upgrade-id 20261029-001 --json",
57
57
  "hosts move": "dreamlake hosts move HOST_ID --namespace alice --to acme --dry-run --json",
58
+ "hosts rename": "dreamlake hosts rename HOST_ID --name fortyfive/bos14/bos14-ctrl/geyang --expected-name fortyfive/bos14/bos14-ctrl-geyang",
58
59
  "infra list": "dreamlake infra list --namespace fortyfive --project dreamlake-infra --json",
59
60
  "infra status": "dreamlake infra status da8e49cf-1b37-446f-9494-9620faf3192d --json",
60
61
  "infra connect": "dreamlake infra connect da8e49cf-1b37-446f-9494-9620faf3192d",
@@ -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 === 1)
169
- parts = [...p, name];
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 !== 3 || !parts.every(s => segment.test(s)))
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);
@@ -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 !== 3 || !parts.slice(0, 2).every(s => /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(s)) || !(parts[2] === "*" || /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(parts[2])))
67
- throw new Error("Host selector must be a 24-character host ID, namespace/group/host or namespace/group/*");
68
+ if (![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]}`;
@@ -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 === 3 && selector.split("/").every(part => /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(part)))) {
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
+ }
@@ -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 === 3 && /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(parts[0]) && !opts.namespace ? parts[0] : await resolveHostNamespace(opts.namespace);
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 === 3 && opts.namespace !== undefined && opts.namespace !== parts[0])
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 === 3 ? parts[0] : await deps.namespace(opts.namespace);
127
- const detail = await deps.status(selector, { namespace: parts.length === 3 ? undefined : namespace });
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")
@@ -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 !== 3 || parts.some((p) => !/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(p)) || `/namespaces/${encodeURIComponent(parts[0])}` !== ns)
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"))
@@ -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)"))
@@ -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);
@@ -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_.-]*$/.test(result.target))
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 !== 3 || selector.includes("*"))
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")
@@ -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')
@@ -1 +1 @@
1
- export declare const VERSION = "0.102.3";
1
+ export declare const VERSION = "0.103.0";
@@ -6,4 +6,4 @@
6
6
  // value means a binary that re-installs the same version forever.
7
7
  //
8
8
  // Editing this by hand does nothing for a release; bump package.json.
9
- export const VERSION = "0.102.3";
9
+ export const VERSION = "0.103.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamlake/dreamlake-cli",
3
- "version": "0.102.3",
3
+ "version": "0.103.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.102.3",
40
- "@dreamlake/dreamlake-cli-darwin-x64": "0.102.3",
41
- "@dreamlake/dreamlake-cli-linux-x64": "0.102.3",
42
- "@dreamlake/dreamlake-cli-linux-arm64": "0.102.3",
43
- "@dreamlake/dreamlake-cli-linux-x64-musl": "0.102.3",
44
- "@dreamlake/dreamlake-cli-linux-arm64-musl": "0.102.3",
45
- "@dreamlake/dreamlake-cli-win32-x64": "0.102.3",
46
- "@dreamlake/dreamlake-cli-win32-arm64": "0.102.3"
39
+ "@dreamlake/dreamlake-cli-darwin-arm64": "0.103.0",
40
+ "@dreamlake/dreamlake-cli-darwin-x64": "0.103.0",
41
+ "@dreamlake/dreamlake-cli-linux-x64": "0.103.0",
42
+ "@dreamlake/dreamlake-cli-linux-arm64": "0.103.0",
43
+ "@dreamlake/dreamlake-cli-linux-x64-musl": "0.103.0",
44
+ "@dreamlake/dreamlake-cli-linux-arm64-musl": "0.103.0",
45
+ "@dreamlake/dreamlake-cli-win32-x64": "0.103.0",
46
+ "@dreamlake/dreamlake-cli-win32-arm64": "0.103.0"
47
47
  }
48
48
  }