zen-code 3.0.1 → 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.
- package/dist/{app-BENrPmmM.mjs → app-DRVd6cDQ.mjs} +596 -598
- package/dist/{checkpoint-1sAx_j1E-DqcSZLfo.mjs → checkpoint-1sAx_j1E-DNrygV7Q.mjs} +1 -1
- package/dist/{checkpoint-DxiUsHMy-BfuW8IQl.mjs → checkpoint-DxiUsHMy-DHFvv2Vn.mjs} +1 -1
- package/dist/get_allowed_models-tD7oPVgc.mjs +774 -0
- package/dist/{index-BZ3paLuT.mjs → index-betxkqLW.mjs} +1 -1
- package/dist/{queue-D6tEGCGs-C_LiNO7O.mjs → queue-D6tEGCGs-DyRh7Gp2.mjs} +1 -1
- package/dist/{shallow-EW7Q1ZFs.mjs → shallow-in1-XXeE.mjs} +1 -1
- package/dist/zen-code.mjs +1 -1
- package/dist/zen-init.mjs +1 -1
- package/package.json +1 -1
- package/dist/get_allowed_models-CHQu5hlT.mjs +0 -651
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { a as x, R as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
|
|
8
|
-
import { parse as
|
|
9
|
-
import
|
|
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
12
|
import Yt, { join as ke } from "node:path";
|
|
@@ -16,7 +16,7 @@ import "yaml";
|
|
|
16
16
|
import { Command as Zn, Send as Jn } from "@langchain/langgraph";
|
|
17
17
|
import "langchain";
|
|
18
18
|
import qt from "node-notifier";
|
|
19
|
-
function
|
|
19
|
+
function kr(t) {
|
|
20
20
|
const { items: e, children: r, style: n } = t, [i, s] = x.useState(0), a = x.useMemo(() => e.slice(i), [e, i]);
|
|
21
21
|
x.useLayoutEffect(() => {
|
|
22
22
|
s(e.length);
|
|
@@ -26,13 +26,13 @@ function Mr(t) {
|
|
|
26
26
|
flexDirection: "column",
|
|
27
27
|
...n
|
|
28
28
|
}), [n]);
|
|
29
|
-
return
|
|
29
|
+
return xe.createElement("ink-box", { internal_static: !0, style: l }, o);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
31
|
+
function at() {
|
|
32
|
+
return xe.createElement(_, { flexGrow: 1 });
|
|
33
33
|
}
|
|
34
34
|
const zt = () => {
|
|
35
|
-
const t = x.useContext(
|
|
35
|
+
const t = x.useContext(dn);
|
|
36
36
|
return {
|
|
37
37
|
enableFocus: t.enableFocus,
|
|
38
38
|
disableFocus: t.disableFocus,
|
|
@@ -58,8 +58,8 @@ function Qn() {
|
|
|
58
58
|
};
|
|
59
59
|
}, []), t;
|
|
60
60
|
}
|
|
61
|
-
var
|
|
62
|
-
function
|
|
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
|
|
@@ -233,15 +233,15 @@ process.env.TERM_PROGRAM === "iTerm.app", Yn = () => process.env.TERM_PROGRAM ==
|
|
|
233
233
|
fallback: "blue"
|
|
234
234
|
/* BLUE */
|
|
235
235
|
}
|
|
236
|
-
},
|
|
237
|
-
function
|
|
236
|
+
}, le = (t) => (t in gt || (t = "sky"), Vn() ? gt[t].hex : gt[t].fallback);
|
|
237
|
+
function Dr() {
|
|
238
238
|
try {
|
|
239
|
-
return
|
|
239
|
+
return fn.userInfo().username;
|
|
240
240
|
} catch {
|
|
241
241
|
return process.env.USER || process.env.USERNAME || "User";
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
var
|
|
244
|
+
var ce = /* @__PURE__ */ ((t) => (t.Pending = "pending", t.Approved = "approved", t.Edited = "edited", t.Rejected = "rejected", t))(ce || {});
|
|
245
245
|
const qn = x.createContext(null), Kn = ({
|
|
246
246
|
children: t
|
|
247
247
|
}) => {
|
|
@@ -250,9 +250,9 @@ const qn = x.createContext(null), Kn = ({
|
|
|
250
250
|
if (!b)
|
|
251
251
|
return;
|
|
252
252
|
const { status: v, editedArgs: S } = y;
|
|
253
|
-
if (v ===
|
|
253
|
+
if (v === ce.Approved)
|
|
254
254
|
b.sendResumeData({ type: "approve" });
|
|
255
|
-
else if (v ===
|
|
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 qn = x.createContext(null), Kn = ({
|
|
|
261
261
|
type: "edit",
|
|
262
262
|
edited_action: C
|
|
263
263
|
});
|
|
264
|
-
} else v ===
|
|
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 qn = x.createContext(null), Kn = ({
|
|
|
269
269
|
const b = {
|
|
270
270
|
...y,
|
|
271
271
|
id: a(),
|
|
272
|
-
status:
|
|
272
|
+
status: ce.Pending,
|
|
273
273
|
createdAt: /* @__PURE__ */ new Date()
|
|
274
274
|
};
|
|
275
275
|
return r((v) => {
|
|
@@ -287,12 +287,12 @@ const qn = x.createContext(null), Kn = ({
|
|
|
287
287
|
});
|
|
288
288
|
}, [n]), u = x.useCallback(() => {
|
|
289
289
|
r((y) => {
|
|
290
|
-
const b = y.filter((v) => v.status ===
|
|
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 ===
|
|
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 qn = 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 ===
|
|
309
|
+
() => e.some((y) => y.status === ce.Pending),
|
|
310
310
|
[e]
|
|
311
311
|
), g = x.useMemo(
|
|
312
312
|
() => e.length > 0 && !m,
|
|
@@ -330,7 +330,7 @@ const qn = x.createContext(null), Kn = ({
|
|
|
330
330
|
[e, o, l, c, u, f, h, m, g]
|
|
331
331
|
);
|
|
332
332
|
return /* @__PURE__ */ d.jsx(qn.Provider, { value: p, children: t });
|
|
333
|
-
},
|
|
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 qn = x.createContext(null), Kn = ({
|
|
|
338
338
|
setBufferedMessage: r,
|
|
339
339
|
clearBuffer: n
|
|
340
340
|
};
|
|
341
|
-
return /* @__PURE__ */ d.jsx(
|
|
342
|
-
},
|
|
343
|
-
const t = x.useContext(
|
|
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
|
-
},
|
|
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 qn = x.createContext(null), Kn = ({
|
|
|
372
372
|
const p = await t.getConfig();
|
|
373
373
|
i(p);
|
|
374
374
|
};
|
|
375
|
-
return s ? null : /* @__PURE__ */ d.jsx(
|
|
376
|
-
},
|
|
377
|
-
const t = x.useContext(
|
|
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
|
-
},
|
|
382
|
-
const t = x.useContext(
|
|
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 qn = 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:
|
|
393
|
+
category: Mr.PANEL,
|
|
394
394
|
state: "idle",
|
|
395
395
|
metadata: {
|
|
396
396
|
title: j?.metadata?.title,
|
|
@@ -488,11 +488,11 @@ const qn = x.createContext(null), Kn = ({
|
|
|
488
488
|
v
|
|
489
489
|
]
|
|
490
490
|
);
|
|
491
|
-
return /* @__PURE__ */ d.jsx(
|
|
492
|
-
},
|
|
493
|
-
const r =
|
|
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:
|
|
495
|
+
/* @__PURE__ */ d.jsx(_, { children: /* @__PURE__ */ d.jsxs(w, { color: le("amber"), children: [
|
|
496
496
|
e,
|
|
497
497
|
" ",
|
|
498
498
|
r
|
|
@@ -611,7 +611,7 @@ function rs() {
|
|
|
611
611
|
})(pt)), pt.exports;
|
|
612
612
|
}
|
|
613
613
|
var ns = rs();
|
|
614
|
-
const Ht = /* @__PURE__ */
|
|
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 Ht = /* @__PURE__ */ wn(ns), ss = /* @__PURE__ */ Symbol("Let zodToJsonSch
|
|
|
654
654
|
}
|
|
655
655
|
]))
|
|
656
656
|
};
|
|
657
|
-
},
|
|
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
|
|
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" ?
|
|
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 =
|
|
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 &&
|
|
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 ?
|
|
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 ?
|
|
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
|
-
|
|
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
|
|
711
|
-
return
|
|
710
|
+
function Ur(t, e) {
|
|
711
|
+
return U(t.type._def, e);
|
|
712
712
|
}
|
|
713
|
-
const ds = (t, e) =>
|
|
714
|
-
function
|
|
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) =>
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
...
|
|
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" ?
|
|
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
|
-
|
|
786
|
+
U(t.left._def, {
|
|
787
787
|
...e,
|
|
788
788
|
currentPath: [...e.currentPath, "allOf", "0"]
|
|
789
789
|
}),
|
|
790
|
-
|
|
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
|
|
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]:
|
|
833
|
+
[i]: U(t.valueType._def, {
|
|
834
834
|
...e,
|
|
835
835
|
currentPath: [...e.currentPath, "properties", i]
|
|
836
|
-
}) ??
|
|
836
|
+
}) ?? X(e)
|
|
837
837
|
}), {}),
|
|
838
838
|
additionalProperties: e.rejectedAdditionalProperties
|
|
839
839
|
};
|
|
840
840
|
const r = {
|
|
841
841
|
type: "object",
|
|
842
|
-
additionalProperties:
|
|
842
|
+
additionalProperties: U(t.valueType._def, {
|
|
843
843
|
...e,
|
|
844
844
|
currentPath: [...e.currentPath, "additionalProperties"]
|
|
845
845
|
}) ?? e.allowedAdditionalProperties
|
|
@@ -847,7 +847,7 @@ function Hr(t, e) {
|
|
|
847
847
|
if (e.target === "openApi3")
|
|
848
848
|
return r;
|
|
849
849
|
if (t.keyType?._def.typeName === O.ZodString && t.keyType._def.checks?.length) {
|
|
850
|
-
const { type: n, ...i } =
|
|
850
|
+
const { type: n, ...i } = Er(t.keyType._def, e);
|
|
851
851
|
return {
|
|
852
852
|
...r,
|
|
853
853
|
propertyNames: i
|
|
@@ -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 } =
|
|
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
|
|
876
|
-
const r =
|
|
875
|
+
return zr(t, e);
|
|
876
|
+
const r = U(t.keyType._def, {
|
|
877
877
|
...e,
|
|
878
878
|
currentPath: [...e.currentPath, "items", "items", "0"]
|
|
879
|
-
}) ||
|
|
879
|
+
}) || X(e), n = U(t.valueType._def, {
|
|
880
880
|
...e,
|
|
881
881
|
currentPath: [...e.currentPath, "items", "items", "1"]
|
|
882
|
-
}) ||
|
|
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:
|
|
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
|
|
917
|
+
const rt = {
|
|
918
918
|
ZodString: "string",
|
|
919
919
|
ZodNumber: "number",
|
|
920
920
|
ZodBigInt: "integer",
|
|
@@ -925,9 +925,9 @@ function Ss(t, e) {
|
|
|
925
925
|
if (e.target === "openApi3")
|
|
926
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
|
|
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 =
|
|
930
|
+
const a = rt[s._def.typeName];
|
|
931
931
|
return a && !i.includes(a) ? [...i, a] : i;
|
|
932
932
|
}, []);
|
|
933
933
|
return {
|
|
@@ -968,7 +968,7 @@ function Ss(t, e) {
|
|
|
968
968
|
return Xt(t, e);
|
|
969
969
|
}
|
|
970
970
|
const Xt = (t, e) => {
|
|
971
|
-
const r = (t.options instanceof Map ? Array.from(t.options.values()) : t.options).map((n, i) =>
|
|
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 Xt = (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:
|
|
980
|
+
type: rt[t.innerType._def.typeName],
|
|
981
981
|
nullable: !0
|
|
982
982
|
} : {
|
|
983
983
|
type: [
|
|
984
|
-
|
|
984
|
+
rt[t.innerType._def.typeName],
|
|
985
985
|
"null"
|
|
986
986
|
]
|
|
987
987
|
};
|
|
988
988
|
if (e.target === "openApi3") {
|
|
989
|
-
const n =
|
|
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 =
|
|
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",
|
|
1010
|
+
r.type = "integer", gn(r, "type", n.message, e);
|
|
1011
1011
|
break;
|
|
1012
1012
|
case "min":
|
|
1013
|
-
e.target === "jsonSchema7" ? n.inclusive ?
|
|
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 ?
|
|
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
|
-
|
|
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 =
|
|
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
|
|
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
|
|
1071
|
-
const r =
|
|
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:
|
|
1078
|
+
not: X(e)
|
|
1079
1079
|
},
|
|
1080
1080
|
r
|
|
1081
1081
|
]
|
|
1082
|
-
} :
|
|
1082
|
+
} : X(e);
|
|
1083
1083
|
}, ks = (t, e) => {
|
|
1084
1084
|
if (e.pipeStrategy === "input")
|
|
1085
|
-
return
|
|
1085
|
+
return U(t.in._def, e);
|
|
1086
1086
|
if (e.pipeStrategy === "output")
|
|
1087
|
-
return
|
|
1088
|
-
const r =
|
|
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 =
|
|
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
|
|
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:
|
|
1106
|
+
items: U(t.valueType._def, {
|
|
1107
1107
|
...e,
|
|
1108
1108
|
currentPath: [...e.currentPath, "items"]
|
|
1109
1109
|
})
|
|
1110
1110
|
};
|
|
1111
|
-
return t.minSize &&
|
|
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) =>
|
|
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:
|
|
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) =>
|
|
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,16 +1134,16 @@ function Ds(t, e) {
|
|
|
1134
1134
|
}
|
|
1135
1135
|
function Rs(t) {
|
|
1136
1136
|
return {
|
|
1137
|
-
not:
|
|
1137
|
+
not: X(t)
|
|
1138
1138
|
};
|
|
1139
1139
|
}
|
|
1140
1140
|
function Os(t) {
|
|
1141
|
-
return
|
|
1141
|
+
return X(t);
|
|
1142
1142
|
}
|
|
1143
|
-
const Ns = (t, e) =>
|
|
1143
|
+
const Ns = (t, e) => U(t.innerType._def, e), Ls = (t, e, r) => {
|
|
1144
1144
|
switch (e) {
|
|
1145
1145
|
case O.ZodString:
|
|
1146
|
-
return
|
|
1146
|
+
return Er(t, r);
|
|
1147
1147
|
case O.ZodNumber:
|
|
1148
1148
|
return Cs(t, r);
|
|
1149
1149
|
case O.ZodObject:
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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" ?
|
|
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:
|
|
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`),
|
|
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 =
|
|
1252
|
+
const i = e?.name, s = U(
|
|
1253
1253
|
t._def,
|
|
1254
1254
|
r,
|
|
1255
1255
|
!1
|
|
1256
|
-
) ??
|
|
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
|
-
},
|
|
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
|
|
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
|
|
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"),
|
|
1442
|
-
const
|
|
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 =
|
|
1452
|
-
|
|
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 = !
|
|
1458
|
+
let s = !se.length;
|
|
1459
1459
|
for (let a of e)
|
|
1460
|
-
|
|
1460
|
+
se.push(a, r.value, n, i);
|
|
1461
1461
|
if (s) {
|
|
1462
|
-
for (
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
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
|
-
|
|
1468
|
+
se.length = 0;
|
|
1469
1469
|
}
|
|
1470
1470
|
},
|
|
1471
1471
|
/* It will be called on last listener unsubscribing.
|
|
@@ -1543,17 +1543,17 @@ class Ee extends Error {
|
|
|
1543
1543
|
super(`${e} at position ${r}`), this.position = r;
|
|
1544
1544
|
}
|
|
1545
1545
|
}
|
|
1546
|
-
const
|
|
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
|
|
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
|
|
1556
|
+
function Ye(t) {
|
|
1557
1557
|
return `,:[]/{}()
|
|
1558
1558
|
+`.includes(t);
|
|
1559
1559
|
}
|
|
@@ -1569,29 +1569,29 @@ function sr(t) {
|
|
|
1569
1569
|
+`.includes(t);
|
|
1570
1570
|
}
|
|
1571
1571
|
function ir(t) {
|
|
1572
|
-
return
|
|
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
|
|
1579
|
+
function _e(t, e) {
|
|
1580
1580
|
const r = t.charCodeAt(e);
|
|
1581
|
-
return r ===
|
|
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 ===
|
|
1585
|
+
return r === Gr || r === Wr || r === Zr;
|
|
1586
1586
|
}
|
|
1587
1587
|
function ii(t, e) {
|
|
1588
1588
|
const r = t.charCodeAt(e);
|
|
1589
1589
|
return r === Qs || r >= Vs && r <= Ys || r === qs || r === Ks || r === Xs;
|
|
1590
1590
|
}
|
|
1591
|
-
function
|
|
1592
|
-
return
|
|
1591
|
+
function Xe(t) {
|
|
1592
|
+
return Jr(t) || Mt(t);
|
|
1593
1593
|
}
|
|
1594
|
-
function
|
|
1594
|
+
function Jr(t) {
|
|
1595
1595
|
return t === '"' || t === "“" || t === "”";
|
|
1596
1596
|
}
|
|
1597
1597
|
function ar(t) {
|
|
@@ -1603,16 +1603,16 @@ function Mt(t) {
|
|
|
1603
1603
|
function or(t) {
|
|
1604
1604
|
return t === "'";
|
|
1605
1605
|
}
|
|
1606
|
-
function
|
|
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
|
|
1611
|
+
function ie(t, e) {
|
|
1612
1612
|
let r = t.length;
|
|
1613
|
-
if (!
|
|
1613
|
+
if (!_e(t, r - 1))
|
|
1614
1614
|
return t + e;
|
|
1615
|
-
for (;
|
|
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() ||
|
|
1645
|
+
c(["```", "[```", "{```"]), s() || J(), c(["```", "```]", "```}"]);
|
|
1646
1646
|
const i = h(",");
|
|
1647
|
-
for (i && a(), ir(t[e]) && oi(r) ? (i || (r =
|
|
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
|
-
|
|
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 ?
|
|
1667
|
+
const L = P ? _e : si;
|
|
1668
1668
|
let F = "";
|
|
1669
1669
|
for (; ; )
|
|
1670
1670
|
if (L(t, e))
|
|
@@ -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 =
|
|
1729
|
-
t[e] === "}" || t[e] === "{" || t[e] === "]" || t[e] === "[" || t[e] === void 0 ? r =
|
|
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(":"),
|
|
1734
|
-
Ce || (ir(t[e]) ||
|
|
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 =
|
|
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 =
|
|
1746
|
-
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 =
|
|
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 =
|
|
1757
|
-
L || (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),
|
|
1764
|
-
const Ce = ar(t[e]) ? ar : or(t[e]) ? or : Mt(t[e]) ? Mt :
|
|
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 &&
|
|
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 =
|
|
1772
|
+
return M = ie(M, '"'), r += M, !0;
|
|
1773
1773
|
if (Ce(t[e])) {
|
|
1774
|
-
const N = e,
|
|
1775
|
-
if (M += '"', e++, r += M, a(!1), P || e >= t.length ||
|
|
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),
|
|
1778
|
-
if (
|
|
1779
|
-
return e =
|
|
1780
|
-
if (
|
|
1781
|
-
return e =
|
|
1782
|
-
r = r.substring(0, E), e = N + 1, M = `${M.substring(0,
|
|
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
1783
|
} else if (P && sr(t[e])) {
|
|
1784
|
-
if (t[e - 1] === ":" && rr.test(t.substring(
|
|
1784
|
+
if (t[e - 1] === ":" && rr.test(t.substring(oe + 1, e + 2)))
|
|
1785
1785
|
for (; e < t.length && nr.test(t[e]); )
|
|
1786
1786
|
M += t[e], e++;
|
|
1787
|
-
return M =
|
|
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 :
|
|
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 =
|
|
1811
|
+
P = !0, e++, a(), r = Fe(r, '"', !0);
|
|
1812
1812
|
const L = r.length;
|
|
1813
|
-
v() ? r = ai(r, L, 1) : 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++,
|
|
1821
|
-
return
|
|
1822
|
-
if (!
|
|
1820
|
+
if (e++, B())
|
|
1821
|
+
return z(P), !0;
|
|
1822
|
+
if (!we(t[e]))
|
|
1823
1823
|
return e = P, !1;
|
|
1824
1824
|
}
|
|
1825
|
-
for (;
|
|
1825
|
+
for (; we(t[e]); )
|
|
1826
1826
|
e++;
|
|
1827
1827
|
if (t[e] === ".") {
|
|
1828
|
-
if (e++,
|
|
1829
|
-
return
|
|
1830
|
-
if (!
|
|
1828
|
+
if (e++, B())
|
|
1829
|
+
return z(P), !0;
|
|
1830
|
+
if (!we(t[e]))
|
|
1831
1831
|
return e = P, !1;
|
|
1832
|
-
for (;
|
|
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++,
|
|
1837
|
-
return
|
|
1838
|
-
if (!
|
|
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 (;
|
|
1840
|
+
for (; we(t[e]); )
|
|
1841
1841
|
e++;
|
|
1842
1842
|
}
|
|
1843
|
-
if (!
|
|
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);
|
|
@@ -1861,18 +1861,18 @@ ${r}
|
|
|
1861
1861
|
for (; e < t.length && tr(t[e]); )
|
|
1862
1862
|
e++;
|
|
1863
1863
|
let F = e;
|
|
1864
|
-
for (;
|
|
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 && !sr(t[e]) && !
|
|
1869
|
+
for (; e < t.length && !sr(t[e]) && !Xe(t[e]) && (!P || t[e] !== ":"); )
|
|
1870
1870
|
e++;
|
|
1871
1871
|
if (t[e - 1] === ":" && rr.test(t.substring(L, e + 2)))
|
|
1872
1872
|
for (; e < t.length && nr.test(t[e]); )
|
|
1873
1873
|
e++;
|
|
1874
1874
|
if (e > L) {
|
|
1875
|
-
for (;
|
|
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 &&
|
|
1891
|
+
for (; L > 0 && _e(t, L); )
|
|
1892
1892
|
L--;
|
|
1893
1893
|
return L;
|
|
1894
1894
|
}
|
|
1895
|
-
function
|
|
1896
|
-
return e >= t.length ||
|
|
1895
|
+
function B() {
|
|
1896
|
+
return e >= t.length || Ye(t[e]) || _e(t, e);
|
|
1897
1897
|
}
|
|
1898
|
-
function
|
|
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
|
|
1904
|
+
function H() {
|
|
1905
1905
|
throw new Ee(`Unexpected character ${JSON.stringify(t[e])}`, e);
|
|
1906
1906
|
}
|
|
1907
|
-
function
|
|
1907
|
+
function J() {
|
|
1908
1908
|
throw new Ee("Unexpected end of json string", t.length);
|
|
1909
1909
|
}
|
|
1910
|
-
function
|
|
1910
|
+
function ee() {
|
|
1911
1911
|
throw new Ee("Object key expected", e);
|
|
1912
1912
|
}
|
|
1913
|
-
function
|
|
1913
|
+
function q() {
|
|
1914
1914
|
throw new Ee("Colon expected", e);
|
|
1915
1915
|
}
|
|
1916
|
-
function
|
|
1916
|
+
function Le() {
|
|
1917
1917
|
const P = t.slice(e, e + 6);
|
|
1918
1918
|
throw new Ee(`Invalid unicode character "${P}"`, e);
|
|
1919
1919
|
}
|
|
@@ -1928,7 +1928,7 @@ class Gt {
|
|
|
1928
1928
|
this.message = e, this.client = r;
|
|
1929
1929
|
}
|
|
1930
1930
|
getToolActionRequestID() {
|
|
1931
|
-
return
|
|
1931
|
+
return Hr({
|
|
1932
1932
|
name: this.message.name,
|
|
1933
1933
|
args: this.getInputRepaired()
|
|
1934
1934
|
});
|
|
@@ -1972,7 +1972,7 @@ class Gt {
|
|
|
1972
1972
|
}
|
|
1973
1973
|
}
|
|
1974
1974
|
get output() {
|
|
1975
|
-
return
|
|
1975
|
+
return Vr(this.message.content);
|
|
1976
1976
|
}
|
|
1977
1977
|
getJSONOutput() {
|
|
1978
1978
|
return JSON.parse(this.output);
|
|
@@ -2031,7 +2031,7 @@ function bi(t) {
|
|
|
2031
2031
|
} else if (t !== void 0)
|
|
2032
2032
|
throw new TypeError("Expected `retries` to be a number or Infinity.");
|
|
2033
2033
|
}
|
|
2034
|
-
function
|
|
2034
|
+
function qe(t, e, { min: r = 0, allowInfinity: n = !1 } = {}) {
|
|
2035
2035
|
if (e !== void 0) {
|
|
2036
2036
|
if (typeof e != "number" || Number.isNaN(e))
|
|
2037
2037
|
throw new TypeError(`Expected \`${t}\` to be a number${n ? " or Infinity" : ""}.`);
|
|
@@ -2092,7 +2092,7 @@ async function Si(t, e = {}) {
|
|
|
2092
2092
|
if (e = { ...e }, bi(e.retries), Object.hasOwn(e, "forever"))
|
|
2093
2093
|
throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");
|
|
2094
2094
|
e.retries ??= 10, e.factor ??= 2, e.minTimeout ??= 1e3, e.maxTimeout ??= Number.POSITIVE_INFINITY, e.maxRetryTime ??= Number.POSITIVE_INFINITY, e.randomize ??= !1, e.onFailedAttempt ??= () => {
|
|
2095
|
-
}, e.shouldRetry ??= () => !0, e.shouldConsumeRetry ??= () => !0,
|
|
2095
|
+
}, e.shouldRetry ??= () => !0, e.shouldConsumeRetry ??= () => !0, qe("factor", e.factor, { min: 0, allowInfinity: !1 }), qe("minTimeout", e.minTimeout, { min: 0, allowInfinity: !1 }), qe("maxTimeout", e.maxTimeout, { min: 0, allowInfinity: !0 }), qe("maxRetryTime", e.maxRetryTime, { min: 0, allowInfinity: !0 }), e.factor > 0 || (e.factor = 1), e.signal?.throwIfAborted();
|
|
2096
2096
|
let r = 0, n = 0;
|
|
2097
2097
|
const i = performance.now();
|
|
2098
2098
|
for (; !Number.isFinite(e.retries) || n <= e.retries; ) {
|
|
@@ -2790,7 +2790,7 @@ function Mi(...t) {
|
|
|
2790
2790
|
}
|
|
2791
2791
|
return r.signal;
|
|
2792
2792
|
}
|
|
2793
|
-
const
|
|
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 =
|
|
2803
|
-
const s = Ri.includes(i.at(-1)), a = i.length - 1, { lines: o } = i.reduce((l, c, u) => (l.from > u || ((c ===
|
|
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] =
|
|
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(
|
|
2815
|
+
t.length && r.enqueue(et(t));
|
|
2816
2816
|
}
|
|
2817
2817
|
});
|
|
2818
2818
|
}
|
|
@@ -2854,7 +2854,7 @@ function Ni() {
|
|
|
2854
2854
|
}
|
|
2855
2855
|
});
|
|
2856
2856
|
}
|
|
2857
|
-
function
|
|
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)
|
|
@@ -2862,17 +2862,17 @@ function Xe(t) {
|
|
|
2862
2862
|
return r;
|
|
2863
2863
|
}
|
|
2864
2864
|
function hr(t, e) {
|
|
2865
|
-
return JSON.parse(t.decode(
|
|
2865
|
+
return JSON.parse(t.decode(et(e)));
|
|
2866
2866
|
}
|
|
2867
|
-
const
|
|
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 || !
|
|
2873
|
+
return typeof e != "object" || e == null || !Qr(e) ? null : e;
|
|
2874
2874
|
}, $i = (t) => {
|
|
2875
|
-
if (!
|
|
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
|
};
|
|
@@ -3978,15 +3978,15 @@ var Ne = class {
|
|
|
3978
3978
|
signal: t?.signal
|
|
3979
3979
|
});
|
|
3980
3980
|
}
|
|
3981
|
-
}, Vi = class
|
|
3981
|
+
}, Vi = class ze extends Ne {
|
|
3982
3982
|
static promiseCache = {};
|
|
3983
3983
|
static getOrCached(e, r) {
|
|
3984
|
-
if (
|
|
3984
|
+
if (ze.promiseCache[e] != null) return ze.promiseCache[e];
|
|
3985
3985
|
const n = r();
|
|
3986
|
-
return
|
|
3986
|
+
return ze.promiseCache[e] = n, n;
|
|
3987
3987
|
}
|
|
3988
3988
|
async getComponent(e, r) {
|
|
3989
|
-
return
|
|
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",
|
|
@@ -4109,7 +4109,7 @@ const Ki = (t, e) => {
|
|
|
4109
4109
|
versions: i
|
|
4110
4110
|
}));
|
|
4111
4111
|
}, Xi = (t, e) => {
|
|
4112
|
-
const r = /* @__PURE__ */
|
|
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
|
}), {
|
|
@@ -4302,10 +4302,10 @@ class ea {
|
|
|
4302
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
|
-
},
|
|
4306
|
-
const n = /* @__PURE__ */
|
|
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__ */
|
|
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,10 +4316,10 @@ const mr = (t) => {
|
|
|
4316
4316
|
}, 10), R = async () => {
|
|
4317
4317
|
const E = s.get();
|
|
4318
4318
|
E && (E.tools.clearTools(), E.tools.bindTools(y.get()));
|
|
4319
|
-
},
|
|
4319
|
+
}, B = async () => {
|
|
4320
4320
|
S.get() && C.set(await s.get()?.graphVisualize() || null);
|
|
4321
4321
|
};
|
|
4322
|
-
async function
|
|
4322
|
+
async function z() {
|
|
4323
4323
|
const E = new ea({
|
|
4324
4324
|
...e,
|
|
4325
4325
|
client: e.client ?? await qi(e)
|
|
@@ -4327,11 +4327,11 @@ const mr = (t) => {
|
|
|
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
|
|
4330
|
+
await ee(M[0].sessionId);
|
|
4331
4331
|
} else
|
|
4332
|
-
await
|
|
4332
|
+
await H();
|
|
4333
4333
|
else
|
|
4334
|
-
await
|
|
4334
|
+
await H();
|
|
4335
4335
|
return E;
|
|
4336
4336
|
}
|
|
4337
4337
|
async function $() {
|
|
@@ -4344,20 +4344,20 @@ const mr = (t) => {
|
|
|
4344
4344
|
console.error("Failed to sync sessions:", M);
|
|
4345
4345
|
}
|
|
4346
4346
|
}
|
|
4347
|
-
async function
|
|
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
|
|
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
|
|
4357
|
+
function J(E) {
|
|
4358
4358
|
const M = () => s.get() === E, N = () => {
|
|
4359
4359
|
M() && I();
|
|
4360
|
-
},
|
|
4360
|
+
}, K = () => {
|
|
4361
4361
|
if (!M())
|
|
4362
4362
|
return;
|
|
4363
4363
|
const Ie = E.getCurrentThread();
|
|
@@ -4366,61 +4366,61 @@ const mr = (t) => {
|
|
|
4366
4366
|
Vt && Ie && (Vt.thread = Ie), $();
|
|
4367
4367
|
}, G = () => {
|
|
4368
4368
|
M() && (I(), k(E));
|
|
4369
|
-
},
|
|
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
|
-
},
|
|
4373
|
+
}, pe = () => {
|
|
4374
4374
|
M() && (h.set(E.getCurrentThread()?.thread_id || null), I(), k(E));
|
|
4375
|
-
},
|
|
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",
|
|
4382
|
-
E.off("start", N), E.off("thread",
|
|
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
|
|
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 =
|
|
4393
|
-
const
|
|
4394
|
-
o.set(
|
|
4395
|
-
const je =
|
|
4396
|
-
f.set(je?.node_name || je?.name || "__start__"), I(), S.get() &&
|
|
4397
|
-
const
|
|
4398
|
-
if (
|
|
4399
|
-
const
|
|
4400
|
-
|
|
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 (
|
|
4404
|
-
console.error("Failed to activate session:",
|
|
4403
|
+
} catch (K) {
|
|
4404
|
+
console.error("Failed to activate session:", K), c.set(K.message);
|
|
4405
4405
|
}
|
|
4406
4406
|
}
|
|
4407
|
-
async function
|
|
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 (
|
|
4414
|
-
if (
|
|
4413
|
+
} catch (te) {
|
|
4414
|
+
if (te.message.includes("422"))
|
|
4415
4415
|
await G.resetStream();
|
|
4416
4416
|
else
|
|
4417
|
-
throw
|
|
4417
|
+
throw te;
|
|
4418
4418
|
} finally {
|
|
4419
4419
|
l.set(""), I();
|
|
4420
4420
|
}
|
|
4421
4421
|
}
|
|
4422
4422
|
}
|
|
4423
|
-
function
|
|
4423
|
+
function Le() {
|
|
4424
4424
|
s.get()?.cancelRun();
|
|
4425
4425
|
}
|
|
4426
4426
|
function P(E) {
|
|
@@ -4439,9 +4439,9 @@ const mr = (t) => {
|
|
|
4439
4439
|
if (!M)
|
|
4440
4440
|
return null;
|
|
4441
4441
|
const N = M.tools.getTool(E)?.render;
|
|
4442
|
-
return N ? (
|
|
4442
|
+
return N ? (K) => N(new Gt(K, M)) : null;
|
|
4443
4443
|
}
|
|
4444
|
-
const
|
|
4444
|
+
const oe = Xi(o, s);
|
|
4445
4445
|
return {
|
|
4446
4446
|
data: {
|
|
4447
4447
|
// 核心客户端
|
|
@@ -4468,26 +4468,26 @@ const mr = (t) => {
|
|
|
4468
4468
|
// 历史记录
|
|
4469
4469
|
showHistory: v,
|
|
4470
4470
|
historyList: a,
|
|
4471
|
-
...
|
|
4471
|
+
...oe.data
|
|
4472
4472
|
},
|
|
4473
4473
|
mutations: {
|
|
4474
4474
|
// 初始化
|
|
4475
|
-
initClient:
|
|
4475
|
+
initClient: z,
|
|
4476
4476
|
getClient: () => s.get(),
|
|
4477
4477
|
getHistory: () => n.get(),
|
|
4478
4478
|
// 会话管理
|
|
4479
|
-
activateSession:
|
|
4480
|
-
createNewSession:
|
|
4479
|
+
activateSession: ee,
|
|
4480
|
+
createNewSession: H,
|
|
4481
4481
|
refreshSessionList: $,
|
|
4482
4482
|
refreshHistoryList: $,
|
|
4483
4483
|
// 向后兼容
|
|
4484
4484
|
// 消息操作
|
|
4485
|
-
sendMessage:
|
|
4486
|
-
stopGeneration:
|
|
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
|
|
4490
|
+
return q([], N, !0);
|
|
4491
4491
|
k(s.get());
|
|
4492
4492
|
},
|
|
4493
4493
|
// 工具操作
|
|
@@ -4501,15 +4501,15 @@ const mr = (t) => {
|
|
|
4501
4501
|
// UI 切换
|
|
4502
4502
|
toggleHistoryVisible: L,
|
|
4503
4503
|
toggleGraphVisible() {
|
|
4504
|
-
S.set(!S.get()), S.get() &&
|
|
4504
|
+
S.set(!S.get()), S.get() && B();
|
|
4505
4505
|
},
|
|
4506
|
-
refreshGraph:
|
|
4506
|
+
refreshGraph: B,
|
|
4507
4507
|
// Agent 切换
|
|
4508
4508
|
setCurrentAgent(E) {
|
|
4509
|
-
return u.set(E),
|
|
4509
|
+
return u.set(E), z();
|
|
4510
4510
|
},
|
|
4511
4511
|
resumeFromInterrupt(E) {
|
|
4512
|
-
return
|
|
4512
|
+
return q([], {
|
|
4513
4513
|
command: {
|
|
4514
4514
|
resume: E
|
|
4515
4515
|
}
|
|
@@ -4517,13 +4517,13 @@ const mr = (t) => {
|
|
|
4517
4517
|
},
|
|
4518
4518
|
// 历史记录(兼容旧 API)
|
|
4519
4519
|
addToHistory: F,
|
|
4520
|
-
createNewChat:
|
|
4521
|
-
toHistoryChat: (E) =>
|
|
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
|
-
...
|
|
4526
|
+
...oe.mutation
|
|
4527
4527
|
}
|
|
4528
4528
|
};
|
|
4529
4529
|
};
|
|
@@ -4748,7 +4748,7 @@ async function na(t, e, r, n) {
|
|
|
4748
4748
|
checkpoint: u
|
|
4749
4749
|
};
|
|
4750
4750
|
}
|
|
4751
|
-
const
|
|
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: {},
|
|
@@ -4771,13 +4771,13 @@ const qr = (t) => typeof t == "object" && t !== null, gr = (t) => qr(t) && !(t i
|
|
|
4771
4771
|
return i;
|
|
4772
4772
|
};
|
|
4773
4773
|
function ia(t, e, r) {
|
|
4774
|
-
if (!
|
|
4774
|
+
if (!Yr(t))
|
|
4775
4775
|
throw new TypeError(`Expected an object, got \`${t}\` (${typeof t})`);
|
|
4776
4776
|
if (Array.isArray(t))
|
|
4777
4777
|
throw new TypeError("Expected an object, got an array");
|
|
4778
4778
|
return Rt(t, e, r);
|
|
4779
4779
|
}
|
|
4780
|
-
const aa = /[\p{Lu}]/u, oa = /[\p{Ll}]/u, pr = /^[\p{Lu}](?![\p{Lu}])/gu,
|
|
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];
|
|
@@ -5010,7 +5010,7 @@ 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
|
|
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
|
}
|
|
@@ -5018,7 +5018,7 @@ class br extends Ht {
|
|
|
5018
5018
|
client;
|
|
5019
5019
|
currentAssistant = null;
|
|
5020
5020
|
currentThread = null;
|
|
5021
|
-
tools = new
|
|
5021
|
+
tools = new me();
|
|
5022
5022
|
availableAssistants = [];
|
|
5023
5023
|
graphState = {};
|
|
5024
5024
|
currentRun;
|
|
@@ -5322,11 +5322,11 @@ class br extends Ht {
|
|
|
5322
5322
|
value: {
|
|
5323
5323
|
/** @ts-ignore */
|
|
5324
5324
|
actionRequests: i.value.action_requests,
|
|
5325
|
-
reviewConfigs:
|
|
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 ||
|
|
5329
|
+
s.id = s.id || Hr(s);
|
|
5330
5330
|
}), i)), {
|
|
5331
5331
|
interruptData: n,
|
|
5332
5332
|
result: {}
|
|
@@ -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
|
|
5416
|
-
const t = x.useContext(
|
|
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(
|
|
5447
|
-
}, va = new
|
|
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(() =>
|
|
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
|
-
}),
|
|
5462
|
-
const { extraParams: r } =
|
|
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:
|
|
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
|
|
@@ -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 } =
|
|
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(
|
|
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 } =
|
|
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" ?
|
|
5655
|
-
children: c.type === "human" ? /* @__PURE__ */ d.jsx(
|
|
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
|
);
|
|
@@ -5661,7 +5661,7 @@ ${s.join(`
|
|
|
5661
5661
|
const o = t.slice(0, a), l = t.slice(a);
|
|
5662
5662
|
return n ? /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", children: [
|
|
5663
5663
|
/* @__PURE__ */ d.jsx(
|
|
5664
|
-
|
|
5664
|
+
kr,
|
|
5665
5665
|
{
|
|
5666
5666
|
items: o,
|
|
5667
5667
|
children: (c, u) => s(c, u, !1)
|
|
@@ -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:
|
|
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:
|
|
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(
|
|
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:
|
|
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 } =
|
|
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);
|
|
@@ -5761,10 +5761,10 @@ ${s.join(`
|
|
|
5761
5761
|
borderBottom: !1,
|
|
5762
5762
|
borderTop: !1,
|
|
5763
5763
|
borderRight: !1,
|
|
5764
|
-
borderLeftColor: m.type === "ai" ?
|
|
5764
|
+
borderLeftColor: m.type === "ai" ? le("teal") : m.type === "human" ? le("amber") : "yellow",
|
|
5765
5765
|
children: [
|
|
5766
|
-
m.type === "human" ? /* @__PURE__ */ d.jsx(
|
|
5767
|
-
m.type === "ai" ? /* @__PURE__ */ d.jsx(
|
|
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,
|
|
@@ -5785,7 +5785,7 @@ ${s.join(`
|
|
|
5785
5785
|
const h = l.slice(0, u), f = l.slice(u);
|
|
5786
5786
|
return i ? /* @__PURE__ */ d.jsxs(_, { flexDirection: "column", children: [
|
|
5787
5787
|
/* @__PURE__ */ d.jsx(
|
|
5788
|
-
|
|
5788
|
+
kr,
|
|
5789
5789
|
{
|
|
5790
5790
|
items: h,
|
|
5791
5791
|
children: (m, g) => c(m, g, !1)
|
|
@@ -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(
|
|
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
|
|
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
|
|
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
|
-
|
|
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 } =
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
|
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:
|
|
6325
|
+
message: Ze.getHelp(r),
|
|
6326
6326
|
shouldClearInput: !0
|
|
6327
6327
|
};
|
|
6328
6328
|
}
|
|
@@ -6337,7 +6337,7 @@ const We = new Fa(), Ua = {
|
|
|
6337
6337
|
shouldClearInput: !0
|
|
6338
6338
|
})
|
|
6339
6339
|
}, Ha = [Ua, Ba, za];
|
|
6340
|
-
class
|
|
6340
|
+
class en {
|
|
6341
6341
|
db;
|
|
6342
6342
|
dbPath;
|
|
6343
6343
|
constructor(e) {
|
|
@@ -6424,7 +6424,7 @@ class tn {
|
|
|
6424
6424
|
return this.dbPath;
|
|
6425
6425
|
}
|
|
6426
6426
|
}
|
|
6427
|
-
let
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
6475
|
+
He = null;
|
|
6476
6476
|
}
|
|
6477
6477
|
function Za(t = "./.claude/templates") {
|
|
6478
|
-
if (
|
|
6479
|
-
return Array.from(
|
|
6478
|
+
if (He)
|
|
6479
|
+
return Array.from(He.values());
|
|
6480
6480
|
const e = t.startsWith("/") ? t : ke(process.cwd(), t);
|
|
6481
|
-
return
|
|
6481
|
+
return He = tn(e, e), Array.from(He.values());
|
|
6482
6482
|
}
|
|
6483
6483
|
const Ja = {
|
|
6484
6484
|
name: "status",
|
|
@@ -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
|
|
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
|
|
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
|
-
|
|
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 } =
|
|
7216
|
-
|
|
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
|
|
7220
|
-
userInput:
|
|
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
|
-
},
|
|
7238
|
-
if (
|
|
7239
|
-
const
|
|
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:
|
|
7243
|
+
content: q.messageContent
|
|
7243
7244
|
}
|
|
7244
7245
|
];
|
|
7245
|
-
u(
|
|
7246
|
+
u(Le, { extraParams: p });
|
|
7246
7247
|
}
|
|
7247
7248
|
return e?.(), !0;
|
|
7248
|
-
} catch (
|
|
7249
|
-
return S(`命令执行错误: ${
|
|
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((
|
|
7271
|
-
|
|
7271
|
+
I.slice(0, 5).map((H, J) => /* @__PURE__ */ d.jsxs(w, { color: "cyan", children: [
|
|
7272
|
+
H.displayText,
|
|
7272
7273
|
" - ",
|
|
7273
|
-
|
|
7274
|
-
] },
|
|
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
|
|
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) =>
|
|
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 (
|
|
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 =
|
|
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:
|
|
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" &&
|
|
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
|
|
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(
|
|
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
|
|
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
|
|
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
|
|
7374
|
+
return tt.call(n, r);
|
|
7374
7375
|
}
|
|
7375
7376
|
const St = "__pregel_tasks", Ao = "__error__", ko = "__scheduled__", Mo = "__interrupt__", Po = "__resume__";
|
|
7376
|
-
var vr = "[...]", Do = "[Circular]",
|
|
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 (;
|
|
7392
|
-
var s =
|
|
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 }),
|
|
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,
|
|
7410
|
+
]) : (n[r] = t, nt.push([
|
|
7410
7411
|
n,
|
|
7411
7412
|
r,
|
|
7412
7413
|
e
|
|
@@ -7487,7 +7488,7 @@ async function Nt(t) {
|
|
|
7487
7488
|
} catch {
|
|
7488
7489
|
return e;
|
|
7489
7490
|
}
|
|
7490
|
-
else if (Lo(e)) return
|
|
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
|
|
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] =
|
|
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:
|
|
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
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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,7 +7739,7 @@ const Qo = (t) => {
|
|
|
7738
7739
|
resume: t.resume
|
|
7739
7740
|
});
|
|
7740
7741
|
};
|
|
7741
|
-
var xr = "[...]", Vo = "[Circular]",
|
|
7742
|
+
var xr = "[...]", Vo = "[Circular]", st = [], De = [];
|
|
7742
7743
|
function Yo() {
|
|
7743
7744
|
return {
|
|
7744
7745
|
depthLimit: Number.MAX_SAFE_INTEGER,
|
|
@@ -7753,8 +7754,8 @@ function qo(t, e, r, n) {
|
|
|
7753
7754
|
} catch {
|
|
7754
7755
|
return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]");
|
|
7755
7756
|
} finally {
|
|
7756
|
-
for (;
|
|
7757
|
-
var s =
|
|
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 qo(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 }),
|
|
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;
|
|
@@ -7847,7 +7848,7 @@ async function $t(t) {
|
|
|
7847
7848
|
return e;
|
|
7848
7849
|
}
|
|
7849
7850
|
else if (Xo(e))
|
|
7850
|
-
return
|
|
7851
|
+
return rn(JSON.stringify(e));
|
|
7851
7852
|
return e;
|
|
7852
7853
|
}
|
|
7853
7854
|
}
|
|
@@ -8057,7 +8058,7 @@ const Re = {};
|
|
|
8057
8058
|
async function sc(t, e) {
|
|
8058
8059
|
Re[t] = e;
|
|
8059
8060
|
}
|
|
8060
|
-
async function
|
|
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;
|
|
@@ -8146,7 +8147,7 @@ class Sr {
|
|
|
8146
8147
|
thread_id: e,
|
|
8147
8148
|
graph_id: i
|
|
8148
8149
|
}
|
|
8149
|
-
}, a = await
|
|
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 Sr {
|
|
|
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
|
|
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
|
|
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
|
|
8214
|
+
class ac extends ue {
|
|
8214
8215
|
constructor() {
|
|
8215
8216
|
super("__stream_end__", "stream end");
|
|
8216
8217
|
}
|
|
8217
8218
|
}
|
|
8218
|
-
class oc extends
|
|
8219
|
+
class oc extends ue {
|
|
8219
8220
|
constructor(e) {
|
|
8220
8221
|
super("__stream_error__", {
|
|
8221
8222
|
error: e.name,
|
|
@@ -8357,7 +8358,7 @@ class cc {
|
|
|
8357
8358
|
thread_id: e,
|
|
8358
8359
|
graph_id: s
|
|
8359
8360
|
}
|
|
8360
|
-
}, o = await
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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,7 +8424,7 @@ 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-
|
|
8427
|
+
const { RedisStreamQueue: e } = await import("./queue-D6tEGCGs-DyRh7Gp2.mjs");
|
|
8427
8428
|
t = e;
|
|
8428
8429
|
} else
|
|
8429
8430
|
t = Qt;
|
|
@@ -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
|
|
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
|
|
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
|
|
8516
|
+
new ue("messages/metadata", {
|
|
8516
8517
|
[b.id]: v
|
|
8517
8518
|
})
|
|
8518
|
-
), f.add(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
|
|
8523
|
-
)) : await r.push(new
|
|
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
|
|
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
|
|
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:
|
|
8629
|
+
getGraph: lt
|
|
8629
8630
|
}
|
|
8630
8631
|
))
|
|
8631
8632
|
yield s;
|
|
@@ -8658,13 +8659,13 @@ const mc = {
|
|
|
8658
8659
|
}
|
|
8659
8660
|
}
|
|
8660
8661
|
};
|
|
8661
|
-
},
|
|
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) =>
|
|
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(
|
|
8665
|
+
for (const r of t.def.items) e.push(Ge(r));
|
|
8665
8666
|
return e;
|
|
8666
|
-
}), V.set(D.ZodPipe.name, (t) =>
|
|
8667
|
-
function
|
|
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
|
|
8676
|
-
if (
|
|
8677
|
-
if (
|
|
8678
|
-
if (
|
|
8679
|
-
if (
|
|
8680
|
-
for (const e of t.def.options) if (
|
|
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
|
|
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
|
|
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()),
|
|
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,12 +8703,12 @@ 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:
|
|
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
|
|
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(),
|
|
@@ -8724,14 +8725,14 @@ T.object({
|
|
|
8724
8725
|
limit: T.number().int().optional(),
|
|
8725
8726
|
offset: T.number().int().optional()
|
|
8726
8727
|
});
|
|
8727
|
-
const
|
|
8728
|
+
const dt = T.object({
|
|
8728
8729
|
thread_id: T.string().uuid()
|
|
8729
|
-
}),
|
|
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:
|
|
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:
|
|
8745
|
-
config:
|
|
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:
|
|
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:
|
|
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
|
|
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,7 +8796,7 @@ function Se(t, e) {
|
|
|
8795
8796
|
}
|
|
8796
8797
|
}), i;
|
|
8797
8798
|
}
|
|
8798
|
-
function
|
|
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;
|
|
@@ -8804,16 +8805,16 @@ function dt(t) {
|
|
|
8804
8805
|
function Y(t, e) {
|
|
8805
8806
|
const r = t.safeParse(e);
|
|
8806
8807
|
if (!r.success)
|
|
8807
|
-
throw new
|
|
8808
|
+
throw new on(r.error.issues);
|
|
8808
8809
|
return r.data;
|
|
8809
8810
|
}
|
|
8810
|
-
class
|
|
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
|
|
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
|
|
8826
|
-
return t instanceof
|
|
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
|
-
) :
|
|
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
|
|
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
|
|
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 = Y(wc, r), i = await
|
|
8927
|
-
return
|
|
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
|
|
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 =
|
|
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
|
|
8940
|
+
return de(o);
|
|
8940
8941
|
} catch (r) {
|
|
8941
|
-
return
|
|
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 = Y(Tc, r), i = await
|
|
8947
|
-
return
|
|
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
|
|
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 = Y(Cc, r), i = await
|
|
8955
|
-
return
|
|
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
|
|
8960
|
+
return ne(r);
|
|
8960
8961
|
}
|
|
8961
8962
|
}
|
|
8962
8963
|
async function Mc(t, e) {
|
|
8963
8964
|
try {
|
|
8964
|
-
const r =
|
|
8965
|
-
return
|
|
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
|
|
8968
|
+
return ne(r);
|
|
8968
8969
|
}
|
|
8969
8970
|
}
|
|
8970
8971
|
async function Pc(t, e) {
|
|
8971
8972
|
try {
|
|
8972
|
-
const r =
|
|
8973
|
-
return await
|
|
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
|
|
8976
|
+
return ne(r);
|
|
8976
8977
|
}
|
|
8977
8978
|
}
|
|
8978
8979
|
async function Dc(t, e) {
|
|
8979
8980
|
try {
|
|
8980
|
-
const r =
|
|
8981
|
-
return
|
|
8982
|
-
|
|
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
|
|
8987
|
+
for await (const { event: l, data: c } of ae.runs.stream(
|
|
8987
8988
|
n,
|
|
8988
8989
|
s.assistant_id,
|
|
8989
|
-
|
|
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
|
|
8996
|
+
return ne(r);
|
|
8996
8997
|
}
|
|
8997
8998
|
}
|
|
8998
8999
|
async function Rc(t, e) {
|
|
8999
9000
|
try {
|
|
9000
|
-
const r =
|
|
9001
|
-
return
|
|
9002
|
-
|
|
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
|
|
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
|
|
9034
|
+
return ne(r);
|
|
9034
9035
|
}
|
|
9035
9036
|
}
|
|
9036
9037
|
async function Oc(t, e) {
|
|
9037
9038
|
try {
|
|
9038
|
-
const r =
|
|
9039
|
-
return
|
|
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
|
|
9042
|
+
return ne(r);
|
|
9042
9043
|
}
|
|
9043
9044
|
}
|
|
9044
9045
|
async function Nc(t, e) {
|
|
9045
9046
|
try {
|
|
9046
|
-
const r =
|
|
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
|
|
9050
|
+
return ne(r);
|
|
9050
9051
|
}
|
|
9051
9052
|
}
|
|
9052
9053
|
async function Lc(t, e) {
|
|
9053
9054
|
try {
|
|
9054
|
-
const r =
|
|
9055
|
-
return
|
|
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
|
|
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),
|
|
9140
|
+
return console.error("Request error:", r), ne(r);
|
|
9140
9141
|
}
|
|
9141
9142
|
}
|
|
9142
|
-
await
|
|
9143
|
-
sc("code",
|
|
9143
|
+
await Cn();
|
|
9144
|
+
sc("code", jn);
|
|
9144
9145
|
const Bc = (t, e = {}) => Uc(new Request(t, e), {}), zc = () => {
|
|
9145
|
-
const t =
|
|
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(
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
9497
|
+
Se,
|
|
9497
9498
|
{
|
|
9498
9499
|
value: a,
|
|
9499
9500
|
onChange: o,
|
|
@@ -9543,13 +9544,13 @@ function Cr({ 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 ?
|
|
9547
|
+
let g = m, p = e ? ye.grey(e) : void 0;
|
|
9547
9548
|
if (s && r) {
|
|
9548
|
-
p = e.length > 0 ?
|
|
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 ?
|
|
9552
|
-
m.length > 0 && u === m.length && (g +=
|
|
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 Cr({ 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 }),
|
|
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 &&
|
|
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
|
-
|
|
9585
|
+
Se,
|
|
9585
9586
|
{
|
|
9586
9587
|
value: i,
|
|
9587
9588
|
onChange: s,
|
|
@@ -9687,7 +9688,7 @@ const Vc = {
|
|
|
9687
9688
|
autoFocus: i = !0,
|
|
9688
9689
|
variant: s = "line"
|
|
9689
9690
|
}) => {
|
|
9690
|
-
const { isFocused: a } =
|
|
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 =
|
|
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 =
|
|
9846
|
+
const u = We.get(c.content.type);
|
|
9846
9847
|
return u ? /* @__PURE__ */ d.jsx(
|
|
9847
9848
|
Kc,
|
|
9848
9849
|
{
|
|
@@ -9878,11 +9879,11 @@ const Vc = {
|
|
|
9878
9879
|
] });
|
|
9879
9880
|
};
|
|
9880
9881
|
function el() {
|
|
9881
|
-
|
|
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 } =
|
|
9886
|
+
const { addInteraction: e, getInteractions: r, updateInteraction: n } = ot(), [i, s] = x.useState(null), a = x.useRef(!1), o = t.getInputRepaired();
|
|
9886
9887
|
return zt(), x.useEffect(() => {
|
|
9887
9888
|
if (t.state === "interrupted" && !i && !a.current) {
|
|
9888
9889
|
const c = {
|
|
@@ -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 =
|
|
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:
|
|
9933
|
-
handler:
|
|
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
|
-
}),
|
|
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 } =
|
|
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,13 +10024,13 @@ 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(
|
|
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 =
|
|
10029
|
+
}, sl = fe({
|
|
10029
10030
|
name: "terminal",
|
|
10030
10031
|
description: "",
|
|
10031
10032
|
parameters: {},
|
|
10032
|
-
handler:
|
|
10033
|
+
handler: me.waitForUIDone,
|
|
10033
10034
|
render(t) {
|
|
10034
10035
|
return /* @__PURE__ */ d.jsx(nl, { tool: t });
|
|
10035
10036
|
}
|
|
@@ -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
|
|
10127
|
-
R++,
|
|
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 (
|
|
10131
|
+
else if (B > c)
|
|
10131
10132
|
v += 2;
|
|
10132
10133
|
else if (b) {
|
|
10133
|
-
var
|
|
10134
|
-
if (
|
|
10135
|
-
var $ = l - g[
|
|
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,
|
|
10138
|
+
return this.diff_bisectSplit_(s, a, R, B, o);
|
|
10138
10139
|
}
|
|
10139
10140
|
}
|
|
10140
10141
|
}
|
|
10141
|
-
for (var
|
|
10142
|
-
var
|
|
10143
|
-
|
|
10144
|
-
for (var
|
|
10145
|
-
$++,
|
|
10146
|
-
if (g[
|
|
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 (
|
|
10149
|
+
else if (J > c)
|
|
10149
10150
|
C += 2;
|
|
10150
10151
|
else if (!b) {
|
|
10151
|
-
var k = h + y -
|
|
10152
|
+
var k = h + y - H;
|
|
10152
10153
|
if (k >= 0 && k < f && m[k] != -1) {
|
|
10153
|
-
var R = m[k],
|
|
10154
|
+
var R = m[k], B = h + R - k;
|
|
10154
10155
|
if ($ = l - $, R >= $)
|
|
10155
|
-
return this.diff_bisectSplit_(s, a, R,
|
|
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,
|
|
10224
|
-
var
|
|
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
|
-
),
|
|
10228
|
+
), J = c.diff_commonSuffix(
|
|
10228
10229
|
S.substring(0, j),
|
|
10229
10230
|
C.substring(0, I)
|
|
10230
10231
|
);
|
|
10231
|
-
k.length <
|
|
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_),
|
|
10285
|
-
return $ ||
|
|
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,
|
|
10437
|
-
var
|
|
10438
|
-
return c.Match_Distance ?
|
|
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)));
|
|
@@ -10747,17 +10748,17 @@ function cl(t, e, r) {
|
|
|
10747
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
|
|
10751
|
-
const n =
|
|
10752
|
-
return /* @__PURE__ */ d.jsxs(w, { color:
|
|
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 =
|
|
10757
|
+
}, ll = fe({
|
|
10757
10758
|
name: "edit_file",
|
|
10758
10759
|
description: "Performs exact string replacements in files with diff visualization",
|
|
10759
|
-
parameters:
|
|
10760
|
-
handler:
|
|
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(
|
|
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 =
|
|
10799
|
+
}, hl = fe({
|
|
10799
10800
|
name: "TodoWrite",
|
|
10800
10801
|
description: "Use this tool to create and manage a structured task list",
|
|
10801
|
-
parameters:
|
|
10802
|
-
handler:
|
|
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 =
|
|
10821
|
+
}), fl = fe({
|
|
10821
10822
|
name: "read_file",
|
|
10822
10823
|
description: "Reads a file from the local filesystem",
|
|
10823
|
-
parameters:
|
|
10824
|
-
handler:
|
|
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(
|
|
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 =
|
|
10841
|
+
}), ml = fe({
|
|
10841
10842
|
name: "glob_files",
|
|
10842
10843
|
description: "Find files by name patterns",
|
|
10843
|
-
parameters:
|
|
10844
|
-
handler:
|
|
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(
|
|
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 =
|
|
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:
|
|
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(
|
|
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,11 +10883,11 @@ 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 =
|
|
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,
|
|
10889
|
-
handler: async (t) => await
|
|
10890
|
+
handler: async (t) => await Ar.invoke(t),
|
|
10890
10891
|
render(t) {
|
|
10891
10892
|
const e = t.getInputRepaired(), r = t.output;
|
|
10892
10893
|
if (!r) return /* @__PURE__ */ d.jsx(d.Fragment, {});
|
|
@@ -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 =
|
|
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:
|
|
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(
|
|
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 } =
|
|
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 =
|
|
10964
|
-
if (
|
|
10964
|
+
}, m = (p) => {
|
|
10965
|
+
if (p.trim()) {
|
|
10965
10966
|
if (h) {
|
|
10966
|
-
r(
|
|
10967
|
+
r(p), u("");
|
|
10967
10968
|
return;
|
|
10968
10969
|
}
|
|
10969
|
-
n ? (o(
|
|
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
|
-
|
|
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
|
|
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 =
|
|
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
|
-
|
|
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(
|
|
11073
|
+
return /* @__PURE__ */ d.jsx(Qe, { config: i, onClose: t });
|
|
11073
11074
|
}, Tl = ({ onClose: t }) => {
|
|
11074
|
-
const { AVAILABLE_MODELS: e, extraParams: r, updateConfig: n } =
|
|
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(
|
|
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(
|
|
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(
|
|
11136
|
+
return /* @__PURE__ */ d.jsx(Qe, { config: i, onClose: t });
|
|
11136
11137
|
}, Cl = ({ onClose: t }) => {
|
|
11137
|
-
const { config: e, updateConfig: r } =
|
|
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
|
|
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(
|
|
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(
|
|
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(
|
|
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 } =
|
|
11204
|
+
}), { loading: r } = re();
|
|
11204
11205
|
return x.useEffect(() => {
|
|
11205
11206
|
(async () => {
|
|
11206
|
-
const i = await
|
|
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 } =
|
|
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.
|
|
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
|
-
"[
|
|
11238
|
+
"[FULL]"
|
|
11233
11239
|
] }),
|
|
11234
|
-
|
|
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
|
-
|
|
11245
|
+
o && /* @__PURE__ */ d.jsxs(w, { color: "red", bold: !0, children: [
|
|
11240
11246
|
" ",
|
|
11241
|
-
"
|
|
11247
|
+
"/summary"
|
|
11242
11248
|
] }),
|
|
11243
|
-
/* @__PURE__ */ d.
|
|
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
|
-
},
|
|
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 ?
|
|
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 ?
|
|
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
|
" ",
|
|
@@ -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(
|
|
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(
|
|
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(
|
|
11482
|
+
) : /* @__PURE__ */ d.jsx(Qe, { config: c, onClose: t }) });
|
|
11480
11483
|
};
|
|
11481
11484
|
function Pl({
|
|
11482
11485
|
loading: t,
|
|
@@ -11507,7 +11510,7 @@ function Pl({
|
|
|
11507
11510
|
if (h > l.current) {
|
|
11508
11511
|
l.current = h;
|
|
11509
11512
|
const f = e[h - 1], m = Jt(f);
|
|
11510
|
-
typeof m == "string" && m.includes("<COMPLETE></COMPLETE>") ? (o.current = !1, a(null),
|
|
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 } =
|
|
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(Er, { 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 } =
|
|
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("/") &&
|
|
11569
|
+
if (y.startsWith("/") && await g.executeCommand(y)) {
|
|
11572
11570
|
o("");
|
|
11573
11571
|
return;
|
|
11574
11572
|
}
|
|
11575
11573
|
m(y).then(() => {
|
|
11576
|
-
|
|
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 } =
|
|
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,7 +11617,7 @@ const Dl = () => {
|
|
|
11619
11617
|
], {
|
|
11620
11618
|
extraParams: t
|
|
11621
11619
|
}).then(() => {
|
|
11622
|
-
|
|
11620
|
+
it("Zen Code 完成任务");
|
|
11623
11621
|
}), u());
|
|
11624
11622
|
}, [i, c, o, t, u]), x.useEffect(() => {
|
|
11625
11623
|
!i && h.focus("global-input");
|
|
@@ -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,
|
|
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,
|
|
11666
|
+
`, I.children.forEach((R, B) => {
|
|
11669
11667
|
k += `
|
|
11670
|
-
### 子任务 ${
|
|
11668
|
+
### 子任务 ${B + 1}: ${R.title}
|
|
11671
11669
|
`, k += `${R.description}
|
|
11672
11670
|
`, R.acceptanceCriteria && R.acceptanceCriteria.length > 0 && (k += `验收标准:
|
|
11673
|
-
${R.acceptanceCriteria.map((
|
|
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
|
-
|
|
11693
|
+
it("任务已发送给 Agent");
|
|
11696
11694
|
});
|
|
11697
11695
|
}), S();
|
|
11698
11696
|
},
|
|
11699
11697
|
[o, t, S]
|
|
11700
|
-
), { hasPendingInteractions: A } =
|
|
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:
|
|
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
|
-
|
|
11740
|
+
hn(/* @__PURE__ */ d.jsx(Ll, {}));
|
|
11743
11741
|
export {
|
|
11744
11742
|
Bo as B,
|
|
11745
11743
|
ic as C,
|