@teodorruskvi/chat-core 0.1.57 → 0.1.59
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/features/conversation/contexts/ThreadStateProvider.d.ts +3 -1
- package/dist/features/conversation/hooks/useChatSession.d.ts +1 -0
- package/dist/features/conversation/hooks/useThreadHistoryState.d.ts +3 -1
- package/dist/index.esm.js +1257 -1251
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +7 -7
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Gt = (e, t, n) => t in e ?
|
|
1
|
+
var qt = Object.defineProperty;
|
|
2
|
+
var Gt = (e, t, n) => t in e ? qt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var at = (e, t, n) => Gt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { jsx as de } from "react/jsx-runtime";
|
|
5
5
|
import * as it from "react";
|
|
6
|
-
import { createContext as Ce, useContext as je, useState as
|
|
6
|
+
import { createContext as Ce, useContext as je, useState as H, useRef as W, useEffect as Y, useCallback as _, useMemo as Z, useReducer as Wt } from "react";
|
|
7
7
|
import Jt, { isCancel as Xt } from "axios";
|
|
8
8
|
function It(e) {
|
|
9
9
|
var t, n, r = "";
|
|
10
10
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
11
11
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
12
|
-
var
|
|
13
|
-
for (t = 0; t <
|
|
12
|
+
var s = e.length;
|
|
13
|
+
for (t = 0; t < s; t++) e[t] && (n = It(e[t])) && (r && (r += " "), r += n);
|
|
14
14
|
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
15
15
|
return r;
|
|
16
16
|
}
|
|
17
17
|
function Qt() {
|
|
18
|
-
for (var e, t, n = 0, r = "",
|
|
18
|
+
for (var e, t, n = 0, r = "", s = arguments.length; n < s; n++) (e = arguments[n]) && (t = It(e)) && (r && (r += " "), r += t);
|
|
19
19
|
return r;
|
|
20
20
|
}
|
|
21
21
|
const et = "-", Yt = (e) => {
|
|
@@ -29,23 +29,23 @@ const et = "-", Yt = (e) => {
|
|
|
29
29
|
return i[0] === "" && i.length !== 1 && i.shift(), vt(i, t) || Zt(a);
|
|
30
30
|
},
|
|
31
31
|
getConflictingClassGroupIds: (a, i) => {
|
|
32
|
-
const
|
|
33
|
-
return i && r[a] ? [...
|
|
32
|
+
const u = n[a] || [];
|
|
33
|
+
return i && r[a] ? [...u, ...r[a]] : u;
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
}, vt = (e, t) => {
|
|
37
37
|
var a;
|
|
38
38
|
if (e.length === 0)
|
|
39
39
|
return t.classGroupId;
|
|
40
|
-
const n = e[0], r = t.nextPart.get(n),
|
|
41
|
-
if (
|
|
42
|
-
return
|
|
40
|
+
const n = e[0], r = t.nextPart.get(n), s = r ? vt(e.slice(1), r) : void 0;
|
|
41
|
+
if (s)
|
|
42
|
+
return s;
|
|
43
43
|
if (t.validators.length === 0)
|
|
44
44
|
return;
|
|
45
|
-
const
|
|
45
|
+
const o = e.join(et);
|
|
46
46
|
return (a = t.validators.find(({
|
|
47
47
|
validator: i
|
|
48
|
-
}) => i(
|
|
48
|
+
}) => i(o))) == null ? void 0 : a.classGroupId;
|
|
49
49
|
}, ct = /^\[(.+)\]$/, Zt = (e) => {
|
|
50
50
|
if (ct.test(e)) {
|
|
51
51
|
const t = ct.exec(e)[1], n = t == null ? void 0 : t.substring(0, t.indexOf(":"));
|
|
@@ -60,29 +60,29 @@ const et = "-", Yt = (e) => {
|
|
|
60
60
|
nextPart: /* @__PURE__ */ new Map(),
|
|
61
61
|
validators: []
|
|
62
62
|
};
|
|
63
|
-
return nn(Object.entries(e.classGroups), n).forEach(([
|
|
64
|
-
Xe(a, r,
|
|
63
|
+
return nn(Object.entries(e.classGroups), n).forEach(([o, a]) => {
|
|
64
|
+
Xe(a, r, o, t);
|
|
65
65
|
}), r;
|
|
66
66
|
}, Xe = (e, t, n, r) => {
|
|
67
|
-
e.forEach((
|
|
68
|
-
if (typeof
|
|
69
|
-
const
|
|
70
|
-
|
|
67
|
+
e.forEach((s) => {
|
|
68
|
+
if (typeof s == "string") {
|
|
69
|
+
const o = s === "" ? t : lt(t, s);
|
|
70
|
+
o.classGroupId = n;
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
if (typeof
|
|
74
|
-
if (tn(
|
|
75
|
-
Xe(
|
|
73
|
+
if (typeof s == "function") {
|
|
74
|
+
if (tn(s)) {
|
|
75
|
+
Xe(s(r), t, n, r);
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
t.validators.push({
|
|
79
|
-
validator:
|
|
79
|
+
validator: s,
|
|
80
80
|
classGroupId: n
|
|
81
81
|
});
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
|
-
Object.entries(
|
|
85
|
-
Xe(a, lt(t,
|
|
84
|
+
Object.entries(s).forEach(([o, a]) => {
|
|
85
|
+
Xe(a, lt(t, o), n, r);
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
88
|
}, lt = (e, t) => {
|
|
@@ -94,8 +94,8 @@ const et = "-", Yt = (e) => {
|
|
|
94
94
|
}), n = n.nextPart.get(r);
|
|
95
95
|
}), n;
|
|
96
96
|
}, tn = (e) => e.isThemeGetter, nn = (e, t) => t ? e.map(([n, r]) => {
|
|
97
|
-
const
|
|
98
|
-
return [n,
|
|
97
|
+
const s = r.map((o) => typeof o == "string" ? t + o : typeof o == "object" ? Object.fromEntries(Object.entries(o).map(([a, i]) => [t + a, i])) : o);
|
|
98
|
+
return [n, s];
|
|
99
99
|
}) : e, rn = (e) => {
|
|
100
100
|
if (e < 1)
|
|
101
101
|
return {
|
|
@@ -105,48 +105,48 @@ const et = "-", Yt = (e) => {
|
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
let t = 0, n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
108
|
-
const
|
|
109
|
-
n.set(
|
|
108
|
+
const s = (o, a) => {
|
|
109
|
+
n.set(o, a), t++, t > e && (t = 0, r = n, n = /* @__PURE__ */ new Map());
|
|
110
110
|
};
|
|
111
111
|
return {
|
|
112
|
-
get(
|
|
113
|
-
let a = n.get(
|
|
112
|
+
get(o) {
|
|
113
|
+
let a = n.get(o);
|
|
114
114
|
if (a !== void 0)
|
|
115
115
|
return a;
|
|
116
|
-
if ((a = r.get(
|
|
117
|
-
return o
|
|
116
|
+
if ((a = r.get(o)) !== void 0)
|
|
117
|
+
return s(o, a), a;
|
|
118
118
|
},
|
|
119
|
-
set(
|
|
120
|
-
n.has(
|
|
119
|
+
set(o, a) {
|
|
120
|
+
n.has(o) ? n.set(o, a) : s(o, a);
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
123
|
}, xt = "!", on = (e) => {
|
|
124
124
|
const {
|
|
125
125
|
separator: t,
|
|
126
126
|
experimentalParseClassName: n
|
|
127
|
-
} = e, r = t.length === 1,
|
|
128
|
-
const
|
|
129
|
-
let
|
|
130
|
-
for (let
|
|
131
|
-
let x = i[
|
|
132
|
-
if (
|
|
133
|
-
if (x ===
|
|
134
|
-
|
|
127
|
+
} = e, r = t.length === 1, s = t[0], o = t.length, a = (i) => {
|
|
128
|
+
const u = [];
|
|
129
|
+
let l = 0, c = 0, d;
|
|
130
|
+
for (let b = 0; b < i.length; b++) {
|
|
131
|
+
let x = i[b];
|
|
132
|
+
if (l === 0) {
|
|
133
|
+
if (x === s && (r || i.slice(b, b + o) === t)) {
|
|
134
|
+
u.push(i.slice(c, b)), c = b + o;
|
|
135
135
|
continue;
|
|
136
136
|
}
|
|
137
137
|
if (x === "/") {
|
|
138
|
-
|
|
138
|
+
d = b;
|
|
139
139
|
continue;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
x === "[" ?
|
|
142
|
+
x === "[" ? l++ : x === "]" && l--;
|
|
143
143
|
}
|
|
144
|
-
const p =
|
|
144
|
+
const p = u.length === 0 ? i : i.substring(c), m = p.startsWith(xt), v = m ? p.substring(1) : p, f = d && d > c ? d - c : void 0;
|
|
145
145
|
return {
|
|
146
|
-
modifiers:
|
|
147
|
-
hasImportantModifier:
|
|
148
|
-
baseClassName:
|
|
149
|
-
maybePostfixModifierPosition:
|
|
146
|
+
modifiers: u,
|
|
147
|
+
hasImportantModifier: m,
|
|
148
|
+
baseClassName: v,
|
|
149
|
+
maybePostfixModifierPosition: f
|
|
150
150
|
};
|
|
151
151
|
};
|
|
152
152
|
return n ? (i) => n({
|
|
@@ -169,38 +169,38 @@ const et = "-", Yt = (e) => {
|
|
|
169
169
|
const {
|
|
170
170
|
parseClassName: n,
|
|
171
171
|
getClassGroupId: r,
|
|
172
|
-
getConflictingClassGroupIds:
|
|
173
|
-
} = t,
|
|
172
|
+
getConflictingClassGroupIds: s
|
|
173
|
+
} = t, o = [], a = e.trim().split(cn);
|
|
174
174
|
let i = "";
|
|
175
|
-
for (let
|
|
176
|
-
const
|
|
177
|
-
modifiers:
|
|
178
|
-
hasImportantModifier:
|
|
175
|
+
for (let u = a.length - 1; u >= 0; u -= 1) {
|
|
176
|
+
const l = a[u], {
|
|
177
|
+
modifiers: c,
|
|
178
|
+
hasImportantModifier: d,
|
|
179
179
|
baseClassName: p,
|
|
180
|
-
maybePostfixModifierPosition:
|
|
181
|
-
} = n(
|
|
182
|
-
let
|
|
183
|
-
if (!
|
|
184
|
-
if (!
|
|
185
|
-
i =
|
|
180
|
+
maybePostfixModifierPosition: m
|
|
181
|
+
} = n(l);
|
|
182
|
+
let v = !!m, f = r(v ? p.substring(0, m) : p);
|
|
183
|
+
if (!f) {
|
|
184
|
+
if (!v) {
|
|
185
|
+
i = l + (i.length > 0 ? " " + i : i);
|
|
186
186
|
continue;
|
|
187
187
|
}
|
|
188
|
-
if (
|
|
189
|
-
i =
|
|
188
|
+
if (f = r(p), !f) {
|
|
189
|
+
i = l + (i.length > 0 ? " " + i : i);
|
|
190
190
|
continue;
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
v = !1;
|
|
193
193
|
}
|
|
194
|
-
const
|
|
195
|
-
if (
|
|
194
|
+
const b = sn(c).join(":"), x = d ? b + xt : b, S = x + f;
|
|
195
|
+
if (o.includes(S))
|
|
196
196
|
continue;
|
|
197
|
-
|
|
198
|
-
const A =
|
|
197
|
+
o.push(S);
|
|
198
|
+
const A = s(f, v);
|
|
199
199
|
for (let w = 0; w < A.length; ++w) {
|
|
200
|
-
const
|
|
201
|
-
|
|
200
|
+
const k = A[w];
|
|
201
|
+
o.push(x + k);
|
|
202
202
|
}
|
|
203
|
-
i =
|
|
203
|
+
i = l + (i.length > 0 ? " " + i : i);
|
|
204
204
|
}
|
|
205
205
|
return i;
|
|
206
206
|
};
|
|
@@ -219,26 +219,26 @@ const At = (e) => {
|
|
|
219
219
|
return n;
|
|
220
220
|
};
|
|
221
221
|
function un(e, ...t) {
|
|
222
|
-
let n, r,
|
|
223
|
-
function a(
|
|
224
|
-
const
|
|
225
|
-
return n = an(
|
|
222
|
+
let n, r, s, o = a;
|
|
223
|
+
function a(u) {
|
|
224
|
+
const l = t.reduce((c, d) => d(c), e());
|
|
225
|
+
return n = an(l), r = n.cache.get, s = n.cache.set, o = i, i(u);
|
|
226
226
|
}
|
|
227
|
-
function i(
|
|
228
|
-
const
|
|
229
|
-
if (
|
|
230
|
-
return
|
|
231
|
-
const
|
|
232
|
-
return
|
|
227
|
+
function i(u) {
|
|
228
|
+
const l = r(u);
|
|
229
|
+
if (l)
|
|
230
|
+
return l;
|
|
231
|
+
const c = ln(u, n);
|
|
232
|
+
return s(u, c), c;
|
|
233
233
|
}
|
|
234
234
|
return function() {
|
|
235
|
-
return
|
|
235
|
+
return o(dn.apply(null, arguments));
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
238
|
const q = (e) => {
|
|
239
239
|
const t = (n) => n[e] || [];
|
|
240
240
|
return t.isThemeGetter = !0, t;
|
|
241
|
-
}, Tt = /^\[(?:([a-z-]+):)?(.+)\]$/i, fn = /^\d+\/\d+$/, pn = /* @__PURE__ */ new Set(["px", "full", "screen"]), gn = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, mn = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, yn = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, hn = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, bn = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, pe = (e) => Te(e) || pn.has(e) || fn.test(e), Ie = (e) => Ee(e, "length", Sn), Te = (e) => !!e && !Number.isNaN(Number(e)),
|
|
241
|
+
}, Tt = /^\[(?:([a-z-]+):)?(.+)\]$/i, fn = /^\d+\/\d+$/, pn = /* @__PURE__ */ new Set(["px", "full", "screen"]), gn = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, mn = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, yn = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, hn = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, bn = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, pe = (e) => Te(e) || pn.has(e) || fn.test(e), Ie = (e) => Ee(e, "length", Sn), Te = (e) => !!e && !Number.isNaN(Number(e)), Ve = (e) => Ee(e, "number", Te), _e = (e) => !!e && Number.isInteger(Number(e)), wn = (e) => e.endsWith("%") && Te(e.slice(0, -1)), R = (e) => Tt.test(e), ve = (e) => gn.test(e), kn = /* @__PURE__ */ new Set(["length", "size", "percentage"]), In = (e) => Ee(e, kn, St), vn = (e) => Ee(e, "position", St), xn = /* @__PURE__ */ new Set(["image", "url"]), An = (e) => Ee(e, xn, Cn), Tn = (e) => Ee(e, "", Mn), Ne = () => !0, Ee = (e, t, n) => {
|
|
242
242
|
const r = Tt.exec(e);
|
|
243
243
|
return r ? r[1] ? typeof t == "string" ? r[1] === t : t.has(r[1]) : n(r[2]) : !1;
|
|
244
244
|
}, Sn = (e) => (
|
|
@@ -247,34 +247,34 @@ const q = (e) => {
|
|
|
247
247
|
// I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
|
|
248
248
|
mn.test(e) && !yn.test(e)
|
|
249
249
|
), St = () => !1, Mn = (e) => hn.test(e), Cn = (e) => bn.test(e), En = () => {
|
|
250
|
-
const e = q("colors"), t = q("spacing"), n = q("blur"), r = q("brightness"),
|
|
250
|
+
const e = q("colors"), t = q("spacing"), n = q("blur"), r = q("brightness"), s = q("borderColor"), o = q("borderRadius"), a = q("borderSpacing"), i = q("borderWidth"), u = q("contrast"), l = q("grayscale"), c = q("hueRotate"), d = q("invert"), p = q("gap"), m = q("gradientColorStops"), v = q("gradientColorStopPositions"), f = q("inset"), b = q("margin"), x = q("opacity"), S = q("padding"), A = q("saturate"), w = q("scale"), k = q("sepia"), h = q("skew"), T = q("space"), y = q("translate"), I = () => ["auto", "contain", "none"], E = () => ["auto", "hidden", "clip", "visible", "scroll"], L = () => ["auto", R, t], M = () => [R, t], $ = () => ["", pe, Ie], U = () => ["auto", Te, R], V = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], P = () => ["solid", "dashed", "dotted", "double", "none"], F = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], N = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], j = () => ["", "0", R], G = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], g = () => [Te, R];
|
|
251
251
|
return {
|
|
252
252
|
cacheSize: 500,
|
|
253
253
|
separator: ":",
|
|
254
254
|
theme: {
|
|
255
255
|
colors: [Ne],
|
|
256
256
|
spacing: [pe, Ie],
|
|
257
|
-
blur: ["none", "", ve,
|
|
258
|
-
brightness:
|
|
257
|
+
blur: ["none", "", ve, R],
|
|
258
|
+
brightness: g(),
|
|
259
259
|
borderColor: [e],
|
|
260
|
-
borderRadius: ["none", "", "full", ve,
|
|
260
|
+
borderRadius: ["none", "", "full", ve, R],
|
|
261
261
|
borderSpacing: M(),
|
|
262
262
|
borderWidth: $(),
|
|
263
|
-
contrast:
|
|
264
|
-
grayscale:
|
|
265
|
-
hueRotate:
|
|
266
|
-
invert:
|
|
263
|
+
contrast: g(),
|
|
264
|
+
grayscale: j(),
|
|
265
|
+
hueRotate: g(),
|
|
266
|
+
invert: j(),
|
|
267
267
|
gap: M(),
|
|
268
268
|
gradientColorStops: [e],
|
|
269
269
|
gradientColorStopPositions: [wn, Ie],
|
|
270
|
-
inset:
|
|
271
|
-
margin:
|
|
272
|
-
opacity:
|
|
270
|
+
inset: L(),
|
|
271
|
+
margin: L(),
|
|
272
|
+
opacity: g(),
|
|
273
273
|
padding: M(),
|
|
274
|
-
saturate:
|
|
275
|
-
scale:
|
|
276
|
-
sepia:
|
|
277
|
-
skew:
|
|
274
|
+
saturate: g(),
|
|
275
|
+
scale: g(),
|
|
276
|
+
sepia: j(),
|
|
277
|
+
skew: g(),
|
|
278
278
|
space: M(),
|
|
279
279
|
translate: M()
|
|
280
280
|
},
|
|
@@ -285,7 +285,7 @@ const q = (e) => {
|
|
|
285
285
|
* @see https://tailwindcss.com/docs/aspect-ratio
|
|
286
286
|
*/
|
|
287
287
|
aspect: [{
|
|
288
|
-
aspect: ["auto", "square", "video",
|
|
288
|
+
aspect: ["auto", "square", "video", R]
|
|
289
289
|
}],
|
|
290
290
|
/**
|
|
291
291
|
* Container
|
|
@@ -304,14 +304,14 @@ const q = (e) => {
|
|
|
304
304
|
* @see https://tailwindcss.com/docs/break-after
|
|
305
305
|
*/
|
|
306
306
|
"break-after": [{
|
|
307
|
-
"break-after":
|
|
307
|
+
"break-after": G()
|
|
308
308
|
}],
|
|
309
309
|
/**
|
|
310
310
|
* Break Before
|
|
311
311
|
* @see https://tailwindcss.com/docs/break-before
|
|
312
312
|
*/
|
|
313
313
|
"break-before": [{
|
|
314
|
-
"break-before":
|
|
314
|
+
"break-before": G()
|
|
315
315
|
}],
|
|
316
316
|
/**
|
|
317
317
|
* Break Inside
|
|
@@ -370,7 +370,7 @@ const q = (e) => {
|
|
|
370
370
|
* @see https://tailwindcss.com/docs/object-position
|
|
371
371
|
*/
|
|
372
372
|
"object-position": [{
|
|
373
|
-
object: [...
|
|
373
|
+
object: [...V(), R]
|
|
374
374
|
}],
|
|
375
375
|
/**
|
|
376
376
|
* Overflow
|
|
@@ -398,21 +398,21 @@ const q = (e) => {
|
|
|
398
398
|
* @see https://tailwindcss.com/docs/overscroll-behavior
|
|
399
399
|
*/
|
|
400
400
|
overscroll: [{
|
|
401
|
-
overscroll:
|
|
401
|
+
overscroll: I()
|
|
402
402
|
}],
|
|
403
403
|
/**
|
|
404
404
|
* Overscroll Behavior X
|
|
405
405
|
* @see https://tailwindcss.com/docs/overscroll-behavior
|
|
406
406
|
*/
|
|
407
407
|
"overscroll-x": [{
|
|
408
|
-
"overscroll-x":
|
|
408
|
+
"overscroll-x": I()
|
|
409
409
|
}],
|
|
410
410
|
/**
|
|
411
411
|
* Overscroll Behavior Y
|
|
412
412
|
* @see https://tailwindcss.com/docs/overscroll-behavior
|
|
413
413
|
*/
|
|
414
414
|
"overscroll-y": [{
|
|
415
|
-
"overscroll-y":
|
|
415
|
+
"overscroll-y": I()
|
|
416
416
|
}],
|
|
417
417
|
/**
|
|
418
418
|
* Position
|
|
@@ -424,63 +424,63 @@ const q = (e) => {
|
|
|
424
424
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
425
425
|
*/
|
|
426
426
|
inset: [{
|
|
427
|
-
inset: [
|
|
427
|
+
inset: [f]
|
|
428
428
|
}],
|
|
429
429
|
/**
|
|
430
430
|
* Right / Left
|
|
431
431
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
432
432
|
*/
|
|
433
433
|
"inset-x": [{
|
|
434
|
-
"inset-x": [
|
|
434
|
+
"inset-x": [f]
|
|
435
435
|
}],
|
|
436
436
|
/**
|
|
437
437
|
* Top / Bottom
|
|
438
438
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
439
439
|
*/
|
|
440
440
|
"inset-y": [{
|
|
441
|
-
"inset-y": [
|
|
441
|
+
"inset-y": [f]
|
|
442
442
|
}],
|
|
443
443
|
/**
|
|
444
444
|
* Start
|
|
445
445
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
446
446
|
*/
|
|
447
447
|
start: [{
|
|
448
|
-
start: [
|
|
448
|
+
start: [f]
|
|
449
449
|
}],
|
|
450
450
|
/**
|
|
451
451
|
* End
|
|
452
452
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
453
453
|
*/
|
|
454
454
|
end: [{
|
|
455
|
-
end: [
|
|
455
|
+
end: [f]
|
|
456
456
|
}],
|
|
457
457
|
/**
|
|
458
458
|
* Top
|
|
459
459
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
460
460
|
*/
|
|
461
461
|
top: [{
|
|
462
|
-
top: [
|
|
462
|
+
top: [f]
|
|
463
463
|
}],
|
|
464
464
|
/**
|
|
465
465
|
* Right
|
|
466
466
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
467
467
|
*/
|
|
468
468
|
right: [{
|
|
469
|
-
right: [
|
|
469
|
+
right: [f]
|
|
470
470
|
}],
|
|
471
471
|
/**
|
|
472
472
|
* Bottom
|
|
473
473
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
474
474
|
*/
|
|
475
475
|
bottom: [{
|
|
476
|
-
bottom: [
|
|
476
|
+
bottom: [f]
|
|
477
477
|
}],
|
|
478
478
|
/**
|
|
479
479
|
* Left
|
|
480
480
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
481
481
|
*/
|
|
482
482
|
left: [{
|
|
483
|
-
left: [
|
|
483
|
+
left: [f]
|
|
484
484
|
}],
|
|
485
485
|
/**
|
|
486
486
|
* Visibility
|
|
@@ -492,7 +492,7 @@ const q = (e) => {
|
|
|
492
492
|
* @see https://tailwindcss.com/docs/z-index
|
|
493
493
|
*/
|
|
494
494
|
z: [{
|
|
495
|
-
z: ["auto", _e,
|
|
495
|
+
z: ["auto", _e, R]
|
|
496
496
|
}],
|
|
497
497
|
// Flexbox and Grid
|
|
498
498
|
/**
|
|
@@ -500,7 +500,7 @@ const q = (e) => {
|
|
|
500
500
|
* @see https://tailwindcss.com/docs/flex-basis
|
|
501
501
|
*/
|
|
502
502
|
basis: [{
|
|
503
|
-
basis:
|
|
503
|
+
basis: L()
|
|
504
504
|
}],
|
|
505
505
|
/**
|
|
506
506
|
* Flex Direction
|
|
@@ -521,28 +521,28 @@ const q = (e) => {
|
|
|
521
521
|
* @see https://tailwindcss.com/docs/flex
|
|
522
522
|
*/
|
|
523
523
|
flex: [{
|
|
524
|
-
flex: ["1", "auto", "initial", "none",
|
|
524
|
+
flex: ["1", "auto", "initial", "none", R]
|
|
525
525
|
}],
|
|
526
526
|
/**
|
|
527
527
|
* Flex Grow
|
|
528
528
|
* @see https://tailwindcss.com/docs/flex-grow
|
|
529
529
|
*/
|
|
530
530
|
grow: [{
|
|
531
|
-
grow:
|
|
531
|
+
grow: j()
|
|
532
532
|
}],
|
|
533
533
|
/**
|
|
534
534
|
* Flex Shrink
|
|
535
535
|
* @see https://tailwindcss.com/docs/flex-shrink
|
|
536
536
|
*/
|
|
537
537
|
shrink: [{
|
|
538
|
-
shrink:
|
|
538
|
+
shrink: j()
|
|
539
539
|
}],
|
|
540
540
|
/**
|
|
541
541
|
* Order
|
|
542
542
|
* @see https://tailwindcss.com/docs/order
|
|
543
543
|
*/
|
|
544
544
|
order: [{
|
|
545
|
-
order: ["first", "last", "none", _e,
|
|
545
|
+
order: ["first", "last", "none", _e, R]
|
|
546
546
|
}],
|
|
547
547
|
/**
|
|
548
548
|
* Grid Template Columns
|
|
@@ -557,22 +557,22 @@ const q = (e) => {
|
|
|
557
557
|
*/
|
|
558
558
|
"col-start-end": [{
|
|
559
559
|
col: ["auto", {
|
|
560
|
-
span: ["full", _e,
|
|
561
|
-
},
|
|
560
|
+
span: ["full", _e, R]
|
|
561
|
+
}, R]
|
|
562
562
|
}],
|
|
563
563
|
/**
|
|
564
564
|
* Grid Column Start
|
|
565
565
|
* @see https://tailwindcss.com/docs/grid-column
|
|
566
566
|
*/
|
|
567
567
|
"col-start": [{
|
|
568
|
-
"col-start":
|
|
568
|
+
"col-start": U()
|
|
569
569
|
}],
|
|
570
570
|
/**
|
|
571
571
|
* Grid Column End
|
|
572
572
|
* @see https://tailwindcss.com/docs/grid-column
|
|
573
573
|
*/
|
|
574
574
|
"col-end": [{
|
|
575
|
-
"col-end":
|
|
575
|
+
"col-end": U()
|
|
576
576
|
}],
|
|
577
577
|
/**
|
|
578
578
|
* Grid Template Rows
|
|
@@ -587,22 +587,22 @@ const q = (e) => {
|
|
|
587
587
|
*/
|
|
588
588
|
"row-start-end": [{
|
|
589
589
|
row: ["auto", {
|
|
590
|
-
span: [_e,
|
|
591
|
-
},
|
|
590
|
+
span: [_e, R]
|
|
591
|
+
}, R]
|
|
592
592
|
}],
|
|
593
593
|
/**
|
|
594
594
|
* Grid Row Start
|
|
595
595
|
* @see https://tailwindcss.com/docs/grid-row
|
|
596
596
|
*/
|
|
597
597
|
"row-start": [{
|
|
598
|
-
"row-start":
|
|
598
|
+
"row-start": U()
|
|
599
599
|
}],
|
|
600
600
|
/**
|
|
601
601
|
* Grid Row End
|
|
602
602
|
* @see https://tailwindcss.com/docs/grid-row
|
|
603
603
|
*/
|
|
604
604
|
"row-end": [{
|
|
605
|
-
"row-end":
|
|
605
|
+
"row-end": U()
|
|
606
606
|
}],
|
|
607
607
|
/**
|
|
608
608
|
* Grid Auto Flow
|
|
@@ -616,14 +616,14 @@ const q = (e) => {
|
|
|
616
616
|
* @see https://tailwindcss.com/docs/grid-auto-columns
|
|
617
617
|
*/
|
|
618
618
|
"auto-cols": [{
|
|
619
|
-
"auto-cols": ["auto", "min", "max", "fr",
|
|
619
|
+
"auto-cols": ["auto", "min", "max", "fr", R]
|
|
620
620
|
}],
|
|
621
621
|
/**
|
|
622
622
|
* Grid Auto Rows
|
|
623
623
|
* @see https://tailwindcss.com/docs/grid-auto-rows
|
|
624
624
|
*/
|
|
625
625
|
"auto-rows": [{
|
|
626
|
-
"auto-rows": ["auto", "min", "max", "fr",
|
|
626
|
+
"auto-rows": ["auto", "min", "max", "fr", R]
|
|
627
627
|
}],
|
|
628
628
|
/**
|
|
629
629
|
* Gap
|
|
@@ -651,7 +651,7 @@ const q = (e) => {
|
|
|
651
651
|
* @see https://tailwindcss.com/docs/justify-content
|
|
652
652
|
*/
|
|
653
653
|
"justify-content": [{
|
|
654
|
-
justify: ["normal", ...
|
|
654
|
+
justify: ["normal", ...N()]
|
|
655
655
|
}],
|
|
656
656
|
/**
|
|
657
657
|
* Justify Items
|
|
@@ -672,7 +672,7 @@ const q = (e) => {
|
|
|
672
672
|
* @see https://tailwindcss.com/docs/align-content
|
|
673
673
|
*/
|
|
674
674
|
"align-content": [{
|
|
675
|
-
content: ["normal", ...
|
|
675
|
+
content: ["normal", ...N(), "baseline"]
|
|
676
676
|
}],
|
|
677
677
|
/**
|
|
678
678
|
* Align Items
|
|
@@ -693,7 +693,7 @@ const q = (e) => {
|
|
|
693
693
|
* @see https://tailwindcss.com/docs/place-content
|
|
694
694
|
*/
|
|
695
695
|
"place-content": [{
|
|
696
|
-
"place-content": [...
|
|
696
|
+
"place-content": [...N(), "baseline"]
|
|
697
697
|
}],
|
|
698
698
|
/**
|
|
699
699
|
* Place Items
|
|
@@ -778,63 +778,63 @@ const q = (e) => {
|
|
|
778
778
|
* @see https://tailwindcss.com/docs/margin
|
|
779
779
|
*/
|
|
780
780
|
m: [{
|
|
781
|
-
m: [
|
|
781
|
+
m: [b]
|
|
782
782
|
}],
|
|
783
783
|
/**
|
|
784
784
|
* Margin X
|
|
785
785
|
* @see https://tailwindcss.com/docs/margin
|
|
786
786
|
*/
|
|
787
787
|
mx: [{
|
|
788
|
-
mx: [
|
|
788
|
+
mx: [b]
|
|
789
789
|
}],
|
|
790
790
|
/**
|
|
791
791
|
* Margin Y
|
|
792
792
|
* @see https://tailwindcss.com/docs/margin
|
|
793
793
|
*/
|
|
794
794
|
my: [{
|
|
795
|
-
my: [
|
|
795
|
+
my: [b]
|
|
796
796
|
}],
|
|
797
797
|
/**
|
|
798
798
|
* Margin Start
|
|
799
799
|
* @see https://tailwindcss.com/docs/margin
|
|
800
800
|
*/
|
|
801
801
|
ms: [{
|
|
802
|
-
ms: [
|
|
802
|
+
ms: [b]
|
|
803
803
|
}],
|
|
804
804
|
/**
|
|
805
805
|
* Margin End
|
|
806
806
|
* @see https://tailwindcss.com/docs/margin
|
|
807
807
|
*/
|
|
808
808
|
me: [{
|
|
809
|
-
me: [
|
|
809
|
+
me: [b]
|
|
810
810
|
}],
|
|
811
811
|
/**
|
|
812
812
|
* Margin Top
|
|
813
813
|
* @see https://tailwindcss.com/docs/margin
|
|
814
814
|
*/
|
|
815
815
|
mt: [{
|
|
816
|
-
mt: [
|
|
816
|
+
mt: [b]
|
|
817
817
|
}],
|
|
818
818
|
/**
|
|
819
819
|
* Margin Right
|
|
820
820
|
* @see https://tailwindcss.com/docs/margin
|
|
821
821
|
*/
|
|
822
822
|
mr: [{
|
|
823
|
-
mr: [
|
|
823
|
+
mr: [b]
|
|
824
824
|
}],
|
|
825
825
|
/**
|
|
826
826
|
* Margin Bottom
|
|
827
827
|
* @see https://tailwindcss.com/docs/margin
|
|
828
828
|
*/
|
|
829
829
|
mb: [{
|
|
830
|
-
mb: [
|
|
830
|
+
mb: [b]
|
|
831
831
|
}],
|
|
832
832
|
/**
|
|
833
833
|
* Margin Left
|
|
834
834
|
* @see https://tailwindcss.com/docs/margin
|
|
835
835
|
*/
|
|
836
836
|
ml: [{
|
|
837
|
-
ml: [
|
|
837
|
+
ml: [b]
|
|
838
838
|
}],
|
|
839
839
|
/**
|
|
840
840
|
* Space Between X
|
|
@@ -866,21 +866,21 @@ const q = (e) => {
|
|
|
866
866
|
* @see https://tailwindcss.com/docs/width
|
|
867
867
|
*/
|
|
868
868
|
w: [{
|
|
869
|
-
w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw",
|
|
869
|
+
w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw", R, t]
|
|
870
870
|
}],
|
|
871
871
|
/**
|
|
872
872
|
* Min-Width
|
|
873
873
|
* @see https://tailwindcss.com/docs/min-width
|
|
874
874
|
*/
|
|
875
875
|
"min-w": [{
|
|
876
|
-
"min-w": [
|
|
876
|
+
"min-w": [R, t, "min", "max", "fit"]
|
|
877
877
|
}],
|
|
878
878
|
/**
|
|
879
879
|
* Max-Width
|
|
880
880
|
* @see https://tailwindcss.com/docs/max-width
|
|
881
881
|
*/
|
|
882
882
|
"max-w": [{
|
|
883
|
-
"max-w": [
|
|
883
|
+
"max-w": [R, t, "none", "full", "min", "max", "fit", "prose", {
|
|
884
884
|
screen: [ve]
|
|
885
885
|
}, ve]
|
|
886
886
|
}],
|
|
@@ -889,28 +889,28 @@ const q = (e) => {
|
|
|
889
889
|
* @see https://tailwindcss.com/docs/height
|
|
890
890
|
*/
|
|
891
891
|
h: [{
|
|
892
|
-
h: [
|
|
892
|
+
h: [R, t, "auto", "min", "max", "fit", "svh", "lvh", "dvh"]
|
|
893
893
|
}],
|
|
894
894
|
/**
|
|
895
895
|
* Min-Height
|
|
896
896
|
* @see https://tailwindcss.com/docs/min-height
|
|
897
897
|
*/
|
|
898
898
|
"min-h": [{
|
|
899
|
-
"min-h": [
|
|
899
|
+
"min-h": [R, t, "min", "max", "fit", "svh", "lvh", "dvh"]
|
|
900
900
|
}],
|
|
901
901
|
/**
|
|
902
902
|
* Max-Height
|
|
903
903
|
* @see https://tailwindcss.com/docs/max-height
|
|
904
904
|
*/
|
|
905
905
|
"max-h": [{
|
|
906
|
-
"max-h": [
|
|
906
|
+
"max-h": [R, t, "min", "max", "fit", "svh", "lvh", "dvh"]
|
|
907
907
|
}],
|
|
908
908
|
/**
|
|
909
909
|
* Size
|
|
910
910
|
* @see https://tailwindcss.com/docs/size
|
|
911
911
|
*/
|
|
912
912
|
size: [{
|
|
913
|
-
size: [
|
|
913
|
+
size: [R, t, "auto", "min", "max", "fit"]
|
|
914
914
|
}],
|
|
915
915
|
// Typography
|
|
916
916
|
/**
|
|
@@ -935,7 +935,7 @@ const q = (e) => {
|
|
|
935
935
|
* @see https://tailwindcss.com/docs/font-weight
|
|
936
936
|
*/
|
|
937
937
|
"font-weight": [{
|
|
938
|
-
font: ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black",
|
|
938
|
+
font: ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black", Ve]
|
|
939
939
|
}],
|
|
940
940
|
/**
|
|
941
941
|
* Font Family
|
|
@@ -979,35 +979,35 @@ const q = (e) => {
|
|
|
979
979
|
* @see https://tailwindcss.com/docs/letter-spacing
|
|
980
980
|
*/
|
|
981
981
|
tracking: [{
|
|
982
|
-
tracking: ["tighter", "tight", "normal", "wide", "wider", "widest",
|
|
982
|
+
tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", R]
|
|
983
983
|
}],
|
|
984
984
|
/**
|
|
985
985
|
* Line Clamp
|
|
986
986
|
* @see https://tailwindcss.com/docs/line-clamp
|
|
987
987
|
*/
|
|
988
988
|
"line-clamp": [{
|
|
989
|
-
"line-clamp": ["none", Te,
|
|
989
|
+
"line-clamp": ["none", Te, Ve]
|
|
990
990
|
}],
|
|
991
991
|
/**
|
|
992
992
|
* Line Height
|
|
993
993
|
* @see https://tailwindcss.com/docs/line-height
|
|
994
994
|
*/
|
|
995
995
|
leading: [{
|
|
996
|
-
leading: ["none", "tight", "snug", "normal", "relaxed", "loose", pe,
|
|
996
|
+
leading: ["none", "tight", "snug", "normal", "relaxed", "loose", pe, R]
|
|
997
997
|
}],
|
|
998
998
|
/**
|
|
999
999
|
* List Style Image
|
|
1000
1000
|
* @see https://tailwindcss.com/docs/list-style-image
|
|
1001
1001
|
*/
|
|
1002
1002
|
"list-image": [{
|
|
1003
|
-
"list-image": ["none",
|
|
1003
|
+
"list-image": ["none", R]
|
|
1004
1004
|
}],
|
|
1005
1005
|
/**
|
|
1006
1006
|
* List Style Type
|
|
1007
1007
|
* @see https://tailwindcss.com/docs/list-style-type
|
|
1008
1008
|
*/
|
|
1009
1009
|
"list-style-type": [{
|
|
1010
|
-
list: ["none", "disc", "decimal",
|
|
1010
|
+
list: ["none", "disc", "decimal", R]
|
|
1011
1011
|
}],
|
|
1012
1012
|
/**
|
|
1013
1013
|
* List Style Position
|
|
@@ -1062,7 +1062,7 @@ const q = (e) => {
|
|
|
1062
1062
|
* @see https://tailwindcss.com/docs/text-decoration-style
|
|
1063
1063
|
*/
|
|
1064
1064
|
"text-decoration-style": [{
|
|
1065
|
-
decoration: [...
|
|
1065
|
+
decoration: [...P(), "wavy"]
|
|
1066
1066
|
}],
|
|
1067
1067
|
/**
|
|
1068
1068
|
* Text Decoration Thickness
|
|
@@ -1076,7 +1076,7 @@ const q = (e) => {
|
|
|
1076
1076
|
* @see https://tailwindcss.com/docs/text-underline-offset
|
|
1077
1077
|
*/
|
|
1078
1078
|
"underline-offset": [{
|
|
1079
|
-
"underline-offset": ["auto", pe,
|
|
1079
|
+
"underline-offset": ["auto", pe, R]
|
|
1080
1080
|
}],
|
|
1081
1081
|
/**
|
|
1082
1082
|
* Text Decoration Color
|
|
@@ -1114,7 +1114,7 @@ const q = (e) => {
|
|
|
1114
1114
|
* @see https://tailwindcss.com/docs/vertical-align
|
|
1115
1115
|
*/
|
|
1116
1116
|
"vertical-align": [{
|
|
1117
|
-
align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super",
|
|
1117
|
+
align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", R]
|
|
1118
1118
|
}],
|
|
1119
1119
|
/**
|
|
1120
1120
|
* Whitespace
|
|
@@ -1142,7 +1142,7 @@ const q = (e) => {
|
|
|
1142
1142
|
* @see https://tailwindcss.com/docs/content
|
|
1143
1143
|
*/
|
|
1144
1144
|
content: [{
|
|
1145
|
-
content: ["none",
|
|
1145
|
+
content: ["none", R]
|
|
1146
1146
|
}],
|
|
1147
1147
|
// Backgrounds
|
|
1148
1148
|
/**
|
|
@@ -1179,7 +1179,7 @@ const q = (e) => {
|
|
|
1179
1179
|
* @see https://tailwindcss.com/docs/background-position
|
|
1180
1180
|
*/
|
|
1181
1181
|
"bg-position": [{
|
|
1182
|
-
bg: [...
|
|
1182
|
+
bg: [...V(), vn]
|
|
1183
1183
|
}],
|
|
1184
1184
|
/**
|
|
1185
1185
|
* Background Repeat
|
|
@@ -1218,42 +1218,42 @@ const q = (e) => {
|
|
|
1218
1218
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1219
1219
|
*/
|
|
1220
1220
|
"gradient-from-pos": [{
|
|
1221
|
-
from: [
|
|
1221
|
+
from: [v]
|
|
1222
1222
|
}],
|
|
1223
1223
|
/**
|
|
1224
1224
|
* Gradient Color Stops Via Position
|
|
1225
1225
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1226
1226
|
*/
|
|
1227
1227
|
"gradient-via-pos": [{
|
|
1228
|
-
via: [
|
|
1228
|
+
via: [v]
|
|
1229
1229
|
}],
|
|
1230
1230
|
/**
|
|
1231
1231
|
* Gradient Color Stops To Position
|
|
1232
1232
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1233
1233
|
*/
|
|
1234
1234
|
"gradient-to-pos": [{
|
|
1235
|
-
to: [
|
|
1235
|
+
to: [v]
|
|
1236
1236
|
}],
|
|
1237
1237
|
/**
|
|
1238
1238
|
* Gradient Color Stops From
|
|
1239
1239
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1240
1240
|
*/
|
|
1241
1241
|
"gradient-from": [{
|
|
1242
|
-
from: [
|
|
1242
|
+
from: [m]
|
|
1243
1243
|
}],
|
|
1244
1244
|
/**
|
|
1245
1245
|
* Gradient Color Stops Via
|
|
1246
1246
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1247
1247
|
*/
|
|
1248
1248
|
"gradient-via": [{
|
|
1249
|
-
via: [
|
|
1249
|
+
via: [m]
|
|
1250
1250
|
}],
|
|
1251
1251
|
/**
|
|
1252
1252
|
* Gradient Color Stops To
|
|
1253
1253
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1254
1254
|
*/
|
|
1255
1255
|
"gradient-to": [{
|
|
1256
|
-
to: [
|
|
1256
|
+
to: [m]
|
|
1257
1257
|
}],
|
|
1258
1258
|
// Borders
|
|
1259
1259
|
/**
|
|
@@ -1261,105 +1261,105 @@ const q = (e) => {
|
|
|
1261
1261
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1262
1262
|
*/
|
|
1263
1263
|
rounded: [{
|
|
1264
|
-
rounded: [
|
|
1264
|
+
rounded: [o]
|
|
1265
1265
|
}],
|
|
1266
1266
|
/**
|
|
1267
1267
|
* Border Radius Start
|
|
1268
1268
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1269
1269
|
*/
|
|
1270
1270
|
"rounded-s": [{
|
|
1271
|
-
"rounded-s": [
|
|
1271
|
+
"rounded-s": [o]
|
|
1272
1272
|
}],
|
|
1273
1273
|
/**
|
|
1274
1274
|
* Border Radius End
|
|
1275
1275
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1276
1276
|
*/
|
|
1277
1277
|
"rounded-e": [{
|
|
1278
|
-
"rounded-e": [
|
|
1278
|
+
"rounded-e": [o]
|
|
1279
1279
|
}],
|
|
1280
1280
|
/**
|
|
1281
1281
|
* Border Radius Top
|
|
1282
1282
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1283
1283
|
*/
|
|
1284
1284
|
"rounded-t": [{
|
|
1285
|
-
"rounded-t": [
|
|
1285
|
+
"rounded-t": [o]
|
|
1286
1286
|
}],
|
|
1287
1287
|
/**
|
|
1288
1288
|
* Border Radius Right
|
|
1289
1289
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1290
1290
|
*/
|
|
1291
1291
|
"rounded-r": [{
|
|
1292
|
-
"rounded-r": [
|
|
1292
|
+
"rounded-r": [o]
|
|
1293
1293
|
}],
|
|
1294
1294
|
/**
|
|
1295
1295
|
* Border Radius Bottom
|
|
1296
1296
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1297
1297
|
*/
|
|
1298
1298
|
"rounded-b": [{
|
|
1299
|
-
"rounded-b": [
|
|
1299
|
+
"rounded-b": [o]
|
|
1300
1300
|
}],
|
|
1301
1301
|
/**
|
|
1302
1302
|
* Border Radius Left
|
|
1303
1303
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1304
1304
|
*/
|
|
1305
1305
|
"rounded-l": [{
|
|
1306
|
-
"rounded-l": [
|
|
1306
|
+
"rounded-l": [o]
|
|
1307
1307
|
}],
|
|
1308
1308
|
/**
|
|
1309
1309
|
* Border Radius Start Start
|
|
1310
1310
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1311
1311
|
*/
|
|
1312
1312
|
"rounded-ss": [{
|
|
1313
|
-
"rounded-ss": [
|
|
1313
|
+
"rounded-ss": [o]
|
|
1314
1314
|
}],
|
|
1315
1315
|
/**
|
|
1316
1316
|
* Border Radius Start End
|
|
1317
1317
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1318
1318
|
*/
|
|
1319
1319
|
"rounded-se": [{
|
|
1320
|
-
"rounded-se": [
|
|
1320
|
+
"rounded-se": [o]
|
|
1321
1321
|
}],
|
|
1322
1322
|
/**
|
|
1323
1323
|
* Border Radius End End
|
|
1324
1324
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1325
1325
|
*/
|
|
1326
1326
|
"rounded-ee": [{
|
|
1327
|
-
"rounded-ee": [
|
|
1327
|
+
"rounded-ee": [o]
|
|
1328
1328
|
}],
|
|
1329
1329
|
/**
|
|
1330
1330
|
* Border Radius End Start
|
|
1331
1331
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1332
1332
|
*/
|
|
1333
1333
|
"rounded-es": [{
|
|
1334
|
-
"rounded-es": [
|
|
1334
|
+
"rounded-es": [o]
|
|
1335
1335
|
}],
|
|
1336
1336
|
/**
|
|
1337
1337
|
* Border Radius Top Left
|
|
1338
1338
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1339
1339
|
*/
|
|
1340
1340
|
"rounded-tl": [{
|
|
1341
|
-
"rounded-tl": [
|
|
1341
|
+
"rounded-tl": [o]
|
|
1342
1342
|
}],
|
|
1343
1343
|
/**
|
|
1344
1344
|
* Border Radius Top Right
|
|
1345
1345
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1346
1346
|
*/
|
|
1347
1347
|
"rounded-tr": [{
|
|
1348
|
-
"rounded-tr": [
|
|
1348
|
+
"rounded-tr": [o]
|
|
1349
1349
|
}],
|
|
1350
1350
|
/**
|
|
1351
1351
|
* Border Radius Bottom Right
|
|
1352
1352
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1353
1353
|
*/
|
|
1354
1354
|
"rounded-br": [{
|
|
1355
|
-
"rounded-br": [
|
|
1355
|
+
"rounded-br": [o]
|
|
1356
1356
|
}],
|
|
1357
1357
|
/**
|
|
1358
1358
|
* Border Radius Bottom Left
|
|
1359
1359
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1360
1360
|
*/
|
|
1361
1361
|
"rounded-bl": [{
|
|
1362
|
-
"rounded-bl": [
|
|
1362
|
+
"rounded-bl": [o]
|
|
1363
1363
|
}],
|
|
1364
1364
|
/**
|
|
1365
1365
|
* Border Width
|
|
@@ -1436,7 +1436,7 @@ const q = (e) => {
|
|
|
1436
1436
|
* @see https://tailwindcss.com/docs/border-style
|
|
1437
1437
|
*/
|
|
1438
1438
|
"border-style": [{
|
|
1439
|
-
border: [...
|
|
1439
|
+
border: [...P(), "hidden"]
|
|
1440
1440
|
}],
|
|
1441
1441
|
/**
|
|
1442
1442
|
* Divide Width X
|
|
@@ -1474,91 +1474,91 @@ const q = (e) => {
|
|
|
1474
1474
|
* @see https://tailwindcss.com/docs/divide-style
|
|
1475
1475
|
*/
|
|
1476
1476
|
"divide-style": [{
|
|
1477
|
-
divide:
|
|
1477
|
+
divide: P()
|
|
1478
1478
|
}],
|
|
1479
1479
|
/**
|
|
1480
1480
|
* Border Color
|
|
1481
1481
|
* @see https://tailwindcss.com/docs/border-color
|
|
1482
1482
|
*/
|
|
1483
1483
|
"border-color": [{
|
|
1484
|
-
border: [
|
|
1484
|
+
border: [s]
|
|
1485
1485
|
}],
|
|
1486
1486
|
/**
|
|
1487
1487
|
* Border Color X
|
|
1488
1488
|
* @see https://tailwindcss.com/docs/border-color
|
|
1489
1489
|
*/
|
|
1490
1490
|
"border-color-x": [{
|
|
1491
|
-
"border-x": [
|
|
1491
|
+
"border-x": [s]
|
|
1492
1492
|
}],
|
|
1493
1493
|
/**
|
|
1494
1494
|
* Border Color Y
|
|
1495
1495
|
* @see https://tailwindcss.com/docs/border-color
|
|
1496
1496
|
*/
|
|
1497
1497
|
"border-color-y": [{
|
|
1498
|
-
"border-y": [
|
|
1498
|
+
"border-y": [s]
|
|
1499
1499
|
}],
|
|
1500
1500
|
/**
|
|
1501
1501
|
* Border Color S
|
|
1502
1502
|
* @see https://tailwindcss.com/docs/border-color
|
|
1503
1503
|
*/
|
|
1504
1504
|
"border-color-s": [{
|
|
1505
|
-
"border-s": [
|
|
1505
|
+
"border-s": [s]
|
|
1506
1506
|
}],
|
|
1507
1507
|
/**
|
|
1508
1508
|
* Border Color E
|
|
1509
1509
|
* @see https://tailwindcss.com/docs/border-color
|
|
1510
1510
|
*/
|
|
1511
1511
|
"border-color-e": [{
|
|
1512
|
-
"border-e": [
|
|
1512
|
+
"border-e": [s]
|
|
1513
1513
|
}],
|
|
1514
1514
|
/**
|
|
1515
1515
|
* Border Color Top
|
|
1516
1516
|
* @see https://tailwindcss.com/docs/border-color
|
|
1517
1517
|
*/
|
|
1518
1518
|
"border-color-t": [{
|
|
1519
|
-
"border-t": [
|
|
1519
|
+
"border-t": [s]
|
|
1520
1520
|
}],
|
|
1521
1521
|
/**
|
|
1522
1522
|
* Border Color Right
|
|
1523
1523
|
* @see https://tailwindcss.com/docs/border-color
|
|
1524
1524
|
*/
|
|
1525
1525
|
"border-color-r": [{
|
|
1526
|
-
"border-r": [
|
|
1526
|
+
"border-r": [s]
|
|
1527
1527
|
}],
|
|
1528
1528
|
/**
|
|
1529
1529
|
* Border Color Bottom
|
|
1530
1530
|
* @see https://tailwindcss.com/docs/border-color
|
|
1531
1531
|
*/
|
|
1532
1532
|
"border-color-b": [{
|
|
1533
|
-
"border-b": [
|
|
1533
|
+
"border-b": [s]
|
|
1534
1534
|
}],
|
|
1535
1535
|
/**
|
|
1536
1536
|
* Border Color Left
|
|
1537
1537
|
* @see https://tailwindcss.com/docs/border-color
|
|
1538
1538
|
*/
|
|
1539
1539
|
"border-color-l": [{
|
|
1540
|
-
"border-l": [
|
|
1540
|
+
"border-l": [s]
|
|
1541
1541
|
}],
|
|
1542
1542
|
/**
|
|
1543
1543
|
* Divide Color
|
|
1544
1544
|
* @see https://tailwindcss.com/docs/divide-color
|
|
1545
1545
|
*/
|
|
1546
1546
|
"divide-color": [{
|
|
1547
|
-
divide: [
|
|
1547
|
+
divide: [s]
|
|
1548
1548
|
}],
|
|
1549
1549
|
/**
|
|
1550
1550
|
* Outline Style
|
|
1551
1551
|
* @see https://tailwindcss.com/docs/outline-style
|
|
1552
1552
|
*/
|
|
1553
1553
|
"outline-style": [{
|
|
1554
|
-
outline: ["", ...
|
|
1554
|
+
outline: ["", ...P()]
|
|
1555
1555
|
}],
|
|
1556
1556
|
/**
|
|
1557
1557
|
* Outline Offset
|
|
1558
1558
|
* @see https://tailwindcss.com/docs/outline-offset
|
|
1559
1559
|
*/
|
|
1560
1560
|
"outline-offset": [{
|
|
1561
|
-
"outline-offset": [pe,
|
|
1561
|
+
"outline-offset": [pe, R]
|
|
1562
1562
|
}],
|
|
1563
1563
|
/**
|
|
1564
1564
|
* Outline Width
|
|
@@ -1641,14 +1641,14 @@ const q = (e) => {
|
|
|
1641
1641
|
* @see https://tailwindcss.com/docs/mix-blend-mode
|
|
1642
1642
|
*/
|
|
1643
1643
|
"mix-blend": [{
|
|
1644
|
-
"mix-blend": [...
|
|
1644
|
+
"mix-blend": [...F(), "plus-lighter", "plus-darker"]
|
|
1645
1645
|
}],
|
|
1646
1646
|
/**
|
|
1647
1647
|
* Background Blend Mode
|
|
1648
1648
|
* @see https://tailwindcss.com/docs/background-blend-mode
|
|
1649
1649
|
*/
|
|
1650
1650
|
"bg-blend": [{
|
|
1651
|
-
"bg-blend":
|
|
1651
|
+
"bg-blend": F()
|
|
1652
1652
|
}],
|
|
1653
1653
|
// Filters
|
|
1654
1654
|
/**
|
|
@@ -1678,35 +1678,35 @@ const q = (e) => {
|
|
|
1678
1678
|
* @see https://tailwindcss.com/docs/contrast
|
|
1679
1679
|
*/
|
|
1680
1680
|
contrast: [{
|
|
1681
|
-
contrast: [
|
|
1681
|
+
contrast: [u]
|
|
1682
1682
|
}],
|
|
1683
1683
|
/**
|
|
1684
1684
|
* Drop Shadow
|
|
1685
1685
|
* @see https://tailwindcss.com/docs/drop-shadow
|
|
1686
1686
|
*/
|
|
1687
1687
|
"drop-shadow": [{
|
|
1688
|
-
"drop-shadow": ["", "none", ve,
|
|
1688
|
+
"drop-shadow": ["", "none", ve, R]
|
|
1689
1689
|
}],
|
|
1690
1690
|
/**
|
|
1691
1691
|
* Grayscale
|
|
1692
1692
|
* @see https://tailwindcss.com/docs/grayscale
|
|
1693
1693
|
*/
|
|
1694
1694
|
grayscale: [{
|
|
1695
|
-
grayscale: [
|
|
1695
|
+
grayscale: [l]
|
|
1696
1696
|
}],
|
|
1697
1697
|
/**
|
|
1698
1698
|
* Hue Rotate
|
|
1699
1699
|
* @see https://tailwindcss.com/docs/hue-rotate
|
|
1700
1700
|
*/
|
|
1701
1701
|
"hue-rotate": [{
|
|
1702
|
-
"hue-rotate": [
|
|
1702
|
+
"hue-rotate": [c]
|
|
1703
1703
|
}],
|
|
1704
1704
|
/**
|
|
1705
1705
|
* Invert
|
|
1706
1706
|
* @see https://tailwindcss.com/docs/invert
|
|
1707
1707
|
*/
|
|
1708
1708
|
invert: [{
|
|
1709
|
-
invert: [
|
|
1709
|
+
invert: [d]
|
|
1710
1710
|
}],
|
|
1711
1711
|
/**
|
|
1712
1712
|
* Saturate
|
|
@@ -1720,7 +1720,7 @@ const q = (e) => {
|
|
|
1720
1720
|
* @see https://tailwindcss.com/docs/sepia
|
|
1721
1721
|
*/
|
|
1722
1722
|
sepia: [{
|
|
1723
|
-
sepia: [
|
|
1723
|
+
sepia: [k]
|
|
1724
1724
|
}],
|
|
1725
1725
|
/**
|
|
1726
1726
|
* Backdrop Filter
|
|
@@ -1749,28 +1749,28 @@ const q = (e) => {
|
|
|
1749
1749
|
* @see https://tailwindcss.com/docs/backdrop-contrast
|
|
1750
1750
|
*/
|
|
1751
1751
|
"backdrop-contrast": [{
|
|
1752
|
-
"backdrop-contrast": [
|
|
1752
|
+
"backdrop-contrast": [u]
|
|
1753
1753
|
}],
|
|
1754
1754
|
/**
|
|
1755
1755
|
* Backdrop Grayscale
|
|
1756
1756
|
* @see https://tailwindcss.com/docs/backdrop-grayscale
|
|
1757
1757
|
*/
|
|
1758
1758
|
"backdrop-grayscale": [{
|
|
1759
|
-
"backdrop-grayscale": [
|
|
1759
|
+
"backdrop-grayscale": [l]
|
|
1760
1760
|
}],
|
|
1761
1761
|
/**
|
|
1762
1762
|
* Backdrop Hue Rotate
|
|
1763
1763
|
* @see https://tailwindcss.com/docs/backdrop-hue-rotate
|
|
1764
1764
|
*/
|
|
1765
1765
|
"backdrop-hue-rotate": [{
|
|
1766
|
-
"backdrop-hue-rotate": [
|
|
1766
|
+
"backdrop-hue-rotate": [c]
|
|
1767
1767
|
}],
|
|
1768
1768
|
/**
|
|
1769
1769
|
* Backdrop Invert
|
|
1770
1770
|
* @see https://tailwindcss.com/docs/backdrop-invert
|
|
1771
1771
|
*/
|
|
1772
1772
|
"backdrop-invert": [{
|
|
1773
|
-
"backdrop-invert": [
|
|
1773
|
+
"backdrop-invert": [d]
|
|
1774
1774
|
}],
|
|
1775
1775
|
/**
|
|
1776
1776
|
* Backdrop Opacity
|
|
@@ -1791,7 +1791,7 @@ const q = (e) => {
|
|
|
1791
1791
|
* @see https://tailwindcss.com/docs/backdrop-sepia
|
|
1792
1792
|
*/
|
|
1793
1793
|
"backdrop-sepia": [{
|
|
1794
|
-
"backdrop-sepia": [
|
|
1794
|
+
"backdrop-sepia": [k]
|
|
1795
1795
|
}],
|
|
1796
1796
|
// Tables
|
|
1797
1797
|
/**
|
|
@@ -1842,35 +1842,35 @@ const q = (e) => {
|
|
|
1842
1842
|
* @see https://tailwindcss.com/docs/transition-property
|
|
1843
1843
|
*/
|
|
1844
1844
|
transition: [{
|
|
1845
|
-
transition: ["none", "all", "", "colors", "opacity", "shadow", "transform",
|
|
1845
|
+
transition: ["none", "all", "", "colors", "opacity", "shadow", "transform", R]
|
|
1846
1846
|
}],
|
|
1847
1847
|
/**
|
|
1848
1848
|
* Transition Duration
|
|
1849
1849
|
* @see https://tailwindcss.com/docs/transition-duration
|
|
1850
1850
|
*/
|
|
1851
1851
|
duration: [{
|
|
1852
|
-
duration:
|
|
1852
|
+
duration: g()
|
|
1853
1853
|
}],
|
|
1854
1854
|
/**
|
|
1855
1855
|
* Transition Timing Function
|
|
1856
1856
|
* @see https://tailwindcss.com/docs/transition-timing-function
|
|
1857
1857
|
*/
|
|
1858
1858
|
ease: [{
|
|
1859
|
-
ease: ["linear", "in", "out", "in-out",
|
|
1859
|
+
ease: ["linear", "in", "out", "in-out", R]
|
|
1860
1860
|
}],
|
|
1861
1861
|
/**
|
|
1862
1862
|
* Transition Delay
|
|
1863
1863
|
* @see https://tailwindcss.com/docs/transition-delay
|
|
1864
1864
|
*/
|
|
1865
1865
|
delay: [{
|
|
1866
|
-
delay:
|
|
1866
|
+
delay: g()
|
|
1867
1867
|
}],
|
|
1868
1868
|
/**
|
|
1869
1869
|
* Animation
|
|
1870
1870
|
* @see https://tailwindcss.com/docs/animation
|
|
1871
1871
|
*/
|
|
1872
1872
|
animate: [{
|
|
1873
|
-
animate: ["none", "spin", "ping", "pulse", "bounce",
|
|
1873
|
+
animate: ["none", "spin", "ping", "pulse", "bounce", R]
|
|
1874
1874
|
}],
|
|
1875
1875
|
// Transforms
|
|
1876
1876
|
/**
|
|
@@ -1906,42 +1906,42 @@ const q = (e) => {
|
|
|
1906
1906
|
* @see https://tailwindcss.com/docs/rotate
|
|
1907
1907
|
*/
|
|
1908
1908
|
rotate: [{
|
|
1909
|
-
rotate: [_e,
|
|
1909
|
+
rotate: [_e, R]
|
|
1910
1910
|
}],
|
|
1911
1911
|
/**
|
|
1912
1912
|
* Translate X
|
|
1913
1913
|
* @see https://tailwindcss.com/docs/translate
|
|
1914
1914
|
*/
|
|
1915
1915
|
"translate-x": [{
|
|
1916
|
-
"translate-x": [
|
|
1916
|
+
"translate-x": [y]
|
|
1917
1917
|
}],
|
|
1918
1918
|
/**
|
|
1919
1919
|
* Translate Y
|
|
1920
1920
|
* @see https://tailwindcss.com/docs/translate
|
|
1921
1921
|
*/
|
|
1922
1922
|
"translate-y": [{
|
|
1923
|
-
"translate-y": [
|
|
1923
|
+
"translate-y": [y]
|
|
1924
1924
|
}],
|
|
1925
1925
|
/**
|
|
1926
1926
|
* Skew X
|
|
1927
1927
|
* @see https://tailwindcss.com/docs/skew
|
|
1928
1928
|
*/
|
|
1929
1929
|
"skew-x": [{
|
|
1930
|
-
"skew-x": [
|
|
1930
|
+
"skew-x": [h]
|
|
1931
1931
|
}],
|
|
1932
1932
|
/**
|
|
1933
1933
|
* Skew Y
|
|
1934
1934
|
* @see https://tailwindcss.com/docs/skew
|
|
1935
1935
|
*/
|
|
1936
1936
|
"skew-y": [{
|
|
1937
|
-
"skew-y": [
|
|
1937
|
+
"skew-y": [h]
|
|
1938
1938
|
}],
|
|
1939
1939
|
/**
|
|
1940
1940
|
* Transform Origin
|
|
1941
1941
|
* @see https://tailwindcss.com/docs/transform-origin
|
|
1942
1942
|
*/
|
|
1943
1943
|
"transform-origin": [{
|
|
1944
|
-
origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left",
|
|
1944
|
+
origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", R]
|
|
1945
1945
|
}],
|
|
1946
1946
|
// Interactivity
|
|
1947
1947
|
/**
|
|
@@ -1963,7 +1963,7 @@ const q = (e) => {
|
|
|
1963
1963
|
* @see https://tailwindcss.com/docs/cursor
|
|
1964
1964
|
*/
|
|
1965
1965
|
cursor: [{
|
|
1966
|
-
cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out",
|
|
1966
|
+
cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", R]
|
|
1967
1967
|
}],
|
|
1968
1968
|
/**
|
|
1969
1969
|
* Caret Color
|
|
@@ -2185,7 +2185,7 @@ const q = (e) => {
|
|
|
2185
2185
|
* @see https://tailwindcss.com/docs/will-change
|
|
2186
2186
|
*/
|
|
2187
2187
|
"will-change": [{
|
|
2188
|
-
"will-change": ["auto", "scroll", "contents", "transform",
|
|
2188
|
+
"will-change": ["auto", "scroll", "contents", "transform", R]
|
|
2189
2189
|
}],
|
|
2190
2190
|
// SVG
|
|
2191
2191
|
/**
|
|
@@ -2200,7 +2200,7 @@ const q = (e) => {
|
|
|
2200
2200
|
* @see https://tailwindcss.com/docs/stroke-width
|
|
2201
2201
|
*/
|
|
2202
2202
|
"stroke-w": [{
|
|
2203
|
-
stroke: [pe, Ie,
|
|
2203
|
+
stroke: [pe, Ie, Ve]
|
|
2204
2204
|
}],
|
|
2205
2205
|
/**
|
|
2206
2206
|
* Stroke
|
|
@@ -2281,16 +2281,16 @@ function ro(...e) {
|
|
|
2281
2281
|
}
|
|
2282
2282
|
function _n(e) {
|
|
2283
2283
|
let t = !1, n = "";
|
|
2284
|
-
for (const
|
|
2285
|
-
if (
|
|
2286
|
-
n +=
|
|
2284
|
+
for (const s of e) {
|
|
2285
|
+
if (s === "\\") {
|
|
2286
|
+
n += s, t = !t;
|
|
2287
2287
|
continue;
|
|
2288
2288
|
}
|
|
2289
|
-
if (
|
|
2289
|
+
if (s === "'" && !t) {
|
|
2290
2290
|
n += '"';
|
|
2291
2291
|
continue;
|
|
2292
2292
|
}
|
|
2293
|
-
n +=
|
|
2293
|
+
n += s, t = !1;
|
|
2294
2294
|
}
|
|
2295
2295
|
return n.replace(/\bTrue\b/g, "true").replace(/\bFalse\b/g, "false").replace(/\bNone\b/g, "null");
|
|
2296
2296
|
}
|
|
@@ -2372,8 +2372,8 @@ function De(e) {
|
|
|
2372
2372
|
if (n === "data" && typeof r == "string" && r.length > 100)
|
|
2373
2373
|
t[n] = `[base64 ${r.length} chars omitted]`;
|
|
2374
2374
|
else {
|
|
2375
|
-
const
|
|
2376
|
-
|
|
2375
|
+
const s = De(r);
|
|
2376
|
+
s !== void 0 && (t[n] = s);
|
|
2377
2377
|
}
|
|
2378
2378
|
}
|
|
2379
2379
|
if (Object.keys(t).length)
|
|
@@ -2404,8 +2404,8 @@ function oo(e) {
|
|
|
2404
2404
|
function Fn(e) {
|
|
2405
2405
|
const t = (r) => {
|
|
2406
2406
|
try {
|
|
2407
|
-
const
|
|
2408
|
-
return typeof
|
|
2407
|
+
const s = De(r);
|
|
2408
|
+
return typeof s == "string" ? s : JSON.stringify(s ?? "");
|
|
2409
2409
|
} catch {
|
|
2410
2410
|
return "";
|
|
2411
2411
|
}
|
|
@@ -2448,26 +2448,26 @@ function fe(e) {
|
|
|
2448
2448
|
);
|
|
2449
2449
|
}
|
|
2450
2450
|
function nt(e) {
|
|
2451
|
-
var x, S, A, w,
|
|
2451
|
+
var x, S, A, w, k, h, T;
|
|
2452
2452
|
if (!e || typeof e != "object") return null;
|
|
2453
2453
|
const t = fe(e), n = Kn(t);
|
|
2454
2454
|
if (!n)
|
|
2455
2455
|
return null;
|
|
2456
|
-
const r = t.toolCalls ?? ((x = t.additionalKwargs) == null ? void 0 : x.toolCalls),
|
|
2456
|
+
const r = t.toolCalls ?? ((x = t.additionalKwargs) == null ? void 0 : x.toolCalls), s = Array.isArray(r) ? r.map(rt) : void 0, o = Dn(t.content ?? t.parts, !!(s != null && s.length)), a = t.id ?? `msg-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`, i = t.createdAt ?? ((S = t.additionalKwargs) == null ? void 0 : S.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(), u = t.name ?? ((A = t.additionalKwargs) == null ? void 0 : A.agentName) ?? void 0, l = t.model ?? ((w = t.additionalKwargs) == null ? void 0 : w.model) ?? void 0, c = t.toolCallId ?? void 0, d = t.additionalKwargs ?? void 0, p = t.responseMetadata ?? void 0, m = t.checkpointId ?? ((k = t.additionalKwargs) == null ? void 0 : k.checkpointId) ?? void 0, v = t.checkpointNs ?? ((h = t.additionalKwargs) == null ? void 0 : h.checkpointNs) ?? void 0, f = typeof t.toolStreaming == "boolean" ? t.toolStreaming : !!((T = t.additionalKwargs) != null && T.toolStreaming);
|
|
2457
2457
|
return {
|
|
2458
2458
|
...t,
|
|
2459
2459
|
id: a,
|
|
2460
2460
|
role: n,
|
|
2461
|
-
content:
|
|
2461
|
+
content: o,
|
|
2462
2462
|
createdAt: i,
|
|
2463
|
-
name:
|
|
2464
|
-
model:
|
|
2465
|
-
toolCallId:
|
|
2466
|
-
toolCalls:
|
|
2467
|
-
checkpointId:
|
|
2468
|
-
checkpointNs:
|
|
2469
|
-
toolStreaming:
|
|
2470
|
-
additionalKwargs:
|
|
2463
|
+
name: u,
|
|
2464
|
+
model: l,
|
|
2465
|
+
toolCallId: c,
|
|
2466
|
+
toolCalls: s,
|
|
2467
|
+
checkpointId: m,
|
|
2468
|
+
checkpointNs: v,
|
|
2469
|
+
toolStreaming: f,
|
|
2470
|
+
additionalKwargs: d,
|
|
2471
2471
|
responseMetadata: p,
|
|
2472
2472
|
artifact: t.artifact && typeof t.artifact == "object" && !t.artifact.type ? { ...t.artifact, type: t.name } : t.artifact ?? void 0
|
|
2473
2473
|
};
|
|
@@ -2512,66 +2512,66 @@ function dt(e) {
|
|
|
2512
2512
|
function ut(e) {
|
|
2513
2513
|
return (Array.isArray(e.toolCalls) ? e.toolCalls : Mt(e)).map(rt);
|
|
2514
2514
|
}
|
|
2515
|
-
function
|
|
2515
|
+
function qe(e, t) {
|
|
2516
2516
|
return t.find(
|
|
2517
2517
|
(n) => n.role === "tool" && (n.toolCallId === e || n.id === e)
|
|
2518
2518
|
);
|
|
2519
2519
|
}
|
|
2520
|
-
function
|
|
2520
|
+
function Hn(e, t) {
|
|
2521
2521
|
const n = t.response ?? t.content;
|
|
2522
2522
|
if (!n) return;
|
|
2523
2523
|
const r = typeof n == "string" ? n : Et(n);
|
|
2524
2524
|
if (!r.trim()) return;
|
|
2525
|
-
const
|
|
2525
|
+
const s = [{ type: "text", text: r }];
|
|
2526
2526
|
return {
|
|
2527
2527
|
id: `tool-${t.id}`,
|
|
2528
2528
|
role: "tool",
|
|
2529
|
-
content:
|
|
2529
|
+
content: s,
|
|
2530
2530
|
name: t.name,
|
|
2531
2531
|
toolCallId: t.id,
|
|
2532
2532
|
artifact: t.artifact,
|
|
2533
2533
|
createdAt: e.createdAt
|
|
2534
2534
|
};
|
|
2535
2535
|
}
|
|
2536
|
-
function
|
|
2536
|
+
function Vn(e, t = []) {
|
|
2537
2537
|
if (Array.isArray(e)) {
|
|
2538
|
-
const
|
|
2539
|
-
return
|
|
2540
|
-
var
|
|
2541
|
-
const i =
|
|
2542
|
-
if (i && !a.content &&
|
|
2543
|
-
const
|
|
2544
|
-
typeof
|
|
2538
|
+
const s = e.filter((a) => a.role === "assistant").flatMap((a) => ut(a)), o = /* @__PURE__ */ new Map();
|
|
2539
|
+
return s.forEach((a) => o.set(a.id, a)), Array.from(o.values()).map((a) => {
|
|
2540
|
+
var d, p, m;
|
|
2541
|
+
const i = qe(a.id, e) || qe(a.id, t), u = Array.isArray((d = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : d.toolProgress) ? (p = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : p.toolProgress : void 0, l = (i == null ? void 0 : i.artifact) ?? a.artifact, c = dt(a.status) ?? ((m = i == null ? void 0 : i.additionalKwargs) != null && m.toolStreaming ? "pending" : null) ?? (i ? "completed" : "pending");
|
|
2542
|
+
if (i && !a.content && c === "completed") {
|
|
2543
|
+
const v = ue(i);
|
|
2544
|
+
typeof v == "string" && (a.content = v);
|
|
2545
2545
|
}
|
|
2546
2546
|
return {
|
|
2547
2547
|
call: a,
|
|
2548
2548
|
result: i,
|
|
2549
|
-
state:
|
|
2550
|
-
progress:
|
|
2551
|
-
artifact:
|
|
2549
|
+
state: c,
|
|
2550
|
+
progress: u,
|
|
2551
|
+
artifact: l
|
|
2552
2552
|
};
|
|
2553
2553
|
});
|
|
2554
2554
|
}
|
|
2555
2555
|
if (e.role !== "assistant") return [];
|
|
2556
2556
|
const n = ut(e);
|
|
2557
2557
|
return n.length === 0 ? [] : n.map((r) => {
|
|
2558
|
-
var
|
|
2559
|
-
const
|
|
2560
|
-
if (
|
|
2561
|
-
const
|
|
2562
|
-
typeof
|
|
2558
|
+
var u, l, c;
|
|
2559
|
+
const s = qe(r.id, t) ?? Hn(e, r), o = Array.isArray((u = s == null ? void 0 : s.additionalKwargs) == null ? void 0 : u.toolProgress) ? (l = s == null ? void 0 : s.additionalKwargs) == null ? void 0 : l.toolProgress : void 0, a = (s == null ? void 0 : s.artifact) ?? r.artifact, i = dt(r.status) ?? ((c = s == null ? void 0 : s.additionalKwargs) != null && c.toolStreaming ? "pending" : null) ?? (s ? "completed" : "pending");
|
|
2560
|
+
if (s && !r.content && i === "completed") {
|
|
2561
|
+
const d = ue(s);
|
|
2562
|
+
typeof d == "string" && (r.content = d);
|
|
2563
2563
|
}
|
|
2564
2564
|
return {
|
|
2565
2565
|
call: r,
|
|
2566
|
-
result:
|
|
2566
|
+
result: s,
|
|
2567
2567
|
state: i,
|
|
2568
|
-
progress:
|
|
2568
|
+
progress: o,
|
|
2569
2569
|
artifact: a
|
|
2570
2570
|
};
|
|
2571
2571
|
});
|
|
2572
2572
|
}
|
|
2573
2573
|
function ao(e, t = []) {
|
|
2574
|
-
return
|
|
2574
|
+
return Vn(e, t).map((n) => n.artifact).filter((n) => !!n);
|
|
2575
2575
|
}
|
|
2576
2576
|
const ze = {
|
|
2577
2577
|
authToken: "authToken",
|
|
@@ -2596,8 +2596,8 @@ function xe(e) {
|
|
|
2596
2596
|
function _t(e) {
|
|
2597
2597
|
return Qe.add(e), () => Qe.delete(e);
|
|
2598
2598
|
}
|
|
2599
|
-
const
|
|
2600
|
-
let Ye =
|
|
2599
|
+
const qn = 12e4, Gn = 12e4;
|
|
2600
|
+
let Ye = qn, Nt = Gn;
|
|
2601
2601
|
const oe = Jt.create({
|
|
2602
2602
|
// BaseURL is set dynamically via ApiProvider -> api.updateConfig
|
|
2603
2603
|
timeout: Ye,
|
|
@@ -2618,10 +2618,10 @@ oe.interceptors.response.use(
|
|
|
2618
2618
|
(e) => {
|
|
2619
2619
|
if (typeof window < "u" && (e != null && e.data))
|
|
2620
2620
|
try {
|
|
2621
|
-
const t = e.data, n = t.data || {}, r = typeof t.token == "string" && t.token || typeof n.token == "string" && n.token || null,
|
|
2622
|
-
r && (localStorage.setItem(ze.authToken, r), xe(r)),
|
|
2621
|
+
const t = e.data, n = t.data || {}, r = typeof t.token == "string" && t.token || typeof n.token == "string" && n.token || null, s = typeof t.expires_at == "number" && t.expires_at || typeof n.expires_at == "number" && n.expires_at || typeof t.expiresAt == "number" && t.expiresAt || typeof n.expiresAt == "number" && n.expiresAt || null;
|
|
2622
|
+
r && (localStorage.setItem(ze.authToken, r), xe(r)), s && localStorage.setItem(ze.authTokenExpiresAt, s.toString()), (r || s) && window.dispatchEvent(
|
|
2623
2623
|
new CustomEvent("smartorg:chat-token-updated", {
|
|
2624
|
-
detail: { token: r, expiresAt:
|
|
2624
|
+
detail: { token: r, expiresAt: s }
|
|
2625
2625
|
})
|
|
2626
2626
|
);
|
|
2627
2627
|
} catch (t) {
|
|
@@ -2684,8 +2684,8 @@ class Yn {
|
|
|
2684
2684
|
async createThread(t, n) {
|
|
2685
2685
|
const r = {};
|
|
2686
2686
|
t && (r.title = t), n && (r.project = n);
|
|
2687
|
-
const
|
|
2688
|
-
return le(
|
|
2687
|
+
const s = await Ze("/threads", Object.keys(r).length ? r : void 0);
|
|
2688
|
+
return le(s);
|
|
2689
2689
|
}
|
|
2690
2690
|
async updateThread(t, n) {
|
|
2691
2691
|
const r = await Xn(`/threads/${t}`, { title: n });
|
|
@@ -2748,11 +2748,11 @@ class Zn {
|
|
|
2748
2748
|
async fetchFileBlob(t, n) {
|
|
2749
2749
|
return await ae(t, {
|
|
2750
2750
|
responseType: "blob",
|
|
2751
|
-
onDownloadProgress: (
|
|
2751
|
+
onDownloadProgress: (s) => {
|
|
2752
2752
|
try {
|
|
2753
|
-
if (n &&
|
|
2754
|
-
const
|
|
2755
|
-
n(
|
|
2753
|
+
if (n && s.lengthComputable) {
|
|
2754
|
+
const o = s.loaded / s.total;
|
|
2755
|
+
n(o);
|
|
2756
2756
|
}
|
|
2757
2757
|
} catch {
|
|
2758
2758
|
}
|
|
@@ -2762,8 +2762,8 @@ class Zn {
|
|
|
2762
2762
|
});
|
|
2763
2763
|
}
|
|
2764
2764
|
async viewFileById(t, n) {
|
|
2765
|
-
const r = await this.fetchFileBlob(`/files/${t}/view`, n),
|
|
2766
|
-
window.open(
|
|
2765
|
+
const r = await this.fetchFileBlob(`/files/${t}/view`, n), s = URL.createObjectURL(r);
|
|
2766
|
+
window.open(s, "_blank"), setTimeout(() => URL.revokeObjectURL(s), 6e4);
|
|
2767
2767
|
}
|
|
2768
2768
|
async getFileBlob(t, n) {
|
|
2769
2769
|
return await this.fetchFileBlob(`/files/${t}/view`, n);
|
|
@@ -2772,30 +2772,30 @@ class Zn {
|
|
|
2772
2772
|
return await (await this.fetchFileBlob(`/files/${t}/view`, n)).text();
|
|
2773
2773
|
}
|
|
2774
2774
|
async downloadFileById(t, n) {
|
|
2775
|
-
const r = await this.fetchFileBlob(`/files/${t}/download`, n),
|
|
2776
|
-
let
|
|
2775
|
+
const r = await this.fetchFileBlob(`/files/${t}/download`, n), s = URL.createObjectURL(r);
|
|
2776
|
+
let o = `file_${t}`;
|
|
2777
2777
|
try {
|
|
2778
2778
|
const i = await ae(`/files/${t}`);
|
|
2779
|
-
|
|
2779
|
+
o = (i == null ? void 0 : i.filename) ?? o;
|
|
2780
2780
|
} catch {
|
|
2781
2781
|
}
|
|
2782
2782
|
const a = document.createElement("a");
|
|
2783
|
-
a.href =
|
|
2783
|
+
a.href = s, a.download = o, document.body.appendChild(a), a.click(), a.remove(), setTimeout(() => URL.revokeObjectURL(s), 6e4);
|
|
2784
2784
|
}
|
|
2785
2785
|
async getFileInfo(t) {
|
|
2786
2786
|
return await ae(`/files/${t}`);
|
|
2787
2787
|
}
|
|
2788
2788
|
async listFiles(t, n = 50, r = 0) {
|
|
2789
|
-
const
|
|
2790
|
-
return t && (
|
|
2789
|
+
const s = { limit: n, offset: r };
|
|
2790
|
+
return t && (s.thread_id = t), await ae("/files", { params: s });
|
|
2791
2791
|
}
|
|
2792
2792
|
async uploadFile(t, n, r) {
|
|
2793
|
-
const
|
|
2794
|
-
return
|
|
2795
|
-
onUploadProgress: (
|
|
2793
|
+
const s = new FormData();
|
|
2794
|
+
return s.append("file", t), n && s.append("thread_id", n), await Ze("/files/upload-form", s, {
|
|
2795
|
+
onUploadProgress: (o) => {
|
|
2796
2796
|
try {
|
|
2797
|
-
if (r &&
|
|
2798
|
-
const a =
|
|
2797
|
+
if (r && o.lengthComputable) {
|
|
2798
|
+
const a = o.loaded / o.total;
|
|
2799
2799
|
r(a);
|
|
2800
2800
|
}
|
|
2801
2801
|
} catch {
|
|
@@ -2842,53 +2842,53 @@ const tr = new er(), Lt = Ce(null);
|
|
|
2842
2842
|
function nr({ children: e, apiConfig: t }) {
|
|
2843
2843
|
const n = zt, r = tr;
|
|
2844
2844
|
if (t) {
|
|
2845
|
-
const
|
|
2846
|
-
(t.baseUrl || t.chatBaseUrl ||
|
|
2845
|
+
const o = n.baseUrl, a = r.baseUrl, i = n.getAuthToken(), u = t.requestTimeoutMs !== void 0 || t.historyTimeoutMs !== void 0;
|
|
2846
|
+
(t.baseUrl || t.chatBaseUrl || u) && (u || t.chatBaseUrl && t.chatBaseUrl !== o || t.baseUrl && !o.startsWith(t.baseUrl)) && n.updateConfig(t), (t.baseUrl || t.authBaseUrl) && (t.authBaseUrl && t.authBaseUrl !== a || t.baseUrl && !a.startsWith(t.baseUrl)) && r.updateConfig(t), t.apiKey !== void 0 && t.apiKey !== i && (n.updateConfig({ apiKey: t.apiKey }), r.updateConfig({ apiKey: t.apiKey }));
|
|
2847
2847
|
}
|
|
2848
|
-
const
|
|
2848
|
+
const s = {
|
|
2849
2849
|
token: n.getAuthToken(),
|
|
2850
|
-
setToken: (
|
|
2851
|
-
n.setAuthToken(
|
|
2850
|
+
setToken: (o) => {
|
|
2851
|
+
n.setAuthToken(o), r.setAuthToken(o);
|
|
2852
2852
|
},
|
|
2853
2853
|
chatApi: n,
|
|
2854
2854
|
authApi: r,
|
|
2855
2855
|
fileApi: Rt,
|
|
2856
2856
|
baseUrl: n.baseUrl
|
|
2857
2857
|
};
|
|
2858
|
-
return /* @__PURE__ */ de(Lt.Provider, { value:
|
|
2858
|
+
return /* @__PURE__ */ de(Lt.Provider, { value: s, children: e });
|
|
2859
2859
|
}
|
|
2860
2860
|
async function rr(e) {
|
|
2861
2861
|
return await new Promise((t, n) => {
|
|
2862
2862
|
const r = new FileReader();
|
|
2863
2863
|
r.onload = () => {
|
|
2864
2864
|
try {
|
|
2865
|
-
const
|
|
2865
|
+
const s = r.result, o = new Uint8Array(s);
|
|
2866
2866
|
let a = "";
|
|
2867
|
-
const i =
|
|
2868
|
-
for (let
|
|
2867
|
+
const i = o.byteLength;
|
|
2868
|
+
for (let u = 0; u < i; u++) a += String.fromCharCode(o[u]);
|
|
2869
2869
|
t(btoa(a));
|
|
2870
|
-
} catch (
|
|
2871
|
-
n(
|
|
2870
|
+
} catch (s) {
|
|
2871
|
+
n(s);
|
|
2872
2872
|
}
|
|
2873
|
-
}, r.onerror = (
|
|
2873
|
+
}, r.onerror = (s) => n(s), r.readAsArrayBuffer(e);
|
|
2874
2874
|
});
|
|
2875
2875
|
}
|
|
2876
2876
|
async function or(e = []) {
|
|
2877
2877
|
const t = [], n = [];
|
|
2878
2878
|
for (const r of e)
|
|
2879
2879
|
try {
|
|
2880
|
-
const
|
|
2880
|
+
const s = await rr(r), o = r.type || "application/octet-stream";
|
|
2881
2881
|
n.push({
|
|
2882
2882
|
filename: r.name,
|
|
2883
|
-
data:
|
|
2884
|
-
mime_type:
|
|
2885
|
-
}),
|
|
2883
|
+
data: s,
|
|
2884
|
+
mime_type: o
|
|
2885
|
+
}), o.startsWith("image/") ? t.push({
|
|
2886
2886
|
type: "image_url",
|
|
2887
|
-
image_url: { url: `data:${
|
|
2887
|
+
image_url: { url: `data:${o};base64,${s}` }
|
|
2888
2888
|
}) : t.push({
|
|
2889
2889
|
type: "file",
|
|
2890
|
-
url: `data:${
|
|
2891
|
-
mimeType:
|
|
2890
|
+
url: `data:${o};base64,${s}`,
|
|
2891
|
+
mimeType: o,
|
|
2892
2892
|
name: r.name,
|
|
2893
2893
|
size: r.size
|
|
2894
2894
|
});
|
|
@@ -2927,8 +2927,8 @@ function lo(e) {
|
|
|
2927
2927
|
default:
|
|
2928
2928
|
return a.type === "interrupt" ? "interrupt" : "unknown";
|
|
2929
2929
|
}
|
|
2930
|
-
}).join("|") : "", r = "checkpointId" in e && e.checkpointId ? `cp:${e.checkpointId}` : "",
|
|
2931
|
-
return `${e.id}:${t}:${n}${
|
|
2930
|
+
}).join("|") : "", r = "checkpointId" in e && e.checkpointId ? `cp:${e.checkpointId}` : "", s = "checkpointNs" in e && e.checkpointNs ? `ns:${e.checkpointNs}` : "", o = [r, s].filter(Boolean).join("|");
|
|
2931
|
+
return `${e.id}:${t}:${n}${o ? `:${o}` : ""}`;
|
|
2932
2932
|
}
|
|
2933
2933
|
function Me() {
|
|
2934
2934
|
const e = je(Lt);
|
|
@@ -3009,134 +3009,134 @@ function fr(e, t) {
|
|
|
3009
3009
|
return "type" in n || (n.type = e), n;
|
|
3010
3010
|
}
|
|
3011
3011
|
function pr(e = {}) {
|
|
3012
|
-
const t = e.baseUrl || "", n = e.streamPath ?? "/stream", [r,
|
|
3012
|
+
const t = e.baseUrl || "", n = e.streamPath ?? "/stream", [r, s] = H(e.token ?? null), o = W(e.headers ?? {}), a = e.credentials ?? "include", i = W(e);
|
|
3013
3013
|
Y(() => {
|
|
3014
3014
|
i.current = e;
|
|
3015
3015
|
}, [e]);
|
|
3016
|
-
const
|
|
3017
|
-
var
|
|
3018
|
-
const
|
|
3019
|
-
if (!
|
|
3020
|
-
(
|
|
3021
|
-
}, []), [
|
|
3022
|
-
|
|
3023
|
-
}, []),
|
|
3024
|
-
p(null),
|
|
3025
|
-
}, []),
|
|
3016
|
+
const u = _((y) => {
|
|
3017
|
+
var L, M, $, U, V, P, F, N, j, G;
|
|
3018
|
+
const I = i.current;
|
|
3019
|
+
if (!I) return;
|
|
3020
|
+
(L = I.onEvent) == null || L.call(I, y), y.type === "thread_info" && ((M = I.onThreadInfo) == null || M.call(I, y)), y.type === "values" && (($ = I.handleValuesEvent) == null || $.call(I, y)), y.type === "metadata" && ((U = I.onMetadataEvent) == null || U.call(I, y)), typeof y.type == "string" && (y.type === "custom" || y.type.startsWith("custom.")) && ((V = I.onCustomEvent) == null || V.call(I, y)), y.type === "updates" && ((P = I.onUpdateEvent) == null || P.call(I, y)), y.type === "tool.end" ? (F = I.onToolEnd) == null || F.call(I, y) : y.type === "tool.start" && ((N = I.onToolStart) == null || N.call(I, y)), y.type === "heartbeat" && ((j = I.onHeartbeat) == null || j.call(I, y)), y.type === "token" && ((G = I.onToken) == null || G.call(I, y.token));
|
|
3021
|
+
}, []), [l, c] = H(!1), [d, p] = H(null), [m, v] = H(!1), [f, b] = H(null), x = W(null), S = W(!0), A = W(null), w = _((y) => {
|
|
3022
|
+
s(y);
|
|
3023
|
+
}, []), k = _(() => {
|
|
3024
|
+
p(null), b(null);
|
|
3025
|
+
}, []), h = _(() => {
|
|
3026
3026
|
var M, $;
|
|
3027
3027
|
console.debug("[use-chat] stop() invoked - aborting stream");
|
|
3028
|
-
const
|
|
3029
|
-
var
|
|
3030
|
-
(
|
|
3028
|
+
const y = (M = A.current) == null ? void 0 : M.threadId, I = ($ = A.current) == null ? void 0 : $.runId, E = () => {
|
|
3029
|
+
var U;
|
|
3030
|
+
(U = x.current) == null || U.abort(), x.current = null, A.current = null, c(!1), v(!1);
|
|
3031
3031
|
};
|
|
3032
|
-
(
|
|
3033
|
-
console.warn("[use-chat] cancel run failed:",
|
|
3032
|
+
(I || y ? zt.cancelRun(I || y).catch((U) => {
|
|
3033
|
+
console.warn("[use-chat] cancel run failed:", U);
|
|
3034
3034
|
}) : Promise.resolve()).finally(E);
|
|
3035
|
-
}, []), T =
|
|
3036
|
-
(
|
|
3035
|
+
}, []), T = _(
|
|
3036
|
+
(y) => {
|
|
3037
3037
|
x.current && (x.current.abort(), x.current = null);
|
|
3038
|
-
const
|
|
3039
|
-
text: typeof
|
|
3040
|
-
threadId:
|
|
3041
|
-
attachments:
|
|
3042
|
-
payload:
|
|
3043
|
-
...
|
|
3044
|
-
creativityLevel:
|
|
3038
|
+
const I = {
|
|
3039
|
+
text: typeof y.content == "string" ? y.content : y.text,
|
|
3040
|
+
threadId: y.threadId,
|
|
3041
|
+
attachments: y.attachments,
|
|
3042
|
+
payload: y.payload ? {
|
|
3043
|
+
...y.payload,
|
|
3044
|
+
creativityLevel: y.payload.creativityLevel ?? "medium"
|
|
3045
3045
|
} : { creativityLevel: "medium" },
|
|
3046
|
-
config:
|
|
3047
|
-
checkpointId:
|
|
3048
|
-
checkpointNs:
|
|
3049
|
-
edit:
|
|
3050
|
-
command:
|
|
3046
|
+
config: y.config,
|
|
3047
|
+
checkpointId: y.checkpointId,
|
|
3048
|
+
checkpointNs: y.checkpointNs || void 0,
|
|
3049
|
+
edit: y.edit ?? !1,
|
|
3050
|
+
command: y.command
|
|
3051
3051
|
};
|
|
3052
|
-
|
|
3052
|
+
c(!0), p(null), b(null);
|
|
3053
3053
|
const E = new AbortController();
|
|
3054
3054
|
x.current = E;
|
|
3055
|
-
let
|
|
3055
|
+
let L = null, M = !1;
|
|
3056
3056
|
return A.current = {
|
|
3057
|
-
threadId:
|
|
3057
|
+
threadId: I.threadId ?? void 0,
|
|
3058
3058
|
runId: void 0,
|
|
3059
3059
|
// Will be updated from headers
|
|
3060
3060
|
headers: {},
|
|
3061
3061
|
isStreaming: !0
|
|
3062
3062
|
}, (async () => {
|
|
3063
|
-
var $,
|
|
3063
|
+
var $, U, V, P, F, N;
|
|
3064
3064
|
try {
|
|
3065
|
-
let
|
|
3065
|
+
let j = {};
|
|
3066
3066
|
try {
|
|
3067
3067
|
if (r)
|
|
3068
|
-
|
|
3068
|
+
j = { Authorization: `Bearer ${r}` };
|
|
3069
3069
|
else if (typeof window < "u") {
|
|
3070
3070
|
const se = window.__AUTH_TOKEN__, he = (($ = window.localStorage) == null ? void 0 : $.getItem(ze.authToken)) || null;
|
|
3071
3071
|
let X = null;
|
|
3072
3072
|
try {
|
|
3073
|
-
const be = (
|
|
3074
|
-
be && (X = ((
|
|
3073
|
+
const be = (U = window.localStorage) == null ? void 0 : U.getItem(ze.chatSettings);
|
|
3074
|
+
be && (X = ((V = JSON.parse(be)) == null ? void 0 : V.apiKey) || null);
|
|
3075
3075
|
} catch {
|
|
3076
3076
|
}
|
|
3077
3077
|
const Q = se || he || X || null;
|
|
3078
|
-
Q && (
|
|
3078
|
+
Q && (j = { Authorization: `Bearer ${Q}` });
|
|
3079
3079
|
}
|
|
3080
3080
|
} catch {
|
|
3081
3081
|
}
|
|
3082
3082
|
console.debug("[use-chat] POST", t + n);
|
|
3083
|
-
let
|
|
3083
|
+
let G = {};
|
|
3084
3084
|
if (typeof window < "u")
|
|
3085
3085
|
try {
|
|
3086
|
-
const
|
|
3087
|
-
|
|
3086
|
+
const J = (P = window.localStorage) == null ? void 0 : P.getItem(ze.authSessionId);
|
|
3087
|
+
J && (G = { "X-Session-Id": J });
|
|
3088
3088
|
} catch {
|
|
3089
3089
|
}
|
|
3090
|
-
const
|
|
3091
|
-
...
|
|
3092
|
-
...
|
|
3093
|
-
...
|
|
3094
|
-
},
|
|
3090
|
+
const g = {
|
|
3091
|
+
...j,
|
|
3092
|
+
...G,
|
|
3093
|
+
...o.current
|
|
3094
|
+
}, z = {
|
|
3095
3095
|
"Content-Type": "application/json",
|
|
3096
3096
|
Accept: "text/event-stream",
|
|
3097
|
-
...
|
|
3097
|
+
...g
|
|
3098
3098
|
}, C = await fetch(t + n, {
|
|
3099
3099
|
method: "POST",
|
|
3100
|
-
headers:
|
|
3101
|
-
body: JSON.stringify(
|
|
3100
|
+
headers: z,
|
|
3101
|
+
body: JSON.stringify(I),
|
|
3102
3102
|
signal: E.signal,
|
|
3103
3103
|
credentials: a
|
|
3104
3104
|
});
|
|
3105
|
-
if (A.current && (A.current.headers =
|
|
3106
|
-
const
|
|
3105
|
+
if (A.current && (A.current.headers = g), !C.ok || !C.body) {
|
|
3106
|
+
const J = await C.text().catch(() => "");
|
|
3107
3107
|
console.debug(
|
|
3108
3108
|
"[use-chat] non-OK response",
|
|
3109
3109
|
C.status,
|
|
3110
|
-
|
|
3110
|
+
J == null ? void 0 : J.slice(0, 500)
|
|
3111
3111
|
);
|
|
3112
|
-
const se = `stream ${C.status}${
|
|
3113
|
-
throw se && (p(se),
|
|
3112
|
+
const se = `stream ${C.status}${J ? ": " + J : ""}`;
|
|
3113
|
+
throw se && (p(se), L = "error"), new Error(se);
|
|
3114
3114
|
}
|
|
3115
|
-
|
|
3116
|
-
const
|
|
3117
|
-
let K = "",
|
|
3115
|
+
v(!0);
|
|
3116
|
+
const O = C.body.getReader(), D = new TextDecoder();
|
|
3117
|
+
let K = "", B = 0, ee = Date.now();
|
|
3118
3118
|
const ie = setInterval(() => {
|
|
3119
|
-
Date.now() - ee > 18e5 && (p("Stream idle timeout"),
|
|
3119
|
+
Date.now() - ee > 18e5 && (p("Stream idle timeout"), L = "error", E.abort());
|
|
3120
3120
|
}, 5e3), ye = 1024 * 1024;
|
|
3121
3121
|
try {
|
|
3122
|
-
const
|
|
3122
|
+
const J = C.headers.get("X-Thread-Id") || C.headers.get("x-thread-id"), se = C.headers.get("X-Run-Id") || C.headers.get("x-run-id");
|
|
3123
3123
|
for (A.current && (A.current = {
|
|
3124
3124
|
...A.current,
|
|
3125
|
-
threadId:
|
|
3125
|
+
threadId: J ?? A.current.threadId,
|
|
3126
3126
|
runId: se ?? A.current.runId
|
|
3127
3127
|
}); ; ) {
|
|
3128
|
-
const { value: he, done: X } = await
|
|
3128
|
+
const { value: he, done: X } = await O.read();
|
|
3129
3129
|
if (X) break;
|
|
3130
|
-
K +=
|
|
3130
|
+
K += D.decode(he, { stream: !0 }), K.length > ye && (K = "", console.warn("Stream buffer reset: exceeded 1MB"));
|
|
3131
3131
|
let Q;
|
|
3132
3132
|
for (; (Q = K.indexOf(`
|
|
3133
3133
|
|
|
3134
3134
|
`)) >= 0; ) {
|
|
3135
3135
|
const be = K.slice(0, Q);
|
|
3136
3136
|
K = K.slice(Q + 2);
|
|
3137
|
-
const
|
|
3137
|
+
const He = be.split(/\r?\n/), we = [];
|
|
3138
3138
|
let Pe = null;
|
|
3139
|
-
for (const ce of
|
|
3139
|
+
for (const ce of He)
|
|
3140
3140
|
if (!ce.startsWith(":") && ce) {
|
|
3141
3141
|
if (ce.startsWith("event:")) {
|
|
3142
3142
|
const Ae = ce.slice(6).trim();
|
|
@@ -3168,85 +3168,85 @@ function pr(e = {}) {
|
|
|
3168
3168
|
ee = Date.now();
|
|
3169
3169
|
const te = typeof re.seq == "number" ? re.seq : void 0;
|
|
3170
3170
|
if (te !== void 0) {
|
|
3171
|
-
if (te <=
|
|
3172
|
-
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: te, lastProcessedSeq:
|
|
3171
|
+
if (te <= B) {
|
|
3172
|
+
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: te, lastProcessedSeq: B, type: re.type });
|
|
3173
3173
|
continue;
|
|
3174
3174
|
}
|
|
3175
|
-
|
|
3175
|
+
B = te;
|
|
3176
3176
|
}
|
|
3177
|
-
|
|
3177
|
+
u(re);
|
|
3178
3178
|
}
|
|
3179
3179
|
}
|
|
3180
|
-
|
|
3181
|
-
} catch (
|
|
3182
|
-
if (
|
|
3183
|
-
|
|
3180
|
+
L === null && !E.signal.aborted && (L = "complete");
|
|
3181
|
+
} catch (J) {
|
|
3182
|
+
if (J.name === "AbortError")
|
|
3183
|
+
L = L ?? "aborted";
|
|
3184
3184
|
else {
|
|
3185
|
-
const se =
|
|
3186
|
-
|
|
3185
|
+
const se = J.message || String(J);
|
|
3186
|
+
L = "error", p(se);
|
|
3187
3187
|
}
|
|
3188
3188
|
} finally {
|
|
3189
3189
|
try {
|
|
3190
|
-
await
|
|
3190
|
+
await O.cancel();
|
|
3191
3191
|
} catch {
|
|
3192
3192
|
} finally {
|
|
3193
|
-
(
|
|
3193
|
+
(F = O.releaseLock) == null || F.call(O);
|
|
3194
3194
|
}
|
|
3195
3195
|
clearInterval(ie);
|
|
3196
3196
|
}
|
|
3197
|
-
} catch (
|
|
3198
|
-
if (
|
|
3199
|
-
|
|
3197
|
+
} catch (j) {
|
|
3198
|
+
if (j.name === "AbortError")
|
|
3199
|
+
L = L ?? "aborted";
|
|
3200
3200
|
else {
|
|
3201
|
-
const
|
|
3202
|
-
|
|
3201
|
+
const G = j.message || String(j);
|
|
3202
|
+
L = "error", p(G), M || (M = !0, (N = e.onConnectionError) == null || N.call(e, G));
|
|
3203
3203
|
}
|
|
3204
3204
|
} finally {
|
|
3205
3205
|
try {
|
|
3206
3206
|
if (e.onFinish) {
|
|
3207
|
-
const
|
|
3207
|
+
const j = {
|
|
3208
3208
|
lastSeq: 0,
|
|
3209
3209
|
lastCheckpointId: null,
|
|
3210
3210
|
lastCheckpointNs: null,
|
|
3211
3211
|
lastValues: null
|
|
3212
3212
|
// Let the reducer/history hook provide the final values
|
|
3213
3213
|
};
|
|
3214
|
-
e.onFinish(
|
|
3214
|
+
e.onFinish(j);
|
|
3215
3215
|
}
|
|
3216
|
-
} catch (
|
|
3217
|
-
console.warn("[use-chat] onClosed callback failed",
|
|
3216
|
+
} catch (j) {
|
|
3217
|
+
console.warn("[use-chat] onClosed callback failed", j);
|
|
3218
3218
|
}
|
|
3219
|
-
|
|
3219
|
+
c(!1), v(!1), x.current = null, A.current = null;
|
|
3220
3220
|
}
|
|
3221
3221
|
})(), Promise.resolve();
|
|
3222
3222
|
},
|
|
3223
|
-
[t, n, r, e,
|
|
3223
|
+
[t, n, r, e, u]
|
|
3224
3224
|
);
|
|
3225
3225
|
return Y(() => () => {
|
|
3226
|
-
var
|
|
3227
|
-
S.current = !1, (
|
|
3226
|
+
var y;
|
|
3227
|
+
S.current = !1, (y = x.current) == null || y.abort();
|
|
3228
3228
|
}, []), {
|
|
3229
|
-
isStreaming:
|
|
3230
|
-
error:
|
|
3229
|
+
isStreaming: l,
|
|
3230
|
+
error: d,
|
|
3231
3231
|
assistantText: "",
|
|
3232
3232
|
// Deprecated: use messages from reducer
|
|
3233
|
-
activeMessageId:
|
|
3233
|
+
activeMessageId: f,
|
|
3234
3234
|
streamedMessages: {},
|
|
3235
3235
|
// Deprecated: use messages from reducer
|
|
3236
3236
|
lastCheckpointId: null,
|
|
3237
3237
|
// Deprecated: use checkpoint from reducer
|
|
3238
3238
|
lastSeq: 0,
|
|
3239
|
-
connected:
|
|
3239
|
+
connected: m,
|
|
3240
3240
|
stream: T,
|
|
3241
|
-
stop:
|
|
3242
|
-
clear:
|
|
3241
|
+
stop: h,
|
|
3242
|
+
clear: k,
|
|
3243
3243
|
setToken: w,
|
|
3244
3244
|
values: {},
|
|
3245
3245
|
// Provide empty object for backward compatibility
|
|
3246
3246
|
interrupt: () => Promise.resolve(),
|
|
3247
3247
|
resume: () => Promise.resolve(),
|
|
3248
3248
|
goto: () => Promise.resolve(),
|
|
3249
|
-
connectionState:
|
|
3249
|
+
connectionState: d ? "error" : l ? m ? "connected" : "connecting" : "idle",
|
|
3250
3250
|
messages: [],
|
|
3251
3251
|
// useStream doesn't maintain messages, use useChatSession instead
|
|
3252
3252
|
submit: T
|
|
@@ -3257,105 +3257,105 @@ function gr({
|
|
|
3257
3257
|
initialThreadId: t = null,
|
|
3258
3258
|
onError: n,
|
|
3259
3259
|
onThreadChange: r,
|
|
3260
|
-
onCurrentThreadDeleted:
|
|
3260
|
+
onCurrentThreadDeleted: s
|
|
3261
3261
|
}) {
|
|
3262
|
-
const [
|
|
3262
|
+
const [o, a] = H([]), [i, u] = H(t), [l, c] = H(!1), [d, p] = H(null), m = W(i), v = W(/* @__PURE__ */ new Map());
|
|
3263
3263
|
Y(() => {
|
|
3264
|
-
|
|
3264
|
+
m.current = i;
|
|
3265
3265
|
}, [i]), Y(() => {
|
|
3266
|
-
t !== void 0 && t !==
|
|
3266
|
+
t !== void 0 && t !== m.current && u(t);
|
|
3267
3267
|
}, [t]);
|
|
3268
|
-
const
|
|
3269
|
-
|
|
3268
|
+
const f = _(async () => {
|
|
3269
|
+
c(!0), p(null);
|
|
3270
3270
|
try {
|
|
3271
|
-
const
|
|
3272
|
-
a(
|
|
3273
|
-
} catch (
|
|
3274
|
-
const
|
|
3275
|
-
p(
|
|
3271
|
+
const k = await e.listThreads();
|
|
3272
|
+
a(k ?? []);
|
|
3273
|
+
} catch (k) {
|
|
3274
|
+
const h = String(k);
|
|
3275
|
+
p(h), n == null || n(h);
|
|
3276
3276
|
} finally {
|
|
3277
|
-
|
|
3277
|
+
c(!1);
|
|
3278
3278
|
}
|
|
3279
3279
|
}, [e, n]);
|
|
3280
3280
|
Y(() => {
|
|
3281
|
-
|
|
3282
|
-
}, [
|
|
3281
|
+
f();
|
|
3282
|
+
}, [f]), Y(() => {
|
|
3283
3283
|
r == null || r(i);
|
|
3284
3284
|
}, [i, r]);
|
|
3285
|
-
const
|
|
3286
|
-
async (
|
|
3285
|
+
const b = _(
|
|
3286
|
+
async (k, h) => {
|
|
3287
3287
|
try {
|
|
3288
|
-
const T =
|
|
3289
|
-
return
|
|
3288
|
+
const T = h && typeof h == "object" ? { id: h.id, name: h.name ?? "" } : void 0, y = await e.createThread(k, T);
|
|
3289
|
+
return u(y.threadId), await f(), y.threadId;
|
|
3290
3290
|
} catch (T) {
|
|
3291
|
-
const
|
|
3292
|
-
return n == null || n(
|
|
3291
|
+
const y = String(T);
|
|
3292
|
+
return n == null || n(y), null;
|
|
3293
3293
|
}
|
|
3294
3294
|
},
|
|
3295
|
-
[e, n,
|
|
3296
|
-
), x =
|
|
3297
|
-
async (
|
|
3298
|
-
const
|
|
3299
|
-
a((
|
|
3295
|
+
[e, n, f]
|
|
3296
|
+
), x = _(
|
|
3297
|
+
async (k) => {
|
|
3298
|
+
const h = o;
|
|
3299
|
+
a((y) => y.filter((I) => I.threadId !== k));
|
|
3300
3300
|
const T = new AbortController();
|
|
3301
|
-
|
|
3301
|
+
v.current.set(k, T);
|
|
3302
3302
|
try {
|
|
3303
|
-
await e.deleteThread(
|
|
3304
|
-
} catch (
|
|
3305
|
-
a(
|
|
3306
|
-
const
|
|
3307
|
-
n == null || n(
|
|
3303
|
+
await e.deleteThread(k), m.current === k && (u(null), s == null || s());
|
|
3304
|
+
} catch (y) {
|
|
3305
|
+
a(h);
|
|
3306
|
+
const I = String(y);
|
|
3307
|
+
n == null || n(I);
|
|
3308
3308
|
} finally {
|
|
3309
|
-
|
|
3309
|
+
v.current.delete(k);
|
|
3310
3310
|
}
|
|
3311
3311
|
},
|
|
3312
|
-
[e,
|
|
3313
|
-
), S =
|
|
3314
|
-
async (
|
|
3312
|
+
[e, s, n, o]
|
|
3313
|
+
), S = _(
|
|
3314
|
+
async (k, h) => {
|
|
3315
3315
|
try {
|
|
3316
|
-
await e.updateThread(
|
|
3316
|
+
await e.updateThread(k, h), await f();
|
|
3317
3317
|
} catch (T) {
|
|
3318
3318
|
n == null || n(String(T));
|
|
3319
3319
|
}
|
|
3320
3320
|
},
|
|
3321
|
-
[e, n,
|
|
3321
|
+
[e, n, f]
|
|
3322
3322
|
), A = Z(
|
|
3323
3323
|
() => ({
|
|
3324
|
-
createThread:
|
|
3324
|
+
createThread: b,
|
|
3325
3325
|
deleteThread: x,
|
|
3326
3326
|
renameThread: S,
|
|
3327
|
-
refreshThreads:
|
|
3327
|
+
refreshThreads: f
|
|
3328
3328
|
}),
|
|
3329
|
-
[
|
|
3330
|
-
), w =
|
|
3331
|
-
if (!(
|
|
3332
|
-
const
|
|
3333
|
-
threadId:
|
|
3334
|
-
title:
|
|
3335
|
-
project:
|
|
3336
|
-
createdAt:
|
|
3337
|
-
updatedAt:
|
|
3338
|
-
messageCount:
|
|
3329
|
+
[b, x, S, f]
|
|
3330
|
+
), w = _((k) => {
|
|
3331
|
+
if (!(k != null && k.threadId)) return;
|
|
3332
|
+
const h = {
|
|
3333
|
+
threadId: k.threadId,
|
|
3334
|
+
title: k.title || `Thread ${k.threadId.slice(0, 8)}`,
|
|
3335
|
+
project: k.project,
|
|
3336
|
+
createdAt: k.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
3337
|
+
updatedAt: k.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
3338
|
+
messageCount: k.messageCount ?? 1
|
|
3339
3339
|
};
|
|
3340
3340
|
a((T) => {
|
|
3341
|
-
let
|
|
3342
|
-
const
|
|
3341
|
+
let y = !1;
|
|
3342
|
+
const I = T.map((E) => E.threadId === h.threadId ? (y = !0, console.debug("[useThreadsState] thread_info: updating existing thread", h.threadId), {
|
|
3343
3343
|
...E,
|
|
3344
|
-
title:
|
|
3345
|
-
project:
|
|
3346
|
-
updatedAt:
|
|
3347
|
-
messageCount:
|
|
3344
|
+
title: h.title ?? E.title,
|
|
3345
|
+
project: h.project ?? E.project,
|
|
3346
|
+
updatedAt: h.updatedAt ?? E.updatedAt,
|
|
3347
|
+
messageCount: h.messageCount ?? E.messageCount
|
|
3348
3348
|
}) : E);
|
|
3349
|
-
return
|
|
3349
|
+
return y ? I : (console.debug("[useThreadsState] thread_info: adding thread to list", h.threadId), [h, ...T]);
|
|
3350
3350
|
});
|
|
3351
3351
|
}, []);
|
|
3352
3352
|
return {
|
|
3353
|
-
threads:
|
|
3353
|
+
threads: o,
|
|
3354
3354
|
currentThreadId: i,
|
|
3355
|
-
currentThreadIdRef:
|
|
3356
|
-
setCurrentThreadId:
|
|
3357
|
-
isLoadingThreads:
|
|
3358
|
-
threadsError:
|
|
3355
|
+
currentThreadIdRef: m,
|
|
3356
|
+
setCurrentThreadId: u,
|
|
3357
|
+
isLoadingThreads: l,
|
|
3358
|
+
threadsError: d,
|
|
3359
3359
|
actions: A,
|
|
3360
3360
|
addThreadFromEvent: w
|
|
3361
3361
|
};
|
|
@@ -3367,43 +3367,43 @@ function mr({
|
|
|
3367
3367
|
onError: n,
|
|
3368
3368
|
onThreadChange: r
|
|
3369
3369
|
}) {
|
|
3370
|
-
const { chatApi:
|
|
3371
|
-
threads:
|
|
3370
|
+
const { chatApi: s } = Me(), {
|
|
3371
|
+
threads: o,
|
|
3372
3372
|
currentThreadId: a,
|
|
3373
3373
|
setCurrentThreadId: i,
|
|
3374
|
-
currentThreadIdRef:
|
|
3375
|
-
isLoadingThreads:
|
|
3376
|
-
threadsError:
|
|
3377
|
-
actions:
|
|
3374
|
+
currentThreadIdRef: u,
|
|
3375
|
+
isLoadingThreads: l,
|
|
3376
|
+
threadsError: c,
|
|
3377
|
+
actions: d,
|
|
3378
3378
|
addThreadFromEvent: p
|
|
3379
3379
|
} = gr({
|
|
3380
|
-
api:
|
|
3380
|
+
api: s,
|
|
3381
3381
|
initialThreadId: t,
|
|
3382
3382
|
onError: n,
|
|
3383
3383
|
onThreadChange: r
|
|
3384
|
-
}),
|
|
3384
|
+
}), m = Z(
|
|
3385
3385
|
() => ({
|
|
3386
|
-
threads:
|
|
3386
|
+
threads: o,
|
|
3387
3387
|
currentThreadId: a,
|
|
3388
3388
|
setCurrentThreadId: i,
|
|
3389
|
-
currentThreadIdRef:
|
|
3390
|
-
isLoading:
|
|
3391
|
-
error:
|
|
3392
|
-
actions:
|
|
3389
|
+
currentThreadIdRef: u,
|
|
3390
|
+
isLoading: l,
|
|
3391
|
+
error: c,
|
|
3392
|
+
actions: d,
|
|
3393
3393
|
addThreadFromEvent: p
|
|
3394
3394
|
}),
|
|
3395
3395
|
[
|
|
3396
|
-
|
|
3396
|
+
o,
|
|
3397
3397
|
a,
|
|
3398
3398
|
i,
|
|
3399
|
-
|
|
3400
|
-
c,
|
|
3399
|
+
u,
|
|
3401
3400
|
l,
|
|
3402
|
-
|
|
3401
|
+
c,
|
|
3402
|
+
d,
|
|
3403
3403
|
p
|
|
3404
3404
|
]
|
|
3405
3405
|
);
|
|
3406
|
-
return /* @__PURE__ */ de(Ut.Provider, { value:
|
|
3406
|
+
return /* @__PURE__ */ de(Ut.Provider, { value: m, children: e });
|
|
3407
3407
|
}
|
|
3408
3408
|
function ot(e) {
|
|
3409
3409
|
const t = je(Ut);
|
|
@@ -3438,8 +3438,8 @@ function yr(e, t) {
|
|
|
3438
3438
|
}
|
|
3439
3439
|
function hr(e, t, n) {
|
|
3440
3440
|
return e.find((r) => {
|
|
3441
|
-
const
|
|
3442
|
-
return !!((
|
|
3441
|
+
const s = Bt(r);
|
|
3442
|
+
return !!((s == null ? void 0 : s.id) === t || n && r.toolCallId === n);
|
|
3443
3443
|
}) ?? null;
|
|
3444
3444
|
}
|
|
3445
3445
|
function Fe(e) {
|
|
@@ -3452,8 +3452,8 @@ function Ft(e, t, n) {
|
|
|
3452
3452
|
function br(e, t, n) {
|
|
3453
3453
|
for (let r = e.length - 1; r >= 0; r--)
|
|
3454
3454
|
if (e[r].role === "assistant") {
|
|
3455
|
-
const
|
|
3456
|
-
return Ft(e, r,
|
|
3455
|
+
const o = { ...e[r], checkpointId: t, checkpointNs: n ?? void 0 };
|
|
3456
|
+
return Ft(e, r, o);
|
|
3457
3457
|
}
|
|
3458
3458
|
return e;
|
|
3459
3459
|
}
|
|
@@ -3484,15 +3484,15 @@ function wr(e, t) {
|
|
|
3484
3484
|
messages: Fe(((n = t.payload) == null ? void 0 : n.messages) ?? [])
|
|
3485
3485
|
};
|
|
3486
3486
|
case "user_message": {
|
|
3487
|
-
const { message: r, editingMessageId:
|
|
3488
|
-
if (
|
|
3489
|
-
const
|
|
3490
|
-
if (
|
|
3491
|
-
const a = e.messages[
|
|
3487
|
+
const { message: r, editingMessageId: s } = t.payload;
|
|
3488
|
+
if (s) {
|
|
3489
|
+
const o = e.messages.findIndex((a) => (a.id || a.messageId || a.id) === s);
|
|
3490
|
+
if (o !== -1) {
|
|
3491
|
+
const a = e.messages[o], i = { ...r, id: s };
|
|
3492
3492
|
return {
|
|
3493
3493
|
...e,
|
|
3494
3494
|
status: "streaming",
|
|
3495
|
-
messages: [...e.messages.slice(0,
|
|
3495
|
+
messages: [...e.messages.slice(0, o), i],
|
|
3496
3496
|
assemblingId: null,
|
|
3497
3497
|
lastCheckpointId: a.checkpointId || e.lastCheckpointId || null,
|
|
3498
3498
|
error: null
|
|
@@ -3509,7 +3509,7 @@ function wr(e, t) {
|
|
|
3509
3509
|
};
|
|
3510
3510
|
}
|
|
3511
3511
|
case "seed": {
|
|
3512
|
-
const r = Fe(t.payload.messages),
|
|
3512
|
+
const r = Fe(t.payload.messages), s = {
|
|
3513
3513
|
...e,
|
|
3514
3514
|
status: "idle",
|
|
3515
3515
|
messages: r,
|
|
@@ -3518,51 +3518,51 @@ function wr(e, t) {
|
|
|
3518
3518
|
taskMessagesByScope: {},
|
|
3519
3519
|
error: null
|
|
3520
3520
|
};
|
|
3521
|
-
return Object.prototype.hasOwnProperty.call(t.payload, "checkpointId") && (
|
|
3521
|
+
return Object.prototype.hasOwnProperty.call(t.payload, "checkpointId") && (s.lastCheckpointId = t.payload.checkpointId ?? null), Object.prototype.hasOwnProperty.call(t.payload, "checkpointNs") && (s.lastCheckpointNs = t.payload.checkpointNs ?? null), Object.prototype.hasOwnProperty.call(t.payload, "values") && (s.values = t.payload.values ?? {}), s;
|
|
3522
3522
|
}
|
|
3523
3523
|
case "prepend": {
|
|
3524
3524
|
const r = Fe(t.payload.messages);
|
|
3525
3525
|
if (!r.length) return e;
|
|
3526
|
-
const
|
|
3527
|
-
return
|
|
3526
|
+
const s = new Set(e.messages.map((a) => a.id)), o = r.filter((a) => !s.has(a.id));
|
|
3527
|
+
return o.length ? { ...e, messages: [...o, ...e.messages] } : e;
|
|
3528
3528
|
}
|
|
3529
3529
|
case "event":
|
|
3530
3530
|
return pt(e, t.payload.ev);
|
|
3531
3531
|
case "batch": {
|
|
3532
3532
|
const { events: r } = t.payload;
|
|
3533
|
-
return r.length ? r.reduce((
|
|
3533
|
+
return r.length ? r.reduce((s, o) => pt(s, o), e) : e;
|
|
3534
3534
|
}
|
|
3535
3535
|
default:
|
|
3536
3536
|
return e;
|
|
3537
3537
|
}
|
|
3538
3538
|
}
|
|
3539
3539
|
function kr(e = []) {
|
|
3540
|
-
const [t, n] = Wt(wr, { ...Ot, messages: e }), r =
|
|
3541
|
-
|
|
3542
|
-
const
|
|
3543
|
-
|
|
3544
|
-
}, []), a =
|
|
3545
|
-
typeof window < "u" && typeof window.requestAnimationFrame == "function" ?
|
|
3546
|
-
}, [
|
|
3547
|
-
r.current.push(
|
|
3548
|
-
}, [a]),
|
|
3549
|
-
setStatus: (
|
|
3550
|
-
reset: (
|
|
3551
|
-
seed: (
|
|
3552
|
-
pushUser: (
|
|
3540
|
+
const [t, n] = Wt(wr, { ...Ot, messages: e }), r = W([]), s = W(null), o = _(() => {
|
|
3541
|
+
s.current !== null && typeof window < "u" && window.cancelAnimationFrame(s.current), s.current = null;
|
|
3542
|
+
const l = r.current;
|
|
3543
|
+
l.length && (r.current = [], n({ type: "batch", payload: { events: l } }));
|
|
3544
|
+
}, []), a = _(() => {
|
|
3545
|
+
typeof window < "u" && typeof window.requestAnimationFrame == "function" ? s.current === null && (s.current = window.requestAnimationFrame(() => o())) : setTimeout(o, 8);
|
|
3546
|
+
}, [o]), i = _((l) => {
|
|
3547
|
+
r.current.push(l), a();
|
|
3548
|
+
}, [a]), u = Z(() => ({
|
|
3549
|
+
setStatus: (l, c) => n({ type: "status", payload: { status: l, error: c } }),
|
|
3550
|
+
reset: (l) => n({ type: "reset", payload: { messages: l } }),
|
|
3551
|
+
seed: (l, c) => n({ type: "seed", payload: { messages: l, ...c ?? {} } }),
|
|
3552
|
+
pushUser: (l, c) => n({ type: "user_message", payload: { message: l, editingMessageId: c } }),
|
|
3553
3553
|
onEvent: i
|
|
3554
3554
|
}), [i]);
|
|
3555
|
-
return { state: t, dispatch: n, ...
|
|
3555
|
+
return { state: t, dispatch: n, ...u };
|
|
3556
3556
|
}
|
|
3557
3557
|
function pt(e, t) {
|
|
3558
|
-
const n = t.origin, r = t.scope,
|
|
3558
|
+
const n = t.origin, r = t.scope, s = n === "task" || typeof r == "string" && r.startsWith("tools:");
|
|
3559
3559
|
if (t.type === "checkpoint") {
|
|
3560
|
-
const
|
|
3561
|
-
return { ...e, lastCheckpointId: t.checkpointId, lastCheckpointNs:
|
|
3560
|
+
const o = t.checkpointNs ?? e.lastCheckpointNs ?? null, a = br(e.messages, t.checkpointId, o);
|
|
3561
|
+
return { ...e, lastCheckpointId: t.checkpointId, lastCheckpointNs: o, messages: a };
|
|
3562
3562
|
}
|
|
3563
3563
|
if (t.type === "status") {
|
|
3564
|
-
const
|
|
3565
|
-
return { ...e, status:
|
|
3564
|
+
const o = t.status === "completed" || t.status === "error" ? "idle" : t.status === "interrupted" ? "awaiting_input" : e.status;
|
|
3565
|
+
return { ...e, status: o };
|
|
3566
3566
|
}
|
|
3567
3567
|
if (t.type === "interrupt")
|
|
3568
3568
|
return {
|
|
@@ -3576,68 +3576,68 @@ function pt(e, t) {
|
|
|
3576
3576
|
}
|
|
3577
3577
|
};
|
|
3578
3578
|
if (t.type === "error") {
|
|
3579
|
-
const
|
|
3579
|
+
const o = {
|
|
3580
3580
|
id: `err-${Date.now()}`,
|
|
3581
3581
|
role: "system",
|
|
3582
3582
|
content: [{ type: "text", text: `Error: ${t.message}` }],
|
|
3583
3583
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3584
3584
|
};
|
|
3585
|
-
return { ...e, status: "error", error: t.message, messages: [...e.messages,
|
|
3585
|
+
return { ...e, status: "error", error: t.message, messages: [...e.messages, o] };
|
|
3586
3586
|
}
|
|
3587
3587
|
if (t.type === "values") {
|
|
3588
|
-
const
|
|
3588
|
+
const o = t, a = o.values && typeof o.values == "object" ? { ...o.values } : {}, i = Array.isArray(o.messages) ? o.messages : Array.isArray(a.messages) ? a.messages : [];
|
|
3589
3589
|
if (!i.length && Object.keys(a).length === 0)
|
|
3590
3590
|
return e;
|
|
3591
|
-
const
|
|
3591
|
+
const u = Fe(i);
|
|
3592
3592
|
delete a.messages;
|
|
3593
|
-
let
|
|
3594
|
-
const
|
|
3595
|
-
if ((p != null && p.checkpoint_id || p != null && p.checkpointId) && (
|
|
3596
|
-
for (let
|
|
3597
|
-
if (
|
|
3598
|
-
|
|
3593
|
+
let l = e.lastCheckpointId, c = e.lastCheckpointNs;
|
|
3594
|
+
const d = o.config || o.checkpoint, p = (d == null ? void 0 : d.configurable) || d;
|
|
3595
|
+
if ((p != null && p.checkpoint_id || p != null && p.checkpointId) && (l = p.checkpoint_id || p.checkpointId, c = p.checkpoint_ns || p.checkpointNs || null), !l) {
|
|
3596
|
+
for (let f = u.length - 1; f >= 0; f--)
|
|
3597
|
+
if (u[f].checkpointId) {
|
|
3598
|
+
l = u[f].checkpointId, c = u[f].checkpointNs ?? null;
|
|
3599
3599
|
break;
|
|
3600
3600
|
}
|
|
3601
3601
|
}
|
|
3602
|
-
const
|
|
3603
|
-
id:
|
|
3604
|
-
value:
|
|
3605
|
-
alternatives:
|
|
3602
|
+
const m = o.interrupts || a.__interrupt__ || a.interrupts, v = Array.isArray(m) && m.length > 0 ? {
|
|
3603
|
+
id: m[0].id || "native-interrupt",
|
|
3604
|
+
value: m[0].value || m[0],
|
|
3605
|
+
alternatives: m[0].alternatives
|
|
3606
3606
|
} : null;
|
|
3607
|
-
if (
|
|
3608
|
-
const
|
|
3607
|
+
if (s) {
|
|
3608
|
+
const f = typeof r == "string" && r.length > 0 ? r : "task";
|
|
3609
3609
|
return {
|
|
3610
3610
|
...e,
|
|
3611
|
-
taskMessagesByScope: { ...e.taskMessagesByScope, [
|
|
3611
|
+
taskMessagesByScope: { ...e.taskMessagesByScope, [f]: u },
|
|
3612
3612
|
assemblingId: null
|
|
3613
3613
|
};
|
|
3614
3614
|
}
|
|
3615
3615
|
return {
|
|
3616
3616
|
...e,
|
|
3617
|
-
status:
|
|
3618
|
-
messages:
|
|
3617
|
+
status: v ? "awaiting_input" : e.status === "streaming" ? "idle" : e.status,
|
|
3618
|
+
messages: u,
|
|
3619
3619
|
assemblingId: null,
|
|
3620
|
-
lastCheckpointId:
|
|
3621
|
-
lastCheckpointNs:
|
|
3622
|
-
pendingInterrupt:
|
|
3620
|
+
lastCheckpointId: l,
|
|
3621
|
+
lastCheckpointNs: c,
|
|
3622
|
+
pendingInterrupt: v,
|
|
3623
3623
|
values: { ...e.values, ...a }
|
|
3624
3624
|
};
|
|
3625
3625
|
}
|
|
3626
3626
|
if (t.type === "messages/metadata") {
|
|
3627
|
-
const
|
|
3628
|
-
return a && typeof a == "object" && Object.entries(a).forEach(([i,
|
|
3629
|
-
const
|
|
3630
|
-
if (!
|
|
3631
|
-
const
|
|
3632
|
-
|
|
3633
|
-
...
|
|
3634
|
-
lastSeq: t.seq ??
|
|
3635
|
-
metadata: { ...
|
|
3627
|
+
const o = { ...e.messagesStreamMeta ?? {} }, a = t.metadata;
|
|
3628
|
+
return a && typeof a == "object" && Object.entries(a).forEach(([i, u]) => {
|
|
3629
|
+
const l = u == null ? void 0 : u.metadata;
|
|
3630
|
+
if (!l || typeof l != "object") return;
|
|
3631
|
+
const c = o[i] ?? {};
|
|
3632
|
+
o[i] = {
|
|
3633
|
+
...c,
|
|
3634
|
+
lastSeq: t.seq ?? c.lastSeq ?? null,
|
|
3635
|
+
metadata: { ...c.metadata ?? {}, ...l }
|
|
3636
3636
|
};
|
|
3637
|
-
}), { ...e, messagesStreamMeta:
|
|
3637
|
+
}), { ...e, messagesStreamMeta: o };
|
|
3638
3638
|
}
|
|
3639
3639
|
if (t.type === "messages/partial" || t.type === "message.delta") {
|
|
3640
|
-
const
|
|
3640
|
+
const o = t.type === "messages/partial" ? t : {
|
|
3641
3641
|
...t,
|
|
3642
3642
|
type: "messages/partial",
|
|
3643
3643
|
messages: t.delta ? [{
|
|
@@ -3648,55 +3648,55 @@ function pt(e, t) {
|
|
|
3648
3648
|
origin: t.origin
|
|
3649
3649
|
}] : []
|
|
3650
3650
|
};
|
|
3651
|
-
return Ir(e,
|
|
3651
|
+
return Ir(e, o, s);
|
|
3652
3652
|
}
|
|
3653
|
-
return t.type === "message.start" ? { ...e, assemblingId: t.id, status: "streaming" } : t.type === "message.end" ? { ...e, assemblingId: null } : t.type === "tool.start" ? { ...vr(e, t,
|
|
3653
|
+
return t.type === "message.start" ? { ...e, assemblingId: t.id, status: "streaming" } : t.type === "message.end" ? { ...e, assemblingId: null } : t.type === "tool.start" ? { ...vr(e, t, s), status: "streaming" } : t.type === "tool.progress" ? xr(e, t, s) : t.type === "tool.end" ? Ar(e, t, s) : t.type === "artifact.update" ? Tr(e, t) : e;
|
|
3654
3654
|
}
|
|
3655
3655
|
function Ir(e, t, n) {
|
|
3656
|
-
var
|
|
3656
|
+
var m, v, f, b, x, S, A;
|
|
3657
3657
|
const r = t.messages;
|
|
3658
3658
|
if (!r.length)
|
|
3659
3659
|
return console.warn("[messagesReducer] Dropping messages/partial event without messages[]", t), e;
|
|
3660
|
-
const
|
|
3661
|
-
if (!
|
|
3662
|
-
const
|
|
3663
|
-
let
|
|
3664
|
-
const p = (
|
|
3665
|
-
if (
|
|
3660
|
+
const s = r.find((w) => w.type === "ai" || w.type === "assistant" || w.role === "assistant");
|
|
3661
|
+
if (!s) return e;
|
|
3662
|
+
const o = s.id, a = s.content ?? "", i = typeof a == "string" ? [{ type: "text", text: a }] : Array.isArray(a) ? a.map((w) => typeof w == "string" ? { type: "text", text: w } : (w == null ? void 0 : w.type) === "text" ? { type: "text", text: typeof w.text == "string" ? w.text : w.content ?? "" } : ((w == null ? void 0 : w.type) === "reasoning", w)) : [], u = i.filter((w) => w.type === "text").map((w) => w.text).join(""), l = e.assemblingId !== o, c = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3663
|
+
let d = n ? [...e.taskMessagesByScope[c] || []] : [...e.messages];
|
|
3664
|
+
const p = (v = (m = e.messagesStreamMeta) == null ? void 0 : m[o]) == null ? void 0 : v.metadata;
|
|
3665
|
+
if (l) {
|
|
3666
3666
|
const w = nt({
|
|
3667
|
-
...
|
|
3667
|
+
...s,
|
|
3668
3668
|
role: "assistant",
|
|
3669
3669
|
content: i,
|
|
3670
3670
|
scope: t.scope,
|
|
3671
3671
|
origin: t.origin,
|
|
3672
|
-
responseMetadata: { ...p, ...
|
|
3672
|
+
responseMetadata: { ...p, ...s.responseMetadata ?? {} }
|
|
3673
3673
|
});
|
|
3674
|
-
w &&
|
|
3674
|
+
w && d.push(w);
|
|
3675
3675
|
} else {
|
|
3676
|
-
const w =
|
|
3676
|
+
const w = d.findIndex((k) => k.id === o);
|
|
3677
3677
|
if (w !== -1) {
|
|
3678
|
-
const
|
|
3679
|
-
|
|
3680
|
-
...
|
|
3678
|
+
const k = d[w];
|
|
3679
|
+
d[w] = {
|
|
3680
|
+
...k,
|
|
3681
3681
|
content: i,
|
|
3682
|
-
scope: t.scope ??
|
|
3683
|
-
origin: t.origin ??
|
|
3684
|
-
responseMetadata: { ...p, ...
|
|
3682
|
+
scope: t.scope ?? k.scope,
|
|
3683
|
+
origin: t.origin ?? k.origin,
|
|
3684
|
+
responseMetadata: { ...p, ...k.responseMetadata, ...s.responseMetadata ?? {} }
|
|
3685
3685
|
};
|
|
3686
3686
|
}
|
|
3687
3687
|
}
|
|
3688
3688
|
return {
|
|
3689
3689
|
...e,
|
|
3690
3690
|
status: "streaming",
|
|
3691
|
-
messages: n ? e.messages :
|
|
3692
|
-
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [
|
|
3693
|
-
assemblingId:
|
|
3691
|
+
messages: n ? e.messages : d,
|
|
3692
|
+
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [c]: d } : e.taskMessagesByScope,
|
|
3693
|
+
assemblingId: o,
|
|
3694
3694
|
messagesStreamMeta: {
|
|
3695
3695
|
...e.messagesStreamMeta ?? {},
|
|
3696
|
-
[
|
|
3697
|
-
...((
|
|
3698
|
-
lastSeq: t.seq ?? ((x = (
|
|
3699
|
-
lastText:
|
|
3696
|
+
[o]: {
|
|
3697
|
+
...((f = e.messagesStreamMeta) == null ? void 0 : f[o]) ?? {},
|
|
3698
|
+
lastSeq: t.seq ?? ((x = (b = e.messagesStreamMeta) == null ? void 0 : b[o]) == null ? void 0 : x.lastSeq) ?? null,
|
|
3699
|
+
lastText: u || (((A = (S = e.messagesStreamMeta) == null ? void 0 : S[o]) == null ? void 0 : A.lastText) ?? "")
|
|
3700
3700
|
}
|
|
3701
3701
|
}
|
|
3702
3702
|
};
|
|
@@ -3705,8 +3705,8 @@ function st(e, t) {
|
|
|
3705
3705
|
var n;
|
|
3706
3706
|
if (!t) return -1;
|
|
3707
3707
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
3708
|
-
const
|
|
3709
|
-
if (
|
|
3708
|
+
const s = e[r];
|
|
3709
|
+
if (s.role === "assistant" && ((n = s.toolCalls) != null && n.some((o) => o.id === t)))
|
|
3710
3710
|
return r;
|
|
3711
3711
|
}
|
|
3712
3712
|
return -1;
|
|
@@ -3714,17 +3714,17 @@ function st(e, t) {
|
|
|
3714
3714
|
function vr(e, t, n) {
|
|
3715
3715
|
const r = t.id || t.callId;
|
|
3716
3716
|
if (!r) return e;
|
|
3717
|
-
const
|
|
3718
|
-
let i = n ? [...e.taskMessagesByScope[a] || []] : [...e.messages],
|
|
3719
|
-
if (
|
|
3720
|
-
for (let
|
|
3721
|
-
if (i[
|
|
3722
|
-
|
|
3717
|
+
const s = t.name || "tool", o = `Starting ${s}...`, a = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3718
|
+
let i = n ? [...e.taskMessagesByScope[a] || []] : [...e.messages], u = st(i, r);
|
|
3719
|
+
if (u === -1) {
|
|
3720
|
+
for (let l = i.length - 1; l >= 0; l--)
|
|
3721
|
+
if (i[l].role === "assistant") {
|
|
3722
|
+
u = l;
|
|
3723
3723
|
break;
|
|
3724
3724
|
}
|
|
3725
3725
|
}
|
|
3726
|
-
if (
|
|
3727
|
-
const
|
|
3726
|
+
if (u === -1) {
|
|
3727
|
+
const l = {
|
|
3728
3728
|
id: `assistant-${r}`,
|
|
3729
3729
|
role: "assistant",
|
|
3730
3730
|
content: [{ type: "text", text: "" }],
|
|
@@ -3733,21 +3733,21 @@ function vr(e, t, n) {
|
|
|
3733
3733
|
scope: t.scope,
|
|
3734
3734
|
origin: t.origin
|
|
3735
3735
|
};
|
|
3736
|
-
i.push(
|
|
3736
|
+
i.push(l), u = i.length - 1;
|
|
3737
3737
|
}
|
|
3738
|
-
if (
|
|
3739
|
-
const
|
|
3740
|
-
|
|
3738
|
+
if (u !== -1) {
|
|
3739
|
+
const l = i[u], c = [...l.toolCalls || []], d = c.findIndex((p) => p.id === r);
|
|
3740
|
+
d >= 0 ? c[d] = { ...c[d], status: "running", content: o } : c.push({
|
|
3741
3741
|
id: r,
|
|
3742
|
-
name:
|
|
3742
|
+
name: s,
|
|
3743
3743
|
args: t.args || {},
|
|
3744
3744
|
status: "running",
|
|
3745
|
-
content:
|
|
3746
|
-
}), i[
|
|
3747
|
-
...
|
|
3748
|
-
toolCalls:
|
|
3749
|
-
scope: t.scope ??
|
|
3750
|
-
origin: t.origin ??
|
|
3745
|
+
content: o
|
|
3746
|
+
}), i[u] = {
|
|
3747
|
+
...l,
|
|
3748
|
+
toolCalls: c,
|
|
3749
|
+
scope: t.scope ?? l.scope,
|
|
3750
|
+
origin: t.origin ?? l.origin
|
|
3751
3751
|
};
|
|
3752
3752
|
}
|
|
3753
3753
|
return {
|
|
@@ -3759,49 +3759,49 @@ function vr(e, t, n) {
|
|
|
3759
3759
|
function xr(e, t, n) {
|
|
3760
3760
|
const r = t.id;
|
|
3761
3761
|
if (!r) return e;
|
|
3762
|
-
const
|
|
3763
|
-
let
|
|
3764
|
-
const a = st(
|
|
3762
|
+
const s = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3763
|
+
let o = n ? [...e.taskMessagesByScope[s] || []] : [...e.messages];
|
|
3764
|
+
const a = st(o, r);
|
|
3765
3765
|
if (a !== -1) {
|
|
3766
|
-
const i =
|
|
3767
|
-
(
|
|
3766
|
+
const i = o[a], u = ue(t.content), l = (i.toolCalls || []).map(
|
|
3767
|
+
(c) => c.id === r ? { ...c, content: typeof u == "string" ? u : c.content } : c
|
|
3768
3768
|
);
|
|
3769
|
-
|
|
3769
|
+
o[a] = {
|
|
3770
3770
|
...i,
|
|
3771
|
-
toolCalls:
|
|
3771
|
+
toolCalls: l,
|
|
3772
3772
|
scope: t.scope ?? i.scope,
|
|
3773
3773
|
origin: t.origin ?? i.origin
|
|
3774
3774
|
};
|
|
3775
3775
|
}
|
|
3776
3776
|
return {
|
|
3777
3777
|
...e,
|
|
3778
|
-
messages: n ? e.messages :
|
|
3779
|
-
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [
|
|
3778
|
+
messages: n ? e.messages : o,
|
|
3779
|
+
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [s]: o } : e.taskMessagesByScope
|
|
3780
3780
|
};
|
|
3781
3781
|
}
|
|
3782
3782
|
function Ar(e, t, n) {
|
|
3783
3783
|
const r = t.id;
|
|
3784
3784
|
if (!r) return e;
|
|
3785
|
-
const
|
|
3786
|
-
let
|
|
3787
|
-
const a = st(
|
|
3785
|
+
const s = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3786
|
+
let o = n ? [...e.taskMessagesByScope[s] || []] : [...e.messages];
|
|
3787
|
+
const a = st(o, r), i = ue(t.content ?? t.error);
|
|
3788
3788
|
if (a !== -1) {
|
|
3789
|
-
const
|
|
3790
|
-
(
|
|
3791
|
-
...
|
|
3789
|
+
const l = o[a], c = (l.toolCalls || []).map(
|
|
3790
|
+
(d) => d.id === r ? {
|
|
3791
|
+
...d,
|
|
3792
3792
|
status: t.error ? "failed" : "completed",
|
|
3793
|
-
content: typeof i == "string" ? i :
|
|
3793
|
+
content: typeof i == "string" ? i : d.content,
|
|
3794
3794
|
artifact: t.artifact
|
|
3795
|
-
} :
|
|
3795
|
+
} : d
|
|
3796
3796
|
);
|
|
3797
|
-
|
|
3798
|
-
...
|
|
3799
|
-
toolCalls:
|
|
3800
|
-
scope: t.scope ??
|
|
3801
|
-
origin: t.origin ??
|
|
3797
|
+
o[a] = {
|
|
3798
|
+
...l,
|
|
3799
|
+
toolCalls: c,
|
|
3800
|
+
scope: t.scope ?? l.scope,
|
|
3801
|
+
origin: t.origin ?? l.origin
|
|
3802
3802
|
};
|
|
3803
3803
|
}
|
|
3804
|
-
const
|
|
3804
|
+
const u = {
|
|
3805
3805
|
id: `tool-${r}`,
|
|
3806
3806
|
role: "tool",
|
|
3807
3807
|
name: t.name,
|
|
@@ -3812,21 +3812,21 @@ function Ar(e, t, n) {
|
|
|
3812
3812
|
scope: t.scope,
|
|
3813
3813
|
origin: t.origin
|
|
3814
3814
|
};
|
|
3815
|
-
return
|
|
3815
|
+
return o.push(u), {
|
|
3816
3816
|
...e,
|
|
3817
|
-
messages: n ? e.messages :
|
|
3818
|
-
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [
|
|
3817
|
+
messages: n ? e.messages : o,
|
|
3818
|
+
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [s]: o } : e.taskMessagesByScope
|
|
3819
3819
|
};
|
|
3820
3820
|
}
|
|
3821
3821
|
function Tr(e, t) {
|
|
3822
3822
|
const n = t.artifactId, r = hr(e.messages, n, t.callId);
|
|
3823
3823
|
if (!r) return e;
|
|
3824
|
-
const
|
|
3824
|
+
const s = e.messages.indexOf(r), o = yr(r, {
|
|
3825
3825
|
status: t.status,
|
|
3826
3826
|
progress: t.progress,
|
|
3827
3827
|
error: t.error
|
|
3828
3828
|
});
|
|
3829
|
-
return t.partial_data &&
|
|
3829
|
+
return t.partial_data && o.artifact && (o.artifact = { ...o.artifact, ...t.partial_data }), { ...e, messages: Ft(e.messages, s, o) };
|
|
3830
3830
|
}
|
|
3831
3831
|
function Re(e) {
|
|
3832
3832
|
if (!(!e || typeof e != "object" || Array.isArray(e)))
|
|
@@ -3855,88 +3855,88 @@ function gt(e) {
|
|
|
3855
3855
|
return Re(t.configurable) ?? t;
|
|
3856
3856
|
}
|
|
3857
3857
|
async function Mr(e, t) {
|
|
3858
|
-
var i,
|
|
3858
|
+
var i, u;
|
|
3859
3859
|
if (!e) return e ?? null;
|
|
3860
|
-
const n = fe(e), r = Array.isArray(n.checkpoints) ? n.checkpoints : n.checkpoints ? Object.values(n.checkpoints) : [],
|
|
3861
|
-
for (const
|
|
3862
|
-
const
|
|
3863
|
-
if (Array.isArray(
|
|
3864
|
-
for (const
|
|
3865
|
-
const p =
|
|
3860
|
+
const n = fe(e), r = Array.isArray(n.checkpoints) ? n.checkpoints : n.checkpoints ? Object.values(n.checkpoints) : [], s = /* @__PURE__ */ new Set();
|
|
3861
|
+
for (const l of r) {
|
|
3862
|
+
const c = (i = l == null ? void 0 : l.values) == null ? void 0 : i.messages;
|
|
3863
|
+
if (Array.isArray(c))
|
|
3864
|
+
for (const d of c) {
|
|
3865
|
+
const p = d == null ? void 0 : d.content;
|
|
3866
3866
|
if (Array.isArray(p))
|
|
3867
|
-
for (const
|
|
3868
|
-
if (!
|
|
3869
|
-
const
|
|
3870
|
-
typeof
|
|
3867
|
+
for (const m of p) {
|
|
3868
|
+
if (!m || typeof m != "object" || m.type !== "image_url" && m.type !== "file") continue;
|
|
3869
|
+
const v = m.fileId || m.file_id;
|
|
3870
|
+
typeof v == "string" && v.trim() && s.add(v);
|
|
3871
3871
|
}
|
|
3872
3872
|
}
|
|
3873
3873
|
}
|
|
3874
|
-
if (
|
|
3874
|
+
if (s.size === 0)
|
|
3875
3875
|
return n;
|
|
3876
|
-
const
|
|
3877
|
-
Array.from(
|
|
3876
|
+
const o = await Promise.all(
|
|
3877
|
+
Array.from(s).map(async (l) => {
|
|
3878
3878
|
try {
|
|
3879
|
-
const
|
|
3880
|
-
return [
|
|
3879
|
+
const c = await t.getFileInfo(l), d = fe(c);
|
|
3880
|
+
return [l, d];
|
|
3881
3881
|
} catch {
|
|
3882
|
-
return [
|
|
3882
|
+
return [l, null];
|
|
3883
3883
|
}
|
|
3884
3884
|
})
|
|
3885
|
-
), a = new Map(
|
|
3886
|
-
for (const
|
|
3887
|
-
const
|
|
3888
|
-
if (Array.isArray(
|
|
3889
|
-
for (const
|
|
3890
|
-
const p =
|
|
3885
|
+
), a = new Map(o);
|
|
3886
|
+
for (const l of r) {
|
|
3887
|
+
const c = (u = l == null ? void 0 : l.values) == null ? void 0 : u.messages;
|
|
3888
|
+
if (Array.isArray(c))
|
|
3889
|
+
for (const d of c) {
|
|
3890
|
+
const p = d == null ? void 0 : d.content;
|
|
3891
3891
|
if (Array.isArray(p))
|
|
3892
|
-
for (const
|
|
3893
|
-
if (!
|
|
3894
|
-
const
|
|
3895
|
-
if (!
|
|
3896
|
-
const
|
|
3897
|
-
|
|
3892
|
+
for (const m of p) {
|
|
3893
|
+
if (!m || typeof m != "object" || m.type !== "image_url" && m.type !== "file") continue;
|
|
3894
|
+
const v = m.fileId || m.file_id;
|
|
3895
|
+
if (!v) continue;
|
|
3896
|
+
const f = a.get(v), b = (f == null ? void 0 : f.contentUrl) || (f == null ? void 0 : f.content_url);
|
|
3897
|
+
b && (m.type === "image_url" ? (m.imageUrl = m.imageUrl || {}, m.imageUrl.url = b) : m.type === "file" && (m.url = b, !m.name && (f != null && f.filename || f != null && f.name) && (m.name = (f == null ? void 0 : f.filename) || (f == null ? void 0 : f.name))));
|
|
3898
3898
|
}
|
|
3899
3899
|
}
|
|
3900
3900
|
}
|
|
3901
3901
|
return n;
|
|
3902
3902
|
}
|
|
3903
3903
|
function mt(e) {
|
|
3904
|
-
const r = [...(Array.isArray(e == null ? void 0 : e.checkpoints) ? (e == null ? void 0 : e.checkpoints) ?? [] : e != null && e.checkpoints ? Object.values(e.checkpoints) : []).map((
|
|
3904
|
+
const r = [...(Array.isArray(e == null ? void 0 : e.checkpoints) ? (e == null ? void 0 : e.checkpoints) ?? [] : e != null && e.checkpoints ? Object.values(e.checkpoints) : []).map((o, a) => Cr(fe(o), a)).filter((o) => !!o)].sort((o, a) => yt(a.createdAt) - yt(o.createdAt)), s = r[0] ?? null;
|
|
3905
3905
|
return {
|
|
3906
3906
|
threadId: (e == null ? void 0 : e.threadId) ?? "",
|
|
3907
|
-
latest:
|
|
3907
|
+
latest: s,
|
|
3908
3908
|
checkpoints: r,
|
|
3909
|
-
interrupt: (
|
|
3909
|
+
interrupt: (s == null ? void 0 : s.interrupt) ?? null
|
|
3910
3910
|
};
|
|
3911
3911
|
}
|
|
3912
3912
|
function Cr(e, t) {
|
|
3913
|
-
var
|
|
3913
|
+
var k, h;
|
|
3914
3914
|
if (!e) return null;
|
|
3915
|
-
const n = ((
|
|
3915
|
+
const n = ((k = e.values) == null ? void 0 : k.activeAgent) ?? null, r = (h = e.values) == null ? void 0 : h.messages, o = (Array.isArray(r) ? r : []).map((T) => Er(T, n)).filter((T) => !!T), a = Re(e.metadata) ?? {}, i = gt(e.config), u = Re(e.parentConfig), l = gt(u), c = Be(i, ["checkpointId"]), d = Be(i, ["checkpointNs"]), p = Be(l, ["checkpointId"]), m = Re(e.config), v = Array.isArray(e.tasks) ? e.tasks.map((T) => ({ ...T })) : e.tasks ?? null, f = Array.isArray(e.next) ? [...e.next] : e.next ?? null, b = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), x = {
|
|
3916
3916
|
...a,
|
|
3917
3917
|
step: Sr(a, ["step"]) ?? 0,
|
|
3918
3918
|
source: Be(a, ["source"]) ?? null
|
|
3919
|
-
}, S =
|
|
3919
|
+
}, S = o.map((T) => ({
|
|
3920
3920
|
...T,
|
|
3921
|
-
checkpointId: T.checkpointId ??
|
|
3922
|
-
checkpointNs: T.checkpointNs ??
|
|
3921
|
+
checkpointId: T.checkpointId ?? c ?? null,
|
|
3922
|
+
checkpointNs: T.checkpointNs ?? d ?? null
|
|
3923
3923
|
})), A = e.values, w = Array.isArray(e.interrupts) ? e.interrupts : Array.isArray(A == null ? void 0 : A.interrupts) ? A.interrupts : [];
|
|
3924
3924
|
return {
|
|
3925
|
-
checkpointId:
|
|
3926
|
-
checkpointNs:
|
|
3927
|
-
createdAt:
|
|
3925
|
+
checkpointId: c ?? null,
|
|
3926
|
+
checkpointNs: d ?? null,
|
|
3927
|
+
createdAt: b,
|
|
3928
3928
|
parentId: p ?? null,
|
|
3929
3929
|
messages: S,
|
|
3930
3930
|
interrupt: Pr(
|
|
3931
3931
|
w,
|
|
3932
3932
|
t,
|
|
3933
|
-
|
|
3933
|
+
c ?? null
|
|
3934
3934
|
),
|
|
3935
3935
|
metadata: x,
|
|
3936
|
-
config:
|
|
3937
|
-
parentConfig:
|
|
3938
|
-
next:
|
|
3939
|
-
tasks:
|
|
3936
|
+
config: m ?? null,
|
|
3937
|
+
parentConfig: u ?? null,
|
|
3938
|
+
next: f,
|
|
3939
|
+
tasks: v,
|
|
3940
3940
|
values: e.values ?? {}
|
|
3941
3941
|
};
|
|
3942
3942
|
}
|
|
@@ -3946,15 +3946,15 @@ function Er(e, t) {
|
|
|
3946
3946
|
}
|
|
3947
3947
|
function Pr(e, t, n) {
|
|
3948
3948
|
const r = e.length;
|
|
3949
|
-
for (let
|
|
3950
|
-
const
|
|
3951
|
-
if (!
|
|
3949
|
+
for (let s = r - 1; s >= 0; s -= 1) {
|
|
3950
|
+
const o = e[s];
|
|
3951
|
+
if (!o || typeof o != "object")
|
|
3952
3952
|
continue;
|
|
3953
|
-
const a =
|
|
3953
|
+
const a = o, i = a.value ?? o;
|
|
3954
3954
|
if (i == null)
|
|
3955
3955
|
continue;
|
|
3956
3956
|
return {
|
|
3957
|
-
id: typeof a.id == "string" && a.id.trim() ? a.id : `interrupt-${n ?? t}-${
|
|
3957
|
+
id: typeof a.id == "string" && a.id.trim() ? a.id : `interrupt-${n ?? t}-${s}`,
|
|
3958
3958
|
value: i
|
|
3959
3959
|
};
|
|
3960
3960
|
}
|
|
@@ -3979,54 +3979,54 @@ function Nr(e) {
|
|
|
3979
3979
|
return _r(e.content) || "";
|
|
3980
3980
|
}
|
|
3981
3981
|
function zr(e) {
|
|
3982
|
-
const t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Map(),
|
|
3983
|
-
for (let
|
|
3984
|
-
const
|
|
3985
|
-
let
|
|
3986
|
-
const S = Array.isArray(
|
|
3987
|
-
for (const
|
|
3988
|
-
|
|
3989
|
-
const A =
|
|
3982
|
+
const t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Map(), s = [];
|
|
3983
|
+
for (let l = 0; l < e.length; l++) {
|
|
3984
|
+
const c = e[l], d = c.checkpointId, p = d ?? `cp-${l}`, m = c.metadata ?? {}, v = typeof m.step == "number" ? m.step : null, f = typeof m.source == "string" ? m.source : null;
|
|
3985
|
+
let b = null, x = null;
|
|
3986
|
+
const S = Array.isArray(c.messages) ? c.messages : [];
|
|
3987
|
+
for (const h of S)
|
|
3988
|
+
h.role === "user" && (x || (x = h), h.id && (b = h.id));
|
|
3989
|
+
const A = c.next && c.next.length > 0 ? String(c.next[0]) : null, w = c.parentConfig ?? null, k = {
|
|
3990
3990
|
id: p,
|
|
3991
|
-
step:
|
|
3992
|
-
source:
|
|
3993
|
-
createdAt:
|
|
3994
|
-
namespace:
|
|
3995
|
-
parentId:
|
|
3991
|
+
step: v,
|
|
3992
|
+
source: f,
|
|
3993
|
+
createdAt: c.createdAt ?? null,
|
|
3994
|
+
namespace: c.checkpointNs ?? null,
|
|
3995
|
+
parentId: c.parentId ?? null,
|
|
3996
3996
|
next: A,
|
|
3997
3997
|
parentConfig: w,
|
|
3998
|
-
userMessageId:
|
|
3998
|
+
userMessageId: b
|
|
3999
3999
|
};
|
|
4000
|
-
if (
|
|
4001
|
-
const
|
|
4002
|
-
|
|
4000
|
+
if (s.push(k), d && t.set(d, k), d && x) {
|
|
4001
|
+
const h = Nr(x);
|
|
4002
|
+
h && r.set(d, h);
|
|
4003
4003
|
}
|
|
4004
4004
|
n.push({
|
|
4005
4005
|
id: p,
|
|
4006
|
-
messageId:
|
|
4007
|
-
step:
|
|
4008
|
-
source:
|
|
4009
|
-
createdAt:
|
|
4006
|
+
messageId: b,
|
|
4007
|
+
step: v,
|
|
4008
|
+
source: f,
|
|
4009
|
+
createdAt: c.createdAt ?? null,
|
|
4010
4010
|
next: A,
|
|
4011
4011
|
parentConfig: w
|
|
4012
4012
|
});
|
|
4013
4013
|
}
|
|
4014
|
-
const
|
|
4015
|
-
for (const
|
|
4016
|
-
if (!
|
|
4017
|
-
const
|
|
4018
|
-
|
|
4014
|
+
const o = /* @__PURE__ */ new Map();
|
|
4015
|
+
for (const l of s) {
|
|
4016
|
+
if (!l.userMessageId) continue;
|
|
4017
|
+
const c = o.get(l.userMessageId) ?? [];
|
|
4018
|
+
c.push(l), o.set(l.userMessageId, c);
|
|
4019
4019
|
}
|
|
4020
|
-
for (const
|
|
4021
|
-
if (!
|
|
4022
|
-
|
|
4023
|
-
const
|
|
4024
|
-
return (p.createdAt ? Date.parse(p.createdAt) : 0) -
|
|
4020
|
+
for (const l of o.values()) {
|
|
4021
|
+
if (!l.length) continue;
|
|
4022
|
+
l.sort((d, p) => {
|
|
4023
|
+
const m = d.createdAt ? Date.parse(d.createdAt) : 0;
|
|
4024
|
+
return (p.createdAt ? Date.parse(p.createdAt) : 0) - m;
|
|
4025
4025
|
});
|
|
4026
|
-
const
|
|
4027
|
-
for (let
|
|
4028
|
-
const p =
|
|
4029
|
-
p.attemptCount =
|
|
4026
|
+
const c = l.length;
|
|
4027
|
+
for (let d = 0; d < l.length; d++) {
|
|
4028
|
+
const p = l[d];
|
|
4029
|
+
p.attemptCount = c, p.attemptIndex = d, p.isLatestAttempt = d === 0;
|
|
4030
4030
|
}
|
|
4031
4031
|
}
|
|
4032
4032
|
return {
|
|
@@ -4035,19 +4035,19 @@ function zr(e) {
|
|
|
4035
4035
|
timeline: n,
|
|
4036
4036
|
messagePreviews: r,
|
|
4037
4037
|
getLatest: () => {
|
|
4038
|
-
const
|
|
4039
|
-
if (
|
|
4040
|
-
return t.get(
|
|
4038
|
+
const l = n[0];
|
|
4039
|
+
if (l)
|
|
4040
|
+
return t.get(l.id);
|
|
4041
4041
|
},
|
|
4042
|
-
getCheckpoint: (
|
|
4043
|
-
getMessageAttempts: (
|
|
4044
|
-
const
|
|
4045
|
-
for (const
|
|
4046
|
-
|
|
4047
|
-
return
|
|
4048
|
-
const
|
|
4049
|
-
return
|
|
4050
|
-
}),
|
|
4042
|
+
getCheckpoint: (l) => t.get(l),
|
|
4043
|
+
getMessageAttempts: (l) => {
|
|
4044
|
+
const c = [];
|
|
4045
|
+
for (const d of t.values())
|
|
4046
|
+
d.userMessageId === l && c.push(d);
|
|
4047
|
+
return c.length ? (c.sort((d, p) => {
|
|
4048
|
+
const m = typeof d.attemptIndex == "number" ? d.attemptIndex : Number.MAX_SAFE_INTEGER, v = typeof p.attemptIndex == "number" ? p.attemptIndex : Number.MAX_SAFE_INTEGER;
|
|
4049
|
+
return m - v;
|
|
4050
|
+
}), c) : [];
|
|
4051
4051
|
}
|
|
4052
4052
|
};
|
|
4053
4053
|
}
|
|
@@ -4057,14 +4057,14 @@ function uo(e, t, n) {
|
|
|
4057
4057
|
const r = n.getMessageAttempts(e);
|
|
4058
4058
|
if (!r.length)
|
|
4059
4059
|
return { attemptCount: 1, attemptIndex: 0, attempts: [] };
|
|
4060
|
-
let
|
|
4060
|
+
let s = 0;
|
|
4061
4061
|
if (t) {
|
|
4062
|
-
const
|
|
4063
|
-
|
|
4062
|
+
const o = r.findIndex((a) => a.id === t);
|
|
4063
|
+
o >= 0 && (s = o);
|
|
4064
4064
|
}
|
|
4065
4065
|
return {
|
|
4066
4066
|
attemptCount: r.length,
|
|
4067
|
-
attemptIndex:
|
|
4067
|
+
attemptIndex: s,
|
|
4068
4068
|
attempts: r
|
|
4069
4069
|
};
|
|
4070
4070
|
}
|
|
@@ -4076,140 +4076,143 @@ function $t({
|
|
|
4076
4076
|
fileApi: t,
|
|
4077
4077
|
seed: n,
|
|
4078
4078
|
onError: r,
|
|
4079
|
-
currentThreadId:
|
|
4080
|
-
autoLoadInitial:
|
|
4079
|
+
currentThreadId: s,
|
|
4080
|
+
autoLoadInitial: o = !0,
|
|
4081
4081
|
isStreaming: a,
|
|
4082
|
-
getMessages: i
|
|
4082
|
+
getMessages: i,
|
|
4083
|
+
includeHistory: u = !0
|
|
4083
4084
|
}) {
|
|
4084
|
-
const [
|
|
4085
|
-
() => mt(
|
|
4086
|
-
[
|
|
4087
|
-
).checkpoints,
|
|
4085
|
+
const [l, c] = H(null), p = Z(
|
|
4086
|
+
() => mt(l),
|
|
4087
|
+
[l]
|
|
4088
|
+
).checkpoints, m = Rr(p), v = m.timeline, [f, b] = H(!1), [x, S] = H(!1), [A, w] = H(!1), [k, h] = H(null), T = W(s), y = W(null), I = W(null);
|
|
4088
4089
|
Y(() => {
|
|
4089
|
-
|
|
4090
|
-
}, [
|
|
4091
|
-
const
|
|
4092
|
-
async (
|
|
4093
|
-
const
|
|
4094
|
-
threadId:
|
|
4095
|
-
checkpointId:
|
|
4096
|
-
checkpointNs:
|
|
4097
|
-
}),
|
|
4090
|
+
T.current = s;
|
|
4091
|
+
}, [s]);
|
|
4092
|
+
const E = _(
|
|
4093
|
+
async (P) => {
|
|
4094
|
+
const F = await e.getState({
|
|
4095
|
+
threadId: P.threadId,
|
|
4096
|
+
checkpointId: P.checkpointId,
|
|
4097
|
+
checkpointNs: P.checkpointNs
|
|
4098
|
+
}), N = {
|
|
4098
4099
|
version: "values@1",
|
|
4099
|
-
threadId:
|
|
4100
|
-
checkpoints: [
|
|
4101
|
-
},
|
|
4102
|
-
return
|
|
4100
|
+
threadId: P.threadId,
|
|
4101
|
+
checkpoints: [F]
|
|
4102
|
+
}, j = t ? await Mr(N, t) : N, { latest: G } = mt(j);
|
|
4103
|
+
return G;
|
|
4103
4104
|
},
|
|
4104
4105
|
[e, t]
|
|
4105
|
-
),
|
|
4106
|
-
async (
|
|
4107
|
-
var
|
|
4108
|
-
if (!
|
|
4109
|
-
const
|
|
4110
|
-
if (
|
|
4111
|
-
(
|
|
4112
|
-
const
|
|
4113
|
-
|
|
4106
|
+
), L = _(
|
|
4107
|
+
async (P, F) => {
|
|
4108
|
+
var G;
|
|
4109
|
+
if (!P) return;
|
|
4110
|
+
const N = `${P}:${F ?? "latest"}`;
|
|
4111
|
+
if (y.current === N || f) return;
|
|
4112
|
+
(G = I.current) == null || G.abort();
|
|
4113
|
+
const j = new AbortController();
|
|
4114
|
+
I.current = j, b(!0), h(null);
|
|
4114
4115
|
try {
|
|
4115
|
-
const
|
|
4116
|
-
threadId:
|
|
4117
|
-
checkpointId:
|
|
4116
|
+
const g = await E({
|
|
4117
|
+
threadId: P,
|
|
4118
|
+
checkpointId: F ?? void 0
|
|
4118
4119
|
});
|
|
4119
|
-
if (
|
|
4120
|
-
|
|
4120
|
+
if (T.current !== P) {
|
|
4121
|
+
b(!1);
|
|
4121
4122
|
return;
|
|
4122
4123
|
}
|
|
4123
|
-
n((
|
|
4124
|
-
checkpointId: (
|
|
4125
|
-
checkpointNs: (
|
|
4126
|
-
pendingInterrupt: (
|
|
4127
|
-
values:
|
|
4128
|
-
}),
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4124
|
+
if (n((g == null ? void 0 : g.messages) ?? [], {
|
|
4125
|
+
checkpointId: (g == null ? void 0 : g.checkpointId) ?? null,
|
|
4126
|
+
checkpointNs: (g == null ? void 0 : g.checkpointNs) ?? null,
|
|
4127
|
+
pendingInterrupt: (g == null ? void 0 : g.interrupt) ?? null,
|
|
4128
|
+
values: g == null ? void 0 : g.values
|
|
4129
|
+
}), y.current = N, b(!1), u) {
|
|
4130
|
+
w(!0);
|
|
4131
|
+
try {
|
|
4132
|
+
const z = await e.getStateHistory({
|
|
4133
|
+
threadId: P,
|
|
4134
|
+
limit: 100,
|
|
4135
|
+
includeMessages: !1
|
|
4136
|
+
});
|
|
4137
|
+
T.current === P && c(z);
|
|
4138
|
+
} finally {
|
|
4139
|
+
w(!1);
|
|
4140
|
+
}
|
|
4138
4141
|
}
|
|
4139
|
-
} catch (
|
|
4140
|
-
if (
|
|
4141
|
-
const
|
|
4142
|
-
|
|
4142
|
+
} catch (g) {
|
|
4143
|
+
if (b(!1), !Xt(g)) {
|
|
4144
|
+
const z = String(g);
|
|
4145
|
+
h(z), r == null || r(z);
|
|
4143
4146
|
}
|
|
4144
4147
|
}
|
|
4145
4148
|
},
|
|
4146
|
-
[e, n,
|
|
4147
|
-
),
|
|
4148
|
-
async (
|
|
4149
|
-
if (
|
|
4150
|
-
|
|
4149
|
+
[e, n, E, r, i]
|
|
4150
|
+
), M = _(
|
|
4151
|
+
async (P, F) => {
|
|
4152
|
+
if (s) {
|
|
4153
|
+
S(!0);
|
|
4151
4154
|
try {
|
|
4152
|
-
const
|
|
4153
|
-
threadId:
|
|
4154
|
-
checkpointId:
|
|
4155
|
-
checkpointNs:
|
|
4155
|
+
const N = await E({
|
|
4156
|
+
threadId: s,
|
|
4157
|
+
checkpointId: P,
|
|
4158
|
+
checkpointNs: F ?? void 0
|
|
4156
4159
|
});
|
|
4157
|
-
n((
|
|
4158
|
-
checkpointId: (
|
|
4159
|
-
checkpointNs: (
|
|
4160
|
-
pendingInterrupt: (
|
|
4161
|
-
values:
|
|
4160
|
+
n((N == null ? void 0 : N.messages) ?? [], {
|
|
4161
|
+
checkpointId: (N == null ? void 0 : N.checkpointId) ?? P,
|
|
4162
|
+
checkpointNs: (N == null ? void 0 : N.checkpointNs) ?? F,
|
|
4163
|
+
pendingInterrupt: (N == null ? void 0 : N.interrupt) ?? null,
|
|
4164
|
+
values: N == null ? void 0 : N.values
|
|
4162
4165
|
});
|
|
4163
|
-
} catch (
|
|
4164
|
-
console.error("[useThreadHistoryState] Navigation failed",
|
|
4166
|
+
} catch (N) {
|
|
4167
|
+
console.error("[useThreadHistoryState] Navigation failed", N);
|
|
4165
4168
|
} finally {
|
|
4166
|
-
|
|
4169
|
+
S(!1);
|
|
4167
4170
|
}
|
|
4168
4171
|
}
|
|
4169
4172
|
},
|
|
4170
|
-
[
|
|
4171
|
-
),
|
|
4172
|
-
|
|
4173
|
-
}, [
|
|
4174
|
-
async (
|
|
4175
|
-
const
|
|
4176
|
-
!
|
|
4173
|
+
[s, E, n]
|
|
4174
|
+
), $ = _(async () => {
|
|
4175
|
+
s && await L(s);
|
|
4176
|
+
}, [s, L]), U = _(
|
|
4177
|
+
async (P) => {
|
|
4178
|
+
const F = (P == null ? void 0 : P.threadId) || s;
|
|
4179
|
+
!F || s !== F || (c(P), y.current = `${F}:latest`);
|
|
4177
4180
|
},
|
|
4178
|
-
[
|
|
4181
|
+
[s]
|
|
4179
4182
|
);
|
|
4180
4183
|
Y(() => {
|
|
4181
|
-
if (!
|
|
4182
|
-
const
|
|
4183
|
-
|
|
4184
|
-
}, [
|
|
4185
|
-
const
|
|
4186
|
-
c(null),
|
|
4184
|
+
if (!o || !s || f || a) return;
|
|
4185
|
+
const P = `${s}:latest`;
|
|
4186
|
+
y.current !== P && L(s);
|
|
4187
|
+
}, [o, s, f, a, L]);
|
|
4188
|
+
const V = _(() => {
|
|
4189
|
+
c(null), b(!1), S(!1), w(!1), h(null), y.current = null;
|
|
4187
4190
|
}, []);
|
|
4188
4191
|
return {
|
|
4189
|
-
threadCheckpoints:
|
|
4190
|
-
threadTimeline:
|
|
4191
|
-
checkpointIndex:
|
|
4192
|
-
isLoadingThread:
|
|
4193
|
-
isLoadingCheckpoint:
|
|
4194
|
-
isLoadingHistory:
|
|
4195
|
-
threadStateError:
|
|
4196
|
-
loadThread:
|
|
4197
|
-
navigateToCheckpoint:
|
|
4198
|
-
setCurrentCheckpointId: (
|
|
4199
|
-
n(i(), { checkpointId:
|
|
4192
|
+
threadCheckpoints: p,
|
|
4193
|
+
threadTimeline: v,
|
|
4194
|
+
checkpointIndex: m,
|
|
4195
|
+
isLoadingThread: f,
|
|
4196
|
+
isLoadingCheckpoint: x,
|
|
4197
|
+
isLoadingHistory: A,
|
|
4198
|
+
threadStateError: k,
|
|
4199
|
+
loadThread: L,
|
|
4200
|
+
navigateToCheckpoint: M,
|
|
4201
|
+
setCurrentCheckpointId: (P, F) => {
|
|
4202
|
+
n(i(), { checkpointId: P, checkpointNs: F });
|
|
4200
4203
|
},
|
|
4201
|
-
returnToLatest:
|
|
4202
|
-
handleValuesEvent:
|
|
4204
|
+
returnToLatest: $,
|
|
4205
|
+
handleValuesEvent: U,
|
|
4203
4206
|
markSkipNextLoad: () => {
|
|
4204
4207
|
},
|
|
4205
4208
|
markStreamPendingThread: () => {
|
|
4206
4209
|
},
|
|
4207
|
-
resetHistoryState:
|
|
4208
|
-
clearState:
|
|
4210
|
+
resetHistoryState: V,
|
|
4211
|
+
clearState: V
|
|
4209
4212
|
};
|
|
4210
4213
|
}
|
|
4211
4214
|
const Dt = Ce(null), Kt = Ce(null);
|
|
4212
|
-
function
|
|
4215
|
+
function Ht(e) {
|
|
4213
4216
|
const t = je(Dt);
|
|
4214
4217
|
if (!t && !(e != null && e.optional)) throw new Error("useThreadState must be used within a ThreadStateProvider");
|
|
4215
4218
|
return t;
|
|
@@ -4225,193 +4228,195 @@ function jr({
|
|
|
4225
4228
|
initialThreadId: t = null,
|
|
4226
4229
|
initialCheckpointId: n = null,
|
|
4227
4230
|
initialCheckpointNs: r = null,
|
|
4228
|
-
autoLoadInitial:
|
|
4229
|
-
isStreaming:
|
|
4230
|
-
onError: a
|
|
4231
|
+
autoLoadInitial: s = !0,
|
|
4232
|
+
isStreaming: o,
|
|
4233
|
+
onError: a,
|
|
4234
|
+
includeHistory: i = !0
|
|
4231
4235
|
}) {
|
|
4232
|
-
const { chatApi:
|
|
4233
|
-
threadCheckpoints:
|
|
4234
|
-
threadTimeline:
|
|
4235
|
-
checkpointIndex:
|
|
4236
|
-
isLoadingThread:
|
|
4237
|
-
isLoadingCheckpoint:
|
|
4238
|
-
isLoadingHistory:
|
|
4239
|
-
threadStateError:
|
|
4240
|
-
loadThread:
|
|
4241
|
-
navigateToCheckpoint:
|
|
4242
|
-
setCurrentCheckpointId:
|
|
4243
|
-
returnToLatest:
|
|
4244
|
-
handleValuesEvent:
|
|
4245
|
-
markSkipNextLoad:
|
|
4246
|
-
markStreamPendingThread:
|
|
4247
|
-
resetHistoryState:
|
|
4236
|
+
const { chatApi: u, fileApi: l } = Me(), { currentThreadId: c } = ot(), { state: d, seed: p, onEvent: m, dispatch: v } = kr(), {
|
|
4237
|
+
threadCheckpoints: f,
|
|
4238
|
+
threadTimeline: b,
|
|
4239
|
+
checkpointIndex: x,
|
|
4240
|
+
isLoadingThread: S,
|
|
4241
|
+
isLoadingCheckpoint: A,
|
|
4242
|
+
isLoadingHistory: w,
|
|
4243
|
+
threadStateError: k,
|
|
4244
|
+
loadThread: h,
|
|
4245
|
+
navigateToCheckpoint: T,
|
|
4246
|
+
setCurrentCheckpointId: y,
|
|
4247
|
+
returnToLatest: I,
|
|
4248
|
+
handleValuesEvent: E,
|
|
4249
|
+
markSkipNextLoad: L,
|
|
4250
|
+
markStreamPendingThread: M,
|
|
4251
|
+
resetHistoryState: $
|
|
4248
4252
|
} = $t({
|
|
4249
|
-
api:
|
|
4250
|
-
fileApi:
|
|
4251
|
-
seed:
|
|
4253
|
+
api: u,
|
|
4254
|
+
fileApi: l,
|
|
4255
|
+
seed: p,
|
|
4252
4256
|
onError: a,
|
|
4253
4257
|
currentThreadId: c,
|
|
4254
4258
|
initialThreadId: t,
|
|
4255
4259
|
initialCheckpointId: n,
|
|
4256
4260
|
initialCheckpointNs: r,
|
|
4257
|
-
autoLoadInitial:
|
|
4258
|
-
isStreaming:
|
|
4259
|
-
getMessages:
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4261
|
+
autoLoadInitial: s,
|
|
4262
|
+
isStreaming: o,
|
|
4263
|
+
getMessages: _(() => d.messages, [d.messages]),
|
|
4264
|
+
includeHistory: i
|
|
4265
|
+
}), U = W(null), V = _(
|
|
4266
|
+
(D) => {
|
|
4267
|
+
U.current = D;
|
|
4263
4268
|
},
|
|
4264
4269
|
[]
|
|
4265
|
-
),
|
|
4266
|
-
(
|
|
4267
|
-
|
|
4270
|
+
), P = W(null), F = _(
|
|
4271
|
+
(D) => {
|
|
4272
|
+
P.current = D;
|
|
4268
4273
|
},
|
|
4269
4274
|
[]
|
|
4270
|
-
),
|
|
4271
|
-
(
|
|
4272
|
-
const
|
|
4273
|
-
return
|
|
4275
|
+
), N = Z(() => ({ assemblingMessageId: d.assemblingId ?? null }), [d.assemblingId]), j = _(
|
|
4276
|
+
(D, K) => {
|
|
4277
|
+
const B = jt(D, "user");
|
|
4278
|
+
return v({
|
|
4274
4279
|
type: "user_message",
|
|
4275
4280
|
payload: {
|
|
4276
|
-
message:
|
|
4277
|
-
editingMessageId:
|
|
4281
|
+
message: B,
|
|
4282
|
+
editingMessageId: K == null ? void 0 : K.editingMessageId
|
|
4278
4283
|
}
|
|
4279
|
-
}),
|
|
4284
|
+
}), B;
|
|
4280
4285
|
},
|
|
4281
|
-
[
|
|
4282
|
-
),
|
|
4283
|
-
|
|
4284
|
-
}, [
|
|
4285
|
-
await
|
|
4286
|
-
}, [
|
|
4286
|
+
[v]
|
|
4287
|
+
), G = _(async () => {
|
|
4288
|
+
U.current ? await U.current() : (p([], {}), $());
|
|
4289
|
+
}, [p, $]), g = _(async (D, K, B) => {
|
|
4290
|
+
await h(D, K, { clearProgress: !1 });
|
|
4291
|
+
}, [h]), z = Z(() => Bn(d.messages), [d.messages]), C = Z(
|
|
4287
4292
|
() => ({
|
|
4288
|
-
status:
|
|
4293
|
+
status: d.status,
|
|
4289
4294
|
threadId: c,
|
|
4290
|
-
messages:
|
|
4291
|
-
taskMessagesByScope:
|
|
4292
|
-
interrupt:
|
|
4295
|
+
messages: d.messages,
|
|
4296
|
+
taskMessagesByScope: d.taskMessagesByScope,
|
|
4297
|
+
interrupt: d.pendingInterrupt,
|
|
4293
4298
|
checkpoint: {
|
|
4294
|
-
id:
|
|
4295
|
-
namespace:
|
|
4299
|
+
id: d.lastCheckpointId ?? null,
|
|
4300
|
+
namespace: d.lastCheckpointNs ?? null
|
|
4296
4301
|
},
|
|
4297
|
-
checkpoints:
|
|
4298
|
-
checkpointIndex:
|
|
4299
|
-
timelineCheckpoints:
|
|
4300
|
-
metadata:
|
|
4301
|
-
values:
|
|
4302
|
-
isLoading:
|
|
4303
|
-
isLoadingCheckpoint:
|
|
4304
|
-
isLoadingHistory:
|
|
4305
|
-
error:
|
|
4302
|
+
checkpoints: f,
|
|
4303
|
+
checkpointIndex: x,
|
|
4304
|
+
timelineCheckpoints: b,
|
|
4305
|
+
metadata: N,
|
|
4306
|
+
values: d.values ?? {},
|
|
4307
|
+
isLoading: S,
|
|
4308
|
+
isLoadingCheckpoint: A,
|
|
4309
|
+
isLoadingHistory: w,
|
|
4310
|
+
error: k,
|
|
4306
4311
|
loadOlder: async () => {
|
|
4307
4312
|
},
|
|
4308
4313
|
// Placeholder
|
|
4309
|
-
seedFromSnapshot: (
|
|
4310
|
-
|
|
4311
|
-
checkpointId:
|
|
4312
|
-
checkpointNs:
|
|
4313
|
-
pendingInterrupt:
|
|
4314
|
-
values:
|
|
4314
|
+
seedFromSnapshot: (D) => {
|
|
4315
|
+
p(D.messages, {
|
|
4316
|
+
checkpointId: D.checkpointId,
|
|
4317
|
+
checkpointNs: D.checkpointNs,
|
|
4318
|
+
pendingInterrupt: D.interrupt,
|
|
4319
|
+
values: D.values
|
|
4315
4320
|
});
|
|
4316
4321
|
},
|
|
4317
|
-
clearState:
|
|
4318
|
-
navigateToCheckpoint:
|
|
4319
|
-
setCurrentCheckpointId:
|
|
4320
|
-
returnToLatest:
|
|
4321
|
-
loadThread:
|
|
4322
|
-
clearThread:
|
|
4323
|
-
respondToInterrupt: async (
|
|
4324
|
-
|
|
4322
|
+
clearState: G,
|
|
4323
|
+
navigateToCheckpoint: T,
|
|
4324
|
+
setCurrentCheckpointId: y,
|
|
4325
|
+
returnToLatest: I,
|
|
4326
|
+
loadThread: g,
|
|
4327
|
+
clearThread: G,
|
|
4328
|
+
respondToInterrupt: async (D, K, B) => {
|
|
4329
|
+
P.current && await P.current(D, K, B);
|
|
4325
4330
|
},
|
|
4326
|
-
messagePreviews:
|
|
4327
|
-
handleValuesEvent:
|
|
4328
|
-
markSkipNextLoad:
|
|
4329
|
-
markStreamPendingThread:
|
|
4330
|
-
resetHistoryState:
|
|
4331
|
-
pushUser:
|
|
4332
|
-
onEvent:
|
|
4333
|
-
artifacts:
|
|
4331
|
+
messagePreviews: x.messagePreviews,
|
|
4332
|
+
handleValuesEvent: E,
|
|
4333
|
+
markSkipNextLoad: L,
|
|
4334
|
+
markStreamPendingThread: M,
|
|
4335
|
+
resetHistoryState: $,
|
|
4336
|
+
pushUser: j,
|
|
4337
|
+
onEvent: m,
|
|
4338
|
+
artifacts: z
|
|
4334
4339
|
}),
|
|
4335
4340
|
[
|
|
4336
4341
|
c,
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
v,
|
|
4346
|
-
R,
|
|
4342
|
+
d.messages,
|
|
4343
|
+
d.taskMessagesByScope,
|
|
4344
|
+
d.pendingInterrupt,
|
|
4345
|
+
d.lastCheckpointId,
|
|
4346
|
+
d.lastCheckpointNs,
|
|
4347
|
+
d.values,
|
|
4348
|
+
f,
|
|
4349
|
+
b,
|
|
4347
4350
|
x,
|
|
4351
|
+
N,
|
|
4348
4352
|
S,
|
|
4349
4353
|
A,
|
|
4350
4354
|
w,
|
|
4351
|
-
f,
|
|
4352
|
-
B,
|
|
4353
|
-
y,
|
|
4354
|
-
T,
|
|
4355
|
-
m,
|
|
4356
|
-
L,
|
|
4357
4355
|
k,
|
|
4358
|
-
E,
|
|
4359
|
-
U,
|
|
4360
|
-
W,
|
|
4361
4356
|
p,
|
|
4362
|
-
|
|
4357
|
+
G,
|
|
4358
|
+
T,
|
|
4359
|
+
y,
|
|
4360
|
+
I,
|
|
4361
|
+
g,
|
|
4362
|
+
E,
|
|
4363
|
+
L,
|
|
4364
|
+
M,
|
|
4365
|
+
j,
|
|
4366
|
+
m,
|
|
4367
|
+
z
|
|
4363
4368
|
]
|
|
4364
|
-
),
|
|
4369
|
+
), O = Z(
|
|
4365
4370
|
() => ({
|
|
4366
|
-
registerClearThread:
|
|
4367
|
-
registerRespondToInterrupt:
|
|
4371
|
+
registerClearThread: V,
|
|
4372
|
+
registerRespondToInterrupt: F
|
|
4368
4373
|
}),
|
|
4369
|
-
[
|
|
4374
|
+
[V, F]
|
|
4370
4375
|
);
|
|
4371
|
-
return /* @__PURE__ */ de(Kt.Provider, { value:
|
|
4376
|
+
return /* @__PURE__ */ de(Kt.Provider, { value: O, children: /* @__PURE__ */ de(Dt.Provider, { value: C, children: e }) });
|
|
4372
4377
|
}
|
|
4373
|
-
const
|
|
4378
|
+
const Vt = Ce(null), Ur = Ce(!1);
|
|
4374
4379
|
function Br({
|
|
4375
4380
|
children: e,
|
|
4376
4381
|
onError: t,
|
|
4377
4382
|
onAuthError: n,
|
|
4378
4383
|
onConnectionError: r,
|
|
4379
|
-
onToolEnd:
|
|
4380
|
-
onUpdateEvent:
|
|
4384
|
+
onToolEnd: s,
|
|
4385
|
+
onUpdateEvent: o,
|
|
4381
4386
|
onCustomEvent: a,
|
|
4382
4387
|
onMetadataEvent: i,
|
|
4383
|
-
onFinish:
|
|
4384
|
-
onStreamingChange:
|
|
4388
|
+
onFinish: u,
|
|
4389
|
+
onStreamingChange: l
|
|
4385
4390
|
}) {
|
|
4386
|
-
const { chatApi:
|
|
4391
|
+
const { chatApi: c, baseUrl: d } = Me(), p = d, m = ge(t), v = ge(n), f = ge(r), b = ge(s), x = ge(o), S = ge(a), A = ge(i), w = ge(u), k = ge(l), h = Z(
|
|
4387
4392
|
() => ({
|
|
4388
|
-
onError:
|
|
4389
|
-
onAuthError:
|
|
4390
|
-
onConnectionError:
|
|
4393
|
+
onError: m,
|
|
4394
|
+
onAuthError: v,
|
|
4395
|
+
onConnectionError: f,
|
|
4391
4396
|
onMetadataEvent: A,
|
|
4392
4397
|
onCustomEvent: S,
|
|
4393
4398
|
onUpdateEvent: x,
|
|
4394
|
-
onToolEnd:
|
|
4399
|
+
onToolEnd: b,
|
|
4395
4400
|
onFinish: w
|
|
4396
4401
|
}),
|
|
4397
4402
|
[
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4403
|
+
m,
|
|
4404
|
+
v,
|
|
4405
|
+
f,
|
|
4401
4406
|
A,
|
|
4402
4407
|
S,
|
|
4403
4408
|
x,
|
|
4404
|
-
|
|
4409
|
+
b,
|
|
4405
4410
|
w
|
|
4406
4411
|
]
|
|
4407
4412
|
);
|
|
4408
4413
|
return /* @__PURE__ */ de(Ur.Provider, { value: !0, children: /* @__PURE__ */ de(
|
|
4409
4414
|
Fr,
|
|
4410
4415
|
{
|
|
4411
|
-
api:
|
|
4416
|
+
api: c,
|
|
4412
4417
|
streamBaseUrl: p,
|
|
4413
|
-
handlers:
|
|
4414
|
-
onStreamingChange:
|
|
4418
|
+
handlers: h,
|
|
4419
|
+
onStreamingChange: k,
|
|
4415
4420
|
children: e
|
|
4416
4421
|
}
|
|
4417
4422
|
) });
|
|
@@ -4421,35 +4426,35 @@ function Fr({
|
|
|
4421
4426
|
api: t,
|
|
4422
4427
|
streamBaseUrl: n,
|
|
4423
4428
|
handlers: r,
|
|
4424
|
-
onStreamingChange:
|
|
4429
|
+
onStreamingChange: s
|
|
4425
4430
|
}) {
|
|
4426
|
-
const { setCurrentThreadId:
|
|
4427
|
-
interrupt:
|
|
4428
|
-
checkpoint:
|
|
4429
|
-
timelineCheckpoints:
|
|
4431
|
+
const { setCurrentThreadId: o, currentThreadIdRef: a, addThreadFromEvent: i, currentThreadId: u } = ot(), {
|
|
4432
|
+
interrupt: l,
|
|
4433
|
+
checkpoint: c,
|
|
4434
|
+
timelineCheckpoints: d,
|
|
4430
4435
|
handleValuesEvent: p,
|
|
4431
|
-
markSkipNextLoad:
|
|
4432
|
-
markStreamPendingThread:
|
|
4433
|
-
resetHistoryState:
|
|
4434
|
-
pushUser:
|
|
4436
|
+
markSkipNextLoad: m,
|
|
4437
|
+
markStreamPendingThread: v,
|
|
4438
|
+
resetHistoryState: f,
|
|
4439
|
+
pushUser: b,
|
|
4435
4440
|
onEvent: x,
|
|
4436
4441
|
messages: S
|
|
4437
|
-
} =
|
|
4438
|
-
(
|
|
4439
|
-
i(
|
|
4442
|
+
} = Ht(), { registerClearThread: A, registerRespondToInterrupt: w } = Lr(), k = _(
|
|
4443
|
+
(g) => {
|
|
4444
|
+
i(g), v(g.threadId), a.current !== g.threadId && ((g.created ?? !a.current) && m(g.threadId), o(g.threadId));
|
|
4440
4445
|
},
|
|
4441
|
-
[i,
|
|
4442
|
-
),
|
|
4446
|
+
[i, m, v, o, a]
|
|
4447
|
+
), h = pr({
|
|
4443
4448
|
baseUrl: n,
|
|
4444
4449
|
onEvent: x,
|
|
4445
|
-
onError: (
|
|
4446
|
-
var
|
|
4447
|
-
(
|
|
4450
|
+
onError: (g) => {
|
|
4451
|
+
var z;
|
|
4452
|
+
(z = r.onError) == null || z.call(r, (g == null ? void 0 : g.message) ?? String(g));
|
|
4448
4453
|
},
|
|
4449
4454
|
onAuthError: r.onAuthError,
|
|
4450
4455
|
onConnectionError: r.onConnectionError,
|
|
4451
4456
|
onFinish: r.onFinish,
|
|
4452
|
-
onThreadInfo:
|
|
4457
|
+
onThreadInfo: k,
|
|
4453
4458
|
onMetadataEvent: r.onMetadataEvent,
|
|
4454
4459
|
onCustomEvent: r.onCustomEvent,
|
|
4455
4460
|
onUpdateEvent: r.onUpdateEvent,
|
|
@@ -4457,84 +4462,84 @@ function Fr({
|
|
|
4457
4462
|
handleValuesEvent: p
|
|
4458
4463
|
});
|
|
4459
4464
|
Y(() => {
|
|
4460
|
-
|
|
4461
|
-
}, [
|
|
4462
|
-
const { stream: T, stop:
|
|
4465
|
+
s == null || s(h.isStreaming);
|
|
4466
|
+
}, [h.isStreaming, s]);
|
|
4467
|
+
const { stream: T, stop: y, clear: I, isStreaming: E, error: L, connected: M, activeMessageId: $ } = h;
|
|
4463
4468
|
Y(() => {
|
|
4464
|
-
|
|
4465
|
-
}, [
|
|
4466
|
-
const
|
|
4467
|
-
async (
|
|
4468
|
-
await T(
|
|
4469
|
+
u !== void 0 && I();
|
|
4470
|
+
}, [u, I]);
|
|
4471
|
+
const U = _(
|
|
4472
|
+
async (g, z) => {
|
|
4473
|
+
await T(g, z);
|
|
4469
4474
|
},
|
|
4470
4475
|
[T]
|
|
4471
|
-
),
|
|
4476
|
+
), V = W(c);
|
|
4472
4477
|
Y(() => {
|
|
4473
|
-
|
|
4474
|
-
}, [
|
|
4475
|
-
const
|
|
4476
|
-
async (
|
|
4478
|
+
V.current = c;
|
|
4479
|
+
}, [c]);
|
|
4480
|
+
const P = _(
|
|
4481
|
+
async (g, z, C) => {
|
|
4477
4482
|
var ye;
|
|
4478
|
-
const
|
|
4479
|
-
if (!
|
|
4483
|
+
const O = a.current;
|
|
4484
|
+
if (!O)
|
|
4480
4485
|
throw new Error("No active thread to handle interrupt");
|
|
4481
|
-
const
|
|
4482
|
-
threadId:
|
|
4483
|
-
checkpointId:
|
|
4486
|
+
const D = g ? z ?? !0 : !1, K = V.current, B = (C == null ? void 0 : C.checkpointId) ?? K.id ?? void 0, ee = (C == null ? void 0 : C.checkpointNs) ?? K.namespace ?? void 0, ie = {
|
|
4487
|
+
threadId: O,
|
|
4488
|
+
checkpointId: B,
|
|
4484
4489
|
checkpointNs: ee,
|
|
4485
|
-
command: { kind: "resume", value:
|
|
4490
|
+
command: { kind: "resume", value: D },
|
|
4486
4491
|
payload: {
|
|
4487
4492
|
...(C == null ? void 0 : C.payload) ?? {},
|
|
4488
4493
|
creativityLevel: ((ye = C == null ? void 0 : C.payload) == null ? void 0 : ye.creativityLevel) ?? "medium"
|
|
4489
4494
|
},
|
|
4490
4495
|
edit: !1
|
|
4491
4496
|
};
|
|
4492
|
-
|
|
4497
|
+
U(ie);
|
|
4493
4498
|
},
|
|
4494
|
-
[a,
|
|
4499
|
+
[a, U]
|
|
4495
4500
|
);
|
|
4496
4501
|
Y(() => {
|
|
4497
|
-
w(
|
|
4498
|
-
}, [
|
|
4499
|
-
const
|
|
4500
|
-
|
|
4501
|
-
}, [
|
|
4502
|
+
w(P);
|
|
4503
|
+
}, [P, w]);
|
|
4504
|
+
const F = _(async () => {
|
|
4505
|
+
y(), I(), f(), o(null);
|
|
4506
|
+
}, [I, f, o, y]);
|
|
4502
4507
|
Y(() => {
|
|
4503
|
-
A(
|
|
4504
|
-
}, [
|
|
4505
|
-
const
|
|
4506
|
-
async (
|
|
4507
|
-
E &&
|
|
4508
|
+
A(F);
|
|
4509
|
+
}, [F, A]);
|
|
4510
|
+
const N = _(
|
|
4511
|
+
async (g, z) => {
|
|
4512
|
+
E && y();
|
|
4508
4513
|
let C = a.current;
|
|
4509
|
-
const
|
|
4510
|
-
ee && delete
|
|
4511
|
-
const ie = !!(ee && ee.length), ye = !!(
|
|
4512
|
-
if (!C && !K &&
|
|
4514
|
+
const O = (g == null ? void 0 : g.text) ?? "", D = (g == null ? void 0 : g.attachments) ?? [], K = (O == null ? void 0 : O.trim()) ?? "", B = { ...(g == null ? void 0 : g.payload) ?? {} }, ee = Array.isArray(B.messages) ? B.messages : void 0;
|
|
4515
|
+
ee && delete B.messages;
|
|
4516
|
+
const ie = !!(ee && ee.length), ye = !!(g.contentParts && g.contentParts.length > 0);
|
|
4517
|
+
if (!C && !K && D.length === 0 && !ie && !ye) return;
|
|
4513
4518
|
if (!C) {
|
|
4514
4519
|
const re = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), te = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")).join("").slice(0, 16);
|
|
4515
|
-
C = `${re}${te}`,
|
|
4520
|
+
C = `${re}${te}`, m(C), o(C);
|
|
4516
4521
|
}
|
|
4517
|
-
let
|
|
4518
|
-
|
|
4519
|
-
const { contentParts: se, filesInfo: he } =
|
|
4520
|
-
K && X.push({ type: "text", text:
|
|
4521
|
-
const Q =
|
|
4522
|
+
let J = null;
|
|
4523
|
+
g.contentParts && g.contentParts.length > 0 && (J = g.contentParts);
|
|
4524
|
+
const { contentParts: se, filesInfo: he } = J ? { contentParts: J, filesInfo: [] } : await or(D), X = [...se];
|
|
4525
|
+
K && X.push({ type: "text", text: O });
|
|
4526
|
+
const Q = g == null ? void 0 : g.originalMessageId, be = !!(g != null && g.edit && Q), He = !ie && X.length > 0;
|
|
4522
4527
|
let we = null;
|
|
4523
|
-
if (
|
|
4528
|
+
if (He) {
|
|
4524
4529
|
const re = be ? Q : `msg-${Date.now()}`;
|
|
4525
4530
|
we = jt({
|
|
4526
4531
|
id: re,
|
|
4527
4532
|
role: "user",
|
|
4528
4533
|
content: X,
|
|
4529
4534
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4530
|
-
}, "user"), be ?
|
|
4535
|
+
}, "user"), be ? b(we, { editingMessageId: Q }) : b(we);
|
|
4531
4536
|
}
|
|
4532
4537
|
const Pe = ie ? ee : we ? [we] : [], ke = {
|
|
4533
|
-
...
|
|
4538
|
+
...B,
|
|
4534
4539
|
...he.length ? { files_info: he } : {}
|
|
4535
4540
|
};
|
|
4536
4541
|
Pe.length ? ke.messages = Pe : "messages" in ke || (ke.messages = []);
|
|
4537
|
-
let ne = (
|
|
4542
|
+
let ne = (g == null ? void 0 : g.checkpointId) ?? c.id ?? void 0;
|
|
4538
4543
|
if (be) {
|
|
4539
4544
|
const re = S.find((te) => te.id === Q);
|
|
4540
4545
|
if (re)
|
|
@@ -4549,54 +4554,54 @@ function Fr({
|
|
|
4549
4554
|
te > 0 && S[te - 1].checkpointId && (ne = S[te - 1].checkpointId ?? void 0);
|
|
4550
4555
|
}
|
|
4551
4556
|
}
|
|
4552
|
-
if (
|
|
4557
|
+
if (g != null && g.edit && !ne)
|
|
4553
4558
|
throw new Error(
|
|
4554
4559
|
`[streaming] Missing checkpointId for edit submit. threadId=${C ?? "null"}. Ensure you are editing a message that has been saved.`
|
|
4555
4560
|
);
|
|
4556
4561
|
const Ue = {
|
|
4557
4562
|
threadId: C,
|
|
4558
|
-
content:
|
|
4563
|
+
content: g == null ? void 0 : g.text,
|
|
4559
4564
|
payload: ke,
|
|
4560
|
-
config:
|
|
4565
|
+
config: g == null ? void 0 : g.config,
|
|
4561
4566
|
checkpointId: ne,
|
|
4562
|
-
command:
|
|
4563
|
-
edit:
|
|
4567
|
+
command: g == null ? void 0 : g.command,
|
|
4568
|
+
edit: g == null ? void 0 : g.edit
|
|
4564
4569
|
};
|
|
4565
|
-
return
|
|
4570
|
+
return U(Ue, z);
|
|
4566
4571
|
},
|
|
4567
|
-
[
|
|
4568
|
-
),
|
|
4572
|
+
[c, a, E, m, b, U, y, d]
|
|
4573
|
+
), j = Z(() => S, [S]), G = Z(
|
|
4569
4574
|
() => ({
|
|
4570
4575
|
isStreaming: E,
|
|
4571
|
-
error:
|
|
4572
|
-
connectionState:
|
|
4573
|
-
messages:
|
|
4576
|
+
error: L,
|
|
4577
|
+
connectionState: L ? "error" : E ? M ? "connected" : "connecting" : "idle",
|
|
4578
|
+
messages: j,
|
|
4574
4579
|
activeMessageId: $,
|
|
4575
|
-
submit:
|
|
4576
|
-
stop:
|
|
4577
|
-
interrupt:
|
|
4580
|
+
submit: N,
|
|
4581
|
+
stop: y,
|
|
4582
|
+
interrupt: l,
|
|
4578
4583
|
resume: () => Promise.resolve(),
|
|
4579
|
-
goto: (
|
|
4584
|
+
goto: (g, z) => Promise.resolve(),
|
|
4580
4585
|
clearError: () => {
|
|
4581
4586
|
}
|
|
4582
4587
|
// TODO: Implement error clearing
|
|
4583
4588
|
}),
|
|
4584
|
-
[E,
|
|
4589
|
+
[E, L, N, y, l, M, j]
|
|
4585
4590
|
);
|
|
4586
|
-
return /* @__PURE__ */ de(
|
|
4591
|
+
return /* @__PURE__ */ de(Vt.Provider, { value: G, children: e });
|
|
4587
4592
|
}
|
|
4588
4593
|
function ge(e) {
|
|
4589
|
-
const t =
|
|
4594
|
+
const t = W(e);
|
|
4590
4595
|
return Y(() => {
|
|
4591
4596
|
t.current = e;
|
|
4592
|
-
}, [e]),
|
|
4597
|
+
}, [e]), _((...n) => {
|
|
4593
4598
|
const r = t.current;
|
|
4594
4599
|
if (r)
|
|
4595
4600
|
return r(...n);
|
|
4596
4601
|
}, []);
|
|
4597
4602
|
}
|
|
4598
4603
|
function Or(e) {
|
|
4599
|
-
return je(
|
|
4604
|
+
return je(Vt);
|
|
4600
4605
|
}
|
|
4601
4606
|
function bt(e) {
|
|
4602
4607
|
return typeof e == "object" && e !== null;
|
|
@@ -4607,24 +4612,24 @@ function $r(e, t) {
|
|
|
4607
4612
|
const n = Object.keys(e), r = Object.keys(t);
|
|
4608
4613
|
if (n.length !== r.length)
|
|
4609
4614
|
return !1;
|
|
4610
|
-
for (const
|
|
4611
|
-
if (!Object.prototype.hasOwnProperty.call(t,
|
|
4615
|
+
for (const s of n)
|
|
4616
|
+
if (!Object.prototype.hasOwnProperty.call(t, s) || !Object.is(e[s], t[s]))
|
|
4612
4617
|
return !1;
|
|
4613
4618
|
return !0;
|
|
4614
4619
|
}
|
|
4615
4620
|
function Dr(e) {
|
|
4616
|
-
const t =
|
|
4621
|
+
const t = W(e), n = W(e);
|
|
4617
4622
|
return $r(t.current, e) || (t.current = e, n.current = e), n.current;
|
|
4618
4623
|
}
|
|
4619
4624
|
function Kr(e) {
|
|
4620
|
-
const t = e.artifact && typeof e.artifact == "object" ? e.artifact : null, n = !t && e.content && typeof e.content == "object" ? e.content : null, r = t ?? n,
|
|
4621
|
-
return typeof
|
|
4625
|
+
const t = e.artifact && typeof e.artifact == "object" ? e.artifact : null, n = !t && e.content && typeof e.content == "object" ? e.content : null, r = t ?? n, s = (r == null ? void 0 : r.task_id) ?? (r == null ? void 0 : r.taskId) ?? null;
|
|
4626
|
+
return typeof s == "string" ? s : null;
|
|
4622
4627
|
}
|
|
4623
4628
|
function fo(e) {
|
|
4624
4629
|
const { setCurrentTaskId: t, getCurrentTaskId: n, onToolEnd: r } = e;
|
|
4625
|
-
return (
|
|
4626
|
-
const
|
|
4627
|
-
|
|
4630
|
+
return (s) => {
|
|
4631
|
+
const o = Kr(s), a = (n == null ? void 0 : n()) ?? null;
|
|
4632
|
+
o && o !== a && t(o), r == null || r(s);
|
|
4628
4633
|
};
|
|
4629
4634
|
}
|
|
4630
4635
|
function po({
|
|
@@ -4632,59 +4637,59 @@ function po({
|
|
|
4632
4637
|
apiConfig: t,
|
|
4633
4638
|
initialThreadId: n = null,
|
|
4634
4639
|
initialCheckpointId: r = null,
|
|
4635
|
-
initialCheckpointNs:
|
|
4636
|
-
autoLoadInitial:
|
|
4640
|
+
initialCheckpointNs: s = null,
|
|
4641
|
+
autoLoadInitial: o = !0,
|
|
4637
4642
|
onConnectionError: a,
|
|
4638
4643
|
onError: i,
|
|
4639
|
-
onAuthError:
|
|
4640
|
-
onThreadChange:
|
|
4641
|
-
onToolEnd:
|
|
4642
|
-
onUpdateEvent:
|
|
4644
|
+
onAuthError: u,
|
|
4645
|
+
onThreadChange: l,
|
|
4646
|
+
onToolEnd: c,
|
|
4647
|
+
onUpdateEvent: d,
|
|
4643
4648
|
onCustomEvent: p,
|
|
4644
|
-
onMetadataEvent:
|
|
4645
|
-
onFinish:
|
|
4649
|
+
onMetadataEvent: m,
|
|
4650
|
+
onFinish: v
|
|
4646
4651
|
}) {
|
|
4647
|
-
const
|
|
4652
|
+
const f = Dr(t), [b, x] = H(!1), S = me(i), A = me(u), w = me(a), k = me(l), h = me(c), T = me(d), y = me(p), I = me(m), E = me(v), L = Z(
|
|
4648
4653
|
() => ({
|
|
4649
4654
|
onError: S,
|
|
4650
4655
|
onAuthError: A,
|
|
4651
4656
|
onConnectionError: w,
|
|
4652
|
-
onToolEnd:
|
|
4657
|
+
onToolEnd: h,
|
|
4653
4658
|
onUpdateEvent: T,
|
|
4654
|
-
onCustomEvent:
|
|
4655
|
-
onMetadataEvent:
|
|
4659
|
+
onCustomEvent: y,
|
|
4660
|
+
onMetadataEvent: I,
|
|
4656
4661
|
onFinish: E
|
|
4657
4662
|
}),
|
|
4658
4663
|
[
|
|
4659
4664
|
S,
|
|
4660
4665
|
A,
|
|
4661
4666
|
w,
|
|
4662
|
-
|
|
4667
|
+
h,
|
|
4663
4668
|
T,
|
|
4664
|
-
|
|
4665
|
-
|
|
4669
|
+
y,
|
|
4670
|
+
I,
|
|
4666
4671
|
E
|
|
4667
4672
|
]
|
|
4668
4673
|
);
|
|
4669
|
-
return /* @__PURE__ */ de(nr, { apiConfig:
|
|
4674
|
+
return /* @__PURE__ */ de(nr, { apiConfig: f, children: /* @__PURE__ */ de(
|
|
4670
4675
|
mr,
|
|
4671
4676
|
{
|
|
4672
4677
|
initialThreadId: n,
|
|
4673
4678
|
onError: S,
|
|
4674
|
-
onThreadChange:
|
|
4679
|
+
onThreadChange: k,
|
|
4675
4680
|
children: /* @__PURE__ */ de(
|
|
4676
4681
|
jr,
|
|
4677
4682
|
{
|
|
4678
4683
|
initialThreadId: n,
|
|
4679
4684
|
initialCheckpointId: r,
|
|
4680
|
-
initialCheckpointNs:
|
|
4681
|
-
autoLoadInitial:
|
|
4685
|
+
initialCheckpointNs: s,
|
|
4686
|
+
autoLoadInitial: o,
|
|
4682
4687
|
onError: S,
|
|
4683
|
-
isStreaming:
|
|
4688
|
+
isStreaming: b,
|
|
4684
4689
|
children: /* @__PURE__ */ de(
|
|
4685
4690
|
Br,
|
|
4686
4691
|
{
|
|
4687
|
-
...
|
|
4692
|
+
...L,
|
|
4688
4693
|
onStreamingChange: x,
|
|
4689
4694
|
children: e
|
|
4690
4695
|
}
|
|
@@ -4695,16 +4700,16 @@ function po({
|
|
|
4695
4700
|
) });
|
|
4696
4701
|
}
|
|
4697
4702
|
function me(e) {
|
|
4698
|
-
const t =
|
|
4699
|
-
return t.current = e,
|
|
4703
|
+
const t = W(e);
|
|
4704
|
+
return t.current = e, _((...n) => {
|
|
4700
4705
|
const r = t.current;
|
|
4701
4706
|
if (r)
|
|
4702
4707
|
return r(...n);
|
|
4703
4708
|
}, []);
|
|
4704
4709
|
}
|
|
4705
|
-
const
|
|
4710
|
+
const Hr = 1, Vr = 1e6;
|
|
4706
4711
|
let We = 0;
|
|
4707
|
-
function
|
|
4712
|
+
function qr() {
|
|
4708
4713
|
return We = (We + 1) % Number.MAX_SAFE_INTEGER, We.toString();
|
|
4709
4714
|
}
|
|
4710
4715
|
const Je = /* @__PURE__ */ new Map(), wt = (e) => {
|
|
@@ -4715,14 +4720,14 @@ const Je = /* @__PURE__ */ new Map(), wt = (e) => {
|
|
|
4715
4720
|
type: "REMOVE_TOAST",
|
|
4716
4721
|
toastId: e
|
|
4717
4722
|
});
|
|
4718
|
-
},
|
|
4723
|
+
}, Vr);
|
|
4719
4724
|
Je.set(e, t);
|
|
4720
4725
|
}, Gr = (e, t) => {
|
|
4721
4726
|
switch (t.type) {
|
|
4722
4727
|
case "ADD_TOAST":
|
|
4723
4728
|
return {
|
|
4724
4729
|
...e,
|
|
4725
|
-
toasts: [t.toast, ...e.toasts].slice(0,
|
|
4730
|
+
toasts: [t.toast, ...e.toasts].slice(0, Hr)
|
|
4726
4731
|
};
|
|
4727
4732
|
case "UPDATE_TOAST":
|
|
4728
4733
|
return {
|
|
@@ -4762,9 +4767,9 @@ function Le(e) {
|
|
|
4762
4767
|
});
|
|
4763
4768
|
}
|
|
4764
4769
|
function Wr({ ...e }) {
|
|
4765
|
-
const t =
|
|
4770
|
+
const t = qr(), n = (s) => Le({
|
|
4766
4771
|
type: "UPDATE_TOAST",
|
|
4767
|
-
toast: { ...
|
|
4772
|
+
toast: { ...s, id: t }
|
|
4768
4773
|
}), r = () => Le({ type: "DISMISS_TOAST", toastId: t });
|
|
4769
4774
|
return Le({
|
|
4770
4775
|
type: "ADD_TOAST",
|
|
@@ -4772,8 +4777,8 @@ function Wr({ ...e }) {
|
|
|
4772
4777
|
...e,
|
|
4773
4778
|
id: t,
|
|
4774
4779
|
open: !0,
|
|
4775
|
-
onOpenChange: (
|
|
4776
|
-
|
|
4780
|
+
onOpenChange: (s) => {
|
|
4781
|
+
s || r();
|
|
4777
4782
|
}
|
|
4778
4783
|
}
|
|
4779
4784
|
}), {
|
|
@@ -4794,75 +4799,75 @@ function Jr() {
|
|
|
4794
4799
|
};
|
|
4795
4800
|
}
|
|
4796
4801
|
function go(e) {
|
|
4797
|
-
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Me(), { toast:
|
|
4798
|
-
|
|
4799
|
-
}, []), p =
|
|
4800
|
-
|
|
4801
|
-
}, []),
|
|
4802
|
-
async (
|
|
4802
|
+
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Me(), { toast: s } = Jr(), [o, a] = H({}), [i, u] = H(null), [l, c] = H(!1), d = _(() => {
|
|
4803
|
+
c(!1), u(null);
|
|
4804
|
+
}, []), p = _((v) => {
|
|
4805
|
+
u(v), c(!0);
|
|
4806
|
+
}, []), m = _(
|
|
4807
|
+
async (v, f, b) => {
|
|
4803
4808
|
var x, S;
|
|
4804
4809
|
if (!t) {
|
|
4805
|
-
|
|
4810
|
+
v.preventDefault();
|
|
4806
4811
|
return;
|
|
4807
4812
|
}
|
|
4808
|
-
if (
|
|
4809
|
-
|
|
4813
|
+
if (o[b]) {
|
|
4814
|
+
v.preventDefault();
|
|
4810
4815
|
return;
|
|
4811
4816
|
}
|
|
4812
4817
|
try {
|
|
4813
|
-
const A = String(
|
|
4818
|
+
const A = String(f.url ?? ""), w = A.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
|
|
4814
4819
|
if (w) {
|
|
4815
|
-
|
|
4816
|
-
const
|
|
4817
|
-
p({ id:
|
|
4820
|
+
v.preventDefault();
|
|
4821
|
+
const k = w[1], h = f.name || `file_${k}`, T = f.mimeType || "application/octet-stream";
|
|
4822
|
+
p({ id: k, name: h, mimeType: T });
|
|
4818
4823
|
return;
|
|
4819
4824
|
}
|
|
4820
4825
|
if (A.startsWith("data:")) {
|
|
4821
|
-
|
|
4822
|
-
const
|
|
4826
|
+
v.preventDefault(), a((h) => ({ ...h, [b]: !0 }));
|
|
4827
|
+
const k = s({ title: "Fetching file...", description: "", open: !0 });
|
|
4823
4828
|
try {
|
|
4824
|
-
const
|
|
4825
|
-
if (!
|
|
4829
|
+
const h = await r.listFiles(n ?? void 0);
|
|
4830
|
+
if (!h || !Array.isArray(h))
|
|
4826
4831
|
throw new Error("Invalid file list response");
|
|
4827
|
-
const T =
|
|
4832
|
+
const T = h.find((y) => !y || typeof y != "object" || !((y.filename ?? "") === (f.name ?? "")) ? !1 : typeof f.size == "number" && typeof y.size == "number" ? y.size === f.size : !0);
|
|
4828
4833
|
if (!(T != null && T.id))
|
|
4829
|
-
throw new Error(`File "${
|
|
4834
|
+
throw new Error(`File "${f.name}" is not yet available on the server`);
|
|
4830
4835
|
if (!T.id || !T.filename)
|
|
4831
4836
|
throw new Error("Invalid file data received from server");
|
|
4832
4837
|
p({
|
|
4833
4838
|
id: T.id,
|
|
4834
|
-
name:
|
|
4835
|
-
mimeType:
|
|
4836
|
-
}), (x =
|
|
4837
|
-
id:
|
|
4839
|
+
name: f.name || T.filename || `file_${T.id}`,
|
|
4840
|
+
mimeType: f.mimeType || T.mime_type || "application/octet-stream"
|
|
4841
|
+
}), (x = k.update) == null || x.call(k, {
|
|
4842
|
+
id: k.id,
|
|
4838
4843
|
title: "Success",
|
|
4839
|
-
description: `Opened ${
|
|
4844
|
+
description: `Opened ${f.name}`,
|
|
4840
4845
|
open: !0
|
|
4841
4846
|
});
|
|
4842
|
-
} catch (
|
|
4843
|
-
console.error("Failed to fetch server file:",
|
|
4844
|
-
const T =
|
|
4845
|
-
(S =
|
|
4847
|
+
} catch (h) {
|
|
4848
|
+
console.error("Failed to fetch server file:", h);
|
|
4849
|
+
const T = h instanceof Error ? h.message : "Unknown error occurred";
|
|
4850
|
+
(S = k.update) == null || S.call(k, { id: k.id, title: "Failed", description: T }), s({
|
|
4846
4851
|
title: "Failed to fetch file",
|
|
4847
4852
|
description: T,
|
|
4848
4853
|
open: !0
|
|
4849
4854
|
});
|
|
4850
4855
|
} finally {
|
|
4851
|
-
a((
|
|
4856
|
+
a((h) => ({ ...h, [b]: !1 }));
|
|
4852
4857
|
}
|
|
4853
4858
|
}
|
|
4854
4859
|
} catch (A) {
|
|
4855
|
-
console.error("File click error:", A), a((w) => ({ ...w, [
|
|
4860
|
+
console.error("File click error:", A), a((w) => ({ ...w, [b]: !1 }));
|
|
4856
4861
|
}
|
|
4857
4862
|
},
|
|
4858
|
-
[t,
|
|
4863
|
+
[t, o, s, n, p]
|
|
4859
4864
|
);
|
|
4860
4865
|
return {
|
|
4861
|
-
uploadingFiles:
|
|
4862
|
-
handleFileClick:
|
|
4863
|
-
fileViewerOpen:
|
|
4866
|
+
uploadingFiles: o,
|
|
4867
|
+
handleFileClick: m,
|
|
4868
|
+
fileViewerOpen: l,
|
|
4864
4869
|
currentFileInfo: i,
|
|
4865
|
-
closeFileViewer:
|
|
4870
|
+
closeFileViewer: d
|
|
4866
4871
|
};
|
|
4867
4872
|
}
|
|
4868
4873
|
function mo(e) {
|
|
@@ -4885,13 +4890,13 @@ function Xr(e) {
|
|
|
4885
4890
|
if (!e) return [];
|
|
4886
4891
|
const t = [], n = e.split(/\r?\n/);
|
|
4887
4892
|
for (const r of n) {
|
|
4888
|
-
const
|
|
4889
|
-
if (!
|
|
4893
|
+
const s = r.trim();
|
|
4894
|
+
if (!s || !s.startsWith(kt))
|
|
4890
4895
|
continue;
|
|
4891
|
-
const
|
|
4892
|
-
if (!
|
|
4896
|
+
const o = s.slice(kt.length).trim();
|
|
4897
|
+
if (!o || o.toLowerCase() === "[done]")
|
|
4893
4898
|
continue;
|
|
4894
|
-
const a = tt(
|
|
4899
|
+
const a = tt(o);
|
|
4895
4900
|
a && typeof a == "object" && t.push(a);
|
|
4896
4901
|
}
|
|
4897
4902
|
return t;
|
|
@@ -4907,79 +4912,80 @@ function Qr(e) {
|
|
|
4907
4912
|
function yo(e) {
|
|
4908
4913
|
return Z(() => {
|
|
4909
4914
|
const t = e.content.filter(
|
|
4910
|
-
(
|
|
4915
|
+
(u) => u.type === "text"
|
|
4911
4916
|
);
|
|
4912
4917
|
if (!t.length)
|
|
4913
4918
|
return null;
|
|
4914
4919
|
let r = t.flatMap(
|
|
4915
|
-
(
|
|
4920
|
+
(u) => Xr(u.text ?? "")
|
|
4916
4921
|
);
|
|
4917
4922
|
if (!r.length) {
|
|
4918
|
-
const
|
|
4919
|
-
`),
|
|
4920
|
-
|
|
4923
|
+
const u = t.map((c) => c.text ?? "").join(`
|
|
4924
|
+
`), l = tt(u);
|
|
4925
|
+
l && typeof l == "object" && (r = [l]);
|
|
4921
4926
|
}
|
|
4922
4927
|
if (!r.length)
|
|
4923
4928
|
return null;
|
|
4924
|
-
const
|
|
4925
|
-
if (!
|
|
4929
|
+
const o = Qr(r) ?? r[r.length - 1];
|
|
4930
|
+
if (!o)
|
|
4926
4931
|
return null;
|
|
4927
|
-
const a =
|
|
4932
|
+
const a = o.output ?? o.payload ?? o, i = ue(a);
|
|
4928
4933
|
return i && typeof i == "object" && !Array.isArray(i) ? {
|
|
4929
4934
|
kind: "dict",
|
|
4930
4935
|
value: i,
|
|
4931
4936
|
data: i,
|
|
4932
|
-
event:
|
|
4937
|
+
event: o
|
|
4933
4938
|
} : {
|
|
4934
4939
|
kind: "generic",
|
|
4935
4940
|
value: i,
|
|
4936
|
-
event:
|
|
4941
|
+
event: o
|
|
4937
4942
|
};
|
|
4938
4943
|
}, [e]);
|
|
4939
4944
|
}
|
|
4940
4945
|
function Yr(e) {
|
|
4941
|
-
var
|
|
4942
|
-
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r = ot({ optional: !0 }), o =
|
|
4946
|
+
var $, U;
|
|
4947
|
+
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r = typeof e == "object" ? e.includeHistory : !0, s = ot({ optional: !0 }), o = Ht({ optional: !0 }), a = Or(), { currentThreadId: i, setCurrentThreadId: u, actions: l } = s || {
|
|
4943
4948
|
currentThreadId: null,
|
|
4944
4949
|
setCurrentThreadId: () => {
|
|
4945
4950
|
},
|
|
4946
4951
|
actions: {}
|
|
4947
|
-
}, c = !!t && t !==
|
|
4948
|
-
|
|
4952
|
+
}, c = !!t && t !== i, [d, p] = H([]), m = _((V) => {
|
|
4953
|
+
p(V);
|
|
4949
4954
|
}, []), {
|
|
4950
|
-
isLoadingThread:
|
|
4951
|
-
threadStateError:
|
|
4952
|
-
threadCheckpoints:
|
|
4953
|
-
isLoadingHistory:
|
|
4954
|
-
loadThread:
|
|
4955
|
+
isLoadingThread: v,
|
|
4956
|
+
threadStateError: f,
|
|
4957
|
+
threadCheckpoints: b,
|
|
4958
|
+
isLoadingHistory: x,
|
|
4959
|
+
loadThread: S
|
|
4955
4960
|
} = $t({
|
|
4956
4961
|
api: Me().chatApi,
|
|
4957
4962
|
fileApi: Me().fileApi,
|
|
4958
|
-
seed:
|
|
4963
|
+
seed: m,
|
|
4959
4964
|
currentThreadId: c ? t : null,
|
|
4960
4965
|
initialThreadId: c ? t : null,
|
|
4961
4966
|
isStreaming: !1,
|
|
4962
|
-
getMessages: () =>
|
|
4963
|
-
autoLoadInitial: c && !n
|
|
4967
|
+
getMessages: () => d,
|
|
4968
|
+
autoLoadInitial: c && !n,
|
|
4969
|
+
includeHistory: r
|
|
4964
4970
|
});
|
|
4965
4971
|
Y(() => {
|
|
4966
|
-
!c && !n &&
|
|
4967
|
-
}, [c, n,
|
|
4968
|
-
const
|
|
4969
|
-
var
|
|
4970
|
-
return ((
|
|
4971
|
-
}, [
|
|
4972
|
+
!c && !n && i && (o != null && o.loadThread) && o.loadThread(i);
|
|
4973
|
+
}, [c, n, i, o == null ? void 0 : o.loadThread]);
|
|
4974
|
+
const A = Z(() => {
|
|
4975
|
+
var V;
|
|
4976
|
+
return ((V = b[0]) == null ? void 0 : V.values) || {};
|
|
4977
|
+
}, [b]), w = Z(() => ({ timeline: [], messagePreviews: {} }), []), k = t || i, h = c ? v ? "loading" : "idle" : (o == null ? void 0 : o.status) || "idle", T = c ? d : (a == null ? void 0 : a.messages) || [], y = c ? v : (o == null ? void 0 : o.isLoading) || !1, I = c ? x : (o == null ? void 0 : o.isLoadingHistory) || !1, E = c ? A : (o == null ? void 0 : o.values) || {}, L = c ? {} : (o == null ? void 0 : o.taskMessagesByScope) || {}, M = c ? f : (a == null ? void 0 : a.error) || (o == null ? void 0 : o.error) || null;
|
|
4972
4978
|
return {
|
|
4973
4979
|
// UNIFIED: Single thread ID concept
|
|
4974
|
-
threadId:
|
|
4975
|
-
status:
|
|
4976
|
-
messages:
|
|
4977
|
-
isLoading:
|
|
4978
|
-
isHistoryLoading:
|
|
4979
|
-
error:
|
|
4980
|
+
threadId: k,
|
|
4981
|
+
status: h,
|
|
4982
|
+
messages: T,
|
|
4983
|
+
isLoading: y,
|
|
4984
|
+
isHistoryLoading: I,
|
|
4985
|
+
error: M,
|
|
4980
4986
|
// Values & Metadata
|
|
4981
|
-
values:
|
|
4982
|
-
taskMessagesByScope:
|
|
4987
|
+
values: E,
|
|
4988
|
+
taskMessagesByScope: L,
|
|
4983
4989
|
metadata: c ? {} : o == null ? void 0 : o.metadata,
|
|
4984
4990
|
// Actions & State relating to Global/Active Thread only
|
|
4985
4991
|
navigateToCheckpoint: c ? async () => {
|
|
@@ -4988,41 +4994,41 @@ function Yr(e) {
|
|
|
4988
4994
|
returnToLatest: c ? async () => {
|
|
4989
4995
|
} : (o == null ? void 0 : o.returnToLatest) || (async () => {
|
|
4990
4996
|
}),
|
|
4991
|
-
checkpoint: c ?
|
|
4992
|
-
checkpoints: c ?
|
|
4993
|
-
checkpointIndex: c ?
|
|
4997
|
+
checkpoint: c ? b[0] ? { id: b[0].checkpointId, namespace: b[0].checkpointNs } : null : (o == null ? void 0 : o.checkpoint) || null,
|
|
4998
|
+
checkpoints: c ? b : (o == null ? void 0 : o.checkpoints) || [],
|
|
4999
|
+
checkpointIndex: c ? w : (o == null ? void 0 : o.checkpointIndex) || { timeline: [], messagePreviews: {} },
|
|
4994
5000
|
interrupt: c ? null : (o == null ? void 0 : o.interrupt) || null,
|
|
4995
5001
|
respondToInterrupt: c ? async () => {
|
|
4996
5002
|
} : (o == null ? void 0 : o.respondToInterrupt) || (async () => {
|
|
4997
5003
|
}),
|
|
4998
5004
|
// Streaming Status
|
|
4999
5005
|
// Even in standalone mode, allow streaming state/stop if a stream context exists.
|
|
5000
|
-
isStreaming: (
|
|
5001
|
-
activeMessageId: c ? null : ((
|
|
5002
|
-
connectionState: (
|
|
5003
|
-
streamingAssistantId: !c && (
|
|
5006
|
+
isStreaming: (a == null ? void 0 : a.isStreaming) || !1,
|
|
5007
|
+
activeMessageId: c ? null : (($ = o == null ? void 0 : o.metadata) == null ? void 0 : $.assemblingMessageId) || (a == null ? void 0 : a.activeMessageId) || null,
|
|
5008
|
+
connectionState: (a == null ? void 0 : a.connectionState) || "disconnected",
|
|
5009
|
+
streamingAssistantId: !c && (a != null && a.isStreaming) && ((U = o == null ? void 0 : o.metadata) != null && U.assemblingMessageId) ? o.metadata.assemblingMessageId : null,
|
|
5004
5010
|
// Actions
|
|
5005
|
-
submit: (
|
|
5011
|
+
submit: (a == null ? void 0 : a.submit) || (async () => {
|
|
5006
5012
|
}),
|
|
5007
|
-
stop: (
|
|
5013
|
+
stop: (a == null ? void 0 : a.stop) || (() => {
|
|
5008
5014
|
}),
|
|
5009
5015
|
clearThread: c ? async () => {
|
|
5010
5016
|
} : (o == null ? void 0 : o.clearThread) || (async () => {
|
|
5011
5017
|
}),
|
|
5012
|
-
setCurrentThreadId:
|
|
5018
|
+
setCurrentThreadId: u,
|
|
5013
5019
|
loadHistory: c ? async () => {
|
|
5014
|
-
t && await
|
|
5020
|
+
t && await S(t);
|
|
5015
5021
|
} : async () => {
|
|
5016
5022
|
},
|
|
5017
5023
|
onEvent: c ? () => {
|
|
5018
5024
|
} : (o == null ? void 0 : o.onEvent) || (() => {
|
|
5019
5025
|
}),
|
|
5020
5026
|
// Thread Management
|
|
5021
|
-
createThread:
|
|
5022
|
-
deleteThread:
|
|
5023
|
-
renameThread:
|
|
5024
|
-
threads: (
|
|
5025
|
-
isThreadsLoading: (
|
|
5027
|
+
createThread: l == null ? void 0 : l.createThread,
|
|
5028
|
+
deleteThread: l == null ? void 0 : l.deleteThread,
|
|
5029
|
+
renameThread: l == null ? void 0 : l.renameThread,
|
|
5030
|
+
threads: (s == null ? void 0 : s.threads) || [],
|
|
5031
|
+
isThreadsLoading: (s == null ? void 0 : s.isLoading) || !1
|
|
5026
5032
|
};
|
|
5027
5033
|
}
|
|
5028
5034
|
function ho({
|
|
@@ -5030,48 +5036,48 @@ function ho({
|
|
|
5030
5036
|
chatRequest: t,
|
|
5031
5037
|
lastCheckpointId: n,
|
|
5032
5038
|
lastCheckpointNs: r,
|
|
5033
|
-
onMessageSent:
|
|
5034
|
-
onExcelUploadSuccess:
|
|
5039
|
+
onMessageSent: s,
|
|
5040
|
+
onExcelUploadSuccess: o,
|
|
5035
5041
|
onError: a,
|
|
5036
5042
|
enableMessageEditing: i,
|
|
5037
|
-
messages:
|
|
5038
|
-
setPendingAssistantResponse:
|
|
5039
|
-
project:
|
|
5040
|
-
onEvent:
|
|
5043
|
+
messages: u,
|
|
5044
|
+
setPendingAssistantResponse: l,
|
|
5045
|
+
project: c,
|
|
5046
|
+
onEvent: d,
|
|
5041
5047
|
threadId: p,
|
|
5042
|
-
clearComposerOnSend:
|
|
5048
|
+
clearComposerOnSend: m = !0
|
|
5043
5049
|
}) {
|
|
5044
|
-
const { messages:
|
|
5050
|
+
const { messages: v } = Yr(), [f, b] = H(null), [x, S] = H(""), [A, w] = H(null), [k, h] = H(null), [T, y] = H(!1), [I, E] = H(""), L = W(I), M = W(null);
|
|
5045
5051
|
Y(() => {
|
|
5046
|
-
if (!
|
|
5052
|
+
if (!f)
|
|
5047
5053
|
if (p) {
|
|
5048
|
-
const
|
|
5049
|
-
E(
|
|
5054
|
+
const z = localStorage.getItem(Ge(p));
|
|
5055
|
+
E(z || "");
|
|
5050
5056
|
} else
|
|
5051
5057
|
E("");
|
|
5052
|
-
}, [p,
|
|
5053
|
-
const $ =
|
|
5054
|
-
E(
|
|
5055
|
-
}, [p,
|
|
5058
|
+
}, [p, f]);
|
|
5059
|
+
const $ = _((z) => {
|
|
5060
|
+
E(z), !f && p && localStorage.setItem(Ge(p), z);
|
|
5061
|
+
}, [p, f]);
|
|
5056
5062
|
Y(() => {
|
|
5057
|
-
|
|
5058
|
-
}, [
|
|
5059
|
-
if (!
|
|
5063
|
+
L.current = I;
|
|
5064
|
+
}, [I]), Y(() => {
|
|
5065
|
+
if (!f) {
|
|
5060
5066
|
M.current = null;
|
|
5061
5067
|
return;
|
|
5062
5068
|
}
|
|
5063
|
-
M.current === null && (M.current =
|
|
5064
|
-
}, [x,
|
|
5065
|
-
const
|
|
5066
|
-
(
|
|
5067
|
-
$(
|
|
5069
|
+
M.current === null && (M.current = L.current), $(x ?? "");
|
|
5070
|
+
}, [x, f, $]);
|
|
5071
|
+
const U = _(
|
|
5072
|
+
(z) => {
|
|
5073
|
+
$(z);
|
|
5068
5074
|
},
|
|
5069
5075
|
[$]
|
|
5070
|
-
),
|
|
5071
|
-
const
|
|
5072
|
-
if (!(!
|
|
5076
|
+
), V = async (z, C) => {
|
|
5077
|
+
const O = Array.isArray(C) ? { files: C } : C ?? {}, D = O.files ?? [], K = O.contentParts ?? [], B = z.trim();
|
|
5078
|
+
if (!(!B && D.length === 0 && K.length === 0))
|
|
5073
5079
|
try {
|
|
5074
|
-
const ee =
|
|
5080
|
+
const ee = D.map(async (X) => {
|
|
5075
5081
|
try {
|
|
5076
5082
|
const Q = await Rt.uploadFile(X);
|
|
5077
5083
|
return { file: X, record: Q };
|
|
@@ -5090,68 +5096,68 @@ function ho({
|
|
|
5090
5096
|
name: X.filename,
|
|
5091
5097
|
size: X.size
|
|
5092
5098
|
};
|
|
5093
|
-
}),
|
|
5099
|
+
}), J = [...K, ...ye], se = f ? (A == null ? void 0 : A.checkpointId) ?? n ?? void 0 : n ?? void 0, he = f ? (A == null ? void 0 : A.checkpointNs) ?? r ?? void 0 : r ?? void 0;
|
|
5094
5100
|
await e(
|
|
5095
5101
|
{
|
|
5096
|
-
text:
|
|
5097
|
-
contentParts:
|
|
5098
|
-
attachments:
|
|
5102
|
+
text: B || "",
|
|
5103
|
+
contentParts: J,
|
|
5104
|
+
attachments: D,
|
|
5099
5105
|
payload: t.payload,
|
|
5100
|
-
edit: !!
|
|
5106
|
+
edit: !!f,
|
|
5101
5107
|
checkpointId: se,
|
|
5102
5108
|
checkpointNs: he,
|
|
5103
|
-
project:
|
|
5104
|
-
originalMessageId:
|
|
5109
|
+
project: c ?? void 0,
|
|
5110
|
+
originalMessageId: f ?? void 0,
|
|
5105
5111
|
config: t.config
|
|
5106
5112
|
},
|
|
5107
|
-
|
|
5108
|
-
),
|
|
5113
|
+
d ? { onEvent: d } : void 0
|
|
5114
|
+
), s == null || s(B), l(!0), m && (p && localStorage.removeItem(Ge(p)), $("")), h(null), b(null), S(""), w(null);
|
|
5109
5115
|
} catch (ee) {
|
|
5110
5116
|
const ie = (ee == null ? void 0 : ee.message) || "Failed to send message";
|
|
5111
|
-
|
|
5117
|
+
h(ie), a == null || a(ie), l(!1);
|
|
5112
5118
|
}
|
|
5113
|
-
},
|
|
5114
|
-
C ||
|
|
5115
|
-
},
|
|
5116
|
-
async (
|
|
5119
|
+
}, P = (z, C) => {
|
|
5120
|
+
C || V(z, { files: [] });
|
|
5121
|
+
}, F = _(
|
|
5122
|
+
async (z) => {
|
|
5117
5123
|
await e(
|
|
5118
5124
|
{
|
|
5119
|
-
attachments: [
|
|
5125
|
+
attachments: [z],
|
|
5120
5126
|
payload: t.payload,
|
|
5121
5127
|
checkpointId: n ?? void 0,
|
|
5122
5128
|
checkpointNs: r ?? void 0,
|
|
5123
|
-
project:
|
|
5129
|
+
project: c ?? void 0,
|
|
5124
5130
|
config: t.config
|
|
5125
5131
|
},
|
|
5126
|
-
|
|
5127
|
-
),
|
|
5132
|
+
d ? { onEvent: d } : void 0
|
|
5133
|
+
), o == null || o({ file: z });
|
|
5128
5134
|
},
|
|
5129
|
-
[n, r, t,
|
|
5130
|
-
),
|
|
5131
|
-
(
|
|
5132
|
-
i && (M.current =
|
|
5133
|
-
checkpointId: (
|
|
5134
|
-
checkpointNs: (
|
|
5135
|
-
}),
|
|
5135
|
+
[n, r, t, o, e]
|
|
5136
|
+
), N = _(
|
|
5137
|
+
(z, C, O) => {
|
|
5138
|
+
i && (M.current = I, b(z), S(C), w({
|
|
5139
|
+
checkpointId: (O == null ? void 0 : O.checkpointId) ?? null,
|
|
5140
|
+
checkpointNs: (O == null ? void 0 : O.checkpointNs) ?? null
|
|
5141
|
+
}), h(null));
|
|
5136
5142
|
},
|
|
5137
|
-
[
|
|
5138
|
-
),
|
|
5139
|
-
|
|
5140
|
-
const
|
|
5141
|
-
|
|
5142
|
-
}, []),
|
|
5143
|
+
[I, i]
|
|
5144
|
+
), j = _(() => {
|
|
5145
|
+
b(null), S(""), w(null), h(null);
|
|
5146
|
+
const z = M.current;
|
|
5147
|
+
z !== null && E(z), M.current = null;
|
|
5148
|
+
}, []), G = _((z) => {
|
|
5143
5149
|
let C = null;
|
|
5144
|
-
for (let
|
|
5145
|
-
if (
|
|
5146
|
-
C =
|
|
5150
|
+
for (let B = z - 1; B >= 0; B--)
|
|
5151
|
+
if (u[B].role === "user") {
|
|
5152
|
+
C = u[B];
|
|
5147
5153
|
break;
|
|
5148
5154
|
}
|
|
5149
5155
|
if (!C) return;
|
|
5150
|
-
const
|
|
5156
|
+
const O = Array.isArray(C.content) ? C.content : [], K = O.filter((B) => (B == null ? void 0 : B.type) === "text").map((B) => B.text).join("") || (() => {
|
|
5151
5157
|
try {
|
|
5152
|
-
return JSON.stringify(
|
|
5158
|
+
return JSON.stringify(O, null, 2);
|
|
5153
5159
|
} catch {
|
|
5154
|
-
return String(
|
|
5160
|
+
return String(O);
|
|
5155
5161
|
}
|
|
5156
5162
|
})();
|
|
5157
5163
|
K && e(
|
|
@@ -5164,25 +5170,25 @@ function ho({
|
|
|
5164
5170
|
originalMessageId: C.id,
|
|
5165
5171
|
config: t.config
|
|
5166
5172
|
},
|
|
5167
|
-
|
|
5173
|
+
d ? { onEvent: d } : void 0
|
|
5168
5174
|
);
|
|
5169
|
-
}, [
|
|
5175
|
+
}, [u, e, n, r, t]);
|
|
5170
5176
|
return {
|
|
5171
|
-
editingMessageId:
|
|
5177
|
+
editingMessageId: f,
|
|
5172
5178
|
editingInitialValue: x,
|
|
5173
|
-
inputError:
|
|
5174
|
-
setInputError:
|
|
5179
|
+
inputError: k,
|
|
5180
|
+
setInputError: h,
|
|
5175
5181
|
dismissError: T,
|
|
5176
|
-
setDismissError:
|
|
5177
|
-
composerValue:
|
|
5178
|
-
handleComposerChange:
|
|
5179
|
-
handleSendMessage:
|
|
5180
|
-
handleQuickPrompt:
|
|
5181
|
-
handleExcelUpload:
|
|
5182
|
-
startEditing:
|
|
5183
|
-
cancelEditing:
|
|
5184
|
-
handleRegenerateCb:
|
|
5185
|
-
displayMessages:
|
|
5182
|
+
setDismissError: y,
|
|
5183
|
+
composerValue: I,
|
|
5184
|
+
handleComposerChange: U,
|
|
5185
|
+
handleSendMessage: V,
|
|
5186
|
+
handleQuickPrompt: P,
|
|
5187
|
+
handleExcelUpload: F,
|
|
5188
|
+
startEditing: N,
|
|
5189
|
+
cancelEditing: j,
|
|
5190
|
+
handleRegenerateCb: G,
|
|
5191
|
+
displayMessages: v
|
|
5186
5192
|
};
|
|
5187
5193
|
}
|
|
5188
5194
|
function bo(e) {
|
|
@@ -5201,11 +5207,11 @@ function bo(e) {
|
|
|
5201
5207
|
}, [e]);
|
|
5202
5208
|
}
|
|
5203
5209
|
function wo(e, t, n) {
|
|
5204
|
-
const [r,
|
|
5210
|
+
const [r, s] = H(e), o = W(e), a = W(null);
|
|
5205
5211
|
return Y(() => {
|
|
5206
|
-
|
|
5212
|
+
o.current = e;
|
|
5207
5213
|
const i = () => {
|
|
5208
|
-
o
|
|
5214
|
+
s(o.current), a.current && (clearTimeout(a.current), a.current = null);
|
|
5209
5215
|
};
|
|
5210
5216
|
if (!t || n <= 0) {
|
|
5211
5217
|
i();
|
|
@@ -5232,7 +5238,7 @@ export {
|
|
|
5232
5238
|
Pt as getChatToken,
|
|
5233
5239
|
uo as getMessageAttemptInfo,
|
|
5234
5240
|
ao as getToolCallArtifacts,
|
|
5235
|
-
|
|
5241
|
+
Vn as getToolCalls,
|
|
5236
5242
|
so as hasContent,
|
|
5237
5243
|
mt as hydrateHistorySnapshots,
|
|
5238
5244
|
Ct as isFileLike,
|
|
@@ -5255,7 +5261,7 @@ export {
|
|
|
5255
5261
|
pr as useStream,
|
|
5256
5262
|
wo as useStreamingMarkdownBuffer,
|
|
5257
5263
|
$t as useThreadHistoryState,
|
|
5258
|
-
|
|
5264
|
+
Ht as useThreadState,
|
|
5259
5265
|
Lr as useThreadStateUpdater,
|
|
5260
5266
|
ot as useThreads,
|
|
5261
5267
|
gr as useThreadsState,
|