@marimo-team/islands 0.25.3-dev431 → 0.25.3-dev432
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/{ErrorBoundary-CRk39Htl.js → ErrorBoundary-B43oV3b6.js} +1 -1
- package/dist/{chat-ui-BrqZd6Qb.js → chat-ui-BEMyRpmS.js} +720 -721
- package/dist/{code-visibility-IOaiwld2.js → code-visibility-S6mDxnr2.js} +1 -1
- package/dist/{common-e3QeLbF6.js → common-CIHg51sQ.js} +301 -301
- package/dist/{data-grid-overlay-editor-BNtYFq14.js → data-grid-overlay-editor-BCWPWxh4.js} +1 -1
- package/dist/{feedback-button-DEHXkqTr.js → feedback-button-DI9se_Ct.js} +2 -2
- package/dist/{glide-data-editor-CcmkcHzC.js → glide-data-editor-BeLtV7nF.js} +3 -3
- package/dist/{globals-Bwn2Opww.js → globals-DLPrOEeB.js} +1 -1
- package/dist/{html-to-image-ffxLmS29.js → html-to-image-DuNAF8H5.js} +1 -1
- package/dist/main.js +251 -251
- package/dist/{number-overlay-editor-iF4C4jgs.js → number-overlay-editor-CZLODMHG.js} +1 -1
- package/dist/{process-output-BEi2k7G4.js → process-output-Cl97_Reh.js} +1 -1
- package/dist/{reveal-component-Lmc4rqUp.js → reveal-component-CcavTIL_.js} +2 -2
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/chat/chat-panel.tsx +21 -11
- package/src/components/editor/ai/prompt-input.tsx +11 -1
- package/src/components/chat/chat-empty-state.tsx +0 -55
|
@@ -3,13 +3,13 @@ import { g as n, h as r, i, t as a } from "./button-qQhINE7z.js";
|
|
|
3
3
|
import { t as o } from "./react-Bgs_wQh3.js";
|
|
4
4
|
import { t as s } from "./compiler-runtime-C5KHtL5D.js";
|
|
5
5
|
import { i as c, t as l } from "./copy-icon-Bv5SAA0w.js";
|
|
6
|
-
import {
|
|
7
|
-
import { h as
|
|
6
|
+
import { At as u, Bt as d, Dt as f, Et as p, Ft as m, Ht as h, J as g, Lt as _, M as v, Ot as y, Pt as b, Rt as x, U as S, V as C, W as w, Y as T, a as E, dt as D, et as O, f as k, g as A, h as j, ht as M, l as N, m as P, n as ee, nt as te, p as F, r as ne, st as re, t as ie, tt as ae, u as oe, v as se, wt as ce, xt as le } from "./html-to-image-DuNAF8H5.js";
|
|
7
|
+
import { h as I, t as ue } from "./tooltip-DsQZP310.js";
|
|
8
8
|
import { d as de } from "./select-Brvb-RwP.js";
|
|
9
9
|
import { Cn as fe, _ as pe, f as me, h as he, i as ge, n as _e, t as ve, xn as ye } from "./dropdown-menu-DzhAnAhr.js";
|
|
10
10
|
import { a as be, l as xe } from "./config-EJnOxh0i.js";
|
|
11
11
|
import { $ as Se, Ct as Ce, P as we, Rt as Te, W as Ee, en as De, h as Oe, i as ke, j as Ae, ot as je, r as Me, t as Ne } from "./error-entries-BbxtqUQ4.js";
|
|
12
|
-
import { c as Pe, d as Fe, l as Ie, n as Le, t as Re, u as ze } from "./process-output-
|
|
12
|
+
import { c as Pe, d as Fe, l as Ie, n as Le, t as Re, u as ze } from "./process-output-Cl97_Reh.js";
|
|
13
13
|
import { t as Be } from "./pencil-DWRFEz2B.js";
|
|
14
14
|
import { n as Ve, r as He, s as Ue } from "./assertNever-ChGm2jYv.js";
|
|
15
15
|
import { t as We } from "./jsx-runtime-D8btoEHk.js";
|
|
@@ -23,7 +23,7 @@ import { n as jt, o as Mt, r as Nt } from "./dist-MggMo7OR.js";
|
|
|
23
23
|
import { n as Pt } from "./dist-BMz__bo5.js";
|
|
24
24
|
import { n as Ft, t as It } from "./esm-Bwp_FHP0.js";
|
|
25
25
|
import { t as Lt } from "./useAsyncData-P5-Oovhq.js";
|
|
26
|
-
var Rt =
|
|
26
|
+
var Rt = I("ban", [["circle", {
|
|
27
27
|
cx: "12",
|
|
28
28
|
cy: "12",
|
|
29
29
|
r: "10",
|
|
@@ -31,13 +31,13 @@ var Rt = F("ban", [["circle", {
|
|
|
31
31
|
}], ["path", {
|
|
32
32
|
d: "M4.929 4.929 19.07 19.071",
|
|
33
33
|
key: "196cmz"
|
|
34
|
-
}]]), zt =
|
|
34
|
+
}]]), zt = I("book-open", [["path", {
|
|
35
35
|
d: "M12 7v14",
|
|
36
36
|
key: "1akyts"
|
|
37
37
|
}], ["path", {
|
|
38
38
|
d: "M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",
|
|
39
39
|
key: "ruj8y"
|
|
40
|
-
}]]), Bt =
|
|
40
|
+
}]]), Bt = I("bot-message-square", [
|
|
41
41
|
["path", {
|
|
42
42
|
d: "M12 6V2H8",
|
|
43
43
|
key: "1155em"
|
|
@@ -62,7 +62,7 @@ var Rt = F("ban", [["circle", {
|
|
|
62
62
|
d: "M9 11v2",
|
|
63
63
|
key: "1ueba0"
|
|
64
64
|
}]
|
|
65
|
-
]), Vt =
|
|
65
|
+
]), Vt = I("brain", [
|
|
66
66
|
["path", {
|
|
67
67
|
d: "M12 18V5",
|
|
68
68
|
key: "adv99a"
|
|
@@ -95,7 +95,7 @@ var Rt = F("ban", [["circle", {
|
|
|
95
95
|
d: "M6.003 5.125a4 4 0 0 0-2.526 5.77",
|
|
96
96
|
key: "q97ue3"
|
|
97
97
|
}]
|
|
98
|
-
]), Ht =
|
|
98
|
+
]), Ht = I("bug", [
|
|
99
99
|
["path", {
|
|
100
100
|
d: "M12 20v-9",
|
|
101
101
|
key: "1qisl0"
|
|
@@ -140,7 +140,7 @@ var Rt = F("ban", [["circle", {
|
|
|
140
140
|
d: "M9 7.13V6a3 3 0 1 1 6 0v1.13",
|
|
141
141
|
key: "1vgav8"
|
|
142
142
|
}]
|
|
143
|
-
]), Ut =
|
|
143
|
+
]), Ut = I("circle-slash", [["circle", {
|
|
144
144
|
cx: "12",
|
|
145
145
|
cy: "12",
|
|
146
146
|
r: "10",
|
|
@@ -151,7 +151,7 @@ var Rt = F("ban", [["circle", {
|
|
|
151
151
|
y1: "15",
|
|
152
152
|
y2: "9",
|
|
153
153
|
key: "1dfufj"
|
|
154
|
-
}]]), Wt =
|
|
154
|
+
}]]), Wt = I("file-search", [
|
|
155
155
|
["path", {
|
|
156
156
|
d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
|
|
157
157
|
key: "1oefj6"
|
|
@@ -170,7 +170,7 @@ var Rt = F("ban", [["circle", {
|
|
|
170
170
|
d: "M13.3 16.3 15 18",
|
|
171
171
|
key: "2quom7"
|
|
172
172
|
}]
|
|
173
|
-
]), Gt =
|
|
173
|
+
]), Gt = I("list-checks", [
|
|
174
174
|
["path", {
|
|
175
175
|
d: "M13 5h8",
|
|
176
176
|
key: "a7qcls"
|
|
@@ -191,7 +191,7 @@ var Rt = F("ban", [["circle", {
|
|
|
191
191
|
d: "m3 7 2 2 4-4",
|
|
192
192
|
key: "1obspn"
|
|
193
193
|
}]
|
|
194
|
-
]), Kt =
|
|
194
|
+
]), Kt = I("notebook", [
|
|
195
195
|
["path", {
|
|
196
196
|
d: "M2 6h4",
|
|
197
197
|
key: "aawbzj"
|
|
@@ -220,16 +220,16 @@ var Rt = F("ban", [["circle", {
|
|
|
220
220
|
d: "M16 2v20",
|
|
221
221
|
key: "rotuqe"
|
|
222
222
|
}]
|
|
223
|
-
]), qt =
|
|
223
|
+
]), qt = I("paperclip", [["path", {
|
|
224
224
|
d: "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",
|
|
225
225
|
key: "1miecu"
|
|
226
|
-
}]]), Jt =
|
|
226
|
+
}]]), Jt = I("rotate-cw", [["path", {
|
|
227
227
|
d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",
|
|
228
228
|
key: "1p45f6"
|
|
229
229
|
}], ["path", {
|
|
230
230
|
d: "M21 3v5h-5",
|
|
231
231
|
key: "1q7to0"
|
|
232
|
-
}]]), Yt =
|
|
232
|
+
}]]), Yt = I("scan-search", [
|
|
233
233
|
["path", {
|
|
234
234
|
d: "M3 7V5a2 2 0 0 1 2-2h2",
|
|
235
235
|
key: "aa7l1z"
|
|
@@ -256,13 +256,13 @@ var Rt = F("ban", [["circle", {
|
|
|
256
256
|
d: "m16 16-1.9-1.9",
|
|
257
257
|
key: "1dq9hf"
|
|
258
258
|
}]
|
|
259
|
-
]), Xt =
|
|
259
|
+
]), Xt = I("send-horizontal", [["path", {
|
|
260
260
|
d: "M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",
|
|
261
261
|
key: "117uat"
|
|
262
262
|
}], ["path", {
|
|
263
263
|
d: "M6 12h16",
|
|
264
264
|
key: "s4cdu5"
|
|
265
|
-
}]]), Zt =
|
|
265
|
+
}]]), Zt = I("settings", [["path", {
|
|
266
266
|
d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",
|
|
267
267
|
key: "1i5ecw"
|
|
268
268
|
}], ["circle", {
|
|
@@ -270,7 +270,7 @@ var Rt = F("ban", [["circle", {
|
|
|
270
270
|
cy: "12",
|
|
271
271
|
r: "3",
|
|
272
272
|
key: "1v7zrd"
|
|
273
|
-
}]]), Qt =
|
|
273
|
+
}]]), Qt = I("shield-question-mark", [
|
|
274
274
|
["path", {
|
|
275
275
|
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
|
|
276
276
|
key: "oel41y"
|
|
@@ -283,7 +283,7 @@ var Rt = F("ban", [["circle", {
|
|
|
283
283
|
d: "M12 17h.01",
|
|
284
284
|
key: "p32p05"
|
|
285
285
|
}]
|
|
286
|
-
]),
|
|
286
|
+
]), L = s(), $t = "vercel.ai.error", en = Symbol.for($t), R = class e extends Error {
|
|
287
287
|
constructor({ name: e, message: t, cause: n }) {
|
|
288
288
|
super(t), this[en] = !0, this.name = e, this.cause = n;
|
|
289
289
|
}
|
|
@@ -294,7 +294,7 @@ var Rt = F("ban", [["circle", {
|
|
|
294
294
|
let n = Symbol.for(t);
|
|
295
295
|
return typeof e == "object" && !!e && n in e && typeof e[n] == "boolean" && e[n] === !0;
|
|
296
296
|
}
|
|
297
|
-
}, tn = "AI_APICallError", nn = `vercel.ai.error.${tn}`, rn = Symbol.for(nn), an = class extends
|
|
297
|
+
}, tn = "AI_APICallError", nn = `vercel.ai.error.${tn}`, rn = Symbol.for(nn), an = class extends R {
|
|
298
298
|
constructor({ message: e, url: t, requestBodyValues: n, statusCode: r, responseHeaders: i, responseBody: a, cause: o, isRetryable: s = r != null && (r === 408 || r === 409 || r === 429 || r >= 500), data: c }) {
|
|
299
299
|
super({
|
|
300
300
|
name: tn,
|
|
@@ -303,9 +303,9 @@ var Rt = F("ban", [["circle", {
|
|
|
303
303
|
}), this[rn] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
|
|
304
304
|
}
|
|
305
305
|
static isInstance(e) {
|
|
306
|
-
return
|
|
306
|
+
return R.hasMarker(e, nn);
|
|
307
307
|
}
|
|
308
|
-
}, on = "AI_EmptyResponseBodyError", sn = `vercel.ai.error.${on}`, cn = Symbol.for(sn), ln = class extends
|
|
308
|
+
}, on = "AI_EmptyResponseBodyError", sn = `vercel.ai.error.${on}`, cn = Symbol.for(sn), ln = class extends R {
|
|
309
309
|
constructor({ message: e = "Empty response body" } = {}) {
|
|
310
310
|
super({
|
|
311
311
|
name: on,
|
|
@@ -313,13 +313,13 @@ var Rt = F("ban", [["circle", {
|
|
|
313
313
|
}), this[cn] = !0;
|
|
314
314
|
}
|
|
315
315
|
static isInstance(e) {
|
|
316
|
-
return
|
|
316
|
+
return R.hasMarker(e, sn);
|
|
317
317
|
}
|
|
318
318
|
};
|
|
319
319
|
function un(e) {
|
|
320
320
|
return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
|
|
321
321
|
}
|
|
322
|
-
var dn = "AI_InvalidArgumentError", fn = `vercel.ai.error.${dn}`, pn = Symbol.for(fn), mn = class extends
|
|
322
|
+
var dn = "AI_InvalidArgumentError", fn = `vercel.ai.error.${dn}`, pn = Symbol.for(fn), mn = class extends R {
|
|
323
323
|
constructor({ message: e, cause: t, argument: n }) {
|
|
324
324
|
super({
|
|
325
325
|
name: dn,
|
|
@@ -328,9 +328,9 @@ var dn = "AI_InvalidArgumentError", fn = `vercel.ai.error.${dn}`, pn = Symbol.fo
|
|
|
328
328
|
}), this[pn] = !0, this.argument = n;
|
|
329
329
|
}
|
|
330
330
|
static isInstance(e) {
|
|
331
|
-
return
|
|
331
|
+
return R.hasMarker(e, fn);
|
|
332
332
|
}
|
|
333
|
-
}, hn = "AI_JSONParseError", gn = `vercel.ai.error.${hn}`, _n = Symbol.for(gn), vn = class extends
|
|
333
|
+
}, hn = "AI_JSONParseError", gn = `vercel.ai.error.${hn}`, _n = Symbol.for(gn), vn = class extends R {
|
|
334
334
|
constructor({ text: e, cause: t }) {
|
|
335
335
|
super({
|
|
336
336
|
name: hn,
|
|
@@ -339,9 +339,9 @@ var dn = "AI_InvalidArgumentError", fn = `vercel.ai.error.${dn}`, pn = Symbol.fo
|
|
|
339
339
|
}), this[_n] = !0, this.text = e;
|
|
340
340
|
}
|
|
341
341
|
static isInstance(e) {
|
|
342
|
-
return
|
|
342
|
+
return R.hasMarker(e, gn);
|
|
343
343
|
}
|
|
344
|
-
}, yn = "AI_TypeValidationError", bn = `vercel.ai.error.${yn}`, xn = Symbol.for(bn), Sn = class e extends
|
|
344
|
+
}, yn = "AI_TypeValidationError", bn = `vercel.ai.error.${yn}`, xn = Symbol.for(bn), Sn = class e extends R {
|
|
345
345
|
constructor({ value: e, cause: t, context: n }) {
|
|
346
346
|
let r = "Type validation failed";
|
|
347
347
|
if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
|
|
@@ -356,7 +356,7 @@ var dn = "AI_InvalidArgumentError", fn = `vercel.ai.error.${dn}`, pn = Symbol.fo
|
|
|
356
356
|
}), this[xn] = !0, this.value = e, this.context = n;
|
|
357
357
|
}
|
|
358
358
|
static isInstance(e) {
|
|
359
|
-
return
|
|
359
|
+
return R.hasMarker(e, bn);
|
|
360
360
|
}
|
|
361
361
|
static wrap({ value: t, cause: n, context: r }) {
|
|
362
362
|
return e.isInstance(n) && n.value === t && n.context?.field === r?.field && n.context?.entityName === r?.entityName && n.context?.entityId === r?.entityId ? n : new e({
|
|
@@ -365,7 +365,7 @@ var dn = "AI_InvalidArgumentError", fn = `vercel.ai.error.${dn}`, pn = Symbol.fo
|
|
|
365
365
|
context: r
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
|
-
}, Cn = "AI_UnsupportedFunctionalityError", wn = `vercel.ai.error.${Cn}`, Tn = Symbol.for(wn), En = class extends
|
|
368
|
+
}, Cn = "AI_UnsupportedFunctionalityError", wn = `vercel.ai.error.${Cn}`, Tn = Symbol.for(wn), En = class extends R {
|
|
369
369
|
constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
|
|
370
370
|
super({
|
|
371
371
|
name: Cn,
|
|
@@ -373,13 +373,13 @@ var dn = "AI_InvalidArgumentError", fn = `vercel.ai.error.${dn}`, pn = Symbol.fo
|
|
|
373
373
|
}), this[Tn] = !0, this.functionality = e;
|
|
374
374
|
}
|
|
375
375
|
static isInstance(e) {
|
|
376
|
-
return
|
|
376
|
+
return R.hasMarker(e, wn);
|
|
377
377
|
}
|
|
378
378
|
}, Dn = class extends Error {
|
|
379
379
|
constructor(e, t) {
|
|
380
380
|
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
381
381
|
}
|
|
382
|
-
}, On = 10, kn = 13,
|
|
382
|
+
}, On = 10, kn = 13, z = 32;
|
|
383
383
|
function An(e) {}
|
|
384
384
|
function jn(e) {
|
|
385
385
|
if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
|
|
@@ -419,7 +419,7 @@ function jn(e) {
|
|
|
419
419
|
}
|
|
420
420
|
let i = e.charCodeAt(n);
|
|
421
421
|
if (Mn(e, n, i)) {
|
|
422
|
-
let i = e.charCodeAt(n + 5) ===
|
|
422
|
+
let i = e.charCodeAt(n + 5) === z ? n + 6 : n + 5, a = e.slice(i, r);
|
|
423
423
|
if (d === 0 && e.charCodeAt(r + 1) === On) {
|
|
424
424
|
t({
|
|
425
425
|
id: l,
|
|
@@ -430,7 +430,7 @@ function jn(e) {
|
|
|
430
430
|
}
|
|
431
431
|
u = d === 0 ? a : `${u}
|
|
432
432
|
${a}`, d++;
|
|
433
|
-
} else Nn(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) ===
|
|
433
|
+
} else Nn(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === z ? n + 7 : n + 6, r) || void 0 : _(e, n, r);
|
|
434
434
|
n = r + 1, r = e.indexOf("\n", n);
|
|
435
435
|
}
|
|
436
436
|
return e.slice(n);
|
|
@@ -449,24 +449,24 @@ ${a}`, d++;
|
|
|
449
449
|
}
|
|
450
450
|
let r = e.charCodeAt(t);
|
|
451
451
|
if (Mn(e, t, r)) {
|
|
452
|
-
let r = e.charCodeAt(t + 5) ===
|
|
452
|
+
let r = e.charCodeAt(t + 5) === z ? t + 6 : t + 5, i = e.slice(r, n);
|
|
453
453
|
u = d === 0 ? i : `${u}
|
|
454
454
|
${i}`, d++;
|
|
455
455
|
return;
|
|
456
456
|
}
|
|
457
457
|
if (Nn(e, t, r)) {
|
|
458
|
-
f = e.slice(e.charCodeAt(t + 6) ===
|
|
458
|
+
f = e.slice(e.charCodeAt(t + 6) === z ? t + 7 : t + 6, n) || void 0;
|
|
459
459
|
return;
|
|
460
460
|
}
|
|
461
461
|
if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
|
|
462
|
-
let r = e.slice(e.charCodeAt(t + 3) ===
|
|
462
|
+
let r = e.slice(e.charCodeAt(t + 3) === z ? t + 4 : t + 3, n);
|
|
463
463
|
l = r.includes("\0") ? void 0 : r;
|
|
464
464
|
return;
|
|
465
465
|
}
|
|
466
466
|
if (r === 58) {
|
|
467
467
|
if (i) {
|
|
468
468
|
let r = e.slice(t, n);
|
|
469
|
-
i(r.slice(e.charCodeAt(t + 1) ===
|
|
469
|
+
i(r.slice(e.charCodeAt(t + 1) === z ? 2 : 1));
|
|
470
470
|
}
|
|
471
471
|
return;
|
|
472
472
|
}
|
|
@@ -475,7 +475,7 @@ ${i}`, d++;
|
|
|
475
475
|
v(a, "", a);
|
|
476
476
|
return;
|
|
477
477
|
}
|
|
478
|
-
let s = a.slice(0, o), c = a.charCodeAt(o + 1) ===
|
|
478
|
+
let s = a.slice(0, o), c = a.charCodeAt(o + 1) === z ? 2 : 1;
|
|
479
479
|
v(s, a.slice(o + c), a);
|
|
480
480
|
}
|
|
481
481
|
function v(e, t, i) {
|
|
@@ -569,7 +569,7 @@ function Ln(e) {
|
|
|
569
569
|
}
|
|
570
570
|
return t;
|
|
571
571
|
}
|
|
572
|
-
var
|
|
572
|
+
var B = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", separator: r = "-" } = {}) => {
|
|
573
573
|
let i = () => {
|
|
574
574
|
let e = n.length, r = Array(t);
|
|
575
575
|
for (let i = 0; i < t; i++) r[i] = n[Math.random() * e | 0];
|
|
@@ -581,7 +581,7 @@ var z = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRS
|
|
|
581
581
|
message: `The separator "${r}" must not be part of the alphabet "${n}".`
|
|
582
582
|
});
|
|
583
583
|
return () => `${e}${r}${i()}`;
|
|
584
|
-
}, Rn =
|
|
584
|
+
}, Rn = B();
|
|
585
585
|
function zn(e) {
|
|
586
586
|
return globalThis.Buffer?.isBuffer(e) ?? !1;
|
|
587
587
|
}
|
|
@@ -621,16 +621,16 @@ function Wn(e) {
|
|
|
621
621
|
function Gn(e) {
|
|
622
622
|
if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
|
|
623
623
|
let { additionalProperties: t } = e;
|
|
624
|
-
e.additionalProperties = t != null && typeof t != "boolean" &&
|
|
624
|
+
e.additionalProperties = t != null && typeof t != "boolean" && V(t);
|
|
625
625
|
let { properties: n } = e;
|
|
626
|
-
if (n != null) for (let e of Object.keys(n)) n[e] =
|
|
626
|
+
if (n != null) for (let e of Object.keys(n)) n[e] = V(n[e]);
|
|
627
627
|
}
|
|
628
|
-
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(
|
|
628
|
+
e.items != null && (e.items = Array.isArray(e.items) ? e.items.map(V) : V(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(V)), e.allOf != null && (e.allOf = e.allOf.map(V)), e.oneOf != null && (e.oneOf = e.oneOf.map(V));
|
|
629
629
|
let { definitions: t } = e;
|
|
630
|
-
if (t != null) for (let e of Object.keys(t)) t[e] =
|
|
630
|
+
if (t != null) for (let e of Object.keys(t)) t[e] = V(t[e]);
|
|
631
631
|
return e;
|
|
632
632
|
}
|
|
633
|
-
function
|
|
633
|
+
function V(e) {
|
|
634
634
|
return typeof e == "boolean" ? e : Gn(e);
|
|
635
635
|
}
|
|
636
636
|
var Kn = Symbol("Let zodToJsonSchema decide on which parser to use"), qn = {
|
|
@@ -660,12 +660,12 @@ var Kn = Symbol("Let zodToJsonSchema decide on which parser to use"), qn = {
|
|
|
660
660
|
...qn,
|
|
661
661
|
...e
|
|
662
662
|
};
|
|
663
|
-
function
|
|
663
|
+
function H() {
|
|
664
664
|
return {};
|
|
665
665
|
}
|
|
666
666
|
function Yn(e, t) {
|
|
667
667
|
let n = { type: "array" };
|
|
668
|
-
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items =
|
|
668
|
+
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = K(e.type._def, {
|
|
669
669
|
...t,
|
|
670
670
|
currentPath: [...t.currentPath, "items"]
|
|
671
671
|
})), e.minLength && (n.minItems = e.minLength.value), e.maxLength && (n.maxItems = e.maxLength.value), e.exactLength && (n.minItems = e.exactLength.value, n.maxItems = e.exactLength.value), n;
|
|
@@ -691,9 +691,9 @@ function Zn() {
|
|
|
691
691
|
return { type: "boolean" };
|
|
692
692
|
}
|
|
693
693
|
function Qn(e, t) {
|
|
694
|
-
return
|
|
694
|
+
return K(e.type._def, t);
|
|
695
695
|
}
|
|
696
|
-
var $n = (e, t) =>
|
|
696
|
+
var $n = (e, t) => K(e.innerType._def, t);
|
|
697
697
|
function er(e, t, n) {
|
|
698
698
|
let r = n ?? t.dateStrategy;
|
|
699
699
|
if (Array.isArray(r)) return { anyOf: r.map((n) => er(e, t, n)) };
|
|
@@ -725,12 +725,12 @@ var tr = (e) => {
|
|
|
725
725
|
};
|
|
726
726
|
function nr(e, t) {
|
|
727
727
|
return {
|
|
728
|
-
...
|
|
728
|
+
...K(e.innerType._def, t),
|
|
729
729
|
default: e.defaultValue()
|
|
730
730
|
};
|
|
731
731
|
}
|
|
732
732
|
function rr(e, t) {
|
|
733
|
-
return t.effectStrategy === "input" ?
|
|
733
|
+
return t.effectStrategy === "input" ? K(e.schema._def, t) : H();
|
|
734
734
|
}
|
|
735
735
|
function ir(e) {
|
|
736
736
|
return {
|
|
@@ -740,14 +740,14 @@ function ir(e) {
|
|
|
740
740
|
}
|
|
741
741
|
var ar = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
742
742
|
function or(e, t) {
|
|
743
|
-
let n = [
|
|
743
|
+
let n = [K(e.left._def, {
|
|
744
744
|
...t,
|
|
745
745
|
currentPath: [
|
|
746
746
|
...t.currentPath,
|
|
747
747
|
"allOf",
|
|
748
748
|
"0"
|
|
749
749
|
]
|
|
750
|
-
}),
|
|
750
|
+
}), K(e.right._def, {
|
|
751
751
|
...t,
|
|
752
752
|
currentPath: [
|
|
753
753
|
...t.currentPath,
|
|
@@ -774,7 +774,7 @@ function sr(e) {
|
|
|
774
774
|
const: e.value
|
|
775
775
|
};
|
|
776
776
|
}
|
|
777
|
-
var cr = void 0,
|
|
777
|
+
var cr = void 0, U = {
|
|
778
778
|
cuid: /^[cC][^\s-]{8,}$/,
|
|
779
779
|
cuid2: /^[0-9a-z]+$/,
|
|
780
780
|
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
@@ -802,83 +802,83 @@ function lr(e, t) {
|
|
|
802
802
|
case "email":
|
|
803
803
|
switch (t.emailStrategy) {
|
|
804
804
|
case "format:email":
|
|
805
|
-
|
|
805
|
+
W(n, "email", r.message, t);
|
|
806
806
|
break;
|
|
807
807
|
case "format:idn-email":
|
|
808
|
-
|
|
808
|
+
W(n, "idn-email", r.message, t);
|
|
809
809
|
break;
|
|
810
|
-
case "pattern:zod":
|
|
810
|
+
case "pattern:zod": G(n, U.email, r.message, t);
|
|
811
811
|
}
|
|
812
812
|
break;
|
|
813
813
|
case "url":
|
|
814
|
-
|
|
814
|
+
W(n, "uri", r.message, t);
|
|
815
815
|
break;
|
|
816
816
|
case "uuid":
|
|
817
|
-
|
|
817
|
+
W(n, "uuid", r.message, t);
|
|
818
818
|
break;
|
|
819
819
|
case "regex":
|
|
820
|
-
|
|
820
|
+
G(n, r.regex, r.message, t);
|
|
821
821
|
break;
|
|
822
822
|
case "cuid":
|
|
823
|
-
|
|
823
|
+
G(n, U.cuid, r.message, t);
|
|
824
824
|
break;
|
|
825
825
|
case "cuid2":
|
|
826
|
-
|
|
826
|
+
G(n, U.cuid2, r.message, t);
|
|
827
827
|
break;
|
|
828
828
|
case "startsWith":
|
|
829
|
-
|
|
829
|
+
G(n, RegExp(`^${ur(r.value, t)}`), r.message, t);
|
|
830
830
|
break;
|
|
831
831
|
case "endsWith":
|
|
832
|
-
|
|
832
|
+
G(n, RegExp(`${ur(r.value, t)}$`), r.message, t);
|
|
833
833
|
break;
|
|
834
834
|
case "datetime":
|
|
835
|
-
|
|
835
|
+
W(n, "date-time", r.message, t);
|
|
836
836
|
break;
|
|
837
837
|
case "date":
|
|
838
|
-
|
|
838
|
+
W(n, "date", r.message, t);
|
|
839
839
|
break;
|
|
840
840
|
case "time":
|
|
841
|
-
|
|
841
|
+
W(n, "time", r.message, t);
|
|
842
842
|
break;
|
|
843
843
|
case "duration":
|
|
844
|
-
|
|
844
|
+
W(n, "duration", r.message, t);
|
|
845
845
|
break;
|
|
846
846
|
case "length":
|
|
847
847
|
n.minLength = typeof n.minLength == "number" ? Math.max(n.minLength, r.value) : r.value, n.maxLength = typeof n.maxLength == "number" ? Math.min(n.maxLength, r.value) : r.value;
|
|
848
848
|
break;
|
|
849
849
|
case "includes":
|
|
850
|
-
|
|
850
|
+
G(n, RegExp(ur(r.value, t)), r.message, t);
|
|
851
851
|
break;
|
|
852
852
|
case "ip":
|
|
853
|
-
r.version !== "v6" &&
|
|
853
|
+
r.version !== "v6" && W(n, "ipv4", r.message, t), r.version !== "v4" && W(n, "ipv6", r.message, t);
|
|
854
854
|
break;
|
|
855
855
|
case "base64url":
|
|
856
|
-
|
|
856
|
+
G(n, U.base64url, r.message, t);
|
|
857
857
|
break;
|
|
858
858
|
case "jwt":
|
|
859
|
-
|
|
859
|
+
G(n, U.jwt, r.message, t);
|
|
860
860
|
break;
|
|
861
861
|
case "cidr":
|
|
862
|
-
r.version !== "v6" &&
|
|
862
|
+
r.version !== "v6" && G(n, U.ipv4Cidr, r.message, t), r.version !== "v4" && G(n, U.ipv6Cidr, r.message, t);
|
|
863
863
|
break;
|
|
864
864
|
case "emoji":
|
|
865
|
-
|
|
865
|
+
G(n, U.emoji(), r.message, t);
|
|
866
866
|
break;
|
|
867
867
|
case "ulid":
|
|
868
|
-
|
|
868
|
+
G(n, U.ulid, r.message, t);
|
|
869
869
|
break;
|
|
870
870
|
case "base64":
|
|
871
871
|
switch (t.base64Strategy) {
|
|
872
872
|
case "format:binary":
|
|
873
|
-
|
|
873
|
+
W(n, "binary", r.message, t);
|
|
874
874
|
break;
|
|
875
875
|
case "contentEncoding:base64":
|
|
876
876
|
n.contentEncoding = "base64";
|
|
877
877
|
break;
|
|
878
|
-
case "pattern:zod":
|
|
878
|
+
case "pattern:zod": G(n, U.base64, r.message, t);
|
|
879
879
|
}
|
|
880
880
|
break;
|
|
881
|
-
case "nanoid":
|
|
881
|
+
case "nanoid": G(n, U.nanoid, r.message, t);
|
|
882
882
|
}
|
|
883
883
|
return n;
|
|
884
884
|
}
|
|
@@ -891,13 +891,13 @@ function fr(e) {
|
|
|
891
891
|
for (let n = 0; n < e.length; n++) dr.has(e[n]) || (t += "\\"), t += e[n];
|
|
892
892
|
return t;
|
|
893
893
|
}
|
|
894
|
-
function
|
|
894
|
+
function W(e, t, n, r) {
|
|
895
895
|
e.format || e.anyOf?.some((e) => e.format) ? (e.anyOf ||= [], e.format && (e.anyOf.push({ format: e.format }), delete e.format), e.anyOf.push({
|
|
896
896
|
format: t,
|
|
897
897
|
...n && r.errorMessages && { errorMessage: { format: n } }
|
|
898
898
|
})) : e.format = t;
|
|
899
899
|
}
|
|
900
|
-
function
|
|
900
|
+
function G(e, t, n, r) {
|
|
901
901
|
e.pattern || e.allOf?.some((e) => e.pattern) ? (e.allOf ||= [], e.pattern && (e.allOf.push({ pattern: e.pattern }), delete e.pattern), e.allOf.push({
|
|
902
902
|
pattern: pr(t, r),
|
|
903
903
|
...n && r.errorMessages && { errorMessage: { pattern: n } }
|
|
@@ -945,7 +945,7 @@ function pr(e, t) {
|
|
|
945
945
|
function mr(e, t) {
|
|
946
946
|
let n = {
|
|
947
947
|
type: "object",
|
|
948
|
-
additionalProperties:
|
|
948
|
+
additionalProperties: K(e.valueType._def, {
|
|
949
949
|
...t,
|
|
950
950
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
951
951
|
}) ?? t.allowedAdditionalProperties
|
|
@@ -976,7 +976,7 @@ function hr(e, t) {
|
|
|
976
976
|
maxItems: 125,
|
|
977
977
|
items: {
|
|
978
978
|
type: "array",
|
|
979
|
-
items: [
|
|
979
|
+
items: [K(e.keyType._def, {
|
|
980
980
|
...t,
|
|
981
981
|
currentPath: [
|
|
982
982
|
...t.currentPath,
|
|
@@ -984,7 +984,7 @@ function hr(e, t) {
|
|
|
984
984
|
"items",
|
|
985
985
|
"0"
|
|
986
986
|
]
|
|
987
|
-
}) ||
|
|
987
|
+
}) || H(), K(e.valueType._def, {
|
|
988
988
|
...t,
|
|
989
989
|
currentPath: [
|
|
990
990
|
...t.currentPath,
|
|
@@ -992,7 +992,7 @@ function hr(e, t) {
|
|
|
992
992
|
"items",
|
|
993
993
|
"1"
|
|
994
994
|
]
|
|
995
|
-
}) ||
|
|
995
|
+
}) || H()],
|
|
996
996
|
minItems: 2,
|
|
997
997
|
maxItems: 2
|
|
998
998
|
}
|
|
@@ -1006,7 +1006,7 @@ function gr(e) {
|
|
|
1006
1006
|
};
|
|
1007
1007
|
}
|
|
1008
1008
|
function _r() {
|
|
1009
|
-
return { not:
|
|
1009
|
+
return { not: H() };
|
|
1010
1010
|
}
|
|
1011
1011
|
function vr() {
|
|
1012
1012
|
return { type: "null" };
|
|
@@ -1053,7 +1053,7 @@ function br(e, t) {
|
|
|
1053
1053
|
return xr(e, t);
|
|
1054
1054
|
}
|
|
1055
1055
|
var xr = (e, t) => {
|
|
1056
|
-
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) =>
|
|
1056
|
+
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => K(e._def, {
|
|
1057
1057
|
...t,
|
|
1058
1058
|
currentPath: [
|
|
1059
1059
|
...t.currentPath,
|
|
@@ -1071,7 +1071,7 @@ function Sr(e, t) {
|
|
|
1071
1071
|
"ZodBoolean",
|
|
1072
1072
|
"ZodNull"
|
|
1073
1073
|
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [yr[e.innerType._def.typeName], "null"] };
|
|
1074
|
-
let n =
|
|
1074
|
+
let n = K(e.innerType._def, {
|
|
1075
1075
|
...t,
|
|
1076
1076
|
currentPath: [
|
|
1077
1077
|
...t.currentPath,
|
|
@@ -1106,7 +1106,7 @@ function wr(e, t) {
|
|
|
1106
1106
|
for (let e in i) {
|
|
1107
1107
|
let a = i[e];
|
|
1108
1108
|
if (a === void 0 || a._def === void 0) continue;
|
|
1109
|
-
let o = Er(a), s =
|
|
1109
|
+
let o = Er(a), s = K(a._def, {
|
|
1110
1110
|
...t,
|
|
1111
1111
|
currentPath: [
|
|
1112
1112
|
...t.currentPath,
|
|
@@ -1126,7 +1126,7 @@ function wr(e, t) {
|
|
|
1126
1126
|
return a !== void 0 && (n.additionalProperties = a), n;
|
|
1127
1127
|
}
|
|
1128
1128
|
function Tr(e, t) {
|
|
1129
|
-
if (e.catchall._def.typeName !== "ZodNever") return
|
|
1129
|
+
if (e.catchall._def.typeName !== "ZodNever") return K(e.catchall._def, {
|
|
1130
1130
|
...t,
|
|
1131
1131
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
1132
1132
|
});
|
|
@@ -1144,8 +1144,8 @@ function Er(e) {
|
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
1146
|
var Dr = (e, t) => {
|
|
1147
|
-
if (t.currentPath.toString() === t.propertyPath?.toString()) return
|
|
1148
|
-
let n =
|
|
1147
|
+
if (t.currentPath.toString() === t.propertyPath?.toString()) return K(e.innerType._def, t);
|
|
1148
|
+
let n = K(e.innerType._def, {
|
|
1149
1149
|
...t,
|
|
1150
1150
|
currentPath: [
|
|
1151
1151
|
...t.currentPath,
|
|
@@ -1153,11 +1153,11 @@ var Dr = (e, t) => {
|
|
|
1153
1153
|
"1"
|
|
1154
1154
|
]
|
|
1155
1155
|
});
|
|
1156
|
-
return n ? { anyOf: [{ not:
|
|
1156
|
+
return n ? { anyOf: [{ not: H() }, n] } : H();
|
|
1157
1157
|
}, Or = (e, t) => {
|
|
1158
|
-
if (t.pipeStrategy === "input") return
|
|
1159
|
-
if (t.pipeStrategy === "output") return
|
|
1160
|
-
let n =
|
|
1158
|
+
if (t.pipeStrategy === "input") return K(e.in._def, t);
|
|
1159
|
+
if (t.pipeStrategy === "output") return K(e.out._def, t);
|
|
1160
|
+
let n = K(e.in._def, {
|
|
1161
1161
|
...t,
|
|
1162
1162
|
currentPath: [
|
|
1163
1163
|
...t.currentPath,
|
|
@@ -1165,7 +1165,7 @@ var Dr = (e, t) => {
|
|
|
1165
1165
|
"0"
|
|
1166
1166
|
]
|
|
1167
1167
|
});
|
|
1168
|
-
return { allOf: [n,
|
|
1168
|
+
return { allOf: [n, K(e.out._def, {
|
|
1169
1169
|
...t,
|
|
1170
1170
|
currentPath: [
|
|
1171
1171
|
...t.currentPath,
|
|
@@ -1175,13 +1175,13 @@ var Dr = (e, t) => {
|
|
|
1175
1175
|
})].filter((e) => e !== void 0) };
|
|
1176
1176
|
};
|
|
1177
1177
|
function kr(e, t) {
|
|
1178
|
-
return
|
|
1178
|
+
return K(e.type._def, t);
|
|
1179
1179
|
}
|
|
1180
1180
|
function Ar(e, t) {
|
|
1181
1181
|
let n = {
|
|
1182
1182
|
type: "array",
|
|
1183
1183
|
uniqueItems: !0,
|
|
1184
|
-
items:
|
|
1184
|
+
items: K(e.valueType._def, {
|
|
1185
1185
|
...t,
|
|
1186
1186
|
currentPath: [...t.currentPath, "items"]
|
|
1187
1187
|
})
|
|
@@ -1192,7 +1192,7 @@ function jr(e, t) {
|
|
|
1192
1192
|
return e.rest ? {
|
|
1193
1193
|
type: "array",
|
|
1194
1194
|
minItems: e.items.length,
|
|
1195
|
-
items: e.items.map((e, n) =>
|
|
1195
|
+
items: e.items.map((e, n) => K(e._def, {
|
|
1196
1196
|
...t,
|
|
1197
1197
|
currentPath: [
|
|
1198
1198
|
...t.currentPath,
|
|
@@ -1200,7 +1200,7 @@ function jr(e, t) {
|
|
|
1200
1200
|
`${n}`
|
|
1201
1201
|
]
|
|
1202
1202
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], []),
|
|
1203
|
-
additionalItems:
|
|
1203
|
+
additionalItems: K(e.rest._def, {
|
|
1204
1204
|
...t,
|
|
1205
1205
|
currentPath: [...t.currentPath, "additionalItems"]
|
|
1206
1206
|
})
|
|
@@ -1208,7 +1208,7 @@ function jr(e, t) {
|
|
|
1208
1208
|
type: "array",
|
|
1209
1209
|
minItems: e.items.length,
|
|
1210
1210
|
maxItems: e.items.length,
|
|
1211
|
-
items: e.items.map((e, n) =>
|
|
1211
|
+
items: e.items.map((e, n) => K(e._def, {
|
|
1212
1212
|
...t,
|
|
1213
1213
|
currentPath: [
|
|
1214
1214
|
...t.currentPath,
|
|
@@ -1219,12 +1219,12 @@ function jr(e, t) {
|
|
|
1219
1219
|
};
|
|
1220
1220
|
}
|
|
1221
1221
|
function Mr() {
|
|
1222
|
-
return { not:
|
|
1222
|
+
return { not: H() };
|
|
1223
1223
|
}
|
|
1224
1224
|
function Nr() {
|
|
1225
|
-
return
|
|
1225
|
+
return H();
|
|
1226
1226
|
}
|
|
1227
|
-
var Pr = (e, t) =>
|
|
1227
|
+
var Pr = (e, t) => K(e.innerType._def, t), Fr = (e, t, n) => {
|
|
1228
1228
|
switch (t) {
|
|
1229
1229
|
case "ZodString": return lr(e, n);
|
|
1230
1230
|
case "ZodNumber": return Cr(e);
|
|
@@ -1252,7 +1252,7 @@ var Pr = (e, t) => G(e.innerType._def, t), Fr = (e, t, n) => {
|
|
|
1252
1252
|
case "ZodNaN":
|
|
1253
1253
|
case "ZodNever": return _r();
|
|
1254
1254
|
case "ZodEffects": return rr(e, n);
|
|
1255
|
-
case "ZodAny": return
|
|
1255
|
+
case "ZodAny": return H();
|
|
1256
1256
|
case "ZodUnknown": return Nr();
|
|
1257
1257
|
case "ZodDefault": return nr(e, n);
|
|
1258
1258
|
case "ZodBranded": return Qn(e, n);
|
|
@@ -1271,7 +1271,7 @@ var Pr = (e, t) => G(e.innerType._def, t), Fr = (e, t, n) => {
|
|
|
1271
1271
|
for (; n < e.length && n < t.length && e[n] === t[n]; n++);
|
|
1272
1272
|
return [(e.length - n).toString(), ...t.slice(n)].join("/");
|
|
1273
1273
|
};
|
|
1274
|
-
function
|
|
1274
|
+
function K(e, t, n = !1) {
|
|
1275
1275
|
let r = t.seen.get(e);
|
|
1276
1276
|
if (t.override) {
|
|
1277
1277
|
let i = t.override?.(e, t, r, n);
|
|
@@ -1287,7 +1287,7 @@ function G(e, t, n = !1) {
|
|
|
1287
1287
|
jsonSchema: void 0
|
|
1288
1288
|
};
|
|
1289
1289
|
t.seen.set(e, i);
|
|
1290
|
-
let a = Fr(e, e.typeName, t), o = typeof a == "function" ?
|
|
1290
|
+
let a = Fr(e, e.typeName, t), o = typeof a == "function" ? K(a(), t) : a;
|
|
1291
1291
|
if (o && Rr(e, t, o), t.postProcess) {
|
|
1292
1292
|
let n = t.postProcess(o, e, t);
|
|
1293
1293
|
return i.jsonSchema = o, n;
|
|
@@ -1299,7 +1299,7 @@ var Lr = (e, t) => {
|
|
|
1299
1299
|
case "root": return { $ref: e.path.join("/") };
|
|
1300
1300
|
case "relative": return { $ref: Ir(t.currentPath, e.path) };
|
|
1301
1301
|
case "none":
|
|
1302
|
-
case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),
|
|
1302
|
+
case "seen": return e.path.length < t.currentPath.length && e.path.every((e, n) => t.currentPath[n] === e) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), H()) : t.$refStrategy === "seen" ? H() : void 0;
|
|
1303
1303
|
}
|
|
1304
1304
|
}, Rr = (e, t, n) => (e.description && (n.description = e.description), n), zr = (e) => {
|
|
1305
1305
|
let t = Jn(e), n = t.name === void 0 ? t.basePath : [
|
|
@@ -1324,22 +1324,22 @@ var Lr = (e, t) => {
|
|
|
1324
1324
|
}, Br = (e, t) => {
|
|
1325
1325
|
let n = zr(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
|
|
1326
1326
|
...e,
|
|
1327
|
-
[t]:
|
|
1327
|
+
[t]: K(r._def, {
|
|
1328
1328
|
...n,
|
|
1329
1329
|
currentPath: [
|
|
1330
1330
|
...n.basePath,
|
|
1331
1331
|
n.definitionPath,
|
|
1332
1332
|
t
|
|
1333
1333
|
]
|
|
1334
|
-
}, !0) ??
|
|
1335
|
-
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a =
|
|
1334
|
+
}, !0) ?? H()
|
|
1335
|
+
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = K(e._def, i === void 0 ? n : {
|
|
1336
1336
|
...n,
|
|
1337
1337
|
currentPath: [
|
|
1338
1338
|
...n.basePath,
|
|
1339
1339
|
n.definitionPath,
|
|
1340
1340
|
i
|
|
1341
1341
|
]
|
|
1342
|
-
}, !1) ??
|
|
1342
|
+
}, !1) ?? H(), o = typeof t == "object" && t.name !== void 0 && t.nameStrategy === "title" ? t.name : void 0;
|
|
1343
1343
|
o !== void 0 && (a.title = o);
|
|
1344
1344
|
let s = i === void 0 ? r ? {
|
|
1345
1345
|
...a,
|
|
@@ -1521,7 +1521,7 @@ async function ni(e) {
|
|
|
1521
1521
|
new TextDecoder();
|
|
1522
1522
|
//#endregion
|
|
1523
1523
|
//#region ../node_modules/.pnpm/ai@7.0.145_zod@4.6.7/node_modules/ai/dist/index.js
|
|
1524
|
-
var ri = "AI_InvalidArgumentError", ii = `vercel.ai.error.${ri}`, ai = Symbol.for(ii), oi = class extends
|
|
1524
|
+
var ri = "AI_InvalidArgumentError", ii = `vercel.ai.error.${ri}`, ai = Symbol.for(ii), oi = class extends R {
|
|
1525
1525
|
constructor({ parameter: e, value: t, message: n }) {
|
|
1526
1526
|
super({
|
|
1527
1527
|
name: ri,
|
|
@@ -1529,9 +1529,9 @@ var ri = "AI_InvalidArgumentError", ii = `vercel.ai.error.${ri}`, ai = Symbol.fo
|
|
|
1529
1529
|
}), this[ai] = !0, this.parameter = e, this.value = t;
|
|
1530
1530
|
}
|
|
1531
1531
|
static isInstance(e) {
|
|
1532
|
-
return
|
|
1532
|
+
return R.hasMarker(e, ii);
|
|
1533
1533
|
}
|
|
1534
|
-
}, si = "AI_UIMessageStreamError", ci = `vercel.ai.error.${si}`, li = Symbol.for(ci),
|
|
1534
|
+
}, si = "AI_UIMessageStreamError", ci = `vercel.ai.error.${si}`, li = Symbol.for(ci), ui = class extends R {
|
|
1535
1535
|
constructor({ chunkType: e, chunkId: t, message: n }) {
|
|
1536
1536
|
super({
|
|
1537
1537
|
name: si,
|
|
@@ -1539,10 +1539,10 @@ var ri = "AI_InvalidArgumentError", ii = `vercel.ai.error.${ri}`, ai = Symbol.fo
|
|
|
1539
1539
|
}), this[li] = !0, this.chunkType = e, this.chunkId = t;
|
|
1540
1540
|
}
|
|
1541
1541
|
static isInstance(e) {
|
|
1542
|
-
return
|
|
1542
|
+
return R.hasMarker(e, ci);
|
|
1543
1543
|
}
|
|
1544
1544
|
};
|
|
1545
|
-
function
|
|
1545
|
+
function di(e, t) {
|
|
1546
1546
|
if (e === void 0 && t === void 0) return;
|
|
1547
1547
|
if (e === void 0) return t;
|
|
1548
1548
|
if (t === void 0) return e;
|
|
@@ -1551,7 +1551,7 @@ function ui(e, t) {
|
|
|
1551
1551
|
let i = t[r];
|
|
1552
1552
|
if (i === void 0) continue;
|
|
1553
1553
|
let a = r in e ? e[r] : void 0, o = typeof i == "object" && !!i && !Array.isArray(i) && !(i instanceof Date) && !(i instanceof RegExp), s = typeof a == "object" && !!a && !Array.isArray(a) && !(a instanceof Date) && !(a instanceof RegExp);
|
|
1554
|
-
n[r] = o && s ?
|
|
1554
|
+
n[r] = o && s ? di(a, i) : i;
|
|
1555
1555
|
}
|
|
1556
1556
|
return n;
|
|
1557
1557
|
}
|
|
@@ -1573,35 +1573,35 @@ var q = {
|
|
|
1573
1573
|
string: tt,
|
|
1574
1574
|
union: pt,
|
|
1575
1575
|
unknown: rt
|
|
1576
|
-
},
|
|
1576
|
+
}, fi = q.lazy(() => q.union([
|
|
1577
1577
|
q.null(),
|
|
1578
1578
|
q.string(),
|
|
1579
1579
|
q.number(),
|
|
1580
1580
|
q.boolean(),
|
|
1581
|
-
q.record(q.string(),
|
|
1582
|
-
q.array(
|
|
1583
|
-
])), J = q.record(q.string(), q.record(q.string(),
|
|
1581
|
+
q.record(q.string(), fi.optional()),
|
|
1582
|
+
q.array(fi)
|
|
1583
|
+
])), J = q.record(q.string(), q.record(q.string(), fi.optional())), pi = q.union([
|
|
1584
1584
|
q.string(),
|
|
1585
1585
|
q.instanceof(Uint8Array),
|
|
1586
1586
|
q.instanceof(ArrayBuffer),
|
|
1587
1587
|
q.custom(zn, { message: "Must be a Buffer" })
|
|
1588
|
-
]),
|
|
1588
|
+
]), mi = q.record(q.string(), q.string()), hi = q.object({
|
|
1589
1589
|
type: q.literal("text"),
|
|
1590
1590
|
text: q.string(),
|
|
1591
1591
|
providerOptions: J.optional()
|
|
1592
|
-
}),
|
|
1592
|
+
}), gi = q.object({
|
|
1593
1593
|
type: q.literal("image"),
|
|
1594
1594
|
image: q.union([
|
|
1595
|
-
|
|
1595
|
+
pi,
|
|
1596
1596
|
q.instanceof(URL),
|
|
1597
|
-
|
|
1597
|
+
mi
|
|
1598
1598
|
]),
|
|
1599
1599
|
mediaType: q.string().optional(),
|
|
1600
1600
|
providerOptions: J.optional()
|
|
1601
|
-
}),
|
|
1601
|
+
}), _i = q.discriminatedUnion("type", [
|
|
1602
1602
|
q.object({
|
|
1603
1603
|
type: q.literal("data"),
|
|
1604
|
-
data:
|
|
1604
|
+
data: pi
|
|
1605
1605
|
}),
|
|
1606
1606
|
q.object({
|
|
1607
1607
|
type: q.literal("url"),
|
|
@@ -1609,54 +1609,54 @@ var q = {
|
|
|
1609
1609
|
}),
|
|
1610
1610
|
q.object({
|
|
1611
1611
|
type: q.literal("reference"),
|
|
1612
|
-
reference:
|
|
1612
|
+
reference: mi
|
|
1613
1613
|
}),
|
|
1614
1614
|
q.object({
|
|
1615
1615
|
type: q.literal("text"),
|
|
1616
1616
|
text: q.string()
|
|
1617
1617
|
})
|
|
1618
|
-
]),
|
|
1618
|
+
]), vi = q.discriminatedUnion("type", [q.object({
|
|
1619
1619
|
type: q.literal("data"),
|
|
1620
|
-
data:
|
|
1620
|
+
data: pi
|
|
1621
1621
|
}), q.object({
|
|
1622
1622
|
type: q.literal("url"),
|
|
1623
1623
|
url: q.instanceof(URL)
|
|
1624
|
-
})]),
|
|
1624
|
+
})]), yi = q.object({
|
|
1625
1625
|
type: q.literal("file"),
|
|
1626
1626
|
data: q.union([
|
|
1627
|
-
|
|
1628
|
-
|
|
1627
|
+
_i,
|
|
1628
|
+
pi,
|
|
1629
1629
|
q.instanceof(URL),
|
|
1630
|
-
|
|
1630
|
+
mi
|
|
1631
1631
|
]),
|
|
1632
1632
|
filename: q.string().optional(),
|
|
1633
1633
|
mediaType: q.string(),
|
|
1634
1634
|
providerOptions: J.optional()
|
|
1635
|
-
}),
|
|
1635
|
+
}), bi = q.object({
|
|
1636
1636
|
type: q.literal("reasoning"),
|
|
1637
1637
|
text: q.string(),
|
|
1638
1638
|
providerOptions: J.optional()
|
|
1639
|
-
}),
|
|
1639
|
+
}), xi = q.object({
|
|
1640
1640
|
type: q.literal("custom"),
|
|
1641
1641
|
kind: q.string().transform((e) => e),
|
|
1642
1642
|
providerOptions: J.optional()
|
|
1643
|
-
}),
|
|
1643
|
+
}), Si = q.object({
|
|
1644
1644
|
type: q.literal("reasoning-file"),
|
|
1645
1645
|
data: q.union([
|
|
1646
|
-
|
|
1647
|
-
|
|
1646
|
+
vi,
|
|
1647
|
+
pi,
|
|
1648
1648
|
q.instanceof(URL)
|
|
1649
1649
|
]),
|
|
1650
1650
|
mediaType: q.string(),
|
|
1651
1651
|
providerOptions: J.optional()
|
|
1652
|
-
}),
|
|
1652
|
+
}), Ci = q.object({
|
|
1653
1653
|
type: q.literal("tool-call"),
|
|
1654
1654
|
toolCallId: q.string(),
|
|
1655
1655
|
toolName: q.string(),
|
|
1656
1656
|
input: q.unknown(),
|
|
1657
1657
|
providerOptions: J.optional(),
|
|
1658
1658
|
providerExecuted: q.boolean().optional()
|
|
1659
|
-
}),
|
|
1659
|
+
}), wi = q.discriminatedUnion("type", [
|
|
1660
1660
|
q.object({
|
|
1661
1661
|
type: q.literal("text"),
|
|
1662
1662
|
value: q.string(),
|
|
@@ -1664,7 +1664,7 @@ var q = {
|
|
|
1664
1664
|
}),
|
|
1665
1665
|
q.object({
|
|
1666
1666
|
type: q.literal("json"),
|
|
1667
|
-
value:
|
|
1667
|
+
value: fi,
|
|
1668
1668
|
providerOptions: J.optional()
|
|
1669
1669
|
}),
|
|
1670
1670
|
q.object({
|
|
@@ -1679,7 +1679,7 @@ var q = {
|
|
|
1679
1679
|
}),
|
|
1680
1680
|
q.object({
|
|
1681
1681
|
type: q.literal("error-json"),
|
|
1682
|
-
value:
|
|
1682
|
+
value: fi,
|
|
1683
1683
|
providerOptions: J.optional()
|
|
1684
1684
|
}),
|
|
1685
1685
|
q.object({
|
|
@@ -1692,7 +1692,7 @@ var q = {
|
|
|
1692
1692
|
}),
|
|
1693
1693
|
q.object({
|
|
1694
1694
|
type: q.literal("file"),
|
|
1695
|
-
data:
|
|
1695
|
+
data: _i,
|
|
1696
1696
|
mediaType: q.string(),
|
|
1697
1697
|
filename: q.string().optional(),
|
|
1698
1698
|
providerOptions: J.optional()
|
|
@@ -1747,13 +1747,13 @@ var q = {
|
|
|
1747
1747
|
})
|
|
1748
1748
|
]))
|
|
1749
1749
|
})
|
|
1750
|
-
]),
|
|
1750
|
+
]), Ti = q.object({
|
|
1751
1751
|
type: q.literal("tool-result"),
|
|
1752
1752
|
toolCallId: q.string(),
|
|
1753
1753
|
toolName: q.string(),
|
|
1754
|
-
output:
|
|
1754
|
+
output: wi,
|
|
1755
1755
|
providerOptions: J.optional()
|
|
1756
|
-
}),
|
|
1756
|
+
}), Ei = q.object({
|
|
1757
1757
|
type: q.literal("tool-approval-request"),
|
|
1758
1758
|
approvalId: q.string(),
|
|
1759
1759
|
toolCallId: q.string(),
|
|
@@ -1761,48 +1761,48 @@ var q = {
|
|
|
1761
1761
|
isAutomatic: q.boolean().optional(),
|
|
1762
1762
|
signature: q.string().optional(),
|
|
1763
1763
|
inputSchemaInput: q.unknown().optional()
|
|
1764
|
-
}),
|
|
1764
|
+
}), Di = q.object({
|
|
1765
1765
|
type: q.literal("tool-approval-response"),
|
|
1766
1766
|
approvalId: q.string(),
|
|
1767
1767
|
approved: q.boolean(),
|
|
1768
1768
|
reason: q.string().optional()
|
|
1769
|
-
}),
|
|
1769
|
+
}), Oi = q.object({
|
|
1770
1770
|
role: q.literal("system"),
|
|
1771
1771
|
content: q.string(),
|
|
1772
1772
|
providerOptions: J.optional()
|
|
1773
|
-
}),
|
|
1773
|
+
}), ki = q.object({
|
|
1774
1774
|
role: q.literal("user"),
|
|
1775
1775
|
content: q.union([q.string(), q.array(q.union([
|
|
1776
|
-
mi,
|
|
1777
1776
|
hi,
|
|
1778
|
-
|
|
1777
|
+
gi,
|
|
1778
|
+
yi
|
|
1779
1779
|
]))]),
|
|
1780
1780
|
providerOptions: J.optional()
|
|
1781
|
-
}),
|
|
1781
|
+
}), Ai = q.object({
|
|
1782
1782
|
role: q.literal("assistant"),
|
|
1783
1783
|
content: q.union([q.string(), q.array(q.union([
|
|
1784
|
-
|
|
1785
|
-
bi,
|
|
1786
|
-
vi,
|
|
1787
|
-
yi,
|
|
1784
|
+
hi,
|
|
1788
1785
|
xi,
|
|
1786
|
+
yi,
|
|
1787
|
+
bi,
|
|
1789
1788
|
Si,
|
|
1790
|
-
|
|
1791
|
-
Ti
|
|
1789
|
+
Ci,
|
|
1790
|
+
Ti,
|
|
1791
|
+
Ei
|
|
1792
1792
|
]))]),
|
|
1793
1793
|
providerOptions: J.optional()
|
|
1794
|
-
}),
|
|
1794
|
+
}), ji = q.object({
|
|
1795
1795
|
role: q.literal("tool"),
|
|
1796
|
-
content: q.array(q.union([
|
|
1796
|
+
content: q.array(q.union([Ti, Di])),
|
|
1797
1797
|
providerOptions: J.optional()
|
|
1798
1798
|
});
|
|
1799
1799
|
q.union([
|
|
1800
|
-
Di,
|
|
1801
1800
|
Oi,
|
|
1802
1801
|
ki,
|
|
1803
|
-
Ai
|
|
1802
|
+
Ai,
|
|
1803
|
+
ji
|
|
1804
1804
|
]);
|
|
1805
|
-
function
|
|
1805
|
+
function Mi(e) {
|
|
1806
1806
|
let t = ["ROOT"], n = -1, r = null, i = 0;
|
|
1807
1807
|
function a(e) {
|
|
1808
1808
|
return e >= "0" && e <= "9" || e >= "A" && e <= "F" || e >= "a" && e <= "f";
|
|
@@ -1984,7 +1984,7 @@ function ji(e) {
|
|
|
1984
1984
|
}
|
|
1985
1985
|
return l;
|
|
1986
1986
|
}
|
|
1987
|
-
async function
|
|
1987
|
+
async function Ni(e) {
|
|
1988
1988
|
if (e === void 0) return {
|
|
1989
1989
|
value: void 0,
|
|
1990
1990
|
state: "undefined-input"
|
|
@@ -1993,7 +1993,7 @@ async function Mi(e) {
|
|
|
1993
1993
|
return t.success ? {
|
|
1994
1994
|
value: t.value,
|
|
1995
1995
|
state: "successful-parse"
|
|
1996
|
-
} : (t = await ei({ text:
|
|
1996
|
+
} : (t = await ei({ text: Mi(e) }), t.success ? {
|
|
1997
1997
|
value: t.value,
|
|
1998
1998
|
state: "repaired-parse"
|
|
1999
1999
|
} : {
|
|
@@ -2001,32 +2001,32 @@ async function Mi(e) {
|
|
|
2001
2001
|
state: "failed-parse"
|
|
2002
2002
|
});
|
|
2003
2003
|
}
|
|
2004
|
-
new TextEncoder(), new TextEncoder(),
|
|
2004
|
+
new TextEncoder(), new TextEncoder(), B({
|
|
2005
2005
|
prefix: "aitxt",
|
|
2006
2006
|
size: 24
|
|
2007
|
-
}),
|
|
2007
|
+
}), B({
|
|
2008
2008
|
prefix: "call",
|
|
2009
2009
|
size: 24
|
|
2010
2010
|
});
|
|
2011
|
-
function
|
|
2011
|
+
function Pi(e, t) {
|
|
2012
2012
|
let n = new Headers(e ?? {});
|
|
2013
2013
|
for (let [e, r] of Object.entries(t)) n.has(e) || n.set(e, r);
|
|
2014
2014
|
return n;
|
|
2015
2015
|
}
|
|
2016
|
-
var
|
|
2017
|
-
function
|
|
2016
|
+
var Fi = ": stream-open\n\n", Ii = ": keep-alive\n\n";
|
|
2017
|
+
function Li({ stream: e, keepAliveMs: t }) {
|
|
2018
2018
|
if (t == null) return e;
|
|
2019
2019
|
if (!Number.isFinite(t) || t <= 0 || t > 2147483647) throw Error("keepAliveMs must be a positive finite timer duration no greater than 2147483647");
|
|
2020
2020
|
let n = e.getReader(), r, i = !1, a = () => {
|
|
2021
2021
|
clearTimeout(r), r = void 0;
|
|
2022
2022
|
}, o = (e) => {
|
|
2023
2023
|
a(), r = setTimeout(() => {
|
|
2024
|
-
i || (e.desiredSize != null && e.desiredSize > 0 && e.enqueue(
|
|
2024
|
+
i || (e.desiredSize != null && e.desiredSize > 0 && e.enqueue(Ii), o(e));
|
|
2025
2025
|
}, t);
|
|
2026
2026
|
};
|
|
2027
2027
|
return new ReadableStream({
|
|
2028
2028
|
start(e) {
|
|
2029
|
-
e.enqueue(
|
|
2029
|
+
e.enqueue(Fi), o(e);
|
|
2030
2030
|
},
|
|
2031
2031
|
pull(e) {
|
|
2032
2032
|
return n.read().then((t) => {
|
|
@@ -2040,7 +2040,7 @@ function Ii({ stream: e, keepAliveMs: t }) {
|
|
|
2040
2040
|
}
|
|
2041
2041
|
});
|
|
2042
2042
|
}
|
|
2043
|
-
var
|
|
2043
|
+
var Ri = class extends TransformStream {
|
|
2044
2044
|
constructor() {
|
|
2045
2045
|
super({
|
|
2046
2046
|
transform(e, t) {
|
|
@@ -2051,16 +2051,16 @@ var Li = class extends TransformStream {
|
|
|
2051
2051
|
}
|
|
2052
2052
|
});
|
|
2053
2053
|
}
|
|
2054
|
-
},
|
|
2054
|
+
}, zi = {
|
|
2055
2055
|
"content-type": "text/event-stream",
|
|
2056
2056
|
"cache-control": "no-cache",
|
|
2057
2057
|
connection: "keep-alive",
|
|
2058
2058
|
"x-vercel-ai-ui-message-stream": "v1",
|
|
2059
2059
|
"x-accel-buffering": "no"
|
|
2060
2060
|
};
|
|
2061
|
-
function
|
|
2062
|
-
let o =
|
|
2063
|
-
stream: r.pipeThrough(new
|
|
2061
|
+
function Bi({ status: e, statusText: t, headers: n, stream: r, keepAliveMs: i, consumeSseStream: a }) {
|
|
2062
|
+
let o = Li({
|
|
2063
|
+
stream: r.pipeThrough(new Ri()),
|
|
2064
2064
|
keepAliveMs: i
|
|
2065
2065
|
});
|
|
2066
2066
|
if (a) {
|
|
@@ -2070,10 +2070,10 @@ function zi({ status: e, statusText: t, headers: n, stream: r, keepAliveMs: i, c
|
|
|
2070
2070
|
return new Response(o.pipeThrough(new TextEncoderStream()), {
|
|
2071
2071
|
status: e,
|
|
2072
2072
|
statusText: t,
|
|
2073
|
-
headers:
|
|
2073
|
+
headers: Pi(n, zi)
|
|
2074
2074
|
});
|
|
2075
2075
|
}
|
|
2076
|
-
var
|
|
2076
|
+
var Vi = q.object({
|
|
2077
2077
|
source: q.discriminatedUnion("sourceType", [q.object({
|
|
2078
2078
|
type: q.literal("source"),
|
|
2079
2079
|
sourceType: q.literal("url"),
|
|
@@ -2093,7 +2093,7 @@ var Bi = q.object({
|
|
|
2093
2093
|
startIndex: q.number().int().nonnegative().optional(),
|
|
2094
2094
|
endIndex: q.number().int().nonnegative().optional(),
|
|
2095
2095
|
citedText: q.string().optional()
|
|
2096
|
-
}),
|
|
2096
|
+
}), Hi = q.record(q.string(), fi.optional()), Ui = Hr(() => Zr(q.union([
|
|
2097
2097
|
q.looseObject({
|
|
2098
2098
|
type: q.literal("text-start"),
|
|
2099
2099
|
id: q.string(),
|
|
@@ -2108,7 +2108,7 @@ var Bi = q.object({
|
|
|
2108
2108
|
q.looseObject({
|
|
2109
2109
|
type: q.literal("text-end"),
|
|
2110
2110
|
id: q.string(),
|
|
2111
|
-
citations: q.array(
|
|
2111
|
+
citations: q.array(Vi).optional(),
|
|
2112
2112
|
providerMetadata: J.optional()
|
|
2113
2113
|
}),
|
|
2114
2114
|
q.looseObject({
|
|
@@ -2122,7 +2122,7 @@ var Bi = q.object({
|
|
|
2122
2122
|
inputEncoding: q.enum(["json", "text"]).optional(),
|
|
2123
2123
|
providerExecuted: q.boolean().optional(),
|
|
2124
2124
|
providerMetadata: J.optional(),
|
|
2125
|
-
toolMetadata:
|
|
2125
|
+
toolMetadata: Hi.optional(),
|
|
2126
2126
|
dynamic: q.boolean().optional(),
|
|
2127
2127
|
title: q.string().optional()
|
|
2128
2128
|
}),
|
|
@@ -2138,7 +2138,7 @@ var Bi = q.object({
|
|
|
2138
2138
|
input: q.unknown(),
|
|
2139
2139
|
providerExecuted: q.boolean().optional(),
|
|
2140
2140
|
providerMetadata: J.optional(),
|
|
2141
|
-
toolMetadata:
|
|
2141
|
+
toolMetadata: Hi.optional(),
|
|
2142
2142
|
dynamic: q.boolean().optional(),
|
|
2143
2143
|
title: q.string().optional()
|
|
2144
2144
|
}),
|
|
@@ -2149,7 +2149,7 @@ var Bi = q.object({
|
|
|
2149
2149
|
input: q.unknown(),
|
|
2150
2150
|
providerExecuted: q.boolean().optional(),
|
|
2151
2151
|
providerMetadata: J.optional(),
|
|
2152
|
-
toolMetadata:
|
|
2152
|
+
toolMetadata: Hi.optional(),
|
|
2153
2153
|
dynamic: q.boolean().optional(),
|
|
2154
2154
|
errorText: q.string(),
|
|
2155
2155
|
title: q.string().optional()
|
|
@@ -2178,7 +2178,7 @@ var Bi = q.object({
|
|
|
2178
2178
|
output: q.unknown(),
|
|
2179
2179
|
providerExecuted: q.boolean().optional(),
|
|
2180
2180
|
providerMetadata: J.optional(),
|
|
2181
|
-
toolMetadata:
|
|
2181
|
+
toolMetadata: Hi.optional(),
|
|
2182
2182
|
dynamic: q.boolean().optional(),
|
|
2183
2183
|
preliminary: q.boolean().optional()
|
|
2184
2184
|
}),
|
|
@@ -2188,7 +2188,7 @@ var Bi = q.object({
|
|
|
2188
2188
|
errorText: q.string(),
|
|
2189
2189
|
providerExecuted: q.boolean().optional(),
|
|
2190
2190
|
providerMetadata: J.optional(),
|
|
2191
|
-
toolMetadata:
|
|
2191
|
+
toolMetadata: Hi.optional(),
|
|
2192
2192
|
dynamic: q.boolean().optional()
|
|
2193
2193
|
}),
|
|
2194
2194
|
q.looseObject({
|
|
@@ -2278,39 +2278,39 @@ var Bi = q.object({
|
|
|
2278
2278
|
messageMetadata: q.unknown()
|
|
2279
2279
|
})
|
|
2280
2280
|
])));
|
|
2281
|
-
function
|
|
2281
|
+
function Wi(e) {
|
|
2282
2282
|
return e.type.startsWith("data-");
|
|
2283
2283
|
}
|
|
2284
|
-
function
|
|
2284
|
+
function Gi() {
|
|
2285
2285
|
return Object.create(null);
|
|
2286
2286
|
}
|
|
2287
|
-
function
|
|
2287
|
+
function Ki(e) {
|
|
2288
2288
|
return e.type.startsWith("tool-");
|
|
2289
2289
|
}
|
|
2290
|
-
function
|
|
2290
|
+
function qi(e) {
|
|
2291
2291
|
return e.type === "dynamic-tool";
|
|
2292
2292
|
}
|
|
2293
2293
|
function Y(e) {
|
|
2294
|
-
return
|
|
2294
|
+
return Ki(e) || qi(e);
|
|
2295
2295
|
}
|
|
2296
|
-
function
|
|
2296
|
+
function Ji(e) {
|
|
2297
2297
|
return e.type.split("-").slice(1).join("-");
|
|
2298
2298
|
}
|
|
2299
|
-
function
|
|
2299
|
+
function Yi({ lastMessage: e, messageId: t }) {
|
|
2300
2300
|
let n = e?.role === "assistant" ? e : {
|
|
2301
2301
|
id: t,
|
|
2302
2302
|
metadata: void 0,
|
|
2303
2303
|
role: "assistant",
|
|
2304
2304
|
parts: []
|
|
2305
|
-
}, r =
|
|
2305
|
+
}, r = Gi(), i = n.parts.findLastIndex((e) => e.type === "step-start"), a = 0;
|
|
2306
2306
|
for (let e of n.parts.slice(i + 1)) {
|
|
2307
2307
|
if (!Y(e)) continue;
|
|
2308
2308
|
let t = a;
|
|
2309
|
-
|
|
2309
|
+
Ki(e) && a++, e.state === "input-streaming" && (r[e.toolCallId] = {
|
|
2310
2310
|
text: e.rawInput ?? "",
|
|
2311
2311
|
inputEncoding: e.inputEncoding,
|
|
2312
2312
|
index: t,
|
|
2313
|
-
toolName: e.type === "dynamic-tool" ? e.toolName :
|
|
2313
|
+
toolName: e.type === "dynamic-tool" ? e.toolName : Ji(e),
|
|
2314
2314
|
dynamic: e.type === "dynamic-tool",
|
|
2315
2315
|
title: e.title,
|
|
2316
2316
|
toolMetadata: e.toolMetadata
|
|
@@ -2318,12 +2318,12 @@ function Ji({ lastMessage: e, messageId: t }) {
|
|
|
2318
2318
|
}
|
|
2319
2319
|
return {
|
|
2320
2320
|
message: n,
|
|
2321
|
-
activeTextParts:
|
|
2322
|
-
activeReasoningParts:
|
|
2321
|
+
activeTextParts: Gi(),
|
|
2322
|
+
activeReasoningParts: Gi(),
|
|
2323
2323
|
partialToolCalls: r
|
|
2324
2324
|
};
|
|
2325
2325
|
}
|
|
2326
|
-
function
|
|
2326
|
+
function Xi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o, resetStateOnMessageIdChange: s = !1, resetStateOnFirstMessageStart: c = !1 }) {
|
|
2327
2327
|
let l = !0;
|
|
2328
2328
|
return e.pipeThrough(new TransformStream({ async transform(e, u) {
|
|
2329
2329
|
await r(async ({ state: r, write: d }) => {
|
|
@@ -2347,7 +2347,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2347
2347
|
}
|
|
2348
2348
|
}
|
|
2349
2349
|
}
|
|
2350
|
-
if (t == null) throw new
|
|
2350
|
+
if (t == null) throw new ui({
|
|
2351
2351
|
chunkType: "tool-invocation",
|
|
2352
2352
|
chunkId: e,
|
|
2353
2353
|
message: `No tool invocation found for tool call ID "${e}".`
|
|
@@ -2356,7 +2356,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2356
2356
|
}
|
|
2357
2357
|
function h(e) {
|
|
2358
2358
|
let t = r.message.parts.filter(Y).find((t) => t.approval?.id === e);
|
|
2359
|
-
if (t == null) throw new
|
|
2359
|
+
if (t == null) throw new ui({
|
|
2360
2360
|
chunkType: "tool-approval-response",
|
|
2361
2361
|
chunkId: e,
|
|
2362
2362
|
message: `No tool invocation found for approval ID "${e}".`
|
|
@@ -2364,7 +2364,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2364
2364
|
return t;
|
|
2365
2365
|
}
|
|
2366
2366
|
function g(e, t) {
|
|
2367
|
-
let n = t ?? f().find((t) =>
|
|
2367
|
+
let n = t ?? f().find((t) => Ki(t) && t.toolCallId === e.toolCallId), i = e, a = n;
|
|
2368
2368
|
if (n != null) {
|
|
2369
2369
|
n.state = e.state, a.input = i.input, a.output = i.output, a.errorText = i.errorText, a.rawInput = i.rawInput, i.inputEncoding == null ? delete a.inputEncoding : a.inputEncoding = i.inputEncoding, a.preliminary = i.preliminary, e.title !== void 0 && (a.title = e.title), e.toolMetadata !== void 0 && (a.toolMetadata = e.toolMetadata), a.providerExecuted = i.providerExecuted ?? n.providerExecuted;
|
|
2370
2370
|
let t = i.providerMetadata;
|
|
@@ -2421,7 +2421,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2421
2421
|
}
|
|
2422
2422
|
async function v(e) {
|
|
2423
2423
|
if (e != null) {
|
|
2424
|
-
let n = r.message.metadata == null ? e :
|
|
2424
|
+
let n = r.message.metadata == null ? e : di(r.message.metadata, e);
|
|
2425
2425
|
t != null && await Qr({
|
|
2426
2426
|
value: n,
|
|
2427
2427
|
schema: t,
|
|
@@ -2445,7 +2445,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2445
2445
|
}
|
|
2446
2446
|
case "text-delta": {
|
|
2447
2447
|
let t = r.activeTextParts[e.id];
|
|
2448
|
-
if (t == null) throw new
|
|
2448
|
+
if (t == null) throw new ui({
|
|
2449
2449
|
chunkType: "text-delta",
|
|
2450
2450
|
chunkId: e.id,
|
|
2451
2451
|
message: `Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
|
|
@@ -2455,7 +2455,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2455
2455
|
}
|
|
2456
2456
|
case "text-end": {
|
|
2457
2457
|
let t = r.activeTextParts[e.id];
|
|
2458
|
-
if (t == null) throw new
|
|
2458
|
+
if (t == null) throw new ui({
|
|
2459
2459
|
chunkType: "text-end",
|
|
2460
2460
|
chunkId: e.id,
|
|
2461
2461
|
message: `Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
|
|
@@ -2485,7 +2485,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2485
2485
|
}
|
|
2486
2486
|
case "reasoning-delta": {
|
|
2487
2487
|
let t = r.activeReasoningParts[e.id];
|
|
2488
|
-
if (t == null) throw new
|
|
2488
|
+
if (t == null) throw new ui({
|
|
2489
2489
|
chunkType: "reasoning-delta",
|
|
2490
2490
|
chunkId: e.id,
|
|
2491
2491
|
message: `Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
|
|
@@ -2495,7 +2495,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2495
2495
|
}
|
|
2496
2496
|
case "reasoning-end": {
|
|
2497
2497
|
let t = r.activeReasoningParts[e.id];
|
|
2498
|
-
if (t == null) throw new
|
|
2498
|
+
if (t == null) throw new ui({
|
|
2499
2499
|
chunkType: "reasoning-end",
|
|
2500
2500
|
chunkId: e.id,
|
|
2501
2501
|
message: `Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
|
|
@@ -2532,7 +2532,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2532
2532
|
}), d();
|
|
2533
2533
|
break;
|
|
2534
2534
|
case "tool-input-start": {
|
|
2535
|
-
let t = f().filter(
|
|
2535
|
+
let t = f().filter(Ki);
|
|
2536
2536
|
r.partialToolCalls[e.toolCallId] = {
|
|
2537
2537
|
text: "",
|
|
2538
2538
|
inputEncoding: e.inputEncoding,
|
|
@@ -2566,13 +2566,13 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2566
2566
|
}
|
|
2567
2567
|
case "tool-input-delta": {
|
|
2568
2568
|
let t = r.partialToolCalls[e.toolCallId];
|
|
2569
|
-
if (t == null) throw new
|
|
2569
|
+
if (t == null) throw new ui({
|
|
2570
2570
|
chunkType: "tool-input-delta",
|
|
2571
2571
|
chunkId: e.toolCallId,
|
|
2572
2572
|
message: `Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`
|
|
2573
2573
|
});
|
|
2574
2574
|
t.text += e.inputTextDelta;
|
|
2575
|
-
let n = t.inputEncoding === "text" ? t.text : (await
|
|
2575
|
+
let n = t.inputEncoding === "text" ? t.text : (await Ni(t.text)).value;
|
|
2576
2576
|
t.dynamic ? _({
|
|
2577
2577
|
toolCallId: e.toolCallId,
|
|
2578
2578
|
toolName: t.toolName,
|
|
@@ -2680,7 +2680,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2680
2680
|
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2681
2681
|
}, t) : g({
|
|
2682
2682
|
toolCallId: e.toolCallId,
|
|
2683
|
-
toolName:
|
|
2683
|
+
toolName: Ji(t),
|
|
2684
2684
|
state: "output-available",
|
|
2685
2685
|
input: t.input,
|
|
2686
2686
|
output: e.output,
|
|
@@ -2706,7 +2706,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2706
2706
|
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2707
2707
|
}, t) : g({
|
|
2708
2708
|
toolCallId: e.toolCallId,
|
|
2709
|
-
toolName:
|
|
2709
|
+
toolName: Ji(t),
|
|
2710
2710
|
state: "output-error",
|
|
2711
2711
|
input: t.input,
|
|
2712
2712
|
rawInput: t.rawInput,
|
|
@@ -2724,12 +2724,12 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2724
2724
|
case "finish-step": break;
|
|
2725
2725
|
case "reset-step": {
|
|
2726
2726
|
let e = f();
|
|
2727
|
-
r.activeTextParts =
|
|
2727
|
+
r.activeTextParts = Gi(), r.activeReasoningParts = Gi(), r.partialToolCalls = Gi(), e.length > 0 && (r.message.parts.splice(r.message.parts.length - e.length, e.length), d());
|
|
2728
2728
|
break;
|
|
2729
2729
|
}
|
|
2730
2730
|
case "start": {
|
|
2731
2731
|
let t = c && l || s && e.messageId != null && e.messageId !== r.message.id;
|
|
2732
|
-
l = !1, t && Object.assign(r,
|
|
2732
|
+
l = !1, t && Object.assign(r, Yi({
|
|
2733
2733
|
lastMessage: void 0,
|
|
2734
2734
|
messageId: e.messageId ?? r.message.id
|
|
2735
2735
|
}), { finishReason: void 0 }), e.messageId != null && (r.message.id = e.messageId), await v(e.messageMetadata), (t || e.messageId != null || e.messageMetadata != null) && d({ updateStatus: !1 });
|
|
@@ -2744,7 +2744,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2744
2744
|
case "error":
|
|
2745
2745
|
i?.(Error(e.errorText));
|
|
2746
2746
|
break;
|
|
2747
|
-
default: if (
|
|
2747
|
+
default: if (Wi(e)) {
|
|
2748
2748
|
if (n?.[e.type] != null) {
|
|
2749
2749
|
let t = r.message.parts.findIndex((t) => "id" in t && "data" in t && t.id === e.id && t.type === e.type), i = t >= 0 ? t : r.message.parts.length;
|
|
2750
2750
|
await Qr({
|
|
@@ -2770,7 +2770,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2770
2770
|
});
|
|
2771
2771
|
} }));
|
|
2772
2772
|
}
|
|
2773
|
-
async function
|
|
2773
|
+
async function Zi({ stream: e, onError: t, abortSignal: n }) {
|
|
2774
2774
|
let r = e.getReader(), i = () => {
|
|
2775
2775
|
r.cancel().catch(() => {});
|
|
2776
2776
|
};
|
|
@@ -2786,7 +2786,7 @@ async function Xi({ stream: e, onError: t, abortSignal: n }) {
|
|
|
2786
2786
|
n?.removeEventListener("abort", i), r.releaseLock();
|
|
2787
2787
|
}
|
|
2788
2788
|
}
|
|
2789
|
-
function
|
|
2789
|
+
function Qi() {
|
|
2790
2790
|
let e, t;
|
|
2791
2791
|
return {
|
|
2792
2792
|
promise: new Promise((n, r) => {
|
|
@@ -2796,32 +2796,32 @@ function Zi() {
|
|
|
2796
2796
|
reject: t
|
|
2797
2797
|
};
|
|
2798
2798
|
}
|
|
2799
|
-
|
|
2799
|
+
B({
|
|
2800
2800
|
prefix: "aitxt",
|
|
2801
2801
|
size: 24
|
|
2802
|
-
}),
|
|
2802
|
+
}), B({
|
|
2803
2803
|
prefix: "call",
|
|
2804
2804
|
size: 24
|
|
2805
|
-
}),
|
|
2805
|
+
}), B({
|
|
2806
2806
|
prefix: "aitxt",
|
|
2807
2807
|
size: 24
|
|
2808
|
-
}),
|
|
2808
|
+
}), B({
|
|
2809
2809
|
prefix: "call",
|
|
2810
2810
|
size: 24
|
|
2811
|
-
}), q.record(q.string(),
|
|
2811
|
+
}), q.record(q.string(), fi.optional()), q.record(q.string(), q.string()), B({
|
|
2812
2812
|
prefix: "call",
|
|
2813
2813
|
size: 24
|
|
2814
|
-
}),
|
|
2814
|
+
}), B({
|
|
2815
2815
|
prefix: "call",
|
|
2816
2816
|
size: 24
|
|
2817
|
-
}), new TextEncoder(),
|
|
2817
|
+
}), new TextEncoder(), B({
|
|
2818
2818
|
prefix: "call",
|
|
2819
2819
|
size: 24
|
|
2820
|
-
}),
|
|
2820
|
+
}), B({
|
|
2821
2821
|
prefix: "aiobj",
|
|
2822
2822
|
size: 24
|
|
2823
2823
|
});
|
|
2824
|
-
var { atob:
|
|
2824
|
+
var { atob: $i } = globalThis, ea = class {
|
|
2825
2825
|
constructor() {
|
|
2826
2826
|
this.queue = [], this.isProcessing = !1, this.idleWaiters = [];
|
|
2827
2827
|
}
|
|
@@ -2853,10 +2853,10 @@ var { atob: Qi } = globalThis, $i = class {
|
|
|
2853
2853
|
});
|
|
2854
2854
|
}
|
|
2855
2855
|
};
|
|
2856
|
-
|
|
2856
|
+
B({
|
|
2857
2857
|
prefix: "aiobj",
|
|
2858
2858
|
size: 24
|
|
2859
|
-
}),
|
|
2859
|
+
}), B({
|
|
2860
2860
|
prefix: "call",
|
|
2861
2861
|
size: 24
|
|
2862
2862
|
}), q.object({
|
|
@@ -2876,17 +2876,17 @@ z({
|
|
|
2876
2876
|
description: q.string().optional(),
|
|
2877
2877
|
parameters: q.record(q.string(), q.unknown())
|
|
2878
2878
|
})).optional()
|
|
2879
|
-
}),
|
|
2879
|
+
}), B({
|
|
2880
2880
|
prefix: "call",
|
|
2881
2881
|
size: 24
|
|
2882
|
-
}),
|
|
2882
|
+
}), B({
|
|
2883
2883
|
prefix: "call",
|
|
2884
2884
|
size: 24
|
|
2885
|
-
}),
|
|
2885
|
+
}), B({
|
|
2886
2886
|
prefix: "call",
|
|
2887
2887
|
size: 24
|
|
2888
2888
|
});
|
|
2889
|
-
async function
|
|
2889
|
+
async function ta({ response: e, url: t, fallbackMessage: n }) {
|
|
2890
2890
|
let r = await e.text();
|
|
2891
2891
|
return new an({
|
|
2892
2892
|
message: r || n,
|
|
@@ -2896,7 +2896,7 @@ async function ea({ response: e, url: t, fallbackMessage: n }) {
|
|
|
2896
2896
|
responseBody: r
|
|
2897
2897
|
});
|
|
2898
2898
|
}
|
|
2899
|
-
async function
|
|
2899
|
+
async function na(e) {
|
|
2900
2900
|
if (e == null) return [];
|
|
2901
2901
|
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new En({
|
|
2902
2902
|
functionality: "FileList",
|
|
@@ -2917,11 +2917,11 @@ async function ta(e) {
|
|
|
2917
2917
|
};
|
|
2918
2918
|
}));
|
|
2919
2919
|
}
|
|
2920
|
-
function
|
|
2920
|
+
function ra(e, t) {
|
|
2921
2921
|
let n = e.search(/[?#]/), r = n === -1 ? e : e.slice(0, n), i = n === -1 ? "" : e.slice(n);
|
|
2922
2922
|
return `${r.endsWith("/") && t.startsWith("/") ? r.slice(0, -1) : r}${t}${i}`;
|
|
2923
2923
|
}
|
|
2924
|
-
var
|
|
2924
|
+
var ia = class {
|
|
2925
2925
|
constructor({ api: e = "/api/chat", credentials: t, headers: n, body: r, fetch: i, prepareSendMessagesRequest: a, prepareReconnectToStreamRequest: o }) {
|
|
2926
2926
|
this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
|
|
2927
2927
|
}
|
|
@@ -2959,7 +2959,7 @@ var ra = class {
|
|
|
2959
2959
|
credentials: u,
|
|
2960
2960
|
signal: e
|
|
2961
2961
|
});
|
|
2962
|
-
if (!d.ok) throw await
|
|
2962
|
+
if (!d.ok) throw await ta({
|
|
2963
2963
|
response: d,
|
|
2964
2964
|
url: s,
|
|
2965
2965
|
fallbackMessage: "Failed to fetch the chat response."
|
|
@@ -2988,7 +2988,7 @@ var ra = class {
|
|
|
2988
2988
|
value: e.chatId,
|
|
2989
2989
|
message: "Chat IDs must not be \".\" or \"..\" when using the default reconnect URL."
|
|
2990
2990
|
});
|
|
2991
|
-
o =
|
|
2991
|
+
o = ra(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
|
|
2992
2992
|
}
|
|
2993
2993
|
let s = a?.headers === void 0 ? i : Ln(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
|
|
2994
2994
|
method: "GET",
|
|
@@ -2997,7 +2997,7 @@ var ra = class {
|
|
|
2997
2997
|
signal: e.abortSignal
|
|
2998
2998
|
});
|
|
2999
2999
|
if (l.status === 204) return null;
|
|
3000
|
-
if (!l.ok) throw await
|
|
3000
|
+
if (!l.ok) throw await ta({
|
|
3001
3001
|
response: l,
|
|
3002
3002
|
url: o,
|
|
3003
3003
|
fallbackMessage: "Failed to fetch the chat response."
|
|
@@ -3005,25 +3005,25 @@ var ra = class {
|
|
|
3005
3005
|
if (!l.body) throw new ln({ message: "The response body is empty." });
|
|
3006
3006
|
return this.processResponseStream(l.body);
|
|
3007
3007
|
}
|
|
3008
|
-
},
|
|
3008
|
+
}, aa = class extends ia {
|
|
3009
3009
|
constructor({ resumeStreamIsReplay: e = !0, ...t } = {}) {
|
|
3010
3010
|
super(t), this.resumeStreamIsReplay = e;
|
|
3011
3011
|
}
|
|
3012
3012
|
processResponseStream(e) {
|
|
3013
3013
|
return ti({
|
|
3014
3014
|
stream: e,
|
|
3015
|
-
schema:
|
|
3015
|
+
schema: Ui
|
|
3016
3016
|
}).pipeThrough(new TransformStream({ async transform(e, t) {
|
|
3017
3017
|
if (!e.success) throw e.error;
|
|
3018
3018
|
t.enqueue(e.value);
|
|
3019
3019
|
} }));
|
|
3020
3020
|
}
|
|
3021
|
-
},
|
|
3021
|
+
}, oa = class {
|
|
3022
3022
|
get id() {
|
|
3023
3023
|
return this._id ??= this.generateId();
|
|
3024
3024
|
}
|
|
3025
|
-
constructor({ generateId: e = Rn, id: t, transport: n = new
|
|
3026
|
-
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new
|
|
3025
|
+
constructor({ generateId: e = Rn, id: t, transport: n = new aa(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
|
|
3026
|
+
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new ea(), this.activeStopCount = 0, this.stopGeneration = 0, this.sendMessage = async (e, t) => {
|
|
3027
3027
|
if (e == null) {
|
|
3028
3028
|
let e = this.pendingApprovalMessageId;
|
|
3029
3029
|
if (e == null) {
|
|
@@ -3050,7 +3050,7 @@ var ra = class {
|
|
|
3050
3050
|
this.pendingMessagePreparations.add(t);
|
|
3051
3051
|
let r;
|
|
3052
3052
|
try {
|
|
3053
|
-
r = Array.isArray(e.files) ? e.files : await
|
|
3053
|
+
r = Array.isArray(e.files) ? e.files : await na(e.files);
|
|
3054
3054
|
} finally {
|
|
3055
3055
|
this.pendingMessagePreparations.delete(t);
|
|
3056
3056
|
}
|
|
@@ -3227,7 +3227,7 @@ var ra = class {
|
|
|
3227
3227
|
}), r && this.status === "error" && this.pendingApprovalMessageId == null && (this.pendingApprovalMessageId = this.state.messages[t]?.id ?? e);
|
|
3228
3228
|
}
|
|
3229
3229
|
async makeRequest(e) {
|
|
3230
|
-
let t =
|
|
3230
|
+
let t = Qi();
|
|
3231
3231
|
try {
|
|
3232
3232
|
await this.makeRequestImpl({
|
|
3233
3233
|
...e,
|
|
@@ -3283,7 +3283,7 @@ var ra = class {
|
|
|
3283
3283
|
let d = this.lastMessage, f = e === "submit-message" && i != null ? this.state.messages.findIndex((e) => e.id === i) : this.state.messages.length - 1, p = f === -1 ? d : this.state.messages[f], m = p?.id, h = e === "resume-stream" && p?.role === "assistant" && p.parts.some((e) => Y(e) && (e.state === "input-streaming" || e.state === "input-available" && e.providerExecuted || e.state === "approval-responded")) ? this.state.snapshot(p) : void 0, g = f !== -1 && f < this.state.messages.length - 1 && p?.role === "assistant", _ = !1, v = !1, y = !1, b;
|
|
3284
3284
|
try {
|
|
3285
3285
|
let s = {
|
|
3286
|
-
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState :
|
|
3286
|
+
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : Yi({
|
|
3287
3287
|
lastMessage: e === "resume-stream" ? h : e === "regenerate-message" ? void 0 : this.state.snapshot(p),
|
|
3288
3288
|
messageId: this.generateId()
|
|
3289
3289
|
}),
|
|
@@ -3303,8 +3303,8 @@ var ra = class {
|
|
|
3303
3303
|
body: r,
|
|
3304
3304
|
trigger: e,
|
|
3305
3305
|
messageId: i
|
|
3306
|
-
}), await
|
|
3307
|
-
stream:
|
|
3306
|
+
}), await Zi({
|
|
3307
|
+
stream: Xi({
|
|
3308
3308
|
stream: l,
|
|
3309
3309
|
resetStateOnMessageIdChange: e === "resume-stream",
|
|
3310
3310
|
resetStateOnFirstMessageStart: e === "resume-stream" && this.transport.resumeStreamIsReplay,
|
|
@@ -3369,13 +3369,13 @@ var ra = class {
|
|
|
3369
3369
|
}));
|
|
3370
3370
|
}
|
|
3371
3371
|
};
|
|
3372
|
-
function
|
|
3372
|
+
function sa({ messages: e }) {
|
|
3373
3373
|
let t = e[e.length - 1];
|
|
3374
3374
|
if (!t || t.role !== "assistant") return !1;
|
|
3375
3375
|
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(Y);
|
|
3376
3376
|
return r.filter((e) => e.state === "approval-responded").length > 0 && r.every((e) => e.state === "output-available" && e.preliminary !== !0 || e.state === "output-error" || e.state === "output-denied" || e.state === "approval-responded");
|
|
3377
3377
|
}
|
|
3378
|
-
function
|
|
3378
|
+
function ca({ messages: e }) {
|
|
3379
3379
|
let t = e[e.length - 1];
|
|
3380
3380
|
if (!t || t.role !== "assistant") return !1;
|
|
3381
3381
|
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1), i = r.filter(Y).filter((e) => !e.providerExecuted), a = r.reduce((e, t, n) => Y(t) && !t.providerExecuted ? n : e, -1);
|
|
@@ -3383,7 +3383,7 @@ function sa({ messages: e }) {
|
|
|
3383
3383
|
}
|
|
3384
3384
|
//#endregion
|
|
3385
3385
|
//#region ../node_modules/.pnpm/throttleit@2.1.0/node_modules/throttleit/index.js
|
|
3386
|
-
var
|
|
3386
|
+
var la = /* @__PURE__ */ t(((e, t) => {
|
|
3387
3387
|
function n(e, t) {
|
|
3388
3388
|
if (typeof e != "function") throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);
|
|
3389
3389
|
let n, r = 0;
|
|
@@ -3396,14 +3396,14 @@ var ca = /* @__PURE__ */ t(((e, t) => {
|
|
|
3396
3396
|
};
|
|
3397
3397
|
}
|
|
3398
3398
|
t.exports = n;
|
|
3399
|
-
})), X = /* @__PURE__ */ e(o(), 1),
|
|
3400
|
-
function
|
|
3401
|
-
return t == null ? e : (0,
|
|
3399
|
+
})), X = /* @__PURE__ */ e(o(), 1), ua = /* @__PURE__ */ e(la(), 1), Z = We();
|
|
3400
|
+
function da(e, t) {
|
|
3401
|
+
return t == null ? e : (0, ua.default)(e, t);
|
|
3402
3402
|
}
|
|
3403
|
-
function
|
|
3403
|
+
function fa(e) {
|
|
3404
3404
|
return Array.isArray(e) ? [...e] : typeof e == "object" && e && (Object.getPrototypeOf(e) === Object.prototype || Object.getPrototypeOf(e) === null) ? { ...e } : e;
|
|
3405
3405
|
}
|
|
3406
|
-
var
|
|
3406
|
+
var pa = class {
|
|
3407
3407
|
#e;
|
|
3408
3408
|
#t;
|
|
3409
3409
|
#n;
|
|
@@ -3427,9 +3427,9 @@ var fa = class {
|
|
|
3427
3427
|
...t,
|
|
3428
3428
|
parts: t.parts.map((e) => ({ ...e }))
|
|
3429
3429
|
};
|
|
3430
|
-
return "metadata" in t && (n.metadata =
|
|
3430
|
+
return "metadata" in t && (n.metadata = fa(t.metadata)), n;
|
|
3431
3431
|
}, this["~registerMessagesCallback"] = (e, t) => {
|
|
3432
|
-
let n = t ?
|
|
3432
|
+
let n = t ? da(e, t) : e;
|
|
3433
3433
|
return this.#r.add(n), () => {
|
|
3434
3434
|
this.#r.delete(n);
|
|
3435
3435
|
};
|
|
@@ -3466,29 +3466,29 @@ var fa = class {
|
|
|
3466
3466
|
#o;
|
|
3467
3467
|
#s;
|
|
3468
3468
|
#c;
|
|
3469
|
-
},
|
|
3469
|
+
}, ma = class extends oa {
|
|
3470
3470
|
#e;
|
|
3471
3471
|
constructor({ messages: e, ...t }) {
|
|
3472
|
-
let n = new
|
|
3472
|
+
let n = new pa(e);
|
|
3473
3473
|
super({
|
|
3474
3474
|
...t,
|
|
3475
3475
|
state: n
|
|
3476
3476
|
}), this["~registerMessagesCallback"] = (e, t) => this.#e["~registerMessagesCallback"](e, t), this["~registerStatusCallback"] = (e) => this.#e["~registerStatusCallback"](e), this["~registerErrorCallback"] = (e) => this.#e["~registerErrorCallback"](e), this.#e = n;
|
|
3477
3477
|
}
|
|
3478
|
-
},
|
|
3479
|
-
function
|
|
3478
|
+
}, ha = /* @__PURE__ */ new WeakMap();
|
|
3479
|
+
function ga({ chat: e, state: t }) {
|
|
3480
3480
|
if (document.visibilityState !== "visible" || t.pendingVisibilityResume != null) return;
|
|
3481
|
-
let n = () =>
|
|
3481
|
+
let n = () => ha.get(e) === t && t.registrations.size > 0, r = () => {
|
|
3482
3482
|
t.pendingVisibilityResume = void 0;
|
|
3483
3483
|
};
|
|
3484
3484
|
t.pendingVisibilityResume = e["~resumeStreamIfDisconnected"]({ shouldResume: () => n() && document.visibilityState === "visible" }).then(r, r);
|
|
3485
3485
|
}
|
|
3486
|
-
function
|
|
3487
|
-
let n =
|
|
3486
|
+
function _a({ chat: e, registration: t }) {
|
|
3487
|
+
let n = ha.get(e);
|
|
3488
3488
|
if (n == null) {
|
|
3489
3489
|
let t = { registrations: /* @__PURE__ */ new Set() };
|
|
3490
|
-
if (
|
|
3491
|
-
let n = () =>
|
|
3490
|
+
if (ha.set(e, t), n = t, typeof document < "u") {
|
|
3491
|
+
let n = () => ga({
|
|
3492
3492
|
chat: e,
|
|
3493
3493
|
state: t
|
|
3494
3494
|
});
|
|
@@ -3499,10 +3499,10 @@ function ga({ chat: e, registration: t }) {
|
|
|
3499
3499
|
}
|
|
3500
3500
|
let { registrations: r } = n, i = r.size === 0;
|
|
3501
3501
|
return r.add(t), i && e.status !== "submitted" && e.status !== "streaming" && e.resumeStream(), () => {
|
|
3502
|
-
r.delete(t), r.size === 0 && (n.cleanupVisibilityListener?.(),
|
|
3502
|
+
r.delete(t), r.size === 0 && (n.cleanupVisibilityListener?.(), ha.delete(e));
|
|
3503
3503
|
};
|
|
3504
3504
|
}
|
|
3505
|
-
function
|
|
3505
|
+
function va(e) {
|
|
3506
3506
|
return {
|
|
3507
3507
|
chat: e,
|
|
3508
3508
|
messages: e.messages,
|
|
@@ -3510,10 +3510,10 @@ function _a(e) {
|
|
|
3510
3510
|
error: e.error
|
|
3511
3511
|
};
|
|
3512
3512
|
}
|
|
3513
|
-
function
|
|
3513
|
+
function ya(e, t) {
|
|
3514
3514
|
return e.chat === t.chat && e.messages === t.messages && e.status === t.status && e.error === t.error;
|
|
3515
3515
|
}
|
|
3516
|
-
function
|
|
3516
|
+
function ba({ throttle: e, experimental_throttle: t, resume: n = !1, ...r } = {}) {
|
|
3517
3517
|
let i = e ?? t, a = (0, X.useRef)({}), o = (0, X.useRef)({});
|
|
3518
3518
|
"chat" in r || (o.current = {
|
|
3519
3519
|
onToolCall: r.onToolCall,
|
|
@@ -3523,7 +3523,7 @@ function ya({ throttle: e, experimental_throttle: t, resume: n = !1, ...r } = {}
|
|
|
3523
3523
|
sendAutomaticallyWhen: r.sendAutomaticallyWhen,
|
|
3524
3524
|
transport: r.transport
|
|
3525
3525
|
});
|
|
3526
|
-
let s, c = () => o.current.transport ?? (s ??= new
|
|
3526
|
+
let s, c = () => o.current.transport ?? (s ??= new aa()), l = {
|
|
3527
3527
|
...r,
|
|
3528
3528
|
transport: {
|
|
3529
3529
|
get resumeStreamIsReplay() {
|
|
@@ -3538,7 +3538,7 @@ function ya({ throttle: e, experimental_throttle: t, resume: n = !1, ...r } = {}
|
|
|
3538
3538
|
onError: (e) => o.current.onError?.(e),
|
|
3539
3539
|
sendAutomaticallyWhen: (e) => o.current.sendAutomaticallyWhen?.(e) ?? !1
|
|
3540
3540
|
}, u = "chat" in r ? r.chat : r.id, { chat: d, isExternallyManaged: f } = (0, X.useMemo)(() => ({
|
|
3541
|
-
chat: "chat" in r ? r.chat : new
|
|
3541
|
+
chat: "chat" in r ? r.chat : new ma(l),
|
|
3542
3542
|
isExternallyManaged: "chat" in r
|
|
3543
3543
|
}), [u]);
|
|
3544
3544
|
(0, X.useEffect)(() => {
|
|
@@ -3546,18 +3546,18 @@ function ya({ throttle: e, experimental_throttle: t, resume: n = !1, ...r } = {}
|
|
|
3546
3546
|
d.stop();
|
|
3547
3547
|
};
|
|
3548
3548
|
}, [d, f]);
|
|
3549
|
-
let [p, m] = (0, X.useState)(() =>
|
|
3550
|
-
p.chat !== d && m(
|
|
3549
|
+
let [p, m] = (0, X.useState)(() => va(d));
|
|
3550
|
+
p.chat !== d && m(va(d)), (0, X.useEffect)(() => {
|
|
3551
3551
|
let e = !0, t = () => {
|
|
3552
3552
|
if (!e) return;
|
|
3553
|
-
let t =
|
|
3554
|
-
m((e) => e.chat !== d ||
|
|
3553
|
+
let t = va(d);
|
|
3554
|
+
m((e) => e.chat !== d || ya(e, t) ? e : t);
|
|
3555
3555
|
}, n = [
|
|
3556
3556
|
d["~registerMessagesCallback"](t, i),
|
|
3557
3557
|
d["~registerStatusCallback"](t),
|
|
3558
3558
|
d["~registerErrorCallback"](t)
|
|
3559
|
-
], r =
|
|
3560
|
-
return m((e) =>
|
|
3559
|
+
], r = va(d);
|
|
3560
|
+
return m((e) => ya(e, r) ? e : r), () => {
|
|
3561
3561
|
e = !1, n.forEach((e) => e());
|
|
3562
3562
|
};
|
|
3563
3563
|
}, [d, i]);
|
|
@@ -3565,7 +3565,7 @@ function ya({ throttle: e, experimental_throttle: t, resume: n = !1, ...r } = {}
|
|
|
3565
3565
|
typeof e == "function" && (e = e(d.messages)), d.messages = e;
|
|
3566
3566
|
}, [d]);
|
|
3567
3567
|
return (0, X.useEffect)(() => {
|
|
3568
|
-
if (n) return
|
|
3568
|
+
if (n) return _a({
|
|
3569
3569
|
chat: d,
|
|
3570
3570
|
registration: a.current
|
|
3571
3571
|
});
|
|
@@ -3589,23 +3589,23 @@ function ya({ throttle: e, experimental_throttle: t, resume: n = !1, ...r } = {}
|
|
|
3589
3589
|
}
|
|
3590
3590
|
//#endregion
|
|
3591
3591
|
//#region src/components/chat/chat-abort.ts
|
|
3592
|
-
var
|
|
3593
|
-
function
|
|
3592
|
+
var xa = "user_cancelled";
|
|
3593
|
+
function Sa(e) {
|
|
3594
3594
|
if (e.type === "abort") return e.reason;
|
|
3595
3595
|
}
|
|
3596
|
-
function
|
|
3596
|
+
function Ca(e) {
|
|
3597
3597
|
return e.isAbort ? e.streamReason || "user_cancelled" : null;
|
|
3598
3598
|
}
|
|
3599
|
-
function
|
|
3599
|
+
function wa(e) {
|
|
3600
3600
|
switch (e) {
|
|
3601
|
-
case
|
|
3601
|
+
case xa: return "Generation stopped";
|
|
3602
3602
|
case "timeout": return "Generation stopped: timed out";
|
|
3603
3603
|
default: return `Generation stopped: ${e}`;
|
|
3604
3604
|
}
|
|
3605
3605
|
}
|
|
3606
3606
|
//#endregion
|
|
3607
3607
|
//#region src/components/chat/turn-timing.ts
|
|
3608
|
-
function
|
|
3608
|
+
function Ta(e) {
|
|
3609
3609
|
let t = e.metadata;
|
|
3610
3610
|
if (typeof t != "object" || !t) return;
|
|
3611
3611
|
let { startedAt: n, finishedAt: r, stopped: i } = t;
|
|
@@ -3615,21 +3615,21 @@ function wa(e) {
|
|
|
3615
3615
|
stopped: i === !0
|
|
3616
3616
|
};
|
|
3617
3617
|
}
|
|
3618
|
-
function
|
|
3618
|
+
function Ea(e) {
|
|
3619
3619
|
let t = Math.max(1, Math.round(e / 1e3)), n = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), i = t % 60;
|
|
3620
3620
|
return n > 0 ? r > 0 ? `${n}h ${r}m` : `${n}h` : r > 0 ? i > 0 ? `${r}m ${i}s` : `${r}m` : `${i}s`;
|
|
3621
3621
|
}
|
|
3622
3622
|
//#endregion
|
|
3623
3623
|
//#region src/components/chat/agent-activity.tsx
|
|
3624
|
-
var
|
|
3625
|
-
let t = (0,
|
|
3624
|
+
var Da = (e) => {
|
|
3625
|
+
let t = (0, L.c)(19), { running: n, thinking: i, interrupted: a, defaultOpen: o, timing: s, toolCount: c, failedCount: l, steps: u } = e, d = i !== void 0 && i, f = a !== void 0 && a, p = o !== void 0 && o, m = c === void 0 ? 0 : c, h = l === void 0 ? 0 : l, g = u === void 0 ? Oa : u, [_, v] = X.useState(), y = _ ?? (n || p), b = ja(n), x = g.length > 0, S;
|
|
3626
3626
|
t[0] !== h || t[1] !== f || t[2] !== b || t[3] !== n || t[4] !== d || t[5] !== s || t[6] !== m ? (S = n ? /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("output", {
|
|
3627
|
-
className:
|
|
3627
|
+
className: ka,
|
|
3628
3628
|
children: d ? "Thinking…" : "Working…"
|
|
3629
3629
|
}), s && /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
3630
3630
|
className: "tabular-nums",
|
|
3631
|
-
children:
|
|
3632
|
-
})] }) : /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("span", { children:
|
|
3631
|
+
children: Ea(b - s.startedAt)
|
|
3632
|
+
})] }) : /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("span", { children: Aa({
|
|
3633
3633
|
interrupted: f,
|
|
3634
3634
|
timing: s,
|
|
3635
3635
|
toolCount: m
|
|
@@ -3665,13 +3665,13 @@ var Ea = (e) => {
|
|
|
3665
3665
|
className: "my-1 w-full",
|
|
3666
3666
|
children: [w, T]
|
|
3667
3667
|
}), t[16] = w, t[17] = T, t[18] = E) : E = t[18], E;
|
|
3668
|
-
},
|
|
3669
|
-
function
|
|
3670
|
-
let r = t?.finishedAt == null ? void 0 :
|
|
3668
|
+
}, Oa = [], ka = "animate-shimmer bg-[linear-gradient(90deg,var(--muted-foreground)_35%,var(--foreground)_50%,var(--muted-foreground)_65%)] bg-size-[200%_100%] bg-clip-text text-transparent motion-reduce:animate-none";
|
|
3669
|
+
function Aa({ interrupted: e, timing: t, toolCount: n }) {
|
|
3670
|
+
let r = t?.finishedAt == null ? void 0 : Ea(t.finishedAt - t.startedAt);
|
|
3671
3671
|
return e ? r ? `Stopped after ${r}` : "Stopped" : n === 0 ? r ? `Thought for ${r}` : "Thought process" : r ? `Worked for ${r}` : `Worked through ${n} ${n === 1 ? "step" : "steps"}`;
|
|
3672
3672
|
}
|
|
3673
|
-
function
|
|
3674
|
-
let t = (0,
|
|
3673
|
+
function ja(e) {
|
|
3674
|
+
let t = (0, L.c)(3), [n, r] = X.useState(Ma), i, a;
|
|
3675
3675
|
return t[0] === e ? (i = t[1], a = t[2]) : (i = () => {
|
|
3676
3676
|
if (!e) return;
|
|
3677
3677
|
let t = () => r(Date.now()), n = requestAnimationFrame(t), i = setInterval(t, 1e3);
|
|
@@ -3680,13 +3680,13 @@ function Aa(e) {
|
|
|
3680
3680
|
};
|
|
3681
3681
|
}, a = [e], t[0] = e, t[1] = i, t[2] = a), X.useEffect(i, a), n;
|
|
3682
3682
|
}
|
|
3683
|
-
function
|
|
3683
|
+
function Ma() {
|
|
3684
3684
|
return Date.now();
|
|
3685
3685
|
}
|
|
3686
3686
|
//#endregion
|
|
3687
3687
|
//#region src/components/chat/chat-components.tsx
|
|
3688
|
-
var
|
|
3689
|
-
let t = (0,
|
|
3688
|
+
var Na = (e) => {
|
|
3689
|
+
let t = (0, L.c)(6), { attachment: n } = e;
|
|
3690
3690
|
if (n.mediaType?.startsWith("image/")) {
|
|
3691
3691
|
let e = n.filename || "Attachment", r;
|
|
3692
3692
|
return t[0] !== n.url || t[1] !== e ? (r = /* @__PURE__ */ (0, Z.jsx)("img", {
|
|
@@ -3702,8 +3702,8 @@ var Ma = (e) => {
|
|
|
3702
3702
|
className: "flex flex-row gap-1 items-center text-xs",
|
|
3703
3703
|
children: [r, i]
|
|
3704
3704
|
}), t[4] = i, t[5] = a), a;
|
|
3705
|
-
},
|
|
3706
|
-
let t = (0,
|
|
3705
|
+
}, Pa = (e) => {
|
|
3706
|
+
let t = (0, L.c)(15), { icon: n, title: r, subtitle: i, href: a } = e, o;
|
|
3707
3707
|
t[0] === r ? o = t[1] : (o = /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
3708
3708
|
className: "truncate font-medium",
|
|
3709
3709
|
children: r
|
|
@@ -3744,27 +3744,27 @@ var Ma = (e) => {
|
|
|
3744
3744
|
};
|
|
3745
3745
|
//#endregion
|
|
3746
3746
|
//#region src/components/chat/chat-markdown.tsx
|
|
3747
|
-
function
|
|
3748
|
-
let t = (0,
|
|
3749
|
-
return t[0] !== n || t[1] !== i ? (a = /* @__PURE__ */ (0, Z.jsx)(
|
|
3747
|
+
function Fa(e) {
|
|
3748
|
+
let t = (0, L.c)(3), { content: n } = e, r = Ye(ot)?.mode, i = r !== "agent" && r !== "code_mode", a;
|
|
3749
|
+
return t[0] !== n || t[1] !== i ? (a = /* @__PURE__ */ (0, Z.jsx)(ne, {
|
|
3750
3750
|
content: n,
|
|
3751
3751
|
allowNotebookInsertion: i
|
|
3752
3752
|
}), t[0] = n, t[1] = i, t[2] = a) : a = t[2], a;
|
|
3753
3753
|
}
|
|
3754
3754
|
//#endregion
|
|
3755
3755
|
//#region src/components/chat/tool-call/shared.ts
|
|
3756
|
-
var
|
|
3756
|
+
var Ia = /* @__PURE__ */ new Set([
|
|
3757
3757
|
"input-streaming",
|
|
3758
3758
|
"input-available",
|
|
3759
3759
|
"approval-responded"
|
|
3760
3760
|
]);
|
|
3761
|
-
function
|
|
3761
|
+
function La(e) {
|
|
3762
3762
|
return e.replace("tool-", "");
|
|
3763
3763
|
}
|
|
3764
3764
|
//#endregion
|
|
3765
3765
|
//#region src/components/chat/tool-call/tool-args.tsx
|
|
3766
|
-
var
|
|
3767
|
-
let t = (0,
|
|
3766
|
+
var Ra = (e) => {
|
|
3767
|
+
let t = (0, L.c)(9), { input: n, label: r } = e, i = r === void 0 ? "Tool Request" : r;
|
|
3768
3768
|
if (n == null) return null;
|
|
3769
3769
|
let a;
|
|
3770
3770
|
t[0] === i ? a = t[1] : (a = /* @__PURE__ */ (0, Z.jsx)("h3", {
|
|
@@ -3783,11 +3783,11 @@ var La = (e) => {
|
|
|
3783
3783
|
className: "space-y-2",
|
|
3784
3784
|
children: [a, s]
|
|
3785
3785
|
}), t[6] = a, t[7] = s, t[8] = c) : c = t[8], c;
|
|
3786
|
-
},
|
|
3787
|
-
let t = (0,
|
|
3786
|
+
}, za = (e) => {
|
|
3787
|
+
let t = (0, L.c)(27), { toolName: n, input: i, approval: o, onApprove: s, className: c } = e, l;
|
|
3788
3788
|
t[0] === c ? l = t[1] : (l = r("rounded-md border border-(--amber-6) bg-(--amber-2) p-3 space-y-3", c), t[0] = c, t[1] = l);
|
|
3789
3789
|
let u;
|
|
3790
|
-
t[2] === n ? u = t[3] : (u =
|
|
3790
|
+
t[2] === n ? u = t[3] : (u = La(n), t[2] = n, t[3] = u);
|
|
3791
3791
|
let d = `Approval required for ${u}`, f;
|
|
3792
3792
|
t[4] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ (0, Z.jsx)(Qt, { className: "h-4 w-4 text-(--amber-11) mt-0.5 shrink-0" }), t[4] = f) : f = t[4];
|
|
3793
3793
|
let p;
|
|
@@ -3796,7 +3796,7 @@ var La = (e) => {
|
|
|
3796
3796
|
children: "Approval required:"
|
|
3797
3797
|
}), t[5] = p) : p = t[5];
|
|
3798
3798
|
let m;
|
|
3799
|
-
t[6] === n ? m = t[7] : (m =
|
|
3799
|
+
t[6] === n ? m = t[7] : (m = La(n), t[6] = n, t[7] = m);
|
|
3800
3800
|
let h;
|
|
3801
3801
|
t[8] === m ? h = t[9] : (h = /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
3802
3802
|
className: "flex items-start gap-2",
|
|
@@ -3813,7 +3813,7 @@ var La = (e) => {
|
|
|
3813
3813
|
})]
|
|
3814
3814
|
}), t[8] = m, t[9] = h);
|
|
3815
3815
|
let g;
|
|
3816
|
-
t[10] === i ? g = t[11] : (g = /* @__PURE__ */ (0, Z.jsx)(
|
|
3816
|
+
t[10] === i ? g = t[11] : (g = /* @__PURE__ */ (0, Z.jsx)(Ra, { input: i }), t[10] = i, t[11] = g);
|
|
3817
3817
|
let _;
|
|
3818
3818
|
t[12] !== o.id || t[13] !== s ? (_ = /* @__PURE__ */ (0, Z.jsx)(a, {
|
|
3819
3819
|
size: "xs",
|
|
@@ -3849,7 +3849,7 @@ var La = (e) => {
|
|
|
3849
3849
|
y
|
|
3850
3850
|
]
|
|
3851
3851
|
}), t[21] = l, t[22] = y, t[23] = d, t[24] = h, t[25] = g, t[26] = b) : b = t[26], b;
|
|
3852
|
-
},
|
|
3852
|
+
}, Ba = {
|
|
3853
3853
|
get_marimo_rules: {
|
|
3854
3854
|
running: "Reading marimo guidelines",
|
|
3855
3855
|
done: "Read marimo guidelines",
|
|
@@ -3878,12 +3878,12 @@ var La = (e) => {
|
|
|
3878
3878
|
get_tables_and_variables: {
|
|
3879
3879
|
running: "Reading variables",
|
|
3880
3880
|
done: "Read variables",
|
|
3881
|
-
icon:
|
|
3881
|
+
icon: f
|
|
3882
3882
|
},
|
|
3883
3883
|
get_database_tables: {
|
|
3884
3884
|
running: "Reading database tables",
|
|
3885
3885
|
done: "Read database tables",
|
|
3886
|
-
icon:
|
|
3886
|
+
icon: d
|
|
3887
3887
|
},
|
|
3888
3888
|
get_notebook_errors: {
|
|
3889
3889
|
running: "Checking for errors",
|
|
@@ -3898,9 +3898,9 @@ var La = (e) => {
|
|
|
3898
3898
|
get_cell_dependency_graph: {
|
|
3899
3899
|
running: "Reading dependency graph",
|
|
3900
3900
|
done: "Read dependency graph",
|
|
3901
|
-
icon:
|
|
3901
|
+
icon: b
|
|
3902
3902
|
}
|
|
3903
|
-
},
|
|
3903
|
+
}, Va = {
|
|
3904
3904
|
add_cell: {
|
|
3905
3905
|
running: "Adding cell",
|
|
3906
3906
|
done: "Added cell",
|
|
@@ -3914,23 +3914,23 @@ var La = (e) => {
|
|
|
3914
3914
|
delete_cell: {
|
|
3915
3915
|
running: "Deleting cell",
|
|
3916
3916
|
done: "Deleted cell",
|
|
3917
|
-
icon:
|
|
3917
|
+
icon: y
|
|
3918
3918
|
}
|
|
3919
3919
|
};
|
|
3920
|
-
function
|
|
3921
|
-
let r =
|
|
3920
|
+
function Ha(e, t, n) {
|
|
3921
|
+
let r = La(e);
|
|
3922
3922
|
if (r === "execute_code") return {
|
|
3923
3923
|
label: n === "running" ? "Running code" : "Ran code",
|
|
3924
|
-
detail:
|
|
3925
|
-
icon:
|
|
3924
|
+
detail: Ga(t) ? Wa(t.code) : void 0,
|
|
3925
|
+
icon: u
|
|
3926
3926
|
};
|
|
3927
3927
|
if (r === "edit_notebook_tool") {
|
|
3928
|
-
let e =
|
|
3928
|
+
let e = Ua(t);
|
|
3929
3929
|
if (e) {
|
|
3930
|
-
let t =
|
|
3930
|
+
let t = Va[e.type];
|
|
3931
3931
|
return {
|
|
3932
3932
|
label: t[n],
|
|
3933
|
-
detail:
|
|
3933
|
+
detail: Wa(e.code),
|
|
3934
3934
|
icon: t.icon
|
|
3935
3935
|
};
|
|
3936
3936
|
}
|
|
@@ -3939,8 +3939,8 @@ function Va(e, t, n) {
|
|
|
3939
3939
|
icon: Be
|
|
3940
3940
|
};
|
|
3941
3941
|
}
|
|
3942
|
-
if (Object.hasOwn(
|
|
3943
|
-
let e =
|
|
3942
|
+
if (Object.hasOwn(Ba, r)) {
|
|
3943
|
+
let e = Ba[r];
|
|
3944
3944
|
return {
|
|
3945
3945
|
label: e[n],
|
|
3946
3946
|
icon: e.icon
|
|
@@ -3949,39 +3949,39 @@ function Va(e, t, n) {
|
|
|
3949
3949
|
return {
|
|
3950
3950
|
label: n === "running" ? "Calling" : "Called",
|
|
3951
3951
|
detail: r,
|
|
3952
|
-
icon:
|
|
3952
|
+
icon: p
|
|
3953
3953
|
};
|
|
3954
3954
|
}
|
|
3955
|
-
function
|
|
3956
|
-
if (!
|
|
3955
|
+
function Ua(e) {
|
|
3956
|
+
if (!Ga(e) || !Ga(e.edit)) return;
|
|
3957
3957
|
let { type: t, code: n } = e.edit;
|
|
3958
|
-
if (typeof t == "string" && Object.hasOwn(
|
|
3958
|
+
if (typeof t == "string" && Object.hasOwn(Va, t)) return {
|
|
3959
3959
|
type: t,
|
|
3960
3960
|
code: typeof n == "string" ? n : void 0
|
|
3961
3961
|
};
|
|
3962
3962
|
}
|
|
3963
|
-
function
|
|
3963
|
+
function Wa(e) {
|
|
3964
3964
|
if (typeof e != "string") return;
|
|
3965
3965
|
let t = e.split("\n").map((e) => e.trim()).filter((e) => e.length > 0);
|
|
3966
3966
|
return t.find((e) => !/^(import\s|from\s|#)/.test(e)) ?? t[0];
|
|
3967
3967
|
}
|
|
3968
|
-
function
|
|
3968
|
+
function Ga(e) {
|
|
3969
3969
|
return typeof e == "object" && !!e;
|
|
3970
3970
|
}
|
|
3971
3971
|
//#endregion
|
|
3972
3972
|
//#region src/components/chat/tool-call/tool-result.tsx
|
|
3973
|
-
function
|
|
3973
|
+
function Ka(e) {
|
|
3974
3974
|
return e == null || typeof e == "object" && gt(e);
|
|
3975
3975
|
}
|
|
3976
|
-
var
|
|
3976
|
+
var qa = it({
|
|
3977
3977
|
status: tt().default("success"),
|
|
3978
3978
|
auth_required: qe().default(!1),
|
|
3979
3979
|
action_url: Je().optional(),
|
|
3980
3980
|
next_steps: Je().optional(),
|
|
3981
3981
|
meta: Je().optional(),
|
|
3982
3982
|
message: tt().nullish()
|
|
3983
|
-
}),
|
|
3984
|
-
let t = (0,
|
|
3983
|
+
}), Ja = (e) => {
|
|
3984
|
+
let t = (0, L.c)(12), { data: n } = e, r;
|
|
3985
3985
|
if (t[0] !== n) {
|
|
3986
3986
|
let { status: e, auth_required: i, action_url: a, meta: o, next_steps: s, message: c, ...l } = n, u;
|
|
3987
3987
|
t[2] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ (0, Z.jsx)("h3", {
|
|
@@ -4006,33 +4006,33 @@ var Ka = it({
|
|
|
4006
4006
|
children: [d, f]
|
|
4007
4007
|
})]
|
|
4008
4008
|
}), t[7] = d, t[8] = f, t[9] = p) : p = t[9];
|
|
4009
|
-
let
|
|
4010
|
-
t[10] === c ?
|
|
4009
|
+
let m;
|
|
4010
|
+
t[10] === c ? m = t[11] : (m = c && /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
4011
4011
|
className: "flex items-start gap-2",
|
|
4012
|
-
children: [/* @__PURE__ */ (0, Z.jsx)(
|
|
4012
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(_, { className: "h-3 w-3 text-(--blue-11) mt-0.5 shrink-0" }), /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
4013
4013
|
className: "text-xs text-foreground",
|
|
4014
4014
|
children: c
|
|
4015
4015
|
})]
|
|
4016
|
-
}), t[10] = c, t[11] =
|
|
4016
|
+
}), t[10] = c, t[11] = m), r = /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
4017
4017
|
className: "flex flex-col gap-1.5",
|
|
4018
4018
|
children: [
|
|
4019
4019
|
p,
|
|
4020
|
-
|
|
4020
|
+
m,
|
|
4021
4021
|
l && /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
4022
4022
|
className: "space-y-3",
|
|
4023
|
-
children: Object.entries(l).map(
|
|
4023
|
+
children: Object.entries(l).map(Xa)
|
|
4024
4024
|
})
|
|
4025
4025
|
]
|
|
4026
4026
|
}), t[0] = n, t[1] = r;
|
|
4027
4027
|
} else r = t[1];
|
|
4028
4028
|
return r;
|
|
4029
|
-
},
|
|
4030
|
-
let t = (0,
|
|
4031
|
-
t[0] === n ? r = t[1] : (r =
|
|
4029
|
+
}, Ya = (e) => {
|
|
4030
|
+
let t = (0, L.c)(8), { result: n } = e, r;
|
|
4031
|
+
t[0] === n ? r = t[1] : (r = qa.safeParse(n), t[0] = n, t[1] = r);
|
|
4032
4032
|
let i = r;
|
|
4033
4033
|
if (i.success) {
|
|
4034
4034
|
let e;
|
|
4035
|
-
return t[2] === i.data ? e = t[3] : (e = /* @__PURE__ */ (0, Z.jsx)(
|
|
4035
|
+
return t[2] === i.data ? e = t[3] : (e = /* @__PURE__ */ (0, Z.jsx)(Ja, { data: i.data }), t[2] = i.data, t[3] = e), e;
|
|
4036
4036
|
}
|
|
4037
4037
|
let a;
|
|
4038
4038
|
t[4] === n ? a = t[5] : (a = typeof n == "string" ? n : JSON.stringify(n, null, 2), t[4] = n, t[5] = a);
|
|
@@ -4042,9 +4042,9 @@ var Ka = it({
|
|
|
4042
4042
|
children: a
|
|
4043
4043
|
}), t[6] = a, t[7] = o), o;
|
|
4044
4044
|
};
|
|
4045
|
-
function
|
|
4045
|
+
function Xa(e) {
|
|
4046
4046
|
let [t, n] = e;
|
|
4047
|
-
return
|
|
4047
|
+
return Ka(n) ? null : /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
4048
4048
|
className: "space-y-1.5",
|
|
4049
4049
|
children: [/* @__PURE__ */ (0, Z.jsx)("span", {
|
|
4050
4050
|
className: "text-xs text-muted-foreground",
|
|
@@ -4057,13 +4057,13 @@ function Ya(e) {
|
|
|
4057
4057
|
}
|
|
4058
4058
|
//#endregion
|
|
4059
4059
|
//#region src/components/chat/tool-call/tool-step.tsx
|
|
4060
|
-
var
|
|
4061
|
-
let t = (0,
|
|
4060
|
+
var Za = (e) => {
|
|
4061
|
+
let t = (0, L.c)(58), { toolName: n, state: i, input: a, result: o, errorText: s, approval: c, isActive: l, className: u } = e, d = l === void 0 || l, [f, p] = X.useState(!1), m, h, g, _, v, y, b, x, S, C, w;
|
|
4062
4062
|
if (t[0] !== u || t[1] !== a || t[2] !== d || t[3] !== f || t[4] !== i || t[5] !== n) {
|
|
4063
|
-
let e =
|
|
4064
|
-
g = o, h = s, _ =
|
|
4063
|
+
let e = Ia.has(i), { label: o, detail: s, icon: c } = Ha(n, a, e ? "running" : "done");
|
|
4064
|
+
g = o, h = s, _ = Qa(i, e && !d, c);
|
|
4065
4065
|
let l = i === "output-error";
|
|
4066
|
-
t[17] === u ? w = t[18] : (w = r("w-full", u), t[17] = u, t[18] = w), b = "button", t[19] === Symbol.for("react.memo_cache_sentinel") ? (x = () => p(
|
|
4066
|
+
t[17] === u ? w = t[18] : (w = r("w-full", u), t[17] = u, t[18] = w), b = "button", t[19] === Symbol.for("react.memo_cache_sentinel") ? (x = () => p(eo), t[19] = x) : x = t[19], S = f;
|
|
4067
4067
|
let T = f && "text-foreground", E = l && "text-(--red-11) hover:bg-(--red-3) hover:text-(--red-11)";
|
|
4068
4068
|
t[20] !== T || t[21] !== E ? (C = r("group/step -mx-1.5 flex w-fit max-w-full min-w-0 items-center gap-1.5 rounded-md px-1.5 py-0.5 text-left text-xs leading-4 text-muted-foreground transition-colors hover:bg-foreground/6 hover:text-foreground focus-visible:outline-1 focus-visible:outline-(--slate-8)", T, E), t[20] = T, t[21] = E, t[22] = C) : C = t[22], m = _.icon, v = !0, y = r("-ml-px size-3 shrink-0", _.spinning && "animate-spin"), t[0] = u, t[1] = a, t[2] = d, t[3] = f, t[4] = i, t[5] = n, t[6] = m, t[7] = h, t[8] = g, t[9] = _, t[10] = v, t[11] = y, t[12] = b, t[13] = x, t[14] = S, t[15] = C, t[16] = w;
|
|
4069
4069
|
} else m = t[6], h = t[7], g = t[8], _ = t[9], v = t[10], y = t[11], b = t[12], x = t[13], S = t[14], C = t[15], w = t[16];
|
|
@@ -4109,27 +4109,27 @@ var Xa = (e) => {
|
|
|
4109
4109
|
]
|
|
4110
4110
|
}), t[37] = E, t[38] = D, t[39] = O, t[40] = j, t[41] = b, t[42] = x, t[43] = S, t[44] = C, t[45] = T, t[46] = M) : M = t[46];
|
|
4111
4111
|
let N;
|
|
4112
|
-
t[47] !== c || t[48] !== s || t[49] !== a || t[50] !== f || t[51] !== o || t[52] !== i ? (N = f && /* @__PURE__ */ (0, Z.jsx)(
|
|
4112
|
+
t[47] !== c || t[48] !== s || t[49] !== a || t[50] !== f || t[51] !== o || t[52] !== i ? (N = f && /* @__PURE__ */ (0, Z.jsx)($a, {
|
|
4113
4113
|
state: i,
|
|
4114
4114
|
input: a,
|
|
4115
4115
|
result: o,
|
|
4116
4116
|
errorText: s,
|
|
4117
4117
|
approval: c
|
|
4118
4118
|
}), t[47] = c, t[48] = s, t[49] = a, t[50] = f, t[51] = o, t[52] = i, t[53] = N) : N = t[53];
|
|
4119
|
-
let
|
|
4120
|
-
return t[54] !== M || t[55] !== N || t[56] !== w ? (
|
|
4119
|
+
let P;
|
|
4120
|
+
return t[54] !== M || t[55] !== N || t[56] !== w ? (P = /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
4121
4121
|
className: w,
|
|
4122
4122
|
children: [M, N]
|
|
4123
|
-
}), t[54] = M, t[55] = N, t[56] = w, t[57] =
|
|
4123
|
+
}), t[54] = M, t[55] = N, t[56] = w, t[57] = P) : P = t[57], P;
|
|
4124
4124
|
};
|
|
4125
|
-
function
|
|
4125
|
+
function Qa(e, t, n) {
|
|
4126
4126
|
if (t) return {
|
|
4127
4127
|
icon: Ut,
|
|
4128
4128
|
suffix: "Stopped"
|
|
4129
4129
|
};
|
|
4130
4130
|
switch (e) {
|
|
4131
4131
|
case "output-error": return {
|
|
4132
|
-
icon:
|
|
4132
|
+
icon: h,
|
|
4133
4133
|
suffix: "Failed"
|
|
4134
4134
|
};
|
|
4135
4135
|
case "output-denied": return {
|
|
@@ -4138,16 +4138,16 @@ function Za(e, t, n) {
|
|
|
4138
4138
|
};
|
|
4139
4139
|
case "output-available": return { icon: n };
|
|
4140
4140
|
default: return {
|
|
4141
|
-
icon:
|
|
4141
|
+
icon: m,
|
|
4142
4142
|
spinning: !0
|
|
4143
4143
|
};
|
|
4144
4144
|
}
|
|
4145
4145
|
}
|
|
4146
|
-
var
|
|
4147
|
-
let t = (0,
|
|
4148
|
-
t[0] === r ? s = t[1] : (s = /* @__PURE__ */ (0, Z.jsx)(
|
|
4146
|
+
var $a = (e) => {
|
|
4147
|
+
let t = (0, L.c)(16), { state: n, input: r, result: i, errorText: a, approval: o } = e, s;
|
|
4148
|
+
t[0] === r ? s = t[1] : (s = /* @__PURE__ */ (0, Z.jsx)(Ra, { input: r }), t[0] = r, t[1] = s);
|
|
4149
4149
|
let c;
|
|
4150
|
-
t[2] !== i || t[3] !== n ? (c = n === "output-available" && i != null && /* @__PURE__ */ (0, Z.jsx)(
|
|
4150
|
+
t[2] !== i || t[3] !== n ? (c = n === "output-available" && i != null && /* @__PURE__ */ (0, Z.jsx)(Ya, { result: i }), t[2] = i, t[3] = n, t[4] = c) : c = t[4];
|
|
4151
4151
|
let l;
|
|
4152
4152
|
t[5] !== a || t[6] !== n ? (l = n === "output-error" && a && /* @__PURE__ */ (0, Z.jsx)("pre", {
|
|
4153
4153
|
className: "max-h-64 overflow-auto rounded border border-(--red-6) bg-(--red-2) p-2 text-xs leading-relaxed whitespace-pre-wrap text-(--red-11) scrollbar-thin",
|
|
@@ -4169,43 +4169,43 @@ var Qa = (e) => {
|
|
|
4169
4169
|
]
|
|
4170
4170
|
}), t[11] = s, t[12] = c, t[13] = l, t[14] = u, t[15] = d) : d = t[15], d;
|
|
4171
4171
|
};
|
|
4172
|
-
function
|
|
4172
|
+
function eo(e) {
|
|
4173
4173
|
return !e;
|
|
4174
4174
|
}
|
|
4175
4175
|
//#endregion
|
|
4176
4176
|
//#region src/components/chat/tool-call/tool-call-view.tsx
|
|
4177
|
-
var
|
|
4178
|
-
let t = (0,
|
|
4177
|
+
var to = (e) => {
|
|
4178
|
+
let t = (0, L.c)(16), n, r, i, a, o;
|
|
4179
4179
|
if (t[0] === e ? (n = t[1], r = t[2], i = t[3], a = t[4], o = t[5]) : ({toolName: o, state: a, approval: n, onApprove: r, ...i} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = i, t[4] = a, t[5] = o), a === "approval-requested") {
|
|
4180
4180
|
let e;
|
|
4181
|
-
return t[6] !== n || t[7] !== r || t[8] !== i || t[9] !== o ? (e = n != null && r != null ? /* @__PURE__ */ (0, Z.jsx)(
|
|
4181
|
+
return t[6] !== n || t[7] !== r || t[8] !== i || t[9] !== o ? (e = n != null && r != null ? /* @__PURE__ */ (0, Z.jsx)(za, {
|
|
4182
4182
|
toolName: o,
|
|
4183
4183
|
input: i.input,
|
|
4184
4184
|
approval: n,
|
|
4185
4185
|
onApprove: r,
|
|
4186
4186
|
className: i.className
|
|
4187
|
-
}) : /* @__PURE__ */ (0, Z.jsx)(
|
|
4187
|
+
}) : /* @__PURE__ */ (0, Z.jsx)(Za, {
|
|
4188
4188
|
...i,
|
|
4189
4189
|
toolName: o,
|
|
4190
4190
|
state: "input-available"
|
|
4191
4191
|
}), t[6] = n, t[7] = r, t[8] = i, t[9] = o, t[10] = e) : e = t[10], e;
|
|
4192
4192
|
}
|
|
4193
4193
|
let s;
|
|
4194
|
-
return t[11] !== n || t[12] !== i || t[13] !== a || t[14] !== o ? (s = /* @__PURE__ */ (0, Z.jsx)(
|
|
4194
|
+
return t[11] !== n || t[12] !== i || t[13] !== a || t[14] !== o ? (s = /* @__PURE__ */ (0, Z.jsx)(Za, {
|
|
4195
4195
|
...i,
|
|
4196
4196
|
toolName: o,
|
|
4197
4197
|
state: a,
|
|
4198
4198
|
approval: n
|
|
4199
4199
|
}), t[11] = n, t[12] = i, t[13] = a, t[14] = o, t[15] = s) : s = t[15], s;
|
|
4200
|
-
},
|
|
4201
|
-
let a = n && t, { work: o, rest: s } =
|
|
4200
|
+
}, no = ({ message: e, isLast: t, isActive: n, turnStartedAt: r, addToolApprovalResponse: i }) => {
|
|
4201
|
+
let a = n && t, { work: o, rest: s } = ro(e.parts), c = [];
|
|
4202
4202
|
if (o.length > 0 || a && s.length === 0) {
|
|
4203
|
-
let t = o.flatMap(({ part: e }) =>
|
|
4204
|
-
c.push(/* @__PURE__ */ (0, Z.jsx)(
|
|
4203
|
+
let t = o.flatMap(({ part: e }) => oo(e) ? [e] : []), n = a && r != null ? { startedAt: r } : Ta(e);
|
|
4204
|
+
c.push(/* @__PURE__ */ (0, Z.jsx)(Da, {
|
|
4205
4205
|
running: a,
|
|
4206
4206
|
thinking: s.length === 0 && (o.length === 0 || o.at(-1)?.part.type === "reasoning"),
|
|
4207
|
-
interrupted: !a && (n?.stopped === !0 || t.some((e) =>
|
|
4208
|
-
defaultOpen: !s.some(({ part: e }) => !
|
|
4207
|
+
interrupted: !a && (n?.stopped === !0 || t.some((e) => Ia.has(e.state))),
|
|
4208
|
+
defaultOpen: !s.some(({ part: e }) => !io(e)),
|
|
4209
4209
|
timing: n,
|
|
4210
4210
|
toolCount: t.length,
|
|
4211
4211
|
failedCount: t.filter((e) => e.state === "output-error").length,
|
|
@@ -4215,7 +4215,7 @@ var eo = (e) => {
|
|
|
4215
4215
|
for (let { part: e, index: t } of s) c.push(l(e, t, !1));
|
|
4216
4216
|
return c;
|
|
4217
4217
|
function l(e, t, n) {
|
|
4218
|
-
if (
|
|
4218
|
+
if (so(e) || e.type === "dynamic-tool") return /* @__PURE__ */ (0, Z.jsx)(to, {
|
|
4219
4219
|
toolName: e.type === "dynamic-tool" ? e.toolName : e.type,
|
|
4220
4220
|
result: e.output,
|
|
4221
4221
|
errorText: e.state === "output-error" ? e.errorText : void 0,
|
|
@@ -4226,11 +4226,11 @@ var eo = (e) => {
|
|
|
4226
4226
|
isActive: a,
|
|
4227
4227
|
className: n ? void 0 : "my-1"
|
|
4228
4228
|
}, t);
|
|
4229
|
-
if (
|
|
4229
|
+
if (co(e)) return null;
|
|
4230
4230
|
switch (e.type) {
|
|
4231
|
-
case "text": return e.text.includes("<marimo-") ? /* @__PURE__ */ (0, Z.jsx)(X.Fragment, { children:
|
|
4231
|
+
case "text": return e.text.includes("<marimo-") ? /* @__PURE__ */ (0, Z.jsx)(X.Fragment, { children: v({ html: e.text }) }, t) : /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
4232
4232
|
className: n ? "py-1.5" : void 0,
|
|
4233
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
4233
|
+
children: /* @__PURE__ */ (0, Z.jsx)(Fa, { content: e.text })
|
|
4234
4234
|
}, t);
|
|
4235
4235
|
case "reasoning": return /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
4236
4236
|
className: "flex gap-1.5 py-1.5 text-muted-foreground",
|
|
@@ -4242,21 +4242,21 @@ var eo = (e) => {
|
|
|
4242
4242
|
children: [/* @__PURE__ */ (0, Z.jsx)("span", {
|
|
4243
4243
|
className: "sr-only",
|
|
4244
4244
|
children: "Reasoning: "
|
|
4245
|
-
}), /* @__PURE__ */ (0, Z.jsx)(
|
|
4245
|
+
}), /* @__PURE__ */ (0, Z.jsx)(Fa, { content: e.text })]
|
|
4246
4246
|
})]
|
|
4247
4247
|
}, t);
|
|
4248
|
-
case "file": return /* @__PURE__ */ (0, Z.jsx)(
|
|
4249
|
-
case "reasoning-file": return /* @__PURE__ */ (0, Z.jsx)(
|
|
4248
|
+
case "file": return /* @__PURE__ */ (0, Z.jsx)(Na, { attachment: e }, t);
|
|
4249
|
+
case "reasoning-file": return /* @__PURE__ */ (0, Z.jsx)(Na, { attachment: {
|
|
4250
4250
|
type: "file",
|
|
4251
4251
|
mediaType: e.mediaType,
|
|
4252
4252
|
url: e.url
|
|
4253
4253
|
} }, t);
|
|
4254
|
-
case "source-document": return /* @__PURE__ */ (0, Z.jsx)(
|
|
4255
|
-
icon: /* @__PURE__ */ (0, Z.jsx)(
|
|
4254
|
+
case "source-document": return /* @__PURE__ */ (0, Z.jsx)(Pa, {
|
|
4255
|
+
icon: /* @__PURE__ */ (0, Z.jsx)(x, { className: "h-3 w-3 shrink-0" }),
|
|
4256
4256
|
title: e.title,
|
|
4257
4257
|
subtitle: e.filename
|
|
4258
4258
|
}, t);
|
|
4259
|
-
case "source-url": return /* @__PURE__ */ (0, Z.jsx)(
|
|
4259
|
+
case "source-url": return /* @__PURE__ */ (0, Z.jsx)(Pa, {
|
|
4260
4260
|
icon: /* @__PURE__ */ (0, Z.jsx)(De, { className: "h-3 w-3 shrink-0" }),
|
|
4261
4261
|
title: e.title ?? e.url,
|
|
4262
4262
|
subtitle: e.title ? e.url : void 0,
|
|
@@ -4271,39 +4271,39 @@ var eo = (e) => {
|
|
|
4271
4271
|
}
|
|
4272
4272
|
}
|
|
4273
4273
|
};
|
|
4274
|
-
function
|
|
4274
|
+
function ro(e) {
|
|
4275
4275
|
let t = e.map((e, t) => ({
|
|
4276
4276
|
part: e,
|
|
4277
4277
|
index: t
|
|
4278
|
-
})).filter(({ part: e }) =>
|
|
4278
|
+
})).filter(({ part: e }) => ao(e)), n = t.findLastIndex(({ part: e }) => e.type === "reasoning" || oo(e) && !io(e));
|
|
4279
4279
|
return {
|
|
4280
|
-
work: t.filter(({ part: e }, t) => t <= n && !
|
|
4281
|
-
rest: t.filter(({ part: e }, t) => t > n ||
|
|
4280
|
+
work: t.filter(({ part: e }, t) => t <= n && !io(e)),
|
|
4281
|
+
rest: t.filter(({ part: e }, t) => t > n || io(e))
|
|
4282
4282
|
};
|
|
4283
4283
|
}
|
|
4284
|
-
function ro(e) {
|
|
4285
|
-
return ao(e) && e.state === "approval-requested";
|
|
4286
|
-
}
|
|
4287
4284
|
function io(e) {
|
|
4285
|
+
return oo(e) && e.state === "approval-requested";
|
|
4286
|
+
}
|
|
4287
|
+
function ao(e) {
|
|
4288
4288
|
switch (e.type) {
|
|
4289
4289
|
case "step-start": return !1;
|
|
4290
4290
|
case "text": return e.text.trim().length > 0;
|
|
4291
4291
|
case "reasoning": return e.text.trim().length > 0;
|
|
4292
|
-
default: return !
|
|
4292
|
+
default: return !co(e);
|
|
4293
4293
|
}
|
|
4294
4294
|
}
|
|
4295
|
-
function ao(e) {
|
|
4296
|
-
return oo(e) || e.type === "dynamic-tool";
|
|
4297
|
-
}
|
|
4298
4295
|
function oo(e) {
|
|
4299
|
-
return e.type
|
|
4296
|
+
return so(e) || e.type === "dynamic-tool";
|
|
4300
4297
|
}
|
|
4301
4298
|
function so(e) {
|
|
4299
|
+
return e.type.startsWith("tool-");
|
|
4300
|
+
}
|
|
4301
|
+
function co(e) {
|
|
4302
4302
|
return e.type.startsWith("data-");
|
|
4303
4303
|
}
|
|
4304
4304
|
//#endregion
|
|
4305
4305
|
//#region src/core/ai/attachments.ts
|
|
4306
|
-
var
|
|
4306
|
+
var lo = /[\x00-\x08\x0B\x0E-\x1F]/, uo = [
|
|
4307
4307
|
"text/*",
|
|
4308
4308
|
"application/json",
|
|
4309
4309
|
"application/xml",
|
|
@@ -4311,17 +4311,17 @@ var co = /[\x00-\x08\x0B\x0E-\x1F]/, lo = [
|
|
|
4311
4311
|
"application/yaml",
|
|
4312
4312
|
"application/x-yaml"
|
|
4313
4313
|
];
|
|
4314
|
-
function
|
|
4314
|
+
function fo(e) {
|
|
4315
4315
|
let t = e.split(";", 1)[0].trim().toLowerCase();
|
|
4316
|
-
return /^(image|audio|video)\//.test(t) ? t :
|
|
4316
|
+
return /^(image|audio|video)\//.test(t) ? t : mo(t, uo) || t.endsWith("+json") || t.endsWith("+xml") ? "text/plain" : t;
|
|
4317
4317
|
}
|
|
4318
|
-
async function
|
|
4319
|
-
let t =
|
|
4318
|
+
async function po(e) {
|
|
4319
|
+
let t = fo(e.type);
|
|
4320
4320
|
if (t !== "text/plain" && !/^(image|audio|video)\//.test(t) && t !== "application/pdf") {
|
|
4321
4321
|
let n = new Uint8Array(await e.arrayBuffer());
|
|
4322
4322
|
try {
|
|
4323
4323
|
let e = new TextDecoder("utf-8", { fatal: !0 }).decode(n);
|
|
4324
|
-
|
|
4324
|
+
lo.test(e) || (t = "text/plain");
|
|
4325
4325
|
} catch {}
|
|
4326
4326
|
}
|
|
4327
4327
|
return t === e.type ? e : new File([e], e.name, {
|
|
@@ -4329,12 +4329,12 @@ async function fo(e) {
|
|
|
4329
4329
|
lastModified: e.lastModified
|
|
4330
4330
|
});
|
|
4331
4331
|
}
|
|
4332
|
-
function
|
|
4332
|
+
function mo(e, t) {
|
|
4333
4333
|
return t.some((t) => t.endsWith("/*") ? e.startsWith(t.slice(0, -1)) : e === t);
|
|
4334
4334
|
}
|
|
4335
4335
|
//#endregion
|
|
4336
4336
|
//#region src/core/ai/context/providers/cell.ts
|
|
4337
|
-
var
|
|
4337
|
+
var ho = class extends j {
|
|
4338
4338
|
title = "Cells";
|
|
4339
4339
|
mentionPrefix = "@";
|
|
4340
4340
|
contextType = "cell";
|
|
@@ -4365,7 +4365,7 @@ var mo = class extends A {
|
|
|
4365
4365
|
};
|
|
4366
4366
|
}
|
|
4367
4367
|
formatContext(e) {
|
|
4368
|
-
return
|
|
4368
|
+
return P({
|
|
4369
4369
|
type: "cell",
|
|
4370
4370
|
data: {
|
|
4371
4371
|
cellId: e.data.cellId,
|
|
@@ -4377,7 +4377,7 @@ var mo = class extends A {
|
|
|
4377
4377
|
};
|
|
4378
4378
|
//#endregion
|
|
4379
4379
|
//#region src/core/ai/context/providers/cell-output.ts
|
|
4380
|
-
function
|
|
4380
|
+
function go(e, t) {
|
|
4381
4381
|
return e ? !!([
|
|
4382
4382
|
"image/",
|
|
4383
4383
|
"video/",
|
|
@@ -4393,7 +4393,7 @@ function ho(e, t) {
|
|
|
4393
4393
|
"<marimo-ui-element"
|
|
4394
4394
|
].some((e) => t.includes(e))) : !1;
|
|
4395
4395
|
}
|
|
4396
|
-
var
|
|
4396
|
+
var _o = class extends j {
|
|
4397
4397
|
title = "Cell Outputs";
|
|
4398
4398
|
mentionPrefix = "@";
|
|
4399
4399
|
contextType = "cell-output";
|
|
@@ -4404,7 +4404,7 @@ var go = class extends A {
|
|
|
4404
4404
|
getItems() {
|
|
4405
4405
|
let e = this.store.get(Oe), t = [];
|
|
4406
4406
|
for (let n of e.cellIds) {
|
|
4407
|
-
let r =
|
|
4407
|
+
let r = bo(n, e, this.store.get(Te(n))), i = r.cellOutput;
|
|
4408
4408
|
if (!i) continue;
|
|
4409
4409
|
let a = i.output.mimetype || "unknown";
|
|
4410
4410
|
t.push({
|
|
@@ -4426,9 +4426,9 @@ var go = class extends A {
|
|
|
4426
4426
|
label: `@${n}`,
|
|
4427
4427
|
displayLabel: n,
|
|
4428
4428
|
detail: `${t.outputType} output`,
|
|
4429
|
-
boost: t.outputType === "media" ?
|
|
4429
|
+
boost: t.outputType === "media" ? k.HIGH : k.MEDIUM,
|
|
4430
4430
|
type: this.contextType,
|
|
4431
|
-
section:
|
|
4431
|
+
section: F.CELL_OUTPUT,
|
|
4432
4432
|
apply: `@${n}`,
|
|
4433
4433
|
info: () => {
|
|
4434
4434
|
let e = document.createElement("div");
|
|
@@ -4465,7 +4465,7 @@ var go = class extends A {
|
|
|
4465
4465
|
outputType: t.outputType,
|
|
4466
4466
|
mimetype: t.output.mimetype
|
|
4467
4467
|
}, o = `Cell Code:\n${i}\n\n`;
|
|
4468
|
-
return t.outputType === "text" && t.processedContent ? o += `Output:\n${t.processedContent}` : t.outputType === "media" && (o += `Media Output: Contains ${t.output.mimetype} content`, t.imageUrl && (o += `\nImage URL: ${t.imageUrl}`)),
|
|
4468
|
+
return t.outputType === "text" && t.processedContent ? o += `Output:\n${t.processedContent}` : t.outputType === "media" && (o += `Media Output: Contains ${t.output.mimetype} content`, t.imageUrl && (o += `\nImage URL: ${t.imageUrl}`)), P({
|
|
4469
4469
|
type: this.contextType,
|
|
4470
4470
|
data: a,
|
|
4471
4471
|
details: o
|
|
@@ -4473,10 +4473,10 @@ var go = class extends A {
|
|
|
4473
4473
|
}
|
|
4474
4474
|
async getAttachments(e) {
|
|
4475
4475
|
let t = e[0].data.cellId, n = e[0].data.cellName;
|
|
4476
|
-
return
|
|
4476
|
+
return vo(e.map((e) => e.data.cellOutput), t, n);
|
|
4477
4477
|
}
|
|
4478
4478
|
};
|
|
4479
|
-
async function
|
|
4479
|
+
async function vo(e, t, r) {
|
|
4480
4480
|
let i = e.filter((e) => e.shouldDownloadImage && e.outputType === "media");
|
|
4481
4481
|
if (i.length === 0) return [];
|
|
4482
4482
|
let a = i.flatMap((e) => {
|
|
@@ -4499,9 +4499,9 @@ async function _o(e, t, r) {
|
|
|
4499
4499
|
return n.error("Error downloading cell output images:", e), [];
|
|
4500
4500
|
}
|
|
4501
4501
|
}
|
|
4502
|
-
function
|
|
4503
|
-
if (
|
|
4504
|
-
let t = e.mimetype, n =
|
|
4502
|
+
function yo(e) {
|
|
4503
|
+
if (E(e)) return null;
|
|
4504
|
+
let t = e.mimetype, n = go(t, String(e.data)) ? "media" : "text", r = Re(e), i, a = !1;
|
|
4505
4505
|
return n === "media" && (typeof e.data == "string" && e.data.startsWith("data:") || typeof e.data == "string" && e.data.startsWith("http") ? i = e.data : a = !0), {
|
|
4506
4506
|
processedContent: r,
|
|
4507
4507
|
imageUrl: i,
|
|
@@ -4510,11 +4510,11 @@ function vo(e) {
|
|
|
4510
4510
|
output: e
|
|
4511
4511
|
};
|
|
4512
4512
|
}
|
|
4513
|
-
function
|
|
4513
|
+
function bo(e, t, n, r) {
|
|
4514
4514
|
let { includeConsoleOutput: i = !1 } = r || {}, a = t.cellRuntime[e], o = t.cellData[e], s = t.cellIds.indexOf(e), c = je(o.name, s), l;
|
|
4515
|
-
i && (l = a.consoleOutputs.map((e) =>
|
|
4515
|
+
i && (l = a.consoleOutputs.map((e) => yo(e)).filter((e) => e !== null));
|
|
4516
4516
|
let u;
|
|
4517
|
-
return n !== null && !
|
|
4517
|
+
return n !== null && !E(n) && (u = yo(n) ?? void 0), {
|
|
4518
4518
|
cellId: e,
|
|
4519
4519
|
cellName: c,
|
|
4520
4520
|
cellCode: o.code,
|
|
@@ -4524,7 +4524,7 @@ function yo(e, t, n, r) {
|
|
|
4524
4524
|
}
|
|
4525
4525
|
//#endregion
|
|
4526
4526
|
//#region src/core/ai/context/providers/error.ts
|
|
4527
|
-
function
|
|
4527
|
+
function xo(e, t) {
|
|
4528
4528
|
let n = [`Code:\n${e.cellCode}`];
|
|
4529
4529
|
if (e.tracebackHtml && n.push(`Traceback:\n${Se(e.tracebackHtml)}`), e.errorData.length > 0 && n.push(e.errorData.map((e) => Me(e)).join("\n\n")), e.errorData.some((e) => e.type === "sql-error")) {
|
|
4530
4530
|
let r = oe(e.cellId, t);
|
|
@@ -4532,23 +4532,23 @@ function bo(e, t) {
|
|
|
4532
4532
|
}
|
|
4533
4533
|
return n.join("\n\n");
|
|
4534
4534
|
}
|
|
4535
|
-
function
|
|
4536
|
-
return
|
|
4535
|
+
function So(e, t) {
|
|
4536
|
+
return P({
|
|
4537
4537
|
type: "error",
|
|
4538
4538
|
data: {
|
|
4539
4539
|
name: e.cellName || `Cell ${e.cellId}`,
|
|
4540
4540
|
cellId: e.cellId
|
|
4541
4541
|
},
|
|
4542
|
-
details:
|
|
4542
|
+
details: xo(e, t)
|
|
4543
4543
|
});
|
|
4544
4544
|
}
|
|
4545
|
-
function
|
|
4545
|
+
function Co(e) {
|
|
4546
4546
|
return e.errorData.length === 1 ? Ne(e.errorData[0]) : e.errorData.length > 1 ? `${e.errorData.length} errors` : e.tracebackHtml ? Se(e.tracebackHtml).trim().split("\n").find((e) => e.trim())?.trim() || "traceback" : "error";
|
|
4547
4547
|
}
|
|
4548
|
-
function
|
|
4548
|
+
function wo(e) {
|
|
4549
4549
|
return `Error: ${e.cellName || `Cell ${e.cellId}`}`;
|
|
4550
4550
|
}
|
|
4551
|
-
var
|
|
4551
|
+
var To = new T("error", "errors"), Eo = class extends j {
|
|
4552
4552
|
title = "Errors";
|
|
4553
4553
|
mentionPrefix = "@";
|
|
4554
4554
|
contextType = "error";
|
|
@@ -4571,13 +4571,13 @@ var wo = new h("error", "errors"), To = class extends A {
|
|
|
4571
4571
|
}];
|
|
4572
4572
|
for (let n of e) t.push({
|
|
4573
4573
|
uri: this.asURI(n.cellId),
|
|
4574
|
-
name:
|
|
4574
|
+
name: wo(n),
|
|
4575
4575
|
type: this.contextType,
|
|
4576
4576
|
data: {
|
|
4577
4577
|
type: "cell-error",
|
|
4578
4578
|
error: n
|
|
4579
4579
|
},
|
|
4580
|
-
description:
|
|
4580
|
+
description: Co(n)
|
|
4581
4581
|
});
|
|
4582
4582
|
return t;
|
|
4583
4583
|
}
|
|
@@ -4587,10 +4587,10 @@ var wo = new h("error", "errors"), To = class extends A {
|
|
|
4587
4587
|
return {
|
|
4588
4588
|
label: "@Errors",
|
|
4589
4589
|
displayLabel: "Errors",
|
|
4590
|
-
detail: `${t} ${
|
|
4590
|
+
detail: `${t} ${To.pluralize(t)}`,
|
|
4591
4591
|
type: "error",
|
|
4592
4592
|
apply: "@error://all",
|
|
4593
|
-
section:
|
|
4593
|
+
section: F.ERROR,
|
|
4594
4594
|
info: () => {
|
|
4595
4595
|
let e = document.createElement("div");
|
|
4596
4596
|
e.classList.add("mo-cm-tooltip", "docs-documentation", "min-w-[200px]", "flex", "flex-col", "gap-1", "p-2");
|
|
@@ -4599,7 +4599,7 @@ var wo = new h("error", "errors"), To = class extends A {
|
|
|
4599
4599
|
let r = document.createElement("div");
|
|
4600
4600
|
r.classList.add("font-bold", "text-base"), r.textContent = "Errors", n.append(r);
|
|
4601
4601
|
let i = document.createElement("div");
|
|
4602
|
-
return i.classList.add("text-sm", "text-muted-foreground"), i.textContent = `${t} ${
|
|
4602
|
+
return i.classList.add("text-sm", "text-muted-foreground"), i.textContent = `${t} ${To.pluralize(t)}`, n.append(i), e.append(n), e;
|
|
4603
4603
|
}
|
|
4604
4604
|
};
|
|
4605
4605
|
}
|
|
@@ -4607,33 +4607,33 @@ var wo = new h("error", "errors"), To = class extends A {
|
|
|
4607
4607
|
let { error: t } = e.data;
|
|
4608
4608
|
return {
|
|
4609
4609
|
...this.createBasicCompletion(e, {
|
|
4610
|
-
detail:
|
|
4610
|
+
detail: Co(t),
|
|
4611
4611
|
type: "error"
|
|
4612
4612
|
}),
|
|
4613
|
-
section:
|
|
4613
|
+
section: F.ERROR
|
|
4614
4614
|
};
|
|
4615
4615
|
}
|
|
4616
4616
|
return {
|
|
4617
4617
|
label: "Error",
|
|
4618
4618
|
displayLabel: "Error",
|
|
4619
|
-
section:
|
|
4619
|
+
section: F.ERROR
|
|
4620
4620
|
};
|
|
4621
4621
|
}
|
|
4622
4622
|
formatContext(e) {
|
|
4623
|
-
return (e.data.type === "all-errors" ? e.data.errors : [e.data.error]).map((e) =>
|
|
4623
|
+
return (e.data.type === "all-errors" ? e.data.errors : [e.data.error]).map((e) => So(e, this.store)).join("\n\n");
|
|
4624
4624
|
}
|
|
4625
|
-
},
|
|
4625
|
+
}, Do = le(), Oo = {
|
|
4626
4626
|
maxDepth: 3,
|
|
4627
4627
|
maxResults: 20,
|
|
4628
4628
|
defaultResultsLimit: 5,
|
|
4629
4629
|
includeDirectories: !1
|
|
4630
|
-
},
|
|
4630
|
+
}, ko = class extends j {
|
|
4631
4631
|
title = "Files";
|
|
4632
4632
|
mentionPrefix = "#";
|
|
4633
4633
|
contextType = "file";
|
|
4634
4634
|
apiRequests;
|
|
4635
4635
|
config;
|
|
4636
|
-
constructor(e, t =
|
|
4636
|
+
constructor(e, t = Oo) {
|
|
4637
4637
|
super(), this.apiRequests = e, this.config = t;
|
|
4638
4638
|
}
|
|
4639
4639
|
createCompletionSource() {
|
|
@@ -4729,12 +4729,12 @@ var wo = new h("error", "errors"), To = class extends A {
|
|
|
4729
4729
|
return {
|
|
4730
4730
|
...this.createBasicCompletion(e),
|
|
4731
4731
|
type: "file",
|
|
4732
|
-
section:
|
|
4733
|
-
boost: t.isDirectory ?
|
|
4732
|
+
section: F.FILE,
|
|
4733
|
+
boost: t.isDirectory ? k.MEDIUM : k.LOW,
|
|
4734
4734
|
detail: t.path,
|
|
4735
4735
|
displayLabel: `${i} ${r}`,
|
|
4736
4736
|
apply: async (e, i, a, o) => {
|
|
4737
|
-
let s = e.state.facet(
|
|
4737
|
+
let s = e.state.facet(Do)?.addAttachment;
|
|
4738
4738
|
if (!s) {
|
|
4739
4739
|
n.warn("No addAttachment callback provided");
|
|
4740
4740
|
return;
|
|
@@ -4767,7 +4767,7 @@ var wo = new h("error", "errors"), To = class extends A {
|
|
|
4767
4767
|
}
|
|
4768
4768
|
formatContext(e) {
|
|
4769
4769
|
let { data: t, name: n } = e;
|
|
4770
|
-
return
|
|
4770
|
+
return P({
|
|
4771
4771
|
type: this.contextType,
|
|
4772
4772
|
data: {
|
|
4773
4773
|
name: n,
|
|
@@ -4777,7 +4777,7 @@ var wo = new h("error", "errors"), To = class extends A {
|
|
|
4777
4777
|
details: t.isDirectory ? "Directory containing files and subdirectories" : "File"
|
|
4778
4778
|
});
|
|
4779
4779
|
}
|
|
4780
|
-
},
|
|
4780
|
+
}, Ao = class extends j {
|
|
4781
4781
|
title = "Tables";
|
|
4782
4782
|
mentionPrefix = "@";
|
|
4783
4783
|
contextType = "data";
|
|
@@ -4807,7 +4807,7 @@ var wo = new h("error", "errors"), To = class extends A {
|
|
|
4807
4807
|
l += `${t}\n`;
|
|
4808
4808
|
}
|
|
4809
4809
|
}
|
|
4810
|
-
return
|
|
4810
|
+
return P({
|
|
4811
4811
|
type: this.contextType,
|
|
4812
4812
|
data: {
|
|
4813
4813
|
name: o,
|
|
@@ -4822,12 +4822,12 @@ var wo = new h("error", "errors"), To = class extends A {
|
|
|
4822
4822
|
label: `@${t}`,
|
|
4823
4823
|
displayLabel: t,
|
|
4824
4824
|
detail: n.source === "memory" ? "in-memory" : n.source,
|
|
4825
|
-
boost: n.source_type === "local" ?
|
|
4826
|
-
type:
|
|
4825
|
+
boost: n.source_type === "local" ? k.LOCAL_TABLE : k.REMOTE_TABLE,
|
|
4826
|
+
type: te(n),
|
|
4827
4827
|
apply: `@${t}`,
|
|
4828
4828
|
section: {
|
|
4829
|
-
name:
|
|
4830
|
-
rank:
|
|
4829
|
+
name: te(n) === "dataframe" ? "Dataframe" : "Table",
|
|
4830
|
+
rank: F.TABLE.rank
|
|
4831
4831
|
},
|
|
4832
4832
|
info: () => this.createTableInfoElement(t, n)
|
|
4833
4833
|
};
|
|
@@ -4885,7 +4885,7 @@ var wo = new h("error", "errors"), To = class extends A {
|
|
|
4885
4885
|
return e.classList.add("text-xs", "px-1.5", "py-0.5", "rounded-full", "font-medium", ...t.split(" ")), e;
|
|
4886
4886
|
}
|
|
4887
4887
|
}
|
|
4888
|
-
},
|
|
4888
|
+
}, jo = class extends j {
|
|
4889
4889
|
title = "Variables";
|
|
4890
4890
|
mentionPrefix = "@";
|
|
4891
4891
|
contextType = "variable";
|
|
@@ -4912,13 +4912,13 @@ var wo = new h("error", "errors"), To = class extends A {
|
|
|
4912
4912
|
displayLabel: n.name,
|
|
4913
4913
|
detail: n.dataType ?? "",
|
|
4914
4914
|
type: this.contextType,
|
|
4915
|
-
section:
|
|
4916
|
-
info: () =>
|
|
4915
|
+
section: F.VARIABLE,
|
|
4916
|
+
info: () => re(n)
|
|
4917
4917
|
};
|
|
4918
4918
|
}
|
|
4919
4919
|
formatContext(e) {
|
|
4920
4920
|
let { data: t } = e, { variable: n } = t;
|
|
4921
|
-
return
|
|
4921
|
+
return P({
|
|
4922
4922
|
type: this.contextType,
|
|
4923
4923
|
data: {
|
|
4924
4924
|
name: n.name,
|
|
@@ -4930,16 +4930,16 @@ var wo = new h("error", "errors"), To = class extends A {
|
|
|
4930
4930
|
};
|
|
4931
4931
|
//#endregion
|
|
4932
4932
|
//#region src/core/ai/context/context.ts
|
|
4933
|
-
function
|
|
4934
|
-
let t = e.get(
|
|
4935
|
-
return new
|
|
4933
|
+
function Mo(e) {
|
|
4934
|
+
let t = e.get(ae), n = e.get(O), r = e.get(M);
|
|
4935
|
+
return new A().register(new Ao(n)).register(new jo(r, n)).register(new Eo(e)).register(new _o(e)).register(new ho(e)).register(new N(t.connectionsMap, n));
|
|
4936
4936
|
}
|
|
4937
|
-
function
|
|
4938
|
-
return new
|
|
4937
|
+
function No() {
|
|
4938
|
+
return new ko(Ee());
|
|
4939
4939
|
}
|
|
4940
4940
|
//#endregion
|
|
4941
4941
|
//#region src/components/editor/ai/completion-utils.ts
|
|
4942
|
-
function
|
|
4942
|
+
function Po(e, t = []) {
|
|
4943
4943
|
return (n) => {
|
|
4944
4944
|
let r = e.map((e) => n.matchBefore(e)).find(Boolean);
|
|
4945
4945
|
return !r || r && r.from === r.to && !n.explicit ? null : {
|
|
@@ -4950,9 +4950,9 @@ function No(e, t = []) {
|
|
|
4950
4950
|
}
|
|
4951
4951
|
//#endregion
|
|
4952
4952
|
//#region src/components/chat/chat-utils.ts
|
|
4953
|
-
async function
|
|
4953
|
+
async function Fo(e) {
|
|
4954
4954
|
return await Promise.all(e.map(async (e) => {
|
|
4955
|
-
let t = await
|
|
4955
|
+
let t = await po(e);
|
|
4956
4956
|
return {
|
|
4957
4957
|
type: "file",
|
|
4958
4958
|
mediaType: t.type,
|
|
@@ -4961,20 +4961,20 @@ async function Po(e) {
|
|
|
4961
4961
|
};
|
|
4962
4962
|
}));
|
|
4963
4963
|
}
|
|
4964
|
-
function
|
|
4964
|
+
function Io(e) {
|
|
4965
4965
|
let t = e.at(-1);
|
|
4966
4966
|
if (!t || t.role !== "assistant") return !1;
|
|
4967
4967
|
let n = t.parts.at(-1);
|
|
4968
|
-
return !n || !Y(n) ? !1 :
|
|
4968
|
+
return !n || !Y(n) ? !1 : ca({ messages: e }) || sa({ messages: e }) || n.state === "output-denied" && !n.providerExecuted;
|
|
4969
4969
|
}
|
|
4970
4970
|
//#endregion
|
|
4971
4971
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-ai@0.3.10_@codemirror+state@6.7.6_@codemirror+view@6.43.13/node_modules/@marimo-team/codemirror-ai/dist/utils/facet.js
|
|
4972
|
-
function
|
|
4972
|
+
function Lo(e) {
|
|
4973
4973
|
return At.define({ combine: (t) => t[0] ?? e });
|
|
4974
4974
|
}
|
|
4975
4975
|
//#endregion
|
|
4976
4976
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-ai@0.3.10_@codemirror+state@6.7.6_@codemirror+view@6.43.13/node_modules/@marimo-team/codemirror-ai/dist/prompt-history/extension.js
|
|
4977
|
-
var
|
|
4977
|
+
var Ro = Lo({}), zo = St.define(), Bo = St.define(), Vo = 50, Ho = Tt.define({
|
|
4978
4978
|
create() {
|
|
4979
4979
|
return {
|
|
4980
4980
|
prompts: [],
|
|
@@ -4984,15 +4984,15 @@ var Lo = Io({}), Ro = St.define(), zo = St.define(), Bo = 50, Vo = Tt.define({
|
|
|
4984
4984
|
},
|
|
4985
4985
|
update(e, t) {
|
|
4986
4986
|
let n = { ...e };
|
|
4987
|
-
t.docChanged && e.navigationIndex !== -1 && (t.effects.some((e) => e.is(
|
|
4988
|
-
for (let r of t.effects) if (r.is(
|
|
4987
|
+
t.docChanged && e.navigationIndex !== -1 && (t.effects.some((e) => e.is(Bo) || e.is(zo)) || (n.navigationIndex = -1, n.originalText = ""));
|
|
4988
|
+
for (let r of t.effects) if (r.is(zo)) {
|
|
4989
4989
|
let i = r.value.trim();
|
|
4990
|
-
i && (n.prompts = [i, ...e.prompts.filter((e) => e !== i)].slice(0,
|
|
4991
|
-
} else r.is(
|
|
4990
|
+
i && (n.prompts = [i, ...e.prompts.filter((e) => e !== i)].slice(0, Vo), t.state.facet(Ro).save?.(n.prompts)), n.navigationIndex = -1, n.originalText = "";
|
|
4991
|
+
} else r.is(Bo) && (n.navigationIndex = r.value.index, n.originalText = r.value.originalText);
|
|
4992
4992
|
return n;
|
|
4993
4993
|
}
|
|
4994
|
-
}),
|
|
4995
|
-
let t = e.state.field(
|
|
4994
|
+
}), Uo = (e) => {
|
|
4995
|
+
let t = e.state.field(Ho), n = e.state.doc;
|
|
4996
4996
|
if (t.prompts.length === 0) return !1;
|
|
4997
4997
|
let r, i = t.originalText;
|
|
4998
4998
|
if (t.navigationIndex === -1) {
|
|
@@ -5006,13 +5006,13 @@ var Lo = Io({}), Ro = St.define(), zo = St.define(), Bo = 50, Vo = Tt.define({
|
|
|
5006
5006
|
to: e.state.doc.length,
|
|
5007
5007
|
insert: a
|
|
5008
5008
|
},
|
|
5009
|
-
effects:
|
|
5009
|
+
effects: Bo.of({
|
|
5010
5010
|
index: r,
|
|
5011
5011
|
originalText: i
|
|
5012
5012
|
})
|
|
5013
5013
|
}), !0;
|
|
5014
|
-
},
|
|
5015
|
-
let t = e.state.field(
|
|
5014
|
+
}, Wo = (e) => {
|
|
5015
|
+
let t = e.state.field(Ho);
|
|
5016
5016
|
if (t.navigationIndex === -1) return !1;
|
|
5017
5017
|
let n, r;
|
|
5018
5018
|
return t.navigationIndex === 0 ? (n = t.originalText, r = -1) : (r = t.navigationIndex - 1, n = t.prompts[r] ?? ""), e.dispatch({
|
|
@@ -5021,41 +5021,41 @@ var Lo = Io({}), Ro = St.define(), zo = St.define(), Bo = 50, Vo = Tt.define({
|
|
|
5021
5021
|
to: e.state.doc.length,
|
|
5022
5022
|
insert: n
|
|
5023
5023
|
},
|
|
5024
|
-
effects:
|
|
5024
|
+
effects: Bo.of({
|
|
5025
5025
|
index: r,
|
|
5026
5026
|
originalText: t.originalText
|
|
5027
5027
|
})
|
|
5028
5028
|
}), !0;
|
|
5029
5029
|
};
|
|
5030
|
-
function
|
|
5031
|
-
let { storage: t, defaultKeymap: n = !0 } = e, r = [
|
|
5030
|
+
function Go(e = {}) {
|
|
5031
|
+
let { storage: t, defaultKeymap: n = !0 } = e, r = [Ho.init(() => ({
|
|
5032
5032
|
prompts: t?.load?.() ?? [],
|
|
5033
5033
|
navigationIndex: -1,
|
|
5034
5034
|
originalText: ""
|
|
5035
|
-
})),
|
|
5035
|
+
})), Ro.of(t ?? {})];
|
|
5036
5036
|
return n && r.push(Ot.of([{
|
|
5037
5037
|
key: "ArrowUp",
|
|
5038
|
-
run:
|
|
5038
|
+
run: Uo
|
|
5039
5039
|
}, {
|
|
5040
5040
|
key: "ArrowDown",
|
|
5041
|
-
run:
|
|
5041
|
+
run: Wo
|
|
5042
5042
|
}])), r;
|
|
5043
5043
|
}
|
|
5044
5044
|
//#endregion
|
|
5045
5045
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/state.js
|
|
5046
|
-
var
|
|
5046
|
+
var Ko = St.define(), Q = Tt.define({
|
|
5047
5047
|
create() {
|
|
5048
5048
|
return /* @__PURE__ */ new Map();
|
|
5049
5049
|
},
|
|
5050
5050
|
update(e, t) {
|
|
5051
5051
|
let n = !1, r = e;
|
|
5052
|
-
for (let i of t.effects) if (i.is(
|
|
5052
|
+
for (let i of t.effects) if (i.is(Ko)) {
|
|
5053
5053
|
n ||= (r = new Map(e), !0);
|
|
5054
5054
|
for (let [e, t] of i.value) r.set(e, t);
|
|
5055
5055
|
}
|
|
5056
5056
|
return r;
|
|
5057
5057
|
}
|
|
5058
|
-
}),
|
|
5058
|
+
}), qo = Tt.define({
|
|
5059
5059
|
create() {
|
|
5060
5060
|
return {
|
|
5061
5061
|
onResourceClick: void 0,
|
|
@@ -5067,14 +5067,14 @@ var Go = St.define(), Q = Tt.define({
|
|
|
5067
5067
|
update(e) {
|
|
5068
5068
|
return e;
|
|
5069
5069
|
}
|
|
5070
|
-
}),
|
|
5070
|
+
}), Jo = St.define();
|
|
5071
5071
|
Tt.define({
|
|
5072
5072
|
create() {
|
|
5073
5073
|
return /* @__PURE__ */ new Map();
|
|
5074
5074
|
},
|
|
5075
5075
|
update(e, t) {
|
|
5076
5076
|
let n = !1, r = e;
|
|
5077
|
-
for (let i of t.effects) if (i.is(
|
|
5077
|
+
for (let i of t.effects) if (i.is(Jo)) {
|
|
5078
5078
|
n ||= (r = new Map(e), !0);
|
|
5079
5079
|
for (let [e, t] of i.value) r.set(e, t);
|
|
5080
5080
|
}
|
|
@@ -5083,12 +5083,12 @@ Tt.define({
|
|
|
5083
5083
|
});
|
|
5084
5084
|
//#endregion
|
|
5085
5085
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/resources/completion.js
|
|
5086
|
-
var
|
|
5086
|
+
var Yo = (e, t) => async (n) => {
|
|
5087
5087
|
let r = n.matchBefore(/@(\w+)?/);
|
|
5088
5088
|
if (!r || r.from === r.to && !n.explicit) return null;
|
|
5089
5089
|
let i = await e();
|
|
5090
5090
|
if (i.length === 0) return null;
|
|
5091
|
-
let a =
|
|
5091
|
+
let a = Ko.of(new Map(i.map((e) => [e.uri, e])));
|
|
5092
5092
|
n.view && n.view.dispatch({ effects: a });
|
|
5093
5093
|
let o = i.map((e) => ({
|
|
5094
5094
|
label: `@${e.name}`,
|
|
@@ -5110,13 +5110,13 @@ var Jo = (e, t) => async (n) => {
|
|
|
5110
5110
|
from: r.from,
|
|
5111
5111
|
options: o
|
|
5112
5112
|
};
|
|
5113
|
-
},
|
|
5113
|
+
}, Xo = /@[\w-]+:\/\/(?!\/)[^\s]+/;
|
|
5114
5114
|
function $(e) {
|
|
5115
|
-
return e.matchAll(new RegExp(
|
|
5115
|
+
return e.matchAll(new RegExp(Xo.source, "g"));
|
|
5116
5116
|
}
|
|
5117
5117
|
//#endregion
|
|
5118
5118
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/resources/decoration.js
|
|
5119
|
-
var
|
|
5119
|
+
var Zo = class extends Ct {
|
|
5120
5120
|
resource;
|
|
5121
5121
|
view;
|
|
5122
5122
|
constructor(e, t) {
|
|
@@ -5128,7 +5128,7 @@ var Xo = class extends Ct {
|
|
|
5128
5128
|
toDOM() {
|
|
5129
5129
|
let e = document.createElement("span");
|
|
5130
5130
|
e.className = "cm-resource-widget", e.textContent = `@${this.resource.name}`;
|
|
5131
|
-
let t = this.view.state.field(
|
|
5131
|
+
let t = this.view.state.field(qo, !1), n = t?.onResourceClick, r = t?.onResourceMouseOver, i = t?.onResourceMouseOut;
|
|
5132
5132
|
return n && (e.style.cursor = "pointer", e.addEventListener("click", (e) => {
|
|
5133
5133
|
e.preventDefault(), e.stopPropagation(), n(this.resource);
|
|
5134
5134
|
})), r && e.addEventListener("mouseover", (e) => {
|
|
@@ -5137,7 +5137,7 @@ var Xo = class extends Ct {
|
|
|
5137
5137
|
e.preventDefault(), e.stopPropagation(), i(this.resource);
|
|
5138
5138
|
}), e;
|
|
5139
5139
|
}
|
|
5140
|
-
},
|
|
5140
|
+
}, Qo = class extends Ct {
|
|
5141
5141
|
uri;
|
|
5142
5142
|
view;
|
|
5143
5143
|
constructor(e, t) {
|
|
@@ -5151,29 +5151,29 @@ var Xo = class extends Ct {
|
|
|
5151
5151
|
return e.className = "cm-not-found-resource-widget", e.textContent = `@${this.uri.split("://")[1] ?? this.uri}`, e;
|
|
5152
5152
|
}
|
|
5153
5153
|
};
|
|
5154
|
-
function
|
|
5154
|
+
function $o(e) {
|
|
5155
5155
|
let t = e.state.field(Q), n = [];
|
|
5156
5156
|
for (let { from: r, to: i } of e.visibleRanges) {
|
|
5157
5157
|
let a = e.state.doc.sliceString(r, i);
|
|
5158
5158
|
for (let i of $(a)) {
|
|
5159
5159
|
let a = r + i.index, o = i[0].slice(1), s = t.get(o);
|
|
5160
|
-
s ? n.push(bt.replace({ widget: new
|
|
5160
|
+
s ? n.push(bt.replace({ widget: new Zo(s, e) }).range(a, a + i[0].length)) : n.push(bt.replace({ widget: new Qo(o, e) }).range(a, a + i[0].length));
|
|
5161
5161
|
}
|
|
5162
5162
|
}
|
|
5163
5163
|
return bt.set(n);
|
|
5164
5164
|
}
|
|
5165
|
-
var
|
|
5165
|
+
var es = Et.fromClass(class {
|
|
5166
5166
|
decorations;
|
|
5167
5167
|
constructor(e) {
|
|
5168
|
-
this.decorations =
|
|
5168
|
+
this.decorations = $o(e);
|
|
5169
5169
|
}
|
|
5170
5170
|
update(e) {
|
|
5171
|
-
(e.docChanged || e.viewportChanged || e.transactions.some((e) => e.effects.some((e) => e.is(
|
|
5171
|
+
(e.docChanged || e.viewportChanged || e.transactions.some((e) => e.effects.some((e) => e.is(Ko)))) && (this.decorations = $o(e.view));
|
|
5172
5172
|
}
|
|
5173
5173
|
}, { decorations: (e) => e.decorations });
|
|
5174
5174
|
//#endregion
|
|
5175
5175
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/resources/hover.js
|
|
5176
|
-
function
|
|
5176
|
+
function ts(e) {
|
|
5177
5177
|
let t = document.createElement("div");
|
|
5178
5178
|
t.className = "cm-tooltip-cursor";
|
|
5179
5179
|
let n = document.createElement("div");
|
|
@@ -5187,7 +5187,7 @@ function es(e) {
|
|
|
5187
5187
|
}
|
|
5188
5188
|
return { dom: t };
|
|
5189
5189
|
}
|
|
5190
|
-
function
|
|
5190
|
+
function ns(e, t, n, r = 0) {
|
|
5191
5191
|
for (let i of $(e)) {
|
|
5192
5192
|
let e = r + i.index, a = e + i[0].length;
|
|
5193
5193
|
if (t >= e && t <= a) {
|
|
@@ -5201,22 +5201,22 @@ function ts(e, t, n, r = 0) {
|
|
|
5201
5201
|
}
|
|
5202
5202
|
return null;
|
|
5203
5203
|
}
|
|
5204
|
-
function
|
|
5204
|
+
function rs(e) {
|
|
5205
5205
|
return kt((t, n) => {
|
|
5206
|
-
let { from: r, text: i } = t.state.doc.lineAt(n), a =
|
|
5206
|
+
let { from: r, text: i } = t.state.doc.lineAt(n), a = ns(i, n, t.state.field(Q), r);
|
|
5207
5207
|
return a ? {
|
|
5208
5208
|
pos: a.start,
|
|
5209
5209
|
end: a.end,
|
|
5210
5210
|
above: !0,
|
|
5211
5211
|
create() {
|
|
5212
|
-
return (e.createTooltip ??
|
|
5212
|
+
return (e.createTooltip ?? ts)(a.resource);
|
|
5213
5213
|
}
|
|
5214
5214
|
} : null;
|
|
5215
5215
|
});
|
|
5216
5216
|
}
|
|
5217
5217
|
//#endregion
|
|
5218
5218
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/resources/input-filter.js
|
|
5219
|
-
function
|
|
5219
|
+
function is(e, t) {
|
|
5220
5220
|
let n = e.field(Q), r = e.doc, i = r.lineAt(t), a = r.sliceString(i.from, i.to), o = Array.from($(a));
|
|
5221
5221
|
if (o.length === 0) return null;
|
|
5222
5222
|
for (let e of o) {
|
|
@@ -5229,7 +5229,7 @@ function rs(e, t) {
|
|
|
5229
5229
|
}
|
|
5230
5230
|
return null;
|
|
5231
5231
|
}
|
|
5232
|
-
function
|
|
5232
|
+
function as(e, t) {
|
|
5233
5233
|
let n = e.field(Q), r = e.doc, i = r.lineAt(t).to, a = r.sliceString(t, i), o = Array.from($(a));
|
|
5234
5234
|
if (o.length === 0) return null;
|
|
5235
5235
|
let s = o[0];
|
|
@@ -5241,7 +5241,7 @@ function is(e, t) {
|
|
|
5241
5241
|
uri: u
|
|
5242
5242
|
} : null;
|
|
5243
5243
|
}
|
|
5244
|
-
function
|
|
5244
|
+
function os(e, t) {
|
|
5245
5245
|
let n = e.field(Q), r = e.doc, i = r.lineAt(t), a = r.sliceString(i.from, i.to), o = Array.from($(a));
|
|
5246
5246
|
for (let e of o) {
|
|
5247
5247
|
let r = i.from + e.index, a = r + e[0].length, o = e[0].slice(1);
|
|
@@ -5253,7 +5253,7 @@ function as(e, t) {
|
|
|
5253
5253
|
}
|
|
5254
5254
|
return null;
|
|
5255
5255
|
}
|
|
5256
|
-
function
|
|
5256
|
+
function ss(e, t) {
|
|
5257
5257
|
let n = e.field(Q), r = e.doc, i = r.lineAt(t), a = r.sliceString(i.from, t), o = Array.from($(a)), s = null;
|
|
5258
5258
|
for (let e of o) {
|
|
5259
5259
|
let r = i.from + e.index, a = r + e[0].length, o = e[0].slice(1);
|
|
@@ -5261,7 +5261,7 @@ function os(e, t) {
|
|
|
5261
5261
|
}
|
|
5262
5262
|
return s;
|
|
5263
5263
|
}
|
|
5264
|
-
function
|
|
5264
|
+
function cs(e, t) {
|
|
5265
5265
|
let n = e.field(Q), r = e.doc, i = r.lineAt(t), a = r.sliceString(i.from, i.to), o = Array.from($(a));
|
|
5266
5266
|
for (let e of o) {
|
|
5267
5267
|
let r = i.from + e.index, a = r + e[0].length, o = e[0].slice(1);
|
|
@@ -5272,7 +5272,7 @@ function ss(e, t) {
|
|
|
5272
5272
|
}
|
|
5273
5273
|
return null;
|
|
5274
5274
|
}
|
|
5275
|
-
var
|
|
5275
|
+
var ls = Dt.transactionFilter.of((e) => {
|
|
5276
5276
|
let t = e.annotation(yt.userEvent);
|
|
5277
5277
|
if (!t) return e;
|
|
5278
5278
|
let n = e.startState.selection.main;
|
|
@@ -5321,7 +5321,7 @@ var cs = Dt.transactionFilter.of((e) => {
|
|
|
5321
5321
|
}
|
|
5322
5322
|
if (t === "delete.backward" || t === "delete.forward") {
|
|
5323
5323
|
let r = null;
|
|
5324
|
-
return t === "delete.backward" ? r =
|
|
5324
|
+
return t === "delete.backward" ? r = is(e.startState, n.head) : t === "delete.forward" && (r = as(e.startState, n.head)), r ? [{
|
|
5325
5325
|
changes: {
|
|
5326
5326
|
from: r.from,
|
|
5327
5327
|
to: r.to,
|
|
@@ -5334,11 +5334,11 @@ var cs = Dt.transactionFilter.of((e) => {
|
|
|
5334
5334
|
if (e.selection?.main.empty && n.empty && !t.startsWith("input") && t !== "input.type") {
|
|
5335
5335
|
let t = n.head, r = e.selection.main.head, i = null;
|
|
5336
5336
|
if (r < t) {
|
|
5337
|
-
let n =
|
|
5338
|
-
i = n && t > n.from ? n.from :
|
|
5337
|
+
let n = os(e.startState, t);
|
|
5338
|
+
i = n && t > n.from ? n.from : ss(e.startState, t);
|
|
5339
5339
|
} else if (r > t) {
|
|
5340
|
-
let n =
|
|
5341
|
-
i = n && t < n.to ? n.to :
|
|
5340
|
+
let n = os(e.startState, t);
|
|
5341
|
+
i = n && t < n.to ? n.to : cs(e.startState, t);
|
|
5342
5342
|
}
|
|
5343
5343
|
if (i !== null && i !== r) return [{
|
|
5344
5344
|
selection: { anchor: i },
|
|
@@ -5346,8 +5346,8 @@ var cs = Dt.transactionFilter.of((e) => {
|
|
|
5346
5346
|
}];
|
|
5347
5347
|
}
|
|
5348
5348
|
return e;
|
|
5349
|
-
}),
|
|
5350
|
-
function
|
|
5349
|
+
}), us = 150;
|
|
5350
|
+
function ds(e, t) {
|
|
5351
5351
|
let n = /* @__PURE__ */ new Set();
|
|
5352
5352
|
for (let r of $(e)) {
|
|
5353
5353
|
let e = r[0].slice(1);
|
|
@@ -5355,13 +5355,13 @@ function us(e, t) {
|
|
|
5355
5355
|
}
|
|
5356
5356
|
return [...n];
|
|
5357
5357
|
}
|
|
5358
|
-
function
|
|
5358
|
+
function fs(e) {
|
|
5359
5359
|
return [...e].sort().join("\n");
|
|
5360
5360
|
}
|
|
5361
|
-
function
|
|
5361
|
+
function ps(e) {
|
|
5362
5362
|
return !$(e).next().done;
|
|
5363
5363
|
}
|
|
5364
|
-
function
|
|
5364
|
+
function ms(e) {
|
|
5365
5365
|
let t = [], n = [];
|
|
5366
5366
|
return e.changes.iterChanges((r, i, a, o) => {
|
|
5367
5367
|
let s = e.startState.doc.lineAt(r), c = e.startState.doc.lineAt(i === r ? r : i - 1);
|
|
@@ -5373,8 +5373,8 @@ function ps(e) {
|
|
|
5373
5373
|
after: n.join("\n")
|
|
5374
5374
|
};
|
|
5375
5375
|
}
|
|
5376
|
-
function
|
|
5377
|
-
let n = t.debounceMs ??
|
|
5376
|
+
function hs(e, t) {
|
|
5377
|
+
let n = t.debounceMs ?? us, { logger: r, resolve: i } = t;
|
|
5378
5378
|
return class {
|
|
5379
5379
|
view;
|
|
5380
5380
|
timer;
|
|
@@ -5387,8 +5387,8 @@ function ms(e, t) {
|
|
|
5387
5387
|
}
|
|
5388
5388
|
update(e) {
|
|
5389
5389
|
if (e.docChanged) {
|
|
5390
|
-
let t =
|
|
5391
|
-
if (
|
|
5390
|
+
let t = ms(e);
|
|
5391
|
+
if (ps(t.before)) {
|
|
5392
5392
|
this.maybeSchedule(e.view);
|
|
5393
5393
|
return;
|
|
5394
5394
|
}
|
|
@@ -5400,11 +5400,11 @@ function ms(e, t) {
|
|
|
5400
5400
|
}
|
|
5401
5401
|
maybeSchedule(e, t) {
|
|
5402
5402
|
let r = t ?? e.state.doc.toString();
|
|
5403
|
-
if (!
|
|
5403
|
+
if (!ps(r)) {
|
|
5404
5404
|
t === void 0 && (this.lastKey = "", this.clearTimer());
|
|
5405
5405
|
return;
|
|
5406
5406
|
}
|
|
5407
|
-
let i = ds(
|
|
5407
|
+
let i = fs(ds(r, e.state.field(Q)));
|
|
5408
5408
|
i === "" ? t === void 0 && (this.lastKey = "", this.clearTimer()) : i === this.lastKey ? this.clearTimer() : (this.clearTimer(), this.timer = setTimeout(() => {
|
|
5409
5409
|
this.timer = void 0, this.run(e);
|
|
5410
5410
|
}, n));
|
|
@@ -5420,12 +5420,12 @@ function ms(e, t) {
|
|
|
5420
5420
|
try {
|
|
5421
5421
|
do {
|
|
5422
5422
|
this.rerun = !1;
|
|
5423
|
-
let n =
|
|
5423
|
+
let n = ds(t.state.doc.toString(), t.state.field(Q));
|
|
5424
5424
|
if (n.length === 0) {
|
|
5425
5425
|
this.lastKey = "";
|
|
5426
5426
|
break;
|
|
5427
5427
|
}
|
|
5428
|
-
this.lastKey =
|
|
5428
|
+
this.lastKey = fs(n);
|
|
5429
5429
|
let r = i ? await i(n) : await e();
|
|
5430
5430
|
if (this.destroyed) return;
|
|
5431
5431
|
let a = new Set(n), o = r.filter((e) => a.has(e.uri));
|
|
@@ -5433,7 +5433,7 @@ function ms(e, t) {
|
|
|
5433
5433
|
if (this.rerun) continue;
|
|
5434
5434
|
break;
|
|
5435
5435
|
}
|
|
5436
|
-
t.dispatch({ effects:
|
|
5436
|
+
t.dispatch({ effects: Ko.of(new Map(o.map((e) => [e.uri, e]))) }), this.rerun = !0;
|
|
5437
5437
|
} while (this.rerun);
|
|
5438
5438
|
} catch (e) {
|
|
5439
5439
|
this.lastKey = "", r?.error("Failed to sync resources:", e);
|
|
@@ -5445,12 +5445,12 @@ function ms(e, t) {
|
|
|
5445
5445
|
}
|
|
5446
5446
|
};
|
|
5447
5447
|
}
|
|
5448
|
-
function
|
|
5449
|
-
return Et.fromClass(
|
|
5448
|
+
function gs(e, t = {}) {
|
|
5449
|
+
return Et.fromClass(hs(e, t));
|
|
5450
5450
|
}
|
|
5451
5451
|
//#endregion
|
|
5452
5452
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/theme.js
|
|
5453
|
-
var
|
|
5453
|
+
var _s = wt.baseTheme({
|
|
5454
5454
|
".cm-resource-widget": {
|
|
5455
5455
|
background: "light-dark(rgba(86,156,214,0.08),rgba(86,156,214,0.18))",
|
|
5456
5456
|
borderRadius: "4px",
|
|
@@ -5466,134 +5466,133 @@ var gs = wt.baseTheme({
|
|
|
5466
5466
|
color: "light-dark(#b00020,#ff8080)",
|
|
5467
5467
|
fontWeight: "500"
|
|
5468
5468
|
}
|
|
5469
|
-
}),
|
|
5469
|
+
}), vs = "_none_", ys = [{
|
|
5470
5470
|
uri: "",
|
|
5471
5471
|
name: "No resources",
|
|
5472
|
-
type:
|
|
5472
|
+
type: vs,
|
|
5473
5473
|
data: {}
|
|
5474
|
-
}],
|
|
5474
|
+
}], bs = {
|
|
5475
5475
|
info: "Variables, dataframes, and tables will appear here.",
|
|
5476
5476
|
apply: () => {}
|
|
5477
5477
|
};
|
|
5478
|
-
function bs(e) {
|
|
5479
|
-
let t = jo(e).getAllItems();
|
|
5480
|
-
return t.length === 0 ? vs : t;
|
|
5481
|
-
}
|
|
5482
5478
|
function xs(e) {
|
|
5483
|
-
let
|
|
5479
|
+
let t = Mo(e).getAllItems();
|
|
5480
|
+
return t.length === 0 ? ys : t;
|
|
5481
|
+
}
|
|
5482
|
+
function Ss(e) {
|
|
5483
|
+
let { language: t, store: r, onAddFiles: i } = e, a = () => xs(r);
|
|
5484
5484
|
return [
|
|
5485
|
-
t.data.of({ autocomplete:
|
|
5485
|
+
t.data.of({ autocomplete: Yo(async () => a(), (e) => e.type === vs ? bs : Mo(r).getProvider(e.type)?.formatCompletion(e) || {}) }),
|
|
5486
5486
|
xt.high(Ot.of([{
|
|
5487
5487
|
key: "Tab",
|
|
5488
5488
|
preventDefault: !0,
|
|
5489
5489
|
run: (e) => jt(e)
|
|
5490
5490
|
}])),
|
|
5491
|
-
|
|
5492
|
-
...i ? [t.data.of({ autocomplete:
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5491
|
+
Do.of({ addAttachment: (e) => i?.([e]) }),
|
|
5492
|
+
...i ? [t.data.of({ autocomplete: No().createCompletionSource() })] : [],
|
|
5493
|
+
es,
|
|
5494
|
+
ls,
|
|
5495
|
+
gs(a, { logger: n }),
|
|
5496
5496
|
Q.init(() => {
|
|
5497
|
-
let e =
|
|
5497
|
+
let e = xs(r);
|
|
5498
5498
|
return new Map(e.map((e) => [e.uri, e]));
|
|
5499
5499
|
}),
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
let t =
|
|
5503
|
-
if (!t) return n.warn("No provider found for resource", e),
|
|
5500
|
+
_s,
|
|
5501
|
+
rs({ createTooltip: (e) => {
|
|
5502
|
+
let t = Mo(r).getProvider(e.type);
|
|
5503
|
+
if (!t) return n.warn("No provider found for resource", e), Cs(e.description || e.name);
|
|
5504
5504
|
let i = t.formatCompletion(e), a = e.description || e.name;
|
|
5505
|
-
if (!i?.info) return
|
|
5506
|
-
if (typeof i.info == "string") return
|
|
5505
|
+
if (!i?.info) return Cs(a);
|
|
5506
|
+
if (typeof i.info == "string") return Cs(i.info);
|
|
5507
5507
|
let o = i.info(i);
|
|
5508
|
-
return o ? "dom" in o ? { dom: o.dom } : "then" in o ? (n.warn("info is a promise. This is not supported", o),
|
|
5508
|
+
return o ? "dom" in o ? { dom: o.dom } : "then" in o ? (n.warn("info is a promise. This is not supported", o), Cs(a)) : { dom: o } : Cs(a);
|
|
5509
5509
|
} })
|
|
5510
5510
|
];
|
|
5511
5511
|
}
|
|
5512
|
-
function
|
|
5512
|
+
function Cs(e) {
|
|
5513
5513
|
let t = document.createElement("div");
|
|
5514
5514
|
return t.textContent = e, { dom: t };
|
|
5515
5515
|
}
|
|
5516
5516
|
//#endregion
|
|
5517
5517
|
//#region src/components/editor/ai/prompt-input.tsx
|
|
5518
|
-
var
|
|
5519
|
-
let t = (0,
|
|
5520
|
-
t[0] ===
|
|
5521
|
-
let
|
|
5522
|
-
if (t[2] !==
|
|
5523
|
-
let e = Pt();
|
|
5524
|
-
t[9] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
5518
|
+
var ws = "marimo:ai-prompt-history", Ts = new we(dt(tt()), () => []), Es = (e) => {
|
|
5519
|
+
let t = (0, L.c)(28), { value: n, placeholder: i, placeholderAction: a, inputRef: o, className: s, onChange: c, onSubmit: l, onKeyDown: u, onClose: d, onAddFiles: f, additionalCompletions: p, maxHeight: m } = e, h = vt(l), _ = vt(d), v = mt(), { theme: y } = nt(), b;
|
|
5520
|
+
t[0] === p ? b = t[1] : (b = (e) => p ? Po([p.triggerCompletionRegex], p.completions)(e) : null, t[0] = p, t[1] = b);
|
|
5521
|
+
let x = vt(b), S;
|
|
5522
|
+
if (t[2] !== x || t[3] !== _ || t[4] !== h || t[5] !== f || t[6] !== a || t[7] !== v) {
|
|
5523
|
+
let e = Pt(), n;
|
|
5524
|
+
t[9] === Symbol.for("react.memo_cache_sentinel") ? (n = Nt({}), t[9] = n) : n = t[9];
|
|
5525
|
+
let r = Ss({
|
|
5525
5526
|
language: e.language,
|
|
5526
|
-
store:
|
|
5527
|
-
onAddFiles:
|
|
5528
|
-
}),
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
let
|
|
5566
|
-
t[
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
ref: a,
|
|
5570
|
-
className: A,
|
|
5527
|
+
store: v,
|
|
5528
|
+
onAddFiles: f
|
|
5529
|
+
}), i = e.language.data.of({ autocomplete: x }), o;
|
|
5530
|
+
t[10] === Symbol.for("react.memo_cache_sentinel") ? (o = Go({ storage: {
|
|
5531
|
+
load: Ds,
|
|
5532
|
+
save: Os
|
|
5533
|
+
} }), t[10] = o) : o = t[10];
|
|
5534
|
+
let s;
|
|
5535
|
+
t[11] === Symbol.for("react.memo_cache_sentinel") ? (s = Ft(), t[11] = s) : s = t[11];
|
|
5536
|
+
let c;
|
|
5537
|
+
t[12] === h ? c = t[13] : (c = xt.highest(Ot.of([{
|
|
5538
|
+
preventDefault: !0,
|
|
5539
|
+
stopPropagation: !0,
|
|
5540
|
+
any: (e, t) => {
|
|
5541
|
+
let n = t.metaKey || t.ctrlKey || t.shiftKey;
|
|
5542
|
+
return t.key === "Enter" && !n ? (h(t, e.state.doc.toString()), t.preventDefault(), t.stopPropagation(), !0) : t.key === "Enter" && t.shiftKey ? (e.dispatch(e.state.replaceSelection("\n")), t.preventDefault(), t.stopPropagation(), !0) : !1;
|
|
5543
|
+
}
|
|
5544
|
+
}])), t[12] = h, t[13] = c);
|
|
5545
|
+
let l;
|
|
5546
|
+
t[14] === _ ? l = t[15] : (l = Ot.of([{
|
|
5547
|
+
key: "Escape",
|
|
5548
|
+
preventDefault: !0,
|
|
5549
|
+
stopPropagation: !0,
|
|
5550
|
+
run: () => (_(), !0)
|
|
5551
|
+
}]), t[14] = _, t[15] = l), S = [
|
|
5552
|
+
...a ? g(a) : [],
|
|
5553
|
+
n,
|
|
5554
|
+
e,
|
|
5555
|
+
r,
|
|
5556
|
+
i,
|
|
5557
|
+
o,
|
|
5558
|
+
wt.lineWrapping,
|
|
5559
|
+
s,
|
|
5560
|
+
c,
|
|
5561
|
+
l
|
|
5562
|
+
], t[2] = x, t[3] = _, t[4] = h, t[5] = f, t[6] = a, t[7] = v, t[8] = S;
|
|
5563
|
+
} else S = t[8];
|
|
5564
|
+
let C = S, w;
|
|
5565
|
+
t[16] === s ? w = t[17] : (w = r("mo-ai-prompt flex-1 font-sans text-sm leading-6 overflow-auto my-1", s), t[16] = s, t[17] = w);
|
|
5566
|
+
let T = y === "dark" ? "dark" : "light", E = a ? void 0 : i || "Generate with AI, @ to include context", D;
|
|
5567
|
+
return t[18] !== C || t[19] !== o || t[20] !== m || t[21] !== c || t[22] !== u || t[23] !== w || t[24] !== T || t[25] !== E || t[26] !== n ? (D = /* @__PURE__ */ (0, Z.jsx)(It, {
|
|
5568
|
+
ref: o,
|
|
5569
|
+
className: w,
|
|
5571
5570
|
width: "100%",
|
|
5572
|
-
maxHeight:
|
|
5571
|
+
maxHeight: m,
|
|
5573
5572
|
value: n,
|
|
5574
5573
|
basicSetup: !1,
|
|
5575
|
-
extensions:
|
|
5576
|
-
onChange:
|
|
5577
|
-
onKeyDown:
|
|
5578
|
-
theme:
|
|
5579
|
-
placeholder:
|
|
5580
|
-
}), t[
|
|
5574
|
+
extensions: C,
|
|
5575
|
+
onChange: c,
|
|
5576
|
+
onKeyDown: u,
|
|
5577
|
+
theme: T,
|
|
5578
|
+
placeholder: E
|
|
5579
|
+
}), t[18] = C, t[19] = o, t[20] = m, t[21] = c, t[22] = u, t[23] = w, t[24] = T, t[25] = E, t[26] = n, t[27] = D) : D = t[27], D;
|
|
5581
5580
|
};
|
|
5582
|
-
function
|
|
5583
|
-
return
|
|
5581
|
+
function Ds() {
|
|
5582
|
+
return Ts.get(ws);
|
|
5584
5583
|
}
|
|
5585
|
-
function
|
|
5586
|
-
return
|
|
5584
|
+
function Os(e) {
|
|
5585
|
+
return Ts.set(ws, e);
|
|
5587
5586
|
}
|
|
5588
5587
|
//#endregion
|
|
5589
5588
|
//#region src/plugins/impl/chat/chat-ui.tsx
|
|
5590
|
-
var
|
|
5589
|
+
var ks = ce, As = st({
|
|
5591
5590
|
type: Ge("stream_chunk"),
|
|
5592
5591
|
message_id: tt(),
|
|
5593
5592
|
content: Je().nullable().transform((e) => e),
|
|
5594
5593
|
is_final: qe().optional()
|
|
5595
5594
|
});
|
|
5596
|
-
function
|
|
5595
|
+
function js(e, t) {
|
|
5597
5596
|
let { controllerRef: r, activeRequestIdRef: i } = t, a = r.current;
|
|
5598
5597
|
if (a === null) return "dropped-no-controller";
|
|
5599
5598
|
let o = i.current;
|
|
@@ -5602,32 +5601,32 @@ function As(e, t) {
|
|
|
5602
5601
|
activeRequestId: o
|
|
5603
5602
|
}), "dropped-stale") : (e.content && a.enqueue(e.content), e.is_final ? (a.close(), r.current = null, i.current = null, "closed") : "enqueued");
|
|
5604
5603
|
}
|
|
5605
|
-
var
|
|
5606
|
-
let [t, o] = (0, X.useState)(""), [s, c] = (0, X.useState)(e.config), [u, d] = (0, X.useState)(e.config), [
|
|
5604
|
+
var Ms = (e) => {
|
|
5605
|
+
let [t, o] = (0, X.useState)(""), [s, c] = (0, X.useState)(e.config), [u, d] = (0, X.useState)(e.config), [f, p] = (0, X.useState)(void 0), m = (0, X.useRef)(null), h = (0, X.useRef)(null), g = (0, X.useRef)(null), _ = (0, X.useRef)(null);
|
|
5607
5606
|
Object.keys(e.config).some((t) => e.config[t] !== u[t]) && (c(e.config), d(e.config));
|
|
5608
|
-
let
|
|
5607
|
+
let v = (0, X.useRef)(s);
|
|
5609
5608
|
(0, X.useLayoutEffect)(() => {
|
|
5610
|
-
|
|
5609
|
+
v.current = s;
|
|
5611
5610
|
}, [s]);
|
|
5612
5611
|
let b = (0, X.useRef)(null), x = (0, X.useRef)(null), S = (0, X.useRef)(null), [C, w] = (0, X.useState)(null), T = () => {
|
|
5613
5612
|
S.current = null, w(null);
|
|
5614
|
-
}, { data: E } = Lt(async () => (await e.get_chat_history({})).messages, []),
|
|
5615
|
-
sendAutomaticallyWhen: ({ messages: e }) =>
|
|
5616
|
-
transport: new
|
|
5613
|
+
}, { data: E } = Lt(async () => (await e.get_chat_history({})).messages, []), O = e.value.length > 0 ? e.value : E, { messages: k, sendMessage: A, setMessages: j, status: M, stop: N, error: P, regenerate: te, clearError: F, addToolApprovalResponse: ne } = ba({
|
|
5614
|
+
sendAutomaticallyWhen: ({ messages: e }) => Io(e),
|
|
5615
|
+
transport: new aa({ fetch: async (t, r) => {
|
|
5617
5616
|
if (r === void 0) return fetch(t);
|
|
5618
5617
|
let i = JSON.parse(r.body), a = r.signal, o = {
|
|
5619
|
-
max_tokens:
|
|
5620
|
-
temperature:
|
|
5621
|
-
top_p:
|
|
5622
|
-
top_k:
|
|
5623
|
-
frequency_penalty:
|
|
5624
|
-
presence_penalty:
|
|
5618
|
+
max_tokens: v.current.max_tokens,
|
|
5619
|
+
temperature: v.current.temperature,
|
|
5620
|
+
top_p: v.current.top_p,
|
|
5621
|
+
top_k: v.current.top_k,
|
|
5622
|
+
frequency_penalty: v.current.frequency_penalty,
|
|
5623
|
+
presence_penalty: v.current.presence_penalty
|
|
5625
5624
|
};
|
|
5626
5625
|
try {
|
|
5627
5626
|
let t = i.messages.map((e) => ({
|
|
5628
5627
|
...e,
|
|
5629
5628
|
content: e.parts?.map((e) => "text" in e ? e.text : "").join("\n")
|
|
5630
|
-
})), r =
|
|
5629
|
+
})), r = D();
|
|
5631
5630
|
T();
|
|
5632
5631
|
let s = new ReadableStream({
|
|
5633
5632
|
start(t) {
|
|
@@ -5656,25 +5655,25 @@ var js = (e) => {
|
|
|
5656
5655
|
config: o
|
|
5657
5656
|
}).catch((e) => {
|
|
5658
5657
|
b.current?.error(e), b.current = null, x.current = null;
|
|
5659
|
-
}),
|
|
5658
|
+
}), Bi({ stream: s });
|
|
5660
5659
|
} catch (e) {
|
|
5661
5660
|
if (e instanceof Error && e.name === "AbortError") return new Response("Aborted", { status: 499 });
|
|
5662
5661
|
let t = e.message?.split("failed with exception ").pop();
|
|
5663
5662
|
return new Response(t, { status: 400 });
|
|
5664
5663
|
}
|
|
5665
5664
|
} }),
|
|
5666
|
-
messages:
|
|
5665
|
+
messages: O,
|
|
5667
5666
|
onFinish: ({ messages: t, isAbort: r, finishReason: i }) => {
|
|
5668
|
-
if (
|
|
5667
|
+
if (p(void 0), m.current && (m.current.value = ""), n.debug("Finished streaming message:", {
|
|
5669
5668
|
finishReason: i,
|
|
5670
5669
|
isAbort: r
|
|
5671
5670
|
}), r) {
|
|
5672
|
-
let e =
|
|
5671
|
+
let e = Ca({
|
|
5673
5672
|
isAbort: !0,
|
|
5674
5673
|
streamReason: S.current
|
|
5675
5674
|
});
|
|
5676
5675
|
if (T(), e != null) {
|
|
5677
|
-
let t =
|
|
5676
|
+
let t = wa(e);
|
|
5678
5677
|
n.debug("Chat stream aborted", {
|
|
5679
5678
|
reason: e,
|
|
5680
5679
|
finishReason: i
|
|
@@ -5688,23 +5687,23 @@ var js = (e) => {
|
|
|
5688
5687
|
}
|
|
5689
5688
|
});
|
|
5690
5689
|
i(e.host, Le.TYPE, (e) => {
|
|
5691
|
-
let t =
|
|
5690
|
+
let t = As.safeParse(e.detail.message);
|
|
5692
5691
|
if (t.success) {
|
|
5693
5692
|
if (t.data.content && t.data.message_id === x.current) {
|
|
5694
|
-
let e =
|
|
5693
|
+
let e = Sa(t.data.content);
|
|
5695
5694
|
e !== void 0 && (S.current = e);
|
|
5696
5695
|
}
|
|
5697
|
-
|
|
5696
|
+
js(t.data, {
|
|
5698
5697
|
controllerRef: b,
|
|
5699
5698
|
activeRequestIdRef: x
|
|
5700
5699
|
});
|
|
5701
5700
|
}
|
|
5702
5701
|
});
|
|
5703
|
-
let re =
|
|
5704
|
-
let n =
|
|
5702
|
+
let re = M === "submitted" || M === "streaming", ie = (t) => {
|
|
5703
|
+
let n = k.findIndex((e) => e.id === t);
|
|
5705
5704
|
if (n !== -1) {
|
|
5706
|
-
let r =
|
|
5707
|
-
e.delete_chat_message({ index: n }),
|
|
5705
|
+
let r = k.filter((e) => e.id !== t);
|
|
5706
|
+
e.delete_chat_message({ index: n }), j(r), e.setValue(r), r.length === 0 && T();
|
|
5708
5707
|
}
|
|
5709
5708
|
}, ae = Array.isArray(e.allowAttachments) && e.allowAttachments.length > 0 || e.allowAttachments === !0, oe = {
|
|
5710
5709
|
triggerCompletionRegex: /^\/(\w+)?/,
|
|
@@ -5713,15 +5712,15 @@ var js = (e) => {
|
|
|
5713
5712
|
displayLabel: e,
|
|
5714
5713
|
apply: e
|
|
5715
5714
|
}))
|
|
5716
|
-
},
|
|
5715
|
+
}, se = e.prompts.length > 0 ? "Type your message here, / for prompts" : "Type your message here...";
|
|
5717
5716
|
(0, X.useEffect)(() => {
|
|
5718
|
-
|
|
5719
|
-
top:
|
|
5717
|
+
_.current?.scrollTo({
|
|
5718
|
+
top: _.current.scrollHeight,
|
|
5720
5719
|
behavior: "smooth"
|
|
5721
5720
|
});
|
|
5722
|
-
}, [
|
|
5723
|
-
let
|
|
5724
|
-
let e =
|
|
5721
|
+
}, [k.length, _]);
|
|
5722
|
+
let ce = () => {
|
|
5723
|
+
let e = g.current?.view;
|
|
5725
5724
|
if (e) {
|
|
5726
5725
|
let t = e.state.doc.length;
|
|
5727
5726
|
e.dispatch({ changes: {
|
|
@@ -5742,18 +5741,18 @@ var js = (e) => {
|
|
|
5742
5741
|
"aria-label": "Reset chat",
|
|
5743
5742
|
variant: "text",
|
|
5744
5743
|
size: "icon",
|
|
5745
|
-
disabled:
|
|
5744
|
+
disabled: k.length === 0,
|
|
5746
5745
|
onClick: () => {
|
|
5747
|
-
|
|
5746
|
+
j([]), e.setValue([]), e.delete_chat_history({}), F(), T();
|
|
5748
5747
|
},
|
|
5749
5748
|
children: /* @__PURE__ */ (0, Z.jsx)(Jt, { className: "h-3 w-3" })
|
|
5750
5749
|
})
|
|
5751
5750
|
}),
|
|
5752
5751
|
/* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
5753
5752
|
className: "grow overflow-y-auto gap-4 pt-8 pb-4 px-2 flex flex-col",
|
|
5754
|
-
ref:
|
|
5753
|
+
ref: _,
|
|
5755
5754
|
children: [
|
|
5756
|
-
|
|
5755
|
+
k.length === 0 && /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
5757
5756
|
className: "flex flex-col items-center justify-center h-full text-muted-foreground text-center p-4",
|
|
5758
5757
|
children: [
|
|
5759
5758
|
/* @__PURE__ */ (0, Z.jsx)(Bt, { className: "h-12 w-12 mb-4" }),
|
|
@@ -5767,17 +5766,17 @@ var js = (e) => {
|
|
|
5767
5766
|
})
|
|
5768
5767
|
]
|
|
5769
5768
|
}),
|
|
5770
|
-
|
|
5771
|
-
let n = e.parts?.filter((e) => e.type === "text").map((e) => e.text).join("\n"), i = t ===
|
|
5769
|
+
k.map((e, t) => {
|
|
5770
|
+
let n = e.parts?.filter((e) => e.type === "text").map((e) => e.text).join("\n"), i = t === k.length - 1;
|
|
5772
5771
|
return /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
5773
5772
|
className: r("flex flex-col group gap-2", e.role === "user" ? "items-end" : "items-start"),
|
|
5774
5773
|
children: [/* @__PURE__ */ (0, Z.jsx)("div", {
|
|
5775
5774
|
className: `max-w-[80%] p-3 rounded-lg ${e.role === "user" ? "bg-(--sky-11) text-(--slate-1) whitespace-pre-wrap" : "bg-(--slate-4) text-(--slate-12) [--muted-foreground:var(--slate-11)]"}`,
|
|
5776
|
-
children:
|
|
5775
|
+
children: no({
|
|
5777
5776
|
message: e,
|
|
5778
5777
|
isLast: i,
|
|
5779
5778
|
isActive: re,
|
|
5780
|
-
addToolApprovalResponse: i ?
|
|
5779
|
+
addToolApprovalResponse: i ? ne : void 0
|
|
5781
5780
|
})
|
|
5782
5781
|
}), /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
5783
5782
|
className: "flex justify-end text-xs gap-2 opacity-0 group-hover:opacity-100 focus-within:opacity-100",
|
|
@@ -5790,25 +5789,25 @@ var js = (e) => {
|
|
|
5790
5789
|
"aria-label": "Delete message",
|
|
5791
5790
|
onClick: () => ie(e.id),
|
|
5792
5791
|
className: "text-xs text-(--slate-9) hover:text-(--slate-11)",
|
|
5793
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
5792
|
+
children: /* @__PURE__ */ (0, Z.jsx)(y, { className: "h-3 w-3 text-(--red-9)" })
|
|
5794
5793
|
})]
|
|
5795
5794
|
})]
|
|
5796
5795
|
}, e.id);
|
|
5797
5796
|
}),
|
|
5798
|
-
re &&
|
|
5797
|
+
re && k.at(-1)?.role !== "assistant" && /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
5799
5798
|
className: "flex items-center justify-center mb-4",
|
|
5800
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
5799
|
+
children: /* @__PURE__ */ (0, Z.jsx)(ee, { size: "small" })
|
|
5801
5800
|
}),
|
|
5802
|
-
|
|
5801
|
+
P && /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
5803
5802
|
className: "flex items-center justify-center space-x-2 mb-4",
|
|
5804
|
-
children: [/* @__PURE__ */ (0, Z.jsx)(ht, { error:
|
|
5803
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(ht, { error: P }), /* @__PURE__ */ (0, Z.jsx)(a, {
|
|
5805
5804
|
variant: "outline",
|
|
5806
5805
|
size: "sm",
|
|
5807
|
-
onClick: () =>
|
|
5806
|
+
onClick: () => te(),
|
|
5808
5807
|
children: "Retry"
|
|
5809
5808
|
})]
|
|
5810
5809
|
}),
|
|
5811
|
-
C && !re && !
|
|
5810
|
+
C && !re && !P && /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
5812
5811
|
className: "flex justify-center py-2",
|
|
5813
5812
|
children: /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
5814
5813
|
className: "text-xs text-muted-foreground",
|
|
@@ -5820,61 +5819,61 @@ var js = (e) => {
|
|
|
5820
5819
|
/* @__PURE__ */ (0, Z.jsxs)("form", {
|
|
5821
5820
|
onSubmit: async (n) => {
|
|
5822
5821
|
if (n.preventDefault(), e.disabled) return;
|
|
5823
|
-
let r =
|
|
5824
|
-
|
|
5822
|
+
let r = f ? await Fo(f) : void 0;
|
|
5823
|
+
A({
|
|
5825
5824
|
role: "user",
|
|
5826
5825
|
parts: [{
|
|
5827
5826
|
type: "text",
|
|
5828
5827
|
text: t
|
|
5829
5828
|
}, ...r ?? []]
|
|
5830
|
-
}),
|
|
5829
|
+
}), ce();
|
|
5831
5830
|
},
|
|
5832
|
-
ref:
|
|
5831
|
+
ref: h,
|
|
5833
5832
|
inert: e.disabled || void 0,
|
|
5834
5833
|
className: r("flex w-full border-t border-(--slate-6) px-2 py-1 items-center", e.disabled && "opacity-50 cursor-not-allowed"),
|
|
5835
5834
|
children: [
|
|
5836
|
-
e.showConfigurationControls && /* @__PURE__ */ (0, Z.jsx)(
|
|
5835
|
+
e.showConfigurationControls && /* @__PURE__ */ (0, Z.jsx)(Ps, {
|
|
5837
5836
|
config: s,
|
|
5838
5837
|
onChange: c
|
|
5839
5838
|
}),
|
|
5840
|
-
e.prompts.length > 0 && /* @__PURE__ */ (0, Z.jsx)(
|
|
5839
|
+
e.prompts.length > 0 && /* @__PURE__ */ (0, Z.jsx)(Fs, {
|
|
5841
5840
|
prompts: e.prompts,
|
|
5842
5841
|
onSelect: (e) => {
|
|
5843
5842
|
o(e), requestAnimationFrame(() => {
|
|
5844
|
-
let e =
|
|
5843
|
+
let e = g.current?.view;
|
|
5845
5844
|
e?.focus(), Ae(e);
|
|
5846
5845
|
});
|
|
5847
5846
|
}
|
|
5848
5847
|
}),
|
|
5849
|
-
/* @__PURE__ */ (0, Z.jsx)(
|
|
5848
|
+
/* @__PURE__ */ (0, Z.jsx)(Es, {
|
|
5850
5849
|
className: "rounded-sm mr-2",
|
|
5851
|
-
placeholder:
|
|
5850
|
+
placeholder: se,
|
|
5852
5851
|
value: t,
|
|
5853
|
-
inputRef:
|
|
5852
|
+
inputRef: g,
|
|
5854
5853
|
maxHeight: e.maxHeight ? `${e.maxHeight / 2}px` : void 0,
|
|
5855
5854
|
onChange: o,
|
|
5856
5855
|
onSubmit: (e, t) => {
|
|
5857
|
-
t.trim() &&
|
|
5856
|
+
t.trim() && h.current?.requestSubmit();
|
|
5858
5857
|
},
|
|
5859
5858
|
onClose: () => {},
|
|
5860
5859
|
additionalCompletions: oe
|
|
5861
5860
|
}),
|
|
5862
|
-
|
|
5863
|
-
title:
|
|
5861
|
+
f && f.length === 1 && /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
5862
|
+
title: f[0].name,
|
|
5864
5863
|
className: "text-sm text-(--slate-11) truncate shrink-0 w-fit max-w-24",
|
|
5865
|
-
children:
|
|
5864
|
+
children: f[0].name
|
|
5866
5865
|
}),
|
|
5867
|
-
|
|
5868
|
-
title: [...
|
|
5866
|
+
f && f.length > 1 && /* @__PURE__ */ (0, Z.jsxs)("span", {
|
|
5867
|
+
title: [...f].map((e) => e.name).join("\n"),
|
|
5869
5868
|
className: "text-sm text-(--slate-11) truncate shrink-0",
|
|
5870
|
-
children: [
|
|
5869
|
+
children: [f.length, " files"]
|
|
5871
5870
|
}),
|
|
5872
|
-
|
|
5871
|
+
f && f.length > 0 && /* @__PURE__ */ (0, Z.jsx)(a, {
|
|
5873
5872
|
type: "button",
|
|
5874
5873
|
variant: "text",
|
|
5875
5874
|
size: "sm",
|
|
5876
5875
|
onClick: () => {
|
|
5877
|
-
|
|
5876
|
+
p(void 0), m.current && (m.current.value = "");
|
|
5878
5877
|
},
|
|
5879
5878
|
children: /* @__PURE__ */ (0, Z.jsx)(Ue, { className: "size-3" })
|
|
5880
5879
|
}),
|
|
@@ -5882,16 +5881,16 @@ var js = (e) => {
|
|
|
5882
5881
|
type: "button",
|
|
5883
5882
|
variant: "text",
|
|
5884
5883
|
size: "sm",
|
|
5885
|
-
onClick: () =>
|
|
5884
|
+
onClick: () => m.current?.click(),
|
|
5886
5885
|
children: /* @__PURE__ */ (0, Z.jsx)(qt, { className: "h-4" })
|
|
5887
5886
|
}), /* @__PURE__ */ (0, Z.jsx)("input", {
|
|
5888
5887
|
type: "file",
|
|
5889
|
-
ref:
|
|
5888
|
+
ref: m,
|
|
5890
5889
|
className: "hidden",
|
|
5891
5890
|
multiple: !0,
|
|
5892
5891
|
accept: Array.isArray(e.allowAttachments) ? e.allowAttachments.join(",") : void 0,
|
|
5893
5892
|
onChange: (e) => {
|
|
5894
|
-
e.target.files &&
|
|
5893
|
+
e.target.files && p([...e.target.files]);
|
|
5895
5894
|
}
|
|
5896
5895
|
})] }),
|
|
5897
5896
|
re ? /* @__PURE__ */ (0, Z.jsx)(ue, {
|
|
@@ -5900,7 +5899,7 @@ var js = (e) => {
|
|
|
5900
5899
|
type: "button",
|
|
5901
5900
|
variant: "link",
|
|
5902
5901
|
size: "xs",
|
|
5903
|
-
onClick: () =>
|
|
5902
|
+
onClick: () => N(),
|
|
5904
5903
|
className: "text-(--red-9) hover:text-(--red-11)",
|
|
5905
5904
|
children: /* @__PURE__ */ (0, Z.jsx)(ze, { className: "h-4 w-4 fill-current" })
|
|
5906
5905
|
})
|
|
@@ -5917,7 +5916,7 @@ var js = (e) => {
|
|
|
5917
5916
|
})
|
|
5918
5917
|
]
|
|
5919
5918
|
});
|
|
5920
|
-
},
|
|
5919
|
+
}, Ns = {
|
|
5921
5920
|
max_tokens: {
|
|
5922
5921
|
min: 1,
|
|
5923
5922
|
max: 4096,
|
|
@@ -5950,12 +5949,12 @@ var js = (e) => {
|
|
|
5950
5949
|
max: 2,
|
|
5951
5950
|
description: "Penalizes new tokens (-2: favor, 2: avoid)"
|
|
5952
5951
|
}
|
|
5953
|
-
},
|
|
5954
|
-
let t = (0,
|
|
5952
|
+
}, Ps = (e) => {
|
|
5953
|
+
let t = (0, L.c)(16), { config: n, onChange: r } = e, [i, o] = (0, X.useState)(!1), s;
|
|
5955
5954
|
t[0] !== n || t[1] !== r ? (s = (e, t) => {
|
|
5956
5955
|
let i = t === null || Number.isNaN(t) ? null : t;
|
|
5957
5956
|
if (i !== null) {
|
|
5958
|
-
let { min: t, max: n } =
|
|
5957
|
+
let { min: t, max: n } = Ns[e];
|
|
5959
5958
|
i = Math.max(t, Math.min(n, i));
|
|
5960
5959
|
}
|
|
5961
5960
|
let a = {
|
|
@@ -6001,7 +6000,7 @@ var js = (e) => {
|
|
|
6001
6000
|
side: "top",
|
|
6002
6001
|
content: /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
6003
6002
|
className: "text-xs flex flex-col",
|
|
6004
|
-
children:
|
|
6003
|
+
children: Ns[t].description
|
|
6005
6004
|
}),
|
|
6006
6005
|
children: /* @__PURE__ */ (0, Z.jsx)(xe, { className: "h-3 w-3 cursor-help text-muted-foreground hover:text-foreground" })
|
|
6007
6006
|
})]
|
|
@@ -6010,9 +6009,9 @@ var js = (e) => {
|
|
|
6010
6009
|
"aria-label": t,
|
|
6011
6010
|
value: n ?? NaN,
|
|
6012
6011
|
placeholder: "null",
|
|
6013
|
-
minValue:
|
|
6014
|
-
maxValue:
|
|
6015
|
-
step:
|
|
6012
|
+
minValue: Ns[t].min,
|
|
6013
|
+
maxValue: Ns[t].max,
|
|
6014
|
+
step: Ns[t].step ?? 1,
|
|
6016
6015
|
onChange: (e) => c(t, e),
|
|
6017
6016
|
onKeyDown: u,
|
|
6018
6017
|
className: "col-span-3"
|
|
@@ -6021,7 +6020,7 @@ var js = (e) => {
|
|
|
6021
6020
|
}, t[9] = c, t[10] = e), p = _t.entries(n).map(e), t[6] = n, t[7] = c, t[8] = p;
|
|
6022
6021
|
} else p = t[8];
|
|
6023
6022
|
let m;
|
|
6024
|
-
t[11] === p ? m = t[12] : (m = /* @__PURE__ */ (0, Z.jsx)(
|
|
6023
|
+
t[11] === p ? m = t[12] : (m = /* @__PURE__ */ (0, Z.jsx)(S, {
|
|
6025
6024
|
className: "w-70 border",
|
|
6026
6025
|
children: /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
6027
6026
|
className: "grid gap-3",
|
|
@@ -6029,13 +6028,13 @@ var js = (e) => {
|
|
|
6029
6028
|
})
|
|
6030
6029
|
}), t[11] = p, t[12] = m);
|
|
6031
6030
|
let h;
|
|
6032
|
-
return t[13] !== i || t[14] !== m ? (h = /* @__PURE__ */ (0, Z.jsxs)(
|
|
6031
|
+
return t[13] !== i || t[14] !== m ? (h = /* @__PURE__ */ (0, Z.jsxs)(C, {
|
|
6033
6032
|
open: i,
|
|
6034
6033
|
onOpenChange: o,
|
|
6035
6034
|
children: [d, m]
|
|
6036
6035
|
}), t[13] = i, t[14] = m, t[15] = h) : h = t[15], h;
|
|
6037
|
-
},
|
|
6038
|
-
let t = (0,
|
|
6036
|
+
}, Fs = (e) => {
|
|
6037
|
+
let t = (0, L.c)(18), { prompts: n, onSelect: r } = e, [i, o] = (0, X.useState)(!1), [s, c] = (0, X.useState)(""), l;
|
|
6039
6038
|
t[0] === r ? l = t[1] : (l = (e) => {
|
|
6040
6039
|
[...e.matchAll(/{{(\w+)}}/g)].length > 0 ? (c(e), o(!0)) : r(e);
|
|
6041
6040
|
}, t[0] = r, t[1] = l);
|
|
@@ -6048,7 +6047,7 @@ var js = (e) => {
|
|
|
6048
6047
|
variant: "outline",
|
|
6049
6048
|
size: "sm",
|
|
6050
6049
|
className: "border-none shadow-none hover:bg-transparent",
|
|
6051
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
6050
|
+
children: /* @__PURE__ */ (0, Z.jsx)(se, { className: "h-3 w-3" })
|
|
6052
6051
|
})
|
|
6053
6052
|
})
|
|
6054
6053
|
}), t[2] = d) : d = t[2];
|
|
@@ -6062,35 +6061,35 @@ var js = (e) => {
|
|
|
6062
6061
|
}, t), t[6] = u, t[7] = e), f = n.map(e), t[3] = u, t[4] = n, t[5] = f;
|
|
6063
6062
|
} else f = t[5];
|
|
6064
6063
|
let p;
|
|
6065
|
-
t[8] === f ? p = t[9] : (p = /* @__PURE__ */ (0, Z.jsx)(
|
|
6064
|
+
t[8] === f ? p = t[9] : (p = /* @__PURE__ */ (0, Z.jsx)(ks, { children: /* @__PURE__ */ (0, Z.jsxs)(ve, { children: [d, /* @__PURE__ */ (0, Z.jsx)(_e, {
|
|
6066
6065
|
side: "right",
|
|
6067
6066
|
align: "end",
|
|
6068
|
-
onCloseAutoFocus:
|
|
6067
|
+
onCloseAutoFocus: Ls,
|
|
6069
6068
|
className: "w-64 max-h-96 overflow-y-auto",
|
|
6070
6069
|
children: f
|
|
6071
6070
|
})] }) }), t[8] = f, t[9] = p);
|
|
6072
6071
|
let m;
|
|
6073
6072
|
t[10] === Symbol.for("react.memo_cache_sentinel") ? (m = () => o(!1), t[10] = m) : m = t[10];
|
|
6074
6073
|
let h;
|
|
6075
|
-
t[11] !== r || t[12] !== s ? (h = /* @__PURE__ */ (0, Z.jsx)(
|
|
6074
|
+
t[11] !== r || t[12] !== s ? (h = /* @__PURE__ */ (0, Z.jsx)(S, {
|
|
6076
6075
|
side: "right",
|
|
6077
6076
|
align: "end",
|
|
6078
6077
|
className: "min-w-80 px-2",
|
|
6079
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
6078
|
+
children: /* @__PURE__ */ (0, Z.jsx)(Is, {
|
|
6080
6079
|
prompt: s,
|
|
6081
6080
|
onClose: m,
|
|
6082
6081
|
onSelect: r
|
|
6083
6082
|
}, s)
|
|
6084
6083
|
}), t[11] = r, t[12] = s, t[13] = h) : h = t[13];
|
|
6085
6084
|
let g;
|
|
6086
|
-
return t[14] !== i || t[15] !== p || t[16] !== h ? (g = /* @__PURE__ */ (0, Z.jsxs)(
|
|
6085
|
+
return t[14] !== i || t[15] !== p || t[16] !== h ? (g = /* @__PURE__ */ (0, Z.jsxs)(C, {
|
|
6087
6086
|
open: i,
|
|
6088
6087
|
onOpenChange: o,
|
|
6089
6088
|
children: [p, h]
|
|
6090
6089
|
}), t[14] = i, t[15] = p, t[16] = h, t[17] = g) : g = t[17], g;
|
|
6091
|
-
},
|
|
6092
|
-
let t = (0,
|
|
6093
|
-
t[0] === n ? o = t[1] : (o = () => [...n.matchAll(/{{(\w+)}}/g)].reduce(
|
|
6090
|
+
}, Is = (e) => {
|
|
6091
|
+
let t = (0, L.c)(30), { prompt: n, onClose: r, onSelect: i } = e, o;
|
|
6092
|
+
t[0] === n ? o = t[1] : (o = () => [...n.matchAll(/{{(\w+)}}/g)].reduce(Rs, {}), t[0] = n, t[1] = o);
|
|
6094
6093
|
let [s, c] = (0, X.useState)(o), l;
|
|
6095
6094
|
t[2] === Symbol.for("react.memo_cache_sentinel") ? (l = (e, t) => {
|
|
6096
6095
|
c((n) => ({
|
|
@@ -6106,7 +6105,7 @@ var js = (e) => {
|
|
|
6106
6105
|
t[7] === s ? r = t[8] : (r = (e, t) => s[t] || `{{${t}}}`, t[7] = s, t[8] = r), d = n.replaceAll(e, r), t[3] = n, t[4] = s, t[5] = d;
|
|
6107
6106
|
} else d = t[5];
|
|
6108
6107
|
let f = d, p;
|
|
6109
|
-
t[9] === s ? p = t[10] : (p = Object.values(s).some(
|
|
6108
|
+
t[9] === s ? p = t[10] : (p = Object.values(s).some(zs), t[9] = s, t[10] = p);
|
|
6110
6109
|
let m = p, h;
|
|
6111
6110
|
t[11] !== r || t[12] !== i || t[13] !== f ? (h = () => {
|
|
6112
6111
|
i(f), r();
|
|
@@ -6161,14 +6160,14 @@ var js = (e) => {
|
|
|
6161
6160
|
]
|
|
6162
6161
|
}), t[26] = v, t[27] = y, t[28] = b, t[29] = x) : x = t[29], x;
|
|
6163
6162
|
};
|
|
6164
|
-
function
|
|
6163
|
+
function Ls(e) {
|
|
6165
6164
|
return e.preventDefault();
|
|
6166
6165
|
}
|
|
6167
|
-
function
|
|
6166
|
+
function Rs(e, t) {
|
|
6168
6167
|
return e[t[1]] = "", e;
|
|
6169
6168
|
}
|
|
6170
|
-
function
|
|
6169
|
+
function zs(e) {
|
|
6171
6170
|
return e == null || e.trim() === "";
|
|
6172
6171
|
}
|
|
6173
6172
|
//#endregion
|
|
6174
|
-
export {
|
|
6173
|
+
export { Ms as Chatbot };
|