skydive-cli 0.4.0-beta.1141 → 0.4.0-beta.1173

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,5 +1,5 @@
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-C-hbIwXv.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-BgGRyc5q.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-CswnhVUN.mjs";
4
4
  import { n as printError, r as printTable, t as output } from "./output-DYzzdXYV.mjs";
5
5
  import { n as createRestClient, t as HttpError } from "./rest-CG7VpQ56.mjs";
@@ -1514,7 +1514,7 @@ const importCommand = {
1514
1514
  process.exit(1);
1515
1515
  }
1516
1516
  }
1517
- const { runChat } = await import("./boot-D1iX9oW1.mjs");
1517
+ const { runChat } = await import("./boot-e-aTvP3w.mjs");
1518
1518
  await runChat({
1519
1519
  appUrl,
1520
1520
  sessionToken: session.value.sessionToken,
@@ -1926,7 +1926,7 @@ const chatCommand = {
1926
1926
  sessionToken: auth.value.token,
1927
1927
  agentSelector: argv.agent ?? null
1928
1928
  });
1929
- const { runChat } = await import("./boot-D1iX9oW1.mjs");
1929
+ const { runChat } = await import("./boot-e-aTvP3w.mjs");
1930
1930
  await runChat({
1931
1931
  appUrl: auth.value.appUrl,
1932
1932
  sessionToken: auth.value.token,
@@ -2285,7 +2285,7 @@ const switchCommand = {
2285
2285
  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.");
2286
2286
  process.exit(1);
2287
2287
  }
2288
- const { runWorkspacePicker } = await import("./boot-D1iX9oW1.mjs");
2288
+ const { runWorkspacePicker } = await import("./boot-e-aTvP3w.mjs");
2289
2289
  await runWorkspacePicker(session);
2290
2290
  return;
2291
2291
  }
@@ -1,5 +1,5 @@
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-C-hbIwXv.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-BgGRyc5q.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-CswnhVUN.mjs";
4
4
  import { a as errorMessage, i as sendErrorMessage, n as createRestClient, o as isRecord, r as errorDetail, t as HttpError } from "./rest-CG7VpQ56.mjs";
5
5
  import { i as billingBlockedOutcomeFromSendResponse } from "./billing-blocked-CwfG1BTR.mjs";
@@ -4615,6 +4615,270 @@ function clampItem(item) {
4615
4615
  }
4616
4616
  }
4617
4617
 
4618
+ //#endregion
4619
+ //#region src/chat/tui/chat/fix-json.ts
4620
+ /**
4621
+ * Implemented as a scanner with additional fixing
4622
+ * that performs a single linear time scan pass over the partial JSON.
4623
+ *
4624
+ * The states should ideally match relevant states from the JSON spec:
4625
+ * https://www.json.org/json-en.html
4626
+ *
4627
+ * Please note that invalid JSON is not considered/covered, because it
4628
+ * is assumed that the resulting JSON will be processed by a standard
4629
+ * JSON parser that will detect any invalid JSON.
4630
+ */
4631
+ function fixJson(input) {
4632
+ const stack = ["ROOT"];
4633
+ let lastValidIndex = -1;
4634
+ let literalStart = null;
4635
+ function processValueStart(char, i, swapState) {
4636
+ switch (char) {
4637
+ case "\"":
4638
+ lastValidIndex = i;
4639
+ stack.pop();
4640
+ stack.push(swapState);
4641
+ stack.push("INSIDE_STRING");
4642
+ break;
4643
+ case "f":
4644
+ case "t":
4645
+ case "n":
4646
+ lastValidIndex = i;
4647
+ literalStart = i;
4648
+ stack.pop();
4649
+ stack.push(swapState);
4650
+ stack.push("INSIDE_LITERAL");
4651
+ break;
4652
+ case "-":
4653
+ stack.pop();
4654
+ stack.push(swapState);
4655
+ stack.push("INSIDE_NUMBER");
4656
+ break;
4657
+ case "0":
4658
+ case "1":
4659
+ case "2":
4660
+ case "3":
4661
+ case "4":
4662
+ case "5":
4663
+ case "6":
4664
+ case "7":
4665
+ case "8":
4666
+ case "9":
4667
+ lastValidIndex = i;
4668
+ stack.pop();
4669
+ stack.push(swapState);
4670
+ stack.push("INSIDE_NUMBER");
4671
+ break;
4672
+ case "{":
4673
+ lastValidIndex = i;
4674
+ stack.pop();
4675
+ stack.push(swapState);
4676
+ stack.push("INSIDE_OBJECT_START");
4677
+ break;
4678
+ case "[":
4679
+ lastValidIndex = i;
4680
+ stack.pop();
4681
+ stack.push(swapState);
4682
+ stack.push("INSIDE_ARRAY_START");
4683
+ break;
4684
+ }
4685
+ }
4686
+ function processAfterObjectValue(char, i) {
4687
+ switch (char) {
4688
+ case ",":
4689
+ stack.pop();
4690
+ stack.push("INSIDE_OBJECT_AFTER_COMMA");
4691
+ break;
4692
+ case "}":
4693
+ lastValidIndex = i;
4694
+ stack.pop();
4695
+ break;
4696
+ }
4697
+ }
4698
+ function processAfterArrayValue(char, i) {
4699
+ switch (char) {
4700
+ case ",":
4701
+ stack.pop();
4702
+ stack.push("INSIDE_ARRAY_AFTER_COMMA");
4703
+ break;
4704
+ case "]":
4705
+ lastValidIndex = i;
4706
+ stack.pop();
4707
+ break;
4708
+ }
4709
+ }
4710
+ for (let i = 0; i < input.length; i++) {
4711
+ const char = input[i];
4712
+ if (!char) continue;
4713
+ switch (stack[stack.length - 1]) {
4714
+ case "ROOT":
4715
+ processValueStart(char, i, "FINISH");
4716
+ break;
4717
+ case "INSIDE_OBJECT_START":
4718
+ switch (char) {
4719
+ case "\"":
4720
+ stack.pop();
4721
+ stack.push("INSIDE_OBJECT_KEY");
4722
+ break;
4723
+ case "}":
4724
+ lastValidIndex = i;
4725
+ stack.pop();
4726
+ break;
4727
+ }
4728
+ break;
4729
+ case "INSIDE_OBJECT_AFTER_COMMA":
4730
+ switch (char) {
4731
+ case "\"":
4732
+ stack.pop();
4733
+ stack.push("INSIDE_OBJECT_KEY");
4734
+ break;
4735
+ }
4736
+ break;
4737
+ case "INSIDE_OBJECT_KEY":
4738
+ switch (char) {
4739
+ case "\"":
4740
+ stack.pop();
4741
+ stack.push("INSIDE_OBJECT_AFTER_KEY");
4742
+ break;
4743
+ }
4744
+ break;
4745
+ case "INSIDE_OBJECT_AFTER_KEY":
4746
+ switch (char) {
4747
+ case ":":
4748
+ stack.pop();
4749
+ stack.push("INSIDE_OBJECT_BEFORE_VALUE");
4750
+ break;
4751
+ }
4752
+ break;
4753
+ case "INSIDE_OBJECT_BEFORE_VALUE":
4754
+ processValueStart(char, i, "INSIDE_OBJECT_AFTER_VALUE");
4755
+ break;
4756
+ case "INSIDE_OBJECT_AFTER_VALUE":
4757
+ processAfterObjectValue(char, i);
4758
+ break;
4759
+ case "INSIDE_STRING":
4760
+ switch (char) {
4761
+ case "\"":
4762
+ stack.pop();
4763
+ lastValidIndex = i;
4764
+ break;
4765
+ case "\\":
4766
+ stack.push("INSIDE_STRING_ESCAPE");
4767
+ break;
4768
+ default: lastValidIndex = i;
4769
+ }
4770
+ break;
4771
+ case "INSIDE_ARRAY_START":
4772
+ switch (char) {
4773
+ case "]":
4774
+ lastValidIndex = i;
4775
+ stack.pop();
4776
+ break;
4777
+ default:
4778
+ lastValidIndex = i;
4779
+ processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
4780
+ break;
4781
+ }
4782
+ break;
4783
+ case "INSIDE_ARRAY_AFTER_VALUE":
4784
+ switch (char) {
4785
+ case ",":
4786
+ stack.pop();
4787
+ stack.push("INSIDE_ARRAY_AFTER_COMMA");
4788
+ break;
4789
+ case "]":
4790
+ lastValidIndex = i;
4791
+ stack.pop();
4792
+ break;
4793
+ default:
4794
+ lastValidIndex = i;
4795
+ break;
4796
+ }
4797
+ break;
4798
+ case "INSIDE_ARRAY_AFTER_COMMA":
4799
+ processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
4800
+ break;
4801
+ case "INSIDE_STRING_ESCAPE":
4802
+ stack.pop();
4803
+ lastValidIndex = i;
4804
+ break;
4805
+ case "INSIDE_NUMBER":
4806
+ switch (char) {
4807
+ case "0":
4808
+ case "1":
4809
+ case "2":
4810
+ case "3":
4811
+ case "4":
4812
+ case "5":
4813
+ case "6":
4814
+ case "7":
4815
+ case "8":
4816
+ case "9":
4817
+ lastValidIndex = i;
4818
+ break;
4819
+ case "e":
4820
+ case "E":
4821
+ case "-":
4822
+ case ".": break;
4823
+ case ",":
4824
+ stack.pop();
4825
+ if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") processAfterArrayValue(char, i);
4826
+ if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") processAfterObjectValue(char, i);
4827
+ break;
4828
+ case "}":
4829
+ stack.pop();
4830
+ if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") processAfterObjectValue(char, i);
4831
+ break;
4832
+ case "]":
4833
+ stack.pop();
4834
+ if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") processAfterArrayValue(char, i);
4835
+ break;
4836
+ default:
4837
+ stack.pop();
4838
+ break;
4839
+ }
4840
+ break;
4841
+ case "INSIDE_LITERAL": {
4842
+ if (!literalStart) continue;
4843
+ const partialLiteral = input.substring(literalStart, i + 1);
4844
+ if (!"false".startsWith(partialLiteral) && !"true".startsWith(partialLiteral) && !"null".startsWith(partialLiteral)) {
4845
+ stack.pop();
4846
+ if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") processAfterObjectValue(char, i);
4847
+ else if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") processAfterArrayValue(char, i);
4848
+ } else lastValidIndex = i;
4849
+ break;
4850
+ }
4851
+ }
4852
+ }
4853
+ let result = input.slice(0, lastValidIndex + 1);
4854
+ for (let i = stack.length - 1; i >= 0; i--) switch (stack[i]) {
4855
+ case "INSIDE_STRING":
4856
+ result += "\"";
4857
+ break;
4858
+ case "INSIDE_OBJECT_KEY":
4859
+ case "INSIDE_OBJECT_AFTER_KEY":
4860
+ case "INSIDE_OBJECT_AFTER_COMMA":
4861
+ case "INSIDE_OBJECT_START":
4862
+ case "INSIDE_OBJECT_BEFORE_VALUE":
4863
+ case "INSIDE_OBJECT_AFTER_VALUE":
4864
+ result += "}";
4865
+ break;
4866
+ case "INSIDE_ARRAY_START":
4867
+ case "INSIDE_ARRAY_AFTER_COMMA":
4868
+ case "INSIDE_ARRAY_AFTER_VALUE":
4869
+ result += "]";
4870
+ break;
4871
+ case "INSIDE_LITERAL": {
4872
+ if (!literalStart) continue;
4873
+ const partialLiteral = input.substring(literalStart, input.length);
4874
+ if ("true".startsWith(partialLiteral)) result += "true".slice(partialLiteral.length);
4875
+ else if ("false".startsWith(partialLiteral)) result += "false".slice(partialLiteral.length);
4876
+ else if ("null".startsWith(partialLiteral)) result += "null".slice(partialLiteral.length);
4877
+ }
4878
+ }
4879
+ return result;
4880
+ }
4881
+
4618
4882
  //#endregion
4619
4883
  //#region src/chat/tui/chat/reducer.ts
4620
4884
  function str(chunk, key) {
@@ -4622,6 +4886,24 @@ function str(chunk, key) {
4622
4886
  return typeof value === "string" ? value : null;
4623
4887
  }
4624
4888
  /**
4889
+ * Best-effort parse of a tool call's partial arguments while they stream.
4890
+ * `fixJson` (the vercel/ai scanner) closes off the truncated JSON so a
4891
+ * half-arrived `{"command":"npm ins` parses to `{ command: 'npm ins' }`,
4892
+ * letting the renderers show the structured input filling in live rather
4893
+ * than a raw JSON fragment. Returns null until enough has arrived to parse
4894
+ * (or when the text isn't an object/array), so callers keep their raw
4895
+ * `inputText` fallback for the first few characters.
4896
+ */
4897
+ function parsePartialInput(text) {
4898
+ const trimmed = text.trimStart();
4899
+ if (trimmed[0] !== "{" && trimmed[0] !== "[") return null;
4900
+ try {
4901
+ return JSON.parse(fixJson(text));
4902
+ } catch (_error) {
4903
+ return null;
4904
+ }
4905
+ }
4906
+ /**
4625
4907
  * `agentName` is the display name of the agent producing this run's stream.
4626
4908
  * It's stamped onto each assistant-origin item so a multi-agent conversation
4627
4909
  * can attribute live turns; pass null in a solo thread to leave items
@@ -4689,10 +4971,17 @@ function applyChunk(items, chunk, agentName = null) {
4689
4971
  const toolCallId = str(chunk, "toolCallId");
4690
4972
  const delta = str(chunk, "inputTextDelta") ?? str(chunk, "delta") ?? "";
4691
4973
  if (!toolCallId) return [...items];
4692
- return items.map((m) => m.kind === "tool" && m.id === toolCallId ? {
4693
- ...m,
4694
- inputText: m.inputText + delta
4695
- } : m);
4974
+ return items.map((m) => {
4975
+ if (m.kind !== "tool" || m.id !== toolCallId) return m;
4976
+ const inputText = m.inputText + delta;
4977
+ const parsed = parsePartialInput(inputText);
4978
+ const input = parsed == null ? null : clampPayload(parsed);
4979
+ return {
4980
+ ...m,
4981
+ inputText,
4982
+ input
4983
+ };
4984
+ });
4696
4985
  }
4697
4986
  case "tool-input-available": {
4698
4987
  const toolCallId = str(chunk, "toolCallId");
@@ -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.0-beta.1141";
11
+ var version$1 = "0.4.0-beta.1173";
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.0-beta.1141",
3
+ "version": "0.4.0-beta.1173",
4
4
  "description": "Skydive CLI — cloud agents from the command line",
5
5
  "homepage": "https://skydive.com",
6
6
  "license": "MIT",