zen-code 3.0.0 → 3.0.2

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,15 +1,15 @@
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
- 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";
4
- import yn from "node:os";
5
- import { g as wn } from "./_commonjsHelpers-ByX85dGu.mjs";
1
+ import { a as x, R as xe, B as _, F as dn, j as d, T as w, u as Ft, r as hn } from "./use-input-1eSjZocJ.mjs";
2
+ import ye from "chalk";
3
+ import fn from "node:os";
4
+ import { g as mn } from "./_commonjsHelpers-ByX85dGu.mjs";
6
5
  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";
8
- import { parse as Un } from "marked";
9
- import Bn from "marked-terminal";
6
+ import { Z as O, s as Z, a as Er, b as gn, i as pn, c as yn, d as wn, e as bn, f as _n, m as vn, k as xn, A as Sn, h as Tn, j as Cn, g as jn, l as In, n as En, t as An, o as kn, q as Mn, v as Ar, w as Pn, x as Dn, y as Rn, M as On } from "./graphBuilder-BIhxVliV.mjs";
7
+ import { parse as Nn } from "marked";
8
+ import Ln from "marked-terminal";
9
+ import { a as Se, S as $n, u as Ut, M as Bt, c as Fn, b as Un, g as Bn } from "./get_allowed_models-tD7oPVgc.mjs";
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";
@@ -26,13 +26,13 @@ function kr(t) {
26
26
  flexDirection: "column",
27
27
  ...n
28
28
  }), [n]);
29
- return ve.createElement("ink-box", { internal_static: !0, style: l }, o);
29
+ return xe.createElement("ink-box", { internal_static: !0, style: l }, o);
30
30
  }
