skydive-cli 0.4.1-beta.4 → 0.4.1-beta.6

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,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { C as ensureActiveOrganization, D as setActiveWorkspace, E as listWorkspaces, O as name, T as getSessionIdentity, a as installCrashHandler, k as version, t as maybeStartProfiling, u as brandHelpArt, w as getActiveWorkspaceId, x as themes } from "./profiler-C9aAb1Sl.mjs";
2
+ import { C as ensureActiveOrganization, D as setActiveWorkspace, E as listWorkspaces, O as name, T as getSessionIdentity, a as installCrashHandler, k as version, t as maybeStartProfiling, u as brandHelpArt, w as getActiveWorkspaceId, x as themes } from "./profiler-94qrV53c.mjs";
3
3
  import { A as getStoredApiKeyWorkspaceName, C as getLastSeenVersion, F as resolveManagementAuth, I as resolveSession, M as resolveAppUrl, N as resolveChatAuth, O as getShareMachineDefault, P as resolveConfig, R as saveConfig, S as getConfigPath, T as getPromptHistoryPath, V as setLastSeenVersion, _ as API_KEY_PREFIX, b as PREFERENCES, g as API_KEY_FAMILY_PREFIX, h as API_KEYS_URL, i as resolveAgent, j as getUpdateCheckDisabled, k as getStoredApiKeyId, v as DEFAULT_API_URL, w as getPreference, x as deleteConfig, z as saveSession } from "./print-CbayCa87.mjs";
4
4
  import { n as printError, r as printTable, t as output } from "./output-DYzzdXYV.mjs";
5
5
  import { t as HttpError } from "./http-error-DzyrsLAZ.mjs";
6
6
  import { t as createRestClient } from "./rest-BY2nADw5.mjs";
7
7
  import "./billing-blocked-2wju4gC_.mjs";
8
- import { a as registerPortalDevice, c as resolveMachineIdentity, i as grantPortalAccess, n as fetchPortalDevices, o as revokePortalAccess, r as findThisDevice } from "./client-DaZyQfQ-.mjs";
9
- import { i as queryDaemonStatus, l as PORTAL_DAEMON_FLAG, n as ensureDaemonRunning, s as stopDaemon, u as daemonPaths } from "./daemon-DpqP-4tS.mjs";
8
+ import { a as registerPortalDevice, c as resolveMachineIdentity, i as grantPortalAccess, n as fetchPortalDevices, o as revokePortalAccess, r as findThisDevice } from "./client-mykp1DVb.mjs";
9
+ import { i as queryDaemonStatus, l as PORTAL_DAEMON_FLAG, n as ensureDaemonRunning, s as stopDaemon, u as daemonPaths } from "./daemon-CfbpCjAw.mjs";
10
10
  import { t as SandboxStream } from "./client-Cn2af31H.mjs";
11
11
  import { hideBin } from "yargs/helpers";
12
12
  import yargs from "yargs";
@@ -1516,7 +1516,7 @@ const importCommand = {
1516
1516
  process.exit(1);
1517
1517
  }
1518
1518
  }
