@mcp-use/inspector 20.0.0-beta.1 → 20.0.0-beta.2
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/README.md +5 -0
- package/dist/cdn/{AnimatePresence-B4HhIdgq.js → AnimatePresence-Dcw-FOy8.js} +50 -50
- package/dist/cdn/ChatTab-DBl6dHVH.js +6744 -0
- package/dist/cdn/{CheckboxIndicator-BF2cKfbA.js → CheckboxIndicator-Bt4IICtv.js} +77 -77
- package/dist/cdn/{ConnectionSettingsForm-BNS6bOMD.js → ConnectionSettingsForm-BFsZpwK4.js} +348 -292
- package/dist/cdn/ConnectionSettingsTab-DDk06dhT.js +150 -0
- package/dist/cdn/{ElicitationTab-upPXq2q7.js → ElicitationTab-CL1KJ0bz.js} +39 -39
- package/dist/cdn/{FormContext-Cl51-7O7.js → FormContext-tmgN_Vdr.js} +1 -1
- package/dist/cdn/{InspectorContext-DzXtgyTx.js → InspectorContext-UjtEbNod.js} +1 -21
- package/dist/cdn/{JSONDisplay-D3RcyO9z.js → JSONDisplay-BFxf5oEu.js} +18 -18
- package/dist/cdn/{ListTabHeader-8lULn-90.js → ListTabHeader-Cv-GmtGF.js} +19 -19
- package/dist/cdn/{ManufactOAuthCallback-DEM8mhWD.js → ManufactOAuthCallback-B98kSYCj.js} +1 -1
- package/dist/cdn/MarkdownRenderer-DQflNTGo.js +3610 -0
- package/dist/cdn/{NotificationsTab-CWopTIzT.js → NotificationsTab-CeImSrhx.js} +13 -13
- package/dist/cdn/{OAuthCallback-k3oeLtIC.js → OAuthCallback-C4n2hqKU.js} +1 -1
- package/dist/cdn/PromptsTab-C84YLTSM.js +901 -0
- package/dist/cdn/{ResourcesTab-KfamsM6-.js → ResourcesTab-CCa5bIHE.js} +35 -55
- package/dist/cdn/{SamplingTab-vcufuK24.js → SamplingTab-Bt9z8yQ2.js} +35 -35
- package/dist/cdn/{ServerMetadataTab-DS0eiyyD.js → ServerMetadataTab-CvrKX8fz.js} +12 -12
- package/dist/cdn/{StatusIcon-BGXOEU2u.js → StatusIcon-D0-ARyOh.js} +6 -6
- package/dist/cdn/{ToolsTab-DRjcZnpu.js → ToolsTab-v9zgWmM6.js} +103 -137
- package/dist/cdn/{ViewPreview-B_onhcUB.js → ViewPreview-DsPwZAwO.js} +2 -2
- package/dist/cdn/{WidgetWrapper-D29YDxIu.js → WidgetWrapper-CwlpDv17.js} +529 -530
- package/dist/cdn/card-DgiYnSg-.js +41 -0
- package/dist/cdn/{checkbox-B4oUG6Rr.js → checkbox-By0FklhG.js} +6 -6
- package/dist/cdn/{dialog-Dnl-pZsY.js → dialog-BsDpuJd3.js} +151 -151
- package/dist/cdn/{dist-mRDqCgKU.js → dist-B0eL32Gb.js} +114 -113
- package/dist/cdn/{dist-DjXr_YO3.js → dist-DaMB0Su9.js} +1 -1
- package/dist/cdn/{index-browser-CVUwR-Bu.js → index-browser-QDjRGsPo.js} +1 -1
- package/dist/cdn/{input-BLxOA7V-.js → input-C2OBd4PJ.js} +4787 -2842
- package/dist/cdn/inspector.css +1 -1
- package/dist/cdn/inspector.js +7419 -7445
- package/dist/cdn/{label-CBvG613A.js → label-B9Jmm9be.js} +10 -10
- package/dist/cdn/{manufact-auth-0TVxpeTA.js → manufact-auth-BQMHhbLV.js} +142 -106
- package/dist/cdn/{not-found-BcNNsTjS.js → not-found-DEtSM_Wd.js} +7 -7
- package/dist/cdn/providerMeta-BQIfHuNL.js +379 -0
- package/dist/cdn/{react-BxO-uEDZ.js → react-Dn8PWXwP.js} +1 -1
- package/dist/cdn/{select-BZ_IoKxg.js → select-DDdiIPR2.js} +726 -726
- package/dist/cdn/{shared-uMiV6Fx1.js → shared-DaILIQPP.js} +29 -29
- package/dist/cdn/{popover-C_SSrXT0.js → sheet-Br_l2kry.js} +694 -622
- package/dist/cdn/{spinner-CWcJhIY_.js → spinner-jQtC7EBj.js} +5 -5
- package/dist/cdn/{switch-DtQOLb9R.js → switch-C3IyQuid.js} +104 -104
- package/dist/cdn/{tabs-subtle-C5cy35sY.js → tabs-subtle-CkdI6Mac.js} +147 -147
- package/dist/cdn/{telemetry-Ct6pVkM1.js → telemetry-DGoIGfIS.js} +3 -3
- package/dist/cdn/{textarea-Bj-CT7hC.js → textarea-DSbwcFVt.js} +6 -6
- package/dist/cdn/{useAriaLabelledBy-Bm9qHGK6.js → useAriaLabelledBy-DqAdnppm.js} +1 -1
- package/dist/cdn/{useCompositeItem-CNJ6MXdi.js → useCompositeItem-BRqEzYh-.js} +2 -2
- package/dist/cdn/{useConfig-CwxZ6Quj.js → useConfig-CTb6GZbt.js} +73 -46
- package/dist/cdn/{useViewHostProps-Dr6W2ooF.js → useViewHostProps-DIIlz3tJ.js} +1 -1
- package/dist/cli.js +26 -12
- package/dist/client/auth/manufact-auth.d.ts +3 -1
- package/dist/client/auth/manufact-auth.d.ts.map +1 -1
- package/dist/client/components/ChatTab.d.ts +1 -8
- package/dist/client/components/ChatTab.d.ts.map +1 -1
- package/dist/client/components/ResourcesTab.d.ts.map +1 -1
- package/dist/client/components/chat/ChatHeader.d.ts +7 -2
- package/dist/client/components/chat/ChatHeader.d.ts.map +1 -1
- package/dist/client/components/chat/ChatLandingForm.d.ts +4 -2
- package/dist/client/components/chat/ChatLandingForm.d.ts.map +1 -1
- package/dist/client/components/chat/ChatManagedNotice.d.ts +10 -0
- package/dist/client/components/chat/ChatManagedNotice.d.ts.map +1 -0
- package/dist/client/components/chat/ChatScrollTopFade.d.ts +7 -0
- package/dist/client/components/chat/ChatScrollTopFade.d.ts.map +1 -0
- package/dist/client/components/chat/ConfigurationDialog.d.ts +11 -9
- package/dist/client/components/chat/ConfigurationDialog.d.ts.map +1 -1
- package/dist/client/components/chat/ConfigureEmptyState.d.ts +1 -6
- package/dist/client/components/chat/ConfigureEmptyState.d.ts.map +1 -1
- package/dist/client/components/chat/StreamingAssistantContent.d.ts.map +1 -1
- package/dist/client/components/chat/chatModeStorage.d.ts +11 -0
- package/dist/client/components/chat/chatModeStorage.d.ts.map +1 -0
- package/dist/client/components/chat/managedChatNotice.d.ts +16 -0
- package/dist/client/components/chat/managedChatNotice.d.ts.map +1 -0
- package/dist/client/components/chat/providerMeta.d.ts +11 -0
- package/dist/client/components/chat/providerMeta.d.ts.map +1 -1
- package/dist/client/components/chat/useChatMessages.d.ts +7 -5
- package/dist/client/components/chat/useChatMessages.d.ts.map +1 -1
- package/dist/client/components/chat/useChatMessagesClientSide.d.ts +4 -6
- package/dist/client/components/chat/useChatMessagesClientSide.d.ts.map +1 -1
- package/dist/client/components/chat/useChatScrollToBottom.d.ts +1 -0
- package/dist/client/components/chat/useChatScrollToBottom.d.ts.map +1 -1
- package/dist/client/components/chat/useConfig.d.ts +1 -1
- package/dist/client/components/chat/useConfig.d.ts.map +1 -1
- package/dist/client/components/chat/useHostedChatMode.d.ts +1 -1
- package/dist/client/components/chat/useHostedChatMode.d.ts.map +1 -1
- package/dist/client/components/shared/MarkdownRenderer.d.ts +2 -1
- package/dist/client/components/shared/MarkdownRenderer.d.ts.map +1 -1
- package/dist/client/components/tools/useToolsTabNavigation.d.ts.map +1 -1
- package/dist/client/components/ui/MeshGradientCanvas.d.ts +13 -0
- package/dist/client/components/ui/MeshGradientCanvas.d.ts.map +1 -0
- package/dist/client/components/ui/chat-message.d.ts +1 -1
- package/dist/client/components/ui/chat-message.d.ts.map +1 -1
- package/dist/client/components/ui/file-thumbnail.d.ts.map +1 -1
- package/dist/client/components/ui/mesh-tab-background.d.ts +3 -1
- package/dist/client/components/ui/mesh-tab-background.d.ts.map +1 -1
- package/dist/client/context/InspectorContext.d.ts.map +1 -1
- package/dist/client/index.js +2577 -2165
- package/dist/client/telemetry/utils.d.ts.map +1 -1
- package/dist/server/asset-urls.d.ts +4 -0
- package/dist/server/asset-urls.d.ts.map +1 -1
- package/dist/server/asset-urls.js +7 -3
- package/dist/server/cdn-shell.d.ts.map +1 -1
- package/dist/server/cdn-shell.js +3 -3
- package/dist/server/{chunk-KBVKS4J5.js → chunk-H6ZCIKBS.js} +10 -0
- package/dist/server/{chunk-VDUV6LR6.js → chunk-K2DPKTIS.js} +15 -4
- package/dist/server/{chunk-Y2GBQOQW.js → chunk-LIM6NAUS.js} +1 -8
- package/dist/server/{chunk-K2V2SDQD.js → chunk-OWR2BIBW.js} +1 -1
- package/dist/server/{chunk-IXYK6ZOY.js → chunk-R6RQMIXL.js} +2 -2
- package/dist/server/{chunk-5B3SXGZP.js → chunk-UJLXHNQP.js} +1 -1
- package/dist/server/{chunk-6XWDZEFF.js → chunk-XCNS5CIW.js} +8 -3
- package/dist/server/cli.js +5 -5
- package/dist/server/create-dev-api-app.js +3 -3
- package/dist/server/dev-callback-redirect.d.ts +3 -0
- package/dist/server/dev-callback-redirect.d.ts.map +1 -0
- package/dist/server/dev-callback-redirect.js +18 -0
- package/dist/server/index.js +6 -6
- package/dist/server/middleware.js +6 -6
- package/dist/server/proxy/index.js +1 -1
- package/dist/server/proxy/mcp-proxy.d.ts +2 -0
- package/dist/server/proxy/mcp-proxy.d.ts.map +1 -1
- package/dist/server/proxy/mcp-proxy.js +3 -1
- package/dist/server/proxy-routes.js +2 -2
- package/dist/server/server.js +3 -3
- package/dist/server/version.js +1 -1
- package/dist/server/vite-dev-api-plugin.js +3 -3
- package/dist/web/assets/{AnimatePresence-CthXziG2.js → AnimatePresence-C5p0yiY1.js} +2 -2
- package/dist/web/assets/ChatTab-C2FtENBM.js +18 -0
- package/dist/web/assets/ConnectionSettingsTab-B2sUjytG.js +1 -0
- package/dist/web/assets/ElicitationTab-DwH08kDC.js +1 -0
- package/dist/web/assets/{FormContext-Cqc_A12u.js → FormContext-DH2caWKO.js} +1 -1
- package/dist/web/assets/ListTabHeader-R17w_JsB.js +1 -0
- package/dist/web/assets/{ManufactOAuthCallback-DCLbW-mz.js → ManufactOAuthCallback-Btu4B6u6.js} +1 -1
- package/dist/web/assets/MarkdownRenderer-DpIEt9wb.js +47 -0
- package/dist/web/assets/{NotificationsTab-JevzvJTg.js → NotificationsTab-CHB8mtSz.js} +1 -1
- package/dist/web/assets/{OAuthCallback-BjcRxLh5.js → OAuthCallback-DV4MgX4Z.js} +1 -1
- package/dist/web/assets/PromptsTab-0GIapoSs.js +15 -0
- package/dist/web/assets/ResourcesTab-N9xjsI_b.js +2 -0
- package/dist/web/assets/SamplingTab-Dw0vpi4t.js +1 -0
- package/dist/web/assets/ServerMetadataTab-D-eQpLBF.js +1 -0
- package/dist/web/assets/ToolsTab-BMrMJ5JV.js +8 -0
- package/dist/web/assets/ViewPreview-N_cpEO0W.js +1 -0
- package/dist/web/assets/WidgetWrapper-pDgNVq9y.js +34 -0
- package/dist/web/assets/checkbox-CrnXSMh2.js +1 -0
- package/dist/web/assets/dist-CeWSydFI.js +21 -0
- package/dist/web/assets/index-Cfuv_gb3.js +475 -0
- package/dist/web/assets/index-fBX3akc8.css +1 -0
- package/dist/web/assets/input-CLYhA7PK.js +1 -0
- package/dist/web/assets/{label-B5Q_Zr8M.js → label-Cdim77Jw.js} +1 -1
- package/dist/web/assets/select-CJ57-Bor.js +1 -0
- package/dist/web/assets/shared-B1GD9FMm.js +1 -0
- package/dist/web/assets/{tabs-subtle-AkJZvdxS.js → tabs-subtle-CG5cjC_N.js} +1 -1
- package/dist/web/assets/textarea-DLAmNVf_.js +1 -0
- package/dist/web/assets/useConfig-BTp15Lle.js +1 -0
- package/dist/web/assets/{useViewHostProps-DXAD1g7g.js → useViewHostProps-BQlaFC2Q.js} +1 -1
- package/dist/web/index.html +8 -9
- package/package.json +4 -11
- package/dist/cdn/ChatTab-D8uwCHAf.js +0 -13218
- package/dist/cdn/ConnectionSettingsTab-B97gPPJW.js +0 -145
- package/dist/cdn/PromptsTab-Cspfnl6n.js +0 -4400
- package/dist/cdn/bundle-mjs-B0nmHDtp.js +0 -1953
- package/dist/cdn/card-DqjqAq0o.js +0 -41
- package/dist/cdn/chunk-BO2N2NFS-Cy167e0X.js +0 -17500
- package/dist/cdn/highlighted-body-OFNGDK62-CoReNbTX.js +0 -36
- package/dist/cdn/mermaid-GHXKKRXX-DgVIbk-D.js +0 -2
- package/dist/cdn/pdf-CxFT9FER.js +0 -16291
- package/dist/cdn/sheet-CerCdhxz.js +0 -78
- package/dist/cdn/useHostedSession-BA39Aegc.js +0 -153
- package/dist/cdn/useMCPPrompts-D3_Hla_z.js +0 -104
- package/dist/client/components/chat/streamdown-code-slim.d.ts +0 -4
- package/dist/client/components/chat/streamdown-code-slim.d.ts.map +0 -1
- package/dist/web/assets/ChatTab-Cy8eyFYI.js +0 -460
- package/dist/web/assets/ConnectionSettingsTab-sDZGaUJn.js +0 -1
- package/dist/web/assets/ElicitationTab-wDKgU1qL.js +0 -1
- package/dist/web/assets/ListTabHeader-G-nQX18m.js +0 -1
- package/dist/web/assets/PromptsTab-DsQVOjKH.js +0 -61
- package/dist/web/assets/ResourcesTab-Bw8_p6M1.js +0 -2
- package/dist/web/assets/SamplingTab-BrcF1zJF.js +0 -1
- package/dist/web/assets/ServerMetadataTab-Bydeh1Po.js +0 -1
- package/dist/web/assets/ToolsTab-DJWF7Q_x.js +0 -8
- package/dist/web/assets/ViewPreview-jgeU7bY9.js +0 -1
- package/dist/web/assets/WidgetWrapper-B_vJU9uF.js +0 -34
- package/dist/web/assets/bundle-mjs-8puS6ou7.js +0 -1
- package/dist/web/assets/checkbox-BA-XURSj.js +0 -1
- package/dist/web/assets/chunk-BO2N2NFS-CGbd3eLY.js +0 -131
- package/dist/web/assets/dist-BcAQZluc.js +0 -21
- package/dist/web/assets/highlighted-body-OFNGDK62-BBJFbIMp.js +0 -1
- package/dist/web/assets/index-BjH-Qp85.css +0 -1
- package/dist/web/assets/index-D2UxaT9v.js +0 -475
- package/dist/web/assets/input-CjmxOFr6.js +0 -1
- package/dist/web/assets/mermaid-GHXKKRXX-B4MKVODA.js +0 -1
- package/dist/web/assets/pdf-CuwKm9zO.js +0 -54
- package/dist/web/assets/select-C0xlfLAa.js +0 -1
- package/dist/web/assets/shared-DQE60Op-.js +0 -1
- package/dist/web/assets/sheet-7TIkLdpr.js +0 -1
- package/dist/web/assets/textarea-Ci09-en6.js +0 -1
- package/dist/web/assets/useConfig-Qglo4xs1.js +0 -1
- package/dist/web/assets/useMCPPrompts-USLYc1I4.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { F as e } from "./cfWorker-Bxcs9rNe.js";
|
|
2
|
-
import { a as t } from "./index-browser-
|
|
2
|
+
import { a as t } from "./index-browser-QDjRGsPo.js";
|
|
3
3
|
//#region ../agent/dist/index.js
|
|
4
4
|
var n = class {
|
|
5
5
|
disallowedTools;
|
|
@@ -368,7 +368,7 @@ function ne(e) {
|
|
|
368
368
|
});
|
|
369
369
|
}), t;
|
|
370
370
|
}
|
|
371
|
-
function
|
|
371
|
+
function re(e) {
|
|
372
372
|
let t = [], n = [];
|
|
373
373
|
for (let r of e) if (r.role === "system") {
|
|
374
374
|
if (typeof r.content == "string") t.push(r.content);
|
|
@@ -379,14 +379,14 @@ function h(e) {
|
|
|
379
379
|
rest: n
|
|
380
380
|
};
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function h(e) {
|
|
383
383
|
let t = e.match(/^data:([^;,]+);base64,(.+)$/);
|
|
384
384
|
return t ? {
|
|
385
385
|
mimeType: t[1],
|
|
386
386
|
data: t[2]
|
|
387
387
|
} : null;
|
|
388
388
|
}
|
|
389
|
-
async function*
|
|
389
|
+
async function* g(e, t) {
|
|
390
390
|
let n = e.getReader(), r = new TextDecoder("utf-8"), i = "";
|
|
391
391
|
try {
|
|
392
392
|
for (;;) {
|
|
@@ -395,15 +395,15 @@ async function* _(e, t) {
|
|
|
395
395
|
if (a) break;
|
|
396
396
|
i += r.decode(e, { stream: !0 });
|
|
397
397
|
let o;
|
|
398
|
-
for (; (o =
|
|
398
|
+
for (; (o = ie(i)) !== -1;) {
|
|
399
399
|
let e = i.slice(0, o);
|
|
400
400
|
i = i.slice(o).replace(/^(\r\n\r\n|\n\n|\r\r)/, "");
|
|
401
|
-
let t =
|
|
401
|
+
let t = _(e);
|
|
402
402
|
t && (yield t);
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
if (i.trim()) {
|
|
406
|
-
let e =
|
|
406
|
+
let e = _(i);
|
|
407
407
|
e && (yield e);
|
|
408
408
|
}
|
|
409
409
|
} finally {
|
|
@@ -412,11 +412,11 @@ async function* _(e, t) {
|
|
|
412
412
|
} catch {}
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function ie(e) {
|
|
416
416
|
let t = e.indexOf("\n\n"), n = e.indexOf("\r\n\r\n");
|
|
417
417
|
return t === -1 ? n : n === -1 ? t : Math.min(t, n);
|
|
418
418
|
}
|
|
419
|
-
function
|
|
419
|
+
function _(e) {
|
|
420
420
|
let t, n = [];
|
|
421
421
|
for (let r of e.split(/\r?\n/)) {
|
|
422
422
|
if (!r || r.startsWith(":")) continue;
|
|
@@ -428,15 +428,15 @@ function v(e) {
|
|
|
428
428
|
data: n.join("\n")
|
|
429
429
|
};
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function v(e, ...t) {
|
|
432
432
|
for (let n of t) {
|
|
433
433
|
let t = e[n];
|
|
434
434
|
if (typeof t == "number" && Number.isFinite(t)) return t;
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
|
-
function
|
|
437
|
+
function y(e) {
|
|
438
438
|
if (!e || typeof e != "object") return;
|
|
439
|
-
let t = e, n =
|
|
439
|
+
let t = e, n = v(t, "inputTokens", "input_tokens", "prompt_tokens", "promptTokenCount", "prompt_eval_count"), r = v(t, "outputTokens", "output_tokens", "completion_tokens", "candidatesTokenCount", "eval_count"), i = v(t, "totalTokens", "total_tokens", "totalTokenCount") ?? (n !== void 0 && r !== void 0 ? n + r : void 0), a = t.input_tokens_details && typeof t.input_tokens_details == "object" ? t.input_tokens_details : void 0, o = t.output_tokens_details && typeof t.output_tokens_details == "object" ? t.output_tokens_details : void 0, s = v(t, "cachedInputTokens", "cache_read_input_tokens") ?? (a ? v(a, "cached_tokens") : void 0), c = v(t, "reasoningTokens", "thoughtsTokenCount") ?? (o ? v(o, "reasoning_tokens") : void 0);
|
|
440
440
|
if (!(n === void 0 && r === void 0 && i === void 0 && s === void 0 && c === void 0)) return {
|
|
441
441
|
inputTokens: n,
|
|
442
442
|
outputTokens: r,
|
|
@@ -445,8 +445,8 @@ function b(e) {
|
|
|
445
445
|
reasoningTokens: c
|
|
446
446
|
};
|
|
447
447
|
}
|
|
448
|
-
var
|
|
449
|
-
function
|
|
448
|
+
var ae = "https://api.anthropic.com/v1/messages", oe = "2023-06-01", se = 4096;
|
|
449
|
+
function b(e) {
|
|
450
450
|
if (e.type !== "image") return null;
|
|
451
451
|
if (e.data && e.mimeType) return {
|
|
452
452
|
type: "image",
|
|
@@ -456,7 +456,7 @@ function x(e) {
|
|
|
456
456
|
data: e.data
|
|
457
457
|
}
|
|
458
458
|
};
|
|
459
|
-
let t =
|
|
459
|
+
let t = h(e.url);
|
|
460
460
|
return t ? {
|
|
461
461
|
type: "image",
|
|
462
462
|
source: {
|
|
@@ -472,7 +472,7 @@ function x(e) {
|
|
|
472
472
|
}
|
|
473
473
|
};
|
|
474
474
|
}
|
|
475
|
-
function
|
|
475
|
+
function ce(e) {
|
|
476
476
|
if (typeof e == "string") return [{
|
|
477
477
|
type: "text",
|
|
478
478
|
text: e || "[no content]"
|
|
@@ -483,7 +483,7 @@ function se(e) {
|
|
|
483
483
|
text: n.text
|
|
484
484
|
});
|
|
485
485
|
else {
|
|
486
|
-
let e =
|
|
486
|
+
let e = b(n);
|
|
487
487
|
e && t.push(e);
|
|
488
488
|
}
|
|
489
489
|
return t.length === 0 && t.push({
|
|
@@ -491,7 +491,7 @@ function se(e) {
|
|
|
491
491
|
text: "[no content]"
|
|
492
492
|
}), t;
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function le(e) {
|
|
495
495
|
if (typeof e == "string") return e;
|
|
496
496
|
let t = [];
|
|
497
497
|
for (let n of e) if (n.type === "text") n.text && t.push({
|
|
@@ -499,19 +499,19 @@ function ce(e) {
|
|
|
499
499
|
text: n.text
|
|
500
500
|
});
|
|
501
501
|
else if (n.type === "image") {
|
|
502
|
-
let e =
|
|
502
|
+
let e = b(n);
|
|
503
503
|
e && t.push(e);
|
|
504
504
|
}
|
|
505
505
|
return t.length === 0 ? "[no content]" : t;
|
|
506
506
|
}
|
|
507
|
-
function
|
|
507
|
+
function ue(e) {
|
|
508
508
|
let t = [];
|
|
509
509
|
for (let n of e) {
|
|
510
510
|
if (n.role === "tool") {
|
|
511
511
|
let e = t[t.length - 1], r = {
|
|
512
512
|
type: "tool_result",
|
|
513
513
|
tool_use_id: n.toolCallId,
|
|
514
|
-
content:
|
|
514
|
+
content: le(n.content),
|
|
515
515
|
...n.toolIsError ? { is_error: !0 } : {}
|
|
516
516
|
};
|
|
517
517
|
e && e.role === "user" && Array.isArray(e.content) ? e.content.push(r) : t.push({
|
|
@@ -542,16 +542,16 @@ function le(e) {
|
|
|
542
542
|
}
|
|
543
543
|
t.push({
|
|
544
544
|
role: "user",
|
|
545
|
-
content:
|
|
545
|
+
content: ce(n.content)
|
|
546
546
|
});
|
|
547
547
|
}
|
|
548
548
|
return t;
|
|
549
549
|
}
|
|
550
|
-
function
|
|
551
|
-
let { config: n, messages: r, tools: i } = e, { system: a, rest: o } =
|
|
550
|
+
function x(e, t) {
|
|
551
|
+
let { config: n, messages: r, tools: i } = e, { system: a, rest: o } = re(r), s = {
|
|
552
552
|
model: n.model,
|
|
553
|
-
max_tokens: n.maxTokens ??
|
|
554
|
-
messages:
|
|
553
|
+
max_tokens: n.maxTokens ?? se,
|
|
554
|
+
messages: ue(o),
|
|
555
555
|
...t ? { stream: !0 } : {}
|
|
556
556
|
};
|
|
557
557
|
return n.temperature !== void 0 && (s.temperature = n.temperature), a && (s.system = a), i && i.length > 0 && (s.tools = i.map((e) => ({
|
|
@@ -560,16 +560,16 @@ function S(e, t) {
|
|
|
560
560
|
input_schema: e.inputSchema
|
|
561
561
|
}))), s;
|
|
562
562
|
}
|
|
563
|
-
async function*
|
|
564
|
-
let { config: t, signal: n } = e, r = await fetch(
|
|
563
|
+
async function* de(e) {
|
|
564
|
+
let { config: t, signal: n } = e, r = await fetch(ae, {
|
|
565
565
|
method: "POST",
|
|
566
566
|
headers: {
|
|
567
567
|
"Content-Type": "application/json",
|
|
568
568
|
"x-api-key": t.apiKey,
|
|
569
|
-
"anthropic-version":
|
|
569
|
+
"anthropic-version": oe,
|
|
570
570
|
"anthropic-dangerous-direct-browser-access": "true"
|
|
571
571
|
},
|
|
572
|
-
body: JSON.stringify(
|
|
572
|
+
body: JSON.stringify(x(e, !0)),
|
|
573
573
|
signal: n
|
|
574
574
|
});
|
|
575
575
|
if (!r.ok || !r.body) {
|
|
@@ -577,7 +577,7 @@ async function* ue(e) {
|
|
|
577
577
|
throw Error(`Anthropic request failed (${r.status} ${r.statusText}): ${e}`);
|
|
578
578
|
}
|
|
579
579
|
let i = /* @__PURE__ */ new Map(), a;
|
|
580
|
-
for await (let e of
|
|
580
|
+
for await (let e of g(r.body, n)) {
|
|
581
581
|
let t;
|
|
582
582
|
try {
|
|
583
583
|
t = JSON.parse(e.data);
|
|
@@ -585,9 +585,9 @@ async function* ue(e) {
|
|
|
585
585
|
continue;
|
|
586
586
|
}
|
|
587
587
|
let n = t?.type;
|
|
588
|
-
if (n === "message_start") a =
|
|
588
|
+
if (n === "message_start") a = y(t?.message?.usage);
|
|
589
589
|
else if (n === "message_delta") {
|
|
590
|
-
let e =
|
|
590
|
+
let e = y(t?.usage);
|
|
591
591
|
e && (a = {
|
|
592
592
|
...a,
|
|
593
593
|
...e
|
|
@@ -662,16 +662,16 @@ async function* ue(e) {
|
|
|
662
662
|
}
|
|
663
663
|
yield { type: "done" };
|
|
664
664
|
}
|
|
665
|
-
async function
|
|
666
|
-
let { config: t, signal: n } = e, r = await fetch(
|
|
665
|
+
async function fe(e) {
|
|
666
|
+
let { config: t, signal: n } = e, r = await fetch(ae, {
|
|
667
667
|
method: "POST",
|
|
668
668
|
headers: {
|
|
669
669
|
"Content-Type": "application/json",
|
|
670
670
|
"x-api-key": t.apiKey,
|
|
671
|
-
"anthropic-version":
|
|
671
|
+
"anthropic-version": oe,
|
|
672
672
|
"anthropic-dangerous-direct-browser-access": "true"
|
|
673
673
|
},
|
|
674
|
-
body: JSON.stringify(
|
|
674
|
+
body: JSON.stringify(x(e, !1)),
|
|
675
675
|
signal: n
|
|
676
676
|
});
|
|
677
677
|
if (!r.ok) {
|
|
@@ -689,7 +689,7 @@ async function de(e) {
|
|
|
689
689
|
toolCalls: o
|
|
690
690
|
};
|
|
691
691
|
}
|
|
692
|
-
var
|
|
692
|
+
var pe = /* @__PURE__ */ new Set([
|
|
693
693
|
"type",
|
|
694
694
|
"description",
|
|
695
695
|
"enum",
|
|
@@ -706,15 +706,15 @@ var fe = /* @__PURE__ */ new Set([
|
|
|
706
706
|
"maxLength",
|
|
707
707
|
"pattern"
|
|
708
708
|
]);
|
|
709
|
-
function
|
|
709
|
+
function me(e) {
|
|
710
710
|
if (!e || typeof e != "object") return { type: "object" };
|
|
711
|
-
let t =
|
|
711
|
+
let t = S(e);
|
|
712
712
|
if (typeof t != "object" || !t) return { type: "object" };
|
|
713
713
|
let n = t;
|
|
714
714
|
return n.type ||= "object", n;
|
|
715
715
|
}
|
|
716
|
-
function
|
|
717
|
-
if (Array.isArray(e)) return e.map(
|
|
716
|
+
function S(e) {
|
|
717
|
+
if (Array.isArray(e)) return e.map(S);
|
|
718
718
|
if (!e || typeof e != "object") return e;
|
|
719
719
|
let t = e;
|
|
720
720
|
for (let e of [
|
|
@@ -723,47 +723,47 @@ function C(e) {
|
|
|
723
723
|
"allOf"
|
|
724
724
|
]) {
|
|
725
725
|
let n = t[e];
|
|
726
|
-
if (Array.isArray(n) && n.length === 1) return
|
|
726
|
+
if (Array.isArray(n) && n.length === 1) return S(n[0]);
|
|
727
727
|
}
|
|
728
728
|
let n = {};
|
|
729
|
-
for (let [e, r] of Object.entries(t)) if (
|
|
729
|
+
for (let [e, r] of Object.entries(t)) if (pe.has(e)) if (e === "properties" && r && typeof r == "object") {
|
|
730
730
|
let t = {};
|
|
731
|
-
for (let [e, n] of Object.entries(r)) t[e] =
|
|
731
|
+
for (let [e, n] of Object.entries(r)) t[e] = S(n);
|
|
732
732
|
n[e] = t;
|
|
733
|
-
} else e === "items" ? n[e] =
|
|
733
|
+
} else e === "items" ? n[e] = S(r) : n[e] = r;
|
|
734
734
|
return n;
|
|
735
735
|
}
|
|
736
|
-
function
|
|
736
|
+
function he(e) {
|
|
737
737
|
let t = e.trim();
|
|
738
738
|
return t.startsWith("models/") ? t.slice(7) : t;
|
|
739
739
|
}
|
|
740
|
-
function
|
|
740
|
+
function C(e, t) {
|
|
741
741
|
let n = t === "stream" ? "streamGenerateContent?alt=sse" : "generateContent";
|
|
742
|
-
return `https://generativelanguage.googleapis.com/v1beta/models/${encodeURIComponent(
|
|
742
|
+
return `https://generativelanguage.googleapis.com/v1beta/models/${encodeURIComponent(he(e))}:${n}`;
|
|
743
743
|
}
|
|
744
|
-
function
|
|
744
|
+
function w(e) {
|
|
745
745
|
if (e.type !== "image") return null;
|
|
746
746
|
if (e.data && e.mimeType) return { inlineData: {
|
|
747
747
|
mimeType: e.mimeType,
|
|
748
748
|
data: e.data
|
|
749
749
|
} };
|
|
750
|
-
let t =
|
|
750
|
+
let t = h(e.url);
|
|
751
751
|
return t ? { inlineData: {
|
|
752
752
|
mimeType: t.mimeType,
|
|
753
753
|
data: t.data
|
|
754
754
|
} } : null;
|
|
755
755
|
}
|
|
756
|
-
function
|
|
756
|
+
function ge(e) {
|
|
757
757
|
if (typeof e == "string") return [{ text: e || "[no content]" }];
|
|
758
758
|
let t = [];
|
|
759
759
|
for (let n of e) if (n.type === "text") n.text && t.push({ text: n.text });
|
|
760
760
|
else {
|
|
761
|
-
let e =
|
|
761
|
+
let e = w(n);
|
|
762
762
|
e && t.push(e);
|
|
763
763
|
}
|
|
764
764
|
return t.length === 0 && t.push({ text: "[no content]" }), t;
|
|
765
765
|
}
|
|
766
|
-
function
|
|
766
|
+
function _e(e) {
|
|
767
767
|
if (typeof e == "string") {
|
|
768
768
|
let t;
|
|
769
769
|
try {
|
|
@@ -785,11 +785,11 @@ function ge(e) {
|
|
|
785
785
|
imageParts: n
|
|
786
786
|
};
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function ve(e) {
|
|
789
789
|
let t = [];
|
|
790
790
|
for (let n of e) {
|
|
791
791
|
if (n.role === "tool") {
|
|
792
|
-
let { response: e, imageParts: r } =
|
|
792
|
+
let { response: e, imageParts: r } = _e(n.content), i = t[t.length - 1], a = { functionResponse: {
|
|
793
793
|
name: n.toolName,
|
|
794
794
|
response: e
|
|
795
795
|
} };
|
|
@@ -799,7 +799,7 @@ function _e(e) {
|
|
|
799
799
|
}), r.length > 0) {
|
|
800
800
|
let e = [{ text: p(n.toolName, r.length) }];
|
|
801
801
|
for (let t of r) {
|
|
802
|
-
let n =
|
|
802
|
+
let n = w(t);
|
|
803
803
|
n && e.push(n);
|
|
804
804
|
}
|
|
805
805
|
t.push({
|
|
@@ -823,26 +823,26 @@ function _e(e) {
|
|
|
823
823
|
}
|
|
824
824
|
t.push({
|
|
825
825
|
role: "user",
|
|
826
|
-
parts:
|
|
826
|
+
parts: ge(n.content)
|
|
827
827
|
});
|
|
828
828
|
}
|
|
829
829
|
return t;
|
|
830
830
|
}
|
|
831
|
-
function
|
|
832
|
-
let { config: t, messages: n, tools: r } = e, { system: i, rest: a } =
|
|
831
|
+
function T(e) {
|
|
832
|
+
let { config: t, messages: n, tools: r } = e, { system: i, rest: a } = re(n), o = { contents: ve(a) };
|
|
833
833
|
i && (o.systemInstruction = { parts: [{ text: i }] });
|
|
834
834
|
let s = {};
|
|
835
835
|
return t.temperature !== void 0 && (s.temperature = t.temperature), t.maxTokens !== void 0 && (s.maxOutputTokens = t.maxTokens), Object.keys(s).length > 0 && (o.generationConfig = s), r && r.length > 0 && (o.tools = [{ functionDeclarations: r.map((e) => ({
|
|
836
836
|
name: e.name,
|
|
837
837
|
description: e.description,
|
|
838
|
-
parameters:
|
|
838
|
+
parameters: me(e.inputSchema)
|
|
839
839
|
})) }]), o;
|
|
840
840
|
}
|
|
841
|
-
async function*
|
|
842
|
-
let { config: t, signal: n } = e, r = `${
|
|
841
|
+
async function* ye(e) {
|
|
842
|
+
let { config: t, signal: n } = e, r = `${C(t.model, "stream")}&key=${encodeURIComponent(t.apiKey)}`, i = await fetch(r, {
|
|
843
843
|
method: "POST",
|
|
844
844
|
headers: { "Content-Type": "application/json" },
|
|
845
|
-
body: JSON.stringify(
|
|
845
|
+
body: JSON.stringify(T(e)),
|
|
846
846
|
signal: n
|
|
847
847
|
});
|
|
848
848
|
if (!i.ok || !i.body) {
|
|
@@ -850,14 +850,14 @@ async function* ve(e) {
|
|
|
850
850
|
throw Error(`Google request failed (${i.status} ${i.statusText}): ${e}`);
|
|
851
851
|
}
|
|
852
852
|
let a = 0, o;
|
|
853
|
-
for await (let e of
|
|
853
|
+
for await (let e of g(i.body, n)) {
|
|
854
854
|
let t;
|
|
855
855
|
try {
|
|
856
856
|
t = JSON.parse(e.data);
|
|
857
857
|
} catch {
|
|
858
858
|
continue;
|
|
859
859
|
}
|
|
860
|
-
o =
|
|
860
|
+
o = y(t?.usageMetadata) ?? o;
|
|
861
861
|
let n = t?.candidates?.[0]?.content?.parts ?? [];
|
|
862
862
|
for (let e of n) if (typeof e.text == "string" && e.text.length > 0) yield {
|
|
863
863
|
type: "text-delta",
|
|
@@ -892,11 +892,11 @@ async function* ve(e) {
|
|
|
892
892
|
usage: o
|
|
893
893
|
}), yield { type: "done" };
|
|
894
894
|
}
|
|
895
|
-
async function
|
|
896
|
-
let { config: t, signal: n } = e, r = `${
|
|
895
|
+
async function be(e) {
|
|
896
|
+
let { config: t, signal: n } = e, r = `${C(t.model, "single")}?key=${encodeURIComponent(t.apiKey)}`, i = await fetch(r, {
|
|
897
897
|
method: "POST",
|
|
898
898
|
headers: { "Content-Type": "application/json" },
|
|
899
|
-
body: JSON.stringify(
|
|
899
|
+
body: JSON.stringify(T(e)),
|
|
900
900
|
signal: n
|
|
901
901
|
});
|
|
902
902
|
if (!i.ok) {
|
|
@@ -914,7 +914,7 @@ async function ye(e) {
|
|
|
914
914
|
toolCalls: s
|
|
915
915
|
};
|
|
916
916
|
}
|
|
917
|
-
async function*
|
|
917
|
+
async function* xe(e, t) {
|
|
918
918
|
let n = e.getReader(), r = new TextDecoder(), i = "";
|
|
919
919
|
try {
|
|
920
920
|
for (;;) {
|
|
@@ -939,22 +939,22 @@ async function* be(e, t) {
|
|
|
939
939
|
n.releaseLock();
|
|
940
940
|
}
|
|
941
941
|
}
|
|
942
|
-
var
|
|
943
|
-
function
|
|
942
|
+
var Se = "http://localhost:11434";
|
|
943
|
+
function E(e) {
|
|
944
944
|
let t = (e || "http://localhost:11434").trim(), n = t.length;
|
|
945
945
|
for (; n > 0 && t.charCodeAt(n - 1) === 47;) n--;
|
|
946
946
|
let r = t.slice(0, n);
|
|
947
947
|
return r.endsWith("/api") ? r.slice(0, -4) : r;
|
|
948
948
|
}
|
|
949
|
-
function
|
|
950
|
-
return `${
|
|
949
|
+
function D(e, t) {
|
|
950
|
+
return `${E(e)}${t}`;
|
|
951
951
|
}
|
|
952
|
-
var
|
|
952
|
+
var Ce = class extends Error {
|
|
953
953
|
constructor(e) {
|
|
954
954
|
super("Could not reach Ollama. If it's running, allow this origin by starting Ollama with `OLLAMA_ORIGINS=*` (or your inspector origin) and try again."), this.name = "OllamaCorsError", this.cause = e;
|
|
955
955
|
}
|
|
956
956
|
};
|
|
957
|
-
function
|
|
957
|
+
function we(e) {
|
|
958
958
|
let t = [];
|
|
959
959
|
for (let n of e) {
|
|
960
960
|
if (n.type !== "image") continue;
|
|
@@ -962,27 +962,27 @@ function Ce(e) {
|
|
|
962
962
|
t.push(n.data);
|
|
963
963
|
continue;
|
|
964
964
|
}
|
|
965
|
-
let e =
|
|
965
|
+
let e = h(n.url);
|
|
966
966
|
e?.data && t.push(e.data);
|
|
967
967
|
}
|
|
968
968
|
return t;
|
|
969
969
|
}
|
|
970
|
-
function
|
|
970
|
+
function O(e) {
|
|
971
971
|
if (typeof e == "string") return { content: e };
|
|
972
|
-
let t = e.filter((e) => e.type === "text").map((e) => e.text).join(""), n =
|
|
972
|
+
let t = e.filter((e) => e.type === "text").map((e) => e.text).join(""), n = we(e);
|
|
973
973
|
return {
|
|
974
974
|
content: t,
|
|
975
975
|
...n.length > 0 ? { images: n } : {}
|
|
976
976
|
};
|
|
977
977
|
}
|
|
978
|
-
function
|
|
978
|
+
function Te(e) {
|
|
979
979
|
return e.map((e) => e.role === "tool" ? {
|
|
980
980
|
role: "tool",
|
|
981
981
|
tool_name: e.toolName,
|
|
982
982
|
content: typeof e.content == "string" ? e.content : JSON.stringify(e.toolResult ?? e.content)
|
|
983
983
|
} : e.role === "assistant" ? {
|
|
984
984
|
role: "assistant",
|
|
985
|
-
...typeof e.content == "string" ? { content: e.content } :
|
|
985
|
+
...typeof e.content == "string" ? { content: e.content } : O(e.content),
|
|
986
986
|
...e.toolCalls?.length ? { tool_calls: e.toolCalls.map((e, t) => ({
|
|
987
987
|
type: "function",
|
|
988
988
|
function: {
|
|
@@ -993,13 +993,13 @@ function we(e) {
|
|
|
993
993
|
})) } : {}
|
|
994
994
|
} : {
|
|
995
995
|
role: e.role,
|
|
996
|
-
...
|
|
996
|
+
...O(e.content)
|
|
997
997
|
});
|
|
998
998
|
}
|
|
999
|
-
function
|
|
999
|
+
function k(e, t) {
|
|
1000
1000
|
let { config: n, messages: r, tools: i } = e, a = {
|
|
1001
1001
|
model: n.model,
|
|
1002
|
-
messages:
|
|
1002
|
+
messages: Te(r),
|
|
1003
1003
|
stream: t
|
|
1004
1004
|
}, o = {};
|
|
1005
1005
|
return n.temperature !== void 0 && (o.temperature = n.temperature), n.maxTokens !== void 0 && (o.num_predict = n.maxTokens), Object.keys(o).length > 0 && (a.options = o), i && i.length > 0 && (a.tools = i.map((e) => ({
|
|
@@ -1011,13 +1011,13 @@ function A(e, t) {
|
|
|
1011
1011
|
}
|
|
1012
1012
|
}))), a;
|
|
1013
1013
|
}
|
|
1014
|
-
function
|
|
1014
|
+
function A(e) {
|
|
1015
1015
|
return {
|
|
1016
1016
|
"Content-Type": "application/json",
|
|
1017
1017
|
...e.apiKey.trim() ? { Authorization: `Bearer ${e.apiKey.trim()}` } : {}
|
|
1018
1018
|
};
|
|
1019
1019
|
}
|
|
1020
|
-
function
|
|
1020
|
+
function j(e) {
|
|
1021
1021
|
return Array.isArray(e) ? e.map((e) => {
|
|
1022
1022
|
let t = e && typeof e == "object" ? e.function : void 0, n = typeof t?.name == "string" ? t.name : "", r = t?.arguments;
|
|
1023
1023
|
return {
|
|
@@ -1026,11 +1026,11 @@ function M(e) {
|
|
|
1026
1026
|
};
|
|
1027
1027
|
}).filter((e) => e.name) : [];
|
|
1028
1028
|
}
|
|
1029
|
-
async function*
|
|
1030
|
-
let { config: t, signal: n } = e, r = await fetch(
|
|
1029
|
+
async function* Ee(e) {
|
|
1030
|
+
let { config: t, signal: n } = e, r = await fetch(D(t.baseUrl, "/api/chat"), {
|
|
1031
1031
|
method: "POST",
|
|
1032
|
-
headers:
|
|
1033
|
-
body: JSON.stringify(
|
|
1032
|
+
headers: A(t),
|
|
1033
|
+
body: JSON.stringify(k(e, !0)),
|
|
1034
1034
|
signal: n
|
|
1035
1035
|
});
|
|
1036
1036
|
if (!r.ok || !r.body) {
|
|
@@ -1038,13 +1038,13 @@ async function* Te(e) {
|
|
|
1038
1038
|
throw Error(`Ollama request failed (${r.status} ${r.statusText}): ${e}`);
|
|
1039
1039
|
}
|
|
1040
1040
|
let i = !1, a;
|
|
1041
|
-
for await (let e of
|
|
1041
|
+
for await (let e of xe(r.body, n)) {
|
|
1042
1042
|
let t = e && typeof e == "object" ? e.message : void 0;
|
|
1043
1043
|
if (typeof t?.content == "string" && t.content.length > 0 && (yield {
|
|
1044
1044
|
type: "text-delta",
|
|
1045
1045
|
delta: t.content
|
|
1046
1046
|
}), !i) {
|
|
1047
|
-
let e =
|
|
1047
|
+
let e = j(t?.tool_calls);
|
|
1048
1048
|
if (e.length > 0) {
|
|
1049
1049
|
for (let [t, n] of e.entries()) {
|
|
1050
1050
|
let e = `call_${t}_${n.name || "tool"}`;
|
|
@@ -1075,18 +1075,18 @@ async function* Te(e) {
|
|
|
1075
1075
|
e && typeof e == "object" && e.error && (yield {
|
|
1076
1076
|
type: "error",
|
|
1077
1077
|
message: String(e.error)
|
|
1078
|
-
}), a =
|
|
1078
|
+
}), a = y(e) ?? a;
|
|
1079
1079
|
}
|
|
1080
1080
|
a && (yield {
|
|
1081
1081
|
type: "usage",
|
|
1082
1082
|
usage: a
|
|
1083
1083
|
}), yield { type: "done" };
|
|
1084
1084
|
}
|
|
1085
|
-
async function
|
|
1086
|
-
let { config: t, signal: n } = e, r = await fetch(
|
|
1085
|
+
async function De(e) {
|
|
1086
|
+
let { config: t, signal: n } = e, r = await fetch(D(t.baseUrl, "/api/chat"), {
|
|
1087
1087
|
method: "POST",
|
|
1088
|
-
headers:
|
|
1089
|
-
body: JSON.stringify(
|
|
1088
|
+
headers: A(t),
|
|
1089
|
+
body: JSON.stringify(k(e, !1)),
|
|
1090
1090
|
signal: n
|
|
1091
1091
|
});
|
|
1092
1092
|
if (!r.ok) {
|
|
@@ -1096,14 +1096,14 @@ async function Ee(e) {
|
|
|
1096
1096
|
let i = (await r.json())?.message ?? {};
|
|
1097
1097
|
return {
|
|
1098
1098
|
text: typeof i.content == "string" ? i.content : "",
|
|
1099
|
-
toolCalls:
|
|
1099
|
+
toolCalls: j(i.tool_calls).map((e, t) => ({
|
|
1100
1100
|
id: `call_${t}_${e.name || "tool"}`,
|
|
1101
1101
|
name: e.name,
|
|
1102
1102
|
args: e.args
|
|
1103
1103
|
}))
|
|
1104
1104
|
};
|
|
1105
1105
|
}
|
|
1106
|
-
var
|
|
1106
|
+
var M = class extends Error {
|
|
1107
1107
|
status;
|
|
1108
1108
|
body;
|
|
1109
1109
|
constructor(e, t, n) {
|
|
@@ -1115,7 +1115,7 @@ async function N(e) {
|
|
|
1115
1115
|
if (t) try {
|
|
1116
1116
|
n = JSON.parse(t);
|
|
1117
1117
|
} catch {}
|
|
1118
|
-
throw new
|
|
1118
|
+
throw new M(e.status, `OpenAI request failed (${e.status} ${e.statusText}): ${t}`, n);
|
|
1119
1119
|
}
|
|
1120
1120
|
var Oe = "https://api.openai.com/v1";
|
|
1121
1121
|
function P(e, t) {
|
|
@@ -1206,7 +1206,7 @@ async function* L(e) {
|
|
|
1206
1206
|
}), c = s.body;
|
|
1207
1207
|
s.ok || await N(s), c || await N(s);
|
|
1208
1208
|
let l = c, u = /* @__PURE__ */ new Map();
|
|
1209
|
-
for await (let e of
|
|
1209
|
+
for await (let e of g(l, i)) {
|
|
1210
1210
|
if (!e.data || e.data === "[DONE]") continue;
|
|
1211
1211
|
let t;
|
|
1212
1212
|
try {
|
|
@@ -1214,7 +1214,7 @@ async function* L(e) {
|
|
|
1214
1214
|
} catch {
|
|
1215
1215
|
continue;
|
|
1216
1216
|
}
|
|
1217
|
-
let n =
|
|
1217
|
+
let n = y(t?.usage);
|
|
1218
1218
|
n && (yield {
|
|
1219
1219
|
type: "usage",
|
|
1220
1220
|
usage: n
|
|
@@ -1324,10 +1324,10 @@ function Ae(e) {
|
|
|
1324
1324
|
switch (e.config.provider) {
|
|
1325
1325
|
case "openai": throw Error("provider 'openai' uses the Responses API via OpenAIResponsesDriver, not streamChat");
|
|
1326
1326
|
case "openai-compatible": return L(e);
|
|
1327
|
-
case "anthropic": return
|
|
1328
|
-
case "google": return
|
|
1327
|
+
case "anthropic": return de(e);
|
|
1328
|
+
case "google": return ye(e);
|
|
1329
1329
|
case "openrouter": return L(z(e));
|
|
1330
|
-
case "ollama": return
|
|
1330
|
+
case "ollama": return Ee(e);
|
|
1331
1331
|
default: throw Error(`Unsupported LLM provider: ${e.config.provider}`);
|
|
1332
1332
|
}
|
|
1333
1333
|
}
|
|
@@ -1335,10 +1335,10 @@ function je(e) {
|
|
|
1335
1335
|
switch (e.config.provider) {
|
|
1336
1336
|
case "openai": throw Error("provider 'openai' uses the Responses API via OpenAIResponsesDriver, not chat");
|
|
1337
1337
|
case "openai-compatible": return R(e);
|
|
1338
|
-
case "anthropic": return
|
|
1339
|
-
case "google": return
|
|
1338
|
+
case "anthropic": return fe(e);
|
|
1339
|
+
case "google": return be(e);
|
|
1340
1340
|
case "openrouter": return R(z(e));
|
|
1341
|
-
case "ollama": return
|
|
1341
|
+
case "ollama": return De(e);
|
|
1342
1342
|
default: throw Error(`Unsupported LLM provider: ${e.config.provider}`);
|
|
1343
1343
|
}
|
|
1344
1344
|
}
|
|
@@ -1512,7 +1512,7 @@ async function* J(e) {
|
|
|
1512
1512
|
});
|
|
1513
1513
|
if (!t.ok || !t.body) throw Error(await H(t));
|
|
1514
1514
|
let n = /* @__PURE__ */ new Map(), r = 0, i = [];
|
|
1515
|
-
for await (let a of
|
|
1515
|
+
for await (let a of g(t.body, e.signal)) {
|
|
1516
1516
|
if (!a.data || a.data === "[DONE]") continue;
|
|
1517
1517
|
let e;
|
|
1518
1518
|
try {
|
|
@@ -1572,7 +1572,7 @@ async function* J(e) {
|
|
|
1572
1572
|
if (t === "response.completed") {
|
|
1573
1573
|
let t = e.response;
|
|
1574
1574
|
t && Array.isArray(t.output) && (i = t.output);
|
|
1575
|
-
let n =
|
|
1575
|
+
let n = y(t?.usage);
|
|
1576
1576
|
n && (yield {
|
|
1577
1577
|
type: "usage",
|
|
1578
1578
|
usage: n
|
|
@@ -1775,6 +1775,7 @@ async function* Re(e) {
|
|
|
1775
1775
|
args: r.args
|
|
1776
1776
|
}), yield r;
|
|
1777
1777
|
} catch (e) {
|
|
1778
|
+
if (e instanceof M) throw e;
|
|
1778
1779
|
yield {
|
|
1779
1780
|
type: "error",
|
|
1780
1781
|
message: e instanceof Error ? e.message : String(e)
|
|
@@ -1956,7 +1957,7 @@ function We(e, t, n) {
|
|
|
1956
1957
|
credentials: n?.credentials
|
|
1957
1958
|
};
|
|
1958
1959
|
}
|
|
1959
|
-
var Ge = "2.0.0-beta.
|
|
1960
|
+
var Ge = "2.0.0-beta.1";
|
|
1960
1961
|
function Ke() {
|
|
1961
1962
|
return Ge;
|
|
1962
1963
|
}
|
|
@@ -2168,7 +2169,7 @@ Raw error: ${c}`);
|
|
|
2168
2169
|
if (!this.initialized) {
|
|
2169
2170
|
if (this.isSimplifiedMode) {
|
|
2170
2171
|
if (!this.client && this.mcpServersConfig) {
|
|
2171
|
-
let { MCPClient: e } = await import("./index-browser-
|
|
2172
|
+
let { MCPClient: e } = await import("./index-browser-QDjRGsPo.js").then((e) => e.i);
|
|
2172
2173
|
this.client = new e({ mcpServers: this.mcpServersConfig }), this.clientOwnedByAgent = !0;
|
|
2173
2174
|
}
|
|
2174
2175
|
this.llmString && (this.driver = X(Q(this.llmString, this.llmConfig)));
|
|
@@ -2302,4 +2303,4 @@ async function Qe(e) {
|
|
|
2302
2303
|
})).text;
|
|
2303
2304
|
}
|
|
2304
2305
|
//#endregion
|
|
2305
|
-
export { Qe as a, We as c,
|
|
2306
|
+
export { Qe as a, We as c, D as i, Ze as n, ne as o, Ce as r, E as s, Se as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as e, t } from "./react-BIs9pQ3H.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Br as n } from "./input-C2OBd4PJ.js";
|
|
3
3
|
//#region ../../node_modules/.pnpm/sonner@2.0.7_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/sonner/dist/index.mjs
|
|
4
4
|
var r = /* @__PURE__ */ e(t(), 1), i = /* @__PURE__ */ e(n(), 1);
|
|
5
5
|
function a(e) {
|