bravecode-cli 0.1.23 → 0.1.25

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.23";
38188
+ APP_VERSION = "0.1.25";
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
  ]
@@ -41934,17 +41944,13 @@ function StatusBar() {
41934
41944
  alignItems: "center"
41935
41945
  },
41936
41946
  children: [
41947
+ /* @__PURE__ */ jsx("text", { fg: colors2.success, children: /* @__PURE__ */ jsx("b", { children: "\u25CF" }) }),
41948
+ /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: " 1 MCP " }),
41949
+ /* @__PURE__ */ jsx("text", { fg: colors2.info, children: "/status" }),
41950
+ /* @__PURE__ */ jsx("text", { fg: colors2.primary, children: /* @__PURE__ */ jsx("b", { children: s(APP_NAME) }) }),
41937
41951
  /* @__PURE__ */ jsxs("text", { fg: colors2.textMuted, children: [
41938
- /* @__PURE__ */ jsx("text", { fg: colors2.success, children: /* @__PURE__ */ jsx("b", { children: "\u25CF" }) }),
41939
- /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: " 1 MCP " }),
41940
- /* @__PURE__ */ jsx("text", { fg: colors2.info, children: "/status" })
41941
- ] }),
41942
- /* @__PURE__ */ jsxs("text", { fg: colors2.textMuted, children: [
41943
- /* @__PURE__ */ jsx("text", { fg: colors2.primary, children: /* @__PURE__ */ jsx("b", { children: APP_NAME }) }),
41944
- /* @__PURE__ */ jsxs("text", { fg: colors2.textMuted, children: [
41945
- " ",
41946
- APP_VERSION
41947
- ] })
41952
+ " ",
41953
+ s(APP_VERSION)
41948
41954
  ] })
41949
41955
  ]
41950
41956
  }
@@ -41956,13 +41962,13 @@ function AgentModelLine({ inline = false }) {
41956
41962
  return /* @__PURE__ */ jsxs("box", { style: { flexDirection: "row", gap: 1, ...inline ? {} : { paddingLeft: 1, paddingRight: 1, marginTop: 0, marginBottom: 0 } }, children: [
41957
41963
  /* @__PURE__ */ jsx("text", { fg: colors2.primary, children: /* @__PURE__ */ jsxs("b", { children: [
41958
41964
  "\u25FC ",
41959
- currentAgent.name.replace(" Agent", "")
41965
+ s(currentAgent.name.replace(" Agent", ""))
41960
41966
  ] }) }),
41961
41967
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "\xB7" }),
41962
- /* @__PURE__ */ jsx("text", { fg: colors2.textSecondary, children: currentModel }),
41968
+ /* @__PURE__ */ jsx("text", { fg: colors2.textSecondary, children: s(currentModel) }),
41963
41969
  /* @__PURE__ */ jsx("text", { fg: colors2.success, children: "Free" }),
41964
41970
  /* @__PURE__ */ jsx("text", { fg: colors2.accent, children: "OpenCode Zen" }),
41965
- isRunning && /* @__PURE__ */ jsx("text", { fg: colors2.warning, children: "\xB7 generating\u2026" })
41971
+ isRunning ? /* @__PURE__ */ jsx("text", { fg: colors2.warning, children: "\xB7 generating\u2026" }) : null
41966
41972
  ] });
41967
41973
  }
