@teodorruskvi/chat-core 0.1.51 → 0.1.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +1078 -1073
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +6 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3,19 +3,19 @@ var Gt = (e, t, n) => t in e ? Ht(e, t, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var at = (e, t, n) => Gt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { jsx as ie } from "react/jsx-runtime";
|
|
5
5
|
import * as it from "react";
|
|
6
|
-
import { createContext as Ce, useContext as
|
|
6
|
+
import { createContext as Ce, useContext as je, useState as $, useRef as G, useEffect as X, useCallback as _, useMemo as Y, useReducer as Wt } from "react";
|
|
7
7
|
import Jt, { isCancel as Xt } from "axios";
|
|
8
8
|
function It(e) {
|
|
9
9
|
var t, n, r = "";
|
|
10
10
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
11
11
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
12
|
-
var
|
|
13
|
-
for (t = 0; t <
|
|
12
|
+
var o = e.length;
|
|
13
|
+
for (t = 0; t < o; t++) e[t] && (n = It(e[t])) && (r && (r += " "), r += n);
|
|
14
14
|
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
15
15
|
return r;
|
|
16
16
|
}
|
|
17
17
|
function Qt() {
|
|
18
|
-
for (var e, t, n = 0, r = "",
|
|
18
|
+
for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t = It(e)) && (r && (r += " "), r += t);
|
|
19
19
|
return r;
|
|
20
20
|
}
|
|
21
21
|
const et = "-", Yt = (e) => {
|
|
@@ -29,23 +29,23 @@ const et = "-", Yt = (e) => {
|
|
|
29
29
|
return i[0] === "" && i.length !== 1 && i.shift(), vt(i, t) || Zt(a);
|
|
30
30
|
},
|
|
31
31
|
getConflictingClassGroupIds: (a, i) => {
|
|
32
|
-
const
|
|
33
|
-
return i && r[a] ? [...
|
|
32
|
+
const d = n[a] || [];
|
|
33
|
+
return i && r[a] ? [...d, ...r[a]] : d;
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
}, vt = (e, t) => {
|
|
37
37
|
var a;
|
|
38
38
|
if (e.length === 0)
|
|
39
39
|
return t.classGroupId;
|
|
40
|
-
const n = e[0], r = t.nextPart.get(n),
|
|
41
|
-
if (
|
|
42
|
-
return
|
|
40
|
+
const n = e[0], r = t.nextPart.get(n), o = r ? vt(e.slice(1), r) : void 0;
|
|
41
|
+
if (o)
|
|
42
|
+
return o;
|
|
43
43
|
if (t.validators.length === 0)
|
|
44
44
|
return;
|
|
45
|
-
const
|
|
45
|
+
const s = e.join(et);
|
|
46
46
|
return (a = t.validators.find(({
|
|
47
47
|
validator: i
|
|
48
|
-
}) => i(
|
|
48
|
+
}) => i(s))) == null ? void 0 : a.classGroupId;
|
|
49
49
|
}, ct = /^\[(.+)\]$/, Zt = (e) => {
|
|
50
50
|
if (ct.test(e)) {
|
|
51
51
|
const t = ct.exec(e)[1], n = t == null ? void 0 : t.substring(0, t.indexOf(":"));
|
|
@@ -60,29 +60,29 @@ const et = "-", Yt = (e) => {
|
|
|
60
60
|
nextPart: /* @__PURE__ */ new Map(),
|
|
61
61
|
validators: []
|
|
62
62
|
};
|
|
63
|
-
return nn(Object.entries(e.classGroups), n).forEach(([
|
|
64
|
-
Xe(a, r,
|
|
63
|
+
return nn(Object.entries(e.classGroups), n).forEach(([s, a]) => {
|
|
64
|
+
Xe(a, r, s, t);
|
|
65
65
|
}), r;
|
|
66
66
|
}, Xe = (e, t, n, r) => {
|
|
67
|
-
e.forEach((
|
|
68
|
-
if (typeof
|
|
69
|
-
const
|
|
70
|
-
|
|
67
|
+
e.forEach((o) => {
|
|
68
|
+
if (typeof o == "string") {
|
|
69
|
+
const s = o === "" ? t : lt(t, o);
|
|
70
|
+
s.classGroupId = n;
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
if (typeof
|
|
74
|
-
if (tn(
|
|
75
|
-
Xe(
|
|
73
|
+
if (typeof o == "function") {
|
|
74
|
+
if (tn(o)) {
|
|
75
|
+
Xe(o(r), t, n, r);
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
t.validators.push({
|
|
79
|
-
validator:
|
|
79
|
+
validator: o,
|
|
80
80
|
classGroupId: n
|
|
81
81
|
});
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
|
-
Object.entries(
|
|
85
|
-
Xe(a, lt(t,
|
|
84
|
+
Object.entries(o).forEach(([s, a]) => {
|
|
85
|
+
Xe(a, lt(t, s), n, r);
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
88
|
}, lt = (e, t) => {
|
|
@@ -94,8 +94,8 @@ const et = "-", Yt = (e) => {
|
|
|
94
94
|
}), n = n.nextPart.get(r);
|
|
95
95
|
}), n;
|
|
96
96
|
}, tn = (e) => e.isThemeGetter, nn = (e, t) => t ? e.map(([n, r]) => {
|
|
97
|
-
const
|
|
98
|
-
return [n,
|
|
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
|
+
return [n, o];
|
|
99
99
|
}) : e, rn = (e) => {
|
|
100
100
|
if (e < 1)
|
|
101
101
|
return {
|
|
@@ -105,55 +105,55 @@ const et = "-", Yt = (e) => {
|
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
let t = 0, n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
108
|
-
const
|
|
109
|
-
n.set(
|
|
108
|
+
const o = (s, a) => {
|
|
109
|
+
n.set(s, a), t++, t > e && (t = 0, r = n, n = /* @__PURE__ */ new Map());
|
|
110
110
|
};
|
|
111
111
|
return {
|
|
112
|
-
get(
|
|
113
|
-
let a = n.get(
|
|
112
|
+
get(s) {
|
|
113
|
+
let a = n.get(s);
|
|
114
114
|
if (a !== void 0)
|
|
115
115
|
return a;
|
|
116
|
-
if ((a = r.get(
|
|
117
|
-
return s
|
|
116
|
+
if ((a = r.get(s)) !== void 0)
|
|
117
|
+
return o(s, a), a;
|
|
118
118
|
},
|
|
119
|
-
set(
|
|
120
|
-
n.has(
|
|
119
|
+
set(s, a) {
|
|
120
|
+
n.has(s) ? n.set(s, a) : o(s, a);
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
}, xt = "!",
|
|
123
|
+
}, xt = "!", on = (e) => {
|
|
124
124
|
const {
|
|
125
125
|
separator: t,
|
|
126
126
|
experimentalParseClassName: n
|
|
127
|
-
} = e, r = t.length === 1,
|
|
128
|
-
const
|
|
129
|
-
let c = 0, l = 0,
|
|
127
|
+
} = e, r = t.length === 1, o = t[0], s = t.length, a = (i) => {
|
|
128
|
+
const d = [];
|
|
129
|
+
let c = 0, l = 0, f;
|
|
130
130
|
for (let v = 0; v < i.length; v++) {
|
|
131
131
|
let x = i[v];
|
|
132
132
|
if (c === 0) {
|
|
133
|
-
if (x ===
|
|
134
|
-
|
|
133
|
+
if (x === o && (r || i.slice(v, v + s) === t)) {
|
|
134
|
+
d.push(i.slice(l, v)), l = v + s;
|
|
135
135
|
continue;
|
|
136
136
|
}
|
|
137
137
|
if (x === "/") {
|
|
138
|
-
|
|
138
|
+
f = v;
|
|
139
139
|
continue;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
x === "[" ? c++ : x === "]" && c--;
|
|
143
143
|
}
|
|
144
|
-
const
|
|
144
|
+
const p = d.length === 0 ? i : i.substring(l), g = p.startsWith(xt), I = g ? p.substring(1) : p, u = f && f > l ? f - l : void 0;
|
|
145
145
|
return {
|
|
146
|
-
modifiers:
|
|
147
|
-
hasImportantModifier:
|
|
146
|
+
modifiers: d,
|
|
147
|
+
hasImportantModifier: g,
|
|
148
148
|
baseClassName: I,
|
|
149
|
-
maybePostfixModifierPosition:
|
|
149
|
+
maybePostfixModifierPosition: u
|
|
150
150
|
};
|
|
151
151
|
};
|
|
152
152
|
return n ? (i) => n({
|
|
153
153
|
className: i,
|
|
154
154
|
parseClassName: a
|
|
155
155
|
}) : a;
|
|
156
|
-
},
|
|
156
|
+
}, sn = (e) => {
|
|
157
157
|
if (e.length <= 1)
|
|
158
158
|
return e;
|
|
159
159
|
const t = [];
|
|
@@ -163,48 +163,48 @@ const et = "-", Yt = (e) => {
|
|
|
163
163
|
}), t.push(...n.sort()), t;
|
|
164
164
|
}, an = (e) => ({
|
|
165
165
|
cache: rn(e.cacheSize),
|
|
166
|
-
parseClassName:
|
|
166
|
+
parseClassName: on(e),
|
|
167
167
|
...Yt(e)
|
|
168
168
|
}), cn = /\s+/, ln = (e, t) => {
|
|
169
169
|
const {
|
|
170
170
|
parseClassName: n,
|
|
171
171
|
getClassGroupId: r,
|
|
172
|
-
getConflictingClassGroupIds:
|
|
173
|
-
} = t,
|
|
172
|
+
getConflictingClassGroupIds: o
|
|
173
|
+
} = t, s = [], a = e.trim().split(cn);
|
|
174
174
|
let i = "";
|
|
175
|
-
for (let
|
|
176
|
-
const c = a[
|
|
175
|
+
for (let d = a.length - 1; d >= 0; d -= 1) {
|
|
176
|
+
const c = a[d], {
|
|
177
177
|
modifiers: l,
|
|
178
|
-
hasImportantModifier:
|
|
179
|
-
baseClassName:
|
|
180
|
-
maybePostfixModifierPosition:
|
|
178
|
+
hasImportantModifier: f,
|
|
179
|
+
baseClassName: p,
|
|
180
|
+
maybePostfixModifierPosition: g
|
|
181
181
|
} = n(c);
|
|
182
|
-
let I = !!
|
|
183
|
-
if (!
|
|
182
|
+
let I = !!g, u = r(I ? p.substring(0, g) : p);
|
|
183
|
+
if (!u) {
|
|
184
184
|
if (!I) {
|
|
185
185
|
i = c + (i.length > 0 ? " " + i : i);
|
|
186
186
|
continue;
|
|
187
187
|
}
|
|
188
|
-
if (
|
|
188
|
+
if (u = r(p), !u) {
|
|
189
189
|
i = c + (i.length > 0 ? " " + i : i);
|
|
190
190
|
continue;
|
|
191
191
|
}
|
|
192
192
|
I = !1;
|
|
193
193
|
}
|
|
194
|
-
const v =
|
|
195
|
-
if (
|
|
194
|
+
const v = sn(l).join(":"), x = f ? v + xt : v, M = x + u;
|
|
195
|
+
if (s.includes(M))
|
|
196
196
|
continue;
|
|
197
|
-
|
|
198
|
-
const A =
|
|
199
|
-
for (let
|
|
200
|
-
const b = A[
|
|
201
|
-
|
|
197
|
+
s.push(M);
|
|
198
|
+
const A = o(u, I);
|
|
199
|
+
for (let w = 0; w < A.length; ++w) {
|
|
200
|
+
const b = A[w];
|
|
201
|
+
s.push(x + b);
|
|
202
202
|
}
|
|
203
203
|
i = c + (i.length > 0 ? " " + i : i);
|
|
204
204
|
}
|
|
205
205
|
return i;
|
|
206
206
|
};
|
|
207
|
-
function
|
|
207
|
+
function dn() {
|
|
208
208
|
let e = 0, t, n, r = "";
|
|
209
209
|
for (; e < arguments.length; )
|
|
210
210
|
(t = arguments[e++]) && (n = At(t)) && (r && (r += " "), r += n);
|
|
@@ -218,27 +218,27 @@ const At = (e) => {
|
|
|
218
218
|
e[r] && (t = At(e[r])) && (n && (n += " "), n += t);
|
|
219
219
|
return n;
|
|
220
220
|
};
|
|
221
|
-
function
|
|
222
|
-
let n, r,
|
|
223
|
-
function a(
|
|
224
|
-
const c = t.reduce((l,
|
|
225
|
-
return n = an(c), r = n.cache.get,
|
|
221
|
+
function un(e, ...t) {
|
|
222
|
+
let n, r, o, s = a;
|
|
223
|
+
function a(d) {
|
|
224
|
+
const c = t.reduce((l, f) => f(l), e());
|
|
225
|
+
return n = an(c), r = n.cache.get, o = n.cache.set, s = i, i(d);
|
|
226
226
|
}
|
|
227
|
-
function i(
|
|
228
|
-
const c = r(
|
|
227
|
+
function i(d) {
|
|
228
|
+
const c = r(d);
|
|
229
229
|
if (c)
|
|
230
230
|
return c;
|
|
231
|
-
const l = ln(
|
|
232
|
-
return
|
|
231
|
+
const l = ln(d, n);
|
|
232
|
+
return o(d, l), l;
|
|
233
233
|
}
|
|
234
234
|
return function() {
|
|
235
|
-
return
|
|
235
|
+
return s(dn.apply(null, arguments));
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
238
|
const D = (e) => {
|
|
239
239
|
const t = (n) => n[e] || [];
|
|
240
240
|
return t.isThemeGetter = !0, t;
|
|
241
|
-
}, Tt = /^\[(?:([a-z-]+):)?(.+)\]$/i, fn = /^\d+\/\d+$/, pn = /* @__PURE__ */ new Set(["px", "full", "screen"]), gn = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, mn = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, yn = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, hn = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, bn = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,
|
|
241
|
+
}, Tt = /^\[(?:([a-z-]+):)?(.+)\]$/i, fn = /^\d+\/\d+$/, pn = /* @__PURE__ */ new Set(["px", "full", "screen"]), gn = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, mn = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, yn = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, hn = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, bn = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, ue = (e) => Te(e) || pn.has(e) || fn.test(e), be = (e) => Ee(e, "length", Sn), Te = (e) => !!e && !Number.isNaN(Number(e)), qe = (e) => Ee(e, "number", Te), _e = (e) => !!e && Number.isInteger(Number(e)), wn = (e) => e.endsWith("%") && Te(e.slice(0, -1)), N = (e) => Tt.test(e), we = (e) => gn.test(e), kn = /* @__PURE__ */ new Set(["length", "size", "percentage"]), In = (e) => Ee(e, kn, St), vn = (e) => Ee(e, "position", St), xn = /* @__PURE__ */ new Set(["image", "url"]), An = (e) => Ee(e, xn, Cn), Tn = (e) => Ee(e, "", Mn), Ne = () => !0, Ee = (e, t, n) => {
|
|
242
242
|
const r = Tt.exec(e);
|
|
243
243
|
return r ? r[1] ? typeof t == "string" ? r[1] === t : t.has(r[1]) : n(r[2]) : !1;
|
|
244
244
|
}, Sn = (e) => (
|
|
@@ -247,34 +247,34 @@ const D = (e) => {
|
|
|
247
247
|
// I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
|
|
248
248
|
mn.test(e) && !yn.test(e)
|
|
249
249
|
), St = () => !1, Mn = (e) => hn.test(e), Cn = (e) => bn.test(e), En = () => {
|
|
250
|
-
const e = D("colors"), t = D("spacing"), n = D("blur"), r = D("brightness"),
|
|
250
|
+
const e = D("colors"), t = D("spacing"), n = D("blur"), r = D("brightness"), o = D("borderColor"), s = D("borderRadius"), a = D("borderSpacing"), i = D("borderWidth"), d = D("contrast"), c = D("grayscale"), l = D("hueRotate"), f = D("invert"), p = D("gap"), g = D("gradientColorStops"), I = D("gradientColorStopPositions"), u = D("inset"), v = D("margin"), x = D("opacity"), M = D("padding"), A = D("saturate"), w = D("scale"), b = D("sepia"), h = D("skew"), T = D("space"), m = D("translate"), k = () => ["auto", "contain", "none"], E = () => ["auto", "hidden", "clip", "visible", "scroll"], j = () => ["auto", N, t], C = () => [N, t], O = () => ["", ue, be], F = () => ["auto", Te, N], P = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], B = () => ["solid", "dashed", "dotted", "double", "none"], z = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], J = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], U = () => ["", "0", N], R = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], q = () => [Te, N];
|
|
251
251
|
return {
|
|
252
252
|
cacheSize: 500,
|
|
253
253
|
separator: ":",
|
|
254
254
|
theme: {
|
|
255
|
-
colors: [
|
|
256
|
-
spacing: [
|
|
257
|
-
blur: ["none", "", we,
|
|
258
|
-
brightness:
|
|
255
|
+
colors: [Ne],
|
|
256
|
+
spacing: [ue, be],
|
|
257
|
+
blur: ["none", "", we, N],
|
|
258
|
+
brightness: q(),
|
|
259
259
|
borderColor: [e],
|
|
260
|
-
borderRadius: ["none", "", "full", we,
|
|
260
|
+
borderRadius: ["none", "", "full", we, N],
|
|
261
261
|
borderSpacing: C(),
|
|
262
262
|
borderWidth: O(),
|
|
263
|
-
contrast:
|
|
264
|
-
grayscale:
|
|
265
|
-
hueRotate:
|
|
266
|
-
invert:
|
|
263
|
+
contrast: q(),
|
|
264
|
+
grayscale: U(),
|
|
265
|
+
hueRotate: q(),
|
|
266
|
+
invert: U(),
|
|
267
267
|
gap: C(),
|
|
268
268
|
gradientColorStops: [e],
|
|
269
269
|
gradientColorStopPositions: [wn, be],
|
|
270
270
|
inset: j(),
|
|
271
271
|
margin: j(),
|
|
272
|
-
opacity:
|
|
272
|
+
opacity: q(),
|
|
273
273
|
padding: C(),
|
|
274
|
-
saturate:
|
|
275
|
-
scale:
|
|
276
|
-
sepia:
|
|
277
|
-
skew:
|
|
274
|
+
saturate: q(),
|
|
275
|
+
scale: q(),
|
|
276
|
+
sepia: U(),
|
|
277
|
+
skew: q(),
|
|
278
278
|
space: C(),
|
|
279
279
|
translate: C()
|
|
280
280
|
},
|
|
@@ -285,7 +285,7 @@ const D = (e) => {
|
|
|
285
285
|
* @see https://tailwindcss.com/docs/aspect-ratio
|
|
286
286
|
*/
|
|
287
287
|
aspect: [{
|
|
288
|
-
aspect: ["auto", "square", "video",
|
|
288
|
+
aspect: ["auto", "square", "video", N]
|
|
289
289
|
}],
|
|
290
290
|
/**
|
|
291
291
|
* Container
|
|
@@ -304,14 +304,14 @@ const D = (e) => {
|
|
|
304
304
|
* @see https://tailwindcss.com/docs/break-after
|
|
305
305
|
*/
|
|
306
306
|
"break-after": [{
|
|
307
|
-
"break-after":
|
|
307
|
+
"break-after": R()
|
|
308
308
|
}],
|
|
309
309
|
/**
|
|
310
310
|
* Break Before
|
|
311
311
|
* @see https://tailwindcss.com/docs/break-before
|
|
312
312
|
*/
|
|
313
313
|
"break-before": [{
|
|
314
|
-
"break-before":
|
|
314
|
+
"break-before": R()
|
|
315
315
|
}],
|
|
316
316
|
/**
|
|
317
317
|
* Break Inside
|
|
@@ -370,49 +370,49 @@ const D = (e) => {
|
|
|
370
370
|
* @see https://tailwindcss.com/docs/object-position
|
|
371
371
|
*/
|
|
372
372
|
"object-position": [{
|
|
373
|
-
object: [...
|
|
373
|
+
object: [...P(), N]
|
|
374
374
|
}],
|
|
375
375
|
/**
|
|
376
376
|
* Overflow
|
|
377
377
|
* @see https://tailwindcss.com/docs/overflow
|
|
378
378
|
*/
|
|
379
379
|
overflow: [{
|
|
380
|
-
overflow:
|
|
380
|
+
overflow: E()
|
|
381
381
|
}],
|
|
382
382
|
/**
|
|
383
383
|
* Overflow X
|
|
384
384
|
* @see https://tailwindcss.com/docs/overflow
|
|
385
385
|
*/
|
|
386
386
|
"overflow-x": [{
|
|
387
|
-
"overflow-x":
|
|
387
|
+
"overflow-x": E()
|
|
388
388
|
}],
|
|
389
389
|
/**
|
|
390
390
|
* Overflow Y
|
|
391
391
|
* @see https://tailwindcss.com/docs/overflow
|
|
392
392
|
*/
|
|
393
393
|
"overflow-y": [{
|
|
394
|
-
"overflow-y":
|
|
394
|
+
"overflow-y": E()
|
|
395
395
|
}],
|
|
396
396
|
/**
|
|
397
397
|
* Overscroll Behavior
|
|
398
398
|
* @see https://tailwindcss.com/docs/overscroll-behavior
|
|
399
399
|
*/
|
|
400
400
|
overscroll: [{
|
|
401
|
-
overscroll:
|
|
401
|
+
overscroll: k()
|
|
402
402
|
}],
|
|
403
403
|
/**
|
|
404
404
|
* Overscroll Behavior X
|
|
405
405
|
* @see https://tailwindcss.com/docs/overscroll-behavior
|
|
406
406
|
*/
|
|
407
407
|
"overscroll-x": [{
|
|
408
|
-
"overscroll-x":
|
|
408
|
+
"overscroll-x": k()
|
|
409
409
|
}],
|
|
410
410
|
/**
|
|
411
411
|
* Overscroll Behavior Y
|
|
412
412
|
* @see https://tailwindcss.com/docs/overscroll-behavior
|
|
413
413
|
*/
|
|
414
414
|
"overscroll-y": [{
|
|
415
|
-
"overscroll-y":
|
|
415
|
+
"overscroll-y": k()
|
|
416
416
|
}],
|
|
417
417
|
/**
|
|
418
418
|
* Position
|
|
@@ -424,63 +424,63 @@ const D = (e) => {
|
|
|
424
424
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
425
425
|
*/
|
|
426
426
|
inset: [{
|
|
427
|
-
inset: [
|
|
427
|
+
inset: [u]
|
|
428
428
|
}],
|
|
429
429
|
/**
|
|
430
430
|
* Right / Left
|
|
431
431
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
432
432
|
*/
|
|
433
433
|
"inset-x": [{
|
|
434
|
-
"inset-x": [
|
|
434
|
+
"inset-x": [u]
|
|
435
435
|
}],
|
|
436
436
|
/**
|
|
437
437
|
* Top / Bottom
|
|
438
438
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
439
439
|
*/
|
|
440
440
|
"inset-y": [{
|
|
441
|
-
"inset-y": [
|
|
441
|
+
"inset-y": [u]
|
|
442
442
|
}],
|
|
443
443
|
/**
|
|
444
444
|
* Start
|
|
445
445
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
446
446
|
*/
|
|
447
447
|
start: [{
|
|
448
|
-
start: [
|
|
448
|
+
start: [u]
|
|
449
449
|
}],
|
|
450
450
|
/**
|
|
451
451
|
* End
|
|
452
452
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
453
453
|
*/
|
|
454
454
|
end: [{
|
|
455
|
-
end: [
|
|
455
|
+
end: [u]
|
|
456
456
|
}],
|
|
457
457
|
/**
|
|
458
458
|
* Top
|
|
459
459
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
460
460
|
*/
|
|
461
461
|
top: [{
|
|
462
|
-
top: [
|
|
462
|
+
top: [u]
|
|
463
463
|
}],
|
|
464
464
|
/**
|
|
465
465
|
* Right
|
|
466
466
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
467
467
|
*/
|
|
468
468
|
right: [{
|
|
469
|
-
right: [
|
|
469
|
+
right: [u]
|
|
470
470
|
}],
|
|
471
471
|
/**
|
|
472
472
|
* Bottom
|
|
473
473
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
474
474
|
*/
|
|
475
475
|
bottom: [{
|
|
476
|
-
bottom: [
|
|
476
|
+
bottom: [u]
|
|
477
477
|
}],
|
|
478
478
|
/**
|
|
479
479
|
* Left
|
|
480
480
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
481
481
|
*/
|
|
482
482
|
left: [{
|
|
483
|
-
left: [
|
|
483
|
+
left: [u]
|
|
484
484
|
}],
|
|
485
485
|
/**
|
|
486
486
|
* Visibility
|
|
@@ -492,7 +492,7 @@ const D = (e) => {
|
|
|
492
492
|
* @see https://tailwindcss.com/docs/z-index
|
|
493
493
|
*/
|
|
494
494
|
z: [{
|
|
495
|
-
z: ["auto", _e,
|
|
495
|
+
z: ["auto", _e, N]
|
|
496
496
|
}],
|
|
497
497
|
// Flexbox and Grid
|
|
498
498
|
/**
|
|
@@ -521,35 +521,35 @@ const D = (e) => {
|
|
|
521
521
|
* @see https://tailwindcss.com/docs/flex
|
|
522
522
|
*/
|
|
523
523
|
flex: [{
|
|
524
|
-
flex: ["1", "auto", "initial", "none",
|
|
524
|
+
flex: ["1", "auto", "initial", "none", N]
|
|
525
525
|
}],
|
|
526
526
|
/**
|
|
527
527
|
* Flex Grow
|
|
528
528
|
* @see https://tailwindcss.com/docs/flex-grow
|
|
529
529
|
*/
|
|
530
530
|
grow: [{
|
|
531
|
-
grow:
|
|
531
|
+
grow: U()
|
|
532
532
|
}],
|
|
533
533
|
/**
|
|
534
534
|
* Flex Shrink
|
|
535
535
|
* @see https://tailwindcss.com/docs/flex-shrink
|
|
536
536
|
*/
|
|
537
537
|
shrink: [{
|
|
538
|
-
shrink:
|
|
538
|
+
shrink: U()
|
|
539
539
|
}],
|
|
540
540
|
/**
|
|
541
541
|
* Order
|
|
542
542
|
* @see https://tailwindcss.com/docs/order
|
|
543
543
|
*/
|
|
544
544
|
order: [{
|
|
545
|
-
order: ["first", "last", "none", _e,
|
|
545
|
+
order: ["first", "last", "none", _e, N]
|
|
546
546
|
}],
|
|
547
547
|
/**
|
|
548
548
|
* Grid Template Columns
|
|
549
549
|
* @see https://tailwindcss.com/docs/grid-template-columns
|
|
550
550
|
*/
|
|
551
551
|
"grid-cols": [{
|
|
552
|
-
"grid-cols": [
|
|
552
|
+
"grid-cols": [Ne]
|
|
553
553
|
}],
|
|
554
554
|
/**
|
|
555
555
|
* Grid Column Start / End
|
|
@@ -557,8 +557,8 @@ const D = (e) => {
|
|
|
557
557
|
*/
|
|
558
558
|
"col-start-end": [{
|
|
559
559
|
col: ["auto", {
|
|
560
|
-
span: ["full", _e,
|
|
561
|
-
},
|
|
560
|
+
span: ["full", _e, N]
|
|
561
|
+
}, N]
|
|
562
562
|
}],
|
|
563
563
|
/**
|
|
564
564
|
* Grid Column Start
|
|
@@ -579,7 +579,7 @@ const D = (e) => {
|
|
|
579
579
|
* @see https://tailwindcss.com/docs/grid-template-rows
|
|
580
580
|
*/
|
|
581
581
|
"grid-rows": [{
|
|
582
|
-
"grid-rows": [
|
|
582
|
+
"grid-rows": [Ne]
|
|
583
583
|
}],
|
|
584
584
|
/**
|
|
585
585
|
* Grid Row Start / End
|
|
@@ -587,8 +587,8 @@ const D = (e) => {
|
|
|
587
587
|
*/
|
|
588
588
|
"row-start-end": [{
|
|
589
589
|
row: ["auto", {
|
|
590
|
-
span: [_e,
|
|
591
|
-
},
|
|
590
|
+
span: [_e, N]
|
|
591
|
+
}, N]
|
|
592
592
|
}],
|
|
593
593
|
/**
|
|
594
594
|
* Grid Row Start
|
|
@@ -616,42 +616,42 @@ const D = (e) => {
|
|
|
616
616
|
* @see https://tailwindcss.com/docs/grid-auto-columns
|
|
617
617
|
*/
|
|
618
618
|
"auto-cols": [{
|
|
619
|
-
"auto-cols": ["auto", "min", "max", "fr",
|
|
619
|
+
"auto-cols": ["auto", "min", "max", "fr", N]
|
|
620
620
|
}],
|
|
621
621
|
/**
|
|
622
622
|
* Grid Auto Rows
|
|
623
623
|
* @see https://tailwindcss.com/docs/grid-auto-rows
|
|
624
624
|
*/
|
|
625
625
|
"auto-rows": [{
|
|
626
|
-
"auto-rows": ["auto", "min", "max", "fr",
|
|
626
|
+
"auto-rows": ["auto", "min", "max", "fr", N]
|
|
627
627
|
}],
|
|
628
628
|
/**
|
|
629
629
|
* Gap
|
|
630
630
|
* @see https://tailwindcss.com/docs/gap
|
|
631
631
|
*/
|
|
632
632
|
gap: [{
|
|
633
|
-
gap: [
|
|
633
|
+
gap: [p]
|
|
634
634
|
}],
|
|
635
635
|
/**
|
|
636
636
|
* Gap X
|
|
637
637
|
* @see https://tailwindcss.com/docs/gap
|
|
638
638
|
*/
|
|
639
639
|
"gap-x": [{
|
|
640
|
-
"gap-x": [
|
|
640
|
+
"gap-x": [p]
|
|
641
641
|
}],
|
|
642
642
|
/**
|
|
643
643
|
* Gap Y
|
|
644
644
|
* @see https://tailwindcss.com/docs/gap
|
|
645
645
|
*/
|
|
646
646
|
"gap-y": [{
|
|
647
|
-
"gap-y": [
|
|
647
|
+
"gap-y": [p]
|
|
648
648
|
}],
|
|
649
649
|
/**
|
|
650
650
|
* Justify Content
|
|
651
651
|
* @see https://tailwindcss.com/docs/justify-content
|
|
652
652
|
*/
|
|
653
653
|
"justify-content": [{
|
|
654
|
-
justify: ["normal", ...
|
|
654
|
+
justify: ["normal", ...J()]
|
|
655
655
|
}],
|
|
656
656
|
/**
|
|
657
657
|
* Justify Items
|
|
@@ -672,7 +672,7 @@ const D = (e) => {
|
|
|
672
672
|
* @see https://tailwindcss.com/docs/align-content
|
|
673
673
|
*/
|
|
674
674
|
"align-content": [{
|
|
675
|
-
content: ["normal", ...
|
|
675
|
+
content: ["normal", ...J(), "baseline"]
|
|
676
676
|
}],
|
|
677
677
|
/**
|
|
678
678
|
* Align Items
|
|
@@ -693,7 +693,7 @@ const D = (e) => {
|
|
|
693
693
|
* @see https://tailwindcss.com/docs/place-content
|
|
694
694
|
*/
|
|
695
695
|
"place-content": [{
|
|
696
|
-
"place-content": [...
|
|
696
|
+
"place-content": [...J(), "baseline"]
|
|
697
697
|
}],
|
|
698
698
|
/**
|
|
699
699
|
* Place Items
|
|
@@ -866,21 +866,21 @@ const D = (e) => {
|
|
|
866
866
|
* @see https://tailwindcss.com/docs/width
|
|
867
867
|
*/
|
|
868
868
|
w: [{
|
|
869
|
-
w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw",
|
|
869
|
+
w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw", N, t]
|
|
870
870
|
}],
|
|
871
871
|
/**
|
|
872
872
|
* Min-Width
|
|
873
873
|
* @see https://tailwindcss.com/docs/min-width
|
|
874
874
|
*/
|
|
875
875
|
"min-w": [{
|
|
876
|
-
"min-w": [
|
|
876
|
+
"min-w": [N, t, "min", "max", "fit"]
|
|
877
877
|
}],
|
|
878
878
|
/**
|
|
879
879
|
* Max-Width
|
|
880
880
|
* @see https://tailwindcss.com/docs/max-width
|
|
881
881
|
*/
|
|
882
882
|
"max-w": [{
|
|
883
|
-
"max-w": [
|
|
883
|
+
"max-w": [N, t, "none", "full", "min", "max", "fit", "prose", {
|
|
884
884
|
screen: [we]
|
|
885
885
|
}, we]
|
|
886
886
|
}],
|
|
@@ -889,28 +889,28 @@ const D = (e) => {
|
|
|
889
889
|
* @see https://tailwindcss.com/docs/height
|
|
890
890
|
*/
|
|
891
891
|
h: [{
|
|
892
|
-
h: [
|
|
892
|
+
h: [N, t, "auto", "min", "max", "fit", "svh", "lvh", "dvh"]
|
|
893
893
|
}],
|
|
894
894
|
/**
|
|
895
895
|
* Min-Height
|
|
896
896
|
* @see https://tailwindcss.com/docs/min-height
|
|
897
897
|
*/
|
|
898
898
|
"min-h": [{
|
|
899
|
-
"min-h": [
|
|
899
|
+
"min-h": [N, t, "min", "max", "fit", "svh", "lvh", "dvh"]
|
|
900
900
|
}],
|
|
901
901
|
/**
|
|
902
902
|
* Max-Height
|
|
903
903
|
* @see https://tailwindcss.com/docs/max-height
|
|
904
904
|
*/
|
|
905
905
|
"max-h": [{
|
|
906
|
-
"max-h": [
|
|
906
|
+
"max-h": [N, t, "min", "max", "fit", "svh", "lvh", "dvh"]
|
|
907
907
|
}],
|
|
908
908
|
/**
|
|
909
909
|
* Size
|
|
910
910
|
* @see https://tailwindcss.com/docs/size
|
|
911
911
|
*/
|
|
912
912
|
size: [{
|
|
913
|
-
size: [
|
|
913
|
+
size: [N, t, "auto", "min", "max", "fit"]
|
|
914
914
|
}],
|
|
915
915
|
// Typography
|
|
916
916
|
/**
|
|
@@ -942,7 +942,7 @@ const D = (e) => {
|
|
|
942
942
|
* @see https://tailwindcss.com/docs/font-family
|
|
943
943
|
*/
|
|
944
944
|
"font-family": [{
|
|
945
|
-
font: [
|
|
945
|
+
font: [Ne]
|
|
946
946
|
}],
|
|
947
947
|
/**
|
|
948
948
|
* Font Variant Numeric
|
|
@@ -979,7 +979,7 @@ const D = (e) => {
|
|
|
979
979
|
* @see https://tailwindcss.com/docs/letter-spacing
|
|
980
980
|
*/
|
|
981
981
|
tracking: [{
|
|
982
|
-
tracking: ["tighter", "tight", "normal", "wide", "wider", "widest",
|
|
982
|
+
tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", N]
|
|
983
983
|
}],
|
|
984
984
|
/**
|
|
985
985
|
* Line Clamp
|
|
@@ -993,21 +993,21 @@ const D = (e) => {
|
|
|
993
993
|
* @see https://tailwindcss.com/docs/line-height
|
|
994
994
|
*/
|
|
995
995
|
leading: [{
|
|
996
|
-
leading: ["none", "tight", "snug", "normal", "relaxed", "loose",
|
|
996
|
+
leading: ["none", "tight", "snug", "normal", "relaxed", "loose", ue, N]
|
|
997
997
|
}],
|
|
998
998
|
/**
|
|
999
999
|
* List Style Image
|
|
1000
1000
|
* @see https://tailwindcss.com/docs/list-style-image
|
|
1001
1001
|
*/
|
|
1002
1002
|
"list-image": [{
|
|
1003
|
-
"list-image": ["none",
|
|
1003
|
+
"list-image": ["none", N]
|
|
1004
1004
|
}],
|
|
1005
1005
|
/**
|
|
1006
1006
|
* List Style Type
|
|
1007
1007
|
* @see https://tailwindcss.com/docs/list-style-type
|
|
1008
1008
|
*/
|
|
1009
1009
|
"list-style-type": [{
|
|
1010
|
-
list: ["none", "disc", "decimal",
|
|
1010
|
+
list: ["none", "disc", "decimal", N]
|
|
1011
1011
|
}],
|
|
1012
1012
|
/**
|
|
1013
1013
|
* List Style Position
|
|
@@ -1069,14 +1069,14 @@ const D = (e) => {
|
|
|
1069
1069
|
* @see https://tailwindcss.com/docs/text-decoration-thickness
|
|
1070
1070
|
*/
|
|
1071
1071
|
"text-decoration-thickness": [{
|
|
1072
|
-
decoration: ["auto", "from-font",
|
|
1072
|
+
decoration: ["auto", "from-font", ue, be]
|
|
1073
1073
|
}],
|
|
1074
1074
|
/**
|
|
1075
1075
|
* Text Underline Offset
|
|
1076
1076
|
* @see https://tailwindcss.com/docs/text-underline-offset
|
|
1077
1077
|
*/
|
|
1078
1078
|
"underline-offset": [{
|
|
1079
|
-
"underline-offset": ["auto",
|
|
1079
|
+
"underline-offset": ["auto", ue, N]
|
|
1080
1080
|
}],
|
|
1081
1081
|
/**
|
|
1082
1082
|
* Text Decoration Color
|
|
@@ -1114,7 +1114,7 @@ const D = (e) => {
|
|
|
1114
1114
|
* @see https://tailwindcss.com/docs/vertical-align
|
|
1115
1115
|
*/
|
|
1116
1116
|
"vertical-align": [{
|
|
1117
|
-
align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super",
|
|
1117
|
+
align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", N]
|
|
1118
1118
|
}],
|
|
1119
1119
|
/**
|
|
1120
1120
|
* Whitespace
|
|
@@ -1142,7 +1142,7 @@ const D = (e) => {
|
|
|
1142
1142
|
* @see https://tailwindcss.com/docs/content
|
|
1143
1143
|
*/
|
|
1144
1144
|
content: [{
|
|
1145
|
-
content: ["none",
|
|
1145
|
+
content: ["none", N]
|
|
1146
1146
|
}],
|
|
1147
1147
|
// Backgrounds
|
|
1148
1148
|
/**
|
|
@@ -1179,7 +1179,7 @@ const D = (e) => {
|
|
|
1179
1179
|
* @see https://tailwindcss.com/docs/background-position
|
|
1180
1180
|
*/
|
|
1181
1181
|
"bg-position": [{
|
|
1182
|
-
bg: [...
|
|
1182
|
+
bg: [...P(), vn]
|
|
1183
1183
|
}],
|
|
1184
1184
|
/**
|
|
1185
1185
|
* Background Repeat
|
|
@@ -1239,21 +1239,21 @@ const D = (e) => {
|
|
|
1239
1239
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1240
1240
|
*/
|
|
1241
1241
|
"gradient-from": [{
|
|
1242
|
-
from: [
|
|
1242
|
+
from: [g]
|
|
1243
1243
|
}],
|
|
1244
1244
|
/**
|
|
1245
1245
|
* Gradient Color Stops Via
|
|
1246
1246
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1247
1247
|
*/
|
|
1248
1248
|
"gradient-via": [{
|
|
1249
|
-
via: [
|
|
1249
|
+
via: [g]
|
|
1250
1250
|
}],
|
|
1251
1251
|
/**
|
|
1252
1252
|
* Gradient Color Stops To
|
|
1253
1253
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1254
1254
|
*/
|
|
1255
1255
|
"gradient-to": [{
|
|
1256
|
-
to: [
|
|
1256
|
+
to: [g]
|
|
1257
1257
|
}],
|
|
1258
1258
|
// Borders
|
|
1259
1259
|
/**
|
|
@@ -1261,105 +1261,105 @@ const D = (e) => {
|
|
|
1261
1261
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1262
1262
|
*/
|
|
1263
1263
|
rounded: [{
|
|
1264
|
-
rounded: [
|
|
1264
|
+
rounded: [s]
|
|
1265
1265
|
}],
|
|
1266
1266
|
/**
|
|
1267
1267
|
* Border Radius Start
|
|
1268
1268
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1269
1269
|
*/
|
|
1270
1270
|
"rounded-s": [{
|
|
1271
|
-
"rounded-s": [
|
|
1271
|
+
"rounded-s": [s]
|
|
1272
1272
|
}],
|
|
1273
1273
|
/**
|
|
1274
1274
|
* Border Radius End
|
|
1275
1275
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1276
1276
|
*/
|
|
1277
1277
|
"rounded-e": [{
|
|
1278
|
-
"rounded-e": [
|
|
1278
|
+
"rounded-e": [s]
|
|
1279
1279
|
}],
|
|
1280
1280
|
/**
|
|
1281
1281
|
* Border Radius Top
|
|
1282
1282
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1283
1283
|
*/
|
|
1284
1284
|
"rounded-t": [{
|
|
1285
|
-
"rounded-t": [
|
|
1285
|
+
"rounded-t": [s]
|
|
1286
1286
|
}],
|
|
1287
1287
|
/**
|
|
1288
1288
|
* Border Radius Right
|
|
1289
1289
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1290
1290
|
*/
|
|
1291
1291
|
"rounded-r": [{
|
|
1292
|
-
"rounded-r": [
|
|
1292
|
+
"rounded-r": [s]
|
|
1293
1293
|
}],
|
|
1294
1294
|
/**
|
|
1295
1295
|
* Border Radius Bottom
|
|
1296
1296
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1297
1297
|
*/
|
|
1298
1298
|
"rounded-b": [{
|
|
1299
|
-
"rounded-b": [
|
|
1299
|
+
"rounded-b": [s]
|
|
1300
1300
|
}],
|
|
1301
1301
|
/**
|
|
1302
1302
|
* Border Radius Left
|
|
1303
1303
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1304
1304
|
*/
|
|
1305
1305
|
"rounded-l": [{
|
|
1306
|
-
"rounded-l": [
|
|
1306
|
+
"rounded-l": [s]
|
|
1307
1307
|
}],
|
|
1308
1308
|
/**
|
|
1309
1309
|
* Border Radius Start Start
|
|
1310
1310
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1311
1311
|
*/
|
|
1312
1312
|
"rounded-ss": [{
|
|
1313
|
-
"rounded-ss": [
|
|
1313
|
+
"rounded-ss": [s]
|
|
1314
1314
|
}],
|
|
1315
1315
|
/**
|
|
1316
1316
|
* Border Radius Start End
|
|
1317
1317
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1318
1318
|
*/
|
|
1319
1319
|
"rounded-se": [{
|
|
1320
|
-
"rounded-se": [
|
|
1320
|
+
"rounded-se": [s]
|
|
1321
1321
|
}],
|
|
1322
1322
|
/**
|
|
1323
1323
|
* Border Radius End End
|
|
1324
1324
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1325
1325
|
*/
|
|
1326
1326
|
"rounded-ee": [{
|
|
1327
|
-
"rounded-ee": [
|
|
1327
|
+
"rounded-ee": [s]
|
|
1328
1328
|
}],
|
|
1329
1329
|
/**
|
|
1330
1330
|
* Border Radius End Start
|
|
1331
1331
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1332
1332
|
*/
|
|
1333
1333
|
"rounded-es": [{
|
|
1334
|
-
"rounded-es": [
|
|
1334
|
+
"rounded-es": [s]
|
|
1335
1335
|
}],
|
|
1336
1336
|
/**
|
|
1337
1337
|
* Border Radius Top Left
|
|
1338
1338
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1339
1339
|
*/
|
|
1340
1340
|
"rounded-tl": [{
|
|
1341
|
-
"rounded-tl": [
|
|
1341
|
+
"rounded-tl": [s]
|
|
1342
1342
|
}],
|
|
1343
1343
|
/**
|
|
1344
1344
|
* Border Radius Top Right
|
|
1345
1345
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1346
1346
|
*/
|
|
1347
1347
|
"rounded-tr": [{
|
|
1348
|
-
"rounded-tr": [
|
|
1348
|
+
"rounded-tr": [s]
|
|
1349
1349
|
}],
|
|
1350
1350
|
/**
|
|
1351
1351
|
* Border Radius Bottom Right
|
|
1352
1352
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1353
1353
|
*/
|
|
1354
1354
|
"rounded-br": [{
|
|
1355
|
-
"rounded-br": [
|
|
1355
|
+
"rounded-br": [s]
|
|
1356
1356
|
}],
|
|
1357
1357
|
/**
|
|
1358
1358
|
* Border Radius Bottom Left
|
|
1359
1359
|
* @see https://tailwindcss.com/docs/border-radius
|
|
1360
1360
|
*/
|
|
1361
1361
|
"rounded-bl": [{
|
|
1362
|
-
"rounded-bl": [
|
|
1362
|
+
"rounded-bl": [s]
|
|
1363
1363
|
}],
|
|
1364
1364
|
/**
|
|
1365
1365
|
* Border Width
|
|
@@ -1481,70 +1481,70 @@ const D = (e) => {
|
|
|
1481
1481
|
* @see https://tailwindcss.com/docs/border-color
|
|
1482
1482
|
*/
|
|
1483
1483
|
"border-color": [{
|
|
1484
|
-
border: [
|
|
1484
|
+
border: [o]
|
|
1485
1485
|
}],
|
|
1486
1486
|
/**
|
|
1487
1487
|
* Border Color X
|
|
1488
1488
|
* @see https://tailwindcss.com/docs/border-color
|
|
1489
1489
|
*/
|
|
1490
1490
|
"border-color-x": [{
|
|
1491
|
-
"border-x": [
|
|
1491
|
+
"border-x": [o]
|
|
1492
1492
|
}],
|
|
1493
1493
|
/**
|
|
1494
1494
|
* Border Color Y
|
|
1495
1495
|
* @see https://tailwindcss.com/docs/border-color
|
|
1496
1496
|
*/
|
|
1497
1497
|
"border-color-y": [{
|
|
1498
|
-
"border-y": [
|
|
1498
|
+
"border-y": [o]
|
|
1499
1499
|
}],
|
|
1500
1500
|
/**
|
|
1501
1501
|
* Border Color S
|
|
1502
1502
|
* @see https://tailwindcss.com/docs/border-color
|
|
1503
1503
|
*/
|
|
1504
1504
|
"border-color-s": [{
|
|
1505
|
-
"border-s": [
|
|
1505
|
+
"border-s": [o]
|
|
1506
1506
|
}],
|
|
1507
1507
|
/**
|
|
1508
1508
|
* Border Color E
|
|
1509
1509
|
* @see https://tailwindcss.com/docs/border-color
|
|
1510
1510
|
*/
|
|
1511
1511
|
"border-color-e": [{
|
|
1512
|
-
"border-e": [
|
|
1512
|
+
"border-e": [o]
|
|
1513
1513
|
}],
|
|
1514
1514
|
/**
|
|
1515
1515
|
* Border Color Top
|
|
1516
1516
|
* @see https://tailwindcss.com/docs/border-color
|
|
1517
1517
|
*/
|
|
1518
1518
|
"border-color-t": [{
|
|
1519
|
-
"border-t": [
|
|
1519
|
+
"border-t": [o]
|
|
1520
1520
|
}],
|
|
1521
1521
|
/**
|
|
1522
1522
|
* Border Color Right
|
|
1523
1523
|
* @see https://tailwindcss.com/docs/border-color
|
|
1524
1524
|
*/
|
|
1525
1525
|
"border-color-r": [{
|
|
1526
|
-
"border-r": [
|
|
1526
|
+
"border-r": [o]
|
|
1527
1527
|
}],
|
|
1528
1528
|
/**
|
|
1529
1529
|
* Border Color Bottom
|
|
1530
1530
|
* @see https://tailwindcss.com/docs/border-color
|
|
1531
1531
|
*/
|
|
1532
1532
|
"border-color-b": [{
|
|
1533
|
-
"border-b": [
|
|
1533
|
+
"border-b": [o]
|
|
1534
1534
|
}],
|
|
1535
1535
|
/**
|
|
1536
1536
|
* Border Color Left
|
|
1537
1537
|
* @see https://tailwindcss.com/docs/border-color
|
|
1538
1538
|
*/
|
|
1539
1539
|
"border-color-l": [{
|
|
1540
|
-
"border-l": [
|
|
1540
|
+
"border-l": [o]
|
|
1541
1541
|
}],
|
|
1542
1542
|
/**
|
|
1543
1543
|
* Divide Color
|
|
1544
1544
|
* @see https://tailwindcss.com/docs/divide-color
|
|
1545
1545
|
*/
|
|
1546
1546
|
"divide-color": [{
|
|
1547
|
-
divide: [
|
|
1547
|
+
divide: [o]
|
|
1548
1548
|
}],
|
|
1549
1549
|
/**
|
|
1550
1550
|
* Outline Style
|
|
@@ -1558,14 +1558,14 @@ const D = (e) => {
|
|
|
1558
1558
|
* @see https://tailwindcss.com/docs/outline-offset
|
|
1559
1559
|
*/
|
|
1560
1560
|
"outline-offset": [{
|
|
1561
|
-
"outline-offset": [
|
|
1561
|
+
"outline-offset": [ue, N]
|
|
1562
1562
|
}],
|
|
1563
1563
|
/**
|
|
1564
1564
|
* Outline Width
|
|
1565
1565
|
* @see https://tailwindcss.com/docs/outline-width
|
|
1566
1566
|
*/
|
|
1567
1567
|
"outline-w": [{
|
|
1568
|
-
outline: [
|
|
1568
|
+
outline: [ue, be]
|
|
1569
1569
|
}],
|
|
1570
1570
|
/**
|
|
1571
1571
|
* Outline Color
|
|
@@ -1605,7 +1605,7 @@ const D = (e) => {
|
|
|
1605
1605
|
* @see https://tailwindcss.com/docs/ring-offset-width
|
|
1606
1606
|
*/
|
|
1607
1607
|
"ring-offset-w": [{
|
|
1608
|
-
"ring-offset": [
|
|
1608
|
+
"ring-offset": [ue, be]
|
|
1609
1609
|
}],
|
|
1610
1610
|
/**
|
|
1611
1611
|
* Ring Offset Color
|
|
@@ -1627,7 +1627,7 @@ const D = (e) => {
|
|
|
1627
1627
|
* @see https://tailwindcss.com/docs/box-shadow-color
|
|
1628
1628
|
*/
|
|
1629
1629
|
"shadow-color": [{
|
|
1630
|
-
shadow: [
|
|
1630
|
+
shadow: [Ne]
|
|
1631
1631
|
}],
|
|
1632
1632
|
/**
|
|
1633
1633
|
* Opacity
|
|
@@ -1678,14 +1678,14 @@ const D = (e) => {
|
|
|
1678
1678
|
* @see https://tailwindcss.com/docs/contrast
|
|
1679
1679
|
*/
|
|
1680
1680
|
contrast: [{
|
|
1681
|
-
contrast: [
|
|
1681
|
+
contrast: [d]
|
|
1682
1682
|
}],
|
|
1683
1683
|
/**
|
|
1684
1684
|
* Drop Shadow
|
|
1685
1685
|
* @see https://tailwindcss.com/docs/drop-shadow
|
|
1686
1686
|
*/
|
|
1687
1687
|
"drop-shadow": [{
|
|
1688
|
-
"drop-shadow": ["", "none", we,
|
|
1688
|
+
"drop-shadow": ["", "none", we, N]
|
|
1689
1689
|
}],
|
|
1690
1690
|
/**
|
|
1691
1691
|
* Grayscale
|
|
@@ -1706,7 +1706,7 @@ const D = (e) => {
|
|
|
1706
1706
|
* @see https://tailwindcss.com/docs/invert
|
|
1707
1707
|
*/
|
|
1708
1708
|
invert: [{
|
|
1709
|
-
invert: [
|
|
1709
|
+
invert: [f]
|
|
1710
1710
|
}],
|
|
1711
1711
|
/**
|
|
1712
1712
|
* Saturate
|
|
@@ -1749,7 +1749,7 @@ const D = (e) => {
|
|
|
1749
1749
|
* @see https://tailwindcss.com/docs/backdrop-contrast
|
|
1750
1750
|
*/
|
|
1751
1751
|
"backdrop-contrast": [{
|
|
1752
|
-
"backdrop-contrast": [
|
|
1752
|
+
"backdrop-contrast": [d]
|
|
1753
1753
|
}],
|
|
1754
1754
|
/**
|
|
1755
1755
|
* Backdrop Grayscale
|
|
@@ -1770,7 +1770,7 @@ const D = (e) => {
|
|
|
1770
1770
|
* @see https://tailwindcss.com/docs/backdrop-invert
|
|
1771
1771
|
*/
|
|
1772
1772
|
"backdrop-invert": [{
|
|
1773
|
-
"backdrop-invert": [
|
|
1773
|
+
"backdrop-invert": [f]
|
|
1774
1774
|
}],
|
|
1775
1775
|
/**
|
|
1776
1776
|
* Backdrop Opacity
|
|
@@ -1842,35 +1842,35 @@ const D = (e) => {
|
|
|
1842
1842
|
* @see https://tailwindcss.com/docs/transition-property
|
|
1843
1843
|
*/
|
|
1844
1844
|
transition: [{
|
|
1845
|
-
transition: ["none", "all", "", "colors", "opacity", "shadow", "transform",
|
|
1845
|
+
transition: ["none", "all", "", "colors", "opacity", "shadow", "transform", N]
|
|
1846
1846
|
}],
|
|
1847
1847
|
/**
|
|
1848
1848
|
* Transition Duration
|
|
1849
1849
|
* @see https://tailwindcss.com/docs/transition-duration
|
|
1850
1850
|
*/
|
|
1851
1851
|
duration: [{
|
|
1852
|
-
duration:
|
|
1852
|
+
duration: q()
|
|
1853
1853
|
}],
|
|
1854
1854
|
/**
|
|
1855
1855
|
* Transition Timing Function
|
|
1856
1856
|
* @see https://tailwindcss.com/docs/transition-timing-function
|
|
1857
1857
|
*/
|
|
1858
1858
|
ease: [{
|
|
1859
|
-
ease: ["linear", "in", "out", "in-out",
|
|
1859
|
+
ease: ["linear", "in", "out", "in-out", N]
|
|
1860
1860
|
}],
|
|
1861
1861
|
/**
|
|
1862
1862
|
* Transition Delay
|
|
1863
1863
|
* @see https://tailwindcss.com/docs/transition-delay
|
|
1864
1864
|
*/
|
|
1865
1865
|
delay: [{
|
|
1866
|
-
delay:
|
|
1866
|
+
delay: q()
|
|
1867
1867
|
}],
|
|
1868
1868
|
/**
|
|
1869
1869
|
* Animation
|
|
1870
1870
|
* @see https://tailwindcss.com/docs/animation
|
|
1871
1871
|
*/
|
|
1872
1872
|
animate: [{
|
|
1873
|
-
animate: ["none", "spin", "ping", "pulse", "bounce",
|
|
1873
|
+
animate: ["none", "spin", "ping", "pulse", "bounce", N]
|
|
1874
1874
|
}],
|
|
1875
1875
|
// Transforms
|
|
1876
1876
|
/**
|
|
@@ -1885,42 +1885,42 @@ const D = (e) => {
|
|
|
1885
1885
|
* @see https://tailwindcss.com/docs/scale
|
|
1886
1886
|
*/
|
|
1887
1887
|
scale: [{
|
|
1888
|
-
scale: [
|
|
1888
|
+
scale: [w]
|
|
1889
1889
|
}],
|
|
1890
1890
|
/**
|
|
1891
1891
|
* Scale X
|
|
1892
1892
|
* @see https://tailwindcss.com/docs/scale
|
|
1893
1893
|
*/
|
|
1894
1894
|
"scale-x": [{
|
|
1895
|
-
"scale-x": [
|
|
1895
|
+
"scale-x": [w]
|
|
1896
1896
|
}],
|
|
1897
1897
|
/**
|
|
1898
1898
|
* Scale Y
|
|
1899
1899
|
* @see https://tailwindcss.com/docs/scale
|
|
1900
1900
|
*/
|
|
1901
1901
|
"scale-y": [{
|
|
1902
|
-
"scale-y": [
|
|
1902
|
+
"scale-y": [w]
|
|
1903
1903
|
}],
|
|
1904
1904
|
/**
|
|
1905
1905
|
* Rotate
|
|
1906
1906
|
* @see https://tailwindcss.com/docs/rotate
|
|
1907
1907
|
*/
|
|
1908
1908
|
rotate: [{
|
|
1909
|
-
rotate: [_e,
|
|
1909
|
+
rotate: [_e, N]
|
|
1910
1910
|
}],
|
|
1911
1911
|
/**
|
|
1912
1912
|
* Translate X
|
|
1913
1913
|
* @see https://tailwindcss.com/docs/translate
|
|
1914
1914
|
*/
|
|
1915
1915
|
"translate-x": [{
|
|
1916
|
-
"translate-x": [
|
|
1916
|
+
"translate-x": [m]
|
|
1917
1917
|
}],
|
|
1918
1918
|
/**
|
|
1919
1919
|
* Translate Y
|
|
1920
1920
|
* @see https://tailwindcss.com/docs/translate
|
|
1921
1921
|
*/
|
|
1922
1922
|
"translate-y": [{
|
|
1923
|
-
"translate-y": [
|
|
1923
|
+
"translate-y": [m]
|
|
1924
1924
|
}],
|
|
1925
1925
|
/**
|
|
1926
1926
|
* Skew X
|
|
@@ -1941,7 +1941,7 @@ const D = (e) => {
|
|
|
1941
1941
|
* @see https://tailwindcss.com/docs/transform-origin
|
|
1942
1942
|
*/
|
|
1943
1943
|
"transform-origin": [{
|
|
1944
|
-
origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left",
|
|
1944
|
+
origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", N]
|
|
1945
1945
|
}],
|
|
1946
1946
|
// Interactivity
|
|
1947
1947
|
/**
|
|
@@ -1963,7 +1963,7 @@ const D = (e) => {
|
|
|
1963
1963
|
* @see https://tailwindcss.com/docs/cursor
|
|
1964
1964
|
*/
|
|
1965
1965
|
cursor: [{
|
|
1966
|
-
cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out",
|
|
1966
|
+
cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", N]
|
|
1967
1967
|
}],
|
|
1968
1968
|
/**
|
|
1969
1969
|
* Caret Color
|
|
@@ -2185,7 +2185,7 @@ const D = (e) => {
|
|
|
2185
2185
|
* @see https://tailwindcss.com/docs/will-change
|
|
2186
2186
|
*/
|
|
2187
2187
|
"will-change": [{
|
|
2188
|
-
"will-change": ["auto", "scroll", "contents", "transform",
|
|
2188
|
+
"will-change": ["auto", "scroll", "contents", "transform", N]
|
|
2189
2189
|
}],
|
|
2190
2190
|
// SVG
|
|
2191
2191
|
/**
|
|
@@ -2200,7 +2200,7 @@ const D = (e) => {
|
|
|
2200
2200
|
* @see https://tailwindcss.com/docs/stroke-width
|
|
2201
2201
|
*/
|
|
2202
2202
|
"stroke-w": [{
|
|
2203
|
-
stroke: [
|
|
2203
|
+
stroke: [ue, be, qe]
|
|
2204
2204
|
}],
|
|
2205
2205
|
/**
|
|
2206
2206
|
* Stroke
|
|
@@ -2275,22 +2275,22 @@ const D = (e) => {
|
|
|
2275
2275
|
"font-size": ["leading"]
|
|
2276
2276
|
}
|
|
2277
2277
|
};
|
|
2278
|
-
}, Pn = /* @__PURE__ */
|
|
2279
|
-
function
|
|
2278
|
+
}, Pn = /* @__PURE__ */ un(En);
|
|
2279
|
+
function ro(...e) {
|
|
2280
2280
|
return Pn(Qt(e));
|
|
2281
2281
|
}
|
|
2282
2282
|
function _n(e) {
|
|
2283
2283
|
let t = !1, n = "";
|
|
2284
|
-
for (const
|
|
2285
|
-
if (
|
|
2286
|
-
n +=
|
|
2284
|
+
for (const o of e) {
|
|
2285
|
+
if (o === "\\") {
|
|
2286
|
+
n += o, t = !t;
|
|
2287
2287
|
continue;
|
|
2288
2288
|
}
|
|
2289
|
-
if (
|
|
2289
|
+
if (o === "'" && !t) {
|
|
2290
2290
|
n += '"';
|
|
2291
2291
|
continue;
|
|
2292
2292
|
}
|
|
2293
|
-
n +=
|
|
2293
|
+
n += o, t = !1;
|
|
2294
2294
|
}
|
|
2295
2295
|
return n.replace(/\bTrue\b/g, "true").replace(/\bFalse\b/g, "false").replace(/\bNone\b/g, "null");
|
|
2296
2296
|
}
|
|
@@ -2310,10 +2310,10 @@ function tt(e) {
|
|
|
2310
2310
|
return null;
|
|
2311
2311
|
}
|
|
2312
2312
|
}
|
|
2313
|
-
function
|
|
2313
|
+
function Nn(e) {
|
|
2314
2314
|
return typeof e != "string" ? !1 : /^[\s\n]*[-*]\s|^[\s\n]*#+\s|```|^\s*\[.*\]\(|^>\s/.test(e);
|
|
2315
2315
|
}
|
|
2316
|
-
function
|
|
2316
|
+
function zn(e) {
|
|
2317
2317
|
return e.type === "image_url";
|
|
2318
2318
|
}
|
|
2319
2319
|
function Rn(e) {
|
|
@@ -2323,10 +2323,10 @@ function Ln(e) {
|
|
|
2323
2323
|
return Array.isArray(e.content) ? e.content.filter((t) => t.type === "text").map((t) => t.text).join(`
|
|
2324
2324
|
`).trim() : typeof e.content == "string" ? e.content : "";
|
|
2325
2325
|
}
|
|
2326
|
-
function Un(e) {
|
|
2327
|
-
return e.content.filter(Nn);
|
|
2328
|
-
}
|
|
2329
2326
|
function jn(e) {
|
|
2327
|
+
return e.content.filter(zn);
|
|
2328
|
+
}
|
|
2329
|
+
function Un(e) {
|
|
2330
2330
|
return e.content.filter(Rn);
|
|
2331
2331
|
}
|
|
2332
2332
|
function Mt(e) {
|
|
@@ -2372,8 +2372,8 @@ 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
|
|
2376
|
-
|
|
2375
|
+
const o = Ke(r);
|
|
2376
|
+
o !== void 0 && (t[n] = o);
|
|
2377
2377
|
}
|
|
2378
2378
|
}
|
|
2379
2379
|
if (Object.keys(t).length)
|
|
@@ -2397,15 +2397,15 @@ function Et(e) {
|
|
|
2397
2397
|
return "";
|
|
2398
2398
|
}
|
|
2399
2399
|
}
|
|
2400
|
-
function
|
|
2400
|
+
function oo(e) {
|
|
2401
2401
|
const t = Et(e);
|
|
2402
|
-
return typeof e == "string" &&
|
|
2402
|
+
return typeof e == "string" && Nn(e) ? { content: e, isMarkdown: !0 } : { content: t, isMarkdown: !1 };
|
|
2403
2403
|
}
|
|
2404
2404
|
function Fn(e) {
|
|
2405
2405
|
const t = (r) => {
|
|
2406
2406
|
try {
|
|
2407
|
-
const
|
|
2408
|
-
return typeof
|
|
2407
|
+
const o = Ke(r);
|
|
2408
|
+
return typeof o == "string" ? o : JSON.stringify(o ?? "");
|
|
2409
2409
|
} catch {
|
|
2410
2410
|
return "";
|
|
2411
2411
|
}
|
|
@@ -2413,7 +2413,7 @@ function Fn(e) {
|
|
|
2413
2413
|
return n.length ? t(n.map((r) => r.text).join(`
|
|
2414
2414
|
`)) : t(e);
|
|
2415
2415
|
}
|
|
2416
|
-
function
|
|
2416
|
+
function so(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) {
|
|
@@ -2448,27 +2448,27 @@ function le(e) {
|
|
|
2448
2448
|
);
|
|
2449
2449
|
}
|
|
2450
2450
|
function nt(e) {
|
|
2451
|
-
var x, M, A,
|
|
2451
|
+
var x, M, A, w, b, h, T;
|
|
2452
2452
|
if (!e || typeof e != "object") return null;
|
|
2453
2453
|
const t = le(e), n = Kn(t);
|
|
2454
2454
|
if (!n)
|
|
2455
2455
|
return null;
|
|
2456
|
-
const r = t.toolCalls ?? ((x = t.additionalKwargs) == null ? void 0 : x.toolCalls),
|
|
2456
|
+
const r = t.toolCalls ?? ((x = t.additionalKwargs) == null ? void 0 : x.toolCalls), o = Array.isArray(r) ? r.map(rt) : void 0, s = Dn(t.content ?? t.parts, !!(o != null && o.length)), a = t.id ?? `msg-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`, i = t.createdAt ?? ((M = t.additionalKwargs) == null ? void 0 : M.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(), d = t.name ?? ((A = t.additionalKwargs) == null ? void 0 : A.agentName) ?? void 0, c = t.model ?? ((w = t.additionalKwargs) == null ? void 0 : w.model) ?? void 0, l = t.toolCallId ?? void 0, f = t.additionalKwargs ?? void 0, p = t.responseMetadata ?? void 0, g = t.checkpointId ?? ((b = t.additionalKwargs) == null ? void 0 : b.checkpointId) ?? void 0, I = t.checkpointNs ?? ((h = t.additionalKwargs) == null ? void 0 : h.checkpointNs) ?? void 0, u = typeof t.toolStreaming == "boolean" ? t.toolStreaming : !!((T = t.additionalKwargs) != null && T.toolStreaming);
|
|
2457
2457
|
return {
|
|
2458
2458
|
...t,
|
|
2459
2459
|
id: a,
|
|
2460
2460
|
role: n,
|
|
2461
|
-
content:
|
|
2461
|
+
content: s,
|
|
2462
2462
|
createdAt: i,
|
|
2463
|
-
name:
|
|
2463
|
+
name: d,
|
|
2464
2464
|
model: c,
|
|
2465
2465
|
toolCallId: l,
|
|
2466
|
-
toolCalls:
|
|
2467
|
-
checkpointId:
|
|
2466
|
+
toolCalls: o,
|
|
2467
|
+
checkpointId: g,
|
|
2468
2468
|
checkpointNs: I,
|
|
2469
|
-
toolStreaming:
|
|
2470
|
-
additionalKwargs:
|
|
2471
|
-
responseMetadata:
|
|
2469
|
+
toolStreaming: u,
|
|
2470
|
+
additionalKwargs: f,
|
|
2471
|
+
responseMetadata: p,
|
|
2472
2472
|
artifact: t.artifact && typeof t.artifact == "object" && !t.artifact.type ? { ...t.artifact, type: t.name } : t.artifact ?? void 0
|
|
2473
2473
|
};
|
|
2474
2474
|
}
|
|
@@ -2504,12 +2504,12 @@ function Kn(e) {
|
|
|
2504
2504
|
const r = t.type;
|
|
2505
2505
|
return r ? r === "user" || r === "assistant" || r === "system" || r === "tool" ? r : r === "human" ? "user" : r === "ai" ? "assistant" : null : null;
|
|
2506
2506
|
}
|
|
2507
|
-
function
|
|
2507
|
+
function dt(e) {
|
|
2508
2508
|
if (!e) return null;
|
|
2509
2509
|
const t = String(e).toLowerCase();
|
|
2510
2510
|
return t === "running" || t === "pending" ? "pending" : t === "completed" || t === "success" ? "completed" : t === "error" || t === "failed" || t === "failure" ? "error" : null;
|
|
2511
2511
|
}
|
|
2512
|
-
function
|
|
2512
|
+
function ut(e) {
|
|
2513
2513
|
return (Array.isArray(e.toolCalls) ? e.toolCalls : Mt(e)).map(rt);
|
|
2514
2514
|
}
|
|
2515
2515
|
function He(e, t) {
|
|
@@ -2522,11 +2522,11 @@ function Vn(e, t) {
|
|
|
2522
2522
|
if (!n) return;
|
|
2523
2523
|
const r = typeof n == "string" ? n : Et(n);
|
|
2524
2524
|
if (!r.trim()) return;
|
|
2525
|
-
const
|
|
2525
|
+
const o = [{ type: "text", text: r }];
|
|
2526
2526
|
return {
|
|
2527
2527
|
id: `tool-${t.id}`,
|
|
2528
2528
|
role: "tool",
|
|
2529
|
-
content:
|
|
2529
|
+
content: o,
|
|
2530
2530
|
name: t.name,
|
|
2531
2531
|
toolCallId: t.id,
|
|
2532
2532
|
artifact: t.artifact,
|
|
@@ -2535,10 +2535,10 @@ function Vn(e, t) {
|
|
|
2535
2535
|
}
|
|
2536
2536
|
function qn(e, t = []) {
|
|
2537
2537
|
if (Array.isArray(e)) {
|
|
2538
|
-
const
|
|
2539
|
-
return
|
|
2540
|
-
var
|
|
2541
|
-
const i = He(a.id, e) || He(a.id, t),
|
|
2538
|
+
const o = e.filter((a) => a.role === "assistant").flatMap((a) => ut(a)), s = /* @__PURE__ */ new Map();
|
|
2539
|
+
return o.forEach((a) => s.set(a.id, a)), Array.from(s.values()).map((a) => {
|
|
2540
|
+
var f, p, g;
|
|
2541
|
+
const i = He(a.id, e) || He(a.id, t), d = Array.isArray((f = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : f.toolProgress) ? (p = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : p.toolProgress : void 0, c = (i == null ? void 0 : i.artifact) ?? a.artifact, l = dt(a.status) ?? ((g = i == null ? void 0 : i.additionalKwargs) != null && g.toolStreaming ? "pending" : null) ?? (i ? "completed" : "pending");
|
|
2542
2542
|
if (i && !a.content && l === "completed") {
|
|
2543
2543
|
const I = ce(i);
|
|
2544
2544
|
typeof I == "string" && (a.content = I);
|
|
@@ -2547,33 +2547,33 @@ function qn(e, t = []) {
|
|
|
2547
2547
|
call: a,
|
|
2548
2548
|
result: i,
|
|
2549
2549
|
state: l,
|
|
2550
|
-
progress:
|
|
2550
|
+
progress: d,
|
|
2551
2551
|
artifact: c
|
|
2552
2552
|
};
|
|
2553
2553
|
});
|
|
2554
2554
|
}
|
|
2555
2555
|
if (e.role !== "assistant") return [];
|
|
2556
|
-
const n =
|
|
2556
|
+
const n = ut(e);
|
|
2557
2557
|
return n.length === 0 ? [] : n.map((r) => {
|
|
2558
|
-
var
|
|
2559
|
-
const
|
|
2560
|
-
if (
|
|
2561
|
-
const
|
|
2562
|
-
typeof
|
|
2558
|
+
var d, c, l;
|
|
2559
|
+
const o = He(r.id, t) ?? Vn(e, r), s = Array.isArray((d = o == null ? void 0 : o.additionalKwargs) == null ? void 0 : d.toolProgress) ? (c = o == null ? void 0 : o.additionalKwargs) == null ? void 0 : c.toolProgress : void 0, a = (o == null ? void 0 : o.artifact) ?? r.artifact, i = dt(r.status) ?? ((l = o == null ? void 0 : o.additionalKwargs) != null && l.toolStreaming ? "pending" : null) ?? (o ? "completed" : "pending");
|
|
2560
|
+
if (o && !r.content && i === "completed") {
|
|
2561
|
+
const f = ce(o);
|
|
2562
|
+
typeof f == "string" && (r.content = f);
|
|
2563
2563
|
}
|
|
2564
2564
|
return {
|
|
2565
2565
|
call: r,
|
|
2566
|
-
result:
|
|
2566
|
+
result: o,
|
|
2567
2567
|
state: i,
|
|
2568
|
-
progress:
|
|
2568
|
+
progress: s,
|
|
2569
2569
|
artifact: a
|
|
2570
2570
|
};
|
|
2571
2571
|
});
|
|
2572
2572
|
}
|
|
2573
|
-
function
|
|
2573
|
+
function ao(e, t = []) {
|
|
2574
2574
|
return qn(e, t).map((n) => n.artifact).filter((n) => !!n);
|
|
2575
2575
|
}
|
|
2576
|
-
const
|
|
2576
|
+
const ze = {
|
|
2577
2577
|
authToken: "authToken",
|
|
2578
2578
|
authTokenExpiresAt: "authTokenExpiresAt",
|
|
2579
2579
|
authSessionId: "authSessionId",
|
|
@@ -2597,7 +2597,7 @@ function _t(e) {
|
|
|
2597
2597
|
return Qe.add(e), () => Qe.delete(e);
|
|
2598
2598
|
}
|
|
2599
2599
|
const Hn = 12e4, Gn = 12e4;
|
|
2600
|
-
let Ye = Hn,
|
|
2600
|
+
let Ye = Hn, Nt = Gn;
|
|
2601
2601
|
const ne = Jt.create({
|
|
2602
2602
|
// BaseURL is set dynamically via ApiProvider -> api.updateConfig
|
|
2603
2603
|
timeout: Ye,
|
|
@@ -2608,20 +2608,20 @@ function ft(e) {
|
|
|
2608
2608
|
}
|
|
2609
2609
|
function Wn(e) {
|
|
2610
2610
|
const t = ft(e.requestTimeoutMs), n = ft(e.historyTimeoutMs);
|
|
2611
|
-
t !== null && (Ye = t, ne.defaults.timeout = Ye), n !== null && (
|
|
2611
|
+
t !== null && (Ye = t, ne.defaults.timeout = Ye), n !== null && (Nt = n);
|
|
2612
2612
|
}
|
|
2613
2613
|
function Jn() {
|
|
2614
|
-
return
|
|
2614
|
+
return Nt;
|
|
2615
2615
|
}
|
|
2616
2616
|
ne.interceptors.request.use((e) => (Ve && (e.headers.Authorization = `Bearer ${Ve}`), e));
|
|
2617
2617
|
ne.interceptors.response.use(
|
|
2618
2618
|
(e) => {
|
|
2619
2619
|
if (typeof window < "u" && (e != null && e.data))
|
|
2620
2620
|
try {
|
|
2621
|
-
const t = e.data, n = t.data || {}, r = typeof t.token == "string" && t.token || typeof n.token == "string" && n.token || null,
|
|
2622
|
-
r && (localStorage.setItem(
|
|
2621
|
+
const t = e.data, n = t.data || {}, r = typeof t.token == "string" && t.token || typeof n.token == "string" && n.token || null, o = typeof t.expires_at == "number" && t.expires_at || typeof n.expires_at == "number" && n.expires_at || typeof t.expiresAt == "number" && t.expiresAt || typeof n.expiresAt == "number" && n.expiresAt || null;
|
|
2622
|
+
r && (localStorage.setItem(ze.authToken, r), Ie(r)), o && localStorage.setItem(ze.authTokenExpiresAt, o.toString()), (r || o) && window.dispatchEvent(
|
|
2623
2623
|
new CustomEvent("smartorg:chat-token-updated", {
|
|
2624
|
-
detail: { token: r, expiresAt:
|
|
2624
|
+
detail: { token: r, expiresAt: o }
|
|
2625
2625
|
})
|
|
2626
2626
|
);
|
|
2627
2627
|
} catch (t) {
|
|
@@ -2631,7 +2631,7 @@ ne.interceptors.response.use(
|
|
|
2631
2631
|
},
|
|
2632
2632
|
(e) => Promise.reject(e)
|
|
2633
2633
|
);
|
|
2634
|
-
async function
|
|
2634
|
+
async function se(e, t) {
|
|
2635
2635
|
return ne.defaults.baseURL ? (await ne.get(e, t)).data : Promise.reject(new Error("API base URL is not configured"));
|
|
2636
2636
|
}
|
|
2637
2637
|
async function Ze(e, t, n) {
|
|
@@ -2677,15 +2677,15 @@ class Yn {
|
|
|
2677
2677
|
}
|
|
2678
2678
|
// ---- Thread Management ----
|
|
2679
2679
|
async listThreads() {
|
|
2680
|
-
const t = await
|
|
2680
|
+
const t = await se("/threads"), n = ae(t);
|
|
2681
2681
|
return (n == null ? void 0 : n.items) ?? (t == null ? void 0 : t.items) ?? [];
|
|
2682
2682
|
}
|
|
2683
2683
|
// listUsers moved to AuthApi
|
|
2684
2684
|
async createThread(t, n) {
|
|
2685
2685
|
const r = {};
|
|
2686
2686
|
t && (r.title = t), n && (r.project = n);
|
|
2687
|
-
const
|
|
2688
|
-
return ae(
|
|
2687
|
+
const o = await Ze("/threads", Object.keys(r).length ? r : void 0);
|
|
2688
|
+
return ae(o);
|
|
2689
2689
|
}
|
|
2690
2690
|
async updateThread(t, n) {
|
|
2691
2691
|
const r = await Xn(`/threads/${t}`, { title: n });
|
|
@@ -2696,24 +2696,24 @@ class Yn {
|
|
|
2696
2696
|
return ae(n);
|
|
2697
2697
|
}
|
|
2698
2698
|
async threadInfo(t) {
|
|
2699
|
-
const n = await
|
|
2699
|
+
const n = await se(`/threads/${t}/info`);
|
|
2700
2700
|
return ae(n);
|
|
2701
2701
|
}
|
|
2702
2702
|
// ---- Agents ----
|
|
2703
2703
|
async listAgents() {
|
|
2704
|
-
const t = await
|
|
2704
|
+
const t = await se("/agents"), n = ae(t);
|
|
2705
2705
|
return (n == null ? void 0 : n.items) ?? [];
|
|
2706
2706
|
}
|
|
2707
2707
|
async getAgent(t) {
|
|
2708
|
-
const n = await
|
|
2708
|
+
const n = await se(`/agents/${t}`);
|
|
2709
2709
|
return ae(n);
|
|
2710
2710
|
}
|
|
2711
2711
|
async getAgentSchema(t) {
|
|
2712
|
-
const n = await
|
|
2712
|
+
const n = await se(`/agents/${t}/schema`);
|
|
2713
2713
|
return ae(n);
|
|
2714
2714
|
}
|
|
2715
2715
|
async getState(t) {
|
|
2716
|
-
const n = await
|
|
2716
|
+
const n = await se(`/threads/${t.threadId}/state`, {
|
|
2717
2717
|
params: {
|
|
2718
2718
|
checkpoint_id: t.checkpointId,
|
|
2719
2719
|
checkpoint_ns: t.checkpointNs
|
|
@@ -2722,7 +2722,7 @@ class Yn {
|
|
|
2722
2722
|
return ae(n);
|
|
2723
2723
|
}
|
|
2724
2724
|
async getStateHistory(t) {
|
|
2725
|
-
const n = await
|
|
2725
|
+
const n = await se(`/threads/${t.threadId}/state/history`, {
|
|
2726
2726
|
params: {
|
|
2727
2727
|
checkpoint_id: t.checkpointId,
|
|
2728
2728
|
checkpoint_ns: t.checkpointNs,
|
|
@@ -2741,18 +2741,18 @@ class Yn {
|
|
|
2741
2741
|
return ae(n);
|
|
2742
2742
|
}
|
|
2743
2743
|
}
|
|
2744
|
-
const
|
|
2744
|
+
const zt = new Yn();
|
|
2745
2745
|
class Zn {
|
|
2746
2746
|
// Config logic could go here if files ever need a distinct base URL from chat
|
|
2747
2747
|
// For now, it shares the chatBaseUrl via the shared httpClient
|
|
2748
2748
|
async fetchFileBlob(t, n) {
|
|
2749
|
-
return await
|
|
2749
|
+
return await se(t, {
|
|
2750
2750
|
responseType: "blob",
|
|
2751
|
-
onDownloadProgress: (
|
|
2751
|
+
onDownloadProgress: (o) => {
|
|
2752
2752
|
try {
|
|
2753
|
-
if (n &&
|
|
2754
|
-
const
|
|
2755
|
-
n(
|
|
2753
|
+
if (n && o.lengthComputable) {
|
|
2754
|
+
const s = o.loaded / o.total;
|
|
2755
|
+
n(s);
|
|
2756
2756
|
}
|
|
2757
2757
|
} catch {
|
|
2758
2758
|
}
|
|
@@ -2762,8 +2762,8 @@ class Zn {
|
|
|
2762
2762
|
});
|
|
2763
2763
|
}
|
|
2764
2764
|
async viewFileById(t, n) {
|
|
2765
|
-
const r = await this.fetchFileBlob(`/files/${t}/view`, n),
|
|
2766
|
-
window.open(
|
|
2765
|
+
const r = await this.fetchFileBlob(`/files/${t}/view`, n), o = URL.createObjectURL(r);
|
|
2766
|
+
window.open(o, "_blank"), setTimeout(() => URL.revokeObjectURL(o), 6e4);
|
|
2767
2767
|
}
|
|
2768
2768
|
async getFileBlob(t, n) {
|
|
2769
2769
|
return await this.fetchFileBlob(`/files/${t}/view`, n);
|
|
@@ -2772,30 +2772,30 @@ class Zn {
|
|
|
2772
2772
|
return await (await this.fetchFileBlob(`/files/${t}/view`, n)).text();
|
|
2773
2773
|
}
|
|
2774
2774
|
async downloadFileById(t, n) {
|
|
2775
|
-
const r = await this.fetchFileBlob(`/files/${t}/download`, n),
|
|
2776
|
-
let
|
|
2775
|
+
const r = await this.fetchFileBlob(`/files/${t}/download`, n), o = URL.createObjectURL(r);
|
|
2776
|
+
let s = `file_${t}`;
|
|
2777
2777
|
try {
|
|
2778
|
-
const i = await
|
|
2779
|
-
|
|
2778
|
+
const i = await se(`/files/${t}`);
|
|
2779
|
+
s = (i == null ? void 0 : i.filename) ?? s;
|
|
2780
2780
|
} catch {
|
|
2781
2781
|
}
|
|
2782
2782
|
const a = document.createElement("a");
|
|
2783
|
-
a.href =
|
|
2783
|
+
a.href = o, a.download = s, document.body.appendChild(a), a.click(), a.remove(), setTimeout(() => URL.revokeObjectURL(o), 6e4);
|
|
2784
2784
|
}
|
|
2785
2785
|
async getFileInfo(t) {
|
|
2786
|
-
return await
|
|
2786
|
+
return await se(`/files/${t}`);
|
|
2787
2787
|
}
|
|
2788
2788
|
async listFiles(t, n = 50, r = 0) {
|
|
2789
|
-
const
|
|
2790
|
-
return t && (
|
|
2789
|
+
const o = { limit: n, offset: r };
|
|
2790
|
+
return t && (o.thread_id = t), await se("/files", { params: o });
|
|
2791
2791
|
}
|
|
2792
2792
|
async uploadFile(t, n, r) {
|
|
2793
|
-
const
|
|
2794
|
-
return
|
|
2795
|
-
onUploadProgress: (
|
|
2793
|
+
const o = new FormData();
|
|
2794
|
+
return o.append("file", t), n && o.append("thread_id", n), await Ze("/files/upload-form", o, {
|
|
2795
|
+
onUploadProgress: (s) => {
|
|
2796
2796
|
try {
|
|
2797
|
-
if (r &&
|
|
2798
|
-
const a =
|
|
2797
|
+
if (r && s.lengthComputable) {
|
|
2798
|
+
const a = s.loaded / s.total;
|
|
2799
2799
|
r(a);
|
|
2800
2800
|
}
|
|
2801
2801
|
} catch {
|
|
@@ -2834,61 +2834,61 @@ class er {
|
|
|
2834
2834
|
}
|
|
2835
2835
|
// ---- User Management ----
|
|
2836
2836
|
async listUsers() {
|
|
2837
|
-
const t = await
|
|
2837
|
+
const t = await se("/users", { baseURL: this.baseUrl });
|
|
2838
2838
|
return (t == null ? void 0 : t.users) ?? [];
|
|
2839
2839
|
}
|
|
2840
2840
|
}
|
|
2841
2841
|
const tr = new er(), Lt = Ce(null);
|
|
2842
2842
|
function nr({ children: e, apiConfig: t }) {
|
|
2843
|
-
const n =
|
|
2843
|
+
const n = zt, r = tr;
|
|
2844
2844
|
if (t) {
|
|
2845
|
-
const
|
|
2846
|
-
(t.baseUrl || t.chatBaseUrl ||
|
|
2845
|
+
const s = n.baseUrl, a = r.baseUrl, i = n.getAuthToken(), d = t.requestTimeoutMs !== void 0 || t.historyTimeoutMs !== void 0;
|
|
2846
|
+
(t.baseUrl || t.chatBaseUrl || d) && (d || t.chatBaseUrl && t.chatBaseUrl !== s || t.baseUrl && !s.startsWith(t.baseUrl)) && n.updateConfig(t), (t.baseUrl || t.authBaseUrl) && (t.authBaseUrl && t.authBaseUrl !== a || t.baseUrl && !a.startsWith(t.baseUrl)) && r.updateConfig(t), t.apiKey !== void 0 && t.apiKey !== i && (n.updateConfig({ apiKey: t.apiKey }), r.updateConfig({ apiKey: t.apiKey }));
|
|
2847
2847
|
}
|
|
2848
|
-
const
|
|
2848
|
+
const o = {
|
|
2849
2849
|
token: n.getAuthToken(),
|
|
2850
|
-
setToken: (
|
|
2851
|
-
n.setAuthToken(
|
|
2850
|
+
setToken: (s) => {
|
|
2851
|
+
n.setAuthToken(s), r.setAuthToken(s);
|
|
2852
2852
|
},
|
|
2853
2853
|
chatApi: n,
|
|
2854
2854
|
authApi: r,
|
|
2855
2855
|
fileApi: Rt,
|
|
2856
2856
|
baseUrl: n.baseUrl
|
|
2857
2857
|
};
|
|
2858
|
-
return /* @__PURE__ */ ie(Lt.Provider, { value:
|
|
2858
|
+
return /* @__PURE__ */ ie(Lt.Provider, { value: o, children: e });
|
|
2859
2859
|
}
|
|
2860
2860
|
async function rr(e) {
|
|
2861
2861
|
return await new Promise((t, n) => {
|
|
2862
2862
|
const r = new FileReader();
|
|
2863
2863
|
r.onload = () => {
|
|
2864
2864
|
try {
|
|
2865
|
-
const
|
|
2865
|
+
const o = r.result, s = new Uint8Array(o);
|
|
2866
2866
|
let a = "";
|
|
2867
|
-
const i =
|
|
2868
|
-
for (let
|
|
2867
|
+
const i = s.byteLength;
|
|
2868
|
+
for (let d = 0; d < i; d++) a += String.fromCharCode(s[d]);
|
|
2869
2869
|
t(btoa(a));
|
|
2870
|
-
} catch (
|
|
2871
|
-
n(
|
|
2870
|
+
} catch (o) {
|
|
2871
|
+
n(o);
|
|
2872
2872
|
}
|
|
2873
|
-
}, r.onerror = (
|
|
2873
|
+
}, r.onerror = (o) => n(o), r.readAsArrayBuffer(e);
|
|
2874
2874
|
});
|
|
2875
2875
|
}
|
|
2876
|
-
async function
|
|
2876
|
+
async function or(e = []) {
|
|
2877
2877
|
const t = [], n = [];
|
|
2878
2878
|
for (const r of e)
|
|
2879
2879
|
try {
|
|
2880
|
-
const
|
|
2880
|
+
const o = await rr(r), s = r.type || "application/octet-stream";
|
|
2881
2881
|
n.push({
|
|
2882
2882
|
filename: r.name,
|
|
2883
|
-
data:
|
|
2884
|
-
mime_type:
|
|
2885
|
-
}),
|
|
2883
|
+
data: o,
|
|
2884
|
+
mime_type: s
|
|
2885
|
+
}), s.startsWith("image/") ? t.push({
|
|
2886
2886
|
type: "image_url",
|
|
2887
|
-
image_url: { url: `data:${
|
|
2887
|
+
image_url: { url: `data:${s};base64,${o}` }
|
|
2888
2888
|
}) : t.push({
|
|
2889
2889
|
type: "file",
|
|
2890
|
-
url: `data:${
|
|
2891
|
-
mimeType:
|
|
2890
|
+
url: `data:${s};base64,${o}`,
|
|
2891
|
+
mimeType: s,
|
|
2892
2892
|
name: r.name,
|
|
2893
2893
|
size: r.size
|
|
2894
2894
|
});
|
|
@@ -2896,10 +2896,10 @@ async function sr(e = []) {
|
|
|
2896
2896
|
}
|
|
2897
2897
|
return { contentParts: t, filesInfo: n };
|
|
2898
2898
|
}
|
|
2899
|
-
function
|
|
2899
|
+
function sr(e) {
|
|
2900
2900
|
return e.filter((t) => t.type === "text").map((t) => t.text).join("");
|
|
2901
2901
|
}
|
|
2902
|
-
function
|
|
2902
|
+
function io(e) {
|
|
2903
2903
|
if (e == null) return null;
|
|
2904
2904
|
const t = String(e).trim();
|
|
2905
2905
|
return t.length > 0 ? t : null;
|
|
@@ -2911,13 +2911,13 @@ function ar(e) {
|
|
|
2911
2911
|
name: e.name ?? void 0
|
|
2912
2912
|
};
|
|
2913
2913
|
}
|
|
2914
|
-
function
|
|
2914
|
+
function co(e) {
|
|
2915
2915
|
var n;
|
|
2916
2916
|
if (e.name && e.name.trim()) return e.name;
|
|
2917
2917
|
const t = (n = e.additionalKwargs) == null ? void 0 : n.agentName;
|
|
2918
2918
|
return typeof t == "string" && t.trim() ? t : e.model && e.model.includes("/") ? e.model.split("/").pop() || null : e.model || null;
|
|
2919
2919
|
}
|
|
2920
|
-
function
|
|
2920
|
+
function lo(e) {
|
|
2921
2921
|
const t = e.updatedAt ?? e.createdAt ?? "", n = Array.isArray(e.content) ? e.content.map((a) => {
|
|
2922
2922
|
switch (a.type) {
|
|
2923
2923
|
case "text":
|
|
@@ -2927,11 +2927,11 @@ function ls(e) {
|
|
|
2927
2927
|
default:
|
|
2928
2928
|
return a.type === "interrupt" ? "interrupt" : "unknown";
|
|
2929
2929
|
}
|
|
2930
|
-
}).join("|") : "", r = "checkpointId" in e && e.checkpointId ? `cp:${e.checkpointId}` : "",
|
|
2931
|
-
return `${e.id}:${t}:${n}${
|
|
2930
|
+
}).join("|") : "", r = "checkpointId" in e && e.checkpointId ? `cp:${e.checkpointId}` : "", o = "checkpointNs" in e && e.checkpointNs ? `ns:${e.checkpointNs}` : "", s = [r, o].filter(Boolean).join("|");
|
|
2931
|
+
return `${e.id}:${t}:${n}${s ? `:${s}` : ""}`;
|
|
2932
2932
|
}
|
|
2933
2933
|
function Me() {
|
|
2934
|
-
const e =
|
|
2934
|
+
const e = je(Lt);
|
|
2935
2935
|
if (!e) throw new Error("useApi must be used within ApiProvider");
|
|
2936
2936
|
return e;
|
|
2937
2937
|
}
|
|
@@ -2945,7 +2945,7 @@ function ir(e, t, n) {
|
|
|
2945
2945
|
...n
|
|
2946
2946
|
};
|
|
2947
2947
|
}
|
|
2948
|
-
function
|
|
2948
|
+
function jt(e, t = "user") {
|
|
2949
2949
|
return typeof e == "string" ? ir(t, e) : e;
|
|
2950
2950
|
}
|
|
2951
2951
|
function cr(e) {
|
|
@@ -2957,10 +2957,10 @@ function Se(e) {
|
|
|
2957
2957
|
function lr(e) {
|
|
2958
2958
|
return Se(e) ? typeof e.id == "string" && typeof e.type == "string" && "content" in e : !1;
|
|
2959
2959
|
}
|
|
2960
|
-
function
|
|
2960
|
+
function dr(e) {
|
|
2961
2961
|
return Array.isArray(e) && e.every(lr);
|
|
2962
2962
|
}
|
|
2963
|
-
function
|
|
2963
|
+
function ur(e) {
|
|
2964
2964
|
if (!Se(e)) return {};
|
|
2965
2965
|
const t = {};
|
|
2966
2966
|
for (const [n, r] of Object.entries(e))
|
|
@@ -2974,7 +2974,7 @@ function fr(e, t) {
|
|
|
2974
2974
|
return t;
|
|
2975
2975
|
if (e === "messages/partial") {
|
|
2976
2976
|
const r = t;
|
|
2977
|
-
return
|
|
2977
|
+
return dr(r.messages) ? {
|
|
2978
2978
|
type: "messages/partial",
|
|
2979
2979
|
messages: r.messages,
|
|
2980
2980
|
seq: typeof r.seq == "number" ? r.seq : void 0,
|
|
@@ -2999,7 +2999,7 @@ function fr(e, t) {
|
|
|
2999
2999
|
const r = t;
|
|
3000
3000
|
return (r == null ? void 0 : r.type) === "messages/metadata" && Se(r.metadata) ? {
|
|
3001
3001
|
type: "messages/metadata",
|
|
3002
|
-
metadata:
|
|
3002
|
+
metadata: ur(r.metadata),
|
|
3003
3003
|
seq: typeof r.seq == "number" ? r.seq : void 0,
|
|
3004
3004
|
scope: typeof r.scope == "string" ? r.scope : void 0,
|
|
3005
3005
|
origin: r.origin === "task" ? "task" : "agent"
|
|
@@ -3009,134 +3009,134 @@ function fr(e, t) {
|
|
|
3009
3009
|
return "type" in n || (n.type = e), n;
|
|
3010
3010
|
}
|
|
3011
3011
|
function pr(e = {}) {
|
|
3012
|
-
const t = e.baseUrl || "", n = e.streamPath ?? "/stream", [r,
|
|
3012
|
+
const t = e.baseUrl || "", n = e.streamPath ?? "/stream", [r, o] = $(e.token ?? null), s = G(e.headers ?? {}), a = e.credentials ?? "include", i = G(e);
|
|
3013
3013
|
X(() => {
|
|
3014
3014
|
i.current = e;
|
|
3015
3015
|
}, [e]);
|
|
3016
|
-
const
|
|
3017
|
-
var j, C, O, F,
|
|
3018
|
-
const
|
|
3019
|
-
if (!
|
|
3020
|
-
(j =
|
|
3021
|
-
}, []), [c, l] = $(!1), [
|
|
3022
|
-
|
|
3016
|
+
const d = _((m) => {
|
|
3017
|
+
var j, C, O, F, P, B, z, J, U, R;
|
|
3018
|
+
const k = i.current;
|
|
3019
|
+
if (!k) return;
|
|
3020
|
+
(j = k.onEvent) == null || j.call(k, m), m.type === "thread_info" && ((C = k.onThreadInfo) == null || C.call(k, m)), m.type === "values" && ((O = k.handleValuesEvent) == null || O.call(k, m)), m.type === "metadata" && ((F = k.onMetadataEvent) == null || F.call(k, m)), typeof m.type == "string" && (m.type === "custom" || m.type.startsWith("custom.")) && ((P = k.onCustomEvent) == null || P.call(k, m)), m.type === "updates" && ((B = k.onUpdateEvent) == null || B.call(k, m)), m.type === "tool.end" ? (z = k.onToolEnd) == null || z.call(k, m) : m.type === "tool.start" && ((J = k.onToolStart) == null || J.call(k, m)), m.type === "heartbeat" && ((U = k.onHeartbeat) == null || U.call(k, m)), m.type === "token" && ((R = k.onToken) == null || R.call(k, m.token));
|
|
3021
|
+
}, []), [c, l] = $(!1), [f, p] = $(null), [g, I] = $(!1), [u, v] = $(null), x = G(null), M = G(!0), A = G(null), w = _((m) => {
|
|
3022
|
+
o(m);
|
|
3023
3023
|
}, []), b = _(() => {
|
|
3024
|
-
|
|
3024
|
+
p(null), v(null);
|
|
3025
3025
|
}, []), h = _(() => {
|
|
3026
3026
|
var C, O;
|
|
3027
3027
|
console.debug("[use-chat] stop() invoked - aborting stream");
|
|
3028
|
-
const
|
|
3028
|
+
const m = (C = A.current) == null ? void 0 : C.threadId, k = (O = A.current) == null ? void 0 : O.runId, E = () => {
|
|
3029
3029
|
var F;
|
|
3030
3030
|
(F = x.current) == null || F.abort(), x.current = null, A.current = null, l(!1), I(!1);
|
|
3031
3031
|
};
|
|
3032
|
-
(
|
|
3032
|
+
(k || m ? zt.cancelRun(k || m).catch((F) => {
|
|
3033
3033
|
console.warn("[use-chat] cancel run failed:", F);
|
|
3034
|
-
}) : Promise.resolve()).finally(
|
|
3034
|
+
}) : Promise.resolve()).finally(E);
|
|
3035
3035
|
}, []), T = _(
|
|
3036
|
-
(
|
|
3036
|
+
(m) => {
|
|
3037
3037
|
x.current && (x.current.abort(), x.current = null);
|
|
3038
|
-
const
|
|
3039
|
-
text: typeof
|
|
3040
|
-
threadId:
|
|
3041
|
-
attachments:
|
|
3042
|
-
payload:
|
|
3043
|
-
...
|
|
3044
|
-
creativityLevel:
|
|
3038
|
+
const k = {
|
|
3039
|
+
text: typeof m.content == "string" ? m.content : m.text,
|
|
3040
|
+
threadId: m.threadId,
|
|
3041
|
+
attachments: m.attachments,
|
|
3042
|
+
payload: m.payload ? {
|
|
3043
|
+
...m.payload,
|
|
3044
|
+
creativityLevel: m.payload.creativityLevel ?? "medium"
|
|
3045
3045
|
} : { creativityLevel: "medium" },
|
|
3046
|
-
config:
|
|
3047
|
-
checkpointId:
|
|
3048
|
-
checkpointNs:
|
|
3049
|
-
edit:
|
|
3050
|
-
command:
|
|
3046
|
+
config: m.config,
|
|
3047
|
+
checkpointId: m.checkpointId,
|
|
3048
|
+
checkpointNs: m.checkpointNs || void 0,
|
|
3049
|
+
edit: m.edit ?? !1,
|
|
3050
|
+
command: m.command
|
|
3051
3051
|
};
|
|
3052
|
-
l(!0),
|
|
3053
|
-
const
|
|
3054
|
-
x.current =
|
|
3052
|
+
l(!0), p(null), v(null);
|
|
3053
|
+
const E = new AbortController();
|
|
3054
|
+
x.current = E;
|
|
3055
3055
|
let j = null, C = !1;
|
|
3056
3056
|
return A.current = {
|
|
3057
|
-
threadId:
|
|
3057
|
+
threadId: k.threadId ?? void 0,
|
|
3058
3058
|
runId: void 0,
|
|
3059
3059
|
// Will be updated from headers
|
|
3060
3060
|
headers: {},
|
|
3061
3061
|
isStreaming: !0
|
|
3062
3062
|
}, (async () => {
|
|
3063
|
-
var O, F,
|
|
3063
|
+
var O, F, P, B, z, J;
|
|
3064
3064
|
try {
|
|
3065
|
-
let
|
|
3065
|
+
let U = {};
|
|
3066
3066
|
try {
|
|
3067
3067
|
if (r)
|
|
3068
|
-
|
|
3068
|
+
U = { Authorization: `Bearer ${r}` };
|
|
3069
3069
|
else if (typeof window < "u") {
|
|
3070
|
-
const te = window.__AUTH_TOKEN__, ke = ((O = window.localStorage) == null ? void 0 : O.getItem(
|
|
3070
|
+
const te = window.__AUTH_TOKEN__, ke = ((O = window.localStorage) == null ? void 0 : O.getItem(ze.authToken)) || null;
|
|
3071
3071
|
let Q = null;
|
|
3072
3072
|
try {
|
|
3073
|
-
const ge = (F = window.localStorage) == null ? void 0 : F.getItem(
|
|
3074
|
-
ge && (Q = ((
|
|
3073
|
+
const ge = (F = window.localStorage) == null ? void 0 : F.getItem(ze.chatSettings);
|
|
3074
|
+
ge && (Q = ((P = JSON.parse(ge)) == null ? void 0 : P.apiKey) || null);
|
|
3075
3075
|
} catch {
|
|
3076
3076
|
}
|
|
3077
3077
|
const Z = te || ke || Q || null;
|
|
3078
|
-
Z && (
|
|
3078
|
+
Z && (U = { Authorization: `Bearer ${Z}` });
|
|
3079
3079
|
}
|
|
3080
3080
|
} catch {
|
|
3081
3081
|
}
|
|
3082
3082
|
console.debug("[use-chat] POST", t + n);
|
|
3083
|
-
let
|
|
3083
|
+
let R = {};
|
|
3084
3084
|
if (typeof window < "u")
|
|
3085
3085
|
try {
|
|
3086
|
-
const
|
|
3087
|
-
|
|
3086
|
+
const H = (B = window.localStorage) == null ? void 0 : B.getItem(ze.authSessionId);
|
|
3087
|
+
H && (R = { "X-Session-Id": H });
|
|
3088
3088
|
} catch {
|
|
3089
3089
|
}
|
|
3090
|
-
const
|
|
3091
|
-
...
|
|
3092
|
-
...
|
|
3093
|
-
...
|
|
3090
|
+
const q = {
|
|
3091
|
+
...U,
|
|
3092
|
+
...R,
|
|
3093
|
+
...s.current
|
|
3094
3094
|
}, y = {
|
|
3095
3095
|
"Content-Type": "application/json",
|
|
3096
3096
|
Accept: "text/event-stream",
|
|
3097
|
-
...
|
|
3098
|
-
},
|
|
3097
|
+
...q
|
|
3098
|
+
}, L = await fetch(t + n, {
|
|
3099
3099
|
method: "POST",
|
|
3100
3100
|
headers: y,
|
|
3101
|
-
body: JSON.stringify(
|
|
3102
|
-
signal:
|
|
3101
|
+
body: JSON.stringify(k),
|
|
3102
|
+
signal: E.signal,
|
|
3103
3103
|
credentials: a
|
|
3104
3104
|
});
|
|
3105
|
-
if (A.current && (A.current.headers =
|
|
3106
|
-
const
|
|
3105
|
+
if (A.current && (A.current.headers = q), !L.ok || !L.body) {
|
|
3106
|
+
const H = await L.text().catch(() => "");
|
|
3107
3107
|
console.debug(
|
|
3108
3108
|
"[use-chat] non-OK response",
|
|
3109
|
-
|
|
3110
|
-
|
|
3109
|
+
L.status,
|
|
3110
|
+
H == null ? void 0 : H.slice(0, 500)
|
|
3111
3111
|
);
|
|
3112
|
-
const te = `stream ${
|
|
3113
|
-
throw te && (
|
|
3112
|
+
const te = `stream ${L.status}${H ? ": " + H : ""}`;
|
|
3113
|
+
throw te && (p(te), j = "error"), new Error(te);
|
|
3114
3114
|
}
|
|
3115
3115
|
I(!0);
|
|
3116
|
-
const S =
|
|
3117
|
-
let
|
|
3116
|
+
const S = L.body.getReader(), W = new TextDecoder();
|
|
3117
|
+
let K = "", V = 0, ee = Date.now();
|
|
3118
3118
|
const re = setInterval(() => {
|
|
3119
|
-
Date.now() - ee > 18e5 && (
|
|
3120
|
-
}, 5e3),
|
|
3119
|
+
Date.now() - ee > 18e5 && (p("Stream idle timeout"), j = "error", E.abort());
|
|
3120
|
+
}, 5e3), de = 1024 * 1024;
|
|
3121
3121
|
try {
|
|
3122
|
-
const
|
|
3122
|
+
const H = L.headers.get("X-Thread-Id") || L.headers.get("x-thread-id"), te = L.headers.get("X-Run-Id") || L.headers.get("x-run-id");
|
|
3123
3123
|
for (A.current && (A.current = {
|
|
3124
3124
|
...A.current,
|
|
3125
|
-
threadId:
|
|
3125
|
+
threadId: H ?? A.current.threadId,
|
|
3126
3126
|
runId: te ?? A.current.runId
|
|
3127
3127
|
}); ; ) {
|
|
3128
3128
|
const { value: ke, done: Q } = await S.read();
|
|
3129
3129
|
if (Q) break;
|
|
3130
|
-
|
|
3130
|
+
K += W.decode(ke, { stream: !0 }), K.length > de && (K = "", console.warn("Stream buffer reset: exceeded 1MB"));
|
|
3131
3131
|
let Z;
|
|
3132
|
-
for (; (Z =
|
|
3132
|
+
for (; (Z = K.indexOf(`
|
|
3133
3133
|
|
|
3134
3134
|
`)) >= 0; ) {
|
|
3135
|
-
const ge =
|
|
3136
|
-
|
|
3137
|
-
const
|
|
3135
|
+
const ge = K.slice(0, Z);
|
|
3136
|
+
K = K.slice(Z + 2);
|
|
3137
|
+
const Ue = ge.split(/\r?\n/), Be = [];
|
|
3138
3138
|
let me = null;
|
|
3139
|
-
for (const he of
|
|
3139
|
+
for (const he of Ue)
|
|
3140
3140
|
if (!he.startsWith(":") && he) {
|
|
3141
3141
|
if (he.startsWith("event:")) {
|
|
3142
3142
|
const Ae = he.slice(6).trim();
|
|
@@ -3151,39 +3151,39 @@ function pr(e = {}) {
|
|
|
3151
3151
|
const ve = Be.join(`
|
|
3152
3152
|
`);
|
|
3153
3153
|
if (!ve) continue;
|
|
3154
|
-
let
|
|
3154
|
+
let oe;
|
|
3155
3155
|
try {
|
|
3156
|
-
|
|
3156
|
+
oe = JSON.parse(ve);
|
|
3157
3157
|
} catch {
|
|
3158
3158
|
console.debug("[use-chat] malformed SSE:", ve.slice(0, 200));
|
|
3159
3159
|
continue;
|
|
3160
3160
|
}
|
|
3161
|
-
|
|
3162
|
-
const Pe = cr(
|
|
3161
|
+
oe = fr(me, oe);
|
|
3162
|
+
const Pe = cr(oe) ? oe.data : oe;
|
|
3163
3163
|
if (!Pe) {
|
|
3164
|
-
console.warn("[use-chat] dropped envelope event without payload",
|
|
3164
|
+
console.warn("[use-chat] dropped envelope event without payload", oe);
|
|
3165
3165
|
continue;
|
|
3166
3166
|
}
|
|
3167
3167
|
const xe = $n(Pe);
|
|
3168
3168
|
ee = Date.now();
|
|
3169
3169
|
const ye = typeof xe.seq == "number" ? xe.seq : void 0;
|
|
3170
3170
|
if (ye !== void 0) {
|
|
3171
|
-
if (ye <=
|
|
3172
|
-
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: ye, lastProcessedSeq:
|
|
3171
|
+
if (ye <= V) {
|
|
3172
|
+
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: ye, lastProcessedSeq: V, type: xe.type });
|
|
3173
3173
|
continue;
|
|
3174
3174
|
}
|
|
3175
|
-
|
|
3175
|
+
V = ye;
|
|
3176
3176
|
}
|
|
3177
|
-
|
|
3177
|
+
d(xe);
|
|
3178
3178
|
}
|
|
3179
3179
|
}
|
|
3180
|
-
j === null && !
|
|
3181
|
-
} catch (
|
|
3182
|
-
if (
|
|
3180
|
+
j === null && !E.signal.aborted && (j = "complete");
|
|
3181
|
+
} catch (H) {
|
|
3182
|
+
if (H.name === "AbortError")
|
|
3183
3183
|
j = j ?? "aborted";
|
|
3184
3184
|
else {
|
|
3185
|
-
const te =
|
|
3186
|
-
j = "error",
|
|
3185
|
+
const te = H.message || String(H);
|
|
3186
|
+
j = "error", p(te);
|
|
3187
3187
|
}
|
|
3188
3188
|
} finally {
|
|
3189
3189
|
try {
|
|
@@ -3194,59 +3194,59 @@ function pr(e = {}) {
|
|
|
3194
3194
|
}
|
|
3195
3195
|
clearInterval(re);
|
|
3196
3196
|
}
|
|
3197
|
-
} catch (
|
|
3198
|
-
if (
|
|
3197
|
+
} catch (U) {
|
|
3198
|
+
if (U.name === "AbortError")
|
|
3199
3199
|
j = j ?? "aborted";
|
|
3200
3200
|
else {
|
|
3201
|
-
const
|
|
3202
|
-
j = "error",
|
|
3201
|
+
const R = U.message || String(U);
|
|
3202
|
+
j = "error", p(R), C || (C = !0, (J = e.onConnectionError) == null || J.call(e, R));
|
|
3203
3203
|
}
|
|
3204
3204
|
} finally {
|
|
3205
3205
|
try {
|
|
3206
3206
|
if (e.onFinish) {
|
|
3207
|
-
const
|
|
3207
|
+
const U = {
|
|
3208
3208
|
lastSeq: 0,
|
|
3209
3209
|
lastCheckpointId: null,
|
|
3210
3210
|
lastCheckpointNs: null,
|
|
3211
3211
|
lastValues: null
|
|
3212
3212
|
// Let the reducer/history hook provide the final values
|
|
3213
3213
|
};
|
|
3214
|
-
e.onFinish(
|
|
3214
|
+
e.onFinish(U);
|
|
3215
3215
|
}
|
|
3216
|
-
} catch (
|
|
3217
|
-
console.warn("[use-chat] onClosed callback failed",
|
|
3216
|
+
} catch (U) {
|
|
3217
|
+
console.warn("[use-chat] onClosed callback failed", U);
|
|
3218
3218
|
}
|
|
3219
3219
|
l(!1), I(!1), x.current = null, A.current = null;
|
|
3220
3220
|
}
|
|
3221
3221
|
})(), Promise.resolve();
|
|
3222
3222
|
},
|
|
3223
|
-
[t, n, r, e,
|
|
3223
|
+
[t, n, r, e, d]
|
|
3224
3224
|
);
|
|
3225
3225
|
return X(() => () => {
|
|
3226
|
-
var
|
|
3227
|
-
M.current = !1, (
|
|
3226
|
+
var m;
|
|
3227
|
+
M.current = !1, (m = x.current) == null || m.abort();
|
|
3228
3228
|
}, []), {
|
|
3229
3229
|
isStreaming: c,
|
|
3230
|
-
error:
|
|
3230
|
+
error: f,
|
|
3231
3231
|
assistantText: "",
|
|
3232
3232
|
// Deprecated: use messages from reducer
|
|
3233
|
-
activeMessageId:
|
|
3233
|
+
activeMessageId: u,
|
|
3234
3234
|
streamedMessages: {},
|
|
3235
3235
|
// Deprecated: use messages from reducer
|
|
3236
3236
|
lastCheckpointId: null,
|
|
3237
3237
|
// Deprecated: use checkpoint from reducer
|
|
3238
3238
|
lastSeq: 0,
|
|
3239
|
-
connected:
|
|
3239
|
+
connected: g,
|
|
3240
3240
|
stream: T,
|
|
3241
3241
|
stop: h,
|
|
3242
3242
|
clear: b,
|
|
3243
|
-
setToken:
|
|
3243
|
+
setToken: w,
|
|
3244
3244
|
values: {},
|
|
3245
3245
|
// Provide empty object for backward compatibility
|
|
3246
3246
|
interrupt: () => Promise.resolve(),
|
|
3247
3247
|
resume: () => Promise.resolve(),
|
|
3248
3248
|
goto: () => Promise.resolve(),
|
|
3249
|
-
connectionState:
|
|
3249
|
+
connectionState: f ? "error" : c ? g ? "connected" : "connecting" : "idle",
|
|
3250
3250
|
messages: [],
|
|
3251
3251
|
// useStream doesn't maintain messages, use useChatSession instead
|
|
3252
3252
|
submit: T
|
|
@@ -3257,77 +3257,77 @@ function gr({
|
|
|
3257
3257
|
initialThreadId: t = null,
|
|
3258
3258
|
onError: n,
|
|
3259
3259
|
onThreadChange: r,
|
|
3260
|
-
onCurrentThreadDeleted:
|
|
3260
|
+
onCurrentThreadDeleted: o
|
|
3261
3261
|
}) {
|
|
3262
|
-
const [
|
|
3262
|
+
const [s, a] = $([]), [i, d] = $(t), [c, l] = $(!1), [f, p] = $(null), g = G(i), I = G(/* @__PURE__ */ new Map());
|
|
3263
3263
|
X(() => {
|
|
3264
|
-
|
|
3264
|
+
g.current = i;
|
|
3265
3265
|
}, [i]), X(() => {
|
|
3266
|
-
t !== void 0 && t !==
|
|
3266
|
+
t !== void 0 && t !== g.current && d(t);
|
|
3267
3267
|
}, [t]);
|
|
3268
|
-
const
|
|
3269
|
-
l(!0),
|
|
3268
|
+
const u = _(async () => {
|
|
3269
|
+
l(!0), p(null);
|
|
3270
3270
|
try {
|
|
3271
3271
|
const b = await e.listThreads();
|
|
3272
3272
|
a(b ?? []);
|
|
3273
3273
|
} catch (b) {
|
|
3274
3274
|
const h = String(b);
|
|
3275
|
-
|
|
3275
|
+
p(h), n == null || n(h);
|
|
3276
3276
|
} finally {
|
|
3277
3277
|
l(!1);
|
|
3278
3278
|
}
|
|
3279
3279
|
}, [e, n]);
|
|
3280
3280
|
X(() => {
|
|
3281
|
-
|
|
3282
|
-
}, [
|
|
3281
|
+
u();
|
|
3282
|
+
}, [u]), X(() => {
|
|
3283
3283
|
r == null || r(i);
|
|
3284
3284
|
}, [i, r]);
|
|
3285
3285
|
const v = _(
|
|
3286
3286
|
async (b, h) => {
|
|
3287
3287
|
try {
|
|
3288
|
-
const T = h && typeof h == "object" ? { id: h.id, name: h.name ?? "" } : void 0,
|
|
3289
|
-
return
|
|
3288
|
+
const T = h && typeof h == "object" ? { id: h.id, name: h.name ?? "" } : void 0, m = await e.createThread(b, T);
|
|
3289
|
+
return d(m.threadId), await u(), m.threadId;
|
|
3290
3290
|
} catch (T) {
|
|
3291
|
-
const
|
|
3292
|
-
return n == null || n(
|
|
3291
|
+
const m = String(T);
|
|
3292
|
+
return n == null || n(m), null;
|
|
3293
3293
|
}
|
|
3294
3294
|
},
|
|
3295
|
-
[e, n,
|
|
3295
|
+
[e, n, u]
|
|
3296
3296
|
), x = _(
|
|
3297
3297
|
async (b) => {
|
|
3298
|
-
const h =
|
|
3299
|
-
a((
|
|
3298
|
+
const h = s;
|
|
3299
|
+
a((m) => m.filter((k) => k.threadId !== b));
|
|
3300
3300
|
const T = new AbortController();
|
|
3301
3301
|
I.current.set(b, T);
|
|
3302
3302
|
try {
|
|
3303
|
-
await e.deleteThread(b),
|
|
3304
|
-
} catch (
|
|
3303
|
+
await e.deleteThread(b), g.current === b && (d(null), o == null || o());
|
|
3304
|
+
} catch (m) {
|
|
3305
3305
|
a(h);
|
|
3306
|
-
const
|
|
3307
|
-
n == null || n(
|
|
3306
|
+
const k = String(m);
|
|
3307
|
+
n == null || n(k);
|
|
3308
3308
|
} finally {
|
|
3309
3309
|
I.current.delete(b);
|
|
3310
3310
|
}
|
|
3311
3311
|
},
|
|
3312
|
-
[e,
|
|
3312
|
+
[e, o, n, s]
|
|
3313
3313
|
), M = _(
|
|
3314
3314
|
async (b, h) => {
|
|
3315
3315
|
try {
|
|
3316
|
-
await e.updateThread(b, h), await
|
|
3316
|
+
await e.updateThread(b, h), await u();
|
|
3317
3317
|
} catch (T) {
|
|
3318
3318
|
n == null || n(String(T));
|
|
3319
3319
|
}
|
|
3320
3320
|
},
|
|
3321
|
-
[e, n,
|
|
3321
|
+
[e, n, u]
|
|
3322
3322
|
), A = Y(
|
|
3323
3323
|
() => ({
|
|
3324
3324
|
createThread: v,
|
|
3325
3325
|
deleteThread: x,
|
|
3326
3326
|
renameThread: M,
|
|
3327
|
-
refreshThreads:
|
|
3327
|
+
refreshThreads: u
|
|
3328
3328
|
}),
|
|
3329
|
-
[v, x, M,
|
|
3330
|
-
),
|
|
3329
|
+
[v, x, M, u]
|
|
3330
|
+
), w = _((b) => {
|
|
3331
3331
|
if (!(b != null && b.threadId)) return;
|
|
3332
3332
|
const h = {
|
|
3333
3333
|
threadId: b.threadId,
|
|
@@ -3338,75 +3338,75 @@ function gr({
|
|
|
3338
3338
|
messageCount: b.messageCount ?? 1
|
|
3339
3339
|
};
|
|
3340
3340
|
a((T) => {
|
|
3341
|
-
let
|
|
3342
|
-
const
|
|
3343
|
-
...
|
|
3344
|
-
title: h.title ??
|
|
3345
|
-
project: h.project ??
|
|
3346
|
-
updatedAt: h.updatedAt ??
|
|
3347
|
-
messageCount: h.messageCount ??
|
|
3348
|
-
}) :
|
|
3349
|
-
return
|
|
3341
|
+
let m = !1;
|
|
3342
|
+
const k = T.map((E) => E.threadId === h.threadId ? (m = !0, console.debug("[useThreadsState] thread_info: updating existing thread", h.threadId), {
|
|
3343
|
+
...E,
|
|
3344
|
+
title: h.title ?? E.title,
|
|
3345
|
+
project: h.project ?? E.project,
|
|
3346
|
+
updatedAt: h.updatedAt ?? E.updatedAt,
|
|
3347
|
+
messageCount: h.messageCount ?? E.messageCount
|
|
3348
|
+
}) : E);
|
|
3349
|
+
return m ? k : (console.debug("[useThreadsState] thread_info: adding thread to list", h.threadId), [h, ...T]);
|
|
3350
3350
|
});
|
|
3351
3351
|
}, []);
|
|
3352
3352
|
return {
|
|
3353
|
-
threads:
|
|
3353
|
+
threads: s,
|
|
3354
3354
|
currentThreadId: i,
|
|
3355
|
-
currentThreadIdRef:
|
|
3356
|
-
setCurrentThreadId:
|
|
3355
|
+
currentThreadIdRef: g,
|
|
3356
|
+
setCurrentThreadId: d,
|
|
3357
3357
|
isLoadingThreads: c,
|
|
3358
|
-
threadsError:
|
|
3358
|
+
threadsError: f,
|
|
3359
3359
|
actions: A,
|
|
3360
|
-
addThreadFromEvent:
|
|
3360
|
+
addThreadFromEvent: w
|
|
3361
3361
|
};
|
|
3362
3362
|
}
|
|
3363
|
-
const
|
|
3363
|
+
const Ut = Ce(null);
|
|
3364
3364
|
function mr({
|
|
3365
3365
|
children: e,
|
|
3366
3366
|
initialThreadId: t = null,
|
|
3367
3367
|
onError: n,
|
|
3368
3368
|
onThreadChange: r
|
|
3369
3369
|
}) {
|
|
3370
|
-
const { chatApi:
|
|
3371
|
-
threads:
|
|
3370
|
+
const { chatApi: o } = Me(), {
|
|
3371
|
+
threads: s,
|
|
3372
3372
|
currentThreadId: a,
|
|
3373
3373
|
setCurrentThreadId: i,
|
|
3374
|
-
currentThreadIdRef:
|
|
3374
|
+
currentThreadIdRef: d,
|
|
3375
3375
|
isLoadingThreads: c,
|
|
3376
3376
|
threadsError: l,
|
|
3377
|
-
actions:
|
|
3378
|
-
addThreadFromEvent:
|
|
3377
|
+
actions: f,
|
|
3378
|
+
addThreadFromEvent: p
|
|
3379
3379
|
} = gr({
|
|
3380
|
-
api:
|
|
3380
|
+
api: o,
|
|
3381
3381
|
initialThreadId: t,
|
|
3382
3382
|
onError: n,
|
|
3383
3383
|
onThreadChange: r
|
|
3384
|
-
}),
|
|
3384
|
+
}), g = Y(
|
|
3385
3385
|
() => ({
|
|
3386
|
-
threads:
|
|
3386
|
+
threads: s,
|
|
3387
3387
|
currentThreadId: a,
|
|
3388
3388
|
setCurrentThreadId: i,
|
|
3389
|
-
currentThreadIdRef:
|
|
3389
|
+
currentThreadIdRef: d,
|
|
3390
3390
|
isLoading: c,
|
|
3391
3391
|
error: l,
|
|
3392
|
-
actions:
|
|
3393
|
-
addThreadFromEvent:
|
|
3392
|
+
actions: f,
|
|
3393
|
+
addThreadFromEvent: p
|
|
3394
3394
|
}),
|
|
3395
3395
|
[
|
|
3396
|
-
|
|
3396
|
+
s,
|
|
3397
3397
|
a,
|
|
3398
3398
|
i,
|
|
3399
|
-
|
|
3399
|
+
d,
|
|
3400
3400
|
c,
|
|
3401
3401
|
l,
|
|
3402
|
-
|
|
3403
|
-
|
|
3402
|
+
f,
|
|
3403
|
+
p
|
|
3404
3404
|
]
|
|
3405
3405
|
);
|
|
3406
|
-
return /* @__PURE__ */ ie(
|
|
3406
|
+
return /* @__PURE__ */ ie(Ut.Provider, { value: g, children: e });
|
|
3407
3407
|
}
|
|
3408
|
-
function
|
|
3409
|
-
const t =
|
|
3408
|
+
function ot(e) {
|
|
3409
|
+
const t = je(Ut);
|
|
3410
3410
|
if (!t && !(e != null && e.optional)) throw new Error("useThreads must be used within a ThreadsProvider");
|
|
3411
3411
|
return t;
|
|
3412
3412
|
}
|
|
@@ -3438,8 +3438,8 @@ function yr(e, t) {
|
|
|
3438
3438
|
}
|
|
3439
3439
|
function hr(e, t, n) {
|
|
3440
3440
|
return e.find((r) => {
|
|
3441
|
-
const
|
|
3442
|
-
return !!((
|
|
3441
|
+
const o = Bt(r);
|
|
3442
|
+
return !!((o == null ? void 0 : o.id) === t || n && r.toolCallId === n);
|
|
3443
3443
|
}) ?? null;
|
|
3444
3444
|
}
|
|
3445
3445
|
function Oe(e) {
|
|
@@ -3452,8 +3452,8 @@ function Ft(e, t, n) {
|
|
|
3452
3452
|
function br(e, t, n) {
|
|
3453
3453
|
for (let r = e.length - 1; r >= 0; r--)
|
|
3454
3454
|
if (e[r].role === "assistant") {
|
|
3455
|
-
const
|
|
3456
|
-
return Ft(e, r,
|
|
3455
|
+
const s = { ...e[r], checkpointId: t, checkpointNs: n ?? void 0 };
|
|
3456
|
+
return Ft(e, r, s);
|
|
3457
3457
|
}
|
|
3458
3458
|
return e;
|
|
3459
3459
|
}
|
|
@@ -3484,18 +3484,20 @@ function wr(e, t) {
|
|
|
3484
3484
|
messages: Oe(((n = t.payload) == null ? void 0 : n.messages) ?? [])
|
|
3485
3485
|
};
|
|
3486
3486
|
case "user_message": {
|
|
3487
|
-
const { message: r, editingMessageId:
|
|
3488
|
-
if (
|
|
3489
|
-
const
|
|
3490
|
-
if (
|
|
3487
|
+
const { message: r, editingMessageId: o } = t.payload;
|
|
3488
|
+
if (o) {
|
|
3489
|
+
const s = e.messages.findIndex((a) => (a.id || a.messageId) === o);
|
|
3490
|
+
if (s !== -1) {
|
|
3491
|
+
const a = { ...r, id: o };
|
|
3491
3492
|
return {
|
|
3492
3493
|
...e,
|
|
3493
3494
|
status: "streaming",
|
|
3494
|
-
messages: [...e.messages.slice(0,
|
|
3495
|
+
messages: [...e.messages.slice(0, s), a],
|
|
3495
3496
|
assemblingId: null,
|
|
3496
3497
|
lastCheckpointId: null,
|
|
3497
3498
|
error: null
|
|
3498
3499
|
};
|
|
3500
|
+
}
|
|
3499
3501
|
}
|
|
3500
3502
|
return {
|
|
3501
3503
|
...e,
|
|
@@ -3507,7 +3509,7 @@ function wr(e, t) {
|
|
|
3507
3509
|
};
|
|
3508
3510
|
}
|
|
3509
3511
|
case "seed": {
|
|
3510
|
-
const r = Oe(t.payload.messages),
|
|
3512
|
+
const r = Oe(t.payload.messages), o = {
|
|
3511
3513
|
...e,
|
|
3512
3514
|
status: "idle",
|
|
3513
3515
|
messages: r,
|
|
@@ -3516,51 +3518,51 @@ function wr(e, t) {
|
|
|
3516
3518
|
taskMessagesByScope: {},
|
|
3517
3519
|
error: null
|
|
3518
3520
|
};
|
|
3519
|
-
return Object.prototype.hasOwnProperty.call(t.payload, "checkpointId") && (
|
|
3521
|
+
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;
|
|
3520
3522
|
}
|
|
3521
3523
|
case "prepend": {
|
|
3522
3524
|
const r = Oe(t.payload.messages);
|
|
3523
3525
|
if (!r.length) return e;
|
|
3524
|
-
const
|
|
3525
|
-
return
|
|
3526
|
+
const o = new Set(e.messages.map((a) => a.id)), s = r.filter((a) => !o.has(a.id));
|
|
3527
|
+
return s.length ? { ...e, messages: [...s, ...e.messages] } : e;
|
|
3526
3528
|
}
|
|
3527
3529
|
case "event":
|
|
3528
3530
|
return pt(e, t.payload.ev);
|
|
3529
3531
|
case "batch": {
|
|
3530
3532
|
const { events: r } = t.payload;
|
|
3531
|
-
return r.length ? r.reduce((
|
|
3533
|
+
return r.length ? r.reduce((o, s) => pt(o, s), e) : e;
|
|
3532
3534
|
}
|
|
3533
3535
|
default:
|
|
3534
3536
|
return e;
|
|
3535
3537
|
}
|
|
3536
3538
|
}
|
|
3537
3539
|
function kr(e = []) {
|
|
3538
|
-
const [t, n] = Wt(wr, { ...Ot, messages: e }), r =
|
|
3539
|
-
|
|
3540
|
+
const [t, n] = Wt(wr, { ...Ot, messages: e }), r = G([]), o = G(null), s = _(() => {
|
|
3541
|
+
o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), o.current = null;
|
|
3540
3542
|
const c = r.current;
|
|
3541
3543
|
c.length && (r.current = [], n({ type: "batch", payload: { events: c } }));
|
|
3542
3544
|
}, []), a = _(() => {
|
|
3543
|
-
typeof window < "u" && typeof window.requestAnimationFrame == "function" ?
|
|
3544
|
-
}, [
|
|
3545
|
+
typeof window < "u" && typeof window.requestAnimationFrame == "function" ? o.current === null && (o.current = window.requestAnimationFrame(() => s())) : setTimeout(s, 8);
|
|
3546
|
+
}, [s]), i = _((c) => {
|
|
3545
3547
|
r.current.push(c), a();
|
|
3546
|
-
}, [a]),
|
|
3548
|
+
}, [a]), d = Y(() => ({
|
|
3547
3549
|
setStatus: (c, l) => n({ type: "status", payload: { status: c, error: l } }),
|
|
3548
3550
|
reset: (c) => n({ type: "reset", payload: { messages: c } }),
|
|
3549
3551
|
seed: (c, l) => n({ type: "seed", payload: { messages: c, ...l ?? {} } }),
|
|
3550
3552
|
pushUser: (c, l) => n({ type: "user_message", payload: { message: c, editingMessageId: l } }),
|
|
3551
3553
|
onEvent: i
|
|
3552
3554
|
}), [i]);
|
|
3553
|
-
return { state: t, dispatch: n, ...
|
|
3555
|
+
return { state: t, dispatch: n, ...d };
|
|
3554
3556
|
}
|
|
3555
3557
|
function pt(e, t) {
|
|
3556
|
-
const n = t.origin, r = t.scope,
|
|
3558
|
+
const n = t.origin, r = t.scope, o = n === "task" || typeof r == "string" && r.startsWith("tools:");
|
|
3557
3559
|
if (t.type === "checkpoint") {
|
|
3558
|
-
const
|
|
3559
|
-
return { ...e, lastCheckpointId: t.checkpointId, lastCheckpointNs:
|
|
3560
|
+
const s = t.checkpointNs ?? e.lastCheckpointNs ?? null, a = br(e.messages, t.checkpointId, s);
|
|
3561
|
+
return { ...e, lastCheckpointId: t.checkpointId, lastCheckpointNs: s, messages: a };
|
|
3560
3562
|
}
|
|
3561
3563
|
if (t.type === "status") {
|
|
3562
|
-
const
|
|
3563
|
-
return { ...e, status:
|
|
3564
|
+
const s = t.status === "completed" || t.status === "error" ? "idle" : t.status === "interrupted" ? "awaiting_input" : e.status;
|
|
3565
|
+
return { ...e, status: s };
|
|
3564
3566
|
}
|
|
3565
3567
|
if (t.type === "interrupt")
|
|
3566
3568
|
return {
|
|
@@ -3574,53 +3576,68 @@ function pt(e, t) {
|
|
|
3574
3576
|
}
|
|
3575
3577
|
};
|
|
3576
3578
|
if (t.type === "error") {
|
|
3577
|
-
const
|
|
3579
|
+
const s = {
|
|
3578
3580
|
id: `err-${Date.now()}`,
|
|
3579
3581
|
role: "system",
|
|
3580
3582
|
content: [{ type: "text", text: `Error: ${t.message}` }],
|
|
3581
3583
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3582
3584
|
};
|
|
3583
|
-
return { ...e, status: "error", error: t.message, messages: [...e.messages,
|
|
3585
|
+
return { ...e, status: "error", error: t.message, messages: [...e.messages, s] };
|
|
3584
3586
|
}
|
|
3585
|
-
if (t.type === "values"
|
|
3586
|
-
const
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3587
|
+
if (t.type === "values") {
|
|
3588
|
+
const s = t, a = s.values && typeof s.values == "object" ? { ...s.values } : {}, i = Array.isArray(s.messages) ? s.messages : Array.isArray(a.messages) ? a.messages : [];
|
|
3589
|
+
if (!i.length && Object.keys(a).length === 0)
|
|
3590
|
+
return e;
|
|
3591
|
+
const d = Oe(i);
|
|
3592
|
+
delete a.messages;
|
|
3593
|
+
let c = e.lastCheckpointId, l = e.lastCheckpointNs;
|
|
3594
|
+
const f = s.config || s.checkpoint, p = (f == null ? void 0 : f.configurable) || f;
|
|
3595
|
+
if ((p != null && p.checkpoint_id || p != null && p.checkpointId) && (c = p.checkpoint_id || p.checkpointId, l = p.checkpoint_ns || p.checkpointNs || null), !c) {
|
|
3596
|
+
for (let u = d.length - 1; u >= 0; u--)
|
|
3597
|
+
if (d[u].checkpointId) {
|
|
3598
|
+
c = d[u].checkpointId, l = d[u].checkpointNs ?? null;
|
|
3599
|
+
break;
|
|
3600
|
+
}
|
|
3601
|
+
}
|
|
3602
|
+
const g = s.interrupts || a.__interrupt__ || a.interrupts, I = Array.isArray(g) && g.length > 0 ? {
|
|
3603
|
+
id: g[0].id || "native-interrupt",
|
|
3604
|
+
value: g[0].value || g[0],
|
|
3605
|
+
alternatives: g[0].alternatives
|
|
3590
3606
|
} : null;
|
|
3591
|
-
if (
|
|
3592
|
-
const
|
|
3607
|
+
if (o) {
|
|
3608
|
+
const u = typeof r == "string" && r.length > 0 ? r : "task";
|
|
3593
3609
|
return {
|
|
3594
3610
|
...e,
|
|
3595
|
-
taskMessagesByScope: { ...e.taskMessagesByScope, [
|
|
3611
|
+
taskMessagesByScope: { ...e.taskMessagesByScope, [u]: d },
|
|
3596
3612
|
assemblingId: null
|
|
3597
|
-
// Clear streaming state when finalized
|
|
3598
3613
|
};
|
|
3599
3614
|
}
|
|
3600
3615
|
return {
|
|
3601
3616
|
...e,
|
|
3602
|
-
status:
|
|
3603
|
-
messages:
|
|
3617
|
+
status: I ? "awaiting_input" : e.status === "streaming" ? "idle" : e.status,
|
|
3618
|
+
messages: d,
|
|
3604
3619
|
assemblingId: null,
|
|
3605
|
-
|
|
3606
|
-
|
|
3620
|
+
lastCheckpointId: c,
|
|
3621
|
+
lastCheckpointNs: l,
|
|
3622
|
+
pendingInterrupt: I,
|
|
3623
|
+
values: { ...e.values, ...a }
|
|
3607
3624
|
};
|
|
3608
3625
|
}
|
|
3609
3626
|
if (t.type === "messages/metadata") {
|
|
3610
|
-
const
|
|
3611
|
-
return a && typeof a == "object" && Object.entries(a).forEach(([i,
|
|
3612
|
-
const c =
|
|
3627
|
+
const s = { ...e.messagesStreamMeta ?? {} }, a = t.metadata;
|
|
3628
|
+
return a && typeof a == "object" && Object.entries(a).forEach(([i, d]) => {
|
|
3629
|
+
const c = d == null ? void 0 : d.metadata;
|
|
3613
3630
|
if (!c || typeof c != "object") return;
|
|
3614
|
-
const l =
|
|
3615
|
-
|
|
3631
|
+
const l = s[i] ?? {};
|
|
3632
|
+
s[i] = {
|
|
3616
3633
|
...l,
|
|
3617
3634
|
lastSeq: t.seq ?? l.lastSeq ?? null,
|
|
3618
3635
|
metadata: { ...l.metadata ?? {}, ...c }
|
|
3619
3636
|
};
|
|
3620
|
-
}), { ...e, messagesStreamMeta:
|
|
3637
|
+
}), { ...e, messagesStreamMeta: s };
|
|
3621
3638
|
}
|
|
3622
3639
|
if (t.type === "messages/partial" || t.type === "message.delta") {
|
|
3623
|
-
const
|
|
3640
|
+
const s = t.type === "messages/partial" ? t : {
|
|
3624
3641
|
...t,
|
|
3625
3642
|
type: "messages/partial",
|
|
3626
3643
|
messages: t.delta ? [{
|
|
@@ -3631,65 +3648,65 @@ function pt(e, t) {
|
|
|
3631
3648
|
origin: t.origin
|
|
3632
3649
|
}] : []
|
|
3633
3650
|
};
|
|
3634
|
-
return Ir(e,
|
|
3651
|
+
return Ir(e, s, o);
|
|
3635
3652
|
}
|
|
3636
|
-
return t.type === "message.start" ? { ...e, assemblingId: t.id, status: "streaming" } : t.type === "message.end" ? { ...e, assemblingId: null } : t.type === "tool.start" ? { ...vr(e, t,
|
|
3653
|
+
return t.type === "message.start" ? { ...e, assemblingId: t.id, status: "streaming" } : t.type === "message.end" ? { ...e, assemblingId: null } : t.type === "tool.start" ? { ...vr(e, t, o), status: "streaming" } : t.type === "tool.progress" ? xr(e, t, o) : t.type === "tool.end" ? Ar(e, t, o) : t.type === "artifact.update" ? Tr(e, t) : e;
|
|
3637
3654
|
}
|
|
3638
3655
|
function Ir(e, t, n) {
|
|
3639
|
-
var
|
|
3656
|
+
var g, I, u, v, x, M, A;
|
|
3640
3657
|
const r = t.messages;
|
|
3641
3658
|
if (!r.length)
|
|
3642
3659
|
return console.warn("[messagesReducer] Dropping messages/partial event without messages[]", t), e;
|
|
3643
|
-
const
|
|
3644
|
-
if (!
|
|
3645
|
-
const
|
|
3646
|
-
let
|
|
3647
|
-
const
|
|
3660
|
+
const o = r.find((w) => w.type === "ai" || w.type === "assistant" || w.role === "assistant");
|
|
3661
|
+
if (!o) return e;
|
|
3662
|
+
const s = o.id, a = o.content ?? "", i = typeof a == "string" ? [{ type: "text", text: a }] : Array.isArray(a) ? a.map((w) => typeof w == "string" ? { type: "text", text: w } : (w == null ? void 0 : w.type) === "text" ? { type: "text", text: typeof w.text == "string" ? w.text : w.content ?? "" } : ((w == null ? void 0 : w.type) === "reasoning", w)) : [], d = i.filter((w) => w.type === "text").map((w) => w.text).join(""), c = e.assemblingId !== s, l = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3663
|
+
let f = n ? [...e.taskMessagesByScope[l] || []] : [...e.messages];
|
|
3664
|
+
const p = (I = (g = e.messagesStreamMeta) == null ? void 0 : g[s]) == null ? void 0 : I.metadata;
|
|
3648
3665
|
if (c) {
|
|
3649
|
-
const
|
|
3650
|
-
...
|
|
3666
|
+
const w = nt({
|
|
3667
|
+
...o,
|
|
3651
3668
|
role: "assistant",
|
|
3652
3669
|
content: i,
|
|
3653
3670
|
scope: t.scope,
|
|
3654
3671
|
origin: t.origin,
|
|
3655
|
-
responseMetadata: { ...
|
|
3672
|
+
responseMetadata: { ...p, ...o.responseMetadata ?? {} }
|
|
3656
3673
|
});
|
|
3657
|
-
|
|
3674
|
+
w && f.push(w);
|
|
3658
3675
|
} else {
|
|
3659
|
-
const
|
|
3660
|
-
if (
|
|
3661
|
-
const b =
|
|
3662
|
-
|
|
3676
|
+
const w = f.findIndex((b) => b.id === s);
|
|
3677
|
+
if (w !== -1) {
|
|
3678
|
+
const b = f[w];
|
|
3679
|
+
f[w] = {
|
|
3663
3680
|
...b,
|
|
3664
3681
|
content: i,
|
|
3665
3682
|
scope: t.scope ?? b.scope,
|
|
3666
3683
|
origin: t.origin ?? b.origin,
|
|
3667
|
-
responseMetadata: { ...
|
|
3684
|
+
responseMetadata: { ...p, ...b.responseMetadata, ...o.responseMetadata ?? {} }
|
|
3668
3685
|
};
|
|
3669
3686
|
}
|
|
3670
3687
|
}
|
|
3671
3688
|
return {
|
|
3672
3689
|
...e,
|
|
3673
3690
|
status: "streaming",
|
|
3674
|
-
messages: n ? e.messages :
|
|
3675
|
-
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [l]:
|
|
3676
|
-
assemblingId:
|
|
3691
|
+
messages: n ? e.messages : f,
|
|
3692
|
+
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [l]: f } : e.taskMessagesByScope,
|
|
3693
|
+
assemblingId: s,
|
|
3677
3694
|
messagesStreamMeta: {
|
|
3678
3695
|
...e.messagesStreamMeta ?? {},
|
|
3679
|
-
[
|
|
3680
|
-
...((
|
|
3681
|
-
lastSeq: t.seq ?? ((x = (v = e.messagesStreamMeta) == null ? void 0 : v[
|
|
3682
|
-
lastText:
|
|
3696
|
+
[s]: {
|
|
3697
|
+
...((u = e.messagesStreamMeta) == null ? void 0 : u[s]) ?? {},
|
|
3698
|
+
lastSeq: t.seq ?? ((x = (v = e.messagesStreamMeta) == null ? void 0 : v[s]) == null ? void 0 : x.lastSeq) ?? null,
|
|
3699
|
+
lastText: d || (((A = (M = e.messagesStreamMeta) == null ? void 0 : M[s]) == null ? void 0 : A.lastText) ?? "")
|
|
3683
3700
|
}
|
|
3684
3701
|
}
|
|
3685
3702
|
};
|
|
3686
3703
|
}
|
|
3687
|
-
function
|
|
3704
|
+
function st(e, t) {
|
|
3688
3705
|
var n;
|
|
3689
3706
|
if (!t) return -1;
|
|
3690
3707
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
3691
|
-
const
|
|
3692
|
-
if (
|
|
3708
|
+
const o = e[r];
|
|
3709
|
+
if (o.role === "assistant" && ((n = o.toolCalls) != null && n.some((s) => s.id === t)))
|
|
3693
3710
|
return r;
|
|
3694
3711
|
}
|
|
3695
3712
|
return -1;
|
|
@@ -3697,16 +3714,16 @@ function ot(e, t) {
|
|
|
3697
3714
|
function vr(e, t, n) {
|
|
3698
3715
|
const r = t.id || t.callId;
|
|
3699
3716
|
if (!r) return e;
|
|
3700
|
-
const
|
|
3701
|
-
let i = n ? [...e.taskMessagesByScope[a] || []] : [...e.messages],
|
|
3702
|
-
if (
|
|
3717
|
+
const o = t.name || "tool", s = `Starting ${o}...`, a = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3718
|
+
let i = n ? [...e.taskMessagesByScope[a] || []] : [...e.messages], d = st(i, r);
|
|
3719
|
+
if (d === -1) {
|
|
3703
3720
|
for (let c = i.length - 1; c >= 0; c--)
|
|
3704
3721
|
if (i[c].role === "assistant") {
|
|
3705
|
-
|
|
3722
|
+
d = c;
|
|
3706
3723
|
break;
|
|
3707
3724
|
}
|
|
3708
3725
|
}
|
|
3709
|
-
if (
|
|
3726
|
+
if (d === -1) {
|
|
3710
3727
|
const c = {
|
|
3711
3728
|
id: `assistant-${r}`,
|
|
3712
3729
|
role: "assistant",
|
|
@@ -3716,17 +3733,17 @@ function vr(e, t, n) {
|
|
|
3716
3733
|
scope: t.scope,
|
|
3717
3734
|
origin: t.origin
|
|
3718
3735
|
};
|
|
3719
|
-
i.push(c),
|
|
3736
|
+
i.push(c), d = i.length - 1;
|
|
3720
3737
|
}
|
|
3721
|
-
if (
|
|
3722
|
-
const c = i[
|
|
3723
|
-
|
|
3738
|
+
if (d !== -1) {
|
|
3739
|
+
const c = i[d], l = [...c.toolCalls || []], f = l.findIndex((p) => p.id === r);
|
|
3740
|
+
f >= 0 ? l[f] = { ...l[f], status: "running", content: s } : l.push({
|
|
3724
3741
|
id: r,
|
|
3725
|
-
name:
|
|
3742
|
+
name: o,
|
|
3726
3743
|
args: t.args || {},
|
|
3727
3744
|
status: "running",
|
|
3728
|
-
content:
|
|
3729
|
-
}), i[
|
|
3745
|
+
content: s
|
|
3746
|
+
}), i[d] = {
|
|
3730
3747
|
...c,
|
|
3731
3748
|
toolCalls: l,
|
|
3732
3749
|
scope: t.scope ?? c.scope,
|
|
@@ -3742,14 +3759,14 @@ function vr(e, t, n) {
|
|
|
3742
3759
|
function xr(e, t, n) {
|
|
3743
3760
|
const r = t.id;
|
|
3744
3761
|
if (!r) return e;
|
|
3745
|
-
const
|
|
3746
|
-
let
|
|
3747
|
-
const a =
|
|
3762
|
+
const o = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3763
|
+
let s = n ? [...e.taskMessagesByScope[o] || []] : [...e.messages];
|
|
3764
|
+
const a = st(s, r);
|
|
3748
3765
|
if (a !== -1) {
|
|
3749
|
-
const i =
|
|
3750
|
-
(l) => l.id === r ? { ...l, content: typeof
|
|
3766
|
+
const i = s[a], d = ce(t.content), c = (i.toolCalls || []).map(
|
|
3767
|
+
(l) => l.id === r ? { ...l, content: typeof d == "string" ? d : l.content } : l
|
|
3751
3768
|
);
|
|
3752
|
-
|
|
3769
|
+
s[a] = {
|
|
3753
3770
|
...i,
|
|
3754
3771
|
toolCalls: c,
|
|
3755
3772
|
scope: t.scope ?? i.scope,
|
|
@@ -3758,33 +3775,33 @@ function xr(e, t, n) {
|
|
|
3758
3775
|
}
|
|
3759
3776
|
return {
|
|
3760
3777
|
...e,
|
|
3761
|
-
messages: n ? e.messages :
|
|
3762
|
-
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [
|
|
3778
|
+
messages: n ? e.messages : s,
|
|
3779
|
+
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [o]: s } : e.taskMessagesByScope
|
|
3763
3780
|
};
|
|
3764
3781
|
}
|
|
3765
3782
|
function Ar(e, t, n) {
|
|
3766
3783
|
const r = t.id;
|
|
3767
3784
|
if (!r) return e;
|
|
3768
|
-
const
|
|
3769
|
-
let
|
|
3770
|
-
const a =
|
|
3785
|
+
const o = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3786
|
+
let s = n ? [...e.taskMessagesByScope[o] || []] : [...e.messages];
|
|
3787
|
+
const a = st(s, r), i = ce(t.content ?? t.error);
|
|
3771
3788
|
if (a !== -1) {
|
|
3772
|
-
const c =
|
|
3773
|
-
(
|
|
3774
|
-
...
|
|
3789
|
+
const c = s[a], l = (c.toolCalls || []).map(
|
|
3790
|
+
(f) => f.id === r ? {
|
|
3791
|
+
...f,
|
|
3775
3792
|
status: t.error ? "failed" : "completed",
|
|
3776
|
-
content: typeof i == "string" ? i :
|
|
3793
|
+
content: typeof i == "string" ? i : f.content,
|
|
3777
3794
|
artifact: t.artifact
|
|
3778
|
-
} :
|
|
3795
|
+
} : f
|
|
3779
3796
|
);
|
|
3780
|
-
|
|
3797
|
+
s[a] = {
|
|
3781
3798
|
...c,
|
|
3782
3799
|
toolCalls: l,
|
|
3783
3800
|
scope: t.scope ?? c.scope,
|
|
3784
3801
|
origin: t.origin ?? c.origin
|
|
3785
3802
|
};
|
|
3786
3803
|
}
|
|
3787
|
-
const
|
|
3804
|
+
const d = {
|
|
3788
3805
|
id: `tool-${r}`,
|
|
3789
3806
|
role: "tool",
|
|
3790
3807
|
name: t.name,
|
|
@@ -3795,21 +3812,21 @@ function Ar(e, t, n) {
|
|
|
3795
3812
|
scope: t.scope,
|
|
3796
3813
|
origin: t.origin
|
|
3797
3814
|
};
|
|
3798
|
-
return
|
|
3815
|
+
return s.push(d), {
|
|
3799
3816
|
...e,
|
|
3800
|
-
messages: n ? e.messages :
|
|
3801
|
-
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [
|
|
3817
|
+
messages: n ? e.messages : s,
|
|
3818
|
+
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [o]: s } : e.taskMessagesByScope
|
|
3802
3819
|
};
|
|
3803
3820
|
}
|
|
3804
3821
|
function Tr(e, t) {
|
|
3805
3822
|
const n = t.artifactId, r = hr(e.messages, n, t.callId);
|
|
3806
3823
|
if (!r) return e;
|
|
3807
|
-
const
|
|
3824
|
+
const o = e.messages.indexOf(r), s = yr(r, {
|
|
3808
3825
|
status: t.status,
|
|
3809
3826
|
progress: t.progress,
|
|
3810
3827
|
error: t.error
|
|
3811
3828
|
});
|
|
3812
|
-
return t.partial_data &&
|
|
3829
|
+
return t.partial_data && s.artifact && (s.artifact = { ...s.artifact, ...t.partial_data }), { ...e, messages: Ft(e.messages, o, s) };
|
|
3813
3830
|
}
|
|
3814
3831
|
function Re(e) {
|
|
3815
3832
|
if (!(!e || typeof e != "object" || Array.isArray(e)))
|
|
@@ -3838,87 +3855,87 @@ function gt(e) {
|
|
|
3838
3855
|
return Re(t.configurable) ?? t;
|
|
3839
3856
|
}
|
|
3840
3857
|
async function Mr(e, t) {
|
|
3841
|
-
var i,
|
|
3858
|
+
var i, d;
|
|
3842
3859
|
if (!e) return e ?? null;
|
|
3843
|
-
const n = le(e), r = Array.isArray(n.checkpoints) ? n.checkpoints : n.checkpoints ? Object.values(n.checkpoints) : [],
|
|
3860
|
+
const n = le(e), r = Array.isArray(n.checkpoints) ? n.checkpoints : n.checkpoints ? Object.values(n.checkpoints) : [], o = /* @__PURE__ */ new Set();
|
|
3844
3861
|
for (const c of r) {
|
|
3845
3862
|
const l = (i = c == null ? void 0 : c.values) == null ? void 0 : i.messages;
|
|
3846
3863
|
if (Array.isArray(l))
|
|
3847
|
-
for (const
|
|
3848
|
-
const
|
|
3849
|
-
if (Array.isArray(
|
|
3850
|
-
for (const
|
|
3851
|
-
if (!
|
|
3852
|
-
const I =
|
|
3853
|
-
typeof I == "string" && I.trim() &&
|
|
3864
|
+
for (const f of l) {
|
|
3865
|
+
const p = f == null ? void 0 : f.content;
|
|
3866
|
+
if (Array.isArray(p))
|
|
3867
|
+
for (const g of p) {
|
|
3868
|
+
if (!g || typeof g != "object" || g.type !== "image_url" && g.type !== "file") continue;
|
|
3869
|
+
const I = g.fileId || g.file_id;
|
|
3870
|
+
typeof I == "string" && I.trim() && o.add(I);
|
|
3854
3871
|
}
|
|
3855
3872
|
}
|
|
3856
3873
|
}
|
|
3857
|
-
if (
|
|
3874
|
+
if (o.size === 0)
|
|
3858
3875
|
return n;
|
|
3859
|
-
const
|
|
3860
|
-
Array.from(
|
|
3876
|
+
const s = await Promise.all(
|
|
3877
|
+
Array.from(o).map(async (c) => {
|
|
3861
3878
|
try {
|
|
3862
|
-
const l = await t.getFileInfo(c),
|
|
3863
|
-
return [c,
|
|
3879
|
+
const l = await t.getFileInfo(c), f = le(l);
|
|
3880
|
+
return [c, f];
|
|
3864
3881
|
} catch {
|
|
3865
3882
|
return [c, null];
|
|
3866
3883
|
}
|
|
3867
3884
|
})
|
|
3868
|
-
), a = new Map(
|
|
3885
|
+
), a = new Map(s);
|
|
3869
3886
|
for (const c of r) {
|
|
3870
|
-
const l = (
|
|
3887
|
+
const l = (d = c == null ? void 0 : c.values) == null ? void 0 : d.messages;
|
|
3871
3888
|
if (Array.isArray(l))
|
|
3872
|
-
for (const
|
|
3873
|
-
const
|
|
3874
|
-
if (Array.isArray(
|
|
3875
|
-
for (const
|
|
3876
|
-
if (!
|
|
3877
|
-
const I =
|
|
3889
|
+
for (const f of l) {
|
|
3890
|
+
const p = f == null ? void 0 : f.content;
|
|
3891
|
+
if (Array.isArray(p))
|
|
3892
|
+
for (const g of p) {
|
|
3893
|
+
if (!g || typeof g != "object" || g.type !== "image_url" && g.type !== "file") continue;
|
|
3894
|
+
const I = g.fileId || g.file_id;
|
|
3878
3895
|
if (!I) continue;
|
|
3879
|
-
const
|
|
3880
|
-
v && (
|
|
3896
|
+
const u = a.get(I), v = (u == null ? void 0 : u.contentUrl) || (u == null ? void 0 : u.content_url);
|
|
3897
|
+
v && (g.type === "image_url" ? (g.imageUrl = g.imageUrl || {}, g.imageUrl.url = v) : g.type === "file" && (g.url = v, !g.name && (u != null && u.filename || u != null && u.name) && (g.name = (u == null ? void 0 : u.filename) || (u == null ? void 0 : u.name))));
|
|
3881
3898
|
}
|
|
3882
3899
|
}
|
|
3883
3900
|
}
|
|
3884
3901
|
return n;
|
|
3885
3902
|
}
|
|
3886
3903
|
function mt(e) {
|
|
3887
|
-
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((
|
|
3904
|
+
const r = [...(Array.isArray(e == null ? void 0 : e.checkpoints) ? (e == null ? void 0 : e.checkpoints) ?? [] : e != null && e.checkpoints ? Object.values(e.checkpoints) : []).map((s, a) => Cr(le(s), a)).filter((s) => !!s)].sort((s, a) => yt(a.createdAt) - yt(s.createdAt)), o = r[0] ?? null;
|
|
3888
3905
|
return {
|
|
3889
3906
|
threadId: (e == null ? void 0 : e.threadId) ?? "",
|
|
3890
|
-
latest:
|
|
3907
|
+
latest: o,
|
|
3891
3908
|
checkpoints: r,
|
|
3892
|
-
interrupt: (
|
|
3909
|
+
interrupt: (o == null ? void 0 : o.interrupt) ?? null
|
|
3893
3910
|
};
|
|
3894
3911
|
}
|
|
3895
3912
|
function Cr(e, t) {
|
|
3896
3913
|
var b, h;
|
|
3897
3914
|
if (!e) return null;
|
|
3898
|
-
const n = ((b = e.values) == null ? void 0 : b.activeAgent) ?? null, r = (h = e.values) == null ? void 0 : h.messages,
|
|
3915
|
+
const n = ((b = e.values) == null ? void 0 : b.activeAgent) ?? null, r = (h = e.values) == null ? void 0 : h.messages, s = (Array.isArray(r) ? r : []).map((T) => Er(T, n)).filter((T) => !!T), a = Re(e.metadata) ?? {}, i = gt(e.config), d = Re(e.parentConfig), c = gt(d), l = Fe(i, ["checkpointId"]), f = Fe(i, ["checkpointNs"]), p = Fe(c, ["checkpointId"]), g = Re(e.config), I = Array.isArray(e.tasks) ? e.tasks.map((T) => ({ ...T })) : e.tasks ?? null, u = Array.isArray(e.next) ? [...e.next] : e.next ?? null, v = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), x = {
|
|
3899
3916
|
...a,
|
|
3900
3917
|
step: Sr(a, ["step"]) ?? 0,
|
|
3901
3918
|
source: Fe(a, ["source"]) ?? null
|
|
3902
|
-
}, M =
|
|
3919
|
+
}, M = s.map((T) => ({
|
|
3903
3920
|
...T,
|
|
3904
3921
|
checkpointId: T.checkpointId ?? l ?? null,
|
|
3905
|
-
checkpointNs: T.checkpointNs ??
|
|
3906
|
-
})), A = e.values,
|
|
3922
|
+
checkpointNs: T.checkpointNs ?? f ?? null
|
|
3923
|
+
})), A = e.values, w = Array.isArray(e.interrupts) ? e.interrupts : Array.isArray(A == null ? void 0 : A.interrupts) ? A.interrupts : [];
|
|
3907
3924
|
return {
|
|
3908
3925
|
checkpointId: l ?? null,
|
|
3909
|
-
checkpointNs:
|
|
3926
|
+
checkpointNs: f ?? null,
|
|
3910
3927
|
createdAt: v,
|
|
3911
|
-
parentId:
|
|
3928
|
+
parentId: p ?? null,
|
|
3912
3929
|
messages: M,
|
|
3913
3930
|
interrupt: Pr(
|
|
3914
|
-
|
|
3931
|
+
w,
|
|
3915
3932
|
t,
|
|
3916
3933
|
l ?? null
|
|
3917
3934
|
),
|
|
3918
3935
|
metadata: x,
|
|
3919
|
-
config:
|
|
3920
|
-
parentConfig:
|
|
3921
|
-
next:
|
|
3936
|
+
config: g ?? null,
|
|
3937
|
+
parentConfig: d ?? null,
|
|
3938
|
+
next: u,
|
|
3922
3939
|
tasks: I,
|
|
3923
3940
|
values: e.values ?? {}
|
|
3924
3941
|
};
|
|
@@ -3929,15 +3946,15 @@ function Er(e, t) {
|
|
|
3929
3946
|
}
|
|
3930
3947
|
function Pr(e, t, n) {
|
|
3931
3948
|
const r = e.length;
|
|
3932
|
-
for (let
|
|
3933
|
-
const
|
|
3934
|
-
if (!
|
|
3949
|
+
for (let o = r - 1; o >= 0; o -= 1) {
|
|
3950
|
+
const s = e[o];
|
|
3951
|
+
if (!s || typeof s != "object")
|
|
3935
3952
|
continue;
|
|
3936
|
-
const a =
|
|
3953
|
+
const a = s, i = a.value ?? s;
|
|
3937
3954
|
if (i == null)
|
|
3938
3955
|
continue;
|
|
3939
3956
|
return {
|
|
3940
|
-
id: typeof a.id == "string" && a.id.trim() ? a.id : `interrupt-${n ?? t}-${
|
|
3957
|
+
id: typeof a.id == "string" && a.id.trim() ? a.id : `interrupt-${n ?? t}-${o}`,
|
|
3941
3958
|
value: i
|
|
3942
3959
|
};
|
|
3943
3960
|
}
|
|
@@ -3958,58 +3975,58 @@ function _r(e) {
|
|
|
3958
3975
|
const n = t.join(" ").replace(/\s+/g, " ").trim();
|
|
3959
3976
|
return n ? n.length > ht ? `${n.slice(0, ht - 3)}…` : n : "";
|
|
3960
3977
|
}
|
|
3961
|
-
function
|
|
3978
|
+
function Nr(e) {
|
|
3962
3979
|
return _r(e.content) || "";
|
|
3963
3980
|
}
|
|
3964
|
-
function
|
|
3965
|
-
const t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Map(),
|
|
3981
|
+
function zr(e) {
|
|
3982
|
+
const t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Map(), o = [];
|
|
3966
3983
|
for (let c = 0; c < e.length; c++) {
|
|
3967
|
-
const l = e[c],
|
|
3984
|
+
const l = e[c], f = l.checkpointId, p = f ?? `cp-${c}`, g = l.metadata ?? {}, I = typeof g.step == "number" ? g.step : null, u = typeof g.source == "string" ? g.source : null;
|
|
3968
3985
|
let v = null, x = null;
|
|
3969
3986
|
const M = Array.isArray(l.messages) ? l.messages : [];
|
|
3970
3987
|
for (const h of M)
|
|
3971
3988
|
h.role === "user" && (x || (x = h), h.id && (v = h.id));
|
|
3972
|
-
const A = l.next && l.next.length > 0 ? String(l.next[0]) : null,
|
|
3973
|
-
id:
|
|
3989
|
+
const A = l.next && l.next.length > 0 ? String(l.next[0]) : null, w = l.parentConfig ?? null, b = {
|
|
3990
|
+
id: p,
|
|
3974
3991
|
step: I,
|
|
3975
|
-
source:
|
|
3992
|
+
source: u,
|
|
3976
3993
|
createdAt: l.createdAt ?? null,
|
|
3977
3994
|
namespace: l.checkpointNs ?? null,
|
|
3978
3995
|
parentId: l.parentId ?? null,
|
|
3979
3996
|
next: A,
|
|
3980
|
-
parentConfig:
|
|
3997
|
+
parentConfig: w,
|
|
3981
3998
|
userMessageId: v
|
|
3982
3999
|
};
|
|
3983
|
-
if (
|
|
3984
|
-
const h =
|
|
3985
|
-
h && r.set(
|
|
4000
|
+
if (o.push(b), f && t.set(f, b), f && x) {
|
|
4001
|
+
const h = Nr(x);
|
|
4002
|
+
h && r.set(f, h);
|
|
3986
4003
|
}
|
|
3987
4004
|
n.push({
|
|
3988
|
-
id:
|
|
4005
|
+
id: p,
|
|
3989
4006
|
messageId: v,
|
|
3990
4007
|
step: I,
|
|
3991
|
-
source:
|
|
4008
|
+
source: u,
|
|
3992
4009
|
createdAt: l.createdAt ?? null,
|
|
3993
4010
|
next: A,
|
|
3994
|
-
parentConfig:
|
|
4011
|
+
parentConfig: w
|
|
3995
4012
|
});
|
|
3996
4013
|
}
|
|
3997
|
-
const
|
|
3998
|
-
for (const c of
|
|
4014
|
+
const s = /* @__PURE__ */ new Map();
|
|
4015
|
+
for (const c of o) {
|
|
3999
4016
|
if (!c.userMessageId) continue;
|
|
4000
|
-
const l =
|
|
4001
|
-
l.push(c),
|
|
4017
|
+
const l = s.get(c.userMessageId) ?? [];
|
|
4018
|
+
l.push(c), s.set(c.userMessageId, l);
|
|
4002
4019
|
}
|
|
4003
|
-
for (const c of
|
|
4020
|
+
for (const c of s.values()) {
|
|
4004
4021
|
if (!c.length) continue;
|
|
4005
|
-
c.sort((
|
|
4006
|
-
const
|
|
4007
|
-
return (
|
|
4022
|
+
c.sort((f, p) => {
|
|
4023
|
+
const g = f.createdAt ? Date.parse(f.createdAt) : 0;
|
|
4024
|
+
return (p.createdAt ? Date.parse(p.createdAt) : 0) - g;
|
|
4008
4025
|
});
|
|
4009
4026
|
const l = c.length;
|
|
4010
|
-
for (let
|
|
4011
|
-
const
|
|
4012
|
-
|
|
4027
|
+
for (let f = 0; f < c.length; f++) {
|
|
4028
|
+
const p = c[f];
|
|
4029
|
+
p.attemptCount = l, p.attemptIndex = f, p.isLatestAttempt = f === 0;
|
|
4013
4030
|
}
|
|
4014
4031
|
}
|
|
4015
4032
|
return {
|
|
@@ -4025,120 +4042,120 @@ function Nr(e) {
|
|
|
4025
4042
|
getCheckpoint: (c) => t.get(c),
|
|
4026
4043
|
getMessageAttempts: (c) => {
|
|
4027
4044
|
const l = [];
|
|
4028
|
-
for (const
|
|
4029
|
-
|
|
4030
|
-
return l.length ? (l.sort((
|
|
4031
|
-
const
|
|
4032
|
-
return
|
|
4045
|
+
for (const f of t.values())
|
|
4046
|
+
f.userMessageId === c && l.push(f);
|
|
4047
|
+
return l.length ? (l.sort((f, p) => {
|
|
4048
|
+
const g = typeof f.attemptIndex == "number" ? f.attemptIndex : Number.MAX_SAFE_INTEGER, I = typeof p.attemptIndex == "number" ? p.attemptIndex : Number.MAX_SAFE_INTEGER;
|
|
4049
|
+
return g - I;
|
|
4033
4050
|
}), l) : [];
|
|
4034
4051
|
}
|
|
4035
4052
|
};
|
|
4036
4053
|
}
|
|
4037
|
-
function
|
|
4054
|
+
function uo(e, t, n) {
|
|
4038
4055
|
if (!e)
|
|
4039
4056
|
return { attemptCount: 1, attemptIndex: 0, attempts: [] };
|
|
4040
4057
|
const r = n.getMessageAttempts(e);
|
|
4041
4058
|
if (!r.length)
|
|
4042
4059
|
return { attemptCount: 1, attemptIndex: 0, attempts: [] };
|
|
4043
|
-
let
|
|
4060
|
+
let o = 0;
|
|
4044
4061
|
if (t) {
|
|
4045
|
-
const
|
|
4046
|
-
|
|
4062
|
+
const s = r.findIndex((a) => a.id === t);
|
|
4063
|
+
s >= 0 && (o = s);
|
|
4047
4064
|
}
|
|
4048
4065
|
return {
|
|
4049
4066
|
attemptCount: r.length,
|
|
4050
|
-
attemptIndex:
|
|
4067
|
+
attemptIndex: o,
|
|
4051
4068
|
attempts: r
|
|
4052
4069
|
};
|
|
4053
4070
|
}
|
|
4054
4071
|
function Rr(e) {
|
|
4055
|
-
return Y(() =>
|
|
4072
|
+
return Y(() => zr(e), [e]);
|
|
4056
4073
|
}
|
|
4057
4074
|
function $t({
|
|
4058
4075
|
api: e,
|
|
4059
4076
|
fileApi: t,
|
|
4060
4077
|
seed: n,
|
|
4061
4078
|
onError: r,
|
|
4062
|
-
currentThreadId:
|
|
4063
|
-
autoLoadInitial:
|
|
4079
|
+
currentThreadId: o,
|
|
4080
|
+
autoLoadInitial: s = !0,
|
|
4064
4081
|
isStreaming: a,
|
|
4065
4082
|
getMessages: i
|
|
4066
4083
|
}) {
|
|
4067
|
-
const [
|
|
4068
|
-
() => mt(
|
|
4069
|
-
[
|
|
4070
|
-
).checkpoints,
|
|
4084
|
+
const [d, c] = $(null), f = Y(
|
|
4085
|
+
() => mt(d),
|
|
4086
|
+
[d]
|
|
4087
|
+
).checkpoints, p = Rr(f), g = p.timeline, [I, u] = $(!1), [v, x] = $(!1), [M, A] = $(!1), [w, b] = $(null), h = G(o), T = G(null), m = G(null);
|
|
4071
4088
|
X(() => {
|
|
4072
|
-
h.current =
|
|
4073
|
-
}, [
|
|
4074
|
-
const
|
|
4075
|
-
async (
|
|
4089
|
+
h.current = o;
|
|
4090
|
+
}, [o]);
|
|
4091
|
+
const k = _(
|
|
4092
|
+
async (P) => {
|
|
4076
4093
|
const B = await e.getState({
|
|
4077
|
-
threadId:
|
|
4078
|
-
checkpointId:
|
|
4079
|
-
checkpointNs:
|
|
4094
|
+
threadId: P.threadId,
|
|
4095
|
+
checkpointId: P.checkpointId,
|
|
4096
|
+
checkpointNs: P.checkpointNs
|
|
4080
4097
|
}), z = {
|
|
4081
4098
|
version: "values@1",
|
|
4082
|
-
threadId:
|
|
4099
|
+
threadId: P.threadId,
|
|
4083
4100
|
checkpoints: [B]
|
|
4084
|
-
},
|
|
4085
|
-
return
|
|
4101
|
+
}, J = t ? await Mr(z, t) : z, { latest: U } = mt(J);
|
|
4102
|
+
return U;
|
|
4086
4103
|
},
|
|
4087
4104
|
[e, t]
|
|
4088
|
-
),
|
|
4089
|
-
async (
|
|
4090
|
-
var
|
|
4091
|
-
if (!
|
|
4092
|
-
const z = `${
|
|
4105
|
+
), E = _(
|
|
4106
|
+
async (P, B) => {
|
|
4107
|
+
var U;
|
|
4108
|
+
if (!P) return;
|
|
4109
|
+
const z = `${P}:${B ?? "latest"}`;
|
|
4093
4110
|
if (T.current === z || I) return;
|
|
4094
|
-
(
|
|
4095
|
-
const
|
|
4096
|
-
|
|
4111
|
+
(U = m.current) == null || U.abort();
|
|
4112
|
+
const J = new AbortController();
|
|
4113
|
+
m.current = J, u(!0), b(null);
|
|
4097
4114
|
try {
|
|
4098
|
-
const
|
|
4099
|
-
threadId:
|
|
4115
|
+
const R = await k({
|
|
4116
|
+
threadId: P,
|
|
4100
4117
|
checkpointId: B ?? void 0
|
|
4101
4118
|
});
|
|
4102
|
-
if (h.current !==
|
|
4103
|
-
|
|
4119
|
+
if (h.current !== P) {
|
|
4120
|
+
u(!1);
|
|
4104
4121
|
return;
|
|
4105
4122
|
}
|
|
4106
|
-
n((
|
|
4107
|
-
checkpointId: (
|
|
4108
|
-
checkpointNs: (
|
|
4109
|
-
pendingInterrupt: (
|
|
4110
|
-
values:
|
|
4111
|
-
}), T.current = z,
|
|
4123
|
+
n((R == null ? void 0 : R.messages) ?? [], {
|
|
4124
|
+
checkpointId: (R == null ? void 0 : R.checkpointId) ?? null,
|
|
4125
|
+
checkpointNs: (R == null ? void 0 : R.checkpointNs) ?? null,
|
|
4126
|
+
pendingInterrupt: (R == null ? void 0 : R.interrupt) ?? null,
|
|
4127
|
+
values: R == null ? void 0 : R.values
|
|
4128
|
+
}), T.current = z, u(!1), A(!0);
|
|
4112
4129
|
try {
|
|
4113
|
-
const
|
|
4114
|
-
threadId:
|
|
4130
|
+
const q = await e.getStateHistory({
|
|
4131
|
+
threadId: P,
|
|
4115
4132
|
limit: 100,
|
|
4116
4133
|
includeMessages: !1
|
|
4117
4134
|
});
|
|
4118
|
-
h.current ===
|
|
4135
|
+
h.current === P && c(q);
|
|
4119
4136
|
} finally {
|
|
4120
4137
|
A(!1);
|
|
4121
4138
|
}
|
|
4122
|
-
} catch (
|
|
4123
|
-
if (
|
|
4124
|
-
const
|
|
4125
|
-
b(
|
|
4139
|
+
} catch (R) {
|
|
4140
|
+
if (u(!1), !Xt(R)) {
|
|
4141
|
+
const q = String(R);
|
|
4142
|
+
b(q), r == null || r(q);
|
|
4126
4143
|
}
|
|
4127
4144
|
}
|
|
4128
4145
|
},
|
|
4129
|
-
[e, n,
|
|
4146
|
+
[e, n, k, r, i]
|
|
4130
4147
|
), j = _(
|
|
4131
|
-
async (
|
|
4132
|
-
if (
|
|
4148
|
+
async (P, B) => {
|
|
4149
|
+
if (o) {
|
|
4133
4150
|
x(!0);
|
|
4134
4151
|
try {
|
|
4135
|
-
const z = await
|
|
4136
|
-
threadId:
|
|
4137
|
-
checkpointId:
|
|
4152
|
+
const z = await k({
|
|
4153
|
+
threadId: o,
|
|
4154
|
+
checkpointId: P,
|
|
4138
4155
|
checkpointNs: B ?? void 0
|
|
4139
4156
|
});
|
|
4140
4157
|
n((z == null ? void 0 : z.messages) ?? [], {
|
|
4141
|
-
checkpointId: (z == null ? void 0 : z.checkpointId) ??
|
|
4158
|
+
checkpointId: (z == null ? void 0 : z.checkpointId) ?? P,
|
|
4142
4159
|
checkpointNs: (z == null ? void 0 : z.checkpointNs) ?? B,
|
|
4143
4160
|
pendingInterrupt: (z == null ? void 0 : z.interrupt) ?? null,
|
|
4144
4161
|
values: z == null ? void 0 : z.values
|
|
@@ -4150,48 +4167,36 @@ function $t({
|
|
|
4150
4167
|
}
|
|
4151
4168
|
}
|
|
4152
4169
|
},
|
|
4153
|
-
[
|
|
4170
|
+
[o, k, n]
|
|
4154
4171
|
), C = _(async () => {
|
|
4155
|
-
|
|
4156
|
-
}, [
|
|
4157
|
-
async (
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
if (!B || s !== B) return;
|
|
4161
|
-
if (c(E), T.current = `${B}:latest`, (K = E.values) != null && K.messages) {
|
|
4162
|
-
const N = await w({
|
|
4163
|
-
threadId: B
|
|
4164
|
-
});
|
|
4165
|
-
N && n(N.messages ?? [], {
|
|
4166
|
-
checkpointId: N.checkpointId ?? null,
|
|
4167
|
-
checkpointNs: N.checkpointNs ?? null,
|
|
4168
|
-
pendingInterrupt: N.interrupt ?? null,
|
|
4169
|
-
values: N.values
|
|
4170
|
-
});
|
|
4171
|
-
}
|
|
4172
|
+
o && await E(o);
|
|
4173
|
+
}, [o, E]), O = _(
|
|
4174
|
+
async (P) => {
|
|
4175
|
+
const B = (P == null ? void 0 : P.threadId) || o;
|
|
4176
|
+
!B || o !== B || (c(P), T.current = `${B}:latest`);
|
|
4172
4177
|
},
|
|
4173
|
-
[
|
|
4178
|
+
[o]
|
|
4174
4179
|
);
|
|
4175
4180
|
X(() => {
|
|
4176
|
-
if (!
|
|
4177
|
-
const
|
|
4178
|
-
T.current !==
|
|
4179
|
-
}, [
|
|
4181
|
+
if (!s || !o || I || a) return;
|
|
4182
|
+
const P = `${o}:latest`;
|
|
4183
|
+
T.current !== P && E(o);
|
|
4184
|
+
}, [s, o, I, a, E]);
|
|
4180
4185
|
const F = _(() => {
|
|
4181
|
-
c(null),
|
|
4186
|
+
c(null), u(!1), x(!1), A(!1), b(null), T.current = null;
|
|
4182
4187
|
}, []);
|
|
4183
4188
|
return {
|
|
4184
|
-
threadCheckpoints:
|
|
4185
|
-
threadTimeline:
|
|
4186
|
-
checkpointIndex:
|
|
4189
|
+
threadCheckpoints: f,
|
|
4190
|
+
threadTimeline: g,
|
|
4191
|
+
checkpointIndex: p,
|
|
4187
4192
|
isLoadingThread: I,
|
|
4188
4193
|
isLoadingCheckpoint: v,
|
|
4189
4194
|
isLoadingHistory: M,
|
|
4190
|
-
threadStateError:
|
|
4191
|
-
loadThread:
|
|
4195
|
+
threadStateError: w,
|
|
4196
|
+
loadThread: E,
|
|
4192
4197
|
navigateToCheckpoint: j,
|
|
4193
|
-
setCurrentCheckpointId: (
|
|
4194
|
-
n(i(), { checkpointId:
|
|
4198
|
+
setCurrentCheckpointId: (P, B) => {
|
|
4199
|
+
n(i(), { checkpointId: P, checkpointNs: B });
|
|
4195
4200
|
},
|
|
4196
4201
|
returnToLatest: C,
|
|
4197
4202
|
handleValuesEvent: O,
|
|
@@ -4205,80 +4210,80 @@ function $t({
|
|
|
4205
4210
|
}
|
|
4206
4211
|
const Dt = Ce(null), Kt = Ce(null);
|
|
4207
4212
|
function Vt(e) {
|
|
4208
|
-
const t =
|
|
4213
|
+
const t = je(Dt);
|
|
4209
4214
|
if (!t && !(e != null && e.optional)) throw new Error("useThreadState must be used within a ThreadStateProvider");
|
|
4210
4215
|
return t;
|
|
4211
4216
|
}
|
|
4212
4217
|
function Lr() {
|
|
4213
|
-
const e =
|
|
4218
|
+
const e = je(Kt);
|
|
4214
4219
|
if (!e)
|
|
4215
4220
|
throw new Error("useThreadStateUpdater must be used within a ThreadStateProvider");
|
|
4216
4221
|
return e;
|
|
4217
4222
|
}
|
|
4218
|
-
function
|
|
4223
|
+
function jr({
|
|
4219
4224
|
children: e,
|
|
4220
4225
|
initialThreadId: t = null,
|
|
4221
4226
|
initialCheckpointId: n = null,
|
|
4222
4227
|
initialCheckpointNs: r = null,
|
|
4223
|
-
autoLoadInitial:
|
|
4224
|
-
isStreaming:
|
|
4228
|
+
autoLoadInitial: o = !0,
|
|
4229
|
+
isStreaming: s,
|
|
4225
4230
|
onError: a
|
|
4226
4231
|
}) {
|
|
4227
|
-
const { chatApi: i, fileApi:
|
|
4232
|
+
const { chatApi: i, fileApi: d } = Me(), { currentThreadId: c } = ot(), { state: l, seed: f, onEvent: p, dispatch: g } = kr(), {
|
|
4228
4233
|
threadCheckpoints: I,
|
|
4229
|
-
threadTimeline:
|
|
4234
|
+
threadTimeline: u,
|
|
4230
4235
|
checkpointIndex: v,
|
|
4231
4236
|
isLoadingThread: x,
|
|
4232
4237
|
isLoadingCheckpoint: M,
|
|
4233
4238
|
isLoadingHistory: A,
|
|
4234
|
-
threadStateError:
|
|
4239
|
+
threadStateError: w,
|
|
4235
4240
|
loadThread: b,
|
|
4236
4241
|
navigateToCheckpoint: h,
|
|
4237
4242
|
setCurrentCheckpointId: T,
|
|
4238
|
-
returnToLatest:
|
|
4239
|
-
handleValuesEvent:
|
|
4240
|
-
markSkipNextLoad:
|
|
4243
|
+
returnToLatest: m,
|
|
4244
|
+
handleValuesEvent: k,
|
|
4245
|
+
markSkipNextLoad: E,
|
|
4241
4246
|
markStreamPendingThread: j,
|
|
4242
4247
|
resetHistoryState: C
|
|
4243
4248
|
} = $t({
|
|
4244
4249
|
api: i,
|
|
4245
|
-
fileApi:
|
|
4246
|
-
seed:
|
|
4250
|
+
fileApi: d,
|
|
4251
|
+
seed: f,
|
|
4247
4252
|
onError: a,
|
|
4248
4253
|
currentThreadId: c,
|
|
4249
4254
|
initialThreadId: t,
|
|
4250
4255
|
initialCheckpointId: n,
|
|
4251
4256
|
initialCheckpointNs: r,
|
|
4252
|
-
autoLoadInitial:
|
|
4253
|
-
isStreaming:
|
|
4257
|
+
autoLoadInitial: o,
|
|
4258
|
+
isStreaming: s,
|
|
4254
4259
|
getMessages: _(() => l.messages, [l.messages])
|
|
4255
|
-
}), O =
|
|
4260
|
+
}), O = G(null), F = _(
|
|
4256
4261
|
(S) => {
|
|
4257
4262
|
O.current = S;
|
|
4258
4263
|
},
|
|
4259
4264
|
[]
|
|
4260
|
-
),
|
|
4265
|
+
), P = G(null), B = _(
|
|
4261
4266
|
(S) => {
|
|
4262
|
-
|
|
4267
|
+
P.current = S;
|
|
4263
4268
|
},
|
|
4264
4269
|
[]
|
|
4265
|
-
), z = Y(() => ({ assemblingMessageId: l.assemblingId ?? null }), [l.assemblingId]),
|
|
4266
|
-
(S,
|
|
4267
|
-
const
|
|
4268
|
-
return
|
|
4270
|
+
), z = Y(() => ({ assemblingMessageId: l.assemblingId ?? null }), [l.assemblingId]), J = _(
|
|
4271
|
+
(S, W) => {
|
|
4272
|
+
const K = jt(S, "user");
|
|
4273
|
+
return g({
|
|
4269
4274
|
type: "user_message",
|
|
4270
4275
|
payload: {
|
|
4271
|
-
message:
|
|
4272
|
-
editingMessageId:
|
|
4276
|
+
message: K,
|
|
4277
|
+
editingMessageId: W == null ? void 0 : W.editingMessageId
|
|
4273
4278
|
}
|
|
4274
|
-
}),
|
|
4279
|
+
}), K;
|
|
4275
4280
|
},
|
|
4276
|
-
[
|
|
4277
|
-
),
|
|
4278
|
-
O.current ? await O.current() : (
|
|
4279
|
-
}, [
|
|
4280
|
-
await b(S,
|
|
4281
|
-
}, [b]),
|
|
4281
|
+
[g]
|
|
4282
|
+
), U = _(async () => {
|
|
4283
|
+
O.current ? await O.current() : (f([], {}), C());
|
|
4284
|
+
}, [f, C]), R = _(async (S, W, K) => {
|
|
4285
|
+
await b(S, W, { clearProgress: !1 });
|
|
4286
|
+
}, [b]), q = Y(() => Bn(l.messages), [l.messages]), y = Y(
|
|
4282
4287
|
() => ({
|
|
4283
4288
|
status: l.status,
|
|
4284
4289
|
threadId: c,
|
|
@@ -4291,41 +4296,41 @@ function Ur({
|
|
|
4291
4296
|
},
|
|
4292
4297
|
checkpoints: I,
|
|
4293
4298
|
checkpointIndex: v,
|
|
4294
|
-
timelineCheckpoints:
|
|
4299
|
+
timelineCheckpoints: u,
|
|
4295
4300
|
metadata: z,
|
|
4296
4301
|
values: l.values ?? {},
|
|
4297
4302
|
isLoading: x,
|
|
4298
4303
|
isLoadingCheckpoint: M,
|
|
4299
4304
|
isLoadingHistory: A,
|
|
4300
|
-
error:
|
|
4305
|
+
error: w,
|
|
4301
4306
|
loadOlder: async () => {
|
|
4302
4307
|
},
|
|
4303
4308
|
// Placeholder
|
|
4304
4309
|
seedFromSnapshot: (S) => {
|
|
4305
|
-
|
|
4310
|
+
f(S.messages, {
|
|
4306
4311
|
checkpointId: S.checkpointId,
|
|
4307
4312
|
checkpointNs: S.checkpointNs,
|
|
4308
4313
|
pendingInterrupt: S.interrupt,
|
|
4309
4314
|
values: S.values
|
|
4310
4315
|
});
|
|
4311
4316
|
},
|
|
4312
|
-
clearState:
|
|
4317
|
+
clearState: U,
|
|
4313
4318
|
navigateToCheckpoint: h,
|
|
4314
4319
|
setCurrentCheckpointId: T,
|
|
4315
|
-
returnToLatest:
|
|
4316
|
-
loadThread:
|
|
4317
|
-
clearThread:
|
|
4318
|
-
respondToInterrupt: async (S,
|
|
4319
|
-
|
|
4320
|
+
returnToLatest: m,
|
|
4321
|
+
loadThread: R,
|
|
4322
|
+
clearThread: U,
|
|
4323
|
+
respondToInterrupt: async (S, W, K) => {
|
|
4324
|
+
P.current && await P.current(S, W, K);
|
|
4320
4325
|
},
|
|
4321
4326
|
messagePreviews: v.messagePreviews,
|
|
4322
|
-
handleValuesEvent:
|
|
4323
|
-
markSkipNextLoad:
|
|
4327
|
+
handleValuesEvent: k,
|
|
4328
|
+
markSkipNextLoad: E,
|
|
4324
4329
|
markStreamPendingThread: j,
|
|
4325
4330
|
resetHistoryState: C,
|
|
4326
|
-
pushUser:
|
|
4327
|
-
onEvent:
|
|
4328
|
-
artifacts:
|
|
4331
|
+
pushUser: J,
|
|
4332
|
+
onEvent: p,
|
|
4333
|
+
artifacts: q
|
|
4329
4334
|
}),
|
|
4330
4335
|
[
|
|
4331
4336
|
c,
|
|
@@ -4336,75 +4341,75 @@ function Ur({
|
|
|
4336
4341
|
l.lastCheckpointNs,
|
|
4337
4342
|
l.values,
|
|
4338
4343
|
I,
|
|
4339
|
-
|
|
4344
|
+
u,
|
|
4340
4345
|
v,
|
|
4341
4346
|
z,
|
|
4342
4347
|
x,
|
|
4343
4348
|
M,
|
|
4344
4349
|
A,
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4350
|
+
w,
|
|
4351
|
+
f,
|
|
4352
|
+
U,
|
|
4348
4353
|
h,
|
|
4349
4354
|
T,
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4355
|
+
m,
|
|
4356
|
+
R,
|
|
4357
|
+
k,
|
|
4358
|
+
E,
|
|
4354
4359
|
j,
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4360
|
+
J,
|
|
4361
|
+
p,
|
|
4362
|
+
q
|
|
4358
4363
|
]
|
|
4359
|
-
),
|
|
4364
|
+
), L = Y(
|
|
4360
4365
|
() => ({
|
|
4361
4366
|
registerClearThread: F,
|
|
4362
4367
|
registerRespondToInterrupt: B
|
|
4363
4368
|
}),
|
|
4364
4369
|
[F, B]
|
|
4365
4370
|
);
|
|
4366
|
-
return /* @__PURE__ */ ie(Kt.Provider, { value:
|
|
4371
|
+
return /* @__PURE__ */ ie(Kt.Provider, { value: L, children: /* @__PURE__ */ ie(Dt.Provider, { value: y, children: e }) });
|
|
4367
4372
|
}
|
|
4368
|
-
const qt = Ce(null),
|
|
4373
|
+
const qt = Ce(null), Ur = Ce(!1);
|
|
4369
4374
|
function Br({
|
|
4370
4375
|
children: e,
|
|
4371
4376
|
onError: t,
|
|
4372
4377
|
onAuthError: n,
|
|
4373
4378
|
onConnectionError: r,
|
|
4374
|
-
onToolEnd:
|
|
4375
|
-
onUpdateEvent:
|
|
4379
|
+
onToolEnd: o,
|
|
4380
|
+
onUpdateEvent: s,
|
|
4376
4381
|
onCustomEvent: a,
|
|
4377
4382
|
onMetadataEvent: i,
|
|
4378
|
-
onFinish:
|
|
4383
|
+
onFinish: d,
|
|
4379
4384
|
onStreamingChange: c
|
|
4380
4385
|
}) {
|
|
4381
|
-
const { chatApi: l, baseUrl:
|
|
4386
|
+
const { chatApi: l, baseUrl: f } = Me(), p = f, g = fe(t), I = fe(n), u = fe(r), v = fe(o), x = fe(s), M = fe(a), A = fe(i), w = fe(d), b = fe(c), h = Y(
|
|
4382
4387
|
() => ({
|
|
4383
|
-
onError:
|
|
4388
|
+
onError: g,
|
|
4384
4389
|
onAuthError: I,
|
|
4385
|
-
onConnectionError:
|
|
4390
|
+
onConnectionError: u,
|
|
4386
4391
|
onMetadataEvent: A,
|
|
4387
4392
|
onCustomEvent: M,
|
|
4388
4393
|
onUpdateEvent: x,
|
|
4389
4394
|
onToolEnd: v,
|
|
4390
|
-
onFinish:
|
|
4395
|
+
onFinish: w
|
|
4391
4396
|
}),
|
|
4392
4397
|
[
|
|
4393
|
-
|
|
4398
|
+
g,
|
|
4394
4399
|
I,
|
|
4395
|
-
|
|
4400
|
+
u,
|
|
4396
4401
|
A,
|
|
4397
4402
|
M,
|
|
4398
4403
|
x,
|
|
4399
4404
|
v,
|
|
4400
|
-
|
|
4405
|
+
w
|
|
4401
4406
|
]
|
|
4402
4407
|
);
|
|
4403
|
-
return /* @__PURE__ */ ie(
|
|
4408
|
+
return /* @__PURE__ */ ie(Ur.Provider, { value: !0, children: /* @__PURE__ */ ie(
|
|
4404
4409
|
Fr,
|
|
4405
4410
|
{
|
|
4406
4411
|
api: l,
|
|
4407
|
-
streamBaseUrl:
|
|
4412
|
+
streamBaseUrl: p,
|
|
4408
4413
|
handlers: h,
|
|
4409
4414
|
onStreamingChange: b,
|
|
4410
4415
|
children: e
|
|
@@ -4416,30 +4421,30 @@ function Fr({
|
|
|
4416
4421
|
api: t,
|
|
4417
4422
|
streamBaseUrl: n,
|
|
4418
4423
|
handlers: r,
|
|
4419
|
-
onStreamingChange:
|
|
4424
|
+
onStreamingChange: o
|
|
4420
4425
|
}) {
|
|
4421
|
-
const { setCurrentThreadId:
|
|
4426
|
+
const { setCurrentThreadId: s, currentThreadIdRef: a, addThreadFromEvent: i, currentThreadId: d } = ot(), {
|
|
4422
4427
|
interrupt: c,
|
|
4423
4428
|
checkpoint: l,
|
|
4424
|
-
timelineCheckpoints:
|
|
4425
|
-
handleValuesEvent:
|
|
4426
|
-
markSkipNextLoad:
|
|
4429
|
+
timelineCheckpoints: f,
|
|
4430
|
+
handleValuesEvent: p,
|
|
4431
|
+
markSkipNextLoad: g,
|
|
4427
4432
|
markStreamPendingThread: I,
|
|
4428
|
-
resetHistoryState:
|
|
4433
|
+
resetHistoryState: u,
|
|
4429
4434
|
pushUser: v,
|
|
4430
4435
|
onEvent: x,
|
|
4431
4436
|
messages: M
|
|
4432
|
-
} = Vt(), { registerClearThread: A, registerRespondToInterrupt:
|
|
4437
|
+
} = Vt(), { registerClearThread: A, registerRespondToInterrupt: w } = Lr(), b = _(
|
|
4433
4438
|
(y) => {
|
|
4434
|
-
i(y), I(y.threadId), a.current !== y.threadId && ((y.created ?? !a.current) &&
|
|
4439
|
+
i(y), I(y.threadId), a.current !== y.threadId && ((y.created ?? !a.current) && g(y.threadId), s(y.threadId));
|
|
4435
4440
|
},
|
|
4436
|
-
[i,
|
|
4441
|
+
[i, g, I, s, a]
|
|
4437
4442
|
), h = pr({
|
|
4438
4443
|
baseUrl: n,
|
|
4439
4444
|
onEvent: x,
|
|
4440
4445
|
onError: (y) => {
|
|
4441
|
-
var
|
|
4442
|
-
(
|
|
4446
|
+
var L;
|
|
4447
|
+
(L = r.onError) == null || L.call(r, (y == null ? void 0 : y.message) ?? String(y));
|
|
4443
4448
|
},
|
|
4444
4449
|
onAuthError: r.onAuthError,
|
|
4445
4450
|
onConnectionError: r.onConnectionError,
|
|
@@ -4449,86 +4454,86 @@ function Fr({
|
|
|
4449
4454
|
onCustomEvent: r.onCustomEvent,
|
|
4450
4455
|
onUpdateEvent: r.onUpdateEvent,
|
|
4451
4456
|
onToolEnd: r.onToolEnd,
|
|
4452
|
-
handleValuesEvent:
|
|
4457
|
+
handleValuesEvent: p
|
|
4453
4458
|
});
|
|
4454
4459
|
X(() => {
|
|
4455
|
-
|
|
4456
|
-
}, [h.isStreaming,
|
|
4457
|
-
const { stream: T, stop:
|
|
4460
|
+
o == null || o(h.isStreaming);
|
|
4461
|
+
}, [h.isStreaming, o]);
|
|
4462
|
+
const { stream: T, stop: m, clear: k, isStreaming: E, error: j, connected: C, streamedMessages: O, activeMessageId: F } = h;
|
|
4458
4463
|
X(() => {
|
|
4459
|
-
|
|
4460
|
-
}, [
|
|
4461
|
-
const
|
|
4462
|
-
async (y,
|
|
4463
|
-
await T(y,
|
|
4464
|
+
d !== void 0 && k();
|
|
4465
|
+
}, [d, k]);
|
|
4466
|
+
const P = _(
|
|
4467
|
+
async (y, L) => {
|
|
4468
|
+
await T(y, L);
|
|
4464
4469
|
},
|
|
4465
4470
|
[T]
|
|
4466
|
-
), B =
|
|
4471
|
+
), B = G(l);
|
|
4467
4472
|
X(() => {
|
|
4468
4473
|
B.current = l;
|
|
4469
4474
|
}, [l]);
|
|
4470
4475
|
const z = _(
|
|
4471
|
-
async (y,
|
|
4472
|
-
var
|
|
4473
|
-
const
|
|
4474
|
-
if (!
|
|
4476
|
+
async (y, L, S) => {
|
|
4477
|
+
var H;
|
|
4478
|
+
const W = a.current;
|
|
4479
|
+
if (!W)
|
|
4475
4480
|
throw new Error("No active thread to handle interrupt");
|
|
4476
|
-
const
|
|
4477
|
-
threadId:
|
|
4481
|
+
const K = y ? L ?? !0 : !1, V = B.current, ee = (S == null ? void 0 : S.checkpointId) ?? V.id ?? void 0, re = (S == null ? void 0 : S.checkpointNs) ?? V.namespace ?? void 0, de = {
|
|
4482
|
+
threadId: W,
|
|
4478
4483
|
checkpointId: ee,
|
|
4479
4484
|
checkpointNs: re,
|
|
4480
|
-
command: { kind: "resume", value:
|
|
4485
|
+
command: { kind: "resume", value: K },
|
|
4481
4486
|
payload: {
|
|
4482
4487
|
...(S == null ? void 0 : S.payload) ?? {},
|
|
4483
|
-
creativityLevel: ((
|
|
4488
|
+
creativityLevel: ((H = S == null ? void 0 : S.payload) == null ? void 0 : H.creativityLevel) ?? "medium"
|
|
4484
4489
|
},
|
|
4485
4490
|
edit: !1
|
|
4486
4491
|
};
|
|
4487
|
-
|
|
4492
|
+
P(de);
|
|
4488
4493
|
},
|
|
4489
|
-
[a,
|
|
4494
|
+
[a, P]
|
|
4490
4495
|
);
|
|
4491
4496
|
X(() => {
|
|
4492
|
-
|
|
4493
|
-
}, [z,
|
|
4494
|
-
const
|
|
4495
|
-
|
|
4496
|
-
}, [
|
|
4497
|
+
w(z);
|
|
4498
|
+
}, [z, w]);
|
|
4499
|
+
const J = _(async () => {
|
|
4500
|
+
m(), k(), u(), s(null);
|
|
4501
|
+
}, [k, u, s, m]);
|
|
4497
4502
|
X(() => {
|
|
4498
|
-
A(
|
|
4499
|
-
}, [
|
|
4500
|
-
const
|
|
4501
|
-
async (y,
|
|
4502
|
-
|
|
4503
|
+
A(J);
|
|
4504
|
+
}, [J, A]);
|
|
4505
|
+
const U = _(
|
|
4506
|
+
async (y, L) => {
|
|
4507
|
+
E && m();
|
|
4503
4508
|
let S = a.current;
|
|
4504
|
-
const
|
|
4509
|
+
const W = (y == null ? void 0 : y.text) ?? "", K = (y == null ? void 0 : y.attachments) ?? [], V = (W == null ? void 0 : W.trim()) ?? "", ee = { ...(y == null ? void 0 : y.payload) ?? {} }, re = Array.isArray(ee.messages) ? ee.messages : void 0;
|
|
4505
4510
|
re && delete ee.messages;
|
|
4506
|
-
const
|
|
4507
|
-
if (!S && !
|
|
4511
|
+
const de = !!(re && re.length), H = !!(y.contentParts && y.contentParts.length > 0);
|
|
4512
|
+
if (!S && !V && K.length === 0 && !de && !H) return;
|
|
4508
4513
|
if (!S) {
|
|
4509
4514
|
const ye = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), he = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")).join("").slice(0, 16);
|
|
4510
|
-
S = `${ye}${he}`,
|
|
4515
|
+
S = `${ye}${he}`, g(S), s(S);
|
|
4511
4516
|
}
|
|
4512
4517
|
let te = null;
|
|
4513
4518
|
y.contentParts && y.contentParts.length > 0 && (te = y.contentParts);
|
|
4514
|
-
const { contentParts: ke, filesInfo: Q } = te ? { contentParts: te, filesInfo: [] } : await
|
|
4515
|
-
|
|
4516
|
-
const ge = y == null ? void 0 : y.originalMessageId,
|
|
4519
|
+
const { contentParts: ke, filesInfo: Q } = te ? { contentParts: te, filesInfo: [] } : await or(K), Z = [...ke];
|
|
4520
|
+
V && Z.push({ type: "text", text: W });
|
|
4521
|
+
const ge = y == null ? void 0 : y.originalMessageId, Ue = !!(y != null && y.edit && ge), Be = !de && Z.length > 0;
|
|
4517
4522
|
let me = null;
|
|
4518
4523
|
if (Be) {
|
|
4519
|
-
const ye =
|
|
4520
|
-
me =
|
|
4524
|
+
const ye = Ue ? ge : `msg-${Date.now()}`;
|
|
4525
|
+
me = jt({
|
|
4521
4526
|
id: ye,
|
|
4522
4527
|
role: "user",
|
|
4523
4528
|
content: Z,
|
|
4524
4529
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4525
|
-
}, "user"),
|
|
4530
|
+
}, "user"), Ue ? v(me, { editingMessageId: ge }) : v(me);
|
|
4526
4531
|
}
|
|
4527
|
-
const ve =
|
|
4532
|
+
const ve = de ? re : me ? [me] : [], oe = {
|
|
4528
4533
|
...ee,
|
|
4529
4534
|
...Q.length ? { files_info: Q } : {}
|
|
4530
4535
|
};
|
|
4531
|
-
ve.length ?
|
|
4536
|
+
ve.length ? oe.messages = ve : "messages" in oe || (oe.messages = []);
|
|
4532
4537
|
const Pe = (y == null ? void 0 : y.checkpointId) ?? l.id ?? void 0;
|
|
4533
4538
|
if (y != null && y.edit && !Pe)
|
|
4534
4539
|
throw new Error(
|
|
@@ -4537,37 +4542,37 @@ function Fr({
|
|
|
4537
4542
|
const xe = {
|
|
4538
4543
|
threadId: S,
|
|
4539
4544
|
content: y == null ? void 0 : y.text,
|
|
4540
|
-
payload:
|
|
4545
|
+
payload: oe,
|
|
4541
4546
|
config: y == null ? void 0 : y.config,
|
|
4542
4547
|
checkpointId: Pe,
|
|
4543
4548
|
command: y == null ? void 0 : y.command,
|
|
4544
4549
|
edit: y == null ? void 0 : y.edit
|
|
4545
4550
|
};
|
|
4546
|
-
return
|
|
4551
|
+
return P(xe, L);
|
|
4547
4552
|
},
|
|
4548
|
-
[l, a,
|
|
4549
|
-
),
|
|
4553
|
+
[l, a, E, g, v, P, m, f]
|
|
4554
|
+
), R = Y(() => M, [M]), q = Y(
|
|
4550
4555
|
() => ({
|
|
4551
|
-
isStreaming:
|
|
4556
|
+
isStreaming: E,
|
|
4552
4557
|
error: j,
|
|
4553
|
-
connectionState: j ? "error" :
|
|
4554
|
-
messages:
|
|
4558
|
+
connectionState: j ? "error" : E ? C ? "connected" : "connecting" : "idle",
|
|
4559
|
+
messages: R,
|
|
4555
4560
|
activeMessageId: F,
|
|
4556
|
-
submit:
|
|
4557
|
-
stop:
|
|
4561
|
+
submit: U,
|
|
4562
|
+
stop: m,
|
|
4558
4563
|
interrupt: c,
|
|
4559
4564
|
resume: () => Promise.resolve(),
|
|
4560
|
-
goto: (y,
|
|
4565
|
+
goto: (y, L) => Promise.resolve(),
|
|
4561
4566
|
clearError: () => {
|
|
4562
4567
|
}
|
|
4563
4568
|
// TODO: Implement error clearing
|
|
4564
4569
|
}),
|
|
4565
|
-
[
|
|
4570
|
+
[E, j, U, m, c, C, R]
|
|
4566
4571
|
);
|
|
4567
|
-
return /* @__PURE__ */ ie(qt.Provider, { value:
|
|
4572
|
+
return /* @__PURE__ */ ie(qt.Provider, { value: q, children: e });
|
|
4568
4573
|
}
|
|
4569
4574
|
function fe(e) {
|
|
4570
|
-
const t =
|
|
4575
|
+
const t = G(e);
|
|
4571
4576
|
return X(() => {
|
|
4572
4577
|
t.current = e;
|
|
4573
4578
|
}, [e]), _((...n) => {
|
|
@@ -4577,7 +4582,7 @@ function fe(e) {
|
|
|
4577
4582
|
}, []);
|
|
4578
4583
|
}
|
|
4579
4584
|
function Or(e) {
|
|
4580
|
-
return
|
|
4585
|
+
return je(qt);
|
|
4581
4586
|
}
|
|
4582
4587
|
function bt(e) {
|
|
4583
4588
|
return typeof e == "object" && e !== null;
|
|
@@ -4588,78 +4593,78 @@ function $r(e, t) {
|
|
|
4588
4593
|
const n = Object.keys(e), r = Object.keys(t);
|
|
4589
4594
|
if (n.length !== r.length)
|
|
4590
4595
|
return !1;
|
|
4591
|
-
for (const
|
|
4592
|
-
if (!Object.prototype.hasOwnProperty.call(t,
|
|
4596
|
+
for (const o of n)
|
|
4597
|
+
if (!Object.prototype.hasOwnProperty.call(t, o) || !Object.is(e[o], t[o]))
|
|
4593
4598
|
return !1;
|
|
4594
4599
|
return !0;
|
|
4595
4600
|
}
|
|
4596
4601
|
function Dr(e) {
|
|
4597
|
-
const t =
|
|
4602
|
+
const t = G(e), n = G(e);
|
|
4598
4603
|
return $r(t.current, e) || (t.current = e, n.current = e), n.current;
|
|
4599
4604
|
}
|
|
4600
4605
|
function Kr(e) {
|
|
4601
|
-
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,
|
|
4602
|
-
return typeof
|
|
4606
|
+
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;
|
|
4607
|
+
return typeof o == "string" ? o : null;
|
|
4603
4608
|
}
|
|
4604
|
-
function
|
|
4609
|
+
function fo(e) {
|
|
4605
4610
|
const { setCurrentTaskId: t, getCurrentTaskId: n, onToolEnd: r } = e;
|
|
4606
|
-
return (
|
|
4607
|
-
const
|
|
4608
|
-
|
|
4611
|
+
return (o) => {
|
|
4612
|
+
const s = Kr(o), a = (n == null ? void 0 : n()) ?? null;
|
|
4613
|
+
s && s !== a && t(s), r == null || r(o);
|
|
4609
4614
|
};
|
|
4610
4615
|
}
|
|
4611
|
-
function
|
|
4616
|
+
function po({
|
|
4612
4617
|
children: e,
|
|
4613
4618
|
apiConfig: t,
|
|
4614
4619
|
initialThreadId: n = null,
|
|
4615
4620
|
initialCheckpointId: r = null,
|
|
4616
|
-
initialCheckpointNs:
|
|
4617
|
-
autoLoadInitial:
|
|
4621
|
+
initialCheckpointNs: o = null,
|
|
4622
|
+
autoLoadInitial: s = !0,
|
|
4618
4623
|
onConnectionError: a,
|
|
4619
4624
|
onError: i,
|
|
4620
|
-
onAuthError:
|
|
4625
|
+
onAuthError: d,
|
|
4621
4626
|
onThreadChange: c,
|
|
4622
4627
|
onToolEnd: l,
|
|
4623
|
-
onUpdateEvent:
|
|
4624
|
-
onCustomEvent:
|
|
4625
|
-
onMetadataEvent:
|
|
4628
|
+
onUpdateEvent: f,
|
|
4629
|
+
onCustomEvent: p,
|
|
4630
|
+
onMetadataEvent: g,
|
|
4626
4631
|
onFinish: I
|
|
4627
4632
|
}) {
|
|
4628
|
-
const
|
|
4633
|
+
const u = Dr(t), [v, x] = $(!1), M = pe(i), A = pe(d), w = pe(a), b = pe(c), h = pe(l), T = pe(f), m = pe(p), k = pe(g), E = pe(I), j = Y(
|
|
4629
4634
|
() => ({
|
|
4630
4635
|
onError: M,
|
|
4631
4636
|
onAuthError: A,
|
|
4632
|
-
onConnectionError:
|
|
4637
|
+
onConnectionError: w,
|
|
4633
4638
|
onToolEnd: h,
|
|
4634
4639
|
onUpdateEvent: T,
|
|
4635
|
-
onCustomEvent:
|
|
4636
|
-
onMetadataEvent:
|
|
4637
|
-
onFinish:
|
|
4640
|
+
onCustomEvent: m,
|
|
4641
|
+
onMetadataEvent: k,
|
|
4642
|
+
onFinish: E
|
|
4638
4643
|
}),
|
|
4639
4644
|
[
|
|
4640
4645
|
M,
|
|
4641
4646
|
A,
|
|
4642
|
-
|
|
4647
|
+
w,
|
|
4643
4648
|
h,
|
|
4644
4649
|
T,
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4650
|
+
m,
|
|
4651
|
+
k,
|
|
4652
|
+
E
|
|
4648
4653
|
]
|
|
4649
4654
|
);
|
|
4650
|
-
return /* @__PURE__ */ ie(nr, { apiConfig:
|
|
4655
|
+
return /* @__PURE__ */ ie(nr, { apiConfig: u, children: /* @__PURE__ */ ie(
|
|
4651
4656
|
mr,
|
|
4652
4657
|
{
|
|
4653
4658
|
initialThreadId: n,
|
|
4654
4659
|
onError: M,
|
|
4655
4660
|
onThreadChange: b,
|
|
4656
4661
|
children: /* @__PURE__ */ ie(
|
|
4657
|
-
|
|
4662
|
+
jr,
|
|
4658
4663
|
{
|
|
4659
4664
|
initialThreadId: n,
|
|
4660
4665
|
initialCheckpointId: r,
|
|
4661
|
-
initialCheckpointNs:
|
|
4662
|
-
autoLoadInitial:
|
|
4666
|
+
initialCheckpointNs: o,
|
|
4667
|
+
autoLoadInitial: s,
|
|
4663
4668
|
onError: M,
|
|
4664
4669
|
isStreaming: v,
|
|
4665
4670
|
children: /* @__PURE__ */ ie(
|
|
@@ -4676,7 +4681,7 @@ function fs({
|
|
|
4676
4681
|
) });
|
|
4677
4682
|
}
|
|
4678
4683
|
function pe(e) {
|
|
4679
|
-
const t =
|
|
4684
|
+
const t = G(e);
|
|
4680
4685
|
return t.current = e, _((...n) => {
|
|
4681
4686
|
const r = t.current;
|
|
4682
4687
|
if (r)
|
|
@@ -4743,9 +4748,9 @@ function Le(e) {
|
|
|
4743
4748
|
});
|
|
4744
4749
|
}
|
|
4745
4750
|
function Wr({ ...e }) {
|
|
4746
|
-
const t = Hr(), n = (
|
|
4751
|
+
const t = Hr(), n = (o) => Le({
|
|
4747
4752
|
type: "UPDATE_TOAST",
|
|
4748
|
-
toast: { ...
|
|
4753
|
+
toast: { ...o, id: t }
|
|
4749
4754
|
}), r = () => Le({ type: "DISMISS_TOAST", toastId: t });
|
|
4750
4755
|
return Le({
|
|
4751
4756
|
type: "ADD_TOAST",
|
|
@@ -4753,8 +4758,8 @@ function Wr({ ...e }) {
|
|
|
4753
4758
|
...e,
|
|
4754
4759
|
id: t,
|
|
4755
4760
|
open: !0,
|
|
4756
|
-
onOpenChange: (
|
|
4757
|
-
|
|
4761
|
+
onOpenChange: (o) => {
|
|
4762
|
+
o || r();
|
|
4758
4763
|
}
|
|
4759
4764
|
}
|
|
4760
4765
|
}), {
|
|
@@ -4774,56 +4779,56 @@ function Jr() {
|
|
|
4774
4779
|
dismiss: (n) => Le({ type: "DISMISS_TOAST", toastId: n })
|
|
4775
4780
|
};
|
|
4776
4781
|
}
|
|
4777
|
-
function
|
|
4778
|
-
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Me(), { toast:
|
|
4779
|
-
l(!1),
|
|
4780
|
-
}, []),
|
|
4781
|
-
|
|
4782
|
-
}, []),
|
|
4783
|
-
async (I,
|
|
4782
|
+
function go(e) {
|
|
4783
|
+
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Me(), { toast: o } = Jr(), [s, a] = $({}), [i, d] = $(null), [c, l] = $(!1), f = _(() => {
|
|
4784
|
+
l(!1), d(null);
|
|
4785
|
+
}, []), p = _((I) => {
|
|
4786
|
+
d(I), l(!0);
|
|
4787
|
+
}, []), g = _(
|
|
4788
|
+
async (I, u, v) => {
|
|
4784
4789
|
var x, M;
|
|
4785
4790
|
if (!t) {
|
|
4786
4791
|
I.preventDefault();
|
|
4787
4792
|
return;
|
|
4788
4793
|
}
|
|
4789
|
-
if (
|
|
4794
|
+
if (s[v]) {
|
|
4790
4795
|
I.preventDefault();
|
|
4791
4796
|
return;
|
|
4792
4797
|
}
|
|
4793
4798
|
try {
|
|
4794
|
-
const A = String(
|
|
4795
|
-
if (
|
|
4799
|
+
const A = String(u.url ?? ""), w = A.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
|
|
4800
|
+
if (w) {
|
|
4796
4801
|
I.preventDefault();
|
|
4797
|
-
const b =
|
|
4798
|
-
|
|
4802
|
+
const b = w[1], h = u.name || `file_${b}`, T = u.mimeType || "application/octet-stream";
|
|
4803
|
+
p({ id: b, name: h, mimeType: T });
|
|
4799
4804
|
return;
|
|
4800
4805
|
}
|
|
4801
4806
|
if (A.startsWith("data:")) {
|
|
4802
4807
|
I.preventDefault(), a((h) => ({ ...h, [v]: !0 }));
|
|
4803
|
-
const b =
|
|
4808
|
+
const b = o({ title: "Fetching file...", description: "", open: !0 });
|
|
4804
4809
|
try {
|
|
4805
4810
|
const h = await r.listFiles(n ?? void 0);
|
|
4806
4811
|
if (!h || !Array.isArray(h))
|
|
4807
4812
|
throw new Error("Invalid file list response");
|
|
4808
|
-
const T = h.find((
|
|
4813
|
+
const T = h.find((m) => !m || typeof m != "object" || !((m.filename ?? "") === (u.name ?? "")) ? !1 : typeof u.size == "number" && typeof m.size == "number" ? m.size === u.size : !0);
|
|
4809
4814
|
if (!(T != null && T.id))
|
|
4810
|
-
throw new Error(`File "${
|
|
4815
|
+
throw new Error(`File "${u.name}" is not yet available on the server`);
|
|
4811
4816
|
if (!T.id || !T.filename)
|
|
4812
4817
|
throw new Error("Invalid file data received from server");
|
|
4813
|
-
|
|
4818
|
+
p({
|
|
4814
4819
|
id: T.id,
|
|
4815
|
-
name:
|
|
4816
|
-
mimeType:
|
|
4820
|
+
name: u.name || T.filename || `file_${T.id}`,
|
|
4821
|
+
mimeType: u.mimeType || T.mime_type || "application/octet-stream"
|
|
4817
4822
|
}), (x = b.update) == null || x.call(b, {
|
|
4818
4823
|
id: b.id,
|
|
4819
4824
|
title: "Success",
|
|
4820
|
-
description: `Opened ${
|
|
4825
|
+
description: `Opened ${u.name}`,
|
|
4821
4826
|
open: !0
|
|
4822
4827
|
});
|
|
4823
4828
|
} catch (h) {
|
|
4824
4829
|
console.error("Failed to fetch server file:", h);
|
|
4825
4830
|
const T = h instanceof Error ? h.message : "Unknown error occurred";
|
|
4826
|
-
(M = b.update) == null || M.call(b, { id: b.id, title: "Failed", description: T }),
|
|
4831
|
+
(M = b.update) == null || M.call(b, { id: b.id, title: "Failed", description: T }), o({
|
|
4827
4832
|
title: "Failed to fetch file",
|
|
4828
4833
|
description: T,
|
|
4829
4834
|
open: !0
|
|
@@ -4833,26 +4838,26 @@ function ps(e) {
|
|
|
4833
4838
|
}
|
|
4834
4839
|
}
|
|
4835
4840
|
} catch (A) {
|
|
4836
|
-
console.error("File click error:", A), a((
|
|
4841
|
+
console.error("File click error:", A), a((w) => ({ ...w, [v]: !1 }));
|
|
4837
4842
|
}
|
|
4838
4843
|
},
|
|
4839
|
-
[t,
|
|
4844
|
+
[t, s, o, n, p]
|
|
4840
4845
|
);
|
|
4841
4846
|
return {
|
|
4842
|
-
uploadingFiles:
|
|
4843
|
-
handleFileClick:
|
|
4847
|
+
uploadingFiles: s,
|
|
4848
|
+
handleFileClick: g,
|
|
4844
4849
|
fileViewerOpen: c,
|
|
4845
4850
|
currentFileInfo: i,
|
|
4846
|
-
closeFileViewer:
|
|
4851
|
+
closeFileViewer: f
|
|
4847
4852
|
};
|
|
4848
4853
|
}
|
|
4849
|
-
function
|
|
4854
|
+
function mo(e) {
|
|
4850
4855
|
return Y(() => {
|
|
4851
4856
|
const t = e;
|
|
4852
4857
|
let n = Array.isArray(t.content) ? t.content : [];
|
|
4853
4858
|
return typeof t.content == "string" && (n = [{ type: "text", text: t.content }]), {
|
|
4854
4859
|
contentParts: n,
|
|
4855
|
-
textContent:
|
|
4860
|
+
textContent: sr(n),
|
|
4856
4861
|
toolMeta: ar(t),
|
|
4857
4862
|
imageParts: n.filter((r) => r.type === "image_url"),
|
|
4858
4863
|
fileParts: n.filter((r) => r.type === "file"),
|
|
@@ -4866,13 +4871,13 @@ function Xr(e) {
|
|
|
4866
4871
|
if (!e) return [];
|
|
4867
4872
|
const t = [], n = e.split(/\r?\n/);
|
|
4868
4873
|
for (const r of n) {
|
|
4869
|
-
const
|
|
4870
|
-
if (!
|
|
4874
|
+
const o = r.trim();
|
|
4875
|
+
if (!o || !o.startsWith(kt))
|
|
4871
4876
|
continue;
|
|
4872
|
-
const
|
|
4873
|
-
if (!
|
|
4877
|
+
const s = o.slice(kt.length).trim();
|
|
4878
|
+
if (!s || s.toLowerCase() === "[done]")
|
|
4874
4879
|
continue;
|
|
4875
|
-
const a = tt(
|
|
4880
|
+
const a = tt(s);
|
|
4876
4881
|
a && typeof a == "object" && t.push(a);
|
|
4877
4882
|
}
|
|
4878
4883
|
return t;
|
|
@@ -4885,58 +4890,58 @@ function Qr(e) {
|
|
|
4885
4890
|
}
|
|
4886
4891
|
return null;
|
|
4887
4892
|
}
|
|
4888
|
-
function
|
|
4893
|
+
function yo(e) {
|
|
4889
4894
|
return Y(() => {
|
|
4890
4895
|
const t = e.content.filter(
|
|
4891
|
-
(
|
|
4896
|
+
(d) => d.type === "text"
|
|
4892
4897
|
);
|
|
4893
4898
|
if (!t.length)
|
|
4894
4899
|
return null;
|
|
4895
4900
|
let r = t.flatMap(
|
|
4896
|
-
(
|
|
4901
|
+
(d) => Xr(d.text ?? "")
|
|
4897
4902
|
);
|
|
4898
4903
|
if (!r.length) {
|
|
4899
|
-
const
|
|
4900
|
-
`), c = tt(
|
|
4904
|
+
const d = t.map((l) => l.text ?? "").join(`
|
|
4905
|
+
`), c = tt(d);
|
|
4901
4906
|
c && typeof c == "object" && (r = [c]);
|
|
4902
4907
|
}
|
|
4903
4908
|
if (!r.length)
|
|
4904
4909
|
return null;
|
|
4905
|
-
const
|
|
4906
|
-
if (!
|
|
4910
|
+
const s = Qr(r) ?? r[r.length - 1];
|
|
4911
|
+
if (!s)
|
|
4907
4912
|
return null;
|
|
4908
|
-
const a =
|
|
4913
|
+
const a = s.output ?? s.payload ?? s, i = ce(a);
|
|
4909
4914
|
return i && typeof i == "object" && !Array.isArray(i) ? {
|
|
4910
4915
|
kind: "dict",
|
|
4911
4916
|
value: i,
|
|
4912
4917
|
data: i,
|
|
4913
|
-
event:
|
|
4918
|
+
event: s
|
|
4914
4919
|
} : {
|
|
4915
4920
|
kind: "generic",
|
|
4916
4921
|
value: i,
|
|
4917
|
-
event:
|
|
4922
|
+
event: s
|
|
4918
4923
|
};
|
|
4919
4924
|
}, [e]);
|
|
4920
4925
|
}
|
|
4921
4926
|
function Yr(e) {
|
|
4922
4927
|
var C, O;
|
|
4923
|
-
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r =
|
|
4928
|
+
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r = ot({ optional: !0 }), o = Vt({ optional: !0 }), s = Or(), { currentThreadId: a, setCurrentThreadId: i, actions: d } = r || {
|
|
4924
4929
|
currentThreadId: null,
|
|
4925
4930
|
setCurrentThreadId: () => {
|
|
4926
4931
|
},
|
|
4927
4932
|
actions: {}
|
|
4928
|
-
}, c = !!t && t !== a, [l,
|
|
4929
|
-
|
|
4933
|
+
}, c = !!t && t !== a, [l, f] = $([]), p = _((F) => {
|
|
4934
|
+
f(F);
|
|
4930
4935
|
}, []), {
|
|
4931
|
-
isLoadingThread:
|
|
4936
|
+
isLoadingThread: g,
|
|
4932
4937
|
threadStateError: I,
|
|
4933
|
-
threadCheckpoints:
|
|
4938
|
+
threadCheckpoints: u,
|
|
4934
4939
|
isLoadingHistory: v,
|
|
4935
4940
|
loadThread: x
|
|
4936
4941
|
} = $t({
|
|
4937
4942
|
api: Me().chatApi,
|
|
4938
4943
|
fileApi: Me().fileApi,
|
|
4939
|
-
seed:
|
|
4944
|
+
seed: p,
|
|
4940
4945
|
currentThreadId: c ? t : null,
|
|
4941
4946
|
initialThreadId: c ? t : null,
|
|
4942
4947
|
isStreaming: !1,
|
|
@@ -4944,51 +4949,51 @@ function Yr(e) {
|
|
|
4944
4949
|
autoLoadInitial: c && !n
|
|
4945
4950
|
});
|
|
4946
4951
|
X(() => {
|
|
4947
|
-
!c && !n && a && (
|
|
4948
|
-
}, [c, n, a,
|
|
4952
|
+
!c && !n && a && (o != null && o.loadThread) && o.loadThread(a);
|
|
4953
|
+
}, [c, n, a, o == null ? void 0 : o.loadThread]);
|
|
4949
4954
|
const M = Y(() => {
|
|
4950
4955
|
var F;
|
|
4951
|
-
return ((F =
|
|
4952
|
-
}, [
|
|
4956
|
+
return ((F = u[0]) == null ? void 0 : F.values) || {};
|
|
4957
|
+
}, [u]), A = Y(() => ({ timeline: [], messagePreviews: {} }), []), w = t || a, b = c ? g ? "loading" : "idle" : (o == null ? void 0 : o.status) || "idle", h = c ? l : (s == null ? void 0 : s.messages) || [], T = c ? g : (o == null ? void 0 : o.isLoading) || !1, m = c ? v : (o == null ? void 0 : o.isLoadingHistory) || !1, k = c ? M : (o == null ? void 0 : o.values) || {}, E = c ? {} : (o == null ? void 0 : o.taskMessagesByScope) || {}, j = c ? I : (s == null ? void 0 : s.error) || (o == null ? void 0 : o.error) || null;
|
|
4953
4958
|
return {
|
|
4954
4959
|
// UNIFIED: Single thread ID concept
|
|
4955
|
-
threadId:
|
|
4960
|
+
threadId: w,
|
|
4956
4961
|
status: b,
|
|
4957
4962
|
messages: h,
|
|
4958
4963
|
isLoading: T,
|
|
4959
|
-
isHistoryLoading:
|
|
4964
|
+
isHistoryLoading: m,
|
|
4960
4965
|
error: j,
|
|
4961
4966
|
// Values & Metadata
|
|
4962
|
-
values:
|
|
4963
|
-
taskMessagesByScope:
|
|
4964
|
-
metadata: c ? {} :
|
|
4967
|
+
values: k,
|
|
4968
|
+
taskMessagesByScope: E,
|
|
4969
|
+
metadata: c ? {} : o == null ? void 0 : o.metadata,
|
|
4965
4970
|
// Actions & State relating to Global/Active Thread only
|
|
4966
4971
|
navigateToCheckpoint: c ? async () => {
|
|
4967
|
-
} : (
|
|
4972
|
+
} : (o == null ? void 0 : o.navigateToCheckpoint) || (async () => {
|
|
4968
4973
|
}),
|
|
4969
4974
|
returnToLatest: c ? async () => {
|
|
4970
|
-
} : (
|
|
4975
|
+
} : (o == null ? void 0 : o.returnToLatest) || (async () => {
|
|
4971
4976
|
}),
|
|
4972
|
-
checkpoint: c ?
|
|
4973
|
-
checkpoints: c ?
|
|
4974
|
-
checkpointIndex: c ? A : (
|
|
4975
|
-
interrupt: c ? null : (
|
|
4977
|
+
checkpoint: c ? u[0] ? { id: u[0].checkpointId, namespace: u[0].checkpointNs } : null : (o == null ? void 0 : o.checkpoint) || null,
|
|
4978
|
+
checkpoints: c ? u : (o == null ? void 0 : o.checkpoints) || [],
|
|
4979
|
+
checkpointIndex: c ? A : (o == null ? void 0 : o.checkpointIndex) || { timeline: [], messagePreviews: {} },
|
|
4980
|
+
interrupt: c ? null : (o == null ? void 0 : o.interrupt) || null,
|
|
4976
4981
|
respondToInterrupt: c ? async () => {
|
|
4977
|
-
} : (
|
|
4982
|
+
} : (o == null ? void 0 : o.respondToInterrupt) || (async () => {
|
|
4978
4983
|
}),
|
|
4979
4984
|
// Streaming Status
|
|
4980
4985
|
// Even in standalone mode, allow streaming state/stop if a stream context exists.
|
|
4981
|
-
isStreaming: (
|
|
4982
|
-
activeMessageId: c ? null : ((C =
|
|
4983
|
-
connectionState: (
|
|
4984
|
-
streamingAssistantId: !c && (
|
|
4986
|
+
isStreaming: (s == null ? void 0 : s.isStreaming) || !1,
|
|
4987
|
+
activeMessageId: c ? null : ((C = o == null ? void 0 : o.metadata) == null ? void 0 : C.assemblingMessageId) || (s == null ? void 0 : s.activeMessageId) || null,
|
|
4988
|
+
connectionState: (s == null ? void 0 : s.connectionState) || "disconnected",
|
|
4989
|
+
streamingAssistantId: !c && (s != null && s.isStreaming) && ((O = o == null ? void 0 : o.metadata) != null && O.assemblingMessageId) ? o.metadata.assemblingMessageId : null,
|
|
4985
4990
|
// Actions
|
|
4986
|
-
submit: (
|
|
4991
|
+
submit: (s == null ? void 0 : s.submit) || (async () => {
|
|
4987
4992
|
}),
|
|
4988
|
-
stop: (
|
|
4993
|
+
stop: (s == null ? void 0 : s.stop) || (() => {
|
|
4989
4994
|
}),
|
|
4990
4995
|
clearThread: c ? async () => {
|
|
4991
|
-
} : (
|
|
4996
|
+
} : (o == null ? void 0 : o.clearThread) || (async () => {
|
|
4992
4997
|
}),
|
|
4993
4998
|
setCurrentThreadId: i,
|
|
4994
4999
|
loadHistory: c ? async () => {
|
|
@@ -4996,70 +5001,70 @@ function Yr(e) {
|
|
|
4996
5001
|
} : async () => {
|
|
4997
5002
|
},
|
|
4998
5003
|
onEvent: c ? () => {
|
|
4999
|
-
} : (
|
|
5004
|
+
} : (o == null ? void 0 : o.onEvent) || (() => {
|
|
5000
5005
|
}),
|
|
5001
5006
|
// Thread Management
|
|
5002
|
-
createThread:
|
|
5003
|
-
deleteThread:
|
|
5004
|
-
renameThread:
|
|
5007
|
+
createThread: d == null ? void 0 : d.createThread,
|
|
5008
|
+
deleteThread: d == null ? void 0 : d.deleteThread,
|
|
5009
|
+
renameThread: d == null ? void 0 : d.renameThread,
|
|
5005
5010
|
threads: (r == null ? void 0 : r.threads) || [],
|
|
5006
5011
|
isThreadsLoading: (r == null ? void 0 : r.isLoading) || !1
|
|
5007
5012
|
};
|
|
5008
5013
|
}
|
|
5009
|
-
function
|
|
5014
|
+
function ho({
|
|
5010
5015
|
submit: e,
|
|
5011
5016
|
chatRequest: t,
|
|
5012
5017
|
lastCheckpointId: n,
|
|
5013
5018
|
lastCheckpointNs: r,
|
|
5014
|
-
onMessageSent:
|
|
5015
|
-
onExcelUploadSuccess:
|
|
5019
|
+
onMessageSent: o,
|
|
5020
|
+
onExcelUploadSuccess: s,
|
|
5016
5021
|
onError: a,
|
|
5017
5022
|
enableMessageEditing: i,
|
|
5018
|
-
messages:
|
|
5023
|
+
messages: d,
|
|
5019
5024
|
setPendingAssistantResponse: c,
|
|
5020
5025
|
project: l,
|
|
5021
|
-
onEvent:
|
|
5022
|
-
threadId:
|
|
5023
|
-
clearComposerOnSend:
|
|
5026
|
+
onEvent: f,
|
|
5027
|
+
threadId: p,
|
|
5028
|
+
clearComposerOnSend: g = !0
|
|
5024
5029
|
}) {
|
|
5025
|
-
const { messages: I } = Yr(), [
|
|
5030
|
+
const { messages: I } = Yr(), [u, v] = $(null), [x, M] = $(""), [A, w] = $(null), [b, h] = $(null), [T, m] = $(!1), [k, E] = $(""), j = G(k), C = G(null);
|
|
5026
5031
|
X(() => {
|
|
5027
|
-
if (!
|
|
5028
|
-
if (
|
|
5029
|
-
const y = localStorage.getItem(Ge(
|
|
5030
|
-
|
|
5032
|
+
if (!u)
|
|
5033
|
+
if (p) {
|
|
5034
|
+
const y = localStorage.getItem(Ge(p));
|
|
5035
|
+
E(y || "");
|
|
5031
5036
|
} else
|
|
5032
|
-
|
|
5033
|
-
}, [
|
|
5037
|
+
E("");
|
|
5038
|
+
}, [p, u]);
|
|
5034
5039
|
const O = _((y) => {
|
|
5035
|
-
|
|
5036
|
-
}, [
|
|
5040
|
+
E(y), !u && p && localStorage.setItem(Ge(p), y);
|
|
5041
|
+
}, [p, u]);
|
|
5037
5042
|
X(() => {
|
|
5038
|
-
j.current =
|
|
5039
|
-
}, [
|
|
5040
|
-
if (!
|
|
5043
|
+
j.current = k;
|
|
5044
|
+
}, [k]), X(() => {
|
|
5045
|
+
if (!u) {
|
|
5041
5046
|
C.current = null;
|
|
5042
5047
|
return;
|
|
5043
5048
|
}
|
|
5044
5049
|
C.current === null && (C.current = j.current), O(x ?? "");
|
|
5045
|
-
}, [x,
|
|
5050
|
+
}, [x, u, O]);
|
|
5046
5051
|
const F = _(
|
|
5047
5052
|
(y) => {
|
|
5048
5053
|
O(y);
|
|
5049
5054
|
},
|
|
5050
5055
|
[O]
|
|
5051
|
-
),
|
|
5052
|
-
const S = Array.isArray(
|
|
5053
|
-
if (!(!
|
|
5056
|
+
), P = async (y, L) => {
|
|
5057
|
+
const S = Array.isArray(L) ? { files: L } : L ?? {}, W = S.files ?? [], K = S.contentParts ?? [], V = y.trim();
|
|
5058
|
+
if (!(!V && W.length === 0 && K.length === 0))
|
|
5054
5059
|
try {
|
|
5055
|
-
const ee =
|
|
5060
|
+
const ee = W.map(async (Q) => {
|
|
5056
5061
|
try {
|
|
5057
5062
|
const Z = await Rt.uploadFile(Q);
|
|
5058
5063
|
return { file: Q, record: Z };
|
|
5059
5064
|
} catch (Z) {
|
|
5060
5065
|
throw console.error("Failed to upload file", Q.name, Z), new Error(`Failed to upload ${Q.name}`);
|
|
5061
5066
|
}
|
|
5062
|
-
}),
|
|
5067
|
+
}), de = (await Promise.all(ee)).map(({ record: Q }) => {
|
|
5063
5068
|
const Z = Q.mime_type;
|
|
5064
5069
|
return Z.startsWith("image/") ? {
|
|
5065
5070
|
type: "image_url",
|
|
@@ -5071,28 +5076,28 @@ function ys({
|
|
|
5071
5076
|
name: Q.filename,
|
|
5072
5077
|
size: Q.size
|
|
5073
5078
|
};
|
|
5074
|
-
}),
|
|
5079
|
+
}), H = [...K, ...de], te = u ? (A == null ? void 0 : A.checkpointId) ?? n ?? void 0 : n ?? void 0, ke = u ? (A == null ? void 0 : A.checkpointNs) ?? r ?? void 0 : r ?? void 0;
|
|
5075
5080
|
await e(
|
|
5076
5081
|
{
|
|
5077
|
-
text:
|
|
5078
|
-
contentParts:
|
|
5079
|
-
attachments:
|
|
5082
|
+
text: V || "",
|
|
5083
|
+
contentParts: H,
|
|
5084
|
+
attachments: W,
|
|
5080
5085
|
payload: t.payload,
|
|
5081
|
-
edit: !!
|
|
5086
|
+
edit: !!u,
|
|
5082
5087
|
checkpointId: te,
|
|
5083
5088
|
checkpointNs: ke,
|
|
5084
5089
|
project: l ?? void 0,
|
|
5085
|
-
originalMessageId:
|
|
5090
|
+
originalMessageId: u ?? void 0,
|
|
5086
5091
|
config: t.config
|
|
5087
5092
|
},
|
|
5088
|
-
|
|
5089
|
-
),
|
|
5093
|
+
f ? { onEvent: f } : void 0
|
|
5094
|
+
), o == null || o(V), c(!0), g && (p && localStorage.removeItem(Ge(p)), O("")), h(null), v(null), M(""), w(null);
|
|
5090
5095
|
} catch (ee) {
|
|
5091
5096
|
const re = (ee == null ? void 0 : ee.message) || "Failed to send message";
|
|
5092
5097
|
h(re), a == null || a(re), c(!1);
|
|
5093
5098
|
}
|
|
5094
|
-
}, B = (y,
|
|
5095
|
-
|
|
5099
|
+
}, B = (y, L) => {
|
|
5100
|
+
L || P(y, { files: [] });
|
|
5096
5101
|
}, z = _(
|
|
5097
5102
|
async (y) => {
|
|
5098
5103
|
await e(
|
|
@@ -5104,73 +5109,73 @@ function ys({
|
|
|
5104
5109
|
project: l ?? void 0,
|
|
5105
5110
|
config: t.config
|
|
5106
5111
|
},
|
|
5107
|
-
|
|
5108
|
-
),
|
|
5112
|
+
f ? { onEvent: f } : void 0
|
|
5113
|
+
), s == null || s({ file: y });
|
|
5109
5114
|
},
|
|
5110
|
-
[n, r, t,
|
|
5111
|
-
),
|
|
5112
|
-
(y,
|
|
5113
|
-
i && (C.current =
|
|
5115
|
+
[n, r, t, s, e]
|
|
5116
|
+
), J = _(
|
|
5117
|
+
(y, L, S) => {
|
|
5118
|
+
i && (C.current = k, v(y), M(L), w({
|
|
5114
5119
|
checkpointId: (S == null ? void 0 : S.checkpointId) ?? null,
|
|
5115
5120
|
checkpointNs: (S == null ? void 0 : S.checkpointNs) ?? null
|
|
5116
5121
|
}), h(null));
|
|
5117
5122
|
},
|
|
5118
|
-
[
|
|
5119
|
-
),
|
|
5120
|
-
v(null), M(""),
|
|
5123
|
+
[k, i]
|
|
5124
|
+
), U = _(() => {
|
|
5125
|
+
v(null), M(""), w(null), h(null);
|
|
5121
5126
|
const y = C.current;
|
|
5122
|
-
y !== null &&
|
|
5123
|
-
}, []),
|
|
5124
|
-
let
|
|
5125
|
-
for (let
|
|
5126
|
-
if (
|
|
5127
|
-
|
|
5127
|
+
y !== null && E(y), C.current = null;
|
|
5128
|
+
}, []), R = _((y) => {
|
|
5129
|
+
let L = null;
|
|
5130
|
+
for (let V = y - 1; V >= 0; V--)
|
|
5131
|
+
if (d[V].role === "user") {
|
|
5132
|
+
L = d[V];
|
|
5128
5133
|
break;
|
|
5129
5134
|
}
|
|
5130
|
-
if (!
|
|
5131
|
-
const S = Array.isArray(
|
|
5135
|
+
if (!L) return;
|
|
5136
|
+
const S = Array.isArray(L.content) ? L.content : [], K = S.filter((V) => (V == null ? void 0 : V.type) === "text").map((V) => V.text).join("") || (() => {
|
|
5132
5137
|
try {
|
|
5133
5138
|
return JSON.stringify(S, null, 2);
|
|
5134
5139
|
} catch {
|
|
5135
5140
|
return String(S);
|
|
5136
5141
|
}
|
|
5137
5142
|
})();
|
|
5138
|
-
|
|
5143
|
+
K && e(
|
|
5139
5144
|
{
|
|
5140
|
-
text:
|
|
5145
|
+
text: K,
|
|
5141
5146
|
payload: t.payload,
|
|
5142
5147
|
checkpointId: n ?? void 0,
|
|
5143
5148
|
checkpointNs: r ?? void 0,
|
|
5144
5149
|
edit: !0,
|
|
5145
|
-
originalMessageId:
|
|
5150
|
+
originalMessageId: L.id,
|
|
5146
5151
|
config: t.config
|
|
5147
5152
|
},
|
|
5148
|
-
|
|
5153
|
+
f ? { onEvent: f } : void 0
|
|
5149
5154
|
);
|
|
5150
|
-
}, [
|
|
5155
|
+
}, [d, e, n, r, t]);
|
|
5151
5156
|
return {
|
|
5152
|
-
editingMessageId:
|
|
5157
|
+
editingMessageId: u,
|
|
5153
5158
|
editingInitialValue: x,
|
|
5154
5159
|
inputError: b,
|
|
5155
5160
|
setInputError: h,
|
|
5156
5161
|
dismissError: T,
|
|
5157
|
-
setDismissError:
|
|
5158
|
-
composerValue:
|
|
5162
|
+
setDismissError: m,
|
|
5163
|
+
composerValue: k,
|
|
5159
5164
|
handleComposerChange: F,
|
|
5160
|
-
handleSendMessage:
|
|
5165
|
+
handleSendMessage: P,
|
|
5161
5166
|
handleQuickPrompt: B,
|
|
5162
5167
|
handleExcelUpload: z,
|
|
5163
|
-
startEditing:
|
|
5164
|
-
cancelEditing:
|
|
5165
|
-
handleRegenerateCb:
|
|
5168
|
+
startEditing: J,
|
|
5169
|
+
cancelEditing: U,
|
|
5170
|
+
handleRegenerateCb: R,
|
|
5166
5171
|
displayMessages: I
|
|
5167
5172
|
};
|
|
5168
5173
|
}
|
|
5169
|
-
function
|
|
5174
|
+
function bo(e) {
|
|
5170
5175
|
return Y(() => e ? {
|
|
5171
5176
|
textContent: Ln(e),
|
|
5172
|
-
imageParts:
|
|
5173
|
-
fileParts:
|
|
5177
|
+
imageParts: jn(e),
|
|
5178
|
+
fileParts: Un(e),
|
|
5174
5179
|
toolCalls: Mt(e),
|
|
5175
5180
|
contentParts: e.content
|
|
5176
5181
|
} : {
|
|
@@ -5181,12 +5186,12 @@ function hs(e) {
|
|
|
5181
5186
|
contentParts: []
|
|
5182
5187
|
}, [e]);
|
|
5183
5188
|
}
|
|
5184
|
-
function
|
|
5185
|
-
const [r,
|
|
5189
|
+
function wo(e, t, n) {
|
|
5190
|
+
const [r, o] = $(e), s = G(e), a = G(null);
|
|
5186
5191
|
return X(() => {
|
|
5187
|
-
|
|
5192
|
+
s.current = e;
|
|
5188
5193
|
const i = () => {
|
|
5189
|
-
s
|
|
5194
|
+
o(s.current), a.current && (clearTimeout(a.current), a.current = null);
|
|
5190
5195
|
};
|
|
5191
5196
|
if (!t || n <= 0) {
|
|
5192
5197
|
i();
|
|
@@ -5200,26 +5205,26 @@ function bs(e, t, n) {
|
|
|
5200
5205
|
}, [e, t, n]), r;
|
|
5201
5206
|
}
|
|
5202
5207
|
export {
|
|
5203
|
-
|
|
5204
|
-
|
|
5208
|
+
po as ChatProviders,
|
|
5209
|
+
jr as ThreadStateProvider,
|
|
5205
5210
|
mr as ThreadsProvider,
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5211
|
+
ro as cn,
|
|
5212
|
+
sr as collectText,
|
|
5213
|
+
fo as createTaskSyncToolEndHandler,
|
|
5209
5214
|
Kr as extractTaskIdFromToolEnd,
|
|
5210
5215
|
ar as extractToolMeta,
|
|
5211
|
-
|
|
5212
|
-
|
|
5216
|
+
oo as formatToolOutput,
|
|
5217
|
+
co as getAgentNameFromMessage,
|
|
5213
5218
|
Pt as getChatToken,
|
|
5214
|
-
|
|
5215
|
-
|
|
5219
|
+
uo as getMessageAttemptInfo,
|
|
5220
|
+
ao as getToolCallArtifacts,
|
|
5216
5221
|
qn as getToolCalls,
|
|
5217
|
-
|
|
5222
|
+
so as hasContent,
|
|
5218
5223
|
mt as hydrateHistorySnapshots,
|
|
5219
5224
|
Ct as isFileLike,
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5225
|
+
Nn as looksLikeMarkdown,
|
|
5226
|
+
lo as messageSignature,
|
|
5227
|
+
io as normalizeInterruptId,
|
|
5223
5228
|
_t as onChatTokenChanged,
|
|
5224
5229
|
tt as parseJsonSafe,
|
|
5225
5230
|
Et as pretty,
|
|
@@ -5228,18 +5233,18 @@ export {
|
|
|
5228
5233
|
Ie as setChatToken,
|
|
5229
5234
|
Fn as stringifyTool,
|
|
5230
5235
|
Me as useApi,
|
|
5231
|
-
|
|
5236
|
+
ho as useChatController,
|
|
5232
5237
|
Yr as useChatSession,
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5238
|
+
go as useFilePreview,
|
|
5239
|
+
bo as useMessageContent,
|
|
5240
|
+
mo as useParsedMessageContent,
|
|
5236
5241
|
pr as useStream,
|
|
5237
|
-
|
|
5242
|
+
wo as useStreamingMarkdownBuffer,
|
|
5238
5243
|
$t as useThreadHistoryState,
|
|
5239
5244
|
Vt as useThreadState,
|
|
5240
5245
|
Lr as useThreadStateUpdater,
|
|
5241
|
-
|
|
5246
|
+
ot as useThreads,
|
|
5242
5247
|
gr as useThreadsState,
|
|
5243
|
-
|
|
5248
|
+
yo as useToolPayload
|
|
5244
5249
|
};
|
|
5245
5250
|
//# sourceMappingURL=index.esm.js.map
|