@dreamlake/dreamlake-cli 0.98.0 → 0.100.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/index.d.ts +212 -10
- package/dist/api/index.js +6 -0
- package/dist/api/native-experiments.d.ts +77 -0
- package/dist/api/native-experiments.js +31 -0
- package/dist/api/sessions.d.ts +240 -7
- package/dist/api/sessions.js +56 -1
- package/dist/api/skills.d.ts +122 -0
- package/dist/api/skills.js +220 -0
- package/dist/cli/experiments/index.js +2 -0
- package/dist/cli/experiments/native-commands.d.ts +13 -0
- package/dist/cli/experiments/native-commands.js +88 -0
- package/dist/cli/help-examples.generated.js +22 -5
- package/dist/cli/hosts/inventory.d.ts +28 -0
- package/dist/cli/hosts/inventory.js +68 -3
- package/dist/cli/hosts/picker.d.ts +34 -0
- package/dist/cli/hosts/picker.js +116 -0
- package/dist/cli/hosts/ssh.d.ts +16 -0
- package/dist/cli/hosts/ssh.js +47 -3
- package/dist/cli/index.js +2 -0
- package/dist/cli/session-affiliation.js +3 -2
- package/dist/cli/sessions/affiliation.d.ts +12 -1
- package/dist/cli/sessions/affiliation.js +37 -0
- package/dist/cli/sessions/control.d.ts +11 -0
- package/dist/cli/sessions/control.js +49 -4
- package/dist/cli/sessions/index.js +70 -17
- package/dist/cli/sessions/live.d.ts +85 -0
- package/dist/cli/sessions/live.js +258 -0
- package/dist/cli/sessions/runner/exec.d.ts +118 -6
- package/dist/cli/sessions/runner/exec.js +298 -47
- package/dist/cli/sessions/runner/native.js +4 -1
- package/dist/cli/sessions/runner/serve.d.ts +37 -2
- package/dist/cli/sessions/runner/serve.js +273 -28
- package/dist/cli/sessions/wrap.d.ts +63 -0
- package/dist/cli/sessions/wrap.js +226 -0
- package/dist/cli/skill/index.d.ts +19 -1
- package/dist/cli/skill/index.js +65 -12
- package/dist/cli/skill/read.d.ts +25 -0
- package/dist/cli/skill/read.js +65 -0
- package/dist/cli/skill/registry.d.ts +95 -0
- package/dist/cli/skill/registry.js +284 -0
- package/dist/cli/skill/reminders.js +2 -1
- package/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/** Skills registry: the server's pinned dreamlake-skills bundle, read-only.
|
|
2
|
+
*
|
|
3
|
+
* One business operation shared by three surfaces — `client.skills.read`,
|
|
4
|
+
* `dreamlake skill read` and the built-in agent's `dreamlake_skills_read` —
|
|
5
|
+
* with the same inputs, the same output fields and the same error codes.
|
|
6
|
+
* Every answer carries the bundle's `{ tag, commit }` so a caller can say
|
|
7
|
+
* which revision it read, and every content hash is verified against the
|
|
8
|
+
* skill's file index before it is returned.
|
|
9
|
+
*
|
|
10
|
+
* Server routes (dreamlake-server `routes/skills.ts`):
|
|
11
|
+
* GET /skills → SkillsList (ETag = commit)
|
|
12
|
+
* GET /skills/:skill → SkillDetail (manifest, SKILL.md body, file index)
|
|
13
|
+
* GET /skills/:skill/files/* → text/plain; ETag = content sha256; 304 on If-None-Match; 415 when binary
|
|
14
|
+
*/
|
|
15
|
+
import { createHash } from "node:crypto";
|
|
16
|
+
import { ApiError } from "./client.js";
|
|
17
|
+
/** Fields every read surface exposes. */
|
|
18
|
+
export const SKILL_READ_FIELDS = ["tag", "commit", "skill", "path", "sha256", "content", "files", "filesTotal", "filesTruncated"];
|
|
19
|
+
/** Present only when the request named a retired skill name. */
|
|
20
|
+
export const SKILL_READ_OPTIONAL_FIELDS = ["renamedFrom"];
|
|
21
|
+
/** Fields only the paged agent tool carries: the code-point window of the page. */
|
|
22
|
+
export const SKILL_READ_PAGING_FIELDS = ["start", "end", "total", "next", "complete"];
|
|
23
|
+
export const DEFAULT_SKILL_FILE = "SKILL.md";
|
|
24
|
+
/** The server's typed refusals and the status each one carries; the last two come only from the paged agent tool. */
|
|
25
|
+
export const SKILLS_ERROR_CODES = {
|
|
26
|
+
skills_unavailable: 503,
|
|
27
|
+
skills_lock_mismatch: 503,
|
|
28
|
+
skill_not_found: 404,
|
|
29
|
+
skill_file_not_found: 404,
|
|
30
|
+
skill_path_invalid: 400,
|
|
31
|
+
skill_file_binary: 415,
|
|
32
|
+
skill_result_too_large: 413,
|
|
33
|
+
skill_range_invalid: 400,
|
|
34
|
+
};
|
|
35
|
+
export const isSkillsErrorCode = (code) => typeof code === "string" && Object.hasOwn(SKILLS_ERROR_CODES, code);
|
|
36
|
+
/** A refusal the skills registry defines. `code` is the identity callers branch on. */
|
|
37
|
+
export class SkillsError extends ApiError {
|
|
38
|
+
code;
|
|
39
|
+
constructor(status, code, body = { error: code }, requestId) {
|
|
40
|
+
super(status, code, body, undefined, requestId);
|
|
41
|
+
this.code = code;
|
|
42
|
+
this.name = "SkillsError";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** Map a transport failure onto the typed refusal when it is one; other failures pass through. */
|
|
46
|
+
export function skillsFailure(error) {
|
|
47
|
+
if (error instanceof SkillsError)
|
|
48
|
+
return error;
|
|
49
|
+
if (error instanceof ApiError && isSkillsErrorCode(error.code)) {
|
|
50
|
+
return new SkillsError(error.status, error.code, error.body, error.requestId);
|
|
51
|
+
}
|
|
52
|
+
return error;
|
|
53
|
+
}
|
|
54
|
+
/** Skill names as the server validates them (`services/skillsBundle.ts`). */
|
|
55
|
+
export const SKILL_NAME = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
56
|
+
/** A relative, forward-slash path inside a skill: no `..`, no leading `/`, no empty segment. */
|
|
57
|
+
export const SKILL_FILE_PATH = /^[A-Za-z0-9._-]+(\/[A-Za-z0-9._-]+)*$/;
|
|
58
|
+
export const skillContentSha256 = (text) => createHash("sha256").update(text, "utf8").digest("hex");
|
|
59
|
+
const SHA256_HEX = /^[0-9a-f]{64}$/;
|
|
60
|
+
/** `Response.text()` drops a leading byte order mark; the ETag and the index hash the bytes with it, so the body is decoded keeping it. */
|
|
61
|
+
const utf8KeepingBom = new TextDecoder("utf-8", { ignoreBOM: true });
|
|
62
|
+
const responseText = async (response) => utf8KeepingBom.decode(await response.arrayBuffer());
|
|
63
|
+
const unquote = (etag) => (etag ?? "").replace(/^W\//, "").replace(/^"(.*)"$/, "$1");
|
|
64
|
+
export function requireSkillName(skill) {
|
|
65
|
+
if (!SKILL_NAME.test(skill))
|
|
66
|
+
throw new SkillsError(404, "skill_not_found");
|
|
67
|
+
return skill;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The path as the server resolves it (`services/skillsTar.ts` safeRelativePath):
|
|
71
|
+
* `.` segments dropped, `..` refused — so the `path` returned is the one the
|
|
72
|
+
* file index lists and the agent tool reports.
|
|
73
|
+
*/
|
|
74
|
+
export function requireSkillPath(path) {
|
|
75
|
+
if (!SKILL_FILE_PATH.test(path))
|
|
76
|
+
throw new SkillsError(400, "skill_path_invalid");
|
|
77
|
+
const parts = path.split("/").filter((segment) => segment !== ".");
|
|
78
|
+
if (parts.length === 0 || parts.includes(".."))
|
|
79
|
+
throw new SkillsError(400, "skill_path_invalid");
|
|
80
|
+
return parts.join("/");
|
|
81
|
+
}
|
|
82
|
+
function requireVersion(value) {
|
|
83
|
+
const v = value;
|
|
84
|
+
if (!v || typeof v.tag !== "string" || typeof v.commit !== "string" || !v.tag || !v.commit) {
|
|
85
|
+
throw new Error("skills registry answered without a version");
|
|
86
|
+
}
|
|
87
|
+
return { tag: v.tag, commit: v.commit };
|
|
88
|
+
}
|
|
89
|
+
function versionFromHeaders(headers, fallback) {
|
|
90
|
+
const tag = headers?.get("x-skills-tag"), commit = headers?.get("x-skills-commit");
|
|
91
|
+
if (tag && commit)
|
|
92
|
+
return { tag, commit };
|
|
93
|
+
if (fallback)
|
|
94
|
+
return fallback;
|
|
95
|
+
throw new Error("skills registry answered without a version");
|
|
96
|
+
}
|
|
97
|
+
const isPaged = (value) => !!value && typeof value === "object" && typeof value.content === "string";
|
|
98
|
+
export function skillsApi(t) {
|
|
99
|
+
const skillPath = (skill) => `/skills/${encodeURIComponent(requireSkillName(skill))}`;
|
|
100
|
+
const filePath = (skill, path) => `${skillPath(skill)}/files/${requireSkillPath(path).split("/").map(encodeURIComponent).join("/")}`;
|
|
101
|
+
/**
|
|
102
|
+
* GET one file. The route answers text/plain; a JSON answer in the agent
|
|
103
|
+
* tool's paged shape is followed through `next` so the result is always the
|
|
104
|
+
* whole file. The content is hashed and held to the ETag.
|
|
105
|
+
*/
|
|
106
|
+
async function fetchFile(skill, path, ifNoneMatch) {
|
|
107
|
+
if (!t.raw)
|
|
108
|
+
throw new Error("reading skill files needs a transport with raw responses");
|
|
109
|
+
const target = filePath(skill, path);
|
|
110
|
+
const headers = ifNoneMatch ? { "If-None-Match": ifNoneMatch } : undefined;
|
|
111
|
+
let seen;
|
|
112
|
+
const onHeaders = (h) => { seen = h; };
|
|
113
|
+
try {
|
|
114
|
+
let start = 0, content = "", etag = "";
|
|
115
|
+
let version;
|
|
116
|
+
for (;;) {
|
|
117
|
+
const response = await t.raw("GET", target, { headers, onHeaders, query: start > 0 ? { start } : undefined });
|
|
118
|
+
version = versionFromHeaders(response.headers, version);
|
|
119
|
+
etag ||= unquote(response.headers.get("etag"));
|
|
120
|
+
if (!/\bjson\b/i.test(response.headers.get("content-type") ?? "")) {
|
|
121
|
+
content += await responseText(response);
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
const page = await response.json();
|
|
125
|
+
if (!isPaged(page))
|
|
126
|
+
throw new Error("skills registry answered with neither text nor a page");
|
|
127
|
+
content += page.content;
|
|
128
|
+
if (page.complete !== false || page.next === null || page.next === undefined)
|
|
129
|
+
break;
|
|
130
|
+
if (page.next <= start)
|
|
131
|
+
throw new Error("skills registry page did not advance");
|
|
132
|
+
start = page.next;
|
|
133
|
+
}
|
|
134
|
+
const digest = skillContentSha256(content);
|
|
135
|
+
if (etag && SHA256_HEX.test(etag) && etag !== digest)
|
|
136
|
+
throw new Error(`skill file ${path} does not hash to its ETag`);
|
|
137
|
+
return { status: 200, ...version, path, sha256: digest, content };
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
if (error instanceof ApiError && error.status === 304) {
|
|
141
|
+
return { status: 304, ...versionFromHeaders(seen), path, sha256: unquote(seen?.get("etag")) || unquote(ifNoneMatch), content: null };
|
|
142
|
+
}
|
|
143
|
+
throw skillsFailure(error);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/** The pinned bundle's version, every skill's summary and the rename table. */
|
|
147
|
+
async function list() {
|
|
148
|
+
try {
|
|
149
|
+
const answer = await t.request("GET", "/skills");
|
|
150
|
+
if (!answer || !Array.isArray(answer.skills))
|
|
151
|
+
throw new Error("skills registry answered without a skill list");
|
|
152
|
+
return { version: requireVersion(answer.version), skills: answer.skills, renamed: answer.renamed ?? {} };
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
throw skillsFailure(error);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/** One skill's manifest, SKILL.md body and file index. */
|
|
159
|
+
async function skill(name) {
|
|
160
|
+
try {
|
|
161
|
+
const answer = await t.request("GET", skillPath(name));
|
|
162
|
+
if (!answer || typeof answer.body !== "string" || !Array.isArray(answer.files)) {
|
|
163
|
+
throw new Error("skills registry answered without a skill body");
|
|
164
|
+
}
|
|
165
|
+
return { ...answer, version: requireVersion(answer.version) };
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
throw skillsFailure(error);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Read one whole file of a skill — `SKILL.md` unless `path` names another —
|
|
173
|
+
* with the bundle version and the content's sha256, verified against the
|
|
174
|
+
* skill's file index. The body of `SKILL.md` comes with the index in one
|
|
175
|
+
* request; any other path is a second request for that file.
|
|
176
|
+
*/
|
|
177
|
+
async function read(input) {
|
|
178
|
+
const path = requireSkillPath(input.path ?? DEFAULT_SKILL_FILE);
|
|
179
|
+
const detail = await skill(input.skill);
|
|
180
|
+
const entry = detail.files.find((f) => f.path === path);
|
|
181
|
+
if (!entry)
|
|
182
|
+
throw new SkillsError(404, "skill_file_not_found");
|
|
183
|
+
if (!entry.text)
|
|
184
|
+
throw new SkillsError(415, "skill_file_binary");
|
|
185
|
+
let content, digest;
|
|
186
|
+
if (path === DEFAULT_SKILL_FILE) {
|
|
187
|
+
content = detail.body;
|
|
188
|
+
digest = skillContentSha256(content);
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
const file = await fetchFile(detail.name, path);
|
|
192
|
+
if (file.commit !== detail.version.commit) {
|
|
193
|
+
throw new Error(`skills bundle changed between requests (${detail.version.commit} → ${file.commit}); retry`);
|
|
194
|
+
}
|
|
195
|
+
content = file.content;
|
|
196
|
+
digest = file.sha256;
|
|
197
|
+
}
|
|
198
|
+
if (digest !== entry.sha256)
|
|
199
|
+
throw new Error(`skill file ${path} does not hash to the index sha256 ${entry.sha256}`);
|
|
200
|
+
return {
|
|
201
|
+
tag: detail.version.tag,
|
|
202
|
+
commit: detail.version.commit,
|
|
203
|
+
skill: detail.name,
|
|
204
|
+
...(detail.renamedFrom ? { renamedFrom: detail.renamedFrom } : {}),
|
|
205
|
+
path,
|
|
206
|
+
sha256: digest,
|
|
207
|
+
content,
|
|
208
|
+
files: detail.files.map((f) => f.path),
|
|
209
|
+
filesTotal: detail.files.length,
|
|
210
|
+
filesTruncated: false,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/** One file as text with its ETag, or `status: 304` when `ifNoneMatch` already names it. */
|
|
214
|
+
function file(input) {
|
|
215
|
+
const etag = input.ifNoneMatch === undefined ? undefined
|
|
216
|
+
: /^(W\/)?".*"$/.test(input.ifNoneMatch) ? input.ifNoneMatch : `"${input.ifNoneMatch}"`;
|
|
217
|
+
return fetchFile(input.skill, input.path, etag);
|
|
218
|
+
}
|
|
219
|
+
return { list, skill, read, file };
|
|
220
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HttpError, requestJson } from "../client.js";
|
|
2
2
|
import { resolveRemote, resolveToken } from "../config.js";
|
|
3
3
|
import { emitJson, fail } from "../helpers.js";
|
|
4
|
+
import { registerNativeExperimentCommands } from "./native-commands.js";
|
|
4
5
|
class BindingError extends Error {
|
|
5
6
|
code;
|
|
6
7
|
remediation;
|
|
@@ -147,6 +148,7 @@ export async function runExperiments(action, opts, selection) {
|
|
|
147
148
|
}
|
|
148
149
|
export function registerExperimentsCommand(program) {
|
|
149
150
|
const command = program.command("experiments").description("discover and explicitly bind an existing managed Dash workspace (JSON receipts)");
|
|
151
|
+
registerNativeExperimentCommands(command);
|
|
150
152
|
for (const action of ["workspaces", "binding", "connect", "disconnect"]) {
|
|
151
153
|
const sub = command.command(action)
|
|
152
154
|
.description({ workspaces: "list verified eligible Dash organization workspaces", binding: "inspect the current binding and revision", connect: "preview a workspace binding; --apply commits it", disconnect: "preview detaching; remote experiments and SDK access are retained" }[action])
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
type Action = "list" | "create" | "archive" | "restore" | "log" | "trash-list" | "delete" | "trash-restore";
|
|
3
|
+
interface Options {
|
|
4
|
+
namespace: string;
|
|
5
|
+
project: string;
|
|
6
|
+
json?: boolean;
|
|
7
|
+
limit?: string;
|
|
8
|
+
cursor?: string;
|
|
9
|
+
level?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function runNativeExperiment(action: Action, opts: Options, subject?: string, message?: string): Promise<number>;
|
|
12
|
+
export declare function registerNativeExperimentCommands(parent: Command): void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { HttpError, requestJson } from "../client.js";
|
|
2
|
+
import { resolveRemote, resolveToken } from "../config.js";
|
|
3
|
+
import { emitJson, fail } from "../helpers.js";
|
|
4
|
+
const id = /^[0-9a-f]{24}$/;
|
|
5
|
+
const key = /^[A-Za-z0-9_-]{1,128}$/;
|
|
6
|
+
export async function runNativeExperiment(action, opts, subject, message) {
|
|
7
|
+
try {
|
|
8
|
+
const token = resolveToken();
|
|
9
|
+
if (!token)
|
|
10
|
+
throw new Error("DreamLake login is required; run dreamlake login.");
|
|
11
|
+
if (!opts.namespace || !opts.project)
|
|
12
|
+
throw new Error("--namespace and --project are required.");
|
|
13
|
+
const base = `/native-experiments/ns/${encodeURIComponent(opts.namespace)}/projects/${encodeURIComponent(opts.project)}`;
|
|
14
|
+
const remote = resolveRemote();
|
|
15
|
+
if (action === "list" || action === "trash-list") {
|
|
16
|
+
const limit = opts.limit === undefined ? 50 : Number(opts.limit);
|
|
17
|
+
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100 ||
|
|
18
|
+
opts.limit !== undefined && !/^[1-9][0-9]*$/.test(opts.limit) ||
|
|
19
|
+
opts.cursor !== undefined && !id.test(opts.cursor))
|
|
20
|
+
throw new Error("Invalid list limit or cursor.");
|
|
21
|
+
emitJson(await requestJson(remote, `${base}/${action === "trash-list" ? "trash" : "runs"}`, { token, query: { limit,
|
|
22
|
+
...(opts.cursor ? { cursor: opts.cursor } : {}) }, redirect: "error" }));
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
if (!subject || !(action === "create" ? key : id).test(subject))
|
|
26
|
+
throw new Error(action === "create"
|
|
27
|
+
? "Run key must contain 1-128 letters, digits, underscores or hyphens."
|
|
28
|
+
: "Run ID must be a DreamLake native Experiment ID.");
|
|
29
|
+
if (action === "create") {
|
|
30
|
+
emitJson(await requestJson(remote, `${base}/runs/${encodeURIComponent(subject)}`, { token, method: "PUT", redirect: "error" }));
|
|
31
|
+
}
|
|
32
|
+
else if (action === "delete" || action === "trash-restore") {
|
|
33
|
+
emitJson(await requestJson(remote, `${base}/runs/${subject}${action === "trash-restore" ? "/restore" : ""}`, {
|
|
34
|
+
token, method: action === "delete" ? "DELETE" : "POST", redirect: "error"
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
else if (action === "archive" || action === "restore") {
|
|
38
|
+
emitJson(await requestJson(remote, `${base}/runs/${subject}`, { token, method: "PATCH",
|
|
39
|
+
json: { archived: action === "archive" }, redirect: "error" }));
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
if (!message || !["info", "warn", "error", "debug", "fatal"].includes(opts.level ?? "info"))
|
|
43
|
+
throw new Error("Log requires a message and a valid --level.");
|
|
44
|
+
emitJson(await requestJson(remote, `${base}/runs/${subject}/logs`, { token, method: "POST", redirect: "error",
|
|
45
|
+
json: { entries: [{ timestamp: new Date().toISOString(), level: opts.level ?? "info", message }] } }));
|
|
46
|
+
}
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
const code = error instanceof HttpError ? `NATIVE_HTTP_${error.status}` : "NATIVE_INVALID_REQUEST";
|
|
51
|
+
const message = error instanceof HttpError ? `Experiment request failed (HTTP ${error.status}). Inspect the run before retrying a write.` :
|
|
52
|
+
error instanceof Error ? error.message : "Experiment request failed.";
|
|
53
|
+
if (opts.json)
|
|
54
|
+
emitJson({ ok: false, error: { code, message } });
|
|
55
|
+
else
|
|
56
|
+
fail(`${code}: ${message}`);
|
|
57
|
+
return 1;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export function registerNativeExperimentCommands(parent) {
|
|
61
|
+
const runs = parent.command("runs").description("DreamLake-native project Experiment runs");
|
|
62
|
+
const common = (command) => command.requiredOption("--namespace <slug>", "DreamLake namespace")
|
|
63
|
+
.requiredOption("--project <slug>", "DreamLake project")
|
|
64
|
+
.option("--json", "emit structured errors (success is JSON)");
|
|
65
|
+
common(runs.command("list").description("list active native runs"))
|
|
66
|
+
.option("--limit <count>", "page size, 1-100")
|
|
67
|
+
.option("--cursor <id>", "nextCursor from the previous page")
|
|
68
|
+
.action(async (opts) => { process.exitCode = await runNativeExperiment("list", opts); });
|
|
69
|
+
common(runs.command("create").description("create an idempotent native run by key").argument("<key>"))
|
|
70
|
+
.action(async (subject, opts) => { process.exitCode = await runNativeExperiment("create", opts, subject); });
|
|
71
|
+
for (const action of ["archive", "restore"])
|
|
72
|
+
common(runs.command(action).description(`${action} a native run`).argument("<run-id>"))
|
|
73
|
+
.action(async (subject, opts) => { process.exitCode = await runNativeExperiment(action, opts, subject); });
|
|
74
|
+
common(runs.command("delete").description("move a terminal native run to trash").argument("<run-id>"))
|
|
75
|
+
.action(async (subject, opts) => { process.exitCode = await runNativeExperiment("delete", opts, subject); });
|
|
76
|
+
const trash = runs.command("trash").description("list and restore deleted native runs");
|
|
77
|
+
common(trash.command("list").description("list deleted native runs"))
|
|
78
|
+
.option("--limit <count>", "page size, 1-100")
|
|
79
|
+
.option("--cursor <id>", "nextCursor from the previous page")
|
|
80
|
+
.action(async (opts) => { process.exitCode = await runNativeExperiment("trash-list", opts); });
|
|
81
|
+
common(trash.command("restore").description("restore a deleted native run").argument("<run-id>"))
|
|
82
|
+
.action(async (subject, opts) => { process.exitCode = await runNativeExperiment("trash-restore", opts, subject); });
|
|
83
|
+
common(runs.command("log").description("append one log entry to a native run").argument("<run-id>").argument("<message>"))
|
|
84
|
+
.option("--level <level>", "info, warn, error, debug or fatal", "info")
|
|
85
|
+
.action(async (subject, message, opts) => {
|
|
86
|
+
process.exitCode = await runNativeExperiment("log", opts, subject, message);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
@@ -20,6 +20,14 @@ export const helpExamples = {
|
|
|
20
20
|
"nymph access grant": "dreamlake nymph access grant upload --name alice/computers/laptop\ndreamlake nymph access grant command-execution --name alice/computers/laptop",
|
|
21
21
|
"nymph access revoke": "dreamlake nymph access revoke upload --name alice/computers/laptop\ndreamlake nymph access revoke command-execution --name alice/computers/laptop",
|
|
22
22
|
"nymph restart": "dreamlake nymph restart --name alice/computers/laptop",
|
|
23
|
+
"experiments runs list": "dreamlake experiments runs list --namespace fortyfive --project research",
|
|
24
|
+
"experiments runs create": "dreamlake experiments runs create trial_1 --namespace fortyfive --project research",
|
|
25
|
+
"experiments runs log": "dreamlake experiments runs log \"$RUN_ID\" \"training started\" --level info --namespace fortyfive --project research",
|
|
26
|
+
"experiments runs archive": "dreamlake experiments runs archive \"$RUN_ID\" --namespace fortyfive --project research",
|
|
27
|
+
"experiments runs restore": "dreamlake experiments runs restore \"$RUN_ID\" --namespace fortyfive --project research",
|
|
28
|
+
"experiments runs delete": "dreamlake experiments runs delete \"$RUN_ID\" --namespace fortyfive --project research",
|
|
29
|
+
"experiments runs trash list": "dreamlake experiments runs trash list --namespace fortyfive --project research",
|
|
30
|
+
"experiments runs trash restore": "dreamlake experiments runs trash restore \"$RUN_ID\" --namespace fortyfive --project research",
|
|
23
31
|
"experiments workspaces": "dreamlake experiments workspaces --namespace fortyfive --json",
|
|
24
32
|
"experiments binding": "dreamlake experiments binding --namespace fortyfive --json",
|
|
25
33
|
"experiments connect": "dreamlake experiments connect research --namespace fortyfive --json\n# Apply only after reviewing the preview. Use its actual revision, not this example's 0.\ndreamlake experiments connect \"$DASH_NAMESPACE_ID\" --namespace fortyfive --instance-id \"$DASH_INSTANCE_ID\" --apply --expected-revision 0 --json",
|
|
@@ -159,7 +167,9 @@ export const helpExamples = {
|
|
|
159
167
|
"service-accounts bind": "dreamlake service-accounts bind my-team/0123456789abcdef01234567 --enrollment 444444444444444444444444",
|
|
160
168
|
"service-accounts revoke": "dreamlake service-accounts revoke my-team/0123456789abcdef01234567",
|
|
161
169
|
"sessions visibility": "dreamlake sessions visibility <saved-id> --namespace <personal-namespace> --visibility private",
|
|
162
|
-
"sessions register": "dreamlake sessions register --provider codex --session <native-uuid> --cwd /absolute/repository --json\n# Explicit private override for a new registration:\ndreamlake sessions register --provider claude --session <native-uuid> --cwd /absolute/repository --visibility private --json",
|
|
170
|
+
"sessions register": "dreamlake sessions register --provider codex --session <native-uuid> --cwd /absolute/repository --json\n# Explicit private override for a new registration:\ndreamlake sessions register --provider claude --session <native-uuid> --cwd /absolute/repository --visibility private --json\n# From inside a Claude Code session: register it, print the saved ID and the control send recipe,\n# and write an env file other shells can source so their note/artifact writes link to it:\ndreamlake sessions register --provider claude --session \"${CLAUDE_SESSION_ID:-$CLAUDE_CODE_SESSION_ID}\" --cwd \"$PWD\" --visibility private --write-env \"$HOME/.dreamlake/sessions/current.env\"",
|
|
171
|
+
"claude": "# Interactive Claude Code, registered private before it starts, acceptEdits (workspace-write):\ndreamlake claude\n# One headless turn at plan level; everything after the wrapper's flags goes to claude unchanged:\ndreamlake claude --permission read-only -p \"Summarize the open PRs\" --model opus",
|
|
172
|
+
"codex": "dreamlake codex --permission full-access \"Fix the failing test\"",
|
|
163
173
|
"sessions link": "dreamlake sessions link SESSION_ID --namespace geyang \\\n --resource-namespace fortyfive --note NOTE_ID --json\ndreamlake sessions link SESSION_ID --namespace geyang \\\n --resource-namespace fortyfive --artifact loss-plot --json",
|
|
164
174
|
"sessions unlink": "dreamlake sessions unlink SESSION_ID --namespace geyang \\\n --resource-namespace fortyfive --artifact loss-plot --json",
|
|
165
175
|
"sessions resources": "dreamlake sessions resources SESSION_ID --namespace geyang --page-size 25 --json",
|
|
@@ -176,22 +186,29 @@ export const helpExamples = {
|
|
|
176
186
|
"sessions stop": "dreamlake sessions stop SESSION_ID --namespace geyang --yes --json",
|
|
177
187
|
"sessions sync": "dreamlake sessions sync --namespace geyang --target TARGET_ID --json\ndreamlake sessions sync --namespace geyang --all --json",
|
|
178
188
|
"sessions upload-conversation": "dreamlake sessions upload-conversation SESSION_ID --namespace geyang \\\n --file /absolute/path/to/conversation.jsonl --json",
|
|
179
|
-
"sessions serve": "dreamlake sessions serve\n# Handle one command and exit (useful in scripts and tests):\ndreamlake sessions serve --once --json",
|
|
189
|
+
"sessions serve": "dreamlake sessions serve\n# Handle one command and exit (useful in scripts and tests):\ndreamlake sessions serve --once --json\n# Let a person raise sessions on this runner up to full access (control restart --raise):\ndreamlake sessions serve --max-human-permission full-access",
|
|
180
190
|
"sessions runners": "dreamlake sessions runners",
|
|
181
191
|
"sessions control start": "dreamlake sessions control start --provider claude --repo /abs/repo --isolation worktree --branch feat/x --permission workspace-write --prompt \"Run the tests and report\" --name \"Test runner\"\n# Reuse the checkout as is, headless:\ndreamlake sessions control start --provider codex --repo /abs/repo --isolation repo --permission read-only --mode headless --prompt \"Summarize open TODOs\"",
|
|
182
|
-
"sessions control send": "dreamlake sessions control send <session-id> \"Please rebase on main and rerun CI\"\n# A
|
|
192
|
+
"sessions control send": "dreamlake sessions control send <session-id> \"Please rebase on main and rerun CI\"\n# A turn under a lower ceiling than the recorded level, for this turn only:\ndreamlake sessions control send <session-id> \"Summarize your state\" --permission read-only\n# A session registered without a level (sessions register, dreamlake claude) is refused until one is recorded:\ndreamlake sessions control restart <session-id> --permission workspace-write --raise",
|
|
183
193
|
"sessions control broadcast": "dreamlake sessions control broadcast \"Stop and summarize your state\" --session <id-1> <id-2>",
|
|
184
194
|
"sessions control resume": "dreamlake sessions control resume <session-id> --prompt \"Continue\"",
|
|
195
|
+
"sessions control restart": "# Lower a session to read-only and continue the same conversation:\ndreamlake sessions control restart <session-id> --permission read-only\n# Raising is the person's explicit ask; the runner must have been started with --max-human-permission:\ndreamlake sessions control restart <session-id> --permission full-access --raise --reason \"needs to run the deploy\"",
|
|
196
|
+
"sessions permission": "dreamlake sessions permission <session-id> read-only --reason \"review only\"",
|
|
185
197
|
"sessions control stop": "dreamlake sessions control stop <session-id> --yes",
|
|
186
198
|
"sessions control status": "dreamlake sessions control status <session-id>\ndreamlake sessions control sync <session-id>\ndreamlake sessions control subagents <session-id>",
|
|
187
199
|
"sessions control list": "dreamlake sessions control list --session <session-id>\ndreamlake sessions control wait <command-id> --wait 120\ndreamlake sessions control cancel <command-id>",
|
|
200
|
+
"sessions heartbeat": "# From a Claude Code hook (settings.json): the hook JSON on stdin names the session and the tool.\ndreamlake sessions heartbeat --state running --hook-stdin\n# From a script or another relay, for an explicit saved session:\ndreamlake sessions heartbeat --session <session-id> --state waiting-for-user --tool Bash",
|
|
201
|
+
"sessions event": "dreamlake sessions event --kind SubagentStart --hook-stdin\ndreamlake sessions event --session <session-id> --kind SubagentStop --subagent agent-abc --finished --tokens 1200",
|
|
202
|
+
"sessions tree": "dreamlake sessions tree <session-id>",
|
|
203
|
+
"sessions watch": "# One session, readable lines:\ndreamlake sessions watch --session <session-id>\n# Everything in the namespace, one JSON frame per line:\ndreamlake sessions watch --json",
|
|
188
204
|
"sessions archive": "dreamlake sessions rename <session-id> \"Flaky test hunt\"\ndreamlake sessions archive <session-id>\ndreamlake sessions unarchive <session-id>",
|
|
189
205
|
"sessions chat": "dreamlake sessions chat \"Which of my sessions need attention?\"\n# Allow lifecycle and messaging tools this turn:\ndreamlake sessions chat --control \"Send 'rebase on main' to the two Claude sessions working on notes\"",
|
|
190
206
|
"sessions tool-calls": "dreamlake sessions tool-calls <conversation-id>",
|
|
191
207
|
"dreamlake": "# Guided agent setup: choose agent and scope, install dreamlake-cli offline\ndreamlake init\n# Install more skills from the public release\ndreamlake skill install dreamlake-notes\n# Keep installed skills current\ndreamlake skill update",
|
|
192
208
|
"init": "dreamlake init\ndreamlake init --agent codex\ndreamlake init --agent claude --global\n# Claude Code and Codex: one copy in each agent's directory\ndreamlake init --agent all --global",
|
|
193
|
-
"skill": "dreamlake skill list\ndreamlake skill install dreamlake-notes\ndreamlake skill update\ndreamlake skill remove dreamlake-notes",
|
|
194
|
-
"skill list": "
|
|
209
|
+
"skill": "dreamlake skill list\ndreamlake skill read dreamlake-notes\ndreamlake skill install dreamlake-notes\ndreamlake skill update\ndreamlake skill remove dreamlake-notes",
|
|
210
|
+
"skill list": "# The server's registry when logged in, else the embedded snapshot\ndreamlake skill list\n# Choose the source; --local never uses the network\ndreamlake skill list --local\ndreamlake skill list --remote\n# Fetch the latest catalog and show it next to the installed versions\ndreamlake skill list --refresh\ndreamlake skill list --agent codex --json",
|
|
211
|
+
"skill read": "# SKILL.md, from the server's registry when logged in, else the embedded bundle\ndreamlake skill read dreamlake-notes\n# One file inside the skill\ndreamlake skill read dreamlake-notes --file actions/read.md\n# Choose the source; --json carries the same fields as the agent's dreamlake_skills_read\ndreamlake skill read dreamlake-cli --local --json\ndreamlake skill read dreamlake-scenes --remote",
|
|
195
212
|
"skill install": "# The embedded dreamlake-cli skill; offline when it matches the release\ndreamlake skill install dreamlake-cli\n# A catalog skill plus whatever it requires, from the latest release\ndreamlake skill install dreamlake-notes --agent codex\n# One copy for Claude Code and one for Codex\ndreamlake skill install dreamlake-notes --agent all --global\n# Replace files you edited with the release copies\ndreamlake skill install dreamlake-notes --force",
|
|
196
213
|
"skill update": "# Every skill with a manifest in the selected scope\ndreamlake skill update\ndreamlake skill update dreamlake-cli --global\n# Overwrite edited files; retired files you edited are still kept\ndreamlake skill update dreamlake-notes --force\n# Go back to an older release, or replace a copy whose version cannot be ordered\ndreamlake skill update dreamlake-notes --allow-downgrade",
|
|
197
214
|
"skill remove": "dreamlake skill remove dreamlake-notes\ndreamlake skill remove dreamlake-notes --agent codex --global --json",
|
|
@@ -33,8 +33,36 @@ export declare function listHosts(opts: {
|
|
|
33
33
|
}, request?: typeof hostRequest): Promise<HostInventory>;
|
|
34
34
|
/** A stored state without a verified runtime observation is not availability. */
|
|
35
35
|
export declare function hostConnection(enrollments?: HostEnrollmentStatus[]): string;
|
|
36
|
+
export declare function cell(value: unknown): string;
|
|
37
|
+
/** Column widths come from the plain text; `decorate` runs after padding so escape codes never shift columns. */
|
|
38
|
+
export declare function table(rows: string[][], decorate?: (value: string, row: number, column: number) => string): string;
|
|
36
39
|
export declare function formatHostsList(result: HostInventory, all?: boolean): string;
|
|
37
40
|
export declare function formatHostStatus(result: {
|
|
38
41
|
host: HostSummary;
|
|
39
42
|
enrollments?: HostEnrollmentStatus[];
|
|
40
43
|
}): string;
|
|
44
|
+
/**
|
|
45
|
+
* Bold and underline every case-insensitive occurrence; the surrounding text keeps the terminal's own
|
|
46
|
+
* colors. `reset` ends each highlight; a caller drawing inside another attribute passes `\x1b[22;24m`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function highlightMatches(value: string, keyword: string, reset?: string): string;
|
|
49
|
+
export interface HostMatches {
|
|
50
|
+
keyword: string;
|
|
51
|
+
hosts: HostSummary[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Hosts whose ID or name contains the keyword, case-insensitively, best match first. A
|
|
55
|
+
* `namespace/group/host` selector that matches nothing as a whole falls back to its last segment.
|
|
56
|
+
*/
|
|
57
|
+
export declare function matchHosts(hosts: HostSummary[], selector: string): HostMatches;
|
|
58
|
+
/**
|
|
59
|
+
* Shell-style completion of a typed host toward `name`: the next `/`-terminated prefix of `name` that
|
|
60
|
+
* is longer than `query` and still contains it (case-insensitively), or the whole name when none does.
|
|
61
|
+
* `bos14` → `team/bos14/` → `team/bos14/bos14-ctrl`; `te` → `team/` → `team/bos14/` → ….
|
|
62
|
+
*/
|
|
63
|
+
export declare function completeHostSegment(query: string, name: string): string;
|
|
64
|
+
export declare const HOST_MATCH_LIMIT = 20;
|
|
65
|
+
/** The `hosts list` columns for a set of hosts: header row first. */
|
|
66
|
+
export declare function hostRows(hosts: HostSummary[]): string[][];
|
|
67
|
+
/** The `hosts list` table restricted to keyword matches, for a terminal reader; `color` adds the highlight. */
|
|
68
|
+
export declare function formatHostMatches(result: HostInventory, matches: HostMatches, color: boolean, command?: string, limit?: number): string;
|
|
@@ -61,12 +61,13 @@ export function hostConnection(enrollments = []) {
|
|
|
61
61
|
return "unknown";
|
|
62
62
|
return enrollments.every(e => e.state === "offline") ? "offline" : "unknown";
|
|
63
63
|
}
|
|
64
|
-
function cell(value) {
|
|
64
|
+
export function cell(value) {
|
|
65
65
|
return typeof value === "string" && value ? value.replace(/[\x00-\x1f\x7f-\x9f]/g, " ") : "unknown";
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
/** Column widths come from the plain text; `decorate` runs after padding so escape codes never shift columns. */
|
|
68
|
+
export function table(rows, decorate = value => value) {
|
|
68
69
|
const widths = rows[0].map((_, i) => rows.reduce((width, row) => Math.max(width, row[i].length), 0));
|
|
69
|
-
return rows.map(row => row.map((value, i) => i === row.length - 1 ? value : value.padEnd(widths[i])).join(" ")).join("\n");
|
|
70
|
+
return rows.map((row, r) => row.map((value, i) => decorate(i === row.length - 1 ? value : value.padEnd(widths[i]), r, i)).join(" ")).join("\n");
|
|
70
71
|
}
|
|
71
72
|
export function formatHostsList(result, all = false) {
|
|
72
73
|
const rows = [["ID", "NAME", "CATALOG", "CONNECTION"], ...result.hosts.map(host => [cell(host.id), cell(host.name), cell(host.catalog?.catalogState), hostConnection(host.enrollments)])];
|
|
@@ -89,3 +90,67 @@ export function formatHostStatus(result) {
|
|
|
89
90
|
lines.push("No enrollments.");
|
|
90
91
|
return lines.join("\n");
|
|
91
92
|
}
|
|
93
|
+
const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
94
|
+
/**
|
|
95
|
+
* Bold and underline every case-insensitive occurrence; the surrounding text keeps the terminal's own
|
|
96
|
+
* colors. `reset` ends each highlight; a caller drawing inside another attribute passes `\x1b[22;24m`.
|
|
97
|
+
*/
|
|
98
|
+
export function highlightMatches(value, keyword, reset = "\x1b[0m") {
|
|
99
|
+
if (!keyword)
|
|
100
|
+
return value;
|
|
101
|
+
return value.replace(new RegExp(escapeRegExp(keyword), "gi"), match => `\x1b[1;4m${match}${reset}`);
|
|
102
|
+
}
|
|
103
|
+
/** Exact name or host segment first, then names or host segments the keyword starts, then containing names, then IDs; inventory order within each. */
|
|
104
|
+
function matchRank(host, needle) {
|
|
105
|
+
const name = host.name.toLowerCase(), last = name.split("/").at(-1);
|
|
106
|
+
return name === needle || last === needle ? 0 : name.startsWith(needle) || last.startsWith(needle) ? 1 : name.includes(needle) ? 2 : 3;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
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.
|
|
111
|
+
*/
|
|
112
|
+
export function matchHosts(hosts, selector) {
|
|
113
|
+
const keywords = [...new Set([selector, selector.split("/").filter(Boolean).at(-1) ?? ""].filter(Boolean))];
|
|
114
|
+
for (const keyword of keywords) {
|
|
115
|
+
const needle = keyword.toLowerCase();
|
|
116
|
+
const matched = hosts.filter(host => host.id.toLowerCase().includes(needle) || host.name.toLowerCase().includes(needle))
|
|
117
|
+
.sort((a, b) => matchRank(a, needle) - matchRank(b, needle));
|
|
118
|
+
if (matched.length)
|
|
119
|
+
return { keyword, hosts: matched };
|
|
120
|
+
}
|
|
121
|
+
// Nothing matched even the broadest keyword tried; report that one.
|
|
122
|
+
return { keyword: keywords.at(-1) ?? selector, hosts: [] };
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Shell-style completion of a typed host toward `name`: the next `/`-terminated prefix of `name` that
|
|
126
|
+
* is longer than `query` and still contains it (case-insensitively), or the whole name when none does.
|
|
127
|
+
* `bos14` → `team/bos14/` → `team/bos14/bos14-ctrl`; `te` → `team/` → `team/bos14/` → ….
|
|
128
|
+
*/
|
|
129
|
+
export function completeHostSegment(query, name) {
|
|
130
|
+
const needle = query.toLowerCase();
|
|
131
|
+
const segments = name.split("/");
|
|
132
|
+
for (let i = 1; i < segments.length; i++) {
|
|
133
|
+
const prefix = segments.slice(0, i).join("/") + "/";
|
|
134
|
+
if (prefix.length > query.length && prefix.toLowerCase().includes(needle))
|
|
135
|
+
return prefix;
|
|
136
|
+
}
|
|
137
|
+
return name;
|
|
138
|
+
}
|
|
139
|
+
export const HOST_MATCH_LIMIT = 20;
|
|
140
|
+
/** The `hosts list` columns for a set of hosts: header row first. */
|
|
141
|
+
export function hostRows(hosts) {
|
|
142
|
+
return [["ID", "NAME", "CATALOG", "CONNECTION"], ...hosts.map(host => [cell(host.id), cell(host.name), cell(host.catalog?.catalogState), hostConnection(host.enrollments)])];
|
|
143
|
+
}
|
|
144
|
+
/** The `hosts list` table restricted to keyword matches, for a terminal reader; `color` adds the highlight. */
|
|
145
|
+
export function formatHostMatches(result, matches, color, command = "ssh", limit = HOST_MATCH_LIMIT) {
|
|
146
|
+
const quoted = JSON.stringify(matches.keyword);
|
|
147
|
+
if (!matches.hosts.length)
|
|
148
|
+
return `No hosts match ${quoted} in namespace ${result.namespace}. Run dreamlake hosts list --all to see every host.`;
|
|
149
|
+
const shown = matches.hosts.slice(0, limit);
|
|
150
|
+
const rows = hostRows(shown);
|
|
151
|
+
const decorate = (value, row, column) => color && row > 0 && column < 2 ? highlightMatches(value, matches.keyword) : value;
|
|
152
|
+
const more = matches.hosts.length > shown.length ? ` Showing ${shown.length}; narrow the keyword to see the rest.` : "";
|
|
153
|
+
const next = matches.hosts.length === 1 ? `Connect with: dreamlake ${command} ${cell(matches.hosts[0].name)}` : "Connect with the full NAME or ID.";
|
|
154
|
+
return [`Hosts matching ${quoted} in namespace ${result.namespace}:`, table(rows, decorate),
|
|
155
|
+
`${matches.hosts.length} of ${result.total} hosts match.${more} ${next}`].join("\n");
|
|
156
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type HostInventory, type HostMatches } from "./inventory.js";
|
|
2
|
+
/** The terminal a person is typing into. `process.stdin`/`process.stderr` in the CLI; any pair of streams in tests. */
|
|
3
|
+
export interface PickerIO {
|
|
4
|
+
input: NodeJS.ReadableStream & {
|
|
5
|
+
isTTY?: boolean;
|
|
6
|
+
setRawMode?: (mode: boolean) => unknown;
|
|
7
|
+
};
|
|
8
|
+
output: {
|
|
9
|
+
write(text: string): unknown;
|
|
10
|
+
columns?: number;
|
|
11
|
+
};
|
|
12
|
+
color: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface PickerState {
|
|
15
|
+
query: string;
|
|
16
|
+
cursor: number;
|
|
17
|
+
}
|
|
18
|
+
/** Matches for what is typed so far; an empty query lists the whole inventory. */
|
|
19
|
+
export declare function pickerMatches(inventory: HostInventory, query: string): HostMatches;
|
|
20
|
+
/** One frame of the picker: the command being built, the match table with the cursor row marked, and a count. */
|
|
21
|
+
export declare function renderPicker(inventory: HostInventory, selector: string, command: "ssh" | "exec", state: PickerState, color: boolean, limit?: number): string;
|
|
22
|
+
/** Pure key handling, so the loop and the tests share one definition. */
|
|
23
|
+
export declare function reducePicker(inventory: HostInventory, state: PickerState, key: string): {
|
|
24
|
+
state: PickerState;
|
|
25
|
+
done?: "pick" | "cancel";
|
|
26
|
+
};
|
|
27
|
+
/** Split a raw-mode chunk into keys: arrow sequences stay whole, everything else is one character per key. */
|
|
28
|
+
export declare function splitKeys(chunk: string): string[];
|
|
29
|
+
/**
|
|
30
|
+
* Interactive host picker for a selector that named no host. Lists keyword matches with the best one
|
|
31
|
+
* highlighted; typing filters, Tab completes toward the highlighted host one segment at a time, Enter
|
|
32
|
+
* resolves to that host's full name, and Esc or Ctrl-C resolves to undefined. Draws on `io.output`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function pickHost(inventory: HostInventory, selector: string, command: "ssh" | "exec", io: PickerIO): Promise<string | undefined>;
|