bravecode-cli 0.1.22 → 0.1.24

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/cli-main.mjs CHANGED
@@ -2893,9 +2893,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2893
2893
  _excessArguments(receivedArgs) {
2894
2894
  if (this._allowExcessArguments) return;
2895
2895
  const expected = this.registeredArguments.length;
2896
- const s = expected === 1 ? "" : "s";
2896
+ const s2 = expected === 1 ? "" : "s";
2897
2897
  const forSubcommand = this.parent ? ` for '${this.name()}'` : "";
2898
- const message = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s} but got ${receivedArgs.length}.`;
2898
+ const message = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s2} but got ${receivedArgs.length}.`;
2899
2899
  this.error(message, { code: "commander.excessArguments" });
2900
2900
  }
2901
2901
  /**
@@ -38185,7 +38185,7 @@ var APP_VERSION, APP_NAME;
38185
38185
  var init_version = __esm({
38186
38186
  "src/version.ts"() {
38187
38187
  "use strict";
38188
- APP_VERSION = "0.1.22";
38188
+ APP_VERSION = "0.1.24";
38189
38189
  APP_NAME = "BraveCode";
38190
38190
  }
38191
38191
  });
@@ -38914,8 +38914,8 @@ var init_brace_expressions = __esm({
38914
38914
  "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
38915
38915
  "[:xdigit:]": ["A-Fa-f0-9", false]
38916
38916
  };
38917
- braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
38918
- regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
38917
+ braceEscape = (s2) => s2.replace(/[[\]\\-]/g, "\\$&");
38918
+ regexpEscape = (s2) => s2.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
38919
38919
  rangesToString = (ranges) => ranges.join("");
38920
38920
  parseClass = (glob, position) => {
38921
38921
  const pos = position;
@@ -39012,11 +39012,11 @@ var init_brace_expressions = __esm({
39012
39012
  var unescape;
39013
39013
  var init_unescape = __esm({
39014
39014
  "node_modules/minimatch/dist/esm/unescape.js"() {
39015
- unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
39015
+ unescape = (s2, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
39016
39016
  if (magicalBraces) {
39017
- return windowsPathsNoEscape ? s.replace(/\[([^/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1");
39017
+ return windowsPathsNoEscape ? s2.replace(/\[([^/\\])\]/g, "$1") : s2.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1");
39018
39018
  }
39019
- return windowsPathsNoEscape ? s.replace(/\[([^/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
39019
+ return windowsPathsNoEscape ? s2.replace(/\[([^/\\{}])\]/g, "$1") : s2.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
39020
39020
  };
39021
39021
  }
39022
39022
  });
@@ -39081,7 +39081,7 @@ var init_ast = __esm({
39081
39081
  addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
39082
39082
  justDots = /* @__PURE__ */ new Set(["..", "."]);
39083
39083
  reSpecials = new Set("().*{}+?[]^$\\!");
39084
- regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
39084
+ regExpEscape = (s2) => s2.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
39085
39085
  qmark = "[^/]";
39086
39086
  star = qmark + "*?";
39087
39087
  starNoEmpty = qmark + "+?";
@@ -39504,7 +39504,7 @@ var init_ast = __esm({
39504
39504
  this.#fillNegs();
39505
39505
  }
39506
39506
  if (!isExtglobAST(this)) {
39507
- const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
39507
+ const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s2) => typeof s2 !== "string");
39508
39508
  const src = this.#parts.map((p) => {
39509
39509
  const [re, _, hasMagic, uflag] = typeof p === "string" ? _a25.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
39510
39510
  this.#hasMagic = this.#hasMagic || hasMagic;
