zen-code 3.0.0 → 3.0.1

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.
@@ -1,22 +1,22 @@
1
1
  import { a as x, R as ve, B as _, F as hn, j as d, T as w, u as Ft, r as fn } from "./use-input-1eSjZocJ.mjs";
2
2
  import pe from "chalk";
3
- import { a as xe, S as Ir, u as Ut, M as Bt, c as mn, g as gn, b as pn } from "./get_allowed_models-I8bki8ev.mjs";
3
+ import { a as xe, S as Er, u as Ut, M as Bt, c as mn, g as gn, b as pn } from "./get_allowed_models-CHQu5hlT.mjs";
4
4
  import yn from "node:os";
5
5
  import { g as wn } from "./_commonjsHelpers-ByX85dGu.mjs";
6
6
  import T, { z as D } from "zod";
7
- import { Z as O, s as J, a as Er, b as bn, i as _n, c as vn, d as xn, e as Sn, f as Tn, m as Cn, k as jn, A as In, h as En, j as An, g as kn, l as Mn, n as Pn, t as Dn, o as Rn, q as On, v as Ar, w as Nn, x as Ln, y as $n, M as Fn } from "./graphBuilder-BttmR-dZ.mjs";
7
+ import { Z as O, s as J, a as Ar, b as bn, i as _n, c as vn, d as xn, e as Sn, f as Tn, m as Cn, k as jn, A as In, h as En, j as An, g as kn, l as Mn, n as Pn, t as Dn, o as Rn, q as On, v as kr, w as Nn, x as Ln, y as $n, M as Fn } from "./graphBuilder-BIhxVliV.mjs";
8
8
  import { parse as Un } from "marked";
9
9
  import Bn from "marked-terminal";
10
10
  import { c as kt } from "./index-P-c4tqBO.mjs";
11
11
  import { readdirSync as zn, readFileSync as Hn } from "node:fs";
12
- import Vt, { join as ke } from "node:path";
12
+ import Yt, { join as ke } from "node:path";
13
13
  import { Low as Gn } from "lowdb";
14
14
  import { JSONFile as Wn } from "lowdb/node";
15
15
  import "yaml";
16
16
  import { Command as Zn, Send as Jn } from "@langchain/langgraph";
17
17
  import "langchain";
18
18
  import qt from "node-notifier";
