@teodorruskvi/chat-core 0.1.57 → 0.1.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/features/conversation/contexts/ThreadStateProvider.d.ts +3 -1
- package/dist/features/conversation/hooks/useChatSession.d.ts +1 -0
- package/dist/features/conversation/hooks/useThreadHistoryState.d.ts +3 -1
- package/dist/index.esm.js +1078 -1069
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +7 -7
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Gt = (e, t, n) => t in e ?
|
|
1
|
+
var qt = Object.defineProperty;
|
|
2
|
+
var Gt = (e, t, n) => t in e ? qt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var at = (e, t, n) => Gt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { jsx as de } from "react/jsx-runtime";
|
|
5
5
|
import * as it from "react";
|
|
6
|
-
import { createContext as Ce, useContext as je, useState as
|
|
6
|
+
import { createContext as Ce, useContext as je, useState as H, useRef as W, useEffect as Y, useCallback as N, useMemo as Z, useReducer as Wt } from "react";
|
|
7
7
|
import Jt, { isCancel as Xt } from "axios";
|
|
8
8
|
function It(e) {
|
|
9
9
|
var t, n, r = "";
|
|
@@ -29,8 +29,8 @@ const et = "-", Yt = (e) => {
|
|
|
29
29
|
return i[0] === "" && i.length !== 1 && i.shift(), vt(i, t) || Zt(a);
|
|
30
30
|
},
|
|
31
31
|
getConflictingClassGroupIds: (a, i) => {
|
|
32
|
-
const
|
|
33
|
-
return i && r[a] ? [...
|
|
32
|
+
const u = n[a] || [];
|
|
33
|
+
return i && r[a] ? [...u, ...r[a]] : u;
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
}, vt = (e, t) => {
|
|
@@ -120,40 +120,40 @@ const et = "-", Yt = (e) => {
|
|
|
120
120
|
n.has(s) ? n.set(s, a) : o(s, a);
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
}, xt = "!",
|
|
123
|
+
}, xt = "!", sn = (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
|
|
130
|
-
for (let
|
|
131
|
-
let x = i[
|
|
132
|
-
if (
|
|
133
|
-
if (x === o && (r || i.slice(
|
|
134
|
-
|
|
128
|
+
const u = [];
|
|
129
|
+
let l = 0, c = 0, d;
|
|
130
|
+
for (let h = 0; h < i.length; h++) {
|
|
131
|
+
let x = i[h];
|
|
132
|
+
if (l === 0) {
|
|
133
|
+
if (x === o && (r || i.slice(h, h + s) === t)) {
|
|
134
|
+
u.push(i.slice(c, h)), c = h + s;
|
|
135
135
|
continue;
|
|
136
136
|
}
|
|
137
137
|
if (x === "/") {
|
|
138
|
-
|
|
138
|
+
d = h;
|
|
139
139
|
continue;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
x === "[" ?
|
|
142
|
+
x === "[" ? l++ : x === "]" && l--;
|
|
143
143
|
}
|
|
144
|
-
const
|
|
144
|
+
const m = u.length === 0 ? i : i.substring(c), p = m.startsWith(xt), I = p ? m.substring(1) : m, f = d && d > c ? d - c : void 0;
|
|
145
145
|
return {
|
|
146
|
-
modifiers:
|
|
147
|
-
hasImportantModifier:
|
|
146
|
+
modifiers: u,
|
|
147
|
+
hasImportantModifier: p,
|
|
148
148
|
baseClassName: I,
|
|
149
|
-
maybePostfixModifierPosition:
|
|
149
|
+
maybePostfixModifierPosition: f
|
|
150
150
|
};
|
|
151
151
|
};
|
|
152
152
|
return n ? (i) => n({
|
|
153
153
|
className: i,
|
|
154
154
|
parseClassName: a
|
|
155
155
|
}) : a;
|
|
156
|
-
},
|
|
156
|
+
}, on = (e) => {
|
|
157
157
|
if (e.length <= 1)
|
|
158
158
|
return e;
|
|
159
159
|
const t = [];
|
|
@@ -163,7 +163,7 @@ const et = "-", Yt = (e) => {
|
|
|
163
163
|
}), t.push(...n.sort()), t;
|
|
164
164
|
}, an = (e) => ({
|
|
165
165
|
cache: rn(e.cacheSize),
|
|
166
|
-
parseClassName:
|
|
166
|
+
parseClassName: sn(e),
|
|
167
167
|
...Yt(e)
|
|
168
168
|
}), cn = /\s+/, ln = (e, t) => {
|
|
169
169
|
const {
|
|
@@ -172,35 +172,35 @@ 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
|
|
177
|
-
modifiers:
|
|
178
|
-
hasImportantModifier:
|
|
179
|
-
baseClassName:
|
|
180
|
-
maybePostfixModifierPosition:
|
|
181
|
-
} = n(
|
|
182
|
-
let I = !!
|
|
183
|
-
if (!
|
|
175
|
+
for (let u = a.length - 1; u >= 0; u -= 1) {
|
|
176
|
+
const l = a[u], {
|
|
177
|
+
modifiers: c,
|
|
178
|
+
hasImportantModifier: d,
|
|
179
|
+
baseClassName: m,
|
|
180
|
+
maybePostfixModifierPosition: p
|
|
181
|
+
} = n(l);
|
|
182
|
+
let I = !!p, f = r(I ? m.substring(0, p) : m);
|
|
183
|
+
if (!f) {
|
|
184
184
|
if (!I) {
|
|
185
|
-
i =
|
|
185
|
+
i = l + (i.length > 0 ? " " + i : i);
|
|
186
186
|
continue;
|
|
187
187
|
}
|
|
188
|
-
if (
|
|
189
|
-
i =
|
|
188
|
+
if (f = r(m), !f) {
|
|
189
|
+
i = l + (i.length > 0 ? " " + i : i);
|
|
190
190
|
continue;
|
|
191
191
|
}
|
|
192
192
|
I = !1;
|
|
193
193
|
}
|
|
194
|
-
const
|
|
194
|
+
const h = on(c).join(":"), x = d ? h + xt : h, S = x + f;
|
|
195
195
|
if (s.includes(S))
|
|
196
196
|
continue;
|
|
197
197
|
s.push(S);
|
|
198
|
-
const A = o(
|
|
198
|
+
const A = o(f, I);
|
|
199
199
|
for (let w = 0; w < A.length; ++w) {
|
|
200
|
-
const
|
|
201
|
-
s.push(x +
|
|
200
|
+
const k = A[w];
|
|
201
|
+
s.push(x + k);
|
|
202
202
|
}
|
|
203
|
-
i =
|
|
203
|
+
i = l + (i.length > 0 ? " " + i : i);
|
|
204
204
|
}
|
|
205
205
|
return i;
|
|
206
206
|
};
|
|
@@ -220,16 +220,16 @@ const At = (e) => {
|
|
|
220
220
|
};
|
|
221
221
|
function un(e, ...t) {
|
|
222
222
|
let n, r, o, s = a;
|
|
223
|
-
function a(
|
|
224
|
-
const
|
|
225
|
-
return n = an(
|
|
223
|
+
function a(u) {
|
|
224
|
+
const l = t.reduce((c, d) => d(c), e());
|
|
225
|
+
return n = an(l), r = n.cache.get, o = n.cache.set, s = i, i(u);
|
|
226
226
|
}
|
|
227
|
-
function i(
|
|
228
|
-
const
|
|
229
|
-
if (
|
|
230
|
-
return
|
|
231
|
-
const
|
|
232
|
-
return o(
|
|
227
|
+
function i(u) {
|
|
228
|
+
const l = r(u);
|
|
229
|
+
if (l)
|
|
230
|
+
return l;
|
|
231
|
+
const c = ln(u, n);
|
|
232
|
+
return o(u, c), c;
|
|
233
233
|
}
|
|
234
234
|
return function() {
|
|
235
235
|
return s(dn.apply(null, arguments));
|
|
@@ -238,7 +238,7 @@ function un(e, ...t) {
|
|
|
238
238
|
const q = (e) => {
|
|
239
239
|
const t = (n) => n[e] || [];
|
|
240
240
|
return t.isThemeGetter = !0, t;
|
|
241
|
-
}, Tt = /^\[(?:([a-z-]+):)?(.+)\]$/i, fn = /^\d+\/\d+$/, pn = /* @__PURE__ */ new Set(["px", "full", "screen"]), gn = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, mn = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, yn = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, hn = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, bn = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, pe = (e) => Te(e) || pn.has(e) || fn.test(e), Ie = (e) => Ee(e, "length", Sn), Te = (e) => !!e && !Number.isNaN(Number(e)),
|
|
241
|
+
}, Tt = /^\[(?:([a-z-]+):)?(.+)\]$/i, fn = /^\d+\/\d+$/, pn = /* @__PURE__ */ new Set(["px", "full", "screen"]), gn = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, mn = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, yn = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, hn = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, bn = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, pe = (e) => Te(e) || pn.has(e) || fn.test(e), Ie = (e) => Ee(e, "length", Sn), Te = (e) => !!e && !Number.isNaN(Number(e)), Ve = (e) => Ee(e, "number", Te), _e = (e) => !!e && Number.isInteger(Number(e)), wn = (e) => e.endsWith("%") && Te(e.slice(0, -1)), R = (e) => Tt.test(e), ve = (e) => gn.test(e), kn = /* @__PURE__ */ new Set(["length", "size", "percentage"]), In = (e) => Ee(e, kn, St), vn = (e) => Ee(e, "position", St), xn = /* @__PURE__ */ new Set(["image", "url"]), An = (e) => Ee(e, xn, Cn), Tn = (e) => Ee(e, "", Mn), Ne = () => !0, Ee = (e, t, n) => {
|
|
242
242
|
const r = Tt.exec(e);
|
|
243
243
|
return r ? r[1] ? typeof t == "string" ? r[1] === t : t.has(r[1]) : n(r[2]) : !1;
|
|
244
244
|
}, Sn = (e) => (
|
|
@@ -247,34 +247,34 @@ const q = (e) => {
|
|
|
247
247
|
// I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
|
|
248
248
|
mn.test(e) && !yn.test(e)
|
|
249
249
|
), St = () => !1, Mn = (e) => hn.test(e), Cn = (e) => bn.test(e), En = () => {
|
|
250
|
-
const e = q("colors"), t = q("spacing"), n = q("blur"), r = q("brightness"), o = q("borderColor"), s = q("borderRadius"), a = q("borderSpacing"), i = q("borderWidth"),
|
|
250
|
+
const e = q("colors"), t = q("spacing"), n = q("blur"), r = q("brightness"), o = q("borderColor"), s = q("borderRadius"), a = q("borderSpacing"), i = q("borderWidth"), u = q("contrast"), l = q("grayscale"), c = q("hueRotate"), d = q("invert"), m = q("gap"), p = q("gradientColorStops"), I = q("gradientColorStopPositions"), f = q("inset"), h = q("margin"), x = q("opacity"), S = q("padding"), A = q("saturate"), w = q("scale"), k = q("sepia"), b = q("skew"), T = q("space"), y = q("translate"), v = () => ["auto", "contain", "none"], _ = () => ["auto", "hidden", "clip", "visible", "scroll"], L = () => ["auto", R, t], M = () => [R, t], $ = () => ["", pe, Ie], U = () => ["auto", Te, R], V = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], P = () => ["solid", "dashed", "dotted", "double", "none"], F = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], E = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], j = () => ["", "0", R], G = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], g = () => [Te, R];
|
|
251
251
|
return {
|
|
252
252
|
cacheSize: 500,
|
|
253
253
|
separator: ":",
|
|
254
254
|
theme: {
|
|
255
255
|
colors: [Ne],
|
|
256
256
|
spacing: [pe, Ie],
|
|
257
|
-
blur: ["none", "", ve,
|
|
258
|
-
brightness:
|
|
257
|
+
blur: ["none", "", ve, R],
|
|
258
|
+
brightness: g(),
|
|
259
259
|
borderColor: [e],
|
|
260
|
-
borderRadius: ["none", "", "full", ve,
|
|
260
|
+
borderRadius: ["none", "", "full", ve, R],
|
|
261
261
|
borderSpacing: M(),
|
|
262
262
|
borderWidth: $(),
|
|
263
|
-
contrast:
|
|
264
|
-
grayscale:
|
|
265
|
-
hueRotate:
|
|
266
|
-
invert:
|
|
263
|
+
contrast: g(),
|
|
264
|
+
grayscale: j(),
|
|
265
|
+
hueRotate: g(),
|
|
266
|
+
invert: j(),
|
|
267
267
|
gap: M(),
|
|
268
268
|
gradientColorStops: [e],
|
|
269
269
|
gradientColorStopPositions: [wn, Ie],
|
|
270
|
-
inset:
|
|
271
|
-
margin:
|
|
272
|
-
opacity:
|
|
270
|
+
inset: L(),
|
|
271
|
+
margin: L(),
|
|
272
|
+
opacity: g(),
|
|
273
273
|
padding: M(),
|
|
274
|
-
saturate:
|
|
275
|
-
scale:
|
|
276
|
-
sepia:
|
|
277
|
-
skew:
|
|
274
|
+
saturate: g(),
|
|
275
|
+
scale: g(),
|
|
276
|
+
sepia: j(),
|
|
277
|
+
skew: g(),
|
|
278
278
|
space: M(),
|
|
279
279
|
translate: M()
|
|
280
280
|
},
|
|
@@ -285,7 +285,7 @@ const q = (e) => {
|
|
|
285
285
|
* @see https://tailwindcss.com/docs/aspect-ratio
|
|
286
286
|
*/
|
|
287
287
|
aspect: [{
|
|
288
|
-
aspect: ["auto", "square", "video",
|
|
288
|
+
aspect: ["auto", "square", "video", R]
|
|
289
289
|
}],
|
|
290
290
|
/**
|
|
291
291
|
* Container
|
|
@@ -304,14 +304,14 @@ const q = (e) => {
|
|
|
304
304
|
* @see https://tailwindcss.com/docs/break-after
|
|
305
305
|
*/
|
|
306
306
|
"break-after": [{
|
|
307
|
-
"break-after":
|
|
307
|
+
"break-after": G()
|
|
308
308
|
}],
|
|
309
309
|
/**
|
|
310
310
|
* Break Before
|
|
311
311
|
* @see https://tailwindcss.com/docs/break-before
|
|
312
312
|
*/
|
|
313
313
|
"break-before": [{
|
|
314
|
-
"break-before":
|
|
314
|
+
"break-before": G()
|
|
315
315
|
}],
|
|
316
316
|
/**
|
|
317
317
|
* Break Inside
|
|
@@ -370,49 +370,49 @@ const q = (e) => {
|
|
|
370
370
|
* @see https://tailwindcss.com/docs/object-position
|
|
371
371
|
*/
|
|
372
372
|
"object-position": [{
|
|
373
|
-
object: [...
|
|
373
|
+
object: [...V(), R]
|
|
374
374
|
}],
|
|
375
375
|
/**
|
|
376
376
|
* Overflow
|
|
377
377
|
* @see https://tailwindcss.com/docs/overflow
|
|
378
378
|
*/
|
|
379
379
|
overflow: [{
|
|
380
|
-
overflow:
|
|
380
|
+
overflow: _()
|
|
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": _()
|
|
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": _()
|
|
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: v()
|
|
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": v()
|
|
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": v()
|
|
416
416
|
}],
|
|
417
417
|
/**
|
|
418
418
|
* Position
|
|
@@ -424,63 +424,63 @@ const q = (e) => {
|
|
|
424
424
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
425
425
|
*/
|
|
426
426
|
inset: [{
|
|
427
|
-
inset: [
|
|
427
|
+
inset: [f]
|
|
428
428
|
}],
|
|
429
429
|
/**
|
|
430
430
|
* Right / Left
|
|
431
431
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
432
432
|
*/
|
|
433
433
|
"inset-x": [{
|
|
434
|
-
"inset-x": [
|
|
434
|
+
"inset-x": [f]
|
|
435
435
|
}],
|
|
436
436
|
/**
|
|
437
437
|
* Top / Bottom
|
|
438
438
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
439
439
|
*/
|
|
440
440
|
"inset-y": [{
|
|
441
|
-
"inset-y": [
|
|
441
|
+
"inset-y": [f]
|
|
442
442
|
}],
|
|
443
443
|
/**
|
|
444
444
|
* Start
|
|
445
445
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
446
446
|
*/
|
|
447
447
|
start: [{
|
|
448
|
-
start: [
|
|
448
|
+
start: [f]
|
|
449
449
|
}],
|
|
450
450
|
/**
|
|
451
451
|
* End
|
|
452
452
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
453
453
|
*/
|
|
454
454
|
end: [{
|
|
455
|
-
end: [
|
|
455
|
+
end: [f]
|
|
456
456
|
}],
|
|
457
457
|
/**
|
|
458
458
|
* Top
|
|
459
459
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
460
460
|
*/
|
|
461
461
|
top: [{
|
|
462
|
-
top: [
|
|
462
|
+
top: [f]
|
|
463
463
|
}],
|
|
464
464
|
/**
|
|
465
465
|
* Right
|
|
466
466
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
467
467
|
*/
|
|
468
468
|
right: [{
|
|
469
|
-
right: [
|
|
469
|
+
right: [f]
|
|
470
470
|
}],
|
|
471
471
|
/**
|
|
472
472
|
* Bottom
|
|
473
473
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
474
474
|
*/
|
|
475
475
|
bottom: [{
|
|
476
|
-
bottom: [
|
|
476
|
+
bottom: [f]
|
|
477
477
|
}],
|
|
478
478
|
/**
|
|
479
479
|
* Left
|
|
480
480
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
481
481
|
*/
|
|
482
482
|
left: [{
|
|
483
|
-
left: [
|
|
483
|
+
left: [f]
|
|
484
484
|
}],
|
|
485
485
|
/**
|
|
486
486
|
* Visibility
|
|
@@ -492,7 +492,7 @@ const q = (e) => {
|
|
|
492
492
|
* @see https://tailwindcss.com/docs/z-index
|
|
493
493
|
*/
|
|
494
494
|
z: [{
|
|
495
|
-
z: ["auto", _e,
|
|
495
|
+
z: ["auto", _e, R]
|
|
496
496
|
}],
|
|
497
497
|
// Flexbox and Grid
|
|
498
498
|
/**
|
|
@@ -500,7 +500,7 @@ const q = (e) => {
|
|
|
500
500
|
* @see https://tailwindcss.com/docs/flex-basis
|
|
501
501
|
*/
|
|
502
502
|
basis: [{
|
|
503
|
-
basis:
|
|
503
|
+
basis: L()
|
|
504
504
|
}],
|
|
505
505
|
/**
|
|
506
506
|
* Flex Direction
|
|
@@ -521,28 +521,28 @@ const q = (e) => {
|
|
|
521
521
|
* @see https://tailwindcss.com/docs/flex
|
|
522
522
|
*/
|
|
523
523
|
flex: [{
|
|
524
|
-
flex: ["1", "auto", "initial", "none",
|
|
524
|
+
flex: ["1", "auto", "initial", "none", R]
|
|
525
525
|
}],
|
|
526
526
|
/**
|
|
527
527
|
* Flex Grow
|
|
528
528
|
* @see https://tailwindcss.com/docs/flex-grow
|
|
529
529
|
*/
|
|
530
530
|
grow: [{
|
|
531
|
-
grow:
|
|
531
|
+
grow: j()
|
|
532
532
|
}],
|
|
533
533
|
/**
|
|
534
534
|
* Flex Shrink
|
|
535
535
|
* @see https://tailwindcss.com/docs/flex-shrink
|
|
536
536
|
*/
|
|
537
537
|
shrink: [{
|
|
538
|
-
shrink:
|
|
538
|
+
shrink: j()
|
|
539
539
|
}],
|
|
540
540
|
/**
|
|
541
541
|
* Order
|
|
542
542
|
* @see https://tailwindcss.com/docs/order
|
|
543
543
|
*/
|
|
544
544
|
order: [{
|
|
545
|
-
order: ["first", "last", "none", _e,
|
|
545
|
+
order: ["first", "last", "none", _e, R]
|
|
546
546
|
}],
|
|
547
547
|
/**
|
|
548
548
|
* Grid Template Columns
|
|
@@ -557,22 +557,22 @@ const q = (e) => {
|
|
|
557
557
|
*/
|
|
558
558
|
"col-start-end": [{
|
|
559
559
|
col: ["auto", {
|
|
560
|
-
span: ["full", _e,
|
|
561
|
-
},
|
|
560
|
+
span: ["full", _e, R]
|
|
561
|
+
}, R]
|
|
562
562
|
}],
|
|
563
563
|
/**
|
|
564
564
|
* Grid Column Start
|
|
565
565
|
* @see https://tailwindcss.com/docs/grid-column
|
|
566
566
|
*/
|
|
567
567
|
"col-start": [{
|
|
568
|
-
"col-start":
|
|
568
|
+
"col-start": U()
|
|
569
569
|
}],
|
|
570
570
|
/**
|
|
571
571
|
* Grid Column End
|
|
572
572
|
* @see https://tailwindcss.com/docs/grid-column
|
|
573
573
|
*/
|
|
574
574
|
"col-end": [{
|
|
575
|
-
"col-end":
|
|
575
|
+
"col-end": U()
|
|
576
576
|
}],
|
|
577
577
|
/**
|
|
578
578
|
* Grid Template Rows
|
|
@@ -587,22 +587,22 @@ const q = (e) => {
|
|
|
587
587
|
*/
|
|
588
588
|
"row-start-end": [{
|
|
589
589
|
row: ["auto", {
|
|
590
|
-
span: [_e,
|
|
591
|
-
},
|
|
590
|
+
span: [_e, R]
|
|
591
|
+
}, R]
|
|
592
592
|
}],
|
|
593
593
|
/**
|
|
594
594
|
* Grid Row Start
|
|
595
595
|
* @see https://tailwindcss.com/docs/grid-row
|
|
596
596
|
*/
|
|
597
597
|
"row-start": [{
|
|
598
|
-
"row-start":
|
|
598
|
+
"row-start": U()
|
|
599
599
|
}],
|
|
600
600
|
/**
|
|
601
601
|
* Grid Row End
|
|
602
602
|
* @see https://tailwindcss.com/docs/grid-row
|
|
603
603
|
*/
|
|
604
604
|
"row-end": [{
|
|
605
|
-
"row-end":
|
|
605
|
+
"row-end": U()
|
|
606
606
|
}],
|
|
607
607
|
/**
|
|
608
608
|
* Grid Auto Flow
|
|
@@ -616,42 +616,42 @@ const q = (e) => {
|
|
|
616
616
|
* @see https://tailwindcss.com/docs/grid-auto-columns
|
|
617
617
|
*/
|
|
618
618
|
"auto-cols": [{
|
|
619
|
-
"auto-cols": ["auto", "min", "max", "fr",
|
|
619
|
+
"auto-cols": ["auto", "min", "max", "fr", R]
|
|
620
620
|
}],
|
|
621
621
|
/**
|
|
622
622
|
* Grid Auto Rows
|
|
623
623
|
* @see https://tailwindcss.com/docs/grid-auto-rows
|
|
624
624
|
*/
|
|
625
625
|
"auto-rows": [{
|
|
626
|
-
"auto-rows": ["auto", "min", "max", "fr",
|
|
626
|
+
"auto-rows": ["auto", "min", "max", "fr", R]
|
|
627
627
|
}],
|
|
628
628
|
/**
|
|
629
629
|
* Gap
|
|
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
|
|
651
651
|
* @see https://tailwindcss.com/docs/justify-content
|
|
652
652
|
*/
|
|
653
653
|
"justify-content": [{
|
|
654
|
-
justify: ["normal", ...
|
|
654
|
+
justify: ["normal", ...E()]
|
|
655
655
|
}],
|
|
656
656
|
/**
|
|
657
657
|
* Justify Items
|
|
@@ -672,7 +672,7 @@ const q = (e) => {
|
|
|
672
672
|
* @see https://tailwindcss.com/docs/align-content
|
|
673
673
|
*/
|
|
674
674
|
"align-content": [{
|
|
675
|
-
content: ["normal", ...
|
|
675
|
+
content: ["normal", ...E(), "baseline"]
|
|
676
676
|
}],
|
|
677
677
|
/**
|
|
678
678
|
* Align Items
|
|
@@ -693,7 +693,7 @@ const q = (e) => {
|
|
|
693
693
|
* @see https://tailwindcss.com/docs/place-content
|
|
694
694
|
*/
|
|
695
695
|
"place-content": [{
|
|
696
|
-
"place-content": [...
|
|
696
|
+
"place-content": [...E(), "baseline"]
|
|
697
697
|
}],
|
|
698
698
|
/**
|
|
699
699
|
* Place Items
|
|
@@ -778,63 +778,63 @@ const q = (e) => {
|
|
|
778
778
|
* @see https://tailwindcss.com/docs/margin
|
|
779
779
|
*/
|
|
780
780
|
m: [{
|
|
781
|
-
m: [
|
|
781
|
+
m: [h]
|
|
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: [h]
|
|
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: [h]
|
|
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: [h]
|
|
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: [h]
|
|
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: [h]
|
|
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: [h]
|
|
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: [h]
|
|
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: [h]
|
|
838
838
|
}],
|
|
839
839
|
/**
|
|
840
840
|
* Space Between X
|
|
@@ -866,21 +866,21 @@ const q = (e) => {
|
|
|
866
866
|
* @see https://tailwindcss.com/docs/width
|
|
867
867
|
*/
|
|
868
868
|
w: [{
|
|
869
|
-
w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw",
|
|
869
|
+
w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw", R, t]
|
|
870
870
|
}],
|
|
871
871
|
/**
|
|
872
872
|
* Min-Width
|
|
873
873
|
* @see https://tailwindcss.com/docs/min-width
|
|
874
874
|
*/
|
|
875
875
|
"min-w": [{
|
|
876
|
-
"min-w": [
|
|
876
|
+
"min-w": [R, t, "min", "max", "fit"]
|
|
877
877
|
}],
|
|
878
878
|
/**
|
|
879
879
|
* Max-Width
|
|
880
880
|
* @see https://tailwindcss.com/docs/max-width
|
|
881
881
|
*/
|
|
882
882
|
"max-w": [{
|
|
883
|
-
"max-w": [
|
|
883
|
+
"max-w": [R, t, "none", "full", "min", "max", "fit", "prose", {
|
|
884
884
|
screen: [ve]
|
|
885
885
|
}, ve]
|
|
886
886
|
}],
|
|
@@ -889,28 +889,28 @@ const q = (e) => {
|
|
|
889
889
|
* @see https://tailwindcss.com/docs/height
|
|
890
890
|
*/
|
|
891
891
|
h: [{
|
|
892
|
-
h: [
|
|
892
|
+
h: [R, t, "auto", "min", "max", "fit", "svh", "lvh", "dvh"]
|
|
893
893
|
}],
|
|
894
894
|
/**
|
|
895
895
|
* Min-Height
|
|
896
896
|
* @see https://tailwindcss.com/docs/min-height
|
|
897
897
|
*/
|
|
898
898
|
"min-h": [{
|
|
899
|
-
"min-h": [
|
|
899
|
+
"min-h": [R, t, "min", "max", "fit", "svh", "lvh", "dvh"]
|
|
900
900
|
}],
|
|
901
901
|
/**
|
|
902
902
|
* Max-Height
|
|
903
903
|
* @see https://tailwindcss.com/docs/max-height
|
|
904
904
|
*/
|
|
905
905
|
"max-h": [{
|
|
906
|
-
"max-h": [
|
|
906
|
+
"max-h": [R, t, "min", "max", "fit", "svh", "lvh", "dvh"]
|
|
907
907
|
}],
|
|
908
908
|
/**
|
|
909
909
|
* Size
|
|
910
910
|
* @see https://tailwindcss.com/docs/size
|
|
911
911
|
*/
|
|
912
912
|
size: [{
|
|
913
|
-
size: [
|
|
913
|
+
size: [R, t, "auto", "min", "max", "fit"]
|
|
914
914
|
}],
|
|
915
915
|
// Typography
|
|
916
916
|
/**
|
|
@@ -935,7 +935,7 @@ const q = (e) => {
|
|
|
935
935
|
* @see https://tailwindcss.com/docs/font-weight
|
|
936
936
|
*/
|
|
937
937
|
"font-weight": [{
|
|
938
|
-
font: ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black",
|
|
938
|
+
font: ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black", Ve]
|
|
939
939
|
}],
|
|
940
940
|
/**
|
|
941
941
|
* Font Family
|
|
@@ -979,35 +979,35 @@ const q = (e) => {
|
|
|
979
979
|
* @see https://tailwindcss.com/docs/letter-spacing
|
|
980
980
|
*/
|
|
981
981
|
tracking: [{
|
|
982
|
-
tracking: ["tighter", "tight", "normal", "wide", "wider", "widest",
|
|
982
|
+
tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", R]
|
|
983
983
|
}],
|
|
984
984
|
/**
|
|
985
985
|
* Line Clamp
|
|
986
986
|
* @see https://tailwindcss.com/docs/line-clamp
|
|
987
987
|
*/
|
|
988
988
|
"line-clamp": [{
|
|
989
|
-
"line-clamp": ["none", Te,
|
|
989
|
+
"line-clamp": ["none", Te, Ve]
|
|
990
990
|
}],
|
|
991
991
|
/**
|
|
992
992
|
* Line Height
|
|
993
993
|
* @see https://tailwindcss.com/docs/line-height
|
|
994
994
|
*/
|
|
995
995
|
leading: [{
|
|
996
|
-
leading: ["none", "tight", "snug", "normal", "relaxed", "loose", pe,
|
|
996
|
+
leading: ["none", "tight", "snug", "normal", "relaxed", "loose", pe, R]
|
|
997
997
|
}],
|
|
998
998
|
/**
|
|
999
999
|
* List Style Image
|
|
1000
1000
|
* @see https://tailwindcss.com/docs/list-style-image
|
|
1001
1001
|
*/
|
|
1002
1002
|
"list-image": [{
|
|
1003
|
-
"list-image": ["none",
|
|
1003
|
+
"list-image": ["none", R]
|
|
1004
1004
|
}],
|
|
1005
1005
|
/**
|
|
1006
1006
|
* List Style Type
|
|
1007
1007
|
* @see https://tailwindcss.com/docs/list-style-type
|
|
1008
1008
|
*/
|
|
1009
1009
|
"list-style-type": [{
|
|
1010
|
-
list: ["none", "disc", "decimal",
|
|
1010
|
+
list: ["none", "disc", "decimal", R]
|
|
1011
1011
|
}],
|
|
1012
1012
|
/**
|
|
1013
1013
|
* List Style Position
|
|
@@ -1062,7 +1062,7 @@ const q = (e) => {
|
|
|
1062
1062
|
* @see https://tailwindcss.com/docs/text-decoration-style
|
|
1063
1063
|
*/
|
|
1064
1064
|
"text-decoration-style": [{
|
|
1065
|
-
decoration: [...
|
|
1065
|
+
decoration: [...P(), "wavy"]
|
|
1066
1066
|
}],
|
|
1067
1067
|
/**
|
|
1068
1068
|
* Text Decoration Thickness
|
|
@@ -1076,7 +1076,7 @@ const q = (e) => {
|
|
|
1076
1076
|
* @see https://tailwindcss.com/docs/text-underline-offset
|
|
1077
1077
|
*/
|
|
1078
1078
|
"underline-offset": [{
|
|
1079
|
-
"underline-offset": ["auto", pe,
|
|
1079
|
+
"underline-offset": ["auto", pe, R]
|
|
1080
1080
|
}],
|
|
1081
1081
|
/**
|
|
1082
1082
|
* Text Decoration Color
|
|
@@ -1114,7 +1114,7 @@ const q = (e) => {
|
|
|
1114
1114
|
* @see https://tailwindcss.com/docs/vertical-align
|
|
1115
1115
|
*/
|
|
1116
1116
|
"vertical-align": [{
|
|
1117
|
-
align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super",
|
|
1117
|
+
align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", R]
|
|
1118
1118
|
}],
|
|
1119
1119
|
/**
|
|
1120
1120
|
* Whitespace
|
|
@@ -1142,7 +1142,7 @@ const q = (e) => {
|
|
|
1142
1142
|
* @see https://tailwindcss.com/docs/content
|
|
1143
1143
|
*/
|
|
1144
1144
|
content: [{
|
|
1145
|
-
content: ["none",
|
|
1145
|
+
content: ["none", R]
|
|
1146
1146
|
}],
|
|
1147
1147
|
// Backgrounds
|
|
1148
1148
|
/**
|
|
@@ -1179,7 +1179,7 @@ const q = (e) => {
|
|
|
1179
1179
|
* @see https://tailwindcss.com/docs/background-position
|
|
1180
1180
|
*/
|
|
1181
1181
|
"bg-position": [{
|
|
1182
|
-
bg: [...
|
|
1182
|
+
bg: [...V(), vn]
|
|
1183
1183
|
}],
|
|
1184
1184
|
/**
|
|
1185
1185
|
* Background Repeat
|
|
@@ -1239,21 +1239,21 @@ const q = (e) => {
|
|
|
1239
1239
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1240
1240
|
*/
|
|
1241
1241
|
"gradient-from": [{
|
|
1242
|
-
from: [
|
|
1242
|
+
from: [p]
|
|
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: [p]
|
|
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: [p]
|
|
1257
1257
|
}],
|
|
1258
1258
|
// Borders
|
|
1259
1259
|
/**
|
|
@@ -1436,7 +1436,7 @@ const q = (e) => {
|
|
|
1436
1436
|
* @see https://tailwindcss.com/docs/border-style
|
|
1437
1437
|
*/
|
|
1438
1438
|
"border-style": [{
|
|
1439
|
-
border: [...
|
|
1439
|
+
border: [...P(), "hidden"]
|
|
1440
1440
|
}],
|
|
1441
1441
|
/**
|
|
1442
1442
|
* Divide Width X
|
|
@@ -1474,7 +1474,7 @@ const q = (e) => {
|
|
|
1474
1474
|
* @see https://tailwindcss.com/docs/divide-style
|
|
1475
1475
|
*/
|
|
1476
1476
|
"divide-style": [{
|
|
1477
|
-
divide:
|
|
1477
|
+
divide: P()
|
|
1478
1478
|
}],
|
|
1479
1479
|
/**
|
|
1480
1480
|
* Border Color
|
|
@@ -1551,14 +1551,14 @@ const q = (e) => {
|
|
|
1551
1551
|
* @see https://tailwindcss.com/docs/outline-style
|
|
1552
1552
|
*/
|
|
1553
1553
|
"outline-style": [{
|
|
1554
|
-
outline: ["", ...
|
|
1554
|
+
outline: ["", ...P()]
|
|
1555
1555
|
}],
|
|
1556
1556
|
/**
|
|
1557
1557
|
* Outline Offset
|
|
1558
1558
|
* @see https://tailwindcss.com/docs/outline-offset
|
|
1559
1559
|
*/
|
|
1560
1560
|
"outline-offset": [{
|
|
1561
|
-
"outline-offset": [pe,
|
|
1561
|
+
"outline-offset": [pe, R]
|
|
1562
1562
|
}],
|
|
1563
1563
|
/**
|
|
1564
1564
|
* Outline Width
|
|
@@ -1641,14 +1641,14 @@ const q = (e) => {
|
|
|
1641
1641
|
* @see https://tailwindcss.com/docs/mix-blend-mode
|
|
1642
1642
|
*/
|
|
1643
1643
|
"mix-blend": [{
|
|
1644
|
-
"mix-blend": [...
|
|
1644
|
+
"mix-blend": [...F(), "plus-lighter", "plus-darker"]
|
|
1645
1645
|
}],
|
|
1646
1646
|
/**
|
|
1647
1647
|
* Background Blend Mode
|
|
1648
1648
|
* @see https://tailwindcss.com/docs/background-blend-mode
|
|
1649
1649
|
*/
|
|
1650
1650
|
"bg-blend": [{
|
|
1651
|
-
"bg-blend":
|
|
1651
|
+
"bg-blend": F()
|
|
1652
1652
|
}],
|
|
1653
1653
|
// Filters
|
|
1654
1654
|
/**
|
|
@@ -1678,35 +1678,35 @@ const q = (e) => {
|
|
|
1678
1678
|
* @see https://tailwindcss.com/docs/contrast
|
|
1679
1679
|
*/
|
|
1680
1680
|
contrast: [{
|
|
1681
|
-
contrast: [
|
|
1681
|
+
contrast: [u]
|
|
1682
1682
|
}],
|
|
1683
1683
|
/**
|
|
1684
1684
|
* Drop Shadow
|
|
1685
1685
|
* @see https://tailwindcss.com/docs/drop-shadow
|
|
1686
1686
|
*/
|
|
1687
1687
|
"drop-shadow": [{
|
|
1688
|
-
"drop-shadow": ["", "none", ve,
|
|
1688
|
+
"drop-shadow": ["", "none", ve, R]
|
|
1689
1689
|
}],
|
|
1690
1690
|
/**
|
|
1691
1691
|
* Grayscale
|
|
1692
1692
|
* @see https://tailwindcss.com/docs/grayscale
|
|
1693
1693
|
*/
|
|
1694
1694
|
grayscale: [{
|
|
1695
|
-
grayscale: [
|
|
1695
|
+
grayscale: [l]
|
|
1696
1696
|
}],
|
|
1697
1697
|
/**
|
|
1698
1698
|
* Hue Rotate
|
|
1699
1699
|
* @see https://tailwindcss.com/docs/hue-rotate
|
|
1700
1700
|
*/
|
|
1701
1701
|
"hue-rotate": [{
|
|
1702
|
-
"hue-rotate": [
|
|
1702
|
+
"hue-rotate": [c]
|
|
1703
1703
|
}],
|
|
1704
1704
|
/**
|
|
1705
1705
|
* Invert
|
|
1706
1706
|
* @see https://tailwindcss.com/docs/invert
|
|
1707
1707
|
*/
|
|
1708
1708
|
invert: [{
|
|
1709
|
-
invert: [
|
|
1709
|
+
invert: [d]
|
|
1710
1710
|
}],
|
|
1711
1711
|
/**
|
|
1712
1712
|
* Saturate
|
|
@@ -1720,7 +1720,7 @@ const q = (e) => {
|
|
|
1720
1720
|
* @see https://tailwindcss.com/docs/sepia
|
|
1721
1721
|
*/
|
|
1722
1722
|
sepia: [{
|
|
1723
|
-
sepia: [
|
|
1723
|
+
sepia: [k]
|
|
1724
1724
|
}],
|
|
1725
1725
|
/**
|
|
1726
1726
|
* Backdrop Filter
|
|
@@ -1749,28 +1749,28 @@ const q = (e) => {
|
|
|
1749
1749
|
* @see https://tailwindcss.com/docs/backdrop-contrast
|
|
1750
1750
|
*/
|
|
1751
1751
|
"backdrop-contrast": [{
|
|
1752
|
-
"backdrop-contrast": [
|
|
1752
|
+
"backdrop-contrast": [u]
|
|
1753
1753
|
}],
|
|
1754
1754
|
/**
|
|
1755
1755
|
* Backdrop Grayscale
|
|
1756
1756
|
* @see https://tailwindcss.com/docs/backdrop-grayscale
|
|
1757
1757
|
*/
|
|
1758
1758
|
"backdrop-grayscale": [{
|
|
1759
|
-
"backdrop-grayscale": [
|
|
1759
|
+
"backdrop-grayscale": [l]
|
|
1760
1760
|
}],
|
|
1761
1761
|
/**
|
|
1762
1762
|
* Backdrop Hue Rotate
|
|
1763
1763
|
* @see https://tailwindcss.com/docs/backdrop-hue-rotate
|
|
1764
1764
|
*/
|
|
1765
1765
|
"backdrop-hue-rotate": [{
|
|
1766
|
-
"backdrop-hue-rotate": [
|
|
1766
|
+
"backdrop-hue-rotate": [c]
|
|
1767
1767
|
}],
|
|
1768
1768
|
/**
|
|
1769
1769
|
* Backdrop Invert
|
|
1770
1770
|
* @see https://tailwindcss.com/docs/backdrop-invert
|
|
1771
1771
|
*/
|
|
1772
1772
|
"backdrop-invert": [{
|
|
1773
|
-
"backdrop-invert": [
|
|
1773
|
+
"backdrop-invert": [d]
|
|
1774
1774
|
}],
|
|
1775
1775
|
/**
|
|
1776
1776
|
* Backdrop Opacity
|
|
@@ -1791,7 +1791,7 @@ const q = (e) => {
|
|
|
1791
1791
|
* @see https://tailwindcss.com/docs/backdrop-sepia
|
|
1792
1792
|
*/
|
|
1793
1793
|
"backdrop-sepia": [{
|
|
1794
|
-
"backdrop-sepia": [
|
|
1794
|
+
"backdrop-sepia": [k]
|
|
1795
1795
|
}],
|
|
1796
1796
|
// Tables
|
|
1797
1797
|
/**
|
|
@@ -1842,35 +1842,35 @@ const q = (e) => {
|
|
|
1842
1842
|
* @see https://tailwindcss.com/docs/transition-property
|
|
1843
1843
|
*/
|
|
1844
1844
|
transition: [{
|
|
1845
|
-
transition: ["none", "all", "", "colors", "opacity", "shadow", "transform",
|
|
1845
|
+
transition: ["none", "all", "", "colors", "opacity", "shadow", "transform", R]
|
|
1846
1846
|
}],
|
|
1847
1847
|
/**
|
|
1848
1848
|
* Transition Duration
|
|
1849
1849
|
* @see https://tailwindcss.com/docs/transition-duration
|
|
1850
1850
|
*/
|
|
1851
1851
|
duration: [{
|
|
1852
|
-
duration:
|
|
1852
|
+
duration: g()
|
|
1853
1853
|
}],
|
|
1854
1854
|
/**
|
|
1855
1855
|
* Transition Timing Function
|
|
1856
1856
|
* @see https://tailwindcss.com/docs/transition-timing-function
|
|
1857
1857
|
*/
|
|
1858
1858
|
ease: [{
|
|
1859
|
-
ease: ["linear", "in", "out", "in-out",
|
|
1859
|
+
ease: ["linear", "in", "out", "in-out", R]
|
|
1860
1860
|
}],
|
|
1861
1861
|
/**
|
|
1862
1862
|
* Transition Delay
|
|
1863
1863
|
* @see https://tailwindcss.com/docs/transition-delay
|
|
1864
1864
|
*/
|
|
1865
1865
|
delay: [{
|
|
1866
|
-
delay:
|
|
1866
|
+
delay: g()
|
|
1867
1867
|
}],
|
|
1868
1868
|
/**
|
|
1869
1869
|
* Animation
|
|
1870
1870
|
* @see https://tailwindcss.com/docs/animation
|
|
1871
1871
|
*/
|
|
1872
1872
|
animate: [{
|
|
1873
|
-
animate: ["none", "spin", "ping", "pulse", "bounce",
|
|
1873
|
+
animate: ["none", "spin", "ping", "pulse", "bounce", R]
|
|
1874
1874
|
}],
|
|
1875
1875
|
// Transforms
|
|
1876
1876
|
/**
|
|
@@ -1906,42 +1906,42 @@ const q = (e) => {
|
|
|
1906
1906
|
* @see https://tailwindcss.com/docs/rotate
|
|
1907
1907
|
*/
|
|
1908
1908
|
rotate: [{
|
|
1909
|
-
rotate: [_e,
|
|
1909
|
+
rotate: [_e, R]
|
|
1910
1910
|
}],
|
|
1911
1911
|
/**
|
|
1912
1912
|
* Translate X
|
|
1913
1913
|
* @see https://tailwindcss.com/docs/translate
|
|
1914
1914
|
*/
|
|
1915
1915
|
"translate-x": [{
|
|
1916
|
-
"translate-x": [
|
|
1916
|
+
"translate-x": [y]
|
|
1917
1917
|
}],
|
|
1918
1918
|
/**
|
|
1919
1919
|
* Translate Y
|
|
1920
1920
|
* @see https://tailwindcss.com/docs/translate
|
|
1921
1921
|
*/
|
|
1922
1922
|
"translate-y": [{
|
|
1923
|
-
"translate-y": [
|
|
1923
|
+
"translate-y": [y]
|
|
1924
1924
|
}],
|
|
1925
1925
|
/**
|
|
1926
1926
|
* Skew X
|
|
1927
1927
|
* @see https://tailwindcss.com/docs/skew
|
|
1928
1928
|
*/
|
|
1929
1929
|
"skew-x": [{
|
|
1930
|
-
"skew-x": [
|
|
1930
|
+
"skew-x": [b]
|
|
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": [b]
|
|
1938
1938
|
}],
|
|
1939
1939
|
/**
|
|
1940
1940
|
* Transform Origin
|
|
1941
1941
|
* @see https://tailwindcss.com/docs/transform-origin
|
|
1942
1942
|
*/
|
|
1943
1943
|
"transform-origin": [{
|
|
1944
|
-
origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left",
|
|
1944
|
+
origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", R]
|
|
1945
1945
|
}],
|
|
1946
1946
|
// Interactivity
|
|
1947
1947
|
/**
|
|
@@ -1963,7 +1963,7 @@ const q = (e) => {
|
|
|
1963
1963
|
* @see https://tailwindcss.com/docs/cursor
|
|
1964
1964
|
*/
|
|
1965
1965
|
cursor: [{
|
|
1966
|
-
cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out",
|
|
1966
|
+
cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", R]
|
|
1967
1967
|
}],
|
|
1968
1968
|
/**
|
|
1969
1969
|
* Caret Color
|
|
@@ -2185,7 +2185,7 @@ const q = (e) => {
|
|
|
2185
2185
|
* @see https://tailwindcss.com/docs/will-change
|
|
2186
2186
|
*/
|
|
2187
2187
|
"will-change": [{
|
|
2188
|
-
"will-change": ["auto", "scroll", "contents", "transform",
|
|
2188
|
+
"will-change": ["auto", "scroll", "contents", "transform", R]
|
|
2189
2189
|
}],
|
|
2190
2190
|
// SVG
|
|
2191
2191
|
/**
|
|
@@ -2200,7 +2200,7 @@ const q = (e) => {
|
|
|
2200
2200
|
* @see https://tailwindcss.com/docs/stroke-width
|
|
2201
2201
|
*/
|
|
2202
2202
|
"stroke-w": [{
|
|
2203
|
-
stroke: [pe, Ie,
|
|
2203
|
+
stroke: [pe, Ie, Ve]
|
|
2204
2204
|
}],
|
|
2205
2205
|
/**
|
|
2206
2206
|
* Stroke
|
|
@@ -2276,7 +2276,7 @@ const q = (e) => {
|
|
|
2276
2276
|
}
|
|
2277
2277
|
};
|
|
2278
2278
|
}, Pn = /* @__PURE__ */ un(En);
|
|
2279
|
-
function
|
|
2279
|
+
function rs(...e) {
|
|
2280
2280
|
return Pn(Qt(e));
|
|
2281
2281
|
}
|
|
2282
2282
|
function _n(e) {
|
|
@@ -2397,7 +2397,7 @@ function Et(e) {
|
|
|
2397
2397
|
return "";
|
|
2398
2398
|
}
|
|
2399
2399
|
}
|
|
2400
|
-
function
|
|
2400
|
+
function ss(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
|
}
|
|
@@ -2413,7 +2413,7 @@ function Fn(e) {
|
|
|
2413
2413
|
return n.length ? t(n.map((r) => r.text).join(`
|
|
2414
2414
|
`)) : t(e);
|
|
2415
2415
|
}
|
|
2416
|
-
function
|
|
2416
|
+
function os(e) {
|
|
2417
2417
|
return e.content.some((t) => t.type === "text" ? t.text.trim().length > 0 : t.type === "image_url" || t.type === "file");
|
|
2418
2418
|
}
|
|
2419
2419
|
function ue(e) {
|
|
@@ -2448,27 +2448,27 @@ function fe(e) {
|
|
|
2448
2448
|
);
|
|
2449
2449
|
}
|
|
2450
2450
|
function nt(e) {
|
|
2451
|
-
var x, S, A, w,
|
|
2451
|
+
var x, S, A, w, k, b, T;
|
|
2452
2452
|
if (!e || typeof e != "object") return null;
|
|
2453
2453
|
const t = fe(e), n = Kn(t);
|
|
2454
2454
|
if (!n)
|
|
2455
2455
|
return null;
|
|
2456
|
-
const r = t.toolCalls ?? ((x = t.additionalKwargs) == null ? void 0 : x.toolCalls), o = Array.isArray(r) ? r.map(rt) : void 0, s = Dn(t.content ?? t.parts, !!(o != null && o.length)), a = t.id ?? `msg-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`, i = t.createdAt ?? ((S = t.additionalKwargs) == null ? void 0 : S.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
2456
|
+
const r = t.toolCalls ?? ((x = t.additionalKwargs) == null ? void 0 : x.toolCalls), o = Array.isArray(r) ? r.map(rt) : void 0, s = Dn(t.content ?? t.parts, !!(o != null && o.length)), a = t.id ?? `msg-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`, i = t.createdAt ?? ((S = t.additionalKwargs) == null ? void 0 : S.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(), u = t.name ?? ((A = t.additionalKwargs) == null ? void 0 : A.agentName) ?? void 0, l = t.model ?? ((w = t.additionalKwargs) == null ? void 0 : w.model) ?? void 0, c = t.toolCallId ?? void 0, d = t.additionalKwargs ?? void 0, m = t.responseMetadata ?? void 0, p = t.checkpointId ?? ((k = t.additionalKwargs) == null ? void 0 : k.checkpointId) ?? void 0, I = t.checkpointNs ?? ((b = t.additionalKwargs) == null ? void 0 : b.checkpointNs) ?? void 0, f = typeof t.toolStreaming == "boolean" ? t.toolStreaming : !!((T = t.additionalKwargs) != null && T.toolStreaming);
|
|
2457
2457
|
return {
|
|
2458
2458
|
...t,
|
|
2459
2459
|
id: a,
|
|
2460
2460
|
role: n,
|
|
2461
2461
|
content: s,
|
|
2462
2462
|
createdAt: i,
|
|
2463
|
-
name:
|
|
2464
|
-
model:
|
|
2465
|
-
toolCallId:
|
|
2463
|
+
name: u,
|
|
2464
|
+
model: l,
|
|
2465
|
+
toolCallId: c,
|
|
2466
2466
|
toolCalls: o,
|
|
2467
|
-
checkpointId:
|
|
2467
|
+
checkpointId: p,
|
|
2468
2468
|
checkpointNs: I,
|
|
2469
|
-
toolStreaming:
|
|
2470
|
-
additionalKwargs:
|
|
2471
|
-
responseMetadata:
|
|
2469
|
+
toolStreaming: f,
|
|
2470
|
+
additionalKwargs: d,
|
|
2471
|
+
responseMetadata: m,
|
|
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
|
}
|
|
@@ -2512,12 +2512,12 @@ function dt(e) {
|
|
|
2512
2512
|
function ut(e) {
|
|
2513
2513
|
return (Array.isArray(e.toolCalls) ? e.toolCalls : Mt(e)).map(rt);
|
|
2514
2514
|
}
|
|
2515
|
-
function
|
|
2515
|
+
function qe(e, t) {
|
|
2516
2516
|
return t.find(
|
|
2517
2517
|
(n) => n.role === "tool" && (n.toolCallId === e || n.id === e)
|
|
2518
2518
|
);
|
|
2519
2519
|
}
|
|
2520
|
-
function
|
|
2520
|
+
function Hn(e, t) {
|
|
2521
2521
|
const n = t.response ?? t.content;
|
|
2522
2522
|
if (!n) return;
|
|
2523
2523
|
const r = typeof n == "string" ? n : Et(n);
|
|
@@ -2533,33 +2533,33 @@ function Vn(e, t) {
|
|
|
2533
2533
|
createdAt: e.createdAt
|
|
2534
2534
|
};
|
|
2535
2535
|
}
|
|
2536
|
-
function
|
|
2536
|
+
function Vn(e, t = []) {
|
|
2537
2537
|
if (Array.isArray(e)) {
|
|
2538
2538
|
const o = e.filter((a) => a.role === "assistant").flatMap((a) => ut(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 =
|
|
2542
|
-
if (i && !a.content &&
|
|
2540
|
+
var d, m, p;
|
|
2541
|
+
const i = qe(a.id, e) || qe(a.id, t), u = Array.isArray((d = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : d.toolProgress) ? (m = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : m.toolProgress : void 0, l = (i == null ? void 0 : i.artifact) ?? a.artifact, c = dt(a.status) ?? ((p = i == null ? void 0 : i.additionalKwargs) != null && p.toolStreaming ? "pending" : null) ?? (i ? "completed" : "pending");
|
|
2542
|
+
if (i && !a.content && c === "completed") {
|
|
2543
2543
|
const I = ue(i);
|
|
2544
2544
|
typeof I == "string" && (a.content = I);
|
|
2545
2545
|
}
|
|
2546
2546
|
return {
|
|
2547
2547
|
call: a,
|
|
2548
2548
|
result: i,
|
|
2549
|
-
state:
|
|
2550
|
-
progress:
|
|
2551
|
-
artifact:
|
|
2549
|
+
state: c,
|
|
2550
|
+
progress: u,
|
|
2551
|
+
artifact: l
|
|
2552
2552
|
};
|
|
2553
2553
|
});
|
|
2554
2554
|
}
|
|
2555
2555
|
if (e.role !== "assistant") return [];
|
|
2556
2556
|
const n = ut(e);
|
|
2557
2557
|
return n.length === 0 ? [] : n.map((r) => {
|
|
2558
|
-
var
|
|
2559
|
-
const o =
|
|
2558
|
+
var u, l, c;
|
|
2559
|
+
const o = qe(r.id, t) ?? Hn(e, r), s = Array.isArray((u = o == null ? void 0 : o.additionalKwargs) == null ? void 0 : u.toolProgress) ? (l = o == null ? void 0 : o.additionalKwargs) == null ? void 0 : l.toolProgress : void 0, a = (o == null ? void 0 : o.artifact) ?? r.artifact, i = dt(r.status) ?? ((c = o == null ? void 0 : o.additionalKwargs) != null && c.toolStreaming ? "pending" : null) ?? (o ? "completed" : "pending");
|
|
2560
2560
|
if (o && !r.content && i === "completed") {
|
|
2561
|
-
const
|
|
2562
|
-
typeof
|
|
2561
|
+
const d = ue(o);
|
|
2562
|
+
typeof d == "string" && (r.content = d);
|
|
2563
2563
|
}
|
|
2564
2564
|
return {
|
|
2565
2565
|
call: r,
|
|
@@ -2570,8 +2570,8 @@ function qn(e, t = []) {
|
|
|
2570
2570
|
};
|
|
2571
2571
|
});
|
|
2572
2572
|
}
|
|
2573
|
-
function
|
|
2574
|
-
return
|
|
2573
|
+
function as(e, t = []) {
|
|
2574
|
+
return Vn(e, t).map((n) => n.artifact).filter((n) => !!n);
|
|
2575
2575
|
}
|
|
2576
2576
|
const ze = {
|
|
2577
2577
|
authToken: "authToken",
|
|
@@ -2596,9 +2596,9 @@ function xe(e) {
|
|
|
2596
2596
|
function _t(e) {
|
|
2597
2597
|
return Qe.add(e), () => Qe.delete(e);
|
|
2598
2598
|
}
|
|
2599
|
-
const
|
|
2600
|
-
let Ye =
|
|
2601
|
-
const
|
|
2599
|
+
const qn = 12e4, Gn = 12e4;
|
|
2600
|
+
let Ye = qn, Nt = Gn;
|
|
2601
|
+
const se = Jt.create({
|
|
2602
2602
|
// BaseURL is set dynamically via ApiProvider -> api.updateConfig
|
|
2603
2603
|
timeout: Ye,
|
|
2604
2604
|
withCredentials: !0
|
|
@@ -2608,13 +2608,13 @@ function ft(e) {
|
|
|
2608
2608
|
}
|
|
2609
2609
|
function Wn(e) {
|
|
2610
2610
|
const t = ft(e.requestTimeoutMs), n = ft(e.historyTimeoutMs);
|
|
2611
|
-
t !== null && (Ye = t,
|
|
2611
|
+
t !== null && (Ye = t, se.defaults.timeout = Ye), n !== null && (Nt = n);
|
|
2612
2612
|
}
|
|
2613
2613
|
function Jn() {
|
|
2614
2614
|
return Nt;
|
|
2615
2615
|
}
|
|
2616
|
-
|
|
2617
|
-
|
|
2616
|
+
se.interceptors.request.use((e) => (Ke && (e.headers.Authorization = `Bearer ${Ke}`), e));
|
|
2617
|
+
se.interceptors.response.use(
|
|
2618
2618
|
(e) => {
|
|
2619
2619
|
if (typeof window < "u" && (e != null && e.data))
|
|
2620
2620
|
try {
|
|
@@ -2632,16 +2632,16 @@ oe.interceptors.response.use(
|
|
|
2632
2632
|
(e) => Promise.reject(e)
|
|
2633
2633
|
);
|
|
2634
2634
|
async function ae(e, t) {
|
|
2635
|
-
return
|
|
2635
|
+
return se.defaults.baseURL ? (await se.get(e, t)).data : Promise.reject(new Error("API base URL is not configured"));
|
|
2636
2636
|
}
|
|
2637
2637
|
async function Ze(e, t, n) {
|
|
2638
|
-
return
|
|
2638
|
+
return se.defaults.baseURL ? (await se.post(e, t, n)).data : Promise.reject(new Error("API base URL is not configured"));
|
|
2639
2639
|
}
|
|
2640
2640
|
async function Xn(e, t, n) {
|
|
2641
|
-
return
|
|
2641
|
+
return se.defaults.baseURL ? (await se.put(e, t, n)).data : Promise.reject(new Error("API base URL is not configured"));
|
|
2642
2642
|
}
|
|
2643
2643
|
async function Qn(e, t) {
|
|
2644
|
-
return
|
|
2644
|
+
return se.defaults.baseURL ? (await se.delete(e, t)).data : Promise.reject(new Error("API base URL is not configured"));
|
|
2645
2645
|
}
|
|
2646
2646
|
function le(e) {
|
|
2647
2647
|
return e && typeof e == "object" && "data" in e ? e.data : e;
|
|
@@ -2651,14 +2651,14 @@ class Yn {
|
|
|
2651
2651
|
// Chat client uses the default httpClient baseURL, no need for internal tracking
|
|
2652
2652
|
// unless we want to support multiple instances with different URLs in the future.
|
|
2653
2653
|
get baseUrl() {
|
|
2654
|
-
return
|
|
2654
|
+
return se.defaults.baseURL || "";
|
|
2655
2655
|
}
|
|
2656
2656
|
updateConfig(t) {
|
|
2657
2657
|
if (t.chatBaseUrl)
|
|
2658
|
-
|
|
2658
|
+
se.defaults.baseURL = t.chatBaseUrl;
|
|
2659
2659
|
else if (t.baseUrl) {
|
|
2660
2660
|
const n = t.baseUrl.replace(/\/+$/, "");
|
|
2661
|
-
|
|
2661
|
+
se.defaults.baseURL = n;
|
|
2662
2662
|
}
|
|
2663
2663
|
t.apiKey !== void 0 ? xe(t.apiKey) : t.getToken && xe(t.getToken()), (t.requestTimeoutMs !== void 0 || t.historyTimeoutMs !== void 0) && Wn({
|
|
2664
2664
|
requestTimeoutMs: t.requestTimeoutMs,
|
|
@@ -2842,8 +2842,8 @@ 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);
|
|
@@ -2873,7 +2873,7 @@ async function rr(e) {
|
|
|
2873
2873
|
}, r.onerror = (o) => n(o), r.readAsArrayBuffer(e);
|
|
2874
2874
|
});
|
|
2875
2875
|
}
|
|
2876
|
-
async function
|
|
2876
|
+
async function sr(e = []) {
|
|
2877
2877
|
const t = [], n = [];
|
|
2878
2878
|
for (const r of e)
|
|
2879
2879
|
try {
|
|
@@ -2896,10 +2896,10 @@ async function or(e = []) {
|
|
|
2896
2896
|
}
|
|
2897
2897
|
return { contentParts: t, filesInfo: n };
|
|
2898
2898
|
}
|
|
2899
|
-
function
|
|
2899
|
+
function or(e) {
|
|
2900
2900
|
return e.filter((t) => t.type === "text").map((t) => t.text).join("");
|
|
2901
2901
|
}
|
|
2902
|
-
function
|
|
2902
|
+
function is(e) {
|
|
2903
2903
|
if (e == null) return null;
|
|
2904
2904
|
const t = String(e).trim();
|
|
2905
2905
|
return t.length > 0 ? t : null;
|
|
@@ -2911,13 +2911,13 @@ function ar(e) {
|
|
|
2911
2911
|
name: e.name ?? void 0
|
|
2912
2912
|
};
|
|
2913
2913
|
}
|
|
2914
|
-
function
|
|
2914
|
+
function cs(e) {
|
|
2915
2915
|
var n;
|
|
2916
2916
|
if (e.name && e.name.trim()) return e.name;
|
|
2917
2917
|
const t = (n = e.additionalKwargs) == null ? void 0 : n.agentName;
|
|
2918
2918
|
return typeof t == "string" && t.trim() ? t : e.model && e.model.includes("/") ? e.model.split("/").pop() || null : e.model || null;
|
|
2919
2919
|
}
|
|
2920
|
-
function
|
|
2920
|
+
function ls(e) {
|
|
2921
2921
|
const t = e.updatedAt ?? e.createdAt ?? "", n = Array.isArray(e.content) ? e.content.map((a) => {
|
|
2922
2922
|
switch (a.type) {
|
|
2923
2923
|
case "text":
|
|
@@ -3009,134 +3009,134 @@ function fr(e, t) {
|
|
|
3009
3009
|
return "type" in n || (n.type = e), n;
|
|
3010
3010
|
}
|
|
3011
3011
|
function pr(e = {}) {
|
|
3012
|
-
const t = e.baseUrl || "", n = e.streamPath ?? "/stream", [r, o] =
|
|
3012
|
+
const t = e.baseUrl || "", n = e.streamPath ?? "/stream", [r, o] = H(e.token ?? null), s = W(e.headers ?? {}), a = e.credentials ?? "include", i = W(e);
|
|
3013
3013
|
Y(() => {
|
|
3014
3014
|
i.current = e;
|
|
3015
3015
|
}, [e]);
|
|
3016
|
-
const
|
|
3017
|
-
var
|
|
3018
|
-
const
|
|
3019
|
-
if (!
|
|
3020
|
-
(
|
|
3021
|
-
}, []), [
|
|
3022
|
-
o(
|
|
3016
|
+
const u = N((y) => {
|
|
3017
|
+
var L, M, $, U, V, P, F, E, j, G;
|
|
3018
|
+
const v = i.current;
|
|
3019
|
+
if (!v) return;
|
|
3020
|
+
(L = v.onEvent) == null || L.call(v, y), y.type === "thread_info" && ((M = v.onThreadInfo) == null || M.call(v, y)), y.type === "values" && (($ = v.handleValuesEvent) == null || $.call(v, y)), y.type === "metadata" && ((U = v.onMetadataEvent) == null || U.call(v, y)), typeof y.type == "string" && (y.type === "custom" || y.type.startsWith("custom.")) && ((V = v.onCustomEvent) == null || V.call(v, y)), y.type === "updates" && ((P = v.onUpdateEvent) == null || P.call(v, y)), y.type === "tool.end" ? (F = v.onToolEnd) == null || F.call(v, y) : y.type === "tool.start" && ((E = v.onToolStart) == null || E.call(v, y)), y.type === "heartbeat" && ((j = v.onHeartbeat) == null || j.call(v, y)), y.type === "token" && ((G = v.onToken) == null || G.call(v, y.token));
|
|
3021
|
+
}, []), [l, c] = H(!1), [d, m] = H(null), [p, I] = H(!1), [f, h] = H(null), x = W(null), S = W(!0), A = W(null), w = N((y) => {
|
|
3022
|
+
o(y);
|
|
3023
|
+
}, []), k = N(() => {
|
|
3024
|
+
m(null), h(null);
|
|
3023
3025
|
}, []), b = N(() => {
|
|
3024
|
-
p(null), v(null);
|
|
3025
|
-
}, []), y = N(() => {
|
|
3026
3026
|
var M, $;
|
|
3027
3027
|
console.debug("[use-chat] stop() invoked - aborting stream");
|
|
3028
|
-
const
|
|
3029
|
-
var
|
|
3030
|
-
(
|
|
3028
|
+
const y = (M = A.current) == null ? void 0 : M.threadId, v = ($ = A.current) == null ? void 0 : $.runId, _ = () => {
|
|
3029
|
+
var U;
|
|
3030
|
+
(U = x.current) == null || U.abort(), x.current = null, A.current = null, c(!1), I(!1);
|
|
3031
3031
|
};
|
|
3032
|
-
(
|
|
3033
|
-
console.warn("[use-chat] cancel run failed:",
|
|
3034
|
-
}) : Promise.resolve()).finally(
|
|
3032
|
+
(v || y ? zt.cancelRun(v || y).catch((U) => {
|
|
3033
|
+
console.warn("[use-chat] cancel run failed:", U);
|
|
3034
|
+
}) : Promise.resolve()).finally(_);
|
|
3035
3035
|
}, []), T = N(
|
|
3036
|
-
(
|
|
3036
|
+
(y) => {
|
|
3037
3037
|
x.current && (x.current.abort(), x.current = null);
|
|
3038
|
-
const
|
|
3039
|
-
text: typeof
|
|
3040
|
-
threadId:
|
|
3041
|
-
attachments:
|
|
3042
|
-
payload:
|
|
3043
|
-
...
|
|
3044
|
-
creativityLevel:
|
|
3038
|
+
const v = {
|
|
3039
|
+
text: typeof y.content == "string" ? y.content : y.text,
|
|
3040
|
+
threadId: y.threadId,
|
|
3041
|
+
attachments: y.attachments,
|
|
3042
|
+
payload: y.payload ? {
|
|
3043
|
+
...y.payload,
|
|
3044
|
+
creativityLevel: y.payload.creativityLevel ?? "medium"
|
|
3045
3045
|
} : { creativityLevel: "medium" },
|
|
3046
|
-
config:
|
|
3047
|
-
checkpointId:
|
|
3048
|
-
checkpointNs:
|
|
3049
|
-
edit:
|
|
3050
|
-
command:
|
|
3046
|
+
config: y.config,
|
|
3047
|
+
checkpointId: y.checkpointId,
|
|
3048
|
+
checkpointNs: y.checkpointNs || void 0,
|
|
3049
|
+
edit: y.edit ?? !1,
|
|
3050
|
+
command: y.command
|
|
3051
3051
|
};
|
|
3052
|
-
|
|
3053
|
-
const
|
|
3054
|
-
x.current =
|
|
3055
|
-
let
|
|
3052
|
+
c(!0), m(null), h(null);
|
|
3053
|
+
const _ = new AbortController();
|
|
3054
|
+
x.current = _;
|
|
3055
|
+
let L = null, M = !1;
|
|
3056
3056
|
return A.current = {
|
|
3057
|
-
threadId:
|
|
3057
|
+
threadId: v.threadId ?? void 0,
|
|
3058
3058
|
runId: void 0,
|
|
3059
3059
|
// Will be updated from headers
|
|
3060
3060
|
headers: {},
|
|
3061
3061
|
isStreaming: !0
|
|
3062
3062
|
}, (async () => {
|
|
3063
|
-
var $,
|
|
3063
|
+
var $, U, V, P, F, E;
|
|
3064
3064
|
try {
|
|
3065
|
-
let
|
|
3065
|
+
let j = {};
|
|
3066
3066
|
try {
|
|
3067
3067
|
if (r)
|
|
3068
|
-
|
|
3068
|
+
j = { Authorization: `Bearer ${r}` };
|
|
3069
3069
|
else if (typeof window < "u") {
|
|
3070
|
-
const
|
|
3070
|
+
const oe = window.__AUTH_TOKEN__, he = (($ = window.localStorage) == null ? void 0 : $.getItem(ze.authToken)) || null;
|
|
3071
3071
|
let X = null;
|
|
3072
3072
|
try {
|
|
3073
|
-
const be = (
|
|
3074
|
-
be && (X = ((
|
|
3073
|
+
const be = (U = window.localStorage) == null ? void 0 : U.getItem(ze.chatSettings);
|
|
3074
|
+
be && (X = ((V = JSON.parse(be)) == null ? void 0 : V.apiKey) || null);
|
|
3075
3075
|
} catch {
|
|
3076
3076
|
}
|
|
3077
|
-
const Q =
|
|
3078
|
-
Q && (
|
|
3077
|
+
const Q = oe || he || X || null;
|
|
3078
|
+
Q && (j = { Authorization: `Bearer ${Q}` });
|
|
3079
3079
|
}
|
|
3080
3080
|
} catch {
|
|
3081
3081
|
}
|
|
3082
3082
|
console.debug("[use-chat] POST", t + n);
|
|
3083
|
-
let
|
|
3083
|
+
let G = {};
|
|
3084
3084
|
if (typeof window < "u")
|
|
3085
3085
|
try {
|
|
3086
|
-
const
|
|
3087
|
-
|
|
3086
|
+
const J = (P = window.localStorage) == null ? void 0 : P.getItem(ze.authSessionId);
|
|
3087
|
+
J && (G = { "X-Session-Id": J });
|
|
3088
3088
|
} catch {
|
|
3089
3089
|
}
|
|
3090
|
-
const
|
|
3091
|
-
...
|
|
3092
|
-
...
|
|
3090
|
+
const g = {
|
|
3091
|
+
...j,
|
|
3092
|
+
...G,
|
|
3093
3093
|
...s.current
|
|
3094
|
-
},
|
|
3094
|
+
}, z = {
|
|
3095
3095
|
"Content-Type": "application/json",
|
|
3096
3096
|
Accept: "text/event-stream",
|
|
3097
|
-
...
|
|
3097
|
+
...g
|
|
3098
3098
|
}, C = await fetch(t + n, {
|
|
3099
3099
|
method: "POST",
|
|
3100
|
-
headers:
|
|
3101
|
-
body: JSON.stringify(
|
|
3102
|
-
signal:
|
|
3100
|
+
headers: z,
|
|
3101
|
+
body: JSON.stringify(v),
|
|
3102
|
+
signal: _.signal,
|
|
3103
3103
|
credentials: a
|
|
3104
3104
|
});
|
|
3105
|
-
if (A.current && (A.current.headers =
|
|
3106
|
-
const
|
|
3105
|
+
if (A.current && (A.current.headers = g), !C.ok || !C.body) {
|
|
3106
|
+
const J = await C.text().catch(() => "");
|
|
3107
3107
|
console.debug(
|
|
3108
3108
|
"[use-chat] non-OK response",
|
|
3109
3109
|
C.status,
|
|
3110
|
-
|
|
3110
|
+
J == null ? void 0 : J.slice(0, 500)
|
|
3111
3111
|
);
|
|
3112
|
-
const
|
|
3113
|
-
throw
|
|
3112
|
+
const oe = `stream ${C.status}${J ? ": " + J : ""}`;
|
|
3113
|
+
throw oe && (m(oe), L = "error"), new Error(oe);
|
|
3114
3114
|
}
|
|
3115
3115
|
I(!0);
|
|
3116
|
-
const
|
|
3117
|
-
let K = "",
|
|
3116
|
+
const O = C.body.getReader(), D = new TextDecoder();
|
|
3117
|
+
let K = "", B = 0, ee = Date.now();
|
|
3118
3118
|
const ie = setInterval(() => {
|
|
3119
|
-
Date.now() - ee > 18e5 && (
|
|
3119
|
+
Date.now() - ee > 18e5 && (m("Stream idle timeout"), L = "error", _.abort());
|
|
3120
3120
|
}, 5e3), ye = 1024 * 1024;
|
|
3121
3121
|
try {
|
|
3122
|
-
const
|
|
3122
|
+
const J = C.headers.get("X-Thread-Id") || C.headers.get("x-thread-id"), oe = C.headers.get("X-Run-Id") || C.headers.get("x-run-id");
|
|
3123
3123
|
for (A.current && (A.current = {
|
|
3124
3124
|
...A.current,
|
|
3125
|
-
threadId:
|
|
3126
|
-
runId:
|
|
3125
|
+
threadId: J ?? A.current.threadId,
|
|
3126
|
+
runId: oe ?? A.current.runId
|
|
3127
3127
|
}); ; ) {
|
|
3128
|
-
const { value: he, done: X } = await
|
|
3128
|
+
const { value: he, done: X } = await O.read();
|
|
3129
3129
|
if (X) break;
|
|
3130
|
-
K +=
|
|
3130
|
+
K += D.decode(he, { stream: !0 }), K.length > ye && (K = "", console.warn("Stream buffer reset: exceeded 1MB"));
|
|
3131
3131
|
let Q;
|
|
3132
3132
|
for (; (Q = K.indexOf(`
|
|
3133
3133
|
|
|
3134
3134
|
`)) >= 0; ) {
|
|
3135
3135
|
const be = K.slice(0, Q);
|
|
3136
3136
|
K = K.slice(Q + 2);
|
|
3137
|
-
const
|
|
3137
|
+
const He = be.split(/\r?\n/), we = [];
|
|
3138
3138
|
let Pe = null;
|
|
3139
|
-
for (const ce of
|
|
3139
|
+
for (const ce of He)
|
|
3140
3140
|
if (!ce.startsWith(":") && ce) {
|
|
3141
3141
|
if (ce.startsWith("event:")) {
|
|
3142
3142
|
const Ae = ce.slice(6).trim();
|
|
@@ -3168,85 +3168,85 @@ function pr(e = {}) {
|
|
|
3168
3168
|
ee = Date.now();
|
|
3169
3169
|
const te = typeof re.seq == "number" ? re.seq : void 0;
|
|
3170
3170
|
if (te !== void 0) {
|
|
3171
|
-
if (te <=
|
|
3172
|
-
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: te, lastProcessedSeq:
|
|
3171
|
+
if (te <= B) {
|
|
3172
|
+
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: te, lastProcessedSeq: B, type: re.type });
|
|
3173
3173
|
continue;
|
|
3174
3174
|
}
|
|
3175
|
-
|
|
3175
|
+
B = te;
|
|
3176
3176
|
}
|
|
3177
|
-
|
|
3177
|
+
u(re);
|
|
3178
3178
|
}
|
|
3179
3179
|
}
|
|
3180
|
-
|
|
3181
|
-
} catch (
|
|
3182
|
-
if (
|
|
3183
|
-
|
|
3180
|
+
L === null && !_.signal.aborted && (L = "complete");
|
|
3181
|
+
} catch (J) {
|
|
3182
|
+
if (J.name === "AbortError")
|
|
3183
|
+
L = L ?? "aborted";
|
|
3184
3184
|
else {
|
|
3185
|
-
const
|
|
3186
|
-
|
|
3185
|
+
const oe = J.message || String(J);
|
|
3186
|
+
L = "error", m(oe);
|
|
3187
3187
|
}
|
|
3188
3188
|
} finally {
|
|
3189
3189
|
try {
|
|
3190
|
-
await
|
|
3190
|
+
await O.cancel();
|
|
3191
3191
|
} catch {
|
|
3192
3192
|
} finally {
|
|
3193
|
-
(
|
|
3193
|
+
(F = O.releaseLock) == null || F.call(O);
|
|
3194
3194
|
}
|
|
3195
3195
|
clearInterval(ie);
|
|
3196
3196
|
}
|
|
3197
|
-
} catch (
|
|
3198
|
-
if (
|
|
3199
|
-
|
|
3197
|
+
} catch (j) {
|
|
3198
|
+
if (j.name === "AbortError")
|
|
3199
|
+
L = L ?? "aborted";
|
|
3200
3200
|
else {
|
|
3201
|
-
const
|
|
3202
|
-
|
|
3201
|
+
const G = j.message || String(j);
|
|
3202
|
+
L = "error", m(G), M || (M = !0, (E = e.onConnectionError) == null || E.call(e, G));
|
|
3203
3203
|
}
|
|
3204
3204
|
} finally {
|
|
3205
3205
|
try {
|
|
3206
3206
|
if (e.onFinish) {
|
|
3207
|
-
const
|
|
3207
|
+
const j = {
|
|
3208
3208
|
lastSeq: 0,
|
|
3209
3209
|
lastCheckpointId: null,
|
|
3210
3210
|
lastCheckpointNs: null,
|
|
3211
3211
|
lastValues: null
|
|
3212
3212
|
// Let the reducer/history hook provide the final values
|
|
3213
3213
|
};
|
|
3214
|
-
e.onFinish(
|
|
3214
|
+
e.onFinish(j);
|
|
3215
3215
|
}
|
|
3216
|
-
} catch (
|
|
3217
|
-
console.warn("[use-chat] onClosed callback failed",
|
|
3216
|
+
} catch (j) {
|
|
3217
|
+
console.warn("[use-chat] onClosed callback failed", j);
|
|
3218
3218
|
}
|
|
3219
|
-
|
|
3219
|
+
c(!1), I(!1), x.current = null, A.current = null;
|
|
3220
3220
|
}
|
|
3221
3221
|
})(), Promise.resolve();
|
|
3222
3222
|
},
|
|
3223
|
-
[t, n, r, e,
|
|
3223
|
+
[t, n, r, e, u]
|
|
3224
3224
|
);
|
|
3225
3225
|
return Y(() => () => {
|
|
3226
|
-
var
|
|
3227
|
-
S.current = !1, (
|
|
3226
|
+
var y;
|
|
3227
|
+
S.current = !1, (y = x.current) == null || y.abort();
|
|
3228
3228
|
}, []), {
|
|
3229
|
-
isStreaming:
|
|
3230
|
-
error:
|
|
3229
|
+
isStreaming: l,
|
|
3230
|
+
error: d,
|
|
3231
3231
|
assistantText: "",
|
|
3232
3232
|
// Deprecated: use messages from reducer
|
|
3233
|
-
activeMessageId:
|
|
3233
|
+
activeMessageId: f,
|
|
3234
3234
|
streamedMessages: {},
|
|
3235
3235
|
// Deprecated: use messages from reducer
|
|
3236
3236
|
lastCheckpointId: null,
|
|
3237
3237
|
// Deprecated: use checkpoint from reducer
|
|
3238
3238
|
lastSeq: 0,
|
|
3239
|
-
connected:
|
|
3239
|
+
connected: p,
|
|
3240
3240
|
stream: T,
|
|
3241
|
-
stop:
|
|
3242
|
-
clear:
|
|
3241
|
+
stop: b,
|
|
3242
|
+
clear: k,
|
|
3243
3243
|
setToken: w,
|
|
3244
3244
|
values: {},
|
|
3245
3245
|
// Provide empty object for backward compatibility
|
|
3246
3246
|
interrupt: () => Promise.resolve(),
|
|
3247
3247
|
resume: () => Promise.resolve(),
|
|
3248
3248
|
goto: () => Promise.resolve(),
|
|
3249
|
-
connectionState:
|
|
3249
|
+
connectionState: d ? "error" : l ? p ? "connected" : "connecting" : "idle",
|
|
3250
3250
|
messages: [],
|
|
3251
3251
|
// useStream doesn't maintain messages, use useChatSession instead
|
|
3252
3252
|
submit: T
|
|
@@ -3259,103 +3259,103 @@ function gr({
|
|
|
3259
3259
|
onThreadChange: r,
|
|
3260
3260
|
onCurrentThreadDeleted: o
|
|
3261
3261
|
}) {
|
|
3262
|
-
const [s, a] =
|
|
3262
|
+
const [s, a] = H([]), [i, u] = H(t), [l, c] = H(!1), [d, m] = H(null), p = W(i), I = W(/* @__PURE__ */ new Map());
|
|
3263
3263
|
Y(() => {
|
|
3264
|
-
|
|
3264
|
+
p.current = i;
|
|
3265
3265
|
}, [i]), Y(() => {
|
|
3266
|
-
t !== void 0 && t !==
|
|
3266
|
+
t !== void 0 && t !== p.current && u(t);
|
|
3267
3267
|
}, [t]);
|
|
3268
|
-
const
|
|
3269
|
-
|
|
3268
|
+
const f = N(async () => {
|
|
3269
|
+
c(!0), m(null);
|
|
3270
3270
|
try {
|
|
3271
|
-
const
|
|
3272
|
-
a(
|
|
3273
|
-
} catch (
|
|
3274
|
-
const
|
|
3275
|
-
|
|
3271
|
+
const k = await e.listThreads();
|
|
3272
|
+
a(k ?? []);
|
|
3273
|
+
} catch (k) {
|
|
3274
|
+
const b = String(k);
|
|
3275
|
+
m(b), n == null || n(b);
|
|
3276
3276
|
} finally {
|
|
3277
|
-
|
|
3277
|
+
c(!1);
|
|
3278
3278
|
}
|
|
3279
3279
|
}, [e, n]);
|
|
3280
3280
|
Y(() => {
|
|
3281
|
-
|
|
3282
|
-
}, [
|
|
3281
|
+
f();
|
|
3282
|
+
}, [f]), Y(() => {
|
|
3283
3283
|
r == null || r(i);
|
|
3284
3284
|
}, [i, r]);
|
|
3285
|
-
const
|
|
3286
|
-
async (
|
|
3285
|
+
const h = N(
|
|
3286
|
+
async (k, b) => {
|
|
3287
3287
|
try {
|
|
3288
|
-
const T =
|
|
3289
|
-
return
|
|
3288
|
+
const T = b && typeof b == "object" ? { id: b.id, name: b.name ?? "" } : void 0, y = await e.createThread(k, T);
|
|
3289
|
+
return u(y.threadId), await f(), y.threadId;
|
|
3290
3290
|
} catch (T) {
|
|
3291
|
-
const
|
|
3292
|
-
return n == null || n(
|
|
3291
|
+
const y = String(T);
|
|
3292
|
+
return n == null || n(y), null;
|
|
3293
3293
|
}
|
|
3294
3294
|
},
|
|
3295
|
-
[e, n,
|
|
3295
|
+
[e, n, f]
|
|
3296
3296
|
), x = N(
|
|
3297
|
-
async (
|
|
3298
|
-
const
|
|
3299
|
-
a((
|
|
3297
|
+
async (k) => {
|
|
3298
|
+
const b = s;
|
|
3299
|
+
a((y) => y.filter((v) => v.threadId !== k));
|
|
3300
3300
|
const T = new AbortController();
|
|
3301
|
-
I.current.set(
|
|
3301
|
+
I.current.set(k, T);
|
|
3302
3302
|
try {
|
|
3303
|
-
await e.deleteThread(
|
|
3304
|
-
} catch (
|
|
3305
|
-
a(
|
|
3306
|
-
const
|
|
3307
|
-
n == null || n(
|
|
3303
|
+
await e.deleteThread(k), p.current === k && (u(null), o == null || o());
|
|
3304
|
+
} catch (y) {
|
|
3305
|
+
a(b);
|
|
3306
|
+
const v = String(y);
|
|
3307
|
+
n == null || n(v);
|
|
3308
3308
|
} finally {
|
|
3309
|
-
I.current.delete(
|
|
3309
|
+
I.current.delete(k);
|
|
3310
3310
|
}
|
|
3311
3311
|
},
|
|
3312
3312
|
[e, o, n, s]
|
|
3313
3313
|
), S = N(
|
|
3314
|
-
async (
|
|
3314
|
+
async (k, b) => {
|
|
3315
3315
|
try {
|
|
3316
|
-
await e.updateThread(
|
|
3316
|
+
await e.updateThread(k, b), await f();
|
|
3317
3317
|
} catch (T) {
|
|
3318
3318
|
n == null || n(String(T));
|
|
3319
3319
|
}
|
|
3320
3320
|
},
|
|
3321
|
-
[e, n,
|
|
3321
|
+
[e, n, f]
|
|
3322
3322
|
), A = Z(
|
|
3323
3323
|
() => ({
|
|
3324
|
-
createThread:
|
|
3324
|
+
createThread: h,
|
|
3325
3325
|
deleteThread: x,
|
|
3326
3326
|
renameThread: S,
|
|
3327
|
-
refreshThreads:
|
|
3327
|
+
refreshThreads: f
|
|
3328
3328
|
}),
|
|
3329
|
-
[
|
|
3330
|
-
), w = N((
|
|
3331
|
-
if (!(
|
|
3332
|
-
const
|
|
3333
|
-
threadId:
|
|
3334
|
-
title:
|
|
3335
|
-
project:
|
|
3336
|
-
createdAt:
|
|
3337
|
-
updatedAt:
|
|
3338
|
-
messageCount:
|
|
3329
|
+
[h, x, S, f]
|
|
3330
|
+
), w = N((k) => {
|
|
3331
|
+
if (!(k != null && k.threadId)) return;
|
|
3332
|
+
const b = {
|
|
3333
|
+
threadId: k.threadId,
|
|
3334
|
+
title: k.title || `Thread ${k.threadId.slice(0, 8)}`,
|
|
3335
|
+
project: k.project,
|
|
3336
|
+
createdAt: k.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
3337
|
+
updatedAt: k.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
3338
|
+
messageCount: k.messageCount ?? 1
|
|
3339
3339
|
};
|
|
3340
3340
|
a((T) => {
|
|
3341
|
-
let
|
|
3342
|
-
const
|
|
3343
|
-
...
|
|
3344
|
-
title:
|
|
3345
|
-
project:
|
|
3346
|
-
updatedAt:
|
|
3347
|
-
messageCount:
|
|
3348
|
-
}) :
|
|
3349
|
-
return
|
|
3341
|
+
let y = !1;
|
|
3342
|
+
const v = T.map((_) => _.threadId === b.threadId ? (y = !0, console.debug("[useThreadsState] thread_info: updating existing thread", b.threadId), {
|
|
3343
|
+
..._,
|
|
3344
|
+
title: b.title ?? _.title,
|
|
3345
|
+
project: b.project ?? _.project,
|
|
3346
|
+
updatedAt: b.updatedAt ?? _.updatedAt,
|
|
3347
|
+
messageCount: b.messageCount ?? _.messageCount
|
|
3348
|
+
}) : _);
|
|
3349
|
+
return y ? v : (console.debug("[useThreadsState] thread_info: adding thread to list", b.threadId), [b, ...T]);
|
|
3350
3350
|
});
|
|
3351
3351
|
}, []);
|
|
3352
3352
|
return {
|
|
3353
3353
|
threads: s,
|
|
3354
3354
|
currentThreadId: i,
|
|
3355
|
-
currentThreadIdRef:
|
|
3356
|
-
setCurrentThreadId:
|
|
3357
|
-
isLoadingThreads:
|
|
3358
|
-
threadsError:
|
|
3355
|
+
currentThreadIdRef: p,
|
|
3356
|
+
setCurrentThreadId: u,
|
|
3357
|
+
isLoadingThreads: l,
|
|
3358
|
+
threadsError: d,
|
|
3359
3359
|
actions: A,
|
|
3360
3360
|
addThreadFromEvent: w
|
|
3361
3361
|
};
|
|
@@ -3371,41 +3371,41 @@ function mr({
|
|
|
3371
3371
|
threads: s,
|
|
3372
3372
|
currentThreadId: a,
|
|
3373
3373
|
setCurrentThreadId: i,
|
|
3374
|
-
currentThreadIdRef:
|
|
3375
|
-
isLoadingThreads:
|
|
3376
|
-
threadsError:
|
|
3377
|
-
actions:
|
|
3378
|
-
addThreadFromEvent:
|
|
3374
|
+
currentThreadIdRef: u,
|
|
3375
|
+
isLoadingThreads: l,
|
|
3376
|
+
threadsError: c,
|
|
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
|
+
}), p = Z(
|
|
3385
3385
|
() => ({
|
|
3386
3386
|
threads: s,
|
|
3387
3387
|
currentThreadId: a,
|
|
3388
3388
|
setCurrentThreadId: i,
|
|
3389
|
-
currentThreadIdRef:
|
|
3390
|
-
isLoading:
|
|
3391
|
-
error:
|
|
3392
|
-
actions:
|
|
3393
|
-
addThreadFromEvent:
|
|
3389
|
+
currentThreadIdRef: u,
|
|
3390
|
+
isLoading: l,
|
|
3391
|
+
error: c,
|
|
3392
|
+
actions: d,
|
|
3393
|
+
addThreadFromEvent: m
|
|
3394
3394
|
}),
|
|
3395
3395
|
[
|
|
3396
3396
|
s,
|
|
3397
3397
|
a,
|
|
3398
3398
|
i,
|
|
3399
|
-
|
|
3400
|
-
c,
|
|
3399
|
+
u,
|
|
3401
3400
|
l,
|
|
3402
|
-
|
|
3403
|
-
|
|
3401
|
+
c,
|
|
3402
|
+
d,
|
|
3403
|
+
m
|
|
3404
3404
|
]
|
|
3405
3405
|
);
|
|
3406
|
-
return /* @__PURE__ */ de(Ut.Provider, { value:
|
|
3406
|
+
return /* @__PURE__ */ de(Ut.Provider, { value: p, children: e });
|
|
3407
3407
|
}
|
|
3408
|
-
function
|
|
3408
|
+
function st(e) {
|
|
3409
3409
|
const t = je(Ut);
|
|
3410
3410
|
if (!t && !(e != null && e.optional)) throw new Error("useThreads must be used within a ThreadsProvider");
|
|
3411
3411
|
return t;
|
|
@@ -3537,22 +3537,22 @@ function wr(e, t) {
|
|
|
3537
3537
|
}
|
|
3538
3538
|
}
|
|
3539
3539
|
function kr(e = []) {
|
|
3540
|
-
const [t, n] = Wt(wr, { ...Ot, messages: e }), r =
|
|
3540
|
+
const [t, n] = Wt(wr, { ...Ot, messages: e }), r = W([]), o = W(null), s = N(() => {
|
|
3541
3541
|
o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), o.current = null;
|
|
3542
|
-
const
|
|
3543
|
-
|
|
3542
|
+
const l = r.current;
|
|
3543
|
+
l.length && (r.current = [], n({ type: "batch", payload: { events: l } }));
|
|
3544
3544
|
}, []), a = N(() => {
|
|
3545
3545
|
typeof window < "u" && typeof window.requestAnimationFrame == "function" ? o.current === null && (o.current = window.requestAnimationFrame(() => s())) : setTimeout(s, 8);
|
|
3546
|
-
}, [s]), i = N((
|
|
3547
|
-
r.current.push(
|
|
3548
|
-
}, [a]),
|
|
3549
|
-
setStatus: (
|
|
3550
|
-
reset: (
|
|
3551
|
-
seed: (
|
|
3552
|
-
pushUser: (
|
|
3546
|
+
}, [s]), i = N((l) => {
|
|
3547
|
+
r.current.push(l), a();
|
|
3548
|
+
}, [a]), u = Z(() => ({
|
|
3549
|
+
setStatus: (l, c) => n({ type: "status", payload: { status: l, error: c } }),
|
|
3550
|
+
reset: (l) => n({ type: "reset", payload: { messages: l } }),
|
|
3551
|
+
seed: (l, c) => n({ type: "seed", payload: { messages: l, ...c ?? {} } }),
|
|
3552
|
+
pushUser: (l, c) => n({ type: "user_message", payload: { message: l, editingMessageId: c } }),
|
|
3553
3553
|
onEvent: i
|
|
3554
3554
|
}), [i]);
|
|
3555
|
-
return { state: t, dispatch: n, ...
|
|
3555
|
+
return { state: t, dispatch: n, ...u };
|
|
3556
3556
|
}
|
|
3557
3557
|
function pt(e, t) {
|
|
3558
3558
|
const n = t.origin, r = t.scope, o = n === "task" || typeof r == "string" && r.startsWith("tools:");
|
|
@@ -3585,54 +3585,54 @@ function pt(e, t) {
|
|
|
3585
3585
|
return { ...e, status: "error", error: t.message, messages: [...e.messages, s] };
|
|
3586
3586
|
}
|
|
3587
3587
|
if (t.type === "values") {
|
|
3588
|
-
const s = t, a = s.values && typeof s.values == "object" ? { ...s.values } : {}, i = Array.isArray(s.messages) ? s.messages : Array.isArray(a.messages) ? a.messages :
|
|
3589
|
-
if (!i
|
|
3588
|
+
const s = t, a = s.values && typeof s.values == "object" ? { ...s.values } : {}, i = Array.isArray(s.messages) || Array.isArray(a.messages), u = Array.isArray(s.messages) ? s.messages : Array.isArray(a.messages) ? a.messages : null;
|
|
3589
|
+
if (!i && Object.keys(a).length === 0)
|
|
3590
3590
|
return e;
|
|
3591
|
-
const
|
|
3592
|
-
delete a.messages;
|
|
3593
|
-
let c = e.lastCheckpointId,
|
|
3594
|
-
const
|
|
3595
|
-
if ((p != null && p.checkpoint_id || p != null && p.checkpointId) && (c = p.checkpoint_id || p.checkpointId,
|
|
3596
|
-
for (let
|
|
3597
|
-
if (
|
|
3598
|
-
c =
|
|
3591
|
+
const l = u !== null ? Fe(u) : e.messages;
|
|
3592
|
+
a && delete a.messages;
|
|
3593
|
+
let c = e.lastCheckpointId, d = e.lastCheckpointNs;
|
|
3594
|
+
const m = s.config || s.checkpoint, p = (m == null ? void 0 : m.configurable) || m;
|
|
3595
|
+
if ((p != null && p.checkpoint_id || p != null && p.checkpointId) && (c = p.checkpoint_id || p.checkpointId, d = p.checkpoint_ns || p.checkpointNs || null), !c) {
|
|
3596
|
+
for (let h = l.length - 1; h >= 0; h--)
|
|
3597
|
+
if (l[h].checkpointId) {
|
|
3598
|
+
c = l[h].checkpointId, d = l[h].checkpointNs ?? null;
|
|
3599
3599
|
break;
|
|
3600
3600
|
}
|
|
3601
3601
|
}
|
|
3602
|
-
const
|
|
3603
|
-
id:
|
|
3604
|
-
value:
|
|
3605
|
-
alternatives:
|
|
3602
|
+
const I = s.interrupts || a.__interrupt__ || a.interrupts, f = Array.isArray(I) && I.length > 0 ? {
|
|
3603
|
+
id: I[0].id || "native-interrupt",
|
|
3604
|
+
value: I[0].value || I[0],
|
|
3605
|
+
alternatives: I[0].alternatives
|
|
3606
3606
|
} : null;
|
|
3607
3607
|
if (o) {
|
|
3608
|
-
const
|
|
3608
|
+
const h = typeof r == "string" && r.length > 0 ? r : "task";
|
|
3609
3609
|
return {
|
|
3610
3610
|
...e,
|
|
3611
|
-
taskMessagesByScope: { ...e.taskMessagesByScope, [
|
|
3611
|
+
taskMessagesByScope: { ...e.taskMessagesByScope, [h]: l },
|
|
3612
3612
|
assemblingId: null
|
|
3613
3613
|
};
|
|
3614
3614
|
}
|
|
3615
3615
|
return {
|
|
3616
3616
|
...e,
|
|
3617
|
-
status:
|
|
3618
|
-
messages:
|
|
3617
|
+
status: f ? "awaiting_input" : e.status === "streaming" ? "idle" : e.status,
|
|
3618
|
+
messages: l,
|
|
3619
3619
|
assemblingId: null,
|
|
3620
3620
|
lastCheckpointId: c,
|
|
3621
|
-
lastCheckpointNs:
|
|
3622
|
-
pendingInterrupt:
|
|
3621
|
+
lastCheckpointNs: d,
|
|
3622
|
+
pendingInterrupt: f,
|
|
3623
3623
|
values: { ...e.values, ...a }
|
|
3624
3624
|
};
|
|
3625
3625
|
}
|
|
3626
3626
|
if (t.type === "messages/metadata") {
|
|
3627
3627
|
const s = { ...e.messagesStreamMeta ?? {} }, a = t.metadata;
|
|
3628
|
-
return a && typeof a == "object" && Object.entries(a).forEach(([i,
|
|
3629
|
-
const
|
|
3630
|
-
if (!
|
|
3631
|
-
const
|
|
3628
|
+
return a && typeof a == "object" && Object.entries(a).forEach(([i, u]) => {
|
|
3629
|
+
const l = u == null ? void 0 : u.metadata;
|
|
3630
|
+
if (!l || typeof l != "object") return;
|
|
3631
|
+
const c = s[i] ?? {};
|
|
3632
3632
|
s[i] = {
|
|
3633
|
-
...
|
|
3634
|
-
lastSeq: t.seq ??
|
|
3635
|
-
metadata: { ...
|
|
3633
|
+
...c,
|
|
3634
|
+
lastSeq: t.seq ?? c.lastSeq ?? null,
|
|
3635
|
+
metadata: { ...c.metadata ?? {}, ...l }
|
|
3636
3636
|
};
|
|
3637
3637
|
}), { ...e, messagesStreamMeta: s };
|
|
3638
3638
|
}
|
|
@@ -3653,55 +3653,55 @@ function pt(e, t) {
|
|
|
3653
3653
|
return t.type === "message.start" ? { ...e, assemblingId: t.id, status: "streaming" } : t.type === "message.end" ? { ...e, assemblingId: null } : t.type === "tool.start" ? { ...vr(e, t, o), status: "streaming" } : t.type === "tool.progress" ? xr(e, t, o) : t.type === "tool.end" ? Ar(e, t, o) : t.type === "artifact.update" ? Tr(e, t) : e;
|
|
3654
3654
|
}
|
|
3655
3655
|
function Ir(e, t, n) {
|
|
3656
|
-
var
|
|
3656
|
+
var p, I, f, h, x, S, A;
|
|
3657
3657
|
const r = t.messages;
|
|
3658
3658
|
if (!r.length)
|
|
3659
3659
|
return console.warn("[messagesReducer] Dropping messages/partial event without messages[]", t), e;
|
|
3660
3660
|
const o = r.find((w) => w.type === "ai" || w.type === "assistant" || w.role === "assistant");
|
|
3661
3661
|
if (!o) return e;
|
|
3662
|
-
const s = o.id, a = o.content ?? "", i = typeof a == "string" ? [{ type: "text", text: a }] : Array.isArray(a) ? a.map((w) => typeof w == "string" ? { type: "text", text: w } : (w == null ? void 0 : w.type) === "text" ? { type: "text", text: typeof w.text == "string" ? w.text : w.content ?? "" } : ((w == null ? void 0 : w.type) === "reasoning", w)) : [],
|
|
3663
|
-
let
|
|
3664
|
-
const
|
|
3665
|
-
if (
|
|
3662
|
+
const s = o.id, a = o.content ?? "", i = typeof a == "string" ? [{ type: "text", text: a }] : Array.isArray(a) ? a.map((w) => typeof w == "string" ? { type: "text", text: w } : (w == null ? void 0 : w.type) === "text" ? { type: "text", text: typeof w.text == "string" ? w.text : w.content ?? "" } : ((w == null ? void 0 : w.type) === "reasoning", w)) : [], u = i.filter((w) => w.type === "text").map((w) => w.text).join(""), l = e.assemblingId !== s, c = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3663
|
+
let d = n ? [...e.taskMessagesByScope[c] || []] : [...e.messages];
|
|
3664
|
+
const m = (I = (p = e.messagesStreamMeta) == null ? void 0 : p[s]) == null ? void 0 : I.metadata;
|
|
3665
|
+
if (l) {
|
|
3666
3666
|
const w = nt({
|
|
3667
3667
|
...o,
|
|
3668
3668
|
role: "assistant",
|
|
3669
3669
|
content: i,
|
|
3670
3670
|
scope: t.scope,
|
|
3671
3671
|
origin: t.origin,
|
|
3672
|
-
responseMetadata: { ...
|
|
3672
|
+
responseMetadata: { ...m, ...o.responseMetadata ?? {} }
|
|
3673
3673
|
});
|
|
3674
|
-
w &&
|
|
3674
|
+
w && d.push(w);
|
|
3675
3675
|
} else {
|
|
3676
|
-
const w =
|
|
3676
|
+
const w = d.findIndex((k) => k.id === s);
|
|
3677
3677
|
if (w !== -1) {
|
|
3678
|
-
const
|
|
3679
|
-
|
|
3680
|
-
...
|
|
3678
|
+
const k = d[w];
|
|
3679
|
+
d[w] = {
|
|
3680
|
+
...k,
|
|
3681
3681
|
content: i,
|
|
3682
|
-
scope: t.scope ??
|
|
3683
|
-
origin: t.origin ??
|
|
3684
|
-
responseMetadata: { ...
|
|
3682
|
+
scope: t.scope ?? k.scope,
|
|
3683
|
+
origin: t.origin ?? k.origin,
|
|
3684
|
+
responseMetadata: { ...m, ...k.responseMetadata, ...o.responseMetadata ?? {} }
|
|
3685
3685
|
};
|
|
3686
3686
|
}
|
|
3687
3687
|
}
|
|
3688
3688
|
return {
|
|
3689
3689
|
...e,
|
|
3690
3690
|
status: "streaming",
|
|
3691
|
-
messages: n ? e.messages :
|
|
3692
|
-
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [
|
|
3691
|
+
messages: n ? e.messages : d,
|
|
3692
|
+
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [c]: d } : e.taskMessagesByScope,
|
|
3693
3693
|
assemblingId: s,
|
|
3694
3694
|
messagesStreamMeta: {
|
|
3695
3695
|
...e.messagesStreamMeta ?? {},
|
|
3696
3696
|
[s]: {
|
|
3697
|
-
...((
|
|
3698
|
-
lastSeq: t.seq ?? ((x = (
|
|
3699
|
-
lastText:
|
|
3697
|
+
...((f = e.messagesStreamMeta) == null ? void 0 : f[s]) ?? {},
|
|
3698
|
+
lastSeq: t.seq ?? ((x = (h = e.messagesStreamMeta) == null ? void 0 : h[s]) == null ? void 0 : x.lastSeq) ?? null,
|
|
3699
|
+
lastText: u || (((A = (S = e.messagesStreamMeta) == null ? void 0 : S[s]) == null ? void 0 : A.lastText) ?? "")
|
|
3700
3700
|
}
|
|
3701
3701
|
}
|
|
3702
3702
|
};
|
|
3703
3703
|
}
|
|
3704
|
-
function
|
|
3704
|
+
function ot(e, t) {
|
|
3705
3705
|
var n;
|
|
3706
3706
|
if (!t) return -1;
|
|
3707
3707
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
@@ -3715,16 +3715,16 @@ function vr(e, t, n) {
|
|
|
3715
3715
|
const r = t.id || t.callId;
|
|
3716
3716
|
if (!r) return e;
|
|
3717
3717
|
const o = t.name || "tool", s = `Starting ${o}...`, a = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3718
|
-
let i = n ? [...e.taskMessagesByScope[a] || []] : [...e.messages],
|
|
3719
|
-
if (
|
|
3720
|
-
for (let
|
|
3721
|
-
if (i[
|
|
3722
|
-
|
|
3718
|
+
let i = n ? [...e.taskMessagesByScope[a] || []] : [...e.messages], u = ot(i, r);
|
|
3719
|
+
if (u === -1) {
|
|
3720
|
+
for (let l = i.length - 1; l >= 0; l--)
|
|
3721
|
+
if (i[l].role === "assistant") {
|
|
3722
|
+
u = l;
|
|
3723
3723
|
break;
|
|
3724
3724
|
}
|
|
3725
3725
|
}
|
|
3726
|
-
if (
|
|
3727
|
-
const
|
|
3726
|
+
if (u === -1) {
|
|
3727
|
+
const l = {
|
|
3728
3728
|
id: `assistant-${r}`,
|
|
3729
3729
|
role: "assistant",
|
|
3730
3730
|
content: [{ type: "text", text: "" }],
|
|
@@ -3733,21 +3733,21 @@ function vr(e, t, n) {
|
|
|
3733
3733
|
scope: t.scope,
|
|
3734
3734
|
origin: t.origin
|
|
3735
3735
|
};
|
|
3736
|
-
i.push(
|
|
3736
|
+
i.push(l), u = i.length - 1;
|
|
3737
3737
|
}
|
|
3738
|
-
if (
|
|
3739
|
-
const
|
|
3740
|
-
|
|
3738
|
+
if (u !== -1) {
|
|
3739
|
+
const l = i[u], c = [...l.toolCalls || []], d = c.findIndex((m) => m.id === r);
|
|
3740
|
+
d >= 0 ? c[d] = { ...c[d], status: "running", content: s } : c.push({
|
|
3741
3741
|
id: r,
|
|
3742
3742
|
name: o,
|
|
3743
3743
|
args: t.args || {},
|
|
3744
3744
|
status: "running",
|
|
3745
3745
|
content: s
|
|
3746
|
-
}), i[
|
|
3747
|
-
...
|
|
3748
|
-
toolCalls:
|
|
3749
|
-
scope: t.scope ??
|
|
3750
|
-
origin: t.origin ??
|
|
3746
|
+
}), i[u] = {
|
|
3747
|
+
...l,
|
|
3748
|
+
toolCalls: c,
|
|
3749
|
+
scope: t.scope ?? l.scope,
|
|
3750
|
+
origin: t.origin ?? l.origin
|
|
3751
3751
|
};
|
|
3752
3752
|
}
|
|
3753
3753
|
return {
|
|
@@ -3761,14 +3761,14 @@ function xr(e, t, n) {
|
|
|
3761
3761
|
if (!r) return e;
|
|
3762
3762
|
const o = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3763
3763
|
let s = n ? [...e.taskMessagesByScope[o] || []] : [...e.messages];
|
|
3764
|
-
const a =
|
|
3764
|
+
const a = ot(s, r);
|
|
3765
3765
|
if (a !== -1) {
|
|
3766
|
-
const i = s[a],
|
|
3767
|
-
(
|
|
3766
|
+
const i = s[a], u = ue(t.content), l = (i.toolCalls || []).map(
|
|
3767
|
+
(c) => c.id === r ? { ...c, content: typeof u == "string" ? u : c.content } : c
|
|
3768
3768
|
);
|
|
3769
3769
|
s[a] = {
|
|
3770
3770
|
...i,
|
|
3771
|
-
toolCalls:
|
|
3771
|
+
toolCalls: l,
|
|
3772
3772
|
scope: t.scope ?? i.scope,
|
|
3773
3773
|
origin: t.origin ?? i.origin
|
|
3774
3774
|
};
|
|
@@ -3784,24 +3784,24 @@ function Ar(e, t, n) {
|
|
|
3784
3784
|
if (!r) return e;
|
|
3785
3785
|
const o = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3786
3786
|
let s = n ? [...e.taskMessagesByScope[o] || []] : [...e.messages];
|
|
3787
|
-
const a =
|
|
3787
|
+
const a = ot(s, r), i = ue(t.content ?? t.error);
|
|
3788
3788
|
if (a !== -1) {
|
|
3789
|
-
const
|
|
3790
|
-
(
|
|
3791
|
-
...
|
|
3789
|
+
const l = s[a], c = (l.toolCalls || []).map(
|
|
3790
|
+
(d) => d.id === r ? {
|
|
3791
|
+
...d,
|
|
3792
3792
|
status: t.error ? "failed" : "completed",
|
|
3793
|
-
content: typeof i == "string" ? i :
|
|
3793
|
+
content: typeof i == "string" ? i : d.content,
|
|
3794
3794
|
artifact: t.artifact
|
|
3795
|
-
} :
|
|
3795
|
+
} : d
|
|
3796
3796
|
);
|
|
3797
3797
|
s[a] = {
|
|
3798
|
-
...
|
|
3799
|
-
toolCalls:
|
|
3800
|
-
scope: t.scope ??
|
|
3801
|
-
origin: t.origin ??
|
|
3798
|
+
...l,
|
|
3799
|
+
toolCalls: c,
|
|
3800
|
+
scope: t.scope ?? l.scope,
|
|
3801
|
+
origin: t.origin ?? l.origin
|
|
3802
3802
|
};
|
|
3803
3803
|
}
|
|
3804
|
-
const
|
|
3804
|
+
const u = {
|
|
3805
3805
|
id: `tool-${r}`,
|
|
3806
3806
|
role: "tool",
|
|
3807
3807
|
name: t.name,
|
|
@@ -3812,7 +3812,7 @@ function Ar(e, t, n) {
|
|
|
3812
3812
|
scope: t.scope,
|
|
3813
3813
|
origin: t.origin
|
|
3814
3814
|
};
|
|
3815
|
-
return s.push(
|
|
3815
|
+
return s.push(u), {
|
|
3816
3816
|
...e,
|
|
3817
3817
|
messages: n ? e.messages : s,
|
|
3818
3818
|
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [o]: s } : e.taskMessagesByScope
|
|
@@ -3855,18 +3855,18 @@ function gt(e) {
|
|
|
3855
3855
|
return Re(t.configurable) ?? t;
|
|
3856
3856
|
}
|
|
3857
3857
|
async function Mr(e, t) {
|
|
3858
|
-
var i,
|
|
3858
|
+
var i, u;
|
|
3859
3859
|
if (!e) return e ?? null;
|
|
3860
3860
|
const n = fe(e), r = Array.isArray(n.checkpoints) ? n.checkpoints : n.checkpoints ? Object.values(n.checkpoints) : [], o = /* @__PURE__ */ new Set();
|
|
3861
|
-
for (const
|
|
3862
|
-
const
|
|
3863
|
-
if (Array.isArray(
|
|
3864
|
-
for (const
|
|
3865
|
-
const
|
|
3866
|
-
if (Array.isArray(
|
|
3867
|
-
for (const
|
|
3868
|
-
if (!
|
|
3869
|
-
const I =
|
|
3861
|
+
for (const l of r) {
|
|
3862
|
+
const c = (i = l == null ? void 0 : l.values) == null ? void 0 : i.messages;
|
|
3863
|
+
if (Array.isArray(c))
|
|
3864
|
+
for (const d of c) {
|
|
3865
|
+
const m = d == null ? void 0 : d.content;
|
|
3866
|
+
if (Array.isArray(m))
|
|
3867
|
+
for (const p of m) {
|
|
3868
|
+
if (!p || typeof p != "object" || p.type !== "image_url" && p.type !== "file") continue;
|
|
3869
|
+
const I = p.fileId || p.file_id;
|
|
3870
3870
|
typeof I == "string" && I.trim() && o.add(I);
|
|
3871
3871
|
}
|
|
3872
3872
|
}
|
|
@@ -3874,27 +3874,27 @@ async function Mr(e, t) {
|
|
|
3874
3874
|
if (o.size === 0)
|
|
3875
3875
|
return n;
|
|
3876
3876
|
const s = await Promise.all(
|
|
3877
|
-
Array.from(o).map(async (
|
|
3877
|
+
Array.from(o).map(async (l) => {
|
|
3878
3878
|
try {
|
|
3879
|
-
const
|
|
3880
|
-
return [
|
|
3879
|
+
const c = await t.getFileInfo(l), d = fe(c);
|
|
3880
|
+
return [l, d];
|
|
3881
3881
|
} catch {
|
|
3882
|
-
return [
|
|
3882
|
+
return [l, null];
|
|
3883
3883
|
}
|
|
3884
3884
|
})
|
|
3885
3885
|
), a = new Map(s);
|
|
3886
|
-
for (const
|
|
3887
|
-
const
|
|
3888
|
-
if (Array.isArray(
|
|
3889
|
-
for (const
|
|
3890
|
-
const
|
|
3891
|
-
if (Array.isArray(
|
|
3892
|
-
for (const
|
|
3893
|
-
if (!
|
|
3894
|
-
const I =
|
|
3886
|
+
for (const l of r) {
|
|
3887
|
+
const c = (u = l == null ? void 0 : l.values) == null ? void 0 : u.messages;
|
|
3888
|
+
if (Array.isArray(c))
|
|
3889
|
+
for (const d of c) {
|
|
3890
|
+
const m = d == null ? void 0 : d.content;
|
|
3891
|
+
if (Array.isArray(m))
|
|
3892
|
+
for (const p of m) {
|
|
3893
|
+
if (!p || typeof p != "object" || p.type !== "image_url" && p.type !== "file") continue;
|
|
3894
|
+
const I = p.fileId || p.file_id;
|
|
3895
3895
|
if (!I) continue;
|
|
3896
|
-
const
|
|
3897
|
-
|
|
3896
|
+
const f = a.get(I), h = (f == null ? void 0 : f.contentUrl) || (f == null ? void 0 : f.content_url);
|
|
3897
|
+
h && (p.type === "image_url" ? (p.imageUrl = p.imageUrl || {}, p.imageUrl.url = h) : p.type === "file" && (p.url = h, !p.name && (f != null && f.filename || f != null && f.name) && (p.name = (f == null ? void 0 : f.filename) || (f == null ? void 0 : f.name))));
|
|
3898
3898
|
}
|
|
3899
3899
|
}
|
|
3900
3900
|
}
|
|
@@ -3910,32 +3910,32 @@ function mt(e) {
|
|
|
3910
3910
|
};
|
|
3911
3911
|
}
|
|
3912
3912
|
function Cr(e, t) {
|
|
3913
|
-
var
|
|
3913
|
+
var k, b;
|
|
3914
3914
|
if (!e) return null;
|
|
3915
|
-
const n = ((
|
|
3915
|
+
const n = ((k = e.values) == null ? void 0 : k.activeAgent) ?? null, r = (b = e.values) == null ? void 0 : b.messages, s = (Array.isArray(r) ? r : []).map((T) => Er(T, n)).filter((T) => !!T), a = Re(e.metadata) ?? {}, i = gt(e.config), u = Re(e.parentConfig), l = gt(u), c = Be(i, ["checkpointId"]), d = Be(i, ["checkpointNs"]), m = Be(l, ["checkpointId"]), p = Re(e.config), I = Array.isArray(e.tasks) ? e.tasks.map((T) => ({ ...T })) : e.tasks ?? null, f = Array.isArray(e.next) ? [...e.next] : e.next ?? null, h = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), x = {
|
|
3916
3916
|
...a,
|
|
3917
3917
|
step: Sr(a, ["step"]) ?? 0,
|
|
3918
3918
|
source: Be(a, ["source"]) ?? null
|
|
3919
3919
|
}, S = s.map((T) => ({
|
|
3920
3920
|
...T,
|
|
3921
|
-
checkpointId: T.checkpointId ??
|
|
3922
|
-
checkpointNs: T.checkpointNs ??
|
|
3921
|
+
checkpointId: T.checkpointId ?? c ?? null,
|
|
3922
|
+
checkpointNs: T.checkpointNs ?? d ?? null
|
|
3923
3923
|
})), A = e.values, w = Array.isArray(e.interrupts) ? e.interrupts : Array.isArray(A == null ? void 0 : A.interrupts) ? A.interrupts : [];
|
|
3924
3924
|
return {
|
|
3925
|
-
checkpointId:
|
|
3926
|
-
checkpointNs:
|
|
3927
|
-
createdAt:
|
|
3928
|
-
parentId:
|
|
3925
|
+
checkpointId: c ?? null,
|
|
3926
|
+
checkpointNs: d ?? null,
|
|
3927
|
+
createdAt: h,
|
|
3928
|
+
parentId: m ?? null,
|
|
3929
3929
|
messages: S,
|
|
3930
3930
|
interrupt: Pr(
|
|
3931
3931
|
w,
|
|
3932
3932
|
t,
|
|
3933
|
-
|
|
3933
|
+
c ?? null
|
|
3934
3934
|
),
|
|
3935
3935
|
metadata: x,
|
|
3936
|
-
config:
|
|
3937
|
-
parentConfig:
|
|
3938
|
-
next:
|
|
3936
|
+
config: p ?? null,
|
|
3937
|
+
parentConfig: u ?? null,
|
|
3938
|
+
next: f,
|
|
3939
3939
|
tasks: I,
|
|
3940
3940
|
values: e.values ?? {}
|
|
3941
3941
|
};
|
|
@@ -3980,53 +3980,53 @@ function Nr(e) {
|
|
|
3980
3980
|
}
|
|
3981
3981
|
function zr(e) {
|
|
3982
3982
|
const t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Map(), o = [];
|
|
3983
|
-
for (let
|
|
3984
|
-
const
|
|
3985
|
-
let
|
|
3986
|
-
const S = Array.isArray(
|
|
3987
|
-
for (const
|
|
3988
|
-
|
|
3989
|
-
const A =
|
|
3990
|
-
id:
|
|
3983
|
+
for (let l = 0; l < e.length; l++) {
|
|
3984
|
+
const c = e[l], d = c.checkpointId, m = d ?? `cp-${l}`, p = c.metadata ?? {}, I = typeof p.step == "number" ? p.step : null, f = typeof p.source == "string" ? p.source : null;
|
|
3985
|
+
let h = null, x = null;
|
|
3986
|
+
const S = Array.isArray(c.messages) ? c.messages : [];
|
|
3987
|
+
for (const b of S)
|
|
3988
|
+
b.role === "user" && (x || (x = b), b.id && (h = b.id));
|
|
3989
|
+
const A = c.next && c.next.length > 0 ? String(c.next[0]) : null, w = c.parentConfig ?? null, k = {
|
|
3990
|
+
id: m,
|
|
3991
3991
|
step: I,
|
|
3992
|
-
source:
|
|
3993
|
-
createdAt:
|
|
3994
|
-
namespace:
|
|
3995
|
-
parentId:
|
|
3992
|
+
source: f,
|
|
3993
|
+
createdAt: c.createdAt ?? null,
|
|
3994
|
+
namespace: c.checkpointNs ?? null,
|
|
3995
|
+
parentId: c.parentId ?? null,
|
|
3996
3996
|
next: A,
|
|
3997
3997
|
parentConfig: w,
|
|
3998
|
-
userMessageId:
|
|
3998
|
+
userMessageId: h
|
|
3999
3999
|
};
|
|
4000
|
-
if (o.push(
|
|
4001
|
-
const
|
|
4002
|
-
|
|
4000
|
+
if (o.push(k), d && t.set(d, k), d && x) {
|
|
4001
|
+
const b = Nr(x);
|
|
4002
|
+
b && r.set(d, b);
|
|
4003
4003
|
}
|
|
4004
4004
|
n.push({
|
|
4005
|
-
id:
|
|
4006
|
-
messageId:
|
|
4005
|
+
id: m,
|
|
4006
|
+
messageId: h,
|
|
4007
4007
|
step: I,
|
|
4008
|
-
source:
|
|
4009
|
-
createdAt:
|
|
4008
|
+
source: f,
|
|
4009
|
+
createdAt: c.createdAt ?? null,
|
|
4010
4010
|
next: A,
|
|
4011
4011
|
parentConfig: w
|
|
4012
4012
|
});
|
|
4013
4013
|
}
|
|
4014
4014
|
const s = /* @__PURE__ */ new Map();
|
|
4015
|
-
for (const
|
|
4016
|
-
if (!
|
|
4017
|
-
const
|
|
4018
|
-
|
|
4015
|
+
for (const l of o) {
|
|
4016
|
+
if (!l.userMessageId) continue;
|
|
4017
|
+
const c = s.get(l.userMessageId) ?? [];
|
|
4018
|
+
c.push(l), s.set(l.userMessageId, c);
|
|
4019
4019
|
}
|
|
4020
|
-
for (const
|
|
4021
|
-
if (!
|
|
4022
|
-
|
|
4023
|
-
const
|
|
4024
|
-
return (
|
|
4020
|
+
for (const l of s.values()) {
|
|
4021
|
+
if (!l.length) continue;
|
|
4022
|
+
l.sort((d, m) => {
|
|
4023
|
+
const p = d.createdAt ? Date.parse(d.createdAt) : 0;
|
|
4024
|
+
return (m.createdAt ? Date.parse(m.createdAt) : 0) - p;
|
|
4025
4025
|
});
|
|
4026
|
-
const
|
|
4027
|
-
for (let
|
|
4028
|
-
const
|
|
4029
|
-
|
|
4026
|
+
const c = l.length;
|
|
4027
|
+
for (let d = 0; d < l.length; d++) {
|
|
4028
|
+
const m = l[d];
|
|
4029
|
+
m.attemptCount = c, m.attemptIndex = d, m.isLatestAttempt = d === 0;
|
|
4030
4030
|
}
|
|
4031
4031
|
}
|
|
4032
4032
|
return {
|
|
@@ -4035,23 +4035,23 @@ function zr(e) {
|
|
|
4035
4035
|
timeline: n,
|
|
4036
4036
|
messagePreviews: r,
|
|
4037
4037
|
getLatest: () => {
|
|
4038
|
-
const
|
|
4039
|
-
if (
|
|
4040
|
-
return t.get(
|
|
4038
|
+
const l = n[0];
|
|
4039
|
+
if (l)
|
|
4040
|
+
return t.get(l.id);
|
|
4041
4041
|
},
|
|
4042
|
-
getCheckpoint: (
|
|
4043
|
-
getMessageAttempts: (
|
|
4044
|
-
const
|
|
4045
|
-
for (const
|
|
4046
|
-
|
|
4047
|
-
return
|
|
4048
|
-
const
|
|
4049
|
-
return
|
|
4050
|
-
}),
|
|
4042
|
+
getCheckpoint: (l) => t.get(l),
|
|
4043
|
+
getMessageAttempts: (l) => {
|
|
4044
|
+
const c = [];
|
|
4045
|
+
for (const d of t.values())
|
|
4046
|
+
d.userMessageId === l && c.push(d);
|
|
4047
|
+
return c.length ? (c.sort((d, m) => {
|
|
4048
|
+
const p = typeof d.attemptIndex == "number" ? d.attemptIndex : Number.MAX_SAFE_INTEGER, I = typeof m.attemptIndex == "number" ? m.attemptIndex : Number.MAX_SAFE_INTEGER;
|
|
4049
|
+
return p - I;
|
|
4050
|
+
}), c) : [];
|
|
4051
4051
|
}
|
|
4052
4052
|
};
|
|
4053
4053
|
}
|
|
4054
|
-
function
|
|
4054
|
+
function ds(e, t, n) {
|
|
4055
4055
|
if (!e)
|
|
4056
4056
|
return { attemptCount: 1, attemptIndex: 0, attempts: [] };
|
|
4057
4057
|
const r = n.getMessageAttempts(e);
|
|
@@ -4079,137 +4079,143 @@ function $t({
|
|
|
4079
4079
|
currentThreadId: o,
|
|
4080
4080
|
autoLoadInitial: s = !0,
|
|
4081
4081
|
isStreaming: a,
|
|
4082
|
-
getMessages: i
|
|
4082
|
+
getMessages: i,
|
|
4083
|
+
includeHistory: u = !0
|
|
4083
4084
|
}) {
|
|
4084
|
-
const [
|
|
4085
|
-
() => mt(
|
|
4086
|
-
[
|
|
4087
|
-
).checkpoints, p = Rr(
|
|
4085
|
+
const [l, c] = H(null), m = Z(
|
|
4086
|
+
() => mt(l),
|
|
4087
|
+
[l]
|
|
4088
|
+
).checkpoints, p = Rr(m), I = p.timeline, [f, h] = H(!1), [x, S] = H(!1), [A, w] = H(!1), [k, b] = H(null), T = W(o), y = W(null), v = W(null);
|
|
4088
4089
|
Y(() => {
|
|
4089
|
-
|
|
4090
|
+
T.current = o;
|
|
4090
4091
|
}, [o]);
|
|
4091
|
-
const
|
|
4092
|
-
async (
|
|
4093
|
-
const
|
|
4094
|
-
threadId:
|
|
4095
|
-
checkpointId:
|
|
4096
|
-
checkpointNs:
|
|
4097
|
-
}),
|
|
4092
|
+
const _ = N(
|
|
4093
|
+
async (P) => {
|
|
4094
|
+
const F = await e.getState({
|
|
4095
|
+
threadId: P.threadId,
|
|
4096
|
+
checkpointId: P.checkpointId,
|
|
4097
|
+
checkpointNs: P.checkpointNs
|
|
4098
|
+
}), E = {
|
|
4098
4099
|
version: "values@1",
|
|
4099
|
-
threadId:
|
|
4100
|
-
checkpoints: [
|
|
4101
|
-
},
|
|
4102
|
-
return
|
|
4100
|
+
threadId: P.threadId,
|
|
4101
|
+
checkpoints: [F]
|
|
4102
|
+
}, j = t ? await Mr(E, t) : E, { latest: G } = mt(j);
|
|
4103
|
+
return G;
|
|
4103
4104
|
},
|
|
4104
4105
|
[e, t]
|
|
4105
|
-
),
|
|
4106
|
-
async (
|
|
4107
|
-
var
|
|
4108
|
-
if (!
|
|
4109
|
-
const
|
|
4110
|
-
if (
|
|
4111
|
-
(
|
|
4112
|
-
const
|
|
4113
|
-
|
|
4106
|
+
), L = N(
|
|
4107
|
+
async (P, F) => {
|
|
4108
|
+
var G;
|
|
4109
|
+
if (!P) return;
|
|
4110
|
+
const E = `${P}:${F ?? "latest"}`;
|
|
4111
|
+
if (y.current === E || f) return;
|
|
4112
|
+
(G = v.current) == null || G.abort();
|
|
4113
|
+
const j = new AbortController();
|
|
4114
|
+
v.current = j, h(!0), b(null);
|
|
4114
4115
|
try {
|
|
4115
|
-
const
|
|
4116
|
-
threadId:
|
|
4117
|
-
checkpointId:
|
|
4116
|
+
const g = await _({
|
|
4117
|
+
threadId: P,
|
|
4118
|
+
checkpointId: F ?? void 0
|
|
4118
4119
|
});
|
|
4119
|
-
if (
|
|
4120
|
-
|
|
4120
|
+
if (T.current !== P) {
|
|
4121
|
+
h(!1);
|
|
4121
4122
|
return;
|
|
4122
4123
|
}
|
|
4123
|
-
n((
|
|
4124
|
-
checkpointId: (
|
|
4125
|
-
checkpointNs: (
|
|
4126
|
-
pendingInterrupt: (
|
|
4127
|
-
values:
|
|
4128
|
-
}),
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4124
|
+
if (n((g == null ? void 0 : g.messages) ?? [], {
|
|
4125
|
+
checkpointId: (g == null ? void 0 : g.checkpointId) ?? null,
|
|
4126
|
+
checkpointNs: (g == null ? void 0 : g.checkpointNs) ?? null,
|
|
4127
|
+
pendingInterrupt: (g == null ? void 0 : g.interrupt) ?? null,
|
|
4128
|
+
values: g == null ? void 0 : g.values
|
|
4129
|
+
}), y.current = E, h(!1), u) {
|
|
4130
|
+
w(!0);
|
|
4131
|
+
try {
|
|
4132
|
+
const z = await e.getStateHistory({
|
|
4133
|
+
threadId: P,
|
|
4134
|
+
limit: 100,
|
|
4135
|
+
includeMessages: !1
|
|
4136
|
+
});
|
|
4137
|
+
T.current === P && c(z);
|
|
4138
|
+
} finally {
|
|
4139
|
+
w(!1);
|
|
4140
|
+
}
|
|
4138
4141
|
}
|
|
4139
|
-
} catch (
|
|
4140
|
-
if (
|
|
4141
|
-
const
|
|
4142
|
-
b(
|
|
4142
|
+
} catch (g) {
|
|
4143
|
+
if (h(!1), !Xt(g)) {
|
|
4144
|
+
const z = String(g);
|
|
4145
|
+
b(z), r == null || r(z);
|
|
4143
4146
|
}
|
|
4144
4147
|
}
|
|
4145
4148
|
},
|
|
4146
|
-
[e, n,
|
|
4147
|
-
),
|
|
4148
|
-
async (
|
|
4149
|
+
[e, n, _, r, i]
|
|
4150
|
+
), M = N(
|
|
4151
|
+
async (P, F) => {
|
|
4149
4152
|
if (o) {
|
|
4150
|
-
|
|
4153
|
+
S(!0);
|
|
4151
4154
|
try {
|
|
4152
|
-
const
|
|
4155
|
+
const E = await _({
|
|
4153
4156
|
threadId: o,
|
|
4154
|
-
checkpointId:
|
|
4155
|
-
checkpointNs:
|
|
4157
|
+
checkpointId: P,
|
|
4158
|
+
checkpointNs: F ?? void 0
|
|
4156
4159
|
});
|
|
4157
|
-
n((
|
|
4158
|
-
checkpointId: (
|
|
4159
|
-
checkpointNs: (
|
|
4160
|
-
pendingInterrupt: (
|
|
4161
|
-
values:
|
|
4160
|
+
n((E == null ? void 0 : E.messages) ?? [], {
|
|
4161
|
+
checkpointId: (E == null ? void 0 : E.checkpointId) ?? P,
|
|
4162
|
+
checkpointNs: (E == null ? void 0 : E.checkpointNs) ?? F,
|
|
4163
|
+
pendingInterrupt: (E == null ? void 0 : E.interrupt) ?? null,
|
|
4164
|
+
values: E == null ? void 0 : E.values
|
|
4162
4165
|
});
|
|
4163
|
-
} catch (
|
|
4164
|
-
console.error("[useThreadHistoryState] Navigation failed",
|
|
4166
|
+
} catch (E) {
|
|
4167
|
+
console.error("[useThreadHistoryState] Navigation failed", E);
|
|
4165
4168
|
} finally {
|
|
4166
|
-
|
|
4169
|
+
S(!1);
|
|
4167
4170
|
}
|
|
4168
4171
|
}
|
|
4169
4172
|
},
|
|
4170
|
-
[o,
|
|
4171
|
-
),
|
|
4172
|
-
o && await
|
|
4173
|
-
}, [o,
|
|
4174
|
-
async (
|
|
4175
|
-
const
|
|
4176
|
-
!
|
|
4173
|
+
[o, _, n]
|
|
4174
|
+
), $ = N(async () => {
|
|
4175
|
+
o && await L(o);
|
|
4176
|
+
}, [o, L]), U = N(
|
|
4177
|
+
async (P) => {
|
|
4178
|
+
const F = (P == null ? void 0 : P.threadId) || o;
|
|
4179
|
+
if (!F || o !== F) return;
|
|
4180
|
+
c(P);
|
|
4181
|
+
const E = P.scope;
|
|
4182
|
+
(!E || E === "main" || E === "agent") && (y.current = `${F}:latest`);
|
|
4177
4183
|
},
|
|
4178
4184
|
[o]
|
|
4179
4185
|
);
|
|
4180
4186
|
Y(() => {
|
|
4181
|
-
if (!s || !o ||
|
|
4182
|
-
const
|
|
4183
|
-
|
|
4184
|
-
}, [s, o,
|
|
4185
|
-
const
|
|
4186
|
-
c(null),
|
|
4187
|
+
if (!s || !o || f || a) return;
|
|
4188
|
+
const P = `${o}:latest`;
|
|
4189
|
+
y.current !== P && L(o);
|
|
4190
|
+
}, [s, o, f, a, L]);
|
|
4191
|
+
const V = N(() => {
|
|
4192
|
+
c(null), h(!1), S(!1), w(!1), b(null), y.current = null;
|
|
4187
4193
|
}, []);
|
|
4188
4194
|
return {
|
|
4189
|
-
threadCheckpoints:
|
|
4190
|
-
threadTimeline:
|
|
4195
|
+
threadCheckpoints: m,
|
|
4196
|
+
threadTimeline: I,
|
|
4191
4197
|
checkpointIndex: p,
|
|
4192
|
-
isLoadingThread:
|
|
4193
|
-
isLoadingCheckpoint:
|
|
4194
|
-
isLoadingHistory:
|
|
4195
|
-
threadStateError:
|
|
4196
|
-
loadThread:
|
|
4197
|
-
navigateToCheckpoint:
|
|
4198
|
-
setCurrentCheckpointId: (
|
|
4199
|
-
n(i(), { checkpointId:
|
|
4198
|
+
isLoadingThread: f,
|
|
4199
|
+
isLoadingCheckpoint: x,
|
|
4200
|
+
isLoadingHistory: A,
|
|
4201
|
+
threadStateError: k,
|
|
4202
|
+
loadThread: L,
|
|
4203
|
+
navigateToCheckpoint: M,
|
|
4204
|
+
setCurrentCheckpointId: (P, F) => {
|
|
4205
|
+
n(i(), { checkpointId: P, checkpointNs: F });
|
|
4200
4206
|
},
|
|
4201
|
-
returnToLatest:
|
|
4202
|
-
handleValuesEvent:
|
|
4207
|
+
returnToLatest: $,
|
|
4208
|
+
handleValuesEvent: U,
|
|
4203
4209
|
markSkipNextLoad: () => {
|
|
4204
4210
|
},
|
|
4205
4211
|
markStreamPendingThread: () => {
|
|
4206
4212
|
},
|
|
4207
|
-
resetHistoryState:
|
|
4208
|
-
clearState:
|
|
4213
|
+
resetHistoryState: V,
|
|
4214
|
+
clearState: V
|
|
4209
4215
|
};
|
|
4210
4216
|
}
|
|
4211
4217
|
const Dt = Ce(null), Kt = Ce(null);
|
|
4212
|
-
function
|
|
4218
|
+
function Ht(e) {
|
|
4213
4219
|
const t = je(Dt);
|
|
4214
4220
|
if (!t && !(e != null && e.optional)) throw new Error("useThreadState must be used within a ThreadStateProvider");
|
|
4215
4221
|
return t;
|
|
@@ -4227,28 +4233,29 @@ function jr({
|
|
|
4227
4233
|
initialCheckpointNs: r = null,
|
|
4228
4234
|
autoLoadInitial: o = !0,
|
|
4229
4235
|
isStreaming: s,
|
|
4230
|
-
onError: a
|
|
4236
|
+
onError: a,
|
|
4237
|
+
includeHistory: i = !0
|
|
4231
4238
|
}) {
|
|
4232
|
-
const { chatApi:
|
|
4233
|
-
threadCheckpoints:
|
|
4234
|
-
threadTimeline:
|
|
4235
|
-
checkpointIndex:
|
|
4236
|
-
isLoadingThread:
|
|
4237
|
-
isLoadingCheckpoint:
|
|
4238
|
-
isLoadingHistory:
|
|
4239
|
-
threadStateError:
|
|
4239
|
+
const { chatApi: u, fileApi: l } = Me(), { currentThreadId: c } = st(), { state: d, seed: m, onEvent: p, dispatch: I } = kr(), {
|
|
4240
|
+
threadCheckpoints: f,
|
|
4241
|
+
threadTimeline: h,
|
|
4242
|
+
checkpointIndex: x,
|
|
4243
|
+
isLoadingThread: S,
|
|
4244
|
+
isLoadingCheckpoint: A,
|
|
4245
|
+
isLoadingHistory: w,
|
|
4246
|
+
threadStateError: k,
|
|
4240
4247
|
loadThread: b,
|
|
4241
|
-
navigateToCheckpoint:
|
|
4242
|
-
setCurrentCheckpointId:
|
|
4243
|
-
returnToLatest:
|
|
4244
|
-
handleValuesEvent:
|
|
4245
|
-
markSkipNextLoad:
|
|
4246
|
-
markStreamPendingThread:
|
|
4247
|
-
resetHistoryState:
|
|
4248
|
+
navigateToCheckpoint: T,
|
|
4249
|
+
setCurrentCheckpointId: y,
|
|
4250
|
+
returnToLatest: v,
|
|
4251
|
+
handleValuesEvent: _,
|
|
4252
|
+
markSkipNextLoad: L,
|
|
4253
|
+
markStreamPendingThread: M,
|
|
4254
|
+
resetHistoryState: $
|
|
4248
4255
|
} = $t({
|
|
4249
|
-
api:
|
|
4250
|
-
fileApi:
|
|
4251
|
-
seed:
|
|
4256
|
+
api: u,
|
|
4257
|
+
fileApi: l,
|
|
4258
|
+
seed: m,
|
|
4252
4259
|
onError: a,
|
|
4253
4260
|
currentThreadId: c,
|
|
4254
4261
|
initialThreadId: t,
|
|
@@ -4256,121 +4263,122 @@ function jr({
|
|
|
4256
4263
|
initialCheckpointNs: r,
|
|
4257
4264
|
autoLoadInitial: o,
|
|
4258
4265
|
isStreaming: s,
|
|
4259
|
-
getMessages: N(() =>
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4266
|
+
getMessages: N(() => d.messages, [d.messages]),
|
|
4267
|
+
includeHistory: i
|
|
4268
|
+
}), U = W(null), V = N(
|
|
4269
|
+
(D) => {
|
|
4270
|
+
U.current = D;
|
|
4263
4271
|
},
|
|
4264
4272
|
[]
|
|
4265
|
-
),
|
|
4266
|
-
(
|
|
4267
|
-
|
|
4273
|
+
), P = W(null), F = N(
|
|
4274
|
+
(D) => {
|
|
4275
|
+
P.current = D;
|
|
4268
4276
|
},
|
|
4269
4277
|
[]
|
|
4270
|
-
),
|
|
4271
|
-
(
|
|
4272
|
-
const
|
|
4273
|
-
return
|
|
4278
|
+
), E = Z(() => ({ assemblingMessageId: d.assemblingId ?? null }), [d.assemblingId]), j = N(
|
|
4279
|
+
(D, K) => {
|
|
4280
|
+
const B = jt(D, "user");
|
|
4281
|
+
return I({
|
|
4274
4282
|
type: "user_message",
|
|
4275
4283
|
payload: {
|
|
4276
|
-
message:
|
|
4277
|
-
editingMessageId:
|
|
4284
|
+
message: B,
|
|
4285
|
+
editingMessageId: K == null ? void 0 : K.editingMessageId
|
|
4278
4286
|
}
|
|
4279
|
-
}),
|
|
4287
|
+
}), B;
|
|
4280
4288
|
},
|
|
4281
|
-
[
|
|
4282
|
-
),
|
|
4283
|
-
|
|
4284
|
-
}, [
|
|
4285
|
-
await b(
|
|
4286
|
-
}, [b]),
|
|
4289
|
+
[I]
|
|
4290
|
+
), G = N(async () => {
|
|
4291
|
+
U.current ? await U.current() : (m([], {}), $());
|
|
4292
|
+
}, [m, $]), g = N(async (D, K, B) => {
|
|
4293
|
+
await b(D, K, { clearProgress: !1 });
|
|
4294
|
+
}, [b]), z = Z(() => Bn(d.messages), [d.messages]), C = Z(
|
|
4287
4295
|
() => ({
|
|
4288
|
-
status:
|
|
4296
|
+
status: d.status,
|
|
4289
4297
|
threadId: c,
|
|
4290
|
-
messages:
|
|
4291
|
-
taskMessagesByScope:
|
|
4292
|
-
interrupt:
|
|
4298
|
+
messages: d.messages,
|
|
4299
|
+
taskMessagesByScope: d.taskMessagesByScope,
|
|
4300
|
+
interrupt: d.pendingInterrupt,
|
|
4293
4301
|
checkpoint: {
|
|
4294
|
-
id:
|
|
4295
|
-
namespace:
|
|
4302
|
+
id: d.lastCheckpointId ?? null,
|
|
4303
|
+
namespace: d.lastCheckpointNs ?? null
|
|
4296
4304
|
},
|
|
4297
|
-
checkpoints:
|
|
4298
|
-
checkpointIndex:
|
|
4299
|
-
timelineCheckpoints:
|
|
4300
|
-
metadata:
|
|
4301
|
-
values:
|
|
4302
|
-
isLoading:
|
|
4303
|
-
isLoadingCheckpoint:
|
|
4304
|
-
isLoadingHistory:
|
|
4305
|
-
error:
|
|
4305
|
+
checkpoints: f,
|
|
4306
|
+
checkpointIndex: x,
|
|
4307
|
+
timelineCheckpoints: h,
|
|
4308
|
+
metadata: E,
|
|
4309
|
+
values: d.values ?? {},
|
|
4310
|
+
isLoading: S,
|
|
4311
|
+
isLoadingCheckpoint: A,
|
|
4312
|
+
isLoadingHistory: w,
|
|
4313
|
+
error: k,
|
|
4306
4314
|
loadOlder: async () => {
|
|
4307
4315
|
},
|
|
4308
4316
|
// Placeholder
|
|
4309
|
-
seedFromSnapshot: (
|
|
4310
|
-
|
|
4311
|
-
checkpointId:
|
|
4312
|
-
checkpointNs:
|
|
4313
|
-
pendingInterrupt:
|
|
4314
|
-
values:
|
|
4317
|
+
seedFromSnapshot: (D) => {
|
|
4318
|
+
m(D.messages, {
|
|
4319
|
+
checkpointId: D.checkpointId,
|
|
4320
|
+
checkpointNs: D.checkpointNs,
|
|
4321
|
+
pendingInterrupt: D.interrupt,
|
|
4322
|
+
values: D.values
|
|
4315
4323
|
});
|
|
4316
4324
|
},
|
|
4317
|
-
clearState:
|
|
4318
|
-
navigateToCheckpoint:
|
|
4319
|
-
setCurrentCheckpointId:
|
|
4320
|
-
returnToLatest:
|
|
4321
|
-
loadThread:
|
|
4322
|
-
clearThread:
|
|
4323
|
-
respondToInterrupt: async (
|
|
4324
|
-
|
|
4325
|
+
clearState: G,
|
|
4326
|
+
navigateToCheckpoint: T,
|
|
4327
|
+
setCurrentCheckpointId: y,
|
|
4328
|
+
returnToLatest: v,
|
|
4329
|
+
loadThread: g,
|
|
4330
|
+
clearThread: G,
|
|
4331
|
+
respondToInterrupt: async (D, K, B) => {
|
|
4332
|
+
P.current && await P.current(D, K, B);
|
|
4325
4333
|
},
|
|
4326
|
-
messagePreviews:
|
|
4327
|
-
handleValuesEvent:
|
|
4328
|
-
markSkipNextLoad:
|
|
4329
|
-
markStreamPendingThread:
|
|
4330
|
-
resetHistoryState:
|
|
4331
|
-
pushUser:
|
|
4334
|
+
messagePreviews: x.messagePreviews,
|
|
4335
|
+
handleValuesEvent: _,
|
|
4336
|
+
markSkipNextLoad: L,
|
|
4337
|
+
markStreamPendingThread: M,
|
|
4338
|
+
resetHistoryState: $,
|
|
4339
|
+
pushUser: j,
|
|
4332
4340
|
onEvent: p,
|
|
4333
|
-
artifacts:
|
|
4341
|
+
artifacts: z
|
|
4334
4342
|
}),
|
|
4335
4343
|
[
|
|
4336
4344
|
c,
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
v,
|
|
4346
|
-
R,
|
|
4345
|
+
d.messages,
|
|
4346
|
+
d.taskMessagesByScope,
|
|
4347
|
+
d.pendingInterrupt,
|
|
4348
|
+
d.lastCheckpointId,
|
|
4349
|
+
d.lastCheckpointNs,
|
|
4350
|
+
d.values,
|
|
4351
|
+
f,
|
|
4352
|
+
h,
|
|
4347
4353
|
x,
|
|
4354
|
+
E,
|
|
4348
4355
|
S,
|
|
4349
4356
|
A,
|
|
4350
4357
|
w,
|
|
4351
|
-
|
|
4352
|
-
B,
|
|
4353
|
-
y,
|
|
4354
|
-
T,
|
|
4358
|
+
k,
|
|
4355
4359
|
m,
|
|
4360
|
+
G,
|
|
4361
|
+
T,
|
|
4362
|
+
y,
|
|
4363
|
+
v,
|
|
4364
|
+
g,
|
|
4365
|
+
_,
|
|
4356
4366
|
L,
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
U,
|
|
4360
|
-
W,
|
|
4367
|
+
M,
|
|
4368
|
+
j,
|
|
4361
4369
|
p,
|
|
4362
|
-
|
|
4370
|
+
z
|
|
4363
4371
|
]
|
|
4364
|
-
),
|
|
4372
|
+
), O = Z(
|
|
4365
4373
|
() => ({
|
|
4366
|
-
registerClearThread:
|
|
4367
|
-
registerRespondToInterrupt:
|
|
4374
|
+
registerClearThread: V,
|
|
4375
|
+
registerRespondToInterrupt: F
|
|
4368
4376
|
}),
|
|
4369
|
-
[
|
|
4377
|
+
[V, F]
|
|
4370
4378
|
);
|
|
4371
|
-
return /* @__PURE__ */ de(Kt.Provider, { value:
|
|
4379
|
+
return /* @__PURE__ */ de(Kt.Provider, { value: O, children: /* @__PURE__ */ de(Dt.Provider, { value: C, children: e }) });
|
|
4372
4380
|
}
|
|
4373
|
-
const
|
|
4381
|
+
const Vt = Ce(null), Ur = Ce(!1);
|
|
4374
4382
|
function Br({
|
|
4375
4383
|
children: e,
|
|
4376
4384
|
onError: t,
|
|
@@ -4380,38 +4388,38 @@ function Br({
|
|
|
4380
4388
|
onUpdateEvent: s,
|
|
4381
4389
|
onCustomEvent: a,
|
|
4382
4390
|
onMetadataEvent: i,
|
|
4383
|
-
onFinish:
|
|
4384
|
-
onStreamingChange:
|
|
4391
|
+
onFinish: u,
|
|
4392
|
+
onStreamingChange: l
|
|
4385
4393
|
}) {
|
|
4386
|
-
const { chatApi:
|
|
4394
|
+
const { chatApi: c, baseUrl: d } = Me(), m = d, p = ge(t), I = ge(n), f = ge(r), h = ge(o), x = ge(s), S = ge(a), A = ge(i), w = ge(u), k = ge(l), b = Z(
|
|
4387
4395
|
() => ({
|
|
4388
|
-
onError:
|
|
4396
|
+
onError: p,
|
|
4389
4397
|
onAuthError: I,
|
|
4390
|
-
onConnectionError:
|
|
4398
|
+
onConnectionError: f,
|
|
4391
4399
|
onMetadataEvent: A,
|
|
4392
4400
|
onCustomEvent: S,
|
|
4393
4401
|
onUpdateEvent: x,
|
|
4394
|
-
onToolEnd:
|
|
4402
|
+
onToolEnd: h,
|
|
4395
4403
|
onFinish: w
|
|
4396
4404
|
}),
|
|
4397
4405
|
[
|
|
4398
|
-
|
|
4406
|
+
p,
|
|
4399
4407
|
I,
|
|
4400
|
-
|
|
4408
|
+
f,
|
|
4401
4409
|
A,
|
|
4402
4410
|
S,
|
|
4403
4411
|
x,
|
|
4404
|
-
|
|
4412
|
+
h,
|
|
4405
4413
|
w
|
|
4406
4414
|
]
|
|
4407
4415
|
);
|
|
4408
4416
|
return /* @__PURE__ */ de(Ur.Provider, { value: !0, children: /* @__PURE__ */ de(
|
|
4409
4417
|
Fr,
|
|
4410
4418
|
{
|
|
4411
|
-
api:
|
|
4412
|
-
streamBaseUrl:
|
|
4413
|
-
handlers:
|
|
4414
|
-
onStreamingChange:
|
|
4419
|
+
api: c,
|
|
4420
|
+
streamBaseUrl: m,
|
|
4421
|
+
handlers: b,
|
|
4422
|
+
onStreamingChange: k,
|
|
4415
4423
|
children: e
|
|
4416
4424
|
}
|
|
4417
4425
|
) });
|
|
@@ -4423,118 +4431,118 @@ function Fr({
|
|
|
4423
4431
|
handlers: r,
|
|
4424
4432
|
onStreamingChange: o
|
|
4425
4433
|
}) {
|
|
4426
|
-
const { setCurrentThreadId: s, currentThreadIdRef: a, addThreadFromEvent: i, currentThreadId:
|
|
4427
|
-
interrupt:
|
|
4428
|
-
checkpoint:
|
|
4429
|
-
timelineCheckpoints:
|
|
4430
|
-
handleValuesEvent:
|
|
4431
|
-
markSkipNextLoad:
|
|
4434
|
+
const { setCurrentThreadId: s, currentThreadIdRef: a, addThreadFromEvent: i, currentThreadId: u } = st(), {
|
|
4435
|
+
interrupt: l,
|
|
4436
|
+
checkpoint: c,
|
|
4437
|
+
timelineCheckpoints: d,
|
|
4438
|
+
handleValuesEvent: m,
|
|
4439
|
+
markSkipNextLoad: p,
|
|
4432
4440
|
markStreamPendingThread: I,
|
|
4433
|
-
resetHistoryState:
|
|
4434
|
-
pushUser:
|
|
4441
|
+
resetHistoryState: f,
|
|
4442
|
+
pushUser: h,
|
|
4435
4443
|
onEvent: x,
|
|
4436
4444
|
messages: S
|
|
4437
|
-
} =
|
|
4438
|
-
(
|
|
4439
|
-
i(
|
|
4445
|
+
} = Ht(), { registerClearThread: A, registerRespondToInterrupt: w } = Lr(), k = N(
|
|
4446
|
+
(g) => {
|
|
4447
|
+
i(g), I(g.threadId), a.current !== g.threadId && ((g.created ?? !a.current) && p(g.threadId), s(g.threadId));
|
|
4440
4448
|
},
|
|
4441
|
-
[i,
|
|
4442
|
-
),
|
|
4449
|
+
[i, p, I, s, a]
|
|
4450
|
+
), b = pr({
|
|
4443
4451
|
baseUrl: n,
|
|
4444
4452
|
onEvent: x,
|
|
4445
|
-
onError: (
|
|
4446
|
-
var
|
|
4447
|
-
(
|
|
4453
|
+
onError: (g) => {
|
|
4454
|
+
var z;
|
|
4455
|
+
(z = r.onError) == null || z.call(r, (g == null ? void 0 : g.message) ?? String(g));
|
|
4448
4456
|
},
|
|
4449
4457
|
onAuthError: r.onAuthError,
|
|
4450
4458
|
onConnectionError: r.onConnectionError,
|
|
4451
4459
|
onFinish: r.onFinish,
|
|
4452
|
-
onThreadInfo:
|
|
4460
|
+
onThreadInfo: k,
|
|
4453
4461
|
onMetadataEvent: r.onMetadataEvent,
|
|
4454
4462
|
onCustomEvent: r.onCustomEvent,
|
|
4455
4463
|
onUpdateEvent: r.onUpdateEvent,
|
|
4456
4464
|
onToolEnd: r.onToolEnd,
|
|
4457
|
-
handleValuesEvent:
|
|
4465
|
+
handleValuesEvent: m
|
|
4458
4466
|
});
|
|
4459
4467
|
Y(() => {
|
|
4460
|
-
o == null || o(
|
|
4461
|
-
}, [
|
|
4462
|
-
const { stream: T, stop:
|
|
4468
|
+
o == null || o(b.isStreaming);
|
|
4469
|
+
}, [b.isStreaming, o]);
|
|
4470
|
+
const { stream: T, stop: y, clear: v, isStreaming: _, error: L, connected: M, activeMessageId: $ } = b;
|
|
4463
4471
|
Y(() => {
|
|
4464
|
-
|
|
4465
|
-
}, [
|
|
4466
|
-
const
|
|
4467
|
-
async (
|
|
4468
|
-
await T(
|
|
4472
|
+
u !== void 0 && v();
|
|
4473
|
+
}, [u, v]);
|
|
4474
|
+
const U = N(
|
|
4475
|
+
async (g, z) => {
|
|
4476
|
+
await T(g, z);
|
|
4469
4477
|
},
|
|
4470
4478
|
[T]
|
|
4471
|
-
),
|
|
4479
|
+
), V = W(c);
|
|
4472
4480
|
Y(() => {
|
|
4473
|
-
|
|
4474
|
-
}, [
|
|
4475
|
-
const
|
|
4476
|
-
async (
|
|
4481
|
+
V.current = c;
|
|
4482
|
+
}, [c]);
|
|
4483
|
+
const P = N(
|
|
4484
|
+
async (g, z, C) => {
|
|
4477
4485
|
var ye;
|
|
4478
|
-
const
|
|
4479
|
-
if (!
|
|
4486
|
+
const O = a.current;
|
|
4487
|
+
if (!O)
|
|
4480
4488
|
throw new Error("No active thread to handle interrupt");
|
|
4481
|
-
const
|
|
4482
|
-
threadId:
|
|
4483
|
-
checkpointId:
|
|
4489
|
+
const D = g ? z ?? !0 : !1, K = V.current, B = (C == null ? void 0 : C.checkpointId) ?? K.id ?? void 0, ee = (C == null ? void 0 : C.checkpointNs) ?? K.namespace ?? void 0, ie = {
|
|
4490
|
+
threadId: O,
|
|
4491
|
+
checkpointId: B,
|
|
4484
4492
|
checkpointNs: ee,
|
|
4485
|
-
command: { kind: "resume", value:
|
|
4493
|
+
command: { kind: "resume", value: D },
|
|
4486
4494
|
payload: {
|
|
4487
4495
|
...(C == null ? void 0 : C.payload) ?? {},
|
|
4488
4496
|
creativityLevel: ((ye = C == null ? void 0 : C.payload) == null ? void 0 : ye.creativityLevel) ?? "medium"
|
|
4489
4497
|
},
|
|
4490
4498
|
edit: !1
|
|
4491
4499
|
};
|
|
4492
|
-
|
|
4500
|
+
U(ie);
|
|
4493
4501
|
},
|
|
4494
|
-
[a,
|
|
4502
|
+
[a, U]
|
|
4495
4503
|
);
|
|
4496
4504
|
Y(() => {
|
|
4497
|
-
w(
|
|
4498
|
-
}, [
|
|
4499
|
-
const
|
|
4500
|
-
|
|
4501
|
-
}, [
|
|
4505
|
+
w(P);
|
|
4506
|
+
}, [P, w]);
|
|
4507
|
+
const F = N(async () => {
|
|
4508
|
+
y(), v(), f(), s(null);
|
|
4509
|
+
}, [v, f, s, y]);
|
|
4502
4510
|
Y(() => {
|
|
4503
|
-
A(
|
|
4504
|
-
}, [
|
|
4505
|
-
const
|
|
4506
|
-
async (
|
|
4507
|
-
|
|
4511
|
+
A(F);
|
|
4512
|
+
}, [F, A]);
|
|
4513
|
+
const E = N(
|
|
4514
|
+
async (g, z) => {
|
|
4515
|
+
_ && y();
|
|
4508
4516
|
let C = a.current;
|
|
4509
|
-
const
|
|
4510
|
-
ee && delete
|
|
4511
|
-
const ie = !!(ee && ee.length), ye = !!(
|
|
4512
|
-
if (!C && !K &&
|
|
4517
|
+
const O = (g == null ? void 0 : g.text) ?? "", D = (g == null ? void 0 : g.attachments) ?? [], K = (O == null ? void 0 : O.trim()) ?? "", B = { ...(g == null ? void 0 : g.payload) ?? {} }, ee = Array.isArray(B.messages) ? B.messages : void 0;
|
|
4518
|
+
ee && delete B.messages;
|
|
4519
|
+
const ie = !!(ee && ee.length), ye = !!(g.contentParts && g.contentParts.length > 0);
|
|
4520
|
+
if (!C && !K && D.length === 0 && !ie && !ye) return;
|
|
4513
4521
|
if (!C) {
|
|
4514
4522
|
const re = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), te = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")).join("").slice(0, 16);
|
|
4515
|
-
C = `${re}${te}`,
|
|
4523
|
+
C = `${re}${te}`, p(C), s(C);
|
|
4516
4524
|
}
|
|
4517
|
-
let
|
|
4518
|
-
|
|
4519
|
-
const { contentParts:
|
|
4520
|
-
K && X.push({ type: "text", text:
|
|
4521
|
-
const Q =
|
|
4525
|
+
let J = null;
|
|
4526
|
+
g.contentParts && g.contentParts.length > 0 && (J = g.contentParts);
|
|
4527
|
+
const { contentParts: oe, filesInfo: he } = J ? { contentParts: J, filesInfo: [] } : await sr(D), X = [...oe];
|
|
4528
|
+
K && X.push({ type: "text", text: O });
|
|
4529
|
+
const Q = g == null ? void 0 : g.originalMessageId, be = !!(g != null && g.edit && Q), He = !ie && X.length > 0;
|
|
4522
4530
|
let we = null;
|
|
4523
|
-
if (
|
|
4531
|
+
if (He) {
|
|
4524
4532
|
const re = be ? Q : `msg-${Date.now()}`;
|
|
4525
4533
|
we = jt({
|
|
4526
4534
|
id: re,
|
|
4527
4535
|
role: "user",
|
|
4528
4536
|
content: X,
|
|
4529
4537
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4530
|
-
}, "user"), be ?
|
|
4538
|
+
}, "user"), be ? h(we, { editingMessageId: Q }) : h(we);
|
|
4531
4539
|
}
|
|
4532
4540
|
const Pe = ie ? ee : we ? [we] : [], ke = {
|
|
4533
|
-
...
|
|
4541
|
+
...B,
|
|
4534
4542
|
...he.length ? { files_info: he } : {}
|
|
4535
4543
|
};
|
|
4536
4544
|
Pe.length ? ke.messages = Pe : "messages" in ke || (ke.messages = []);
|
|
4537
|
-
let ne = (
|
|
4545
|
+
let ne = (g == null ? void 0 : g.checkpointId) ?? c.id ?? void 0;
|
|
4538
4546
|
if (be) {
|
|
4539
4547
|
const re = S.find((te) => te.id === Q);
|
|
4540
4548
|
if (re)
|
|
@@ -4549,44 +4557,44 @@ function Fr({
|
|
|
4549
4557
|
te > 0 && S[te - 1].checkpointId && (ne = S[te - 1].checkpointId ?? void 0);
|
|
4550
4558
|
}
|
|
4551
4559
|
}
|
|
4552
|
-
if (
|
|
4560
|
+
if (g != null && g.edit && !ne)
|
|
4553
4561
|
throw new Error(
|
|
4554
4562
|
`[streaming] Missing checkpointId for edit submit. threadId=${C ?? "null"}. Ensure you are editing a message that has been saved.`
|
|
4555
4563
|
);
|
|
4556
4564
|
const Ue = {
|
|
4557
4565
|
threadId: C,
|
|
4558
|
-
content:
|
|
4566
|
+
content: g == null ? void 0 : g.text,
|
|
4559
4567
|
payload: ke,
|
|
4560
|
-
config:
|
|
4568
|
+
config: g == null ? void 0 : g.config,
|
|
4561
4569
|
checkpointId: ne,
|
|
4562
|
-
command:
|
|
4563
|
-
edit:
|
|
4570
|
+
command: g == null ? void 0 : g.command,
|
|
4571
|
+
edit: g == null ? void 0 : g.edit
|
|
4564
4572
|
};
|
|
4565
|
-
return
|
|
4573
|
+
return U(Ue, z);
|
|
4566
4574
|
},
|
|
4567
|
-
[
|
|
4568
|
-
),
|
|
4575
|
+
[c, a, _, p, h, U, y, d]
|
|
4576
|
+
), j = Z(() => S, [S]), G = Z(
|
|
4569
4577
|
() => ({
|
|
4570
|
-
isStreaming:
|
|
4571
|
-
error:
|
|
4572
|
-
connectionState:
|
|
4573
|
-
messages:
|
|
4578
|
+
isStreaming: _,
|
|
4579
|
+
error: L,
|
|
4580
|
+
connectionState: L ? "error" : _ ? M ? "connected" : "connecting" : "idle",
|
|
4581
|
+
messages: j,
|
|
4574
4582
|
activeMessageId: $,
|
|
4575
|
-
submit:
|
|
4576
|
-
stop:
|
|
4577
|
-
interrupt:
|
|
4583
|
+
submit: E,
|
|
4584
|
+
stop: y,
|
|
4585
|
+
interrupt: l,
|
|
4578
4586
|
resume: () => Promise.resolve(),
|
|
4579
|
-
goto: (
|
|
4587
|
+
goto: (g, z) => Promise.resolve(),
|
|
4580
4588
|
clearError: () => {
|
|
4581
4589
|
}
|
|
4582
4590
|
// TODO: Implement error clearing
|
|
4583
4591
|
}),
|
|
4584
|
-
[
|
|
4592
|
+
[_, L, E, y, l, M, j]
|
|
4585
4593
|
);
|
|
4586
|
-
return /* @__PURE__ */ de(
|
|
4594
|
+
return /* @__PURE__ */ de(Vt.Provider, { value: G, children: e });
|
|
4587
4595
|
}
|
|
4588
4596
|
function ge(e) {
|
|
4589
|
-
const t =
|
|
4597
|
+
const t = W(e);
|
|
4590
4598
|
return Y(() => {
|
|
4591
4599
|
t.current = e;
|
|
4592
4600
|
}, [e]), N((...n) => {
|
|
@@ -4596,7 +4604,7 @@ function ge(e) {
|
|
|
4596
4604
|
}, []);
|
|
4597
4605
|
}
|
|
4598
4606
|
function Or(e) {
|
|
4599
|
-
return je(
|
|
4607
|
+
return je(Vt);
|
|
4600
4608
|
}
|
|
4601
4609
|
function bt(e) {
|
|
4602
4610
|
return typeof e == "object" && e !== null;
|
|
@@ -4613,21 +4621,21 @@ function $r(e, t) {
|
|
|
4613
4621
|
return !0;
|
|
4614
4622
|
}
|
|
4615
4623
|
function Dr(e) {
|
|
4616
|
-
const t =
|
|
4624
|
+
const t = W(e), n = W(e);
|
|
4617
4625
|
return $r(t.current, e) || (t.current = e, n.current = e), n.current;
|
|
4618
4626
|
}
|
|
4619
4627
|
function Kr(e) {
|
|
4620
4628
|
const t = e.artifact && typeof e.artifact == "object" ? e.artifact : null, n = !t && e.content && typeof e.content == "object" ? e.content : null, r = t ?? n, o = (r == null ? void 0 : r.task_id) ?? (r == null ? void 0 : r.taskId) ?? null;
|
|
4621
4629
|
return typeof o == "string" ? o : null;
|
|
4622
4630
|
}
|
|
4623
|
-
function
|
|
4631
|
+
function us(e) {
|
|
4624
4632
|
const { setCurrentTaskId: t, getCurrentTaskId: n, onToolEnd: r } = e;
|
|
4625
4633
|
return (o) => {
|
|
4626
4634
|
const s = Kr(o), a = (n == null ? void 0 : n()) ?? null;
|
|
4627
4635
|
s && s !== a && t(s), r == null || r(o);
|
|
4628
4636
|
};
|
|
4629
4637
|
}
|
|
4630
|
-
function
|
|
4638
|
+
function fs({
|
|
4631
4639
|
children: e,
|
|
4632
4640
|
apiConfig: t,
|
|
4633
4641
|
initialThreadId: n = null,
|
|
@@ -4636,42 +4644,42 @@ function po({
|
|
|
4636
4644
|
autoLoadInitial: s = !0,
|
|
4637
4645
|
onConnectionError: a,
|
|
4638
4646
|
onError: i,
|
|
4639
|
-
onAuthError:
|
|
4640
|
-
onThreadChange:
|
|
4641
|
-
onToolEnd:
|
|
4642
|
-
onUpdateEvent:
|
|
4643
|
-
onCustomEvent:
|
|
4644
|
-
onMetadataEvent:
|
|
4647
|
+
onAuthError: u,
|
|
4648
|
+
onThreadChange: l,
|
|
4649
|
+
onToolEnd: c,
|
|
4650
|
+
onUpdateEvent: d,
|
|
4651
|
+
onCustomEvent: m,
|
|
4652
|
+
onMetadataEvent: p,
|
|
4645
4653
|
onFinish: I
|
|
4646
4654
|
}) {
|
|
4647
|
-
const
|
|
4655
|
+
const f = Dr(t), [h, x] = H(!1), S = me(i), A = me(u), w = me(a), k = me(l), b = me(c), T = me(d), y = me(m), v = me(p), _ = me(I), L = Z(
|
|
4648
4656
|
() => ({
|
|
4649
4657
|
onError: S,
|
|
4650
4658
|
onAuthError: A,
|
|
4651
4659
|
onConnectionError: w,
|
|
4652
|
-
onToolEnd:
|
|
4660
|
+
onToolEnd: b,
|
|
4653
4661
|
onUpdateEvent: T,
|
|
4654
|
-
onCustomEvent:
|
|
4655
|
-
onMetadataEvent:
|
|
4656
|
-
onFinish:
|
|
4662
|
+
onCustomEvent: y,
|
|
4663
|
+
onMetadataEvent: v,
|
|
4664
|
+
onFinish: _
|
|
4657
4665
|
}),
|
|
4658
4666
|
[
|
|
4659
4667
|
S,
|
|
4660
4668
|
A,
|
|
4661
4669
|
w,
|
|
4662
|
-
|
|
4670
|
+
b,
|
|
4663
4671
|
T,
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4672
|
+
y,
|
|
4673
|
+
v,
|
|
4674
|
+
_
|
|
4667
4675
|
]
|
|
4668
4676
|
);
|
|
4669
|
-
return /* @__PURE__ */ de(nr, { apiConfig:
|
|
4677
|
+
return /* @__PURE__ */ de(nr, { apiConfig: f, children: /* @__PURE__ */ de(
|
|
4670
4678
|
mr,
|
|
4671
4679
|
{
|
|
4672
4680
|
initialThreadId: n,
|
|
4673
4681
|
onError: S,
|
|
4674
|
-
onThreadChange:
|
|
4682
|
+
onThreadChange: k,
|
|
4675
4683
|
children: /* @__PURE__ */ de(
|
|
4676
4684
|
jr,
|
|
4677
4685
|
{
|
|
@@ -4680,11 +4688,11 @@ function po({
|
|
|
4680
4688
|
initialCheckpointNs: o,
|
|
4681
4689
|
autoLoadInitial: s,
|
|
4682
4690
|
onError: S,
|
|
4683
|
-
isStreaming:
|
|
4691
|
+
isStreaming: h,
|
|
4684
4692
|
children: /* @__PURE__ */ de(
|
|
4685
4693
|
Br,
|
|
4686
4694
|
{
|
|
4687
|
-
...
|
|
4695
|
+
...L,
|
|
4688
4696
|
onStreamingChange: x,
|
|
4689
4697
|
children: e
|
|
4690
4698
|
}
|
|
@@ -4695,16 +4703,16 @@ function po({
|
|
|
4695
4703
|
) });
|
|
4696
4704
|
}
|
|
4697
4705
|
function me(e) {
|
|
4698
|
-
const t =
|
|
4706
|
+
const t = W(e);
|
|
4699
4707
|
return t.current = e, N((...n) => {
|
|
4700
4708
|
const r = t.current;
|
|
4701
4709
|
if (r)
|
|
4702
4710
|
return r(...n);
|
|
4703
4711
|
}, []);
|
|
4704
4712
|
}
|
|
4705
|
-
const
|
|
4713
|
+
const Hr = 1, Vr = 1e6;
|
|
4706
4714
|
let We = 0;
|
|
4707
|
-
function
|
|
4715
|
+
function qr() {
|
|
4708
4716
|
return We = (We + 1) % Number.MAX_SAFE_INTEGER, We.toString();
|
|
4709
4717
|
}
|
|
4710
4718
|
const Je = /* @__PURE__ */ new Map(), wt = (e) => {
|
|
@@ -4715,14 +4723,14 @@ const Je = /* @__PURE__ */ new Map(), wt = (e) => {
|
|
|
4715
4723
|
type: "REMOVE_TOAST",
|
|
4716
4724
|
toastId: e
|
|
4717
4725
|
});
|
|
4718
|
-
},
|
|
4726
|
+
}, Vr);
|
|
4719
4727
|
Je.set(e, t);
|
|
4720
4728
|
}, Gr = (e, t) => {
|
|
4721
4729
|
switch (t.type) {
|
|
4722
4730
|
case "ADD_TOAST":
|
|
4723
4731
|
return {
|
|
4724
4732
|
...e,
|
|
4725
|
-
toasts: [t.toast, ...e.toasts].slice(0,
|
|
4733
|
+
toasts: [t.toast, ...e.toasts].slice(0, Hr)
|
|
4726
4734
|
};
|
|
4727
4735
|
case "UPDATE_TOAST":
|
|
4728
4736
|
return {
|
|
@@ -4762,7 +4770,7 @@ function Le(e) {
|
|
|
4762
4770
|
});
|
|
4763
4771
|
}
|
|
4764
4772
|
function Wr({ ...e }) {
|
|
4765
|
-
const t =
|
|
4773
|
+
const t = qr(), n = (o) => Le({
|
|
4766
4774
|
type: "UPDATE_TOAST",
|
|
4767
4775
|
toast: { ...o, id: t }
|
|
4768
4776
|
}), r = () => Le({ type: "DISMISS_TOAST", toastId: t });
|
|
@@ -4793,85 +4801,85 @@ function Jr() {
|
|
|
4793
4801
|
dismiss: (n) => Le({ type: "DISMISS_TOAST", toastId: n })
|
|
4794
4802
|
};
|
|
4795
4803
|
}
|
|
4796
|
-
function
|
|
4797
|
-
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Me(), { toast: o } = Jr(), [s, a] =
|
|
4798
|
-
|
|
4799
|
-
}, []),
|
|
4800
|
-
|
|
4801
|
-
}, []),
|
|
4802
|
-
async (I,
|
|
4804
|
+
function ps(e) {
|
|
4805
|
+
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Me(), { toast: o } = Jr(), [s, a] = H({}), [i, u] = H(null), [l, c] = H(!1), d = N(() => {
|
|
4806
|
+
c(!1), u(null);
|
|
4807
|
+
}, []), m = N((I) => {
|
|
4808
|
+
u(I), c(!0);
|
|
4809
|
+
}, []), p = N(
|
|
4810
|
+
async (I, f, h) => {
|
|
4803
4811
|
var x, S;
|
|
4804
4812
|
if (!t) {
|
|
4805
4813
|
I.preventDefault();
|
|
4806
4814
|
return;
|
|
4807
4815
|
}
|
|
4808
|
-
if (s[
|
|
4816
|
+
if (s[h]) {
|
|
4809
4817
|
I.preventDefault();
|
|
4810
4818
|
return;
|
|
4811
4819
|
}
|
|
4812
4820
|
try {
|
|
4813
|
-
const A = String(
|
|
4821
|
+
const A = String(f.url ?? ""), w = A.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
|
|
4814
4822
|
if (w) {
|
|
4815
4823
|
I.preventDefault();
|
|
4816
|
-
const
|
|
4817
|
-
|
|
4824
|
+
const k = w[1], b = f.name || `file_${k}`, T = f.mimeType || "application/octet-stream";
|
|
4825
|
+
m({ id: k, name: b, mimeType: T });
|
|
4818
4826
|
return;
|
|
4819
4827
|
}
|
|
4820
4828
|
if (A.startsWith("data:")) {
|
|
4821
|
-
I.preventDefault(), a((
|
|
4822
|
-
const
|
|
4829
|
+
I.preventDefault(), a((b) => ({ ...b, [h]: !0 }));
|
|
4830
|
+
const k = o({ title: "Fetching file...", description: "", open: !0 });
|
|
4823
4831
|
try {
|
|
4824
|
-
const
|
|
4825
|
-
if (!
|
|
4832
|
+
const b = await r.listFiles(n ?? void 0);
|
|
4833
|
+
if (!b || !Array.isArray(b))
|
|
4826
4834
|
throw new Error("Invalid file list response");
|
|
4827
|
-
const T =
|
|
4835
|
+
const T = b.find((y) => !y || typeof y != "object" || !((y.filename ?? "") === (f.name ?? "")) ? !1 : typeof f.size == "number" && typeof y.size == "number" ? y.size === f.size : !0);
|
|
4828
4836
|
if (!(T != null && T.id))
|
|
4829
|
-
throw new Error(`File "${
|
|
4837
|
+
throw new Error(`File "${f.name}" is not yet available on the server`);
|
|
4830
4838
|
if (!T.id || !T.filename)
|
|
4831
4839
|
throw new Error("Invalid file data received from server");
|
|
4832
|
-
|
|
4840
|
+
m({
|
|
4833
4841
|
id: T.id,
|
|
4834
|
-
name:
|
|
4835
|
-
mimeType:
|
|
4836
|
-
}), (x =
|
|
4837
|
-
id:
|
|
4842
|
+
name: f.name || T.filename || `file_${T.id}`,
|
|
4843
|
+
mimeType: f.mimeType || T.mime_type || "application/octet-stream"
|
|
4844
|
+
}), (x = k.update) == null || x.call(k, {
|
|
4845
|
+
id: k.id,
|
|
4838
4846
|
title: "Success",
|
|
4839
|
-
description: `Opened ${
|
|
4847
|
+
description: `Opened ${f.name}`,
|
|
4840
4848
|
open: !0
|
|
4841
4849
|
});
|
|
4842
|
-
} catch (
|
|
4843
|
-
console.error("Failed to fetch server file:",
|
|
4844
|
-
const T =
|
|
4845
|
-
(S =
|
|
4850
|
+
} catch (b) {
|
|
4851
|
+
console.error("Failed to fetch server file:", b);
|
|
4852
|
+
const T = b instanceof Error ? b.message : "Unknown error occurred";
|
|
4853
|
+
(S = k.update) == null || S.call(k, { id: k.id, title: "Failed", description: T }), o({
|
|
4846
4854
|
title: "Failed to fetch file",
|
|
4847
4855
|
description: T,
|
|
4848
4856
|
open: !0
|
|
4849
4857
|
});
|
|
4850
4858
|
} finally {
|
|
4851
|
-
a((
|
|
4859
|
+
a((b) => ({ ...b, [h]: !1 }));
|
|
4852
4860
|
}
|
|
4853
4861
|
}
|
|
4854
4862
|
} catch (A) {
|
|
4855
|
-
console.error("File click error:", A), a((w) => ({ ...w, [
|
|
4863
|
+
console.error("File click error:", A), a((w) => ({ ...w, [h]: !1 }));
|
|
4856
4864
|
}
|
|
4857
4865
|
},
|
|
4858
|
-
[t, s, o, n,
|
|
4866
|
+
[t, s, o, n, m]
|
|
4859
4867
|
);
|
|
4860
4868
|
return {
|
|
4861
4869
|
uploadingFiles: s,
|
|
4862
|
-
handleFileClick:
|
|
4863
|
-
fileViewerOpen:
|
|
4870
|
+
handleFileClick: p,
|
|
4871
|
+
fileViewerOpen: l,
|
|
4864
4872
|
currentFileInfo: i,
|
|
4865
|
-
closeFileViewer:
|
|
4873
|
+
closeFileViewer: d
|
|
4866
4874
|
};
|
|
4867
4875
|
}
|
|
4868
|
-
function
|
|
4876
|
+
function gs(e) {
|
|
4869
4877
|
return Z(() => {
|
|
4870
4878
|
const t = e;
|
|
4871
4879
|
let n = Array.isArray(t.content) ? t.content : [];
|
|
4872
4880
|
return typeof t.content == "string" && (n = [{ type: "text", text: t.content }]), {
|
|
4873
4881
|
contentParts: n,
|
|
4874
|
-
textContent:
|
|
4882
|
+
textContent: or(n),
|
|
4875
4883
|
toolMeta: ar(t),
|
|
4876
4884
|
imageParts: n.filter((r) => r.type === "image_url"),
|
|
4877
4885
|
fileParts: n.filter((r) => r.type === "file"),
|
|
@@ -4904,20 +4912,20 @@ function Qr(e) {
|
|
|
4904
4912
|
}
|
|
4905
4913
|
return null;
|
|
4906
4914
|
}
|
|
4907
|
-
function
|
|
4915
|
+
function ms(e) {
|
|
4908
4916
|
return Z(() => {
|
|
4909
4917
|
const t = e.content.filter(
|
|
4910
|
-
(
|
|
4918
|
+
(u) => u.type === "text"
|
|
4911
4919
|
);
|
|
4912
4920
|
if (!t.length)
|
|
4913
4921
|
return null;
|
|
4914
4922
|
let r = t.flatMap(
|
|
4915
|
-
(
|
|
4923
|
+
(u) => Xr(u.text ?? "")
|
|
4916
4924
|
);
|
|
4917
4925
|
if (!r.length) {
|
|
4918
|
-
const
|
|
4919
|
-
`),
|
|
4920
|
-
|
|
4926
|
+
const u = t.map((c) => c.text ?? "").join(`
|
|
4927
|
+
`), l = tt(u);
|
|
4928
|
+
l && typeof l == "object" && (r = [l]);
|
|
4921
4929
|
}
|
|
4922
4930
|
if (!r.length)
|
|
4923
4931
|
return null;
|
|
@@ -4938,20 +4946,20 @@ function yo(e) {
|
|
|
4938
4946
|
}, [e]);
|
|
4939
4947
|
}
|
|
4940
4948
|
function Yr(e) {
|
|
4941
|
-
var
|
|
4942
|
-
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r =
|
|
4949
|
+
var $, U;
|
|
4950
|
+
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r = typeof e == "object" ? e.includeHistory : !0, o = st({ optional: !0 }), s = Ht({ optional: !0 }), a = Or(), { currentThreadId: i, setCurrentThreadId: u, actions: l } = o || {
|
|
4943
4951
|
currentThreadId: null,
|
|
4944
4952
|
setCurrentThreadId: () => {
|
|
4945
4953
|
},
|
|
4946
4954
|
actions: {}
|
|
4947
|
-
}, c = !!t && t !==
|
|
4948
|
-
|
|
4955
|
+
}, c = !!t && t !== i, [d, m] = H([]), p = N((V) => {
|
|
4956
|
+
m(V);
|
|
4949
4957
|
}, []), {
|
|
4950
|
-
isLoadingThread:
|
|
4951
|
-
threadStateError:
|
|
4952
|
-
threadCheckpoints:
|
|
4953
|
-
isLoadingHistory:
|
|
4954
|
-
loadThread:
|
|
4958
|
+
isLoadingThread: I,
|
|
4959
|
+
threadStateError: f,
|
|
4960
|
+
threadCheckpoints: h,
|
|
4961
|
+
isLoadingHistory: x,
|
|
4962
|
+
loadThread: S
|
|
4955
4963
|
} = $t({
|
|
4956
4964
|
api: Me().chatApi,
|
|
4957
4965
|
fileApi: Me().fileApi,
|
|
@@ -4959,73 +4967,74 @@ function Yr(e) {
|
|
|
4959
4967
|
currentThreadId: c ? t : null,
|
|
4960
4968
|
initialThreadId: c ? t : null,
|
|
4961
4969
|
isStreaming: !1,
|
|
4962
|
-
getMessages: () =>
|
|
4963
|
-
autoLoadInitial: c && !n
|
|
4970
|
+
getMessages: () => d,
|
|
4971
|
+
autoLoadInitial: c && !n,
|
|
4972
|
+
includeHistory: r
|
|
4964
4973
|
});
|
|
4965
4974
|
Y(() => {
|
|
4966
|
-
!c && !n &&
|
|
4967
|
-
}, [c, n,
|
|
4968
|
-
const
|
|
4969
|
-
var
|
|
4970
|
-
return ((
|
|
4971
|
-
}, [
|
|
4975
|
+
!c && !n && i && (s != null && s.loadThread) && s.loadThread(i);
|
|
4976
|
+
}, [c, n, i, s == null ? void 0 : s.loadThread]);
|
|
4977
|
+
const A = Z(() => {
|
|
4978
|
+
var V;
|
|
4979
|
+
return ((V = h[0]) == null ? void 0 : V.values) || {};
|
|
4980
|
+
}, [h]), w = Z(() => ({ timeline: [], messagePreviews: {} }), []), k = t || i, b = c ? I ? "loading" : "idle" : (s == null ? void 0 : s.status) || "idle", T = c ? d : (a == null ? void 0 : a.messages) || [], y = c ? I : (s == null ? void 0 : s.isLoading) || !1, v = c ? x : (s == null ? void 0 : s.isLoadingHistory) || !1, _ = c ? A : (s == null ? void 0 : s.values) || {}, L = c ? {} : (s == null ? void 0 : s.taskMessagesByScope) || {}, M = c ? f : (a == null ? void 0 : a.error) || (s == null ? void 0 : s.error) || null;
|
|
4972
4981
|
return {
|
|
4973
4982
|
// UNIFIED: Single thread ID concept
|
|
4974
|
-
threadId:
|
|
4983
|
+
threadId: k,
|
|
4975
4984
|
status: b,
|
|
4976
|
-
messages:
|
|
4977
|
-
isLoading:
|
|
4978
|
-
isHistoryLoading:
|
|
4979
|
-
error:
|
|
4985
|
+
messages: T,
|
|
4986
|
+
isLoading: y,
|
|
4987
|
+
isHistoryLoading: v,
|
|
4988
|
+
error: M,
|
|
4980
4989
|
// Values & Metadata
|
|
4981
|
-
values:
|
|
4982
|
-
taskMessagesByScope:
|
|
4983
|
-
metadata: c ? {} :
|
|
4990
|
+
values: _,
|
|
4991
|
+
taskMessagesByScope: L,
|
|
4992
|
+
metadata: c ? {} : s == null ? void 0 : s.metadata,
|
|
4984
4993
|
// Actions & State relating to Global/Active Thread only
|
|
4985
4994
|
navigateToCheckpoint: c ? async () => {
|
|
4986
|
-
} : (
|
|
4995
|
+
} : (s == null ? void 0 : s.navigateToCheckpoint) || (async () => {
|
|
4987
4996
|
}),
|
|
4988
4997
|
returnToLatest: c ? async () => {
|
|
4989
|
-
} : (
|
|
4998
|
+
} : (s == null ? void 0 : s.returnToLatest) || (async () => {
|
|
4990
4999
|
}),
|
|
4991
|
-
checkpoint: c ?
|
|
4992
|
-
checkpoints: c ?
|
|
4993
|
-
checkpointIndex: c ?
|
|
4994
|
-
interrupt: c ? null : (
|
|
5000
|
+
checkpoint: c ? h[0] ? { id: h[0].checkpointId, namespace: h[0].checkpointNs } : null : (s == null ? void 0 : s.checkpoint) || null,
|
|
5001
|
+
checkpoints: c ? h : (s == null ? void 0 : s.checkpoints) || [],
|
|
5002
|
+
checkpointIndex: c ? w : (s == null ? void 0 : s.checkpointIndex) || { timeline: [], messagePreviews: {} },
|
|
5003
|
+
interrupt: c ? null : (s == null ? void 0 : s.interrupt) || null,
|
|
4995
5004
|
respondToInterrupt: c ? async () => {
|
|
4996
|
-
} : (
|
|
5005
|
+
} : (s == null ? void 0 : s.respondToInterrupt) || (async () => {
|
|
4997
5006
|
}),
|
|
4998
5007
|
// Streaming Status
|
|
4999
5008
|
// Even in standalone mode, allow streaming state/stop if a stream context exists.
|
|
5000
|
-
isStreaming: (
|
|
5001
|
-
activeMessageId: c ? null : ((
|
|
5002
|
-
connectionState: (
|
|
5003
|
-
streamingAssistantId: !c && (
|
|
5009
|
+
isStreaming: (a == null ? void 0 : a.isStreaming) || !1,
|
|
5010
|
+
activeMessageId: c ? null : (($ = s == null ? void 0 : s.metadata) == null ? void 0 : $.assemblingMessageId) || (a == null ? void 0 : a.activeMessageId) || null,
|
|
5011
|
+
connectionState: (a == null ? void 0 : a.connectionState) || "disconnected",
|
|
5012
|
+
streamingAssistantId: !c && (a != null && a.isStreaming) && ((U = s == null ? void 0 : s.metadata) != null && U.assemblingMessageId) ? s.metadata.assemblingMessageId : null,
|
|
5004
5013
|
// Actions
|
|
5005
|
-
submit: (
|
|
5014
|
+
submit: (a == null ? void 0 : a.submit) || (async () => {
|
|
5006
5015
|
}),
|
|
5007
|
-
stop: (
|
|
5016
|
+
stop: (a == null ? void 0 : a.stop) || (() => {
|
|
5008
5017
|
}),
|
|
5009
5018
|
clearThread: c ? async () => {
|
|
5010
|
-
} : (
|
|
5019
|
+
} : (s == null ? void 0 : s.clearThread) || (async () => {
|
|
5011
5020
|
}),
|
|
5012
|
-
setCurrentThreadId:
|
|
5021
|
+
setCurrentThreadId: u,
|
|
5013
5022
|
loadHistory: c ? async () => {
|
|
5014
|
-
t && await
|
|
5023
|
+
t && await S(t);
|
|
5015
5024
|
} : async () => {
|
|
5016
5025
|
},
|
|
5017
5026
|
onEvent: c ? () => {
|
|
5018
|
-
} : (
|
|
5027
|
+
} : (s == null ? void 0 : s.onEvent) || (() => {
|
|
5019
5028
|
}),
|
|
5020
5029
|
// Thread Management
|
|
5021
|
-
createThread:
|
|
5022
|
-
deleteThread:
|
|
5023
|
-
renameThread:
|
|
5024
|
-
threads: (
|
|
5025
|
-
isThreadsLoading: (
|
|
5030
|
+
createThread: l == null ? void 0 : l.createThread,
|
|
5031
|
+
deleteThread: l == null ? void 0 : l.deleteThread,
|
|
5032
|
+
renameThread: l == null ? void 0 : l.renameThread,
|
|
5033
|
+
threads: (o == null ? void 0 : o.threads) || [],
|
|
5034
|
+
isThreadsLoading: (o == null ? void 0 : o.isLoading) || !1
|
|
5026
5035
|
};
|
|
5027
5036
|
}
|
|
5028
|
-
function
|
|
5037
|
+
function ys({
|
|
5029
5038
|
submit: e,
|
|
5030
5039
|
chatRequest: t,
|
|
5031
5040
|
lastCheckpointId: n,
|
|
@@ -5034,44 +5043,44 @@ function ho({
|
|
|
5034
5043
|
onExcelUploadSuccess: s,
|
|
5035
5044
|
onError: a,
|
|
5036
5045
|
enableMessageEditing: i,
|
|
5037
|
-
messages:
|
|
5038
|
-
setPendingAssistantResponse:
|
|
5039
|
-
project:
|
|
5040
|
-
onEvent:
|
|
5041
|
-
threadId:
|
|
5042
|
-
clearComposerOnSend:
|
|
5046
|
+
messages: u,
|
|
5047
|
+
setPendingAssistantResponse: l,
|
|
5048
|
+
project: c,
|
|
5049
|
+
onEvent: d,
|
|
5050
|
+
threadId: m,
|
|
5051
|
+
clearComposerOnSend: p = !0
|
|
5043
5052
|
}) {
|
|
5044
|
-
const { messages: I } = Yr(), [
|
|
5053
|
+
const { messages: I } = Yr(), [f, h] = H(null), [x, S] = H(""), [A, w] = H(null), [k, b] = H(null), [T, y] = H(!1), [v, _] = H(""), L = W(v), M = W(null);
|
|
5045
5054
|
Y(() => {
|
|
5046
|
-
if (!
|
|
5047
|
-
if (
|
|
5048
|
-
const
|
|
5049
|
-
|
|
5055
|
+
if (!f)
|
|
5056
|
+
if (m) {
|
|
5057
|
+
const z = localStorage.getItem(Ge(m));
|
|
5058
|
+
_(z || "");
|
|
5050
5059
|
} else
|
|
5051
|
-
|
|
5052
|
-
}, [
|
|
5053
|
-
const $ = N((
|
|
5054
|
-
|
|
5055
|
-
}, [
|
|
5060
|
+
_("");
|
|
5061
|
+
}, [m, f]);
|
|
5062
|
+
const $ = N((z) => {
|
|
5063
|
+
_(z), !f && m && localStorage.setItem(Ge(m), z);
|
|
5064
|
+
}, [m, f]);
|
|
5056
5065
|
Y(() => {
|
|
5057
|
-
|
|
5058
|
-
}, [
|
|
5059
|
-
if (!
|
|
5066
|
+
L.current = v;
|
|
5067
|
+
}, [v]), Y(() => {
|
|
5068
|
+
if (!f) {
|
|
5060
5069
|
M.current = null;
|
|
5061
5070
|
return;
|
|
5062
5071
|
}
|
|
5063
|
-
M.current === null && (M.current =
|
|
5064
|
-
}, [x,
|
|
5065
|
-
const
|
|
5066
|
-
(
|
|
5067
|
-
$(
|
|
5072
|
+
M.current === null && (M.current = L.current), $(x ?? "");
|
|
5073
|
+
}, [x, f, $]);
|
|
5074
|
+
const U = N(
|
|
5075
|
+
(z) => {
|
|
5076
|
+
$(z);
|
|
5068
5077
|
},
|
|
5069
5078
|
[$]
|
|
5070
|
-
),
|
|
5071
|
-
const
|
|
5072
|
-
if (!(!
|
|
5079
|
+
), V = async (z, C) => {
|
|
5080
|
+
const O = Array.isArray(C) ? { files: C } : C ?? {}, D = O.files ?? [], K = O.contentParts ?? [], B = z.trim();
|
|
5081
|
+
if (!(!B && D.length === 0 && K.length === 0))
|
|
5073
5082
|
try {
|
|
5074
|
-
const ee =
|
|
5083
|
+
const ee = D.map(async (X) => {
|
|
5075
5084
|
try {
|
|
5076
5085
|
const Q = await Rt.uploadFile(X);
|
|
5077
5086
|
return { file: X, record: Q };
|
|
@@ -5090,68 +5099,68 @@ function ho({
|
|
|
5090
5099
|
name: X.filename,
|
|
5091
5100
|
size: X.size
|
|
5092
5101
|
};
|
|
5093
|
-
}),
|
|
5102
|
+
}), J = [...K, ...ye], oe = f ? (A == null ? void 0 : A.checkpointId) ?? n ?? void 0 : n ?? void 0, he = f ? (A == null ? void 0 : A.checkpointNs) ?? r ?? void 0 : r ?? void 0;
|
|
5094
5103
|
await e(
|
|
5095
5104
|
{
|
|
5096
|
-
text:
|
|
5097
|
-
contentParts:
|
|
5098
|
-
attachments:
|
|
5105
|
+
text: B || "",
|
|
5106
|
+
contentParts: J,
|
|
5107
|
+
attachments: D,
|
|
5099
5108
|
payload: t.payload,
|
|
5100
|
-
edit: !!
|
|
5101
|
-
checkpointId:
|
|
5109
|
+
edit: !!f,
|
|
5110
|
+
checkpointId: oe,
|
|
5102
5111
|
checkpointNs: he,
|
|
5103
|
-
project:
|
|
5104
|
-
originalMessageId:
|
|
5112
|
+
project: c ?? void 0,
|
|
5113
|
+
originalMessageId: f ?? void 0,
|
|
5105
5114
|
config: t.config
|
|
5106
5115
|
},
|
|
5107
|
-
|
|
5108
|
-
), o == null || o(
|
|
5116
|
+
d ? { onEvent: d } : void 0
|
|
5117
|
+
), o == null || o(B), l(!0), p && (m && localStorage.removeItem(Ge(m)), $("")), b(null), h(null), S(""), w(null);
|
|
5109
5118
|
} catch (ee) {
|
|
5110
5119
|
const ie = (ee == null ? void 0 : ee.message) || "Failed to send message";
|
|
5111
|
-
|
|
5120
|
+
b(ie), a == null || a(ie), l(!1);
|
|
5112
5121
|
}
|
|
5113
|
-
},
|
|
5114
|
-
C ||
|
|
5115
|
-
},
|
|
5116
|
-
async (
|
|
5122
|
+
}, P = (z, C) => {
|
|
5123
|
+
C || V(z, { files: [] });
|
|
5124
|
+
}, F = N(
|
|
5125
|
+
async (z) => {
|
|
5117
5126
|
await e(
|
|
5118
5127
|
{
|
|
5119
|
-
attachments: [
|
|
5128
|
+
attachments: [z],
|
|
5120
5129
|
payload: t.payload,
|
|
5121
5130
|
checkpointId: n ?? void 0,
|
|
5122
5131
|
checkpointNs: r ?? void 0,
|
|
5123
|
-
project:
|
|
5132
|
+
project: c ?? void 0,
|
|
5124
5133
|
config: t.config
|
|
5125
5134
|
},
|
|
5126
|
-
|
|
5127
|
-
), s == null || s({ file:
|
|
5135
|
+
d ? { onEvent: d } : void 0
|
|
5136
|
+
), s == null || s({ file: z });
|
|
5128
5137
|
},
|
|
5129
5138
|
[n, r, t, s, e]
|
|
5130
|
-
),
|
|
5131
|
-
(
|
|
5132
|
-
i && (M.current =
|
|
5133
|
-
checkpointId: (
|
|
5134
|
-
checkpointNs: (
|
|
5135
|
-
}),
|
|
5139
|
+
), E = N(
|
|
5140
|
+
(z, C, O) => {
|
|
5141
|
+
i && (M.current = v, h(z), S(C), w({
|
|
5142
|
+
checkpointId: (O == null ? void 0 : O.checkpointId) ?? null,
|
|
5143
|
+
checkpointNs: (O == null ? void 0 : O.checkpointNs) ?? null
|
|
5144
|
+
}), b(null));
|
|
5136
5145
|
},
|
|
5137
|
-
[
|
|
5138
|
-
),
|
|
5139
|
-
|
|
5140
|
-
const
|
|
5141
|
-
|
|
5142
|
-
}, []),
|
|
5146
|
+
[v, i]
|
|
5147
|
+
), j = N(() => {
|
|
5148
|
+
h(null), S(""), w(null), b(null);
|
|
5149
|
+
const z = M.current;
|
|
5150
|
+
z !== null && _(z), M.current = null;
|
|
5151
|
+
}, []), G = N((z) => {
|
|
5143
5152
|
let C = null;
|
|
5144
|
-
for (let
|
|
5145
|
-
if (
|
|
5146
|
-
C =
|
|
5153
|
+
for (let B = z - 1; B >= 0; B--)
|
|
5154
|
+
if (u[B].role === "user") {
|
|
5155
|
+
C = u[B];
|
|
5147
5156
|
break;
|
|
5148
5157
|
}
|
|
5149
5158
|
if (!C) return;
|
|
5150
|
-
const
|
|
5159
|
+
const O = Array.isArray(C.content) ? C.content : [], K = O.filter((B) => (B == null ? void 0 : B.type) === "text").map((B) => B.text).join("") || (() => {
|
|
5151
5160
|
try {
|
|
5152
|
-
return JSON.stringify(
|
|
5161
|
+
return JSON.stringify(O, null, 2);
|
|
5153
5162
|
} catch {
|
|
5154
|
-
return String(
|
|
5163
|
+
return String(O);
|
|
5155
5164
|
}
|
|
5156
5165
|
})();
|
|
5157
5166
|
K && e(
|
|
@@ -5164,28 +5173,28 @@ function ho({
|
|
|
5164
5173
|
originalMessageId: C.id,
|
|
5165
5174
|
config: t.config
|
|
5166
5175
|
},
|
|
5167
|
-
|
|
5176
|
+
d ? { onEvent: d } : void 0
|
|
5168
5177
|
);
|
|
5169
|
-
}, [
|
|
5178
|
+
}, [u, e, n, r, t]);
|
|
5170
5179
|
return {
|
|
5171
|
-
editingMessageId:
|
|
5180
|
+
editingMessageId: f,
|
|
5172
5181
|
editingInitialValue: x,
|
|
5173
|
-
inputError:
|
|
5174
|
-
setInputError:
|
|
5182
|
+
inputError: k,
|
|
5183
|
+
setInputError: b,
|
|
5175
5184
|
dismissError: T,
|
|
5176
|
-
setDismissError:
|
|
5177
|
-
composerValue:
|
|
5178
|
-
handleComposerChange:
|
|
5179
|
-
handleSendMessage:
|
|
5180
|
-
handleQuickPrompt:
|
|
5181
|
-
handleExcelUpload:
|
|
5182
|
-
startEditing:
|
|
5183
|
-
cancelEditing:
|
|
5184
|
-
handleRegenerateCb:
|
|
5185
|
+
setDismissError: y,
|
|
5186
|
+
composerValue: v,
|
|
5187
|
+
handleComposerChange: U,
|
|
5188
|
+
handleSendMessage: V,
|
|
5189
|
+
handleQuickPrompt: P,
|
|
5190
|
+
handleExcelUpload: F,
|
|
5191
|
+
startEditing: E,
|
|
5192
|
+
cancelEditing: j,
|
|
5193
|
+
handleRegenerateCb: G,
|
|
5185
5194
|
displayMessages: I
|
|
5186
5195
|
};
|
|
5187
5196
|
}
|
|
5188
|
-
function
|
|
5197
|
+
function hs(e) {
|
|
5189
5198
|
return Z(() => e ? {
|
|
5190
5199
|
textContent: Ln(e),
|
|
5191
5200
|
imageParts: jn(e),
|
|
@@ -5200,8 +5209,8 @@ function bo(e) {
|
|
|
5200
5209
|
contentParts: []
|
|
5201
5210
|
}, [e]);
|
|
5202
5211
|
}
|
|
5203
|
-
function
|
|
5204
|
-
const [r, o] =
|
|
5212
|
+
function bs(e, t, n) {
|
|
5213
|
+
const [r, o] = H(e), s = W(e), a = W(null);
|
|
5205
5214
|
return Y(() => {
|
|
5206
5215
|
s.current = e;
|
|
5207
5216
|
const i = () => {
|
|
@@ -5219,26 +5228,26 @@ function wo(e, t, n) {
|
|
|
5219
5228
|
}, [e, t, n]), r;
|
|
5220
5229
|
}
|
|
5221
5230
|
export {
|
|
5222
|
-
|
|
5231
|
+
fs as ChatProviders,
|
|
5223
5232
|
jr as ThreadStateProvider,
|
|
5224
5233
|
mr as ThreadsProvider,
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5234
|
+
rs as cn,
|
|
5235
|
+
or as collectText,
|
|
5236
|
+
us as createTaskSyncToolEndHandler,
|
|
5228
5237
|
Kr as extractTaskIdFromToolEnd,
|
|
5229
5238
|
ar as extractToolMeta,
|
|
5230
|
-
|
|
5231
|
-
|
|
5239
|
+
ss as formatToolOutput,
|
|
5240
|
+
cs as getAgentNameFromMessage,
|
|
5232
5241
|
Pt as getChatToken,
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5242
|
+
ds as getMessageAttemptInfo,
|
|
5243
|
+
as as getToolCallArtifacts,
|
|
5244
|
+
Vn as getToolCalls,
|
|
5245
|
+
os as hasContent,
|
|
5237
5246
|
mt as hydrateHistorySnapshots,
|
|
5238
5247
|
Ct as isFileLike,
|
|
5239
5248
|
Nn as looksLikeMarkdown,
|
|
5240
|
-
|
|
5241
|
-
|
|
5249
|
+
ls as messageSignature,
|
|
5250
|
+
is as normalizeInterruptId,
|
|
5242
5251
|
_t as onChatTokenChanged,
|
|
5243
5252
|
tt as parseJsonSafe,
|
|
5244
5253
|
Et as pretty,
|
|
@@ -5247,18 +5256,18 @@ export {
|
|
|
5247
5256
|
xe as setChatToken,
|
|
5248
5257
|
Fn as stringifyTool,
|
|
5249
5258
|
Me as useApi,
|
|
5250
|
-
|
|
5259
|
+
ys as useChatController,
|
|
5251
5260
|
Yr as useChatSession,
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5261
|
+
ps as useFilePreview,
|
|
5262
|
+
hs as useMessageContent,
|
|
5263
|
+
gs as useParsedMessageContent,
|
|
5255
5264
|
pr as useStream,
|
|
5256
|
-
|
|
5265
|
+
bs as useStreamingMarkdownBuffer,
|
|
5257
5266
|
$t as useThreadHistoryState,
|
|
5258
|
-
|
|
5267
|
+
Ht as useThreadState,
|
|
5259
5268
|
Lr as useThreadStateUpdater,
|
|
5260
|
-
|
|
5269
|
+
st as useThreads,
|
|
5261
5270
|
gr as useThreadsState,
|
|
5262
|
-
|
|
5271
|
+
ms as useToolPayload
|
|
5263
5272
|
};
|
|
5264
5273
|
//# sourceMappingURL=index.esm.js.map
|