skydive-cli 0.6.0-beta.39 → 0.6.0-beta.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/js/bin.mjs CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
- import { c as version, s as name, t as createRestClient } from "./rest-HMJ6HYnl.mjs";
3
- import { A as getPromptHistoryPath, B as resolveConfig, D as getDefaultAgent, E as getConfigPath, F as getStoredApiKeyWorkspaceName, G as saveSession, H as resolveSession$1, I as getUpdateCheckDisabled, N as getShareMachineDefault, O as getLastSeenVersion, P as getStoredApiKeyId, R as resolveAppUrl, S as DEFAULT_API_URL, T as deleteConfig, V as resolveManagementAuth, W as saveConfig, b as API_KEY_FAMILY_PREFIX, i as resolveAgent$1, k as getPreference, q as setLastSeenVersion, w as PREFERENCES, x as API_KEY_PREFIX, y as API_KEYS_URL, z as resolveChatAuth } from "./print-BPQO_UaI.mjs";
4
- import { A as installAgentAlias, B as resolveWorkspaceId, D as machineOsFromPlatform, E as buildImportSeedPrompt, F as detectShell, I as ensureActiveOrganization, L as getActiveWorkspaceId, M as takenAliasNames, N as SUPPORTED_SHELLS, O as aliasActivationHint, P as defaultInstallEnv, R as getSessionIdentity, V as setActiveWorkspace, c as getAutomaticLogsDir, j as slugifyAliasName, k as dedupeAliasName, l as maybeStartProfiling, o as brandHelpArt, t as installCrashHandler, u as profileDir, w as themes, z as listWorkspaces } from "./install-03ApVdVv.mjs";
2
+ import { c as version, s as name, t as createRestClient } from "./rest-CXCsoY4Q.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-DTaoROjq.mjs";
4
+ import { A as installAgentAlias, B as resolveWorkspaceId, D as machineOsFromPlatform, E as buildImportSeedPrompt, F as detectShell, I as ensureActiveOrganization, L as getActiveWorkspaceId, M as takenAliasNames, N as SUPPORTED_SHELLS, O as aliasActivationHint, P as defaultInstallEnv, R as getSessionIdentity, V as setActiveWorkspace, c as getAutomaticLogsDir, j as slugifyAliasName, k as dedupeAliasName, l as maybeStartProfiling, o as brandHelpArt, t as installCrashHandler, u as profileDir, w as themes, z as listWorkspaces } from "./install-DxZwvQnt.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 { a as resolveMachineIdentity } from "./client-C1r0rRmd.mjs";
8
+ import { s as resolveMachineIdentity } from "./client-hxuyfRBc.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-CSAbOyRz.mjs";
12
- import { a as encodeFsRequest, i as decodeFsResponse, n as SANDBOX_STREAM_PATH, r as streamSpecToQuery, t as SandboxStream } from "./client-l6orYfqq.mjs";
11
+ import { d as daemonPaths, i as queryDaemonStatus, n as ensureDaemonRunning, s as stopDaemon, u as PORTAL_DAEMON_FLAG } from "./daemon-BHEJmgBq.mjs";
12
+ import { a as encodeFsRequest, i as decodeFsResponse, n as SANDBOX_STREAM_PATH, r as streamSpecToQuery, t as SandboxStream } from "./client-Dr81zuTm.mjs";
13
13
  import { hideBin } from "yargs/helpers";
14
14
  import yargs from "yargs";
15
15
  import { hostname, tmpdir } from "node:os";
@@ -71,6 +71,22 @@ 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() });
75
91
  var SkydiveApiClient = class {
76
92
  baseUrl;
@@ -161,6 +177,27 @@ var SkydiveApiClient = class {
161
177
  path: `/agents/${encodeURIComponent(agentId)}/secrets/${encodeURIComponent(key)}`
162
178
  });
163
179
  }