41968
41974
  function ShortcutHints({ interrupted = false }) {
@@ -41982,7 +41988,7 @@ function PixelLogo() {
41982
41988
  \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
41989
  `;
41984
41990
  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)) });
41991
+ 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
41992
  }
41987
41993
  function Sidebar({ compact = false }) {
41988
41994
  const { colors: colors2 } = useTheme();
@@ -42006,18 +42012,18 @@ function Sidebar({ compact = false }) {
42006
42012
  /* @__PURE__ */ jsx("text", { fg: colors2.text, children: /* @__PURE__ */ jsx("b", { children: "Info" }) }),
42007
42013
  /* @__PURE__ */ jsxs("box", { style: { marginTop: 1 }, children: [
42008
42014
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "agent " }),
42009
- /* @__PURE__ */ jsx("text", { fg: colors2.primary, children: currentAgent.name.replace(" Agent", "") })
42015
+ /* @__PURE__ */ jsx("text", { fg: colors2.primary, children: s(currentAgent.name.replace(" Agent", "")) })
42010
42016
  ] }),
42011
42017
  /* @__PURE__ */ jsxs("text", { fg: colors2.textMuted, children: [
42012
42018
  "model ",
42013
- currentModel
42019
+ s(currentModel)
42014
42020
  ] }),
42015
42021
  /* @__PURE__ */ jsxs("box", { style: { marginTop: 1 }, children: [
42016
42022
  /* @__PURE__ */ jsx("text", { fg: colors2.success, children: "\u25CF" }),
42017
42023
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: " mcp connected" })
42018
42024
  ] }),
42019
42025
  /* @__PURE__ */ jsx("box", { style: { flexGrow: 1 } }),
42020
- /* @__PURE__ */ jsx("box", { style: { marginTop: 1 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: APP_VERSION }) }),
42026
+ /* @__PURE__ */ jsx("box", { style: { marginTop: 1 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: s(APP_VERSION) }) }),
42021
42027
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "ctrl+b sidebar" })
42022
42028
  ]
42023
42029
  }
@@ -42038,9 +42044,9 @@ function Sidebar({ compact = false }) {
42038
42044
  children: [
42039
42045
  /* @__PURE__ */ jsx("text", { fg: colors2.text, children: /* @__PURE__ */ jsxs("b", { children: [
42040
42046
  "New session - ",
42041
- sessionTime.slice(0, 17)
42047
+ s(sessionTime.slice(0, 17))
42042
42048
  ] }) }),
42043
- /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: sessionTime.slice(17) }),
42049
+ /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: s(sessionTime.slice(17)) }),
42044
42050
  /* @__PURE__ */ jsx("box", { style: { marginTop: 1 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.text, children: /* @__PURE__ */ jsx("b", { children: "Context" }) }) }),
42045
42051
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "0 tokens" }),
42046
42052
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "0% used" }),
@@ -42054,14 +42060,14 @@ function Sidebar({ compact = false }) {
42054
42060
  /* @__PURE__ */ jsx("box", { style: { marginTop: 1 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.text, children: /* @__PURE__ */ jsx("b", { children: "LSP" }) }) }),
42055
42061
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "LSPs are disabled" }),
42056
42062
  /* @__PURE__ */ jsx("box", { style: { flexGrow: 1 } }),
42057
- /* @__PURE__ */ jsx("box", { style: { marginTop: 1 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: cwd }) }),
42063
+ /* @__PURE__ */ jsx("box", { style: { marginTop: 1 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: s(cwd) }) }),
42058
42064
  /* @__PURE__ */ jsxs("box", { children: [
42059
42065
  /* @__PURE__ */ jsx("text", { fg: colors2.primary, children: /* @__PURE__ */ jsxs("b", { children: [
42060
42066
  "\u25CF ",
42061
- APP_NAME,
42067
+ s(APP_NAME),
42062
42068
  " "
42063
42069
  ] }) }),
42064
- /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: APP_VERSION })
42070
+ /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: s(APP_VERSION) })
42065
42071
  ] })
42066
42072
  ]
42067
42073
  }
@@ -42081,10 +42087,10 @@ function MessageBubble({ msg }) {
42081
42087
  }, children: [
42082
42088
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: /* @__PURE__ */ jsxs("b", { children: [
42083
42089
  "[Tool result for ",
42084
- msg.toolName ?? "tool",
42090
+ s(msg.toolName ?? "tool"),
42085
42091
  "]"
42086
42092
  ] }) }),
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 }) })
42093
+ /* @__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
42094
  ] });
42089
42095
  }
42090
42096
  return /* @__PURE__ */ jsxs("box", { style: {
@@ -42099,21 +42105,21 @@ function MessageBubble({ msg }) {
42099
42105
  }, children: [
42100
42106
  /* @__PURE__ */ jsxs("box", { style: { flexDirection: "row", gap: 1, marginBottom: 0 }, children: [
42101
42107
  /* @__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() })
42108
+ /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: s(msg.timestamp.toLocaleTimeString()) })
42103
42109
  ] }),
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: [
42110
+ /* @__PURE__ */ jsx("scrollbox", { style: { maxHeight: 40 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.text, wrapMode: "word", children: s(msg.content || (isUser ? "" : " ")) }) }),
42111
+ 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
42112
  "[",
42107
- tc.name,
42113
+ s(tc.name),
42108
42114
  tc.status === "done" ? " \u2713" : tc.status === "error" ? " \u2717" : "\u2026",
42109
42115
  "]"
42110
- ] }) }) }, tc.id)) })
42116
+ ] }) }) }, s(tc.id))) }) : null
42111
42117
  ] });
42112
42118
  }
42113
42119
  function MessageContainer() {
42114
42120
  const { messages } = useSession();
42115
42121
  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)) }) });
42122
+ 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
42123
  }
42118
42124
  function InputEditor({
42119
42125
  onSubmit,
@@ -42149,10 +42155,10 @@ function InputEditor({
42149
42155
  "input",
42150
42156
  {
42151
42157
  ref: inputRef,
42152
- value,
42153
- onChange: (val) => setValue(String(val)),
42158
+ value: s(value),
42159
+ onChange: (val) => setValue(s(val)),
42154
42160
  onSubmit: () => doSubmit(),
42155
- placeholder,
42161
+ placeholder: s(placeholder),
42156
42162
  placeholderColor: colors2.textMuted,
42157
42163
  textColor: colors2.text,
42158
42164
  backgroundColor: colors2.inputBg
@@ -42178,10 +42184,10 @@ function InputEditor({
42178
42184
  "input",
42179
42185
  {
42180
42186
  ref: inputRef,
42181
- value,
42182
- onChange: (val) => setValue(String(val)),
42187
+ value: s(value),
42188
+ onChange: (val) => setValue(s(val)),
42183
42189
  onSubmit: () => doSubmit(),
42184
- placeholder,
42190
+ placeholder: s(placeholder),
42185
42191
  placeholderColor: colors2.textMuted,
42186
42192
  textColor: colors2.text,
42187
42193
  backgroundColor: colors2.inputBg
@@ -42211,25 +42217,25 @@ function HelpDialog() {
42211
42217
  children: [
42212
42218
  /* @__PURE__ */ jsx("box", { style: { flexDirection: "row", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx("text", { fg: colors2.primary, children: /* @__PURE__ */ jsx("b", { children: "Help \xB7 Commands & Shortcuts" }) }) }),
42213
42219
  /* @__PURE__ */ jsxs("box", { style: { flexDirection: "column", gap: 0, width: "100%" }, children: [
42214
- /* @__PURE__ */ jsxs("text", { fg: colors2.text, children: [
42220
+ /* @__PURE__ */ jsxs("box", { style: { flexDirection: "row" }, children: [
42215
42221
  /* @__PURE__ */ jsx("text", { fg: colors2.accent, children: /* @__PURE__ */ jsx("b", { children: "Tab" }) }),
42216
- " \u2014 cycle agent"
42222
+ /* @__PURE__ */ jsx("text", { fg: colors2.text, children: " \u2014 cycle agent" })
42217
42223
  ] }),
42218
- /* @__PURE__ */ jsxs("text", { fg: colors2.text, children: [
42224
+ /* @__PURE__ */ jsxs("box", { style: { flexDirection: "row" }, children: [
42219
42225
  /* @__PURE__ */ jsx("text", { fg: colors2.accent, children: /* @__PURE__ */ jsx("b", { children: "Ctrl+P" }) }),
42220
- " \u2014 model/commands palette"
42226
+ /* @__PURE__ */ jsx("text", { fg: colors2.text, children: " \u2014 model/commands palette" })
42221
42227
  ] }),
42222
- /* @__PURE__ */ jsxs("text", { fg: colors2.text, children: [
42228
+ /* @__PURE__ */ jsxs("box", { style: { flexDirection: "row" }, children: [
42223
42229
  /* @__PURE__ */ jsx("text", { fg: colors2.accent, children: /* @__PURE__ */ jsx("b", { children: "Ctrl+B" }) }),
42224
- " \u2014 toggle sidebar"
42230
+ /* @__PURE__ */ jsx("text", { fg: colors2.text, children: " \u2014 toggle sidebar" })
42225
42231
  ] }),
42226
- /* @__PURE__ */ jsxs("text", { fg: colors2.text, children: [
42232
+ /* @__PURE__ */ jsxs("box", { style: { flexDirection: "row" }, children: [
42227
42233
  /* @__PURE__ */ jsx("text", { fg: colors2.accent, children: /* @__PURE__ */ jsx("b", { children: "Esc" }) }),
42228
- " \u2014 interrupt / close dialog"
42234
+ /* @__PURE__ */ jsx("text", { fg: colors2.text, children: " \u2014 interrupt / close dialog" })
42229
42235
  ] }),
42230
- /* @__PURE__ */ jsxs("text", { fg: colors2.text, children: [
42236
+ /* @__PURE__ */ jsxs("box", { style: { flexDirection: "row" }, children: [
42231
42237
  /* @__PURE__ */ jsx("text", { fg: colors2.accent, children: /* @__PURE__ */ jsx("b", { children: "Ctrl+C" }) }),
42232
- " \u2014 exit (when idle)"
42238
+ /* @__PURE__ */ jsx("text", { fg: colors2.text, children: " \u2014 exit (when idle)" })
42233
42239
  ] })
42234
42240
  ] }),
42235
42241
  /* @__PURE__ */ jsx("box", { style: { flexDirection: "column", gap: 0, marginTop: 1, width: "100%" }, children: /* @__PURE__ */ jsx("text", { fg: colors2.textSecondary, children: "/help \xB7 /models \xB7 /agents \xB7 /clear \xB7 /exit" }) })
@@ -42298,9 +42304,9 @@ function ModelAgentDialog() {
42298
42304
  const item = it;
42299
42305
  const id = item.id;
42300
42306
  const name25 = item.name;
42301
- const subtitle = isAgent ? item.model ?? "" : `${item.provider ?? ""} \xB7 ${Math.round((item.contextWindow ?? 0) / 1e3)}k ctx`;
42307
+ const ctxK = Math.round((item.contextWindow ?? 0) / 1e3);
42308
+ const subtitle = isAgent ? s(item.model ?? "") : `${s(item.provider ?? "")} \xB7 ${s(ctxK)}k ctx`;
42302
42309
  const isCurrent = isAgent ? currentAgent.id === id : currentModel === id;
42303
- const selected = i === selectedIdx.current;
42304
42310
  return /* @__PURE__ */ jsxs(
42305
42311
  "box",
42306
42312
  {
@@ -42309,20 +42315,20 @@ function ModelAgentDialog() {
42309
42315
  paddingRight: 1,
42310
42316
  paddingTop: 0,
42311
42317
  paddingBottom: 0,
42312
- backgroundColor: selected ? colors2.primaryDim : "transparent",
42318
+ backgroundColor: i === selectedIdx.current ? colors2.primaryDim : "transparent",
42313
42319
  flexDirection: "row",
42314
42320
  justifyContent: "space-between",
42315
42321
  width: "100%"
42316
42322
  },
42317
42323
  children: [
42318
42324
  /* @__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 })
42325
+ /* @__PURE__ */ jsx("text", { fg: colors2.text, children: /* @__PURE__ */ jsx("b", { children: s(name25) }) }),
42326
+ /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: s(subtitle) })
42321
42327
  ] }),
42322
- isCurrent && /* @__PURE__ */ jsx("text", { fg: colors2.success, children: /* @__PURE__ */ jsx("b", { children: "\u25C9" }) })
42328
+ isCurrent ? /* @__PURE__ */ jsx("text", { fg: colors2.success, children: /* @__PURE__ */ jsx("b", { children: "\u25C9" }) }) : null
42323
42329
  ]
42324
42330
  },
42325
- id
42331
+ s(id)
42326
42332
  );
42327
42333
  }) }) }),
42328
42334
  /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "\u2191\u2193 navigate \xB7 tab switch \xB7 Enter select \xB7 Esc close" })
@@ -42357,15 +42363,15 @@ function ToastContainer() {
42357
42363
  {
42358
42364
  fg: t.kind === "error" ? colors2.error : t.kind === "warning" ? colors2.warning : t.kind === "success" ? colors2.success : colors2.info,
42359
42365
  children: /* @__PURE__ */ jsxs("b", { children: [
42360
- t.kind.toUpperCase(),
42366
+ s(t.kind.toUpperCase()),
42361
42367
  ":"
42362
42368
  ] })
42363
42369
  }
42364
42370
  ),
42365
- /* @__PURE__ */ jsx("text", { fg: colors2.text, style: { paddingLeft: 1 }, children: t.message })
42371
+ /* @__PURE__ */ jsx("text", { fg: colors2.text, style: { paddingLeft: 1 }, children: s(t.message) })
42366
42372
  ]
42367
42373
  },
42368
- t.id
42374
+ s(t.id)
42369
42375
  )) });
42370
42376
  }
42371
42377
  function App() {
@@ -42500,11 +42506,11 @@ function App() {
42500
42506
  /* @__PURE__ */ jsx(ShortcutHints, { interrupted: isRunning })
42501
42507
  ] })
42502
42508
  ] }),
42503
- sidebarVisible ? /* @__PURE__ */ jsx(Sidebar, { compact: false }) : infoCompact && /* @__PURE__ */ jsx(Sidebar, { compact: true })
42509
+ sidebarVisible ? /* @__PURE__ */ jsx(Sidebar, { compact: false }) : infoCompact ? /* @__PURE__ */ jsx(Sidebar, { compact: true }) : null
42504
42510
  ] }),
42505
42511
  /* @__PURE__ */ jsx(StatusBar, {}),
42506
- isOpen && dialog.type === "model" && /* @__PURE__ */ jsx(ModelAgentDialog, {}),
42507
- isOpen && dialog.type === "help" && /* @__PURE__ */ jsx(HelpDialog, {}),
42512
+ isOpen && dialog.type === "model" ? /* @__PURE__ */ jsx(ModelAgentDialog, {}) : null,
42513
+ isOpen && dialog.type === "help" ? /* @__PURE__ */ jsx(HelpDialog, {}) : null,
42508
42514
  /* @__PURE__ */ jsx(ToastContainer, {})
42509
42515
  ] });
42510
42516
  }
@@ -43040,7 +43046,7 @@ Fetching ${url2} (${method})...
43040
43046
  if (action === "remove" && args && args.length > 0) {
43041
43047
  const config2 = getConfig();
43042
43048
  const servers = config2.getNested("mcp.servers") || [];
43043
- const filtered = servers.filter((s) => s.id !== args[0]);
43049
+ const filtered = servers.filter((s2) => s2.id !== args[0]);
43044
43050
  config2.setNested("mcp.servers", filtered);
43045
43051
  console.log(`Removed MCP server: ${args[0]}`);
43046
43052
  return;