@dreamlake/dreamlake-cli 0.103.0 → 0.104.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/content.d.ts +42 -6
- package/dist/api/content.js +3 -0
- package/dist/api/index.d.ts +20 -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 +1 -0
- package/dist/cli/hosts/api.js +3 -0
- package/dist/cli/hosts/ssh-usage.d.ts +17 -0
- package/dist/cli/hosts/ssh-usage.js +19 -0
- package/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/package.json +9 -9
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
|
@@ -850,6 +850,13 @@ export declare function createApi(transport: Transport): {
|
|
|
850
850
|
}>;
|
|
851
851
|
};
|
|
852
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>;
|
|
853
860
|
versions: (name: string) => Promise<unknown>;
|
|
854
861
|
version: (name: string, version: string) => Promise<unknown>;
|
|
855
862
|
pushVersion: (name: string, input: {
|
|
@@ -857,12 +864,9 @@ export declare function createApi(transport: Transport): {
|
|
|
857
864
|
source: string;
|
|
858
865
|
metadata?: import("./common.js").JsonObject;
|
|
859
866
|
}) => Promise<unknown>;
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
get: (id: string) => Promise<import("./common.js").Resource>;
|
|
864
|
-
create: (input: import("./common.js").JsonObject) => Promise<import("./common.js").Resource>;
|
|
865
|
-
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>;
|
|
866
870
|
delete: (id: string) => Promise<unknown>;
|
|
867
871
|
};
|
|
868
872
|
libraries: (namespace: string) => {
|
|
@@ -1931,6 +1935,13 @@ export declare function createClient(options: ClientOptions): {
|
|
|
1931
1935
|
}>;
|
|
1932
1936
|
};
|
|
1933
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>;
|
|
1934
1945
|
versions: (name: string) => Promise<unknown>;
|
|
1935
1946
|
version: (name: string, version: string) => Promise<unknown>;
|
|
1936
1947
|
pushVersion: (name: string, input: {
|
|
@@ -1938,12 +1949,9 @@ export declare function createClient(options: ClientOptions): {
|
|
|
1938
1949
|
source: string;
|
|
1939
1950
|
metadata?: import("./common.js").JsonObject;
|
|
1940
1951
|
}) => Promise<unknown>;
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
get: (id: string) => Promise<import("./common.js").Resource>;
|
|
1945
|
-
create: (input: import("./common.js").JsonObject) => Promise<import("./common.js").Resource>;
|
|
1946
|
-
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>;
|
|
1947
1955
|
delete: (id: string) => Promise<unknown>;
|
|
1948
1956
|
};
|
|
1949
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",
|
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.
|
|
@@ -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/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.104.1";
|
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.1",
|
|
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.1",
|
|
40
|
+
"@dreamlake/dreamlake-cli-darwin-x64": "0.104.1",
|
|
41
|
+
"@dreamlake/dreamlake-cli-linux-x64": "0.104.1",
|
|
42
|
+
"@dreamlake/dreamlake-cli-linux-arm64": "0.104.1",
|
|
43
|
+
"@dreamlake/dreamlake-cli-linux-x64-musl": "0.104.1",
|
|
44
|
+
"@dreamlake/dreamlake-cli-linux-arm64-musl": "0.104.1",
|
|
45
|
+
"@dreamlake/dreamlake-cli-win32-x64": "0.104.1",
|
|
46
|
+
"@dreamlake/dreamlake-cli-win32-arm64": "0.104.1"
|
|
47
47
|
}
|
|
48
48
|
}
|