skydive-cli 0.2.0-beta.684 → 0.2.0-beta.700

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,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { C as setActiveWorkspace, S as listWorkspaces, T as version, _ as themes, b as getActiveWorkspaceId, o as brandHelpArt, t as installCrashHandler, w as name, x as getSessionIdentity, y as ensureActiveOrganization } from "./install-DgwIUN1J.mjs";
3
- import { A as resolveAppUrl, C as getPromptHistoryPath, D as getStoredApiKeyId, E as getShareMachineDefault, F as saveConfig, I as saveSession, M as resolveManagementAuth, N as resolveSession, O as getStoredApiKeyWorkspaceName, R as setLastSeenVersion, S as getLastSeenVersion, _ as API_KEY_PREFIX, b as deleteConfig, g as API_KEY_FAMILY_PREFIX, h as API_KEYS_URL, i as resolveAgent, j as resolveConfig, k as getUpdateCheckDisabled, v as DEFAULT_API_URL, x as getConfigPath } from "./print-BUbxOvnm.mjs";
2
+ import { C as setActiveWorkspace, S as listWorkspaces, T as version, _ as themes, b as getActiveWorkspaceId, o as brandHelpArt, t as installCrashHandler, w as name, x as getSessionIdentity, y as ensureActiveOrganization } from "./install-DVPqms6J.mjs";
3
+ import { A as resolveAppUrl, C as getPromptHistoryPath, D as getStoredApiKeyId, E as getShareMachineDefault, F as saveConfig, I as saveSession, M as resolveManagementAuth, N as resolveSession, O as getStoredApiKeyWorkspaceName, R as setLastSeenVersion, S as getLastSeenVersion, _ as API_KEY_PREFIX, b as deleteConfig, g as API_KEY_FAMILY_PREFIX, h as API_KEYS_URL, i as resolveAgent, j as resolveConfig, k as getUpdateCheckDisabled, v as DEFAULT_API_URL, x as getConfigPath } from "./print-CcvhSMi9.mjs";
4
4
  import { n as printError, r as printTable, t as output } from "./output-DYzzdXYV.mjs";
5
- import { n as createRestClient } from "./rest-CCyln7vx.mjs";
6
- import { a as registerPortalDevice, i as grantPortalAccess, n as fetchPortalDevices, o as revokePortalAccess, r as findThisDevice, s as machineIdentity } from "./client-O5KfzIaB.mjs";
7
- import { c as PORTAL_DAEMON_FLAG, i as queryDaemonStatus, l as daemonPaths, n as ensureDaemonRunning, o as stopDaemon } from "./daemon-Dk4RinJn.mjs";
5
+ import { n as createRestClient } from "./rest-B5v4v5ux.mjs";
6
+ import { a as registerPortalDevice, i as grantPortalAccess, n as fetchPortalDevices, o as revokePortalAccess, r as findThisDevice, s as machineIdentity } from "./client-DqidlIb-.mjs";
7
+ import { c as PORTAL_DAEMON_FLAG, i as queryDaemonStatus, l as daemonPaths, n as ensureDaemonRunning, o as stopDaemon } from "./daemon-mXhmMGsS.mjs";
8
8
  import { t as SandboxStream } from "./client-DfcJFEbh.mjs";
9
9
  import { hideBin } from "yargs/helpers";
10
10
  import yargs from "yargs";
@@ -1500,7 +1500,7 @@ const importCommand = {
1500
1500
  process.exit(1);
1501
1501
  }
1502
1502
  }
