@teodorruskvi/chat-core 0.1.49 → 0.1.51
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 +1073 -1043
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/dist/types/domain/messages.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -5,17 +5,17 @@ import { jsx as ie } from "react/jsx-runtime";
|
|
|
5
5
|
import * as it from "react";
|
|
6
6
|
import { createContext as Ce, useContext as Ue, useState as $, useRef as W, useEffect as X, useCallback as _, useMemo as Y, useReducer as Wt } from "react";
|
|
7
7
|
import Jt, { isCancel as Xt } from "axios";
|
|
8
|
-
function
|
|
8
|
+
function It(e) {
|
|
9
9
|
var t, n, r = "";
|
|
10
10
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
11
11
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
12
|
-
var
|
|
13
|
-
for (t = 0; t <
|
|
12
|
+
var s = e.length;
|
|
13
|
+
for (t = 0; t < s; 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 = "", s = arguments.length; n < s; n++) (e = arguments[n]) && (t = It(e)) && (r && (r += " "), r += t);
|
|
19
19
|
return r;
|
|
20
20
|
}
|
|
21
21
|
const et = "-", Yt = (e) => {
|
|
@@ -26,26 +26,26 @@ const et = "-", Yt = (e) => {
|
|
|
26
26
|
return {
|
|
27
27
|
getClassGroupId: (a) => {
|
|
28
28
|
const i = a.split(et);
|
|
29
|
-
return i[0] === "" && i.length !== 1 && i.shift(),
|
|
29
|
+
return i[0] === "" && i.length !== 1 && i.shift(), vt(i, t) || Zt(a);
|
|
30
30
|
},
|
|
31
31
|
getConflictingClassGroupIds: (a, i) => {
|
|
32
32
|
const u = n[a] || [];
|
|
33
33
|
return i && r[a] ? [...u, ...r[a]] : u;
|
|
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), s = r ? vt(e.slice(1), r) : void 0;
|
|
41
|
+
if (s)
|
|
42
|
+
return s;
|
|
43
43
|
if (t.validators.length === 0)
|
|
44
44
|
return;
|
|
45
|
-
const
|
|
45
|
+
const o = e.join(et);
|
|
46
46
|
return (a = t.validators.find(({
|
|
47
47
|
validator: i
|
|
48
|
-
}) => i(
|
|
48
|
+
}) => i(o))) == 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(([o, a]) => {
|
|
64
|
+
Xe(a, r, o, t);
|
|
65
65
|
}), r;
|
|
66
66
|
}, Xe = (e, t, n, r) => {
|
|
67
|
-
e.forEach((
|
|
68
|
-
if (typeof
|
|
69
|
-
const
|
|
70
|
-
|
|
67
|
+
e.forEach((s) => {
|
|
68
|
+
if (typeof s == "string") {
|
|
69
|
+
const o = s === "" ? t : lt(t, s);
|
|
70
|
+
o.classGroupId = n;
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
if (typeof
|
|
74
|
-
if (tn(
|
|
75
|
-
Xe(
|
|
73
|
+
if (typeof s == "function") {
|
|
74
|
+
if (tn(s)) {
|
|
75
|
+
Xe(s(r), t, n, r);
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
t.validators.push({
|
|
79
|
-
validator:
|
|
79
|
+
validator: s,
|
|
80
80
|
classGroupId: n
|
|
81
81
|
});
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
|
-
Object.entries(
|
|
85
|
-
Xe(a, lt(t,
|
|
84
|
+
Object.entries(s).forEach(([o, a]) => {
|
|
85
|
+
Xe(a, lt(t, o), 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 s = r.map((o) => typeof o == "string" ? t + o : typeof o == "object" ? Object.fromEntries(Object.entries(o).map(([a, i]) => [t + a, i])) : o);
|
|
98
|
+
return [n, s];
|
|
99
99
|
}) : e, rn = (e) => {
|
|
100
100
|
if (e < 1)
|
|
101
101
|
return {
|
|
@@ -105,47 +105,47 @@ 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 s = (o, a) => {
|
|
109
|
+
n.set(o, 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(o) {
|
|
113
|
+
let a = n.get(o);
|
|
114
114
|
if (a !== void 0)
|
|
115
115
|
return a;
|
|
116
|
-
if ((a = r.get(
|
|
117
|
-
return o
|
|
116
|
+
if ((a = r.get(o)) !== void 0)
|
|
117
|
+
return s(o, a), a;
|
|
118
118
|
},
|
|
119
|
-
set(
|
|
120
|
-
n.has(
|
|
119
|
+
set(o, a) {
|
|
120
|
+
n.has(o) ? n.set(o, a) : s(o, a);
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
},
|
|
123
|
+
}, xt = "!", sn = (e) => {
|
|
124
124
|
const {
|
|
125
125
|
separator: t,
|
|
126
126
|
experimentalParseClassName: n
|
|
127
|
-
} = e, r = t.length === 1,
|
|
127
|
+
} = e, r = t.length === 1, s = t[0], o = t.length, a = (i) => {
|
|
128
128
|
const u = [];
|
|
129
129
|
let c = 0, l = 0, d;
|
|
130
|
-
for (let
|
|
131
|
-
let
|
|
130
|
+
for (let v = 0; v < i.length; v++) {
|
|
131
|
+
let x = i[v];
|
|
132
132
|
if (c === 0) {
|
|
133
|
-
if (
|
|
134
|
-
u.push(i.slice(l,
|
|
133
|
+
if (x === s && (r || i.slice(v, v + o) === t)) {
|
|
134
|
+
u.push(i.slice(l, v)), l = v + o;
|
|
135
135
|
continue;
|
|
136
136
|
}
|
|
137
|
-
if (
|
|
138
|
-
d =
|
|
137
|
+
if (x === "/") {
|
|
138
|
+
d = v;
|
|
139
139
|
continue;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
x === "[" ? c++ : x === "]" && c--;
|
|
143
143
|
}
|
|
144
|
-
const
|
|
144
|
+
const g = u.length === 0 ? i : i.substring(l), m = g.startsWith(xt), I = m ? g.substring(1) : g, f = d && d > l ? d - l : void 0;
|
|
145
145
|
return {
|
|
146
146
|
modifiers: u,
|
|
147
|
-
hasImportantModifier:
|
|
148
|
-
baseClassName:
|
|
147
|
+
hasImportantModifier: m,
|
|
148
|
+
baseClassName: I,
|
|
149
149
|
maybePostfixModifierPosition: f
|
|
150
150
|
};
|
|
151
151
|
};
|
|
@@ -153,7 +153,7 @@ const et = "-", Yt = (e) => {
|
|
|
153
153
|
className: i,
|
|
154
154
|
parseClassName: a
|
|
155
155
|
}) : a;
|
|
156
|
-
},
|
|
156
|
+
}, on = (e) => {
|
|
157
157
|
if (e.length <= 1)
|
|
158
158
|
return e;
|
|
159
159
|
const t = [];
|
|
@@ -163,42 +163,42 @@ const et = "-", Yt = (e) => {
|
|
|
163
163
|
}), t.push(...n.sort()), t;
|
|
164
164
|
}, an = (e) => ({
|
|
165
165
|
cache: rn(e.cacheSize),
|
|
166
|
-
parseClassName:
|
|
166
|
+
parseClassName: sn(e),
|
|
167
167
|
...Yt(e)
|
|
168
168
|
}), cn = /\s+/, ln = (e, t) => {
|
|
169
169
|
const {
|
|
170
170
|
parseClassName: n,
|
|
171
171
|
getClassGroupId: r,
|
|
172
|
-
getConflictingClassGroupIds:
|
|
173
|
-
} = t,
|
|
172
|
+
getConflictingClassGroupIds: s
|
|
173
|
+
} = t, o = [], a = e.trim().split(cn);
|
|
174
174
|
let i = "";
|
|
175
175
|
for (let u = a.length - 1; u >= 0; u -= 1) {
|
|
176
176
|
const c = a[u], {
|
|
177
177
|
modifiers: l,
|
|
178
178
|
hasImportantModifier: d,
|
|
179
|
-
baseClassName:
|
|
180
|
-
maybePostfixModifierPosition:
|
|
179
|
+
baseClassName: g,
|
|
180
|
+
maybePostfixModifierPosition: m
|
|
181
181
|
} = n(c);
|
|
182
|
-
let
|
|
182
|
+
let I = !!m, f = r(I ? g.substring(0, m) : g);
|
|
183
183
|
if (!f) {
|
|
184
|
-
if (!
|
|
184
|
+
if (!I) {
|
|
185
185
|
i = c + (i.length > 0 ? " " + i : i);
|
|
186
186
|
continue;
|
|
187
187
|
}
|
|
188
|
-
if (f = r(
|
|
188
|
+
if (f = r(g), !f) {
|
|
189
189
|
i = c + (i.length > 0 ? " " + i : i);
|
|
190
190
|
continue;
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
I = !1;
|
|
193
193
|
}
|
|
194
|
-
const
|
|
195
|
-
if (
|
|
194
|
+
const v = on(l).join(":"), x = d ? v + xt : v, M = x + f;
|
|
195
|
+
if (o.includes(M))
|
|
196
196
|
continue;
|
|
197
|
-
|
|
198
|
-
const
|
|
199
|
-
for (let
|
|
200
|
-
const
|
|
201
|
-
|
|
197
|
+
o.push(M);
|
|
198
|
+
const A = s(f, I);
|
|
199
|
+
for (let k = 0; k < A.length; ++k) {
|
|
200
|
+
const b = A[k];
|
|
201
|
+
o.push(x + b);
|
|
202
202
|
}
|
|
203
203
|
i = c + (i.length > 0 ? " " + i : i);
|
|
204
204
|
}
|
|
@@ -207,38 +207,38 @@ const et = "-", Yt = (e) => {
|
|
|
207
207
|
function un() {
|
|
208
208
|
let e = 0, t, n, r = "";
|
|
209
209
|
for (; e < arguments.length; )
|
|
210
|
-
(t = arguments[e++]) && (n =
|
|
210
|
+
(t = arguments[e++]) && (n = At(t)) && (r && (r += " "), r += n);
|
|
211
211
|
return r;
|
|
212
212
|
}
|
|
213
|
-
const
|
|
213
|
+
const At = (e) => {
|
|
214
214
|
if (typeof e == "string")
|
|
215
215
|
return e;
|
|
216
216
|
let t, n = "";
|
|
217
217
|
for (let r = 0; r < e.length; r++)
|
|
218
|
-
e[r] && (t =
|
|
218
|
+
e[r] && (t = At(e[r])) && (n && (n += " "), n += t);
|
|
219
219
|
return n;
|
|
220
220
|
};
|
|
221
221
|
function dn(e, ...t) {
|
|
222
|
-
let n, r,
|
|
222
|
+
let n, r, s, o = a;
|
|
223
223
|
function a(u) {
|
|
224
224
|
const c = t.reduce((l, d) => d(l), e());
|
|
225
|
-
return n = an(c), r = n.cache.get,
|
|
225
|
+
return n = an(c), r = n.cache.get, s = n.cache.set, o = i, i(u);
|
|
226
226
|
}
|
|
227
227
|
function i(u) {
|
|
228
228
|
const c = r(u);
|
|
229
229
|
if (c)
|
|
230
230
|
return c;
|
|
231
231
|
const l = ln(u, n);
|
|
232
|
-
return
|
|
232
|
+
return s(u, l), l;
|
|
233
233
|
}
|
|
234
234
|
return function() {
|
|
235
|
-
return
|
|
235
|
+
return o(un.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)\(.+\)$/, de = (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)), R = (e) => Tt.test(e), we = (e) => gn.test(e), kn = /* @__PURE__ */ new Set(["length", "size", "percentage"]),
|
|
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)\(.+\)$/, de = (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)), R = (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), ze = () => !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,36 +247,36 @@ 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"), s = D("borderColor"), o = D("borderRadius"), a = D("borderSpacing"), i = D("borderWidth"), u = D("contrast"), c = D("grayscale"), l = D("hueRotate"), d = D("invert"), g = D("gap"), m = D("gradientColorStops"), I = D("gradientColorStopPositions"), f = D("inset"), v = D("margin"), x = D("opacity"), M = D("padding"), A = D("saturate"), k = D("scale"), b = D("sepia"), h = D("skew"), T = D("space"), p = D("translate"), w = () => ["auto", "contain", "none"], P = () => ["auto", "hidden", "clip", "visible", "scroll"], j = () => ["auto", R, t], C = () => [R, t], O = () => ["", de, be], F = () => ["auto", Te, R], E = () => ["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"], K = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], N = () => ["", "0", R], L = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], H = () => [Te, R];
|
|
251
251
|
return {
|
|
252
252
|
cacheSize: 500,
|
|
253
253
|
separator: ":",
|
|
254
254
|
theme: {
|
|
255
|
-
colors: [
|
|
255
|
+
colors: [ze],
|
|
256
256
|
spacing: [de, be],
|
|
257
257
|
blur: ["none", "", we, R],
|
|
258
258
|
brightness: H(),
|
|
259
259
|
borderColor: [e],
|
|
260
260
|
borderRadius: ["none", "", "full", we, R],
|
|
261
|
-
borderSpacing:
|
|
261
|
+
borderSpacing: C(),
|
|
262
262
|
borderWidth: O(),
|
|
263
263
|
contrast: H(),
|
|
264
|
-
grayscale:
|
|
264
|
+
grayscale: N(),
|
|
265
265
|
hueRotate: H(),
|
|
266
|
-
invert:
|
|
267
|
-
gap:
|
|
266
|
+
invert: N(),
|
|
267
|
+
gap: C(),
|
|
268
268
|
gradientColorStops: [e],
|
|
269
269
|
gradientColorStopPositions: [wn, be],
|
|
270
270
|
inset: j(),
|
|
271
271
|
margin: j(),
|
|
272
272
|
opacity: H(),
|
|
273
|
-
padding:
|
|
273
|
+
padding: C(),
|
|
274
274
|
saturate: H(),
|
|
275
275
|
scale: H(),
|
|
276
|
-
sepia:
|
|
276
|
+
sepia: N(),
|
|
277
277
|
skew: H(),
|
|
278
|
-
space:
|
|
279
|
-
translate:
|
|
278
|
+
space: C(),
|
|
279
|
+
translate: C()
|
|
280
280
|
},
|
|
281
281
|
classGroups: {
|
|
282
282
|
// Layout
|
|
@@ -370,7 +370,7 @@ const D = (e) => {
|
|
|
370
370
|
* @see https://tailwindcss.com/docs/object-position
|
|
371
371
|
*/
|
|
372
372
|
"object-position": [{
|
|
373
|
-
object: [...
|
|
373
|
+
object: [...E(), R]
|
|
374
374
|
}],
|
|
375
375
|
/**
|
|
376
376
|
* Overflow
|
|
@@ -528,14 +528,14 @@ const D = (e) => {
|
|
|
528
528
|
* @see https://tailwindcss.com/docs/flex-grow
|
|
529
529
|
*/
|
|
530
530
|
grow: [{
|
|
531
|
-
grow:
|
|
531
|
+
grow: N()
|
|
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: N()
|
|
539
539
|
}],
|
|
540
540
|
/**
|
|
541
541
|
* Order
|
|
@@ -549,7 +549,7 @@ const D = (e) => {
|
|
|
549
549
|
* @see https://tailwindcss.com/docs/grid-template-columns
|
|
550
550
|
*/
|
|
551
551
|
"grid-cols": [{
|
|
552
|
-
"grid-cols": [
|
|
552
|
+
"grid-cols": [ze]
|
|
553
553
|
}],
|
|
554
554
|
/**
|
|
555
555
|
* Grid Column Start / End
|
|
@@ -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": [ze]
|
|
583
583
|
}],
|
|
584
584
|
/**
|
|
585
585
|
* Grid Row Start / End
|
|
@@ -630,21 +630,21 @@ const D = (e) => {
|
|
|
630
630
|
* @see https://tailwindcss.com/docs/gap
|
|
631
631
|
*/
|
|
632
632
|
gap: [{
|
|
633
|
-
gap: [
|
|
633
|
+
gap: [g]
|
|
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": [g]
|
|
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": [g]
|
|
648
648
|
}],
|
|
649
649
|
/**
|
|
650
650
|
* Justify Content
|
|
@@ -715,133 +715,133 @@ const D = (e) => {
|
|
|
715
715
|
* @see https://tailwindcss.com/docs/padding
|
|
716
716
|
*/
|
|
717
717
|
p: [{
|
|
718
|
-
p: [
|
|
718
|
+
p: [M]
|
|
719
719
|
}],
|
|
720
720
|
/**
|
|
721
721
|
* Padding X
|
|
722
722
|
* @see https://tailwindcss.com/docs/padding
|
|
723
723
|
*/
|
|
724
724
|
px: [{
|
|
725
|
-
px: [
|
|
725
|
+
px: [M]
|
|
726
726
|
}],
|
|
727
727
|
/**
|
|
728
728
|
* Padding Y
|
|
729
729
|
* @see https://tailwindcss.com/docs/padding
|
|
730
730
|
*/
|
|
731
731
|
py: [{
|
|
732
|
-
py: [
|
|
732
|
+
py: [M]
|
|
733
733
|
}],
|
|
734
734
|
/**
|
|
735
735
|
* Padding Start
|
|
736
736
|
* @see https://tailwindcss.com/docs/padding
|
|
737
737
|
*/
|
|
738
738
|
ps: [{
|
|
739
|
-
ps: [
|
|
739
|
+
ps: [M]
|
|
740
740
|
}],
|
|
741
741
|
/**
|
|
742
742
|
* Padding End
|
|
743
743
|
* @see https://tailwindcss.com/docs/padding
|
|
744
744
|
*/
|
|
745
745
|
pe: [{
|
|
746
|
-
pe: [
|
|
746
|
+
pe: [M]
|
|
747
747
|
}],
|
|
748
748
|
/**
|
|
749
749
|
* Padding Top
|
|
750
750
|
* @see https://tailwindcss.com/docs/padding
|
|
751
751
|
*/
|
|
752
752
|
pt: [{
|
|
753
|
-
pt: [
|
|
753
|
+
pt: [M]
|
|
754
754
|
}],
|
|
755
755
|
/**
|
|
756
756
|
* Padding Right
|
|
757
757
|
* @see https://tailwindcss.com/docs/padding
|
|
758
758
|
*/
|
|
759
759
|
pr: [{
|
|
760
|
-
pr: [
|
|
760
|
+
pr: [M]
|
|
761
761
|
}],
|
|
762
762
|
/**
|
|
763
763
|
* Padding Bottom
|
|
764
764
|
* @see https://tailwindcss.com/docs/padding
|
|
765
765
|
*/
|
|
766
766
|
pb: [{
|
|
767
|
-
pb: [
|
|
767
|
+
pb: [M]
|
|
768
768
|
}],
|
|
769
769
|
/**
|
|
770
770
|
* Padding Left
|
|
771
771
|
* @see https://tailwindcss.com/docs/padding
|
|
772
772
|
*/
|
|
773
773
|
pl: [{
|
|
774
|
-
pl: [
|
|
774
|
+
pl: [M]
|
|
775
775
|
}],
|
|
776
776
|
/**
|
|
777
777
|
* Margin
|
|
778
778
|
* @see https://tailwindcss.com/docs/margin
|
|
779
779
|
*/
|
|
780
780
|
m: [{
|
|
781
|
-
m: [
|
|
781
|
+
m: [v]
|
|
782
782
|
}],
|
|
783
783
|
/**
|
|
784
784
|
* Margin X
|
|
785
785
|
* @see https://tailwindcss.com/docs/margin
|
|
786
786
|
*/
|
|
787
787
|
mx: [{
|
|
788
|
-
mx: [
|
|
788
|
+
mx: [v]
|
|
789
789
|
}],
|
|
790
790
|
/**
|
|
791
791
|
* Margin Y
|
|
792
792
|
* @see https://tailwindcss.com/docs/margin
|
|
793
793
|
*/
|
|
794
794
|
my: [{
|
|
795
|
-
my: [
|
|
795
|
+
my: [v]
|
|
796
796
|
}],
|
|
797
797
|
/**
|
|
798
798
|
* Margin Start
|
|
799
799
|
* @see https://tailwindcss.com/docs/margin
|
|
800
800
|
*/
|
|
801
801
|
ms: [{
|
|
802
|
-
ms: [
|
|
802
|
+
ms: [v]
|
|
803
803
|
}],
|
|
804
804
|
/**
|
|
805
805
|
* Margin End
|
|
806
806
|
* @see https://tailwindcss.com/docs/margin
|
|
807
807
|
*/
|
|
808
808
|
me: [{
|
|
809
|
-
me: [
|
|
809
|
+
me: [v]
|
|
810
810
|
}],
|
|
811
811
|
/**
|
|
812
812
|
* Margin Top
|
|
813
813
|
* @see https://tailwindcss.com/docs/margin
|
|
814
814
|
*/
|
|
815
815
|
mt: [{
|
|
816
|
-
mt: [
|
|
816
|
+
mt: [v]
|
|
817
817
|
}],
|
|
818
818
|
/**
|
|
819
819
|
* Margin Right
|
|
820
820
|
* @see https://tailwindcss.com/docs/margin
|
|
821
821
|
*/
|
|
822
822
|
mr: [{
|
|
823
|
-
mr: [
|
|
823
|
+
mr: [v]
|
|
824
824
|
}],
|
|
825
825
|
/**
|
|
826
826
|
* Margin Bottom
|
|
827
827
|
* @see https://tailwindcss.com/docs/margin
|
|
828
828
|
*/
|
|
829
829
|
mb: [{
|
|
830
|
-
mb: [
|
|
830
|
+
mb: [v]
|
|
831
831
|
}],
|
|
832
832
|
/**
|
|
833
833
|
* Margin Left
|
|
834
834
|
* @see https://tailwindcss.com/docs/margin
|
|
835
835
|
*/
|
|
836
836
|
ml: [{
|
|
837
|
-
ml: [
|
|
837
|
+
ml: [v]
|
|
838
838
|
}],
|
|
839
839
|
/**
|
|
840
840
|
* Space Between X
|
|
841
841
|
* @see https://tailwindcss.com/docs/space
|
|
842
842
|
*/
|
|
843
843
|
"space-x": [{
|
|
844
|
-
"space-x": [
|
|
844
|
+
"space-x": [T]
|
|
845
845
|
}],
|
|
846
846
|
/**
|
|
847
847
|
* Space Between X Reverse
|
|
@@ -853,7 +853,7 @@ const D = (e) => {
|
|
|
853
853
|
* @see https://tailwindcss.com/docs/space
|
|
854
854
|
*/
|
|
855
855
|
"space-y": [{
|
|
856
|
-
"space-y": [
|
|
856
|
+
"space-y": [T]
|
|
857
857
|
}],
|
|
858
858
|
/**
|
|
859
859
|
* Space Between Y Reverse
|
|
@@ -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: [ze]
|
|
946
946
|
}],
|
|
947
947
|
/**
|
|
948
948
|
* Font Variant Numeric
|
|
@@ -1029,7 +1029,7 @@ const D = (e) => {
|
|
|
1029
1029
|
* @see https://tailwindcss.com/docs/placeholder-opacity
|
|
1030
1030
|
*/
|
|
1031
1031
|
"placeholder-opacity": [{
|
|
1032
|
-
"placeholder-opacity": [
|
|
1032
|
+
"placeholder-opacity": [x]
|
|
1033
1033
|
}],
|
|
1034
1034
|
/**
|
|
1035
1035
|
* Text Alignment
|
|
@@ -1050,7 +1050,7 @@ const D = (e) => {
|
|
|
1050
1050
|
* @see https://tailwindcss.com/docs/text-opacity
|
|
1051
1051
|
*/
|
|
1052
1052
|
"text-opacity": [{
|
|
1053
|
-
"text-opacity": [
|
|
1053
|
+
"text-opacity": [x]
|
|
1054
1054
|
}],
|
|
1055
1055
|
/**
|
|
1056
1056
|
* Text Decoration
|
|
@@ -1107,7 +1107,7 @@ const D = (e) => {
|
|
|
1107
1107
|
* @see https://tailwindcss.com/docs/text-indent
|
|
1108
1108
|
*/
|
|
1109
1109
|
indent: [{
|
|
1110
|
-
indent:
|
|
1110
|
+
indent: C()
|
|
1111
1111
|
}],
|
|
1112
1112
|
/**
|
|
1113
1113
|
* Vertical Alignment
|
|
@@ -1165,7 +1165,7 @@ const D = (e) => {
|
|
|
1165
1165
|
* @see https://tailwindcss.com/docs/background-opacity
|
|
1166
1166
|
*/
|
|
1167
1167
|
"bg-opacity": [{
|
|
1168
|
-
"bg-opacity": [
|
|
1168
|
+
"bg-opacity": [x]
|
|
1169
1169
|
}],
|
|
1170
1170
|
/**
|
|
1171
1171
|
* Background Origin
|
|
@@ -1179,7 +1179,7 @@ const D = (e) => {
|
|
|
1179
1179
|
* @see https://tailwindcss.com/docs/background-position
|
|
1180
1180
|
*/
|
|
1181
1181
|
"bg-position": [{
|
|
1182
|
-
bg: [...
|
|
1182
|
+
bg: [...E(), vn]
|
|
1183
1183
|
}],
|
|
1184
1184
|
/**
|
|
1185
1185
|
* Background Repeat
|
|
@@ -1195,7 +1195,7 @@ const D = (e) => {
|
|
|
1195
1195
|
* @see https://tailwindcss.com/docs/background-size
|
|
1196
1196
|
*/
|
|
1197
1197
|
"bg-size": [{
|
|
1198
|
-
bg: ["auto", "cover", "contain",
|
|
1198
|
+
bg: ["auto", "cover", "contain", In]
|
|
1199
1199
|
}],
|
|
1200
1200
|
/**
|
|
1201
1201
|
* Background Image
|
|
@@ -1204,7 +1204,7 @@ const D = (e) => {
|
|
|
1204
1204
|
"bg-image": [{
|
|
1205
1205
|
bg: ["none", {
|
|
1206
1206
|
"gradient-to": ["t", "tr", "r", "br", "b", "bl", "l", "tl"]
|
|
1207
|
-
},
|
|
1207
|
+
}, An]
|
|
1208
1208
|
}],
|
|
1209
1209
|
/**
|
|
1210
1210
|
* Background Color
|
|
@@ -1218,42 +1218,42 @@ const D = (e) => {
|
|
|
1218
1218
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1219
1219
|
*/
|
|
1220
1220
|
"gradient-from-pos": [{
|
|
1221
|
-
from: [
|
|
1221
|
+
from: [I]
|
|
1222
1222
|
}],
|
|
1223
1223
|
/**
|
|
1224
1224
|
* Gradient Color Stops Via Position
|
|
1225
1225
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1226
1226
|
*/
|
|
1227
1227
|
"gradient-via-pos": [{
|
|
1228
|
-
via: [
|
|
1228
|
+
via: [I]
|
|
1229
1229
|
}],
|
|
1230
1230
|
/**
|
|
1231
1231
|
* Gradient Color Stops To Position
|
|
1232
1232
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1233
1233
|
*/
|
|
1234
1234
|
"gradient-to-pos": [{
|
|
1235
|
-
to: [
|
|
1235
|
+
to: [I]
|
|
1236
1236
|
}],
|
|
1237
1237
|
/**
|
|
1238
1238
|
* Gradient Color Stops From
|
|
1239
1239
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1240
1240
|
*/
|
|
1241
1241
|
"gradient-from": [{
|
|
1242
|
-
from: [
|
|
1242
|
+
from: [m]
|
|
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: [m]
|
|
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: [m]
|
|
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: [o]
|
|
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": [o]
|
|
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": [o]
|
|
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": [o]
|
|
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": [o]
|
|
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": [o]
|
|
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": [o]
|
|
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": [o]
|
|
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": [o]
|
|
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": [o]
|
|
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": [o]
|
|
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": [o]
|
|
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": [o]
|
|
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": [o]
|
|
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": [o]
|
|
1363
1363
|
}],
|
|
1364
1364
|
/**
|
|
1365
1365
|
* Border Width
|
|
@@ -1429,7 +1429,7 @@ const D = (e) => {
|
|
|
1429
1429
|
* @see https://tailwindcss.com/docs/border-opacity
|
|
1430
1430
|
*/
|
|
1431
1431
|
"border-opacity": [{
|
|
1432
|
-
"border-opacity": [
|
|
1432
|
+
"border-opacity": [x]
|
|
1433
1433
|
}],
|
|
1434
1434
|
/**
|
|
1435
1435
|
* Border Style
|
|
@@ -1467,7 +1467,7 @@ const D = (e) => {
|
|
|
1467
1467
|
* @see https://tailwindcss.com/docs/divide-opacity
|
|
1468
1468
|
*/
|
|
1469
1469
|
"divide-opacity": [{
|
|
1470
|
-
"divide-opacity": [
|
|
1470
|
+
"divide-opacity": [x]
|
|
1471
1471
|
}],
|
|
1472
1472
|
/**
|
|
1473
1473
|
* Divide Style
|
|
@@ -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: [s]
|
|
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": [s]
|
|
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": [s]
|
|
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": [s]
|
|
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": [s]
|
|
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": [s]
|
|
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": [s]
|
|
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": [s]
|
|
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": [s]
|
|
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: [s]
|
|
1548
1548
|
}],
|
|
1549
1549
|
/**
|
|
1550
1550
|
* Outline Style
|
|
@@ -1598,7 +1598,7 @@ const D = (e) => {
|
|
|
1598
1598
|
* @see https://tailwindcss.com/docs/ring-opacity
|
|
1599
1599
|
*/
|
|
1600
1600
|
"ring-opacity": [{
|
|
1601
|
-
"ring-opacity": [
|
|
1601
|
+
"ring-opacity": [x]
|
|
1602
1602
|
}],
|
|
1603
1603
|
/**
|
|
1604
1604
|
* Ring Offset Width
|
|
@@ -1627,28 +1627,28 @@ const D = (e) => {
|
|
|
1627
1627
|
* @see https://tailwindcss.com/docs/box-shadow-color
|
|
1628
1628
|
*/
|
|
1629
1629
|
"shadow-color": [{
|
|
1630
|
-
shadow: [
|
|
1630
|
+
shadow: [ze]
|
|
1631
1631
|
}],
|
|
1632
1632
|
/**
|
|
1633
1633
|
* Opacity
|
|
1634
1634
|
* @see https://tailwindcss.com/docs/opacity
|
|
1635
1635
|
*/
|
|
1636
1636
|
opacity: [{
|
|
1637
|
-
opacity: [
|
|
1637
|
+
opacity: [x]
|
|
1638
1638
|
}],
|
|
1639
1639
|
/**
|
|
1640
1640
|
* Mix Blend Mode
|
|
1641
1641
|
* @see https://tailwindcss.com/docs/mix-blend-mode
|
|
1642
1642
|
*/
|
|
1643
1643
|
"mix-blend": [{
|
|
1644
|
-
"mix-blend": [...
|
|
1644
|
+
"mix-blend": [...z(), "plus-lighter", "plus-darker"]
|
|
1645
1645
|
}],
|
|
1646
1646
|
/**
|
|
1647
1647
|
* Background Blend Mode
|
|
1648
1648
|
* @see https://tailwindcss.com/docs/background-blend-mode
|
|
1649
1649
|
*/
|
|
1650
1650
|
"bg-blend": [{
|
|
1651
|
-
"bg-blend":
|
|
1651
|
+
"bg-blend": z()
|
|
1652
1652
|
}],
|
|
1653
1653
|
// Filters
|
|
1654
1654
|
/**
|
|
@@ -1713,14 +1713,14 @@ const D = (e) => {
|
|
|
1713
1713
|
* @see https://tailwindcss.com/docs/saturate
|
|
1714
1714
|
*/
|
|
1715
1715
|
saturate: [{
|
|
1716
|
-
saturate: [
|
|
1716
|
+
saturate: [A]
|
|
1717
1717
|
}],
|
|
1718
1718
|
/**
|
|
1719
1719
|
* Sepia
|
|
1720
1720
|
* @see https://tailwindcss.com/docs/sepia
|
|
1721
1721
|
*/
|
|
1722
1722
|
sepia: [{
|
|
1723
|
-
sepia: [
|
|
1723
|
+
sepia: [b]
|
|
1724
1724
|
}],
|
|
1725
1725
|
/**
|
|
1726
1726
|
* Backdrop Filter
|
|
@@ -1777,21 +1777,21 @@ const D = (e) => {
|
|
|
1777
1777
|
* @see https://tailwindcss.com/docs/backdrop-opacity
|
|
1778
1778
|
*/
|
|
1779
1779
|
"backdrop-opacity": [{
|
|
1780
|
-
"backdrop-opacity": [
|
|
1780
|
+
"backdrop-opacity": [x]
|
|
1781
1781
|
}],
|
|
1782
1782
|
/**
|
|
1783
1783
|
* Backdrop Saturate
|
|
1784
1784
|
* @see https://tailwindcss.com/docs/backdrop-saturate
|
|
1785
1785
|
*/
|
|
1786
1786
|
"backdrop-saturate": [{
|
|
1787
|
-
"backdrop-saturate": [
|
|
1787
|
+
"backdrop-saturate": [A]
|
|
1788
1788
|
}],
|
|
1789
1789
|
/**
|
|
1790
1790
|
* Backdrop Sepia
|
|
1791
1791
|
* @see https://tailwindcss.com/docs/backdrop-sepia
|
|
1792
1792
|
*/
|
|
1793
1793
|
"backdrop-sepia": [{
|
|
1794
|
-
"backdrop-sepia": [
|
|
1794
|
+
"backdrop-sepia": [b]
|
|
1795
1795
|
}],
|
|
1796
1796
|
// Tables
|
|
1797
1797
|
/**
|
|
@@ -1885,21 +1885,21 @@ const D = (e) => {
|
|
|
1885
1885
|
* @see https://tailwindcss.com/docs/scale
|
|
1886
1886
|
*/
|
|
1887
1887
|
scale: [{
|
|
1888
|
-
scale: [
|
|
1888
|
+
scale: [k]
|
|
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": [k]
|
|
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": [k]
|
|
1903
1903
|
}],
|
|
1904
1904
|
/**
|
|
1905
1905
|
* Rotate
|
|
@@ -1913,28 +1913,28 @@ const D = (e) => {
|
|
|
1913
1913
|
* @see https://tailwindcss.com/docs/translate
|
|
1914
1914
|
*/
|
|
1915
1915
|
"translate-x": [{
|
|
1916
|
-
"translate-x": [
|
|
1916
|
+
"translate-x": [p]
|
|
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": [p]
|
|
1924
1924
|
}],
|
|
1925
1925
|
/**
|
|
1926
1926
|
* Skew X
|
|
1927
1927
|
* @see https://tailwindcss.com/docs/skew
|
|
1928
1928
|
*/
|
|
1929
1929
|
"skew-x": [{
|
|
1930
|
-
"skew-x": [
|
|
1930
|
+
"skew-x": [h]
|
|
1931
1931
|
}],
|
|
1932
1932
|
/**
|
|
1933
1933
|
* Skew Y
|
|
1934
1934
|
* @see https://tailwindcss.com/docs/skew
|
|
1935
1935
|
*/
|
|
1936
1936
|
"skew-y": [{
|
|
1937
|
-
"skew-y": [
|
|
1937
|
+
"skew-y": [h]
|
|
1938
1938
|
}],
|
|
1939
1939
|
/**
|
|
1940
1940
|
* Transform Origin
|
|
@@ -1998,126 +1998,126 @@ const D = (e) => {
|
|
|
1998
1998
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
1999
1999
|
*/
|
|
2000
2000
|
"scroll-m": [{
|
|
2001
|
-
"scroll-m":
|
|
2001
|
+
"scroll-m": C()
|
|
2002
2002
|
}],
|
|
2003
2003
|
/**
|
|
2004
2004
|
* Scroll Margin X
|
|
2005
2005
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2006
2006
|
*/
|
|
2007
2007
|
"scroll-mx": [{
|
|
2008
|
-
"scroll-mx":
|
|
2008
|
+
"scroll-mx": C()
|
|
2009
2009
|
}],
|
|
2010
2010
|
/**
|
|
2011
2011
|
* Scroll Margin Y
|
|
2012
2012
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2013
2013
|
*/
|
|
2014
2014
|
"scroll-my": [{
|
|
2015
|
-
"scroll-my":
|
|
2015
|
+
"scroll-my": C()
|
|
2016
2016
|
}],
|
|
2017
2017
|
/**
|
|
2018
2018
|
* Scroll Margin Start
|
|
2019
2019
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2020
2020
|
*/
|
|
2021
2021
|
"scroll-ms": [{
|
|
2022
|
-
"scroll-ms":
|
|
2022
|
+
"scroll-ms": C()
|
|
2023
2023
|
}],
|
|
2024
2024
|
/**
|
|
2025
2025
|
* Scroll Margin End
|
|
2026
2026
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2027
2027
|
*/
|
|
2028
2028
|
"scroll-me": [{
|
|
2029
|
-
"scroll-me":
|
|
2029
|
+
"scroll-me": C()
|
|
2030
2030
|
}],
|
|
2031
2031
|
/**
|
|
2032
2032
|
* Scroll Margin Top
|
|
2033
2033
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2034
2034
|
*/
|
|
2035
2035
|
"scroll-mt": [{
|
|
2036
|
-
"scroll-mt":
|
|
2036
|
+
"scroll-mt": C()
|
|
2037
2037
|
}],
|
|
2038
2038
|
/**
|
|
2039
2039
|
* Scroll Margin Right
|
|
2040
2040
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2041
2041
|
*/
|
|
2042
2042
|
"scroll-mr": [{
|
|
2043
|
-
"scroll-mr":
|
|
2043
|
+
"scroll-mr": C()
|
|
2044
2044
|
}],
|
|
2045
2045
|
/**
|
|
2046
2046
|
* Scroll Margin Bottom
|
|
2047
2047
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2048
2048
|
*/
|
|
2049
2049
|
"scroll-mb": [{
|
|
2050
|
-
"scroll-mb":
|
|
2050
|
+
"scroll-mb": C()
|
|
2051
2051
|
}],
|
|
2052
2052
|
/**
|
|
2053
2053
|
* Scroll Margin Left
|
|
2054
2054
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2055
2055
|
*/
|
|
2056
2056
|
"scroll-ml": [{
|
|
2057
|
-
"scroll-ml":
|
|
2057
|
+
"scroll-ml": C()
|
|
2058
2058
|
}],
|
|
2059
2059
|
/**
|
|
2060
2060
|
* Scroll Padding
|
|
2061
2061
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2062
2062
|
*/
|
|
2063
2063
|
"scroll-p": [{
|
|
2064
|
-
"scroll-p":
|
|
2064
|
+
"scroll-p": C()
|
|
2065
2065
|
}],
|
|
2066
2066
|
/**
|
|
2067
2067
|
* Scroll Padding X
|
|
2068
2068
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2069
2069
|
*/
|
|
2070
2070
|
"scroll-px": [{
|
|
2071
|
-
"scroll-px":
|
|
2071
|
+
"scroll-px": C()
|
|
2072
2072
|
}],
|
|
2073
2073
|
/**
|
|
2074
2074
|
* Scroll Padding Y
|
|
2075
2075
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2076
2076
|
*/
|
|
2077
2077
|
"scroll-py": [{
|
|
2078
|
-
"scroll-py":
|
|
2078
|
+
"scroll-py": C()
|
|
2079
2079
|
}],
|
|
2080
2080
|
/**
|
|
2081
2081
|
* Scroll Padding Start
|
|
2082
2082
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2083
2083
|
*/
|
|
2084
2084
|
"scroll-ps": [{
|
|
2085
|
-
"scroll-ps":
|
|
2085
|
+
"scroll-ps": C()
|
|
2086
2086
|
}],
|
|
2087
2087
|
/**
|
|
2088
2088
|
* Scroll Padding End
|
|
2089
2089
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2090
2090
|
*/
|
|
2091
2091
|
"scroll-pe": [{
|
|
2092
|
-
"scroll-pe":
|
|
2092
|
+
"scroll-pe": C()
|
|
2093
2093
|
}],
|
|
2094
2094
|
/**
|
|
2095
2095
|
* Scroll Padding Top
|
|
2096
2096
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2097
2097
|
*/
|
|
2098
2098
|
"scroll-pt": [{
|
|
2099
|
-
"scroll-pt":
|
|
2099
|
+
"scroll-pt": C()
|
|
2100
2100
|
}],
|
|
2101
2101
|
/**
|
|
2102
2102
|
* Scroll Padding Right
|
|
2103
2103
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2104
2104
|
*/
|
|
2105
2105
|
"scroll-pr": [{
|
|
2106
|
-
"scroll-pr":
|
|
2106
|
+
"scroll-pr": C()
|
|
2107
2107
|
}],
|
|
2108
2108
|
/**
|
|
2109
2109
|
* Scroll Padding Bottom
|
|
2110
2110
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2111
2111
|
*/
|
|
2112
2112
|
"scroll-pb": [{
|
|
2113
|
-
"scroll-pb":
|
|
2113
|
+
"scroll-pb": C()
|
|
2114
2114
|
}],
|
|
2115
2115
|
/**
|
|
2116
2116
|
* Scroll Padding Left
|
|
2117
2117
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2118
2118
|
*/
|
|
2119
2119
|
"scroll-pl": [{
|
|
2120
|
-
"scroll-pl":
|
|
2120
|
+
"scroll-pl": C()
|
|
2121
2121
|
}],
|
|
2122
2122
|
/**
|
|
2123
2123
|
* Scroll Snap Align
|
|
@@ -2276,21 +2276,21 @@ const D = (e) => {
|
|
|
2276
2276
|
}
|
|
2277
2277
|
};
|
|
2278
2278
|
}, Pn = /* @__PURE__ */ dn(En);
|
|
2279
|
-
function
|
|
2279
|
+
function rs(...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 s of e) {
|
|
2285
|
+
if (s === "\\") {
|
|
2286
|
+
n += s, t = !t;
|
|
2287
2287
|
continue;
|
|
2288
2288
|
}
|
|
2289
|
-
if (
|
|
2289
|
+
if (s === "'" && !t) {
|
|
2290
2290
|
n += '"';
|
|
2291
2291
|
continue;
|
|
2292
2292
|
}
|
|
2293
|
-
n +=
|
|
2293
|
+
n += s, 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 zn(e) {
|
|
2314
2314
|
return typeof e != "string" ? !1 : /^[\s\n]*[-*]\s|^[\s\n]*#+\s|```|^\s*\[.*\]\(|^>\s/.test(e);
|
|
2315
2315
|
}
|
|
2316
|
-
function
|
|
2316
|
+
function Nn(e) {
|
|
2317
2317
|
return e.type === "image_url";
|
|
2318
2318
|
}
|
|
2319
2319
|
function Rn(e) {
|
|
@@ -2324,7 +2324,7 @@ function Ln(e) {
|
|
|
2324
2324
|
`).trim() : typeof e.content == "string" ? e.content : "";
|
|
2325
2325
|
}
|
|
2326
2326
|
function Un(e) {
|
|
2327
|
-
return e.content.filter(
|
|
2327
|
+
return e.content.filter(Nn);
|
|
2328
2328
|
}
|
|
2329
2329
|
function jn(e) {
|
|
2330
2330
|
return e.content.filter(Rn);
|
|
@@ -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 s = Ke(r);
|
|
2376
|
+
s !== void 0 && (t[n] = s);
|
|
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 ss(e) {
|
|
2401
2401
|
const t = Et(e);
|
|
2402
|
-
return typeof e == "string" &&
|
|
2402
|
+
return typeof e == "string" && zn(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 s = Ke(r);
|
|
2408
|
+
return typeof s == "string" ? s : JSON.stringify(s ?? "");
|
|
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 os(e) {
|
|
2417
2417
|
return e.content.some((t) => t.type === "text" ? t.text.trim().length > 0 : t.type === "image_url" || t.type === "file");
|
|
2418
2418
|
}
|
|
2419
2419
|
function ce(e) {
|
|
@@ -2448,27 +2448,27 @@ function le(e) {
|
|
|
2448
2448
|
);
|
|
2449
2449
|
}
|
|
2450
2450
|
function nt(e) {
|
|
2451
|
-
var
|
|
2451
|
+
var x, M, A, k, b, h, T;
|
|
2452
2452
|
if (!e || typeof e != "object") return null;
|
|
2453
2453
|
const t = le(e), n = Kn(t);
|
|
2454
2454
|
if (!n)
|
|
2455
2455
|
return null;
|
|
2456
|
-
const r = t.toolCalls ?? ((
|
|
2456
|
+
const r = t.toolCalls ?? ((x = t.additionalKwargs) == null ? void 0 : x.toolCalls), s = Array.isArray(r) ? r.map(rt) : void 0, o = Dn(t.content ?? t.parts, !!(s != null && s.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(), u = t.name ?? ((A = t.additionalKwargs) == null ? void 0 : A.agentName) ?? void 0, c = t.model ?? ((k = t.additionalKwargs) == null ? void 0 : k.model) ?? void 0, l = t.toolCallId ?? void 0, d = t.additionalKwargs ?? void 0, g = t.responseMetadata ?? void 0, m = 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, f = typeof t.toolStreaming == "boolean" ? t.toolStreaming : !!((T = t.additionalKwargs) != null && T.toolStreaming);
|
|
2457
2457
|
return {
|
|
2458
2458
|
...t,
|
|
2459
2459
|
id: a,
|
|
2460
2460
|
role: n,
|
|
2461
|
-
content:
|
|
2461
|
+
content: o,
|
|
2462
2462
|
createdAt: i,
|
|
2463
2463
|
name: u,
|
|
2464
2464
|
model: c,
|
|
2465
2465
|
toolCallId: l,
|
|
2466
|
-
toolCalls:
|
|
2467
|
-
checkpointId:
|
|
2468
|
-
checkpointNs:
|
|
2466
|
+
toolCalls: s,
|
|
2467
|
+
checkpointId: m,
|
|
2468
|
+
checkpointNs: I,
|
|
2469
2469
|
toolStreaming: f,
|
|
2470
2470
|
additionalKwargs: d,
|
|
2471
|
-
responseMetadata:
|
|
2471
|
+
responseMetadata: g,
|
|
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
|
}
|
|
@@ -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 s = [{ type: "text", text: r }];
|
|
2526
2526
|
return {
|
|
2527
2527
|
id: `tool-${t.id}`,
|
|
2528
2528
|
role: "tool",
|
|
2529
|
-
content:
|
|
2529
|
+
content: s,
|
|
2530
2530
|
name: t.name,
|
|
2531
2531
|
toolCallId: t.id,
|
|
2532
2532
|
artifact: t.artifact,
|
|
@@ -2535,13 +2535,13 @@ function Vn(e, t) {
|
|
|
2535
2535
|
}
|
|
2536
2536
|
function qn(e, t = []) {
|
|
2537
2537
|
if (Array.isArray(e)) {
|
|
2538
|
-
const
|
|
2539
|
-
return
|
|
2540
|
-
var d,
|
|
2541
|
-
const i = He(a.id, e) || He(a.id, t), u = Array.isArray((d = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : d.toolProgress) ? (
|
|
2538
|
+
const s = e.filter((a) => a.role === "assistant").flatMap((a) => dt(a)), o = /* @__PURE__ */ new Map();
|
|
2539
|
+
return s.forEach((a) => o.set(a.id, a)), Array.from(o.values()).map((a) => {
|
|
2540
|
+
var d, g, m;
|
|
2541
|
+
const i = He(a.id, e) || He(a.id, t), u = Array.isArray((d = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : d.toolProgress) ? (g = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : g.toolProgress : void 0, c = (i == null ? void 0 : i.artifact) ?? a.artifact, l = ut(a.status) ?? ((m = i == null ? void 0 : i.additionalKwargs) != null && m.toolStreaming ? "pending" : null) ?? (i ? "completed" : "pending");
|
|
2542
2542
|
if (i && !a.content && l === "completed") {
|
|
2543
|
-
const
|
|
2544
|
-
typeof
|
|
2543
|
+
const I = ce(i);
|
|
2544
|
+
typeof I == "string" && (a.content = I);
|
|
2545
2545
|
}
|
|
2546
2546
|
return {
|
|
2547
2547
|
call: a,
|
|
@@ -2556,24 +2556,24 @@ function qn(e, t = []) {
|
|
|
2556
2556
|
const n = dt(e);
|
|
2557
2557
|
return n.length === 0 ? [] : n.map((r) => {
|
|
2558
2558
|
var u, c, l;
|
|
2559
|
-
const
|
|
2560
|
-
if (
|
|
2561
|
-
const d = ce(
|
|
2559
|
+
const s = He(r.id, t) ?? Vn(e, r), o = Array.isArray((u = s == null ? void 0 : s.additionalKwargs) == null ? void 0 : u.toolProgress) ? (c = s == null ? void 0 : s.additionalKwargs) == null ? void 0 : c.toolProgress : void 0, a = (s == null ? void 0 : s.artifact) ?? r.artifact, i = ut(r.status) ?? ((l = s == null ? void 0 : s.additionalKwargs) != null && l.toolStreaming ? "pending" : null) ?? (s ? "completed" : "pending");
|
|
2560
|
+
if (s && !r.content && i === "completed") {
|
|
2561
|
+
const d = ce(s);
|
|
2562
2562
|
typeof d == "string" && (r.content = d);
|
|
2563
2563
|
}
|
|
2564
2564
|
return {
|
|
2565
2565
|
call: r,
|
|
2566
|
-
result:
|
|
2566
|
+
result: s,
|
|
2567
2567
|
state: i,
|
|
2568
|
-
progress:
|
|
2568
|
+
progress: o,
|
|
2569
2569
|
artifact: a
|
|
2570
2570
|
};
|
|
2571
2571
|
});
|
|
2572
2572
|
}
|
|
2573
|
-
function
|
|
2573
|
+
function as(e, t = []) {
|
|
2574
2574
|
return qn(e, t).map((n) => n.artifact).filter((n) => !!n);
|
|
2575
2575
|
}
|
|
2576
|
-
const
|
|
2576
|
+
const Ne = {
|
|
2577
2577
|
authToken: "authToken",
|
|
2578
2578
|
authTokenExpiresAt: "authTokenExpiresAt",
|
|
2579
2579
|
authSessionId: "authSessionId",
|
|
@@ -2590,14 +2590,14 @@ const Qe = /* @__PURE__ */ new Set();
|
|
|
2590
2590
|
function Pt() {
|
|
2591
2591
|
return Ve;
|
|
2592
2592
|
}
|
|
2593
|
-
function
|
|
2593
|
+
function Ie(e) {
|
|
2594
2594
|
Ve = e, Qe.forEach((t) => t(e));
|
|
2595
2595
|
}
|
|
2596
2596
|
function _t(e) {
|
|
2597
2597
|
return Qe.add(e), () => Qe.delete(e);
|
|
2598
2598
|
}
|
|
2599
2599
|
const Hn = 12e4, Gn = 12e4;
|
|
2600
|
-
let Ye = Hn,
|
|
2600
|
+
let Ye = Hn, zt = 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 && (zt = n);
|
|
2612
2612
|
}
|
|
2613
2613
|
function Jn() {
|
|
2614
|
-
return
|
|
2614
|
+
return zt;
|
|
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, s = 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(Ne.authToken, r), Ie(r)), s && localStorage.setItem(Ne.authTokenExpiresAt, s.toString()), (r || s) && window.dispatchEvent(
|
|
2623
2623
|
new CustomEvent("smartorg:chat-token-updated", {
|
|
2624
|
-
detail: { token: r, expiresAt:
|
|
2624
|
+
detail: { token: r, expiresAt: s }
|
|
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 oe(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) {
|
|
@@ -2660,7 +2660,7 @@ class Yn {
|
|
|
2660
2660
|
const n = t.baseUrl.replace(/\/+$/, "");
|
|
2661
2661
|
ne.defaults.baseURL = n;
|
|
2662
2662
|
}
|
|
2663
|
-
t.apiKey !== void 0 ?
|
|
2663
|
+
t.apiKey !== void 0 ? Ie(t.apiKey) : t.getToken && Ie(t.getToken()), (t.requestTimeoutMs !== void 0 || t.historyTimeoutMs !== void 0) && Wn({
|
|
2664
2664
|
requestTimeoutMs: t.requestTimeoutMs,
|
|
2665
2665
|
historyTimeoutMs: t.historyTimeoutMs
|
|
2666
2666
|
});
|
|
@@ -2670,22 +2670,22 @@ class Yn {
|
|
|
2670
2670
|
return Pt();
|
|
2671
2671
|
}
|
|
2672
2672
|
setAuthToken(t) {
|
|
2673
|
-
|
|
2673
|
+
Ie(t);
|
|
2674
2674
|
}
|
|
2675
2675
|
onTokenChange(t) {
|
|
2676
2676
|
return _t(t);
|
|
2677
2677
|
}
|
|
2678
2678
|
// ---- Thread Management ----
|
|
2679
2679
|
async listThreads() {
|
|
2680
|
-
const t = await
|
|
2680
|
+
const t = await oe("/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 s = await Ze("/threads", Object.keys(r).length ? r : void 0);
|
|
2688
|
+
return ae(s);
|
|
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 oe(`/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 oe("/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 oe(`/agents/${t}`);
|
|
2709
2709
|
return ae(n);
|
|
2710
2710
|
}
|
|
2711
2711
|
async getAgentSchema(t) {
|
|
2712
|
-
const n = await
|
|
2712
|
+
const n = await oe(`/agents/${t}/schema`);
|
|
2713
2713
|
return ae(n);
|
|
2714
2714
|
}
|
|
2715
2715
|
async getState(t) {
|
|
2716
|
-
const n = await
|
|
2716
|
+
const n = await oe(`/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 oe(`/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 Nt = 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 oe(t, {
|
|
2750
2750
|
responseType: "blob",
|
|
2751
|
-
onDownloadProgress: (
|
|
2751
|
+
onDownloadProgress: (s) => {
|
|
2752
2752
|
try {
|
|
2753
|
-
if (n &&
|
|
2754
|
-
const
|
|
2755
|
-
n(
|
|
2753
|
+
if (n && s.lengthComputable) {
|
|
2754
|
+
const o = s.loaded / s.total;
|
|
2755
|
+
n(o);
|
|
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), s = URL.createObjectURL(r);
|
|
2766
|
+
window.open(s, "_blank"), setTimeout(() => URL.revokeObjectURL(s), 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), s = URL.createObjectURL(r);
|
|
2776
|
+
let o = `file_${t}`;
|
|
2777
2777
|
try {
|
|
2778
|
-
const i = await
|
|
2779
|
-
|
|
2778
|
+
const i = await oe(`/files/${t}`);
|
|
2779
|
+
o = (i == null ? void 0 : i.filename) ?? o;
|
|
2780
2780
|
} catch {
|
|
2781
2781
|
}
|
|
2782
2782
|
const a = document.createElement("a");
|
|
2783
|
-
a.href =
|
|
2783
|
+
a.href = s, a.download = o, document.body.appendChild(a), a.click(), a.remove(), setTimeout(() => URL.revokeObjectURL(s), 6e4);
|
|
2784
2784
|
}
|
|
2785
2785
|
async getFileInfo(t) {
|
|
2786
|
-
return await
|
|
2786
|
+
return await oe(`/files/${t}`);
|
|
2787
2787
|
}
|
|
2788
2788
|
async listFiles(t, n = 50, r = 0) {
|
|
2789
|
-
const
|
|
2790
|
-
return t && (
|
|
2789
|
+
const s = { limit: n, offset: r };
|
|
2790
|
+
return t && (s.thread_id = t), await oe("/files", { params: s });
|
|
2791
2791
|
}
|
|
2792
2792
|
async uploadFile(t, n, r) {
|
|
2793
|
-
const
|
|
2794
|
-
return
|
|
2795
|
-
onUploadProgress: (
|
|
2793
|
+
const s = new FormData();
|
|
2794
|
+
return s.append("file", t), n && s.append("thread_id", n), await Ze("/files/upload-form", s, {
|
|
2795
|
+
onUploadProgress: (o) => {
|
|
2796
2796
|
try {
|
|
2797
|
-
if (r &&
|
|
2798
|
-
const a =
|
|
2797
|
+
if (r && o.lengthComputable) {
|
|
2798
|
+
const a = o.loaded / o.total;
|
|
2799
2799
|
r(a);
|
|
2800
2800
|
}
|
|
2801
2801
|
} catch {
|
|
@@ -2820,75 +2820,75 @@ class er {
|
|
|
2820
2820
|
const n = t.baseUrl.replace(/\/+$/, "");
|
|
2821
2821
|
this._authBaseUrl = `${n}/auth`;
|
|
2822
2822
|
}
|
|
2823
|
-
t.apiKey !== void 0 ?
|
|
2823
|
+
t.apiKey !== void 0 ? Ie(t.apiKey) : t.getToken && Ie(t.getToken());
|
|
2824
2824
|
}
|
|
2825
2825
|
// ---- Token Management ----
|
|
2826
2826
|
getAuthToken() {
|
|
2827
2827
|
return Pt();
|
|
2828
2828
|
}
|
|
2829
2829
|
setAuthToken(t) {
|
|
2830
|
-
|
|
2830
|
+
Ie(t);
|
|
2831
2831
|
}
|
|
2832
2832
|
onTokenChange(t) {
|
|
2833
2833
|
return _t(t);
|
|
2834
2834
|
}
|
|
2835
2835
|
// ---- User Management ----
|
|
2836
2836
|
async listUsers() {
|
|
2837
|
-
const t = await
|
|
2837
|
+
const t = await oe("/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 = Nt, r = tr;
|
|
2844
2844
|
if (t) {
|
|
2845
|
-
const
|
|
2846
|
-
(t.baseUrl || t.chatBaseUrl || u) && (u || t.chatBaseUrl && t.chatBaseUrl !==
|
|
2845
|
+
const o = n.baseUrl, a = r.baseUrl, i = n.getAuthToken(), u = t.requestTimeoutMs !== void 0 || t.historyTimeoutMs !== void 0;
|
|
2846
|
+
(t.baseUrl || t.chatBaseUrl || u) && (u || t.chatBaseUrl && t.chatBaseUrl !== o || t.baseUrl && !o.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 s = {
|
|
2849
2849
|
token: n.getAuthToken(),
|
|
2850
|
-
setToken: (
|
|
2851
|
-
n.setAuthToken(
|
|
2850
|
+
setToken: (o) => {
|
|
2851
|
+
n.setAuthToken(o), r.setAuthToken(o);
|
|
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: s, 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 s = r.result, o = new Uint8Array(s);
|
|
2866
2866
|
let a = "";
|
|
2867
|
-
const i =
|
|
2868
|
-
for (let u = 0; u < i; u++) a += String.fromCharCode(
|
|
2867
|
+
const i = o.byteLength;
|
|
2868
|
+
for (let u = 0; u < i; u++) a += String.fromCharCode(o[u]);
|
|
2869
2869
|
t(btoa(a));
|
|
2870
|
-
} catch (
|
|
2871
|
-
n(
|
|
2870
|
+
} catch (s) {
|
|
2871
|
+
n(s);
|
|
2872
2872
|
}
|
|
2873
|
-
}, r.onerror = (
|
|
2873
|
+
}, r.onerror = (s) => n(s), r.readAsArrayBuffer(e);
|
|
2874
2874
|
});
|
|
2875
2875
|
}
|
|
2876
|
-
async function
|
|
2876
|
+
async function sr(e = []) {
|
|
2877
2877
|
const t = [], n = [];
|
|
2878
2878
|
for (const r of e)
|
|
2879
2879
|
try {
|
|
2880
|
-
const
|
|
2880
|
+
const s = await rr(r), o = r.type || "application/octet-stream";
|
|
2881
2881
|
n.push({
|
|
2882
2882
|
filename: r.name,
|
|
2883
|
-
data:
|
|
2884
|
-
mime_type:
|
|
2885
|
-
}),
|
|
2883
|
+
data: s,
|
|
2884
|
+
mime_type: o
|
|
2885
|
+
}), o.startsWith("image/") ? t.push({
|
|
2886
2886
|
type: "image_url",
|
|
2887
|
-
image_url: { url: `data:${
|
|
2887
|
+
image_url: { url: `data:${o};base64,${s}` }
|
|
2888
2888
|
}) : t.push({
|
|
2889
2889
|
type: "file",
|
|
2890
|
-
url: `data:${
|
|
2891
|
-
mimeType:
|
|
2890
|
+
url: `data:${o};base64,${s}`,
|
|
2891
|
+
mimeType: o,
|
|
2892
2892
|
name: r.name,
|
|
2893
2893
|
size: r.size
|
|
2894
2894
|
});
|
|
@@ -2896,10 +2896,10 @@ async function or(e = []) {
|
|
|
2896
2896
|
}
|
|
2897
2897
|
return { contentParts: t, filesInfo: n };
|
|
2898
2898
|
}
|
|
2899
|
-
function
|
|
2899
|
+
function or(e) {
|
|
2900
2900
|
return e.filter((t) => t.type === "text").map((t) => t.text).join("");
|
|
2901
2901
|
}
|
|
2902
|
-
function
|
|
2902
|
+
function is(e) {
|
|
2903
2903
|
if (e == null) return null;
|
|
2904
2904
|
const t = String(e).trim();
|
|
2905
2905
|
return t.length > 0 ? t : null;
|
|
@@ -2911,13 +2911,13 @@ function ar(e) {
|
|
|
2911
2911
|
name: e.name ?? void 0
|
|
2912
2912
|
};
|
|
2913
2913
|
}
|
|
2914
|
-
function
|
|
2914
|
+
function cs(e) {
|
|
2915
2915
|
var n;
|
|
2916
2916
|
if (e.name && e.name.trim()) return e.name;
|
|
2917
2917
|
const t = (n = e.additionalKwargs) == null ? void 0 : n.agentName;
|
|
2918
2918
|
return typeof t == "string" && t.trim() ? t : e.model && e.model.includes("/") ? e.model.split("/").pop() || null : e.model || null;
|
|
2919
2919
|
}
|
|
2920
|
-
function
|
|
2920
|
+
function ls(e) {
|
|
2921
2921
|
const t = e.updatedAt ?? e.createdAt ?? "", n = Array.isArray(e.content) ? e.content.map((a) => {
|
|
2922
2922
|
switch (a.type) {
|
|
2923
2923
|
case "text":
|
|
@@ -2927,8 +2927,8 @@ function lo(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}` : "", s = "checkpointNs" in e && e.checkpointNs ? `ns:${e.checkpointNs}` : "", o = [r, s].filter(Boolean).join("|");
|
|
2931
|
+
return `${e.id}:${t}:${n}${o ? `:${o}` : ""}`;
|
|
2932
2932
|
}
|
|
2933
2933
|
function Me() {
|
|
2934
2934
|
const e = Ue(Lt);
|
|
@@ -3009,73 +3009,73 @@ 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, s] = $(e.token ?? null), o = W(e.headers ?? {}), a = e.credentials ?? "include", i = W(e);
|
|
3013
3013
|
X(() => {
|
|
3014
3014
|
i.current = e;
|
|
3015
3015
|
}, [e]);
|
|
3016
|
-
const u = _((
|
|
3017
|
-
var j,
|
|
3016
|
+
const u = _((p) => {
|
|
3017
|
+
var j, C, O, F, E, B, z, K, N, L;
|
|
3018
3018
|
const w = i.current;
|
|
3019
3019
|
if (!w) return;
|
|
3020
|
-
(j = w.onEvent) == null || j.call(w,
|
|
3021
|
-
}, []), [c, l] = $(!1), [d,
|
|
3022
|
-
|
|
3023
|
-
}, []), k = _(() => {
|
|
3024
|
-
m(null), I(null);
|
|
3020
|
+
(j = w.onEvent) == null || j.call(w, p), p.type === "thread_info" && ((C = w.onThreadInfo) == null || C.call(w, p)), p.type === "values" && Array.isArray(p.checkpoints) && ((O = w.handleValuesEvent) == null || O.call(w, p)), p.type === "metadata" && ((F = w.onMetadataEvent) == null || F.call(w, p)), typeof p.type == "string" && (p.type === "custom" || p.type.startsWith("custom.")) && ((E = w.onCustomEvent) == null || E.call(w, p)), p.type === "updates" && ((B = w.onUpdateEvent) == null || B.call(w, p)), p.type === "tool.end" ? (z = w.onToolEnd) == null || z.call(w, p) : p.type === "tool.start" && ((K = w.onToolStart) == null || K.call(w, p)), p.type === "heartbeat" && ((N = w.onHeartbeat) == null || N.call(w, p)), p.type === "token" && ((L = w.onToken) == null || L.call(w, p.token));
|
|
3021
|
+
}, []), [c, l] = $(!1), [d, g] = $(null), [m, I] = $(!1), [f, v] = $(null), x = W(null), M = W(!0), A = W(null), k = _((p) => {
|
|
3022
|
+
s(p);
|
|
3025
3023
|
}, []), b = _(() => {
|
|
3026
|
-
|
|
3024
|
+
g(null), v(null);
|
|
3025
|
+
}, []), h = _(() => {
|
|
3026
|
+
var C, O;
|
|
3027
3027
|
console.debug("[use-chat] stop() invoked - aborting stream");
|
|
3028
|
-
const
|
|
3028
|
+
const p = (C = A.current) == null ? void 0 : C.threadId, w = (O = A.current) == null ? void 0 : O.runId, P = () => {
|
|
3029
3029
|
var F;
|
|
3030
|
-
(F =
|
|
3030
|
+
(F = x.current) == null || F.abort(), x.current = null, A.current = null, l(!1), I(!1);
|
|
3031
3031
|
};
|
|
3032
|
-
(w ||
|
|
3032
|
+
(w || p ? Nt.cancelRun(w || p).catch((F) => {
|
|
3033
3033
|
console.warn("[use-chat] cancel run failed:", F);
|
|
3034
3034
|
}) : Promise.resolve()).finally(P);
|
|
3035
|
-
}, []),
|
|
3036
|
-
(
|
|
3037
|
-
|
|
3035
|
+
}, []), T = _(
|
|
3036
|
+
(p) => {
|
|
3037
|
+
x.current && (x.current.abort(), x.current = null);
|
|
3038
3038
|
const w = {
|
|
3039
|
-
text: typeof
|
|
3040
|
-
threadId:
|
|
3041
|
-
attachments:
|
|
3042
|
-
payload:
|
|
3043
|
-
...
|
|
3044
|
-
creativityLevel:
|
|
3039
|
+
text: typeof p.content == "string" ? p.content : p.text,
|
|
3040
|
+
threadId: p.threadId,
|
|
3041
|
+
attachments: p.attachments,
|
|
3042
|
+
payload: p.payload ? {
|
|
3043
|
+
...p.payload,
|
|
3044
|
+
creativityLevel: p.payload.creativityLevel ?? "medium"
|
|
3045
3045
|
} : { creativityLevel: "medium" },
|
|
3046
|
-
config:
|
|
3047
|
-
checkpointId:
|
|
3048
|
-
checkpointNs:
|
|
3049
|
-
edit:
|
|
3050
|
-
command:
|
|
3046
|
+
config: p.config,
|
|
3047
|
+
checkpointId: p.checkpointId,
|
|
3048
|
+
checkpointNs: p.checkpointNs || void 0,
|
|
3049
|
+
edit: p.edit ?? !1,
|
|
3050
|
+
command: p.command
|
|
3051
3051
|
};
|
|
3052
|
-
l(!0),
|
|
3052
|
+
l(!0), g(null), v(null);
|
|
3053
3053
|
const P = new AbortController();
|
|
3054
|
-
|
|
3055
|
-
let j = null,
|
|
3056
|
-
return
|
|
3054
|
+
x.current = P;
|
|
3055
|
+
let j = null, C = !1;
|
|
3056
|
+
return A.current = {
|
|
3057
3057
|
threadId: w.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, E, B, z, K;
|
|
3064
3064
|
try {
|
|
3065
|
-
let
|
|
3065
|
+
let N = {};
|
|
3066
3066
|
try {
|
|
3067
3067
|
if (r)
|
|
3068
|
-
|
|
3068
|
+
N = { 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(Ne.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(Ne.chatSettings);
|
|
3074
|
+
ge && (Q = ((E = JSON.parse(ge)) == null ? void 0 : E.apiKey) || null);
|
|
3075
3075
|
} catch {
|
|
3076
3076
|
}
|
|
3077
3077
|
const Z = te || ke || Q || null;
|
|
3078
|
-
Z && (
|
|
3078
|
+
Z && (N = { Authorization: `Bearer ${Z}` });
|
|
3079
3079
|
}
|
|
3080
3080
|
} catch {
|
|
3081
3081
|
}
|
|
@@ -3083,26 +3083,26 @@ function pr(e = {}) {
|
|
|
3083
3083
|
let L = {};
|
|
3084
3084
|
if (typeof window < "u")
|
|
3085
3085
|
try {
|
|
3086
|
-
const G = (B = window.localStorage) == null ? void 0 : B.getItem(
|
|
3086
|
+
const G = (B = window.localStorage) == null ? void 0 : B.getItem(Ne.authSessionId);
|
|
3087
3087
|
G && (L = { "X-Session-Id": G });
|
|
3088
3088
|
} catch {
|
|
3089
3089
|
}
|
|
3090
3090
|
const H = {
|
|
3091
|
-
...
|
|
3091
|
+
...N,
|
|
3092
3092
|
...L,
|
|
3093
|
-
...
|
|
3094
|
-
},
|
|
3093
|
+
...o.current
|
|
3094
|
+
}, y = {
|
|
3095
3095
|
"Content-Type": "application/json",
|
|
3096
3096
|
Accept: "text/event-stream",
|
|
3097
3097
|
...H
|
|
3098
3098
|
}, U = await fetch(t + n, {
|
|
3099
3099
|
method: "POST",
|
|
3100
|
-
headers:
|
|
3100
|
+
headers: y,
|
|
3101
3101
|
body: JSON.stringify(w),
|
|
3102
3102
|
signal: P.signal,
|
|
3103
3103
|
credentials: a
|
|
3104
3104
|
});
|
|
3105
|
-
if (
|
|
3105
|
+
if (A.current && (A.current.headers = H), !U.ok || !U.body) {
|
|
3106
3106
|
const G = await U.text().catch(() => "");
|
|
3107
3107
|
console.debug(
|
|
3108
3108
|
"[use-chat] non-OK response",
|
|
@@ -3110,22 +3110,22 @@ function pr(e = {}) {
|
|
|
3110
3110
|
G == null ? void 0 : G.slice(0, 500)
|
|
3111
3111
|
);
|
|
3112
3112
|
const te = `stream ${U.status}${G ? ": " + G : ""}`;
|
|
3113
|
-
throw te && (
|
|
3113
|
+
throw te && (g(te), j = "error"), new Error(te);
|
|
3114
3114
|
}
|
|
3115
|
-
|
|
3116
|
-
const
|
|
3115
|
+
I(!0);
|
|
3116
|
+
const S = U.body.getReader(), J = new TextDecoder();
|
|
3117
3117
|
let V = "", q = 0, ee = Date.now();
|
|
3118
3118
|
const re = setInterval(() => {
|
|
3119
|
-
Date.now() - ee > 18e5 && (
|
|
3119
|
+
Date.now() - ee > 18e5 && (g("Stream idle timeout"), j = "error", P.abort());
|
|
3120
3120
|
}, 5e3), ue = 1024 * 1024;
|
|
3121
3121
|
try {
|
|
3122
3122
|
const G = U.headers.get("X-Thread-Id") || U.headers.get("x-thread-id"), te = U.headers.get("X-Run-Id") || U.headers.get("x-run-id");
|
|
3123
|
-
for (
|
|
3124
|
-
...
|
|
3125
|
-
threadId: G ??
|
|
3126
|
-
runId: te ??
|
|
3123
|
+
for (A.current && (A.current = {
|
|
3124
|
+
...A.current,
|
|
3125
|
+
threadId: G ?? A.current.threadId,
|
|
3126
|
+
runId: te ?? A.current.runId
|
|
3127
3127
|
}); ; ) {
|
|
3128
|
-
const { value: ke, done: Q } = await
|
|
3128
|
+
const { value: ke, done: Q } = await S.read();
|
|
3129
3129
|
if (Q) break;
|
|
3130
3130
|
V += J.decode(ke, { stream: !0 }), V.length > ue && (V = "", console.warn("Stream buffer reset: exceeded 1MB"));
|
|
3131
3131
|
let Z;
|
|
@@ -3139,42 +3139,42 @@ function pr(e = {}) {
|
|
|
3139
3139
|
for (const he of je)
|
|
3140
3140
|
if (!he.startsWith(":") && he) {
|
|
3141
3141
|
if (he.startsWith("event:")) {
|
|
3142
|
-
const
|
|
3143
|
-
|
|
3142
|
+
const Ae = he.slice(6).trim();
|
|
3143
|
+
Ae && (me = Ae);
|
|
3144
3144
|
continue;
|
|
3145
3145
|
}
|
|
3146
3146
|
if (he.startsWith("data:")) {
|
|
3147
|
-
const
|
|
3148
|
-
Be.push(
|
|
3147
|
+
const Ae = he.slice(5);
|
|
3148
|
+
Be.push(Ae.startsWith(" ") ? Ae.slice(1) : Ae);
|
|
3149
3149
|
}
|
|
3150
3150
|
}
|
|
3151
|
-
const
|
|
3151
|
+
const ve = Be.join(`
|
|
3152
3152
|
`);
|
|
3153
|
-
if (!
|
|
3154
|
-
let
|
|
3153
|
+
if (!ve) continue;
|
|
3154
|
+
let se;
|
|
3155
3155
|
try {
|
|
3156
|
-
|
|
3156
|
+
se = JSON.parse(ve);
|
|
3157
3157
|
} catch {
|
|
3158
|
-
console.debug("[use-chat] malformed SSE:",
|
|
3158
|
+
console.debug("[use-chat] malformed SSE:", ve.slice(0, 200));
|
|
3159
3159
|
continue;
|
|
3160
3160
|
}
|
|
3161
|
-
|
|
3162
|
-
const Pe = cr(
|
|
3161
|
+
se = fr(me, se);
|
|
3162
|
+
const Pe = cr(se) ? se.data : se;
|
|
3163
3163
|
if (!Pe) {
|
|
3164
|
-
console.warn("[use-chat] dropped envelope event without payload",
|
|
3164
|
+
console.warn("[use-chat] dropped envelope event without payload", se);
|
|
3165
3165
|
continue;
|
|
3166
3166
|
}
|
|
3167
|
-
const
|
|
3167
|
+
const xe = $n(Pe);
|
|
3168
3168
|
ee = Date.now();
|
|
3169
|
-
const ye = typeof
|
|
3169
|
+
const ye = typeof xe.seq == "number" ? xe.seq : void 0;
|
|
3170
3170
|
if (ye !== void 0) {
|
|
3171
3171
|
if (ye <= q) {
|
|
3172
|
-
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: ye, lastProcessedSeq: q, type:
|
|
3172
|
+
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: ye, lastProcessedSeq: q, type: xe.type });
|
|
3173
3173
|
continue;
|
|
3174
3174
|
}
|
|
3175
3175
|
q = ye;
|
|
3176
3176
|
}
|
|
3177
|
-
u(
|
|
3177
|
+
u(xe);
|
|
3178
3178
|
}
|
|
3179
3179
|
}
|
|
3180
3180
|
j === null && !P.signal.aborted && (j = "complete");
|
|
@@ -3183,48 +3183,48 @@ function pr(e = {}) {
|
|
|
3183
3183
|
j = j ?? "aborted";
|
|
3184
3184
|
else {
|
|
3185
3185
|
const te = G.message || String(G);
|
|
3186
|
-
j = "error",
|
|
3186
|
+
j = "error", g(te);
|
|
3187
3187
|
}
|
|
3188
3188
|
} finally {
|
|
3189
3189
|
try {
|
|
3190
|
-
await
|
|
3190
|
+
await S.cancel();
|
|
3191
3191
|
} catch {
|
|
3192
3192
|
} finally {
|
|
3193
|
-
(
|
|
3193
|
+
(z = S.releaseLock) == null || z.call(S);
|
|
3194
3194
|
}
|
|
3195
3195
|
clearInterval(re);
|
|
3196
3196
|
}
|
|
3197
|
-
} catch (
|
|
3198
|
-
if (
|
|
3197
|
+
} catch (N) {
|
|
3198
|
+
if (N.name === "AbortError")
|
|
3199
3199
|
j = j ?? "aborted";
|
|
3200
3200
|
else {
|
|
3201
|
-
const L =
|
|
3202
|
-
j = "error",
|
|
3201
|
+
const L = N.message || String(N);
|
|
3202
|
+
j = "error", g(L), C || (C = !0, (K = e.onConnectionError) == null || K.call(e, L));
|
|
3203
3203
|
}
|
|
3204
3204
|
} finally {
|
|
3205
3205
|
try {
|
|
3206
3206
|
if (e.onFinish) {
|
|
3207
|
-
const
|
|
3207
|
+
const N = {
|
|
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(N);
|
|
3215
3215
|
}
|
|
3216
|
-
} catch (
|
|
3217
|
-
console.warn("[use-chat] onClosed callback failed",
|
|
3216
|
+
} catch (N) {
|
|
3217
|
+
console.warn("[use-chat] onClosed callback failed", N);
|
|
3218
3218
|
}
|
|
3219
|
-
l(!1),
|
|
3219
|
+
l(!1), I(!1), x.current = null, A.current = null;
|
|
3220
3220
|
}
|
|
3221
3221
|
})(), Promise.resolve();
|
|
3222
3222
|
},
|
|
3223
3223
|
[t, n, r, e, u]
|
|
3224
3224
|
);
|
|
3225
3225
|
return X(() => () => {
|
|
3226
|
-
var
|
|
3227
|
-
|
|
3226
|
+
var p;
|
|
3227
|
+
M.current = !1, (p = x.current) == null || p.abort();
|
|
3228
3228
|
}, []), {
|
|
3229
3229
|
isStreaming: c,
|
|
3230
3230
|
error: d,
|
|
@@ -3236,20 +3236,20 @@ function pr(e = {}) {
|
|
|
3236
3236
|
lastCheckpointId: null,
|
|
3237
3237
|
// Deprecated: use checkpoint from reducer
|
|
3238
3238
|
lastSeq: 0,
|
|
3239
|
-
connected:
|
|
3240
|
-
stream:
|
|
3241
|
-
stop:
|
|
3242
|
-
clear:
|
|
3243
|
-
setToken:
|
|
3239
|
+
connected: m,
|
|
3240
|
+
stream: T,
|
|
3241
|
+
stop: h,
|
|
3242
|
+
clear: b,
|
|
3243
|
+
setToken: k,
|
|
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: d ? "error" : c ?
|
|
3249
|
+
connectionState: d ? "error" : c ? m ? "connected" : "connecting" : "idle",
|
|
3250
3250
|
messages: [],
|
|
3251
3251
|
// useStream doesn't maintain messages, use useChatSession instead
|
|
3252
|
-
submit:
|
|
3252
|
+
submit: T
|
|
3253
3253
|
};
|
|
3254
3254
|
}
|
|
3255
3255
|
function gr({
|
|
@@ -3257,22 +3257,22 @@ function gr({
|
|
|
3257
3257
|
initialThreadId: t = null,
|
|
3258
3258
|
onError: n,
|
|
3259
3259
|
onThreadChange: r,
|
|
3260
|
-
onCurrentThreadDeleted:
|
|
3260
|
+
onCurrentThreadDeleted: s
|
|
3261
3261
|
}) {
|
|
3262
|
-
const [
|
|
3262
|
+
const [o, a] = $([]), [i, u] = $(t), [c, l] = $(!1), [d, g] = $(null), m = W(i), I = W(/* @__PURE__ */ new Map());
|
|
3263
3263
|
X(() => {
|
|
3264
|
-
|
|
3264
|
+
m.current = i;
|
|
3265
3265
|
}, [i]), X(() => {
|
|
3266
|
-
t !== void 0 && t !==
|
|
3266
|
+
t !== void 0 && t !== m.current && u(t);
|
|
3267
3267
|
}, [t]);
|
|
3268
3268
|
const f = _(async () => {
|
|
3269
|
-
l(!0),
|
|
3269
|
+
l(!0), g(null);
|
|
3270
3270
|
try {
|
|
3271
|
-
const
|
|
3272
|
-
a(
|
|
3273
|
-
} catch (
|
|
3274
|
-
const
|
|
3275
|
-
|
|
3271
|
+
const b = await e.listThreads();
|
|
3272
|
+
a(b ?? []);
|
|
3273
|
+
} catch (b) {
|
|
3274
|
+
const h = String(b);
|
|
3275
|
+
g(h), n == null || n(h);
|
|
3276
3276
|
} finally {
|
|
3277
3277
|
l(!1);
|
|
3278
3278
|
}
|
|
@@ -3282,82 +3282,82 @@ function gr({
|
|
|
3282
3282
|
}, [f]), X(() => {
|
|
3283
3283
|
r == null || r(i);
|
|
3284
3284
|
}, [i, r]);
|
|
3285
|
-
const
|
|
3286
|
-
async (
|
|
3285
|
+
const v = _(
|
|
3286
|
+
async (b, h) => {
|
|
3287
3287
|
try {
|
|
3288
|
-
const
|
|
3289
|
-
return u(
|
|
3290
|
-
} catch (
|
|
3291
|
-
const
|
|
3292
|
-
return n == null || n(
|
|
3288
|
+
const T = h && typeof h == "object" ? { id: h.id, name: h.name ?? "" } : void 0, p = await e.createThread(b, T);
|
|
3289
|
+
return u(p.threadId), await f(), p.threadId;
|
|
3290
|
+
} catch (T) {
|
|
3291
|
+
const p = String(T);
|
|
3292
|
+
return n == null || n(p), null;
|
|
3293
3293
|
}
|
|
3294
3294
|
},
|
|
3295
3295
|
[e, n, f]
|
|
3296
|
-
),
|
|
3297
|
-
async (
|
|
3298
|
-
const
|
|
3299
|
-
a((
|
|
3300
|
-
const
|
|
3301
|
-
|
|
3296
|
+
), x = _(
|
|
3297
|
+
async (b) => {
|
|
3298
|
+
const h = o;
|
|
3299
|
+
a((p) => p.filter((w) => w.threadId !== b));
|
|
3300
|
+
const T = new AbortController();
|
|
3301
|
+
I.current.set(b, T);
|
|
3302
3302
|
try {
|
|
3303
|
-
await e.deleteThread(
|
|
3304
|
-
} catch (
|
|
3305
|
-
a(
|
|
3306
|
-
const w = String(
|
|
3303
|
+
await e.deleteThread(b), m.current === b && (u(null), s == null || s());
|
|
3304
|
+
} catch (p) {
|
|
3305
|
+
a(h);
|
|
3306
|
+
const w = String(p);
|
|
3307
3307
|
n == null || n(w);
|
|
3308
3308
|
} finally {
|
|
3309
|
-
|
|
3309
|
+
I.current.delete(b);
|
|
3310
3310
|
}
|
|
3311
3311
|
},
|
|
3312
|
-
[e,
|
|
3313
|
-
),
|
|
3314
|
-
async (
|
|
3312
|
+
[e, s, n, o]
|
|
3313
|
+
), M = _(
|
|
3314
|
+
async (b, h) => {
|
|
3315
3315
|
try {
|
|
3316
|
-
await e.updateThread(
|
|
3317
|
-
} catch (
|
|
3318
|
-
n == null || n(String(
|
|
3316
|
+
await e.updateThread(b, h), await f();
|
|
3317
|
+
} catch (T) {
|
|
3318
|
+
n == null || n(String(T));
|
|
3319
3319
|
}
|
|
3320
3320
|
},
|
|
3321
3321
|
[e, n, f]
|
|
3322
|
-
),
|
|
3322
|
+
), A = Y(
|
|
3323
3323
|
() => ({
|
|
3324
|
-
createThread:
|
|
3325
|
-
deleteThread:
|
|
3326
|
-
renameThread:
|
|
3324
|
+
createThread: v,
|
|
3325
|
+
deleteThread: x,
|
|
3326
|
+
renameThread: M,
|
|
3327
3327
|
refreshThreads: f
|
|
3328
3328
|
}),
|
|
3329
|
-
[
|
|
3330
|
-
),
|
|
3331
|
-
if (!(
|
|
3332
|
-
const
|
|
3333
|
-
threadId:
|
|
3334
|
-
title:
|
|
3335
|
-
project:
|
|
3336
|
-
createdAt:
|
|
3337
|
-
updatedAt:
|
|
3338
|
-
messageCount:
|
|
3329
|
+
[v, x, M, f]
|
|
3330
|
+
), k = _((b) => {
|
|
3331
|
+
if (!(b != null && b.threadId)) return;
|
|
3332
|
+
const h = {
|
|
3333
|
+
threadId: b.threadId,
|
|
3334
|
+
title: b.title || `Thread ${b.threadId.slice(0, 8)}`,
|
|
3335
|
+
project: b.project,
|
|
3336
|
+
createdAt: b.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
3337
|
+
updatedAt: b.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
3338
|
+
messageCount: b.messageCount ?? 1
|
|
3339
3339
|
};
|
|
3340
|
-
a((
|
|
3341
|
-
let
|
|
3342
|
-
const w =
|
|
3340
|
+
a((T) => {
|
|
3341
|
+
let p = !1;
|
|
3342
|
+
const w = T.map((P) => P.threadId === h.threadId ? (p = !0, console.debug("[useThreadsState] thread_info: updating existing thread", h.threadId), {
|
|
3343
3343
|
...P,
|
|
3344
|
-
title:
|
|
3345
|
-
project:
|
|
3346
|
-
updatedAt:
|
|
3347
|
-
messageCount:
|
|
3344
|
+
title: h.title ?? P.title,
|
|
3345
|
+
project: h.project ?? P.project,
|
|
3346
|
+
updatedAt: h.updatedAt ?? P.updatedAt,
|
|
3347
|
+
messageCount: h.messageCount ?? P.messageCount
|
|
3348
3348
|
}) : P);
|
|
3349
|
-
return
|
|
3349
|
+
return p ? w : (console.debug("[useThreadsState] thread_info: adding thread to list", h.threadId), [h, ...T]);
|
|
3350
3350
|
});
|
|
3351
3351
|
}, []);
|
|
3352
3352
|
return {
|
|
3353
|
-
threads:
|
|
3353
|
+
threads: o,
|
|
3354
3354
|
currentThreadId: i,
|
|
3355
|
-
currentThreadIdRef:
|
|
3355
|
+
currentThreadIdRef: m,
|
|
3356
3356
|
setCurrentThreadId: u,
|
|
3357
3357
|
isLoadingThreads: c,
|
|
3358
3358
|
threadsError: d,
|
|
3359
|
-
actions:
|
|
3360
|
-
addThreadFromEvent:
|
|
3359
|
+
actions: A,
|
|
3360
|
+
addThreadFromEvent: k
|
|
3361
3361
|
};
|
|
3362
3362
|
}
|
|
3363
3363
|
const jt = Ce(null);
|
|
@@ -3367,45 +3367,45 @@ function mr({
|
|
|
3367
3367
|
onError: n,
|
|
3368
3368
|
onThreadChange: r
|
|
3369
3369
|
}) {
|
|
3370
|
-
const { chatApi:
|
|
3371
|
-
threads:
|
|
3370
|
+
const { chatApi: s } = Me(), {
|
|
3371
|
+
threads: o,
|
|
3372
3372
|
currentThreadId: a,
|
|
3373
3373
|
setCurrentThreadId: i,
|
|
3374
3374
|
currentThreadIdRef: u,
|
|
3375
3375
|
isLoadingThreads: c,
|
|
3376
3376
|
threadsError: l,
|
|
3377
3377
|
actions: d,
|
|
3378
|
-
addThreadFromEvent:
|
|
3378
|
+
addThreadFromEvent: g
|
|
3379
3379
|
} = gr({
|
|
3380
|
-
api:
|
|
3380
|
+
api: s,
|
|
3381
3381
|
initialThreadId: t,
|
|
3382
3382
|
onError: n,
|
|
3383
3383
|
onThreadChange: r
|
|
3384
|
-
}),
|
|
3384
|
+
}), m = Y(
|
|
3385
3385
|
() => ({
|
|
3386
|
-
threads:
|
|
3386
|
+
threads: o,
|
|
3387
3387
|
currentThreadId: a,
|
|
3388
3388
|
setCurrentThreadId: i,
|
|
3389
3389
|
currentThreadIdRef: u,
|
|
3390
3390
|
isLoading: c,
|
|
3391
3391
|
error: l,
|
|
3392
3392
|
actions: d,
|
|
3393
|
-
addThreadFromEvent:
|
|
3393
|
+
addThreadFromEvent: g
|
|
3394
3394
|
}),
|
|
3395
3395
|
[
|
|
3396
|
-
|
|
3396
|
+
o,
|
|
3397
3397
|
a,
|
|
3398
3398
|
i,
|
|
3399
3399
|
u,
|
|
3400
3400
|
c,
|
|
3401
3401
|
l,
|
|
3402
3402
|
d,
|
|
3403
|
-
|
|
3403
|
+
g
|
|
3404
3404
|
]
|
|
3405
3405
|
);
|
|
3406
|
-
return /* @__PURE__ */ ie(jt.Provider, { value:
|
|
3406
|
+
return /* @__PURE__ */ ie(jt.Provider, { value: m, children: e });
|
|
3407
3407
|
}
|
|
3408
|
-
function
|
|
3408
|
+
function st(e) {
|
|
3409
3409
|
const t = Ue(jt);
|
|
3410
3410
|
if (!t && !(e != null && e.optional)) throw new Error("useThreads must be used within a ThreadsProvider");
|
|
3411
3411
|
return t;
|
|
@@ -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 s = Bt(r);
|
|
3442
|
+
return !!((s == null ? void 0 : s.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 o = { ...e[r], checkpointId: t, checkpointNs: n ?? void 0 };
|
|
3456
|
+
return Ft(e, r, o);
|
|
3457
3457
|
}
|
|
3458
3458
|
return e;
|
|
3459
3459
|
}
|
|
@@ -3484,7 +3484,19 @@ function wr(e, t) {
|
|
|
3484
3484
|
messages: Oe(((n = t.payload) == null ? void 0 : n.messages) ?? [])
|
|
3485
3485
|
};
|
|
3486
3486
|
case "user_message": {
|
|
3487
|
-
const { message: r } = t.payload;
|
|
3487
|
+
const { message: r, editingMessageId: s } = t.payload;
|
|
3488
|
+
if (s) {
|
|
3489
|
+
const o = e.messages.findIndex((a) => a.id === s);
|
|
3490
|
+
if (o !== -1)
|
|
3491
|
+
return {
|
|
3492
|
+
...e,
|
|
3493
|
+
status: "streaming",
|
|
3494
|
+
messages: [...e.messages.slice(0, o), r],
|
|
3495
|
+
assemblingId: null,
|
|
3496
|
+
lastCheckpointId: null,
|
|
3497
|
+
error: null
|
|
3498
|
+
};
|
|
3499
|
+
}
|
|
3488
3500
|
return {
|
|
3489
3501
|
...e,
|
|
3490
3502
|
status: "streaming",
|
|
@@ -3495,7 +3507,7 @@ function wr(e, t) {
|
|
|
3495
3507
|
};
|
|
3496
3508
|
}
|
|
3497
3509
|
case "seed": {
|
|
3498
|
-
const r = Oe(t.payload.messages),
|
|
3510
|
+
const r = Oe(t.payload.messages), s = {
|
|
3499
3511
|
...e,
|
|
3500
3512
|
status: "idle",
|
|
3501
3513
|
messages: r,
|
|
@@ -3504,32 +3516,32 @@ function wr(e, t) {
|
|
|
3504
3516
|
taskMessagesByScope: {},
|
|
3505
3517
|
error: null
|
|
3506
3518
|
};
|
|
3507
|
-
return Object.prototype.hasOwnProperty.call(t.payload, "checkpointId") && (
|
|
3519
|
+
return Object.prototype.hasOwnProperty.call(t.payload, "checkpointId") && (s.lastCheckpointId = t.payload.checkpointId ?? null), Object.prototype.hasOwnProperty.call(t.payload, "checkpointNs") && (s.lastCheckpointNs = t.payload.checkpointNs ?? null), Object.prototype.hasOwnProperty.call(t.payload, "values") && (s.values = t.payload.values ?? {}), s;
|
|
3508
3520
|
}
|
|
3509
3521
|
case "prepend": {
|
|
3510
3522
|
const r = Oe(t.payload.messages);
|
|
3511
3523
|
if (!r.length) return e;
|
|
3512
|
-
const
|
|
3513
|
-
return
|
|
3524
|
+
const s = new Set(e.messages.map((a) => a.id)), o = r.filter((a) => !s.has(a.id));
|
|
3525
|
+
return o.length ? { ...e, messages: [...o, ...e.messages] } : e;
|
|
3514
3526
|
}
|
|
3515
3527
|
case "event":
|
|
3516
3528
|
return pt(e, t.payload.ev);
|
|
3517
3529
|
case "batch": {
|
|
3518
3530
|
const { events: r } = t.payload;
|
|
3519
|
-
return r.length ? r.reduce((
|
|
3531
|
+
return r.length ? r.reduce((s, o) => pt(s, o), e) : e;
|
|
3520
3532
|
}
|
|
3521
3533
|
default:
|
|
3522
3534
|
return e;
|
|
3523
3535
|
}
|
|
3524
3536
|
}
|
|
3525
3537
|
function kr(e = []) {
|
|
3526
|
-
const [t, n] = Wt(wr, { ...Ot, messages: e }), r = W([]),
|
|
3527
|
-
|
|
3538
|
+
const [t, n] = Wt(wr, { ...Ot, messages: e }), r = W([]), s = W(null), o = _(() => {
|
|
3539
|
+
s.current !== null && typeof window < "u" && window.cancelAnimationFrame(s.current), s.current = null;
|
|
3528
3540
|
const c = r.current;
|
|
3529
3541
|
c.length && (r.current = [], n({ type: "batch", payload: { events: c } }));
|
|
3530
3542
|
}, []), a = _(() => {
|
|
3531
|
-
typeof window < "u" && typeof window.requestAnimationFrame == "function" ?
|
|
3532
|
-
}, [
|
|
3543
|
+
typeof window < "u" && typeof window.requestAnimationFrame == "function" ? s.current === null && (s.current = window.requestAnimationFrame(() => o())) : setTimeout(o, 8);
|
|
3544
|
+
}, [o]), i = _((c) => {
|
|
3533
3545
|
r.current.push(c), a();
|
|
3534
3546
|
}, [a]), u = Y(() => ({
|
|
3535
3547
|
setStatus: (c, l) => n({ type: "status", payload: { status: c, error: l } }),
|
|
@@ -3541,14 +3553,14 @@ function kr(e = []) {
|
|
|
3541
3553
|
return { state: t, dispatch: n, ...u };
|
|
3542
3554
|
}
|
|
3543
3555
|
function pt(e, t) {
|
|
3544
|
-
const n = t.origin, r = t.scope,
|
|
3556
|
+
const n = t.origin, r = t.scope, s = n === "task" || typeof r == "string" && r.startsWith("tools:");
|
|
3545
3557
|
if (t.type === "checkpoint") {
|
|
3546
|
-
const
|
|
3547
|
-
return { ...e, lastCheckpointId: t.checkpointId, lastCheckpointNs:
|
|
3558
|
+
const o = t.checkpointNs ?? e.lastCheckpointNs ?? null, a = br(e.messages, t.checkpointId, o);
|
|
3559
|
+
return { ...e, lastCheckpointId: t.checkpointId, lastCheckpointNs: o, messages: a };
|
|
3548
3560
|
}
|
|
3549
3561
|
if (t.type === "status") {
|
|
3550
|
-
const
|
|
3551
|
-
return { ...e, status:
|
|
3562
|
+
const o = t.status === "completed" || t.status === "error" ? "idle" : t.status === "interrupted" ? "awaiting_input" : e.status;
|
|
3563
|
+
return { ...e, status: o };
|
|
3552
3564
|
}
|
|
3553
3565
|
if (t.type === "interrupt")
|
|
3554
3566
|
return {
|
|
@@ -3562,25 +3574,25 @@ function pt(e, t) {
|
|
|
3562
3574
|
}
|
|
3563
3575
|
};
|
|
3564
3576
|
if (t.type === "error") {
|
|
3565
|
-
const
|
|
3577
|
+
const o = {
|
|
3566
3578
|
id: `err-${Date.now()}`,
|
|
3567
3579
|
role: "system",
|
|
3568
3580
|
content: [{ type: "text", text: `Error: ${t.message}` }],
|
|
3569
3581
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3570
3582
|
};
|
|
3571
|
-
return { ...e, status: "error", error: t.message, messages: [...e.messages,
|
|
3583
|
+
return { ...e, status: "error", error: t.message, messages: [...e.messages, o] };
|
|
3572
3584
|
}
|
|
3573
3585
|
if (t.type === "values" && "messages" in t && Array.isArray(t.messages)) {
|
|
3574
|
-
const
|
|
3586
|
+
const o = t, a = Array.isArray(o.messages) ? o.messages : [], i = Oe(a), { messages: u, ...c } = o, l = c.__interrupt__ ?? c.interrupts, d = Array.isArray(l) && l.length > 0 ? {
|
|
3575
3587
|
id: l[0].id || "native-interrupt",
|
|
3576
3588
|
value: l[0].value || l[0],
|
|
3577
3589
|
alternatives: l[0].alternatives
|
|
3578
3590
|
} : null;
|
|
3579
|
-
if (
|
|
3580
|
-
const
|
|
3591
|
+
if (s) {
|
|
3592
|
+
const g = typeof r == "string" && r.length > 0 ? r : "task";
|
|
3581
3593
|
return {
|
|
3582
3594
|
...e,
|
|
3583
|
-
taskMessagesByScope: { ...e.taskMessagesByScope, [
|
|
3595
|
+
taskMessagesByScope: { ...e.taskMessagesByScope, [g]: i },
|
|
3584
3596
|
assemblingId: null
|
|
3585
3597
|
// Clear streaming state when finalized
|
|
3586
3598
|
};
|
|
@@ -3595,46 +3607,64 @@ function pt(e, t) {
|
|
|
3595
3607
|
};
|
|
3596
3608
|
}
|
|
3597
3609
|
if (t.type === "messages/metadata") {
|
|
3598
|
-
const
|
|
3610
|
+
const o = { ...e.messagesStreamMeta ?? {} }, a = t.metadata;
|
|
3599
3611
|
return a && typeof a == "object" && Object.entries(a).forEach(([i, u]) => {
|
|
3600
3612
|
const c = u == null ? void 0 : u.metadata;
|
|
3601
3613
|
if (!c || typeof c != "object") return;
|
|
3602
|
-
const l =
|
|
3603
|
-
|
|
3614
|
+
const l = o[i] ?? {};
|
|
3615
|
+
o[i] = {
|
|
3604
3616
|
...l,
|
|
3605
|
-
lastSeq: t.seq ?? l.lastSeq ?? null
|
|
3617
|
+
lastSeq: t.seq ?? l.lastSeq ?? null,
|
|
3618
|
+
metadata: { ...l.metadata ?? {}, ...c }
|
|
3606
3619
|
};
|
|
3607
|
-
}), { ...e, messagesStreamMeta:
|
|
3620
|
+
}), { ...e, messagesStreamMeta: o };
|
|
3621
|
+
}
|
|
3622
|
+
if (t.type === "messages/partial" || t.type === "message.delta") {
|
|
3623
|
+
const o = t.type === "messages/partial" ? t : {
|
|
3624
|
+
...t,
|
|
3625
|
+
type: "messages/partial",
|
|
3626
|
+
messages: t.delta ? [{
|
|
3627
|
+
id: t.id,
|
|
3628
|
+
type: "ai",
|
|
3629
|
+
content: t.delta,
|
|
3630
|
+
scope: t.scope,
|
|
3631
|
+
origin: t.origin
|
|
3632
|
+
}] : []
|
|
3633
|
+
};
|
|
3634
|
+
return Ir(e, o, s);
|
|
3608
3635
|
}
|
|
3609
|
-
return t.type === "
|
|
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, s), status: "streaming" } : t.type === "tool.progress" ? xr(e, t, s) : t.type === "tool.end" ? Ar(e, t, s) : t.type === "artifact.update" ? Tr(e, t) : e;
|
|
3610
3637
|
}
|
|
3611
|
-
function
|
|
3612
|
-
var m,
|
|
3638
|
+
function Ir(e, t, n) {
|
|
3639
|
+
var m, I, f, v, x, M, A;
|
|
3613
3640
|
const r = t.messages;
|
|
3614
3641
|
if (!r.length)
|
|
3615
3642
|
return console.warn("[messagesReducer] Dropping messages/partial event without messages[]", t), e;
|
|
3616
|
-
const
|
|
3617
|
-
if (!
|
|
3618
|
-
const
|
|
3643
|
+
const s = r.find((k) => k.type === "ai" || k.type === "assistant" || k.role === "assistant");
|
|
3644
|
+
if (!s) return e;
|
|
3645
|
+
const o = s.id, a = s.content ?? "", i = typeof a == "string" ? [{ type: "text", text: a }] : Array.isArray(a) ? a.map((k) => typeof k == "string" ? { type: "text", text: k } : (k == null ? void 0 : k.type) === "text" ? { type: "text", text: typeof k.text == "string" ? k.text : k.content ?? "" } : ((k == null ? void 0 : k.type) === "reasoning", k)) : [], u = i.filter((k) => k.type === "text").map((k) => k.text).join(""), c = e.assemblingId !== o, l = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3619
3646
|
let d = n ? [...e.taskMessagesByScope[l] || []] : [...e.messages];
|
|
3647
|
+
const g = (I = (m = e.messagesStreamMeta) == null ? void 0 : m[o]) == null ? void 0 : I.metadata;
|
|
3620
3648
|
if (c) {
|
|
3621
|
-
const
|
|
3622
|
-
...
|
|
3649
|
+
const k = nt({
|
|
3650
|
+
...s,
|
|
3623
3651
|
role: "assistant",
|
|
3624
3652
|
content: i,
|
|
3625
3653
|
scope: t.scope,
|
|
3626
|
-
origin: t.origin
|
|
3654
|
+
origin: t.origin,
|
|
3655
|
+
responseMetadata: { ...g, ...s.responseMetadata ?? {} }
|
|
3627
3656
|
});
|
|
3628
|
-
|
|
3657
|
+
k && d.push(k);
|
|
3629
3658
|
} else {
|
|
3630
|
-
const
|
|
3631
|
-
if (
|
|
3632
|
-
const
|
|
3633
|
-
d[
|
|
3634
|
-
...
|
|
3659
|
+
const k = d.findIndex((b) => b.id === o);
|
|
3660
|
+
if (k !== -1) {
|
|
3661
|
+
const b = d[k];
|
|
3662
|
+
d[k] = {
|
|
3663
|
+
...b,
|
|
3635
3664
|
content: i,
|
|
3636
|
-
scope: t.scope ??
|
|
3637
|
-
origin: t.origin ??
|
|
3665
|
+
scope: t.scope ?? b.scope,
|
|
3666
|
+
origin: t.origin ?? b.origin,
|
|
3667
|
+
responseMetadata: { ...g, ...b.responseMetadata, ...s.responseMetadata ?? {} }
|
|
3638
3668
|
};
|
|
3639
3669
|
}
|
|
3640
3670
|
}
|
|
@@ -3643,32 +3673,32 @@ function vr(e, t, n) {
|
|
|
3643
3673
|
status: "streaming",
|
|
3644
3674
|
messages: n ? e.messages : d,
|
|
3645
3675
|
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [l]: d } : e.taskMessagesByScope,
|
|
3646
|
-
assemblingId:
|
|
3676
|
+
assemblingId: o,
|
|
3647
3677
|
messagesStreamMeta: {
|
|
3648
3678
|
...e.messagesStreamMeta ?? {},
|
|
3649
|
-
[
|
|
3650
|
-
...((
|
|
3651
|
-
lastSeq: t.seq ?? ((
|
|
3652
|
-
lastText: u || (((
|
|
3679
|
+
[o]: {
|
|
3680
|
+
...((f = e.messagesStreamMeta) == null ? void 0 : f[o]) ?? {},
|
|
3681
|
+
lastSeq: t.seq ?? ((x = (v = e.messagesStreamMeta) == null ? void 0 : v[o]) == null ? void 0 : x.lastSeq) ?? null,
|
|
3682
|
+
lastText: u || (((A = (M = e.messagesStreamMeta) == null ? void 0 : M[o]) == null ? void 0 : A.lastText) ?? "")
|
|
3653
3683
|
}
|
|
3654
3684
|
}
|
|
3655
3685
|
};
|
|
3656
3686
|
}
|
|
3657
|
-
function
|
|
3687
|
+
function ot(e, t) {
|
|
3658
3688
|
var n;
|
|
3659
3689
|
if (!t) return -1;
|
|
3660
3690
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
3661
|
-
const
|
|
3662
|
-
if (
|
|
3691
|
+
const s = e[r];
|
|
3692
|
+
if (s.role === "assistant" && ((n = s.toolCalls) != null && n.some((o) => o.id === t)))
|
|
3663
3693
|
return r;
|
|
3664
3694
|
}
|
|
3665
3695
|
return -1;
|
|
3666
3696
|
}
|
|
3667
|
-
function
|
|
3697
|
+
function vr(e, t, n) {
|
|
3668
3698
|
const r = t.id || t.callId;
|
|
3669
3699
|
if (!r) return e;
|
|
3670
|
-
const
|
|
3671
|
-
let i = n ? [...e.taskMessagesByScope[a] || []] : [...e.messages], u =
|
|
3700
|
+
const s = t.name || "tool", o = `Starting ${s}...`, a = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3701
|
+
let i = n ? [...e.taskMessagesByScope[a] || []] : [...e.messages], u = ot(i, r);
|
|
3672
3702
|
if (u === -1) {
|
|
3673
3703
|
for (let c = i.length - 1; c >= 0; c--)
|
|
3674
3704
|
if (i[c].role === "assistant") {
|
|
@@ -3689,13 +3719,13 @@ function Ir(e, t, n) {
|
|
|
3689
3719
|
i.push(c), u = i.length - 1;
|
|
3690
3720
|
}
|
|
3691
3721
|
if (u !== -1) {
|
|
3692
|
-
const c = i[u], l = [...c.toolCalls || []], d = l.findIndex((
|
|
3693
|
-
d >= 0 ? l[d] = { ...l[d], status: "running", content:
|
|
3722
|
+
const c = i[u], l = [...c.toolCalls || []], d = l.findIndex((g) => g.id === r);
|
|
3723
|
+
d >= 0 ? l[d] = { ...l[d], status: "running", content: o } : l.push({
|
|
3694
3724
|
id: r,
|
|
3695
|
-
name:
|
|
3725
|
+
name: s,
|
|
3696
3726
|
args: t.args || {},
|
|
3697
3727
|
status: "running",
|
|
3698
|
-
content:
|
|
3728
|
+
content: o
|
|
3699
3729
|
}), i[u] = {
|
|
3700
3730
|
...c,
|
|
3701
3731
|
toolCalls: l,
|
|
@@ -3709,17 +3739,17 @@ function Ir(e, t, n) {
|
|
|
3709
3739
|
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [a]: i } : e.taskMessagesByScope
|
|
3710
3740
|
};
|
|
3711
3741
|
}
|
|
3712
|
-
function
|
|
3742
|
+
function xr(e, t, n) {
|
|
3713
3743
|
const r = t.id;
|
|
3714
3744
|
if (!r) return e;
|
|
3715
|
-
const
|
|
3716
|
-
let
|
|
3717
|
-
const a =
|
|
3745
|
+
const s = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3746
|
+
let o = n ? [...e.taskMessagesByScope[s] || []] : [...e.messages];
|
|
3747
|
+
const a = ot(o, r);
|
|
3718
3748
|
if (a !== -1) {
|
|
3719
|
-
const i =
|
|
3749
|
+
const i = o[a], u = ce(t.content), c = (i.toolCalls || []).map(
|
|
3720
3750
|
(l) => l.id === r ? { ...l, content: typeof u == "string" ? u : l.content } : l
|
|
3721
3751
|
);
|
|
3722
|
-
|
|
3752
|
+
o[a] = {
|
|
3723
3753
|
...i,
|
|
3724
3754
|
toolCalls: c,
|
|
3725
3755
|
scope: t.scope ?? i.scope,
|
|
@@ -3728,18 +3758,18 @@ function Ar(e, t, n) {
|
|
|
3728
3758
|
}
|
|
3729
3759
|
return {
|
|
3730
3760
|
...e,
|
|
3731
|
-
messages: n ? e.messages :
|
|
3732
|
-
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [
|
|
3761
|
+
messages: n ? e.messages : o,
|
|
3762
|
+
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [s]: o } : e.taskMessagesByScope
|
|
3733
3763
|
};
|
|
3734
3764
|
}
|
|
3735
|
-
function
|
|
3765
|
+
function Ar(e, t, n) {
|
|
3736
3766
|
const r = t.id;
|
|
3737
3767
|
if (!r) return e;
|
|
3738
|
-
const
|
|
3739
|
-
let
|
|
3740
|
-
const a =
|
|
3768
|
+
const s = typeof t.scope == "string" && t.scope.length > 0 ? t.scope : "task";
|
|
3769
|
+
let o = n ? [...e.taskMessagesByScope[s] || []] : [...e.messages];
|
|
3770
|
+
const a = ot(o, r), i = ce(t.content ?? t.error);
|
|
3741
3771
|
if (a !== -1) {
|
|
3742
|
-
const c =
|
|
3772
|
+
const c = o[a], l = (c.toolCalls || []).map(
|
|
3743
3773
|
(d) => d.id === r ? {
|
|
3744
3774
|
...d,
|
|
3745
3775
|
status: t.error ? "failed" : "completed",
|
|
@@ -3747,7 +3777,7 @@ function xr(e, t, n) {
|
|
|
3747
3777
|
artifact: t.artifact
|
|
3748
3778
|
} : d
|
|
3749
3779
|
);
|
|
3750
|
-
|
|
3780
|
+
o[a] = {
|
|
3751
3781
|
...c,
|
|
3752
3782
|
toolCalls: l,
|
|
3753
3783
|
scope: t.scope ?? c.scope,
|
|
@@ -3765,21 +3795,21 @@ function xr(e, t, n) {
|
|
|
3765
3795
|
scope: t.scope,
|
|
3766
3796
|
origin: t.origin
|
|
3767
3797
|
};
|
|
3768
|
-
return
|
|
3798
|
+
return o.push(u), {
|
|
3769
3799
|
...e,
|
|
3770
|
-
messages: n ? e.messages :
|
|
3771
|
-
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [
|
|
3800
|
+
messages: n ? e.messages : o,
|
|
3801
|
+
taskMessagesByScope: n ? { ...e.taskMessagesByScope, [s]: o } : e.taskMessagesByScope
|
|
3772
3802
|
};
|
|
3773
3803
|
}
|
|
3774
3804
|
function Tr(e, t) {
|
|
3775
3805
|
const n = t.artifactId, r = hr(e.messages, n, t.callId);
|
|
3776
3806
|
if (!r) return e;
|
|
3777
|
-
const
|
|
3807
|
+
const s = e.messages.indexOf(r), o = yr(r, {
|
|
3778
3808
|
status: t.status,
|
|
3779
3809
|
progress: t.progress,
|
|
3780
3810
|
error: t.error
|
|
3781
3811
|
});
|
|
3782
|
-
return t.partial_data &&
|
|
3812
|
+
return t.partial_data && o.artifact && (o.artifact = { ...o.artifact, ...t.partial_data }), { ...e, messages: Ft(e.messages, s, o) };
|
|
3783
3813
|
}
|
|
3784
3814
|
function Re(e) {
|
|
3785
3815
|
if (!(!e || typeof e != "object" || Array.isArray(e)))
|
|
@@ -3810,24 +3840,24 @@ function gt(e) {
|
|
|
3810
3840
|
async function Mr(e, t) {
|
|
3811
3841
|
var i, u;
|
|
3812
3842
|
if (!e) return e ?? null;
|
|
3813
|
-
const n = le(e), r = Array.isArray(n.checkpoints) ? n.checkpoints : n.checkpoints ? Object.values(n.checkpoints) : [],
|
|
3843
|
+
const n = le(e), r = Array.isArray(n.checkpoints) ? n.checkpoints : n.checkpoints ? Object.values(n.checkpoints) : [], s = /* @__PURE__ */ new Set();
|
|
3814
3844
|
for (const c of r) {
|
|
3815
3845
|
const l = (i = c == null ? void 0 : c.values) == null ? void 0 : i.messages;
|
|
3816
3846
|
if (Array.isArray(l))
|
|
3817
3847
|
for (const d of l) {
|
|
3818
|
-
const
|
|
3819
|
-
if (Array.isArray(
|
|
3820
|
-
for (const
|
|
3821
|
-
if (!
|
|
3822
|
-
const
|
|
3823
|
-
typeof
|
|
3848
|
+
const g = d == null ? void 0 : d.content;
|
|
3849
|
+
if (Array.isArray(g))
|
|
3850
|
+
for (const m of g) {
|
|
3851
|
+
if (!m || typeof m != "object" || m.type !== "image_url" && m.type !== "file") continue;
|
|
3852
|
+
const I = m.fileId || m.file_id;
|
|
3853
|
+
typeof I == "string" && I.trim() && s.add(I);
|
|
3824
3854
|
}
|
|
3825
3855
|
}
|
|
3826
3856
|
}
|
|
3827
|
-
if (
|
|
3857
|
+
if (s.size === 0)
|
|
3828
3858
|
return n;
|
|
3829
|
-
const
|
|
3830
|
-
Array.from(
|
|
3859
|
+
const o = await Promise.all(
|
|
3860
|
+
Array.from(s).map(async (c) => {
|
|
3831
3861
|
try {
|
|
3832
3862
|
const l = await t.getFileInfo(c), d = le(l);
|
|
3833
3863
|
return [c, d];
|
|
@@ -3835,61 +3865,61 @@ async function Mr(e, t) {
|
|
|
3835
3865
|
return [c, null];
|
|
3836
3866
|
}
|
|
3837
3867
|
})
|
|
3838
|
-
), a = new Map(
|
|
3868
|
+
), a = new Map(o);
|
|
3839
3869
|
for (const c of r) {
|
|
3840
3870
|
const l = (u = c == null ? void 0 : c.values) == null ? void 0 : u.messages;
|
|
3841
3871
|
if (Array.isArray(l))
|
|
3842
3872
|
for (const d of l) {
|
|
3843
|
-
const
|
|
3844
|
-
if (Array.isArray(
|
|
3845
|
-
for (const
|
|
3846
|
-
if (!
|
|
3847
|
-
const
|
|
3848
|
-
if (!
|
|
3849
|
-
const f = a.get(
|
|
3850
|
-
|
|
3873
|
+
const g = d == null ? void 0 : d.content;
|
|
3874
|
+
if (Array.isArray(g))
|
|
3875
|
+
for (const m of g) {
|
|
3876
|
+
if (!m || typeof m != "object" || m.type !== "image_url" && m.type !== "file") continue;
|
|
3877
|
+
const I = m.fileId || m.file_id;
|
|
3878
|
+
if (!I) continue;
|
|
3879
|
+
const f = a.get(I), v = (f == null ? void 0 : f.contentUrl) || (f == null ? void 0 : f.content_url);
|
|
3880
|
+
v && (m.type === "image_url" ? (m.imageUrl = m.imageUrl || {}, m.imageUrl.url = v) : m.type === "file" && (m.url = v, !m.name && (f != null && f.filename || f != null && f.name) && (m.name = (f == null ? void 0 : f.filename) || (f == null ? void 0 : f.name))));
|
|
3851
3881
|
}
|
|
3852
3882
|
}
|
|
3853
3883
|
}
|
|
3854
3884
|
return n;
|
|
3855
3885
|
}
|
|
3856
3886
|
function mt(e) {
|
|
3857
|
-
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((
|
|
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((o, a) => Cr(le(o), a)).filter((o) => !!o)].sort((o, a) => yt(a.createdAt) - yt(o.createdAt)), s = r[0] ?? null;
|
|
3858
3888
|
return {
|
|
3859
3889
|
threadId: (e == null ? void 0 : e.threadId) ?? "",
|
|
3860
|
-
latest:
|
|
3890
|
+
latest: s,
|
|
3861
3891
|
checkpoints: r,
|
|
3862
|
-
interrupt: (
|
|
3892
|
+
interrupt: (s == null ? void 0 : s.interrupt) ?? null
|
|
3863
3893
|
};
|
|
3864
3894
|
}
|
|
3865
3895
|
function Cr(e, t) {
|
|
3866
|
-
var
|
|
3896
|
+
var b, h;
|
|
3867
3897
|
if (!e) return null;
|
|
3868
|
-
const n = ((
|
|
3898
|
+
const n = ((b = e.values) == null ? void 0 : b.activeAgent) ?? null, r = (h = e.values) == null ? void 0 : h.messages, o = (Array.isArray(r) ? r : []).map((T) => Er(T, n)).filter((T) => !!T), a = Re(e.metadata) ?? {}, i = gt(e.config), u = Re(e.parentConfig), c = gt(u), l = Fe(i, ["checkpointId"]), d = Fe(i, ["checkpointNs"]), g = Fe(c, ["checkpointId"]), m = Re(e.config), I = Array.isArray(e.tasks) ? e.tasks.map((T) => ({ ...T })) : e.tasks ?? null, f = Array.isArray(e.next) ? [...e.next] : e.next ?? null, v = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), x = {
|
|
3869
3899
|
...a,
|
|
3870
3900
|
step: Sr(a, ["step"]) ?? 0,
|
|
3871
3901
|
source: Fe(a, ["source"]) ?? null
|
|
3872
|
-
},
|
|
3873
|
-
...
|
|
3874
|
-
checkpointId:
|
|
3875
|
-
checkpointNs:
|
|
3876
|
-
})),
|
|
3902
|
+
}, M = o.map((T) => ({
|
|
3903
|
+
...T,
|
|
3904
|
+
checkpointId: T.checkpointId ?? l ?? null,
|
|
3905
|
+
checkpointNs: T.checkpointNs ?? d ?? null
|
|
3906
|
+
})), A = e.values, k = Array.isArray(e.interrupts) ? e.interrupts : Array.isArray(A == null ? void 0 : A.interrupts) ? A.interrupts : [];
|
|
3877
3907
|
return {
|
|
3878
3908
|
checkpointId: l ?? null,
|
|
3879
3909
|
checkpointNs: d ?? null,
|
|
3880
|
-
createdAt:
|
|
3881
|
-
parentId:
|
|
3882
|
-
messages:
|
|
3910
|
+
createdAt: v,
|
|
3911
|
+
parentId: g ?? null,
|
|
3912
|
+
messages: M,
|
|
3883
3913
|
interrupt: Pr(
|
|
3884
|
-
|
|
3914
|
+
k,
|
|
3885
3915
|
t,
|
|
3886
3916
|
l ?? null
|
|
3887
3917
|
),
|
|
3888
|
-
metadata:
|
|
3889
|
-
config:
|
|
3918
|
+
metadata: x,
|
|
3919
|
+
config: m ?? null,
|
|
3890
3920
|
parentConfig: u ?? null,
|
|
3891
3921
|
next: f,
|
|
3892
|
-
tasks:
|
|
3922
|
+
tasks: I,
|
|
3893
3923
|
values: e.values ?? {}
|
|
3894
3924
|
};
|
|
3895
3925
|
}
|
|
@@ -3899,15 +3929,15 @@ function Er(e, t) {
|
|
|
3899
3929
|
}
|
|
3900
3930
|
function Pr(e, t, n) {
|
|
3901
3931
|
const r = e.length;
|
|
3902
|
-
for (let
|
|
3903
|
-
const
|
|
3904
|
-
if (!
|
|
3932
|
+
for (let s = r - 1; s >= 0; s -= 1) {
|
|
3933
|
+
const o = e[s];
|
|
3934
|
+
if (!o || typeof o != "object")
|
|
3905
3935
|
continue;
|
|
3906
|
-
const a =
|
|
3936
|
+
const a = o, i = a.value ?? o;
|
|
3907
3937
|
if (i == null)
|
|
3908
3938
|
continue;
|
|
3909
3939
|
return {
|
|
3910
|
-
id: typeof a.id == "string" && a.id.trim() ? a.id : `interrupt-${n ?? t}-${
|
|
3940
|
+
id: typeof a.id == "string" && a.id.trim() ? a.id : `interrupt-${n ?? t}-${s}`,
|
|
3911
3941
|
value: i
|
|
3912
3942
|
};
|
|
3913
3943
|
}
|
|
@@ -3928,58 +3958,58 @@ function _r(e) {
|
|
|
3928
3958
|
const n = t.join(" ").replace(/\s+/g, " ").trim();
|
|
3929
3959
|
return n ? n.length > ht ? `${n.slice(0, ht - 3)}…` : n : "";
|
|
3930
3960
|
}
|
|
3931
|
-
function
|
|
3961
|
+
function zr(e) {
|
|
3932
3962
|
return _r(e.content) || "";
|
|
3933
3963
|
}
|
|
3934
|
-
function
|
|
3935
|
-
const t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Map(),
|
|
3964
|
+
function Nr(e) {
|
|
3965
|
+
const t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Map(), s = [];
|
|
3936
3966
|
for (let c = 0; c < e.length; c++) {
|
|
3937
|
-
const l = e[c], d = l.checkpointId,
|
|
3938
|
-
let
|
|
3939
|
-
const
|
|
3940
|
-
for (const
|
|
3941
|
-
|
|
3942
|
-
const
|
|
3943
|
-
id:
|
|
3944
|
-
step:
|
|
3967
|
+
const l = e[c], d = l.checkpointId, g = d ?? `cp-${c}`, m = l.metadata ?? {}, I = typeof m.step == "number" ? m.step : null, f = typeof m.source == "string" ? m.source : null;
|
|
3968
|
+
let v = null, x = null;
|
|
3969
|
+
const M = Array.isArray(l.messages) ? l.messages : [];
|
|
3970
|
+
for (const h of M)
|
|
3971
|
+
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, k = l.parentConfig ?? null, b = {
|
|
3973
|
+
id: g,
|
|
3974
|
+
step: I,
|
|
3945
3975
|
source: f,
|
|
3946
3976
|
createdAt: l.createdAt ?? null,
|
|
3947
3977
|
namespace: l.checkpointNs ?? null,
|
|
3948
3978
|
parentId: l.parentId ?? null,
|
|
3949
|
-
next:
|
|
3950
|
-
parentConfig:
|
|
3951
|
-
userMessageId:
|
|
3979
|
+
next: A,
|
|
3980
|
+
parentConfig: k,
|
|
3981
|
+
userMessageId: v
|
|
3952
3982
|
};
|
|
3953
|
-
if (
|
|
3954
|
-
const
|
|
3955
|
-
|
|
3983
|
+
if (s.push(b), d && t.set(d, b), d && x) {
|
|
3984
|
+
const h = zr(x);
|
|
3985
|
+
h && r.set(d, h);
|
|
3956
3986
|
}
|
|
3957
3987
|
n.push({
|
|
3958
|
-
id:
|
|
3959
|
-
messageId:
|
|
3960
|
-
step:
|
|
3988
|
+
id: g,
|
|
3989
|
+
messageId: v,
|
|
3990
|
+
step: I,
|
|
3961
3991
|
source: f,
|
|
3962
3992
|
createdAt: l.createdAt ?? null,
|
|
3963
|
-
next:
|
|
3964
|
-
parentConfig:
|
|
3993
|
+
next: A,
|
|
3994
|
+
parentConfig: k
|
|
3965
3995
|
});
|
|
3966
3996
|
}
|
|
3967
|
-
const
|
|
3968
|
-
for (const c of
|
|
3997
|
+
const o = /* @__PURE__ */ new Map();
|
|
3998
|
+
for (const c of s) {
|
|
3969
3999
|
if (!c.userMessageId) continue;
|
|
3970
|
-
const l =
|
|
3971
|
-
l.push(c),
|
|
4000
|
+
const l = o.get(c.userMessageId) ?? [];
|
|
4001
|
+
l.push(c), o.set(c.userMessageId, l);
|
|
3972
4002
|
}
|
|
3973
|
-
for (const c of
|
|
4003
|
+
for (const c of o.values()) {
|
|
3974
4004
|
if (!c.length) continue;
|
|
3975
|
-
c.sort((d,
|
|
3976
|
-
const
|
|
3977
|
-
return (
|
|
4005
|
+
c.sort((d, g) => {
|
|
4006
|
+
const m = d.createdAt ? Date.parse(d.createdAt) : 0;
|
|
4007
|
+
return (g.createdAt ? Date.parse(g.createdAt) : 0) - m;
|
|
3978
4008
|
});
|
|
3979
4009
|
const l = c.length;
|
|
3980
4010
|
for (let d = 0; d < c.length; d++) {
|
|
3981
|
-
const
|
|
3982
|
-
|
|
4011
|
+
const g = c[d];
|
|
4012
|
+
g.attemptCount = l, g.attemptIndex = d, g.isLatestAttempt = d === 0;
|
|
3983
4013
|
}
|
|
3984
4014
|
}
|
|
3985
4015
|
return {
|
|
@@ -3997,79 +4027,79 @@ function zr(e) {
|
|
|
3997
4027
|
const l = [];
|
|
3998
4028
|
for (const d of t.values())
|
|
3999
4029
|
d.userMessageId === c && l.push(d);
|
|
4000
|
-
return l.length ? (l.sort((d,
|
|
4001
|
-
const
|
|
4002
|
-
return
|
|
4030
|
+
return l.length ? (l.sort((d, g) => {
|
|
4031
|
+
const m = typeof d.attemptIndex == "number" ? d.attemptIndex : Number.MAX_SAFE_INTEGER, I = typeof g.attemptIndex == "number" ? g.attemptIndex : Number.MAX_SAFE_INTEGER;
|
|
4032
|
+
return m - I;
|
|
4003
4033
|
}), l) : [];
|
|
4004
4034
|
}
|
|
4005
4035
|
};
|
|
4006
4036
|
}
|
|
4007
|
-
function
|
|
4037
|
+
function us(e, t, n) {
|
|
4008
4038
|
if (!e)
|
|
4009
4039
|
return { attemptCount: 1, attemptIndex: 0, attempts: [] };
|
|
4010
4040
|
const r = n.getMessageAttempts(e);
|
|
4011
4041
|
if (!r.length)
|
|
4012
4042
|
return { attemptCount: 1, attemptIndex: 0, attempts: [] };
|
|
4013
|
-
let
|
|
4043
|
+
let s = 0;
|
|
4014
4044
|
if (t) {
|
|
4015
|
-
const
|
|
4016
|
-
|
|
4045
|
+
const o = r.findIndex((a) => a.id === t);
|
|
4046
|
+
o >= 0 && (s = o);
|
|
4017
4047
|
}
|
|
4018
4048
|
return {
|
|
4019
4049
|
attemptCount: r.length,
|
|
4020
|
-
attemptIndex:
|
|
4050
|
+
attemptIndex: s,
|
|
4021
4051
|
attempts: r
|
|
4022
4052
|
};
|
|
4023
4053
|
}
|
|
4024
4054
|
function Rr(e) {
|
|
4025
|
-
return Y(() =>
|
|
4055
|
+
return Y(() => Nr(e), [e]);
|
|
4026
4056
|
}
|
|
4027
4057
|
function $t({
|
|
4028
4058
|
api: e,
|
|
4029
4059
|
fileApi: t,
|
|
4030
4060
|
seed: n,
|
|
4031
4061
|
onError: r,
|
|
4032
|
-
currentThreadId:
|
|
4033
|
-
autoLoadInitial:
|
|
4062
|
+
currentThreadId: s,
|
|
4063
|
+
autoLoadInitial: o = !0,
|
|
4034
4064
|
isStreaming: a,
|
|
4035
4065
|
getMessages: i
|
|
4036
4066
|
}) {
|
|
4037
4067
|
const [u, c] = $(null), d = Y(
|
|
4038
4068
|
() => mt(u),
|
|
4039
4069
|
[u]
|
|
4040
|
-
).checkpoints,
|
|
4070
|
+
).checkpoints, g = Rr(d), m = g.timeline, [I, f] = $(!1), [v, x] = $(!1), [M, A] = $(!1), [k, b] = $(null), h = W(s), T = W(null), p = W(null);
|
|
4041
4071
|
X(() => {
|
|
4042
|
-
|
|
4043
|
-
}, [
|
|
4072
|
+
h.current = s;
|
|
4073
|
+
}, [s]);
|
|
4044
4074
|
const w = _(
|
|
4045
|
-
async (
|
|
4075
|
+
async (E) => {
|
|
4046
4076
|
const B = await e.getState({
|
|
4047
|
-
threadId:
|
|
4048
|
-
checkpointId:
|
|
4049
|
-
checkpointNs:
|
|
4050
|
-
}),
|
|
4077
|
+
threadId: E.threadId,
|
|
4078
|
+
checkpointId: E.checkpointId,
|
|
4079
|
+
checkpointNs: E.checkpointNs
|
|
4080
|
+
}), z = {
|
|
4051
4081
|
version: "values@1",
|
|
4052
|
-
threadId:
|
|
4082
|
+
threadId: E.threadId,
|
|
4053
4083
|
checkpoints: [B]
|
|
4054
|
-
}, K = t ? await Mr(
|
|
4055
|
-
return
|
|
4084
|
+
}, K = t ? await Mr(z, t) : z, { latest: N } = mt(K);
|
|
4085
|
+
return N;
|
|
4056
4086
|
},
|
|
4057
4087
|
[e, t]
|
|
4058
4088
|
), P = _(
|
|
4059
|
-
async (
|
|
4060
|
-
var
|
|
4061
|
-
if (!
|
|
4062
|
-
const
|
|
4063
|
-
if (
|
|
4064
|
-
(
|
|
4089
|
+
async (E, B) => {
|
|
4090
|
+
var N;
|
|
4091
|
+
if (!E) return;
|
|
4092
|
+
const z = `${E}:${B ?? "latest"}`;
|
|
4093
|
+
if (T.current === z || I) return;
|
|
4094
|
+
(N = p.current) == null || N.abort();
|
|
4065
4095
|
const K = new AbortController();
|
|
4066
|
-
|
|
4096
|
+
p.current = K, f(!0), b(null);
|
|
4067
4097
|
try {
|
|
4068
4098
|
const L = await w({
|
|
4069
|
-
threadId:
|
|
4099
|
+
threadId: E,
|
|
4070
4100
|
checkpointId: B ?? void 0
|
|
4071
4101
|
});
|
|
4072
|
-
if (
|
|
4102
|
+
if (h.current !== E) {
|
|
4073
4103
|
f(!1);
|
|
4074
4104
|
return;
|
|
4075
4105
|
}
|
|
@@ -4078,92 +4108,92 @@ function $t({
|
|
|
4078
4108
|
checkpointNs: (L == null ? void 0 : L.checkpointNs) ?? null,
|
|
4079
4109
|
pendingInterrupt: (L == null ? void 0 : L.interrupt) ?? null,
|
|
4080
4110
|
values: L == null ? void 0 : L.values
|
|
4081
|
-
}),
|
|
4111
|
+
}), T.current = z, f(!1), A(!0);
|
|
4082
4112
|
try {
|
|
4083
4113
|
const H = await e.getStateHistory({
|
|
4084
|
-
threadId:
|
|
4114
|
+
threadId: E,
|
|
4085
4115
|
limit: 100,
|
|
4086
4116
|
includeMessages: !1
|
|
4087
4117
|
});
|
|
4088
|
-
|
|
4118
|
+
h.current === E && c(H);
|
|
4089
4119
|
} finally {
|
|
4090
|
-
|
|
4120
|
+
A(!1);
|
|
4091
4121
|
}
|
|
4092
4122
|
} catch (L) {
|
|
4093
4123
|
if (f(!1), !Xt(L)) {
|
|
4094
4124
|
const H = String(L);
|
|
4095
|
-
|
|
4125
|
+
b(H), r == null || r(H);
|
|
4096
4126
|
}
|
|
4097
4127
|
}
|
|
4098
4128
|
},
|
|
4099
4129
|
[e, n, w, r, i]
|
|
4100
4130
|
), j = _(
|
|
4101
|
-
async (
|
|
4102
|
-
if (
|
|
4103
|
-
|
|
4131
|
+
async (E, B) => {
|
|
4132
|
+
if (s) {
|
|
4133
|
+
x(!0);
|
|
4104
4134
|
try {
|
|
4105
|
-
const
|
|
4106
|
-
threadId:
|
|
4107
|
-
checkpointId:
|
|
4135
|
+
const z = await w({
|
|
4136
|
+
threadId: s,
|
|
4137
|
+
checkpointId: E,
|
|
4108
4138
|
checkpointNs: B ?? void 0
|
|
4109
4139
|
});
|
|
4110
|
-
n((
|
|
4111
|
-
checkpointId: (
|
|
4112
|
-
checkpointNs: (
|
|
4113
|
-
pendingInterrupt: (
|
|
4114
|
-
values:
|
|
4140
|
+
n((z == null ? void 0 : z.messages) ?? [], {
|
|
4141
|
+
checkpointId: (z == null ? void 0 : z.checkpointId) ?? E,
|
|
4142
|
+
checkpointNs: (z == null ? void 0 : z.checkpointNs) ?? B,
|
|
4143
|
+
pendingInterrupt: (z == null ? void 0 : z.interrupt) ?? null,
|
|
4144
|
+
values: z == null ? void 0 : z.values
|
|
4115
4145
|
});
|
|
4116
|
-
} catch (
|
|
4117
|
-
console.error("[useThreadHistoryState] Navigation failed",
|
|
4146
|
+
} catch (z) {
|
|
4147
|
+
console.error("[useThreadHistoryState] Navigation failed", z);
|
|
4118
4148
|
} finally {
|
|
4119
|
-
|
|
4149
|
+
x(!1);
|
|
4120
4150
|
}
|
|
4121
4151
|
}
|
|
4122
4152
|
},
|
|
4123
|
-
[
|
|
4124
|
-
),
|
|
4125
|
-
|
|
4126
|
-
}, [
|
|
4127
|
-
async (
|
|
4153
|
+
[s, w, n]
|
|
4154
|
+
), C = _(async () => {
|
|
4155
|
+
s && await P(s);
|
|
4156
|
+
}, [s, P]), O = _(
|
|
4157
|
+
async (E) => {
|
|
4128
4158
|
var K;
|
|
4129
|
-
const B = (
|
|
4130
|
-
if (!B ||
|
|
4131
|
-
if (c(
|
|
4132
|
-
const
|
|
4159
|
+
const B = (E == null ? void 0 : E.threadId) || s;
|
|
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({
|
|
4133
4163
|
threadId: B
|
|
4134
4164
|
});
|
|
4135
|
-
|
|
4136
|
-
checkpointId:
|
|
4137
|
-
checkpointNs:
|
|
4138
|
-
pendingInterrupt:
|
|
4139
|
-
values:
|
|
4165
|
+
N && n(N.messages ?? [], {
|
|
4166
|
+
checkpointId: N.checkpointId ?? null,
|
|
4167
|
+
checkpointNs: N.checkpointNs ?? null,
|
|
4168
|
+
pendingInterrupt: N.interrupt ?? null,
|
|
4169
|
+
values: N.values
|
|
4140
4170
|
});
|
|
4141
4171
|
}
|
|
4142
4172
|
},
|
|
4143
|
-
[
|
|
4173
|
+
[s, w, n]
|
|
4144
4174
|
);
|
|
4145
4175
|
X(() => {
|
|
4146
|
-
if (!
|
|
4147
|
-
const
|
|
4148
|
-
|
|
4149
|
-
}, [
|
|
4176
|
+
if (!o || !s || I || a) return;
|
|
4177
|
+
const E = `${s}:latest`;
|
|
4178
|
+
T.current !== E && P(s);
|
|
4179
|
+
}, [o, s, I, a, P]);
|
|
4150
4180
|
const F = _(() => {
|
|
4151
|
-
c(null), f(!1),
|
|
4181
|
+
c(null), f(!1), x(!1), A(!1), b(null), T.current = null;
|
|
4152
4182
|
}, []);
|
|
4153
4183
|
return {
|
|
4154
4184
|
threadCheckpoints: d,
|
|
4155
|
-
threadTimeline:
|
|
4156
|
-
checkpointIndex:
|
|
4157
|
-
isLoadingThread:
|
|
4158
|
-
isLoadingCheckpoint:
|
|
4159
|
-
isLoadingHistory:
|
|
4160
|
-
threadStateError:
|
|
4185
|
+
threadTimeline: m,
|
|
4186
|
+
checkpointIndex: g,
|
|
4187
|
+
isLoadingThread: I,
|
|
4188
|
+
isLoadingCheckpoint: v,
|
|
4189
|
+
isLoadingHistory: M,
|
|
4190
|
+
threadStateError: k,
|
|
4161
4191
|
loadThread: P,
|
|
4162
4192
|
navigateToCheckpoint: j,
|
|
4163
|
-
setCurrentCheckpointId: (
|
|
4164
|
-
n(i(), { checkpointId:
|
|
4193
|
+
setCurrentCheckpointId: (E, B) => {
|
|
4194
|
+
n(i(), { checkpointId: E, checkpointNs: B });
|
|
4165
4195
|
},
|
|
4166
|
-
returnToLatest:
|
|
4196
|
+
returnToLatest: C,
|
|
4167
4197
|
handleValuesEvent: O,
|
|
4168
4198
|
markSkipNextLoad: () => {
|
|
4169
4199
|
},
|
|
@@ -4190,26 +4220,26 @@ function Ur({
|
|
|
4190
4220
|
initialThreadId: t = null,
|
|
4191
4221
|
initialCheckpointId: n = null,
|
|
4192
4222
|
initialCheckpointNs: r = null,
|
|
4193
|
-
autoLoadInitial:
|
|
4194
|
-
isStreaming:
|
|
4223
|
+
autoLoadInitial: s = !0,
|
|
4224
|
+
isStreaming: o,
|
|
4195
4225
|
onError: a
|
|
4196
4226
|
}) {
|
|
4197
|
-
const { chatApi: i, fileApi: u } = Me(), { currentThreadId: c } =
|
|
4198
|
-
threadCheckpoints:
|
|
4227
|
+
const { chatApi: i, fileApi: u } = Me(), { currentThreadId: c } = st(), { state: l, seed: d, onEvent: g, dispatch: m } = kr(), {
|
|
4228
|
+
threadCheckpoints: I,
|
|
4199
4229
|
threadTimeline: f,
|
|
4200
|
-
checkpointIndex:
|
|
4201
|
-
isLoadingThread:
|
|
4202
|
-
isLoadingCheckpoint:
|
|
4203
|
-
isLoadingHistory:
|
|
4204
|
-
threadStateError:
|
|
4205
|
-
loadThread:
|
|
4206
|
-
navigateToCheckpoint:
|
|
4207
|
-
setCurrentCheckpointId:
|
|
4208
|
-
returnToLatest:
|
|
4230
|
+
checkpointIndex: v,
|
|
4231
|
+
isLoadingThread: x,
|
|
4232
|
+
isLoadingCheckpoint: M,
|
|
4233
|
+
isLoadingHistory: A,
|
|
4234
|
+
threadStateError: k,
|
|
4235
|
+
loadThread: b,
|
|
4236
|
+
navigateToCheckpoint: h,
|
|
4237
|
+
setCurrentCheckpointId: T,
|
|
4238
|
+
returnToLatest: p,
|
|
4209
4239
|
handleValuesEvent: w,
|
|
4210
4240
|
markSkipNextLoad: P,
|
|
4211
4241
|
markStreamPendingThread: j,
|
|
4212
|
-
resetHistoryState:
|
|
4242
|
+
resetHistoryState: C
|
|
4213
4243
|
} = $t({
|
|
4214
4244
|
api: i,
|
|
4215
4245
|
fileApi: u,
|
|
@@ -4219,23 +4249,23 @@ function Ur({
|
|
|
4219
4249
|
initialThreadId: t,
|
|
4220
4250
|
initialCheckpointId: n,
|
|
4221
4251
|
initialCheckpointNs: r,
|
|
4222
|
-
autoLoadInitial:
|
|
4223
|
-
isStreaming:
|
|
4252
|
+
autoLoadInitial: s,
|
|
4253
|
+
isStreaming: o,
|
|
4224
4254
|
getMessages: _(() => l.messages, [l.messages])
|
|
4225
4255
|
}), O = W(null), F = _(
|
|
4226
|
-
(
|
|
4227
|
-
O.current =
|
|
4256
|
+
(S) => {
|
|
4257
|
+
O.current = S;
|
|
4228
4258
|
},
|
|
4229
4259
|
[]
|
|
4230
|
-
),
|
|
4231
|
-
(
|
|
4232
|
-
|
|
4260
|
+
), E = W(null), B = _(
|
|
4261
|
+
(S) => {
|
|
4262
|
+
E.current = S;
|
|
4233
4263
|
},
|
|
4234
4264
|
[]
|
|
4235
|
-
),
|
|
4236
|
-
(
|
|
4237
|
-
const V = Ut(
|
|
4238
|
-
return
|
|
4265
|
+
), z = Y(() => ({ assemblingMessageId: l.assemblingId ?? null }), [l.assemblingId]), K = _(
|
|
4266
|
+
(S, J) => {
|
|
4267
|
+
const V = Ut(S, "user");
|
|
4268
|
+
return m({
|
|
4239
4269
|
type: "user_message",
|
|
4240
4270
|
payload: {
|
|
4241
4271
|
message: V,
|
|
@@ -4243,12 +4273,12 @@ function Ur({
|
|
|
4243
4273
|
}
|
|
4244
4274
|
}), V;
|
|
4245
4275
|
},
|
|
4246
|
-
[
|
|
4247
|
-
),
|
|
4248
|
-
O.current ? await O.current() : (d([], {}),
|
|
4249
|
-
}, [d,
|
|
4250
|
-
await
|
|
4251
|
-
}, [
|
|
4276
|
+
[m]
|
|
4277
|
+
), N = _(async () => {
|
|
4278
|
+
O.current ? await O.current() : (d([], {}), C());
|
|
4279
|
+
}, [d, C]), L = _(async (S, J, V) => {
|
|
4280
|
+
await b(S, J, { clearProgress: !1 });
|
|
4281
|
+
}, [b]), H = Y(() => Bn(l.messages), [l.messages]), y = Y(
|
|
4252
4282
|
() => ({
|
|
4253
4283
|
status: l.status,
|
|
4254
4284
|
threadId: c,
|
|
@@ -4259,42 +4289,42 @@ function Ur({
|
|
|
4259
4289
|
id: l.lastCheckpointId ?? null,
|
|
4260
4290
|
namespace: l.lastCheckpointNs ?? null
|
|
4261
4291
|
},
|
|
4262
|
-
checkpoints:
|
|
4263
|
-
checkpointIndex:
|
|
4292
|
+
checkpoints: I,
|
|
4293
|
+
checkpointIndex: v,
|
|
4264
4294
|
timelineCheckpoints: f,
|
|
4265
|
-
metadata:
|
|
4295
|
+
metadata: z,
|
|
4266
4296
|
values: l.values ?? {},
|
|
4267
|
-
isLoading:
|
|
4268
|
-
isLoadingCheckpoint:
|
|
4269
|
-
isLoadingHistory:
|
|
4270
|
-
error:
|
|
4297
|
+
isLoading: x,
|
|
4298
|
+
isLoadingCheckpoint: M,
|
|
4299
|
+
isLoadingHistory: A,
|
|
4300
|
+
error: k,
|
|
4271
4301
|
loadOlder: async () => {
|
|
4272
4302
|
},
|
|
4273
4303
|
// Placeholder
|
|
4274
|
-
seedFromSnapshot: (
|
|
4275
|
-
d(
|
|
4276
|
-
checkpointId:
|
|
4277
|
-
checkpointNs:
|
|
4278
|
-
pendingInterrupt:
|
|
4279
|
-
values:
|
|
4304
|
+
seedFromSnapshot: (S) => {
|
|
4305
|
+
d(S.messages, {
|
|
4306
|
+
checkpointId: S.checkpointId,
|
|
4307
|
+
checkpointNs: S.checkpointNs,
|
|
4308
|
+
pendingInterrupt: S.interrupt,
|
|
4309
|
+
values: S.values
|
|
4280
4310
|
});
|
|
4281
4311
|
},
|
|
4282
|
-
clearState:
|
|
4283
|
-
navigateToCheckpoint:
|
|
4284
|
-
setCurrentCheckpointId:
|
|
4285
|
-
returnToLatest:
|
|
4312
|
+
clearState: N,
|
|
4313
|
+
navigateToCheckpoint: h,
|
|
4314
|
+
setCurrentCheckpointId: T,
|
|
4315
|
+
returnToLatest: p,
|
|
4286
4316
|
loadThread: L,
|
|
4287
|
-
clearThread:
|
|
4288
|
-
respondToInterrupt: async (
|
|
4289
|
-
|
|
4317
|
+
clearThread: N,
|
|
4318
|
+
respondToInterrupt: async (S, J, V) => {
|
|
4319
|
+
E.current && await E.current(S, J, V);
|
|
4290
4320
|
},
|
|
4291
|
-
messagePreviews:
|
|
4321
|
+
messagePreviews: v.messagePreviews,
|
|
4292
4322
|
handleValuesEvent: w,
|
|
4293
4323
|
markSkipNextLoad: P,
|
|
4294
4324
|
markStreamPendingThread: j,
|
|
4295
|
-
resetHistoryState:
|
|
4325
|
+
resetHistoryState: C,
|
|
4296
4326
|
pushUser: K,
|
|
4297
|
-
onEvent:
|
|
4327
|
+
onEvent: g,
|
|
4298
4328
|
artifacts: H
|
|
4299
4329
|
}),
|
|
4300
4330
|
[
|
|
@@ -4305,25 +4335,25 @@ function Ur({
|
|
|
4305
4335
|
l.lastCheckpointId,
|
|
4306
4336
|
l.lastCheckpointNs,
|
|
4307
4337
|
l.values,
|
|
4308
|
-
v,
|
|
4309
|
-
f,
|
|
4310
4338
|
I,
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
S,
|
|
4314
|
-
x,
|
|
4315
|
-
E,
|
|
4316
|
-
d,
|
|
4339
|
+
f,
|
|
4340
|
+
v,
|
|
4317
4341
|
z,
|
|
4318
|
-
|
|
4342
|
+
x,
|
|
4343
|
+
M,
|
|
4319
4344
|
A,
|
|
4320
|
-
|
|
4345
|
+
k,
|
|
4346
|
+
d,
|
|
4347
|
+
N,
|
|
4348
|
+
h,
|
|
4349
|
+
T,
|
|
4350
|
+
p,
|
|
4321
4351
|
L,
|
|
4322
4352
|
w,
|
|
4323
4353
|
P,
|
|
4324
4354
|
j,
|
|
4325
4355
|
K,
|
|
4326
|
-
|
|
4356
|
+
g,
|
|
4327
4357
|
H
|
|
4328
4358
|
]
|
|
4329
4359
|
), U = Y(
|
|
@@ -4333,7 +4363,7 @@ function Ur({
|
|
|
4333
4363
|
}),
|
|
4334
4364
|
[F, B]
|
|
4335
4365
|
);
|
|
4336
|
-
return /* @__PURE__ */ ie(Kt.Provider, { value: U, children: /* @__PURE__ */ ie(Dt.Provider, { value:
|
|
4366
|
+
return /* @__PURE__ */ ie(Kt.Provider, { value: U, children: /* @__PURE__ */ ie(Dt.Provider, { value: y, children: e }) });
|
|
4337
4367
|
}
|
|
4338
4368
|
const qt = Ce(null), jr = Ce(!1);
|
|
4339
4369
|
function Br({
|
|
@@ -4341,42 +4371,42 @@ function Br({
|
|
|
4341
4371
|
onError: t,
|
|
4342
4372
|
onAuthError: n,
|
|
4343
4373
|
onConnectionError: r,
|
|
4344
|
-
onToolEnd:
|
|
4345
|
-
onUpdateEvent:
|
|
4374
|
+
onToolEnd: s,
|
|
4375
|
+
onUpdateEvent: o,
|
|
4346
4376
|
onCustomEvent: a,
|
|
4347
4377
|
onMetadataEvent: i,
|
|
4348
4378
|
onFinish: u,
|
|
4349
4379
|
onStreamingChange: c
|
|
4350
4380
|
}) {
|
|
4351
|
-
const { chatApi: l, baseUrl: d } = Me(),
|
|
4381
|
+
const { chatApi: l, baseUrl: d } = Me(), g = d, m = fe(t), I = fe(n), f = fe(r), v = fe(s), x = fe(o), M = fe(a), A = fe(i), k = fe(u), b = fe(c), h = Y(
|
|
4352
4382
|
() => ({
|
|
4353
|
-
onError:
|
|
4354
|
-
onAuthError:
|
|
4383
|
+
onError: m,
|
|
4384
|
+
onAuthError: I,
|
|
4355
4385
|
onConnectionError: f,
|
|
4356
|
-
onMetadataEvent:
|
|
4357
|
-
onCustomEvent:
|
|
4358
|
-
onUpdateEvent:
|
|
4359
|
-
onToolEnd:
|
|
4360
|
-
onFinish:
|
|
4386
|
+
onMetadataEvent: A,
|
|
4387
|
+
onCustomEvent: M,
|
|
4388
|
+
onUpdateEvent: x,
|
|
4389
|
+
onToolEnd: v,
|
|
4390
|
+
onFinish: k
|
|
4361
4391
|
}),
|
|
4362
4392
|
[
|
|
4363
|
-
|
|
4364
|
-
|
|
4393
|
+
m,
|
|
4394
|
+
I,
|
|
4365
4395
|
f,
|
|
4396
|
+
A,
|
|
4397
|
+
M,
|
|
4366
4398
|
x,
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
I,
|
|
4370
|
-
E
|
|
4399
|
+
v,
|
|
4400
|
+
k
|
|
4371
4401
|
]
|
|
4372
4402
|
);
|
|
4373
4403
|
return /* @__PURE__ */ ie(jr.Provider, { value: !0, children: /* @__PURE__ */ ie(
|
|
4374
4404
|
Fr,
|
|
4375
4405
|
{
|
|
4376
4406
|
api: l,
|
|
4377
|
-
streamBaseUrl:
|
|
4378
|
-
handlers:
|
|
4379
|
-
onStreamingChange:
|
|
4407
|
+
streamBaseUrl: g,
|
|
4408
|
+
handlers: h,
|
|
4409
|
+
onStreamingChange: b,
|
|
4380
4410
|
children: e
|
|
4381
4411
|
}
|
|
4382
4412
|
) });
|
|
@@ -4386,104 +4416,104 @@ function Fr({
|
|
|
4386
4416
|
api: t,
|
|
4387
4417
|
streamBaseUrl: n,
|
|
4388
4418
|
handlers: r,
|
|
4389
|
-
onStreamingChange:
|
|
4419
|
+
onStreamingChange: s
|
|
4390
4420
|
}) {
|
|
4391
|
-
const { setCurrentThreadId:
|
|
4421
|
+
const { setCurrentThreadId: o, currentThreadIdRef: a, addThreadFromEvent: i, currentThreadId: u } = st(), {
|
|
4392
4422
|
interrupt: c,
|
|
4393
4423
|
checkpoint: l,
|
|
4394
4424
|
timelineCheckpoints: d,
|
|
4395
|
-
handleValuesEvent:
|
|
4396
|
-
markSkipNextLoad:
|
|
4397
|
-
markStreamPendingThread:
|
|
4425
|
+
handleValuesEvent: g,
|
|
4426
|
+
markSkipNextLoad: m,
|
|
4427
|
+
markStreamPendingThread: I,
|
|
4398
4428
|
resetHistoryState: f,
|
|
4399
|
-
pushUser:
|
|
4400
|
-
onEvent:
|
|
4401
|
-
messages:
|
|
4402
|
-
} = Vt(), { registerClearThread:
|
|
4403
|
-
(
|
|
4404
|
-
i(
|
|
4429
|
+
pushUser: v,
|
|
4430
|
+
onEvent: x,
|
|
4431
|
+
messages: M
|
|
4432
|
+
} = Vt(), { registerClearThread: A, registerRespondToInterrupt: k } = Lr(), b = _(
|
|
4433
|
+
(y) => {
|
|
4434
|
+
i(y), I(y.threadId), a.current !== y.threadId && ((y.created ?? !a.current) && m(y.threadId), o(y.threadId));
|
|
4405
4435
|
},
|
|
4406
|
-
[i,
|
|
4407
|
-
),
|
|
4436
|
+
[i, m, I, o, a]
|
|
4437
|
+
), h = pr({
|
|
4408
4438
|
baseUrl: n,
|
|
4409
|
-
onEvent:
|
|
4410
|
-
onError: (
|
|
4439
|
+
onEvent: x,
|
|
4440
|
+
onError: (y) => {
|
|
4411
4441
|
var U;
|
|
4412
|
-
(U = r.onError) == null || U.call(r, (
|
|
4442
|
+
(U = r.onError) == null || U.call(r, (y == null ? void 0 : y.message) ?? String(y));
|
|
4413
4443
|
},
|
|
4414
4444
|
onAuthError: r.onAuthError,
|
|
4415
4445
|
onConnectionError: r.onConnectionError,
|
|
4416
4446
|
onFinish: r.onFinish,
|
|
4417
|
-
onThreadInfo:
|
|
4447
|
+
onThreadInfo: b,
|
|
4418
4448
|
onMetadataEvent: r.onMetadataEvent,
|
|
4419
4449
|
onCustomEvent: r.onCustomEvent,
|
|
4420
4450
|
onUpdateEvent: r.onUpdateEvent,
|
|
4421
4451
|
onToolEnd: r.onToolEnd,
|
|
4422
|
-
handleValuesEvent:
|
|
4452
|
+
handleValuesEvent: g
|
|
4423
4453
|
});
|
|
4424
4454
|
X(() => {
|
|
4425
|
-
|
|
4426
|
-
}, [
|
|
4427
|
-
const { stream:
|
|
4455
|
+
s == null || s(h.isStreaming);
|
|
4456
|
+
}, [h.isStreaming, s]);
|
|
4457
|
+
const { stream: T, stop: p, clear: w, isStreaming: P, error: j, connected: C, streamedMessages: O, activeMessageId: F } = h;
|
|
4428
4458
|
X(() => {
|
|
4429
4459
|
u !== void 0 && w();
|
|
4430
4460
|
}, [u, w]);
|
|
4431
|
-
const
|
|
4432
|
-
async (
|
|
4433
|
-
await
|
|
4461
|
+
const E = _(
|
|
4462
|
+
async (y, U) => {
|
|
4463
|
+
await T(y, U);
|
|
4434
4464
|
},
|
|
4435
|
-
[
|
|
4465
|
+
[T]
|
|
4436
4466
|
), B = W(l);
|
|
4437
4467
|
X(() => {
|
|
4438
4468
|
B.current = l;
|
|
4439
4469
|
}, [l]);
|
|
4440
|
-
const
|
|
4441
|
-
async (
|
|
4470
|
+
const z = _(
|
|
4471
|
+
async (y, U, S) => {
|
|
4442
4472
|
var G;
|
|
4443
4473
|
const J = a.current;
|
|
4444
4474
|
if (!J)
|
|
4445
4475
|
throw new Error("No active thread to handle interrupt");
|
|
4446
|
-
const V =
|
|
4476
|
+
const V = y ? U ?? !0 : !1, q = B.current, ee = (S == null ? void 0 : S.checkpointId) ?? q.id ?? void 0, re = (S == null ? void 0 : S.checkpointNs) ?? q.namespace ?? void 0, ue = {
|
|
4447
4477
|
threadId: J,
|
|
4448
4478
|
checkpointId: ee,
|
|
4449
4479
|
checkpointNs: re,
|
|
4450
4480
|
command: { kind: "resume", value: V },
|
|
4451
4481
|
payload: {
|
|
4452
|
-
...(
|
|
4453
|
-
creativityLevel: ((G =
|
|
4482
|
+
...(S == null ? void 0 : S.payload) ?? {},
|
|
4483
|
+
creativityLevel: ((G = S == null ? void 0 : S.payload) == null ? void 0 : G.creativityLevel) ?? "medium"
|
|
4454
4484
|
},
|
|
4455
4485
|
edit: !1
|
|
4456
4486
|
};
|
|
4457
|
-
|
|
4487
|
+
E(ue);
|
|
4458
4488
|
},
|
|
4459
|
-
[a,
|
|
4489
|
+
[a, E]
|
|
4460
4490
|
);
|
|
4461
4491
|
X(() => {
|
|
4462
|
-
|
|
4463
|
-
}, [
|
|
4492
|
+
k(z);
|
|
4493
|
+
}, [z, k]);
|
|
4464
4494
|
const K = _(async () => {
|
|
4465
|
-
|
|
4466
|
-
}, [w, f,
|
|
4495
|
+
p(), w(), f(), o(null);
|
|
4496
|
+
}, [w, f, o, p]);
|
|
4467
4497
|
X(() => {
|
|
4468
|
-
|
|
4469
|
-
}, [K,
|
|
4470
|
-
const
|
|
4471
|
-
async (
|
|
4472
|
-
P &&
|
|
4473
|
-
let
|
|
4474
|
-
const J = (
|
|
4498
|
+
A(K);
|
|
4499
|
+
}, [K, A]);
|
|
4500
|
+
const N = _(
|
|
4501
|
+
async (y, U) => {
|
|
4502
|
+
P && p();
|
|
4503
|
+
let S = a.current;
|
|
4504
|
+
const J = (y == null ? void 0 : y.text) ?? "", V = (y == null ? void 0 : y.attachments) ?? [], q = (J == null ? void 0 : J.trim()) ?? "", ee = { ...(y == null ? void 0 : y.payload) ?? {} }, re = Array.isArray(ee.messages) ? ee.messages : void 0;
|
|
4475
4505
|
re && delete ee.messages;
|
|
4476
|
-
const ue = !!(re && re.length), G = !!(
|
|
4477
|
-
if (!
|
|
4478
|
-
if (!
|
|
4506
|
+
const ue = !!(re && re.length), G = !!(y.contentParts && y.contentParts.length > 0);
|
|
4507
|
+
if (!S && !q && V.length === 0 && !ue && !G) return;
|
|
4508
|
+
if (!S) {
|
|
4479
4509
|
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);
|
|
4480
|
-
|
|
4510
|
+
S = `${ye}${he}`, m(S), o(S);
|
|
4481
4511
|
}
|
|
4482
4512
|
let te = null;
|
|
4483
|
-
|
|
4484
|
-
const { contentParts: ke, filesInfo: Q } = te ? { contentParts: te, filesInfo: [] } : await
|
|
4513
|
+
y.contentParts && y.contentParts.length > 0 && (te = y.contentParts);
|
|
4514
|
+
const { contentParts: ke, filesInfo: Q } = te ? { contentParts: te, filesInfo: [] } : await sr(V), Z = [...ke];
|
|
4485
4515
|
q && Z.push({ type: "text", text: J });
|
|
4486
|
-
const ge =
|
|
4516
|
+
const ge = y == null ? void 0 : y.originalMessageId, je = !!(y != null && y.edit && ge), Be = !ue && Z.length > 0;
|
|
4487
4517
|
let me = null;
|
|
4488
4518
|
if (Be) {
|
|
4489
4519
|
const ye = je ? ge : `msg-${Date.now()}`;
|
|
@@ -4492,47 +4522,47 @@ function Fr({
|
|
|
4492
4522
|
role: "user",
|
|
4493
4523
|
content: Z,
|
|
4494
4524
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4495
|
-
}, "user"), je ?
|
|
4525
|
+
}, "user"), je ? v(me, { editingMessageId: ge }) : v(me);
|
|
4496
4526
|
}
|
|
4497
|
-
const
|
|
4527
|
+
const ve = ue ? re : me ? [me] : [], se = {
|
|
4498
4528
|
...ee,
|
|
4499
4529
|
...Q.length ? { files_info: Q } : {}
|
|
4500
4530
|
};
|
|
4501
|
-
|
|
4502
|
-
const Pe = (
|
|
4503
|
-
if (
|
|
4531
|
+
ve.length ? se.messages = ve : "messages" in se || (se.messages = []);
|
|
4532
|
+
const Pe = (y == null ? void 0 : y.checkpointId) ?? l.id ?? void 0;
|
|
4533
|
+
if (y != null && y.edit && !Pe)
|
|
4504
4534
|
throw new Error(
|
|
4505
|
-
`[streaming] Missing checkpointId for edit submit. threadId=${
|
|
4535
|
+
`[streaming] Missing checkpointId for edit submit. threadId=${S ?? "null"}`
|
|
4506
4536
|
);
|
|
4507
|
-
const
|
|
4508
|
-
threadId:
|
|
4509
|
-
content:
|
|
4510
|
-
payload:
|
|
4511
|
-
config:
|
|
4537
|
+
const xe = {
|
|
4538
|
+
threadId: S,
|
|
4539
|
+
content: y == null ? void 0 : y.text,
|
|
4540
|
+
payload: se,
|
|
4541
|
+
config: y == null ? void 0 : y.config,
|
|
4512
4542
|
checkpointId: Pe,
|
|
4513
|
-
command:
|
|
4514
|
-
edit:
|
|
4543
|
+
command: y == null ? void 0 : y.command,
|
|
4544
|
+
edit: y == null ? void 0 : y.edit
|
|
4515
4545
|
};
|
|
4516
|
-
return
|
|
4546
|
+
return E(xe, U);
|
|
4517
4547
|
},
|
|
4518
|
-
[l, a, P,
|
|
4519
|
-
), L = Y(() =>
|
|
4548
|
+
[l, a, P, m, v, E, p, d]
|
|
4549
|
+
), L = Y(() => M, [M]), H = Y(
|
|
4520
4550
|
() => ({
|
|
4521
4551
|
isStreaming: P,
|
|
4522
4552
|
error: j,
|
|
4523
|
-
connectionState: j ? "error" : P ?
|
|
4553
|
+
connectionState: j ? "error" : P ? C ? "connected" : "connecting" : "idle",
|
|
4524
4554
|
messages: L,
|
|
4525
4555
|
activeMessageId: F,
|
|
4526
|
-
submit:
|
|
4527
|
-
stop:
|
|
4556
|
+
submit: N,
|
|
4557
|
+
stop: p,
|
|
4528
4558
|
interrupt: c,
|
|
4529
4559
|
resume: () => Promise.resolve(),
|
|
4530
|
-
goto: (
|
|
4560
|
+
goto: (y, U) => Promise.resolve(),
|
|
4531
4561
|
clearError: () => {
|
|
4532
4562
|
}
|
|
4533
4563
|
// TODO: Implement error clearing
|
|
4534
4564
|
}),
|
|
4535
|
-
[P, j,
|
|
4565
|
+
[P, j, N, p, c, C, L]
|
|
4536
4566
|
);
|
|
4537
4567
|
return /* @__PURE__ */ ie(qt.Provider, { value: H, children: e });
|
|
4538
4568
|
}
|
|
@@ -4558,8 +4588,8 @@ function $r(e, t) {
|
|
|
4558
4588
|
const n = Object.keys(e), r = Object.keys(t);
|
|
4559
4589
|
if (n.length !== r.length)
|
|
4560
4590
|
return !1;
|
|
4561
|
-
for (const
|
|
4562
|
-
if (!Object.prototype.hasOwnProperty.call(t,
|
|
4591
|
+
for (const s of n)
|
|
4592
|
+
if (!Object.prototype.hasOwnProperty.call(t, s) || !Object.is(e[s], t[s]))
|
|
4563
4593
|
return !1;
|
|
4564
4594
|
return !0;
|
|
4565
4595
|
}
|
|
@@ -4568,51 +4598,51 @@ function Dr(e) {
|
|
|
4568
4598
|
return $r(t.current, e) || (t.current = e, n.current = e), n.current;
|
|
4569
4599
|
}
|
|
4570
4600
|
function Kr(e) {
|
|
4571
|
-
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,
|
|
4572
|
-
return typeof
|
|
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, s = (r == null ? void 0 : r.task_id) ?? (r == null ? void 0 : r.taskId) ?? null;
|
|
4602
|
+
return typeof s == "string" ? s : null;
|
|
4573
4603
|
}
|
|
4574
|
-
function
|
|
4604
|
+
function ds(e) {
|
|
4575
4605
|
const { setCurrentTaskId: t, getCurrentTaskId: n, onToolEnd: r } = e;
|
|
4576
|
-
return (
|
|
4577
|
-
const
|
|
4578
|
-
|
|
4606
|
+
return (s) => {
|
|
4607
|
+
const o = Kr(s), a = (n == null ? void 0 : n()) ?? null;
|
|
4608
|
+
o && o !== a && t(o), r == null || r(s);
|
|
4579
4609
|
};
|
|
4580
4610
|
}
|
|
4581
|
-
function
|
|
4611
|
+
function fs({
|
|
4582
4612
|
children: e,
|
|
4583
4613
|
apiConfig: t,
|
|
4584
4614
|
initialThreadId: n = null,
|
|
4585
4615
|
initialCheckpointId: r = null,
|
|
4586
|
-
initialCheckpointNs:
|
|
4587
|
-
autoLoadInitial:
|
|
4616
|
+
initialCheckpointNs: s = null,
|
|
4617
|
+
autoLoadInitial: o = !0,
|
|
4588
4618
|
onConnectionError: a,
|
|
4589
4619
|
onError: i,
|
|
4590
4620
|
onAuthError: u,
|
|
4591
4621
|
onThreadChange: c,
|
|
4592
4622
|
onToolEnd: l,
|
|
4593
4623
|
onUpdateEvent: d,
|
|
4594
|
-
onCustomEvent:
|
|
4595
|
-
onMetadataEvent:
|
|
4596
|
-
onFinish:
|
|
4624
|
+
onCustomEvent: g,
|
|
4625
|
+
onMetadataEvent: m,
|
|
4626
|
+
onFinish: I
|
|
4597
4627
|
}) {
|
|
4598
|
-
const f = Dr(t), [
|
|
4628
|
+
const f = Dr(t), [v, x] = $(!1), M = pe(i), A = pe(u), k = pe(a), b = pe(c), h = pe(l), T = pe(d), p = pe(g), w = pe(m), P = pe(I), j = Y(
|
|
4599
4629
|
() => ({
|
|
4600
|
-
onError:
|
|
4601
|
-
onAuthError:
|
|
4602
|
-
onConnectionError:
|
|
4603
|
-
onToolEnd:
|
|
4604
|
-
onUpdateEvent:
|
|
4605
|
-
onCustomEvent:
|
|
4630
|
+
onError: M,
|
|
4631
|
+
onAuthError: A,
|
|
4632
|
+
onConnectionError: k,
|
|
4633
|
+
onToolEnd: h,
|
|
4634
|
+
onUpdateEvent: T,
|
|
4635
|
+
onCustomEvent: p,
|
|
4606
4636
|
onMetadataEvent: w,
|
|
4607
4637
|
onFinish: P
|
|
4608
4638
|
}),
|
|
4609
4639
|
[
|
|
4610
|
-
|
|
4611
|
-
x,
|
|
4612
|
-
E,
|
|
4613
|
-
b,
|
|
4640
|
+
M,
|
|
4614
4641
|
A,
|
|
4615
|
-
|
|
4642
|
+
k,
|
|
4643
|
+
h,
|
|
4644
|
+
T,
|
|
4645
|
+
p,
|
|
4616
4646
|
w,
|
|
4617
4647
|
P
|
|
4618
4648
|
]
|
|
@@ -4621,22 +4651,22 @@ function po({
|
|
|
4621
4651
|
mr,
|
|
4622
4652
|
{
|
|
4623
4653
|
initialThreadId: n,
|
|
4624
|
-
onError:
|
|
4625
|
-
onThreadChange:
|
|
4654
|
+
onError: M,
|
|
4655
|
+
onThreadChange: b,
|
|
4626
4656
|
children: /* @__PURE__ */ ie(
|
|
4627
4657
|
Ur,
|
|
4628
4658
|
{
|
|
4629
4659
|
initialThreadId: n,
|
|
4630
4660
|
initialCheckpointId: r,
|
|
4631
|
-
initialCheckpointNs:
|
|
4632
|
-
autoLoadInitial:
|
|
4633
|
-
onError:
|
|
4634
|
-
isStreaming:
|
|
4661
|
+
initialCheckpointNs: s,
|
|
4662
|
+
autoLoadInitial: o,
|
|
4663
|
+
onError: M,
|
|
4664
|
+
isStreaming: v,
|
|
4635
4665
|
children: /* @__PURE__ */ ie(
|
|
4636
4666
|
Br,
|
|
4637
4667
|
{
|
|
4638
4668
|
...j,
|
|
4639
|
-
onStreamingChange:
|
|
4669
|
+
onStreamingChange: x,
|
|
4640
4670
|
children: e
|
|
4641
4671
|
}
|
|
4642
4672
|
)
|
|
@@ -4713,9 +4743,9 @@ function Le(e) {
|
|
|
4713
4743
|
});
|
|
4714
4744
|
}
|
|
4715
4745
|
function Wr({ ...e }) {
|
|
4716
|
-
const t = Hr(), n = (
|
|
4746
|
+
const t = Hr(), n = (s) => Le({
|
|
4717
4747
|
type: "UPDATE_TOAST",
|
|
4718
|
-
toast: { ...
|
|
4748
|
+
toast: { ...s, id: t }
|
|
4719
4749
|
}), r = () => Le({ type: "DISMISS_TOAST", toastId: t });
|
|
4720
4750
|
return Le({
|
|
4721
4751
|
type: "ADD_TOAST",
|
|
@@ -4723,8 +4753,8 @@ function Wr({ ...e }) {
|
|
|
4723
4753
|
...e,
|
|
4724
4754
|
id: t,
|
|
4725
4755
|
open: !0,
|
|
4726
|
-
onOpenChange: (
|
|
4727
|
-
|
|
4756
|
+
onOpenChange: (s) => {
|
|
4757
|
+
s || r();
|
|
4728
4758
|
}
|
|
4729
4759
|
}
|
|
4730
4760
|
}), {
|
|
@@ -4744,85 +4774,85 @@ function Jr() {
|
|
|
4744
4774
|
dismiss: (n) => Le({ type: "DISMISS_TOAST", toastId: n })
|
|
4745
4775
|
};
|
|
4746
4776
|
}
|
|
4747
|
-
function
|
|
4748
|
-
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Me(), { toast:
|
|
4777
|
+
function ps(e) {
|
|
4778
|
+
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Me(), { toast: s } = Jr(), [o, a] = $({}), [i, u] = $(null), [c, l] = $(!1), d = _(() => {
|
|
4749
4779
|
l(!1), u(null);
|
|
4750
|
-
}, []),
|
|
4751
|
-
u(
|
|
4752
|
-
}, []),
|
|
4753
|
-
async (
|
|
4754
|
-
var
|
|
4780
|
+
}, []), g = _((I) => {
|
|
4781
|
+
u(I), l(!0);
|
|
4782
|
+
}, []), m = _(
|
|
4783
|
+
async (I, f, v) => {
|
|
4784
|
+
var x, M;
|
|
4755
4785
|
if (!t) {
|
|
4756
|
-
|
|
4786
|
+
I.preventDefault();
|
|
4757
4787
|
return;
|
|
4758
4788
|
}
|
|
4759
|
-
if (
|
|
4760
|
-
|
|
4789
|
+
if (o[v]) {
|
|
4790
|
+
I.preventDefault();
|
|
4761
4791
|
return;
|
|
4762
4792
|
}
|
|
4763
4793
|
try {
|
|
4764
|
-
const
|
|
4765
|
-
if (
|
|
4766
|
-
|
|
4767
|
-
const
|
|
4768
|
-
|
|
4794
|
+
const A = String(f.url ?? ""), k = A.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
|
|
4795
|
+
if (k) {
|
|
4796
|
+
I.preventDefault();
|
|
4797
|
+
const b = k[1], h = f.name || `file_${b}`, T = f.mimeType || "application/octet-stream";
|
|
4798
|
+
g({ id: b, name: h, mimeType: T });
|
|
4769
4799
|
return;
|
|
4770
4800
|
}
|
|
4771
|
-
if (
|
|
4772
|
-
|
|
4773
|
-
const
|
|
4801
|
+
if (A.startsWith("data:")) {
|
|
4802
|
+
I.preventDefault(), a((h) => ({ ...h, [v]: !0 }));
|
|
4803
|
+
const b = s({ title: "Fetching file...", description: "", open: !0 });
|
|
4774
4804
|
try {
|
|
4775
|
-
const
|
|
4776
|
-
if (!
|
|
4805
|
+
const h = await r.listFiles(n ?? void 0);
|
|
4806
|
+
if (!h || !Array.isArray(h))
|
|
4777
4807
|
throw new Error("Invalid file list response");
|
|
4778
|
-
const
|
|
4779
|
-
if (!(
|
|
4808
|
+
const T = h.find((p) => !p || typeof p != "object" || !((p.filename ?? "") === (f.name ?? "")) ? !1 : typeof f.size == "number" && typeof p.size == "number" ? p.size === f.size : !0);
|
|
4809
|
+
if (!(T != null && T.id))
|
|
4780
4810
|
throw new Error(`File "${f.name}" is not yet available on the server`);
|
|
4781
|
-
if (!
|
|
4811
|
+
if (!T.id || !T.filename)
|
|
4782
4812
|
throw new Error("Invalid file data received from server");
|
|
4783
|
-
|
|
4784
|
-
id:
|
|
4785
|
-
name: f.name ||
|
|
4786
|
-
mimeType: f.mimeType ||
|
|
4787
|
-
}), (
|
|
4788
|
-
id:
|
|
4813
|
+
g({
|
|
4814
|
+
id: T.id,
|
|
4815
|
+
name: f.name || T.filename || `file_${T.id}`,
|
|
4816
|
+
mimeType: f.mimeType || T.mime_type || "application/octet-stream"
|
|
4817
|
+
}), (x = b.update) == null || x.call(b, {
|
|
4818
|
+
id: b.id,
|
|
4789
4819
|
title: "Success",
|
|
4790
4820
|
description: `Opened ${f.name}`,
|
|
4791
4821
|
open: !0
|
|
4792
4822
|
});
|
|
4793
|
-
} catch (
|
|
4794
|
-
console.error("Failed to fetch server file:",
|
|
4795
|
-
const
|
|
4796
|
-
(
|
|
4823
|
+
} catch (h) {
|
|
4824
|
+
console.error("Failed to fetch server file:", h);
|
|
4825
|
+
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 }), s({
|
|
4797
4827
|
title: "Failed to fetch file",
|
|
4798
|
-
description:
|
|
4828
|
+
description: T,
|
|
4799
4829
|
open: !0
|
|
4800
4830
|
});
|
|
4801
4831
|
} finally {
|
|
4802
|
-
a((
|
|
4832
|
+
a((h) => ({ ...h, [v]: !1 }));
|
|
4803
4833
|
}
|
|
4804
4834
|
}
|
|
4805
|
-
} catch (
|
|
4806
|
-
console.error("File click error:",
|
|
4835
|
+
} catch (A) {
|
|
4836
|
+
console.error("File click error:", A), a((k) => ({ ...k, [v]: !1 }));
|
|
4807
4837
|
}
|
|
4808
4838
|
},
|
|
4809
|
-
[t,
|
|
4839
|
+
[t, o, s, n, g]
|
|
4810
4840
|
);
|
|
4811
4841
|
return {
|
|
4812
|
-
uploadingFiles:
|
|
4813
|
-
handleFileClick:
|
|
4842
|
+
uploadingFiles: o,
|
|
4843
|
+
handleFileClick: m,
|
|
4814
4844
|
fileViewerOpen: c,
|
|
4815
4845
|
currentFileInfo: i,
|
|
4816
4846
|
closeFileViewer: d
|
|
4817
4847
|
};
|
|
4818
4848
|
}
|
|
4819
|
-
function
|
|
4849
|
+
function gs(e) {
|
|
4820
4850
|
return Y(() => {
|
|
4821
4851
|
const t = e;
|
|
4822
4852
|
let n = Array.isArray(t.content) ? t.content : [];
|
|
4823
4853
|
return typeof t.content == "string" && (n = [{ type: "text", text: t.content }]), {
|
|
4824
4854
|
contentParts: n,
|
|
4825
|
-
textContent:
|
|
4855
|
+
textContent: or(n),
|
|
4826
4856
|
toolMeta: ar(t),
|
|
4827
4857
|
imageParts: n.filter((r) => r.type === "image_url"),
|
|
4828
4858
|
fileParts: n.filter((r) => r.type === "file"),
|
|
@@ -4836,13 +4866,13 @@ function Xr(e) {
|
|
|
4836
4866
|
if (!e) return [];
|
|
4837
4867
|
const t = [], n = e.split(/\r?\n/);
|
|
4838
4868
|
for (const r of n) {
|
|
4839
|
-
const
|
|
4840
|
-
if (!
|
|
4869
|
+
const s = r.trim();
|
|
4870
|
+
if (!s || !s.startsWith(kt))
|
|
4841
4871
|
continue;
|
|
4842
|
-
const
|
|
4843
|
-
if (!
|
|
4872
|
+
const o = s.slice(kt.length).trim();
|
|
4873
|
+
if (!o || o.toLowerCase() === "[done]")
|
|
4844
4874
|
continue;
|
|
4845
|
-
const a = tt(
|
|
4875
|
+
const a = tt(o);
|
|
4846
4876
|
a && typeof a == "object" && t.push(a);
|
|
4847
4877
|
}
|
|
4848
4878
|
return t;
|
|
@@ -4855,7 +4885,7 @@ function Qr(e) {
|
|
|
4855
4885
|
}
|
|
4856
4886
|
return null;
|
|
4857
4887
|
}
|
|
4858
|
-
function
|
|
4888
|
+
function ms(e) {
|
|
4859
4889
|
return Y(() => {
|
|
4860
4890
|
const t = e.content.filter(
|
|
4861
4891
|
(u) => u.type === "text"
|
|
@@ -4872,41 +4902,41 @@ function yo(e) {
|
|
|
4872
4902
|
}
|
|
4873
4903
|
if (!r.length)
|
|
4874
4904
|
return null;
|
|
4875
|
-
const
|
|
4876
|
-
if (!
|
|
4905
|
+
const o = Qr(r) ?? r[r.length - 1];
|
|
4906
|
+
if (!o)
|
|
4877
4907
|
return null;
|
|
4878
|
-
const a =
|
|
4908
|
+
const a = o.output ?? o.payload ?? o, i = ce(a);
|
|
4879
4909
|
return i && typeof i == "object" && !Array.isArray(i) ? {
|
|
4880
4910
|
kind: "dict",
|
|
4881
4911
|
value: i,
|
|
4882
4912
|
data: i,
|
|
4883
|
-
event:
|
|
4913
|
+
event: o
|
|
4884
4914
|
} : {
|
|
4885
4915
|
kind: "generic",
|
|
4886
4916
|
value: i,
|
|
4887
|
-
event:
|
|
4917
|
+
event: o
|
|
4888
4918
|
};
|
|
4889
4919
|
}, [e]);
|
|
4890
4920
|
}
|
|
4891
4921
|
function Yr(e) {
|
|
4892
|
-
var
|
|
4893
|
-
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r =
|
|
4922
|
+
var C, O;
|
|
4923
|
+
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r = st({ optional: !0 }), s = Vt({ optional: !0 }), o = Or(), { currentThreadId: a, setCurrentThreadId: i, actions: u } = r || {
|
|
4894
4924
|
currentThreadId: null,
|
|
4895
4925
|
setCurrentThreadId: () => {
|
|
4896
4926
|
},
|
|
4897
4927
|
actions: {}
|
|
4898
|
-
}, c = !!t && t !== a, [l, d] = $([]),
|
|
4928
|
+
}, c = !!t && t !== a, [l, d] = $([]), g = _((F) => {
|
|
4899
4929
|
d(F);
|
|
4900
4930
|
}, []), {
|
|
4901
|
-
isLoadingThread:
|
|
4902
|
-
threadStateError:
|
|
4931
|
+
isLoadingThread: m,
|
|
4932
|
+
threadStateError: I,
|
|
4903
4933
|
threadCheckpoints: f,
|
|
4904
|
-
isLoadingHistory:
|
|
4905
|
-
loadThread:
|
|
4934
|
+
isLoadingHistory: v,
|
|
4935
|
+
loadThread: x
|
|
4906
4936
|
} = $t({
|
|
4907
4937
|
api: Me().chatApi,
|
|
4908
4938
|
fileApi: Me().fileApi,
|
|
4909
|
-
seed:
|
|
4939
|
+
seed: g,
|
|
4910
4940
|
currentThreadId: c ? t : null,
|
|
4911
4941
|
initialThreadId: c ? t : null,
|
|
4912
4942
|
isStreaming: !1,
|
|
@@ -4914,59 +4944,59 @@ function Yr(e) {
|
|
|
4914
4944
|
autoLoadInitial: c && !n
|
|
4915
4945
|
});
|
|
4916
4946
|
X(() => {
|
|
4917
|
-
!c && !n && a && (
|
|
4918
|
-
}, [c, n, a,
|
|
4919
|
-
const
|
|
4947
|
+
!c && !n && a && (s != null && s.loadThread) && s.loadThread(a);
|
|
4948
|
+
}, [c, n, a, s == null ? void 0 : s.loadThread]);
|
|
4949
|
+
const M = Y(() => {
|
|
4920
4950
|
var F;
|
|
4921
4951
|
return ((F = f[0]) == null ? void 0 : F.values) || {};
|
|
4922
|
-
}, [f]),
|
|
4952
|
+
}, [f]), A = Y(() => ({ timeline: [], messagePreviews: {} }), []), k = t || a, b = c ? m ? "loading" : "idle" : (s == null ? void 0 : s.status) || "idle", h = c ? l : (o == null ? void 0 : o.messages) || [], T = c ? m : (s == null ? void 0 : s.isLoading) || !1, p = c ? v : (s == null ? void 0 : s.isLoadingHistory) || !1, w = c ? M : (s == null ? void 0 : s.values) || {}, P = c ? {} : (s == null ? void 0 : s.taskMessagesByScope) || {}, j = c ? I : (o == null ? void 0 : o.error) || (s == null ? void 0 : s.error) || null;
|
|
4923
4953
|
return {
|
|
4924
4954
|
// UNIFIED: Single thread ID concept
|
|
4925
|
-
threadId:
|
|
4926
|
-
status:
|
|
4927
|
-
messages:
|
|
4928
|
-
isLoading:
|
|
4929
|
-
isHistoryLoading:
|
|
4955
|
+
threadId: k,
|
|
4956
|
+
status: b,
|
|
4957
|
+
messages: h,
|
|
4958
|
+
isLoading: T,
|
|
4959
|
+
isHistoryLoading: p,
|
|
4930
4960
|
error: j,
|
|
4931
4961
|
// Values & Metadata
|
|
4932
4962
|
values: w,
|
|
4933
4963
|
taskMessagesByScope: P,
|
|
4934
|
-
metadata: c ? {} :
|
|
4964
|
+
metadata: c ? {} : s == null ? void 0 : s.metadata,
|
|
4935
4965
|
// Actions & State relating to Global/Active Thread only
|
|
4936
4966
|
navigateToCheckpoint: c ? async () => {
|
|
4937
|
-
} : (
|
|
4967
|
+
} : (s == null ? void 0 : s.navigateToCheckpoint) || (async () => {
|
|
4938
4968
|
}),
|
|
4939
4969
|
returnToLatest: c ? async () => {
|
|
4940
|
-
} : (
|
|
4970
|
+
} : (s == null ? void 0 : s.returnToLatest) || (async () => {
|
|
4941
4971
|
}),
|
|
4942
|
-
checkpoint: c ? f[0] ? { id: f[0].checkpointId, namespace: f[0].checkpointNs } : null : (
|
|
4943
|
-
checkpoints: c ? f : (
|
|
4944
|
-
checkpointIndex: c ?
|
|
4945
|
-
interrupt: c ? null : (
|
|
4972
|
+
checkpoint: c ? f[0] ? { id: f[0].checkpointId, namespace: f[0].checkpointNs } : null : (s == null ? void 0 : s.checkpoint) || null,
|
|
4973
|
+
checkpoints: c ? f : (s == null ? void 0 : s.checkpoints) || [],
|
|
4974
|
+
checkpointIndex: c ? A : (s == null ? void 0 : s.checkpointIndex) || { timeline: [], messagePreviews: {} },
|
|
4975
|
+
interrupt: c ? null : (s == null ? void 0 : s.interrupt) || null,
|
|
4946
4976
|
respondToInterrupt: c ? async () => {
|
|
4947
|
-
} : (
|
|
4977
|
+
} : (s == null ? void 0 : s.respondToInterrupt) || (async () => {
|
|
4948
4978
|
}),
|
|
4949
4979
|
// Streaming Status
|
|
4950
4980
|
// Even in standalone mode, allow streaming state/stop if a stream context exists.
|
|
4951
|
-
isStreaming: (
|
|
4952
|
-
activeMessageId: c ? null : ((
|
|
4953
|
-
connectionState: (
|
|
4954
|
-
streamingAssistantId: !c && (
|
|
4981
|
+
isStreaming: (o == null ? void 0 : o.isStreaming) || !1,
|
|
4982
|
+
activeMessageId: c ? null : ((C = s == null ? void 0 : s.metadata) == null ? void 0 : C.assemblingMessageId) || (o == null ? void 0 : o.activeMessageId) || null,
|
|
4983
|
+
connectionState: (o == null ? void 0 : o.connectionState) || "disconnected",
|
|
4984
|
+
streamingAssistantId: !c && (o != null && o.isStreaming) && ((O = s == null ? void 0 : s.metadata) != null && O.assemblingMessageId) ? s.metadata.assemblingMessageId : null,
|
|
4955
4985
|
// Actions
|
|
4956
|
-
submit: (
|
|
4986
|
+
submit: (o == null ? void 0 : o.submit) || (async () => {
|
|
4957
4987
|
}),
|
|
4958
|
-
stop: (
|
|
4988
|
+
stop: (o == null ? void 0 : o.stop) || (() => {
|
|
4959
4989
|
}),
|
|
4960
4990
|
clearThread: c ? async () => {
|
|
4961
|
-
} : (
|
|
4991
|
+
} : (s == null ? void 0 : s.clearThread) || (async () => {
|
|
4962
4992
|
}),
|
|
4963
4993
|
setCurrentThreadId: i,
|
|
4964
4994
|
loadHistory: c ? async () => {
|
|
4965
|
-
t && await
|
|
4995
|
+
t && await x(t);
|
|
4966
4996
|
} : async () => {
|
|
4967
4997
|
},
|
|
4968
4998
|
onEvent: c ? () => {
|
|
4969
|
-
} : (
|
|
4999
|
+
} : (s == null ? void 0 : s.onEvent) || (() => {
|
|
4970
5000
|
}),
|
|
4971
5001
|
// Thread Management
|
|
4972
5002
|
createThread: u == null ? void 0 : u.createThread,
|
|
@@ -4976,50 +5006,50 @@ function Yr(e) {
|
|
|
4976
5006
|
isThreadsLoading: (r == null ? void 0 : r.isLoading) || !1
|
|
4977
5007
|
};
|
|
4978
5008
|
}
|
|
4979
|
-
function
|
|
5009
|
+
function ys({
|
|
4980
5010
|
submit: e,
|
|
4981
5011
|
chatRequest: t,
|
|
4982
5012
|
lastCheckpointId: n,
|
|
4983
5013
|
lastCheckpointNs: r,
|
|
4984
|
-
onMessageSent:
|
|
4985
|
-
onExcelUploadSuccess:
|
|
5014
|
+
onMessageSent: s,
|
|
5015
|
+
onExcelUploadSuccess: o,
|
|
4986
5016
|
onError: a,
|
|
4987
5017
|
enableMessageEditing: i,
|
|
4988
5018
|
messages: u,
|
|
4989
5019
|
setPendingAssistantResponse: c,
|
|
4990
5020
|
project: l,
|
|
4991
5021
|
onEvent: d,
|
|
4992
|
-
threadId:
|
|
4993
|
-
clearComposerOnSend:
|
|
5022
|
+
threadId: g,
|
|
5023
|
+
clearComposerOnSend: m = !0
|
|
4994
5024
|
}) {
|
|
4995
|
-
const { messages:
|
|
5025
|
+
const { messages: I } = Yr(), [f, v] = $(null), [x, M] = $(""), [A, k] = $(null), [b, h] = $(null), [T, p] = $(!1), [w, P] = $(""), j = W(w), C = W(null);
|
|
4996
5026
|
X(() => {
|
|
4997
5027
|
if (!f)
|
|
4998
|
-
if (
|
|
4999
|
-
const
|
|
5000
|
-
P(
|
|
5028
|
+
if (g) {
|
|
5029
|
+
const y = localStorage.getItem(Ge(g));
|
|
5030
|
+
P(y || "");
|
|
5001
5031
|
} else
|
|
5002
5032
|
P("");
|
|
5003
|
-
}, [
|
|
5004
|
-
const O = _((
|
|
5005
|
-
P(
|
|
5006
|
-
}, [
|
|
5033
|
+
}, [g, f]);
|
|
5034
|
+
const O = _((y) => {
|
|
5035
|
+
P(y), !f && g && localStorage.setItem(Ge(g), y);
|
|
5036
|
+
}, [g, f]);
|
|
5007
5037
|
X(() => {
|
|
5008
5038
|
j.current = w;
|
|
5009
5039
|
}, [w]), X(() => {
|
|
5010
5040
|
if (!f) {
|
|
5011
|
-
|
|
5041
|
+
C.current = null;
|
|
5012
5042
|
return;
|
|
5013
5043
|
}
|
|
5014
|
-
|
|
5015
|
-
}, [
|
|
5044
|
+
C.current === null && (C.current = j.current), O(x ?? "");
|
|
5045
|
+
}, [x, f, O]);
|
|
5016
5046
|
const F = _(
|
|
5017
|
-
(
|
|
5018
|
-
O(
|
|
5047
|
+
(y) => {
|
|
5048
|
+
O(y);
|
|
5019
5049
|
},
|
|
5020
5050
|
[O]
|
|
5021
|
-
),
|
|
5022
|
-
const
|
|
5051
|
+
), E = async (y, U) => {
|
|
5052
|
+
const S = Array.isArray(U) ? { files: U } : U ?? {}, J = S.files ?? [], V = S.contentParts ?? [], q = y.trim();
|
|
5023
5053
|
if (!(!q && J.length === 0 && V.length === 0))
|
|
5024
5054
|
try {
|
|
5025
5055
|
const ee = J.map(async (Q) => {
|
|
@@ -5041,7 +5071,7 @@ function ho({
|
|
|
5041
5071
|
name: Q.filename,
|
|
5042
5072
|
size: Q.size
|
|
5043
5073
|
};
|
|
5044
|
-
}), G = [...V, ...ue], te = f ? (
|
|
5074
|
+
}), G = [...V, ...ue], te = f ? (A == null ? void 0 : A.checkpointId) ?? n ?? void 0 : n ?? void 0, ke = f ? (A == null ? void 0 : A.checkpointNs) ?? r ?? void 0 : r ?? void 0;
|
|
5045
5075
|
await e(
|
|
5046
5076
|
{
|
|
5047
5077
|
text: q || "",
|
|
@@ -5056,18 +5086,18 @@ function ho({
|
|
|
5056
5086
|
config: t.config
|
|
5057
5087
|
},
|
|
5058
5088
|
d ? { onEvent: d } : void 0
|
|
5059
|
-
),
|
|
5089
|
+
), s == null || s(q), c(!0), m && (g && localStorage.removeItem(Ge(g)), O("")), h(null), v(null), M(""), k(null);
|
|
5060
5090
|
} catch (ee) {
|
|
5061
5091
|
const re = (ee == null ? void 0 : ee.message) || "Failed to send message";
|
|
5062
|
-
|
|
5092
|
+
h(re), a == null || a(re), c(!1);
|
|
5063
5093
|
}
|
|
5064
|
-
}, B = (
|
|
5065
|
-
U ||
|
|
5066
|
-
},
|
|
5067
|
-
async (
|
|
5094
|
+
}, B = (y, U) => {
|
|
5095
|
+
U || E(y, { files: [] });
|
|
5096
|
+
}, z = _(
|
|
5097
|
+
async (y) => {
|
|
5068
5098
|
await e(
|
|
5069
5099
|
{
|
|
5070
|
-
attachments: [
|
|
5100
|
+
attachments: [y],
|
|
5071
5101
|
payload: t.payload,
|
|
5072
5102
|
checkpointId: n ?? void 0,
|
|
5073
5103
|
checkpointNs: r ?? void 0,
|
|
@@ -5075,34 +5105,34 @@ function ho({
|
|
|
5075
5105
|
config: t.config
|
|
5076
5106
|
},
|
|
5077
5107
|
d ? { onEvent: d } : void 0
|
|
5078
|
-
),
|
|
5108
|
+
), o == null || o({ file: y });
|
|
5079
5109
|
},
|
|
5080
|
-
[n, r, t,
|
|
5110
|
+
[n, r, t, o, e]
|
|
5081
5111
|
), K = _(
|
|
5082
|
-
(
|
|
5083
|
-
i && (
|
|
5084
|
-
checkpointId: (
|
|
5085
|
-
checkpointNs: (
|
|
5086
|
-
}),
|
|
5112
|
+
(y, U, S) => {
|
|
5113
|
+
i && (C.current = w, v(y), M(U), k({
|
|
5114
|
+
checkpointId: (S == null ? void 0 : S.checkpointId) ?? null,
|
|
5115
|
+
checkpointNs: (S == null ? void 0 : S.checkpointNs) ?? null
|
|
5116
|
+
}), h(null));
|
|
5087
5117
|
},
|
|
5088
5118
|
[w, i]
|
|
5089
|
-
),
|
|
5090
|
-
|
|
5091
|
-
const
|
|
5092
|
-
|
|
5093
|
-
}, []), L = _((
|
|
5119
|
+
), N = _(() => {
|
|
5120
|
+
v(null), M(""), k(null), h(null);
|
|
5121
|
+
const y = C.current;
|
|
5122
|
+
y !== null && P(y), C.current = null;
|
|
5123
|
+
}, []), L = _((y) => {
|
|
5094
5124
|
let U = null;
|
|
5095
|
-
for (let q =
|
|
5125
|
+
for (let q = y - 1; q >= 0; q--)
|
|
5096
5126
|
if (u[q].role === "user") {
|
|
5097
5127
|
U = u[q];
|
|
5098
5128
|
break;
|
|
5099
5129
|
}
|
|
5100
5130
|
if (!U) return;
|
|
5101
|
-
const
|
|
5131
|
+
const S = Array.isArray(U.content) ? U.content : [], V = S.filter((q) => (q == null ? void 0 : q.type) === "text").map((q) => q.text).join("") || (() => {
|
|
5102
5132
|
try {
|
|
5103
|
-
return JSON.stringify(
|
|
5133
|
+
return JSON.stringify(S, null, 2);
|
|
5104
5134
|
} catch {
|
|
5105
|
-
return String(
|
|
5135
|
+
return String(S);
|
|
5106
5136
|
}
|
|
5107
5137
|
})();
|
|
5108
5138
|
V && e(
|
|
@@ -5120,23 +5150,23 @@ function ho({
|
|
|
5120
5150
|
}, [u, e, n, r, t]);
|
|
5121
5151
|
return {
|
|
5122
5152
|
editingMessageId: f,
|
|
5123
|
-
editingInitialValue:
|
|
5124
|
-
inputError:
|
|
5125
|
-
setInputError:
|
|
5126
|
-
dismissError:
|
|
5127
|
-
setDismissError:
|
|
5153
|
+
editingInitialValue: x,
|
|
5154
|
+
inputError: b,
|
|
5155
|
+
setInputError: h,
|
|
5156
|
+
dismissError: T,
|
|
5157
|
+
setDismissError: p,
|
|
5128
5158
|
composerValue: w,
|
|
5129
5159
|
handleComposerChange: F,
|
|
5130
|
-
handleSendMessage:
|
|
5160
|
+
handleSendMessage: E,
|
|
5131
5161
|
handleQuickPrompt: B,
|
|
5132
|
-
handleExcelUpload:
|
|
5162
|
+
handleExcelUpload: z,
|
|
5133
5163
|
startEditing: K,
|
|
5134
|
-
cancelEditing:
|
|
5164
|
+
cancelEditing: N,
|
|
5135
5165
|
handleRegenerateCb: L,
|
|
5136
|
-
displayMessages:
|
|
5166
|
+
displayMessages: I
|
|
5137
5167
|
};
|
|
5138
5168
|
}
|
|
5139
|
-
function
|
|
5169
|
+
function hs(e) {
|
|
5140
5170
|
return Y(() => e ? {
|
|
5141
5171
|
textContent: Ln(e),
|
|
5142
5172
|
imageParts: Un(e),
|
|
@@ -5151,12 +5181,12 @@ function bo(e) {
|
|
|
5151
5181
|
contentParts: []
|
|
5152
5182
|
}, [e]);
|
|
5153
5183
|
}
|
|
5154
|
-
function
|
|
5155
|
-
const [r,
|
|
5184
|
+
function bs(e, t, n) {
|
|
5185
|
+
const [r, s] = $(e), o = W(e), a = W(null);
|
|
5156
5186
|
return X(() => {
|
|
5157
|
-
|
|
5187
|
+
o.current = e;
|
|
5158
5188
|
const i = () => {
|
|
5159
|
-
o
|
|
5189
|
+
s(o.current), a.current && (clearTimeout(a.current), a.current = null);
|
|
5160
5190
|
};
|
|
5161
5191
|
if (!t || n <= 0) {
|
|
5162
5192
|
i();
|
|
@@ -5170,46 +5200,46 @@ function wo(e, t, n) {
|
|
|
5170
5200
|
}, [e, t, n]), r;
|
|
5171
5201
|
}
|
|
5172
5202
|
export {
|
|
5173
|
-
|
|
5203
|
+
fs as ChatProviders,
|
|
5174
5204
|
Ur as ThreadStateProvider,
|
|
5175
5205
|
mr as ThreadsProvider,
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5206
|
+
rs as cn,
|
|
5207
|
+
or as collectText,
|
|
5208
|
+
ds as createTaskSyncToolEndHandler,
|
|
5179
5209
|
Kr as extractTaskIdFromToolEnd,
|
|
5180
5210
|
ar as extractToolMeta,
|
|
5181
|
-
|
|
5182
|
-
|
|
5211
|
+
ss as formatToolOutput,
|
|
5212
|
+
cs as getAgentNameFromMessage,
|
|
5183
5213
|
Pt as getChatToken,
|
|
5184
|
-
|
|
5185
|
-
|
|
5214
|
+
us as getMessageAttemptInfo,
|
|
5215
|
+
as as getToolCallArtifacts,
|
|
5186
5216
|
qn as getToolCalls,
|
|
5187
|
-
|
|
5217
|
+
os as hasContent,
|
|
5188
5218
|
mt as hydrateHistorySnapshots,
|
|
5189
5219
|
Ct as isFileLike,
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5220
|
+
zn as looksLikeMarkdown,
|
|
5221
|
+
ls as messageSignature,
|
|
5222
|
+
is as normalizeInterruptId,
|
|
5193
5223
|
_t as onChatTokenChanged,
|
|
5194
5224
|
tt as parseJsonSafe,
|
|
5195
5225
|
Et as pretty,
|
|
5196
5226
|
Mr as refreshHistoryFileUrls,
|
|
5197
5227
|
Ke as sanitizeForDisplay,
|
|
5198
|
-
|
|
5228
|
+
Ie as setChatToken,
|
|
5199
5229
|
Fn as stringifyTool,
|
|
5200
5230
|
Me as useApi,
|
|
5201
|
-
|
|
5231
|
+
ys as useChatController,
|
|
5202
5232
|
Yr as useChatSession,
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5233
|
+
ps as useFilePreview,
|
|
5234
|
+
hs as useMessageContent,
|
|
5235
|
+
gs as useParsedMessageContent,
|
|
5206
5236
|
pr as useStream,
|
|
5207
|
-
|
|
5237
|
+
bs as useStreamingMarkdownBuffer,
|
|
5208
5238
|
$t as useThreadHistoryState,
|
|
5209
5239
|
Vt as useThreadState,
|
|
5210
5240
|
Lr as useThreadStateUpdater,
|
|
5211
|
-
|
|
5241
|
+
st as useThreads,
|
|
5212
5242
|
gr as useThreadsState,
|
|
5213
|
-
|
|
5243
|
+
ms as useToolPayload
|
|
5214
5244
|
};
|
|
5215
5245
|
//# sourceMappingURL=index.esm.js.map
|