1519
- const { runChat } = await import("./boot-xlXCVRBH.mjs");
1519
+ const { runChat } = await import("./boot-B48inW5D.mjs");
1520
1520
  await runChat({
1521
1521
  appUrl,
1522
1522
  sessionToken: session.value.sessionToken,
@@ -1543,7 +1543,7 @@ async function runImportPrintMode({ argv, appUrl }) {
1543
1543
  printError(`${session.error.message} For non-interactive use, run \`skydive auth login --web\` first, or set SKYDIVE_SESSION_TOKEN.`);
1544
1544
  process.exit(1);
1545
1545
  }
1546
- const { connectMachineShare } = await import("./print-share-Jgn0lqGr.mjs");
1546
+ const { connectMachineShare } = await import("./print-share-ZV88PqDu.mjs");
1547
1547
  const machineShare = await connectMachineShare({
1548
1548
  appUrl,
1549
1549
  sessionToken: session.value.sessionToken,
@@ -1928,7 +1928,7 @@ const chatCommand = {
1928
1928
  sessionToken: auth.value.token,
1929
1929
  agentSelector: argv.agent ?? null
1930
1930
  });
1931
- const { runChat } = await import("./boot-xlXCVRBH.mjs");
1931
+ const { runChat } = await import("./boot-B48inW5D.mjs");
1932
1932
  await runChat({
1933
1933
  appUrl: auth.value.appUrl,
1934
1934
  sessionToken: auth.value.token,
@@ -2020,7 +2020,7 @@ async function runPrintMode({ argv, appUrl }) {
2020
2020
  process.exit(1);
2021
2021
  }
2022
2022
  } else {
2023
- const { connectMachineShare } = await import("./print-share-Jgn0lqGr.mjs");
2023
+ const { connectMachineShare } = await import("./print-share-ZV88PqDu.mjs");
2024
2024
  machineShare = await connectMachineShare({
2025
2025
  appUrl: auth.value.appUrl,
2026
2026
  sessionToken: auth.value.token,
@@ -2287,7 +2287,7 @@ const switchCommand = {
2287
2287
  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.");
2288
2288
  process.exit(1);
2289
2289
  }
2290
- const { runWorkspacePicker } = await import("./boot-xlXCVRBH.mjs");
2290
+ const { runWorkspacePicker } = await import("./boot-B48inW5D.mjs");
2291
2291
  await runWorkspacePicker(session);
2292
2292
  return;
2293
2293
  }
@@ -2366,7 +2366,7 @@ const openCommand = {
2366
2366
  const agent = argv.agent ? resolveAgent((await fetchPortalDevices(session)).agents, argv.agent) : null;
2367
2367
  const cwd = argv.cwd ? path.resolve(argv.cwd) : process.cwd();
2368
2368
  const { machineName } = await resolveMachineIdentity();
2369
- const { PortalDaemonClient } = await import("./daemon-client-TQuXEURW.mjs");
2369
+ const { PortalDaemonClient } = await import("./daemon-client-BHehCLrO.mjs");
2370
2370
  let lastLine = "";
2371
2371
  let signalConnected;
2372
2372
  const connected = new Promise((resolve) => {
@@ -4169,7 +4169,7 @@ if (process.argv.includes(UPDATE_WORKER_FLAG)) {
4169
4169
  process.exit(0);
4170
4170
  }
4171
4171
  if (process.argv.includes(PORTAL_DAEMON_FLAG)) {
4172
- const { runPortalDaemon } = await import("./daemon-BKVPOhzU.mjs");
4172
+ const { runPortalDaemon } = await import("./daemon-D4ZX3wNG.mjs");
4173
4173
  runPortalDaemon(process.argv);
4174
4174
  } else runCli();
4175
4175
  function runCli() {
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
- import { D as setActiveWorkspace, E as listWorkspaces, S as themesForMode, _ as themeForMode, a as installCrashHandler, b as themeVersion, c as MARK_CELLS, d as DEFAULT_THEME_ID, f as applyTheme, g as theme, h as noColorRequested, i as writeArtifact, l as WORDMARK, m as monoTheme, n as profilingEnabled, o as buildCrashReport, p as findTheme, r as record, s as writeCrashReport, v as themeMode, w as getActiveWorkspaceId, y as themeModeFromColorFgBg } from "./profiler-C9aAb1Sl.mjs";
2
+ import { D as setActiveWorkspace, E as listWorkspaces, S as themesForMode, _ as themeForMode, a as installCrashHandler, b as themeVersion, c as MARK_CELLS, d as DEFAULT_THEME_ID, f as applyTheme, g as theme, h as noColorRequested, i as writeArtifact, l as WORDMARK, m as monoTheme, n as profilingEnabled, o as buildCrashReport, p as findTheme, r as record, s as writeCrashReport, v as themeMode, w as getActiveWorkspaceId, y as themeModeFromColorFgBg } from "./profiler-94qrV53c.mjs";
3
3
  import { B as saveTheme, D as getSavedTheme, E as getReviewStateDir, L as resolveWebUrl, S as getConfigPath, c as cardActionErrorMessage, d as reconcileMaskedInput, f as resolveConnectUrl, i as resolveAgent, l as parseExternalOauthConnectParams, m as specKeyFor, p as parseConnectCard, s as MASK_CHAR, u as parseOauthConnectParams, v as DEFAULT_API_URL, y as DEFAULT_APP_URL } from "./print-CbayCa87.mjs";
4
4
  import { t as HttpError } from "./http-error-DzyrsLAZ.mjs";
5
5
  import { a as isRecord, i as errorMessage, n as errorDetail, r as sendErrorMessage, t as createRestClient } from "./rest-BY2nADw5.mjs";
6
6
  import { i as billingBlockedOutcomeFromSendResponse } from "./billing-blocked-2wju4gC_.mjs";
7
- import { t as PortalClient } from "./client-DaZyQfQ-.mjs";
8
- import "./daemon-DpqP-4tS.mjs";
7
+ import { t as PortalClient } from "./client-mykp1DVb.mjs";
8
+ import "./daemon-CfbpCjAw.mjs";
9
9
  import { t as SandboxStream } from "./client-Cn2af31H.mjs";
10
- import { t as PortalDaemonClient } from "./daemon-client-F7gX12Mp.mjs";
10
+ import { t as PortalDaemonClient } from "./daemon-client-6xtta_n2.mjs";
11
11
  import { t as runRawPtyPassthrough } from "./raw-pty-B6mAroiI.mjs";
12
12
  import * as os$1 from "node:os";
13
13
  import { homedir, platform, release, tmpdir } from "node:os";
@@ -6877,6 +6877,66 @@ function filterSlashCommands(query) {
6877
6877
  return [...prefix, ...substring];
6878
6878
  }
6879
6879
 
6880
+ //#endregion
6881
+ //#region src/chat/tui/hard-exit.ts
6882
+ /**
6883
+ * Leaving the chat has to work even when the renderer cannot finish its own
6884
+ * teardown.
6885
+ *
6886
+ * `destroy()` restores the terminal from inside the render loop: when a frame
6887
+ * is in flight it defers the restore to the loop's `finally` and returns
6888
+ * immediately. That is fine while the loop is turning. When the loop has
6889
+ * stopped producing frames, the deferred half never runs — the process keeps
6890
+ * running with the alternate screen up, the cursor hidden and stdin in raw
6891
+ * mode, so the pane looks frozen and quitting appears to do nothing.
6892
+ *
6893
+ * So teardown checks whether the renderer actually finished. If it did not,
6894
+ * we emit the same terminal reset ourselves and end the process rather than
6895
+ * waiting on an event loop that is no longer draining.
6896
+ */
6897
+ /**
6898
+ * The reset the renderer writes when it completes teardown: show the cursor,
6899
+ * stop every mouse reporting mode, pop the kitty keyboard stack, leave the
6900
+ * alternate screen, clear attributes. Emitting it twice is harmless, which is
6901
+ * what makes it safe as a fallback.
6902
+ */
6903
+ const TERMINAL_RESTORE = [
6904
+ "\x1B[?25h",
6905
+ "\x1B[?1000l",
6906
+ "\x1B[?1002l",
6907
+ "\x1B[?1003l",
6908
+ "\x1B[?1006l",
6909
+ "\x1B[?1015l",
6910
+ "\x1B[<u",
6911
+ "\x1B[?1049l",
6912
+ "\x1B[0m"
6913
+ ].join("");
6914
+ /**
6915
+ * Tear down the renderer and leave the chat, guaranteeing both a usable
6916
+ * terminal and an ended process.
6917
+ *
6918
+ * A renderer that tore itself down keeps the existing behavior: the process
6919
+ * ends once the event loop drains, so nothing in flight is cut short. Only an
6920
+ * unfinished teardown takes the forced path.
6921
+ */
6922
+ function exitChat({ renderer, afterTeardown, write = (text) => void process.stdout.write(text), setRawMode = (raw) => process.stdin.setRawMode?.(raw), exit = (code) => process.exit(code) }) {
6923
+ let destroyThrew = false;
6924
+ try {
6925
+ renderer.destroy();
6926
+ } catch {
6927
+ destroyThrew = true;
6928
+ }
6929
+ const finished = !destroyThrew && renderer.isDestroyed;
6930
+ if (!finished) {
6931
+ try {
6932
+ setRawMode(false);
6933
+ } catch {}
6934
+ write(TERMINAL_RESTORE);
6935
+ }
6936
+ afterTeardown?.();
6937
+ if (!finished) exit(0);
6938
+ }
6939
+
6880
6940
  //#endregion
6881
6941
  //#region src/chat/tui/resume-hint.ts
6882
6942
  /**
@@ -10859,8 +10919,10 @@ function ChatScreen({ agent, conversation }) {
10859
10919
  const quit = useCallback(() => {
10860
10920
  portalClient?.dispose();
10861
10921
  agentHost.dispose();
10862
- renderer.destroy();
10863
- printResumeHint();
10922
+ exitChat({
10923
+ renderer,
10924
+ afterTeardown: printResumeHint
10925
+ });
10864
10926
  }, [
10865
10927
  portalClient,
10866
10928
  agentHost,
@@ -12398,8 +12460,10 @@ function App({ appUrl, sessionToken, authKind, shareMachine, promptHistoryPath,
12398
12460
  if (key.name === "c" && key.ctrl && screen.kind !== "chat") {
12399
12461
  useStore.getState().portalClient?.dispose();
12400
12462
  agentHost.dispose();
12401
- renderer.destroy();
12402
- printResumeHint();
12463
+ exitChat({
12464
+ renderer,
12465
+ afterTeardown: printResumeHint
12466
+ });
12403
12467
  }
12404
12468
  });
12405
12469
  return /* @__PURE__ */ jsx(AgentHostContext.Provider, {
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { t as PortalClient } from "./client-mykp1DVb.mjs";
3
+
4
+ export { PortalClient };
@@ -133,7 +133,8 @@ const ctrlMessageSchema = z.discriminatedUnion("t", [
133
133
  z.object({ t: z.literal("cancel") }),
134
134
  z.object({
135
135
  t: z.literal("close"),
136
- exitCode: z.number()
136
+ exitCode: z.number(),
137
+ frames: z.number().int().nonnegative().optional()
137
138
  }),
138
139
  z.object({
139
140
  t: z.literal("error"),
@@ -277,7 +278,8 @@ var JobManager = class {
277
278
  this.jobs.delete(id);
278
279
  this.opts.send(encodeCtrl(id, {
279
280
  t: "close",
280
- exitCode: code ?? -1
281
+ exitCode: code ?? -1,
282
+ frames: job.seq
281
283
  }));
282
284
  });
283
285
  }
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { s as isRecord, t as PortalClient } from "./client-DaZyQfQ-.mjs";
2
+ import { s as isRecord, t as PortalClient } from "./client-mykp1DVb.mjs";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
5
  import { z } from "zod";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "./client-DaZyQfQ-.mjs";
3
- import { a as runPortalDaemon, i as queryDaemonStatus, n as ensureDaemonRunning, o as startPortalDaemon, r as isDaemonListening, s as stopDaemon, t as PortalDaemon } from "./daemon-DpqP-4tS.mjs";
2
+ import "./client-mykp1DVb.mjs";
3
+ import { a as runPortalDaemon, i as queryDaemonStatus, n as ensureDaemonRunning, o as startPortalDaemon, r as isDaemonListening, s as stopDaemon, t as PortalDaemon } from "./daemon-CfbpCjAw.mjs";
4
4
 
5
5
  export { runPortalDaemon };
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { c as LOCAL_PROTOCOL_VERSION, d as encodeLine, f as makeLineParser, n as ensureDaemonRunning, p as parseDaemonMessage, u as daemonPaths } from "./daemon-DpqP-4tS.mjs";
2
+ import { c as LOCAL_PROTOCOL_VERSION, d as encodeLine, f as makeLineParser, n as ensureDaemonRunning, p as parseDaemonMessage, u as daemonPaths } from "./daemon-CfbpCjAw.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { connect } from "node:net";
5
5
 
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import "./client-mykp1DVb.mjs";
3
+ import "./daemon-CfbpCjAw.mjs";
4
+ import { t as PortalDaemonClient } from "./daemon-client-6xtta_n2.mjs";
5
+
6
+ export { PortalDaemonClient };
@@ -14,7 +14,7 @@ import { n as printError } from "./output-DYzzdXYV.mjs";
14
14
  * the reply (and to --json).
15
15
  */
16
16
  async function connectMachineShare({ appUrl, sessionToken, timeoutHint }) {
17
- const { PortalClient } = await import("./client-BsTDaKa2.mjs");
17
+ const { PortalClient } = await import("./client-NBj0KZSP.mjs");
18
18
  let signalConnected;
19
19
  const connected = new Promise((resolve) => {
20
20
  signalConnected = resolve;
@@ -8,7 +8,7 @@ import fs from "node:fs";
8
8
 
9
9
  //#region package.json
10
10
  var name = "skydive-cli";
11
- var version$1 = "0.4.1-beta.4";
11
+ var version$1 = "0.4.1-beta.6";
12
12
 
13
13
  //#endregion
14
14
  //#region src/auth/organization.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skydive-cli",
3
- "version": "0.4.1-beta.4",
3
+ "version": "0.4.1-beta.6",
4
4
  "description": "Skydive CLI — cloud agents from the command line",
5
5
  "homepage": "https://skydive.com",
6
6
  "license": "MIT",
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import { t as PortalClient } from "./client-DaZyQfQ-.mjs";
3
-
4
- export { PortalClient };
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- import "./client-DaZyQfQ-.mjs";
3
- import "./daemon-DpqP-4tS.mjs";
4
- import { t as PortalDaemonClient } from "./daemon-client-F7gX12Mp.mjs";
5
-
6
- export { PortalDaemonClient };