@teodorruskvi/chat-core 0.1.50 → 0.1.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +904 -889
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +6 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3,19 +3,19 @@ var Gt = (e, t, n) => t in e ? Ht(e, t, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var at = (e, t, n) => Gt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { jsx as ie } from "react/jsx-runtime";
|
|
5
5
|
import * as it from "react";
|
|
6
|
-
import { createContext as Ce, useContext as
|
|
6
|
+
import { createContext as Ce, useContext as je, useState as $, useRef as G, useEffect as X, useCallback as _, useMemo as Y, useReducer as Wt } from "react";
|
|
7
7
|
import Jt, { isCancel as Xt } from "axios";
|
|
8
|
-
function
|
|
8
|
+
function It(e) {
|
|
9
9
|
var t, n, r = "";
|
|
10
10
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
11
11
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
12
12
|
var o = e.length;
|
|
13
|
-
for (t = 0; t < o; t++) e[t] && (n =
|
|
13
|
+
for (t = 0; t < o; t++) e[t] && (n = It(e[t])) && (r && (r += " "), r += n);
|
|
14
14
|
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
15
15
|
return r;
|
|
16
16
|
}
|
|
17
17
|
function Qt() {
|
|
18
|
-
for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t =
|
|
18
|
+
for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t = It(e)) && (r && (r += " "), r += t);
|
|
19
19
|
return r;
|
|
20
20
|
}
|
|
21
21
|
const et = "-", Yt = (e) => {
|
|
@@ -26,18 +26,18 @@ const et = "-", Yt = (e) => {
|
|
|
26
26
|
return {
|
|
27
27
|
getClassGroupId: (a) => {
|
|
28
28
|
const i = a.split(et);
|
|
29
|
-
return i[0] === "" && i.length !== 1 && i.shift(),
|
|
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 d = n[a] || [];
|
|
33
|
+
return i && r[a] ? [...d, ...r[a]] : d;
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
},
|
|
36
|
+
}, vt = (e, t) => {
|
|
37
37
|
var a;
|
|
38
38
|
if (e.length === 0)
|
|
39
39
|
return t.classGroupId;
|
|
40
|
-
const n = e[0], r = t.nextPart.get(n), o = r ?
|
|
40
|
+
const n = e[0], r = t.nextPart.get(n), o = r ? vt(e.slice(1), r) : void 0;
|
|
41
41
|
if (o)
|
|
42
42
|
return o;
|
|
43
43
|
if (t.validators.length === 0)
|
|
@@ -120,33 +120,33 @@ const et = "-", Yt = (e) => {
|
|
|
120
120
|
n.has(s) ? n.set(s, a) : o(s, a);
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
},
|
|
123
|
+
}, xt = "!", on = (e) => {
|
|
124
124
|
const {
|
|
125
125
|
separator: t,
|
|
126
126
|
experimentalParseClassName: n
|
|
127
127
|
} = e, r = t.length === 1, o = t[0], s = t.length, a = (i) => {
|
|
128
|
-
const
|
|
129
|
-
let c = 0, l = 0,
|
|
130
|
-
for (let
|
|
131
|
-
let
|
|
128
|
+
const d = [];
|
|
129
|
+
let c = 0, l = 0, f;
|
|
130
|
+
for (let v = 0; v < i.length; v++) {
|
|
131
|
+
let x = i[v];
|
|
132
132
|
if (c === 0) {
|
|
133
|
-
if (
|
|
134
|
-
|
|
133
|
+
if (x === o && (r || i.slice(v, v + s) === t)) {
|
|
134
|
+
d.push(i.slice(l, v)), l = v + s;
|
|
135
135
|
continue;
|
|
136
136
|
}
|
|
137
|
-
if (
|
|
138
|
-
|
|
137
|
+
if (x === "/") {
|
|
138
|
+
f = v;
|
|
139
139
|
continue;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
x === "[" ? c++ : x === "]" && c--;
|
|
143
143
|
}
|
|
144
|
-
const
|
|
144
|
+
const p = d.length === 0 ? i : i.substring(l), g = p.startsWith(xt), I = g ? p.substring(1) : p, u = f && f > l ? f - l : void 0;
|
|
145
145
|
return {
|
|
146
|
-
modifiers:
|
|
147
|
-
hasImportantModifier:
|
|
148
|
-
baseClassName:
|
|
149
|
-
maybePostfixModifierPosition:
|
|
146
|
+
modifiers: d,
|
|
147
|
+
hasImportantModifier: g,
|
|
148
|
+
baseClassName: I,
|
|
149
|
+
maybePostfixModifierPosition: u
|
|
150
150
|
};
|
|
151
151
|
};
|
|
152
152
|
return n ? (i) => n({
|
|
@@ -172,73 +172,73 @@ const et = "-", Yt = (e) => {
|
|
|
172
172
|
getConflictingClassGroupIds: o
|
|
173
173
|
} = t, s = [], a = e.trim().split(cn);
|
|
174
174
|
let i = "";
|
|
175
|
-
for (let
|
|
176
|
-
const c = a[
|
|
175
|
+
for (let d = a.length - 1; d >= 0; d -= 1) {
|
|
176
|
+
const c = a[d], {
|
|
177
177
|
modifiers: l,
|
|
178
|
-
hasImportantModifier:
|
|
179
|
-
baseClassName:
|
|
180
|
-
maybePostfixModifierPosition:
|
|
178
|
+
hasImportantModifier: f,
|
|
179
|
+
baseClassName: p,
|
|
180
|
+
maybePostfixModifierPosition: g
|
|
181
181
|
} = n(c);
|
|
182
|
-
let
|
|
183
|
-
if (!
|
|
184
|
-
if (!
|
|
182
|
+
let I = !!g, u = r(I ? p.substring(0, g) : p);
|
|
183
|
+
if (!u) {
|
|
184
|
+
if (!I) {
|
|
185
185
|
i = c + (i.length > 0 ? " " + i : i);
|
|
186
186
|
continue;
|
|
187
187
|
}
|
|
188
|
-
if (
|
|
188
|
+
if (u = r(p), !u) {
|
|
189
189
|
i = c + (i.length > 0 ? " " + i : i);
|
|
190
190
|
continue;
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
I = !1;
|
|
193
193
|
}
|
|
194
|
-
const
|
|
194
|
+
const v = sn(l).join(":"), x = f ? v + xt : v, M = x + u;
|
|
195
195
|
if (s.includes(M))
|
|
196
196
|
continue;
|
|
197
197
|
s.push(M);
|
|
198
|
-
const
|
|
199
|
-
for (let
|
|
200
|
-
const b =
|
|
201
|
-
s.push(
|
|
198
|
+
const A = o(u, I);
|
|
199
|
+
for (let w = 0; w < A.length; ++w) {
|
|
200
|
+
const b = A[w];
|
|
201
|
+
s.push(x + b);
|
|
202
202
|
}
|
|
203
203
|
i = c + (i.length > 0 ? " " + i : i);
|
|
204
204
|
}
|
|
205
205
|
return i;
|
|
206
206
|
};
|
|
207
|
-
function
|
|
207
|
+
function dn() {
|
|
208
208
|
let e = 0, t, n, r = "";
|
|
209
209
|
for (; e < arguments.length; )
|
|
210
|
-
(t = arguments[e++]) && (n =
|
|
210
|
+
(t = arguments[e++]) && (n = At(t)) && (r && (r += " "), r += n);
|
|
211
211
|
return r;
|
|
212
212
|
}
|
|
213
|
-
const
|
|
213
|
+
const At = (e) => {
|
|
214
214
|
if (typeof e == "string")
|
|
215
215
|
return e;
|
|
216
216
|
let t, n = "";
|
|
217
217
|
for (let r = 0; r < e.length; r++)
|
|
218
|
-
e[r] && (t =
|
|
218
|
+
e[r] && (t = At(e[r])) && (n && (n += " "), n += t);
|
|
219
219
|
return n;
|
|
220
220
|
};
|
|
221
|
-
function
|
|
221
|
+
function un(e, ...t) {
|
|
222
222
|
let n, r, o, s = a;
|
|
223
|
-
function a(
|
|
224
|
-
const c = t.reduce((l,
|
|
225
|
-
return n = an(c), r = n.cache.get, o = n.cache.set, s = i, i(
|
|
223
|
+
function a(d) {
|
|
224
|
+
const c = t.reduce((l, f) => f(l), e());
|
|
225
|
+
return n = an(c), r = n.cache.get, o = n.cache.set, s = i, i(d);
|
|
226
226
|
}
|
|
227
|
-
function i(
|
|
228
|
-
const c = r(
|
|
227
|
+
function i(d) {
|
|
228
|
+
const c = r(d);
|
|
229
229
|
if (c)
|
|
230
230
|
return c;
|
|
231
|
-
const l = ln(
|
|
232
|
-
return o(
|
|
231
|
+
const l = ln(d, n);
|
|
232
|
+
return o(d, l), l;
|
|
233
233
|
}
|
|
234
234
|
return function() {
|
|
235
|
-
return s(
|
|
235
|
+
return s(dn.apply(null, arguments));
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
238
|
const D = (e) => {
|
|
239
239
|
const t = (n) => n[e] || [];
|
|
240
240
|
return t.isThemeGetter = !0, t;
|
|
241
|
-
}, Tt = /^\[(?:([a-z-]+):)?(.+)\]$/i, fn = /^\d+\/\d+$/, pn = /* @__PURE__ */ new Set(["px", "full", "screen"]), gn = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, mn = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, yn = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, hn = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, bn = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,
|
|
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)\(.+\)$/, ue = (e) => Te(e) || pn.has(e) || fn.test(e), be = (e) => Ee(e, "length", Sn), Te = (e) => !!e && !Number.isNaN(Number(e)), qe = (e) => Ee(e, "number", Te), _e = (e) => !!e && Number.isInteger(Number(e)), wn = (e) => e.endsWith("%") && Te(e.slice(0, -1)), N = (e) => Tt.test(e), we = (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 D = (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 = D("colors"), t = D("spacing"), n = D("blur"), r = D("brightness"), o = D("borderColor"), s = D("borderRadius"), a = D("borderSpacing"), i = D("borderWidth"),
|
|
250
|
+
const e = D("colors"), t = D("spacing"), n = D("blur"), r = D("brightness"), o = D("borderColor"), s = D("borderRadius"), a = D("borderSpacing"), i = D("borderWidth"), d = D("contrast"), c = D("grayscale"), l = D("hueRotate"), f = D("invert"), p = D("gap"), g = D("gradientColorStops"), I = D("gradientColorStopPositions"), u = D("inset"), v = D("margin"), x = D("opacity"), M = D("padding"), A = D("saturate"), w = D("scale"), b = D("sepia"), h = D("skew"), T = D("space"), m = D("translate"), k = () => ["auto", "contain", "none"], E = () => ["auto", "hidden", "clip", "visible", "scroll"], j = () => ["auto", N, t], C = () => [N, t], O = () => ["", ue, be], F = () => ["auto", Te, N], P = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], B = () => ["solid", "dashed", "dotted", "double", "none"], z = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], J = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], U = () => ["", "0", N], R = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], q = () => [Te, N];
|
|
251
251
|
return {
|
|
252
252
|
cacheSize: 500,
|
|
253
253
|
separator: ":",
|
|
254
254
|
theme: {
|
|
255
|
-
colors: [
|
|
256
|
-
spacing: [
|
|
257
|
-
blur: ["none", "", we,
|
|
258
|
-
brightness:
|
|
255
|
+
colors: [Ne],
|
|
256
|
+
spacing: [ue, be],
|
|
257
|
+
blur: ["none", "", we, N],
|
|
258
|
+
brightness: q(),
|
|
259
259
|
borderColor: [e],
|
|
260
|
-
borderRadius: ["none", "", "full", we,
|
|
260
|
+
borderRadius: ["none", "", "full", we, N],
|
|
261
261
|
borderSpacing: C(),
|
|
262
262
|
borderWidth: O(),
|
|
263
|
-
contrast:
|
|
264
|
-
grayscale:
|
|
265
|
-
hueRotate:
|
|
266
|
-
invert:
|
|
263
|
+
contrast: q(),
|
|
264
|
+
grayscale: U(),
|
|
265
|
+
hueRotate: q(),
|
|
266
|
+
invert: U(),
|
|
267
267
|
gap: C(),
|
|
268
268
|
gradientColorStops: [e],
|
|
269
269
|
gradientColorStopPositions: [wn, be],
|
|
270
270
|
inset: j(),
|
|
271
271
|
margin: j(),
|
|
272
|
-
opacity:
|
|
272
|
+
opacity: q(),
|
|
273
273
|
padding: C(),
|
|
274
|
-
saturate:
|
|
275
|
-
scale:
|
|
276
|
-
sepia:
|
|
277
|
-
skew:
|
|
274
|
+
saturate: q(),
|
|
275
|
+
scale: q(),
|
|
276
|
+
sepia: U(),
|
|
277
|
+
skew: q(),
|
|
278
278
|
space: C(),
|
|
279
279
|
translate: C()
|
|
280
280
|
},
|
|
@@ -285,7 +285,7 @@ const D = (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", N]
|
|
289
289
|
}],
|
|
290
290
|
/**
|
|
291
291
|
* Container
|
|
@@ -304,14 +304,14 @@ const D = (e) => {
|
|
|
304
304
|
* @see https://tailwindcss.com/docs/break-after
|
|
305
305
|
*/
|
|
306
306
|
"break-after": [{
|
|
307
|
-
"break-after":
|
|
307
|
+
"break-after": R()
|
|
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": R()
|
|
315
315
|
}],
|
|
316
316
|
/**
|
|
317
317
|
* Break Inside
|
|
@@ -370,49 +370,49 @@ const D = (e) => {
|
|
|
370
370
|
* @see https://tailwindcss.com/docs/object-position
|
|
371
371
|
*/
|
|
372
372
|
"object-position": [{
|
|
373
|
-
object: [...
|
|
373
|
+
object: [...P(), N]
|
|
374
374
|
}],
|
|
375
375
|
/**
|
|
376
376
|
* Overflow
|
|
377
377
|
* @see https://tailwindcss.com/docs/overflow
|
|
378
378
|
*/
|
|
379
379
|
overflow: [{
|
|
380
|
-
overflow:
|
|
380
|
+
overflow: E()
|
|
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": E()
|
|
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": E()
|
|
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: k()
|
|
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": k()
|
|
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": k()
|
|
416
416
|
}],
|
|
417
417
|
/**
|
|
418
418
|
* Position
|
|
@@ -424,63 +424,63 @@ const D = (e) => {
|
|
|
424
424
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
425
425
|
*/
|
|
426
426
|
inset: [{
|
|
427
|
-
inset: [
|
|
427
|
+
inset: [u]
|
|
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": [u]
|
|
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": [u]
|
|
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: [u]
|
|
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: [u]
|
|
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: [u]
|
|
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: [u]
|
|
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: [u]
|
|
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: [u]
|
|
484
484
|
}],
|
|
485
485
|
/**
|
|
486
486
|
* Visibility
|
|
@@ -492,7 +492,7 @@ const D = (e) => {
|
|
|
492
492
|
* @see https://tailwindcss.com/docs/z-index
|
|
493
493
|
*/
|
|
494
494
|
z: [{
|
|
495
|
-
z: ["auto", _e,
|
|
495
|
+
z: ["auto", _e, N]
|
|
496
496
|
}],
|
|
497
497
|
// Flexbox and Grid
|
|
498
498
|
/**
|
|
@@ -521,35 +521,35 @@ const D = (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", N]
|
|
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: U()
|
|
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: U()
|
|
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, N]
|
|
546
546
|
}],
|
|
547
547
|
/**
|
|
548
548
|
* Grid Template Columns
|
|
549
549
|
* @see https://tailwindcss.com/docs/grid-template-columns
|
|
550
550
|
*/
|
|
551
551
|
"grid-cols": [{
|
|
552
|
-
"grid-cols": [
|
|
552
|
+
"grid-cols": [Ne]
|
|
553
553
|
}],
|
|
554
554
|
/**
|
|
555
555
|
* Grid Column Start / End
|
|
@@ -557,8 +557,8 @@ const D = (e) => {
|
|
|
557
557
|
*/
|
|
558
558
|
"col-start-end": [{
|
|
559
559
|
col: ["auto", {
|
|
560
|
-
span: ["full", _e,
|
|
561
|
-
},
|
|
560
|
+
span: ["full", _e, N]
|
|
561
|
+
}, N]
|
|
562
562
|
}],
|
|
563
563
|
/**
|
|
564
564
|
* Grid Column Start
|
|
@@ -579,7 +579,7 @@ const D = (e) => {
|
|
|
579
579
|
* @see https://tailwindcss.com/docs/grid-template-rows
|
|
580
580
|
*/
|
|
581
581
|
"grid-rows": [{
|
|
582
|
-
"grid-rows": [
|
|
582
|
+
"grid-rows": [Ne]
|
|
583
583
|
}],
|
|
584
584
|
/**
|
|
585
585
|
* Grid Row Start / End
|
|
@@ -587,8 +587,8 @@ const D = (e) => {
|
|
|
587
587
|
*/
|
|
588
588
|
"row-start-end": [{
|
|
589
589
|
row: ["auto", {
|
|
590
|
-
span: [_e,
|
|
591
|
-
},
|
|
590
|
+
span: [_e, N]
|
|
591
|
+
}, N]
|
|
592
592
|
}],
|
|
593
593
|
/**
|
|
594
594
|
* Grid Row Start
|
|
@@ -616,42 +616,42 @@ const D = (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", N]
|
|
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", N]
|
|
627
627
|
}],
|
|
628
628
|
/**
|
|
629
629
|
* Gap
|
|
630
630
|
* @see https://tailwindcss.com/docs/gap
|
|
631
631
|
*/
|
|
632
632
|
gap: [{
|
|
633
|
-
gap: [
|
|
633
|
+
gap: [p]
|
|
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": [p]
|
|
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": [p]
|
|
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", ...J()]
|
|
655
655
|
}],
|
|
656
656
|
/**
|
|
657
657
|
* Justify Items
|
|
@@ -672,7 +672,7 @@ const D = (e) => {
|
|
|
672
672
|
* @see https://tailwindcss.com/docs/align-content
|
|
673
673
|
*/
|
|
674
674
|
"align-content": [{
|
|
675
|
-
content: ["normal", ...
|
|
675
|
+
content: ["normal", ...J(), "baseline"]
|
|
676
676
|
}],
|
|
677
677
|
/**
|
|
678
678
|
* Align Items
|
|
@@ -693,7 +693,7 @@ const D = (e) => {
|
|
|
693
693
|
* @see https://tailwindcss.com/docs/place-content
|
|
694
694
|
*/
|
|
695
695
|
"place-content": [{
|
|
696
|
-
"place-content": [...
|
|
696
|
+
"place-content": [...J(), "baseline"]
|
|
697
697
|
}],
|
|
698
698
|
/**
|
|
699
699
|
* Place Items
|
|
@@ -778,63 +778,63 @@ const D = (e) => {
|
|
|
778
778
|
* @see https://tailwindcss.com/docs/margin
|
|
779
779
|
*/
|
|
780
780
|
m: [{
|
|
781
|
-
m: [
|
|
781
|
+
m: [v]
|
|
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: [v]
|
|
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: [v]
|
|
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: [v]
|
|
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: [v]
|
|
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: [v]
|
|
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: [v]
|
|
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: [v]
|
|
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: [v]
|
|
838
838
|
}],
|
|
839
839
|
/**
|
|
840
840
|
* Space Between X
|
|
@@ -866,21 +866,21 @@ const D = (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", N, 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": [N, 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": [N, t, "none", "full", "min", "max", "fit", "prose", {
|
|
884
884
|
screen: [we]
|
|
885
885
|
}, we]
|
|
886
886
|
}],
|
|
@@ -889,28 +889,28 @@ const D = (e) => {
|
|
|
889
889
|
* @see https://tailwindcss.com/docs/height
|
|
890
890
|
*/
|
|
891
891
|
h: [{
|
|
892
|
-
h: [
|
|
892
|
+
h: [N, 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": [N, 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": [N, 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: [N, t, "auto", "min", "max", "fit"]
|
|
914
914
|
}],
|
|
915
915
|
// Typography
|
|
916
916
|
/**
|
|
@@ -942,7 +942,7 @@ const D = (e) => {
|
|
|
942
942
|
* @see https://tailwindcss.com/docs/font-family
|
|
943
943
|
*/
|
|
944
944
|
"font-family": [{
|
|
945
|
-
font: [
|
|
945
|
+
font: [Ne]
|
|
946
946
|
}],
|
|
947
947
|
/**
|
|
948
948
|
* Font Variant Numeric
|
|
@@ -979,7 +979,7 @@ const D = (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", N]
|
|
983
983
|
}],
|
|
984
984
|
/**
|
|
985
985
|
* Line Clamp
|
|
@@ -993,21 +993,21 @@ const D = (e) => {
|
|
|
993
993
|
* @see https://tailwindcss.com/docs/line-height
|
|
994
994
|
*/
|
|
995
995
|
leading: [{
|
|
996
|
-
leading: ["none", "tight", "snug", "normal", "relaxed", "loose",
|
|
996
|
+
leading: ["none", "tight", "snug", "normal", "relaxed", "loose", ue, N]
|
|
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", N]
|
|
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", N]
|
|
1011
1011
|
}],
|
|
1012
1012
|
/**
|
|
1013
1013
|
* List Style Position
|
|
@@ -1029,7 +1029,7 @@ const D = (e) => {
|
|
|
1029
1029
|
* @see https://tailwindcss.com/docs/placeholder-opacity
|
|
1030
1030
|
*/
|
|
1031
1031
|
"placeholder-opacity": [{
|
|
1032
|
-
"placeholder-opacity": [
|
|
1032
|
+
"placeholder-opacity": [x]
|
|
1033
1033
|
}],
|
|
1034
1034
|
/**
|
|
1035
1035
|
* Text Alignment
|
|
@@ -1050,7 +1050,7 @@ const D = (e) => {
|
|
|
1050
1050
|
* @see https://tailwindcss.com/docs/text-opacity
|
|
1051
1051
|
*/
|
|
1052
1052
|
"text-opacity": [{
|
|
1053
|
-
"text-opacity": [
|
|
1053
|
+
"text-opacity": [x]
|
|
1054
1054
|
}],
|
|
1055
1055
|
/**
|
|
1056
1056
|
* Text Decoration
|
|
@@ -1069,14 +1069,14 @@ const D = (e) => {
|
|
|
1069
1069
|
* @see https://tailwindcss.com/docs/text-decoration-thickness
|
|
1070
1070
|
*/
|
|
1071
1071
|
"text-decoration-thickness": [{
|
|
1072
|
-
decoration: ["auto", "from-font",
|
|
1072
|
+
decoration: ["auto", "from-font", ue, be]
|
|
1073
1073
|
}],
|
|
1074
1074
|
/**
|
|
1075
1075
|
* Text Underline Offset
|
|
1076
1076
|
* @see https://tailwindcss.com/docs/text-underline-offset
|
|
1077
1077
|
*/
|
|
1078
1078
|
"underline-offset": [{
|
|
1079
|
-
"underline-offset": ["auto",
|
|
1079
|
+
"underline-offset": ["auto", ue, N]
|
|
1080
1080
|
}],
|
|
1081
1081
|
/**
|
|
1082
1082
|
* Text Decoration Color
|
|
@@ -1114,7 +1114,7 @@ const D = (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", N]
|
|
1118
1118
|
}],
|
|
1119
1119
|
/**
|
|
1120
1120
|
* Whitespace
|
|
@@ -1142,7 +1142,7 @@ const D = (e) => {
|
|
|
1142
1142
|
* @see https://tailwindcss.com/docs/content
|
|
1143
1143
|
*/
|
|
1144
1144
|
content: [{
|
|
1145
|
-
content: ["none",
|
|
1145
|
+
content: ["none", N]
|
|
1146
1146
|
}],
|
|
1147
1147
|
// Backgrounds
|
|
1148
1148
|
/**
|
|
@@ -1165,7 +1165,7 @@ const D = (e) => {
|
|
|
1165
1165
|
* @see https://tailwindcss.com/docs/background-opacity
|
|
1166
1166
|
*/
|
|
1167
1167
|
"bg-opacity": [{
|
|
1168
|
-
"bg-opacity": [
|
|
1168
|
+
"bg-opacity": [x]
|
|
1169
1169
|
}],
|
|
1170
1170
|
/**
|
|
1171
1171
|
* Background Origin
|
|
@@ -1179,7 +1179,7 @@ const D = (e) => {
|
|
|
1179
1179
|
* @see https://tailwindcss.com/docs/background-position
|
|
1180
1180
|
*/
|
|
1181
1181
|
"bg-position": [{
|
|
1182
|
-
bg: [...
|
|
1182
|
+
bg: [...P(), vn]
|
|
1183
1183
|
}],
|
|
1184
1184
|
/**
|
|
1185
1185
|
* Background Repeat
|
|
@@ -1195,7 +1195,7 @@ const D = (e) => {
|
|
|
1195
1195
|
* @see https://tailwindcss.com/docs/background-size
|
|
1196
1196
|
*/
|
|
1197
1197
|
"bg-size": [{
|
|
1198
|
-
bg: ["auto", "cover", "contain",
|
|
1198
|
+
bg: ["auto", "cover", "contain", In]
|
|
1199
1199
|
}],
|
|
1200
1200
|
/**
|
|
1201
1201
|
* Background Image
|
|
@@ -1204,7 +1204,7 @@ const D = (e) => {
|
|
|
1204
1204
|
"bg-image": [{
|
|
1205
1205
|
bg: ["none", {
|
|
1206
1206
|
"gradient-to": ["t", "tr", "r", "br", "b", "bl", "l", "tl"]
|
|
1207
|
-
},
|
|
1207
|
+
}, An]
|
|
1208
1208
|
}],
|
|
1209
1209
|
/**
|
|
1210
1210
|
* Background Color
|
|
@@ -1218,42 +1218,42 @@ const D = (e) => {
|
|
|
1218
1218
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1219
1219
|
*/
|
|
1220
1220
|
"gradient-from-pos": [{
|
|
1221
|
-
from: [
|
|
1221
|
+
from: [I]
|
|
1222
1222
|
}],
|
|
1223
1223
|
/**
|
|
1224
1224
|
* Gradient Color Stops Via Position
|
|
1225
1225
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1226
1226
|
*/
|
|
1227
1227
|
"gradient-via-pos": [{
|
|
1228
|
-
via: [
|
|
1228
|
+
via: [I]
|
|
1229
1229
|
}],
|
|
1230
1230
|
/**
|
|
1231
1231
|
* Gradient Color Stops To Position
|
|
1232
1232
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1233
1233
|
*/
|
|
1234
1234
|
"gradient-to-pos": [{
|
|
1235
|
-
to: [
|
|
1235
|
+
to: [I]
|
|
1236
1236
|
}],
|
|
1237
1237
|
/**
|
|
1238
1238
|
* Gradient Color Stops From
|
|
1239
1239
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1240
1240
|
*/
|
|
1241
1241
|
"gradient-from": [{
|
|
1242
|
-
from: [
|
|
1242
|
+
from: [g]
|
|
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: [g]
|
|
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: [g]
|
|
1257
1257
|
}],
|
|
1258
1258
|
// Borders
|
|
1259
1259
|
/**
|
|
@@ -1429,7 +1429,7 @@ const D = (e) => {
|
|
|
1429
1429
|
* @see https://tailwindcss.com/docs/border-opacity
|
|
1430
1430
|
*/
|
|
1431
1431
|
"border-opacity": [{
|
|
1432
|
-
"border-opacity": [
|
|
1432
|
+
"border-opacity": [x]
|
|
1433
1433
|
}],
|
|
1434
1434
|
/**
|
|
1435
1435
|
* Border Style
|
|
@@ -1467,7 +1467,7 @@ const D = (e) => {
|
|
|
1467
1467
|
* @see https://tailwindcss.com/docs/divide-opacity
|
|
1468
1468
|
*/
|
|
1469
1469
|
"divide-opacity": [{
|
|
1470
|
-
"divide-opacity": [
|
|
1470
|
+
"divide-opacity": [x]
|
|
1471
1471
|
}],
|
|
1472
1472
|
/**
|
|
1473
1473
|
* Divide Style
|
|
@@ -1558,14 +1558,14 @@ const D = (e) => {
|
|
|
1558
1558
|
* @see https://tailwindcss.com/docs/outline-offset
|
|
1559
1559
|
*/
|
|
1560
1560
|
"outline-offset": [{
|
|
1561
|
-
"outline-offset": [
|
|
1561
|
+
"outline-offset": [ue, N]
|
|
1562
1562
|
}],
|
|
1563
1563
|
/**
|
|
1564
1564
|
* Outline Width
|
|
1565
1565
|
* @see https://tailwindcss.com/docs/outline-width
|
|
1566
1566
|
*/
|
|
1567
1567
|
"outline-w": [{
|
|
1568
|
-
outline: [
|
|
1568
|
+
outline: [ue, be]
|
|
1569
1569
|
}],
|
|
1570
1570
|
/**
|
|
1571
1571
|
* Outline Color
|
|
@@ -1598,14 +1598,14 @@ const D = (e) => {
|
|
|
1598
1598
|
* @see https://tailwindcss.com/docs/ring-opacity
|
|
1599
1599
|
*/
|
|
1600
1600
|
"ring-opacity": [{
|
|
1601
|
-
"ring-opacity": [
|
|
1601
|
+
"ring-opacity": [x]
|
|
1602
1602
|
}],
|
|
1603
1603
|
/**
|
|
1604
1604
|
* Ring Offset Width
|
|
1605
1605
|
* @see https://tailwindcss.com/docs/ring-offset-width
|
|
1606
1606
|
*/
|
|
1607
1607
|
"ring-offset-w": [{
|
|
1608
|
-
"ring-offset": [
|
|
1608
|
+
"ring-offset": [ue, be]
|
|
1609
1609
|
}],
|
|
1610
1610
|
/**
|
|
1611
1611
|
* Ring Offset Color
|
|
@@ -1627,14 +1627,14 @@ const D = (e) => {
|
|
|
1627
1627
|
* @see https://tailwindcss.com/docs/box-shadow-color
|
|
1628
1628
|
*/
|
|
1629
1629
|
"shadow-color": [{
|
|
1630
|
-
shadow: [
|
|
1630
|
+
shadow: [Ne]
|
|
1631
1631
|
}],
|
|
1632
1632
|
/**
|
|
1633
1633
|
* Opacity
|
|
1634
1634
|
* @see https://tailwindcss.com/docs/opacity
|
|
1635
1635
|
*/
|
|
1636
1636
|
opacity: [{
|
|
1637
|
-
opacity: [
|
|
1637
|
+
opacity: [x]
|
|
1638
1638
|
}],
|
|
1639
1639
|
/**
|
|
1640
1640
|
* Mix Blend Mode
|
|
@@ -1678,14 +1678,14 @@ const D = (e) => {
|
|
|
1678
1678
|
* @see https://tailwindcss.com/docs/contrast
|
|
1679
1679
|
*/
|
|
1680
1680
|
contrast: [{
|
|
1681
|
-
contrast: [
|
|
1681
|
+
contrast: [d]
|
|
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", we,
|
|
1688
|
+
"drop-shadow": ["", "none", we, N]
|
|
1689
1689
|
}],
|
|
1690
1690
|
/**
|
|
1691
1691
|
* Grayscale
|
|
@@ -1706,14 +1706,14 @@ const D = (e) => {
|
|
|
1706
1706
|
* @see https://tailwindcss.com/docs/invert
|
|
1707
1707
|
*/
|
|
1708
1708
|
invert: [{
|
|
1709
|
-
invert: [
|
|
1709
|
+
invert: [f]
|
|
1710
1710
|
}],
|
|
1711
1711
|
/**
|
|
1712
1712
|
* Saturate
|
|
1713
1713
|
* @see https://tailwindcss.com/docs/saturate
|
|
1714
1714
|
*/
|
|
1715
1715
|
saturate: [{
|
|
1716
|
-
saturate: [
|
|
1716
|
+
saturate: [A]
|
|
1717
1717
|
}],
|
|
1718
1718
|
/**
|
|
1719
1719
|
* Sepia
|
|
@@ -1749,7 +1749,7 @@ const D = (e) => {
|
|
|
1749
1749
|
* @see https://tailwindcss.com/docs/backdrop-contrast
|
|
1750
1750
|
*/
|
|
1751
1751
|
"backdrop-contrast": [{
|
|
1752
|
-
"backdrop-contrast": [
|
|
1752
|
+
"backdrop-contrast": [d]
|
|
1753
1753
|
}],
|
|
1754
1754
|
/**
|
|
1755
1755
|
* Backdrop Grayscale
|
|
@@ -1770,21 +1770,21 @@ const D = (e) => {
|
|
|
1770
1770
|
* @see https://tailwindcss.com/docs/backdrop-invert
|
|
1771
1771
|
*/
|
|
1772
1772
|
"backdrop-invert": [{
|
|
1773
|
-
"backdrop-invert": [
|
|
1773
|
+
"backdrop-invert": [f]
|
|
1774
1774
|
}],
|
|
1775
1775
|
/**
|
|
1776
1776
|
* Backdrop Opacity
|
|
1777
1777
|
* @see https://tailwindcss.com/docs/backdrop-opacity
|
|
1778
1778
|
*/
|
|
1779
1779
|
"backdrop-opacity": [{
|
|
1780
|
-
"backdrop-opacity": [
|
|
1780
|
+
"backdrop-opacity": [x]
|
|
1781
1781
|
}],
|
|
1782
1782
|
/**
|
|
1783
1783
|
* Backdrop Saturate
|
|
1784
1784
|
* @see https://tailwindcss.com/docs/backdrop-saturate
|
|
1785
1785
|
*/
|
|
1786
1786
|
"backdrop-saturate": [{
|
|
1787
|
-
"backdrop-saturate": [
|
|
1787
|
+
"backdrop-saturate": [A]
|
|
1788
1788
|
}],
|
|
1789
1789
|
/**
|
|
1790
1790
|
* Backdrop Sepia
|
|
@@ -1842,35 +1842,35 @@ const D = (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", N]
|
|
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: q()
|
|
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", N]
|
|
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: q()
|
|
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", N]
|
|
1874
1874
|
}],
|
|
1875
1875
|
// Transforms
|
|
1876
1876
|
/**
|
|
@@ -1885,42 +1885,42 @@ const D = (e) => {
|
|
|
1885
1885
|
* @see https://tailwindcss.com/docs/scale
|
|
1886
1886
|
*/
|
|
1887
1887
|
scale: [{
|
|
1888
|
-
scale: [
|
|
1888
|
+
scale: [w]
|
|
1889
1889
|
}],
|
|
1890
1890
|
/**
|
|
1891
1891
|
* Scale X
|
|
1892
1892
|
* @see https://tailwindcss.com/docs/scale
|
|
1893
1893
|
*/
|
|
1894
1894
|
"scale-x": [{
|
|
1895
|
-
"scale-x": [
|
|
1895
|
+
"scale-x": [w]
|
|
1896
1896
|
}],
|
|
1897
1897
|
/**
|
|
1898
1898
|
* Scale Y
|
|
1899
1899
|
* @see https://tailwindcss.com/docs/scale
|
|
1900
1900
|
*/
|
|
1901
1901
|
"scale-y": [{
|
|
1902
|
-
"scale-y": [
|
|
1902
|
+
"scale-y": [w]
|
|
1903
1903
|
}],
|
|
1904
1904
|
/**
|
|
1905
1905
|
* Rotate
|
|
1906
1906
|
* @see https://tailwindcss.com/docs/rotate
|
|
1907
1907
|
*/
|
|
1908
1908
|
rotate: [{
|
|
1909
|
-
rotate: [_e,
|
|
1909
|
+
rotate: [_e, N]
|
|
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": [m]
|
|
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": [m]
|
|
1924
1924
|
}],
|
|
1925
1925
|
/**
|
|
1926
1926
|
* Skew X
|
|
@@ -1941,7 +1941,7 @@ const D = (e) => {
|
|
|
1941
1941
|
* @see https://tailwindcss.com/docs/transform-origin
|
|
1942
1942
|
*/
|
|
1943
1943
|
"transform-origin": [{
|
|
1944
|
-
origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left",
|
|
1944
|
+
origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", N]
|
|
1945
1945
|
}],
|
|
1946
1946
|
// Interactivity
|
|
1947
1947
|
/**
|
|
@@ -1963,7 +1963,7 @@ const D = (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", N]
|
|
1967
1967
|
}],
|
|
1968
1968
|
/**
|
|
1969
1969
|
* Caret Color
|
|
@@ -2185,7 +2185,7 @@ const D = (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", N]
|
|
2189
2189
|
}],
|
|
2190
2190
|
// SVG
|
|
2191
2191
|
/**
|
|
@@ -2200,7 +2200,7 @@ const D = (e) => {
|
|
|
2200
2200
|
* @see https://tailwindcss.com/docs/stroke-width
|
|
2201
2201
|
*/
|
|
2202
2202
|
"stroke-w": [{
|
|
2203
|
-
stroke: [
|
|
2203
|
+
stroke: [ue, be, qe]
|
|
2204
2204
|
}],
|
|
2205
2205
|
/**
|
|
2206
2206
|
* Stroke
|
|
@@ -2275,7 +2275,7 @@ const D = (e) => {
|
|
|
2275
2275
|
"font-size": ["leading"]
|
|
2276
2276
|
}
|
|
2277
2277
|
};
|
|
2278
|
-
}, Pn = /* @__PURE__ */
|
|
2278
|
+
}, Pn = /* @__PURE__ */ un(En);
|
|
2279
2279
|
function ro(...e) {
|
|
2280
2280
|
return Pn(Qt(e));
|
|
2281
2281
|
}
|
|
@@ -2310,10 +2310,10 @@ function tt(e) {
|
|
|
2310
2310
|
return null;
|
|
2311
2311
|
}
|
|
2312
2312
|
}
|
|
2313
|
-
function
|
|
2313
|
+
function Nn(e) {
|
|
2314
2314
|
return typeof e != "string" ? !1 : /^[\s\n]*[-*]\s|^[\s\n]*#+\s|```|^\s*\[.*\]\(|^>\s/.test(e);
|
|
2315
2315
|
}
|
|
2316
|
-
function
|
|
2316
|
+
function zn(e) {
|
|
2317
2317
|
return e.type === "image_url";
|
|
2318
2318
|
}
|
|
2319
2319
|
function Rn(e) {
|
|
@@ -2323,10 +2323,10 @@ function Ln(e) {
|
|
|
2323
2323
|
return Array.isArray(e.content) ? e.content.filter((t) => t.type === "text").map((t) => t.text).join(`
|
|
2324
2324
|
`).trim() : typeof e.content == "string" ? e.content : "";
|
|
2325
2325
|
}
|
|
2326
|
-
function Un(e) {
|
|
2327
|
-
return e.content.filter(Nn);
|
|
2328
|
-
}
|
|
2329
2326
|
function jn(e) {
|
|
2327
|
+
return e.content.filter(zn);
|
|
2328
|
+
}
|
|
2329
|
+
function Un(e) {
|
|
2330
2330
|
return e.content.filter(Rn);
|
|
2331
2331
|
}
|
|
2332
2332
|
function Mt(e) {
|
|
@@ -2399,7 +2399,7 @@ function Et(e) {
|
|
|
2399
2399
|
}
|
|
2400
2400
|
function oo(e) {
|
|
2401
2401
|
const t = Et(e);
|
|
2402
|
-
return typeof e == "string" &&
|
|
2402
|
+
return typeof e == "string" && Nn(e) ? { content: e, isMarkdown: !0 } : { content: t, isMarkdown: !1 };
|
|
2403
2403
|
}
|
|
2404
2404
|
function Fn(e) {
|
|
2405
2405
|
const t = (r) => {
|
|
@@ -2448,27 +2448,27 @@ function le(e) {
|
|
|
2448
2448
|
);
|
|
2449
2449
|
}
|
|
2450
2450
|
function nt(e) {
|
|
2451
|
-
var
|
|
2451
|
+
var x, M, A, w, b, h, T;
|
|
2452
2452
|
if (!e || typeof e != "object") return null;
|
|
2453
2453
|
const t = le(e), n = Kn(t);
|
|
2454
2454
|
if (!n)
|
|
2455
2455
|
return null;
|
|
2456
|
-
const r = t.toolCalls ?? ((
|
|
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 ?? ((M = t.additionalKwargs) == null ? void 0 : M.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(), d = t.name ?? ((A = t.additionalKwargs) == null ? void 0 : A.agentName) ?? void 0, c = t.model ?? ((w = t.additionalKwargs) == null ? void 0 : w.model) ?? void 0, l = t.toolCallId ?? void 0, f = t.additionalKwargs ?? void 0, p = t.responseMetadata ?? void 0, g = t.checkpointId ?? ((b = t.additionalKwargs) == null ? void 0 : b.checkpointId) ?? void 0, I = t.checkpointNs ?? ((h = t.additionalKwargs) == null ? void 0 : h.checkpointNs) ?? void 0, u = 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:
|
|
2463
|
+
name: d,
|
|
2464
2464
|
model: c,
|
|
2465
2465
|
toolCallId: l,
|
|
2466
2466
|
toolCalls: o,
|
|
2467
|
-
checkpointId:
|
|
2468
|
-
checkpointNs:
|
|
2469
|
-
toolStreaming:
|
|
2470
|
-
additionalKwargs:
|
|
2471
|
-
responseMetadata:
|
|
2467
|
+
checkpointId: g,
|
|
2468
|
+
checkpointNs: I,
|
|
2469
|
+
toolStreaming: u,
|
|
2470
|
+
additionalKwargs: f,
|
|
2471
|
+
responseMetadata: p,
|
|
2472
2472
|
artifact: t.artifact && typeof t.artifact == "object" && !t.artifact.type ? { ...t.artifact, type: t.name } : t.artifact ?? void 0
|
|
2473
2473
|
};
|
|
2474
2474
|
}
|
|
@@ -2504,12 +2504,12 @@ function Kn(e) {
|
|
|
2504
2504
|
const r = t.type;
|
|
2505
2505
|
return r ? r === "user" || r === "assistant" || r === "system" || r === "tool" ? r : r === "human" ? "user" : r === "ai" ? "assistant" : null : null;
|
|
2506
2506
|
}
|
|
2507
|
-
function
|
|
2507
|
+
function dt(e) {
|
|
2508
2508
|
if (!e) return null;
|
|
2509
2509
|
const t = String(e).toLowerCase();
|
|
2510
2510
|
return t === "running" || t === "pending" ? "pending" : t === "completed" || t === "success" ? "completed" : t === "error" || t === "failed" || t === "failure" ? "error" : null;
|
|
2511
2511
|
}
|
|
2512
|
-
function
|
|
2512
|
+
function ut(e) {
|
|
2513
2513
|
return (Array.isArray(e.toolCalls) ? e.toolCalls : Mt(e)).map(rt);
|
|
2514
2514
|
}
|
|
2515
2515
|
function He(e, t) {
|
|
@@ -2535,31 +2535,31 @@ function Vn(e, t) {
|
|
|
2535
2535
|
}
|
|
2536
2536
|
function qn(e, t = []) {
|
|
2537
2537
|
if (Array.isArray(e)) {
|
|
2538
|
-
const o = e.filter((a) => a.role === "assistant").flatMap((a) =>
|
|
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 = He(a.id, e) || He(a.id, t),
|
|
2540
|
+
var f, p, g;
|
|
2541
|
+
const i = He(a.id, e) || He(a.id, t), d = Array.isArray((f = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : f.toolProgress) ? (p = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : p.toolProgress : void 0, c = (i == null ? void 0 : i.artifact) ?? a.artifact, l = dt(a.status) ?? ((g = i == null ? void 0 : i.additionalKwargs) != null && g.toolStreaming ? "pending" : null) ?? (i ? "completed" : "pending");
|
|
2542
2542
|
if (i && !a.content && l === "completed") {
|
|
2543
|
-
const
|
|
2544
|
-
typeof
|
|
2543
|
+
const I = ce(i);
|
|
2544
|
+
typeof I == "string" && (a.content = I);
|
|
2545
2545
|
}
|
|
2546
2546
|
return {
|
|
2547
2547
|
call: a,
|
|
2548
2548
|
result: i,
|
|
2549
2549
|
state: l,
|
|
2550
|
-
progress:
|
|
2550
|
+
progress: d,
|
|
2551
2551
|
artifact: c
|
|
2552
2552
|
};
|
|
2553
2553
|
});
|
|
2554
2554
|
}
|
|
2555
2555
|
if (e.role !== "assistant") return [];
|
|
2556
|
-
const n =
|
|
2556
|
+
const n = ut(e);
|
|
2557
2557
|
return n.length === 0 ? [] : n.map((r) => {
|
|
2558
|
-
var
|
|
2559
|
-
const o = He(r.id, t) ?? Vn(e, r), s = Array.isArray((
|
|
2558
|
+
var d, c, l;
|
|
2559
|
+
const o = He(r.id, t) ?? Vn(e, r), s = Array.isArray((d = o == null ? void 0 : o.additionalKwargs) == null ? void 0 : d.toolProgress) ? (c = o == null ? void 0 : o.additionalKwargs) == null ? void 0 : c.toolProgress : void 0, a = (o == null ? void 0 : o.artifact) ?? r.artifact, i = dt(r.status) ?? ((l = o == null ? void 0 : o.additionalKwargs) != null && l.toolStreaming ? "pending" : null) ?? (o ? "completed" : "pending");
|
|
2560
2560
|
if (o && !r.content && i === "completed") {
|
|
2561
|
-
const
|
|
2562
|
-
typeof
|
|
2561
|
+
const f = ce(o);
|
|
2562
|
+
typeof f == "string" && (r.content = f);
|
|
2563
2563
|
}
|
|
2564
2564
|
return {
|
|
2565
2565
|
call: r,
|
|
@@ -2573,7 +2573,7 @@ function qn(e, t = []) {
|
|
|
2573
2573
|
function ao(e, t = []) {
|
|
2574
2574
|
return qn(e, t).map((n) => n.artifact).filter((n) => !!n);
|
|
2575
2575
|
}
|
|
2576
|
-
const
|
|
2576
|
+
const ze = {
|
|
2577
2577
|
authToken: "authToken",
|
|
2578
2578
|
authTokenExpiresAt: "authTokenExpiresAt",
|
|
2579
2579
|
authSessionId: "authSessionId",
|
|
@@ -2590,14 +2590,14 @@ const Qe = /* @__PURE__ */ new Set();
|
|
|
2590
2590
|
function Pt() {
|
|
2591
2591
|
return Ve;
|
|
2592
2592
|
}
|
|
2593
|
-
function
|
|
2593
|
+
function Ie(e) {
|
|
2594
2594
|
Ve = e, Qe.forEach((t) => t(e));
|
|
2595
2595
|
}
|
|
2596
2596
|
function _t(e) {
|
|
2597
2597
|
return Qe.add(e), () => Qe.delete(e);
|
|
2598
2598
|
}
|
|
2599
2599
|
const Hn = 12e4, Gn = 12e4;
|
|
2600
|
-
let Ye = Hn,
|
|
2600
|
+
let Ye = Hn, Nt = Gn;
|
|
2601
2601
|
const ne = Jt.create({
|
|
2602
2602
|
// BaseURL is set dynamically via ApiProvider -> api.updateConfig
|
|
2603
2603
|
timeout: Ye,
|
|
@@ -2608,10 +2608,10 @@ 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, ne.defaults.timeout = Ye), n !== null && (
|
|
2611
|
+
t !== null && (Ye = t, ne.defaults.timeout = Ye), n !== null && (Nt = n);
|
|
2612
2612
|
}
|
|
2613
2613
|
function Jn() {
|
|
2614
|
-
return
|
|
2614
|
+
return Nt;
|
|
2615
2615
|
}
|
|
2616
2616
|
ne.interceptors.request.use((e) => (Ve && (e.headers.Authorization = `Bearer ${Ve}`), e));
|
|
2617
2617
|
ne.interceptors.response.use(
|
|
@@ -2619,7 +2619,7 @@ ne.interceptors.response.use(
|
|
|
2619
2619
|
if (typeof window < "u" && (e != null && e.data))
|
|
2620
2620
|
try {
|
|
2621
2621
|
const t = e.data, n = t.data || {}, r = typeof t.token == "string" && t.token || typeof n.token == "string" && n.token || null, o = typeof t.expires_at == "number" && t.expires_at || typeof n.expires_at == "number" && n.expires_at || typeof t.expiresAt == "number" && t.expiresAt || typeof n.expiresAt == "number" && n.expiresAt || null;
|
|
2622
|
-
r && (localStorage.setItem(
|
|
2622
|
+
r && (localStorage.setItem(ze.authToken, r), Ie(r)), o && localStorage.setItem(ze.authTokenExpiresAt, o.toString()), (r || o) && window.dispatchEvent(
|
|
2623
2623
|
new CustomEvent("smartorg:chat-token-updated", {
|
|
2624
2624
|
detail: { token: r, expiresAt: o }
|
|
2625
2625
|
})
|
|
@@ -2660,7 +2660,7 @@ class Yn {
|
|
|
2660
2660
|
const n = t.baseUrl.replace(/\/+$/, "");
|
|
2661
2661
|
ne.defaults.baseURL = n;
|
|
2662
2662
|
}
|
|
2663
|
-
t.apiKey !== void 0 ?
|
|
2663
|
+
t.apiKey !== void 0 ? Ie(t.apiKey) : t.getToken && Ie(t.getToken()), (t.requestTimeoutMs !== void 0 || t.historyTimeoutMs !== void 0) && Wn({
|
|
2664
2664
|
requestTimeoutMs: t.requestTimeoutMs,
|
|
2665
2665
|
historyTimeoutMs: t.historyTimeoutMs
|
|
2666
2666
|
});
|
|
@@ -2670,7 +2670,7 @@ class Yn {
|
|
|
2670
2670
|
return Pt();
|
|
2671
2671
|
}
|
|
2672
2672
|
setAuthToken(t) {
|
|
2673
|
-
|
|
2673
|
+
Ie(t);
|
|
2674
2674
|
}
|
|
2675
2675
|
onTokenChange(t) {
|
|
2676
2676
|
return _t(t);
|
|
@@ -2741,7 +2741,7 @@ class Yn {
|
|
|
2741
2741
|
return ae(n);
|
|
2742
2742
|
}
|
|
2743
2743
|
}
|
|
2744
|
-
const
|
|
2744
|
+
const zt = new Yn();
|
|
2745
2745
|
class Zn {
|
|
2746
2746
|
// Config logic could go here if files ever need a distinct base URL from chat
|
|
2747
2747
|
// For now, it shares the chatBaseUrl via the shared httpClient
|
|
@@ -2820,14 +2820,14 @@ class er {
|
|
|
2820
2820
|
const n = t.baseUrl.replace(/\/+$/, "");
|
|
2821
2821
|
this._authBaseUrl = `${n}/auth`;
|
|
2822
2822
|
}
|
|
2823
|
-
t.apiKey !== void 0 ?
|
|
2823
|
+
t.apiKey !== void 0 ? Ie(t.apiKey) : t.getToken && Ie(t.getToken());
|
|
2824
2824
|
}
|
|
2825
2825
|
// ---- Token Management ----
|
|
2826
2826
|
getAuthToken() {
|
|
2827
2827
|
return Pt();
|
|
2828
2828
|
}
|
|
2829
2829
|
setAuthToken(t) {
|
|
2830
|
-
|
|
2830
|
+
Ie(t);
|
|
2831
2831
|
}
|
|
2832
2832
|
onTokenChange(t) {
|
|
2833
2833
|
return _t(t);
|
|
@@ -2840,10 +2840,10 @@ class er {
|
|
|
2840
2840
|
}
|
|
2841
2841
|
const tr = new er(), Lt = Ce(null);
|
|
2842
2842
|
function nr({ children: e, apiConfig: t }) {
|
|
2843
|
-
const n =
|
|
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(), d = t.requestTimeoutMs !== void 0 || t.historyTimeoutMs !== void 0;
|
|
2846
|
+
(t.baseUrl || t.chatBaseUrl || d) && (d || 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 d = 0; d < i; d++) a += String.fromCharCode(s[d]);
|
|
2869
2869
|
t(btoa(a));
|
|
2870
2870
|
} catch (o) {
|
|
2871
2871
|
n(o);
|
|
@@ -2931,7 +2931,7 @@ function lo(e) {
|
|
|
2931
2931
|
return `${e.id}:${t}:${n}${s ? `:${s}` : ""}`;
|
|
2932
2932
|
}
|
|
2933
2933
|
function Me() {
|
|
2934
|
-
const e =
|
|
2934
|
+
const e = je(Lt);
|
|
2935
2935
|
if (!e) throw new Error("useApi must be used within ApiProvider");
|
|
2936
2936
|
return e;
|
|
2937
2937
|
}
|
|
@@ -2945,7 +2945,7 @@ function ir(e, t, n) {
|
|
|
2945
2945
|
...n
|
|
2946
2946
|
};
|
|
2947
2947
|
}
|
|
2948
|
-
function
|
|
2948
|
+
function jt(e, t = "user") {
|
|
2949
2949
|
return typeof e == "string" ? ir(t, e) : e;
|
|
2950
2950
|
}
|
|
2951
2951
|
function cr(e) {
|
|
@@ -2957,10 +2957,10 @@ function Se(e) {
|
|
|
2957
2957
|
function lr(e) {
|
|
2958
2958
|
return Se(e) ? typeof e.id == "string" && typeof e.type == "string" && "content" in e : !1;
|
|
2959
2959
|
}
|
|
2960
|
-
function
|
|
2960
|
+
function dr(e) {
|
|
2961
2961
|
return Array.isArray(e) && e.every(lr);
|
|
2962
2962
|
}
|
|
2963
|
-
function
|
|
2963
|
+
function ur(e) {
|
|
2964
2964
|
if (!Se(e)) return {};
|
|
2965
2965
|
const t = {};
|
|
2966
2966
|
for (const [n, r] of Object.entries(e))
|
|
@@ -2974,7 +2974,7 @@ function fr(e, t) {
|
|
|
2974
2974
|
return t;
|
|
2975
2975
|
if (e === "messages/partial") {
|
|
2976
2976
|
const r = t;
|
|
2977
|
-
return
|
|
2977
|
+
return dr(r.messages) ? {
|
|
2978
2978
|
type: "messages/partial",
|
|
2979
2979
|
messages: r.messages,
|
|
2980
2980
|
seq: typeof r.seq == "number" ? r.seq : void 0,
|
|
@@ -2999,7 +2999,7 @@ function fr(e, t) {
|
|
|
2999
2999
|
const r = t;
|
|
3000
3000
|
return (r == null ? void 0 : r.type) === "messages/metadata" && Se(r.metadata) ? {
|
|
3001
3001
|
type: "messages/metadata",
|
|
3002
|
-
metadata:
|
|
3002
|
+
metadata: ur(r.metadata),
|
|
3003
3003
|
seq: typeof r.seq == "number" ? r.seq : void 0,
|
|
3004
3004
|
scope: typeof r.scope == "string" ? r.scope : void 0,
|
|
3005
3005
|
origin: r.origin === "task" ? "task" : "agent"
|
|
@@ -3009,153 +3009,153 @@ 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] = $(e.token ?? null), s =
|
|
3012
|
+
const t = e.baseUrl || "", n = e.streamPath ?? "/stream", [r, o] = $(e.token ?? null), s = G(e.headers ?? {}), a = e.credentials ?? "include", i = G(e);
|
|
3013
3013
|
X(() => {
|
|
3014
3014
|
i.current = e;
|
|
3015
3015
|
}, [e]);
|
|
3016
|
-
const
|
|
3017
|
-
var j, C, O, F,
|
|
3018
|
-
const
|
|
3019
|
-
if (!
|
|
3020
|
-
(j =
|
|
3021
|
-
}, []), [c, l] = $(!1), [
|
|
3022
|
-
o(
|
|
3016
|
+
const d = _((m) => {
|
|
3017
|
+
var j, C, O, F, P, B, z, J, U, R;
|
|
3018
|
+
const k = i.current;
|
|
3019
|
+
if (!k) return;
|
|
3020
|
+
(j = k.onEvent) == null || j.call(k, m), m.type === "thread_info" && ((C = k.onThreadInfo) == null || C.call(k, m)), m.type === "values" && ((O = k.handleValuesEvent) == null || O.call(k, m)), m.type === "metadata" && ((F = k.onMetadataEvent) == null || F.call(k, m)), typeof m.type == "string" && (m.type === "custom" || m.type.startsWith("custom.")) && ((P = k.onCustomEvent) == null || P.call(k, m)), m.type === "updates" && ((B = k.onUpdateEvent) == null || B.call(k, m)), m.type === "tool.end" ? (z = k.onToolEnd) == null || z.call(k, m) : m.type === "tool.start" && ((J = k.onToolStart) == null || J.call(k, m)), m.type === "heartbeat" && ((U = k.onHeartbeat) == null || U.call(k, m)), m.type === "token" && ((R = k.onToken) == null || R.call(k, m.token));
|
|
3021
|
+
}, []), [c, l] = $(!1), [f, p] = $(null), [g, I] = $(!1), [u, v] = $(null), x = G(null), M = G(!0), A = G(null), w = _((m) => {
|
|
3022
|
+
o(m);
|
|
3023
3023
|
}, []), b = _(() => {
|
|
3024
|
-
|
|
3024
|
+
p(null), v(null);
|
|
3025
3025
|
}, []), h = _(() => {
|
|
3026
3026
|
var C, O;
|
|
3027
3027
|
console.debug("[use-chat] stop() invoked - aborting stream");
|
|
3028
|
-
const
|
|
3028
|
+
const m = (C = A.current) == null ? void 0 : C.threadId, k = (O = A.current) == null ? void 0 : O.runId, E = () => {
|
|
3029
3029
|
var F;
|
|
3030
|
-
(F =
|
|
3030
|
+
(F = x.current) == null || F.abort(), x.current = null, A.current = null, l(!1), I(!1);
|
|
3031
3031
|
};
|
|
3032
|
-
(
|
|
3032
|
+
(k || m ? zt.cancelRun(k || m).catch((F) => {
|
|
3033
3033
|
console.warn("[use-chat] cancel run failed:", F);
|
|
3034
|
-
}) : Promise.resolve()).finally(
|
|
3034
|
+
}) : Promise.resolve()).finally(E);
|
|
3035
3035
|
}, []), T = _(
|
|
3036
|
-
(
|
|
3037
|
-
|
|
3038
|
-
const
|
|
3039
|
-
text: typeof
|
|
3040
|
-
threadId:
|
|
3041
|
-
attachments:
|
|
3042
|
-
payload:
|
|
3043
|
-
...
|
|
3044
|
-
creativityLevel:
|
|
3036
|
+
(m) => {
|
|
3037
|
+
x.current && (x.current.abort(), x.current = null);
|
|
3038
|
+
const k = {
|
|
3039
|
+
text: typeof m.content == "string" ? m.content : m.text,
|
|
3040
|
+
threadId: m.threadId,
|
|
3041
|
+
attachments: m.attachments,
|
|
3042
|
+
payload: m.payload ? {
|
|
3043
|
+
...m.payload,
|
|
3044
|
+
creativityLevel: m.payload.creativityLevel ?? "medium"
|
|
3045
3045
|
} : { creativityLevel: "medium" },
|
|
3046
|
-
config:
|
|
3047
|
-
checkpointId:
|
|
3048
|
-
checkpointNs:
|
|
3049
|
-
edit:
|
|
3050
|
-
command:
|
|
3046
|
+
config: m.config,
|
|
3047
|
+
checkpointId: m.checkpointId,
|
|
3048
|
+
checkpointNs: m.checkpointNs || void 0,
|
|
3049
|
+
edit: m.edit ?? !1,
|
|
3050
|
+
command: m.command
|
|
3051
3051
|
};
|
|
3052
|
-
l(!0),
|
|
3053
|
-
const
|
|
3054
|
-
|
|
3052
|
+
l(!0), p(null), v(null);
|
|
3053
|
+
const E = new AbortController();
|
|
3054
|
+
x.current = E;
|
|
3055
3055
|
let j = null, C = !1;
|
|
3056
|
-
return
|
|
3057
|
-
threadId:
|
|
3056
|
+
return A.current = {
|
|
3057
|
+
threadId: k.threadId ?? void 0,
|
|
3058
3058
|
runId: void 0,
|
|
3059
3059
|
// Will be updated from headers
|
|
3060
3060
|
headers: {},
|
|
3061
3061
|
isStreaming: !0
|
|
3062
3062
|
}, (async () => {
|
|
3063
|
-
var O, F,
|
|
3063
|
+
var O, F, P, B, z, J;
|
|
3064
3064
|
try {
|
|
3065
|
-
let
|
|
3065
|
+
let U = {};
|
|
3066
3066
|
try {
|
|
3067
3067
|
if (r)
|
|
3068
|
-
|
|
3068
|
+
U = { Authorization: `Bearer ${r}` };
|
|
3069
3069
|
else if (typeof window < "u") {
|
|
3070
|
-
const te = window.__AUTH_TOKEN__, ke = ((O = window.localStorage) == null ? void 0 : O.getItem(
|
|
3070
|
+
const te = window.__AUTH_TOKEN__, ke = ((O = window.localStorage) == null ? void 0 : O.getItem(ze.authToken)) || null;
|
|
3071
3071
|
let Q = null;
|
|
3072
3072
|
try {
|
|
3073
|
-
const ge = (F = window.localStorage) == null ? void 0 : F.getItem(
|
|
3074
|
-
ge && (Q = ((
|
|
3073
|
+
const ge = (F = window.localStorage) == null ? void 0 : F.getItem(ze.chatSettings);
|
|
3074
|
+
ge && (Q = ((P = JSON.parse(ge)) == null ? void 0 : P.apiKey) || null);
|
|
3075
3075
|
} catch {
|
|
3076
3076
|
}
|
|
3077
3077
|
const Z = te || ke || Q || null;
|
|
3078
|
-
Z && (
|
|
3078
|
+
Z && (U = { Authorization: `Bearer ${Z}` });
|
|
3079
3079
|
}
|
|
3080
3080
|
} catch {
|
|
3081
3081
|
}
|
|
3082
3082
|
console.debug("[use-chat] POST", t + n);
|
|
3083
|
-
let
|
|
3083
|
+
let R = {};
|
|
3084
3084
|
if (typeof window < "u")
|
|
3085
3085
|
try {
|
|
3086
|
-
const
|
|
3087
|
-
|
|
3086
|
+
const H = (B = window.localStorage) == null ? void 0 : B.getItem(ze.authSessionId);
|
|
3087
|
+
H && (R = { "X-Session-Id": H });
|
|
3088
3088
|
} catch {
|
|
3089
3089
|
}
|
|
3090
|
-
const
|
|
3091
|
-
...
|
|
3092
|
-
...
|
|
3090
|
+
const q = {
|
|
3091
|
+
...U,
|
|
3092
|
+
...R,
|
|
3093
3093
|
...s.current
|
|
3094
3094
|
}, y = {
|
|
3095
3095
|
"Content-Type": "application/json",
|
|
3096
3096
|
Accept: "text/event-stream",
|
|
3097
|
-
...
|
|
3098
|
-
},
|
|
3097
|
+
...q
|
|
3098
|
+
}, L = await fetch(t + n, {
|
|
3099
3099
|
method: "POST",
|
|
3100
3100
|
headers: y,
|
|
3101
|
-
body: JSON.stringify(
|
|
3102
|
-
signal:
|
|
3101
|
+
body: JSON.stringify(k),
|
|
3102
|
+
signal: E.signal,
|
|
3103
3103
|
credentials: a
|
|
3104
3104
|
});
|
|
3105
|
-
if (
|
|
3106
|
-
const
|
|
3105
|
+
if (A.current && (A.current.headers = q), !L.ok || !L.body) {
|
|
3106
|
+
const H = await L.text().catch(() => "");
|
|
3107
3107
|
console.debug(
|
|
3108
3108
|
"[use-chat] non-OK response",
|
|
3109
|
-
|
|
3110
|
-
|
|
3109
|
+
L.status,
|
|
3110
|
+
H == null ? void 0 : H.slice(0, 500)
|
|
3111
3111
|
);
|
|
3112
|
-
const te = `stream ${
|
|
3113
|
-
throw te && (
|
|
3112
|
+
const te = `stream ${L.status}${H ? ": " + H : ""}`;
|
|
3113
|
+
throw te && (p(te), j = "error"), new Error(te);
|
|
3114
3114
|
}
|
|
3115
|
-
|
|
3116
|
-
const S =
|
|
3117
|
-
let
|
|
3115
|
+
I(!0);
|
|
3116
|
+
const S = L.body.getReader(), W = new TextDecoder();
|
|
3117
|
+
let K = "", V = 0, ee = Date.now();
|
|
3118
3118
|
const re = setInterval(() => {
|
|
3119
|
-
Date.now() - ee > 18e5 && (
|
|
3120
|
-
}, 5e3),
|
|
3119
|
+
Date.now() - ee > 18e5 && (p("Stream idle timeout"), j = "error", E.abort());
|
|
3120
|
+
}, 5e3), de = 1024 * 1024;
|
|
3121
3121
|
try {
|
|
3122
|
-
const
|
|
3123
|
-
for (
|
|
3124
|
-
...
|
|
3125
|
-
threadId:
|
|
3126
|
-
runId: te ??
|
|
3122
|
+
const H = L.headers.get("X-Thread-Id") || L.headers.get("x-thread-id"), te = L.headers.get("X-Run-Id") || L.headers.get("x-run-id");
|
|
3123
|
+
for (A.current && (A.current = {
|
|
3124
|
+
...A.current,
|
|
3125
|
+
threadId: H ?? A.current.threadId,
|
|
3126
|
+
runId: te ?? A.current.runId
|
|
3127
3127
|
}); ; ) {
|
|
3128
3128
|
const { value: ke, done: Q } = await S.read();
|
|
3129
3129
|
if (Q) break;
|
|
3130
|
-
|
|
3130
|
+
K += W.decode(ke, { stream: !0 }), K.length > de && (K = "", console.warn("Stream buffer reset: exceeded 1MB"));
|
|
3131
3131
|
let Z;
|
|
3132
|
-
for (; (Z =
|
|
3132
|
+
for (; (Z = K.indexOf(`
|
|
3133
3133
|
|
|
3134
3134
|
`)) >= 0; ) {
|
|
3135
|
-
const ge =
|
|
3136
|
-
|
|
3137
|
-
const
|
|
3135
|
+
const ge = K.slice(0, Z);
|
|
3136
|
+
K = K.slice(Z + 2);
|
|
3137
|
+
const Ue = ge.split(/\r?\n/), Be = [];
|
|
3138
3138
|
let me = null;
|
|
3139
|
-
for (const he of
|
|
3139
|
+
for (const he of Ue)
|
|
3140
3140
|
if (!he.startsWith(":") && he) {
|
|
3141
3141
|
if (he.startsWith("event:")) {
|
|
3142
|
-
const
|
|
3143
|
-
|
|
3142
|
+
const Ae = he.slice(6).trim();
|
|
3143
|
+
Ae && (me = Ae);
|
|
3144
3144
|
continue;
|
|
3145
3145
|
}
|
|
3146
3146
|
if (he.startsWith("data:")) {
|
|
3147
|
-
const
|
|
3148
|
-
Be.push(
|
|
3147
|
+
const Ae = he.slice(5);
|
|
3148
|
+
Be.push(Ae.startsWith(" ") ? Ae.slice(1) : Ae);
|
|
3149
3149
|
}
|
|
3150
3150
|
}
|
|
3151
|
-
const
|
|
3151
|
+
const ve = Be.join(`
|
|
3152
3152
|
`);
|
|
3153
|
-
if (!
|
|
3153
|
+
if (!ve) continue;
|
|
3154
3154
|
let oe;
|
|
3155
3155
|
try {
|
|
3156
|
-
oe = JSON.parse(
|
|
3156
|
+
oe = JSON.parse(ve);
|
|
3157
3157
|
} catch {
|
|
3158
|
-
console.debug("[use-chat] malformed SSE:",
|
|
3158
|
+
console.debug("[use-chat] malformed SSE:", ve.slice(0, 200));
|
|
3159
3159
|
continue;
|
|
3160
3160
|
}
|
|
3161
3161
|
oe = fr(me, oe);
|
|
@@ -3164,26 +3164,26 @@ function pr(e = {}) {
|
|
|
3164
3164
|
console.warn("[use-chat] dropped envelope event without payload", oe);
|
|
3165
3165
|
continue;
|
|
3166
3166
|
}
|
|
3167
|
-
const
|
|
3167
|
+
const xe = $n(Pe);
|
|
3168
3168
|
ee = Date.now();
|
|
3169
|
-
const ye = typeof
|
|
3169
|
+
const ye = typeof xe.seq == "number" ? xe.seq : void 0;
|
|
3170
3170
|
if (ye !== void 0) {
|
|
3171
|
-
if (ye <=
|
|
3172
|
-
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: ye, lastProcessedSeq:
|
|
3171
|
+
if (ye <= V) {
|
|
3172
|
+
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: ye, lastProcessedSeq: V, type: xe.type });
|
|
3173
3173
|
continue;
|
|
3174
3174
|
}
|
|
3175
|
-
|
|
3175
|
+
V = ye;
|
|
3176
3176
|
}
|
|
3177
|
-
|
|
3177
|
+
d(xe);
|
|
3178
3178
|
}
|
|
3179
3179
|
}
|
|
3180
|
-
j === null && !
|
|
3181
|
-
} catch (
|
|
3182
|
-
if (
|
|
3180
|
+
j === null && !E.signal.aborted && (j = "complete");
|
|
3181
|
+
} catch (H) {
|
|
3182
|
+
if (H.name === "AbortError")
|
|
3183
3183
|
j = j ?? "aborted";
|
|
3184
3184
|
else {
|
|
3185
|
-
const te =
|
|
3186
|
-
j = "error",
|
|
3185
|
+
const te = H.message || String(H);
|
|
3186
|
+
j = "error", p(te);
|
|
3187
3187
|
}
|
|
3188
3188
|
} finally {
|
|
3189
3189
|
try {
|
|
@@ -3194,59 +3194,59 @@ function pr(e = {}) {
|
|
|
3194
3194
|
}
|
|
3195
3195
|
clearInterval(re);
|
|
3196
3196
|
}
|
|
3197
|
-
} catch (
|
|
3198
|
-
if (
|
|
3197
|
+
} catch (U) {
|
|
3198
|
+
if (U.name === "AbortError")
|
|
3199
3199
|
j = j ?? "aborted";
|
|
3200
3200
|
else {
|
|
3201
|
-
const
|
|
3202
|
-
j = "error",
|
|
3201
|
+
const R = U.message || String(U);
|
|
3202
|
+
j = "error", p(R), C || (C = !0, (J = e.onConnectionError) == null || J.call(e, R));
|
|
3203
3203
|
}
|
|
3204
3204
|
} finally {
|
|
3205
3205
|
try {
|
|
3206
3206
|
if (e.onFinish) {
|
|
3207
|
-
const
|
|
3207
|
+
const U = {
|
|
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(U);
|
|
3215
3215
|
}
|
|
3216
|
-
} catch (
|
|
3217
|
-
console.warn("[use-chat] onClosed callback failed",
|
|
3216
|
+
} catch (U) {
|
|
3217
|
+
console.warn("[use-chat] onClosed callback failed", U);
|
|
3218
3218
|
}
|
|
3219
|
-
l(!1),
|
|
3219
|
+
l(!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, d]
|
|
3224
3224
|
);
|
|
3225
3225
|
return X(() => () => {
|
|
3226
|
-
var
|
|
3227
|
-
M.current = !1, (
|
|
3226
|
+
var m;
|
|
3227
|
+
M.current = !1, (m = x.current) == null || m.abort();
|
|
3228
3228
|
}, []), {
|
|
3229
3229
|
isStreaming: c,
|
|
3230
|
-
error:
|
|
3230
|
+
error: f,
|
|
3231
3231
|
assistantText: "",
|
|
3232
3232
|
// Deprecated: use messages from reducer
|
|
3233
|
-
activeMessageId:
|
|
3233
|
+
activeMessageId: u,
|
|
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: g,
|
|
3240
3240
|
stream: T,
|
|
3241
3241
|
stop: h,
|
|
3242
3242
|
clear: b,
|
|
3243
|
-
setToken:
|
|
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: f ? "error" : c ? g ? "connected" : "connecting" : "idle",
|
|
3250
3250
|
messages: [],
|
|
3251
3251
|
// useStream doesn't maintain messages, use useChatSession instead
|
|
3252
3252
|
submit: T
|
|
@@ -3259,75 +3259,75 @@ function gr({
|
|
|
3259
3259
|
onThreadChange: r,
|
|
3260
3260
|
onCurrentThreadDeleted: o
|
|
3261
3261
|
}) {
|
|
3262
|
-
const [s, a] = $([]), [i,
|
|
3262
|
+
const [s, a] = $([]), [i, d] = $(t), [c, l] = $(!1), [f, p] = $(null), g = G(i), I = G(/* @__PURE__ */ new Map());
|
|
3263
3263
|
X(() => {
|
|
3264
|
-
|
|
3264
|
+
g.current = i;
|
|
3265
3265
|
}, [i]), X(() => {
|
|
3266
|
-
t !== void 0 && t !==
|
|
3266
|
+
t !== void 0 && t !== g.current && d(t);
|
|
3267
3267
|
}, [t]);
|
|
3268
|
-
const
|
|
3269
|
-
l(!0),
|
|
3268
|
+
const u = _(async () => {
|
|
3269
|
+
l(!0), p(null);
|
|
3270
3270
|
try {
|
|
3271
3271
|
const b = await e.listThreads();
|
|
3272
3272
|
a(b ?? []);
|
|
3273
3273
|
} catch (b) {
|
|
3274
3274
|
const h = String(b);
|
|
3275
|
-
|
|
3275
|
+
p(h), n == null || n(h);
|
|
3276
3276
|
} finally {
|
|
3277
3277
|
l(!1);
|
|
3278
3278
|
}
|
|
3279
3279
|
}, [e, n]);
|
|
3280
3280
|
X(() => {
|
|
3281
|
-
|
|
3282
|
-
}, [
|
|
3281
|
+
u();
|
|
3282
|
+
}, [u]), X(() => {
|
|
3283
3283
|
r == null || r(i);
|
|
3284
3284
|
}, [i, r]);
|
|
3285
|
-
const
|
|
3285
|
+
const v = _(
|
|
3286
3286
|
async (b, h) => {
|
|
3287
3287
|
try {
|
|
3288
|
-
const T = h && typeof h == "object" ? { id: h.id, name: h.name ?? "" } : void 0,
|
|
3289
|
-
return
|
|
3288
|
+
const T = h && typeof h == "object" ? { id: h.id, name: h.name ?? "" } : void 0, m = await e.createThread(b, T);
|
|
3289
|
+
return d(m.threadId), await u(), m.threadId;
|
|
3290
3290
|
} catch (T) {
|
|
3291
|
-
const
|
|
3292
|
-
return n == null || n(
|
|
3291
|
+
const m = String(T);
|
|
3292
|
+
return n == null || n(m), null;
|
|
3293
3293
|
}
|
|
3294
3294
|
},
|
|
3295
|
-
[e, n,
|
|
3296
|
-
),
|
|
3295
|
+
[e, n, u]
|
|
3296
|
+
), x = _(
|
|
3297
3297
|
async (b) => {
|
|
3298
3298
|
const h = s;
|
|
3299
|
-
a((
|
|
3299
|
+
a((m) => m.filter((k) => k.threadId !== b));
|
|
3300
3300
|
const T = new AbortController();
|
|
3301
|
-
|
|
3301
|
+
I.current.set(b, T);
|
|
3302
3302
|
try {
|
|
3303
|
-
await e.deleteThread(b),
|
|
3304
|
-
} catch (
|
|
3303
|
+
await e.deleteThread(b), g.current === b && (d(null), o == null || o());
|
|
3304
|
+
} catch (m) {
|
|
3305
3305
|
a(h);
|
|
3306
|
-
const
|
|
3307
|
-
n == null || n(
|
|
3306
|
+
const k = String(m);
|
|
3307
|
+
n == null || n(k);
|
|
3308
3308
|
} finally {
|
|
3309
|
-
|
|
3309
|
+
I.current.delete(b);
|
|
3310
3310
|
}
|
|
3311
3311
|
},
|
|
3312
3312
|
[e, o, n, s]
|
|
3313
3313
|
), M = _(
|
|
3314
3314
|
async (b, h) => {
|
|
3315
3315
|
try {
|
|
3316
|
-
await e.updateThread(b, h), await
|
|
3316
|
+
await e.updateThread(b, h), await u();
|
|
3317
3317
|
} catch (T) {
|
|
3318
3318
|
n == null || n(String(T));
|
|
3319
3319
|
}
|
|
3320
3320
|
},
|
|
3321
|
-
[e, n,
|
|
3322
|
-
),
|
|
3321
|
+
[e, n, u]
|
|
3322
|
+
), A = Y(
|
|
3323
3323
|
() => ({
|
|
3324
|
-
createThread:
|
|
3325
|
-
deleteThread:
|
|
3324
|
+
createThread: v,
|
|
3325
|
+
deleteThread: x,
|
|
3326
3326
|
renameThread: M,
|
|
3327
|
-
refreshThreads:
|
|
3327
|
+
refreshThreads: u
|
|
3328
3328
|
}),
|
|
3329
|
-
[
|
|
3330
|
-
),
|
|
3329
|
+
[v, x, M, u]
|
|
3330
|
+
), w = _((b) => {
|
|
3331
3331
|
if (!(b != null && b.threadId)) return;
|
|
3332
3332
|
const h = {
|
|
3333
3333
|
threadId: b.threadId,
|
|
@@ -3338,29 +3338,29 @@ function gr({
|
|
|
3338
3338
|
messageCount: b.messageCount ?? 1
|
|
3339
3339
|
};
|
|
3340
3340
|
a((T) => {
|
|
3341
|
-
let
|
|
3342
|
-
const
|
|
3343
|
-
...
|
|
3344
|
-
title: h.title ??
|
|
3345
|
-
project: h.project ??
|
|
3346
|
-
updatedAt: h.updatedAt ??
|
|
3347
|
-
messageCount: h.messageCount ??
|
|
3348
|
-
}) :
|
|
3349
|
-
return
|
|
3341
|
+
let m = !1;
|
|
3342
|
+
const k = T.map((E) => E.threadId === h.threadId ? (m = !0, console.debug("[useThreadsState] thread_info: updating existing thread", h.threadId), {
|
|
3343
|
+
...E,
|
|
3344
|
+
title: h.title ?? E.title,
|
|
3345
|
+
project: h.project ?? E.project,
|
|
3346
|
+
updatedAt: h.updatedAt ?? E.updatedAt,
|
|
3347
|
+
messageCount: h.messageCount ?? E.messageCount
|
|
3348
|
+
}) : E);
|
|
3349
|
+
return m ? k : (console.debug("[useThreadsState] thread_info: adding thread to list", h.threadId), [h, ...T]);
|
|
3350
3350
|
});
|
|
3351
3351
|
}, []);
|
|
3352
3352
|
return {
|
|
3353
3353
|
threads: s,
|
|
3354
3354
|
currentThreadId: i,
|
|
3355
|
-
currentThreadIdRef:
|
|
3356
|
-
setCurrentThreadId:
|
|
3355
|
+
currentThreadIdRef: g,
|
|
3356
|
+
setCurrentThreadId: d,
|
|
3357
3357
|
isLoadingThreads: c,
|
|
3358
|
-
threadsError:
|
|
3359
|
-
actions:
|
|
3360
|
-
addThreadFromEvent:
|
|
3358
|
+
threadsError: f,
|
|
3359
|
+
actions: A,
|
|
3360
|
+
addThreadFromEvent: w
|
|
3361
3361
|
};
|
|
3362
3362
|
}
|
|
3363
|
-
const
|
|
3363
|
+
const Ut = Ce(null);
|
|
3364
3364
|
function mr({
|
|
3365
3365
|
children: e,
|
|
3366
3366
|
initialThreadId: t = null,
|
|
@@ -3371,42 +3371,42 @@ function mr({
|
|
|
3371
3371
|
threads: s,
|
|
3372
3372
|
currentThreadId: a,
|
|
3373
3373
|
setCurrentThreadId: i,
|
|
3374
|
-
currentThreadIdRef:
|
|
3374
|
+
currentThreadIdRef: d,
|
|
3375
3375
|
isLoadingThreads: c,
|
|
3376
3376
|
threadsError: l,
|
|
3377
|
-
actions:
|
|
3378
|
-
addThreadFromEvent:
|
|
3377
|
+
actions: f,
|
|
3378
|
+
addThreadFromEvent: p
|
|
3379
3379
|
} = gr({
|
|
3380
3380
|
api: o,
|
|
3381
3381
|
initialThreadId: t,
|
|
3382
3382
|
onError: n,
|
|
3383
3383
|
onThreadChange: r
|
|
3384
|
-
}),
|
|
3384
|
+
}), g = Y(
|
|
3385
3385
|
() => ({
|
|
3386
3386
|
threads: s,
|
|
3387
3387
|
currentThreadId: a,
|
|
3388
3388
|
setCurrentThreadId: i,
|
|
3389
|
-
currentThreadIdRef:
|
|
3389
|
+
currentThreadIdRef: d,
|
|
3390
3390
|
isLoading: c,
|
|
3391
3391
|
error: l,
|
|
3392
|
-
actions:
|
|
3393
|
-
addThreadFromEvent:
|
|
3392
|
+
actions: f,
|
|
3393
|
+
addThreadFromEvent: p
|
|
3394
3394
|
}),
|
|
3395
3395
|
[
|
|
3396
3396
|
s,
|
|
3397
3397
|
a,
|
|
3398
3398
|
i,
|
|
3399
|
-
|
|
3399
|
+
d,
|
|
3400
3400
|
c,
|
|
3401
3401
|
l,
|
|
3402
|
-
|
|
3403
|
-
|
|
3402
|
+
f,
|
|
3403
|
+
p
|
|
3404
3404
|
]
|
|
3405
3405
|
);
|
|
3406
|
-
return /* @__PURE__ */ ie(
|
|
3406
|
+
return /* @__PURE__ */ ie(Ut.Provider, { value: g, children: e });
|
|
3407
3407
|
}
|
|
3408
3408
|
function ot(e) {
|
|
3409
|
-
const t =
|
|
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;
|
|
3412
3412
|
}
|
|
@@ -3484,7 +3484,19 @@ function wr(e, t) {
|
|
|
3484
3484
|
messages: Oe(((n = t.payload) == null ? void 0 : n.messages) ?? [])
|
|
3485
3485
|
};
|
|
3486
3486
|
case "user_message": {
|
|
3487
|
-
const { message: r } = t.payload;
|
|
3487
|
+
const { message: r, editingMessageId: o } = t.payload;
|
|
3488
|
+
if (o) {
|
|
3489
|
+
const s = e.messages.findIndex((a) => a.id === o);
|
|
3490
|
+
if (s !== -1)
|
|
3491
|
+
return {
|
|
3492
|
+
...e,
|
|
3493
|
+
status: "streaming",
|
|
3494
|
+
messages: [...e.messages.slice(0, s), r],
|
|
3495
|
+
assemblingId: null,
|
|
3496
|
+
lastCheckpointId: null,
|
|
3497
|
+
error: null
|
|
3498
|
+
};
|
|
3499
|
+
}
|
|
3488
3500
|
return {
|
|
3489
3501
|
...e,
|
|
3490
3502
|
status: "streaming",
|
|
@@ -3523,7 +3535,7 @@ function wr(e, t) {
|
|
|
3523
3535
|
}
|
|
3524
3536
|
}
|
|
3525
3537
|
function kr(e = []) {
|
|
3526
|
-
const [t, n] = Wt(wr, { ...Ot, messages: e }), r =
|
|
3538
|
+
const [t, n] = Wt(wr, { ...Ot, messages: e }), r = G([]), o = G(null), s = _(() => {
|
|
3527
3539
|
o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), o.current = null;
|
|
3528
3540
|
const c = r.current;
|
|
3529
3541
|
c.length && (r.current = [], n({ type: "batch", payload: { events: c } }));
|
|
@@ -3531,14 +3543,14 @@ function kr(e = []) {
|
|
|
3531
3543
|
typeof window < "u" && typeof window.requestAnimationFrame == "function" ? o.current === null && (o.current = window.requestAnimationFrame(() => s())) : setTimeout(s, 8);
|
|
3532
3544
|
}, [s]), i = _((c) => {
|
|
3533
3545
|
r.current.push(c), a();
|
|
3534
|
-
}, [a]),
|
|
3546
|
+
}, [a]), d = Y(() => ({
|
|
3535
3547
|
setStatus: (c, l) => n({ type: "status", payload: { status: c, error: l } }),
|
|
3536
3548
|
reset: (c) => n({ type: "reset", payload: { messages: c } }),
|
|
3537
3549
|
seed: (c, l) => n({ type: "seed", payload: { messages: c, ...l ?? {} } }),
|
|
3538
3550
|
pushUser: (c, l) => n({ type: "user_message", payload: { message: c, editingMessageId: l } }),
|
|
3539
3551
|
onEvent: i
|
|
3540
3552
|
}), [i]);
|
|
3541
|
-
return { state: t, dispatch: n, ...
|
|
3553
|
+
return { state: t, dispatch: n, ...d };
|
|
3542
3554
|
}
|
|
3543
3555
|
function pt(e, t) {
|
|
3544
3556
|
const n = t.origin, r = t.scope, o = n === "task" || typeof r == "string" && r.startsWith("tools:");
|
|
@@ -3570,34 +3582,49 @@ function pt(e, t) {
|
|
|
3570
3582
|
};
|
|
3571
3583
|
return { ...e, status: "error", error: t.message, messages: [...e.messages, s] };
|
|
3572
3584
|
}
|
|
3573
|
-
if (t.type === "values"
|
|
3574
|
-
const s = t, a =
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3585
|
+
if (t.type === "values") {
|
|
3586
|
+
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 : [];
|
|
3587
|
+
if (!i.length && Object.keys(a).length === 0)
|
|
3588
|
+
return e;
|
|
3589
|
+
const d = Oe(i);
|
|
3590
|
+
delete a.messages;
|
|
3591
|
+
let c = e.lastCheckpointId, l = e.lastCheckpointNs;
|
|
3592
|
+
const f = s.config || s.checkpoint, p = (f == null ? void 0 : f.configurable) || f;
|
|
3593
|
+
if ((p != null && p.checkpoint_id || p != null && p.checkpointId) && (c = p.checkpoint_id || p.checkpointId, l = p.checkpoint_ns || p.checkpointNs || null), !c) {
|
|
3594
|
+
for (let u = d.length - 1; u >= 0; u--)
|
|
3595
|
+
if (d[u].checkpointId) {
|
|
3596
|
+
c = d[u].checkpointId, l = d[u].checkpointNs ?? null;
|
|
3597
|
+
break;
|
|
3598
|
+
}
|
|
3599
|
+
}
|
|
3600
|
+
const g = s.interrupts || a.__interrupt__ || a.interrupts, I = Array.isArray(g) && g.length > 0 ? {
|
|
3601
|
+
id: g[0].id || "native-interrupt",
|
|
3602
|
+
value: g[0].value || g[0],
|
|
3603
|
+
alternatives: g[0].alternatives
|
|
3578
3604
|
} : null;
|
|
3579
3605
|
if (o) {
|
|
3580
|
-
const
|
|
3606
|
+
const u = typeof r == "string" && r.length > 0 ? r : "task";
|
|
3581
3607
|
return {
|
|
3582
3608
|
...e,
|
|
3583
|
-
taskMessagesByScope: { ...e.taskMessagesByScope, [
|
|
3609
|
+
taskMessagesByScope: { ...e.taskMessagesByScope, [u]: d },
|
|
3584
3610
|
assemblingId: null
|
|
3585
|
-
// Clear streaming state when finalized
|
|
3586
3611
|
};
|
|
3587
3612
|
}
|
|
3588
3613
|
return {
|
|
3589
3614
|
...e,
|
|
3590
|
-
status:
|
|
3591
|
-
messages:
|
|
3615
|
+
status: I ? "awaiting_input" : e.status === "streaming" ? "idle" : e.status,
|
|
3616
|
+
messages: d,
|
|
3592
3617
|
assemblingId: null,
|
|
3593
|
-
|
|
3594
|
-
|
|
3618
|
+
lastCheckpointId: c,
|
|
3619
|
+
lastCheckpointNs: l,
|
|
3620
|
+
pendingInterrupt: I,
|
|
3621
|
+
values: { ...e.values, ...a }
|
|
3595
3622
|
};
|
|
3596
3623
|
}
|
|
3597
3624
|
if (t.type === "messages/metadata") {
|
|
3598
3625
|
const s = { ...e.messagesStreamMeta ?? {} }, a = t.metadata;
|
|
3599
|
-
return a && typeof a == "object" && Object.entries(a).forEach(([i,
|
|
3600
|
-
const c =
|
|
3626
|
+
return a && typeof a == "object" && Object.entries(a).forEach(([i, d]) => {
|
|
3627
|
+
const c = d == null ? void 0 : d.metadata;
|
|
3601
3628
|
if (!c || typeof c != "object") return;
|
|
3602
3629
|
const l = s[i] ?? {};
|
|
3603
3630
|
s[i] = {
|
|
@@ -3619,55 +3646,55 @@ function pt(e, t) {
|
|
|
3619
3646
|
origin: t.origin
|
|
3620
3647
|
}] : []
|
|
3621
3648
|
};
|
|
3622
|
-
return
|
|
3649
|
+
return Ir(e, s, o);
|
|
3623
3650
|
}
|
|
3624
|
-
return t.type === "message.start" ? { ...e, assemblingId: t.id, status: "streaming" } : t.type === "message.end" ? { ...e, assemblingId: null } : t.type === "tool.start" ? { ...
|
|
3651
|
+
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;
|
|
3625
3652
|
}
|
|
3626
|
-
function
|
|
3627
|
-
var
|
|
3653
|
+
function Ir(e, t, n) {
|
|
3654
|
+
var g, I, u, v, x, M, A;
|
|
3628
3655
|
const r = t.messages;
|
|
3629
3656
|
if (!r.length)
|
|
3630
3657
|
return console.warn("[messagesReducer] Dropping messages/partial event without messages[]", t), e;
|
|
3631
|
-
const o = r.find((
|
|
3658
|
+
const o = r.find((w) => w.type === "ai" || w.type === "assistant" || w.role === "assistant");
|
|
3632
3659
|
if (!o) return e;
|
|
3633
|
-
const s = o.id, a = o.content ?? "", i = typeof a == "string" ? [{ type: "text", text: a }] : Array.isArray(a) ? a.map((
|
|
3634
|
-
let
|
|
3635
|
-
const
|
|
3660
|
+
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)) : [], d = i.filter((w) => w.type === "text").map((w) => w.text).join(""), c = e.assemblingId !== s, l = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3661
|
+
let f = n ? [...e.taskMessagesByScope[l] || []] : [...e.messages];
|
|
3662
|
+
const p = (I = (g = e.messagesStreamMeta) == null ? void 0 : g[s]) == null ? void 0 : I.metadata;
|
|
3636
3663
|
if (c) {
|
|
3637
|
-
const
|
|
3664
|
+
const w = nt({
|
|
3638
3665
|
...o,
|
|
3639
3666
|
role: "assistant",
|
|
3640
3667
|
content: i,
|
|
3641
3668
|
scope: t.scope,
|
|
3642
3669
|
origin: t.origin,
|
|
3643
|
-
responseMetadata: { ...
|
|
3670
|
+
responseMetadata: { ...p, ...o.responseMetadata ?? {} }
|
|
3644
3671
|
});
|
|
3645
|
-
|
|
3672
|
+
w && f.push(w);
|
|
3646
3673
|
} else {
|
|
3647
|
-
const
|
|
3648
|
-
if (
|
|
3649
|
-
const b =
|
|
3650
|
-
|
|
3674
|
+
const w = f.findIndex((b) => b.id === s);
|
|
3675
|
+
if (w !== -1) {
|
|
3676
|
+
const b = f[w];
|
|
3677
|
+
f[w] = {
|
|
3651
3678
|
...b,
|
|
3652
3679
|
content: i,
|
|
3653
3680
|
scope: t.scope ?? b.scope,
|
|
3654
3681
|
origin: t.origin ?? b.origin,
|
|
3655
|
-
responseMetadata: { ...
|
|
3682
|
+
responseMetadata: { ...p, ...b.responseMetadata, ...o.responseMetadata ?? {} }
|
|
3656
3683
|
};
|
|
3657
3684
|
}
|
|
3658
3685
|
}
|
|
3659
3686
|
return {
|
|
3660
3687
|
...e,
|
|
3661
3688
|
status: "streaming",
|
|
3662
|
-
messages: n ? e.messages :
|
|
3663
|
-
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [l]:
|
|
3689
|
+
messages: n ? e.messages : f,
|
|
3690
|
+
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [l]: f } : e.taskMessagesByScope,
|
|
3664
3691
|
assemblingId: s,
|
|
3665
3692
|
messagesStreamMeta: {
|
|
3666
3693
|
...e.messagesStreamMeta ?? {},
|
|
3667
3694
|
[s]: {
|
|
3668
|
-
...((
|
|
3669
|
-
lastSeq: t.seq ?? ((
|
|
3670
|
-
lastText:
|
|
3695
|
+
...((u = e.messagesStreamMeta) == null ? void 0 : u[s]) ?? {},
|
|
3696
|
+
lastSeq: t.seq ?? ((x = (v = e.messagesStreamMeta) == null ? void 0 : v[s]) == null ? void 0 : x.lastSeq) ?? null,
|
|
3697
|
+
lastText: d || (((A = (M = e.messagesStreamMeta) == null ? void 0 : M[s]) == null ? void 0 : A.lastText) ?? "")
|
|
3671
3698
|
}
|
|
3672
3699
|
}
|
|
3673
3700
|
};
|
|
@@ -3682,19 +3709,19 @@ function st(e, t) {
|
|
|
3682
3709
|
}
|
|
3683
3710
|
return -1;
|
|
3684
3711
|
}
|
|
3685
|
-
function
|
|
3712
|
+
function vr(e, t, n) {
|
|
3686
3713
|
const r = t.id || t.callId;
|
|
3687
3714
|
if (!r) return e;
|
|
3688
3715
|
const o = t.name || "tool", s = `Starting ${o}...`, a = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3689
|
-
let i = n ? [...e.taskMessagesByScope[a] || []] : [...e.messages],
|
|
3690
|
-
if (
|
|
3716
|
+
let i = n ? [...e.taskMessagesByScope[a] || []] : [...e.messages], d = st(i, r);
|
|
3717
|
+
if (d === -1) {
|
|
3691
3718
|
for (let c = i.length - 1; c >= 0; c--)
|
|
3692
3719
|
if (i[c].role === "assistant") {
|
|
3693
|
-
|
|
3720
|
+
d = c;
|
|
3694
3721
|
break;
|
|
3695
3722
|
}
|
|
3696
3723
|
}
|
|
3697
|
-
if (
|
|
3724
|
+
if (d === -1) {
|
|
3698
3725
|
const c = {
|
|
3699
3726
|
id: `assistant-${r}`,
|
|
3700
3727
|
role: "assistant",
|
|
@@ -3704,17 +3731,17 @@ function Ir(e, t, n) {
|
|
|
3704
3731
|
scope: t.scope,
|
|
3705
3732
|
origin: t.origin
|
|
3706
3733
|
};
|
|
3707
|
-
i.push(c),
|
|
3734
|
+
i.push(c), d = i.length - 1;
|
|
3708
3735
|
}
|
|
3709
|
-
if (
|
|
3710
|
-
const c = i[
|
|
3711
|
-
|
|
3736
|
+
if (d !== -1) {
|
|
3737
|
+
const c = i[d], l = [...c.toolCalls || []], f = l.findIndex((p) => p.id === r);
|
|
3738
|
+
f >= 0 ? l[f] = { ...l[f], status: "running", content: s } : l.push({
|
|
3712
3739
|
id: r,
|
|
3713
3740
|
name: o,
|
|
3714
3741
|
args: t.args || {},
|
|
3715
3742
|
status: "running",
|
|
3716
3743
|
content: s
|
|
3717
|
-
}), i[
|
|
3744
|
+
}), i[d] = {
|
|
3718
3745
|
...c,
|
|
3719
3746
|
toolCalls: l,
|
|
3720
3747
|
scope: t.scope ?? c.scope,
|
|
@@ -3727,15 +3754,15 @@ function Ir(e, t, n) {
|
|
|
3727
3754
|
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [a]: i } : e.taskMessagesByScope
|
|
3728
3755
|
};
|
|
3729
3756
|
}
|
|
3730
|
-
function
|
|
3757
|
+
function xr(e, t, n) {
|
|
3731
3758
|
const r = t.id;
|
|
3732
3759
|
if (!r) return e;
|
|
3733
3760
|
const o = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3734
3761
|
let s = n ? [...e.taskMessagesByScope[o] || []] : [...e.messages];
|
|
3735
3762
|
const a = st(s, r);
|
|
3736
3763
|
if (a !== -1) {
|
|
3737
|
-
const i = s[a],
|
|
3738
|
-
(l) => l.id === r ? { ...l, content: typeof
|
|
3764
|
+
const i = s[a], d = ce(t.content), c = (i.toolCalls || []).map(
|
|
3765
|
+
(l) => l.id === r ? { ...l, content: typeof d == "string" ? d : l.content } : l
|
|
3739
3766
|
);
|
|
3740
3767
|
s[a] = {
|
|
3741
3768
|
...i,
|
|
@@ -3750,7 +3777,7 @@ function Ar(e, t, n) {
|
|
|
3750
3777
|
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [o]: s } : e.taskMessagesByScope
|
|
3751
3778
|
};
|
|
3752
3779
|
}
|
|
3753
|
-
function
|
|
3780
|
+
function Ar(e, t, n) {
|
|
3754
3781
|
const r = t.id;
|
|
3755
3782
|
if (!r) return e;
|
|
3756
3783
|
const o = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
@@ -3758,12 +3785,12 @@ function xr(e, t, n) {
|
|
|
3758
3785
|
const a = st(s, r), i = ce(t.content ?? t.error);
|
|
3759
3786
|
if (a !== -1) {
|
|
3760
3787
|
const c = s[a], l = (c.toolCalls || []).map(
|
|
3761
|
-
(
|
|
3762
|
-
...
|
|
3788
|
+
(f) => f.id === r ? {
|
|
3789
|
+
...f,
|
|
3763
3790
|
status: t.error ? "failed" : "completed",
|
|
3764
|
-
content: typeof i == "string" ? i :
|
|
3791
|
+
content: typeof i == "string" ? i : f.content,
|
|
3765
3792
|
artifact: t.artifact
|
|
3766
|
-
} :
|
|
3793
|
+
} : f
|
|
3767
3794
|
);
|
|
3768
3795
|
s[a] = {
|
|
3769
3796
|
...c,
|
|
@@ -3772,7 +3799,7 @@ function xr(e, t, n) {
|
|
|
3772
3799
|
origin: t.origin ?? c.origin
|
|
3773
3800
|
};
|
|
3774
3801
|
}
|
|
3775
|
-
const
|
|
3802
|
+
const d = {
|
|
3776
3803
|
id: `tool-${r}`,
|
|
3777
3804
|
role: "tool",
|
|
3778
3805
|
name: t.name,
|
|
@@ -3783,7 +3810,7 @@ function xr(e, t, n) {
|
|
|
3783
3810
|
scope: t.scope,
|
|
3784
3811
|
origin: t.origin
|
|
3785
3812
|
};
|
|
3786
|
-
return s.push(
|
|
3813
|
+
return s.push(d), {
|
|
3787
3814
|
...e,
|
|
3788
3815
|
messages: n ? e.messages : s,
|
|
3789
3816
|
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [o]: s } : e.taskMessagesByScope
|
|
@@ -3826,19 +3853,19 @@ function gt(e) {
|
|
|
3826
3853
|
return Re(t.configurable) ?? t;
|
|
3827
3854
|
}
|
|
3828
3855
|
async function Mr(e, t) {
|
|
3829
|
-
var i,
|
|
3856
|
+
var i, d;
|
|
3830
3857
|
if (!e) return e ?? null;
|
|
3831
3858
|
const n = le(e), r = Array.isArray(n.checkpoints) ? n.checkpoints : n.checkpoints ? Object.values(n.checkpoints) : [], o = /* @__PURE__ */ new Set();
|
|
3832
3859
|
for (const c of r) {
|
|
3833
3860
|
const l = (i = c == null ? void 0 : c.values) == null ? void 0 : i.messages;
|
|
3834
3861
|
if (Array.isArray(l))
|
|
3835
|
-
for (const
|
|
3836
|
-
const
|
|
3837
|
-
if (Array.isArray(
|
|
3838
|
-
for (const
|
|
3839
|
-
if (!
|
|
3840
|
-
const
|
|
3841
|
-
typeof
|
|
3862
|
+
for (const f of l) {
|
|
3863
|
+
const p = f == null ? void 0 : f.content;
|
|
3864
|
+
if (Array.isArray(p))
|
|
3865
|
+
for (const g of p) {
|
|
3866
|
+
if (!g || typeof g != "object" || g.type !== "image_url" && g.type !== "file") continue;
|
|
3867
|
+
const I = g.fileId || g.file_id;
|
|
3868
|
+
typeof I == "string" && I.trim() && o.add(I);
|
|
3842
3869
|
}
|
|
3843
3870
|
}
|
|
3844
3871
|
}
|
|
@@ -3847,25 +3874,25 @@ async function Mr(e, t) {
|
|
|
3847
3874
|
const s = await Promise.all(
|
|
3848
3875
|
Array.from(o).map(async (c) => {
|
|
3849
3876
|
try {
|
|
3850
|
-
const l = await t.getFileInfo(c),
|
|
3851
|
-
return [c,
|
|
3877
|
+
const l = await t.getFileInfo(c), f = le(l);
|
|
3878
|
+
return [c, f];
|
|
3852
3879
|
} catch {
|
|
3853
3880
|
return [c, null];
|
|
3854
3881
|
}
|
|
3855
3882
|
})
|
|
3856
3883
|
), a = new Map(s);
|
|
3857
3884
|
for (const c of r) {
|
|
3858
|
-
const l = (
|
|
3885
|
+
const l = (d = c == null ? void 0 : c.values) == null ? void 0 : d.messages;
|
|
3859
3886
|
if (Array.isArray(l))
|
|
3860
|
-
for (const
|
|
3861
|
-
const
|
|
3862
|
-
if (Array.isArray(
|
|
3863
|
-
for (const
|
|
3864
|
-
if (!
|
|
3865
|
-
const
|
|
3866
|
-
if (!
|
|
3867
|
-
const
|
|
3868
|
-
|
|
3887
|
+
for (const f of l) {
|
|
3888
|
+
const p = f == null ? void 0 : f.content;
|
|
3889
|
+
if (Array.isArray(p))
|
|
3890
|
+
for (const g of p) {
|
|
3891
|
+
if (!g || typeof g != "object" || g.type !== "image_url" && g.type !== "file") continue;
|
|
3892
|
+
const I = g.fileId || g.file_id;
|
|
3893
|
+
if (!I) continue;
|
|
3894
|
+
const u = a.get(I), v = (u == null ? void 0 : u.contentUrl) || (u == null ? void 0 : u.content_url);
|
|
3895
|
+
v && (g.type === "image_url" ? (g.imageUrl = g.imageUrl || {}, g.imageUrl.url = v) : g.type === "file" && (g.url = v, !g.name && (u != null && u.filename || u != null && u.name) && (g.name = (u == null ? void 0 : u.filename) || (u == null ? void 0 : u.name))));
|
|
3869
3896
|
}
|
|
3870
3897
|
}
|
|
3871
3898
|
}
|
|
@@ -3883,31 +3910,31 @@ function mt(e) {
|
|
|
3883
3910
|
function Cr(e, t) {
|
|
3884
3911
|
var b, h;
|
|
3885
3912
|
if (!e) return null;
|
|
3886
|
-
const n = ((b = e.values) == null ? void 0 : b.activeAgent) ?? null, r = (h = e.values) == null ? void 0 : h.messages, s = (Array.isArray(r) ? r : []).map((T) => Er(T, n)).filter((T) => !!T), a = Re(e.metadata) ?? {}, i = gt(e.config),
|
|
3913
|
+
const n = ((b = e.values) == null ? void 0 : b.activeAgent) ?? null, r = (h = e.values) == null ? void 0 : h.messages, s = (Array.isArray(r) ? r : []).map((T) => Er(T, n)).filter((T) => !!T), a = Re(e.metadata) ?? {}, i = gt(e.config), d = Re(e.parentConfig), c = gt(d), l = Fe(i, ["checkpointId"]), f = Fe(i, ["checkpointNs"]), p = Fe(c, ["checkpointId"]), g = Re(e.config), I = Array.isArray(e.tasks) ? e.tasks.map((T) => ({ ...T })) : e.tasks ?? null, u = Array.isArray(e.next) ? [...e.next] : e.next ?? null, v = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), x = {
|
|
3887
3914
|
...a,
|
|
3888
3915
|
step: Sr(a, ["step"]) ?? 0,
|
|
3889
3916
|
source: Fe(a, ["source"]) ?? null
|
|
3890
3917
|
}, M = s.map((T) => ({
|
|
3891
3918
|
...T,
|
|
3892
3919
|
checkpointId: T.checkpointId ?? l ?? null,
|
|
3893
|
-
checkpointNs: T.checkpointNs ??
|
|
3894
|
-
})),
|
|
3920
|
+
checkpointNs: T.checkpointNs ?? f ?? null
|
|
3921
|
+
})), A = e.values, w = Array.isArray(e.interrupts) ? e.interrupts : Array.isArray(A == null ? void 0 : A.interrupts) ? A.interrupts : [];
|
|
3895
3922
|
return {
|
|
3896
3923
|
checkpointId: l ?? null,
|
|
3897
|
-
checkpointNs:
|
|
3898
|
-
createdAt:
|
|
3899
|
-
parentId:
|
|
3924
|
+
checkpointNs: f ?? null,
|
|
3925
|
+
createdAt: v,
|
|
3926
|
+
parentId: p ?? null,
|
|
3900
3927
|
messages: M,
|
|
3901
3928
|
interrupt: Pr(
|
|
3902
|
-
|
|
3929
|
+
w,
|
|
3903
3930
|
t,
|
|
3904
3931
|
l ?? null
|
|
3905
3932
|
),
|
|
3906
|
-
metadata:
|
|
3907
|
-
config:
|
|
3908
|
-
parentConfig:
|
|
3909
|
-
next:
|
|
3910
|
-
tasks:
|
|
3933
|
+
metadata: x,
|
|
3934
|
+
config: g ?? null,
|
|
3935
|
+
parentConfig: d ?? null,
|
|
3936
|
+
next: u,
|
|
3937
|
+
tasks: I,
|
|
3911
3938
|
values: e.values ?? {}
|
|
3912
3939
|
};
|
|
3913
3940
|
}
|
|
@@ -3946,40 +3973,40 @@ function _r(e) {
|
|
|
3946
3973
|
const n = t.join(" ").replace(/\s+/g, " ").trim();
|
|
3947
3974
|
return n ? n.length > ht ? `${n.slice(0, ht - 3)}…` : n : "";
|
|
3948
3975
|
}
|
|
3949
|
-
function
|
|
3976
|
+
function Nr(e) {
|
|
3950
3977
|
return _r(e.content) || "";
|
|
3951
3978
|
}
|
|
3952
|
-
function
|
|
3979
|
+
function zr(e) {
|
|
3953
3980
|
const t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Map(), o = [];
|
|
3954
3981
|
for (let c = 0; c < e.length; c++) {
|
|
3955
|
-
const l = e[c],
|
|
3956
|
-
let
|
|
3982
|
+
const l = e[c], f = l.checkpointId, p = f ?? `cp-${c}`, g = l.metadata ?? {}, I = typeof g.step == "number" ? g.step : null, u = typeof g.source == "string" ? g.source : null;
|
|
3983
|
+
let v = null, x = null;
|
|
3957
3984
|
const M = Array.isArray(l.messages) ? l.messages : [];
|
|
3958
3985
|
for (const h of M)
|
|
3959
|
-
h.role === "user" && (
|
|
3960
|
-
const
|
|
3961
|
-
id:
|
|
3962
|
-
step:
|
|
3963
|
-
source:
|
|
3986
|
+
h.role === "user" && (x || (x = h), h.id && (v = h.id));
|
|
3987
|
+
const A = l.next && l.next.length > 0 ? String(l.next[0]) : null, w = l.parentConfig ?? null, b = {
|
|
3988
|
+
id: p,
|
|
3989
|
+
step: I,
|
|
3990
|
+
source: u,
|
|
3964
3991
|
createdAt: l.createdAt ?? null,
|
|
3965
3992
|
namespace: l.checkpointNs ?? null,
|
|
3966
3993
|
parentId: l.parentId ?? null,
|
|
3967
|
-
next:
|
|
3968
|
-
parentConfig:
|
|
3969
|
-
userMessageId:
|
|
3994
|
+
next: A,
|
|
3995
|
+
parentConfig: w,
|
|
3996
|
+
userMessageId: v
|
|
3970
3997
|
};
|
|
3971
|
-
if (o.push(b),
|
|
3972
|
-
const h =
|
|
3973
|
-
h && r.set(
|
|
3998
|
+
if (o.push(b), f && t.set(f, b), f && x) {
|
|
3999
|
+
const h = Nr(x);
|
|
4000
|
+
h && r.set(f, h);
|
|
3974
4001
|
}
|
|
3975
4002
|
n.push({
|
|
3976
|
-
id:
|
|
3977
|
-
messageId:
|
|
3978
|
-
step:
|
|
3979
|
-
source:
|
|
4003
|
+
id: p,
|
|
4004
|
+
messageId: v,
|
|
4005
|
+
step: I,
|
|
4006
|
+
source: u,
|
|
3980
4007
|
createdAt: l.createdAt ?? null,
|
|
3981
|
-
next:
|
|
3982
|
-
parentConfig:
|
|
4008
|
+
next: A,
|
|
4009
|
+
parentConfig: w
|
|
3983
4010
|
});
|
|
3984
4011
|
}
|
|
3985
4012
|
const s = /* @__PURE__ */ new Map();
|
|
@@ -3990,14 +4017,14 @@ function Nr(e) {
|
|
|
3990
4017
|
}
|
|
3991
4018
|
for (const c of s.values()) {
|
|
3992
4019
|
if (!c.length) continue;
|
|
3993
|
-
c.sort((
|
|
3994
|
-
const
|
|
3995
|
-
return (
|
|
4020
|
+
c.sort((f, p) => {
|
|
4021
|
+
const g = f.createdAt ? Date.parse(f.createdAt) : 0;
|
|
4022
|
+
return (p.createdAt ? Date.parse(p.createdAt) : 0) - g;
|
|
3996
4023
|
});
|
|
3997
4024
|
const l = c.length;
|
|
3998
|
-
for (let
|
|
3999
|
-
const
|
|
4000
|
-
|
|
4025
|
+
for (let f = 0; f < c.length; f++) {
|
|
4026
|
+
const p = c[f];
|
|
4027
|
+
p.attemptCount = l, p.attemptIndex = f, p.isLatestAttempt = f === 0;
|
|
4001
4028
|
}
|
|
4002
4029
|
}
|
|
4003
4030
|
return {
|
|
@@ -4013,11 +4040,11 @@ function Nr(e) {
|
|
|
4013
4040
|
getCheckpoint: (c) => t.get(c),
|
|
4014
4041
|
getMessageAttempts: (c) => {
|
|
4015
4042
|
const l = [];
|
|
4016
|
-
for (const
|
|
4017
|
-
|
|
4018
|
-
return l.length ? (l.sort((
|
|
4019
|
-
const
|
|
4020
|
-
return
|
|
4043
|
+
for (const f of t.values())
|
|
4044
|
+
f.userMessageId === c && l.push(f);
|
|
4045
|
+
return l.length ? (l.sort((f, p) => {
|
|
4046
|
+
const g = typeof f.attemptIndex == "number" ? f.attemptIndex : Number.MAX_SAFE_INTEGER, I = typeof p.attemptIndex == "number" ? p.attemptIndex : Number.MAX_SAFE_INTEGER;
|
|
4047
|
+
return g - I;
|
|
4021
4048
|
}), l) : [];
|
|
4022
4049
|
}
|
|
4023
4050
|
};
|
|
@@ -4040,7 +4067,7 @@ function uo(e, t, n) {
|
|
|
4040
4067
|
};
|
|
4041
4068
|
}
|
|
4042
4069
|
function Rr(e) {
|
|
4043
|
-
return Y(() =>
|
|
4070
|
+
return Y(() => zr(e), [e]);
|
|
4044
4071
|
}
|
|
4045
4072
|
function $t({
|
|
4046
4073
|
api: e,
|
|
@@ -4052,81 +4079,81 @@ function $t({
|
|
|
4052
4079
|
isStreaming: a,
|
|
4053
4080
|
getMessages: i
|
|
4054
4081
|
}) {
|
|
4055
|
-
const [
|
|
4056
|
-
() => mt(
|
|
4057
|
-
[
|
|
4058
|
-
).checkpoints,
|
|
4082
|
+
const [d, c] = $(null), f = Y(
|
|
4083
|
+
() => mt(d),
|
|
4084
|
+
[d]
|
|
4085
|
+
).checkpoints, p = Rr(f), g = p.timeline, [I, u] = $(!1), [v, x] = $(!1), [M, A] = $(!1), [w, b] = $(null), h = G(o), T = G(null), m = G(null);
|
|
4059
4086
|
X(() => {
|
|
4060
4087
|
h.current = o;
|
|
4061
4088
|
}, [o]);
|
|
4062
|
-
const
|
|
4063
|
-
async (
|
|
4089
|
+
const k = _(
|
|
4090
|
+
async (P) => {
|
|
4064
4091
|
const B = await e.getState({
|
|
4065
|
-
threadId:
|
|
4066
|
-
checkpointId:
|
|
4067
|
-
checkpointNs:
|
|
4092
|
+
threadId: P.threadId,
|
|
4093
|
+
checkpointId: P.checkpointId,
|
|
4094
|
+
checkpointNs: P.checkpointNs
|
|
4068
4095
|
}), z = {
|
|
4069
4096
|
version: "values@1",
|
|
4070
|
-
threadId:
|
|
4097
|
+
threadId: P.threadId,
|
|
4071
4098
|
checkpoints: [B]
|
|
4072
|
-
},
|
|
4073
|
-
return
|
|
4099
|
+
}, J = t ? await Mr(z, t) : z, { latest: U } = mt(J);
|
|
4100
|
+
return U;
|
|
4074
4101
|
},
|
|
4075
4102
|
[e, t]
|
|
4076
|
-
),
|
|
4077
|
-
async (
|
|
4078
|
-
var
|
|
4079
|
-
if (!
|
|
4080
|
-
const z = `${
|
|
4081
|
-
if (T.current === z ||
|
|
4082
|
-
(
|
|
4083
|
-
const
|
|
4084
|
-
|
|
4103
|
+
), E = _(
|
|
4104
|
+
async (P, B) => {
|
|
4105
|
+
var U;
|
|
4106
|
+
if (!P) return;
|
|
4107
|
+
const z = `${P}:${B ?? "latest"}`;
|
|
4108
|
+
if (T.current === z || I) return;
|
|
4109
|
+
(U = m.current) == null || U.abort();
|
|
4110
|
+
const J = new AbortController();
|
|
4111
|
+
m.current = J, u(!0), b(null);
|
|
4085
4112
|
try {
|
|
4086
|
-
const
|
|
4087
|
-
threadId:
|
|
4113
|
+
const R = await k({
|
|
4114
|
+
threadId: P,
|
|
4088
4115
|
checkpointId: B ?? void 0
|
|
4089
4116
|
});
|
|
4090
|
-
if (h.current !==
|
|
4091
|
-
|
|
4117
|
+
if (h.current !== P) {
|
|
4118
|
+
u(!1);
|
|
4092
4119
|
return;
|
|
4093
4120
|
}
|
|
4094
|
-
n((
|
|
4095
|
-
checkpointId: (
|
|
4096
|
-
checkpointNs: (
|
|
4097
|
-
pendingInterrupt: (
|
|
4098
|
-
values:
|
|
4099
|
-
}), T.current = z,
|
|
4121
|
+
n((R == null ? void 0 : R.messages) ?? [], {
|
|
4122
|
+
checkpointId: (R == null ? void 0 : R.checkpointId) ?? null,
|
|
4123
|
+
checkpointNs: (R == null ? void 0 : R.checkpointNs) ?? null,
|
|
4124
|
+
pendingInterrupt: (R == null ? void 0 : R.interrupt) ?? null,
|
|
4125
|
+
values: R == null ? void 0 : R.values
|
|
4126
|
+
}), T.current = z, u(!1), A(!0);
|
|
4100
4127
|
try {
|
|
4101
|
-
const
|
|
4102
|
-
threadId:
|
|
4128
|
+
const q = await e.getStateHistory({
|
|
4129
|
+
threadId: P,
|
|
4103
4130
|
limit: 100,
|
|
4104
4131
|
includeMessages: !1
|
|
4105
4132
|
});
|
|
4106
|
-
h.current ===
|
|
4133
|
+
h.current === P && c(q);
|
|
4107
4134
|
} finally {
|
|
4108
|
-
|
|
4135
|
+
A(!1);
|
|
4109
4136
|
}
|
|
4110
|
-
} catch (
|
|
4111
|
-
if (
|
|
4112
|
-
const
|
|
4113
|
-
b(
|
|
4137
|
+
} catch (R) {
|
|
4138
|
+
if (u(!1), !Xt(R)) {
|
|
4139
|
+
const q = String(R);
|
|
4140
|
+
b(q), r == null || r(q);
|
|
4114
4141
|
}
|
|
4115
4142
|
}
|
|
4116
4143
|
},
|
|
4117
|
-
[e, n,
|
|
4144
|
+
[e, n, k, r, i]
|
|
4118
4145
|
), j = _(
|
|
4119
|
-
async (
|
|
4146
|
+
async (P, B) => {
|
|
4120
4147
|
if (o) {
|
|
4121
|
-
|
|
4148
|
+
x(!0);
|
|
4122
4149
|
try {
|
|
4123
|
-
const z = await
|
|
4150
|
+
const z = await k({
|
|
4124
4151
|
threadId: o,
|
|
4125
|
-
checkpointId:
|
|
4152
|
+
checkpointId: P,
|
|
4126
4153
|
checkpointNs: B ?? void 0
|
|
4127
4154
|
});
|
|
4128
4155
|
n((z == null ? void 0 : z.messages) ?? [], {
|
|
4129
|
-
checkpointId: (z == null ? void 0 : z.checkpointId) ??
|
|
4156
|
+
checkpointId: (z == null ? void 0 : z.checkpointId) ?? P,
|
|
4130
4157
|
checkpointNs: (z == null ? void 0 : z.checkpointNs) ?? B,
|
|
4131
4158
|
pendingInterrupt: (z == null ? void 0 : z.interrupt) ?? null,
|
|
4132
4159
|
values: z == null ? void 0 : z.values
|
|
@@ -4134,52 +4161,40 @@ function $t({
|
|
|
4134
4161
|
} catch (z) {
|
|
4135
4162
|
console.error("[useThreadHistoryState] Navigation failed", z);
|
|
4136
4163
|
} finally {
|
|
4137
|
-
|
|
4164
|
+
x(!1);
|
|
4138
4165
|
}
|
|
4139
4166
|
}
|
|
4140
4167
|
},
|
|
4141
|
-
[o,
|
|
4168
|
+
[o, k, n]
|
|
4142
4169
|
), C = _(async () => {
|
|
4143
|
-
o && await
|
|
4144
|
-
}, [o,
|
|
4145
|
-
async (
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
if (!B || o !== B) return;
|
|
4149
|
-
if (c(E), T.current = `${B}:latest`, (K = E.values) != null && K.messages) {
|
|
4150
|
-
const N = await w({
|
|
4151
|
-
threadId: B
|
|
4152
|
-
});
|
|
4153
|
-
N && n(N.messages ?? [], {
|
|
4154
|
-
checkpointId: N.checkpointId ?? null,
|
|
4155
|
-
checkpointNs: N.checkpointNs ?? null,
|
|
4156
|
-
pendingInterrupt: N.interrupt ?? null,
|
|
4157
|
-
values: N.values
|
|
4158
|
-
});
|
|
4159
|
-
}
|
|
4170
|
+
o && await E(o);
|
|
4171
|
+
}, [o, E]), O = _(
|
|
4172
|
+
async (P) => {
|
|
4173
|
+
const B = (P == null ? void 0 : P.threadId) || o;
|
|
4174
|
+
!B || o !== B || (c(P), T.current = `${B}:latest`);
|
|
4160
4175
|
},
|
|
4161
|
-
[o
|
|
4176
|
+
[o]
|
|
4162
4177
|
);
|
|
4163
4178
|
X(() => {
|
|
4164
|
-
if (!s || !o ||
|
|
4165
|
-
const
|
|
4166
|
-
T.current !==
|
|
4167
|
-
}, [s, o,
|
|
4179
|
+
if (!s || !o || I || a) return;
|
|
4180
|
+
const P = `${o}:latest`;
|
|
4181
|
+
T.current !== P && E(o);
|
|
4182
|
+
}, [s, o, I, a, E]);
|
|
4168
4183
|
const F = _(() => {
|
|
4169
|
-
c(null),
|
|
4184
|
+
c(null), u(!1), x(!1), A(!1), b(null), T.current = null;
|
|
4170
4185
|
}, []);
|
|
4171
4186
|
return {
|
|
4172
|
-
threadCheckpoints:
|
|
4173
|
-
threadTimeline:
|
|
4174
|
-
checkpointIndex:
|
|
4175
|
-
isLoadingThread:
|
|
4176
|
-
isLoadingCheckpoint:
|
|
4187
|
+
threadCheckpoints: f,
|
|
4188
|
+
threadTimeline: g,
|
|
4189
|
+
checkpointIndex: p,
|
|
4190
|
+
isLoadingThread: I,
|
|
4191
|
+
isLoadingCheckpoint: v,
|
|
4177
4192
|
isLoadingHistory: M,
|
|
4178
|
-
threadStateError:
|
|
4179
|
-
loadThread:
|
|
4193
|
+
threadStateError: w,
|
|
4194
|
+
loadThread: E,
|
|
4180
4195
|
navigateToCheckpoint: j,
|
|
4181
|
-
setCurrentCheckpointId: (
|
|
4182
|
-
n(i(), { checkpointId:
|
|
4196
|
+
setCurrentCheckpointId: (P, B) => {
|
|
4197
|
+
n(i(), { checkpointId: P, checkpointNs: B });
|
|
4183
4198
|
},
|
|
4184
4199
|
returnToLatest: C,
|
|
4185
4200
|
handleValuesEvent: O,
|
|
@@ -4193,17 +4208,17 @@ function $t({
|
|
|
4193
4208
|
}
|
|
4194
4209
|
const Dt = Ce(null), Kt = Ce(null);
|
|
4195
4210
|
function Vt(e) {
|
|
4196
|
-
const t =
|
|
4211
|
+
const t = je(Dt);
|
|
4197
4212
|
if (!t && !(e != null && e.optional)) throw new Error("useThreadState must be used within a ThreadStateProvider");
|
|
4198
4213
|
return t;
|
|
4199
4214
|
}
|
|
4200
4215
|
function Lr() {
|
|
4201
|
-
const e =
|
|
4216
|
+
const e = je(Kt);
|
|
4202
4217
|
if (!e)
|
|
4203
4218
|
throw new Error("useThreadStateUpdater must be used within a ThreadStateProvider");
|
|
4204
4219
|
return e;
|
|
4205
4220
|
}
|
|
4206
|
-
function
|
|
4221
|
+
function jr({
|
|
4207
4222
|
children: e,
|
|
4208
4223
|
initialThreadId: t = null,
|
|
4209
4224
|
initialCheckpointId: n = null,
|
|
@@ -4212,26 +4227,26 @@ function Ur({
|
|
|
4212
4227
|
isStreaming: s,
|
|
4213
4228
|
onError: a
|
|
4214
4229
|
}) {
|
|
4215
|
-
const { chatApi: i, fileApi:
|
|
4216
|
-
threadCheckpoints:
|
|
4217
|
-
threadTimeline:
|
|
4218
|
-
checkpointIndex:
|
|
4219
|
-
isLoadingThread:
|
|
4230
|
+
const { chatApi: i, fileApi: d } = Me(), { currentThreadId: c } = ot(), { state: l, seed: f, onEvent: p, dispatch: g } = kr(), {
|
|
4231
|
+
threadCheckpoints: I,
|
|
4232
|
+
threadTimeline: u,
|
|
4233
|
+
checkpointIndex: v,
|
|
4234
|
+
isLoadingThread: x,
|
|
4220
4235
|
isLoadingCheckpoint: M,
|
|
4221
|
-
isLoadingHistory:
|
|
4222
|
-
threadStateError:
|
|
4236
|
+
isLoadingHistory: A,
|
|
4237
|
+
threadStateError: w,
|
|
4223
4238
|
loadThread: b,
|
|
4224
4239
|
navigateToCheckpoint: h,
|
|
4225
4240
|
setCurrentCheckpointId: T,
|
|
4226
|
-
returnToLatest:
|
|
4227
|
-
handleValuesEvent:
|
|
4228
|
-
markSkipNextLoad:
|
|
4241
|
+
returnToLatest: m,
|
|
4242
|
+
handleValuesEvent: k,
|
|
4243
|
+
markSkipNextLoad: E,
|
|
4229
4244
|
markStreamPendingThread: j,
|
|
4230
4245
|
resetHistoryState: C
|
|
4231
4246
|
} = $t({
|
|
4232
4247
|
api: i,
|
|
4233
|
-
fileApi:
|
|
4234
|
-
seed:
|
|
4248
|
+
fileApi: d,
|
|
4249
|
+
seed: f,
|
|
4235
4250
|
onError: a,
|
|
4236
4251
|
currentThreadId: c,
|
|
4237
4252
|
initialThreadId: t,
|
|
@@ -4240,33 +4255,33 @@ function Ur({
|
|
|
4240
4255
|
autoLoadInitial: o,
|
|
4241
4256
|
isStreaming: s,
|
|
4242
4257
|
getMessages: _(() => l.messages, [l.messages])
|
|
4243
|
-
}), O =
|
|
4258
|
+
}), O = G(null), F = _(
|
|
4244
4259
|
(S) => {
|
|
4245
4260
|
O.current = S;
|
|
4246
4261
|
},
|
|
4247
4262
|
[]
|
|
4248
|
-
),
|
|
4263
|
+
), P = G(null), B = _(
|
|
4249
4264
|
(S) => {
|
|
4250
|
-
|
|
4265
|
+
P.current = S;
|
|
4251
4266
|
},
|
|
4252
4267
|
[]
|
|
4253
|
-
), z = Y(() => ({ assemblingMessageId: l.assemblingId ?? null }), [l.assemblingId]),
|
|
4254
|
-
(S,
|
|
4255
|
-
const
|
|
4256
|
-
return
|
|
4268
|
+
), z = Y(() => ({ assemblingMessageId: l.assemblingId ?? null }), [l.assemblingId]), J = _(
|
|
4269
|
+
(S, W) => {
|
|
4270
|
+
const K = jt(S, "user");
|
|
4271
|
+
return g({
|
|
4257
4272
|
type: "user_message",
|
|
4258
4273
|
payload: {
|
|
4259
|
-
message:
|
|
4260
|
-
editingMessageId:
|
|
4274
|
+
message: K,
|
|
4275
|
+
editingMessageId: W == null ? void 0 : W.editingMessageId
|
|
4261
4276
|
}
|
|
4262
|
-
}),
|
|
4277
|
+
}), K;
|
|
4263
4278
|
},
|
|
4264
|
-
[
|
|
4265
|
-
),
|
|
4266
|
-
O.current ? await O.current() : (
|
|
4267
|
-
}, [
|
|
4268
|
-
await b(S,
|
|
4269
|
-
}, [b]),
|
|
4279
|
+
[g]
|
|
4280
|
+
), U = _(async () => {
|
|
4281
|
+
O.current ? await O.current() : (f([], {}), C());
|
|
4282
|
+
}, [f, C]), R = _(async (S, W, K) => {
|
|
4283
|
+
await b(S, W, { clearProgress: !1 });
|
|
4284
|
+
}, [b]), q = Y(() => Bn(l.messages), [l.messages]), y = Y(
|
|
4270
4285
|
() => ({
|
|
4271
4286
|
status: l.status,
|
|
4272
4287
|
threadId: c,
|
|
@@ -4277,43 +4292,43 @@ function Ur({
|
|
|
4277
4292
|
id: l.lastCheckpointId ?? null,
|
|
4278
4293
|
namespace: l.lastCheckpointNs ?? null
|
|
4279
4294
|
},
|
|
4280
|
-
checkpoints:
|
|
4281
|
-
checkpointIndex:
|
|
4282
|
-
timelineCheckpoints:
|
|
4295
|
+
checkpoints: I,
|
|
4296
|
+
checkpointIndex: v,
|
|
4297
|
+
timelineCheckpoints: u,
|
|
4283
4298
|
metadata: z,
|
|
4284
4299
|
values: l.values ?? {},
|
|
4285
|
-
isLoading:
|
|
4300
|
+
isLoading: x,
|
|
4286
4301
|
isLoadingCheckpoint: M,
|
|
4287
|
-
isLoadingHistory:
|
|
4288
|
-
error:
|
|
4302
|
+
isLoadingHistory: A,
|
|
4303
|
+
error: w,
|
|
4289
4304
|
loadOlder: async () => {
|
|
4290
4305
|
},
|
|
4291
4306
|
// Placeholder
|
|
4292
4307
|
seedFromSnapshot: (S) => {
|
|
4293
|
-
|
|
4308
|
+
f(S.messages, {
|
|
4294
4309
|
checkpointId: S.checkpointId,
|
|
4295
4310
|
checkpointNs: S.checkpointNs,
|
|
4296
4311
|
pendingInterrupt: S.interrupt,
|
|
4297
4312
|
values: S.values
|
|
4298
4313
|
});
|
|
4299
4314
|
},
|
|
4300
|
-
clearState:
|
|
4315
|
+
clearState: U,
|
|
4301
4316
|
navigateToCheckpoint: h,
|
|
4302
4317
|
setCurrentCheckpointId: T,
|
|
4303
|
-
returnToLatest:
|
|
4304
|
-
loadThread:
|
|
4305
|
-
clearThread:
|
|
4306
|
-
respondToInterrupt: async (S,
|
|
4307
|
-
|
|
4318
|
+
returnToLatest: m,
|
|
4319
|
+
loadThread: R,
|
|
4320
|
+
clearThread: U,
|
|
4321
|
+
respondToInterrupt: async (S, W, K) => {
|
|
4322
|
+
P.current && await P.current(S, W, K);
|
|
4308
4323
|
},
|
|
4309
|
-
messagePreviews:
|
|
4310
|
-
handleValuesEvent:
|
|
4311
|
-
markSkipNextLoad:
|
|
4324
|
+
messagePreviews: v.messagePreviews,
|
|
4325
|
+
handleValuesEvent: k,
|
|
4326
|
+
markSkipNextLoad: E,
|
|
4312
4327
|
markStreamPendingThread: j,
|
|
4313
4328
|
resetHistoryState: C,
|
|
4314
|
-
pushUser:
|
|
4315
|
-
onEvent:
|
|
4316
|
-
artifacts:
|
|
4329
|
+
pushUser: J,
|
|
4330
|
+
onEvent: p,
|
|
4331
|
+
artifacts: q
|
|
4317
4332
|
}),
|
|
4318
4333
|
[
|
|
4319
4334
|
c,
|
|
@@ -4323,37 +4338,37 @@ function Ur({
|
|
|
4323
4338
|
l.lastCheckpointId,
|
|
4324
4339
|
l.lastCheckpointNs,
|
|
4325
4340
|
l.values,
|
|
4326
|
-
v,
|
|
4327
|
-
f,
|
|
4328
4341
|
I,
|
|
4342
|
+
u,
|
|
4343
|
+
v,
|
|
4329
4344
|
z,
|
|
4330
|
-
A,
|
|
4331
|
-
M,
|
|
4332
4345
|
x,
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4346
|
+
M,
|
|
4347
|
+
A,
|
|
4348
|
+
w,
|
|
4349
|
+
f,
|
|
4350
|
+
U,
|
|
4336
4351
|
h,
|
|
4337
4352
|
T,
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4353
|
+
m,
|
|
4354
|
+
R,
|
|
4355
|
+
k,
|
|
4356
|
+
E,
|
|
4342
4357
|
j,
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4358
|
+
J,
|
|
4359
|
+
p,
|
|
4360
|
+
q
|
|
4346
4361
|
]
|
|
4347
|
-
),
|
|
4362
|
+
), L = Y(
|
|
4348
4363
|
() => ({
|
|
4349
4364
|
registerClearThread: F,
|
|
4350
4365
|
registerRespondToInterrupt: B
|
|
4351
4366
|
}),
|
|
4352
4367
|
[F, B]
|
|
4353
4368
|
);
|
|
4354
|
-
return /* @__PURE__ */ ie(Kt.Provider, { value:
|
|
4369
|
+
return /* @__PURE__ */ ie(Kt.Provider, { value: L, children: /* @__PURE__ */ ie(Dt.Provider, { value: y, children: e }) });
|
|
4355
4370
|
}
|
|
4356
|
-
const qt = Ce(null),
|
|
4371
|
+
const qt = Ce(null), Ur = Ce(!1);
|
|
4357
4372
|
function Br({
|
|
4358
4373
|
children: e,
|
|
4359
4374
|
onError: t,
|
|
@@ -4363,36 +4378,36 @@ function Br({
|
|
|
4363
4378
|
onUpdateEvent: s,
|
|
4364
4379
|
onCustomEvent: a,
|
|
4365
4380
|
onMetadataEvent: i,
|
|
4366
|
-
onFinish:
|
|
4381
|
+
onFinish: d,
|
|
4367
4382
|
onStreamingChange: c
|
|
4368
4383
|
}) {
|
|
4369
|
-
const { chatApi: l, baseUrl:
|
|
4384
|
+
const { chatApi: l, baseUrl: f } = Me(), p = f, g = fe(t), I = fe(n), u = fe(r), v = fe(o), x = fe(s), M = fe(a), A = fe(i), w = fe(d), b = fe(c), h = Y(
|
|
4370
4385
|
() => ({
|
|
4371
|
-
onError:
|
|
4372
|
-
onAuthError:
|
|
4373
|
-
onConnectionError:
|
|
4374
|
-
onMetadataEvent:
|
|
4386
|
+
onError: g,
|
|
4387
|
+
onAuthError: I,
|
|
4388
|
+
onConnectionError: u,
|
|
4389
|
+
onMetadataEvent: A,
|
|
4375
4390
|
onCustomEvent: M,
|
|
4376
|
-
onUpdateEvent:
|
|
4377
|
-
onToolEnd:
|
|
4378
|
-
onFinish:
|
|
4391
|
+
onUpdateEvent: x,
|
|
4392
|
+
onToolEnd: v,
|
|
4393
|
+
onFinish: w
|
|
4379
4394
|
}),
|
|
4380
4395
|
[
|
|
4381
|
-
|
|
4382
|
-
v,
|
|
4383
|
-
f,
|
|
4384
|
-
x,
|
|
4385
|
-
M,
|
|
4386
|
-
A,
|
|
4396
|
+
g,
|
|
4387
4397
|
I,
|
|
4388
|
-
|
|
4398
|
+
u,
|
|
4399
|
+
A,
|
|
4400
|
+
M,
|
|
4401
|
+
x,
|
|
4402
|
+
v,
|
|
4403
|
+
w
|
|
4389
4404
|
]
|
|
4390
4405
|
);
|
|
4391
|
-
return /* @__PURE__ */ ie(
|
|
4406
|
+
return /* @__PURE__ */ ie(Ur.Provider, { value: !0, children: /* @__PURE__ */ ie(
|
|
4392
4407
|
Fr,
|
|
4393
4408
|
{
|
|
4394
4409
|
api: l,
|
|
4395
|
-
streamBaseUrl:
|
|
4410
|
+
streamBaseUrl: p,
|
|
4396
4411
|
handlers: h,
|
|
4397
4412
|
onStreamingChange: b,
|
|
4398
4413
|
children: e
|
|
@@ -4406,28 +4421,28 @@ function Fr({
|
|
|
4406
4421
|
handlers: r,
|
|
4407
4422
|
onStreamingChange: o
|
|
4408
4423
|
}) {
|
|
4409
|
-
const { setCurrentThreadId: s, currentThreadIdRef: a, addThreadFromEvent: i, currentThreadId:
|
|
4424
|
+
const { setCurrentThreadId: s, currentThreadIdRef: a, addThreadFromEvent: i, currentThreadId: d } = ot(), {
|
|
4410
4425
|
interrupt: c,
|
|
4411
4426
|
checkpoint: l,
|
|
4412
|
-
timelineCheckpoints:
|
|
4413
|
-
handleValuesEvent:
|
|
4414
|
-
markSkipNextLoad:
|
|
4415
|
-
markStreamPendingThread:
|
|
4416
|
-
resetHistoryState:
|
|
4417
|
-
pushUser:
|
|
4418
|
-
onEvent:
|
|
4427
|
+
timelineCheckpoints: f,
|
|
4428
|
+
handleValuesEvent: p,
|
|
4429
|
+
markSkipNextLoad: g,
|
|
4430
|
+
markStreamPendingThread: I,
|
|
4431
|
+
resetHistoryState: u,
|
|
4432
|
+
pushUser: v,
|
|
4433
|
+
onEvent: x,
|
|
4419
4434
|
messages: M
|
|
4420
|
-
} = Vt(), { registerClearThread:
|
|
4435
|
+
} = Vt(), { registerClearThread: A, registerRespondToInterrupt: w } = Lr(), b = _(
|
|
4421
4436
|
(y) => {
|
|
4422
|
-
i(y),
|
|
4437
|
+
i(y), I(y.threadId), a.current !== y.threadId && ((y.created ?? !a.current) && g(y.threadId), s(y.threadId));
|
|
4423
4438
|
},
|
|
4424
|
-
[i,
|
|
4439
|
+
[i, g, I, s, a]
|
|
4425
4440
|
), h = pr({
|
|
4426
4441
|
baseUrl: n,
|
|
4427
|
-
onEvent:
|
|
4442
|
+
onEvent: x,
|
|
4428
4443
|
onError: (y) => {
|
|
4429
|
-
var
|
|
4430
|
-
(
|
|
4444
|
+
var L;
|
|
4445
|
+
(L = r.onError) == null || L.call(r, (y == null ? void 0 : y.message) ?? String(y));
|
|
4431
4446
|
},
|
|
4432
4447
|
onAuthError: r.onAuthError,
|
|
4433
4448
|
onConnectionError: r.onConnectionError,
|
|
@@ -4437,92 +4452,92 @@ function Fr({
|
|
|
4437
4452
|
onCustomEvent: r.onCustomEvent,
|
|
4438
4453
|
onUpdateEvent: r.onUpdateEvent,
|
|
4439
4454
|
onToolEnd: r.onToolEnd,
|
|
4440
|
-
handleValuesEvent:
|
|
4455
|
+
handleValuesEvent: p
|
|
4441
4456
|
});
|
|
4442
4457
|
X(() => {
|
|
4443
4458
|
o == null || o(h.isStreaming);
|
|
4444
4459
|
}, [h.isStreaming, o]);
|
|
4445
|
-
const { stream: T, stop:
|
|
4460
|
+
const { stream: T, stop: m, clear: k, isStreaming: E, error: j, connected: C, streamedMessages: O, activeMessageId: F } = h;
|
|
4446
4461
|
X(() => {
|
|
4447
|
-
|
|
4448
|
-
}, [
|
|
4449
|
-
const
|
|
4450
|
-
async (y,
|
|
4451
|
-
await T(y,
|
|
4462
|
+
d !== void 0 && k();
|
|
4463
|
+
}, [d, k]);
|
|
4464
|
+
const P = _(
|
|
4465
|
+
async (y, L) => {
|
|
4466
|
+
await T(y, L);
|
|
4452
4467
|
},
|
|
4453
4468
|
[T]
|
|
4454
|
-
), B =
|
|
4469
|
+
), B = G(l);
|
|
4455
4470
|
X(() => {
|
|
4456
4471
|
B.current = l;
|
|
4457
4472
|
}, [l]);
|
|
4458
4473
|
const z = _(
|
|
4459
|
-
async (y,
|
|
4460
|
-
var
|
|
4461
|
-
const
|
|
4462
|
-
if (!
|
|
4474
|
+
async (y, L, S) => {
|
|
4475
|
+
var H;
|
|
4476
|
+
const W = a.current;
|
|
4477
|
+
if (!W)
|
|
4463
4478
|
throw new Error("No active thread to handle interrupt");
|
|
4464
|
-
const
|
|
4465
|
-
threadId:
|
|
4479
|
+
const K = y ? L ?? !0 : !1, V = B.current, ee = (S == null ? void 0 : S.checkpointId) ?? V.id ?? void 0, re = (S == null ? void 0 : S.checkpointNs) ?? V.namespace ?? void 0, de = {
|
|
4480
|
+
threadId: W,
|
|
4466
4481
|
checkpointId: ee,
|
|
4467
4482
|
checkpointNs: re,
|
|
4468
|
-
command: { kind: "resume", value:
|
|
4483
|
+
command: { kind: "resume", value: K },
|
|
4469
4484
|
payload: {
|
|
4470
4485
|
...(S == null ? void 0 : S.payload) ?? {},
|
|
4471
|
-
creativityLevel: ((
|
|
4486
|
+
creativityLevel: ((H = S == null ? void 0 : S.payload) == null ? void 0 : H.creativityLevel) ?? "medium"
|
|
4472
4487
|
},
|
|
4473
4488
|
edit: !1
|
|
4474
4489
|
};
|
|
4475
|
-
|
|
4490
|
+
P(de);
|
|
4476
4491
|
},
|
|
4477
|
-
[a,
|
|
4492
|
+
[a, P]
|
|
4478
4493
|
);
|
|
4479
4494
|
X(() => {
|
|
4480
|
-
|
|
4481
|
-
}, [z,
|
|
4482
|
-
const
|
|
4483
|
-
|
|
4484
|
-
}, [
|
|
4495
|
+
w(z);
|
|
4496
|
+
}, [z, w]);
|
|
4497
|
+
const J = _(async () => {
|
|
4498
|
+
m(), k(), u(), s(null);
|
|
4499
|
+
}, [k, u, s, m]);
|
|
4485
4500
|
X(() => {
|
|
4486
|
-
|
|
4487
|
-
}, [
|
|
4488
|
-
const
|
|
4489
|
-
async (y,
|
|
4490
|
-
|
|
4501
|
+
A(J);
|
|
4502
|
+
}, [J, A]);
|
|
4503
|
+
const U = _(
|
|
4504
|
+
async (y, L) => {
|
|
4505
|
+
E && m();
|
|
4491
4506
|
let S = a.current;
|
|
4492
|
-
const
|
|
4507
|
+
const W = (y == null ? void 0 : y.text) ?? "", K = (y == null ? void 0 : y.attachments) ?? [], V = (W == null ? void 0 : W.trim()) ?? "", ee = { ...(y == null ? void 0 : y.payload) ?? {} }, re = Array.isArray(ee.messages) ? ee.messages : void 0;
|
|
4493
4508
|
re && delete ee.messages;
|
|
4494
|
-
const
|
|
4495
|
-
if (!S && !
|
|
4509
|
+
const de = !!(re && re.length), H = !!(y.contentParts && y.contentParts.length > 0);
|
|
4510
|
+
if (!S && !V && K.length === 0 && !de && !H) return;
|
|
4496
4511
|
if (!S) {
|
|
4497
4512
|
const ye = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), he = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")).join("").slice(0, 16);
|
|
4498
|
-
S = `${ye}${he}`,
|
|
4513
|
+
S = `${ye}${he}`, g(S), s(S);
|
|
4499
4514
|
}
|
|
4500
4515
|
let te = null;
|
|
4501
4516
|
y.contentParts && y.contentParts.length > 0 && (te = y.contentParts);
|
|
4502
|
-
const { contentParts: ke, filesInfo: Q } = te ? { contentParts: te, filesInfo: [] } : await or(
|
|
4503
|
-
|
|
4504
|
-
const ge = y == null ? void 0 : y.originalMessageId,
|
|
4517
|
+
const { contentParts: ke, filesInfo: Q } = te ? { contentParts: te, filesInfo: [] } : await or(K), Z = [...ke];
|
|
4518
|
+
V && Z.push({ type: "text", text: W });
|
|
4519
|
+
const ge = y == null ? void 0 : y.originalMessageId, Ue = !!(y != null && y.edit && ge), Be = !de && Z.length > 0;
|
|
4505
4520
|
let me = null;
|
|
4506
4521
|
if (Be) {
|
|
4507
|
-
const ye =
|
|
4508
|
-
me =
|
|
4522
|
+
const ye = Ue ? ge : `msg-${Date.now()}`;
|
|
4523
|
+
me = jt({
|
|
4509
4524
|
id: ye,
|
|
4510
4525
|
role: "user",
|
|
4511
4526
|
content: Z,
|
|
4512
4527
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4513
|
-
}, "user"),
|
|
4528
|
+
}, "user"), Ue ? v(me, { editingMessageId: ge }) : v(me);
|
|
4514
4529
|
}
|
|
4515
|
-
const
|
|
4530
|
+
const ve = de ? re : me ? [me] : [], oe = {
|
|
4516
4531
|
...ee,
|
|
4517
4532
|
...Q.length ? { files_info: Q } : {}
|
|
4518
4533
|
};
|
|
4519
|
-
|
|
4534
|
+
ve.length ? oe.messages = ve : "messages" in oe || (oe.messages = []);
|
|
4520
4535
|
const Pe = (y == null ? void 0 : y.checkpointId) ?? l.id ?? void 0;
|
|
4521
4536
|
if (y != null && y.edit && !Pe)
|
|
4522
4537
|
throw new Error(
|
|
4523
4538
|
`[streaming] Missing checkpointId for edit submit. threadId=${S ?? "null"}`
|
|
4524
4539
|
);
|
|
4525
|
-
const
|
|
4540
|
+
const xe = {
|
|
4526
4541
|
threadId: S,
|
|
4527
4542
|
content: y == null ? void 0 : y.text,
|
|
4528
4543
|
payload: oe,
|
|
@@ -4531,31 +4546,31 @@ function Fr({
|
|
|
4531
4546
|
command: y == null ? void 0 : y.command,
|
|
4532
4547
|
edit: y == null ? void 0 : y.edit
|
|
4533
4548
|
};
|
|
4534
|
-
return
|
|
4549
|
+
return P(xe, L);
|
|
4535
4550
|
},
|
|
4536
|
-
[l, a,
|
|
4537
|
-
),
|
|
4551
|
+
[l, a, E, g, v, P, m, f]
|
|
4552
|
+
), R = Y(() => M, [M]), q = Y(
|
|
4538
4553
|
() => ({
|
|
4539
|
-
isStreaming:
|
|
4554
|
+
isStreaming: E,
|
|
4540
4555
|
error: j,
|
|
4541
|
-
connectionState: j ? "error" :
|
|
4542
|
-
messages:
|
|
4556
|
+
connectionState: j ? "error" : E ? C ? "connected" : "connecting" : "idle",
|
|
4557
|
+
messages: R,
|
|
4543
4558
|
activeMessageId: F,
|
|
4544
|
-
submit:
|
|
4545
|
-
stop:
|
|
4559
|
+
submit: U,
|
|
4560
|
+
stop: m,
|
|
4546
4561
|
interrupt: c,
|
|
4547
4562
|
resume: () => Promise.resolve(),
|
|
4548
|
-
goto: (y,
|
|
4563
|
+
goto: (y, L) => Promise.resolve(),
|
|
4549
4564
|
clearError: () => {
|
|
4550
4565
|
}
|
|
4551
4566
|
// TODO: Implement error clearing
|
|
4552
4567
|
}),
|
|
4553
|
-
[
|
|
4568
|
+
[E, j, U, m, c, C, R]
|
|
4554
4569
|
);
|
|
4555
|
-
return /* @__PURE__ */ ie(qt.Provider, { value:
|
|
4570
|
+
return /* @__PURE__ */ ie(qt.Provider, { value: q, children: e });
|
|
4556
4571
|
}
|
|
4557
4572
|
function fe(e) {
|
|
4558
|
-
const t =
|
|
4573
|
+
const t = G(e);
|
|
4559
4574
|
return X(() => {
|
|
4560
4575
|
t.current = e;
|
|
4561
4576
|
}, [e]), _((...n) => {
|
|
@@ -4565,7 +4580,7 @@ function fe(e) {
|
|
|
4565
4580
|
}, []);
|
|
4566
4581
|
}
|
|
4567
4582
|
function Or(e) {
|
|
4568
|
-
return
|
|
4583
|
+
return je(qt);
|
|
4569
4584
|
}
|
|
4570
4585
|
function bt(e) {
|
|
4571
4586
|
return typeof e == "object" && e !== null;
|
|
@@ -4582,7 +4597,7 @@ function $r(e, t) {
|
|
|
4582
4597
|
return !0;
|
|
4583
4598
|
}
|
|
4584
4599
|
function Dr(e) {
|
|
4585
|
-
const t =
|
|
4600
|
+
const t = G(e), n = G(e);
|
|
4586
4601
|
return $r(t.current, e) || (t.current = e, n.current = e), n.current;
|
|
4587
4602
|
}
|
|
4588
4603
|
function Kr(e) {
|
|
@@ -4605,56 +4620,56 @@ function po({
|
|
|
4605
4620
|
autoLoadInitial: s = !0,
|
|
4606
4621
|
onConnectionError: a,
|
|
4607
4622
|
onError: i,
|
|
4608
|
-
onAuthError:
|
|
4623
|
+
onAuthError: d,
|
|
4609
4624
|
onThreadChange: c,
|
|
4610
4625
|
onToolEnd: l,
|
|
4611
|
-
onUpdateEvent:
|
|
4612
|
-
onCustomEvent:
|
|
4613
|
-
onMetadataEvent:
|
|
4614
|
-
onFinish:
|
|
4626
|
+
onUpdateEvent: f,
|
|
4627
|
+
onCustomEvent: p,
|
|
4628
|
+
onMetadataEvent: g,
|
|
4629
|
+
onFinish: I
|
|
4615
4630
|
}) {
|
|
4616
|
-
const
|
|
4631
|
+
const u = Dr(t), [v, x] = $(!1), M = pe(i), A = pe(d), w = pe(a), b = pe(c), h = pe(l), T = pe(f), m = pe(p), k = pe(g), E = pe(I), j = Y(
|
|
4617
4632
|
() => ({
|
|
4618
4633
|
onError: M,
|
|
4619
|
-
onAuthError:
|
|
4620
|
-
onConnectionError:
|
|
4634
|
+
onAuthError: A,
|
|
4635
|
+
onConnectionError: w,
|
|
4621
4636
|
onToolEnd: h,
|
|
4622
4637
|
onUpdateEvent: T,
|
|
4623
|
-
onCustomEvent:
|
|
4624
|
-
onMetadataEvent:
|
|
4625
|
-
onFinish:
|
|
4638
|
+
onCustomEvent: m,
|
|
4639
|
+
onMetadataEvent: k,
|
|
4640
|
+
onFinish: E
|
|
4626
4641
|
}),
|
|
4627
4642
|
[
|
|
4628
4643
|
M,
|
|
4629
|
-
|
|
4630
|
-
|
|
4644
|
+
A,
|
|
4645
|
+
w,
|
|
4631
4646
|
h,
|
|
4632
4647
|
T,
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4648
|
+
m,
|
|
4649
|
+
k,
|
|
4650
|
+
E
|
|
4636
4651
|
]
|
|
4637
4652
|
);
|
|
4638
|
-
return /* @__PURE__ */ ie(nr, { apiConfig:
|
|
4653
|
+
return /* @__PURE__ */ ie(nr, { apiConfig: u, children: /* @__PURE__ */ ie(
|
|
4639
4654
|
mr,
|
|
4640
4655
|
{
|
|
4641
4656
|
initialThreadId: n,
|
|
4642
4657
|
onError: M,
|
|
4643
4658
|
onThreadChange: b,
|
|
4644
4659
|
children: /* @__PURE__ */ ie(
|
|
4645
|
-
|
|
4660
|
+
jr,
|
|
4646
4661
|
{
|
|
4647
4662
|
initialThreadId: n,
|
|
4648
4663
|
initialCheckpointId: r,
|
|
4649
4664
|
initialCheckpointNs: o,
|
|
4650
4665
|
autoLoadInitial: s,
|
|
4651
4666
|
onError: M,
|
|
4652
|
-
isStreaming:
|
|
4667
|
+
isStreaming: v,
|
|
4653
4668
|
children: /* @__PURE__ */ ie(
|
|
4654
4669
|
Br,
|
|
4655
4670
|
{
|
|
4656
4671
|
...j,
|
|
4657
|
-
onStreamingChange:
|
|
4672
|
+
onStreamingChange: x,
|
|
4658
4673
|
children: e
|
|
4659
4674
|
}
|
|
4660
4675
|
)
|
|
@@ -4664,7 +4679,7 @@ function po({
|
|
|
4664
4679
|
) });
|
|
4665
4680
|
}
|
|
4666
4681
|
function pe(e) {
|
|
4667
|
-
const t =
|
|
4682
|
+
const t = G(e);
|
|
4668
4683
|
return t.current = e, _((...n) => {
|
|
4669
4684
|
const r = t.current;
|
|
4670
4685
|
if (r)
|
|
@@ -4763,49 +4778,49 @@ function Jr() {
|
|
|
4763
4778
|
};
|
|
4764
4779
|
}
|
|
4765
4780
|
function go(e) {
|
|
4766
|
-
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Me(), { toast: o } = Jr(), [s, a] = $({}), [i,
|
|
4767
|
-
l(!1),
|
|
4768
|
-
}, []),
|
|
4769
|
-
|
|
4770
|
-
}, []),
|
|
4771
|
-
async (
|
|
4772
|
-
var
|
|
4781
|
+
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Me(), { toast: o } = Jr(), [s, a] = $({}), [i, d] = $(null), [c, l] = $(!1), f = _(() => {
|
|
4782
|
+
l(!1), d(null);
|
|
4783
|
+
}, []), p = _((I) => {
|
|
4784
|
+
d(I), l(!0);
|
|
4785
|
+
}, []), g = _(
|
|
4786
|
+
async (I, u, v) => {
|
|
4787
|
+
var x, M;
|
|
4773
4788
|
if (!t) {
|
|
4774
|
-
|
|
4789
|
+
I.preventDefault();
|
|
4775
4790
|
return;
|
|
4776
4791
|
}
|
|
4777
|
-
if (s[
|
|
4778
|
-
|
|
4792
|
+
if (s[v]) {
|
|
4793
|
+
I.preventDefault();
|
|
4779
4794
|
return;
|
|
4780
4795
|
}
|
|
4781
4796
|
try {
|
|
4782
|
-
const
|
|
4783
|
-
if (
|
|
4784
|
-
|
|
4785
|
-
const b =
|
|
4786
|
-
|
|
4797
|
+
const A = String(u.url ?? ""), w = A.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
|
|
4798
|
+
if (w) {
|
|
4799
|
+
I.preventDefault();
|
|
4800
|
+
const b = w[1], h = u.name || `file_${b}`, T = u.mimeType || "application/octet-stream";
|
|
4801
|
+
p({ id: b, name: h, mimeType: T });
|
|
4787
4802
|
return;
|
|
4788
4803
|
}
|
|
4789
|
-
if (
|
|
4790
|
-
|
|
4804
|
+
if (A.startsWith("data:")) {
|
|
4805
|
+
I.preventDefault(), a((h) => ({ ...h, [v]: !0 }));
|
|
4791
4806
|
const b = o({ title: "Fetching file...", description: "", open: !0 });
|
|
4792
4807
|
try {
|
|
4793
4808
|
const h = await r.listFiles(n ?? void 0);
|
|
4794
4809
|
if (!h || !Array.isArray(h))
|
|
4795
4810
|
throw new Error("Invalid file list response");
|
|
4796
|
-
const T = h.find((
|
|
4811
|
+
const T = h.find((m) => !m || typeof m != "object" || !((m.filename ?? "") === (u.name ?? "")) ? !1 : typeof u.size == "number" && typeof m.size == "number" ? m.size === u.size : !0);
|
|
4797
4812
|
if (!(T != null && T.id))
|
|
4798
|
-
throw new Error(`File "${
|
|
4813
|
+
throw new Error(`File "${u.name}" is not yet available on the server`);
|
|
4799
4814
|
if (!T.id || !T.filename)
|
|
4800
4815
|
throw new Error("Invalid file data received from server");
|
|
4801
|
-
|
|
4816
|
+
p({
|
|
4802
4817
|
id: T.id,
|
|
4803
|
-
name:
|
|
4804
|
-
mimeType:
|
|
4805
|
-
}), (
|
|
4818
|
+
name: u.name || T.filename || `file_${T.id}`,
|
|
4819
|
+
mimeType: u.mimeType || T.mime_type || "application/octet-stream"
|
|
4820
|
+
}), (x = b.update) == null || x.call(b, {
|
|
4806
4821
|
id: b.id,
|
|
4807
4822
|
title: "Success",
|
|
4808
|
-
description: `Opened ${
|
|
4823
|
+
description: `Opened ${u.name}`,
|
|
4809
4824
|
open: !0
|
|
4810
4825
|
});
|
|
4811
4826
|
} catch (h) {
|
|
@@ -4817,21 +4832,21 @@ function go(e) {
|
|
|
4817
4832
|
open: !0
|
|
4818
4833
|
});
|
|
4819
4834
|
} finally {
|
|
4820
|
-
a((h) => ({ ...h, [
|
|
4835
|
+
a((h) => ({ ...h, [v]: !1 }));
|
|
4821
4836
|
}
|
|
4822
4837
|
}
|
|
4823
|
-
} catch (
|
|
4824
|
-
console.error("File click error:",
|
|
4838
|
+
} catch (A) {
|
|
4839
|
+
console.error("File click error:", A), a((w) => ({ ...w, [v]: !1 }));
|
|
4825
4840
|
}
|
|
4826
4841
|
},
|
|
4827
|
-
[t, s, o, n,
|
|
4842
|
+
[t, s, o, n, p]
|
|
4828
4843
|
);
|
|
4829
4844
|
return {
|
|
4830
4845
|
uploadingFiles: s,
|
|
4831
|
-
handleFileClick:
|
|
4846
|
+
handleFileClick: g,
|
|
4832
4847
|
fileViewerOpen: c,
|
|
4833
4848
|
currentFileInfo: i,
|
|
4834
|
-
closeFileViewer:
|
|
4849
|
+
closeFileViewer: f
|
|
4835
4850
|
};
|
|
4836
4851
|
}
|
|
4837
4852
|
function mo(e) {
|
|
@@ -4876,16 +4891,16 @@ function Qr(e) {
|
|
|
4876
4891
|
function yo(e) {
|
|
4877
4892
|
return Y(() => {
|
|
4878
4893
|
const t = e.content.filter(
|
|
4879
|
-
(
|
|
4894
|
+
(d) => d.type === "text"
|
|
4880
4895
|
);
|
|
4881
4896
|
if (!t.length)
|
|
4882
4897
|
return null;
|
|
4883
4898
|
let r = t.flatMap(
|
|
4884
|
-
(
|
|
4899
|
+
(d) => Xr(d.text ?? "")
|
|
4885
4900
|
);
|
|
4886
4901
|
if (!r.length) {
|
|
4887
|
-
const
|
|
4888
|
-
`), c = tt(
|
|
4902
|
+
const d = t.map((l) => l.text ?? "").join(`
|
|
4903
|
+
`), c = tt(d);
|
|
4889
4904
|
c && typeof c == "object" && (r = [c]);
|
|
4890
4905
|
}
|
|
4891
4906
|
if (!r.length)
|
|
@@ -4908,23 +4923,23 @@ function yo(e) {
|
|
|
4908
4923
|
}
|
|
4909
4924
|
function Yr(e) {
|
|
4910
4925
|
var C, O;
|
|
4911
|
-
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r = ot({ optional: !0 }), o = Vt({ optional: !0 }), s = Or(), { currentThreadId: a, setCurrentThreadId: i, actions:
|
|
4926
|
+
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r = ot({ optional: !0 }), o = Vt({ optional: !0 }), s = Or(), { currentThreadId: a, setCurrentThreadId: i, actions: d } = r || {
|
|
4912
4927
|
currentThreadId: null,
|
|
4913
4928
|
setCurrentThreadId: () => {
|
|
4914
4929
|
},
|
|
4915
4930
|
actions: {}
|
|
4916
|
-
}, c = !!t && t !== a, [l,
|
|
4917
|
-
|
|
4931
|
+
}, c = !!t && t !== a, [l, f] = $([]), p = _((F) => {
|
|
4932
|
+
f(F);
|
|
4918
4933
|
}, []), {
|
|
4919
|
-
isLoadingThread:
|
|
4920
|
-
threadStateError:
|
|
4921
|
-
threadCheckpoints:
|
|
4922
|
-
isLoadingHistory:
|
|
4923
|
-
loadThread:
|
|
4934
|
+
isLoadingThread: g,
|
|
4935
|
+
threadStateError: I,
|
|
4936
|
+
threadCheckpoints: u,
|
|
4937
|
+
isLoadingHistory: v,
|
|
4938
|
+
loadThread: x
|
|
4924
4939
|
} = $t({
|
|
4925
4940
|
api: Me().chatApi,
|
|
4926
4941
|
fileApi: Me().fileApi,
|
|
4927
|
-
seed:
|
|
4942
|
+
seed: p,
|
|
4928
4943
|
currentThreadId: c ? t : null,
|
|
4929
4944
|
initialThreadId: c ? t : null,
|
|
4930
4945
|
isStreaming: !1,
|
|
@@ -4936,19 +4951,19 @@ function Yr(e) {
|
|
|
4936
4951
|
}, [c, n, a, o == null ? void 0 : o.loadThread]);
|
|
4937
4952
|
const M = Y(() => {
|
|
4938
4953
|
var F;
|
|
4939
|
-
return ((F =
|
|
4940
|
-
}, [
|
|
4954
|
+
return ((F = u[0]) == null ? void 0 : F.values) || {};
|
|
4955
|
+
}, [u]), A = Y(() => ({ timeline: [], messagePreviews: {} }), []), w = t || a, b = c ? g ? "loading" : "idle" : (o == null ? void 0 : o.status) || "idle", h = c ? l : (s == null ? void 0 : s.messages) || [], T = c ? g : (o == null ? void 0 : o.isLoading) || !1, m = c ? v : (o == null ? void 0 : o.isLoadingHistory) || !1, k = c ? M : (o == null ? void 0 : o.values) || {}, E = c ? {} : (o == null ? void 0 : o.taskMessagesByScope) || {}, j = c ? I : (s == null ? void 0 : s.error) || (o == null ? void 0 : o.error) || null;
|
|
4941
4956
|
return {
|
|
4942
4957
|
// UNIFIED: Single thread ID concept
|
|
4943
|
-
threadId:
|
|
4958
|
+
threadId: w,
|
|
4944
4959
|
status: b,
|
|
4945
4960
|
messages: h,
|
|
4946
4961
|
isLoading: T,
|
|
4947
|
-
isHistoryLoading:
|
|
4962
|
+
isHistoryLoading: m,
|
|
4948
4963
|
error: j,
|
|
4949
4964
|
// Values & Metadata
|
|
4950
|
-
values:
|
|
4951
|
-
taskMessagesByScope:
|
|
4965
|
+
values: k,
|
|
4966
|
+
taskMessagesByScope: E,
|
|
4952
4967
|
metadata: c ? {} : o == null ? void 0 : o.metadata,
|
|
4953
4968
|
// Actions & State relating to Global/Active Thread only
|
|
4954
4969
|
navigateToCheckpoint: c ? async () => {
|
|
@@ -4957,9 +4972,9 @@ function Yr(e) {
|
|
|
4957
4972
|
returnToLatest: c ? async () => {
|
|
4958
4973
|
} : (o == null ? void 0 : o.returnToLatest) || (async () => {
|
|
4959
4974
|
}),
|
|
4960
|
-
checkpoint: c ?
|
|
4961
|
-
checkpoints: c ?
|
|
4962
|
-
checkpointIndex: c ?
|
|
4975
|
+
checkpoint: c ? u[0] ? { id: u[0].checkpointId, namespace: u[0].checkpointNs } : null : (o == null ? void 0 : o.checkpoint) || null,
|
|
4976
|
+
checkpoints: c ? u : (o == null ? void 0 : o.checkpoints) || [],
|
|
4977
|
+
checkpointIndex: c ? A : (o == null ? void 0 : o.checkpointIndex) || { timeline: [], messagePreviews: {} },
|
|
4963
4978
|
interrupt: c ? null : (o == null ? void 0 : o.interrupt) || null,
|
|
4964
4979
|
respondToInterrupt: c ? async () => {
|
|
4965
4980
|
} : (o == null ? void 0 : o.respondToInterrupt) || (async () => {
|
|
@@ -4980,16 +4995,16 @@ function Yr(e) {
|
|
|
4980
4995
|
}),
|
|
4981
4996
|
setCurrentThreadId: i,
|
|
4982
4997
|
loadHistory: c ? async () => {
|
|
4983
|
-
t && await
|
|
4998
|
+
t && await x(t);
|
|
4984
4999
|
} : async () => {
|
|
4985
5000
|
},
|
|
4986
5001
|
onEvent: c ? () => {
|
|
4987
5002
|
} : (o == null ? void 0 : o.onEvent) || (() => {
|
|
4988
5003
|
}),
|
|
4989
5004
|
// Thread Management
|
|
4990
|
-
createThread:
|
|
4991
|
-
deleteThread:
|
|
4992
|
-
renameThread:
|
|
5005
|
+
createThread: d == null ? void 0 : d.createThread,
|
|
5006
|
+
deleteThread: d == null ? void 0 : d.deleteThread,
|
|
5007
|
+
renameThread: d == null ? void 0 : d.renameThread,
|
|
4993
5008
|
threads: (r == null ? void 0 : r.threads) || [],
|
|
4994
5009
|
isThreadsLoading: (r == null ? void 0 : r.isLoading) || !1
|
|
4995
5010
|
};
|
|
@@ -5003,51 +5018,51 @@ function ho({
|
|
|
5003
5018
|
onExcelUploadSuccess: s,
|
|
5004
5019
|
onError: a,
|
|
5005
5020
|
enableMessageEditing: i,
|
|
5006
|
-
messages:
|
|
5021
|
+
messages: d,
|
|
5007
5022
|
setPendingAssistantResponse: c,
|
|
5008
5023
|
project: l,
|
|
5009
|
-
onEvent:
|
|
5010
|
-
threadId:
|
|
5011
|
-
clearComposerOnSend:
|
|
5024
|
+
onEvent: f,
|
|
5025
|
+
threadId: p,
|
|
5026
|
+
clearComposerOnSend: g = !0
|
|
5012
5027
|
}) {
|
|
5013
|
-
const { messages:
|
|
5028
|
+
const { messages: I } = Yr(), [u, v] = $(null), [x, M] = $(""), [A, w] = $(null), [b, h] = $(null), [T, m] = $(!1), [k, E] = $(""), j = G(k), C = G(null);
|
|
5014
5029
|
X(() => {
|
|
5015
|
-
if (!
|
|
5016
|
-
if (
|
|
5017
|
-
const y = localStorage.getItem(Ge(
|
|
5018
|
-
|
|
5030
|
+
if (!u)
|
|
5031
|
+
if (p) {
|
|
5032
|
+
const y = localStorage.getItem(Ge(p));
|
|
5033
|
+
E(y || "");
|
|
5019
5034
|
} else
|
|
5020
|
-
|
|
5021
|
-
}, [
|
|
5035
|
+
E("");
|
|
5036
|
+
}, [p, u]);
|
|
5022
5037
|
const O = _((y) => {
|
|
5023
|
-
|
|
5024
|
-
}, [
|
|
5038
|
+
E(y), !u && p && localStorage.setItem(Ge(p), y);
|
|
5039
|
+
}, [p, u]);
|
|
5025
5040
|
X(() => {
|
|
5026
|
-
j.current =
|
|
5027
|
-
}, [
|
|
5028
|
-
if (!
|
|
5041
|
+
j.current = k;
|
|
5042
|
+
}, [k]), X(() => {
|
|
5043
|
+
if (!u) {
|
|
5029
5044
|
C.current = null;
|
|
5030
5045
|
return;
|
|
5031
5046
|
}
|
|
5032
|
-
C.current === null && (C.current = j.current), O(
|
|
5033
|
-
}, [
|
|
5047
|
+
C.current === null && (C.current = j.current), O(x ?? "");
|
|
5048
|
+
}, [x, u, O]);
|
|
5034
5049
|
const F = _(
|
|
5035
5050
|
(y) => {
|
|
5036
5051
|
O(y);
|
|
5037
5052
|
},
|
|
5038
5053
|
[O]
|
|
5039
|
-
),
|
|
5040
|
-
const S = Array.isArray(
|
|
5041
|
-
if (!(!
|
|
5054
|
+
), P = async (y, L) => {
|
|
5055
|
+
const S = Array.isArray(L) ? { files: L } : L ?? {}, W = S.files ?? [], K = S.contentParts ?? [], V = y.trim();
|
|
5056
|
+
if (!(!V && W.length === 0 && K.length === 0))
|
|
5042
5057
|
try {
|
|
5043
|
-
const ee =
|
|
5058
|
+
const ee = W.map(async (Q) => {
|
|
5044
5059
|
try {
|
|
5045
5060
|
const Z = await Rt.uploadFile(Q);
|
|
5046
5061
|
return { file: Q, record: Z };
|
|
5047
5062
|
} catch (Z) {
|
|
5048
5063
|
throw console.error("Failed to upload file", Q.name, Z), new Error(`Failed to upload ${Q.name}`);
|
|
5049
5064
|
}
|
|
5050
|
-
}),
|
|
5065
|
+
}), de = (await Promise.all(ee)).map(({ record: Q }) => {
|
|
5051
5066
|
const Z = Q.mime_type;
|
|
5052
5067
|
return Z.startsWith("image/") ? {
|
|
5053
5068
|
type: "image_url",
|
|
@@ -5059,28 +5074,28 @@ function ho({
|
|
|
5059
5074
|
name: Q.filename,
|
|
5060
5075
|
size: Q.size
|
|
5061
5076
|
};
|
|
5062
|
-
}),
|
|
5077
|
+
}), H = [...K, ...de], te = u ? (A == null ? void 0 : A.checkpointId) ?? n ?? void 0 : n ?? void 0, ke = u ? (A == null ? void 0 : A.checkpointNs) ?? r ?? void 0 : r ?? void 0;
|
|
5063
5078
|
await e(
|
|
5064
5079
|
{
|
|
5065
|
-
text:
|
|
5066
|
-
contentParts:
|
|
5067
|
-
attachments:
|
|
5080
|
+
text: V || "",
|
|
5081
|
+
contentParts: H,
|
|
5082
|
+
attachments: W,
|
|
5068
5083
|
payload: t.payload,
|
|
5069
|
-
edit: !!
|
|
5084
|
+
edit: !!u,
|
|
5070
5085
|
checkpointId: te,
|
|
5071
5086
|
checkpointNs: ke,
|
|
5072
5087
|
project: l ?? void 0,
|
|
5073
|
-
originalMessageId:
|
|
5088
|
+
originalMessageId: u ?? void 0,
|
|
5074
5089
|
config: t.config
|
|
5075
5090
|
},
|
|
5076
|
-
|
|
5077
|
-
), o == null || o(
|
|
5091
|
+
f ? { onEvent: f } : void 0
|
|
5092
|
+
), o == null || o(V), c(!0), g && (p && localStorage.removeItem(Ge(p)), O("")), h(null), v(null), M(""), w(null);
|
|
5078
5093
|
} catch (ee) {
|
|
5079
5094
|
const re = (ee == null ? void 0 : ee.message) || "Failed to send message";
|
|
5080
5095
|
h(re), a == null || a(re), c(!1);
|
|
5081
5096
|
}
|
|
5082
|
-
}, B = (y,
|
|
5083
|
-
|
|
5097
|
+
}, B = (y, L) => {
|
|
5098
|
+
L || P(y, { files: [] });
|
|
5084
5099
|
}, z = _(
|
|
5085
5100
|
async (y) => {
|
|
5086
5101
|
await e(
|
|
@@ -5092,73 +5107,73 @@ function ho({
|
|
|
5092
5107
|
project: l ?? void 0,
|
|
5093
5108
|
config: t.config
|
|
5094
5109
|
},
|
|
5095
|
-
|
|
5110
|
+
f ? { onEvent: f } : void 0
|
|
5096
5111
|
), s == null || s({ file: y });
|
|
5097
5112
|
},
|
|
5098
5113
|
[n, r, t, s, e]
|
|
5099
|
-
),
|
|
5100
|
-
(y,
|
|
5101
|
-
i && (C.current =
|
|
5114
|
+
), J = _(
|
|
5115
|
+
(y, L, S) => {
|
|
5116
|
+
i && (C.current = k, v(y), M(L), w({
|
|
5102
5117
|
checkpointId: (S == null ? void 0 : S.checkpointId) ?? null,
|
|
5103
5118
|
checkpointNs: (S == null ? void 0 : S.checkpointNs) ?? null
|
|
5104
5119
|
}), h(null));
|
|
5105
5120
|
},
|
|
5106
|
-
[
|
|
5107
|
-
),
|
|
5108
|
-
|
|
5121
|
+
[k, i]
|
|
5122
|
+
), U = _(() => {
|
|
5123
|
+
v(null), M(""), w(null), h(null);
|
|
5109
5124
|
const y = C.current;
|
|
5110
|
-
y !== null &&
|
|
5111
|
-
}, []),
|
|
5112
|
-
let
|
|
5113
|
-
for (let
|
|
5114
|
-
if (
|
|
5115
|
-
|
|
5125
|
+
y !== null && E(y), C.current = null;
|
|
5126
|
+
}, []), R = _((y) => {
|
|
5127
|
+
let L = null;
|
|
5128
|
+
for (let V = y - 1; V >= 0; V--)
|
|
5129
|
+
if (d[V].role === "user") {
|
|
5130
|
+
L = d[V];
|
|
5116
5131
|
break;
|
|
5117
5132
|
}
|
|
5118
|
-
if (!
|
|
5119
|
-
const S = Array.isArray(
|
|
5133
|
+
if (!L) return;
|
|
5134
|
+
const S = Array.isArray(L.content) ? L.content : [], K = S.filter((V) => (V == null ? void 0 : V.type) === "text").map((V) => V.text).join("") || (() => {
|
|
5120
5135
|
try {
|
|
5121
5136
|
return JSON.stringify(S, null, 2);
|
|
5122
5137
|
} catch {
|
|
5123
5138
|
return String(S);
|
|
5124
5139
|
}
|
|
5125
5140
|
})();
|
|
5126
|
-
|
|
5141
|
+
K && e(
|
|
5127
5142
|
{
|
|
5128
|
-
text:
|
|
5143
|
+
text: K,
|
|
5129
5144
|
payload: t.payload,
|
|
5130
5145
|
checkpointId: n ?? void 0,
|
|
5131
5146
|
checkpointNs: r ?? void 0,
|
|
5132
5147
|
edit: !0,
|
|
5133
|
-
originalMessageId:
|
|
5148
|
+
originalMessageId: L.id,
|
|
5134
5149
|
config: t.config
|
|
5135
5150
|
},
|
|
5136
|
-
|
|
5151
|
+
f ? { onEvent: f } : void 0
|
|
5137
5152
|
);
|
|
5138
|
-
}, [
|
|
5153
|
+
}, [d, e, n, r, t]);
|
|
5139
5154
|
return {
|
|
5140
|
-
editingMessageId:
|
|
5141
|
-
editingInitialValue:
|
|
5155
|
+
editingMessageId: u,
|
|
5156
|
+
editingInitialValue: x,
|
|
5142
5157
|
inputError: b,
|
|
5143
5158
|
setInputError: h,
|
|
5144
5159
|
dismissError: T,
|
|
5145
|
-
setDismissError:
|
|
5146
|
-
composerValue:
|
|
5160
|
+
setDismissError: m,
|
|
5161
|
+
composerValue: k,
|
|
5147
5162
|
handleComposerChange: F,
|
|
5148
|
-
handleSendMessage:
|
|
5163
|
+
handleSendMessage: P,
|
|
5149
5164
|
handleQuickPrompt: B,
|
|
5150
5165
|
handleExcelUpload: z,
|
|
5151
|
-
startEditing:
|
|
5152
|
-
cancelEditing:
|
|
5153
|
-
handleRegenerateCb:
|
|
5154
|
-
displayMessages:
|
|
5166
|
+
startEditing: J,
|
|
5167
|
+
cancelEditing: U,
|
|
5168
|
+
handleRegenerateCb: R,
|
|
5169
|
+
displayMessages: I
|
|
5155
5170
|
};
|
|
5156
5171
|
}
|
|
5157
5172
|
function bo(e) {
|
|
5158
5173
|
return Y(() => e ? {
|
|
5159
5174
|
textContent: Ln(e),
|
|
5160
|
-
imageParts:
|
|
5161
|
-
fileParts:
|
|
5175
|
+
imageParts: jn(e),
|
|
5176
|
+
fileParts: Un(e),
|
|
5162
5177
|
toolCalls: Mt(e),
|
|
5163
5178
|
contentParts: e.content
|
|
5164
5179
|
} : {
|
|
@@ -5170,7 +5185,7 @@ function bo(e) {
|
|
|
5170
5185
|
}, [e]);
|
|
5171
5186
|
}
|
|
5172
5187
|
function wo(e, t, n) {
|
|
5173
|
-
const [r, o] = $(e), s =
|
|
5188
|
+
const [r, o] = $(e), s = G(e), a = G(null);
|
|
5174
5189
|
return X(() => {
|
|
5175
5190
|
s.current = e;
|
|
5176
5191
|
const i = () => {
|
|
@@ -5189,7 +5204,7 @@ function wo(e, t, n) {
|
|
|
5189
5204
|
}
|
|
5190
5205
|
export {
|
|
5191
5206
|
po as ChatProviders,
|
|
5192
|
-
|
|
5207
|
+
jr as ThreadStateProvider,
|
|
5193
5208
|
mr as ThreadsProvider,
|
|
5194
5209
|
ro as cn,
|
|
5195
5210
|
sr as collectText,
|
|
@@ -5205,7 +5220,7 @@ export {
|
|
|
5205
5220
|
so as hasContent,
|
|
5206
5221
|
mt as hydrateHistorySnapshots,
|
|
5207
5222
|
Ct as isFileLike,
|
|
5208
|
-
|
|
5223
|
+
Nn as looksLikeMarkdown,
|
|
5209
5224
|
lo as messageSignature,
|
|
5210
5225
|
io as normalizeInterruptId,
|
|
5211
5226
|
_t as onChatTokenChanged,
|
|
@@ -5213,7 +5228,7 @@ export {
|
|
|
5213
5228
|
Et as pretty,
|
|
5214
5229
|
Mr as refreshHistoryFileUrls,
|
|
5215
5230
|
Ke as sanitizeForDisplay,
|
|
5216
|
-
|
|
5231
|
+
Ie as setChatToken,
|
|
5217
5232
|
Fn as stringifyTool,
|
|
5218
5233
|
Me as useApi,
|
|
5219
5234
|
ho as useChatController,
|