@teodorruskvi/chat-core 0.1.37 → 0.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/features/conversation/hooks/useChatSession.d.ts +0 -1
- package/dist/features/conversation/hooks/useThreadsState.d.ts +1 -9
- package/dist/features/streaming/contexts/types.d.ts +0 -8
- package/dist/index.esm.js +1211 -1328
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +7 -7
- package/dist/index.umd.js.map +1 -1
- package/dist/shared/core/api/clients/chatClient.d.ts +2 -8
- package/dist/types/api/runs.d.ts +0 -19
- package/dist/types/core.d.ts +0 -6
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var Gt = Object.defineProperty;
|
|
2
|
+
var Ht = (e, t, n) => t in e ? Gt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var st = (e, t, n) => Ht(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { jsx as ie } from "react/jsx-runtime";
|
|
5
|
-
import * as
|
|
6
|
-
import { createContext as Se, useContext as Ue, useState as
|
|
7
|
-
import
|
|
8
|
-
function
|
|
5
|
+
import * as at from "react";
|
|
6
|
+
import { createContext as Se, useContext as Ue, useState as $, useRef as K, useEffect as W, useCallback as U, useMemo as X, useReducer as Wt } from "react";
|
|
7
|
+
import qt, { isCancel as Jt } from "axios";
|
|
8
|
+
function vt(e) {
|
|
9
9
|
var t, n, r = "";
|
|
10
10
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
11
11
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
12
12
|
var o = e.length;
|
|
13
|
-
for (t = 0; t < o; t++) e[t] && (n =
|
|
13
|
+
for (t = 0; t < o; t++) e[t] && (n = vt(e[t])) && (r && (r += " "), r += n);
|
|
14
14
|
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
15
15
|
return r;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t =
|
|
17
|
+
function Xt() {
|
|
18
|
+
for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t = vt(e)) && (r && (r += " "), r += t);
|
|
19
19
|
return r;
|
|
20
20
|
}
|
|
21
|
-
const
|
|
22
|
-
const t =
|
|
21
|
+
const Ze = "-", Qt = (e) => {
|
|
22
|
+
const t = Zt(e), {
|
|
23
23
|
conflictingClassGroups: n,
|
|
24
24
|
conflictingClassGroupModifiers: r
|
|
25
25
|
} = e;
|
|
26
26
|
return {
|
|
27
27
|
getClassGroupId: (a) => {
|
|
28
|
-
const i = a.split(
|
|
29
|
-
return i[0] === "" && i.length !== 1 && i.shift(),
|
|
28
|
+
const i = a.split(Ze);
|
|
29
|
+
return i[0] === "" && i.length !== 1 && i.shift(), kt(i, t) || Yt(a);
|
|
30
30
|
},
|
|
31
31
|
getConflictingClassGroupIds: (a, i) => {
|
|
32
32
|
const u = n[a] || [];
|
|
33
33
|
return i && r[a] ? [...u, ...r[a]] : u;
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
},
|
|
36
|
+
}, kt = (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 ? kt(e.slice(1), r) : void 0;
|
|
41
41
|
if (o)
|
|
42
42
|
return o;
|
|
43
43
|
if (t.validators.length === 0)
|
|
44
44
|
return;
|
|
45
|
-
const s = e.join(
|
|
45
|
+
const s = e.join(Ze);
|
|
46
46
|
return (a = t.validators.find(({
|
|
47
47
|
validator: i
|
|
48
48
|
}) => i(s))) == null ? void 0 : a.classGroupId;
|
|
49
|
-
},
|
|
50
|
-
if (
|
|
51
|
-
const t =
|
|
49
|
+
}, it = /^\[(.+)\]$/, Yt = (e) => {
|
|
50
|
+
if (it.test(e)) {
|
|
51
|
+
const t = it.exec(e)[1], n = t == null ? void 0 : t.substring(0, t.indexOf(":"));
|
|
52
52
|
if (n)
|
|
53
53
|
return "arbitrary.." + n;
|
|
54
54
|
}
|
|
55
|
-
},
|
|
55
|
+
}, Zt = (e) => {
|
|
56
56
|
const {
|
|
57
57
|
theme: t,
|
|
58
58
|
prefix: n
|
|
@@ -60,19 +60,19 @@ const et = "-", Zt = (e) => {
|
|
|
60
60
|
nextPart: /* @__PURE__ */ new Map(),
|
|
61
61
|
validators: []
|
|
62
62
|
};
|
|
63
|
-
return
|
|
64
|
-
|
|
63
|
+
return tn(Object.entries(e.classGroups), n).forEach(([s, a]) => {
|
|
64
|
+
Je(a, r, s, t);
|
|
65
65
|
}), r;
|
|
66
|
-
},
|
|
66
|
+
}, Je = (e, t, n, r) => {
|
|
67
67
|
e.forEach((o) => {
|
|
68
68
|
if (typeof o == "string") {
|
|
69
|
-
const s = o === "" ? t :
|
|
69
|
+
const s = o === "" ? t : ct(t, o);
|
|
70
70
|
s.classGroupId = n;
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
if (typeof o == "function") {
|
|
74
|
-
if (
|
|
75
|
-
|
|
74
|
+
if (en(o)) {
|
|
75
|
+
Je(o(r), t, n, r);
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
t.validators.push({
|
|
@@ -82,21 +82,21 @@ const et = "-", Zt = (e) => {
|
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
84
|
Object.entries(o).forEach(([s, a]) => {
|
|
85
|
-
|
|
85
|
+
Je(a, ct(t, s), n, r);
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
|
-
},
|
|
88
|
+
}, ct = (e, t) => {
|
|
89
89
|
let n = e;
|
|
90
|
-
return t.split(
|
|
90
|
+
return t.split(Ze).forEach((r) => {
|
|
91
91
|
n.nextPart.has(r) || n.nextPart.set(r, {
|
|
92
92
|
nextPart: /* @__PURE__ */ new Map(),
|
|
93
93
|
validators: []
|
|
94
94
|
}), n = n.nextPart.get(r);
|
|
95
95
|
}), n;
|
|
96
|
-
},
|
|
96
|
+
}, en = (e) => e.isThemeGetter, tn = (e, t) => t ? e.map(([n, r]) => {
|
|
97
97
|
const o = r.map((s) => typeof s == "string" ? t + s : typeof s == "object" ? Object.fromEntries(Object.entries(s).map(([a, i]) => [t + a, i])) : s);
|
|
98
98
|
return [n, o];
|
|
99
|
-
}) : e,
|
|
99
|
+
}) : e, nn = (e) => {
|
|
100
100
|
if (e < 1)
|
|
101
101
|
return {
|
|
102
102
|
get: () => {
|
|
@@ -120,40 +120,40 @@ const et = "-", Zt = (e) => {
|
|
|
120
120
|
n.has(s) ? n.set(s, a) : o(s, a);
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
},
|
|
123
|
+
}, It = "!", rn = (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
128
|
const u = [];
|
|
129
129
|
let c = 0, l = 0, p;
|
|
130
|
-
for (let
|
|
131
|
-
let
|
|
130
|
+
for (let v = 0; v < i.length; v++) {
|
|
131
|
+
let I = i[v];
|
|
132
132
|
if (c === 0) {
|
|
133
|
-
if (
|
|
134
|
-
u.push(i.slice(l,
|
|
133
|
+
if (I === o && (r || i.slice(v, v + s) === t)) {
|
|
134
|
+
u.push(i.slice(l, v)), l = v + s;
|
|
135
135
|
continue;
|
|
136
136
|
}
|
|
137
|
-
if (
|
|
138
|
-
p =
|
|
137
|
+
if (I === "/") {
|
|
138
|
+
p = v;
|
|
139
139
|
continue;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
I === "[" ? c++ : I === "]" && c--;
|
|
143
143
|
}
|
|
144
|
-
const m = u.length === 0 ? i : i.substring(l), h = m.startsWith(
|
|
144
|
+
const m = u.length === 0 ? i : i.substring(l), h = m.startsWith(It), k = h ? m.substring(1) : m, d = p && p > l ? p - l : void 0;
|
|
145
145
|
return {
|
|
146
146
|
modifiers: u,
|
|
147
147
|
hasImportantModifier: h,
|
|
148
|
-
baseClassName:
|
|
149
|
-
maybePostfixModifierPosition:
|
|
148
|
+
baseClassName: k,
|
|
149
|
+
maybePostfixModifierPosition: d
|
|
150
150
|
};
|
|
151
151
|
};
|
|
152
152
|
return n ? (i) => n({
|
|
153
153
|
className: i,
|
|
154
154
|
parseClassName: a
|
|
155
155
|
}) : a;
|
|
156
|
-
},
|
|
156
|
+
}, on = (e) => {
|
|
157
157
|
if (e.length <= 1)
|
|
158
158
|
return e;
|
|
159
159
|
const t = [];
|
|
@@ -161,16 +161,16 @@ const et = "-", Zt = (e) => {
|
|
|
161
161
|
return e.forEach((r) => {
|
|
162
162
|
r[0] === "[" ? (t.push(...n.sort(), r), n = []) : n.push(r);
|
|
163
163
|
}), t.push(...n.sort()), t;
|
|
164
|
-
},
|
|
165
|
-
cache:
|
|
166
|
-
parseClassName:
|
|
167
|
-
...
|
|
168
|
-
}),
|
|
164
|
+
}, sn = (e) => ({
|
|
165
|
+
cache: nn(e.cacheSize),
|
|
166
|
+
parseClassName: rn(e),
|
|
167
|
+
...Qt(e)
|
|
168
|
+
}), an = /\s+/, cn = (e, t) => {
|
|
169
169
|
const {
|
|
170
170
|
parseClassName: n,
|
|
171
171
|
getClassGroupId: r,
|
|
172
172
|
getConflictingClassGroupIds: o
|
|
173
|
-
} = t, s = [], a = e.trim().split(
|
|
173
|
+
} = t, s = [], a = e.trim().split(an);
|
|
174
174
|
let i = "";
|
|
175
175
|
for (let u = a.length - 1; u >= 0; u -= 1) {
|
|
176
176
|
const c = a[u], {
|
|
@@ -179,104 +179,104 @@ const et = "-", Zt = (e) => {
|
|
|
179
179
|
baseClassName: m,
|
|
180
180
|
maybePostfixModifierPosition: h
|
|
181
181
|
} = n(c);
|
|
182
|
-
let
|
|
183
|
-
if (!
|
|
184
|
-
if (!
|
|
182
|
+
let k = !!h, d = r(k ? m.substring(0, h) : m);
|
|
183
|
+
if (!d) {
|
|
184
|
+
if (!k) {
|
|
185
185
|
i = c + (i.length > 0 ? " " + i : i);
|
|
186
186
|
continue;
|
|
187
187
|
}
|
|
188
|
-
if (
|
|
188
|
+
if (d = r(m), !d) {
|
|
189
189
|
i = c + (i.length > 0 ? " " + i : i);
|
|
190
190
|
continue;
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
k = !1;
|
|
193
193
|
}
|
|
194
|
-
const
|
|
195
|
-
if (s.includes(
|
|
194
|
+
const v = on(l).join(":"), I = p ? v + It : v, A = I + d;
|
|
195
|
+
if (s.includes(A))
|
|
196
196
|
continue;
|
|
197
|
-
s.push(
|
|
198
|
-
const
|
|
199
|
-
for (let N = 0; N <
|
|
200
|
-
const
|
|
201
|
-
s.push(
|
|
197
|
+
s.push(A);
|
|
198
|
+
const T = o(d, k);
|
|
199
|
+
for (let N = 0; N < T.length; ++N) {
|
|
200
|
+
const b = T[N];
|
|
201
|
+
s.push(I + b);
|
|
202
202
|
}
|
|
203
203
|
i = c + (i.length > 0 ? " " + i : i);
|
|
204
204
|
}
|
|
205
205
|
return i;
|
|
206
206
|
};
|
|
207
|
-
function
|
|
207
|
+
function ln() {
|
|
208
208
|
let e = 0, t, n, r = "";
|
|
209
209
|
for (; e < arguments.length; )
|
|
210
|
-
(t = arguments[e++]) && (n =
|
|
210
|
+
(t = arguments[e++]) && (n = Tt(t)) && (r && (r += " "), r += n);
|
|
211
211
|
return r;
|
|
212
212
|
}
|
|
213
|
-
const
|
|
213
|
+
const Tt = (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 = Tt(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
223
|
function a(u) {
|
|
224
224
|
const c = t.reduce((l, p) => p(l), e());
|
|
225
|
-
return n =
|
|
225
|
+
return n = sn(c), r = n.cache.get, o = n.cache.set, s = i, i(u);
|
|
226
226
|
}
|
|
227
227
|
function i(u) {
|
|
228
228
|
const c = r(u);
|
|
229
229
|
if (c)
|
|
230
230
|
return c;
|
|
231
|
-
const l =
|
|
231
|
+
const l = cn(u, n);
|
|
232
232
|
return o(u, l), l;
|
|
233
233
|
}
|
|
234
234
|
return function() {
|
|
235
|
-
return s(
|
|
235
|
+
return s(ln.apply(null, arguments));
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
|
-
const
|
|
238
|
+
const B = (e) => {
|
|
239
239
|
const t = (n) => n[e] || [];
|
|
240
240
|
return t.isThemeGetter = !0, t;
|
|
241
|
-
},
|
|
242
|
-
const r =
|
|
241
|
+
}, xt = /^\[(?:([a-z-]+):)?(.+)\]$/i, dn = /^\d+\/\d+$/, fn = /* @__PURE__ */ new Set(["px", "full", "screen"]), pn = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, gn = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, mn = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, hn = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, yn = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, fe = (e) => xe(e) || fn.has(e) || dn.test(e), be = (e) => Ce(e, "length", An), xe = (e) => !!e && !Number.isNaN(Number(e)), Ke = (e) => Ce(e, "number", xe), Pe = (e) => !!e && Number.isInteger(Number(e)), bn = (e) => e.endsWith("%") && xe(e.slice(0, -1)), R = (e) => xt.test(e), we = (e) => pn.test(e), wn = /* @__PURE__ */ new Set(["length", "size", "percentage"]), vn = (e) => Ce(e, wn, At), kn = (e) => Ce(e, "position", At), In = /* @__PURE__ */ new Set(["image", "url"]), Tn = (e) => Ce(e, In, Cn), xn = (e) => Ce(e, "", Sn), Ne = () => !0, Ce = (e, t, n) => {
|
|
242
|
+
const r = xt.exec(e);
|
|
243
243
|
return r ? r[1] ? typeof t == "string" ? r[1] === t : t.has(r[1]) : n(r[2]) : !1;
|
|
244
|
-
},
|
|
244
|
+
}, An = (e) => (
|
|
245
245
|
// `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
|
|
246
246
|
// For example, `hsl(0 0% 0%)` would be classified as a length without this check.
|
|
247
247
|
// I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
|
|
248
|
-
|
|
249
|
-
),
|
|
250
|
-
const e =
|
|
248
|
+
gn.test(e) && !mn.test(e)
|
|
249
|
+
), At = () => !1, Sn = (e) => hn.test(e), Cn = (e) => yn.test(e), Mn = () => {
|
|
250
|
+
const e = B("colors"), t = B("spacing"), n = B("blur"), r = B("brightness"), o = B("borderColor"), s = B("borderRadius"), a = B("borderSpacing"), i = B("borderWidth"), u = B("contrast"), c = B("grayscale"), l = B("hueRotate"), p = B("invert"), m = B("gap"), h = B("gradientColorStops"), k = B("gradientColorStopPositions"), d = B("inset"), v = B("margin"), I = B("opacity"), A = B("padding"), T = B("saturate"), N = B("scale"), b = B("sepia"), y = B("skew"), x = B("space"), g = B("translate"), w = () => ["auto", "contain", "none"], z = () => ["auto", "hidden", "clip", "visible", "scroll"], j = () => ["auto", R, t], S = () => [R, t], C = () => ["", fe, be], L = () => ["auto", xe, R], _ = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], O = () => ["solid", "dashed", "dotted", "double", "none"], F = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], G = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], E = () => ["", "0", R], D = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], Q = () => [xe, R];
|
|
251
251
|
return {
|
|
252
252
|
cacheSize: 500,
|
|
253
253
|
separator: ":",
|
|
254
254
|
theme: {
|
|
255
|
-
colors: [
|
|
255
|
+
colors: [Ne],
|
|
256
256
|
spacing: [fe, be],
|
|
257
|
-
blur: ["none", "", we,
|
|
258
|
-
brightness:
|
|
257
|
+
blur: ["none", "", we, R],
|
|
258
|
+
brightness: Q(),
|
|
259
259
|
borderColor: [e],
|
|
260
|
-
borderRadius: ["none", "", "full", we,
|
|
261
|
-
borderSpacing:
|
|
262
|
-
borderWidth:
|
|
263
|
-
contrast:
|
|
264
|
-
grayscale:
|
|
265
|
-
hueRotate:
|
|
266
|
-
invert:
|
|
267
|
-
gap:
|
|
260
|
+
borderRadius: ["none", "", "full", we, R],
|
|
261
|
+
borderSpacing: S(),
|
|
262
|
+
borderWidth: C(),
|
|
263
|
+
contrast: Q(),
|
|
264
|
+
grayscale: E(),
|
|
265
|
+
hueRotate: Q(),
|
|
266
|
+
invert: E(),
|
|
267
|
+
gap: S(),
|
|
268
268
|
gradientColorStops: [e],
|
|
269
|
-
gradientColorStopPositions: [
|
|
270
|
-
inset:
|
|
271
|
-
margin:
|
|
272
|
-
opacity:
|
|
273
|
-
padding:
|
|
274
|
-
saturate:
|
|
275
|
-
scale:
|
|
276
|
-
sepia:
|
|
277
|
-
skew:
|
|
278
|
-
space:
|
|
279
|
-
translate:
|
|
269
|
+
gradientColorStopPositions: [bn, be],
|
|
270
|
+
inset: j(),
|
|
271
|
+
margin: j(),
|
|
272
|
+
opacity: Q(),
|
|
273
|
+
padding: S(),
|
|
274
|
+
saturate: Q(),
|
|
275
|
+
scale: Q(),
|
|
276
|
+
sepia: E(),
|
|
277
|
+
skew: Q(),
|
|
278
|
+
space: S(),
|
|
279
|
+
translate: S()
|
|
280
280
|
},
|
|
281
281
|
classGroups: {
|
|
282
282
|
// Layout
|
|
@@ -285,7 +285,7 @@ const K = (e) => {
|
|
|
285
285
|
* @see https://tailwindcss.com/docs/aspect-ratio
|
|
286
286
|
*/
|
|
287
287
|
aspect: [{
|
|
288
|
-
aspect: ["auto", "square", "video",
|
|
288
|
+
aspect: ["auto", "square", "video", R]
|
|
289
289
|
}],
|
|
290
290
|
/**
|
|
291
291
|
* Container
|
|
@@ -304,14 +304,14 @@ const K = (e) => {
|
|
|
304
304
|
* @see https://tailwindcss.com/docs/break-after
|
|
305
305
|
*/
|
|
306
306
|
"break-after": [{
|
|
307
|
-
"break-after":
|
|
307
|
+
"break-after": D()
|
|
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": D()
|
|
315
315
|
}],
|
|
316
316
|
/**
|
|
317
317
|
* Break Inside
|
|
@@ -370,49 +370,49 @@ const K = (e) => {
|
|
|
370
370
|
* @see https://tailwindcss.com/docs/object-position
|
|
371
371
|
*/
|
|
372
372
|
"object-position": [{
|
|
373
|
-
object: [...
|
|
373
|
+
object: [..._(), R]
|
|
374
374
|
}],
|
|
375
375
|
/**
|
|
376
376
|
* Overflow
|
|
377
377
|
* @see https://tailwindcss.com/docs/overflow
|
|
378
378
|
*/
|
|
379
379
|
overflow: [{
|
|
380
|
-
overflow:
|
|
380
|
+
overflow: z()
|
|
381
381
|
}],
|
|
382
382
|
/**
|
|
383
383
|
* Overflow X
|
|
384
384
|
* @see https://tailwindcss.com/docs/overflow
|
|
385
385
|
*/
|
|
386
386
|
"overflow-x": [{
|
|
387
|
-
"overflow-x":
|
|
387
|
+
"overflow-x": z()
|
|
388
388
|
}],
|
|
389
389
|
/**
|
|
390
390
|
* Overflow Y
|
|
391
391
|
* @see https://tailwindcss.com/docs/overflow
|
|
392
392
|
*/
|
|
393
393
|
"overflow-y": [{
|
|
394
|
-
"overflow-y":
|
|
394
|
+
"overflow-y": z()
|
|
395
395
|
}],
|
|
396
396
|
/**
|
|
397
397
|
* Overscroll Behavior
|
|
398
398
|
* @see https://tailwindcss.com/docs/overscroll-behavior
|
|
399
399
|
*/
|
|
400
400
|
overscroll: [{
|
|
401
|
-
overscroll:
|
|
401
|
+
overscroll: w()
|
|
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": w()
|
|
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": w()
|
|
416
416
|
}],
|
|
417
417
|
/**
|
|
418
418
|
* Position
|
|
@@ -424,63 +424,63 @@ const K = (e) => {
|
|
|
424
424
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
425
425
|
*/
|
|
426
426
|
inset: [{
|
|
427
|
-
inset: [
|
|
427
|
+
inset: [d]
|
|
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": [d]
|
|
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": [d]
|
|
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: [d]
|
|
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: [d]
|
|
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: [d]
|
|
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: [d]
|
|
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: [d]
|
|
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: [d]
|
|
484
484
|
}],
|
|
485
485
|
/**
|
|
486
486
|
* Visibility
|
|
@@ -492,7 +492,7 @@ const K = (e) => {
|
|
|
492
492
|
* @see https://tailwindcss.com/docs/z-index
|
|
493
493
|
*/
|
|
494
494
|
z: [{
|
|
495
|
-
z: ["auto", Pe,
|
|
495
|
+
z: ["auto", Pe, R]
|
|
496
496
|
}],
|
|
497
497
|
// Flexbox and Grid
|
|
498
498
|
/**
|
|
@@ -500,7 +500,7 @@ const K = (e) => {
|
|
|
500
500
|
* @see https://tailwindcss.com/docs/flex-basis
|
|
501
501
|
*/
|
|
502
502
|
basis: [{
|
|
503
|
-
basis:
|
|
503
|
+
basis: j()
|
|
504
504
|
}],
|
|
505
505
|
/**
|
|
506
506
|
* Flex Direction
|
|
@@ -521,35 +521,35 @@ const K = (e) => {
|
|
|
521
521
|
* @see https://tailwindcss.com/docs/flex
|
|
522
522
|
*/
|
|
523
523
|
flex: [{
|
|
524
|
-
flex: ["1", "auto", "initial", "none",
|
|
524
|
+
flex: ["1", "auto", "initial", "none", R]
|
|
525
525
|
}],
|
|
526
526
|
/**
|
|
527
527
|
* Flex Grow
|
|
528
528
|
* @see https://tailwindcss.com/docs/flex-grow
|
|
529
529
|
*/
|
|
530
530
|
grow: [{
|
|
531
|
-
grow:
|
|
531
|
+
grow: E()
|
|
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: E()
|
|
539
539
|
}],
|
|
540
540
|
/**
|
|
541
541
|
* Order
|
|
542
542
|
* @see https://tailwindcss.com/docs/order
|
|
543
543
|
*/
|
|
544
544
|
order: [{
|
|
545
|
-
order: ["first", "last", "none", Pe,
|
|
545
|
+
order: ["first", "last", "none", Pe, R]
|
|
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 K = (e) => {
|
|
|
557
557
|
*/
|
|
558
558
|
"col-start-end": [{
|
|
559
559
|
col: ["auto", {
|
|
560
|
-
span: ["full", Pe,
|
|
561
|
-
},
|
|
560
|
+
span: ["full", Pe, R]
|
|
561
|
+
}, R]
|
|
562
562
|
}],
|
|
563
563
|
/**
|
|
564
564
|
* Grid Column Start
|
|
@@ -579,7 +579,7 @@ const K = (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 K = (e) => {
|
|
|
587
587
|
*/
|
|
588
588
|
"row-start-end": [{
|
|
589
589
|
row: ["auto", {
|
|
590
|
-
span: [Pe,
|
|
591
|
-
},
|
|
590
|
+
span: [Pe, R]
|
|
591
|
+
}, R]
|
|
592
592
|
}],
|
|
593
593
|
/**
|
|
594
594
|
* Grid Row Start
|
|
@@ -616,14 +616,14 @@ const K = (e) => {
|
|
|
616
616
|
* @see https://tailwindcss.com/docs/grid-auto-columns
|
|
617
617
|
*/
|
|
618
618
|
"auto-cols": [{
|
|
619
|
-
"auto-cols": ["auto", "min", "max", "fr",
|
|
619
|
+
"auto-cols": ["auto", "min", "max", "fr", R]
|
|
620
620
|
}],
|
|
621
621
|
/**
|
|
622
622
|
* Grid Auto Rows
|
|
623
623
|
* @see https://tailwindcss.com/docs/grid-auto-rows
|
|
624
624
|
*/
|
|
625
625
|
"auto-rows": [{
|
|
626
|
-
"auto-rows": ["auto", "min", "max", "fr",
|
|
626
|
+
"auto-rows": ["auto", "min", "max", "fr", R]
|
|
627
627
|
}],
|
|
628
628
|
/**
|
|
629
629
|
* Gap
|
|
@@ -651,7 +651,7 @@ const K = (e) => {
|
|
|
651
651
|
* @see https://tailwindcss.com/docs/justify-content
|
|
652
652
|
*/
|
|
653
653
|
"justify-content": [{
|
|
654
|
-
justify: ["normal", ...
|
|
654
|
+
justify: ["normal", ...G()]
|
|
655
655
|
}],
|
|
656
656
|
/**
|
|
657
657
|
* Justify Items
|
|
@@ -672,7 +672,7 @@ const K = (e) => {
|
|
|
672
672
|
* @see https://tailwindcss.com/docs/align-content
|
|
673
673
|
*/
|
|
674
674
|
"align-content": [{
|
|
675
|
-
content: ["normal", ...
|
|
675
|
+
content: ["normal", ...G(), "baseline"]
|
|
676
676
|
}],
|
|
677
677
|
/**
|
|
678
678
|
* Align Items
|
|
@@ -693,7 +693,7 @@ const K = (e) => {
|
|
|
693
693
|
* @see https://tailwindcss.com/docs/place-content
|
|
694
694
|
*/
|
|
695
695
|
"place-content": [{
|
|
696
|
-
"place-content": [...
|
|
696
|
+
"place-content": [...G(), "baseline"]
|
|
697
697
|
}],
|
|
698
698
|
/**
|
|
699
699
|
* Place Items
|
|
@@ -715,133 +715,133 @@ const K = (e) => {
|
|
|
715
715
|
* @see https://tailwindcss.com/docs/padding
|
|
716
716
|
*/
|
|
717
717
|
p: [{
|
|
718
|
-
p: [
|
|
718
|
+
p: [A]
|
|
719
719
|
}],
|
|
720
720
|
/**
|
|
721
721
|
* Padding X
|
|
722
722
|
* @see https://tailwindcss.com/docs/padding
|
|
723
723
|
*/
|
|
724
724
|
px: [{
|
|
725
|
-
px: [
|
|
725
|
+
px: [A]
|
|
726
726
|
}],
|
|
727
727
|
/**
|
|
728
728
|
* Padding Y
|
|
729
729
|
* @see https://tailwindcss.com/docs/padding
|
|
730
730
|
*/
|
|
731
731
|
py: [{
|
|
732
|
-
py: [
|
|
732
|
+
py: [A]
|
|
733
733
|
}],
|
|
734
734
|
/**
|
|
735
735
|
* Padding Start
|
|
736
736
|
* @see https://tailwindcss.com/docs/padding
|
|
737
737
|
*/
|
|
738
738
|
ps: [{
|
|
739
|
-
ps: [
|
|
739
|
+
ps: [A]
|
|
740
740
|
}],
|
|
741
741
|
/**
|
|
742
742
|
* Padding End
|
|
743
743
|
* @see https://tailwindcss.com/docs/padding
|
|
744
744
|
*/
|
|
745
745
|
pe: [{
|
|
746
|
-
pe: [
|
|
746
|
+
pe: [A]
|
|
747
747
|
}],
|
|
748
748
|
/**
|
|
749
749
|
* Padding Top
|
|
750
750
|
* @see https://tailwindcss.com/docs/padding
|
|
751
751
|
*/
|
|
752
752
|
pt: [{
|
|
753
|
-
pt: [
|
|
753
|
+
pt: [A]
|
|
754
754
|
}],
|
|
755
755
|
/**
|
|
756
756
|
* Padding Right
|
|
757
757
|
* @see https://tailwindcss.com/docs/padding
|
|
758
758
|
*/
|
|
759
759
|
pr: [{
|
|
760
|
-
pr: [
|
|
760
|
+
pr: [A]
|
|
761
761
|
}],
|
|
762
762
|
/**
|
|
763
763
|
* Padding Bottom
|
|
764
764
|
* @see https://tailwindcss.com/docs/padding
|
|
765
765
|
*/
|
|
766
766
|
pb: [{
|
|
767
|
-
pb: [
|
|
767
|
+
pb: [A]
|
|
768
768
|
}],
|
|
769
769
|
/**
|
|
770
770
|
* Padding Left
|
|
771
771
|
* @see https://tailwindcss.com/docs/padding
|
|
772
772
|
*/
|
|
773
773
|
pl: [{
|
|
774
|
-
pl: [
|
|
774
|
+
pl: [A]
|
|
775
775
|
}],
|
|
776
776
|
/**
|
|
777
777
|
* Margin
|
|
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
|
|
841
841
|
* @see https://tailwindcss.com/docs/space
|
|
842
842
|
*/
|
|
843
843
|
"space-x": [{
|
|
844
|
-
"space-x": [
|
|
844
|
+
"space-x": [x]
|
|
845
845
|
}],
|
|
846
846
|
/**
|
|
847
847
|
* Space Between X Reverse
|
|
@@ -853,7 +853,7 @@ const K = (e) => {
|
|
|
853
853
|
* @see https://tailwindcss.com/docs/space
|
|
854
854
|
*/
|
|
855
855
|
"space-y": [{
|
|
856
|
-
"space-y": [
|
|
856
|
+
"space-y": [x]
|
|
857
857
|
}],
|
|
858
858
|
/**
|
|
859
859
|
* Space Between Y Reverse
|
|
@@ -866,21 +866,21 @@ const K = (e) => {
|
|
|
866
866
|
* @see https://tailwindcss.com/docs/width
|
|
867
867
|
*/
|
|
868
868
|
w: [{
|
|
869
|
-
w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw",
|
|
869
|
+
w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw", R, t]
|
|
870
870
|
}],
|
|
871
871
|
/**
|
|
872
872
|
* Min-Width
|
|
873
873
|
* @see https://tailwindcss.com/docs/min-width
|
|
874
874
|
*/
|
|
875
875
|
"min-w": [{
|
|
876
|
-
"min-w": [
|
|
876
|
+
"min-w": [R, t, "min", "max", "fit"]
|
|
877
877
|
}],
|
|
878
878
|
/**
|
|
879
879
|
* Max-Width
|
|
880
880
|
* @see https://tailwindcss.com/docs/max-width
|
|
881
881
|
*/
|
|
882
882
|
"max-w": [{
|
|
883
|
-
"max-w": [
|
|
883
|
+
"max-w": [R, t, "none", "full", "min", "max", "fit", "prose", {
|
|
884
884
|
screen: [we]
|
|
885
885
|
}, we]
|
|
886
886
|
}],
|
|
@@ -889,28 +889,28 @@ const K = (e) => {
|
|
|
889
889
|
* @see https://tailwindcss.com/docs/height
|
|
890
890
|
*/
|
|
891
891
|
h: [{
|
|
892
|
-
h: [
|
|
892
|
+
h: [R, t, "auto", "min", "max", "fit", "svh", "lvh", "dvh"]
|
|
893
893
|
}],
|
|
894
894
|
/**
|
|
895
895
|
* Min-Height
|
|
896
896
|
* @see https://tailwindcss.com/docs/min-height
|
|
897
897
|
*/
|
|
898
898
|
"min-h": [{
|
|
899
|
-
"min-h": [
|
|
899
|
+
"min-h": [R, t, "min", "max", "fit", "svh", "lvh", "dvh"]
|
|
900
900
|
}],
|
|
901
901
|
/**
|
|
902
902
|
* Max-Height
|
|
903
903
|
* @see https://tailwindcss.com/docs/max-height
|
|
904
904
|
*/
|
|
905
905
|
"max-h": [{
|
|
906
|
-
"max-h": [
|
|
906
|
+
"max-h": [R, t, "min", "max", "fit", "svh", "lvh", "dvh"]
|
|
907
907
|
}],
|
|
908
908
|
/**
|
|
909
909
|
* Size
|
|
910
910
|
* @see https://tailwindcss.com/docs/size
|
|
911
911
|
*/
|
|
912
912
|
size: [{
|
|
913
|
-
size: [
|
|
913
|
+
size: [R, t, "auto", "min", "max", "fit"]
|
|
914
914
|
}],
|
|
915
915
|
// Typography
|
|
916
916
|
/**
|
|
@@ -935,14 +935,14 @@ const K = (e) => {
|
|
|
935
935
|
* @see https://tailwindcss.com/docs/font-weight
|
|
936
936
|
*/
|
|
937
937
|
"font-weight": [{
|
|
938
|
-
font: ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black",
|
|
938
|
+
font: ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black", Ke]
|
|
939
939
|
}],
|
|
940
940
|
/**
|
|
941
941
|
* Font Family
|
|
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,35 +979,35 @@ const K = (e) => {
|
|
|
979
979
|
* @see https://tailwindcss.com/docs/letter-spacing
|
|
980
980
|
*/
|
|
981
981
|
tracking: [{
|
|
982
|
-
tracking: ["tighter", "tight", "normal", "wide", "wider", "widest",
|
|
982
|
+
tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", R]
|
|
983
983
|
}],
|
|
984
984
|
/**
|
|
985
985
|
* Line Clamp
|
|
986
986
|
* @see https://tailwindcss.com/docs/line-clamp
|
|
987
987
|
*/
|
|
988
988
|
"line-clamp": [{
|
|
989
|
-
"line-clamp": ["none", xe,
|
|
989
|
+
"line-clamp": ["none", xe, Ke]
|
|
990
990
|
}],
|
|
991
991
|
/**
|
|
992
992
|
* Line Height
|
|
993
993
|
* @see https://tailwindcss.com/docs/line-height
|
|
994
994
|
*/
|
|
995
995
|
leading: [{
|
|
996
|
-
leading: ["none", "tight", "snug", "normal", "relaxed", "loose", fe,
|
|
996
|
+
leading: ["none", "tight", "snug", "normal", "relaxed", "loose", fe, R]
|
|
997
997
|
}],
|
|
998
998
|
/**
|
|
999
999
|
* List Style Image
|
|
1000
1000
|
* @see https://tailwindcss.com/docs/list-style-image
|
|
1001
1001
|
*/
|
|
1002
1002
|
"list-image": [{
|
|
1003
|
-
"list-image": ["none",
|
|
1003
|
+
"list-image": ["none", R]
|
|
1004
1004
|
}],
|
|
1005
1005
|
/**
|
|
1006
1006
|
* List Style Type
|
|
1007
1007
|
* @see https://tailwindcss.com/docs/list-style-type
|
|
1008
1008
|
*/
|
|
1009
1009
|
"list-style-type": [{
|
|
1010
|
-
list: ["none", "disc", "decimal",
|
|
1010
|
+
list: ["none", "disc", "decimal", R]
|
|
1011
1011
|
}],
|
|
1012
1012
|
/**
|
|
1013
1013
|
* List Style Position
|
|
@@ -1029,7 +1029,7 @@ const K = (e) => {
|
|
|
1029
1029
|
* @see https://tailwindcss.com/docs/placeholder-opacity
|
|
1030
1030
|
*/
|
|
1031
1031
|
"placeholder-opacity": [{
|
|
1032
|
-
"placeholder-opacity": [
|
|
1032
|
+
"placeholder-opacity": [I]
|
|
1033
1033
|
}],
|
|
1034
1034
|
/**
|
|
1035
1035
|
* Text Alignment
|
|
@@ -1050,7 +1050,7 @@ const K = (e) => {
|
|
|
1050
1050
|
* @see https://tailwindcss.com/docs/text-opacity
|
|
1051
1051
|
*/
|
|
1052
1052
|
"text-opacity": [{
|
|
1053
|
-
"text-opacity": [
|
|
1053
|
+
"text-opacity": [I]
|
|
1054
1054
|
}],
|
|
1055
1055
|
/**
|
|
1056
1056
|
* Text Decoration
|
|
@@ -1062,7 +1062,7 @@ const K = (e) => {
|
|
|
1062
1062
|
* @see https://tailwindcss.com/docs/text-decoration-style
|
|
1063
1063
|
*/
|
|
1064
1064
|
"text-decoration-style": [{
|
|
1065
|
-
decoration: [...
|
|
1065
|
+
decoration: [...O(), "wavy"]
|
|
1066
1066
|
}],
|
|
1067
1067
|
/**
|
|
1068
1068
|
* Text Decoration Thickness
|
|
@@ -1076,7 +1076,7 @@ const K = (e) => {
|
|
|
1076
1076
|
* @see https://tailwindcss.com/docs/text-underline-offset
|
|
1077
1077
|
*/
|
|
1078
1078
|
"underline-offset": [{
|
|
1079
|
-
"underline-offset": ["auto", fe,
|
|
1079
|
+
"underline-offset": ["auto", fe, R]
|
|
1080
1080
|
}],
|
|
1081
1081
|
/**
|
|
1082
1082
|
* Text Decoration Color
|
|
@@ -1107,14 +1107,14 @@ const K = (e) => {
|
|
|
1107
1107
|
* @see https://tailwindcss.com/docs/text-indent
|
|
1108
1108
|
*/
|
|
1109
1109
|
indent: [{
|
|
1110
|
-
indent:
|
|
1110
|
+
indent: S()
|
|
1111
1111
|
}],
|
|
1112
1112
|
/**
|
|
1113
1113
|
* Vertical Alignment
|
|
1114
1114
|
* @see https://tailwindcss.com/docs/vertical-align
|
|
1115
1115
|
*/
|
|
1116
1116
|
"vertical-align": [{
|
|
1117
|
-
align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super",
|
|
1117
|
+
align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", R]
|
|
1118
1118
|
}],
|
|
1119
1119
|
/**
|
|
1120
1120
|
* Whitespace
|
|
@@ -1142,7 +1142,7 @@ const K = (e) => {
|
|
|
1142
1142
|
* @see https://tailwindcss.com/docs/content
|
|
1143
1143
|
*/
|
|
1144
1144
|
content: [{
|
|
1145
|
-
content: ["none",
|
|
1145
|
+
content: ["none", R]
|
|
1146
1146
|
}],
|
|
1147
1147
|
// Backgrounds
|
|
1148
1148
|
/**
|
|
@@ -1165,7 +1165,7 @@ const K = (e) => {
|
|
|
1165
1165
|
* @see https://tailwindcss.com/docs/background-opacity
|
|
1166
1166
|
*/
|
|
1167
1167
|
"bg-opacity": [{
|
|
1168
|
-
"bg-opacity": [
|
|
1168
|
+
"bg-opacity": [I]
|
|
1169
1169
|
}],
|
|
1170
1170
|
/**
|
|
1171
1171
|
* Background Origin
|
|
@@ -1179,7 +1179,7 @@ const K = (e) => {
|
|
|
1179
1179
|
* @see https://tailwindcss.com/docs/background-position
|
|
1180
1180
|
*/
|
|
1181
1181
|
"bg-position": [{
|
|
1182
|
-
bg: [...
|
|
1182
|
+
bg: [..._(), kn]
|
|
1183
1183
|
}],
|
|
1184
1184
|
/**
|
|
1185
1185
|
* Background Repeat
|
|
@@ -1195,7 +1195,7 @@ const K = (e) => {
|
|
|
1195
1195
|
* @see https://tailwindcss.com/docs/background-size
|
|
1196
1196
|
*/
|
|
1197
1197
|
"bg-size": [{
|
|
1198
|
-
bg: ["auto", "cover", "contain",
|
|
1198
|
+
bg: ["auto", "cover", "contain", vn]
|
|
1199
1199
|
}],
|
|
1200
1200
|
/**
|
|
1201
1201
|
* Background Image
|
|
@@ -1204,7 +1204,7 @@ const K = (e) => {
|
|
|
1204
1204
|
"bg-image": [{
|
|
1205
1205
|
bg: ["none", {
|
|
1206
1206
|
"gradient-to": ["t", "tr", "r", "br", "b", "bl", "l", "tl"]
|
|
1207
|
-
},
|
|
1207
|
+
}, Tn]
|
|
1208
1208
|
}],
|
|
1209
1209
|
/**
|
|
1210
1210
|
* Background Color
|
|
@@ -1218,21 +1218,21 @@ const K = (e) => {
|
|
|
1218
1218
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1219
1219
|
*/
|
|
1220
1220
|
"gradient-from-pos": [{
|
|
1221
|
-
from: [
|
|
1221
|
+
from: [k]
|
|
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: [k]
|
|
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: [k]
|
|
1236
1236
|
}],
|
|
1237
1237
|
/**
|
|
1238
1238
|
* Gradient Color Stops From
|
|
@@ -1429,14 +1429,14 @@ const K = (e) => {
|
|
|
1429
1429
|
* @see https://tailwindcss.com/docs/border-opacity
|
|
1430
1430
|
*/
|
|
1431
1431
|
"border-opacity": [{
|
|
1432
|
-
"border-opacity": [
|
|
1432
|
+
"border-opacity": [I]
|
|
1433
1433
|
}],
|
|
1434
1434
|
/**
|
|
1435
1435
|
* Border Style
|
|
1436
1436
|
* @see https://tailwindcss.com/docs/border-style
|
|
1437
1437
|
*/
|
|
1438
1438
|
"border-style": [{
|
|
1439
|
-
border: [...
|
|
1439
|
+
border: [...O(), "hidden"]
|
|
1440
1440
|
}],
|
|
1441
1441
|
/**
|
|
1442
1442
|
* Divide Width X
|
|
@@ -1467,14 +1467,14 @@ const K = (e) => {
|
|
|
1467
1467
|
* @see https://tailwindcss.com/docs/divide-opacity
|
|
1468
1468
|
*/
|
|
1469
1469
|
"divide-opacity": [{
|
|
1470
|
-
"divide-opacity": [
|
|
1470
|
+
"divide-opacity": [I]
|
|
1471
1471
|
}],
|
|
1472
1472
|
/**
|
|
1473
1473
|
* Divide Style
|
|
1474
1474
|
* @see https://tailwindcss.com/docs/divide-style
|
|
1475
1475
|
*/
|
|
1476
1476
|
"divide-style": [{
|
|
1477
|
-
divide:
|
|
1477
|
+
divide: O()
|
|
1478
1478
|
}],
|
|
1479
1479
|
/**
|
|
1480
1480
|
* Border Color
|
|
@@ -1551,14 +1551,14 @@ const K = (e) => {
|
|
|
1551
1551
|
* @see https://tailwindcss.com/docs/outline-style
|
|
1552
1552
|
*/
|
|
1553
1553
|
"outline-style": [{
|
|
1554
|
-
outline: ["", ...
|
|
1554
|
+
outline: ["", ...O()]
|
|
1555
1555
|
}],
|
|
1556
1556
|
/**
|
|
1557
1557
|
* Outline Offset
|
|
1558
1558
|
* @see https://tailwindcss.com/docs/outline-offset
|
|
1559
1559
|
*/
|
|
1560
1560
|
"outline-offset": [{
|
|
1561
|
-
"outline-offset": [fe,
|
|
1561
|
+
"outline-offset": [fe, R]
|
|
1562
1562
|
}],
|
|
1563
1563
|
/**
|
|
1564
1564
|
* Outline Width
|
|
@@ -1579,7 +1579,7 @@ const K = (e) => {
|
|
|
1579
1579
|
* @see https://tailwindcss.com/docs/ring-width
|
|
1580
1580
|
*/
|
|
1581
1581
|
"ring-w": [{
|
|
1582
|
-
ring:
|
|
1582
|
+
ring: C()
|
|
1583
1583
|
}],
|
|
1584
1584
|
/**
|
|
1585
1585
|
* Ring Width Inset
|
|
@@ -1598,7 +1598,7 @@ const K = (e) => {
|
|
|
1598
1598
|
* @see https://tailwindcss.com/docs/ring-opacity
|
|
1599
1599
|
*/
|
|
1600
1600
|
"ring-opacity": [{
|
|
1601
|
-
"ring-opacity": [
|
|
1601
|
+
"ring-opacity": [I]
|
|
1602
1602
|
}],
|
|
1603
1603
|
/**
|
|
1604
1604
|
* Ring Offset Width
|
|
@@ -1620,35 +1620,35 @@ const K = (e) => {
|
|
|
1620
1620
|
* @see https://tailwindcss.com/docs/box-shadow
|
|
1621
1621
|
*/
|
|
1622
1622
|
shadow: [{
|
|
1623
|
-
shadow: ["", "inner", "none", we,
|
|
1623
|
+
shadow: ["", "inner", "none", we, xn]
|
|
1624
1624
|
}],
|
|
1625
1625
|
/**
|
|
1626
1626
|
* Box Shadow Color
|
|
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: [I]
|
|
1638
1638
|
}],
|
|
1639
1639
|
/**
|
|
1640
1640
|
* Mix Blend Mode
|
|
1641
1641
|
* @see https://tailwindcss.com/docs/mix-blend-mode
|
|
1642
1642
|
*/
|
|
1643
1643
|
"mix-blend": [{
|
|
1644
|
-
"mix-blend": [...
|
|
1644
|
+
"mix-blend": [...F(), "plus-lighter", "plus-darker"]
|
|
1645
1645
|
}],
|
|
1646
1646
|
/**
|
|
1647
1647
|
* Background Blend Mode
|
|
1648
1648
|
* @see https://tailwindcss.com/docs/background-blend-mode
|
|
1649
1649
|
*/
|
|
1650
1650
|
"bg-blend": [{
|
|
1651
|
-
"bg-blend":
|
|
1651
|
+
"bg-blend": F()
|
|
1652
1652
|
}],
|
|
1653
1653
|
// Filters
|
|
1654
1654
|
/**
|
|
@@ -1685,7 +1685,7 @@ const K = (e) => {
|
|
|
1685
1685
|
* @see https://tailwindcss.com/docs/drop-shadow
|
|
1686
1686
|
*/
|
|
1687
1687
|
"drop-shadow": [{
|
|
1688
|
-
"drop-shadow": ["", "none", we,
|
|
1688
|
+
"drop-shadow": ["", "none", we, R]
|
|
1689
1689
|
}],
|
|
1690
1690
|
/**
|
|
1691
1691
|
* Grayscale
|
|
@@ -1713,14 +1713,14 @@ const K = (e) => {
|
|
|
1713
1713
|
* @see https://tailwindcss.com/docs/saturate
|
|
1714
1714
|
*/
|
|
1715
1715
|
saturate: [{
|
|
1716
|
-
saturate: [
|
|
1716
|
+
saturate: [T]
|
|
1717
1717
|
}],
|
|
1718
1718
|
/**
|
|
1719
1719
|
* Sepia
|
|
1720
1720
|
* @see https://tailwindcss.com/docs/sepia
|
|
1721
1721
|
*/
|
|
1722
1722
|
sepia: [{
|
|
1723
|
-
sepia: [
|
|
1723
|
+
sepia: [b]
|
|
1724
1724
|
}],
|
|
1725
1725
|
/**
|
|
1726
1726
|
* Backdrop Filter
|
|
@@ -1777,21 +1777,21 @@ const K = (e) => {
|
|
|
1777
1777
|
* @see https://tailwindcss.com/docs/backdrop-opacity
|
|
1778
1778
|
*/
|
|
1779
1779
|
"backdrop-opacity": [{
|
|
1780
|
-
"backdrop-opacity": [
|
|
1780
|
+
"backdrop-opacity": [I]
|
|
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": [T]
|
|
1788
1788
|
}],
|
|
1789
1789
|
/**
|
|
1790
1790
|
* Backdrop Sepia
|
|
1791
1791
|
* @see https://tailwindcss.com/docs/backdrop-sepia
|
|
1792
1792
|
*/
|
|
1793
1793
|
"backdrop-sepia": [{
|
|
1794
|
-
"backdrop-sepia": [
|
|
1794
|
+
"backdrop-sepia": [b]
|
|
1795
1795
|
}],
|
|
1796
1796
|
// Tables
|
|
1797
1797
|
/**
|
|
@@ -1842,35 +1842,35 @@ const K = (e) => {
|
|
|
1842
1842
|
* @see https://tailwindcss.com/docs/transition-property
|
|
1843
1843
|
*/
|
|
1844
1844
|
transition: [{
|
|
1845
|
-
transition: ["none", "all", "", "colors", "opacity", "shadow", "transform",
|
|
1845
|
+
transition: ["none", "all", "", "colors", "opacity", "shadow", "transform", R]
|
|
1846
1846
|
}],
|
|
1847
1847
|
/**
|
|
1848
1848
|
* Transition Duration
|
|
1849
1849
|
* @see https://tailwindcss.com/docs/transition-duration
|
|
1850
1850
|
*/
|
|
1851
1851
|
duration: [{
|
|
1852
|
-
duration:
|
|
1852
|
+
duration: 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", R]
|
|
1860
1860
|
}],
|
|
1861
1861
|
/**
|
|
1862
1862
|
* Transition Delay
|
|
1863
1863
|
* @see https://tailwindcss.com/docs/transition-delay
|
|
1864
1864
|
*/
|
|
1865
1865
|
delay: [{
|
|
1866
|
-
delay:
|
|
1866
|
+
delay: 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", R]
|
|
1874
1874
|
}],
|
|
1875
1875
|
// Transforms
|
|
1876
1876
|
/**
|
|
@@ -1906,7 +1906,7 @@ const K = (e) => {
|
|
|
1906
1906
|
* @see https://tailwindcss.com/docs/rotate
|
|
1907
1907
|
*/
|
|
1908
1908
|
rotate: [{
|
|
1909
|
-
rotate: [Pe,
|
|
1909
|
+
rotate: [Pe, R]
|
|
1910
1910
|
}],
|
|
1911
1911
|
/**
|
|
1912
1912
|
* Translate X
|
|
@@ -1927,21 +1927,21 @@ const K = (e) => {
|
|
|
1927
1927
|
* @see https://tailwindcss.com/docs/skew
|
|
1928
1928
|
*/
|
|
1929
1929
|
"skew-x": [{
|
|
1930
|
-
"skew-x": [
|
|
1930
|
+
"skew-x": [y]
|
|
1931
1931
|
}],
|
|
1932
1932
|
/**
|
|
1933
1933
|
* Skew Y
|
|
1934
1934
|
* @see https://tailwindcss.com/docs/skew
|
|
1935
1935
|
*/
|
|
1936
1936
|
"skew-y": [{
|
|
1937
|
-
"skew-y": [
|
|
1937
|
+
"skew-y": [y]
|
|
1938
1938
|
}],
|
|
1939
1939
|
/**
|
|
1940
1940
|
* Transform Origin
|
|
1941
1941
|
* @see https://tailwindcss.com/docs/transform-origin
|
|
1942
1942
|
*/
|
|
1943
1943
|
"transform-origin": [{
|
|
1944
|
-
origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left",
|
|
1944
|
+
origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", R]
|
|
1945
1945
|
}],
|
|
1946
1946
|
// Interactivity
|
|
1947
1947
|
/**
|
|
@@ -1963,7 +1963,7 @@ const K = (e) => {
|
|
|
1963
1963
|
* @see https://tailwindcss.com/docs/cursor
|
|
1964
1964
|
*/
|
|
1965
1965
|
cursor: [{
|
|
1966
|
-
cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out",
|
|
1966
|
+
cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", R]
|
|
1967
1967
|
}],
|
|
1968
1968
|
/**
|
|
1969
1969
|
* Caret Color
|
|
@@ -1998,126 +1998,126 @@ const K = (e) => {
|
|
|
1998
1998
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
1999
1999
|
*/
|
|
2000
2000
|
"scroll-m": [{
|
|
2001
|
-
"scroll-m":
|
|
2001
|
+
"scroll-m": S()
|
|
2002
2002
|
}],
|
|
2003
2003
|
/**
|
|
2004
2004
|
* Scroll Margin X
|
|
2005
2005
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2006
2006
|
*/
|
|
2007
2007
|
"scroll-mx": [{
|
|
2008
|
-
"scroll-mx":
|
|
2008
|
+
"scroll-mx": S()
|
|
2009
2009
|
}],
|
|
2010
2010
|
/**
|
|
2011
2011
|
* Scroll Margin Y
|
|
2012
2012
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2013
2013
|
*/
|
|
2014
2014
|
"scroll-my": [{
|
|
2015
|
-
"scroll-my":
|
|
2015
|
+
"scroll-my": S()
|
|
2016
2016
|
}],
|
|
2017
2017
|
/**
|
|
2018
2018
|
* Scroll Margin Start
|
|
2019
2019
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2020
2020
|
*/
|
|
2021
2021
|
"scroll-ms": [{
|
|
2022
|
-
"scroll-ms":
|
|
2022
|
+
"scroll-ms": S()
|
|
2023
2023
|
}],
|
|
2024
2024
|
/**
|
|
2025
2025
|
* Scroll Margin End
|
|
2026
2026
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2027
2027
|
*/
|
|
2028
2028
|
"scroll-me": [{
|
|
2029
|
-
"scroll-me":
|
|
2029
|
+
"scroll-me": S()
|
|
2030
2030
|
}],
|
|
2031
2031
|
/**
|
|
2032
2032
|
* Scroll Margin Top
|
|
2033
2033
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2034
2034
|
*/
|
|
2035
2035
|
"scroll-mt": [{
|
|
2036
|
-
"scroll-mt":
|
|
2036
|
+
"scroll-mt": S()
|
|
2037
2037
|
}],
|
|
2038
2038
|
/**
|
|
2039
2039
|
* Scroll Margin Right
|
|
2040
2040
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2041
2041
|
*/
|
|
2042
2042
|
"scroll-mr": [{
|
|
2043
|
-
"scroll-mr":
|
|
2043
|
+
"scroll-mr": S()
|
|
2044
2044
|
}],
|
|
2045
2045
|
/**
|
|
2046
2046
|
* Scroll Margin Bottom
|
|
2047
2047
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2048
2048
|
*/
|
|
2049
2049
|
"scroll-mb": [{
|
|
2050
|
-
"scroll-mb":
|
|
2050
|
+
"scroll-mb": S()
|
|
2051
2051
|
}],
|
|
2052
2052
|
/**
|
|
2053
2053
|
* Scroll Margin Left
|
|
2054
2054
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2055
2055
|
*/
|
|
2056
2056
|
"scroll-ml": [{
|
|
2057
|
-
"scroll-ml":
|
|
2057
|
+
"scroll-ml": S()
|
|
2058
2058
|
}],
|
|
2059
2059
|
/**
|
|
2060
2060
|
* Scroll Padding
|
|
2061
2061
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2062
2062
|
*/
|
|
2063
2063
|
"scroll-p": [{
|
|
2064
|
-
"scroll-p":
|
|
2064
|
+
"scroll-p": S()
|
|
2065
2065
|
}],
|
|
2066
2066
|
/**
|
|
2067
2067
|
* Scroll Padding X
|
|
2068
2068
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2069
2069
|
*/
|
|
2070
2070
|
"scroll-px": [{
|
|
2071
|
-
"scroll-px":
|
|
2071
|
+
"scroll-px": S()
|
|
2072
2072
|
}],
|
|
2073
2073
|
/**
|
|
2074
2074
|
* Scroll Padding Y
|
|
2075
2075
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2076
2076
|
*/
|
|
2077
2077
|
"scroll-py": [{
|
|
2078
|
-
"scroll-py":
|
|
2078
|
+
"scroll-py": S()
|
|
2079
2079
|
}],
|
|
2080
2080
|
/**
|
|
2081
2081
|
* Scroll Padding Start
|
|
2082
2082
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2083
2083
|
*/
|
|
2084
2084
|
"scroll-ps": [{
|
|
2085
|
-
"scroll-ps":
|
|
2085
|
+
"scroll-ps": S()
|
|
2086
2086
|
}],
|
|
2087
2087
|
/**
|
|
2088
2088
|
* Scroll Padding End
|
|
2089
2089
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2090
2090
|
*/
|
|
2091
2091
|
"scroll-pe": [{
|
|
2092
|
-
"scroll-pe":
|
|
2092
|
+
"scroll-pe": S()
|
|
2093
2093
|
}],
|
|
2094
2094
|
/**
|
|
2095
2095
|
* Scroll Padding Top
|
|
2096
2096
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2097
2097
|
*/
|
|
2098
2098
|
"scroll-pt": [{
|
|
2099
|
-
"scroll-pt":
|
|
2099
|
+
"scroll-pt": S()
|
|
2100
2100
|
}],
|
|
2101
2101
|
/**
|
|
2102
2102
|
* Scroll Padding Right
|
|
2103
2103
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2104
2104
|
*/
|
|
2105
2105
|
"scroll-pr": [{
|
|
2106
|
-
"scroll-pr":
|
|
2106
|
+
"scroll-pr": S()
|
|
2107
2107
|
}],
|
|
2108
2108
|
/**
|
|
2109
2109
|
* Scroll Padding Bottom
|
|
2110
2110
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2111
2111
|
*/
|
|
2112
2112
|
"scroll-pb": [{
|
|
2113
|
-
"scroll-pb":
|
|
2113
|
+
"scroll-pb": S()
|
|
2114
2114
|
}],
|
|
2115
2115
|
/**
|
|
2116
2116
|
* Scroll Padding Left
|
|
2117
2117
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2118
2118
|
*/
|
|
2119
2119
|
"scroll-pl": [{
|
|
2120
|
-
"scroll-pl":
|
|
2120
|
+
"scroll-pl": S()
|
|
2121
2121
|
}],
|
|
2122
2122
|
/**
|
|
2123
2123
|
* Scroll Snap Align
|
|
@@ -2185,7 +2185,7 @@ const K = (e) => {
|
|
|
2185
2185
|
* @see https://tailwindcss.com/docs/will-change
|
|
2186
2186
|
*/
|
|
2187
2187
|
"will-change": [{
|
|
2188
|
-
"will-change": ["auto", "scroll", "contents", "transform",
|
|
2188
|
+
"will-change": ["auto", "scroll", "contents", "transform", R]
|
|
2189
2189
|
}],
|
|
2190
2190
|
// SVG
|
|
2191
2191
|
/**
|
|
@@ -2200,7 +2200,7 @@ const K = (e) => {
|
|
|
2200
2200
|
* @see https://tailwindcss.com/docs/stroke-width
|
|
2201
2201
|
*/
|
|
2202
2202
|
"stroke-w": [{
|
|
2203
|
-
stroke: [fe, be,
|
|
2203
|
+
stroke: [fe, be, Ke]
|
|
2204
2204
|
}],
|
|
2205
2205
|
/**
|
|
2206
2206
|
* Stroke
|
|
@@ -2275,11 +2275,11 @@ const K = (e) => {
|
|
|
2275
2275
|
"font-size": ["leading"]
|
|
2276
2276
|
}
|
|
2277
2277
|
};
|
|
2278
|
-
},
|
|
2279
|
-
function
|
|
2280
|
-
return
|
|
2278
|
+
}, En = /* @__PURE__ */ un(Mn);
|
|
2279
|
+
function Yr(...e) {
|
|
2280
|
+
return En(Xt(e));
|
|
2281
2281
|
}
|
|
2282
|
-
function
|
|
2282
|
+
function Pn(e) {
|
|
2283
2283
|
let t = !1, n = "";
|
|
2284
2284
|
for (const o of e) {
|
|
2285
2285
|
if (o === "\\") {
|
|
@@ -2294,13 +2294,13 @@ function Nn(e) {
|
|
|
2294
2294
|
}
|
|
2295
2295
|
return n.replace(/\bTrue\b/g, "true").replace(/\bFalse\b/g, "false").replace(/\bNone\b/g, "null");
|
|
2296
2296
|
}
|
|
2297
|
-
function
|
|
2297
|
+
function et(e) {
|
|
2298
2298
|
const t = e == null ? void 0 : e.trim();
|
|
2299
2299
|
if (!t || !(t.startsWith("{") || t.startsWith("["))) return null;
|
|
2300
2300
|
try {
|
|
2301
2301
|
return JSON.parse(t);
|
|
2302
2302
|
} catch {
|
|
2303
|
-
const n =
|
|
2303
|
+
const n = Pn(t);
|
|
2304
2304
|
if (n)
|
|
2305
2305
|
try {
|
|
2306
2306
|
return JSON.parse(n);
|
|
@@ -2310,29 +2310,29 @@ 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 _n(e) {
|
|
2317
2317
|
return e.type === "image_url";
|
|
2318
2318
|
}
|
|
2319
|
-
function
|
|
2319
|
+
function zn(e) {
|
|
2320
2320
|
return e.type === "file";
|
|
2321
2321
|
}
|
|
2322
|
-
function
|
|
2322
|
+
function Rn(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(_n);
|
|
2328
|
+
}
|
|
2326
2329
|
function jn(e) {
|
|
2327
2330
|
return e.content.filter(zn);
|
|
2328
2331
|
}
|
|
2329
|
-
function
|
|
2330
|
-
return e.content.filter(Un);
|
|
2331
|
-
}
|
|
2332
|
-
function Mt(e) {
|
|
2332
|
+
function St(e) {
|
|
2333
2333
|
return Array.isArray(e.toolCalls) ? e.toolCalls : [];
|
|
2334
2334
|
}
|
|
2335
|
-
function
|
|
2335
|
+
function Ln(e) {
|
|
2336
2336
|
const t = [];
|
|
2337
2337
|
return e.forEach((n) => {
|
|
2338
2338
|
n.artifact && t.push(n.artifact), Array.isArray(n.toolCalls) && n.toolCalls.forEach((r) => {
|
|
@@ -2340,22 +2340,22 @@ function On(e) {
|
|
|
2340
2340
|
});
|
|
2341
2341
|
}), t;
|
|
2342
2342
|
}
|
|
2343
|
-
function
|
|
2343
|
+
function Ct(e) {
|
|
2344
2344
|
return !!(e && typeof e == "object" && (e.type === "file" || e.mimeType || e.filename || e.sourceType === "base64"));
|
|
2345
2345
|
}
|
|
2346
|
-
function
|
|
2346
|
+
function Ve(e) {
|
|
2347
2347
|
if (typeof e == "string")
|
|
2348
2348
|
return e;
|
|
2349
2349
|
if (e && typeof e == "object") {
|
|
2350
2350
|
if (Array.isArray(e)) {
|
|
2351
|
-
const n = e.map(
|
|
2351
|
+
const n = e.map(Ve).filter((r) => r !== void 0);
|
|
2352
2352
|
if (!n.length) {
|
|
2353
2353
|
console.debug("[message-utils] sanitizeForDisplay - array emptied -> returning undefined", { originalLength: e.length });
|
|
2354
2354
|
return;
|
|
2355
2355
|
}
|
|
2356
2356
|
return n;
|
|
2357
2357
|
}
|
|
2358
|
-
if (
|
|
2358
|
+
if (Ct(e)) {
|
|
2359
2359
|
try {
|
|
2360
2360
|
console.debug("[message-utils] sanitizeForDisplay - dropping file-like object", {
|
|
2361
2361
|
sampleFilename: e && (e.filename || e.name) ? e.filename || e.name : void 0,
|
|
@@ -2372,7 +2372,7 @@ function Ke(e) {
|
|
|
2372
2372
|
if (n === "data" && typeof r == "string" && r.length > 100)
|
|
2373
2373
|
t[n] = `[base64 ${r.length} chars omitted]`;
|
|
2374
2374
|
else {
|
|
2375
|
-
const o =
|
|
2375
|
+
const o = Ve(r);
|
|
2376
2376
|
o !== void 0 && (t[n] = o);
|
|
2377
2377
|
}
|
|
2378
2378
|
}
|
|
@@ -2387,24 +2387,24 @@ function Ke(e) {
|
|
|
2387
2387
|
}
|
|
2388
2388
|
return e;
|
|
2389
2389
|
}
|
|
2390
|
-
function
|
|
2390
|
+
function Mt(e) {
|
|
2391
2391
|
if (typeof e == "string") return e;
|
|
2392
|
-
if (
|
|
2392
|
+
if (Ct(e)) return "";
|
|
2393
2393
|
try {
|
|
2394
|
-
const t =
|
|
2394
|
+
const t = Ve(e);
|
|
2395
2395
|
return t === void 0 ? "" : typeof t == "string" ? t : JSON.stringify(t, null, 2);
|
|
2396
2396
|
} catch {
|
|
2397
2397
|
return "";
|
|
2398
2398
|
}
|
|
2399
2399
|
}
|
|
2400
|
-
function
|
|
2401
|
-
const t =
|
|
2402
|
-
return typeof e == "string" &&
|
|
2400
|
+
function Zr(e) {
|
|
2401
|
+
const t = Mt(e);
|
|
2402
|
+
return typeof e == "string" && Nn(e) ? { content: e, isMarkdown: !0 } : { content: t, isMarkdown: !1 };
|
|
2403
2403
|
}
|
|
2404
|
-
function
|
|
2404
|
+
function Fn(e) {
|
|
2405
2405
|
const t = (r) => {
|
|
2406
2406
|
try {
|
|
2407
|
-
const o =
|
|
2407
|
+
const o = Ve(r);
|
|
2408
2408
|
return typeof o == "string" ? o : JSON.stringify(o ?? "");
|
|
2409
2409
|
} catch {
|
|
2410
2410
|
return "";
|
|
@@ -2413,7 +2413,7 @@ function $n(e) {
|
|
|
2413
2413
|
return n.length ? t(n.map((r) => r.text).join(`
|
|
2414
2414
|
`)) : t(e);
|
|
2415
2415
|
}
|
|
2416
|
-
function
|
|
2416
|
+
function eo(e) {
|
|
2417
2417
|
return e.content.some((t) => t.type === "text" ? t.text.trim().length > 0 : t.type === "image_url" || t.type === "file");
|
|
2418
2418
|
}
|
|
2419
2419
|
function ce(e) {
|
|
@@ -2421,7 +2421,7 @@ function ce(e) {
|
|
|
2421
2421
|
if (typeof e == "string") {
|
|
2422
2422
|
const t = e.trim();
|
|
2423
2423
|
if (t.startsWith("{") || t.startsWith("[")) {
|
|
2424
|
-
const n =
|
|
2424
|
+
const n = et(t);
|
|
2425
2425
|
if (n !== null)
|
|
2426
2426
|
return ce(n);
|
|
2427
2427
|
}
|
|
@@ -2436,24 +2436,24 @@ function ce(e) {
|
|
|
2436
2436
|
}
|
|
2437
2437
|
return typeof e == "object" && !Array.isArray(e) && (e.type === "text" && typeof e.text == "string" || typeof e.text == "string") ? e.text : Array.isArray(e) && e.length > 0 ? ce(e[0]) : e;
|
|
2438
2438
|
}
|
|
2439
|
-
function
|
|
2439
|
+
function On(e) {
|
|
2440
2440
|
return e.replace(/[_-](\w)/g, (t, n) => n ? n.toUpperCase() : "").replace(/^\w/, (t) => t.toLowerCase());
|
|
2441
2441
|
}
|
|
2442
2442
|
function le(e) {
|
|
2443
2443
|
return !e || typeof e != "object" ? e : Array.isArray(e) ? e.map(le) : Object.fromEntries(
|
|
2444
2444
|
Object.entries(e).map(([t, n]) => [
|
|
2445
|
-
|
|
2445
|
+
On(t),
|
|
2446
2446
|
le(n)
|
|
2447
2447
|
])
|
|
2448
2448
|
);
|
|
2449
2449
|
}
|
|
2450
|
-
function
|
|
2451
|
-
var
|
|
2450
|
+
function tt(e) {
|
|
2451
|
+
var v, I, A, T, N, b;
|
|
2452
2452
|
if (!e || typeof e != "object") return null;
|
|
2453
|
-
const t = le(e), n =
|
|
2453
|
+
const t = le(e), n = Vn(t);
|
|
2454
2454
|
if (!n)
|
|
2455
2455
|
return null;
|
|
2456
|
-
const r = Array.isArray(t.toolCalls) ? t.toolCalls.map(
|
|
2456
|
+
const r = Array.isArray(t.toolCalls) ? t.toolCalls.map(nt) : void 0, o = $n(t.content ?? t.parts, !!(r != null && r.length)), s = t.id ?? `msg-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`, a = t.createdAt ?? ((v = t.additionalKwargs) == null ? void 0 : v.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(), i = t.name ?? ((I = t.additionalKwargs) == null ? void 0 : I.agentName) ?? void 0, u = t.model ?? ((A = t.additionalKwargs) == null ? void 0 : A.model) ?? void 0, c = t.toolCallId ?? void 0, l = t.additionalKwargs ?? void 0, p = t.responseMetadata ?? void 0, m = t.checkpointId ?? ((T = t.additionalKwargs) == null ? void 0 : T.checkpointId) ?? void 0, h = t.checkpointNs ?? ((N = t.additionalKwargs) == null ? void 0 : N.checkpointNs) ?? void 0, k = typeof t.toolStreaming == "boolean" ? t.toolStreaming : !!((b = t.additionalKwargs) != null && b.toolStreaming);
|
|
2457
2457
|
return {
|
|
2458
2458
|
...t,
|
|
2459
2459
|
id: s,
|
|
@@ -2466,13 +2466,13 @@ function nt(e) {
|
|
|
2466
2466
|
toolCalls: r,
|
|
2467
2467
|
checkpointId: m,
|
|
2468
2468
|
checkpointNs: h,
|
|
2469
|
-
toolStreaming:
|
|
2469
|
+
toolStreaming: k,
|
|
2470
2470
|
additionalKwargs: l,
|
|
2471
2471
|
responseMetadata: p,
|
|
2472
2472
|
artifact: t.artifact ?? void 0
|
|
2473
2473
|
};
|
|
2474
2474
|
}
|
|
2475
|
-
function
|
|
2475
|
+
function Bn(e) {
|
|
2476
2476
|
if (!e || typeof e != "object") return e;
|
|
2477
2477
|
const t = le(e);
|
|
2478
2478
|
if (t.tool && !t.name && (t.name = t.tool), t.type === "artifact.update" && t.artifact && typeof t.artifact == "object") {
|
|
@@ -2481,7 +2481,7 @@ function Dn(e) {
|
|
|
2481
2481
|
}
|
|
2482
2482
|
return t;
|
|
2483
2483
|
}
|
|
2484
|
-
function
|
|
2484
|
+
function nt(e) {
|
|
2485
2485
|
const t = le(e), n = t.content ?? t.output ?? void 0;
|
|
2486
2486
|
return {
|
|
2487
2487
|
...t,
|
|
@@ -2492,35 +2492,35 @@ function rt(e) {
|
|
|
2492
2492
|
content: typeof n == "string" ? n : n ? JSON.stringify(n) : void 0
|
|
2493
2493
|
};
|
|
2494
2494
|
}
|
|
2495
|
-
function
|
|
2496
|
-
return typeof e == "string" ? [{ type: "text", text: e }] : Array.isArray(e) ? e.map((n) => typeof n == "string" ? { type: "text", text: n } : n.type === "tool_call" || n.type === "tool" ? t ? null :
|
|
2495
|
+
function $n(e, t) {
|
|
2496
|
+
return typeof e == "string" ? [{ type: "text", text: e }] : Array.isArray(e) ? e.map((n) => typeof n == "string" ? { type: "text", text: n } : n.type === "tool_call" || n.type === "tool" ? t ? null : nt(le(n)) : n).filter(
|
|
2497
2497
|
(n) => !!(n && typeof n == "object" && typeof n.type == "string")
|
|
2498
2498
|
) : [];
|
|
2499
2499
|
}
|
|
2500
|
-
function
|
|
2500
|
+
function Vn(e) {
|
|
2501
2501
|
const t = le(e), n = t.role;
|
|
2502
2502
|
if (n && (n === "assistant" || n === "user" || n === "system" || n === "tool" || n === "interrupt"))
|
|
2503
2503
|
return n;
|
|
2504
2504
|
const r = t.type;
|
|
2505
2505
|
return r === "human" ? "user" : r === "ai" ? "assistant" : r === "tool" ? "tool" : r === "system" ? "system" : null;
|
|
2506
2506
|
}
|
|
2507
|
-
function
|
|
2507
|
+
function lt(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
|
|
2513
|
-
return (Array.isArray(e.toolCalls) ? e.toolCalls :
|
|
2512
|
+
function ut(e) {
|
|
2513
|
+
return (Array.isArray(e.toolCalls) ? e.toolCalls : St(e)).map(nt);
|
|
2514
2514
|
}
|
|
2515
|
-
function
|
|
2515
|
+
function Ge(e, t) {
|
|
2516
2516
|
return t.find(
|
|
2517
2517
|
(n) => n.role === "tool" && (n.toolCallId === e || n.id === e)
|
|
2518
2518
|
);
|
|
2519
2519
|
}
|
|
2520
|
-
function
|
|
2520
|
+
function Dn(e, t) {
|
|
2521
2521
|
const n = t.response ?? t.content;
|
|
2522
2522
|
if (!n) return;
|
|
2523
|
-
const r = typeof n == "string" ? n :
|
|
2523
|
+
const r = typeof n == "string" ? n : Mt(n);
|
|
2524
2524
|
if (!r.trim()) return;
|
|
2525
2525
|
const o = [{ type: "text", text: r }];
|
|
2526
2526
|
return {
|
|
@@ -2533,15 +2533,15 @@ function Gn(e, t) {
|
|
|
2533
2533
|
createdAt: e.createdAt
|
|
2534
2534
|
};
|
|
2535
2535
|
}
|
|
2536
|
-
function
|
|
2536
|
+
function Kn(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
2540
|
var p, m, h;
|
|
2541
|
-
const i =
|
|
2541
|
+
const i = Ge(a.id, e) || Ge(a.id, t), u = Array.isArray((p = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : p.toolProgress) ? (m = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : m.toolProgress : void 0, c = (i == null ? void 0 : i.artifact) ?? a.artifact, l = lt(a.status) ?? ((h = i == null ? void 0 : i.additionalKwargs) != null && h.toolStreaming ? "pending" : null) ?? (i ? "completed" : "pending");
|
|
2542
2542
|
if (i && !a.content && l === "completed") {
|
|
2543
|
-
const
|
|
2544
|
-
typeof
|
|
2543
|
+
const k = ce(i);
|
|
2544
|
+
typeof k == "string" && (a.content = k);
|
|
2545
2545
|
}
|
|
2546
2546
|
return {
|
|
2547
2547
|
call: a,
|
|
@@ -2553,10 +2553,10 @@ function Hn(e, t = []) {
|
|
|
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
2558
|
var u, c, l;
|
|
2559
|
-
const o =
|
|
2559
|
+
const o = Ge(r.id, t) ?? Dn(e, r), s = Array.isArray((u = o == null ? void 0 : o.additionalKwargs) == null ? void 0 : u.toolProgress) ? (c = o == null ? void 0 : o.additionalKwargs) == null ? void 0 : c.toolProgress : void 0, a = (o == null ? void 0 : o.artifact) ?? r.artifact, i = lt(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
2561
|
const p = ce(o);
|
|
2562
2562
|
typeof p == "string" && (r.content = p);
|
|
@@ -2570,10 +2570,10 @@ function Hn(e, t = []) {
|
|
|
2570
2570
|
};
|
|
2571
2571
|
});
|
|
2572
2572
|
}
|
|
2573
|
-
function
|
|
2574
|
-
return
|
|
2573
|
+
function to(e, t = []) {
|
|
2574
|
+
return Kn(e, t).map((n) => n.artifact).filter((n) => !!n);
|
|
2575
2575
|
}
|
|
2576
|
-
const
|
|
2576
|
+
const _e = {
|
|
2577
2577
|
authToken: "authToken",
|
|
2578
2578
|
authTokenExpiresAt: "authTokenExpiresAt",
|
|
2579
2579
|
authSessionId: "authSessionId",
|
|
@@ -2582,44 +2582,44 @@ const Ne = {
|
|
|
2582
2582
|
playgroundSettings: "new-chat-ui-chat-settings",
|
|
2583
2583
|
debugLogs: "app:debugLogs"
|
|
2584
2584
|
};
|
|
2585
|
-
function
|
|
2585
|
+
function He(e) {
|
|
2586
2586
|
return `draft:${e}`;
|
|
2587
2587
|
}
|
|
2588
|
-
let
|
|
2589
|
-
const
|
|
2590
|
-
function
|
|
2591
|
-
return
|
|
2588
|
+
let De = null;
|
|
2589
|
+
const Xe = /* @__PURE__ */ new Set();
|
|
2590
|
+
function Et() {
|
|
2591
|
+
return De;
|
|
2592
2592
|
}
|
|
2593
2593
|
function ke(e) {
|
|
2594
|
-
|
|
2594
|
+
De = e, Xe.forEach((t) => t(e));
|
|
2595
2595
|
}
|
|
2596
|
-
function
|
|
2597
|
-
return
|
|
2596
|
+
function Pt(e) {
|
|
2597
|
+
return Xe.add(e), () => Xe.delete(e);
|
|
2598
2598
|
}
|
|
2599
|
-
const
|
|
2600
|
-
let
|
|
2601
|
-
const
|
|
2599
|
+
const Gn = 12e4, Hn = 12e4;
|
|
2600
|
+
let Qe = Gn, Nt = Hn;
|
|
2601
|
+
const re = qt.create({
|
|
2602
2602
|
// BaseURL is set dynamically via ApiProvider -> api.updateConfig
|
|
2603
|
-
timeout:
|
|
2603
|
+
timeout: Qe,
|
|
2604
2604
|
withCredentials: !0
|
|
2605
2605
|
});
|
|
2606
|
-
function
|
|
2606
|
+
function dt(e) {
|
|
2607
2607
|
return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? null : Math.floor(e);
|
|
2608
2608
|
}
|
|
2609
|
-
function
|
|
2610
|
-
const t =
|
|
2611
|
-
t !== null && (
|
|
2609
|
+
function Wn(e) {
|
|
2610
|
+
const t = dt(e.requestTimeoutMs), n = dt(e.historyTimeoutMs);
|
|
2611
|
+
t !== null && (Qe = t, re.defaults.timeout = Qe), n !== null && (Nt = n);
|
|
2612
2612
|
}
|
|
2613
|
-
function
|
|
2614
|
-
return
|
|
2613
|
+
function qn() {
|
|
2614
|
+
return Nt;
|
|
2615
2615
|
}
|
|
2616
|
-
|
|
2617
|
-
|
|
2616
|
+
re.interceptors.request.use((e) => (De && (e.headers.Authorization = `Bearer ${De}`), e));
|
|
2617
|
+
re.interceptors.response.use(
|
|
2618
2618
|
(e) => {
|
|
2619
2619
|
if (typeof window < "u" && (e != null && e.data))
|
|
2620
2620
|
try {
|
|
2621
2621
|
const t = e.data, n = t.data || {}, r = typeof t.token == "string" && t.token || typeof n.token == "string" && n.token || null, o = typeof t.expires_at == "number" && t.expires_at || typeof n.expires_at == "number" && n.expires_at || typeof t.expiresAt == "number" && t.expiresAt || typeof n.expiresAt == "number" && n.expiresAt || null;
|
|
2622
|
-
r && (localStorage.setItem(
|
|
2622
|
+
r && (localStorage.setItem(_e.authToken, r), ke(r)), o && localStorage.setItem(_e.authTokenExpiresAt, o.toString()), (r || o) && window.dispatchEvent(
|
|
2623
2623
|
new CustomEvent("smartorg:chat-token-updated", {
|
|
2624
2624
|
detail: { token: r, expiresAt: o }
|
|
2625
2625
|
})
|
|
@@ -2632,95 +2632,85 @@ oe.interceptors.response.use(
|
|
|
2632
2632
|
(e) => Promise.reject(e)
|
|
2633
2633
|
);
|
|
2634
2634
|
async function se(e, t) {
|
|
2635
|
-
return
|
|
2635
|
+
return re.defaults.baseURL ? (await re.get(e, t)).data : Promise.reject(new Error("API base URL is not configured"));
|
|
2636
2636
|
}
|
|
2637
|
-
async function
|
|
2638
|
-
return
|
|
2637
|
+
async function Ye(e, t, n) {
|
|
2638
|
+
return re.defaults.baseURL ? (await re.post(e, t, n)).data : Promise.reject(new Error("API base URL is not configured"));
|
|
2639
2639
|
}
|
|
2640
|
-
async function
|
|
2641
|
-
return
|
|
2640
|
+
async function Jn(e, t, n) {
|
|
2641
|
+
return re.defaults.baseURL ? (await re.put(e, t, n)).data : Promise.reject(new Error("API base URL is not configured"));
|
|
2642
2642
|
}
|
|
2643
|
-
async function
|
|
2644
|
-
return
|
|
2643
|
+
async function Xn(e, t) {
|
|
2644
|
+
return re.defaults.baseURL ? (await re.delete(e, t)).data : Promise.reject(new Error("API base URL is not configured"));
|
|
2645
2645
|
}
|
|
2646
|
-
function
|
|
2646
|
+
function ae(e) {
|
|
2647
2647
|
return e && typeof e == "object" && "data" in e ? e.data : e;
|
|
2648
2648
|
}
|
|
2649
|
-
class
|
|
2649
|
+
class Qn {
|
|
2650
2650
|
// ---- Configuration ----
|
|
2651
2651
|
// Chat client uses the default httpClient baseURL, no need for internal tracking
|
|
2652
2652
|
// unless we want to support multiple instances with different URLs in the future.
|
|
2653
2653
|
get baseUrl() {
|
|
2654
|
-
return
|
|
2654
|
+
return re.defaults.baseURL || "";
|
|
2655
2655
|
}
|
|
2656
2656
|
updateConfig(t) {
|
|
2657
2657
|
if (t.chatBaseUrl)
|
|
2658
|
-
|
|
2658
|
+
re.defaults.baseURL = t.chatBaseUrl;
|
|
2659
2659
|
else if (t.baseUrl) {
|
|
2660
2660
|
const n = t.baseUrl.replace(/\/+$/, "");
|
|
2661
|
-
|
|
2661
|
+
re.defaults.baseURL = n;
|
|
2662
2662
|
}
|
|
2663
|
-
t.apiKey !== void 0 ? ke(t.apiKey) : t.getToken && ke(t.getToken()), (t.requestTimeoutMs !== void 0 || t.historyTimeoutMs !== void 0) &&
|
|
2663
|
+
t.apiKey !== void 0 ? ke(t.apiKey) : t.getToken && ke(t.getToken()), (t.requestTimeoutMs !== void 0 || t.historyTimeoutMs !== void 0) && Wn({
|
|
2664
2664
|
requestTimeoutMs: t.requestTimeoutMs,
|
|
2665
2665
|
historyTimeoutMs: t.historyTimeoutMs
|
|
2666
2666
|
});
|
|
2667
2667
|
}
|
|
2668
2668
|
// ---- Token Management ----
|
|
2669
2669
|
getAuthToken() {
|
|
2670
|
-
return
|
|
2670
|
+
return Et();
|
|
2671
2671
|
}
|
|
2672
2672
|
setAuthToken(t) {
|
|
2673
2673
|
ke(t);
|
|
2674
2674
|
}
|
|
2675
2675
|
onTokenChange(t) {
|
|
2676
|
-
return
|
|
2676
|
+
return Pt(t);
|
|
2677
2677
|
}
|
|
2678
2678
|
// ---- Thread Management ----
|
|
2679
2679
|
async listThreads() {
|
|
2680
|
-
const t = await se("/threads"), n =
|
|
2681
|
-
return (n == null ? void 0 : n.items) ?? (t == null ? void 0 : t.items) ?? [];
|
|
2682
|
-
}
|
|
2683
|
-
async listSharedThreads() {
|
|
2684
|
-
const t = await se("/threads/shared"), n = re(t);
|
|
2680
|
+
const t = await se("/threads"), n = ae(t);
|
|
2685
2681
|
return (n == null ? void 0 : n.items) ?? (t == null ? void 0 : t.items) ?? [];
|
|
2686
2682
|
}
|
|
2687
2683
|
// listUsers moved to AuthApi
|
|
2688
2684
|
async createThread(t, n) {
|
|
2689
2685
|
const r = {};
|
|
2690
2686
|
t && (r.title = t), n && (r.project = n);
|
|
2691
|
-
const o = await
|
|
2692
|
-
return
|
|
2687
|
+
const o = await Ye("/threads", Object.keys(r).length ? r : void 0);
|
|
2688
|
+
return ae(o);
|
|
2693
2689
|
}
|
|
2694
2690
|
async updateThread(t, n) {
|
|
2695
|
-
const r = await
|
|
2696
|
-
return
|
|
2691
|
+
const r = await Jn(`/threads/${t}`, { title: n });
|
|
2692
|
+
return ae(r);
|
|
2697
2693
|
}
|
|
2698
2694
|
async deleteThread(t) {
|
|
2699
|
-
const n = await
|
|
2700
|
-
return
|
|
2701
|
-
}
|
|
2702
|
-
async shareThread(t, n) {
|
|
2703
|
-
const r = await Oe(`/threads/${t}/share`, {
|
|
2704
|
-
shared_with_user_id: n
|
|
2705
|
-
});
|
|
2706
|
-
return re(r);
|
|
2695
|
+
const n = await Xn(`/threads/${t}`);
|
|
2696
|
+
return ae(n);
|
|
2707
2697
|
}
|
|
2708
2698
|
async threadInfo(t) {
|
|
2709
2699
|
const n = await se(`/threads/${t}/info`);
|
|
2710
|
-
return
|
|
2700
|
+
return ae(n);
|
|
2711
2701
|
}
|
|
2712
2702
|
// ---- Agents ----
|
|
2713
2703
|
async listAgents() {
|
|
2714
|
-
const t = await se("/agents"), n =
|
|
2704
|
+
const t = await se("/agents"), n = ae(t);
|
|
2715
2705
|
return (n == null ? void 0 : n.items) ?? [];
|
|
2716
2706
|
}
|
|
2717
2707
|
async getAgent(t) {
|
|
2718
2708
|
const n = await se(`/agents/${t}`);
|
|
2719
|
-
return
|
|
2709
|
+
return ae(n);
|
|
2720
2710
|
}
|
|
2721
2711
|
async getAgentSchema(t) {
|
|
2722
2712
|
const n = await se(`/agents/${t}/schema`);
|
|
2723
|
-
return
|
|
2713
|
+
return ae(n);
|
|
2724
2714
|
}
|
|
2725
2715
|
async getState(t) {
|
|
2726
2716
|
const n = await se(`/threads/${t.threadId}/state`, {
|
|
@@ -2729,7 +2719,7 @@ class Yn {
|
|
|
2729
2719
|
checkpoint_ns: t.checkpointNs
|
|
2730
2720
|
}
|
|
2731
2721
|
});
|
|
2732
|
-
return
|
|
2722
|
+
return ae(n);
|
|
2733
2723
|
}
|
|
2734
2724
|
async getStateHistory(t) {
|
|
2735
2725
|
const n = await se(`/threads/${t.threadId}/state/history`, {
|
|
@@ -2740,23 +2730,19 @@ class Yn {
|
|
|
2740
2730
|
offset: t.offset ?? 0,
|
|
2741
2731
|
include_messages: t.includeMessages ?? !0
|
|
2742
2732
|
},
|
|
2743
|
-
timeout:
|
|
2733
|
+
timeout: qn(),
|
|
2744
2734
|
signal: t.signal
|
|
2745
2735
|
});
|
|
2746
|
-
return
|
|
2736
|
+
return ae(n);
|
|
2747
2737
|
}
|
|
2748
2738
|
// ---- Run Management ----
|
|
2749
2739
|
async cancelRun(t) {
|
|
2750
|
-
const n = await
|
|
2751
|
-
return
|
|
2752
|
-
}
|
|
2753
|
-
async unshareThread(t, n) {
|
|
2754
|
-
const r = await pt(`/threads/${t}/share/${n}`);
|
|
2755
|
-
return re(r);
|
|
2740
|
+
const n = await Ye(`/runs/${t}/cancel`);
|
|
2741
|
+
return ae(n);
|
|
2756
2742
|
}
|
|
2757
2743
|
}
|
|
2758
|
-
const
|
|
2759
|
-
class
|
|
2744
|
+
const _t = new Qn();
|
|
2745
|
+
class Yn {
|
|
2760
2746
|
// Config logic could go here if files ever need a distinct base URL from chat
|
|
2761
2747
|
// For now, it shares the chatBaseUrl via the shared httpClient
|
|
2762
2748
|
async fetchFileBlob(t, n) {
|
|
@@ -2805,7 +2791,7 @@ class Zn {
|
|
|
2805
2791
|
}
|
|
2806
2792
|
async uploadFile(t, n, r) {
|
|
2807
2793
|
const o = new FormData();
|
|
2808
|
-
return o.append("file", t), n && o.append("thread_id", n), await
|
|
2794
|
+
return o.append("file", t), n && o.append("thread_id", n), await Ye("/files/upload-form", o, {
|
|
2809
2795
|
onUploadProgress: (s) => {
|
|
2810
2796
|
try {
|
|
2811
2797
|
if (r && s.lengthComputable) {
|
|
@@ -2818,11 +2804,11 @@ class Zn {
|
|
|
2818
2804
|
});
|
|
2819
2805
|
}
|
|
2820
2806
|
}
|
|
2821
|
-
const
|
|
2822
|
-
class
|
|
2807
|
+
const zt = new Yn();
|
|
2808
|
+
class Zn {
|
|
2823
2809
|
constructor() {
|
|
2824
2810
|
// ---- Configuration ----
|
|
2825
|
-
|
|
2811
|
+
st(this, "_authBaseUrl", "");
|
|
2826
2812
|
}
|
|
2827
2813
|
get baseUrl() {
|
|
2828
2814
|
return this._authBaseUrl;
|
|
@@ -2838,13 +2824,13 @@ class er {
|
|
|
2838
2824
|
}
|
|
2839
2825
|
// ---- Token Management ----
|
|
2840
2826
|
getAuthToken() {
|
|
2841
|
-
return
|
|
2827
|
+
return Et();
|
|
2842
2828
|
}
|
|
2843
2829
|
setAuthToken(t) {
|
|
2844
2830
|
ke(t);
|
|
2845
2831
|
}
|
|
2846
2832
|
onTokenChange(t) {
|
|
2847
|
-
return
|
|
2833
|
+
return Pt(t);
|
|
2848
2834
|
}
|
|
2849
2835
|
// ---- User Management ----
|
|
2850
2836
|
async listUsers() {
|
|
@@ -2852,9 +2838,9 @@ class er {
|
|
|
2852
2838
|
return (t == null ? void 0 : t.users) ?? [];
|
|
2853
2839
|
}
|
|
2854
2840
|
}
|
|
2855
|
-
const
|
|
2856
|
-
function
|
|
2857
|
-
const n =
|
|
2841
|
+
const er = new Zn(), Rt = Se(null);
|
|
2842
|
+
function tr({ children: e, apiConfig: t }) {
|
|
2843
|
+
const n = _t, r = er;
|
|
2858
2844
|
if (t) {
|
|
2859
2845
|
const s = n.baseUrl, a = r.baseUrl, i = n.getAuthToken(), u = t.requestTimeoutMs !== void 0 || t.historyTimeoutMs !== void 0;
|
|
2860
2846
|
(t.baseUrl || t.chatBaseUrl || u) && (u || t.chatBaseUrl && t.chatBaseUrl !== s || t.baseUrl && !s.startsWith(t.baseUrl)) && n.updateConfig(t), (t.baseUrl || t.authBaseUrl) && (t.authBaseUrl && t.authBaseUrl !== a || t.baseUrl && !a.startsWith(t.baseUrl)) && r.updateConfig(t), t.apiKey !== void 0 && t.apiKey !== i && (n.updateConfig({ apiKey: t.apiKey }), r.updateConfig({ apiKey: t.apiKey }));
|
|
@@ -2866,12 +2852,12 @@ function nr({ children: e, apiConfig: t }) {
|
|
|
2866
2852
|
},
|
|
2867
2853
|
chatApi: n,
|
|
2868
2854
|
authApi: r,
|
|
2869
|
-
fileApi:
|
|
2855
|
+
fileApi: zt,
|
|
2870
2856
|
baseUrl: n.baseUrl
|
|
2871
2857
|
};
|
|
2872
|
-
return /* @__PURE__ */ ie(
|
|
2858
|
+
return /* @__PURE__ */ ie(Rt.Provider, { value: o, children: e });
|
|
2873
2859
|
}
|
|
2874
|
-
async function
|
|
2860
|
+
async function nr(e) {
|
|
2875
2861
|
return await new Promise((t, n) => {
|
|
2876
2862
|
const r = new FileReader();
|
|
2877
2863
|
r.onload = () => {
|
|
@@ -2887,11 +2873,11 @@ async function rr(e) {
|
|
|
2887
2873
|
}, r.onerror = (o) => n(o), r.readAsArrayBuffer(e);
|
|
2888
2874
|
});
|
|
2889
2875
|
}
|
|
2890
|
-
async function
|
|
2876
|
+
async function rr(e = []) {
|
|
2891
2877
|
const t = [], n = [];
|
|
2892
2878
|
for (const r of e)
|
|
2893
2879
|
try {
|
|
2894
|
-
const o = await
|
|
2880
|
+
const o = await nr(r), s = r.type || "application/octet-stream";
|
|
2895
2881
|
n.push({
|
|
2896
2882
|
filename: r.name,
|
|
2897
2883
|
data: o,
|
|
@@ -2910,28 +2896,28 @@ async function or(e = []) {
|
|
|
2910
2896
|
}
|
|
2911
2897
|
return { contentParts: t, filesInfo: n };
|
|
2912
2898
|
}
|
|
2913
|
-
function
|
|
2899
|
+
function or(e) {
|
|
2914
2900
|
return e.filter((t) => t.type === "text").map((t) => t.text).join("");
|
|
2915
2901
|
}
|
|
2916
|
-
function
|
|
2902
|
+
function no(e) {
|
|
2917
2903
|
if (e == null) return null;
|
|
2918
2904
|
const t = String(e).trim();
|
|
2919
2905
|
return t.length > 0 ? t : null;
|
|
2920
2906
|
}
|
|
2921
|
-
function
|
|
2907
|
+
function sr(e) {
|
|
2922
2908
|
const t = e.toolCallId ?? (e.role === "tool" ? e.id : void 0);
|
|
2923
2909
|
return e.role === "tool" && !t && console.error("[meta-utils] CRITICAL: Tool message missing toolCallId!", e), {
|
|
2924
2910
|
toolCallId: t ?? void 0,
|
|
2925
2911
|
name: e.name ?? void 0
|
|
2926
2912
|
};
|
|
2927
2913
|
}
|
|
2928
|
-
function
|
|
2914
|
+
function ro(e) {
|
|
2929
2915
|
var n;
|
|
2930
2916
|
if (e.name && e.name.trim()) return e.name;
|
|
2931
2917
|
const t = (n = e.additionalKwargs) == null ? void 0 : n.agentName;
|
|
2932
2918
|
return typeof t == "string" && t.trim() ? t : e.model && e.model.includes("/") ? e.model.split("/").pop() || null : e.model || null;
|
|
2933
2919
|
}
|
|
2934
|
-
function
|
|
2920
|
+
function oo(e) {
|
|
2935
2921
|
const t = e.updatedAt ?? e.createdAt ?? "", n = Array.isArray(e.content) ? e.content.map((a) => {
|
|
2936
2922
|
switch (a.type) {
|
|
2937
2923
|
case "text":
|
|
@@ -2945,11 +2931,11 @@ function io(e) {
|
|
|
2945
2931
|
return `${e.id}:${t}:${n}${s ? `:${s}` : ""}`;
|
|
2946
2932
|
}
|
|
2947
2933
|
function Ae() {
|
|
2948
|
-
const e = Ue(
|
|
2934
|
+
const e = Ue(Rt);
|
|
2949
2935
|
if (!e) throw new Error("useApi must be used within ApiProvider");
|
|
2950
2936
|
return e;
|
|
2951
2937
|
}
|
|
2952
|
-
function
|
|
2938
|
+
function ar(e, t, n) {
|
|
2953
2939
|
const r = typeof t == "string" ? [{ type: "text", text: t }] : t;
|
|
2954
2940
|
return {
|
|
2955
2941
|
id: `msg-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
@@ -2959,40 +2945,40 @@ function ir(e, t, n) {
|
|
|
2959
2945
|
...n
|
|
2960
2946
|
};
|
|
2961
2947
|
}
|
|
2962
|
-
function
|
|
2963
|
-
return typeof e == "string" ?
|
|
2948
|
+
function Ut(e, t = "user") {
|
|
2949
|
+
return typeof e == "string" ? ar(t, e) : e;
|
|
2964
2950
|
}
|
|
2965
|
-
function
|
|
2951
|
+
function ir(e) {
|
|
2966
2952
|
return !!e && typeof e == "object" && "data" in e;
|
|
2967
2953
|
}
|
|
2968
|
-
function
|
|
2969
|
-
const t = e.baseUrl || "", n = e.streamPath ?? "/runs/stream", [r, o] =
|
|
2970
|
-
|
|
2954
|
+
function cr(e = {}) {
|
|
2955
|
+
const t = e.baseUrl || "", n = e.streamPath ?? "/runs/stream", [r, o] = $(e.token ?? null), s = K(e.headers ?? {}), a = e.credentials ?? "include", i = K(e);
|
|
2956
|
+
W(() => {
|
|
2971
2957
|
i.current = e;
|
|
2972
2958
|
}, [e]);
|
|
2973
|
-
const u =
|
|
2974
|
-
var
|
|
2975
|
-
const
|
|
2976
|
-
if (!
|
|
2977
|
-
(
|
|
2978
|
-
}, []), [c, l] =
|
|
2959
|
+
const u = U((g) => {
|
|
2960
|
+
var j, S, C, L, _, O, F, G, E, D;
|
|
2961
|
+
const w = i.current;
|
|
2962
|
+
if (!w) return;
|
|
2963
|
+
(j = w.onEvent) == null || j.call(w, g), g.type === "thread_info" && ((S = w.onThreadInfo) == null || S.call(w, g)), g.type === "values" && Array.isArray(g.checkpoints) && ((C = w.handleValuesEvent) == null || C.call(w, g)), g.type === "metadata" && ((L = w.onMetadataEvent) == null || L.call(w, g)), typeof g.type == "string" && (g.type === "custom" || g.type.startsWith("custom.")) && ((_ = w.onCustomEvent) == null || _.call(w, g)), g.type === "updates" && ((O = w.onUpdateEvent) == null || O.call(w, g)), g.type === "tool.end" ? (F = w.onToolEnd) == null || F.call(w, g) : g.type === "tool.start" && ((G = w.onToolStart) == null || G.call(w, g)), g.type === "heartbeat" && ((E = w.onHeartbeat) == null || E.call(w, g)), g.type === "token" && ((D = w.onToken) == null || D.call(w, g.token));
|
|
2964
|
+
}, []), [c, l] = $(!1), [p, m] = $(null), [h, k] = $(!1), [d, v] = $(null), I = K(null), A = K(!0), T = K(null), N = U((g) => {
|
|
2979
2965
|
o(g);
|
|
2980
|
-
}, []),
|
|
2981
|
-
m(null),
|
|
2982
|
-
}, []),
|
|
2983
|
-
var
|
|
2966
|
+
}, []), b = U(() => {
|
|
2967
|
+
m(null), v(null);
|
|
2968
|
+
}, []), y = U(() => {
|
|
2969
|
+
var S, C;
|
|
2984
2970
|
console.debug("[use-chat] stop() invoked - aborting stream");
|
|
2985
|
-
const g = (
|
|
2971
|
+
const g = (S = T.current) == null ? void 0 : S.threadId, w = (C = T.current) == null ? void 0 : C.runId, z = () => {
|
|
2986
2972
|
var L;
|
|
2987
|
-
(L =
|
|
2973
|
+
(L = I.current) == null || L.abort(), I.current = null, T.current = null, l(!1), k(!1);
|
|
2988
2974
|
};
|
|
2989
|
-
(
|
|
2975
|
+
(w || g ? _t.cancelRun(w || g).catch((L) => {
|
|
2990
2976
|
console.warn("[use-chat] cancel run failed:", L);
|
|
2991
|
-
}) : Promise.resolve()).finally(
|
|
2992
|
-
}, []),
|
|
2977
|
+
}) : Promise.resolve()).finally(z);
|
|
2978
|
+
}, []), x = U(
|
|
2993
2979
|
(g) => {
|
|
2994
|
-
|
|
2995
|
-
const
|
|
2980
|
+
I.current && (I.current.abort(), I.current = null);
|
|
2981
|
+
const w = {
|
|
2996
2982
|
text: typeof g.content == "string" ? g.content : g.text,
|
|
2997
2983
|
threadId: g.threadId,
|
|
2998
2984
|
attachments: g.attachments,
|
|
@@ -3003,94 +2989,94 @@ function lr(e = {}) {
|
|
|
3003
2989
|
edit: g.edit,
|
|
3004
2990
|
command: g.command
|
|
3005
2991
|
};
|
|
3006
|
-
l(!0), m(null),
|
|
3007
|
-
const
|
|
3008
|
-
|
|
3009
|
-
let
|
|
3010
|
-
return
|
|
3011
|
-
threadId:
|
|
2992
|
+
l(!0), m(null), v(null);
|
|
2993
|
+
const z = new AbortController();
|
|
2994
|
+
I.current = z;
|
|
2995
|
+
let j = null, S = !1;
|
|
2996
|
+
return T.current = {
|
|
2997
|
+
threadId: w.threadId ?? void 0,
|
|
3012
2998
|
runId: void 0,
|
|
3013
2999
|
// Will be updated from headers
|
|
3014
3000
|
headers: {},
|
|
3015
3001
|
isStreaming: !0
|
|
3016
3002
|
}, (async () => {
|
|
3017
|
-
var
|
|
3003
|
+
var C, L, _, O, F, G;
|
|
3018
3004
|
try {
|
|
3019
|
-
let
|
|
3005
|
+
let E = {};
|
|
3020
3006
|
try {
|
|
3021
3007
|
if (r)
|
|
3022
|
-
|
|
3008
|
+
E = { Authorization: `Bearer ${r}` };
|
|
3023
3009
|
else if (typeof window < "u") {
|
|
3024
|
-
const ee = window.__AUTH_TOKEN__, ve = ((
|
|
3025
|
-
let
|
|
3010
|
+
const ee = window.__AUTH_TOKEN__, ve = ((C = window.localStorage) == null ? void 0 : C.getItem(_e.authToken)) || null;
|
|
3011
|
+
let J = null;
|
|
3026
3012
|
try {
|
|
3027
|
-
const me = (L = window.localStorage) == null ? void 0 : L.getItem(
|
|
3028
|
-
me && (
|
|
3013
|
+
const me = (L = window.localStorage) == null ? void 0 : L.getItem(_e.chatSettings);
|
|
3014
|
+
me && (J = ((_ = JSON.parse(me)) == null ? void 0 : _.apiKey) || null);
|
|
3029
3015
|
} catch {
|
|
3030
3016
|
}
|
|
3031
|
-
const Y = ee || ve ||
|
|
3032
|
-
Y && (
|
|
3017
|
+
const Y = ee || ve || J || null;
|
|
3018
|
+
Y && (E = { Authorization: `Bearer ${Y}` });
|
|
3033
3019
|
}
|
|
3034
3020
|
} catch {
|
|
3035
3021
|
}
|
|
3036
3022
|
console.debug("[use-chat] POST", t + n);
|
|
3037
|
-
let
|
|
3023
|
+
let D = {};
|
|
3038
3024
|
if (typeof window < "u")
|
|
3039
3025
|
try {
|
|
3040
|
-
const
|
|
3041
|
-
|
|
3026
|
+
const H = (O = window.localStorage) == null ? void 0 : O.getItem(_e.authSessionId);
|
|
3027
|
+
H && (D = { "X-Session-Id": H });
|
|
3042
3028
|
} catch {
|
|
3043
3029
|
}
|
|
3044
|
-
const
|
|
3045
|
-
...
|
|
3046
|
-
...
|
|
3030
|
+
const Q = {
|
|
3031
|
+
...E,
|
|
3032
|
+
...D,
|
|
3047
3033
|
...s.current
|
|
3048
|
-
},
|
|
3034
|
+
}, f = {
|
|
3049
3035
|
"Content-Type": "application/json",
|
|
3050
3036
|
Accept: "text/event-stream",
|
|
3051
|
-
|
|
3052
|
-
},
|
|
3037
|
+
...Q
|
|
3038
|
+
}, P = await fetch(t + n, {
|
|
3053
3039
|
method: "POST",
|
|
3054
|
-
headers:
|
|
3055
|
-
body: JSON.stringify(
|
|
3056
|
-
signal:
|
|
3040
|
+
headers: f,
|
|
3041
|
+
body: JSON.stringify(w),
|
|
3042
|
+
signal: z.signal,
|
|
3057
3043
|
credentials: a
|
|
3058
3044
|
});
|
|
3059
|
-
if (
|
|
3060
|
-
const
|
|
3045
|
+
if (T.current && (T.current.headers = Q), !P.ok || !P.body) {
|
|
3046
|
+
const H = await P.text().catch(() => "");
|
|
3061
3047
|
console.debug(
|
|
3062
3048
|
"[use-chat] non-OK response",
|
|
3063
|
-
|
|
3064
|
-
|
|
3049
|
+
P.status,
|
|
3050
|
+
H == null ? void 0 : H.slice(0, 500)
|
|
3065
3051
|
);
|
|
3066
|
-
const ee = `stream ${
|
|
3067
|
-
throw ee && (m(ee),
|
|
3052
|
+
const ee = `stream ${P.status}${H ? ": " + H : ""}`;
|
|
3053
|
+
throw ee && (m(ee), j = "error"), new Error(ee);
|
|
3068
3054
|
}
|
|
3069
|
-
|
|
3070
|
-
const
|
|
3071
|
-
let
|
|
3072
|
-
const
|
|
3073
|
-
Date.now() - Z > 18e5 && (m("Stream idle timeout"),
|
|
3055
|
+
k(!0);
|
|
3056
|
+
const M = P.body.getReader(), te = new TextDecoder();
|
|
3057
|
+
let q = "", V = 0, Z = Date.now();
|
|
3058
|
+
const oe = setInterval(() => {
|
|
3059
|
+
Date.now() - Z > 18e5 && (m("Stream idle timeout"), j = "error", z.abort());
|
|
3074
3060
|
}, 5e3), ue = 1024 * 1024;
|
|
3075
3061
|
try {
|
|
3076
|
-
const
|
|
3077
|
-
for (
|
|
3078
|
-
...
|
|
3079
|
-
threadId:
|
|
3080
|
-
runId: ee ??
|
|
3062
|
+
const H = P.headers.get("X-Thread-Id") || P.headers.get("x-thread-id"), ee = P.headers.get("X-Run-Id") || P.headers.get("x-run-id");
|
|
3063
|
+
for (T.current && (T.current = {
|
|
3064
|
+
...T.current,
|
|
3065
|
+
threadId: H ?? T.current.threadId,
|
|
3066
|
+
runId: ee ?? T.current.runId
|
|
3081
3067
|
}); ; ) {
|
|
3082
|
-
const { value: ve, done:
|
|
3083
|
-
if (
|
|
3084
|
-
|
|
3068
|
+
const { value: ve, done: J } = await M.read();
|
|
3069
|
+
if (J) break;
|
|
3070
|
+
q += te.decode(ve, { stream: !0 }), q.length > ue && (q = "", console.warn("Stream buffer reset: exceeded 1MB"));
|
|
3085
3071
|
let Y;
|
|
3086
|
-
for (; (Y =
|
|
3072
|
+
for (; (Y = q.indexOf(`
|
|
3087
3073
|
|
|
3088
3074
|
`)) >= 0; ) {
|
|
3089
|
-
const me =
|
|
3090
|
-
|
|
3091
|
-
const
|
|
3075
|
+
const me = q.slice(0, Y);
|
|
3076
|
+
q = q.slice(Y + 2);
|
|
3077
|
+
const je = me.split(/\r?\n/), Le = [];
|
|
3092
3078
|
let de = null;
|
|
3093
|
-
for (const ye of
|
|
3079
|
+
for (const ye of je)
|
|
3094
3080
|
if (!ye.startsWith(":") && ye) {
|
|
3095
3081
|
if (ye.startsWith("event:")) {
|
|
3096
3082
|
const Te = ye.slice(6).trim();
|
|
@@ -3099,10 +3085,10 @@ function lr(e = {}) {
|
|
|
3099
3085
|
}
|
|
3100
3086
|
if (ye.startsWith("data:")) {
|
|
3101
3087
|
const Te = ye.slice(5);
|
|
3102
|
-
|
|
3088
|
+
Le.push(Te.startsWith(" ") ? Te.slice(1) : Te);
|
|
3103
3089
|
}
|
|
3104
3090
|
}
|
|
3105
|
-
const Ie =
|
|
3091
|
+
const Ie = Le.join(`
|
|
3106
3092
|
`);
|
|
3107
3093
|
if (!Ie) continue;
|
|
3108
3094
|
let ne;
|
|
@@ -3113,87 +3099,87 @@ function lr(e = {}) {
|
|
|
3113
3099
|
continue;
|
|
3114
3100
|
}
|
|
3115
3101
|
de && typeof ne == "object" && ne !== null && !("type" in ne) && (ne.type = de);
|
|
3116
|
-
const Me =
|
|
3102
|
+
const Me = ir(ne) ? ne.data : ne;
|
|
3117
3103
|
if (!Me) {
|
|
3118
3104
|
console.warn("[use-chat] dropped envelope event without payload", ne);
|
|
3119
3105
|
continue;
|
|
3120
3106
|
}
|
|
3121
|
-
const Ee =
|
|
3107
|
+
const Ee = Bn(Me);
|
|
3122
3108
|
Z = Date.now();
|
|
3123
3109
|
const he = Ee.seq;
|
|
3124
3110
|
if (he !== void 0) {
|
|
3125
|
-
if (he <=
|
|
3126
|
-
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: he, lastProcessedSeq:
|
|
3111
|
+
if (he <= V) {
|
|
3112
|
+
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: he, lastProcessedSeq: V, type: Ee.type });
|
|
3127
3113
|
continue;
|
|
3128
3114
|
}
|
|
3129
|
-
|
|
3115
|
+
V = he;
|
|
3130
3116
|
}
|
|
3131
3117
|
u(Ee);
|
|
3132
3118
|
}
|
|
3133
3119
|
}
|
|
3134
|
-
|
|
3135
|
-
} catch (
|
|
3136
|
-
if (
|
|
3137
|
-
|
|
3120
|
+
j === null && !z.signal.aborted && (j = "complete");
|
|
3121
|
+
} catch (H) {
|
|
3122
|
+
if (H.name === "AbortError")
|
|
3123
|
+
j = j ?? "aborted";
|
|
3138
3124
|
else {
|
|
3139
|
-
const ee =
|
|
3140
|
-
|
|
3125
|
+
const ee = H.message || String(H);
|
|
3126
|
+
j = "error", m(ee);
|
|
3141
3127
|
}
|
|
3142
3128
|
} finally {
|
|
3143
3129
|
try {
|
|
3144
|
-
await
|
|
3130
|
+
await M.cancel();
|
|
3145
3131
|
} catch {
|
|
3146
3132
|
} finally {
|
|
3147
|
-
(
|
|
3133
|
+
(F = M.releaseLock) == null || F.call(M);
|
|
3148
3134
|
}
|
|
3149
|
-
clearInterval(
|
|
3135
|
+
clearInterval(oe);
|
|
3150
3136
|
}
|
|
3151
|
-
} catch (
|
|
3152
|
-
if (
|
|
3153
|
-
|
|
3137
|
+
} catch (E) {
|
|
3138
|
+
if (E.name === "AbortError")
|
|
3139
|
+
j = j ?? "aborted";
|
|
3154
3140
|
else {
|
|
3155
|
-
const
|
|
3156
|
-
|
|
3141
|
+
const D = E.message || String(E);
|
|
3142
|
+
j = "error", m(D), S || (S = !0, (G = e.onConnectionError) == null || G.call(e, D));
|
|
3157
3143
|
}
|
|
3158
3144
|
} finally {
|
|
3159
3145
|
try {
|
|
3160
3146
|
if (e.onFinish) {
|
|
3161
|
-
const
|
|
3147
|
+
const E = {
|
|
3162
3148
|
lastSeq: 0,
|
|
3163
3149
|
lastCheckpointId: null,
|
|
3164
3150
|
lastCheckpointNs: null,
|
|
3165
3151
|
lastValues: null
|
|
3166
3152
|
// Let the reducer/history hook provide the final values
|
|
3167
3153
|
};
|
|
3168
|
-
e.onFinish(
|
|
3154
|
+
e.onFinish(E);
|
|
3169
3155
|
}
|
|
3170
|
-
} catch (
|
|
3171
|
-
console.warn("[use-chat] onClosed callback failed",
|
|
3156
|
+
} catch (E) {
|
|
3157
|
+
console.warn("[use-chat] onClosed callback failed", E);
|
|
3172
3158
|
}
|
|
3173
|
-
l(!1),
|
|
3159
|
+
l(!1), k(!1), I.current = null, T.current = null;
|
|
3174
3160
|
}
|
|
3175
3161
|
})(), Promise.resolve();
|
|
3176
3162
|
},
|
|
3177
3163
|
[t, n, r, e, u]
|
|
3178
3164
|
);
|
|
3179
|
-
return
|
|
3165
|
+
return W(() => () => {
|
|
3180
3166
|
var g;
|
|
3181
|
-
|
|
3167
|
+
A.current = !1, (g = I.current) == null || g.abort();
|
|
3182
3168
|
}, []), {
|
|
3183
3169
|
isStreaming: c,
|
|
3184
3170
|
error: p,
|
|
3185
3171
|
assistantText: "",
|
|
3186
3172
|
// Deprecated: use messages from reducer
|
|
3187
|
-
activeMessageId:
|
|
3173
|
+
activeMessageId: d,
|
|
3188
3174
|
streamedMessages: {},
|
|
3189
3175
|
// Deprecated: use messages from reducer
|
|
3190
3176
|
lastCheckpointId: null,
|
|
3191
3177
|
// Deprecated: use checkpoint from reducer
|
|
3192
3178
|
lastSeq: 0,
|
|
3193
3179
|
connected: h,
|
|
3194
|
-
stream:
|
|
3195
|
-
stop:
|
|
3196
|
-
clear:
|
|
3180
|
+
stream: x,
|
|
3181
|
+
stop: y,
|
|
3182
|
+
clear: b,
|
|
3197
3183
|
setToken: N,
|
|
3198
3184
|
values: {},
|
|
3199
3185
|
// Provide empty object for backward compatibility
|
|
@@ -3203,206 +3189,119 @@ function lr(e = {}) {
|
|
|
3203
3189
|
connectionState: p ? "error" : c ? h ? "connected" : "connecting" : "idle",
|
|
3204
3190
|
messages: [],
|
|
3205
3191
|
// useStream doesn't maintain messages, use useChatSession instead
|
|
3206
|
-
submit:
|
|
3192
|
+
submit: x
|
|
3207
3193
|
};
|
|
3208
3194
|
}
|
|
3209
|
-
|
|
3210
|
-
function $e(e) {
|
|
3211
|
-
if (!e) return null;
|
|
3212
|
-
if (typeof e == "string") {
|
|
3213
|
-
const t = e.trim();
|
|
3214
|
-
return t.length ? t : null;
|
|
3215
|
-
}
|
|
3216
|
-
if (Array.isArray(e)) {
|
|
3217
|
-
for (const t of e) {
|
|
3218
|
-
const n = $e(t);
|
|
3219
|
-
if (n)
|
|
3220
|
-
return n;
|
|
3221
|
-
}
|
|
3222
|
-
return null;
|
|
3223
|
-
}
|
|
3224
|
-
if (typeof e == "object") {
|
|
3225
|
-
const t = e;
|
|
3226
|
-
for (const n of ur) {
|
|
3227
|
-
const r = $e(t[n]);
|
|
3228
|
-
if (r)
|
|
3229
|
-
return r;
|
|
3230
|
-
}
|
|
3231
|
-
if ("errors" in t) {
|
|
3232
|
-
const n = $e(t.errors);
|
|
3233
|
-
if (n) return n;
|
|
3234
|
-
}
|
|
3235
|
-
}
|
|
3236
|
-
return null;
|
|
3237
|
-
}
|
|
3238
|
-
function dr(e) {
|
|
3239
|
-
if (!e) return "Request failed";
|
|
3240
|
-
const t = e.response, n = $e(t == null ? void 0 : t.data);
|
|
3241
|
-
if (n) return n;
|
|
3242
|
-
if (t != null && t.statusText)
|
|
3243
|
-
return t.statusText;
|
|
3244
|
-
if (e instanceof Error && e.message)
|
|
3245
|
-
return e.message;
|
|
3246
|
-
if (typeof e == "string") {
|
|
3247
|
-
const r = e.trim();
|
|
3248
|
-
if (r.length) return r;
|
|
3249
|
-
}
|
|
3250
|
-
return t != null && t.status ? `Request failed with status code ${t.status}` : "Request failed";
|
|
3251
|
-
}
|
|
3252
|
-
function fr({
|
|
3195
|
+
function lr({
|
|
3253
3196
|
api: e,
|
|
3254
3197
|
initialThreadId: t = null,
|
|
3255
3198
|
onError: n,
|
|
3256
3199
|
onThreadChange: r,
|
|
3257
3200
|
onCurrentThreadDeleted: o
|
|
3258
3201
|
}) {
|
|
3259
|
-
const [s, a] =
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
}, [i]),
|
|
3263
|
-
t !== void 0 && t !==
|
|
3202
|
+
const [s, a] = $([]), [i, u] = $(t), [c, l] = $(!1), [p, m] = $(null), h = K(i), k = K(/* @__PURE__ */ new Map());
|
|
3203
|
+
W(() => {
|
|
3204
|
+
h.current = i;
|
|
3205
|
+
}, [i]), W(() => {
|
|
3206
|
+
t !== void 0 && t !== h.current && u(t);
|
|
3264
3207
|
}, [t]);
|
|
3265
|
-
const
|
|
3208
|
+
const d = U(async () => {
|
|
3266
3209
|
l(!0), m(null);
|
|
3267
3210
|
try {
|
|
3268
|
-
const
|
|
3269
|
-
a(
|
|
3270
|
-
} catch (
|
|
3271
|
-
const y = String(
|
|
3211
|
+
const b = await e.listThreads();
|
|
3212
|
+
a(b ?? []);
|
|
3213
|
+
} catch (b) {
|
|
3214
|
+
const y = String(b);
|
|
3272
3215
|
m(y), n == null || n(y);
|
|
3273
3216
|
} finally {
|
|
3274
3217
|
l(!1);
|
|
3275
3218
|
}
|
|
3276
|
-
}, [e, n]), b = z(async () => {
|
|
3277
|
-
w(!0), k(null);
|
|
3278
|
-
try {
|
|
3279
|
-
const A = await e.listSharedThreads();
|
|
3280
|
-
v(A ?? []);
|
|
3281
|
-
} catch (A) {
|
|
3282
|
-
const y = String(A);
|
|
3283
|
-
k(y), n == null || n(y);
|
|
3284
|
-
} finally {
|
|
3285
|
-
w(!1);
|
|
3286
|
-
}
|
|
3287
3219
|
}, [e, n]);
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
}, [
|
|
3291
|
-
b();
|
|
3292
|
-
}, [b]), q(() => {
|
|
3220
|
+
W(() => {
|
|
3221
|
+
d();
|
|
3222
|
+
}, [d]), W(() => {
|
|
3293
3223
|
r == null || r(i);
|
|
3294
3224
|
}, [i, r]);
|
|
3295
|
-
const
|
|
3296
|
-
async (
|
|
3225
|
+
const v = U(
|
|
3226
|
+
async (b, y) => {
|
|
3297
3227
|
try {
|
|
3298
|
-
const
|
|
3299
|
-
return u(
|
|
3300
|
-
} catch (
|
|
3301
|
-
const
|
|
3302
|
-
return n == null || n(
|
|
3228
|
+
const x = y && typeof y == "object" ? { id: y.id, name: y.name ?? "" } : void 0, g = await e.createThread(b, x);
|
|
3229
|
+
return u(g.threadId), await d(), g.threadId;
|
|
3230
|
+
} catch (x) {
|
|
3231
|
+
const g = String(x);
|
|
3232
|
+
return n == null || n(g), null;
|
|
3303
3233
|
}
|
|
3304
3234
|
},
|
|
3305
|
-
[e, n,
|
|
3306
|
-
),
|
|
3307
|
-
async (
|
|
3235
|
+
[e, n, d]
|
|
3236
|
+
), I = U(
|
|
3237
|
+
async (b) => {
|
|
3308
3238
|
const y = s;
|
|
3309
|
-
a((
|
|
3310
|
-
const
|
|
3311
|
-
|
|
3239
|
+
a((g) => g.filter((w) => w.threadId !== b));
|
|
3240
|
+
const x = new AbortController();
|
|
3241
|
+
k.current.set(b, x);
|
|
3312
3242
|
try {
|
|
3313
|
-
await e.deleteThread(
|
|
3314
|
-
} catch (
|
|
3243
|
+
await e.deleteThread(b), h.current === b && (u(null), o == null || o());
|
|
3244
|
+
} catch (g) {
|
|
3315
3245
|
a(y);
|
|
3316
|
-
const
|
|
3317
|
-
n == null || n(
|
|
3246
|
+
const w = String(g);
|
|
3247
|
+
n == null || n(w);
|
|
3318
3248
|
} finally {
|
|
3319
|
-
|
|
3249
|
+
k.current.delete(b);
|
|
3320
3250
|
}
|
|
3321
3251
|
},
|
|
3322
3252
|
[e, o, n, s]
|
|
3323
|
-
),
|
|
3324
|
-
async (
|
|
3325
|
-
try {
|
|
3326
|
-
await e.updateThread(A, y), await g();
|
|
3327
|
-
} catch (F) {
|
|
3328
|
-
n == null || n(String(F));
|
|
3329
|
-
}
|
|
3330
|
-
},
|
|
3331
|
-
[e, n, g]
|
|
3332
|
-
), M = z(
|
|
3333
|
-
async (A, y) => {
|
|
3334
|
-
P(!0), I("Sharing thread…");
|
|
3253
|
+
), A = U(
|
|
3254
|
+
async (b, y) => {
|
|
3335
3255
|
try {
|
|
3336
|
-
await e.
|
|
3337
|
-
} catch (
|
|
3338
|
-
|
|
3339
|
-
throw n == null || n($), I(`Failed to share: ${$}`), new Error($);
|
|
3340
|
-
} finally {
|
|
3341
|
-
P(!1);
|
|
3256
|
+
await e.updateThread(b, y), await d();
|
|
3257
|
+
} catch (x) {
|
|
3258
|
+
n == null || n(String(x));
|
|
3342
3259
|
}
|
|
3343
3260
|
},
|
|
3344
|
-
[e, n,
|
|
3345
|
-
),
|
|
3346
|
-
async (A, y) => {
|
|
3347
|
-
try {
|
|
3348
|
-
await e.unshareThread(A, y), await b();
|
|
3349
|
-
} catch (F) {
|
|
3350
|
-
const $ = String(F);
|
|
3351
|
-
throw n == null || n($), F;
|
|
3352
|
-
}
|
|
3353
|
-
},
|
|
3354
|
-
[e, n, b]
|
|
3355
|
-
), R = Q(
|
|
3261
|
+
[e, n, d]
|
|
3262
|
+
), T = X(
|
|
3356
3263
|
() => ({
|
|
3357
|
-
createThread:
|
|
3358
|
-
deleteThread:
|
|
3359
|
-
renameThread:
|
|
3360
|
-
refreshThreads:
|
|
3361
|
-
refreshSharedThreads: b,
|
|
3362
|
-
shareThread: M,
|
|
3363
|
-
unshareThread: L
|
|
3264
|
+
createThread: v,
|
|
3265
|
+
deleteThread: I,
|
|
3266
|
+
renameThread: A,
|
|
3267
|
+
refreshThreads: d
|
|
3364
3268
|
}),
|
|
3365
|
-
[
|
|
3366
|
-
),
|
|
3367
|
-
if (!(
|
|
3269
|
+
[v, I, A, d]
|
|
3270
|
+
), N = U((b) => {
|
|
3271
|
+
if (!(b != null && b.threadId)) return;
|
|
3368
3272
|
const y = {
|
|
3369
|
-
threadId:
|
|
3370
|
-
title:
|
|
3371
|
-
project:
|
|
3372
|
-
createdAt:
|
|
3373
|
-
updatedAt:
|
|
3374
|
-
messageCount:
|
|
3273
|
+
threadId: b.threadId,
|
|
3274
|
+
title: b.title || `Thread ${b.threadId.slice(0, 8)}`,
|
|
3275
|
+
project: b.project,
|
|
3276
|
+
createdAt: b.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
3277
|
+
updatedAt: b.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
3278
|
+
messageCount: b.messageCount ?? 1
|
|
3375
3279
|
};
|
|
3376
|
-
a((
|
|
3377
|
-
let
|
|
3378
|
-
const
|
|
3379
|
-
...
|
|
3380
|
-
title: y.title ??
|
|
3381
|
-
project: y.project ??
|
|
3382
|
-
updatedAt: y.updatedAt ??
|
|
3383
|
-
messageCount: y.messageCount ??
|
|
3384
|
-
}) :
|
|
3385
|
-
return
|
|
3280
|
+
a((x) => {
|
|
3281
|
+
let g = !1;
|
|
3282
|
+
const w = x.map((z) => z.threadId === y.threadId ? (g = !0, console.debug("[useThreadsState] thread_info: updating existing thread", y.threadId), {
|
|
3283
|
+
...z,
|
|
3284
|
+
title: y.title ?? z.title,
|
|
3285
|
+
project: y.project ?? z.project,
|
|
3286
|
+
updatedAt: y.updatedAt ?? z.updatedAt,
|
|
3287
|
+
messageCount: y.messageCount ?? z.messageCount
|
|
3288
|
+
}) : z);
|
|
3289
|
+
return g ? w : (console.debug("[useThreadsState] thread_info: adding thread to list", y.threadId), [y, ...x]);
|
|
3386
3290
|
});
|
|
3387
|
-
}, [])
|
|
3291
|
+
}, []);
|
|
3388
3292
|
return {
|
|
3389
3293
|
threads: s,
|
|
3390
3294
|
currentThreadId: i,
|
|
3391
|
-
currentThreadIdRef:
|
|
3295
|
+
currentThreadIdRef: h,
|
|
3392
3296
|
setCurrentThreadId: u,
|
|
3393
3297
|
isLoadingThreads: c,
|
|
3394
3298
|
threadsError: p,
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
actions: R,
|
|
3398
|
-
addThreadFromEvent: V,
|
|
3399
|
-
shareInFlight: N,
|
|
3400
|
-
shareStatus: E,
|
|
3401
|
-
clearShareStatus: D
|
|
3299
|
+
actions: T,
|
|
3300
|
+
addThreadFromEvent: N
|
|
3402
3301
|
};
|
|
3403
3302
|
}
|
|
3404
|
-
const
|
|
3405
|
-
function
|
|
3303
|
+
const jt = Se(null);
|
|
3304
|
+
function ur({
|
|
3406
3305
|
children: e,
|
|
3407
3306
|
initialThreadId: t = null,
|
|
3408
3307
|
onError: n,
|
|
@@ -3415,19 +3314,14 @@ function pr({
|
|
|
3415
3314
|
currentThreadIdRef: u,
|
|
3416
3315
|
isLoadingThreads: c,
|
|
3417
3316
|
threadsError: l,
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
addThreadFromEvent: v,
|
|
3422
|
-
shareInFlight: f,
|
|
3423
|
-
shareStatus: w,
|
|
3424
|
-
clearShareStatus: k
|
|
3425
|
-
} = fr({
|
|
3317
|
+
actions: p,
|
|
3318
|
+
addThreadFromEvent: m
|
|
3319
|
+
} = lr({
|
|
3426
3320
|
api: o,
|
|
3427
3321
|
initialThreadId: t,
|
|
3428
3322
|
onError: n,
|
|
3429
3323
|
onThreadChange: r
|
|
3430
|
-
}),
|
|
3324
|
+
}), h = X(
|
|
3431
3325
|
() => ({
|
|
3432
3326
|
threads: s,
|
|
3433
3327
|
currentThreadId: a,
|
|
@@ -3435,13 +3329,8 @@ function pr({
|
|
|
3435
3329
|
currentThreadIdRef: u,
|
|
3436
3330
|
isLoading: c,
|
|
3437
3331
|
error: l,
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
actions: h,
|
|
3441
|
-
shareInFlight: f,
|
|
3442
|
-
shareStatus: w,
|
|
3443
|
-
clearShareStatus: k,
|
|
3444
|
-
addThreadFromEvent: v
|
|
3332
|
+
actions: p,
|
|
3333
|
+
addThreadFromEvent: m
|
|
3445
3334
|
}),
|
|
3446
3335
|
[
|
|
3447
3336
|
s,
|
|
@@ -3451,22 +3340,17 @@ function pr({
|
|
|
3451
3340
|
c,
|
|
3452
3341
|
l,
|
|
3453
3342
|
p,
|
|
3454
|
-
m
|
|
3455
|
-
h,
|
|
3456
|
-
f,
|
|
3457
|
-
w,
|
|
3458
|
-
k,
|
|
3459
|
-
v
|
|
3343
|
+
m
|
|
3460
3344
|
]
|
|
3461
3345
|
);
|
|
3462
|
-
return /* @__PURE__ */ ie(
|
|
3346
|
+
return /* @__PURE__ */ ie(jt.Provider, { value: h, children: e });
|
|
3463
3347
|
}
|
|
3464
|
-
function
|
|
3465
|
-
const t = Ue(
|
|
3348
|
+
function rt(e) {
|
|
3349
|
+
const t = Ue(jt);
|
|
3466
3350
|
if (!t && !(e != null && e.optional)) throw new Error("useThreads must be used within a ThreadsProvider");
|
|
3467
3351
|
return t;
|
|
3468
3352
|
}
|
|
3469
|
-
function
|
|
3353
|
+
function Lt(e) {
|
|
3470
3354
|
const t = e.artifact;
|
|
3471
3355
|
return !t || typeof t != "object" ? null : "metadata" in t && t.metadata ? t.metadata : {
|
|
3472
3356
|
id: t.id ?? e.id ?? `artifact-${Date.now()}`,
|
|
@@ -3476,8 +3360,8 @@ function Ot(e) {
|
|
|
3476
3360
|
progress: t.progress ?? void 0
|
|
3477
3361
|
};
|
|
3478
3362
|
}
|
|
3479
|
-
function
|
|
3480
|
-
const n =
|
|
3363
|
+
function dr(e, t) {
|
|
3364
|
+
const n = Lt(e);
|
|
3481
3365
|
if (!n) return e;
|
|
3482
3366
|
const r = {
|
|
3483
3367
|
...n,
|
|
@@ -3492,27 +3376,27 @@ function gr(e, t) {
|
|
|
3492
3376
|
}
|
|
3493
3377
|
};
|
|
3494
3378
|
}
|
|
3495
|
-
function
|
|
3379
|
+
function fr(e, t, n) {
|
|
3496
3380
|
return e.find((r) => {
|
|
3497
|
-
const o =
|
|
3381
|
+
const o = Lt(r);
|
|
3498
3382
|
return !!((o == null ? void 0 : o.id) === t || n && r.toolCallId === n);
|
|
3499
3383
|
}) ?? null;
|
|
3500
3384
|
}
|
|
3501
|
-
function
|
|
3502
|
-
return e.map((t) =>
|
|
3385
|
+
function Oe(e) {
|
|
3386
|
+
return e.map((t) => tt(t)).filter((t) => !!t);
|
|
3503
3387
|
}
|
|
3504
|
-
function
|
|
3388
|
+
function Ft(e, t, n) {
|
|
3505
3389
|
return t < 0 || t >= e.length ? e : [...e.slice(0, t), n, ...e.slice(t + 1)];
|
|
3506
3390
|
}
|
|
3507
|
-
function
|
|
3391
|
+
function pr(e, t, n) {
|
|
3508
3392
|
for (let r = e.length - 1; r >= 0; r--)
|
|
3509
3393
|
if (e[r].role === "assistant") {
|
|
3510
3394
|
const s = { ...e[r], checkpointId: t, checkpointNs: n ?? void 0 };
|
|
3511
|
-
return
|
|
3395
|
+
return Ft(e, r, s);
|
|
3512
3396
|
}
|
|
3513
3397
|
return e;
|
|
3514
3398
|
}
|
|
3515
|
-
const
|
|
3399
|
+
const Ot = {
|
|
3516
3400
|
status: "idle",
|
|
3517
3401
|
messages: [],
|
|
3518
3402
|
taskMessagesByScope: {},
|
|
@@ -3524,7 +3408,7 @@ const Bt = {
|
|
|
3524
3408
|
values: {},
|
|
3525
3409
|
error: null
|
|
3526
3410
|
};
|
|
3527
|
-
function
|
|
3411
|
+
function gr(e, t) {
|
|
3528
3412
|
var n;
|
|
3529
3413
|
switch (t.type) {
|
|
3530
3414
|
case "status":
|
|
@@ -3535,8 +3419,8 @@ function yr(e, t) {
|
|
|
3535
3419
|
};
|
|
3536
3420
|
case "reset":
|
|
3537
3421
|
return {
|
|
3538
|
-
...
|
|
3539
|
-
messages:
|
|
3422
|
+
...Ot,
|
|
3423
|
+
messages: Oe(((n = t.payload) == null ? void 0 : n.messages) ?? [])
|
|
3540
3424
|
};
|
|
3541
3425
|
case "user_message": {
|
|
3542
3426
|
const { message: r } = t.payload;
|
|
@@ -3550,7 +3434,7 @@ function yr(e, t) {
|
|
|
3550
3434
|
};
|
|
3551
3435
|
}
|
|
3552
3436
|
case "seed": {
|
|
3553
|
-
const r =
|
|
3437
|
+
const r = Oe(t.payload.messages), o = {
|
|
3554
3438
|
...e,
|
|
3555
3439
|
status: "idle",
|
|
3556
3440
|
messages: r,
|
|
@@ -3562,31 +3446,31 @@ function yr(e, t) {
|
|
|
3562
3446
|
return Object.prototype.hasOwnProperty.call(t.payload, "checkpointId") && (o.lastCheckpointId = t.payload.checkpointId ?? null), Object.prototype.hasOwnProperty.call(t.payload, "checkpointNs") && (o.lastCheckpointNs = t.payload.checkpointNs ?? null), Object.prototype.hasOwnProperty.call(t.payload, "values") && (o.values = t.payload.values ?? {}), o;
|
|
3563
3447
|
}
|
|
3564
3448
|
case "prepend": {
|
|
3565
|
-
const r =
|
|
3449
|
+
const r = Oe(t.payload.messages);
|
|
3566
3450
|
if (!r.length) return e;
|
|
3567
3451
|
const o = new Set(e.messages.map((a) => a.id)), s = r.filter((a) => !o.has(a.id));
|
|
3568
3452
|
return s.length ? { ...e, messages: [...s, ...e.messages] } : e;
|
|
3569
3453
|
}
|
|
3570
3454
|
case "event":
|
|
3571
|
-
return
|
|
3455
|
+
return ft(e, t.payload.ev);
|
|
3572
3456
|
case "batch": {
|
|
3573
3457
|
const { events: r } = t.payload;
|
|
3574
|
-
return r.length ? r.reduce((o, s) =>
|
|
3458
|
+
return r.length ? r.reduce((o, s) => ft(o, s), e) : e;
|
|
3575
3459
|
}
|
|
3576
3460
|
default:
|
|
3577
3461
|
return e;
|
|
3578
3462
|
}
|
|
3579
3463
|
}
|
|
3580
|
-
function
|
|
3581
|
-
const [t, n] =
|
|
3464
|
+
function mr(e = []) {
|
|
3465
|
+
const [t, n] = Wt(gr, { ...Ot, messages: e }), r = K([]), o = K(null), s = U(() => {
|
|
3582
3466
|
o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), o.current = null;
|
|
3583
3467
|
const c = r.current;
|
|
3584
3468
|
c.length && (r.current = [], n({ type: "batch", payload: { events: c } }));
|
|
3585
|
-
}, []), a =
|
|
3469
|
+
}, []), a = U(() => {
|
|
3586
3470
|
typeof window < "u" && typeof window.requestAnimationFrame == "function" ? o.current === null && (o.current = window.requestAnimationFrame(() => s())) : setTimeout(s, 8);
|
|
3587
|
-
}, [s]), i =
|
|
3471
|
+
}, [s]), i = U((c) => {
|
|
3588
3472
|
r.current.push(c), a();
|
|
3589
|
-
}, [a]), u =
|
|
3473
|
+
}, [a]), u = X(() => ({
|
|
3590
3474
|
setStatus: (c, l) => n({ type: "status", payload: { status: c, error: l } }),
|
|
3591
3475
|
reset: (c) => n({ type: "reset", payload: { messages: c } }),
|
|
3592
3476
|
seed: (c, l) => n({ type: "seed", payload: { messages: c, ...l ?? {} } }),
|
|
@@ -3595,11 +3479,11 @@ function br(e = []) {
|
|
|
3595
3479
|
}), [i]);
|
|
3596
3480
|
return { state: t, dispatch: n, ...u };
|
|
3597
3481
|
}
|
|
3598
|
-
function
|
|
3482
|
+
function ft(e, t) {
|
|
3599
3483
|
var a;
|
|
3600
3484
|
const n = t, r = n == null ? void 0 : n.origin, o = n == null ? void 0 : n.scope, s = r === "task" || typeof o == "string" && o.startsWith("tools:");
|
|
3601
3485
|
if (t.type === "checkpoint") {
|
|
3602
|
-
const i = t.checkpointNs ?? e.lastCheckpointNs ?? null, u =
|
|
3486
|
+
const i = t.checkpointNs ?? e.lastCheckpointNs ?? null, u = pr(e.messages, t.checkpointId, i);
|
|
3603
3487
|
return { ...e, lastCheckpointId: t.checkpointId, lastCheckpointNs: i, messages: u };
|
|
3604
3488
|
}
|
|
3605
3489
|
if (t.type === "status") {
|
|
@@ -3616,7 +3500,7 @@ function gt(e, t) {
|
|
|
3616
3500
|
return { ...e, status: "error", error: t.message, messages: [...e.messages, i] };
|
|
3617
3501
|
}
|
|
3618
3502
|
if (t.type === "values" && ((a = n.values) != null && a.messages)) {
|
|
3619
|
-
const i = n.values, u = Array.isArray(i.messages) ? i.messages : [], c =
|
|
3503
|
+
const i = n.values, u = Array.isArray(i.messages) ? i.messages : [], c = Oe(u), { messages: l, ...p } = i;
|
|
3620
3504
|
if (s) {
|
|
3621
3505
|
const m = typeof o == "string" && o.length > 0 ? o : "task";
|
|
3622
3506
|
return {
|
|
@@ -3633,15 +3517,15 @@ function gt(e, t) {
|
|
|
3633
3517
|
values: p
|
|
3634
3518
|
};
|
|
3635
3519
|
}
|
|
3636
|
-
return t.type === "messages/partial" ?
|
|
3520
|
+
return t.type === "messages/partial" ? hr(e, n) : t.type === "tool.start" ? s ? e : yr(e, t) : t.type === "tool.progress" ? s ? e : br(e, t) : t.type === "tool.end" ? s ? e : wr(e, t) : t.type === "artifact.update" ? vr(e, t) : e;
|
|
3637
3521
|
}
|
|
3638
|
-
function
|
|
3522
|
+
function hr(e, t) {
|
|
3639
3523
|
const r = (t.messages || [t]).find((u) => u.type === "ai" || u.role === "assistant");
|
|
3640
3524
|
if (!r) return e;
|
|
3641
3525
|
const o = r.id, s = r.content ?? "", a = e.assemblingId !== o;
|
|
3642
3526
|
let i = [...e.messages];
|
|
3643
3527
|
if (a) {
|
|
3644
|
-
const u =
|
|
3528
|
+
const u = tt({
|
|
3645
3529
|
...r,
|
|
3646
3530
|
role: "assistant",
|
|
3647
3531
|
content: typeof s == "string" ? [{ type: "text", text: s }] : s
|
|
@@ -3664,7 +3548,7 @@ function wr(e, t) {
|
|
|
3664
3548
|
assemblingId: o
|
|
3665
3549
|
};
|
|
3666
3550
|
}
|
|
3667
|
-
function
|
|
3551
|
+
function ot(e, t) {
|
|
3668
3552
|
var n;
|
|
3669
3553
|
if (!t) return -1;
|
|
3670
3554
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
@@ -3674,11 +3558,11 @@ function st(e, t) {
|
|
|
3674
3558
|
}
|
|
3675
3559
|
return -1;
|
|
3676
3560
|
}
|
|
3677
|
-
function
|
|
3561
|
+
function yr(e, t) {
|
|
3678
3562
|
const n = t, r = n.id || n.callId;
|
|
3679
3563
|
if (!r) return e;
|
|
3680
3564
|
const o = n.name || "tool", s = `Starting ${o}...`;
|
|
3681
|
-
let a = [...e.messages], i =
|
|
3565
|
+
let a = [...e.messages], i = ot(a, r);
|
|
3682
3566
|
if (i === -1) {
|
|
3683
3567
|
for (let u = a.length - 1; u >= 0; u--)
|
|
3684
3568
|
if (a[u].role === "assistant") {
|
|
@@ -3698,11 +3582,11 @@ function vr(e, t) {
|
|
|
3698
3582
|
}
|
|
3699
3583
|
return { ...e, messages: a };
|
|
3700
3584
|
}
|
|
3701
|
-
function
|
|
3585
|
+
function br(e, t) {
|
|
3702
3586
|
const n = t.id;
|
|
3703
3587
|
if (!n) return e;
|
|
3704
3588
|
let r = [...e.messages];
|
|
3705
|
-
const o =
|
|
3589
|
+
const o = ot(r, n);
|
|
3706
3590
|
if (o !== -1) {
|
|
3707
3591
|
const s = r[o], a = ce(t.content), i = (s.toolCalls || []).map(
|
|
3708
3592
|
(u) => u.id === n ? { ...u, content: typeof a == "string" ? a : u.content } : u
|
|
@@ -3711,11 +3595,11 @@ function kr(e, t) {
|
|
|
3711
3595
|
}
|
|
3712
3596
|
return { ...e, messages: r };
|
|
3713
3597
|
}
|
|
3714
|
-
function
|
|
3598
|
+
function wr(e, t) {
|
|
3715
3599
|
const n = t.id;
|
|
3716
3600
|
if (!n) return e;
|
|
3717
3601
|
let r = [...e.messages];
|
|
3718
|
-
const o =
|
|
3602
|
+
const o = ot(r, n), s = ce(t.content ?? t.error);
|
|
3719
3603
|
if (o !== -1) {
|
|
3720
3604
|
const i = r[o], u = (i.toolCalls || []).map(
|
|
3721
3605
|
(c) => c.id === n ? {
|
|
@@ -3738,17 +3622,17 @@ function Ir(e, t) {
|
|
|
3738
3622
|
};
|
|
3739
3623
|
return { ...e, messages: [...r, a] };
|
|
3740
3624
|
}
|
|
3741
|
-
function
|
|
3742
|
-
const n = t.artifactId, r =
|
|
3625
|
+
function vr(e, t) {
|
|
3626
|
+
const n = t.artifactId, r = fr(e.messages, n, t.callId);
|
|
3743
3627
|
if (!r) return e;
|
|
3744
|
-
const o = e.messages.indexOf(r), s =
|
|
3628
|
+
const o = e.messages.indexOf(r), s = dr(r, {
|
|
3745
3629
|
status: t.status,
|
|
3746
3630
|
progress: t.progress,
|
|
3747
3631
|
error: t.error
|
|
3748
3632
|
});
|
|
3749
|
-
return t.partial_data && s.artifact && (s.artifact = { ...s.artifact, ...t.partial_data }), { ...e, messages:
|
|
3633
|
+
return t.partial_data && s.artifact && (s.artifact = { ...s.artifact, ...t.partial_data }), { ...e, messages: Ft(e.messages, o, s) };
|
|
3750
3634
|
}
|
|
3751
|
-
function
|
|
3635
|
+
function ze(e) {
|
|
3752
3636
|
if (!(!e || typeof e != "object" || Array.isArray(e)))
|
|
3753
3637
|
return { ...e };
|
|
3754
3638
|
}
|
|
@@ -3760,7 +3644,7 @@ function Fe(e, t) {
|
|
|
3760
3644
|
return r.trim();
|
|
3761
3645
|
}
|
|
3762
3646
|
}
|
|
3763
|
-
function
|
|
3647
|
+
function kr(e, t) {
|
|
3764
3648
|
if (!e) return null;
|
|
3765
3649
|
for (const n of t) {
|
|
3766
3650
|
const r = e[n];
|
|
@@ -3769,12 +3653,12 @@ function xr(e, t) {
|
|
|
3769
3653
|
}
|
|
3770
3654
|
return null;
|
|
3771
3655
|
}
|
|
3772
|
-
function
|
|
3773
|
-
const t =
|
|
3656
|
+
function pt(e) {
|
|
3657
|
+
const t = ze(e);
|
|
3774
3658
|
if (t)
|
|
3775
|
-
return
|
|
3659
|
+
return ze(t.configurable) ?? t;
|
|
3776
3660
|
}
|
|
3777
|
-
async function
|
|
3661
|
+
async function Ir(e, t) {
|
|
3778
3662
|
var i, u;
|
|
3779
3663
|
if (!e) return e ?? null;
|
|
3780
3664
|
const n = le(e), r = Array.isArray(n.checkpoints) ? n.checkpoints : n.checkpoints ? Object.values(n.checkpoints) : [], o = /* @__PURE__ */ new Set();
|
|
@@ -3786,8 +3670,8 @@ async function Ar(e, t) {
|
|
|
3786
3670
|
if (Array.isArray(m))
|
|
3787
3671
|
for (const h of m) {
|
|
3788
3672
|
if (!h || typeof h != "object" || h.type !== "image_url" && h.type !== "file") continue;
|
|
3789
|
-
const
|
|
3790
|
-
typeof
|
|
3673
|
+
const k = h.fileId || h.file_id;
|
|
3674
|
+
typeof k == "string" && k.trim() && o.add(k);
|
|
3791
3675
|
}
|
|
3792
3676
|
}
|
|
3793
3677
|
}
|
|
@@ -3811,17 +3695,17 @@ async function Ar(e, t) {
|
|
|
3811
3695
|
if (Array.isArray(m))
|
|
3812
3696
|
for (const h of m) {
|
|
3813
3697
|
if (!h || typeof h != "object" || h.type !== "image_url" && h.type !== "file") continue;
|
|
3814
|
-
const
|
|
3815
|
-
if (!
|
|
3816
|
-
const
|
|
3817
|
-
|
|
3698
|
+
const k = h.fileId || h.file_id;
|
|
3699
|
+
if (!k) continue;
|
|
3700
|
+
const d = a.get(k), v = (d == null ? void 0 : d.contentUrl) || (d == null ? void 0 : d.content_url);
|
|
3701
|
+
v && (h.type === "image_url" ? (h.imageUrl = h.imageUrl || {}, h.imageUrl.url = v) : h.type === "file" && (h.url = v, !h.name && (d != null && d.filename || d != null && d.name) && (h.name = (d == null ? void 0 : d.filename) || (d == null ? void 0 : d.name))));
|
|
3818
3702
|
}
|
|
3819
3703
|
}
|
|
3820
3704
|
}
|
|
3821
3705
|
return n;
|
|
3822
3706
|
}
|
|
3823
|
-
function
|
|
3824
|
-
const r = [...(Array.isArray(e == null ? void 0 : e.checkpoints) ? (e == null ? void 0 : e.checkpoints) ?? [] : e != null && e.checkpoints ? Object.values(e.checkpoints) : []).map((s, a) =>
|
|
3707
|
+
function gt(e) {
|
|
3708
|
+
const r = [...(Array.isArray(e == null ? void 0 : e.checkpoints) ? (e == null ? void 0 : e.checkpoints) ?? [] : e != null && e.checkpoints ? Object.values(e.checkpoints) : []).map((s, a) => Tr(le(s), a)).filter((s) => !!s)].sort((s, a) => mt(a.createdAt) - mt(s.createdAt)), o = r[0] ?? null;
|
|
3825
3709
|
return {
|
|
3826
3710
|
threadId: (e == null ? void 0 : e.threadId) ?? "",
|
|
3827
3711
|
latest: o,
|
|
@@ -3829,42 +3713,42 @@ function ht(e) {
|
|
|
3829
3713
|
interrupt: (o == null ? void 0 : o.interrupt) ?? null
|
|
3830
3714
|
};
|
|
3831
3715
|
}
|
|
3832
|
-
function
|
|
3833
|
-
var
|
|
3716
|
+
function Tr(e, t) {
|
|
3717
|
+
var b, y;
|
|
3834
3718
|
if (!e) return null;
|
|
3835
|
-
const n = ((
|
|
3719
|
+
const n = ((b = e.values) == null ? void 0 : b.activeAgent) ?? null, r = (y = e.values) == null ? void 0 : y.messages, s = (Array.isArray(r) ? r : []).map((x) => xr(x, n)).filter((x) => !!x), a = ze(e.metadata) ?? {}, i = pt(e.config), u = ze(e.parentConfig), c = pt(u), l = Fe(i, ["checkpointId"]), p = Fe(i, ["checkpointNs"]), m = Fe(c, ["checkpointId"]), h = ze(e.config), k = Array.isArray(e.tasks) ? e.tasks.map((x) => ({ ...x })) : e.tasks ?? null, d = Array.isArray(e.next) ? [...e.next] : e.next ?? null, v = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), I = {
|
|
3836
3720
|
...a,
|
|
3837
|
-
step:
|
|
3721
|
+
step: kr(a, ["step"]) ?? 0,
|
|
3838
3722
|
source: Fe(a, ["source"]) ?? null
|
|
3839
|
-
},
|
|
3840
|
-
...
|
|
3841
|
-
checkpointId:
|
|
3842
|
-
checkpointNs:
|
|
3843
|
-
})),
|
|
3723
|
+
}, A = s.map((x) => ({
|
|
3724
|
+
...x,
|
|
3725
|
+
checkpointId: x.checkpointId ?? l ?? null,
|
|
3726
|
+
checkpointNs: x.checkpointNs ?? p ?? null
|
|
3727
|
+
})), T = e.values, N = Array.isArray(e.interrupts) ? e.interrupts : Array.isArray(T == null ? void 0 : T.interrupts) ? T.interrupts : [];
|
|
3844
3728
|
return {
|
|
3845
3729
|
checkpointId: l ?? null,
|
|
3846
3730
|
checkpointNs: p ?? null,
|
|
3847
|
-
createdAt:
|
|
3731
|
+
createdAt: v,
|
|
3848
3732
|
parentId: m ?? null,
|
|
3849
|
-
messages:
|
|
3850
|
-
interrupt:
|
|
3733
|
+
messages: A,
|
|
3734
|
+
interrupt: Ar(
|
|
3851
3735
|
N,
|
|
3852
3736
|
t,
|
|
3853
3737
|
l ?? null
|
|
3854
3738
|
),
|
|
3855
|
-
metadata:
|
|
3739
|
+
metadata: I,
|
|
3856
3740
|
config: h ?? null,
|
|
3857
3741
|
parentConfig: u ?? null,
|
|
3858
|
-
next:
|
|
3859
|
-
tasks:
|
|
3742
|
+
next: d,
|
|
3743
|
+
tasks: k,
|
|
3860
3744
|
values: e.values ?? {}
|
|
3861
3745
|
};
|
|
3862
3746
|
}
|
|
3863
|
-
function
|
|
3864
|
-
const n =
|
|
3747
|
+
function xr(e, t) {
|
|
3748
|
+
const n = tt(e);
|
|
3865
3749
|
return n ? (n.role === "assistant" && !n.name && t && (n.name = t), n) : null;
|
|
3866
3750
|
}
|
|
3867
|
-
function
|
|
3751
|
+
function Ar(e, t, n) {
|
|
3868
3752
|
const r = e.length;
|
|
3869
3753
|
for (let o = r - 1; o >= 0; o -= 1) {
|
|
3870
3754
|
const s = e[o];
|
|
@@ -3880,54 +3764,54 @@ function Mr(e, t, n) {
|
|
|
3880
3764
|
}
|
|
3881
3765
|
return null;
|
|
3882
3766
|
}
|
|
3883
|
-
function
|
|
3767
|
+
function mt(e) {
|
|
3884
3768
|
if (!e) return 0;
|
|
3885
3769
|
const t = Date.parse(e);
|
|
3886
3770
|
return Number.isFinite(t) ? t : 0;
|
|
3887
3771
|
}
|
|
3888
|
-
const
|
|
3889
|
-
function
|
|
3772
|
+
const ht = 120;
|
|
3773
|
+
function Sr(e) {
|
|
3890
3774
|
if (!Array.isArray(e))
|
|
3891
3775
|
return "";
|
|
3892
3776
|
const t = e.filter((r) => !!(r && r.type === "text")).map((r) => (r.text ?? "").trim()).filter(Boolean);
|
|
3893
3777
|
if (!t.length)
|
|
3894
3778
|
return "";
|
|
3895
3779
|
const n = t.join(" ").replace(/\s+/g, " ").trim();
|
|
3896
|
-
return n ? n.length >
|
|
3780
|
+
return n ? n.length > ht ? `${n.slice(0, ht - 3)}…` : n : "";
|
|
3897
3781
|
}
|
|
3898
|
-
function
|
|
3899
|
-
return
|
|
3782
|
+
function Cr(e) {
|
|
3783
|
+
return Sr(e.content) || "";
|
|
3900
3784
|
}
|
|
3901
|
-
function
|
|
3785
|
+
function Mr(e) {
|
|
3902
3786
|
const t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Map(), o = [];
|
|
3903
3787
|
for (let c = 0; c < e.length; c++) {
|
|
3904
|
-
const l = e[c], p = l.checkpointId, m = p ?? `cp-${c}`, h = l.metadata ?? {},
|
|
3905
|
-
let
|
|
3906
|
-
const
|
|
3907
|
-
for (const
|
|
3908
|
-
|
|
3909
|
-
const
|
|
3788
|
+
const l = e[c], p = l.checkpointId, m = p ?? `cp-${c}`, h = l.metadata ?? {}, k = typeof h.step == "number" ? h.step : null, d = typeof h.source == "string" ? h.source : null;
|
|
3789
|
+
let v = null, I = null;
|
|
3790
|
+
const A = Array.isArray(l.messages) ? l.messages : [];
|
|
3791
|
+
for (const y of A)
|
|
3792
|
+
y.role === "user" && (I || (I = y), y.id && (v = y.id));
|
|
3793
|
+
const T = l.next && l.next.length > 0 ? String(l.next[0]) : null, N = l.parentConfig ?? null, b = {
|
|
3910
3794
|
id: m,
|
|
3911
|
-
step:
|
|
3912
|
-
source:
|
|
3795
|
+
step: k,
|
|
3796
|
+
source: d,
|
|
3913
3797
|
createdAt: l.createdAt ?? null,
|
|
3914
3798
|
namespace: l.checkpointNs ?? null,
|
|
3915
3799
|
parentId: l.parentId ?? null,
|
|
3916
|
-
next:
|
|
3800
|
+
next: T,
|
|
3917
3801
|
parentConfig: N,
|
|
3918
|
-
userMessageId:
|
|
3802
|
+
userMessageId: v
|
|
3919
3803
|
};
|
|
3920
|
-
if (o.push(
|
|
3921
|
-
const
|
|
3922
|
-
|
|
3804
|
+
if (o.push(b), p && t.set(p, b), p && I) {
|
|
3805
|
+
const y = Cr(I);
|
|
3806
|
+
y && r.set(p, y);
|
|
3923
3807
|
}
|
|
3924
3808
|
n.push({
|
|
3925
3809
|
id: m,
|
|
3926
|
-
messageId:
|
|
3927
|
-
step:
|
|
3928
|
-
source:
|
|
3810
|
+
messageId: v,
|
|
3811
|
+
step: k,
|
|
3812
|
+
source: d,
|
|
3929
3813
|
createdAt: l.createdAt ?? null,
|
|
3930
|
-
next:
|
|
3814
|
+
next: T,
|
|
3931
3815
|
parentConfig: N
|
|
3932
3816
|
});
|
|
3933
3817
|
}
|
|
@@ -3965,13 +3849,13 @@ function _r(e) {
|
|
|
3965
3849
|
for (const p of t.values())
|
|
3966
3850
|
p.userMessageId === c && l.push(p);
|
|
3967
3851
|
return l.length ? (l.sort((p, m) => {
|
|
3968
|
-
const h = typeof p.attemptIndex == "number" ? p.attemptIndex : Number.MAX_SAFE_INTEGER,
|
|
3969
|
-
return h -
|
|
3852
|
+
const h = typeof p.attemptIndex == "number" ? p.attemptIndex : Number.MAX_SAFE_INTEGER, k = typeof m.attemptIndex == "number" ? m.attemptIndex : Number.MAX_SAFE_INTEGER;
|
|
3853
|
+
return h - k;
|
|
3970
3854
|
}), l) : [];
|
|
3971
3855
|
}
|
|
3972
3856
|
};
|
|
3973
3857
|
}
|
|
3974
|
-
function
|
|
3858
|
+
function so(e, t, n) {
|
|
3975
3859
|
if (!e)
|
|
3976
3860
|
return { attemptCount: 1, attemptIndex: 0, attempts: [] };
|
|
3977
3861
|
const r = n.getMessageAttempts(e);
|
|
@@ -3988,10 +3872,10 @@ function co(e, t, n) {
|
|
|
3988
3872
|
attempts: r
|
|
3989
3873
|
};
|
|
3990
3874
|
}
|
|
3991
|
-
function
|
|
3992
|
-
return
|
|
3875
|
+
function Er(e) {
|
|
3876
|
+
return X(() => Mr(e), [e]);
|
|
3993
3877
|
}
|
|
3994
|
-
function
|
|
3878
|
+
function Bt({
|
|
3995
3879
|
api: e,
|
|
3996
3880
|
fileApi: t,
|
|
3997
3881
|
seed: n,
|
|
@@ -4001,152 +3885,152 @@ function Dt({
|
|
|
4001
3885
|
isStreaming: a,
|
|
4002
3886
|
getMessages: i
|
|
4003
3887
|
}) {
|
|
4004
|
-
const [u, c] =
|
|
4005
|
-
() =>
|
|
3888
|
+
const [u, c] = $(null), p = X(
|
|
3889
|
+
() => gt(u),
|
|
4006
3890
|
[u]
|
|
4007
|
-
).checkpoints, m =
|
|
4008
|
-
|
|
3891
|
+
).checkpoints, m = Er(p), h = m.timeline, [k, d] = $(!1), [v, I] = $(!1), [A, T] = $(null), N = K(o), b = K(null), y = K(null);
|
|
3892
|
+
W(() => {
|
|
4009
3893
|
N.current = o;
|
|
4010
3894
|
}, [o]);
|
|
4011
|
-
const
|
|
4012
|
-
async (
|
|
3895
|
+
const x = U(
|
|
3896
|
+
async (C) => {
|
|
4013
3897
|
const L = await e.getState({
|
|
4014
|
-
threadId:
|
|
4015
|
-
checkpointId:
|
|
4016
|
-
checkpointNs:
|
|
4017
|
-
}),
|
|
3898
|
+
threadId: C.threadId,
|
|
3899
|
+
checkpointId: C.checkpointId,
|
|
3900
|
+
checkpointNs: C.checkpointNs
|
|
3901
|
+
}), _ = {
|
|
4018
3902
|
version: "values@1",
|
|
4019
|
-
threadId:
|
|
3903
|
+
threadId: C.threadId,
|
|
4020
3904
|
checkpoints: [L]
|
|
4021
|
-
},
|
|
4022
|
-
return
|
|
3905
|
+
}, O = t ? await Ir(_, t) : _, { latest: F } = gt(O);
|
|
3906
|
+
return F;
|
|
4023
3907
|
},
|
|
4024
3908
|
[e, t]
|
|
4025
|
-
), g =
|
|
4026
|
-
async (
|
|
4027
|
-
var
|
|
4028
|
-
if (!
|
|
4029
|
-
const
|
|
4030
|
-
if (
|
|
4031
|
-
(
|
|
4032
|
-
const
|
|
4033
|
-
|
|
3909
|
+
), g = U(
|
|
3910
|
+
async (C, L) => {
|
|
3911
|
+
var G;
|
|
3912
|
+
if (!C) return;
|
|
3913
|
+
const _ = `${C}:${L ?? "latest"}`, O = i();
|
|
3914
|
+
if (b.current === _ && !k && O.length > 0) return;
|
|
3915
|
+
(G = y.current) == null || G.abort();
|
|
3916
|
+
const F = new AbortController();
|
|
3917
|
+
y.current = F, d(!0), T(null);
|
|
4034
3918
|
try {
|
|
4035
|
-
const
|
|
4036
|
-
threadId:
|
|
3919
|
+
const E = await x({
|
|
3920
|
+
threadId: C,
|
|
4037
3921
|
checkpointId: L ?? void 0
|
|
4038
3922
|
});
|
|
4039
|
-
if (N.current !==
|
|
4040
|
-
n((
|
|
4041
|
-
checkpointId: (
|
|
4042
|
-
checkpointNs: (
|
|
4043
|
-
pendingInterrupt: (
|
|
4044
|
-
values:
|
|
4045
|
-
}),
|
|
4046
|
-
const
|
|
4047
|
-
threadId:
|
|
3923
|
+
if (N.current !== C) return;
|
|
3924
|
+
n((E == null ? void 0 : E.messages) ?? [], {
|
|
3925
|
+
checkpointId: (E == null ? void 0 : E.checkpointId) ?? null,
|
|
3926
|
+
checkpointNs: (E == null ? void 0 : E.checkpointNs) ?? null,
|
|
3927
|
+
pendingInterrupt: (E == null ? void 0 : E.interrupt) ?? null,
|
|
3928
|
+
values: E == null ? void 0 : E.values
|
|
3929
|
+
}), b.current = _;
|
|
3930
|
+
const D = await e.getStateHistory({
|
|
3931
|
+
threadId: C,
|
|
4048
3932
|
limit: 100,
|
|
4049
3933
|
includeMessages: !1
|
|
4050
3934
|
});
|
|
4051
|
-
N.current ===
|
|
4052
|
-
} catch (
|
|
4053
|
-
if (!
|
|
4054
|
-
const
|
|
4055
|
-
|
|
3935
|
+
N.current === C && c(D);
|
|
3936
|
+
} catch (E) {
|
|
3937
|
+
if (!Jt(E)) {
|
|
3938
|
+
const D = String(E);
|
|
3939
|
+
T(D), r == null || r(D);
|
|
4056
3940
|
}
|
|
4057
3941
|
} finally {
|
|
4058
|
-
|
|
3942
|
+
d(!1);
|
|
4059
3943
|
}
|
|
4060
3944
|
},
|
|
4061
|
-
[e, n,
|
|
4062
|
-
),
|
|
4063
|
-
async (
|
|
3945
|
+
[e, n, x, r, k, i]
|
|
3946
|
+
), w = U(
|
|
3947
|
+
async (C, L) => {
|
|
4064
3948
|
if (o) {
|
|
4065
|
-
|
|
3949
|
+
I(!0);
|
|
4066
3950
|
try {
|
|
4067
|
-
const
|
|
3951
|
+
const _ = await x({
|
|
4068
3952
|
threadId: o,
|
|
4069
|
-
checkpointId:
|
|
3953
|
+
checkpointId: C,
|
|
4070
3954
|
checkpointNs: L ?? void 0
|
|
4071
3955
|
});
|
|
4072
|
-
n((
|
|
4073
|
-
checkpointId: (
|
|
4074
|
-
checkpointNs: (
|
|
4075
|
-
pendingInterrupt: (
|
|
4076
|
-
values:
|
|
3956
|
+
n((_ == null ? void 0 : _.messages) ?? [], {
|
|
3957
|
+
checkpointId: (_ == null ? void 0 : _.checkpointId) ?? C,
|
|
3958
|
+
checkpointNs: (_ == null ? void 0 : _.checkpointNs) ?? L,
|
|
3959
|
+
pendingInterrupt: (_ == null ? void 0 : _.interrupt) ?? null,
|
|
3960
|
+
values: _ == null ? void 0 : _.values
|
|
4077
3961
|
});
|
|
4078
|
-
} catch (
|
|
4079
|
-
console.error("[useThreadHistoryState] Navigation failed",
|
|
3962
|
+
} catch (_) {
|
|
3963
|
+
console.error("[useThreadHistoryState] Navigation failed", _);
|
|
4080
3964
|
} finally {
|
|
4081
|
-
|
|
3965
|
+
I(!1);
|
|
4082
3966
|
}
|
|
4083
3967
|
}
|
|
4084
3968
|
},
|
|
4085
|
-
[o,
|
|
4086
|
-
),
|
|
3969
|
+
[o, x, n]
|
|
3970
|
+
), z = U(async () => {
|
|
4087
3971
|
o && await g(o);
|
|
4088
|
-
}, [o, g]),
|
|
4089
|
-
async (
|
|
4090
|
-
var
|
|
4091
|
-
const L = (
|
|
3972
|
+
}, [o, g]), j = U(
|
|
3973
|
+
async (C) => {
|
|
3974
|
+
var O;
|
|
3975
|
+
const L = (C == null ? void 0 : C.threadId) || o;
|
|
4092
3976
|
if (!L || o !== L) return;
|
|
4093
|
-
if (c(
|
|
4094
|
-
const
|
|
3977
|
+
if (c(C), b.current = `${L}:latest`, (O = C.values) != null && O.messages) {
|
|
3978
|
+
const F = await x({
|
|
4095
3979
|
threadId: L
|
|
4096
3980
|
});
|
|
4097
|
-
|
|
4098
|
-
checkpointId:
|
|
4099
|
-
checkpointNs:
|
|
4100
|
-
pendingInterrupt:
|
|
4101
|
-
values:
|
|
3981
|
+
F && n(F.messages ?? [], {
|
|
3982
|
+
checkpointId: F.checkpointId ?? null,
|
|
3983
|
+
checkpointNs: F.checkpointNs ?? null,
|
|
3984
|
+
pendingInterrupt: F.interrupt ?? null,
|
|
3985
|
+
values: F.values
|
|
4102
3986
|
});
|
|
4103
3987
|
}
|
|
4104
3988
|
},
|
|
4105
|
-
[o,
|
|
3989
|
+
[o, x, n]
|
|
4106
3990
|
);
|
|
4107
|
-
|
|
4108
|
-
if (!s || !o ||
|
|
4109
|
-
const
|
|
4110
|
-
|
|
4111
|
-
}, [s, o,
|
|
4112
|
-
const
|
|
4113
|
-
c(null),
|
|
3991
|
+
W(() => {
|
|
3992
|
+
if (!s || !o || k || a) return;
|
|
3993
|
+
const C = `${o}:latest`;
|
|
3994
|
+
b.current !== C && g(o);
|
|
3995
|
+
}, [s, o, k, a, g]);
|
|
3996
|
+
const S = U(() => {
|
|
3997
|
+
c(null), d(!1), I(!1), T(null), b.current = null;
|
|
4114
3998
|
}, []);
|
|
4115
3999
|
return {
|
|
4116
4000
|
threadCheckpoints: p,
|
|
4117
4001
|
threadTimeline: h,
|
|
4118
4002
|
checkpointIndex: m,
|
|
4119
|
-
isLoadingThread:
|
|
4120
|
-
isLoadingCheckpoint:
|
|
4121
|
-
threadStateError:
|
|
4003
|
+
isLoadingThread: k,
|
|
4004
|
+
isLoadingCheckpoint: v,
|
|
4005
|
+
threadStateError: A,
|
|
4122
4006
|
loadThread: g,
|
|
4123
|
-
navigateToCheckpoint:
|
|
4124
|
-
setCurrentCheckpointId: (
|
|
4125
|
-
n(i(), { checkpointId:
|
|
4007
|
+
navigateToCheckpoint: w,
|
|
4008
|
+
setCurrentCheckpointId: (C, L) => {
|
|
4009
|
+
n(i(), { checkpointId: C, checkpointNs: L });
|
|
4126
4010
|
},
|
|
4127
|
-
returnToLatest:
|
|
4128
|
-
handleValuesEvent:
|
|
4011
|
+
returnToLatest: z,
|
|
4012
|
+
handleValuesEvent: j,
|
|
4129
4013
|
markSkipNextLoad: () => {
|
|
4130
4014
|
},
|
|
4131
4015
|
markStreamPendingThread: () => {
|
|
4132
4016
|
},
|
|
4133
|
-
resetHistoryState:
|
|
4134
|
-
clearState:
|
|
4017
|
+
resetHistoryState: S,
|
|
4018
|
+
clearState: S
|
|
4135
4019
|
};
|
|
4136
4020
|
}
|
|
4137
|
-
const
|
|
4138
|
-
function
|
|
4139
|
-
const t = Ue(
|
|
4021
|
+
const $t = Se(null), Vt = Se(null);
|
|
4022
|
+
function Dt(e) {
|
|
4023
|
+
const t = Ue($t);
|
|
4140
4024
|
if (!t && !(e != null && e.optional)) throw new Error("useThreadState must be used within a ThreadStateProvider");
|
|
4141
4025
|
return t;
|
|
4142
4026
|
}
|
|
4143
|
-
function
|
|
4144
|
-
const e = Ue(
|
|
4027
|
+
function Pr() {
|
|
4028
|
+
const e = Ue(Vt);
|
|
4145
4029
|
if (!e)
|
|
4146
4030
|
throw new Error("useThreadStateUpdater must be used within a ThreadStateProvider");
|
|
4147
4031
|
return e;
|
|
4148
4032
|
}
|
|
4149
|
-
function
|
|
4033
|
+
function Nr({
|
|
4150
4034
|
children: e,
|
|
4151
4035
|
initialThreadId: t = null,
|
|
4152
4036
|
initialCheckpointId: n = null,
|
|
@@ -4155,22 +4039,22 @@ function zr({
|
|
|
4155
4039
|
isStreaming: s,
|
|
4156
4040
|
onError: a
|
|
4157
4041
|
}) {
|
|
4158
|
-
const { chatApi: i, fileApi: u } = Ae(), { currentThreadId: c } =
|
|
4159
|
-
threadCheckpoints:
|
|
4160
|
-
threadTimeline:
|
|
4161
|
-
checkpointIndex:
|
|
4162
|
-
isLoadingThread:
|
|
4163
|
-
isLoadingCheckpoint:
|
|
4164
|
-
threadStateError:
|
|
4042
|
+
const { chatApi: i, fileApi: u } = Ae(), { currentThreadId: c } = rt(), { state: l, seed: p, onEvent: m, dispatch: h } = mr(), {
|
|
4043
|
+
threadCheckpoints: k,
|
|
4044
|
+
threadTimeline: d,
|
|
4045
|
+
checkpointIndex: v,
|
|
4046
|
+
isLoadingThread: I,
|
|
4047
|
+
isLoadingCheckpoint: A,
|
|
4048
|
+
threadStateError: T,
|
|
4165
4049
|
loadThread: N,
|
|
4166
|
-
navigateToCheckpoint:
|
|
4167
|
-
setCurrentCheckpointId:
|
|
4168
|
-
returnToLatest:
|
|
4050
|
+
navigateToCheckpoint: b,
|
|
4051
|
+
setCurrentCheckpointId: y,
|
|
4052
|
+
returnToLatest: x,
|
|
4169
4053
|
handleValuesEvent: g,
|
|
4170
|
-
markSkipNextLoad:
|
|
4171
|
-
markStreamPendingThread:
|
|
4172
|
-
resetHistoryState:
|
|
4173
|
-
} =
|
|
4054
|
+
markSkipNextLoad: w,
|
|
4055
|
+
markStreamPendingThread: z,
|
|
4056
|
+
resetHistoryState: j
|
|
4057
|
+
} = Bt({
|
|
4174
4058
|
api: i,
|
|
4175
4059
|
fileApi: u,
|
|
4176
4060
|
seed: p,
|
|
@@ -4181,32 +4065,32 @@ function zr({
|
|
|
4181
4065
|
initialCheckpointNs: r,
|
|
4182
4066
|
autoLoadInitial: o,
|
|
4183
4067
|
isStreaming: s,
|
|
4184
|
-
getMessages:
|
|
4185
|
-
}),
|
|
4186
|
-
(
|
|
4187
|
-
|
|
4068
|
+
getMessages: U(() => l.messages, [l.messages])
|
|
4069
|
+
}), S = K(null), C = U(
|
|
4070
|
+
(f) => {
|
|
4071
|
+
S.current = f;
|
|
4188
4072
|
},
|
|
4189
4073
|
[]
|
|
4190
|
-
), L =
|
|
4191
|
-
(
|
|
4192
|
-
L.current =
|
|
4074
|
+
), L = K(null), _ = U(
|
|
4075
|
+
(f) => {
|
|
4076
|
+
L.current = f;
|
|
4193
4077
|
},
|
|
4194
4078
|
[]
|
|
4195
|
-
),
|
|
4196
|
-
(
|
|
4197
|
-
const
|
|
4079
|
+
), O = X(() => ({ assemblingMessageId: l.assemblingId ?? null }), [l.assemblingId]), F = U(
|
|
4080
|
+
(f, P) => {
|
|
4081
|
+
const M = Ut(f, "user");
|
|
4198
4082
|
return h({
|
|
4199
4083
|
type: "user_message",
|
|
4200
4084
|
payload: {
|
|
4201
|
-
message:
|
|
4202
|
-
editingMessageId:
|
|
4085
|
+
message: M,
|
|
4086
|
+
editingMessageId: P == null ? void 0 : P.editingMessageId
|
|
4203
4087
|
}
|
|
4204
|
-
}),
|
|
4088
|
+
}), M;
|
|
4205
4089
|
},
|
|
4206
4090
|
[h]
|
|
4207
|
-
),
|
|
4208
|
-
|
|
4209
|
-
}, [p,
|
|
4091
|
+
), G = U(async () => {
|
|
4092
|
+
S.current ? await S.current() : (p([], {}), j());
|
|
4093
|
+
}, [p, j]), E = X(() => Ln(l.messages), [l.messages]), D = X(
|
|
4210
4094
|
() => ({
|
|
4211
4095
|
status: l.status,
|
|
4212
4096
|
threadId: c,
|
|
@@ -4217,44 +4101,44 @@ function zr({
|
|
|
4217
4101
|
id: l.lastCheckpointId ?? null,
|
|
4218
4102
|
namespace: l.lastCheckpointNs ?? null
|
|
4219
4103
|
},
|
|
4220
|
-
checkpoints:
|
|
4221
|
-
checkpointIndex:
|
|
4222
|
-
timelineCheckpoints:
|
|
4223
|
-
metadata:
|
|
4104
|
+
checkpoints: k,
|
|
4105
|
+
checkpointIndex: v,
|
|
4106
|
+
timelineCheckpoints: d,
|
|
4107
|
+
metadata: O,
|
|
4224
4108
|
values: l.values ?? {},
|
|
4225
|
-
isLoading:
|
|
4226
|
-
isLoadingCheckpoint:
|
|
4227
|
-
error:
|
|
4109
|
+
isLoading: I,
|
|
4110
|
+
isLoadingCheckpoint: A,
|
|
4111
|
+
error: T,
|
|
4228
4112
|
loadOlder: async () => {
|
|
4229
4113
|
},
|
|
4230
4114
|
// Placeholder
|
|
4231
|
-
seedFromSnapshot: (
|
|
4232
|
-
p(
|
|
4233
|
-
checkpointId:
|
|
4234
|
-
checkpointNs:
|
|
4235
|
-
pendingInterrupt:
|
|
4236
|
-
values:
|
|
4115
|
+
seedFromSnapshot: (f) => {
|
|
4116
|
+
p(f.messages, {
|
|
4117
|
+
checkpointId: f.checkpointId,
|
|
4118
|
+
checkpointNs: f.checkpointNs,
|
|
4119
|
+
pendingInterrupt: f.interrupt,
|
|
4120
|
+
values: f.values
|
|
4237
4121
|
});
|
|
4238
4122
|
},
|
|
4239
|
-
clearState:
|
|
4240
|
-
navigateToCheckpoint:
|
|
4241
|
-
setCurrentCheckpointId:
|
|
4242
|
-
returnToLatest:
|
|
4243
|
-
loadThread: async (
|
|
4244
|
-
await N(
|
|
4123
|
+
clearState: G,
|
|
4124
|
+
navigateToCheckpoint: b,
|
|
4125
|
+
setCurrentCheckpointId: y,
|
|
4126
|
+
returnToLatest: x,
|
|
4127
|
+
loadThread: async (f, P, M) => {
|
|
4128
|
+
await N(f, P, { clearProgress: !1 });
|
|
4245
4129
|
},
|
|
4246
|
-
clearThread:
|
|
4247
|
-
respondToInterrupt: async (
|
|
4248
|
-
L.current && await L.current(
|
|
4130
|
+
clearThread: G,
|
|
4131
|
+
respondToInterrupt: async (f, P, M) => {
|
|
4132
|
+
L.current && await L.current(f, P, M);
|
|
4249
4133
|
},
|
|
4250
|
-
messagePreviews:
|
|
4134
|
+
messagePreviews: v.messagePreviews,
|
|
4251
4135
|
handleValuesEvent: g,
|
|
4252
|
-
markSkipNextLoad:
|
|
4253
|
-
markStreamPendingThread:
|
|
4254
|
-
resetHistoryState:
|
|
4255
|
-
pushUser:
|
|
4136
|
+
markSkipNextLoad: w,
|
|
4137
|
+
markStreamPendingThread: z,
|
|
4138
|
+
resetHistoryState: j,
|
|
4139
|
+
pushUser: F,
|
|
4256
4140
|
onEvent: m,
|
|
4257
|
-
artifacts:
|
|
4141
|
+
artifacts: E
|
|
4258
4142
|
}),
|
|
4259
4143
|
[
|
|
4260
4144
|
c,
|
|
@@ -4264,37 +4148,37 @@ function zr({
|
|
|
4264
4148
|
l.lastCheckpointId,
|
|
4265
4149
|
l.lastCheckpointNs,
|
|
4266
4150
|
l.values,
|
|
4267
|
-
v,
|
|
4268
|
-
f,
|
|
4269
|
-
w,
|
|
4270
|
-
V,
|
|
4271
4151
|
k,
|
|
4272
|
-
|
|
4152
|
+
d,
|
|
4153
|
+
v,
|
|
4154
|
+
O,
|
|
4273
4155
|
I,
|
|
4274
|
-
p,
|
|
4275
4156
|
A,
|
|
4276
|
-
P,
|
|
4277
4157
|
T,
|
|
4278
|
-
|
|
4158
|
+
p,
|
|
4159
|
+
G,
|
|
4160
|
+
b,
|
|
4161
|
+
y,
|
|
4162
|
+
x,
|
|
4279
4163
|
N,
|
|
4280
4164
|
g,
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4165
|
+
w,
|
|
4166
|
+
z,
|
|
4167
|
+
F,
|
|
4284
4168
|
m,
|
|
4285
|
-
|
|
4169
|
+
E
|
|
4286
4170
|
]
|
|
4287
|
-
),
|
|
4171
|
+
), Q = X(
|
|
4288
4172
|
() => ({
|
|
4289
|
-
registerClearThread:
|
|
4290
|
-
registerRespondToInterrupt:
|
|
4173
|
+
registerClearThread: C,
|
|
4174
|
+
registerRespondToInterrupt: _
|
|
4291
4175
|
}),
|
|
4292
|
-
[
|
|
4176
|
+
[C, _]
|
|
4293
4177
|
);
|
|
4294
|
-
return /* @__PURE__ */ ie(
|
|
4178
|
+
return /* @__PURE__ */ ie(Vt.Provider, { value: Q, children: /* @__PURE__ */ ie($t.Provider, { value: D, children: e }) });
|
|
4295
4179
|
}
|
|
4296
|
-
const
|
|
4297
|
-
function
|
|
4180
|
+
const Kt = Se(null), _r = Se(!1);
|
|
4181
|
+
function zr({
|
|
4298
4182
|
children: e,
|
|
4299
4183
|
onError: t,
|
|
4300
4184
|
onAuthError: n,
|
|
@@ -4306,216 +4190,216 @@ function Lr({
|
|
|
4306
4190
|
onFinish: u,
|
|
4307
4191
|
onStreamingChange: c
|
|
4308
4192
|
}) {
|
|
4309
|
-
const { chatApi: l, baseUrl: p } = Ae(), m = p, h = pe(t),
|
|
4193
|
+
const { chatApi: l, baseUrl: p } = Ae(), m = p, h = pe(t), k = pe(n), d = pe(r), v = pe(o), I = pe(s), A = pe(a), T = pe(i), N = pe(u), b = pe(c), y = X(
|
|
4310
4194
|
() => ({
|
|
4311
4195
|
onError: h,
|
|
4312
|
-
onAuthError:
|
|
4313
|
-
onConnectionError:
|
|
4314
|
-
onMetadataEvent:
|
|
4315
|
-
onCustomEvent:
|
|
4316
|
-
onUpdateEvent:
|
|
4317
|
-
onToolEnd:
|
|
4196
|
+
onAuthError: k,
|
|
4197
|
+
onConnectionError: d,
|
|
4198
|
+
onMetadataEvent: T,
|
|
4199
|
+
onCustomEvent: A,
|
|
4200
|
+
onUpdateEvent: I,
|
|
4201
|
+
onToolEnd: v,
|
|
4318
4202
|
onFinish: N
|
|
4319
4203
|
}),
|
|
4320
4204
|
[
|
|
4321
4205
|
h,
|
|
4322
|
-
v,
|
|
4323
|
-
f,
|
|
4324
|
-
I,
|
|
4325
|
-
E,
|
|
4326
4206
|
k,
|
|
4327
|
-
|
|
4207
|
+
d,
|
|
4208
|
+
T,
|
|
4209
|
+
A,
|
|
4210
|
+
I,
|
|
4211
|
+
v,
|
|
4328
4212
|
N
|
|
4329
4213
|
]
|
|
4330
4214
|
);
|
|
4331
|
-
return /* @__PURE__ */ ie(
|
|
4332
|
-
|
|
4215
|
+
return /* @__PURE__ */ ie(_r.Provider, { value: !0, children: /* @__PURE__ */ ie(
|
|
4216
|
+
Rr,
|
|
4333
4217
|
{
|
|
4334
4218
|
api: l,
|
|
4335
4219
|
streamBaseUrl: m,
|
|
4336
|
-
handlers:
|
|
4337
|
-
onStreamingChange:
|
|
4220
|
+
handlers: y,
|
|
4221
|
+
onStreamingChange: b,
|
|
4338
4222
|
children: e
|
|
4339
4223
|
}
|
|
4340
4224
|
) });
|
|
4341
4225
|
}
|
|
4342
|
-
function
|
|
4226
|
+
function Rr({
|
|
4343
4227
|
children: e,
|
|
4344
4228
|
api: t,
|
|
4345
4229
|
streamBaseUrl: n,
|
|
4346
4230
|
handlers: r,
|
|
4347
4231
|
onStreamingChange: o
|
|
4348
4232
|
}) {
|
|
4349
|
-
const { setCurrentThreadId: s, currentThreadIdRef: a, addThreadFromEvent: i, currentThreadId: u } =
|
|
4233
|
+
const { setCurrentThreadId: s, currentThreadIdRef: a, addThreadFromEvent: i, currentThreadId: u } = rt(), {
|
|
4350
4234
|
interrupt: c,
|
|
4351
4235
|
checkpoint: l,
|
|
4352
4236
|
timelineCheckpoints: p,
|
|
4353
4237
|
handleValuesEvent: m,
|
|
4354
4238
|
markSkipNextLoad: h,
|
|
4355
|
-
markStreamPendingThread:
|
|
4356
|
-
resetHistoryState:
|
|
4357
|
-
pushUser:
|
|
4358
|
-
onEvent:
|
|
4359
|
-
messages:
|
|
4360
|
-
} =
|
|
4361
|
-
(
|
|
4362
|
-
i(
|
|
4239
|
+
markStreamPendingThread: k,
|
|
4240
|
+
resetHistoryState: d,
|
|
4241
|
+
pushUser: v,
|
|
4242
|
+
onEvent: I,
|
|
4243
|
+
messages: A
|
|
4244
|
+
} = Dt(), { registerClearThread: T, registerRespondToInterrupt: N } = Pr(), b = U(
|
|
4245
|
+
(f) => {
|
|
4246
|
+
i(f), k(f.threadId), a.current !== f.threadId && ((f.created ?? !a.current) && h(f.threadId), s(f.threadId));
|
|
4363
4247
|
},
|
|
4364
|
-
[i, h,
|
|
4365
|
-
),
|
|
4248
|
+
[i, h, k, s, a]
|
|
4249
|
+
), y = cr({
|
|
4366
4250
|
baseUrl: n,
|
|
4367
|
-
onEvent:
|
|
4368
|
-
onError: (
|
|
4369
|
-
var
|
|
4370
|
-
(
|
|
4251
|
+
onEvent: I,
|
|
4252
|
+
onError: (f) => {
|
|
4253
|
+
var P;
|
|
4254
|
+
(P = r.onError) == null || P.call(r, (f == null ? void 0 : f.message) ?? String(f));
|
|
4371
4255
|
},
|
|
4372
4256
|
onAuthError: r.onAuthError,
|
|
4373
4257
|
onConnectionError: r.onConnectionError,
|
|
4374
4258
|
onFinish: r.onFinish,
|
|
4375
|
-
onThreadInfo:
|
|
4259
|
+
onThreadInfo: b,
|
|
4376
4260
|
onMetadataEvent: r.onMetadataEvent,
|
|
4377
4261
|
onCustomEvent: r.onCustomEvent,
|
|
4378
4262
|
onUpdateEvent: r.onUpdateEvent,
|
|
4379
4263
|
onToolEnd: r.onToolEnd,
|
|
4380
4264
|
handleValuesEvent: m
|
|
4381
4265
|
});
|
|
4382
|
-
|
|
4383
|
-
o == null || o(
|
|
4384
|
-
}, [
|
|
4385
|
-
const { stream:
|
|
4386
|
-
|
|
4387
|
-
u !== void 0 &&
|
|
4388
|
-
}, [u,
|
|
4389
|
-
const
|
|
4390
|
-
async (
|
|
4391
|
-
await
|
|
4266
|
+
W(() => {
|
|
4267
|
+
o == null || o(y.isStreaming);
|
|
4268
|
+
}, [y.isStreaming, o]);
|
|
4269
|
+
const { stream: x, stop: g, clear: w, isStreaming: z, error: j, connected: S, streamedMessages: C, activeMessageId: L } = y;
|
|
4270
|
+
W(() => {
|
|
4271
|
+
u !== void 0 && w();
|
|
4272
|
+
}, [u, w]);
|
|
4273
|
+
const _ = U(
|
|
4274
|
+
async (f, P) => {
|
|
4275
|
+
await x(f, P);
|
|
4392
4276
|
},
|
|
4393
|
-
[
|
|
4394
|
-
),
|
|
4395
|
-
|
|
4396
|
-
|
|
4277
|
+
[x]
|
|
4278
|
+
), O = K(l);
|
|
4279
|
+
W(() => {
|
|
4280
|
+
O.current = l;
|
|
4397
4281
|
}, [l]);
|
|
4398
|
-
const
|
|
4399
|
-
async (
|
|
4282
|
+
const F = U(
|
|
4283
|
+
async (f, P, M) => {
|
|
4400
4284
|
const te = a.current;
|
|
4401
4285
|
if (!te)
|
|
4402
4286
|
throw new Error("No active thread to handle interrupt");
|
|
4403
|
-
const
|
|
4287
|
+
const q = f ? P ?? !0 : !1, V = O.current, Z = (M == null ? void 0 : M.checkpointId) ?? V.id ?? void 0, oe = (M == null ? void 0 : M.checkpointNs) ?? V.namespace ?? void 0, ue = {
|
|
4404
4288
|
threadId: te,
|
|
4405
4289
|
checkpointId: Z,
|
|
4406
|
-
checkpointNs:
|
|
4407
|
-
command: { kind: "resume", value:
|
|
4408
|
-
payload:
|
|
4290
|
+
checkpointNs: oe,
|
|
4291
|
+
command: { kind: "resume", value: q },
|
|
4292
|
+
payload: M == null ? void 0 : M.payload
|
|
4409
4293
|
};
|
|
4410
|
-
|
|
4294
|
+
_(ue);
|
|
4411
4295
|
},
|
|
4412
|
-
[a,
|
|
4296
|
+
[a, _]
|
|
4413
4297
|
);
|
|
4414
|
-
|
|
4415
|
-
N(
|
|
4416
|
-
}, [
|
|
4417
|
-
const
|
|
4418
|
-
g(),
|
|
4419
|
-
}, [
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
}, [
|
|
4423
|
-
const
|
|
4424
|
-
async (
|
|
4425
|
-
|
|
4426
|
-
let
|
|
4427
|
-
const te = (
|
|
4428
|
-
|
|
4429
|
-
const ue = !!(
|
|
4430
|
-
if (!
|
|
4431
|
-
if (!
|
|
4298
|
+
W(() => {
|
|
4299
|
+
N(F);
|
|
4300
|
+
}, [F, N]);
|
|
4301
|
+
const G = U(async () => {
|
|
4302
|
+
g(), w(), d(), s(null);
|
|
4303
|
+
}, [w, d, s, g]);
|
|
4304
|
+
W(() => {
|
|
4305
|
+
T(G);
|
|
4306
|
+
}, [G, T]);
|
|
4307
|
+
const E = U(
|
|
4308
|
+
async (f, P) => {
|
|
4309
|
+
z && g();
|
|
4310
|
+
let M = a.current;
|
|
4311
|
+
const te = (f == null ? void 0 : f.text) ?? "", q = (f == null ? void 0 : f.attachments) ?? [], V = (te == null ? void 0 : te.trim()) ?? "", Z = { ...(f == null ? void 0 : f.payload) ?? {} }, oe = Array.isArray(Z.messages) ? Z.messages : void 0;
|
|
4312
|
+
oe && delete Z.messages;
|
|
4313
|
+
const ue = !!(oe && oe.length), H = !!(f.contentParts && f.contentParts.length > 0);
|
|
4314
|
+
if (!M && !V && q.length === 0 && !ue && !H) return;
|
|
4315
|
+
if (!M) {
|
|
4432
4316
|
const he = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), ye = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")).join("").slice(0, 16);
|
|
4433
|
-
|
|
4317
|
+
M = `${he}${ye}`, h(M), s(M);
|
|
4434
4318
|
}
|
|
4435
4319
|
let ee = null;
|
|
4436
|
-
|
|
4437
|
-
const { contentParts: ve, filesInfo:
|
|
4438
|
-
|
|
4439
|
-
const me =
|
|
4320
|
+
f.contentParts && f.contentParts.length > 0 && (ee = f.contentParts);
|
|
4321
|
+
const { contentParts: ve, filesInfo: J } = ee ? { contentParts: ee, filesInfo: [] } : await rr(q), Y = [...ve];
|
|
4322
|
+
V && Y.push({ type: "text", text: te });
|
|
4323
|
+
const me = f == null ? void 0 : f.originalMessageId, je = !!(f != null && f.edit && me), Le = !ue && Y.length > 0;
|
|
4440
4324
|
let de = null;
|
|
4441
|
-
if (
|
|
4442
|
-
const he =
|
|
4443
|
-
de =
|
|
4325
|
+
if (Le) {
|
|
4326
|
+
const he = je ? me : `msg-${Date.now()}`;
|
|
4327
|
+
de = Ut({
|
|
4444
4328
|
id: he,
|
|
4445
4329
|
role: "user",
|
|
4446
4330
|
content: Y,
|
|
4447
4331
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4448
|
-
}, "user"),
|
|
4332
|
+
}, "user"), je ? v(de, { editingMessageId: me }) : v(de);
|
|
4449
4333
|
}
|
|
4450
|
-
const Ie = ue ?
|
|
4334
|
+
const Ie = ue ? oe : de ? [de] : [], ne = {
|
|
4451
4335
|
...Z,
|
|
4452
|
-
...
|
|
4336
|
+
...J.length ? { files_info: J } : {}
|
|
4453
4337
|
};
|
|
4454
4338
|
Ie.length ? ne.messages = Ie : "messages" in ne || (ne.messages = []);
|
|
4455
|
-
const Me = (
|
|
4456
|
-
if (
|
|
4339
|
+
const Me = (f == null ? void 0 : f.checkpointId) ?? l.id ?? void 0;
|
|
4340
|
+
if (f != null && f.edit && !Me)
|
|
4457
4341
|
throw new Error(
|
|
4458
|
-
`[streaming] Missing checkpointId for edit submit. threadId=${
|
|
4342
|
+
`[streaming] Missing checkpointId for edit submit. threadId=${M ?? "null"}`
|
|
4459
4343
|
);
|
|
4460
4344
|
const Ee = {
|
|
4461
|
-
threadId:
|
|
4462
|
-
content:
|
|
4345
|
+
threadId: M,
|
|
4346
|
+
content: f == null ? void 0 : f.text,
|
|
4463
4347
|
payload: ne,
|
|
4464
|
-
config:
|
|
4348
|
+
config: f == null ? void 0 : f.config,
|
|
4465
4349
|
checkpointId: Me,
|
|
4466
|
-
command:
|
|
4467
|
-
edit:
|
|
4350
|
+
command: f == null ? void 0 : f.command,
|
|
4351
|
+
edit: f == null ? void 0 : f.edit
|
|
4468
4352
|
};
|
|
4469
|
-
return
|
|
4353
|
+
return _(Ee, P);
|
|
4470
4354
|
},
|
|
4471
|
-
[l, a,
|
|
4472
|
-
),
|
|
4473
|
-
const
|
|
4474
|
-
if (!
|
|
4475
|
-
return
|
|
4476
|
-
const
|
|
4477
|
-
return
|
|
4478
|
-
|
|
4479
|
-
}), Array.from(
|
|
4480
|
-
}, [
|
|
4355
|
+
[l, a, z, h, v, _, g, p]
|
|
4356
|
+
), D = X(() => {
|
|
4357
|
+
const f = Object.keys(C).length > 0;
|
|
4358
|
+
if (!z && !f)
|
|
4359
|
+
return A;
|
|
4360
|
+
const P = /* @__PURE__ */ new Map();
|
|
4361
|
+
return A.forEach((M) => P.set(M.id, M)), Object.values(C).forEach((M) => {
|
|
4362
|
+
P.set(M.id, M);
|
|
4363
|
+
}), Array.from(P.values());
|
|
4364
|
+
}, [z, C, A]), Q = X(
|
|
4481
4365
|
() => ({
|
|
4482
|
-
isStreaming:
|
|
4483
|
-
error:
|
|
4484
|
-
connectionState:
|
|
4485
|
-
messages:
|
|
4366
|
+
isStreaming: z,
|
|
4367
|
+
error: j,
|
|
4368
|
+
connectionState: j ? "error" : z ? S ? "connected" : "connecting" : "idle",
|
|
4369
|
+
messages: D,
|
|
4486
4370
|
activeMessageId: L,
|
|
4487
|
-
submit:
|
|
4371
|
+
submit: E,
|
|
4488
4372
|
stop: g,
|
|
4489
4373
|
interrupt: c,
|
|
4490
4374
|
resume: () => Promise.resolve(),
|
|
4491
|
-
goto: (
|
|
4375
|
+
goto: (f, P) => Promise.resolve(),
|
|
4492
4376
|
clearError: () => {
|
|
4493
4377
|
}
|
|
4494
4378
|
// TODO: Implement error clearing
|
|
4495
4379
|
}),
|
|
4496
|
-
[
|
|
4380
|
+
[z, j, E, g, c, S, D]
|
|
4497
4381
|
);
|
|
4498
|
-
return /* @__PURE__ */ ie(
|
|
4382
|
+
return /* @__PURE__ */ ie(Kt.Provider, { value: Q, children: e });
|
|
4499
4383
|
}
|
|
4500
4384
|
function pe(e) {
|
|
4501
|
-
const t =
|
|
4502
|
-
return
|
|
4385
|
+
const t = K(e);
|
|
4386
|
+
return W(() => {
|
|
4503
4387
|
t.current = e;
|
|
4504
|
-
}, [e]),
|
|
4388
|
+
}, [e]), U((...n) => {
|
|
4505
4389
|
const r = t.current;
|
|
4506
4390
|
if (r)
|
|
4507
4391
|
return r(...n);
|
|
4508
4392
|
}, []);
|
|
4509
4393
|
}
|
|
4510
|
-
function
|
|
4511
|
-
return Ue(
|
|
4394
|
+
function Ur(e) {
|
|
4395
|
+
return Ue(Kt);
|
|
4512
4396
|
}
|
|
4513
|
-
function
|
|
4397
|
+
function yt(e) {
|
|
4514
4398
|
return typeof e == "object" && e !== null;
|
|
4515
4399
|
}
|
|
4516
|
-
function
|
|
4400
|
+
function jr(e, t) {
|
|
4517
4401
|
if (Object.is(e, t)) return !0;
|
|
4518
|
-
if (!
|
|
4402
|
+
if (!yt(e) || !yt(t)) return !1;
|
|
4519
4403
|
const n = Object.keys(e), r = Object.keys(t);
|
|
4520
4404
|
if (n.length !== r.length)
|
|
4521
4405
|
return !1;
|
|
@@ -4524,22 +4408,22 @@ function Or(e, t) {
|
|
|
4524
4408
|
return !1;
|
|
4525
4409
|
return !0;
|
|
4526
4410
|
}
|
|
4527
|
-
function
|
|
4528
|
-
const t =
|
|
4529
|
-
return
|
|
4411
|
+
function Lr(e) {
|
|
4412
|
+
const t = K(e), n = K(e);
|
|
4413
|
+
return jr(t.current, e) || (t.current = e, n.current = e), n.current;
|
|
4530
4414
|
}
|
|
4531
|
-
function
|
|
4415
|
+
function Fr(e) {
|
|
4532
4416
|
const t = e.artifact && typeof e.artifact == "object" ? e.artifact : null, n = !t && e.content && typeof e.content == "object" ? e.content : null, r = t ?? n, o = (r == null ? void 0 : r.task_id) ?? (r == null ? void 0 : r.taskId) ?? null;
|
|
4533
4417
|
return typeof o == "string" ? o : null;
|
|
4534
4418
|
}
|
|
4535
|
-
function
|
|
4419
|
+
function ao(e) {
|
|
4536
4420
|
const { setCurrentTaskId: t, getCurrentTaskId: n, onToolEnd: r } = e;
|
|
4537
4421
|
return (o) => {
|
|
4538
|
-
const s =
|
|
4422
|
+
const s = Fr(o), a = (n == null ? void 0 : n()) ?? null;
|
|
4539
4423
|
s && s !== a && t(s), r == null || r(o);
|
|
4540
4424
|
};
|
|
4541
4425
|
}
|
|
4542
|
-
function
|
|
4426
|
+
function io({
|
|
4543
4427
|
children: e,
|
|
4544
4428
|
apiConfig: t,
|
|
4545
4429
|
initialThreadId: n = null,
|
|
@@ -4554,50 +4438,50 @@ function uo({
|
|
|
4554
4438
|
onUpdateEvent: p,
|
|
4555
4439
|
onCustomEvent: m,
|
|
4556
4440
|
onMetadataEvent: h,
|
|
4557
|
-
onFinish:
|
|
4441
|
+
onFinish: k
|
|
4558
4442
|
}) {
|
|
4559
|
-
const
|
|
4443
|
+
const d = Lr(t), [v, I] = $(!1), A = ge(i), T = ge(u), N = ge(a), b = ge(c), y = ge(l), x = ge(p), g = ge(m), w = ge(h), z = ge(k), j = X(
|
|
4560
4444
|
() => ({
|
|
4561
|
-
onError:
|
|
4562
|
-
onAuthError:
|
|
4445
|
+
onError: A,
|
|
4446
|
+
onAuthError: T,
|
|
4563
4447
|
onConnectionError: N,
|
|
4564
|
-
onToolEnd:
|
|
4565
|
-
onUpdateEvent:
|
|
4448
|
+
onToolEnd: y,
|
|
4449
|
+
onUpdateEvent: x,
|
|
4566
4450
|
onCustomEvent: g,
|
|
4567
|
-
onMetadataEvent:
|
|
4568
|
-
onFinish:
|
|
4451
|
+
onMetadataEvent: w,
|
|
4452
|
+
onFinish: z
|
|
4569
4453
|
}),
|
|
4570
4454
|
[
|
|
4571
|
-
|
|
4572
|
-
I,
|
|
4573
|
-
N,
|
|
4455
|
+
A,
|
|
4574
4456
|
T,
|
|
4575
|
-
|
|
4457
|
+
N,
|
|
4458
|
+
y,
|
|
4459
|
+
x,
|
|
4576
4460
|
g,
|
|
4577
|
-
|
|
4578
|
-
|
|
4461
|
+
w,
|
|
4462
|
+
z
|
|
4579
4463
|
]
|
|
4580
4464
|
);
|
|
4581
|
-
return /* @__PURE__ */ ie(
|
|
4582
|
-
|
|
4465
|
+
return /* @__PURE__ */ ie(tr, { apiConfig: d, children: /* @__PURE__ */ ie(
|
|
4466
|
+
ur,
|
|
4583
4467
|
{
|
|
4584
4468
|
initialThreadId: n,
|
|
4585
|
-
onError:
|
|
4586
|
-
onThreadChange:
|
|
4469
|
+
onError: A,
|
|
4470
|
+
onThreadChange: b,
|
|
4587
4471
|
children: /* @__PURE__ */ ie(
|
|
4588
|
-
|
|
4472
|
+
Nr,
|
|
4589
4473
|
{
|
|
4590
4474
|
initialThreadId: n,
|
|
4591
4475
|
initialCheckpointId: r,
|
|
4592
4476
|
initialCheckpointNs: o,
|
|
4593
4477
|
autoLoadInitial: s,
|
|
4594
|
-
onError:
|
|
4595
|
-
isStreaming:
|
|
4478
|
+
onError: A,
|
|
4479
|
+
isStreaming: v,
|
|
4596
4480
|
children: /* @__PURE__ */ ie(
|
|
4597
|
-
|
|
4481
|
+
zr,
|
|
4598
4482
|
{
|
|
4599
|
-
...
|
|
4600
|
-
onStreamingChange:
|
|
4483
|
+
...j,
|
|
4484
|
+
onStreamingChange: I,
|
|
4601
4485
|
children: e
|
|
4602
4486
|
}
|
|
4603
4487
|
)
|
|
@@ -4607,34 +4491,34 @@ function uo({
|
|
|
4607
4491
|
) });
|
|
4608
4492
|
}
|
|
4609
4493
|
function ge(e) {
|
|
4610
|
-
const t =
|
|
4611
|
-
return t.current = e,
|
|
4494
|
+
const t = K(e);
|
|
4495
|
+
return t.current = e, U((...n) => {
|
|
4612
4496
|
const r = t.current;
|
|
4613
4497
|
if (r)
|
|
4614
4498
|
return r(...n);
|
|
4615
4499
|
}, []);
|
|
4616
4500
|
}
|
|
4617
|
-
const
|
|
4618
|
-
let
|
|
4619
|
-
function
|
|
4620
|
-
return
|
|
4501
|
+
const Or = 1, Br = 1e6;
|
|
4502
|
+
let We = 0;
|
|
4503
|
+
function $r() {
|
|
4504
|
+
return We = (We + 1) % Number.MAX_SAFE_INTEGER, We.toString();
|
|
4621
4505
|
}
|
|
4622
|
-
const
|
|
4623
|
-
if (
|
|
4506
|
+
const qe = /* @__PURE__ */ new Map(), bt = (e) => {
|
|
4507
|
+
if (qe.has(e))
|
|
4624
4508
|
return;
|
|
4625
4509
|
const t = setTimeout(() => {
|
|
4626
|
-
|
|
4510
|
+
qe.delete(e), Re({
|
|
4627
4511
|
type: "REMOVE_TOAST",
|
|
4628
4512
|
toastId: e
|
|
4629
4513
|
});
|
|
4630
|
-
},
|
|
4631
|
-
|
|
4632
|
-
},
|
|
4514
|
+
}, Br);
|
|
4515
|
+
qe.set(e, t);
|
|
4516
|
+
}, Vr = (e, t) => {
|
|
4633
4517
|
switch (t.type) {
|
|
4634
4518
|
case "ADD_TOAST":
|
|
4635
4519
|
return {
|
|
4636
4520
|
...e,
|
|
4637
|
-
toasts: [t.toast, ...e.toasts].slice(0,
|
|
4521
|
+
toasts: [t.toast, ...e.toasts].slice(0, Or)
|
|
4638
4522
|
};
|
|
4639
4523
|
case "UPDATE_TOAST":
|
|
4640
4524
|
return {
|
|
@@ -4645,8 +4529,8 @@ const Xe = /* @__PURE__ */ new Map(), vt = (e) => {
|
|
|
4645
4529
|
};
|
|
4646
4530
|
case "DISMISS_TOAST": {
|
|
4647
4531
|
const { toastId: n } = t;
|
|
4648
|
-
return n ?
|
|
4649
|
-
|
|
4532
|
+
return n ? bt(n) : e.toasts.forEach((r) => {
|
|
4533
|
+
bt(r.id);
|
|
4650
4534
|
}), {
|
|
4651
4535
|
...e,
|
|
4652
4536
|
toasts: e.toasts.map(
|
|
@@ -4666,19 +4550,19 @@ const Xe = /* @__PURE__ */ new Map(), vt = (e) => {
|
|
|
4666
4550
|
toasts: e.toasts.filter((n) => n.id !== t.toastId)
|
|
4667
4551
|
};
|
|
4668
4552
|
}
|
|
4669
|
-
},
|
|
4670
|
-
let
|
|
4671
|
-
function
|
|
4672
|
-
|
|
4673
|
-
t(
|
|
4553
|
+
}, Be = [];
|
|
4554
|
+
let $e = { toasts: [] };
|
|
4555
|
+
function Re(e) {
|
|
4556
|
+
$e = Vr($e, e), Be.forEach((t) => {
|
|
4557
|
+
t($e);
|
|
4674
4558
|
});
|
|
4675
4559
|
}
|
|
4676
|
-
function
|
|
4677
|
-
const t =
|
|
4560
|
+
function Dr({ ...e }) {
|
|
4561
|
+
const t = $r(), n = (o) => Re({
|
|
4678
4562
|
type: "UPDATE_TOAST",
|
|
4679
4563
|
toast: { ...o, id: t }
|
|
4680
|
-
}), r = () =>
|
|
4681
|
-
return
|
|
4564
|
+
}), r = () => Re({ type: "DISMISS_TOAST", toastId: t });
|
|
4565
|
+
return Re({
|
|
4682
4566
|
type: "ADD_TOAST",
|
|
4683
4567
|
toast: {
|
|
4684
4568
|
...e,
|
|
@@ -4694,77 +4578,77 @@ function Hr({ ...e }) {
|
|
|
4694
4578
|
update: n
|
|
4695
4579
|
};
|
|
4696
4580
|
}
|
|
4697
|
-
function
|
|
4698
|
-
const [e, t] =
|
|
4699
|
-
return
|
|
4700
|
-
const n =
|
|
4701
|
-
n > -1 &&
|
|
4581
|
+
function Kr() {
|
|
4582
|
+
const [e, t] = at.useState($e);
|
|
4583
|
+
return at.useEffect(() => (Be.push(t), () => {
|
|
4584
|
+
const n = Be.indexOf(t);
|
|
4585
|
+
n > -1 && Be.splice(n, 1);
|
|
4702
4586
|
}), [e]), {
|
|
4703
4587
|
...e,
|
|
4704
|
-
toast:
|
|
4705
|
-
dismiss: (n) =>
|
|
4588
|
+
toast: Dr,
|
|
4589
|
+
dismiss: (n) => Re({ type: "DISMISS_TOAST", toastId: n })
|
|
4706
4590
|
};
|
|
4707
4591
|
}
|
|
4708
|
-
function
|
|
4709
|
-
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Ae(), { toast: o } =
|
|
4592
|
+
function co(e) {
|
|
4593
|
+
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Ae(), { toast: o } = Kr(), [s, a] = $({}), [i, u] = $(null), [c, l] = $(!1), p = U(() => {
|
|
4710
4594
|
l(!1), u(null);
|
|
4711
|
-
}, []), m =
|
|
4712
|
-
u(
|
|
4713
|
-
}, []), h =
|
|
4714
|
-
async (
|
|
4715
|
-
var
|
|
4595
|
+
}, []), m = U((k) => {
|
|
4596
|
+
u(k), l(!0);
|
|
4597
|
+
}, []), h = U(
|
|
4598
|
+
async (k, d, v) => {
|
|
4599
|
+
var I, A;
|
|
4716
4600
|
if (!t) {
|
|
4717
|
-
|
|
4601
|
+
k.preventDefault();
|
|
4718
4602
|
return;
|
|
4719
4603
|
}
|
|
4720
|
-
if (s[
|
|
4721
|
-
|
|
4604
|
+
if (s[v]) {
|
|
4605
|
+
k.preventDefault();
|
|
4722
4606
|
return;
|
|
4723
4607
|
}
|
|
4724
4608
|
try {
|
|
4725
|
-
const
|
|
4609
|
+
const T = String(d.url ?? ""), N = T.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
|
|
4726
4610
|
if (N) {
|
|
4727
|
-
|
|
4728
|
-
const
|
|
4729
|
-
m({ id:
|
|
4611
|
+
k.preventDefault();
|
|
4612
|
+
const b = N[1], y = d.name || `file_${b}`, x = d.mimeType || "application/octet-stream";
|
|
4613
|
+
m({ id: b, name: y, mimeType: x });
|
|
4730
4614
|
return;
|
|
4731
4615
|
}
|
|
4732
|
-
if (
|
|
4733
|
-
|
|
4734
|
-
const
|
|
4616
|
+
if (T.startsWith("data:")) {
|
|
4617
|
+
k.preventDefault(), a((y) => ({ ...y, [v]: !0 }));
|
|
4618
|
+
const b = o({ title: "Fetching file...", description: "", open: !0 });
|
|
4735
4619
|
try {
|
|
4736
|
-
const
|
|
4737
|
-
if (!
|
|
4620
|
+
const y = await r.listFiles(n ?? void 0);
|
|
4621
|
+
if (!y || !Array.isArray(y))
|
|
4738
4622
|
throw new Error("Invalid file list response");
|
|
4739
|
-
const
|
|
4740
|
-
if (!(
|
|
4741
|
-
throw new Error(`File "${
|
|
4742
|
-
if (!
|
|
4623
|
+
const x = y.find((g) => !g || typeof g != "object" || !((g.filename ?? "") === (d.name ?? "")) ? !1 : typeof d.size == "number" && typeof g.size == "number" ? g.size === d.size : !0);
|
|
4624
|
+
if (!(x != null && x.id))
|
|
4625
|
+
throw new Error(`File "${d.name}" is not yet available on the server`);
|
|
4626
|
+
if (!x.id || !x.filename)
|
|
4743
4627
|
throw new Error("Invalid file data received from server");
|
|
4744
4628
|
m({
|
|
4745
|
-
id:
|
|
4746
|
-
name:
|
|
4747
|
-
mimeType:
|
|
4748
|
-
}), (
|
|
4749
|
-
id:
|
|
4629
|
+
id: x.id,
|
|
4630
|
+
name: d.name || x.filename || `file_${x.id}`,
|
|
4631
|
+
mimeType: d.mimeType || x.mime_type || "application/octet-stream"
|
|
4632
|
+
}), (I = b.update) == null || I.call(b, {
|
|
4633
|
+
id: b.id,
|
|
4750
4634
|
title: "Success",
|
|
4751
|
-
description: `Opened ${
|
|
4635
|
+
description: `Opened ${d.name}`,
|
|
4752
4636
|
open: !0
|
|
4753
4637
|
});
|
|
4754
|
-
} catch (
|
|
4755
|
-
console.error("Failed to fetch server file:",
|
|
4756
|
-
const
|
|
4757
|
-
(
|
|
4638
|
+
} catch (y) {
|
|
4639
|
+
console.error("Failed to fetch server file:", y);
|
|
4640
|
+
const x = y instanceof Error ? y.message : "Unknown error occurred";
|
|
4641
|
+
(A = b.update) == null || A.call(b, { id: b.id, title: "Failed", description: x }), o({
|
|
4758
4642
|
title: "Failed to fetch file",
|
|
4759
|
-
description:
|
|
4643
|
+
description: x,
|
|
4760
4644
|
open: !0
|
|
4761
4645
|
});
|
|
4762
4646
|
} finally {
|
|
4763
|
-
a((
|
|
4647
|
+
a((y) => ({ ...y, [v]: !1 }));
|
|
4764
4648
|
}
|
|
4765
4649
|
}
|
|
4766
|
-
} catch (
|
|
4767
|
-
console.error("File click error:",
|
|
4650
|
+
} catch (T) {
|
|
4651
|
+
console.error("File click error:", T), a((N) => ({ ...N, [v]: !1 }));
|
|
4768
4652
|
}
|
|
4769
4653
|
},
|
|
4770
4654
|
[t, s, o, n, m]
|
|
@@ -4777,38 +4661,38 @@ function fo(e) {
|
|
|
4777
4661
|
closeFileViewer: p
|
|
4778
4662
|
};
|
|
4779
4663
|
}
|
|
4780
|
-
function
|
|
4781
|
-
return
|
|
4664
|
+
function lo(e) {
|
|
4665
|
+
return X(() => {
|
|
4782
4666
|
const t = e;
|
|
4783
4667
|
let n = Array.isArray(t.content) ? t.content : [];
|
|
4784
4668
|
return typeof t.content == "string" && (n = [{ type: "text", text: t.content }]), {
|
|
4785
4669
|
contentParts: n,
|
|
4786
|
-
textContent:
|
|
4787
|
-
toolMeta:
|
|
4670
|
+
textContent: or(n),
|
|
4671
|
+
toolMeta: sr(t),
|
|
4788
4672
|
imageParts: n.filter((r) => r.type === "image_url"),
|
|
4789
4673
|
fileParts: n.filter((r) => r.type === "file"),
|
|
4790
|
-
toolRaw:
|
|
4674
|
+
toolRaw: Fn(n),
|
|
4791
4675
|
isToolStreaming: !!t.toolStreaming
|
|
4792
4676
|
};
|
|
4793
4677
|
}, [e]);
|
|
4794
4678
|
}
|
|
4795
|
-
const
|
|
4796
|
-
function
|
|
4679
|
+
const wt = "data:";
|
|
4680
|
+
function Gr(e) {
|
|
4797
4681
|
if (!e) return [];
|
|
4798
4682
|
const t = [], n = e.split(/\r?\n/);
|
|
4799
4683
|
for (const r of n) {
|
|
4800
4684
|
const o = r.trim();
|
|
4801
|
-
if (!o || !o.startsWith(
|
|
4685
|
+
if (!o || !o.startsWith(wt))
|
|
4802
4686
|
continue;
|
|
4803
|
-
const s = o.slice(
|
|
4687
|
+
const s = o.slice(wt.length).trim();
|
|
4804
4688
|
if (!s || s.toLowerCase() === "[done]")
|
|
4805
4689
|
continue;
|
|
4806
|
-
const a =
|
|
4690
|
+
const a = et(s);
|
|
4807
4691
|
a && typeof a == "object" && t.push(a);
|
|
4808
4692
|
}
|
|
4809
4693
|
return t;
|
|
4810
4694
|
}
|
|
4811
|
-
function
|
|
4695
|
+
function Hr(e) {
|
|
4812
4696
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
4813
4697
|
const n = e[t];
|
|
4814
4698
|
if (n && typeof n == "object" && n.type === "tool.end")
|
|
@@ -4816,24 +4700,24 @@ function Jr(e) {
|
|
|
4816
4700
|
}
|
|
4817
4701
|
return null;
|
|
4818
4702
|
}
|
|
4819
|
-
function
|
|
4820
|
-
return
|
|
4703
|
+
function uo(e) {
|
|
4704
|
+
return X(() => {
|
|
4821
4705
|
const t = e.content.filter(
|
|
4822
4706
|
(u) => u.type === "text"
|
|
4823
4707
|
);
|
|
4824
4708
|
if (!t.length)
|
|
4825
4709
|
return null;
|
|
4826
4710
|
let r = t.flatMap(
|
|
4827
|
-
(u) =>
|
|
4711
|
+
(u) => Gr(u.text ?? "")
|
|
4828
4712
|
);
|
|
4829
4713
|
if (!r.length) {
|
|
4830
4714
|
const u = t.map((l) => l.text ?? "").join(`
|
|
4831
|
-
`), c =
|
|
4715
|
+
`), c = et(u);
|
|
4832
4716
|
c && typeof c == "object" && (r = [c]);
|
|
4833
4717
|
}
|
|
4834
4718
|
if (!r.length)
|
|
4835
4719
|
return null;
|
|
4836
|
-
const s =
|
|
4720
|
+
const s = Hr(r) ?? r[r.length - 1];
|
|
4837
4721
|
if (!s)
|
|
4838
4722
|
return null;
|
|
4839
4723
|
const a = s.output ?? s.payload ?? s, i = ce(a);
|
|
@@ -4849,21 +4733,21 @@ function go(e) {
|
|
|
4849
4733
|
};
|
|
4850
4734
|
}, [e]);
|
|
4851
4735
|
}
|
|
4852
|
-
function
|
|
4853
|
-
var
|
|
4854
|
-
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r =
|
|
4736
|
+
function Wr(e) {
|
|
4737
|
+
var z;
|
|
4738
|
+
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r = rt({ optional: !0 }), o = Dt({ optional: !0 }), s = Ur(), { currentThreadId: a, setCurrentThreadId: i, actions: u } = r || {
|
|
4855
4739
|
currentThreadId: null,
|
|
4856
4740
|
setCurrentThreadId: () => {
|
|
4857
4741
|
},
|
|
4858
4742
|
actions: {}
|
|
4859
|
-
}, c = !!t && t !== a, [l, p] =
|
|
4860
|
-
p(
|
|
4743
|
+
}, c = !!t && t !== a, [l, p] = $([]), m = U((j) => {
|
|
4744
|
+
p(j);
|
|
4861
4745
|
}, []), {
|
|
4862
4746
|
isLoadingThread: h,
|
|
4863
|
-
threadStateError:
|
|
4864
|
-
threadCheckpoints:
|
|
4865
|
-
loadThread:
|
|
4866
|
-
} =
|
|
4747
|
+
threadStateError: k,
|
|
4748
|
+
threadCheckpoints: d,
|
|
4749
|
+
loadThread: v
|
|
4750
|
+
} = Bt({
|
|
4867
4751
|
api: Ae().chatApi,
|
|
4868
4752
|
fileApi: Ae().fileApi,
|
|
4869
4753
|
seed: m,
|
|
@@ -4873,23 +4757,23 @@ function Xr(e) {
|
|
|
4873
4757
|
getMessages: () => l,
|
|
4874
4758
|
autoLoadInitial: c && !n
|
|
4875
4759
|
});
|
|
4876
|
-
|
|
4760
|
+
W(() => {
|
|
4877
4761
|
!c && !n && a && (o != null && o.loadThread) && o.loadThread(a);
|
|
4878
4762
|
}, [c, n, a, o == null ? void 0 : o.loadThread]);
|
|
4879
|
-
const
|
|
4880
|
-
var
|
|
4881
|
-
return ((
|
|
4882
|
-
}, [
|
|
4763
|
+
const I = X(() => {
|
|
4764
|
+
var j;
|
|
4765
|
+
return ((j = d[0]) == null ? void 0 : j.values) || {};
|
|
4766
|
+
}, [d]), A = X(() => ({ timeline: [], messagePreviews: {} }), []), T = t || a, N = c ? h ? "loading" : "idle" : (o == null ? void 0 : o.status) || "idle", b = c ? l : (s == null ? void 0 : s.messages) || [], y = c ? h : (o == null ? void 0 : o.isLoading) || !1, x = c ? I : (o == null ? void 0 : o.values) || {}, g = c ? {} : (o == null ? void 0 : o.taskMessagesByScope) || {}, w = c ? k : (s == null ? void 0 : s.error) || (o == null ? void 0 : o.error) || null;
|
|
4883
4767
|
return {
|
|
4884
4768
|
// UNIFIED: Single thread ID concept
|
|
4885
|
-
threadId:
|
|
4769
|
+
threadId: T,
|
|
4886
4770
|
status: N,
|
|
4887
|
-
messages:
|
|
4888
|
-
isLoading:
|
|
4889
|
-
isHistoryLoading:
|
|
4890
|
-
error:
|
|
4771
|
+
messages: b,
|
|
4772
|
+
isLoading: y,
|
|
4773
|
+
isHistoryLoading: y,
|
|
4774
|
+
error: w,
|
|
4891
4775
|
// Values & Metadata
|
|
4892
|
-
values:
|
|
4776
|
+
values: x,
|
|
4893
4777
|
taskMessagesByScope: g,
|
|
4894
4778
|
metadata: c ? {} : o == null ? void 0 : o.metadata,
|
|
4895
4779
|
// Actions & State relating to Global/Active Thread only
|
|
@@ -4899,9 +4783,9 @@ function Xr(e) {
|
|
|
4899
4783
|
returnToLatest: c ? async () => {
|
|
4900
4784
|
} : (o == null ? void 0 : o.returnToLatest) || (async () => {
|
|
4901
4785
|
}),
|
|
4902
|
-
checkpoint: c ?
|
|
4903
|
-
checkpoints: c ?
|
|
4904
|
-
checkpointIndex: c ?
|
|
4786
|
+
checkpoint: c ? d[0] ? { id: d[0].checkpointId, namespace: d[0].checkpointNs } : null : (o == null ? void 0 : o.checkpoint) || null,
|
|
4787
|
+
checkpoints: c ? d : (o == null ? void 0 : o.checkpoints) || [],
|
|
4788
|
+
checkpointIndex: c ? A : (o == null ? void 0 : o.checkpointIndex) || { timeline: [], messagePreviews: {} },
|
|
4905
4789
|
interrupt: c ? null : (o == null ? void 0 : o.interrupt) || null,
|
|
4906
4790
|
respondToInterrupt: c ? async () => {
|
|
4907
4791
|
} : (o == null ? void 0 : o.respondToInterrupt) || (async () => {
|
|
@@ -4911,7 +4795,7 @@ function Xr(e) {
|
|
|
4911
4795
|
isStreaming: (s == null ? void 0 : s.isStreaming) || !1,
|
|
4912
4796
|
activeMessageId: (s == null ? void 0 : s.activeMessageId) || null,
|
|
4913
4797
|
connectionState: (s == null ? void 0 : s.connectionState) || "disconnected",
|
|
4914
|
-
streamingAssistantId: !c && (s != null && s.isStreaming) && ((
|
|
4798
|
+
streamingAssistantId: !c && (s != null && s.isStreaming) && ((z = o == null ? void 0 : o.metadata) != null && z.assemblingMessageId) ? o.metadata.assemblingMessageId : null,
|
|
4915
4799
|
// Actions
|
|
4916
4800
|
submit: (s == null ? void 0 : s.submit) || (async () => {
|
|
4917
4801
|
}),
|
|
@@ -4922,19 +4806,18 @@ function Xr(e) {
|
|
|
4922
4806
|
}),
|
|
4923
4807
|
setCurrentThreadId: i,
|
|
4924
4808
|
loadHistory: c ? async () => {
|
|
4925
|
-
t && await
|
|
4809
|
+
t && await v(t);
|
|
4926
4810
|
} : async () => {
|
|
4927
4811
|
},
|
|
4928
4812
|
// Thread Management
|
|
4929
4813
|
createThread: u == null ? void 0 : u.createThread,
|
|
4930
4814
|
deleteThread: u == null ? void 0 : u.deleteThread,
|
|
4931
4815
|
renameThread: u == null ? void 0 : u.renameThread,
|
|
4932
|
-
shareThread: u == null ? void 0 : u.shareThread,
|
|
4933
4816
|
threads: (r == null ? void 0 : r.threads) || [],
|
|
4934
4817
|
isThreadsLoading: (r == null ? void 0 : r.isLoading) || !1
|
|
4935
4818
|
};
|
|
4936
4819
|
}
|
|
4937
|
-
function
|
|
4820
|
+
function fo({
|
|
4938
4821
|
submit: e,
|
|
4939
4822
|
chatRequest: t,
|
|
4940
4823
|
lastCheckpointId: n,
|
|
@@ -4950,82 +4833,82 @@ function mo({
|
|
|
4950
4833
|
threadId: m,
|
|
4951
4834
|
clearComposerOnSend: h = !0
|
|
4952
4835
|
}) {
|
|
4953
|
-
const { messages:
|
|
4954
|
-
|
|
4955
|
-
if (!
|
|
4836
|
+
const { messages: k } = Wr(), [d, v] = $(null), [I, A] = $(""), [T, N] = $(null), [b, y] = $(null), [x, g] = $(!1), [w, z] = $(""), j = K(w), S = K(null);
|
|
4837
|
+
W(() => {
|
|
4838
|
+
if (!d)
|
|
4956
4839
|
if (m) {
|
|
4957
|
-
const
|
|
4958
|
-
|
|
4840
|
+
const f = localStorage.getItem(He(m));
|
|
4841
|
+
z(f || "");
|
|
4959
4842
|
} else
|
|
4960
|
-
|
|
4961
|
-
}, [m,
|
|
4962
|
-
const
|
|
4963
|
-
|
|
4964
|
-
}, [m,
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
}, [
|
|
4968
|
-
if (!
|
|
4969
|
-
|
|
4843
|
+
z("");
|
|
4844
|
+
}, [m, d]);
|
|
4845
|
+
const C = U((f) => {
|
|
4846
|
+
z(f), !d && m && localStorage.setItem(He(m), f);
|
|
4847
|
+
}, [m, d]);
|
|
4848
|
+
W(() => {
|
|
4849
|
+
j.current = w;
|
|
4850
|
+
}, [w]), W(() => {
|
|
4851
|
+
if (!d) {
|
|
4852
|
+
S.current = null;
|
|
4970
4853
|
return;
|
|
4971
4854
|
}
|
|
4972
|
-
|
|
4973
|
-
}, [
|
|
4974
|
-
const L =
|
|
4975
|
-
(
|
|
4976
|
-
|
|
4855
|
+
S.current === null && (S.current = j.current), C(I ?? "");
|
|
4856
|
+
}, [I, d, C]);
|
|
4857
|
+
const L = U(
|
|
4858
|
+
(f) => {
|
|
4859
|
+
C(f);
|
|
4977
4860
|
},
|
|
4978
|
-
[
|
|
4979
|
-
),
|
|
4980
|
-
const
|
|
4981
|
-
if (!(!
|
|
4861
|
+
[C]
|
|
4862
|
+
), _ = async (f, P) => {
|
|
4863
|
+
const M = Array.isArray(P) ? { files: P } : P ?? {}, te = M.files ?? [], q = M.contentParts ?? [], V = f.trim();
|
|
4864
|
+
if (!(!V && te.length === 0 && q.length === 0))
|
|
4982
4865
|
try {
|
|
4983
|
-
const Z = te.map(async (
|
|
4866
|
+
const Z = te.map(async (J) => {
|
|
4984
4867
|
try {
|
|
4985
|
-
const Y = await
|
|
4986
|
-
return { file:
|
|
4868
|
+
const Y = await zt.uploadFile(J);
|
|
4869
|
+
return { file: J, record: Y };
|
|
4987
4870
|
} catch (Y) {
|
|
4988
|
-
throw console.error("Failed to upload file",
|
|
4871
|
+
throw console.error("Failed to upload file", J.name, Y), new Error(`Failed to upload ${J.name}`);
|
|
4989
4872
|
}
|
|
4990
|
-
}), ue = (await Promise.all(Z)).map(({ record:
|
|
4991
|
-
const Y =
|
|
4873
|
+
}), ue = (await Promise.all(Z)).map(({ record: J }) => {
|
|
4874
|
+
const Y = J.mime_type;
|
|
4992
4875
|
return Y.startsWith("image/") ? {
|
|
4993
4876
|
type: "image_url",
|
|
4994
|
-
image_url: { url:
|
|
4877
|
+
image_url: { url: J.content_url }
|
|
4995
4878
|
} : {
|
|
4996
4879
|
type: "file",
|
|
4997
|
-
url:
|
|
4880
|
+
url: J.content_url,
|
|
4998
4881
|
mimeType: Y,
|
|
4999
|
-
name:
|
|
5000
|
-
size:
|
|
4882
|
+
name: J.filename,
|
|
4883
|
+
size: J.size
|
|
5001
4884
|
};
|
|
5002
|
-
}),
|
|
4885
|
+
}), H = [...q, ...ue], ee = d ? (T == null ? void 0 : T.checkpointId) ?? n ?? void 0 : n ?? void 0, ve = d ? (T == null ? void 0 : T.checkpointNs) ?? r ?? void 0 : r ?? void 0;
|
|
5003
4886
|
await e(
|
|
5004
4887
|
{
|
|
5005
|
-
text:
|
|
5006
|
-
contentParts:
|
|
4888
|
+
text: V || "",
|
|
4889
|
+
contentParts: H,
|
|
5007
4890
|
attachments: te,
|
|
5008
4891
|
payload: t.payload,
|
|
5009
|
-
edit: !!
|
|
4892
|
+
edit: !!d,
|
|
5010
4893
|
checkpointId: ee,
|
|
5011
4894
|
checkpointNs: ve,
|
|
5012
4895
|
project: l ?? void 0,
|
|
5013
|
-
originalMessageId:
|
|
4896
|
+
originalMessageId: d ?? void 0,
|
|
5014
4897
|
config: t.config
|
|
5015
4898
|
},
|
|
5016
4899
|
p ? { onEvent: p } : void 0
|
|
5017
|
-
), o == null || o(
|
|
4900
|
+
), o == null || o(V), c(!0), h && (m && localStorage.removeItem(He(m)), C("")), y(null), v(null), A(""), N(null);
|
|
5018
4901
|
} catch (Z) {
|
|
5019
|
-
const
|
|
5020
|
-
|
|
4902
|
+
const oe = (Z == null ? void 0 : Z.message) || "Failed to send message";
|
|
4903
|
+
y(oe), a == null || a(oe), c(!1);
|
|
5021
4904
|
}
|
|
5022
|
-
},
|
|
5023
|
-
|
|
5024
|
-
},
|
|
5025
|
-
async (
|
|
4905
|
+
}, O = (f, P) => {
|
|
4906
|
+
P || _(f, { files: [] });
|
|
4907
|
+
}, F = U(
|
|
4908
|
+
async (f) => {
|
|
5026
4909
|
await e(
|
|
5027
4910
|
{
|
|
5028
|
-
attachments: [
|
|
4911
|
+
attachments: [f],
|
|
5029
4912
|
payload: t.payload,
|
|
5030
4913
|
checkpointId: n ?? void 0,
|
|
5031
4914
|
checkpointNs: r ?? void 0,
|
|
@@ -5033,73 +4916,73 @@ function mo({
|
|
|
5033
4916
|
config: t.config
|
|
5034
4917
|
},
|
|
5035
4918
|
p ? { onEvent: p } : void 0
|
|
5036
|
-
), s == null || s({ file:
|
|
4919
|
+
), s == null || s({ file: f });
|
|
5037
4920
|
},
|
|
5038
4921
|
[n, r, t, s, e]
|
|
5039
|
-
),
|
|
5040
|
-
(
|
|
5041
|
-
i && (
|
|
5042
|
-
checkpointId: (
|
|
5043
|
-
checkpointNs: (
|
|
5044
|
-
}),
|
|
4922
|
+
), G = U(
|
|
4923
|
+
(f, P, M) => {
|
|
4924
|
+
i && (S.current = w, v(f), A(P), N({
|
|
4925
|
+
checkpointId: (M == null ? void 0 : M.checkpointId) ?? null,
|
|
4926
|
+
checkpointNs: (M == null ? void 0 : M.checkpointNs) ?? null
|
|
4927
|
+
}), y(null));
|
|
5045
4928
|
},
|
|
5046
|
-
[
|
|
5047
|
-
),
|
|
5048
|
-
|
|
5049
|
-
const
|
|
5050
|
-
|
|
5051
|
-
}, []),
|
|
5052
|
-
let
|
|
5053
|
-
for (let
|
|
5054
|
-
if (u[
|
|
5055
|
-
|
|
4929
|
+
[w, i]
|
|
4930
|
+
), E = U(() => {
|
|
4931
|
+
v(null), A(""), N(null), y(null);
|
|
4932
|
+
const f = S.current;
|
|
4933
|
+
f !== null && z(f), S.current = null;
|
|
4934
|
+
}, []), D = U((f) => {
|
|
4935
|
+
let P = null;
|
|
4936
|
+
for (let V = f - 1; V >= 0; V--)
|
|
4937
|
+
if (u[V].role === "user") {
|
|
4938
|
+
P = u[V];
|
|
5056
4939
|
break;
|
|
5057
4940
|
}
|
|
5058
|
-
if (!
|
|
5059
|
-
const
|
|
4941
|
+
if (!P) return;
|
|
4942
|
+
const M = Array.isArray(P.content) ? P.content : [], q = M.filter((V) => (V == null ? void 0 : V.type) === "text").map((V) => V.text).join("") || (() => {
|
|
5060
4943
|
try {
|
|
5061
|
-
return JSON.stringify(
|
|
4944
|
+
return JSON.stringify(M, null, 2);
|
|
5062
4945
|
} catch {
|
|
5063
|
-
return String(
|
|
4946
|
+
return String(M);
|
|
5064
4947
|
}
|
|
5065
4948
|
})();
|
|
5066
|
-
|
|
4949
|
+
q && e(
|
|
5067
4950
|
{
|
|
5068
|
-
text:
|
|
4951
|
+
text: q,
|
|
5069
4952
|
payload: t.payload,
|
|
5070
4953
|
checkpointId: n ?? void 0,
|
|
5071
4954
|
checkpointNs: r ?? void 0,
|
|
5072
4955
|
edit: !0,
|
|
5073
|
-
originalMessageId:
|
|
4956
|
+
originalMessageId: P.id,
|
|
5074
4957
|
config: t.config
|
|
5075
4958
|
},
|
|
5076
4959
|
p ? { onEvent: p } : void 0
|
|
5077
4960
|
);
|
|
5078
4961
|
}, [u, e, n, r, t]);
|
|
5079
4962
|
return {
|
|
5080
|
-
editingMessageId:
|
|
5081
|
-
editingInitialValue:
|
|
5082
|
-
inputError:
|
|
5083
|
-
setInputError:
|
|
5084
|
-
dismissError:
|
|
4963
|
+
editingMessageId: d,
|
|
4964
|
+
editingInitialValue: I,
|
|
4965
|
+
inputError: b,
|
|
4966
|
+
setInputError: y,
|
|
4967
|
+
dismissError: x,
|
|
5085
4968
|
setDismissError: g,
|
|
5086
|
-
composerValue:
|
|
4969
|
+
composerValue: w,
|
|
5087
4970
|
handleComposerChange: L,
|
|
5088
|
-
handleSendMessage:
|
|
5089
|
-
handleQuickPrompt:
|
|
5090
|
-
handleExcelUpload:
|
|
5091
|
-
startEditing:
|
|
5092
|
-
cancelEditing:
|
|
5093
|
-
handleRegenerateCb:
|
|
5094
|
-
displayMessages:
|
|
4971
|
+
handleSendMessage: _,
|
|
4972
|
+
handleQuickPrompt: O,
|
|
4973
|
+
handleExcelUpload: F,
|
|
4974
|
+
startEditing: G,
|
|
4975
|
+
cancelEditing: E,
|
|
4976
|
+
handleRegenerateCb: D,
|
|
4977
|
+
displayMessages: k
|
|
5095
4978
|
};
|
|
5096
4979
|
}
|
|
5097
|
-
function
|
|
5098
|
-
return
|
|
5099
|
-
textContent:
|
|
5100
|
-
imageParts:
|
|
5101
|
-
fileParts:
|
|
5102
|
-
toolCalls:
|
|
4980
|
+
function po(e) {
|
|
4981
|
+
return X(() => e ? {
|
|
4982
|
+
textContent: Rn(e),
|
|
4983
|
+
imageParts: Un(e),
|
|
4984
|
+
fileParts: jn(e),
|
|
4985
|
+
toolCalls: St(e),
|
|
5103
4986
|
contentParts: e.content
|
|
5104
4987
|
} : {
|
|
5105
4988
|
textContent: "",
|
|
@@ -5109,9 +4992,9 @@ function ho(e) {
|
|
|
5109
4992
|
contentParts: []
|
|
5110
4993
|
}, [e]);
|
|
5111
4994
|
}
|
|
5112
|
-
function
|
|
5113
|
-
const [r, o] =
|
|
5114
|
-
return
|
|
4995
|
+
function go(e, t, n) {
|
|
4996
|
+
const [r, o] = $(e), s = K(e), a = K(null);
|
|
4997
|
+
return W(() => {
|
|
5115
4998
|
s.current = e;
|
|
5116
4999
|
const i = () => {
|
|
5117
5000
|
o(s.current), a.current && (clearTimeout(a.current), a.current = null);
|
|
@@ -5128,46 +5011,46 @@ function yo(e, t, n) {
|
|
|
5128
5011
|
}, [e, t, n]), r;
|
|
5129
5012
|
}
|
|
5130
5013
|
export {
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5014
|
+
io as ChatProviders,
|
|
5015
|
+
Nr as ThreadStateProvider,
|
|
5016
|
+
ur as ThreadsProvider,
|
|
5017
|
+
Yr as cn,
|
|
5018
|
+
or as collectText,
|
|
5019
|
+
ao as createTaskSyncToolEndHandler,
|
|
5020
|
+
Fr as extractTaskIdFromToolEnd,
|
|
5021
|
+
sr as extractToolMeta,
|
|
5022
|
+
Zr as formatToolOutput,
|
|
5023
|
+
ro as getAgentNameFromMessage,
|
|
5024
|
+
Et as getChatToken,
|
|
5025
|
+
so as getMessageAttemptInfo,
|
|
5026
|
+
to as getToolCallArtifacts,
|
|
5027
|
+
Kn as getToolCalls,
|
|
5028
|
+
eo as hasContent,
|
|
5029
|
+
gt as hydrateHistorySnapshots,
|
|
5030
|
+
Ct as isFileLike,
|
|
5031
|
+
Nn as looksLikeMarkdown,
|
|
5032
|
+
oo as messageSignature,
|
|
5033
|
+
no as normalizeInterruptId,
|
|
5034
|
+
Pt as onChatTokenChanged,
|
|
5035
|
+
et as parseJsonSafe,
|
|
5036
|
+
Mt as pretty,
|
|
5037
|
+
Ir as refreshHistoryFileUrls,
|
|
5038
|
+
Ve as sanitizeForDisplay,
|
|
5156
5039
|
ke as setChatToken,
|
|
5157
|
-
|
|
5040
|
+
Fn as stringifyTool,
|
|
5158
5041
|
Ae as useApi,
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5042
|
+
fo as useChatController,
|
|
5043
|
+
Wr as useChatSession,
|
|
5044
|
+
co as useFilePreview,
|
|
5045
|
+
po as useMessageContent,
|
|
5046
|
+
lo as useParsedMessageContent,
|
|
5047
|
+
cr as useStream,
|
|
5048
|
+
go as useStreamingMarkdownBuffer,
|
|
5049
|
+
Bt as useThreadHistoryState,
|
|
5050
|
+
Dt as useThreadState,
|
|
5051
|
+
Pr as useThreadStateUpdater,
|
|
5052
|
+
rt as useThreads,
|
|
5053
|
+
lr as useThreadsState,
|
|
5054
|
+
uo as useToolPayload
|
|
5172
5055
|
};
|
|
5173
5056
|
//# sourceMappingURL=index.esm.js.map
|