skydive-cli 0.5.0-beta.31 → 0.5.0-beta.33

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.
Files changed (36) hide show
  1. package/README.md +20 -0
  2. package/dist/js/api-DQCaztBg.mjs +315 -0
  3. package/dist/js/{billing-blocked-Dgu5-oDy.mjs → billing-blocked-SE6tySLd.mjs} +1 -1
  4. package/dist/js/bin.mjs +214 -50
  5. package/dist/js/{boot-iaVSnd7h.mjs → boot-C5HJfwRS.mjs} +17 -14
  6. package/dist/js/chunk-BbwQpWto.mjs +33 -0
  7. package/dist/js/{client-DbqRBquD.mjs → client-d6K9qm6B.mjs} +70 -2
  8. package/dist/js/client-yz3zrpAS.mjs +5 -0
  9. package/dist/js/{daemon-BTyg329O.mjs → daemon-BPGZufS1.mjs} +4 -2
  10. package/dist/js/daemon-WQ8QYrFt.mjs +7 -0
  11. package/dist/js/daemon-client-DTfIza0O.mjs +8 -0
  12. package/dist/js/{daemon-client--A_yMKq6.mjs → daemon-client-MpAGVkqP.mjs} +1 -1
  13. package/dist/js/dist-CRtjM7ba.mjs +1750 -0
  14. package/dist/js/{forward-DL6DYqyc.mjs → forward-zwB55Bls.mjs} +25 -4
  15. package/dist/js/{profiler-BVbYs_Yg.mjs → install-BPUAm8bS.mjs} +274 -210
  16. package/dist/js/localhost-cert-Bn-UBUmj.mjs +67 -0
  17. package/dist/js/{print-DACzRUwQ.mjs → print-B9djx8GU.mjs} +3 -3
  18. package/dist/js/{print-C_TnQSPg.mjs → print-Clgq46GU.mjs} +3 -3
  19. package/dist/js/{print-share-BH9gvCls.mjs → print-share-BBy3OTno.mjs} +6 -2
  20. package/dist/js/{raw-pty-DY4KelZW.mjs → raw-pty-B9Bue8gg.mjs} +1 -1
  21. package/dist/js/raw-pty-g3kATVQe.mjs +5 -0
  22. package/dist/js/{rest-CgfbKXst.mjs → rest-C6E4mS2A.mjs} +2 -2
  23. package/dist/js/rest-CaWUSrnH.mjs +6 -0
  24. package/dist/js/tls-cert-CLgSQALB.mjs +4 -0
  25. package/dist/js/tls-cert-CV-pwxVN.mjs +67 -0
  26. package/package.json +1 -1
  27. package/dist/js/api-DG5W6iwx.mjs +0 -131
  28. package/dist/js/client-hH2PJL8y.mjs +0 -5
  29. package/dist/js/daemon-SPQgtsbW.mjs +0 -6
  30. package/dist/js/daemon-client-C7emKKlj.mjs +0 -7
  31. package/dist/js/raw-pty-DmdUf4_w.mjs +0 -5
  32. package/dist/js/rest-VV5nc-Mn.mjs +0 -6
  33. /package/dist/js/{billing-blocked-2wju4gC_.mjs → billing-blocked-D3l5kJlX.mjs} +0 -0
  34. /package/dist/js/{client-c4c5MmgN.mjs → client-BTQ1fwzM.mjs} +0 -0
  35. /package/dist/js/{http-error-DzyrsLAZ.mjs → http-error-UHH3mVBF.mjs} +0 -0
  36. /package/dist/js/{output-DYzzdXYV.mjs → output-wY0VQDea.mjs} +0 -0
package/dist/js/bin.mjs CHANGED
@@ -1,14 +1,15 @@
1
1
  #!/usr/bin/env node