180
+ async listGitTokens(agentId) {
181
+ return this.request({
182
+ method: "GET",
183
+ path: `/agents/${encodeURIComponent(agentId)}/git-tokens`,
184
+ schema: ListGitTokensResponseSchema
185
+ }).then((r) => r.map((res) => res.tokens));
186
+ }
187
+ async createGitToken(agentId, params) {
188
+ return this.request({
189
+ method: "POST",
190
+ path: `/agents/${encodeURIComponent(agentId)}/git-tokens`,
191
+ body: params,
192
+ schema: GitTokenSchema
193
+ });
194
+ }
195
+ async revokeGitToken(agentId, tokenId) {
196
+ return this.request({
197
+ method: "DELETE",
198
+ path: `/agents/${encodeURIComponent(agentId)}/git-tokens/${encodeURIComponent(tokenId)}`
199
+ });
200
+ }
164
201
  async request(params) {
165
202
  const url = `${this.baseUrl}${params.path}`;
166
203
  const headers = {
@@ -582,6 +619,7 @@ async function runBrowserLogin(argv) {
582
619
  if (identity?.activeWorkspaceName) console.log(` Workspace: ${identity.activeWorkspaceName}`);
583
620
  if (minted.isOk()) console.log(` API key: ${minted.value.prefix}… (${minted.value.name})`);
584
621
  console.log(` Config: ${getConfigPath()}`);
622
+ console.log(" Git: to push to an agent repo from this machine, run `skydive agents git token create <agent>`");
585
623
  }
586
624
  /** CI / headless path: validate and persist an existing key, no browser. */
587
625
  async function runApiKeyLogin(argv, apiKey) {
@@ -1027,6 +1065,40 @@ function requireManagementClient(argv, opts = {}) {
1027
1065
  ...opts.workspaceId ? { workspaceId: opts.workspaceId } : {}
1028
1066
  });
1029
1067
  }
1068
+ /**
1069
+ * Resolve an agent-targeting command's agent selector (id or name) against
1070
+ * the management roster, returning the id, or exit with the candidate list.
1071
+ *
1072
+ * `secrets` and `keys` historically took a raw `--agent-id` and hit
1073
+ * `/agents/<value>/...` directly, so a name 404'd "agent not found" for a
1074
+ * perfectly real agent, while `sandbox`/`fs`/`portal` resolved the same
1075
+ * string happily (ANY-8977). Reads one page (the same 100 `skydive agents
1076
+ * list` shows), so the error's candidates are what the user was looking at.
1077
+ */
1078
+ async function resolveTargetAgentId(client, selector) {
1079
+ if (!selector) {
1080
+ printError("Missing --agent <id or name>. Run `skydive agents list` for candidates.");
1081
+ process.exit(1);
1082
+ }
1083
+ const { resolveAgent } = await import("./print-Bovyirht.mjs");
1084
+ const result = await client.listAgents({
1085
+ scope: "org",
1086
+ limit: 100
1087
+ });
1088
+ if (result.isErr()) {
1089
+ printError(result.error.message);
1090
+ process.exit(1);
1091
+ }
1092
+ try {
1093
+ return resolveAgent(result.value.agents.map((agent) => ({
1094
+ id: agent.id,
1095
+ name: agent.name
1096
+ })), selector).id;
1097
+ } catch (error) {
1098
+ printError(error instanceof Error ? error.message : String(error));
1099
+ process.exit(1);
1100
+ }
1101
+ }
1030
1102
  /** Resolve the session (see {@link requireSession}) and build a REST client. */
1031
1103
  function requireRestClient(argv) {
1032
1104
  const auth = resolveChatAuth({ appUrl: resolveAppUrl({ appUrl: argv["api-url"] }) });
@@ -1040,6 +1112,171 @@ function requireRestClient(argv) {
1040
1112
  });
1041
1113
  }
1042
1114
 
