@teodorruskvi/chat-core 0.1.46 → 0.1.47
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/index.esm.js +952 -935
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +6 -6
- 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 Ht = Object.defineProperty;
|
|
2
|
+
var Gt = (e, t, n) => t in e ? Ht(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 ie } from "react/jsx-runtime";
|
|
5
5
|
import * as it from "react";
|
|
6
|
-
import { createContext as
|
|
6
|
+
import { createContext as Ce, useContext as Ue, useState as $, useRef as W, useEffect as X, useCallback as _, useMemo as Y, useReducer as Wt } from "react";
|
|
7
7
|
import Jt, { isCancel as Xt } from "axios";
|
|
8
|
-
function
|
|
8
|
+
function vt(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
12
|
var o = e.length;
|
|
13
|
-
for (t = 0; t < o; t++) e[t] && (n =
|
|
13
|
+
for (t = 0; t < o; t++) e[t] && (n = vt(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 = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t =
|
|
18
|
+
for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t = vt(e)) && (r && (r += " "), r += t);
|
|
19
19
|
return r;
|
|
20
20
|
}
|
|
21
21
|
const et = "-", Yt = (e) => {
|
|
@@ -29,8 +29,8 @@ const et = "-", Yt = (e) => {
|
|
|
29
29
|
return i[0] === "" && i.length !== 1 && i.shift(), It(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
|
}, It = (e, t) => {
|
|
@@ -120,33 +120,33 @@ const et = "-", Yt = (e) => {
|
|
|
120
120
|
n.has(s) ? n.set(s, a) : o(s, a);
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
},
|
|
123
|
+
}, At = "!", on = (e) => {
|
|
124
124
|
const {
|
|
125
125
|
separator: t,
|
|
126
126
|
experimentalParseClassName: n
|
|
127
127
|
} = e, r = t.length === 1, o = t[0], s = t.length, a = (i) => {
|
|
128
|
-
const
|
|
129
|
-
let c = 0, l = 0,
|
|
130
|
-
for (let
|
|
131
|
-
let
|
|
128
|
+
const u = [];
|
|
129
|
+
let c = 0, l = 0, d;
|
|
130
|
+
for (let k = 0; k < i.length; k++) {
|
|
131
|
+
let p = i[k];
|
|
132
132
|
if (c === 0) {
|
|
133
|
-
if (
|
|
134
|
-
|
|
133
|
+
if (p === o && (r || i.slice(k, k + s) === t)) {
|
|
134
|
+
u.push(i.slice(l, k)), l = k + s;
|
|
135
135
|
continue;
|
|
136
136
|
}
|
|
137
|
-
if (
|
|
138
|
-
|
|
137
|
+
if (p === "/") {
|
|
138
|
+
d = k;
|
|
139
139
|
continue;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
p === "[" ? c++ : p === "]" && c--;
|
|
143
143
|
}
|
|
144
|
-
const
|
|
144
|
+
const m = u.length === 0 ? i : i.substring(l), y = m.startsWith(At), I = y ? m.substring(1) : m, f = d && d > l ? d - l : void 0;
|
|
145
145
|
return {
|
|
146
|
-
modifiers:
|
|
147
|
-
hasImportantModifier:
|
|
148
|
-
baseClassName:
|
|
149
|
-
maybePostfixModifierPosition:
|
|
146
|
+
modifiers: u,
|
|
147
|
+
hasImportantModifier: y,
|
|
148
|
+
baseClassName: I,
|
|
149
|
+
maybePostfixModifierPosition: f
|
|
150
150
|
};
|
|
151
151
|
};
|
|
152
152
|
return n ? (i) => n({
|
|
@@ -172,33 +172,33 @@ const et = "-", Yt = (e) => {
|
|
|
172
172
|
getConflictingClassGroupIds: o
|
|
173
173
|
} = t, s = [], a = e.trim().split(cn);
|
|
174
174
|
let i = "";
|
|
175
|
-
for (let
|
|
176
|
-
const c = a[
|
|
175
|
+
for (let u = a.length - 1; u >= 0; u -= 1) {
|
|
176
|
+
const c = a[u], {
|
|
177
177
|
modifiers: l,
|
|
178
|
-
hasImportantModifier:
|
|
179
|
-
baseClassName:
|
|
180
|
-
maybePostfixModifierPosition:
|
|
178
|
+
hasImportantModifier: d,
|
|
179
|
+
baseClassName: m,
|
|
180
|
+
maybePostfixModifierPosition: y
|
|
181
181
|
} = n(c);
|
|
182
|
-
let
|
|
183
|
-
if (!
|
|
184
|
-
if (!
|
|
182
|
+
let I = !!y, f = r(I ? m.substring(0, y) : m);
|
|
183
|
+
if (!f) {
|
|
184
|
+
if (!I) {
|
|
185
185
|
i = c + (i.length > 0 ? " " + i : i);
|
|
186
186
|
continue;
|
|
187
187
|
}
|
|
188
|
-
if (
|
|
188
|
+
if (f = r(m), !f) {
|
|
189
189
|
i = c + (i.length > 0 ? " " + i : i);
|
|
190
190
|
continue;
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
I = !1;
|
|
193
193
|
}
|
|
194
|
-
const
|
|
195
|
-
if (s.includes(
|
|
194
|
+
const k = sn(l).join(":"), p = d ? k + At : k, S = p + f;
|
|
195
|
+
if (s.includes(S))
|
|
196
196
|
continue;
|
|
197
|
-
s.push(
|
|
198
|
-
const
|
|
199
|
-
for (let E = 0; E <
|
|
200
|
-
const v =
|
|
201
|
-
s.push(
|
|
197
|
+
s.push(S);
|
|
198
|
+
const A = o(f, I);
|
|
199
|
+
for (let E = 0; E < A.length; ++E) {
|
|
200
|
+
const v = A[E];
|
|
201
|
+
s.push(p + v);
|
|
202
202
|
}
|
|
203
203
|
i = c + (i.length > 0 ? " " + i : i);
|
|
204
204
|
}
|
|
@@ -207,29 +207,29 @@ const et = "-", Yt = (e) => {
|
|
|
207
207
|
function un() {
|
|
208
208
|
let e = 0, t, n, r = "";
|
|
209
209
|
for (; e < arguments.length; )
|
|
210
|
-
(t = arguments[e++]) && (n =
|
|
210
|
+
(t = arguments[e++]) && (n = xt(t)) && (r && (r += " "), r += n);
|
|
211
211
|
return r;
|
|
212
212
|
}
|
|
213
|
-
const
|
|
213
|
+
const xt = (e) => {
|
|
214
214
|
if (typeof e == "string")
|
|
215
215
|
return e;
|
|
216
216
|
let t, n = "";
|
|
217
217
|
for (let r = 0; r < e.length; r++)
|
|
218
|
-
e[r] && (t =
|
|
218
|
+
e[r] && (t = xt(e[r])) && (n && (n += " "), n += t);
|
|
219
219
|
return n;
|
|
220
220
|
};
|
|
221
221
|
function dn(e, ...t) {
|
|
222
222
|
let n, r, o, s = a;
|
|
223
|
-
function a(
|
|
224
|
-
const c = t.reduce((l,
|
|
225
|
-
return n = an(c), r = n.cache.get, o = n.cache.set, s = i, i(
|
|
223
|
+
function a(u) {
|
|
224
|
+
const c = t.reduce((l, d) => d(l), e());
|
|
225
|
+
return n = an(c), r = n.cache.get, o = n.cache.set, s = i, i(u);
|
|
226
226
|
}
|
|
227
|
-
function i(
|
|
228
|
-
const c = r(
|
|
227
|
+
function i(u) {
|
|
228
|
+
const c = r(u);
|
|
229
229
|
if (c)
|
|
230
230
|
return c;
|
|
231
|
-
const l = ln(
|
|
232
|
-
return o(
|
|
231
|
+
const l = ln(u, n);
|
|
232
|
+
return o(u, l), l;
|
|
233
233
|
}
|
|
234
234
|
return function() {
|
|
235
235
|
return s(un.apply(null, arguments));
|
|
@@ -238,7 +238,7 @@ function dn(e, ...t) {
|
|
|
238
238
|
const D = (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)\(.+\)$/, de = (e) => Te(e) || pn.has(e) || fn.test(e), be = (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)\(.+\)$/, de = (e) => Te(e) || pn.has(e) || fn.test(e), be = (e) => Ee(e, "length", Sn), Te = (e) => !!e && !Number.isNaN(Number(e)), qe = (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), we = (e) => gn.test(e), kn = /* @__PURE__ */ new Set(["length", "size", "percentage"]), vn = (e) => Ee(e, kn, St), In = (e) => Ee(e, "position", St), An = /* @__PURE__ */ new Set(["image", "url"]), xn = (e) => Ee(e, An, 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) => (
|
|
@@ -246,8 +246,8 @@ const D = (e) => {
|
|
|
246
246
|
// For example, `hsl(0 0% 0%)` would be classified as a length without this check.
|
|
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
|
-
), St = () => !1,
|
|
250
|
-
const e = D("colors"), t = D("spacing"), n = D("blur"), r = D("brightness"), o = D("borderColor"), s = D("borderRadius"), a = D("borderSpacing"), i = D("borderWidth"),
|
|
249
|
+
), St = () => !1, Mn = (e) => hn.test(e), Cn = (e) => bn.test(e), En = () => {
|
|
250
|
+
const e = D("colors"), t = D("spacing"), n = D("blur"), r = D("brightness"), o = D("borderColor"), s = D("borderRadius"), a = D("borderSpacing"), i = D("borderWidth"), u = D("contrast"), c = D("grayscale"), l = D("hueRotate"), d = D("invert"), m = D("gap"), y = D("gradientColorStops"), I = D("gradientColorStopPositions"), f = D("inset"), k = D("margin"), p = D("opacity"), S = D("padding"), A = D("saturate"), E = D("scale"), v = D("sepia"), w = D("skew"), x = D("space"), g = D("translate"), b = () => ["auto", "contain", "none"], P = () => ["auto", "hidden", "clip", "visible", "scroll"], j = () => ["auto", R, t], M = () => [R, t], O = () => ["", de, be], F = () => ["auto", Te, R], C = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], B = () => ["solid", "dashed", "dotted", "double", "none"], N = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], V = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], z = () => ["", "0", R], L = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], H = () => [Te, R];
|
|
251
251
|
return {
|
|
252
252
|
cacheSize: 500,
|
|
253
253
|
separator: ":",
|
|
@@ -255,28 +255,28 @@ const D = (e) => {
|
|
|
255
255
|
colors: [Ne],
|
|
256
256
|
spacing: [de, be],
|
|
257
257
|
blur: ["none", "", we, R],
|
|
258
|
-
brightness:
|
|
258
|
+
brightness: H(),
|
|
259
259
|
borderColor: [e],
|
|
260
260
|
borderRadius: ["none", "", "full", we, R],
|
|
261
|
-
borderSpacing:
|
|
261
|
+
borderSpacing: M(),
|
|
262
262
|
borderWidth: O(),
|
|
263
|
-
contrast:
|
|
263
|
+
contrast: H(),
|
|
264
264
|
grayscale: z(),
|
|
265
|
-
hueRotate:
|
|
265
|
+
hueRotate: H(),
|
|
266
266
|
invert: z(),
|
|
267
|
-
gap:
|
|
267
|
+
gap: M(),
|
|
268
268
|
gradientColorStops: [e],
|
|
269
269
|
gradientColorStopPositions: [wn, be],
|
|
270
270
|
inset: j(),
|
|
271
271
|
margin: j(),
|
|
272
|
-
opacity:
|
|
273
|
-
padding:
|
|
274
|
-
saturate:
|
|
275
|
-
scale:
|
|
272
|
+
opacity: H(),
|
|
273
|
+
padding: M(),
|
|
274
|
+
saturate: H(),
|
|
275
|
+
scale: H(),
|
|
276
276
|
sepia: z(),
|
|
277
|
-
skew:
|
|
278
|
-
space:
|
|
279
|
-
translate:
|
|
277
|
+
skew: H(),
|
|
278
|
+
space: M(),
|
|
279
|
+
translate: M()
|
|
280
280
|
},
|
|
281
281
|
classGroups: {
|
|
282
282
|
// Layout
|
|
@@ -370,7 +370,7 @@ const D = (e) => {
|
|
|
370
370
|
* @see https://tailwindcss.com/docs/object-position
|
|
371
371
|
*/
|
|
372
372
|
"object-position": [{
|
|
373
|
-
object: [...
|
|
373
|
+
object: [...C(), R]
|
|
374
374
|
}],
|
|
375
375
|
/**
|
|
376
376
|
* Overflow
|
|
@@ -398,21 +398,21 @@ const D = (e) => {
|
|
|
398
398
|
* @see https://tailwindcss.com/docs/overscroll-behavior
|
|
399
399
|
*/
|
|
400
400
|
overscroll: [{
|
|
401
|
-
overscroll:
|
|
401
|
+
overscroll: b()
|
|
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": b()
|
|
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": b()
|
|
416
416
|
}],
|
|
417
417
|
/**
|
|
418
418
|
* Position
|
|
@@ -424,63 +424,63 @@ const D = (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
|
|
@@ -565,14 +565,14 @@ const D = (e) => {
|
|
|
565
565
|
* @see https://tailwindcss.com/docs/grid-column
|
|
566
566
|
*/
|
|
567
567
|
"col-start": [{
|
|
568
|
-
"col-start":
|
|
568
|
+
"col-start": F()
|
|
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": F()
|
|
576
576
|
}],
|
|
577
577
|
/**
|
|
578
578
|
* Grid Template Rows
|
|
@@ -595,14 +595,14 @@ const D = (e) => {
|
|
|
595
595
|
* @see https://tailwindcss.com/docs/grid-row
|
|
596
596
|
*/
|
|
597
597
|
"row-start": [{
|
|
598
|
-
"row-start":
|
|
598
|
+
"row-start": F()
|
|
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": F()
|
|
606
606
|
}],
|
|
607
607
|
/**
|
|
608
608
|
* Grid Auto Flow
|
|
@@ -630,21 +630,21 @@ const D = (e) => {
|
|
|
630
630
|
* @see https://tailwindcss.com/docs/gap
|
|
631
631
|
*/
|
|
632
632
|
gap: [{
|
|
633
|
-
gap: [
|
|
633
|
+
gap: [m]
|
|
634
634
|
}],
|
|
635
635
|
/**
|
|
636
636
|
* Gap X
|
|
637
637
|
* @see https://tailwindcss.com/docs/gap
|
|
638
638
|
*/
|
|
639
639
|
"gap-x": [{
|
|
640
|
-
"gap-x": [
|
|
640
|
+
"gap-x": [m]
|
|
641
641
|
}],
|
|
642
642
|
/**
|
|
643
643
|
* Gap Y
|
|
644
644
|
* @see https://tailwindcss.com/docs/gap
|
|
645
645
|
*/
|
|
646
646
|
"gap-y": [{
|
|
647
|
-
"gap-y": [
|
|
647
|
+
"gap-y": [m]
|
|
648
648
|
}],
|
|
649
649
|
/**
|
|
650
650
|
* Justify Content
|
|
@@ -715,133 +715,133 @@ const D = (e) => {
|
|
|
715
715
|
* @see https://tailwindcss.com/docs/padding
|
|
716
716
|
*/
|
|
717
717
|
p: [{
|
|
718
|
-
p: [
|
|
718
|
+
p: [S]
|
|
719
719
|
}],
|
|
720
720
|
/**
|
|
721
721
|
* Padding X
|
|
722
722
|
* @see https://tailwindcss.com/docs/padding
|
|
723
723
|
*/
|
|
724
724
|
px: [{
|
|
725
|
-
px: [
|
|
725
|
+
px: [S]
|
|
726
726
|
}],
|
|
727
727
|
/**
|
|
728
728
|
* Padding Y
|
|
729
729
|
* @see https://tailwindcss.com/docs/padding
|
|
730
730
|
*/
|
|
731
731
|
py: [{
|
|
732
|
-
py: [
|
|
732
|
+
py: [S]
|
|
733
733
|
}],
|
|
734
734
|
/**
|
|
735
735
|
* Padding Start
|
|
736
736
|
* @see https://tailwindcss.com/docs/padding
|
|
737
737
|
*/
|
|
738
738
|
ps: [{
|
|
739
|
-
ps: [
|
|
739
|
+
ps: [S]
|
|
740
740
|
}],
|
|
741
741
|
/**
|
|
742
742
|
* Padding End
|
|
743
743
|
* @see https://tailwindcss.com/docs/padding
|
|
744
744
|
*/
|
|
745
745
|
pe: [{
|
|
746
|
-
pe: [
|
|
746
|
+
pe: [S]
|
|
747
747
|
}],
|
|
748
748
|
/**
|
|
749
749
|
* Padding Top
|
|
750
750
|
* @see https://tailwindcss.com/docs/padding
|
|
751
751
|
*/
|
|
752
752
|
pt: [{
|
|
753
|
-
pt: [
|
|
753
|
+
pt: [S]
|
|
754
754
|
}],
|
|
755
755
|
/**
|
|
756
756
|
* Padding Right
|
|
757
757
|
* @see https://tailwindcss.com/docs/padding
|
|
758
758
|
*/
|
|
759
759
|
pr: [{
|
|
760
|
-
pr: [
|
|
760
|
+
pr: [S]
|
|
761
761
|
}],
|
|
762
762
|
/**
|
|
763
763
|
* Padding Bottom
|
|
764
764
|
* @see https://tailwindcss.com/docs/padding
|
|
765
765
|
*/
|
|
766
766
|
pb: [{
|
|
767
|
-
pb: [
|
|
767
|
+
pb: [S]
|
|
768
768
|
}],
|
|
769
769
|
/**
|
|
770
770
|
* Padding Left
|
|
771
771
|
* @see https://tailwindcss.com/docs/padding
|
|
772
772
|
*/
|
|
773
773
|
pl: [{
|
|
774
|
-
pl: [
|
|
774
|
+
pl: [S]
|
|
775
775
|
}],
|
|
776
776
|
/**
|
|
777
777
|
* Margin
|
|
778
778
|
* @see https://tailwindcss.com/docs/margin
|
|
779
779
|
*/
|
|
780
780
|
m: [{
|
|
781
|
-
m: [
|
|
781
|
+
m: [k]
|
|
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: [k]
|
|
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: [k]
|
|
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: [k]
|
|
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: [k]
|
|
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: [k]
|
|
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: [k]
|
|
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: [k]
|
|
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: [k]
|
|
838
838
|
}],
|
|
839
839
|
/**
|
|
840
840
|
* Space Between X
|
|
841
841
|
* @see https://tailwindcss.com/docs/space
|
|
842
842
|
*/
|
|
843
843
|
"space-x": [{
|
|
844
|
-
"space-x": [
|
|
844
|
+
"space-x": [x]
|
|
845
845
|
}],
|
|
846
846
|
/**
|
|
847
847
|
* Space Between X Reverse
|
|
@@ -853,7 +853,7 @@ const D = (e) => {
|
|
|
853
853
|
* @see https://tailwindcss.com/docs/space
|
|
854
854
|
*/
|
|
855
855
|
"space-y": [{
|
|
856
|
-
"space-y": [
|
|
856
|
+
"space-y": [x]
|
|
857
857
|
}],
|
|
858
858
|
/**
|
|
859
859
|
* Space Between Y Reverse
|
|
@@ -935,7 +935,7 @@ const D = (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", qe]
|
|
939
939
|
}],
|
|
940
940
|
/**
|
|
941
941
|
* Font Family
|
|
@@ -986,7 +986,7 @@ const D = (e) => {
|
|
|
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, qe]
|
|
990
990
|
}],
|
|
991
991
|
/**
|
|
992
992
|
* Line Height
|
|
@@ -1029,7 +1029,7 @@ const D = (e) => {
|
|
|
1029
1029
|
* @see https://tailwindcss.com/docs/placeholder-opacity
|
|
1030
1030
|
*/
|
|
1031
1031
|
"placeholder-opacity": [{
|
|
1032
|
-
"placeholder-opacity": [
|
|
1032
|
+
"placeholder-opacity": [p]
|
|
1033
1033
|
}],
|
|
1034
1034
|
/**
|
|
1035
1035
|
* Text Alignment
|
|
@@ -1050,7 +1050,7 @@ const D = (e) => {
|
|
|
1050
1050
|
* @see https://tailwindcss.com/docs/text-opacity
|
|
1051
1051
|
*/
|
|
1052
1052
|
"text-opacity": [{
|
|
1053
|
-
"text-opacity": [
|
|
1053
|
+
"text-opacity": [p]
|
|
1054
1054
|
}],
|
|
1055
1055
|
/**
|
|
1056
1056
|
* Text Decoration
|
|
@@ -1062,7 +1062,7 @@ const D = (e) => {
|
|
|
1062
1062
|
* @see https://tailwindcss.com/docs/text-decoration-style
|
|
1063
1063
|
*/
|
|
1064
1064
|
"text-decoration-style": [{
|
|
1065
|
-
decoration: [...
|
|
1065
|
+
decoration: [...B(), "wavy"]
|
|
1066
1066
|
}],
|
|
1067
1067
|
/**
|
|
1068
1068
|
* Text Decoration Thickness
|
|
@@ -1107,7 +1107,7 @@ const D = (e) => {
|
|
|
1107
1107
|
* @see https://tailwindcss.com/docs/text-indent
|
|
1108
1108
|
*/
|
|
1109
1109
|
indent: [{
|
|
1110
|
-
indent:
|
|
1110
|
+
indent: M()
|
|
1111
1111
|
}],
|
|
1112
1112
|
/**
|
|
1113
1113
|
* Vertical Alignment
|
|
@@ -1165,7 +1165,7 @@ const D = (e) => {
|
|
|
1165
1165
|
* @see https://tailwindcss.com/docs/background-opacity
|
|
1166
1166
|
*/
|
|
1167
1167
|
"bg-opacity": [{
|
|
1168
|
-
"bg-opacity": [
|
|
1168
|
+
"bg-opacity": [p]
|
|
1169
1169
|
}],
|
|
1170
1170
|
/**
|
|
1171
1171
|
* Background Origin
|
|
@@ -1179,7 +1179,7 @@ const D = (e) => {
|
|
|
1179
1179
|
* @see https://tailwindcss.com/docs/background-position
|
|
1180
1180
|
*/
|
|
1181
1181
|
"bg-position": [{
|
|
1182
|
-
bg: [...
|
|
1182
|
+
bg: [...C(), In]
|
|
1183
1183
|
}],
|
|
1184
1184
|
/**
|
|
1185
1185
|
* Background Repeat
|
|
@@ -1195,7 +1195,7 @@ const D = (e) => {
|
|
|
1195
1195
|
* @see https://tailwindcss.com/docs/background-size
|
|
1196
1196
|
*/
|
|
1197
1197
|
"bg-size": [{
|
|
1198
|
-
bg: ["auto", "cover", "contain",
|
|
1198
|
+
bg: ["auto", "cover", "contain", vn]
|
|
1199
1199
|
}],
|
|
1200
1200
|
/**
|
|
1201
1201
|
* Background Image
|
|
@@ -1204,7 +1204,7 @@ const D = (e) => {
|
|
|
1204
1204
|
"bg-image": [{
|
|
1205
1205
|
bg: ["none", {
|
|
1206
1206
|
"gradient-to": ["t", "tr", "r", "br", "b", "bl", "l", "tl"]
|
|
1207
|
-
},
|
|
1207
|
+
}, xn]
|
|
1208
1208
|
}],
|
|
1209
1209
|
/**
|
|
1210
1210
|
* Background Color
|
|
@@ -1218,42 +1218,42 @@ const D = (e) => {
|
|
|
1218
1218
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1219
1219
|
*/
|
|
1220
1220
|
"gradient-from-pos": [{
|
|
1221
|
-
from: [
|
|
1221
|
+
from: [I]
|
|
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: [I]
|
|
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: [I]
|
|
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: [y]
|
|
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: [y]
|
|
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: [y]
|
|
1257
1257
|
}],
|
|
1258
1258
|
// Borders
|
|
1259
1259
|
/**
|
|
@@ -1429,14 +1429,14 @@ const D = (e) => {
|
|
|
1429
1429
|
* @see https://tailwindcss.com/docs/border-opacity
|
|
1430
1430
|
*/
|
|
1431
1431
|
"border-opacity": [{
|
|
1432
|
-
"border-opacity": [
|
|
1432
|
+
"border-opacity": [p]
|
|
1433
1433
|
}],
|
|
1434
1434
|
/**
|
|
1435
1435
|
* Border Style
|
|
1436
1436
|
* @see https://tailwindcss.com/docs/border-style
|
|
1437
1437
|
*/
|
|
1438
1438
|
"border-style": [{
|
|
1439
|
-
border: [...
|
|
1439
|
+
border: [...B(), "hidden"]
|
|
1440
1440
|
}],
|
|
1441
1441
|
/**
|
|
1442
1442
|
* Divide Width X
|
|
@@ -1467,14 +1467,14 @@ const D = (e) => {
|
|
|
1467
1467
|
* @see https://tailwindcss.com/docs/divide-opacity
|
|
1468
1468
|
*/
|
|
1469
1469
|
"divide-opacity": [{
|
|
1470
|
-
"divide-opacity": [
|
|
1470
|
+
"divide-opacity": [p]
|
|
1471
1471
|
}],
|
|
1472
1472
|
/**
|
|
1473
1473
|
* Divide Style
|
|
1474
1474
|
* @see https://tailwindcss.com/docs/divide-style
|
|
1475
1475
|
*/
|
|
1476
1476
|
"divide-style": [{
|
|
1477
|
-
divide:
|
|
1477
|
+
divide: B()
|
|
1478
1478
|
}],
|
|
1479
1479
|
/**
|
|
1480
1480
|
* Border Color
|
|
@@ -1551,7 +1551,7 @@ const D = (e) => {
|
|
|
1551
1551
|
* @see https://tailwindcss.com/docs/outline-style
|
|
1552
1552
|
*/
|
|
1553
1553
|
"outline-style": [{
|
|
1554
|
-
outline: ["", ...
|
|
1554
|
+
outline: ["", ...B()]
|
|
1555
1555
|
}],
|
|
1556
1556
|
/**
|
|
1557
1557
|
* Outline Offset
|
|
@@ -1598,7 +1598,7 @@ const D = (e) => {
|
|
|
1598
1598
|
* @see https://tailwindcss.com/docs/ring-opacity
|
|
1599
1599
|
*/
|
|
1600
1600
|
"ring-opacity": [{
|
|
1601
|
-
"ring-opacity": [
|
|
1601
|
+
"ring-opacity": [p]
|
|
1602
1602
|
}],
|
|
1603
1603
|
/**
|
|
1604
1604
|
* Ring Offset Width
|
|
@@ -1634,7 +1634,7 @@ const D = (e) => {
|
|
|
1634
1634
|
* @see https://tailwindcss.com/docs/opacity
|
|
1635
1635
|
*/
|
|
1636
1636
|
opacity: [{
|
|
1637
|
-
opacity: [
|
|
1637
|
+
opacity: [p]
|
|
1638
1638
|
}],
|
|
1639
1639
|
/**
|
|
1640
1640
|
* Mix Blend Mode
|
|
@@ -1678,7 +1678,7 @@ const D = (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
|
|
@@ -1706,14 +1706,14 @@ const D = (e) => {
|
|
|
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
|
|
1713
1713
|
* @see https://tailwindcss.com/docs/saturate
|
|
1714
1714
|
*/
|
|
1715
1715
|
saturate: [{
|
|
1716
|
-
saturate: [
|
|
1716
|
+
saturate: [A]
|
|
1717
1717
|
}],
|
|
1718
1718
|
/**
|
|
1719
1719
|
* Sepia
|
|
@@ -1749,7 +1749,7 @@ const D = (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
|
|
@@ -1770,21 +1770,21 @@ const D = (e) => {
|
|
|
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
|
|
1777
1777
|
* @see https://tailwindcss.com/docs/backdrop-opacity
|
|
1778
1778
|
*/
|
|
1779
1779
|
"backdrop-opacity": [{
|
|
1780
|
-
"backdrop-opacity": [
|
|
1780
|
+
"backdrop-opacity": [p]
|
|
1781
1781
|
}],
|
|
1782
1782
|
/**
|
|
1783
1783
|
* Backdrop Saturate
|
|
1784
1784
|
* @see https://tailwindcss.com/docs/backdrop-saturate
|
|
1785
1785
|
*/
|
|
1786
1786
|
"backdrop-saturate": [{
|
|
1787
|
-
"backdrop-saturate": [
|
|
1787
|
+
"backdrop-saturate": [A]
|
|
1788
1788
|
}],
|
|
1789
1789
|
/**
|
|
1790
1790
|
* Backdrop Sepia
|
|
@@ -1849,7 +1849,7 @@ const D = (e) => {
|
|
|
1849
1849
|
* @see https://tailwindcss.com/docs/transition-duration
|
|
1850
1850
|
*/
|
|
1851
1851
|
duration: [{
|
|
1852
|
-
duration:
|
|
1852
|
+
duration: H()
|
|
1853
1853
|
}],
|
|
1854
1854
|
/**
|
|
1855
1855
|
* Transition Timing Function
|
|
@@ -1863,7 +1863,7 @@ const D = (e) => {
|
|
|
1863
1863
|
* @see https://tailwindcss.com/docs/transition-delay
|
|
1864
1864
|
*/
|
|
1865
1865
|
delay: [{
|
|
1866
|
-
delay:
|
|
1866
|
+
delay: H()
|
|
1867
1867
|
}],
|
|
1868
1868
|
/**
|
|
1869
1869
|
* Animation
|
|
@@ -1913,28 +1913,28 @@ const D = (e) => {
|
|
|
1913
1913
|
* @see https://tailwindcss.com/docs/translate
|
|
1914
1914
|
*/
|
|
1915
1915
|
"translate-x": [{
|
|
1916
|
-
"translate-x": [
|
|
1916
|
+
"translate-x": [g]
|
|
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": [g]
|
|
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": [w]
|
|
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": [w]
|
|
1938
1938
|
}],
|
|
1939
1939
|
/**
|
|
1940
1940
|
* Transform Origin
|
|
@@ -1998,126 +1998,126 @@ const D = (e) => {
|
|
|
1998
1998
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
1999
1999
|
*/
|
|
2000
2000
|
"scroll-m": [{
|
|
2001
|
-
"scroll-m":
|
|
2001
|
+
"scroll-m": M()
|
|
2002
2002
|
}],
|
|
2003
2003
|
/**
|
|
2004
2004
|
* Scroll Margin X
|
|
2005
2005
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2006
2006
|
*/
|
|
2007
2007
|
"scroll-mx": [{
|
|
2008
|
-
"scroll-mx":
|
|
2008
|
+
"scroll-mx": M()
|
|
2009
2009
|
}],
|
|
2010
2010
|
/**
|
|
2011
2011
|
* Scroll Margin Y
|
|
2012
2012
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2013
2013
|
*/
|
|
2014
2014
|
"scroll-my": [{
|
|
2015
|
-
"scroll-my":
|
|
2015
|
+
"scroll-my": M()
|
|
2016
2016
|
}],
|
|
2017
2017
|
/**
|
|
2018
2018
|
* Scroll Margin Start
|
|
2019
2019
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2020
2020
|
*/
|
|
2021
2021
|
"scroll-ms": [{
|
|
2022
|
-
"scroll-ms":
|
|
2022
|
+
"scroll-ms": M()
|
|
2023
2023
|
}],
|
|
2024
2024
|
/**
|
|
2025
2025
|
* Scroll Margin End
|
|
2026
2026
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2027
2027
|
*/
|
|
2028
2028
|
"scroll-me": [{
|
|
2029
|
-
"scroll-me":
|
|
2029
|
+
"scroll-me": M()
|
|
2030
2030
|
}],
|
|
2031
2031
|
/**
|
|
2032
2032
|
* Scroll Margin Top
|
|
2033
2033
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2034
2034
|
*/
|
|
2035
2035
|
"scroll-mt": [{
|
|
2036
|
-
"scroll-mt":
|
|
2036
|
+
"scroll-mt": M()
|
|
2037
2037
|
}],
|
|
2038
2038
|
/**
|
|
2039
2039
|
* Scroll Margin Right
|
|
2040
2040
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2041
2041
|
*/
|
|
2042
2042
|
"scroll-mr": [{
|
|
2043
|
-
"scroll-mr":
|
|
2043
|
+
"scroll-mr": M()
|
|
2044
2044
|
}],
|
|
2045
2045
|
/**
|
|
2046
2046
|
* Scroll Margin Bottom
|
|
2047
2047
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2048
2048
|
*/
|
|
2049
2049
|
"scroll-mb": [{
|
|
2050
|
-
"scroll-mb":
|
|
2050
|
+
"scroll-mb": M()
|
|
2051
2051
|
}],
|
|
2052
2052
|
/**
|
|
2053
2053
|
* Scroll Margin Left
|
|
2054
2054
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2055
2055
|
*/
|
|
2056
2056
|
"scroll-ml": [{
|
|
2057
|
-
"scroll-ml":
|
|
2057
|
+
"scroll-ml": M()
|
|
2058
2058
|
}],
|
|
2059
2059
|
/**
|
|
2060
2060
|
* Scroll Padding
|
|
2061
2061
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2062
2062
|
*/
|
|
2063
2063
|
"scroll-p": [{
|
|
2064
|
-
"scroll-p":
|
|
2064
|
+
"scroll-p": M()
|
|
2065
2065
|
}],
|
|
2066
2066
|
/**
|
|
2067
2067
|
* Scroll Padding X
|
|
2068
2068
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2069
2069
|
*/
|
|
2070
2070
|
"scroll-px": [{
|
|
2071
|
-
"scroll-px":
|
|
2071
|
+
"scroll-px": M()
|
|
2072
2072
|
}],
|
|
2073
2073
|
/**
|
|
2074
2074
|
* Scroll Padding Y
|
|
2075
2075
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2076
2076
|
*/
|
|
2077
2077
|
"scroll-py": [{
|
|
2078
|
-
"scroll-py":
|
|
2078
|
+
"scroll-py": M()
|
|
2079
2079
|
}],
|
|
2080
2080
|
/**
|
|
2081
2081
|
* Scroll Padding Start
|
|
2082
2082
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2083
2083
|
*/
|
|
2084
2084
|
"scroll-ps": [{
|
|
2085
|
-
"scroll-ps":
|
|
2085
|
+
"scroll-ps": M()
|
|
2086
2086
|
}],
|
|
2087
2087
|
/**
|
|
2088
2088
|
* Scroll Padding End
|
|
2089
2089
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2090
2090
|
*/
|
|
2091
2091
|
"scroll-pe": [{
|
|
2092
|
-
"scroll-pe":
|
|
2092
|
+
"scroll-pe": M()
|
|
2093
2093
|
}],
|
|
2094
2094
|
/**
|
|
2095
2095
|
* Scroll Padding Top
|
|
2096
2096
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2097
2097
|
*/
|
|
2098
2098
|
"scroll-pt": [{
|
|
2099
|
-
"scroll-pt":
|
|
2099
|
+
"scroll-pt": M()
|
|
2100
2100
|
}],
|
|
2101
2101
|
/**
|
|
2102
2102
|
* Scroll Padding Right
|
|
2103
2103
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2104
2104
|
*/
|
|
2105
2105
|
"scroll-pr": [{
|
|
2106
|
-
"scroll-pr":
|
|
2106
|
+
"scroll-pr": M()
|
|
2107
2107
|
}],
|
|
2108
2108
|
/**
|
|
2109
2109
|
* Scroll Padding Bottom
|
|
2110
2110
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2111
2111
|
*/
|
|
2112
2112
|
"scroll-pb": [{
|
|
2113
|
-
"scroll-pb":
|
|
2113
|
+
"scroll-pb": M()
|
|
2114
2114
|
}],
|
|
2115
2115
|
/**
|
|
2116
2116
|
* Scroll Padding Left
|
|
2117
2117
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2118
2118
|
*/
|
|
2119
2119
|
"scroll-pl": [{
|
|
2120
|
-
"scroll-pl":
|
|
2120
|
+
"scroll-pl": M()
|
|
2121
2121
|
}],
|
|
2122
2122
|
/**
|
|
2123
2123
|
* Scroll Snap Align
|
|
@@ -2200,7 +2200,7 @@ const D = (e) => {
|
|
|
2200
2200
|
* @see https://tailwindcss.com/docs/stroke-width
|
|
2201
2201
|
*/
|
|
2202
2202
|
"stroke-w": [{
|
|
2203
|
-
stroke: [de, be,
|
|
2203
|
+
stroke: [de, be, qe]
|
|
2204
2204
|
}],
|
|
2205
2205
|
/**
|
|
2206
2206
|
* Stroke
|
|
@@ -2329,10 +2329,10 @@ function Un(e) {
|
|
|
2329
2329
|
function jn(e) {
|
|
2330
2330
|
return e.content.filter(Rn);
|
|
2331
2331
|
}
|
|
2332
|
-
function
|
|
2332
|
+
function Mt(e) {
|
|
2333
2333
|
return Array.isArray(e.toolCalls) ? e.toolCalls : [];
|
|
2334
2334
|
}
|
|
2335
|
-
function
|
|
2335
|
+
function Bn(e) {
|
|
2336
2336
|
const t = [];
|
|
2337
2337
|
return e.forEach((n) => {
|
|
2338
2338
|
n.artifact && t.push(n.artifact), Array.isArray(n.toolCalls) && n.toolCalls.forEach((r) => {
|
|
@@ -2340,7 +2340,7 @@ function Fn(e) {
|
|
|
2340
2340
|
});
|
|
2341
2341
|
}), t;
|
|
2342
2342
|
}
|
|
2343
|
-
function
|
|
2343
|
+
function Ct(e) {
|
|
2344
2344
|
return !!(e && typeof e == "object" && (e.type === "file" || e.mimeType || e.filename || e.sourceType === "base64"));
|
|
2345
2345
|
}
|
|
2346
2346
|
function Ve(e) {
|
|
@@ -2355,7 +2355,7 @@ function Ve(e) {
|
|
|
2355
2355
|
}
|
|
2356
2356
|
return n;
|
|
2357
2357
|
}
|
|
2358
|
-
if (
|
|
2358
|
+
if (Ct(e)) {
|
|
2359
2359
|
try {
|
|
2360
2360
|
console.debug("[message-utils] sanitizeForDisplay - dropping file-like object", {
|
|
2361
2361
|
sampleFilename: e && (e.filename || e.name) ? e.filename || e.name : void 0,
|
|
@@ -2389,7 +2389,7 @@ function Ve(e) {
|
|
|
2389
2389
|
}
|
|
2390
2390
|
function Et(e) {
|
|
2391
2391
|
if (typeof e == "string") return e;
|
|
2392
|
-
if (
|
|
2392
|
+
if (Ct(e)) return "";
|
|
2393
2393
|
try {
|
|
2394
2394
|
const t = Ve(e);
|
|
2395
2395
|
return t === void 0 ? "" : typeof t == "string" ? t : JSON.stringify(t, null, 2);
|
|
@@ -2401,7 +2401,7 @@ function oo(e) {
|
|
|
2401
2401
|
const t = Et(e);
|
|
2402
2402
|
return typeof e == "string" && Nn(e) ? { content: e, isMarkdown: !0 } : { content: t, isMarkdown: !1 };
|
|
2403
2403
|
}
|
|
2404
|
-
function
|
|
2404
|
+
function Fn(e) {
|
|
2405
2405
|
const t = (r) => {
|
|
2406
2406
|
try {
|
|
2407
2407
|
const o = Ve(r);
|
|
@@ -2436,24 +2436,24 @@ function ce(e) {
|
|
|
2436
2436
|
}
|
|
2437
2437
|
return typeof e == "object" && !Array.isArray(e) && (e.type === "text" && typeof e.text == "string" || typeof e.text == "string") ? e.text : Array.isArray(e) && e.length > 0 ? ce(e[0]) : e;
|
|
2438
2438
|
}
|
|
2439
|
-
function
|
|
2439
|
+
function On(e) {
|
|
2440
2440
|
return e.replace(/[_-](\w)/g, (t, n) => n ? n.toUpperCase() : "").replace(/^\w/, (t) => t.toLowerCase());
|
|
2441
2441
|
}
|
|
2442
2442
|
function le(e) {
|
|
2443
2443
|
return !e || typeof e != "object" ? e : Array.isArray(e) ? e.map(le) : Object.fromEntries(
|
|
2444
2444
|
Object.entries(e).map(([t, n]) => [
|
|
2445
|
-
|
|
2445
|
+
On(t),
|
|
2446
2446
|
le(n)
|
|
2447
2447
|
])
|
|
2448
2448
|
);
|
|
2449
2449
|
}
|
|
2450
2450
|
function nt(e) {
|
|
2451
|
-
var
|
|
2451
|
+
var k, p, S, A, E, v;
|
|
2452
2452
|
if (!e || typeof e != "object") return null;
|
|
2453
2453
|
const t = le(e), n = Vn(t);
|
|
2454
2454
|
if (!n)
|
|
2455
2455
|
return null;
|
|
2456
|
-
const r = Array.isArray(t.toolCalls) ? t.toolCalls.map(rt) : void 0, o = Dn(t.content ?? t.parts, !!(r != null && r.length)), s = t.id ?? `msg-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`, a = t.createdAt ?? ((
|
|
2456
|
+
const r = Array.isArray(t.toolCalls) ? t.toolCalls.map(rt) : void 0, o = Dn(t.content ?? t.parts, !!(r != null && r.length)), s = t.id ?? `msg-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`, a = t.createdAt ?? ((k = t.additionalKwargs) == null ? void 0 : k.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(), i = t.name ?? ((p = t.additionalKwargs) == null ? void 0 : p.agentName) ?? void 0, u = t.model ?? ((S = t.additionalKwargs) == null ? void 0 : S.model) ?? void 0, c = t.toolCallId ?? void 0, l = t.additionalKwargs ?? void 0, d = t.responseMetadata ?? void 0, m = t.checkpointId ?? ((A = t.additionalKwargs) == null ? void 0 : A.checkpointId) ?? void 0, y = t.checkpointNs ?? ((E = t.additionalKwargs) == null ? void 0 : E.checkpointNs) ?? void 0, I = typeof t.toolStreaming == "boolean" ? t.toolStreaming : !!((v = t.additionalKwargs) != null && v.toolStreaming);
|
|
2457
2457
|
return {
|
|
2458
2458
|
...t,
|
|
2459
2459
|
id: s,
|
|
@@ -2461,14 +2461,14 @@ function nt(e) {
|
|
|
2461
2461
|
content: o,
|
|
2462
2462
|
createdAt: a,
|
|
2463
2463
|
name: i,
|
|
2464
|
-
model:
|
|
2464
|
+
model: u,
|
|
2465
2465
|
toolCallId: c,
|
|
2466
2466
|
toolCalls: r,
|
|
2467
|
-
checkpointId:
|
|
2468
|
-
checkpointNs:
|
|
2469
|
-
toolStreaming:
|
|
2467
|
+
checkpointId: m,
|
|
2468
|
+
checkpointNs: y,
|
|
2469
|
+
toolStreaming: I,
|
|
2470
2470
|
additionalKwargs: l,
|
|
2471
|
-
responseMetadata:
|
|
2471
|
+
responseMetadata: d,
|
|
2472
2472
|
artifact: t.artifact && typeof t.artifact == "object" && !t.artifact.type ? { ...t.artifact, type: t.name } : t.artifact ?? void 0
|
|
2473
2473
|
};
|
|
2474
2474
|
}
|
|
@@ -2510,14 +2510,14 @@ function ut(e) {
|
|
|
2510
2510
|
return t === "running" || t === "pending" ? "pending" : t === "completed" || t === "success" ? "completed" : t === "error" || t === "failed" || t === "failure" ? "error" : null;
|
|
2511
2511
|
}
|
|
2512
2512
|
function dt(e) {
|
|
2513
|
-
return (Array.isArray(e.toolCalls) ? e.toolCalls :
|
|
2513
|
+
return (Array.isArray(e.toolCalls) ? e.toolCalls : Mt(e)).map(rt);
|
|
2514
2514
|
}
|
|
2515
|
-
function
|
|
2515
|
+
function He(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 Kn(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);
|
|
@@ -2533,21 +2533,21 @@ function qn(e, t) {
|
|
|
2533
2533
|
createdAt: e.createdAt
|
|
2534
2534
|
};
|
|
2535
2535
|
}
|
|
2536
|
-
function
|
|
2536
|
+
function qn(e, t = []) {
|
|
2537
2537
|
if (Array.isArray(e)) {
|
|
2538
2538
|
const o = e.filter((a) => a.role === "assistant").flatMap((a) => dt(a)), s = /* @__PURE__ */ new Map();
|
|
2539
2539
|
return o.forEach((a) => s.set(a.id, a)), Array.from(s.values()).map((a) => {
|
|
2540
|
-
var
|
|
2541
|
-
const i =
|
|
2540
|
+
var d, m, y;
|
|
2541
|
+
const i = He(a.id, e) || He(a.id, t), u = Array.isArray((d = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : d.toolProgress) ? (m = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : m.toolProgress : void 0, c = (i == null ? void 0 : i.artifact) ?? a.artifact, l = ut(a.status) ?? ((y = i == null ? void 0 : i.additionalKwargs) != null && y.toolStreaming ? "pending" : null) ?? (i ? "completed" : "pending");
|
|
2542
2542
|
if (i && !a.content && l === "completed") {
|
|
2543
|
-
const
|
|
2544
|
-
typeof
|
|
2543
|
+
const I = ce(i);
|
|
2544
|
+
typeof I == "string" && (a.content = I);
|
|
2545
2545
|
}
|
|
2546
2546
|
return {
|
|
2547
2547
|
call: a,
|
|
2548
2548
|
result: i,
|
|
2549
2549
|
state: l,
|
|
2550
|
-
progress:
|
|
2550
|
+
progress: u,
|
|
2551
2551
|
artifact: c
|
|
2552
2552
|
};
|
|
2553
2553
|
});
|
|
@@ -2555,11 +2555,11 @@ function Hn(e, t = []) {
|
|
|
2555
2555
|
if (e.role !== "assistant") return [];
|
|
2556
2556
|
const n = dt(e);
|
|
2557
2557
|
return n.length === 0 ? [] : n.map((r) => {
|
|
2558
|
-
var
|
|
2559
|
-
const o =
|
|
2558
|
+
var u, c, l;
|
|
2559
|
+
const o = He(r.id, t) ?? Kn(e, r), s = Array.isArray((u = o == null ? void 0 : o.additionalKwargs) == null ? void 0 : u.toolProgress) ? (c = o == null ? void 0 : o.additionalKwargs) == null ? void 0 : c.toolProgress : void 0, a = (o == null ? void 0 : o.artifact) ?? r.artifact, i = ut(r.status) ?? ((l = o == null ? void 0 : o.additionalKwargs) != null && l.toolStreaming ? "pending" : null) ?? (o ? "completed" : "pending");
|
|
2560
2560
|
if (o && !r.content && i === "completed") {
|
|
2561
|
-
const
|
|
2562
|
-
typeof
|
|
2561
|
+
const d = ce(o);
|
|
2562
|
+
typeof d == "string" && (r.content = d);
|
|
2563
2563
|
}
|
|
2564
2564
|
return {
|
|
2565
2565
|
call: r,
|
|
@@ -2571,7 +2571,7 @@ function Hn(e, t = []) {
|
|
|
2571
2571
|
});
|
|
2572
2572
|
}
|
|
2573
2573
|
function ao(e, t = []) {
|
|
2574
|
-
return
|
|
2574
|
+
return qn(e, t).map((n) => n.artifact).filter((n) => !!n);
|
|
2575
2575
|
}
|
|
2576
2576
|
const ze = {
|
|
2577
2577
|
authToken: "authToken",
|
|
@@ -2585,19 +2585,19 @@ const ze = {
|
|
|
2585
2585
|
function Ge(e) {
|
|
2586
2586
|
return `draft:${e}`;
|
|
2587
2587
|
}
|
|
2588
|
-
let
|
|
2588
|
+
let Ke = null;
|
|
2589
2589
|
const Qe = /* @__PURE__ */ new Set();
|
|
2590
2590
|
function Pt() {
|
|
2591
|
-
return
|
|
2591
|
+
return Ke;
|
|
2592
2592
|
}
|
|
2593
|
-
function
|
|
2594
|
-
|
|
2593
|
+
function ve(e) {
|
|
2594
|
+
Ke = e, Qe.forEach((t) => t(e));
|
|
2595
2595
|
}
|
|
2596
2596
|
function _t(e) {
|
|
2597
2597
|
return Qe.add(e), () => Qe.delete(e);
|
|
2598
2598
|
}
|
|
2599
|
-
const
|
|
2600
|
-
let Ye =
|
|
2599
|
+
const Hn = 12e4, Gn = 12e4;
|
|
2600
|
+
let Ye = Hn, Nt = Gn;
|
|
2601
2601
|
const ne = Jt.create({
|
|
2602
2602
|
// BaseURL is set dynamically via ApiProvider -> api.updateConfig
|
|
2603
2603
|
timeout: Ye,
|
|
@@ -2613,13 +2613,13 @@ function Wn(e) {
|
|
|
2613
2613
|
function Jn() {
|
|
2614
2614
|
return Nt;
|
|
2615
2615
|
}
|
|
2616
|
-
ne.interceptors.request.use((e) => (
|
|
2616
|
+
ne.interceptors.request.use((e) => (Ke && (e.headers.Authorization = `Bearer ${Ke}`), e));
|
|
2617
2617
|
ne.interceptors.response.use(
|
|
2618
2618
|
(e) => {
|
|
2619
2619
|
if (typeof window < "u" && (e != null && e.data))
|
|
2620
2620
|
try {
|
|
2621
2621
|
const t = e.data, n = t.data || {}, r = typeof t.token == "string" && t.token || typeof n.token == "string" && n.token || null, o = 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),
|
|
2622
|
+
r && (localStorage.setItem(ze.authToken, r), ve(r)), o && localStorage.setItem(ze.authTokenExpiresAt, o.toString()), (r || o) && window.dispatchEvent(
|
|
2623
2623
|
new CustomEvent("smartorg:chat-token-updated", {
|
|
2624
2624
|
detail: { token: r, expiresAt: o }
|
|
2625
2625
|
})
|
|
@@ -2660,7 +2660,7 @@ class Yn {
|
|
|
2660
2660
|
const n = t.baseUrl.replace(/\/+$/, "");
|
|
2661
2661
|
ne.defaults.baseURL = n;
|
|
2662
2662
|
}
|
|
2663
|
-
t.apiKey !== void 0 ?
|
|
2663
|
+
t.apiKey !== void 0 ? ve(t.apiKey) : t.getToken && ve(t.getToken()), (t.requestTimeoutMs !== void 0 || t.historyTimeoutMs !== void 0) && Wn({
|
|
2664
2664
|
requestTimeoutMs: t.requestTimeoutMs,
|
|
2665
2665
|
historyTimeoutMs: t.historyTimeoutMs
|
|
2666
2666
|
});
|
|
@@ -2670,7 +2670,7 @@ class Yn {
|
|
|
2670
2670
|
return Pt();
|
|
2671
2671
|
}
|
|
2672
2672
|
setAuthToken(t) {
|
|
2673
|
-
|
|
2673
|
+
ve(t);
|
|
2674
2674
|
}
|
|
2675
2675
|
onTokenChange(t) {
|
|
2676
2676
|
return _t(t);
|
|
@@ -2820,14 +2820,14 @@ class er {
|
|
|
2820
2820
|
const n = t.baseUrl.replace(/\/+$/, "");
|
|
2821
2821
|
this._authBaseUrl = `${n}/auth`;
|
|
2822
2822
|
}
|
|
2823
|
-
t.apiKey !== void 0 ?
|
|
2823
|
+
t.apiKey !== void 0 ? ve(t.apiKey) : t.getToken && ve(t.getToken());
|
|
2824
2824
|
}
|
|
2825
2825
|
// ---- Token Management ----
|
|
2826
2826
|
getAuthToken() {
|
|
2827
2827
|
return Pt();
|
|
2828
2828
|
}
|
|
2829
2829
|
setAuthToken(t) {
|
|
2830
|
-
|
|
2830
|
+
ve(t);
|
|
2831
2831
|
}
|
|
2832
2832
|
onTokenChange(t) {
|
|
2833
2833
|
return _t(t);
|
|
@@ -2838,12 +2838,12 @@ class er {
|
|
|
2838
2838
|
return (t == null ? void 0 : t.users) ?? [];
|
|
2839
2839
|
}
|
|
2840
2840
|
}
|
|
2841
|
-
const tr = new er(), Lt =
|
|
2841
|
+
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 s = n.baseUrl, a = r.baseUrl, i = n.getAuthToken(),
|
|
2846
|
-
(t.baseUrl || t.chatBaseUrl ||
|
|
2845
|
+
const s = 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 !== s || t.baseUrl && !s.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
2848
|
const o = {
|
|
2849
2849
|
token: n.getAuthToken(),
|
|
@@ -2865,7 +2865,7 @@ async function rr(e) {
|
|
|
2865
2865
|
const o = r.result, s = new Uint8Array(o);
|
|
2866
2866
|
let a = "";
|
|
2867
2867
|
const i = s.byteLength;
|
|
2868
|
-
for (let
|
|
2868
|
+
for (let u = 0; u < i; u++) a += String.fromCharCode(s[u]);
|
|
2869
2869
|
t(btoa(a));
|
|
2870
2870
|
} catch (o) {
|
|
2871
2871
|
n(o);
|
|
@@ -2930,7 +2930,7 @@ function lo(e) {
|
|
|
2930
2930
|
}).join("|") : "", r = "checkpointId" in e && e.checkpointId ? `cp:${e.checkpointId}` : "", o = "checkpointNs" in e && e.checkpointNs ? `ns:${e.checkpointNs}` : "", s = [r, o].filter(Boolean).join("|");
|
|
2931
2931
|
return `${e.id}:${t}:${n}${s ? `:${s}` : ""}`;
|
|
2932
2932
|
}
|
|
2933
|
-
function
|
|
2933
|
+
function Me() {
|
|
2934
2934
|
const e = Ue(Lt);
|
|
2935
2935
|
if (!e) throw new Error("useApi must be used within ApiProvider");
|
|
2936
2936
|
return e;
|
|
@@ -3009,72 +3009,72 @@ 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, o] =
|
|
3012
|
+
const t = e.baseUrl || "", n = e.streamPath ?? "/stream", [r, o] = $(e.token ?? null), s = W(e.headers ?? {}), a = e.credentials ?? "include", i = W(e);
|
|
3013
3013
|
X(() => {
|
|
3014
3014
|
i.current = e;
|
|
3015
3015
|
}, [e]);
|
|
3016
|
-
const
|
|
3017
|
-
var j,
|
|
3018
|
-
const
|
|
3019
|
-
if (!
|
|
3020
|
-
(j =
|
|
3021
|
-
}, []), [c, l] =
|
|
3022
|
-
o(
|
|
3016
|
+
const u = _((g) => {
|
|
3017
|
+
var j, M, O, F, C, B, N, V, z, L;
|
|
3018
|
+
const b = i.current;
|
|
3019
|
+
if (!b) return;
|
|
3020
|
+
(j = b.onEvent) == null || j.call(b, g), g.type === "thread_info" && ((M = b.onThreadInfo) == null || M.call(b, g)), g.type === "values" && Array.isArray(g.checkpoints) && ((O = b.handleValuesEvent) == null || O.call(b, g)), g.type === "metadata" && ((F = b.onMetadataEvent) == null || F.call(b, g)), typeof g.type == "string" && (g.type === "custom" || g.type.startsWith("custom.")) && ((C = b.onCustomEvent) == null || C.call(b, g)), g.type === "updates" && ((B = b.onUpdateEvent) == null || B.call(b, g)), g.type === "tool.end" ? (N = b.onToolEnd) == null || N.call(b, g) : g.type === "tool.start" && ((V = b.onToolStart) == null || V.call(b, g)), g.type === "heartbeat" && ((z = b.onHeartbeat) == null || z.call(b, g)), g.type === "token" && ((L = b.onToken) == null || L.call(b, g.token));
|
|
3021
|
+
}, []), [c, l] = $(!1), [d, m] = $(null), [y, I] = $(!1), [f, k] = $(null), p = W(null), S = W(!0), A = W(null), E = _((g) => {
|
|
3022
|
+
o(g);
|
|
3023
3023
|
}, []), v = _(() => {
|
|
3024
|
-
|
|
3025
|
-
}, []),
|
|
3026
|
-
var
|
|
3024
|
+
m(null), k(null);
|
|
3025
|
+
}, []), w = _(() => {
|
|
3026
|
+
var M, O;
|
|
3027
3027
|
console.debug("[use-chat] stop() invoked - aborting stream");
|
|
3028
|
-
const
|
|
3029
|
-
var
|
|
3030
|
-
(
|
|
3028
|
+
const g = (M = A.current) == null ? void 0 : M.threadId, b = (O = A.current) == null ? void 0 : O.runId, P = () => {
|
|
3029
|
+
var F;
|
|
3030
|
+
(F = p.current) == null || F.abort(), p.current = null, A.current = null, l(!1), I(!1);
|
|
3031
3031
|
};
|
|
3032
|
-
(
|
|
3033
|
-
console.warn("[use-chat] cancel run failed:",
|
|
3032
|
+
(b || g ? zt.cancelRun(b || g).catch((F) => {
|
|
3033
|
+
console.warn("[use-chat] cancel run failed:", F);
|
|
3034
3034
|
}) : Promise.resolve()).finally(P);
|
|
3035
|
-
}, []),
|
|
3036
|
-
(
|
|
3037
|
-
|
|
3038
|
-
const
|
|
3039
|
-
text: typeof
|
|
3040
|
-
threadId:
|
|
3041
|
-
attachments:
|
|
3042
|
-
payload:
|
|
3043
|
-
...
|
|
3044
|
-
creativityLevel:
|
|
3035
|
+
}, []), x = _(
|
|
3036
|
+
(g) => {
|
|
3037
|
+
p.current && (p.current.abort(), p.current = null);
|
|
3038
|
+
const b = {
|
|
3039
|
+
text: typeof g.content == "string" ? g.content : g.text,
|
|
3040
|
+
threadId: g.threadId,
|
|
3041
|
+
attachments: g.attachments,
|
|
3042
|
+
payload: g.payload ? {
|
|
3043
|
+
...g.payload,
|
|
3044
|
+
creativityLevel: g.payload.creativityLevel ?? "medium"
|
|
3045
3045
|
} : { creativityLevel: "medium" },
|
|
3046
|
-
config:
|
|
3047
|
-
checkpointId:
|
|
3048
|
-
checkpointNs:
|
|
3049
|
-
edit:
|
|
3050
|
-
command:
|
|
3046
|
+
config: g.config,
|
|
3047
|
+
checkpointId: g.checkpointId,
|
|
3048
|
+
checkpointNs: g.checkpointNs || void 0,
|
|
3049
|
+
edit: g.edit ?? !1,
|
|
3050
|
+
command: g.command
|
|
3051
3051
|
};
|
|
3052
|
-
l(!0),
|
|
3052
|
+
l(!0), m(null), k(null);
|
|
3053
3053
|
const P = new AbortController();
|
|
3054
|
-
|
|
3055
|
-
let j = null,
|
|
3056
|
-
return
|
|
3057
|
-
threadId:
|
|
3054
|
+
p.current = P;
|
|
3055
|
+
let j = null, M = !1;
|
|
3056
|
+
return A.current = {
|
|
3057
|
+
threadId: b.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 O,
|
|
3063
|
+
var O, F, C, B, N, V;
|
|
3064
3064
|
try {
|
|
3065
3065
|
let z = {};
|
|
3066
3066
|
try {
|
|
3067
3067
|
if (r)
|
|
3068
3068
|
z = { Authorization: `Bearer ${r}` };
|
|
3069
3069
|
else if (typeof window < "u") {
|
|
3070
|
-
const te = window.__AUTH_TOKEN__,
|
|
3070
|
+
const te = window.__AUTH_TOKEN__, ke = ((O = window.localStorage) == null ? void 0 : O.getItem(ze.authToken)) || null;
|
|
3071
3071
|
let Q = null;
|
|
3072
3072
|
try {
|
|
3073
|
-
const ge = (
|
|
3074
|
-
ge && (Q = ((
|
|
3073
|
+
const ge = (F = window.localStorage) == null ? void 0 : F.getItem(ze.chatSettings);
|
|
3074
|
+
ge && (Q = ((C = JSON.parse(ge)) == null ? void 0 : C.apiKey) || null);
|
|
3075
3075
|
} catch {
|
|
3076
3076
|
}
|
|
3077
|
-
const Z = te ||
|
|
3077
|
+
const Z = te || ke || Q || null;
|
|
3078
3078
|
Z && (z = { Authorization: `Bearer ${Z}` });
|
|
3079
3079
|
}
|
|
3080
3080
|
} catch {
|
|
@@ -3083,26 +3083,26 @@ function pr(e = {}) {
|
|
|
3083
3083
|
let L = {};
|
|
3084
3084
|
if (typeof window < "u")
|
|
3085
3085
|
try {
|
|
3086
|
-
const G = (
|
|
3086
|
+
const G = (B = window.localStorage) == null ? void 0 : B.getItem(ze.authSessionId);
|
|
3087
3087
|
G && (L = { "X-Session-Id": G });
|
|
3088
3088
|
} catch {
|
|
3089
3089
|
}
|
|
3090
|
-
const
|
|
3090
|
+
const H = {
|
|
3091
3091
|
...z,
|
|
3092
3092
|
...L,
|
|
3093
3093
|
...s.current
|
|
3094
|
-
},
|
|
3094
|
+
}, h = {
|
|
3095
3095
|
"Content-Type": "application/json",
|
|
3096
3096
|
Accept: "text/event-stream",
|
|
3097
|
-
...
|
|
3097
|
+
...H
|
|
3098
3098
|
}, U = await fetch(t + n, {
|
|
3099
3099
|
method: "POST",
|
|
3100
|
-
headers:
|
|
3101
|
-
body: JSON.stringify(
|
|
3100
|
+
headers: h,
|
|
3101
|
+
body: JSON.stringify(b),
|
|
3102
3102
|
signal: P.signal,
|
|
3103
3103
|
credentials: a
|
|
3104
3104
|
});
|
|
3105
|
-
if (
|
|
3105
|
+
if (A.current && (A.current.headers = H), !U.ok || !U.body) {
|
|
3106
3106
|
const G = await U.text().catch(() => "");
|
|
3107
3107
|
console.debug(
|
|
3108
3108
|
"[use-chat] non-OK response",
|
|
@@ -3110,45 +3110,45 @@ function pr(e = {}) {
|
|
|
3110
3110
|
G == null ? void 0 : G.slice(0, 500)
|
|
3111
3111
|
);
|
|
3112
3112
|
const te = `stream ${U.status}${G ? ": " + G : ""}`;
|
|
3113
|
-
throw te && (
|
|
3113
|
+
throw te && (m(te), j = "error"), new Error(te);
|
|
3114
3114
|
}
|
|
3115
|
-
|
|
3115
|
+
I(!0);
|
|
3116
3116
|
const T = U.body.getReader(), J = new TextDecoder();
|
|
3117
|
-
let
|
|
3117
|
+
let K = "", q = 0, ee = Date.now();
|
|
3118
3118
|
const re = setInterval(() => {
|
|
3119
|
-
Date.now() - ee > 18e5 && (
|
|
3119
|
+
Date.now() - ee > 18e5 && (m("Stream idle timeout"), j = "error", P.abort());
|
|
3120
3120
|
}, 5e3), ue = 1024 * 1024;
|
|
3121
3121
|
try {
|
|
3122
3122
|
const G = U.headers.get("X-Thread-Id") || U.headers.get("x-thread-id"), te = U.headers.get("X-Run-Id") || U.headers.get("x-run-id");
|
|
3123
|
-
for (
|
|
3124
|
-
...
|
|
3125
|
-
threadId: G ??
|
|
3126
|
-
runId: te ??
|
|
3123
|
+
for (A.current && (A.current = {
|
|
3124
|
+
...A.current,
|
|
3125
|
+
threadId: G ?? A.current.threadId,
|
|
3126
|
+
runId: te ?? A.current.runId
|
|
3127
3127
|
}); ; ) {
|
|
3128
|
-
const { value:
|
|
3128
|
+
const { value: ke, done: Q } = await T.read();
|
|
3129
3129
|
if (Q) break;
|
|
3130
|
-
|
|
3130
|
+
K += J.decode(ke, { stream: !0 }), K.length > ue && (K = "", console.warn("Stream buffer reset: exceeded 1MB"));
|
|
3131
3131
|
let Z;
|
|
3132
|
-
for (; (Z =
|
|
3132
|
+
for (; (Z = K.indexOf(`
|
|
3133
3133
|
|
|
3134
3134
|
`)) >= 0; ) {
|
|
3135
|
-
const ge =
|
|
3136
|
-
|
|
3137
|
-
const je = ge.split(/\r?\n/),
|
|
3135
|
+
const ge = K.slice(0, Z);
|
|
3136
|
+
K = K.slice(Z + 2);
|
|
3137
|
+
const je = ge.split(/\r?\n/), Be = [];
|
|
3138
3138
|
let me = null;
|
|
3139
3139
|
for (const he of je)
|
|
3140
3140
|
if (!he.startsWith(":") && he) {
|
|
3141
3141
|
if (he.startsWith("event:")) {
|
|
3142
|
-
const
|
|
3143
|
-
|
|
3142
|
+
const xe = he.slice(6).trim();
|
|
3143
|
+
xe && (me = xe);
|
|
3144
3144
|
continue;
|
|
3145
3145
|
}
|
|
3146
3146
|
if (he.startsWith("data:")) {
|
|
3147
|
-
const
|
|
3148
|
-
|
|
3147
|
+
const xe = he.slice(5);
|
|
3148
|
+
Be.push(xe.startsWith(" ") ? xe.slice(1) : xe);
|
|
3149
3149
|
}
|
|
3150
3150
|
}
|
|
3151
|
-
const Ie =
|
|
3151
|
+
const Ie = Be.join(`
|
|
3152
3152
|
`);
|
|
3153
3153
|
if (!Ie) continue;
|
|
3154
3154
|
let oe;
|
|
@@ -3164,17 +3164,17 @@ function pr(e = {}) {
|
|
|
3164
3164
|
console.warn("[use-chat] dropped envelope event without payload", oe);
|
|
3165
3165
|
continue;
|
|
3166
3166
|
}
|
|
3167
|
-
const
|
|
3167
|
+
const Ae = $n(Pe);
|
|
3168
3168
|
ee = Date.now();
|
|
3169
|
-
const ye = typeof
|
|
3169
|
+
const ye = typeof Ae.seq == "number" ? Ae.seq : void 0;
|
|
3170
3170
|
if (ye !== void 0) {
|
|
3171
|
-
if (ye <=
|
|
3172
|
-
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: ye, lastProcessedSeq:
|
|
3171
|
+
if (ye <= q) {
|
|
3172
|
+
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: ye, lastProcessedSeq: q, type: Ae.type });
|
|
3173
3173
|
continue;
|
|
3174
3174
|
}
|
|
3175
|
-
|
|
3175
|
+
q = ye;
|
|
3176
3176
|
}
|
|
3177
|
-
|
|
3177
|
+
u(Ae);
|
|
3178
3178
|
}
|
|
3179
3179
|
}
|
|
3180
3180
|
j === null && !P.signal.aborted && (j = "complete");
|
|
@@ -3183,7 +3183,7 @@ function pr(e = {}) {
|
|
|
3183
3183
|
j = j ?? "aborted";
|
|
3184
3184
|
else {
|
|
3185
3185
|
const te = G.message || String(G);
|
|
3186
|
-
j = "error",
|
|
3186
|
+
j = "error", m(te);
|
|
3187
3187
|
}
|
|
3188
3188
|
} finally {
|
|
3189
3189
|
try {
|
|
@@ -3199,7 +3199,7 @@ function pr(e = {}) {
|
|
|
3199
3199
|
j = j ?? "aborted";
|
|
3200
3200
|
else {
|
|
3201
3201
|
const L = z.message || String(z);
|
|
3202
|
-
j = "error",
|
|
3202
|
+
j = "error", m(L), M || (M = !0, (V = e.onConnectionError) == null || V.call(e, L));
|
|
3203
3203
|
}
|
|
3204
3204
|
} finally {
|
|
3205
3205
|
try {
|
|
@@ -3216,29 +3216,29 @@ function pr(e = {}) {
|
|
|
3216
3216
|
} catch (z) {
|
|
3217
3217
|
console.warn("[use-chat] onClosed callback failed", z);
|
|
3218
3218
|
}
|
|
3219
|
-
l(!1),
|
|
3219
|
+
l(!1), I(!1), p.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 X(() => () => {
|
|
3226
|
-
var
|
|
3227
|
-
|
|
3226
|
+
var g;
|
|
3227
|
+
S.current = !1, (g = p.current) == null || g.abort();
|
|
3228
3228
|
}, []), {
|
|
3229
3229
|
isStreaming: c,
|
|
3230
|
-
error:
|
|
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:
|
|
3240
|
-
stream:
|
|
3241
|
-
stop:
|
|
3239
|
+
connected: y,
|
|
3240
|
+
stream: x,
|
|
3241
|
+
stop: w,
|
|
3242
3242
|
clear: v,
|
|
3243
3243
|
setToken: E,
|
|
3244
3244
|
values: {},
|
|
@@ -3246,10 +3246,10 @@ function pr(e = {}) {
|
|
|
3246
3246
|
interrupt: () => Promise.resolve(),
|
|
3247
3247
|
resume: () => Promise.resolve(),
|
|
3248
3248
|
goto: () => Promise.resolve(),
|
|
3249
|
-
connectionState:
|
|
3249
|
+
connectionState: d ? "error" : c ? y ? "connected" : "connecting" : "idle",
|
|
3250
3250
|
messages: [],
|
|
3251
3251
|
// useStream doesn't maintain messages, use useChatSession instead
|
|
3252
|
-
submit:
|
|
3252
|
+
submit: x
|
|
3253
3253
|
};
|
|
3254
3254
|
}
|
|
3255
3255
|
function gr({
|
|
@@ -3259,77 +3259,77 @@ function gr({
|
|
|
3259
3259
|
onThreadChange: r,
|
|
3260
3260
|
onCurrentThreadDeleted: o
|
|
3261
3261
|
}) {
|
|
3262
|
-
const [s, a] =
|
|
3262
|
+
const [s, a] = $([]), [i, u] = $(t), [c, l] = $(!1), [d, m] = $(null), y = W(i), I = W(/* @__PURE__ */ new Map());
|
|
3263
3263
|
X(() => {
|
|
3264
|
-
|
|
3264
|
+
y.current = i;
|
|
3265
3265
|
}, [i]), X(() => {
|
|
3266
|
-
t !== void 0 && t !==
|
|
3266
|
+
t !== void 0 && t !== y.current && u(t);
|
|
3267
3267
|
}, [t]);
|
|
3268
|
-
const
|
|
3269
|
-
l(!0),
|
|
3268
|
+
const f = _(async () => {
|
|
3269
|
+
l(!0), m(null);
|
|
3270
3270
|
try {
|
|
3271
3271
|
const v = await e.listThreads();
|
|
3272
3272
|
a(v ?? []);
|
|
3273
3273
|
} catch (v) {
|
|
3274
|
-
const
|
|
3275
|
-
|
|
3274
|
+
const w = String(v);
|
|
3275
|
+
m(w), n == null || n(w);
|
|
3276
3276
|
} finally {
|
|
3277
3277
|
l(!1);
|
|
3278
3278
|
}
|
|
3279
3279
|
}, [e, n]);
|
|
3280
3280
|
X(() => {
|
|
3281
|
-
|
|
3282
|
-
}, [
|
|
3281
|
+
f();
|
|
3282
|
+
}, [f]), X(() => {
|
|
3283
3283
|
r == null || r(i);
|
|
3284
3284
|
}, [i, r]);
|
|
3285
|
-
const
|
|
3286
|
-
async (v,
|
|
3285
|
+
const k = _(
|
|
3286
|
+
async (v, w) => {
|
|
3287
3287
|
try {
|
|
3288
|
-
const
|
|
3289
|
-
return
|
|
3290
|
-
} catch (
|
|
3291
|
-
const
|
|
3292
|
-
return n == null || n(
|
|
3288
|
+
const x = w && typeof w == "object" ? { id: w.id, name: w.name ?? "" } : void 0, g = await e.createThread(v, x);
|
|
3289
|
+
return u(g.threadId), await f(), g.threadId;
|
|
3290
|
+
} catch (x) {
|
|
3291
|
+
const g = String(x);
|
|
3292
|
+
return n == null || n(g), null;
|
|
3293
3293
|
}
|
|
3294
3294
|
},
|
|
3295
|
-
[e, n,
|
|
3296
|
-
),
|
|
3295
|
+
[e, n, f]
|
|
3296
|
+
), p = _(
|
|
3297
3297
|
async (v) => {
|
|
3298
|
-
const
|
|
3299
|
-
a((
|
|
3300
|
-
const
|
|
3301
|
-
|
|
3298
|
+
const w = s;
|
|
3299
|
+
a((g) => g.filter((b) => b.threadId !== v));
|
|
3300
|
+
const x = new AbortController();
|
|
3301
|
+
I.current.set(v, x);
|
|
3302
3302
|
try {
|
|
3303
|
-
await e.deleteThread(v),
|
|
3304
|
-
} catch (
|
|
3305
|
-
a(
|
|
3306
|
-
const
|
|
3307
|
-
n == null || n(
|
|
3303
|
+
await e.deleteThread(v), y.current === v && (u(null), o == null || o());
|
|
3304
|
+
} catch (g) {
|
|
3305
|
+
a(w);
|
|
3306
|
+
const b = String(g);
|
|
3307
|
+
n == null || n(b);
|
|
3308
3308
|
} finally {
|
|
3309
|
-
|
|
3309
|
+
I.current.delete(v);
|
|
3310
3310
|
}
|
|
3311
3311
|
},
|
|
3312
3312
|
[e, o, n, s]
|
|
3313
|
-
),
|
|
3314
|
-
async (v,
|
|
3313
|
+
), S = _(
|
|
3314
|
+
async (v, w) => {
|
|
3315
3315
|
try {
|
|
3316
|
-
await e.updateThread(v,
|
|
3317
|
-
} catch (
|
|
3318
|
-
n == null || n(String(
|
|
3316
|
+
await e.updateThread(v, w), await f();
|
|
3317
|
+
} catch (x) {
|
|
3318
|
+
n == null || n(String(x));
|
|
3319
3319
|
}
|
|
3320
3320
|
},
|
|
3321
|
-
[e, n,
|
|
3322
|
-
),
|
|
3321
|
+
[e, n, f]
|
|
3322
|
+
), A = Y(
|
|
3323
3323
|
() => ({
|
|
3324
|
-
createThread:
|
|
3325
|
-
deleteThread:
|
|
3326
|
-
renameThread:
|
|
3327
|
-
refreshThreads:
|
|
3324
|
+
createThread: k,
|
|
3325
|
+
deleteThread: p,
|
|
3326
|
+
renameThread: S,
|
|
3327
|
+
refreshThreads: f
|
|
3328
3328
|
}),
|
|
3329
|
-
[
|
|
3329
|
+
[k, p, S, f]
|
|
3330
3330
|
), E = _((v) => {
|
|
3331
3331
|
if (!(v != null && v.threadId)) return;
|
|
3332
|
-
const
|
|
3332
|
+
const w = {
|
|
3333
3333
|
threadId: v.threadId,
|
|
3334
3334
|
title: v.title || `Thread ${v.threadId.slice(0, 8)}`,
|
|
3335
3335
|
project: v.project,
|
|
@@ -3337,80 +3337,80 @@ function gr({
|
|
|
3337
3337
|
updatedAt: v.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
3338
3338
|
messageCount: v.messageCount ?? 1
|
|
3339
3339
|
};
|
|
3340
|
-
a((
|
|
3341
|
-
let
|
|
3342
|
-
const
|
|
3340
|
+
a((x) => {
|
|
3341
|
+
let g = !1;
|
|
3342
|
+
const b = x.map((P) => P.threadId === w.threadId ? (g = !0, console.debug("[useThreadsState] thread_info: updating existing thread", w.threadId), {
|
|
3343
3343
|
...P,
|
|
3344
|
-
title:
|
|
3345
|
-
project:
|
|
3346
|
-
updatedAt:
|
|
3347
|
-
messageCount:
|
|
3344
|
+
title: w.title ?? P.title,
|
|
3345
|
+
project: w.project ?? P.project,
|
|
3346
|
+
updatedAt: w.updatedAt ?? P.updatedAt,
|
|
3347
|
+
messageCount: w.messageCount ?? P.messageCount
|
|
3348
3348
|
}) : P);
|
|
3349
|
-
return
|
|
3349
|
+
return g ? b : (console.debug("[useThreadsState] thread_info: adding thread to list", w.threadId), [w, ...x]);
|
|
3350
3350
|
});
|
|
3351
3351
|
}, []);
|
|
3352
3352
|
return {
|
|
3353
3353
|
threads: s,
|
|
3354
3354
|
currentThreadId: i,
|
|
3355
|
-
currentThreadIdRef:
|
|
3356
|
-
setCurrentThreadId:
|
|
3355
|
+
currentThreadIdRef: y,
|
|
3356
|
+
setCurrentThreadId: u,
|
|
3357
3357
|
isLoadingThreads: c,
|
|
3358
|
-
threadsError:
|
|
3359
|
-
actions:
|
|
3358
|
+
threadsError: d,
|
|
3359
|
+
actions: A,
|
|
3360
3360
|
addThreadFromEvent: E
|
|
3361
3361
|
};
|
|
3362
3362
|
}
|
|
3363
|
-
const jt =
|
|
3363
|
+
const jt = Ce(null);
|
|
3364
3364
|
function mr({
|
|
3365
3365
|
children: e,
|
|
3366
3366
|
initialThreadId: t = null,
|
|
3367
3367
|
onError: n,
|
|
3368
3368
|
onThreadChange: r
|
|
3369
3369
|
}) {
|
|
3370
|
-
const { chatApi: o } =
|
|
3370
|
+
const { chatApi: o } = Me(), {
|
|
3371
3371
|
threads: s,
|
|
3372
3372
|
currentThreadId: a,
|
|
3373
3373
|
setCurrentThreadId: i,
|
|
3374
|
-
currentThreadIdRef:
|
|
3374
|
+
currentThreadIdRef: u,
|
|
3375
3375
|
isLoadingThreads: c,
|
|
3376
3376
|
threadsError: l,
|
|
3377
|
-
actions:
|
|
3378
|
-
addThreadFromEvent:
|
|
3377
|
+
actions: d,
|
|
3378
|
+
addThreadFromEvent: m
|
|
3379
3379
|
} = gr({
|
|
3380
3380
|
api: o,
|
|
3381
3381
|
initialThreadId: t,
|
|
3382
3382
|
onError: n,
|
|
3383
3383
|
onThreadChange: r
|
|
3384
|
-
}),
|
|
3384
|
+
}), y = Y(
|
|
3385
3385
|
() => ({
|
|
3386
3386
|
threads: s,
|
|
3387
3387
|
currentThreadId: a,
|
|
3388
3388
|
setCurrentThreadId: i,
|
|
3389
|
-
currentThreadIdRef:
|
|
3389
|
+
currentThreadIdRef: u,
|
|
3390
3390
|
isLoading: c,
|
|
3391
3391
|
error: l,
|
|
3392
|
-
actions:
|
|
3393
|
-
addThreadFromEvent:
|
|
3392
|
+
actions: d,
|
|
3393
|
+
addThreadFromEvent: m
|
|
3394
3394
|
}),
|
|
3395
3395
|
[
|
|
3396
3396
|
s,
|
|
3397
3397
|
a,
|
|
3398
3398
|
i,
|
|
3399
|
-
|
|
3399
|
+
u,
|
|
3400
3400
|
c,
|
|
3401
3401
|
l,
|
|
3402
|
-
|
|
3403
|
-
|
|
3402
|
+
d,
|
|
3403
|
+
m
|
|
3404
3404
|
]
|
|
3405
3405
|
);
|
|
3406
|
-
return /* @__PURE__ */ ie(jt.Provider, { value:
|
|
3406
|
+
return /* @__PURE__ */ ie(jt.Provider, { value: y, children: e });
|
|
3407
3407
|
}
|
|
3408
3408
|
function ot(e) {
|
|
3409
3409
|
const t = Ue(jt);
|
|
3410
3410
|
if (!t && !(e != null && e.optional)) throw new Error("useThreads must be used within a ThreadsProvider");
|
|
3411
3411
|
return t;
|
|
3412
3412
|
}
|
|
3413
|
-
function
|
|
3413
|
+
function Bt(e) {
|
|
3414
3414
|
const t = e.artifact;
|
|
3415
3415
|
return !t || typeof t != "object" ? null : "metadata" in t && t.metadata ? t.metadata : {
|
|
3416
3416
|
id: t.id ?? e.id ?? `artifact-${Date.now()}`,
|
|
@@ -3421,7 +3421,7 @@ function Ft(e) {
|
|
|
3421
3421
|
};
|
|
3422
3422
|
}
|
|
3423
3423
|
function yr(e, t) {
|
|
3424
|
-
const n =
|
|
3424
|
+
const n = Bt(e);
|
|
3425
3425
|
if (!n) return e;
|
|
3426
3426
|
const r = {
|
|
3427
3427
|
...n,
|
|
@@ -3438,25 +3438,25 @@ function yr(e, t) {
|
|
|
3438
3438
|
}
|
|
3439
3439
|
function hr(e, t, n) {
|
|
3440
3440
|
return e.find((r) => {
|
|
3441
|
-
const o =
|
|
3441
|
+
const o = Bt(r);
|
|
3442
3442
|
return !!((o == null ? void 0 : o.id) === t || n && r.toolCallId === n);
|
|
3443
3443
|
}) ?? null;
|
|
3444
3444
|
}
|
|
3445
|
-
function
|
|
3445
|
+
function Oe(e) {
|
|
3446
3446
|
return e.map((t) => nt(t)).filter((t) => !!t);
|
|
3447
3447
|
}
|
|
3448
|
-
function
|
|
3448
|
+
function Ft(e, t, n) {
|
|
3449
3449
|
return t < 0 || t >= e.length ? e : [...e.slice(0, t), n, ...e.slice(t + 1)];
|
|
3450
3450
|
}
|
|
3451
3451
|
function br(e, t, n) {
|
|
3452
3452
|
for (let r = e.length - 1; r >= 0; r--)
|
|
3453
3453
|
if (e[r].role === "assistant") {
|
|
3454
3454
|
const s = { ...e[r], checkpointId: t, checkpointNs: n ?? void 0 };
|
|
3455
|
-
return
|
|
3455
|
+
return Ft(e, r, s);
|
|
3456
3456
|
}
|
|
3457
3457
|
return e;
|
|
3458
3458
|
}
|
|
3459
|
-
const
|
|
3459
|
+
const Ot = {
|
|
3460
3460
|
status: "idle",
|
|
3461
3461
|
messages: [],
|
|
3462
3462
|
taskMessagesByScope: {},
|
|
@@ -3479,8 +3479,8 @@ function wr(e, t) {
|
|
|
3479
3479
|
};
|
|
3480
3480
|
case "reset":
|
|
3481
3481
|
return {
|
|
3482
|
-
...
|
|
3483
|
-
messages:
|
|
3482
|
+
...Ot,
|
|
3483
|
+
messages: Oe(((n = t.payload) == null ? void 0 : n.messages) ?? [])
|
|
3484
3484
|
};
|
|
3485
3485
|
case "user_message": {
|
|
3486
3486
|
const { message: r } = t.payload;
|
|
@@ -3494,7 +3494,7 @@ function wr(e, t) {
|
|
|
3494
3494
|
};
|
|
3495
3495
|
}
|
|
3496
3496
|
case "seed": {
|
|
3497
|
-
const r =
|
|
3497
|
+
const r = Oe(t.payload.messages), o = {
|
|
3498
3498
|
...e,
|
|
3499
3499
|
status: "idle",
|
|
3500
3500
|
messages: r,
|
|
@@ -3506,7 +3506,7 @@ function wr(e, t) {
|
|
|
3506
3506
|
return Object.prototype.hasOwnProperty.call(t.payload, "checkpointId") && (o.lastCheckpointId = t.payload.checkpointId ?? null), Object.prototype.hasOwnProperty.call(t.payload, "checkpointNs") && (o.lastCheckpointNs = t.payload.checkpointNs ?? null), Object.prototype.hasOwnProperty.call(t.payload, "values") && (o.values = t.payload.values ?? {}), o;
|
|
3507
3507
|
}
|
|
3508
3508
|
case "prepend": {
|
|
3509
|
-
const r =
|
|
3509
|
+
const r = Oe(t.payload.messages);
|
|
3510
3510
|
if (!r.length) return e;
|
|
3511
3511
|
const o = new Set(e.messages.map((a) => a.id)), s = r.filter((a) => !o.has(a.id));
|
|
3512
3512
|
return s.length ? { ...e, messages: [...s, ...e.messages] } : e;
|
|
@@ -3521,8 +3521,8 @@ function wr(e, t) {
|
|
|
3521
3521
|
return e;
|
|
3522
3522
|
}
|
|
3523
3523
|
}
|
|
3524
|
-
function
|
|
3525
|
-
const [t, n] = Wt(wr, { ...
|
|
3524
|
+
function kr(e = []) {
|
|
3525
|
+
const [t, n] = Wt(wr, { ...Ot, messages: e }), r = W([]), o = W(null), s = _(() => {
|
|
3526
3526
|
o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), o.current = null;
|
|
3527
3527
|
const c = r.current;
|
|
3528
3528
|
c.length && (r.current = [], n({ type: "batch", payload: { events: c } }));
|
|
@@ -3530,14 +3530,14 @@ function vr(e = []) {
|
|
|
3530
3530
|
typeof window < "u" && typeof window.requestAnimationFrame == "function" ? o.current === null && (o.current = window.requestAnimationFrame(() => s())) : setTimeout(s, 8);
|
|
3531
3531
|
}, [s]), i = _((c) => {
|
|
3532
3532
|
r.current.push(c), a();
|
|
3533
|
-
}, [a]),
|
|
3533
|
+
}, [a]), u = Y(() => ({
|
|
3534
3534
|
setStatus: (c, l) => n({ type: "status", payload: { status: c, error: l } }),
|
|
3535
3535
|
reset: (c) => n({ type: "reset", payload: { messages: c } }),
|
|
3536
3536
|
seed: (c, l) => n({ type: "seed", payload: { messages: c, ...l ?? {} } }),
|
|
3537
3537
|
pushUser: (c, l) => n({ type: "user_message", payload: { message: c, editingMessageId: l } }),
|
|
3538
3538
|
onEvent: i
|
|
3539
3539
|
}), [i]);
|
|
3540
|
-
return { state: t, dispatch: n, ...
|
|
3540
|
+
return { state: t, dispatch: n, ...u };
|
|
3541
3541
|
}
|
|
3542
3542
|
function pt(e, t) {
|
|
3543
3543
|
const n = t.origin, r = t.scope, o = n === "task" || typeof r == "string" && r.startsWith("tools:");
|
|
@@ -3570,31 +3570,33 @@ function pt(e, t) {
|
|
|
3570
3570
|
return { ...e, status: "error", error: t.message, messages: [...e.messages, s] };
|
|
3571
3571
|
}
|
|
3572
3572
|
if (t.type === "values" && "messages" in t && Array.isArray(t.messages)) {
|
|
3573
|
-
const s = t, a = Array.isArray(s.messages) ? s.messages : [], i =
|
|
3573
|
+
const s = t, a = Array.isArray(s.messages) ? s.messages : [], i = Oe(a), { messages: u, ...c } = s, l = c.__interrupt__ ?? c.interrupts, d = Array.isArray(l) && l.length > 0 ? {
|
|
3574
3574
|
id: l[0].id || "native-interrupt",
|
|
3575
3575
|
value: l[0].value || l[0],
|
|
3576
3576
|
alternatives: l[0].alternatives
|
|
3577
3577
|
} : null;
|
|
3578
3578
|
if (o) {
|
|
3579
|
-
const
|
|
3579
|
+
const m = typeof r == "string" && r.length > 0 ? r : "task";
|
|
3580
3580
|
return {
|
|
3581
3581
|
...e,
|
|
3582
|
-
taskMessagesByScope: { ...e.taskMessagesByScope, [
|
|
3582
|
+
taskMessagesByScope: { ...e.taskMessagesByScope, [m]: i },
|
|
3583
|
+
assemblingId: null
|
|
3584
|
+
// Clear streaming state when finalized
|
|
3583
3585
|
};
|
|
3584
3586
|
}
|
|
3585
3587
|
return {
|
|
3586
3588
|
...e,
|
|
3587
|
-
status:
|
|
3589
|
+
status: d ? "awaiting_input" : e.status === "streaming" ? "idle" : e.status,
|
|
3588
3590
|
messages: i,
|
|
3589
3591
|
assemblingId: null,
|
|
3590
|
-
pendingInterrupt:
|
|
3592
|
+
pendingInterrupt: d,
|
|
3591
3593
|
values: c
|
|
3592
3594
|
};
|
|
3593
3595
|
}
|
|
3594
3596
|
if (t.type === "messages/metadata") {
|
|
3595
3597
|
const s = { ...e.messagesStreamMeta ?? {} }, a = t.metadata;
|
|
3596
|
-
return a && typeof a == "object" && Object.entries(a).forEach(([i,
|
|
3597
|
-
const c =
|
|
3598
|
+
return a && typeof a == "object" && Object.entries(a).forEach(([i, u]) => {
|
|
3599
|
+
const c = u == null ? void 0 : u.metadata;
|
|
3598
3600
|
if (!c || typeof c != "object") return;
|
|
3599
3601
|
const l = s[i] ?? {};
|
|
3600
3602
|
s[i] = {
|
|
@@ -3603,49 +3605,50 @@ function pt(e, t) {
|
|
|
3603
3605
|
};
|
|
3604
3606
|
}), { ...e, messagesStreamMeta: s };
|
|
3605
3607
|
}
|
|
3606
|
-
return t.type === "messages/partial" ?
|
|
3608
|
+
return t.type === "messages/partial" ? vr(e, t, o) : t.type === "tool.start" ? { ...Ir(e, t, o), status: "streaming" } : t.type === "tool.progress" ? Ar(e, t, o) : t.type === "tool.end" ? xr(e, t, o) : t.type === "artifact.update" ? Tr(e, t) : e;
|
|
3607
3609
|
}
|
|
3608
|
-
function
|
|
3609
|
-
var
|
|
3610
|
-
const
|
|
3611
|
-
if (!
|
|
3610
|
+
function vr(e, t, n) {
|
|
3611
|
+
var m, y, I, f, k;
|
|
3612
|
+
const r = t.messages;
|
|
3613
|
+
if (!r.length)
|
|
3612
3614
|
return console.warn("[messagesReducer] Dropping messages/partial event without messages[]", t), e;
|
|
3613
|
-
const
|
|
3614
|
-
if (!
|
|
3615
|
-
const
|
|
3616
|
-
let
|
|
3617
|
-
if (
|
|
3618
|
-
const
|
|
3619
|
-
...
|
|
3615
|
+
const o = r.find((p) => p.type === "ai" || p.type === "assistant" || p.role === "assistant");
|
|
3616
|
+
if (!o) return e;
|
|
3617
|
+
const s = o.id, a = o.content ?? "", i = typeof a == "string" ? [{ type: "text", text: a }] : Array.isArray(a) ? a.map((p) => typeof p == "string" ? { type: "text", text: p } : (p == null ? void 0 : p.type) === "text" ? { type: "text", text: typeof p.text == "string" ? p.text : p.content ?? "" } : ((p == null ? void 0 : p.type) === "reasoning", p)) : [], u = i.filter((p) => p.type === "text").map((p) => p.text).join(""), c = e.assemblingId !== s, l = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3618
|
+
let d = n ? [...e.taskMessagesByScope[l] || []] : [...e.messages];
|
|
3619
|
+
if (c) {
|
|
3620
|
+
const p = nt({
|
|
3621
|
+
...o,
|
|
3620
3622
|
role: "assistant",
|
|
3621
|
-
content:
|
|
3623
|
+
content: i,
|
|
3622
3624
|
scope: t.scope,
|
|
3623
3625
|
origin: t.origin
|
|
3624
3626
|
});
|
|
3625
|
-
|
|
3627
|
+
p && d.push(p);
|
|
3626
3628
|
} else {
|
|
3627
|
-
const
|
|
3628
|
-
if (
|
|
3629
|
-
const
|
|
3630
|
-
|
|
3631
|
-
...
|
|
3632
|
-
content:
|
|
3633
|
-
scope: t.scope ??
|
|
3634
|
-
origin: t.origin ??
|
|
3629
|
+
const p = d.findIndex((S) => S.id === s);
|
|
3630
|
+
if (p !== -1) {
|
|
3631
|
+
const S = d[p];
|
|
3632
|
+
d[p] = {
|
|
3633
|
+
...S,
|
|
3634
|
+
content: i,
|
|
3635
|
+
scope: t.scope ?? S.scope,
|
|
3636
|
+
origin: t.origin ?? S.origin
|
|
3635
3637
|
};
|
|
3636
3638
|
}
|
|
3637
3639
|
}
|
|
3638
3640
|
return {
|
|
3639
3641
|
...e,
|
|
3640
3642
|
status: "streaming",
|
|
3641
|
-
messages:
|
|
3642
|
-
|
|
3643
|
+
messages: n ? e.messages : d,
|
|
3644
|
+
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [l]: d } : e.taskMessagesByScope,
|
|
3645
|
+
assemblingId: s,
|
|
3643
3646
|
messagesStreamMeta: {
|
|
3644
3647
|
...e.messagesStreamMeta ?? {},
|
|
3645
|
-
[
|
|
3646
|
-
...((
|
|
3647
|
-
lastSeq: t.seq ?? ((
|
|
3648
|
-
lastText:
|
|
3648
|
+
[s]: {
|
|
3649
|
+
...((m = e.messagesStreamMeta) == null ? void 0 : m[s]) ?? {},
|
|
3650
|
+
lastSeq: t.seq ?? ((I = (y = e.messagesStreamMeta) == null ? void 0 : y[s]) == null ? void 0 : I.lastSeq) ?? null,
|
|
3651
|
+
lastText: u || (((k = (f = e.messagesStreamMeta) == null ? void 0 : f[s]) == null ? void 0 : k.lastText) ?? "")
|
|
3649
3652
|
}
|
|
3650
3653
|
}
|
|
3651
3654
|
};
|
|
@@ -3660,21 +3663,21 @@ function st(e, t) {
|
|
|
3660
3663
|
}
|
|
3661
3664
|
return -1;
|
|
3662
3665
|
}
|
|
3663
|
-
function Ir(e, t) {
|
|
3664
|
-
const
|
|
3665
|
-
if (!
|
|
3666
|
-
const
|
|
3667
|
-
let
|
|
3668
|
-
if (
|
|
3669
|
-
for (let
|
|
3670
|
-
if (
|
|
3671
|
-
|
|
3666
|
+
function Ir(e, t, n) {
|
|
3667
|
+
const r = t.id || t.callId;
|
|
3668
|
+
if (!r) return e;
|
|
3669
|
+
const o = t.name || "tool", s = `Starting ${o}...`, a = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3670
|
+
let i = n ? [...e.taskMessagesByScope[a] || []] : [...e.messages], u = st(i, r);
|
|
3671
|
+
if (u === -1) {
|
|
3672
|
+
for (let c = i.length - 1; c >= 0; c--)
|
|
3673
|
+
if (i[c].role === "assistant") {
|
|
3674
|
+
u = c;
|
|
3672
3675
|
break;
|
|
3673
3676
|
}
|
|
3674
3677
|
}
|
|
3675
|
-
if (
|
|
3676
|
-
const
|
|
3677
|
-
id: `assistant-${
|
|
3678
|
+
if (u === -1) {
|
|
3679
|
+
const c = {
|
|
3680
|
+
id: `assistant-${r}`,
|
|
3678
3681
|
role: "assistant",
|
|
3679
3682
|
content: [{ type: "text", text: "" }],
|
|
3680
3683
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -3682,76 +3685,90 @@ function Ir(e, t) {
|
|
|
3682
3685
|
scope: t.scope,
|
|
3683
3686
|
origin: t.origin
|
|
3684
3687
|
};
|
|
3685
|
-
|
|
3688
|
+
i.push(c), u = i.length - 1;
|
|
3686
3689
|
}
|
|
3687
|
-
if (
|
|
3688
|
-
const
|
|
3689
|
-
|
|
3690
|
-
id:
|
|
3691
|
-
name:
|
|
3690
|
+
if (u !== -1) {
|
|
3691
|
+
const c = i[u], l = [...c.toolCalls || []], d = l.findIndex((m) => m.id === r);
|
|
3692
|
+
d >= 0 ? l[d] = { ...l[d], status: "running", content: s } : l.push({
|
|
3693
|
+
id: r,
|
|
3694
|
+
name: o,
|
|
3692
3695
|
args: t.args || {},
|
|
3693
3696
|
status: "running",
|
|
3694
|
-
content:
|
|
3695
|
-
}),
|
|
3696
|
-
...
|
|
3697
|
-
toolCalls:
|
|
3698
|
-
scope: t.scope ??
|
|
3699
|
-
origin: t.origin ??
|
|
3697
|
+
content: s
|
|
3698
|
+
}), i[u] = {
|
|
3699
|
+
...c,
|
|
3700
|
+
toolCalls: l,
|
|
3701
|
+
scope: t.scope ?? c.scope,
|
|
3702
|
+
origin: t.origin ?? c.origin
|
|
3700
3703
|
};
|
|
3701
3704
|
}
|
|
3702
|
-
return {
|
|
3705
|
+
return {
|
|
3706
|
+
...e,
|
|
3707
|
+
messages: n ? e.messages : i,
|
|
3708
|
+
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [a]: i } : e.taskMessagesByScope
|
|
3709
|
+
};
|
|
3703
3710
|
}
|
|
3704
|
-
function
|
|
3705
|
-
const
|
|
3706
|
-
if (!
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3711
|
+
function Ar(e, t, n) {
|
|
3712
|
+
const r = t.id;
|
|
3713
|
+
if (!r) return e;
|
|
3714
|
+
const o = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3715
|
+
let s = n ? [...e.taskMessagesByScope[o] || []] : [...e.messages];
|
|
3716
|
+
const a = st(s, r);
|
|
3717
|
+
if (a !== -1) {
|
|
3718
|
+
const i = s[a], u = ce(t.content), c = (i.toolCalls || []).map(
|
|
3719
|
+
(l) => l.id === r ? { ...l, content: typeof u == "string" ? u : l.content } : l
|
|
3712
3720
|
);
|
|
3713
|
-
|
|
3714
|
-
...
|
|
3715
|
-
toolCalls:
|
|
3716
|
-
scope: t.scope ??
|
|
3717
|
-
origin: t.origin ??
|
|
3721
|
+
s[a] = {
|
|
3722
|
+
...i,
|
|
3723
|
+
toolCalls: c,
|
|
3724
|
+
scope: t.scope ?? i.scope,
|
|
3725
|
+
origin: t.origin ?? i.origin
|
|
3718
3726
|
};
|
|
3719
3727
|
}
|
|
3720
|
-
return {
|
|
3728
|
+
return {
|
|
3729
|
+
...e,
|
|
3730
|
+
messages: n ? e.messages : s,
|
|
3731
|
+
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [o]: s } : e.taskMessagesByScope
|
|
3732
|
+
};
|
|
3721
3733
|
}
|
|
3722
|
-
function
|
|
3723
|
-
const
|
|
3724
|
-
if (!
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3734
|
+
function xr(e, t, n) {
|
|
3735
|
+
const r = t.id;
|
|
3736
|
+
if (!r) return e;
|
|
3737
|
+
const o = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3738
|
+
let s = n ? [...e.taskMessagesByScope[o] || []] : [...e.messages];
|
|
3739
|
+
const a = st(s, r), i = ce(t.content ?? t.error);
|
|
3740
|
+
if (a !== -1) {
|
|
3741
|
+
const c = s[a], l = (c.toolCalls || []).map(
|
|
3742
|
+
(d) => d.id === r ? {
|
|
3743
|
+
...d,
|
|
3731
3744
|
status: t.error ? "failed" : "completed",
|
|
3732
|
-
content: typeof
|
|
3745
|
+
content: typeof i == "string" ? i : d.content,
|
|
3733
3746
|
artifact: t.artifact
|
|
3734
|
-
} :
|
|
3747
|
+
} : d
|
|
3735
3748
|
);
|
|
3736
|
-
|
|
3737
|
-
...
|
|
3738
|
-
toolCalls:
|
|
3739
|
-
scope: t.scope ??
|
|
3740
|
-
origin: t.origin ??
|
|
3749
|
+
s[a] = {
|
|
3750
|
+
...c,
|
|
3751
|
+
toolCalls: l,
|
|
3752
|
+
scope: t.scope ?? c.scope,
|
|
3753
|
+
origin: t.origin ?? c.origin
|
|
3741
3754
|
};
|
|
3742
3755
|
}
|
|
3743
|
-
const
|
|
3744
|
-
id: `tool-${
|
|
3756
|
+
const u = {
|
|
3757
|
+
id: `tool-${r}`,
|
|
3745
3758
|
role: "tool",
|
|
3746
3759
|
name: t.name,
|
|
3747
|
-
content: [{ type: "text", text: typeof
|
|
3760
|
+
content: [{ type: "text", text: typeof i == "string" ? i : "" }],
|
|
3748
3761
|
artifact: t.artifact,
|
|
3749
|
-
toolCallId:
|
|
3762
|
+
toolCallId: r,
|
|
3750
3763
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3751
3764
|
scope: t.scope,
|
|
3752
3765
|
origin: t.origin
|
|
3753
3766
|
};
|
|
3754
|
-
return
|
|
3767
|
+
return s.push(u), {
|
|
3768
|
+
...e,
|
|
3769
|
+
messages: n ? e.messages : s,
|
|
3770
|
+
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [o]: s } : e.taskMessagesByScope
|
|
3771
|
+
};
|
|
3755
3772
|
}
|
|
3756
3773
|
function Tr(e, t) {
|
|
3757
3774
|
const n = t.artifactId, r = hr(e.messages, n, t.callId);
|
|
@@ -3761,13 +3778,13 @@ function Tr(e, t) {
|
|
|
3761
3778
|
progress: t.progress,
|
|
3762
3779
|
error: t.error
|
|
3763
3780
|
});
|
|
3764
|
-
return t.partial_data && s.artifact && (s.artifact = { ...s.artifact, ...t.partial_data }), { ...e, messages:
|
|
3781
|
+
return t.partial_data && s.artifact && (s.artifact = { ...s.artifact, ...t.partial_data }), { ...e, messages: Ft(e.messages, o, s) };
|
|
3765
3782
|
}
|
|
3766
3783
|
function Re(e) {
|
|
3767
3784
|
if (!(!e || typeof e != "object" || Array.isArray(e)))
|
|
3768
3785
|
return { ...e };
|
|
3769
3786
|
}
|
|
3770
|
-
function
|
|
3787
|
+
function Fe(e, t) {
|
|
3771
3788
|
if (e)
|
|
3772
3789
|
for (const n of t) {
|
|
3773
3790
|
const r = e[n];
|
|
@@ -3789,20 +3806,20 @@ function gt(e) {
|
|
|
3789
3806
|
if (t)
|
|
3790
3807
|
return Re(t.configurable) ?? t;
|
|
3791
3808
|
}
|
|
3792
|
-
async function
|
|
3793
|
-
var i,
|
|
3809
|
+
async function Mr(e, t) {
|
|
3810
|
+
var i, u;
|
|
3794
3811
|
if (!e) return e ?? null;
|
|
3795
3812
|
const n = le(e), r = Array.isArray(n.checkpoints) ? n.checkpoints : n.checkpoints ? Object.values(n.checkpoints) : [], o = /* @__PURE__ */ new Set();
|
|
3796
3813
|
for (const c of r) {
|
|
3797
3814
|
const l = (i = c == null ? void 0 : c.values) == null ? void 0 : i.messages;
|
|
3798
3815
|
if (Array.isArray(l))
|
|
3799
|
-
for (const
|
|
3800
|
-
const
|
|
3801
|
-
if (Array.isArray(
|
|
3802
|
-
for (const
|
|
3803
|
-
if (!
|
|
3804
|
-
const
|
|
3805
|
-
typeof
|
|
3816
|
+
for (const d of l) {
|
|
3817
|
+
const m = d == null ? void 0 : d.content;
|
|
3818
|
+
if (Array.isArray(m))
|
|
3819
|
+
for (const y of m) {
|
|
3820
|
+
if (!y || typeof y != "object" || y.type !== "image_url" && y.type !== "file") continue;
|
|
3821
|
+
const I = y.fileId || y.file_id;
|
|
3822
|
+
typeof I == "string" && I.trim() && o.add(I);
|
|
3806
3823
|
}
|
|
3807
3824
|
}
|
|
3808
3825
|
}
|
|
@@ -3811,32 +3828,32 @@ async function Cr(e, t) {
|
|
|
3811
3828
|
const s = await Promise.all(
|
|
3812
3829
|
Array.from(o).map(async (c) => {
|
|
3813
3830
|
try {
|
|
3814
|
-
const l = await t.getFileInfo(c),
|
|
3815
|
-
return [c,
|
|
3831
|
+
const l = await t.getFileInfo(c), d = le(l);
|
|
3832
|
+
return [c, d];
|
|
3816
3833
|
} catch {
|
|
3817
3834
|
return [c, null];
|
|
3818
3835
|
}
|
|
3819
3836
|
})
|
|
3820
3837
|
), a = new Map(s);
|
|
3821
3838
|
for (const c of r) {
|
|
3822
|
-
const l = (
|
|
3839
|
+
const l = (u = c == null ? void 0 : c.values) == null ? void 0 : u.messages;
|
|
3823
3840
|
if (Array.isArray(l))
|
|
3824
|
-
for (const
|
|
3825
|
-
const
|
|
3826
|
-
if (Array.isArray(
|
|
3827
|
-
for (const
|
|
3828
|
-
if (!
|
|
3829
|
-
const
|
|
3830
|
-
if (!
|
|
3831
|
-
const
|
|
3832
|
-
|
|
3841
|
+
for (const d of l) {
|
|
3842
|
+
const m = d == null ? void 0 : d.content;
|
|
3843
|
+
if (Array.isArray(m))
|
|
3844
|
+
for (const y of m) {
|
|
3845
|
+
if (!y || typeof y != "object" || y.type !== "image_url" && y.type !== "file") continue;
|
|
3846
|
+
const I = y.fileId || y.file_id;
|
|
3847
|
+
if (!I) continue;
|
|
3848
|
+
const f = a.get(I), k = (f == null ? void 0 : f.contentUrl) || (f == null ? void 0 : f.content_url);
|
|
3849
|
+
k && (y.type === "image_url" ? (y.imageUrl = y.imageUrl || {}, y.imageUrl.url = k) : y.type === "file" && (y.url = k, !y.name && (f != null && f.filename || f != null && f.name) && (y.name = (f == null ? void 0 : f.filename) || (f == null ? void 0 : f.name))));
|
|
3833
3850
|
}
|
|
3834
3851
|
}
|
|
3835
3852
|
}
|
|
3836
3853
|
return n;
|
|
3837
3854
|
}
|
|
3838
3855
|
function mt(e) {
|
|
3839
|
-
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((s, a) =>
|
|
3856
|
+
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((s, a) => Cr(le(s), a)).filter((s) => !!s)].sort((s, a) => yt(a.createdAt) - yt(s.createdAt)), o = r[0] ?? null;
|
|
3840
3857
|
return {
|
|
3841
3858
|
threadId: (e == null ? void 0 : e.threadId) ?? "",
|
|
3842
3859
|
latest: o,
|
|
@@ -3844,34 +3861,34 @@ function mt(e) {
|
|
|
3844
3861
|
interrupt: (o == null ? void 0 : o.interrupt) ?? null
|
|
3845
3862
|
};
|
|
3846
3863
|
}
|
|
3847
|
-
function
|
|
3848
|
-
var v,
|
|
3864
|
+
function Cr(e, t) {
|
|
3865
|
+
var v, w;
|
|
3849
3866
|
if (!e) return null;
|
|
3850
|
-
const n = ((v = e.values) == null ? void 0 : v.activeAgent) ?? null, r = (
|
|
3867
|
+
const n = ((v = e.values) == null ? void 0 : v.activeAgent) ?? null, r = (w = e.values) == null ? void 0 : w.messages, s = (Array.isArray(r) ? r : []).map((x) => Er(x, n)).filter((x) => !!x), a = Re(e.metadata) ?? {}, i = gt(e.config), u = Re(e.parentConfig), c = gt(u), l = Fe(i, ["checkpointId"]), d = Fe(i, ["checkpointNs"]), m = Fe(c, ["checkpointId"]), y = Re(e.config), I = Array.isArray(e.tasks) ? e.tasks.map((x) => ({ ...x })) : e.tasks ?? null, f = Array.isArray(e.next) ? [...e.next] : e.next ?? null, k = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), p = {
|
|
3851
3868
|
...a,
|
|
3852
3869
|
step: Sr(a, ["step"]) ?? 0,
|
|
3853
|
-
source:
|
|
3854
|
-
},
|
|
3855
|
-
...
|
|
3856
|
-
checkpointId:
|
|
3857
|
-
checkpointNs:
|
|
3858
|
-
})),
|
|
3870
|
+
source: Fe(a, ["source"]) ?? null
|
|
3871
|
+
}, S = s.map((x) => ({
|
|
3872
|
+
...x,
|
|
3873
|
+
checkpointId: x.checkpointId ?? l ?? null,
|
|
3874
|
+
checkpointNs: x.checkpointNs ?? d ?? null
|
|
3875
|
+
})), A = e.values, E = Array.isArray(e.interrupts) ? e.interrupts : Array.isArray(A == null ? void 0 : A.interrupts) ? A.interrupts : [];
|
|
3859
3876
|
return {
|
|
3860
3877
|
checkpointId: l ?? null,
|
|
3861
|
-
checkpointNs:
|
|
3862
|
-
createdAt:
|
|
3863
|
-
parentId:
|
|
3864
|
-
messages:
|
|
3878
|
+
checkpointNs: d ?? null,
|
|
3879
|
+
createdAt: k,
|
|
3880
|
+
parentId: m ?? null,
|
|
3881
|
+
messages: S,
|
|
3865
3882
|
interrupt: Pr(
|
|
3866
3883
|
E,
|
|
3867
3884
|
t,
|
|
3868
3885
|
l ?? null
|
|
3869
3886
|
),
|
|
3870
|
-
metadata:
|
|
3871
|
-
config:
|
|
3872
|
-
parentConfig:
|
|
3873
|
-
next:
|
|
3874
|
-
tasks:
|
|
3887
|
+
metadata: p,
|
|
3888
|
+
config: y ?? null,
|
|
3889
|
+
parentConfig: u ?? null,
|
|
3890
|
+
next: f,
|
|
3891
|
+
tasks: I,
|
|
3875
3892
|
values: e.values ?? {}
|
|
3876
3893
|
};
|
|
3877
3894
|
}
|
|
@@ -3916,33 +3933,33 @@ function Nr(e) {
|
|
|
3916
3933
|
function zr(e) {
|
|
3917
3934
|
const t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Map(), o = [];
|
|
3918
3935
|
for (let c = 0; c < e.length; c++) {
|
|
3919
|
-
const l = e[c],
|
|
3920
|
-
let
|
|
3921
|
-
const
|
|
3922
|
-
for (const
|
|
3923
|
-
|
|
3924
|
-
const
|
|
3925
|
-
id:
|
|
3926
|
-
step:
|
|
3927
|
-
source:
|
|
3936
|
+
const l = e[c], d = l.checkpointId, m = d ?? `cp-${c}`, y = l.metadata ?? {}, I = typeof y.step == "number" ? y.step : null, f = typeof y.source == "string" ? y.source : null;
|
|
3937
|
+
let k = null, p = null;
|
|
3938
|
+
const S = Array.isArray(l.messages) ? l.messages : [];
|
|
3939
|
+
for (const w of S)
|
|
3940
|
+
w.role === "user" && (p || (p = w), w.id && (k = w.id));
|
|
3941
|
+
const A = l.next && l.next.length > 0 ? String(l.next[0]) : null, E = l.parentConfig ?? null, v = {
|
|
3942
|
+
id: m,
|
|
3943
|
+
step: I,
|
|
3944
|
+
source: f,
|
|
3928
3945
|
createdAt: l.createdAt ?? null,
|
|
3929
3946
|
namespace: l.checkpointNs ?? null,
|
|
3930
3947
|
parentId: l.parentId ?? null,
|
|
3931
|
-
next:
|
|
3948
|
+
next: A,
|
|
3932
3949
|
parentConfig: E,
|
|
3933
|
-
userMessageId:
|
|
3950
|
+
userMessageId: k
|
|
3934
3951
|
};
|
|
3935
|
-
if (o.push(v),
|
|
3936
|
-
const
|
|
3937
|
-
|
|
3952
|
+
if (o.push(v), d && t.set(d, v), d && p) {
|
|
3953
|
+
const w = Nr(p);
|
|
3954
|
+
w && r.set(d, w);
|
|
3938
3955
|
}
|
|
3939
3956
|
n.push({
|
|
3940
|
-
id:
|
|
3941
|
-
messageId:
|
|
3942
|
-
step:
|
|
3943
|
-
source:
|
|
3957
|
+
id: m,
|
|
3958
|
+
messageId: k,
|
|
3959
|
+
step: I,
|
|
3960
|
+
source: f,
|
|
3944
3961
|
createdAt: l.createdAt ?? null,
|
|
3945
|
-
next:
|
|
3962
|
+
next: A,
|
|
3946
3963
|
parentConfig: E
|
|
3947
3964
|
});
|
|
3948
3965
|
}
|
|
@@ -3954,14 +3971,14 @@ function zr(e) {
|
|
|
3954
3971
|
}
|
|
3955
3972
|
for (const c of s.values()) {
|
|
3956
3973
|
if (!c.length) continue;
|
|
3957
|
-
c.sort((
|
|
3958
|
-
const
|
|
3959
|
-
return (
|
|
3974
|
+
c.sort((d, m) => {
|
|
3975
|
+
const y = d.createdAt ? Date.parse(d.createdAt) : 0;
|
|
3976
|
+
return (m.createdAt ? Date.parse(m.createdAt) : 0) - y;
|
|
3960
3977
|
});
|
|
3961
3978
|
const l = c.length;
|
|
3962
|
-
for (let
|
|
3963
|
-
const
|
|
3964
|
-
|
|
3979
|
+
for (let d = 0; d < c.length; d++) {
|
|
3980
|
+
const m = c[d];
|
|
3981
|
+
m.attemptCount = l, m.attemptIndex = d, m.isLatestAttempt = d === 0;
|
|
3965
3982
|
}
|
|
3966
3983
|
}
|
|
3967
3984
|
return {
|
|
@@ -3977,11 +3994,11 @@ function zr(e) {
|
|
|
3977
3994
|
getCheckpoint: (c) => t.get(c),
|
|
3978
3995
|
getMessageAttempts: (c) => {
|
|
3979
3996
|
const l = [];
|
|
3980
|
-
for (const
|
|
3981
|
-
|
|
3982
|
-
return l.length ? (l.sort((
|
|
3983
|
-
const
|
|
3984
|
-
return
|
|
3997
|
+
for (const d of t.values())
|
|
3998
|
+
d.userMessageId === c && l.push(d);
|
|
3999
|
+
return l.length ? (l.sort((d, m) => {
|
|
4000
|
+
const y = typeof d.attemptIndex == "number" ? d.attemptIndex : Number.MAX_SAFE_INTEGER, I = typeof m.attemptIndex == "number" ? m.attemptIndex : Number.MAX_SAFE_INTEGER;
|
|
4001
|
+
return y - I;
|
|
3985
4002
|
}), l) : [];
|
|
3986
4003
|
}
|
|
3987
4004
|
};
|
|
@@ -4016,43 +4033,43 @@ function $t({
|
|
|
4016
4033
|
isStreaming: a,
|
|
4017
4034
|
getMessages: i
|
|
4018
4035
|
}) {
|
|
4019
|
-
const [
|
|
4020
|
-
() => mt(
|
|
4021
|
-
[
|
|
4022
|
-
).checkpoints,
|
|
4036
|
+
const [u, c] = $(null), d = Y(
|
|
4037
|
+
() => mt(u),
|
|
4038
|
+
[u]
|
|
4039
|
+
).checkpoints, m = Rr(d), y = m.timeline, [I, f] = $(!1), [k, p] = $(!1), [S, A] = $(!1), [E, v] = $(null), w = W(o), x = W(null), g = W(null);
|
|
4023
4040
|
X(() => {
|
|
4024
|
-
|
|
4041
|
+
w.current = o;
|
|
4025
4042
|
}, [o]);
|
|
4026
|
-
const
|
|
4027
|
-
async (
|
|
4028
|
-
const
|
|
4029
|
-
threadId:
|
|
4030
|
-
checkpointId:
|
|
4031
|
-
checkpointNs:
|
|
4043
|
+
const b = _(
|
|
4044
|
+
async (C) => {
|
|
4045
|
+
const B = await e.getState({
|
|
4046
|
+
threadId: C.threadId,
|
|
4047
|
+
checkpointId: C.checkpointId,
|
|
4048
|
+
checkpointNs: C.checkpointNs
|
|
4032
4049
|
}), N = {
|
|
4033
4050
|
version: "values@1",
|
|
4034
|
-
threadId:
|
|
4035
|
-
checkpoints: [
|
|
4036
|
-
}, V = t ? await
|
|
4051
|
+
threadId: C.threadId,
|
|
4052
|
+
checkpoints: [B]
|
|
4053
|
+
}, V = t ? await Mr(N, t) : N, { latest: z } = mt(V);
|
|
4037
4054
|
return z;
|
|
4038
4055
|
},
|
|
4039
4056
|
[e, t]
|
|
4040
4057
|
), P = _(
|
|
4041
|
-
async (
|
|
4058
|
+
async (C, B) => {
|
|
4042
4059
|
var z;
|
|
4043
|
-
if (!
|
|
4044
|
-
const N = `${
|
|
4045
|
-
if (
|
|
4046
|
-
(z =
|
|
4060
|
+
if (!C) return;
|
|
4061
|
+
const N = `${C}:${B ?? "latest"}`;
|
|
4062
|
+
if (x.current === N || I) return;
|
|
4063
|
+
(z = g.current) == null || z.abort();
|
|
4047
4064
|
const V = new AbortController();
|
|
4048
|
-
|
|
4065
|
+
g.current = V, f(!0), v(null);
|
|
4049
4066
|
try {
|
|
4050
|
-
const L = await
|
|
4051
|
-
threadId:
|
|
4052
|
-
checkpointId:
|
|
4067
|
+
const L = await b({
|
|
4068
|
+
threadId: C,
|
|
4069
|
+
checkpointId: B ?? void 0
|
|
4053
4070
|
});
|
|
4054
|
-
if (
|
|
4055
|
-
|
|
4071
|
+
if (w.current !== C) {
|
|
4072
|
+
f(!1);
|
|
4056
4073
|
return;
|
|
4057
4074
|
}
|
|
4058
4075
|
n((L == null ? void 0 : L.messages) ?? [], {
|
|
@@ -4060,59 +4077,59 @@ function $t({
|
|
|
4060
4077
|
checkpointNs: (L == null ? void 0 : L.checkpointNs) ?? null,
|
|
4061
4078
|
pendingInterrupt: (L == null ? void 0 : L.interrupt) ?? null,
|
|
4062
4079
|
values: L == null ? void 0 : L.values
|
|
4063
|
-
}),
|
|
4080
|
+
}), x.current = N, f(!1), A(!0);
|
|
4064
4081
|
try {
|
|
4065
|
-
const
|
|
4066
|
-
threadId:
|
|
4082
|
+
const H = await e.getStateHistory({
|
|
4083
|
+
threadId: C,
|
|
4067
4084
|
limit: 100,
|
|
4068
4085
|
includeMessages: !1
|
|
4069
4086
|
});
|
|
4070
|
-
|
|
4087
|
+
w.current === C && c(H);
|
|
4071
4088
|
} finally {
|
|
4072
|
-
|
|
4089
|
+
A(!1);
|
|
4073
4090
|
}
|
|
4074
4091
|
} catch (L) {
|
|
4075
|
-
if (
|
|
4076
|
-
const
|
|
4077
|
-
v(
|
|
4092
|
+
if (f(!1), !Xt(L)) {
|
|
4093
|
+
const H = String(L);
|
|
4094
|
+
v(H), r == null || r(H);
|
|
4078
4095
|
}
|
|
4079
4096
|
}
|
|
4080
4097
|
},
|
|
4081
|
-
[e, n,
|
|
4098
|
+
[e, n, b, r, i]
|
|
4082
4099
|
), j = _(
|
|
4083
|
-
async (
|
|
4100
|
+
async (C, B) => {
|
|
4084
4101
|
if (o) {
|
|
4085
|
-
|
|
4102
|
+
p(!0);
|
|
4086
4103
|
try {
|
|
4087
|
-
const N = await
|
|
4104
|
+
const N = await b({
|
|
4088
4105
|
threadId: o,
|
|
4089
|
-
checkpointId:
|
|
4090
|
-
checkpointNs:
|
|
4106
|
+
checkpointId: C,
|
|
4107
|
+
checkpointNs: B ?? void 0
|
|
4091
4108
|
});
|
|
4092
4109
|
n((N == null ? void 0 : N.messages) ?? [], {
|
|
4093
|
-
checkpointId: (N == null ? void 0 : N.checkpointId) ??
|
|
4094
|
-
checkpointNs: (N == null ? void 0 : N.checkpointNs) ??
|
|
4110
|
+
checkpointId: (N == null ? void 0 : N.checkpointId) ?? C,
|
|
4111
|
+
checkpointNs: (N == null ? void 0 : N.checkpointNs) ?? B,
|
|
4095
4112
|
pendingInterrupt: (N == null ? void 0 : N.interrupt) ?? null,
|
|
4096
4113
|
values: N == null ? void 0 : N.values
|
|
4097
4114
|
});
|
|
4098
4115
|
} catch (N) {
|
|
4099
4116
|
console.error("[useThreadHistoryState] Navigation failed", N);
|
|
4100
4117
|
} finally {
|
|
4101
|
-
|
|
4118
|
+
p(!1);
|
|
4102
4119
|
}
|
|
4103
4120
|
}
|
|
4104
4121
|
},
|
|
4105
|
-
[o,
|
|
4106
|
-
),
|
|
4122
|
+
[o, b, n]
|
|
4123
|
+
), M = _(async () => {
|
|
4107
4124
|
o && await P(o);
|
|
4108
4125
|
}, [o, P]), O = _(
|
|
4109
|
-
async (
|
|
4126
|
+
async (C) => {
|
|
4110
4127
|
var V;
|
|
4111
|
-
const
|
|
4112
|
-
if (!
|
|
4113
|
-
if (c(
|
|
4114
|
-
const z = await
|
|
4115
|
-
threadId:
|
|
4128
|
+
const B = (C == null ? void 0 : C.threadId) || o;
|
|
4129
|
+
if (!B || o !== B) return;
|
|
4130
|
+
if (c(C), x.current = `${B}:latest`, (V = C.values) != null && V.messages) {
|
|
4131
|
+
const z = await b({
|
|
4132
|
+
threadId: B
|
|
4116
4133
|
});
|
|
4117
4134
|
z && n(z.messages ?? [], {
|
|
4118
4135
|
checkpointId: z.checkpointId ?? null,
|
|
@@ -4122,41 +4139,41 @@ function $t({
|
|
|
4122
4139
|
});
|
|
4123
4140
|
}
|
|
4124
4141
|
},
|
|
4125
|
-
[o,
|
|
4142
|
+
[o, b, n]
|
|
4126
4143
|
);
|
|
4127
4144
|
X(() => {
|
|
4128
|
-
if (!s || !o ||
|
|
4129
|
-
const
|
|
4130
|
-
|
|
4131
|
-
}, [s, o,
|
|
4132
|
-
const
|
|
4133
|
-
c(null),
|
|
4145
|
+
if (!s || !o || I || a) return;
|
|
4146
|
+
const C = `${o}:latest`;
|
|
4147
|
+
x.current !== C && P(o);
|
|
4148
|
+
}, [s, o, I, a, P]);
|
|
4149
|
+
const F = _(() => {
|
|
4150
|
+
c(null), f(!1), p(!1), A(!1), v(null), x.current = null;
|
|
4134
4151
|
}, []);
|
|
4135
4152
|
return {
|
|
4136
|
-
threadCheckpoints:
|
|
4137
|
-
threadTimeline:
|
|
4138
|
-
checkpointIndex:
|
|
4139
|
-
isLoadingThread:
|
|
4140
|
-
isLoadingCheckpoint:
|
|
4141
|
-
isLoadingHistory:
|
|
4153
|
+
threadCheckpoints: d,
|
|
4154
|
+
threadTimeline: y,
|
|
4155
|
+
checkpointIndex: m,
|
|
4156
|
+
isLoadingThread: I,
|
|
4157
|
+
isLoadingCheckpoint: k,
|
|
4158
|
+
isLoadingHistory: S,
|
|
4142
4159
|
threadStateError: E,
|
|
4143
4160
|
loadThread: P,
|
|
4144
4161
|
navigateToCheckpoint: j,
|
|
4145
|
-
setCurrentCheckpointId: (
|
|
4146
|
-
n(i(), { checkpointId:
|
|
4162
|
+
setCurrentCheckpointId: (C, B) => {
|
|
4163
|
+
n(i(), { checkpointId: C, checkpointNs: B });
|
|
4147
4164
|
},
|
|
4148
|
-
returnToLatest:
|
|
4165
|
+
returnToLatest: M,
|
|
4149
4166
|
handleValuesEvent: O,
|
|
4150
4167
|
markSkipNextLoad: () => {
|
|
4151
4168
|
},
|
|
4152
4169
|
markStreamPendingThread: () => {
|
|
4153
4170
|
},
|
|
4154
|
-
resetHistoryState:
|
|
4155
|
-
clearState:
|
|
4171
|
+
resetHistoryState: F,
|
|
4172
|
+
clearState: F
|
|
4156
4173
|
};
|
|
4157
4174
|
}
|
|
4158
|
-
const Dt =
|
|
4159
|
-
function
|
|
4175
|
+
const Dt = Ce(null), Vt = Ce(null);
|
|
4176
|
+
function Kt(e) {
|
|
4160
4177
|
const t = Ue(Dt);
|
|
4161
4178
|
if (!t && !(e != null && e.optional)) throw new Error("useThreadState must be used within a ThreadStateProvider");
|
|
4162
4179
|
return t;
|
|
@@ -4176,26 +4193,26 @@ function Ur({
|
|
|
4176
4193
|
isStreaming: s,
|
|
4177
4194
|
onError: a
|
|
4178
4195
|
}) {
|
|
4179
|
-
const { chatApi: i, fileApi:
|
|
4180
|
-
threadCheckpoints:
|
|
4181
|
-
threadTimeline:
|
|
4182
|
-
checkpointIndex:
|
|
4183
|
-
isLoadingThread:
|
|
4184
|
-
isLoadingCheckpoint:
|
|
4185
|
-
isLoadingHistory:
|
|
4196
|
+
const { chatApi: i, fileApi: u } = Me(), { currentThreadId: c } = ot(), { state: l, seed: d, onEvent: m, dispatch: y } = kr(), {
|
|
4197
|
+
threadCheckpoints: I,
|
|
4198
|
+
threadTimeline: f,
|
|
4199
|
+
checkpointIndex: k,
|
|
4200
|
+
isLoadingThread: p,
|
|
4201
|
+
isLoadingCheckpoint: S,
|
|
4202
|
+
isLoadingHistory: A,
|
|
4186
4203
|
threadStateError: E,
|
|
4187
4204
|
loadThread: v,
|
|
4188
|
-
navigateToCheckpoint:
|
|
4189
|
-
setCurrentCheckpointId:
|
|
4190
|
-
returnToLatest:
|
|
4191
|
-
handleValuesEvent:
|
|
4205
|
+
navigateToCheckpoint: w,
|
|
4206
|
+
setCurrentCheckpointId: x,
|
|
4207
|
+
returnToLatest: g,
|
|
4208
|
+
handleValuesEvent: b,
|
|
4192
4209
|
markSkipNextLoad: P,
|
|
4193
4210
|
markStreamPendingThread: j,
|
|
4194
|
-
resetHistoryState:
|
|
4211
|
+
resetHistoryState: M
|
|
4195
4212
|
} = $t({
|
|
4196
4213
|
api: i,
|
|
4197
|
-
fileApi:
|
|
4198
|
-
seed:
|
|
4214
|
+
fileApi: u,
|
|
4215
|
+
seed: d,
|
|
4199
4216
|
onError: a,
|
|
4200
4217
|
currentThreadId: c,
|
|
4201
4218
|
initialThreadId: t,
|
|
@@ -4204,33 +4221,33 @@ function Ur({
|
|
|
4204
4221
|
autoLoadInitial: o,
|
|
4205
4222
|
isStreaming: s,
|
|
4206
4223
|
getMessages: _(() => l.messages, [l.messages])
|
|
4207
|
-
}), O = W(null),
|
|
4224
|
+
}), O = W(null), F = _(
|
|
4208
4225
|
(T) => {
|
|
4209
4226
|
O.current = T;
|
|
4210
4227
|
},
|
|
4211
4228
|
[]
|
|
4212
|
-
),
|
|
4229
|
+
), C = W(null), B = _(
|
|
4213
4230
|
(T) => {
|
|
4214
|
-
|
|
4231
|
+
C.current = T;
|
|
4215
4232
|
},
|
|
4216
4233
|
[]
|
|
4217
4234
|
), N = Y(() => ({ assemblingMessageId: l.assemblingId ?? null }), [l.assemblingId]), V = _(
|
|
4218
4235
|
(T, J) => {
|
|
4219
|
-
const
|
|
4220
|
-
return
|
|
4236
|
+
const K = Ut(T, "user");
|
|
4237
|
+
return y({
|
|
4221
4238
|
type: "user_message",
|
|
4222
4239
|
payload: {
|
|
4223
|
-
message:
|
|
4240
|
+
message: K,
|
|
4224
4241
|
editingMessageId: J == null ? void 0 : J.editingMessageId
|
|
4225
4242
|
}
|
|
4226
|
-
}),
|
|
4243
|
+
}), K;
|
|
4227
4244
|
},
|
|
4228
|
-
[
|
|
4245
|
+
[y]
|
|
4229
4246
|
), z = _(async () => {
|
|
4230
|
-
O.current ? await O.current() : (
|
|
4231
|
-
}, [
|
|
4247
|
+
O.current ? await O.current() : (d([], {}), M());
|
|
4248
|
+
}, [d, M]), L = _(async (T, J, K) => {
|
|
4232
4249
|
await v(T, J, { clearProgress: !1 });
|
|
4233
|
-
}, [v]),
|
|
4250
|
+
}, [v]), H = Y(() => Bn(l.messages), [l.messages]), h = Y(
|
|
4234
4251
|
() => ({
|
|
4235
4252
|
status: l.status,
|
|
4236
4253
|
threadId: c,
|
|
@@ -4241,20 +4258,20 @@ function Ur({
|
|
|
4241
4258
|
id: l.lastCheckpointId ?? null,
|
|
4242
4259
|
namespace: l.lastCheckpointNs ?? null
|
|
4243
4260
|
},
|
|
4244
|
-
checkpoints:
|
|
4245
|
-
checkpointIndex:
|
|
4246
|
-
timelineCheckpoints:
|
|
4261
|
+
checkpoints: I,
|
|
4262
|
+
checkpointIndex: k,
|
|
4263
|
+
timelineCheckpoints: f,
|
|
4247
4264
|
metadata: N,
|
|
4248
4265
|
values: l.values ?? {},
|
|
4249
|
-
isLoading:
|
|
4250
|
-
isLoadingCheckpoint:
|
|
4251
|
-
isLoadingHistory:
|
|
4266
|
+
isLoading: p,
|
|
4267
|
+
isLoadingCheckpoint: S,
|
|
4268
|
+
isLoadingHistory: A,
|
|
4252
4269
|
error: E,
|
|
4253
4270
|
loadOlder: async () => {
|
|
4254
4271
|
},
|
|
4255
4272
|
// Placeholder
|
|
4256
4273
|
seedFromSnapshot: (T) => {
|
|
4257
|
-
|
|
4274
|
+
d(T.messages, {
|
|
4258
4275
|
checkpointId: T.checkpointId,
|
|
4259
4276
|
checkpointNs: T.checkpointNs,
|
|
4260
4277
|
pendingInterrupt: T.interrupt,
|
|
@@ -4262,22 +4279,22 @@ function Ur({
|
|
|
4262
4279
|
});
|
|
4263
4280
|
},
|
|
4264
4281
|
clearState: z,
|
|
4265
|
-
navigateToCheckpoint:
|
|
4266
|
-
setCurrentCheckpointId:
|
|
4267
|
-
returnToLatest:
|
|
4282
|
+
navigateToCheckpoint: w,
|
|
4283
|
+
setCurrentCheckpointId: x,
|
|
4284
|
+
returnToLatest: g,
|
|
4268
4285
|
loadThread: L,
|
|
4269
4286
|
clearThread: z,
|
|
4270
|
-
respondToInterrupt: async (T, J,
|
|
4271
|
-
|
|
4287
|
+
respondToInterrupt: async (T, J, K) => {
|
|
4288
|
+
C.current && await C.current(T, J, K);
|
|
4272
4289
|
},
|
|
4273
|
-
messagePreviews:
|
|
4274
|
-
handleValuesEvent:
|
|
4290
|
+
messagePreviews: k.messagePreviews,
|
|
4291
|
+
handleValuesEvent: b,
|
|
4275
4292
|
markSkipNextLoad: P,
|
|
4276
4293
|
markStreamPendingThread: j,
|
|
4277
|
-
resetHistoryState:
|
|
4294
|
+
resetHistoryState: M,
|
|
4278
4295
|
pushUser: V,
|
|
4279
|
-
onEvent:
|
|
4280
|
-
artifacts:
|
|
4296
|
+
onEvent: m,
|
|
4297
|
+
artifacts: H
|
|
4281
4298
|
}),
|
|
4282
4299
|
[
|
|
4283
4300
|
c,
|
|
@@ -4287,38 +4304,38 @@ function Ur({
|
|
|
4287
4304
|
l.lastCheckpointId,
|
|
4288
4305
|
l.lastCheckpointNs,
|
|
4289
4306
|
l.values,
|
|
4307
|
+
I,
|
|
4308
|
+
f,
|
|
4290
4309
|
k,
|
|
4291
|
-
u,
|
|
4292
|
-
w,
|
|
4293
4310
|
N,
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4311
|
+
p,
|
|
4312
|
+
S,
|
|
4313
|
+
A,
|
|
4297
4314
|
E,
|
|
4298
|
-
|
|
4315
|
+
d,
|
|
4299
4316
|
z,
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4317
|
+
w,
|
|
4318
|
+
x,
|
|
4319
|
+
g,
|
|
4303
4320
|
L,
|
|
4304
|
-
|
|
4321
|
+
b,
|
|
4305
4322
|
P,
|
|
4306
4323
|
j,
|
|
4307
4324
|
V,
|
|
4308
|
-
|
|
4309
|
-
|
|
4325
|
+
m,
|
|
4326
|
+
H
|
|
4310
4327
|
]
|
|
4311
4328
|
), U = Y(
|
|
4312
4329
|
() => ({
|
|
4313
|
-
registerClearThread:
|
|
4314
|
-
registerRespondToInterrupt:
|
|
4330
|
+
registerClearThread: F,
|
|
4331
|
+
registerRespondToInterrupt: B
|
|
4315
4332
|
}),
|
|
4316
|
-
[
|
|
4333
|
+
[F, B]
|
|
4317
4334
|
);
|
|
4318
|
-
return /* @__PURE__ */ ie(Vt.Provider, { value: U, children: /* @__PURE__ */ ie(Dt.Provider, { value:
|
|
4335
|
+
return /* @__PURE__ */ ie(Vt.Provider, { value: U, children: /* @__PURE__ */ ie(Dt.Provider, { value: h, children: e }) });
|
|
4319
4336
|
}
|
|
4320
|
-
const
|
|
4321
|
-
function
|
|
4337
|
+
const qt = Ce(null), jr = Ce(!1);
|
|
4338
|
+
function Br({
|
|
4322
4339
|
children: e,
|
|
4323
4340
|
onError: t,
|
|
4324
4341
|
onAuthError: n,
|
|
@@ -4327,71 +4344,71 @@ function Fr({
|
|
|
4327
4344
|
onUpdateEvent: s,
|
|
4328
4345
|
onCustomEvent: a,
|
|
4329
4346
|
onMetadataEvent: i,
|
|
4330
|
-
onFinish:
|
|
4347
|
+
onFinish: u,
|
|
4331
4348
|
onStreamingChange: c
|
|
4332
4349
|
}) {
|
|
4333
|
-
const { chatApi: l, baseUrl:
|
|
4350
|
+
const { chatApi: l, baseUrl: d } = Me(), m = d, y = fe(t), I = fe(n), f = fe(r), k = fe(o), p = fe(s), S = fe(a), A = fe(i), E = fe(u), v = fe(c), w = Y(
|
|
4334
4351
|
() => ({
|
|
4335
|
-
onError:
|
|
4336
|
-
onAuthError:
|
|
4337
|
-
onConnectionError:
|
|
4338
|
-
onMetadataEvent:
|
|
4339
|
-
onCustomEvent:
|
|
4340
|
-
onUpdateEvent:
|
|
4341
|
-
onToolEnd:
|
|
4352
|
+
onError: y,
|
|
4353
|
+
onAuthError: I,
|
|
4354
|
+
onConnectionError: f,
|
|
4355
|
+
onMetadataEvent: A,
|
|
4356
|
+
onCustomEvent: S,
|
|
4357
|
+
onUpdateEvent: p,
|
|
4358
|
+
onToolEnd: k,
|
|
4342
4359
|
onFinish: E
|
|
4343
4360
|
}),
|
|
4344
4361
|
[
|
|
4345
|
-
|
|
4346
|
-
k,
|
|
4347
|
-
u,
|
|
4348
|
-
x,
|
|
4349
|
-
C,
|
|
4362
|
+
y,
|
|
4350
4363
|
I,
|
|
4351
|
-
|
|
4364
|
+
f,
|
|
4365
|
+
A,
|
|
4366
|
+
S,
|
|
4367
|
+
p,
|
|
4368
|
+
k,
|
|
4352
4369
|
E
|
|
4353
4370
|
]
|
|
4354
4371
|
);
|
|
4355
4372
|
return /* @__PURE__ */ ie(jr.Provider, { value: !0, children: /* @__PURE__ */ ie(
|
|
4356
|
-
|
|
4373
|
+
Fr,
|
|
4357
4374
|
{
|
|
4358
4375
|
api: l,
|
|
4359
|
-
streamBaseUrl:
|
|
4360
|
-
handlers:
|
|
4376
|
+
streamBaseUrl: m,
|
|
4377
|
+
handlers: w,
|
|
4361
4378
|
onStreamingChange: v,
|
|
4362
4379
|
children: e
|
|
4363
4380
|
}
|
|
4364
4381
|
) });
|
|
4365
4382
|
}
|
|
4366
|
-
function
|
|
4383
|
+
function Fr({
|
|
4367
4384
|
children: e,
|
|
4368
4385
|
api: t,
|
|
4369
4386
|
streamBaseUrl: n,
|
|
4370
4387
|
handlers: r,
|
|
4371
4388
|
onStreamingChange: o
|
|
4372
4389
|
}) {
|
|
4373
|
-
const { setCurrentThreadId: s, currentThreadIdRef: a, addThreadFromEvent: i, currentThreadId:
|
|
4390
|
+
const { setCurrentThreadId: s, currentThreadIdRef: a, addThreadFromEvent: i, currentThreadId: u } = ot(), {
|
|
4374
4391
|
interrupt: c,
|
|
4375
4392
|
checkpoint: l,
|
|
4376
|
-
timelineCheckpoints:
|
|
4377
|
-
handleValuesEvent:
|
|
4378
|
-
markSkipNextLoad:
|
|
4379
|
-
markStreamPendingThread:
|
|
4380
|
-
resetHistoryState:
|
|
4381
|
-
pushUser:
|
|
4382
|
-
onEvent:
|
|
4383
|
-
messages:
|
|
4384
|
-
} =
|
|
4385
|
-
(
|
|
4386
|
-
i(
|
|
4393
|
+
timelineCheckpoints: d,
|
|
4394
|
+
handleValuesEvent: m,
|
|
4395
|
+
markSkipNextLoad: y,
|
|
4396
|
+
markStreamPendingThread: I,
|
|
4397
|
+
resetHistoryState: f,
|
|
4398
|
+
pushUser: k,
|
|
4399
|
+
onEvent: p,
|
|
4400
|
+
messages: S
|
|
4401
|
+
} = Kt(), { registerClearThread: A, registerRespondToInterrupt: E } = Lr(), v = _(
|
|
4402
|
+
(h) => {
|
|
4403
|
+
i(h), I(h.threadId), a.current !== h.threadId && ((h.created ?? !a.current) && y(h.threadId), s(h.threadId));
|
|
4387
4404
|
},
|
|
4388
|
-
[i,
|
|
4389
|
-
),
|
|
4405
|
+
[i, y, I, s, a]
|
|
4406
|
+
), w = pr({
|
|
4390
4407
|
baseUrl: n,
|
|
4391
|
-
onEvent:
|
|
4392
|
-
onError: (
|
|
4408
|
+
onEvent: p,
|
|
4409
|
+
onError: (h) => {
|
|
4393
4410
|
var U;
|
|
4394
|
-
(U = r.onError) == null || U.call(r, (
|
|
4411
|
+
(U = r.onError) == null || U.call(r, (h == null ? void 0 : h.message) ?? String(h));
|
|
4395
4412
|
},
|
|
4396
4413
|
onAuthError: r.onAuthError,
|
|
4397
4414
|
onConnectionError: r.onConnectionError,
|
|
@@ -4401,122 +4418,122 @@ function Or({
|
|
|
4401
4418
|
onCustomEvent: r.onCustomEvent,
|
|
4402
4419
|
onUpdateEvent: r.onUpdateEvent,
|
|
4403
4420
|
onToolEnd: r.onToolEnd,
|
|
4404
|
-
handleValuesEvent:
|
|
4421
|
+
handleValuesEvent: m
|
|
4405
4422
|
});
|
|
4406
4423
|
X(() => {
|
|
4407
|
-
o == null || o(
|
|
4408
|
-
}, [
|
|
4409
|
-
const { stream:
|
|
4424
|
+
o == null || o(w.isStreaming);
|
|
4425
|
+
}, [w.isStreaming, o]);
|
|
4426
|
+
const { stream: x, stop: g, clear: b, isStreaming: P, error: j, connected: M, streamedMessages: O, activeMessageId: F } = w;
|
|
4410
4427
|
X(() => {
|
|
4411
|
-
|
|
4412
|
-
}, [
|
|
4413
|
-
const
|
|
4414
|
-
async (
|
|
4415
|
-
await
|
|
4428
|
+
u !== void 0 && b();
|
|
4429
|
+
}, [u, b]);
|
|
4430
|
+
const C = _(
|
|
4431
|
+
async (h, U) => {
|
|
4432
|
+
await x(h, U);
|
|
4416
4433
|
},
|
|
4417
|
-
[
|
|
4418
|
-
),
|
|
4434
|
+
[x]
|
|
4435
|
+
), B = W(l);
|
|
4419
4436
|
X(() => {
|
|
4420
|
-
|
|
4437
|
+
B.current = l;
|
|
4421
4438
|
}, [l]);
|
|
4422
4439
|
const N = _(
|
|
4423
|
-
async (
|
|
4440
|
+
async (h, U, T) => {
|
|
4424
4441
|
var G;
|
|
4425
4442
|
const J = a.current;
|
|
4426
4443
|
if (!J)
|
|
4427
4444
|
throw new Error("No active thread to handle interrupt");
|
|
4428
|
-
const
|
|
4445
|
+
const K = h ? U ?? !0 : !1, q = B.current, ee = (T == null ? void 0 : T.checkpointId) ?? q.id ?? void 0, re = (T == null ? void 0 : T.checkpointNs) ?? q.namespace ?? void 0, ue = {
|
|
4429
4446
|
threadId: J,
|
|
4430
4447
|
checkpointId: ee,
|
|
4431
4448
|
checkpointNs: re,
|
|
4432
|
-
command: { kind: "resume", value:
|
|
4449
|
+
command: { kind: "resume", value: K },
|
|
4433
4450
|
payload: {
|
|
4434
4451
|
...(T == null ? void 0 : T.payload) ?? {},
|
|
4435
4452
|
creativityLevel: ((G = T == null ? void 0 : T.payload) == null ? void 0 : G.creativityLevel) ?? "medium"
|
|
4436
4453
|
},
|
|
4437
4454
|
edit: !1
|
|
4438
4455
|
};
|
|
4439
|
-
|
|
4456
|
+
C(ue);
|
|
4440
4457
|
},
|
|
4441
|
-
[a,
|
|
4458
|
+
[a, C]
|
|
4442
4459
|
);
|
|
4443
4460
|
X(() => {
|
|
4444
4461
|
E(N);
|
|
4445
4462
|
}, [N, E]);
|
|
4446
4463
|
const V = _(async () => {
|
|
4447
|
-
|
|
4448
|
-
}, [
|
|
4464
|
+
g(), b(), f(), s(null);
|
|
4465
|
+
}, [b, f, s, g]);
|
|
4449
4466
|
X(() => {
|
|
4450
|
-
|
|
4451
|
-
}, [V,
|
|
4467
|
+
A(V);
|
|
4468
|
+
}, [V, A]);
|
|
4452
4469
|
const z = _(
|
|
4453
|
-
async (
|
|
4454
|
-
P &&
|
|
4470
|
+
async (h, U) => {
|
|
4471
|
+
P && g();
|
|
4455
4472
|
let T = a.current;
|
|
4456
|
-
const J = (
|
|
4473
|
+
const J = (h == null ? void 0 : h.text) ?? "", K = (h == null ? void 0 : h.attachments) ?? [], q = (J == null ? void 0 : J.trim()) ?? "", ee = { ...(h == null ? void 0 : h.payload) ?? {} }, re = Array.isArray(ee.messages) ? ee.messages : void 0;
|
|
4457
4474
|
re && delete ee.messages;
|
|
4458
|
-
const ue = !!(re && re.length), G = !!(
|
|
4459
|
-
if (!T && !
|
|
4475
|
+
const ue = !!(re && re.length), G = !!(h.contentParts && h.contentParts.length > 0);
|
|
4476
|
+
if (!T && !q && K.length === 0 && !ue && !G) return;
|
|
4460
4477
|
if (!T) {
|
|
4461
4478
|
const ye = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), he = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")).join("").slice(0, 16);
|
|
4462
|
-
T = `${ye}${he}`,
|
|
4479
|
+
T = `${ye}${he}`, y(T), s(T);
|
|
4463
4480
|
}
|
|
4464
4481
|
let te = null;
|
|
4465
|
-
|
|
4466
|
-
const { contentParts:
|
|
4467
|
-
|
|
4468
|
-
const ge =
|
|
4482
|
+
h.contentParts && h.contentParts.length > 0 && (te = h.contentParts);
|
|
4483
|
+
const { contentParts: ke, filesInfo: Q } = te ? { contentParts: te, filesInfo: [] } : await or(K), Z = [...ke];
|
|
4484
|
+
q && Z.push({ type: "text", text: J });
|
|
4485
|
+
const ge = h == null ? void 0 : h.originalMessageId, je = !!(h != null && h.edit && ge), Be = !ue && Z.length > 0;
|
|
4469
4486
|
let me = null;
|
|
4470
|
-
if (
|
|
4487
|
+
if (Be) {
|
|
4471
4488
|
const ye = je ? ge : `msg-${Date.now()}`;
|
|
4472
4489
|
me = Ut({
|
|
4473
4490
|
id: ye,
|
|
4474
4491
|
role: "user",
|
|
4475
4492
|
content: Z,
|
|
4476
4493
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4477
|
-
}, "user"), je ?
|
|
4494
|
+
}, "user"), je ? k(me, { editingMessageId: ge }) : k(me);
|
|
4478
4495
|
}
|
|
4479
4496
|
const Ie = ue ? re : me ? [me] : [], oe = {
|
|
4480
4497
|
...ee,
|
|
4481
4498
|
...Q.length ? { files_info: Q } : {}
|
|
4482
4499
|
};
|
|
4483
4500
|
Ie.length ? oe.messages = Ie : "messages" in oe || (oe.messages = []);
|
|
4484
|
-
const Pe = (
|
|
4485
|
-
if (
|
|
4501
|
+
const Pe = (h == null ? void 0 : h.checkpointId) ?? l.id ?? void 0;
|
|
4502
|
+
if (h != null && h.edit && !Pe)
|
|
4486
4503
|
throw new Error(
|
|
4487
4504
|
`[streaming] Missing checkpointId for edit submit. threadId=${T ?? "null"}`
|
|
4488
4505
|
);
|
|
4489
|
-
const
|
|
4506
|
+
const Ae = {
|
|
4490
4507
|
threadId: T,
|
|
4491
|
-
content:
|
|
4508
|
+
content: h == null ? void 0 : h.text,
|
|
4492
4509
|
payload: oe,
|
|
4493
|
-
config:
|
|
4510
|
+
config: h == null ? void 0 : h.config,
|
|
4494
4511
|
checkpointId: Pe,
|
|
4495
|
-
command:
|
|
4496
|
-
edit:
|
|
4512
|
+
command: h == null ? void 0 : h.command,
|
|
4513
|
+
edit: h == null ? void 0 : h.edit
|
|
4497
4514
|
};
|
|
4498
|
-
return
|
|
4515
|
+
return C(Ae, U);
|
|
4499
4516
|
},
|
|
4500
|
-
[l, a, P,
|
|
4501
|
-
), L = Y(() =>
|
|
4517
|
+
[l, a, P, y, k, C, g, d]
|
|
4518
|
+
), L = Y(() => S, [S]), H = Y(
|
|
4502
4519
|
() => ({
|
|
4503
4520
|
isStreaming: P,
|
|
4504
4521
|
error: j,
|
|
4505
|
-
connectionState: j ? "error" : P ?
|
|
4522
|
+
connectionState: j ? "error" : P ? M ? "connected" : "connecting" : "idle",
|
|
4506
4523
|
messages: L,
|
|
4507
|
-
activeMessageId:
|
|
4524
|
+
activeMessageId: F,
|
|
4508
4525
|
submit: z,
|
|
4509
|
-
stop:
|
|
4526
|
+
stop: g,
|
|
4510
4527
|
interrupt: c,
|
|
4511
4528
|
resume: () => Promise.resolve(),
|
|
4512
|
-
goto: (
|
|
4529
|
+
goto: (h, U) => Promise.resolve(),
|
|
4513
4530
|
clearError: () => {
|
|
4514
4531
|
}
|
|
4515
4532
|
// TODO: Implement error clearing
|
|
4516
4533
|
}),
|
|
4517
|
-
[P, j, z,
|
|
4534
|
+
[P, j, z, g, c, M, L]
|
|
4518
4535
|
);
|
|
4519
|
-
return /* @__PURE__ */ ie(
|
|
4536
|
+
return /* @__PURE__ */ ie(qt.Provider, { value: H, children: e });
|
|
4520
4537
|
}
|
|
4521
4538
|
function fe(e) {
|
|
4522
4539
|
const t = W(e);
|
|
@@ -4528,8 +4545,8 @@ function fe(e) {
|
|
|
4528
4545
|
return r(...n);
|
|
4529
4546
|
}, []);
|
|
4530
4547
|
}
|
|
4531
|
-
function
|
|
4532
|
-
return Ue(
|
|
4548
|
+
function Or(e) {
|
|
4549
|
+
return Ue(qt);
|
|
4533
4550
|
}
|
|
4534
4551
|
function bt(e) {
|
|
4535
4552
|
return typeof e == "object" && e !== null;
|
|
@@ -4569,41 +4586,41 @@ function po({
|
|
|
4569
4586
|
autoLoadInitial: s = !0,
|
|
4570
4587
|
onConnectionError: a,
|
|
4571
4588
|
onError: i,
|
|
4572
|
-
onAuthError:
|
|
4589
|
+
onAuthError: u,
|
|
4573
4590
|
onThreadChange: c,
|
|
4574
4591
|
onToolEnd: l,
|
|
4575
|
-
onUpdateEvent:
|
|
4576
|
-
onCustomEvent:
|
|
4577
|
-
onMetadataEvent:
|
|
4578
|
-
onFinish:
|
|
4592
|
+
onUpdateEvent: d,
|
|
4593
|
+
onCustomEvent: m,
|
|
4594
|
+
onMetadataEvent: y,
|
|
4595
|
+
onFinish: I
|
|
4579
4596
|
}) {
|
|
4580
|
-
const
|
|
4597
|
+
const f = Dr(t), [k, p] = $(!1), S = pe(i), A = pe(u), E = pe(a), v = pe(c), w = pe(l), x = pe(d), g = pe(m), b = pe(y), P = pe(I), j = Y(
|
|
4581
4598
|
() => ({
|
|
4582
|
-
onError:
|
|
4583
|
-
onAuthError:
|
|
4599
|
+
onError: S,
|
|
4600
|
+
onAuthError: A,
|
|
4584
4601
|
onConnectionError: E,
|
|
4585
|
-
onToolEnd:
|
|
4586
|
-
onUpdateEvent:
|
|
4587
|
-
onCustomEvent:
|
|
4588
|
-
onMetadataEvent:
|
|
4602
|
+
onToolEnd: w,
|
|
4603
|
+
onUpdateEvent: x,
|
|
4604
|
+
onCustomEvent: g,
|
|
4605
|
+
onMetadataEvent: b,
|
|
4589
4606
|
onFinish: P
|
|
4590
4607
|
}),
|
|
4591
4608
|
[
|
|
4592
|
-
|
|
4593
|
-
|
|
4609
|
+
S,
|
|
4610
|
+
A,
|
|
4594
4611
|
E,
|
|
4612
|
+
w,
|
|
4613
|
+
x,
|
|
4614
|
+
g,
|
|
4595
4615
|
b,
|
|
4596
|
-
A,
|
|
4597
|
-
p,
|
|
4598
|
-
h,
|
|
4599
4616
|
P
|
|
4600
4617
|
]
|
|
4601
4618
|
);
|
|
4602
|
-
return /* @__PURE__ */ ie(nr, { apiConfig:
|
|
4619
|
+
return /* @__PURE__ */ ie(nr, { apiConfig: f, children: /* @__PURE__ */ ie(
|
|
4603
4620
|
mr,
|
|
4604
4621
|
{
|
|
4605
4622
|
initialThreadId: n,
|
|
4606
|
-
onError:
|
|
4623
|
+
onError: S,
|
|
4607
4624
|
onThreadChange: v,
|
|
4608
4625
|
children: /* @__PURE__ */ ie(
|
|
4609
4626
|
Ur,
|
|
@@ -4612,13 +4629,13 @@ function po({
|
|
|
4612
4629
|
initialCheckpointId: r,
|
|
4613
4630
|
initialCheckpointNs: o,
|
|
4614
4631
|
autoLoadInitial: s,
|
|
4615
|
-
onError:
|
|
4616
|
-
isStreaming:
|
|
4632
|
+
onError: S,
|
|
4633
|
+
isStreaming: k,
|
|
4617
4634
|
children: /* @__PURE__ */ ie(
|
|
4618
|
-
|
|
4635
|
+
Br,
|
|
4619
4636
|
{
|
|
4620
4637
|
...j,
|
|
4621
|
-
onStreamingChange:
|
|
4638
|
+
onStreamingChange: p,
|
|
4622
4639
|
children: e
|
|
4623
4640
|
}
|
|
4624
4641
|
)
|
|
@@ -4635,9 +4652,9 @@ function pe(e) {
|
|
|
4635
4652
|
return r(...n);
|
|
4636
4653
|
}, []);
|
|
4637
4654
|
}
|
|
4638
|
-
const
|
|
4655
|
+
const Kr = 1, qr = 1e6;
|
|
4639
4656
|
let We = 0;
|
|
4640
|
-
function
|
|
4657
|
+
function Hr() {
|
|
4641
4658
|
return We = (We + 1) % Number.MAX_SAFE_INTEGER, We.toString();
|
|
4642
4659
|
}
|
|
4643
4660
|
const Je = /* @__PURE__ */ new Map(), wt = (e) => {
|
|
@@ -4648,14 +4665,14 @@ const Je = /* @__PURE__ */ new Map(), wt = (e) => {
|
|
|
4648
4665
|
type: "REMOVE_TOAST",
|
|
4649
4666
|
toastId: e
|
|
4650
4667
|
});
|
|
4651
|
-
},
|
|
4668
|
+
}, qr);
|
|
4652
4669
|
Je.set(e, t);
|
|
4653
4670
|
}, Gr = (e, t) => {
|
|
4654
4671
|
switch (t.type) {
|
|
4655
4672
|
case "ADD_TOAST":
|
|
4656
4673
|
return {
|
|
4657
4674
|
...e,
|
|
4658
|
-
toasts: [t.toast, ...e.toasts].slice(0,
|
|
4675
|
+
toasts: [t.toast, ...e.toasts].slice(0, Kr)
|
|
4659
4676
|
};
|
|
4660
4677
|
case "UPDATE_TOAST":
|
|
4661
4678
|
return {
|
|
@@ -4695,7 +4712,7 @@ function Le(e) {
|
|
|
4695
4712
|
});
|
|
4696
4713
|
}
|
|
4697
4714
|
function Wr({ ...e }) {
|
|
4698
|
-
const t =
|
|
4715
|
+
const t = Hr(), n = (o) => Le({
|
|
4699
4716
|
type: "UPDATE_TOAST",
|
|
4700
4717
|
toast: { ...o, id: t }
|
|
4701
4718
|
}), r = () => Le({ type: "DISMISS_TOAST", toastId: t });
|
|
@@ -4727,75 +4744,75 @@ function Jr() {
|
|
|
4727
4744
|
};
|
|
4728
4745
|
}
|
|
4729
4746
|
function go(e) {
|
|
4730
|
-
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } =
|
|
4731
|
-
l(!1),
|
|
4732
|
-
}, []),
|
|
4733
|
-
|
|
4734
|
-
}, []),
|
|
4735
|
-
async (
|
|
4736
|
-
var
|
|
4747
|
+
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Me(), { toast: o } = Jr(), [s, a] = $({}), [i, u] = $(null), [c, l] = $(!1), d = _(() => {
|
|
4748
|
+
l(!1), u(null);
|
|
4749
|
+
}, []), m = _((I) => {
|
|
4750
|
+
u(I), l(!0);
|
|
4751
|
+
}, []), y = _(
|
|
4752
|
+
async (I, f, k) => {
|
|
4753
|
+
var p, S;
|
|
4737
4754
|
if (!t) {
|
|
4738
|
-
|
|
4755
|
+
I.preventDefault();
|
|
4739
4756
|
return;
|
|
4740
4757
|
}
|
|
4741
|
-
if (s[
|
|
4742
|
-
|
|
4758
|
+
if (s[k]) {
|
|
4759
|
+
I.preventDefault();
|
|
4743
4760
|
return;
|
|
4744
4761
|
}
|
|
4745
4762
|
try {
|
|
4746
|
-
const
|
|
4763
|
+
const A = String(f.url ?? ""), E = A.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
|
|
4747
4764
|
if (E) {
|
|
4748
|
-
|
|
4749
|
-
const v = E[1],
|
|
4750
|
-
|
|
4765
|
+
I.preventDefault();
|
|
4766
|
+
const v = E[1], w = f.name || `file_${v}`, x = f.mimeType || "application/octet-stream";
|
|
4767
|
+
m({ id: v, name: w, mimeType: x });
|
|
4751
4768
|
return;
|
|
4752
4769
|
}
|
|
4753
|
-
if (
|
|
4754
|
-
|
|
4770
|
+
if (A.startsWith("data:")) {
|
|
4771
|
+
I.preventDefault(), a((w) => ({ ...w, [k]: !0 }));
|
|
4755
4772
|
const v = o({ title: "Fetching file...", description: "", open: !0 });
|
|
4756
4773
|
try {
|
|
4757
|
-
const
|
|
4758
|
-
if (!
|
|
4774
|
+
const w = await r.listFiles(n ?? void 0);
|
|
4775
|
+
if (!w || !Array.isArray(w))
|
|
4759
4776
|
throw new Error("Invalid file list response");
|
|
4760
|
-
const
|
|
4761
|
-
if (!(
|
|
4762
|
-
throw new Error(`File "${
|
|
4763
|
-
if (!
|
|
4777
|
+
const x = w.find((g) => !g || typeof g != "object" || !((g.filename ?? "") === (f.name ?? "")) ? !1 : typeof f.size == "number" && typeof g.size == "number" ? g.size === f.size : !0);
|
|
4778
|
+
if (!(x != null && x.id))
|
|
4779
|
+
throw new Error(`File "${f.name}" is not yet available on the server`);
|
|
4780
|
+
if (!x.id || !x.filename)
|
|
4764
4781
|
throw new Error("Invalid file data received from server");
|
|
4765
|
-
|
|
4766
|
-
id:
|
|
4767
|
-
name:
|
|
4768
|
-
mimeType:
|
|
4769
|
-
}), (
|
|
4782
|
+
m({
|
|
4783
|
+
id: x.id,
|
|
4784
|
+
name: f.name || x.filename || `file_${x.id}`,
|
|
4785
|
+
mimeType: f.mimeType || x.mime_type || "application/octet-stream"
|
|
4786
|
+
}), (p = v.update) == null || p.call(v, {
|
|
4770
4787
|
id: v.id,
|
|
4771
4788
|
title: "Success",
|
|
4772
|
-
description: `Opened ${
|
|
4789
|
+
description: `Opened ${f.name}`,
|
|
4773
4790
|
open: !0
|
|
4774
4791
|
});
|
|
4775
|
-
} catch (
|
|
4776
|
-
console.error("Failed to fetch server file:",
|
|
4777
|
-
const
|
|
4778
|
-
(
|
|
4792
|
+
} catch (w) {
|
|
4793
|
+
console.error("Failed to fetch server file:", w);
|
|
4794
|
+
const x = w instanceof Error ? w.message : "Unknown error occurred";
|
|
4795
|
+
(S = v.update) == null || S.call(v, { id: v.id, title: "Failed", description: x }), o({
|
|
4779
4796
|
title: "Failed to fetch file",
|
|
4780
|
-
description:
|
|
4797
|
+
description: x,
|
|
4781
4798
|
open: !0
|
|
4782
4799
|
});
|
|
4783
4800
|
} finally {
|
|
4784
|
-
a((
|
|
4801
|
+
a((w) => ({ ...w, [k]: !1 }));
|
|
4785
4802
|
}
|
|
4786
4803
|
}
|
|
4787
|
-
} catch (
|
|
4788
|
-
console.error("File click error:",
|
|
4804
|
+
} catch (A) {
|
|
4805
|
+
console.error("File click error:", A), a((E) => ({ ...E, [k]: !1 }));
|
|
4789
4806
|
}
|
|
4790
4807
|
},
|
|
4791
|
-
[t, s, o, n,
|
|
4808
|
+
[t, s, o, n, m]
|
|
4792
4809
|
);
|
|
4793
4810
|
return {
|
|
4794
4811
|
uploadingFiles: s,
|
|
4795
|
-
handleFileClick:
|
|
4812
|
+
handleFileClick: y,
|
|
4796
4813
|
fileViewerOpen: c,
|
|
4797
4814
|
currentFileInfo: i,
|
|
4798
|
-
closeFileViewer:
|
|
4815
|
+
closeFileViewer: d
|
|
4799
4816
|
};
|
|
4800
4817
|
}
|
|
4801
4818
|
function mo(e) {
|
|
@@ -4808,20 +4825,20 @@ function mo(e) {
|
|
|
4808
4825
|
toolMeta: ar(t),
|
|
4809
4826
|
imageParts: n.filter((r) => r.type === "image_url"),
|
|
4810
4827
|
fileParts: n.filter((r) => r.type === "file"),
|
|
4811
|
-
toolRaw:
|
|
4828
|
+
toolRaw: Fn(n),
|
|
4812
4829
|
isToolStreaming: !!t.toolStreaming
|
|
4813
4830
|
};
|
|
4814
4831
|
}, [e]);
|
|
4815
4832
|
}
|
|
4816
|
-
const
|
|
4833
|
+
const kt = "data:";
|
|
4817
4834
|
function Xr(e) {
|
|
4818
4835
|
if (!e) return [];
|
|
4819
4836
|
const t = [], n = e.split(/\r?\n/);
|
|
4820
4837
|
for (const r of n) {
|
|
4821
4838
|
const o = r.trim();
|
|
4822
|
-
if (!o || !o.startsWith(
|
|
4839
|
+
if (!o || !o.startsWith(kt))
|
|
4823
4840
|
continue;
|
|
4824
|
-
const s = o.slice(
|
|
4841
|
+
const s = o.slice(kt.length).trim();
|
|
4825
4842
|
if (!s || s.toLowerCase() === "[done]")
|
|
4826
4843
|
continue;
|
|
4827
4844
|
const a = tt(s);
|
|
@@ -4840,16 +4857,16 @@ function Qr(e) {
|
|
|
4840
4857
|
function yo(e) {
|
|
4841
4858
|
return Y(() => {
|
|
4842
4859
|
const t = e.content.filter(
|
|
4843
|
-
(
|
|
4860
|
+
(u) => u.type === "text"
|
|
4844
4861
|
);
|
|
4845
4862
|
if (!t.length)
|
|
4846
4863
|
return null;
|
|
4847
4864
|
let r = t.flatMap(
|
|
4848
|
-
(
|
|
4865
|
+
(u) => Xr(u.text ?? "")
|
|
4849
4866
|
);
|
|
4850
4867
|
if (!r.length) {
|
|
4851
|
-
const
|
|
4852
|
-
`), c = tt(
|
|
4868
|
+
const u = t.map((l) => l.text ?? "").join(`
|
|
4869
|
+
`), c = tt(u);
|
|
4853
4870
|
c && typeof c == "object" && (r = [c]);
|
|
4854
4871
|
}
|
|
4855
4872
|
if (!r.length)
|
|
@@ -4871,24 +4888,24 @@ function yo(e) {
|
|
|
4871
4888
|
}, [e]);
|
|
4872
4889
|
}
|
|
4873
4890
|
function Yr(e) {
|
|
4874
|
-
var
|
|
4875
|
-
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r = ot({ optional: !0 }), o =
|
|
4891
|
+
var M, O;
|
|
4892
|
+
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r = ot({ optional: !0 }), o = Kt({ optional: !0 }), s = Or(), { currentThreadId: a, setCurrentThreadId: i, actions: u } = r || {
|
|
4876
4893
|
currentThreadId: null,
|
|
4877
4894
|
setCurrentThreadId: () => {
|
|
4878
4895
|
},
|
|
4879
4896
|
actions: {}
|
|
4880
|
-
}, c = !!t && t !== a, [l,
|
|
4881
|
-
|
|
4897
|
+
}, c = !!t && t !== a, [l, d] = $([]), m = _((F) => {
|
|
4898
|
+
d(F);
|
|
4882
4899
|
}, []), {
|
|
4883
|
-
isLoadingThread:
|
|
4884
|
-
threadStateError:
|
|
4885
|
-
threadCheckpoints:
|
|
4886
|
-
isLoadingHistory:
|
|
4887
|
-
loadThread:
|
|
4900
|
+
isLoadingThread: y,
|
|
4901
|
+
threadStateError: I,
|
|
4902
|
+
threadCheckpoints: f,
|
|
4903
|
+
isLoadingHistory: k,
|
|
4904
|
+
loadThread: p
|
|
4888
4905
|
} = $t({
|
|
4889
|
-
api:
|
|
4890
|
-
fileApi:
|
|
4891
|
-
seed:
|
|
4906
|
+
api: Me().chatApi,
|
|
4907
|
+
fileApi: Me().fileApi,
|
|
4908
|
+
seed: m,
|
|
4892
4909
|
currentThreadId: c ? t : null,
|
|
4893
4910
|
initialThreadId: c ? t : null,
|
|
4894
4911
|
isStreaming: !1,
|
|
@@ -4898,20 +4915,20 @@ function Yr(e) {
|
|
|
4898
4915
|
X(() => {
|
|
4899
4916
|
!c && !n && a && (o != null && o.loadThread) && o.loadThread(a);
|
|
4900
4917
|
}, [c, n, a, o == null ? void 0 : o.loadThread]);
|
|
4901
|
-
const
|
|
4902
|
-
var
|
|
4903
|
-
return ((
|
|
4904
|
-
}, [
|
|
4918
|
+
const S = Y(() => {
|
|
4919
|
+
var F;
|
|
4920
|
+
return ((F = f[0]) == null ? void 0 : F.values) || {};
|
|
4921
|
+
}, [f]), A = Y(() => ({ timeline: [], messagePreviews: {} }), []), E = t || a, v = c ? y ? "loading" : "idle" : (o == null ? void 0 : o.status) || "idle", w = c ? l : (s == null ? void 0 : s.messages) || [], x = c ? y : (o == null ? void 0 : o.isLoading) || !1, g = c ? k : (o == null ? void 0 : o.isLoadingHistory) || !1, b = c ? S : (o == null ? void 0 : o.values) || {}, P = c ? {} : (o == null ? void 0 : o.taskMessagesByScope) || {}, j = c ? I : (s == null ? void 0 : s.error) || (o == null ? void 0 : o.error) || null;
|
|
4905
4922
|
return {
|
|
4906
4923
|
// UNIFIED: Single thread ID concept
|
|
4907
4924
|
threadId: E,
|
|
4908
4925
|
status: v,
|
|
4909
|
-
messages:
|
|
4910
|
-
isLoading:
|
|
4911
|
-
isHistoryLoading:
|
|
4926
|
+
messages: w,
|
|
4927
|
+
isLoading: x,
|
|
4928
|
+
isHistoryLoading: g,
|
|
4912
4929
|
error: j,
|
|
4913
4930
|
// Values & Metadata
|
|
4914
|
-
values:
|
|
4931
|
+
values: b,
|
|
4915
4932
|
taskMessagesByScope: P,
|
|
4916
4933
|
metadata: c ? {} : o == null ? void 0 : o.metadata,
|
|
4917
4934
|
// Actions & State relating to Global/Active Thread only
|
|
@@ -4921,9 +4938,9 @@ function Yr(e) {
|
|
|
4921
4938
|
returnToLatest: c ? async () => {
|
|
4922
4939
|
} : (o == null ? void 0 : o.returnToLatest) || (async () => {
|
|
4923
4940
|
}),
|
|
4924
|
-
checkpoint: c ?
|
|
4925
|
-
checkpoints: c ?
|
|
4926
|
-
checkpointIndex: c ?
|
|
4941
|
+
checkpoint: c ? f[0] ? { id: f[0].checkpointId, namespace: f[0].checkpointNs } : null : (o == null ? void 0 : o.checkpoint) || null,
|
|
4942
|
+
checkpoints: c ? f : (o == null ? void 0 : o.checkpoints) || [],
|
|
4943
|
+
checkpointIndex: c ? A : (o == null ? void 0 : o.checkpointIndex) || { timeline: [], messagePreviews: {} },
|
|
4927
4944
|
interrupt: c ? null : (o == null ? void 0 : o.interrupt) || null,
|
|
4928
4945
|
respondToInterrupt: c ? async () => {
|
|
4929
4946
|
} : (o == null ? void 0 : o.respondToInterrupt) || (async () => {
|
|
@@ -4931,9 +4948,9 @@ function Yr(e) {
|
|
|
4931
4948
|
// Streaming Status
|
|
4932
4949
|
// Even in standalone mode, allow streaming state/stop if a stream context exists.
|
|
4933
4950
|
isStreaming: (s == null ? void 0 : s.isStreaming) || !1,
|
|
4934
|
-
activeMessageId: (s == null ? void 0 : s.activeMessageId) || null,
|
|
4951
|
+
activeMessageId: c ? null : ((M = o == null ? void 0 : o.metadata) == null ? void 0 : M.assemblingMessageId) || (s == null ? void 0 : s.activeMessageId) || null,
|
|
4935
4952
|
connectionState: (s == null ? void 0 : s.connectionState) || "disconnected",
|
|
4936
|
-
streamingAssistantId: !c && (s != null && s.isStreaming) && ((
|
|
4953
|
+
streamingAssistantId: !c && (s != null && s.isStreaming) && ((O = o == null ? void 0 : o.metadata) != null && O.assemblingMessageId) ? o.metadata.assemblingMessageId : null,
|
|
4937
4954
|
// Actions
|
|
4938
4955
|
submit: (s == null ? void 0 : s.submit) || (async () => {
|
|
4939
4956
|
}),
|
|
@@ -4944,16 +4961,16 @@ function Yr(e) {
|
|
|
4944
4961
|
}),
|
|
4945
4962
|
setCurrentThreadId: i,
|
|
4946
4963
|
loadHistory: c ? async () => {
|
|
4947
|
-
t && await
|
|
4964
|
+
t && await p(t);
|
|
4948
4965
|
} : async () => {
|
|
4949
4966
|
},
|
|
4950
4967
|
onEvent: c ? () => {
|
|
4951
4968
|
} : (o == null ? void 0 : o.onEvent) || (() => {
|
|
4952
4969
|
}),
|
|
4953
4970
|
// Thread Management
|
|
4954
|
-
createThread:
|
|
4955
|
-
deleteThread:
|
|
4956
|
-
renameThread:
|
|
4971
|
+
createThread: u == null ? void 0 : u.createThread,
|
|
4972
|
+
deleteThread: u == null ? void 0 : u.deleteThread,
|
|
4973
|
+
renameThread: u == null ? void 0 : u.renameThread,
|
|
4957
4974
|
threads: (r == null ? void 0 : r.threads) || [],
|
|
4958
4975
|
isThreadsLoading: (r == null ? void 0 : r.isLoading) || !1
|
|
4959
4976
|
};
|
|
@@ -4967,42 +4984,42 @@ function ho({
|
|
|
4967
4984
|
onExcelUploadSuccess: s,
|
|
4968
4985
|
onError: a,
|
|
4969
4986
|
enableMessageEditing: i,
|
|
4970
|
-
messages:
|
|
4987
|
+
messages: u,
|
|
4971
4988
|
setPendingAssistantResponse: c,
|
|
4972
4989
|
project: l,
|
|
4973
|
-
onEvent:
|
|
4974
|
-
threadId:
|
|
4975
|
-
clearComposerOnSend:
|
|
4990
|
+
onEvent: d,
|
|
4991
|
+
threadId: m,
|
|
4992
|
+
clearComposerOnSend: y = !0
|
|
4976
4993
|
}) {
|
|
4977
|
-
const { messages:
|
|
4994
|
+
const { messages: I } = Yr(), [f, k] = $(null), [p, S] = $(""), [A, E] = $(null), [v, w] = $(null), [x, g] = $(!1), [b, P] = $(""), j = W(b), M = W(null);
|
|
4978
4995
|
X(() => {
|
|
4979
|
-
if (!
|
|
4980
|
-
if (
|
|
4981
|
-
const
|
|
4982
|
-
P(
|
|
4996
|
+
if (!f)
|
|
4997
|
+
if (m) {
|
|
4998
|
+
const h = localStorage.getItem(Ge(m));
|
|
4999
|
+
P(h || "");
|
|
4983
5000
|
} else
|
|
4984
5001
|
P("");
|
|
4985
|
-
}, [
|
|
4986
|
-
const O = _((
|
|
4987
|
-
P(
|
|
4988
|
-
}, [
|
|
5002
|
+
}, [m, f]);
|
|
5003
|
+
const O = _((h) => {
|
|
5004
|
+
P(h), !f && m && localStorage.setItem(Ge(m), h);
|
|
5005
|
+
}, [m, f]);
|
|
4989
5006
|
X(() => {
|
|
4990
|
-
j.current =
|
|
4991
|
-
}, [
|
|
4992
|
-
if (!
|
|
4993
|
-
|
|
5007
|
+
j.current = b;
|
|
5008
|
+
}, [b]), X(() => {
|
|
5009
|
+
if (!f) {
|
|
5010
|
+
M.current = null;
|
|
4994
5011
|
return;
|
|
4995
5012
|
}
|
|
4996
|
-
|
|
4997
|
-
}, [
|
|
4998
|
-
const
|
|
4999
|
-
(
|
|
5000
|
-
O(
|
|
5013
|
+
M.current === null && (M.current = j.current), O(p ?? "");
|
|
5014
|
+
}, [p, f, O]);
|
|
5015
|
+
const F = _(
|
|
5016
|
+
(h) => {
|
|
5017
|
+
O(h);
|
|
5001
5018
|
},
|
|
5002
5019
|
[O]
|
|
5003
|
-
),
|
|
5004
|
-
const T = Array.isArray(U) ? { files: U } : U ?? {}, J = T.files ?? [],
|
|
5005
|
-
if (!(!
|
|
5020
|
+
), C = async (h, U) => {
|
|
5021
|
+
const T = Array.isArray(U) ? { files: U } : U ?? {}, J = T.files ?? [], K = T.contentParts ?? [], q = h.trim();
|
|
5022
|
+
if (!(!q && J.length === 0 && K.length === 0))
|
|
5006
5023
|
try {
|
|
5007
5024
|
const ee = J.map(async (Q) => {
|
|
5008
5025
|
try {
|
|
@@ -5023,73 +5040,73 @@ function ho({
|
|
|
5023
5040
|
name: Q.filename,
|
|
5024
5041
|
size: Q.size
|
|
5025
5042
|
};
|
|
5026
|
-
}), G = [...
|
|
5043
|
+
}), G = [...K, ...ue], te = f ? (A == null ? void 0 : A.checkpointId) ?? n ?? void 0 : n ?? void 0, ke = f ? (A == null ? void 0 : A.checkpointNs) ?? r ?? void 0 : r ?? void 0;
|
|
5027
5044
|
await e(
|
|
5028
5045
|
{
|
|
5029
|
-
text:
|
|
5046
|
+
text: q || "",
|
|
5030
5047
|
contentParts: G,
|
|
5031
5048
|
attachments: J,
|
|
5032
5049
|
payload: t.payload,
|
|
5033
|
-
edit: !!
|
|
5050
|
+
edit: !!f,
|
|
5034
5051
|
checkpointId: te,
|
|
5035
|
-
checkpointNs:
|
|
5052
|
+
checkpointNs: ke,
|
|
5036
5053
|
project: l ?? void 0,
|
|
5037
|
-
originalMessageId:
|
|
5054
|
+
originalMessageId: f ?? void 0,
|
|
5038
5055
|
config: t.config
|
|
5039
5056
|
},
|
|
5040
|
-
|
|
5041
|
-
), o == null || o(
|
|
5057
|
+
d ? { onEvent: d } : void 0
|
|
5058
|
+
), o == null || o(q), c(!0), y && (m && localStorage.removeItem(Ge(m)), O("")), w(null), k(null), S(""), E(null);
|
|
5042
5059
|
} catch (ee) {
|
|
5043
5060
|
const re = (ee == null ? void 0 : ee.message) || "Failed to send message";
|
|
5044
|
-
|
|
5061
|
+
w(re), a == null || a(re), c(!1);
|
|
5045
5062
|
}
|
|
5046
|
-
},
|
|
5047
|
-
U ||
|
|
5063
|
+
}, B = (h, U) => {
|
|
5064
|
+
U || C(h, { files: [] });
|
|
5048
5065
|
}, N = _(
|
|
5049
|
-
async (
|
|
5066
|
+
async (h) => {
|
|
5050
5067
|
await e(
|
|
5051
5068
|
{
|
|
5052
|
-
attachments: [
|
|
5069
|
+
attachments: [h],
|
|
5053
5070
|
payload: t.payload,
|
|
5054
5071
|
checkpointId: n ?? void 0,
|
|
5055
5072
|
checkpointNs: r ?? void 0,
|
|
5056
5073
|
project: l ?? void 0,
|
|
5057
5074
|
config: t.config
|
|
5058
5075
|
},
|
|
5059
|
-
|
|
5060
|
-
), s == null || s({ file:
|
|
5076
|
+
d ? { onEvent: d } : void 0
|
|
5077
|
+
), s == null || s({ file: h });
|
|
5061
5078
|
},
|
|
5062
5079
|
[n, r, t, s, e]
|
|
5063
5080
|
), V = _(
|
|
5064
|
-
(
|
|
5065
|
-
i && (
|
|
5081
|
+
(h, U, T) => {
|
|
5082
|
+
i && (M.current = b, k(h), S(U), E({
|
|
5066
5083
|
checkpointId: (T == null ? void 0 : T.checkpointId) ?? null,
|
|
5067
5084
|
checkpointNs: (T == null ? void 0 : T.checkpointNs) ?? null
|
|
5068
|
-
}),
|
|
5085
|
+
}), w(null));
|
|
5069
5086
|
},
|
|
5070
|
-
[
|
|
5087
|
+
[b, i]
|
|
5071
5088
|
), z = _(() => {
|
|
5072
|
-
|
|
5073
|
-
const
|
|
5074
|
-
|
|
5075
|
-
}, []), L = _((
|
|
5089
|
+
k(null), S(""), E(null), w(null);
|
|
5090
|
+
const h = M.current;
|
|
5091
|
+
h !== null && P(h), M.current = null;
|
|
5092
|
+
}, []), L = _((h) => {
|
|
5076
5093
|
let U = null;
|
|
5077
|
-
for (let
|
|
5078
|
-
if (
|
|
5079
|
-
U =
|
|
5094
|
+
for (let q = h - 1; q >= 0; q--)
|
|
5095
|
+
if (u[q].role === "user") {
|
|
5096
|
+
U = u[q];
|
|
5080
5097
|
break;
|
|
5081
5098
|
}
|
|
5082
5099
|
if (!U) return;
|
|
5083
|
-
const T = Array.isArray(U.content) ? U.content : [],
|
|
5100
|
+
const T = Array.isArray(U.content) ? U.content : [], K = T.filter((q) => (q == null ? void 0 : q.type) === "text").map((q) => q.text).join("") || (() => {
|
|
5084
5101
|
try {
|
|
5085
5102
|
return JSON.stringify(T, null, 2);
|
|
5086
5103
|
} catch {
|
|
5087
5104
|
return String(T);
|
|
5088
5105
|
}
|
|
5089
5106
|
})();
|
|
5090
|
-
|
|
5107
|
+
K && e(
|
|
5091
5108
|
{
|
|
5092
|
-
text:
|
|
5109
|
+
text: K,
|
|
5093
5110
|
payload: t.payload,
|
|
5094
5111
|
checkpointId: n ?? void 0,
|
|
5095
5112
|
checkpointNs: r ?? void 0,
|
|
@@ -5097,25 +5114,25 @@ function ho({
|
|
|
5097
5114
|
originalMessageId: U.id,
|
|
5098
5115
|
config: t.config
|
|
5099
5116
|
},
|
|
5100
|
-
|
|
5117
|
+
d ? { onEvent: d } : void 0
|
|
5101
5118
|
);
|
|
5102
|
-
}, [
|
|
5119
|
+
}, [u, e, n, r, t]);
|
|
5103
5120
|
return {
|
|
5104
|
-
editingMessageId:
|
|
5105
|
-
editingInitialValue:
|
|
5121
|
+
editingMessageId: f,
|
|
5122
|
+
editingInitialValue: p,
|
|
5106
5123
|
inputError: v,
|
|
5107
|
-
setInputError:
|
|
5108
|
-
dismissError:
|
|
5109
|
-
setDismissError:
|
|
5110
|
-
composerValue:
|
|
5111
|
-
handleComposerChange:
|
|
5112
|
-
handleSendMessage:
|
|
5113
|
-
handleQuickPrompt:
|
|
5124
|
+
setInputError: w,
|
|
5125
|
+
dismissError: x,
|
|
5126
|
+
setDismissError: g,
|
|
5127
|
+
composerValue: b,
|
|
5128
|
+
handleComposerChange: F,
|
|
5129
|
+
handleSendMessage: C,
|
|
5130
|
+
handleQuickPrompt: B,
|
|
5114
5131
|
handleExcelUpload: N,
|
|
5115
5132
|
startEditing: V,
|
|
5116
5133
|
cancelEditing: z,
|
|
5117
5134
|
handleRegenerateCb: L,
|
|
5118
|
-
displayMessages:
|
|
5135
|
+
displayMessages: I
|
|
5119
5136
|
};
|
|
5120
5137
|
}
|
|
5121
5138
|
function bo(e) {
|
|
@@ -5123,7 +5140,7 @@ function bo(e) {
|
|
|
5123
5140
|
textContent: Ln(e),
|
|
5124
5141
|
imageParts: Un(e),
|
|
5125
5142
|
fileParts: jn(e),
|
|
5126
|
-
toolCalls:
|
|
5143
|
+
toolCalls: Mt(e),
|
|
5127
5144
|
contentParts: e.content
|
|
5128
5145
|
} : {
|
|
5129
5146
|
textContent: "",
|
|
@@ -5134,7 +5151,7 @@ function bo(e) {
|
|
|
5134
5151
|
}, [e]);
|
|
5135
5152
|
}
|
|
5136
5153
|
function wo(e, t, n) {
|
|
5137
|
-
const [r, o] =
|
|
5154
|
+
const [r, o] = $(e), s = W(e), a = W(null);
|
|
5138
5155
|
return X(() => {
|
|
5139
5156
|
s.current = e;
|
|
5140
5157
|
const i = () => {
|
|
@@ -5165,21 +5182,21 @@ export {
|
|
|
5165
5182
|
Pt as getChatToken,
|
|
5166
5183
|
uo as getMessageAttemptInfo,
|
|
5167
5184
|
ao as getToolCallArtifacts,
|
|
5168
|
-
|
|
5185
|
+
qn as getToolCalls,
|
|
5169
5186
|
so as hasContent,
|
|
5170
5187
|
mt as hydrateHistorySnapshots,
|
|
5171
|
-
|
|
5188
|
+
Ct as isFileLike,
|
|
5172
5189
|
Nn as looksLikeMarkdown,
|
|
5173
5190
|
lo as messageSignature,
|
|
5174
5191
|
io as normalizeInterruptId,
|
|
5175
5192
|
_t as onChatTokenChanged,
|
|
5176
5193
|
tt as parseJsonSafe,
|
|
5177
5194
|
Et as pretty,
|
|
5178
|
-
|
|
5195
|
+
Mr as refreshHistoryFileUrls,
|
|
5179
5196
|
Ve as sanitizeForDisplay,
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5197
|
+
ve as setChatToken,
|
|
5198
|
+
Fn as stringifyTool,
|
|
5199
|
+
Me as useApi,
|
|
5183
5200
|
ho as useChatController,
|
|
5184
5201
|
Yr as useChatSession,
|
|
5185
5202
|
go as useFilePreview,
|
|
@@ -5188,7 +5205,7 @@ export {
|
|
|
5188
5205
|
pr as useStream,
|
|
5189
5206
|
wo as useStreamingMarkdownBuffer,
|
|
5190
5207
|
$t as useThreadHistoryState,
|
|
5191
|
-
|
|
5208
|
+
Kt as useThreadState,
|
|
5192
5209
|
Lr as useThreadStateUpdater,
|
|
5193
5210
|
ot as useThreads,
|
|
5194
5211
|
gr as useThreadsState,
|