@@ -39544,12 +39544,12 @@ var init_ast = __esm({
39544
39544
  const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
39545
39545
  let body = this.#partsToRegExp(dot);
39546
39546
  if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
39547
- const s = this.toString();
39547
+ const s2 = this.toString();
39548
39548
  const me = this;
39549
- me.#parts = [s];
39549
+ me.#parts = [s2];
39550
39550
  me.type = null;
39551
39551
  me.#hasMagic = void 0;
39552
- return [s, unescape(this.toString()), false, false];
39552
+ return [s2, unescape(this.toString()), false, false];
39553
39553
  }
39554
39554
  let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(true);
39555
39555
  if (bodyDotAllowed === body) {
@@ -39675,11 +39675,11 @@ var init_ast = __esm({
39675
39675
  var escape;
39676
39676
  var init_escape = __esm({
39677
39677
  "node_modules/minimatch/dist/esm/escape.js"() {
39678
- escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
39678
+ escape = (s2, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
39679
39679
  if (magicalBraces) {
39680
- return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
39680
+ return windowsPathsNoEscape ? s2.replace(/[?*()[\]{}]/g, "[$&]") : s2.replace(/[?*()[\]\\{}]/g, "\\$&");
39681
39681
  }
39682
- return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
39682
+ return windowsPathsNoEscape ? s2.replace(/[?*()[\]]/g, "[$&]") : s2.replace(/[?*()[\]\\]/g, "\\$&");
39683
39683
  };
39684
39684
  }
39685
39685
  });
@@ -39794,8 +39794,8 @@ var init_esm4 = __esm({
39794
39794
  return orig.AST.fromGlob(pattern, ext(def, options));
39795
39795
  }
39796
39796
  },
39797
- unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
39798
- escape: (s, options = {}) => orig.escape(s, ext(def, options)),
39797
+ unescape: (s2, options = {}) => orig.unescape(s2, ext(def, options)),
39798
+ escape: (s2, options = {}) => orig.escape(s2, ext(def, options)),
39799
39799
  filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
39800
39800
  defaults: (options) => orig.defaults(ext(def, options)),
39801
39801
  makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
@@ -39826,7 +39826,7 @@ var init_esm4 = __esm({
39826
39826
  };
39827
39827
  minimatch.match = match;
39828
39828
  globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
39829
- regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
39829
+ regExpEscape2 = (s2) => s2.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
39830
39830
  Minimatch = class {
39831
39831
  options;
39832
39832
  set;
@@ -39904,26 +39904,26 @@ var init_esm4 = __esm({
39904
39904
  this.debug = (...args) => console.error(...args);
39905
39905
  }
39906
39906
  this.debug(this.pattern, this.globSet);
39907
- const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
39907
+ const rawGlobParts = this.globSet.map((s2) => this.slashSplit(s2));
39908
39908
  this.globParts = this.preprocess(rawGlobParts);
39909
39909
  this.debug(this.pattern, this.globParts);
39910
- let set2 = this.globParts.map((s, _, __) => {
39910
+ let set2 = this.globParts.map((s2, _, __) => {
39911
39911
  if (this.isWindows && this.windowsNoMagicRoot) {
39912
- const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
39913
- const isDrive = /^[a-z]:/i.test(s[0]);
39912
+ const isUNC = s2[0] === "" && s2[1] === "" && (s2[2] === "?" || !globMagic.test(s2[2])) && !globMagic.test(s2[3]);
39913
+ const isDrive = /^[a-z]:/i.test(s2[0]);
39914
39914
  if (isUNC) {
39915
39915
  return [
39916
- ...s.slice(0, 4),
39917
- ...s.slice(4).map((ss) => this.parse(ss))
39916
+ ...s2.slice(0, 4),
39917
+ ...s2.slice(4).map((ss) => this.parse(ss))
39918
39918
  ];
39919
39919
  } else if (isDrive) {
39920
- return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
39920
+ return [s2[0], ...s2.slice(1).map((ss) => this.parse(ss))];
39921
39921
  }
39922
39922
  }
39923
- return s.map((ss) => this.parse(ss));
39923
+ return s2.map((ss) => this.parse(ss));
39924
39924
  });
39925
39925
  this.debug(this.pattern, set2);
39926
- this.set = set2.filter((s) => s.indexOf(false) === -1);
39926
+ this.set = set2.filter((s2) => s2.indexOf(false) === -1);
39927
39927
  if (this.isWindows) {
39928
39928
  for (let i = 0; i < this.set.length; i++) {
39929
39929
  const p = this.set[i];
@@ -40785,13 +40785,13 @@ var init_snapshot = __esm({
40785
40785
  return [...this.snapshots];
40786
40786
  }
40787
40787
  getSnapshot(id) {
40788
- return this.snapshots.find((s) => s.id === id);
40788
+ return this.snapshots.find((s2) => s2.id === id);
40789
40789
  }
40790
40790
  async getDiff() {
40791
40791
  if (!this.isGitRepo()) {
40792
40792
  return "Not a git repository";
40793
40793
  }
40794
- const lastReal = [...this.snapshots].reverse().find((s) => isRealCommitHash(s.commitHash));
40794
+ const lastReal = [...this.snapshots].reverse().find((s2) => isRealCommitHash(s2.commitHash));
40795
40795
  if (!lastReal) {
40796
40796
  return "No snapshot to diff";
40797
40797
  }
@@ -41889,6 +41889,16 @@ var init_use_agent_runner = __esm({
41889
41889
  import React4 from "react";
41890
41890
  import { useRenderer, useKeyboard, useTerminalDimensions, createRoot } from "@opentui/react";
41891
41891
  import { Fragment, jsx, jsxs } from "@opentui/react/jsx-runtime";
41892
+ function s(v) {
41893
+ if (v === null || v === void 0) return "";
41894
+ if (typeof v === "string") return v;
41895
+ if (typeof v === "number" || typeof v === "bigint" || typeof v === "boolean") return String(v);
41896
+ try {
41897
+ return String(v);
41898
+ } catch {
41899
+ return "";
41900
+ }
41901
+ }
41892
41902
  function HeaderBar() {
41893
41903
  const { colors: colors2 } = useTheme();
41894
41904
  const cwd = process.cwd().replace(process.env.HOME ?? "", "~");
@@ -41910,9 +41920,9 @@ function HeaderBar() {
41910
41920
  /* @__PURE__ */ jsx("text", { fg: colors2.headerFg, children: /* @__PURE__ */ jsxs("b", { children: [
41911
41921
  APP_NAME,
41912
41922
  " \u2014 ",
41913
- APP_NAME.toLowerCase()
41923
+ s(APP_NAME.toLowerCase())
41914
41924
  ] }) }),
41915
- /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: cwd })
41925
+ /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: s(cwd) })
41916
41926
  ] }),
41917
41927
  /* @__PURE__ */ jsx("text", { fg: colors2.headerFg, children: "\u25A4 \u2630 \u2296 \u22A1 \u2715" })
41918
41928
  ]
@@ -41940,10 +41950,10 @@ function StatusBar() {
41940
41950
  /* @__PURE__ */ jsx("text", { fg: colors2.info, children: "/status" })
41941
41951
  ] }),
41942
41952
  /* @__PURE__ */ jsxs("text", { fg: colors2.textMuted, children: [
41943
- /* @__PURE__ */ jsx("text", { fg: colors2.primary, children: /* @__PURE__ */ jsx("b", { children: APP_NAME }) }),
41953
+ /* @__PURE__ */ jsx("text", { fg: colors2.primary, children: /* @__PURE__ */ jsx("b", { children: s(APP_NAME) }) }),
41944
41954
  /* @__PURE__ */ jsxs("text", { fg: colors2.textMuted, children: [
41945
41955
  " ",
41946
- APP_VERSION
41956
+ s(APP_VERSION)
41947
41957
  ] })
41948
41958
  ] })
41949
41959
  ]
@@ -41956,13 +41966,13 @@ function AgentModelLine({ inline = false }) {
41956
41966
  return /* @__PURE__ */ jsxs("box", { style: { flexDirection: "row", gap: 1, ...inline ? {} : { paddingLeft: 1, paddingRight: 1, marginTop: 0, marginBottom: 0 } }, children: [
41957
41967
  /* @__PURE__ */ jsx("text", { fg: colors2.primary, children: /* @__PURE__ */ jsxs("b", { children: [
41958
41968
  "\u25FC ",
41959
- currentAgent.name.replace(" Agent", "")
41969
+ s(currentAgent.name.replace(" Agent", ""))
41960
41970
  ] }) }),
41961
41971
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "\xB7" }),
41962
- /* @__PURE__ */ jsx("text", { fg: colors2.textSecondary, children: currentModel }),
41972
+ /* @__PURE__ */ jsx("text", { fg: colors2.textSecondary, children: s(currentModel) }),
41963
41973
  /* @__PURE__ */ jsx("text", { fg: colors2.success, children: "Free" }),
41964
41974
  /* @__PURE__ */ jsx("text", { fg: colors2.accent, children: "OpenCode Zen" }),
41965
- isRunning && /* @__PURE__ */ jsx("text", { fg: colors2.warning, children: "\xB7 generating\u2026" })
41975
+ isRunning ? /* @__PURE__ */ jsx("text", { fg: colors2.warning, children: "\xB7 generating\u2026" }) : null
41966
41976
  ] });
41967
41977
  }
41968
41978
  function ShortcutHints({ interrupted = false }) {
@@ -41982,7 +41992,7 @@ function PixelLogo() {
41982
41992
  \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588
41983
41993
  `;
41984
41994
  const logo = letter.split("\n").filter(Boolean);
41985
- return /* @__PURE__ */ jsx("box", { alignItems: "center", flexDirection: "column", gap: 0, children: logo.map((line, i) => /* @__PURE__ */ jsx("text", { fg: colors2.primary, children: line }, i)) });
41995
+ return /* @__PURE__ */ jsx("box", { alignItems: "center", flexDirection: "column", gap: 0, children: logo.map((line, i) => /* @__PURE__ */ jsx("text", { fg: colors2.primary, children: s(line) }, s(i))) });
41986
41996
  }
41987
41997
  function Sidebar({ compact = false }) {
41988
41998
  const { colors: colors2 } = useTheme();
@@ -42006,18 +42016,18 @@ function Sidebar({ compact = false }) {
42006
42016
  /* @__PURE__ */ jsx("text", { fg: colors2.text, children: /* @__PURE__ */ jsx("b", { children: "Info" }) }),
42007
42017
  /* @__PURE__ */ jsxs("box", { style: { marginTop: 1 }, children: [
42008
42018
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "agent " }),
42009
- /* @__PURE__ */ jsx("text", { fg: colors2.primary, children: currentAgent.name.replace(" Agent", "") })
42019
+ /* @__PURE__ */ jsx("text", { fg: colors2.primary, children: s(currentAgent.name.replace(" Agent", "")) })
42010
42020
  ] }),
42011
42021
  /* @__PURE__ */ jsxs("text", { fg: colors2.textMuted, children: [
42012
42022
  "model ",
42013
- currentModel
42023
+ s(currentModel)
42014
42024
  ] }),
42015
42025
  /* @__PURE__ */ jsxs("box", { style: { marginTop: 1 }, children: [
42016
42026
  /* @__PURE__ */ jsx("text", { fg: colors2.success, children: "\u25CF" }),
42017
42027
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: " mcp connected" })
42018
42028
  ] }),
42019
42029
  /* @__PURE__ */ jsx("box", { style: { flexGrow: 1 } }),
42020
- /* @__PURE__ */ jsx("box", { style: { marginTop: 1 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: APP_VERSION }) }),
42030
+ /* @__PURE__ */ jsx("box", { style: { marginTop: 1 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: s(APP_VERSION) }) }),
42021
42031
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "ctrl+b sidebar" })
42022
42032
  ]
42023
42033
  }
@@ -42038,9 +42048,9 @@ function Sidebar({ compact = false }) {
42038
42048
  children: [
42039
42049
  /* @__PURE__ */ jsx("text", { fg: colors2.text, children: /* @__PURE__ */ jsxs("b", { children: [
42040
42050
  "New session - ",
42041
- sessionTime.slice(0, 17)
42051
+ s(sessionTime.slice(0, 17))
42042
42052
  ] }) }),
42043
- /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: sessionTime.slice(17) }),
42053
+ /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: s(sessionTime.slice(17)) }),
42044
42054
  /* @__PURE__ */ jsx("box", { style: { marginTop: 1 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.text, children: /* @__PURE__ */ jsx("b", { children: "Context" }) }) }),
42045
42055
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "0 tokens" }),
42046
42056
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "0% used" }),
@@ -42054,14 +42064,14 @@ function Sidebar({ compact = false }) {
42054
42064
  /* @__PURE__ */ jsx("box", { style: { marginTop: 1 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.text, children: /* @__PURE__ */ jsx("b", { children: "LSP" }) }) }),
42055
42065
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "LSPs are disabled" }),
42056
42066
  /* @__PURE__ */ jsx("box", { style: { flexGrow: 1 } }),
42057
- /* @__PURE__ */ jsx("box", { style: { marginTop: 1 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: cwd }) }),
42067
+ /* @__PURE__ */ jsx("box", { style: { marginTop: 1 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: s(cwd) }) }),
42058
42068
  /* @__PURE__ */ jsxs("box", { children: [
42059
42069
  /* @__PURE__ */ jsx("text", { fg: colors2.primary, children: /* @__PURE__ */ jsxs("b", { children: [
42060
42070
  "\u25CF ",
42061
- APP_NAME,
42071
+ s(APP_NAME),
42062
42072
  " "
42063
42073
  ] }) }),
42064
- /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: APP_VERSION })
42074
+ /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: s(APP_VERSION) })
42065
42075
  ] })
42066
42076
  ]
42067
42077
  }
@@ -42081,10 +42091,10 @@ function MessageBubble({ msg }) {
42081
42091
  }, children: [
42082
42092
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: /* @__PURE__ */ jsxs("b", { children: [
42083
42093
  "[Tool result for ",
42084
- msg.toolName ?? "tool",
42094
+ s(msg.toolName ?? "tool"),
42085
42095
  "]"
42086
42096
  ] }) }),
42087
- /* @__PURE__ */ jsx("scrollbox", { style: { maxHeight: 10, backgroundColor: colors2.bgAlt }, children: /* @__PURE__ */ jsx("text", { fg: colors2.textSecondary, children: msg.content.length > 4e3 ? msg.content.slice(0, 4e3) + "\n... (truncated)" : msg.content }) })
42097
+ /* @__PURE__ */ jsx("scrollbox", { style: { maxHeight: 10, backgroundColor: colors2.bgAlt }, children: /* @__PURE__ */ jsx("text", { fg: colors2.textSecondary, children: s(msg.content.length > 4e3 ? msg.content.slice(0, 4e3) + "\n... (truncated)" : msg.content) }) })
42088
42098
  ] });
42089
42099
  }
42090
42100
  return /* @__PURE__ */ jsxs("box", { style: {
@@ -42099,21 +42109,21 @@ function MessageBubble({ msg }) {
42099
42109
  }, children: [
42100
42110
  /* @__PURE__ */ jsxs("box", { style: { flexDirection: "row", gap: 1, marginBottom: 0 }, children: [
42101
42111
  /* @__PURE__ */ jsx("text", { fg: isUser ? colors2.primary : colors2.textSecondary, children: /* @__PURE__ */ jsx("b", { children: isUser ? "You" : "Assistant" }) }),
42102
- /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: msg.timestamp.toLocaleTimeString() })
42112
+ /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: s(msg.timestamp.toLocaleTimeString()) })
42103
42113
  ] }),
42104
- /* @__PURE__ */ jsx("scrollbox", { style: { maxHeight: 40 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.text, wrapMode: "word", children: msg.content || (isUser ? "" : " ") }) }),
42105
- msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */ jsx("box", { style: { marginTop: 0, flexDirection: "column" }, children: msg.toolCalls.map((tc) => /* @__PURE__ */ jsx("box", { style: { flexDirection: "row", gap: 1 }, children: /* @__PURE__ */ jsx("text", { fg: tc.status === "error" ? colors2.error : colors2.info, children: /* @__PURE__ */ jsxs("b", { children: [
42114
+ /* @__PURE__ */ jsx("scrollbox", { style: { maxHeight: 40 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.text, wrapMode: "word", children: s(msg.content || (isUser ? "" : " ")) }) }),
42115
+ msg.toolCalls && msg.toolCalls.length > 0 ? /* @__PURE__ */ jsx("box", { style: { marginTop: 0, flexDirection: "column" }, children: msg.toolCalls.map((tc) => /* @__PURE__ */ jsx("box", { style: { flexDirection: "row", gap: 1 }, children: /* @__PURE__ */ jsx("text", { fg: tc.status === "error" ? colors2.error : colors2.info, children: /* @__PURE__ */ jsxs("b", { children: [
42106
42116
  "[",
42107
- tc.name,
42117
+ s(tc.name),
42108
42118
  tc.status === "done" ? " \u2713" : tc.status === "error" ? " \u2717" : "\u2026",
42109
42119
  "]"
42110
- ] }) }) }, tc.id)) })
42120
+ ] }) }) }, s(tc.id))) }) : null
42111
42121
  ] });
42112
42122
  }
42113
42123
  function MessageContainer() {
42114
42124
  const { messages } = useSession();
42115
42125
  const { colors: colors2 } = useTheme();
42116
- return /* @__PURE__ */ jsx("scrollbox", { style: { flexGrow: 1, backgroundColor: colors2.bg, paddingLeft: 1, paddingRight: 1 }, children: /* @__PURE__ */ jsx("box", { style: { flexDirection: "column", gap: 1, paddingTop: 1 }, children: messages.map((msg) => /* @__PURE__ */ jsx(MessageBubble, { msg }, msg.id)) }) });
42126
+ return /* @__PURE__ */ jsx("scrollbox", { style: { flexGrow: 1, backgroundColor: colors2.bg, paddingLeft: 1, paddingRight: 1 }, children: /* @__PURE__ */ jsx("box", { style: { flexDirection: "column", gap: 1, paddingTop: 1 }, children: messages.map((msg) => /* @__PURE__ */ jsx(MessageBubble, { msg }, s(msg.id))) }) });
42117
42127
  }
42118
42128
  function InputEditor({
42119
42129
  onSubmit,
@@ -42149,10 +42159,10 @@ function InputEditor({
42149
42159
  "input",
42150
42160
  {
42151
42161
  ref: inputRef,
42152
- value,
42153
- onChange: (val) => setValue(String(val)),
42162
+ value: s(value),
42163
+ onChange: (val) => setValue(s(val)),
42154
42164
  onSubmit: () => doSubmit(),
42155
- placeholder,
42165
+ placeholder: s(placeholder),
42156
42166
  placeholderColor: colors2.textMuted,
42157
42167
  textColor: colors2.text,
42158
42168
  backgroundColor: colors2.inputBg
@@ -42178,10 +42188,10 @@ function InputEditor({
42178
42188
  "input",
42179
42189
  {
42180
42190
  ref: inputRef,
42181
- value,
42182
- onChange: (val) => setValue(String(val)),
42191
+ value: s(value),
42192
+ onChange: (val) => setValue(s(val)),
42183
42193
  onSubmit: () => doSubmit(),
42184
- placeholder,
42194
+ placeholder: s(placeholder),
42185
42195
  placeholderColor: colors2.textMuted,
42186
42196
  textColor: colors2.text,
42187
42197
  backgroundColor: colors2.inputBg
@@ -42298,9 +42308,9 @@ function ModelAgentDialog() {
42298
42308
  const item = it;
42299
42309
  const id = item.id;
42300
42310
  const name25 = item.name;
42301
- const subtitle = isAgent ? item.model ?? "" : `${item.provider ?? ""} \xB7 ${Math.round((item.contextWindow ?? 0) / 1e3)}k ctx`;
42311
+ const ctxK = Math.round((item.contextWindow ?? 0) / 1e3);
42312
+ const subtitle = isAgent ? s(item.model ?? "") : `${s(item.provider ?? "")} \xB7 ${s(ctxK)}k ctx`;
42302
42313
  const isCurrent = isAgent ? currentAgent.id === id : currentModel === id;
42303
- const selected = i === selectedIdx.current;
42304
42314
  return /* @__PURE__ */ jsxs(
42305
42315
  "box",
42306
42316
  {
@@ -42309,20 +42319,20 @@ function ModelAgentDialog() {
42309
42319
  paddingRight: 1,
42310
42320
  paddingTop: 0,
42311
42321
  paddingBottom: 0,
42312
- backgroundColor: selected ? colors2.primaryDim : "transparent",
42322
+ backgroundColor: i === selectedIdx.current ? colors2.primaryDim : "transparent",
42313
42323
  flexDirection: "row",
42314
42324
  justifyContent: "space-between",
42315
42325
  width: "100%"
42316
42326
  },
42317
42327
  children: [
42318
42328
  /* @__PURE__ */ jsxs("box", { style: { flexDirection: "column" }, children: [
42319
- /* @__PURE__ */ jsx("text", { fg: colors2.text, children: /* @__PURE__ */ jsx("b", { children: name25 }) }),
42320
- /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: subtitle })
42329
+ /* @__PURE__ */ jsx("text", { fg: colors2.text, children: /* @__PURE__ */ jsx("b", { children: s(name25) }) }),
42330
+ /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: s(subtitle) })
42321
42331
  ] }),
42322
- isCurrent && /* @__PURE__ */ jsx("text", { fg: colors2.success, children: /* @__PURE__ */ jsx("b", { children: "\u25C9" }) })
42332
+ isCurrent ? /* @__PURE__ */ jsx("text", { fg: colors2.success, children: /* @__PURE__ */ jsx("b", { children: "\u25C9" }) }) : null
42323
42333
  ]
42324
42334
  },
42325
- id
42335
+ s(id)
42326
42336
  );
42327
42337
  }) }) }),
42328
42338
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "\u2191\u2193 navigate \xB7 tab switch \xB7 Enter select \xB7 Esc close" })
@@ -42357,15 +42367,15 @@ function ToastContainer() {
42357
42367
  {
42358
42368
  fg: t.kind === "error" ? colors2.error : t.kind === "warning" ? colors2.warning : t.kind === "success" ? colors2.success : colors2.info,
42359
42369
  children: /* @__PURE__ */ jsxs("b", { children: [
42360
- t.kind.toUpperCase(),
42370
+ s(t.kind.toUpperCase()),
42361
42371
  ":"
42362
42372
  ] })
42363
42373
  }
42364
42374
  ),
42365
- /* @__PURE__ */ jsx("text", { fg: colors2.text, style: { paddingLeft: 1 }, children: t.message })
42375
+ /* @__PURE__ */ jsx("text", { fg: colors2.text, style: { paddingLeft: 1 }, children: s(t.message) })
42366
42376
  ]
42367
42377
  },
42368
- t.id
42378
+ s(t.id)
42369
42379
  )) });
42370
42380
  }
42371
42381
  function App() {
@@ -42500,11 +42510,11 @@ function App() {
42500
42510
  /* @__PURE__ */ jsx(ShortcutHints, { interrupted: isRunning })
42501
42511
  ] })
42502
42512
  ] }),
42503
- sidebarVisible ? /* @__PURE__ */ jsx(Sidebar, { compact: false }) : infoCompact && /* @__PURE__ */ jsx(Sidebar, { compact: true })
42513
+ sidebarVisible ? /* @__PURE__ */ jsx(Sidebar, { compact: false }) : infoCompact ? /* @__PURE__ */ jsx(Sidebar, { compact: true }) : null
42504
42514
  ] }),
42505
42515
  /* @__PURE__ */ jsx(StatusBar, {}),
42506
- isOpen && dialog.type === "model" && /* @__PURE__ */ jsx(ModelAgentDialog, {}),
42507
- isOpen && dialog.type === "help" && /* @__PURE__ */ jsx(HelpDialog, {}),
42516
+ isOpen && dialog.type === "model" ? /* @__PURE__ */ jsx(ModelAgentDialog, {}) : null,
42517
+ isOpen && dialog.type === "help" ? /* @__PURE__ */ jsx(HelpDialog, {}) : null,
42508
42518
  /* @__PURE__ */ jsx(ToastContainer, {})
42509
42519
  ] });
42510
42520
  }
@@ -43040,7 +43050,7 @@ Fetching ${url2} (${method})...
43040
43050
  if (action === "remove" && args && args.length > 0) {
43041
43051
  const config2 = getConfig();
43042
43052
  const servers = config2.getNested("mcp.servers") || [];
43043
- const filtered = servers.filter((s) => s.id !== args[0]);
43053
+ const filtered = servers.filter((s2) => s2.id !== args[0]);
43044
43054
  config2.setNested("mcp.servers", filtered);
43045
43055
  console.log(`Removed MCP server: ${args[0]}`);
43046
43056
  return;