1115
+ //#endregion
1116
+ //#region src/auth/git-credentials.ts
1117
+ /**
1118
+ * Laptop-side git credentials for an agent's repo.
1119
+ *
1120
+ * The in-sandbox push path (`git -> in-sandbox credential helper -> daemon ->
1121
+ * /git-credentials route -> git storage`) mints a short-lived credential per
1122
+ * push, which only works inside the sandbox. From a laptop, the supported
1123
+ * path is a git-proxy token: `POST /v1/agents/:agentId/git-tokens` returns a
1124
+ * long-lived `skdv_…` token plus a tokenless remote URL on the git-proxy
1125
+ * host. This module holds the pure logic for naming the token. The command
1126
+ * prints the values and changes nothing on the machine: what to do with the
1127
+ * token (credential store, remotes) is left to the user's own tools.
1128
+ */
1129
+ /** Label stamped on the git-proxy token a machine mints for itself, so the
1130
+ * token is identifiable in `git token list` and on the web settings page. */
1131
+ function gitTokenLabel() {
1132
+ return `CLI git (${hostname()})`;
1133
+ }
1134
+
1135
+ //#endregion
1136
+ //#region src/commands/git-setup.ts
1137
+ /** Create one read_write git-proxy token for the agent and print it. The
1138
+ * API returns the ready-to-use tokenless remote URL, so the CLI does no URL
1139
+ * parsing. The command's job ends at the credential: it changes nothing on
1140
+ * this machine (no git config writes, no credential-store plumbing) — what
1141
+ * to do with the token is the caller's tool's business. The label is
1142
+ * metadata only, so a re-run accumulates rather than revokes. */
1143
+ const gitTokenCreateCommand = {
1144
+ command: "create <agent>",
1145
+ describe: "Create a git token to push to the agent's repo from your machine",
1146
+ builder: (y) => y.positional("agent", {
1147
+ type: "string",
1148
+ demandOption: true,
1149
+ describe: "Agent ID or name (see `skydive agents list`)"
1150
+ }),
1151
+ handler: async (argv) => {
1152
+ const client = requireManagementClient(argv);
1153
+ const agent = await resolveAgent(client, argv.agent);
1154
+ const created = await client.createGitToken(agent.id, {
1155
+ permissions: "read_write",
1156
+ label: gitTokenLabel()
1157
+ });
1158
+ if (created.isErr()) {
1159
+ printError(`Could not create a git token: ${created.error.message}`);
1160
+ process.exit(1);
1161
+ }
1162
+ const { token, remoteUrl } = created.value;
1163
+ if (argv.json) {
1164
+ output(argv, {
1165
+ agentId: agent.id,
1166
+ agentName: agent.name,
1167
+ remoteUrl,
1168
+ tokenLabel: created.value.label,
1169
+ token
1170
+ });
1171
+ return;
1172
+ }
1173
+ if (argv.quiet) {
1174
+ console.log(token);
1175
+ return;
1176
+ }
1177
+ console.log(`Git token for ${agent.name} (read_write).`);
1178
+ console.log(` Token: ${token}`);
1179
+ console.log(` Remote: ${remoteUrl} (password is the token)`);
1180
+ console.log(" Nothing was written to git on this machine; pipe these into whatever manages your credentials.");
1181
+ }
1182
+ };
1183
+ /** List the agent's git tokens (id, label, permissions, last use) so a revoke
1184
+ * has an id to take. Token values only come back from creating. */
1185
+ const gitTokenListCommand = {
1186
+ command: "list <agent>",
1187
+ describe: "List the agent's git tokens",
1188
+ builder: (y) => y.positional("agent", {
1189
+ type: "string",
1190
+ demandOption: true,
1191
+ describe: "Agent ID or name (see `skydive agents list`)"
1192
+ }),
1193
+ handler: async (argv) => {
1194
+ const client = requireManagementClient(argv);
1195
+ const agent = await resolveAgent(client, argv.agent);
1196
+ const listed = await client.listGitTokens(agent.id);
1197
+ if (listed.isErr()) {
1198
+ printError(`Could not list this agent's git tokens: ${listed.error.message}`);
1199
+ process.exit(1);
1200
+ }
1201
+ if (argv.json) {
1202
+ output(argv, {
1203
+ agentId: agent.id,
1204
+ agentName: agent.name,
1205
+ tokens: listed.value
1206
+ });
1207
+ return;
1208
+ }
1209
+ if (argv.quiet) {
1210
+ for (const token of listed.value) console.log(token.id);
1211
+ return;
1212
+ }
1213
+ if (listed.value.length === 0) {
1214
+ console.log(`No git tokens for ${agent.name}.`);
1215
+ return;
1216
+ }
1217
+ printTable([
1218
+ "ID",
1219
+ "Label",
1220
+ "Permissions",
1221
+ "Last used"
1222
+ ], listed.value.map((t) => [
1223
+ t.id,
1224
+ t.label ?? "",
1225
+ t.permissions,
1226
+ t.lastUsedAt ?? "never"
1227
+ ]));
1228
+ }
1229
+ };
1230
+ /** Revoke one git token by id (run `git token list` for the ids). */
1231
+ const gitTokenRevokeCommand = {
1232
+ command: "revoke <agent> <token-id>",
1233
+ describe: "Revoke one of the agent's git tokens by id",
1234
+ builder: (y) => y.positional("agent", {
1235
+ type: "string",
1236
+ demandOption: true,
1237
+ describe: "Agent ID or name (see `skydive agents list`)"
1238
+ }).positional("token-id", {
1239
+ type: "string",
1240
+ demandOption: true,
1241
+ describe: "Token id (see `skydive agents git token list`)"
1242
+ }),
1243
+ handler: async (argv) => {
1244
+ const client = requireManagementClient(argv);
1245
+ const agent = await resolveAgent(client, argv.agent);
1246
+ const revoked = await client.revokeGitToken(agent.id, argv["token-id"]);
1247
+ if (revoked.isErr()) {
1248
+ printError(`Could not revoke git token ${argv["token-id"]}: ${revoked.error.message}`);
1249
+ process.exit(1);
1250
+ }
1251
+ console.log(`Revoked git token ${argv["token-id"]} for ${agent.name}.`);
1252
+ }
1253
+ };
1254
+ const gitTokenCommand = {
1255
+ command: "token <command>",
1256
+ describe: "Create, list, or revoke git-proxy tokens for an agent's repo",
1257
+ builder: (y) => y.command(gitTokenCreateCommand).command(gitTokenListCommand).command(gitTokenRevokeCommand).demandCommand(1, "Specify a subcommand: create, list, revoke"),
1258
+ handler: () => {}
1259
+ };
1260
+ /**
1261
+ * `skydive agents git` — git access to an agent's repo from your own machine.
1262
+ * The in-sandbox push path (git -> in-sandbox credential helper -> daemon ->
1263
+ * git storage) only works inside the sandbox; from a laptop, the supported
1264
+ * path is a git-proxy token via the same routes the web settings page uses:
1265
+ *
1266
+ * - `git token create <agent>` create a token and print it.
1267
+ * - `git token list <agent>` list the agent's tokens by id.
1268
+ * - `git token revoke <agent> <id>` revoke one token.
1269
+ *
1270
+ * The command's job ends at the credential: it changes nothing on this
1271
+ * machine — what to do with the token is the caller's tool's business.
1272
+ */
1273
+ const gitCommand = {
1274
+ command: "git <command>",
1275
+ describe: "Git access to an agent's repo from your machine",
1276
+ builder: (y) => y.command(gitTokenCommand).demandCommand(1, "Specify a subcommand: token"),
1277
+ handler: () => {}
1278
+ };
1279
+
1043
1280
  //#endregion