31
- function it() {
32
- return ve.createElement(_, { flexGrow: 1 });
31
+ function at() {
32
+ return xe.createElement(_, { flexGrow: 1 });
33
33
  }
34
- const Mr = () => {
35
- const t = x.useContext(hn);
34
+ const zt = () => {
35
+ const t = x.useContext(dn);
36
36
  return {
37
37
  enableFocus: t.enableFocus,
38
38
  disableFocus: t.disableFocus,
@@ -58,14 +58,14 @@ function Qn() {
58
58
  };
59
59
  }, []), t;
60
60
  }
61
- var Pr = /* @__PURE__ */ ((t) => (t.PANEL = "panel", t.INLINE = "inline", t.MODAL = "modal", t))(Pr || {});
62
- function Dr(t) {
61
+ var Mr = /* @__PURE__ */ ((t) => (t.PANEL = "panel", t.INLINE = "inline", t.MODAL = "modal", t))(Mr || {});
62
+ function Pr(t) {
63
63
  return t?.replace(process.cwd(), ".") || t || "";
64
64
  }
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",
@@ -233,16 +233,16 @@ process.env.TERM_PROGRAM === "iTerm.app", qn = () => process.env.TERM_PROGRAM ==
233
233
  fallback: "blue"
234
234
  /* BLUE */
235
235
  }
236
- }, oe = (t) => (t in gt || (t = "sky"), Vn() ? gt[t].hex : gt[t].fallback);
237
- function Rr() {
236
+ }, le = (t) => (t in gt || (t = "sky"), Vn() ? gt[t].hex : gt[t].fallback);
237
+ function Dr() {
238
238
  try {
239
- return yn.userInfo().username;
239
+ return fn.userInfo().username;
240
240
  } catch {
241
241
  return process.env.USER || process.env.USERNAME || "User";
242
242
  }
243
243
  }
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 = ({
244
+ var ce = /* @__PURE__ */ ((t) => (t.Pending = "pending", t.Approved = "approved", t.Edited = "edited", t.Rejected = "rejected", t))(ce || {});
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) => {
@@ -250,9 +250,9 @@ const Yn = x.createContext(null), Kn = ({
250
250
  if (!b)
251
251
  return;
252
252
  const { status: v, editedArgs: S } = y;
253
- if (v === ae.Approved)
253
+ if (v === ce.Approved)
254
254
  b.sendResumeData({ type: "approve" });
255
- else if (v === ae.Edited) {
255
+ else if (v === ce.Edited) {
256
256
  const C = {
257
257
  name: b.message.name,
258
258
  args: S
@@ -261,7 +261,7 @@ const Yn = x.createContext(null), Kn = ({
261
261
  type: "edit",
262
262
  edited_action: C
263
263
  });
264
- } else v === ae.Rejected ? b.sendResumeData({
264
+ } else v === ce.Rejected ? b.sendResumeData({
265
265
  type: "reject",
266
266
  message: "User rejected to run this tool"
267
267
  }) : console.error("[ChatWrapper] Unknown approval status:", v);
@@ -269,7 +269,7 @@ const Yn = x.createContext(null), Kn = ({
269
269
  const b = {
270
270
  ...y,
271
271
  id: a(),
272
- status: ae.Pending,
272
+ status: ce.Pending,
273
273
  createdAt: /* @__PURE__ */ new Date()
274
274
  };
275
275
  return r((v) => {
@@ -287,12 +287,12 @@ const Yn = x.createContext(null), Kn = ({
287
287
  });
288
288
  }, [n]), u = x.useCallback(() => {
289
289
  r((y) => {
290
- const b = y.filter((v) => v.status === ae.Pending);
290
+ const b = y.filter((v) => v.status === ce.Pending);
291
291
  return b.length === 0 ? i(null) : n && !b.find((v) => v.id === n) && i(b[0].id), b;
292
292
  });
293
293
  }, [n]), h = x.useCallback(async () => {
294
294
  const y = e.filter(
295
- (b) => b.status === ae.Approved || b.status === ae.Edited || b.status === ae.Rejected
295
+ (b) => b.status === ce.Approved || b.status === ce.Edited || b.status === ce.Rejected
296
296
  );
297
297
  if (y.length !== 0) {
298
298
  for (const b of y)
@@ -306,7 +306,7 @@ const Yn = x.createContext(null), Kn = ({
306
306
  }, [e, s, u]), f = x.useCallback(async (y) => {
307
307
  await s(y);
308
308
  }, [s]), m = x.useMemo(
309
- () => e.some((y) => y.status === ae.Pending),
309
+ () => e.some((y) => y.status === ce.Pending),
310
310
  [e]
311
311
  ), g = x.useMemo(
312
312
  () => e.length > 0 && !m,
@@ -329,8 +329,8 @@ 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 });
333
- }, Or = x.createContext(null), Xn = ({ children: t }) => {
332
+ return /* @__PURE__ */ d.jsx(qn.Provider, { value: p, children: t });
333
+ }, Rr = x.createContext(null), Xn = ({ children: t }) => {
334
334
  const [e, r] = x.useState(""), n = x.useCallback(() => {
335
335
  r("");
336
336
  }, []), i = {
@@ -338,13 +338,13 @@ const Yn = x.createContext(null), Kn = ({
338
338
  setBufferedMessage: r,
339
339
  clearBuffer: n
340
340
  };
341
- return /* @__PURE__ */ d.jsx(Or.Provider, { value: i, children: t });
342
- }, Nr = () => {
343
- const t = x.useContext(Or);
341
+ return /* @__PURE__ */ d.jsx(Rr.Provider, { value: i, children: t });
342
+ }, Or = () => {
343
+ const t = x.useContext(Rr);
344
344
  if (!t)
345
345
  throw new Error("useChatInputBuffer must be used within ChatInputBufferProvider");
346
346
  return t;
347
- }, Lr = x.createContext(void 0), es = ({ manager: t, get_allowed_models: e, children: r }) => {
347
+ }, Nr = x.createContext(void 0), es = ({ manager: t, get_allowed_models: e, children: r }) => {
348
348
  const [n, i] = x.useState(null), [s, a] = x.useState(!0), [o, l] = x.useState([]), c = x.useMemo(() => ({
349
349
  main_model: n?.main_model || o[0]?.id,
350
350
  mcp_config: n?.mcp_config,
@@ -372,14 +372,14 @@ const Yn = x.createContext(null), Kn = ({
372
372
  const p = await t.getConfig();
373
373
  i(p);
374
374
  };
375
- return s ? null : /* @__PURE__ */ d.jsx(Lr.Provider, { value: { config: n, updateConfig: m, extraParams: c, AVAILABLE_MODELS: o, manager: t, compactMode: u, toggleCompactMode: h }, children: r });
376
- }, ue = () => {
377
- const t = x.useContext(Lr);
375
+ return s ? null : /* @__PURE__ */ d.jsx(Nr.Provider, { value: { config: n, updateConfig: m, extraParams: c, AVAILABLE_MODELS: o, manager: t, compactMode: u, toggleCompactMode: h }, children: r });
376
+ }, he = () => {
377
+ const t = x.useContext(Nr);
378
378
  if (t === void 0)
379
379
  throw new Error("useSettings must be used within a SettingsProvider");
380
380
  return t;
381
- }, $r = x.createContext(null), at = () => {
382
- const t = x.useContext($r);
381
+ }, Lr = x.createContext(null), ot = () => {
382
+ const t = x.useContext(Lr);
383
383
  if (!t)
384
384
  throw new Error("useInteractionContext must be used within InteractionProvider");
385
385
  return t;
@@ -390,7 +390,7 @@ const Yn = x.createContext(null), Kn = ({
390
390
  const [r, n] = x.useState([]), [i, s] = x.useState(0), a = x.useCallback(() => `interaction_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`, []), o = x.useCallback((C, j) => {
391
391
  const A = /* @__PURE__ */ new Date(), I = {
392
392
  id: a(),
393
- category: Pr.PANEL,
393
+ category: Mr.PANEL,
394
394
  state: "idle",
395
395
  metadata: {
396
396
  title: j?.metadata?.title,
@@ -488,11 +488,11 @@ const Yn = x.createContext(null), Kn = ({
488
488
  v
489
489
  ]
490
490
  );
491
- return /* @__PURE__ */ d.jsx($r.Provider, { value: S, children: t });
492
- }, Fr = ({ content: t, messageNumber: e }) => {
493
- const r = Rr(), n = () => typeof t == "string" ? /* @__PURE__ */ d.jsx(w, { color: "white", children: t }) : Array.isArray(t) ? t.filter((i) => i.type === "text").map((i, s) => /* @__PURE__ */ d.jsx(w, { color: "white", children: i.text })) : /* @__PURE__ */ d.jsx(w, { color: "white", children: JSON.stringify(t) });
491
+ return /* @__PURE__ */ d.jsx(Lr.Provider, { value: S, children: t });
492
+ }, $r = ({ content: t, messageNumber: e }) => {
493
+ const r = Dr(), n = () => typeof t == "string" ? /* @__PURE__ */ d.jsx(w, { color: "white", children: t }) : Array.isArray(t) ? t.filter((i) => i.type === "text").map((i, s) => /* @__PURE__ */ d.jsx(w, { color: "white", children: i.text })) : /* @__PURE__ */ d.jsx(w, { color: "white", children: JSON.stringify(t) });
494
494
  return /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", children: [
495
- /* @__PURE__ */ d.jsx(_, { children: /* @__PURE__ */ d.jsxs(w, { color: oe("amber"), children: [
495
+ /* @__PURE__ */ d.jsx(_, { children: /* @__PURE__ */ d.jsxs(w, { color: le("amber"), children: [
496
496
  e,
497
497
  " ",
498
498
  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__ */ mn(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: ["#"],
@@ -654,13 +654,13 @@ const zt = /* @__PURE__ */ wn(ns), ss = /* @__PURE__ */ Symbol("Let zodToJsonSch
654
654
  }
655
655
  ]))
656
656
  };
657
- }, Ur = (t, e) => {
657
+ }, Fr = (t, e) => {
658
658
  let r = 0;
659
659
  for (; r < t.length && r < e.length && t[r] === e[r]; r++)
660
660
  ;
661
661
  return [(t.length - r).toString(), ...e.slice(r)].join("/");
662
662
  };
663
- function K(t) {
663
+ function X(t) {
664
664
  if (t.target !== "openAi")
665
665
  return {};
666
666
  const e = [
@@ -669,17 +669,17 @@ function K(t) {
669
669
  t.openAiAnyTypeName
670
670
  ];
671
671
  return t.flags.hasReferencedOpenAiAnyType = !0, {
672
- $ref: t.$refStrategy === "relative" ? Ur(e, t.currentPath) : e.join("/")
672
+ $ref: t.$refStrategy === "relative" ? Fr(e, t.currentPath) : e.join("/")
673
673
  };
674
674
  }
675
675
  function cs(t, e) {
676
676
  const r = {
677
677
  type: "array"
678
678
  };
679
- return t.type?._def && t.type?._def?.typeName !== O.ZodAny && (r.items = B(t.type._def, {
679
+ return t.type?._def && t.type?._def?.typeName !== O.ZodAny && (r.items = U(t.type._def, {
680
680
  ...e,
681
681
  currentPath: [...e.currentPath, "items"]
682
- })), t.minLength && J(r, "minItems", t.minLength.value, t.minLength.message, e), t.maxLength && J(r, "maxItems", t.maxLength.value, t.maxLength.message, e), t.exactLength && (J(r, "minItems", t.exactLength.value, t.exactLength.message, e), J(r, "maxItems", t.exactLength.value, t.exactLength.message, e)), r;
682
+ })), t.minLength && Z(r, "minItems", t.minLength.value, t.minLength.message, e), t.maxLength && Z(r, "maxItems", t.maxLength.value, t.maxLength.message, e), t.exactLength && (Z(r, "minItems", t.exactLength.value, t.exactLength.message, e), Z(r, "maxItems", t.exactLength.value, t.exactLength.message, e)), r;
683
683
  }
684
684
  function ls(t, e) {
685
685
  const r = {
@@ -691,13 +691,13 @@ function ls(t, e) {
691
691
  for (const n of t.checks)
692
692
  switch (n.kind) {
693
693
  case "min":
694
- e.target === "jsonSchema7" ? n.inclusive ? J(r, "minimum", n.value, n.message, e) : J(r, "exclusiveMinimum", n.value, n.message, e) : (n.inclusive || (r.exclusiveMinimum = !0), J(r, "minimum", n.value, n.message, e));
694
+ e.target === "jsonSchema7" ? n.inclusive ? Z(r, "minimum", n.value, n.message, e) : Z(r, "exclusiveMinimum", n.value, n.message, e) : (n.inclusive || (r.exclusiveMinimum = !0), Z(r, "minimum", n.value, n.message, e));
695
695
  break;
696
696
  case "max":
697
- e.target === "jsonSchema7" ? n.inclusive ? J(r, "maximum", n.value, n.message, e) : J(r, "exclusiveMaximum", n.value, n.message, e) : (n.inclusive || (r.exclusiveMaximum = !0), J(r, "maximum", n.value, n.message, e));
697
+ e.target === "jsonSchema7" ? n.inclusive ? Z(r, "maximum", n.value, n.message, e) : Z(r, "exclusiveMaximum", n.value, n.message, e) : (n.inclusive || (r.exclusiveMaximum = !0), Z(r, "maximum", n.value, n.message, e));
698
698
  break;
699
699
  case "multipleOf":
700
- J(r, "multipleOf", n.value, n.message, e);
700
+ Z(r, "multipleOf", n.value, n.message, e);
701
701
  break;
702
702
  }
703
703
  return r;
@@ -707,15 +707,15 @@ function us() {
707
707
  type: "boolean"
708
708
  };
709
709
  }
710
- function Br(t, e) {
711
- return B(t.type._def, e);
710
+ function Ur(t, e) {
711
+ return U(t.type._def, e);
712
712
  }
713
- const ds = (t, e) => B(t.innerType._def, e);
714
- function zr(t, e, r) {
713
+ const ds = (t, e) => U(t.innerType._def, e);
714
+ function Br(t, e, r) {
715
715
  const n = r ?? e.dateStrategy;
716
716
  if (Array.isArray(n))
717
717
  return {
718
- anyOf: n.map((i, s) => zr(t, e, i))
718
+ anyOf: n.map((i, s) => Br(t, e, i))
719
719
  };
720
720
  switch (n) {
721
721
  case "string":
@@ -743,7 +743,7 @@ const hs = (t, e) => {
743
743
  for (const n of t.checks)
744
744
  switch (n.kind) {
745
745
  case "min":
746
- J(
746
+ Z(
747
747
  r,
748
748
  "minimum",
749
749
  n.value,
@@ -753,7 +753,7 @@ const hs = (t, e) => {
753
753
  );
754
754
  break;
755
755
  case "max":
756
- J(
756
+ Z(
757
757
  r,
758
758
  "maximum",
759
759
  n.value,
@@ -767,12 +767,12 @@ const hs = (t, e) => {
767
767
  };
768
768
  function fs(t, e) {
769
769
  return {
770
- ...B(t.innerType._def, e),
770
+ ...U(t.innerType._def, e),
771
771
  default: t.defaultValue()
772
772
  };
773
773
  }
774
774
  function ms(t, e) {
775
- return e.effectStrategy === "input" ? B(t.schema._def, e) : K(e);
775
+ return e.effectStrategy === "input" ? U(t.schema._def, e) : X(e);
776
776
  }
777
777
  function gs(t) {
778
778
  return {
@@ -783,11 +783,11 @@ function gs(t) {
783
783
  const ps = (t) => "type" in t && t.type === "string" ? !1 : "allOf" in t;
784
784
  function ys(t, e) {
785
785
  const r = [
786
- B(t.left._def, {
786
+ U(t.left._def, {
787
787
  ...e,
788
788
  currentPath: [...e.currentPath, "allOf", "0"]
789
789
  }),
790
- B(t.right._def, {
790
+ U(t.right._def, {
791
791
  ...e,
792
792
  currentPath: [...e.currentPath, "allOf", "1"]
793
793
  })
@@ -823,23 +823,23 @@ function ws(t, e) {
823
823
  const: t.value
824
824
  };
825
825
  }
826
- function Hr(t, e) {
826
+ function zr(t, e) {
827
827
  if (e.target === "openAi" && console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."), e.target === "openApi3" && t.keyType?._def.typeName === O.ZodEnum)
828
828
  return {
829
829
  type: "object",
830
830
  required: t.keyType._def.values,
831
831
  properties: t.keyType._def.values.reduce((n, i) => ({
832
832
  ...n,
833
- [i]: B(t.valueType._def, {
833
+ [i]: U(t.valueType._def, {
834
834
  ...e,
835
835
  currentPath: [...e.currentPath, "properties", i]
836
- }) ?? K(e)
836
+ }) ?? X(e)
837
837
  }), {}),
838
838
  additionalProperties: e.rejectedAdditionalProperties
839
839
  };
840
840
  const r = {
841
841
  type: "object",
842
- additionalProperties: B(t.valueType._def, {
842
+ additionalProperties: U(t.valueType._def, {
843
843
  ...e,
844
844
  currentPath: [...e.currentPath, "additionalProperties"]
845
845
  }) ?? e.allowedAdditionalProperties
@@ -861,7 +861,7 @@ function Hr(t, e) {
861
861
  }
862
862
  };
863
863
  if (t.keyType?._def.typeName === O.ZodBranded && t.keyType._def.type._def.typeName === O.ZodString && t.keyType._def.type._def.checks?.length) {
864
- const { type: n, ...i } = Br(t.keyType._def, e);
864
+ const { type: n, ...i } = Ur(t.keyType._def, e);
865
865
  return {
866
866
  ...r,
867
867
  propertyNames: i
@@ -872,14 +872,14 @@ function Hr(t, e) {
872
872
  }
873
873
  function bs(t, e) {
874
874
  if (e.mapStrategy === "record")
875
- return Hr(t, e);
876
- const r = B(t.keyType._def, {
875
+ return zr(t, e);
876
+ const r = U(t.keyType._def, {
877
877
  ...e,
878
878
  currentPath: [...e.currentPath, "items", "items", "0"]
879
- }) || K(e), n = B(t.valueType._def, {
879
+ }) || X(e), n = U(t.valueType._def, {
880
880
  ...e,
881
881
  currentPath: [...e.currentPath, "items", "items", "1"]
882
- }) || K(e);
882
+ }) || X(e);
883
883
  return {
884
884
  type: "array",
885
885
  maxItems: 125,
@@ -900,7 +900,7 @@ function _s(t) {
900
900
  }
901
901
  function vs(t) {
902
902
  return t.target === "openAi" ? void 0 : {
903
- not: K({
903
+ not: X({
904
904
  ...t,
905
905
  currentPath: [...t.currentPath, "not"]
906
906
  })
@@ -914,7 +914,7 @@ function xs(t) {
914
914
  type: "null"
915
915
  };
916
916
  }
917
- const tt = {
917
+ const rt = {
918
918
  ZodString: "string",
919
919
  ZodNumber: "number",
920
920
  ZodBigInt: "integer",
@@ -923,11 +923,11 @@ 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
- if (r.every((n) => n._def.typeName in tt && (!n._def.checks || !n._def.checks.length))) {
928
+ if (r.every((n) => n._def.typeName in rt && (!n._def.checks || !n._def.checks.length))) {
929
929
  const n = r.reduce((i, s) => {
930
- const a = tt[s._def.typeName];
930
+ const a = rt[s._def.typeName];
931
931
  return a && !i.includes(a) ? [...i, a] : i;
932
932
  }, []);
933
933
  return {
@@ -965,10 +965,10 @@ 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) => {
971
- const r = (t.options instanceof Map ? Array.from(t.options.values()) : t.options).map((n, i) => B(n._def, {
970
+ const Xt = (t, e) => {
971
+ const r = (t.options instanceof Map ? Array.from(t.options.values()) : t.options).map((n, i) => U(n._def, {
972
972
  ...e,
973
973
  currentPath: [...e.currentPath, "anyOf", `${i}`]
974
974
  })).filter((n) => !!n && (!e.strictUnions || typeof n == "object" && Object.keys(n).length > 0));
@@ -977,22 +977,22 @@ const Kt = (t, e) => {
977
977
  function Ts(t, e) {
978
978
  if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(t.innerType._def.typeName) && (!t.innerType._def.checks || !t.innerType._def.checks.length))
979
979
  return e.target === "openApi3" ? {
980
- type: tt[t.innerType._def.typeName],
980
+ type: rt[t.innerType._def.typeName],
981
981
  nullable: !0
982
982
  } : {
983
983
  type: [
984
- tt[t.innerType._def.typeName],
984
+ rt[t.innerType._def.typeName],
985
985
  "null"
986
986
  ]
987
987
  };
988
988
  if (e.target === "openApi3") {
989
- const n = B(t.innerType._def, {
989
+ const n = U(t.innerType._def, {
990
990
  ...e,
991
991
  currentPath: [...e.currentPath]
992
992
  });
993
993
  return n && "$ref" in n ? { allOf: [n], nullable: !0 } : n && { ...n, nullable: !0 };
994
994
  }
995
- const r = B(t.innerType._def, {
995
+ const r = U(t.innerType._def, {
996
996
  ...e,
997
997
  currentPath: [...e.currentPath, "anyOf", "0"]
998
998
  });
@@ -1007,16 +1007,16 @@ function Cs(t, e) {
1007
1007
  for (const n of t.checks)
1008
1008
  switch (n.kind) {
1009
1009
  case "int":
1010
- r.type = "integer", bn(r, "type", n.message, e);
1010
+ r.type = "integer", gn(r, "type", n.message, e);
1011
1011
  break;
1012
1012
  case "min":
1013
- e.target === "jsonSchema7" ? n.inclusive ? J(r, "minimum", n.value, n.message, e) : J(r, "exclusiveMinimum", n.value, n.message, e) : (n.inclusive || (r.exclusiveMinimum = !0), J(r, "minimum", n.value, n.message, e));
1013
+ e.target === "jsonSchema7" ? n.inclusive ? Z(r, "minimum", n.value, n.message, e) : Z(r, "exclusiveMinimum", n.value, n.message, e) : (n.inclusive || (r.exclusiveMinimum = !0), Z(r, "minimum", n.value, n.message, e));
1014
1014
  break;
1015
1015
  case "max":
1016
- e.target === "jsonSchema7" ? n.inclusive ? J(r, "maximum", n.value, n.message, e) : J(r, "exclusiveMaximum", n.value, n.message, e) : (n.inclusive || (r.exclusiveMaximum = !0), J(r, "maximum", n.value, n.message, e));
1016
+ e.target === "jsonSchema7" ? n.inclusive ? Z(r, "maximum", n.value, n.message, e) : Z(r, "exclusiveMaximum", n.value, n.message, e) : (n.inclusive || (r.exclusiveMaximum = !0), Z(r, "maximum", n.value, n.message, e));
1017
1017
  break;
1018
1018
  case "multipleOf":
1019
- J(r, "multipleOf", n.value, n.message, e);
1019
+ Z(r, "multipleOf", n.value, n.message, e);
1020
1020
  break;
1021
1021
  }
1022
1022
  return r;
@@ -1032,7 +1032,7 @@ function js(t, e) {
1032
1032
  continue;
1033
1033
  let c = Es(l);
1034
1034
  c && r && (l._def.typeName === "ZodOptional" && (l = l._def.innerType), l.isNullable() || (l = l.nullable()), c = !1);
1035
- const u = B(l._def, {
1035
+ const u = U(l._def, {
1036
1036
  ...e,
1037
1037
  currentPath: [...e.currentPath, "properties", o],
1038
1038
  propertyPath: [...e.currentPath, "properties", o]
@@ -1045,7 +1045,7 @@ function js(t, e) {
1045
1045
  }
1046
1046
  function Is(t, e) {
1047
1047
  if (t.catchall._def.typeName !== "ZodNever")
1048
- return B(t.catchall._def, {
1048
+ return U(t.catchall._def, {
1049
1049
  ...e,
1050
1050
  currentPath: [...e.currentPath, "additionalProperties"]
1051
1051
  });
@@ -1067,28 +1067,28 @@ function Es(t) {
1067
1067
  }
1068
1068
  const As = (t, e) => {
1069
1069
  if (e.currentPath.toString() === e.propertyPath?.toString())
1070
- return B(t.innerType._def, e);
1071
- const r = B(t.innerType._def, {
1070
+ return U(t.innerType._def, e);
1071
+ const r = U(t.innerType._def, {
1072
1072
  ...e,
1073
1073
  currentPath: [...e.currentPath, "anyOf", "1"]
1074
1074
  });
1075
1075
  return r ? {
1076
1076
  anyOf: [
1077
1077
  {
1078
- not: K(e)
1078
+ not: X(e)
1079
1079
  },
1080
1080
  r
1081
1081
  ]
1082
- } : K(e);
1082
+ } : X(e);
1083
1083
  }, ks = (t, e) => {
1084
1084
  if (e.pipeStrategy === "input")
1085
- return B(t.in._def, e);
1085
+ return U(t.in._def, e);
1086
1086
  if (e.pipeStrategy === "output")
1087
- return B(t.out._def, e);
1088
- const r = B(t.in._def, {
1087
+ return U(t.out._def, e);
1088
+ const r = U(t.in._def, {
1089
1089
  ...e,
1090
1090
  currentPath: [...e.currentPath, "allOf", "0"]
1091
- }), n = B(t.out._def, {
1091
+ }), n = U(t.out._def, {
1092
1092
  ...e,
1093
1093
  currentPath: [...e.currentPath, "allOf", r ? "1" : "0"]
1094
1094
  });
@@ -1097,28 +1097,28 @@ const As = (t, e) => {
1097
1097
  };
1098
1098
  };
1099
1099
  function Ms(t, e) {
1100
- return B(t.type._def, e);
1100
+ return U(t.type._def, e);
1101
1101
  }
1102
1102
  function Ps(t, e) {
1103
1103
  const n = {
1104
1104
  type: "array",
1105
1105
  uniqueItems: !0,
1106
- items: B(t.valueType._def, {
1106
+ items: U(t.valueType._def, {
1107
1107
  ...e,
1108
1108
  currentPath: [...e.currentPath, "items"]
1109
1109
  })
1110
1110
  };
1111
- return t.minSize && J(n, "minItems", t.minSize.value, t.minSize.message, e), t.maxSize && J(n, "maxItems", t.maxSize.value, t.maxSize.message, e), n;
1111
+ return t.minSize && Z(n, "minItems", t.minSize.value, t.minSize.message, e), t.maxSize && Z(n, "maxItems", t.maxSize.value, t.maxSize.message, e), n;
1112
1112
  }
1113
1113
  function Ds(t, e) {
1114
1114
  return t.rest ? {
1115
1115
  type: "array",
1116
1116
  minItems: t.items.length,
1117
- items: t.items.map((r, n) => B(r._def, {
1117
+ items: t.items.map((r, n) => U(r._def, {
1118
1118
  ...e,
1119
1119
  currentPath: [...e.currentPath, "items", `${n}`]
1120
1120
  })).reduce((r, n) => n === void 0 ? r : [...r, n], []),
1121
- additionalItems: B(t.rest._def, {
1121
+ additionalItems: U(t.rest._def, {
1122
1122
  ...e,
1123
1123
  currentPath: [...e.currentPath, "additionalItems"]
1124
1124
  })
@@ -1126,7 +1126,7 @@ function Ds(t, e) {
1126
1126
  type: "array",
1127
1127
  minItems: t.items.length,
1128
1128
  maxItems: t.items.length,
1129
- items: t.items.map((r, n) => B(r._def, {
1129
+ items: t.items.map((r, n) => U(r._def, {
1130
1130
  ...e,
1131
1131
  currentPath: [...e.currentPath, "items", `${n}`]
1132
1132
  })).reduce((r, n) => n === void 0 ? r : [...r, n], [])
@@ -1134,13 +1134,13 @@ function Ds(t, e) {
1134
1134
  }
1135
1135
  function Rs(t) {
1136
1136
  return {
1137
- not: K(t)
1137
+ not: X(t)
1138
1138
  };
1139
1139
  }
1140
1140
  function Os(t) {
1141
- return K(t);
1141
+ return X(t);
1142
1142
  }
1143
- const Ns = (t, e) => B(t.innerType._def, e), Ls = (t, e, r) => {
1143
+ const Ns = (t, e) => U(t.innerType._def, e), Ls = (t, e, r) => {
1144
1144
  switch (e) {
1145
1145
  case O.ZodString:
1146
1146
  return Er(t, r);
@@ -1153,7 +1153,7 @@ const Ns = (t, e) => B(t.innerType._def, e), Ls = (t, e, r) => {
1153
1153
  case O.ZodBoolean:
1154
1154
  return us();
1155
1155
  case O.ZodDate:
1156
- return zr(t, r);
1156
+ return Br(t, r);
1157
1157
  case O.ZodUndefined:
1158
1158
  return Rs(r);
1159
1159
  case O.ZodNull:
@@ -1168,7 +1168,7 @@ const Ns = (t, e) => B(t.innerType._def, e), Ls = (t, e, r) => {
1168
1168
  case O.ZodTuple:
1169
1169
  return Ds(t, r);
1170
1170
  case O.ZodRecord:
1171
- return Hr(t, r);
1171
+ return zr(t, r);
1172
1172
  case O.ZodLiteral:
1173
1173
  return ws(t, r);
1174
1174
  case O.ZodEnum:
@@ -1193,13 +1193,13 @@ const Ns = (t, e) => B(t.innerType._def, e), Ls = (t, e, r) => {
1193
1193
  case O.ZodEffects:
1194
1194
  return ms(t, r);
1195
1195
  case O.ZodAny:
1196
- return K(r);
1196
+ return X(r);
1197
1197
  case O.ZodUnknown:
1198
1198
  return Os(r);
1199
1199
  case O.ZodDefault:
1200
1200
  return fs(t, r);
1201
1201
  case O.ZodBranded:
1202
- return Br(t, r);
1202
+ return Ur(t, r);
1203
1203
  case O.ZodReadonly:
1204
1204
  return Ns(t, r);
1205
1205
  case O.ZodCatch:
@@ -1215,7 +1215,7 @@ const Ns = (t, e) => B(t.innerType._def, e), Ls = (t, e, r) => {
1215
1215
  })();
1216
1216
  }
1217
1217
  };
1218
- function B(t, e, r = !1) {
1218
+ function U(t, e, r = !1) {
1219
1219
  const n = e.seen.get(t);
1220
1220
  if (e.override) {
1221
1221
  const o = e.override?.(t, e, n, r);
@@ -1229,7 +1229,7 @@ function B(t, e, r = !1) {
1229
1229
  }
1230
1230
  const i = { def: t, path: e.currentPath, jsonSchema: void 0 };
1231
1231
  e.seen.set(t, i);
1232
- const s = Ls(t, t.typeName, e), a = typeof s == "function" ? B(s(), e) : s;
1232
+ const s = Ls(t, t.typeName, e), a = typeof s == "function" ? U(s(), e) : s;
1233
1233
  if (a && Fs(t, e, a), e.postProcess) {
1234
1234
  const o = e.postProcess(a, t, e);
1235
1235
  return i.jsonSchema = a, o;
@@ -1241,19 +1241,19 @@ const $s = (t, e) => {
1241
1241
  case "root":
1242
1242
  return { $ref: t.path.join("/") };
1243
1243
  case "relative":
1244
- return { $ref: Ur(e.currentPath, t.path) };
1244
+ return { $ref: Fr(e.currentPath, t.path) };
1245
1245
  case "none":
1246
1246
  case "seen":
1247
- return t.path.length < e.currentPath.length && t.path.every((r, n) => e.currentPath[n] === r) ? (console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`), K(e)) : e.$refStrategy === "seen" ? K(e) : void 0;
1247
+ return t.path.length < e.currentPath.length && t.path.every((r, n) => e.currentPath[n] === r) ? (console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`), X(e)) : e.$refStrategy === "seen" ? X(e) : void 0;
1248
1248
  }
1249
1249
  }, Fs = (t, e, r) => (t.description && (r.description = t.description, e.markdownDescription && (r.markdownDescription = t.description)), r), Us = (t, e) => {
1250
1250
  const r = os(e);
1251
1251
  let n;
1252
- const i = e?.name, s = B(
1252
+ const i = e?.name, s = U(
1253
1253
  t._def,
1254
1254
  r,
1255
1255
  !1
1256
- ) ?? K(r);
1256
+ ) ?? X(r);
1257
1257
  r.flags.hasReferencedOpenAiAnyType && (n || (n = {}), n[r.openAiAnyTypeName] || (n[r.openAiAnyTypeName] = {
1258
1258
  // Skipping "object" as no properties can be defined and additionalProperties must be "false"
1259
1259
  type: ["string", "number", "integer", "boolean", "array", "null"],
@@ -1280,7 +1280,7 @@ const $s = (t, e) => {
1280
1280
  }
1281
1281
  };
1282
1282
  return r.target === "jsonSchema7" ? a.$schema = "http://json-schema.org/draft-07/schema#" : (r.target === "jsonSchema2019-09" || r.target === "openAi") && (a.$schema = "https://json-schema.org/draft/2019-09/schema#"), r.target === "openAi" && ("anyOf" in a || "oneOf" in a || "allOf" in a || "type" in a && Array.isArray(a.type)) && console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."), a;
1283
- }, de = (t) => {
1283
+ }, fe = (t) => {
1284
1284
  const e = t.execute || (async (r, n) => {
1285
1285
  try {
1286
1286
  const i = await t.handler?.(r, n);
@@ -1298,7 +1298,7 @@ const $s = (t, e) => {
1298
1298
  description: t.description,
1299
1299
  parameters: t.isPureParams ? t.parameters : Us(D.object(t.parameters))
1300
1300
  });
1301
- class he {
1301
+ class me {
1302
1302
  tools = /* @__PURE__ */ new Map();
1303
1303
  // === 专门为前端设计的异步触发结构
1304
1304
  waitingMap = /* @__PURE__ */ new Map();
@@ -1391,7 +1391,7 @@ class he {
1391
1391
  return r.client.tools.waitForDone(r.message.id);
1392
1392
  }
1393
1393
  }
1394
- const Gr = (t) => t.name + JSON.stringify(t.args);
1394
+ const Hr = (t) => t.name + JSON.stringify(t.args);
1395
1395
  class zs {
1396
1396
  timeCounter = /* @__PURE__ */ new Map();
1397
1397
  /**
@@ -1438,8 +1438,8 @@ class zs {
1438
1438
  return n.getTime() - r.getTime();
1439
1439
  }
1440
1440
  }
1441
- let Hs = /* @__PURE__ */ Symbol("clean"), te = [], me = 0;
1442
- const Qe = 4, Z = /* @__NO_SIDE_EFFECTS__ */ (t) => {
1441
+ let Hs = /* @__PURE__ */ Symbol("clean"), se = [], ge = 0;
1442
+ const Ve = 4, W = /* @__NO_SIDE_EFFECTS__ */ (t) => {
1443
1443
  let e = [], r = {
1444
1444
  get() {
1445
1445
  return r.lc || r.listen(() => {
@@ -1448,24 +1448,24 @@ const Qe = 4, Z = /* @__NO_SIDE_EFFECTS__ */ (t) => {
1448
1448
  lc: 0,
1449
1449
  listen(n) {
1450
1450
  return r.lc = e.push(n), () => {
1451
- for (let s = me + Qe; s < te.length; )
1452
- te[s] === n ? te.splice(s, Qe) : s += Qe;
1451
+ for (let s = ge + Ve; s < se.length; )
1452
+ se[s] === n ? se.splice(s, Ve) : s += Ve;
1453
1453
  let i = e.indexOf(n);
1454
1454
  ~i && (e.splice(i, 1), --r.lc || r.off());
1455
1455
  };
1456
1456
  },
1457
1457
  notify(n, i) {
1458
- let s = !te.length;
1458
+ let s = !se.length;
1459
1459
  for (let a of e)
1460
- te.push(a, r.value, n, i);
1460
+ se.push(a, r.value, n, i);
1461
1461
  if (s) {
1462
- for (me = 0; me < te.length; me += Qe)
1463
- te[me](
1464
- te[me + 1],
1465
- te[me + 2],
1466
- te[me + 3]
1462
+ for (ge = 0; ge < se.length; ge += Ve)
1463
+ se[ge](
1464
+ se[ge + 1],
1465
+ se[ge + 2],
1466
+ se[ge + 3]
1467
1467
  );
1468
- te.length = 0;
1468
+ se.length = 0;
1469
1469
  }
1470
1470
  },
1471
1471
  /* It will be called on last listener unsubscribing.
@@ -1543,76 +1543,76 @@ 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 Gr = 32, Js = 10, Wr = 9, Zr = 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
  }
1550
- function ye(t) {
1550
+ function we(t) {
1551
1551
  return t >= "0" && t <= "9";
1552
1552
  }
1553
1553
  function ti(t) {
1554
1554
  return t >= " ";
1555
1555
  }
1556
- function Ve(t) {
1556
+ function Ye(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) {
1572
- return Ke(t) || ri.test(t);
1571
+ function ir(t) {
1572
+ return Xe(t) || ri.test(t);
1573
1573
  }
1574
1574
  const ri = /^[[{\w-]$/;
1575
1575
  function ni(t) {
1576
1576
  return t === `
1577
1577
  ` || t === "\r" || t === " " || t === "\b" || t === "\f";
1578
1578
  }
1579
- function be(t, e) {
1579
+ function _e(t, e) {
1580
1580
  const r = t.charCodeAt(e);
1581
- return r === Wr || r === Js || r === Zr || r === Jr;
1581
+ return r === Gr || r === Js || r === Wr || r === Zr;
1582
1582
  }
1583
1583
  function si(t, e) {
1584
1584
  const r = t.charCodeAt(e);
1585
- return r === Wr || r === Zr || r === Jr;
1585
+ return r === Gr || r === Wr || r === Zr;
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
- function Ke(t) {
1592
- return Qr(t) || Mt(t);
1591
+ function Xe(t) {
1592
+ return Jr(t) || Mt(t);
1593
1593
  }
1594
- function Qr(t) {
1594
+ function Jr(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
- function $e(t, e) {
1606
+ function Fe(t, e) {
1607
1607
  let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
1608
1608
  const n = t.lastIndexOf(e);
1609
1609
  return n !== -1 ? t.substring(0, n) + (r ? "" : t.substring(n + 1)) : t;
1610
1610
  }
1611
- function re(t, e) {
1611
+ function ie(t, e) {
1612
1612
  let r = t.length;
1613
- if (!be(t, r - 1))
1613
+ if (!_e(t, r - 1))
1614
1614
  return t + e;
1615
- for (; be(t, r - 1); )
1615
+ for (; _e(t, r - 1); )
1616
1616
  r--;
1617
1617
  return t.substring(0, r) + e + t.substring(r);
1618
1618
  }
@@ -1642,13 +1642,13 @@ const ci = {
1642
1642
  };
1643
1643
  function ui(t) {
1644
1644
  let e = 0, r = "";
1645
- c(["```", "[```", "{```"]), s() || W(), c(["```", "```]", "```}"]);
1645
+ c(["```", "[```", "{```"]), s() || J(), 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 = ie(r, ",")), b()) : i && (r = Fe(r, ",")); t[e] === "}" || t[e] === "]"; )
1648
1648
  e++, a();
1649
1649
  if (e >= t.length)
1650
1650
  return r;
1651
- U();
1651
+ H();
1652
1652
  function s() {
1653
1653
  a();
1654
1654
  const P = p() || y() || v() || C() || j() || I(!1) || k();
@@ -1664,7 +1664,7 @@ function ui(t) {
1664
1664
  return e > L;
1665
1665
  }
1666
1666
  function o(P) {
1667
- const L = P ? be : si;
1667
+ const L = P ? _e : si;
1668
1668
  let F = "";
1669
1669
  for (; ; )
1670
1670
  if (L(t, e))
@@ -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
  }
@@ -1725,15 +1725,15 @@ function ui(t) {
1725
1725
  let P = !0;
1726
1726
  for (; e < t.length && t[e] !== "}"; ) {
1727
1727
  let L;
1728
- if (P ? (L = !0, P = !1) : (L = h(","), L || (r = re(r, ",")), a()), g(), !(v() || I(!0))) {
1729
- t[e] === "}" || t[e] === "{" || t[e] === "]" || t[e] === "[" || t[e] === void 0 ? r = $e(r, ",") : fe();
1728
+ if (P ? (L = !0, P = !1) : (L = h(","), L || (r = ie(r, ",")), a()), g(), !(v() || I(!0))) {
1729
+ t[e] === "}" || t[e] === "{" || t[e] === "]" || t[e] === "[" || t[e] === void 0 ? r = Fe(r, ",") : ee();
1730
1730
  break;
1731
1731
  }
1732
1732
  a();
1733
- const Ce = h(":"), ie = e >= t.length;
1734
- Ce || (sr(t[e]) || ie ? r = re(r, ":") : Te()), s() || (Ce || ie ? r += "null" : Te());
1733
+ const Ce = h(":"), oe = e >= t.length;
1734
+ Ce || (ir(t[e]) || oe ? r = ie(r, ":") : q()), s() || (Ce || oe ? r += "null" : q());
1735
1735
  }
1736
- return t[e] === "}" ? (r += "}", e++) : r = re(r, "}"), !0;
1736
+ return t[e] === "}" ? (r += "}", e++) : r = ie(r, "}"), !0;
1737
1737
  }
1738
1738
  return !1;
1739
1739
  }
@@ -1742,49 +1742,49 @@ function ui(t) {
1742
1742
  r += "[", e++, a(), f(",") && a();
1743
1743
  let P = !0;
1744
1744
  for (; e < t.length && t[e] !== "]"; )
1745
- if (P ? P = !1 : h(",") || (r = re(r, ",")), g(), !s()) {
1746
- r = $e(r, ",");
1745
+ if (P ? P = !1 : h(",") || (r = ie(r, ",")), g(), !s()) {
1746
+ r = Fe(r, ",");
1747
1747
  break;
1748
1748
  }
1749
- return t[e] === "]" ? (r += "]", e++) : r = re(r, "]"), !0;
1749
+ return t[e] === "]" ? (r += "]", e++) : r = ie(r, "]"), !0;
1750
1750
  }
1751
1751
  return !1;
1752
1752
  }
1753
1753
  function b() {
1754
1754
  let P = !0, L = !0;
1755
1755
  for (; L; )
1756
- P ? P = !1 : h(",") || (r = re(r, ",")), L = s();
1757
- L || (r = $e(r, ",")), r = `[
1756
+ P ? P = !1 : h(",") || (r = ie(r, ",")), L = s();
1757
+ L || (r = Fe(r, ",")), r = `[
1758
1758
  ${r}
1759
1759
  ]`;
1760
1760
  }
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
- 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;
1763
+ if (F && (e++, F = !0), Xe(t[e])) {
1764
+ const Ce = ar(t[e]) ? ar : or(t[e]) ? or : Mt(t[e]) ? Mt : Jr, oe = e, E = r.length;
1765
1765
  let M = '"';
1766
1766
  for (e++; ; ) {
1767
1767
  if (e >= t.length) {
1768
1768
  const N = R(e - 1);
1769
- return !P && Ve(t.charAt(N)) ? (e = ie, r = r.substring(0, E), v(!0)) : (M = re(M, '"'), r += M, !0);
1769
+ return !P && Ye(t.charAt(N)) ? (e = oe, r = r.substring(0, E), v(!0)) : (M = ie(M, '"'), r += M, !0);
1770
1770
  }
1771
1771
  if (e === L)
1772
- return M = re(M, '"'), r += M, !0;
1772
+ return M = ie(M, '"'), r += M, !0;
1773
1773
  if (Ce(t[e])) {
1774
- const N = e, Y = M.length;
1775
- if (M += '"', e++, r += M, a(!1), P || e >= t.length || Ve(t[e]) || Ke(t[e]) || ye(t[e]))
1774
+ const N = e, K = M.length;
1775
+ if (M += '"', e++, r += M, a(!1), P || e >= t.length || Ye(t[e]) || Xe(t[e]) || we(t[e]))
1776
1776
  return S(), !0;
1777
- const G = R(N - 1), X = t.charAt(G);
1778
- if (X === ",")
1779
- return e = ie, r = r.substring(0, E), v(!1, G);
1780
- if (Ve(X))
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]); )
1777
+ const G = R(N - 1), te = t.charAt(G);
1778
+ if (te === ",")
1779
+ return e = oe, r = r.substring(0, E), v(!1, G);
1780
+ if (Ye(te))
1781
+ return e = oe, r = r.substring(0, E), v(!0);
1782
+ r = r.substring(0, E), e = N + 1, M = `${M.substring(0, K)}\\${M.substring(K)}`;
1783
+ } else if (P && sr(t[e])) {
1784
+ if (t[e - 1] === ":" && rr.test(t.substring(oe + 1, e + 2)))
1785
+ for (; e < t.length && nr.test(t[e]); )
1786
1786
  M += t[e], e++;
1787
- return M = re(M, '"'), r += M, S(), !0;
1787
+ return M = ie(M, '"'), r += M, S(), !0;
1788
1788
  } else if (t[e] === "\\") {
1789
1789
  const N = t.charAt(e + 1);
1790
1790
  if (li[N] !== void 0)
@@ -1793,7 +1793,7 @@ ${r}
1793
1793
  let G = 2;
1794
1794
  for (; G < 6 && ei(t[e + G]); )
1795
1795
  G++;
1796
- G === 6 ? (M += t.slice(e, e + 6), e += 6) : e + G >= t.length ? e = t.length : ft();
1796
+ G === 6 ? (M += t.slice(e, e + 6), e += 6) : e + G >= t.length ? e = t.length : Le();
1797
1797
  } else
1798
1798
  M += N, e += 2;
1799
1799
  } else {
@@ -1808,39 +1808,39 @@ ${r}
1808
1808
  function S() {
1809
1809
  let P = !1;
1810
1810
  for (a(); t[e] === "+"; ) {
1811
- P = !0, e++, a(), r = $e(r, '"', !0);
1811
+ P = !0, e++, a(), r = Fe(r, '"', !0);
1812
1812
  const L = r.length;
1813
- v() ? r = ai(r, L, 1) : r = re(r, '"');
1813
+ v() ? r = ai(r, L, 1) : r = ie(r, '"');
1814
1814
  }
1815
1815
  return P;
1816
1816
  }
1817
1817
  function C() {
1818
1818
  const P = e;
1819
1819
  if (t[e] === "-") {
1820
- if (e++, z())
1821
- return H(P), !0;
1822
- if (!ye(t[e]))
1820
+ if (e++, B())
1821
+ return z(P), !0;
1822
+ if (!we(t[e]))
1823
1823
  return e = P, !1;
1824
1824
  }
1825
- for (; ye(t[e]); )
1825
+ for (; we(t[e]); )
1826
1826
  e++;
1827
1827
  if (t[e] === ".") {
1828
- if (e++, z())
1829
- return H(P), !0;
1830
- if (!ye(t[e]))
1828
+ if (e++, B())
1829
+ return z(P), !0;
1830
+ if (!we(t[e]))
1831
1831
  return e = P, !1;
1832
- for (; ye(t[e]); )
1832
+ for (; we(t[e]); )
1833
1833
  e++;
1834
1834
  }
1835
1835
  if (t[e] === "e" || t[e] === "E") {
1836
- if (e++, (t[e] === "-" || t[e] === "+") && e++, z())
1837
- return H(P), !0;
1838
- if (!ye(t[e]))
1836
+ if (e++, (t[e] === "-" || t[e] === "+") && e++, B())
1837
+ return z(P), !0;
1838
+ if (!we(t[e]))
1839
1839
  return e = P, !1;
1840
- for (; ye(t[e]); )
1840
+ for (; we(t[e]); )
1841
1841
  e++;
1842
1842
  }
1843
- if (!z())
1843
+ if (!B())
1844
1844
  return e = P, !1;
1845
1845
  if (e > P) {
1846
1846
  const L = t.slice(P, e), F = /^0\d/.test(L);
@@ -1857,22 +1857,22 @@ ${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
- for (; be(t, F); )
1864
+ for (; _e(t, F); )
1865
1865
  F++;
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]) && !Xe(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
- for (; be(t, e - 1) && e > 0; )
1875
+ for (; _e(t, e - 1) && e > 0; )
1876
1876
  e--;
1877
1877
  const F = t.slice(L, e);
1878
1878
  return r += F === "undefined" ? "null" : JSON.stringify(F), t[e] === '"' && e++, !0;
@@ -1888,32 +1888,32 @@ ${r}
1888
1888
  }
1889
1889
  function R(P) {
1890
1890
  let L = P;
1891
- for (; L > 0 && be(t, L); )
1891
+ for (; L > 0 && _e(t, L); )
1892
1892
  L--;
1893
1893
  return L;
1894
1894
  }
1895
- function z() {
1896
- return e >= t.length || Ve(t[e]) || be(t, e);
1895
+ function B() {
1896
+ return e >= t.length || Ye(t[e]) || _e(t, e);
1897
1897
  }
1898
- function H(P) {
1898
+ function z(P) {
1899
1899
  r += `${t.slice(P, e)}0`;
1900
1900
  }
1901
1901
  function $(P) {
1902
1902
  throw new Ee(`Invalid character ${JSON.stringify(P)}`, e);
1903
1903
  }
1904
- function U() {
1904
+ function H() {
1905
1905
  throw new Ee(`Unexpected character ${JSON.stringify(t[e])}`, e);
1906
1906
  }
1907
- function W() {
1907
+ function J() {
1908
1908
  throw new Ee("Unexpected end of json string", t.length);
1909
1909
  }
1910
- function fe() {
1910
+ function ee() {
1911
1911
  throw new Ee("Object key expected", e);
1912
1912
  }
1913
- function Te() {
1913
+ function q() {
1914
1914
  throw new Ee("Colon expected", e);
1915
1915
  }
1916
- function ft() {
1916
+ function Le() {
1917
1917
  const P = t.slice(e, e + 6);
1918
1918
  throw new Ee(`Invalid unicode character "${P}"`, e);
1919
1919
  }
@@ -1921,14 +1921,14 @@ ${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) {
1928
1928
  this.message = e, this.client = r;
1929
1929
  }
1930
1930
  getToolActionRequestID() {
1931
- return Gr({
1931
+ return Hr({
1932
1932
  name: this.message.name,
1933
1933
  args: this.getInputRepaired()
1934
1934
  });
@@ -1972,7 +1972,7 @@ class Ht {
1972
1972
  }
1973
1973
  }
1974
1974
  get output() {
1975
- return qr(this.message.content);
1975
+ return Vr(this.message.content);
1976
1976
  }
1977
1977
  getJSONOutput() {
1978
1978
  return JSON.parse(this.output);
@@ -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)) {
@@ -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 Be = 13, Dt = 10, Pi = 0, dr = 58, Di = 32, Ri = [Be, Dt];
2794
2794
  function Oi() {
2795
2795
  let t = [], e = !1;
2796
2796
  return new TransformStream({
@@ -2799,8 +2799,8 @@ function Oi() {
2799
2799
  },
2800
2800
  transform(r, n) {
2801
2801
  let i = r;
2802
- if (e && (i = Xe([[Ue], i]), e = !1), i.length > 0 && i.at(-1) === Ue && (e = !0, i = i.subarray(0, -1)), !i.length) return;
2803
- const s = Ri.includes(i.at(-1)), a = i.length - 1, { lines: o } = i.reduce((l, c, u) => (l.from > u || ((c === Ue || c === Dt) && (l.lines.push(i.subarray(l.from, u)), c === Ue && i[u + 1] === Dt ? l.from = u + 2 : l.from = u + 1), u === a && l.from <= a && l.lines.push(i.subarray(l.from))), l), {
2802
+ if (e && (i = et([[Be], i]), e = !1), i.length > 0 && i.at(-1) === Be && (e = !0, i = i.subarray(0, -1)), !i.length) return;
2803
+ const s = Ri.includes(i.at(-1)), a = i.length - 1, { lines: o } = i.reduce((l, c, u) => (l.from > u || ((c === Be || c === Dt) && (l.lines.push(i.subarray(l.from, u)), c === Be && i[u + 1] === Dt ? l.from = u + 2 : l.from = u + 1), u === a && l.from <= a && l.lines.push(i.subarray(l.from))), l), {
2804
2804
  lines: [],
2805
2805
  from: 0
2806
2806
  });
@@ -2808,11 +2808,11 @@ function Oi() {
2808
2808
  t.push(o[0]);
2809
2809
  return;
2810
2810
  }
2811
- t.length && (t.push(o[0]), o[0] = Xe(t), t = []), s || o.length && (t = [o.pop()]);
2811
+ t.length && (t.push(o[0]), o[0] = et(t), t = []), s || o.length && (t = [o.pop()]);
2812
2812
  for (const l of o) n.enqueue(l);
2813
2813
  },
2814
2814
  flush(r) {
2815
- t.length && r.enqueue(Xe(t));
2815
+ t.length && r.enqueue(et(t));
2816
2816
  }
2817
2817
  });
2818
2818
  }
@@ -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,30 +2849,30 @@ 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
  });
2856
2856
  }
2857
- function Xe(t) {
2857
+ function et(t) {
2858
2858
  const e = t.reduce((i, s) => i + s.length, 0), r = new Uint8Array(e);
2859
2859
  let n = 0;
2860
2860
  for (const i of t)
2861
2861
  r.set(i, n), n += i.length;
2862
2862
  return r;
2863
2863
  }
2864
- function dr(t, e) {
2865
- return JSON.parse(t.decode(Xe(e)));
2864
+ function hr(t, e) {
2865
+ return JSON.parse(t.decode(et(e)));
2866
2866
  }
2867
- const Vr = (t) => {
2867
+ const Qr = (t) => {
2868
2868
  if ("isError" in Error && typeof Error.isError == "function") return Error.isError(t);
2869
2869
  const e = Object.prototype.toString.call(t);
2870
2870
  return e === "[object Error]" || e === "[object DOMException]" || e === "[object DOMError]" || e === "[object Exception]";
2871
2871
  }, Li = (t) => {
2872
2872
  const { cause: e } = t;
2873
- return typeof e != "object" || e == null || !Vr(e) ? null : e;
2873
+ return typeof e != "object" || e == null || !Qr(e) ? null : e;
2874
2874
  }, $i = (t) => {
2875
- if (!Vr(t) || t.name !== "TypeError" || typeof t.message != "string") return !1;
2875
+ if (!Qr(t) || t.name !== "TypeError" || typeof t.message != "string") return !1;
2876
2876
  const e = t.message.toLowerCase(), r = Li(t)?.message?.toLowerCase() ?? "";
2877
2877
  return e.includes("fetch") || e.includes("network") || e.includes("connection") || e.includes("error sending request") || e.includes("load failed") || e.includes("terminated") || r.includes("other side closed") || r.includes("socket");
2878
2878
  };
@@ -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}`);
@@ -3978,15 +3978,15 @@ var Ne = class {
3978
3978
  signal: t?.signal
3979
3979
  });
3980
3980
  }
3981
- }, Vi = class Be extends Ne {
3981
+ }, Vi = class ze extends Ne {
3982
3982
  static promiseCache = {};
3983
3983
  static getOrCached(e, r) {
3984
- if (Be.promiseCache[e] != null) return Be.promiseCache[e];
3984
+ if (ze.promiseCache[e] != null) return ze.promiseCache[e];
3985
3985
  const n = r();
3986
- return Be.promiseCache[e] = n, n;
3986
+ return ze.promiseCache[e] = n, n;
3987
3987
  }
3988
3988
  async getComponent(e, r) {
3989
- return Be.getOrCached(`${this.apiUrl}-${e}-${r}`, async () => {
3989
+ return ze.getOrCached(`${this.apiUrl}-${e}-${r}`, async () => {
3990
3990
  let [n, i] = this.prepareFetchOptions(`/ui/${e}`, {
3991
3991
  headers: {
3992
3992
  Accept: "text/html",
@@ -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]);
@@ -4109,7 +4109,7 @@ const Ki = (t, e) => {
4109
4109
  versions: i
4110
4110
  }));
4111
4111
  }, Xi = (t, e) => {
4112
- const r = /* @__PURE__ */ Z(!1), n = /* @__PURE__ */ Z(null), i = /* @__PURE__ */ Z([]);
4112
+ const r = /* @__PURE__ */ W(!1), n = /* @__PURE__ */ W(null), i = /* @__PURE__ */ W([]);
4113
4113
  return Gs([t, e], () => {
4114
4114
  i.set(Ki(t.get(), e.get()));
4115
4115
  }), {
@@ -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,13 +4299,13 @@ 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 = {}) => {
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);
4305
+ }, Vr = (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
+ const n = /* @__PURE__ */ W(null), i = /* @__PURE__ */ W([]), s = /* @__PURE__ */ W(null), a = /* @__PURE__ */ W([]), o = /* @__PURE__ */ W([]), l = /* @__PURE__ */ W(""), c = /* @__PURE__ */ W(null), u = /* @__PURE__ */ W(t), h = /* @__PURE__ */ W(null), f = /* @__PURE__ */ W("__start__"), m = /* @__PURE__ */ W("idle"), g = /* @__PURE__ */ W(null), p = /* @__PURE__ */ W(!1), y = /* @__PURE__ */ W([]), b = /* @__PURE__ */ W([]), v = /* @__PURE__ */ W(r.showHistory ?? !1), S = /* @__PURE__ */ W(r.showGraph ?? !1), C = /* @__PURE__ */ W(null);
4307
4307
  let j = null;
4308
- const A = /* @__PURE__ */ Z(!1), I = () => {
4308
+ const A = /* @__PURE__ */ W(!1), I = () => {
4309
4309
  const E = s.get();
4310
4310
  E && A.set(E.status === "busy" || E.status === "interrupted");
4311
4311
  }, k = Zs((E) => {
@@ -4316,22 +4316,22 @@ const fr = (t) => {
4316
4316
  }, 10), R = async () => {
4317
4317
  const E = s.get();
4318
4318
  E && (E.tools.clearTools(), E.tools.bindTools(y.get()));
4319
- }, z = async () => {
4319
+ }, B = async () => {
4320
4320
  S.get() && C.set(await s.get()?.graphVisualize() || null);
4321
4321
  };
4322
- async function H() {
4322
+ async function z() {
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) {
4329
4329
  const M = i.get();
4330
- await fe(M[0].sessionId);
4330
+ await ee(M[0].sessionId);
4331
4331
  } else
4332
- await U();
4332
+ await H();
4333
4333
  else
4334
- await U();
4334
+ await H();
4335
4335
  return E;
4336
4336
  }
4337
4337
  async function $() {
@@ -4344,83 +4344,83 @@ const fr = (t) => {
4344
4344
  console.error("Failed to sync sessions:", M);
4345
4345
  }
4346
4346
  }
4347
- async function U() {
4347
+ async function H() {
4348
4348
  const E = n.get();
4349
4349
  if (E)
4350
4350
  try {
4351
4351
  const M = await E.createSession();
4352
- await $(), await fe(M.sessionId);
4352
+ await $(), await ee(M.sessionId);
4353
4353
  } catch (M) {
4354
4354
  console.error("Failed to create new session:", M), c.set(M.message);
4355
4355
  }
4356
4356
  }
4357
- function W(E) {
4357
+ function J(E) {
4358
4358
  const M = () => s.get() === E, N = () => {
4359
4359
  M() && I();
4360
- }, Y = () => {
4360
+ }, K = () => {
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
- }, X = (Ie) => {
4369
+ }, te = (Ie) => {
4370
4370
  M() && (I(), c.set(Ie.data));
4371
4371
  }, je = () => {
4372
4372
  M() && (h.set(E.getCurrentThread()?.thread_id || null), I(), k(E));
4373
- }, ge = () => {
4373
+ }, pe = () => {
4374
4374
  M() && (h.set(E.getCurrentThread()?.thread_id || null), I(), k(E));
4375
- }, Le = (Ie) => {
4375
+ }, $e = (Ie) => {
4376
4376
  if (!M())
4377
4377
  return;
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", K), E.on("done", G), E.on("error", te), E.on("message", je), E.on("value", pe), E.on("interruptChange", $e), () => {
4382
+ E.off("start", N), E.off("thread", K), E.off("done", G), E.off("error", te), E.off("message", je), E.off("value", pe), E.off("interruptChange", $e);
4383
4383
  };
4384
4384
  }
4385
- async function fe(E, M = !1) {
4385
+ async function ee(E, M = !1) {
4386
4386
  const N = n.get();
4387
4387
  if (N)
4388
4388
  try {
4389
4389
  j && (j(), j = null), c.set(null), g.set(null), p.set(!1);
4390
4390
  const G = (await N.activateSession(E, M)).client;
4391
4391
  if (G) {
4392
- j = W(G), r.onInit?.(G), s.set(G), h.set(E);
4393
- const X = G.renderMessage;
4394
- o.set(X);
4395
- const je = X[X.length - 1];
4396
- f.set(je?.node_name || je?.name || "__start__"), I(), S.get() && z(), R();
4397
- const ge = G.getCurrentThread();
4398
- if (ge && (ge.status === "busy" || ge.status === "pending") && await G.resetStream(), ge?.status === "interrupted") {
4399
- const Le = G.interruptData;
4400
- Le && (g.set(Le), p.set(!0));
4392
+ j = J(G), r.onInit?.(G), s.set(G), h.set(E);
4393
+ const te = G.renderMessage;
4394
+ o.set(te);
4395
+ const je = te[te.length - 1];
4396
+ f.set(je?.node_name || je?.name || "__start__"), I(), S.get() && B(), R();
4397
+ const pe = G.getCurrentThread();
4398
+ if (pe && (pe.status === "busy" || pe.status === "pending") && await G.resetStream(), pe?.status === "interrupted") {
4399
+ const $e = G.interruptData;
4400
+ $e && (g.set($e), p.set(!0));
4401
4401
  }
4402
4402
  }
4403
- } catch (Y) {
4404
- console.error("Failed to activate session:", Y), c.set(Y.message);
4403
+ } catch (K) {
4404
+ console.error("Failed to activate session:", K), c.set(K.message);
4405
4405
  }
4406
4406
  }
4407
- async function Te(E, M, N = !1, Y = !1) {
4407
+ async function q(E, M, N = !1, K = !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);
4411
4411
  try {
4412
4412
  A.set(!0), await G.sendMessage(E || l.get(), M);
4413
- } catch (X) {
4414
- if (X.message.includes("422"))
4413
+ } catch (te) {
4414
+ if (te.message.includes("422"))
4415
4415
  await G.resetStream();
4416
4416
  else
4417
- throw X;
4417
+ throw te;
4418
4418
  } finally {
4419
4419
  l.set(""), I();
4420
4420
  }
4421
4421
  }
4422
4422
  }
4423
- function ft() {
4423
+ function Le() {
4424
4424
  s.get()?.cancelRun();
4425
4425
  }
4426
4426
  function P(E) {
@@ -4439,9 +4439,9 @@ 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 ? (K) => N(new Gt(K, M)) : null;
4443
4443
  }
4444
- const ie = Xi(o, s);
4444
+ const oe = Xi(o, s);
4445
4445
  return {
4446
4446
  data: {
4447
4447
  // 核心客户端
@@ -4468,26 +4468,26 @@ const fr = (t) => {
4468
4468
  // 历史记录
4469
4469
  showHistory: v,
4470
4470
  historyList: a,
4471
- ...ie.data
4471
+ ...oe.data
4472
4472
  },
4473
4473
  mutations: {
4474
4474
  // 初始化
4475
- initClient: H,
4475
+ initClient: z,
4476
4476
  getClient: () => s.get(),
4477
4477
  getHistory: () => n.get(),
4478
4478
  // 会话管理
4479
- activateSession: fe,
4480
- createNewSession: U,
4479
+ activateSession: ee,
4480
+ createNewSession: H,
4481
4481
  refreshSessionList: $,
4482
4482
  refreshHistoryList: $,
4483
4483
  // 向后兼容
4484
4484
  // 消息操作
4485
- sendMessage: Te,
4486
- stopGeneration: ft,
4485
+ sendMessage: q,
4486
+ stopGeneration: Le,
4487
4487
  setUserInput: (E) => l.set(E),
4488
4488
  async revertChatTo(E, M = !1, N) {
4489
4489
  if (await s.get()?.revertChatTo(E, N || {}), M)
4490
- return Te([], N, !0);
4490
+ return q([], N, !0);
4491
4491
  k(s.get());
4492
4492
  },
4493
4493
  // 工具操作
@@ -4501,15 +4501,15 @@ const fr = (t) => {
4501
4501
  // UI 切换
4502
4502
  toggleHistoryVisible: L,
4503
4503
  toggleGraphVisible() {
4504
- S.set(!S.get()), S.get() && z();
4504
+ S.set(!S.get()), S.get() && B();
4505
4505
  },
4506
- refreshGraph: z,
4506
+ refreshGraph: B,
4507
4507
  // Agent 切换
4508
4508
  setCurrentAgent(E) {
4509
- return u.set(E), H();
4509
+ return u.set(E), z();
4510
4510
  },
4511
4511
  resumeFromInterrupt(E) {
4512
- return Te([], {
4512
+ return q([], {
4513
4513
  command: {
4514
4514
  resume: E
4515
4515
  }
@@ -4517,13 +4517,13 @@ const fr = (t) => {
4517
4517
  },
4518
4518
  // 历史记录(兼容旧 API)
4519
4519
  addToHistory: F,
4520
- createNewChat: U,
4521
- toHistoryChat: (E) => fe(E.thread_id, !0),
4520
+ createNewChat: H,
4521
+ toHistoryChat: (E) => ee(E.thread_id, !0),
4522
4522
  async deleteHistoryChat(E) {
4523
4523
  const M = n.get();
4524
4524
  M && (await M.deleteSession(E.thread_id), await $());
4525
4525
  },
4526
- ...ie.mutation
4526
+ ...oe.mutation
4527
4527
  }
4528
4528
  };
4529
4529
  };
@@ -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 Yr = (t) => typeof t == "object" && t !== null, gr = (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()) => {
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,7 +4766,7 @@ 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
  };
@@ -4777,14 +4777,14 @@ function ia(t, e, r) {
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, qr = /([\p{Alpha}\p{N}_]|$)/u, Zt = /[_.\- ]+/, ca = new RegExp("^" + Zt.source), yr = new RegExp(Zt.source + qr.source, "gu"), wr = new RegExp("\\d+" + qr.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;
@@ -5010,15 +5010,15 @@ const ma = (t, e) => t.some((r) => typeof r == "string" ? r === e : (r.lastIndex
5010
5010
  u[g] = o && Ae(t[g]) ? Me(t[g], e, r, n) : t[g];
5011
5011
  return u;
5012
5012
  };
5013
- function Ze(t, e) {
5013
+ function Je(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;
5021
- tools = new he();
5021
+ tools = new me();
5022
5022
  availableAssistants = [];
5023
5023
  graphState = {};
5024
5024
  currentRun;
@@ -5322,11 +5322,11 @@ class wr extends zt {
5322
5322
  value: {
5323
5323
  /** @ts-ignore */
5324
5324
  actionRequests: i.value.action_requests,
5325
- reviewConfigs: Ze(i.value.review_configs, { deep: !0 })
5325
+ reviewConfigs: Je(i.value.review_configs, { deep: !0 })
5326
5326
  }
5327
5327
  } : i);
5328
5328
  return n.forEach((i) => (i.value.actionRequests.forEach((s) => {
5329
- s.id = s.id || Gr(s);
5329
+ s.id = s.id || Hr(s);
5330
5330
  }), i)), {
5331
5331
  interruptData: n,
5332
5332
  result: {}
@@ -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
  };
@@ -5412,8 +5412,8 @@ function ba(t, { keys: e, deps: r = [t, e] } = {}) {
5412
5412
  let i = x.useCallback((a) => (vt(n, a)(t.value), e?.length > 0 ? Ws(t, e, vt(n, a)) : t.listen(vt(n, a))), r), s = () => n.current;
5413
5413
  return x.useSyncExternalStore(i, s, s);
5414
5414
  }
5415
- const Xr = x.createContext(void 0), ne = () => {
5416
- const t = x.useContext(Xr);
5415
+ const Kr = x.createContext(void 0), re = () => {
5416
+ const t = x.useContext(Kr);
5417
5417
  if (!t)
5418
5418
  throw new Error("useChat must be used within a ChatProvider");
5419
5419
  return t;
@@ -5443,8 +5443,8 @@ const Xr = x.createContext(void 0), ne = () => {
5443
5443
  b.current || (b.current = !0, y.initClient().catch((v) => {
5444
5444
  console.error(v), g.current && g.current(v, y.currentAgent);
5445
5445
  }));
5446
- }, [y]), x.createElement(Xr.Provider, { value: y }, t);
5447
- }, va = new Bn({}, {}), xa = (t, e = !1) => {
5446
+ }, [y]), x.createElement(Kr.Provider, { value: y }, t);
5447
+ }, va = new Ln({}, {}), xa = (t, e = !1) => {
5448
5448
  if (e || !t)
5449
5449
  return t;
5450
5450
  const r = 5, n = t.split(`
@@ -5456,12 +5456,12 @@ const Xr = x.createContext(void 0), ne = () => {
5456
5456
  ${s.join(`
5457
5457
  `)}`;
5458
5458
  }, Sa = x.memo(({ children: t }) => {
5459
- const e = x.useMemo(() => Un(t || "", { renderer: va }), [t]), { loading: r } = ne(), n = x.useMemo(() => xa(e.trim(), !r), [e, r]);
5459
+ const e = x.useMemo(() => Nn(t || "", { renderer: va }), [t]), { loading: r } = re(), n = x.useMemo(() => xa(e.trim(), !r), [e, r]);
5460
5460
  return /* @__PURE__ */ d.jsx(w, { children: n });
5461
- }), en = ({ message: t, messageNumber: e }) => {
5462
- const { extraParams: r } = ue(), n = r.main_model || "AI", i = wa(t), s = Zt(t);
5461
+ }), Xr = ({ message: t, messageNumber: e }) => {
5462
+ const { extraParams: r } = he(), n = r.main_model || "AI", i = wa(t), s = Jt(t);
5463
5463
  return s ? /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", children: [
5464
- /* @__PURE__ */ d.jsx(_, { paddingBottom: 0, marginBottom: 1, children: /* @__PURE__ */ d.jsxs(w, { color: oe("teal"), children: [
5464
+ /* @__PURE__ */ d.jsx(_, { paddingBottom: 0, marginBottom: 1, children: /* @__PURE__ */ d.jsxs(w, { color: le("teal"), children: [
5465
5465
  e,
5466
5466
  " ",
5467
5467
  n
@@ -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 } = re(), 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(Vr(t.content)) })
5631
5631
  ] })
5632
5632
  ] })
5633
5633
  ] });
@@ -5635,7 +5635,7 @@ ${s.join(`
5635
5635
  renderMessages: t,
5636
5636
  startIndex: e
5637
5637
  }) => {
5638
- const { currentChatId: r } = ne(), [n, i] = x.useState(!1);
5638
+ const { currentChatId: r } = re(), [n, i] = x.useState(!1);
5639
5639
  x.useEffect(() => {
5640
5640
  const c = setTimeout(() => i(!0), 0);
5641
5641
  return () => clearTimeout(c);
@@ -5651,8 +5651,8 @@ ${s.join(`
5651
5651
  borderBottom: !1,
5652
5652
  borderTop: !1,
5653
5653
  borderRight: !1,
5654
- borderLeftColor: c.type === "ai" ? oe("teal") : c.type === "human" ? oe("amber") : "yellow",
5655
- children: c.type === "human" ? /* @__PURE__ */ d.jsx(Fr, { content: c.content, messageNumber: u + 1 + e }) : c.type === "tool" ? /* @__PURE__ */ d.jsx(Aa, { message: c, messageNumber: u + 1 + e }) : /* @__PURE__ */ d.jsx(en, { message: c, messageNumber: u + 1 + e })
5654
+ borderLeftColor: c.type === "ai" ? le("teal") : c.type === "human" ? le("amber") : "yellow",
5655
+ children: c.type === "human" ? /* @__PURE__ */ d.jsx($r, { content: c.content, messageNumber: u + 1 + e }) : c.type === "tool" ? /* @__PURE__ */ d.jsx(Aa, { message: c, messageNumber: u + 1 + e }) : /* @__PURE__ */ d.jsx(Xr, { message: c, messageNumber: u + 1 + e })
5656
5656
  },
5657
5657
  c.id || u
5658
5658
  );
@@ -5688,7 +5688,7 @@ ${s.join(`
5688
5688
  paddingY: 1,
5689
5689
  children: [
5690
5690
  /* @__PURE__ */ d.jsxs(_, { gap: 1, children: [
5691
- /* @__PURE__ */ d.jsx(w, { color: oe("indigo"), bold: !0, children: "⚙️" }),
5691
+ /* @__PURE__ */ d.jsx(w, { color: le("indigo"), bold: !0, children: "⚙️" }),
5692
5692
  n > 0 && /* @__PURE__ */ d.jsxs(w, { color: "green", bold: !0, children: [
5693
5693
  " ",
5694
5694
  n
@@ -5697,14 +5697,14 @@ ${s.join(`
5697
5697
  " ",
5698
5698
  i
5699
5699
  ] }),
5700
- /* @__PURE__ */ d.jsxs(w, { color: oe("indigo"), bold: !0, children: [
5700
+ /* @__PURE__ */ d.jsxs(w, { color: le("indigo"), bold: !0, children: [
5701
5701
  " ",
5702
5702
  "tools"
5703
5703
  ] })
5704
5704
  ] }),
5705
- /* @__PURE__ */ d.jsx(_, { paddingLeft: 2, children: a.map(([l, c], u) => /* @__PURE__ */ d.jsxs(ve.Fragment, { children: [
5705
+ /* @__PURE__ */ d.jsx(_, { paddingLeft: 2, children: a.map(([l, c], u) => /* @__PURE__ */ d.jsxs(xe.Fragment, { children: [
5706
5706
  u > 0 && /* @__PURE__ */ d.jsx(w, { dimColor: !0, children: ", " }),
5707
- /* @__PURE__ */ d.jsxs(w, { color: oe(o[u % o.length]), dimColor: !0, children: [
5707
+ /* @__PURE__ */ d.jsxs(w, { color: le(o[u % o.length]), dimColor: !0, children: [
5708
5708
  l,
5709
5709
  "(",
5710
5710
  c,
@@ -5719,7 +5719,7 @@ ${s.join(`
5719
5719
  renderMessages: t,
5720
5720
  startIndex: e
5721
5721
  }) => {
5722
- const { currentChatId: r, getToolUIRender: n } = ne(), [i, s] = x.useState(!1);
5722
+ const { currentChatId: r, getToolUIRender: n } = re(), [i, s] = x.useState(!1);
5723
5723
  x.useEffect(() => {
5724
5724
  const m = setTimeout(() => s(!0), 0);
5725
5725
  return () => clearTimeout(m);
@@ -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;
@@ -5761,10 +5761,10 @@ ${s.join(`
5761
5761
  borderBottom: !1,
5762
5762
  borderTop: !1,
5763
5763
  borderRight: !1,
5764
- borderLeftColor: m.type === "ai" ? oe("teal") : m.type === "human" ? oe("amber") : "yellow",
5764
+ borderLeftColor: m.type === "ai" ? le("teal") : m.type === "human" ? le("amber") : "yellow",
5765
5765
  children: [
5766
- m.type === "human" ? /* @__PURE__ */ d.jsx(Fr, { content: m.content, messageNumber: g + 1 + e }) : null,
5767
- m.type === "ai" ? /* @__PURE__ */ d.jsx(en, { message: m, messageNumber: g + 1 + e }) : null,
5766
+ m.type === "human" ? /* @__PURE__ */ d.jsx($r, { content: m.content, messageNumber: g + 1 + e }) : null,
5767
+ m.type === "ai" ? /* @__PURE__ */ d.jsx(Xr, { message: m, messageNumber: g + 1 + e }) : null,
5768
5768
  m.type === "group" && /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
5769
5769
  /* @__PURE__ */ d.jsx(
5770
5770
  Ma,
@@ -5806,7 +5806,7 @@ ${s.join(`
5806
5806
  i && /* @__PURE__ */ d.jsx(_, { marginTop: 1, paddingX: 1, children: i })
5807
5807
  ] }), Da = ({ searchTerm: t, onSearchTermChange: e, placeholder: r }) => /* @__PURE__ */ d.jsx(_, { flexDirection: "column", width: "100%", children: /* @__PURE__ */ d.jsxs(_, { gap: 1, paddingX: 1, width: "100%", children: [
5808
5808
  /* @__PURE__ */ d.jsx(w, { color: "cyan", children: "/" }),
5809
- /* @__PURE__ */ d.jsx(xe, { value: t, onChange: e, placeholder: r })
5809
+ /* @__PURE__ */ d.jsx(Se, { value: t, onChange: e, placeholder: r })
5810
5810
  ] }) });
5811
5811
  function Ra({
5812
5812
  items: t,
@@ -5954,7 +5954,7 @@ function La(t) {
5954
5954
  setSearchMode: g
5955
5955
  };
5956
5956
  }
5957
- function Je({ config: t, onClose: e }) {
5957
+ function Qe({ config: t, onClose: e }) {
5958
5958
  const [r, n] = x.useState([]), [i, s] = x.useState(!0);
5959
5959
  x.useEffect(() => {
5960
5960
  (async () => {
@@ -6041,7 +6041,7 @@ function Je({ config: t, onClose: e }) {
6041
6041
  }
6042
6042
  );
6043
6043
  }
6044
- function ot({
6044
+ function ct({
6045
6045
  isSelected: t,
6046
6046
  isCurrent: e = !1,
6047
6047
  children: r,
@@ -6054,7 +6054,7 @@ function ot({
6054
6054
  /* @__PURE__ */ d.jsx(w, { color: t ? "cyan" : "gray", children: t ? ">" : " " }),
6055
6055
  n && /* @__PURE__ */ d.jsx(w, { color: i || (t || e ? "cyan" : "gray"), children: n }),
6056
6056
  /* @__PURE__ */ d.jsx(w, { color: t ? "cyan" : "gray", children: " " }),
6057
- ve.Children.map(r, (o) => ve.isValidElement(o) ? ve.cloneElement(o, {
6057
+ xe.Children.map(r, (o) => xe.isValidElement(o) ? xe.cloneElement(o, {
6058
6058
  /* @ts-ignore */
6059
6059
  color: t ? "cyan" : o.props?.color || "white",
6060
6060
  /* @ts-ignore */
@@ -6063,7 +6063,7 @@ function ot({
6063
6063
  ] });
6064
6064
  }
6065
6065
  const $a = ({ onClose: t }) => {
6066
- const { historyList: e, currentChatId: r, refreshHistoryList: n, toHistoryChat: i, createNewChat: s } = ne(), a = (c) => c.toLocaleTimeString(), o = (c) => {
6066
+ const { historyList: e, currentChatId: r, refreshHistoryList: n, toHistoryChat: i, createNewChat: s } = re(), a = (c) => c.toLocaleTimeString(), o = (c) => {
6067
6067
  switch (c) {
6068
6068
  case "idle":
6069
6069
  return { emoji: "🟢", color: "green", text: "空闲" };
@@ -6110,14 +6110,14 @@ const $a = ({ onClose: t }) => {
6110
6110
  visibleCount: 10,
6111
6111
  renderItem: (c, u, h) => {
6112
6112
  const f = o(c.status), m = c.thread_id === r, g = a(new Date(c.updated_at));
6113
- return /* @__PURE__ */ d.jsxs(ot, { isSelected: h, isCurrent: m, children: [
6113
+ return /* @__PURE__ */ d.jsxs(ct, { isSelected: h, isCurrent: m, children: [
6114
6114
  /* @__PURE__ */ d.jsxs(w, { bold: !0, color: f.color, children: [
6115
6115
  u,
6116
6116
  ". ",
6117
6117
  c.thread_id.substring(0, 8),
6118
6118
  "..."
6119
6119
  ] }),
6120
- /* @__PURE__ */ d.jsx(it, {}),
6120
+ /* @__PURE__ */ d.jsx(at, {}),
6121
6121
  /* @__PURE__ */ d.jsx(w, { dimColor: !0, children: g })
6122
6122
  ] }, c.thread_id);
6123
6123
  },
@@ -6132,7 +6132,7 @@ const $a = ({ onClose: t }) => {
6132
6132
  }
6133
6133
  }
6134
6134
  };
6135
- return /* @__PURE__ */ d.jsx(Je, { config: l, onClose: t });
6135
+ return /* @__PURE__ */ d.jsx(Qe, { config: l, onClose: t });
6136
6136
  };
6137
6137
  class Fa {
6138
6138
  commands = /* @__PURE__ */ new Map();
@@ -6282,7 +6282,7 @@ class Fa {
6282
6282
  使用 /help <命令名> 获取具体命令的帮助信息`, r;
6283
6283
  }
6284
6284
  }
6285
- const We = new Fa(), Ua = {
6285
+ const Ze = new Fa(), Ua = {
6286
6286
  name: "new",
6287
6287
  description: "初始化新的对话会话",
6288
6288
  aliases: ["new", "n"],
@@ -6322,7 +6322,7 @@ const We = new Fa(), Ua = {
6322
6322
  const r = t[0];
6323
6323
  return {
6324
6324
  success: !0,
6325
- message: We.getHelp(r),
6325
+ message: Ze.getHelp(r),
6326
6326
  shouldClearInput: !0
6327
6327
  };
6328
6328
  }
@@ -6337,11 +6337,11 @@ const We = new Fa(), Ua = {
6337
6337
  shouldClearInput: !0
6338
6338
  })
6339
6339
  }, Ha = [Ua, Ba, za];
6340
- class tn {
6340
+ class en {
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
  /**
@@ -6424,7 +6424,7 @@ class tn {
6424
6424
  return this.dbPath;
6425
6425
  }
6426
6426
  }
6427
- let ze = null;
6427
+ let He = null;
6428
6428
  function Ga(t) {
6429
6429
  const e = t.split(`
6430
6430
  `);
@@ -6445,14 +6445,14 @@ function Ga(t) {
6445
6445
  `).trim();
6446
6446
  return { metadata: i, content: s };
6447
6447
  }
6448
- function rn(t, e) {
6448
+ function tn(t, e) {
6449
6449
  const r = /* @__PURE__ */ new Map();
6450
6450
  try {
6451
6451
  const n = zn(t, { withFileTypes: !0 });
6452
6452
  for (const i of n) {
6453
6453
  const s = ke(t, i.name);
6454
6454
  if (i.isDirectory())
6455
- rn(s, e).forEach((o) => r.set(o.name, o));
6455
+ tn(s, e).forEach((o) => r.set(o.name, o));
6456
6456
  else if (i.name.endsWith(".md"))
6457
6457
  try {
6458
6458
  const a = Hn(s, "utf-8"), { metadata: o, content: l } = Ga(a), c = o.name || i.name.replace(/\.md$/, "");
@@ -6472,13 +6472,13 @@ function rn(t, e) {
6472
6472
  return r;
6473
6473
  }
6474
6474
  function Wa() {
6475
- ze = null;
6475
+ He = null;
6476
6476
  }
6477
6477
  function Za(t = "./.claude/templates") {
6478
- if (ze)
6479
- return Array.from(ze.values());
6478
+ if (He)
6479
+ return Array.from(He.values());
6480
6480
  const e = t.startsWith("/") ? t : ke(process.cwd(), t);
6481
- return ze = rn(e, e), Array.from(ze.values());
6481
+ return He = tn(e, e), Array.from(He.values());
6482
6482
  }
6483
6483
  const Ja = {
6484
6484
  name: "status",
@@ -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: 添加历史面板命令
@@ -7034,7 +7034,7 @@ const yo = {
7034
7034
  用法: /spark <text> [#tag1 #tag2]`
7035
7035
  };
7036
7036
  try {
7037
- const n = mo(r), i = go(r), s = po(i), a = i, o = new tn(fo());
7037
+ const n = mo(r), i = go(r), s = po(i), a = i, o = new en(fo());
7038
7038
  return await o.initialize(), {
7039
7039
  success: !0,
7040
7040
  message: `✨ Spark added!
@@ -7140,7 +7140,7 @@ For each selected spark, create a plan using the writing-plans skill template:
7140
7140
  requiresArgs: !1,
7141
7141
  execute: async (t, e) => {
7142
7142
  try {
7143
- const r = new tn(bo());
7143
+ const r = new en(bo());
7144
7144
  await r.initialize();
7145
7145
  const n = await r.getSparksByStatus("pending");
7146
7146
  if (n.length === 0)
@@ -7209,15 +7209,16 @@ For each selected spark, create a plan using the writing-plans skill template:
7209
7209
  }
7210
7210
  };
7211
7211
  [...Ha, ...no, ...io, ...co, ...ho, ...wo, ...So, To].forEach((t) => {
7212
- We.register(t);
7212
+ Ze.register(t);
7213
7213
  });
7214
7214
  const Co = (t) => {
7215
- const { onCommandExecuted: e, switchToHistory: r, switchToKnowledge: n, switchToModel: i, switchToAgent: s, closePanel: a, switchToTask: o } = t, { userInput: l, setUserInput: c, sendMessage: u, currentAgent: h, client: f, createNewChat: m, renderMessages: g } = ne(), { extraParams: p, updateConfig: y, AVAILABLE_MODELS: b } = ue(), [v, S] = x.useState(null), [C, j] = x.useState(null), A = l.startsWith("/"), I = A ? We.getSuggestions(l) : [], k = A, R = x.useCallback(async () => {
7216
- if (!We.isCommand(l))
7215
+ const { onCommandExecuted: e, switchToHistory: r, switchToKnowledge: n, switchToModel: i, switchToAgent: s, closePanel: a, switchToTask: o } = t, { userInput: l, setUserInput: c, sendMessage: u, currentAgent: h, client: f, createNewChat: m, renderMessages: g } = re(), { extraParams: p, updateConfig: y, AVAILABLE_MODELS: b } = he(), [v, S] = x.useState(null), [C, j] = x.useState(null), A = l.startsWith("/"), I = A ? Ze.getSuggestions(l) : [], k = A, R = x.useCallback(async (H) => {
7216
+ const J = H || l;
7217
+ if (!Ze.isCommand(J))
7217
7218
  return !1;
7218
7219
  try {
7219
- const U = {
7220
- userInput: l,
7220
+ const ee = {
7221
+ userInput: J,
7221
7222
  setUserInput: c,
7222
7223
  sendMessage: u,
7223
7224
  currentAgent: h,
@@ -7234,19 +7235,19 @@ const Co = (t) => {
7234
7235
  switchToTask: o,
7235
7236
  closePanel: a,
7236
7237
  startRalphLoop: t.startRalphLoop
7237
- }, W = await We.executeCommand(l, U);
7238
- if (W.success ? W.message && (j(W.message), setTimeout(() => j(null), 5e3)) : (S(W.message || "命令执行失败"), setTimeout(() => S(null), 3e3)), W.shouldClearInput && c(""), W.shouldSendMessage && W.messageContent) {
7239
- const fe = [
7238
+ }, q = await Ze.executeCommand(J, ee);
7239
+ if (q.success ? q.message && (j(q.message), setTimeout(() => j(null), 5e3)) : (S(q.message || "命令执行失败"), setTimeout(() => S(null), 3e3)), q.shouldClearInput && c(""), q.shouldSendMessage && q.messageContent) {
7240
+ const Le = [
7240
7241
  {
7241
7242
  type: "human",
7242
- content: W.messageContent
7243
+ content: q.messageContent
7243
7244
  }
7244
7245
  ];
7245
- u(fe, { extraParams: p });
7246
+ u(Le, { extraParams: p });
7246
7247
  }
7247
7248
  return e?.(), !0;
7248
- } catch (U) {
7249
- return S(`命令执行错误: ${U instanceof Error ? U.message : String(U)}`), setTimeout(() => S(null), 3e3), !0;
7249
+ } catch (ee) {
7250
+ return S(`命令执行错误: ${ee instanceof Error ? ee.message : String(ee)}`), setTimeout(() => S(null), 3e3), !0;
7250
7251
  }
7251
7252
  }, [
7252
7253
  l,
@@ -7267,11 +7268,11 @@ const Co = (t) => {
7267
7268
  executeCommand: R,
7268
7269
  CommandHintUI: () => !k || I.length === 0 ? null : /* @__PURE__ */ d.jsxs(_, { marginBottom: 1, flexDirection: "column", children: [
7269
7270
  /* @__PURE__ */ d.jsx(w, { color: "yellow", bold: !0, children: "命令建议:" }),
7270
- I.slice(0, 5).map((U, W) => /* @__PURE__ */ d.jsxs(w, { color: "cyan", children: [
7271
- U.displayText,
7271
+ I.slice(0, 5).map((H, J) => /* @__PURE__ */ d.jsxs(w, { color: "cyan", children: [
7272
+ H.displayText,
7272
7273
  " - ",
7273
- U.description
7274
- ] }, W)),
7274
+ H.description
7275
+ ] }, J)),
7275
7276
  I.length > 5 && /* @__PURE__ */ d.jsxs(w, { color: "gray", children: [
7276
7277
  "...还有 ",
7277
7278
  I.length - 5,
@@ -7293,22 +7294,22 @@ function Eo(t) {
7293
7294
  for (let r = t; r && r.prototype; r = Object.getPrototypeOf(r)) Object.assign(e, Reflect.get(r.prototype, "lc_aliases"));
7294
7295
  return Object.entries(e).reduce((r, [n, i]) => (r[i] = n, r), {});
7295
7296
  }
7296
- async function et(t) {
7297
+ async function tt(t) {
7297
7298
  const { optionalImportsMap: e, optionalImportEntrypoints: r, importMap: n, secretsMap: i, secretsFromEnv: s, path: a, depth: o, maxDepth: l } = this, c = a.join(".");
7298
7299
  if (o > l) throw new Error(`Maximum recursion depth (${l}) exceeded during deserialization. This may indicate a malicious payload or you may need to increase maxDepth.`);
7299
7300
  if (typeof t != "object" || t == null) return t;
7300
- if (Array.isArray(t)) return Promise.all(t.map((f, m) => et.call({
7301
+ if (Array.isArray(t)) return Promise.all(t.map((f, m) => tt.call({
7301
7302
  ...this,
7302
7303
  path: [...a, `${m}`],
7303
7304
  depth: o + 1
7304
7305
  }, f)));
7305
7306
  const u = t;
7306
- if (_n(u)) return vn(u);
7307
+ if (pn(u)) return yn(u);
7307
7308
  if ("lc" in u && "type" in u && "id" in u && u.lc === 1 && u.type === "secret") {
7308
7309
  const f = u, [m] = f.id;
7309
7310
  if (m in i) return i[m];
7310
7311
  if (s) {
7311
- const g = xn(m);
7312
+ const g = wn(m);
7312
7313
  if (g) return g;
7313
7314
  }
7314
7315
  throw new Error(`Missing secret "${m}" at ${c}`);
@@ -7319,7 +7320,7 @@ async function et(t) {
7319
7320
  }
7320
7321
  if ("lc" in u && "type" in u && "id" in u && "kwargs" in u && u.lc === 1 && u.type === "constructor") {
7321
7322
  const f = u, m = JSON.stringify(f), [g, ...p] = f.id.slice().reverse(), y = p.reverse(), b = {
7322
- langchain_core: Sn,
7323
+ langchain_core: bn,
7323
7324
  langchain: n
7324
7325
  };
7325
7326
  let v = null;
@@ -7342,24 +7343,24 @@ async function et(t) {
7342
7343
  R in k && (v = k[R]);
7343
7344
  }
7344
7345
  if (typeof v != "object" || v === null) throw new Error(`Invalid namespace: ${c} -> ${m}`);
7345
- const j = v[g] ?? Object.values(v).find((k) => typeof k == "function" && Tn(k) === g);
7346
+ const j = v[g] ?? Object.values(v).find((k) => typeof k == "function" && _n(k) === g);
7346
7347
  if (typeof j != "function") throw new Error(`Invalid identifer: ${c} -> ${m}`);
7347
- const A = await et.call({
7348
+ const A = await tt.call({
7348
7349
  ...this,
7349
7350
  path: [...a, "kwargs"],
7350
7351
  depth: o + 1
7351
- }, f.kwargs), I = new j(Cn(A, jn, Eo(j)));
7352
+ }, f.kwargs), I = new j(vn(A, xn, Eo(j)));
7352
7353
  return Object.defineProperty(I.constructor, "name", { value: g }), I;
7353
7354
  }
7354
7355
  const h = {};
7355
- for (const [f, m] of Object.entries(u)) h[f] = await et.call({
7356
+ for (const [f, m] of Object.entries(u)) h[f] = await tt.call({
7356
7357
  ...this,
7357
7358
  path: [...a, f],
7358
7359
  depth: o + 1
7359
7360
  }, m);
7360
7361
  return h;
7361
7362
  }
7362
- async function nn(t, e) {
7363
+ async function rn(t, e) {
7363
7364
  const r = JSON.parse(t), n = {
7364
7365
  optionalImportsMap: {},
7365
7366
  optionalImportEntrypoints: [],
@@ -7370,10 +7371,10 @@ async function nn(t, e) {
7370
7371
  depth: 0,
7371
7372
  maxDepth: Io
7372
7373
  };
7373
- return et.call(n, r);
7374
+ return tt.call(n, r);
7374
7375
  }
7375
7376
  const St = "__pregel_tasks", Ao = "__error__", ko = "__scheduled__", Mo = "__interrupt__", Po = "__resume__";
7376
- var _r = "[...]", Do = "[Circular]", rt = [], Pe = [];
7377
+ var vr = "[...]", Do = "[Circular]", nt = [], Pe = [];
7377
7378
  function Ro() {
7378
7379
  return {
7379
7380
  depthLimit: Number.MAX_SAFE_INTEGER,
@@ -7388,8 +7389,8 @@ function Oo(t, e, r, n) {
7388
7389
  } catch {
7389
7390
  return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]");
7390
7391
  } finally {
7391
- for (; rt.length !== 0; ) {
7392
- var s = rt.pop();
7392
+ for (; nt.length !== 0; ) {
7393
+ var s = nt.pop();
7393
7394
  s.length === 4 ? Object.defineProperty(s[0], s[1], s[3]) : s[0][s[1]] = s[2];
7394
7395
  }
7395
7396
  }
@@ -7397,7 +7398,7 @@ function Oo(t, e, r, n) {
7397
7398
  }
7398
7399
  function Tt(t, e, r, n) {
7399
7400
  var i = Object.getOwnPropertyDescriptor(n, r);
7400
- i.get !== void 0 ? i.configurable ? (Object.defineProperty(n, r, { value: t }), rt.push([
7401
+ i.get !== void 0 ? i.configurable ? (Object.defineProperty(n, r, { value: t }), nt.push([
7401
7402
  n,
7402
7403
  r,
7403
7404
  e,
@@ -7406,7 +7407,7 @@ function Tt(t, e, r, n) {
7406
7407
  e,
7407
7408
  r,
7408
7409
  t
7409
- ]) : (n[r] = t, rt.push([
7410
+ ]) : (n[r] = t, nt.push([
7410
7411
  n,
7411
7412
  r,
7412
7413
  e
@@ -7421,11 +7422,11 @@ function Ot(t, e, r, n, i, s, a) {
7421
7422
  return;
7422
7423
  }
7423
7424
  if (typeof a.depthLimit < "u" && s > a.depthLimit) {
7424
- Tt(_r, t, e, i);
7425
+ Tt(vr, t, e, i);
7425
7426
  return;
7426
7427
  }
7427
7428
  if (typeof a.edgesLimit < "u" && r + 1 > a.edgesLimit) {
7428
- Tt(_r, t, e, i);
7429
+ Tt(vr, t, e, i);
7429
7430
  return;
7430
7431
  }
7431
7432
  if (n.push(t), Array.isArray(t)) for (o = 0; o < t.length; o++) Ot(t[o], o, o, n, t, s, a);
@@ -7487,7 +7488,7 @@ async function Nt(t) {
7487
7488
  } catch {
7488
7489
  return e;
7489
7490
  }
7490
- else if (Lo(e)) return nn(JSON.stringify(e));
7491
+ else if (Lo(e)) return rn(JSON.stringify(e));
7491
7492
  return e;
7492
7493
  }
7493
7494
  }
@@ -7529,10 +7530,10 @@ var Fo = class {
7529
7530
  throw new Error(`Unknown serialization type: ${e}`);
7530
7531
  }
7531
7532
  };
7532
- function sn(t) {
7533
+ function nn(t) {
7533
7534
  if (typeof t != "object" || t === null) return t;
7534
7535
  const e = Array.isArray(t) ? [] : {};
7535
- for (const r in t) Object.prototype.hasOwnProperty.call(t, r) && (e[r] = sn(t[r]));
7536
+ for (const r in t) Object.prototype.hasOwnProperty.call(t, r) && (e[r] = nn(t[r]));
7536
7537
  return e;
7537
7538
  }
7538
7539
  function Uo(t) {
@@ -7542,7 +7543,7 @@ function Uo(t) {
7542
7543
  ts: t.ts,
7543
7544
  channel_values: { ...t.channel_values },
7544
7545
  channel_versions: { ...t.channel_versions },
7545
- versions_seen: sn(t.versions_seen)
7546
+ versions_seen: nn(t.versions_seen)
7546
7547
  };
7547
7548
  }
7548
7549
  var Bo = class {
@@ -7580,7 +7581,7 @@ const Go = {
7580
7581
  function Wo(t) {
7581
7582
  return t.configurable?.checkpoint_id || t.configurable?.thread_ts || "";
7582
7583
  }
7583
- function Fe(t, e, r) {
7584
+ function Ue(t, e, r) {
7584
7585
  return JSON.stringify([
7585
7586
  t,
7586
7587
  e,
@@ -7603,7 +7604,7 @@ var Jo = class extends Bo {
7603
7604
  }
7604
7605
  /** @internal */
7605
7606
  async _migratePendingSends(t, e, r, n) {
7606
- const i = t, s = Fe(e, r, n), a = await Promise.all(Object.values(this.writes[s] ?? {}).filter(([o, l]) => l === St).map(async ([o, l, c]) => await this.serde.loadsTyped("json", c)));
7607
+ const i = t, s = Ue(e, r, n), a = await Promise.all(Object.values(this.writes[s] ?? {}).filter(([o, l]) => l === St).map(async ([o, l, c]) => await this.serde.loadsTyped("json", c)));
7607
7608
  i.channel_values ??= {}, i.channel_values[St] = a, i.channel_versions ??= {}, i.channel_versions[St] = Object.keys(i.channel_versions).length > 0 ? Ho(...Object.values(i.channel_versions)) : this.getNextVersion(void 0);
7608
7609
  }
7609
7610
  async getTuple(t) {
@@ -7612,7 +7613,7 @@ var Jo = class extends Bo {
7612
7613
  if (n) {
7613
7614
  const i = this.storage[e]?.[r]?.[n];
7614
7615
  if (i !== void 0) {
7615
- const [s, a, o] = i, l = Fe(e, r, n), c = await this.serde.loadsTyped("json", s);
7616
+ const [s, a, o] = i, l = Ue(e, r, n), c = await this.serde.loadsTyped("json", s);
7616
7617
  c.v < 4 && o !== void 0 && await this._migratePendingSends(c, e, r, o);
7617
7618
  const u = await Promise.all(Object.values(this.writes[l] || {}).map(async ([f, m, g]) => [
7618
7619
  f,
@@ -7634,7 +7635,7 @@ var Jo = class extends Bo {
7634
7635
  const i = this.storage[e]?.[r];
7635
7636
  if (i !== void 0) {
7636
7637
  n = Object.keys(i).sort((m, g) => g.localeCompare(m))[0];
7637
- const s = i[n], [a, o, l] = s, c = Fe(e, r, n), u = await this.serde.loadsTyped("json", a);
7638
+ const s = i[n], [a, o, l] = s, c = Ue(e, r, n), u = await this.serde.loadsTyped("json", a);
7638
7639
  u.v < 4 && l !== void 0 && await this._migratePendingSends(u, e, r, l);
7639
7640
  const h = await Promise.all(Object.values(this.writes[c] || {}).map(async ([m, g, p]) => [
7640
7641
  m,
@@ -7672,7 +7673,7 @@ var Jo = class extends Bo {
7672
7673
  if (n <= 0) break;
7673
7674
  n -= 1;
7674
7675
  }
7675
- const b = Fe(l, c, f), v = Object.values(this.writes[b] || {}), S = await Promise.all(v.map(async ([A, I, k]) => [
7676
+ const b = Ue(l, c, f), v = Object.values(this.writes[b] || {}), S = await Promise.all(v.map(async ([A, I, k]) => [
7676
7677
  A,
7677
7678
  I,
7678
7679
  await this.serde.loadsTyped("json", k)
@@ -7715,7 +7716,7 @@ var Jo = class extends Bo {
7715
7716
  const n = t.configurable?.thread_id, i = t.configurable?.checkpoint_ns, s = t.configurable?.checkpoint_id;
7716
7717
  if (n === void 0) throw new Error('Failed to put writes. The passed RunnableConfig is missing a required "thread_id" field in its "configurable" property');
7717
7718
  if (s === void 0) throw new Error('Failed to put writes. The passed RunnableConfig is missing a required "checkpoint_id" field in its "configurable" property.');
7718
- const a = Fe(n, i, s), o = this.writes[a];
7719
+ const a = Ue(n, i, s), o = this.writes[a];
7719
7720
  this.writes[a] === void 0 && (this.writes[a] = {}), await Promise.all(e.map(async ([l, c], u) => {
7720
7721
  const [, h] = await this.serde.dumpsTyped(c), f = [r, Go[l] || u], m = `${f[0]},${f[1]}`;
7721
7722
  f[1] >= 0 && o && m in o || (this.writes[a][m] = [
@@ -7738,23 +7739,23 @@ const Qo = (t) => {
7738
7739
  resume: t.resume
7739
7740
  });
7740
7741
  };
7741
- var vr = "[...]", Vo = "[Circular]", nt = [], De = [];
7742
- function qo() {
7742
+ var xr = "[...]", Vo = "[Circular]", st = [], De = [];
7743
+ function Yo() {
7743
7744
  return {
7744
7745
  depthLimit: Number.MAX_SAFE_INTEGER,
7745
7746
  edgesLimit: Number.MAX_SAFE_INTEGER
7746
7747
  };
7747
7748
  }
7748
- function Yo(t, e, r, n) {
7749
- typeof n > "u" && (n = qo()), Lt(t, "", 0, [], void 0, 0, n);
7749
+ function qo(t, e, r, n) {
7750
+ typeof n > "u" && (n = Yo()), Lt(t, "", 0, [], void 0, 0, n);
7750
7751
  var i;
7751
7752
  try {
7752
7753
  De.length === 0 ? i = JSON.stringify(t, e, r) : i = JSON.stringify(t, Ko(e), r);
7753
7754
  } catch {
7754
7755
  return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]");
7755
7756
  } finally {
7756
- for (; nt.length !== 0; ) {
7757
- var s = nt.pop();
7757
+ for (; st.length !== 0; ) {
7758
+ var s = st.pop();
7758
7759
  s.length === 4 ? Object.defineProperty(s[0], s[1], s[3]) : s[0][s[1]] = s[2];
7759
7760
  }
7760
7761
  }
@@ -7762,7 +7763,7 @@ function Yo(t, e, r, n) {
7762
7763
  }
7763
7764
  function jt(t, e, r, n) {
7764
7765
  var i = Object.getOwnPropertyDescriptor(n, r);
7765
- i.get !== void 0 ? i.configurable ? (Object.defineProperty(n, r, { value: t }), nt.push([n, r, e, i])) : De.push([e, r, t]) : (n[r] = t, nt.push([n, r, e]));
7766
+ i.get !== void 0 ? i.configurable ? (Object.defineProperty(n, r, { value: t }), st.push([n, r, e, i])) : De.push([e, r, t]) : (n[r] = t, st.push([n, r, e]));
7766
7767
  }
7767
7768
  function Lt(t, e, r, n, i, s, a) {
7768
7769
  s += 1;
@@ -7774,11 +7775,11 @@ function Lt(t, e, r, n, i, s, a) {
7774
7775
  return;
7775
7776
  }
7776
7777
  if (typeof a.depthLimit < "u" && s > a.depthLimit) {
7777
- jt(vr, t, e, i);
7778
+ jt(xr, t, e, i);
7778
7779
  return;
7779
7780
  }
7780
7781
  if (typeof a.edgesLimit < "u" && r + 1 > a.edgesLimit) {
7781
- jt(vr, t, e, i);
7782
+ jt(xr, t, e, i);
7782
7783
  return;
7783
7784
  }
7784
7785
  if (n.push(t), Array.isArray(t))
@@ -7847,7 +7848,7 @@ async function $t(t) {
7847
7848
  return e;
7848
7849
  }
7849
7850
  else if (Xo(e))
7850
- return nn(JSON.stringify(e));
7851
+ return rn(JSON.stringify(e));
7851
7852
  return e;
7852
7853
  }
7853
7854
  }
@@ -7875,7 +7876,7 @@ function ec(t) {
7875
7876
  class tc {
7876
7877
  _dumps(e) {
7877
7878
  return new TextEncoder().encode(
7878
- Yo(e, (n, i) => ec(i))
7879
+ qo(e, (n, i) => ec(i))
7879
7880
  );
7880
7881
  }
7881
7882
  async dumpsTyped(e) {
@@ -7893,7 +7894,7 @@ class tc {
7893
7894
  throw new Error(`Unknown serialization type: ${e}`);
7894
7895
  }
7895
7896
  }
7896
- class rc extends zt {
7897
+ class rc extends Ht {
7897
7898
  /**
7898
7899
  * 构造函数
7899
7900
  * Constructor
@@ -8057,12 +8058,12 @@ const Re = {};
8057
8058
  async function sc(t, e) {
8058
8059
  Re[t] = e;
8059
8060
  }
8060
- async function ct(t, e, r) {
8061
+ async function lt(t, e, r) {
8061
8062
  if (!Re[t]) throw new Error(`Graph "${t}" not found`);
8062
8063
  const n = typeof Re[t] == "function" ? await Re[t](e ?? { configurable: {} }) : Re[t];
8063
8064
  return typeof r?.checkpointer < "u" ? n.checkpointer = r?.checkpointer ?? Q.globalCheckPointer : n.checkpointer = Q.globalCheckPointer, n.store = r?.store ?? void 0, n;
8064
8065
  }
8065
- class xr {
8066
+ class Sr {
8066
8067
  db;
8067
8068
  adapter;
8068
8069
  constructor(e) {
@@ -8146,7 +8147,7 @@ class xr {
8146
8147
  thread_id: e,
8147
8148
  graph_id: i
8148
8149
  }
8149
- }, a = await ct(i, s), o = await a.updateState(s, r.values), l = await a.getState(s);
8150
+ }, a = await lt(i, s), o = await a.updateState(s, r.values), l = await a.getState(s);
8150
8151
  return await this.set(e, { values: JSON.parse(Oe(l.values)) }), o;
8151
8152
  }
8152
8153
  async delete(e) {
@@ -8197,7 +8198,7 @@ class xr {
8197
8198
  r.status !== void 0 && (i.status = r.status), r.metadata !== void 0 && (i.metadata = this.adapter.jsonToDb(r.metadata)), r.multitask_strategy !== void 0 && (i.multitask_strategy = r.multitask_strategy), await this.db.updateTable("runs").set(i).where("run_id", "=", e).execute();
8198
8199
  }
8199
8200
  }
8200
- class ce {
8201
+ class ue {
8201
8202
  event;
8202
8203
  data;
8203
8204
  id;
@@ -8205,17 +8206,17 @@ class ce {
8205
8206
  this.event = e, this.data = r;
8206
8207
  }
8207
8208
  }
8208
- class ic extends ce {
8209
+ class ic extends ue {
8209
8210
  constructor() {
8210
8211
  super("__system_cancel__", "user cancel this run");
8211
8212
  }
8212
8213
  }
8213
- class ac extends ce {
8214
+ class ac extends ue {
8214
8215
  constructor() {
8215
8216
  super("__stream_end__", "stream end");
8216
8217
  }
8217
8218
  }
8218
- class oc extends ce {
8219
+ class oc extends ue {
8219
8220
  constructor(e) {
8220
8221
  super("__stream_error__", {
8221
8222
  error: e.name,
@@ -8223,7 +8224,7 @@ class oc extends ce {
8223
8224
  });
8224
8225
  }
8225
8226
  }
8226
- class Jt extends rc {
8227
+ class Qt extends rc {
8227
8228
  data = [];
8228
8229
  async push(e) {
8229
8230
  const r = this.compressMessages ? await this.encodeData(e) : e;
@@ -8279,7 +8280,7 @@ class Jt extends rc {
8279
8280
  this.cancelSignal.abort("user cancel this run"), await this.push(new ic());
8280
8281
  }
8281
8282
  async copyToQueue(e, r) {
8282
- const n = this.data, i = new Jt(e, this.compressMessages, r ?? this.ttl);
8283
+ const n = this.data, i = new Qt(e, this.compressMessages, r ?? this.ttl);
8283
8284
  return i.data = n, i;
8284
8285
  }
8285
8286
  }
@@ -8357,7 +8358,7 @@ class cc {
8357
8358
  thread_id: e,
8358
8359
  graph_id: s
8359
8360
  }
8360
- }, o = await ct(s, a), l = await o.updateState(a, r.values), c = await o.getState(a);
8361
+ }, o = await lt(s, a), l = await o.updateState(a, r.values), c = await o.getState(a);
8361
8362
  return await this.set(e, { values: JSON.parse(Oe(c.values)) }), l;
8362
8363
  }
8363
8364
  runs = [];
@@ -8389,7 +8390,7 @@ const lc = async () => {
8389
8390
  if (process.env.REDIS_URL && process.env.CHECKPOINT_TYPE === "redis" || process.env.CHECKPOINT_TYPE === "shallow/redis") {
8390
8391
  if (process.env.CHECKPOINT_TYPE === "redis") {
8391
8392
  console.debug("LG | Using redis as checkpoint");
8392
- const { RedisSaver: t } = await import("./index-BmxiURq0.mjs");
8393
+ const { RedisSaver: t } = await import("./index-betxkqLW.mjs");
8393
8394
  return await t.fromUrl(process.env.REDIS_URL, {
8394
8395
  defaultTTL: 60,
8395
8396
  // TTL in minutes
@@ -8398,18 +8399,18 @@ const lc = async () => {
8398
8399
  }
8399
8400
  if (process.env.CHECKPOINT_TYPE === "shallow/redis") {
8400
8401
  console.debug("LG | Using shallow redis as checkpoint");
8401
- const { ShallowRedisSaver: t } = await import("./shallow-Cn-uyrVQ.mjs");
8402
+ const { ShallowRedisSaver: t } = await import("./shallow-in1-XXeE.mjs");
8402
8403
  return await t.fromUrl(process.env.REDIS_URL);
8403
8404
  }
8404
8405
  }
8405
8406
  if (process.env.DATABASE_URL) {
8406
8407
  console.debug("LG | Using postgres as checkpoint");
8407
- const { createPGCheckpoint: t } = await import("./checkpoint-DxiUsHMy-BWVXO0Oa.mjs");
8408
+ const { createPGCheckpoint: t } = await import("./checkpoint-DxiUsHMy-DHFvv2Vn.mjs");
8408
8409
  return t();
8409
8410
  }
8410
8411
  if (process.env.SQLITE_DATABASE_URI) {
8411
8412
  console.debug("LG | Using sqlite as checkpoint");
8412
- const { SqliteSaver: t } = await import("./checkpoint-1sAx_j1E-BlqgvrDY.mjs");
8413
+ const { SqliteSaver: t } = await import("./checkpoint-1sAx_j1E-DNrygV7Q.mjs");
8413
8414
  return await t.fromConnStringAsync(process.env.SQLITE_DATABASE_URI);
8414
8415
  }
8415
8416
  return console.log("LG | You are using memory as checkpoint!"), console.log(
@@ -8423,20 +8424,20 @@ const lc = async () => {
8423
8424
  let t;
8424
8425
  if (process.env.REDIS_URL) {
8425
8426
  console.debug("LG | Using redis as stream queue");
8426
- const { RedisStreamQueue: e } = await import("./queue-D6tEGCGs-BLJPuWhS.mjs");
8427
+ const { RedisStreamQueue: e } = await import("./queue-D6tEGCGs-DyRh7Gp2.mjs");
8427
8428
  t = e;
8428
8429
  } else
8429
- t = Jt;
8430
+ t = Qt;
8430
8431
  return new nc(t);
8431
8432
  }, dc = async (t) => {
8432
8433
  if (process.env.DATABASE_URL && t.checkpointer) {
8433
8434
  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));
8435
+ const { PostgresAdapter: e } = await import("./pg-adapter-BFtir1GE-BU2H39HC.mjs"), r = t.checkpointer.pool, n = new Sr(new e(r));
8435
8436
  return process.env.DATABASE_INIT === "true" && await n.setup(), n;
8436
8437
  }
8437
8438
  if (process.env.SQLITE_DATABASE_URI && t.checkpointer) {
8438
8439
  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));
8440
+ const { SQLiteAdapter: e } = await import("./sqlite-adapter-5PeLHaxe-CUccULPN.mjs"), r = t.checkpointer.db, n = new Sr(new e(r));
8440
8441
  return await n.setup(), n;
8441
8442
  }
8442
8443
  return new cc();
@@ -8471,7 +8472,7 @@ async function hc(t, e, r, n, i) {
8471
8472
  ...l.filter((f) => f !== "events" && f !== "messages-tuple")
8472
8473
  ]);
8473
8474
  l.includes("messages-tuple") && c.add("messages"), l.includes("messages") && c.add("values"), await r.push(
8474
- new ce("metadata", {
8475
+ new ue("metadata", {
8475
8476
  run_id: e.run_id,
8476
8477
  attempt: i.attempt,
8477
8478
  graph_id: a
@@ -8503,7 +8504,7 @@ async function hc(t, e, r, n, i) {
8503
8504
  const y = (b) => p.length === 0 || p.length === 1 && p[0]?.length === 0 ? b : `${b}|${p.join("|")}`;
8504
8505
  if (g[0] === "values") {
8505
8506
  const b = g[1];
8506
- await r.push(new ce(y("values"), b)), y("values") === "values" && (b?.__interrupt__ ? await t.set(e.thread_id, {
8507
+ await r.push(new ue(y("values"), b)), y("values") === "values" && (b?.__interrupt__ ? await t.set(e.thread_id, {
8507
8508
  status: "interrupted",
8508
8509
  interrupts: b ? JSON.parse(Oe(b)) : ""
8509
8510
  }) : await t.set(e.thread_id, {
@@ -8512,18 +8513,18 @@ async function hc(t, e, r, n, i) {
8512
8513
  } else if (g[0] === "messages") {
8513
8514
  const b = g[1][0], v = g[1][1];
8514
8515
  b.id && !f.has(b.id) && (await r.push(
8515
- new ce("messages/metadata", {
8516
+ new ue("messages/metadata", {
8516
8517
  [b.id]: v
8517
8518
  })
8518
- ), f.add(b.id)), In.isInstance(b) && b.id ? (m.set(b.id, [
8519
+ ), f.add(b.id)), Sn.isInstance(b) && b.id ? (m.set(b.id, [
8519
8520
  ...m.get(b.id) ?? [],
8520
8521
  b
8521
8522
  ]), await r.push(
8522
- new ce("messages/partial", [m.get(b.id).reduce(En)])
8523
- )) : await r.push(new ce("messages/partial", [b]));
8523
+ new ue("messages/partial", [m.get(b.id).reduce(Tn)])
8524
+ )) : await r.push(new ue("messages/partial", [b]));
8524
8525
  } else if (g[0] === "updates") {
8525
8526
  const b = g[1];
8526
- await r.push(new ce(y("updates"), b));
8527
+ await r.push(new ue(y("updates"), b));
8527
8528
  }
8528
8529
  }
8529
8530
  } finally {
@@ -8590,7 +8591,7 @@ const mc = {
8590
8591
  },
8591
8592
  async getGraph(t, e) {
8592
8593
  const r = {};
8593
- return (await (await ct(t, r)).getGraphAsync({
8594
+ return (await (await lt(t, r)).getGraphAsync({
8594
8595
  ...r,
8595
8596
  xray: e?.xray ?? void 0
8596
8597
  })).toJSON();
@@ -8625,7 +8626,7 @@ const mc = {
8625
8626
  n,
8626
8627
  {
8627
8628
  attempt: 0,
8628
- getGraph: ct
8629
+ getGraph: lt
8629
8630
  }
8630
8631
  ))
8631
8632
  yield s;
@@ -8658,13 +8659,13 @@ const mc = {
8658
8659
  }
8659
8660
  }
8660
8661
  };
8661
- }, we = (t, e) => t.constructor.name === e.name, V = /* @__PURE__ */ new Map();
8662
- V.set(D.ZodBoolean.name, () => !1), V.set(D.ZodNumber.name, () => 0), V.set(D.ZodString.name, () => ""), V.set(D.ZodArray.name, () => []), V.set(D.ZodRecord.name, () => ({})), V.set(D.ZodDefault.name, (t) => t.def.defaultValue), V.set(D.ZodPipe.name, (t) => He(t.def.in)), V.set(D.ZodOptional.name, (t) => we(t.def.innerType, D.ZodDefault) ? t.def.innerType.def.defaultValue : void 0), V.set(D.ZodTuple.name, (t) => {
8662
+ }, be = (t, e) => t.constructor.name === e.name, V = /* @__PURE__ */ new Map();
8663
+ V.set(D.ZodBoolean.name, () => !1), V.set(D.ZodNumber.name, () => 0), V.set(D.ZodString.name, () => ""), V.set(D.ZodArray.name, () => []), V.set(D.ZodRecord.name, () => ({})), V.set(D.ZodDefault.name, (t) => t.def.defaultValue), V.set(D.ZodPipe.name, (t) => Ge(t.def.in)), V.set(D.ZodOptional.name, (t) => be(t.def.innerType, D.ZodDefault) ? t.def.innerType.def.defaultValue : void 0), V.set(D.ZodTuple.name, (t) => {
8663
8664
  const e = [];
8664
- for (const r of t.def.items) e.push(He(r));
8665
+ for (const r of t.def.items) e.push(Ge(r));
8665
8666
  return e;
8666
- }), V.set(D.ZodPipe.name, (t) => He(t.def.in)), V.set(D.ZodUnion.name, (t) => He(t.def.options[0])), V.set(D.ZodObject.name, (t) => _e(t)), V.set(D.ZodRecord.name, (t) => _e(t)), V.set(D.ZodIntersection.name, (t) => _e(t));
8667
- function He(t) {
8667
+ }), V.set(D.ZodPipe.name, (t) => Ge(t.def.in)), V.set(D.ZodUnion.name, (t) => Ge(t.def.options[0])), V.set(D.ZodObject.name, (t) => ve(t)), V.set(D.ZodRecord.name, (t) => ve(t)), V.set(D.ZodIntersection.name, (t) => ve(t));
8668
+ function Ge(t) {
8668
8669
  const e = t.constructor.name;
8669
8670
  if (!V.has(e)) {
8670
8671
  console.warn("getSchemaDefaultForField: Unhandled type", t.constructor.name);
@@ -8672,15 +8673,15 @@ function He(t) {
8672
8673
  }
8673
8674
  return V.get(e)(t);
8674
8675
  }
8675
- function _e(t) {
8676
- if (we(t, D.ZodRecord)) return {};
8677
- if (we(t, D.ZodPipe)) return _e(t.def.in);
8678
- if (we(t, D.ZodIntersection)) return { ..._e(t.def.left), ..._e(t.def.right) };
8679
- if (we(t, D.ZodUnion)) {
8680
- for (const e of t.def.options) if (we(e, D.ZodObject)) return _e(e);
8676
+ function ve(t) {
8677
+ if (be(t, D.ZodRecord)) return {};
8678
+ if (be(t, D.ZodPipe)) return ve(t.def.in);
8679
+ if (be(t, D.ZodIntersection)) return { ...ve(t.def.left), ...ve(t.def.right) };
8680
+ if (be(t, D.ZodUnion)) {
8681
+ for (const e of t.def.options) if (be(e, D.ZodObject)) return ve(e);
8681
8682
  return console.warn("getSchemaDefaultObject: No object found in union, returning empty object"), {};
8682
8683
  }
8683
- return we(t, D.ZodObject) ? Object.fromEntries(Object.entries(t.shape).map(([e, r]) => [e, He(r)]).filter((e) => e[1] !== void 0)) : (console.warn(`getSchemaDefaultObject: Expected object schema, got ${t.constructor.name}`), {});
8684
+ return be(t, D.ZodObject) ? Object.fromEntries(Object.entries(t.shape).map(([e, r]) => [e, Ge(r)]).filter((e) => e[1] !== void 0)) : (console.warn(`getSchemaDefaultObject: Expected object schema, got ${t.constructor.name}`), {});
8684
8685
  }
8685
8686
  D.object({
8686
8687
  task_store: D.record(D.string(), D.any()).default({})
@@ -8691,10 +8692,10 @@ D.object({
8691
8692
  task_description: D.string().describe("Describe the user state and what you want the subagent to do."),
8692
8693
  data_transfer: D.any().optional().describe("Data to transfer to the subagent.")
8693
8694
  });
8694
- const se = gc(), pc = T.object({
8695
+ const ae = gc(), pc = T.object({
8695
8696
  thread_id: T.string().optional(),
8696
8697
  thread_ts: T.string().optional()
8697
- }).catchall(T.unknown()), an = T.object({
8698
+ }).catchall(T.unknown()), sn = T.object({
8698
8699
  tags: T.array(T.string()).optional(),
8699
8700
  recursion_limit: T.number().int().optional(),
8700
8701
  configurable: pc.optional()
@@ -8702,36 +8703,36 @@ const se = gc(), pc = T.object({
8702
8703
  T.object({
8703
8704
  assistant_id: T.string().uuid(),
8704
8705
  graph_id: T.string(),
8705
- config: an,
8706
+ config: sn,
8706
8707
  created_at: T.string(),
8707
8708
  updated_at: T.string(),
8708
8709
  metadata: T.object({}).catchall(T.any())
8709
8710
  });
8710
- const lt = T.object({
8711
+ const ut = T.object({
8711
8712
  source: T.union([T.literal("input"), T.literal("loop"), T.literal("update"), T.string()]).optional(),
8712
8713
  step: T.number().optional(),
8713
8714
  writes: T.any().nullable().optional(),
8714
8715
  parents: T.any().optional()
8715
- }).catchall(T.unknown()), Sr = T.object({
8716
+ }).catchall(T.unknown()), Tr = T.object({
8716
8717
  node: T.string(),
8717
8718
  input: T.unknown().optional()
8718
8719
  }), yc = T.object({
8719
8720
  update: T.union([T.any(), T.array(T.tuple([T.string(), T.any()]))]).nullable().optional(),
8720
8721
  resume: T.unknown().optional(),
8721
- goto: T.union([Sr, T.array(Sr), T.string(), T.array(T.string())]).optional()
8722
+ goto: T.union([Tr, T.array(Tr), T.string(), T.array(T.string())]).optional()
8722
8723
  });
8723
8724
  T.object({
8724
8725
  limit: T.number().int().optional(),
8725
8726
  offset: T.number().int().optional()
8726
8727
  });
8727
- const ut = T.object({
8728
+ const dt = T.object({
8728
8729
  thread_id: T.string().uuid()
8729
- }), on = T.object({
8730
+ }), an = T.object({
8730
8731
  thread_id: T.string().uuid(),
8731
8732
  run_id: T.string().uuid()
8732
8733
  }), wc = T.object({
8733
8734
  graph_id: T.string().optional(),
8734
- metadata: lt.optional(),
8735
+ metadata: ut.optional(),
8735
8736
  limit: T.number().int().optional(),
8736
8737
  offset: T.number().int().optional()
8737
8738
  }), bc = T.object({
@@ -8741,8 +8742,8 @@ const ut = T.object({
8741
8742
  checkpoint_id: T.string().optional(),
8742
8743
  input: T.any().optional(),
8743
8744
  command: yc.optional(),
8744
- metadata: lt.optional(),
8745
- config: an.optional(),
8745
+ metadata: ut.optional(),
8746
+ config: sn.optional(),
8746
8747
  webhook: T.string().optional(),
8747
8748
  interrupt_before: T.union([T.literal("*"), T.array(T.string())]).optional(),
8748
8749
  interrupt_after: T.union([T.literal("*"), T.array(T.string())]).optional(),
@@ -8769,10 +8770,10 @@ const ut = T.object({
8769
8770
  stream_mode: T.enum(["values", "messages", "messages-tuple", "updates", "events", "debug", "custom"]).optional()
8770
8771
  }), Tc = T.object({
8771
8772
  thread_id: T.string().uuid().describe("The ID of the thread. If not provided, an ID is generated.").optional(),
8772
- metadata: lt.optional(),
8773
+ metadata: ut.optional(),
8773
8774
  if_exists: T.union([T.literal("raise"), T.literal("do_nothing")]).optional()
8774
8775
  }).describe("Payload for creating a thread."), Cc = T.object({
8775
- metadata: lt.describe("Metadata to search for.").optional(),
8776
+ metadata: ut.describe("Metadata to search for.").optional(),
8776
8777
  status: T.enum(["idle", "busy", "interrupted", "error"]).describe("Filter by thread status.").optional(),
8777
8778
  values: T.any().describe("Filter by thread values.").optional(),
8778
8779
  limit: T.number().int().gte(1).lte(1e3).describe("Maximum number to return.").optional(),
@@ -8786,7 +8787,7 @@ const ut = T.object({
8786
8787
  // checkpoint_id: z.string().optional(),
8787
8788
  // checkpoint: CheckpointSchema.nullish(),
8788
8789
  }).describe("Payload for adding state to a thread.");
8789
- function Se(t, e) {
8790
+ function Te(t, e) {
8790
8791
  const r = e.split("/").filter((s) => s), n = new URL(t).pathname.split("/").filter((s) => s), i = {};
8791
8792
  return r.forEach((s, a) => {
8792
8793
  if (s.startsWith(":")) {
@@ -8795,25 +8796,25 @@ function Se(t, e) {
8795
8796
  }
8796
8797
  }), i;
8797
8798
  }
8798
- function dt(t) {
8799
+ function ht(t) {
8799
8800
  const e = new URL(t).searchParams, r = {};
8800
8801
  return e.forEach((n, i) => {
8801
8802
  !isNaN(Number(n)) && n !== "" ? r[i] = Number(n) : n === "true" || n === "false" ? r[i] = n === "true" : r[i] = n;
8802
8803
  }), r;
8803
8804
  }
8804
- function q(t, e) {
8805
+ function Y(t, e) {
8805
8806
  const r = t.safeParse(e);
8806
8807
  if (!r.success)
8807
- throw new cn(r.error.issues);
8808
+ throw new on(r.error.issues);
8808
8809
  return r.data;
8809
8810
  }
8810
- class cn extends Error {
8811
+ class on extends Error {
8811
8812
  errors;
8812
8813
  constructor(e) {
8813
8814
  super("Validation failed"), this.name = "ValidationError", this.errors = e;
8814
8815
  }
8815
8816
  }
8816
- function le(t, e = 200, r) {
8817
+ function de(t, e = 200, r) {
8817
8818
  return new Response(JSON.stringify(t), {
8818
8819
  status: e,
8819
8820
  headers: {
@@ -8822,21 +8823,21 @@ function le(t, e = 200, r) {
8822
8823
  }
8823
8824
  });
8824
8825
  }
8825
- function ee(t, e = 500) {
8826
- return t instanceof cn ? le(
8826
+ function ne(t, e = 500) {
8827
+ return t instanceof on ? de(
8827
8828
  {
8828
8829
  error: "Validation Error",
8829
8830
  details: t.errors
8830
8831
  },
8831
8832
  400
8832
- ) : le(
8833
+ ) : de(
8833
8834
  {
8834
8835
  error: t instanceof Error ? t.message : "Unknown error"
8835
8836
  },
8836
8837
  e
8837
8838
  );
8838
8839
  }
8839
- function ln(t) {
8840
+ function cn(t) {
8840
8841
  let e, r = !1;
8841
8842
  const n = new ReadableStream({
8842
8843
  async start(i) {
@@ -8892,7 +8893,7 @@ function ln(t) {
8892
8893
  }
8893
8894
  });
8894
8895
  }
8895
- function un(t, e = process.env.HEARTBEAT_INTERVAL ? parseInt(process.env.HEARTBEAT_INTERVAL) : 1500) {
8896
+ function ln(t, e = process.env.HEARTBEAT_INTERVAL ? parseInt(process.env.HEARTBEAT_INTERVAL) : 1500) {
8896
8897
  return async (r) => {
8897
8898
  let n = null;
8898
8899
  const i = () => {
@@ -8923,83 +8924,83 @@ function un(t, e = process.env.HEARTBEAT_INTERVAL ? parseInt(process.env.HEARTBE
8923
8924
  }
8924
8925
  async function Ic(t, e) {
8925
8926
  try {
8926
- const r = await t.json(), n = q(wc, r), i = await se.assistants.search(Ze(n));
8927
- return le(i, 200, {
8927
+ const r = await t.json(), n = Y(wc, r), i = await ae.assistants.search(Je(n));
8928
+ return de(i, 200, {
8928
8929
  "X-Pagination-Total": "0"
8929
8930
  });
8930
8931
  } catch (r) {
8931
- return ee(r);
8932
+ return ne(r);
8932
8933
  }
8933
8934
  }
8934
8935
  async function Ec(t, e) {
8935
8936
  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, {
8937
+ const i = new URL(t.url).pathname.split("/").filter((l) => l)[1], s = ht(t.url), { xray: a } = Y(bc, s), o = await ae.assistants.getGraph(i, {
8937
8938
  xray: a !== void 0 ? a === "true" : void 0
8938
8939
  });
8939
- return le(o);
8940
+ return de(o);
8940
8941
  } catch (r) {
8941
- return ee(r);
8942
+ return ne(r);
8942
8943
  }
8943
8944
  }
8944
8945
  async function Ac(t, e) {
8945
8946
  try {
8946
- const r = await t.json(), n = q(Tc, r), i = await se.threads.create(Ze(n));
8947
- return le(i);
8947
+ const r = await t.json(), n = Y(Tc, r), i = await ae.threads.create(Je(n));
8948
+ return de(i);
8948
8949
  } catch (r) {
8949
- return ee(r);
8950
+ return ne(r);
8950
8951
  }
8951
8952
  }
8952
8953
  async function kc(t, e) {
8953
8954
  try {
8954
- const r = await t.json(), n = q(Cc, r), i = await se.threads.search(Ze(n));
8955
- return le(i, 200, {
8955
+ const r = await t.json(), n = Y(Cc, r), i = await ae.threads.search(Je(n));
8956
+ return de(i, 200, {
8956
8957
  "X-Pagination-Total": i.length.toString()
8957
8958
  });
8958
8959
  } catch (r) {
8959
- return ee(r);
8960
+ return ne(r);
8960
8961
  }
8961
8962
  }
8962
8963
  async function Mc(t, e) {
8963
8964
  try {
8964
- const r = Se(t.url, "/threads/:thread_id"), { thread_id: n } = q(ut, r), i = await se.threads.get(n);
8965
- return le(i);
8965
+ const r = Te(t.url, "/threads/:thread_id"), { thread_id: n } = Y(dt, r), i = await ae.threads.get(n);
8966
+ return de(i);
8966
8967
  } catch (r) {
8967
- return ee(r);
8968
+ return ne(r);
8968
8969
  }
8969
8970
  }
8970
8971
  async function Pc(t, e) {
8971
8972
  try {
8972
- const r = Se(t.url, "/threads/:thread_id"), { thread_id: n } = q(ut, r);
8973
- return await se.threads.delete(n), new Response(null, { status: 204 });
8973
+ const r = Te(t.url, "/threads/:thread_id"), { thread_id: n } = Y(dt, r);
8974
+ return await ae.threads.delete(n), new Response(null, { status: 204 });
8974
8975
  } catch (r) {
8975
- return ee(r);
8976
+ return ne(r);
8976
8977
  }
8977
8978
  }
8978
8979
  async function Dc(t, e) {
8979
8980
  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);
8981
- return ln(
8982
- un(async (a) => {
8981
+ const r = Te(t.url, "/threads/:thread_id/runs/stream"), { thread_id: n } = Y(dt, r), i = await t.json(), s = Y(_c, i);
8982
+ return cn(
8983
+ ln(async (a) => {
8983
8984
  s.config = s.config || {}, s.config.configurable = s.config.configurable || {};
8984
8985
  const o = e?.langgraph_context;
8985
8986
  o && Object.assign(s.config.configurable, o);
8986
- for await (const { event: l, data: c } of se.runs.stream(
8987
+ for await (const { event: l, data: c } of ae.runs.stream(
8987
8988
  n,
8988
8989
  s.assistant_id,
8989
- Ze(s)
8990
+ Je(s)
8990
8991
  ))
8991
8992
  await a.writeSSE({ data: Oe(c) ?? "", event: l });
8992
8993
  })
8993
8994
  );
8994
8995
  } catch (r) {
8995
- return ee(r);
8996
+ return ne(r);
8996
8997
  }
8997
8998
  }
8998
8999
  async function Rc(t, e) {
8999
9000
  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);
9001
- return ln(
9002
- un(async (c) => {
9001
+ const r = Te(t.url, "/threads/:thread_id/runs/:run_id/stream"), { thread_id: n, run_id: i } = Y(an, r), s = ht(t.url), { cancel_on_disconnect: a, last_event_id: o, stream_mode: l } = Y(Sc, s);
9002
+ return cn(
9003
+ ln(async (c) => {
9003
9004
  const u = new AbortController();
9004
9005
  if (a) {
9005
9006
  const h = () => {
@@ -9008,7 +9009,7 @@ async function Rc(t, e) {
9008
9009
  t.signal?.addEventListener("abort", h);
9009
9010
  }
9010
9011
  try {
9011
- for await (const { event: h, data: f, id: m } of se.runs.joinStream(n, i, {
9012
+ for await (const { event: h, data: f, id: m } of ae.runs.joinStream(n, i, {
9012
9013
  signal: u.signal,
9013
9014
  cancelOnDisconnect: a,
9014
9015
  lastEventId: o,
@@ -9030,31 +9031,31 @@ async function Rc(t, e) {
9030
9031
  })
9031
9032
  );
9032
9033
  } catch (r) {
9033
- return ee(r);
9034
+ return ne(r);
9034
9035
  }
9035
9036
  }
9036
9037
  async function Oc(t, e) {
9037
9038
  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 });
9039
- return le(l);
9039
+ const r = Te(t.url, "/threads/:thread_id/runs"), { thread_id: n } = Y(dt, r), i = ht(t.url), { limit: s, offset: a, status: o } = Y(vc, i), l = await ae.runs.list(n, { limit: s, offset: a, status: o });
9040
+ return de(l);
9040
9041
  } catch (r) {
9041
- return ee(r);
9042
+ return ne(r);
9042
9043
  }
9043
9044
  }
9044
9045
  async function Nc(t, e) {
9045
9046
  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);
9047
+ const r = Te(t.url, "/threads/:thread_id/runs/:run_id/cancel"), { thread_id: n, run_id: i } = Y(an, r), s = ht(t.url), { wait: a, action: o } = Y(xc, s), l = ae.runs.cancel(n, i, a, o);
9047
9048
  return a && await l, new Response(null, { status: a ? 204 : 202 });
9048
9049
  } catch (r) {
9049
- return ee(r);
9050
+ return ne(r);
9050
9051
  }
9051
9052
  }
9052
9053
  async function Lc(t, e) {
9053
9054
  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);
9055
- return le(a);
9055
+ const r = Te(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 ae.threads.updateState(n, s);
9056
+ return de(a);
9056
9057
  } catch (r) {
9057
- return ee(r);
9058
+ return ne(r);
9058
9059
  }
9059
9060
  }
9060
9061
  const $c = [
@@ -9136,13 +9137,13 @@ async function Uc(t, e = {}) {
9136
9137
  return await s.handler(t, e);
9137
9138
  return new Response("Not Found", { status: 404 });
9138
9139
  } catch (r) {
9139
- return console.error("Request error:", r), ee(r);
9140
+ return console.error("Request error:", r), ne(r);
9140
9141
  }
9141
9142
  }
9142
- await An();
9143
- sc("code", kn);
9143
+ await Cn();
9144
+ sc("code", jn);
9144
9145
  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);
9146
+ const t = Dr(), e = (/* @__PURE__ */ new Date()).toLocaleDateString(), { extraParams: r, AVAILABLE_MODELS: n, config: i } = he(), 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
9147
  return x.useEffect(() => {
9147
9148
  const I = setInterval(() => {
9148
9149
  v((k) => (k + 1) % 92);
@@ -9160,7 +9161,7 @@ const Bc = (t, e = {}) => Uc(new Request(t, e), {}), zc = () => {
9160
9161
  ███╔╝ ██╔══╝ ██║╚██╗██║
9161
9162
  ███████╗███████╗██║ ╚████║
9162
9163
  ╚══════╝╚══════╝╚═╝ ╚═══╝`.split(`
9163
- `).map((S) => /* @__PURE__ */ d.jsx(Ir, { interval: 40, text: S, globalIndex: b }, S)) }),
9164
+ `).map((S) => /* @__PURE__ */ d.jsx($n, { interval: 40, text: S, globalIndex: b }, S)) }),
9164
9165
  /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", justifyContent: "center", flexGrow: 1, children: [
9165
9166
  /* @__PURE__ */ d.jsx(_, { marginBottom: 1, children: y ? /* @__PURE__ */ d.jsxs(w, { color: "green", bold: !0, children: [
9166
9167
  " ",
@@ -9284,7 +9285,7 @@ class Hc {
9284
9285
  this.renderers.clear();
9285
9286
  }
9286
9287
  }
9287
- const Ge = new Hc(), Gc = {
9288
+ const We = new Hc(), Gc = {
9288
9289
  approve: "green",
9289
9290
  reject: "red",
9290
9291
  edit: "yellow",
@@ -9353,7 +9354,7 @@ const Ge = new Hc(), Gc = {
9353
9354
  j ? /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", marginTop: 0, children: [
9354
9355
  /* @__PURE__ */ d.jsx(w, { color: "yellow", dimColor: !0, children: "Editing action arguments (JSON format):" }),
9355
9356
  /* @__PURE__ */ d.jsx(_, { paddingX: 1, children: /* @__PURE__ */ d.jsx(
9356
- xe,
9357
+ Se,
9357
9358
  {
9358
9359
  value: u,
9359
9360
  onChange: h,
@@ -9365,7 +9366,7 @@ const Ge = new Hc(), Gc = {
9365
9366
  ] }) : /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", marginTop: 0, children: [
9366
9367
  /* @__PURE__ */ d.jsx(w, { color: "cyan", dimColor: !0, children: "Enter additional message for this action:" }),
9367
9368
  /* @__PURE__ */ d.jsx(_, { padding: 1, children: /* @__PURE__ */ d.jsx(
9368
- xe,
9369
+ Se,
9369
9370
  {
9370
9371
  value: u,
9371
9372
  onChange: h,
@@ -9493,7 +9494,7 @@ const Ge = new Hc(), Gc = {
9493
9494
  }
9494
9495
  ),
9495
9496
  r.allowCustomInput && /* @__PURE__ */ d.jsx(_, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ d.jsx(
9496
- xe,
9497
+ Se,
9497
9498
  {
9498
9499
  value: a,
9499
9500
  onChange: o,
@@ -9526,7 +9527,7 @@ const Ge = new Hc(), Gc = {
9526
9527
  }
9527
9528
  }
9528
9529
  };
9529
- function Tr({ value: t, placeholder: e = "", focus: r = !0, mask: n, highlightPastedText: i = !1, showCursor: s = !0, onChange: a, onSubmit: o }) {
9530
+ function Cr({ value: t, placeholder: e = "", focus: r = !0, mask: n, highlightPastedText: i = !1, showCursor: s = !0, onChange: a, onSubmit: o }) {
9530
9531
  const [l, c] = x.useState({
9531
9532
  cursorOffset: (t || "").length,
9532
9533
  cursorWidth: 0
@@ -9543,13 +9544,13 @@ function Tr({ value: t, placeholder: e = "", focus: r = !0, mask: n, highlightPa
9543
9544
  });
9544
9545
  }, [t, r, s]);
9545
9546
  const f = i ? h : 0, m = n ? n.repeat(t.length) : t;
9546
- let g = m, p = e ? pe.grey(e) : void 0;
9547
+ let g = m, p = e ? ye.grey(e) : void 0;
9547
9548
  if (s && r) {
9548
- p = e.length > 0 ? pe.inverse(e[0]) + pe.grey(e.slice(1)) : pe.inverse(" "), g = m.length > 0 ? "" : pe.inverse(" ");
9549
+ p = e.length > 0 ? ye.inverse(e[0]) + ye.grey(e.slice(1)) : ye.inverse(" "), g = m.length > 0 ? "" : ye.inverse(" ");
9549
9550
  let y = 0;
9550
9551
  for (const b of m)
9551
- g += y >= u - f && y <= u ? pe.inverse(b) : b, y++;
9552
- m.length > 0 && u === m.length && (g += pe.inverse(" "));
9552
+ g += y >= u - f && y <= u ? ye.inverse(b) : b, y++;
9553
+ m.length > 0 && u === m.length && (g += ye.inverse(" "));
9553
9554
  }
9554
9555
  return Ut((y, b) => {
9555
9556
  if (b.upArrow || b.downArrow || b.ctrl && y === "c" || b.tab || b.shift && b.tab)
@@ -9563,7 +9564,7 @@ function Tr({ value: t, placeholder: e = "", focus: r = !0, mask: n, highlightPa
9563
9564
  cursorOffset: v,
9564
9565
  cursorWidth: C
9565
9566
  }), S !== t && a(S);
9566
- }, { isActive: r }), ve.createElement(w, null, e ? m.length > 0 ? g : p : g);
9567
+ }, { isActive: r }), xe.createElement(w, null, e ? m.length > 0 ? g : p : g);
9567
9568
  }
9568
9569
  const Vc = {
9569
9570
  type: "input",
@@ -9577,11 +9578,11 @@ const Vc = {
9577
9578
  result: { value: i }
9578
9579
  });
9579
9580
  };
9580
- return r.multiline && xe, /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", paddingX: 1, children: [
9581
+ return r.multiline && Se, /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", paddingX: 1, children: [
9581
9582
  n?.title && /* @__PURE__ */ d.jsx(_, { marginBottom: 1, children: /* @__PURE__ */ d.jsx(w, { color: "cyan", bold: !0, children: n.title }) }),
9582
9583
  n?.description && /* @__PURE__ */ d.jsx(_, { marginBottom: 1, children: /* @__PURE__ */ d.jsx(w, { dimColor: !0, children: n.description }) }),
9583
9584
  /* @__PURE__ */ d.jsx(_, { children: r.multiline ? /* @__PURE__ */ d.jsx(
9584
- xe,
9585
+ Se,
9585
9586
  {
9586
9587
  value: i,
9587
9588
  onChange: s,
@@ -9590,7 +9591,7 @@ const Vc = {
9590
9591
  autoFocus: !0
9591
9592
  }
9592
9593
  ) : /* @__PURE__ */ d.jsx(
9593
- Tr,
9594
+ Cr,
9594
9595
  {
9595
9596
  value: i,
9596
9597
  onChange: s,
@@ -9625,7 +9626,7 @@ const Vc = {
9625
9626
  autoSubmit: !1
9626
9627
  }
9627
9628
  }
9628
- }, qc = {
9629
+ }, Yc = {
9629
9630
  type: "confirm",
9630
9631
  /**
9631
9632
  * 渲染确认交互
@@ -9679,7 +9680,7 @@ const Vc = {
9679
9680
  autoSubmit: !1
9680
9681
  }
9681
9682
  }
9682
- }, Yc = ({
9683
+ }, qc = ({
9683
9684
  items: t,
9684
9685
  defaultIndex: e = 0,
9685
9686
  onChange: r,
@@ -9687,7 +9688,7 @@ const Vc = {
9687
9688
  autoFocus: i = !0,
9688
9689
  variant: s = "line"
9689
9690
  }) => {
9690
- const { isFocused: a } = mn({ autoFocus: i }), [o, l] = x.useState(e), c = x.useCallback(
9691
+ const { isFocused: a } = Fn({ autoFocus: i }), [o, l] = x.useState(e), c = x.useCallback(
9691
9692
  (f) => {
9692
9693
  f < 0 || f >= t.length || t[f].disabled || (l(f), r?.(f, t[f]));
9693
9694
  },
@@ -9806,7 +9807,7 @@ const Vc = {
9806
9807
  }
9807
9808
  );
9808
9809
  }, Xc = () => {
9809
- const t = at(), [e, r] = x.useState(null), { focusNext: n } = Mr(), i = x.useMemo(() => t.getInteractions(), [t.getInteractions()]);
9810
+ const t = ot(), [e, r] = x.useState(null), { focusNext: n } = zt(), i = x.useMemo(() => t.getInteractions(), [t.getInteractions()]);
9810
9811
  x.useEffect(() => {
9811
9812
  i.length > 0 && !e && r(i[0].id);
9812
9813
  }, [i, e]);
@@ -9842,7 +9843,7 @@ const Vc = {
9842
9843
  if (!e) return null;
9843
9844
  const c = i.find((h) => h.id === e);
9844
9845
  if (!c) return null;
9845
- const u = Ge.get(c.content.type);
9846
+ const u = We.get(c.content.type);
9846
9847
  return u ? /* @__PURE__ */ d.jsx(
9847
9848
  Kc,
9848
9849
  {
@@ -9864,7 +9865,7 @@ const Vc = {
9864
9865
  ")"
9865
9866
  ] }) }),
9866
9867
  /* @__PURE__ */ d.jsx(_, { paddingX: 1, marginBottom: 1, children: /* @__PURE__ */ d.jsx(
9867
- Yc,
9868
+ qc,
9868
9869
  {
9869
9870
  items: s,
9870
9871
  defaultIndex: s.findIndex((c) => c.id === e),
@@ -9878,12 +9879,12 @@ const Vc = {
9878
9879
  ] });
9879
9880
  };
9880
9881
  function el() {
9881
- Ge.register("approval", Jc), Ge.register("selection", Qc), Ge.register("input", Vc), Ge.register("confirm", qc);
9882
+ We.register("approval", Jc), We.register("selection", Qc), We.register("input", Vc), We.register("confirm", Yc);
9882
9883
  }
9883
9884
  el();
9884
9885
  const tl = ({ tool: t }) => {
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
+ const { addInteraction: e, getInteractions: r, updateInteraction: n } = ot(), [i, s] = x.useState(null), a = x.useRef(!1), o = t.getInputRepaired();
9887
+ return zt(), x.useEffect(() => {
9887
9888
  if (t.state === "interrupted" && !i && !a.current) {
9888
9889
  const c = {
9889
9890
  type: "selection",
@@ -9926,15 +9927,15 @@ const tl = ({ tool: t }) => {
9926
9927
  const c = setInterval(l, 100);
9927
9928
  return () => clearInterval(c);
9928
9929
  }, [i, r, n, t]), t.state === "interrupted" && !t.output ? /* @__PURE__ */ d.jsx(_, { flexDirection: "column", children: /* @__PURE__ */ d.jsx(_, { paddingX: 1, children: /* @__PURE__ */ d.jsx(w, { color: "yellow", children: "⏳ Waiting for selection..." }) }) }) : t.output ? /* @__PURE__ */ d.jsx(w, { color: "yellow", children: t.output }) : null;
9929
- }, rl = de({
9930
+ }, rl = fe({
9930
9931
  name: "ask_user_with_options",
9931
9932
  description: "Ask the user for a selection from a list of options",
9932
- parameters: Mn.schema.shape,
9933
- handler: he.waitForUIDone,
9933
+ parameters: In.schema.shape,
9934
+ handler: me.waitForUIDone,
9934
9935
  render(t) {
9935
9936
  return /* @__PURE__ */ d.jsx(tl, { tool: t });
9936
9937
  }
9937
- }), dn = ({
9938
+ }), un = ({
9938
9939
  content: t,
9939
9940
  maxLines: e = 10,
9940
9941
  borderColor: r = "cyan",
@@ -9968,7 +9969,7 @@ const tl = ({ tool: t }) => {
9968
9969
  }
9969
9970
  ) });
9970
9971
  }, nl = ({ tool: t }) => {
9971
- const { addInteraction: e, getInteractions: r, updateInteraction: n } = at(), [i, s] = x.useState(null), a = x.useRef(!1), o = t.getHumanInTheLoopData();
9972
+ const { addInteraction: e, getInteractions: r, updateInteraction: n } = ot(), [i, s] = x.useState(null), a = x.useRef(!1), o = t.getHumanInTheLoopData();
9972
9973
  if (x.useEffect(() => {
9973
9974
  if (o?.reviewConfig && t.state === "interrupted" && !i && !a.current) {
9974
9975
  const c = t.getInputRepaired()?.description, u = {
@@ -10023,20 +10024,20 @@ const tl = ({ tool: t }) => {
10023
10024
  return () => clearInterval(u);
10024
10025
  }, [i, r, n, t]), o?.reviewConfig && i && !t.output)
10025
10026
  return /* @__PURE__ */ d.jsx(_, { flexDirection: "column", children: /* @__PURE__ */ d.jsx(_, { paddingX: 1, paddingY: 1, children: /* @__PURE__ */ d.jsx(w, { color: "yellow", children: "⏳ Wait for Approval" }) }) });
10026
- const l = () => t.output ? /* @__PURE__ */ d.jsx(dn, { content: t.output, maxLines: 5, borderColor: "cyan" }) : null;
10027
+ const l = () => t.output ? /* @__PURE__ */ d.jsx(un, { content: t.output, maxLines: 5, borderColor: "cyan" }) : null;
10027
10028
  return /* @__PURE__ */ d.jsx(_, { flexDirection: "column", children: l() });
10028
- }, sl = de({
10029
+ }, sl = fe({
10029
10030
  name: "terminal",
10030
10031
  description: "",
10031
10032
  parameters: {},
10032
- handler: he.waitForUIDone,
10033
+ handler: me.waitForUIDone,
10033
10034
  render(t) {
10034
10035
  return /* @__PURE__ */ d.jsx(nl, { tool: t });
10035
10036
  }
10036
10037
  });
10037
- var Et = { exports: {} }, Cr;
10038
+ var Et = { exports: {} }, jr;
10038
10039
  function il() {
10039
- return Cr || (Cr = 1, (function(t) {
10040
+ return jr || (jr = 1, (function(t) {
10040
10041
  var e = function() {
10041
10042
  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
10043
  }, r = -1, n = 1, i = 0;
@@ -10123,36 +10124,36 @@ function il() {
10123
10124
  for (var I = -A + v; I <= A - S; I += 2) {
10124
10125
  var k = h + I, R;
10125
10126
  I == -A || I != A && m[k - 1] < m[k + 1] ? R = m[k + 1] : R = m[k - 1] + 1;
10126
- for (var z = R - I; R < l && z < c && s.charAt(R) == a.charAt(z); )
10127
- R++, z++;
10127
+ for (var B = R - I; R < l && B < c && s.charAt(R) == a.charAt(B); )
10128
+ R++, B++;
10128
10129
  if (m[k] = R, R > l)
10129
10130
  S += 2;
10130
- else if (z > c)
10131
+ else if (B > c)
10131
10132
  v += 2;
10132
10133
  else if (b) {
10133
- var H = h + y - I;
10134
- if (H >= 0 && H < f && g[H] != -1) {
10135
- var $ = l - g[H];
10134
+ var z = h + y - I;
10135
+ if (z >= 0 && z < f && g[z] != -1) {
10136
+ var $ = l - g[z];
10136
10137
  if (R >= $)
10137
- return this.diff_bisectSplit_(s, a, R, z, o);
10138
+ return this.diff_bisectSplit_(s, a, R, B, o);
10138
10139
  }
10139
10140
  }
10140
10141
  }
10141
- for (var U = -A + C; U <= A - j; U += 2) {
10142
- var H = h + U, $;
10143
- U == -A || U != A && g[H - 1] < g[H + 1] ? $ = g[H + 1] : $ = g[H - 1] + 1;
10144
- for (var W = $ - U; $ < l && W < c && s.charAt(l - $ - 1) == a.charAt(c - W - 1); )
10145
- $++, W++;
10146
- if (g[H] = $, $ > l)
10142
+ for (var H = -A + C; H <= A - j; H += 2) {
10143
+ var z = h + H, $;
10144
+ H == -A || H != A && g[z - 1] < g[z + 1] ? $ = g[z + 1] : $ = g[z - 1] + 1;
10145
+ for (var J = $ - H; $ < l && J < c && s.charAt(l - $ - 1) == a.charAt(c - J - 1); )
10146
+ $++, J++;
10147
+ if (g[z] = $, $ > l)
10147
10148
  j += 2;
10148
- else if (W > c)
10149
+ else if (J > c)
10149
10150
  C += 2;
10150
10151
  else if (!b) {
10151
- var k = h + y - U;
10152
+ var k = h + y - H;
10152
10153
  if (k >= 0 && k < f && m[k] != -1) {
10153
- var R = m[k], z = h + R - k;
10154
+ var R = m[k], B = h + R - k;
10154
10155
  if ($ = l - $, R >= $)
10155
- return this.diff_bisectSplit_(s, a, R, z, o);
10156
+ return this.diff_bisectSplit_(s, a, R, B, o);
10156
10157
  }
10157
10158
  }
10158
10159
  }
@@ -10220,20 +10221,20 @@ function il() {
10220
10221
  return null;
10221
10222
  var c = this;
10222
10223
  function u(S, C, j) {
10223
- for (var A = S.substring(j, j + Math.floor(S.length / 4)), I = -1, k = "", R, z, H, $; (I = C.indexOf(A, I + 1)) != -1; ) {
10224
- var U = c.diff_commonPrefix(
10224
+ for (var A = S.substring(j, j + Math.floor(S.length / 4)), I = -1, k = "", R, B, z, $; (I = C.indexOf(A, I + 1)) != -1; ) {
10225
+ var H = c.diff_commonPrefix(
10225
10226
  S.substring(j),
10226
10227
  C.substring(I)
10227
- ), W = c.diff_commonSuffix(
10228
+ ), J = c.diff_commonSuffix(
10228
10229
  S.substring(0, j),
10229
10230
  C.substring(0, I)
10230
10231
  );
10231
- k.length < W + U && (k = C.substring(I - W, I) + C.substring(I, I + U), R = S.substring(0, j - W), z = S.substring(j + U), H = C.substring(0, I - W), $ = C.substring(I + U));
10232
+ k.length < J + H && (k = C.substring(I - J, I) + C.substring(I, I + H), R = S.substring(0, j - J), B = S.substring(j + H), z = C.substring(0, I - J), $ = C.substring(I + H));
10232
10233
  }
10233
10234
  return k.length * 2 >= S.length ? [
10234
10235
  R,
10236
+ B,
10235
10237
  z,
10236
- H,
10237
10238
  $,
10238
10239
  k
10239
10240
  ] : null;
@@ -10281,8 +10282,8 @@ function il() {
10281
10282
  function a(v, S) {
10282
10283
  if (!v || !S)
10283
10284
  return 6;
10284
- var C = v.charAt(v.length - 1), j = S.charAt(0), A = C.match(e.nonAlphaNumericRegex_), I = j.match(e.nonAlphaNumericRegex_), k = A && C.match(e.whitespaceRegex_), R = I && j.match(e.whitespaceRegex_), z = k && C.match(e.linebreakRegex_), H = R && j.match(e.linebreakRegex_), $ = z && v.match(e.blanklineEndRegex_), U = H && S.match(e.blanklineStartRegex_);
10285
- return $ || U ? 5 : z || H ? 4 : A && !k && R ? 3 : k || R ? 2 : A || I ? 1 : 0;
10285
+ var C = v.charAt(v.length - 1), j = S.charAt(0), A = C.match(e.nonAlphaNumericRegex_), I = j.match(e.nonAlphaNumericRegex_), k = A && C.match(e.whitespaceRegex_), R = I && j.match(e.whitespaceRegex_), B = k && C.match(e.linebreakRegex_), z = R && j.match(e.linebreakRegex_), $ = B && v.match(e.blanklineEndRegex_), H = z && S.match(e.blanklineStartRegex_);
10286
+ return $ || H ? 5 : B || z ? 4 : A && !k && R ? 3 : k || R ? 2 : A || I ? 1 : 0;
10286
10287
  }
10287
10288
  for (var o = 1; o < s.length - 1; ) {
10288
10289
  if (s[o - 1][0] == i && s[o + 1][0] == i) {
@@ -10433,9 +10434,9 @@ function il() {
10433
10434
  if (a.length > this.Match_MaxBits)
10434
10435
  throw new Error("Pattern too long for this browser.");
10435
10436
  var l = this.match_alphabet_(a), c = this;
10436
- function u(R, z) {
10437
- var H = R / a.length, $ = Math.abs(o - z);
10438
- return c.Match_Distance ? H + $ / c.Match_Distance : $ ? 1 : H;
10437
+ function u(R, B) {
10438
+ var z = R / a.length, $ = Math.abs(o - B);
10439
+ return c.Match_Distance ? z + $ / c.Match_Distance : $ ? 1 : z;
10439
10440
  }
10440
10441
  var h = this.Match_Threshold, f = s.indexOf(a, o);
10441
10442
  f != -1 && (h = Math.min(u(0, f), h), f = s.lastIndexOf(a, o + a.length), f != -1 && (h = Math.min(u(0, f), h)));
@@ -10739,25 +10740,25 @@ function ol(t, e, r) {
10739
10740
  }
10740
10741
  return h;
10741
10742
  }
10742
- function jr(t, e = 1e3) {
10743
+ function Ir(t, e = 1e3) {
10743
10744
  return t = t || "", t.length > e || t.split(`
10744
10745
  `).length > 50;
10745
10746
  }
10746
10747
  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);
10748
+ 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
10749
  return ol(t, e, { maxLines: s, contextLines: a });
10749
10750
  }
10750
- const ht = ({ path: t, color: e = "cyan", line: r }) => {
10751
- const n = Dr(t), i = r !== void 0 ? `:${r}` : "";
10752
- return /* @__PURE__ */ d.jsxs(w, { color: oe(e), children: [
10751
+ const ft = ({ path: t, color: e = "cyan", line: r }) => {
10752
+ const n = Pr(t), i = r !== void 0 ? `:${r}` : "";
10753
+ return /* @__PURE__ */ d.jsxs(w, { color: le(e), children: [
10753
10754
  n,
10754
10755
  i
10755
10756
  ] });
10756
- }, ll = de({
10757
+ }, ll = fe({
10757
10758
  name: "edit_file",
10758
10759
  description: "Performs exact string replacements in files with diff visualization",
10759
- parameters: Pn.shape,
10760
- handler: he.waitForUIDone,
10760
+ parameters: En.shape,
10761
+ handler: me.waitForUIDone,
10761
10762
  render(t) {
10762
10763
  const e = t.getInputRepaired(), r = t.output, n = e.old_string && e.new_string && e.old_string !== e.new_string;
10763
10764
  let i = 0, s = 0;
@@ -10768,7 +10769,7 @@ const ht = ({ path: t, color: e = "cyan", line: r }) => {
10768
10769
  }
10769
10770
  return /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", paddingX: 1, children: [
10770
10771
  /* @__PURE__ */ d.jsxs(_, { children: [
10771
- /* @__PURE__ */ d.jsx(ht, { path: e.file_path, color: "white" }),
10772
+ /* @__PURE__ */ d.jsx(ft, { path: e.file_path, color: "white" }),
10772
10773
  n && /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
10773
10774
  /* @__PURE__ */ d.jsx(w, { color: "gray", children: " (" }),
10774
10775
  /* @__PURE__ */ d.jsxs(w, { color: "red", children: [
@@ -10795,11 +10796,11 @@ const ht = ({ path: t, color: e = "cyan", line: r }) => {
10795
10796
  pending: "○",
10796
10797
  in_progress: "◐",
10797
10798
  completed: "✓"
10798
- }, hl = de({
10799
+ }, hl = fe({
10799
10800
  name: "TodoWrite",
10800
10801
  description: "Use this tool to create and manage a structured task list",
10801
- parameters: Dn.shape,
10802
- handler: he.waitForUIDone,
10802
+ parameters: An.shape,
10803
+ handler: me.waitForUIDone,
10803
10804
  render(t) {
10804
10805
  const e = t.getInputRepaired();
10805
10806
  if (!e || !e.todos || !Array.isArray(e.todos))
@@ -10817,18 +10818,18 @@ const ht = ({ path: t, color: e = "cyan", line: r }) => {
10817
10818
  ] }, i.id)) });
10818
10819
  return /* @__PURE__ */ d.jsx(_, { flexDirection: "column", paddingX: 0, children: /* @__PURE__ */ d.jsx(_, { flexDirection: "column", marginTop: 0, children: n() }) });
10819
10820
  }
10820
- }), fl = de({
10821
+ }), fl = fe({
10821
10822
  name: "read_file",
10822
10823
  description: "Reads a file from the local filesystem",
10823
- parameters: Rn.shape,
10824
- handler: he.waitForUIDone,
10824
+ parameters: kn.shape,
10825
+ handler: me.waitForUIDone,
10825
10826
  render(t) {
10826
10827
  const e = t.getInputRepaired(), r = t.output;
10827
10828
  if (!r) return /* @__PURE__ */ d.jsx(d.Fragment, {});
10828
10829
  const i = r.split(`
10829
10830
  `).length;
10830
10831
  return /* @__PURE__ */ d.jsx(_, { flexDirection: "column", paddingX: 1, children: /* @__PURE__ */ d.jsxs(_, { children: [
10831
- /* @__PURE__ */ d.jsx(ht, { path: e.file_path, color: "blue" }),
10832
+ /* @__PURE__ */ d.jsx(ft, { path: e.file_path, color: "blue" }),
10832
10833
  /* @__PURE__ */ d.jsxs(w, { color: "gray", dimColor: !0, children: [
10833
10834
  " ",
10834
10835
  "(",
@@ -10837,18 +10838,18 @@ const ht = ({ path: t, color: e = "cyan", line: r }) => {
10837
10838
  ] })
10838
10839
  ] }) });
10839
10840
  }
10840
- }), ml = de({
10841
+ }), ml = fe({
10841
10842
  name: "glob_files",
10842
10843
  description: "Find files by name patterns",
10843
- parameters: On.shape,
10844
- handler: he.waitForUIDone,
10844
+ parameters: Mn.shape,
10845
+ handler: me.waitForUIDone,
10845
10846
  render(t) {
10846
10847
  const e = t.getInputRepaired(), r = t.output;
10847
10848
  if (!r) return /* @__PURE__ */ d.jsx(d.Fragment, {});
10848
10849
  const i = r.split(`
10849
10850
  `).filter(Boolean).length;
10850
10851
  return /* @__PURE__ */ d.jsx(_, { flexDirection: "column", paddingX: 1, children: /* @__PURE__ */ d.jsxs(w, { children: [
10851
- /* @__PURE__ */ d.jsx(ht, { path: e.pattern, color: "blue" }),
10852
+ /* @__PURE__ */ d.jsx(ft, { path: e.pattern, color: "blue" }),
10852
10853
  /* @__PURE__ */ d.jsxs(w, { color: "gray", dimColor: !0, children: [
10853
10854
  " ",
10854
10855
  "(",
@@ -10861,17 +10862,17 @@ const ht = ({ path: t, color: e = "cyan", line: r }) => {
10861
10862
  description: D.string().optional(),
10862
10863
  file_path: D.string(),
10863
10864
  content: D.string()
10864
- }), pl = de({
10865
+ }), pl = fe({
10865
10866
  name: "write_file",
10866
10867
  description: "Writes a file to the local filesystem",
10867
10868
  parameters: gl.shape,
10868
- handler: he.waitForUIDone,
10869
+ handler: me.waitForUIDone,
10869
10870
  render(t) {
10870
10871
  const e = t.getInputRepaired(), r = t.output, n = e.content?.split(`
10871
10872
  `).length;
10872
10873
  return /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", paddingX: 1, children: [
10873
10874
  /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", children: [
10874
- /* @__PURE__ */ d.jsx(ht, { path: e.file_path, color: "white" }),
10875
+ /* @__PURE__ */ d.jsx(ft, { path: e.file_path, color: "white" }),
10875
10876
  /* @__PURE__ */ d.jsxs(w, { color: "gray", children: [
10876
10877
  " (",
10877
10878
  n,
@@ -10882,7 +10883,7 @@ const ht = ({ path: t, color: e = "cyan", line: r }) => {
10882
10883
  !r && /* @__PURE__ */ d.jsx(_, { marginTop: 0, children: /* @__PURE__ */ d.jsx(w, { color: "gray", children: "Press Enter to confirm, Ctrl+C to cancel" }) })
10883
10884
  ] });
10884
10885
  }
10885
- }), yl = Ar.schema, wl = de({
10886
+ }), yl = Ar.schema, wl = fe({
10886
10887
  name: "folder_operations",
10887
10888
  description: "Unified folder operations tool supporting create, list, delete, and existence check",
10888
10889
  parameters: yl.shape,
@@ -10916,7 +10917,7 @@ const ht = ({ path: t, color: e = "cyan", line: r }) => {
10916
10917
  args: D.record(D.string(), D.any()).describe("Command 参数,JSON 对象格式")
10917
10918
  })
10918
10919
  ).describe("要执行的 Command 列表")
10919
- }), _l = de({
10920
+ }), _l = fe({
10920
10921
  name: "batch_command",
10921
10922
  description: `批量执行多个 Command。在一个调用中并行执行多个 Command 操作。
10922
10923
 
@@ -10932,7 +10933,7 @@ const ht = ({ path: t, color: e = "cyan", line: r }) => {
10932
10933
  - 返回结果按 Command 顺序排列
10933
10934
  - 适合批量操作和并行执行独立任务`,
10934
10935
  parameters: bl.shape,
10935
- handler: he.waitForUIDone,
10936
+ handler: me.waitForUIDone,
10936
10937
  render(t) {
10937
10938
  const e = t.getInputRepaired(), r = t.output;
10938
10939
  return /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", children: [
@@ -10943,7 +10944,7 @@ const ht = ({ path: t, color: e = "cyan", line: r }) => {
10943
10944
  ] }),
10944
10945
  /* @__PURE__ */ d.jsx(w, { color: "blue", children: n.name })
10945
10946
  ] }, i)) }),
10946
- r && /* @__PURE__ */ d.jsx(dn, { content: r, maxLines: 5, borderColor: "gray" })
10947
+ r && /* @__PURE__ */ d.jsx(un, { content: r, maxLines: 5, borderColor: "gray" })
10947
10948
  ] });
10948
10949
  }
10949
10950
  }), vl = [sl, rl, ll, hl, fl, ml, pl, wl, _l], xl = ({
@@ -10954,19 +10955,19 @@ const ht = ({ path: t, color: e = "cyan", line: r }) => {
10954
10955
  placeholder: i = "输入消息...",
10955
10956
  commandHandler: s
10956
10957
  }) => {
10957
- const { bufferedMessage: a, setBufferedMessage: o, clearBuffer: l } = Nr(), [c, u] = x.useState(t);
10958
+ const { bufferedMessage: a, setBufferedMessage: o, clearBuffer: l } = Or(), [c, u] = x.useState(t);
10958
10959
  x.useEffect(() => {
10959
10960
  u(t);
10960
10961
  }, [t]);
10961
10962
  const h = x.useMemo(() => c.startsWith("/"), [c]), f = (p) => {
10962
10963
  u(p), e(p);
10963
- }, m = async () => {
10964
- if (c.trim()) {
10964
+ }, m = (p) => {
10965
+ if (p.trim()) {
10965
10966
  if (h) {
10966
- r(c), u("");
10967
+ r(p), u("");
10967
10968
  return;
10968
10969
  }
10969
- n ? (o(c), u("")) : (r(c), u(""));
10970
+ n ? (o(p), u("")) : (r(p), u(""));
10970
10971
  }
10971
10972
  }, g = () => {
10972
10973
  a ? l() : u("");
@@ -10979,7 +10980,7 @@ const ht = ({ path: t, color: e = "cyan", line: r }) => {
10979
10980
  ] }) }),
10980
10981
  /* @__PURE__ */ d.jsx(s.CommandHintUI, {}),
10981
10982
  /* @__PURE__ */ d.jsx(_, { paddingY: 1, children: /* @__PURE__ */ d.jsx(
10982
- xe,
10983
+ Se,
10983
10984
  {
10984
10985
  id: "global-input",
10985
10986
  value: c,
@@ -10991,7 +10992,7 @@ const ht = ({ path: t, color: e = "cyan", line: r }) => {
10991
10992
  ) })
10992
10993
  ] });
10993
10994
  };
10994
- function st(t) {
10995
+ function it(t) {
10995
10996
  typeof t == "string" ? qt.notify({
10996
10997
  title: t
10997
10998
  }) : qt.notify({
@@ -11009,7 +11010,7 @@ const Sl = ({ onClose: t }) => {
11009
11010
  dataSource: async () => {
11010
11011
  const s = ke(process.cwd(), ".claude/memories"), a = ke(process.env.HOME || "", ".deepagents/code/memories"), o = ke(process.cwd(), ".claude/skills"), l = ke(process.env.HOME || "", ".deepagents/code/skills");
11011
11012
  try {
11012
- const c = Nn(a, s), u = Ln(l, o);
11013
+ const c = Pn(a, s), u = Dn(l, o);
11013
11014
  return e === "memories" ? c.map((f) => ({ ...f, type: "memory" })) : u.map((f) => ({ ...f, type: "skill" }));
11014
11015
  } catch (c) {
11015
11016
  return console.warn("Failed to load knowledge:", c), [];
@@ -11048,7 +11049,7 @@ const Sl = ({ onClose: t }) => {
11048
11049
  ] }) }),
11049
11050
  /* @__PURE__ */ d.jsx(_, { paddingY: 1, children: /* @__PURE__ */ d.jsx(w, { color: o ? "white" : "gray", children: l }) }),
11050
11051
  /* @__PURE__ */ d.jsx(_, { children: /* @__PURE__ */ d.jsxs(w, { color: "cyan", dimColor: !o, children: [
11051
- Dr(s.path),
11052
+ Pr(s.path),
11052
11053
  s.category && /* @__PURE__ */ d.jsxs(w, { color: "yellow", children: [
11053
11054
  " ",
11054
11055
  s.category
@@ -11069,9 +11070,9 @@ const Sl = ({ onClose: t }) => {
11069
11070
  }
11070
11071
  }
11071
11072
  };
11072
- return /* @__PURE__ */ d.jsx(Je, { config: i, onClose: t });
11073
+ return /* @__PURE__ */ d.jsx(Qe, { config: i, onClose: t });
11073
11074
  }, Tl = ({ onClose: t }) => {
11074
- const { AVAILABLE_MODELS: e, extraParams: r, updateConfig: n } = ue(), i = {
11075
+ const { AVAILABLE_MODELS: e, extraParams: r, updateConfig: n } = he(), i = {
11075
11076
  id: "model",
11076
11077
  title: "模型选择",
11077
11078
  icon: "🤖",
@@ -11106,13 +11107,13 @@ const Sl = ({ onClose: t }) => {
11106
11107
  visibleCount: 10,
11107
11108
  renderItem: (s, a, o) => {
11108
11109
  const l = s.id === r.main_model;
11109
- return /* @__PURE__ */ d.jsxs(ot, { isSelected: o, isCurrent: l, children: [
11110
+ return /* @__PURE__ */ d.jsxs(ct, { isSelected: o, isCurrent: l, children: [
11110
11111
  /* @__PURE__ */ d.jsxs(w, { bold: !0, children: [
11111
11112
  a + 1,
11112
11113
  ". ",
11113
11114
  s.id
11114
11115
  ] }),
11115
- /* @__PURE__ */ d.jsx(it, {}),
11116
+ /* @__PURE__ */ d.jsx(at, {}),
11116
11117
  /* @__PURE__ */ d.jsx(w, { dimColor: !0, children: s.provider })
11117
11118
  ] }, s.id);
11118
11119
  },
@@ -11132,15 +11133,15 @@ const Sl = ({ onClose: t }) => {
11132
11133
  ] }) : null;
11133
11134
  }
11134
11135
  };
11135
- return /* @__PURE__ */ d.jsx(Je, { config: i, onClose: t });
11136
+ return /* @__PURE__ */ d.jsx(Qe, { config: i, onClose: t });
11136
11137
  }, Cl = ({ onClose: t }) => {
11137
- const { config: e, updateConfig: r } = ue(), n = e?.switch_command || "default", i = {
11138
+ const { config: e, updateConfig: r } = he(), n = e?.switch_command || "default", i = {
11138
11139
  id: "agent",
11139
11140
  title: "Agent 选择",
11140
11141
  icon: "🤖",
11141
11142
  // 数据源
11142
11143
  dataSource: async () => {
11143
- const s = await $n();
11144
+ const s = await Rn();
11144
11145
  return Object.values(s);
11145
11146
  },
11146
11147
  // 搜索配置
@@ -11169,13 +11170,13 @@ const Sl = ({ onClose: t }) => {
11169
11170
  // 显示 15 个 agent
11170
11171
  renderItem: (s, a, o) => {
11171
11172
  const l = s.id === n;
11172
- return /* @__PURE__ */ d.jsxs(ot, { isSelected: o, isCurrent: l, children: [
11173
+ return /* @__PURE__ */ d.jsxs(ct, { isSelected: o, isCurrent: l, children: [
11173
11174
  /* @__PURE__ */ d.jsxs(w, { bold: !0, children: [
11174
11175
  a + 1,
11175
11176
  ". ",
11176
11177
  s.id
11177
11178
  ] }),
11178
- /* @__PURE__ */ d.jsx(it, {}),
11179
+ /* @__PURE__ */ d.jsx(at, {}),
11179
11180
  /* @__PURE__ */ d.jsx(w, { dimColor: !0, children: s.description })
11180
11181
  ] }, s.id);
11181
11182
  },
@@ -11193,17 +11194,17 @@ const Sl = ({ onClose: t }) => {
11193
11194
  ] }) : null;
11194
11195
  }
11195
11196
  };
11196
- return /* @__PURE__ */ d.jsx(Je, { config: i, onClose: t });
11197
+ return /* @__PURE__ */ d.jsx(Qe, { config: i, onClose: t });
11197
11198
  }, jl = () => {
11198
11199
  const [t, e] = x.useState({
11199
11200
  isInitialized: !1,
11200
11201
  toolCount: 0,
11201
11202
  lastRefresh: null,
11202
11203
  servers: []
11203
- }), { loading: r } = ne();
11204
+ }), { loading: r } = re();
11204
11205
  return x.useEffect(() => {
11205
11206
  (async () => {
11206
- const i = await Fn.getInstance().getStatus();
11207
+ const i = await On.getInstance().getStatus();
11207
11208
  e(i);
11208
11209
  })();
11209
11210
  }, [r]), /* @__PURE__ */ d.jsx(d.Fragment, { children: t.toolCount ? /* @__PURE__ */ d.jsxs(_, { paddingX: 1, children: [
@@ -11214,10 +11215,15 @@ const Sl = ({ onClose: t }) => {
11214
11215
  ] })
11215
11216
  ] }) : /* @__PURE__ */ d.jsx(d.Fragment, {}) });
11216
11217
  }, Il = ({}) => {
11217
- const { extraParams: t, compactMode: e } = ue(), { currentChatId: r, renderMessages: n } = ne(), i = process.env.YOLO_MODE === "true", a = (n?.length || 0) > 100;
11218
+ const { extraParams: t, compactMode: e } = he(), { currentChatId: r, renderMessages: n } = re(), { loading: i } = re(), s = process.env.YOLO_MODE === "true", o = (n?.length || 0) > 100;
11218
11219
  return /* @__PURE__ */ d.jsx(_, { flexDirection: "column", width: "100%", children: /* @__PURE__ */ d.jsxs(_, { paddingX: 1, paddingY: 0, justifyContent: "space-between", width: "100%", children: [
11219
- /* @__PURE__ */ d.jsxs(_, { children: [
11220
- /* @__PURE__ */ d.jsx(w, { color: "magenta", bold: !0, children: "⚡ Zen Code" }),
11220
+ /* @__PURE__ */ d.jsxs(_, { gap: 1, children: [
11221
+ i && /* @__PURE__ */ d.jsxs(w, { color: "yellow", bold: !0, children: [
11222
+ /* @__PURE__ */ d.jsx(Un, {}),
11223
+ " ",
11224
+ "LOADING "
11225
+ ] }),
11226
+ !i && /* @__PURE__ */ d.jsx(w, { color: "magenta", bold: !0, children: "Zen Code" }),
11221
11227
  /* @__PURE__ */ d.jsxs(w, { color: "cyan", bold: !0, children: [
11222
11228
  " ",
11223
11229
  t.main_model
@@ -11227,27 +11233,24 @@ const Sl = ({ onClose: t }) => {
11227
11233
  "@",
11228
11234
  t.switch_command || "default"
11229
11235
  ] }),
11230
- e && /* @__PURE__ */ d.jsxs(w, { color: "blue", bold: !0, children: [
11236
+ !e && /* @__PURE__ */ d.jsxs(w, { color: "blue", bold: !0, children: [
11231
11237
  " ",
11232
- "[COMPACT]"
11238
+ "[FULL]"
11233
11239
  ] }),
11234
- i && /* @__PURE__ */ d.jsxs(w, { color: "red", bold: !0, children: [
11240
+ s && /* @__PURE__ */ d.jsxs(w, { color: "red", bold: !0, children: [
11235
11241
  " ",
11236
11242
  "YOLO"
11237
11243
  ] }),
11238
11244
  /* @__PURE__ */ d.jsx(jl, {}),
11239
- a && /* @__PURE__ */ d.jsxs(w, { color: "red", bold: !0, children: [
11245
+ o && /* @__PURE__ */ d.jsxs(w, { color: "red", bold: !0, children: [
11240
11246
  " ",
11241
- "💡 /summary"
11247
+ "/summary"
11242
11248
  ] }),
11243
- /* @__PURE__ */ d.jsxs(w, { color: "red", bold: !0, children: [
11244
- "💡 ",
11245
- n.length
11246
- ] })
11249
+ /* @__PURE__ */ d.jsx(w, { color: "green", bold: !0, children: n.length })
11247
11250
  ] }),
11248
11251
  /* @__PURE__ */ d.jsx(_, { children: /* @__PURE__ */ d.jsx(w, { dimColor: !0, children: r?.slice(0, 6) || "N/A" }) })
11249
11252
  ] }) });
11250
- }, Ye = {
11253
+ }, Ke = {
11251
11254
  pickup: { emoji: "📥", color: "cyan", label: "待领取" },
11252
11255
  running: { emoji: "🔄", color: "yellow", label: "运行中" },
11253
11256
  complete: { emoji: "✅", color: "green", label: "已完成" },
@@ -11262,7 +11265,7 @@ const Sl = ({ onClose: t }) => {
11262
11265
  Ft((o, l) => {
11263
11266
  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
11267
  });
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;
11268
+ const i = t.status ? Ke[t.status] : Ke.pickup, s = t.status === "pickup" || t.status === "error" || t.status === "feedback", a = t.complexity ? El[t.complexity] : null;
11266
11269
  return /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", paddingX: 1, children: [
11267
11270
  /* @__PURE__ */ d.jsxs(_, { borderStyle: "single", paddingX: 1, marginBottom: 1, children: [
11268
11271
  /* @__PURE__ */ d.jsxs(w, { bold: !0, color: "cyan", children: [
@@ -11340,7 +11343,7 @@ const Sl = ({ onClose: t }) => {
11340
11343
  "):"
11341
11344
  ] }),
11342
11345
  t.children.map((o, l) => {
11343
- const c = o.status ? Ye[o.status] : Ye.pickup;
11346
+ const c = o.status ? Ke[o.status] : Ke.pickup;
11344
11347
  return /* @__PURE__ */ d.jsx(_, { children: /* @__PURE__ */ d.jsxs(w, { color: c.color, children: [
11345
11348
  c.emoji,
11346
11349
  " ",
@@ -11369,7 +11372,7 @@ const Sl = ({ onClose: t }) => {
11369
11372
  }, Ml = ({ onClose: t, onExecuteTask: e }) => {
11370
11373
  const [r, n] = x.useState(null), [i, s] = x.useState(0), a = x.useCallback(async () => {
11371
11374
  try {
11372
- const { getTasksStore: u } = await import("./tasks-BemLKkuC.mjs"), h = u(process.cwd());
11375
+ const { getTasksStore: u } = await import("./tasks-D9VxaG3A.mjs"), h = u(process.cwd());
11373
11376
  return await h.initialize(), await h.getAllTasks();
11374
11377
  } catch (u) {
11375
11378
  return console.error("Failed to load tasks:", u), [];
@@ -11378,7 +11381,7 @@ const Sl = ({ onClose: t }) => {
11378
11381
  n(null);
11379
11382
  }, []), l = x.useCallback(async (u) => {
11380
11383
  try {
11381
- const { getTasksStore: h } = await import("./tasks-BemLKkuC.mjs"), f = h(process.cwd());
11384
+ const { getTasksStore: h } = await import("./tasks-D9VxaG3A.mjs"), f = h(process.cwd());
11382
11385
  await f.initialize(), await f.deleteTask(u.id) ? s((g) => g + 1) : console.error(`Failed to delete task: ${u.id}`);
11383
11386
  } catch (h) {
11384
11387
  console.error("Error deleting task:", h);
@@ -11428,7 +11431,7 @@ const Sl = ({ onClose: t }) => {
11428
11431
  visibleCount: 10,
11429
11432
  renderItem: (u, h, f) => {
11430
11433
  const m = u.status ? At[u.status] : At.pickup, g = u.complexity ? kl[u.complexity] : null;
11431
- return /* @__PURE__ */ d.jsx(ot, { isSelected: f, children: /* @__PURE__ */ d.jsxs(_, { children: [
11434
+ return /* @__PURE__ */ d.jsx(ct, { isSelected: f, children: /* @__PURE__ */ d.jsxs(_, { children: [
11432
11435
  /* @__PURE__ */ d.jsxs(w, { color: "cyan", dimColor: m === At.complete, children: [
11433
11436
  m.emoji,
11434
11437
  " ",
@@ -11436,7 +11439,7 @@ const Sl = ({ onClose: t }) => {
11436
11439
  ". ",
11437
11440
  u.title
11438
11441
  ] }),
11439
- /* @__PURE__ */ d.jsx(it, {}),
11442
+ /* @__PURE__ */ d.jsx(at, {}),
11440
11443
  /* @__PURE__ */ d.jsx(w, { color: "yellow", dimColor: !0, children: m.label }),
11441
11444
  g && /* @__PURE__ */ d.jsxs(w, { dimColor: !0, children: [
11442
11445
  g.emoji,
@@ -11476,7 +11479,7 @@ const Sl = ({ onClose: t }) => {
11476
11479
  onExecuteTask: e,
11477
11480
  onDelete: l
11478
11481
  }
11479
- ) : /* @__PURE__ */ d.jsx(Je, { config: c, onClose: t }) });
11482
+ ) : /* @__PURE__ */ d.jsx(Qe, { config: c, onClose: t }) });
11480
11483
  };
11481
11484
  function Pl({
11482
11485
  loading: t,
@@ -11506,8 +11509,8 @@ function Pl({
11506
11509
  const h = e.length;
11507
11510
  if (h > l.current) {
11508
11511
  l.current = h;
11509
- const f = e[h - 1], m = Zt(f);
11510
- typeof m == "string" && m.includes("<COMPLETE></COMPLETE>") ? (o.current = !1, a(null), st("Ralph 循环完成")) : c(s);
11512
+ const f = e[h - 1], m = Jt(f);
11513
+ typeof m == "string" && m.includes("<COMPLETE></COMPLETE>") ? (o.current = !1, a(null), it("Ralph 循环完成")) : c(s);
11511
11514
  }
11512
11515
  }
11513
11516
  }, [t, e, s, c]), {
@@ -11517,7 +11520,7 @@ function Pl({
11517
11520
  };
11518
11521
  }
11519
11522
  const Dl = () => {
11520
- const { renderMessages: t, loading: e, inChatError: r, isFELocking: n } = ne(), { compactMode: i } = ue(), s = t;
11523
+ const { renderMessages: t, loading: e, inChatError: r, isFELocking: n } = re(), { compactMode: i } = he(), s = t;
11521
11524
  return /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", flexGrow: 1, paddingX: 0, paddingY: 0, children: [
11522
11525
  s.length === 0 && /* @__PURE__ */ d.jsx(zc, {}),
11523
11526
  i ? /* @__PURE__ */ d.jsx(
@@ -11533,11 +11536,6 @@ const Dl = () => {
11533
11536
  startIndex: 0
11534
11537
  }
11535
11538
  ),
11536
- e && !n() && /* @__PURE__ */ d.jsx(_, { marginTop: 1, paddingLeft: 1, children: /* @__PURE__ */ d.jsxs(w, { children: [
11537
- /* @__PURE__ */ d.jsx(pn, { type: "dots" }),
11538
- " ",
11539
- /* @__PURE__ */ d.jsx(Ir, { text: "正在思考中... Ctrl + C 中断" })
11540
- ] }) }),
11541
11539
  r && /* @__PURE__ */ d.jsx(_, { marginTop: 0, paddingLeft: 1, children: /* @__PURE__ */ d.jsxs(w, { color: "red", children: [
11542
11540
  "❌ ",
11543
11541
  JSON.stringify(r)
@@ -11551,7 +11549,7 @@ const Dl = () => {
11551
11549
  switchToTask: i,
11552
11550
  closePanel: s
11553
11551
  }) => {
11554
- const { userInput: a, setUserInput: o, sendMessage: l, loading: c, renderMessages: u } = ne(), { extraParams: h } = ue(), { startRalphLoop: f, sendTextMessage: m } = Pl({
11552
+ const { userInput: a, setUserInput: o, sendMessage: l, loading: c, renderMessages: u } = re(), { extraParams: h } = he(), { startRalphLoop: f, sendTextMessage: m } = Pl({
11555
11553
  loading: c,
11556
11554
  renderMessages: u,
11557
11555
  sendMessage: l,
@@ -11568,12 +11566,12 @@ const Dl = () => {
11568
11566
  startRalphLoop: f
11569
11567
  }), p = async (y) => {
11570
11568
  if (y) {
11571
- if (y.startsWith("/") && (o(y), await new Promise((v) => setTimeout(v, 0)), await g.executeCommand())) {
11569
+ if (y.startsWith("/") && await g.executeCommand(y)) {
11572
11570
  o("");
11573
11571
  return;
11574
11572
  }
11575
11573
  m(y).then(() => {
11576
- st("Zen Code 完成任务");
11574
+ it("Zen Code 完成任务");
11577
11575
  });
11578
11576
  }
11579
11577
  };
@@ -11592,6 +11590,7 @@ const Dl = () => {
11592
11590
  children: [
11593
11591
  /* @__PURE__ */ d.jsx(g.CommandErrorUI, {}),
11594
11592
  /* @__PURE__ */ d.jsx(g.CommandSuccessUI, {}),
11593
+ /* @__PURE__ */ d.jsx(w, { children: JSON.stringify(a) }),
11595
11594
  /* @__PURE__ */ d.jsx(
11596
11595
  xl,
11597
11596
  {
@@ -11599,7 +11598,6 @@ const Dl = () => {
11599
11598
  onChange: o,
11600
11599
  onSubmit: p,
11601
11600
  loading: c,
11602
- placeholder: "输入消息...",
11603
11601
  commandHandler: g
11604
11602
  }
11605
11603
  )
@@ -11607,7 +11605,7 @@ const Dl = () => {
11607
11605
  }
11608
11606
  );
11609
11607
  }, Ol = () => {
11610
- const { extraParams: t, toggleCompactMode: e } = ue(), { setTools: r, createNewChat: n, loading: i, stopGeneration: s, currentChatId: a, sendMessage: o, renderMessages: l } = ne(), { bufferedMessage: c, clearBuffer: u } = Nr();
11608
+ const { extraParams: t, toggleCompactMode: e } = he(), { setTools: r, createNewChat: n, loading: i, stopGeneration: s, currentChatId: a, sendMessage: o, renderMessages: l } = re(), { bufferedMessage: c, clearBuffer: u } = Or();
11611
11609
  x.useEffect(() => {
11612
11610
  console.clear(), r(vl);
11613
11611
  }, []), x.useEffect(() => {
@@ -11619,12 +11617,12 @@ const Dl = () => {
11619
11617
  ], {
11620
11618
  extraParams: t
11621
11619
  }).then(() => {
11622
- st("Zen Code 完成任务");
11620
+ it("Zen Code 完成任务");
11623
11621
  }), u());
11624
11622
  }, [i, c, o, t, u]), x.useEffect(() => {
11625
11623
  !i && h.focus("global-input");
11626
11624
  }, [i]);
11627
- const h = Mr(), [f, m] = x.useState("chat");
11625
+ const h = zt(), [f, m] = x.useState("chat");
11628
11626
  Ft(
11629
11627
  (I, k) => {
11630
11628
  k.ctrl && I === "c" ? i ? s() : process.exit() : k.ctrl && I === "o" && f === "chat" && !i && e();
@@ -11661,16 +11659,16 @@ ${I.dependencies.map((R) => `- ${R}`).join(`
11661
11659
  `)}
11662
11660
 
11663
11661
  `), I.acceptanceCriteria && I.acceptanceCriteria.length > 0 && (k += `**验收标准:**
11664
- ${I.acceptanceCriteria.map((R, z) => `${z + 1}. ${R}`).join(`
11662
+ ${I.acceptanceCriteria.map((R, B) => `${B + 1}. ${R}`).join(`
11665
11663
  `)}
11666
11664
 
11667
11665
  `), I.children && I.children.length > 0 && (k += `**子任务:**
11668
- `, I.children.forEach((R, z) => {
11666
+ `, I.children.forEach((R, B) => {
11669
11667
  k += `
11670
- ### 子任务 ${z + 1}: ${R.title}
11668
+ ### 子任务 ${B + 1}: ${R.title}
11671
11669
  `, k += `${R.description}
11672
11670
  `, R.acceptanceCriteria && R.acceptanceCriteria.length > 0 && (k += `验收标准:
11673
- ${R.acceptanceCriteria.map((H) => `- ${H}`).join(`
11671
+ ${R.acceptanceCriteria.map((z) => `- ${z}`).join(`
11674
11672
  `)}
11675
11673
  `);
11676
11674
  }), k += `
@@ -11692,12 +11690,12 @@ ${R.acceptanceCriteria.map((H) => `- ${H}`).join(`
11692
11690
  is_in_task: !0
11693
11691
  }
11694
11692
  }).then(() => {
11695
- st("任务已发送给 Agent");
11693
+ it("任务已发送给 Agent");
11696
11694
  });
11697
11695
  }), S();
11698
11696
  },
11699
11697
  [o, t, S]
11700
- ), { hasPendingInteractions: A } = at();
11698
+ ), { hasPendingInteractions: A } = ot();
11701
11699
  return /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", width: "100%", children: [
11702
11700
  /* @__PURE__ */ d.jsxs(_, { flexGrow: 1, flexDirection: "row", children: [
11703
11701
  f === "chat" && /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", flexGrow: 1, children: [
@@ -11736,10 +11734,10 @@ ${R.acceptanceCriteria.map((H) => `- ${H}`).join(`
11736
11734
  },
11737
11735
  fetch: Bc,
11738
11736
  autoRestoreLastSession: !0,
11739
- children: /* @__PURE__ */ d.jsx(Xn, { children: /* @__PURE__ */ d.jsx(es, { get_allowed_models: gn, manager: kt, children: /* @__PURE__ */ d.jsx(Kn, { children: /* @__PURE__ */ d.jsx(ts, { children: /* @__PURE__ */ d.jsx(Ol, {}) }) }) }) })
11737
+ children: /* @__PURE__ */ d.jsx(Xn, { children: /* @__PURE__ */ d.jsx(es, { get_allowed_models: Bn, manager: kt, children: /* @__PURE__ */ d.jsx(Kn, { children: /* @__PURE__ */ d.jsx(ts, { children: /* @__PURE__ */ d.jsx(Ol, {}) }) }) }) })
11740
11738
  }
11741
11739
  ), Ll = () => /* @__PURE__ */ d.jsx(Nl, {});
11742
- fn(/* @__PURE__ */ d.jsx(Ll, {}));
11740
+ hn(/* @__PURE__ */ d.jsx(Ll, {}));
11743
11741
  export {
11744
11742
  Bo as B,
11745
11743
  ic as C,