@teodorruskvi/chat-core 0.1.40 → 0.1.42
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 +426 -426
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ var Ht = (e, t, n) => t in e ? Gt(e, t, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var st = (e, t, n) => Ht(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { jsx as ie } from "react/jsx-runtime";
|
|
5
5
|
import * as at from "react";
|
|
6
|
-
import { createContext as Se, useContext as Ue, useState as
|
|
6
|
+
import { createContext as Se, useContext as Ue, useState as $, useRef as K, useEffect as q, useCallback as R, useMemo as Q, useReducer as Wt } from "react";
|
|
7
7
|
import qt, { isCancel as Jt } from "axios";
|
|
8
8
|
function vt(e) {
|
|
9
9
|
var t, n, r = "";
|
|
@@ -196,9 +196,9 @@ const Ze = "-", Qt = (e) => {
|
|
|
196
196
|
continue;
|
|
197
197
|
s.push(C);
|
|
198
198
|
const T = o(d, k);
|
|
199
|
-
for (let
|
|
200
|
-
const
|
|
201
|
-
s.push(I +
|
|
199
|
+
for (let N = 0; N < T.length; ++N) {
|
|
200
|
+
const w = T[N];
|
|
201
|
+
s.push(I + w);
|
|
202
202
|
}
|
|
203
203
|
i = c + (i.length > 0 ? " " + i : i);
|
|
204
204
|
}
|
|
@@ -235,10 +235,10 @@ function un(e, ...t) {
|
|
|
235
235
|
return s(ln.apply(null, arguments));
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
|
-
const
|
|
238
|
+
const B = (e) => {
|
|
239
239
|
const t = (n) => n[e] || [];
|
|
240
240
|
return t.isThemeGetter = !0, t;
|
|
241
|
-
}, xt = /^\[(?:([a-z-]+):)?(.+)\]$/i, dn = /^\d+\/\d+$/, fn = /* @__PURE__ */ new Set(["px", "full", "screen"]), pn = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, gn = /\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$/, mn = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, hn = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, yn = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, fe = (e) => xe(e) || fn.has(e) || dn.test(e), be = (e) => Ce(e, "length", An), xe = (e) => !!e && !Number.isNaN(Number(e)), Ke = (e) => Ce(e, "number", xe), Pe = (e) => !!e && Number.isInteger(Number(e)), bn = (e) => e.endsWith("%") && xe(e.slice(0, -1)),
|
|
241
|
+
}, xt = /^\[(?:([a-z-]+):)?(.+)\]$/i, dn = /^\d+\/\d+$/, fn = /* @__PURE__ */ new Set(["px", "full", "screen"]), pn = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, gn = /\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$/, mn = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, hn = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, yn = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, fe = (e) => xe(e) || fn.has(e) || dn.test(e), be = (e) => Ce(e, "length", An), xe = (e) => !!e && !Number.isNaN(Number(e)), Ke = (e) => Ce(e, "number", xe), Pe = (e) => !!e && Number.isInteger(Number(e)), bn = (e) => e.endsWith("%") && xe(e.slice(0, -1)), U = (e) => xt.test(e), we = (e) => pn.test(e), wn = /* @__PURE__ */ new Set(["length", "size", "percentage"]), vn = (e) => Ce(e, wn, At), kn = (e) => Ce(e, "position", At), In = /* @__PURE__ */ new Set(["image", "url"]), Tn = (e) => Ce(e, In, Cn), xn = (e) => Ce(e, "", Sn), Ne = () => !0, Ce = (e, t, n) => {
|
|
242
242
|
const r = xt.exec(e);
|
|
243
243
|
return r ? r[1] ? typeof t == "string" ? r[1] === t : t.has(r[1]) : n(r[2]) : !1;
|
|
244
244
|
}, An = (e) => (
|
|
@@ -247,33 +247,33 @@ const $ = (e) => {
|
|
|
247
247
|
// I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
|
|
248
248
|
gn.test(e) && !mn.test(e)
|
|
249
249
|
), At = () => !1, Sn = (e) => hn.test(e), Cn = (e) => yn.test(e), Mn = () => {
|
|
250
|
-
const e =
|
|
250
|
+
const e = B("colors"), t = B("spacing"), n = B("blur"), r = B("brightness"), o = B("borderColor"), s = B("borderRadius"), a = B("borderSpacing"), i = B("borderWidth"), u = B("contrast"), c = B("grayscale"), l = B("hueRotate"), f = B("invert"), m = B("gap"), h = B("gradientColorStops"), k = B("gradientColorStopPositions"), d = B("inset"), v = B("margin"), I = B("opacity"), C = B("padding"), T = B("saturate"), N = B("scale"), w = B("sepia"), y = B("skew"), x = B("space"), p = B("translate"), b = () => ["auto", "contain", "none"], z = () => ["auto", "hidden", "clip", "visible", "scroll"], j = () => ["auto", U, t], M = () => [U, t], O = () => ["", fe, be], E = () => ["auto", xe, U], L = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], _ = () => ["solid", "dashed", "dotted", "double", "none"], G = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], F = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], P = () => ["", "0", U], V = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], Y = () => [xe, U];
|
|
251
251
|
return {
|
|
252
252
|
cacheSize: 500,
|
|
253
253
|
separator: ":",
|
|
254
254
|
theme: {
|
|
255
255
|
colors: [Ne],
|
|
256
256
|
spacing: [fe, be],
|
|
257
|
-
blur: ["none", "", we,
|
|
257
|
+
blur: ["none", "", we, U],
|
|
258
258
|
brightness: Y(),
|
|
259
259
|
borderColor: [e],
|
|
260
|
-
borderRadius: ["none", "", "full", we,
|
|
260
|
+
borderRadius: ["none", "", "full", we, U],
|
|
261
261
|
borderSpacing: M(),
|
|
262
|
-
borderWidth:
|
|
262
|
+
borderWidth: O(),
|
|
263
263
|
contrast: Y(),
|
|
264
|
-
grayscale:
|
|
264
|
+
grayscale: P(),
|
|
265
265
|
hueRotate: Y(),
|
|
266
|
-
invert:
|
|
266
|
+
invert: P(),
|
|
267
267
|
gap: M(),
|
|
268
268
|
gradientColorStops: [e],
|
|
269
269
|
gradientColorStopPositions: [bn, be],
|
|
270
|
-
inset:
|
|
271
|
-
margin:
|
|
270
|
+
inset: j(),
|
|
271
|
+
margin: j(),
|
|
272
272
|
opacity: Y(),
|
|
273
273
|
padding: M(),
|
|
274
274
|
saturate: Y(),
|
|
275
275
|
scale: Y(),
|
|
276
|
-
sepia:
|
|
276
|
+
sepia: P(),
|
|
277
277
|
skew: Y(),
|
|
278
278
|
space: M(),
|
|
279
279
|
translate: M()
|
|
@@ -285,7 +285,7 @@ const $ = (e) => {
|
|
|
285
285
|
* @see https://tailwindcss.com/docs/aspect-ratio
|
|
286
286
|
*/
|
|
287
287
|
aspect: [{
|
|
288
|
-
aspect: ["auto", "square", "video",
|
|
288
|
+
aspect: ["auto", "square", "video", U]
|
|
289
289
|
}],
|
|
290
290
|
/**
|
|
291
291
|
* Container
|
|
@@ -304,14 +304,14 @@ const $ = (e) => {
|
|
|
304
304
|
* @see https://tailwindcss.com/docs/break-after
|
|
305
305
|
*/
|
|
306
306
|
"break-after": [{
|
|
307
|
-
"break-after":
|
|
307
|
+
"break-after": V()
|
|
308
308
|
}],
|
|
309
309
|
/**
|
|
310
310
|
* Break Before
|
|
311
311
|
* @see https://tailwindcss.com/docs/break-before
|
|
312
312
|
*/
|
|
313
313
|
"break-before": [{
|
|
314
|
-
"break-before":
|
|
314
|
+
"break-before": V()
|
|
315
315
|
}],
|
|
316
316
|
/**
|
|
317
317
|
* Break Inside
|
|
@@ -370,49 +370,49 @@ const $ = (e) => {
|
|
|
370
370
|
* @see https://tailwindcss.com/docs/object-position
|
|
371
371
|
*/
|
|
372
372
|
"object-position": [{
|
|
373
|
-
object: [...
|
|
373
|
+
object: [...L(), U]
|
|
374
374
|
}],
|
|
375
375
|
/**
|
|
376
376
|
* Overflow
|
|
377
377
|
* @see https://tailwindcss.com/docs/overflow
|
|
378
378
|
*/
|
|
379
379
|
overflow: [{
|
|
380
|
-
overflow:
|
|
380
|
+
overflow: z()
|
|
381
381
|
}],
|
|
382
382
|
/**
|
|
383
383
|
* Overflow X
|
|
384
384
|
* @see https://tailwindcss.com/docs/overflow
|
|
385
385
|
*/
|
|
386
386
|
"overflow-x": [{
|
|
387
|
-
"overflow-x":
|
|
387
|
+
"overflow-x": z()
|
|
388
388
|
}],
|
|
389
389
|
/**
|
|
390
390
|
* Overflow Y
|
|
391
391
|
* @see https://tailwindcss.com/docs/overflow
|
|
392
392
|
*/
|
|
393
393
|
"overflow-y": [{
|
|
394
|
-
"overflow-y":
|
|
394
|
+
"overflow-y": z()
|
|
395
395
|
}],
|
|
396
396
|
/**
|
|
397
397
|
* Overscroll Behavior
|
|
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
|
|
@@ -492,7 +492,7 @@ const $ = (e) => {
|
|
|
492
492
|
* @see https://tailwindcss.com/docs/z-index
|
|
493
493
|
*/
|
|
494
494
|
z: [{
|
|
495
|
-
z: ["auto", Pe,
|
|
495
|
+
z: ["auto", Pe, U]
|
|
496
496
|
}],
|
|
497
497
|
// Flexbox and Grid
|
|
498
498
|
/**
|
|
@@ -500,7 +500,7 @@ const $ = (e) => {
|
|
|
500
500
|
* @see https://tailwindcss.com/docs/flex-basis
|
|
501
501
|
*/
|
|
502
502
|
basis: [{
|
|
503
|
-
basis:
|
|
503
|
+
basis: j()
|
|
504
504
|
}],
|
|
505
505
|
/**
|
|
506
506
|
* Flex Direction
|
|
@@ -521,28 +521,28 @@ const $ = (e) => {
|
|
|
521
521
|
* @see https://tailwindcss.com/docs/flex
|
|
522
522
|
*/
|
|
523
523
|
flex: [{
|
|
524
|
-
flex: ["1", "auto", "initial", "none",
|
|
524
|
+
flex: ["1", "auto", "initial", "none", U]
|
|
525
525
|
}],
|
|
526
526
|
/**
|
|
527
527
|
* Flex Grow
|
|
528
528
|
* @see https://tailwindcss.com/docs/flex-grow
|
|
529
529
|
*/
|
|
530
530
|
grow: [{
|
|
531
|
-
grow:
|
|
531
|
+
grow: P()
|
|
532
532
|
}],
|
|
533
533
|
/**
|
|
534
534
|
* Flex Shrink
|
|
535
535
|
* @see https://tailwindcss.com/docs/flex-shrink
|
|
536
536
|
*/
|
|
537
537
|
shrink: [{
|
|
538
|
-
shrink:
|
|
538
|
+
shrink: P()
|
|
539
539
|
}],
|
|
540
540
|
/**
|
|
541
541
|
* Order
|
|
542
542
|
* @see https://tailwindcss.com/docs/order
|
|
543
543
|
*/
|
|
544
544
|
order: [{
|
|
545
|
-
order: ["first", "last", "none", Pe,
|
|
545
|
+
order: ["first", "last", "none", Pe, U]
|
|
546
546
|
}],
|
|
547
547
|
/**
|
|
548
548
|
* Grid Template Columns
|
|
@@ -557,22 +557,22 @@ const $ = (e) => {
|
|
|
557
557
|
*/
|
|
558
558
|
"col-start-end": [{
|
|
559
559
|
col: ["auto", {
|
|
560
|
-
span: ["full", Pe,
|
|
561
|
-
},
|
|
560
|
+
span: ["full", Pe, U]
|
|
561
|
+
}, U]
|
|
562
562
|
}],
|
|
563
563
|
/**
|
|
564
564
|
* Grid Column Start
|
|
565
565
|
* @see https://tailwindcss.com/docs/grid-column
|
|
566
566
|
*/
|
|
567
567
|
"col-start": [{
|
|
568
|
-
"col-start":
|
|
568
|
+
"col-start": E()
|
|
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": E()
|
|
576
576
|
}],
|
|
577
577
|
/**
|
|
578
578
|
* Grid Template Rows
|
|
@@ -587,22 +587,22 @@ const $ = (e) => {
|
|
|
587
587
|
*/
|
|
588
588
|
"row-start-end": [{
|
|
589
589
|
row: ["auto", {
|
|
590
|
-
span: [Pe,
|
|
591
|
-
},
|
|
590
|
+
span: [Pe, U]
|
|
591
|
+
}, U]
|
|
592
592
|
}],
|
|
593
593
|
/**
|
|
594
594
|
* Grid Row Start
|
|
595
595
|
* @see https://tailwindcss.com/docs/grid-row
|
|
596
596
|
*/
|
|
597
597
|
"row-start": [{
|
|
598
|
-
"row-start":
|
|
598
|
+
"row-start": E()
|
|
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": E()
|
|
606
606
|
}],
|
|
607
607
|
/**
|
|
608
608
|
* Grid Auto Flow
|
|
@@ -616,14 +616,14 @@ const $ = (e) => {
|
|
|
616
616
|
* @see https://tailwindcss.com/docs/grid-auto-columns
|
|
617
617
|
*/
|
|
618
618
|
"auto-cols": [{
|
|
619
|
-
"auto-cols": ["auto", "min", "max", "fr",
|
|
619
|
+
"auto-cols": ["auto", "min", "max", "fr", U]
|
|
620
620
|
}],
|
|
621
621
|
/**
|
|
622
622
|
* Grid Auto Rows
|
|
623
623
|
* @see https://tailwindcss.com/docs/grid-auto-rows
|
|
624
624
|
*/
|
|
625
625
|
"auto-rows": [{
|
|
626
|
-
"auto-rows": ["auto", "min", "max", "fr",
|
|
626
|
+
"auto-rows": ["auto", "min", "max", "fr", U]
|
|
627
627
|
}],
|
|
628
628
|
/**
|
|
629
629
|
* Gap
|
|
@@ -651,7 +651,7 @@ const $ = (e) => {
|
|
|
651
651
|
* @see https://tailwindcss.com/docs/justify-content
|
|
652
652
|
*/
|
|
653
653
|
"justify-content": [{
|
|
654
|
-
justify: ["normal", ...
|
|
654
|
+
justify: ["normal", ...F()]
|
|
655
655
|
}],
|
|
656
656
|
/**
|
|
657
657
|
* Justify Items
|
|
@@ -672,7 +672,7 @@ const $ = (e) => {
|
|
|
672
672
|
* @see https://tailwindcss.com/docs/align-content
|
|
673
673
|
*/
|
|
674
674
|
"align-content": [{
|
|
675
|
-
content: ["normal", ...
|
|
675
|
+
content: ["normal", ...F(), "baseline"]
|
|
676
676
|
}],
|
|
677
677
|
/**
|
|
678
678
|
* Align Items
|
|
@@ -693,7 +693,7 @@ const $ = (e) => {
|
|
|
693
693
|
* @see https://tailwindcss.com/docs/place-content
|
|
694
694
|
*/
|
|
695
695
|
"place-content": [{
|
|
696
|
-
"place-content": [...
|
|
696
|
+
"place-content": [...F(), "baseline"]
|
|
697
697
|
}],
|
|
698
698
|
/**
|
|
699
699
|
* Place Items
|
|
@@ -866,21 +866,21 @@ const $ = (e) => {
|
|
|
866
866
|
* @see https://tailwindcss.com/docs/width
|
|
867
867
|
*/
|
|
868
868
|
w: [{
|
|
869
|
-
w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw",
|
|
869
|
+
w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw", U, t]
|
|
870
870
|
}],
|
|
871
871
|
/**
|
|
872
872
|
* Min-Width
|
|
873
873
|
* @see https://tailwindcss.com/docs/min-width
|
|
874
874
|
*/
|
|
875
875
|
"min-w": [{
|
|
876
|
-
"min-w": [
|
|
876
|
+
"min-w": [U, t, "min", "max", "fit"]
|
|
877
877
|
}],
|
|
878
878
|
/**
|
|
879
879
|
* Max-Width
|
|
880
880
|
* @see https://tailwindcss.com/docs/max-width
|
|
881
881
|
*/
|
|
882
882
|
"max-w": [{
|
|
883
|
-
"max-w": [
|
|
883
|
+
"max-w": [U, t, "none", "full", "min", "max", "fit", "prose", {
|
|
884
884
|
screen: [we]
|
|
885
885
|
}, we]
|
|
886
886
|
}],
|
|
@@ -889,28 +889,28 @@ const $ = (e) => {
|
|
|
889
889
|
* @see https://tailwindcss.com/docs/height
|
|
890
890
|
*/
|
|
891
891
|
h: [{
|
|
892
|
-
h: [
|
|
892
|
+
h: [U, t, "auto", "min", "max", "fit", "svh", "lvh", "dvh"]
|
|
893
893
|
}],
|
|
894
894
|
/**
|
|
895
895
|
* Min-Height
|
|
896
896
|
* @see https://tailwindcss.com/docs/min-height
|
|
897
897
|
*/
|
|
898
898
|
"min-h": [{
|
|
899
|
-
"min-h": [
|
|
899
|
+
"min-h": [U, t, "min", "max", "fit", "svh", "lvh", "dvh"]
|
|
900
900
|
}],
|
|
901
901
|
/**
|
|
902
902
|
* Max-Height
|
|
903
903
|
* @see https://tailwindcss.com/docs/max-height
|
|
904
904
|
*/
|
|
905
905
|
"max-h": [{
|
|
906
|
-
"max-h": [
|
|
906
|
+
"max-h": [U, t, "min", "max", "fit", "svh", "lvh", "dvh"]
|
|
907
907
|
}],
|
|
908
908
|
/**
|
|
909
909
|
* Size
|
|
910
910
|
* @see https://tailwindcss.com/docs/size
|
|
911
911
|
*/
|
|
912
912
|
size: [{
|
|
913
|
-
size: [
|
|
913
|
+
size: [U, t, "auto", "min", "max", "fit"]
|
|
914
914
|
}],
|
|
915
915
|
// Typography
|
|
916
916
|
/**
|
|
@@ -979,7 +979,7 @@ const $ = (e) => {
|
|
|
979
979
|
* @see https://tailwindcss.com/docs/letter-spacing
|
|
980
980
|
*/
|
|
981
981
|
tracking: [{
|
|
982
|
-
tracking: ["tighter", "tight", "normal", "wide", "wider", "widest",
|
|
982
|
+
tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", U]
|
|
983
983
|
}],
|
|
984
984
|
/**
|
|
985
985
|
* Line Clamp
|
|
@@ -993,21 +993,21 @@ const $ = (e) => {
|
|
|
993
993
|
* @see https://tailwindcss.com/docs/line-height
|
|
994
994
|
*/
|
|
995
995
|
leading: [{
|
|
996
|
-
leading: ["none", "tight", "snug", "normal", "relaxed", "loose", fe,
|
|
996
|
+
leading: ["none", "tight", "snug", "normal", "relaxed", "loose", fe, U]
|
|
997
997
|
}],
|
|
998
998
|
/**
|
|
999
999
|
* List Style Image
|
|
1000
1000
|
* @see https://tailwindcss.com/docs/list-style-image
|
|
1001
1001
|
*/
|
|
1002
1002
|
"list-image": [{
|
|
1003
|
-
"list-image": ["none",
|
|
1003
|
+
"list-image": ["none", U]
|
|
1004
1004
|
}],
|
|
1005
1005
|
/**
|
|
1006
1006
|
* List Style Type
|
|
1007
1007
|
* @see https://tailwindcss.com/docs/list-style-type
|
|
1008
1008
|
*/
|
|
1009
1009
|
"list-style-type": [{
|
|
1010
|
-
list: ["none", "disc", "decimal",
|
|
1010
|
+
list: ["none", "disc", "decimal", U]
|
|
1011
1011
|
}],
|
|
1012
1012
|
/**
|
|
1013
1013
|
* List Style Position
|
|
@@ -1062,7 +1062,7 @@ const $ = (e) => {
|
|
|
1062
1062
|
* @see https://tailwindcss.com/docs/text-decoration-style
|
|
1063
1063
|
*/
|
|
1064
1064
|
"text-decoration-style": [{
|
|
1065
|
-
decoration: [...
|
|
1065
|
+
decoration: [..._(), "wavy"]
|
|
1066
1066
|
}],
|
|
1067
1067
|
/**
|
|
1068
1068
|
* Text Decoration Thickness
|
|
@@ -1076,7 +1076,7 @@ const $ = (e) => {
|
|
|
1076
1076
|
* @see https://tailwindcss.com/docs/text-underline-offset
|
|
1077
1077
|
*/
|
|
1078
1078
|
"underline-offset": [{
|
|
1079
|
-
"underline-offset": ["auto", fe,
|
|
1079
|
+
"underline-offset": ["auto", fe, U]
|
|
1080
1080
|
}],
|
|
1081
1081
|
/**
|
|
1082
1082
|
* Text Decoration Color
|
|
@@ -1114,7 +1114,7 @@ const $ = (e) => {
|
|
|
1114
1114
|
* @see https://tailwindcss.com/docs/vertical-align
|
|
1115
1115
|
*/
|
|
1116
1116
|
"vertical-align": [{
|
|
1117
|
-
align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super",
|
|
1117
|
+
align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", U]
|
|
1118
1118
|
}],
|
|
1119
1119
|
/**
|
|
1120
1120
|
* Whitespace
|
|
@@ -1142,7 +1142,7 @@ const $ = (e) => {
|
|
|
1142
1142
|
* @see https://tailwindcss.com/docs/content
|
|
1143
1143
|
*/
|
|
1144
1144
|
content: [{
|
|
1145
|
-
content: ["none",
|
|
1145
|
+
content: ["none", U]
|
|
1146
1146
|
}],
|
|
1147
1147
|
// Backgrounds
|
|
1148
1148
|
/**
|
|
@@ -1179,7 +1179,7 @@ const $ = (e) => {
|
|
|
1179
1179
|
* @see https://tailwindcss.com/docs/background-position
|
|
1180
1180
|
*/
|
|
1181
1181
|
"bg-position": [{
|
|
1182
|
-
bg: [...
|
|
1182
|
+
bg: [...L(), kn]
|
|
1183
1183
|
}],
|
|
1184
1184
|
/**
|
|
1185
1185
|
* Background Repeat
|
|
@@ -1436,7 +1436,7 @@ const $ = (e) => {
|
|
|
1436
1436
|
* @see https://tailwindcss.com/docs/border-style
|
|
1437
1437
|
*/
|
|
1438
1438
|
"border-style": [{
|
|
1439
|
-
border: [...
|
|
1439
|
+
border: [..._(), "hidden"]
|
|
1440
1440
|
}],
|
|
1441
1441
|
/**
|
|
1442
1442
|
* Divide Width X
|
|
@@ -1474,7 +1474,7 @@ const $ = (e) => {
|
|
|
1474
1474
|
* @see https://tailwindcss.com/docs/divide-style
|
|
1475
1475
|
*/
|
|
1476
1476
|
"divide-style": [{
|
|
1477
|
-
divide:
|
|
1477
|
+
divide: _()
|
|
1478
1478
|
}],
|
|
1479
1479
|
/**
|
|
1480
1480
|
* Border Color
|
|
@@ -1551,14 +1551,14 @@ const $ = (e) => {
|
|
|
1551
1551
|
* @see https://tailwindcss.com/docs/outline-style
|
|
1552
1552
|
*/
|
|
1553
1553
|
"outline-style": [{
|
|
1554
|
-
outline: ["", ...
|
|
1554
|
+
outline: ["", ..._()]
|
|
1555
1555
|
}],
|
|
1556
1556
|
/**
|
|
1557
1557
|
* Outline Offset
|
|
1558
1558
|
* @see https://tailwindcss.com/docs/outline-offset
|
|
1559
1559
|
*/
|
|
1560
1560
|
"outline-offset": [{
|
|
1561
|
-
"outline-offset": [fe,
|
|
1561
|
+
"outline-offset": [fe, U]
|
|
1562
1562
|
}],
|
|
1563
1563
|
/**
|
|
1564
1564
|
* Outline Width
|
|
@@ -1579,7 +1579,7 @@ const $ = (e) => {
|
|
|
1579
1579
|
* @see https://tailwindcss.com/docs/ring-width
|
|
1580
1580
|
*/
|
|
1581
1581
|
"ring-w": [{
|
|
1582
|
-
ring:
|
|
1582
|
+
ring: O()
|
|
1583
1583
|
}],
|
|
1584
1584
|
/**
|
|
1585
1585
|
* Ring Width Inset
|
|
@@ -1641,14 +1641,14 @@ const $ = (e) => {
|
|
|
1641
1641
|
* @see https://tailwindcss.com/docs/mix-blend-mode
|
|
1642
1642
|
*/
|
|
1643
1643
|
"mix-blend": [{
|
|
1644
|
-
"mix-blend": [...
|
|
1644
|
+
"mix-blend": [...G(), "plus-lighter", "plus-darker"]
|
|
1645
1645
|
}],
|
|
1646
1646
|
/**
|
|
1647
1647
|
* Background Blend Mode
|
|
1648
1648
|
* @see https://tailwindcss.com/docs/background-blend-mode
|
|
1649
1649
|
*/
|
|
1650
1650
|
"bg-blend": [{
|
|
1651
|
-
"bg-blend":
|
|
1651
|
+
"bg-blend": G()
|
|
1652
1652
|
}],
|
|
1653
1653
|
// Filters
|
|
1654
1654
|
/**
|
|
@@ -1685,7 +1685,7 @@ const $ = (e) => {
|
|
|
1685
1685
|
* @see https://tailwindcss.com/docs/drop-shadow
|
|
1686
1686
|
*/
|
|
1687
1687
|
"drop-shadow": [{
|
|
1688
|
-
"drop-shadow": ["", "none", we,
|
|
1688
|
+
"drop-shadow": ["", "none", we, U]
|
|
1689
1689
|
}],
|
|
1690
1690
|
/**
|
|
1691
1691
|
* Grayscale
|
|
@@ -1720,7 +1720,7 @@ const $ = (e) => {
|
|
|
1720
1720
|
* @see https://tailwindcss.com/docs/sepia
|
|
1721
1721
|
*/
|
|
1722
1722
|
sepia: [{
|
|
1723
|
-
sepia: [
|
|
1723
|
+
sepia: [w]
|
|
1724
1724
|
}],
|
|
1725
1725
|
/**
|
|
1726
1726
|
* Backdrop Filter
|
|
@@ -1791,7 +1791,7 @@ const $ = (e) => {
|
|
|
1791
1791
|
* @see https://tailwindcss.com/docs/backdrop-sepia
|
|
1792
1792
|
*/
|
|
1793
1793
|
"backdrop-sepia": [{
|
|
1794
|
-
"backdrop-sepia": [
|
|
1794
|
+
"backdrop-sepia": [w]
|
|
1795
1795
|
}],
|
|
1796
1796
|
// Tables
|
|
1797
1797
|
/**
|
|
@@ -1842,7 +1842,7 @@ const $ = (e) => {
|
|
|
1842
1842
|
* @see https://tailwindcss.com/docs/transition-property
|
|
1843
1843
|
*/
|
|
1844
1844
|
transition: [{
|
|
1845
|
-
transition: ["none", "all", "", "colors", "opacity", "shadow", "transform",
|
|
1845
|
+
transition: ["none", "all", "", "colors", "opacity", "shadow", "transform", U]
|
|
1846
1846
|
}],
|
|
1847
1847
|
/**
|
|
1848
1848
|
* Transition Duration
|
|
@@ -1856,7 +1856,7 @@ const $ = (e) => {
|
|
|
1856
1856
|
* @see https://tailwindcss.com/docs/transition-timing-function
|
|
1857
1857
|
*/
|
|
1858
1858
|
ease: [{
|
|
1859
|
-
ease: ["linear", "in", "out", "in-out",
|
|
1859
|
+
ease: ["linear", "in", "out", "in-out", U]
|
|
1860
1860
|
}],
|
|
1861
1861
|
/**
|
|
1862
1862
|
* Transition Delay
|
|
@@ -1870,7 +1870,7 @@ const $ = (e) => {
|
|
|
1870
1870
|
* @see https://tailwindcss.com/docs/animation
|
|
1871
1871
|
*/
|
|
1872
1872
|
animate: [{
|
|
1873
|
-
animate: ["none", "spin", "ping", "pulse", "bounce",
|
|
1873
|
+
animate: ["none", "spin", "ping", "pulse", "bounce", U]
|
|
1874
1874
|
}],
|
|
1875
1875
|
// Transforms
|
|
1876
1876
|
/**
|
|
@@ -1885,28 +1885,28 @@ const $ = (e) => {
|
|
|
1885
1885
|
* @see https://tailwindcss.com/docs/scale
|
|
1886
1886
|
*/
|
|
1887
1887
|
scale: [{
|
|
1888
|
-
scale: [
|
|
1888
|
+
scale: [N]
|
|
1889
1889
|
}],
|
|
1890
1890
|
/**
|
|
1891
1891
|
* Scale X
|
|
1892
1892
|
* @see https://tailwindcss.com/docs/scale
|
|
1893
1893
|
*/
|
|
1894
1894
|
"scale-x": [{
|
|
1895
|
-
"scale-x": [
|
|
1895
|
+
"scale-x": [N]
|
|
1896
1896
|
}],
|
|
1897
1897
|
/**
|
|
1898
1898
|
* Scale Y
|
|
1899
1899
|
* @see https://tailwindcss.com/docs/scale
|
|
1900
1900
|
*/
|
|
1901
1901
|
"scale-y": [{
|
|
1902
|
-
"scale-y": [
|
|
1902
|
+
"scale-y": [N]
|
|
1903
1903
|
}],
|
|
1904
1904
|
/**
|
|
1905
1905
|
* Rotate
|
|
1906
1906
|
* @see https://tailwindcss.com/docs/rotate
|
|
1907
1907
|
*/
|
|
1908
1908
|
rotate: [{
|
|
1909
|
-
rotate: [Pe,
|
|
1909
|
+
rotate: [Pe, U]
|
|
1910
1910
|
}],
|
|
1911
1911
|
/**
|
|
1912
1912
|
* Translate X
|
|
@@ -1941,7 +1941,7 @@ const $ = (e) => {
|
|
|
1941
1941
|
* @see https://tailwindcss.com/docs/transform-origin
|
|
1942
1942
|
*/
|
|
1943
1943
|
"transform-origin": [{
|
|
1944
|
-
origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left",
|
|
1944
|
+
origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", U]
|
|
1945
1945
|
}],
|
|
1946
1946
|
// Interactivity
|
|
1947
1947
|
/**
|
|
@@ -1963,7 +1963,7 @@ const $ = (e) => {
|
|
|
1963
1963
|
* @see https://tailwindcss.com/docs/cursor
|
|
1964
1964
|
*/
|
|
1965
1965
|
cursor: [{
|
|
1966
|
-
cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out",
|
|
1966
|
+
cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", U]
|
|
1967
1967
|
}],
|
|
1968
1968
|
/**
|
|
1969
1969
|
* Caret Color
|
|
@@ -2185,7 +2185,7 @@ const $ = (e) => {
|
|
|
2185
2185
|
* @see https://tailwindcss.com/docs/will-change
|
|
2186
2186
|
*/
|
|
2187
2187
|
"will-change": [{
|
|
2188
|
-
"will-change": ["auto", "scroll", "contents", "transform",
|
|
2188
|
+
"will-change": ["auto", "scroll", "contents", "transform", U]
|
|
2189
2189
|
}],
|
|
2190
2190
|
// SVG
|
|
2191
2191
|
/**
|
|
@@ -2448,12 +2448,12 @@ function le(e) {
|
|
|
2448
2448
|
);
|
|
2449
2449
|
}
|
|
2450
2450
|
function tt(e) {
|
|
2451
|
-
var v, I, C, T,
|
|
2451
|
+
var v, I, C, T, N, w;
|
|
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(nt) : void 0, o = $n(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 ?? ((v = t.additionalKwargs) == null ? void 0 : v.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(), i = t.name ?? ((I = t.additionalKwargs) == null ? void 0 : I.agentName) ?? void 0, u = t.model ?? ((C = t.additionalKwargs) == null ? void 0 : C.model) ?? void 0, c = t.toolCallId ?? void 0, l = t.additionalKwargs ?? void 0, f = t.responseMetadata ?? void 0, m = t.checkpointId ?? ((T = t.additionalKwargs) == null ? void 0 : T.checkpointId) ?? void 0, h = t.checkpointNs ?? ((
|
|
2456
|
+
const r = Array.isArray(t.toolCalls) ? t.toolCalls.map(nt) : void 0, o = $n(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 ?? ((v = t.additionalKwargs) == null ? void 0 : v.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(), i = t.name ?? ((I = t.additionalKwargs) == null ? void 0 : I.agentName) ?? void 0, u = t.model ?? ((C = t.additionalKwargs) == null ? void 0 : C.model) ?? void 0, c = t.toolCallId ?? void 0, l = t.additionalKwargs ?? void 0, f = t.responseMetadata ?? void 0, m = t.checkpointId ?? ((T = t.additionalKwargs) == null ? void 0 : T.checkpointId) ?? void 0, h = t.checkpointNs ?? ((N = t.additionalKwargs) == null ? void 0 : N.checkpointNs) ?? void 0, k = typeof t.toolStreaming == "boolean" ? t.toolStreaming : !!((w = t.additionalKwargs) != null && w.toolStreaming);
|
|
2457
2457
|
return {
|
|
2458
2458
|
...t,
|
|
2459
2459
|
id: s,
|
|
@@ -2952,33 +2952,33 @@ function ir(e) {
|
|
|
2952
2952
|
return !!e && typeof e == "object" && "data" in e;
|
|
2953
2953
|
}
|
|
2954
2954
|
function cr(e = {}) {
|
|
2955
|
-
const t = e.baseUrl || "", n = e.streamPath ?? "/
|
|
2955
|
+
const t = e.baseUrl || "", n = e.streamPath ?? "/stream", [r, o] = $(e.token ?? null), s = K(e.headers ?? {}), a = e.credentials ?? "include", i = K(e);
|
|
2956
2956
|
q(() => {
|
|
2957
2957
|
i.current = e;
|
|
2958
2958
|
}, [e]);
|
|
2959
|
-
const u =
|
|
2960
|
-
var
|
|
2961
|
-
const
|
|
2962
|
-
if (!
|
|
2963
|
-
(
|
|
2964
|
-
}, []), [c, l] =
|
|
2959
|
+
const u = R((p) => {
|
|
2960
|
+
var j, M, O, E, L, _, G, F, P, V;
|
|
2961
|
+
const b = i.current;
|
|
2962
|
+
if (!b) return;
|
|
2963
|
+
(j = b.onEvent) == null || j.call(b, p), p.type === "thread_info" && ((M = b.onThreadInfo) == null || M.call(b, p)), p.type === "values" && Array.isArray(p.checkpoints) && ((O = b.handleValuesEvent) == null || O.call(b, p)), p.type === "metadata" && ((E = b.onMetadataEvent) == null || E.call(b, p)), typeof p.type == "string" && (p.type === "custom" || p.type.startsWith("custom.")) && ((L = b.onCustomEvent) == null || L.call(b, p)), p.type === "updates" && ((_ = b.onUpdateEvent) == null || _.call(b, p)), p.type === "tool.end" ? (G = b.onToolEnd) == null || G.call(b, p) : p.type === "tool.start" && ((F = b.onToolStart) == null || F.call(b, p)), p.type === "heartbeat" && ((P = b.onHeartbeat) == null || P.call(b, p)), p.type === "token" && ((V = b.onToken) == null || V.call(b, p.token));
|
|
2964
|
+
}, []), [c, l] = $(!1), [f, m] = $(null), [h, k] = $(!1), [d, v] = $(null), I = K(null), C = K(!0), T = K(null), N = R((p) => {
|
|
2965
2965
|
o(p);
|
|
2966
|
-
}, []),
|
|
2966
|
+
}, []), w = R(() => {
|
|
2967
2967
|
m(null), v(null);
|
|
2968
|
-
}, []), y =
|
|
2969
|
-
var M,
|
|
2968
|
+
}, []), y = R(() => {
|
|
2969
|
+
var M, O;
|
|
2970
2970
|
console.debug("[use-chat] stop() invoked - aborting stream");
|
|
2971
|
-
const p = (M = T.current) == null ? void 0 : M.threadId,
|
|
2972
|
-
var
|
|
2973
|
-
(
|
|
2971
|
+
const p = (M = T.current) == null ? void 0 : M.threadId, b = (O = T.current) == null ? void 0 : O.runId, z = () => {
|
|
2972
|
+
var E;
|
|
2973
|
+
(E = I.current) == null || E.abort(), I.current = null, T.current = null, l(!1), k(!1);
|
|
2974
2974
|
};
|
|
2975
|
-
(
|
|
2976
|
-
console.warn("[use-chat] cancel run failed:",
|
|
2977
|
-
}) : Promise.resolve()).finally(
|
|
2978
|
-
}, []), x =
|
|
2975
|
+
(b || p ? _t.cancelRun(b || p).catch((E) => {
|
|
2976
|
+
console.warn("[use-chat] cancel run failed:", E);
|
|
2977
|
+
}) : Promise.resolve()).finally(z);
|
|
2978
|
+
}, []), x = R(
|
|
2979
2979
|
(p) => {
|
|
2980
2980
|
I.current && (I.current.abort(), I.current = null);
|
|
2981
|
-
const
|
|
2981
|
+
const b = {
|
|
2982
2982
|
text: typeof p.content == "string" ? p.content : p.text,
|
|
2983
2983
|
threadId: p.threadId,
|
|
2984
2984
|
attachments: p.attachments,
|
|
@@ -2990,46 +2990,46 @@ function cr(e = {}) {
|
|
|
2990
2990
|
command: p.command
|
|
2991
2991
|
};
|
|
2992
2992
|
l(!0), m(null), v(null);
|
|
2993
|
-
const
|
|
2994
|
-
I.current =
|
|
2995
|
-
let
|
|
2993
|
+
const z = new AbortController();
|
|
2994
|
+
I.current = z;
|
|
2995
|
+
let j = null, M = !1;
|
|
2996
2996
|
return T.current = {
|
|
2997
|
-
threadId:
|
|
2997
|
+
threadId: b.threadId ?? void 0,
|
|
2998
2998
|
runId: void 0,
|
|
2999
2999
|
// Will be updated from headers
|
|
3000
3000
|
headers: {},
|
|
3001
3001
|
isStreaming: !0
|
|
3002
3002
|
}, (async () => {
|
|
3003
|
-
var
|
|
3003
|
+
var O, E, L, _, G, F;
|
|
3004
3004
|
try {
|
|
3005
|
-
let
|
|
3005
|
+
let P = {};
|
|
3006
3006
|
try {
|
|
3007
3007
|
if (r)
|
|
3008
|
-
|
|
3008
|
+
P = { Authorization: `Bearer ${r}` };
|
|
3009
3009
|
else if (typeof window < "u") {
|
|
3010
|
-
const te = window.__AUTH_TOKEN__, ve = ((
|
|
3010
|
+
const te = window.__AUTH_TOKEN__, ve = ((O = window.localStorage) == null ? void 0 : O.getItem(_e.authToken)) || null;
|
|
3011
3011
|
let X = null;
|
|
3012
3012
|
try {
|
|
3013
|
-
const me = (
|
|
3014
|
-
me && (X = ((
|
|
3013
|
+
const me = (E = window.localStorage) == null ? void 0 : E.getItem(_e.chatSettings);
|
|
3014
|
+
me && (X = ((L = JSON.parse(me)) == null ? void 0 : L.apiKey) || null);
|
|
3015
3015
|
} catch {
|
|
3016
3016
|
}
|
|
3017
3017
|
const Z = te || ve || X || null;
|
|
3018
|
-
Z && (
|
|
3018
|
+
Z && (P = { Authorization: `Bearer ${Z}` });
|
|
3019
3019
|
}
|
|
3020
3020
|
} catch {
|
|
3021
3021
|
}
|
|
3022
3022
|
console.debug("[use-chat] POST", t + n);
|
|
3023
|
-
let
|
|
3023
|
+
let V = {};
|
|
3024
3024
|
if (typeof window < "u")
|
|
3025
3025
|
try {
|
|
3026
|
-
const
|
|
3027
|
-
|
|
3026
|
+
const W = (_ = window.localStorage) == null ? void 0 : _.getItem(_e.authSessionId);
|
|
3027
|
+
W && (V = { "X-Session-Id": W });
|
|
3028
3028
|
} catch {
|
|
3029
3029
|
}
|
|
3030
3030
|
const Y = {
|
|
3031
|
-
...
|
|
3032
|
-
...
|
|
3031
|
+
...P,
|
|
3032
|
+
...V,
|
|
3033
3033
|
...s.current
|
|
3034
3034
|
}, g = {
|
|
3035
3035
|
"Content-Type": "application/json",
|
|
@@ -3038,36 +3038,36 @@ function cr(e = {}) {
|
|
|
3038
3038
|
}, A = await fetch(t + n, {
|
|
3039
3039
|
method: "POST",
|
|
3040
3040
|
headers: g,
|
|
3041
|
-
body: JSON.stringify(
|
|
3042
|
-
signal:
|
|
3041
|
+
body: JSON.stringify(b),
|
|
3042
|
+
signal: z.signal,
|
|
3043
3043
|
credentials: a
|
|
3044
3044
|
});
|
|
3045
3045
|
if (T.current && (T.current.headers = Y), !A.ok || !A.body) {
|
|
3046
|
-
const
|
|
3046
|
+
const W = await A.text().catch(() => "");
|
|
3047
3047
|
console.debug(
|
|
3048
3048
|
"[use-chat] non-OK response",
|
|
3049
3049
|
A.status,
|
|
3050
|
-
|
|
3050
|
+
W == null ? void 0 : W.slice(0, 500)
|
|
3051
3051
|
);
|
|
3052
|
-
const te = `stream ${A.status}${
|
|
3053
|
-
throw te && (m(te),
|
|
3052
|
+
const te = `stream ${A.status}${W ? ": " + W : ""}`;
|
|
3053
|
+
throw te && (m(te), j = "error"), new Error(te);
|
|
3054
3054
|
}
|
|
3055
3055
|
k(!0);
|
|
3056
|
-
const S = A.body.getReader(),
|
|
3056
|
+
const S = A.body.getReader(), H = new TextDecoder();
|
|
3057
3057
|
let J = "", D = 0, ee = Date.now();
|
|
3058
3058
|
const oe = setInterval(() => {
|
|
3059
|
-
Date.now() - ee > 18e5 && (m("Stream idle timeout"),
|
|
3059
|
+
Date.now() - ee > 18e5 && (m("Stream idle timeout"), j = "error", z.abort());
|
|
3060
3060
|
}, 5e3), ue = 1024 * 1024;
|
|
3061
3061
|
try {
|
|
3062
|
-
const
|
|
3062
|
+
const W = A.headers.get("X-Thread-Id") || A.headers.get("x-thread-id"), te = A.headers.get("X-Run-Id") || A.headers.get("x-run-id");
|
|
3063
3063
|
for (T.current && (T.current = {
|
|
3064
3064
|
...T.current,
|
|
3065
|
-
threadId:
|
|
3065
|
+
threadId: W ?? T.current.threadId,
|
|
3066
3066
|
runId: te ?? T.current.runId
|
|
3067
3067
|
}); ; ) {
|
|
3068
3068
|
const { value: ve, done: X } = await S.read();
|
|
3069
3069
|
if (X) break;
|
|
3070
|
-
J +=
|
|
3070
|
+
J += H.decode(ve, { stream: !0 }), J.length > ue && (J = "", console.warn("Stream buffer reset: exceeded 1MB"));
|
|
3071
3071
|
let Z;
|
|
3072
3072
|
for (; (Z = J.indexOf(`
|
|
3073
3073
|
|
|
@@ -3117,44 +3117,44 @@ function cr(e = {}) {
|
|
|
3117
3117
|
u(Ee);
|
|
3118
3118
|
}
|
|
3119
3119
|
}
|
|
3120
|
-
|
|
3121
|
-
} catch (
|
|
3122
|
-
if (
|
|
3123
|
-
|
|
3120
|
+
j === null && !z.signal.aborted && (j = "complete");
|
|
3121
|
+
} catch (W) {
|
|
3122
|
+
if (W.name === "AbortError")
|
|
3123
|
+
j = j ?? "aborted";
|
|
3124
3124
|
else {
|
|
3125
|
-
const te =
|
|
3126
|
-
|
|
3125
|
+
const te = W.message || String(W);
|
|
3126
|
+
j = "error", m(te);
|
|
3127
3127
|
}
|
|
3128
3128
|
} finally {
|
|
3129
3129
|
try {
|
|
3130
3130
|
await S.cancel();
|
|
3131
3131
|
} catch {
|
|
3132
3132
|
} finally {
|
|
3133
|
-
(
|
|
3133
|
+
(G = S.releaseLock) == null || G.call(S);
|
|
3134
3134
|
}
|
|
3135
3135
|
clearInterval(oe);
|
|
3136
3136
|
}
|
|
3137
|
-
} catch (
|
|
3138
|
-
if (
|
|
3139
|
-
|
|
3137
|
+
} catch (P) {
|
|
3138
|
+
if (P.name === "AbortError")
|
|
3139
|
+
j = j ?? "aborted";
|
|
3140
3140
|
else {
|
|
3141
|
-
const
|
|
3142
|
-
|
|
3141
|
+
const V = P.message || String(P);
|
|
3142
|
+
j = "error", m(V), M || (M = !0, (F = e.onConnectionError) == null || F.call(e, V));
|
|
3143
3143
|
}
|
|
3144
3144
|
} finally {
|
|
3145
3145
|
try {
|
|
3146
3146
|
if (e.onFinish) {
|
|
3147
|
-
const
|
|
3147
|
+
const P = {
|
|
3148
3148
|
lastSeq: 0,
|
|
3149
3149
|
lastCheckpointId: null,
|
|
3150
3150
|
lastCheckpointNs: null,
|
|
3151
3151
|
lastValues: null
|
|
3152
3152
|
// Let the reducer/history hook provide the final values
|
|
3153
3153
|
};
|
|
3154
|
-
e.onFinish(
|
|
3154
|
+
e.onFinish(P);
|
|
3155
3155
|
}
|
|
3156
|
-
} catch (
|
|
3157
|
-
console.warn("[use-chat] onClosed callback failed",
|
|
3156
|
+
} catch (P) {
|
|
3157
|
+
console.warn("[use-chat] onClosed callback failed", P);
|
|
3158
3158
|
}
|
|
3159
3159
|
l(!1), k(!1), I.current = null, T.current = null;
|
|
3160
3160
|
}
|
|
@@ -3179,8 +3179,8 @@ function cr(e = {}) {
|
|
|
3179
3179
|
connected: h,
|
|
3180
3180
|
stream: x,
|
|
3181
3181
|
stop: y,
|
|
3182
|
-
clear:
|
|
3183
|
-
setToken:
|
|
3182
|
+
clear: w,
|
|
3183
|
+
setToken: N,
|
|
3184
3184
|
values: {},
|
|
3185
3185
|
// Provide empty object for backward compatibility
|
|
3186
3186
|
interrupt: () => Promise.resolve(),
|
|
@@ -3199,19 +3199,19 @@ function lr({
|
|
|
3199
3199
|
onThreadChange: r,
|
|
3200
3200
|
onCurrentThreadDeleted: o
|
|
3201
3201
|
}) {
|
|
3202
|
-
const [s, a] =
|
|
3202
|
+
const [s, a] = $([]), [i, u] = $(t), [c, l] = $(!1), [f, m] = $(null), h = K(i), k = K(/* @__PURE__ */ new Map());
|
|
3203
3203
|
q(() => {
|
|
3204
3204
|
h.current = i;
|
|
3205
3205
|
}, [i]), q(() => {
|
|
3206
3206
|
t !== void 0 && t !== h.current && u(t);
|
|
3207
3207
|
}, [t]);
|
|
3208
|
-
const d =
|
|
3208
|
+
const d = R(async () => {
|
|
3209
3209
|
l(!0), m(null);
|
|
3210
3210
|
try {
|
|
3211
|
-
const
|
|
3212
|
-
a(
|
|
3213
|
-
} catch (
|
|
3214
|
-
const y = String(
|
|
3211
|
+
const w = await e.listThreads();
|
|
3212
|
+
a(w ?? []);
|
|
3213
|
+
} catch (w) {
|
|
3214
|
+
const y = String(w);
|
|
3215
3215
|
m(y), n == null || n(y);
|
|
3216
3216
|
} finally {
|
|
3217
3217
|
l(!1);
|
|
@@ -3222,10 +3222,10 @@ function lr({
|
|
|
3222
3222
|
}, [d]), q(() => {
|
|
3223
3223
|
r == null || r(i);
|
|
3224
3224
|
}, [i, r]);
|
|
3225
|
-
const v =
|
|
3226
|
-
async (
|
|
3225
|
+
const v = R(
|
|
3226
|
+
async (w, y) => {
|
|
3227
3227
|
try {
|
|
3228
|
-
const x = y && typeof y == "object" ? { id: y.id, name: y.name ?? "" } : void 0, p = await e.createThread(
|
|
3228
|
+
const x = y && typeof y == "object" ? { id: y.id, name: y.name ?? "" } : void 0, p = await e.createThread(w, x);
|
|
3229
3229
|
return u(p.threadId), await d(), p.threadId;
|
|
3230
3230
|
} catch (x) {
|
|
3231
3231
|
const p = String(x);
|
|
@@ -3233,27 +3233,27 @@ function lr({
|
|
|
3233
3233
|
}
|
|
3234
3234
|
},
|
|
3235
3235
|
[e, n, d]
|
|
3236
|
-
), I =
|
|
3237
|
-
async (
|
|
3236
|
+
), I = R(
|
|
3237
|
+
async (w) => {
|
|
3238
3238
|
const y = s;
|
|
3239
|
-
a((p) => p.filter((
|
|
3239
|
+
a((p) => p.filter((b) => b.threadId !== w));
|
|
3240
3240
|
const x = new AbortController();
|
|
3241
|
-
k.current.set(
|
|
3241
|
+
k.current.set(w, x);
|
|
3242
3242
|
try {
|
|
3243
|
-
await e.deleteThread(
|
|
3243
|
+
await e.deleteThread(w), h.current === w && (u(null), o == null || o());
|
|
3244
3244
|
} catch (p) {
|
|
3245
3245
|
a(y);
|
|
3246
|
-
const
|
|
3247
|
-
n == null || n(
|
|
3246
|
+
const b = String(p);
|
|
3247
|
+
n == null || n(b);
|
|
3248
3248
|
} finally {
|
|
3249
|
-
k.current.delete(
|
|
3249
|
+
k.current.delete(w);
|
|
3250
3250
|
}
|
|
3251
3251
|
},
|
|
3252
3252
|
[e, o, n, s]
|
|
3253
|
-
), C =
|
|
3254
|
-
async (
|
|
3253
|
+
), C = R(
|
|
3254
|
+
async (w, y) => {
|
|
3255
3255
|
try {
|
|
3256
|
-
await e.updateThread(
|
|
3256
|
+
await e.updateThread(w, y), await d();
|
|
3257
3257
|
} catch (x) {
|
|
3258
3258
|
n == null || n(String(x));
|
|
3259
3259
|
}
|
|
@@ -3267,26 +3267,26 @@ function lr({
|
|
|
3267
3267
|
refreshThreads: d
|
|
3268
3268
|
}),
|
|
3269
3269
|
[v, I, C, d]
|
|
3270
|
-
),
|
|
3271
|
-
if (!(
|
|
3270
|
+
), N = R((w) => {
|
|
3271
|
+
if (!(w != null && w.threadId)) return;
|
|
3272
3272
|
const y = {
|
|
3273
|
-
threadId:
|
|
3274
|
-
title:
|
|
3275
|
-
project:
|
|
3276
|
-
createdAt:
|
|
3277
|
-
updatedAt:
|
|
3278
|
-
messageCount:
|
|
3273
|
+
threadId: w.threadId,
|
|
3274
|
+
title: w.title || `Thread ${w.threadId.slice(0, 8)}`,
|
|
3275
|
+
project: w.project,
|
|
3276
|
+
createdAt: w.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
3277
|
+
updatedAt: w.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
3278
|
+
messageCount: w.messageCount ?? 1
|
|
3279
3279
|
};
|
|
3280
3280
|
a((x) => {
|
|
3281
3281
|
let p = !1;
|
|
3282
|
-
const
|
|
3283
|
-
...
|
|
3284
|
-
title: y.title ??
|
|
3285
|
-
project: y.project ??
|
|
3286
|
-
updatedAt: y.updatedAt ??
|
|
3287
|
-
messageCount: y.messageCount ??
|
|
3288
|
-
}) :
|
|
3289
|
-
return p ?
|
|
3282
|
+
const b = x.map((z) => z.threadId === y.threadId ? (p = !0, console.debug("[useThreadsState] thread_info: updating existing thread", y.threadId), {
|
|
3283
|
+
...z,
|
|
3284
|
+
title: y.title ?? z.title,
|
|
3285
|
+
project: y.project ?? z.project,
|
|
3286
|
+
updatedAt: y.updatedAt ?? z.updatedAt,
|
|
3287
|
+
messageCount: y.messageCount ?? z.messageCount
|
|
3288
|
+
}) : z);
|
|
3289
|
+
return p ? b : (console.debug("[useThreadsState] thread_info: adding thread to list", y.threadId), [y, ...x]);
|
|
3290
3290
|
});
|
|
3291
3291
|
}, []);
|
|
3292
3292
|
return {
|
|
@@ -3297,7 +3297,7 @@ function lr({
|
|
|
3297
3297
|
isLoadingThreads: c,
|
|
3298
3298
|
threadsError: f,
|
|
3299
3299
|
actions: T,
|
|
3300
|
-
addThreadFromEvent:
|
|
3300
|
+
addThreadFromEvent: N
|
|
3301
3301
|
};
|
|
3302
3302
|
}
|
|
3303
3303
|
const jt = Se(null);
|
|
@@ -3462,13 +3462,13 @@ function gr(e, t) {
|
|
|
3462
3462
|
}
|
|
3463
3463
|
}
|
|
3464
3464
|
function mr(e = []) {
|
|
3465
|
-
const [t, n] = Wt(gr, { ...Ot, messages: e }), r = K([]), o = K(null), s =
|
|
3465
|
+
const [t, n] = Wt(gr, { ...Ot, messages: e }), r = K([]), o = K(null), s = R(() => {
|
|
3466
3466
|
o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), o.current = null;
|
|
3467
3467
|
const c = r.current;
|
|
3468
3468
|
c.length && (r.current = [], n({ type: "batch", payload: { events: c } }));
|
|
3469
|
-
}, []), a =
|
|
3469
|
+
}, []), a = R(() => {
|
|
3470
3470
|
typeof window < "u" && typeof window.requestAnimationFrame == "function" ? o.current === null && (o.current = window.requestAnimationFrame(() => s())) : setTimeout(s, 8);
|
|
3471
|
-
}, [s]), i =
|
|
3471
|
+
}, [s]), i = R((c) => {
|
|
3472
3472
|
r.current.push(c), a();
|
|
3473
3473
|
}, [a]), u = Q(() => ({
|
|
3474
3474
|
setStatus: (c, l) => n({ type: "status", payload: { status: c, error: l } }),
|
|
@@ -3714,9 +3714,9 @@ function gt(e) {
|
|
|
3714
3714
|
};
|
|
3715
3715
|
}
|
|
3716
3716
|
function Tr(e, t) {
|
|
3717
|
-
var
|
|
3717
|
+
var w, y;
|
|
3718
3718
|
if (!e) return null;
|
|
3719
|
-
const n = ((
|
|
3719
|
+
const n = ((w = e.values) == null ? void 0 : w.activeAgent) ?? null, r = (y = e.values) == null ? void 0 : y.messages, s = (Array.isArray(r) ? r : []).map((x) => xr(x, n)).filter((x) => !!x), a = ze(e.metadata) ?? {}, i = pt(e.config), u = ze(e.parentConfig), c = pt(u), l = Fe(i, ["checkpointId"]), f = Fe(i, ["checkpointNs"]), m = Fe(c, ["checkpointId"]), h = ze(e.config), k = Array.isArray(e.tasks) ? e.tasks.map((x) => ({ ...x })) : e.tasks ?? null, d = Array.isArray(e.next) ? [...e.next] : e.next ?? null, v = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), I = {
|
|
3720
3720
|
...a,
|
|
3721
3721
|
step: kr(a, ["step"]) ?? 0,
|
|
3722
3722
|
source: Fe(a, ["source"]) ?? null
|
|
@@ -3724,7 +3724,7 @@ function Tr(e, t) {
|
|
|
3724
3724
|
...x,
|
|
3725
3725
|
checkpointId: x.checkpointId ?? l ?? null,
|
|
3726
3726
|
checkpointNs: x.checkpointNs ?? f ?? null
|
|
3727
|
-
})), T = e.values,
|
|
3727
|
+
})), T = e.values, N = Array.isArray(e.interrupts) ? e.interrupts : Array.isArray(T == null ? void 0 : T.interrupts) ? T.interrupts : [];
|
|
3728
3728
|
return {
|
|
3729
3729
|
checkpointId: l ?? null,
|
|
3730
3730
|
checkpointNs: f ?? null,
|
|
@@ -3732,7 +3732,7 @@ function Tr(e, t) {
|
|
|
3732
3732
|
parentId: m ?? null,
|
|
3733
3733
|
messages: C,
|
|
3734
3734
|
interrupt: Ar(
|
|
3735
|
-
|
|
3735
|
+
N,
|
|
3736
3736
|
t,
|
|
3737
3737
|
l ?? null
|
|
3738
3738
|
),
|
|
@@ -3790,7 +3790,7 @@ function Mr(e) {
|
|
|
3790
3790
|
const C = Array.isArray(l.messages) ? l.messages : [];
|
|
3791
3791
|
for (const y of C)
|
|
3792
3792
|
y.role === "user" && (I || (I = y), y.id && (v = y.id));
|
|
3793
|
-
const T = l.next && l.next.length > 0 ? String(l.next[0]) : null,
|
|
3793
|
+
const T = l.next && l.next.length > 0 ? String(l.next[0]) : null, N = l.parentConfig ?? null, w = {
|
|
3794
3794
|
id: m,
|
|
3795
3795
|
step: k,
|
|
3796
3796
|
source: d,
|
|
@@ -3798,10 +3798,10 @@ function Mr(e) {
|
|
|
3798
3798
|
namespace: l.checkpointNs ?? null,
|
|
3799
3799
|
parentId: l.parentId ?? null,
|
|
3800
3800
|
next: T,
|
|
3801
|
-
parentConfig:
|
|
3801
|
+
parentConfig: N,
|
|
3802
3802
|
userMessageId: v
|
|
3803
3803
|
};
|
|
3804
|
-
if (o.push(
|
|
3804
|
+
if (o.push(w), f && t.set(f, w), f && I) {
|
|
3805
3805
|
const y = Cr(I);
|
|
3806
3806
|
y && r.set(f, y);
|
|
3807
3807
|
}
|
|
@@ -3812,7 +3812,7 @@ function Mr(e) {
|
|
|
3812
3812
|
source: d,
|
|
3813
3813
|
createdAt: l.createdAt ?? null,
|
|
3814
3814
|
next: T,
|
|
3815
|
-
parentConfig:
|
|
3815
|
+
parentConfig: N
|
|
3816
3816
|
});
|
|
3817
3817
|
}
|
|
3818
3818
|
const s = /* @__PURE__ */ new Map();
|
|
@@ -3885,116 +3885,116 @@ function Bt({
|
|
|
3885
3885
|
isStreaming: a,
|
|
3886
3886
|
getMessages: i
|
|
3887
3887
|
}) {
|
|
3888
|
-
const [u, c] =
|
|
3888
|
+
const [u, c] = $(null), f = Q(
|
|
3889
3889
|
() => gt(u),
|
|
3890
3890
|
[u]
|
|
3891
|
-
).checkpoints, m = Er(f), h = m.timeline, [k, d] =
|
|
3891
|
+
).checkpoints, m = Er(f), h = m.timeline, [k, d] = $(!1), [v, I] = $(!1), [C, T] = $(null), N = K(o), w = K(null), y = K(null), x = K(null);
|
|
3892
3892
|
q(() => {
|
|
3893
|
-
|
|
3893
|
+
N.current = o;
|
|
3894
3894
|
}, [o]);
|
|
3895
|
-
const
|
|
3895
|
+
const p = R(
|
|
3896
3896
|
async (E) => {
|
|
3897
|
-
const
|
|
3897
|
+
const L = await e.getState({
|
|
3898
3898
|
threadId: E.threadId,
|
|
3899
3899
|
checkpointId: E.checkpointId,
|
|
3900
3900
|
checkpointNs: E.checkpointNs
|
|
3901
|
-
}),
|
|
3901
|
+
}), _ = {
|
|
3902
3902
|
version: "values@1",
|
|
3903
3903
|
threadId: E.threadId,
|
|
3904
|
-
checkpoints: [
|
|
3905
|
-
},
|
|
3906
|
-
return
|
|
3904
|
+
checkpoints: [L]
|
|
3905
|
+
}, G = t ? await Ir(_, t) : _, { latest: F } = gt(G);
|
|
3906
|
+
return F;
|
|
3907
3907
|
},
|
|
3908
3908
|
[e, t]
|
|
3909
|
-
),
|
|
3910
|
-
async (E,
|
|
3911
|
-
var
|
|
3909
|
+
), b = R(
|
|
3910
|
+
async (E, L) => {
|
|
3911
|
+
var F;
|
|
3912
3912
|
if (!E) return;
|
|
3913
|
-
const
|
|
3914
|
-
if (
|
|
3915
|
-
(
|
|
3916
|
-
const
|
|
3917
|
-
|
|
3913
|
+
const _ = `${E}:${L ?? "latest"}`;
|
|
3914
|
+
if (y.current === _ || w.current === _) return;
|
|
3915
|
+
y.current = _, (F = x.current) == null || F.abort();
|
|
3916
|
+
const G = new AbortController();
|
|
3917
|
+
x.current = G, d(!0), T(null);
|
|
3918
3918
|
try {
|
|
3919
|
-
const
|
|
3919
|
+
const P = await p({
|
|
3920
3920
|
threadId: E,
|
|
3921
|
-
checkpointId:
|
|
3921
|
+
checkpointId: L ?? void 0
|
|
3922
3922
|
});
|
|
3923
|
-
if (
|
|
3924
|
-
n((
|
|
3925
|
-
checkpointId: (
|
|
3926
|
-
checkpointNs: (
|
|
3927
|
-
pendingInterrupt: (
|
|
3928
|
-
values:
|
|
3929
|
-
}),
|
|
3930
|
-
const
|
|
3923
|
+
if (N.current !== E) return;
|
|
3924
|
+
n((P == null ? void 0 : P.messages) ?? [], {
|
|
3925
|
+
checkpointId: (P == null ? void 0 : P.checkpointId) ?? null,
|
|
3926
|
+
checkpointNs: (P == null ? void 0 : P.checkpointNs) ?? null,
|
|
3927
|
+
pendingInterrupt: (P == null ? void 0 : P.interrupt) ?? null,
|
|
3928
|
+
values: P == null ? void 0 : P.values
|
|
3929
|
+
}), w.current = _;
|
|
3930
|
+
const V = await e.getStateHistory({
|
|
3931
3931
|
threadId: E,
|
|
3932
3932
|
limit: 100,
|
|
3933
3933
|
includeMessages: !1
|
|
3934
3934
|
});
|
|
3935
|
-
|
|
3936
|
-
} catch (
|
|
3937
|
-
if (!Jt(
|
|
3938
|
-
const
|
|
3939
|
-
T(
|
|
3935
|
+
N.current === E && c(V);
|
|
3936
|
+
} catch (P) {
|
|
3937
|
+
if (!Jt(P)) {
|
|
3938
|
+
const V = String(P);
|
|
3939
|
+
T(V), r == null || r(V);
|
|
3940
3940
|
}
|
|
3941
3941
|
} finally {
|
|
3942
|
-
d(!1);
|
|
3942
|
+
y.current = null, d(!1);
|
|
3943
3943
|
}
|
|
3944
3944
|
},
|
|
3945
|
-
[e, n,
|
|
3946
|
-
),
|
|
3947
|
-
async (E,
|
|
3945
|
+
[e, n, p, r, k, i]
|
|
3946
|
+
), z = R(
|
|
3947
|
+
async (E, L) => {
|
|
3948
3948
|
if (o) {
|
|
3949
3949
|
I(!0);
|
|
3950
3950
|
try {
|
|
3951
|
-
const
|
|
3951
|
+
const _ = await p({
|
|
3952
3952
|
threadId: o,
|
|
3953
3953
|
checkpointId: E,
|
|
3954
|
-
checkpointNs:
|
|
3954
|
+
checkpointNs: L ?? void 0
|
|
3955
3955
|
});
|
|
3956
|
-
n((
|
|
3957
|
-
checkpointId: (
|
|
3958
|
-
checkpointNs: (
|
|
3959
|
-
pendingInterrupt: (
|
|
3960
|
-
values:
|
|
3956
|
+
n((_ == null ? void 0 : _.messages) ?? [], {
|
|
3957
|
+
checkpointId: (_ == null ? void 0 : _.checkpointId) ?? E,
|
|
3958
|
+
checkpointNs: (_ == null ? void 0 : _.checkpointNs) ?? L,
|
|
3959
|
+
pendingInterrupt: (_ == null ? void 0 : _.interrupt) ?? null,
|
|
3960
|
+
values: _ == null ? void 0 : _.values
|
|
3961
3961
|
});
|
|
3962
|
-
} catch (
|
|
3963
|
-
console.error("[useThreadHistoryState] Navigation failed",
|
|
3962
|
+
} catch (_) {
|
|
3963
|
+
console.error("[useThreadHistoryState] Navigation failed", _);
|
|
3964
3964
|
} finally {
|
|
3965
3965
|
I(!1);
|
|
3966
3966
|
}
|
|
3967
3967
|
}
|
|
3968
3968
|
},
|
|
3969
|
-
[o,
|
|
3970
|
-
),
|
|
3971
|
-
o && await
|
|
3972
|
-
}, [o,
|
|
3969
|
+
[o, p, n]
|
|
3970
|
+
), j = R(async () => {
|
|
3971
|
+
o && await b(o);
|
|
3972
|
+
}, [o, b]), M = R(
|
|
3973
3973
|
async (E) => {
|
|
3974
|
-
var
|
|
3975
|
-
const
|
|
3976
|
-
if (!
|
|
3977
|
-
if (c(E),
|
|
3978
|
-
const
|
|
3979
|
-
threadId:
|
|
3974
|
+
var G;
|
|
3975
|
+
const L = (E == null ? void 0 : E.threadId) || o;
|
|
3976
|
+
if (!L || o !== L) return;
|
|
3977
|
+
if (c(E), w.current = `${L}:latest`, (G = E.values) != null && G.messages) {
|
|
3978
|
+
const F = await p({
|
|
3979
|
+
threadId: L
|
|
3980
3980
|
});
|
|
3981
|
-
|
|
3982
|
-
checkpointId:
|
|
3983
|
-
checkpointNs:
|
|
3984
|
-
pendingInterrupt:
|
|
3985
|
-
values:
|
|
3981
|
+
F && n(F.messages ?? [], {
|
|
3982
|
+
checkpointId: F.checkpointId ?? null,
|
|
3983
|
+
checkpointNs: F.checkpointNs ?? null,
|
|
3984
|
+
pendingInterrupt: F.interrupt ?? null,
|
|
3985
|
+
values: F.values
|
|
3986
3986
|
});
|
|
3987
3987
|
}
|
|
3988
3988
|
},
|
|
3989
|
-
[o,
|
|
3989
|
+
[o, p, n]
|
|
3990
3990
|
);
|
|
3991
3991
|
q(() => {
|
|
3992
3992
|
if (!s || !o || k || a) return;
|
|
3993
3993
|
const E = `${o}:latest`;
|
|
3994
|
-
|
|
3995
|
-
}, [s, o, k, a,
|
|
3996
|
-
const
|
|
3997
|
-
c(null), d(!1), I(!1), T(null),
|
|
3994
|
+
w.current !== E && b(o);
|
|
3995
|
+
}, [s, o, k, a, b]);
|
|
3996
|
+
const O = R(() => {
|
|
3997
|
+
c(null), d(!1), I(!1), T(null), w.current = null;
|
|
3998
3998
|
}, []);
|
|
3999
3999
|
return {
|
|
4000
4000
|
threadCheckpoints: f,
|
|
@@ -4003,19 +4003,19 @@ function Bt({
|
|
|
4003
4003
|
isLoadingThread: k,
|
|
4004
4004
|
isLoadingCheckpoint: v,
|
|
4005
4005
|
threadStateError: C,
|
|
4006
|
-
loadThread:
|
|
4007
|
-
navigateToCheckpoint:
|
|
4008
|
-
setCurrentCheckpointId: (E,
|
|
4009
|
-
n(i(), { checkpointId: E, checkpointNs:
|
|
4006
|
+
loadThread: b,
|
|
4007
|
+
navigateToCheckpoint: z,
|
|
4008
|
+
setCurrentCheckpointId: (E, L) => {
|
|
4009
|
+
n(i(), { checkpointId: E, checkpointNs: L });
|
|
4010
4010
|
},
|
|
4011
|
-
returnToLatest:
|
|
4012
|
-
handleValuesEvent:
|
|
4011
|
+
returnToLatest: j,
|
|
4012
|
+
handleValuesEvent: M,
|
|
4013
4013
|
markSkipNextLoad: () => {
|
|
4014
4014
|
},
|
|
4015
4015
|
markStreamPendingThread: () => {
|
|
4016
4016
|
},
|
|
4017
|
-
resetHistoryState:
|
|
4018
|
-
clearState:
|
|
4017
|
+
resetHistoryState: O,
|
|
4018
|
+
clearState: O
|
|
4019
4019
|
};
|
|
4020
4020
|
}
|
|
4021
4021
|
const $t = Se(null), Vt = Se(null);
|
|
@@ -4046,14 +4046,14 @@ function Nr({
|
|
|
4046
4046
|
isLoadingThread: I,
|
|
4047
4047
|
isLoadingCheckpoint: C,
|
|
4048
4048
|
threadStateError: T,
|
|
4049
|
-
loadThread:
|
|
4050
|
-
navigateToCheckpoint:
|
|
4049
|
+
loadThread: N,
|
|
4050
|
+
navigateToCheckpoint: w,
|
|
4051
4051
|
setCurrentCheckpointId: y,
|
|
4052
4052
|
returnToLatest: x,
|
|
4053
4053
|
handleValuesEvent: p,
|
|
4054
|
-
markSkipNextLoad:
|
|
4055
|
-
markStreamPendingThread:
|
|
4056
|
-
resetHistoryState:
|
|
4054
|
+
markSkipNextLoad: b,
|
|
4055
|
+
markStreamPendingThread: z,
|
|
4056
|
+
resetHistoryState: j
|
|
4057
4057
|
} = Bt({
|
|
4058
4058
|
api: i,
|
|
4059
4059
|
fileApi: u,
|
|
@@ -4065,34 +4065,34 @@ function Nr({
|
|
|
4065
4065
|
initialCheckpointNs: r,
|
|
4066
4066
|
autoLoadInitial: o,
|
|
4067
4067
|
isStreaming: s,
|
|
4068
|
-
getMessages:
|
|
4069
|
-
}), M = K(null),
|
|
4068
|
+
getMessages: R(() => l.messages, [l.messages])
|
|
4069
|
+
}), M = K(null), O = R(
|
|
4070
4070
|
(A) => {
|
|
4071
4071
|
M.current = A;
|
|
4072
4072
|
},
|
|
4073
4073
|
[]
|
|
4074
|
-
),
|
|
4074
|
+
), E = K(null), L = R(
|
|
4075
4075
|
(A) => {
|
|
4076
|
-
|
|
4076
|
+
E.current = A;
|
|
4077
4077
|
},
|
|
4078
4078
|
[]
|
|
4079
|
-
),
|
|
4079
|
+
), _ = Q(() => ({ assemblingMessageId: l.assemblingId ?? null }), [l.assemblingId]), G = R(
|
|
4080
4080
|
(A, S) => {
|
|
4081
|
-
const
|
|
4081
|
+
const H = Ut(A, "user");
|
|
4082
4082
|
return h({
|
|
4083
4083
|
type: "user_message",
|
|
4084
4084
|
payload: {
|
|
4085
|
-
message:
|
|
4085
|
+
message: H,
|
|
4086
4086
|
editingMessageId: S == null ? void 0 : S.editingMessageId
|
|
4087
4087
|
}
|
|
4088
|
-
}),
|
|
4088
|
+
}), H;
|
|
4089
4089
|
},
|
|
4090
4090
|
[h]
|
|
4091
|
-
),
|
|
4092
|
-
M.current ? await M.current() : (f([], {}),
|
|
4093
|
-
}, [f,
|
|
4094
|
-
await
|
|
4095
|
-
}, [
|
|
4091
|
+
), F = R(async () => {
|
|
4092
|
+
M.current ? await M.current() : (f([], {}), j());
|
|
4093
|
+
}, [f, j]), P = R(async (A, S, H) => {
|
|
4094
|
+
await N(A, S, { clearProgress: !1 });
|
|
4095
|
+
}, [N]), V = Q(() => Ln(l.messages), [l.messages]), Y = Q(
|
|
4096
4096
|
() => ({
|
|
4097
4097
|
status: l.status,
|
|
4098
4098
|
threadId: c,
|
|
@@ -4106,7 +4106,7 @@ function Nr({
|
|
|
4106
4106
|
checkpoints: k,
|
|
4107
4107
|
checkpointIndex: v,
|
|
4108
4108
|
timelineCheckpoints: d,
|
|
4109
|
-
metadata:
|
|
4109
|
+
metadata: _,
|
|
4110
4110
|
values: l.values ?? {},
|
|
4111
4111
|
isLoading: I,
|
|
4112
4112
|
isLoadingCheckpoint: C,
|
|
@@ -4122,23 +4122,23 @@ function Nr({
|
|
|
4122
4122
|
values: A.values
|
|
4123
4123
|
});
|
|
4124
4124
|
},
|
|
4125
|
-
clearState:
|
|
4126
|
-
navigateToCheckpoint:
|
|
4125
|
+
clearState: F,
|
|
4126
|
+
navigateToCheckpoint: w,
|
|
4127
4127
|
setCurrentCheckpointId: y,
|
|
4128
4128
|
returnToLatest: x,
|
|
4129
|
-
loadThread:
|
|
4130
|
-
clearThread:
|
|
4131
|
-
respondToInterrupt: async (A, S,
|
|
4132
|
-
|
|
4129
|
+
loadThread: P,
|
|
4130
|
+
clearThread: F,
|
|
4131
|
+
respondToInterrupt: async (A, S, H) => {
|
|
4132
|
+
E.current && await E.current(A, S, H);
|
|
4133
4133
|
},
|
|
4134
4134
|
messagePreviews: v.messagePreviews,
|
|
4135
4135
|
handleValuesEvent: p,
|
|
4136
|
-
markSkipNextLoad:
|
|
4137
|
-
markStreamPendingThread:
|
|
4138
|
-
resetHistoryState:
|
|
4139
|
-
pushUser:
|
|
4136
|
+
markSkipNextLoad: b,
|
|
4137
|
+
markStreamPendingThread: z,
|
|
4138
|
+
resetHistoryState: j,
|
|
4139
|
+
pushUser: G,
|
|
4140
4140
|
onEvent: m,
|
|
4141
|
-
artifacts:
|
|
4141
|
+
artifacts: V
|
|
4142
4142
|
}),
|
|
4143
4143
|
[
|
|
4144
4144
|
c,
|
|
@@ -4151,29 +4151,29 @@ function Nr({
|
|
|
4151
4151
|
k,
|
|
4152
4152
|
d,
|
|
4153
4153
|
v,
|
|
4154
|
-
|
|
4154
|
+
_,
|
|
4155
4155
|
I,
|
|
4156
4156
|
C,
|
|
4157
4157
|
T,
|
|
4158
4158
|
f,
|
|
4159
|
-
|
|
4160
|
-
|
|
4159
|
+
F,
|
|
4160
|
+
w,
|
|
4161
4161
|
y,
|
|
4162
4162
|
x,
|
|
4163
|
-
|
|
4163
|
+
P,
|
|
4164
4164
|
p,
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4165
|
+
b,
|
|
4166
|
+
z,
|
|
4167
|
+
G,
|
|
4168
4168
|
m,
|
|
4169
|
-
|
|
4169
|
+
V
|
|
4170
4170
|
]
|
|
4171
4171
|
), g = Q(
|
|
4172
4172
|
() => ({
|
|
4173
|
-
registerClearThread:
|
|
4174
|
-
registerRespondToInterrupt:
|
|
4173
|
+
registerClearThread: O,
|
|
4174
|
+
registerRespondToInterrupt: L
|
|
4175
4175
|
}),
|
|
4176
|
-
[
|
|
4176
|
+
[O, L]
|
|
4177
4177
|
);
|
|
4178
4178
|
return /* @__PURE__ */ ie(Vt.Provider, { value: g, children: /* @__PURE__ */ ie($t.Provider, { value: Y, children: e }) });
|
|
4179
4179
|
}
|
|
@@ -4190,7 +4190,7 @@ function zr({
|
|
|
4190
4190
|
onFinish: u,
|
|
4191
4191
|
onStreamingChange: c
|
|
4192
4192
|
}) {
|
|
4193
|
-
const { chatApi: l, baseUrl: f } = Ae(), m = f, h = pe(t), k = pe(n), d = pe(r), v = pe(o), I = pe(s), C = pe(a), T = pe(i),
|
|
4193
|
+
const { chatApi: l, baseUrl: f } = Ae(), m = f, h = pe(t), k = pe(n), d = pe(r), v = pe(o), I = pe(s), C = pe(a), T = pe(i), N = pe(u), w = pe(c), y = Q(
|
|
4194
4194
|
() => ({
|
|
4195
4195
|
onError: h,
|
|
4196
4196
|
onAuthError: k,
|
|
@@ -4199,7 +4199,7 @@ function zr({
|
|
|
4199
4199
|
onCustomEvent: C,
|
|
4200
4200
|
onUpdateEvent: I,
|
|
4201
4201
|
onToolEnd: v,
|
|
4202
|
-
onFinish:
|
|
4202
|
+
onFinish: N
|
|
4203
4203
|
}),
|
|
4204
4204
|
[
|
|
4205
4205
|
h,
|
|
@@ -4209,7 +4209,7 @@ function zr({
|
|
|
4209
4209
|
C,
|
|
4210
4210
|
I,
|
|
4211
4211
|
v,
|
|
4212
|
-
|
|
4212
|
+
N
|
|
4213
4213
|
]
|
|
4214
4214
|
);
|
|
4215
4215
|
return /* @__PURE__ */ ie(_r.Provider, { value: !0, children: /* @__PURE__ */ ie(
|
|
@@ -4218,7 +4218,7 @@ function zr({
|
|
|
4218
4218
|
api: l,
|
|
4219
4219
|
streamBaseUrl: m,
|
|
4220
4220
|
handlers: y,
|
|
4221
|
-
onStreamingChange:
|
|
4221
|
+
onStreamingChange: w,
|
|
4222
4222
|
children: e
|
|
4223
4223
|
}
|
|
4224
4224
|
) });
|
|
@@ -4241,7 +4241,7 @@ function Rr({
|
|
|
4241
4241
|
pushUser: v,
|
|
4242
4242
|
onEvent: I,
|
|
4243
4243
|
messages: C
|
|
4244
|
-
} = Dt(), { registerClearThread: T, registerRespondToInterrupt:
|
|
4244
|
+
} = Dt(), { registerClearThread: T, registerRespondToInterrupt: N } = Pr(), w = R(
|
|
4245
4245
|
(g) => {
|
|
4246
4246
|
i(g), k(g.threadId), a.current !== g.threadId && ((g.created ?? !a.current) && h(g.threadId), s(g.threadId));
|
|
4247
4247
|
},
|
|
@@ -4256,7 +4256,7 @@ function Rr({
|
|
|
4256
4256
|
onAuthError: r.onAuthError,
|
|
4257
4257
|
onConnectionError: r.onConnectionError,
|
|
4258
4258
|
onFinish: r.onFinish,
|
|
4259
|
-
onThreadInfo:
|
|
4259
|
+
onThreadInfo: w,
|
|
4260
4260
|
onMetadataEvent: r.onMetadataEvent,
|
|
4261
4261
|
onCustomEvent: r.onCustomEvent,
|
|
4262
4262
|
onUpdateEvent: r.onUpdateEvent,
|
|
@@ -4266,52 +4266,52 @@ function Rr({
|
|
|
4266
4266
|
q(() => {
|
|
4267
4267
|
o == null || o(y.isStreaming);
|
|
4268
4268
|
}, [y.isStreaming, o]);
|
|
4269
|
-
const { stream: x, stop: p, clear:
|
|
4269
|
+
const { stream: x, stop: p, clear: b, isStreaming: z, error: j, connected: M, streamedMessages: O, activeMessageId: E } = y;
|
|
4270
4270
|
q(() => {
|
|
4271
|
-
u !== void 0 &&
|
|
4272
|
-
}, [u,
|
|
4273
|
-
const
|
|
4271
|
+
u !== void 0 && b();
|
|
4272
|
+
}, [u, b]);
|
|
4273
|
+
const L = R(
|
|
4274
4274
|
async (g, A) => {
|
|
4275
4275
|
await x(g, A);
|
|
4276
4276
|
},
|
|
4277
4277
|
[x]
|
|
4278
|
-
),
|
|
4278
|
+
), _ = K(l);
|
|
4279
4279
|
q(() => {
|
|
4280
|
-
|
|
4280
|
+
_.current = l;
|
|
4281
4281
|
}, [l]);
|
|
4282
|
-
const
|
|
4282
|
+
const G = R(
|
|
4283
4283
|
async (g, A, S) => {
|
|
4284
|
-
const
|
|
4285
|
-
if (!
|
|
4284
|
+
const H = a.current;
|
|
4285
|
+
if (!H)
|
|
4286
4286
|
throw new Error("No active thread to handle interrupt");
|
|
4287
|
-
const J = g ? A ?? !0 : !1, D =
|
|
4288
|
-
threadId:
|
|
4287
|
+
const J = g ? A ?? !0 : !1, D = _.current, ee = (S == null ? void 0 : S.checkpointId) ?? D.id ?? void 0, oe = (S == null ? void 0 : S.checkpointNs) ?? D.namespace ?? void 0, ue = {
|
|
4288
|
+
threadId: H,
|
|
4289
4289
|
checkpointId: ee,
|
|
4290
4290
|
checkpointNs: oe,
|
|
4291
4291
|
command: { kind: "resume", value: J },
|
|
4292
4292
|
payload: S == null ? void 0 : S.payload
|
|
4293
4293
|
};
|
|
4294
|
-
|
|
4294
|
+
L(ue);
|
|
4295
4295
|
},
|
|
4296
|
-
[a,
|
|
4296
|
+
[a, L]
|
|
4297
4297
|
);
|
|
4298
4298
|
q(() => {
|
|
4299
|
-
|
|
4300
|
-
}, [
|
|
4301
|
-
const
|
|
4302
|
-
p(),
|
|
4303
|
-
}, [
|
|
4299
|
+
N(G);
|
|
4300
|
+
}, [G, N]);
|
|
4301
|
+
const F = R(async () => {
|
|
4302
|
+
p(), b(), d(), s(null);
|
|
4303
|
+
}, [b, d, s, p]);
|
|
4304
4304
|
q(() => {
|
|
4305
|
-
T(
|
|
4306
|
-
}, [
|
|
4307
|
-
const
|
|
4305
|
+
T(F);
|
|
4306
|
+
}, [F, T]);
|
|
4307
|
+
const P = R(
|
|
4308
4308
|
async (g, A) => {
|
|
4309
|
-
|
|
4309
|
+
z && p();
|
|
4310
4310
|
let S = a.current;
|
|
4311
|
-
const
|
|
4311
|
+
const H = (g == null ? void 0 : g.text) ?? "", J = (g == null ? void 0 : g.attachments) ?? [], D = (H == null ? void 0 : H.trim()) ?? "", ee = { ...(g == null ? void 0 : g.payload) ?? {} }, oe = Array.isArray(ee.messages) ? ee.messages : void 0;
|
|
4312
4312
|
oe && delete ee.messages;
|
|
4313
|
-
const ue = !!(oe && oe.length),
|
|
4314
|
-
if (!S && !D && J.length === 0 && !ue && !
|
|
4313
|
+
const ue = !!(oe && oe.length), W = !!(g.contentParts && g.contentParts.length > 0);
|
|
4314
|
+
if (!S && !D && J.length === 0 && !ue && !W) return;
|
|
4315
4315
|
if (!S) {
|
|
4316
4316
|
const he = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), ye = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")).join("").slice(0, 16);
|
|
4317
4317
|
S = `${he}${ye}`, h(S), s(S);
|
|
@@ -4319,7 +4319,7 @@ function Rr({
|
|
|
4319
4319
|
let te = null;
|
|
4320
4320
|
g.contentParts && g.contentParts.length > 0 && (te = g.contentParts);
|
|
4321
4321
|
const { contentParts: ve, filesInfo: X } = te ? { contentParts: te, filesInfo: [] } : await rr(J), Z = [...ve];
|
|
4322
|
-
D && Z.push({ type: "text", text:
|
|
4322
|
+
D && Z.push({ type: "text", text: H });
|
|
4323
4323
|
const me = g == null ? void 0 : g.originalMessageId, je = !!(g != null && g.edit && me), Le = !ue && Z.length > 0;
|
|
4324
4324
|
let de = null;
|
|
4325
4325
|
if (Le) {
|
|
@@ -4350,25 +4350,25 @@ function Rr({
|
|
|
4350
4350
|
command: g == null ? void 0 : g.command,
|
|
4351
4351
|
edit: g == null ? void 0 : g.edit
|
|
4352
4352
|
};
|
|
4353
|
-
return
|
|
4353
|
+
return L(Ee, A);
|
|
4354
4354
|
},
|
|
4355
|
-
[l, a,
|
|
4356
|
-
),
|
|
4357
|
-
const g = Object.keys(
|
|
4358
|
-
if (!
|
|
4355
|
+
[l, a, z, h, v, L, p, f]
|
|
4356
|
+
), V = Q(() => {
|
|
4357
|
+
const g = Object.keys(O).length > 0;
|
|
4358
|
+
if (!z && !g)
|
|
4359
4359
|
return C;
|
|
4360
4360
|
const A = /* @__PURE__ */ new Map();
|
|
4361
|
-
return C.forEach((S) => A.set(S.id, S)), Object.values(
|
|
4361
|
+
return C.forEach((S) => A.set(S.id, S)), Object.values(O).forEach((S) => {
|
|
4362
4362
|
A.set(S.id, S);
|
|
4363
4363
|
}), Array.from(A.values());
|
|
4364
|
-
}, [
|
|
4364
|
+
}, [z, O, C]), Y = Q(
|
|
4365
4365
|
() => ({
|
|
4366
|
-
isStreaming:
|
|
4367
|
-
error:
|
|
4368
|
-
connectionState:
|
|
4369
|
-
messages:
|
|
4370
|
-
activeMessageId:
|
|
4371
|
-
submit:
|
|
4366
|
+
isStreaming: z,
|
|
4367
|
+
error: j,
|
|
4368
|
+
connectionState: j ? "error" : z ? M ? "connected" : "connecting" : "idle",
|
|
4369
|
+
messages: V,
|
|
4370
|
+
activeMessageId: E,
|
|
4371
|
+
submit: P,
|
|
4372
4372
|
stop: p,
|
|
4373
4373
|
interrupt: c,
|
|
4374
4374
|
resume: () => Promise.resolve(),
|
|
@@ -4377,7 +4377,7 @@ function Rr({
|
|
|
4377
4377
|
}
|
|
4378
4378
|
// TODO: Implement error clearing
|
|
4379
4379
|
}),
|
|
4380
|
-
[
|
|
4380
|
+
[z, j, P, p, c, M, V]
|
|
4381
4381
|
);
|
|
4382
4382
|
return /* @__PURE__ */ ie(Kt.Provider, { value: Y, children: e });
|
|
4383
4383
|
}
|
|
@@ -4385,7 +4385,7 @@ function pe(e) {
|
|
|
4385
4385
|
const t = K(e);
|
|
4386
4386
|
return q(() => {
|
|
4387
4387
|
t.current = e;
|
|
4388
|
-
}, [e]),
|
|
4388
|
+
}, [e]), R((...n) => {
|
|
4389
4389
|
const r = t.current;
|
|
4390
4390
|
if (r)
|
|
4391
4391
|
return r(...n);
|
|
@@ -4440,26 +4440,26 @@ function io({
|
|
|
4440
4440
|
onMetadataEvent: h,
|
|
4441
4441
|
onFinish: k
|
|
4442
4442
|
}) {
|
|
4443
|
-
const d = Lr(t), [v, I] =
|
|
4443
|
+
const d = Lr(t), [v, I] = $(!1), C = ge(i), T = ge(u), N = ge(a), w = ge(c), y = ge(l), x = ge(f), p = ge(m), b = ge(h), z = ge(k), j = Q(
|
|
4444
4444
|
() => ({
|
|
4445
4445
|
onError: C,
|
|
4446
4446
|
onAuthError: T,
|
|
4447
|
-
onConnectionError:
|
|
4447
|
+
onConnectionError: N,
|
|
4448
4448
|
onToolEnd: y,
|
|
4449
4449
|
onUpdateEvent: x,
|
|
4450
4450
|
onCustomEvent: p,
|
|
4451
|
-
onMetadataEvent:
|
|
4452
|
-
onFinish:
|
|
4451
|
+
onMetadataEvent: b,
|
|
4452
|
+
onFinish: z
|
|
4453
4453
|
}),
|
|
4454
4454
|
[
|
|
4455
4455
|
C,
|
|
4456
4456
|
T,
|
|
4457
|
-
|
|
4457
|
+
N,
|
|
4458
4458
|
y,
|
|
4459
4459
|
x,
|
|
4460
4460
|
p,
|
|
4461
|
-
|
|
4462
|
-
|
|
4461
|
+
b,
|
|
4462
|
+
z
|
|
4463
4463
|
]
|
|
4464
4464
|
);
|
|
4465
4465
|
return /* @__PURE__ */ ie(tr, { apiConfig: d, children: /* @__PURE__ */ ie(
|
|
@@ -4467,7 +4467,7 @@ function io({
|
|
|
4467
4467
|
{
|
|
4468
4468
|
initialThreadId: n,
|
|
4469
4469
|
onError: C,
|
|
4470
|
-
onThreadChange:
|
|
4470
|
+
onThreadChange: w,
|
|
4471
4471
|
children: /* @__PURE__ */ ie(
|
|
4472
4472
|
Nr,
|
|
4473
4473
|
{
|
|
@@ -4480,7 +4480,7 @@ function io({
|
|
|
4480
4480
|
children: /* @__PURE__ */ ie(
|
|
4481
4481
|
zr,
|
|
4482
4482
|
{
|
|
4483
|
-
...
|
|
4483
|
+
...j,
|
|
4484
4484
|
onStreamingChange: I,
|
|
4485
4485
|
children: e
|
|
4486
4486
|
}
|
|
@@ -4492,7 +4492,7 @@ function io({
|
|
|
4492
4492
|
}
|
|
4493
4493
|
function ge(e) {
|
|
4494
4494
|
const t = K(e);
|
|
4495
|
-
return t.current = e,
|
|
4495
|
+
return t.current = e, R((...n) => {
|
|
4496
4496
|
const r = t.current;
|
|
4497
4497
|
if (r)
|
|
4498
4498
|
return r(...n);
|
|
@@ -4590,11 +4590,11 @@ function Kr() {
|
|
|
4590
4590
|
};
|
|
4591
4591
|
}
|
|
4592
4592
|
function co(e) {
|
|
4593
|
-
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Ae(), { toast: o } = Kr(), [s, a] =
|
|
4593
|
+
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Ae(), { toast: o } = Kr(), [s, a] = $({}), [i, u] = $(null), [c, l] = $(!1), f = R(() => {
|
|
4594
4594
|
l(!1), u(null);
|
|
4595
|
-
}, []), m =
|
|
4595
|
+
}, []), m = R((k) => {
|
|
4596
4596
|
u(k), l(!0);
|
|
4597
|
-
}, []), h =
|
|
4597
|
+
}, []), h = R(
|
|
4598
4598
|
async (k, d, v) => {
|
|
4599
4599
|
var I, C;
|
|
4600
4600
|
if (!t) {
|
|
@@ -4606,16 +4606,16 @@ function co(e) {
|
|
|
4606
4606
|
return;
|
|
4607
4607
|
}
|
|
4608
4608
|
try {
|
|
4609
|
-
const T = String(d.url ?? ""),
|
|
4610
|
-
if (
|
|
4609
|
+
const T = String(d.url ?? ""), N = T.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
|
|
4610
|
+
if (N) {
|
|
4611
4611
|
k.preventDefault();
|
|
4612
|
-
const
|
|
4613
|
-
m({ id:
|
|
4612
|
+
const w = N[1], y = d.name || `file_${w}`, x = d.mimeType || "application/octet-stream";
|
|
4613
|
+
m({ id: w, name: y, mimeType: x });
|
|
4614
4614
|
return;
|
|
4615
4615
|
}
|
|
4616
4616
|
if (T.startsWith("data:")) {
|
|
4617
4617
|
k.preventDefault(), a((y) => ({ ...y, [v]: !0 }));
|
|
4618
|
-
const
|
|
4618
|
+
const w = o({ title: "Fetching file...", description: "", open: !0 });
|
|
4619
4619
|
try {
|
|
4620
4620
|
const y = await r.listFiles(n ?? void 0);
|
|
4621
4621
|
if (!y || !Array.isArray(y))
|
|
@@ -4629,8 +4629,8 @@ function co(e) {
|
|
|
4629
4629
|
id: x.id,
|
|
4630
4630
|
name: d.name || x.filename || `file_${x.id}`,
|
|
4631
4631
|
mimeType: d.mimeType || x.mime_type || "application/octet-stream"
|
|
4632
|
-
}), (I =
|
|
4633
|
-
id:
|
|
4632
|
+
}), (I = w.update) == null || I.call(w, {
|
|
4633
|
+
id: w.id,
|
|
4634
4634
|
title: "Success",
|
|
4635
4635
|
description: `Opened ${d.name}`,
|
|
4636
4636
|
open: !0
|
|
@@ -4638,7 +4638,7 @@ function co(e) {
|
|
|
4638
4638
|
} catch (y) {
|
|
4639
4639
|
console.error("Failed to fetch server file:", y);
|
|
4640
4640
|
const x = y instanceof Error ? y.message : "Unknown error occurred";
|
|
4641
|
-
(C =
|
|
4641
|
+
(C = w.update) == null || C.call(w, { id: w.id, title: "Failed", description: x }), o({
|
|
4642
4642
|
title: "Failed to fetch file",
|
|
4643
4643
|
description: x,
|
|
4644
4644
|
open: !0
|
|
@@ -4648,7 +4648,7 @@ function co(e) {
|
|
|
4648
4648
|
}
|
|
4649
4649
|
}
|
|
4650
4650
|
} catch (T) {
|
|
4651
|
-
console.error("File click error:", T), a((
|
|
4651
|
+
console.error("File click error:", T), a((N) => ({ ...N, [v]: !1 }));
|
|
4652
4652
|
}
|
|
4653
4653
|
},
|
|
4654
4654
|
[t, s, o, n, m]
|
|
@@ -4734,14 +4734,14 @@ function uo(e) {
|
|
|
4734
4734
|
}, [e]);
|
|
4735
4735
|
}
|
|
4736
4736
|
function Wr(e) {
|
|
4737
|
-
var
|
|
4737
|
+
var z;
|
|
4738
4738
|
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r = rt({ optional: !0 }), o = Dt({ optional: !0 }), s = Ur(), { currentThreadId: a, setCurrentThreadId: i, actions: u } = r || {
|
|
4739
4739
|
currentThreadId: null,
|
|
4740
4740
|
setCurrentThreadId: () => {
|
|
4741
4741
|
},
|
|
4742
4742
|
actions: {}
|
|
4743
|
-
}, c = !!t && t !== a, [l, f] =
|
|
4744
|
-
f(
|
|
4743
|
+
}, c = !!t && t !== a, [l, f] = $([]), m = R((j) => {
|
|
4744
|
+
f(j);
|
|
4745
4745
|
}, []), {
|
|
4746
4746
|
isLoadingThread: h,
|
|
4747
4747
|
threadStateError: k,
|
|
@@ -4761,17 +4761,17 @@ function Wr(e) {
|
|
|
4761
4761
|
!c && !n && a && (o != null && o.loadThread) && o.loadThread(a);
|
|
4762
4762
|
}, [c, n, a, o == null ? void 0 : o.loadThread]);
|
|
4763
4763
|
const I = Q(() => {
|
|
4764
|
-
var
|
|
4765
|
-
return ((
|
|
4766
|
-
}, [d]), C = Q(() => ({ timeline: [], messagePreviews: {} }), []), T = t || a,
|
|
4764
|
+
var j;
|
|
4765
|
+
return ((j = d[0]) == null ? void 0 : j.values) || {};
|
|
4766
|
+
}, [d]), C = Q(() => ({ timeline: [], messagePreviews: {} }), []), T = t || a, N = c ? h ? "loading" : "idle" : (o == null ? void 0 : o.status) || "idle", w = c ? l : (s == null ? void 0 : s.messages) || [], y = c ? h : (o == null ? void 0 : o.isLoading) || !1, x = c ? I : (o == null ? void 0 : o.values) || {}, p = c ? {} : (o == null ? void 0 : o.taskMessagesByScope) || {}, b = c ? k : (s == null ? void 0 : s.error) || (o == null ? void 0 : o.error) || null;
|
|
4767
4767
|
return {
|
|
4768
4768
|
// UNIFIED: Single thread ID concept
|
|
4769
4769
|
threadId: T,
|
|
4770
|
-
status:
|
|
4771
|
-
messages:
|
|
4770
|
+
status: N,
|
|
4771
|
+
messages: w,
|
|
4772
4772
|
isLoading: y,
|
|
4773
4773
|
isHistoryLoading: y,
|
|
4774
|
-
error:
|
|
4774
|
+
error: b,
|
|
4775
4775
|
// Values & Metadata
|
|
4776
4776
|
values: x,
|
|
4777
4777
|
taskMessagesByScope: p,
|
|
@@ -4795,7 +4795,7 @@ function Wr(e) {
|
|
|
4795
4795
|
isStreaming: (s == null ? void 0 : s.isStreaming) || !1,
|
|
4796
4796
|
activeMessageId: (s == null ? void 0 : s.activeMessageId) || null,
|
|
4797
4797
|
connectionState: (s == null ? void 0 : s.connectionState) || "disconnected",
|
|
4798
|
-
streamingAssistantId: !c && (s != null && s.isStreaming) && ((
|
|
4798
|
+
streamingAssistantId: !c && (s != null && s.isStreaming) && ((z = o == null ? void 0 : o.metadata) != null && z.assemblingMessageId) ? o.metadata.assemblingMessageId : null,
|
|
4799
4799
|
// Actions
|
|
4800
4800
|
submit: (s == null ? void 0 : s.submit) || (async () => {
|
|
4801
4801
|
}),
|
|
@@ -4833,37 +4833,37 @@ function fo({
|
|
|
4833
4833
|
threadId: m,
|
|
4834
4834
|
clearComposerOnSend: h = !0
|
|
4835
4835
|
}) {
|
|
4836
|
-
const { messages: k } = Wr(), [d, v] =
|
|
4836
|
+
const { messages: k } = Wr(), [d, v] = $(null), [I, C] = $(""), [T, N] = $(null), [w, y] = $(null), [x, p] = $(!1), [b, z] = $(""), j = K(b), M = K(null);
|
|
4837
4837
|
q(() => {
|
|
4838
4838
|
if (!d)
|
|
4839
4839
|
if (m) {
|
|
4840
4840
|
const g = localStorage.getItem(He(m));
|
|
4841
|
-
|
|
4841
|
+
z(g || "");
|
|
4842
4842
|
} else
|
|
4843
|
-
|
|
4843
|
+
z("");
|
|
4844
4844
|
}, [m, d]);
|
|
4845
|
-
const
|
|
4846
|
-
|
|
4845
|
+
const O = R((g) => {
|
|
4846
|
+
z(g), !d && m && localStorage.setItem(He(m), g);
|
|
4847
4847
|
}, [m, d]);
|
|
4848
4848
|
q(() => {
|
|
4849
|
-
|
|
4850
|
-
}, [
|
|
4849
|
+
j.current = b;
|
|
4850
|
+
}, [b]), q(() => {
|
|
4851
4851
|
if (!d) {
|
|
4852
4852
|
M.current = null;
|
|
4853
4853
|
return;
|
|
4854
4854
|
}
|
|
4855
|
-
M.current === null && (M.current =
|
|
4856
|
-
}, [I, d,
|
|
4857
|
-
const
|
|
4855
|
+
M.current === null && (M.current = j.current), O(I ?? "");
|
|
4856
|
+
}, [I, d, O]);
|
|
4857
|
+
const E = R(
|
|
4858
4858
|
(g) => {
|
|
4859
|
-
|
|
4859
|
+
O(g);
|
|
4860
4860
|
},
|
|
4861
|
-
[
|
|
4862
|
-
),
|
|
4863
|
-
const S = Array.isArray(A) ? { files: A } : A ?? {},
|
|
4864
|
-
if (!(!D &&
|
|
4861
|
+
[O]
|
|
4862
|
+
), L = async (g, A) => {
|
|
4863
|
+
const S = Array.isArray(A) ? { files: A } : A ?? {}, H = S.files ?? [], J = S.contentParts ?? [], D = g.trim();
|
|
4864
|
+
if (!(!D && H.length === 0 && J.length === 0))
|
|
4865
4865
|
try {
|
|
4866
|
-
const ee =
|
|
4866
|
+
const ee = H.map(async (X) => {
|
|
4867
4867
|
try {
|
|
4868
4868
|
const Z = await zt.uploadFile(X);
|
|
4869
4869
|
return { file: X, record: Z };
|
|
@@ -4882,12 +4882,12 @@ function fo({
|
|
|
4882
4882
|
name: X.filename,
|
|
4883
4883
|
size: X.size
|
|
4884
4884
|
};
|
|
4885
|
-
}),
|
|
4885
|
+
}), W = [...J, ...ue], te = d ? (T == null ? void 0 : T.checkpointId) ?? n ?? void 0 : n ?? void 0, ve = d ? (T == null ? void 0 : T.checkpointNs) ?? r ?? void 0 : r ?? void 0;
|
|
4886
4886
|
await e(
|
|
4887
4887
|
{
|
|
4888
4888
|
text: D || "",
|
|
4889
|
-
contentParts:
|
|
4890
|
-
attachments:
|
|
4889
|
+
contentParts: W,
|
|
4890
|
+
attachments: H,
|
|
4891
4891
|
payload: t.payload,
|
|
4892
4892
|
edit: !!d,
|
|
4893
4893
|
checkpointId: te,
|
|
@@ -4897,14 +4897,14 @@ function fo({
|
|
|
4897
4897
|
config: t.config
|
|
4898
4898
|
},
|
|
4899
4899
|
f ? { onEvent: f } : void 0
|
|
4900
|
-
), o == null || o(D), c(!0), h && (m && localStorage.removeItem(He(m)),
|
|
4900
|
+
), o == null || o(D), c(!0), h && (m && localStorage.removeItem(He(m)), O("")), y(null), v(null), C(""), N(null);
|
|
4901
4901
|
} catch (ee) {
|
|
4902
4902
|
const oe = (ee == null ? void 0 : ee.message) || "Failed to send message";
|
|
4903
4903
|
y(oe), a == null || a(oe), c(!1);
|
|
4904
4904
|
}
|
|
4905
|
-
},
|
|
4906
|
-
A ||
|
|
4907
|
-
},
|
|
4905
|
+
}, _ = (g, A) => {
|
|
4906
|
+
A || L(g, { files: [] });
|
|
4907
|
+
}, G = R(
|
|
4908
4908
|
async (g) => {
|
|
4909
4909
|
await e(
|
|
4910
4910
|
{
|
|
@@ -4919,19 +4919,19 @@ function fo({
|
|
|
4919
4919
|
), s == null || s({ file: g });
|
|
4920
4920
|
},
|
|
4921
4921
|
[n, r, t, s, e]
|
|
4922
|
-
),
|
|
4922
|
+
), F = R(
|
|
4923
4923
|
(g, A, S) => {
|
|
4924
|
-
i && (M.current =
|
|
4924
|
+
i && (M.current = b, v(g), C(A), N({
|
|
4925
4925
|
checkpointId: (S == null ? void 0 : S.checkpointId) ?? null,
|
|
4926
4926
|
checkpointNs: (S == null ? void 0 : S.checkpointNs) ?? null
|
|
4927
4927
|
}), y(null));
|
|
4928
4928
|
},
|
|
4929
|
-
[
|
|
4930
|
-
),
|
|
4931
|
-
v(null), C(""),
|
|
4929
|
+
[b, i]
|
|
4930
|
+
), P = R(() => {
|
|
4931
|
+
v(null), C(""), N(null), y(null);
|
|
4932
4932
|
const g = M.current;
|
|
4933
|
-
g !== null &&
|
|
4934
|
-
}, []),
|
|
4933
|
+
g !== null && z(g), M.current = null;
|
|
4934
|
+
}, []), V = R((g) => {
|
|
4935
4935
|
let A = null;
|
|
4936
4936
|
for (let D = g - 1; D >= 0; D--)
|
|
4937
4937
|
if (u[D].role === "user") {
|
|
@@ -4962,18 +4962,18 @@ function fo({
|
|
|
4962
4962
|
return {
|
|
4963
4963
|
editingMessageId: d,
|
|
4964
4964
|
editingInitialValue: I,
|
|
4965
|
-
inputError:
|
|
4965
|
+
inputError: w,
|
|
4966
4966
|
setInputError: y,
|
|
4967
4967
|
dismissError: x,
|
|
4968
4968
|
setDismissError: p,
|
|
4969
|
-
composerValue:
|
|
4970
|
-
handleComposerChange:
|
|
4971
|
-
handleSendMessage:
|
|
4972
|
-
handleQuickPrompt:
|
|
4973
|
-
handleExcelUpload:
|
|
4974
|
-
startEditing:
|
|
4975
|
-
cancelEditing:
|
|
4976
|
-
handleRegenerateCb:
|
|
4969
|
+
composerValue: b,
|
|
4970
|
+
handleComposerChange: E,
|
|
4971
|
+
handleSendMessage: L,
|
|
4972
|
+
handleQuickPrompt: _,
|
|
4973
|
+
handleExcelUpload: G,
|
|
4974
|
+
startEditing: F,
|
|
4975
|
+
cancelEditing: P,
|
|
4976
|
+
handleRegenerateCb: V,
|
|
4977
4977
|
displayMessages: k
|
|
4978
4978
|
};
|
|
4979
4979
|
}
|
|
@@ -4993,7 +4993,7 @@ function po(e) {
|
|
|
4993
4993
|
}, [e]);
|
|
4994
4994
|
}
|
|
4995
4995
|
function go(e, t, n) {
|
|
4996
|
-
const [r, o] =
|
|
4996
|
+
const [r, o] = $(e), s = K(e), a = K(null);
|
|
4997
4997
|
return q(() => {
|
|
4998
4998
|
s.current = e;
|
|
4999
4999
|
const i = () => {
|