@marimo-team/islands 0.26.1-dev27 → 0.26.1-dev29
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-zpe6C93k.js → ErrorBoundary-CPcZlpvU.js} +1 -1
- package/dist/{chat-ui-DOvIzlMA.js → chat-ui-CWmSnBs8.js} +899 -899
- package/dist/{code-visibility-BtvMUvQ6.js → code-visibility-CHvnQsso.js} +2 -2
- package/dist/{common-B46KECgx.js → common-9OlCmjdr.js} +6565 -6565
- package/dist/{config-DL9e-OWE.js → config-1ku0tAiU.js} +27 -28
- package/dist/{data-grid-overlay-editor-CLCJ44fs.js → data-grid-overlay-editor-D6x_MBSD.js} +1 -1
- package/dist/{dropdown-menu-DYN2RV5d.js → dropdown-menu-D65ZUqka.js} +1983 -1983
- package/dist/{error-entries-CncQR572.js → error-entries-DFHEq_SO.js} +515 -519
- package/dist/{feedback-button-CnyHlwaY.js → feedback-button-CodkZ3hF.js} +19 -19
- package/dist/{glide-data-editor-C3znsea0.js → glide-data-editor-BZxvtSp-.js} +35 -35
- package/dist/{globals-DHoGn4Qt.js → globals-DFf-tSyE.js} +1 -1
- package/dist/{html-to-image-BU7H-AM1.js → html-to-image-D6Gtk5ik.js} +24005 -23992
- package/dist/main.js +864 -864
- package/dist/{number-overlay-editor-DwK5S3_f.js → number-overlay-editor-CfwFMv_U.js} +1 -1
- package/dist/{process-output-xJm8T5-E.js → process-output-ZBdibqlG.js} +2 -2
- package/dist/{reveal-component-Dsp5kSt3.js → reveal-component-CDfNuSFv.js} +3 -3
- package/dist/style.css +1 -1
- package/dist/{vega-component-DpTyTrz3.js → vega-component-D61CTW1X.js} +1 -1
- package/package.json +1 -1
- package/src/__mocks__/intersection-observer.ts +45 -0
- package/src/components/databases/engine-variable.tsx +2 -2
- package/src/components/dependency-graph/panels.tsx +2 -2
- package/src/components/editor/actions/useCellActionButton.tsx +2 -8
- package/src/components/editor/cell/code/__tests__/code-placeholder.test.tsx +40 -0
- package/src/components/editor/cell/code/cell-editor.tsx +41 -104
- package/src/components/editor/cell/code/code-placeholder.css +61 -11
- package/src/components/editor/cell/code/code-placeholder.tsx +52 -29
- package/src/components/editor/cell/useSplitCell.tsx +2 -2
- package/src/components/editor/chrome/wrapper/__tests__/pending-ai-cells.test.tsx +6 -10
- package/src/components/editor/errors/auto-fix.tsx +8 -7
- package/src/components/editor/navigation/__tests__/navigation.test.ts +3 -12
- package/src/components/editor/navigation/focus-utils.ts +20 -8
- package/src/components/editor/navigation/multi-cell-action-toolbar.tsx +3 -11
- package/src/components/editor/navigation/navigation.ts +2 -2
- package/src/components/editor/notebook-cell.tsx +15 -24
- package/src/components/editor/output/MarimoTracebackOutput.tsx +2 -2
- package/src/components/editor/renderers/vertical-layout/__tests__/useFocusFirstEditor.test.ts +6 -9
- package/src/components/editor/renderers/vertical-layout/useFocusFirstEditor.ts +2 -5
- package/src/components/find-replace/find-replace.tsx +3 -7
- package/src/components/variables/__tests__/variables-table.test.tsx +1 -2
- package/src/core/ai/__tests__/staged-cells.test.ts +6 -39
- package/src/core/ai/staged-cells.ts +2 -20
- package/src/core/ai/tools/__tests__/edit-notebook-tool.test.ts +15 -13
- package/src/core/ai/tools/edit-notebook-tool.ts +13 -8
- package/src/core/cells/__tests__/cell-editor-view.test.ts +44 -0
- package/src/core/cells/__tests__/cells.test.ts +0 -1
- package/src/core/cells/__tests__/focus.test.ts +1 -7
- package/src/core/cells/__tests__/harness.ts +0 -1
- package/src/core/cells/cells.ts +15 -10
- package/src/core/cells/focus.ts +1 -1
- package/src/core/cells/scrollCellIntoView.ts +4 -14
- package/src/core/cells/utils.ts +0 -13
- package/src/core/codemirror/__tests__/cell-documents.test.ts +79 -0
- package/src/core/codemirror/__tests__/editor-mount-scheduler.test.ts +75 -105
- package/src/core/codemirror/__tests__/format.test.ts +85 -63
- package/src/core/codemirror/__tests__/use-lazy-editor-mount.test.tsx +193 -0
- package/src/core/codemirror/cell-documents.ts +132 -0
- package/src/core/codemirror/copilot/__tests__/getCodes.test.ts +0 -1
- package/src/core/codemirror/copilot/getCodes.ts +3 -14
- package/src/core/codemirror/editor-mount-scheduler.ts +41 -48
- package/src/core/codemirror/extensions.ts +2 -2
- package/src/core/codemirror/find-replace/__tests__/navigate.test.ts +42 -16
- package/src/core/codemirror/find-replace/__tests__/search-highlight.test.ts +30 -0
- package/src/core/codemirror/find-replace/__tests__/unmounted-cells.test.ts +145 -0
- package/src/core/codemirror/find-replace/navigate.ts +88 -129
- package/src/core/codemirror/find-replace/search-highlight.ts +3 -1
- package/src/core/codemirror/find-replace/state.ts +7 -2
- package/src/core/codemirror/format.ts +25 -31
- package/src/core/codemirror/go-to-definition/__tests__/utils.test.ts +8 -9
- package/src/core/codemirror/language/cell-code.ts +7 -0
- package/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts +25 -0
- package/src/core/codemirror/lsp/notebook-lsp.ts +6 -16
- package/src/core/codemirror/use-lazy-editor-mount.ts +67 -0
- package/src/core/codemirror/utils.ts +2 -6
- package/src/utils/__tests__/shared-intersection-observer.test.ts +49 -0
- package/src/utils/shared-intersection-observer.ts +53 -0
|
@@ -3,27 +3,27 @@ import { g as n, h as r, r as i, t as a } from "./button-Z2R2272J.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-rYV2znAe.js";
|
|
6
|
-
import {
|
|
7
|
-
import { h as
|
|
8
|
-
import { d as
|
|
9
|
-
import { Cn as
|
|
10
|
-
import {
|
|
11
|
-
import { F as
|
|
12
|
-
import { c as
|
|
13
|
-
import { t as
|
|
14
|
-
import { n as
|
|
15
|
-
import { t as
|
|
16
|
-
import { Bt as
|
|
17
|
-
import { n as
|
|
18
|
-
import { t as
|
|
19
|
-
import { t as
|
|
20
|
-
import { t as
|
|
21
|
-
import { At as
|
|
22
|
-
import { n as
|
|
23
|
-
import { n as
|
|
24
|
-
import { n as
|
|
25
|
-
import { t as
|
|
26
|
-
var
|
|
6
|
+
import { $ as u, At as d, Bt as f, Dt as p, Et as m, Ft as h, Ht as g, Lt as _, M as v, Ot as y, Pt as b, Q as x, Rt as S, St as C, U as w, V as T, W as E, a as D, dt as O, et as ee, f as k, g as A, h as j, ht as te, l as M, m as ne, n as re, p as N, q as ie, r as ae, rt as oe, st as se, t as ce, u as le, v as ue, wt as de } from "./html-to-image-D6Gtk5ik.js";
|
|
7
|
+
import { h as P, t as fe } from "./tooltip-DSWC_Td_.js";
|
|
8
|
+
import { d as pe } from "./select-CKLRKIzB.js";
|
|
9
|
+
import { Cn as me, f as he, g as ge, i as _e, n as ve, t as ye, v as be, xn as xe } from "./dropdown-menu-D65ZUqka.js";
|
|
10
|
+
import { i as Se, l as Ce } from "./config-1ku0tAiU.js";
|
|
11
|
+
import { F as we, J as Te, R as Ee, Tt as De, Vt as Oe, h as ke, i as Ae, in as je, kt as Me, r as Ne, t as Pe, yt as Fe } from "./error-entries-DFHEq_SO.js";
|
|
12
|
+
import { c as Ie, d as Le, l as Re, n as ze, t as Be, u as Ve } from "./process-output-ZBdibqlG.js";
|
|
13
|
+
import { t as He } from "./pencil-AWgwbH4D.js";
|
|
14
|
+
import { n as Ue, r as We, s as Ge } from "./assertNever-BHnIohkX.js";
|
|
15
|
+
import { t as Ke } from "./jsx-runtime-D8btoEHk.js";
|
|
16
|
+
import { Bt as qe, G as Je, Ht as Ye, J as Xe, K as Ze, W as Qe, X as $e, Y as et, Z as tt, at as nt, ct as rt, d as it, et as at, ft as ot, g as st, gt as ct, it as lt, mt as ut, nt as dt, ot as ft, pt, q as mt, tt as ht, ut as gt } from "./use-restore-focus-ocw7t85i.js";
|
|
17
|
+
import { n as _t } from "./error-banner-D-AC7pQx.js";
|
|
18
|
+
import { t as vt } from "./isEmpty-CdX7MTE1.js";
|
|
19
|
+
import { t as yt } from "./objects-DCmMvZtn.js";
|
|
20
|
+
import { t as bt } from "./useEvent-BoN7U38T.js";
|
|
21
|
+
import { At as xt, B as St, Ct, Dt as wt, G as Tt, H as Et, Ot as Dt, W as Ot, bt as kt, it as At, rt as jt, xt as Mt } from "./dist-BIaGGUbU.js";
|
|
22
|
+
import { n as Nt, o as Pt, r as Ft } from "./dist-m0MWV-aw.js";
|
|
23
|
+
import { n as It, t as Lt } from "./esm-Dw2ZydG_.js";
|
|
24
|
+
import { n as Rt } from "./dist-CQfpgadU.js";
|
|
25
|
+
import { t as zt } from "./useAsyncData-P5-Oovhq.js";
|
|
26
|
+
var Bt = P("ban", [["circle", {
|
|
27
27
|
cx: "12",
|
|
28
28
|
cy: "12",
|
|
29
29
|
r: "10",
|
|
@@ -31,13 +31,13 @@ var Rt = I("ban", [["circle", {
|
|
|
31
31
|
}], ["path", {
|
|
32
32
|
d: "M4.929 4.929 19.07 19.071",
|
|
33
33
|
key: "196cmz"
|
|
34
|
-
}]]),
|
|
34
|
+
}]]), Vt = P("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
|
-
}]]),
|
|
40
|
+
}]]), Ht = P("bot-message-square", [
|
|
41
41
|
["path", {
|
|
42
42
|
d: "M12 6V2H8",
|
|
43
43
|
key: "1155em"
|
|
@@ -62,7 +62,7 @@ var Rt = I("ban", [["circle", {
|
|
|
62
62
|
d: "M9 11v2",
|
|
63
63
|
key: "1ueba0"
|
|
64
64
|
}]
|
|
65
|
-
]),
|
|
65
|
+
]), Ut = P("brain", [
|
|
66
66
|
["path", {
|
|
67
67
|
d: "M12 18V5",
|
|
68
68
|
key: "adv99a"
|
|
@@ -95,7 +95,7 @@ var Rt = I("ban", [["circle", {
|
|
|
95
95
|
d: "M6.003 5.125a4 4 0 0 0-2.526 5.77",
|
|
96
96
|
key: "q97ue3"
|
|
97
97
|
}]
|
|
98
|
-
]),
|
|
98
|
+
]), Wt = P("bug", [
|
|
99
99
|
["path", {
|
|
100
100
|
d: "M12 20v-9",
|
|
101
101
|
key: "1qisl0"
|
|
@@ -140,7 +140,7 @@ var Rt = I("ban", [["circle", {
|
|
|
140
140
|
d: "M9 7.13V6a3 3 0 1 1 6 0v1.13",
|
|
141
141
|
key: "1vgav8"
|
|
142
142
|
}]
|
|
143
|
-
]),
|
|
143
|
+
]), Gt = P("circle-slash", [["circle", {
|
|
144
144
|
cx: "12",
|
|
145
145
|
cy: "12",
|
|
146
146
|
r: "10",
|
|
@@ -151,7 +151,7 @@ var Rt = I("ban", [["circle", {
|
|
|
151
151
|
y1: "15",
|
|
152
152
|
y2: "9",
|
|
153
153
|
key: "1dfufj"
|
|
154
|
-
}]]),
|
|
154
|
+
}]]), Kt = P("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 = I("ban", [["circle", {
|
|
|
170
170
|
d: "M13.3 16.3 15 18",
|
|
171
171
|
key: "2quom7"
|
|
172
172
|
}]
|
|
173
|
-
]),
|
|
173
|
+
]), qt = P("list-checks", [
|
|
174
174
|
["path", {
|
|
175
175
|
d: "M13 5h8",
|
|
176
176
|
key: "a7qcls"
|
|
@@ -191,7 +191,7 @@ var Rt = I("ban", [["circle", {
|
|
|
191
191
|
d: "m3 7 2 2 4-4",
|
|
192
192
|
key: "1obspn"
|
|
193
193
|
}]
|
|
194
|
-
]),
|
|
194
|
+
]), Jt = P("notebook", [
|
|
195
195
|
["path", {
|
|
196
196
|
d: "M2 6h4",
|
|
197
197
|
key: "aawbzj"
|
|
@@ -220,16 +220,16 @@ var Rt = I("ban", [["circle", {
|
|
|
220
220
|
d: "M16 2v20",
|
|
221
221
|
key: "rotuqe"
|
|
222
222
|
}]
|
|
223
|
-
]),
|
|
223
|
+
]), Yt = P("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
|
-
}]]),
|
|
226
|
+
}]]), Xt = P("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
|
-
}]]),
|
|
232
|
+
}]]), Zt = P("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 = I("ban", [["circle", {
|
|
|
256
256
|
d: "m16 16-1.9-1.9",
|
|
257
257
|
key: "1dq9hf"
|
|
258
258
|
}]
|
|
259
|
-
]),
|
|
259
|
+
]), Qt = P("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
|
-
}]]),
|
|
265
|
+
}]]), $t = P("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 = I("ban", [["circle", {
|
|
|
270
270
|
cy: "12",
|
|
271
271
|
r: "3",
|
|
272
272
|
key: "1v7zrd"
|
|
273
|
-
}]]),
|
|
273
|
+
}]]), en = P("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,65 +283,65 @@ var Rt = I("ban", [["circle", {
|
|
|
283
283
|
d: "M12 17h.01",
|
|
284
284
|
key: "p32p05"
|
|
285
285
|
}]
|
|
286
|
-
]),
|
|
286
|
+
]), F = s(), tn = "vercel.ai.error", nn = Symbol.for(tn), I = class e extends Error {
|
|
287
287
|
constructor({ name: e, message: t, cause: n }) {
|
|
288
|
-
super(t), this[
|
|
288
|
+
super(t), this[nn] = !0, this.name = e, this.cause = n;
|
|
289
289
|
}
|
|
290
290
|
static isInstance(t) {
|
|
291
|
-
return e.hasMarker(t,
|
|
291
|
+
return e.hasMarker(t, tn);
|
|
292
292
|
}
|
|
293
293
|
static hasMarker(e, t) {
|
|
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
|
-
},
|
|
297
|
+
}, rn = "AI_APICallError", an = `vercel.ai.error.${rn}`, on = Symbol.for(an), sn = class extends I {
|
|
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
|
-
name:
|
|
300
|
+
name: rn,
|
|
301
301
|
message: e,
|
|
302
302
|
cause: o
|
|
303
|
-
}), this[
|
|
303
|
+
}), this[on] = !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 I.hasMarker(e, an);
|
|
307
307
|
}
|
|
308
|
-
},
|
|
308
|
+
}, cn = "AI_EmptyResponseBodyError", ln = `vercel.ai.error.${cn}`, un = Symbol.for(ln), dn = class extends I {
|
|
309
309
|
constructor({ message: e = "Empty response body" } = {}) {
|
|
310
310
|
super({
|
|
311
|
-
name:
|
|
311
|
+
name: cn,
|
|
312
312
|
message: e
|
|
313
|
-
}), this[
|
|
313
|
+
}), this[un] = !0;
|
|
314
314
|
}
|
|
315
315
|
static isInstance(e) {
|
|
316
|
-
return
|
|
316
|
+
return I.hasMarker(e, ln);
|
|
317
317
|
}
|
|
318
318
|
};
|
|
319
|
-
function
|
|
319
|
+
function fn(e) {
|
|
320
320
|
return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
|
|
321
321
|
}
|
|
322
|
-
var
|
|
322
|
+
var pn = "AI_InvalidArgumentError", mn = `vercel.ai.error.${pn}`, hn = Symbol.for(mn), gn = class extends I {
|
|
323
323
|
constructor({ message: e, cause: t, argument: n }) {
|
|
324
324
|
super({
|
|
325
|
-
name:
|
|
325
|
+
name: pn,
|
|
326
326
|
message: e,
|
|
327
327
|
cause: t
|
|
328
|
-
}), this[
|
|
328
|
+
}), this[hn] = !0, this.argument = n;
|
|
329
329
|
}
|
|
330
330
|
static isInstance(e) {
|
|
331
|
-
return
|
|
331
|
+
return I.hasMarker(e, mn);
|
|
332
332
|
}
|
|
333
|
-
},
|
|
333
|
+
}, _n = "AI_JSONParseError", vn = `vercel.ai.error.${_n}`, yn = Symbol.for(vn), bn = class extends I {
|
|
334
334
|
constructor({ text: e, cause: t }) {
|
|
335
335
|
super({
|
|
336
|
-
name:
|
|
337
|
-
message: `JSON parsing failed: Text: ${e}.\nError message: ${
|
|
336
|
+
name: _n,
|
|
337
|
+
message: `JSON parsing failed: Text: ${e}.\nError message: ${fn(t)}`,
|
|
338
338
|
cause: t
|
|
339
|
-
}), this[
|
|
339
|
+
}), this[yn] = !0, this.text = e;
|
|
340
340
|
}
|
|
341
341
|
static isInstance(e) {
|
|
342
|
-
return
|
|
342
|
+
return I.hasMarker(e, vn);
|
|
343
343
|
}
|
|
344
|
-
},
|
|
344
|
+
}, xn = "AI_TypeValidationError", Sn = `vercel.ai.error.${xn}`, Cn = Symbol.for(Sn), wn = class e extends I {
|
|
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) {
|
|
@@ -350,13 +350,13 @@ var dn = "AI_InvalidArgumentError", fn = `vercel.ai.error.${dn}`, pn = Symbol.fo
|
|
|
350
350
|
n.entityName && e.push(n.entityName), n.entityId && e.push(`id: "${n.entityId}"`), r += e.join(", "), r += ")";
|
|
351
351
|
}
|
|
352
352
|
super({
|
|
353
|
-
name:
|
|
354
|
-
message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${
|
|
353
|
+
name: xn,
|
|
354
|
+
message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${fn(t)}`,
|
|
355
355
|
cause: t
|
|
356
|
-
}), this[
|
|
356
|
+
}), this[Cn] = !0, this.value = e, this.context = n;
|
|
357
357
|
}
|
|
358
358
|
static isInstance(e) {
|
|
359
|
-
return
|
|
359
|
+
return I.hasMarker(e, Sn);
|
|
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,25 +365,25 @@ var dn = "AI_InvalidArgumentError", fn = `vercel.ai.error.${dn}`, pn = Symbol.fo
|
|
|
365
365
|
context: r
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
|
-
},
|
|
368
|
+
}, Tn = "AI_UnsupportedFunctionalityError", En = `vercel.ai.error.${Tn}`, Dn = Symbol.for(En), On = class extends I {
|
|
369
369
|
constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
|
|
370
370
|
super({
|
|
371
|
-
name:
|
|
371
|
+
name: Tn,
|
|
372
372
|
message: t
|
|
373
|
-
}), this[
|
|
373
|
+
}), this[Dn] = !0, this.functionality = e;
|
|
374
374
|
}
|
|
375
375
|
static isInstance(e) {
|
|
376
|
-
return
|
|
376
|
+
return I.hasMarker(e, En);
|
|
377
377
|
}
|
|
378
|
-
},
|
|
378
|
+
}, kn = 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
|
-
},
|
|
383
|
-
function
|
|
384
|
-
function
|
|
382
|
+
}, An = 10, jn = 13, L = 32;
|
|
383
|
+
function Mn(e) {}
|
|
384
|
+
function Nn(e) {
|
|
385
385
|
if (typeof e == "function") throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");
|
|
386
|
-
let { onEvent: t =
|
|
386
|
+
let { onEvent: t = Mn, onError: n = Mn, onRetry: r = Mn, onComment: i, maxBufferSize: a } = e, o = [], s = 0, c = !0, l, u = "", d = 0, f, p = !1;
|
|
387
387
|
function m(e) {
|
|
388
388
|
if (p) throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");
|
|
389
389
|
if (c && (c = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), o.length === 0) {
|
|
@@ -402,7 +402,7 @@ function jn(e) {
|
|
|
402
402
|
n !== "" && (o.push(n), s = n.length), h();
|
|
403
403
|
}
|
|
404
404
|
function h() {
|
|
405
|
-
a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new
|
|
405
|
+
a !== void 0 && (s + u.length <= a || (p = !0, o.length = 0, s = 0, l = void 0, u = "", d = 0, f = void 0, n(new kn(`Buffered data exceeded max buffer size of ${a} characters`, { type: "max-buffer-size-exceeded" }))));
|
|
406
406
|
}
|
|
407
407
|
function g(e) {
|
|
408
408
|
let n = 0;
|
|
@@ -418,9 +418,9 @@ function jn(e) {
|
|
|
418
418
|
continue;
|
|
419
419
|
}
|
|
420
420
|
let i = e.charCodeAt(n);
|
|
421
|
-
if (
|
|
422
|
-
let i = e.charCodeAt(n + 5) ===
|
|
423
|
-
if (d === 0 && e.charCodeAt(r + 1) ===
|
|
421
|
+
if (Pn(e, n, i)) {
|
|
422
|
+
let i = e.charCodeAt(n + 5) === L ? n + 6 : n + 5, a = e.slice(i, r);
|
|
423
|
+
if (d === 0 && e.charCodeAt(r + 1) === An) {
|
|
424
424
|
t({
|
|
425
425
|
id: l,
|
|
426
426
|
event: f,
|
|
@@ -430,7 +430,7 @@ function jn(e) {
|
|
|
430
430
|
}
|
|
431
431
|
u = d === 0 ? a : `${u}
|
|
432
432
|
${a}`, d++;
|
|
433
|
-
} else
|
|
433
|
+
} else Fn(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === L ? 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);
|
|
@@ -438,7 +438,7 @@ ${a}`, d++;
|
|
|
438
438
|
for (; n < e.length;) {
|
|
439
439
|
let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
|
|
440
440
|
if (t !== -1 && r !== -1 ? i = t < r ? t : r : t === -1 ? r !== -1 && (i = r) : i = t === e.length - 1 ? -1 : t, i === -1) break;
|
|
441
|
-
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) ===
|
|
441
|
+
_(e, n, i), n = i + 1, e.charCodeAt(n - 1) === jn && e.charCodeAt(n) === An && n++;
|
|
442
442
|
}
|
|
443
443
|
return e.slice(n);
|
|
444
444
|
}
|
|
@@ -448,25 +448,25 @@ ${a}`, d++;
|
|
|
448
448
|
return;
|
|
449
449
|
}
|
|
450
450
|
let r = e.charCodeAt(t);
|
|
451
|
-
if (
|
|
452
|
-
let r = e.charCodeAt(t + 5) ===
|
|
451
|
+
if (Pn(e, t, r)) {
|
|
452
|
+
let r = e.charCodeAt(t + 5) === L ? 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
|
-
if (
|
|
458
|
-
f = e.slice(e.charCodeAt(t + 6) ===
|
|
457
|
+
if (Fn(e, t, r)) {
|
|
458
|
+
f = e.slice(e.charCodeAt(t + 6) === L ? 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) === L ? 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) === L ? 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) === L ? 2 : 1;
|
|
479
479
|
v(s, a.slice(o + c), a);
|
|
480
480
|
}
|
|
481
481
|
function v(e, t, i) {
|
|
@@ -491,13 +491,13 @@ ${t}`, d++;
|
|
|
491
491
|
l = t.includes("\0") ? void 0 : t;
|
|
492
492
|
break;
|
|
493
493
|
case "retry":
|
|
494
|
-
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new
|
|
494
|
+
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new kn(`Invalid \`retry\` value: "${t}"`, {
|
|
495
495
|
type: "invalid-retry",
|
|
496
496
|
value: t,
|
|
497
497
|
line: i
|
|
498
498
|
}));
|
|
499
499
|
break;
|
|
500
|
-
default: n(new
|
|
500
|
+
default: n(new kn(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
|
|
501
501
|
type: "unknown-field",
|
|
502
502
|
field: e,
|
|
503
503
|
value: t,
|
|
@@ -524,20 +524,20 @@ ${t}`, d++;
|
|
|
524
524
|
reset: b
|
|
525
525
|
};
|
|
526
526
|
}
|
|
527
|
-
function
|
|
527
|
+
function Pn(e, t, n) {
|
|
528
528
|
return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
|
|
529
529
|
}
|
|
530
|
-
function
|
|
530
|
+
function Fn(e, t, n) {
|
|
531
531
|
return n === 101 && e.charCodeAt(t + 1) === 118 && e.charCodeAt(t + 2) === 101 && e.charCodeAt(t + 3) === 110 && e.charCodeAt(t + 4) === 116 && e.charCodeAt(t + 5) === 58;
|
|
532
532
|
}
|
|
533
533
|
//#endregion
|
|
534
534
|
//#region ../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
|
|
535
|
-
var
|
|
535
|
+
var In = class extends TransformStream {
|
|
536
536
|
constructor({ onError: e, onRetry: t, onComment: n, maxBufferSize: r } = {}) {
|
|
537
537
|
let i;
|
|
538
538
|
super({
|
|
539
539
|
start(a) {
|
|
540
|
-
i =
|
|
540
|
+
i = Nn({
|
|
541
541
|
onEvent: (e) => {
|
|
542
542
|
a.enqueue(e);
|
|
543
543
|
},
|
|
@@ -556,8 +556,8 @@ var Pn = class extends TransformStream {
|
|
|
556
556
|
}
|
|
557
557
|
};
|
|
558
558
|
new TextDecoder();
|
|
559
|
-
var { btoa:
|
|
560
|
-
function
|
|
559
|
+
var { btoa: Ln, atob: Rn } = globalThis;
|
|
560
|
+
function zn(e) {
|
|
561
561
|
if (e == null) return {};
|
|
562
562
|
let t = {};
|
|
563
563
|
if (e instanceof Headers) e.forEach((e, n) => {
|
|
@@ -569,28 +569,28 @@ function Ln(e) {
|
|
|
569
569
|
}
|
|
570
570
|
return t;
|
|
571
571
|
}
|
|
572
|
-
var
|
|
572
|
+
var R = ({ 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];
|
|
576
576
|
return r.join("");
|
|
577
577
|
};
|
|
578
578
|
if (e == null) return i;
|
|
579
|
-
if (n.includes(r)) throw new
|
|
579
|
+
if (n.includes(r)) throw new gn({
|
|
580
580
|
argument: "separator",
|
|
581
581
|
message: `The separator "${r}" must not be part of the alphabet "${n}".`
|
|
582
582
|
});
|
|
583
583
|
return () => `${e}${r}${i()}`;
|
|
584
|
-
},
|
|
585
|
-
function
|
|
584
|
+
}, Bn = R();
|
|
585
|
+
function Vn(e) {
|
|
586
586
|
return globalThis.Buffer?.isBuffer(e) ?? !1;
|
|
587
587
|
}
|
|
588
|
-
var
|
|
589
|
-
function
|
|
588
|
+
var Hn = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, Un = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
|
|
589
|
+
function Wn(e) {
|
|
590
590
|
let t = JSON.parse(e);
|
|
591
|
-
return typeof t != "object" || !t ||
|
|
591
|
+
return typeof t != "object" || !t || Hn.test(e) === !1 && Un.test(e) === !1 ? t : Gn(t);
|
|
592
592
|
}
|
|
593
|
-
function
|
|
593
|
+
function Gn(e) {
|
|
594
594
|
let t = [e];
|
|
595
595
|
for (; t.length;) {
|
|
596
596
|
let e = t;
|
|
@@ -605,35 +605,35 @@ function Un(e) {
|
|
|
605
605
|
}
|
|
606
606
|
return e;
|
|
607
607
|
}
|
|
608
|
-
function
|
|
608
|
+
function Kn(e) {
|
|
609
609
|
let { stackTraceLimit: t } = Error;
|
|
610
610
|
try {
|
|
611
611
|
Error.stackTraceLimit = 0;
|
|
612
612
|
} catch {
|
|
613
|
-
return
|
|
613
|
+
return Wn(e);
|
|
614
614
|
}
|
|
615
615
|
try {
|
|
616
|
-
return
|
|
616
|
+
return Wn(e);
|
|
617
617
|
} finally {
|
|
618
618
|
Error.stackTraceLimit = t;
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
|
-
function
|
|
621
|
+
function qn(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" && z(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] = z(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(z) : z(e.items)), e.anyOf != null && (e.anyOf = e.anyOf.map(z)), e.allOf != null && (e.allOf = e.allOf.map(z)), e.oneOf != null && (e.oneOf = e.oneOf.map(z));
|
|
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] = z(t[e]);
|
|
631
631
|
return e;
|
|
632
632
|
}
|
|
633
|
-
function
|
|
634
|
-
return typeof e == "boolean" ? e :
|
|
633
|
+
function z(e) {
|
|
634
|
+
return typeof e == "boolean" ? e : qn(e);
|
|
635
635
|
}
|
|
636
|
-
var
|
|
636
|
+
var Jn = Symbol("Let zodToJsonSchema decide on which parser to use"), Yn = {
|
|
637
637
|
name: void 0,
|
|
638
638
|
$refStrategy: "root",
|
|
639
639
|
basePath: ["#"],
|
|
@@ -653,24 +653,24 @@ var Kn = Symbol("Let zodToJsonSchema decide on which parser to use"), qn = {
|
|
|
653
653
|
emailStrategy: "format:email",
|
|
654
654
|
base64Strategy: "contentEncoding:base64",
|
|
655
655
|
nameStrategy: "ref"
|
|
656
|
-
},
|
|
657
|
-
...
|
|
656
|
+
}, Xn = (e) => typeof e == "string" ? {
|
|
657
|
+
...Yn,
|
|
658
658
|
name: e
|
|
659
659
|
} : {
|
|
660
|
-
...
|
|
660
|
+
...Yn,
|
|
661
661
|
...e
|
|
662
662
|
};
|
|
663
|
-
function
|
|
663
|
+
function B() {
|
|
664
664
|
return {};
|
|
665
665
|
}
|
|
666
|
-
function
|
|
666
|
+
function Zn(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 = W(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;
|
|
672
672
|
}
|
|
673
|
-
function
|
|
673
|
+
function Qn(e) {
|
|
674
674
|
let t = {
|
|
675
675
|
type: "integer",
|
|
676
676
|
format: "int64"
|
|
@@ -687,16 +687,16 @@ function Xn(e) {
|
|
|
687
687
|
}
|
|
688
688
|
return t;
|
|
689
689
|
}
|
|
690
|
-
function
|
|
690
|
+
function $n() {
|
|
691
691
|
return { type: "boolean" };
|
|
692
692
|
}
|
|
693
|
-
function
|
|
694
|
-
return
|
|
693
|
+
function er(e, t) {
|
|
694
|
+
return W(e.type._def, t);
|
|
695
695
|
}
|
|
696
|
-
var
|
|
697
|
-
function
|
|
696
|
+
var tr = (e, t) => W(e.innerType._def, t);
|
|
697
|
+
function nr(e, t, n) {
|
|
698
698
|
let r = n ?? t.dateStrategy;
|
|
699
|
-
if (Array.isArray(r)) return { anyOf: r.map((n) =>
|
|
699
|
+
if (Array.isArray(r)) return { anyOf: r.map((n) => nr(e, t, n)) };
|
|
700
700
|
switch (r) {
|
|
701
701
|
case "string":
|
|
702
702
|
case "format:date-time": return {
|
|
@@ -707,10 +707,10 @@ function er(e, t, n) {
|
|
|
707
707
|
type: "string",
|
|
708
708
|
format: "date"
|
|
709
709
|
};
|
|
710
|
-
case "integer": return
|
|
710
|
+
case "integer": return rr(e);
|
|
711
711
|
}
|
|
712
712
|
}
|
|
713
|
-
var
|
|
713
|
+
var rr = (e) => {
|
|
714
714
|
let t = {
|
|
715
715
|
type: "integer",
|
|
716
716
|
format: "unix-time"
|
|
@@ -723,31 +723,31 @@ var tr = (e) => {
|
|
|
723
723
|
}
|
|
724
724
|
return t;
|
|
725
725
|
};
|
|
726
|
-
function
|
|
726
|
+
function ir(e, t) {
|
|
727
727
|
return {
|
|
728
|
-
...
|
|
728
|
+
...W(e.innerType._def, t),
|
|
729
729
|
default: e.defaultValue()
|
|
730
730
|
};
|
|
731
731
|
}
|
|
732
|
-
function
|
|
733
|
-
return t.effectStrategy === "input" ?
|
|
732
|
+
function ar(e, t) {
|
|
733
|
+
return t.effectStrategy === "input" ? W(e.schema._def, t) : B();
|
|
734
734
|
}
|
|
735
|
-
function
|
|
735
|
+
function or(e) {
|
|
736
736
|
return {
|
|
737
737
|
type: "string",
|
|
738
738
|
enum: Array.from(e.values)
|
|
739
739
|
};
|
|
740
740
|
}
|
|
741
|
-
var
|
|
742
|
-
function
|
|
743
|
-
let n = [
|
|
741
|
+
var sr = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
742
|
+
function cr(e, t) {
|
|
743
|
+
let n = [W(e.left._def, {
|
|
744
744
|
...t,
|
|
745
745
|
currentPath: [
|
|
746
746
|
...t.currentPath,
|
|
747
747
|
"allOf",
|
|
748
748
|
"0"
|
|
749
749
|
]
|
|
750
|
-
}),
|
|
750
|
+
}), W(e.right._def, {
|
|
751
751
|
...t,
|
|
752
752
|
currentPath: [
|
|
753
753
|
...t.currentPath,
|
|
@@ -756,7 +756,7 @@ function or(e, t) {
|
|
|
756
756
|
]
|
|
757
757
|
})].filter((e) => !!e), r = [];
|
|
758
758
|
return n.forEach((e) => {
|
|
759
|
-
if (
|
|
759
|
+
if (sr(e)) r.push(...e.allOf);
|
|
760
760
|
else {
|
|
761
761
|
let t = e;
|
|
762
762
|
if ("additionalProperties" in e && e.additionalProperties === !1) {
|
|
@@ -767,19 +767,19 @@ function or(e, t) {
|
|
|
767
767
|
}
|
|
768
768
|
}), r.length ? { allOf: r } : void 0;
|
|
769
769
|
}
|
|
770
|
-
function
|
|
770
|
+
function lr(e) {
|
|
771
771
|
let t = typeof e.value;
|
|
772
772
|
return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
|
|
773
773
|
type: t === "bigint" ? "integer" : t,
|
|
774
774
|
const: e.value
|
|
775
775
|
};
|
|
776
776
|
}
|
|
777
|
-
var
|
|
777
|
+
var ur = void 0, V = {
|
|
778
778
|
cuid: /^[cC][^\s-]{8,}$/,
|
|
779
779
|
cuid2: /^[0-9a-z]+$/,
|
|
780
780
|
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
781
781
|
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
|
|
782
|
-
emoji: () => (
|
|
782
|
+
emoji: () => (ur === void 0 && (ur = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), ur),
|
|
783
783
|
uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
|
|
784
784
|
ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
|
|
785
785
|
ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
|
|
@@ -790,7 +790,7 @@ var cr = void 0, U = {
|
|
|
790
790
|
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
791
791
|
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
792
792
|
};
|
|
793
|
-
function
|
|
793
|
+
function dr(e, t) {
|
|
794
794
|
let n = { type: "string" };
|
|
795
795
|
if (e.checks) for (let r of e.checks) switch (r.kind) {
|
|
796
796
|
case "min":
|
|
@@ -802,108 +802,108 @@ function lr(e, t) {
|
|
|
802
802
|
case "email":
|
|
803
803
|
switch (t.emailStrategy) {
|
|
804
804
|
case "format:email":
|
|
805
|
-
|
|
805
|
+
H(n, "email", r.message, t);
|
|
806
806
|
break;
|
|
807
807
|
case "format:idn-email":
|
|
808
|
-
|
|
808
|
+
H(n, "idn-email", r.message, t);
|
|
809
809
|
break;
|
|
810
|
-
case "pattern:zod":
|
|
810
|
+
case "pattern:zod": U(n, V.email, r.message, t);
|
|
811
811
|
}
|
|
812
812
|
break;
|
|
813
813
|
case "url":
|
|
814
|
-
|
|
814
|
+
H(n, "uri", r.message, t);
|
|
815
815
|
break;
|
|
816
816
|
case "uuid":
|
|
817
|
-
|
|
817
|
+
H(n, "uuid", r.message, t);
|
|
818
818
|
break;
|
|
819
819
|
case "regex":
|
|
820
|
-
|
|
820
|
+
U(n, r.regex, r.message, t);
|
|
821
821
|
break;
|
|
822
822
|
case "cuid":
|
|
823
|
-
|
|
823
|
+
U(n, V.cuid, r.message, t);
|
|
824
824
|
break;
|
|
825
825
|
case "cuid2":
|
|
826
|
-
|
|
826
|
+
U(n, V.cuid2, r.message, t);
|
|
827
827
|
break;
|
|
828
828
|
case "startsWith":
|
|
829
|
-
|
|
829
|
+
U(n, RegExp(`^${fr(r.value, t)}`), r.message, t);
|
|
830
830
|
break;
|
|
831
831
|
case "endsWith":
|
|
832
|
-
|
|
832
|
+
U(n, RegExp(`${fr(r.value, t)}$`), r.message, t);
|
|
833
833
|
break;
|
|
834
834
|
case "datetime":
|
|
835
|
-
|
|
835
|
+
H(n, "date-time", r.message, t);
|
|
836
836
|
break;
|
|
837
837
|
case "date":
|
|
838
|
-
|
|
838
|
+
H(n, "date", r.message, t);
|
|
839
839
|
break;
|
|
840
840
|
case "time":
|
|
841
|
-
|
|
841
|
+
H(n, "time", r.message, t);
|
|
842
842
|
break;
|
|
843
843
|
case "duration":
|
|
844
|
-
|
|
844
|
+
H(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
|
+
U(n, RegExp(fr(r.value, t)), r.message, t);
|
|
851
851
|
break;
|
|
852
852
|
case "ip":
|
|
853
|
-
r.version !== "v6" &&
|
|
853
|
+
r.version !== "v6" && H(n, "ipv4", r.message, t), r.version !== "v4" && H(n, "ipv6", r.message, t);
|
|
854
854
|
break;
|
|
855
855
|
case "base64url":
|
|
856
|
-
|
|
856
|
+
U(n, V.base64url, r.message, t);
|
|
857
857
|
break;
|
|
858
858
|
case "jwt":
|
|
859
|
-
|
|
859
|
+
U(n, V.jwt, r.message, t);
|
|
860
860
|
break;
|
|
861
861
|
case "cidr":
|
|
862
|
-
r.version !== "v6" &&
|
|
862
|
+
r.version !== "v6" && U(n, V.ipv4Cidr, r.message, t), r.version !== "v4" && U(n, V.ipv6Cidr, r.message, t);
|
|
863
863
|
break;
|
|
864
864
|
case "emoji":
|
|
865
|
-
|
|
865
|
+
U(n, V.emoji(), r.message, t);
|
|
866
866
|
break;
|
|
867
867
|
case "ulid":
|
|
868
|
-
|
|
868
|
+
U(n, V.ulid, r.message, t);
|
|
869
869
|
break;
|
|
870
870
|
case "base64":
|
|
871
871
|
switch (t.base64Strategy) {
|
|
872
872
|
case "format:binary":
|
|
873
|
-
|
|
873
|
+
H(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": U(n, V.base64, r.message, t);
|
|
879
879
|
}
|
|
880
880
|
break;
|
|
881
|
-
case "nanoid":
|
|
881
|
+
case "nanoid": U(n, V.nanoid, r.message, t);
|
|
882
882
|
}
|
|
883
883
|
return n;
|
|
884
884
|
}
|
|
885
|
-
function
|
|
886
|
-
return t.patternStrategy === "escape" ?
|
|
885
|
+
function fr(e, t) {
|
|
886
|
+
return t.patternStrategy === "escape" ? mr(e) : e;
|
|
887
887
|
}
|
|
888
|
-
var
|
|
889
|
-
function
|
|
888
|
+
var pr = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
889
|
+
function mr(e) {
|
|
890
890
|
let t = "";
|
|
891
|
-
for (let n = 0; n < e.length; n++)
|
|
891
|
+
for (let n = 0; n < e.length; n++) pr.has(e[n]) || (t += "\\"), t += e[n];
|
|
892
892
|
return t;
|
|
893
893
|
}
|
|
894
|
-
function
|
|
894
|
+
function H(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 U(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
|
-
pattern:
|
|
902
|
+
pattern: hr(t, r),
|
|
903
903
|
...n && r.errorMessages && { errorMessage: { pattern: n } }
|
|
904
|
-
})) : e.pattern =
|
|
904
|
+
})) : e.pattern = hr(t, r);
|
|
905
905
|
}
|
|
906
|
-
function
|
|
906
|
+
function hr(e, t) {
|
|
907
907
|
if (!t.applyRegexFlags || !e.flags) return e.source;
|
|
908
908
|
let n = {
|
|
909
909
|
i: e.flags.includes("i"),
|
|
@@ -942,16 +942,16 @@ function pr(e, t) {
|
|
|
942
942
|
}
|
|
943
943
|
return i;
|
|
944
944
|
}
|
|
945
|
-
function
|
|
945
|
+
function gr(e, t) {
|
|
946
946
|
let n = {
|
|
947
947
|
type: "object",
|
|
948
|
-
additionalProperties:
|
|
948
|
+
additionalProperties: W(e.valueType._def, {
|
|
949
949
|
...t,
|
|
950
950
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
951
951
|
}) ?? t.allowedAdditionalProperties
|
|
952
952
|
};
|
|
953
953
|
if (e.keyType?._def.typeName === "ZodString" && e.keyType._def.checks?.length) {
|
|
954
|
-
let { type: r, ...i } =
|
|
954
|
+
let { type: r, ...i } = dr(e.keyType._def, t);
|
|
955
955
|
return {
|
|
956
956
|
...n,
|
|
957
957
|
propertyNames: i
|
|
@@ -962,7 +962,7 @@ function mr(e, t) {
|
|
|
962
962
|
propertyNames: { enum: e.keyType._def.values }
|
|
963
963
|
};
|
|
964
964
|
if (e.keyType?._def.typeName === "ZodBranded" && e.keyType._def.type._def.typeName === "ZodString" && e.keyType._def.type._def.checks?.length) {
|
|
965
|
-
let { type: r, ...i } =
|
|
965
|
+
let { type: r, ...i } = er(e.keyType._def, t);
|
|
966
966
|
return {
|
|
967
967
|
...n,
|
|
968
968
|
propertyNames: i
|
|
@@ -970,13 +970,13 @@ function mr(e, t) {
|
|
|
970
970
|
}
|
|
971
971
|
return n;
|
|
972
972
|
}
|
|
973
|
-
function
|
|
974
|
-
return t.mapStrategy === "record" ?
|
|
973
|
+
function _r(e, t) {
|
|
974
|
+
return t.mapStrategy === "record" ? gr(e, t) : {
|
|
975
975
|
type: "array",
|
|
976
976
|
maxItems: 125,
|
|
977
977
|
items: {
|
|
978
978
|
type: "array",
|
|
979
|
-
items: [
|
|
979
|
+
items: [W(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
|
+
}) || B(), W(e.valueType._def, {
|
|
988
988
|
...t,
|
|
989
989
|
currentPath: [
|
|
990
990
|
...t.currentPath,
|
|
@@ -992,37 +992,37 @@ function hr(e, t) {
|
|
|
992
992
|
"items",
|
|
993
993
|
"1"
|
|
994
994
|
]
|
|
995
|
-
}) ||
|
|
995
|
+
}) || B()],
|
|
996
996
|
minItems: 2,
|
|
997
997
|
maxItems: 2
|
|
998
998
|
}
|
|
999
999
|
};
|
|
1000
1000
|
}
|
|
1001
|
-
function
|
|
1001
|
+
function vr(e) {
|
|
1002
1002
|
let t = e.values, n = Object.keys(e.values).filter((e) => typeof t[t[e]] != "number").map((e) => t[e]), r = Array.from(new Set(n.map((e) => typeof e)));
|
|
1003
1003
|
return {
|
|
1004
1004
|
type: r.length === 1 ? r[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
1005
1005
|
enum: n
|
|
1006
1006
|
};
|
|
1007
1007
|
}
|
|
1008
|
-
function
|
|
1009
|
-
return { not:
|
|
1008
|
+
function yr() {
|
|
1009
|
+
return { not: B() };
|
|
1010
1010
|
}
|
|
1011
|
-
function
|
|
1011
|
+
function br() {
|
|
1012
1012
|
return { type: "null" };
|
|
1013
1013
|
}
|
|
1014
|
-
var
|
|
1014
|
+
var xr = {
|
|
1015
1015
|
ZodString: "string",
|
|
1016
1016
|
ZodNumber: "number",
|
|
1017
1017
|
ZodBigInt: "integer",
|
|
1018
1018
|
ZodBoolean: "boolean",
|
|
1019
1019
|
ZodNull: "null"
|
|
1020
1020
|
};
|
|
1021
|
-
function
|
|
1021
|
+
function Sr(e, t) {
|
|
1022
1022
|
let n = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
|
|
1023
|
-
if (n.every((e) => e._def.typeName in
|
|
1023
|
+
if (n.every((e) => e._def.typeName in xr && (!e._def.checks || !e._def.checks.length))) {
|
|
1024
1024
|
let e = n.reduce((e, t) => {
|
|
1025
|
-
let n =
|
|
1025
|
+
let n = xr[t._def.typeName];
|
|
1026
1026
|
return n && !e.includes(n) ? [...e, n] : e;
|
|
1027
1027
|
}, []);
|
|
1028
1028
|
return { type: e.length > 1 ? e : e[0] };
|
|
@@ -1050,10 +1050,10 @@ function br(e, t) {
|
|
|
1050
1050
|
type: "string",
|
|
1051
1051
|
enum: n.reduce((e, t) => [...e, ...t._def.values.filter((t) => !e.includes(t))], [])
|
|
1052
1052
|
};
|
|
1053
|
-
return
|
|
1053
|
+
return Cr(e, t);
|
|
1054
1054
|
}
|
|
1055
|
-
var
|
|
1056
|
-
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) =>
|
|
1055
|
+
var Cr = (e, t) => {
|
|
1056
|
+
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => W(e._def, {
|
|
1057
1057
|
...t,
|
|
1058
1058
|
currentPath: [
|
|
1059
1059
|
...t.currentPath,
|
|
@@ -1063,15 +1063,15 @@ var xr = (e, t) => {
|
|
|
1063
1063
|
})).filter((e) => !!e && (!t.strictUnions || typeof e == "object" && Object.keys(e).length > 0));
|
|
1064
1064
|
return n.length ? { anyOf: n } : void 0;
|
|
1065
1065
|
};
|
|
1066
|
-
function
|
|
1066
|
+
function wr(e, t) {
|
|
1067
1067
|
if ([
|
|
1068
1068
|
"ZodString",
|
|
1069
1069
|
"ZodNumber",
|
|
1070
1070
|
"ZodBigInt",
|
|
1071
1071
|
"ZodBoolean",
|
|
1072
1072
|
"ZodNull"
|
|
1073
|
-
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [
|
|
1074
|
-
let n =
|
|
1073
|
+
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [xr[e.innerType._def.typeName], "null"] };
|
|
1074
|
+
let n = W(e.innerType._def, {
|
|
1075
1075
|
...t,
|
|
1076
1076
|
currentPath: [
|
|
1077
1077
|
...t.currentPath,
|
|
@@ -1081,7 +1081,7 @@ function Sr(e, t) {
|
|
|
1081
1081
|
});
|
|
1082
1082
|
return n && { anyOf: [n, { type: "null" }] };
|
|
1083
1083
|
}
|
|
1084
|
-
function
|
|
1084
|
+
function Tr(e) {
|
|
1085
1085
|
let t = { type: "number" };
|
|
1086
1086
|
if (!e.checks) return t;
|
|
1087
1087
|
for (let n of e.checks) switch (n.kind) {
|
|
@@ -1098,7 +1098,7 @@ function Cr(e) {
|
|
|
1098
1098
|
}
|
|
1099
1099
|
return t;
|
|
1100
1100
|
}
|
|
1101
|
-
function
|
|
1101
|
+
function Er(e, t) {
|
|
1102
1102
|
let n = {
|
|
1103
1103
|
type: "object",
|
|
1104
1104
|
properties: {}
|
|
@@ -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 =
|
|
1109
|
+
let o = Or(a), s = W(a._def, {
|
|
1110
1110
|
...t,
|
|
1111
1111
|
currentPath: [
|
|
1112
1112
|
...t.currentPath,
|
|
@@ -1122,11 +1122,11 @@ function wr(e, t) {
|
|
|
1122
1122
|
s !== void 0 && (n.properties[e] = s, o || r.push(e));
|
|
1123
1123
|
}
|
|
1124
1124
|
r.length && (n.required = r);
|
|
1125
|
-
let a =
|
|
1125
|
+
let a = Dr(e, t);
|
|
1126
1126
|
return a !== void 0 && (n.additionalProperties = a), n;
|
|
1127
1127
|
}
|
|
1128
|
-
function
|
|
1129
|
-
if (e.catchall._def.typeName !== "ZodNever") return
|
|
1128
|
+
function Dr(e, t) {
|
|
1129
|
+
if (e.catchall._def.typeName !== "ZodNever") return W(e.catchall._def, {
|
|
1130
1130
|
...t,
|
|
1131
1131
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
1132
1132
|
});
|
|
@@ -1136,16 +1136,16 @@ function Tr(e, t) {
|
|
|
1136
1136
|
case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
|
|
1137
1137
|
}
|
|
1138
1138
|
}
|
|
1139
|
-
function
|
|
1139
|
+
function Or(e) {
|
|
1140
1140
|
try {
|
|
1141
1141
|
return e.isOptional();
|
|
1142
1142
|
} catch {
|
|
1143
1143
|
return !0;
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
|
-
var
|
|
1147
|
-
if (t.currentPath.toString() === t.propertyPath?.toString()) return
|
|
1148
|
-
let n =
|
|
1146
|
+
var kr = (e, t) => {
|
|
1147
|
+
if (t.currentPath.toString() === t.propertyPath?.toString()) return W(e.innerType._def, t);
|
|
1148
|
+
let n = W(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:
|
|
1157
|
-
},
|
|
1158
|
-
if (t.pipeStrategy === "input") return
|
|
1159
|
-
if (t.pipeStrategy === "output") return
|
|
1160
|
-
let n =
|
|
1156
|
+
return n ? { anyOf: [{ not: B() }, n] } : B();
|
|
1157
|
+
}, Ar = (e, t) => {
|
|
1158
|
+
if (t.pipeStrategy === "input") return W(e.in._def, t);
|
|
1159
|
+
if (t.pipeStrategy === "output") return W(e.out._def, t);
|
|
1160
|
+
let n = W(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, W(e.out._def, {
|
|
1169
1169
|
...t,
|
|
1170
1170
|
currentPath: [
|
|
1171
1171
|
...t.currentPath,
|
|
@@ -1174,25 +1174,25 @@ var Dr = (e, t) => {
|
|
|
1174
1174
|
]
|
|
1175
1175
|
})].filter((e) => e !== void 0) };
|
|
1176
1176
|
};
|
|
1177
|
-
function
|
|
1178
|
-
return
|
|
1177
|
+
function jr(e, t) {
|
|
1178
|
+
return W(e.type._def, t);
|
|
1179
1179
|
}
|
|
1180
|
-
function
|
|
1180
|
+
function Mr(e, t) {
|
|
1181
1181
|
let n = {
|
|
1182
1182
|
type: "array",
|
|
1183
1183
|
uniqueItems: !0,
|
|
1184
|
-
items:
|
|
1184
|
+
items: W(e.valueType._def, {
|
|
1185
1185
|
...t,
|
|
1186
1186
|
currentPath: [...t.currentPath, "items"]
|
|
1187
1187
|
})
|
|
1188
1188
|
};
|
|
1189
1189
|
return e.minSize && (n.minItems = e.minSize.value), e.maxSize && (n.maxItems = e.maxSize.value), n;
|
|
1190
1190
|
}
|
|
1191
|
-
function
|
|
1191
|
+
function Nr(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) => W(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: W(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) => W(e._def, {
|
|
1212
1212
|
...t,
|
|
1213
1213
|
currentPath: [
|
|
1214
1214
|
...t.currentPath,
|
|
@@ -1218,47 +1218,47 @@ function jr(e, t) {
|
|
|
1218
1218
|
})).reduce((e, t) => t === void 0 ? e : [...e, t], [])
|
|
1219
1219
|
};
|
|
1220
1220
|
}
|
|
1221
|
-
function
|
|
1222
|
-
return { not:
|
|
1221
|
+
function Pr() {
|
|
1222
|
+
return { not: B() };
|
|
1223
1223
|
}
|
|
1224
|
-
function
|
|
1225
|
-
return
|
|
1224
|
+
function Fr() {
|
|
1225
|
+
return B();
|
|
1226
1226
|
}
|
|
1227
|
-
var
|
|
1227
|
+
var Ir = (e, t) => W(e.innerType._def, t), Lr = (e, t, n) => {
|
|
1228
1228
|
switch (t) {
|
|
1229
|
-
case "ZodString": return
|
|
1230
|
-
case "ZodNumber": return
|
|
1231
|
-
case "ZodObject": return
|
|
1232
|
-
case "ZodBigInt": return
|
|
1233
|
-
case "ZodBoolean": return
|
|
1234
|
-
case "ZodDate": return
|
|
1235
|
-
case "ZodUndefined": return
|
|
1236
|
-
case "ZodNull": return
|
|
1237
|
-
case "ZodArray": return
|
|
1229
|
+
case "ZodString": return dr(e, n);
|
|
1230
|
+
case "ZodNumber": return Tr(e);
|
|
1231
|
+
case "ZodObject": return Er(e, n);
|
|
1232
|
+
case "ZodBigInt": return Qn(e);
|
|
1233
|
+
case "ZodBoolean": return $n();
|
|
1234
|
+
case "ZodDate": return nr(e, n);
|
|
1235
|
+
case "ZodUndefined": return Pr();
|
|
1236
|
+
case "ZodNull": return br();
|
|
1237
|
+
case "ZodArray": return Zn(e, n);
|
|
1238
1238
|
case "ZodUnion":
|
|
1239
|
-
case "ZodDiscriminatedUnion": return
|
|
1240
|
-
case "ZodIntersection": return
|
|
1241
|
-
case "ZodTuple": return
|
|
1242
|
-
case "ZodRecord": return
|
|
1243
|
-
case "ZodLiteral": return
|
|
1244
|
-
case "ZodEnum": return
|
|
1245
|
-
case "ZodNativeEnum": return
|
|
1246
|
-
case "ZodNullable": return
|
|
1247
|
-
case "ZodOptional": return
|
|
1248
|
-
case "ZodMap": return
|
|
1249
|
-
case "ZodSet": return
|
|
1239
|
+
case "ZodDiscriminatedUnion": return Sr(e, n);
|
|
1240
|
+
case "ZodIntersection": return cr(e, n);
|
|
1241
|
+
case "ZodTuple": return Nr(e, n);
|
|
1242
|
+
case "ZodRecord": return gr(e, n);
|
|
1243
|
+
case "ZodLiteral": return lr(e);
|
|
1244
|
+
case "ZodEnum": return or(e);
|
|
1245
|
+
case "ZodNativeEnum": return vr(e);
|
|
1246
|
+
case "ZodNullable": return wr(e, n);
|
|
1247
|
+
case "ZodOptional": return kr(e, n);
|
|
1248
|
+
case "ZodMap": return _r(e, n);
|
|
1249
|
+
case "ZodSet": return Mr(e, n);
|
|
1250
1250
|
case "ZodLazy": return () => e.getter()._def;
|
|
1251
|
-
case "ZodPromise": return
|
|
1251
|
+
case "ZodPromise": return jr(e, n);
|
|
1252
1252
|
case "ZodNaN":
|
|
1253
|
-
case "ZodNever": return
|
|
1254
|
-
case "ZodEffects": return
|
|
1255
|
-
case "ZodAny": return
|
|
1256
|
-
case "ZodUnknown": return
|
|
1257
|
-
case "ZodDefault": return
|
|
1258
|
-
case "ZodBranded": return
|
|
1259
|
-
case "ZodReadonly": return
|
|
1260
|
-
case "ZodCatch": return
|
|
1261
|
-
case "ZodPipeline": return
|
|
1253
|
+
case "ZodNever": return yr();
|
|
1254
|
+
case "ZodEffects": return ar(e, n);
|
|
1255
|
+
case "ZodAny": return B();
|
|
1256
|
+
case "ZodUnknown": return Fr();
|
|
1257
|
+
case "ZodDefault": return ir(e, n);
|
|
1258
|
+
case "ZodBranded": return er(e, n);
|
|
1259
|
+
case "ZodReadonly": return Ir(e, n);
|
|
1260
|
+
case "ZodCatch": return tr(e, n);
|
|
1261
|
+
case "ZodPipeline": return Ar(e, n);
|
|
1262
1262
|
case "ZodFunction":
|
|
1263
1263
|
case "ZodVoid":
|
|
1264
1264
|
case "ZodSymbol": return;
|
|
@@ -1266,19 +1266,19 @@ var Pr = (e, t) => K(e.innerType._def, t), Fr = (e, t, n) => {
|
|
|
1266
1266
|
/* c8 ignore next */
|
|
1267
1267
|
return ((e) => void 0)(t);
|
|
1268
1268
|
}
|
|
1269
|
-
},
|
|
1269
|
+
}, Rr = (e, t) => {
|
|
1270
1270
|
let n = 0;
|
|
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 W(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);
|
|
1278
|
-
if (i !==
|
|
1278
|
+
if (i !== Jn) return i;
|
|
1279
1279
|
}
|
|
1280
1280
|
if (r && !n) {
|
|
1281
|
-
let e =
|
|
1281
|
+
let e = zr(r, t);
|
|
1282
1282
|
if (e !== void 0) return e;
|
|
1283
1283
|
}
|
|
1284
1284
|
let i = {
|
|
@@ -1287,22 +1287,22 @@ function K(e, t, n = !1) {
|
|
|
1287
1287
|
jsonSchema: void 0
|
|
1288
1288
|
};
|
|
1289
1289
|
t.seen.set(e, i);
|
|
1290
|
-
let a =
|
|
1291
|
-
if (o &&
|
|
1290
|
+
let a = Lr(e, e.typeName, t), o = typeof a == "function" ? W(a(), t) : a;
|
|
1291
|
+
if (o && Br(e, t, o), t.postProcess) {
|
|
1292
1292
|
let n = t.postProcess(o, e, t);
|
|
1293
1293
|
return i.jsonSchema = o, n;
|
|
1294
1294
|
}
|
|
1295
1295
|
return i.jsonSchema = o, o;
|
|
1296
1296
|
}
|
|
1297
|
-
var
|
|
1297
|
+
var zr = (e, t) => {
|
|
1298
1298
|
switch (t.$refStrategy) {
|
|
1299
1299
|
case "root": return { $ref: e.path.join("/") };
|
|
1300
|
-
case "relative": return { $ref:
|
|
1300
|
+
case "relative": return { $ref: Rr(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`), B()) : t.$refStrategy === "seen" ? B() : void 0;
|
|
1303
1303
|
}
|
|
1304
|
-
},
|
|
1305
|
-
let t =
|
|
1304
|
+
}, Br = (e, t, n) => (e.description && (n.description = e.description), n), Vr = (e) => {
|
|
1305
|
+
let t = Xn(e), n = t.name === void 0 ? t.basePath : [
|
|
1306
1306
|
...t.basePath,
|
|
1307
1307
|
t.definitionPath,
|
|
1308
1308
|
t.name
|
|
@@ -1321,25 +1321,25 @@ var Lr = (e, t) => {
|
|
|
1321
1321
|
jsonSchema: void 0
|
|
1322
1322
|
}]))
|
|
1323
1323
|
};
|
|
1324
|
-
},
|
|
1325
|
-
let n =
|
|
1324
|
+
}, Hr = (e, t) => {
|
|
1325
|
+
let n = Vr(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
|
|
1326
1326
|
...e,
|
|
1327
|
-
[t]:
|
|
1327
|
+
[t]: W(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) ?? B()
|
|
1335
|
+
}), {}) : void 0, i = typeof t == "string" ? t : t?.nameStrategy === "title" ? void 0 : t?.name, a = W(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) ?? B(), 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,
|
|
@@ -1356,14 +1356,14 @@ var Lr = (e, t) => {
|
|
|
1356
1356
|
}
|
|
1357
1357
|
};
|
|
1358
1358
|
return s.$schema = "http://json-schema.org/draft-07/schema#", s;
|
|
1359
|
-
},
|
|
1360
|
-
function
|
|
1359
|
+
}, Ur = Symbol.for("vercel.ai.schema");
|
|
1360
|
+
function Wr(e) {
|
|
1361
1361
|
let t;
|
|
1362
1362
|
return () => (t ??= e(), t);
|
|
1363
1363
|
}
|
|
1364
|
-
function
|
|
1364
|
+
function Gr(e, { validate: t } = {}) {
|
|
1365
1365
|
return {
|
|
1366
|
-
[
|
|
1366
|
+
[Ur]: !0,
|
|
1367
1367
|
_type: void 0,
|
|
1368
1368
|
get jsonSchema() {
|
|
1369
1369
|
return typeof e == "function" && (e = e()), e;
|
|
@@ -1371,20 +1371,20 @@ function Ur(e, { validate: t } = {}) {
|
|
|
1371
1371
|
validate: t
|
|
1372
1372
|
};
|
|
1373
1373
|
}
|
|
1374
|
-
function
|
|
1375
|
-
return typeof e == "object" && !!e &&
|
|
1374
|
+
function Kr(e) {
|
|
1375
|
+
return typeof e == "object" && !!e && Ur in e && e[Ur] === !0 && "jsonSchema" in e && "validate" in e;
|
|
1376
1376
|
}
|
|
1377
|
-
function
|
|
1378
|
-
return e == null ?
|
|
1377
|
+
function qr(e) {
|
|
1378
|
+
return e == null ? Gr({
|
|
1379
1379
|
type: "object",
|
|
1380
1380
|
properties: {},
|
|
1381
1381
|
additionalProperties: !1
|
|
1382
|
-
}) :
|
|
1382
|
+
}) : Kr(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? $r(e) : Jr(e) : e();
|
|
1383
1383
|
}
|
|
1384
|
-
function
|
|
1385
|
-
return
|
|
1386
|
-
if (!
|
|
1387
|
-
return
|
|
1384
|
+
function Jr(e) {
|
|
1385
|
+
return Gr(() => {
|
|
1386
|
+
if (!Yr(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
|
|
1387
|
+
return qn(e["~standard"].jsonSchema.input({ target: "draft-07" }));
|
|
1388
1388
|
}, { validate: async (t) => {
|
|
1389
1389
|
let n = await e["~standard"].validate(t);
|
|
1390
1390
|
return "value" in n ? {
|
|
@@ -1392,19 +1392,19 @@ function Kr(e) {
|
|
|
1392
1392
|
value: n.value
|
|
1393
1393
|
} : {
|
|
1394
1394
|
success: !1,
|
|
1395
|
-
error: new
|
|
1395
|
+
error: new wn({
|
|
1396
1396
|
value: t,
|
|
1397
1397
|
cause: n.issues
|
|
1398
1398
|
})
|
|
1399
1399
|
};
|
|
1400
1400
|
} });
|
|
1401
1401
|
}
|
|
1402
|
-
function
|
|
1402
|
+
function Yr(e) {
|
|
1403
1403
|
return e["~standard"].jsonSchema != null;
|
|
1404
1404
|
}
|
|
1405
|
-
function
|
|
1405
|
+
function Xr(e, t) {
|
|
1406
1406
|
let n = t?.useReferences ?? !1;
|
|
1407
|
-
return
|
|
1407
|
+
return Gr(() => Hr(e, { $refStrategy: n ? "root" : "none" }), { validate: async (t) => {
|
|
1408
1408
|
let n = await e.safeParseAsync(t);
|
|
1409
1409
|
return n.success ? {
|
|
1410
1410
|
success: !0,
|
|
@@ -1415,14 +1415,14 @@ function Jr(e, t) {
|
|
|
1415
1415
|
};
|
|
1416
1416
|
} });
|
|
1417
1417
|
}
|
|
1418
|
-
function
|
|
1418
|
+
function Zr(e, t) {
|
|
1419
1419
|
let n = t?.useReferences ?? !1;
|
|
1420
|
-
return
|
|
1420
|
+
return Gr(() => qn(ct(e, {
|
|
1421
1421
|
target: "draft-7",
|
|
1422
1422
|
io: "input",
|
|
1423
1423
|
reused: n ? "ref" : "inline"
|
|
1424
1424
|
})), { validate: async (t) => {
|
|
1425
|
-
let n = await
|
|
1425
|
+
let n = await ut(e, t);
|
|
1426
1426
|
return n.success ? {
|
|
1427
1427
|
success: !0,
|
|
1428
1428
|
value: n.data
|
|
@@ -1432,27 +1432,27 @@ function Yr(e, t) {
|
|
|
1432
1432
|
};
|
|
1433
1433
|
} });
|
|
1434
1434
|
}
|
|
1435
|
-
function
|
|
1435
|
+
function Qr(e) {
|
|
1436
1436
|
return "_zod" in e;
|
|
1437
1437
|
}
|
|
1438
|
-
function
|
|
1439
|
-
return
|
|
1438
|
+
function $r(e, t) {
|
|
1439
|
+
return Qr(e) ? Zr(e, t) : Xr(e, t);
|
|
1440
1440
|
}
|
|
1441
|
-
async function
|
|
1442
|
-
let r = await
|
|
1441
|
+
async function ei({ value: e, schema: t, context: n }) {
|
|
1442
|
+
let r = await ti({
|
|
1443
1443
|
value: e,
|
|
1444
1444
|
schema: t,
|
|
1445
1445
|
context: n
|
|
1446
1446
|
});
|
|
1447
|
-
if (!r.success) throw
|
|
1447
|
+
if (!r.success) throw wn.wrap({
|
|
1448
1448
|
value: e,
|
|
1449
1449
|
cause: r.error,
|
|
1450
1450
|
context: n
|
|
1451
1451
|
});
|
|
1452
1452
|
return r.value;
|
|
1453
1453
|
}
|
|
1454
|
-
async function
|
|
1455
|
-
let r =
|
|
1454
|
+
async function ti({ value: e, schema: t, context: n }) {
|
|
1455
|
+
let r = qr(t);
|
|
1456
1456
|
try {
|
|
1457
1457
|
if (r.validate == null) return {
|
|
1458
1458
|
success: !0,
|
|
@@ -1466,7 +1466,7 @@ async function $r({ value: e, schema: t, context: n }) {
|
|
|
1466
1466
|
rawValue: e
|
|
1467
1467
|
} : {
|
|
1468
1468
|
success: !1,
|
|
1469
|
-
error:
|
|
1469
|
+
error: wn.wrap({
|
|
1470
1470
|
value: e,
|
|
1471
1471
|
cause: t.error,
|
|
1472
1472
|
context: n
|
|
@@ -1476,7 +1476,7 @@ async function $r({ value: e, schema: t, context: n }) {
|
|
|
1476
1476
|
} catch (t) {
|
|
1477
1477
|
return {
|
|
1478
1478
|
success: !1,
|
|
1479
|
-
error:
|
|
1479
|
+
error: wn.wrap({
|
|
1480
1480
|
value: e,
|
|
1481
1481
|
cause: t,
|
|
1482
1482
|
context: n
|
|
@@ -1485,21 +1485,21 @@ async function $r({ value: e, schema: t, context: n }) {
|
|
|
1485
1485
|
};
|
|
1486
1486
|
}
|
|
1487
1487
|
}
|
|
1488
|
-
async function
|
|
1488
|
+
async function ni({ text: e, schema: t }) {
|
|
1489
1489
|
try {
|
|
1490
|
-
let n =
|
|
1490
|
+
let n = Kn(e);
|
|
1491
1491
|
return t == null ? {
|
|
1492
1492
|
success: !0,
|
|
1493
1493
|
value: n,
|
|
1494
1494
|
rawValue: n
|
|
1495
|
-
} : await
|
|
1495
|
+
} : await ti({
|
|
1496
1496
|
value: n,
|
|
1497
1497
|
schema: t
|
|
1498
1498
|
});
|
|
1499
1499
|
} catch (t) {
|
|
1500
1500
|
return {
|
|
1501
1501
|
success: !1,
|
|
1502
|
-
error:
|
|
1502
|
+
error: bn.isInstance(t) ? t : new bn({
|
|
1503
1503
|
text: e,
|
|
1504
1504
|
cause: t
|
|
1505
1505
|
}),
|
|
@@ -1507,42 +1507,42 @@ async function ei({ text: e, schema: t }) {
|
|
|
1507
1507
|
};
|
|
1508
1508
|
}
|
|
1509
1509
|
}
|
|
1510
|
-
function
|
|
1511
|
-
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new
|
|
1512
|
-
e !== "[DONE]" && n.enqueue(await
|
|
1510
|
+
function ri({ stream: e, schema: t }) {
|
|
1511
|
+
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new In()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
|
|
1512
|
+
e !== "[DONE]" && n.enqueue(await ni({
|
|
1513
1513
|
text: e,
|
|
1514
1514
|
schema: t
|
|
1515
1515
|
}));
|
|
1516
1516
|
} }));
|
|
1517
1517
|
}
|
|
1518
|
-
async function
|
|
1518
|
+
async function ii(e) {
|
|
1519
1519
|
return typeof e == "function" && (e = e()), e;
|
|
1520
1520
|
}
|
|
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
|
|
1524
|
+
var ai = "AI_InvalidArgumentError", oi = `vercel.ai.error.${ai}`, si = Symbol.for(oi), ci = class extends I {
|
|
1525
1525
|
constructor({ parameter: e, value: t, message: n }) {
|
|
1526
1526
|
super({
|
|
1527
|
-
name:
|
|
1527
|
+
name: ai,
|
|
1528
1528
|
message: `Invalid argument for parameter ${e}: ${n}`
|
|
1529
|
-
}), this[
|
|
1529
|
+
}), this[si] = !0, this.parameter = e, this.value = t;
|
|
1530
1530
|
}
|
|
1531
1531
|
static isInstance(e) {
|
|
1532
|
-
return
|
|
1532
|
+
return I.hasMarker(e, oi);
|
|
1533
1533
|
}
|
|
1534
|
-
},
|
|
1534
|
+
}, li = "AI_UIMessageStreamError", ui = `vercel.ai.error.${li}`, di = Symbol.for(ui), G = class extends I {
|
|
1535
1535
|
constructor({ chunkType: e, chunkId: t, message: n }) {
|
|
1536
1536
|
super({
|
|
1537
|
-
name:
|
|
1537
|
+
name: li,
|
|
1538
1538
|
message: n
|
|
1539
|
-
}), this[
|
|
1539
|
+
}), this[di] = !0, this.chunkType = e, this.chunkId = t;
|
|
1540
1540
|
}
|
|
1541
1541
|
static isInstance(e) {
|
|
1542
|
-
return
|
|
1542
|
+
return I.hasMarker(e, ui);
|
|
1543
1543
|
}
|
|
1544
1544
|
};
|
|
1545
|
-
function
|
|
1545
|
+
function fi(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,236 +1551,236 @@ function di(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 ? fi(a, i) : i;
|
|
1555
1555
|
}
|
|
1556
1556
|
return n;
|
|
1557
1557
|
}
|
|
1558
|
-
var
|
|
1559
|
-
array:
|
|
1560
|
-
boolean:
|
|
1561
|
-
custom:
|
|
1562
|
-
discriminatedUnion:
|
|
1563
|
-
enum:
|
|
1564
|
-
instanceof:
|
|
1565
|
-
lazy:
|
|
1566
|
-
literal:
|
|
1567
|
-
looseObject:
|
|
1568
|
-
never:
|
|
1569
|
-
null:
|
|
1570
|
-
number:
|
|
1571
|
-
object:
|
|
1572
|
-
record:
|
|
1573
|
-
string:
|
|
1574
|
-
union:
|
|
1575
|
-
unknown:
|
|
1576
|
-
},
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
])), J =
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
]), mi =
|
|
1589
|
-
type:
|
|
1590
|
-
text:
|
|
1558
|
+
var K = {
|
|
1559
|
+
array: Xe,
|
|
1560
|
+
boolean: et,
|
|
1561
|
+
custom: $e,
|
|
1562
|
+
discriminatedUnion: tt,
|
|
1563
|
+
enum: Qe,
|
|
1564
|
+
instanceof: Je,
|
|
1565
|
+
lazy: at,
|
|
1566
|
+
literal: ht,
|
|
1567
|
+
looseObject: dt,
|
|
1568
|
+
never: lt,
|
|
1569
|
+
null: Ze,
|
|
1570
|
+
number: nt,
|
|
1571
|
+
object: ft,
|
|
1572
|
+
record: rt,
|
|
1573
|
+
string: gt,
|
|
1574
|
+
union: ot,
|
|
1575
|
+
unknown: pt
|
|
1576
|
+
}, q = K.lazy(() => K.union([
|
|
1577
|
+
K.null(),
|
|
1578
|
+
K.string(),
|
|
1579
|
+
K.number(),
|
|
1580
|
+
K.boolean(),
|
|
1581
|
+
K.record(K.string(), q.optional()),
|
|
1582
|
+
K.array(q)
|
|
1583
|
+
])), J = K.record(K.string(), K.record(K.string(), q.optional())), pi = K.union([
|
|
1584
|
+
K.string(),
|
|
1585
|
+
K.instanceof(Uint8Array),
|
|
1586
|
+
K.instanceof(ArrayBuffer),
|
|
1587
|
+
K.custom(Vn, { message: "Must be a Buffer" })
|
|
1588
|
+
]), mi = K.record(K.string(), K.string()), hi = K.object({
|
|
1589
|
+
type: K.literal("text"),
|
|
1590
|
+
text: K.string(),
|
|
1591
1591
|
providerOptions: J.optional()
|
|
1592
|
-
}), gi =
|
|
1593
|
-
type:
|
|
1594
|
-
image:
|
|
1592
|
+
}), gi = K.object({
|
|
1593
|
+
type: K.literal("image"),
|
|
1594
|
+
image: K.union([
|
|
1595
1595
|
pi,
|
|
1596
|
-
|
|
1596
|
+
K.instanceof(URL),
|
|
1597
1597
|
mi
|
|
1598
1598
|
]),
|
|
1599
|
-
mediaType:
|
|
1599
|
+
mediaType: K.string().optional(),
|
|
1600
1600
|
providerOptions: J.optional()
|
|
1601
|
-
}), _i =
|
|
1602
|
-
|
|
1603
|
-
type:
|
|
1601
|
+
}), _i = K.discriminatedUnion("type", [
|
|
1602
|
+
K.object({
|
|
1603
|
+
type: K.literal("data"),
|
|
1604
1604
|
data: pi
|
|
1605
1605
|
}),
|
|
1606
|
-
|
|
1607
|
-
type:
|
|
1608
|
-
url:
|
|
1606
|
+
K.object({
|
|
1607
|
+
type: K.literal("url"),
|
|
1608
|
+
url: K.instanceof(URL)
|
|
1609
1609
|
}),
|
|
1610
|
-
|
|
1611
|
-
type:
|
|
1610
|
+
K.object({
|
|
1611
|
+
type: K.literal("reference"),
|
|
1612
1612
|
reference: mi
|
|
1613
1613
|
}),
|
|
1614
|
-
|
|
1615
|
-
type:
|
|
1616
|
-
text:
|
|
1614
|
+
K.object({
|
|
1615
|
+
type: K.literal("text"),
|
|
1616
|
+
text: K.string()
|
|
1617
1617
|
})
|
|
1618
|
-
]), vi =
|
|
1619
|
-
type:
|
|
1618
|
+
]), vi = K.discriminatedUnion("type", [K.object({
|
|
1619
|
+
type: K.literal("data"),
|
|
1620
1620
|
data: pi
|
|
1621
|
-
}),
|
|
1622
|
-
type:
|
|
1623
|
-
url:
|
|
1624
|
-
})]), yi =
|
|
1625
|
-
type:
|
|
1626
|
-
data:
|
|
1621
|
+
}), K.object({
|
|
1622
|
+
type: K.literal("url"),
|
|
1623
|
+
url: K.instanceof(URL)
|
|
1624
|
+
})]), yi = K.object({
|
|
1625
|
+
type: K.literal("file"),
|
|
1626
|
+
data: K.union([
|
|
1627
1627
|
_i,
|
|
1628
1628
|
pi,
|
|
1629
|
-
|
|
1629
|
+
K.instanceof(URL),
|
|
1630
1630
|
mi
|
|
1631
1631
|
]),
|
|
1632
|
-
filename:
|
|
1633
|
-
mediaType:
|
|
1632
|
+
filename: K.string().optional(),
|
|
1633
|
+
mediaType: K.string(),
|
|
1634
1634
|
providerOptions: J.optional()
|
|
1635
|
-
}), bi =
|
|
1636
|
-
type:
|
|
1637
|
-
text:
|
|
1635
|
+
}), bi = K.object({
|
|
1636
|
+
type: K.literal("reasoning"),
|
|
1637
|
+
text: K.string(),
|
|
1638
1638
|
providerOptions: J.optional()
|
|
1639
|
-
}), xi =
|
|
1640
|
-
type:
|
|
1641
|
-
kind:
|
|
1639
|
+
}), xi = K.object({
|
|
1640
|
+
type: K.literal("custom"),
|
|
1641
|
+
kind: K.string().transform((e) => e),
|
|
1642
1642
|
providerOptions: J.optional()
|
|
1643
|
-
}), Si =
|
|
1644
|
-
type:
|
|
1645
|
-
data:
|
|
1643
|
+
}), Si = K.object({
|
|
1644
|
+
type: K.literal("reasoning-file"),
|
|
1645
|
+
data: K.union([
|
|
1646
1646
|
vi,
|
|
1647
1647
|
pi,
|
|
1648
|
-
|
|
1648
|
+
K.instanceof(URL)
|
|
1649
1649
|
]),
|
|
1650
|
-
mediaType:
|
|
1650
|
+
mediaType: K.string(),
|
|
1651
1651
|
providerOptions: J.optional()
|
|
1652
|
-
}), Ci =
|
|
1653
|
-
type:
|
|
1654
|
-
toolCallId:
|
|
1655
|
-
toolName:
|
|
1656
|
-
input:
|
|
1652
|
+
}), Ci = K.object({
|
|
1653
|
+
type: K.literal("tool-call"),
|
|
1654
|
+
toolCallId: K.string(),
|
|
1655
|
+
toolName: K.string(),
|
|
1656
|
+
input: K.unknown(),
|
|
1657
1657
|
providerOptions: J.optional(),
|
|
1658
|
-
providerExecuted:
|
|
1659
|
-
}), wi =
|
|
1660
|
-
|
|
1661
|
-
type:
|
|
1662
|
-
value:
|
|
1658
|
+
providerExecuted: K.boolean().optional()
|
|
1659
|
+
}), wi = K.discriminatedUnion("type", [
|
|
1660
|
+
K.object({
|
|
1661
|
+
type: K.literal("text"),
|
|
1662
|
+
value: K.string(),
|
|
1663
1663
|
providerOptions: J.optional()
|
|
1664
1664
|
}),
|
|
1665
|
-
|
|
1666
|
-
type:
|
|
1667
|
-
value:
|
|
1665
|
+
K.object({
|
|
1666
|
+
type: K.literal("json"),
|
|
1667
|
+
value: q,
|
|
1668
1668
|
providerOptions: J.optional()
|
|
1669
1669
|
}),
|
|
1670
|
-
|
|
1671
|
-
type:
|
|
1672
|
-
reason:
|
|
1670
|
+
K.object({
|
|
1671
|
+
type: K.literal("execution-denied"),
|
|
1672
|
+
reason: K.string().optional(),
|
|
1673
1673
|
providerOptions: J.optional()
|
|
1674
1674
|
}),
|
|
1675
|
-
|
|
1676
|
-
type:
|
|
1677
|
-
value:
|
|
1675
|
+
K.object({
|
|
1676
|
+
type: K.literal("error-text"),
|
|
1677
|
+
value: K.string(),
|
|
1678
1678
|
providerOptions: J.optional()
|
|
1679
1679
|
}),
|
|
1680
|
-
|
|
1681
|
-
type:
|
|
1682
|
-
value:
|
|
1680
|
+
K.object({
|
|
1681
|
+
type: K.literal("error-json"),
|
|
1682
|
+
value: q,
|
|
1683
1683
|
providerOptions: J.optional()
|
|
1684
1684
|
}),
|
|
1685
|
-
|
|
1686
|
-
type:
|
|
1687
|
-
value:
|
|
1688
|
-
|
|
1689
|
-
type:
|
|
1690
|
-
text:
|
|
1685
|
+
K.object({
|
|
1686
|
+
type: K.literal("content"),
|
|
1687
|
+
value: K.array(K.union([
|
|
1688
|
+
K.object({
|
|
1689
|
+
type: K.literal("text"),
|
|
1690
|
+
text: K.string(),
|
|
1691
1691
|
providerOptions: J.optional()
|
|
1692
1692
|
}),
|
|
1693
|
-
|
|
1694
|
-
type:
|
|
1693
|
+
K.object({
|
|
1694
|
+
type: K.literal("file"),
|
|
1695
1695
|
data: _i,
|
|
1696
|
-
mediaType:
|
|
1697
|
-
filename:
|
|
1696
|
+
mediaType: K.string(),
|
|
1697
|
+
filename: K.string().optional(),
|
|
1698
1698
|
providerOptions: J.optional()
|
|
1699
1699
|
}),
|
|
1700
|
-
|
|
1701
|
-
type:
|
|
1702
|
-
data:
|
|
1703
|
-
mediaType:
|
|
1704
|
-
filename:
|
|
1700
|
+
K.object({
|
|
1701
|
+
type: K.literal("file-data"),
|
|
1702
|
+
data: K.string(),
|
|
1703
|
+
mediaType: K.string(),
|
|
1704
|
+
filename: K.string().optional(),
|
|
1705
1705
|
providerOptions: J.optional()
|
|
1706
1706
|
}),
|
|
1707
|
-
|
|
1708
|
-
type:
|
|
1709
|
-
url:
|
|
1710
|
-
mediaType:
|
|
1707
|
+
K.object({
|
|
1708
|
+
type: K.literal("file-url"),
|
|
1709
|
+
url: K.string(),
|
|
1710
|
+
mediaType: K.string().optional(),
|
|
1711
1711
|
providerOptions: J.optional()
|
|
1712
1712
|
}),
|
|
1713
|
-
|
|
1714
|
-
type:
|
|
1715
|
-
fileId:
|
|
1713
|
+
K.object({
|
|
1714
|
+
type: K.literal("file-id"),
|
|
1715
|
+
fileId: K.union([K.string(), K.record(K.string(), K.string())]),
|
|
1716
1716
|
providerOptions: J.optional()
|
|
1717
1717
|
}),
|
|
1718
|
-
|
|
1719
|
-
type:
|
|
1720
|
-
providerReference:
|
|
1718
|
+
K.object({
|
|
1719
|
+
type: K.literal("file-reference"),
|
|
1720
|
+
providerReference: K.record(K.string(), K.string()),
|
|
1721
1721
|
providerOptions: J.optional()
|
|
1722
1722
|
}),
|
|
1723
|
-
|
|
1724
|
-
type:
|
|
1725
|
-
data:
|
|
1726
|
-
mediaType:
|
|
1723
|
+
K.object({
|
|
1724
|
+
type: K.literal("image-data"),
|
|
1725
|
+
data: K.string(),
|
|
1726
|
+
mediaType: K.string(),
|
|
1727
1727
|
providerOptions: J.optional()
|
|
1728
1728
|
}),
|
|
1729
|
-
|
|
1730
|
-
type:
|
|
1731
|
-
url:
|
|
1729
|
+
K.object({
|
|
1730
|
+
type: K.literal("image-url"),
|
|
1731
|
+
url: K.string(),
|
|
1732
1732
|
providerOptions: J.optional()
|
|
1733
1733
|
}),
|
|
1734
|
-
|
|
1735
|
-
type:
|
|
1736
|
-
fileId:
|
|
1734
|
+
K.object({
|
|
1735
|
+
type: K.literal("image-file-id"),
|
|
1736
|
+
fileId: K.union([K.string(), K.record(K.string(), K.string())]),
|
|
1737
1737
|
providerOptions: J.optional()
|
|
1738
1738
|
}),
|
|
1739
|
-
|
|
1740
|
-
type:
|
|
1741
|
-
providerReference:
|
|
1739
|
+
K.object({
|
|
1740
|
+
type: K.literal("image-file-reference"),
|
|
1741
|
+
providerReference: K.record(K.string(), K.string()),
|
|
1742
1742
|
providerOptions: J.optional()
|
|
1743
1743
|
}),
|
|
1744
|
-
|
|
1745
|
-
type:
|
|
1744
|
+
K.object({
|
|
1745
|
+
type: K.literal("custom"),
|
|
1746
1746
|
providerOptions: J.optional()
|
|
1747
1747
|
})
|
|
1748
1748
|
]))
|
|
1749
1749
|
})
|
|
1750
|
-
]), Ti =
|
|
1751
|
-
type:
|
|
1752
|
-
toolCallId:
|
|
1753
|
-
toolName:
|
|
1750
|
+
]), Ti = K.object({
|
|
1751
|
+
type: K.literal("tool-result"),
|
|
1752
|
+
toolCallId: K.string(),
|
|
1753
|
+
toolName: K.string(),
|
|
1754
1754
|
output: wi,
|
|
1755
1755
|
providerOptions: J.optional()
|
|
1756
|
-
}), Ei =
|
|
1757
|
-
type:
|
|
1758
|
-
approvalId:
|
|
1759
|
-
toolCallId:
|
|
1760
|
-
reason:
|
|
1761
|
-
isAutomatic:
|
|
1762
|
-
signature:
|
|
1763
|
-
inputSchemaInput:
|
|
1764
|
-
}), Di =
|
|
1765
|
-
type:
|
|
1766
|
-
approvalId:
|
|
1767
|
-
approved:
|
|
1768
|
-
reason:
|
|
1769
|
-
}), Oi =
|
|
1770
|
-
role:
|
|
1771
|
-
content:
|
|
1756
|
+
}), Ei = K.object({
|
|
1757
|
+
type: K.literal("tool-approval-request"),
|
|
1758
|
+
approvalId: K.string(),
|
|
1759
|
+
toolCallId: K.string(),
|
|
1760
|
+
reason: K.string().optional(),
|
|
1761
|
+
isAutomatic: K.boolean().optional(),
|
|
1762
|
+
signature: K.string().optional(),
|
|
1763
|
+
inputSchemaInput: K.unknown().optional()
|
|
1764
|
+
}), Di = K.object({
|
|
1765
|
+
type: K.literal("tool-approval-response"),
|
|
1766
|
+
approvalId: K.string(),
|
|
1767
|
+
approved: K.boolean(),
|
|
1768
|
+
reason: K.string().optional()
|
|
1769
|
+
}), Oi = K.object({
|
|
1770
|
+
role: K.literal("system"),
|
|
1771
|
+
content: K.string(),
|
|
1772
1772
|
providerOptions: J.optional()
|
|
1773
|
-
}), ki =
|
|
1774
|
-
role:
|
|
1775
|
-
content:
|
|
1773
|
+
}), ki = K.object({
|
|
1774
|
+
role: K.literal("user"),
|
|
1775
|
+
content: K.union([K.string(), K.array(K.union([
|
|
1776
1776
|
hi,
|
|
1777
1777
|
gi,
|
|
1778
1778
|
yi
|
|
1779
1779
|
]))]),
|
|
1780
1780
|
providerOptions: J.optional()
|
|
1781
|
-
}), Ai =
|
|
1782
|
-
role:
|
|
1783
|
-
content:
|
|
1781
|
+
}), Ai = K.object({
|
|
1782
|
+
role: K.literal("assistant"),
|
|
1783
|
+
content: K.union([K.string(), K.array(K.union([
|
|
1784
1784
|
hi,
|
|
1785
1785
|
xi,
|
|
1786
1786
|
yi,
|
|
@@ -1791,12 +1791,12 @@ var q = {
|
|
|
1791
1791
|
Ei
|
|
1792
1792
|
]))]),
|
|
1793
1793
|
providerOptions: J.optional()
|
|
1794
|
-
}), ji =
|
|
1795
|
-
role:
|
|
1796
|
-
content:
|
|
1794
|
+
}), ji = K.object({
|
|
1795
|
+
role: K.literal("tool"),
|
|
1796
|
+
content: K.array(K.union([Ti, Di])),
|
|
1797
1797
|
providerOptions: J.optional()
|
|
1798
1798
|
});
|
|
1799
|
-
|
|
1799
|
+
K.union([
|
|
1800
1800
|
Oi,
|
|
1801
1801
|
ki,
|
|
1802
1802
|
Ai,
|
|
@@ -1989,11 +1989,11 @@ async function Ni(e) {
|
|
|
1989
1989
|
value: void 0,
|
|
1990
1990
|
state: "undefined-input"
|
|
1991
1991
|
};
|
|
1992
|
-
let t = await
|
|
1992
|
+
let t = await ni({ text: e });
|
|
1993
1993
|
return t.success ? {
|
|
1994
1994
|
value: t.value,
|
|
1995
1995
|
state: "successful-parse"
|
|
1996
|
-
} : (t = await
|
|
1996
|
+
} : (t = await ni({ text: Mi(e) }), t.success ? {
|
|
1997
1997
|
value: t.value,
|
|
1998
1998
|
state: "repaired-parse"
|
|
1999
1999
|
} : {
|
|
@@ -2001,10 +2001,10 @@ async function Ni(e) {
|
|
|
2001
2001
|
state: "failed-parse"
|
|
2002
2002
|
});
|
|
2003
2003
|
}
|
|
2004
|
-
new TextEncoder(), new TextEncoder(),
|
|
2004
|
+
new TextEncoder(), new TextEncoder(), R({
|
|
2005
2005
|
prefix: "aitxt",
|
|
2006
2006
|
size: 24
|
|
2007
|
-
}),
|
|
2007
|
+
}), R({
|
|
2008
2008
|
prefix: "call",
|
|
2009
2009
|
size: 24
|
|
2010
2010
|
});
|
|
@@ -2073,193 +2073,193 @@ function Bi({ status: e, statusText: t, headers: n, stream: r, keepAliveMs: i, c
|
|
|
2073
2073
|
headers: Pi(n, zi)
|
|
2074
2074
|
});
|
|
2075
2075
|
}
|
|
2076
|
-
var Vi =
|
|
2077
|
-
source:
|
|
2078
|
-
type:
|
|
2079
|
-
sourceType:
|
|
2080
|
-
id:
|
|
2081
|
-
url:
|
|
2082
|
-
title:
|
|
2076
|
+
var Vi = K.object({
|
|
2077
|
+
source: K.discriminatedUnion("sourceType", [K.object({
|
|
2078
|
+
type: K.literal("source"),
|
|
2079
|
+
sourceType: K.literal("url"),
|
|
2080
|
+
id: K.string(),
|
|
2081
|
+
url: K.string(),
|
|
2082
|
+
title: K.string().optional(),
|
|
2083
2083
|
providerMetadata: J.optional()
|
|
2084
|
-
}),
|
|
2085
|
-
type:
|
|
2086
|
-
sourceType:
|
|
2087
|
-
id:
|
|
2088
|
-
mediaType:
|
|
2089
|
-
title:
|
|
2090
|
-
filename:
|
|
2084
|
+
}), K.object({
|
|
2085
|
+
type: K.literal("source"),
|
|
2086
|
+
sourceType: K.literal("document"),
|
|
2087
|
+
id: K.string(),
|
|
2088
|
+
mediaType: K.string(),
|
|
2089
|
+
title: K.string(),
|
|
2090
|
+
filename: K.string().optional(),
|
|
2091
2091
|
providerMetadata: J.optional()
|
|
2092
2092
|
})]),
|
|
2093
|
-
startIndex:
|
|
2094
|
-
endIndex:
|
|
2095
|
-
citedText:
|
|
2096
|
-
}), Hi =
|
|
2097
|
-
|
|
2098
|
-
type:
|
|
2099
|
-
id:
|
|
2093
|
+
startIndex: K.number().int().nonnegative().optional(),
|
|
2094
|
+
endIndex: K.number().int().nonnegative().optional(),
|
|
2095
|
+
citedText: K.string().optional()
|
|
2096
|
+
}), Hi = K.record(K.string(), q.optional()), Ui = Wr(() => $r(K.union([
|
|
2097
|
+
K.looseObject({
|
|
2098
|
+
type: K.literal("text-start"),
|
|
2099
|
+
id: K.string(),
|
|
2100
2100
|
providerMetadata: J.optional()
|
|
2101
2101
|
}),
|
|
2102
|
-
|
|
2103
|
-
type:
|
|
2104
|
-
id:
|
|
2105
|
-
delta:
|
|
2102
|
+
K.looseObject({
|
|
2103
|
+
type: K.literal("text-delta"),
|
|
2104
|
+
id: K.string(),
|
|
2105
|
+
delta: K.string(),
|
|
2106
2106
|
providerMetadata: J.optional()
|
|
2107
2107
|
}),
|
|
2108
|
-
|
|
2109
|
-
type:
|
|
2110
|
-
id:
|
|
2111
|
-
citations:
|
|
2108
|
+
K.looseObject({
|
|
2109
|
+
type: K.literal("text-end"),
|
|
2110
|
+
id: K.string(),
|
|
2111
|
+
citations: K.array(Vi).optional(),
|
|
2112
2112
|
providerMetadata: J.optional()
|
|
2113
2113
|
}),
|
|
2114
|
-
|
|
2115
|
-
type:
|
|
2116
|
-
errorText:
|
|
2114
|
+
K.looseObject({
|
|
2115
|
+
type: K.literal("error"),
|
|
2116
|
+
errorText: K.string()
|
|
2117
2117
|
}),
|
|
2118
|
-
|
|
2119
|
-
type:
|
|
2120
|
-
toolCallId:
|
|
2121
|
-
toolName:
|
|
2122
|
-
inputEncoding:
|
|
2123
|
-
providerExecuted:
|
|
2118
|
+
K.looseObject({
|
|
2119
|
+
type: K.literal("tool-input-start"),
|
|
2120
|
+
toolCallId: K.string(),
|
|
2121
|
+
toolName: K.string(),
|
|
2122
|
+
inputEncoding: K.enum(["json", "text"]).optional(),
|
|
2123
|
+
providerExecuted: K.boolean().optional(),
|
|
2124
2124
|
providerMetadata: J.optional(),
|
|
2125
2125
|
toolMetadata: Hi.optional(),
|
|
2126
|
-
dynamic:
|
|
2127
|
-
title:
|
|
2126
|
+
dynamic: K.boolean().optional(),
|
|
2127
|
+
title: K.string().optional()
|
|
2128
2128
|
}),
|
|
2129
|
-
|
|
2130
|
-
type:
|
|
2131
|
-
toolCallId:
|
|
2132
|
-
inputTextDelta:
|
|
2129
|
+
K.looseObject({
|
|
2130
|
+
type: K.literal("tool-input-delta"),
|
|
2131
|
+
toolCallId: K.string(),
|
|
2132
|
+
inputTextDelta: K.string()
|
|
2133
2133
|
}),
|
|
2134
|
-
|
|
2135
|
-
type:
|
|
2136
|
-
toolCallId:
|
|
2137
|
-
toolName:
|
|
2138
|
-
input:
|
|
2139
|
-
providerExecuted:
|
|
2134
|
+
K.looseObject({
|
|
2135
|
+
type: K.literal("tool-input-available"),
|
|
2136
|
+
toolCallId: K.string(),
|
|
2137
|
+
toolName: K.string(),
|
|
2138
|
+
input: K.unknown(),
|
|
2139
|
+
providerExecuted: K.boolean().optional(),
|
|
2140
2140
|
providerMetadata: J.optional(),
|
|
2141
2141
|
toolMetadata: Hi.optional(),
|
|
2142
|
-
dynamic:
|
|
2143
|
-
title:
|
|
2142
|
+
dynamic: K.boolean().optional(),
|
|
2143
|
+
title: K.string().optional()
|
|
2144
2144
|
}),
|
|
2145
|
-
|
|
2146
|
-
type:
|
|
2147
|
-
toolCallId:
|
|
2148
|
-
toolName:
|
|
2149
|
-
input:
|
|
2150
|
-
providerExecuted:
|
|
2145
|
+
K.looseObject({
|
|
2146
|
+
type: K.literal("tool-input-error"),
|
|
2147
|
+
toolCallId: K.string(),
|
|
2148
|
+
toolName: K.string(),
|
|
2149
|
+
input: K.unknown(),
|
|
2150
|
+
providerExecuted: K.boolean().optional(),
|
|
2151
2151
|
providerMetadata: J.optional(),
|
|
2152
2152
|
toolMetadata: Hi.optional(),
|
|
2153
|
-
dynamic:
|
|
2154
|
-
errorText:
|
|
2155
|
-
title:
|
|
2153
|
+
dynamic: K.boolean().optional(),
|
|
2154
|
+
errorText: K.string(),
|
|
2155
|
+
title: K.string().optional()
|
|
2156
2156
|
}),
|
|
2157
|
-
|
|
2158
|
-
type:
|
|
2159
|
-
approvalId:
|
|
2160
|
-
toolCallId:
|
|
2161
|
-
approvalDescriptor:
|
|
2162
|
-
inputSchemaInput:
|
|
2163
|
-
reason:
|
|
2164
|
-
isAutomatic:
|
|
2165
|
-
signature:
|
|
2157
|
+
K.looseObject({
|
|
2158
|
+
type: K.literal("tool-approval-request"),
|
|
2159
|
+
approvalId: K.string(),
|
|
2160
|
+
toolCallId: K.string(),
|
|
2161
|
+
approvalDescriptor: K.unknown().optional(),
|
|
2162
|
+
inputSchemaInput: K.unknown().optional(),
|
|
2163
|
+
reason: K.string().optional(),
|
|
2164
|
+
isAutomatic: K.boolean().optional(),
|
|
2165
|
+
signature: K.string().optional()
|
|
2166
2166
|
}),
|
|
2167
|
-
|
|
2168
|
-
type:
|
|
2169
|
-
approvalId:
|
|
2170
|
-
approved:
|
|
2171
|
-
reason:
|
|
2172
|
-
providerExecuted:
|
|
2167
|
+
K.looseObject({
|
|
2168
|
+
type: K.literal("tool-approval-response"),
|
|
2169
|
+
approvalId: K.string(),
|
|
2170
|
+
approved: K.boolean(),
|
|
2171
|
+
reason: K.string().optional(),
|
|
2172
|
+
providerExecuted: K.boolean().optional(),
|
|
2173
2173
|
providerMetadata: J.optional()
|
|
2174
2174
|
}),
|
|
2175
|
-
|
|
2176
|
-
type:
|
|
2177
|
-
toolCallId:
|
|
2178
|
-
output:
|
|
2179
|
-
providerExecuted:
|
|
2175
|
+
K.looseObject({
|
|
2176
|
+
type: K.literal("tool-output-available"),
|
|
2177
|
+
toolCallId: K.string(),
|
|
2178
|
+
output: K.unknown(),
|
|
2179
|
+
providerExecuted: K.boolean().optional(),
|
|
2180
2180
|
providerMetadata: J.optional(),
|
|
2181
2181
|
toolMetadata: Hi.optional(),
|
|
2182
|
-
dynamic:
|
|
2183
|
-
preliminary:
|
|
2182
|
+
dynamic: K.boolean().optional(),
|
|
2183
|
+
preliminary: K.boolean().optional()
|
|
2184
2184
|
}),
|
|
2185
|
-
|
|
2186
|
-
type:
|
|
2187
|
-
toolCallId:
|
|
2188
|
-
errorText:
|
|
2189
|
-
providerExecuted:
|
|
2185
|
+
K.looseObject({
|
|
2186
|
+
type: K.literal("tool-output-error"),
|
|
2187
|
+
toolCallId: K.string(),
|
|
2188
|
+
errorText: K.string(),
|
|
2189
|
+
providerExecuted: K.boolean().optional(),
|
|
2190
2190
|
providerMetadata: J.optional(),
|
|
2191
2191
|
toolMetadata: Hi.optional(),
|
|
2192
|
-
dynamic:
|
|
2192
|
+
dynamic: K.boolean().optional()
|
|
2193
2193
|
}),
|
|
2194
|
-
|
|
2195
|
-
type:
|
|
2196
|
-
toolCallId:
|
|
2194
|
+
K.looseObject({
|
|
2195
|
+
type: K.literal("tool-output-denied"),
|
|
2196
|
+
toolCallId: K.string()
|
|
2197
2197
|
}),
|
|
2198
|
-
|
|
2199
|
-
type:
|
|
2200
|
-
id:
|
|
2198
|
+
K.looseObject({
|
|
2199
|
+
type: K.literal("reasoning-start"),
|
|
2200
|
+
id: K.string(),
|
|
2201
2201
|
providerMetadata: J.optional()
|
|
2202
2202
|
}),
|
|
2203
|
-
|
|
2204
|
-
type:
|
|
2205
|
-
id:
|
|
2206
|
-
delta:
|
|
2203
|
+
K.looseObject({
|
|
2204
|
+
type: K.literal("reasoning-delta"),
|
|
2205
|
+
id: K.string(),
|
|
2206
|
+
delta: K.string(),
|
|
2207
2207
|
providerMetadata: J.optional()
|
|
2208
2208
|
}),
|
|
2209
|
-
|
|
2210
|
-
type:
|
|
2211
|
-
id:
|
|
2209
|
+
K.looseObject({
|
|
2210
|
+
type: K.literal("reasoning-end"),
|
|
2211
|
+
id: K.string(),
|
|
2212
2212
|
providerMetadata: J.optional()
|
|
2213
2213
|
}),
|
|
2214
|
-
|
|
2215
|
-
type:
|
|
2216
|
-
kind:
|
|
2214
|
+
K.looseObject({
|
|
2215
|
+
type: K.literal("custom"),
|
|
2216
|
+
kind: K.string().transform((e) => e),
|
|
2217
2217
|
providerMetadata: J.optional()
|
|
2218
2218
|
}),
|
|
2219
|
-
|
|
2220
|
-
type:
|
|
2221
|
-
sourceId:
|
|
2222
|
-
url:
|
|
2223
|
-
title:
|
|
2219
|
+
K.looseObject({
|
|
2220
|
+
type: K.literal("source-url"),
|
|
2221
|
+
sourceId: K.string(),
|
|
2222
|
+
url: K.string(),
|
|
2223
|
+
title: K.string().optional(),
|
|
2224
2224
|
providerMetadata: J.optional()
|
|
2225
2225
|
}),
|
|
2226
|
-
|
|
2227
|
-
type:
|
|
2228
|
-
sourceId:
|
|
2229
|
-
mediaType:
|
|
2230
|
-
title:
|
|
2231
|
-
filename:
|
|
2226
|
+
K.looseObject({
|
|
2227
|
+
type: K.literal("source-document"),
|
|
2228
|
+
sourceId: K.string(),
|
|
2229
|
+
mediaType: K.string(),
|
|
2230
|
+
title: K.string(),
|
|
2231
|
+
filename: K.string().optional(),
|
|
2232
2232
|
providerMetadata: J.optional()
|
|
2233
2233
|
}),
|
|
2234
|
-
|
|
2235
|
-
type:
|
|
2236
|
-
url:
|
|
2237
|
-
mediaType:
|
|
2234
|
+
K.looseObject({
|
|
2235
|
+
type: K.literal("file"),
|
|
2236
|
+
url: K.string(),
|
|
2237
|
+
mediaType: K.string(),
|
|
2238
2238
|
providerMetadata: J.optional()
|
|
2239
2239
|
}),
|
|
2240
|
-
|
|
2241
|
-
type:
|
|
2242
|
-
url:
|
|
2243
|
-
mediaType:
|
|
2240
|
+
K.looseObject({
|
|
2241
|
+
type: K.literal("reasoning-file"),
|
|
2242
|
+
url: K.string(),
|
|
2243
|
+
mediaType: K.string(),
|
|
2244
2244
|
providerMetadata: J.optional()
|
|
2245
2245
|
}),
|
|
2246
|
-
|
|
2247
|
-
type:
|
|
2248
|
-
id:
|
|
2249
|
-
data:
|
|
2250
|
-
transient:
|
|
2246
|
+
K.looseObject({
|
|
2247
|
+
type: K.custom((e) => typeof e == "string" && e.startsWith("data-"), { message: "Type must start with \"data-\"" }),
|
|
2248
|
+
id: K.string().optional(),
|
|
2249
|
+
data: K.unknown(),
|
|
2250
|
+
transient: K.boolean().optional()
|
|
2251
2251
|
}),
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
type:
|
|
2257
|
-
messageId:
|
|
2258
|
-
messageMetadata:
|
|
2252
|
+
K.looseObject({ type: K.literal("start-step") }),
|
|
2253
|
+
K.looseObject({ type: K.literal("finish-step") }),
|
|
2254
|
+
K.looseObject({ type: K.literal("reset-step") }),
|
|
2255
|
+
K.looseObject({
|
|
2256
|
+
type: K.literal("start"),
|
|
2257
|
+
messageId: K.string().optional(),
|
|
2258
|
+
messageMetadata: K.unknown().optional()
|
|
2259
2259
|
}),
|
|
2260
|
-
|
|
2261
|
-
type:
|
|
2262
|
-
finishReason:
|
|
2260
|
+
K.looseObject({
|
|
2261
|
+
type: K.literal("finish"),
|
|
2262
|
+
finishReason: K.enum([
|
|
2263
2263
|
"stop",
|
|
2264
2264
|
"length",
|
|
2265
2265
|
"content-filter",
|
|
@@ -2267,15 +2267,15 @@ var Vi = q.object({
|
|
|
2267
2267
|
"error",
|
|
2268
2268
|
"other"
|
|
2269
2269
|
]).optional(),
|
|
2270
|
-
messageMetadata:
|
|
2270
|
+
messageMetadata: K.unknown().optional()
|
|
2271
2271
|
}),
|
|
2272
|
-
|
|
2273
|
-
type:
|
|
2274
|
-
reason:
|
|
2272
|
+
K.looseObject({
|
|
2273
|
+
type: K.literal("abort"),
|
|
2274
|
+
reason: K.string().optional()
|
|
2275
2275
|
}),
|
|
2276
|
-
|
|
2277
|
-
type:
|
|
2278
|
-
messageMetadata:
|
|
2276
|
+
K.looseObject({
|
|
2277
|
+
type: K.literal("message-metadata"),
|
|
2278
|
+
messageMetadata: K.unknown()
|
|
2279
2279
|
})
|
|
2280
2280
|
])));
|
|
2281
2281
|
function Wi(e) {
|
|
@@ -2347,7 +2347,7 @@ function Xi({ 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 G({
|
|
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 Xi({ 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 G({
|
|
2360
2360
|
chunkType: "tool-approval-response",
|
|
2361
2361
|
chunkId: e,
|
|
2362
2362
|
message: `No tool invocation found for approval ID "${e}".`
|
|
@@ -2421,8 +2421,8 @@ function Xi({ 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 :
|
|
2425
|
-
t != null && await
|
|
2424
|
+
let n = r.message.metadata == null ? e : fi(r.message.metadata, e);
|
|
2425
|
+
t != null && await ei({
|
|
2426
2426
|
value: n,
|
|
2427
2427
|
schema: t,
|
|
2428
2428
|
context: {
|
|
@@ -2445,7 +2445,7 @@ function Xi({ 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 G({
|
|
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 Xi({ 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 G({
|
|
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 Xi({ 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 G({
|
|
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 Xi({ 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 G({
|
|
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.`
|
|
@@ -2566,7 +2566,7 @@ function Xi({ 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 G({
|
|
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.`
|
|
@@ -2747,7 +2747,7 @@ function Xi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2747
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
|
-
await
|
|
2750
|
+
await ei({
|
|
2751
2751
|
value: e.data,
|
|
2752
2752
|
schema: n[e.type],
|
|
2753
2753
|
context: {
|
|
@@ -2796,28 +2796,28 @@ function Qi() {
|
|
|
2796
2796
|
reject: t
|
|
2797
2797
|
};
|
|
2798
2798
|
}
|
|
2799
|
-
|
|
2799
|
+
R({
|
|
2800
2800
|
prefix: "aitxt",
|
|
2801
2801
|
size: 24
|
|
2802
|
-
}),
|
|
2802
|
+
}), R({
|
|
2803
2803
|
prefix: "call",
|
|
2804
2804
|
size: 24
|
|
2805
|
-
}),
|
|
2805
|
+
}), R({
|
|
2806
2806
|
prefix: "aitxt",
|
|
2807
2807
|
size: 24
|
|
2808
|
-
}),
|
|
2808
|
+
}), R({
|
|
2809
2809
|
prefix: "call",
|
|
2810
2810
|
size: 24
|
|
2811
|
-
}),
|
|
2811
|
+
}), K.record(K.string(), q.optional()), K.record(K.string(), K.string()), R({
|
|
2812
2812
|
prefix: "call",
|
|
2813
2813
|
size: 24
|
|
2814
|
-
}),
|
|
2814
|
+
}), R({
|
|
2815
2815
|
prefix: "call",
|
|
2816
2816
|
size: 24
|
|
2817
|
-
}), new TextEncoder(),
|
|
2817
|
+
}), new TextEncoder(), R({
|
|
2818
2818
|
prefix: "call",
|
|
2819
2819
|
size: 24
|
|
2820
|
-
}),
|
|
2820
|
+
}), R({
|
|
2821
2821
|
prefix: "aiobj",
|
|
2822
2822
|
size: 24
|
|
2823
2823
|
});
|
|
@@ -2853,15 +2853,15 @@ var { atob: $i } = globalThis, ea = class {
|
|
|
2853
2853
|
});
|
|
2854
2854
|
}
|
|
2855
2855
|
};
|
|
2856
|
-
|
|
2856
|
+
R({
|
|
2857
2857
|
prefix: "aiobj",
|
|
2858
2858
|
size: 24
|
|
2859
|
-
}),
|
|
2859
|
+
}), R({
|
|
2860
2860
|
prefix: "call",
|
|
2861
2861
|
size: 24
|
|
2862
|
-
}),
|
|
2863
|
-
token:
|
|
2864
|
-
url:
|
|
2862
|
+
}), K.object({
|
|
2863
|
+
token: K.string().refine((e) => e.trim().length > 0),
|
|
2864
|
+
url: K.string().refine((e) => {
|
|
2865
2865
|
try {
|
|
2866
2866
|
let t = new URL(e);
|
|
2867
2867
|
return (t.protocol === "ws:" || t.protocol === "wss:") && t.hostname !== "";
|
|
@@ -2869,26 +2869,26 @@ B({
|
|
|
2869
2869
|
return !1;
|
|
2870
2870
|
}
|
|
2871
2871
|
}),
|
|
2872
|
-
expiresAt:
|
|
2873
|
-
tools:
|
|
2874
|
-
type:
|
|
2875
|
-
name:
|
|
2876
|
-
description:
|
|
2877
|
-
parameters:
|
|
2872
|
+
expiresAt: K.number().positive().max(2 ** 53 - 1).optional(),
|
|
2873
|
+
tools: K.array(K.object({
|
|
2874
|
+
type: K.literal("function"),
|
|
2875
|
+
name: K.string().min(1),
|
|
2876
|
+
description: K.string().optional(),
|
|
2877
|
+
parameters: K.record(K.string(), K.unknown())
|
|
2878
2878
|
})).optional()
|
|
2879
|
-
}),
|
|
2879
|
+
}), R({
|
|
2880
2880
|
prefix: "call",
|
|
2881
2881
|
size: 24
|
|
2882
|
-
}),
|
|
2882
|
+
}), R({
|
|
2883
2883
|
prefix: "call",
|
|
2884
2884
|
size: 24
|
|
2885
|
-
}),
|
|
2885
|
+
}), R({
|
|
2886
2886
|
prefix: "call",
|
|
2887
2887
|
size: 24
|
|
2888
2888
|
});
|
|
2889
2889
|
async function ta({ response: e, url: t, fallbackMessage: n }) {
|
|
2890
2890
|
let r = await e.text();
|
|
2891
|
-
return new
|
|
2891
|
+
return new sn({
|
|
2892
2892
|
message: r || n,
|
|
2893
2893
|
url: t,
|
|
2894
2894
|
requestBodyValues: void 0,
|
|
@@ -2898,7 +2898,7 @@ async function ta({ response: e, url: t, fallbackMessage: n }) {
|
|
|
2898
2898
|
}
|
|
2899
2899
|
async function na(e) {
|
|
2900
2900
|
if (e == null) return [];
|
|
2901
|
-
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new
|
|
2901
|
+
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new On({
|
|
2902
2902
|
functionality: "FileList",
|
|
2903
2903
|
message: "FileList is not supported in the current environment"
|
|
2904
2904
|
});
|
|
@@ -2926,9 +2926,9 @@ var ia = class {
|
|
|
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
|
}
|
|
2928
2928
|
async sendMessages({ abortSignal: e, ...t }) {
|
|
2929
|
-
let n = await
|
|
2930
|
-
...
|
|
2931
|
-
...
|
|
2929
|
+
let n = await ii(this.body), r = await ii(this.headers), i = await ii(this.credentials), a = {
|
|
2930
|
+
...zn(r),
|
|
2931
|
+
...zn(t.headers)
|
|
2932
2932
|
}, o = await this.prepareSendMessagesRequest?.({
|
|
2933
2933
|
api: this.api,
|
|
2934
2934
|
id: t.chatId,
|
|
@@ -2942,7 +2942,7 @@ var ia = class {
|
|
|
2942
2942
|
requestMetadata: t.metadata,
|
|
2943
2943
|
trigger: t.trigger,
|
|
2944
2944
|
messageId: t.messageId
|
|
2945
|
-
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a :
|
|
2945
|
+
}), s = o?.api ?? this.api, c = o?.headers === void 0 ? a : zn(o.headers), l = o?.body === void 0 ? {
|
|
2946
2946
|
...n,
|
|
2947
2947
|
...t.body,
|
|
2948
2948
|
id: t.chatId,
|
|
@@ -2964,13 +2964,13 @@ var ia = class {
|
|
|
2964
2964
|
url: s,
|
|
2965
2965
|
fallbackMessage: "Failed to fetch the chat response."
|
|
2966
2966
|
});
|
|
2967
|
-
if (!d.body) throw new
|
|
2967
|
+
if (!d.body) throw new dn({ message: "The response body is empty." });
|
|
2968
2968
|
return this.processResponseStream(d.body);
|
|
2969
2969
|
}
|
|
2970
2970
|
async reconnectToStream(e) {
|
|
2971
|
-
let t = await
|
|
2972
|
-
...
|
|
2973
|
-
...
|
|
2971
|
+
let t = await ii(this.body), n = await ii(this.headers), r = await ii(this.credentials), i = {
|
|
2972
|
+
...zn(n),
|
|
2973
|
+
...zn(e.headers)
|
|
2974
2974
|
}, a = await this.prepareReconnectToStreamRequest?.({
|
|
2975
2975
|
api: this.api,
|
|
2976
2976
|
id: e.chatId,
|
|
@@ -2983,14 +2983,14 @@ var ia = class {
|
|
|
2983
2983
|
requestMetadata: e.metadata
|
|
2984
2984
|
}), o = a?.api;
|
|
2985
2985
|
if (o == null) {
|
|
2986
|
-
if (e.chatId === "." || e.chatId === "..") throw new
|
|
2986
|
+
if (e.chatId === "." || e.chatId === "..") throw new ci({
|
|
2987
2987
|
parameter: "chatId",
|
|
2988
2988
|
value: e.chatId,
|
|
2989
2989
|
message: "Chat IDs must not be \".\" or \"..\" when using the default reconnect URL."
|
|
2990
2990
|
});
|
|
2991
2991
|
o = ra(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
|
|
2992
2992
|
}
|
|
2993
|
-
let s = a?.headers === void 0 ? i :
|
|
2993
|
+
let s = a?.headers === void 0 ? i : zn(a.headers), c = a?.credentials ?? r, l = await (this.fetch ?? globalThis.fetch)(o, {
|
|
2994
2994
|
method: "GET",
|
|
2995
2995
|
headers: s,
|
|
2996
2996
|
credentials: c,
|
|
@@ -3002,7 +3002,7 @@ var ia = class {
|
|
|
3002
3002
|
url: o,
|
|
3003
3003
|
fallbackMessage: "Failed to fetch the chat response."
|
|
3004
3004
|
});
|
|
3005
|
-
if (!l.body) throw new
|
|
3005
|
+
if (!l.body) throw new dn({ message: "The response body is empty." });
|
|
3006
3006
|
return this.processResponseStream(l.body);
|
|
3007
3007
|
}
|
|
3008
3008
|
}, aa = class extends ia {
|
|
@@ -3010,7 +3010,7 @@ var ia = class {
|
|
|
3010
3010
|
super(t), this.resumeStreamIsReplay = e;
|
|
3011
3011
|
}
|
|
3012
3012
|
processResponseStream(e) {
|
|
3013
|
-
return
|
|
3013
|
+
return ri({
|
|
3014
3014
|
stream: e,
|
|
3015
3015
|
schema: Ui
|
|
3016
3016
|
}).pipeThrough(new TransformStream({ async transform(e, t) {
|
|
@@ -3022,7 +3022,7 @@ var ia = class {
|
|
|
3022
3022
|
get id() {
|
|
3023
3023
|
return this._id ??= this.generateId();
|
|
3024
3024
|
}
|
|
3025
|
-
constructor({ generateId: e =
|
|
3025
|
+
constructor({ generateId: e = Bn, id: t, transport: n = new aa(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
|
|
3026
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;
|
|
@@ -3062,12 +3062,12 @@ var ia = class {
|
|
|
3062
3062
|
} else n = e;
|
|
3063
3063
|
if (e.messageId != null) {
|
|
3064
3064
|
let t = this.state.messages.findIndex((t) => t.id === e.messageId);
|
|
3065
|
-
if (t === -1) throw new
|
|
3065
|
+
if (t === -1) throw new ci({
|
|
3066
3066
|
parameter: "message.messageId",
|
|
3067
3067
|
value: e.messageId,
|
|
3068
3068
|
message: `message with id ${e.messageId} not found`
|
|
3069
3069
|
});
|
|
3070
|
-
if (this.state.messages[t].role !== "user") throw new
|
|
3070
|
+
if (this.state.messages[t].role !== "user") throw new ci({
|
|
3071
3071
|
parameter: "message.messageId",
|
|
3072
3072
|
value: e.messageId,
|
|
3073
3073
|
message: `message with id ${e.messageId} is not a user message`
|
|
@@ -3091,7 +3091,7 @@ var ia = class {
|
|
|
3091
3091
|
});
|
|
3092
3092
|
}, this.regenerate = async ({ messageId: e, ...t } = {}) => {
|
|
3093
3093
|
let n = e == null ? this.state.messages.length - 1 : this.state.messages.findIndex((t) => t.id === e);
|
|
3094
|
-
if (n === -1) throw new
|
|
3094
|
+
if (n === -1) throw new ci({
|
|
3095
3095
|
parameter: "messageId",
|
|
3096
3096
|
value: e,
|
|
3097
3097
|
message: `message ${e} not found`
|
|
@@ -3396,7 +3396,7 @@ var la = /* @__PURE__ */ t(((e, t) => {
|
|
|
3396
3396
|
};
|
|
3397
3397
|
}
|
|
3398
3398
|
t.exports = n;
|
|
3399
|
-
})), X = /* @__PURE__ */ e(o(), 1), ua = /* @__PURE__ */ e(la(), 1), Z =
|
|
3399
|
+
})), X = /* @__PURE__ */ e(o(), 1), ua = /* @__PURE__ */ e(la(), 1), Z = Ke();
|
|
3400
3400
|
function da(e, t) {
|
|
3401
3401
|
return t == null ? e : (0, ua.default)(e, t);
|
|
3402
3402
|
}
|
|
@@ -3622,7 +3622,7 @@ function Ea(e) {
|
|
|
3622
3622
|
//#endregion
|
|
3623
3623
|
//#region src/components/chat/agent-activity.tsx
|
|
3624
3624
|
var Da = (e) => {
|
|
3625
|
-
let t = (0,
|
|
3625
|
+
let t = (0, F.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
3627
|
className: ka,
|
|
3628
3628
|
children: d ? "Thinking…" : "Working…"
|
|
@@ -3647,7 +3647,7 @@ var Da = (e) => {
|
|
|
3647
3647
|
onClick: () => v(!y),
|
|
3648
3648
|
"aria-expanded": y,
|
|
3649
3649
|
className: "group/activity -mx-1.5 flex items-center gap-1.5 rounded-md px-1.5 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-foreground/6 hover:text-foreground focus-visible:outline-1 focus-visible:outline-(--slate-8)",
|
|
3650
|
-
children: [C, /* @__PURE__ */ (0, Z.jsx)(
|
|
3650
|
+
children: [C, /* @__PURE__ */ (0, Z.jsx)(me, {
|
|
3651
3651
|
"aria-hidden": !0,
|
|
3652
3652
|
className: r("size-3 shrink-0 opacity-60 transition-transform group-hover/activity:opacity-100", y && "rotate-90")
|
|
3653
3653
|
})]
|
|
@@ -3671,7 +3671,7 @@ function Aa({ interrupted: e, timing: t, toolCount: n }) {
|
|
|
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
3673
|
function ja(e) {
|
|
3674
|
-
let t = (0,
|
|
3674
|
+
let t = (0, F.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);
|
|
@@ -3686,7 +3686,7 @@ function Ma() {
|
|
|
3686
3686
|
//#endregion
|
|
3687
3687
|
//#region src/components/chat/chat-components.tsx
|
|
3688
3688
|
var Na = (e) => {
|
|
3689
|
-
let t = (0,
|
|
3689
|
+
let t = (0, F.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", {
|
|
@@ -3696,14 +3696,14 @@ var Na = (e) => {
|
|
|
3696
3696
|
}), t[0] = n.url, t[1] = e, t[2] = r) : r = t[2], r;
|
|
3697
3697
|
}
|
|
3698
3698
|
let r;
|
|
3699
|
-
t[3] === Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ (0, Z.jsx)(
|
|
3699
|
+
t[3] === Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ (0, Z.jsx)(Le, { className: "h-3 w-3 mt-0.5" }), t[3] = r) : r = t[3];
|
|
3700
3700
|
let i = n.filename || "Attachment", a;
|
|
3701
3701
|
return t[4] === i ? a = t[5] : (a = /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
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
3705
|
}, Pa = (e) => {
|
|
3706
|
-
let t = (0,
|
|
3706
|
+
let t = (0, F.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
|
|
@@ -3724,7 +3724,7 @@ var Na = (e) => {
|
|
|
3724
3724
|
s
|
|
3725
3725
|
] }), t[4] = n, t[5] = o, t[6] = s, t[7] = c) : c = t[7];
|
|
3726
3726
|
let l = c;
|
|
3727
|
-
if (a &&
|
|
3727
|
+
if (a && Se(a)) {
|
|
3728
3728
|
let e = i ?? r, n;
|
|
3729
3729
|
return t[8] !== l || t[9] !== a || t[10] !== e ? (n = /* @__PURE__ */ (0, Z.jsx)("a", {
|
|
3730
3730
|
href: a,
|
|
@@ -3745,8 +3745,8 @@ var Na = (e) => {
|
|
|
3745
3745
|
//#endregion
|
|
3746
3746
|
//#region src/components/chat/chat-markdown.tsx
|
|
3747
3747
|
function Fa(e) {
|
|
3748
|
-
let t = (0,
|
|
3749
|
-
return t[0] !== n || t[1] !== i ? (a = /* @__PURE__ */ (0, Z.jsx)(
|
|
3748
|
+
let t = (0, F.c)(3), { content: n } = e, r = qe(st)?.mode, i = r !== "agent" && r !== "code_mode", a;
|
|
3749
|
+
return t[0] !== n || t[1] !== i ? (a = /* @__PURE__ */ (0, Z.jsx)(ae, {
|
|
3750
3750
|
content: n,
|
|
3751
3751
|
allowNotebookInsertion: i
|
|
3752
3752
|
}), t[0] = n, t[1] = i, t[2] = a) : a = t[2], a;
|
|
@@ -3764,7 +3764,7 @@ function La(e) {
|
|
|
3764
3764
|
//#endregion
|
|
3765
3765
|
//#region src/components/chat/tool-call/tool-args.tsx
|
|
3766
3766
|
var Ra = (e) => {
|
|
3767
|
-
let t = (0,
|
|
3767
|
+
let t = (0, F.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", {
|
|
@@ -3784,12 +3784,12 @@ var Ra = (e) => {
|
|
|
3784
3784
|
children: [a, s]
|
|
3785
3785
|
}), t[6] = a, t[7] = s, t[8] = c) : c = t[8], c;
|
|
3786
3786
|
}, za = (e) => {
|
|
3787
|
-
let t = (0,
|
|
3787
|
+
let t = (0, F.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
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
|
-
t[4] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ (0, Z.jsx)(
|
|
3792
|
+
t[4] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ (0, Z.jsx)(en, { className: "h-4 w-4 text-(--amber-11) mt-0.5 shrink-0" }), t[4] = f) : f = t[4];
|
|
3793
3793
|
let p;
|
|
3794
3794
|
t[5] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
3795
3795
|
className: "font-semibold",
|
|
@@ -3853,47 +3853,47 @@ var Ra = (e) => {
|
|
|
3853
3853
|
get_marimo_rules: {
|
|
3854
3854
|
running: "Reading marimo guidelines",
|
|
3855
3855
|
done: "Read marimo guidelines",
|
|
3856
|
-
icon:
|
|
3856
|
+
icon: Vt
|
|
3857
3857
|
},
|
|
3858
3858
|
get_active_notebooks: {
|
|
3859
3859
|
running: "Listing notebooks",
|
|
3860
3860
|
done: "Listed notebooks",
|
|
3861
|
-
icon:
|
|
3861
|
+
icon: Jt
|
|
3862
3862
|
},
|
|
3863
3863
|
get_lightweight_cell_map: {
|
|
3864
3864
|
running: "Reading notebook",
|
|
3865
3865
|
done: "Read notebook",
|
|
3866
|
-
icon:
|
|
3866
|
+
icon: Kt
|
|
3867
3867
|
},
|
|
3868
3868
|
get_cell_runtime_data: {
|
|
3869
3869
|
running: "Inspecting cells",
|
|
3870
3870
|
done: "Inspected cells",
|
|
3871
|
-
icon:
|
|
3871
|
+
icon: Zt
|
|
3872
3872
|
},
|
|
3873
3873
|
get_cell_outputs: {
|
|
3874
3874
|
running: "Reading cell outputs",
|
|
3875
3875
|
done: "Read cell outputs",
|
|
3876
|
-
icon:
|
|
3876
|
+
icon: Zt
|
|
3877
3877
|
},
|
|
3878
3878
|
get_tables_and_variables: {
|
|
3879
3879
|
running: "Reading variables",
|
|
3880
3880
|
done: "Read variables",
|
|
3881
|
-
icon:
|
|
3881
|
+
icon: p
|
|
3882
3882
|
},
|
|
3883
3883
|
get_database_tables: {
|
|
3884
3884
|
running: "Reading database tables",
|
|
3885
3885
|
done: "Read database tables",
|
|
3886
|
-
icon:
|
|
3886
|
+
icon: f
|
|
3887
3887
|
},
|
|
3888
3888
|
get_notebook_errors: {
|
|
3889
3889
|
running: "Checking for errors",
|
|
3890
3890
|
done: "Checked for errors",
|
|
3891
|
-
icon:
|
|
3891
|
+
icon: Wt
|
|
3892
3892
|
},
|
|
3893
3893
|
lint_notebook: {
|
|
3894
3894
|
running: "Linting notebook",
|
|
3895
3895
|
done: "Linted notebook",
|
|
3896
|
-
icon:
|
|
3896
|
+
icon: qt
|
|
3897
3897
|
},
|
|
3898
3898
|
get_cell_dependency_graph: {
|
|
3899
3899
|
running: "Reading dependency graph",
|
|
@@ -3904,12 +3904,12 @@ var Ra = (e) => {
|
|
|
3904
3904
|
add_cell: {
|
|
3905
3905
|
running: "Adding cell",
|
|
3906
3906
|
done: "Added cell",
|
|
3907
|
-
icon:
|
|
3907
|
+
icon: xe
|
|
3908
3908
|
},
|
|
3909
3909
|
update_cell: {
|
|
3910
3910
|
running: "Editing cell",
|
|
3911
3911
|
done: "Edited cell",
|
|
3912
|
-
icon:
|
|
3912
|
+
icon: He
|
|
3913
3913
|
},
|
|
3914
3914
|
delete_cell: {
|
|
3915
3915
|
running: "Deleting cell",
|
|
@@ -3922,7 +3922,7 @@ function Ha(e, t, n) {
|
|
|
3922
3922
|
if (r === "execute_code") return {
|
|
3923
3923
|
label: n === "running" ? "Running code" : "Ran code",
|
|
3924
3924
|
detail: Ga(t) ? Wa(t.code) : void 0,
|
|
3925
|
-
icon:
|
|
3925
|
+
icon: d
|
|
3926
3926
|
};
|
|
3927
3927
|
if (r === "edit_notebook_tool") {
|
|
3928
3928
|
let e = Ua(t);
|
|
@@ -3936,7 +3936,7 @@ function Ha(e, t, n) {
|
|
|
3936
3936
|
}
|
|
3937
3937
|
return {
|
|
3938
3938
|
label: n === "running" ? "Editing notebook" : "Edited notebook",
|
|
3939
|
-
icon:
|
|
3939
|
+
icon: He
|
|
3940
3940
|
};
|
|
3941
3941
|
}
|
|
3942
3942
|
if (Object.hasOwn(Ba, r)) {
|
|
@@ -3949,7 +3949,7 @@ function Ha(e, t, n) {
|
|
|
3949
3949
|
return {
|
|
3950
3950
|
label: n === "running" ? "Calling" : "Called",
|
|
3951
3951
|
detail: r,
|
|
3952
|
-
icon:
|
|
3952
|
+
icon: m
|
|
3953
3953
|
};
|
|
3954
3954
|
}
|
|
3955
3955
|
function Ua(e) {
|
|
@@ -3971,17 +3971,17 @@ function Ga(e) {
|
|
|
3971
3971
|
//#endregion
|
|
3972
3972
|
//#region src/components/chat/tool-call/tool-result.tsx
|
|
3973
3973
|
function Ka(e) {
|
|
3974
|
-
return e == null || typeof e == "object" &&
|
|
3975
|
-
}
|
|
3976
|
-
var qa =
|
|
3977
|
-
status:
|
|
3978
|
-
auth_required:
|
|
3979
|
-
action_url:
|
|
3980
|
-
next_steps:
|
|
3981
|
-
meta:
|
|
3982
|
-
message:
|
|
3974
|
+
return e == null || typeof e == "object" && vt(e);
|
|
3975
|
+
}
|
|
3976
|
+
var qa = dt({
|
|
3977
|
+
status: gt().default("success"),
|
|
3978
|
+
auth_required: et().default(!1),
|
|
3979
|
+
action_url: mt().optional(),
|
|
3980
|
+
next_steps: mt().optional(),
|
|
3981
|
+
meta: mt().optional(),
|
|
3982
|
+
message: gt().nullish()
|
|
3983
3983
|
}), Ja = (e) => {
|
|
3984
|
-
let t = (0,
|
|
3984
|
+
let t = (0, F.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", {
|
|
@@ -4027,7 +4027,7 @@ var qa = lt({
|
|
|
4027
4027
|
} else r = t[1];
|
|
4028
4028
|
return r;
|
|
4029
4029
|
}, Ya = (e) => {
|
|
4030
|
-
let t = (0,
|
|
4030
|
+
let t = (0, F.c)(8), { result: n } = e, r;
|
|
4031
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) {
|
|
@@ -4058,7 +4058,7 @@ function Xa(e) {
|
|
|
4058
4058
|
//#endregion
|
|
4059
4059
|
//#region src/components/chat/tool-call/tool-step.tsx
|
|
4060
4060
|
var Za = (e) => {
|
|
4061
|
-
let t = (0,
|
|
4061
|
+
let t = (0, F.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
4063
|
let e = Ia.has(i), { label: o, detail: s, icon: c } = Ha(n, a, e ? "running" : "done");
|
|
4064
4064
|
g = o, h = s, _ = Qa(i, e && !d, c);
|
|
@@ -4087,15 +4087,15 @@ var Za = (e) => {
|
|
|
4087
4087
|
className: "shrink-0 opacity-80",
|
|
4088
4088
|
children: ["· ", _.suffix]
|
|
4089
4089
|
}), t[31] = _.suffix, t[32] = O);
|
|
4090
|
-
let
|
|
4091
|
-
t[33] ===
|
|
4092
|
-
let
|
|
4093
|
-
t[35] ===
|
|
4090
|
+
let ee = f && "rotate-90 opacity-100", k;
|
|
4091
|
+
t[33] === ee ? k = t[34] : (k = r("size-3 shrink-0 opacity-40 transition-transform group-hover/step:opacity-100", ee), t[33] = ee, t[34] = k);
|
|
4092
|
+
let A;
|
|
4093
|
+
t[35] === k ? A = t[36] : (A = /* @__PURE__ */ (0, Z.jsx)(me, {
|
|
4094
4094
|
"aria-hidden": !0,
|
|
4095
|
-
className:
|
|
4096
|
-
}), t[35] =
|
|
4097
|
-
let
|
|
4098
|
-
t[37] !== E || t[38] !== D || t[39] !== O || t[40] !==
|
|
4095
|
+
className: k
|
|
4096
|
+
}), t[35] = k, t[36] = A);
|
|
4097
|
+
let j;
|
|
4098
|
+
t[37] !== E || t[38] !== D || t[39] !== O || t[40] !== A || t[41] !== b || t[42] !== x || t[43] !== S || t[44] !== C || t[45] !== T ? (j = /* @__PURE__ */ (0, Z.jsxs)("button", {
|
|
4099
4099
|
type: b,
|
|
4100
4100
|
onClick: x,
|
|
4101
4101
|
"aria-expanded": S,
|
|
@@ -4105,46 +4105,46 @@ var Za = (e) => {
|
|
|
4105
4105
|
E,
|
|
4106
4106
|
D,
|
|
4107
4107
|
O,
|
|
4108
|
-
|
|
4108
|
+
A
|
|
4109
4109
|
]
|
|
4110
|
-
}), t[37] = E, t[38] = D, t[39] = O, t[40] =
|
|
4111
|
-
let
|
|
4112
|
-
t[47] !== c || t[48] !== s || t[49] !== a || t[50] !== f || t[51] !== o || t[52] !== i ? (
|
|
4110
|
+
}), t[37] = E, t[38] = D, t[39] = O, t[40] = A, t[41] = b, t[42] = x, t[43] = S, t[44] = C, t[45] = T, t[46] = j) : j = t[46];
|
|
4111
|
+
let te;
|
|
4112
|
+
t[47] !== c || t[48] !== s || t[49] !== a || t[50] !== f || t[51] !== o || t[52] !== i ? (te = 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
|
-
}), t[47] = c, t[48] = s, t[49] = a, t[50] = f, t[51] = o, t[52] = i, t[53] =
|
|
4119
|
-
let
|
|
4120
|
-
return t[54] !==
|
|
4118
|
+
}), t[47] = c, t[48] = s, t[49] = a, t[50] = f, t[51] = o, t[52] = i, t[53] = te) : te = t[53];
|
|
4119
|
+
let M;
|
|
4120
|
+
return t[54] !== j || t[55] !== te || t[56] !== w ? (M = /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
4121
4121
|
className: w,
|
|
4122
|
-
children: [
|
|
4123
|
-
}), t[54] =
|
|
4122
|
+
children: [j, te]
|
|
4123
|
+
}), t[54] = j, t[55] = te, t[56] = w, t[57] = M) : M = t[57], M;
|
|
4124
4124
|
};
|
|
4125
4125
|
function Qa(e, t, n) {
|
|
4126
4126
|
if (t) return {
|
|
4127
|
-
icon:
|
|
4127
|
+
icon: Gt,
|
|
4128
4128
|
suffix: "Stopped"
|
|
4129
4129
|
};
|
|
4130
4130
|
switch (e) {
|
|
4131
4131
|
case "output-error": return {
|
|
4132
|
-
icon:
|
|
4132
|
+
icon: g,
|
|
4133
4133
|
suffix: "Failed"
|
|
4134
4134
|
};
|
|
4135
4135
|
case "output-denied": return {
|
|
4136
|
-
icon:
|
|
4136
|
+
icon: Bt,
|
|
4137
4137
|
suffix: "Denied"
|
|
4138
4138
|
};
|
|
4139
4139
|
case "output-available": return { icon: n };
|
|
4140
4140
|
default: return {
|
|
4141
|
-
icon:
|
|
4141
|
+
icon: h,
|
|
4142
4142
|
spinning: !0
|
|
4143
4143
|
};
|
|
4144
4144
|
}
|
|
4145
4145
|
}
|
|
4146
4146
|
var $a = (e) => {
|
|
4147
|
-
let t = (0,
|
|
4147
|
+
let t = (0, F.c)(16), { state: n, input: r, result: i, errorText: a, approval: o } = e, s;
|
|
4148
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
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];
|
|
@@ -4175,7 +4175,7 @@ function eo(e) {
|
|
|
4175
4175
|
//#endregion
|
|
4176
4176
|
//#region src/components/chat/tool-call/tool-call-view.tsx
|
|
4177
4177
|
var to = (e) => {
|
|
4178
|
-
let t = (0,
|
|
4178
|
+
let t = (0, F.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
4181
|
return t[6] !== n || t[7] !== r || t[8] !== i || t[9] !== o ? (e = n != null && r != null ? /* @__PURE__ */ (0, Z.jsx)(za, {
|
|
@@ -4234,7 +4234,7 @@ var to = (e) => {
|
|
|
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",
|
|
4237
|
-
children: [/* @__PURE__ */ (0, Z.jsx)(
|
|
4237
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(Ut, {
|
|
4238
4238
|
"aria-hidden": !0,
|
|
4239
4239
|
className: "-ml-px mt-1 size-3 shrink-0"
|
|
4240
4240
|
}), /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
@@ -4252,12 +4252,12 @@ var to = (e) => {
|
|
|
4252
4252
|
url: e.url
|
|
4253
4253
|
} }, t);
|
|
4254
4254
|
case "source-document": return /* @__PURE__ */ (0, Z.jsx)(Pa, {
|
|
4255
|
-
icon: /* @__PURE__ */ (0, Z.jsx)(
|
|
4255
|
+
icon: /* @__PURE__ */ (0, Z.jsx)(S, { className: "h-3 w-3 shrink-0" }),
|
|
4256
4256
|
title: e.title,
|
|
4257
4257
|
subtitle: e.filename
|
|
4258
4258
|
}, t);
|
|
4259
4259
|
case "source-url": return /* @__PURE__ */ (0, Z.jsx)(Pa, {
|
|
4260
|
-
icon: /* @__PURE__ */ (0, Z.jsx)(
|
|
4260
|
+
icon: /* @__PURE__ */ (0, Z.jsx)(je, { className: "h-3 w-3 shrink-0" }),
|
|
4261
4261
|
title: e.title ?? e.url,
|
|
4262
4262
|
subtitle: e.title ? e.url : void 0,
|
|
4263
4263
|
href: e.url
|
|
@@ -4267,7 +4267,7 @@ var to = (e) => {
|
|
|
4267
4267
|
children: e.kind
|
|
4268
4268
|
}, t);
|
|
4269
4269
|
case "step-start": return null;
|
|
4270
|
-
default: return
|
|
4270
|
+
default: return Ue(e), null;
|
|
4271
4271
|
}
|
|
4272
4272
|
}
|
|
4273
4273
|
};
|
|
@@ -4343,12 +4343,12 @@ var ho = class extends j {
|
|
|
4343
4343
|
super(), this.store = e;
|
|
4344
4344
|
}
|
|
4345
4345
|
getItems() {
|
|
4346
|
-
let e = this.store.get(
|
|
4346
|
+
let e = this.store.get(ke);
|
|
4347
4347
|
return e.cellIds.map((t, n) => {
|
|
4348
4348
|
let r = e.cellData[t];
|
|
4349
4349
|
return {
|
|
4350
4350
|
uri: this.asURI(t),
|
|
4351
|
-
name:
|
|
4351
|
+
name: Fe(r.name, n),
|
|
4352
4352
|
type: this.contextType,
|
|
4353
4353
|
description: "Cell code",
|
|
4354
4354
|
data: {
|
|
@@ -4365,7 +4365,7 @@ var ho = class extends j {
|
|
|
4365
4365
|
};
|
|
4366
4366
|
}
|
|
4367
4367
|
formatContext(e) {
|
|
4368
|
-
return
|
|
4368
|
+
return ne({
|
|
4369
4369
|
type: "cell",
|
|
4370
4370
|
data: {
|
|
4371
4371
|
cellId: e.data.cellId,
|
|
@@ -4402,9 +4402,9 @@ var _o = class extends j {
|
|
|
4402
4402
|
super(), this.store = e;
|
|
4403
4403
|
}
|
|
4404
4404
|
getItems() {
|
|
4405
|
-
let e = this.store.get(
|
|
4405
|
+
let e = this.store.get(ke), t = [];
|
|
4406
4406
|
for (let n of e.cellIds) {
|
|
4407
|
-
let r = bo(n, e, this.store.get(
|
|
4407
|
+
let r = bo(n, e, this.store.get(Oe(n))), i = r.cellOutput;
|
|
4408
4408
|
if (!i) continue;
|
|
4409
4409
|
let a = i.output.mimetype || "unknown";
|
|
4410
4410
|
t.push({
|
|
@@ -4428,7 +4428,7 @@ var _o = class extends j {
|
|
|
4428
4428
|
detail: `${t.outputType} output`,
|
|
4429
4429
|
boost: t.outputType === "media" ? k.HIGH : k.MEDIUM,
|
|
4430
4430
|
type: this.contextType,
|
|
4431
|
-
section:
|
|
4431
|
+
section: N.CELL_OUTPUT,
|
|
4432
4432
|
apply: `@${n}`,
|
|
4433
4433
|
info: () => {
|
|
4434
4434
|
let e = document.createElement("div");
|
|
@@ -4465,7 +4465,7 @@ var _o = class extends j {
|
|
|
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}`)), ne({
|
|
4469
4469
|
type: this.contextType,
|
|
4470
4470
|
data: a,
|
|
4471
4471
|
details: o
|
|
@@ -4480,7 +4480,7 @@ 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) => {
|
|
4483
|
-
let i = document.getElementById(
|
|
4483
|
+
let i = document.getElementById(Me.create(t));
|
|
4484
4484
|
return i ? {
|
|
4485
4485
|
cellId: t,
|
|
4486
4486
|
cellName: r,
|
|
@@ -4493,15 +4493,15 @@ async function vo(e, t, r) {
|
|
|
4493
4493
|
type: "file",
|
|
4494
4494
|
filename: `${r}-output-screenshot`,
|
|
4495
4495
|
mediaType: "image/png",
|
|
4496
|
-
url: await
|
|
4496
|
+
url: await ce(e.element)
|
|
4497
4497
|
})));
|
|
4498
4498
|
} catch (e) {
|
|
4499
4499
|
return n.error("Error downloading cell output images:", e), [];
|
|
4500
4500
|
}
|
|
4501
4501
|
}
|
|
4502
4502
|
function yo(e) {
|
|
4503
|
-
if (
|
|
4504
|
-
let t = e.mimetype, n = go(t, String(e.data)) ? "media" : "text", r =
|
|
4503
|
+
if (D(e)) return null;
|
|
4504
|
+
let t = e.mimetype, n = go(t, String(e.data)) ? "media" : "text", r = Be(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,
|
|
@@ -4511,8 +4511,8 @@ function yo(e) {
|
|
|
4511
4511
|
};
|
|
4512
4512
|
}
|
|
4513
4513
|
function bo(e, t, n, r) {
|
|
4514
|
-
let i = t.cellData[e], a = t.cellIds.indexOf(e), o =
|
|
4515
|
-
return n !== null && !
|
|
4514
|
+
let i = t.cellData[e], a = t.cellIds.indexOf(e), o = Fe(i.name, a), s = r?.map(yo).filter((e) => e !== null), c;
|
|
4515
|
+
return n !== null && !D(n) && (c = yo(n) ?? void 0), {
|
|
4516
4516
|
cellId: e,
|
|
4517
4517
|
cellName: o,
|
|
4518
4518
|
cellCode: i.code,
|
|
@@ -4524,14 +4524,14 @@ function bo(e, t, n, r) {
|
|
|
4524
4524
|
//#region src/core/ai/context/providers/error.ts
|
|
4525
4525
|
function xo(e, t) {
|
|
4526
4526
|
let n = [`Code:\n${e.cellCode}`];
|
|
4527
|
-
if (e.tracebackHtml && n.push(`Traceback:\n${
|
|
4528
|
-
let r =
|
|
4527
|
+
if (e.tracebackHtml && n.push(`Traceback:\n${De(e.tracebackHtml)}`), e.errorData.length > 0 && n.push(e.errorData.map((e) => Ne(e)).join("\n\n")), e.errorData.some((e) => e.type === "sql-error")) {
|
|
4528
|
+
let r = le(e.cellId, t);
|
|
4529
4529
|
r && n.push(`Database schema:\n${r}`);
|
|
4530
4530
|
}
|
|
4531
4531
|
return n.join("\n\n");
|
|
4532
4532
|
}
|
|
4533
4533
|
function So(e, t) {
|
|
4534
|
-
return
|
|
4534
|
+
return ne({
|
|
4535
4535
|
type: "error",
|
|
4536
4536
|
data: {
|
|
4537
4537
|
name: e.cellName || `Cell ${e.cellId}`,
|
|
@@ -4541,12 +4541,12 @@ function So(e, t) {
|
|
|
4541
4541
|
});
|
|
4542
4542
|
}
|
|
4543
4543
|
function Co(e) {
|
|
4544
|
-
return e.errorData.length === 1 ?
|
|
4544
|
+
return e.errorData.length === 1 ? Pe(e.errorData[0]) : e.errorData.length > 1 ? `${e.errorData.length} errors` : e.tracebackHtml ? De(e.tracebackHtml).trim().split("\n").find((e) => e.trim())?.trim() || "traceback" : "error";
|
|
4545
4545
|
}
|
|
4546
4546
|
function wo(e) {
|
|
4547
4547
|
return `Error: ${e.cellName || `Cell ${e.cellId}`}`;
|
|
4548
4548
|
}
|
|
4549
|
-
var To = new
|
|
4549
|
+
var To = new ie("error", "errors"), Eo = class extends j {
|
|
4550
4550
|
title = "Errors";
|
|
4551
4551
|
mentionPrefix = "@";
|
|
4552
4552
|
contextType = "error";
|
|
@@ -4555,7 +4555,7 @@ var To = new T("error", "errors"), Eo = class extends j {
|
|
|
4555
4555
|
super(), this.store = e;
|
|
4556
4556
|
}
|
|
4557
4557
|
getItems() {
|
|
4558
|
-
let e =
|
|
4558
|
+
let e = Ae(this.store);
|
|
4559
4559
|
if (e.length === 0) return [];
|
|
4560
4560
|
let t = [{
|
|
4561
4561
|
uri: this.asURI("all"),
|
|
@@ -4588,7 +4588,7 @@ var To = new T("error", "errors"), Eo = class extends j {
|
|
|
4588
4588
|
detail: `${t} ${To.pluralize(t)}`,
|
|
4589
4589
|
type: "error",
|
|
4590
4590
|
apply: "@error://all",
|
|
4591
|
-
section:
|
|
4591
|
+
section: N.ERROR,
|
|
4592
4592
|
info: () => {
|
|
4593
4593
|
let e = document.createElement("div");
|
|
4594
4594
|
e.classList.add("mo-cm-tooltip", "docs-documentation", "min-w-[200px]", "flex", "flex-col", "gap-1", "p-2");
|
|
@@ -4608,19 +4608,19 @@ var To = new T("error", "errors"), Eo = class extends j {
|
|
|
4608
4608
|
detail: Co(t),
|
|
4609
4609
|
type: "error"
|
|
4610
4610
|
}),
|
|
4611
|
-
section:
|
|
4611
|
+
section: N.ERROR
|
|
4612
4612
|
};
|
|
4613
4613
|
}
|
|
4614
4614
|
return {
|
|
4615
4615
|
label: "Error",
|
|
4616
4616
|
displayLabel: "Error",
|
|
4617
|
-
section:
|
|
4617
|
+
section: N.ERROR
|
|
4618
4618
|
};
|
|
4619
4619
|
}
|
|
4620
4620
|
formatContext(e) {
|
|
4621
4621
|
return (e.data.type === "all-errors" ? e.data.errors : [e.data.error]).map((e) => So(e, this.store)).join("\n\n");
|
|
4622
4622
|
}
|
|
4623
|
-
}, Do =
|
|
4623
|
+
}, Do = O(), Oo = {
|
|
4624
4624
|
maxDepth: 3,
|
|
4625
4625
|
maxResults: 20,
|
|
4626
4626
|
defaultResultsLimit: 5,
|
|
@@ -4727,7 +4727,7 @@ var To = new T("error", "errors"), Eo = class extends j {
|
|
|
4727
4727
|
return {
|
|
4728
4728
|
...this.createBasicCompletion(e),
|
|
4729
4729
|
type: "file",
|
|
4730
|
-
section:
|
|
4730
|
+
section: N.FILE,
|
|
4731
4731
|
boost: t.isDirectory ? k.MEDIUM : k.LOW,
|
|
4732
4732
|
detail: t.path,
|
|
4733
4733
|
displayLabel: `${i} ${r}`,
|
|
@@ -4742,7 +4742,7 @@ var To = new T("error", "errors"), Eo = class extends j {
|
|
|
4742
4742
|
description: e.message
|
|
4743
4743
|
}), null));
|
|
4744
4744
|
if (!l) return;
|
|
4745
|
-
let u = l.mimeType || "text/plain", d =
|
|
4745
|
+
let u = l.mimeType || "text/plain", d = Ie({
|
|
4746
4746
|
contents: l.contents ?? "",
|
|
4747
4747
|
mimeType: u,
|
|
4748
4748
|
isBase64: l.isBase64 ?? !1
|
|
@@ -4751,7 +4751,7 @@ var To = new T("error", "errors"), Eo = class extends j {
|
|
|
4751
4751
|
from: a,
|
|
4752
4752
|
to: o,
|
|
4753
4753
|
insert: ""
|
|
4754
|
-
} }),
|
|
4754
|
+
} }), Pt(e);
|
|
4755
4755
|
},
|
|
4756
4756
|
info: () => {
|
|
4757
4757
|
let e = document.createElement("div");
|
|
@@ -4765,7 +4765,7 @@ var To = new T("error", "errors"), Eo = class extends j {
|
|
|
4765
4765
|
}
|
|
4766
4766
|
formatContext(e) {
|
|
4767
4767
|
let { data: t, name: n } = e;
|
|
4768
|
-
return
|
|
4768
|
+
return ne({
|
|
4769
4769
|
type: this.contextType,
|
|
4770
4770
|
data: {
|
|
4771
4771
|
name: n,
|
|
@@ -4805,7 +4805,7 @@ var To = new T("error", "errors"), Eo = class extends j {
|
|
|
4805
4805
|
l += `${t}\n`;
|
|
4806
4806
|
}
|
|
4807
4807
|
}
|
|
4808
|
-
return
|
|
4808
|
+
return ne({
|
|
4809
4809
|
type: this.contextType,
|
|
4810
4810
|
data: {
|
|
4811
4811
|
name: o,
|
|
@@ -4821,11 +4821,11 @@ var To = new T("error", "errors"), Eo = class extends j {
|
|
|
4821
4821
|
displayLabel: t,
|
|
4822
4822
|
detail: n.source === "memory" ? "in-memory" : n.source,
|
|
4823
4823
|
boost: n.source_type === "local" ? k.LOCAL_TABLE : k.REMOTE_TABLE,
|
|
4824
|
-
type:
|
|
4824
|
+
type: ee(n),
|
|
4825
4825
|
apply: `@${t}`,
|
|
4826
4826
|
section: {
|
|
4827
|
-
name:
|
|
4828
|
-
rank:
|
|
4827
|
+
name: ee(n) === "dataframe" ? "Dataframe" : "Table",
|
|
4828
|
+
rank: N.TABLE.rank
|
|
4829
4829
|
},
|
|
4830
4830
|
info: () => this.createTableInfoElement(t, n)
|
|
4831
4831
|
};
|
|
@@ -4910,13 +4910,13 @@ var To = new T("error", "errors"), Eo = class extends j {
|
|
|
4910
4910
|
displayLabel: n.name,
|
|
4911
4911
|
detail: n.dataType ?? "",
|
|
4912
4912
|
type: this.contextType,
|
|
4913
|
-
section:
|
|
4914
|
-
info: () =>
|
|
4913
|
+
section: N.VARIABLE,
|
|
4914
|
+
info: () => se(n)
|
|
4915
4915
|
};
|
|
4916
4916
|
}
|
|
4917
4917
|
formatContext(e) {
|
|
4918
4918
|
let { data: t } = e, { variable: n } = t;
|
|
4919
|
-
return
|
|
4919
|
+
return ne({
|
|
4920
4920
|
type: this.contextType,
|
|
4921
4921
|
data: {
|
|
4922
4922
|
name: n.name,
|
|
@@ -4929,11 +4929,11 @@ var To = new T("error", "errors"), Eo = class extends j {
|
|
|
4929
4929
|
//#endregion
|
|
4930
4930
|
//#region src/core/ai/context/context.ts
|
|
4931
4931
|
function Mo(e) {
|
|
4932
|
-
let t = e.get(
|
|
4933
|
-
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
|
|
4932
|
+
let t = e.get(u), n = e.get(x), r = e.get(C);
|
|
4933
|
+
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 M(t.connectionsMap, n));
|
|
4934
4934
|
}
|
|
4935
4935
|
function No() {
|
|
4936
|
-
return new ko(
|
|
4936
|
+
return new ko(Te());
|
|
4937
4937
|
}
|
|
4938
4938
|
//#endregion
|
|
4939
4939
|
//#region src/components/editor/ai/completion-utils.ts
|
|
@@ -4955,7 +4955,7 @@ async function Fo(e) {
|
|
|
4955
4955
|
type: "file",
|
|
4956
4956
|
mediaType: t.type,
|
|
4957
4957
|
filename: e.name,
|
|
4958
|
-
url: await
|
|
4958
|
+
url: await Re(t)
|
|
4959
4959
|
};
|
|
4960
4960
|
}));
|
|
4961
4961
|
}
|
|
@@ -4968,11 +4968,11 @@ function Io(e) {
|
|
|
4968
4968
|
//#endregion
|
|
4969
4969
|
//#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
|
|
4970
4970
|
function Lo(e) {
|
|
4971
|
-
return
|
|
4971
|
+
return Mt.define({ combine: (t) => t[0] ?? e });
|
|
4972
4972
|
}
|
|
4973
4973
|
//#endregion
|
|
4974
4974
|
//#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
|
|
4975
|
-
var Ro = Lo({}), zo =
|
|
4975
|
+
var Ro = Lo({}), zo = wt.define(), Bo = wt.define(), Vo = 50, Ho = Dt.define({
|
|
4976
4976
|
create() {
|
|
4977
4977
|
return {
|
|
4978
4978
|
prompts: [],
|
|
@@ -5031,7 +5031,7 @@ function Go(e = {}) {
|
|
|
5031
5031
|
navigationIndex: -1,
|
|
5032
5032
|
originalText: ""
|
|
5033
5033
|
})), Ro.of(t ?? {})];
|
|
5034
|
-
return n && r.push(
|
|
5034
|
+
return n && r.push(At.of([{
|
|
5035
5035
|
key: "ArrowUp",
|
|
5036
5036
|
run: Uo
|
|
5037
5037
|
}, {
|
|
@@ -5041,7 +5041,7 @@ function Go(e = {}) {
|
|
|
5041
5041
|
}
|
|
5042
5042
|
//#endregion
|
|
5043
5043
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_7a070d6d3cd24348faf68fbca252ab72/node_modules/@marimo-team/codemirror-mcp/dist/state.js
|
|
5044
|
-
var Ko =
|
|
5044
|
+
var Ko = wt.define(), Q = Dt.define({
|
|
5045
5045
|
create() {
|
|
5046
5046
|
return /* @__PURE__ */ new Map();
|
|
5047
5047
|
},
|
|
@@ -5053,7 +5053,7 @@ var Ko = St.define(), Q = Tt.define({
|
|
|
5053
5053
|
}
|
|
5054
5054
|
return r;
|
|
5055
5055
|
}
|
|
5056
|
-
}), qo =
|
|
5056
|
+
}), qo = Dt.define({
|
|
5057
5057
|
create() {
|
|
5058
5058
|
return {
|
|
5059
5059
|
onResourceClick: void 0,
|
|
@@ -5065,8 +5065,8 @@ var Ko = St.define(), Q = Tt.define({
|
|
|
5065
5065
|
update(e) {
|
|
5066
5066
|
return e;
|
|
5067
5067
|
}
|
|
5068
|
-
}), Jo =
|
|
5069
|
-
|
|
5068
|
+
}), Jo = wt.define();
|
|
5069
|
+
Dt.define({
|
|
5070
5070
|
create() {
|
|
5071
5071
|
return /* @__PURE__ */ new Map();
|
|
5072
5072
|
},
|
|
@@ -5114,7 +5114,7 @@ function $(e) {
|
|
|
5114
5114
|
}
|
|
5115
5115
|
//#endregion
|
|
5116
5116
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_7a070d6d3cd24348faf68fbca252ab72/node_modules/@marimo-team/codemirror-mcp/dist/resources/decoration.js
|
|
5117
|
-
var Zo = class extends
|
|
5117
|
+
var Zo = class extends Tt {
|
|
5118
5118
|
resource;
|
|
5119
5119
|
view;
|
|
5120
5120
|
constructor(e, t) {
|
|
@@ -5135,7 +5135,7 @@ var Zo = class extends Ct {
|
|
|
5135
5135
|
e.preventDefault(), e.stopPropagation(), i(this.resource);
|
|
5136
5136
|
}), e;
|
|
5137
5137
|
}
|
|
5138
|
-
}, Qo = class extends
|
|
5138
|
+
}, Qo = class extends Tt {
|
|
5139
5139
|
uri;
|
|
5140
5140
|
view;
|
|
5141
5141
|
constructor(e, t) {
|
|
@@ -5155,12 +5155,12 @@ function $o(e) {
|
|
|
5155
5155
|
let a = e.state.doc.sliceString(r, i);
|
|
5156
5156
|
for (let i of $(a)) {
|
|
5157
5157
|
let a = r + i.index, o = i[0].slice(1), s = t.get(o);
|
|
5158
|
-
s ? n.push(
|
|
5158
|
+
s ? n.push(St.replace({ widget: new Zo(s, e) }).range(a, a + i[0].length)) : n.push(St.replace({ widget: new Qo(o, e) }).range(a, a + i[0].length));
|
|
5159
5159
|
}
|
|
5160
5160
|
}
|
|
5161
|
-
return
|
|
5161
|
+
return St.set(n);
|
|
5162
5162
|
}
|
|
5163
|
-
var es =
|
|
5163
|
+
var es = Ot.fromClass(class {
|
|
5164
5164
|
decorations;
|
|
5165
5165
|
constructor(e) {
|
|
5166
5166
|
this.decorations = $o(e);
|
|
@@ -5200,7 +5200,7 @@ function ns(e, t, n, r = 0) {
|
|
|
5200
5200
|
return null;
|
|
5201
5201
|
}
|
|
5202
5202
|
function rs(e) {
|
|
5203
|
-
return
|
|
5203
|
+
return jt((t, n) => {
|
|
5204
5204
|
let { from: r, text: i } = t.state.doc.lineAt(n), a = ns(i, n, t.state.field(Q), r);
|
|
5205
5205
|
return a ? {
|
|
5206
5206
|
pos: a.start,
|
|
@@ -5270,8 +5270,8 @@ function cs(e, t) {
|
|
|
5270
5270
|
}
|
|
5271
5271
|
return null;
|
|
5272
5272
|
}
|
|
5273
|
-
var ls =
|
|
5274
|
-
let t = e.annotation(
|
|
5273
|
+
var ls = kt.transactionFilter.of((e) => {
|
|
5274
|
+
let t = e.annotation(xt.userEvent);
|
|
5275
5275
|
if (!t) return e;
|
|
5276
5276
|
let n = e.startState.selection.main;
|
|
5277
5277
|
if (!n.empty) return e;
|
|
@@ -5444,11 +5444,11 @@ function hs(e, t) {
|
|
|
5444
5444
|
};
|
|
5445
5445
|
}
|
|
5446
5446
|
function gs(e, t = {}) {
|
|
5447
|
-
return
|
|
5447
|
+
return Ot.fromClass(hs(e, t));
|
|
5448
5448
|
}
|
|
5449
5449
|
//#endregion
|
|
5450
5450
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_7a070d6d3cd24348faf68fbca252ab72/node_modules/@marimo-team/codemirror-mcp/dist/theme.js
|
|
5451
|
-
var _s =
|
|
5451
|
+
var _s = Et.baseTheme({
|
|
5452
5452
|
".cm-resource-widget": {
|
|
5453
5453
|
background: "light-dark(rgba(86,156,214,0.08),rgba(86,156,214,0.18))",
|
|
5454
5454
|
borderRadius: "4px",
|
|
@@ -5481,10 +5481,10 @@ function Ss(e) {
|
|
|
5481
5481
|
let { language: t, store: r, onAddFiles: i } = e, a = () => xs(r);
|
|
5482
5482
|
return [
|
|
5483
5483
|
t.data.of({ autocomplete: Yo(async () => a(), (e) => e.type === vs ? bs : Mo(r).getProvider(e.type)?.formatCompletion(e) || {}) }),
|
|
5484
|
-
|
|
5484
|
+
Ct.high(At.of([{
|
|
5485
5485
|
key: "Tab",
|
|
5486
5486
|
preventDefault: !0,
|
|
5487
|
-
run: (e) =>
|
|
5487
|
+
run: (e) => Nt(e)
|
|
5488
5488
|
}])),
|
|
5489
5489
|
Do.of({ addAttachment: (e) => i?.([e]) }),
|
|
5490
5490
|
...i ? [t.data.of({ autocomplete: No().createCompletionSource() })] : [],
|
|
@@ -5513,26 +5513,26 @@ function Cs(e) {
|
|
|
5513
5513
|
}
|
|
5514
5514
|
//#endregion
|
|
5515
5515
|
//#region src/components/editor/ai/prompt-input.tsx
|
|
5516
|
-
var ws = "marimo:ai-prompt-history", Ts = new
|
|
5517
|
-
let t = (0,
|
|
5518
|
-
t[0] === p ?
|
|
5519
|
-
let
|
|
5520
|
-
if (t[2] !==
|
|
5521
|
-
let e =
|
|
5522
|
-
t[9] === Symbol.for("react.memo_cache_sentinel") ? (n =
|
|
5516
|
+
var ws = "marimo:ai-prompt-history", Ts = new Ee(Xe(gt()), () => []), Es = (e) => {
|
|
5517
|
+
let t = (0, F.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 = bt(l), g = bt(d), _ = Ye(), { theme: v } = it(), y;
|
|
5518
|
+
t[0] === p ? y = t[1] : (y = (e) => p ? Po([p.triggerCompletionRegex], p.completions)(e) : null, t[0] = p, t[1] = y);
|
|
5519
|
+
let b = bt(y), x;
|
|
5520
|
+
if (t[2] !== b || t[3] !== g || t[4] !== h || t[5] !== f || t[6] !== a || t[7] !== _) {
|
|
5521
|
+
let e = Rt(), n;
|
|
5522
|
+
t[9] === Symbol.for("react.memo_cache_sentinel") ? (n = Ft({}), t[9] = n) : n = t[9];
|
|
5523
5523
|
let r = Ss({
|
|
5524
5524
|
language: e.language,
|
|
5525
|
-
store:
|
|
5525
|
+
store: _,
|
|
5526
5526
|
onAddFiles: f
|
|
5527
|
-
}), i = e.language.data.of({ autocomplete:
|
|
5527
|
+
}), i = e.language.data.of({ autocomplete: b }), o;
|
|
5528
5528
|
t[10] === Symbol.for("react.memo_cache_sentinel") ? (o = Go({ storage: {
|
|
5529
5529
|
load: Ds,
|
|
5530
5530
|
save: Os
|
|
5531
5531
|
} }), t[10] = o) : o = t[10];
|
|
5532
5532
|
let s;
|
|
5533
|
-
t[11] === Symbol.for("react.memo_cache_sentinel") ? (s =
|
|
5533
|
+
t[11] === Symbol.for("react.memo_cache_sentinel") ? (s = It(), t[11] = s) : s = t[11];
|
|
5534
5534
|
let c;
|
|
5535
|
-
t[12] === h ? c = t[13] : (c =
|
|
5535
|
+
t[12] === h ? c = t[13] : (c = Ct.highest(At.of([{
|
|
5536
5536
|
preventDefault: !0,
|
|
5537
5537
|
stopPropagation: !0,
|
|
5538
5538
|
any: (e, t) => {
|
|
@@ -5541,40 +5541,40 @@ var ws = "marimo:ai-prompt-history", Ts = new Se(Je(mt()), () => []), Es = (e) =
|
|
|
5541
5541
|
}
|
|
5542
5542
|
}])), t[12] = h, t[13] = c);
|
|
5543
5543
|
let l;
|
|
5544
|
-
t[14] ===
|
|
5544
|
+
t[14] === g ? l = t[15] : (l = At.of([{
|
|
5545
5545
|
key: "Escape",
|
|
5546
5546
|
preventDefault: !0,
|
|
5547
5547
|
stopPropagation: !0,
|
|
5548
|
-
run: () => (
|
|
5549
|
-
}]), t[14] =
|
|
5550
|
-
...a ?
|
|
5548
|
+
run: () => (g(), !0)
|
|
5549
|
+
}]), t[14] = g, t[15] = l), x = [
|
|
5550
|
+
...a ? oe(a) : [],
|
|
5551
5551
|
n,
|
|
5552
5552
|
e,
|
|
5553
5553
|
r,
|
|
5554
5554
|
i,
|
|
5555
5555
|
o,
|
|
5556
|
-
|
|
5556
|
+
Et.lineWrapping,
|
|
5557
5557
|
s,
|
|
5558
5558
|
c,
|
|
5559
5559
|
l
|
|
5560
|
-
], t[2] =
|
|
5561
|
-
} else
|
|
5562
|
-
let
|
|
5563
|
-
t[16] === s ?
|
|
5564
|
-
let
|
|
5565
|
-
return t[18] !==
|
|
5560
|
+
], t[2] = b, t[3] = g, t[4] = h, t[5] = f, t[6] = a, t[7] = _, t[8] = x;
|
|
5561
|
+
} else x = t[8];
|
|
5562
|
+
let S = x, C;
|
|
5563
|
+
t[16] === s ? C = t[17] : (C = r("mo-ai-prompt flex-1 font-sans text-sm leading-6 overflow-auto my-1", s), t[16] = s, t[17] = C);
|
|
5564
|
+
let w = v === "dark" ? "dark" : "light", T = a ? void 0 : i || "Generate with AI, @ to include context", E;
|
|
5565
|
+
return t[18] !== S || t[19] !== o || t[20] !== m || t[21] !== c || t[22] !== u || t[23] !== C || t[24] !== w || t[25] !== T || t[26] !== n ? (E = /* @__PURE__ */ (0, Z.jsx)(Lt, {
|
|
5566
5566
|
ref: o,
|
|
5567
|
-
className:
|
|
5567
|
+
className: C,
|
|
5568
5568
|
width: "100%",
|
|
5569
5569
|
maxHeight: m,
|
|
5570
5570
|
value: n,
|
|
5571
5571
|
basicSetup: !1,
|
|
5572
|
-
extensions:
|
|
5572
|
+
extensions: S,
|
|
5573
5573
|
onChange: c,
|
|
5574
5574
|
onKeyDown: u,
|
|
5575
|
-
theme:
|
|
5576
|
-
placeholder:
|
|
5577
|
-
}), t[18] =
|
|
5575
|
+
theme: w,
|
|
5576
|
+
placeholder: T
|
|
5577
|
+
}), t[18] = S, t[19] = o, t[20] = m, t[21] = c, t[22] = u, t[23] = C, t[24] = w, t[25] = T, t[26] = n, t[27] = E) : E = t[27], E;
|
|
5578
5578
|
};
|
|
5579
5579
|
function Ds() {
|
|
5580
5580
|
return Ts.get(ws);
|
|
@@ -5584,11 +5584,11 @@ function Os(e) {
|
|
|
5584
5584
|
}
|
|
5585
5585
|
//#endregion
|
|
5586
5586
|
//#region src/plugins/impl/chat/chat-ui.tsx
|
|
5587
|
-
var ks =
|
|
5588
|
-
type:
|
|
5589
|
-
message_id:
|
|
5590
|
-
content:
|
|
5591
|
-
is_final:
|
|
5587
|
+
var ks = de, As = ft({
|
|
5588
|
+
type: ht("stream_chunk"),
|
|
5589
|
+
message_id: gt(),
|
|
5590
|
+
content: mt().nullable().transform((e) => e),
|
|
5591
|
+
is_final: et().optional()
|
|
5592
5592
|
});
|
|
5593
5593
|
function js(e, t) {
|
|
5594
5594
|
let { controllerRef: r, activeRequestIdRef: i } = t, a = r.current;
|
|
@@ -5608,7 +5608,7 @@ var Ms = (e) => {
|
|
|
5608
5608
|
}, [s]);
|
|
5609
5609
|
let b = (0, X.useRef)(null), x = (0, X.useRef)(null), S = (0, X.useRef)(null), [C, w] = (0, X.useState)(null), T = () => {
|
|
5610
5610
|
S.current = null, w(null);
|
|
5611
|
-
}, { data: E } =
|
|
5611
|
+
}, { data: E } = zt(async () => (await e.get_chat_history({})).messages, []), D = e.value.length > 0 ? e.value : E, { messages: O, sendMessage: ee, setMessages: k, status: A, stop: j, error: M, regenerate: ne, clearError: N, addToolApprovalResponse: ie } = ba({
|
|
5612
5612
|
sendAutomaticallyWhen: ({ messages: e }) => Io(e),
|
|
5613
5613
|
transport: new aa({ fetch: async (t, r) => {
|
|
5614
5614
|
if (r === void 0) return fetch(t);
|
|
@@ -5624,7 +5624,7 @@ var Ms = (e) => {
|
|
|
5624
5624
|
let t = i.messages.map((e) => ({
|
|
5625
5625
|
...e,
|
|
5626
5626
|
content: e.parts?.map((e) => "text" in e ? e.text : "").join("\n")
|
|
5627
|
-
})), r =
|
|
5627
|
+
})), r = te();
|
|
5628
5628
|
T();
|
|
5629
5629
|
let s = new ReadableStream({
|
|
5630
5630
|
start(t) {
|
|
@@ -5660,7 +5660,7 @@ var Ms = (e) => {
|
|
|
5660
5660
|
return new Response(t, { status: 400 });
|
|
5661
5661
|
}
|
|
5662
5662
|
} }),
|
|
5663
|
-
messages:
|
|
5663
|
+
messages: D,
|
|
5664
5664
|
onFinish: ({ messages: t, isAbort: r, finishReason: i }) => {
|
|
5665
5665
|
if (p(void 0), m.current && (m.current.value = ""), n.debug("Finished streaming message:", {
|
|
5666
5666
|
finishReason: i,
|
|
@@ -5684,7 +5684,7 @@ var Ms = (e) => {
|
|
|
5684
5684
|
n.error("An error occurred:", e);
|
|
5685
5685
|
}
|
|
5686
5686
|
});
|
|
5687
|
-
i(e.host,
|
|
5687
|
+
i(e.host, ze.TYPE, (e) => {
|
|
5688
5688
|
let t = As.safeParse(e.detail.message);
|
|
5689
5689
|
if (t.success) {
|
|
5690
5690
|
if (t.data.content && t.data.message_id === x.current) {
|
|
@@ -5697,27 +5697,27 @@ var Ms = (e) => {
|
|
|
5697
5697
|
});
|
|
5698
5698
|
}
|
|
5699
5699
|
});
|
|
5700
|
-
let
|
|
5701
|
-
let n =
|
|
5700
|
+
let ae = A === "submitted" || A === "streaming", oe = (t) => {
|
|
5701
|
+
let n = O.findIndex((e) => e.id === t);
|
|
5702
5702
|
if (n !== -1) {
|
|
5703
|
-
let r =
|
|
5704
|
-
e.delete_chat_message({ index: n }),
|
|
5703
|
+
let r = O.filter((e) => e.id !== t);
|
|
5704
|
+
e.delete_chat_message({ index: n }), k(r), e.setValue(r), r.length === 0 && T();
|
|
5705
5705
|
}
|
|
5706
|
-
},
|
|
5706
|
+
}, se = Array.isArray(e.allowAttachments) && e.allowAttachments.length > 0 || e.allowAttachments === !0, ce = {
|
|
5707
5707
|
triggerCompletionRegex: /^\/(\w+)?/,
|
|
5708
5708
|
completions: e.prompts.map((e) => ({
|
|
5709
5709
|
label: `/${e}`,
|
|
5710
5710
|
displayLabel: e,
|
|
5711
5711
|
apply: e
|
|
5712
5712
|
}))
|
|
5713
|
-
},
|
|
5713
|
+
}, le = e.prompts.length > 0 ? "Type your message here, / for prompts" : "Type your message here...";
|
|
5714
5714
|
(0, X.useEffect)(() => {
|
|
5715
5715
|
_.current?.scrollTo({
|
|
5716
5716
|
top: _.current.scrollHeight,
|
|
5717
5717
|
behavior: "smooth"
|
|
5718
5718
|
});
|
|
5719
|
-
}, [
|
|
5720
|
-
let
|
|
5719
|
+
}, [O.length, _]);
|
|
5720
|
+
let ue = () => {
|
|
5721
5721
|
let e = g.current?.view;
|
|
5722
5722
|
if (e) {
|
|
5723
5723
|
let t = e.state.doc.length;
|
|
@@ -5739,21 +5739,21 @@ var Ms = (e) => {
|
|
|
5739
5739
|
"aria-label": "Reset chat",
|
|
5740
5740
|
variant: "text",
|
|
5741
5741
|
size: "icon",
|
|
5742
|
-
disabled:
|
|
5742
|
+
disabled: O.length === 0,
|
|
5743
5743
|
onClick: () => {
|
|
5744
|
-
|
|
5744
|
+
k([]), e.setValue([]), e.delete_chat_history({}), N(), T();
|
|
5745
5745
|
},
|
|
5746
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
5746
|
+
children: /* @__PURE__ */ (0, Z.jsx)(Xt, { className: "h-3 w-3" })
|
|
5747
5747
|
})
|
|
5748
5748
|
}),
|
|
5749
5749
|
/* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
5750
5750
|
className: "grow overflow-y-auto gap-4 pt-8 pb-4 px-2 flex flex-col",
|
|
5751
5751
|
ref: _,
|
|
5752
5752
|
children: [
|
|
5753
|
-
|
|
5753
|
+
O.length === 0 && /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
5754
5754
|
className: "flex flex-col items-center justify-center h-full text-muted-foreground text-center p-4",
|
|
5755
5755
|
children: [
|
|
5756
|
-
/* @__PURE__ */ (0, Z.jsx)(
|
|
5756
|
+
/* @__PURE__ */ (0, Z.jsx)(Ht, { className: "h-12 w-12 mb-4" }),
|
|
5757
5757
|
/* @__PURE__ */ (0, Z.jsx)("h3", {
|
|
5758
5758
|
className: "text-lg font-semibold mb-2",
|
|
5759
5759
|
children: "No messages yet"
|
|
@@ -5764,8 +5764,8 @@ var Ms = (e) => {
|
|
|
5764
5764
|
})
|
|
5765
5765
|
]
|
|
5766
5766
|
}),
|
|
5767
|
-
|
|
5768
|
-
let n = e.parts?.filter((e) => e.type === "text").map((e) => e.text).join("\n"), i = t ===
|
|
5767
|
+
O.map((e, t) => {
|
|
5768
|
+
let n = e.parts?.filter((e) => e.type === "text").map((e) => e.text).join("\n"), i = t === O.length - 1;
|
|
5769
5769
|
return /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
5770
5770
|
className: r("flex flex-col group gap-2", e.role === "user" ? "items-end" : "items-start"),
|
|
5771
5771
|
children: [/* @__PURE__ */ (0, Z.jsx)("div", {
|
|
@@ -5773,8 +5773,8 @@ var Ms = (e) => {
|
|
|
5773
5773
|
children: no({
|
|
5774
5774
|
message: e,
|
|
5775
5775
|
isLast: i,
|
|
5776
|
-
isActive:
|
|
5777
|
-
addToolApprovalResponse: i ?
|
|
5776
|
+
isActive: ae,
|
|
5777
|
+
addToolApprovalResponse: i ? ie : void 0
|
|
5778
5778
|
})
|
|
5779
5779
|
}), /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
5780
5780
|
className: "flex justify-end text-xs gap-2 opacity-0 group-hover:opacity-100 focus-within:opacity-100",
|
|
@@ -5785,27 +5785,27 @@ var Ms = (e) => {
|
|
|
5785
5785
|
}), /* @__PURE__ */ (0, Z.jsx)("button", {
|
|
5786
5786
|
type: "button",
|
|
5787
5787
|
"aria-label": "Delete message",
|
|
5788
|
-
onClick: () =>
|
|
5788
|
+
onClick: () => oe(e.id),
|
|
5789
5789
|
className: "text-xs text-(--slate-9) hover:text-(--slate-11)",
|
|
5790
5790
|
children: /* @__PURE__ */ (0, Z.jsx)(y, { className: "h-3 w-3 text-(--red-9)" })
|
|
5791
5791
|
})]
|
|
5792
5792
|
})]
|
|
5793
5793
|
}, e.id);
|
|
5794
5794
|
}),
|
|
5795
|
-
|
|
5795
|
+
ae && O.at(-1)?.role !== "assistant" && /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
5796
5796
|
className: "flex items-center justify-center mb-4",
|
|
5797
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
5797
|
+
children: /* @__PURE__ */ (0, Z.jsx)(re, { size: "small" })
|
|
5798
5798
|
}),
|
|
5799
|
-
|
|
5799
|
+
M && /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
5800
5800
|
className: "flex items-center justify-center space-x-2 mb-4",
|
|
5801
|
-
children: [/* @__PURE__ */ (0, Z.jsx)(
|
|
5801
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(_t, { error: M }), /* @__PURE__ */ (0, Z.jsx)(a, {
|
|
5802
5802
|
variant: "outline",
|
|
5803
5803
|
size: "sm",
|
|
5804
|
-
onClick: () =>
|
|
5804
|
+
onClick: () => ne(),
|
|
5805
5805
|
children: "Retry"
|
|
5806
5806
|
})]
|
|
5807
5807
|
}),
|
|
5808
|
-
C && !
|
|
5808
|
+
C && !ae && !M && /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
5809
5809
|
className: "flex justify-center py-2",
|
|
5810
5810
|
children: /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
5811
5811
|
className: "text-xs text-muted-foreground",
|
|
@@ -5818,13 +5818,13 @@ var Ms = (e) => {
|
|
|
5818
5818
|
onSubmit: async (n) => {
|
|
5819
5819
|
if (n.preventDefault(), e.disabled) return;
|
|
5820
5820
|
let r = f ? await Fo(f) : void 0;
|
|
5821
|
-
|
|
5821
|
+
ee({
|
|
5822
5822
|
role: "user",
|
|
5823
5823
|
parts: [{
|
|
5824
5824
|
type: "text",
|
|
5825
5825
|
text: t
|
|
5826
5826
|
}, ...r ?? []]
|
|
5827
|
-
}),
|
|
5827
|
+
}), ue();
|
|
5828
5828
|
},
|
|
5829
5829
|
ref: h,
|
|
5830
5830
|
inert: e.disabled || void 0,
|
|
@@ -5845,7 +5845,7 @@ var Ms = (e) => {
|
|
|
5845
5845
|
}),
|
|
5846
5846
|
/* @__PURE__ */ (0, Z.jsx)(Es, {
|
|
5847
5847
|
className: "rounded-sm mr-2",
|
|
5848
|
-
placeholder:
|
|
5848
|
+
placeholder: le,
|
|
5849
5849
|
value: t,
|
|
5850
5850
|
inputRef: g,
|
|
5851
5851
|
maxHeight: e.maxHeight ? `${e.maxHeight / 2}px` : void 0,
|
|
@@ -5854,7 +5854,7 @@ var Ms = (e) => {
|
|
|
5854
5854
|
t.trim() && h.current?.requestSubmit();
|
|
5855
5855
|
},
|
|
5856
5856
|
onClose: () => {},
|
|
5857
|
-
additionalCompletions:
|
|
5857
|
+
additionalCompletions: ce
|
|
5858
5858
|
}),
|
|
5859
5859
|
f && f.length === 1 && /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
5860
5860
|
title: f[0].name,
|
|
@@ -5873,14 +5873,14 @@ var Ms = (e) => {
|
|
|
5873
5873
|
onClick: () => {
|
|
5874
5874
|
p(void 0), m.current && (m.current.value = "");
|
|
5875
5875
|
},
|
|
5876
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
5876
|
+
children: /* @__PURE__ */ (0, Z.jsx)(Ge, { className: "size-3" })
|
|
5877
5877
|
}),
|
|
5878
|
-
|
|
5878
|
+
se && /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)(a, {
|
|
5879
5879
|
type: "button",
|
|
5880
5880
|
variant: "text",
|
|
5881
5881
|
size: "sm",
|
|
5882
5882
|
onClick: () => m.current?.click(),
|
|
5883
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
5883
|
+
children: /* @__PURE__ */ (0, Z.jsx)(Yt, { className: "h-4" })
|
|
5884
5884
|
}), /* @__PURE__ */ (0, Z.jsx)("input", {
|
|
5885
5885
|
type: "file",
|
|
5886
5886
|
ref: m,
|
|
@@ -5891,15 +5891,15 @@ var Ms = (e) => {
|
|
|
5891
5891
|
e.target.files && p([...e.target.files]);
|
|
5892
5892
|
}
|
|
5893
5893
|
})] }),
|
|
5894
|
-
|
|
5894
|
+
ae ? /* @__PURE__ */ (0, Z.jsx)(fe, {
|
|
5895
5895
|
content: "Stop generating",
|
|
5896
5896
|
children: /* @__PURE__ */ (0, Z.jsx)(a, {
|
|
5897
5897
|
type: "button",
|
|
5898
5898
|
variant: "link",
|
|
5899
5899
|
size: "xs",
|
|
5900
|
-
onClick: () =>
|
|
5900
|
+
onClick: () => j(),
|
|
5901
5901
|
className: "text-(--red-9) hover:text-(--red-11)",
|
|
5902
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
5902
|
+
children: /* @__PURE__ */ (0, Z.jsx)(Ve, { className: "h-4 w-4 fill-current" })
|
|
5903
5903
|
})
|
|
5904
5904
|
}) : /* @__PURE__ */ (0, Z.jsx)(a, {
|
|
5905
5905
|
type: "submit",
|
|
@@ -5908,7 +5908,7 @@ var Ms = (e) => {
|
|
|
5908
5908
|
size: "xs",
|
|
5909
5909
|
className: "text-(--slate-11)",
|
|
5910
5910
|
"aria-label": "Send message",
|
|
5911
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
5911
|
+
children: /* @__PURE__ */ (0, Z.jsx)(Qt, { className: "h-4 w-4" })
|
|
5912
5912
|
})
|
|
5913
5913
|
]
|
|
5914
5914
|
})
|
|
@@ -5948,7 +5948,7 @@ var Ms = (e) => {
|
|
|
5948
5948
|
description: "Penalizes new tokens (-2: favor, 2: avoid)"
|
|
5949
5949
|
}
|
|
5950
5950
|
}, Ps = (e) => {
|
|
5951
|
-
let t = (0,
|
|
5951
|
+
let t = (0, F.c)(16), { config: n, onChange: r } = e, [i, o] = (0, X.useState)(!1), s;
|
|
5952
5952
|
t[0] !== n || t[1] !== r ? (s = (e, t) => {
|
|
5953
5953
|
let i = t === null || Number.isNaN(t) ? null : t;
|
|
5954
5954
|
if (i !== null) {
|
|
@@ -5966,15 +5966,15 @@ var Ms = (e) => {
|
|
|
5966
5966
|
e.key === "Enter" && (e.preventDefault(), o(!1));
|
|
5967
5967
|
}, t[3] = l) : l = t[3];
|
|
5968
5968
|
let u = l, d;
|
|
5969
|
-
t[4] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ (0, Z.jsx)(
|
|
5969
|
+
t[4] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ (0, Z.jsx)(fe, {
|
|
5970
5970
|
content: "Configuration",
|
|
5971
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
5971
|
+
children: /* @__PURE__ */ (0, Z.jsx)(E, {
|
|
5972
5972
|
asChild: !0,
|
|
5973
5973
|
children: /* @__PURE__ */ (0, Z.jsx)(a, {
|
|
5974
5974
|
variant: "outline",
|
|
5975
5975
|
size: "sm",
|
|
5976
5976
|
className: "border-none shadow-none hover:bg-transparent",
|
|
5977
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
5977
|
+
children: /* @__PURE__ */ (0, Z.jsx)($t, { className: "h-3 w-3" })
|
|
5978
5978
|
})
|
|
5979
5979
|
})
|
|
5980
5980
|
}), t[4] = d) : d = t[4];
|
|
@@ -5990,19 +5990,19 @@ var Ms = (e) => {
|
|
|
5990
5990
|
let [t, n] = e;
|
|
5991
5991
|
return /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
5992
5992
|
className: "grid grid-cols-3 items-center gap-1",
|
|
5993
|
-
children: [/* @__PURE__ */ (0, Z.jsxs)(
|
|
5993
|
+
children: [/* @__PURE__ */ (0, Z.jsxs)(pe, {
|
|
5994
5994
|
htmlFor: t,
|
|
5995
5995
|
className: "flex w-full justify-between col-span-3 align-end",
|
|
5996
|
-
children: [
|
|
5996
|
+
children: [We.startCase(t), /* @__PURE__ */ (0, Z.jsx)(fe, {
|
|
5997
5997
|
delayDuration: 200,
|
|
5998
5998
|
side: "top",
|
|
5999
5999
|
content: /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
6000
6000
|
className: "text-xs flex flex-col",
|
|
6001
6001
|
children: Ns[t].description
|
|
6002
6002
|
}),
|
|
6003
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
6003
|
+
children: /* @__PURE__ */ (0, Z.jsx)(Ce, { className: "h-3 w-3 cursor-help text-muted-foreground hover:text-foreground" })
|
|
6004
6004
|
})]
|
|
6005
|
-
}), /* @__PURE__ */ (0, Z.jsx)(
|
|
6005
|
+
}), /* @__PURE__ */ (0, Z.jsx)(be, {
|
|
6006
6006
|
id: t,
|
|
6007
6007
|
"aria-label": t,
|
|
6008
6008
|
value: n ?? NaN,
|
|
@@ -6015,10 +6015,10 @@ var Ms = (e) => {
|
|
|
6015
6015
|
className: "col-span-3"
|
|
6016
6016
|
})]
|
|
6017
6017
|
}, t);
|
|
6018
|
-
}, t[9] = c, t[10] = e), p =
|
|
6018
|
+
}, t[9] = c, t[10] = e), p = yt.entries(n).map(e), t[6] = n, t[7] = c, t[8] = p;
|
|
6019
6019
|
} else p = t[8];
|
|
6020
6020
|
let m;
|
|
6021
|
-
t[11] === p ? m = t[12] : (m = /* @__PURE__ */ (0, Z.jsx)(
|
|
6021
|
+
t[11] === p ? m = t[12] : (m = /* @__PURE__ */ (0, Z.jsx)(w, {
|
|
6022
6022
|
className: "w-70 border",
|
|
6023
6023
|
children: /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
6024
6024
|
className: "grid gap-3",
|
|
@@ -6026,40 +6026,40 @@ var Ms = (e) => {
|
|
|
6026
6026
|
})
|
|
6027
6027
|
}), t[11] = p, t[12] = m);
|
|
6028
6028
|
let h;
|
|
6029
|
-
return t[13] !== i || t[14] !== m ? (h = /* @__PURE__ */ (0, Z.jsxs)(
|
|
6029
|
+
return t[13] !== i || t[14] !== m ? (h = /* @__PURE__ */ (0, Z.jsxs)(T, {
|
|
6030
6030
|
open: i,
|
|
6031
6031
|
onOpenChange: o,
|
|
6032
6032
|
children: [d, m]
|
|
6033
6033
|
}), t[13] = i, t[14] = m, t[15] = h) : h = t[15], h;
|
|
6034
6034
|
}, Fs = (e) => {
|
|
6035
|
-
let t = (0,
|
|
6035
|
+
let t = (0, F.c)(18), { prompts: n, onSelect: r } = e, [i, o] = (0, X.useState)(!1), [s, c] = (0, X.useState)(""), l;
|
|
6036
6036
|
t[0] === r ? l = t[1] : (l = (e) => {
|
|
6037
6037
|
[...e.matchAll(/{{(\w+)}}/g)].length > 0 ? (c(e), o(!0)) : r(e);
|
|
6038
6038
|
}, t[0] = r, t[1] = l);
|
|
6039
6039
|
let u = l, d;
|
|
6040
|
-
t[2] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ (0, Z.jsx)(
|
|
6040
|
+
t[2] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ (0, Z.jsx)(fe, {
|
|
6041
6041
|
content: "Select a prompt",
|
|
6042
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
6042
|
+
children: /* @__PURE__ */ (0, Z.jsx)(he, {
|
|
6043
6043
|
asChild: !0,
|
|
6044
6044
|
children: /* @__PURE__ */ (0, Z.jsx)(a, {
|
|
6045
6045
|
variant: "outline",
|
|
6046
6046
|
size: "sm",
|
|
6047
6047
|
className: "border-none shadow-none hover:bg-transparent",
|
|
6048
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
6048
|
+
children: /* @__PURE__ */ (0, Z.jsx)(ue, { className: "h-3 w-3" })
|
|
6049
6049
|
})
|
|
6050
6050
|
})
|
|
6051
6051
|
}), t[2] = d) : d = t[2];
|
|
6052
6052
|
let f;
|
|
6053
6053
|
if (t[3] !== u || t[4] !== n) {
|
|
6054
6054
|
let e;
|
|
6055
|
-
t[6] === u ? e = t[7] : (e = (e, t) => /* @__PURE__ */ (0, Z.jsx)(
|
|
6055
|
+
t[6] === u ? e = t[7] : (e = (e, t) => /* @__PURE__ */ (0, Z.jsx)(_e, {
|
|
6056
6056
|
onSelect: () => u(e),
|
|
6057
6057
|
className: "whitespace-normal text-left",
|
|
6058
6058
|
children: e
|
|
6059
6059
|
}, t), t[6] = u, t[7] = e), f = n.map(e), t[3] = u, t[4] = n, t[5] = f;
|
|
6060
6060
|
} else f = t[5];
|
|
6061
6061
|
let p;
|
|
6062
|
-
t[8] === f ? p = t[9] : (p = /* @__PURE__ */ (0, Z.jsx)(ks, { children: /* @__PURE__ */ (0, Z.jsxs)(
|
|
6062
|
+
t[8] === f ? p = t[9] : (p = /* @__PURE__ */ (0, Z.jsx)(ks, { children: /* @__PURE__ */ (0, Z.jsxs)(ye, { children: [d, /* @__PURE__ */ (0, Z.jsx)(ve, {
|
|
6063
6063
|
side: "right",
|
|
6064
6064
|
align: "end",
|
|
6065
6065
|
onCloseAutoFocus: Ls,
|
|
@@ -6069,7 +6069,7 @@ var Ms = (e) => {
|
|
|
6069
6069
|
let m;
|
|
6070
6070
|
t[10] === Symbol.for("react.memo_cache_sentinel") ? (m = () => o(!1), t[10] = m) : m = t[10];
|
|
6071
6071
|
let h;
|
|
6072
|
-
t[11] !== r || t[12] !== s ? (h = /* @__PURE__ */ (0, Z.jsx)(
|
|
6072
|
+
t[11] !== r || t[12] !== s ? (h = /* @__PURE__ */ (0, Z.jsx)(w, {
|
|
6073
6073
|
side: "right",
|
|
6074
6074
|
align: "end",
|
|
6075
6075
|
className: "min-w-80 px-2",
|
|
@@ -6080,13 +6080,13 @@ var Ms = (e) => {
|
|
|
6080
6080
|
}, s)
|
|
6081
6081
|
}), t[11] = r, t[12] = s, t[13] = h) : h = t[13];
|
|
6082
6082
|
let g;
|
|
6083
|
-
return t[14] !== i || t[15] !== p || t[16] !== h ? (g = /* @__PURE__ */ (0, Z.jsxs)(
|
|
6083
|
+
return t[14] !== i || t[15] !== p || t[16] !== h ? (g = /* @__PURE__ */ (0, Z.jsxs)(T, {
|
|
6084
6084
|
open: i,
|
|
6085
6085
|
onOpenChange: o,
|
|
6086
6086
|
children: [p, h]
|
|
6087
6087
|
}), t[14] = i, t[15] = p, t[16] = h, t[17] = g) : g = t[17], g;
|
|
6088
6088
|
}, Is = (e) => {
|
|
6089
|
-
let t = (0,
|
|
6089
|
+
let t = (0, F.c)(30), { prompt: n, onClose: r, onSelect: i } = e, o;
|
|
6090
6090
|
t[0] === n ? o = t[1] : (o = () => [...n.matchAll(/{{(\w+)}}/g)].reduce(Rs, {}), t[0] = n, t[1] = o);
|
|
6091
6091
|
let [s, c] = (0, X.useState)(o), l;
|
|
6092
6092
|
t[2] === Symbol.for("react.memo_cache_sentinel") ? (l = (e, t) => {
|
|
@@ -6115,11 +6115,11 @@ var Ms = (e) => {
|
|
|
6115
6115
|
let [n, r] = e;
|
|
6116
6116
|
return /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
6117
6117
|
className: "grid grid-cols-4 items-center gap-2",
|
|
6118
|
-
children: [/* @__PURE__ */ (0, Z.jsx)(
|
|
6118
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(pe, {
|
|
6119
6119
|
htmlFor: n,
|
|
6120
6120
|
className: "font-semibold text-base",
|
|
6121
6121
|
children: n
|
|
6122
|
-
}), /* @__PURE__ */ (0, Z.jsx)(
|
|
6122
|
+
}), /* @__PURE__ */ (0, Z.jsx)(ge, {
|
|
6123
6123
|
id: n,
|
|
6124
6124
|
value: r,
|
|
6125
6125
|
onChange: (e) => u(n, e.target.value),
|