skydive-cli 0.6.0-beta.15 → 0.6.0-beta.154
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/CHANGELOG.md +15 -0
- package/dist/js/bin.mjs +867 -89
- package/dist/js/{boot-D5_QVvwk.mjs → boot-DENbHF_1.mjs} +9829 -7587
- package/dist/js/{client-l6orYfqq.mjs → client-Cxk3khQu.mjs} +18 -4
- package/dist/js/client-DnezHAcS.mjs +5 -0
- package/dist/js/{client-7decrdm4.mjs → client-r-o8dD4w.mjs} +67 -8
- package/dist/js/{daemon-CLTmAfBt.mjs → daemon-DpnxS19C.mjs} +2 -2
- package/dist/js/{daemon-5HHkFtaF.mjs → daemon-KcZ0CrBB.mjs} +117 -27
- package/dist/js/{daemon-client-BdEu0TK_.mjs → daemon-client-CTWxQ2T9.mjs} +29 -4
- package/dist/js/daemon-client-DG7VEYbY.mjs +8 -0
- package/dist/js/{install-Fo1riO1w.mjs → install-AaZqKYZR.mjs} +49 -3
- package/dist/js/{print-sWlw3B6z.mjs → print-ClmJYG9P.mjs} +2 -2
- package/dist/js/{print-C_xW32a6.mjs → print-KIdHOW60.mjs} +13 -12
- package/dist/js/{print-share-ooQ3IrUT.mjs → print-share-DyV94dRt.mjs} +1 -1
- package/dist/js/{raw-pty-dndn1Kxc.mjs → raw-pty-B-WKaaE3.mjs} +1 -1
- package/dist/js/raw-pty-BJIs_xjQ.mjs +5 -0
- package/dist/js/{rest-Benrf1yZ.mjs → rest-Bqz92FKU.mjs} +148 -15
- package/dist/js/{rest-8DCRRen0.mjs → rest-DnbZKhDh.mjs} +1 -1
- package/package.json +9 -8
- package/dist/js/client-Dwy-uGNl.mjs +0 -5
- package/dist/js/daemon-client-CkU1-t5_.mjs +0 -8
- package/dist/js/raw-pty-DRZuf1oW.mjs +0 -5
package/dist/js/bin.mjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { c as version, s as name, t as createRestClient } from "./rest-
|
|
3
|
-
import { A as
|
|
4
|
-
import { A as
|
|
2
|
+
import { c as version, s as name, t as createRestClient } from "./rest-Bqz92FKU.mjs";
|
|
3
|
+
import { A as getPreference, B as resolveChatAuth, C as DEFAULT_API_URL, D as getConfigPath, E as deleteConfig, F as getStoredApiKeyId, G as saveConfig, H as resolveManagementAuth, I as getStoredApiKeyWorkspaceName, J as setLastSeenVersion, K as saveSession, L as getUpdateCheckDisabled, O as getDefaultAgent, P as getShareMachineDefault, S as API_KEY_PREFIX, T as PREFERENCES, U as resolveSession$1, V as resolveConfig, b as API_KEYS_URL, i as resolveAgent$1, j as getPromptHistoryPath, k as getLastSeenVersion, x as API_KEY_FAMILY_PREFIX, z as resolveAppUrl } from "./print-KIdHOW60.mjs";
|
|
4
|
+
import { A as aliasActivationHint, B as getSessionIdentity, E as themes, F as SUPPORTED_SHELLS, H as resolveWorkspaceId, I as defaultInstallEnv, L as detectShell, M as installAgentAlias, N as slugifyAliasName, O as buildImportSeedPrompt, P as takenAliasNames, R as ensureActiveOrganization, U as setActiveWorkspace, V as listWorkspaces, c as brandHelpArt, d as maybeStartProfiling, f as profileDir, j as dedupeAliasName, k as machineOsFromPlatform, t as installCrashHandler, u as getAutomaticLogsDir, z as getActiveWorkspaceId } from "./install-AaZqKYZR.mjs";
|
|
5
5
|
import { n as printError, r as printTable, t as output } from "./output-C9mb3sUB.mjs";
|
|
6
6
|
import { t as HttpError } from "./http-error-BF2NZZE3.mjs";
|
|
7
7
|
import "./billing-blocked-D3l5kJlX.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { s as resolveMachineIdentity } from "./client-r-o8dD4w.mjs";
|
|
9
9
|
import "./tls-cert-Rua2oV7n.mjs";
|
|
10
10
|
import { i as grantPortalAccess, n as fetchPortalDevices, o as registerPortalDevice, r as findThisDevice, s as revokePortalAccess } from "./api-BFQ4PQDA.mjs";
|
|
11
|
-
import { d as daemonPaths, i as queryDaemonStatus, n as ensureDaemonRunning, s as stopDaemon, u as PORTAL_DAEMON_FLAG } from "./daemon-
|
|
12
|
-
import { a as
|
|
11
|
+
import { d as daemonPaths, i as queryDaemonStatus, n as ensureDaemonRunning, s as stopDaemon, u as PORTAL_DAEMON_FLAG } from "./daemon-KcZ0CrBB.mjs";
|
|
12
|
+
import { a as FS_MAX_BLOB_BYTES, i as streamSpecToQuery, n as DEFAULT_EXEC_TIMEOUT_MS, o as decodeFsResponse, r as SANDBOX_STREAM_PATH, s as encodeFsRequest, t as SandboxStream } from "./client-Cxk3khQu.mjs";
|
|
13
13
|
import { hideBin } from "yargs/helpers";
|
|
14
14
|
import yargs from "yargs";
|
|
15
15
|
import { hostname, tmpdir } from "node:os";
|
|
16
16
|
import path, { join } from "node:path";
|
|
17
17
|
import { err, ok } from "neverthrow";
|
|
18
|
+
import fsp, { mkdtemp, open, readFile, rm, stat, writeFile } from "node:fs/promises";
|
|
18
19
|
import { z } from "zod";
|
|
19
|
-
import open from "open";
|
|
20
|
+
import open$1 from "open";
|
|
20
21
|
import fs from "node:fs";
|
|
21
22
|
import { spawn, spawnSync } from "node:child_process";
|
|
22
23
|
import { createHash } from "node:crypto";
|
|
23
24
|
import zlib from "node:zlib";
|
|
24
|
-
import fsp, { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
25
25
|
import { WebSocket } from "ws";
|
|
26
26
|
import semver from "semver";
|
|
27
27
|
import { createInterface } from "node:readline";
|
|
@@ -51,7 +51,9 @@ const AgentSchema = z.object({
|
|
|
51
51
|
url: z.string().nullable(),
|
|
52
52
|
description: z.string().nullable(),
|
|
53
53
|
model: z.string().nullable(),
|
|
54
|
-
gitUrl: z.string()
|
|
54
|
+
gitUrl: z.string(),
|
|
55
|
+
createdByUserId: z.string().nullable().optional(),
|
|
56
|
+
createdAt: z.string().nullable().optional()
|
|
55
57
|
});
|
|
56
58
|
const ListAgentsResponseSchema = z.object({
|
|
57
59
|
agents: z.array(AgentSchema),
|
|
@@ -69,7 +71,47 @@ const ApiKeySchema = z.object({
|
|
|
69
71
|
const CreatedApiKeySchema = ApiKeySchema.extend({ key: z.string() });
|
|
70
72
|
const ListApiKeysResponseSchema = z.object({ keys: z.array(ApiKeySchema) });
|
|
71
73
|
const ListSecretKeysResponseSchema = z.object({ keys: z.array(z.string()) });
|
|
74
|
+
const GitTokenSchema = z.object({
|
|
75
|
+
id: z.string(),
|
|
76
|
+
token: z.string(),
|
|
77
|
+
cloneUrl: z.string(),
|
|
78
|
+
remoteUrl: z.string(),
|
|
79
|
+
permissions: z.string(),
|
|
80
|
+
label: z.string().nullable()
|
|
81
|
+
});
|
|
82
|
+
const ListedGitTokenSchema = z.object({
|
|
83
|
+
id: z.string(),
|
|
84
|
+
permissions: z.string(),
|
|
85
|
+
label: z.string().nullable(),
|
|
86
|
+
lastUsedAt: z.string().nullable(),
|
|
87
|
+
createdAt: z.string()
|
|
88
|
+
});
|
|
89
|
+
const ListGitTokensResponseSchema = z.object({ tokens: z.array(ListedGitTokenSchema) });
|
|
72
90
|
const SetSecretResponseSchema = z.object({ key: z.string() });
|
|
91
|
+
const AvatarPresignResponseSchema = z.object({
|
|
92
|
+
uploadUrl: z.string(),
|
|
93
|
+
ttlSeconds: z.number()
|
|
94
|
+
});
|
|
95
|
+
const AvatarCommitResponseSchema = z.object({ avatarUrl: z.string() });
|
|
96
|
+
/** Same cap the server enforces at avatar commit; enforced client-side too so
|
|
97
|
+
* oversized files fail before the presign/PUT round-trip. */
|
|
98
|
+
const MAX_AGENT_AVATAR_BYTES = 5 * 1024 * 1024;
|
|
99
|
+
/**
|
|
100
|
+
* Sniff an agent-avatar media type from file magic bytes. Kept in sync with
|
|
101
|
+
* the api's commit sniff — `apps/anyone/api/src/lib/agent-avatar.ts`
|
|
102
|
+
* `sniffAvatarMediaType` — so the declared type always matches what the
|
|
103
|
+
* server accepts; the CLI deliberately has no @createinc/anyone-* deps (and
|
|
104
|
+
* no barrel imports, see the CLI bundle rules), so this stays a local copy.
|
|
105
|
+
* If you add a type here, add it there too or the server 415s at commit.
|
|
106
|
+
* null means the file is not an avatar-acceptable raster and the server
|
|
107
|
+
* would reject it.
|
|
108
|
+
*/
|
|
109
|
+
function sniffAgentAvatarMediaType(bytes) {
|
|
110
|
+
if (bytes.byteLength >= 8 && bytes[0] === 137 && bytes[1] === 80 && bytes[2] === 78 && bytes[3] === 71) return "image/png";
|
|
111
|
+
if (bytes.byteLength >= 3 && bytes[0] === 255 && bytes[1] === 216 && bytes[2] === 255) return "image/jpeg";
|
|
112
|
+
if (bytes.byteLength >= 12 && bytes[0] === 82 && bytes[1] === 73 && bytes[2] === 70 && bytes[3] === 70 && bytes[8] === 87 && bytes[9] === 69 && bytes[10] === 66 && bytes[11] === 80) return "image/webp";
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
73
115
|
var SkydiveApiClient = class {
|
|
74
116
|
baseUrl;
|
|
75
117
|
token;
|
|
@@ -159,6 +201,99 @@ var SkydiveApiClient = class {
|
|
|
159
201
|
path: `/agents/${encodeURIComponent(agentId)}/secrets/${encodeURIComponent(key)}`
|
|
160
202
|
});
|
|
161
203
|
}
|
|
204
|
+
async listGitTokens(agentId) {
|
|
205
|
+
return this.request({
|
|
206
|
+
method: "GET",
|
|
207
|
+
path: `/agents/${encodeURIComponent(agentId)}/git-tokens`,
|
|
208
|
+
schema: ListGitTokensResponseSchema
|
|
209
|
+
}).then((r) => r.map((res) => res.tokens));
|
|
210
|
+
}
|
|
211
|
+
async createGitToken(agentId, params) {
|
|
212
|
+
return this.request({
|
|
213
|
+
method: "POST",
|
|
214
|
+
path: `/agents/${encodeURIComponent(agentId)}/git-tokens`,
|
|
215
|
+
body: params,
|
|
216
|
+
schema: GitTokenSchema
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
async revokeGitToken(agentId, tokenId) {
|
|
220
|
+
return this.request({
|
|
221
|
+
method: "DELETE",
|
|
222
|
+
path: `/agents/${encodeURIComponent(agentId)}/git-tokens/${encodeURIComponent(tokenId)}`
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Set an agent's avatar photo, driving the server's presigned-PUT flow end
|
|
227
|
+
* to end: read the local file, sniff its raster type, presign, PUT the bytes
|
|
228
|
+
* straight to storage, then commit. Returns the versioned avatar URL the
|
|
229
|
+
* server stored.
|
|
230
|
+
*/
|
|
231
|
+
async setAgentAvatar(params) {
|
|
232
|
+
const prefix = Buffer.alloc(16);
|
|
233
|
+
let sniffBytes;
|
|
234
|
+
try {
|
|
235
|
+
const handle = await open(params.filePath, "r");
|
|
236
|
+
try {
|
|
237
|
+
const { bytesRead } = await handle.read(prefix, 0, prefix.byteLength, 0);
|
|
238
|
+
sniffBytes = prefix.subarray(0, bytesRead);
|
|
239
|
+
} finally {
|
|
240
|
+
await handle.close();
|
|
241
|
+
}
|
|
242
|
+
} catch (e) {
|
|
243
|
+
return err({
|
|
244
|
+
message: `Cannot read ${params.filePath}: ${e instanceof Error ? e.message : String(e)}`,
|
|
245
|
+
status: null
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
const mediaType = sniffAgentAvatarMediaType(sniffBytes);
|
|
249
|
+
if (!mediaType) return err({
|
|
250
|
+
message: "Not an avatar the server accepts: it must be a PNG, JPEG, or WebP image.",
|
|
251
|
+
status: null
|
|
252
|
+
});
|
|
253
|
+
let bytes;
|
|
254
|
+
try {
|
|
255
|
+
bytes = await readFile(params.filePath);
|
|
256
|
+
} catch (e) {
|
|
257
|
+
return err({
|
|
258
|
+
message: `Cannot read ${params.filePath}: ${e instanceof Error ? e.message : String(e)}`,
|
|
259
|
+
status: null
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
if (bytes.byteLength > MAX_AGENT_AVATAR_BYTES) return err({
|
|
263
|
+
message: "image exceeds 5 MB",
|
|
264
|
+
status: null
|
|
265
|
+
});
|
|
266
|
+
const presign = await this.request({
|
|
267
|
+
method: "POST",
|
|
268
|
+
path: `/agents/${encodeURIComponent(params.agentId)}/avatar/presign`,
|
|
269
|
+
body: { mediaType },
|
|
270
|
+
schema: AvatarPresignResponseSchema
|
|
271
|
+
});
|
|
272
|
+
if (presign.isErr()) return err(presign.error);
|
|
273
|
+
const put = await fetch(presign.value.uploadUrl, {
|
|
274
|
+
method: "PUT",
|
|
275
|
+
headers: { "content-type": mediaType },
|
|
276
|
+
body: new Uint8Array(bytes)
|
|
277
|
+
});
|
|
278
|
+
if (!put.ok) return err({
|
|
279
|
+
message: `Avatar upload failed: HTTP ${put.status}`,
|
|
280
|
+
status: put.status
|
|
281
|
+
});
|
|
282
|
+
return this.request({
|
|
283
|
+
method: "POST",
|
|
284
|
+
path: `/agents/${encodeURIComponent(params.agentId)}/avatar`,
|
|
285
|
+
body: { mediaType },
|
|
286
|
+
schema: AvatarCommitResponseSchema
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
/** Remove an agent's uploaded avatar photo; the generated preset takes
|
|
290
|
+
* over. Idempotent server-side — removing an agent with no photo succeeds. */
|
|
291
|
+
async deleteAgentAvatar(agentId) {
|
|
292
|
+
return this.request({
|
|
293
|
+
method: "DELETE",
|
|
294
|
+
path: `/agents/${encodeURIComponent(agentId)}/avatar`
|
|
295
|
+
});
|
|
296
|
+
}
|
|
162
297
|
async request(params) {
|
|
163
298
|
const url = `${this.baseUrl}${params.path}`;
|
|
164
299
|
const headers = {
|
|
@@ -187,7 +322,7 @@ var SkydiveApiClient = class {
|
|
|
187
322
|
const body = await response.json();
|
|
188
323
|
if (body.error && typeof body.error === "string") message = body.error;
|
|
189
324
|
else if (body.error?.message) message = body.error.message;
|
|
190
|
-
} catch {}
|
|
325
|
+
} catch (_error) {}
|
|
191
326
|
if (response.status === 401 && this.authKind === "session") message = `${message}. Your chat session may have expired. Run \`skydive auth login\`.`;
|
|
192
327
|
return err({
|
|
193
328
|
message,
|
|
@@ -198,7 +333,7 @@ var SkydiveApiClient = class {
|
|
|
198
333
|
let body;
|
|
199
334
|
try {
|
|
200
335
|
body = await response.json();
|
|
201
|
-
} catch {
|
|
336
|
+
} catch (_error) {
|
|
202
337
|
return err({
|
|
203
338
|
message: "Invalid JSON response",
|
|
204
339
|
status: response.status
|
|
@@ -343,7 +478,7 @@ async function loginWithDevice({ appUrl, openBrowser = true }) {
|
|
|
343
478
|
const verificationUrl = code.verification_uri_complete ?? code.verification_uri;
|
|
344
479
|
process.stderr.write(`\nTo sign in, open:\n ${verificationUrl}\n`);
|
|
345
480
|
process.stderr.write(`and enter the code: ${formatUserCode(code.user_code)}\n\n`);
|
|
346
|
-
if (openBrowser) await open(verificationUrl).catch(() => void 0);
|
|
481
|
+
if (openBrowser) await open$1(verificationUrl).catch(() => void 0);
|
|
347
482
|
process.stderr.write("Waiting for approval…\n");
|
|
348
483
|
let intervalMs = (code.interval ?? 5) * 1e3 || DEFAULT_INTERVAL_MS;
|
|
349
484
|
const expiresAt = Date.now() + code.expires_in * 1e3;
|
|
@@ -580,6 +715,7 @@ async function runBrowserLogin(argv) {
|
|
|
580
715
|
if (identity?.activeWorkspaceName) console.log(` Workspace: ${identity.activeWorkspaceName}`);
|
|
581
716
|
if (minted.isOk()) console.log(` API key: ${minted.value.prefix}… (${minted.value.name})`);
|
|
582
717
|
console.log(` Config: ${getConfigPath()}`);
|
|
718
|
+
console.log(" Git: to push to an agent repo from this machine, run `skydive agents git token create <agent>`");
|
|
583
719
|
}
|
|
584
720
|
/** CI / headless path: validate and persist an existing key, no browser. */
|
|
585
721
|
async function runApiKeyLogin(argv, apiKey) {
|
|
@@ -1025,6 +1161,40 @@ function requireManagementClient(argv, opts = {}) {
|
|
|
1025
1161
|
...opts.workspaceId ? { workspaceId: opts.workspaceId } : {}
|
|
1026
1162
|
});
|
|
1027
1163
|
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Resolve an agent-targeting command's agent selector (id or name) against
|
|
1166
|
+
* the management roster, returning the id, or exit with the candidate list.
|
|
1167
|
+
*
|
|
1168
|
+
* `secrets` and `keys` historically took a raw `--agent-id` and hit
|
|
1169
|
+
* `/agents/<value>/...` directly, so a name 404'd "agent not found" for a
|
|
1170
|
+
* perfectly real agent, while `sandbox`/`fs`/`portal` resolved the same
|
|
1171
|
+
* string happily (ANY-8977). Reads one page (the same 100 `skydive agents
|
|
1172
|
+
* list` shows), so the error's candidates are what the user was looking at.
|
|
1173
|
+
*/
|
|
1174
|
+
async function resolveTargetAgentId(client, selector) {
|
|
1175
|
+
if (!selector) {
|
|
1176
|
+
printError("Missing --agent <id or name>. Run `skydive agents list` for candidates.");
|
|
1177
|
+
process.exit(1);
|
|
1178
|
+
}
|
|
1179
|
+
const { resolveAgent } = await import("./print-ClmJYG9P.mjs");
|
|
1180
|
+
const result = await client.listAgents({
|
|
1181
|
+
scope: "org",
|
|
1182
|
+
limit: 100
|
|
1183
|
+
});
|
|
1184
|
+
if (result.isErr()) {
|
|
1185
|
+
printError(result.error.message);
|
|
1186
|
+
process.exit(1);
|
|
1187
|
+
}
|
|
1188
|
+
try {
|
|
1189
|
+
return resolveAgent(result.value.agents.map((agent) => ({
|
|
1190
|
+
id: agent.id,
|
|
1191
|
+
name: agent.name
|
|
1192
|
+
})), selector).id;
|
|
1193
|
+
} catch (error) {
|
|
1194
|
+
printError(error instanceof Error ? error.message : String(error));
|
|
1195
|
+
process.exit(1);
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1028
1198
|
/** Resolve the session (see {@link requireSession}) and build a REST client. */
|
|
1029
1199
|
function requireRestClient(argv) {
|
|
1030
1200
|
const auth = resolveChatAuth({ appUrl: resolveAppUrl({ appUrl: argv["api-url"] }) });
|
|
@@ -1038,6 +1208,171 @@ function requireRestClient(argv) {
|
|
|
1038
1208
|
});
|
|
1039
1209
|
}
|
|
1040
1210
|
|
|
1211
|
+
//#endregion
|
|
1212
|
+
//#region src/auth/git-credentials.ts
|
|
1213
|
+
/**
|
|
1214
|
+
* Laptop-side git credentials for an agent's repo.
|
|
1215
|
+
*
|
|
1216
|
+
* The in-sandbox push path (`git -> in-sandbox credential helper -> daemon ->
|
|
1217
|
+
* /git-credentials route -> git storage`) mints a short-lived credential per
|
|
1218
|
+
* push, which only works inside the sandbox. From a laptop, the supported
|
|
1219
|
+
* path is a git-proxy token: `POST /v1/agents/:agentId/git-tokens` returns a
|
|
1220
|
+
* long-lived `skdv_…` token plus a tokenless remote URL on the git-proxy
|
|
1221
|
+
* host. This module holds the pure logic for naming the token. The command
|
|
1222
|
+
* prints the values and changes nothing on the machine: what to do with the
|
|
1223
|
+
* token (credential store, remotes) is left to the user's own tools.
|
|
1224
|
+
*/
|
|
1225
|
+
/** Label stamped on the git-proxy token a machine mints for itself, so the
|
|
1226
|
+
* token is identifiable in `git token list` and on the web settings page. */
|
|
1227
|
+
function gitTokenLabel() {
|
|
1228
|
+
return `CLI git (${hostname()})`;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
//#endregion
|
|
1232
|
+
//#region src/commands/git-setup.ts
|
|
1233
|
+
/** Create one read_write git-proxy token for the agent and print it. The
|
|
1234
|
+
* API returns the ready-to-use tokenless remote URL, so the CLI does no URL
|
|
1235
|
+
* parsing. The command's job ends at the credential: it changes nothing on
|
|
1236
|
+
* this machine (no git config writes, no credential-store plumbing) — what
|
|
1237
|
+
* to do with the token is the caller's tool's business. The label is
|
|
1238
|
+
* metadata only, so a re-run accumulates rather than revokes. */
|
|
1239
|
+
const gitTokenCreateCommand = {
|
|
1240
|
+
command: "create <agent>",
|
|
1241
|
+
describe: "Create a git token to push to the agent's repo from your machine",
|
|
1242
|
+
builder: (y) => y.positional("agent", {
|
|
1243
|
+
type: "string",
|
|
1244
|
+
demandOption: true,
|
|
1245
|
+
describe: "Agent ID or name (see `skydive agents list`)"
|
|
1246
|
+
}),
|
|
1247
|
+
handler: async (argv) => {
|
|
1248
|
+
const client = requireManagementClient(argv);
|
|
1249
|
+
const agent = await resolveAgent(client, argv.agent);
|
|
1250
|
+
const created = await client.createGitToken(agent.id, {
|
|
1251
|
+
permissions: "read_write",
|
|
1252
|
+
label: gitTokenLabel()
|
|
1253
|
+
});
|
|
1254
|
+
if (created.isErr()) {
|
|
1255
|
+
printError(`Could not create a git token: ${created.error.message}`);
|
|
1256
|
+
process.exit(1);
|
|
1257
|
+
}
|
|
1258
|
+
const { token, remoteUrl } = created.value;
|
|
1259
|
+
if (argv.json) {
|
|
1260
|
+
output(argv, {
|
|
1261
|
+
agentId: agent.id,
|
|
1262
|
+
agentName: agent.name,
|
|
1263
|
+
remoteUrl,
|
|
1264
|
+
tokenLabel: created.value.label,
|
|
1265
|
+
token
|
|
1266
|
+
});
|
|
1267
|
+
return;
|
|
1268
|
+
}
|
|
1269
|
+
if (argv.quiet) {
|
|
1270
|
+
console.log(token);
|
|
1271
|
+
return;
|
|
1272
|
+
}
|
|
1273
|
+
console.log(`Git token for ${agent.name} (read_write).`);
|
|
1274
|
+
console.log(` Token: ${token}`);
|
|
1275
|
+
console.log(` Remote: ${remoteUrl} (password is the token)`);
|
|
1276
|
+
console.log(" Nothing was written to git on this machine; pipe these into whatever manages your credentials.");
|
|
1277
|
+
}
|
|
1278
|
+
};
|
|
1279
|
+
/** List the agent's git tokens (id, label, permissions, last use) so a revoke
|
|
1280
|
+
* has an id to take. Token values only come back from creating. */
|
|
1281
|
+
const gitTokenListCommand = {
|
|
1282
|
+
command: "list <agent>",
|
|
1283
|
+
describe: "List the agent's git tokens",
|
|
1284
|
+
builder: (y) => y.positional("agent", {
|
|
1285
|
+
type: "string",
|
|
1286
|
+
demandOption: true,
|
|
1287
|
+
describe: "Agent ID or name (see `skydive agents list`)"
|
|
1288
|
+
}),
|
|
1289
|
+
handler: async (argv) => {
|
|
1290
|
+
const client = requireManagementClient(argv);
|
|
1291
|
+
const agent = await resolveAgent(client, argv.agent);
|
|
1292
|
+
const listed = await client.listGitTokens(agent.id);
|
|
1293
|
+
if (listed.isErr()) {
|
|
1294
|
+
printError(`Could not list this agent's git tokens: ${listed.error.message}`);
|
|
1295
|
+
process.exit(1);
|
|
1296
|
+
}
|
|
1297
|
+
if (argv.json) {
|
|
1298
|
+
output(argv, {
|
|
1299
|
+
agentId: agent.id,
|
|
1300
|
+
agentName: agent.name,
|
|
1301
|
+
tokens: listed.value
|
|
1302
|
+
});
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1305
|
+
if (argv.quiet) {
|
|
1306
|
+
for (const token of listed.value) console.log(token.id);
|
|
1307
|
+
return;
|
|
1308
|
+
}
|
|
1309
|
+
if (listed.value.length === 0) {
|
|
1310
|
+
console.log(`No git tokens for ${agent.name}.`);
|
|
1311
|
+
return;
|
|
1312
|
+
}
|
|
1313
|
+
printTable([
|
|
1314
|
+
"ID",
|
|
1315
|
+
"Label",
|
|
1316
|
+
"Permissions",
|
|
1317
|
+
"Last used"
|
|
1318
|
+
], listed.value.map((t) => [
|
|
1319
|
+
t.id,
|
|
1320
|
+
t.label ?? "",
|
|
1321
|
+
t.permissions,
|
|
1322
|
+
t.lastUsedAt ?? "never"
|
|
1323
|
+
]));
|
|
1324
|
+
}
|
|
1325
|
+
};
|
|
1326
|
+
/** Revoke one git token by id (run `git token list` for the ids). */
|
|
1327
|
+
const gitTokenRevokeCommand = {
|
|
1328
|
+
command: "revoke <agent> <token-id>",
|
|
1329
|
+
describe: "Revoke one of the agent's git tokens by id",
|
|
1330
|
+
builder: (y) => y.positional("agent", {
|
|
1331
|
+
type: "string",
|
|
1332
|
+
demandOption: true,
|
|
1333
|
+
describe: "Agent ID or name (see `skydive agents list`)"
|
|
1334
|
+
}).positional("token-id", {
|
|
1335
|
+
type: "string",
|
|
1336
|
+
demandOption: true,
|
|
1337
|
+
describe: "Token id (see `skydive agents git token list`)"
|
|
1338
|
+
}),
|
|
1339
|
+
handler: async (argv) => {
|
|
1340
|
+
const client = requireManagementClient(argv);
|
|
1341
|
+
const agent = await resolveAgent(client, argv.agent);
|
|
1342
|
+
const revoked = await client.revokeGitToken(agent.id, argv["token-id"]);
|
|
1343
|
+
if (revoked.isErr()) {
|
|
1344
|
+
printError(`Could not revoke git token ${argv["token-id"]}: ${revoked.error.message}`);
|
|
1345
|
+
process.exit(1);
|
|
1346
|
+
}
|
|
1347
|
+
console.log(`Revoked git token ${argv["token-id"]} for ${agent.name}.`);
|
|
1348
|
+
}
|
|
1349
|
+
};
|
|
1350
|
+
const gitTokenCommand = {
|
|
1351
|
+
command: "token <command>",
|
|
1352
|
+
describe: "Create, list, or revoke git-proxy tokens for an agent's repo",
|
|
1353
|
+
builder: (y) => y.command(gitTokenCreateCommand).command(gitTokenListCommand).command(gitTokenRevokeCommand).demandCommand(1, "Specify a subcommand: create, list, revoke"),
|
|
1354
|
+
handler: () => {}
|
|
1355
|
+
};
|
|
1356
|
+
/**
|
|
1357
|
+
* `skydive agents git` — git access to an agent's repo from your own machine.
|
|
1358
|
+
* The in-sandbox push path (git -> in-sandbox credential helper -> daemon ->
|
|
1359
|
+
* git storage) only works inside the sandbox; from a laptop, the supported
|
|
1360
|
+
* path is a git-proxy token via the same routes the web settings page uses:
|
|
1361
|
+
*
|
|
1362
|
+
* - `git token create <agent>` create a token and print it.
|
|
1363
|
+
* - `git token list <agent>` list the agent's tokens by id.
|
|
1364
|
+
* - `git token revoke <agent> <id>` revoke one token.
|
|
1365
|
+
*
|
|
1366
|
+
* The command's job ends at the credential: it changes nothing on this
|
|
1367
|
+
* machine — what to do with the token is the caller's tool's business.
|
|
1368
|
+
*/
|
|
1369
|
+
const gitCommand = {
|
|
1370
|
+
command: "git <command>",
|
|
1371
|
+
describe: "Git access to an agent's repo from your machine",
|
|
1372
|
+
builder: (y) => y.command(gitTokenCommand).demandCommand(1, "Specify a subcommand: token"),
|
|
1373
|
+
handler: () => {}
|
|
1374
|
+
};
|
|
1375
|
+
|
|
1041
1376
|
//#endregion
|
|
1042
1377
|
//#region src/commands/agents.ts
|
|
1043
1378
|
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
@@ -1065,7 +1400,7 @@ async function resolveAgent(client, selector) {
|
|
|
1065
1400
|
if (matches.length === 0) throw new Error(`No agent named "${selector}". Pass an id, or run \`skydive agents list\`.`);
|
|
1066
1401
|
throw new Error(`Multiple agents named "${selector}". Pass the id instead:\n${matches.map((a) => ` ${a.name} ${a.id}`).join("\n")}`);
|
|
1067
1402
|
}
|
|
1068
|
-
const listCommand$
|
|
1403
|
+
const listCommand$7 = {
|
|
1069
1404
|
command: "list",
|
|
1070
1405
|
describe: "List agents in the active workspace",
|
|
1071
1406
|
builder: (y) => y.option("limit", {
|
|
@@ -1286,10 +1621,76 @@ const aliasCommand = {
|
|
|
1286
1621
|
console.log(aliasActivationHint(result));
|
|
1287
1622
|
}
|
|
1288
1623
|
};
|
|
1624
|
+
const avatarSetCommand = {
|
|
1625
|
+
command: "set <agent>",
|
|
1626
|
+
describe: "Set an agent's avatar photo (PNG, JPEG, or WebP, max 5 MB)",
|
|
1627
|
+
builder: (y) => y.positional("agent", {
|
|
1628
|
+
type: "string",
|
|
1629
|
+
demandOption: true,
|
|
1630
|
+
describe: "Agent id or name to set the avatar on"
|
|
1631
|
+
}).option("file", {
|
|
1632
|
+
type: "string",
|
|
1633
|
+
demandOption: true,
|
|
1634
|
+
describe: "Path to the image file to upload"
|
|
1635
|
+
}).example("skydive agents avatar set Ripple --file avatar.png", "upload a photo"),
|
|
1636
|
+
handler: async (argv) => {
|
|
1637
|
+
const client = requireManagementClient(argv);
|
|
1638
|
+
const agent = await resolveAgent(client, argv.agent);
|
|
1639
|
+
const result = await client.setAgentAvatar({
|
|
1640
|
+
agentId: agent.id,
|
|
1641
|
+
filePath: argv.file
|
|
1642
|
+
});
|
|
1643
|
+
if (result.isErr()) {
|
|
1644
|
+
printError(result.error.message);
|
|
1645
|
+
process.exit(1);
|
|
1646
|
+
}
|
|
1647
|
+
if (argv.json) {
|
|
1648
|
+
output(argv, {
|
|
1649
|
+
agent: agent.id,
|
|
1650
|
+
avatarUrl: result.value.avatarUrl
|
|
1651
|
+
});
|
|
1652
|
+
return;
|
|
1653
|
+
}
|
|
1654
|
+
if (argv.quiet) {
|
|
1655
|
+
console.log(result.value.avatarUrl);
|
|
1656
|
+
return;
|
|
1657
|
+
}
|
|
1658
|
+
console.log(`Avatar set for ${agent.name}.`);
|
|
1659
|
+
}
|
|
1660
|
+
};
|
|
1661
|
+
const avatarRemoveCommand = {
|
|
1662
|
+
command: "remove <agent>",
|
|
1663
|
+
describe: "Remove an agent's uploaded avatar (the generated preset takes over)",
|
|
1664
|
+
builder: (y) => y.positional("agent", {
|
|
1665
|
+
type: "string",
|
|
1666
|
+
demandOption: true,
|
|
1667
|
+
describe: "Agent id or name to remove the avatar from"
|
|
1668
|
+
}),
|
|
1669
|
+
handler: async (argv) => {
|
|
1670
|
+
const client = requireManagementClient(argv);
|
|
1671
|
+
const agent = await resolveAgent(client, argv.agent);
|
|
1672
|
+
const result = await client.deleteAgentAvatar(agent.id);
|
|
1673
|
+
if (result.isErr()) {
|
|
1674
|
+
printError(result.error.message);
|
|
1675
|
+
process.exit(1);
|
|
1676
|
+
}
|
|
1677
|
+
if (argv.json) {
|
|
1678
|
+
output(argv, { agent: agent.id });
|
|
1679
|
+
return;
|
|
1680
|
+
}
|
|
1681
|
+
console.log(`Avatar removed for ${agent.name}.`);
|
|
1682
|
+
}
|
|
1683
|
+
};
|
|
1684
|
+
const avatarCommand = {
|
|
1685
|
+
command: "avatar",
|
|
1686
|
+
describe: "Manage an agent's avatar photo",
|
|
1687
|
+
builder: (y) => y.command(avatarSetCommand).command(avatarRemoveCommand).demandCommand(1, "Specify a subcommand: set, remove"),
|
|
1688
|
+
handler: () => {}
|
|
1689
|
+
};
|
|
1289
1690
|
const agentsCommand = {
|
|
1290
1691
|
command: "agents",
|
|
1291
1692
|
describe: "Manage agents",
|
|
1292
|
-
builder: (y) => y.command(listCommand$
|
|
1693
|
+
builder: (y) => y.command(listCommand$7).command(getCommand$2).command(createCommand$1).command(aliasCommand).command(gitCommand).command(avatarCommand).demandCommand(1, "Specify a subcommand: list, get, create, alias, git, avatar"),
|
|
1293
1694
|
handler: () => {}
|
|
1294
1695
|
};
|
|
1295
1696
|
|
|
@@ -1359,7 +1760,7 @@ function isExecutableFile(p) {
|
|
|
1359
1760
|
if (!fs.statSync(p).isFile()) return false;
|
|
1360
1761
|
if (process.platform !== "win32") fs.accessSync(p, fs.constants.X_OK);
|
|
1361
1762
|
return true;
|
|
1362
|
-
} catch {
|
|
1763
|
+
} catch (_error) {
|
|
1363
1764
|
return false;
|
|
1364
1765
|
}
|
|
1365
1766
|
}
|
|
@@ -1584,7 +1985,7 @@ const importCommand = {
|
|
|
1584
1985
|
process.exit(1);
|
|
1585
1986
|
}
|
|
1586
1987
|
}
|
|
1587
|
-
const { runChat } = await import("./boot-
|
|
1988
|
+
const { runChat } = await import("./boot-DENbHF_1.mjs");
|
|
1588
1989
|
await runChat({
|
|
1589
1990
|
appUrl,
|
|
1590
1991
|
sessionToken: session.value.sessionToken,
|
|
@@ -1614,7 +2015,7 @@ async function runImportPrintMode({ argv, appUrl }) {
|
|
|
1614
2015
|
printError(`${session.error.message} For non-interactive use, run \`skydive auth login --web\` first, or set SKYDIVE_SESSION_TOKEN.`);
|
|
1615
2016
|
process.exit(1);
|
|
1616
2017
|
}
|
|
1617
|
-
const { connectMachineShare } = await import("./print-share-
|
|
2018
|
+
const { connectMachineShare } = await import("./print-share-DyV94dRt.mjs");
|
|
1618
2019
|
const machineShare = await connectMachineShare({
|
|
1619
2020
|
appUrl,
|
|
1620
2021
|
sessionToken: session.value.sessionToken,
|
|
@@ -1622,7 +2023,7 @@ async function runImportPrintMode({ argv, appUrl }) {
|
|
|
1622
2023
|
});
|
|
1623
2024
|
const extra = (argv.print ?? "").trim();
|
|
1624
2025
|
const prompt = buildImportSeedPrompt(process.cwd(), machineOsFromPlatform(process.platform)) + (extra ? `\n\nAdditional instructions: ${extra}` : "");
|
|
1625
|
-
const { runPrint } = await import("./print-
|
|
2026
|
+
const { runPrint } = await import("./print-ClmJYG9P.mjs");
|
|
1626
2027
|
try {
|
|
1627
2028
|
const result = await runPrint({
|
|
1628
2029
|
appUrl,
|
|
@@ -1646,11 +2047,13 @@ async function runImportPrintMode({ argv, appUrl }) {
|
|
|
1646
2047
|
|
|
1647
2048
|
//#endregion
|
|
1648
2049
|
//#region src/commands/keys.ts
|
|
1649
|
-
const listCommand$
|
|
2050
|
+
const listCommand$6 = {
|
|
1650
2051
|
command: "list",
|
|
1651
2052
|
describe: "List API keys for an agent",
|
|
1652
2053
|
handler: async (argv) => {
|
|
1653
|
-
const
|
|
2054
|
+
const client = requireManagementClient(argv);
|
|
2055
|
+
const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
|
|
2056
|
+
const result = await client.listKeys(agentId);
|
|
1654
2057
|
if (result.isErr()) {
|
|
1655
2058
|
printError(result.error.message);
|
|
1656
2059
|
process.exit(1);
|
|
@@ -1686,7 +2089,9 @@ const createCommand = {
|
|
|
1686
2089
|
describe: "Key name"
|
|
1687
2090
|
}),
|
|
1688
2091
|
handler: async (argv) => {
|
|
1689
|
-
const
|
|
2092
|
+
const client = requireManagementClient(argv);
|
|
2093
|
+
const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
|
|
2094
|
+
const result = await client.createKey(agentId, argv.name);
|
|
1690
2095
|
if (result.isErr()) {
|
|
1691
2096
|
printError(result.error.message);
|
|
1692
2097
|
process.exit(1);
|
|
@@ -1716,7 +2121,9 @@ const revokeCommand$1 = {
|
|
|
1716
2121
|
describe: "Key ID"
|
|
1717
2122
|
}),
|
|
1718
2123
|
handler: async (argv) => {
|
|
1719
|
-
const
|
|
2124
|
+
const client = requireManagementClient(argv);
|
|
2125
|
+
const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
|
|
2126
|
+
const result = await client.revokeKey(agentId, argv.id);
|
|
1720
2127
|
if (result.isErr()) {
|
|
1721
2128
|
printError(result.error.message);
|
|
1722
2129
|
process.exit(1);
|
|
@@ -1731,11 +2138,13 @@ const revokeCommand$1 = {
|
|
|
1731
2138
|
const keysCommand = {
|
|
1732
2139
|
command: "keys",
|
|
1733
2140
|
describe: "Manage API keys for an agent",
|
|
1734
|
-
builder: (y) => y.option("agent
|
|
2141
|
+
builder: (y) => y.option("agent", {
|
|
1735
2142
|
type: "string",
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
2143
|
+
describe: "Target agent, by id or name (e.g. --agent my-agent)"
|
|
2144
|
+
}).option("agent-id", {
|
|
2145
|
+
type: "string",
|
|
2146
|
+
describe: "Target agent id (legacy; prefer --agent)"
|
|
2147
|
+
}).command(listCommand$6).command(createCommand).command(revokeCommand$1).demandCommand(1, "Specify a subcommand: list, create, revoke"),
|
|
1739
2148
|
handler: () => {}
|
|
1740
2149
|
};
|
|
1741
2150
|
|
|
@@ -1747,11 +2156,13 @@ async function readStdin() {
|
|
|
1747
2156
|
for await (const chunk of process.stdin) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
1748
2157
|
return Buffer.concat(chunks).toString("utf8").replace(/\n$/, "");
|
|
1749
2158
|
}
|
|
1750
|
-
const listCommand$
|
|
2159
|
+
const listCommand$5 = {
|
|
1751
2160
|
command: "list",
|
|
1752
2161
|
describe: "List secret names for an agent (values are never shown)",
|
|
1753
2162
|
handler: async (argv) => {
|
|
1754
|
-
const
|
|
2163
|
+
const client = requireManagementClient(argv);
|
|
2164
|
+
const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
|
|
2165
|
+
const result = await client.listSecrets(agentId);
|
|
1755
2166
|
if (result.isErr()) {
|
|
1756
2167
|
printError(result.error.message);
|
|
1757
2168
|
process.exit(1);
|
|
@@ -1792,7 +2203,9 @@ const setCommand$1 = {
|
|
|
1792
2203
|
printError("Empty secret value.");
|
|
1793
2204
|
process.exit(1);
|
|
1794
2205
|
}
|
|
1795
|
-
const
|
|
2206
|
+
const client = requireManagementClient(argv);
|
|
2207
|
+
const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
|
|
2208
|
+
const result = await client.setSecret(agentId, argv.key, value);
|
|
1796
2209
|
if (result.isErr()) {
|
|
1797
2210
|
printError(result.error.message);
|
|
1798
2211
|
process.exit(1);
|
|
@@ -1814,7 +2227,9 @@ const rmCommand = {
|
|
|
1814
2227
|
describe: "Secret name"
|
|
1815
2228
|
}),
|
|
1816
2229
|
handler: async (argv) => {
|
|
1817
|
-
const
|
|
2230
|
+
const client = requireManagementClient(argv);
|
|
2231
|
+
const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
|
|
2232
|
+
const result = await client.deleteSecret(agentId, argv.key);
|
|
1818
2233
|
if (result.isErr()) {
|
|
1819
2234
|
printError(result.error.message);
|
|
1820
2235
|
process.exit(1);
|
|
@@ -1829,11 +2244,13 @@ const rmCommand = {
|
|
|
1829
2244
|
const secretsCommand = {
|
|
1830
2245
|
command: "secrets",
|
|
1831
2246
|
describe: "Manage an agent’s secrets",
|
|
1832
|
-
builder: (y) => y.option("agent
|
|
2247
|
+
builder: (y) => y.option("agent", {
|
|
1833
2248
|
type: "string",
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
2249
|
+
describe: "Target agent, by id or name (e.g. --agent my-agent)"
|
|
2250
|
+
}).option("agent-id", {
|
|
2251
|
+
type: "string",
|
|
2252
|
+
describe: "Target agent id (legacy; prefer --agent)"
|
|
2253
|
+
}).command(listCommand$5).command(setCommand$1).command(rmCommand).demandCommand(1, "Specify a subcommand: list, set, rm"),
|
|
1837
2254
|
handler: () => {}
|
|
1838
2255
|
};
|
|
1839
2256
|
|
|
@@ -2029,7 +2446,7 @@ const chatCommand = {
|
|
|
2029
2446
|
sessionToken: auth.value.token,
|
|
2030
2447
|
agentSelector: argv.agent ?? null
|
|
2031
2448
|
});
|
|
2032
|
-
const { runChat } = await import("./boot-
|
|
2449
|
+
const { runChat } = await import("./boot-DENbHF_1.mjs");
|
|
2033
2450
|
await runChat({
|
|
2034
2451
|
appUrl: auth.value.appUrl,
|
|
2035
2452
|
sessionToken: auth.value.token,
|
|
@@ -2113,7 +2530,7 @@ async function runPrintMode({ argv, appUrl }) {
|
|
|
2113
2530
|
printError(`${auth.error.message} For non-interactive use, run \`skydive auth login\` first, or set SKYDIVE_API_KEY / SKYDIVE_SESSION_TOKEN.`);
|
|
2114
2531
|
process.exit(1);
|
|
2115
2532
|
}
|
|
2116
|
-
const { runPrint, readStdin } = await import("./print-
|
|
2533
|
+
const { runPrint, readStdin } = await import("./print-ClmJYG9P.mjs");
|
|
2117
2534
|
const workspaceId = await resolveWorkspaceFlag({
|
|
2118
2535
|
appUrl,
|
|
2119
2536
|
sessionToken: auth.value.token,
|
|
@@ -2143,7 +2560,7 @@ async function runPrintMode({ argv, appUrl }) {
|
|
|
2143
2560
|
process.exit(1);
|
|
2144
2561
|
}
|
|
2145
2562
|
} else {
|
|
2146
|
-
const { connectMachineShare } = await import("./print-share-
|
|
2563
|
+
const { connectMachineShare } = await import("./print-share-DyV94dRt.mjs");
|
|
2147
2564
|
machineShare = await connectMachineShare({
|
|
2148
2565
|
appUrl: auth.value.appUrl,
|
|
2149
2566
|
sessionToken: auth.value.token,
|
|
@@ -2208,7 +2625,7 @@ const getCommand$1 = {
|
|
|
2208
2625
|
printError(`${auth.error.message} Run \`skydive auth login\` first, or set SKYDIVE_API_KEY / SKYDIVE_SESSION_TOKEN.`);
|
|
2209
2626
|
process.exit(1);
|
|
2210
2627
|
}
|
|
2211
|
-
const { messageGet } = await import("./print-
|
|
2628
|
+
const { messageGet } = await import("./print-ClmJYG9P.mjs");
|
|
2212
2629
|
try {
|
|
2213
2630
|
const result = await messageGet({
|
|
2214
2631
|
appUrl: auth.value.appUrl,
|
|
@@ -2255,7 +2672,7 @@ function messageToText(message) {
|
|
|
2255
2672
|
}
|
|
2256
2673
|
return chunks.join("\n").trim();
|
|
2257
2674
|
}
|
|
2258
|
-
const listCommand$
|
|
2675
|
+
const listCommand$4 = {
|
|
2259
2676
|
command: "list",
|
|
2260
2677
|
describe: "List an agent's conversations",
|
|
2261
2678
|
builder: (y) => y.option("agent", {
|
|
@@ -2345,7 +2762,7 @@ const conversationsCommand = {
|
|
|
2345
2762
|
command: "conversations",
|
|
2346
2763
|
aliases: ["conv"],
|
|
2347
2764
|
describe: "List and read agent conversations",
|
|
2348
|
-
builder: (y) => y.command(listCommand$
|
|
2765
|
+
builder: (y) => y.command(listCommand$4).command(showCommand).demandCommand(1, "Specify a subcommand: list, show"),
|
|
2349
2766
|
handler: () => {}
|
|
2350
2767
|
};
|
|
2351
2768
|
|
|
@@ -2387,7 +2804,7 @@ async function runList(argv, { hint }) {
|
|
|
2387
2804
|
]));
|
|
2388
2805
|
if (hint && !argv.quiet) console.log("\nRun `skydive workspace switch` to pick a workspace, or pass its slug directly.");
|
|
2389
2806
|
}
|
|
2390
|
-
const listCommand$
|
|
2807
|
+
const listCommand$3 = {
|
|
2391
2808
|
command: "list",
|
|
2392
2809
|
describe: "List workspaces on your account",
|
|
2393
2810
|
handler: (argv) => runList(argv, { hint: false })
|
|
@@ -2411,7 +2828,7 @@ const switchCommand = {
|
|
|
2411
2828
|
printError("The workspace picker needs the Bun runtime and it could not be set up automatically. Pass a workspace slug instead, or install Bun and retry.");
|
|
2412
2829
|
process.exit(1);
|
|
2413
2830
|
}
|
|
2414
|
-
const { runWorkspacePicker } = await import("./boot-
|
|
2831
|
+
const { runWorkspacePicker } = await import("./boot-DENbHF_1.mjs");
|
|
2415
2832
|
await runWorkspacePicker(session);
|
|
2416
2833
|
return;
|
|
2417
2834
|
}
|
|
@@ -2444,7 +2861,7 @@ const switchCommand = {
|
|
|
2444
2861
|
const workspaceCommand = {
|
|
2445
2862
|
command: "workspace",
|
|
2446
2863
|
describe: "List or switch the workspace all `skydive` commands act on",
|
|
2447
|
-
builder: (y) => y.command(listCommand$
|
|
2864
|
+
builder: (y) => y.command(listCommand$3).command(switchCommand),
|
|
2448
2865
|
handler: (argv) => runList(argv, { hint: true })
|
|
2449
2866
|
};
|
|
2450
2867
|
|
|
@@ -2490,7 +2907,7 @@ const openCommand = {
|
|
|
2490
2907
|
const agent = argv.agent ? resolveAgent$1((await fetchPortalDevices(session)).agents, argv.agent) : null;
|
|
2491
2908
|
const cwd = argv.cwd ? path.resolve(argv.cwd) : process.cwd();
|
|
2492
2909
|
const { machineName } = await resolveMachineIdentity(null);
|
|
2493
|
-
const { PortalDaemonClient } = await import("./daemon-client-
|
|
2910
|
+
const { PortalDaemonClient } = await import("./daemon-client-DG7VEYbY.mjs");
|
|
2494
2911
|
let lastLine = "";
|
|
2495
2912
|
let signalConnected;
|
|
2496
2913
|
const connected = new Promise((resolve) => {
|
|
@@ -2844,11 +3261,14 @@ const sandboxCommand = {
|
|
|
2844
3261
|
type: "string",
|
|
2845
3262
|
array: true,
|
|
2846
3263
|
describe: "Command to run one-shot (streams output, exits with its exit code). Omit for a live interactive terminal. Put it after `--` if it has flags of its own."
|
|
3264
|
+
}).option("timeout", {
|
|
3265
|
+
type: "number",
|
|
3266
|
+
describe: `One-shot commands: kill the command after this many seconds. Without it the server default (~${Math.round(DEFAULT_EXEC_TIMEOUT_MS / 6e4)} min) applies.`
|
|
2847
3267
|
}).example("skydive sandbox --agent grace", "Live terminal (Ctrl-] detaches)").example("skydive sandbox --agent grace -- tail -n 50 /tmp/harness.log", "One-shot command (use `--` so its flags reach the sandbox)").example("skydive sandbox --agent grace -- sh -c 'ls /tmp | wc -l'", "Shell features go through an explicit `sh -c`"),
|
|
2848
3268
|
handler: async (argv) => {
|
|
2849
3269
|
const session = requireSession(argv);
|
|
2850
|
-
const { createRestClient } = await import("./rest-
|
|
2851
|
-
const { resolveAgent } = await import("./print-
|
|
3270
|
+
const { createRestClient } = await import("./rest-DnbZKhDh.mjs");
|
|
3271
|
+
const { resolveAgent } = await import("./print-ClmJYG9P.mjs");
|
|
2852
3272
|
const client = createRestClient({
|
|
2853
3273
|
appUrl: session.appUrl,
|
|
2854
3274
|
sessionToken: session.sessionToken
|
|
@@ -2864,10 +3284,20 @@ const sandboxCommand = {
|
|
|
2864
3284
|
process.exit(1);
|
|
2865
3285
|
}
|
|
2866
3286
|
const command = joinCommandWords([...argv.command ?? [], ...argv["--"] ?? []]);
|
|
3287
|
+
if (argv.timeout !== void 0 && !command) {
|
|
3288
|
+
printError("--timeout applies to a one-shot command; pass one after `--`.");
|
|
3289
|
+
process.exit(1);
|
|
3290
|
+
}
|
|
3291
|
+
if (argv.timeout !== void 0 && (!Number.isFinite(argv.timeout) || argv.timeout <= 0)) {
|
|
3292
|
+
printError("--timeout must be a positive number of seconds.");
|
|
3293
|
+
process.exit(1);
|
|
3294
|
+
}
|
|
3295
|
+
const timeoutMs = argv.timeout !== void 0 ? Math.round(argv.timeout * 1e3) : void 0;
|
|
2867
3296
|
const code = command ? await runExec({
|
|
2868
3297
|
session,
|
|
2869
3298
|
agentId: agent.id,
|
|
2870
|
-
command
|
|
3299
|
+
command,
|
|
3300
|
+
timeoutMs
|
|
2871
3301
|
}) : await runPty({
|
|
2872
3302
|
session,
|
|
2873
3303
|
agentId: agent.id,
|
|
@@ -2877,18 +3307,19 @@ const sandboxCommand = {
|
|
|
2877
3307
|
}
|
|
2878
3308
|
};
|
|
2879
3309
|
/** One-shot exec: stream output to stdout, resolve to the command's exit code. */
|
|
2880
|
-
function runExec({ session, agentId, command }) {
|
|
3310
|
+
function runExec({ session, agentId, command, timeoutMs }) {
|
|
2881
3311
|
console.error("Connecting to the sandbox…");
|
|
2882
3312
|
return new Promise((resolve) => {
|
|
2883
3313
|
const finish = (code) => {
|
|
2884
3314
|
process.stdout.write("", () => resolve(code));
|
|
2885
3315
|
};
|
|
2886
|
-
SandboxStream.open({
|
|
3316
|
+
const stream = SandboxStream.open({
|
|
2887
3317
|
mode: "exec",
|
|
2888
3318
|
appUrl: session.appUrl,
|
|
2889
3319
|
sessionToken: session.sessionToken,
|
|
2890
3320
|
agentId,
|
|
2891
3321
|
command,
|
|
3322
|
+
...timeoutMs !== void 0 ? { timeoutMs } : {},
|
|
2892
3323
|
onEvent: (e) => {
|
|
2893
3324
|
switch (e.type) {
|
|
2894
3325
|
case "data":
|
|
@@ -2906,10 +3337,45 @@ function runExec({ session, agentId, command }) {
|
|
|
2906
3337
|
finish(1);
|
|
2907
3338
|
break;
|
|
2908
3339
|
}
|
|
3340
|
+
stopStdinForwarding();
|
|
2909
3341
|
}
|
|
2910
3342
|
});
|
|
3343
|
+
forwardStdinToStream({
|
|
3344
|
+
stdin: process.stdin,
|
|
3345
|
+
stream
|
|
3346
|
+
});
|
|
2911
3347
|
});
|
|
2912
3348
|
}
|
|
3349
|
+
const STDIN_EOF_INPUT = new Uint8Array(0);
|
|
3350
|
+
let forwardingStdin = null;
|
|
3351
|
+
/**
|
|
3352
|
+
* Forward the caller's stdin into the sandbox stream as INPUT frames (one per
|
|
3353
|
+
* stdin chunk; an empty payload marks end-of-stdin so the remote command gets
|
|
3354
|
+
* a real EOF — `sh -c 'cat > file'` finishes instead of hanging). Nothing is
|
|
3355
|
+
* forwarded when stdin is already closed (no pipe, nothing piped in), which
|
|
3356
|
+
* keeps the plain scripted case exactly where it was.
|
|
3357
|
+
*/
|
|
3358
|
+
function forwardStdinToStream({ stdin, stream }) {
|
|
3359
|
+
if (stdin.readableEnded || stdin.destroyed) return;
|
|
3360
|
+
const onData = (chunk) => stream.sendInput(new Uint8Array(chunk));
|
|
3361
|
+
const onEnd = () => stream.sendInput(STDIN_EOF_INPUT);
|
|
3362
|
+
forwardingStdin = {
|
|
3363
|
+
stdin,
|
|
3364
|
+
onData,
|
|
3365
|
+
onEnd
|
|
3366
|
+
};
|
|
3367
|
+
stdin.on("data", onData);
|
|
3368
|
+
stdin.once("end", onEnd);
|
|
3369
|
+
stdin.resume();
|
|
3370
|
+
}
|
|
3371
|
+
/** Stop forwarding stdin (on a terminal stream event) without killing reads. */
|
|
3372
|
+
function stopStdinForwarding() {
|
|
3373
|
+
const current = forwardingStdin;
|
|
3374
|
+
if (!current) return;
|
|
3375
|
+
forwardingStdin = null;
|
|
3376
|
+
current.stdin.off("data", current.onData);
|
|
3377
|
+
current.stdin.off("end", current.onEnd);
|
|
3378
|
+
}
|
|
2913
3379
|
/** Live terminal on the caller's real TTY. */
|
|
2914
3380
|
async function runPty({ session, agentId, agentName }) {
|
|
2915
3381
|
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
@@ -2917,7 +3383,7 @@ async function runPty({ session, agentId, agentName }) {
|
|
|
2917
3383
|
return 1;
|
|
2918
3384
|
}
|
|
2919
3385
|
console.error(`Connecting to ${agentName}'s sandbox… (Ctrl-] detaches)`);
|
|
2920
|
-
const { runRawPtyPassthrough } = await import("./raw-pty-
|
|
3386
|
+
const { runRawPtyPassthrough } = await import("./raw-pty-BJIs_xjQ.mjs");
|
|
2921
3387
|
const result = await runRawPtyPassthrough({
|
|
2922
3388
|
stdin: process.stdin,
|
|
2923
3389
|
stdout: process.stdout,
|
|
@@ -3088,6 +3554,53 @@ function resolveEditor(override, env, platform = process.platform) {
|
|
|
3088
3554
|
};
|
|
3089
3555
|
}
|
|
3090
3556
|
/**
|
|
3557
|
+
* Resolve the target agent and open the multiplexed fs channel to its
|
|
3558
|
+
* sandbox. Shared by every `fs` subcommand. A failed agent listing or a
|
|
3559
|
+
* failed upgrade (expired session, an agent the caller can't edit, or the
|
|
3560
|
+
* `sandbox-fs-enabled` kill switch) exits here before any file work.
|
|
3561
|
+
*/
|
|
3562
|
+
async function openAgentFs(session, agentSelector) {
|
|
3563
|
+
const { createRestClient } = await import("./rest-DnbZKhDh.mjs");
|
|
3564
|
+
const { resolveAgent } = await import("./print-ClmJYG9P.mjs");
|
|
3565
|
+
let agent;
|
|
3566
|
+
try {
|
|
3567
|
+
agent = resolveAgent(await createRestClient({
|
|
3568
|
+
appUrl: session.appUrl,
|
|
3569
|
+
sessionToken: session.sessionToken
|
|
3570
|
+
}).listAgents({
|
|
3571
|
+
scope: "org",
|
|
3572
|
+
onPage: null
|
|
3573
|
+
}), agentSelector);
|
|
3574
|
+
} catch (error) {
|
|
3575
|
+
printError(error instanceof Error ? error.message : String(error));
|
|
3576
|
+
process.exit(1);
|
|
3577
|
+
}
|
|
3578
|
+
let fs;
|
|
3579
|
+
try {
|
|
3580
|
+
fs = await SandboxFsClient.connect({
|
|
3581
|
+
appUrl: session.appUrl,
|
|
3582
|
+
sessionToken: session.sessionToken,
|
|
3583
|
+
agentId: agent.id
|
|
3584
|
+
});
|
|
3585
|
+
} catch (error) {
|
|
3586
|
+
printError(`Could not open the sandbox filesystem channel: ${error instanceof Error ? error.message : String(error)}`);
|
|
3587
|
+
process.exit(1);
|
|
3588
|
+
}
|
|
3589
|
+
return {
|
|
3590
|
+
agent,
|
|
3591
|
+
fs
|
|
3592
|
+
};
|
|
3593
|
+
}
|
|
3594
|
+
/**
|
|
3595
|
+
* The oversized-file error for `fs put` and `fs cp`. The fs channel's write
|
|
3596
|
+
* op is whole-file only (no offset or append), so the CLI cannot chunk a
|
|
3597
|
+
* file larger than the relay's per-write cap — the web Files tab is the path
|
|
3598
|
+
* for those.
|
|
3599
|
+
*/
|
|
3600
|
+
function oversizeWriteError(label, size) {
|
|
3601
|
+
return `${label} is ${size} bytes, over the ${Math.floor(FS_MAX_BLOB_BYTES / (1024 * 1024))}MB per-write cap of the sandbox filesystem channel. Upload larger files through the Files tab in the web app instead.`;
|
|
3602
|
+
}
|
|
3603
|
+
/**
|
|
3091
3604
|
* `skydive fs edit <path>` — edit a file that lives on the agent's computer
|
|
3092
3605
|
* (its sandbox) with your LOCAL editor. It reads the remote file down over the
|
|
3093
3606
|
* multiplexed `fs` sandbox-stream channel, opens it in `$EDITOR`, and writes
|
|
@@ -3119,33 +3632,7 @@ const fsEditCommand = {
|
|
|
3119
3632
|
handler: async (argv) => {
|
|
3120
3633
|
const session = requireSession(argv);
|
|
3121
3634
|
const remotePath = argv.path;
|
|
3122
|
-
const {
|
|
3123
|
-
const { resolveAgent } = await import("./print-sWlw3B6z.mjs");
|
|
3124
|
-
const client = createRestClient({
|
|
3125
|
-
appUrl: session.appUrl,
|
|
3126
|
-
sessionToken: session.sessionToken
|
|
3127
|
-
});
|
|
3128
|
-
let agent;
|
|
3129
|
-
try {
|
|
3130
|
-
agent = resolveAgent(await client.listAgents({
|
|
3131
|
-
scope: "org",
|
|
3132
|
-
onPage: null
|
|
3133
|
-
}), argv.agent ?? null);
|
|
3134
|
-
} catch (error) {
|
|
3135
|
-
printError(error instanceof Error ? error.message : String(error));
|
|
3136
|
-
process.exit(1);
|
|
3137
|
-
}
|
|
3138
|
-
let fs;
|
|
3139
|
-
try {
|
|
3140
|
-
fs = await SandboxFsClient.connect({
|
|
3141
|
-
appUrl: session.appUrl,
|
|
3142
|
-
sessionToken: session.sessionToken,
|
|
3143
|
-
agentId: agent.id
|
|
3144
|
-
});
|
|
3145
|
-
} catch (error) {
|
|
3146
|
-
printError(`Could not open the sandbox filesystem channel: ${error instanceof Error ? error.message : String(error)}`);
|
|
3147
|
-
process.exit(1);
|
|
3148
|
-
}
|
|
3635
|
+
const { agent, fs } = await openAgentFs(session, argv.agent ?? null);
|
|
3149
3636
|
const cleanup = async (dir) => {
|
|
3150
3637
|
await rm(dir, {
|
|
3151
3638
|
recursive: true,
|
|
@@ -3210,21 +3697,157 @@ function openEditor(override, file) {
|
|
|
3210
3697
|
});
|
|
3211
3698
|
}
|
|
3212
3699
|
/**
|
|
3700
|
+
* Upload a local file to a path on the agent's sandbox in one `write` op.
|
|
3701
|
+
* The relay caps a single write's payload at {@link FS_MAX_BLOB_BYTES} and the
|
|
3702
|
+
* write op is whole-file only (no offset/append), so a larger file is
|
|
3703
|
+
* rejected up front with a pointer to the web Files tab rather than a
|
|
3704
|
+
* truncated or partial upload.
|
|
3705
|
+
*/
|
|
3706
|
+
const fsPutCommand = {
|
|
3707
|
+
command: "put <agent> <local-file> <remote-path>",
|
|
3708
|
+
describe: "Copy a file from your machine onto the agent's sandbox",
|
|
3709
|
+
builder: (y) => y.positional("agent", {
|
|
3710
|
+
type: "string",
|
|
3711
|
+
demandOption: true,
|
|
3712
|
+
describe: "Target agent, by id, slug, or name"
|
|
3713
|
+
}).positional("local-file", {
|
|
3714
|
+
type: "string",
|
|
3715
|
+
demandOption: true,
|
|
3716
|
+
describe: "Path of the file on your machine to upload"
|
|
3717
|
+
}).positional("remote-path", {
|
|
3718
|
+
type: "string",
|
|
3719
|
+
demandOption: true,
|
|
3720
|
+
describe: "Absolute or sandbox-relative path to write it to"
|
|
3721
|
+
}).example("skydive fs put grace ./report.pdf /home/user/Downloads/report.pdf", "Upload a local file to the sandbox"),
|
|
3722
|
+
handler: async (argv) => {
|
|
3723
|
+
const { fs } = await openAgentFs(requireSession(argv), argv.agent ?? null);
|
|
3724
|
+
try {
|
|
3725
|
+
const localStat = await stat(argv["local-file"]);
|
|
3726
|
+
if (localStat.isDirectory()) {
|
|
3727
|
+
printError(`${argv["local-file"]} is a directory; fs put copies a single file.`);
|
|
3728
|
+
process.exit(1);
|
|
3729
|
+
}
|
|
3730
|
+
if (localStat.size > FS_MAX_BLOB_BYTES) {
|
|
3731
|
+
printError(oversizeWriteError(argv["local-file"], localStat.size));
|
|
3732
|
+
process.exit(1);
|
|
3733
|
+
}
|
|
3734
|
+
const bytes = await readFile(argv["local-file"]);
|
|
3735
|
+
await fs.write(argv["remote-path"], new Uint8Array(bytes));
|
|
3736
|
+
fs.close();
|
|
3737
|
+
} catch (error) {
|
|
3738
|
+
fs.close();
|
|
3739
|
+
printError(error instanceof Error ? error.message : String(error));
|
|
3740
|
+
process.exit(1);
|
|
3741
|
+
}
|
|
3742
|
+
}
|
|
3743
|
+
};
|
|
3744
|
+
/**
|
|
3745
|
+
* Download a file from the agent's sandbox to a local path. Reads are
|
|
3746
|
+
* range-based, so a file of any size comes down in chunks of
|
|
3747
|
+
* {@link FS_MAX_BLOB_BYTES}; the chunks are concatenated into one local
|
|
3748
|
+
* write. Silent on success so it composes in scripts (exit code carries the
|
|
3749
|
+
* result).
|
|
3750
|
+
*/
|
|
3751
|
+
const fsGetCommand = {
|
|
3752
|
+
command: "get <agent> <remote-path> <local-path>",
|
|
3753
|
+
describe: "Copy a file from the agent's sandbox onto your machine",
|
|
3754
|
+
builder: (y) => y.positional("agent", {
|
|
3755
|
+
type: "string",
|
|
3756
|
+
demandOption: true,
|
|
3757
|
+
describe: "Target agent, by id, slug, or name"
|
|
3758
|
+
}).positional("remote-path", {
|
|
3759
|
+
type: "string",
|
|
3760
|
+
demandOption: true,
|
|
3761
|
+
describe: "Absolute or sandbox-relative path of the file to download"
|
|
3762
|
+
}).positional("local-path", {
|
|
3763
|
+
type: "string",
|
|
3764
|
+
demandOption: true,
|
|
3765
|
+
describe: "Path on your machine to write it to"
|
|
3766
|
+
}).example("skydive fs get grace /home/user/.self/soul.md ./soul.md", "Download a file from the sandbox"),
|
|
3767
|
+
handler: async (argv) => {
|
|
3768
|
+
const { fs } = await openAgentFs(requireSession(argv), argv.agent ?? null);
|
|
3769
|
+
try {
|
|
3770
|
+
const remoteStat = await fs.stat(argv["remote-path"]);
|
|
3771
|
+
if (remoteStat.type === "dir") {
|
|
3772
|
+
printError(`${argv["remote-path"]} is a directory; fs get copies a single file.`);
|
|
3773
|
+
process.exit(1);
|
|
3774
|
+
}
|
|
3775
|
+
const chunks = [];
|
|
3776
|
+
for (let offset = 0; offset < remoteStat.size; offset += FS_MAX_BLOB_BYTES) chunks.push(await fs.read(argv["remote-path"], {
|
|
3777
|
+
offset,
|
|
3778
|
+
length: FS_MAX_BLOB_BYTES
|
|
3779
|
+
}));
|
|
3780
|
+
await writeFile(argv["local-path"], Buffer.concat(chunks));
|
|
3781
|
+
fs.close();
|
|
3782
|
+
} catch (error) {
|
|
3783
|
+
fs.close();
|
|
3784
|
+
printError(error instanceof Error ? error.message : String(error));
|
|
3785
|
+
process.exit(1);
|
|
3786
|
+
}
|
|
3787
|
+
}
|
|
3788
|
+
};
|
|
3789
|
+
/**
|
|
3790
|
+
* Copy a file from one sandbox path to another, via one read and one write.
|
|
3791
|
+
* Same per-write cap as `fs put`: the write op is whole-file only, so a
|
|
3792
|
+
* source larger than {@link FS_MAX_BLOB_BYTES} is rejected up front.
|
|
3793
|
+
*/
|
|
3794
|
+
const fsCpCommand = {
|
|
3795
|
+
command: "cp <agent> <src> <dst>",
|
|
3796
|
+
describe: "Copy a file to another path inside the agent's sandbox",
|
|
3797
|
+
builder: (y) => y.positional("agent", {
|
|
3798
|
+
type: "string",
|
|
3799
|
+
demandOption: true,
|
|
3800
|
+
describe: "Target agent, by id, slug, or name"
|
|
3801
|
+
}).positional("src", {
|
|
3802
|
+
type: "string",
|
|
3803
|
+
demandOption: true,
|
|
3804
|
+
describe: "Absolute or sandbox-relative path of the file to copy"
|
|
3805
|
+
}).positional("dst", {
|
|
3806
|
+
type: "string",
|
|
3807
|
+
demandOption: true,
|
|
3808
|
+
describe: "Absolute or sandbox-relative path to copy it to"
|
|
3809
|
+
}).example("skydive fs cp grace /tmp/notes.md /home/user/.self/notes.md", "Copy a file within the sandbox"),
|
|
3810
|
+
handler: async (argv) => {
|
|
3811
|
+
const { fs } = await openAgentFs(requireSession(argv), argv.agent ?? null);
|
|
3812
|
+
try {
|
|
3813
|
+
const srcStat = await fs.stat(argv.src);
|
|
3814
|
+
if (srcStat.type === "dir") {
|
|
3815
|
+
printError(`${argv.src} is a directory; fs cp copies a single file.`);
|
|
3816
|
+
process.exit(1);
|
|
3817
|
+
}
|
|
3818
|
+
if (srcStat.size > FS_MAX_BLOB_BYTES) {
|
|
3819
|
+
printError(oversizeWriteError(argv.src, srcStat.size));
|
|
3820
|
+
process.exit(1);
|
|
3821
|
+
}
|
|
3822
|
+
const bytes = await fs.read(argv.src, null);
|
|
3823
|
+
await fs.write(argv.dst, bytes);
|
|
3824
|
+
fs.close();
|
|
3825
|
+
} catch (error) {
|
|
3826
|
+
fs.close();
|
|
3827
|
+
printError(error instanceof Error ? error.message : String(error));
|
|
3828
|
+
process.exit(1);
|
|
3829
|
+
}
|
|
3830
|
+
}
|
|
3831
|
+
};
|
|
3832
|
+
/**
|
|
3213
3833
|
* `skydive fs` — work with the files on an agent's computer (its sandbox) from
|
|
3214
3834
|
* your own machine. The namespace for filesystem access:
|
|
3215
3835
|
*
|
|
3216
|
-
* - `fs edit <path>` edit one remote file with your local editor
|
|
3836
|
+
* - `fs edit <path>` edit one remote file with your local editor.
|
|
3837
|
+
* - `fs put ...` upload a local file to the sandbox.
|
|
3838
|
+
* - `fs get ...` download a sandbox file to your machine.
|
|
3839
|
+
* - `fs cp ...` copy a file within the sandbox.
|
|
3217
3840
|
* - `fs mount <dir>` mount the whole sandbox filesystem locally (coming in a
|
|
3218
3841
|
* later PR, on the same first-class `fs` relay channel).
|
|
3219
3842
|
*
|
|
3220
3843
|
* Grouping these under one command keeps the file surface discoverable and
|
|
3221
|
-
* leaves room to grow (`fs ls`, `fs cat
|
|
3222
|
-
*
|
|
3844
|
+
* leaves room to grow (`fs ls`, `fs cat`) without adding more top-level
|
|
3845
|
+
* commands.
|
|
3223
3846
|
*/
|
|
3224
3847
|
const fsCommand = {
|
|
3225
3848
|
command: "fs <command>",
|
|
3226
3849
|
describe: "Work with the files on an agent's computer (its sandbox)",
|
|
3227
|
-
builder: (y) => y.command(fsEditCommand).demandCommand(1, "Specify a subcommand: edit"),
|
|
3850
|
+
builder: (y) => y.command(fsEditCommand).command(fsPutCommand).command(fsGetCommand).command(fsCpCommand).demandCommand(1, "Specify a subcommand: edit, put, get, cp"),
|
|
3228
3851
|
handler: () => {}
|
|
3229
3852
|
};
|
|
3230
3853
|
|
|
@@ -3782,7 +4405,8 @@ async function offerPackageManagerUpdate(opts) {
|
|
|
3782
4405
|
function relaunchCli(argv = process.argv) {
|
|
3783
4406
|
try {
|
|
3784
4407
|
const [, script, ...rest] = argv;
|
|
3785
|
-
|
|
4408
|
+
const args = script?.startsWith("/$bunfs/") ? rest : script ? [script, ...rest] : rest;
|
|
4409
|
+
spawn(process.execPath, args, { stdio: "inherit" }).on("exit", (code) => process.exit(code ?? 0));
|
|
3786
4410
|
} catch (_error) {
|
|
3787
4411
|
process.exit(0);
|
|
3788
4412
|
}
|
|
@@ -3951,7 +4575,7 @@ function snapshot(pref) {
|
|
|
3951
4575
|
describe: pref.describe
|
|
3952
4576
|
};
|
|
3953
4577
|
}
|
|
3954
|
-
const listCommand$
|
|
4578
|
+
const listCommand$2 = {
|
|
3955
4579
|
command: "list",
|
|
3956
4580
|
aliases: ["ls"],
|
|
3957
4581
|
describe: "Show every editable preference, its value, and its source",
|
|
@@ -4056,8 +4680,162 @@ const pathCommand$1 = {
|
|
|
4056
4680
|
const configCommand = {
|
|
4057
4681
|
command: "config",
|
|
4058
4682
|
describe: "View and set CLI preferences (safe, hand-editable keys only)",
|
|
4059
|
-
builder: (y) => y.command(listCommand$
|
|
4060
|
-
handler: (argv) => listCommand$
|
|
4683
|
+
builder: (y) => y.command(listCommand$2).command(getCommand).command(setCommand).command(unsetCommand).command(pathCommand$1),
|
|
4684
|
+
handler: (argv) => listCommand$2.handler(argv)
|
|
4685
|
+
};
|
|
4686
|
+
|
|
4687
|
+
//#endregion
|
|
4688
|
+
//#region src/commands/proxy.ts
|
|
4689
|
+
/**
|
|
4690
|
+
* `skydive proxy skip-list` — manage the sandbox egress proxy's custom skip
|
|
4691
|
+
* list. The agent-visible verbs are `skip-list add <host…>` / `skip-list
|
|
4692
|
+
* remove <host…>`; a bare `skip-list` lists what is currently skipped.
|
|
4693
|
+
*
|
|
4694
|
+
* Skipped hosts leave the sandbox RAW: the mitmproxy addon forwards them
|
|
4695
|
+
* without rewriting through the transparent proxy, which means NO platform
|
|
4696
|
+
* credential injection (that's the point — a user's own API keys go straight
|
|
4697
|
+
* to the provider), but also no agent rules, no content policy, no billing
|
|
4698
|
+
* gate, and no platform-side record of the egress.
|
|
4699
|
+
*
|
|
4700
|
+
* Config is agent-scoped runtime state: it lives in the in-sandbox daemon's
|
|
4701
|
+
* env and survives daemon restarts and pause/resume, but resets on a fresh
|
|
4702
|
+
* box (a new sandbox cold-create starts with the addon's built-in defaults
|
|
4703
|
+
* only). Platform control-plane hosts can never be skipped.
|
|
4704
|
+
*
|
|
4705
|
+
* Loopback-only daemon routes: this command only works INSIDE a sandbox
|
|
4706
|
+
* (where the egress proxy actually runs).
|
|
4707
|
+
*/
|
|
4708
|
+
const DAEMON_BASE_URL = process.env["SKYDIVE_DAEMON_URL"] ?? "http://localhost:38994";
|
|
4709
|
+
async function daemonFetch(path, init) {
|
|
4710
|
+
try {
|
|
4711
|
+
const res = await fetch(`${DAEMON_BASE_URL}${path}`, {
|
|
4712
|
+
...init,
|
|
4713
|
+
headers: {
|
|
4714
|
+
"Content-Type": "application/json",
|
|
4715
|
+
...init?.headers
|
|
4716
|
+
}
|
|
4717
|
+
});
|
|
4718
|
+
const parsed = z.object({
|
|
4719
|
+
hosts: z.array(z.string()).optional(),
|
|
4720
|
+
error: z.string().optional()
|
|
4721
|
+
}).safeParse(await res.json().catch((_error) => ({})));
|
|
4722
|
+
const body = parsed.success ? parsed.data : {};
|
|
4723
|
+
return {
|
|
4724
|
+
status: res.status,
|
|
4725
|
+
body
|
|
4726
|
+
};
|
|
4727
|
+
} catch (err) {
|
|
4728
|
+
return {
|
|
4729
|
+
status: 0,
|
|
4730
|
+
body: { error: `Could not reach the sandbox daemon at ${DAEMON_BASE_URL}. This command only works inside a sandbox. (${err instanceof Error ? err.message : String(err)})` }
|
|
4731
|
+
};
|
|
4732
|
+
}
|
|
4733
|
+
}
|
|
4734
|
+
function printHosts(argv, hosts) {
|
|
4735
|
+
if (argv.json) {
|
|
4736
|
+
output(argv, { hosts });
|
|
4737
|
+
return;
|
|
4738
|
+
}
|
|
4739
|
+
if (hosts.length === 0) {
|
|
4740
|
+
console.log("No custom skip hosts. (Platform defaults still apply.)");
|
|
4741
|
+
return;
|
|
4742
|
+
}
|
|
4743
|
+
printTable(["Host"], hosts.map((h) => [h]));
|
|
4744
|
+
}
|
|
4745
|
+
const listCommand$1 = {
|
|
4746
|
+
command: "list",
|
|
4747
|
+
aliases: ["ls"],
|
|
4748
|
+
describe: "Show the custom proxy skip hosts (same as bare `skip-list`)",
|
|
4749
|
+
handler: async (argv) => {
|
|
4750
|
+
const { status, body } = await daemonFetch("/v1/proxy/skip-list", null);
|
|
4751
|
+
if (status !== 200) {
|
|
4752
|
+
printError(body.error ?? `daemon /v1/proxy/skip-list: ${status}`);
|
|
4753
|
+
process.exit(1);
|
|
4754
|
+
}
|
|
4755
|
+
printHosts(argv, body.hosts ?? []);
|
|
4756
|
+
}
|
|
4757
|
+
};
|
|
4758
|
+
const addCommand = {
|
|
4759
|
+
command: "add <hosts..>",
|
|
4760
|
+
describe: "Skip the proxy for exact host(s). Their traffic leaves the sandbox RAW: no platform credential injection, no agent rules, no billing gate.",
|
|
4761
|
+
builder: (y) => y.positional("hosts", {
|
|
4762
|
+
type: "string",
|
|
4763
|
+
array: true,
|
|
4764
|
+
demandOption: true,
|
|
4765
|
+
describe: "One or more exact hostnames (api.example.com), no wildcards"
|
|
4766
|
+
}),
|
|
4767
|
+
handler: async (argv) => {
|
|
4768
|
+
for (const host of argv.hosts) {
|
|
4769
|
+
const { status, body } = await daemonFetch("/v1/proxy/skip-list/add", {
|
|
4770
|
+
method: "POST",
|
|
4771
|
+
body: JSON.stringify({ host })
|
|
4772
|
+
});
|
|
4773
|
+
if (status === 0) {
|
|
4774
|
+
printError(body.error ?? `daemon unreachable (host ${host})`);
|
|
4775
|
+
process.exitCode = 1;
|
|
4776
|
+
continue;
|
|
4777
|
+
}
|
|
4778
|
+
if (status !== 200) {
|
|
4779
|
+
printError(`${host}: ${body.error ?? status}`);
|
|
4780
|
+
process.exitCode = 1;
|
|
4781
|
+
continue;
|
|
4782
|
+
}
|
|
4783
|
+
if (argv.json) output(argv, {
|
|
4784
|
+
host,
|
|
4785
|
+
hosts: body.hosts ?? []
|
|
4786
|
+
});
|
|
4787
|
+
else console.log(`${host} is now skipped: requests to it leave the sandbox raw (no platform credential injection).`);
|
|
4788
|
+
}
|
|
4789
|
+
}
|
|
4790
|
+
};
|
|
4791
|
+
const removeCommand = {
|
|
4792
|
+
command: "remove <hosts..>",
|
|
4793
|
+
aliases: ["rm"],
|
|
4794
|
+
describe: "Remove host(s) from the custom skip list",
|
|
4795
|
+
builder: (y) => y.positional("hosts", {
|
|
4796
|
+
type: "string",
|
|
4797
|
+
array: true,
|
|
4798
|
+
demandOption: true,
|
|
4799
|
+
describe: "Exact hostnames to remove"
|
|
4800
|
+
}),
|
|
4801
|
+
handler: async (argv) => {
|
|
4802
|
+
for (const host of argv.hosts) {
|
|
4803
|
+
const { status, body } = await daemonFetch("/v1/proxy/skip-list/remove", {
|
|
4804
|
+
method: "POST",
|
|
4805
|
+
body: JSON.stringify({ host })
|
|
4806
|
+
});
|
|
4807
|
+
if (status === 0) {
|
|
4808
|
+
printError(body.error ?? `daemon unreachable (host ${host})`);
|
|
4809
|
+
process.exitCode = 1;
|
|
4810
|
+
continue;
|
|
4811
|
+
}
|
|
4812
|
+
if (status !== 200) {
|
|
4813
|
+
printError(`${host}: ${body.error ?? status}`);
|
|
4814
|
+
process.exitCode = 1;
|
|
4815
|
+
continue;
|
|
4816
|
+
}
|
|
4817
|
+
if (argv.json) output(argv, {
|
|
4818
|
+
host,
|
|
4819
|
+
hosts: body.hosts ?? []
|
|
4820
|
+
});
|
|
4821
|
+
else console.log(`${host} removed from the skip list.`);
|
|
4822
|
+
}
|
|
4823
|
+
}
|
|
4824
|
+
};
|
|
4825
|
+
/** `skydive proxy skip-list` — no subcommand lists; add/remove mutate. */
|
|
4826
|
+
const skipListCommand = {
|
|
4827
|
+
command: "skip-list [command]",
|
|
4828
|
+
describe: "Manage hosts that bypass the egress proxy",
|
|
4829
|
+
builder: (y) => y.command(listCommand$1).command(addCommand).command(removeCommand).default("command", "list"),
|
|
4830
|
+
handler: async (argv) => {
|
|
4831
|
+
if (argv.command === "list" || argv.command === "ls") await listCommand$1.handler(argv);
|
|
4832
|
+
}
|
|
4833
|
+
};
|
|
4834
|
+
const proxyCommand = {
|
|
4835
|
+
command: "proxy <command>",
|
|
4836
|
+
describe: "Inspect and configure the sandbox egress proxy",
|
|
4837
|
+
builder: (y) => y.command(skipListCommand).demandCommand(1, "Run `skydive proxy skip-list`"),
|
|
4838
|
+
handler: () => {}
|
|
4061
4839
|
};
|
|
4062
4840
|
|
|
4063
4841
|
//#endregion
|
|
@@ -4114,7 +4892,7 @@ async function offerIssueReport(archivePath) {
|
|
|
4114
4892
|
console.log(`File an issue: ${ISSUE_REPOSITORY_URL}`);
|
|
4115
4893
|
return;
|
|
4116
4894
|
}
|
|
4117
|
-
await open(issueUrl(archivePath));
|
|
4895
|
+
await open$1(issueUrl(archivePath));
|
|
4118
4896
|
console.log(`Attach the diagnostics archive: ${archivePath}`);
|
|
4119
4897
|
} finally {
|
|
4120
4898
|
prompt.close();
|
|
@@ -4217,7 +4995,7 @@ function createCli(argv) {
|
|
|
4217
4995
|
type: "string",
|
|
4218
4996
|
global: true,
|
|
4219
4997
|
describe: "Override API base URL"
|
|
4220
|
-
}).command(authCommand).command(chatCommand).command(messagesCommand).command(conversationsCommand).command(agentsCommand).command(importCommand).command(keysCommand).command(secretsCommand).command(workspaceCommand).command(portalCommand).command(sandboxCommand).command(fsCommand).command(updateCommand).command(configCommand).command(logsCommand).command(completionCommand).demandCommand(1, "Specify a command. Run --help for usage.").strict().wrap(null).version(version).alias("v", "version").alias("h", "help").help().fail((msg, err) => {
|
|
4998
|
+
}).command(authCommand).command(chatCommand).command(messagesCommand).command(conversationsCommand).command(agentsCommand).command(importCommand).command(keysCommand).command(secretsCommand).command(workspaceCommand).command(portalCommand).command(sandboxCommand).command(fsCommand).command(updateCommand).command(configCommand).command(proxyCommand).command(logsCommand).command(completionCommand).demandCommand(1, "Specify a command. Run --help for usage.").strict().wrap(null).version(version).alias("v", "version").alias("h", "help").help().fail((msg, err) => {
|
|
4221
4999
|
printError(err ? err instanceof Error ? err.message : String(err) : msg ?? "Unknown error");
|
|
4222
5000
|
process.exit(1);
|
|
4223
5001
|
});
|
|
@@ -4430,7 +5208,7 @@ function setupUpdateCheck(argv) {
|
|
|
4430
5208
|
|
|
4431
5209
|
//#endregion
|
|
4432
5210
|
//#region src/changelog.generated.ts
|
|
4433
|
-
const CHANGELOG_MD = "# Changelog\n\nAll notable changes to the Skydive CLI are documented here.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## [Unreleased]\n\n### Changed\n\n- The chat TUI status bar now always shows where the portal stands, instead of only lighting up once everything already worked. It reads `portal off`, `portal connecting`, `portal on` (open on this machine, but this agent has no grant), `portal shared` (green — this agent can run commands here), `portal error`, or `portal unavailable` when you signed in with an API key and no portal is possible. Previously the badge rendered nothing in every one of those states, so \"why can't the agent reach my machine?\" had no answer on screen.\n- One word for that feature across the whole CLI: **portal**. The footer hint is now `ctrl+t portal` / `ctrl+t close portal` (was `local access` / `revoke access`), `/status` reports a `portal` row (was `local access`), and `/share` and `/portal` describe themselves as opening the portal and granting an agent access to your machine. `/portal` used to say \"access your computer\", which collided with `/computer` — that command still means the **agent's** sandbox, and \"computer\" stays reserved for it. `--share-machine` and the `shareMachineDefault` config key are unchanged.\n- `npm i -g skydive-cli` (and yarn/pnpm/bun) now installs a tiny launcher plus one prebuilt, os/cpu-matched binary that carries its own runtime — so on the common platforms `skydive chat` and `skydive import` start instantly and **do not download a Bun runtime on first use**. On any platform without a prebuilt binary (or if the optional dependency is skipped), the CLI automatically falls back to the existing behavior: it runs under your Node and provisions Bun on first `chat`, exactly as before. Nothing about the commands, flags, config, or `SKYDIVE_*` environment variables changes, and `skydive update` still upgrades npm installs via your package manager and standalone-binary installs in place.\n\n### Added\n\n- Files an agent shares into the conversation now show as a saveable row in the chat TUI. When the agent sends you a file (a report, an export, a screenshot), it appears as a `📎` row with the filename and size and a \"click to save\" hint; clicking it downloads the file to your `~/Downloads` (falling back to your home directory) and opens it with your default app, then the row shows where it landed. Clicking a saved row again re-opens it. Previously these files were only reachable in the web app — in the terminal they were invisible.\n- `platform ask` forms now render in the chat TUI. The card lists each question with lettered options (A/B/C/D plus Other); `ctrl+r` opens a full overlay picker (one question at a time, arrows + enter, Other as a typed row — the Claude Code interaction). The answer sends as a normal message. Headless `chat -p` prints the question as an `[action needed]` block instead of dropping it.\n- Every API request now reports this install's version (`x-skydive-cli-version`) so the server can refuse features the installed CLI cannot render — `platform ask` needs the #21411 canary (`0.5.0-beta.43` or newer), not 0.4.0 and not earlier 0.5.0 betas.\n- `/search` (alias `/find`) in the chat TUI — opens the conversation picker with its search field focused, so \"find a conversation\" has a discoverable command instead of being a feature you had to know the bare picker already had. Pass a query inline (`/search billing deep dive`) and the picker opens already narrowed to the matches; bare `/search` opens it ready for you to type. The search runs server-side across conversation titles, message bodies, and participant names, the same search the picker exposes.\n- First run in a workspace with no agents now sets you up automatically: instead of dropping you on an empty agent picker, `skydive` creates your first agent for you (with a suggested name and avatar, mirroring the web onboarding flow) and then offers to have it learn how you already work — reading the other coding agents set up on your machine (Claude Code, Cursor, Codex, and more), the same import that `skydive import` runs, with a plan shown first and credentials never copied. Decline and you go straight into the new agent's chat. You can replay this flow anytime with `skydive --onboarding` (or `SKYDIVE_FORCE_ONBOARDING=1`), even in a workspace that already has agents.\n- `/computer` in the chat TUI — a snapshot of the agent's sandbox drawn as colored bar graphs: CPU, memory, and disk usage. Bars turn amber past 75%% and red past 90%% so a glance tells you whether the box is under pressure. The numbers come from the Skydive API (the same live resource sample the web computer view reads), not by connecting to the sandbox — so the card shows instantly, never waking or hanging on a box that isn't running: when the agent has no live sandbox it simply reads \"no sandbox running\". The card keeps itself current quietly (a slow background refresh, no flicker or \"updating\" chrome); only the most recent card refreshes, and it silently stops while you're scrolled up (no wasted polls on a card you're not looking at) and resumes at the bottom.\n- `/computer restart` in the chat TUI — reboot the agent's sandbox from chat. It asks a `y`/`n` confirm first (the restart stops whatever run is going and brings up a fresh box), then enqueues the same restart the web \"Restart\" control does. Available to anyone with edit access to the agent; view-only members are told they can't.\n- `skydive fs` — a namespace for working with the files on an agent's computer (its sandbox) from your own machine. Its first subcommand, `skydive fs edit <path>`, reads a remote file down over the same relay `skydive sandbox` uses, opens it in your local editor (`$VISUAL`/`$EDITOR`, override with `--editor`, defaults to `vi`), and writes your changes back atomically when you save and close — so you can edit a remote file as if it were local without opening the chat TUI. A path that doesn't exist yet is created on save; no changes means nothing is written. Access is gated on EDIT permission for the agent, exactly like `skydive sandbox`. (A first-class `fs` relay channel and `skydive fs mount` land in follow-ups.)\n\n## [0.4.0] - 2026-08-07\n\n### Added\n\n- `skydive chat` works with API key auth: an API key alone now opens the chat TUI (and headless `chat -p`) without a browser login, using the key's pinned workspace.\n- `skydive config` command to view and set the safe, hand-editable CLI preferences (`shareMachineDefault`, `updateCheck`) without opening `config.json`. `config`/`config list` shows each key, its effective value, and whether it comes from the file or the built-in default; `config get`/`set`/`unset` read and change one key; `config path` prints the config file location. It only ever touches those preference keys, never credentials or flow-managed state.\n- Billing-blocked sends and runs now surface the server-authored recovery\n guidance from the typed billing outcome. The chat TUI renders it as a\n warning-toned system-notice row — live when a send is refused or a run is\n stopped at the billing boundary, and again when reopening a conversation\n that holds a persisted billing notice — instead of a generic error.\n Headless `chat -p` and `messages get` print the guidance (state, recovery\n step, and manage-billing URL) on stderr, keep any partial output already\n streamed on stdout, and exit with code `5` (distinct from the generic `1`)\n so scripted callers can tell a billing pause from a failure.\n- Syntax highlighting for 14 more languages in the chat transcript and file/review panes (python, bash, go, rust, c, cpp, java, ruby, css, html, json, yaml, and more) — previously only JavaScript/TypeScript rendered colored.\n\n### Changed\n\n- `skydive agent list` lists the full agent roster by default instead of a truncated page.\n\n### Fixed\n\n- Long multi-line bash tool-call commands (e.g. heredocs) are clamped with a `+N more · click to expand` tail instead of dumping their whole body into the scrollback.\n- Tool error output is clipped the same way as ok output, so a failing command no longer floods the transcript.\n- The TUI toast overlay has an opaque background instead of letting the transcript bleed through.\n\n## [0.3.0] - 2026-08-04\n\n### Added\n\n**Chat TUI**\n\n- `/fork` slash command to fork a conversation at any point and continue in a new thread.\n- `/conversation` switches threads from inside a live session.\n- `/compact` triggers manual conversation compaction.\n- `/portal` and `/copy` slash commands.\n- Archive the current conversation from the chat TUI.\n- `--new` flag on `skydive chat` to start a fresh conversation.\n- Debounced server-side conversation search in the picker, with title matches ranked first.\n- File review pane orientation toggle, and review comments in the file pane.\n- Pinned plan card controls and a jump-to-latest hint.\n- Terminal title (OSC) follows the live conversation title on every screen; inside cmux the workspace is renamed too, and linked PRs are pushed to the cmux sidebar.\n- Every participating agent shows in the conversation list; connect cards each have their own identity, and ctrl+r asks which connect card to act on.\n- Colored Skydive splash art in `skydive --help` and the TUI pickers.\n- New-agent name prefilled from the server's suggestion.\n\n**CLI & platform**\n\n- `skydive update` self-updater, with an update notice when a new version is available.\n- Shell completions for bash, zsh, and fish via `completion install`.\n- Portal daemon: one connection per host with per-conversation working directories.\n- Agent-led coding-agent import (`skydive import`).\n- Per-workspace scoping on the REST client, and cross-org `--agent <uuid>` auto-switches workspace.\n- `skydive-beta` wrapper for the canary channel.\n\n### Fixed\n\n- `skydive update` no longer claims an update is available on every npm install.\n- Chat memory is bounded (payload clamps + windowed rows) with a memory watchdog and OOM diagnostic report; transcript rows are memoized so streaming stops re-rendering the whole chat.\n- Chat-send failures map to real error messages.\n- Notification and sidebar previews use the last text block of the reply and strip inline markdown.\n- Picker rows no longer overlap when a conversation title contains a newline, tab, or control character.\n- Sending to non-web channel conversations is blocked in the TUI.\n- GitHub bot connect opens on the web front door, not api.skydive.com.\n- TUI activity counter times from the run, not the screen.\n\n## [0.2.0] - 2026-07-29\n\n### Added\n\n**Sandbox & machine access**\n\n- Standalone `skydive sandbox` command for direct access to an agent's sandbox.\n- `/sandbox` in the chat TUI — live PTY session and one-shot command execution.\n- Headless machine sharing via `skydive portal`, with self-registering portal grants.\n- `shareMachineDefault` config key for always-on portal sharing.\n\n**Chat TUI**\n\n- File pane (`ctrl+g`) with Changes and Files tabs: a shared file tree plus source viewer and a workspace browser, mouse-resizable and responsive to terminal size.\n- Agent todo list rendered in the chat TUI, above the composer, mirroring the web chat's todo card.\n- Fuzzy finder in the conversation and agent pickers.\n- Slash-command autocomplete menu.\n- Paste or drag-and-drop any file into the composer; paste clipboard images with Cmd+V.\n- Run local shell commands with `!` in the composer.\n- Conversation recaps, streamed live title updates, and per-agent attribution on assistant turns.\n- Working timer rolls up into minutes and hours.\n- Conversation picker paginates past 50 conversations and shows only your own conversations.\n- Esc leaves a live run; typing `exit` quits the chat.\n- Cursor Dark theme.\n- Picker rows no longer overlap when a conversation title contains a newline, tab, or control character.\n\n**Headless & scripting**\n\n- Resume a conversation by id.\n- `conversations list` and `conversations show` for transcript reads.\n- `messages get`, with run recovery keyed on message id.\n- Connect cards surface in headless `-p` mode so a driving agent never gets stuck.\n\n**Authentication**\n\n- `skydive auth login` via the browser now auto-mints an API key, so one login yields both a chat session and a usable management credential. Management commands announce the key's pinned workspace when it drives them, so a workspace mismatch is visible at use time.\n- Workspace picker on the device authorization page.\n- Account and workspace identity shown in `auth status`.\n\n**Platform**\n\n- Standalone binary builds compiling the CLI into a per-target executable.\n- Interactive workspace switcher; management commands follow the active workspace.\n- Terminal host integrations and agent notifications.\n\n### Fixed\n\n- Transcript errors collapse to one line, click to expand (REST and portal errors keep their full body).\n- Dragged/pasted image file paths attach the file instead of inserting path text, including macOS paths with literal parentheses.\n- Bare URLs in chat markdown are hyperlinked so they survive text wrap.\n- Composer draft is preserved across TUI overlays.\n- Relative connect links resolve before opening the browser.\n- Numbered markdown headings render colored in the TUI.\n- Chat transcript pages by 75% of a screen; picker rows stay on one line.\n- Run starts push to the TUI over the conversation stream.\n- Security: remediated high-severity dependency findings and cleared tar/shell-quote CVEs.\n\n## [0.1.0] - 2026-07-21\n\nInitial public release: `skydive chat` TUI, agent and conversation management,\ndevice authorization, and headless `-p` mode.\n";
|
|
5211
|
+
const CHANGELOG_MD = "# Changelog\n\nAll notable changes to the Skydive CLI are documented here.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## [Unreleased]\n\n### Added\n\n- `skydive fs put`, `fs get`, and `fs cp` — move files between your machine and an agent's sandbox without opening the chat TUI or the web app. `fs put [agent] <local-file> <remote-path>` uploads a file, `fs get [agent] <remote-path> <local-path>` downloads one, and `fs cp [agent] <src> <dst>` copies a file to another path inside the sandbox. They ride the same first-class `fs` relay channel as `fs edit` (same EDIT-permission and kill-switch gating); downloads stream in 8MB ranges so large files come down fine, while uploads and in-sandbox copies are capped at the relay's 8MB per-write limit — a bigger file is rejected up front with a pointer to the web Files tab. Silent on success so they compose in scripts; exit code carries the result.\n\n### Changed\n\n- `skydive secrets` and `skydive keys` now accept `--agent <id or name>` (the same flag every other agent-targeting command uses), resolving the name against your agent roster. They used to take only a raw `--agent-id`, so passing the name every other command accepts 404'd \"agent not found\" for a perfectly real agent; `--agent-id` still works.\n\n- `/fork` in the chat TUI now works while the agent is mid-run. It used to refuse with \"finish or cancel the run first\"; now it copies the conversation up to the last completed message and opens the copy, while the agent keeps working on the original — reopen the original to reattach, exactly as after `esc`. This matches the web \"Fork chat\" menu item, which never had the restriction.\n- The two cards pinned above the chat TUI composer — **subagents** and **plan** — can now be minimized to a single header row. Click a card's header (the `▾`/`▸` chevron shows which way it goes), or use `/subagent minimize` and `/plan minimize`; the same again, or `/plan expand`, brings the rows back. Minimized, a card keeps its label and its progress counter (`Subagents 7/10`), so a ten-task fan-out costs one row instead of ten and the rest of the terminal goes back to the transcript. `/plan expand` and `/plan collapse` keep their meaning (unfold and re-fold the completed rows the card windows away); clicking the card's _body_ still does the same, and the hints now say which surface does which.\n- Reopening a conversation whose subagents and plan are all finished now opens both pinned cards minimized to their header row (`▸ ✔ Subagents 4/4`, `▸ Plan 5/5`) instead of spending up to ten rows above the composer on finished work. A card that opens this way pops back open by itself the moment new work goes live in that conversation (a fresh fan-out, a new in-progress step); a card you minimized yourself stays minimized, as before. Work still running when you open the conversation shows its rows, exactly as it did.\n\n- The chat TUI status bar now always shows where the portal stands, instead of only lighting up once everything already worked. It reads `portal off`, `portal connecting`, `portal on` (open on this machine, but this agent has no grant), `portal shared` (green — this agent can run commands here), `portal error`, or `portal unavailable` when you signed in with an API key and no portal is possible. Previously the badge rendered nothing in every one of those states, so \"why can't the agent reach my machine?\" had no answer on screen.\n- One word for that feature across the whole CLI: **portal**. The footer hint is now `ctrl+t portal` / `ctrl+t close portal` (was `local access` / `revoke access`), `/status` reports a `portal` row (was `local access`), and `/share` and `/portal` describe themselves as opening the portal and granting an agent access to your machine. `/portal` used to say \"access your computer\", which collided with `/computer` — that command still means the **agent's** sandbox, and \"computer\" stays reserved for it. `--share-machine` and the `shareMachineDefault` config key are unchanged.\n- `npm i -g skydive-cli` (and yarn/pnpm/bun) now installs a tiny launcher plus one prebuilt, os/cpu-matched binary that carries its own runtime — so on the common platforms `skydive chat` and `skydive import` start instantly and **do not download a Bun runtime on first use**. On any platform without a prebuilt binary (or if the optional dependency is skipped), the CLI automatically falls back to the existing behavior: it runs under your Node and provisions Bun on first `chat`, exactly as before. Nothing about the commands, flags, config, or `SKYDIVE_*` environment variables changes, and `skydive update` still upgrades npm installs via your package manager and standalone-binary installs in place.\n\n### Added\n\n- `skydive agents git token` — create, list, and revoke git-proxy tokens for an agent's repo from your machine. `agents git token create <agent>` prints a read_write token plus the tokenless remote URL (the same routes the web settings page uses); `… git token list <agent>` shows the agent's tokens by id, and `… git token revoke <agent> <token-id>` revokes one. The command's job ends at the credential: it writes nothing to git on your machine, so what to do with the token (credential store, remote URLs) stays with whatever tooling you already pipe credentials through. `auth login` now points at it for laptop git setup.\n- Files an agent shares into the conversation now show as a saveable row in the chat TUI. When the agent sends you a file (a report, an export, a screenshot), it appears as a `📎` row with the filename and size and a \"click to save\" hint; clicking it downloads the file to your `~/Downloads` (falling back to your home directory) and opens it with your default app, then the row shows where it landed. Clicking a saved row again re-opens it. Previously these files were only reachable in the web app — in the terminal they were invisible.\n- `platform ask` forms now render in the chat TUI. The card lists each question with lettered options (A/B/C/D plus Other); `ctrl+r` opens a full overlay picker (one question at a time, arrows + enter, Other as a typed row — the Claude Code interaction). The answer sends as a normal message. Headless `chat -p` prints the question as an `[action needed]` block instead of dropping it.\n- Every API request now reports this install's version (`x-skydive-cli-version`) so the server can refuse features the installed CLI cannot render — `platform ask` needs the #21411 canary (`0.5.0-beta.43` or newer), not 0.4.0 and not earlier 0.5.0 betas.\n- `/search` (alias `/find`) in the chat TUI — opens the conversation picker with its search field focused, so \"find a conversation\" has a discoverable command instead of being a feature you had to know the bare picker already had. Pass a query inline (`/search billing deep dive`) and the picker opens already narrowed to the matches; bare `/search` opens it ready for you to type. The search runs server-side across conversation titles, message bodies, and participant names, the same search the picker exposes.\n- First run in a workspace with no agents now sets you up automatically: instead of dropping you on an empty agent picker, `skydive` creates your first agent for you (with a suggested name and avatar, mirroring the web onboarding flow) and then offers to have it learn how you already work — reading the other coding agents set up on your machine (Claude Code, Cursor, Codex, and more), the same import that `skydive import` runs, with a plan shown first and credentials never copied. Decline and you go straight into the new agent's chat. You can replay this flow anytime with `skydive --onboarding` (or `SKYDIVE_FORCE_ONBOARDING=1`), even in a workspace that already has agents.\n- `/computer` in the chat TUI — a snapshot of the agent's sandbox drawn as colored bar graphs: CPU, memory, and disk usage. Bars turn amber past 75%% and red past 90%% so a glance tells you whether the box is under pressure. The numbers come from the Skydive API (the same live resource sample the web computer view reads), not by connecting to the sandbox — so the card shows instantly, never waking or hanging on a box that isn't running: when the agent has no live sandbox it simply reads \"no sandbox running\". The card keeps itself current quietly (a slow background refresh, no flicker or \"updating\" chrome); only the most recent card refreshes, and it silently stops while you're scrolled up (no wasted polls on a card you're not looking at) and resumes at the bottom.\n- `/computer restart` in the chat TUI — reboot the agent's sandbox from chat. It asks a `y`/`n` confirm first (the restart stops whatever run is going and brings up a fresh box), then enqueues the same restart the web \"Restart\" control does. Available to anyone with edit access to the agent; view-only members are told they can't.\n- `skydive fs` — a namespace for working with the files on an agent's computer (its sandbox) from your own machine. Its first subcommand, `skydive fs edit <path>`, reads a remote file down over the same relay `skydive sandbox` uses, opens it in your local editor (`$VISUAL`/`$EDITOR`, override with `--editor`, defaults to `vi`), and writes your changes back atomically when you save and close — so you can edit a remote file as if it were local without opening the chat TUI. A path that doesn't exist yet is created on save; no changes means nothing is written. Access is gated on EDIT permission for the agent, exactly like `skydive sandbox`. (A first-class `fs` relay channel and `skydive fs mount` land in follow-ups.)\n\n### Fixed\n\n- The chat TUI's \"finished responding\" notification no longer pings while the agent is visibly still working. It fired once per run, but one task can span several runs: a subagent finishing, a scheduled or agent-to-agent check-in, or an auto-restart retry all start a follow-up run seconds after the previous run settles, so you'd get pinged \"finished\" and open the conversation to find it still running. The ping now waits behind a short grace window - a successor run starting in that window cancels it - and cancelled or superseded runs never ping at all.\n\n## [0.4.0] - 2026-08-07\n\n### Added\n\n- `skydive chat` works with API key auth: an API key alone now opens the chat TUI (and headless `chat -p`) without a browser login, using the key's pinned workspace.\n- `skydive config` command to view and set the safe, hand-editable CLI preferences (`shareMachineDefault`, `updateCheck`) without opening `config.json`. `config`/`config list` shows each key, its effective value, and whether it comes from the file or the built-in default; `config get`/`set`/`unset` read and change one key; `config path` prints the config file location. It only ever touches those preference keys, never credentials or flow-managed state.\n- Billing-blocked sends and runs now surface the server-authored recovery\n guidance from the typed billing outcome. The chat TUI renders it as a\n warning-toned system-notice row — live when a send is refused or a run is\n stopped at the billing boundary, and again when reopening a conversation\n that holds a persisted billing notice — instead of a generic error.\n Headless `chat -p` and `messages get` print the guidance (state, recovery\n step, and manage-billing URL) on stderr, keep any partial output already\n streamed on stdout, and exit with code `5` (distinct from the generic `1`)\n so scripted callers can tell a billing pause from a failure.\n- Syntax highlighting for 14 more languages in the chat transcript and file/review panes (python, bash, go, rust, c, cpp, java, ruby, css, html, json, yaml, and more) — previously only JavaScript/TypeScript rendered colored.\n\n### Changed\n\n- `skydive agent list` lists the full agent roster by default instead of a truncated page.\n\n### Fixed\n\n- Long multi-line bash tool-call commands (e.g. heredocs) are clamped with a `+N more · click to expand` tail instead of dumping their whole body into the scrollback.\n- Tool error output is clipped the same way as ok output, so a failing command no longer floods the transcript.\n- The TUI toast overlay has an opaque background instead of letting the transcript bleed through.\n\n## [0.3.0] - 2026-08-04\n\n### Added\n\n**Chat TUI**\n\n- `/fork` slash command to fork a conversation at any point and continue in a new thread.\n- `/conversation` switches threads from inside a live session.\n- `/compact` triggers manual conversation compaction.\n- `/portal` and `/copy` slash commands.\n- Archive the current conversation from the chat TUI.\n- `--new` flag on `skydive chat` to start a fresh conversation.\n- Debounced server-side conversation search in the picker, with title matches ranked first.\n- File review pane orientation toggle, and review comments in the file pane.\n- Pinned plan card controls and a jump-to-latest hint.\n- Terminal title (OSC) follows the live conversation title on every screen; inside cmux the workspace is renamed too, and linked PRs are pushed to the cmux sidebar.\n- Every participating agent shows in the conversation list; connect cards each have their own identity, and ctrl+r asks which connect card to act on.\n- Colored Skydive splash art in `skydive --help` and the TUI pickers.\n- New-agent name prefilled from the server's suggestion.\n\n**CLI & platform**\n\n- `skydive update` self-updater, with an update notice when a new version is available.\n- Shell completions for bash, zsh, and fish via `completion install`.\n- Portal daemon: one connection per host with per-conversation working directories.\n- Agent-led coding-agent import (`skydive import`).\n- Per-workspace scoping on the REST client, and cross-org `--agent <uuid>` auto-switches workspace.\n- `skydive-beta` wrapper for the canary channel.\n\n### Fixed\n\n- `skydive update` no longer claims an update is available on every npm install.\n- Chat memory is bounded (payload clamps + windowed rows) with a memory watchdog and OOM diagnostic report; transcript rows are memoized so streaming stops re-rendering the whole chat.\n- Chat-send failures map to real error messages.\n- Notification and sidebar previews use the last text block of the reply and strip inline markdown.\n- Picker rows no longer overlap when a conversation title contains a newline, tab, or control character.\n- Sending to non-web channel conversations is blocked in the TUI.\n- GitHub bot connect opens on the web front door, not api.skydive.com.\n- TUI activity counter times from the run, not the screen.\n\n## [0.2.0] - 2026-07-29\n\n### Added\n\n**Sandbox & machine access**\n\n- Standalone `skydive sandbox` command for direct access to an agent's sandbox.\n- `/sandbox` in the chat TUI — live PTY session and one-shot command execution.\n- Headless machine sharing via `skydive portal`, with self-registering portal grants.\n- `shareMachineDefault` config key for always-on portal sharing.\n\n**Chat TUI**\n\n- File pane (`ctrl+g`) with Changes and Files tabs: a shared file tree plus source viewer and a workspace browser, mouse-resizable and responsive to terminal size.\n- Agent todo list rendered in the chat TUI, above the composer, mirroring the web chat's todo card.\n- Fuzzy finder in the conversation and agent pickers.\n- Slash-command autocomplete menu.\n- Paste or drag-and-drop any file into the composer; paste clipboard images with Cmd+V.\n- Run local shell commands with `!` in the composer.\n- Conversation recaps, streamed live title updates, and per-agent attribution on assistant turns.\n- Working timer rolls up into minutes and hours.\n- Conversation picker paginates past 50 conversations and shows only your own conversations.\n- Esc leaves a live run; typing `exit` quits the chat.\n- Cursor Dark theme.\n- Picker rows no longer overlap when a conversation title contains a newline, tab, or control character.\n\n**Headless & scripting**\n\n- Resume a conversation by id.\n- `conversations list` and `conversations show` for transcript reads.\n- `messages get`, with run recovery keyed on message id.\n- Connect cards surface in headless `-p` mode so a driving agent never gets stuck.\n\n**Authentication**\n\n- `skydive auth login` via the browser now auto-mints an API key, so one login yields both a chat session and a usable management credential. Management commands announce the key's pinned workspace when it drives them, so a workspace mismatch is visible at use time.\n- Workspace picker on the device authorization page.\n- Account and workspace identity shown in `auth status`.\n\n**Platform**\n\n- Standalone binary builds compiling the CLI into a per-target executable.\n- Interactive workspace switcher; management commands follow the active workspace.\n- Terminal host integrations and agent notifications.\n\n### Fixed\n\n- Transcript errors collapse to one line, click to expand (REST and portal errors keep their full body).\n- Dragged/pasted image file paths attach the file instead of inserting path text, including macOS paths with literal parentheses.\n- Bare URLs in chat markdown are hyperlinked so they survive text wrap.\n- Composer draft is preserved across TUI overlays.\n- Relative connect links resolve before opening the browser.\n- Numbered markdown headings render colored in the TUI.\n- Chat transcript pages by 75% of a screen; picker rows stay on one line.\n- Run starts push to the TUI over the conversation stream.\n- Security: remediated high-severity dependency findings and cleared tar/shell-quote CVEs.\n\n## [0.1.0] - 2026-07-21\n\nInitial public release: `skydive chat` TUI, agent and conversation management,\ndevice authorization, and headless `-p` mode.\n";
|
|
4434
5212
|
|
|
4435
5213
|
//#endregion
|
|
4436
5214
|
//#region src/whats-new.ts
|
|
@@ -4573,7 +5351,7 @@ if (process.argv.includes(UPDATE_WORKER_FLAG)) {
|
|
|
4573
5351
|
process.exit(0);
|
|
4574
5352
|
}
|
|
4575
5353
|
if (process.argv.includes(PORTAL_DAEMON_FLAG)) {
|
|
4576
|
-
const { runPortalDaemon } = await import("./daemon-
|
|
5354
|
+
const { runPortalDaemon } = await import("./daemon-DpnxS19C.mjs");
|
|
4577
5355
|
runPortalDaemon(process.argv);
|
|
4578
5356
|
} else runCli();
|
|
4579
5357
|
function runCli() {
|