skydive-cli 0.6.0-beta.22 → 0.6.0-beta.221
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 +11 -0
- package/dist/js/bin.mjs +872 -90
- package/dist/js/{boot-BTMaaPIl.mjs → boot-mdwze7oB.mjs} +11351 -9716
- package/dist/js/client-8BydRV9B.mjs +5 -0
- package/dist/js/{client-SKWnQuQz.mjs → client-BM7DBW7E.mjs} +67 -8
- package/dist/js/{client-l6orYfqq.mjs → client-Cxk3khQu.mjs} +18 -4
- package/dist/js/{daemon-D-Zu-olv.mjs → daemon-CYEKGZoq.mjs} +117 -27
- package/dist/js/daemon-client-CCwDsdGH.mjs +8 -0
- package/dist/js/{daemon-client-D0su8ZQV.mjs → daemon-client-l1IK_u8V.mjs} +29 -4
- package/dist/js/{daemon-CafeTT4h.mjs → daemon-iKbr3tym.mjs} +2 -2
- package/dist/js/{install-aZKTSrxS.mjs → install-C_7bGPq5.mjs} +56 -8
- package/dist/js/{print-BTEml9Tz.mjs → print-DwGszUZ_.mjs} +13 -12
- package/dist/js/{print-DX4RJe8S.mjs → print-PxBm9ypJ.mjs} +2 -2
- package/dist/js/{print-share-DQPAKVqI.mjs → print-share-4-BKiiIr.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-CT8jXjJS.mjs → rest-C8mKL4nc.mjs} +1 -1
- package/dist/js/{rest-CSVvGxGU.mjs → rest-Rp0OKKnS.mjs} +148 -15
- package/package.json +9 -8
- package/dist/js/client-Cjs9Ma4U.mjs +0 -5
- package/dist/js/daemon-client-BaUEkjKT.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-Rp0OKKnS.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-DwGszUZ_.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-C_7bGPq5.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-BM7DBW7E.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-CYEKGZoq.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";
|
|
@@ -71,7 +71,47 @@ const ApiKeySchema = z.object({
|
|
|
71
71
|
const CreatedApiKeySchema = ApiKeySchema.extend({ key: z.string() });
|
|
72
72
|
const ListApiKeysResponseSchema = z.object({ keys: z.array(ApiKeySchema) });
|
|
73
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) });
|
|
74
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
|
+
}
|
|
75
115
|
var SkydiveApiClient = class {
|
|
76
116
|
baseUrl;
|
|
77
117
|
token;
|
|
@@ -161,6 +201,99 @@ var SkydiveApiClient = class {
|
|
|
161
201
|
path: `/agents/${encodeURIComponent(agentId)}/secrets/${encodeURIComponent(key)}`
|
|
162
202
|
});
|
|
163
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
|
+
}
|
|
164
297
|
async request(params) {
|
|
165
298
|
const url = `${this.baseUrl}${params.path}`;
|
|
166
299
|
const headers = {
|
|
@@ -189,7 +322,7 @@ var SkydiveApiClient = class {
|
|
|
189
322
|
const body = await response.json();
|
|
190
323
|
if (body.error && typeof body.error === "string") message = body.error;
|
|
191
324
|
else if (body.error?.message) message = body.error.message;
|
|
192
|
-
} catch {}
|
|
325
|
+
} catch (_error) {}
|
|
193
326
|
if (response.status === 401 && this.authKind === "session") message = `${message}. Your chat session may have expired. Run \`skydive auth login\`.`;
|
|
194
327
|
return err({
|
|
195
328
|
message,
|
|
@@ -200,7 +333,7 @@ var SkydiveApiClient = class {
|
|
|
200
333
|
let body;
|
|
201
334
|
try {
|
|
202
335
|
body = await response.json();
|
|
203
|
-
} catch {
|
|
336
|
+
} catch (_error) {
|
|
204
337
|
return err({
|
|
205
338
|
message: "Invalid JSON response",
|
|
206
339
|
status: response.status
|
|
@@ -345,7 +478,7 @@ async function loginWithDevice({ appUrl, openBrowser = true }) {
|
|
|
345
478
|
const verificationUrl = code.verification_uri_complete ?? code.verification_uri;
|
|
346
479
|
process.stderr.write(`\nTo sign in, open:\n ${verificationUrl}\n`);
|
|
347
480
|
process.stderr.write(`and enter the code: ${formatUserCode(code.user_code)}\n\n`);
|
|
348
|
-
if (openBrowser) await open(verificationUrl).catch(() => void 0);
|
|
481
|
+
if (openBrowser) await open$1(verificationUrl).catch(() => void 0);
|
|
349
482
|
process.stderr.write("Waiting for approval…\n");
|
|
350
483
|
let intervalMs = (code.interval ?? 5) * 1e3 || DEFAULT_INTERVAL_MS;
|
|
351
484
|
const expiresAt = Date.now() + code.expires_in * 1e3;
|
|
@@ -582,6 +715,7 @@ async function runBrowserLogin(argv) {
|
|
|
582
715
|
if (identity?.activeWorkspaceName) console.log(` Workspace: ${identity.activeWorkspaceName}`);
|
|
583
716
|
if (minted.isOk()) console.log(` API key: ${minted.value.prefix}… (${minted.value.name})`);
|
|
584
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>`");
|
|
585
719
|
}
|
|
586
720
|
/** CI / headless path: validate and persist an existing key, no browser. */
|
|
587
721
|
async function runApiKeyLogin(argv, apiKey) {
|
|
@@ -1027,6 +1161,40 @@ function requireManagementClient(argv, opts = {}) {
|
|
|
1027
1161
|
...opts.workspaceId ? { workspaceId: opts.workspaceId } : {}
|
|
1028
1162
|
});
|
|
1029
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-PxBm9ypJ.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
|
+
}
|
|
1030
1198
|
/** Resolve the session (see {@link requireSession}) and build a REST client. */
|
|
1031
1199
|
function requireRestClient(argv) {
|
|
1032
1200
|
const auth = resolveChatAuth({ appUrl: resolveAppUrl({ appUrl: argv["api-url"] }) });
|
|
@@ -1040,6 +1208,171 @@ function requireRestClient(argv) {
|
|
|
1040
1208
|
});
|
|
1041
1209
|
}
|
|
1042
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
|
+
|
|
1043
1376
|
//#endregion
|
|
1044
1377
|
//#region src/commands/agents.ts
|
|
1045
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;
|
|
@@ -1067,7 +1400,7 @@ async function resolveAgent(client, selector) {
|
|
|
1067
1400
|
if (matches.length === 0) throw new Error(`No agent named "${selector}". Pass an id, or run \`skydive agents list\`.`);
|
|
1068
1401
|
throw new Error(`Multiple agents named "${selector}". Pass the id instead:\n${matches.map((a) => ` ${a.name} ${a.id}`).join("\n")}`);
|
|
1069
1402
|
}
|
|
1070
|
-
const listCommand$
|
|
1403
|
+
const listCommand$7 = {
|
|
1071
1404
|
command: "list",
|
|
1072
1405
|
describe: "List agents in the active workspace",
|
|
1073
1406
|
builder: (y) => y.option("limit", {
|
|
@@ -1288,10 +1621,76 @@ const aliasCommand = {
|
|
|
1288
1621
|
console.log(aliasActivationHint(result));
|
|
1289
1622
|
}
|
|
1290
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
|
+
};
|
|
1291
1690
|
const agentsCommand = {
|
|
1292
1691
|
command: "agents",
|
|
1293
1692
|
describe: "Manage agents",
|
|
1294
|
-
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"),
|
|
1295
1694
|
handler: () => {}
|
|
1296
1695
|
};
|
|
1297
1696
|
|
|
@@ -1361,7 +1760,7 @@ function isExecutableFile(p) {
|
|
|
1361
1760
|
if (!fs.statSync(p).isFile()) return false;
|
|
1362
1761
|
if (process.platform !== "win32") fs.accessSync(p, fs.constants.X_OK);
|
|
1363
1762
|
return true;
|
|
1364
|
-
} catch {
|
|
1763
|
+
} catch (_error) {
|
|
1365
1764
|
return false;
|
|
1366
1765
|
}
|
|
1367
1766
|
}
|
|
@@ -1586,7 +1985,7 @@ const importCommand = {
|
|
|
1586
1985
|
process.exit(1);
|
|
1587
1986
|
}
|
|
1588
1987
|
}
|
|
1589
|
-
const { runChat } = await import("./boot-
|
|
1988
|
+
const { runChat } = await import("./boot-mdwze7oB.mjs");
|
|
1590
1989
|
await runChat({
|
|
1591
1990
|
appUrl,
|
|
1592
1991
|
sessionToken: session.value.sessionToken,
|
|
@@ -1599,7 +1998,10 @@ const importCommand = {
|
|
|
1599
1998
|
newConversation: false,
|
|
1600
1999
|
defaultAgentSelector: getDefaultAgent(),
|
|
1601
2000
|
forceOnboarding: false,
|
|
1602
|
-
seedPrompt: buildImportSeedPrompt(
|
|
2001
|
+
seedPrompt: buildImportSeedPrompt({
|
|
2002
|
+
projectDir: process.cwd(),
|
|
2003
|
+
os: machineOsFromPlatform(process.platform)
|
|
2004
|
+
})
|
|
1603
2005
|
});
|
|
1604
2006
|
}
|
|
1605
2007
|
};
|
|
@@ -1616,15 +2018,18 @@ async function runImportPrintMode({ argv, appUrl }) {
|
|
|
1616
2018
|
printError(`${session.error.message} For non-interactive use, run \`skydive auth login --web\` first, or set SKYDIVE_SESSION_TOKEN.`);
|
|
1617
2019
|
process.exit(1);
|
|
1618
2020
|
}
|
|
1619
|
-
const { connectMachineShare } = await import("./print-share-
|
|
2021
|
+
const { connectMachineShare } = await import("./print-share-4-BKiiIr.mjs");
|
|
1620
2022
|
const machineShare = await connectMachineShare({
|
|
1621
2023
|
appUrl,
|
|
1622
2024
|
sessionToken: session.value.sessionToken,
|
|
1623
2025
|
timeoutHint: "Check `skydive portal status`, then re-run."
|
|
1624
2026
|
});
|
|
1625
2027
|
const extra = (argv.print ?? "").trim();
|
|
1626
|
-
const prompt = buildImportSeedPrompt(
|
|
1627
|
-
|
|
2028
|
+
const prompt = buildImportSeedPrompt({
|
|
2029
|
+
projectDir: process.cwd(),
|
|
2030
|
+
os: machineOsFromPlatform(process.platform)
|
|
2031
|
+
}) + (extra ? `\n\nAdditional instructions: ${extra}` : "");
|
|
2032
|
+
const { runPrint } = await import("./print-PxBm9ypJ.mjs");
|
|
1628
2033
|
try {
|
|
1629
2034
|
const result = await runPrint({
|
|
1630
2035
|
appUrl,
|
|
@@ -1648,11 +2053,13 @@ async function runImportPrintMode({ argv, appUrl }) {
|
|
|
1648
2053
|
|
|
1649
2054
|
//#endregion
|
|
1650
2055
|
//#region src/commands/keys.ts
|
|
1651
|
-
const listCommand$
|
|
2056
|
+
const listCommand$6 = {
|
|
1652
2057
|
command: "list",
|
|
1653
2058
|
describe: "List API keys for an agent",
|
|
1654
2059
|
handler: async (argv) => {
|
|
1655
|
-
const
|
|
2060
|
+
const client = requireManagementClient(argv);
|
|
2061
|
+
const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
|
|
2062
|
+
const result = await client.listKeys(agentId);
|
|
1656
2063
|
if (result.isErr()) {
|
|
1657
2064
|
printError(result.error.message);
|
|
1658
2065
|
process.exit(1);
|
|
@@ -1688,7 +2095,9 @@ const createCommand = {
|
|
|
1688
2095
|
describe: "Key name"
|
|
1689
2096
|
}),
|
|
1690
2097
|
handler: async (argv) => {
|
|
1691
|
-
const
|
|
2098
|
+
const client = requireManagementClient(argv);
|
|
2099
|
+
const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
|
|
2100
|
+
const result = await client.createKey(agentId, argv.name);
|
|
1692
2101
|
if (result.isErr()) {
|
|
1693
2102
|
printError(result.error.message);
|
|
1694
2103
|
process.exit(1);
|
|
@@ -1718,7 +2127,9 @@ const revokeCommand$1 = {
|
|
|
1718
2127
|
describe: "Key ID"
|
|
1719
2128
|
}),
|
|
1720
2129
|
handler: async (argv) => {
|
|
1721
|
-
const
|
|
2130
|
+
const client = requireManagementClient(argv);
|
|
2131
|
+
const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
|
|
2132
|
+
const result = await client.revokeKey(agentId, argv.id);
|
|
1722
2133
|
if (result.isErr()) {
|
|
1723
2134
|
printError(result.error.message);
|
|
1724
2135
|
process.exit(1);
|
|
@@ -1733,11 +2144,13 @@ const revokeCommand$1 = {
|
|
|
1733
2144
|
const keysCommand = {
|
|
1734
2145
|
command: "keys",
|
|
1735
2146
|
describe: "Manage API keys for an agent",
|
|
1736
|
-
builder: (y) => y.option("agent
|
|
2147
|
+
builder: (y) => y.option("agent", {
|
|
1737
2148
|
type: "string",
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
2149
|
+
describe: "Target agent, by id or name (e.g. --agent my-agent)"
|
|
2150
|
+
}).option("agent-id", {
|
|
2151
|
+
type: "string",
|
|
2152
|
+
describe: "Target agent id (legacy; prefer --agent)"
|
|
2153
|
+
}).command(listCommand$6).command(createCommand).command(revokeCommand$1).demandCommand(1, "Specify a subcommand: list, create, revoke"),
|
|
1741
2154
|
handler: () => {}
|
|
1742
2155
|
};
|
|
1743
2156
|
|
|
@@ -1749,11 +2162,13 @@ async function readStdin() {
|
|
|
1749
2162
|
for await (const chunk of process.stdin) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
1750
2163
|
return Buffer.concat(chunks).toString("utf8").replace(/\n$/, "");
|
|
1751
2164
|
}
|
|
1752
|
-
const listCommand$
|
|
2165
|
+
const listCommand$5 = {
|
|
1753
2166
|
command: "list",
|
|
1754
2167
|
describe: "List secret names for an agent (values are never shown)",
|
|
1755
2168
|
handler: async (argv) => {
|
|
1756
|
-
const
|
|
2169
|
+
const client = requireManagementClient(argv);
|
|
2170
|
+
const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
|
|
2171
|
+
const result = await client.listSecrets(agentId);
|
|
1757
2172
|
if (result.isErr()) {
|
|
1758
2173
|
printError(result.error.message);
|
|
1759
2174
|
process.exit(1);
|
|
@@ -1794,7 +2209,9 @@ const setCommand$1 = {
|
|
|
1794
2209
|
printError("Empty secret value.");
|
|
1795
2210
|
process.exit(1);
|
|
1796
2211
|
}
|
|
1797
|
-
const
|
|
2212
|
+
const client = requireManagementClient(argv);
|
|
2213
|
+
const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
|
|
2214
|
+
const result = await client.setSecret(agentId, argv.key, value);
|
|
1798
2215
|
if (result.isErr()) {
|
|
1799
2216
|
printError(result.error.message);
|
|
1800
2217
|
process.exit(1);
|
|
@@ -1816,7 +2233,9 @@ const rmCommand = {
|
|
|
1816
2233
|
describe: "Secret name"
|
|
1817
2234
|
}),
|
|
1818
2235
|
handler: async (argv) => {
|
|
1819
|
-
const
|
|
2236
|
+
const client = requireManagementClient(argv);
|
|
2237
|
+
const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
|
|
2238
|
+
const result = await client.deleteSecret(agentId, argv.key);
|
|
1820
2239
|
if (result.isErr()) {
|
|
1821
2240
|
printError(result.error.message);
|
|
1822
2241
|
process.exit(1);
|
|
@@ -1831,11 +2250,13 @@ const rmCommand = {
|
|
|
1831
2250
|
const secretsCommand = {
|
|
1832
2251
|
command: "secrets",
|
|
1833
2252
|
describe: "Manage an agent’s secrets",
|
|
1834
|
-
builder: (y) => y.option("agent
|
|
2253
|
+
builder: (y) => y.option("agent", {
|
|
1835
2254
|
type: "string",
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
2255
|
+
describe: "Target agent, by id or name (e.g. --agent my-agent)"
|
|
2256
|
+
}).option("agent-id", {
|
|
2257
|
+
type: "string",
|
|
2258
|
+
describe: "Target agent id (legacy; prefer --agent)"
|
|
2259
|
+
}).command(listCommand$5).command(setCommand$1).command(rmCommand).demandCommand(1, "Specify a subcommand: list, set, rm"),
|
|
1839
2260
|
handler: () => {}
|
|
1840
2261
|
};
|
|
1841
2262
|
|
|
@@ -2031,7 +2452,7 @@ const chatCommand = {
|
|
|
2031
2452
|
sessionToken: auth.value.token,
|
|
2032
2453
|
agentSelector: argv.agent ?? null
|
|
2033
2454
|
});
|
|
2034
|
-
const { runChat } = await import("./boot-
|
|
2455
|
+
const { runChat } = await import("./boot-mdwze7oB.mjs");
|
|
2035
2456
|
await runChat({
|
|
2036
2457
|
appUrl: auth.value.appUrl,
|
|
2037
2458
|
sessionToken: auth.value.token,
|
|
@@ -2115,7 +2536,7 @@ async function runPrintMode({ argv, appUrl }) {
|
|
|
2115
2536
|
printError(`${auth.error.message} For non-interactive use, run \`skydive auth login\` first, or set SKYDIVE_API_KEY / SKYDIVE_SESSION_TOKEN.`);
|
|
2116
2537
|
process.exit(1);
|
|
2117
2538
|
}
|
|
2118
|
-
const { runPrint, readStdin } = await import("./print-
|
|
2539
|
+
const { runPrint, readStdin } = await import("./print-PxBm9ypJ.mjs");
|
|
2119
2540
|
const workspaceId = await resolveWorkspaceFlag({
|
|
2120
2541
|
appUrl,
|
|
2121
2542
|
sessionToken: auth.value.token,
|
|
@@ -2145,7 +2566,7 @@ async function runPrintMode({ argv, appUrl }) {
|
|
|
2145
2566
|
process.exit(1);
|
|
2146
2567
|
}
|
|
2147
2568
|
} else {
|
|
2148
|
-
const { connectMachineShare } = await import("./print-share-
|
|
2569
|
+
const { connectMachineShare } = await import("./print-share-4-BKiiIr.mjs");
|
|
2149
2570
|
machineShare = await connectMachineShare({
|
|
2150
2571
|
appUrl: auth.value.appUrl,
|
|
2151
2572
|
sessionToken: auth.value.token,
|
|
@@ -2210,7 +2631,7 @@ const getCommand$1 = {
|
|
|
2210
2631
|
printError(`${auth.error.message} Run \`skydive auth login\` first, or set SKYDIVE_API_KEY / SKYDIVE_SESSION_TOKEN.`);
|
|
2211
2632
|
process.exit(1);
|
|
2212
2633
|
}
|
|
2213
|
-
const { messageGet } = await import("./print-
|
|
2634
|
+
const { messageGet } = await import("./print-PxBm9ypJ.mjs");
|
|
2214
2635
|
try {
|
|
2215
2636
|
const result = await messageGet({
|
|
2216
2637
|
appUrl: auth.value.appUrl,
|
|
@@ -2257,7 +2678,7 @@ function messageToText(message) {
|
|
|
2257
2678
|
}
|
|
2258
2679
|
return chunks.join("\n").trim();
|
|
2259
2680
|
}
|
|
2260
|
-
const listCommand$
|
|
2681
|
+
const listCommand$4 = {
|
|
2261
2682
|
command: "list",
|
|
2262
2683
|
describe: "List an agent's conversations",
|
|
2263
2684
|
builder: (y) => y.option("agent", {
|
|
@@ -2347,7 +2768,7 @@ const conversationsCommand = {
|
|
|
2347
2768
|
command: "conversations",
|
|
2348
2769
|
aliases: ["conv"],
|
|
2349
2770
|
describe: "List and read agent conversations",
|
|
2350
|
-
builder: (y) => y.command(listCommand$
|
|
2771
|
+
builder: (y) => y.command(listCommand$4).command(showCommand).demandCommand(1, "Specify a subcommand: list, show"),
|
|
2351
2772
|
handler: () => {}
|
|
2352
2773
|
};
|
|
2353
2774
|
|
|
@@ -2389,7 +2810,7 @@ async function runList(argv, { hint }) {
|
|
|
2389
2810
|
]));
|
|
2390
2811
|
if (hint && !argv.quiet) console.log("\nRun `skydive workspace switch` to pick a workspace, or pass its slug directly.");
|
|
2391
2812
|
}
|
|
2392
|
-
const listCommand$
|
|
2813
|
+
const listCommand$3 = {
|
|
2393
2814
|
command: "list",
|
|
2394
2815
|
describe: "List workspaces on your account",
|
|
2395
2816
|
handler: (argv) => runList(argv, { hint: false })
|
|
@@ -2413,7 +2834,7 @@ const switchCommand = {
|
|
|
2413
2834
|
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.");
|
|
2414
2835
|
process.exit(1);
|
|
2415
2836
|
}
|
|
2416
|
-
const { runWorkspacePicker } = await import("./boot-
|
|
2837
|
+
const { runWorkspacePicker } = await import("./boot-mdwze7oB.mjs");
|
|
2417
2838
|
await runWorkspacePicker(session);
|
|
2418
2839
|
return;
|
|
2419
2840
|
}
|
|
@@ -2446,7 +2867,7 @@ const switchCommand = {
|
|
|
2446
2867
|
const workspaceCommand = {
|
|
2447
2868
|
command: "workspace",
|
|
2448
2869
|
describe: "List or switch the workspace all `skydive` commands act on",
|
|
2449
|
-
builder: (y) => y.command(listCommand$
|
|
2870
|
+
builder: (y) => y.command(listCommand$3).command(switchCommand),
|
|
2450
2871
|
handler: (argv) => runList(argv, { hint: true })
|
|
2451
2872
|
};
|
|
2452
2873
|
|
|
@@ -2492,7 +2913,7 @@ const openCommand = {
|
|
|
2492
2913
|
const agent = argv.agent ? resolveAgent$1((await fetchPortalDevices(session)).agents, argv.agent) : null;
|
|
2493
2914
|
const cwd = argv.cwd ? path.resolve(argv.cwd) : process.cwd();
|
|
2494
2915
|
const { machineName } = await resolveMachineIdentity(null);
|
|
2495
|
-
const { PortalDaemonClient } = await import("./daemon-client-
|
|
2916
|
+
const { PortalDaemonClient } = await import("./daemon-client-CCwDsdGH.mjs");
|
|
2496
2917
|
let lastLine = "";
|
|
2497
2918
|
let signalConnected;
|
|
2498
2919
|
const connected = new Promise((resolve) => {
|
|
@@ -2846,11 +3267,14 @@ const sandboxCommand = {
|
|
|
2846
3267
|
type: "string",
|
|
2847
3268
|
array: true,
|
|
2848
3269
|
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."
|
|
3270
|
+
}).option("timeout", {
|
|
3271
|
+
type: "number",
|
|
3272
|
+
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.`
|
|
2849
3273
|
}).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`"),
|
|
2850
3274
|
handler: async (argv) => {
|
|
2851
3275
|
const session = requireSession(argv);
|
|
2852
|
-
const { createRestClient } = await import("./rest-
|
|
2853
|
-
const { resolveAgent } = await import("./print-
|
|
3276
|
+
const { createRestClient } = await import("./rest-C8mKL4nc.mjs");
|
|
3277
|
+
const { resolveAgent } = await import("./print-PxBm9ypJ.mjs");
|
|
2854
3278
|
const client = createRestClient({
|
|
2855
3279
|
appUrl: session.appUrl,
|
|
2856
3280
|
sessionToken: session.sessionToken
|
|
@@ -2866,10 +3290,20 @@ const sandboxCommand = {
|
|
|
2866
3290
|
process.exit(1);
|
|
2867
3291
|
}
|
|
2868
3292
|
const command = joinCommandWords([...argv.command ?? [], ...argv["--"] ?? []]);
|
|
3293
|
+
if (argv.timeout !== void 0 && !command) {
|
|
3294
|
+
printError("--timeout applies to a one-shot command; pass one after `--`.");
|
|
3295
|
+
process.exit(1);
|
|
3296
|
+
}
|
|
3297
|
+
if (argv.timeout !== void 0 && (!Number.isFinite(argv.timeout) || argv.timeout <= 0)) {
|
|
3298
|
+
printError("--timeout must be a positive number of seconds.");
|
|
3299
|
+
process.exit(1);
|
|
3300
|
+
}
|
|
3301
|
+
const timeoutMs = argv.timeout !== void 0 ? Math.round(argv.timeout * 1e3) : void 0;
|
|
2869
3302
|
const code = command ? await runExec({
|
|
2870
3303
|
session,
|
|
2871
3304
|
agentId: agent.id,
|
|
2872
|
-
command
|
|
3305
|
+
command,
|
|
3306
|
+
timeoutMs
|
|
2873
3307
|
}) : await runPty({
|
|
2874
3308
|
session,
|
|
2875
3309
|
agentId: agent.id,
|
|
@@ -2879,18 +3313,19 @@ const sandboxCommand = {
|
|
|
2879
3313
|
}
|
|
2880
3314
|
};
|
|
2881
3315
|
/** One-shot exec: stream output to stdout, resolve to the command's exit code. */
|
|
2882
|
-
function runExec({ session, agentId, command }) {
|
|
3316
|
+
function runExec({ session, agentId, command, timeoutMs }) {
|
|
2883
3317
|
console.error("Connecting to the sandbox…");
|
|
2884
3318
|
return new Promise((resolve) => {
|
|
2885
3319
|
const finish = (code) => {
|
|
2886
3320
|
process.stdout.write("", () => resolve(code));
|
|
2887
3321
|
};
|
|
2888
|
-
SandboxStream.open({
|
|
3322
|
+
const stream = SandboxStream.open({
|
|
2889
3323
|
mode: "exec",
|
|
2890
3324
|
appUrl: session.appUrl,
|
|
2891
3325
|
sessionToken: session.sessionToken,
|
|
2892
3326
|
agentId,
|
|
2893
3327
|
command,
|
|
3328
|
+
...timeoutMs !== void 0 ? { timeoutMs } : {},
|
|
2894
3329
|
onEvent: (e) => {
|
|
2895
3330
|
switch (e.type) {
|
|
2896
3331
|
case "data":
|
|
@@ -2908,10 +3343,45 @@ function runExec({ session, agentId, command }) {
|
|
|
2908
3343
|
finish(1);
|
|
2909
3344
|
break;
|
|
2910
3345
|
}
|
|
3346
|
+
stopStdinForwarding();
|
|
2911
3347
|
}
|
|
2912
3348
|
});
|
|
3349
|
+
forwardStdinToStream({
|
|
3350
|
+
stdin: process.stdin,
|
|
3351
|
+
stream
|
|
3352
|
+
});
|
|
2913
3353
|
});
|
|
2914
3354
|
}
|
|
3355
|
+
const STDIN_EOF_INPUT = new Uint8Array(0);
|
|
3356
|
+
let forwardingStdin = null;
|
|
3357
|
+
/**
|
|
3358
|
+
* Forward the caller's stdin into the sandbox stream as INPUT frames (one per
|
|
3359
|
+
* stdin chunk; an empty payload marks end-of-stdin so the remote command gets
|
|
3360
|
+
* a real EOF — `sh -c 'cat > file'` finishes instead of hanging). Nothing is
|
|
3361
|
+
* forwarded when stdin is already closed (no pipe, nothing piped in), which
|
|
3362
|
+
* keeps the plain scripted case exactly where it was.
|
|
3363
|
+
*/
|
|
3364
|
+
function forwardStdinToStream({ stdin, stream }) {
|
|
3365
|
+
if (stdin.readableEnded || stdin.destroyed) return;
|
|
3366
|
+
const onData = (chunk) => stream.sendInput(new Uint8Array(chunk));
|
|
3367
|
+
const onEnd = () => stream.sendInput(STDIN_EOF_INPUT);
|
|
3368
|
+
forwardingStdin = {
|
|
3369
|
+
stdin,
|
|
3370
|
+
onData,
|
|
3371
|
+
onEnd
|
|
3372
|
+
};
|
|
3373
|
+
stdin.on("data", onData);
|
|
3374
|
+
stdin.once("end", onEnd);
|
|
3375
|
+
stdin.resume();
|
|
3376
|
+
}
|
|
3377
|
+
/** Stop forwarding stdin (on a terminal stream event) without killing reads. */
|
|
3378
|
+
function stopStdinForwarding() {
|
|
3379
|
+
const current = forwardingStdin;
|
|
3380
|
+
if (!current) return;
|
|
3381
|
+
forwardingStdin = null;
|
|
3382
|
+
current.stdin.off("data", current.onData);
|
|
3383
|
+
current.stdin.off("end", current.onEnd);
|
|
3384
|
+
}
|
|
2915
3385
|
/** Live terminal on the caller's real TTY. */
|
|
2916
3386
|
async function runPty({ session, agentId, agentName }) {
|
|
2917
3387
|
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
@@ -2919,7 +3389,7 @@ async function runPty({ session, agentId, agentName }) {
|
|
|
2919
3389
|
return 1;
|
|
2920
3390
|
}
|
|
2921
3391
|
console.error(`Connecting to ${agentName}'s sandbox… (Ctrl-] detaches)`);
|
|
2922
|
-
const { runRawPtyPassthrough } = await import("./raw-pty-
|
|
3392
|
+
const { runRawPtyPassthrough } = await import("./raw-pty-BJIs_xjQ.mjs");
|
|
2923
3393
|
const result = await runRawPtyPassthrough({
|
|
2924
3394
|
stdin: process.stdin,
|
|
2925
3395
|
stdout: process.stdout,
|
|
@@ -3090,6 +3560,53 @@ function resolveEditor(override, env, platform = process.platform) {
|
|
|
3090
3560
|
};
|
|
3091
3561
|
}
|
|
3092
3562
|
/**
|
|
3563
|
+
* Resolve the target agent and open the multiplexed fs channel to its
|
|
3564
|
+
* sandbox. Shared by every `fs` subcommand. A failed agent listing or a
|
|
3565
|
+
* failed upgrade (expired session, an agent the caller can't edit, or the
|
|
3566
|
+
* `sandbox-fs-enabled` kill switch) exits here before any file work.
|
|
3567
|
+
*/
|
|
3568
|
+
async function openAgentFs(session, agentSelector) {
|
|
3569
|
+
const { createRestClient } = await import("./rest-C8mKL4nc.mjs");
|
|
3570
|
+
const { resolveAgent } = await import("./print-PxBm9ypJ.mjs");
|
|
3571
|
+
let agent;
|
|
3572
|
+
try {
|
|
3573
|
+
agent = resolveAgent(await createRestClient({
|
|
3574
|
+
appUrl: session.appUrl,
|
|
3575
|
+
sessionToken: session.sessionToken
|
|
3576
|
+
}).listAgents({
|
|
3577
|
+
scope: "org",
|
|
3578
|
+
onPage: null
|
|
3579
|
+
}), agentSelector);
|
|
3580
|
+
} catch (error) {
|
|
3581
|
+
printError(error instanceof Error ? error.message : String(error));
|
|
3582
|
+
process.exit(1);
|
|
3583
|
+
}
|
|
3584
|
+
let fs;
|
|
3585
|
+
try {
|
|
3586
|
+
fs = await SandboxFsClient.connect({
|
|
3587
|
+
appUrl: session.appUrl,
|
|
3588
|
+
sessionToken: session.sessionToken,
|
|
3589
|
+
agentId: agent.id
|
|
3590
|
+
});
|
|
3591
|
+
} catch (error) {
|
|
3592
|
+
printError(`Could not open the sandbox filesystem channel: ${error instanceof Error ? error.message : String(error)}`);
|
|
3593
|
+
process.exit(1);
|
|
3594
|
+
}
|
|
3595
|
+
return {
|
|
3596
|
+
agent,
|
|
3597
|
+
fs
|
|
3598
|
+
};
|
|
3599
|
+
}
|
|
3600
|
+
/**
|
|
3601
|
+
* The oversized-file error for `fs put` and `fs cp`. The fs channel's write
|
|
3602
|
+
* op is whole-file only (no offset or append), so the CLI cannot chunk a
|
|
3603
|
+
* file larger than the relay's per-write cap — the web Files tab is the path
|
|
3604
|
+
* for those.
|
|
3605
|
+
*/
|
|
3606
|
+
function oversizeWriteError(label, size) {
|
|
3607
|
+
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.`;
|
|
3608
|
+
}
|
|
3609
|
+
/**
|
|
3093
3610
|
* `skydive fs edit <path>` — edit a file that lives on the agent's computer
|
|
3094
3611
|
* (its sandbox) with your LOCAL editor. It reads the remote file down over the
|
|
3095
3612
|
* multiplexed `fs` sandbox-stream channel, opens it in `$EDITOR`, and writes
|
|
@@ -3121,33 +3638,7 @@ const fsEditCommand = {
|
|
|
3121
3638
|
handler: async (argv) => {
|
|
3122
3639
|
const session = requireSession(argv);
|
|
3123
3640
|
const remotePath = argv.path;
|
|
3124
|
-
const {
|
|
3125
|
-
const { resolveAgent } = await import("./print-DX4RJe8S.mjs");
|
|
3126
|
-
const client = createRestClient({
|
|
3127
|
-
appUrl: session.appUrl,
|
|
3128
|
-
sessionToken: session.sessionToken
|
|
3129
|
-
});
|
|
3130
|
-
let agent;
|
|
3131
|
-
try {
|
|
3132
|
-
agent = resolveAgent(await client.listAgents({
|
|
3133
|
-
scope: "org",
|
|
3134
|
-
onPage: null
|
|
3135
|
-
}), argv.agent ?? null);
|
|
3136
|
-
} catch (error) {
|
|
3137
|
-
printError(error instanceof Error ? error.message : String(error));
|
|
3138
|
-
process.exit(1);
|
|
3139
|
-
}
|
|
3140
|
-
let fs;
|
|
3141
|
-
try {
|
|
3142
|
-
fs = await SandboxFsClient.connect({
|
|
3143
|
-
appUrl: session.appUrl,
|
|
3144
|
-
sessionToken: session.sessionToken,
|
|
3145
|
-
agentId: agent.id
|
|
3146
|
-
});
|
|
3147
|
-
} catch (error) {
|
|
3148
|
-
printError(`Could not open the sandbox filesystem channel: ${error instanceof Error ? error.message : String(error)}`);
|
|
3149
|
-
process.exit(1);
|
|
3150
|
-
}
|
|
3641
|
+
const { agent, fs } = await openAgentFs(session, argv.agent ?? null);
|
|
3151
3642
|
const cleanup = async (dir) => {
|
|
3152
3643
|
await rm(dir, {
|
|
3153
3644
|
recursive: true,
|
|
@@ -3212,21 +3703,157 @@ function openEditor(override, file) {
|
|
|
3212
3703
|
});
|
|
3213
3704
|
}
|
|
3214
3705
|
/**
|
|
3706
|
+
* Upload a local file to a path on the agent's sandbox in one `write` op.
|
|
3707
|
+
* The relay caps a single write's payload at {@link FS_MAX_BLOB_BYTES} and the
|
|
3708
|
+
* write op is whole-file only (no offset/append), so a larger file is
|
|
3709
|
+
* rejected up front with a pointer to the web Files tab rather than a
|
|
3710
|
+
* truncated or partial upload.
|
|
3711
|
+
*/
|
|
3712
|
+
const fsPutCommand = {
|
|
3713
|
+
command: "put <agent> <local-file> <remote-path>",
|
|
3714
|
+
describe: "Copy a file from your machine onto the agent's sandbox",
|
|
3715
|
+
builder: (y) => y.positional("agent", {
|
|
3716
|
+
type: "string",
|
|
3717
|
+
demandOption: true,
|
|
3718
|
+
describe: "Target agent, by id, slug, or name"
|
|
3719
|
+
}).positional("local-file", {
|
|
3720
|
+
type: "string",
|
|
3721
|
+
demandOption: true,
|
|
3722
|
+
describe: "Path of the file on your machine to upload"
|
|
3723
|
+
}).positional("remote-path", {
|
|
3724
|
+
type: "string",
|
|
3725
|
+
demandOption: true,
|
|
3726
|
+
describe: "Absolute or sandbox-relative path to write it to"
|
|
3727
|
+
}).example("skydive fs put grace ./report.pdf /home/user/Downloads/report.pdf", "Upload a local file to the sandbox"),
|
|
3728
|
+
handler: async (argv) => {
|
|
3729
|
+
const { fs } = await openAgentFs(requireSession(argv), argv.agent ?? null);
|
|
3730
|
+
try {
|
|
3731
|
+
const localStat = await stat(argv["local-file"]);
|
|
3732
|
+
if (localStat.isDirectory()) {
|
|
3733
|
+
printError(`${argv["local-file"]} is a directory; fs put copies a single file.`);
|
|
3734
|
+
process.exit(1);
|
|
3735
|
+
}
|
|
3736
|
+
if (localStat.size > FS_MAX_BLOB_BYTES) {
|
|
3737
|
+
printError(oversizeWriteError(argv["local-file"], localStat.size));
|
|
3738
|
+
process.exit(1);
|
|
3739
|
+
}
|
|
3740
|
+
const bytes = await readFile(argv["local-file"]);
|
|
3741
|
+
await fs.write(argv["remote-path"], new Uint8Array(bytes));
|
|
3742
|
+
fs.close();
|
|
3743
|
+
} catch (error) {
|
|
3744
|
+
fs.close();
|
|
3745
|
+
printError(error instanceof Error ? error.message : String(error));
|
|
3746
|
+
process.exit(1);
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
};
|
|
3750
|
+
/**
|
|
3751
|
+
* Download a file from the agent's sandbox to a local path. Reads are
|
|
3752
|
+
* range-based, so a file of any size comes down in chunks of
|
|
3753
|
+
* {@link FS_MAX_BLOB_BYTES}; the chunks are concatenated into one local
|
|
3754
|
+
* write. Silent on success so it composes in scripts (exit code carries the
|
|
3755
|
+
* result).
|
|
3756
|
+
*/
|
|
3757
|
+
const fsGetCommand = {
|
|
3758
|
+
command: "get <agent> <remote-path> <local-path>",
|
|
3759
|
+
describe: "Copy a file from the agent's sandbox onto your machine",
|
|
3760
|
+
builder: (y) => y.positional("agent", {
|
|
3761
|
+
type: "string",
|
|
3762
|
+
demandOption: true,
|
|
3763
|
+
describe: "Target agent, by id, slug, or name"
|
|
3764
|
+
}).positional("remote-path", {
|
|
3765
|
+
type: "string",
|
|
3766
|
+
demandOption: true,
|
|
3767
|
+
describe: "Absolute or sandbox-relative path of the file to download"
|
|
3768
|
+
}).positional("local-path", {
|
|
3769
|
+
type: "string",
|
|
3770
|
+
demandOption: true,
|
|
3771
|
+
describe: "Path on your machine to write it to"
|
|
3772
|
+
}).example("skydive fs get grace /home/user/.self/soul.md ./soul.md", "Download a file from the sandbox"),
|
|
3773
|
+
handler: async (argv) => {
|
|
3774
|
+
const { fs } = await openAgentFs(requireSession(argv), argv.agent ?? null);
|
|
3775
|
+
try {
|
|
3776
|
+
const remoteStat = await fs.stat(argv["remote-path"]);
|
|
3777
|
+
if (remoteStat.type === "dir") {
|
|
3778
|
+
printError(`${argv["remote-path"]} is a directory; fs get copies a single file.`);
|
|
3779
|
+
process.exit(1);
|
|
3780
|
+
}
|
|
3781
|
+
const chunks = [];
|
|
3782
|
+
for (let offset = 0; offset < remoteStat.size; offset += FS_MAX_BLOB_BYTES) chunks.push(await fs.read(argv["remote-path"], {
|
|
3783
|
+
offset,
|
|
3784
|
+
length: FS_MAX_BLOB_BYTES
|
|
3785
|
+
}));
|
|
3786
|
+
await writeFile(argv["local-path"], Buffer.concat(chunks));
|
|
3787
|
+
fs.close();
|
|
3788
|
+
} catch (error) {
|
|
3789
|
+
fs.close();
|
|
3790
|
+
printError(error instanceof Error ? error.message : String(error));
|
|
3791
|
+
process.exit(1);
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3794
|
+
};
|
|
3795
|
+
/**
|
|
3796
|
+
* Copy a file from one sandbox path to another, via one read and one write.
|
|
3797
|
+
* Same per-write cap as `fs put`: the write op is whole-file only, so a
|
|
3798
|
+
* source larger than {@link FS_MAX_BLOB_BYTES} is rejected up front.
|
|
3799
|
+
*/
|
|
3800
|
+
const fsCpCommand = {
|
|
3801
|
+
command: "cp <agent> <src> <dst>",
|
|
3802
|
+
describe: "Copy a file to another path inside the agent's sandbox",
|
|
3803
|
+
builder: (y) => y.positional("agent", {
|
|
3804
|
+
type: "string",
|
|
3805
|
+
demandOption: true,
|
|
3806
|
+
describe: "Target agent, by id, slug, or name"
|
|
3807
|
+
}).positional("src", {
|
|
3808
|
+
type: "string",
|
|
3809
|
+
demandOption: true,
|
|
3810
|
+
describe: "Absolute or sandbox-relative path of the file to copy"
|
|
3811
|
+
}).positional("dst", {
|
|
3812
|
+
type: "string",
|
|
3813
|
+
demandOption: true,
|
|
3814
|
+
describe: "Absolute or sandbox-relative path to copy it to"
|
|
3815
|
+
}).example("skydive fs cp grace /tmp/notes.md /home/user/.self/notes.md", "Copy a file within the sandbox"),
|
|
3816
|
+
handler: async (argv) => {
|
|
3817
|
+
const { fs } = await openAgentFs(requireSession(argv), argv.agent ?? null);
|
|
3818
|
+
try {
|
|
3819
|
+
const srcStat = await fs.stat(argv.src);
|
|
3820
|
+
if (srcStat.type === "dir") {
|
|
3821
|
+
printError(`${argv.src} is a directory; fs cp copies a single file.`);
|
|
3822
|
+
process.exit(1);
|
|
3823
|
+
}
|
|
3824
|
+
if (srcStat.size > FS_MAX_BLOB_BYTES) {
|
|
3825
|
+
printError(oversizeWriteError(argv.src, srcStat.size));
|
|
3826
|
+
process.exit(1);
|
|
3827
|
+
}
|
|
3828
|
+
const bytes = await fs.read(argv.src, null);
|
|
3829
|
+
await fs.write(argv.dst, bytes);
|
|
3830
|
+
fs.close();
|
|
3831
|
+
} catch (error) {
|
|
3832
|
+
fs.close();
|
|
3833
|
+
printError(error instanceof Error ? error.message : String(error));
|
|
3834
|
+
process.exit(1);
|
|
3835
|
+
}
|
|
3836
|
+
}
|
|
3837
|
+
};
|
|
3838
|
+
/**
|
|
3215
3839
|
* `skydive fs` — work with the files on an agent's computer (its sandbox) from
|
|
3216
3840
|
* your own machine. The namespace for filesystem access:
|
|
3217
3841
|
*
|
|
3218
|
-
* - `fs edit <path>` edit one remote file with your local editor
|
|
3842
|
+
* - `fs edit <path>` edit one remote file with your local editor.
|
|
3843
|
+
* - `fs put ...` upload a local file to the sandbox.
|
|
3844
|
+
* - `fs get ...` download a sandbox file to your machine.
|
|
3845
|
+
* - `fs cp ...` copy a file within the sandbox.
|
|
3219
3846
|
* - `fs mount <dir>` mount the whole sandbox filesystem locally (coming in a
|
|
3220
3847
|
* later PR, on the same first-class `fs` relay channel).
|
|
3221
3848
|
*
|
|
3222
3849
|
* Grouping these under one command keeps the file surface discoverable and
|
|
3223
|
-
* leaves room to grow (`fs ls`, `fs cat
|
|
3224
|
-
*
|
|
3850
|
+
* leaves room to grow (`fs ls`, `fs cat`) without adding more top-level
|
|
3851
|
+
* commands.
|
|
3225
3852
|
*/
|
|
3226
3853
|
const fsCommand = {
|
|
3227
3854
|
command: "fs <command>",
|
|
3228
3855
|
describe: "Work with the files on an agent's computer (its sandbox)",
|
|
3229
|
-
builder: (y) => y.command(fsEditCommand).demandCommand(1, "Specify a subcommand: edit"),
|
|
3856
|
+
builder: (y) => y.command(fsEditCommand).command(fsPutCommand).command(fsGetCommand).command(fsCpCommand).demandCommand(1, "Specify a subcommand: edit, put, get, cp"),
|
|
3230
3857
|
handler: () => {}
|
|
3231
3858
|
};
|
|
3232
3859
|
|
|
@@ -3784,7 +4411,8 @@ async function offerPackageManagerUpdate(opts) {
|
|
|
3784
4411
|
function relaunchCli(argv = process.argv) {
|
|
3785
4412
|
try {
|
|
3786
4413
|
const [, script, ...rest] = argv;
|
|
3787
|
-
|
|
4414
|
+
const args = script?.startsWith("/$bunfs/") ? rest : script ? [script, ...rest] : rest;
|
|
4415
|
+
spawn(process.execPath, args, { stdio: "inherit" }).on("exit", (code) => process.exit(code ?? 0));
|
|
3788
4416
|
} catch (_error) {
|
|
3789
4417
|
process.exit(0);
|
|
3790
4418
|
}
|
|
@@ -3953,7 +4581,7 @@ function snapshot(pref) {
|
|
|
3953
4581
|
describe: pref.describe
|
|
3954
4582
|
};
|
|
3955
4583
|
}
|
|
3956
|
-
const listCommand$
|
|
4584
|
+
const listCommand$2 = {
|
|
3957
4585
|
command: "list",
|
|
3958
4586
|
aliases: ["ls"],
|
|
3959
4587
|
describe: "Show every editable preference, its value, and its source",
|
|
@@ -4058,8 +4686,162 @@ const pathCommand$1 = {
|
|
|
4058
4686
|
const configCommand = {
|
|
4059
4687
|
command: "config",
|
|
4060
4688
|
describe: "View and set CLI preferences (safe, hand-editable keys only)",
|
|
4061
|
-
builder: (y) => y.command(listCommand$
|
|
4062
|
-
handler: (argv) => listCommand$
|
|
4689
|
+
builder: (y) => y.command(listCommand$2).command(getCommand).command(setCommand).command(unsetCommand).command(pathCommand$1),
|
|
4690
|
+
handler: (argv) => listCommand$2.handler(argv)
|
|
4691
|
+
};
|
|
4692
|
+
|
|
4693
|
+
//#endregion
|
|
4694
|
+
//#region src/commands/proxy.ts
|
|
4695
|
+
/**
|
|
4696
|
+
* `skydive proxy skip-list` — manage the sandbox egress proxy's custom skip
|
|
4697
|
+
* list. The agent-visible verbs are `skip-list add <host…>` / `skip-list
|
|
4698
|
+
* remove <host…>`; a bare `skip-list` lists what is currently skipped.
|
|
4699
|
+
*
|
|
4700
|
+
* Skipped hosts leave the sandbox RAW: the mitmproxy addon forwards them
|
|
4701
|
+
* without rewriting through the transparent proxy, which means NO platform
|
|
4702
|
+
* credential injection (that's the point — a user's own API keys go straight
|
|
4703
|
+
* to the provider), but also no agent rules, no content policy, no billing
|
|
4704
|
+
* gate, and no platform-side record of the egress.
|
|
4705
|
+
*
|
|
4706
|
+
* Config is agent-scoped runtime state: it lives in the in-sandbox daemon's
|
|
4707
|
+
* env and survives daemon restarts and pause/resume, but resets on a fresh
|
|
4708
|
+
* box (a new sandbox cold-create starts with the addon's built-in defaults
|
|
4709
|
+
* only). Platform control-plane hosts can never be skipped.
|
|
4710
|
+
*
|
|
4711
|
+
* Loopback-only daemon routes: this command only works INSIDE a sandbox
|
|
4712
|
+
* (where the egress proxy actually runs).
|
|
4713
|
+
*/
|
|
4714
|
+
const DAEMON_BASE_URL = process.env["SKYDIVE_DAEMON_URL"] ?? "http://localhost:38994";
|
|
4715
|
+
async function daemonFetch(path, init) {
|
|
4716
|
+
try {
|
|
4717
|
+
const res = await fetch(`${DAEMON_BASE_URL}${path}`, {
|
|
4718
|
+
...init,
|
|
4719
|
+
headers: {
|
|
4720
|
+
"Content-Type": "application/json",
|
|
4721
|
+
...init?.headers
|
|
4722
|
+
}
|
|
4723
|
+
});
|
|
4724
|
+
const parsed = z.object({
|
|
4725
|
+
hosts: z.array(z.string()).optional(),
|
|
4726
|
+
error: z.string().optional()
|
|
4727
|
+
}).safeParse(await res.json().catch((_error) => ({})));
|
|
4728
|
+
const body = parsed.success ? parsed.data : {};
|
|
4729
|
+
return {
|
|
4730
|
+
status: res.status,
|
|
4731
|
+
body
|
|
4732
|
+
};
|
|
4733
|
+
} catch (err) {
|
|
4734
|
+
return {
|
|
4735
|
+
status: 0,
|
|
4736
|
+
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)})` }
|
|
4737
|
+
};
|
|
4738
|
+
}
|
|
4739
|
+
}
|
|
4740
|
+
function printHosts(argv, hosts) {
|
|
4741
|
+
if (argv.json) {
|
|
4742
|
+
output(argv, { hosts });
|
|
4743
|
+
return;
|
|
4744
|
+
}
|
|
4745
|
+
if (hosts.length === 0) {
|
|
4746
|
+
console.log("No custom skip hosts. (Platform defaults still apply.)");
|
|
4747
|
+
return;
|
|
4748
|
+
}
|
|
4749
|
+
printTable(["Host"], hosts.map((h) => [h]));
|
|
4750
|
+
}
|
|
4751
|
+
const listCommand$1 = {
|
|
4752
|
+
command: "list",
|
|
4753
|
+
aliases: ["ls"],
|
|
4754
|
+
describe: "Show the custom proxy skip hosts (same as bare `skip-list`)",
|
|
4755
|
+
handler: async (argv) => {
|
|
4756
|
+
const { status, body } = await daemonFetch("/v1/proxy/skip-list", null);
|
|
4757
|
+
if (status !== 200) {
|
|
4758
|
+
printError(body.error ?? `daemon /v1/proxy/skip-list: ${status}`);
|
|
4759
|
+
process.exit(1);
|
|
4760
|
+
}
|
|
4761
|
+
printHosts(argv, body.hosts ?? []);
|
|
4762
|
+
}
|
|
4763
|
+
};
|
|
4764
|
+
const addCommand = {
|
|
4765
|
+
command: "add <hosts..>",
|
|
4766
|
+
describe: "Skip the proxy for exact host(s). Their traffic leaves the sandbox RAW: no platform credential injection, no agent rules, no billing gate.",
|
|
4767
|
+
builder: (y) => y.positional("hosts", {
|
|
4768
|
+
type: "string",
|
|
4769
|
+
array: true,
|
|
4770
|
+
demandOption: true,
|
|
4771
|
+
describe: "One or more exact hostnames (api.example.com), no wildcards"
|
|
4772
|
+
}),
|
|
4773
|
+
handler: async (argv) => {
|
|
4774
|
+
for (const host of argv.hosts) {
|
|
4775
|
+
const { status, body } = await daemonFetch("/v1/proxy/skip-list/add", {
|
|
4776
|
+
method: "POST",
|
|
4777
|
+
body: JSON.stringify({ host })
|
|
4778
|
+
});
|
|
4779
|
+
if (status === 0) {
|
|
4780
|
+
printError(body.error ?? `daemon unreachable (host ${host})`);
|
|
4781
|
+
process.exitCode = 1;
|
|
4782
|
+
continue;
|
|
4783
|
+
}
|
|
4784
|
+
if (status !== 200) {
|
|
4785
|
+
printError(`${host}: ${body.error ?? status}`);
|
|
4786
|
+
process.exitCode = 1;
|
|
4787
|
+
continue;
|
|
4788
|
+
}
|
|
4789
|
+
if (argv.json) output(argv, {
|
|
4790
|
+
host,
|
|
4791
|
+
hosts: body.hosts ?? []
|
|
4792
|
+
});
|
|
4793
|
+
else console.log(`${host} is now skipped: requests to it leave the sandbox raw (no platform credential injection).`);
|
|
4794
|
+
}
|
|
4795
|
+
}
|
|
4796
|
+
};
|
|
4797
|
+
const removeCommand = {
|
|
4798
|
+
command: "remove <hosts..>",
|
|
4799
|
+
aliases: ["rm"],
|
|
4800
|
+
describe: "Remove host(s) from the custom skip list",
|
|
4801
|
+
builder: (y) => y.positional("hosts", {
|
|
4802
|
+
type: "string",
|
|
4803
|
+
array: true,
|
|
4804
|
+
demandOption: true,
|
|
4805
|
+
describe: "Exact hostnames to remove"
|
|
4806
|
+
}),
|
|
4807
|
+
handler: async (argv) => {
|
|
4808
|
+
for (const host of argv.hosts) {
|
|
4809
|
+
const { status, body } = await daemonFetch("/v1/proxy/skip-list/remove", {
|
|
4810
|
+
method: "POST",
|
|
4811
|
+
body: JSON.stringify({ host })
|
|
4812
|
+
});
|
|
4813
|
+
if (status === 0) {
|
|
4814
|
+
printError(body.error ?? `daemon unreachable (host ${host})`);
|
|
4815
|
+
process.exitCode = 1;
|
|
4816
|
+
continue;
|
|
4817
|
+
}
|
|
4818
|
+
if (status !== 200) {
|
|
4819
|
+
printError(`${host}: ${body.error ?? status}`);
|
|
4820
|
+
process.exitCode = 1;
|
|
4821
|
+
continue;
|
|
4822
|
+
}
|
|
4823
|
+
if (argv.json) output(argv, {
|
|
4824
|
+
host,
|
|
4825
|
+
hosts: body.hosts ?? []
|
|
4826
|
+
});
|
|
4827
|
+
else console.log(`${host} removed from the skip list.`);
|
|
4828
|
+
}
|
|
4829
|
+
}
|
|
4830
|
+
};
|
|
4831
|
+
/** `skydive proxy skip-list` — no subcommand lists; add/remove mutate. */
|
|
4832
|
+
const skipListCommand = {
|
|
4833
|
+
command: "skip-list [command]",
|
|
4834
|
+
describe: "Manage hosts that bypass the egress proxy",
|
|
4835
|
+
builder: (y) => y.command(listCommand$1).command(addCommand).command(removeCommand).default("command", "list"),
|
|
4836
|
+
handler: async (argv) => {
|
|
4837
|
+
if (argv.command === "list" || argv.command === "ls") await listCommand$1.handler(argv);
|
|
4838
|
+
}
|
|
4839
|
+
};
|
|
4840
|
+
const proxyCommand = {
|
|
4841
|
+
command: "proxy <command>",
|
|
4842
|
+
describe: "Inspect and configure the sandbox egress proxy",
|
|
4843
|
+
builder: (y) => y.command(skipListCommand).demandCommand(1, "Run `skydive proxy skip-list`"),
|
|
4844
|
+
handler: () => {}
|
|
4063
4845
|
};
|
|
4064
4846
|
|
|
4065
4847
|
//#endregion
|
|
@@ -4116,7 +4898,7 @@ async function offerIssueReport(archivePath) {
|
|
|
4116
4898
|
console.log(`File an issue: ${ISSUE_REPOSITORY_URL}`);
|
|
4117
4899
|
return;
|
|
4118
4900
|
}
|
|
4119
|
-
await open(issueUrl(archivePath));
|
|
4901
|
+
await open$1(issueUrl(archivePath));
|
|
4120
4902
|
console.log(`Attach the diagnostics archive: ${archivePath}`);
|
|
4121
4903
|
} finally {
|
|
4122
4904
|
prompt.close();
|
|
@@ -4219,7 +5001,7 @@ function createCli(argv) {
|
|
|
4219
5001
|
type: "string",
|
|
4220
5002
|
global: true,
|
|
4221
5003
|
describe: "Override API base URL"
|
|
4222
|
-
}).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) => {
|
|
5004
|
+
}).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) => {
|
|
4223
5005
|
printError(err ? err instanceof Error ? err.message : String(err) : msg ?? "Unknown error");
|
|
4224
5006
|
process.exit(1);
|
|
4225
5007
|
});
|
|
@@ -4432,7 +5214,7 @@ function setupUpdateCheck(argv) {
|
|
|
4432
5214
|
|
|
4433
5215
|
//#endregion
|
|
4434
5216
|
//#region src/changelog.generated.ts
|
|
4435
|
-
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- `/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- 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";
|
|
5217
|
+
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";
|
|
4436
5218
|
|
|
4437
5219
|
//#endregion
|
|
4438
5220
|
//#region src/whats-new.ts
|
|
@@ -4575,7 +5357,7 @@ if (process.argv.includes(UPDATE_WORKER_FLAG)) {
|
|
|
4575
5357
|
process.exit(0);
|
|
4576
5358
|
}
|
|
4577
5359
|
if (process.argv.includes(PORTAL_DAEMON_FLAG)) {
|
|
4578
|
-
const { runPortalDaemon } = await import("./daemon-
|
|
5360
|
+
const { runPortalDaemon } = await import("./daemon-iKbr3tym.mjs");
|
|
4579
5361
|
runPortalDaemon(process.argv);
|
|
4580
5362
|
} else runCli();
|
|
4581
5363
|
function runCli() {
|