1503
- const { runChat } = await import("./boot-Buk9Rq0h.mjs");
1503
+ const { runChat } = await import("./boot-BLk76r4J.mjs");
1504
1504
  await runChat({
1505
1505
  appUrl,
1506
1506
  sessionToken: session.value.sessionToken,
@@ -1527,7 +1527,7 @@ async function runImportPrintMode({ argv, appUrl }) {
1527
1527
  printError(`${session.error.message} For non-interactive use, run \`skydive auth login --web\` first, or set SKYDIVE_SESSION_TOKEN.`);
1528
1528
  process.exit(1);
1529
1529
  }
1530
- const { connectMachineShare } = await import("./print-share-BTGabspc.mjs");
1530
+ const { connectMachineShare } = await import("./print-share-88a3VFKn.mjs");
1531
1531
  const machineShare = await connectMachineShare({
1532
1532
  appUrl,
1533
1533
  sessionToken: session.value.sessionToken,
@@ -1535,7 +1535,7 @@ async function runImportPrintMode({ argv, appUrl }) {
1535
1535
  });
1536
1536
  const extra = (argv.print ?? "").trim();
1537
1537
  const prompt = buildImportSeedPrompt(process.cwd()) + (extra ? `\n\nAdditional instructions: ${extra}` : "");
1538
- const { runPrint } = await import("./print-DZC3Xxnl.mjs");
1538
+ const { runPrint } = await import("./print-CXRJLvyp.mjs");
1539
1539
  try {
1540
1540
  const result = await runPrint({
1541
1541
  appUrl,
@@ -1816,7 +1816,7 @@ const chatCommand = {
1816
1816
  printError(`Unknown theme "${themeId}". Valid themes: ${themes.map((t) => t.id).join(", ")}`);
1817
1817
  process.exit(1);
1818
1818
  }
1819
- const { runChat } = await import("./boot-Buk9Rq0h.mjs");
1819
+ const { runChat } = await import("./boot-BLk76r4J.mjs");
1820
1820
  await runChat({
1821
1821
  appUrl,
1822
1822
  sessionToken: session.value.sessionToken,
@@ -1853,7 +1853,7 @@ async function runPrintMode({ argv, appUrl }) {
1853
1853
  printError(`${session.error.message} For non-interactive use, run \`skydive auth login\` first, or set SKYDIVE_SESSION_TOKEN.`);
1854
1854
  process.exit(1);
1855
1855
  }
1856
- const { runPrint, readStdin } = await import("./print-DZC3Xxnl.mjs");
1856
+ const { runPrint, readStdin } = await import("./print-CXRJLvyp.mjs");
1857
1857
  let prompt = (argv.print ?? "").trim();
1858
1858
  if (!prompt) {
1859
1859
  if (process.stdin.isTTY) {
@@ -1868,7 +1868,7 @@ async function runPrintMode({ argv, appUrl }) {
1868
1868
  }
1869
1869
  let machineShare = null;
1870
1870
  if (resolveShareMachine(argv)) {
1871
- const { connectMachineShare } = await import("./print-share-BTGabspc.mjs");
1871
+ const { connectMachineShare } = await import("./print-share-88a3VFKn.mjs");
1872
1872
  machineShare = await connectMachineShare({
1873
1873
  appUrl,
1874
1874
  sessionToken: session.value.sessionToken,
@@ -1927,7 +1927,7 @@ const getCommand = {
1927
1927
  printError(`${session.error.message} Run \`skydive auth login\` first, or set SKYDIVE_SESSION_TOKEN.`);
1928
1928
  process.exit(1);
1929
1929
  }
1930
- const { messageGet } = await import("./print-DZC3Xxnl.mjs");
1930
+ const { messageGet } = await import("./print-CXRJLvyp.mjs");
1931
1931
  try {
1932
1932
  const result = await messageGet({
1933
1933
  appUrl,
@@ -2124,7 +2124,7 @@ const switchCommand = {
2124
2124
  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.");
2125
2125
  process.exit(1);
2126
2126
  }
2127
- const { runWorkspacePicker } = await import("./boot-Buk9Rq0h.mjs");
2127
+ const { runWorkspacePicker } = await import("./boot-BLk76r4J.mjs");
2128
2128
  await runWorkspacePicker(session);
2129
2129
  return;
2130
2130
  }
@@ -2202,7 +2202,7 @@ const openCommand = {
2202
2202
  const agent = argv.agent ? resolveAgent((await fetchPortalDevices(session)).agents, argv.agent) : null;
2203
2203
  const cwd = argv.cwd ? path.resolve(argv.cwd) : process.cwd();
2204
2204
  const { machineName } = machineIdentity();
2205
- const { PortalClient } = await import("./client-Csl6iRdd.mjs");
2205
+ const { PortalClient } = await import("./client-Bi6tvlso.mjs");
2206
2206
  let lastLine = "";
2207
2207
  let signalConnected;
2208
2208
  const connected = new Promise((resolve) => {
@@ -2475,8 +2475,8 @@ const sandboxCommand = {
2475
2475
  }).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`"),
2476
2476
  handler: async (argv) => {
2477
2477
  const session = requireSession(argv);
2478
- const { createRestClient } = await import("./rest-HIAVuPQz.mjs");
2479
- const { resolveAgent } = await import("./print-DZC3Xxnl.mjs");
2478
+ const { createRestClient } = await import("./rest-BFuvemde.mjs");
2479
+ const { resolveAgent } = await import("./print-CXRJLvyp.mjs");
2480
2480
  const client = createRestClient({
2481
2481
  appUrl: session.appUrl,
2482
2482
  sessionToken: session.sessionToken
@@ -3553,7 +3553,7 @@ if (process.argv.includes(UPDATE_WORKER_FLAG)) {
3553
3553
  process.exit(0);
3554
3554
  }
3555
3555
  if (process.argv.includes(PORTAL_DAEMON_FLAG)) {
3556
- const { runPortalDaemon } = await import("./daemon-DxwrTG1K.mjs");
3556
+ const { runPortalDaemon } = await import("./daemon-Dj1iBfMV.mjs");
3557
3557
  runPortalDaemon(process.argv);
3558
3558
  } else runCli();
3559
3559
  function runCli() {
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { C as setActiveWorkspace, S as listWorkspaces, a as WORDMARK, b as getActiveWorkspaceId, c as applyTheme, d as noColorRequested, f as theme, g as themeVersion, h as themeModeFromColorFgBg, i as MARK_CELLS, l as findTheme, m as themeMode, n as buildCrashReport, p as themeForMode, r as writeCrashReport, s as DEFAULT_THEME_ID, t as installCrashHandler, u as monoTheme, v as themesForMode } from "./install-DgwIUN1J.mjs";
3
- import { L as saveTheme, P as resolveWebUrl, T as getSavedTheme, 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, w as getReviewStateDir, x as getConfigPath, y as DEFAULT_APP_URL } from "./print-BUbxOvnm.mjs";
4
- import { a as errorMessage, i as sendErrorMessage, n as createRestClient, o as isRecord, r as errorDetail, t as HttpError } from "./rest-CCyln7vx.mjs";
5
- import { t as PortalClient } from "./client-O5KfzIaB.mjs";
6
- import { d as makeLineParser, f as parseDaemonMessage, l as daemonPaths, n as ensureDaemonRunning, s as LOCAL_PROTOCOL_VERSION, u as encodeLine } from "./daemon-Dk4RinJn.mjs";
2
+ import { C as setActiveWorkspace, S as listWorkspaces, a as WORDMARK, b as getActiveWorkspaceId, c as applyTheme, d as noColorRequested, f as theme, g as themeVersion, h as themeModeFromColorFgBg, i as MARK_CELLS, l as findTheme, m as themeMode, n as buildCrashReport, p as themeForMode, r as writeCrashReport, s as DEFAULT_THEME_ID, t as installCrashHandler, u as monoTheme, v as themesForMode } from "./install-DVPqms6J.mjs";
3
+ import { L as saveTheme, P as resolveWebUrl, T as getSavedTheme, 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, w as getReviewStateDir, x as getConfigPath, y as DEFAULT_APP_URL } from "./print-CcvhSMi9.mjs";
4
+ import { a as errorMessage, i as sendErrorMessage, n as createRestClient, o as isRecord, r as errorDetail, t as HttpError } from "./rest-B5v4v5ux.mjs";
5
+ import { t as PortalClient } from "./client-DqidlIb-.mjs";
6
+ import { d as makeLineParser, f as parseDaemonMessage, l as daemonPaths, n as ensureDaemonRunning, s as LOCAL_PROTOCOL_VERSION, u as encodeLine } from "./daemon-mXhmMGsS.mjs";
7
7
  import { t as SandboxStream } from "./client-DfcJFEbh.mjs";
8
8
  import { t as runRawPtyPassthrough } from "./raw-pty-BcjbTjHJ.mjs";
9
9
  import * as os$1 from "node:os";
@@ -1044,13 +1044,17 @@ const PR_URL_RE = /https?:\/\/(?:www\.)?github\.com\/([\w.-]+)\/([\w.-]+)\/pull\
1044
1044
  * path/query/fragment) so the same PR linked twice with different fragments
1045
1045
  * collapses to one pill.
1046
1046
  */
1047
- function extractPullRequests(text) {
1047
+ function extractPullRequests(text, options) {
1048
+ const requireCompleteNumber = options?.requireCompleteNumber ?? true;
1048
1049
  const byKey = /* @__PURE__ */ new Map();
1049
1050
  for (const match of text.matchAll(PR_URL_RE)) {
1050
1051
  const owner = match[1];
1051
1052
  const repo = match[2];
1052
1053
  const numberText = match[3];
1053
1054
  if (!owner || !repo || !numberText) continue;
1055
+ if (requireCompleteNumber) {
1056
+ if (match.index + match[0].length >= text.length) continue;
1057
+ }
1054
1058
  const number = Number.parseInt(numberText, 10);
1055
1059
  if (!Number.isFinite(number) || number <= 0) continue;
1056
1060
  const key = `${owner.toLowerCase()}/${repo.toLowerCase()}#${number}`;
@@ -1064,34 +1068,87 @@ function extractPullRequests(text) {
1064
1068
  return [...byKey.values()];
1065
1069
  }
1066
1070
  /**
1067
- * A streaming PR scanner: fed `text-delta` chunks as a run streams, it reports
1068
- * each distinct PR the moment its URL completes, exactly once, without ever
1069
- * rescanning the transcript. It accumulates text per part id (a URL can split
1070
- * across two deltas) and only scans the current part's buffer, so cost is
1071
- * bounded by one text block, not the whole scrollback.
1071
+ * Flattens an arbitrary tool-output value into one string we can scan for PR
1072
+ * URLs. A tool's output is usually a string (bash stdout, a `gh pr create`
1073
+ * line) but can be a structured payload (an object/array of content parts), so
1074
+ * we walk it and concatenate every string we find. Depth- and size-bounded so
1075
+ * a pathological payload can't blow up the scan; the cap is generous because a
1076
+ * PR URL a tool prints is short and lands early in normal output.
1077
+ */
1078
+ function stringifyToolOutput(value) {
1079
+ const MAX_LEN = 2e5;
1080
+ const parts = [];
1081
+ let total = 0;
1082
+ const visit = (v, depth) => {
1083
+ if (total >= MAX_LEN || depth > 6) return;
1084
+ if (typeof v === "string") {
1085
+ parts.push(v);
1086
+ total += v.length;
1087
+ return;
1088
+ }
1089
+ if (Array.isArray(v)) {
1090
+ for (const item of v) {
1091
+ if (total >= MAX_LEN) return;
1092
+ visit(item, depth + 1);
1093
+ }
1094
+ return;
1095
+ }
1096
+ if (v && typeof v === "object") for (const item of Object.values(v)) {
1097
+ if (total >= MAX_LEN) return;
1098
+ visit(item, depth + 1);
1099
+ }
1100
+ };
1101
+ visit(value, 0);
1102
+ return parts.join("\n");
1103
+ }
1104
+ /**
1105
+ * A streaming PR scanner: fed run chunks as they stream, it reports each
1106
+ * distinct PR the moment its URL is seen, exactly once, without ever rescanning
1107
+ * the transcript. Two sources feed it:
1108
+ *
1109
+ * - **Assistant text** (`text-delta`): accumulated per part id (a URL can split
1110
+ * across two deltas) and only the current part's buffer is scanned, so cost
1111
+ * is bounded by one text block, not the whole scrollback.
1112
+ * - **Tool output** (`tool-output-available`): the settled output of a tool
1113
+ * call (e.g. `gh pr create` stdout) arrives whole, not delta-streamed, so we
1114
+ * flatten and scan it in one pass. This catches PRs a tool printed that the
1115
+ * agent never restated in prose — the common case for an opened PR.
1072
1116
  *
1073
- * `onPullRequest` fires once per never-before-seen PR number for the life of
1074
- * the scanner. Construct one per run (or per conversation) and feed it the
1075
- * same `text-delta` chunks the transcript reducer sees.
1117
+ * `onPullRequest` fires once per never-before-seen PR (keyed by
1118
+ * `owner/repo#number`) for the life of the scanner, regardless of which source
1119
+ * it came from. Construct one per run (or per conversation) and feed it the
1120
+ * same chunks the transcript reducer sees.
1076
1121
  */
1077
1122
  function createPullRequestScanner(onPullRequest) {
1078
1123
  let text = "";
1079
1124
  let lastPartId;
1080
1125
  const seen = /* @__PURE__ */ new Set();
1126
+ const report = (buffer, final) => {
1127
+ for (const pr of extractPullRequests(buffer, { requireCompleteNumber: !final })) {
1128
+ if (seen.has(pr.key)) continue;
1129
+ seen.add(pr.key);
1130
+ onPullRequest(pr);
1131
+ }
1132
+ };
1081
1133
  return { addChunk(chunk) {
1134
+ if (chunk["type"] === "tool-output-available") {
1135
+ const outputText = stringifyToolOutput(chunk["output"]);
1136
+ if (!outputText.includes("/pull/")) return;
1137
+ report(outputText, true);
1138
+ return;
1139
+ }
1082
1140
  if (chunk["type"] !== "text-delta") return;
1083
1141
  const delta = typeof chunk["delta"] === "string" ? chunk["delta"] : typeof chunk["text"] === "string" ? chunk["text"] : "";
1084
1142
  if (!delta) return;
1085
1143
  const partId = typeof chunk["id"] === "string" ? chunk["id"] : void 0;
1086
- if (partId && lastPartId && partId !== lastPartId) text = "";
1144
+ if (partId && lastPartId && partId !== lastPartId) {
1145
+ if (text.includes("/pull/")) report(text, true);
1146
+ text = "";
1147
+ }
1087
1148
  text += delta;
1088
1149
  lastPartId = partId ?? lastPartId;
1089
- if (!delta.includes("/pull/") && !/\/\d/.test(delta)) return;
1090
- for (const pr of extractPullRequests(text)) {
1091
- if (seen.has(pr.key)) continue;
1092
- seen.add(pr.key);
1093
- onPullRequest(pr);
1094
- }
1150
+ if (!text.includes("/pull/")) return;
1151
+ report(text, false);
1095
1152
  } };
1096
1153
  }
1097
1154
 
@@ -9524,8 +9581,9 @@ function ChatScreen({ agent, conversation }) {
9524
9581
  });
9525
9582
  setItems(loaded);
9526
9583
  for (const item of loaded) {
9527
- if (item.kind !== "assistant-text") continue;
9528
- for (const pr of extractPullRequests(item.text)) {
9584
+ const text = item.kind === "assistant-text" ? item.text : item.kind === "tool" && item.output?.kind === "ok" ? stringifyToolOutput(item.output.value) : null;
9585
+ if (text === null) continue;
9586
+ for (const pr of extractPullRequests(text, { requireCompleteNumber: false })) {
9529
9587
  if (reportedPrsRef.current.has(pr.key)) continue;
9530
9588
  reportedPrsRef.current.set(pr.key, pr);
9531
9589
  setPrLinks((prev) => [...prev, pr]);
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import "./rest-B5v4v5ux.mjs";
3
+ import { t as PortalClient } from "./client-DqidlIb-.mjs";
4
+
5
+ export { PortalClient };
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as errorMessage, t as HttpError } from "./rest-CCyln7vx.mjs";
2
+ import { a as errorMessage, t as HttpError } from "./rest-B5v4v5ux.mjs";
3
3
  import os from "node:os";
4
4
  import { z } from "zod";
5
5
  import { spawn } from "node:child_process";
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import "./rest-CCyln7vx.mjs";
3
- import "./client-O5KfzIaB.mjs";
4
- import { a as runPortalDaemon, i as queryDaemonStatus, n as ensureDaemonRunning, o as stopDaemon, r as isDaemonListening, t as PortalDaemon } from "./daemon-Dk4RinJn.mjs";
2
+ import "./rest-B5v4v5ux.mjs";
3
+ import "./client-DqidlIb-.mjs";
4
+ import { a as runPortalDaemon, i as queryDaemonStatus, n as ensureDaemonRunning, o as stopDaemon, r as isDaemonListening, t as PortalDaemon } from "./daemon-mXhmMGsS.mjs";
5
5
 
6
6
  export { runPortalDaemon };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { o as isRecord } from "./rest-CCyln7vx.mjs";
3
- import { t as PortalClient } from "./client-O5KfzIaB.mjs";
2
+ import { o as isRecord } from "./rest-B5v4v5ux.mjs";
3
+ import { t as PortalClient } from "./client-DqidlIb-.mjs";
4
4
  import os from "node:os";
5
5
  import path from "node:path";
6
6
  import { z } from "zod";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { x as getConfigPath } from "./print-BUbxOvnm.mjs";
2
+ import { x as getConfigPath } from "./print-CcvhSMi9.mjs";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
5
  import { err, ok } from "neverthrow";
@@ -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.2.0-beta.684";
11
+ var version$1 = "0.2.0-beta.700";
12
12
 
13
13
  //#endregion
14
14
  //#region src/auth/organization.ts
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as runPrint, i as resolveAgent, n as messageGet, o as toPrintError, r as readStdin, t as collectRunText } from "./print-BUbxOvnm.mjs";
3
- import "./rest-CCyln7vx.mjs";
2
+ import { a as runPrint, i as resolveAgent, n as messageGet, o as toPrintError, r as readStdin, t as collectRunText } from "./print-CcvhSMi9.mjs";
3
+ import "./rest-B5v4v5ux.mjs";
4
4
 
5
5
  export { messageGet, readStdin, resolveAgent, runPrint };
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as errorMessage, i as sendErrorMessage, n as createRestClient, o as isRecord, t as HttpError } from "./rest-CCyln7vx.mjs";
2
+ import { a as errorMessage, i as sendErrorMessage, n as createRestClient, o as isRecord, t as HttpError } from "./rest-B5v4v5ux.mjs";
3
3
  import path from "node:path";
4
4
  import Conf from "conf";
5
5
  import { err, ok } from "neverthrow";
@@ -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-Csl6iRdd.mjs");
17
+ const { PortalClient } = await import("./client-Bi6tvlso.mjs");
18
18
  let signalConnected;
19
19
  const connected = new Promise((resolve) => {
20
20
  signalConnected = resolve;
@@ -102,11 +102,12 @@ function sendErrorMessage(err) {
102
102
  return fromServer ?? `Send failed (HTTP ${err.status}).`;
103
103
  }
104
104
  const MAX_STREAM_RECONNECTS = 5;
105
- function createRestClient({ appUrl, sessionToken }) {
105
+ function createRestClient({ appUrl, sessionToken, workspaceId }) {
106
106
  const baseHeaders = {
107
107
  authorization: `Bearer ${sessionToken}`,
108
108
  accept: "application/json"
109
109
  };
110
+ if (workspaceId) baseHeaders["x-workspace-id"] = workspaceId;
110
111
  async function get(path, schema) {
111
112
  const res = await fetch(`${appUrl}${path}`, { headers: baseHeaders });
112
113
  if (!res.ok) throw new HttpError(res.status, await res.text().catch(() => ""));
@@ -142,6 +143,7 @@ function createRestClient({ appUrl, sessionToken }) {
142
143
  authorization: `Bearer ${sessionToken}`,
143
144
  accept: "text/event-stream"
144
145
  };
146
+ if (workspaceId) headers["x-workspace-id"] = workspaceId;
145
147
  if (lastEventId) headers["last-event-id"] = lastEventId;
146
148
  const res = await fetch(`${appUrl}${path}`, {
147
149
  headers,
@@ -368,7 +370,8 @@ function createRestClient({ appUrl, sessionToken }) {
368
370
  const res = await fetch(`${appUrl}/api/v1/chat/conversations/${encodeURIComponent(conversationId)}/stream`, {
369
371
  headers: {
370
372
  authorization: `Bearer ${sessionToken}`,
371
- accept: "text/event-stream"
373
+ accept: "text/event-stream",
374
+ ...workspaceId ? { "x-workspace-id": workspaceId } : {}
372
375
  },
373
376
  signal
374
377
  });
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { i as sendErrorMessage, n as createRestClient, r as errorDetail, t as HttpError } from "./rest-CCyln7vx.mjs";
2
+ import { i as sendErrorMessage, n as createRestClient, r as errorDetail, t as HttpError } from "./rest-B5v4v5ux.mjs";
3
3
 
4
4
  export { createRestClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skydive-cli",
3
- "version": "0.2.0-beta.684",
3
+ "version": "0.2.0-beta.700",
4
4
  "description": "Skydive CLI — cloud agents from the command line",
5
5
  "homepage": "https://skydive.com",
6
6
  "license": "MIT",
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import "./rest-CCyln7vx.mjs";
3
- import { t as PortalClient } from "./client-O5KfzIaB.mjs";
4
-
5
- export { PortalClient };