@marimo-team/islands 0.25.3-dev388 → 0.25.3-dev391
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-_mFP3LkM.js → ErrorBoundary-DNRG0xHi.js} +1 -1
- package/dist/{chat-ui-BKSYhGMh.js → chat-ui-CWVNPm2l.js} +769 -769
- package/dist/{code-visibility-DkMNjdNe.js → code-visibility-Ca8sDptK.js} +10 -10
- package/dist/{common-Ces9ooG_.js → common-B3NYpak4.js} +4910 -4902
- package/dist/{data-grid-overlay-editor-uNMslVKY.js → data-grid-overlay-editor-Cz7uMmtm.js} +1 -1
- package/dist/{error-entries-rtPWQkJk.js → error-entries-CnXf4kpP.js} +821 -686
- package/dist/{feedback-button-i960qUnq.js → feedback-button-BQbnZsf5.js} +7 -7
- package/dist/{glide-data-editor-_EEhlGzS.js → glide-data-editor-Bxc30klU.js} +3 -3
- package/dist/{globals-DKkjIolp.js → globals-CDatnx0Y.js} +1 -1
- package/dist/{html-to-image-B5nTOeMI.js → html-to-image-Bu_-vH_Y.js} +4782 -4765
- package/dist/main.js +6233 -6172
- package/dist/{number-overlay-editor-D5U7jbrh.js → number-overlay-editor-ChGu5C-s.js} +1 -1
- package/dist/{process-output-DNxpsd4n.js → process-output-Rbqr1aYD.js} +2 -2
- package/dist/{reveal-component-BM9TozVQ.js → reveal-component-CSxWJFAP.js} +32 -32
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/__mocks__/executions.ts +48 -8
- package/src/__mocks__/notebook.ts +20 -42
- package/src/components/app-config/__tests__/add-model-discovery.test.tsx +255 -0
- package/src/components/app-config/__tests__/model-discovery.test.tsx +183 -0
- package/src/components/app-config/ai-config.tsx +20 -24
- package/src/components/app-config/model-discovery.tsx +118 -184
- package/src/components/app-config/model-provider-config.ts +25 -0
- package/src/components/editor/Output.tsx +5 -4
- package/src/components/editor/__tests__/data-attributes.test.tsx +1 -6
- package/src/components/editor/__tests__/dynamic-favicon.test.tsx +11 -16
- package/src/components/editor/__tests__/output-persistence.test.tsx +6 -24
- package/src/components/editor/actions/__tests__/useSetOutputsExpanded.test.ts +6 -8
- package/src/components/editor/actions/useSetOutputsExpanded.ts +12 -4
- package/src/components/editor/cell/cell-context-menu.tsx +3 -2
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +89 -72
- package/src/components/editor/notebook-cell.tsx +15 -10
- package/src/components/editor/output/console/process-output.ts +4 -2
- package/src/components/editor/renderers/cells-renderer.tsx +3 -1
- package/src/components/editor/renderers/grid-layout/__tests__/grid-layout.test.tsx +5 -11
- package/src/components/editor/renderers/grid-layout/grid-layout.tsx +9 -8
- package/src/components/editor/renderers/types.ts +2 -2
- package/src/components/editor/renderers/vertical-layout/utils.ts +4 -4
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +5 -8
- package/src/components/scratchpad/scratchpad.tsx +6 -2
- package/src/components/slides/__tests__/cell-output-block.test.tsx +7 -8
- package/src/components/slides/__tests__/minimap-actions.test.tsx +3 -3
- package/src/components/slides/__tests__/slide-cell-view.test.tsx +1 -0
- package/src/components/slides/slide-cell-view.tsx +1 -3
- package/src/components/slides/slide.tsx +3 -3
- package/src/core/ai/context/__tests__/registry.test.ts +7 -11
- package/src/core/ai/context/providers/__tests__/cell-output.test.ts +113 -35
- package/src/core/ai/context/providers/__tests__/error.test.ts +74 -191
- package/src/core/ai/context/providers/cell-output.ts +11 -6
- package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +8 -103
- package/src/core/cells/__tests__/cells.test.ts +40 -292
- package/src/core/cells/__tests__/clear-outputs.test.ts +151 -0
- package/src/core/cells/__tests__/harness.ts +14 -12
- package/src/core/cells/__tests__/layout.test.ts +20 -26
- package/src/core/cells/__tests__/notebook-outline.test.ts +49 -43
- package/src/core/cells/__tests__/session.test.ts +26 -146
- package/src/core/cells/actions.ts +49 -9
- package/src/core/cells/cell.ts +0 -13
- package/src/core/cells/cells.ts +53 -62
- package/src/core/cells/focus.ts +6 -1
- package/src/core/cells/layout.ts +2 -3
- package/src/core/cells/outputs.ts +2 -2
- package/src/core/cells/session.ts +3 -38
- package/src/core/cells/types.ts +6 -8
- package/src/core/cells/utils.ts +4 -3
- package/src/core/codemirror/ai/__tests__/resources.test.ts +7 -11
- package/src/core/errors/__tests__/error-entries.test.ts +52 -18
- package/src/core/errors/error-entries.ts +21 -11
- package/src/core/executions/__tests__/freshness.test.ts +7 -4
- package/src/core/executions/__tests__/hooks.test.tsx +5 -1
- package/src/core/executions/__tests__/interrupt.test.ts +2 -0
- package/src/core/executions/__tests__/output-lifecycle.test.ts +201 -0
- package/src/core/executions/__tests__/output.test.ts +87 -3
- package/src/core/executions/__tests__/select.test.ts +17 -10
- package/src/core/executions/atoms.ts +73 -15
- package/src/core/executions/freshness.ts +1 -1
- package/src/core/executions/hooks.ts +18 -8
- package/src/core/executions/index.ts +6 -0
- package/src/core/executions/output.ts +122 -38
- package/src/core/executions/select.ts +2 -2
- package/src/core/export/__tests__/hooks.test.ts +20 -29
- package/src/core/export/hooks.ts +7 -9
- package/src/core/islands/__tests__/iframe-resizer.test.ts +91 -0
- package/src/core/islands/__tests__/main.test.ts +17 -0
- package/src/core/islands/components/__tests__/web-components.test.tsx +13 -15
- package/src/core/islands/components/output-wrapper.tsx +15 -20
- package/src/core/islands/iframe-resizer.ts +38 -0
- package/src/core/islands/main.ts +3 -0
- package/src/core/lifecycle/render-policy.ts +7 -4
- package/src/core/network/__tests__/ai.test.ts +41 -0
- package/src/core/network/ai.ts +12 -0
- package/src/core/notebook/document/__tests__/codemirror.test.ts +2 -0
- package/src/core/notebook/replica/__tests__/replica.test.ts +19 -0
- package/src/core/notebook/replica/__tests__/results.test.ts +45 -16
- package/src/core/notebook/replica/index.ts +1 -1
- package/src/core/notebook/replica/replica.ts +19 -4
- package/src/core/notebook/replica/resources/executions.ts +100 -9
- package/src/core/notebook/replica/resources/results.ts +46 -31
- package/src/core/transports/__tests__/static.test.ts +5 -3
- package/src/stories/cell.stories.tsx +40 -30
- package/src/stories/layout/vertical/one-column.stories.tsx +15 -7
|
@@ -3,27 +3,27 @@ import { g as n, h as r, i, t as a } from "./button-qQhINE7z.js";
|
|
|
3
3
|
import { t as o } from "./react-Bgs_wQh3.js";
|
|
4
4
|
import { t as s } from "./compiler-runtime-C5KHtL5D.js";
|
|
5
5
|
import { i as c, t as l } from "./copy-icon-xWvA8ybp.js";
|
|
6
|
-
import { At as u, Bt as d, Dt as f, Et as p, Ft as m, Ht as h, J as g, Lt as _, M as v, Ot as y, Pt as b, Rt as x, U as S, V as C, W as w, Y as T, a as E, dt as D, et as O, f as k, g as A, h as j, ht as M, l as N, m as P, n as ee, nt as te, p as F, r as ne, st as re, t as ie, tt as ae, u as oe, v as se, wt as ce, xt as le } from "./html-to-image-
|
|
6
|
+
import { At as u, Bt as d, Dt as f, Et as p, Ft as m, Ht as h, J as g, Lt as _, M as v, Ot as y, Pt as b, Rt as x, U as S, V as C, W as w, Y as T, a as E, dt as D, et as O, f as k, g as A, h as j, ht as M, l as N, m as P, n as ee, nt as te, p as F, r as ne, st as re, t as ie, tt as ae, u as oe, v as se, wt as ce, xt as le } from "./html-to-image-Bu_-vH_Y.js";
|
|
7
7
|
import { h as I, t as ue } from "./tooltip-BwlFTaNy.js";
|
|
8
8
|
import { d as de } from "./select-Ca-POp4c.js";
|
|
9
9
|
import { Cn as fe, _ as pe, f as me, h as he, i as ge, n as _e, t as ve, xn as ye } from "./dropdown-menu-DfamXjVI.js";
|
|
10
10
|
import { a as be, l as xe } from "./config-DJ8M-gPL.js";
|
|
11
|
-
import { $ as Se, Ct as Ce, P as we,
|
|
12
|
-
import { d as
|
|
13
|
-
import { t as
|
|
14
|
-
import { n as
|
|
15
|
-
import { t as
|
|
16
|
-
import { $ as
|
|
17
|
-
import { n as
|
|
18
|
-
import { t as
|
|
19
|
-
import { t as
|
|
20
|
-
import { t as
|
|
21
|
-
import { Dt as
|
|
22
|
-
import { n as
|
|
23
|
-
import { n as
|
|
24
|
-
import { n as
|
|
25
|
-
import { t as
|
|
26
|
-
var
|
|
11
|
+
import { $ as Se, Ct as Ce, P as we, Rt as Te, W as Ee, en as De, h as Oe, i as ke, j as Ae, ot as je, r as Me, t as Ne } from "./error-entries-CnXf4kpP.js";
|
|
12
|
+
import { d as Pe, f as Fe, i as Ie, n as Le, t as Re, u as ze } from "./process-output-Rbqr1aYD.js";
|
|
13
|
+
import { t as Be } from "./pencil-weySvN0N.js";
|
|
14
|
+
import { n as Ve, r as He, s as Ue } from "./assertNever-5uYEbJc8.js";
|
|
15
|
+
import { t as We } from "./jsx-runtime-D8btoEHk.js";
|
|
16
|
+
import { $ as Ge, B as Ke, G as qe, H as Je, It as Ye, K as Xe, Pt as Ze, U as Qe, V as $e, W as et, X as tt, Y as nt, Z as rt, at as it, ct as at, d as ot, dt as st, et as ct, lt, p as ut, q as dt, rt as ft, st as pt, tt as mt } from "./use-restore-focus-fKgXR0nb.js";
|
|
17
|
+
import { n as ht } from "./error-banner-k06CAftu.js";
|
|
18
|
+
import { t as gt } from "./isEmpty-CdX7MTE1.js";
|
|
19
|
+
import { t as _t } from "./objects-DCmMvZtn.js";
|
|
20
|
+
import { t as vt } from "./useEvent-BoN7U38T.js";
|
|
21
|
+
import { Dt as yt, Et as bt, St as xt, U as St, V as Ct, W as wt, bt as Tt, kt as Et, nt as Dt, rt as Ot, yt as kt, z as At } from "./dist-B_xgcU0N.js";
|
|
22
|
+
import { n as jt, o as Mt, r as Nt } from "./dist-C3dYgyiI.js";
|
|
23
|
+
import { n as Pt } from "./dist-U4WlxEDL.js";
|
|
24
|
+
import { n as Ft, t as It } from "./esm-Dc_RPXvZ.js";
|
|
25
|
+
import { t as Lt } from "./useAsyncData-P5-Oovhq.js";
|
|
26
|
+
var Rt = I("ban", [["circle", {
|
|
27
27
|
cx: "12",
|
|
28
28
|
cy: "12",
|
|
29
29
|
r: "10",
|
|
@@ -31,13 +31,13 @@ var Lt = I("ban", [["circle", {
|
|
|
31
31
|
}], ["path", {
|
|
32
32
|
d: "M4.929 4.929 19.07 19.071",
|
|
33
33
|
key: "196cmz"
|
|
34
|
-
}]]),
|
|
34
|
+
}]]), zt = I("book-open", [["path", {
|
|
35
35
|
d: "M12 7v14",
|
|
36
36
|
key: "1akyts"
|
|
37
37
|
}], ["path", {
|
|
38
38
|
d: "M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",
|
|
39
39
|
key: "ruj8y"
|
|
40
|
-
}]]),
|
|
40
|
+
}]]), Bt = I("bot-message-square", [
|
|
41
41
|
["path", {
|
|
42
42
|
d: "M12 6V2H8",
|
|
43
43
|
key: "1155em"
|
|
@@ -62,7 +62,7 @@ var Lt = I("ban", [["circle", {
|
|
|
62
62
|
d: "M9 11v2",
|
|
63
63
|
key: "1ueba0"
|
|
64
64
|
}]
|
|
65
|
-
]),
|
|
65
|
+
]), Vt = I("brain", [
|
|
66
66
|
["path", {
|
|
67
67
|
d: "M12 18V5",
|
|
68
68
|
key: "adv99a"
|
|
@@ -95,7 +95,7 @@ var Lt = 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
|
+
]), Ht = I("bug", [
|
|
99
99
|
["path", {
|
|
100
100
|
d: "M12 20v-9",
|
|
101
101
|
key: "1qisl0"
|
|
@@ -140,7 +140,7 @@ var Lt = I("ban", [["circle", {
|
|
|
140
140
|
d: "M9 7.13V6a3 3 0 1 1 6 0v1.13",
|
|
141
141
|
key: "1vgav8"
|
|
142
142
|
}]
|
|
143
|
-
]),
|
|
143
|
+
]), Ut = I("circle-slash", [["circle", {
|
|
144
144
|
cx: "12",
|
|
145
145
|
cy: "12",
|
|
146
146
|
r: "10",
|
|
@@ -151,7 +151,7 @@ var Lt = I("ban", [["circle", {
|
|
|
151
151
|
y1: "15",
|
|
152
152
|
y2: "9",
|
|
153
153
|
key: "1dfufj"
|
|
154
|
-
}]]),
|
|
154
|
+
}]]), Wt = I("file-search", [
|
|
155
155
|
["path", {
|
|
156
156
|
d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
|
|
157
157
|
key: "1oefj6"
|
|
@@ -170,7 +170,7 @@ var Lt = I("ban", [["circle", {
|
|
|
170
170
|
d: "M13.3 16.3 15 18",
|
|
171
171
|
key: "2quom7"
|
|
172
172
|
}]
|
|
173
|
-
]),
|
|
173
|
+
]), Gt = I("list-checks", [
|
|
174
174
|
["path", {
|
|
175
175
|
d: "M13 5h8",
|
|
176
176
|
key: "a7qcls"
|
|
@@ -191,7 +191,7 @@ var Lt = I("ban", [["circle", {
|
|
|
191
191
|
d: "m3 7 2 2 4-4",
|
|
192
192
|
key: "1obspn"
|
|
193
193
|
}]
|
|
194
|
-
]),
|
|
194
|
+
]), Kt = I("notebook", [
|
|
195
195
|
["path", {
|
|
196
196
|
d: "M2 6h4",
|
|
197
197
|
key: "aawbzj"
|
|
@@ -220,16 +220,16 @@ var Lt = I("ban", [["circle", {
|
|
|
220
220
|
d: "M16 2v20",
|
|
221
221
|
key: "rotuqe"
|
|
222
222
|
}]
|
|
223
|
-
]),
|
|
223
|
+
]), qt = I("paperclip", [["path", {
|
|
224
224
|
d: "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",
|
|
225
225
|
key: "1miecu"
|
|
226
|
-
}]]),
|
|
226
|
+
}]]), Jt = I("rotate-cw", [["path", {
|
|
227
227
|
d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",
|
|
228
228
|
key: "1p45f6"
|
|
229
229
|
}], ["path", {
|
|
230
230
|
d: "M21 3v5h-5",
|
|
231
231
|
key: "1q7to0"
|
|
232
|
-
}]]),
|
|
232
|
+
}]]), Yt = I("scan-search", [
|
|
233
233
|
["path", {
|
|
234
234
|
d: "M3 7V5a2 2 0 0 1 2-2h2",
|
|
235
235
|
key: "aa7l1z"
|
|
@@ -256,13 +256,13 @@ var Lt = I("ban", [["circle", {
|
|
|
256
256
|
d: "m16 16-1.9-1.9",
|
|
257
257
|
key: "1dq9hf"
|
|
258
258
|
}]
|
|
259
|
-
]),
|
|
259
|
+
]), Xt = I("send-horizontal", [["path", {
|
|
260
260
|
d: "M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",
|
|
261
261
|
key: "117uat"
|
|
262
262
|
}], ["path", {
|
|
263
263
|
d: "M6 12h16",
|
|
264
264
|
key: "s4cdu5"
|
|
265
|
-
}]]),
|
|
265
|
+
}]]), Zt = I("settings", [["path", {
|
|
266
266
|
d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",
|
|
267
267
|
key: "1i5ecw"
|
|
268
268
|
}], ["circle", {
|
|
@@ -270,7 +270,7 @@ var Lt = I("ban", [["circle", {
|
|
|
270
270
|
cy: "12",
|
|
271
271
|
r: "3",
|
|
272
272
|
key: "1v7zrd"
|
|
273
|
-
}]]),
|
|
273
|
+
}]]), Qt = I("shield-question-mark", [
|
|
274
274
|
["path", {
|
|
275
275
|
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
|
|
276
276
|
key: "oel41y"
|
|
@@ -283,65 +283,65 @@ var Lt = I("ban", [["circle", {
|
|
|
283
283
|
d: "M12 17h.01",
|
|
284
284
|
key: "p32p05"
|
|
285
285
|
}]
|
|
286
|
-
]), L = s(),
|
|
286
|
+
]), L = s(), $t = "vercel.ai.error", en = Symbol.for($t), R = class e extends Error {
|
|
287
287
|
constructor({ name: e, message: t, cause: n }) {
|
|
288
|
-
super(t), this[
|
|
288
|
+
super(t), this[en] = !0, this.name = e, this.cause = n;
|
|
289
289
|
}
|
|
290
290
|
static isInstance(t) {
|
|
291
|
-
return e.hasMarker(t,
|
|
291
|
+
return e.hasMarker(t, $t);
|
|
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
|
+
}, tn = "AI_APICallError", nn = `vercel.ai.error.${tn}`, rn = Symbol.for(nn), an = class extends R {
|
|
298
298
|
constructor({ message: e, url: t, requestBodyValues: n, statusCode: r, responseHeaders: i, responseBody: a, cause: o, isRetryable: s = r != null && (r === 408 || r === 409 || r === 429 || r >= 500), data: c }) {
|
|
299
299
|
super({
|
|
300
|
-
name:
|
|
300
|
+
name: tn,
|
|
301
301
|
message: e,
|
|
302
302
|
cause: o
|
|
303
|
-
}), this[
|
|
303
|
+
}), this[rn] = !0, this.url = t, this.requestBodyValues = n, this.statusCode = r, this.responseHeaders = i, this.responseBody = a, this.isRetryable = s, this.data = c;
|
|
304
304
|
}
|
|
305
305
|
static isInstance(e) {
|
|
306
|
-
return R.hasMarker(e,
|
|
306
|
+
return R.hasMarker(e, nn);
|
|
307
307
|
}
|
|
308
|
-
},
|
|
308
|
+
}, on = "AI_EmptyResponseBodyError", sn = `vercel.ai.error.${on}`, cn = Symbol.for(sn), ln = class extends R {
|
|
309
309
|
constructor({ message: e = "Empty response body" } = {}) {
|
|
310
310
|
super({
|
|
311
|
-
name:
|
|
311
|
+
name: on,
|
|
312
312
|
message: e
|
|
313
|
-
}), this[
|
|
313
|
+
}), this[cn] = !0;
|
|
314
314
|
}
|
|
315
315
|
static isInstance(e) {
|
|
316
|
-
return R.hasMarker(e,
|
|
316
|
+
return R.hasMarker(e, sn);
|
|
317
317
|
}
|
|
318
318
|
};
|
|
319
|
-
function
|
|
319
|
+
function un(e) {
|
|
320
320
|
return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
|
|
321
321
|
}
|
|
322
|
-
var
|
|
322
|
+
var dn = "AI_InvalidArgumentError", fn = `vercel.ai.error.${dn}`, pn = Symbol.for(fn), mn = class extends R {
|
|
323
323
|
constructor({ message: e, cause: t, argument: n }) {
|
|
324
324
|
super({
|
|
325
|
-
name:
|
|
325
|
+
name: dn,
|
|
326
326
|
message: e,
|
|
327
327
|
cause: t
|
|
328
|
-
}), this[
|
|
328
|
+
}), this[pn] = !0, this.argument = n;
|
|
329
329
|
}
|
|
330
330
|
static isInstance(e) {
|
|
331
|
-
return R.hasMarker(e,
|
|
331
|
+
return R.hasMarker(e, fn);
|
|
332
332
|
}
|
|
333
|
-
},
|
|
333
|
+
}, hn = "AI_JSONParseError", gn = `vercel.ai.error.${hn}`, _n = Symbol.for(gn), vn = class extends R {
|
|
334
334
|
constructor({ text: e, cause: t }) {
|
|
335
335
|
super({
|
|
336
|
-
name:
|
|
337
|
-
message: `JSON parsing failed: Text: ${e}.\nError message: ${
|
|
336
|
+
name: hn,
|
|
337
|
+
message: `JSON parsing failed: Text: ${e}.\nError message: ${un(t)}`,
|
|
338
338
|
cause: t
|
|
339
|
-
}), this[
|
|
339
|
+
}), this[_n] = !0, this.text = e;
|
|
340
340
|
}
|
|
341
341
|
static isInstance(e) {
|
|
342
|
-
return R.hasMarker(e,
|
|
342
|
+
return R.hasMarker(e, gn);
|
|
343
343
|
}
|
|
344
|
-
},
|
|
344
|
+
}, yn = "AI_TypeValidationError", bn = `vercel.ai.error.${yn}`, xn = Symbol.for(bn), Sn = class e extends R {
|
|
345
345
|
constructor({ value: e, cause: t, context: n }) {
|
|
346
346
|
let r = "Type validation failed";
|
|
347
347
|
if (n?.field && (r += ` for ${n.field}`), n?.entityName || n?.entityId) {
|
|
@@ -350,13 +350,13 @@ var un = "AI_InvalidArgumentError", dn = `vercel.ai.error.${un}`, fn = 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: yn,
|
|
354
|
+
message: `${r}: Value: ${JSON.stringify(e)}.\nError message: ${un(t)}`,
|
|
355
355
|
cause: t
|
|
356
|
-
}), this[
|
|
356
|
+
}), this[xn] = !0, this.value = e, this.context = n;
|
|
357
357
|
}
|
|
358
358
|
static isInstance(e) {
|
|
359
|
-
return R.hasMarker(e,
|
|
359
|
+
return R.hasMarker(e, bn);
|
|
360
360
|
}
|
|
361
361
|
static wrap({ value: t, cause: n, context: r }) {
|
|
362
362
|
return e.isInstance(n) && n.value === t && n.context?.field === r?.field && n.context?.entityName === r?.entityName && n.context?.entityId === r?.entityId ? n : new e({
|
|
@@ -365,25 +365,25 @@ var un = "AI_InvalidArgumentError", dn = `vercel.ai.error.${un}`, fn = Symbol.fo
|
|
|
365
365
|
context: r
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
|
-
},
|
|
368
|
+
}, Cn = "AI_UnsupportedFunctionalityError", wn = `vercel.ai.error.${Cn}`, Tn = Symbol.for(wn), En = class extends R {
|
|
369
369
|
constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
|
|
370
370
|
super({
|
|
371
|
-
name:
|
|
371
|
+
name: Cn,
|
|
372
372
|
message: t
|
|
373
|
-
}), this[
|
|
373
|
+
}), this[Tn] = !0, this.functionality = e;
|
|
374
374
|
}
|
|
375
375
|
static isInstance(e) {
|
|
376
|
-
return R.hasMarker(e,
|
|
376
|
+
return R.hasMarker(e, wn);
|
|
377
377
|
}
|
|
378
|
-
},
|
|
378
|
+
}, Dn = class extends Error {
|
|
379
379
|
constructor(e, t) {
|
|
380
380
|
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
381
381
|
}
|
|
382
|
-
},
|
|
383
|
-
function
|
|
384
|
-
function
|
|
382
|
+
}, On = 10, kn = 13, An = 32;
|
|
383
|
+
function jn(e) {}
|
|
384
|
+
function Mn(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 = jn, onError: n = jn, onRetry: r = jn, 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 Dn(`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 (Nn(e, n, i)) {
|
|
422
|
+
let i = e.charCodeAt(n + 5) === An ? n + 6 : n + 5, a = e.slice(i, r);
|
|
423
|
+
if (d === 0 && e.charCodeAt(r + 1) === On) {
|
|
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 Pn(e, n, i) ? f = e.slice(e.charCodeAt(n + 6) === An ? 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) === kn && e.charCodeAt(n) === On && 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 (Nn(e, t, r)) {
|
|
452
|
+
let r = e.charCodeAt(t + 5) === An ? 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 (Pn(e, t, r)) {
|
|
458
|
+
f = e.slice(e.charCodeAt(t + 6) === An ? 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) === An ? 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) === An ? 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) === An ? 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 Dn(`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 Dn(`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 Nn(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 Pn(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 Fn = 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 = Mn({
|
|
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: In, atob: Ln } = globalThis;
|
|
560
|
+
function Rn(e) {
|
|
561
561
|
if (e == null) return {};
|
|
562
562
|
let t = {};
|
|
563
563
|
if (e instanceof Headers) e.forEach((e, n) => {
|
|
@@ -576,21 +576,21 @@ var z = ({ prefix: e, size: t = 16, alphabet: n = "0123456789ABCDEFGHIJKLMNOPQRS
|
|
|
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 mn({
|
|
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
|
+
}, zn = z();
|
|
585
|
+
function Bn(e) {
|
|
586
586
|
return globalThis.Buffer?.isBuffer(e) ?? !1;
|
|
587
587
|
}
|
|
588
|
-
var
|
|
589
|
-
function
|
|
588
|
+
var Vn = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, Hn = /"(?: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 Un(e) {
|
|
590
590
|
let t = JSON.parse(e);
|
|
591
|
-
return typeof t != "object" || !t ||
|
|
591
|
+
return typeof t != "object" || !t || Vn.test(e) === !1 && Hn.test(e) === !1 ? t : Wn(t);
|
|
592
592
|
}
|
|
593
|
-
function
|
|
593
|
+
function Wn(e) {
|
|
594
594
|
let t = [e];
|
|
595
595
|
for (; t.length;) {
|
|
596
596
|
let e = t;
|
|
@@ -605,20 +605,20 @@ function Un(e) {
|
|
|
605
605
|
}
|
|
606
606
|
return e;
|
|
607
607
|
}
|
|
608
|
-
function
|
|
608
|
+
function Gn(e) {
|
|
609
609
|
let { stackTraceLimit: t } = Error;
|
|
610
610
|
try {
|
|
611
611
|
Error.stackTraceLimit = 0;
|
|
612
612
|
} catch {
|
|
613
|
-
return
|
|
613
|
+
return Un(e);
|
|
614
614
|
}
|
|
615
615
|
try {
|
|
616
|
-
return
|
|
616
|
+
return Un(e);
|
|
617
617
|
} finally {
|
|
618
618
|
Error.stackTraceLimit = t;
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
|
-
function
|
|
621
|
+
function Kn(e) {
|
|
622
622
|
if (e.type === "object" || Array.isArray(e.type) && e.type.includes("object")) {
|
|
623
623
|
let { additionalProperties: t } = e;
|
|
624
624
|
e.additionalProperties = t != null && typeof t != "boolean" && B(t);
|
|
@@ -631,9 +631,9 @@ function Gn(e) {
|
|
|
631
631
|
return e;
|
|
632
632
|
}
|
|
633
633
|
function B(e) {
|
|
634
|
-
return typeof e == "boolean" ? e :
|
|
634
|
+
return typeof e == "boolean" ? e : Kn(e);
|
|
635
635
|
}
|
|
636
|
-
var
|
|
636
|
+
var qn = Symbol("Let zodToJsonSchema decide on which parser to use"), Jn = {
|
|
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
|
+
}, Yn = (e) => typeof e == "string" ? {
|
|
657
|
+
...Jn,
|
|
658
658
|
name: e
|
|
659
659
|
} : {
|
|
660
|
-
...
|
|
660
|
+
...Jn,
|
|
661
661
|
...e
|
|
662
662
|
};
|
|
663
663
|
function V() {
|
|
664
664
|
return {};
|
|
665
665
|
}
|
|
666
|
-
function
|
|
666
|
+
function Xn(e, t) {
|
|
667
667
|
let n = { type: "array" };
|
|
668
668
|
return e.type?._def && e.type?._def?.typeName !== "ZodAny" && (n.items = G(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 Zn(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 Qn() {
|
|
691
691
|
return { type: "boolean" };
|
|
692
692
|
}
|
|
693
|
-
function
|
|
693
|
+
function $n(e, t) {
|
|
694
694
|
return G(e.type._def, t);
|
|
695
695
|
}
|
|
696
|
-
var
|
|
697
|
-
function
|
|
696
|
+
var er = (e, t) => G(e.innerType._def, t);
|
|
697
|
+
function tr(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) => tr(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 nr(e);
|
|
711
711
|
}
|
|
712
712
|
}
|
|
713
|
-
var
|
|
713
|
+
var nr = (e) => {
|
|
714
714
|
let t = {
|
|
715
715
|
type: "integer",
|
|
716
716
|
format: "unix-time"
|
|
@@ -723,23 +723,23 @@ var tr = (e) => {
|
|
|
723
723
|
}
|
|
724
724
|
return t;
|
|
725
725
|
};
|
|
726
|
-
function
|
|
726
|
+
function rr(e, t) {
|
|
727
727
|
return {
|
|
728
728
|
...G(e.innerType._def, t),
|
|
729
729
|
default: e.defaultValue()
|
|
730
730
|
};
|
|
731
731
|
}
|
|
732
|
-
function
|
|
732
|
+
function ir(e, t) {
|
|
733
733
|
return t.effectStrategy === "input" ? G(e.schema._def, t) : V();
|
|
734
734
|
}
|
|
735
|
-
function
|
|
735
|
+
function ar(e) {
|
|
736
736
|
return {
|
|
737
737
|
type: "string",
|
|
738
738
|
enum: Array.from(e.values)
|
|
739
739
|
};
|
|
740
740
|
}
|
|
741
|
-
var
|
|
742
|
-
function
|
|
741
|
+
var or = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
|
|
742
|
+
function sr(e, t) {
|
|
743
743
|
let n = [G(e.left._def, {
|
|
744
744
|
...t,
|
|
745
745
|
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 (or(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 cr(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 lr = void 0, H = {
|
|
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: () => (lr === void 0 && (lr = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), lr),
|
|
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, H = {
|
|
|
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 ur(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":
|
|
@@ -826,10 +826,10 @@ function lr(e, t) {
|
|
|
826
826
|
W(n, H.cuid2, r.message, t);
|
|
827
827
|
break;
|
|
828
828
|
case "startsWith":
|
|
829
|
-
W(n, RegExp(`^${
|
|
829
|
+
W(n, RegExp(`^${dr(r.value, t)}`), r.message, t);
|
|
830
830
|
break;
|
|
831
831
|
case "endsWith":
|
|
832
|
-
W(n, RegExp(`${
|
|
832
|
+
W(n, RegExp(`${dr(r.value, t)}$`), r.message, t);
|
|
833
833
|
break;
|
|
834
834
|
case "datetime":
|
|
835
835
|
U(n, "date-time", r.message, t);
|
|
@@ -847,7 +847,7 @@ function lr(e, t) {
|
|
|
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
|
-
W(n, RegExp(
|
|
850
|
+
W(n, RegExp(dr(r.value, t)), r.message, t);
|
|
851
851
|
break;
|
|
852
852
|
case "ip":
|
|
853
853
|
r.version !== "v6" && U(n, "ipv4", r.message, t), r.version !== "v4" && U(n, "ipv6", r.message, t);
|
|
@@ -882,13 +882,13 @@ function lr(e, t) {
|
|
|
882
882
|
}
|
|
883
883
|
return n;
|
|
884
884
|
}
|
|
885
|
-
function
|
|
886
|
-
return t.patternStrategy === "escape" ?
|
|
885
|
+
function dr(e, t) {
|
|
886
|
+
return t.patternStrategy === "escape" ? pr(e) : e;
|
|
887
887
|
}
|
|
888
|
-
var
|
|
889
|
-
function
|
|
888
|
+
var fr = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
889
|
+
function pr(e) {
|
|
890
890
|
let t = "";
|
|
891
|
-
for (let n = 0; n < e.length; n++)
|
|
891
|
+
for (let n = 0; n < e.length; n++) fr.has(e[n]) || (t += "\\"), t += e[n];
|
|
892
892
|
return t;
|
|
893
893
|
}
|
|
894
894
|
function U(e, t, n, r) {
|
|
@@ -899,11 +899,11 @@ function U(e, t, n, r) {
|
|
|
899
899
|
}
|
|
900
900
|
function W(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: mr(t, r),
|
|
903
903
|
...n && r.errorMessages && { errorMessage: { pattern: n } }
|
|
904
|
-
})) : e.pattern =
|
|
904
|
+
})) : e.pattern = mr(t, r);
|
|
905
905
|
}
|
|
906
|
-
function
|
|
906
|
+
function mr(e, t) {
|
|
907
907
|
if (!t.applyRegexFlags || !e.flags) return e.source;
|
|
908
908
|
let n = {
|
|
909
909
|
i: e.flags.includes("i"),
|
|
@@ -942,7 +942,7 @@ function pr(e, t) {
|
|
|
942
942
|
}
|
|
943
943
|
return i;
|
|
944
944
|
}
|
|
945
|
-
function
|
|
945
|
+
function hr(e, t) {
|
|
946
946
|
let n = {
|
|
947
947
|
type: "object",
|
|
948
948
|
additionalProperties: G(e.valueType._def, {
|
|
@@ -951,7 +951,7 @@ function mr(e, t) {
|
|
|
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 } = ur(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 } = $n(e.keyType._def, t);
|
|
966
966
|
return {
|
|
967
967
|
...n,
|
|
968
968
|
propertyNames: i
|
|
@@ -970,8 +970,8 @@ function mr(e, t) {
|
|
|
970
970
|
}
|
|
971
971
|
return n;
|
|
972
972
|
}
|
|
973
|
-
function
|
|
974
|
-
return t.mapStrategy === "record" ?
|
|
973
|
+
function gr(e, t) {
|
|
974
|
+
return t.mapStrategy === "record" ? hr(e, t) : {
|
|
975
975
|
type: "array",
|
|
976
976
|
maxItems: 125,
|
|
977
977
|
items: {
|
|
@@ -998,31 +998,31 @@ function hr(e, t) {
|
|
|
998
998
|
}
|
|
999
999
|
};
|
|
1000
1000
|
}
|
|
1001
|
-
function
|
|
1001
|
+
function _r(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
|
|
1008
|
+
function vr() {
|
|
1009
1009
|
return { not: V() };
|
|
1010
1010
|
}
|
|
1011
|
-
function
|
|
1011
|
+
function yr() {
|
|
1012
1012
|
return { type: "null" };
|
|
1013
1013
|
}
|
|
1014
|
-
var
|
|
1014
|
+
var br = {
|
|
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 xr(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 br && (!e._def.checks || !e._def.checks.length))) {
|
|
1024
1024
|
let e = n.reduce((e, t) => {
|
|
1025
|
-
let n =
|
|
1025
|
+
let n = br[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,9 +1050,9 @@ 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 Sr(e, t);
|
|
1054
1054
|
}
|
|
1055
|
-
var
|
|
1055
|
+
var Sr = (e, t) => {
|
|
1056
1056
|
let n = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((e, n) => G(e._def, {
|
|
1057
1057
|
...t,
|
|
1058
1058
|
currentPath: [
|
|
@@ -1063,14 +1063,14 @@ 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 Cr(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: [
|
|
1073
|
+
].includes(e.innerType._def.typeName) && (!e.innerType._def.checks || !e.innerType._def.checks.length)) return { type: [br[e.innerType._def.typeName], "null"] };
|
|
1074
1074
|
let n = G(e.innerType._def, {
|
|
1075
1075
|
...t,
|
|
1076
1076
|
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 wr(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 Tr(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 = Dr(a), s = G(a._def, {
|
|
1110
1110
|
...t,
|
|
1111
1111
|
currentPath: [
|
|
1112
1112
|
...t.currentPath,
|
|
@@ -1122,10 +1122,10 @@ 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 = Er(e, t);
|
|
1126
1126
|
return a !== void 0 && (n.additionalProperties = a), n;
|
|
1127
1127
|
}
|
|
1128
|
-
function
|
|
1128
|
+
function Er(e, t) {
|
|
1129
1129
|
if (e.catchall._def.typeName !== "ZodNever") return G(e.catchall._def, {
|
|
1130
1130
|
...t,
|
|
1131
1131
|
currentPath: [...t.currentPath, "additionalProperties"]
|
|
@@ -1136,14 +1136,14 @@ function Tr(e, t) {
|
|
|
1136
1136
|
case "strip": return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
|
|
1137
1137
|
}
|
|
1138
1138
|
}
|
|
1139
|
-
function
|
|
1139
|
+
function Dr(e) {
|
|
1140
1140
|
try {
|
|
1141
1141
|
return e.isOptional();
|
|
1142
1142
|
} catch {
|
|
1143
1143
|
return !0;
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
|
-
var
|
|
1146
|
+
var Or = (e, t) => {
|
|
1147
1147
|
if (t.currentPath.toString() === t.propertyPath?.toString()) return G(e.innerType._def, t);
|
|
1148
1148
|
let n = G(e.innerType._def, {
|
|
1149
1149
|
...t,
|
|
@@ -1154,7 +1154,7 @@ var Dr = (e, t) => {
|
|
|
1154
1154
|
]
|
|
1155
1155
|
});
|
|
1156
1156
|
return n ? { anyOf: [{ not: V() }, n] } : V();
|
|
1157
|
-
},
|
|
1157
|
+
}, kr = (e, t) => {
|
|
1158
1158
|
if (t.pipeStrategy === "input") return G(e.in._def, t);
|
|
1159
1159
|
if (t.pipeStrategy === "output") return G(e.out._def, t);
|
|
1160
1160
|
let n = G(e.in._def, {
|
|
@@ -1174,10 +1174,10 @@ var Dr = (e, t) => {
|
|
|
1174
1174
|
]
|
|
1175
1175
|
})].filter((e) => e !== void 0) };
|
|
1176
1176
|
};
|
|
1177
|
-
function
|
|
1177
|
+
function Ar(e, t) {
|
|
1178
1178
|
return G(e.type._def, t);
|
|
1179
1179
|
}
|
|
1180
|
-
function
|
|
1180
|
+
function jr(e, t) {
|
|
1181
1181
|
let n = {
|
|
1182
1182
|
type: "array",
|
|
1183
1183
|
uniqueItems: !0,
|
|
@@ -1188,7 +1188,7 @@ function Ar(e, t) {
|
|
|
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 Mr(e, t) {
|
|
1192
1192
|
return e.rest ? {
|
|
1193
1193
|
type: "array",
|
|
1194
1194
|
minItems: e.items.length,
|
|
@@ -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
|
|
1221
|
+
function Nr() {
|
|
1222
1222
|
return { not: V() };
|
|
1223
1223
|
}
|
|
1224
|
-
function
|
|
1224
|
+
function Pr() {
|
|
1225
1225
|
return V();
|
|
1226
1226
|
}
|
|
1227
|
-
var
|
|
1227
|
+
var Fr = (e, t) => G(e.innerType._def, t), Ir = (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 ur(e, n);
|
|
1230
|
+
case "ZodNumber": return wr(e);
|
|
1231
|
+
case "ZodObject": return Tr(e, n);
|
|
1232
|
+
case "ZodBigInt": return Zn(e);
|
|
1233
|
+
case "ZodBoolean": return Qn();
|
|
1234
|
+
case "ZodDate": return tr(e, n);
|
|
1235
|
+
case "ZodUndefined": return Nr();
|
|
1236
|
+
case "ZodNull": return yr();
|
|
1237
|
+
case "ZodArray": return Xn(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 xr(e, n);
|
|
1240
|
+
case "ZodIntersection": return sr(e, n);
|
|
1241
|
+
case "ZodTuple": return Mr(e, n);
|
|
1242
|
+
case "ZodRecord": return hr(e, n);
|
|
1243
|
+
case "ZodLiteral": return cr(e);
|
|
1244
|
+
case "ZodEnum": return ar(e);
|
|
1245
|
+
case "ZodNativeEnum": return _r(e);
|
|
1246
|
+
case "ZodNullable": return Cr(e, n);
|
|
1247
|
+
case "ZodOptional": return Or(e, n);
|
|
1248
|
+
case "ZodMap": return gr(e, n);
|
|
1249
|
+
case "ZodSet": return jr(e, n);
|
|
1250
1250
|
case "ZodLazy": return () => e.getter()._def;
|
|
1251
|
-
case "ZodPromise": return
|
|
1251
|
+
case "ZodPromise": return Ar(e, n);
|
|
1252
1252
|
case "ZodNaN":
|
|
1253
|
-
case "ZodNever": return
|
|
1254
|
-
case "ZodEffects": return
|
|
1253
|
+
case "ZodNever": return vr();
|
|
1254
|
+
case "ZodEffects": return ir(e, n);
|
|
1255
1255
|
case "ZodAny": return V();
|
|
1256
|
-
case "ZodUnknown": return
|
|
1257
|
-
case "ZodDefault": return
|
|
1258
|
-
case "ZodBranded": return
|
|
1259
|
-
case "ZodReadonly": return
|
|
1260
|
-
case "ZodCatch": return
|
|
1261
|
-
case "ZodPipeline": return
|
|
1256
|
+
case "ZodUnknown": return Pr();
|
|
1257
|
+
case "ZodDefault": return rr(e, n);
|
|
1258
|
+
case "ZodBranded": return $n(e, n);
|
|
1259
|
+
case "ZodReadonly": return Fr(e, n);
|
|
1260
|
+
case "ZodCatch": return er(e, n);
|
|
1261
|
+
case "ZodPipeline": return kr(e, n);
|
|
1262
1262
|
case "ZodFunction":
|
|
1263
1263
|
case "ZodVoid":
|
|
1264
1264
|
case "ZodSymbol": return;
|
|
@@ -1266,7 +1266,7 @@ var Pr = (e, t) => G(e.innerType._def, t), Fr = (e, t, n) => {
|
|
|
1266
1266
|
/* c8 ignore next */
|
|
1267
1267
|
return ((e) => void 0)(t);
|
|
1268
1268
|
}
|
|
1269
|
-
},
|
|
1269
|
+
}, Lr = (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("/");
|
|
@@ -1275,10 +1275,10 @@ function G(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 !== qn) return i;
|
|
1279
1279
|
}
|
|
1280
1280
|
if (r && !n) {
|
|
1281
|
-
let e =
|
|
1281
|
+
let e = Rr(r, t);
|
|
1282
1282
|
if (e !== void 0) return e;
|
|
1283
1283
|
}
|
|
1284
1284
|
let i = {
|
|
@@ -1287,22 +1287,22 @@ function G(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 = Ir(e, e.typeName, t), o = typeof a == "function" ? G(a(), t) : a;
|
|
1291
|
+
if (o && zr(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 Rr = (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: Lr(t.currentPath, e.path) };
|
|
1301
1301
|
case "none":
|
|
1302
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`), V()) : t.$refStrategy === "seen" ? V() : void 0;
|
|
1303
1303
|
}
|
|
1304
|
-
},
|
|
1305
|
-
let t =
|
|
1304
|
+
}, zr = (e, t, n) => (e.description && (n.description = e.description), n), Br = (e) => {
|
|
1305
|
+
let t = Yn(e), n = t.name === void 0 ? t.basePath : [
|
|
1306
1306
|
...t.basePath,
|
|
1307
1307
|
t.definitionPath,
|
|
1308
1308
|
t.name
|
|
@@ -1321,8 +1321,8 @@ var Lr = (e, t) => {
|
|
|
1321
1321
|
jsonSchema: void 0
|
|
1322
1322
|
}]))
|
|
1323
1323
|
};
|
|
1324
|
-
},
|
|
1325
|
-
let n =
|
|
1324
|
+
}, Vr = (e, t) => {
|
|
1325
|
+
let n = Br(t), r = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((e, [t, r]) => ({
|
|
1326
1326
|
...e,
|
|
1327
1327
|
[t]: G(r._def, {
|
|
1328
1328
|
...n,
|
|
@@ -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
|
+
}, Hr = Symbol.for("vercel.ai.schema");
|
|
1360
|
+
function Ur(e) {
|
|
1361
1361
|
let t;
|
|
1362
1362
|
return () => (t ??= e(), t);
|
|
1363
1363
|
}
|
|
1364
|
-
function
|
|
1364
|
+
function Wr(e, { validate: t } = {}) {
|
|
1365
1365
|
return {
|
|
1366
|
-
[
|
|
1366
|
+
[Hr]: !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 Wr(e) {
|
|
1375
|
-
return typeof e == "object" && !!e && Vr in e && e[Vr] === !0 && "jsonSchema" in e && "validate" in e;
|
|
1376
|
-
}
|
|
1377
1374
|
function Gr(e) {
|
|
1378
|
-
return e ==
|
|
1375
|
+
return typeof e == "object" && !!e && Hr in e && e[Hr] === !0 && "jsonSchema" in e && "validate" in e;
|
|
1376
|
+
}
|
|
1377
|
+
function Kr(e) {
|
|
1378
|
+
return e == null ? Wr({
|
|
1379
1379
|
type: "object",
|
|
1380
1380
|
properties: {},
|
|
1381
1381
|
additionalProperties: !1
|
|
1382
|
-
}) :
|
|
1382
|
+
}) : Gr(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? Qr(e) : qr(e) : e();
|
|
1383
1383
|
}
|
|
1384
|
-
function
|
|
1385
|
-
return
|
|
1386
|
-
if (!
|
|
1387
|
-
return
|
|
1384
|
+
function qr(e) {
|
|
1385
|
+
return Wr(() => {
|
|
1386
|
+
if (!Jr(e)) throw Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
|
|
1387
|
+
return Kn(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 Sn({
|
|
1396
1396
|
value: t,
|
|
1397
1397
|
cause: n.issues
|
|
1398
1398
|
})
|
|
1399
1399
|
};
|
|
1400
1400
|
} });
|
|
1401
1401
|
}
|
|
1402
|
-
function
|
|
1402
|
+
function Jr(e) {
|
|
1403
1403
|
return e["~standard"].jsonSchema != null;
|
|
1404
1404
|
}
|
|
1405
|
-
function
|
|
1405
|
+
function Yr(e, t) {
|
|
1406
1406
|
let n = t?.useReferences ?? !1;
|
|
1407
|
-
return
|
|
1407
|
+
return Wr(() => Vr(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 Xr(e, t) {
|
|
1419
1419
|
let n = t?.useReferences ?? !1;
|
|
1420
|
-
return
|
|
1420
|
+
return Wr(() => Kn(st(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 lt(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 Zr(e) {
|
|
1436
1436
|
return "_zod" in e;
|
|
1437
1437
|
}
|
|
1438
|
-
function
|
|
1439
|
-
return
|
|
1438
|
+
function Qr(e, t) {
|
|
1439
|
+
return Zr(e) ? Xr(e, t) : Yr(e, t);
|
|
1440
1440
|
}
|
|
1441
|
-
async function
|
|
1442
|
-
let r = await
|
|
1441
|
+
async function $r({ value: e, schema: t, context: n }) {
|
|
1442
|
+
let r = await ei({
|
|
1443
1443
|
value: e,
|
|
1444
1444
|
schema: t,
|
|
1445
1445
|
context: n
|
|
1446
1446
|
});
|
|
1447
|
-
if (!r.success) throw
|
|
1447
|
+
if (!r.success) throw Sn.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 ei({ value: e, schema: t, context: n }) {
|
|
1455
|
+
let r = Kr(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: Sn.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: Sn.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 ti({ text: e, schema: t }) {
|
|
1489
1489
|
try {
|
|
1490
|
-
let n =
|
|
1490
|
+
let n = Gn(e);
|
|
1491
1491
|
return t == null ? {
|
|
1492
1492
|
success: !0,
|
|
1493
1493
|
value: n,
|
|
1494
1494
|
rawValue: n
|
|
1495
|
-
} : await
|
|
1495
|
+
} : await ei({
|
|
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: vn.isInstance(t) ? t : new vn({
|
|
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 ni({ stream: e, schema: t }) {
|
|
1511
|
+
return e.pipeThrough(new TextDecoderStream()).pipeThrough(new Fn()).pipeThrough(new TransformStream({ async transform({ data: e }, n) {
|
|
1512
|
+
e !== "[DONE]" && n.enqueue(await ti({
|
|
1513
1513
|
text: e,
|
|
1514
1514
|
schema: t
|
|
1515
1515
|
}));
|
|
1516
1516
|
} }));
|
|
1517
1517
|
}
|
|
1518
|
-
async function
|
|
1518
|
+
async function ri(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 ii = "AI_InvalidArgumentError", ai = `vercel.ai.error.${ii}`, oi = Symbol.for(ai), si = class extends R {
|
|
1525
1525
|
constructor({ parameter: e, value: t, message: n }) {
|
|
1526
1526
|
super({
|
|
1527
|
-
name:
|
|
1527
|
+
name: ii,
|
|
1528
1528
|
message: `Invalid argument for parameter ${e}: ${n}`
|
|
1529
|
-
}), this[
|
|
1529
|
+
}), this[oi] = !0, this.parameter = e, this.value = t;
|
|
1530
1530
|
}
|
|
1531
1531
|
static isInstance(e) {
|
|
1532
|
-
return R.hasMarker(e,
|
|
1532
|
+
return R.hasMarker(e, ai);
|
|
1533
1533
|
}
|
|
1534
|
-
},
|
|
1534
|
+
}, ci = "AI_UIMessageStreamError", li = `vercel.ai.error.${ci}`, ui = Symbol.for(li), K = class extends R {
|
|
1535
1535
|
constructor({ chunkType: e, chunkId: t, message: n }) {
|
|
1536
1536
|
super({
|
|
1537
|
-
name:
|
|
1537
|
+
name: ci,
|
|
1538
1538
|
message: n
|
|
1539
|
-
}), this[
|
|
1539
|
+
}), this[ui] = !0, this.chunkType = e, this.chunkId = t;
|
|
1540
1540
|
}
|
|
1541
1541
|
static isInstance(e) {
|
|
1542
|
-
return R.hasMarker(e,
|
|
1542
|
+
return R.hasMarker(e, li);
|
|
1543
1543
|
}
|
|
1544
1544
|
};
|
|
1545
|
-
function
|
|
1545
|
+
function di(e, t) {
|
|
1546
1546
|
if (e === void 0 && t === void 0) return;
|
|
1547
1547
|
if (e === void 0) return t;
|
|
1548
1548
|
if (t === void 0) return e;
|
|
@@ -1551,57 +1551,57 @@ function ui(e, t) {
|
|
|
1551
1551
|
let i = t[r];
|
|
1552
1552
|
if (i === void 0) continue;
|
|
1553
1553
|
let a = r in e ? e[r] : void 0, o = typeof i == "object" && !!i && !Array.isArray(i) && !(i instanceof Date) && !(i instanceof RegExp), s = typeof a == "object" && !!a && !Array.isArray(a) && !(a instanceof Date) && !(a instanceof RegExp);
|
|
1554
|
-
n[r] = o && s ?
|
|
1554
|
+
n[r] = o && s ? di(a, i) : i;
|
|
1555
1555
|
}
|
|
1556
1556
|
return n;
|
|
1557
1557
|
}
|
|
1558
1558
|
var q = {
|
|
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
|
-
},
|
|
1559
|
+
array: et,
|
|
1560
|
+
boolean: qe,
|
|
1561
|
+
custom: Xe,
|
|
1562
|
+
discriminatedUnion: dt,
|
|
1563
|
+
enum: Ke,
|
|
1564
|
+
instanceof: $e,
|
|
1565
|
+
lazy: nt,
|
|
1566
|
+
literal: tt,
|
|
1567
|
+
looseObject: rt,
|
|
1568
|
+
never: Ge,
|
|
1569
|
+
null: Je,
|
|
1570
|
+
number: ct,
|
|
1571
|
+
object: mt,
|
|
1572
|
+
record: ft,
|
|
1573
|
+
string: it,
|
|
1574
|
+
union: pt,
|
|
1575
|
+
unknown: at
|
|
1576
|
+
}, fi = q.lazy(() => q.union([
|
|
1577
1577
|
q.null(),
|
|
1578
1578
|
q.string(),
|
|
1579
1579
|
q.number(),
|
|
1580
1580
|
q.boolean(),
|
|
1581
|
-
q.record(q.string(),
|
|
1582
|
-
q.array(
|
|
1583
|
-
])), J = q.record(q.string(), q.record(q.string(),
|
|
1581
|
+
q.record(q.string(), fi.optional()),
|
|
1582
|
+
q.array(fi)
|
|
1583
|
+
])), J = q.record(q.string(), q.record(q.string(), fi.optional())), pi = q.union([
|
|
1584
1584
|
q.string(),
|
|
1585
1585
|
q.instanceof(Uint8Array),
|
|
1586
1586
|
q.instanceof(ArrayBuffer),
|
|
1587
|
-
q.custom(
|
|
1588
|
-
]),
|
|
1587
|
+
q.custom(Bn, { message: "Must be a Buffer" })
|
|
1588
|
+
]), mi = q.record(q.string(), q.string()), hi = q.object({
|
|
1589
1589
|
type: q.literal("text"),
|
|
1590
1590
|
text: q.string(),
|
|
1591
1591
|
providerOptions: J.optional()
|
|
1592
|
-
}),
|
|
1592
|
+
}), gi = q.object({
|
|
1593
1593
|
type: q.literal("image"),
|
|
1594
1594
|
image: q.union([
|
|
1595
|
-
|
|
1595
|
+
pi,
|
|
1596
1596
|
q.instanceof(URL),
|
|
1597
|
-
|
|
1597
|
+
mi
|
|
1598
1598
|
]),
|
|
1599
1599
|
mediaType: q.string().optional(),
|
|
1600
1600
|
providerOptions: J.optional()
|
|
1601
|
-
}),
|
|
1601
|
+
}), _i = q.discriminatedUnion("type", [
|
|
1602
1602
|
q.object({
|
|
1603
1603
|
type: q.literal("data"),
|
|
1604
|
-
data:
|
|
1604
|
+
data: pi
|
|
1605
1605
|
}),
|
|
1606
1606
|
q.object({
|
|
1607
1607
|
type: q.literal("url"),
|
|
@@ -1609,54 +1609,54 @@ var q = {
|
|
|
1609
1609
|
}),
|
|
1610
1610
|
q.object({
|
|
1611
1611
|
type: q.literal("reference"),
|
|
1612
|
-
reference:
|
|
1612
|
+
reference: mi
|
|
1613
1613
|
}),
|
|
1614
1614
|
q.object({
|
|
1615
1615
|
type: q.literal("text"),
|
|
1616
1616
|
text: q.string()
|
|
1617
1617
|
})
|
|
1618
|
-
]),
|
|
1618
|
+
]), vi = q.discriminatedUnion("type", [q.object({
|
|
1619
1619
|
type: q.literal("data"),
|
|
1620
|
-
data:
|
|
1620
|
+
data: pi
|
|
1621
1621
|
}), q.object({
|
|
1622
1622
|
type: q.literal("url"),
|
|
1623
1623
|
url: q.instanceof(URL)
|
|
1624
|
-
})]),
|
|
1624
|
+
})]), yi = q.object({
|
|
1625
1625
|
type: q.literal("file"),
|
|
1626
1626
|
data: q.union([
|
|
1627
|
-
|
|
1628
|
-
|
|
1627
|
+
_i,
|
|
1628
|
+
pi,
|
|
1629
1629
|
q.instanceof(URL),
|
|
1630
|
-
|
|
1630
|
+
mi
|
|
1631
1631
|
]),
|
|
1632
1632
|
filename: q.string().optional(),
|
|
1633
1633
|
mediaType: q.string(),
|
|
1634
1634
|
providerOptions: J.optional()
|
|
1635
|
-
}),
|
|
1635
|
+
}), bi = q.object({
|
|
1636
1636
|
type: q.literal("reasoning"),
|
|
1637
1637
|
text: q.string(),
|
|
1638
1638
|
providerOptions: J.optional()
|
|
1639
|
-
}),
|
|
1639
|
+
}), xi = q.object({
|
|
1640
1640
|
type: q.literal("custom"),
|
|
1641
1641
|
kind: q.string().transform((e) => e),
|
|
1642
1642
|
providerOptions: J.optional()
|
|
1643
|
-
}),
|
|
1643
|
+
}), Si = q.object({
|
|
1644
1644
|
type: q.literal("reasoning-file"),
|
|
1645
1645
|
data: q.union([
|
|
1646
|
-
|
|
1647
|
-
|
|
1646
|
+
vi,
|
|
1647
|
+
pi,
|
|
1648
1648
|
q.instanceof(URL)
|
|
1649
1649
|
]),
|
|
1650
1650
|
mediaType: q.string(),
|
|
1651
1651
|
providerOptions: J.optional()
|
|
1652
|
-
}),
|
|
1652
|
+
}), Ci = q.object({
|
|
1653
1653
|
type: q.literal("tool-call"),
|
|
1654
1654
|
toolCallId: q.string(),
|
|
1655
1655
|
toolName: q.string(),
|
|
1656
1656
|
input: q.unknown(),
|
|
1657
1657
|
providerOptions: J.optional(),
|
|
1658
1658
|
providerExecuted: q.boolean().optional()
|
|
1659
|
-
}),
|
|
1659
|
+
}), wi = q.discriminatedUnion("type", [
|
|
1660
1660
|
q.object({
|
|
1661
1661
|
type: q.literal("text"),
|
|
1662
1662
|
value: q.string(),
|
|
@@ -1664,7 +1664,7 @@ var q = {
|
|
|
1664
1664
|
}),
|
|
1665
1665
|
q.object({
|
|
1666
1666
|
type: q.literal("json"),
|
|
1667
|
-
value:
|
|
1667
|
+
value: fi,
|
|
1668
1668
|
providerOptions: J.optional()
|
|
1669
1669
|
}),
|
|
1670
1670
|
q.object({
|
|
@@ -1679,7 +1679,7 @@ var q = {
|
|
|
1679
1679
|
}),
|
|
1680
1680
|
q.object({
|
|
1681
1681
|
type: q.literal("error-json"),
|
|
1682
|
-
value:
|
|
1682
|
+
value: fi,
|
|
1683
1683
|
providerOptions: J.optional()
|
|
1684
1684
|
}),
|
|
1685
1685
|
q.object({
|
|
@@ -1692,7 +1692,7 @@ var q = {
|
|
|
1692
1692
|
}),
|
|
1693
1693
|
q.object({
|
|
1694
1694
|
type: q.literal("file"),
|
|
1695
|
-
data:
|
|
1695
|
+
data: _i,
|
|
1696
1696
|
mediaType: q.string(),
|
|
1697
1697
|
filename: q.string().optional(),
|
|
1698
1698
|
providerOptions: J.optional()
|
|
@@ -1747,13 +1747,13 @@ var q = {
|
|
|
1747
1747
|
})
|
|
1748
1748
|
]))
|
|
1749
1749
|
})
|
|
1750
|
-
]),
|
|
1750
|
+
]), Ti = q.object({
|
|
1751
1751
|
type: q.literal("tool-result"),
|
|
1752
1752
|
toolCallId: q.string(),
|
|
1753
1753
|
toolName: q.string(),
|
|
1754
|
-
output:
|
|
1754
|
+
output: wi,
|
|
1755
1755
|
providerOptions: J.optional()
|
|
1756
|
-
}),
|
|
1756
|
+
}), Ei = q.object({
|
|
1757
1757
|
type: q.literal("tool-approval-request"),
|
|
1758
1758
|
approvalId: q.string(),
|
|
1759
1759
|
toolCallId: q.string(),
|
|
@@ -1761,48 +1761,48 @@ var q = {
|
|
|
1761
1761
|
isAutomatic: q.boolean().optional(),
|
|
1762
1762
|
signature: q.string().optional(),
|
|
1763
1763
|
inputSchemaInput: q.unknown().optional()
|
|
1764
|
-
}),
|
|
1764
|
+
}), Di = q.object({
|
|
1765
1765
|
type: q.literal("tool-approval-response"),
|
|
1766
1766
|
approvalId: q.string(),
|
|
1767
1767
|
approved: q.boolean(),
|
|
1768
1768
|
reason: q.string().optional()
|
|
1769
|
-
}),
|
|
1769
|
+
}), Oi = q.object({
|
|
1770
1770
|
role: q.literal("system"),
|
|
1771
1771
|
content: q.string(),
|
|
1772
1772
|
providerOptions: J.optional()
|
|
1773
|
-
}),
|
|
1773
|
+
}), ki = q.object({
|
|
1774
1774
|
role: q.literal("user"),
|
|
1775
1775
|
content: q.union([q.string(), q.array(q.union([
|
|
1776
|
-
mi,
|
|
1777
1776
|
hi,
|
|
1778
|
-
|
|
1777
|
+
gi,
|
|
1778
|
+
yi
|
|
1779
1779
|
]))]),
|
|
1780
1780
|
providerOptions: J.optional()
|
|
1781
|
-
}),
|
|
1781
|
+
}), Ai = q.object({
|
|
1782
1782
|
role: q.literal("assistant"),
|
|
1783
1783
|
content: q.union([q.string(), q.array(q.union([
|
|
1784
|
-
|
|
1785
|
-
bi,
|
|
1786
|
-
vi,
|
|
1787
|
-
yi,
|
|
1784
|
+
hi,
|
|
1788
1785
|
xi,
|
|
1786
|
+
yi,
|
|
1787
|
+
bi,
|
|
1789
1788
|
Si,
|
|
1790
|
-
|
|
1791
|
-
Ti
|
|
1789
|
+
Ci,
|
|
1790
|
+
Ti,
|
|
1791
|
+
Ei
|
|
1792
1792
|
]))]),
|
|
1793
1793
|
providerOptions: J.optional()
|
|
1794
|
-
}),
|
|
1794
|
+
}), ji = q.object({
|
|
1795
1795
|
role: q.literal("tool"),
|
|
1796
|
-
content: q.array(q.union([
|
|
1796
|
+
content: q.array(q.union([Ti, Di])),
|
|
1797
1797
|
providerOptions: J.optional()
|
|
1798
1798
|
});
|
|
1799
1799
|
q.union([
|
|
1800
|
-
Di,
|
|
1801
1800
|
Oi,
|
|
1802
1801
|
ki,
|
|
1803
|
-
Ai
|
|
1802
|
+
Ai,
|
|
1803
|
+
ji
|
|
1804
1804
|
]);
|
|
1805
|
-
function
|
|
1805
|
+
function Mi(e) {
|
|
1806
1806
|
let t = ["ROOT"], n = -1, r = null, i = 0;
|
|
1807
1807
|
function a(e) {
|
|
1808
1808
|
return e >= "0" && e <= "9" || e >= "A" && e <= "F" || e >= "a" && e <= "f";
|
|
@@ -1984,16 +1984,16 @@ function ji(e) {
|
|
|
1984
1984
|
}
|
|
1985
1985
|
return l;
|
|
1986
1986
|
}
|
|
1987
|
-
async function
|
|
1987
|
+
async function Ni(e) {
|
|
1988
1988
|
if (e === void 0) return {
|
|
1989
1989
|
value: void 0,
|
|
1990
1990
|
state: "undefined-input"
|
|
1991
1991
|
};
|
|
1992
|
-
let t = await
|
|
1992
|
+
let t = await ti({ text: e });
|
|
1993
1993
|
return t.success ? {
|
|
1994
1994
|
value: t.value,
|
|
1995
1995
|
state: "successful-parse"
|
|
1996
|
-
} : (t = await
|
|
1996
|
+
} : (t = await ti({ text: Mi(e) }), t.success ? {
|
|
1997
1997
|
value: t.value,
|
|
1998
1998
|
state: "repaired-parse"
|
|
1999
1999
|
} : {
|
|
@@ -2008,25 +2008,25 @@ new TextEncoder(), new TextEncoder(), z({
|
|
|
2008
2008
|
prefix: "call",
|
|
2009
2009
|
size: 24
|
|
2010
2010
|
});
|
|
2011
|
-
function
|
|
2011
|
+
function Pi(e, t) {
|
|
2012
2012
|
let n = new Headers(e ?? {});
|
|
2013
2013
|
for (let [e, r] of Object.entries(t)) n.has(e) || n.set(e, r);
|
|
2014
2014
|
return n;
|
|
2015
2015
|
}
|
|
2016
|
-
var
|
|
2017
|
-
function
|
|
2016
|
+
var Fi = ": stream-open\n\n", Ii = ": keep-alive\n\n";
|
|
2017
|
+
function Li({ stream: e, keepAliveMs: t }) {
|
|
2018
2018
|
if (t == null) return e;
|
|
2019
2019
|
if (!Number.isFinite(t) || t <= 0 || t > 2147483647) throw Error("keepAliveMs must be a positive finite timer duration no greater than 2147483647");
|
|
2020
2020
|
let n = e.getReader(), r, i = !1, a = () => {
|
|
2021
2021
|
clearTimeout(r), r = void 0;
|
|
2022
2022
|
}, o = (e) => {
|
|
2023
2023
|
a(), r = setTimeout(() => {
|
|
2024
|
-
i || (e.desiredSize != null && e.desiredSize > 0 && e.enqueue(
|
|
2024
|
+
i || (e.desiredSize != null && e.desiredSize > 0 && e.enqueue(Ii), o(e));
|
|
2025
2025
|
}, t);
|
|
2026
2026
|
};
|
|
2027
2027
|
return new ReadableStream({
|
|
2028
2028
|
start(e) {
|
|
2029
|
-
e.enqueue(
|
|
2029
|
+
e.enqueue(Fi), o(e);
|
|
2030
2030
|
},
|
|
2031
2031
|
pull(e) {
|
|
2032
2032
|
return n.read().then((t) => {
|
|
@@ -2040,7 +2040,7 @@ function Ii({ stream: e, keepAliveMs: t }) {
|
|
|
2040
2040
|
}
|
|
2041
2041
|
});
|
|
2042
2042
|
}
|
|
2043
|
-
var
|
|
2043
|
+
var Ri = class extends TransformStream {
|
|
2044
2044
|
constructor() {
|
|
2045
2045
|
super({
|
|
2046
2046
|
transform(e, t) {
|
|
@@ -2051,16 +2051,16 @@ var Li = class extends TransformStream {
|
|
|
2051
2051
|
}
|
|
2052
2052
|
});
|
|
2053
2053
|
}
|
|
2054
|
-
},
|
|
2054
|
+
}, zi = {
|
|
2055
2055
|
"content-type": "text/event-stream",
|
|
2056
2056
|
"cache-control": "no-cache",
|
|
2057
2057
|
connection: "keep-alive",
|
|
2058
2058
|
"x-vercel-ai-ui-message-stream": "v1",
|
|
2059
2059
|
"x-accel-buffering": "no"
|
|
2060
2060
|
};
|
|
2061
|
-
function
|
|
2062
|
-
let o =
|
|
2063
|
-
stream: r.pipeThrough(new
|
|
2061
|
+
function Bi({ status: e, statusText: t, headers: n, stream: r, keepAliveMs: i, consumeSseStream: a }) {
|
|
2062
|
+
let o = Li({
|
|
2063
|
+
stream: r.pipeThrough(new Ri()),
|
|
2064
2064
|
keepAliveMs: i
|
|
2065
2065
|
});
|
|
2066
2066
|
if (a) {
|
|
@@ -2070,10 +2070,10 @@ function zi({ status: e, statusText: t, headers: n, stream: r, keepAliveMs: i, c
|
|
|
2070
2070
|
return new Response(o.pipeThrough(new TextEncoderStream()), {
|
|
2071
2071
|
status: e,
|
|
2072
2072
|
statusText: t,
|
|
2073
|
-
headers:
|
|
2073
|
+
headers: Pi(n, zi)
|
|
2074
2074
|
});
|
|
2075
2075
|
}
|
|
2076
|
-
var
|
|
2076
|
+
var Vi = q.object({
|
|
2077
2077
|
source: q.discriminatedUnion("sourceType", [q.object({
|
|
2078
2078
|
type: q.literal("source"),
|
|
2079
2079
|
sourceType: q.literal("url"),
|
|
@@ -2093,7 +2093,7 @@ var Bi = q.object({
|
|
|
2093
2093
|
startIndex: q.number().int().nonnegative().optional(),
|
|
2094
2094
|
endIndex: q.number().int().nonnegative().optional(),
|
|
2095
2095
|
citedText: q.string().optional()
|
|
2096
|
-
}),
|
|
2096
|
+
}), Hi = q.record(q.string(), fi.optional()), Ui = Ur(() => Qr(q.union([
|
|
2097
2097
|
q.looseObject({
|
|
2098
2098
|
type: q.literal("text-start"),
|
|
2099
2099
|
id: q.string(),
|
|
@@ -2108,7 +2108,7 @@ var Bi = q.object({
|
|
|
2108
2108
|
q.looseObject({
|
|
2109
2109
|
type: q.literal("text-end"),
|
|
2110
2110
|
id: q.string(),
|
|
2111
|
-
citations: q.array(
|
|
2111
|
+
citations: q.array(Vi).optional(),
|
|
2112
2112
|
providerMetadata: J.optional()
|
|
2113
2113
|
}),
|
|
2114
2114
|
q.looseObject({
|
|
@@ -2122,7 +2122,7 @@ var Bi = q.object({
|
|
|
2122
2122
|
inputEncoding: q.enum(["json", "text"]).optional(),
|
|
2123
2123
|
providerExecuted: q.boolean().optional(),
|
|
2124
2124
|
providerMetadata: J.optional(),
|
|
2125
|
-
toolMetadata:
|
|
2125
|
+
toolMetadata: Hi.optional(),
|
|
2126
2126
|
dynamic: q.boolean().optional(),
|
|
2127
2127
|
title: q.string().optional()
|
|
2128
2128
|
}),
|
|
@@ -2138,7 +2138,7 @@ var Bi = q.object({
|
|
|
2138
2138
|
input: q.unknown(),
|
|
2139
2139
|
providerExecuted: q.boolean().optional(),
|
|
2140
2140
|
providerMetadata: J.optional(),
|
|
2141
|
-
toolMetadata:
|
|
2141
|
+
toolMetadata: Hi.optional(),
|
|
2142
2142
|
dynamic: q.boolean().optional(),
|
|
2143
2143
|
title: q.string().optional()
|
|
2144
2144
|
}),
|
|
@@ -2149,7 +2149,7 @@ var Bi = q.object({
|
|
|
2149
2149
|
input: q.unknown(),
|
|
2150
2150
|
providerExecuted: q.boolean().optional(),
|
|
2151
2151
|
providerMetadata: J.optional(),
|
|
2152
|
-
toolMetadata:
|
|
2152
|
+
toolMetadata: Hi.optional(),
|
|
2153
2153
|
dynamic: q.boolean().optional(),
|
|
2154
2154
|
errorText: q.string(),
|
|
2155
2155
|
title: q.string().optional()
|
|
@@ -2178,7 +2178,7 @@ var Bi = q.object({
|
|
|
2178
2178
|
output: q.unknown(),
|
|
2179
2179
|
providerExecuted: q.boolean().optional(),
|
|
2180
2180
|
providerMetadata: J.optional(),
|
|
2181
|
-
toolMetadata:
|
|
2181
|
+
toolMetadata: Hi.optional(),
|
|
2182
2182
|
dynamic: q.boolean().optional(),
|
|
2183
2183
|
preliminary: q.boolean().optional()
|
|
2184
2184
|
}),
|
|
@@ -2188,7 +2188,7 @@ var Bi = q.object({
|
|
|
2188
2188
|
errorText: q.string(),
|
|
2189
2189
|
providerExecuted: q.boolean().optional(),
|
|
2190
2190
|
providerMetadata: J.optional(),
|
|
2191
|
-
toolMetadata:
|
|
2191
|
+
toolMetadata: Hi.optional(),
|
|
2192
2192
|
dynamic: q.boolean().optional()
|
|
2193
2193
|
}),
|
|
2194
2194
|
q.looseObject({
|
|
@@ -2278,39 +2278,39 @@ var Bi = q.object({
|
|
|
2278
2278
|
messageMetadata: q.unknown()
|
|
2279
2279
|
})
|
|
2280
2280
|
])));
|
|
2281
|
-
function
|
|
2281
|
+
function Wi(e) {
|
|
2282
2282
|
return e.type.startsWith("data-");
|
|
2283
2283
|
}
|
|
2284
|
-
function
|
|
2284
|
+
function Gi() {
|
|
2285
2285
|
return Object.create(null);
|
|
2286
2286
|
}
|
|
2287
|
-
function
|
|
2287
|
+
function Ki(e) {
|
|
2288
2288
|
return e.type.startsWith("tool-");
|
|
2289
2289
|
}
|
|
2290
|
-
function
|
|
2290
|
+
function qi(e) {
|
|
2291
2291
|
return e.type === "dynamic-tool";
|
|
2292
2292
|
}
|
|
2293
2293
|
function Y(e) {
|
|
2294
|
-
return
|
|
2294
|
+
return Ki(e) || qi(e);
|
|
2295
2295
|
}
|
|
2296
|
-
function
|
|
2296
|
+
function Ji(e) {
|
|
2297
2297
|
return e.type.split("-").slice(1).join("-");
|
|
2298
2298
|
}
|
|
2299
|
-
function
|
|
2299
|
+
function Yi({ lastMessage: e, messageId: t }) {
|
|
2300
2300
|
let n = e?.role === "assistant" ? e : {
|
|
2301
2301
|
id: t,
|
|
2302
2302
|
metadata: void 0,
|
|
2303
2303
|
role: "assistant",
|
|
2304
2304
|
parts: []
|
|
2305
|
-
}, r =
|
|
2305
|
+
}, r = Gi(), i = n.parts.findLastIndex((e) => e.type === "step-start"), a = 0;
|
|
2306
2306
|
for (let e of n.parts.slice(i + 1)) {
|
|
2307
2307
|
if (!Y(e)) continue;
|
|
2308
2308
|
let t = a;
|
|
2309
|
-
|
|
2309
|
+
Ki(e) && a++, e.state === "input-streaming" && (r[e.toolCallId] = {
|
|
2310
2310
|
text: e.rawInput ?? "",
|
|
2311
2311
|
inputEncoding: e.inputEncoding,
|
|
2312
2312
|
index: t,
|
|
2313
|
-
toolName: e.type === "dynamic-tool" ? e.toolName :
|
|
2313
|
+
toolName: e.type === "dynamic-tool" ? e.toolName : Ji(e),
|
|
2314
2314
|
dynamic: e.type === "dynamic-tool",
|
|
2315
2315
|
title: e.title,
|
|
2316
2316
|
toolMetadata: e.toolMetadata
|
|
@@ -2318,12 +2318,12 @@ function Ji({ lastMessage: e, messageId: t }) {
|
|
|
2318
2318
|
}
|
|
2319
2319
|
return {
|
|
2320
2320
|
message: n,
|
|
2321
|
-
activeTextParts:
|
|
2322
|
-
activeReasoningParts:
|
|
2321
|
+
activeTextParts: Gi(),
|
|
2322
|
+
activeReasoningParts: Gi(),
|
|
2323
2323
|
partialToolCalls: r
|
|
2324
2324
|
};
|
|
2325
2325
|
}
|
|
2326
|
-
function
|
|
2326
|
+
function Xi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdateMessageJob: r, onError: i, onToolCall: a, onData: o, resetStateOnMessageIdChange: s = !1, resetStateOnFirstMessageStart: c = !1 }) {
|
|
2327
2327
|
let l = !0;
|
|
2328
2328
|
return e.pipeThrough(new TransformStream({ async transform(e, u) {
|
|
2329
2329
|
await r(async ({ state: r, write: d }) => {
|
|
@@ -2364,7 +2364,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2364
2364
|
return t;
|
|
2365
2365
|
}
|
|
2366
2366
|
function g(e, t) {
|
|
2367
|
-
let n = t ?? f().find((t) =>
|
|
2367
|
+
let n = t ?? f().find((t) => Ki(t) && t.toolCallId === e.toolCallId), i = e, a = n;
|
|
2368
2368
|
if (n != null) {
|
|
2369
2369
|
n.state = e.state, a.input = i.input, a.output = i.output, a.errorText = i.errorText, a.rawInput = i.rawInput, i.inputEncoding == null ? delete a.inputEncoding : a.inputEncoding = i.inputEncoding, a.preliminary = i.preliminary, e.title !== void 0 && (a.title = e.title), e.toolMetadata !== void 0 && (a.toolMetadata = e.toolMetadata), a.providerExecuted = i.providerExecuted ?? n.providerExecuted;
|
|
2370
2370
|
let t = i.providerMetadata;
|
|
@@ -2421,8 +2421,8 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2421
2421
|
}
|
|
2422
2422
|
async function v(e) {
|
|
2423
2423
|
if (e != null) {
|
|
2424
|
-
let n = r.message.metadata == null ? e :
|
|
2425
|
-
t != null && await
|
|
2424
|
+
let n = r.message.metadata == null ? e : di(r.message.metadata, e);
|
|
2425
|
+
t != null && await $r({
|
|
2426
2426
|
value: n,
|
|
2427
2427
|
schema: t,
|
|
2428
2428
|
context: {
|
|
@@ -2532,7 +2532,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2532
2532
|
}), d();
|
|
2533
2533
|
break;
|
|
2534
2534
|
case "tool-input-start": {
|
|
2535
|
-
let t = f().filter(
|
|
2535
|
+
let t = f().filter(Ki);
|
|
2536
2536
|
r.partialToolCalls[e.toolCallId] = {
|
|
2537
2537
|
text: "",
|
|
2538
2538
|
inputEncoding: e.inputEncoding,
|
|
@@ -2572,7 +2572,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2572
2572
|
message: `Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`
|
|
2573
2573
|
});
|
|
2574
2574
|
t.text += e.inputTextDelta;
|
|
2575
|
-
let n = t.inputEncoding === "text" ? t.text : (await
|
|
2575
|
+
let n = t.inputEncoding === "text" ? t.text : (await Ni(t.text)).value;
|
|
2576
2576
|
t.dynamic ? _({
|
|
2577
2577
|
toolCallId: e.toolCallId,
|
|
2578
2578
|
toolName: t.toolName,
|
|
@@ -2680,7 +2680,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2680
2680
|
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2681
2681
|
}, t) : g({
|
|
2682
2682
|
toolCallId: e.toolCallId,
|
|
2683
|
-
toolName:
|
|
2683
|
+
toolName: Ji(t),
|
|
2684
2684
|
state: "output-available",
|
|
2685
2685
|
input: t.input,
|
|
2686
2686
|
output: e.output,
|
|
@@ -2706,7 +2706,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2706
2706
|
toolMetadata: e.toolMetadata ?? t.toolMetadata
|
|
2707
2707
|
}, t) : g({
|
|
2708
2708
|
toolCallId: e.toolCallId,
|
|
2709
|
-
toolName:
|
|
2709
|
+
toolName: Ji(t),
|
|
2710
2710
|
state: "output-error",
|
|
2711
2711
|
input: t.input,
|
|
2712
2712
|
rawInput: t.rawInput,
|
|
@@ -2724,12 +2724,12 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2724
2724
|
case "finish-step": break;
|
|
2725
2725
|
case "reset-step": {
|
|
2726
2726
|
let e = f();
|
|
2727
|
-
r.activeTextParts =
|
|
2727
|
+
r.activeTextParts = Gi(), r.activeReasoningParts = Gi(), r.partialToolCalls = Gi(), e.length > 0 && (r.message.parts.splice(r.message.parts.length - e.length, e.length), d());
|
|
2728
2728
|
break;
|
|
2729
2729
|
}
|
|
2730
2730
|
case "start": {
|
|
2731
2731
|
let t = c && l || s && e.messageId != null && e.messageId !== r.message.id;
|
|
2732
|
-
l = !1, t && Object.assign(r,
|
|
2732
|
+
l = !1, t && Object.assign(r, Yi({
|
|
2733
2733
|
lastMessage: void 0,
|
|
2734
2734
|
messageId: e.messageId ?? r.message.id
|
|
2735
2735
|
}), { finishReason: void 0 }), e.messageId != null && (r.message.id = e.messageId), await v(e.messageMetadata), (t || e.messageId != null || e.messageMetadata != null) && d({ updateStatus: !1 });
|
|
@@ -2744,10 +2744,10 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2744
2744
|
case "error":
|
|
2745
2745
|
i?.(Error(e.errorText));
|
|
2746
2746
|
break;
|
|
2747
|
-
default: if (
|
|
2747
|
+
default: if (Wi(e)) {
|
|
2748
2748
|
if (n?.[e.type] != null) {
|
|
2749
2749
|
let t = r.message.parts.findIndex((t) => "id" in t && "data" in t && t.id === e.id && t.type === e.type), i = t >= 0 ? t : r.message.parts.length;
|
|
2750
|
-
await
|
|
2750
|
+
await $r({
|
|
2751
2751
|
value: e.data,
|
|
2752
2752
|
schema: n[e.type],
|
|
2753
2753
|
context: {
|
|
@@ -2770,7 +2770,7 @@ function Yi({ stream: e, messageMetadataSchema: t, dataPartSchemas: n, runUpdate
|
|
|
2770
2770
|
});
|
|
2771
2771
|
} }));
|
|
2772
2772
|
}
|
|
2773
|
-
async function
|
|
2773
|
+
async function Zi({ stream: e, onError: t, abortSignal: n }) {
|
|
2774
2774
|
let r = e.getReader(), i = () => {
|
|
2775
2775
|
r.cancel().catch(() => {});
|
|
2776
2776
|
};
|
|
@@ -2786,7 +2786,7 @@ async function Xi({ stream: e, onError: t, abortSignal: n }) {
|
|
|
2786
2786
|
n?.removeEventListener("abort", i), r.releaseLock();
|
|
2787
2787
|
}
|
|
2788
2788
|
}
|
|
2789
|
-
function
|
|
2789
|
+
function Qi() {
|
|
2790
2790
|
let e, t;
|
|
2791
2791
|
return {
|
|
2792
2792
|
promise: new Promise((n, r) => {
|
|
@@ -2808,7 +2808,7 @@ z({
|
|
|
2808
2808
|
}), z({
|
|
2809
2809
|
prefix: "call",
|
|
2810
2810
|
size: 24
|
|
2811
|
-
}), q.record(q.string(),
|
|
2811
|
+
}), q.record(q.string(), fi.optional()), q.record(q.string(), q.string()), z({
|
|
2812
2812
|
prefix: "call",
|
|
2813
2813
|
size: 24
|
|
2814
2814
|
}), z({
|
|
@@ -2821,7 +2821,7 @@ z({
|
|
|
2821
2821
|
prefix: "aiobj",
|
|
2822
2822
|
size: 24
|
|
2823
2823
|
});
|
|
2824
|
-
var { atob:
|
|
2824
|
+
var { atob: $i } = globalThis, ea = class {
|
|
2825
2825
|
constructor() {
|
|
2826
2826
|
this.queue = [], this.isProcessing = !1, this.idleWaiters = [];
|
|
2827
2827
|
}
|
|
@@ -2886,9 +2886,9 @@ z({
|
|
|
2886
2886
|
prefix: "call",
|
|
2887
2887
|
size: 24
|
|
2888
2888
|
});
|
|
2889
|
-
async function
|
|
2889
|
+
async function ta({ response: e, url: t, fallbackMessage: n }) {
|
|
2890
2890
|
let r = await e.text();
|
|
2891
|
-
return new
|
|
2891
|
+
return new an({
|
|
2892
2892
|
message: r || n,
|
|
2893
2893
|
url: t,
|
|
2894
2894
|
requestBodyValues: void 0,
|
|
@@ -2896,9 +2896,9 @@ async function ea({ response: e, url: t, fallbackMessage: n }) {
|
|
|
2896
2896
|
responseBody: r
|
|
2897
2897
|
});
|
|
2898
2898
|
}
|
|
2899
|
-
async function
|
|
2899
|
+
async function na(e) {
|
|
2900
2900
|
if (e == null) return [];
|
|
2901
|
-
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new
|
|
2901
|
+
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new En({
|
|
2902
2902
|
functionality: "FileList",
|
|
2903
2903
|
message: "FileList is not supported in the current environment"
|
|
2904
2904
|
});
|
|
@@ -2917,18 +2917,18 @@ async function ta(e) {
|
|
|
2917
2917
|
};
|
|
2918
2918
|
}));
|
|
2919
2919
|
}
|
|
2920
|
-
function
|
|
2920
|
+
function ra(e, t) {
|
|
2921
2921
|
let n = e.search(/[?#]/), r = n === -1 ? e : e.slice(0, n), i = n === -1 ? "" : e.slice(n);
|
|
2922
2922
|
return `${r.endsWith("/") && t.startsWith("/") ? r.slice(0, -1) : r}${t}${i}`;
|
|
2923
2923
|
}
|
|
2924
|
-
var
|
|
2924
|
+
var ia = class {
|
|
2925
2925
|
constructor({ api: e = "/api/chat", credentials: t, headers: n, body: r, fetch: i, prepareSendMessagesRequest: a, prepareReconnectToStreamRequest: o }) {
|
|
2926
2926
|
this.api = e, this.credentials = t, this.headers = n, this.body = r, this.fetch = i, this.prepareSendMessagesRequest = a, this.prepareReconnectToStreamRequest = o;
|
|
2927
2927
|
}
|
|
2928
2928
|
async sendMessages({ abortSignal: e, ...t }) {
|
|
2929
|
-
let n = await
|
|
2930
|
-
...
|
|
2931
|
-
...
|
|
2929
|
+
let n = await ri(this.body), r = await ri(this.headers), i = await ri(this.credentials), a = {
|
|
2930
|
+
...Rn(r),
|
|
2931
|
+
...Rn(t.headers)
|
|
2932
2932
|
}, o = await this.prepareSendMessagesRequest?.({
|
|
2933
2933
|
api: this.api,
|
|
2934
2934
|
id: t.chatId,
|
|
@@ -2942,7 +2942,7 @@ var ra = 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 : Rn(o.headers), l = o?.body === void 0 ? {
|
|
2946
2946
|
...n,
|
|
2947
2947
|
...t.body,
|
|
2948
2948
|
id: t.chatId,
|
|
@@ -2959,18 +2959,18 @@ var ra = class {
|
|
|
2959
2959
|
credentials: u,
|
|
2960
2960
|
signal: e
|
|
2961
2961
|
});
|
|
2962
|
-
if (!d.ok) throw await
|
|
2962
|
+
if (!d.ok) throw await ta({
|
|
2963
2963
|
response: d,
|
|
2964
2964
|
url: s,
|
|
2965
2965
|
fallbackMessage: "Failed to fetch the chat response."
|
|
2966
2966
|
});
|
|
2967
|
-
if (!d.body) throw new
|
|
2967
|
+
if (!d.body) throw new ln({ 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 ri(this.body), n = await ri(this.headers), r = await ri(this.credentials), i = {
|
|
2972
|
+
...Rn(n),
|
|
2973
|
+
...Rn(e.headers)
|
|
2974
2974
|
}, a = await this.prepareReconnectToStreamRequest?.({
|
|
2975
2975
|
api: this.api,
|
|
2976
2976
|
id: e.chatId,
|
|
@@ -2983,47 +2983,47 @@ var ra = 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 si({
|
|
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
|
-
o =
|
|
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 : Rn(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,
|
|
2997
2997
|
signal: e.abortSignal
|
|
2998
2998
|
});
|
|
2999
2999
|
if (l.status === 204) return null;
|
|
3000
|
-
if (!l.ok) throw await
|
|
3000
|
+
if (!l.ok) throw await ta({
|
|
3001
3001
|
response: l,
|
|
3002
3002
|
url: o,
|
|
3003
3003
|
fallbackMessage: "Failed to fetch the chat response."
|
|
3004
3004
|
});
|
|
3005
|
-
if (!l.body) throw new
|
|
3005
|
+
if (!l.body) throw new ln({ message: "The response body is empty." });
|
|
3006
3006
|
return this.processResponseStream(l.body);
|
|
3007
3007
|
}
|
|
3008
|
-
},
|
|
3008
|
+
}, aa = class extends ia {
|
|
3009
3009
|
constructor({ resumeStreamIsReplay: e = !0, ...t } = {}) {
|
|
3010
3010
|
super(t), this.resumeStreamIsReplay = e;
|
|
3011
3011
|
}
|
|
3012
3012
|
processResponseStream(e) {
|
|
3013
|
-
return
|
|
3013
|
+
return ni({
|
|
3014
3014
|
stream: e,
|
|
3015
|
-
schema:
|
|
3015
|
+
schema: Ui
|
|
3016
3016
|
}).pipeThrough(new TransformStream({ async transform(e, t) {
|
|
3017
3017
|
if (!e.success) throw e.error;
|
|
3018
3018
|
t.enqueue(e.value);
|
|
3019
3019
|
} }));
|
|
3020
3020
|
}
|
|
3021
|
-
},
|
|
3021
|
+
}, oa = class {
|
|
3022
3022
|
get id() {
|
|
3023
3023
|
return this._id ??= this.generateId();
|
|
3024
3024
|
}
|
|
3025
|
-
constructor({ generateId: e =
|
|
3026
|
-
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new
|
|
3025
|
+
constructor({ generateId: e = zn, id: t, transport: n = new aa(), messageMetadataSchema: r, dataPartSchemas: i, state: a, onError: o, onToolCall: s, onFinish: c, onData: l, sendAutomaticallyWhen: u }) {
|
|
3026
|
+
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new ea(), this.activeStopCount = 0, this.stopGeneration = 0, this.sendMessage = async (e, t) => {
|
|
3027
3027
|
if (e == null) {
|
|
3028
3028
|
let e = this.pendingApprovalMessageId;
|
|
3029
3029
|
if (e == null) {
|
|
@@ -3050,7 +3050,7 @@ var ra = class {
|
|
|
3050
3050
|
this.pendingMessagePreparations.add(t);
|
|
3051
3051
|
let r;
|
|
3052
3052
|
try {
|
|
3053
|
-
r = Array.isArray(e.files) ? e.files : await
|
|
3053
|
+
r = Array.isArray(e.files) ? e.files : await na(e.files);
|
|
3054
3054
|
} finally {
|
|
3055
3055
|
this.pendingMessagePreparations.delete(t);
|
|
3056
3056
|
}
|
|
@@ -3062,12 +3062,12 @@ var ra = 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 si({
|
|
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 si({
|
|
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 ra = 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 si({
|
|
3095
3095
|
parameter: "messageId",
|
|
3096
3096
|
value: e,
|
|
3097
3097
|
message: `message ${e} not found`
|
|
@@ -3227,7 +3227,7 @@ var ra = class {
|
|
|
3227
3227
|
}), r && this.status === "error" && this.pendingApprovalMessageId == null && (this.pendingApprovalMessageId = this.state.messages[t]?.id ?? e);
|
|
3228
3228
|
}
|
|
3229
3229
|
async makeRequest(e) {
|
|
3230
|
-
let t =
|
|
3230
|
+
let t = Qi();
|
|
3231
3231
|
try {
|
|
3232
3232
|
await this.makeRequestImpl({
|
|
3233
3233
|
...e,
|
|
@@ -3283,7 +3283,7 @@ var ra = class {
|
|
|
3283
3283
|
let d = this.lastMessage, f = e === "submit-message" && i != null ? this.state.messages.findIndex((e) => e.id === i) : this.state.messages.length - 1, p = f === -1 ? d : this.state.messages[f], m = p?.id, h = e === "resume-stream" && p?.role === "assistant" && p.parts.some((e) => Y(e) && (e.state === "input-streaming" || e.state === "input-available" && e.providerExecuted || e.state === "approval-responded")) ? this.state.snapshot(p) : void 0, g = f !== -1 && f < this.state.messages.length - 1 && p?.role === "assistant", _ = !1, v = !1, y = !1, b;
|
|
3284
3284
|
try {
|
|
3285
3285
|
let s = {
|
|
3286
|
-
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState :
|
|
3286
|
+
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : Yi({
|
|
3287
3287
|
lastMessage: e === "resume-stream" ? h : e === "regenerate-message" ? void 0 : this.state.snapshot(p),
|
|
3288
3288
|
messageId: this.generateId()
|
|
3289
3289
|
}),
|
|
@@ -3303,8 +3303,8 @@ var ra = class {
|
|
|
3303
3303
|
body: r,
|
|
3304
3304
|
trigger: e,
|
|
3305
3305
|
messageId: i
|
|
3306
|
-
}), await
|
|
3307
|
-
stream:
|
|
3306
|
+
}), await Zi({
|
|
3307
|
+
stream: Xi({
|
|
3308
3308
|
stream: l,
|
|
3309
3309
|
resetStateOnMessageIdChange: e === "resume-stream",
|
|
3310
3310
|
resetStateOnFirstMessageStart: e === "resume-stream" && this.transport.resumeStreamIsReplay,
|
|
@@ -3369,13 +3369,13 @@ var ra = class {
|
|
|
3369
3369
|
}));
|
|
3370
3370
|
}
|
|
3371
3371
|
};
|
|
3372
|
-
function
|
|
3372
|
+
function sa({ messages: e }) {
|
|
3373
3373
|
let t = e[e.length - 1];
|
|
3374
3374
|
if (!t || t.role !== "assistant") return !1;
|
|
3375
3375
|
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1).filter(Y);
|
|
3376
3376
|
return r.filter((e) => e.state === "approval-responded").length > 0 && r.every((e) => e.state === "output-available" && e.preliminary !== !0 || e.state === "output-error" || e.state === "output-denied" || e.state === "approval-responded");
|
|
3377
3377
|
}
|
|
3378
|
-
function
|
|
3378
|
+
function ca({ messages: e }) {
|
|
3379
3379
|
let t = e[e.length - 1];
|
|
3380
3380
|
if (!t || t.role !== "assistant") return !1;
|
|
3381
3381
|
let n = t.parts.reduce((e, t, n) => t.type === "step-start" ? n : e, -1), r = t.parts.slice(n + 1), i = r.filter(Y).filter((e) => !e.providerExecuted), a = r.reduce((e, t, n) => Y(t) && !t.providerExecuted ? n : e, -1);
|
|
@@ -3383,7 +3383,7 @@ function sa({ messages: e }) {
|
|
|
3383
3383
|
}
|
|
3384
3384
|
//#endregion
|
|
3385
3385
|
//#region ../node_modules/.pnpm/throttleit@2.1.0/node_modules/throttleit/index.js
|
|
3386
|
-
var
|
|
3386
|
+
var la = /* @__PURE__ */ t(((e, t) => {
|
|
3387
3387
|
function n(e, t) {
|
|
3388
3388
|
if (typeof e != "function") throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);
|
|
3389
3389
|
let n, r = 0;
|
|
@@ -3396,14 +3396,14 @@ var ca = /* @__PURE__ */ t(((e, t) => {
|
|
|
3396
3396
|
};
|
|
3397
3397
|
}
|
|
3398
3398
|
t.exports = n;
|
|
3399
|
-
})), X = /* @__PURE__ */ e(o(), 1),
|
|
3400
|
-
function
|
|
3401
|
-
return t == null ? e : (0,
|
|
3399
|
+
})), X = /* @__PURE__ */ e(o(), 1), ua = /* @__PURE__ */ e(la(), 1), Z = We();
|
|
3400
|
+
function da(e, t) {
|
|
3401
|
+
return t == null ? e : (0, ua.default)(e, t);
|
|
3402
3402
|
}
|
|
3403
|
-
function
|
|
3403
|
+
function fa(e) {
|
|
3404
3404
|
return Array.isArray(e) ? [...e] : typeof e == "object" && e && (Object.getPrototypeOf(e) === Object.prototype || Object.getPrototypeOf(e) === null) ? { ...e } : e;
|
|
3405
3405
|
}
|
|
3406
|
-
var
|
|
3406
|
+
var pa = class {
|
|
3407
3407
|
#e;
|
|
3408
3408
|
#t;
|
|
3409
3409
|
#n;
|
|
@@ -3427,9 +3427,9 @@ var fa = class {
|
|
|
3427
3427
|
...t,
|
|
3428
3428
|
parts: t.parts.map((e) => ({ ...e }))
|
|
3429
3429
|
};
|
|
3430
|
-
return "metadata" in t && (n.metadata =
|
|
3430
|
+
return "metadata" in t && (n.metadata = fa(t.metadata)), n;
|
|
3431
3431
|
}, this["~registerMessagesCallback"] = (e, t) => {
|
|
3432
|
-
let n = t ?
|
|
3432
|
+
let n = t ? da(e, t) : e;
|
|
3433
3433
|
return this.#r.add(n), () => {
|
|
3434
3434
|
this.#r.delete(n);
|
|
3435
3435
|
};
|
|
@@ -3466,29 +3466,29 @@ var fa = class {
|
|
|
3466
3466
|
#o;
|
|
3467
3467
|
#s;
|
|
3468
3468
|
#c;
|
|
3469
|
-
},
|
|
3469
|
+
}, ma = class extends oa {
|
|
3470
3470
|
#e;
|
|
3471
3471
|
constructor({ messages: e, ...t }) {
|
|
3472
|
-
let n = new
|
|
3472
|
+
let n = new pa(e);
|
|
3473
3473
|
super({
|
|
3474
3474
|
...t,
|
|
3475
3475
|
state: n
|
|
3476
3476
|
}), this["~registerMessagesCallback"] = (e, t) => this.#e["~registerMessagesCallback"](e, t), this["~registerStatusCallback"] = (e) => this.#e["~registerStatusCallback"](e), this["~registerErrorCallback"] = (e) => this.#e["~registerErrorCallback"](e), this.#e = n;
|
|
3477
3477
|
}
|
|
3478
|
-
},
|
|
3479
|
-
function
|
|
3478
|
+
}, ha = /* @__PURE__ */ new WeakMap();
|
|
3479
|
+
function ga({ chat: e, state: t }) {
|
|
3480
3480
|
if (document.visibilityState !== "visible" || t.pendingVisibilityResume != null) return;
|
|
3481
|
-
let n = () =>
|
|
3481
|
+
let n = () => ha.get(e) === t && t.registrations.size > 0, r = () => {
|
|
3482
3482
|
t.pendingVisibilityResume = void 0;
|
|
3483
3483
|
};
|
|
3484
3484
|
t.pendingVisibilityResume = e["~resumeStreamIfDisconnected"]({ shouldResume: () => n() && document.visibilityState === "visible" }).then(r, r);
|
|
3485
3485
|
}
|
|
3486
|
-
function
|
|
3487
|
-
let n =
|
|
3486
|
+
function _a({ chat: e, registration: t }) {
|
|
3487
|
+
let n = ha.get(e);
|
|
3488
3488
|
if (n == null) {
|
|
3489
3489
|
let t = { registrations: /* @__PURE__ */ new Set() };
|
|
3490
|
-
if (
|
|
3491
|
-
let n = () =>
|
|
3490
|
+
if (ha.set(e, t), n = t, typeof document < "u") {
|
|
3491
|
+
let n = () => ga({
|
|
3492
3492
|
chat: e,
|
|
3493
3493
|
state: t
|
|
3494
3494
|
});
|
|
@@ -3499,10 +3499,10 @@ function ga({ chat: e, registration: t }) {
|
|
|
3499
3499
|
}
|
|
3500
3500
|
let { registrations: r } = n, i = r.size === 0;
|
|
3501
3501
|
return r.add(t), i && e.status !== "submitted" && e.status !== "streaming" && e.resumeStream(), () => {
|
|
3502
|
-
r.delete(t), r.size === 0 && (n.cleanupVisibilityListener?.(),
|
|
3502
|
+
r.delete(t), r.size === 0 && (n.cleanupVisibilityListener?.(), ha.delete(e));
|
|
3503
3503
|
};
|
|
3504
3504
|
}
|
|
3505
|
-
function
|
|
3505
|
+
function va(e) {
|
|
3506
3506
|
return {
|
|
3507
3507
|
chat: e,
|
|
3508
3508
|
messages: e.messages,
|
|
@@ -3510,10 +3510,10 @@ function _a(e) {
|
|
|
3510
3510
|
error: e.error
|
|
3511
3511
|
};
|
|
3512
3512
|
}
|
|
3513
|
-
function
|
|
3513
|
+
function ya(e, t) {
|
|
3514
3514
|
return e.chat === t.chat && e.messages === t.messages && e.status === t.status && e.error === t.error;
|
|
3515
3515
|
}
|
|
3516
|
-
function
|
|
3516
|
+
function ba({ throttle: e, experimental_throttle: t, resume: n = !1, ...r } = {}) {
|
|
3517
3517
|
let i = e ?? t, a = (0, X.useRef)({}), o = (0, X.useRef)({});
|
|
3518
3518
|
"chat" in r || (o.current = {
|
|
3519
3519
|
onToolCall: r.onToolCall,
|
|
@@ -3523,7 +3523,7 @@ function ya({ throttle: e, experimental_throttle: t, resume: n = !1, ...r } = {}
|
|
|
3523
3523
|
sendAutomaticallyWhen: r.sendAutomaticallyWhen,
|
|
3524
3524
|
transport: r.transport
|
|
3525
3525
|
});
|
|
3526
|
-
let s, c = () => o.current.transport ?? (s ??= new
|
|
3526
|
+
let s, c = () => o.current.transport ?? (s ??= new aa()), l = {
|
|
3527
3527
|
...r,
|
|
3528
3528
|
transport: {
|
|
3529
3529
|
get resumeStreamIsReplay() {
|
|
@@ -3538,7 +3538,7 @@ function ya({ throttle: e, experimental_throttle: t, resume: n = !1, ...r } = {}
|
|
|
3538
3538
|
onError: (e) => o.current.onError?.(e),
|
|
3539
3539
|
sendAutomaticallyWhen: (e) => o.current.sendAutomaticallyWhen?.(e) ?? !1
|
|
3540
3540
|
}, u = "chat" in r ? r.chat : r.id, { chat: d, isExternallyManaged: f } = (0, X.useMemo)(() => ({
|
|
3541
|
-
chat: "chat" in r ? r.chat : new
|
|
3541
|
+
chat: "chat" in r ? r.chat : new ma(l),
|
|
3542
3542
|
isExternallyManaged: "chat" in r
|
|
3543
3543
|
}), [u]);
|
|
3544
3544
|
(0, X.useEffect)(() => {
|
|
@@ -3546,18 +3546,18 @@ function ya({ throttle: e, experimental_throttle: t, resume: n = !1, ...r } = {}
|
|
|
3546
3546
|
d.stop();
|
|
3547
3547
|
};
|
|
3548
3548
|
}, [d, f]);
|
|
3549
|
-
let [p, m] = (0, X.useState)(() =>
|
|
3550
|
-
p.chat !== d && m(
|
|
3549
|
+
let [p, m] = (0, X.useState)(() => va(d));
|
|
3550
|
+
p.chat !== d && m(va(d)), (0, X.useEffect)(() => {
|
|
3551
3551
|
let e = !0, t = () => {
|
|
3552
3552
|
if (!e) return;
|
|
3553
|
-
let t =
|
|
3554
|
-
m((e) => e.chat !== d ||
|
|
3553
|
+
let t = va(d);
|
|
3554
|
+
m((e) => e.chat !== d || ya(e, t) ? e : t);
|
|
3555
3555
|
}, n = [
|
|
3556
3556
|
d["~registerMessagesCallback"](t, i),
|
|
3557
3557
|
d["~registerStatusCallback"](t),
|
|
3558
3558
|
d["~registerErrorCallback"](t)
|
|
3559
|
-
], r =
|
|
3560
|
-
return m((e) =>
|
|
3559
|
+
], r = va(d);
|
|
3560
|
+
return m((e) => ya(e, r) ? e : r), () => {
|
|
3561
3561
|
e = !1, n.forEach((e) => e());
|
|
3562
3562
|
};
|
|
3563
3563
|
}, [d, i]);
|
|
@@ -3565,7 +3565,7 @@ function ya({ throttle: e, experimental_throttle: t, resume: n = !1, ...r } = {}
|
|
|
3565
3565
|
typeof e == "function" && (e = e(d.messages)), d.messages = e;
|
|
3566
3566
|
}, [d]);
|
|
3567
3567
|
return (0, X.useEffect)(() => {
|
|
3568
|
-
if (n) return
|
|
3568
|
+
if (n) return _a({
|
|
3569
3569
|
chat: d,
|
|
3570
3570
|
registration: a.current
|
|
3571
3571
|
});
|
|
@@ -3589,23 +3589,23 @@ function ya({ throttle: e, experimental_throttle: t, resume: n = !1, ...r } = {}
|
|
|
3589
3589
|
}
|
|
3590
3590
|
//#endregion
|
|
3591
3591
|
//#region src/components/chat/chat-abort.ts
|
|
3592
|
-
var
|
|
3593
|
-
function
|
|
3592
|
+
var xa = "user_cancelled";
|
|
3593
|
+
function Sa(e) {
|
|
3594
3594
|
if (e.type === "abort") return e.reason;
|
|
3595
3595
|
}
|
|
3596
|
-
function
|
|
3596
|
+
function Ca(e) {
|
|
3597
3597
|
return e.isAbort ? e.streamReason || "user_cancelled" : null;
|
|
3598
3598
|
}
|
|
3599
|
-
function
|
|
3599
|
+
function wa(e) {
|
|
3600
3600
|
switch (e) {
|
|
3601
|
-
case
|
|
3601
|
+
case xa: return "Generation stopped";
|
|
3602
3602
|
case "timeout": return "Generation stopped: timed out";
|
|
3603
3603
|
default: return `Generation stopped: ${e}`;
|
|
3604
3604
|
}
|
|
3605
3605
|
}
|
|
3606
3606
|
//#endregion
|
|
3607
3607
|
//#region src/components/chat/turn-timing.ts
|
|
3608
|
-
function
|
|
3608
|
+
function Ta(e) {
|
|
3609
3609
|
let t = e.metadata;
|
|
3610
3610
|
if (typeof t != "object" || !t) return;
|
|
3611
3611
|
let { startedAt: n, finishedAt: r, stopped: i } = t;
|
|
@@ -3615,21 +3615,21 @@ function wa(e) {
|
|
|
3615
3615
|
stopped: i === !0
|
|
3616
3616
|
};
|
|
3617
3617
|
}
|
|
3618
|
-
function
|
|
3618
|
+
function Ea(e) {
|
|
3619
3619
|
let t = Math.max(1, Math.round(e / 1e3)), n = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), i = t % 60;
|
|
3620
3620
|
return n > 0 ? r > 0 ? `${n}h ${r}m` : `${n}h` : r > 0 ? i > 0 ? `${r}m ${i}s` : `${r}m` : `${i}s`;
|
|
3621
3621
|
}
|
|
3622
3622
|
//#endregion
|
|
3623
3623
|
//#region src/components/chat/agent-activity.tsx
|
|
3624
|
-
var
|
|
3625
|
-
let t = (0, L.c)(19), { running: n, thinking: i, interrupted: a, defaultOpen: o, timing: s, toolCount: c, failedCount: l, steps: u } = e, d = i !== void 0 && i, f = a !== void 0 && a, p = o !== void 0 && o, m = c === void 0 ? 0 : c, h = l === void 0 ? 0 : l, g = u === void 0 ?
|
|
3624
|
+
var Da = (e) => {
|
|
3625
|
+
let t = (0, L.c)(19), { running: n, thinking: i, interrupted: a, defaultOpen: o, timing: s, toolCount: c, failedCount: l, steps: u } = e, d = i !== void 0 && i, f = a !== void 0 && a, p = o !== void 0 && o, m = c === void 0 ? 0 : c, h = l === void 0 ? 0 : l, g = u === void 0 ? Oa : u, [_, v] = X.useState(), y = _ ?? (n || p), b = ja(n), x = g.length > 0, S;
|
|
3626
3626
|
t[0] !== h || t[1] !== f || t[2] !== b || t[3] !== n || t[4] !== d || t[5] !== s || t[6] !== m ? (S = n ? /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("output", {
|
|
3627
|
-
className:
|
|
3627
|
+
className: ka,
|
|
3628
3628
|
children: d ? "Thinking…" : "Working…"
|
|
3629
3629
|
}), s && /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
3630
3630
|
className: "tabular-nums",
|
|
3631
|
-
children:
|
|
3632
|
-
})] }) : /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("span", { children:
|
|
3631
|
+
children: Ea(b - s.startedAt)
|
|
3632
|
+
})] }) : /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)("span", { children: Aa({
|
|
3633
3633
|
interrupted: f,
|
|
3634
3634
|
timing: s,
|
|
3635
3635
|
toolCount: m
|
|
@@ -3665,13 +3665,13 @@ var Ea = (e) => {
|
|
|
3665
3665
|
className: "my-1 w-full",
|
|
3666
3666
|
children: [w, T]
|
|
3667
3667
|
}), t[16] = w, t[17] = T, t[18] = E) : E = t[18], E;
|
|
3668
|
-
},
|
|
3669
|
-
function
|
|
3670
|
-
let r = t?.finishedAt == null ? void 0 :
|
|
3668
|
+
}, Oa = [], ka = "animate-shimmer bg-[linear-gradient(90deg,var(--muted-foreground)_35%,var(--foreground)_50%,var(--muted-foreground)_65%)] bg-size-[200%_100%] bg-clip-text text-transparent motion-reduce:animate-none";
|
|
3669
|
+
function Aa({ interrupted: e, timing: t, toolCount: n }) {
|
|
3670
|
+
let r = t?.finishedAt == null ? void 0 : Ea(t.finishedAt - t.startedAt);
|
|
3671
3671
|
return e ? r ? `Stopped after ${r}` : "Stopped" : n === 0 ? r ? `Thought for ${r}` : "Thought process" : r ? `Worked for ${r}` : `Worked through ${n} ${n === 1 ? "step" : "steps"}`;
|
|
3672
3672
|
}
|
|
3673
|
-
function
|
|
3674
|
-
let t = (0, L.c)(3), [n, r] = X.useState(
|
|
3673
|
+
function ja(e) {
|
|
3674
|
+
let t = (0, L.c)(3), [n, r] = X.useState(Ma), i, a;
|
|
3675
3675
|
return t[0] === e ? (i = t[1], a = t[2]) : (i = () => {
|
|
3676
3676
|
if (!e) return;
|
|
3677
3677
|
let t = () => r(Date.now()), n = requestAnimationFrame(t), i = setInterval(t, 1e3);
|
|
@@ -3680,12 +3680,12 @@ function Aa(e) {
|
|
|
3680
3680
|
};
|
|
3681
3681
|
}, a = [e], t[0] = e, t[1] = i, t[2] = a), X.useEffect(i, a), n;
|
|
3682
3682
|
}
|
|
3683
|
-
function
|
|
3683
|
+
function Ma() {
|
|
3684
3684
|
return Date.now();
|
|
3685
3685
|
}
|
|
3686
3686
|
//#endregion
|
|
3687
3687
|
//#region src/core/ai/context/providers/cell.ts
|
|
3688
|
-
var
|
|
3688
|
+
var Na = class extends j {
|
|
3689
3689
|
title = "Cells";
|
|
3690
3690
|
mentionPrefix = "@";
|
|
3691
3691
|
contextType = "cell";
|
|
@@ -3694,12 +3694,12 @@ var Ma = class extends j {
|
|
|
3694
3694
|
super(), this.store = e;
|
|
3695
3695
|
}
|
|
3696
3696
|
getItems() {
|
|
3697
|
-
let e = this.store.get(
|
|
3697
|
+
let e = this.store.get(Oe);
|
|
3698
3698
|
return e.cellIds.map((t, n) => {
|
|
3699
3699
|
let r = e.cellData[t];
|
|
3700
3700
|
return {
|
|
3701
3701
|
uri: this.asURI(t),
|
|
3702
|
-
name:
|
|
3702
|
+
name: je(r.name, n),
|
|
3703
3703
|
type: this.contextType,
|
|
3704
3704
|
description: "Cell code",
|
|
3705
3705
|
data: {
|
|
@@ -3728,7 +3728,7 @@ var Ma = class extends j {
|
|
|
3728
3728
|
};
|
|
3729
3729
|
//#endregion
|
|
3730
3730
|
//#region src/core/ai/context/providers/cell-output.ts
|
|
3731
|
-
function
|
|
3731
|
+
function Pa(e, t) {
|
|
3732
3732
|
return e ? !!([
|
|
3733
3733
|
"image/",
|
|
3734
3734
|
"video/",
|
|
@@ -3744,7 +3744,7 @@ function Na(e, t) {
|
|
|
3744
3744
|
"<marimo-ui-element"
|
|
3745
3745
|
].some((e) => t.includes(e))) : !1;
|
|
3746
3746
|
}
|
|
3747
|
-
var
|
|
3747
|
+
var Fa = class extends j {
|
|
3748
3748
|
title = "Cell Outputs";
|
|
3749
3749
|
mentionPrefix = "@";
|
|
3750
3750
|
contextType = "cell-output";
|
|
@@ -3753,9 +3753,9 @@ var Pa = class extends j {
|
|
|
3753
3753
|
super(), this.store = e;
|
|
3754
3754
|
}
|
|
3755
3755
|
getItems() {
|
|
3756
|
-
let e = this.store.get(
|
|
3756
|
+
let e = this.store.get(Oe), t = [];
|
|
3757
3757
|
for (let n of e.cellIds) {
|
|
3758
|
-
let r =
|
|
3758
|
+
let r = Ra(n, e, this.store.get(Te(n))), i = r.cellOutput;
|
|
3759
3759
|
if (!i) continue;
|
|
3760
3760
|
let a = i.output.mimetype || "unknown";
|
|
3761
3761
|
t.push({
|
|
@@ -3824,10 +3824,10 @@ var Pa = class extends j {
|
|
|
3824
3824
|
}
|
|
3825
3825
|
async getAttachments(e) {
|
|
3826
3826
|
let t = e[0].data.cellId, n = e[0].data.cellName;
|
|
3827
|
-
return
|
|
3827
|
+
return Ia(e.map((e) => e.data.cellOutput), t, n);
|
|
3828
3828
|
}
|
|
3829
3829
|
};
|
|
3830
|
-
async function
|
|
3830
|
+
async function Ia(e, t, r) {
|
|
3831
3831
|
let i = e.filter((e) => e.shouldDownloadImage && e.outputType === "media");
|
|
3832
3832
|
if (i.length === 0) return [];
|
|
3833
3833
|
let a = i.flatMap((e) => {
|
|
@@ -3850,9 +3850,9 @@ async function Fa(e, t, r) {
|
|
|
3850
3850
|
return n.error("Error downloading cell output images:", e), [];
|
|
3851
3851
|
}
|
|
3852
3852
|
}
|
|
3853
|
-
function
|
|
3853
|
+
function La(e) {
|
|
3854
3854
|
if (E(e)) return null;
|
|
3855
|
-
let t = e.mimetype, n =
|
|
3855
|
+
let t = e.mimetype, n = Pa(t, String(e.data)) ? "media" : "text", r = Re(e), i, a = !1;
|
|
3856
3856
|
return n === "media" && (typeof e.data == "string" && e.data.startsWith("data:") || typeof e.data == "string" && e.data.startsWith("http") ? i = e.data : a = !0), {
|
|
3857
3857
|
processedContent: r,
|
|
3858
3858
|
imageUrl: i,
|
|
@@ -3861,45 +3861,45 @@ function Ia(e) {
|
|
|
3861
3861
|
output: e
|
|
3862
3862
|
};
|
|
3863
3863
|
}
|
|
3864
|
-
function
|
|
3865
|
-
let { includeConsoleOutput:
|
|
3866
|
-
|
|
3867
|
-
let
|
|
3868
|
-
return
|
|
3864
|
+
function Ra(e, t, n, r) {
|
|
3865
|
+
let { includeConsoleOutput: i = !1 } = r || {}, a = t.cellRuntime[e], o = t.cellData[e], s = t.cellIds.indexOf(e), c = je(o.name, s), l;
|
|
3866
|
+
i && (l = a.consoleOutputs.map((e) => La(e)).filter((e) => e !== null));
|
|
3867
|
+
let u;
|
|
3868
|
+
return n !== null && !E(n) && (u = La(n) ?? void 0), {
|
|
3869
3869
|
cellId: e,
|
|
3870
|
-
cellName:
|
|
3871
|
-
cellCode:
|
|
3872
|
-
cellOutput:
|
|
3873
|
-
consoleOutputs:
|
|
3870
|
+
cellName: c,
|
|
3871
|
+
cellCode: o.code,
|
|
3872
|
+
cellOutput: u,
|
|
3873
|
+
consoleOutputs: l
|
|
3874
3874
|
};
|
|
3875
3875
|
}
|
|
3876
3876
|
//#endregion
|
|
3877
3877
|
//#region src/core/ai/context/providers/error.ts
|
|
3878
|
-
function
|
|
3878
|
+
function za(e, t) {
|
|
3879
3879
|
let n = [`Code:\n${e.cellCode}`];
|
|
3880
|
-
if (e.tracebackHtml && n.push(`Traceback:\n${Se(e.tracebackHtml)}`), e.errorData.length > 0 && n.push(e.errorData.map((e) =>
|
|
3880
|
+
if (e.tracebackHtml && n.push(`Traceback:\n${Se(e.tracebackHtml)}`), e.errorData.length > 0 && n.push(e.errorData.map((e) => Me(e)).join("\n\n")), e.errorData.some((e) => e.type === "sql-error")) {
|
|
3881
3881
|
let r = oe(e.cellId, t);
|
|
3882
3882
|
r && n.push(`Database schema:\n${r}`);
|
|
3883
3883
|
}
|
|
3884
3884
|
return n.join("\n\n");
|
|
3885
3885
|
}
|
|
3886
|
-
function
|
|
3886
|
+
function Ba(e, t) {
|
|
3887
3887
|
return P({
|
|
3888
3888
|
type: "error",
|
|
3889
3889
|
data: {
|
|
3890
3890
|
name: e.cellName || `Cell ${e.cellId}`,
|
|
3891
3891
|
cellId: e.cellId
|
|
3892
3892
|
},
|
|
3893
|
-
details:
|
|
3893
|
+
details: za(e, t)
|
|
3894
3894
|
});
|
|
3895
3895
|
}
|
|
3896
|
-
function Ba(e) {
|
|
3897
|
-
return e.errorData.length === 1 ? Me(e.errorData[0]) : e.errorData.length > 1 ? `${e.errorData.length} errors` : e.tracebackHtml ? Se(e.tracebackHtml).trim().split("\n").find((e) => e.trim())?.trim() || "traceback" : "error";
|
|
3898
|
-
}
|
|
3899
3896
|
function Va(e) {
|
|
3897
|
+
return e.errorData.length === 1 ? Ne(e.errorData[0]) : e.errorData.length > 1 ? `${e.errorData.length} errors` : e.tracebackHtml ? Se(e.tracebackHtml).trim().split("\n").find((e) => e.trim())?.trim() || "traceback" : "error";
|
|
3898
|
+
}
|
|
3899
|
+
function Ha(e) {
|
|
3900
3900
|
return `Error: ${e.cellName || `Cell ${e.cellId}`}`;
|
|
3901
3901
|
}
|
|
3902
|
-
var
|
|
3902
|
+
var Ua = new T("error", "errors"), Wa = class extends j {
|
|
3903
3903
|
title = "Errors";
|
|
3904
3904
|
mentionPrefix = "@";
|
|
3905
3905
|
contextType = "error";
|
|
@@ -3908,7 +3908,7 @@ var Ha = new T("error", "errors"), Ua = class extends j {
|
|
|
3908
3908
|
super(), this.store = e;
|
|
3909
3909
|
}
|
|
3910
3910
|
getItems() {
|
|
3911
|
-
let e =
|
|
3911
|
+
let e = ke(this.store);
|
|
3912
3912
|
if (e.length === 0) return [];
|
|
3913
3913
|
let t = [{
|
|
3914
3914
|
uri: this.asURI("all"),
|
|
@@ -3922,13 +3922,13 @@ var Ha = new T("error", "errors"), Ua = class extends j {
|
|
|
3922
3922
|
}];
|
|
3923
3923
|
for (let n of e) t.push({
|
|
3924
3924
|
uri: this.asURI(n.cellId),
|
|
3925
|
-
name:
|
|
3925
|
+
name: Ha(n),
|
|
3926
3926
|
type: this.contextType,
|
|
3927
3927
|
data: {
|
|
3928
3928
|
type: "cell-error",
|
|
3929
3929
|
error: n
|
|
3930
3930
|
},
|
|
3931
|
-
description:
|
|
3931
|
+
description: Va(n)
|
|
3932
3932
|
});
|
|
3933
3933
|
return t;
|
|
3934
3934
|
}
|
|
@@ -3938,7 +3938,7 @@ var Ha = new T("error", "errors"), Ua = class extends j {
|
|
|
3938
3938
|
return {
|
|
3939
3939
|
label: "@Errors",
|
|
3940
3940
|
displayLabel: "Errors",
|
|
3941
|
-
detail: `${t} ${
|
|
3941
|
+
detail: `${t} ${Ua.pluralize(t)}`,
|
|
3942
3942
|
type: "error",
|
|
3943
3943
|
apply: "@error://all",
|
|
3944
3944
|
section: F.ERROR,
|
|
@@ -3950,7 +3950,7 @@ var Ha = new T("error", "errors"), Ua = class extends j {
|
|
|
3950
3950
|
let r = document.createElement("div");
|
|
3951
3951
|
r.classList.add("font-bold", "text-base"), r.textContent = "Errors", n.append(r);
|
|
3952
3952
|
let i = document.createElement("div");
|
|
3953
|
-
return i.classList.add("text-sm", "text-muted-foreground"), i.textContent = `${t} ${
|
|
3953
|
+
return i.classList.add("text-sm", "text-muted-foreground"), i.textContent = `${t} ${Ua.pluralize(t)}`, n.append(i), e.append(n), e;
|
|
3954
3954
|
}
|
|
3955
3955
|
};
|
|
3956
3956
|
}
|
|
@@ -3958,7 +3958,7 @@ var Ha = new T("error", "errors"), Ua = class extends j {
|
|
|
3958
3958
|
let { error: t } = e.data;
|
|
3959
3959
|
return {
|
|
3960
3960
|
...this.createBasicCompletion(e, {
|
|
3961
|
-
detail:
|
|
3961
|
+
detail: Va(t),
|
|
3962
3962
|
type: "error"
|
|
3963
3963
|
}),
|
|
3964
3964
|
section: F.ERROR
|
|
@@ -3971,20 +3971,20 @@ var Ha = new T("error", "errors"), Ua = class extends j {
|
|
|
3971
3971
|
};
|
|
3972
3972
|
}
|
|
3973
3973
|
formatContext(e) {
|
|
3974
|
-
return (e.data.type === "all-errors" ? e.data.errors : [e.data.error]).map((e) =>
|
|
3974
|
+
return (e.data.type === "all-errors" ? e.data.errors : [e.data.error]).map((e) => Ba(e, this.store)).join("\n\n");
|
|
3975
3975
|
}
|
|
3976
|
-
},
|
|
3976
|
+
}, Ga = le(), Ka = {
|
|
3977
3977
|
maxDepth: 3,
|
|
3978
3978
|
maxResults: 20,
|
|
3979
3979
|
defaultResultsLimit: 5,
|
|
3980
3980
|
includeDirectories: !1
|
|
3981
|
-
},
|
|
3981
|
+
}, qa = class extends j {
|
|
3982
3982
|
title = "Files";
|
|
3983
3983
|
mentionPrefix = "#";
|
|
3984
3984
|
contextType = "file";
|
|
3985
3985
|
apiRequests;
|
|
3986
3986
|
config;
|
|
3987
|
-
constructor(e, t =
|
|
3987
|
+
constructor(e, t = Ka) {
|
|
3988
3988
|
super(), this.apiRequests = e, this.config = t;
|
|
3989
3989
|
}
|
|
3990
3990
|
createCompletionSource() {
|
|
@@ -4085,7 +4085,7 @@ var Ha = new T("error", "errors"), Ua = class extends j {
|
|
|
4085
4085
|
detail: t.path,
|
|
4086
4086
|
displayLabel: `${i} ${r}`,
|
|
4087
4087
|
apply: async (e, i, a, o) => {
|
|
4088
|
-
let s = e.state.facet(
|
|
4088
|
+
let s = e.state.facet(Ga)?.addAttachment;
|
|
4089
4089
|
if (!s) {
|
|
4090
4090
|
n.warn("No addAttachment callback provided");
|
|
4091
4091
|
return;
|
|
@@ -4095,7 +4095,7 @@ var Ha = new T("error", "errors"), Ua = class extends j {
|
|
|
4095
4095
|
description: e.message
|
|
4096
4096
|
}), null));
|
|
4097
4097
|
if (!l) return;
|
|
4098
|
-
let u = l.mimeType || "text/plain", d =
|
|
4098
|
+
let u = l.mimeType || "text/plain", d = ze({
|
|
4099
4099
|
contents: l.contents ?? "",
|
|
4100
4100
|
mimeType: u,
|
|
4101
4101
|
isBase64: l.isBase64 ?? !1
|
|
@@ -4104,7 +4104,7 @@ var Ha = new T("error", "errors"), Ua = class extends j {
|
|
|
4104
4104
|
from: a,
|
|
4105
4105
|
to: o,
|
|
4106
4106
|
insert: ""
|
|
4107
|
-
} }),
|
|
4107
|
+
} }), Mt(e);
|
|
4108
4108
|
},
|
|
4109
4109
|
info: () => {
|
|
4110
4110
|
let e = document.createElement("div");
|
|
@@ -4128,7 +4128,7 @@ var Ha = new T("error", "errors"), Ua = class extends j {
|
|
|
4128
4128
|
details: t.isDirectory ? "Directory containing files and subdirectories" : "File"
|
|
4129
4129
|
});
|
|
4130
4130
|
}
|
|
4131
|
-
},
|
|
4131
|
+
}, Ja = class extends j {
|
|
4132
4132
|
title = "Tables";
|
|
4133
4133
|
mentionPrefix = "@";
|
|
4134
4134
|
contextType = "data";
|
|
@@ -4236,7 +4236,7 @@ var Ha = new T("error", "errors"), Ua = class extends j {
|
|
|
4236
4236
|
return e.classList.add("text-xs", "px-1.5", "py-0.5", "rounded-full", "font-medium", ...t.split(" ")), e;
|
|
4237
4237
|
}
|
|
4238
4238
|
}
|
|
4239
|
-
},
|
|
4239
|
+
}, Ya = class extends j {
|
|
4240
4240
|
title = "Variables";
|
|
4241
4241
|
mentionPrefix = "@";
|
|
4242
4242
|
contextType = "variable";
|
|
@@ -4281,16 +4281,16 @@ var Ha = new T("error", "errors"), Ua = class extends j {
|
|
|
4281
4281
|
};
|
|
4282
4282
|
//#endregion
|
|
4283
4283
|
//#region src/core/ai/context/context.ts
|
|
4284
|
-
function
|
|
4284
|
+
function Xa(e) {
|
|
4285
4285
|
let t = e.get(ae), n = e.get(O), r = e.get(M);
|
|
4286
|
-
return new A().register(new
|
|
4286
|
+
return new A().register(new Ja(n)).register(new Ya(r, n)).register(new Wa(e)).register(new Fa(e)).register(new Na(e)).register(new N(t.connectionsMap, n));
|
|
4287
4287
|
}
|
|
4288
|
-
function
|
|
4289
|
-
return new
|
|
4288
|
+
function Za() {
|
|
4289
|
+
return new qa(Ee());
|
|
4290
4290
|
}
|
|
4291
4291
|
//#endregion
|
|
4292
4292
|
//#region src/components/editor/ai/completion-utils.ts
|
|
4293
|
-
function
|
|
4293
|
+
function Qa(e, t = []) {
|
|
4294
4294
|
return (n) => {
|
|
4295
4295
|
let r = e.map((e) => n.matchBefore(e)).find(Boolean);
|
|
4296
4296
|
return !r || r && r.from === r.to && !n.explicit ? null : {
|
|
@@ -4301,23 +4301,23 @@ function Za(e, t = []) {
|
|
|
4301
4301
|
}
|
|
4302
4302
|
//#endregion
|
|
4303
4303
|
//#region src/components/chat/chat-utils.ts
|
|
4304
|
-
async function
|
|
4304
|
+
async function $a(e) {
|
|
4305
4305
|
return await Promise.all(e.map(async (e) => ({
|
|
4306
4306
|
type: "file",
|
|
4307
4307
|
mediaType: e.type,
|
|
4308
4308
|
filename: e.name,
|
|
4309
|
-
url: await
|
|
4309
|
+
url: await Le(e, "dataUrl")
|
|
4310
4310
|
})));
|
|
4311
4311
|
}
|
|
4312
|
-
function
|
|
4312
|
+
function eo(e) {
|
|
4313
4313
|
let t = e.at(-1);
|
|
4314
4314
|
if (!t || t.role !== "assistant") return !1;
|
|
4315
4315
|
let n = t.parts.at(-1);
|
|
4316
|
-
return !n || !Y(n) ? !1 :
|
|
4316
|
+
return !n || !Y(n) ? !1 : ca({ messages: e }) || sa({ messages: e }) || n.state === "output-denied" && !n.providerExecuted;
|
|
4317
4317
|
}
|
|
4318
4318
|
//#endregion
|
|
4319
4319
|
//#region src/components/chat/chat-components.tsx
|
|
4320
|
-
var
|
|
4320
|
+
var to = (e) => {
|
|
4321
4321
|
let t = (0, L.c)(6), { attachment: n } = e;
|
|
4322
4322
|
if (n.mediaType?.startsWith("image/")) {
|
|
4323
4323
|
let e = n.filename || "Attachment", r;
|
|
@@ -4328,13 +4328,13 @@ var eo = (e) => {
|
|
|
4328
4328
|
}), t[0] = n.url, t[1] = e, t[2] = r) : r = t[2], r;
|
|
4329
4329
|
}
|
|
4330
4330
|
let r;
|
|
4331
|
-
t[3] === Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ (0, Z.jsx)(
|
|
4331
|
+
t[3] === Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ (0, Z.jsx)(Fe, { className: "h-3 w-3 mt-0.5" }), t[3] = r) : r = t[3];
|
|
4332
4332
|
let i = n.filename || "Attachment", a;
|
|
4333
4333
|
return t[4] === i ? a = t[5] : (a = /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
4334
4334
|
className: "flex flex-row gap-1 items-center text-xs",
|
|
4335
4335
|
children: [r, i]
|
|
4336
4336
|
}), t[4] = i, t[5] = a), a;
|
|
4337
|
-
},
|
|
4337
|
+
}, no = (e) => {
|
|
4338
4338
|
let t = (0, L.c)(15), { icon: n, title: r, subtitle: i, href: a } = e, o;
|
|
4339
4339
|
t[0] === r ? o = t[1] : (o = /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
4340
4340
|
className: "truncate font-medium",
|
|
@@ -4376,8 +4376,8 @@ var eo = (e) => {
|
|
|
4376
4376
|
};
|
|
4377
4377
|
//#endregion
|
|
4378
4378
|
//#region src/components/chat/chat-markdown.tsx
|
|
4379
|
-
function
|
|
4380
|
-
let t = (0, L.c)(3), { content: n } = e, r =
|
|
4379
|
+
function ro(e) {
|
|
4380
|
+
let t = (0, L.c)(3), { content: n } = e, r = Ze(ut)?.mode, i = r !== "agent" && r !== "code_mode", a;
|
|
4381
4381
|
return t[0] !== n || t[1] !== i ? (a = /* @__PURE__ */ (0, Z.jsx)(ne, {
|
|
4382
4382
|
content: n,
|
|
4383
4383
|
allowNotebookInsertion: i
|
|
@@ -4385,17 +4385,17 @@ function no(e) {
|
|
|
4385
4385
|
}
|
|
4386
4386
|
//#endregion
|
|
4387
4387
|
//#region src/components/chat/tool-call/shared.ts
|
|
4388
|
-
var
|
|
4388
|
+
var io = /* @__PURE__ */ new Set([
|
|
4389
4389
|
"input-streaming",
|
|
4390
4390
|
"input-available",
|
|
4391
4391
|
"approval-responded"
|
|
4392
4392
|
]);
|
|
4393
|
-
function
|
|
4393
|
+
function ao(e) {
|
|
4394
4394
|
return e.replace("tool-", "");
|
|
4395
4395
|
}
|
|
4396
4396
|
//#endregion
|
|
4397
4397
|
//#region src/components/chat/tool-call/tool-args.tsx
|
|
4398
|
-
var
|
|
4398
|
+
var oo = (e) => {
|
|
4399
4399
|
let t = (0, L.c)(9), { input: n, label: r } = e, i = r === void 0 ? "Tool Request" : r;
|
|
4400
4400
|
if (n == null) return null;
|
|
4401
4401
|
let a;
|
|
@@ -4415,20 +4415,20 @@ var ao = (e) => {
|
|
|
4415
4415
|
className: "space-y-2",
|
|
4416
4416
|
children: [a, s]
|
|
4417
4417
|
}), t[6] = a, t[7] = s, t[8] = c) : c = t[8], c;
|
|
4418
|
-
},
|
|
4418
|
+
}, so = (e) => {
|
|
4419
4419
|
let t = (0, L.c)(27), { toolName: n, input: i, approval: o, onApprove: s, className: c } = e, l;
|
|
4420
4420
|
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);
|
|
4421
4421
|
let u;
|
|
4422
|
-
t[2] === n ? u = t[3] : (u =
|
|
4422
|
+
t[2] === n ? u = t[3] : (u = ao(n), t[2] = n, t[3] = u);
|
|
4423
4423
|
let d = `Approval required for ${u}`, f;
|
|
4424
|
-
t[4] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ (0, Z.jsx)(
|
|
4424
|
+
t[4] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ (0, Z.jsx)(Qt, { className: "h-4 w-4 text-(--amber-11) mt-0.5 shrink-0" }), t[4] = f) : f = t[4];
|
|
4425
4425
|
let p;
|
|
4426
4426
|
t[5] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ (0, Z.jsx)("span", {
|
|
4427
4427
|
className: "font-semibold",
|
|
4428
4428
|
children: "Approval required:"
|
|
4429
4429
|
}), t[5] = p) : p = t[5];
|
|
4430
4430
|
let m;
|
|
4431
|
-
t[6] === n ? m = t[7] : (m =
|
|
4431
|
+
t[6] === n ? m = t[7] : (m = ao(n), t[6] = n, t[7] = m);
|
|
4432
4432
|
let h;
|
|
4433
4433
|
t[8] === m ? h = t[9] : (h = /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
4434
4434
|
className: "flex items-start gap-2",
|
|
@@ -4445,7 +4445,7 @@ var ao = (e) => {
|
|
|
4445
4445
|
})]
|
|
4446
4446
|
}), t[8] = m, t[9] = h);
|
|
4447
4447
|
let g;
|
|
4448
|
-
t[10] === i ? g = t[11] : (g = /* @__PURE__ */ (0, Z.jsx)(
|
|
4448
|
+
t[10] === i ? g = t[11] : (g = /* @__PURE__ */ (0, Z.jsx)(oo, { input: i }), t[10] = i, t[11] = g);
|
|
4449
4449
|
let _;
|
|
4450
4450
|
t[12] !== o.id || t[13] !== s ? (_ = /* @__PURE__ */ (0, Z.jsx)(a, {
|
|
4451
4451
|
size: "xs",
|
|
@@ -4481,31 +4481,31 @@ var ao = (e) => {
|
|
|
4481
4481
|
y
|
|
4482
4482
|
]
|
|
4483
4483
|
}), t[21] = l, t[22] = y, t[23] = d, t[24] = h, t[25] = g, t[26] = b) : b = t[26], b;
|
|
4484
|
-
},
|
|
4484
|
+
}, co = {
|
|
4485
4485
|
get_marimo_rules: {
|
|
4486
4486
|
running: "Reading marimo guidelines",
|
|
4487
4487
|
done: "Read marimo guidelines",
|
|
4488
|
-
icon:
|
|
4488
|
+
icon: zt
|
|
4489
4489
|
},
|
|
4490
4490
|
get_active_notebooks: {
|
|
4491
4491
|
running: "Listing notebooks",
|
|
4492
4492
|
done: "Listed notebooks",
|
|
4493
|
-
icon:
|
|
4493
|
+
icon: Kt
|
|
4494
4494
|
},
|
|
4495
4495
|
get_lightweight_cell_map: {
|
|
4496
4496
|
running: "Reading notebook",
|
|
4497
4497
|
done: "Read notebook",
|
|
4498
|
-
icon:
|
|
4498
|
+
icon: Wt
|
|
4499
4499
|
},
|
|
4500
4500
|
get_cell_runtime_data: {
|
|
4501
4501
|
running: "Inspecting cells",
|
|
4502
4502
|
done: "Inspected cells",
|
|
4503
|
-
icon:
|
|
4503
|
+
icon: Yt
|
|
4504
4504
|
},
|
|
4505
4505
|
get_cell_outputs: {
|
|
4506
4506
|
running: "Reading cell outputs",
|
|
4507
4507
|
done: "Read cell outputs",
|
|
4508
|
-
icon:
|
|
4508
|
+
icon: Yt
|
|
4509
4509
|
},
|
|
4510
4510
|
get_tables_and_variables: {
|
|
4511
4511
|
running: "Reading variables",
|
|
@@ -4520,19 +4520,19 @@ var ao = (e) => {
|
|
|
4520
4520
|
get_notebook_errors: {
|
|
4521
4521
|
running: "Checking for errors",
|
|
4522
4522
|
done: "Checked for errors",
|
|
4523
|
-
icon:
|
|
4523
|
+
icon: Ht
|
|
4524
4524
|
},
|
|
4525
4525
|
lint_notebook: {
|
|
4526
4526
|
running: "Linting notebook",
|
|
4527
4527
|
done: "Linted notebook",
|
|
4528
|
-
icon:
|
|
4528
|
+
icon: Gt
|
|
4529
4529
|
},
|
|
4530
4530
|
get_cell_dependency_graph: {
|
|
4531
4531
|
running: "Reading dependency graph",
|
|
4532
4532
|
done: "Read dependency graph",
|
|
4533
4533
|
icon: b
|
|
4534
4534
|
}
|
|
4535
|
-
},
|
|
4535
|
+
}, lo = {
|
|
4536
4536
|
add_cell: {
|
|
4537
4537
|
running: "Adding cell",
|
|
4538
4538
|
done: "Added cell",
|
|
@@ -4541,7 +4541,7 @@ var ao = (e) => {
|
|
|
4541
4541
|
update_cell: {
|
|
4542
4542
|
running: "Editing cell",
|
|
4543
4543
|
done: "Edited cell",
|
|
4544
|
-
icon:
|
|
4544
|
+
icon: Be
|
|
4545
4545
|
},
|
|
4546
4546
|
delete_cell: {
|
|
4547
4547
|
running: "Deleting cell",
|
|
@@ -4549,30 +4549,30 @@ var ao = (e) => {
|
|
|
4549
4549
|
icon: y
|
|
4550
4550
|
}
|
|
4551
4551
|
};
|
|
4552
|
-
function
|
|
4553
|
-
let r =
|
|
4552
|
+
function uo(e, t, n) {
|
|
4553
|
+
let r = ao(e);
|
|
4554
4554
|
if (r === "execute_code") return {
|
|
4555
4555
|
label: n === "running" ? "Running code" : "Ran code",
|
|
4556
|
-
detail:
|
|
4556
|
+
detail: mo(t) ? po(t.code) : void 0,
|
|
4557
4557
|
icon: u
|
|
4558
4558
|
};
|
|
4559
4559
|
if (r === "edit_notebook_tool") {
|
|
4560
|
-
let e =
|
|
4560
|
+
let e = fo(t);
|
|
4561
4561
|
if (e) {
|
|
4562
|
-
let t =
|
|
4562
|
+
let t = lo[e.type];
|
|
4563
4563
|
return {
|
|
4564
4564
|
label: t[n],
|
|
4565
|
-
detail:
|
|
4565
|
+
detail: po(e.code),
|
|
4566
4566
|
icon: t.icon
|
|
4567
4567
|
};
|
|
4568
4568
|
}
|
|
4569
4569
|
return {
|
|
4570
4570
|
label: n === "running" ? "Editing notebook" : "Edited notebook",
|
|
4571
|
-
icon:
|
|
4571
|
+
icon: Be
|
|
4572
4572
|
};
|
|
4573
4573
|
}
|
|
4574
|
-
if (Object.hasOwn(
|
|
4575
|
-
let e =
|
|
4574
|
+
if (Object.hasOwn(co, r)) {
|
|
4575
|
+
let e = co[r];
|
|
4576
4576
|
return {
|
|
4577
4577
|
label: e[n],
|
|
4578
4578
|
icon: e.icon
|
|
@@ -4584,35 +4584,35 @@ function lo(e, t, n) {
|
|
|
4584
4584
|
icon: p
|
|
4585
4585
|
};
|
|
4586
4586
|
}
|
|
4587
|
-
function
|
|
4588
|
-
if (!
|
|
4587
|
+
function fo(e) {
|
|
4588
|
+
if (!mo(e) || !mo(e.edit)) return;
|
|
4589
4589
|
let { type: t, code: n } = e.edit;
|
|
4590
|
-
if (typeof t == "string" && Object.hasOwn(
|
|
4590
|
+
if (typeof t == "string" && Object.hasOwn(lo, t)) return {
|
|
4591
4591
|
type: t,
|
|
4592
4592
|
code: typeof n == "string" ? n : void 0
|
|
4593
4593
|
};
|
|
4594
4594
|
}
|
|
4595
|
-
function
|
|
4595
|
+
function po(e) {
|
|
4596
4596
|
if (typeof e != "string") return;
|
|
4597
4597
|
let t = e.split("\n").map((e) => e.trim()).filter((e) => e.length > 0);
|
|
4598
4598
|
return t.find((e) => !/^(import\s|from\s|#)/.test(e)) ?? t[0];
|
|
4599
4599
|
}
|
|
4600
|
-
function
|
|
4600
|
+
function mo(e) {
|
|
4601
4601
|
return typeof e == "object" && !!e;
|
|
4602
4602
|
}
|
|
4603
4603
|
//#endregion
|
|
4604
4604
|
//#region src/components/chat/tool-call/tool-result.tsx
|
|
4605
|
-
function
|
|
4606
|
-
return e == null || typeof e == "object" &&
|
|
4607
|
-
}
|
|
4608
|
-
var
|
|
4609
|
-
status:
|
|
4610
|
-
auth_required:
|
|
4611
|
-
action_url:
|
|
4612
|
-
next_steps:
|
|
4613
|
-
meta:
|
|
4614
|
-
message:
|
|
4615
|
-
}),
|
|
4605
|
+
function ho(e) {
|
|
4606
|
+
return e == null || typeof e == "object" && gt(e);
|
|
4607
|
+
}
|
|
4608
|
+
var go = rt({
|
|
4609
|
+
status: it().default("success"),
|
|
4610
|
+
auth_required: qe().default(!1),
|
|
4611
|
+
action_url: Qe().optional(),
|
|
4612
|
+
next_steps: Qe().optional(),
|
|
4613
|
+
meta: Qe().optional(),
|
|
4614
|
+
message: it().nullish()
|
|
4615
|
+
}), _o = (e) => {
|
|
4616
4616
|
let t = (0, L.c)(12), { data: n } = e, r;
|
|
4617
4617
|
if (t[0] !== n) {
|
|
4618
4618
|
let { status: e, auth_required: i, action_url: a, meta: o, next_steps: s, message: c, ...l } = n, u;
|
|
@@ -4652,19 +4652,19 @@ var ho = nt({
|
|
|
4652
4652
|
m,
|
|
4653
4653
|
l && /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
4654
4654
|
className: "space-y-3",
|
|
4655
|
-
children: Object.entries(l).map(
|
|
4655
|
+
children: Object.entries(l).map(yo)
|
|
4656
4656
|
})
|
|
4657
4657
|
]
|
|
4658
4658
|
}), t[0] = n, t[1] = r;
|
|
4659
4659
|
} else r = t[1];
|
|
4660
4660
|
return r;
|
|
4661
|
-
},
|
|
4661
|
+
}, vo = (e) => {
|
|
4662
4662
|
let t = (0, L.c)(8), { result: n } = e, r;
|
|
4663
|
-
t[0] === n ? r = t[1] : (r =
|
|
4663
|
+
t[0] === n ? r = t[1] : (r = go.safeParse(n), t[0] = n, t[1] = r);
|
|
4664
4664
|
let i = r;
|
|
4665
4665
|
if (i.success) {
|
|
4666
4666
|
let e;
|
|
4667
|
-
return t[2] === i.data ? e = t[3] : (e = /* @__PURE__ */ (0, Z.jsx)(
|
|
4667
|
+
return t[2] === i.data ? e = t[3] : (e = /* @__PURE__ */ (0, Z.jsx)(_o, { data: i.data }), t[2] = i.data, t[3] = e), e;
|
|
4668
4668
|
}
|
|
4669
4669
|
let a;
|
|
4670
4670
|
t[4] === n ? a = t[5] : (a = typeof n == "string" ? n : JSON.stringify(n, null, 2), t[4] = n, t[5] = a);
|
|
@@ -4674,9 +4674,9 @@ var ho = nt({
|
|
|
4674
4674
|
children: a
|
|
4675
4675
|
}), t[6] = a, t[7] = o), o;
|
|
4676
4676
|
};
|
|
4677
|
-
function
|
|
4677
|
+
function yo(e) {
|
|
4678
4678
|
let [t, n] = e;
|
|
4679
|
-
return
|
|
4679
|
+
return ho(n) ? null : /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
4680
4680
|
className: "space-y-1.5",
|
|
4681
4681
|
children: [/* @__PURE__ */ (0, Z.jsx)("span", {
|
|
4682
4682
|
className: "text-xs text-muted-foreground",
|
|
@@ -4689,13 +4689,13 @@ function vo(e) {
|
|
|
4689
4689
|
}
|
|
4690
4690
|
//#endregion
|
|
4691
4691
|
//#region src/components/chat/tool-call/tool-step.tsx
|
|
4692
|
-
var
|
|
4692
|
+
var bo = (e) => {
|
|
4693
4693
|
let t = (0, L.c)(58), { toolName: n, state: i, input: a, result: o, errorText: s, approval: c, isActive: l, className: u } = e, d = l === void 0 || l, [f, p] = X.useState(!1), m, h, g, _, v, y, b, x, S, C, w;
|
|
4694
4694
|
if (t[0] !== u || t[1] !== a || t[2] !== d || t[3] !== f || t[4] !== i || t[5] !== n) {
|
|
4695
|
-
let e =
|
|
4696
|
-
g = o, h = s, _ =
|
|
4695
|
+
let e = io.has(i), { label: o, detail: s, icon: c } = uo(n, a, e ? "running" : "done");
|
|
4696
|
+
g = o, h = s, _ = xo(i, e && !d, c);
|
|
4697
4697
|
let l = i === "output-error";
|
|
4698
|
-
t[17] === u ? w = t[18] : (w = r("w-full", u), t[17] = u, t[18] = w), b = "button", t[19] === Symbol.for("react.memo_cache_sentinel") ? (x = () => p(
|
|
4698
|
+
t[17] === u ? w = t[18] : (w = r("w-full", u), t[17] = u, t[18] = w), b = "button", t[19] === Symbol.for("react.memo_cache_sentinel") ? (x = () => p(Co), t[19] = x) : x = t[19], S = f;
|
|
4699
4699
|
let T = f && "text-foreground", E = l && "text-(--red-11) hover:bg-(--red-3) hover:text-(--red-11)";
|
|
4700
4700
|
t[20] !== T || t[21] !== E ? (C = r("group/step -mx-1.5 flex w-fit max-w-full min-w-0 items-center gap-1.5 rounded-md px-1.5 py-0.5 text-left text-xs leading-4 text-muted-foreground transition-colors hover:bg-foreground/6 hover:text-foreground focus-visible:outline-1 focus-visible:outline-(--slate-8)", T, E), t[20] = T, t[21] = E, t[22] = C) : C = t[22], m = _.icon, v = !0, y = r("-ml-px size-3 shrink-0", _.spinning && "animate-spin"), t[0] = u, t[1] = a, t[2] = d, t[3] = f, t[4] = i, t[5] = n, t[6] = m, t[7] = h, t[8] = g, t[9] = _, t[10] = v, t[11] = y, t[12] = b, t[13] = x, t[14] = S, t[15] = C, t[16] = w;
|
|
4701
4701
|
} else m = t[6], h = t[7], g = t[8], _ = t[9], v = t[10], y = t[11], b = t[12], x = t[13], S = t[14], C = t[15], w = t[16];
|
|
@@ -4741,7 +4741,7 @@ var yo = (e) => {
|
|
|
4741
4741
|
]
|
|
4742
4742
|
}), t[37] = E, t[38] = D, t[39] = O, t[40] = j, t[41] = b, t[42] = x, t[43] = S, t[44] = C, t[45] = T, t[46] = M) : M = t[46];
|
|
4743
4743
|
let N;
|
|
4744
|
-
t[47] !== c || t[48] !== s || t[49] !== a || t[50] !== f || t[51] !== o || t[52] !== i ? (N = f && /* @__PURE__ */ (0, Z.jsx)(
|
|
4744
|
+
t[47] !== c || t[48] !== s || t[49] !== a || t[50] !== f || t[51] !== o || t[52] !== i ? (N = f && /* @__PURE__ */ (0, Z.jsx)(So, {
|
|
4745
4745
|
state: i,
|
|
4746
4746
|
input: a,
|
|
4747
4747
|
result: o,
|
|
@@ -4754,9 +4754,9 @@ var yo = (e) => {
|
|
|
4754
4754
|
children: [M, N]
|
|
4755
4755
|
}), t[54] = M, t[55] = N, t[56] = w, t[57] = P) : P = t[57], P;
|
|
4756
4756
|
};
|
|
4757
|
-
function
|
|
4757
|
+
function xo(e, t, n) {
|
|
4758
4758
|
if (t) return {
|
|
4759
|
-
icon:
|
|
4759
|
+
icon: Ut,
|
|
4760
4760
|
suffix: "Stopped"
|
|
4761
4761
|
};
|
|
4762
4762
|
switch (e) {
|
|
@@ -4765,7 +4765,7 @@ function bo(e, t, n) {
|
|
|
4765
4765
|
suffix: "Failed"
|
|
4766
4766
|
};
|
|
4767
4767
|
case "output-denied": return {
|
|
4768
|
-
icon:
|
|
4768
|
+
icon: Rt,
|
|
4769
4769
|
suffix: "Denied"
|
|
4770
4770
|
};
|
|
4771
4771
|
case "output-available": return { icon: n };
|
|
@@ -4775,11 +4775,11 @@ function bo(e, t, n) {
|
|
|
4775
4775
|
};
|
|
4776
4776
|
}
|
|
4777
4777
|
}
|
|
4778
|
-
var
|
|
4778
|
+
var So = (e) => {
|
|
4779
4779
|
let t = (0, L.c)(16), { state: n, input: r, result: i, errorText: a, approval: o } = e, s;
|
|
4780
|
-
t[0] === r ? s = t[1] : (s = /* @__PURE__ */ (0, Z.jsx)(
|
|
4780
|
+
t[0] === r ? s = t[1] : (s = /* @__PURE__ */ (0, Z.jsx)(oo, { input: r }), t[0] = r, t[1] = s);
|
|
4781
4781
|
let c;
|
|
4782
|
-
t[2] !== i || t[3] !== n ? (c = n === "output-available" && i != null && /* @__PURE__ */ (0, Z.jsx)(
|
|
4782
|
+
t[2] !== i || t[3] !== n ? (c = n === "output-available" && i != null && /* @__PURE__ */ (0, Z.jsx)(vo, { result: i }), t[2] = i, t[3] = n, t[4] = c) : c = t[4];
|
|
4783
4783
|
let l;
|
|
4784
4784
|
t[5] !== a || t[6] !== n ? (l = n === "output-error" && a && /* @__PURE__ */ (0, Z.jsx)("pre", {
|
|
4785
4785
|
className: "max-h-64 overflow-auto rounded border border-(--red-6) bg-(--red-2) p-2 text-xs leading-relaxed whitespace-pre-wrap text-(--red-11) scrollbar-thin",
|
|
@@ -4801,43 +4801,43 @@ var xo = (e) => {
|
|
|
4801
4801
|
]
|
|
4802
4802
|
}), t[11] = s, t[12] = c, t[13] = l, t[14] = u, t[15] = d) : d = t[15], d;
|
|
4803
4803
|
};
|
|
4804
|
-
function
|
|
4804
|
+
function Co(e) {
|
|
4805
4805
|
return !e;
|
|
4806
4806
|
}
|
|
4807
4807
|
//#endregion
|
|
4808
4808
|
//#region src/components/chat/tool-call/tool-call-view.tsx
|
|
4809
|
-
var
|
|
4809
|
+
var wo = (e) => {
|
|
4810
4810
|
let t = (0, L.c)(16), n, r, i, a, o;
|
|
4811
4811
|
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") {
|
|
4812
4812
|
let e;
|
|
4813
|
-
return t[6] !== n || t[7] !== r || t[8] !== i || t[9] !== o ? (e = n != null && r != null ? /* @__PURE__ */ (0, Z.jsx)(
|
|
4813
|
+
return t[6] !== n || t[7] !== r || t[8] !== i || t[9] !== o ? (e = n != null && r != null ? /* @__PURE__ */ (0, Z.jsx)(so, {
|
|
4814
4814
|
toolName: o,
|
|
4815
4815
|
input: i.input,
|
|
4816
4816
|
approval: n,
|
|
4817
4817
|
onApprove: r,
|
|
4818
4818
|
className: i.className
|
|
4819
|
-
}) : /* @__PURE__ */ (0, Z.jsx)(
|
|
4819
|
+
}) : /* @__PURE__ */ (0, Z.jsx)(bo, {
|
|
4820
4820
|
...i,
|
|
4821
4821
|
toolName: o,
|
|
4822
4822
|
state: "input-available"
|
|
4823
4823
|
}), t[6] = n, t[7] = r, t[8] = i, t[9] = o, t[10] = e) : e = t[10], e;
|
|
4824
4824
|
}
|
|
4825
4825
|
let s;
|
|
4826
|
-
return t[11] !== n || t[12] !== i || t[13] !== a || t[14] !== o ? (s = /* @__PURE__ */ (0, Z.jsx)(
|
|
4826
|
+
return t[11] !== n || t[12] !== i || t[13] !== a || t[14] !== o ? (s = /* @__PURE__ */ (0, Z.jsx)(bo, {
|
|
4827
4827
|
...i,
|
|
4828
4828
|
toolName: o,
|
|
4829
4829
|
state: a,
|
|
4830
4830
|
approval: n
|
|
4831
4831
|
}), t[11] = n, t[12] = i, t[13] = a, t[14] = o, t[15] = s) : s = t[15], s;
|
|
4832
|
-
},
|
|
4833
|
-
let a = n && t, { work: o, rest: s } =
|
|
4832
|
+
}, To = ({ message: e, isLast: t, isActive: n, turnStartedAt: r, addToolApprovalResponse: i }) => {
|
|
4833
|
+
let a = n && t, { work: o, rest: s } = Eo(e.parts), c = [];
|
|
4834
4834
|
if (o.length > 0 || a && s.length === 0) {
|
|
4835
|
-
let t = o.flatMap(({ part: e }) =>
|
|
4836
|
-
c.push(/* @__PURE__ */ (0, Z.jsx)(
|
|
4835
|
+
let t = o.flatMap(({ part: e }) => ko(e) ? [e] : []), n = a && r != null ? { startedAt: r } : Ta(e);
|
|
4836
|
+
c.push(/* @__PURE__ */ (0, Z.jsx)(Da, {
|
|
4837
4837
|
running: a,
|
|
4838
4838
|
thinking: s.length === 0 && (o.length === 0 || o.at(-1)?.part.type === "reasoning"),
|
|
4839
|
-
interrupted: !a && (n?.stopped === !0 || t.some((e) =>
|
|
4840
|
-
defaultOpen: !s.some(({ part: e }) => !
|
|
4839
|
+
interrupted: !a && (n?.stopped === !0 || t.some((e) => io.has(e.state))),
|
|
4840
|
+
defaultOpen: !s.some(({ part: e }) => !Do(e)),
|
|
4841
4841
|
timing: n,
|
|
4842
4842
|
toolCount: t.length,
|
|
4843
4843
|
failedCount: t.filter((e) => e.state === "output-error").length,
|
|
@@ -4847,7 +4847,7 @@ var Co = (e) => {
|
|
|
4847
4847
|
for (let { part: e, index: t } of s) c.push(l(e, t, !1));
|
|
4848
4848
|
return c;
|
|
4849
4849
|
function l(e, t, n) {
|
|
4850
|
-
if (
|
|
4850
|
+
if (Ao(e) || e.type === "dynamic-tool") return /* @__PURE__ */ (0, Z.jsx)(wo, {
|
|
4851
4851
|
toolName: e.type === "dynamic-tool" ? e.toolName : e.type,
|
|
4852
4852
|
result: e.output,
|
|
4853
4853
|
errorText: e.state === "output-error" ? e.errorText : void 0,
|
|
@@ -4858,15 +4858,15 @@ var Co = (e) => {
|
|
|
4858
4858
|
isActive: a,
|
|
4859
4859
|
className: n ? void 0 : "my-1"
|
|
4860
4860
|
}, t);
|
|
4861
|
-
if (
|
|
4861
|
+
if (jo(e)) return null;
|
|
4862
4862
|
switch (e.type) {
|
|
4863
4863
|
case "text": return e.text.includes("<marimo-") ? /* @__PURE__ */ (0, Z.jsx)(X.Fragment, { children: v({ html: e.text }) }, t) : /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
4864
4864
|
className: n ? "py-1.5" : void 0,
|
|
4865
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
4865
|
+
children: /* @__PURE__ */ (0, Z.jsx)(ro, { content: e.text })
|
|
4866
4866
|
}, t);
|
|
4867
4867
|
case "reasoning": return /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
4868
4868
|
className: "flex gap-1.5 py-1.5 text-muted-foreground",
|
|
4869
|
-
children: [/* @__PURE__ */ (0, Z.jsx)(
|
|
4869
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(Vt, {
|
|
4870
4870
|
"aria-hidden": !0,
|
|
4871
4871
|
className: "-ml-px mt-1 size-3 shrink-0"
|
|
4872
4872
|
}), /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
@@ -4874,22 +4874,22 @@ var Co = (e) => {
|
|
|
4874
4874
|
children: [/* @__PURE__ */ (0, Z.jsx)("span", {
|
|
4875
4875
|
className: "sr-only",
|
|
4876
4876
|
children: "Reasoning: "
|
|
4877
|
-
}), /* @__PURE__ */ (0, Z.jsx)(
|
|
4877
|
+
}), /* @__PURE__ */ (0, Z.jsx)(ro, { content: e.text })]
|
|
4878
4878
|
})]
|
|
4879
4879
|
}, t);
|
|
4880
|
-
case "file": return /* @__PURE__ */ (0, Z.jsx)(
|
|
4881
|
-
case "reasoning-file": return /* @__PURE__ */ (0, Z.jsx)(
|
|
4880
|
+
case "file": return /* @__PURE__ */ (0, Z.jsx)(to, { attachment: e }, t);
|
|
4881
|
+
case "reasoning-file": return /* @__PURE__ */ (0, Z.jsx)(to, { attachment: {
|
|
4882
4882
|
type: "file",
|
|
4883
4883
|
mediaType: e.mediaType,
|
|
4884
4884
|
url: e.url
|
|
4885
4885
|
} }, t);
|
|
4886
|
-
case "source-document": return /* @__PURE__ */ (0, Z.jsx)(
|
|
4886
|
+
case "source-document": return /* @__PURE__ */ (0, Z.jsx)(no, {
|
|
4887
4887
|
icon: /* @__PURE__ */ (0, Z.jsx)(x, { className: "h-3 w-3 shrink-0" }),
|
|
4888
4888
|
title: e.title,
|
|
4889
4889
|
subtitle: e.filename
|
|
4890
4890
|
}, t);
|
|
4891
|
-
case "source-url": return /* @__PURE__ */ (0, Z.jsx)(
|
|
4892
|
-
icon: /* @__PURE__ */ (0, Z.jsx)(
|
|
4891
|
+
case "source-url": return /* @__PURE__ */ (0, Z.jsx)(no, {
|
|
4892
|
+
icon: /* @__PURE__ */ (0, Z.jsx)(De, { className: "h-3 w-3 shrink-0" }),
|
|
4893
4893
|
title: e.title ?? e.url,
|
|
4894
4894
|
subtitle: e.title ? e.url : void 0,
|
|
4895
4895
|
href: e.url
|
|
@@ -4899,48 +4899,48 @@ var Co = (e) => {
|
|
|
4899
4899
|
children: e.kind
|
|
4900
4900
|
}, t);
|
|
4901
4901
|
case "step-start": return null;
|
|
4902
|
-
default: return
|
|
4902
|
+
default: return Ve(e), null;
|
|
4903
4903
|
}
|
|
4904
4904
|
}
|
|
4905
4905
|
};
|
|
4906
|
-
function
|
|
4906
|
+
function Eo(e) {
|
|
4907
4907
|
let t = e.map((e, t) => ({
|
|
4908
4908
|
part: e,
|
|
4909
4909
|
index: t
|
|
4910
|
-
})).filter(({ part: e }) =>
|
|
4910
|
+
})).filter(({ part: e }) => Oo(e)), n = t.findLastIndex(({ part: e }) => e.type === "reasoning" || ko(e) && !Do(e));
|
|
4911
4911
|
return {
|
|
4912
|
-
work: t.filter(({ part: e }, t) => t <= n && !
|
|
4913
|
-
rest: t.filter(({ part: e }, t) => t > n ||
|
|
4912
|
+
work: t.filter(({ part: e }, t) => t <= n && !Do(e)),
|
|
4913
|
+
rest: t.filter(({ part: e }, t) => t > n || Do(e))
|
|
4914
4914
|
};
|
|
4915
4915
|
}
|
|
4916
|
-
function Eo(e) {
|
|
4917
|
-
return Oo(e) && e.state === "approval-requested";
|
|
4918
|
-
}
|
|
4919
4916
|
function Do(e) {
|
|
4917
|
+
return ko(e) && e.state === "approval-requested";
|
|
4918
|
+
}
|
|
4919
|
+
function Oo(e) {
|
|
4920
4920
|
switch (e.type) {
|
|
4921
4921
|
case "step-start": return !1;
|
|
4922
4922
|
case "text": return e.text.trim().length > 0;
|
|
4923
4923
|
case "reasoning": return e.text.trim().length > 0;
|
|
4924
|
-
default: return !
|
|
4924
|
+
default: return !jo(e);
|
|
4925
4925
|
}
|
|
4926
4926
|
}
|
|
4927
|
-
function Oo(e) {
|
|
4928
|
-
return ko(e) || e.type === "dynamic-tool";
|
|
4929
|
-
}
|
|
4930
4927
|
function ko(e) {
|
|
4931
|
-
return e.type
|
|
4928
|
+
return Ao(e) || e.type === "dynamic-tool";
|
|
4932
4929
|
}
|
|
4933
4930
|
function Ao(e) {
|
|
4931
|
+
return e.type.startsWith("tool-");
|
|
4932
|
+
}
|
|
4933
|
+
function jo(e) {
|
|
4934
4934
|
return e.type.startsWith("data-");
|
|
4935
4935
|
}
|
|
4936
4936
|
//#endregion
|
|
4937
4937
|
//#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
|
|
4938
|
-
function
|
|
4939
|
-
return
|
|
4938
|
+
function Mo(e) {
|
|
4939
|
+
return Tt.define({ combine: (t) => t[0] ?? e });
|
|
4940
4940
|
}
|
|
4941
4941
|
//#endregion
|
|
4942
4942
|
//#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
|
|
4943
|
-
var
|
|
4943
|
+
var No = Mo({}), Po = bt.define(), Fo = bt.define(), Io = 50, Lo = yt.define({
|
|
4944
4944
|
create() {
|
|
4945
4945
|
return {
|
|
4946
4946
|
prompts: [],
|
|
@@ -4950,15 +4950,15 @@ var Mo = jo({}), No = yt.define(), Po = yt.define(), Fo = 50, Io = vt.define({
|
|
|
4950
4950
|
},
|
|
4951
4951
|
update(e, t) {
|
|
4952
4952
|
let n = { ...e };
|
|
4953
|
-
t.docChanged && e.navigationIndex !== -1 && (t.effects.some((e) => e.is(
|
|
4954
|
-
for (let r of t.effects) if (r.is(
|
|
4953
|
+
t.docChanged && e.navigationIndex !== -1 && (t.effects.some((e) => e.is(Fo) || e.is(Po)) || (n.navigationIndex = -1, n.originalText = ""));
|
|
4954
|
+
for (let r of t.effects) if (r.is(Po)) {
|
|
4955
4955
|
let i = r.value.trim();
|
|
4956
|
-
i && (n.prompts = [i, ...e.prompts.filter((e) => e !== i)].slice(0,
|
|
4957
|
-
} else r.is(
|
|
4956
|
+
i && (n.prompts = [i, ...e.prompts.filter((e) => e !== i)].slice(0, Io), t.state.facet(No).save?.(n.prompts)), n.navigationIndex = -1, n.originalText = "";
|
|
4957
|
+
} else r.is(Fo) && (n.navigationIndex = r.value.index, n.originalText = r.value.originalText);
|
|
4958
4958
|
return n;
|
|
4959
4959
|
}
|
|
4960
|
-
}),
|
|
4961
|
-
let t = e.state.field(
|
|
4960
|
+
}), Ro = (e) => {
|
|
4961
|
+
let t = e.state.field(Lo), n = e.state.doc;
|
|
4962
4962
|
if (t.prompts.length === 0) return !1;
|
|
4963
4963
|
let r, i = t.originalText;
|
|
4964
4964
|
if (t.navigationIndex === -1) {
|
|
@@ -4972,13 +4972,13 @@ var Mo = jo({}), No = yt.define(), Po = yt.define(), Fo = 50, Io = vt.define({
|
|
|
4972
4972
|
to: e.state.doc.length,
|
|
4973
4973
|
insert: a
|
|
4974
4974
|
},
|
|
4975
|
-
effects:
|
|
4975
|
+
effects: Fo.of({
|
|
4976
4976
|
index: r,
|
|
4977
4977
|
originalText: i
|
|
4978
4978
|
})
|
|
4979
4979
|
}), !0;
|
|
4980
|
-
},
|
|
4981
|
-
let t = e.state.field(
|
|
4980
|
+
}, zo = (e) => {
|
|
4981
|
+
let t = e.state.field(Lo);
|
|
4982
4982
|
if (t.navigationIndex === -1) return !1;
|
|
4983
4983
|
let n, r;
|
|
4984
4984
|
return t.navigationIndex === 0 ? (n = t.originalText, r = -1) : (r = t.navigationIndex - 1, n = t.prompts[r] ?? ""), e.dispatch({
|
|
@@ -4987,41 +4987,41 @@ var Mo = jo({}), No = yt.define(), Po = yt.define(), Fo = 50, Io = vt.define({
|
|
|
4987
4987
|
to: e.state.doc.length,
|
|
4988
4988
|
insert: n
|
|
4989
4989
|
},
|
|
4990
|
-
effects:
|
|
4990
|
+
effects: Fo.of({
|
|
4991
4991
|
index: r,
|
|
4992
4992
|
originalText: t.originalText
|
|
4993
4993
|
})
|
|
4994
4994
|
}), !0;
|
|
4995
4995
|
};
|
|
4996
|
-
function
|
|
4997
|
-
let { storage: t, defaultKeymap: n = !0 } = e, r = [
|
|
4996
|
+
function Bo(e = {}) {
|
|
4997
|
+
let { storage: t, defaultKeymap: n = !0 } = e, r = [Lo.init(() => ({
|
|
4998
4998
|
prompts: t?.load?.() ?? [],
|
|
4999
4999
|
navigationIndex: -1,
|
|
5000
5000
|
originalText: ""
|
|
5001
|
-
})),
|
|
5002
|
-
return n && r.push(
|
|
5001
|
+
})), No.of(t ?? {})];
|
|
5002
|
+
return n && r.push(Ot.of([{
|
|
5003
5003
|
key: "ArrowUp",
|
|
5004
|
-
run:
|
|
5004
|
+
run: Ro
|
|
5005
5005
|
}, {
|
|
5006
5006
|
key: "ArrowDown",
|
|
5007
|
-
run:
|
|
5007
|
+
run: zo
|
|
5008
5008
|
}])), r;
|
|
5009
5009
|
}
|
|
5010
5010
|
//#endregion
|
|
5011
5011
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/state.js
|
|
5012
|
-
var
|
|
5012
|
+
var Vo = bt.define(), Q = yt.define({
|
|
5013
5013
|
create() {
|
|
5014
5014
|
return /* @__PURE__ */ new Map();
|
|
5015
5015
|
},
|
|
5016
5016
|
update(e, t) {
|
|
5017
5017
|
let n = !1, r = e;
|
|
5018
|
-
for (let i of t.effects) if (i.is(
|
|
5018
|
+
for (let i of t.effects) if (i.is(Vo)) {
|
|
5019
5019
|
n ||= (r = new Map(e), !0);
|
|
5020
5020
|
for (let [e, t] of i.value) r.set(e, t);
|
|
5021
5021
|
}
|
|
5022
5022
|
return r;
|
|
5023
5023
|
}
|
|
5024
|
-
}),
|
|
5024
|
+
}), Ho = yt.define({
|
|
5025
5025
|
create() {
|
|
5026
5026
|
return {
|
|
5027
5027
|
onResourceClick: void 0,
|
|
@@ -5033,14 +5033,14 @@ var Bo = yt.define(), Q = vt.define({
|
|
|
5033
5033
|
update(e) {
|
|
5034
5034
|
return e;
|
|
5035
5035
|
}
|
|
5036
|
-
}),
|
|
5037
|
-
|
|
5036
|
+
}), Uo = bt.define();
|
|
5037
|
+
yt.define({
|
|
5038
5038
|
create() {
|
|
5039
5039
|
return /* @__PURE__ */ new Map();
|
|
5040
5040
|
},
|
|
5041
5041
|
update(e, t) {
|
|
5042
5042
|
let n = !1, r = e;
|
|
5043
|
-
for (let i of t.effects) if (i.is(
|
|
5043
|
+
for (let i of t.effects) if (i.is(Uo)) {
|
|
5044
5044
|
n ||= (r = new Map(e), !0);
|
|
5045
5045
|
for (let [e, t] of i.value) r.set(e, t);
|
|
5046
5046
|
}
|
|
@@ -5049,12 +5049,12 @@ vt.define({
|
|
|
5049
5049
|
});
|
|
5050
5050
|
//#endregion
|
|
5051
5051
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/resources/completion.js
|
|
5052
|
-
var
|
|
5052
|
+
var Wo = (e, t) => async (n) => {
|
|
5053
5053
|
let r = n.matchBefore(/@(\w+)?/);
|
|
5054
5054
|
if (!r || r.from === r.to && !n.explicit) return null;
|
|
5055
5055
|
let i = await e();
|
|
5056
5056
|
if (i.length === 0) return null;
|
|
5057
|
-
let a =
|
|
5057
|
+
let a = Vo.of(new Map(i.map((e) => [e.uri, e])));
|
|
5058
5058
|
n.view && n.view.dispatch({ effects: a });
|
|
5059
5059
|
let o = i.map((e) => ({
|
|
5060
5060
|
label: `@${e.name}`,
|
|
@@ -5076,13 +5076,13 @@ var Uo = (e, t) => async (n) => {
|
|
|
5076
5076
|
from: r.from,
|
|
5077
5077
|
options: o
|
|
5078
5078
|
};
|
|
5079
|
-
},
|
|
5079
|
+
}, Go = /@[\w-]+:\/\/(?!\/)[^\s]+/;
|
|
5080
5080
|
function $(e) {
|
|
5081
|
-
return e.matchAll(new RegExp(
|
|
5081
|
+
return e.matchAll(new RegExp(Go.source, "g"));
|
|
5082
5082
|
}
|
|
5083
5083
|
//#endregion
|
|
5084
5084
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/resources/decoration.js
|
|
5085
|
-
var
|
|
5085
|
+
var Ko = class extends wt {
|
|
5086
5086
|
resource;
|
|
5087
5087
|
view;
|
|
5088
5088
|
constructor(e, t) {
|
|
@@ -5094,7 +5094,7 @@ var Go = class extends Ct {
|
|
|
5094
5094
|
toDOM() {
|
|
5095
5095
|
let e = document.createElement("span");
|
|
5096
5096
|
e.className = "cm-resource-widget", e.textContent = `@${this.resource.name}`;
|
|
5097
|
-
let t = this.view.state.field(
|
|
5097
|
+
let t = this.view.state.field(Ho, !1), n = t?.onResourceClick, r = t?.onResourceMouseOver, i = t?.onResourceMouseOut;
|
|
5098
5098
|
return n && (e.style.cursor = "pointer", e.addEventListener("click", (e) => {
|
|
5099
5099
|
e.preventDefault(), e.stopPropagation(), n(this.resource);
|
|
5100
5100
|
})), r && e.addEventListener("mouseover", (e) => {
|
|
@@ -5103,7 +5103,7 @@ var Go = class extends Ct {
|
|
|
5103
5103
|
e.preventDefault(), e.stopPropagation(), i(this.resource);
|
|
5104
5104
|
}), e;
|
|
5105
5105
|
}
|
|
5106
|
-
},
|
|
5106
|
+
}, qo = class extends wt {
|
|
5107
5107
|
uri;
|
|
5108
5108
|
view;
|
|
5109
5109
|
constructor(e, t) {
|
|
@@ -5117,29 +5117,29 @@ var Go = class extends Ct {
|
|
|
5117
5117
|
return e.className = "cm-not-found-resource-widget", e.textContent = `@${this.uri.split("://")[1] ?? this.uri}`, e;
|
|
5118
5118
|
}
|
|
5119
5119
|
};
|
|
5120
|
-
function
|
|
5120
|
+
function Jo(e) {
|
|
5121
5121
|
let t = e.state.field(Q), n = [];
|
|
5122
5122
|
for (let { from: r, to: i } of e.visibleRanges) {
|
|
5123
5123
|
let a = e.state.doc.sliceString(r, i);
|
|
5124
5124
|
for (let i of $(a)) {
|
|
5125
5125
|
let a = r + i.index, o = i[0].slice(1), s = t.get(o);
|
|
5126
|
-
s ? n.push(
|
|
5126
|
+
s ? n.push(At.replace({ widget: new Ko(s, e) }).range(a, a + i[0].length)) : n.push(At.replace({ widget: new qo(o, e) }).range(a, a + i[0].length));
|
|
5127
5127
|
}
|
|
5128
5128
|
}
|
|
5129
|
-
return
|
|
5129
|
+
return At.set(n);
|
|
5130
5130
|
}
|
|
5131
|
-
var
|
|
5131
|
+
var Yo = St.fromClass(class {
|
|
5132
5132
|
decorations;
|
|
5133
5133
|
constructor(e) {
|
|
5134
|
-
this.decorations =
|
|
5134
|
+
this.decorations = Jo(e);
|
|
5135
5135
|
}
|
|
5136
5136
|
update(e) {
|
|
5137
|
-
(e.docChanged || e.viewportChanged || e.transactions.some((e) => e.effects.some((e) => e.is(
|
|
5137
|
+
(e.docChanged || e.viewportChanged || e.transactions.some((e) => e.effects.some((e) => e.is(Vo)))) && (this.decorations = Jo(e.view));
|
|
5138
5138
|
}
|
|
5139
5139
|
}, { decorations: (e) => e.decorations });
|
|
5140
5140
|
//#endregion
|
|
5141
5141
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/resources/hover.js
|
|
5142
|
-
function
|
|
5142
|
+
function Xo(e) {
|
|
5143
5143
|
let t = document.createElement("div");
|
|
5144
5144
|
t.className = "cm-tooltip-cursor";
|
|
5145
5145
|
let n = document.createElement("div");
|
|
@@ -5153,7 +5153,7 @@ function Yo(e) {
|
|
|
5153
5153
|
}
|
|
5154
5154
|
return { dom: t };
|
|
5155
5155
|
}
|
|
5156
|
-
function
|
|
5156
|
+
function Zo(e, t, n, r = 0) {
|
|
5157
5157
|
for (let i of $(e)) {
|
|
5158
5158
|
let e = r + i.index, a = e + i[0].length;
|
|
5159
5159
|
if (t >= e && t <= a) {
|
|
@@ -5167,22 +5167,22 @@ function Xo(e, t, n, r = 0) {
|
|
|
5167
5167
|
}
|
|
5168
5168
|
return null;
|
|
5169
5169
|
}
|
|
5170
|
-
function
|
|
5171
|
-
return
|
|
5172
|
-
let { from: r, text: i } = t.state.doc.lineAt(n), a =
|
|
5170
|
+
function Qo(e) {
|
|
5171
|
+
return Dt((t, n) => {
|
|
5172
|
+
let { from: r, text: i } = t.state.doc.lineAt(n), a = Zo(i, n, t.state.field(Q), r);
|
|
5173
5173
|
return a ? {
|
|
5174
5174
|
pos: a.start,
|
|
5175
5175
|
end: a.end,
|
|
5176
5176
|
above: !0,
|
|
5177
5177
|
create() {
|
|
5178
|
-
return (e.createTooltip ??
|
|
5178
|
+
return (e.createTooltip ?? Xo)(a.resource);
|
|
5179
5179
|
}
|
|
5180
5180
|
} : null;
|
|
5181
5181
|
});
|
|
5182
5182
|
}
|
|
5183
5183
|
//#endregion
|
|
5184
5184
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/resources/input-filter.js
|
|
5185
|
-
function
|
|
5185
|
+
function $o(e, t) {
|
|
5186
5186
|
let n = e.field(Q), r = e.doc, i = r.lineAt(t), a = r.sliceString(i.from, i.to), o = Array.from($(a));
|
|
5187
5187
|
if (o.length === 0) return null;
|
|
5188
5188
|
for (let e of o) {
|
|
@@ -5195,7 +5195,7 @@ function Qo(e, t) {
|
|
|
5195
5195
|
}
|
|
5196
5196
|
return null;
|
|
5197
5197
|
}
|
|
5198
|
-
function
|
|
5198
|
+
function es(e, t) {
|
|
5199
5199
|
let n = e.field(Q), r = e.doc, i = r.lineAt(t).to, a = r.sliceString(t, i), o = Array.from($(a));
|
|
5200
5200
|
if (o.length === 0) return null;
|
|
5201
5201
|
let s = o[0];
|
|
@@ -5207,7 +5207,7 @@ function $o(e, t) {
|
|
|
5207
5207
|
uri: u
|
|
5208
5208
|
} : null;
|
|
5209
5209
|
}
|
|
5210
|
-
function
|
|
5210
|
+
function ts(e, t) {
|
|
5211
5211
|
let n = e.field(Q), r = e.doc, i = r.lineAt(t), a = r.sliceString(i.from, i.to), o = Array.from($(a));
|
|
5212
5212
|
for (let e of o) {
|
|
5213
5213
|
let r = i.from + e.index, a = r + e[0].length, o = e[0].slice(1);
|
|
@@ -5219,7 +5219,7 @@ function es(e, t) {
|
|
|
5219
5219
|
}
|
|
5220
5220
|
return null;
|
|
5221
5221
|
}
|
|
5222
|
-
function
|
|
5222
|
+
function ns(e, t) {
|
|
5223
5223
|
let n = e.field(Q), r = e.doc, i = r.lineAt(t), a = r.sliceString(i.from, t), o = Array.from($(a)), s = null;
|
|
5224
5224
|
for (let e of o) {
|
|
5225
5225
|
let r = i.from + e.index, a = r + e[0].length, o = e[0].slice(1);
|
|
@@ -5227,7 +5227,7 @@ function ts(e, t) {
|
|
|
5227
5227
|
}
|
|
5228
5228
|
return s;
|
|
5229
5229
|
}
|
|
5230
|
-
function
|
|
5230
|
+
function rs(e, t) {
|
|
5231
5231
|
let n = e.field(Q), r = e.doc, i = r.lineAt(t), a = r.sliceString(i.from, i.to), o = Array.from($(a));
|
|
5232
5232
|
for (let e of o) {
|
|
5233
5233
|
let r = i.from + e.index, a = r + e[0].length, o = e[0].slice(1);
|
|
@@ -5238,8 +5238,8 @@ function ns(e, t) {
|
|
|
5238
5238
|
}
|
|
5239
5239
|
return null;
|
|
5240
5240
|
}
|
|
5241
|
-
var
|
|
5242
|
-
let t = e.annotation(
|
|
5241
|
+
var is = kt.transactionFilter.of((e) => {
|
|
5242
|
+
let t = e.annotation(Et.userEvent);
|
|
5243
5243
|
if (!t) return e;
|
|
5244
5244
|
let n = e.startState.selection.main;
|
|
5245
5245
|
if (!n.empty) return e;
|
|
@@ -5287,7 +5287,7 @@ var rs = Ot.transactionFilter.of((e) => {
|
|
|
5287
5287
|
}
|
|
5288
5288
|
if (t === "delete.backward" || t === "delete.forward") {
|
|
5289
5289
|
let r = null;
|
|
5290
|
-
return t === "delete.backward" ? r =
|
|
5290
|
+
return t === "delete.backward" ? r = $o(e.startState, n.head) : t === "delete.forward" && (r = es(e.startState, n.head)), r ? [{
|
|
5291
5291
|
changes: {
|
|
5292
5292
|
from: r.from,
|
|
5293
5293
|
to: r.to,
|
|
@@ -5300,11 +5300,11 @@ var rs = Ot.transactionFilter.of((e) => {
|
|
|
5300
5300
|
if (e.selection?.main.empty && n.empty && !t.startsWith("input") && t !== "input.type") {
|
|
5301
5301
|
let t = n.head, r = e.selection.main.head, i = null;
|
|
5302
5302
|
if (r < t) {
|
|
5303
|
-
let n =
|
|
5304
|
-
i = n && t > n.from ? n.from :
|
|
5303
|
+
let n = ts(e.startState, t);
|
|
5304
|
+
i = n && t > n.from ? n.from : ns(e.startState, t);
|
|
5305
5305
|
} else if (r > t) {
|
|
5306
|
-
let n =
|
|
5307
|
-
i = n && t < n.to ? n.to :
|
|
5306
|
+
let n = ts(e.startState, t);
|
|
5307
|
+
i = n && t < n.to ? n.to : rs(e.startState, t);
|
|
5308
5308
|
}
|
|
5309
5309
|
if (i !== null && i !== r) return [{
|
|
5310
5310
|
selection: { anchor: i },
|
|
@@ -5312,8 +5312,8 @@ var rs = Ot.transactionFilter.of((e) => {
|
|
|
5312
5312
|
}];
|
|
5313
5313
|
}
|
|
5314
5314
|
return e;
|
|
5315
|
-
}),
|
|
5316
|
-
function
|
|
5315
|
+
}), as = 150;
|
|
5316
|
+
function os(e, t) {
|
|
5317
5317
|
let n = /* @__PURE__ */ new Set();
|
|
5318
5318
|
for (let r of $(e)) {
|
|
5319
5319
|
let e = r[0].slice(1);
|
|
@@ -5321,13 +5321,13 @@ function as(e, t) {
|
|
|
5321
5321
|
}
|
|
5322
5322
|
return [...n];
|
|
5323
5323
|
}
|
|
5324
|
-
function
|
|
5324
|
+
function ss(e) {
|
|
5325
5325
|
return [...e].sort().join("\n");
|
|
5326
5326
|
}
|
|
5327
|
-
function
|
|
5327
|
+
function cs(e) {
|
|
5328
5328
|
return !$(e).next().done;
|
|
5329
5329
|
}
|
|
5330
|
-
function
|
|
5330
|
+
function ls(e) {
|
|
5331
5331
|
let t = [], n = [];
|
|
5332
5332
|
return e.changes.iterChanges((r, i, a, o) => {
|
|
5333
5333
|
let s = e.startState.doc.lineAt(r), c = e.startState.doc.lineAt(i === r ? r : i - 1);
|
|
@@ -5339,8 +5339,8 @@ function cs(e) {
|
|
|
5339
5339
|
after: n.join("\n")
|
|
5340
5340
|
};
|
|
5341
5341
|
}
|
|
5342
|
-
function
|
|
5343
|
-
let n = t.debounceMs ??
|
|
5342
|
+
function us(e, t) {
|
|
5343
|
+
let n = t.debounceMs ?? as, { logger: r, resolve: i } = t;
|
|
5344
5344
|
return class {
|
|
5345
5345
|
view;
|
|
5346
5346
|
timer;
|
|
@@ -5353,8 +5353,8 @@ function ls(e, t) {
|
|
|
5353
5353
|
}
|
|
5354
5354
|
update(e) {
|
|
5355
5355
|
if (e.docChanged) {
|
|
5356
|
-
let t =
|
|
5357
|
-
if (
|
|
5356
|
+
let t = ls(e);
|
|
5357
|
+
if (cs(t.before)) {
|
|
5358
5358
|
this.maybeSchedule(e.view);
|
|
5359
5359
|
return;
|
|
5360
5360
|
}
|
|
@@ -5366,11 +5366,11 @@ function ls(e, t) {
|
|
|
5366
5366
|
}
|
|
5367
5367
|
maybeSchedule(e, t) {
|
|
5368
5368
|
let r = t ?? e.state.doc.toString();
|
|
5369
|
-
if (!
|
|
5369
|
+
if (!cs(r)) {
|
|
5370
5370
|
t === void 0 && (this.lastKey = "", this.clearTimer());
|
|
5371
5371
|
return;
|
|
5372
5372
|
}
|
|
5373
|
-
let i = os(
|
|
5373
|
+
let i = ss(os(r, e.state.field(Q)));
|
|
5374
5374
|
i === "" ? t === void 0 && (this.lastKey = "", this.clearTimer()) : i === this.lastKey ? this.clearTimer() : (this.clearTimer(), this.timer = setTimeout(() => {
|
|
5375
5375
|
this.timer = void 0, this.run(e);
|
|
5376
5376
|
}, n));
|
|
@@ -5386,12 +5386,12 @@ function ls(e, t) {
|
|
|
5386
5386
|
try {
|
|
5387
5387
|
do {
|
|
5388
5388
|
this.rerun = !1;
|
|
5389
|
-
let n =
|
|
5389
|
+
let n = os(t.state.doc.toString(), t.state.field(Q));
|
|
5390
5390
|
if (n.length === 0) {
|
|
5391
5391
|
this.lastKey = "";
|
|
5392
5392
|
break;
|
|
5393
5393
|
}
|
|
5394
|
-
this.lastKey =
|
|
5394
|
+
this.lastKey = ss(n);
|
|
5395
5395
|
let r = i ? await i(n) : await e();
|
|
5396
5396
|
if (this.destroyed) return;
|
|
5397
5397
|
let a = new Set(n), o = r.filter((e) => a.has(e.uri));
|
|
@@ -5399,7 +5399,7 @@ function ls(e, t) {
|
|
|
5399
5399
|
if (this.rerun) continue;
|
|
5400
5400
|
break;
|
|
5401
5401
|
}
|
|
5402
|
-
t.dispatch({ effects:
|
|
5402
|
+
t.dispatch({ effects: Vo.of(new Map(o.map((e) => [e.uri, e]))) }), this.rerun = !0;
|
|
5403
5403
|
} while (this.rerun);
|
|
5404
5404
|
} catch (e) {
|
|
5405
5405
|
this.lastKey = "", r?.error("Failed to sync resources:", e);
|
|
@@ -5411,12 +5411,12 @@ function ls(e, t) {
|
|
|
5411
5411
|
}
|
|
5412
5412
|
};
|
|
5413
5413
|
}
|
|
5414
|
-
function
|
|
5415
|
-
return
|
|
5414
|
+
function ds(e, t = {}) {
|
|
5415
|
+
return St.fromClass(us(e, t));
|
|
5416
5416
|
}
|
|
5417
5417
|
//#endregion
|
|
5418
5418
|
//#region ../node_modules/.pnpm/@marimo-team+codemirror-mcp@0.1.7_@codemirror+autocomplete@6.20.3_@codemirror+state@6.7_6b342e94e942eed410acc909cdad6bca/node_modules/@marimo-team/codemirror-mcp/dist/theme.js
|
|
5419
|
-
var
|
|
5419
|
+
var fs = Ct.baseTheme({
|
|
5420
5420
|
".cm-resource-widget": {
|
|
5421
5421
|
background: "light-dark(rgba(86,156,214,0.08),rgba(86,156,214,0.18))",
|
|
5422
5422
|
borderRadius: "4px",
|
|
@@ -5432,75 +5432,75 @@ var ds = St.baseTheme({
|
|
|
5432
5432
|
color: "light-dark(#b00020,#ff8080)",
|
|
5433
5433
|
fontWeight: "500"
|
|
5434
5434
|
}
|
|
5435
|
-
}),
|
|
5435
|
+
}), ps = "_none_", ms = [{
|
|
5436
5436
|
uri: "",
|
|
5437
5437
|
name: "No resources",
|
|
5438
|
-
type:
|
|
5438
|
+
type: ps,
|
|
5439
5439
|
data: {}
|
|
5440
|
-
}],
|
|
5440
|
+
}], hs = {
|
|
5441
5441
|
info: "Variables, dataframes, and tables will appear here.",
|
|
5442
5442
|
apply: () => {}
|
|
5443
5443
|
};
|
|
5444
|
-
function hs(e) {
|
|
5445
|
-
let t = Ya(e).getAllItems();
|
|
5446
|
-
return t.length === 0 ? ps : t;
|
|
5447
|
-
}
|
|
5448
5444
|
function gs(e) {
|
|
5449
|
-
let
|
|
5445
|
+
let t = Xa(e).getAllItems();
|
|
5446
|
+
return t.length === 0 ? ms : t;
|
|
5447
|
+
}
|
|
5448
|
+
function _s(e) {
|
|
5449
|
+
let { language: t, store: r, onAddFiles: i } = e, a = () => gs(r);
|
|
5450
5450
|
return [
|
|
5451
|
-
t.data.of({ autocomplete:
|
|
5452
|
-
|
|
5451
|
+
t.data.of({ autocomplete: Wo(async () => a(), (e) => e.type === ps ? hs : Xa(r).getProvider(e.type)?.formatCompletion(e) || {}) }),
|
|
5452
|
+
xt.high(Ot.of([{
|
|
5453
5453
|
key: "Tab",
|
|
5454
5454
|
preventDefault: !0,
|
|
5455
|
-
run: (e) =>
|
|
5455
|
+
run: (e) => jt(e)
|
|
5456
5456
|
}])),
|
|
5457
|
-
|
|
5458
|
-
...i ? [t.data.of({ autocomplete:
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5457
|
+
Ga.of({ addAttachment: (e) => i?.([e]) }),
|
|
5458
|
+
...i ? [t.data.of({ autocomplete: Za().createCompletionSource() })] : [],
|
|
5459
|
+
Yo,
|
|
5460
|
+
is,
|
|
5461
|
+
ds(a, { logger: n }),
|
|
5462
5462
|
Q.init(() => {
|
|
5463
|
-
let e =
|
|
5463
|
+
let e = gs(r);
|
|
5464
5464
|
return new Map(e.map((e) => [e.uri, e]));
|
|
5465
5465
|
}),
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
let t =
|
|
5469
|
-
if (!t) return n.warn("No provider found for resource", e),
|
|
5466
|
+
fs,
|
|
5467
|
+
Qo({ createTooltip: (e) => {
|
|
5468
|
+
let t = Xa(r).getProvider(e.type);
|
|
5469
|
+
if (!t) return n.warn("No provider found for resource", e), vs(e.description || e.name);
|
|
5470
5470
|
let i = t.formatCompletion(e), a = e.description || e.name;
|
|
5471
|
-
if (!i?.info) return
|
|
5472
|
-
if (typeof i.info == "string") return
|
|
5471
|
+
if (!i?.info) return vs(a);
|
|
5472
|
+
if (typeof i.info == "string") return vs(i.info);
|
|
5473
5473
|
let o = i.info(i);
|
|
5474
|
-
return o ? "dom" in o ? { dom: o.dom } : "then" in o ? (n.warn("info is a promise. This is not supported", o),
|
|
5474
|
+
return o ? "dom" in o ? { dom: o.dom } : "then" in o ? (n.warn("info is a promise. This is not supported", o), vs(a)) : { dom: o } : vs(a);
|
|
5475
5475
|
} })
|
|
5476
5476
|
];
|
|
5477
5477
|
}
|
|
5478
|
-
function
|
|
5478
|
+
function vs(e) {
|
|
5479
5479
|
let t = document.createElement("div");
|
|
5480
5480
|
return t.textContent = e, { dom: t };
|
|
5481
5481
|
}
|
|
5482
5482
|
//#endregion
|
|
5483
5483
|
//#region src/components/editor/ai/prompt-input.tsx
|
|
5484
|
-
var
|
|
5485
|
-
let t = (0, L.c)(28), { value: n, placeholder: i, placeholderAction: a, inputRef: o, className: s, onChange: c, onSubmit: l, onKeyDown: u, onClose: d, onAddFiles: f, additionalCompletions: p, maxHeight: m } = e, h =
|
|
5486
|
-
t[0] === p ? b = t[1] : (b = (e) => p ?
|
|
5487
|
-
let x =
|
|
5484
|
+
var ys = "marimo:ai-prompt-history", bs = new we(et(it()), () => []), xs = (e) => {
|
|
5485
|
+
let t = (0, L.c)(28), { value: n, placeholder: i, placeholderAction: a, inputRef: o, className: s, onChange: c, onSubmit: l, onKeyDown: u, onClose: d, onAddFiles: f, additionalCompletions: p, maxHeight: m } = e, h = vt(l), _ = vt(d), v = Ye(), { theme: y } = ot(), b;
|
|
5486
|
+
t[0] === p ? b = t[1] : (b = (e) => p ? Qa([p.triggerCompletionRegex], p.completions)(e) : null, t[0] = p, t[1] = b);
|
|
5487
|
+
let x = vt(b), S;
|
|
5488
5488
|
if (t[2] !== x || t[3] !== _ || t[4] !== h || t[5] !== f || t[6] !== a || t[7] !== v) {
|
|
5489
|
-
let e =
|
|
5490
|
-
t[9] === Symbol.for("react.memo_cache_sentinel") ? (n =
|
|
5491
|
-
let r =
|
|
5489
|
+
let e = Pt(), n;
|
|
5490
|
+
t[9] === Symbol.for("react.memo_cache_sentinel") ? (n = Nt({}), t[9] = n) : n = t[9];
|
|
5491
|
+
let r = _s({
|
|
5492
5492
|
language: e.language,
|
|
5493
5493
|
store: v,
|
|
5494
5494
|
onAddFiles: f
|
|
5495
5495
|
}), i = e.language.data.of({ autocomplete: x }), o;
|
|
5496
|
-
t[10] === Symbol.for("react.memo_cache_sentinel") ? (o =
|
|
5497
|
-
load:
|
|
5498
|
-
save:
|
|
5496
|
+
t[10] === Symbol.for("react.memo_cache_sentinel") ? (o = Bo({ storage: {
|
|
5497
|
+
load: Ss,
|
|
5498
|
+
save: Cs
|
|
5499
5499
|
} }), t[10] = o) : o = t[10];
|
|
5500
5500
|
let s;
|
|
5501
|
-
t[11] === Symbol.for("react.memo_cache_sentinel") ? (s =
|
|
5501
|
+
t[11] === Symbol.for("react.memo_cache_sentinel") ? (s = Ft(), t[11] = s) : s = t[11];
|
|
5502
5502
|
let c;
|
|
5503
|
-
t[12] === h ? c = t[13] : (c =
|
|
5503
|
+
t[12] === h ? c = t[13] : (c = xt.highest(Ot.of([{
|
|
5504
5504
|
preventDefault: !0,
|
|
5505
5505
|
stopPropagation: !0,
|
|
5506
5506
|
any: (e, t) => {
|
|
@@ -5509,7 +5509,7 @@ var vs = "marimo:ai-prompt-history", ys = new we($e(rt()), () => []), bs = (e) =
|
|
|
5509
5509
|
}
|
|
5510
5510
|
}])), t[12] = h, t[13] = c);
|
|
5511
5511
|
let l;
|
|
5512
|
-
t[14] === _ ? l = t[15] : (l =
|
|
5512
|
+
t[14] === _ ? l = t[15] : (l = Ot.of([{
|
|
5513
5513
|
key: "Escape",
|
|
5514
5514
|
preventDefault: !0,
|
|
5515
5515
|
stopPropagation: !0,
|
|
@@ -5521,7 +5521,7 @@ var vs = "marimo:ai-prompt-history", ys = new we($e(rt()), () => []), bs = (e) =
|
|
|
5521
5521
|
r,
|
|
5522
5522
|
i,
|
|
5523
5523
|
o,
|
|
5524
|
-
|
|
5524
|
+
Ct.lineWrapping,
|
|
5525
5525
|
s,
|
|
5526
5526
|
c,
|
|
5527
5527
|
l
|
|
@@ -5530,7 +5530,7 @@ var vs = "marimo:ai-prompt-history", ys = new we($e(rt()), () => []), bs = (e) =
|
|
|
5530
5530
|
let C = S, w;
|
|
5531
5531
|
t[16] === s ? w = t[17] : (w = r("mo-ai-prompt flex-1 font-sans text-sm leading-6 overflow-auto my-1", s), t[16] = s, t[17] = w);
|
|
5532
5532
|
let T = y === "dark" ? "dark" : "light", E = a ? void 0 : i || "Generate with AI, @ to include context", D;
|
|
5533
|
-
return t[18] !== C || t[19] !== o || t[20] !== m || t[21] !== c || t[22] !== u || t[23] !== w || t[24] !== T || t[25] !== E || t[26] !== n ? (D = /* @__PURE__ */ (0, Z.jsx)(
|
|
5533
|
+
return t[18] !== C || t[19] !== o || t[20] !== m || t[21] !== c || t[22] !== u || t[23] !== w || t[24] !== T || t[25] !== E || t[26] !== n ? (D = /* @__PURE__ */ (0, Z.jsx)(It, {
|
|
5534
5534
|
ref: o,
|
|
5535
5535
|
className: w,
|
|
5536
5536
|
width: "100%",
|
|
@@ -5544,21 +5544,21 @@ var vs = "marimo:ai-prompt-history", ys = new we($e(rt()), () => []), bs = (e) =
|
|
|
5544
5544
|
placeholder: E
|
|
5545
5545
|
}), t[18] = C, t[19] = o, t[20] = m, t[21] = c, t[22] = u, t[23] = w, t[24] = T, t[25] = E, t[26] = n, t[27] = D) : D = t[27], D;
|
|
5546
5546
|
};
|
|
5547
|
-
function
|
|
5548
|
-
return
|
|
5547
|
+
function Ss() {
|
|
5548
|
+
return bs.get(ys);
|
|
5549
5549
|
}
|
|
5550
|
-
function
|
|
5551
|
-
return
|
|
5550
|
+
function Cs(e) {
|
|
5551
|
+
return bs.set(ys, e);
|
|
5552
5552
|
}
|
|
5553
5553
|
//#endregion
|
|
5554
5554
|
//#region src/plugins/impl/chat/chat-ui.tsx
|
|
5555
|
-
var
|
|
5556
|
-
type:
|
|
5557
|
-
message_id:
|
|
5558
|
-
content:
|
|
5559
|
-
is_final:
|
|
5555
|
+
var ws = ce, Ts = mt({
|
|
5556
|
+
type: tt("stream_chunk"),
|
|
5557
|
+
message_id: it(),
|
|
5558
|
+
content: Qe().nullable().transform((e) => e),
|
|
5559
|
+
is_final: qe().optional()
|
|
5560
5560
|
});
|
|
5561
|
-
function
|
|
5561
|
+
function Es(e, t) {
|
|
5562
5562
|
let { controllerRef: r, activeRequestIdRef: i } = t, a = r.current;
|
|
5563
5563
|
if (a === null) return "dropped-no-controller";
|
|
5564
5564
|
let o = i.current;
|
|
@@ -5567,7 +5567,7 @@ function Ts(e, t) {
|
|
|
5567
5567
|
activeRequestId: o
|
|
5568
5568
|
}), "dropped-stale") : (e.content && a.enqueue(e.content), e.is_final ? (a.close(), r.current = null, i.current = null, "closed") : "enqueued");
|
|
5569
5569
|
}
|
|
5570
|
-
var
|
|
5570
|
+
var Ds = (e) => {
|
|
5571
5571
|
let [t, o] = (0, X.useState)(""), [s, c] = (0, X.useState)(e.config), [u, d] = (0, X.useState)(e.config), [f, p] = (0, X.useState)(void 0), m = (0, X.useRef)(null), h = (0, X.useRef)(null), g = (0, X.useRef)(null), _ = (0, X.useRef)(null);
|
|
5572
5572
|
Object.keys(e.config).some((t) => e.config[t] !== u[t]) && (c(e.config), d(e.config));
|
|
5573
5573
|
let v = (0, X.useRef)(s);
|
|
@@ -5576,9 +5576,9 @@ var Es = (e) => {
|
|
|
5576
5576
|
}, [s]);
|
|
5577
5577
|
let b = (0, X.useRef)(null), x = (0, X.useRef)(null), S = (0, X.useRef)(null), [C, w] = (0, X.useState)(null), T = () => {
|
|
5578
5578
|
S.current = null, w(null);
|
|
5579
|
-
}, { data: E } =
|
|
5580
|
-
sendAutomaticallyWhen: ({ messages: e }) =>
|
|
5581
|
-
transport: new
|
|
5579
|
+
}, { data: E } = Lt(async () => (await e.get_chat_history({})).messages, []), O = e.value.length > 0 ? e.value : E, { messages: k, sendMessage: A, setMessages: j, status: M, stop: N, error: P, regenerate: te, clearError: F, addToolApprovalResponse: ne } = ba({
|
|
5580
|
+
sendAutomaticallyWhen: ({ messages: e }) => eo(e),
|
|
5581
|
+
transport: new aa({ fetch: async (t, r) => {
|
|
5582
5582
|
if (r === void 0) return fetch(t);
|
|
5583
5583
|
let i = JSON.parse(r.body), a = r.signal, o = {
|
|
5584
5584
|
max_tokens: v.current.max_tokens,
|
|
@@ -5621,7 +5621,7 @@ var Es = (e) => {
|
|
|
5621
5621
|
config: o
|
|
5622
5622
|
}).catch((e) => {
|
|
5623
5623
|
b.current?.error(e), b.current = null, x.current = null;
|
|
5624
|
-
}),
|
|
5624
|
+
}), Bi({ stream: s });
|
|
5625
5625
|
} catch (e) {
|
|
5626
5626
|
if (e instanceof Error && e.name === "AbortError") return new Response("Aborted", { status: 499 });
|
|
5627
5627
|
let t = e.message?.split("failed with exception ").pop();
|
|
@@ -5634,12 +5634,12 @@ var Es = (e) => {
|
|
|
5634
5634
|
finishReason: i,
|
|
5635
5635
|
isAbort: r
|
|
5636
5636
|
}), r) {
|
|
5637
|
-
let e =
|
|
5637
|
+
let e = Ca({
|
|
5638
5638
|
isAbort: !0,
|
|
5639
5639
|
streamReason: S.current
|
|
5640
5640
|
});
|
|
5641
5641
|
if (T(), e != null) {
|
|
5642
|
-
let t =
|
|
5642
|
+
let t = wa(e);
|
|
5643
5643
|
n.debug("Chat stream aborted", {
|
|
5644
5644
|
reason: e,
|
|
5645
5645
|
finishReason: i
|
|
@@ -5652,14 +5652,14 @@ var Es = (e) => {
|
|
|
5652
5652
|
n.error("An error occurred:", e);
|
|
5653
5653
|
}
|
|
5654
5654
|
});
|
|
5655
|
-
i(e.host,
|
|
5656
|
-
let t =
|
|
5655
|
+
i(e.host, Ie.TYPE, (e) => {
|
|
5656
|
+
let t = Ts.safeParse(e.detail.message);
|
|
5657
5657
|
if (t.success) {
|
|
5658
5658
|
if (t.data.content && t.data.message_id === x.current) {
|
|
5659
|
-
let e =
|
|
5659
|
+
let e = Sa(t.data.content);
|
|
5660
5660
|
e !== void 0 && (S.current = e);
|
|
5661
5661
|
}
|
|
5662
|
-
|
|
5662
|
+
Es(t.data, {
|
|
5663
5663
|
controllerRef: b,
|
|
5664
5664
|
activeRequestIdRef: x
|
|
5665
5665
|
});
|
|
@@ -5711,7 +5711,7 @@ var Es = (e) => {
|
|
|
5711
5711
|
onClick: () => {
|
|
5712
5712
|
j([]), e.setValue([]), e.delete_chat_history({}), F(), T();
|
|
5713
5713
|
},
|
|
5714
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
5714
|
+
children: /* @__PURE__ */ (0, Z.jsx)(Jt, { className: "h-3 w-3" })
|
|
5715
5715
|
})
|
|
5716
5716
|
}),
|
|
5717
5717
|
/* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
@@ -5721,7 +5721,7 @@ var Es = (e) => {
|
|
|
5721
5721
|
k.length === 0 && /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
5722
5722
|
className: "flex flex-col items-center justify-center h-full text-muted-foreground text-center p-4",
|
|
5723
5723
|
children: [
|
|
5724
|
-
/* @__PURE__ */ (0, Z.jsx)(
|
|
5724
|
+
/* @__PURE__ */ (0, Z.jsx)(Bt, { className: "h-12 w-12 mb-4" }),
|
|
5725
5725
|
/* @__PURE__ */ (0, Z.jsx)("h3", {
|
|
5726
5726
|
className: "text-lg font-semibold mb-2",
|
|
5727
5727
|
children: "No messages yet"
|
|
@@ -5738,7 +5738,7 @@ var Es = (e) => {
|
|
|
5738
5738
|
className: r("flex flex-col group gap-2", e.role === "user" ? "items-end" : "items-start"),
|
|
5739
5739
|
children: [/* @__PURE__ */ (0, Z.jsx)("div", {
|
|
5740
5740
|
className: `max-w-[80%] p-3 rounded-lg ${e.role === "user" ? "bg-(--sky-11) text-(--slate-1) whitespace-pre-wrap" : "bg-(--slate-4) text-(--slate-12) [--muted-foreground:var(--slate-11)]"}`,
|
|
5741
|
-
children:
|
|
5741
|
+
children: To({
|
|
5742
5742
|
message: e,
|
|
5743
5743
|
isLast: i,
|
|
5744
5744
|
isActive: re,
|
|
@@ -5766,7 +5766,7 @@ var Es = (e) => {
|
|
|
5766
5766
|
}),
|
|
5767
5767
|
P && /* @__PURE__ */ (0, Z.jsxs)("div", {
|
|
5768
5768
|
className: "flex items-center justify-center space-x-2 mb-4",
|
|
5769
|
-
children: [/* @__PURE__ */ (0, Z.jsx)(
|
|
5769
|
+
children: [/* @__PURE__ */ (0, Z.jsx)(ht, { error: P }), /* @__PURE__ */ (0, Z.jsx)(a, {
|
|
5770
5770
|
variant: "outline",
|
|
5771
5771
|
size: "sm",
|
|
5772
5772
|
onClick: () => te(),
|
|
@@ -5785,7 +5785,7 @@ var Es = (e) => {
|
|
|
5785
5785
|
/* @__PURE__ */ (0, Z.jsxs)("form", {
|
|
5786
5786
|
onSubmit: async (n) => {
|
|
5787
5787
|
if (n.preventDefault(), e.disabled) return;
|
|
5788
|
-
let r = f ? await
|
|
5788
|
+
let r = f ? await $a(f) : void 0;
|
|
5789
5789
|
A({
|
|
5790
5790
|
role: "user",
|
|
5791
5791
|
parts: [{
|
|
@@ -5798,20 +5798,20 @@ var Es = (e) => {
|
|
|
5798
5798
|
inert: e.disabled || void 0,
|
|
5799
5799
|
className: r("flex w-full border-t border-(--slate-6) px-2 py-1 items-center", e.disabled && "opacity-50 cursor-not-allowed"),
|
|
5800
5800
|
children: [
|
|
5801
|
-
e.showConfigurationControls && /* @__PURE__ */ (0, Z.jsx)(
|
|
5801
|
+
e.showConfigurationControls && /* @__PURE__ */ (0, Z.jsx)(ks, {
|
|
5802
5802
|
config: s,
|
|
5803
5803
|
onChange: c
|
|
5804
5804
|
}),
|
|
5805
|
-
e.prompts.length > 0 && /* @__PURE__ */ (0, Z.jsx)(
|
|
5805
|
+
e.prompts.length > 0 && /* @__PURE__ */ (0, Z.jsx)(As, {
|
|
5806
5806
|
prompts: e.prompts,
|
|
5807
5807
|
onSelect: (e) => {
|
|
5808
5808
|
o(e), requestAnimationFrame(() => {
|
|
5809
5809
|
let e = g.current?.view;
|
|
5810
|
-
e?.focus(),
|
|
5810
|
+
e?.focus(), Ae(e);
|
|
5811
5811
|
});
|
|
5812
5812
|
}
|
|
5813
5813
|
}),
|
|
5814
|
-
/* @__PURE__ */ (0, Z.jsx)(
|
|
5814
|
+
/* @__PURE__ */ (0, Z.jsx)(xs, {
|
|
5815
5815
|
className: "rounded-sm mr-2",
|
|
5816
5816
|
placeholder: se,
|
|
5817
5817
|
value: t,
|
|
@@ -5841,14 +5841,14 @@ var Es = (e) => {
|
|
|
5841
5841
|
onClick: () => {
|
|
5842
5842
|
p(void 0), m.current && (m.current.value = "");
|
|
5843
5843
|
},
|
|
5844
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
5844
|
+
children: /* @__PURE__ */ (0, Z.jsx)(Ue, { className: "size-3" })
|
|
5845
5845
|
}),
|
|
5846
5846
|
ae && /* @__PURE__ */ (0, Z.jsxs)(Z.Fragment, { children: [/* @__PURE__ */ (0, Z.jsx)(a, {
|
|
5847
5847
|
type: "button",
|
|
5848
5848
|
variant: "text",
|
|
5849
5849
|
size: "sm",
|
|
5850
5850
|
onClick: () => m.current?.click(),
|
|
5851
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
5851
|
+
children: /* @__PURE__ */ (0, Z.jsx)(qt, { className: "h-4" })
|
|
5852
5852
|
}), /* @__PURE__ */ (0, Z.jsx)("input", {
|
|
5853
5853
|
type: "file",
|
|
5854
5854
|
ref: m,
|
|
@@ -5867,7 +5867,7 @@ var Es = (e) => {
|
|
|
5867
5867
|
size: "xs",
|
|
5868
5868
|
onClick: () => N(),
|
|
5869
5869
|
className: "text-(--red-9) hover:text-(--red-11)",
|
|
5870
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
5870
|
+
children: /* @__PURE__ */ (0, Z.jsx)(Pe, { className: "h-4 w-4 fill-current" })
|
|
5871
5871
|
})
|
|
5872
5872
|
}) : /* @__PURE__ */ (0, Z.jsx)(a, {
|
|
5873
5873
|
type: "submit",
|
|
@@ -5876,13 +5876,13 @@ var Es = (e) => {
|
|
|
5876
5876
|
size: "xs",
|
|
5877
5877
|
className: "text-(--slate-11)",
|
|
5878
5878
|
"aria-label": "Send message",
|
|
5879
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
5879
|
+
children: /* @__PURE__ */ (0, Z.jsx)(Xt, { className: "h-4 w-4" })
|
|
5880
5880
|
})
|
|
5881
5881
|
]
|
|
5882
5882
|
})
|
|
5883
5883
|
]
|
|
5884
5884
|
});
|
|
5885
|
-
},
|
|
5885
|
+
}, Os = {
|
|
5886
5886
|
max_tokens: {
|
|
5887
5887
|
min: 1,
|
|
5888
5888
|
max: 4096,
|
|
@@ -5915,12 +5915,12 @@ var Es = (e) => {
|
|
|
5915
5915
|
max: 2,
|
|
5916
5916
|
description: "Penalizes new tokens (-2: favor, 2: avoid)"
|
|
5917
5917
|
}
|
|
5918
|
-
},
|
|
5918
|
+
}, ks = (e) => {
|
|
5919
5919
|
let t = (0, L.c)(16), { config: n, onChange: r } = e, [i, o] = (0, X.useState)(!1), s;
|
|
5920
5920
|
t[0] !== n || t[1] !== r ? (s = (e, t) => {
|
|
5921
5921
|
let i = t === null || Number.isNaN(t) ? null : t;
|
|
5922
5922
|
if (i !== null) {
|
|
5923
|
-
let { min: t, max: n } =
|
|
5923
|
+
let { min: t, max: n } = Os[e];
|
|
5924
5924
|
i = Math.max(t, Math.min(n, i));
|
|
5925
5925
|
}
|
|
5926
5926
|
let a = {
|
|
@@ -5942,7 +5942,7 @@ var Es = (e) => {
|
|
|
5942
5942
|
variant: "outline",
|
|
5943
5943
|
size: "sm",
|
|
5944
5944
|
className: "border-none shadow-none hover:bg-transparent",
|
|
5945
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
5945
|
+
children: /* @__PURE__ */ (0, Z.jsx)(Zt, { className: "h-3 w-3" })
|
|
5946
5946
|
})
|
|
5947
5947
|
})
|
|
5948
5948
|
}), t[4] = d) : d = t[4];
|
|
@@ -5961,12 +5961,12 @@ var Es = (e) => {
|
|
|
5961
5961
|
children: [/* @__PURE__ */ (0, Z.jsxs)(de, {
|
|
5962
5962
|
htmlFor: t,
|
|
5963
5963
|
className: "flex w-full justify-between col-span-3 align-end",
|
|
5964
|
-
children: [
|
|
5964
|
+
children: [He.startCase(t), /* @__PURE__ */ (0, Z.jsx)(ue, {
|
|
5965
5965
|
delayDuration: 200,
|
|
5966
5966
|
side: "top",
|
|
5967
5967
|
content: /* @__PURE__ */ (0, Z.jsx)("div", {
|
|
5968
5968
|
className: "text-xs flex flex-col",
|
|
5969
|
-
children:
|
|
5969
|
+
children: Os[t].description
|
|
5970
5970
|
}),
|
|
5971
5971
|
children: /* @__PURE__ */ (0, Z.jsx)(xe, { className: "h-3 w-3 cursor-help text-muted-foreground hover:text-foreground" })
|
|
5972
5972
|
})]
|
|
@@ -5975,15 +5975,15 @@ var Es = (e) => {
|
|
|
5975
5975
|
"aria-label": t,
|
|
5976
5976
|
value: n ?? NaN,
|
|
5977
5977
|
placeholder: "null",
|
|
5978
|
-
minValue:
|
|
5979
|
-
maxValue:
|
|
5980
|
-
step:
|
|
5978
|
+
minValue: Os[t].min,
|
|
5979
|
+
maxValue: Os[t].max,
|
|
5980
|
+
step: Os[t].step ?? 1,
|
|
5981
5981
|
onChange: (e) => c(t, e),
|
|
5982
5982
|
onKeyDown: u,
|
|
5983
5983
|
className: "col-span-3"
|
|
5984
5984
|
})]
|
|
5985
5985
|
}, t);
|
|
5986
|
-
}, t[9] = c, t[10] = e), p =
|
|
5986
|
+
}, t[9] = c, t[10] = e), p = _t.entries(n).map(e), t[6] = n, t[7] = c, t[8] = p;
|
|
5987
5987
|
} else p = t[8];
|
|
5988
5988
|
let m;
|
|
5989
5989
|
t[11] === p ? m = t[12] : (m = /* @__PURE__ */ (0, Z.jsx)(S, {
|
|
@@ -5999,7 +5999,7 @@ var Es = (e) => {
|
|
|
5999
5999
|
onOpenChange: o,
|
|
6000
6000
|
children: [d, m]
|
|
6001
6001
|
}), t[13] = i, t[14] = m, t[15] = h) : h = t[15], h;
|
|
6002
|
-
},
|
|
6002
|
+
}, As = (e) => {
|
|
6003
6003
|
let t = (0, L.c)(18), { prompts: n, onSelect: r } = e, [i, o] = (0, X.useState)(!1), [s, c] = (0, X.useState)(""), l;
|
|
6004
6004
|
t[0] === r ? l = t[1] : (l = (e) => {
|
|
6005
6005
|
[...e.matchAll(/{{(\w+)}}/g)].length > 0 ? (c(e), o(!0)) : r(e);
|
|
@@ -6027,10 +6027,10 @@ var Es = (e) => {
|
|
|
6027
6027
|
}, t), t[6] = u, t[7] = e), f = n.map(e), t[3] = u, t[4] = n, t[5] = f;
|
|
6028
6028
|
} else f = t[5];
|
|
6029
6029
|
let p;
|
|
6030
|
-
t[8] === f ? p = t[9] : (p = /* @__PURE__ */ (0, Z.jsx)(
|
|
6030
|
+
t[8] === f ? p = t[9] : (p = /* @__PURE__ */ (0, Z.jsx)(ws, { children: /* @__PURE__ */ (0, Z.jsxs)(ve, { children: [d, /* @__PURE__ */ (0, Z.jsx)(_e, {
|
|
6031
6031
|
side: "right",
|
|
6032
6032
|
align: "end",
|
|
6033
|
-
onCloseAutoFocus:
|
|
6033
|
+
onCloseAutoFocus: Ms,
|
|
6034
6034
|
className: "w-64 max-h-96 overflow-y-auto",
|
|
6035
6035
|
children: f
|
|
6036
6036
|
})] }) }), t[8] = f, t[9] = p);
|
|
@@ -6041,7 +6041,7 @@ var Es = (e) => {
|
|
|
6041
6041
|
side: "right",
|
|
6042
6042
|
align: "end",
|
|
6043
6043
|
className: "min-w-80 px-2",
|
|
6044
|
-
children: /* @__PURE__ */ (0, Z.jsx)(
|
|
6044
|
+
children: /* @__PURE__ */ (0, Z.jsx)(js, {
|
|
6045
6045
|
prompt: s,
|
|
6046
6046
|
onClose: m,
|
|
6047
6047
|
onSelect: r
|
|
@@ -6053,9 +6053,9 @@ var Es = (e) => {
|
|
|
6053
6053
|
onOpenChange: o,
|
|
6054
6054
|
children: [p, h]
|
|
6055
6055
|
}), t[14] = i, t[15] = p, t[16] = h, t[17] = g) : g = t[17], g;
|
|
6056
|
-
},
|
|
6056
|
+
}, js = (e) => {
|
|
6057
6057
|
let t = (0, L.c)(30), { prompt: n, onClose: r, onSelect: i } = e, o;
|
|
6058
|
-
t[0] === n ? o = t[1] : (o = () => [...n.matchAll(/{{(\w+)}}/g)].reduce(
|
|
6058
|
+
t[0] === n ? o = t[1] : (o = () => [...n.matchAll(/{{(\w+)}}/g)].reduce(Ns, {}), t[0] = n, t[1] = o);
|
|
6059
6059
|
let [s, c] = (0, X.useState)(o), l;
|
|
6060
6060
|
t[2] === Symbol.for("react.memo_cache_sentinel") ? (l = (e, t) => {
|
|
6061
6061
|
c((n) => ({
|
|
@@ -6071,7 +6071,7 @@ var Es = (e) => {
|
|
|
6071
6071
|
t[7] === s ? r = t[8] : (r = (e, t) => s[t] || `{{${t}}}`, t[7] = s, t[8] = r), d = n.replaceAll(e, r), t[3] = n, t[4] = s, t[5] = d;
|
|
6072
6072
|
} else d = t[5];
|
|
6073
6073
|
let f = d, p;
|
|
6074
|
-
t[9] === s ? p = t[10] : (p = Object.values(s).some(
|
|
6074
|
+
t[9] === s ? p = t[10] : (p = Object.values(s).some(Ps), t[9] = s, t[10] = p);
|
|
6075
6075
|
let m = p, h;
|
|
6076
6076
|
t[11] !== r || t[12] !== i || t[13] !== f ? (h = () => {
|
|
6077
6077
|
i(f), r();
|
|
@@ -6126,14 +6126,14 @@ var Es = (e) => {
|
|
|
6126
6126
|
]
|
|
6127
6127
|
}), t[26] = v, t[27] = y, t[28] = b, t[29] = x) : x = t[29], x;
|
|
6128
6128
|
};
|
|
6129
|
-
function
|
|
6129
|
+
function Ms(e) {
|
|
6130
6130
|
return e.preventDefault();
|
|
6131
6131
|
}
|
|
6132
|
-
function
|
|
6132
|
+
function Ns(e, t) {
|
|
6133
6133
|
return e[t[1]] = "", e;
|
|
6134
6134
|
}
|
|
6135
|
-
function
|
|
6135
|
+
function Ps(e) {
|
|
6136
6136
|
return e == null || e.trim() === "";
|
|
6137
6137
|
}
|
|
6138
6138
|
//#endregion
|
|
6139
|
-
export {
|
|
6139
|
+
export { Ds as Chatbot };
|