1044
1281
  //#region src/commands/agents.ts
1045
1282
  const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
@@ -1291,7 +1528,7 @@ const aliasCommand = {
1291
1528
  const agentsCommand = {
1292
1529
  command: "agents",
1293
1530
  describe: "Manage agents",
1294
- builder: (y) => y.command(listCommand$6).command(getCommand$2).command(createCommand$1).command(aliasCommand).demandCommand(1, "Specify a subcommand: list, get, create, alias"),
1531
+ builder: (y) => y.command(listCommand$6).command(getCommand$2).command(createCommand$1).command(aliasCommand).command(gitCommand).demandCommand(1, "Specify a subcommand: list, get, create, alias, git"),
1295
1532
  handler: () => {}
1296
1533
  };
1297
1534
 
@@ -1586,7 +1823,7 @@ const importCommand = {
1586
1823
  process.exit(1);
1587
1824
  }
1588
1825
  }
1589
- const { runChat } = await import("./boot-FnZU62YK.mjs");
1826
+ const { runChat } = await import("./boot-Dzf7JWwL.mjs");
1590
1827
  await runChat({
1591
1828
  appUrl,
1592
1829
  sessionToken: session.value.sessionToken,
@@ -1616,7 +1853,7 @@ async function runImportPrintMode({ argv, appUrl }) {
1616
1853
  printError(`${session.error.message} For non-interactive use, run \`skydive auth login --web\` first, or set SKYDIVE_SESSION_TOKEN.`);
1617
1854
  process.exit(1);
1618
1855
  }
1619
- const { connectMachineShare } = await import("./print-share-Tdu4xDgY.mjs");
1856
+ const { connectMachineShare } = await import("./print-share-BvFDVwGW.mjs");
1620
1857
  const machineShare = await connectMachineShare({
1621
1858
  appUrl,
1622
1859
  sessionToken: session.value.sessionToken,
@@ -1624,7 +1861,7 @@ async function runImportPrintMode({ argv, appUrl }) {
1624
1861
  });
1625
1862
  const extra = (argv.print ?? "").trim();
1626
1863
  const prompt = buildImportSeedPrompt(process.cwd(), machineOsFromPlatform(process.platform)) + (extra ? `\n\nAdditional instructions: ${extra}` : "");
1627
- const { runPrint } = await import("./print-BzjQA_4s.mjs");
1864
+ const { runPrint } = await import("./print-Bovyirht.mjs");
1628
1865
  try {
1629
1866
  const result = await runPrint({
1630
1867
  appUrl,
@@ -1652,7 +1889,9 @@ const listCommand$5 = {
1652
1889
  command: "list",
1653
1890
  describe: "List API keys for an agent",
1654
1891
  handler: async (argv) => {
1655
- const result = await requireManagementClient(argv).listKeys(argv["agent-id"]);
1892
+ const client = requireManagementClient(argv);
1893
+ const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
1894
+ const result = await client.listKeys(agentId);
1656
1895
  if (result.isErr()) {
1657
1896
  printError(result.error.message);
1658
1897
  process.exit(1);
@@ -1688,7 +1927,9 @@ const createCommand = {
1688
1927
  describe: "Key name"
1689
1928
  }),
1690
1929
  handler: async (argv) => {
1691
- const result = await requireManagementClient(argv).createKey(argv["agent-id"], argv.name);
1930
+ const client = requireManagementClient(argv);
1931
+ const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
1932
+ const result = await client.createKey(agentId, argv.name);
1692
1933
  if (result.isErr()) {
1693
1934
  printError(result.error.message);
1694
1935
  process.exit(1);
@@ -1718,7 +1959,9 @@ const revokeCommand$1 = {
1718
1959
  describe: "Key ID"
1719
1960
  }),
1720
1961
  handler: async (argv) => {
1721
- const result = await requireManagementClient(argv).revokeKey(argv["agent-id"], argv.id);
1962
+ const client = requireManagementClient(argv);
1963
+ const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
1964
+ const result = await client.revokeKey(agentId, argv.id);
1722
1965
  if (result.isErr()) {
1723
1966
  printError(result.error.message);
1724
1967
  process.exit(1);
@@ -1733,10 +1976,12 @@ const revokeCommand$1 = {
1733
1976
  const keysCommand = {
1734
1977
  command: "keys",
1735
1978
  describe: "Manage API keys for an agent",
1736
- builder: (y) => y.option("agent-id", {
1979
+ builder: (y) => y.option("agent", {
1737
1980
  type: "string",
1738
- demandOption: true,
1739
- describe: "Agent ID"
1981
+ describe: "Target agent, by id or name (e.g. --agent my-agent)"
1982
+ }).option("agent-id", {
1983
+ type: "string",
1984
+ describe: "Target agent id (legacy; prefer --agent)"
1740
1985
  }).command(listCommand$5).command(createCommand).command(revokeCommand$1).demandCommand(1, "Specify a subcommand: list, create, revoke"),
1741
1986
  handler: () => {}
1742
1987
  };
@@ -1753,7 +1998,9 @@ const listCommand$4 = {
1753
1998
  command: "list",
1754
1999
  describe: "List secret names for an agent (values are never shown)",
1755
2000
  handler: async (argv) => {
1756
- const result = await requireManagementClient(argv).listSecrets(argv["agent-id"]);
2001
+ const client = requireManagementClient(argv);
2002
+ const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
2003
+ const result = await client.listSecrets(agentId);
1757
2004
  if (result.isErr()) {
1758
2005
  printError(result.error.message);
1759
2006
  process.exit(1);
@@ -1794,7 +2041,9 @@ const setCommand$1 = {
1794
2041
  printError("Empty secret value.");
1795
2042
  process.exit(1);
1796
2043
  }
1797
- const result = await requireManagementClient(argv).setSecret(argv["agent-id"], argv.key, value);
2044
+ const client = requireManagementClient(argv);
2045
+ const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
2046
+ const result = await client.setSecret(agentId, argv.key, value);
1798
2047
  if (result.isErr()) {
1799
2048
  printError(result.error.message);
1800
2049
  process.exit(1);
@@ -1816,7 +2065,9 @@ const rmCommand = {
1816
2065
  describe: "Secret name"
1817
2066
  }),
1818
2067
  handler: async (argv) => {
1819
- const result = await requireManagementClient(argv).deleteSecret(argv["agent-id"], argv.key);
2068
+ const client = requireManagementClient(argv);
2069
+ const agentId = await resolveTargetAgentId(client, argv.agent ?? argv["agent-id"]);
2070
+ const result = await client.deleteSecret(agentId, argv.key);
1820
2071
  if (result.isErr()) {
1821
2072
  printError(result.error.message);
1822
2073
  process.exit(1);
@@ -1831,10 +2082,12 @@ const rmCommand = {
1831
2082
  const secretsCommand = {
1832
2083
  command: "secrets",
1833
2084
  describe: "Manage an agent’s secrets",
1834
- builder: (y) => y.option("agent-id", {
2085
+ builder: (y) => y.option("agent", {
1835
2086
  type: "string",
1836
- demandOption: true,
1837
- describe: "Agent ID"
2087
+ describe: "Target agent, by id or name (e.g. --agent my-agent)"
2088
+ }).option("agent-id", {
2089
+ type: "string",
2090
+ describe: "Target agent id (legacy; prefer --agent)"
1838
2091
  }).command(listCommand$4).command(setCommand$1).command(rmCommand).demandCommand(1, "Specify a subcommand: list, set, rm"),
1839
2092
  handler: () => {}
1840
2093
  };
@@ -2031,7 +2284,7 @@ const chatCommand = {
2031
2284
  sessionToken: auth.value.token,
2032
2285
  agentSelector: argv.agent ?? null
2033
2286
  });
2034
- const { runChat } = await import("./boot-FnZU62YK.mjs");
2287
+ const { runChat } = await import("./boot-Dzf7JWwL.mjs");
2035
2288
  await runChat({
2036
2289
  appUrl: auth.value.appUrl,
2037
2290
  sessionToken: auth.value.token,
@@ -2115,7 +2368,7 @@ async function runPrintMode({ argv, appUrl }) {
2115
2368
  printError(`${auth.error.message} For non-interactive use, run \`skydive auth login\` first, or set SKYDIVE_API_KEY / SKYDIVE_SESSION_TOKEN.`);
2116
2369
  process.exit(1);
2117
2370
  }
2118
- const { runPrint, readStdin } = await import("./print-BzjQA_4s.mjs");
2371
+ const { runPrint, readStdin } = await import("./print-Bovyirht.mjs");
2119
2372
  const workspaceId = await resolveWorkspaceFlag({
2120
2373
  appUrl,
2121
2374
  sessionToken: auth.value.token,
@@ -2145,7 +2398,7 @@ async function runPrintMode({ argv, appUrl }) {
2145
2398
  process.exit(1);
2146
2399
  }
2147
2400
  } else {
2148
- const { connectMachineShare } = await import("./print-share-Tdu4xDgY.mjs");
2401
+ const { connectMachineShare } = await import("./print-share-BvFDVwGW.mjs");
2149
2402
  machineShare = await connectMachineShare({
2150
2403
  appUrl: auth.value.appUrl,
2151
2404
  sessionToken: auth.value.token,
@@ -2210,7 +2463,7 @@ const getCommand$1 = {
2210
2463
  printError(`${auth.error.message} Run \`skydive auth login\` first, or set SKYDIVE_API_KEY / SKYDIVE_SESSION_TOKEN.`);
2211
2464
  process.exit(1);
2212
2465
  }
2213
- const { messageGet } = await import("./print-BzjQA_4s.mjs");
2466
+ const { messageGet } = await import("./print-Bovyirht.mjs");
2214
2467
  try {
2215
2468
  const result = await messageGet({
2216
2469
  appUrl: auth.value.appUrl,
@@ -2413,7 +2666,7 @@ const switchCommand = {
2413
2666
  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
2667
  process.exit(1);
2415
2668
  }
2416
- const { runWorkspacePicker } = await import("./boot-FnZU62YK.mjs");
2669
+ const { runWorkspacePicker } = await import("./boot-Dzf7JWwL.mjs");
2417
2670
  await runWorkspacePicker(session);
2418
2671
  return;
2419
2672
  }
@@ -2492,7 +2745,7 @@ const openCommand = {
2492
2745
  const agent = argv.agent ? resolveAgent$1((await fetchPortalDevices(session)).agents, argv.agent) : null;
2493
2746
  const cwd = argv.cwd ? path.resolve(argv.cwd) : process.cwd();
2494
2747
  const { machineName } = await resolveMachineIdentity(null);
2495
- const { PortalDaemonClient } = await import("./daemon-client-D83lfklG.mjs");
2748
+ const { PortalDaemonClient } = await import("./daemon-client-Dk5z9CfF.mjs");
2496
2749
  let lastLine = "";
2497
2750
  let signalConnected;
2498
2751
  const connected = new Promise((resolve) => {
@@ -2846,11 +3099,14 @@ const sandboxCommand = {
2846
3099
  type: "string",
2847
3100
  array: true,
2848
3101
  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."
3102
+ }).option("timeout", {
3103
+ type: "number",
3104
+ describe: "One-shot commands: kill the command after this many seconds. Without it the server default (~10 min) applies."
2849
3105
  }).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
3106
  handler: async (argv) => {
2851
3107
  const session = requireSession(argv);
2852
- const { createRestClient } = await import("./rest-BYNvZw3f.mjs");
2853
- const { resolveAgent } = await import("./print-BzjQA_4s.mjs");
3108
+ const { createRestClient } = await import("./rest-ANsrfO_h.mjs");
3109
+ const { resolveAgent } = await import("./print-Bovyirht.mjs");
2854
3110
  const client = createRestClient({
2855
3111
  appUrl: session.appUrl,
2856
3112
  sessionToken: session.sessionToken
@@ -2866,10 +3122,20 @@ const sandboxCommand = {
2866
3122
  process.exit(1);
2867
3123
  }
2868
3124
  const command = joinCommandWords([...argv.command ?? [], ...argv["--"] ?? []]);
3125
+ if (argv.timeout !== void 0 && !command) {
3126
+ printError("--timeout applies to a one-shot command; pass one after `--`.");
3127
+ process.exit(1);
3128
+ }
3129
+ if (argv.timeout !== void 0 && (!Number.isFinite(argv.timeout) || argv.timeout <= 0)) {
3130
+ printError("--timeout must be a positive number of seconds.");
3131
+ process.exit(1);
3132
+ }
3133
+ const timeoutMs = argv.timeout !== void 0 ? Math.round(argv.timeout * 1e3) : void 0;
2869
3134
  const code = command ? await runExec({
2870
3135
  session,
2871
3136
  agentId: agent.id,
2872
- command
3137
+ command,
3138
+ timeoutMs
2873
3139
  }) : await runPty({
2874
3140
  session,
2875
3141
  agentId: agent.id,
@@ -2879,18 +3145,19 @@ const sandboxCommand = {
2879
3145
  }
2880
3146
  };
2881
3147
  /** One-shot exec: stream output to stdout, resolve to the command's exit code. */
2882
- function runExec({ session, agentId, command }) {
3148
+ function runExec({ session, agentId, command, timeoutMs }) {
2883
3149
  console.error("Connecting to the sandbox…");
2884
3150
  return new Promise((resolve) => {
2885
3151
  const finish = (code) => {
2886
3152
  process.stdout.write("", () => resolve(code));
2887
3153
  };
2888
- SandboxStream.open({
3154
+ const stream = SandboxStream.open({
2889
3155
  mode: "exec",
2890
3156
  appUrl: session.appUrl,
2891
3157
  sessionToken: session.sessionToken,
2892
3158
  agentId,
2893
3159
  command,
3160
+ ...timeoutMs !== void 0 ? { timeoutMs } : {},
2894
3161
  onEvent: (e) => {
2895
3162
  switch (e.type) {
2896
3163
  case "data":
@@ -2908,10 +3175,45 @@ function runExec({ session, agentId, command }) {
2908
3175
  finish(1);
2909
3176
  break;
2910
3177
  }
3178
+ stopStdinForwarding();
2911
3179
  }
2912
3180
  });
3181
+ forwardStdinToStream({
3182
+ stdin: process.stdin,
3183
+ stream
3184
+ });
2913
3185
  });
2914
3186
  }
3187
+ const STDIN_EOF_INPUT = new Uint8Array(0);
3188
+ let forwardingStdin = null;
3189
+ /**
3190
+ * Forward the caller's stdin into the sandbox stream as INPUT frames (one per
3191
+ * stdin chunk; an empty payload marks end-of-stdin so the remote command gets
3192
+ * a real EOF — `sh -c 'cat > file'` finishes instead of hanging). Nothing is
3193
+ * forwarded when stdin is already closed (no pipe, nothing piped in), which
3194
+ * keeps the plain scripted case exactly where it was.
3195
+ */
3196
+ function forwardStdinToStream({ stdin, stream }) {
3197
+ if (stdin.readableEnded || stdin.destroyed) return;
3198
+ const onData = (chunk) => stream.sendInput(new Uint8Array(chunk));
3199
+ const onEnd = () => stream.sendInput(STDIN_EOF_INPUT);
3200
+ forwardingStdin = {
3201
+ stdin,
3202
+ onData,
3203
+ onEnd
3204
+ };
3205
+ stdin.on("data", onData);
3206
+ stdin.once("end", onEnd);
3207
+ stdin.resume();
3208
+ }
3209
+ /** Stop forwarding stdin (on a terminal stream event) without killing reads. */
3210
+ function stopStdinForwarding() {
3211
+ const current = forwardingStdin;
3212
+ if (!current) return;
3213
+ forwardingStdin = null;
3214
+ current.stdin.off("data", current.onData);
3215
+ current.stdin.off("end", current.onEnd);
3216
+ }
2915
3217
  /** Live terminal on the caller's real TTY. */
2916
3218
  async function runPty({ session, agentId, agentName }) {
2917
3219
  if (!process.stdin.isTTY || !process.stdout.isTTY) {
@@ -2919,7 +3221,7 @@ async function runPty({ session, agentId, agentName }) {
2919
3221
  return 1;
2920
3222
  }
2921
3223
  console.error(`Connecting to ${agentName}'s sandbox… (Ctrl-] detaches)`);
2922
- const { runRawPtyPassthrough } = await import("./raw-pty-DRZuf1oW.mjs");
3224
+ const { runRawPtyPassthrough } = await import("./raw-pty-WUHQQwTF.mjs");
2923
3225
  const result = await runRawPtyPassthrough({
2924
3226
  stdin: process.stdin,
2925
3227
  stdout: process.stdout,
@@ -3121,8 +3423,8 @@ const fsEditCommand = {
3121
3423
  handler: async (argv) => {
3122
3424
  const session = requireSession(argv);
3123
3425
  const remotePath = argv.path;
3124
- const { createRestClient } = await import("./rest-BYNvZw3f.mjs");
3125
- const { resolveAgent } = await import("./print-BzjQA_4s.mjs");
3426
+ const { createRestClient } = await import("./rest-ANsrfO_h.mjs");
3427
+ const { resolveAgent } = await import("./print-Bovyirht.mjs");
3126
3428
  const client = createRestClient({
3127
3429
  appUrl: session.appUrl,
3128
3430
  sessionToken: session.sessionToken
@@ -4433,7 +4735,7 @@ function setupUpdateCheck(argv) {
4433
4735
 
4434
4736
  //#endregion
4435
4737
  //#region src/changelog.generated.ts
4436
- 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";
4738
+ 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- `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## [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";
4437
4739
 
4438
4740
  //#endregion
4439
4741
  //#region src/whats-new.ts
@@ -4576,7 +4878,7 @@ if (process.argv.includes(UPDATE_WORKER_FLAG)) {
4576
4878
  process.exit(0);
4577
4879
  }
4578
4880
  if (process.argv.includes(PORTAL_DAEMON_FLAG)) {
4579
- const { runPortalDaemon } = await import("./daemon-DbtMlkm5.mjs");
4881
+ const { runPortalDaemon } = await import("./daemon-Cw1GI6jv.mjs");
4580
4882
  runPortalDaemon(process.argv);
4581
4883
  } else runCli();
4582
4884
  function runCli() {