2
- import { A as takenAliasNames, B as name, D as dedupeAliasName, E as aliasActivationHint, F as getActiveWorkspaceId, I as getSessionIdentity, L as listWorkspaces, M as defaultInstallEnv, N as detectShell, O as installAgentAlias, P as ensureActiveOrganization, R as resolveWorkspaceId, S as themes, T as machineOsFromPlatform, V as version, a as installCrashHandler, j as SUPPORTED_SHELLS, k as slugifyAliasName, t as maybeStartProfiling, u as brandHelpArt, w as buildImportSeedPrompt, z as setActiveWorkspace } from "./profiler-BVbYs_Yg.mjs";
3
- import { A as getShareMachineDefault, C as getConfigPath, D as getPromptHistoryPath, E as getPreference, F as resolveAppUrl, H as saveSession, I as resolveChatAuth, L as resolveConfig, M as getStoredApiKeyWorkspaceName, N as getUpdateCheckDisabled, R as resolveManagementAuth, S as deleteConfig, T as getLastSeenVersion, V as saveConfig, W as setLastSeenVersion, _ as API_KEY_FAMILY_PREFIX, g as API_KEYS_URL, i as resolveAgent$1, j as getStoredApiKeyId, v as API_KEY_PREFIX, w as getDefaultAgent, x as PREFERENCES, y as DEFAULT_API_URL, z as resolveSession } from "./print-C_TnQSPg.mjs";
4
- import { n as printError, r as printTable, t as output } from "./output-DYzzdXYV.mjs";
5
- import { t as HttpError } from "./http-error-DzyrsLAZ.mjs";
6
- import { t as createRestClient } from "./rest-CgfbKXst.mjs";
7
- import "./billing-blocked-2wju4gC_.mjs";
8
- import { r as resolveMachineIdentity } from "./client-DbqRBquD.mjs";
9
- import { i as queryDaemonStatus, l as PORTAL_DAEMON_FLAG, n as ensureDaemonRunning, s as stopDaemon, u as daemonPaths } from "./daemon-BTyg329O.mjs";
10
- import { i as grantPortalAccess, n as fetchPortalDevices, o as registerPortalDevice, r as findThisDevice, s as revokePortalAccess } from "./api-DG5W6iwx.mjs";
11
- import { t as SandboxStream } from "./client-c4c5MmgN.mjs";
2
+ import { A as installAgentAlias, B as resolveWorkspaceId, D as machineOsFromPlatform, E as buildImportSeedPrompt, F as detectShell, H as name, I as ensureActiveOrganization, L as getActiveWorkspaceId, M as takenAliasNames, N as SUPPORTED_SHELLS, O as aliasActivationHint, P as defaultInstallEnv, R as getSessionIdentity, U as version, 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-BPUAm8bS.mjs";
3
+ import { A as getShareMachineDefault, C as getConfigPath, D as getPromptHistoryPath, E as getPreference, F as resolveAppUrl, H as saveSession, I as resolveChatAuth, L as resolveConfig, M as getStoredApiKeyWorkspaceName, N as getUpdateCheckDisabled, R as resolveManagementAuth, S as deleteConfig, T as getLastSeenVersion, V as saveConfig, W as setLastSeenVersion, _ as API_KEY_FAMILY_PREFIX, g as API_KEYS_URL, i as resolveAgent$1, j as getStoredApiKeyId, v as API_KEY_PREFIX, w as getDefaultAgent, x as PREFERENCES, y as DEFAULT_API_URL, z as resolveSession$1 } from "./print-Clgq46GU.mjs";
4
+ import { n as printError, r as printTable, t as output } from "./output-wY0VQDea.mjs";
5
+ import { t as HttpError } from "./http-error-UHH3mVBF.mjs";
6
+ import { t as createRestClient } from "./rest-C6E4mS2A.mjs";
7
+ import "./billing-blocked-D3l5kJlX.mjs";
8
+ import { r as resolveMachineIdentity } from "./client-d6K9qm6B.mjs";
9
+ import { i as queryDaemonStatus, l as PORTAL_DAEMON_FLAG, n as ensureDaemonRunning, s as stopDaemon, u as daemonPaths } from "./daemon-BPGZufS1.mjs";
10
+ import "./tls-cert-CV-pwxVN.mjs";
11
+ import { i as grantPortalAccess, n as fetchPortalDevices, o as registerPortalDevice, r as findThisDevice, s as revokePortalAccess } from "./api-DQCaztBg.mjs";
12
+ import { t as SandboxStream } from "./client-BTQ1fwzM.mjs";
12
13
  import { hideBin } from "yargs/helpers";
13
14
  import yargs from "yargs";
14
15
  import { hostname, tmpdir } from "node:os";
@@ -24,6 +25,7 @@ import fsp, { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
24
25
  import { quote } from "shell-quote";
25
26
  import semver from "semver";
26
27
  import { createInterface } from "node:readline";
28
+ import { createInterface as createInterface$1 } from "node:readline/promises";
27
29
 
28
30
  //#region src/types.ts
29
31
  const NON_INTERACTIVE_ENV_VARS = [
@@ -619,7 +621,7 @@ const logoutCommand = {
619
621
  const keyId = getStoredApiKeyId();
620
622
  let keyRevoked = false;
621
623
  if (keyId) {
622
- const session = resolveSession({ appUrl: argv["api-url"] });
624
+ const session = resolveSession$1({ appUrl: argv["api-url"] });
623
625
  const config = resolveConfig({ apiUrl: argv["api-url"] });
624
626
  const credential = session.isOk() ? {
625
627
  appUrl: session.value.appUrl,
@@ -650,7 +652,7 @@ const statusCommand$1 = {
650
652
  describe: "Show current authentication state",
651
653
  handler: async (argv) => {
652
654
  const apiKey = resolveConfig({ apiUrl: argv["api-url"] });
653
- const session = resolveSession({});
655
+ const session = resolveSession$1({});
654
656
  const management = resolveManagementAuth({ apiUrl: argv["api-url"] });
655
657
  const identity = session.isOk() ? (await getSessionIdentity({
656
658
  appUrl: session.value.appUrl,
@@ -1000,7 +1002,7 @@ const completionCommand = {
1000
1002
  * resolve-or-exit block isn't copy-pasted per command.
1001
1003
  */
1002
1004
  function requireSession(argv) {
1003
- const session = resolveSession({ appUrl: resolveAppUrl({ appUrl: argv["api-url"] }) });
1005
+ const session = resolveSession$1({ appUrl: resolveAppUrl({ appUrl: argv["api-url"] }) });
1004
1006
  if (session.isErr()) {
1005
1007
  printError(`${session.error.message} Run \`skydive auth login\` first, or set SKYDIVE_SESSION_TOKEN.`);
1006
1008
  process.exit(1);
@@ -1065,7 +1067,7 @@ async function resolveAgent(client, selector) {
1065
1067
  if (matches.length === 0) throw new Error(`No agent named "${selector}". Pass an id, or run \`skydive agents list\`.`);
1066
1068
  throw new Error(`Multiple agents named "${selector}". Pass the id instead:\n${matches.map((a) => ` ${a.name} ${a.id}`).join("\n")}`);
1067
1069
  }
1068
- const listCommand$5 = {
1070
+ const listCommand$6 = {
1069
1071
  command: "list",
1070
1072
  describe: "List agents in the active workspace",
1071
1073
  builder: (y) => y.option("limit", {
@@ -1289,7 +1291,7 @@ const aliasCommand = {
1289
1291
  const agentsCommand = {
1290
1292
  command: "agents",
1291
1293
  describe: "Manage agents",
1292
- builder: (y) => y.command(listCommand$5).command(getCommand$2).command(createCommand$1).command(aliasCommand).demandCommand(1, "Specify a subcommand: list, get, create, alias"),
1294
+ builder: (y) => y.command(listCommand$6).command(getCommand$2).command(createCommand$1).command(aliasCommand).demandCommand(1, "Specify a subcommand: list, get, create, alias"),
1293
1295
  handler: () => {}
1294
1296
  };
1295
1297
 
@@ -1571,20 +1573,20 @@ const importCommand = {
1571
1573
  printError(`import needs the Bun runtime and it couldn't be set up automatically. Install Bun (https://bun.sh) and run \`bun ${process.argv[1] ?? "skydive"} import\`, point SKYDIVE_BUN_PATH at an existing bun binary, or use the non-interactive \`import -p\` (runs under Node).`);
1572
1574
  process.exit(1);
1573
1575
  }
1574
- let session = resolveSession({ appUrl });
1576
+ let session = resolveSession$1({ appUrl });
1575
1577
  if (session.isErr()) {
1576
1578
  const login = await loginWithDevice({ appUrl });
1577
1579
  if (login.isErr()) {
1578
1580
  printError(login.error.message);
1579
1581
  process.exit(1);
1580
1582
  }
1581
- session = resolveSession({ appUrl });
1583
+ session = resolveSession$1({ appUrl });
1582
1584
  if (session.isErr()) {
1583
1585
  printError("Signed in, but no session was stored.");
1584
1586
  process.exit(1);
1585
1587
  }
1586
1588
  }
1587
- const { runChat } = await import("./boot-iaVSnd7h.mjs");
1589
+ const { runChat } = await import("./boot-C5HJfwRS.mjs");
1588
1590
  await runChat({
1589
1591
  appUrl,
1590
1592
  sessionToken: session.value.sessionToken,
@@ -1609,12 +1611,12 @@ const importCommand = {
1609
1611
  * (`chat -p "go ahead" --resume <id> --share-machine`) to apply it.
1610
1612
  */
1611
1613
  async function runImportPrintMode({ argv, appUrl }) {
1612
- const session = resolveSession({ appUrl });
1614
+ const session = resolveSession$1({ appUrl });
1613
1615
  if (session.isErr()) {
1614
1616
  printError(`${session.error.message} For non-interactive use, run \`skydive auth login --web\` first, or set SKYDIVE_SESSION_TOKEN.`);
1615
1617
  process.exit(1);
1616
1618
  }
1617
- const { connectMachineShare } = await import("./print-share-BH9gvCls.mjs");
1619
+ const { connectMachineShare } = await import("./print-share-BBy3OTno.mjs");
1618
1620
  const machineShare = await connectMachineShare({
1619
1621
  appUrl,
1620
1622
  sessionToken: session.value.sessionToken,
@@ -1622,7 +1624,7 @@ async function runImportPrintMode({ argv, appUrl }) {
1622
1624
  });
1623
1625
  const extra = (argv.print ?? "").trim();
1624
1626
  const prompt = buildImportSeedPrompt(process.cwd(), machineOsFromPlatform(process.platform)) + (extra ? `\n\nAdditional instructions: ${extra}` : "");
1625
- const { runPrint } = await import("./print-DACzRUwQ.mjs");
1627
+ const { runPrint } = await import("./print-B9djx8GU.mjs");
1626
1628
  try {
1627
1629
  const result = await runPrint({
1628
1630
  appUrl,
@@ -1646,7 +1648,7 @@ async function runImportPrintMode({ argv, appUrl }) {
1646
1648
 
1647
1649
  //#endregion
1648
1650
  //#region src/commands/keys.ts
1649
- const listCommand$4 = {
1651
+ const listCommand$5 = {
1650
1652
  command: "list",
1651
1653
  describe: "List API keys for an agent",
1652
1654
  handler: async (argv) => {
@@ -1735,7 +1737,7 @@ const keysCommand = {
1735
1737
  type: "string",
1736
1738
  demandOption: true,
1737
1739
  describe: "Agent ID"
1738
- }).command(listCommand$4).command(createCommand).command(revokeCommand$1).demandCommand(1, "Specify a subcommand: list, create, revoke"),
1740
+ }).command(listCommand$5).command(createCommand).command(revokeCommand$1).demandCommand(1, "Specify a subcommand: list, create, revoke"),
1739
1741
  handler: () => {}
1740
1742
  };
1741
1743
 
@@ -1747,7 +1749,7 @@ async function readStdin() {
1747
1749
  for await (const chunk of process.stdin) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
1748
1750
  return Buffer.concat(chunks).toString("utf8").replace(/\n$/, "");
1749
1751
  }
1750
- const listCommand$3 = {
1752
+ const listCommand$4 = {
1751
1753
  command: "list",
1752
1754
  describe: "List secret names for an agent (values are never shown)",
1753
1755
  handler: async (argv) => {
@@ -1833,7 +1835,7 @@ const secretsCommand = {
1833
1835
  type: "string",
1834
1836
  demandOption: true,
1835
1837
  describe: "Agent ID"
1836
- }).command(listCommand$3).command(setCommand$1).command(rmCommand).demandCommand(1, "Specify a subcommand: list, set, rm"),
1838
+ }).command(listCommand$4).command(setCommand$1).command(rmCommand).demandCommand(1, "Specify a subcommand: list, set, rm"),
1837
1839
  handler: () => {}
1838
1840
  };
1839
1841
 
@@ -2029,7 +2031,7 @@ const chatCommand = {
2029
2031
  sessionToken: auth.value.token,
2030
2032
  agentSelector: argv.agent ?? null
2031
2033
  });
2032
- const { runChat } = await import("./boot-iaVSnd7h.mjs");
2034
+ const { runChat } = await import("./boot-C5HJfwRS.mjs");
2033
2035
  await runChat({
2034
2036
  appUrl: auth.value.appUrl,
2035
2037
  sessionToken: auth.value.token,
@@ -2113,7 +2115,7 @@ async function runPrintMode({ argv, appUrl }) {
2113
2115
  printError(`${auth.error.message} For non-interactive use, run \`skydive auth login\` first, or set SKYDIVE_API_KEY / SKYDIVE_SESSION_TOKEN.`);
2114
2116
  process.exit(1);
2115
2117
  }
2116
- const { runPrint, readStdin } = await import("./print-DACzRUwQ.mjs");
2118
+ const { runPrint, readStdin } = await import("./print-B9djx8GU.mjs");
2117
2119
  const workspaceId = await resolveWorkspaceFlag({
2118
2120
  appUrl,
2119
2121
  sessionToken: auth.value.token,
@@ -2143,7 +2145,7 @@ async function runPrintMode({ argv, appUrl }) {
2143
2145
  process.exit(1);
2144
2146
  }
2145
2147
  } else {
2146
- const { connectMachineShare } = await import("./print-share-BH9gvCls.mjs");
2148
+ const { connectMachineShare } = await import("./print-share-BBy3OTno.mjs");
2147
2149
  machineShare = await connectMachineShare({
2148
2150
  appUrl: auth.value.appUrl,
2149
2151
  sessionToken: auth.value.token,
@@ -2164,7 +2166,7 @@ async function runPrintMode({ argv, appUrl }) {
2164
2166
  });
2165
2167
  if (argv.json) output(argv, result);
2166
2168
  } catch (error) {
2167
- const { BillingBlockedError, BILLING_BLOCKED_EXIT_CODE, billingBlockedJsonResult } = await import("./billing-blocked-Dgu5-oDy.mjs");
2169
+ const { BillingBlockedError, BILLING_BLOCKED_EXIT_CODE, billingBlockedJsonResult } = await import("./billing-blocked-SE6tySLd.mjs");
2168
2170
  if (error instanceof BillingBlockedError) {
2169
2171
  if (argv.json) output(argv, billingBlockedJsonResult(error, null));
2170
2172
  printError(error.message);
@@ -2208,7 +2210,7 @@ const getCommand$1 = {
2208
2210
  printError(`${auth.error.message} Run \`skydive auth login\` first, or set SKYDIVE_API_KEY / SKYDIVE_SESSION_TOKEN.`);
2209
2211
  process.exit(1);
2210
2212
  }
2211
- const { messageGet } = await import("./print-DACzRUwQ.mjs");
2213
+ const { messageGet } = await import("./print-B9djx8GU.mjs");
2212
2214
  try {
2213
2215
  const result = await messageGet({
2214
2216
  appUrl: auth.value.appUrl,
@@ -2218,7 +2220,7 @@ const getCommand$1 = {
2218
2220
  });
2219
2221
  if (argv.json) output(argv, result);
2220
2222
  } catch (error) {
2221
- const { BillingBlockedError, BILLING_BLOCKED_EXIT_CODE, billingBlockedJsonResult } = await import("./billing-blocked-Dgu5-oDy.mjs");
2223
+ const { BillingBlockedError, BILLING_BLOCKED_EXIT_CODE, billingBlockedJsonResult } = await import("./billing-blocked-SE6tySLd.mjs");
2222
2224
  if (error instanceof BillingBlockedError) {
2223
2225
  if (argv.json) output(argv, billingBlockedJsonResult(error, argv["message-id"]));
2224
2226
  printError(error.message);
@@ -2255,7 +2257,7 @@ function messageToText(message) {
2255
2257
  }
2256
2258
  return chunks.join("\n").trim();
2257
2259
  }
2258
- const listCommand$2 = {
2260
+ const listCommand$3 = {
2259
2261
  command: "list",
2260
2262
  describe: "List an agent's conversations",
2261
2263
  builder: (y) => y.option("agent", {
@@ -2345,7 +2347,7 @@ const conversationsCommand = {
2345
2347
  command: "conversations",
2346
2348
  aliases: ["conv"],
2347
2349
  describe: "List and read agent conversations",
2348
- builder: (y) => y.command(listCommand$2).command(showCommand).demandCommand(1, "Specify a subcommand: list, show"),
2350
+ builder: (y) => y.command(listCommand$3).command(showCommand).demandCommand(1, "Specify a subcommand: list, show"),
2349
2351
  handler: () => {}
2350
2352
  };
2351
2353
 
@@ -2387,7 +2389,7 @@ async function runList(argv, { hint }) {
2387
2389
  ]));
2388
2390
  if (hint && !argv.quiet) console.log("\nRun `skydive workspace switch` to pick a workspace, or pass its slug directly.");
2389
2391
  }
2390
- const listCommand$1 = {
2392
+ const listCommand$2 = {
2391
2393
  command: "list",
2392
2394
  describe: "List workspaces on your account",
2393
2395
  handler: (argv) => runList(argv, { hint: false })
@@ -2411,7 +2413,7 @@ const switchCommand = {
2411
2413
  printError("The workspace picker needs the Bun runtime and it could not be set up automatically. Pass a workspace slug instead, or install Bun and retry.");
2412
2414
  process.exit(1);
2413
2415
  }
2414
- const { runWorkspacePicker } = await import("./boot-iaVSnd7h.mjs");
2416
+ const { runWorkspacePicker } = await import("./boot-C5HJfwRS.mjs");
2415
2417
  await runWorkspacePicker(session);
2416
2418
  return;
2417
2419
  }
@@ -2444,7 +2446,7 @@ const switchCommand = {
2444
2446
  const workspaceCommand = {
2445
2447
  command: "workspace",
2446
2448
  describe: "List or switch the workspace all `skydive` commands act on",
2447
- builder: (y) => y.command(listCommand$1).command(switchCommand),
2449
+ builder: (y) => y.command(listCommand$2).command(switchCommand),
2448
2450
  handler: (argv) => runList(argv, { hint: true })
2449
2451
  };
2450
2452
 
@@ -2490,7 +2492,7 @@ const openCommand = {
2490
2492
  const agent = argv.agent ? resolveAgent$1((await fetchPortalDevices(session)).agents, argv.agent) : null;
2491
2493
  const cwd = argv.cwd ? path.resolve(argv.cwd) : process.cwd();
2492
2494
  const { machineName } = await resolveMachineIdentity(null);
2493
- const { PortalDaemonClient } = await import("./daemon-client-C7emKKlj.mjs");
2495
+ const { PortalDaemonClient } = await import("./daemon-client-DTfIza0O.mjs");
2494
2496
  let lastLine = "";
2495
2497
  let signalConnected;
2496
2498
  const connected = new Promise((resolve) => {
@@ -2736,15 +2738,19 @@ const forwardCommand = {
2736
2738
  const agent = resolveAgent$1((await fetchPortalDevices(session)).agents, argv.agent ?? null);
2737
2739
  const targetPort = argv.port;
2738
2740
  const localPort = argv["local-port"] ?? targetPort;
2739
- const { startForward } = await import("./forward-DL6DYqyc.mjs");
2741
+ const { startForward } = await import("./forward-zwB55Bls.mjs");
2742
+ const { defaultTlsCertSource } = await import("./tls-cert-CLgSQALB.mjs");
2743
+ const log = (msg) => console.error(msg);
2740
2744
  const listener = await startForward({
2741
2745
  auth: session,
2742
2746
  agentId: agent.id,
2743
2747
  localPort,
2744
2748
  targetPort,
2745
- log: (msg) => console.error(msg)
2749
+ tlsCertSource: defaultTlsCertSource(process.env, log),
2750
+ log
2746
2751
  });
2747
2752
  console.log(`Forwarding http://localhost:${listener.port} -> ${agent.name}'s sandbox port ${targetPort}. ctrl+c to stop.`);
2753
+ if (listener.tls) console.log(` https://${listener.tls.hostname}:${listener.tls.port} (TLS — browsers negotiate HTTP/2 here, which loads module-heavy dev servers much faster)`);
2748
2754
  await new Promise((resolve) => {
2749
2755
  process.once("SIGINT", () => resolve());
2750
2756
  process.once("SIGTERM", () => resolve());
@@ -2800,8 +2806,8 @@ const sandboxCommand = {
2800
2806
  }).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`"),
2801
2807
  handler: async (argv) => {
2802
2808
  const session = requireSession(argv);
2803
- const { createRestClient } = await import("./rest-VV5nc-Mn.mjs");
2804
- const { resolveAgent } = await import("./print-DACzRUwQ.mjs");
2809
+ const { createRestClient } = await import("./rest-CaWUSrnH.mjs");
2810
+ const { resolveAgent } = await import("./print-B9djx8GU.mjs");
2805
2811
  const client = createRestClient({
2806
2812
  appUrl: session.appUrl,
2807
2813
  sessionToken: session.sessionToken
@@ -2870,7 +2876,7 @@ async function runPty({ session, agentId, agentName }) {
2870
2876
  return 1;
2871
2877
  }
2872
2878
  console.error(`Connecting to ${agentName}'s sandbox… (Ctrl-] detaches)`);
2873
- const { runRawPtyPassthrough } = await import("./raw-pty-DmdUf4_w.mjs");
2879
+ const { runRawPtyPassthrough } = await import("./raw-pty-g3kATVQe.mjs");
2874
2880
  const result = await runRawPtyPassthrough({
2875
2881
  stdin: process.stdin,
2876
2882
  stdout: process.stdout,
@@ -2958,8 +2964,8 @@ const fsEditCommand = {
2958
2964
  handler: async (argv) => {
2959
2965
  const session = requireSession(argv);
2960
2966
  const remotePath = argv.path;
2961
- const { createRestClient } = await import("./rest-VV5nc-Mn.mjs");
2962
- const { resolveAgent } = await import("./print-DACzRUwQ.mjs");
2967
+ const { createRestClient } = await import("./rest-CaWUSrnH.mjs");
2968
+ const { resolveAgent } = await import("./print-B9djx8GU.mjs");
2963
2969
  const client = createRestClient({
2964
2970
  appUrl: session.appUrl,
2965
2971
  sessionToken: session.sessionToken
@@ -3854,7 +3860,7 @@ function snapshot(pref) {
3854
3860
  describe: pref.describe
3855
3861
  };
3856
3862
  }
3857
- const listCommand = {
3863
+ const listCommand$1 = {
3858
3864
  command: "list",
3859
3865
  aliases: ["ls"],
3860
3866
  describe: "Show every editable preference, its value, and its source",
@@ -3945,7 +3951,7 @@ const unsetCommand = {
3945
3951
  }
3946
3952
  }
3947
3953
  };
3948
- const pathCommand = {
3954
+ const pathCommand$1 = {
3949
3955
  command: "path",
3950
3956
  describe: "Print the on-disk config file path",
3951
3957
  handler: (argv) => {
@@ -3959,14 +3965,172 @@ const pathCommand = {
3959
3965
  const configCommand = {
3960
3966
  command: "config",
3961
3967
  describe: "View and set CLI preferences (safe, hand-editable keys only)",
3962
- builder: (y) => y.command(listCommand).command(getCommand).command(setCommand).command(unsetCommand).command(pathCommand),
3968
+ builder: (y) => y.command(listCommand$1).command(getCommand).command(setCommand).command(unsetCommand).command(pathCommand$1),
3969
+ handler: (argv) => listCommand$1.handler(argv)
3970
+ };
3971
+
3972
+ //#endregion
3973
+ //#region src/commands/logs.ts
3974
+ const ISSUE_REPOSITORY_URL = "https://github.com/Create-Inc/skydive-cli";
3975
+ function issueUrl(archivePath) {
3976
+ const url = new URL(`${ISSUE_REPOSITORY_URL}/issues/new`);
3977
+ url.searchParams.set("title", "CLI issue: ");
3978
+ url.searchParams.set("body", [
3979
+ "## What happened?",
3980
+ "",
3981
+ "<!-- Tell us what you were doing and what went wrong. -->",
3982
+ "",
3983
+ "## Diagnostics",
3984
+ "",
3985
+ `Please attach \`${path.basename(archivePath)}\` to this issue.`
3986
+ ].join("\n"));
3987
+ return url.toString();
3988
+ }
3989
+ async function listLogSessions(activeSessionPath = profileDir()) {
3990
+ const root = getAutomaticLogsDir();
3991
+ try {
3992
+ const entries = await fs.promises.readdir(root, { withFileTypes: true });
3993
+ return (await Promise.all(entries.filter((entry) => entry.isDirectory() && path.join(root, entry.name) !== activeSessionPath).map(async (entry) => {
3994
+ const sessionPath = path.join(root, entry.name);
3995
+ return {
3996
+ name: entry.name,
3997
+ path: sessionPath,
3998
+ modifiedAt: (await fs.promises.stat(sessionPath)).mtime.toISOString()
3999
+ };
4000
+ }))).sort((a, b) => b.name.localeCompare(a.name));
4001
+ } catch (_error) {
4002
+ return [];
4003
+ }
4004
+ }
4005
+ async function resolveSession(name) {
4006
+ const sessions = await listLogSessions();
4007
+ const session = name ? sessions.find((candidate) => candidate.name === name) : sessions[0];
4008
+ if (session) return session;
4009
+ printError(name ? `Log session "${name}" was not found. Run \`skydive logs list\`.` : "No diagnostic logs found yet.");
4010
+ process.exit(1);
4011
+ }
4012
+ async function offerIssueReport(archivePath) {
4013
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
4014
+ console.log(`Report an issue: ${ISSUE_REPOSITORY_URL}`);
4015
+ return;
4016
+ }
4017
+ const prompt = createInterface$1({
4018
+ input: process.stdin,
4019
+ output: process.stdout
4020
+ });
4021
+ try {
4022
+ if ((await prompt.question("Open a prefilled GitHub issue in your browser? [Y/n] ")).trim().toLowerCase() === "n") {
4023
+ console.log(`File an issue: ${ISSUE_REPOSITORY_URL}`);
4024
+ return;
4025
+ }
4026
+ await open(issueUrl(archivePath));
4027
+ console.log(`Attach the diagnostics archive: ${archivePath}`);
4028
+ } finally {
4029
+ prompt.close();
4030
+ }
4031
+ }
4032
+ async function createArchive(source, destination) {
4033
+ await new Promise((resolve, reject) => {
4034
+ const child = spawn("tar", [
4035
+ "-czf",
4036
+ destination,
4037
+ "-C",
4038
+ path.dirname(source),
4039
+ path.basename(source)
4040
+ ], { stdio: [
4041
+ "ignore",
4042
+ "ignore",
4043
+ "pipe"
4044
+ ] });
4045
+ const stderr = [];
4046
+ child.stderr.on("data", (chunk) => stderr.push(chunk));
4047
+ child.once("error", reject);
4048
+ child.once("close", (code) => {
4049
+ if (code === 0) {
4050
+ resolve();
4051
+ return;
4052
+ }
4053
+ reject(new Error(Buffer.concat(stderr).toString("utf8").trim() || "Could not archive logs."));
4054
+ });
4055
+ });
4056
+ }
4057
+ const listCommand = {
4058
+ command: "list",
4059
+ aliases: ["ls"],
4060
+ describe: "List recent diagnostic sessions",
4061
+ handler: async (argv) => {
4062
+ const sessions = await listLogSessions();
4063
+ if (argv.json) {
4064
+ output(argv, sessions);
4065
+ return;
4066
+ }
4067
+ if (sessions.length === 0) {
4068
+ console.log("No diagnostic logs found yet.");
4069
+ return;
4070
+ }
4071
+ printTable(["Session", "Modified"], sessions.map((session) => [session.name, session.modifiedAt]));
4072
+ }
4073
+ };
4074
+ const pathCommand = {
4075
+ command: "path [session]",
4076
+ describe: "Print a diagnostic session directory (latest by default)",
4077
+ builder: (y) => y.positional("session", {
4078
+ type: "string",
4079
+ describe: "Session name from `skydive logs list`"
4080
+ }),
4081
+ handler: async (argv) => {
4082
+ const session = await resolveSession(argv.session);
4083
+ if (argv.json) {
4084
+ output(argv, session);
4085
+ return;
4086
+ }
4087
+ console.log(session.path);
4088
+ }
4089
+ };
4090
+ const exportCommand = {
4091
+ command: "export [session]",
4092
+ describe: "Archive a diagnostic session for sharing (latest by default)",
4093
+ builder: (y) => y.positional("session", {
4094
+ type: "string",
4095
+ describe: "Session name from `skydive logs list`"
4096
+ }).option("output", {
4097
+ alias: "o",
4098
+ type: "string",
4099
+ describe: "Archive path (defaults to the current directory)"
4100
+ }),
4101
+ handler: async (argv) => {
4102
+ const session = await resolveSession(argv.session);
4103
+ const destination = path.resolve(argv.output ?? `skydive-logs-${session.name}.tar.gz`);
4104
+ try {
4105
+ await createArchive(session.path, destination);
4106
+ } catch (error) {
4107
+ printError(error instanceof Error ? error.message : String(error));
4108
+ process.exit(1);
4109
+ }
4110
+ if (argv.json) {
4111
+ output(argv, {
4112
+ path: destination,
4113
+ session: session.name,
4114
+ issueUrl: issueUrl(destination),
4115
+ repositoryUrl: ISSUE_REPOSITORY_URL
4116
+ });
4117
+ return;
4118
+ }
4119
+ console.log(destination);
4120
+ await offerIssueReport(destination);
4121
+ }
4122
+ };
4123
+ const logsCommand = {
4124
+ command: "logs",
4125
+ describe: "Find and export recent local diagnostic logs",
4126
+ builder: (y) => y.command(listCommand).command(pathCommand).command(exportCommand),
3963
4127
  handler: (argv) => listCommand.handler(argv)
3964
4128
  };
3965
4129
 
3966
4130
  //#endregion
3967
4131
  //#region src/cli.ts
3968
4132
  function createCli(argv) {
3969
- return yargs(argv).scriptName("skydive").usage("$0 <command> [options]").parserConfiguration({ "populate--": true }).example("skydive auth login", "Store your API key").example("skydive chat", "Open the interactive chat TUI (prod)").example("skydive chat --api-url http://localhost:4500", "Chat against a local dev API").example("skydive agents list", "List your agents").example("skydive completion install", "Set up TAB completion for your shell").example("skydive keys create \"my-key\"", "Create an API key").example("skydive secrets set OPENAI_API_KEY --agent-id <id>", "Set a secret (value from stdin)").example("skydive workspace list", "List workspaces on your account").example("skydive config set updateCheck false", "Disable the daily update check").example("skydive workspace switch acme-team", "Switch the workspace all `skydive` commands act on").example("skydive portal open --agent grace", "Open the portal to this machine for an agent, headless (no TUI)").example("skydive fs edit --agent grace /tmp/notes.md", "Edit a file on the agent's computer with your local editor").option("json", {
4133
+ return yargs(argv).scriptName("skydive").usage("$0 <command> [options]").parserConfiguration({ "populate--": true }).example("skydive auth login", "Store your API key").example("skydive chat", "Open the interactive chat TUI (prod)").example("skydive chat --api-url http://localhost:4500", "Chat against a local dev API").example("skydive agents list", "List your agents").example("skydive completion install", "Set up TAB completion for your shell").example("skydive keys create \"my-key\"", "Create an API key").example("skydive secrets set OPENAI_API_KEY --agent-id <id>", "Set a secret (value from stdin)").example("skydive workspace list", "List workspaces on your account").example("skydive config set updateCheck false", "Disable the daily update check").example("skydive logs export", "Archive the latest local diagnostics for sharing").example("skydive workspace switch acme-team", "Switch the workspace all `skydive` commands act on").example("skydive portal open --agent grace", "Open the portal to this machine for an agent, headless (no TUI)").example("skydive fs edit --agent grace /tmp/notes.md", "Edit a file on the agent's computer with your local editor").option("json", {
3970
4134
  type: "boolean",
3971
4135
  default: false,
3972
4136
  global: true,
@@ -3980,7 +4144,7 @@ function createCli(argv) {
3980
4144
  type: "string",
3981
4145
  global: true,
3982
4146
  describe: "Override API base URL"
3983
- }).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(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) => {
4147
+ }).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) => {
3984
4148
  printError(err ? err instanceof Error ? err.message : String(err) : msg ?? "Unknown error");
3985
4149
  process.exit(1);
3986
4150
  });
@@ -4336,7 +4500,7 @@ if (process.argv.includes(UPDATE_WORKER_FLAG)) {
4336
4500
  process.exit(0);
4337
4501
  }
4338
4502
  if (process.argv.includes(PORTAL_DAEMON_FLAG)) {
4339
- const { runPortalDaemon } = await import("./daemon-SPQgtsbW.mjs");
4503
+ const { runPortalDaemon } = await import("./daemon-WQ8QYrFt.mjs");
4340
4504
  runPortalDaemon(process.argv);
4341
4505
  } else runCli();
4342
4506
  function runCli() {
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env node
2
- import { A as takenAliasNames, C as themesForMode, D as dedupeAliasName, E as aliasActivationHint, F as getActiveWorkspaceId, L as listWorkspaces, N as detectShell, O as installAgentAlias, T as machineOsFromPlatform, _ as theme, a as installCrashHandler, b as themeModeFromColorFgBg, c as MARK_CELLS, d as splashFitsWidth, f as DEFAULT_THEME_ID, g as noColorRequested, h as monoTheme, i as writeArtifact, k as slugifyAliasName, l as WORDMARK, m as findTheme, n as profilingEnabled, o as buildCrashReport, p as applyTheme, r as record, s as writeCrashReport, v as themeForMode, x as themeVersion, y as themeMode, z as setActiveWorkspace } from "./profiler-BVbYs_Yg.mjs";
3
- import { B as resolveWebUrl, C as getConfigPath, O as getReviewStateDir, P as recordDefaultAgent, U as saveTheme, b as DEFAULT_APP_URL, c as cardActionErrorMessage, d as reconcileMaskedInput, f as resolveConnectUrl, h as specKeyFor, i as resolveAgent, k as getSavedTheme, l as parseExternalOauthConnectParams, m as parseConnectCard, p as computeSettledLabel, s as MASK_CHAR, u as parseOauthConnectParams, y as DEFAULT_API_URL } from "./print-C_TnQSPg.mjs";
4
- import { t as HttpError } from "./http-error-DzyrsLAZ.mjs";
5
- import { a as isRecord, i as errorMessage, n as errorDetail, r as sendErrorMessage, t as createRestClient } from "./rest-CgfbKXst.mjs";
6
- import { i as billingBlockedOutcomeFromSendResponse } from "./billing-blocked-2wju4gC_.mjs";
7
- import { t as PortalClient } from "./client-DbqRBquD.mjs";
8
- import "./daemon-BTyg329O.mjs";
9
- import "./api-DG5W6iwx.mjs";
10
- import { t as SandboxStream } from "./client-c4c5MmgN.mjs";
11
- import { t as PortalDaemonClient } from "./daemon-client--A_yMKq6.mjs";
12
- import { t as runRawPtyPassthrough } from "./raw-pty-DY4KelZW.mjs";
2
+ import { A as installAgentAlias, C as themeVersion, D as machineOsFromPlatform, F as detectShell, L as getActiveWorkspaceId, M as takenAliasNames, O as aliasActivationHint, S as themeModeFromColorFgBg, T as themesForMode, V as setActiveWorkspace, _ as monoTheme, a as WORDMARK, b as themeForMode, d as profilingEnabled, f as record, g as findTheme, h as applyTheme, i as MARK_CELLS, j as slugifyAliasName, k as dedupeAliasName, m as DEFAULT_THEME_ID, n as buildCrashReport, p as writeArtifact, r as writeCrashReport, s as splashFitsWidth, t as installCrashHandler, v as noColorRequested, x as themeMode, y as theme, z as listWorkspaces } from "./install-BPUAm8bS.mjs";
3
+ import { B as resolveWebUrl, C as getConfigPath, O as getReviewStateDir, P as recordDefaultAgent, U as saveTheme, b as DEFAULT_APP_URL, c as cardActionErrorMessage, d as reconcileMaskedInput, f as resolveConnectUrl, h as specKeyFor, i as resolveAgent, k as getSavedTheme, l as parseExternalOauthConnectParams, m as parseConnectCard, p as computeSettledLabel, s as MASK_CHAR, u as parseOauthConnectParams, y as DEFAULT_API_URL } from "./print-Clgq46GU.mjs";
4
+ import { t as HttpError } from "./http-error-UHH3mVBF.mjs";
5
+ import { a as isRecord, i as errorMessage, n as errorDetail, r as sendErrorMessage, t as createRestClient } from "./rest-C6E4mS2A.mjs";
6
+ import { i as billingBlockedOutcomeFromSendResponse } from "./billing-blocked-D3l5kJlX.mjs";
7
+ import { t as PortalClient } from "./client-d6K9qm6B.mjs";
8
+ import "./daemon-BPGZufS1.mjs";
9
+ import { t as defaultTlsCertSource } from "./tls-cert-CV-pwxVN.mjs";
10
+ import "./api-DQCaztBg.mjs";
11
+ import { t as SandboxStream } from "./client-BTQ1fwzM.mjs";
12
+ import { t as PortalDaemonClient } from "./daemon-client-MpAGVkqP.mjs";
13
+ import { t as runRawPtyPassthrough } from "./raw-pty-B9Bue8gg.mjs";
13
14
  import * as os$1 from "node:os";
14
15
  import { homedir, platform, release, tmpdir } from "node:os";
15
16
  import path, { basename, extname, isAbsolute, join, win32 } from "node:path";
@@ -396,6 +397,9 @@ function createPortalClient(opts) {
396
397
  deviceToken: null
397
398
  }),
398
399
  resolveCwd: () => process.cwd(),
400
+ tlsCertSource: defaultTlsCertSource(process.env, (msg) => {
401
+ console.error(msg);
402
+ }),
399
403
  persistedMachineName: null,
400
404
  onMachineName: () => {},
401
405
  onState: (state) => opts.onState({
@@ -14140,9 +14144,8 @@ async function settleBootThemeMode({ source, applyThemeMode, graceMs = THEME_QUE
14140
14144
  //#endregion
14141
14145
  //#region src/profiling/tui.ts
14142
14146
  /**
14143
- * TUI-side profiling instrumentation. Everything here rides on the shared
14144
- * profile directory created in bin.ts (see profiler.ts) and is inert unless
14145
- * SKYDIVE_PROFILE is set.
14147
+ * TUI-side diagnostics. Everything here rides on the shared session directory
14148
+ * created in bin.ts. SKYDIVE_PROFILE=0 makes these helpers inert.
14146
14149
  */
14147
14150
  /**
14148
14151
  * Renderer options to merge into createCliRenderer when profiling:
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from "node:module";
3
+
4
+ //#region \0rolldown/runtime.js
5
+ var __create = Object.create;
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __getOwnPropNames = Object.getOwnPropertyNames;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
+ key = keys[i];
16
+ if (!__hasOwnProp.call(to, key) && key !== except) {
17
+ __defProp(to, key, {
18
+ get: ((k) => from[k]).bind(null, key),
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ }
23
+ }
24
+ return to;
25
+ };
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
27
+ value: mod,
28
+ enumerable: true
29
+ }) : target, mod));
30
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
31
+
32
+ //#endregion
33
+ export { __require as n, __toESM as r, __commonJSMin as t };