19
- function kr(t) {
19
+ function Mr(t) {
20
20
  const { items: e, children: r, style: n } = t, [i, s] = x.useState(0), a = x.useMemo(() => e.slice(i), [e, i]);
21
21
  x.useLayoutEffect(() => {
22
22
  s(e.length);
@@ -31,7 +31,7 @@ function kr(t) {
31
31
  function it() {
32
32
  return ve.createElement(_, { flexGrow: 1 });
33
33
  }
34
- const Mr = () => {
34
+ const zt = () => {
35
35
  const t = x.useContext(hn);
36
36
  return {
37
37
  enableFocus: t.enableFocus,
@@ -65,7 +65,7 @@ function Dr(t) {
65
65
  const Vn = () => process.env.TERM?.includes("256color") || process.env.TERM === "xterm-256color" || process.env.WT_SESSION !== void 0 || // Windows Terminal
66
66
  process.platform === "darwin" || // Mac usually supports
67
67
  process.env.TERM_PROGRAM === "vscode" || // VSCode
68
- process.env.TERM_PROGRAM === "iTerm.app", qn = () => process.env.TERM_PROGRAM === "iTerm.app" ? "iTerm2" : process.env.WT_SESSION !== void 0 ? "Windows Terminal" : process.env.TERM_PROGRAM === "vscode" ? "VSCode" : process.env.TERM?.includes("screen") ? "GNU Screen" : process.env.TERM?.includes("tmux") ? "tmux" : process.env.TERM || "unknown", gt = {
68
+ process.env.TERM_PROGRAM === "iTerm.app", Yn = () => process.env.TERM_PROGRAM === "iTerm.app" ? "iTerm2" : process.env.WT_SESSION !== void 0 ? "Windows Terminal" : process.env.TERM_PROGRAM === "vscode" ? "VSCode" : process.env.TERM?.includes("screen") ? "GNU Screen" : process.env.TERM?.includes("tmux") ? "tmux" : process.env.TERM || "unknown", gt = {
69
69
  // Status Colors
70
70
  success: {
71
71
  hex: "#4fd6be",
@@ -242,7 +242,7 @@ function Rr() {
242
242
  }
243
243
  }
244
244
  var ae = /* @__PURE__ */ ((t) => (t.Pending = "pending", t.Approved = "approved", t.Edited = "edited", t.Rejected = "rejected", t))(ae || {});
245
- const Yn = x.createContext(null), Kn = ({
245
+ const qn = x.createContext(null), Kn = ({
246
246
  children: t
247
247
  }) => {
248
248
  const [e, r] = x.useState([]), [n, i] = x.useState(null), s = x.useCallback(async (y) => {
@@ -329,7 +329,7 @@ const Yn = x.createContext(null), Kn = ({
329
329
  }),
330
330
  [e, o, l, c, u, f, h, m, g]
331
331
  );
332
- return /* @__PURE__ */ d.jsx(Yn.Provider, { value: p, children: t });
332
+ return /* @__PURE__ */ d.jsx(qn.Provider, { value: p, children: t });
333
333
  }, Or = x.createContext(null), Xn = ({ children: t }) => {
334
334
  const [e, r] = x.useState(""), n = x.useCallback(() => {
335
335
  r("");
@@ -503,9 +503,9 @@ const Yn = x.createContext(null), Kn = ({
503
503
  ] }) })
504
504
  ] });
505
505
  };
506
- var pt = { exports: {} }, Yt;
506
+ var pt = { exports: {} }, Kt;
507
507
  function rs() {
508
- return Yt || (Yt = 1, (function(t) {
508
+ return Kt || (Kt = 1, (function(t) {
509
509
  var e = Object.prototype.hasOwnProperty, r = "~";
510
510
  function n() {
511
511
  }
@@ -611,7 +611,7 @@ function rs() {
611
611
  })(pt)), pt.exports;
612
612
  }
613
613
  var ns = rs();
614
- const zt = /* @__PURE__ */ wn(ns), ss = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use"), is = {
614
+ const Ht = /* @__PURE__ */ wn(ns), ss = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use"), is = {
615
615
  name: void 0,
616
616
  $refStrategy: "root",
617
617
  basePath: ["#"],
@@ -847,7 +847,7 @@ function Hr(t, e) {
847
847
  if (e.target === "openApi3")
848
848
  return r;
849
849
  if (t.keyType?._def.typeName === O.ZodString && t.keyType._def.checks?.length) {
850
- const { type: n, ...i } = Er(t.keyType._def, e);
850
+ const { type: n, ...i } = Ar(t.keyType._def, e);
851
851
  return {
852
852
  ...r,
853
853
  propertyNames: i
@@ -923,7 +923,7 @@ const tt = {
923
923
  };
924
924
  function Ss(t, e) {
925
925
  if (e.target === "openApi3")
926
- return Kt(t, e);
926
+ return Xt(t, e);
927
927
  const r = t.options instanceof Map ? Array.from(t.options.values()) : t.options;
928
928
  if (r.every((n) => n._def.typeName in tt && (!n._def.checks || !n._def.checks.length))) {
929
929
  const n = r.reduce((i, s) => {
@@ -965,9 +965,9 @@ function Ss(t, e) {
965
965
  ...i._def.values.filter((s) => !n.includes(s))
966
966
  ], [])
967
967
  };
968
- return Kt(t, e);
968
+ return Xt(t, e);
969
969
  }
970
- const Kt = (t, e) => {
970
+ const Xt = (t, e) => {
971
971
  const r = (t.options instanceof Map ? Array.from(t.options.values()) : t.options).map((n, i) => B(n._def, {
972
972
  ...e,
973
973
  currentPath: [...e.currentPath, "anyOf", `${i}`]
@@ -1143,7 +1143,7 @@ function Os(t) {
1143
1143
  const Ns = (t, e) => B(t.innerType._def, e), Ls = (t, e, r) => {
1144
1144
  switch (e) {
1145
1145
  case O.ZodString:
1146
- return Er(t, r);
1146
+ return Ar(t, r);
1147
1147
  case O.ZodNumber:
1148
1148
  return Cs(t, r);
1149
1149
  case O.ZodObject:
@@ -1543,7 +1543,7 @@ class Ee extends Error {
1543
1543
  super(`${e} at position ${r}`), this.position = r;
1544
1544
  }
1545
1545
  }
1546
- const Wr = 32, Js = 10, Zr = 9, Jr = 13, Qs = 160, Vs = 8192, qs = 8202, Ys = 8239, Ks = 8287, Xs = 12288;
1546
+ const Wr = 32, Js = 10, Zr = 9, Jr = 13, Qs = 160, Vs = 8192, Ys = 8202, qs = 8239, Ks = 8287, Xs = 12288;
1547
1547
  function ei(t) {
1548
1548
  return /^[0-9A-Fa-f]$/.test(t);
1549
1549
  }
@@ -1557,18 +1557,18 @@ function Ve(t) {
1557
1557
  return `,:[]/{}()
1558
1558
  +`.includes(t);
1559
1559
  }
1560
- function Xt(t) {
1560
+ function er(t) {
1561
1561
  return t >= "a" && t <= "z" || t >= "A" && t <= "Z" || t === "_" || t === "$";
1562
1562
  }
1563
- function er(t) {
1563
+ function tr(t) {
1564
1564
  return t >= "a" && t <= "z" || t >= "A" && t <= "Z" || t === "_" || t === "$" || t >= "0" && t <= "9";
1565
1565
  }
1566
- const tr = /^(http|https|ftp|mailto|file|data|irc):\/\/$/, rr = /^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;
1567
- function nr(t) {
1566
+ const rr = /^(http|https|ftp|mailto|file|data|irc):\/\/$/, nr = /^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;
1567
+ function sr(t) {
1568
1568
  return `,[]/{}
1569
1569
  +`.includes(t);
1570
1570
  }
1571
- function sr(t) {
1571
+ function ir(t) {
1572
1572
  return Ke(t) || ri.test(t);
1573
1573
  }
1574
1574
  const ri = /^[[{\w-]$/;
@@ -1586,7 +1586,7 @@ function si(t, e) {
1586
1586
  }
1587
1587
  function ii(t, e) {
1588
1588
  const r = t.charCodeAt(e);
1589
- return r === Qs || r >= Vs && r <= qs || r === Ys || r === Ks || r === Xs;
1589
+ return r === Qs || r >= Vs && r <= Ys || r === qs || r === Ks || r === Xs;
1590
1590
  }
1591
1591
  function Ke(t) {
1592
1592
  return Qr(t) || Mt(t);
@@ -1594,13 +1594,13 @@ function Ke(t) {
1594
1594
  function Qr(t) {
1595
1595
  return t === '"' || t === "“" || t === "”";
1596
1596
  }
1597
- function ir(t) {
1597
+ function ar(t) {
1598
1598
  return t === '"';
1599
1599
  }
1600
1600
  function Mt(t) {
1601
1601
  return t === "'" || t === "‘" || t === "’" || t === "`" || t === "´";
1602
1602
  }
1603
- function ar(t) {
1603
+ function or(t) {
1604
1604
  return t === "'";
1605
1605
  }
1606
1606
  function $e(t, e) {
@@ -1644,7 +1644,7 @@ function ui(t) {
1644
1644
  let e = 0, r = "";
1645
1645
  c(["```", "[```", "{```"]), s() || W(), c(["```", "```]", "```}"]);
1646
1646
  const i = h(",");
1647
- for (i && a(), sr(t[e]) && oi(r) ? (i || (r = re(r, ",")), b()) : i && (r = $e(r, ",")); t[e] === "}" || t[e] === "]"; )
1647
+ for (i && a(), ir(t[e]) && oi(r) ? (i || (r = re(r, ",")), b()) : i && (r = $e(r, ",")); t[e] === "}" || t[e] === "]"; )
1648
1648
  e++, a();
1649
1649
  if (e >= t.length)
1650
1650
  return r;
@@ -1691,8 +1691,8 @@ function ui(t) {
1691
1691
  }
1692
1692
  function c(P) {
1693
1693
  if (u(P)) {
1694
- if (Xt(t[e]))
1695
- for (; e < t.length && er(t[e]); )
1694
+ if (er(t[e]))
1695
+ for (; e < t.length && tr(t[e]); )
1696
1696
  e++;
1697
1697
  return a(), !0;
1698
1698
  }
@@ -1731,7 +1731,7 @@ function ui(t) {
1731
1731
  }
1732
1732
  a();
1733
1733
  const Ce = h(":"), ie = e >= t.length;
1734
- Ce || (sr(t[e]) || ie ? r = re(r, ":") : Te()), s() || (Ce || ie ? r += "null" : Te());
1734
+ Ce || (ir(t[e]) || ie ? r = re(r, ":") : Te()), s() || (Ce || ie ? r += "null" : Te());
1735
1735
  }
1736
1736
  return t[e] === "}" ? (r += "}", e++) : r = re(r, "}"), !0;
1737
1737
  }
@@ -1761,7 +1761,7 @@ ${r}
1761
1761
  function v() {
1762
1762
  let P = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, L = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : -1, F = t[e] === "\\";
1763
1763
  if (F && (e++, F = !0), Ke(t[e])) {
1764
- const Ce = ir(t[e]) ? ir : ar(t[e]) ? ar : Mt(t[e]) ? Mt : Qr, ie = e, E = r.length;
1764
+ const Ce = ar(t[e]) ? ar : or(t[e]) ? or : Mt(t[e]) ? Mt : Qr, ie = e, E = r.length;
1765
1765
  let M = '"';
1766
1766
  for (e++; ; ) {
1767
1767
  if (e >= t.length) {
@@ -1771,7 +1771,7 @@ ${r}
1771
1771
  if (e === L)
1772
1772
  return M = re(M, '"'), r += M, !0;
1773
1773
  if (Ce(t[e])) {
1774
- const N = e, Y = M.length;
1774
+ const N = e, q = M.length;
1775
1775
  if (M += '"', e++, r += M, a(!1), P || e >= t.length || Ve(t[e]) || Ke(t[e]) || ye(t[e]))
1776
1776
  return S(), !0;
1777
1777
  const G = R(N - 1), X = t.charAt(G);
@@ -1779,10 +1779,10 @@ ${r}
1779
1779
  return e = ie, r = r.substring(0, E), v(!1, G);
1780
1780
  if (Ve(X))
1781
1781
  return e = ie, r = r.substring(0, E), v(!0);
1782
- r = r.substring(0, E), e = N + 1, M = `${M.substring(0, Y)}\\${M.substring(Y)}`;
1783
- } else if (P && nr(t[e])) {
1784
- if (t[e - 1] === ":" && tr.test(t.substring(ie + 1, e + 2)))
1785
- for (; e < t.length && rr.test(t[e]); )
1782
+ r = r.substring(0, E), e = N + 1, M = `${M.substring(0, q)}\\${M.substring(q)}`;
1783
+ } else if (P && sr(t[e])) {
1784
+ if (t[e - 1] === ":" && rr.test(t.substring(ie + 1, e + 2)))
1785
+ for (; e < t.length && nr.test(t[e]); )
1786
1786
  M += t[e], e++;
1787
1787
  return M = re(M, '"'), r += M, S(), !0;
1788
1788
  } else if (t[e] === "\\") {
@@ -1857,8 +1857,8 @@ ${r}
1857
1857
  }
1858
1858
  function I(P) {
1859
1859
  const L = e;
1860
- if (Xt(t[e])) {
1861
- for (; e < t.length && er(t[e]); )
1860
+ if (er(t[e])) {
1861
+ for (; e < t.length && tr(t[e]); )
1862
1862
  e++;
1863
1863
  let F = e;
1864
1864
  for (; be(t, F); )
@@ -1866,10 +1866,10 @@ ${r}
1866
1866
  if (t[F] === "(")
1867
1867
  return e = F + 1, s(), t[e] === ")" && (e++, t[e] === ";" && e++), !0;
1868
1868
  }
1869
- for (; e < t.length && !nr(t[e]) && !Ke(t[e]) && (!P || t[e] !== ":"); )
1869
+ for (; e < t.length && !sr(t[e]) && !Ke(t[e]) && (!P || t[e] !== ":"); )
1870
1870
  e++;
1871
- if (t[e - 1] === ":" && tr.test(t.substring(L, e + 2)))
1872
- for (; e < t.length && rr.test(t[e]); )
1871
+ if (t[e - 1] === ":" && rr.test(t.substring(L, e + 2)))
1872
+ for (; e < t.length && nr.test(t[e]); )
1873
1873
  e++;
1874
1874
  if (e > L) {
1875
1875
  for (; be(t, e - 1) && e > 0; )
@@ -1921,7 +1921,7 @@ ${r}
1921
1921
  function di(t, e) {
1922
1922
  return t[e] === "*" && t[e + 1] === "/";
1923
1923
  }
1924
- class Ht {
1924
+ class Gt {
1925
1925
  message;
1926
1926
  client;
1927
1927
  constructor(e, r) {
@@ -1972,7 +1972,7 @@ class Ht {
1972
1972
  }
1973
1973
  }
1974
1974
  get output() {
1975
- return qr(this.message.content);
1975
+ return Yr(this.message.content);
1976
1976
  }
1977
1977
  getJSONOutput() {
1978
1978
  return JSON.parse(this.output);
@@ -2031,7 +2031,7 @@ function bi(t) {
2031
2031
  } else if (t !== void 0)
2032
2032
  throw new TypeError("Expected `retries` to be a number or Infinity.");
2033
2033
  }
2034
- function qe(t, e, { min: r = 0, allowInfinity: n = !1 } = {}) {
2034
+ function Ye(t, e, { min: r = 0, allowInfinity: n = !1 } = {}) {
2035
2035
  if (e !== void 0) {
2036
2036
  if (typeof e != "number" || Number.isNaN(e))
2037
2037
  throw new TypeError(`Expected \`${t}\` to be a number${n ? " or Infinity" : ""}.`);
@@ -2051,7 +2051,7 @@ function vi(t, e) {
2051
2051
  let i = Math.round(n * e.minTimeout * e.factor ** (r - 1));
2052
2052
  return i = Math.min(i, e.maxTimeout), i;
2053
2053
  }
2054
- function or(t, e) {
2054
+ function cr(t, e) {
2055
2055
  return Number.isFinite(e) ? e - (performance.now() - t) : e;
2056
2056
  }
2057
2057
  async function xi({ error: t, attemptNumber: e, retriesConsumed: r, startTime: n, options: i }) {
@@ -2064,9 +2064,9 @@ async function xi({ error: t, attemptNumber: e, retriesConsumed: r, startTime: n
2064
2064
  retriesLeft: a,
2065
2065
  retriesConsumed: r
2066
2066
  });
2067
- if (await i.onFailedAttempt(l), or(n, o) <= 0)
2067
+ if (await i.onFailedAttempt(l), cr(n, o) <= 0)
2068
2068
  throw s;
2069
- const c = await i.shouldConsumeRetry(l), u = or(n, o);
2069
+ const c = await i.shouldConsumeRetry(l), u = cr(n, o);
2070
2070
  if (u <= 0 || a <= 0)
2071
2071
  throw s;
2072
2072
  if (s instanceof TypeError && !wi(s)) {
@@ -2092,7 +2092,7 @@ async function Si(t, e = {}) {
2092
2092
  if (e = { ...e }, bi(e.retries), Object.hasOwn(e, "forever"))
2093
2093
  throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");
2094
2094
  e.retries ??= 10, e.factor ??= 2, e.minTimeout ??= 1e3, e.maxTimeout ??= Number.POSITIVE_INFINITY, e.maxRetryTime ??= Number.POSITIVE_INFINITY, e.randomize ??= !1, e.onFailedAttempt ??= () => {
2095
- }, e.shouldRetry ??= () => !0, e.shouldConsumeRetry ??= () => !0, qe("factor", e.factor, { min: 0, allowInfinity: !1 }), qe("minTimeout", e.minTimeout, { min: 0, allowInfinity: !1 }), qe("maxTimeout", e.maxTimeout, { min: 0, allowInfinity: !0 }), qe("maxRetryTime", e.maxRetryTime, { min: 0, allowInfinity: !0 }), e.factor > 0 || (e.factor = 1), e.signal?.throwIfAborted();
2095
+ }, e.shouldRetry ??= () => !0, e.shouldConsumeRetry ??= () => !0, Ye("factor", e.factor, { min: 0, allowInfinity: !1 }), Ye("minTimeout", e.minTimeout, { min: 0, allowInfinity: !1 }), Ye("maxTimeout", e.maxTimeout, { min: 0, allowInfinity: !0 }), Ye("maxRetryTime", e.maxRetryTime, { min: 0, allowInfinity: !0 }), e.factor > 0 || (e.factor = 1), e.signal?.throwIfAborted();
2096
2096
  let r = 0, n = 0;
2097
2097
  const i = performance.now();
2098
2098
  for (; !Number.isFinite(e.retries) || n <= e.retries; ) {
@@ -2113,13 +2113,13 @@ async function Si(t, e = {}) {
2113
2113
  }
2114
2114
  throw new Error("Retry attempts exhausted without throwing an error.");
2115
2115
  }
2116
- class Gt extends Error {
2116
+ class Wt extends Error {
2117
2117
  name = "TimeoutError";
2118
2118
  constructor(e, r) {
2119
- super(e, r), Error.captureStackTrace?.(this, Gt);
2119
+ super(e, r), Error.captureStackTrace?.(this, Wt);
2120
2120
  }
2121
2121
  }
2122
- const cr = (t) => t.reason ?? new DOMException("This operation was aborted.", "AbortError");
2122
+ const lr = (t) => t.reason ?? new DOMException("This operation was aborted.", "AbortError");
2123
2123
  function Ti(t, e) {
2124
2124
  const {
2125
2125
  milliseconds: r,
@@ -2133,14 +2133,14 @@ function Ti(t, e) {
2133
2133
  if (typeof r != "number" || Math.sign(r) !== 1)
2134
2134
  throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${r}\``);
2135
2135
  if (a?.aborted) {
2136
- f(cr(a));
2136
+ f(lr(a));
2137
2137
  return;
2138
2138
  }
2139
2139
  if (a && (l = () => {
2140
- f(cr(a));
2140
+ f(lr(a));
2141
2141
  }, a.addEventListener("abort", l, { once: !0 })), t.then(h, f), r === Number.POSITIVE_INFINITY)
2142
2142
  return;
2143
- const m = new Gt();
2143
+ const m = new Wt();
2144
2144
  o = s.setTimeout.call(void 0, () => {
2145
2145
  if (n) {
2146
2146
  try {
@@ -2200,7 +2200,7 @@ class ji {
2200
2200
  return this.#r.length;
2201
2201
  }
2202
2202
  }
2203
- class yt extends zt {
2203
+ class yt extends Ht {
2204
2204
  #r;
2205
2205
  #e;
2206
2206
  #t = 0;
@@ -2715,7 +2715,7 @@ const Ii = [
2715
2715
  function Ei(t) {
2716
2716
  return t == null || typeof t != "object" ? !1 : "status" in t && "statusText" in t && "text" in t;
2717
2717
  }
2718
- var lr = class Pt extends Error {
2718
+ var ur = class Pt extends Error {
2719
2719
  status;
2720
2720
  text;
2721
2721
  response;
@@ -2741,7 +2741,7 @@ var lr = class Pt extends Error {
2741
2741
  call(t, ...e) {
2742
2742
  const { onFailedResponseHook: r } = this;
2743
2743
  return this.queue.add(() => Si(() => t(...e).catch(async (n) => {
2744
- throw n instanceof Error ? n : Ei(n) ? await lr.fromResponse(n, { includeResponse: !!r }) : new Error(n);
2744
+ throw n instanceof Error ? n : Ei(n) ? await ur.fromResponse(n, { includeResponse: !!r }) : new Error(n);
2745
2745
  }), {
2746
2746
  async onFailedAttempt({ error: n }) {
2747
2747
  const i = n.message ?? "";
@@ -2750,7 +2750,7 @@ var lr = class Pt extends Error {
2750
2750
  const s = /* @__PURE__ */ new Error(`Unable to connect to LangGraph server. Please ensure the server is running and accessible. Original error: ${i}`);
2751
2751
  throw s.name = "ConnectionError", s;
2752
2752
  }
2753
- if (n instanceof lr) {
2753
+ if (n instanceof ur) {
2754
2754
  if (Ii.includes(n.status)) throw n;
2755
2755
  r && n.response && await r(n.response);
2756
2756
  }
@@ -2790,7 +2790,7 @@ function Mi(...t) {
2790
2790
  }
2791
2791
  return r.signal;
2792
2792
  }
2793
- const Ue = 13, Dt = 10, Pi = 0, ur = 58, Di = 32, Ri = [Ue, Dt];
2793
+ const Ue = 13, Dt = 10, Pi = 0, dr = 58, Di = 32, Ri = [Ue, Dt];
2794
2794
  function Oi() {
2795
2795
  let t = [], e = !1;
2796
2796
  return new TransformStream({
@@ -2826,13 +2826,13 @@ function Ni() {
2826
2826
  const u = {
2827
2827
  id: r || void 0,
2828
2828
  event: t,
2829
- data: e.length ? dr(i, e) : null
2829
+ data: e.length ? hr(i, e) : null
2830
2830
  };
2831
2831
  t = "", e = [], n = null, a.enqueue(u);
2832
2832
  return;
2833
2833
  }
2834
- if (s[0] === ur) return;
2835
- const o = s.indexOf(ur);
2834
+ if (s[0] === dr) return;
2835
+ const o = s.indexOf(dr);
2836
2836
  if (o === -1) return;
2837
2837
  const l = i.decode(s.subarray(0, o));
2838
2838
  let c = s.subarray(o + 1);
@@ -2849,7 +2849,7 @@ function Ni() {
2849
2849
  t && s.enqueue({
2850
2850
  id: r || void 0,
2851
2851
  event: t,
2852
- data: e.length ? dr(i, e) : null
2852
+ data: e.length ? hr(i, e) : null
2853
2853
  });
2854
2854
  }
2855
2855
  });
@@ -2861,7 +2861,7 @@ function Xe(t) {
2861
2861
  r.set(i, n), n += i.length;
2862
2862
  return r;
2863
2863
  }
2864
- function dr(t, e) {
2864
+ function hr(t, e) {
2865
2865
  return JSON.parse(t.decode(Xe(e)));
2866
2866
  }
2867
2867
  const Vr = (t) => {
@@ -2953,7 +2953,7 @@ function* Bi(t) {
2953
2953
  o !== void 0 && (r && !a && (a = !0, yield [i, null]), yield [i, o]);
2954
2954
  }
2955
2955
  }
2956
- function hr(...t) {
2956
+ function fr(...t) {
2957
2957
  const e = new Headers();
2958
2958
  for (const n of t)
2959
2959
  if (n)
@@ -3011,9 +3011,9 @@ var Ne = class {
3011
3011
  prepareFetchOptions(t, e) {
3012
3012
  const r = {
3013
3013
  ...e,
3014
- headers: hr(this.defaultHeaders, e?.headers)
3014
+ headers: fr(this.defaultHeaders, e?.headers)
3015
3015
  };
3016
- r.json && (r.body = JSON.stringify(r.json), r.headers = hr(r.headers, { "content-type": "application/json" }), delete r.json), r.withResponse && delete r.withResponse;
3016
+ r.json && (r.body = JSON.stringify(r.json), r.headers = fr(r.headers, { "content-type": "application/json" }), delete r.json), r.withResponse && delete r.withResponse;
3017
3017
  let n = null;
3018
3018
  typeof e?.timeoutMs < "u" ? e.timeoutMs != null && (n = AbortSignal.timeout(e.timeoutMs)) : this.timeoutMs != null && (n = AbortSignal.timeout(this.timeoutMs)), r.signal = Mi(n, r.signal);
3019
3019
  const i = new URL(`${this.apiUrl}${t}`);
@@ -3998,7 +3998,7 @@ var Ne = class {
3998
3998
  return this.onRequest != null && (i = await this.onRequest(n, i)), (await this.asyncCaller.fetch(n, i)).text();
3999
3999
  });
4000
4000
  }
4001
- }, qi = class {
4001
+ }, Yi = class {
4002
4002
  /**
4003
4003
  * The client for interacting with assistants.
4004
4004
  */
@@ -4044,8 +4044,8 @@ var Ne = class {
4044
4044
  }), this.assistants = new Wi(t), this.threads = new Zi(t), this.runs = new Ji(t), this.crons = new Gi(t), this.store = new Qi(t), this["~ui"] = new Vi(t);
4045
4045
  }
4046
4046
  };
4047
- const Yi = async (t) => {
4048
- const e = new qi(t);
4047
+ const qi = async (t) => {
4048
+ const e = new Yi(t);
4049
4049
  return e.threads.search = function(r) {
4050
4050
  return this.fetch("/threads/search", {
4051
4051
  method: "POST",
@@ -4068,7 +4068,7 @@ const Ki = (t, e) => {
4068
4068
  const r = /* @__PURE__ */ new Map();
4069
4069
  for (const i of t)
4070
4070
  if (i.type === "tool" && i.name === "create_artifacts") {
4071
- const s = new Ht(i, e), a = s.getInputRepaired();
4071
+ const s = new Gt(i, e), a = s.getInputRepaired();
4072
4072
  if (!a.id)
4073
4073
  continue;
4074
4074
  a.tool_id = s.message.id, a.is_done = s.state === "done", r.set(a.id, [...r.get(a.id) || [], a]);
@@ -4137,7 +4137,7 @@ class ea {
4137
4137
  /** 虚拟 Client,用于查询操作(不绑定特定 Thread) */
4138
4138
  virtualClient;
4139
4139
  constructor(e) {
4140
- this.clientConfig = e, this.virtualClient = new wr(e);
4140
+ this.clientConfig = e, this.virtualClient = new br(e);
4141
4141
  }
4142
4142
  /**
4143
4143
  * @zh 创建新会话(延迟创建 Thread,直到发送第一条消息)
@@ -4165,7 +4165,7 @@ class ea {
4165
4165
  agentName: this.virtualClient.getCurrentAssistant()?.graph_id
4166
4166
  };
4167
4167
  if (!n.client) {
4168
- const s = new wr(this.clientConfig);
4168
+ const s = new br(this.clientConfig);
4169
4169
  await s.initAssistant(n.agentName), (n.thread || r) && await s.resetThread(n.agentName, e), n.client = s;
4170
4170
  }
4171
4171
  const i = this.activeSessionId && this.sessions.get(this.activeSessionId);
@@ -4299,10 +4299,10 @@ class ea {
4299
4299
  return this.virtualClient.initAssistant(e, r);
4300
4300
  }
4301
4301
  }
4302
- const fr = (t) => {
4302
+ const mr = (t) => {
4303
4303
  const e = (l) => l.toString().padStart(2, "0"), r = t.getFullYear(), n = e(t.getMonth() + 1), i = e(t.getDate()), s = e(t.getHours()), a = e(t.getMinutes()), o = e(t.getSeconds());
4304
4304
  return `${r}-${n}-${i} ${s}:${a}:${o}`;
4305
- }, qr = (t) => typeof t == "string" ? t : Array.isArray(t) ? t.map((e) => typeof e == "string" ? e : e.type === "text" ? e.text : e.type === "image_url" ? "[图片]" : e.type === "tool_use" ? "" : JSON.stringify(e)).join("") : JSON.stringify(t), ta = (t, e, r = {}) => {
4305
+ }, Yr = (t) => typeof t == "string" ? t : Array.isArray(t) ? t.map((e) => typeof e == "string" ? e : e.type === "text" ? e.text : e.type === "image_url" ? "[图片]" : e.type === "tool_use" ? "" : JSON.stringify(e)).join("") : JSON.stringify(t), ta = (t, e, r = {}) => {
4306
4306
  const n = /* @__PURE__ */ Z(null), i = /* @__PURE__ */ Z([]), s = /* @__PURE__ */ Z(null), a = /* @__PURE__ */ Z([]), o = /* @__PURE__ */ Z([]), l = /* @__PURE__ */ Z(""), c = /* @__PURE__ */ Z(null), u = /* @__PURE__ */ Z(t), h = /* @__PURE__ */ Z(null), f = /* @__PURE__ */ Z("__start__"), m = /* @__PURE__ */ Z("idle"), g = /* @__PURE__ */ Z(null), p = /* @__PURE__ */ Z(!1), y = /* @__PURE__ */ Z([]), b = /* @__PURE__ */ Z([]), v = /* @__PURE__ */ Z(r.showHistory ?? !1), S = /* @__PURE__ */ Z(r.showGraph ?? !1), C = /* @__PURE__ */ Z(null);
4307
4307
  let j = null;
4308
4308
  const A = /* @__PURE__ */ Z(!1), I = () => {
@@ -4322,7 +4322,7 @@ const fr = (t) => {
4322
4322
  async function H() {
4323
4323
  const E = new ea({
4324
4324
  ...e,
4325
- client: e.client ?? await Yi(e)
4325
+ client: e.client ?? await qi(e)
4326
4326
  });
4327
4327
  if (await E.init(u.get(), { fallbackToAvailableAssistants: r.fallbackToAvailableAssistants }), n.set(E), r.autoRestoreLastSession)
4328
4328
  if (await $(), i.get().length > 0) {
@@ -4357,13 +4357,13 @@ const fr = (t) => {
4357
4357
  function W(E) {
4358
4358
  const M = () => s.get() === E, N = () => {
4359
4359
  M() && I();
4360
- }, Y = () => {
4360
+ }, q = () => {
4361
4361
  if (!M())
4362
4362
  return;
4363
4363
  const Ie = E.getCurrentThread();
4364
4364
  h.set(Ie?.thread_id || null), f.set("__start__");
4365
- const Qt = n.get()?.getActiveSession();
4366
- Qt && Ie && (Qt.thread = Ie), $();
4365
+ const Vt = n.get()?.getActiveSession();
4366
+ Vt && Ie && (Vt.thread = Ie), $();
4367
4367
  }, G = () => {
4368
4368
  M() && (I(), k(E));
4369
4369
  }, X = (Ie) => {
@@ -4378,8 +4378,8 @@ const fr = (t) => {
4378
4378
  const mt = E.interruptData;
4379
4379
  mt ? (g.set(mt), p.set(!0), I()) : (g.set(null), p.set(!1)), k(E), s.set(s.get());
4380
4380
  };
4381
- return E.on("start", N), E.on("thread", Y), E.on("done", G), E.on("error", X), E.on("message", je), E.on("value", ge), E.on("interruptChange", Le), () => {
4382
- E.off("start", N), E.off("thread", Y), E.off("done", G), E.off("error", X), E.off("message", je), E.off("value", ge), E.off("interruptChange", Le);
4381
+ return E.on("start", N), E.on("thread", q), E.on("done", G), E.on("error", X), E.on("message", je), E.on("value", ge), E.on("interruptChange", Le), () => {
4382
+ E.off("start", N), E.off("thread", q), E.off("done", G), E.off("error", X), E.off("message", je), E.off("value", ge), E.off("interruptChange", Le);
4383
4383
  };
4384
4384
  }
4385
4385
  async function fe(E, M = !1) {
@@ -4400,11 +4400,11 @@ const fr = (t) => {
4400
4400
  Le && (g.set(Le), p.set(!0));
4401
4401
  }
4402
4402
  }
4403
- } catch (Y) {
4404
- console.error("Failed to activate session:", Y), c.set(Y.message);
4403
+ } catch (q) {
4404
+ console.error("Failed to activate session:", q), c.set(q.message);
4405
4405
  }
4406
4406
  }
4407
- async function Te(E, M, N = !1, Y = !1) {
4407
+ async function Te(E, M, N = !1, q = !1) {
4408
4408
  const G = s.get();
4409
4409
  if (!(!N && !l.get().trim() && !E?.length || !G) && G.status !== "busy") {
4410
4410
  c.set(null);
@@ -4439,7 +4439,7 @@ const fr = (t) => {
4439
4439
  if (!M)
4440
4440
  return null;
4441
4441
  const N = M.tools.getTool(E)?.render;
4442
- return N ? (Y) => N(new Ht(Y, M)) : null;
4442
+ return N ? (q) => N(new Gt(q, M)) : null;
4443
4443
  }
4444
4444
  const ie = Xi(o, s);
4445
4445
  return {
@@ -4622,7 +4622,7 @@ class ra {
4622
4622
  const r = [...e];
4623
4623
  for (const n of r) {
4624
4624
  n.additional_kwargs || (n.additional_kwargs = {});
4625
- const i = n.additional_kwargs?.create_time || fr(this.spendTime.getStartTime(n.id)), s = n.additional_kwargs?.update_time || fr(this.spendTime.getEndTime(n.id));
4625
+ const i = n.additional_kwargs?.create_time || mr(this.spendTime.getStartTime(n.id)), s = n.additional_kwargs?.update_time || mr(this.spendTime.getEndTime(n.id));
4626
4626
  if (n.additional_kwargs.create_time = i, n.additional_kwargs.update_time = s, n.unique_id = n.tool_call_id || n.id, n.spend_time = new Date(s).getTime() - new Date(i).getTime(), !n.usage_metadata && n.response_metadata?.usage) {
4627
4627
  const a = n.response_metadata.usage;
4628
4628
  n.usage_metadata = {
@@ -4748,7 +4748,7 @@ async function na(t, e, r, n) {
4748
4748
  checkpoint: u
4749
4749
  };
4750
4750
  }
4751
- const Yr = (t) => typeof t == "object" && t !== null, mr = (t) => Yr(t) && !(t instanceof RegExp) && !(t instanceof Error) && !(t instanceof Date) && !(globalThis.Blob && t instanceof globalThis.Blob), sa = /* @__PURE__ */ Symbol("mapObjectSkip"), Rt = (t, e, r, n = /* @__PURE__ */ new WeakMap()) => {
4751
+ const qr = (t) => typeof t == "object" && t !== null, gr = (t) => qr(t) && !(t instanceof RegExp) && !(t instanceof Error) && !(t instanceof Date) && !(globalThis.Blob && t instanceof globalThis.Blob), sa = /* @__PURE__ */ Symbol("mapObjectSkip"), Rt = (t, e, r, n = /* @__PURE__ */ new WeakMap()) => {
4752
4752
  if (r = {
4753
4753
  deep: !1,
4754
4754
  target: {},
@@ -4758,7 +4758,7 @@ const Yr = (t) => typeof t == "object" && t !== null, mr = (t) => Yr(t) && !(t i
4758
4758
  n.set(t, r.target);
4759
4759
  const { target: i } = r;
4760
4760
  delete r.target;
4761
- const s = (a) => a.map((o) => mr(o) ? Rt(o, e, r, n) : o);
4761
+ const s = (a) => a.map((o) => gr(o) ? Rt(o, e, r, n) : o);
4762
4762
  if (Array.isArray(t))
4763
4763
  return s(t);
4764
4764
  for (const [a, o] of Object.entries(t)) {
@@ -4766,25 +4766,25 @@ const Yr = (t) => typeof t == "object" && t !== null, mr = (t) => Yr(t) && !(t i
4766
4766
  if (l === sa)
4767
4767
  continue;
4768
4768
  let [c, u, { shouldRecurse: h = !0 } = {}] = l;
4769
- c !== "__proto__" && (r.deep && h && mr(u) && (u = Array.isArray(u) ? s(u) : Rt(u, e, r, n)), i[c] = u);
4769
+ c !== "__proto__" && (r.deep && h && gr(u) && (u = Array.isArray(u) ? s(u) : Rt(u, e, r, n)), i[c] = u);
4770
4770
  }
4771
4771
  return i;
4772
4772
  };
4773
4773
  function ia(t, e, r) {
4774
- if (!Yr(t))
4774
+ if (!qr(t))
4775
4775
  throw new TypeError(`Expected an object, got \`${t}\` (${typeof t})`);
4776
4776
  if (Array.isArray(t))
4777
4777
  throw new TypeError("Expected an object, got an array");
4778
4778
  return Rt(t, e, r);
4779
4779
  }
4780
- const aa = /[\p{Lu}]/u, oa = /[\p{Ll}]/u, gr = /^[\p{Lu}](?![\p{Lu}])/gu, Kr = /([\p{Alpha}\p{N}_]|$)/u, Wt = /[_.\- ]+/, ca = new RegExp("^" + Wt.source), pr = new RegExp(Wt.source + Kr.source, "gu"), yr = new RegExp("\\d+" + Kr.source, "gu"), la = (t, e, r, n) => {
4780
+ const aa = /[\p{Lu}]/u, oa = /[\p{Ll}]/u, pr = /^[\p{Lu}](?![\p{Lu}])/gu, Kr = /([\p{Alpha}\p{N}_]|$)/u, Zt = /[_.\- ]+/, ca = new RegExp("^" + Zt.source), yr = new RegExp(Zt.source + Kr.source, "gu"), wr = new RegExp("\\d+" + Kr.source, "gu"), la = (t, e, r, n) => {
4781
4781
  let i = !1, s = !1, a = !1, o = !1;
4782
4782
  for (let l = 0; l < t.length; l++) {
4783
4783
  const c = t[l];
4784
4784
  o = l > 2 ? t[l - 3] === "-" : !0, i && aa.test(c) ? (t = t.slice(0, l) + "-" + t.slice(l), i = !1, a = s, s = !0, l++) : s && a && oa.test(c) && (!o || n) ? (t = t.slice(0, l - 1) + "-" + t.slice(l - 1), a = s, s = !1, i = !0) : (i = e(c) === c && r(c) !== c, a = s, s = r(c) === c && e(c) !== c);
4785
4785
  }
4786
4786
  return t;
4787
- }, ua = (t, e) => (gr.lastIndex = 0, t.replaceAll(gr, (r) => e(r))), da = (t, e) => (pr.lastIndex = 0, yr.lastIndex = 0, t.replaceAll(yr, (r, n, i) => ["_", "-"].includes(t.charAt(i + r.length)) ? r : e(r)).replaceAll(pr, (r, n) => e(n)));
4787
+ }, ua = (t, e) => (pr.lastIndex = 0, t.replaceAll(pr, (r) => e(r))), da = (t, e) => (yr.lastIndex = 0, wr.lastIndex = 0, t.replaceAll(wr, (r, n, i) => ["_", "-"].includes(t.charAt(i + r.length)) ? r : e(r)).replaceAll(yr, (r, n) => e(n)));
4788
4788
  function ha(t, e) {
4789
4789
  if (!(typeof t == "string" || Array.isArray(t)))
4790
4790
  throw new TypeError("Expected the input to be `string | string[]`");
@@ -4795,7 +4795,7 @@ function ha(t, e) {
4795
4795
  }, Array.isArray(t) ? t = t.map((s) => s.trim()).filter((s) => s.length).join("-") : t = t.trim(), t.length === 0)
4796
4796
  return "";
4797
4797
  const r = e.locale === !1 ? (s) => s.toLowerCase() : (s) => s.toLocaleLowerCase(e.locale), n = e.locale === !1 ? (s) => s.toUpperCase() : (s) => s.toLocaleUpperCase(e.locale);
4798
- return t.length === 1 ? Wt.test(t) ? "" : e.pascalCase ? n(t) : r(t) : (t !== r(t) && (t = la(t, r, n, e.preserveConsecutiveUppercase)), t = t.replace(ca, ""), t = e.preserveConsecutiveUppercase ? ua(t, r) : r(t), e.pascalCase && (t = n(t.charAt(0)) + t.slice(1)), da(t, n));
4798
+ return t.length === 1 ? Zt.test(t) ? "" : e.pascalCase ? n(t) : r(t) : (t !== r(t) && (t = la(t, r, n, e.preserveConsecutiveUppercase)), t = t.replace(ca, ""), t = e.preserveConsecutiveUppercase ? ua(t, r) : r(t), e.pascalCase && (t = n(t.charAt(0)) + t.slice(1)), da(t, n));
4799
4799
  }
4800
4800
  class fa extends Map {
4801
4801
  #r = 0;
@@ -5014,7 +5014,7 @@ function Ze(t, e) {
5014
5014
  const r = /* @__PURE__ */ new WeakMap();
5015
5015
  return Array.isArray(t) ? t.map((n) => Ae(n) ? Me(n, e, r, void 0) : n) : Me(t, e, r);
5016
5016
  }
5017
- class wr extends zt {
5017
+ class br extends Ht {
5018
5018
  client;
5019
5019
  currentAssistant = null;
5020
5020
  currentThread = null;
@@ -5402,7 +5402,7 @@ class wr extends zt {
5402
5402
  const ya = (t, e) => ({
5403
5403
  ...Object.fromEntries(Object.entries(t.data).map(([n, i]) => [n, e(i)])),
5404
5404
  ...t.mutations
5405
- }), wa = (t) => t.additional_kwargs?.reasoning_content || Array.isArray(t.content) && t.content.find((e) => e.type === "thinking")?.thinking, Zt = (t) => typeof t.content == "string" ? t.content : t.content?.filter((e) => e.type === "text").map((e) => e.text).join("");
5405
+ }), wa = (t) => t.additional_kwargs?.reasoning_content || Array.isArray(t.content) && t.content.find((e) => e.type === "thinking")?.thinking, Jt = (t) => typeof t.content == "string" ? t.content : t.content?.filter((e) => e.type === "text").map((e) => e.text).join("");
5406
5406
  let vt = (t, e) => (r) => {
5407
5407
  t.current !== r && (t.current = r, e());
5408
5408
  };
@@ -5459,7 +5459,7 @@ ${s.join(`
5459
5459
  const e = x.useMemo(() => Un(t || "", { renderer: va }), [t]), { loading: r } = ne(), n = x.useMemo(() => xa(e.trim(), !r), [e, r]);
5460
5460
  return /* @__PURE__ */ d.jsx(w, { children: n });
5461
5461
  }), en = ({ message: t, messageNumber: e }) => {
5462
- const { extraParams: r } = ue(), n = r.main_model || "AI", i = wa(t), s = Zt(t);
5462
+ const { extraParams: r } = ue(), n = r.main_model || "AI", i = wa(t), s = Jt(t);
5463
5463
  return s ? /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", children: [
5464
5464
  /* @__PURE__ */ d.jsx(_, { paddingBottom: 0, marginBottom: 1, children: /* @__PURE__ */ d.jsxs(w, { color: oe("teal"), children: [
5465
5465
  e,
@@ -5486,12 +5486,12 @@ ${s.join(`
5486
5486
  ] }) }),
5487
5487
  /* @__PURE__ */ d.jsx(_, { paddingLeft: 2, flexDirection: "column", children: n.map((i, s) => /* @__PURE__ */ d.jsx(w, { dimColor: !0, children: i }, s)) })
5488
5488
  ] });
5489
- }, br = ["yellow", "magenta", "blue"], Ca = (t) => {
5489
+ }, _r = ["yellow", "magenta", "blue"], Ca = (t) => {
5490
5490
  let e = 0;
5491
5491
  for (let n = 0; n < t.length; n++)
5492
5492
  e = t.charCodeAt(n) + ((e << 5) - e);
5493
- const r = Math.abs(e % br.length);
5494
- return br[r];
5493
+ const r = Math.abs(e % _r.length);
5494
+ return _r[r];
5495
5495
  }, ja = (t) => ({
5496
5496
  success: "✓",
5497
5497
  completed: "✓",
@@ -5594,7 +5594,7 @@ ${s.join(`
5594
5594
  };
5595
5595
  return /* @__PURE__ */ d.jsx(w, { children: e(t) });
5596
5596
  }, Aa = ({ message: t, messageNumber: e }) => {
5597
- const { getToolUIRender: r, client: n } = ne(), i = new Ht(t, n), s = i.getInputRepaired(), a = s?.title ? `: ${s.title}` : s?.description ? `: ${s.description}` : "", o = t.name ? r(t.name) : null;
5597
+ const { getToolUIRender: r, client: n } = ne(), i = new Gt(t, n), s = i.getInputRepaired(), a = s?.title ? `: ${s.title}` : s?.description ? `: ${s.description}` : "", o = t.name ? r(t.name) : null;
5598
5598
  let l = Ca(t.name || "");
5599
5599
  return l = t.status === "error" ? "red" : "yellow", /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", children: [
5600
5600
  /* @__PURE__ */ d.jsxs(_, { children: [
@@ -5627,7 +5627,7 @@ ${s.join(`
5627
5627
  ] }),
5628
5628
  /* @__PURE__ */ d.jsxs(_, { paddingTop: 0, paddingBottom: 0, children: [
5629
5629
  /* @__PURE__ */ d.jsx(w, { color: "gray", children: "└─ " }),
5630
- /* @__PURE__ */ d.jsx(w, { dimColor: !0, italic: !0, children: Ia(qr(t.content)) })
5630
+ /* @__PURE__ */ d.jsx(w, { dimColor: !0, italic: !0, children: Ia(Yr(t.content)) })
5631
5631
  ] })
5632
5632
  ] })
5633
5633
  ] });
@@ -5661,7 +5661,7 @@ ${s.join(`
5661
5661
  const o = t.slice(0, a), l = t.slice(a);
5662
5662
  return n ? /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", children: [
5663
5663
  /* @__PURE__ */ d.jsx(
5664
- kr,
5664
+ Mr,
5665
5665
  {
5666
5666
  items: o,
5667
5667
  children: (c, u) => s(c, u, !1)
@@ -5727,7 +5727,7 @@ ${s.join(`
5727
5727
  const a = (m) => {
5728
5728
  if (m.type !== "ai") return !0;
5729
5729
  try {
5730
- const g = Zt(m);
5730
+ const g = Jt(m);
5731
5731
  return !!(g && g.trim().length > 0);
5732
5732
  } catch {
5733
5733
  return !1;
@@ -5785,7 +5785,7 @@ ${s.join(`
5785
5785
  const h = l.slice(0, u), f = l.slice(u);
5786
5786
  return i ? /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", children: [
5787
5787
  /* @__PURE__ */ d.jsx(
5788
- kr,
5788
+ Mr,
5789
5789
  {
5790
5790
  items: h,
5791
5791
  children: (m, g) => c(m, g, !1)
@@ -6341,7 +6341,7 @@ class tn {
6341
6341
  db;
6342
6342
  dbPath;
6343
6343
  constructor(e) {
6344
- this.dbPath = Vt.join(e, ".claude", "spark.json");
6344
+ this.dbPath = Yt.join(e, ".claude", "spark.json");
6345
6345
  const r = new Wn(this.dbPath);
6346
6346
  this.db = new Gn(r, this.getDefaultData());
6347
6347
  }
@@ -6356,7 +6356,7 @@ class tn {
6356
6356
  * 初始化数据库(如果不存在则创建)
6357
6357
  */
6358
6358
  async initialize() {
6359
- const e = await import("node:fs"), r = Vt.dirname(this.dbPath);
6359
+ const e = await import("node:fs"), r = Yt.dirname(this.dbPath);
6360
6360
  e.existsSync(r) || e.mkdirSync(r, { recursive: !0 }), await this.db.read(), this.db.data || (this.db.data = this.getDefaultData(), await this.db.write());
6361
6361
  }
6362
6362
  /**
@@ -6635,7 +6635,7 @@ ${i.description}`,
6635
6635
  };
6636
6636
  }
6637
6637
  }
6638
- }, qa = {
6638
+ }, Ya = {
6639
6639
  name: "mcp",
6640
6640
  description: "管理 MCP 服务器配置",
6641
6641
  aliases: [],
@@ -6764,7 +6764,7 @@ ${s.map((o) => ` - ${o}`).join(`
6764
6764
  };
6765
6765
  }
6766
6766
  }
6767
- }, Ya = {
6767
+ }, qa = {
6768
6768
  name: "summarize",
6769
6769
  description: "智能总结对话并提取有价值信息保存为记忆",
6770
6770
  aliases: ["sum", "summary", "compact"],
@@ -6873,8 +6873,8 @@ ${s.map((o) => ` - ${o}`).join(`
6873
6873
  Ja,
6874
6874
  Qa,
6875
6875
  Va,
6876
- qa,
6877
6876
  Ya,
6877
+ qa,
6878
6878
  // NEW: 添加总结命令
6879
6879
  Ka,
6880
6880
  // NEW: 添加历史面板命令
@@ -7373,7 +7373,7 @@ async function nn(t, e) {
7373
7373
  return et.call(n, r);
7374
7374
  }
7375
7375
  const St = "__pregel_tasks", Ao = "__error__", ko = "__scheduled__", Mo = "__interrupt__", Po = "__resume__";
7376
- var _r = "[...]", Do = "[Circular]", rt = [], Pe = [];
7376
+ var vr = "[...]", Do = "[Circular]", rt = [], Pe = [];
7377
7377
  function Ro() {
7378
7378
  return {
7379
7379
  depthLimit: Number.MAX_SAFE_INTEGER,
@@ -7421,11 +7421,11 @@ function Ot(t, e, r, n, i, s, a) {
7421
7421
  return;
7422
7422
  }
7423
7423
  if (typeof a.depthLimit < "u" && s > a.depthLimit) {
7424
- Tt(_r, t, e, i);
7424
+ Tt(vr, t, e, i);
7425
7425
  return;
7426
7426
  }
7427
7427
  if (typeof a.edgesLimit < "u" && r + 1 > a.edgesLimit) {
7428
- Tt(_r, t, e, i);
7428
+ Tt(vr, t, e, i);
7429
7429
  return;
7430
7430
  }
7431
7431
  if (n.push(t), Array.isArray(t)) for (o = 0; o < t.length; o++) Ot(t[o], o, o, n, t, s, a);
@@ -7738,15 +7738,15 @@ const Qo = (t) => {
7738
7738
  resume: t.resume
7739
7739
  });
7740
7740
  };
7741
- var vr = "[...]", Vo = "[Circular]", nt = [], De = [];
7742
- function qo() {
7741
+ var xr = "[...]", Vo = "[Circular]", nt = [], De = [];
7742
+ function Yo() {
7743
7743
  return {
7744
7744
  depthLimit: Number.MAX_SAFE_INTEGER,
7745
7745
  edgesLimit: Number.MAX_SAFE_INTEGER
7746
7746
  };
7747
7747
  }
7748
- function Yo(t, e, r, n) {
7749
- typeof n > "u" && (n = qo()), Lt(t, "", 0, [], void 0, 0, n);
7748
+ function qo(t, e, r, n) {
7749
+ typeof n > "u" && (n = Yo()), Lt(t, "", 0, [], void 0, 0, n);
7750
7750
  var i;
7751
7751
  try {
7752
7752
  De.length === 0 ? i = JSON.stringify(t, e, r) : i = JSON.stringify(t, Ko(e), r);
@@ -7774,11 +7774,11 @@ function Lt(t, e, r, n, i, s, a) {
7774
7774
  return;
7775
7775
  }
7776
7776
  if (typeof a.depthLimit < "u" && s > a.depthLimit) {
7777
- jt(vr, t, e, i);
7777
+ jt(xr, t, e, i);
7778
7778
  return;
7779
7779
  }
7780
7780
  if (typeof a.edgesLimit < "u" && r + 1 > a.edgesLimit) {
7781
- jt(vr, t, e, i);
7781
+ jt(xr, t, e, i);
7782
7782
  return;
7783
7783
  }
7784
7784
  if (n.push(t), Array.isArray(t))
@@ -7875,7 +7875,7 @@ function ec(t) {
7875
7875
  class tc {
7876
7876
  _dumps(e) {
7877
7877
  return new TextEncoder().encode(
7878
- Yo(e, (n, i) => ec(i))
7878
+ qo(e, (n, i) => ec(i))
7879
7879
  );
7880
7880
  }
7881
7881
  async dumpsTyped(e) {
@@ -7893,7 +7893,7 @@ class tc {
7893
7893
  throw new Error(`Unknown serialization type: ${e}`);
7894
7894
  }
7895
7895
  }
7896
- class rc extends zt {
7896
+ class rc extends Ht {
7897
7897
  /**
7898
7898
  * 构造函数
7899
7899
  * Constructor
@@ -8062,7 +8062,7 @@ async function ct(t, e, r) {
8062
8062
  const n = typeof Re[t] == "function" ? await Re[t](e ?? { configurable: {} }) : Re[t];
8063
8063
  return typeof r?.checkpointer < "u" ? n.checkpointer = r?.checkpointer ?? Q.globalCheckPointer : n.checkpointer = Q.globalCheckPointer, n.store = r?.store ?? void 0, n;
8064
8064
  }
8065
- class xr {
8065
+ class Sr {
8066
8066
  db;
8067
8067
  adapter;
8068
8068
  constructor(e) {
@@ -8223,7 +8223,7 @@ class oc extends ce {
8223
8223
  });
8224
8224
  }
8225
8225
  }
8226
- class Jt extends rc {
8226
+ class Qt extends rc {
8227
8227
  data = [];
8228
8228
  async push(e) {
8229
8229
  const r = this.compressMessages ? await this.encodeData(e) : e;
@@ -8279,7 +8279,7 @@ class Jt extends rc {
8279
8279
  this.cancelSignal.abort("user cancel this run"), await this.push(new ic());
8280
8280
  }
8281
8281
  async copyToQueue(e, r) {
8282
- const n = this.data, i = new Jt(e, this.compressMessages, r ?? this.ttl);
8282
+ const n = this.data, i = new Qt(e, this.compressMessages, r ?? this.ttl);
8283
8283
  return i.data = n, i;
8284
8284
  }
8285
8285
  }
@@ -8389,7 +8389,7 @@ const lc = async () => {
8389
8389
  if (process.env.REDIS_URL && process.env.CHECKPOINT_TYPE === "redis" || process.env.CHECKPOINT_TYPE === "shallow/redis") {
8390
8390
  if (process.env.CHECKPOINT_TYPE === "redis") {
8391
8391
  console.debug("LG | Using redis as checkpoint");
8392
- const { RedisSaver: t } = await import("./index-BmxiURq0.mjs");
8392
+ const { RedisSaver: t } = await import("./index-BZ3paLuT.mjs");
8393
8393
  return await t.fromUrl(process.env.REDIS_URL, {
8394
8394
  defaultTTL: 60,
8395
8395
  // TTL in minutes
@@ -8398,18 +8398,18 @@ const lc = async () => {
8398
8398
  }
8399
8399
  if (process.env.CHECKPOINT_TYPE === "shallow/redis") {
8400
8400
  console.debug("LG | Using shallow redis as checkpoint");
8401
- const { ShallowRedisSaver: t } = await import("./shallow-Cn-uyrVQ.mjs");
8401
+ const { ShallowRedisSaver: t } = await import("./shallow-EW7Q1ZFs.mjs");
8402
8402
  return await t.fromUrl(process.env.REDIS_URL);
8403
8403
  }
8404
8404
  }
8405
8405
  if (process.env.DATABASE_URL) {
8406
8406
  console.debug("LG | Using postgres as checkpoint");
8407
- const { createPGCheckpoint: t } = await import("./checkpoint-DxiUsHMy-BWVXO0Oa.mjs");
8407
+ const { createPGCheckpoint: t } = await import("./checkpoint-DxiUsHMy-BfuW8IQl.mjs");
8408
8408
  return t();
8409
8409
  }
8410
8410
  if (process.env.SQLITE_DATABASE_URI) {
8411
8411
  console.debug("LG | Using sqlite as checkpoint");
8412
- const { SqliteSaver: t } = await import("./checkpoint-1sAx_j1E-BlqgvrDY.mjs");
8412
+ const { SqliteSaver: t } = await import("./checkpoint-1sAx_j1E-DqcSZLfo.mjs");
8413
8413
  return await t.fromConnStringAsync(process.env.SQLITE_DATABASE_URI);
8414
8414
  }
8415
8415
  return console.log("LG | You are using memory as checkpoint!"), console.log(
@@ -8423,20 +8423,20 @@ const lc = async () => {
8423
8423
  let t;
8424
8424
  if (process.env.REDIS_URL) {
8425
8425
  console.debug("LG | Using redis as stream queue");
8426
- const { RedisStreamQueue: e } = await import("./queue-D6tEGCGs-BLJPuWhS.mjs");
8426
+ const { RedisStreamQueue: e } = await import("./queue-D6tEGCGs-C_LiNO7O.mjs");
8427
8427
  t = e;
8428
8428
  } else
8429
- t = Jt;
8429
+ t = Qt;
8430
8430
  return new nc(t);
8431
8431
  }, dc = async (t) => {
8432
8432
  if (process.env.DATABASE_URL && t.checkpointer) {
8433
8433
  console.debug("LG | Using PostgreSQL ThreadsManager");
8434
- const { PostgresAdapter: e } = await import("./pg-adapter-BFtir1GE-BU2H39HC.mjs"), r = t.checkpointer.pool, n = new xr(new e(r));
8434
+ const { PostgresAdapter: e } = await import("./pg-adapter-BFtir1GE-BU2H39HC.mjs"), r = t.checkpointer.pool, n = new Sr(new e(r));
8435
8435
  return process.env.DATABASE_INIT === "true" && await n.setup(), n;
8436
8436
  }
8437
8437
  if (process.env.SQLITE_DATABASE_URI && t.checkpointer) {
8438
8438
  console.debug("LG | Using SQLite ThreadsManager");
8439
- const { SQLiteAdapter: e } = await import("./sqlite-adapter-5PeLHaxe-CUccULPN.mjs"), r = t.checkpointer.db, n = new xr(new e(r));
8439
+ const { SQLiteAdapter: e } = await import("./sqlite-adapter-5PeLHaxe-CUccULPN.mjs"), r = t.checkpointer.db, n = new Sr(new e(r));
8440
8440
  return await n.setup(), n;
8441
8441
  }
8442
8442
  return new cc();
@@ -8712,13 +8712,13 @@ const lt = T.object({
8712
8712
  step: T.number().optional(),
8713
8713
  writes: T.any().nullable().optional(),
8714
8714
  parents: T.any().optional()
8715
- }).catchall(T.unknown()), Sr = T.object({
8715
+ }).catchall(T.unknown()), Tr = T.object({
8716
8716
  node: T.string(),
8717
8717
  input: T.unknown().optional()
8718
8718
  }), yc = T.object({
8719
8719
  update: T.union([T.any(), T.array(T.tuple([T.string(), T.any()]))]).nullable().optional(),
8720
8720
  resume: T.unknown().optional(),
8721
- goto: T.union([Sr, T.array(Sr), T.string(), T.array(T.string())]).optional()
8721
+ goto: T.union([Tr, T.array(Tr), T.string(), T.array(T.string())]).optional()
8722
8722
  });
8723
8723
  T.object({
8724
8724
  limit: T.number().int().optional(),
@@ -8801,7 +8801,7 @@ function dt(t) {
8801
8801
  !isNaN(Number(n)) && n !== "" ? r[i] = Number(n) : n === "true" || n === "false" ? r[i] = n === "true" : r[i] = n;
8802
8802
  }), r;
8803
8803
  }
8804
- function q(t, e) {
8804
+ function Y(t, e) {
8805
8805
  const r = t.safeParse(e);
8806
8806
  if (!r.success)
8807
8807
  throw new cn(r.error.issues);
@@ -8923,7 +8923,7 @@ function un(t, e = process.env.HEARTBEAT_INTERVAL ? parseInt(process.env.HEARTBE
8923
8923
  }
8924
8924
  async function Ic(t, e) {
8925
8925
  try {
8926
- const r = await t.json(), n = q(wc, r), i = await se.assistants.search(Ze(n));
8926
+ const r = await t.json(), n = Y(wc, r), i = await se.assistants.search(Ze(n));
8927
8927
  return le(i, 200, {
8928
8928
  "X-Pagination-Total": "0"
8929
8929
  });
@@ -8933,7 +8933,7 @@ async function Ic(t, e) {
8933
8933
  }
8934
8934
  async function Ec(t, e) {
8935
8935
  try {
8936
- const i = new URL(t.url).pathname.split("/").filter((l) => l)[1], s = dt(t.url), { xray: a } = q(bc, s), o = await se.assistants.getGraph(i, {
8936
+ const i = new URL(t.url).pathname.split("/").filter((l) => l)[1], s = dt(t.url), { xray: a } = Y(bc, s), o = await se.assistants.getGraph(i, {
8937
8937
  xray: a !== void 0 ? a === "true" : void 0
8938
8938
  });
8939
8939
  return le(o);
@@ -8943,7 +8943,7 @@ async function Ec(t, e) {
8943
8943
  }
8944
8944
  async function Ac(t, e) {
8945
8945
  try {
8946
- const r = await t.json(), n = q(Tc, r), i = await se.threads.create(Ze(n));
8946
+ const r = await t.json(), n = Y(Tc, r), i = await se.threads.create(Ze(n));
8947
8947
  return le(i);
8948
8948
  } catch (r) {
8949
8949
  return ee(r);
@@ -8951,7 +8951,7 @@ async function Ac(t, e) {
8951
8951
  }
8952
8952
  async function kc(t, e) {
8953
8953
  try {
8954
- const r = await t.json(), n = q(Cc, r), i = await se.threads.search(Ze(n));
8954
+ const r = await t.json(), n = Y(Cc, r), i = await se.threads.search(Ze(n));
8955
8955
  return le(i, 200, {
8956
8956
  "X-Pagination-Total": i.length.toString()
8957
8957
  });
@@ -8961,7 +8961,7 @@ async function kc(t, e) {
8961
8961
  }
8962
8962
  async function Mc(t, e) {
8963
8963
  try {
8964
- const r = Se(t.url, "/threads/:thread_id"), { thread_id: n } = q(ut, r), i = await se.threads.get(n);
8964
+ const r = Se(t.url, "/threads/:thread_id"), { thread_id: n } = Y(ut, r), i = await se.threads.get(n);
8965
8965
  return le(i);
8966
8966
  } catch (r) {
8967
8967
  return ee(r);
@@ -8969,7 +8969,7 @@ async function Mc(t, e) {
8969
8969
  }
8970
8970
  async function Pc(t, e) {
8971
8971
  try {
8972
- const r = Se(t.url, "/threads/:thread_id"), { thread_id: n } = q(ut, r);
8972
+ const r = Se(t.url, "/threads/:thread_id"), { thread_id: n } = Y(ut, r);
8973
8973
  return await se.threads.delete(n), new Response(null, { status: 204 });
8974
8974
  } catch (r) {
8975
8975
  return ee(r);
@@ -8977,7 +8977,7 @@ async function Pc(t, e) {
8977
8977
  }
8978
8978
  async function Dc(t, e) {
8979
8979
  try {
8980
- const r = Se(t.url, "/threads/:thread_id/runs/stream"), { thread_id: n } = q(ut, r), i = await t.json(), s = q(_c, i);
8980
+ const r = Se(t.url, "/threads/:thread_id/runs/stream"), { thread_id: n } = Y(ut, r), i = await t.json(), s = Y(_c, i);
8981
8981
  return ln(
8982
8982
  un(async (a) => {
8983
8983
  s.config = s.config || {}, s.config.configurable = s.config.configurable || {};
@@ -8997,7 +8997,7 @@ async function Dc(t, e) {
8997
8997
  }
8998
8998
  async function Rc(t, e) {
8999
8999
  try {
9000
- const r = Se(t.url, "/threads/:thread_id/runs/:run_id/stream"), { thread_id: n, run_id: i } = q(on, r), s = dt(t.url), { cancel_on_disconnect: a, last_event_id: o, stream_mode: l } = q(Sc, s);
9000
+ const r = Se(t.url, "/threads/:thread_id/runs/:run_id/stream"), { thread_id: n, run_id: i } = Y(on, r), s = dt(t.url), { cancel_on_disconnect: a, last_event_id: o, stream_mode: l } = Y(Sc, s);
9001
9001
  return ln(
9002
9002
  un(async (c) => {
9003
9003
  const u = new AbortController();
@@ -9035,7 +9035,7 @@ async function Rc(t, e) {
9035
9035
  }
9036
9036
  async function Oc(t, e) {
9037
9037
  try {
9038
- const r = Se(t.url, "/threads/:thread_id/runs"), { thread_id: n } = q(ut, r), i = dt(t.url), { limit: s, offset: a, status: o } = q(vc, i), l = await se.runs.list(n, { limit: s, offset: a, status: o });
9038
+ const r = Se(t.url, "/threads/:thread_id/runs"), { thread_id: n } = Y(ut, r), i = dt(t.url), { limit: s, offset: a, status: o } = Y(vc, i), l = await se.runs.list(n, { limit: s, offset: a, status: o });
9039
9039
  return le(l);
9040
9040
  } catch (r) {
9041
9041
  return ee(r);
@@ -9043,7 +9043,7 @@ async function Oc(t, e) {
9043
9043
  }
9044
9044
  async function Nc(t, e) {
9045
9045
  try {
9046
- const r = Se(t.url, "/threads/:thread_id/runs/:run_id/cancel"), { thread_id: n, run_id: i } = q(on, r), s = dt(t.url), { wait: a, action: o } = q(xc, s), l = se.runs.cancel(n, i, a, o);
9046
+ const r = Se(t.url, "/threads/:thread_id/runs/:run_id/cancel"), { thread_id: n, run_id: i } = Y(on, r), s = dt(t.url), { wait: a, action: o } = Y(xc, s), l = se.runs.cancel(n, i, a, o);
9047
9047
  return a && await l, new Response(null, { status: a ? 204 : 202 });
9048
9048
  } catch (r) {
9049
9049
  return ee(r);
@@ -9051,7 +9051,7 @@ async function Nc(t, e) {
9051
9051
  }
9052
9052
  async function Lc(t, e) {
9053
9053
  try {
9054
- const r = Se(t.url, "/threads/:thread_id/state"), { thread_id: n } = q(T.object({ thread_id: T.string().uuid() }), r), i = await t.json(), s = q(jc, i), a = await se.threads.updateState(n, s);
9054
+ const r = Se(t.url, "/threads/:thread_id/state"), { thread_id: n } = Y(T.object({ thread_id: T.string().uuid() }), r), i = await t.json(), s = Y(jc, i), a = await se.threads.updateState(n, s);
9055
9055
  return le(a);
9056
9056
  } catch (r) {
9057
9057
  return ee(r);
@@ -9142,7 +9142,7 @@ async function Uc(t, e = {}) {
9142
9142
  await An();
9143
9143
  sc("code", kn);
9144
9144
  const Bc = (t, e = {}) => Uc(new Request(t, e), {}), zc = () => {
9145
- const t = Rr(), e = (/* @__PURE__ */ new Date()).toLocaleDateString(), { extraParams: r, AVAILABLE_MODELS: n, config: i } = ue(), s = r.mcp_config || {}, a = Object.keys(s).length, o = qn(), l = process.platform, c = l === "darwin" ? "macOS" : l === "win32" ? "Windows" : "Linux", u = process.cwd(), h = i?.model_provider || process.env.MODEL_PROVIDER || "openai", f = !!i?.openai_api_key, m = !!i?.openai_base_url, g = !!i?.anthropic_api_key, p = n.length > 0, y = h === "anthropic" ? g && p : f && m && p, [b, v] = x.useState(0);
9145
+ const t = Rr(), e = (/* @__PURE__ */ new Date()).toLocaleDateString(), { extraParams: r, AVAILABLE_MODELS: n, config: i } = ue(), s = r.mcp_config || {}, a = Object.keys(s).length, o = Yn(), l = process.platform, c = l === "darwin" ? "macOS" : l === "win32" ? "Windows" : "Linux", u = process.cwd(), h = i?.model_provider || process.env.MODEL_PROVIDER || "openai", f = !!i?.openai_api_key, m = !!i?.openai_base_url, g = !!i?.anthropic_api_key, p = n.length > 0, y = h === "anthropic" ? g && p : f && m && p, [b, v] = x.useState(0);
9146
9146
  return x.useEffect(() => {
9147
9147
  const I = setInterval(() => {
9148
9148
  v((k) => (k + 1) % 92);
@@ -9160,7 +9160,7 @@ const Bc = (t, e = {}) => Uc(new Request(t, e), {}), zc = () => {
9160
9160
  ███╔╝ ██╔══╝ ██║╚██╗██║
9161
9161
  ███████╗███████╗██║ ╚████║
9162
9162
  ╚══════╝╚══════╝╚═╝ ╚═══╝`.split(`
9163
- `).map((S) => /* @__PURE__ */ d.jsx(Ir, { interval: 40, text: S, globalIndex: b }, S)) }),
9163
+ `).map((S) => /* @__PURE__ */ d.jsx(Er, { interval: 40, text: S, globalIndex: b }, S)) }),
9164
9164
  /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", justifyContent: "center", flexGrow: 1, children: [
9165
9165
  /* @__PURE__ */ d.jsx(_, { marginBottom: 1, children: y ? /* @__PURE__ */ d.jsxs(w, { color: "green", bold: !0, children: [
9166
9166
  " ",
@@ -9526,7 +9526,7 @@ const Ge = new Hc(), Gc = {
9526
9526
  }
9527
9527
  }
9528
9528
  };
9529
- function Tr({ value: t, placeholder: e = "", focus: r = !0, mask: n, highlightPastedText: i = !1, showCursor: s = !0, onChange: a, onSubmit: o }) {
9529
+ function Cr({ value: t, placeholder: e = "", focus: r = !0, mask: n, highlightPastedText: i = !1, showCursor: s = !0, onChange: a, onSubmit: o }) {
9530
9530
  const [l, c] = x.useState({
9531
9531
  cursorOffset: (t || "").length,
9532
9532
  cursorWidth: 0
@@ -9590,7 +9590,7 @@ const Vc = {
9590
9590
  autoFocus: !0
9591
9591
  }
9592
9592
  ) : /* @__PURE__ */ d.jsx(
9593
- Tr,
9593
+ Cr,
9594
9594
  {
9595
9595
  value: i,
9596
9596
  onChange: s,
@@ -9625,7 +9625,7 @@ const Vc = {
9625
9625
  autoSubmit: !1
9626
9626
  }
9627
9627
  }
9628
- }, qc = {
9628
+ }, Yc = {
9629
9629
  type: "confirm",
9630
9630
  /**
9631
9631
  * 渲染确认交互
@@ -9679,7 +9679,7 @@ const Vc = {
9679
9679
  autoSubmit: !1
9680
9680
  }
9681
9681
  }
9682
- }, Yc = ({
9682
+ }, qc = ({
9683
9683
  items: t,
9684
9684
  defaultIndex: e = 0,
9685
9685
  onChange: r,
@@ -9806,7 +9806,7 @@ const Vc = {
9806
9806
  }
9807
9807
  );
9808
9808
  }, Xc = () => {
9809
- const t = at(), [e, r] = x.useState(null), { focusNext: n } = Mr(), i = x.useMemo(() => t.getInteractions(), [t.getInteractions()]);
9809
+ const t = at(), [e, r] = x.useState(null), { focusNext: n } = zt(), i = x.useMemo(() => t.getInteractions(), [t.getInteractions()]);
9810
9810
  x.useEffect(() => {
9811
9811
  i.length > 0 && !e && r(i[0].id);
9812
9812
  }, [i, e]);
@@ -9864,7 +9864,7 @@ const Vc = {
9864
9864
  ")"
9865
9865
  ] }) }),
9866
9866
  /* @__PURE__ */ d.jsx(_, { paddingX: 1, marginBottom: 1, children: /* @__PURE__ */ d.jsx(
9867
- Yc,
9867
+ qc,
9868
9868
  {
9869
9869
  items: s,
9870
9870
  defaultIndex: s.findIndex((c) => c.id === e),
@@ -9878,12 +9878,12 @@ const Vc = {
9878
9878
  ] });
9879
9879
  };
9880
9880
  function el() {
9881
- Ge.register("approval", Jc), Ge.register("selection", Qc), Ge.register("input", Vc), Ge.register("confirm", qc);
9881
+ Ge.register("approval", Jc), Ge.register("selection", Qc), Ge.register("input", Vc), Ge.register("confirm", Yc);
9882
9882
  }
9883
9883
  el();
9884
9884
  const tl = ({ tool: t }) => {
9885
9885
  const { addInteraction: e, getInteractions: r, updateInteraction: n } = at(), [i, s] = x.useState(null), a = x.useRef(!1), o = t.getInputRepaired();
9886
- return require("ink").useFocusManager(), x.useEffect(() => {
9886
+ return zt(), x.useEffect(() => {
9887
9887
  if (t.state === "interrupted" && !i && !a.current) {
9888
9888
  const c = {
9889
9889
  type: "selection",
@@ -10034,9 +10034,9 @@ const tl = ({ tool: t }) => {
10034
10034
  return /* @__PURE__ */ d.jsx(nl, { tool: t });
10035
10035
  }
10036
10036
  });
10037
- var Et = { exports: {} }, Cr;
10037
+ var Et = { exports: {} }, jr;
10038
10038
  function il() {
10039
- return Cr || (Cr = 1, (function(t) {
10039
+ return jr || (jr = 1, (function(t) {
10040
10040
  var e = function() {
10041
10041
  this.Diff_Timeout = 1, this.Diff_EditCost = 4, this.Match_Threshold = 0.5, this.Match_Distance = 1e3, this.Patch_DeleteThreshold = 0.5, this.Patch_Margin = 4, this.Match_MaxBits = 32;
10042
10042
  }, r = -1, n = 1, i = 0;
@@ -10739,12 +10739,12 @@ function ol(t, e, r) {
10739
10739
  }
10740
10740
  return h;
10741
10741
  }
10742
- function jr(t, e = 1e3) {
10742
+ function Ir(t, e = 1e3) {
10743
10743
  return t = t || "", t.length > e || t.split(`
10744
10744
  `).length > 50;
10745
10745
  }
10746
10746
  function cl(t, e, r) {
10747
- const n = jr(t) || jr(e), s = r !== void 0 && "maxLines" in r ? r.maxLines : n ? 10 : 20, a = r?.contextLines ?? (n ? 1 : 3);
10747
+ const n = Ir(t) || Ir(e), s = r !== void 0 && "maxLines" in r ? r.maxLines : n ? 10 : 20, a = r?.contextLines ?? (n ? 1 : 3);
10748
10748
  return ol(t, e, { maxLines: s, contextLines: a });
10749
10749
  }
10750
10750
  const ht = ({ path: t, color: e = "cyan", line: r }) => {
@@ -10882,11 +10882,11 @@ const ht = ({ path: t, color: e = "cyan", line: r }) => {
10882
10882
  !r && /* @__PURE__ */ d.jsx(_, { marginTop: 0, children: /* @__PURE__ */ d.jsx(w, { color: "gray", children: "Press Enter to confirm, Ctrl+C to cancel" }) })
10883
10883
  ] });
10884
10884
  }
10885
- }), yl = Ar.schema, wl = de({
10885
+ }), yl = kr.schema, wl = de({
10886
10886
  name: "folder_operations",
10887
10887
  description: "Unified folder operations tool supporting create, list, delete, and existence check",
10888
10888
  parameters: yl.shape,
10889
- handler: async (t) => await Ar.invoke(t),
10889
+ handler: async (t) => await kr.invoke(t),
10890
10890
  render(t) {
10891
10891
  const e = t.getInputRepaired(), r = t.output;
10892
10892
  if (!r) return /* @__PURE__ */ d.jsx(d.Fragment, {});
@@ -11247,7 +11247,7 @@ const Sl = ({ onClose: t }) => {
11247
11247
  ] }),
11248
11248
  /* @__PURE__ */ d.jsx(_, { children: /* @__PURE__ */ d.jsx(w, { dimColor: !0, children: r?.slice(0, 6) || "N/A" }) })
11249
11249
  ] }) });
11250
- }, Ye = {
11250
+ }, qe = {
11251
11251
  pickup: { emoji: "📥", color: "cyan", label: "待领取" },
11252
11252
  running: { emoji: "🔄", color: "yellow", label: "运行中" },
11253
11253
  complete: { emoji: "✅", color: "green", label: "已完成" },
@@ -11262,7 +11262,7 @@ const Sl = ({ onClose: t }) => {
11262
11262
  Ft((o, l) => {
11263
11263
  l.escape ? e() : l.return && r ? (t.status === "pickup" || t.status === "error" || t.status === "feedback") && r(t) : (l.backspace || l.delete) && n && n(t);
11264
11264
  });
11265
- const i = t.status ? Ye[t.status] : Ye.pickup, s = t.status === "pickup" || t.status === "error" || t.status === "feedback", a = t.complexity ? El[t.complexity] : null;
11265
+ const i = t.status ? qe[t.status] : qe.pickup, s = t.status === "pickup" || t.status === "error" || t.status === "feedback", a = t.complexity ? El[t.complexity] : null;
11266
11266
  return /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", paddingX: 1, children: [
11267
11267
  /* @__PURE__ */ d.jsxs(_, { borderStyle: "single", paddingX: 1, marginBottom: 1, children: [
11268
11268
  /* @__PURE__ */ d.jsxs(w, { bold: !0, color: "cyan", children: [
@@ -11340,7 +11340,7 @@ const Sl = ({ onClose: t }) => {
11340
11340
  "):"
11341
11341
  ] }),
11342
11342
  t.children.map((o, l) => {
11343
- const c = o.status ? Ye[o.status] : Ye.pickup;
11343
+ const c = o.status ? qe[o.status] : qe.pickup;
11344
11344
  return /* @__PURE__ */ d.jsx(_, { children: /* @__PURE__ */ d.jsxs(w, { color: c.color, children: [
11345
11345
  c.emoji,
11346
11346
  " ",
@@ -11369,7 +11369,7 @@ const Sl = ({ onClose: t }) => {
11369
11369
  }, Ml = ({ onClose: t, onExecuteTask: e }) => {
11370
11370
  const [r, n] = x.useState(null), [i, s] = x.useState(0), a = x.useCallback(async () => {
11371
11371
  try {
11372
- const { getTasksStore: u } = await import("./tasks-BemLKkuC.mjs"), h = u(process.cwd());
11372
+ const { getTasksStore: u } = await import("./tasks-D9VxaG3A.mjs"), h = u(process.cwd());
11373
11373
  return await h.initialize(), await h.getAllTasks();
11374
11374
  } catch (u) {
11375
11375
  return console.error("Failed to load tasks:", u), [];
@@ -11378,7 +11378,7 @@ const Sl = ({ onClose: t }) => {
11378
11378
  n(null);
11379
11379
  }, []), l = x.useCallback(async (u) => {
11380
11380
  try {
11381
- const { getTasksStore: h } = await import("./tasks-BemLKkuC.mjs"), f = h(process.cwd());
11381
+ const { getTasksStore: h } = await import("./tasks-D9VxaG3A.mjs"), f = h(process.cwd());
11382
11382
  await f.initialize(), await f.deleteTask(u.id) ? s((g) => g + 1) : console.error(`Failed to delete task: ${u.id}`);
11383
11383
  } catch (h) {
11384
11384
  console.error("Error deleting task:", h);
@@ -11506,7 +11506,7 @@ function Pl({
11506
11506
  const h = e.length;
11507
11507
  if (h > l.current) {
11508
11508
  l.current = h;
11509
- const f = e[h - 1], m = Zt(f);
11509
+ const f = e[h - 1], m = Jt(f);
11510
11510
  typeof m == "string" && m.includes("<COMPLETE></COMPLETE>") ? (o.current = !1, a(null), st("Ralph 循环完成")) : c(s);
11511
11511
  }
11512
11512
  }
@@ -11536,7 +11536,7 @@ const Dl = () => {
11536
11536
  e && !n() && /* @__PURE__ */ d.jsx(_, { marginTop: 1, paddingLeft: 1, children: /* @__PURE__ */ d.jsxs(w, { children: [
11537
11537
  /* @__PURE__ */ d.jsx(pn, { type: "dots" }),
11538
11538
  " ",
11539
- /* @__PURE__ */ d.jsx(Ir, { text: "正在思考中... Ctrl + C 中断" })
11539
+ /* @__PURE__ */ d.jsx(Er, { text: "正在思考中... Ctrl + C 中断" })
11540
11540
  ] }) }),
11541
11541
  r && /* @__PURE__ */ d.jsx(_, { marginTop: 0, paddingLeft: 1, children: /* @__PURE__ */ d.jsxs(w, { color: "red", children: [
11542
11542
  "❌ ",
@@ -11624,7 +11624,7 @@ const Dl = () => {
11624
11624
  }, [i, c, o, t, u]), x.useEffect(() => {
11625
11625
  !i && h.focus("global-input");
11626
11626
  }, [i]);
11627
- const h = Mr(), [f, m] = x.useState("chat");
11627
+ const h = zt(), [f, m] = x.useState("chat");
11628
11628
  Ft(
11629
11629
  (I, k) => {
11630
11630
  k.ctrl && I === "c" ? i ? s() : process.exit() : k.ctrl && I === "o" && f === "chat" && !i && e();