@roomle/embedding-lib 11.0.0-alpha.6 → 11.0.0-alpha.8
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/THIRD-PARTY-NOTICES.txt +1 -1
- package/ai.js +6 -6
- package/ai.min.js +5 -4
- package/{browser-D6M-d6y5.mjs → browser-Cys-y5Hy.mjs} +1 -2
- package/chat-model-B7BO8IhK.mjs +212 -0
- package/chat-model-XYf503pT.mjs +213 -0
- package/coerce-CuLRCRlo.mjs +6 -0
- package/coerce-Dup0o-HR.mjs +7 -0
- package/{comlink-CG3f9q6z.mjs → comlink-7u13Z2ZH.mjs} +2 -3
- package/{comlink-hSUzCx9j.mjs → comlink-DKhvPU0o.mjs} +1 -1
- package/configurator.js +3 -4
- package/configurator.min.js +2 -2
- package/construction.js +278 -24
- package/construction.min.js +284 -27
- package/continuation-CswXtOus.mjs +10 -0
- package/continuation-NclHDSgS.mjs +9 -0
- package/{dist-Cm3aF4sf.mjs → dist-7-X7Xqsl.mjs} +851 -919
- package/{dist-BQaw78-_.mjs → dist-BMxyw-Zs.mjs} +411 -405
- package/{dist-0WZWTj8T.mjs → dist-BU022PnG.mjs} +4 -9
- package/{dist-DkR6G9Kj.mjs → dist-BY8OLJ2p.mjs} +1 -1
- package/{dist-6TznX-Ae.mjs → dist-BZSd56sr.mjs} +3850 -3942
- package/{dist-70R0b5Mq.mjs → dist-Ba3J8AjB.mjs} +400 -390
- package/{dist-CTS0DDwt.mjs → dist-CbQKC1xX.mjs} +1590 -1616
- package/{dist-BmOBP9h9.mjs → dist-CiybWJvs.mjs} +44 -41
- package/{dist-CPG4atmb.mjs → dist-CkZuNdCU.mjs} +6 -4
- package/{dist-Bt1FopV4.mjs → dist-D2ZAAHGn.mjs} +1058 -1042
- package/{dist-BWNv7qW9.mjs → dist-DjsS42rR.mjs} +916 -962
- package/{dist-9UI7dzwc.mjs → dist-Jcq_kKKT.mjs} +403 -393
- package/{dist-D0XFfKEL.mjs → dist-S9sLSjZ4.mjs} +3112 -3104
- package/{dist-BV-32IEX.mjs → dist-XECXrV5Q.mjs} +1497 -1558
- package/{dist-Bc2s-kJZ.mjs → dist-a5_BIeaS.mjs} +45 -51
- package/{dist-Crrp-Bno.mjs → dist-bQAJDeYc.mjs} +698 -748
- package/docs/md/web/embedding/CHANGELOG.md +19 -64
- package/{drag-ghost-BpIDzSdK.mjs → drag-ghost-QZelgA-_.mjs} +2 -3
- package/{drag-ghost-Bhb0_67G.mjs → drag-ghost-VmgSWLva.mjs} +5 -7
- package/{drag-in-mE_ozj_Q.mjs → drag-in-Cd_67tzS.mjs} +4 -5
- package/{drag-in-CGBG4wEk.mjs → drag-in-DlDsgY4T.mjs} +3 -3
- package/embedding-plugins.js +1 -2
- package/embedding-plugins.min.js +1 -2
- package/{experimental-evaluation-FzKFGoye.mjs → experimental-evaluation-B4hKMgFH.mjs} +19 -38
- package/{experimental-evaluation-DczxmJme.mjs → experimental-evaluation-DmqghFSx.mjs} +1 -1
- package/{from-custom-view-B3fIWMox.mjs → from-custom-view-6HMD_sPe.mjs} +5 -4
- package/{from-custom-view-B3HCOhdT.mjs → from-custom-view-BRFynafo.mjs} +16 -16
- package/{from-website-DaTahmvJ.mjs → from-website-Dl1VN4h7.mjs} +5 -6
- package/{from-website-DUQ9USj1.mjs → from-website-iZzauH4C.mjs} +3 -3
- package/hi.js +188 -197
- package/hi.min.js +193 -194
- package/mcp-tools-BLB7pCga.mjs +42 -0
- package/mcp-tools-BirFT2R0.mjs +41 -0
- package/package.json +1 -1
- package/packages/web-sdk/packages/assistant.d.ts +1 -0
- package/packages/web-sdk/packages/common-core/src/planning-assistant/runtime.d.ts +4 -1
- package/packages/web-sdk/packages/common-core/src/planning-assistant.d.ts +3 -0
- package/rolldown-runtime--db92txo.mjs +10 -0
- package/rolldown-runtime-CyjYJMBa.mjs +11 -0
- package/roomle-embedding-lib.js +25 -34
- package/roomle-embedding-lib.min.js +3 -3
- package/sbom.cdx.json +5 -5
- package/turn-limits-9LbUeSG2.mjs +9 -0
- package/turn-limits-Ciq383Bd.mjs +10 -0
- package/{utils-BwWn6Fw4.mjs → utils-CJnKZceY.mjs} +3 -4
- package/{utils-BoELtcEK.mjs → utils-DdNhTbJr.mjs} +6 -6
- package/chat-model-CZfZsgX9.mjs +0 -377
- package/chat-model-vgLJamoj.mjs +0 -373
- package/coerce-CqJod_GZ.mjs +0 -8
- package/coerce-CsI42_k0.mjs +0 -6
- package/mcp-tools-8qPMNqTK.mjs +0 -2
- package/mcp-tools-D_GxXscW.mjs +0 -2
- /package/{browser-BjtSrqbu.mjs → browser-CzLpXYFF.mjs} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { $ as e, A as t, Bt as n, D as r, E as i, Et as a, F as o, Ft as s, H as c, Ht as l, It as u, Jt as d, K as f, Kt as p, L as m, Lt as h, M as g, Mt as _, N as v, O as y, Ot as b, Pn as x, Pt as S, Qt as C, Rt as w, S as T, Sn as E, St as D, T as O, Tt as k, U as A, Vt as j, Wt as M, X as ee, Yt as N, Zt as P, _ as F, _n as te, _t as I, an as L, b as ne, bn as R, bt as z, cn as B, ct as re, dn as V, en as ie, f as H, fn as U, ft as ae, g as oe, h as se, ht as ce, i as le, in as W, j as ue, jn as G, jt as K, k as de, kn as fe, kt as pe, ln as q, m as me, nt as he, o as ge, ot as J, p as _e, pt as ve, qt as ye, sn as Y, st as be, tn as X, un as xe, v as Se, w as Ce, x as we, xn as Te, xt as Ee, yt as De, zt as Oe } from "./dist-
|
|
3
|
-
import { t as ke } from "./coerce-
|
|
4
|
-
import { t as Ae } from "./experimental-evaluation-
|
|
5
|
-
|
|
2
|
+
import { $ as e, A as t, Bt as n, D as r, E as i, Et as a, F as o, Ft as s, H as c, Ht as l, It as u, Jt as d, K as f, Kt as p, L as m, Lt as h, M as g, Mt as _, N as v, O as y, Ot as b, Pn as x, Pt as S, Qt as C, Rt as w, S as T, Sn as E, St as D, T as O, Tt as k, U as A, Vt as j, Wt as M, X as ee, Yt as N, Zt as P, _ as F, _n as te, _t as I, an as L, b as ne, bn as R, bt as z, cn as B, ct as re, dn as V, en as ie, f as H, fn as U, ft as ae, g as oe, h as se, ht as ce, i as le, in as W, j as ue, jn as G, jt as K, k as de, kn as fe, kt as pe, ln as q, m as me, nt as he, o as ge, ot as J, p as _e, pt as ve, qt as ye, sn as Y, st as be, tn as X, un as xe, v as Se, w as Ce, x as we, xn as Te, xt as Ee, yt as De, zt as Oe } from "./dist-XECXrV5Q.mjs";
|
|
3
|
+
import { t as ke } from "./coerce-Dup0o-HR.mjs";
|
|
4
|
+
import { t as Ae } from "./experimental-evaluation-B4hKMgFH.mjs";
|
|
5
|
+
// node_modules/@ai-sdk/openai/dist/index.js
|
|
6
6
|
var je = L({ error: L({
|
|
7
7
|
message: q(),
|
|
8
8
|
type: q().nullish(),
|
|
@@ -333,16 +333,14 @@ function Xe({ prompt: e, systemMessageMode: t = "system" }) {
|
|
|
333
333
|
}), r ||= i != null;
|
|
334
334
|
break;
|
|
335
335
|
}
|
|
336
|
-
case "tool-call":
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
});
|
|
345
|
-
break;
|
|
336
|
+
case "tool-call": i.push({
|
|
337
|
+
id: n.toolCallId,
|
|
338
|
+
type: "function",
|
|
339
|
+
function: {
|
|
340
|
+
name: n.toolName,
|
|
341
|
+
arguments: Ye(n.input)
|
|
342
|
+
}
|
|
343
|
+
});
|
|
346
344
|
}
|
|
347
345
|
n.push({
|
|
348
346
|
role: "assistant",
|
|
@@ -365,9 +363,7 @@ function Xe({ prompt: e, systemMessageMode: t = "system" }) {
|
|
|
365
363
|
break;
|
|
366
364
|
case "content":
|
|
367
365
|
case "json":
|
|
368
|
-
case "error-json":
|
|
369
|
-
i = JSON.stringify(t.value);
|
|
370
|
-
break;
|
|
366
|
+
case "error-json": i = JSON.stringify(t.value);
|
|
371
367
|
}
|
|
372
368
|
n.push({
|
|
373
369
|
role: "tool",
|
|
@@ -619,23 +615,11 @@ function rt(e) {
|
|
|
619
615
|
let t = !1, n = !1;
|
|
620
616
|
for (let r = 0; r < e.length; r++) {
|
|
621
617
|
let i = e[r];
|
|
622
|
-
if (t)
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
if (i === "
|
|
627
|
-
t = !0;
|
|
628
|
-
continue;
|
|
629
|
-
}
|
|
630
|
-
if (i === "[") {
|
|
631
|
-
n = !0;
|
|
632
|
-
continue;
|
|
633
|
-
}
|
|
634
|
-
if (i === "]") {
|
|
635
|
-
n = !1;
|
|
636
|
-
continue;
|
|
637
|
-
}
|
|
638
|
-
if (!n && i === "(" && e[r + 1] === "?") {
|
|
618
|
+
if (t) t = !1;
|
|
619
|
+
else if (i === "\\") t = !0;
|
|
620
|
+
else if (i === "[") n = !0;
|
|
621
|
+
else if (i === "]") n = !1;
|
|
622
|
+
else if (!n && i === "(" && e[r + 1] === "?") {
|
|
639
623
|
let t = e[r + 2];
|
|
640
624
|
if (t === "=" || t === "!" || t === "<" && (e[r + 3] === "=" || e[r + 3] === "!")) return !0;
|
|
641
625
|
}
|
|
@@ -665,12 +649,10 @@ function it({ tools: e, toolChoice: t }) {
|
|
|
665
649
|
});
|
|
666
650
|
break;
|
|
667
651
|
}
|
|
668
|
-
default:
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
});
|
|
673
|
-
break;
|
|
652
|
+
default: n.push({
|
|
653
|
+
type: "unsupported",
|
|
654
|
+
feature: `tool type: ${t.type}`
|
|
655
|
+
});
|
|
674
656
|
}
|
|
675
657
|
if (t == null) return {
|
|
676
658
|
tools: r,
|
|
@@ -739,7 +721,7 @@ var at = class e {
|
|
|
739
721
|
let C = {
|
|
740
722
|
model: this.modelId,
|
|
741
723
|
logit_bias: h.logitBias,
|
|
742
|
-
logprobs: h.logprobs === !0 || typeof h.logprobs == "number"
|
|
724
|
+
logprobs: h.logprobs === !0 || typeof h.logprobs == "number" || void 0,
|
|
743
725
|
top_logprobs: typeof h.logprobs == "number" ? h.logprobs : typeof h.logprobs == "boolean" && h.logprobs ? 0 : void 0,
|
|
744
726
|
user: h.user,
|
|
745
727
|
parallel_tool_calls: h.parallelToolCalls,
|
|
@@ -776,7 +758,7 @@ var at = class e {
|
|
|
776
758
|
type: "unsupported",
|
|
777
759
|
feature: "promptCacheRetention",
|
|
778
760
|
details: "promptCacheRetention is not supported by GPT-6 and later models; use promptCacheOptions instead"
|
|
779
|
-
})), v ? (
|
|
761
|
+
})), v ? (_ === "none" && g.supportsNonReasoningParameters || (C.temperature != null && (C.temperature = void 0, m.push({
|
|
780
762
|
type: "unsupported",
|
|
781
763
|
feature: "temperature",
|
|
782
764
|
details: "temperature is not supported for reasoning models"
|
|
@@ -809,7 +791,7 @@ var at = class e {
|
|
|
809
791
|
type: "unsupported",
|
|
810
792
|
feature: "serviceTier",
|
|
811
793
|
details: "flex processing is only available for o3, o4-mini, and gpt-5 models"
|
|
812
|
-
}), C.service_tier = void 0),
|
|
794
|
+
}), C.service_tier = void 0), h.serviceTier !== "priority" && h.serviceTier !== "fast" || g.supportsPriorityProcessing || (m.push({
|
|
813
795
|
type: "unsupported",
|
|
814
796
|
feature: "serviceTier",
|
|
815
797
|
details: "priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"
|
|
@@ -1026,9 +1008,7 @@ function ct({ prompt: e, user: t = "user", assistant: n = "assistant" }) {
|
|
|
1026
1008
|
});
|
|
1027
1009
|
case "user": {
|
|
1028
1010
|
let e = a.map((e) => {
|
|
1029
|
-
|
|
1030
|
-
case "text": return e.text;
|
|
1031
|
-
}
|
|
1011
|
+
if (e.type === "text") return e.text;
|
|
1032
1012
|
}).filter(Boolean).join("");
|
|
1033
1013
|
r += `${t}:
|
|
1034
1014
|
${e}
|
|
@@ -1628,7 +1608,7 @@ var At = J(() => n(kt.extend({
|
|
|
1628
1608
|
"gpt-image-2.5-sunburst",
|
|
1629
1609
|
"gpt-image-2.5-sunburst-2026-09-08",
|
|
1630
1610
|
"chatgpt-image-latest"
|
|
1631
|
-
].includes(this.modelId) ? !0 : this.modelId
|
|
1611
|
+
].includes(this.modelId) ? !0 : this.modelId !== "dall-e-3" && void 0 : this.config.imageInputCapabilities.supportsFileInputs;
|
|
1632
1612
|
}
|
|
1633
1613
|
get supportsMaskInputs() {
|
|
1634
1614
|
return this.config.imageInputCapabilities == null ? this.supportsFileInputs : this.config.imageInputCapabilities.supportsMaskInputs;
|
|
@@ -1913,10 +1893,10 @@ var Lt = t({
|
|
|
1913
1893
|
syntax: M(["regex", "lark"]),
|
|
1914
1894
|
definition: q()
|
|
1915
1895
|
}), L({ type: X("text") })]).optional()
|
|
1916
|
-
}))), Xt = de({
|
|
1896
|
+
}))), Xt = J(() => n(q())), Zt = de({
|
|
1917
1897
|
id: "openai.custom",
|
|
1918
|
-
inputSchema:
|
|
1919
|
-
}),
|
|
1898
|
+
inputSchema: Xt
|
|
1899
|
+
}), Qt = (e) => Zt(e), $t = L({
|
|
1920
1900
|
key: q(),
|
|
1921
1901
|
type: M([
|
|
1922
1902
|
"eq",
|
|
@@ -1934,18 +1914,18 @@ var Lt = t({
|
|
|
1934
1914
|
N(),
|
|
1935
1915
|
d(q())
|
|
1936
1916
|
])
|
|
1937
|
-
}),
|
|
1917
|
+
}), en = L({
|
|
1938
1918
|
type: M(["and", "or"]),
|
|
1939
|
-
filters: d(V([
|
|
1940
|
-
}),
|
|
1919
|
+
filters: d(V([$t, ie(() => en)]))
|
|
1920
|
+
}), tn = J(() => n(L({
|
|
1941
1921
|
vectorStoreIds: d(q()),
|
|
1942
1922
|
maxNumResults: W().optional(),
|
|
1943
1923
|
ranking: L({
|
|
1944
1924
|
ranker: q().optional(),
|
|
1945
1925
|
scoreThreshold: W().optional()
|
|
1946
1926
|
}).optional(),
|
|
1947
|
-
filters: V([
|
|
1948
|
-
}))),
|
|
1927
|
+
filters: V([$t, en]).optional()
|
|
1928
|
+
}))), nn = J(() => n(L({
|
|
1949
1929
|
queries: d(q()),
|
|
1950
1930
|
results: d(L({
|
|
1951
1931
|
attributes: Y(q(), U()),
|
|
@@ -1954,11 +1934,11 @@ var Lt = t({
|
|
|
1954
1934
|
score: W(),
|
|
1955
1935
|
text: q()
|
|
1956
1936
|
})).nullable()
|
|
1957
|
-
}))),
|
|
1937
|
+
}))), rn = ue({
|
|
1958
1938
|
id: "openai.file_search",
|
|
1959
1939
|
inputSchema: L({}),
|
|
1960
|
-
outputSchema:
|
|
1961
|
-
}),
|
|
1940
|
+
outputSchema: nn
|
|
1941
|
+
}), an = J(() => n(L({
|
|
1962
1942
|
action: M([
|
|
1963
1943
|
"generate",
|
|
1964
1944
|
"edit",
|
|
@@ -1997,33 +1977,33 @@ var Lt = t({
|
|
|
1997
1977
|
"1536x1024",
|
|
1998
1978
|
"auto"
|
|
1999
1979
|
]), q().regex(/^\d+x\d+$/)]).optional()
|
|
2000
|
-
}).strict())),
|
|
1980
|
+
}).strict())), on = J(() => n(L({}))), sn = J(() => n(L({ result: q() }))), cn = ue({
|
|
2001
1981
|
id: "openai.image_generation",
|
|
2002
|
-
inputSchema:
|
|
2003
|
-
outputSchema:
|
|
2004
|
-
}),
|
|
1982
|
+
inputSchema: on,
|
|
1983
|
+
outputSchema: sn
|
|
1984
|
+
}), ln = (e = {}) => cn(e), un = J(() => n(L({ action: L({
|
|
2005
1985
|
type: X("exec"),
|
|
2006
1986
|
command: d(q()),
|
|
2007
1987
|
timeoutMs: W().optional(),
|
|
2008
1988
|
user: q().optional(),
|
|
2009
1989
|
workingDirectory: q().optional(),
|
|
2010
1990
|
env: Y(q(), q()).optional()
|
|
2011
|
-
}) }))),
|
|
1991
|
+
}) }))), dn = J(() => n(L({ output: q() }))), fn = t({
|
|
2012
1992
|
id: "openai.local_shell",
|
|
2013
|
-
inputSchema:
|
|
2014
|
-
outputSchema:
|
|
2015
|
-
}),
|
|
1993
|
+
inputSchema: un,
|
|
1994
|
+
outputSchema: dn
|
|
1995
|
+
}), pn = J(() => n(L({ action: L({
|
|
2016
1996
|
commands: d(q()),
|
|
2017
1997
|
timeoutMs: W().optional(),
|
|
2018
1998
|
maxOutputLength: W().optional()
|
|
2019
|
-
}) }))),
|
|
1999
|
+
}) }))), mn = J(() => n(L({ output: d(L({
|
|
2020
2000
|
stdout: q(),
|
|
2021
2001
|
stderr: q(),
|
|
2022
2002
|
outcome: P("type", [L({ type: X("timeout") }), L({
|
|
2023
2003
|
type: X("exit"),
|
|
2024
2004
|
exitCode: W()
|
|
2025
2005
|
})])
|
|
2026
|
-
})) }))),
|
|
2006
|
+
})) }))), hn = d(P("type", [L({
|
|
2027
2007
|
type: X("skillReference"),
|
|
2028
2008
|
providerReference: Y(q(), q()),
|
|
2029
2009
|
version: q().optional()
|
|
@@ -2036,7 +2016,7 @@ var Lt = t({
|
|
|
2036
2016
|
mediaType: X("application/zip"),
|
|
2037
2017
|
data: q()
|
|
2038
2018
|
})
|
|
2039
|
-
})])).optional(),
|
|
2019
|
+
})])).optional(), gn = J(() => n(L({ environment: V([
|
|
2040
2020
|
L({
|
|
2041
2021
|
type: X("containerAuto"),
|
|
2042
2022
|
fileIds: d(q()).optional(),
|
|
@@ -2055,7 +2035,7 @@ var Lt = t({
|
|
|
2055
2035
|
value: q()
|
|
2056
2036
|
})).optional()
|
|
2057
2037
|
})]).optional(),
|
|
2058
|
-
skills:
|
|
2038
|
+
skills: hn
|
|
2059
2039
|
}),
|
|
2060
2040
|
L({
|
|
2061
2041
|
type: X("containerReference"),
|
|
@@ -2069,22 +2049,22 @@ var Lt = t({
|
|
|
2069
2049
|
path: q()
|
|
2070
2050
|
})).optional()
|
|
2071
2051
|
})
|
|
2072
|
-
]).optional() }))),
|
|
2052
|
+
]).optional() }))), _n = t({
|
|
2073
2053
|
id: "openai.shell",
|
|
2074
|
-
inputSchema:
|
|
2075
|
-
outputSchema:
|
|
2076
|
-
}),
|
|
2054
|
+
inputSchema: pn,
|
|
2055
|
+
outputSchema: mn
|
|
2056
|
+
}), vn = J(() => n(L({
|
|
2077
2057
|
execution: M(["server", "client"]).optional(),
|
|
2078
2058
|
description: q().optional(),
|
|
2079
2059
|
parameters: Y(q(), U()).optional()
|
|
2080
|
-
}))),
|
|
2060
|
+
}))), yn = J(() => n(L({
|
|
2081
2061
|
arguments: U().optional(),
|
|
2082
2062
|
call_id: q().nullish()
|
|
2083
|
-
}))),
|
|
2063
|
+
}))), bn = J(() => n(L({ tools: d(Y(q(), U())) }))), xn = t({
|
|
2084
2064
|
id: "openai.tool_search",
|
|
2085
|
-
inputSchema:
|
|
2086
|
-
outputSchema:
|
|
2087
|
-
}),
|
|
2065
|
+
inputSchema: yn,
|
|
2066
|
+
outputSchema: bn
|
|
2067
|
+
}), Sn = (e = {}) => xn(e), Cn = J(() => n(L({
|
|
2088
2068
|
externalWebAccess: N().optional(),
|
|
2089
2069
|
filters: L({
|
|
2090
2070
|
allowedDomains: d(q()).optional(),
|
|
@@ -2102,35 +2082,35 @@ var Lt = t({
|
|
|
2102
2082
|
region: q().optional(),
|
|
2103
2083
|
timezone: q().optional()
|
|
2104
2084
|
}).optional()
|
|
2105
|
-
}))),
|
|
2085
|
+
}))), wn = J(() => n(L({}))), Tn = J(() => n(L({
|
|
2086
|
+
action: P("type", [
|
|
2087
|
+
L({
|
|
2088
|
+
type: X("search"),
|
|
2089
|
+
query: q().optional(),
|
|
2090
|
+
queries: d(q()).optional()
|
|
2091
|
+
}),
|
|
2092
|
+
L({
|
|
2093
|
+
type: X("openPage"),
|
|
2094
|
+
url: q().nullish()
|
|
2095
|
+
}),
|
|
2096
|
+
L({
|
|
2097
|
+
type: X("findInPage"),
|
|
2098
|
+
url: q().nullish(),
|
|
2099
|
+
pattern: q().nullish()
|
|
2100
|
+
})
|
|
2101
|
+
]).optional(),
|
|
2102
|
+
sources: d(P("type", [L({
|
|
2103
|
+
type: X("url"),
|
|
2104
|
+
url: q()
|
|
2105
|
+
}), L({
|
|
2106
|
+
type: X("api"),
|
|
2107
|
+
name: q()
|
|
2108
|
+
})])).optional()
|
|
2109
|
+
}))), En = ue({
|
|
2106
2110
|
id: "openai.web_search",
|
|
2107
|
-
inputSchema:
|
|
2108
|
-
outputSchema:
|
|
2109
|
-
|
|
2110
|
-
L({
|
|
2111
|
-
type: X("search"),
|
|
2112
|
-
query: q().optional(),
|
|
2113
|
-
queries: d(q()).optional()
|
|
2114
|
-
}),
|
|
2115
|
-
L({
|
|
2116
|
-
type: X("openPage"),
|
|
2117
|
-
url: q().nullish()
|
|
2118
|
-
}),
|
|
2119
|
-
L({
|
|
2120
|
-
type: X("findInPage"),
|
|
2121
|
-
url: q().nullish(),
|
|
2122
|
-
pattern: q().nullish()
|
|
2123
|
-
})
|
|
2124
|
-
]).optional(),
|
|
2125
|
-
sources: d(P("type", [L({
|
|
2126
|
-
type: X("url"),
|
|
2127
|
-
url: q()
|
|
2128
|
-
}), L({
|
|
2129
|
-
type: X("api"),
|
|
2130
|
-
name: q()
|
|
2131
|
-
})])).optional()
|
|
2132
|
-
})))
|
|
2133
|
-
}), Sn = (e = {}) => xn(e), Cn = J(() => n(L({
|
|
2111
|
+
inputSchema: wn,
|
|
2112
|
+
outputSchema: Tn
|
|
2113
|
+
}), Dn = (e = {}) => En(e), On = J(() => n(L({
|
|
2134
2114
|
searchContextSize: M([
|
|
2135
2115
|
"low",
|
|
2136
2116
|
"medium",
|
|
@@ -2143,32 +2123,32 @@ var Lt = t({
|
|
|
2143
2123
|
region: q().optional(),
|
|
2144
2124
|
timezone: q().optional()
|
|
2145
2125
|
}).optional()
|
|
2146
|
-
}))),
|
|
2126
|
+
}))), kn = J(() => n(L({}))), An = J(() => n(L({ action: P("type", [
|
|
2127
|
+
L({
|
|
2128
|
+
type: X("search"),
|
|
2129
|
+
query: q().optional()
|
|
2130
|
+
}),
|
|
2131
|
+
L({
|
|
2132
|
+
type: X("openPage"),
|
|
2133
|
+
url: q().nullish()
|
|
2134
|
+
}),
|
|
2135
|
+
L({
|
|
2136
|
+
type: X("findInPage"),
|
|
2137
|
+
url: q().nullish(),
|
|
2138
|
+
pattern: q().nullish()
|
|
2139
|
+
})
|
|
2140
|
+
]).optional() }))), jn = ue({
|
|
2147
2141
|
id: "openai.web_search_preview",
|
|
2148
|
-
inputSchema:
|
|
2149
|
-
outputSchema:
|
|
2150
|
-
|
|
2151
|
-
type: X("search"),
|
|
2152
|
-
query: q().optional()
|
|
2153
|
-
}),
|
|
2154
|
-
L({
|
|
2155
|
-
type: X("openPage"),
|
|
2156
|
-
url: q().nullish()
|
|
2157
|
-
}),
|
|
2158
|
-
L({
|
|
2159
|
-
type: X("findInPage"),
|
|
2160
|
-
url: q().nullish(),
|
|
2161
|
-
pattern: q().nullish()
|
|
2162
|
-
})
|
|
2163
|
-
]).optional() })))
|
|
2164
|
-
}), Tn = ie(() => V([
|
|
2142
|
+
inputSchema: kn,
|
|
2143
|
+
outputSchema: An
|
|
2144
|
+
}), Mn = ie(() => V([
|
|
2165
2145
|
q(),
|
|
2166
2146
|
W(),
|
|
2167
2147
|
N(),
|
|
2168
2148
|
p(),
|
|
2169
|
-
d(
|
|
2170
|
-
Y(q(),
|
|
2171
|
-
])),
|
|
2149
|
+
d(Mn),
|
|
2150
|
+
Y(q(), Mn)
|
|
2151
|
+
])), Nn = J(() => n(L({
|
|
2172
2152
|
serverLabel: q(),
|
|
2173
2153
|
allowedTools: V([d(q()), L({
|
|
2174
2154
|
readOnly: N().optional(),
|
|
@@ -2180,41 +2160,41 @@ var Lt = t({
|
|
|
2180
2160
|
requireApproval: V([M(["always", "never"]), L({ never: L({ toolNames: d(q()).optional() }).optional() })]).optional(),
|
|
2181
2161
|
serverDescription: q().optional(),
|
|
2182
2162
|
serverUrl: q().optional()
|
|
2183
|
-
}).refine((e) => e.serverUrl != null || e.connectorId != null, "One of serverUrl or connectorId must be provided."))),
|
|
2163
|
+
}).refine((e) => e.serverUrl != null || e.connectorId != null, "One of serverUrl or connectorId must be provided."))), Pn = J(() => n(L({}))), Fn = J(() => n(L({
|
|
2164
|
+
type: X("call"),
|
|
2165
|
+
serverLabel: q(),
|
|
2166
|
+
name: q(),
|
|
2167
|
+
arguments: q(),
|
|
2168
|
+
output: q().nullish(),
|
|
2169
|
+
error: V([q(), Mn]).optional()
|
|
2170
|
+
}))), In = ue({
|
|
2184
2171
|
id: "openai.mcp",
|
|
2185
|
-
inputSchema:
|
|
2186
|
-
outputSchema:
|
|
2187
|
-
|
|
2188
|
-
serverLabel: q(),
|
|
2189
|
-
name: q(),
|
|
2190
|
-
arguments: q(),
|
|
2191
|
-
output: q().nullish(),
|
|
2192
|
-
error: V([q(), Tn]).optional()
|
|
2193
|
-
})))
|
|
2194
|
-
}), On = (e) => Dn(e), kn = J(() => n(L({
|
|
2172
|
+
inputSchema: Pn,
|
|
2173
|
+
outputSchema: Fn
|
|
2174
|
+
}), Ln = (e) => In(e), Rn = J(() => n(L({
|
|
2195
2175
|
code: q(),
|
|
2196
2176
|
fingerprint: q()
|
|
2197
|
-
}))),
|
|
2177
|
+
}))), zn = J(() => n(L({
|
|
2198
2178
|
result: q(),
|
|
2199
2179
|
status: M(["completed", "incomplete"])
|
|
2200
|
-
}))),
|
|
2180
|
+
}))), Bn = ue({
|
|
2201
2181
|
id: "openai.programmatic_tool_calling",
|
|
2202
|
-
inputSchema:
|
|
2203
|
-
outputSchema:
|
|
2182
|
+
inputSchema: Rn,
|
|
2183
|
+
outputSchema: zn,
|
|
2204
2184
|
supportsDeferredResults: !0
|
|
2205
|
-
}),
|
|
2185
|
+
}), Vn = {
|
|
2206
2186
|
applyPatch: Lt,
|
|
2207
|
-
customTool:
|
|
2187
|
+
customTool: Qt,
|
|
2208
2188
|
codeInterpreter: Ht,
|
|
2209
2189
|
computer: Jt,
|
|
2210
|
-
fileSearch:
|
|
2211
|
-
imageGeneration:
|
|
2212
|
-
localShell:
|
|
2213
|
-
shell:
|
|
2214
|
-
webSearchPreview:
|
|
2215
|
-
webSearch:
|
|
2216
|
-
mcp:
|
|
2217
|
-
programmaticToolCalling: () => S(
|
|
2190
|
+
fileSearch: rn,
|
|
2191
|
+
imageGeneration: ln,
|
|
2192
|
+
localShell: fn,
|
|
2193
|
+
shell: _n,
|
|
2194
|
+
webSearchPreview: jn,
|
|
2195
|
+
webSearch: Dn,
|
|
2196
|
+
mcp: Ln,
|
|
2197
|
+
programmaticToolCalling: () => S(Bn({}), {
|
|
2218
2198
|
type: "provider",
|
|
2219
2199
|
prepareProviderOptions: (e) => {
|
|
2220
2200
|
let t = e?.openai;
|
|
@@ -2227,9 +2207,9 @@ var Lt = t({
|
|
|
2227
2207
|
};
|
|
2228
2208
|
}
|
|
2229
2209
|
}),
|
|
2230
|
-
toolSearch:
|
|
2210
|
+
toolSearch: Sn
|
|
2231
2211
|
};
|
|
2232
|
-
function
|
|
2212
|
+
function Hn(e) {
|
|
2233
2213
|
if (e == null) return y();
|
|
2234
2214
|
let t = e.input_tokens, n = e.output_tokens, r = e.input_tokens_details?.cached_tokens ?? 0, i = e.input_tokens_details?.cache_write_tokens ?? void 0, a = e.output_tokens_details?.reasoning_tokens ?? 0;
|
|
2235
2215
|
return {
|
|
@@ -2247,7 +2227,7 @@ function Nn(e) {
|
|
|
2247
2227
|
raw: e
|
|
2248
2228
|
};
|
|
2249
2229
|
}
|
|
2250
|
-
function
|
|
2230
|
+
function Un({ finishReason: e, hasFunctionCall: t }) {
|
|
2251
2231
|
switch (e) {
|
|
2252
2232
|
case void 0:
|
|
2253
2233
|
case null: return t ? "tool-calls" : "stop";
|
|
@@ -2256,32 +2236,32 @@ function Pn({ finishReason: e, hasFunctionCall: t }) {
|
|
|
2256
2236
|
default: return t ? "tool-calls" : "other";
|
|
2257
2237
|
}
|
|
2258
2238
|
}
|
|
2259
|
-
var
|
|
2239
|
+
var Wn = ie(() => V([
|
|
2260
2240
|
q(),
|
|
2261
2241
|
W(),
|
|
2262
2242
|
N(),
|
|
2263
2243
|
p(),
|
|
2264
|
-
d(
|
|
2265
|
-
Y(q(),
|
|
2266
|
-
])),
|
|
2244
|
+
d(Wn),
|
|
2245
|
+
Y(q(), Wn.optional())
|
|
2246
|
+
])), Gn = Y(q(), Wn.optional()), Kn = C(Gn, L({
|
|
2267
2247
|
input_tokens: W(),
|
|
2268
|
-
input_tokens_details: C(
|
|
2248
|
+
input_tokens_details: C(Gn, L({
|
|
2269
2249
|
cached_tokens: W().nullish(),
|
|
2270
2250
|
cache_write_tokens: W().nullish(),
|
|
2271
2251
|
orchestration_input_tokens: W().nullish(),
|
|
2272
2252
|
orchestration_input_cached_tokens: W().nullish()
|
|
2273
2253
|
})).nullish(),
|
|
2274
2254
|
output_tokens: W(),
|
|
2275
|
-
output_tokens_details: C(
|
|
2255
|
+
output_tokens_details: C(Gn, L({
|
|
2276
2256
|
reasoning_tokens: W().nullish(),
|
|
2277
2257
|
orchestration_output_tokens: W().nullish()
|
|
2278
2258
|
})).nullish(),
|
|
2279
2259
|
total_tokens: W().optional()
|
|
2280
|
-
})),
|
|
2260
|
+
})), qn = L({
|
|
2281
2261
|
id: q(),
|
|
2282
2262
|
code: q().nullish(),
|
|
2283
2263
|
message: q().nullish()
|
|
2284
|
-
}),
|
|
2264
|
+
}), Jn = P("type", [
|
|
2285
2265
|
L({
|
|
2286
2266
|
type: X("click"),
|
|
2287
2267
|
button: M([
|
|
@@ -2333,7 +2313,7 @@ var Fn = ie(() => V([
|
|
|
2333
2313
|
text: q()
|
|
2334
2314
|
}),
|
|
2335
2315
|
L({ type: X("wait") })
|
|
2336
|
-
]),
|
|
2316
|
+
]), Yn = L({
|
|
2337
2317
|
type: X("computer_call"),
|
|
2338
2318
|
id: q(),
|
|
2339
2319
|
call_id: q().nullish(),
|
|
@@ -2342,25 +2322,25 @@ var Fn = ie(() => V([
|
|
|
2342
2322
|
"completed",
|
|
2343
2323
|
"incomplete"
|
|
2344
2324
|
]),
|
|
2345
|
-
action:
|
|
2346
|
-
actions: d(
|
|
2347
|
-
pending_safety_checks: d(
|
|
2348
|
-
}),
|
|
2325
|
+
action: Jn.nullish(),
|
|
2326
|
+
actions: d(Jn).nullish(),
|
|
2327
|
+
pending_safety_checks: d(qn).nullish()
|
|
2328
|
+
}), Xn = P("type", [L({ type: X("direct") }), L({
|
|
2349
2329
|
type: X("program"),
|
|
2350
2330
|
caller_id: q()
|
|
2351
|
-
})]),
|
|
2331
|
+
})]), Zn = L({
|
|
2352
2332
|
type: X("program"),
|
|
2353
2333
|
id: q(),
|
|
2354
2334
|
call_id: q(),
|
|
2355
2335
|
code: q(),
|
|
2356
2336
|
fingerprint: q()
|
|
2357
|
-
}),
|
|
2337
|
+
}), Qn = L({
|
|
2358
2338
|
type: X("program_output"),
|
|
2359
2339
|
id: q(),
|
|
2360
2340
|
call_id: q(),
|
|
2361
2341
|
result: q(),
|
|
2362
2342
|
status: M(["completed", "incomplete"])
|
|
2363
|
-
}),
|
|
2343
|
+
}), $n = L({
|
|
2364
2344
|
type: X("local_shell_call"),
|
|
2365
2345
|
id: q(),
|
|
2366
2346
|
call_id: q(),
|
|
@@ -2372,7 +2352,7 @@ var Fn = ie(() => V([
|
|
|
2372
2352
|
working_directory: q().optional(),
|
|
2373
2353
|
env: Y(q(), q()).optional()
|
|
2374
2354
|
})
|
|
2375
|
-
}),
|
|
2355
|
+
}), er = L({
|
|
2376
2356
|
type: X("error"),
|
|
2377
2357
|
sequence_number: W(),
|
|
2378
2358
|
error: L({
|
|
@@ -2381,13 +2361,13 @@ var Fn = ie(() => V([
|
|
|
2381
2361
|
message: q(),
|
|
2382
2362
|
param: q().nullish()
|
|
2383
2363
|
})
|
|
2384
|
-
}),
|
|
2364
|
+
}), tr = L({
|
|
2385
2365
|
type: X("error"),
|
|
2386
2366
|
sequence_number: W(),
|
|
2387
2367
|
code: q().nullish(),
|
|
2388
2368
|
message: q(),
|
|
2389
2369
|
param: q().nullish()
|
|
2390
|
-
}),
|
|
2370
|
+
}), nr = /* @__PURE__ */ new Set([
|
|
2391
2371
|
"error",
|
|
2392
2372
|
"response.apply_patch_call_operation_diff.delta",
|
|
2393
2373
|
"response.apply_patch_call_operation_diff.done",
|
|
@@ -2409,7 +2389,7 @@ var Fn = ie(() => V([
|
|
|
2409
2389
|
"response.reasoning_summary_part.added",
|
|
2410
2390
|
"response.reasoning_summary_part.done",
|
|
2411
2391
|
"response.reasoning_summary_text.delta"
|
|
2412
|
-
]),
|
|
2392
|
+
]), rr = /* @__PURE__ */ new Set([
|
|
2413
2393
|
"apply_patch_call",
|
|
2414
2394
|
"code_interpreter_call",
|
|
2415
2395
|
"compaction",
|
|
@@ -2432,10 +2412,10 @@ var Fn = ie(() => V([
|
|
|
2432
2412
|
"tool_search_output",
|
|
2433
2413
|
"web_search_call"
|
|
2434
2414
|
]);
|
|
2435
|
-
function
|
|
2436
|
-
return typeof e.type != "string" || !
|
|
2415
|
+
function ir(e) {
|
|
2416
|
+
return typeof e.type != "string" || !nr.has(e.type) ? !1 : e.type !== "response.output_item.added" && e.type !== "response.output_item.done" || !he(e.item) || typeof e.item.type != "string" || rr.has(e.item.type);
|
|
2437
2417
|
}
|
|
2438
|
-
var
|
|
2418
|
+
var ar = J(() => n(V([
|
|
2439
2419
|
L({
|
|
2440
2420
|
type: X("response.output_text.delta"),
|
|
2441
2421
|
item_id: q(),
|
|
@@ -2454,7 +2434,7 @@ var Xn = J(() => n(V([
|
|
|
2454
2434
|
type: M(["response.completed", "response.incomplete"]),
|
|
2455
2435
|
response: L({
|
|
2456
2436
|
incomplete_details: L({ reason: q() }).nullish(),
|
|
2457
|
-
usage:
|
|
2437
|
+
usage: Kn.nullish(),
|
|
2458
2438
|
reasoning: L({ context: q().nullish() }).nullish(),
|
|
2459
2439
|
service_tier: q().nullish()
|
|
2460
2440
|
})
|
|
@@ -2468,7 +2448,7 @@ var Xn = J(() => n(V([
|
|
|
2468
2448
|
message: q()
|
|
2469
2449
|
}).nullish(),
|
|
2470
2450
|
incomplete_details: L({ reason: q() }).nullish(),
|
|
2471
|
-
usage:
|
|
2451
|
+
usage: Kn.nullish(),
|
|
2472
2452
|
reasoning: L({ context: q().nullish() }).nullish(),
|
|
2473
2453
|
service_tier: q().nullish()
|
|
2474
2454
|
})
|
|
@@ -2513,21 +2493,21 @@ var Xn = J(() => n(V([
|
|
|
2513
2493
|
arguments: q(),
|
|
2514
2494
|
async: N().nullish(),
|
|
2515
2495
|
namespace: q().nullish(),
|
|
2516
|
-
caller:
|
|
2496
|
+
caller: Xn.nullish()
|
|
2517
2497
|
}),
|
|
2518
|
-
|
|
2519
|
-
|
|
2498
|
+
Zn,
|
|
2499
|
+
Qn,
|
|
2520
2500
|
L({
|
|
2521
2501
|
type: X("web_search_call"),
|
|
2522
2502
|
id: q(),
|
|
2523
2503
|
status: q()
|
|
2524
2504
|
}),
|
|
2525
|
-
|
|
2505
|
+
Yn,
|
|
2526
2506
|
L({
|
|
2527
2507
|
type: X("file_search_call"),
|
|
2528
2508
|
id: q()
|
|
2529
2509
|
}),
|
|
2530
|
-
|
|
2510
|
+
$n,
|
|
2531
2511
|
L({
|
|
2532
2512
|
type: X("image_generation_call"),
|
|
2533
2513
|
id: q()
|
|
@@ -2646,7 +2626,7 @@ var Xn = J(() => n(V([
|
|
|
2646
2626
|
"completed",
|
|
2647
2627
|
"incomplete"
|
|
2648
2628
|
]),
|
|
2649
|
-
tools: d(Y(q(),
|
|
2629
|
+
tools: d(Y(q(), Wn.optional()))
|
|
2650
2630
|
})
|
|
2651
2631
|
])
|
|
2652
2632
|
}),
|
|
@@ -2677,10 +2657,10 @@ var Xn = J(() => n(V([
|
|
|
2677
2657
|
"incomplete"
|
|
2678
2658
|
]),
|
|
2679
2659
|
namespace: q().nullish(),
|
|
2680
|
-
caller:
|
|
2660
|
+
caller: Xn.nullish()
|
|
2681
2661
|
}),
|
|
2682
|
-
|
|
2683
|
-
|
|
2662
|
+
Zn,
|
|
2663
|
+
Qn,
|
|
2684
2664
|
L({
|
|
2685
2665
|
type: X("custom_tool_call"),
|
|
2686
2666
|
id: q(),
|
|
@@ -2752,8 +2732,8 @@ var Xn = J(() => n(V([
|
|
|
2752
2732
|
text: q()
|
|
2753
2733
|
})).nullish()
|
|
2754
2734
|
}),
|
|
2755
|
-
|
|
2756
|
-
|
|
2735
|
+
$n,
|
|
2736
|
+
Yn,
|
|
2757
2737
|
L({
|
|
2758
2738
|
type: X("mcp_call"),
|
|
2759
2739
|
id: q(),
|
|
@@ -2871,7 +2851,7 @@ var Xn = J(() => n(V([
|
|
|
2871
2851
|
"completed",
|
|
2872
2852
|
"incomplete"
|
|
2873
2853
|
]),
|
|
2874
|
-
tools: d(Y(q(),
|
|
2854
|
+
tools: d(Y(q(), Wn.optional()))
|
|
2875
2855
|
})
|
|
2876
2856
|
])
|
|
2877
2857
|
}),
|
|
@@ -2974,13 +2954,13 @@ var Xn = J(() => n(V([
|
|
|
2974
2954
|
output_index: W(),
|
|
2975
2955
|
diff: q()
|
|
2976
2956
|
}),
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
L({ type: q() }).loose().refine((e) => !
|
|
2957
|
+
er,
|
|
2958
|
+
tr,
|
|
2959
|
+
L({ type: q() }).loose().refine((e) => !ir(e), { message: "Known response chunk failed schema validation" }).transform((e) => ({
|
|
2980
2960
|
type: "unknown_chunk",
|
|
2981
2961
|
message: e.type
|
|
2982
2962
|
}))
|
|
2983
|
-
]))),
|
|
2963
|
+
]))), or = J(() => n(L({
|
|
2984
2964
|
id: q().optional(),
|
|
2985
2965
|
created_at: W().optional(),
|
|
2986
2966
|
error: L({
|
|
@@ -3099,7 +3079,7 @@ var Xn = J(() => n(V([
|
|
|
3099
3079
|
id: q(),
|
|
3100
3080
|
result: q()
|
|
3101
3081
|
}),
|
|
3102
|
-
|
|
3082
|
+
$n,
|
|
3103
3083
|
L({
|
|
3104
3084
|
type: X("function_call"),
|
|
3105
3085
|
call_id: q(),
|
|
@@ -3108,10 +3088,10 @@ var Xn = J(() => n(V([
|
|
|
3108
3088
|
id: q(),
|
|
3109
3089
|
async: N().nullish(),
|
|
3110
3090
|
namespace: q().nullish(),
|
|
3111
|
-
caller:
|
|
3091
|
+
caller: Xn.nullish()
|
|
3112
3092
|
}),
|
|
3113
|
-
|
|
3114
|
-
|
|
3093
|
+
Zn,
|
|
3094
|
+
Qn,
|
|
3115
3095
|
L({
|
|
3116
3096
|
type: X("custom_tool_call"),
|
|
3117
3097
|
call_id: q(),
|
|
@@ -3120,7 +3100,7 @@ var Xn = J(() => n(V([
|
|
|
3120
3100
|
id: q(),
|
|
3121
3101
|
async: N().nullish()
|
|
3122
3102
|
}),
|
|
3123
|
-
|
|
3103
|
+
Yn,
|
|
3124
3104
|
L({
|
|
3125
3105
|
type: X("reasoning"),
|
|
3126
3106
|
id: q(),
|
|
@@ -3247,15 +3227,15 @@ var Xn = J(() => n(V([
|
|
|
3247
3227
|
"completed",
|
|
3248
3228
|
"incomplete"
|
|
3249
3229
|
]),
|
|
3250
|
-
tools: d(Y(q(),
|
|
3230
|
+
tools: d(Y(q(), Wn.optional()))
|
|
3251
3231
|
})
|
|
3252
3232
|
])).optional(),
|
|
3253
3233
|
service_tier: q().nullish(),
|
|
3254
3234
|
reasoning: L({ context: q().nullish() }).nullish(),
|
|
3255
3235
|
incomplete_details: L({ reason: q() }).nullish(),
|
|
3256
|
-
usage:
|
|
3236
|
+
usage: Kn.nullish()
|
|
3257
3237
|
})));
|
|
3258
|
-
function
|
|
3238
|
+
function sr(e) {
|
|
3259
3239
|
if (e.provider == null) throw Error("OpenAI model is missing provider after workflow deserialization.");
|
|
3260
3240
|
return {
|
|
3261
3241
|
...e,
|
|
@@ -3267,7 +3247,7 @@ function Qn(e) {
|
|
|
3267
3247
|
headers: typeof e.headers == "function" ? e.headers : e.headers == null ? void 0 : () => e.headers
|
|
3268
3248
|
};
|
|
3269
3249
|
}
|
|
3270
|
-
var
|
|
3250
|
+
var cr = 20, lr = J(() => n(L({
|
|
3271
3251
|
conversation: q().nullish(),
|
|
3272
3252
|
include: d(M([
|
|
3273
3253
|
"reasoning.encrypted_content",
|
|
@@ -3277,7 +3257,7 @@ var $n = 20, er = J(() => n(L({
|
|
|
3277
3257
|
])).nullish(),
|
|
3278
3258
|
includeWebSearchSources: N().optional(),
|
|
3279
3259
|
instructions: q().nullish(),
|
|
3280
|
-
logprobs: V([N(), W().min(1).max(
|
|
3260
|
+
logprobs: V([N(), W().min(1).max(cr)]).optional(),
|
|
3281
3261
|
maxToolCalls: W().nullish(),
|
|
3282
3262
|
metadata: ye().nullish(),
|
|
3283
3263
|
parallelToolCalls: N().nullish(),
|
|
@@ -3338,23 +3318,23 @@ var $n = 20, er = J(() => n(L({
|
|
|
3338
3318
|
toolNames: d(q()).min(1),
|
|
3339
3319
|
mode: M(["auto", "required"]).optional()
|
|
3340
3320
|
}).optional()
|
|
3341
|
-
}))),
|
|
3321
|
+
}))), ur = J(() => n(L({ reasoningEffortUpdate: M([
|
|
3342
3322
|
"none",
|
|
3343
3323
|
"low",
|
|
3344
3324
|
"medium",
|
|
3345
3325
|
"high",
|
|
3346
3326
|
"xhigh",
|
|
3347
3327
|
"max"
|
|
3348
|
-
]).optional() }))),
|
|
3349
|
-
function
|
|
3328
|
+
]).optional() }))), dr = "parallel", fr = "functions.";
|
|
3329
|
+
function pr({ providerOptions: e, providerOptionsName: t }) {
|
|
3350
3330
|
let n = e?.[t]?.parallelToolCall;
|
|
3351
3331
|
if (!(!x(n) || typeof n.itemId != "string" || typeof n.toolCallId != "string" || typeof n.toolName != "string" || typeof n.input != "string" || typeof n.index != "number" || !Number.isInteger(n.index) || typeof n.count != "number" || !Number.isInteger(n.count) || n.index < 0 || n.count <= n.index)) return n;
|
|
3352
3332
|
}
|
|
3353
|
-
function
|
|
3354
|
-
return e ===
|
|
3333
|
+
function mr({ toolName: e, tools: t }) {
|
|
3334
|
+
return e === dr && !t.some((e) => e.name === dr);
|
|
3355
3335
|
}
|
|
3356
|
-
async function
|
|
3357
|
-
if (!
|
|
3336
|
+
async function hr({ toolCall: e, tools: t, providerOptionsName: n, itemId: r }) {
|
|
3337
|
+
if (!mr({
|
|
3358
3338
|
toolName: e.toolName,
|
|
3359
3339
|
tools: t
|
|
3360
3340
|
})) return;
|
|
@@ -3366,8 +3346,8 @@ async function or({ toolCall: e, tools: t, providerOptionsName: n, itemId: r })
|
|
|
3366
3346
|
for (let [t, i] of a.entries()) {
|
|
3367
3347
|
if (!x(i)) return;
|
|
3368
3348
|
let c = i.recipient_name, l = i.parameters;
|
|
3369
|
-
if (typeof c != "string" || !c.startsWith(
|
|
3370
|
-
let u = c.slice(
|
|
3349
|
+
if (typeof c != "string" || !c.startsWith(fr) || !x(l)) return;
|
|
3350
|
+
let u = c.slice(fr.length);
|
|
3371
3351
|
if (u.length === 0 || !o.has(u)) return;
|
|
3372
3352
|
s.push({
|
|
3373
3353
|
type: "tool-call",
|
|
@@ -3386,16 +3366,16 @@ async function or({ toolCall: e, tools: t, providerOptionsName: n, itemId: r })
|
|
|
3386
3366
|
}
|
|
3387
3367
|
return s;
|
|
3388
3368
|
}
|
|
3389
|
-
function
|
|
3369
|
+
function gr(e) {
|
|
3390
3370
|
return JSON.stringify(e === void 0 ? {} : e);
|
|
3391
3371
|
}
|
|
3392
|
-
function
|
|
3372
|
+
function _r(e) {
|
|
3393
3373
|
return e == null ? void 0 : e.type === "program" ? {
|
|
3394
3374
|
type: "program",
|
|
3395
3375
|
caller_id: e.callerId
|
|
3396
3376
|
} : e;
|
|
3397
3377
|
}
|
|
3398
|
-
async function
|
|
3378
|
+
async function vr({ output: t, toolName: n, outputSchemaToolNames: r, promptCacheBreakpoint: i, providerOptionsName: o, warnings: s }) {
|
|
3399
3379
|
let c = r?.has(n), l = (e) => i == null ? e : [{
|
|
3400
3380
|
type: "input_text",
|
|
3401
3381
|
text: e,
|
|
@@ -3476,32 +3456,24 @@ async function lr({ output: t, toolName: n, outputSchemaToolNames: r, promptCach
|
|
|
3476
3456
|
}).filter(e);
|
|
3477
3457
|
}
|
|
3478
3458
|
}
|
|
3479
|
-
function
|
|
3459
|
+
function yr(e, t) {
|
|
3480
3460
|
return e.itemId === t.itemId && e.toolCallId === t.toolCallId && e.toolName === t.toolName && e.input === t.input && e.count === t.count;
|
|
3481
3461
|
}
|
|
3482
|
-
function
|
|
3462
|
+
function br({ prompt: t, providerOptionsName: n }) {
|
|
3483
3463
|
let r = /* @__PURE__ */ new Map();
|
|
3484
3464
|
for (let e of t) if (e.role === "tool") for (let t of e.content) {
|
|
3485
3465
|
if (t.type !== "tool-result") continue;
|
|
3486
|
-
let e =
|
|
3466
|
+
let e = pr({
|
|
3487
3467
|
providerOptions: t.providerOptions,
|
|
3488
3468
|
providerOptionsName: n
|
|
3489
3469
|
});
|
|
3490
3470
|
if (e == null) continue;
|
|
3491
3471
|
let i = r.get(e.toolCallId);
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
});
|
|
3498
|
-
continue;
|
|
3499
|
-
}
|
|
3500
|
-
if (!ur(i.metadata, e) || i.results.has(e.index)) {
|
|
3501
|
-
i.invalid = !0;
|
|
3502
|
-
continue;
|
|
3503
|
-
}
|
|
3504
|
-
i.results.set(e.index, t);
|
|
3472
|
+
i == null ? r.set(e.toolCallId, {
|
|
3473
|
+
metadata: e,
|
|
3474
|
+
results: /* @__PURE__ */ new Map([[e.index, t]]),
|
|
3475
|
+
invalid: !1
|
|
3476
|
+
}) : !yr(i.metadata, e) || i.results.has(e.index) ? i.invalid = !0 : i.results.set(e.index, t);
|
|
3505
3477
|
}
|
|
3506
3478
|
let i = /* @__PURE__ */ new Map();
|
|
3507
3479
|
for (let [t, n] of r) {
|
|
@@ -3517,14 +3489,14 @@ function dr({ prompt: t, providerOptionsName: n }) {
|
|
|
3517
3489
|
function $(e, t) {
|
|
3518
3490
|
return e?.[t]?.promptCacheBreakpoint;
|
|
3519
3491
|
}
|
|
3520
|
-
function
|
|
3492
|
+
function xr({ output: e, toolResultProviderOptions: t, providerOptionsName: n }) {
|
|
3521
3493
|
return e.type === "content" ? void 0 : $(e.providerOptions, n) ?? $(t, n);
|
|
3522
3494
|
}
|
|
3523
|
-
function
|
|
3495
|
+
function Sr(e, t) {
|
|
3524
3496
|
return t ? t.some((t) => e.startsWith(t)) : !1;
|
|
3525
3497
|
}
|
|
3526
|
-
async function
|
|
3527
|
-
let S = [], C = [], w = /* @__PURE__ */ new Set(), T = /* @__PURE__ */ new Set(), E = d || p ?
|
|
3498
|
+
async function Cr({ prompt: t, toolNameMapping: n, systemMessageMode: r, providerOptionsName: i, explicitMessageItemType: o = !1, fileIdPrefixes: s, passThroughUnsupportedFiles: c = !1, store: l, hasConversation: d = !1, hasPreviousResponseId: p = !1, hasLocalShellTool: m = !1, hasShellTool: h = !1, hasApplyPatchTool: g = !1, hasComputerTool: _ = !1, toolSearchToolName: v, customProviderToolNames: y, outputSchemaToolNames: b, configurationUpdateUnsupportedReason: x }) {
|
|
3499
|
+
let S = [], C = [], w = /* @__PURE__ */ new Set(), T = /* @__PURE__ */ new Set(), E = d || p ? br({
|
|
3528
3500
|
prompt: t,
|
|
3529
3501
|
providerOptionsName: i
|
|
3530
3502
|
}) : /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Set(), O = /* @__PURE__ */ new Set();
|
|
@@ -3533,12 +3505,12 @@ async function mr({ prompt: t, toolNameMapping: n, systemMessageMode: r, provide
|
|
|
3533
3505
|
let e = await I({
|
|
3534
3506
|
provider: i,
|
|
3535
3507
|
providerOptions: M,
|
|
3536
|
-
schema:
|
|
3508
|
+
schema: ur
|
|
3537
3509
|
});
|
|
3538
3510
|
e == null && i !== "openai" && (e = await I({
|
|
3539
3511
|
provider: "openai",
|
|
3540
3512
|
providerOptions: M,
|
|
3541
|
-
schema:
|
|
3513
|
+
schema: ur
|
|
3542
3514
|
}));
|
|
3543
3515
|
let t = e?.reasoningEffortUpdate;
|
|
3544
3516
|
if (t != null) {
|
|
@@ -3628,7 +3600,7 @@ async function mr({ prompt: t, toolNameMapping: n, systemMessageMode: r, provide
|
|
|
3628
3600
|
case "data":
|
|
3629
3601
|
if (f(e.mediaType) === "image") return {
|
|
3630
3602
|
type: "input_image",
|
|
3631
|
-
...e.data.type === "url" ? { image_url: e.data.url.toString() } : typeof e.data.data == "string" &&
|
|
3603
|
+
...e.data.type === "url" ? { image_url: e.data.url.toString() } : typeof e.data.data == "string" && Sr(e.data.data, s) ? { file_id: e.data.data } : { image_url: `data:${k({ part: e })};base64,${F(e.data.data)}` },
|
|
3632
3604
|
detail: e.providerOptions?.[i]?.imageDetail,
|
|
3633
3605
|
...n != null && { prompt_cache_breakpoint: n }
|
|
3634
3606
|
};
|
|
@@ -3642,7 +3614,7 @@ async function mr({ prompt: t, toolNameMapping: n, systemMessageMode: r, provide
|
|
|
3642
3614
|
if (r !== "application/pdf" && !c) throw new G({ functionality: `file part media type ${r}` });
|
|
3643
3615
|
return {
|
|
3644
3616
|
type: "input_file",
|
|
3645
|
-
...typeof e.data.data == "string" &&
|
|
3617
|
+
...typeof e.data.data == "string" && Sr(e.data.data, s) ? { file_id: e.data.data } : {
|
|
3646
3618
|
filename: e.filename ?? (r === "application/pdf" ? `part-${t}.pdf` : `part-${t}`),
|
|
3647
3619
|
file_data: `data:${r};base64,${F(e.data.data)}`
|
|
3648
3620
|
},
|
|
@@ -3677,11 +3649,11 @@ async function mr({ prompt: t, toolNameMapping: n, systemMessageMode: r, provide
|
|
|
3677
3649
|
break;
|
|
3678
3650
|
}
|
|
3679
3651
|
case "tool-call": {
|
|
3680
|
-
let e =
|
|
3652
|
+
let e = pr({
|
|
3681
3653
|
providerOptions: t.providerOptions,
|
|
3682
3654
|
providerOptionsName: i
|
|
3683
3655
|
}), r = e == null ? void 0 : E.get(e.toolCallId);
|
|
3684
|
-
if (e != null && r != null &&
|
|
3656
|
+
if (e != null && r != null && yr(r.metadata, e)) {
|
|
3685
3657
|
D.has(r.metadata.toolCallId) || (D.add(r.metadata.toolCallId), d || S.push({
|
|
3686
3658
|
type: "function_call",
|
|
3687
3659
|
call_id: r.metadata.toolCallId,
|
|
@@ -3703,10 +3675,10 @@ async function mr({ prompt: t, toolNameMapping: n, systemMessageMode: r, provide
|
|
|
3703
3675
|
}
|
|
3704
3676
|
let e = typeof t.input == "string" ? await ce({
|
|
3705
3677
|
text: t.input,
|
|
3706
|
-
schema:
|
|
3678
|
+
schema: yn
|
|
3707
3679
|
}) : await u({
|
|
3708
3680
|
value: t.input,
|
|
3709
|
-
schema:
|
|
3681
|
+
schema: yn
|
|
3710
3682
|
}), n = e.call_id == null ? "server" : "client";
|
|
3711
3683
|
S.push({
|
|
3712
3684
|
type: "tool_search_call",
|
|
@@ -3728,7 +3700,7 @@ async function mr({ prompt: t, toolNameMapping: n, systemMessageMode: r, provide
|
|
|
3728
3700
|
}
|
|
3729
3701
|
let e = await u({
|
|
3730
3702
|
value: t.input,
|
|
3731
|
-
schema:
|
|
3703
|
+
schema: Rn
|
|
3732
3704
|
});
|
|
3733
3705
|
S.push({
|
|
3734
3706
|
type: "program",
|
|
@@ -3755,7 +3727,7 @@ async function mr({ prompt: t, toolNameMapping: n, systemMessageMode: r, provide
|
|
|
3755
3727
|
if (m && f === "local_shell") {
|
|
3756
3728
|
let e = await u({
|
|
3757
3729
|
value: t.input,
|
|
3758
|
-
schema:
|
|
3730
|
+
schema: un
|
|
3759
3731
|
});
|
|
3760
3732
|
S.push({
|
|
3761
3733
|
type: "local_shell_call",
|
|
@@ -3775,7 +3747,7 @@ async function mr({ prompt: t, toolNameMapping: n, systemMessageMode: r, provide
|
|
|
3775
3747
|
if (h && f === "shell") {
|
|
3776
3748
|
let e = await u({
|
|
3777
3749
|
value: t.input,
|
|
3778
|
-
schema:
|
|
3750
|
+
schema: pn
|
|
3779
3751
|
});
|
|
3780
3752
|
S.push({
|
|
3781
3753
|
type: "shell_call",
|
|
@@ -3860,10 +3832,10 @@ async function mr({ prompt: t, toolNameMapping: n, systemMessageMode: r, provide
|
|
|
3860
3832
|
type: "function_call",
|
|
3861
3833
|
call_id: t.toolCallId,
|
|
3862
3834
|
name: f,
|
|
3863
|
-
arguments:
|
|
3835
|
+
arguments: gr(t.input),
|
|
3864
3836
|
...s != null && { async: s },
|
|
3865
3837
|
...o != null && { namespace: o },
|
|
3866
|
-
...c != null && { caller:
|
|
3838
|
+
...c != null && { caller: _r(c) }
|
|
3867
3839
|
});
|
|
3868
3840
|
break;
|
|
3869
3841
|
}
|
|
@@ -3879,7 +3851,7 @@ async function mr({ prompt: t, toolNameMapping: n, systemMessageMode: r, provide
|
|
|
3879
3851
|
else if (t.output.type === "json") {
|
|
3880
3852
|
let n = await u({
|
|
3881
3853
|
value: t.output.value,
|
|
3882
|
-
schema:
|
|
3854
|
+
schema: bn
|
|
3883
3855
|
});
|
|
3884
3856
|
S.push({
|
|
3885
3857
|
type: "tool_search_output",
|
|
@@ -3901,7 +3873,7 @@ async function mr({ prompt: t, toolNameMapping: n, systemMessageMode: r, provide
|
|
|
3901
3873
|
else if (t.output.type === "json") {
|
|
3902
3874
|
let n = await u({
|
|
3903
3875
|
value: t.output.value,
|
|
3904
|
-
schema:
|
|
3876
|
+
schema: zn
|
|
3905
3877
|
});
|
|
3906
3878
|
S.push({
|
|
3907
3879
|
type: "program_output",
|
|
@@ -3917,7 +3889,7 @@ async function mr({ prompt: t, toolNameMapping: n, systemMessageMode: r, provide
|
|
|
3917
3889
|
if (t.output.type === "json") {
|
|
3918
3890
|
let e = await u({
|
|
3919
3891
|
value: t.output.value,
|
|
3920
|
-
schema:
|
|
3892
|
+
schema: mn
|
|
3921
3893
|
});
|
|
3922
3894
|
S.push({
|
|
3923
3895
|
type: "shell_call_output",
|
|
@@ -3950,7 +3922,7 @@ async function mr({ prompt: t, toolNameMapping: n, systemMessageMode: r, provide
|
|
|
3950
3922
|
let n = await I({
|
|
3951
3923
|
provider: i,
|
|
3952
3924
|
providerOptions: t.providerOptions,
|
|
3953
|
-
schema:
|
|
3925
|
+
schema: wr
|
|
3954
3926
|
}), r = n?.itemId;
|
|
3955
3927
|
if ((d || p) && r != null) break;
|
|
3956
3928
|
if (r != null) {
|
|
@@ -3997,25 +3969,23 @@ async function mr({ prompt: t, toolNameMapping: n, systemMessageMode: r, provide
|
|
|
3997
3969
|
}
|
|
3998
3970
|
break;
|
|
3999
3971
|
}
|
|
4000
|
-
case "custom":
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
id: n
|
|
4008
|
-
});
|
|
4009
|
-
break;
|
|
4010
|
-
}
|
|
4011
|
-
let r = e?.encryptedContent;
|
|
4012
|
-
n != null && S.push({
|
|
4013
|
-
type: "compaction",
|
|
4014
|
-
id: n,
|
|
4015
|
-
encrypted_content: r
|
|
3972
|
+
case "custom": if (t.kind === "openai.compaction") {
|
|
3973
|
+
let e = t.providerOptions?.[i], n = e?.itemId;
|
|
3974
|
+
if (d && n != null) break;
|
|
3975
|
+
if (l && n != null) {
|
|
3976
|
+
S.push({
|
|
3977
|
+
type: "item_reference",
|
|
3978
|
+
id: n
|
|
4016
3979
|
});
|
|
3980
|
+
break;
|
|
4017
3981
|
}
|
|
4018
|
-
|
|
3982
|
+
let r = e?.encryptedContent;
|
|
3983
|
+
n != null && S.push({
|
|
3984
|
+
type: "compaction",
|
|
3985
|
+
id: n,
|
|
3986
|
+
encrypted_content: r
|
|
3987
|
+
});
|
|
3988
|
+
}
|
|
4019
3989
|
}
|
|
4020
3990
|
break;
|
|
4021
3991
|
}
|
|
@@ -4034,21 +4004,21 @@ async function mr({ prompt: t, toolNameMapping: n, systemMessageMode: r, provide
|
|
|
4034
4004
|
});
|
|
4035
4005
|
continue;
|
|
4036
4006
|
}
|
|
4037
|
-
let r =
|
|
4007
|
+
let r = pr({
|
|
4038
4008
|
providerOptions: t.providerOptions,
|
|
4039
4009
|
providerOptionsName: i
|
|
4040
4010
|
}), a = r == null ? void 0 : E.get(r.toolCallId);
|
|
4041
|
-
if (r != null && a != null &&
|
|
4011
|
+
if (r != null && a != null && yr(a.metadata, r)) {
|
|
4042
4012
|
if (!O.has(a.metadata.toolCallId)) {
|
|
4043
4013
|
O.add(a.metadata.toolCallId);
|
|
4044
4014
|
let e = await Promise.all(a.results.map(async (e) => {
|
|
4045
|
-
let t =
|
|
4015
|
+
let t = xr({
|
|
4046
4016
|
output: e.output,
|
|
4047
4017
|
toolResultProviderOptions: e.providerOptions,
|
|
4048
4018
|
providerOptionsName: i
|
|
4049
4019
|
});
|
|
4050
4020
|
return {
|
|
4051
|
-
output: await
|
|
4021
|
+
output: await vr({
|
|
4052
4022
|
output: e.output,
|
|
4053
4023
|
toolName: e.toolName,
|
|
4054
4024
|
outputSchemaToolNames: b,
|
|
@@ -4077,7 +4047,7 @@ ${t}`,
|
|
|
4077
4047
|
if (t.toolName === v && o.type === "json") {
|
|
4078
4048
|
let e = await u({
|
|
4079
4049
|
value: o.value,
|
|
4080
|
-
schema:
|
|
4050
|
+
schema: bn
|
|
4081
4051
|
});
|
|
4082
4052
|
S.push({
|
|
4083
4053
|
type: "tool_search_output",
|
|
@@ -4091,7 +4061,7 @@ ${t}`,
|
|
|
4091
4061
|
if (m && s === "local_shell" && o.type === "json") {
|
|
4092
4062
|
let e = await u({
|
|
4093
4063
|
value: o.value,
|
|
4094
|
-
schema:
|
|
4064
|
+
schema: dn
|
|
4095
4065
|
});
|
|
4096
4066
|
S.push({
|
|
4097
4067
|
type: "local_shell_call_output",
|
|
@@ -4103,7 +4073,7 @@ ${t}`,
|
|
|
4103
4073
|
if (h && s === "shell" && o.type === "json") {
|
|
4104
4074
|
let e = await u({
|
|
4105
4075
|
value: o.value,
|
|
4106
|
-
schema:
|
|
4076
|
+
schema: mn
|
|
4107
4077
|
});
|
|
4108
4078
|
S.push({
|
|
4109
4079
|
type: "shell_call_output",
|
|
@@ -4155,7 +4125,7 @@ ${t}`,
|
|
|
4155
4125
|
continue;
|
|
4156
4126
|
}
|
|
4157
4127
|
if (y?.has(s)) {
|
|
4158
|
-
let n =
|
|
4128
|
+
let n = xr({
|
|
4159
4129
|
output: o,
|
|
4160
4130
|
toolResultProviderOptions: t.providerOptions,
|
|
4161
4131
|
providerOptionsName: i
|
|
@@ -4237,18 +4207,18 @@ ${t}`,
|
|
|
4237
4207
|
}
|
|
4238
4208
|
let c = t.providerOptions?.[i]?.caller;
|
|
4239
4209
|
if (o.type === "execution-denied" && (c?.type === "program" || T.has(t.toolCallId))) throw new G({ functionality: "execution-denied results for programmatic tool calls" });
|
|
4240
|
-
let x = await
|
|
4210
|
+
let x = await vr({
|
|
4241
4211
|
output: o,
|
|
4242
4212
|
toolName: t.toolName,
|
|
4243
4213
|
outputSchemaToolNames: b,
|
|
4244
|
-
promptCacheBreakpoint:
|
|
4214
|
+
promptCacheBreakpoint: xr({
|
|
4245
4215
|
output: o,
|
|
4246
4216
|
toolResultProviderOptions: t.providerOptions,
|
|
4247
4217
|
providerOptionsName: i
|
|
4248
4218
|
}),
|
|
4249
4219
|
providerOptionsName: i,
|
|
4250
4220
|
warnings: C
|
|
4251
|
-
}), D =
|
|
4221
|
+
}), D = _r(c);
|
|
4252
4222
|
S.push({
|
|
4253
4223
|
type: "function_call_output",
|
|
4254
4224
|
call_id: t.toolCallId,
|
|
@@ -4267,11 +4237,11 @@ ${t}`,
|
|
|
4267
4237
|
warnings: C
|
|
4268
4238
|
};
|
|
4269
4239
|
}
|
|
4270
|
-
var
|
|
4240
|
+
var wr = L({
|
|
4271
4241
|
itemId: q().nullish(),
|
|
4272
4242
|
reasoningEncryptedContent: q().nullish()
|
|
4273
4243
|
});
|
|
4274
|
-
async function
|
|
4244
|
+
async function Tr({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r, customProviderToolNames: i, outputSchemaToolNames: a, supportsAsyncToolCalling: o = !0 }) {
|
|
4275
4245
|
e = e?.length ? e : void 0;
|
|
4276
4246
|
let s = [];
|
|
4277
4247
|
if (e == null) return {
|
|
@@ -4282,17 +4252,17 @@ async function gr({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
|
|
|
4282
4252
|
let c = [], l = /* @__PURE__ */ new Map(), d = i ?? /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = (e, t, n) => {
|
|
4283
4253
|
if (f.set(e, t), n == null || n === e) return;
|
|
4284
4254
|
let r = p.get(n);
|
|
4285
|
-
r == null ? p.set(n, t) : r !== "ambiguous" && !
|
|
4255
|
+
r == null ? p.set(n, t) : r !== "ambiguous" && !Dr(r, t) && p.set(n, "ambiguous");
|
|
4286
4256
|
};
|
|
4287
4257
|
for (let t of e) switch (t.type) {
|
|
4288
4258
|
case "function": {
|
|
4289
4259
|
let e = t.providerOptions?.openai;
|
|
4290
4260
|
e?.outputSchema != null && a?.add(t.name);
|
|
4291
|
-
let n =
|
|
4261
|
+
let n = kr({
|
|
4292
4262
|
tool: t,
|
|
4293
4263
|
options: e,
|
|
4294
4264
|
toolWarnings: s,
|
|
4295
|
-
async:
|
|
4265
|
+
async: Ar({
|
|
4296
4266
|
value: e?.async,
|
|
4297
4267
|
supportsAsyncToolCalling: o,
|
|
4298
4268
|
toolName: t.name,
|
|
@@ -4332,7 +4302,7 @@ async function gr({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
|
|
|
4332
4302
|
case "openai.file_search": {
|
|
4333
4303
|
let e = await u({
|
|
4334
4304
|
value: t.args,
|
|
4335
|
-
schema:
|
|
4305
|
+
schema: tn
|
|
4336
4306
|
});
|
|
4337
4307
|
c.push({
|
|
4338
4308
|
type: "file_search",
|
|
@@ -4352,11 +4322,11 @@ async function gr({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
|
|
|
4352
4322
|
case "openai.shell": {
|
|
4353
4323
|
let e = await u({
|
|
4354
4324
|
value: t.args,
|
|
4355
|
-
schema:
|
|
4325
|
+
schema: gn
|
|
4356
4326
|
});
|
|
4357
4327
|
c.push({
|
|
4358
4328
|
type: "shell",
|
|
4359
|
-
...e.environment && { environment:
|
|
4329
|
+
...e.environment && { environment: jr(e.environment) }
|
|
4360
4330
|
});
|
|
4361
4331
|
break;
|
|
4362
4332
|
}
|
|
@@ -4369,7 +4339,7 @@ async function gr({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
|
|
|
4369
4339
|
case "openai.web_search_preview": {
|
|
4370
4340
|
let e = await u({
|
|
4371
4341
|
value: t.args,
|
|
4372
|
-
schema:
|
|
4342
|
+
schema: On
|
|
4373
4343
|
});
|
|
4374
4344
|
c.push({
|
|
4375
4345
|
type: "web_search_preview",
|
|
@@ -4381,7 +4351,7 @@ async function gr({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
|
|
|
4381
4351
|
case "openai.web_search": {
|
|
4382
4352
|
let e = await u({
|
|
4383
4353
|
value: t.args,
|
|
4384
|
-
schema:
|
|
4354
|
+
schema: Cn
|
|
4385
4355
|
});
|
|
4386
4356
|
c.push({
|
|
4387
4357
|
type: "web_search",
|
|
@@ -4415,7 +4385,7 @@ async function gr({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
|
|
|
4415
4385
|
case "openai.image_generation": {
|
|
4416
4386
|
let e = await u({
|
|
4417
4387
|
value: t.args,
|
|
4418
|
-
schema:
|
|
4388
|
+
schema: an
|
|
4419
4389
|
});
|
|
4420
4390
|
c.push({
|
|
4421
4391
|
type: "image_generation",
|
|
@@ -4439,7 +4409,7 @@ async function gr({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
|
|
|
4439
4409
|
case "openai.mcp": {
|
|
4440
4410
|
let e = await u({
|
|
4441
4411
|
value: t.args,
|
|
4442
|
-
schema:
|
|
4412
|
+
schema: Nn
|
|
4443
4413
|
}), n = (e) => ({ tool_names: e.toolNames }), r = e.requireApproval, i = r == null ? void 0 : typeof r == "string" ? r : r.never == null ? void 0 : { never: n(r.never) };
|
|
4444
4414
|
c.push({
|
|
4445
4415
|
type: "mcp",
|
|
@@ -4466,7 +4436,7 @@ async function gr({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
|
|
|
4466
4436
|
type: "custom",
|
|
4467
4437
|
name: t.name,
|
|
4468
4438
|
description: e.description,
|
|
4469
|
-
...
|
|
4439
|
+
...Ar({
|
|
4470
4440
|
value: e.async,
|
|
4471
4441
|
supportsAsyncToolCalling: o,
|
|
4472
4442
|
toolName: t.name,
|
|
@@ -4482,7 +4452,7 @@ async function gr({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
|
|
|
4482
4452
|
case "openai.tool_search": {
|
|
4483
4453
|
let e = await u({
|
|
4484
4454
|
value: t.args,
|
|
4485
|
-
schema:
|
|
4455
|
+
schema: vn
|
|
4486
4456
|
});
|
|
4487
4457
|
c.push({
|
|
4488
4458
|
type: "tool_search",
|
|
@@ -4495,53 +4465,39 @@ async function gr({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
|
|
|
4495
4465
|
}
|
|
4496
4466
|
if (c.length > e) {
|
|
4497
4467
|
let n = c[e];
|
|
4498
|
-
m(t.name,
|
|
4468
|
+
m(t.name, Or(n), r?.toProviderToolName(t.name));
|
|
4499
4469
|
}
|
|
4500
4470
|
break;
|
|
4501
4471
|
}
|
|
4502
|
-
default:
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
});
|
|
4507
|
-
break;
|
|
4472
|
+
default: s.push({
|
|
4473
|
+
type: "unsupported",
|
|
4474
|
+
feature: `function tool ${t}`
|
|
4475
|
+
});
|
|
4508
4476
|
}
|
|
4509
4477
|
if (n != null) {
|
|
4510
4478
|
let e = [], t = [];
|
|
4511
4479
|
for (let i of n.toolNames) {
|
|
4512
4480
|
let n = f.get(i), a = n ?? p.get(i);
|
|
4513
|
-
|
|
4481
|
+
n != null && p.has(i) && s.push({
|
|
4514
4482
|
type: "unsupported",
|
|
4515
4483
|
feature: `allowedTools entry "${i}"`,
|
|
4516
4484
|
details: "this name is both a tool name and the provider tool name of another tool in this request; the tool with this name is allowed"
|
|
4517
|
-
}), a === "ambiguous"
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
});
|
|
4534
|
-
continue;
|
|
4535
|
-
}
|
|
4536
|
-
if (!a.supported) {
|
|
4537
|
-
s.push({
|
|
4538
|
-
type: "unsupported",
|
|
4539
|
-
feature: `allowedTools entry "${i}"`,
|
|
4540
|
-
details: `${a.reason}; the tool is removed from the allowed tools`
|
|
4541
|
-
}), t.push(i);
|
|
4542
|
-
continue;
|
|
4543
|
-
}
|
|
4544
|
-
e.push(a.entry);
|
|
4485
|
+
}), a === "ambiguous" ? (s.push({
|
|
4486
|
+
type: "unsupported",
|
|
4487
|
+
feature: `allowedTools entry "${i}"`,
|
|
4488
|
+
details: "several tools in this request share this provider tool name; use the tool name from the tools for this request instead"
|
|
4489
|
+
}), t.push(i)) : a == null ? (s.push({
|
|
4490
|
+
type: "unsupported",
|
|
4491
|
+
feature: `allowedTools entry "${i}"`,
|
|
4492
|
+
details: "the tool is not part of the tools for this request and is sent as a function tool"
|
|
4493
|
+
}), e.push({
|
|
4494
|
+
type: "function",
|
|
4495
|
+
name: r?.toProviderToolName(i) ?? i
|
|
4496
|
+
})) : a.supported ? e.push(a.entry) : (s.push({
|
|
4497
|
+
type: "unsupported",
|
|
4498
|
+
feature: `allowedTools entry "${i}"`,
|
|
4499
|
+
details: `${a.reason}; the tool is removed from the allowed tools`
|
|
4500
|
+
}), t.push(i));
|
|
4545
4501
|
}
|
|
4546
4502
|
if (e.length === 0) throw new G({ functionality: `allowedTools with only tools that cannot be allow-listed (${t.join(", ")})` });
|
|
4547
4503
|
return {
|
|
@@ -4585,7 +4541,7 @@ async function gr({ tools: e, toolChoice: t, allowedTools: n, toolNameMapping: r
|
|
|
4585
4541
|
default: throw new G({ functionality: `tool choice type: ${h}` });
|
|
4586
4542
|
}
|
|
4587
4543
|
}
|
|
4588
|
-
function
|
|
4544
|
+
function Er(e) {
|
|
4589
4545
|
switch (e.type) {
|
|
4590
4546
|
case "mcp": return `mcp:${e.server_label}`;
|
|
4591
4547
|
case "function":
|
|
@@ -4593,10 +4549,10 @@ function _r(e) {
|
|
|
4593
4549
|
default: return e.type;
|
|
4594
4550
|
}
|
|
4595
4551
|
}
|
|
4596
|
-
function
|
|
4597
|
-
return e.supported && t.supported ?
|
|
4552
|
+
function Dr(e, t) {
|
|
4553
|
+
return e.supported && t.supported ? Er(e.entry) === Er(t.entry) : !e.supported && !t.supported && e.reason === t.reason;
|
|
4598
4554
|
}
|
|
4599
|
-
function
|
|
4555
|
+
function Or(e) {
|
|
4600
4556
|
switch (e.type) {
|
|
4601
4557
|
case "custom": return {
|
|
4602
4558
|
supported: !0,
|
|
@@ -4631,7 +4587,7 @@ function yr(e) {
|
|
|
4631
4587
|
};
|
|
4632
4588
|
}
|
|
4633
4589
|
}
|
|
4634
|
-
function
|
|
4590
|
+
function kr({ tool: e, options: t, toolWarnings: n, async: r }) {
|
|
4635
4591
|
let i = t?.deferLoading, a = nt(e.inputSchema), o = t?.outputSchema == null ? void 0 : nt(t.outputSchema);
|
|
4636
4592
|
return n.push(...a.warnings, ...o?.warnings ?? []), {
|
|
4637
4593
|
type: "function",
|
|
@@ -4645,7 +4601,7 @@ function br({ tool: e, options: t, toolWarnings: n, async: r }) {
|
|
|
4645
4601
|
...t?.outputSchema == null ? {} : { output_schema: o?.schema }
|
|
4646
4602
|
};
|
|
4647
4603
|
}
|
|
4648
|
-
function
|
|
4604
|
+
function Ar({ value: e, supportsAsyncToolCalling: t, toolName: n, toolWarnings: r }) {
|
|
4649
4605
|
if (e !== !0 || t) return e;
|
|
4650
4606
|
r.push({
|
|
4651
4607
|
type: "unsupported",
|
|
@@ -4653,7 +4609,7 @@ function xr({ value: e, supportsAsyncToolCalling: t, toolName: n, toolWarnings:
|
|
|
4653
4609
|
details: "Async tool calling is only supported by GPT-6 and later models."
|
|
4654
4610
|
});
|
|
4655
4611
|
}
|
|
4656
|
-
function
|
|
4612
|
+
function jr(e) {
|
|
4657
4613
|
if (e.type === "containerReference") return {
|
|
4658
4614
|
type: "container_reference",
|
|
4659
4615
|
container_id: e.containerId
|
|
@@ -4669,7 +4625,7 @@ function Sr(e) {
|
|
|
4669
4625
|
allowed_domains: t.networkPolicy.allowedDomains,
|
|
4670
4626
|
domain_secrets: t.networkPolicy.domainSecrets
|
|
4671
4627
|
},
|
|
4672
|
-
skills:
|
|
4628
|
+
skills: Mr(t.skills)
|
|
4673
4629
|
};
|
|
4674
4630
|
}
|
|
4675
4631
|
return {
|
|
@@ -4677,7 +4633,7 @@ function Sr(e) {
|
|
|
4677
4633
|
skills: e.skills
|
|
4678
4634
|
};
|
|
4679
4635
|
}
|
|
4680
|
-
function
|
|
4636
|
+
function Mr(e) {
|
|
4681
4637
|
return e?.map((e) => e.type === "skillReference" ? {
|
|
4682
4638
|
type: "skill_reference",
|
|
4683
4639
|
skill_id: a({
|
|
@@ -4696,7 +4652,7 @@ function Cr(e) {
|
|
|
4696
4652
|
}
|
|
4697
4653
|
});
|
|
4698
4654
|
}
|
|
4699
|
-
function
|
|
4655
|
+
function Nr(e) {
|
|
4700
4656
|
let t = {};
|
|
4701
4657
|
for (let n of e) if (n.role === "assistant") for (let e of n.content) {
|
|
4702
4658
|
if (e.type !== "tool-call") continue;
|
|
@@ -4705,7 +4661,7 @@ function wr(e) {
|
|
|
4705
4661
|
}
|
|
4706
4662
|
return t;
|
|
4707
4663
|
}
|
|
4708
|
-
function
|
|
4664
|
+
function Pr(e) {
|
|
4709
4665
|
switch (e.type) {
|
|
4710
4666
|
case "click": return {
|
|
4711
4667
|
type: "click",
|
|
@@ -4745,9 +4701,9 @@ function Tr(e) {
|
|
|
4745
4701
|
case "wait": return e;
|
|
4746
4702
|
}
|
|
4747
4703
|
}
|
|
4748
|
-
function
|
|
4704
|
+
function Fr({ action: e, actions: t, pending_safety_checks: n, status: r }) {
|
|
4749
4705
|
return {
|
|
4750
|
-
actions: (t ?? (e == null ? [] : [e])).map(
|
|
4706
|
+
actions: (t ?? (e == null ? [] : [e])).map(Pr),
|
|
4751
4707
|
pendingSafetyChecks: n?.map((e) => ({
|
|
4752
4708
|
id: e.id,
|
|
4753
4709
|
...e.code != null && { code: e.code },
|
|
@@ -4756,17 +4712,17 @@ function Er({ action: e, actions: t, pending_safety_checks: n, status: r }) {
|
|
|
4756
4712
|
status: r
|
|
4757
4713
|
};
|
|
4758
4714
|
}
|
|
4759
|
-
var
|
|
4715
|
+
var Ir = {
|
|
4760
4716
|
"image/*": [/^https?:\/\/.*$/],
|
|
4761
4717
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
4762
4718
|
};
|
|
4763
|
-
function
|
|
4719
|
+
function Lr({ modelCapabilities: e, options: t }) {
|
|
4764
4720
|
if (!e.supportsConfigurationUpdate) return "reasoningEffortUpdate is only supported by GPT-6 and later models";
|
|
4765
4721
|
if (t?.reasoningMode === "pro" || t?.contextManagement != null || t?.truncation === "auto") return "reasoningEffortUpdate requires standard reasoning mode without automatic compaction or automatic truncation";
|
|
4766
4722
|
}
|
|
4767
|
-
var
|
|
4723
|
+
var Rr = class e {
|
|
4768
4724
|
constructor(e, t) {
|
|
4769
|
-
this.specificationVersion = "v4", this.supportedUrls =
|
|
4725
|
+
this.specificationVersion = "v4", this.supportedUrls = Ir, this.modelId = e, this.config = t;
|
|
4770
4726
|
}
|
|
4771
4727
|
static [l](e) {
|
|
4772
4728
|
return K({
|
|
@@ -4775,7 +4731,7 @@ var kr = class e {
|
|
|
4775
4731
|
});
|
|
4776
4732
|
}
|
|
4777
4733
|
static [j](t) {
|
|
4778
|
-
return new e(t.modelId,
|
|
4734
|
+
return new e(t.modelId, sr(t.config));
|
|
4779
4735
|
}
|
|
4780
4736
|
get provider() {
|
|
4781
4737
|
return this.config.provider;
|
|
@@ -4801,12 +4757,12 @@ var kr = class e {
|
|
|
4801
4757
|
let y = t.provider.includes("azure") ? "azure" : "openai", b = await I({
|
|
4802
4758
|
provider: y,
|
|
4803
4759
|
providerOptions: f,
|
|
4804
|
-
schema:
|
|
4760
|
+
schema: lr
|
|
4805
4761
|
});
|
|
4806
4762
|
b == null && y !== "openai" && (b = await I({
|
|
4807
4763
|
provider: "openai",
|
|
4808
4764
|
providerOptions: f,
|
|
4809
|
-
schema:
|
|
4765
|
+
schema: lr
|
|
4810
4766
|
}));
|
|
4811
4767
|
let x = b?.reasoningEffort ?? (ee(d) ? d : void 0);
|
|
4812
4768
|
x != null && _.supportedReasoningEfforts != null && !_.supportedReasoningEfforts.includes(x) && (g.push({
|
|
@@ -4836,7 +4792,7 @@ var kr = class e {
|
|
|
4836
4792
|
"openai.tool_search": "tool_search",
|
|
4837
4793
|
"openai.programmatic_tool_calling": "programmatic_tool_calling"
|
|
4838
4794
|
}
|
|
4839
|
-
}), T = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Set(), { tools: D, toolChoice: O, toolWarnings: k } = await
|
|
4795
|
+
}), T = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Set(), { tools: D, toolChoice: O, toolWarnings: k } = await Tr({
|
|
4840
4796
|
tools: p,
|
|
4841
4797
|
toolChoice: m,
|
|
4842
4798
|
allowedTools: b?.allowedTools ?? void 0,
|
|
@@ -4844,10 +4800,10 @@ var kr = class e {
|
|
|
4844
4800
|
customProviderToolNames: T,
|
|
4845
4801
|
outputSchemaToolNames: E,
|
|
4846
4802
|
supportsAsyncToolCalling: _.supportsAsyncToolCalling
|
|
4847
|
-
}), A =
|
|
4803
|
+
}), A = Lr({
|
|
4848
4804
|
modelCapabilities: _,
|
|
4849
4805
|
options: b
|
|
4850
|
-
}), { input: j, warnings: M } = await
|
|
4806
|
+
}), { input: j, warnings: M } = await Cr({
|
|
4851
4807
|
prompt: u,
|
|
4852
4808
|
toolNameMapping: w,
|
|
4853
4809
|
systemMessageMode: b?.systemMessageMode ?? (C ? "developer" : _.systemMessageMode),
|
|
@@ -4903,7 +4859,7 @@ var kr = class e {
|
|
|
4903
4859
|
function B(e) {
|
|
4904
4860
|
return z(e) != null;
|
|
4905
4861
|
}
|
|
4906
|
-
let re = typeof b?.logprobs == "number" ? b?.logprobs : b?.logprobs === !0 ?
|
|
4862
|
+
let re = typeof b?.logprobs == "number" ? b?.logprobs : b?.logprobs === !0 ? cr : void 0;
|
|
4907
4863
|
re && R("message.output_text.logprobs");
|
|
4908
4864
|
let V = p?.find((e) => e.type === "provider" && (e.id === "openai.web_search" || e.id === "openai.web_search_preview"))?.name;
|
|
4909
4865
|
V && t.supportsWebSearchSourcesInclude !== !1 && b?.includeWebSearchSources !== !1 && R("web_search_call.action.sources"), B("openai.code_interpreter") && R("code_interpreter_call.outputs");
|
|
@@ -4995,7 +4951,7 @@ var kr = class e {
|
|
|
4995
4951
|
type: "unsupported",
|
|
4996
4952
|
feature: "serviceTier",
|
|
4997
4953
|
details: "flex processing is only available for o3, o4-mini, and gpt-5 models"
|
|
4998
|
-
}), delete H.service_tier),
|
|
4954
|
+
}), delete H.service_tier), b?.serviceTier !== "priority" && b?.serviceTier !== "fast" || _.supportsPriorityProcessing || (g.push({
|
|
4999
4955
|
type: "unsupported",
|
|
5000
4956
|
feature: "serviceTier",
|
|
5001
4957
|
details: "priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"
|
|
@@ -5026,12 +4982,12 @@ var kr = class e {
|
|
|
5026
4982
|
let { args: t, warnings: n, webSearchToolName: r, toolNameMapping: a, providerOptionsName: o, isShellProviderExecuted: s } = await this.getArgs(e), l = this.config.url({
|
|
5027
4983
|
path: "/responses",
|
|
5028
4984
|
modelId: this.modelId
|
|
5029
|
-
}), u =
|
|
4985
|
+
}), u = Nr(e.prompt), { responseHeaders: d, value: f, rawValue: p } = await z({
|
|
5030
4986
|
url: l,
|
|
5031
4987
|
headers: H(this.config.headers?.(), e.headers),
|
|
5032
4988
|
body: t,
|
|
5033
4989
|
failedResponseHandler: Z,
|
|
5034
|
-
successfulResponseHandler: i(
|
|
4990
|
+
successfulResponseHandler: i(or),
|
|
5035
4991
|
abortSignal: e.abortSignal,
|
|
5036
4992
|
fetch: this.config.fetch
|
|
5037
4993
|
});
|
|
@@ -5206,7 +5162,7 @@ var kr = class e {
|
|
|
5206
5162
|
break;
|
|
5207
5163
|
case "function_call": {
|
|
5208
5164
|
_ = !0;
|
|
5209
|
-
let e = await
|
|
5165
|
+
let e = await hr({
|
|
5210
5166
|
toolCall: {
|
|
5211
5167
|
toolCallId: t.call_id,
|
|
5212
5168
|
toolName: t.name,
|
|
@@ -5288,7 +5244,7 @@ var kr = class e {
|
|
|
5288
5244
|
type: "tool-result",
|
|
5289
5245
|
toolCallId: t.id,
|
|
5290
5246
|
toolName: a.toCustomToolName(r ?? "web_search"),
|
|
5291
|
-
result:
|
|
5247
|
+
result: ai(t.action)
|
|
5292
5248
|
});
|
|
5293
5249
|
break;
|
|
5294
5250
|
case "mcp_call": {
|
|
@@ -5358,7 +5314,7 @@ var kr = class e {
|
|
|
5358
5314
|
type: "tool-call",
|
|
5359
5315
|
toolCallId: t.call_id,
|
|
5360
5316
|
toolName: e,
|
|
5361
|
-
input: JSON.stringify(
|
|
5317
|
+
input: JSON.stringify(Fr(t)),
|
|
5362
5318
|
providerMetadata: { [o]: { itemId: t.id } }
|
|
5363
5319
|
});
|
|
5364
5320
|
break;
|
|
@@ -5415,17 +5371,15 @@ var kr = class e {
|
|
|
5415
5371
|
providerMetadata: { [o]: { itemId: t.id } }
|
|
5416
5372
|
});
|
|
5417
5373
|
break;
|
|
5418
|
-
case "compaction":
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
});
|
|
5428
|
-
break;
|
|
5374
|
+
case "compaction": m.push({
|
|
5375
|
+
type: "custom",
|
|
5376
|
+
kind: "openai.compaction",
|
|
5377
|
+
providerMetadata: { [o]: {
|
|
5378
|
+
type: "compaction",
|
|
5379
|
+
itemId: t.id,
|
|
5380
|
+
encryptedContent: t.encrypted_content
|
|
5381
|
+
} }
|
|
5382
|
+
});
|
|
5429
5383
|
}
|
|
5430
5384
|
let y = { [o]: {
|
|
5431
5385
|
responseId: f.id,
|
|
@@ -5436,13 +5390,13 @@ var kr = class e {
|
|
|
5436
5390
|
return {
|
|
5437
5391
|
content: m,
|
|
5438
5392
|
finishReason: {
|
|
5439
|
-
unified:
|
|
5393
|
+
unified: Un({
|
|
5440
5394
|
finishReason: f.incomplete_details?.reason,
|
|
5441
5395
|
hasFunctionCall: _
|
|
5442
5396
|
}),
|
|
5443
5397
|
raw: f.incomplete_details?.reason ?? void 0
|
|
5444
5398
|
},
|
|
5445
|
-
usage:
|
|
5399
|
+
usage: Hn(b),
|
|
5446
5400
|
request: { body: t },
|
|
5447
5401
|
response: {
|
|
5448
5402
|
id: f.id,
|
|
@@ -5467,18 +5421,18 @@ var kr = class e {
|
|
|
5467
5421
|
stream: !0
|
|
5468
5422
|
},
|
|
5469
5423
|
failedResponseHandler: Z,
|
|
5470
|
-
successfulResponseHandler: T(
|
|
5424
|
+
successfulResponseHandler: T(ar),
|
|
5471
5425
|
abortSignal: e.abortSignal,
|
|
5472
5426
|
fetch: this.config.fetch
|
|
5473
5427
|
}), f = await Ie({
|
|
5474
5428
|
stream: d,
|
|
5475
|
-
getError: (e) =>
|
|
5476
|
-
isOutputChunk:
|
|
5477
|
-
isAcceptedChunk:
|
|
5429
|
+
getError: (e) => ni(e) || Gr(e) && e.response.error != null ? e : void 0,
|
|
5430
|
+
isOutputChunk: ii,
|
|
5431
|
+
isAcceptedChunk: ri,
|
|
5478
5432
|
url: l,
|
|
5479
5433
|
requestBodyValues: t,
|
|
5480
5434
|
responseHeaders: u
|
|
5481
|
-
}), p = this, m =
|
|
5435
|
+
}), p = this, m = Nr(e.prompt), h = e.tools?.filter((e) => e.type === "function") ?? [], g = /* @__PURE__ */ new Map(), _ = {
|
|
5482
5436
|
unified: "other",
|
|
5483
5437
|
raw: void 0
|
|
5484
5438
|
}, v, y = [], b = null, x = {}, S = [], C, w = !1, E = {}, D = {}, O = ({ itemId: e, outputIndex: t }) => t == null ? e : D[t] ?? e, k, A, j = [], M = !1;
|
|
@@ -5495,7 +5449,7 @@ var kr = class e {
|
|
|
5495
5449
|
type: "raw",
|
|
5496
5450
|
rawValue: n.rawValue
|
|
5497
5451
|
}), !n.success) {
|
|
5498
|
-
let e =
|
|
5452
|
+
let e = Br(n.rawValue) ? Vr({
|
|
5499
5453
|
value: n.rawValue,
|
|
5500
5454
|
cause: n.error,
|
|
5501
5455
|
url: l,
|
|
@@ -5512,9 +5466,9 @@ var kr = class e {
|
|
|
5512
5466
|
return;
|
|
5513
5467
|
}
|
|
5514
5468
|
let f = n.value;
|
|
5515
|
-
if (
|
|
5469
|
+
if (ei(f)) {
|
|
5516
5470
|
if (f.item.type === "function_call") {
|
|
5517
|
-
let e =
|
|
5471
|
+
let e = mr({
|
|
5518
5472
|
toolName: f.item.name,
|
|
5519
5473
|
tools: h
|
|
5520
5474
|
});
|
|
@@ -5608,444 +5562,444 @@ var kr = class e {
|
|
|
5608
5562
|
toolName: t,
|
|
5609
5563
|
providerExecuted: !0
|
|
5610
5564
|
});
|
|
5611
|
-
} else if (f.item.type !== "tool_search_output" &&
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5565
|
+
} else if (f.item.type !== "tool_search_output" && f.item.type !== "mcp_call" && f.item.type !== "mcp_list_tools" && f.item.type !== "mcp_approval_request") {
|
|
5566
|
+
if (f.item.type === "apply_patch_call") {
|
|
5567
|
+
let { call_id: e, operation: t } = f.item;
|
|
5568
|
+
if (x[f.output_index] = {
|
|
5569
|
+
toolName: i.toCustomToolName("apply_patch"),
|
|
5570
|
+
toolCallId: e,
|
|
5571
|
+
applyPatch: {
|
|
5572
|
+
hasDiff: t.type === "delete_file",
|
|
5573
|
+
endEmitted: t.type === "delete_file"
|
|
5574
|
+
}
|
|
5575
|
+
}, d.enqueue({
|
|
5576
|
+
type: "tool-input-start",
|
|
5577
|
+
id: e,
|
|
5578
|
+
toolName: i.toCustomToolName("apply_patch")
|
|
5579
|
+
}), t.type === "delete_file") {
|
|
5580
|
+
let n = JSON.stringify({
|
|
5581
|
+
callId: e,
|
|
5582
|
+
operation: t
|
|
5583
|
+
});
|
|
5584
|
+
d.enqueue({
|
|
5585
|
+
type: "tool-input-delta",
|
|
5586
|
+
id: e,
|
|
5587
|
+
delta: n
|
|
5588
|
+
}), d.enqueue({
|
|
5589
|
+
type: "tool-input-end",
|
|
5590
|
+
id: e
|
|
5591
|
+
});
|
|
5592
|
+
} else d.enqueue({
|
|
5630
5593
|
type: "tool-input-delta",
|
|
5631
5594
|
id: e,
|
|
5632
|
-
delta:
|
|
5633
|
-
}), d.enqueue({
|
|
5634
|
-
type: "tool-input-end",
|
|
5635
|
-
id: e
|
|
5595
|
+
delta: `{"callId":"${oi(e)}","operation":{"type":"${oi(t.type)}","path":"${oi(t.path)}","diff":"`
|
|
5636
5596
|
});
|
|
5637
|
-
} else
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5597
|
+
} else f.item.type === "shell_call" ? x[f.output_index] = {
|
|
5598
|
+
toolName: i.toCustomToolName("shell"),
|
|
5599
|
+
toolCallId: f.item.call_id
|
|
5600
|
+
} : f.item.type === "shell_call_output" || (f.item.type === "message" ? (D[f.output_index] = f.item.id, S.splice(0), C = f.item.phase ?? void 0, d.enqueue({
|
|
5601
|
+
type: "text-start",
|
|
5602
|
+
id: f.item.id,
|
|
5603
|
+
providerMetadata: { [o]: {
|
|
5604
|
+
itemId: f.item.id,
|
|
5605
|
+
...f.item.phase != null && { phase: f.item.phase }
|
|
5606
|
+
} }
|
|
5607
|
+
})) : ei(f) && f.item.type === "reasoning" && (D[f.output_index] = f.item.id, E[f.item.id] = {
|
|
5608
|
+
encryptedContent: f.item.encrypted_content,
|
|
5609
|
+
summaryParts: { 0: "active" }
|
|
5610
|
+
}, d.enqueue({
|
|
5611
|
+
type: "reasoning-start",
|
|
5612
|
+
id: `${f.item.id}:0`,
|
|
5613
|
+
providerMetadata: { [o]: {
|
|
5614
|
+
itemId: f.item.id,
|
|
5615
|
+
reasoningEncryptedContent: f.item.encrypted_content ?? null
|
|
5616
|
+
} }
|
|
5617
|
+
})));
|
|
5618
|
+
}
|
|
5619
|
+
} else if (Ur(f)) {
|
|
5620
|
+
if (f.item.type === "message") {
|
|
5621
|
+
let e = O({
|
|
5659
5622
|
itemId: f.item.id,
|
|
5660
|
-
|
|
5661
|
-
}
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5623
|
+
outputIndex: f.output_index
|
|
5624
|
+
}), t = f.item.phase ?? C;
|
|
5625
|
+
C = void 0, d.enqueue({
|
|
5626
|
+
type: "text-end",
|
|
5627
|
+
id: e,
|
|
5628
|
+
providerMetadata: { [o]: {
|
|
5629
|
+
itemId: e,
|
|
5630
|
+
...t != null && { phase: t },
|
|
5631
|
+
...S.length > 0 && { annotations: S }
|
|
5632
|
+
} }
|
|
5633
|
+
}), D[f.output_index] = void 0;
|
|
5634
|
+
} else if (f.item.type === "function_call") {
|
|
5635
|
+
let e = f.item, t = x[f.output_index];
|
|
5636
|
+
x[f.output_index] = void 0, w = !0;
|
|
5637
|
+
let n = t?.suppressInputStreaming ?? mr({
|
|
5638
|
+
toolName: e.name,
|
|
5639
|
+
tools: h
|
|
5640
|
+
}), r = () => {
|
|
5641
|
+
if (n) {
|
|
5642
|
+
d.enqueue({
|
|
5643
|
+
type: "tool-input-start",
|
|
5644
|
+
id: e.call_id,
|
|
5645
|
+
toolName: e.name
|
|
5646
|
+
});
|
|
5647
|
+
let n = t?.bufferedInputDeltas ?? [];
|
|
5648
|
+
if (n.length > 0) for (let t of n) d.enqueue({
|
|
5649
|
+
type: "tool-input-delta",
|
|
5650
|
+
id: e.call_id,
|
|
5651
|
+
delta: t
|
|
5652
|
+
});
|
|
5653
|
+
else e.arguments.length > 0 && d.enqueue({
|
|
5654
|
+
type: "tool-input-delta",
|
|
5655
|
+
id: e.call_id,
|
|
5656
|
+
delta: e.arguments
|
|
5657
|
+
});
|
|
5658
|
+
}
|
|
5685
5659
|
d.enqueue({
|
|
5686
|
-
type: "tool-input-
|
|
5687
|
-
id: e.call_id,
|
|
5688
|
-
toolName: e.name
|
|
5689
|
-
});
|
|
5690
|
-
let n = t?.bufferedInputDeltas ?? [];
|
|
5691
|
-
if (n.length > 0) for (let t of n) d.enqueue({
|
|
5692
|
-
type: "tool-input-delta",
|
|
5693
|
-
id: e.call_id,
|
|
5694
|
-
delta: t
|
|
5695
|
-
});
|
|
5696
|
-
else e.arguments.length > 0 && d.enqueue({
|
|
5697
|
-
type: "tool-input-delta",
|
|
5660
|
+
type: "tool-input-end",
|
|
5698
5661
|
id: e.call_id,
|
|
5699
|
-
|
|
5662
|
+
...e.namespace != null && { providerMetadata: { [o]: { namespace: e.namespace } } }
|
|
5663
|
+
}), d.enqueue({
|
|
5664
|
+
type: "tool-call",
|
|
5665
|
+
toolCallId: e.call_id,
|
|
5666
|
+
toolName: e.name,
|
|
5667
|
+
input: e.arguments,
|
|
5668
|
+
providerMetadata: { [o]: {
|
|
5669
|
+
itemId: e.id,
|
|
5670
|
+
...e.async == null ? t?.async == null ? {} : { async: t.async } : { async: e.async },
|
|
5671
|
+
...e.namespace != null && { namespace: e.namespace },
|
|
5672
|
+
...e.caller != null && { caller: e.caller.type === "program" ? {
|
|
5673
|
+
type: "program",
|
|
5674
|
+
callerId: e.caller.caller_id
|
|
5675
|
+
} : e.caller }
|
|
5676
|
+
} }
|
|
5700
5677
|
});
|
|
5678
|
+
};
|
|
5679
|
+
if (!n) {
|
|
5680
|
+
r();
|
|
5681
|
+
return;
|
|
5701
5682
|
}
|
|
5683
|
+
return hr({
|
|
5684
|
+
toolCall: {
|
|
5685
|
+
toolCallId: e.call_id,
|
|
5686
|
+
toolName: e.name,
|
|
5687
|
+
input: e.arguments
|
|
5688
|
+
},
|
|
5689
|
+
tools: h,
|
|
5690
|
+
providerOptionsName: o,
|
|
5691
|
+
itemId: e.id
|
|
5692
|
+
}).then((e) => {
|
|
5693
|
+
if (e == null) r();
|
|
5694
|
+
else for (let t of e) d.enqueue({
|
|
5695
|
+
type: "tool-input-start",
|
|
5696
|
+
id: t.toolCallId,
|
|
5697
|
+
toolName: t.toolName
|
|
5698
|
+
}), d.enqueue({
|
|
5699
|
+
type: "tool-input-delta",
|
|
5700
|
+
id: t.toolCallId,
|
|
5701
|
+
delta: t.input
|
|
5702
|
+
}), d.enqueue({
|
|
5703
|
+
type: "tool-input-end",
|
|
5704
|
+
id: t.toolCallId
|
|
5705
|
+
}), d.enqueue(t);
|
|
5706
|
+
});
|
|
5707
|
+
} else if (f.item.type === "program") d.enqueue({
|
|
5708
|
+
type: "tool-call",
|
|
5709
|
+
toolCallId: f.item.call_id,
|
|
5710
|
+
toolName: i.toCustomToolName("programmatic_tool_calling"),
|
|
5711
|
+
input: JSON.stringify({
|
|
5712
|
+
code: f.item.code,
|
|
5713
|
+
fingerprint: f.item.fingerprint
|
|
5714
|
+
}),
|
|
5715
|
+
providerExecuted: !0,
|
|
5716
|
+
providerMetadata: { [o]: { itemId: f.item.id } }
|
|
5717
|
+
});
|
|
5718
|
+
else if (f.item.type === "program_output") d.enqueue({
|
|
5719
|
+
type: "tool-result",
|
|
5720
|
+
toolCallId: f.item.call_id,
|
|
5721
|
+
toolName: i.toCustomToolName("programmatic_tool_calling"),
|
|
5722
|
+
result: {
|
|
5723
|
+
result: f.item.result,
|
|
5724
|
+
status: f.item.status
|
|
5725
|
+
},
|
|
5726
|
+
providerMetadata: { [o]: { itemId: f.item.id } }
|
|
5727
|
+
});
|
|
5728
|
+
else if (f.item.type === "custom_tool_call") {
|
|
5729
|
+
let e = x[f.output_index];
|
|
5730
|
+
x[f.output_index] = void 0, w = !0;
|
|
5731
|
+
let t = i.toCustomToolName(f.item.name);
|
|
5702
5732
|
d.enqueue({
|
|
5703
5733
|
type: "tool-input-end",
|
|
5704
|
-
id:
|
|
5705
|
-
...e.namespace != null && { providerMetadata: { [o]: { namespace: e.namespace } } }
|
|
5734
|
+
id: f.item.call_id
|
|
5706
5735
|
}), d.enqueue({
|
|
5707
5736
|
type: "tool-call",
|
|
5708
|
-
toolCallId:
|
|
5709
|
-
toolName:
|
|
5710
|
-
input:
|
|
5737
|
+
toolCallId: f.item.call_id,
|
|
5738
|
+
toolName: t,
|
|
5739
|
+
input: JSON.stringify(f.item.input),
|
|
5711
5740
|
providerMetadata: { [o]: {
|
|
5712
|
-
itemId:
|
|
5713
|
-
...
|
|
5714
|
-
...e.namespace != null && { namespace: e.namespace },
|
|
5715
|
-
...e.caller != null && { caller: e.caller.type === "program" ? {
|
|
5716
|
-
type: "program",
|
|
5717
|
-
callerId: e.caller.caller_id
|
|
5718
|
-
} : e.caller }
|
|
5741
|
+
itemId: f.item.id,
|
|
5742
|
+
...f.item.async == null ? e?.async == null ? {} : { async: e.async } : { async: f.item.async }
|
|
5719
5743
|
} }
|
|
5720
5744
|
});
|
|
5721
|
-
}
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5745
|
+
} else if (f.item.type === "web_search_call") x[f.output_index] = void 0, d.enqueue({
|
|
5746
|
+
type: "tool-result",
|
|
5747
|
+
toolCallId: f.item.id,
|
|
5748
|
+
toolName: i.toCustomToolName(r ?? "web_search"),
|
|
5749
|
+
result: ai(f.item.action)
|
|
5750
|
+
});
|
|
5751
|
+
else if (f.item.type === "computer_call") {
|
|
5752
|
+
if (x[f.output_index] = void 0, f.item.call_id == null) {
|
|
5753
|
+
d.enqueue({
|
|
5754
|
+
type: "tool-input-end",
|
|
5755
|
+
id: f.item.id
|
|
5756
|
+
}), d.enqueue({
|
|
5757
|
+
type: "tool-call",
|
|
5758
|
+
toolCallId: f.item.id,
|
|
5759
|
+
toolName: i.toCustomToolName("computer_use"),
|
|
5760
|
+
input: "",
|
|
5761
|
+
providerExecuted: !0
|
|
5762
|
+
}), d.enqueue({
|
|
5763
|
+
type: "tool-result",
|
|
5764
|
+
toolCallId: f.item.id,
|
|
5765
|
+
toolName: i.toCustomToolName("computer_use"),
|
|
5766
|
+
result: {
|
|
5767
|
+
type: "computer_use_tool_result",
|
|
5768
|
+
status: f.item.status
|
|
5769
|
+
}
|
|
5770
|
+
});
|
|
5738
5771
|
return;
|
|
5739
5772
|
}
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
toolName: t.toolName
|
|
5744
|
-
}), d.enqueue({
|
|
5773
|
+
w = !0;
|
|
5774
|
+
let e = i.toCustomToolName("computer"), t = JSON.stringify(Fr(f.item));
|
|
5775
|
+
d.enqueue({
|
|
5745
5776
|
type: "tool-input-delta",
|
|
5746
|
-
id:
|
|
5747
|
-
delta: t
|
|
5777
|
+
id: f.item.call_id,
|
|
5778
|
+
delta: t
|
|
5748
5779
|
}), d.enqueue({
|
|
5749
5780
|
type: "tool-input-end",
|
|
5750
|
-
id:
|
|
5751
|
-
}), d.enqueue(
|
|
5781
|
+
id: f.item.call_id
|
|
5782
|
+
}), d.enqueue({
|
|
5783
|
+
type: "tool-call",
|
|
5784
|
+
toolCallId: f.item.call_id,
|
|
5785
|
+
toolName: e,
|
|
5786
|
+
input: t,
|
|
5787
|
+
providerMetadata: { [o]: { itemId: f.item.id } }
|
|
5788
|
+
});
|
|
5789
|
+
} else if (f.item.type === "file_search_call") x[f.output_index] = void 0, d.enqueue({
|
|
5790
|
+
type: "tool-result",
|
|
5791
|
+
toolCallId: f.item.id,
|
|
5792
|
+
toolName: i.toCustomToolName("file_search"),
|
|
5793
|
+
result: {
|
|
5794
|
+
queries: f.item.queries,
|
|
5795
|
+
results: f.item.results?.map((e) => ({
|
|
5796
|
+
attributes: e.attributes,
|
|
5797
|
+
fileId: e.file_id,
|
|
5798
|
+
filename: e.filename,
|
|
5799
|
+
score: e.score,
|
|
5800
|
+
text: e.text
|
|
5801
|
+
})) ?? null
|
|
5802
|
+
}
|
|
5752
5803
|
});
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
code: f.item.code,
|
|
5759
|
-
fingerprint: f.item.fingerprint
|
|
5760
|
-
}),
|
|
5761
|
-
providerExecuted: !0,
|
|
5762
|
-
providerMetadata: { [o]: { itemId: f.item.id } }
|
|
5763
|
-
});
|
|
5764
|
-
else if (f.item.type === "program_output") d.enqueue({
|
|
5765
|
-
type: "tool-result",
|
|
5766
|
-
toolCallId: f.item.call_id,
|
|
5767
|
-
toolName: i.toCustomToolName("programmatic_tool_calling"),
|
|
5768
|
-
result: {
|
|
5769
|
-
result: f.item.result,
|
|
5770
|
-
status: f.item.status
|
|
5771
|
-
},
|
|
5772
|
-
providerMetadata: { [o]: { itemId: f.item.id } }
|
|
5773
|
-
});
|
|
5774
|
-
else if (f.item.type === "custom_tool_call") {
|
|
5775
|
-
let e = x[f.output_index];
|
|
5776
|
-
x[f.output_index] = void 0, w = !0;
|
|
5777
|
-
let t = i.toCustomToolName(f.item.name);
|
|
5778
|
-
d.enqueue({
|
|
5779
|
-
type: "tool-input-end",
|
|
5780
|
-
id: f.item.call_id
|
|
5781
|
-
}), d.enqueue({
|
|
5782
|
-
type: "tool-call",
|
|
5783
|
-
toolCallId: f.item.call_id,
|
|
5784
|
-
toolName: t,
|
|
5785
|
-
input: JSON.stringify(f.item.input),
|
|
5786
|
-
providerMetadata: { [o]: {
|
|
5787
|
-
itemId: f.item.id,
|
|
5788
|
-
...f.item.async == null ? e?.async == null ? {} : { async: e.async } : { async: f.item.async }
|
|
5789
|
-
} }
|
|
5804
|
+
else if (f.item.type === "code_interpreter_call") x[f.output_index] = void 0, d.enqueue({
|
|
5805
|
+
type: "tool-result",
|
|
5806
|
+
toolCallId: f.item.id,
|
|
5807
|
+
toolName: i.toCustomToolName("code_interpreter"),
|
|
5808
|
+
result: { outputs: f.item.outputs }
|
|
5790
5809
|
});
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5810
|
+
else if (f.item.type === "image_generation_call") d.enqueue({
|
|
5811
|
+
type: "tool-result",
|
|
5812
|
+
toolCallId: f.item.id,
|
|
5813
|
+
toolName: i.toCustomToolName("image_generation"),
|
|
5814
|
+
result: { result: f.item.result }
|
|
5815
|
+
});
|
|
5816
|
+
else if (f.item.type === "tool_search_call") {
|
|
5817
|
+
let e = x[f.output_index], t = f.item.execution === "server";
|
|
5818
|
+
if (e != null) {
|
|
5819
|
+
let n = t ? e.toolCallId : f.item.call_id ?? f.item.id;
|
|
5820
|
+
t ? j.push(n) : d.enqueue({
|
|
5821
|
+
type: "tool-input-start",
|
|
5822
|
+
id: n,
|
|
5823
|
+
toolName: e.toolName
|
|
5824
|
+
}), d.enqueue({
|
|
5825
|
+
type: "tool-input-end",
|
|
5826
|
+
id: n
|
|
5827
|
+
}), d.enqueue({
|
|
5828
|
+
type: "tool-call",
|
|
5829
|
+
toolCallId: n,
|
|
5830
|
+
toolName: e.toolName,
|
|
5831
|
+
input: JSON.stringify({
|
|
5832
|
+
arguments: f.item.arguments,
|
|
5833
|
+
call_id: t ? null : n
|
|
5834
|
+
}),
|
|
5835
|
+
...t ? { providerExecuted: !0 } : {},
|
|
5836
|
+
providerMetadata: { [o]: { itemId: f.item.id } }
|
|
5837
|
+
});
|
|
5838
|
+
}
|
|
5839
|
+
x[f.output_index] = void 0;
|
|
5840
|
+
} else if (f.item.type === "tool_search_output") {
|
|
5841
|
+
let e = f.item.call_id ?? j.shift() ?? f.item.id;
|
|
5842
|
+
d.enqueue({
|
|
5843
|
+
type: "tool-result",
|
|
5844
|
+
toolCallId: e,
|
|
5845
|
+
toolName: i.toCustomToolName("tool_search"),
|
|
5846
|
+
result: { tools: f.item.tools },
|
|
5847
|
+
providerMetadata: { [o]: { itemId: f.item.id } }
|
|
5848
|
+
});
|
|
5849
|
+
} else if (f.item.type === "mcp_call") {
|
|
5850
|
+
x[f.output_index] = void 0;
|
|
5851
|
+
let e = f.item.approval_request_id ?? void 0, t = e == null ? f.item.id : g.get(e) ?? m[e] ?? f.item.id, n = `mcp.${f.item.name}`;
|
|
5799
5852
|
d.enqueue({
|
|
5800
|
-
type: "tool-input-end",
|
|
5801
|
-
id: f.item.id
|
|
5802
|
-
}), d.enqueue({
|
|
5803
5853
|
type: "tool-call",
|
|
5804
|
-
toolCallId:
|
|
5805
|
-
toolName:
|
|
5806
|
-
input:
|
|
5807
|
-
providerExecuted: !0
|
|
5854
|
+
toolCallId: t,
|
|
5855
|
+
toolName: n,
|
|
5856
|
+
input: f.item.arguments,
|
|
5857
|
+
providerExecuted: !0,
|
|
5858
|
+
dynamic: !0
|
|
5808
5859
|
}), d.enqueue({
|
|
5809
5860
|
type: "tool-result",
|
|
5810
|
-
toolCallId:
|
|
5811
|
-
toolName:
|
|
5861
|
+
toolCallId: t,
|
|
5862
|
+
toolName: n,
|
|
5812
5863
|
result: {
|
|
5813
|
-
type: "
|
|
5814
|
-
|
|
5815
|
-
|
|
5864
|
+
type: "call",
|
|
5865
|
+
serverLabel: f.item.server_label,
|
|
5866
|
+
name: f.item.name,
|
|
5867
|
+
arguments: f.item.arguments,
|
|
5868
|
+
...f.item.output == null ? {} : { output: f.item.output },
|
|
5869
|
+
...f.item.error == null ? {} : { error: f.item.error }
|
|
5870
|
+
},
|
|
5871
|
+
providerMetadata: { [o]: { itemId: f.item.id } }
|
|
5816
5872
|
});
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
delta: t
|
|
5825
|
-
}), d.enqueue({
|
|
5826
|
-
type: "tool-input-end",
|
|
5827
|
-
id: f.item.call_id
|
|
5828
|
-
}), d.enqueue({
|
|
5829
|
-
type: "tool-call",
|
|
5830
|
-
toolCallId: f.item.call_id,
|
|
5831
|
-
toolName: e,
|
|
5832
|
-
input: t,
|
|
5833
|
-
providerMetadata: { [o]: { itemId: f.item.id } }
|
|
5834
|
-
});
|
|
5835
|
-
} else if (f.item.type === "file_search_call") x[f.output_index] = void 0, d.enqueue({
|
|
5836
|
-
type: "tool-result",
|
|
5837
|
-
toolCallId: f.item.id,
|
|
5838
|
-
toolName: i.toCustomToolName("file_search"),
|
|
5839
|
-
result: {
|
|
5840
|
-
queries: f.item.queries,
|
|
5841
|
-
results: f.item.results?.map((e) => ({
|
|
5842
|
-
attributes: e.attributes,
|
|
5843
|
-
fileId: e.file_id,
|
|
5844
|
-
filename: e.filename,
|
|
5845
|
-
score: e.score,
|
|
5846
|
-
text: e.text
|
|
5847
|
-
})) ?? null
|
|
5848
|
-
}
|
|
5849
|
-
});
|
|
5850
|
-
else if (f.item.type === "code_interpreter_call") x[f.output_index] = void 0, d.enqueue({
|
|
5851
|
-
type: "tool-result",
|
|
5852
|
-
toolCallId: f.item.id,
|
|
5853
|
-
toolName: i.toCustomToolName("code_interpreter"),
|
|
5854
|
-
result: { outputs: f.item.outputs }
|
|
5855
|
-
});
|
|
5856
|
-
else if (f.item.type === "image_generation_call") d.enqueue({
|
|
5857
|
-
type: "tool-result",
|
|
5858
|
-
toolCallId: f.item.id,
|
|
5859
|
-
toolName: i.toCustomToolName("image_generation"),
|
|
5860
|
-
result: { result: f.item.result }
|
|
5861
|
-
});
|
|
5862
|
-
else if (f.item.type === "tool_search_call") {
|
|
5863
|
-
let e = x[f.output_index], t = f.item.execution === "server";
|
|
5864
|
-
if (e != null) {
|
|
5865
|
-
let n = t ? e.toolCallId : f.item.call_id ?? f.item.id;
|
|
5866
|
-
t ? j.push(n) : d.enqueue({
|
|
5867
|
-
type: "tool-input-start",
|
|
5868
|
-
id: n,
|
|
5869
|
-
toolName: e.toolName
|
|
5873
|
+
} else if (f.item.type === "mcp_list_tools") x[f.output_index] = void 0;
|
|
5874
|
+
else if (f.item.type === "apply_patch_call") {
|
|
5875
|
+
let e = x[f.output_index];
|
|
5876
|
+
e?.applyPatch && !e.applyPatch.endEmitted && f.item.operation.type !== "delete_file" && (e.applyPatch.hasDiff || d.enqueue({
|
|
5877
|
+
type: "tool-input-delta",
|
|
5878
|
+
id: e.toolCallId,
|
|
5879
|
+
delta: oi(f.item.operation.diff)
|
|
5870
5880
|
}), d.enqueue({
|
|
5871
|
-
type: "tool-input-
|
|
5872
|
-
id:
|
|
5881
|
+
type: "tool-input-delta",
|
|
5882
|
+
id: e.toolCallId,
|
|
5883
|
+
delta: "\"}}"
|
|
5873
5884
|
}), d.enqueue({
|
|
5885
|
+
type: "tool-input-end",
|
|
5886
|
+
id: e.toolCallId
|
|
5887
|
+
}), e.applyPatch.endEmitted = !0), e && f.item.status === "completed" && (w = !0, d.enqueue({
|
|
5874
5888
|
type: "tool-call",
|
|
5875
|
-
toolCallId:
|
|
5876
|
-
toolName:
|
|
5889
|
+
toolCallId: e.toolCallId,
|
|
5890
|
+
toolName: i.toCustomToolName("apply_patch"),
|
|
5877
5891
|
input: JSON.stringify({
|
|
5878
|
-
|
|
5879
|
-
|
|
5892
|
+
callId: f.item.call_id,
|
|
5893
|
+
operation: f.item.operation
|
|
5880
5894
|
}),
|
|
5881
|
-
...t ? { providerExecuted: !0 } : {},
|
|
5882
5895
|
providerMetadata: { [o]: { itemId: f.item.id } }
|
|
5896
|
+
})), x[f.output_index] = void 0;
|
|
5897
|
+
} else if (f.item.type === "mcp_approval_request") {
|
|
5898
|
+
x[f.output_index] = void 0;
|
|
5899
|
+
let e = p.config.generateId?.() ?? c(), t = f.item.approval_request_id ?? f.item.id;
|
|
5900
|
+
g.set(t, e);
|
|
5901
|
+
let n = `mcp.${f.item.name}`;
|
|
5902
|
+
d.enqueue({
|
|
5903
|
+
type: "tool-call",
|
|
5904
|
+
toolCallId: e,
|
|
5905
|
+
toolName: n,
|
|
5906
|
+
input: f.item.arguments,
|
|
5907
|
+
providerExecuted: !0,
|
|
5908
|
+
dynamic: !0
|
|
5909
|
+
}), d.enqueue({
|
|
5910
|
+
type: "tool-approval-request",
|
|
5911
|
+
approvalId: t,
|
|
5912
|
+
toolCallId: e
|
|
5883
5913
|
});
|
|
5884
|
-
}
|
|
5885
|
-
x[f.output_index] = void 0;
|
|
5886
|
-
} else if (f.item.type === "tool_search_output") {
|
|
5887
|
-
let e = f.item.call_id ?? j.shift() ?? f.item.id;
|
|
5888
|
-
d.enqueue({
|
|
5889
|
-
type: "tool-result",
|
|
5890
|
-
toolCallId: e,
|
|
5891
|
-
toolName: i.toCustomToolName("tool_search"),
|
|
5892
|
-
result: { tools: f.item.tools },
|
|
5893
|
-
providerMetadata: { [o]: { itemId: f.item.id } }
|
|
5894
|
-
});
|
|
5895
|
-
} else if (f.item.type === "mcp_call") {
|
|
5896
|
-
x[f.output_index] = void 0;
|
|
5897
|
-
let e = f.item.approval_request_id ?? void 0, t = e == null ? f.item.id : g.get(e) ?? m[e] ?? f.item.id, n = `mcp.${f.item.name}`;
|
|
5898
|
-
d.enqueue({
|
|
5914
|
+
} else if (f.item.type === "local_shell_call") x[f.output_index] = void 0, d.enqueue({
|
|
5899
5915
|
type: "tool-call",
|
|
5900
|
-
toolCallId:
|
|
5901
|
-
toolName:
|
|
5902
|
-
input:
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
type: "call",
|
|
5911
|
-
serverLabel: f.item.server_label,
|
|
5912
|
-
name: f.item.name,
|
|
5913
|
-
arguments: f.item.arguments,
|
|
5914
|
-
...f.item.output == null ? {} : { output: f.item.output },
|
|
5915
|
-
...f.item.error == null ? {} : { error: f.item.error }
|
|
5916
|
-
},
|
|
5916
|
+
toolCallId: f.item.call_id,
|
|
5917
|
+
toolName: i.toCustomToolName("local_shell"),
|
|
5918
|
+
input: JSON.stringify({ action: {
|
|
5919
|
+
type: "exec",
|
|
5920
|
+
command: f.item.action.command,
|
|
5921
|
+
timeoutMs: f.item.action.timeout_ms,
|
|
5922
|
+
user: f.item.action.user,
|
|
5923
|
+
workingDirectory: f.item.action.working_directory,
|
|
5924
|
+
env: f.item.action.env
|
|
5925
|
+
} }),
|
|
5917
5926
|
providerMetadata: { [o]: { itemId: f.item.id } }
|
|
5918
5927
|
});
|
|
5919
|
-
|
|
5920
|
-
else if (f.item.type === "apply_patch_call") {
|
|
5921
|
-
let e = x[f.output_index];
|
|
5922
|
-
e?.applyPatch && !e.applyPatch.endEmitted && f.item.operation.type !== "delete_file" && (e.applyPatch.hasDiff || d.enqueue({
|
|
5923
|
-
type: "tool-input-delta",
|
|
5924
|
-
id: e.toolCallId,
|
|
5925
|
-
delta: Zr(f.item.operation.diff)
|
|
5926
|
-
}), d.enqueue({
|
|
5927
|
-
type: "tool-input-delta",
|
|
5928
|
-
id: e.toolCallId,
|
|
5929
|
-
delta: "\"}}"
|
|
5930
|
-
}), d.enqueue({
|
|
5931
|
-
type: "tool-input-end",
|
|
5932
|
-
id: e.toolCallId
|
|
5933
|
-
}), e.applyPatch.endEmitted = !0), e && f.item.status === "completed" && (w = !0, d.enqueue({
|
|
5928
|
+
else if (f.item.type === "shell_call") x[f.output_index] = void 0, d.enqueue({
|
|
5934
5929
|
type: "tool-call",
|
|
5935
|
-
toolCallId:
|
|
5936
|
-
toolName: i.toCustomToolName("
|
|
5937
|
-
input: JSON.stringify({
|
|
5938
|
-
|
|
5939
|
-
operation: f.item.operation
|
|
5940
|
-
}),
|
|
5930
|
+
toolCallId: f.item.call_id,
|
|
5931
|
+
toolName: i.toCustomToolName("shell"),
|
|
5932
|
+
input: JSON.stringify({ action: { commands: f.item.action.commands } }),
|
|
5933
|
+
...s && { providerExecuted: !0 },
|
|
5941
5934
|
providerMetadata: { [o]: { itemId: f.item.id } }
|
|
5942
|
-
})), x[f.output_index] = void 0;
|
|
5943
|
-
} else if (f.item.type === "mcp_approval_request") {
|
|
5944
|
-
x[f.output_index] = void 0;
|
|
5945
|
-
let e = p.config.generateId?.() ?? c(), t = f.item.approval_request_id ?? f.item.id;
|
|
5946
|
-
g.set(t, e);
|
|
5947
|
-
let n = `mcp.${f.item.name}`;
|
|
5948
|
-
d.enqueue({
|
|
5949
|
-
type: "tool-call",
|
|
5950
|
-
toolCallId: e,
|
|
5951
|
-
toolName: n,
|
|
5952
|
-
input: f.item.arguments,
|
|
5953
|
-
providerExecuted: !0,
|
|
5954
|
-
dynamic: !0
|
|
5955
|
-
}), d.enqueue({
|
|
5956
|
-
type: "tool-approval-request",
|
|
5957
|
-
approvalId: t,
|
|
5958
|
-
toolCallId: e
|
|
5959
5935
|
});
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
})
|
|
6000
|
-
|
|
6001
|
-
let n = Object.entries(t.summaryParts).filter(([e, t]) => t === "active" || t === "can-conclude").map(([e]) => e);
|
|
6002
|
-
for (let t of n) d.enqueue({
|
|
6003
|
-
type: "reasoning-end",
|
|
6004
|
-
id: `${e}:${t}`,
|
|
6005
|
-
providerMetadata: { [o]: {
|
|
6006
|
-
itemId: e,
|
|
6007
|
-
reasoningEncryptedContent: f.item.encrypted_content ?? null
|
|
6008
|
-
} }
|
|
6009
|
-
});
|
|
6010
|
-
delete E[e];
|
|
6011
|
-
}
|
|
6012
|
-
D[f.output_index] = void 0;
|
|
6013
|
-
} else f.item.type === "compaction" && d.enqueue({
|
|
6014
|
-
type: "custom",
|
|
6015
|
-
kind: "openai.compaction",
|
|
6016
|
-
providerMetadata: { [o]: {
|
|
6017
|
-
type: "compaction",
|
|
6018
|
-
itemId: f.item.id,
|
|
6019
|
-
encryptedContent: f.item.encrypted_content
|
|
6020
|
-
} }
|
|
6021
|
-
});
|
|
6022
|
-
else if (Rr(f)) {
|
|
5936
|
+
else if (f.item.type === "shell_call_output") d.enqueue({
|
|
5937
|
+
type: "tool-result",
|
|
5938
|
+
toolCallId: f.item.call_id,
|
|
5939
|
+
toolName: i.toCustomToolName("shell"),
|
|
5940
|
+
result: { output: f.item.output.map((e) => ({
|
|
5941
|
+
stdout: e.stdout,
|
|
5942
|
+
stderr: e.stderr,
|
|
5943
|
+
outcome: e.outcome.type === "exit" ? {
|
|
5944
|
+
type: "exit",
|
|
5945
|
+
exitCode: e.outcome.exit_code
|
|
5946
|
+
} : { type: "timeout" }
|
|
5947
|
+
})) }
|
|
5948
|
+
});
|
|
5949
|
+
else if (f.item.type === "reasoning") {
|
|
5950
|
+
let e = O({
|
|
5951
|
+
itemId: f.item.id,
|
|
5952
|
+
outputIndex: f.output_index
|
|
5953
|
+
}), t = E[e];
|
|
5954
|
+
if (t != null) {
|
|
5955
|
+
let n = Object.entries(t.summaryParts).filter(([e, t]) => t === "active" || t === "can-conclude").map(([e]) => e);
|
|
5956
|
+
for (let t of n) d.enqueue({
|
|
5957
|
+
type: "reasoning-end",
|
|
5958
|
+
id: `${e}:${t}`,
|
|
5959
|
+
providerMetadata: { [o]: {
|
|
5960
|
+
itemId: e,
|
|
5961
|
+
reasoningEncryptedContent: f.item.encrypted_content ?? null
|
|
5962
|
+
} }
|
|
5963
|
+
});
|
|
5964
|
+
delete E[e];
|
|
5965
|
+
}
|
|
5966
|
+
D[f.output_index] = void 0;
|
|
5967
|
+
} else f.item.type === "compaction" && d.enqueue({
|
|
5968
|
+
type: "custom",
|
|
5969
|
+
kind: "openai.compaction",
|
|
5970
|
+
providerMetadata: { [o]: {
|
|
5971
|
+
type: "compaction",
|
|
5972
|
+
itemId: f.item.id,
|
|
5973
|
+
encryptedContent: f.item.encrypted_content
|
|
5974
|
+
} }
|
|
5975
|
+
});
|
|
5976
|
+
} else if (qr(f)) {
|
|
6023
5977
|
let e = x[f.output_index];
|
|
6024
5978
|
e != null && (e.suppressInputStreaming ? e.bufferedInputDeltas?.push(f.delta) : d.enqueue({
|
|
6025
5979
|
type: "tool-input-delta",
|
|
6026
5980
|
id: e.toolCallId,
|
|
6027
5981
|
delta: f.delta
|
|
6028
5982
|
}));
|
|
6029
|
-
} else if (
|
|
5983
|
+
} else if (Jr(f)) {
|
|
6030
5984
|
let e = x[f.output_index];
|
|
6031
5985
|
e != null && d.enqueue({
|
|
6032
5986
|
type: "tool-input-delta",
|
|
6033
5987
|
id: e.toolCallId,
|
|
6034
5988
|
delta: f.delta
|
|
6035
5989
|
});
|
|
6036
|
-
} else if (
|
|
5990
|
+
} else if (Qr(f)) {
|
|
6037
5991
|
let e = x[f.output_index];
|
|
6038
5992
|
e?.applyPatch && (d.enqueue({
|
|
6039
5993
|
type: "tool-input-delta",
|
|
6040
5994
|
id: e.toolCallId,
|
|
6041
|
-
delta:
|
|
5995
|
+
delta: oi(f.delta)
|
|
6042
5996
|
}), e.applyPatch.hasDiff = !0);
|
|
6043
|
-
} else if (
|
|
5997
|
+
} else if ($r(f)) {
|
|
6044
5998
|
let e = x[f.output_index];
|
|
6045
5999
|
e?.applyPatch && !e.applyPatch.endEmitted && (e.applyPatch.hasDiff || (d.enqueue({
|
|
6046
6000
|
type: "tool-input-delta",
|
|
6047
6001
|
id: e.toolCallId,
|
|
6048
|
-
delta:
|
|
6002
|
+
delta: oi(f.diff)
|
|
6049
6003
|
}), e.applyPatch.hasDiff = !0), d.enqueue({
|
|
6050
6004
|
type: "tool-input-delta",
|
|
6051
6005
|
id: e.toolCallId,
|
|
@@ -6054,21 +6008,21 @@ var kr = class e {
|
|
|
6054
6008
|
type: "tool-input-end",
|
|
6055
6009
|
id: e.toolCallId
|
|
6056
6010
|
}), e.applyPatch.endEmitted = !0);
|
|
6057
|
-
} else if (
|
|
6011
|
+
} else if (Yr(f)) d.enqueue({
|
|
6058
6012
|
type: "tool-result",
|
|
6059
6013
|
toolCallId: f.item_id,
|
|
6060
6014
|
toolName: i.toCustomToolName("image_generation"),
|
|
6061
6015
|
result: { result: f.partial_image_b64 },
|
|
6062
6016
|
preliminary: !0
|
|
6063
6017
|
});
|
|
6064
|
-
else if (
|
|
6018
|
+
else if (Xr(f)) {
|
|
6065
6019
|
let e = x[f.output_index];
|
|
6066
6020
|
e != null && d.enqueue({
|
|
6067
6021
|
type: "tool-input-delta",
|
|
6068
6022
|
id: e.toolCallId,
|
|
6069
|
-
delta:
|
|
6023
|
+
delta: oi(f.delta)
|
|
6070
6024
|
});
|
|
6071
|
-
} else if (
|
|
6025
|
+
} else if (Zr(f)) {
|
|
6072
6026
|
let e = x[f.output_index];
|
|
6073
6027
|
e != null && (d.enqueue({
|
|
6074
6028
|
type: "tool-input-delta",
|
|
@@ -6087,13 +6041,13 @@ var kr = class e {
|
|
|
6087
6041
|
}),
|
|
6088
6042
|
providerExecuted: !0
|
|
6089
6043
|
}));
|
|
6090
|
-
} else if (
|
|
6044
|
+
} else if (Kr(f)) b = f.response.id, d.enqueue({
|
|
6091
6045
|
type: "response-metadata",
|
|
6092
6046
|
id: f.response.id,
|
|
6093
6047
|
timestamp: /* @__PURE__ */ new Date(f.response.created_at * 1e3),
|
|
6094
6048
|
modelId: f.response.model
|
|
6095
6049
|
});
|
|
6096
|
-
else if (
|
|
6050
|
+
else if (zr(f)) {
|
|
6097
6051
|
let t = O({
|
|
6098
6052
|
itemId: f.item_id,
|
|
6099
6053
|
outputIndex: f.output_index
|
|
@@ -6148,17 +6102,17 @@ var kr = class e {
|
|
|
6148
6102
|
id: `${e}:${f.summary_index}`,
|
|
6149
6103
|
providerMetadata: { [o]: { itemId: e } }
|
|
6150
6104
|
}), t.summaryParts[f.summary_index] = "concluded") : t.summaryParts[f.summary_index] = "can-conclude");
|
|
6151
|
-
} else if (
|
|
6152
|
-
unified:
|
|
6105
|
+
} else if (Wr(f)) M || (_ = {
|
|
6106
|
+
unified: Un({
|
|
6153
6107
|
finishReason: f.response.incomplete_details?.reason,
|
|
6154
6108
|
hasFunctionCall: w
|
|
6155
6109
|
}),
|
|
6156
6110
|
raw: f.response.incomplete_details?.reason ?? void 0
|
|
6157
6111
|
}), v = f.response.usage ?? void 0, typeof f.response.service_tier == "string" && (k = f.response.service_tier), f.response.reasoning?.context != null && (A = f.response.reasoning.context);
|
|
6158
|
-
else if (
|
|
6112
|
+
else if (Gr(f)) {
|
|
6159
6113
|
let e = f.response.incomplete_details?.reason;
|
|
6160
6114
|
if (_ = {
|
|
6161
|
-
unified: e ?
|
|
6115
|
+
unified: e ? Un({
|
|
6162
6116
|
finishReason: e,
|
|
6163
6117
|
hasFunctionCall: w
|
|
6164
6118
|
}) : "error",
|
|
@@ -6179,7 +6133,7 @@ var kr = class e {
|
|
|
6179
6133
|
error: Fe(e) ?? e
|
|
6180
6134
|
});
|
|
6181
6135
|
}
|
|
6182
|
-
} else
|
|
6136
|
+
} else ti(f) ? (S.push(f.annotation), f.annotation.type === "url_citation" ? d.enqueue({
|
|
6183
6137
|
type: "source",
|
|
6184
6138
|
sourceType: "url",
|
|
6185
6139
|
id: p.config.generateId?.() ?? c(),
|
|
@@ -6221,7 +6175,7 @@ var kr = class e {
|
|
|
6221
6175
|
fileId: f.annotation.file_id,
|
|
6222
6176
|
index: f.annotation.index
|
|
6223
6177
|
} }
|
|
6224
|
-
})) :
|
|
6178
|
+
})) : ni(f) && (M = !0, _ = {
|
|
6225
6179
|
unified: "error",
|
|
6226
6180
|
raw: "error"
|
|
6227
6181
|
}, d.enqueue({
|
|
@@ -6251,7 +6205,7 @@ var kr = class e {
|
|
|
6251
6205
|
e.enqueue({
|
|
6252
6206
|
type: "finish",
|
|
6253
6207
|
finishReason: _,
|
|
6254
|
-
usage:
|
|
6208
|
+
usage: Hn(v),
|
|
6255
6209
|
providerMetadata: t
|
|
6256
6210
|
});
|
|
6257
6211
|
}
|
|
@@ -6261,14 +6215,14 @@ var kr = class e {
|
|
|
6261
6215
|
};
|
|
6262
6216
|
}
|
|
6263
6217
|
};
|
|
6264
|
-
function
|
|
6218
|
+
function zr(e) {
|
|
6265
6219
|
return e.type === "response.output_text.delta";
|
|
6266
6220
|
}
|
|
6267
|
-
function
|
|
6268
|
-
let t =
|
|
6221
|
+
function Br(e) {
|
|
6222
|
+
let t = Hr(e);
|
|
6269
6223
|
return t != null && Array.isArray(t.choices) && typeof t.type != "string";
|
|
6270
6224
|
}
|
|
6271
|
-
function
|
|
6225
|
+
function Vr({ value: e, cause: t, url: n, requestBodyValues: r, responseHeaders: i }) {
|
|
6272
6226
|
return new te({
|
|
6273
6227
|
message: "Received a Chat Completions stream while using the OpenAI Responses API. The default OpenAI provider model uses the Responses API. If your custom baseURL targets a Chat Completions-compatible endpoint, use openai.chat('model-id') or createOpenAI(...).chat('model-id') instead. You can also use @ai-sdk/openai-compatible for OpenAI-compatible providers.",
|
|
6274
6228
|
url: n,
|
|
@@ -6280,58 +6234,58 @@ function Mr({ value: e, cause: t, url: n, requestBodyValues: r, responseHeaders:
|
|
|
6280
6234
|
isRetryable: !1
|
|
6281
6235
|
});
|
|
6282
6236
|
}
|
|
6283
|
-
function
|
|
6237
|
+
function Hr(e) {
|
|
6284
6238
|
return typeof e == "object" && e ? e : void 0;
|
|
6285
6239
|
}
|
|
6286
|
-
function
|
|
6240
|
+
function Ur(e) {
|
|
6287
6241
|
return e.type === "response.output_item.done";
|
|
6288
6242
|
}
|
|
6289
|
-
function
|
|
6243
|
+
function Wr(e) {
|
|
6290
6244
|
return e.type === "response.completed" || e.type === "response.incomplete";
|
|
6291
6245
|
}
|
|
6292
|
-
function
|
|
6246
|
+
function Gr(e) {
|
|
6293
6247
|
return e.type === "response.failed";
|
|
6294
6248
|
}
|
|
6295
|
-
function
|
|
6249
|
+
function Kr(e) {
|
|
6296
6250
|
return e.type === "response.created";
|
|
6297
6251
|
}
|
|
6298
|
-
function
|
|
6252
|
+
function qr(e) {
|
|
6299
6253
|
return e.type === "response.function_call_arguments.delta";
|
|
6300
6254
|
}
|
|
6301
|
-
function
|
|
6255
|
+
function Jr(e) {
|
|
6302
6256
|
return e.type === "response.custom_tool_call_input.delta";
|
|
6303
6257
|
}
|
|
6304
|
-
function
|
|
6258
|
+
function Yr(e) {
|
|
6305
6259
|
return e.type === "response.image_generation_call.partial_image";
|
|
6306
6260
|
}
|
|
6307
|
-
function
|
|
6261
|
+
function Xr(e) {
|
|
6308
6262
|
return e.type === "response.code_interpreter_call_code.delta";
|
|
6309
6263
|
}
|
|
6310
|
-
function
|
|
6264
|
+
function Zr(e) {
|
|
6311
6265
|
return e.type === "response.code_interpreter_call_code.done";
|
|
6312
6266
|
}
|
|
6313
|
-
function
|
|
6267
|
+
function Qr(e) {
|
|
6314
6268
|
return e.type === "response.apply_patch_call_operation_diff.delta";
|
|
6315
6269
|
}
|
|
6316
|
-
function
|
|
6270
|
+
function $r(e) {
|
|
6317
6271
|
return e.type === "response.apply_patch_call_operation_diff.done";
|
|
6318
6272
|
}
|
|
6319
|
-
function
|
|
6273
|
+
function ei(e) {
|
|
6320
6274
|
return e.type === "response.output_item.added";
|
|
6321
6275
|
}
|
|
6322
|
-
function
|
|
6276
|
+
function ti(e) {
|
|
6323
6277
|
return e.type === "response.output_text.annotation.added";
|
|
6324
6278
|
}
|
|
6325
|
-
function
|
|
6279
|
+
function ni(e) {
|
|
6326
6280
|
return e.type === "error";
|
|
6327
6281
|
}
|
|
6328
|
-
function
|
|
6282
|
+
function ri(e) {
|
|
6329
6283
|
return e.type === "response.in_progress";
|
|
6330
6284
|
}
|
|
6331
|
-
function
|
|
6332
|
-
return
|
|
6285
|
+
function ii(e) {
|
|
6286
|
+
return e.type !== "response.created" && e.type !== "response.in_progress" && e.type !== "response.failed" && e.type !== "error" && e.type !== "unknown_chunk";
|
|
6333
6287
|
}
|
|
6334
|
-
function
|
|
6288
|
+
function ai(e) {
|
|
6335
6289
|
if (e == null) return {};
|
|
6336
6290
|
switch (e.type) {
|
|
6337
6291
|
case "search": return {
|
|
@@ -6353,11 +6307,11 @@ function Xr(e) {
|
|
|
6353
6307
|
} };
|
|
6354
6308
|
}
|
|
6355
6309
|
}
|
|
6356
|
-
function
|
|
6310
|
+
function oi(e) {
|
|
6357
6311
|
return JSON.stringify(e).slice(1, -1);
|
|
6358
6312
|
}
|
|
6359
|
-
var
|
|
6360
|
-
function
|
|
6313
|
+
var si = "/v1/responses", ci = 172800, li = J(() => n(L({ inputFileExpiresAfter: W().int().min(3600).max(2592e3).optional() })));
|
|
6314
|
+
function ui(e) {
|
|
6361
6315
|
for (let t of e) {
|
|
6362
6316
|
let e = t.type;
|
|
6363
6317
|
if (e !== "text") throw new G({
|
|
@@ -6366,7 +6320,7 @@ function ti(e) {
|
|
|
6366
6320
|
});
|
|
6367
6321
|
}
|
|
6368
6322
|
}
|
|
6369
|
-
var
|
|
6323
|
+
var di = () => L({
|
|
6370
6324
|
id: q(),
|
|
6371
6325
|
status: q(),
|
|
6372
6326
|
output_file_id: q().nullish(),
|
|
@@ -6382,7 +6336,7 @@ var ni = () => L({
|
|
|
6382
6336
|
code: q().nullish(),
|
|
6383
6337
|
message: q().nullish()
|
|
6384
6338
|
})).nullish() }).nullish()
|
|
6385
|
-
}),
|
|
6339
|
+
}), fi = J(() => n(di())), pi = J(() => n(L({
|
|
6386
6340
|
custom_id: q(),
|
|
6387
6341
|
response: L({
|
|
6388
6342
|
status_code: W(),
|
|
@@ -6393,34 +6347,34 @@ var ni = () => L({
|
|
|
6393
6347
|
code: q(),
|
|
6394
6348
|
message: q()
|
|
6395
6349
|
}).nullish()
|
|
6396
|
-
}))),
|
|
6397
|
-
data: d(
|
|
6350
|
+
}))), mi = J(() => n(L({
|
|
6351
|
+
data: d(di()),
|
|
6398
6352
|
has_more: N(),
|
|
6399
6353
|
last_id: q().nullish()
|
|
6400
|
-
}))),
|
|
6354
|
+
}))), hi = class {
|
|
6401
6355
|
constructor(e) {
|
|
6402
|
-
this.options = e, this.specificationVersion = "v4", this.supportedUrls =
|
|
6356
|
+
this.options = e, this.specificationVersion = "v4", this.supportedUrls = Ir, this.provider = e.provider;
|
|
6403
6357
|
}
|
|
6404
6358
|
async doStartBatch(e) {
|
|
6405
|
-
|
|
6359
|
+
ui(e.requests), gi(e.requests);
|
|
6406
6360
|
let t = [], n = e.webhookUrl == null ? [] : [{ warning: {
|
|
6407
6361
|
type: "unsupported",
|
|
6408
6362
|
feature: "webhookUrl",
|
|
6409
6363
|
details: "The OpenAI Batch API does not support per-batch webhook URLs."
|
|
6410
|
-
} }], r = (await this.parseBatchProviderOptions(e.providerOptions))?.inputFileExpiresAfter ??
|
|
6364
|
+
} }], r = (await this.parseBatchProviderOptions(e.providerOptions))?.inputFileExpiresAfter ?? ci;
|
|
6411
6365
|
for (let r of e.requests) {
|
|
6412
6366
|
let e = await this.prepareRequest(r);
|
|
6413
6367
|
t.push(JSON.stringify({
|
|
6414
6368
|
custom_id: r.id,
|
|
6415
6369
|
method: "POST",
|
|
6416
|
-
url:
|
|
6370
|
+
url: si,
|
|
6417
6371
|
body: e.body
|
|
6418
6372
|
}), "\n");
|
|
6419
6373
|
for (let t of e.warnings) n.push({
|
|
6420
6374
|
requestId: r.id,
|
|
6421
6375
|
warning: t
|
|
6422
6376
|
});
|
|
6423
|
-
for (let e of r.options.tools ?? []) e.type === "provider" && !
|
|
6377
|
+
for (let e of r.options.tools ?? []) e.type === "provider" && !_i.has(e.id) && n.push({
|
|
6424
6378
|
requestId: r.id,
|
|
6425
6379
|
warning: {
|
|
6426
6380
|
type: "unsupported",
|
|
@@ -6458,17 +6412,17 @@ var ni = () => L({
|
|
|
6458
6412
|
headers: H(this.options.config.headers?.(), e.headers),
|
|
6459
6413
|
body: {
|
|
6460
6414
|
input_file_id: c.id,
|
|
6461
|
-
endpoint:
|
|
6415
|
+
endpoint: si,
|
|
6462
6416
|
completion_window: "24h"
|
|
6463
6417
|
},
|
|
6464
6418
|
failedResponseHandler: Z,
|
|
6465
|
-
successfulResponseHandler: i(
|
|
6419
|
+
successfulResponseHandler: i(fi),
|
|
6466
6420
|
abortSignal: e.abortSignal,
|
|
6467
6421
|
fetch: this.options.config.fetch
|
|
6468
|
-
}), u =
|
|
6422
|
+
}), u = xi(c.expires_at);
|
|
6469
6423
|
return {
|
|
6470
6424
|
batchId: l.id,
|
|
6471
|
-
...
|
|
6425
|
+
...vi(l),
|
|
6472
6426
|
providerMetadata: { openai: {
|
|
6473
6427
|
inputFileId: c.id,
|
|
6474
6428
|
...u == null ? {} : { inputFileExpiresAt: u }
|
|
@@ -6480,16 +6434,16 @@ var ni = () => L({
|
|
|
6480
6434
|
let t = this.options.config.provider.includes("azure") ? "azure" : "openai", n = await I({
|
|
6481
6435
|
provider: t,
|
|
6482
6436
|
providerOptions: e,
|
|
6483
|
-
schema:
|
|
6437
|
+
schema: li
|
|
6484
6438
|
});
|
|
6485
6439
|
return n == null && t !== "openai" && (n = await I({
|
|
6486
6440
|
provider: "openai",
|
|
6487
6441
|
providerOptions: e,
|
|
6488
|
-
schema:
|
|
6442
|
+
schema: li
|
|
6489
6443
|
})), n;
|
|
6490
6444
|
}
|
|
6491
6445
|
async doGetBatchStatus(e) {
|
|
6492
|
-
return
|
|
6446
|
+
return vi(await this.retrieveBatch(e));
|
|
6493
6447
|
}
|
|
6494
6448
|
async doCancelBatch(e) {
|
|
6495
6449
|
return await z({
|
|
@@ -6497,7 +6451,7 @@ var ni = () => L({
|
|
|
6497
6451
|
headers: H(this.options.config.headers?.(), e.headers),
|
|
6498
6452
|
body: {},
|
|
6499
6453
|
failedResponseHandler: Z,
|
|
6500
|
-
successfulResponseHandler: i(
|
|
6454
|
+
successfulResponseHandler: i(fi),
|
|
6501
6455
|
abortSignal: e.abortSignal,
|
|
6502
6456
|
fetch: this.options.config.fetch
|
|
6503
6457
|
}), {};
|
|
@@ -6509,7 +6463,7 @@ var ni = () => L({
|
|
|
6509
6463
|
url: t.toString(),
|
|
6510
6464
|
headers: H(this.options.config.headers?.(), e.headers),
|
|
6511
6465
|
failedResponseHandler: Z,
|
|
6512
|
-
successfulResponseHandler: i(
|
|
6466
|
+
successfulResponseHandler: i(mi),
|
|
6513
6467
|
abortSignal: e.abortSignal,
|
|
6514
6468
|
fetch: this.options.config.fetch,
|
|
6515
6469
|
validateUrl: !1
|
|
@@ -6517,13 +6471,13 @@ var ni = () => L({
|
|
|
6517
6471
|
return {
|
|
6518
6472
|
batches: n.data.map((e) => ({
|
|
6519
6473
|
batchId: e.id,
|
|
6520
|
-
...
|
|
6474
|
+
...vi(e)
|
|
6521
6475
|
})),
|
|
6522
6476
|
...n.has_more && n.last_id != null ? { nextCursor: n.last_id } : {}
|
|
6523
6477
|
};
|
|
6524
6478
|
}
|
|
6525
6479
|
async doGetBatchResults(e) {
|
|
6526
|
-
let t = await this.retrieveBatch(e), n =
|
|
6480
|
+
let t = await this.retrieveBatch(e), n = vi(t);
|
|
6527
6481
|
if (n.status === "pending") throw new R({
|
|
6528
6482
|
argument: "batchId",
|
|
6529
6483
|
message: `OpenAI batch "${e.batchId}" is not complete.`
|
|
@@ -6533,17 +6487,18 @@ var ni = () => L({
|
|
|
6533
6487
|
data: t,
|
|
6534
6488
|
message: `OpenAI batch "${e.batchId}" completed without batch output.`
|
|
6535
6489
|
});
|
|
6536
|
-
|
|
6490
|
+
let i = this.iterateBatchResults({
|
|
6537
6491
|
fileIds: r,
|
|
6538
6492
|
options: e
|
|
6539
|
-
})
|
|
6493
|
+
});
|
|
6494
|
+
return me(i);
|
|
6540
6495
|
}
|
|
6541
6496
|
async retrieveBatch(e) {
|
|
6542
6497
|
let { value: t } = await A({
|
|
6543
6498
|
url: this.getUrl(`/batches/${encodeURIComponent(e.batchId)}`),
|
|
6544
6499
|
headers: H(this.options.config.headers?.(), e.headers),
|
|
6545
6500
|
failedResponseHandler: Z,
|
|
6546
|
-
successfulResponseHandler: i(
|
|
6501
|
+
successfulResponseHandler: i(fi),
|
|
6547
6502
|
abortSignal: e.abortSignal,
|
|
6548
6503
|
fetch: this.options.config.fetch,
|
|
6549
6504
|
validateUrl: !1
|
|
@@ -6556,7 +6511,7 @@ var ni = () => L({
|
|
|
6556
6511
|
url: this.getUrl(`/files/${encodeURIComponent(n)}/content`),
|
|
6557
6512
|
headers: H(this.options.config.headers?.(), t.headers),
|
|
6558
6513
|
failedResponseHandler: Z,
|
|
6559
|
-
successfulResponseHandler: O(
|
|
6514
|
+
successfulResponseHandler: O(pi),
|
|
6560
6515
|
abortSignal: t.abortSignal,
|
|
6561
6516
|
fetch: this.options.config.fetch,
|
|
6562
6517
|
validateUrl: !1
|
|
@@ -6600,12 +6555,12 @@ var ni = () => L({
|
|
|
6600
6555
|
type: "text",
|
|
6601
6556
|
id: e.custom_id,
|
|
6602
6557
|
status: "failed",
|
|
6603
|
-
error: await
|
|
6558
|
+
error: await Si({
|
|
6604
6559
|
body: e.response.body,
|
|
6605
6560
|
statusCode: e.response.status_code
|
|
6606
6561
|
})
|
|
6607
6562
|
};
|
|
6608
|
-
let t = await
|
|
6563
|
+
let t = await Ci(e.response.body);
|
|
6609
6564
|
return t.success ? {
|
|
6610
6565
|
type: "text",
|
|
6611
6566
|
id: e.custom_id,
|
|
@@ -6619,7 +6574,7 @@ var ni = () => L({
|
|
|
6619
6574
|
};
|
|
6620
6575
|
}
|
|
6621
6576
|
async prepareRequest(e) {
|
|
6622
|
-
let { args: t, warnings: n } = await
|
|
6577
|
+
let { args: t, warnings: n } = await Rr.prepareRequest({
|
|
6623
6578
|
modelId: e.modelId,
|
|
6624
6579
|
config: this.options.config,
|
|
6625
6580
|
options: e.options
|
|
@@ -6636,22 +6591,22 @@ var ni = () => L({
|
|
|
6636
6591
|
});
|
|
6637
6592
|
}
|
|
6638
6593
|
};
|
|
6639
|
-
function
|
|
6594
|
+
function gi(e) {
|
|
6640
6595
|
let t = e[0]?.modelId;
|
|
6641
6596
|
for (let n of e) if (n.modelId !== t) throw new R({
|
|
6642
6597
|
argument: "requests",
|
|
6643
6598
|
message: `The OpenAI Batch API requires all requests in a batch to use the same model. Found "${t}" and "${n.modelId}".`
|
|
6644
6599
|
});
|
|
6645
6600
|
}
|
|
6646
|
-
var
|
|
6601
|
+
var _i = /* @__PURE__ */ new Set([
|
|
6647
6602
|
"openai.code_interpreter",
|
|
6648
6603
|
"openai.custom",
|
|
6649
6604
|
"openai.file_search",
|
|
6650
6605
|
"openai.web_search",
|
|
6651
6606
|
"openai.web_search_preview"
|
|
6652
6607
|
]);
|
|
6653
|
-
function
|
|
6654
|
-
let t =
|
|
6608
|
+
function vi(e) {
|
|
6609
|
+
let t = yi(e.status), n = e.errors?.data?.[0], r = bi(e.request_counts), i = xi(e.created_at), a = xi(e.expires_at);
|
|
6655
6610
|
return {
|
|
6656
6611
|
status: t,
|
|
6657
6612
|
rawStatus: e.status,
|
|
@@ -6664,7 +6619,7 @@ function li(e) {
|
|
|
6664
6619
|
...a == null ? {} : { expiresAt: a }
|
|
6665
6620
|
};
|
|
6666
6621
|
}
|
|
6667
|
-
function
|
|
6622
|
+
function yi(e) {
|
|
6668
6623
|
switch (e) {
|
|
6669
6624
|
case "completed": return "completed";
|
|
6670
6625
|
case "failed":
|
|
@@ -6673,7 +6628,7 @@ function ui(e) {
|
|
|
6673
6628
|
default: return "pending";
|
|
6674
6629
|
}
|
|
6675
6630
|
}
|
|
6676
|
-
function
|
|
6631
|
+
function bi(e) {
|
|
6677
6632
|
let t = e?.total, n = e?.completed, r = e?.failed;
|
|
6678
6633
|
return ve({
|
|
6679
6634
|
total: t,
|
|
@@ -6682,12 +6637,12 @@ function di(e) {
|
|
|
6682
6637
|
failed: r
|
|
6683
6638
|
});
|
|
6684
6639
|
}
|
|
6685
|
-
function
|
|
6640
|
+
function xi(e) {
|
|
6686
6641
|
if (e == null || !Number.isFinite(e)) return;
|
|
6687
6642
|
let t = /* @__PURE__ */ new Date(e * 1e3);
|
|
6688
6643
|
return Number.isNaN(t.getTime()) ? void 0 : t.toISOString();
|
|
6689
6644
|
}
|
|
6690
|
-
async function
|
|
6645
|
+
async function Si({ body: e, statusCode: t }) {
|
|
6691
6646
|
let n = await pe({
|
|
6692
6647
|
value: e,
|
|
6693
6648
|
schema: je
|
|
@@ -6702,10 +6657,10 @@ async function pi({ body: e, statusCode: t }) {
|
|
|
6702
6657
|
statusCode: t
|
|
6703
6658
|
};
|
|
6704
6659
|
}
|
|
6705
|
-
async function
|
|
6660
|
+
async function Ci(e) {
|
|
6706
6661
|
let t = await pe({
|
|
6707
6662
|
value: e,
|
|
6708
|
-
schema:
|
|
6663
|
+
schema: or
|
|
6709
6664
|
});
|
|
6710
6665
|
if (!t.success) return {
|
|
6711
6666
|
success: !1,
|
|
@@ -6793,7 +6748,7 @@ async function mi(e) {
|
|
|
6793
6748
|
type: "tool-result",
|
|
6794
6749
|
toolCallId: e.id,
|
|
6795
6750
|
toolName: "web_search",
|
|
6796
|
-
result:
|
|
6751
|
+
result: ai(e.action),
|
|
6797
6752
|
dynamic: !0
|
|
6798
6753
|
});
|
|
6799
6754
|
break;
|
|
@@ -6860,13 +6815,13 @@ async function mi(e) {
|
|
|
6860
6815
|
result: {
|
|
6861
6816
|
content: r,
|
|
6862
6817
|
finishReason: {
|
|
6863
|
-
unified:
|
|
6818
|
+
unified: Un({
|
|
6864
6819
|
finishReason: n.incomplete_details?.reason,
|
|
6865
6820
|
hasFunctionCall: a
|
|
6866
6821
|
}),
|
|
6867
6822
|
raw: n.incomplete_details?.reason ?? void 0
|
|
6868
6823
|
},
|
|
6869
|
-
usage:
|
|
6824
|
+
usage: Hn(n.usage),
|
|
6870
6825
|
response: {
|
|
6871
6826
|
id: n.id,
|
|
6872
6827
|
timestamp: n.created_at == null ? void 0 : /* @__PURE__ */ new Date(n.created_at * 1e3),
|
|
@@ -6877,13 +6832,13 @@ async function mi(e) {
|
|
|
6877
6832
|
}
|
|
6878
6833
|
};
|
|
6879
6834
|
}
|
|
6880
|
-
var
|
|
6835
|
+
var wi = B({
|
|
6881
6836
|
type: q(),
|
|
6882
6837
|
responseEvent: q().optional()
|
|
6883
|
-
}).refine((e) => e.type === "response.event" == (e.responseEvent !== void 0), "responseEvent is required for response.event and forbidden for other event types."),
|
|
6838
|
+
}).refine((e) => e.type === "response.event" == (e.responseEvent !== void 0), "responseEvent is required for response.event and forbidden for other event types."), Ti = B({
|
|
6884
6839
|
client: B({ dataChannel: B({
|
|
6885
6840
|
allowedClientEvents: V([X("all"), d(q())]).optional(),
|
|
6886
|
-
allowedServerEvents: V([X("all"), d(
|
|
6841
|
+
allowedServerEvents: V([X("all"), d(wi)]).optional()
|
|
6887
6842
|
}) }).optional(),
|
|
6888
6843
|
delegation: B({ type: X("client") }).nullable().optional(),
|
|
6889
6844
|
input: d(P("role", [B({
|
|
@@ -6903,14 +6858,14 @@ var hi = B({
|
|
|
6903
6858
|
})])).max(128).optional(),
|
|
6904
6859
|
store: N().optional(),
|
|
6905
6860
|
voice: B({ id: q().min(1) }).optional()
|
|
6906
|
-
}),
|
|
6861
|
+
}), Ei = V([B({
|
|
6907
6862
|
type: X("audio/pcm"),
|
|
6908
6863
|
rate: V([X(16e3), X(24e3)])
|
|
6909
6864
|
}), B({
|
|
6910
6865
|
type: M(["audio/pcma", "audio/pcmu"]),
|
|
6911
6866
|
rate: X(8e3)
|
|
6912
6867
|
})]);
|
|
6913
|
-
function
|
|
6868
|
+
function Di(e, t, n = "websocket") {
|
|
6914
6869
|
for (let t of Object.keys(e)) if (![
|
|
6915
6870
|
"instructions",
|
|
6916
6871
|
"voice",
|
|
@@ -6919,14 +6874,14 @@ function vi(e, t, n = "websocket") {
|
|
|
6919
6874
|
"providerOptions"
|
|
6920
6875
|
].includes(t)) throw new G({ functionality: `OpenAI Live session setting: ${t}` });
|
|
6921
6876
|
if (L({ delegation: L({ type: X("responses") }) }).safeParse(e.providerOptions?.openai).success) throw new G({ functionality: "OpenAI Live Responses delegation; only client delegation is supported" });
|
|
6922
|
-
let r =
|
|
6877
|
+
let r = Ti.parse(e.providerOptions?.openai ?? {});
|
|
6923
6878
|
if (r.client !== void 0 && n !== "webrtc") throw new G({ functionality: "OpenAI Live client permissions outside WebRTC startup" });
|
|
6924
6879
|
if (r.voice != null && e.voice != null) throw new R({
|
|
6925
6880
|
argument: "voice",
|
|
6926
6881
|
message: "Choose either voice or providerOptions.openai.voice."
|
|
6927
6882
|
});
|
|
6928
6883
|
if (n === "webrtc" && (e.inputAudioFormat !== void 0 || e.outputAudioFormat !== void 0)) throw new G({ functionality: "Fixed audio formats for OpenAI Live WebRTC; audio is negotiated through SDP" });
|
|
6929
|
-
let i = e.inputAudioFormat == null ? void 0 :
|
|
6884
|
+
let i = e.inputAudioFormat == null ? void 0 : Ei.parse(e.inputAudioFormat), a = e.outputAudioFormat == null ? void 0 : Ei.parse(e.outputAudioFormat);
|
|
6930
6885
|
if (i != null && a != null && (i.type !== a.type || i.rate !== a.rate)) throw new R({
|
|
6931
6886
|
argument: "outputAudioFormat",
|
|
6932
6887
|
message: "OpenAI Live requires the same input and output audio format."
|
|
@@ -6953,28 +6908,28 @@ function vi(e, t, n = "websocket") {
|
|
|
6953
6908
|
...r.store === void 0 ? {} : { store: r.store }
|
|
6954
6909
|
};
|
|
6955
6910
|
}
|
|
6956
|
-
var
|
|
6911
|
+
var Oi = L({ id: q().min(1) }), ki = Oi.extend({ delegation: L({ type: M(["client", "responses"]) }).nullish() }), Ai = L({ seconds: W().nonnegative() }), ji = {
|
|
6957
6912
|
delta: q(),
|
|
6958
6913
|
start_ms: W().nonnegative(),
|
|
6959
6914
|
end_ms: W().nonnegative()
|
|
6960
|
-
},
|
|
6961
|
-
...
|
|
6915
|
+
}, Mi = { client_event_id: q().nullish() }, Ni = {
|
|
6916
|
+
...Mi,
|
|
6962
6917
|
start_ms: W().nonnegative(),
|
|
6963
6918
|
end_ms: W().nonnegative()
|
|
6964
|
-
},
|
|
6919
|
+
}, Pi = P("type", [
|
|
6965
6920
|
L({
|
|
6966
6921
|
type: X("session.started"),
|
|
6967
|
-
session:
|
|
6922
|
+
session: ki
|
|
6968
6923
|
}),
|
|
6969
6924
|
L({
|
|
6970
6925
|
type: X("session.closed"),
|
|
6971
|
-
session:
|
|
6972
|
-
usage:
|
|
6926
|
+
session: Oi.nullish(),
|
|
6927
|
+
usage: Ai,
|
|
6973
6928
|
reason: q()
|
|
6974
6929
|
}),
|
|
6975
6930
|
L({
|
|
6976
6931
|
type: X("session.usage.updated"),
|
|
6977
|
-
usage:
|
|
6932
|
+
usage: Ai,
|
|
6978
6933
|
context_window: L({ usage_ratio: W().min(0).max(1) }).nullish()
|
|
6979
6934
|
}),
|
|
6980
6935
|
L({
|
|
@@ -6983,11 +6938,11 @@ var yi = L({ id: q().min(1) }), bi = yi.extend({ delegation: L({ type: M(["clien
|
|
|
6983
6938
|
}),
|
|
6984
6939
|
L({
|
|
6985
6940
|
type: X("session.input_transcript.delta"),
|
|
6986
|
-
...
|
|
6941
|
+
...ji
|
|
6987
6942
|
}),
|
|
6988
6943
|
L({
|
|
6989
6944
|
type: X("session.output_transcript.delta"),
|
|
6990
|
-
...
|
|
6945
|
+
...ji
|
|
6991
6946
|
}),
|
|
6992
6947
|
L({
|
|
6993
6948
|
type: X("session.delegation.created"),
|
|
@@ -7000,28 +6955,28 @@ var yi = L({ id: q().min(1) }), bi = yi.extend({ delegation: L({ type: M(["clien
|
|
|
7000
6955
|
}),
|
|
7001
6956
|
L({
|
|
7002
6957
|
type: X("session.updated"),
|
|
7003
|
-
session:
|
|
7004
|
-
...
|
|
6958
|
+
session: Oi,
|
|
6959
|
+
...Mi
|
|
7005
6960
|
}),
|
|
7006
6961
|
L({
|
|
7007
6962
|
type: X("session.input_audio.muted"),
|
|
7008
|
-
...
|
|
6963
|
+
...Mi
|
|
7009
6964
|
}),
|
|
7010
6965
|
L({
|
|
7011
6966
|
type: X("session.input_audio.unmuted"),
|
|
7012
|
-
...
|
|
6967
|
+
...Mi
|
|
7013
6968
|
}),
|
|
7014
6969
|
L({
|
|
7015
6970
|
type: X("session.instructions.appended"),
|
|
7016
|
-
...
|
|
6971
|
+
...Ni
|
|
7017
6972
|
}),
|
|
7018
6973
|
L({
|
|
7019
6974
|
type: X("session.thinking.appended"),
|
|
7020
|
-
...
|
|
6975
|
+
...Ni
|
|
7021
6976
|
}),
|
|
7022
6977
|
L({
|
|
7023
6978
|
type: X("session.commentary.appended"),
|
|
7024
|
-
...
|
|
6979
|
+
...Ni
|
|
7025
6980
|
}),
|
|
7026
6981
|
L({
|
|
7027
6982
|
type: X("error"),
|
|
@@ -7031,21 +6986,21 @@ var yi = L({ id: q().min(1) }), bi = yi.extend({ delegation: L({ type: M(["clien
|
|
|
7031
6986
|
client_event_id: q().nullish()
|
|
7032
6987
|
})
|
|
7033
6988
|
})
|
|
7034
|
-
]),
|
|
7035
|
-
function
|
|
7036
|
-
return (e) =>
|
|
6989
|
+
]), Fi = new Set(Pi.options.map((e) => e.shape.type.value)), Ii = L({ type: q() });
|
|
6990
|
+
function Li() {
|
|
6991
|
+
return (e) => Ri(e);
|
|
7037
6992
|
}
|
|
7038
|
-
function
|
|
7039
|
-
return [
|
|
6993
|
+
function Ri(e) {
|
|
6994
|
+
return [zi(e)];
|
|
7040
6995
|
}
|
|
7041
|
-
function
|
|
7042
|
-
let t =
|
|
7043
|
-
if (t.success && !
|
|
6996
|
+
function zi(e) {
|
|
6997
|
+
let t = Ii.safeParse(e);
|
|
6998
|
+
if (t.success && !Fi.has(t.data.type)) return {
|
|
7044
6999
|
type: "custom",
|
|
7045
7000
|
rawType: t.data.type,
|
|
7046
7001
|
raw: e
|
|
7047
7002
|
};
|
|
7048
|
-
let n =
|
|
7003
|
+
let n = Pi.safeParse(e);
|
|
7049
7004
|
if (!n.success) return {
|
|
7050
7005
|
type: "error",
|
|
7051
7006
|
code: "invalid_server_event",
|
|
@@ -7131,12 +7086,12 @@ function Ai(e) {
|
|
|
7131
7086
|
};
|
|
7132
7087
|
}
|
|
7133
7088
|
}
|
|
7134
|
-
function
|
|
7089
|
+
function Bi(e, t) {
|
|
7135
7090
|
let n = "eventId" in e && e.eventId !== void 0 ? { event_id: e.eventId } : {};
|
|
7136
7091
|
switch (e.type) {
|
|
7137
7092
|
case "session-start": return {
|
|
7138
7093
|
type: "session.start",
|
|
7139
|
-
session:
|
|
7094
|
+
session: Di(e.config, t),
|
|
7140
7095
|
...n
|
|
7141
7096
|
};
|
|
7142
7097
|
case "session-update": throw new G({ functionality: "OpenAI Live session-update; startup settings are immutable; use context-append or input-audio-mute/input-audio-unmute" });
|
|
@@ -7176,13 +7131,13 @@ function ji(e, t) {
|
|
|
7176
7131
|
default: throw new G({ functionality: `OpenAI Live command: ${e.type}; use continuous audio and context-append instead of voice-turn commands` });
|
|
7177
7132
|
}
|
|
7178
7133
|
}
|
|
7179
|
-
var
|
|
7134
|
+
var Vi = L({
|
|
7180
7135
|
session: L({ id: q().min(1) }),
|
|
7181
7136
|
transport: L({
|
|
7182
7137
|
type: X("webrtc"),
|
|
7183
7138
|
sdp: q().min(1)
|
|
7184
7139
|
})
|
|
7185
|
-
}),
|
|
7140
|
+
}), Hi = class {
|
|
7186
7141
|
constructor(e, t) {
|
|
7187
7142
|
this.modelId = e, this.config = t, this.specificationVersion = "v4", this.capabilities = {
|
|
7188
7143
|
conversation: "continuous",
|
|
@@ -7209,7 +7164,7 @@ var Mi = L({
|
|
|
7209
7164
|
};
|
|
7210
7165
|
}
|
|
7211
7166
|
async doCreateWebRTCSession({ sdp: e, sessionConfig: t = {}, abortSignal: n }) {
|
|
7212
|
-
let r =
|
|
7167
|
+
let r = Di(t, this.modelId, "webrtc"), { value: a } = await z({
|
|
7213
7168
|
url: `${this.config.baseURL}/live/sessions`,
|
|
7214
7169
|
headers: this.config.headers(),
|
|
7215
7170
|
body: {
|
|
@@ -7220,7 +7175,7 @@ var Mi = L({
|
|
|
7220
7175
|
}
|
|
7221
7176
|
},
|
|
7222
7177
|
failedResponseHandler: Z,
|
|
7223
|
-
successfulResponseHandler: i(
|
|
7178
|
+
successfulResponseHandler: i(Vi),
|
|
7224
7179
|
abortSignal: n,
|
|
7225
7180
|
fetch: this.config.fetch
|
|
7226
7181
|
});
|
|
@@ -7230,19 +7185,19 @@ var Mi = L({
|
|
|
7230
7185
|
};
|
|
7231
7186
|
}
|
|
7232
7187
|
parseServerEvent(e) {
|
|
7233
|
-
return
|
|
7188
|
+
return Ri(e);
|
|
7234
7189
|
}
|
|
7235
7190
|
createServerEventParser() {
|
|
7236
|
-
return
|
|
7191
|
+
return Li();
|
|
7237
7192
|
}
|
|
7238
7193
|
serializeClientEvent(e) {
|
|
7239
|
-
return
|
|
7194
|
+
return Bi(e, this.modelId);
|
|
7240
7195
|
}
|
|
7241
7196
|
buildSessionConfig(e) {
|
|
7242
|
-
return
|
|
7197
|
+
return Di(e, this.modelId);
|
|
7243
7198
|
}
|
|
7244
7199
|
};
|
|
7245
|
-
function
|
|
7200
|
+
function Ui(e) {
|
|
7246
7201
|
let t = e, n = t.type;
|
|
7247
7202
|
switch (n) {
|
|
7248
7203
|
case "session.created": return {
|
|
@@ -7389,11 +7344,11 @@ function Pi(e) {
|
|
|
7389
7344
|
};
|
|
7390
7345
|
}
|
|
7391
7346
|
}
|
|
7392
|
-
function
|
|
7347
|
+
function Wi(e, t) {
|
|
7393
7348
|
switch (e.type) {
|
|
7394
7349
|
case "session-update": return {
|
|
7395
7350
|
type: "session.update",
|
|
7396
|
-
session:
|
|
7351
|
+
session: Gi(e.config, t),
|
|
7397
7352
|
...e.eventId == null ? {} : { event_id: e.eventId }
|
|
7398
7353
|
};
|
|
7399
7354
|
case "input-audio-append": return {
|
|
@@ -7456,7 +7411,7 @@ function Fi(e, t) {
|
|
|
7456
7411
|
case "response-cancel": return { type: "response.cancel" };
|
|
7457
7412
|
}
|
|
7458
7413
|
}
|
|
7459
|
-
function
|
|
7414
|
+
function Gi(e, t) {
|
|
7460
7415
|
let n = {
|
|
7461
7416
|
type: "realtime",
|
|
7462
7417
|
model: t
|
|
@@ -7468,10 +7423,12 @@ function Ii(e, t) {
|
|
|
7468
7423
|
if (e.inputAudioFormat != null && (t.format = {
|
|
7469
7424
|
type: e.inputAudioFormat.type,
|
|
7470
7425
|
...e.inputAudioFormat.rate == null ? {} : { rate: e.inputAudioFormat.rate }
|
|
7471
|
-
}), e.turnDetection != null)
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7426
|
+
}), e.turnDetection != null) {
|
|
7427
|
+
if (e.turnDetection.type === "disabled") t.turn_detection = null;
|
|
7428
|
+
else {
|
|
7429
|
+
let n = { type: e.turnDetection.type === "server-vad" ? "server_vad" : "semantic_vad" };
|
|
7430
|
+
e.turnDetection.threshold != null && (n.threshold = e.turnDetection.threshold), e.turnDetection.silenceDurationMs != null && (n.silence_duration_ms = e.turnDetection.silenceDurationMs), e.turnDetection.prefixPaddingMs != null && (n.prefix_padding_ms = e.turnDetection.prefixPaddingMs), t.turn_detection = n;
|
|
7431
|
+
}
|
|
7475
7432
|
}
|
|
7476
7433
|
e.inputAudioTranscription != null && (t.transcription = {
|
|
7477
7434
|
model: e.inputAudioTranscription.model ?? "gpt-realtime-whisper",
|
|
@@ -7493,7 +7450,7 @@ function Ii(e, t) {
|
|
|
7493
7450
|
parameters: e.parameters
|
|
7494
7451
|
})), n.tool_choice = "auto"), e.providerOptions != null && Object.assign(n, e.providerOptions), n;
|
|
7495
7452
|
}
|
|
7496
|
-
var
|
|
7453
|
+
var Ki = class {
|
|
7497
7454
|
constructor(e, t) {
|
|
7498
7455
|
this.specificationVersion = "v4", this.modelId = e, this.provider = t.provider, this.config = t;
|
|
7499
7456
|
}
|
|
@@ -7501,7 +7458,7 @@ var Li = class {
|
|
|
7501
7458
|
let t = this.config.fetch ?? fetch, n = `${this.config.baseURL}/realtime/client_secrets`, r = e.sessionConfig == null ? {
|
|
7502
7459
|
type: "realtime",
|
|
7503
7460
|
model: this.modelId
|
|
7504
|
-
} :
|
|
7461
|
+
} : Gi(e.sessionConfig, this.modelId), i = await t(n, {
|
|
7505
7462
|
method: "POST",
|
|
7506
7463
|
headers: {
|
|
7507
7464
|
...this.config.headers(),
|
|
@@ -7533,16 +7490,16 @@ var Li = class {
|
|
|
7533
7490
|
};
|
|
7534
7491
|
}
|
|
7535
7492
|
parseServerEvent(e) {
|
|
7536
|
-
return
|
|
7493
|
+
return Ui(e);
|
|
7537
7494
|
}
|
|
7538
7495
|
serializeClientEvent(e) {
|
|
7539
|
-
return
|
|
7496
|
+
return Wi(e, this.modelId);
|
|
7540
7497
|
}
|
|
7541
7498
|
buildSessionConfig(e) {
|
|
7542
|
-
return
|
|
7499
|
+
return Gi(e, this.modelId);
|
|
7543
7500
|
}
|
|
7544
|
-
},
|
|
7545
|
-
function
|
|
7501
|
+
}, qi = ["gpt-live-1"];
|
|
7502
|
+
function Ji(e, { api: t } = {}) {
|
|
7546
7503
|
if (t !== void 0) {
|
|
7547
7504
|
if (t !== "live" && t !== "realtime") throw new R({
|
|
7548
7505
|
argument: "api",
|
|
@@ -7550,19 +7507,19 @@ function zi(e, { api: t } = {}) {
|
|
|
7550
7507
|
});
|
|
7551
7508
|
return t;
|
|
7552
7509
|
}
|
|
7553
|
-
return
|
|
7510
|
+
return qi.some((t) => t === e) ? "live" : "realtime";
|
|
7554
7511
|
}
|
|
7555
|
-
function
|
|
7512
|
+
function Yi(e) {
|
|
7556
7513
|
let t = (t, n) => {
|
|
7557
|
-
let r =
|
|
7514
|
+
let r = Ji(t, n), i = {
|
|
7558
7515
|
...e,
|
|
7559
7516
|
provider: `${e.provider}.${r}`
|
|
7560
7517
|
};
|
|
7561
|
-
return r === "live" ? new
|
|
7518
|
+
return r === "live" ? new Hi(t, i) : new Ki(t, i);
|
|
7562
7519
|
};
|
|
7563
7520
|
return Object.assign(t, { getToken: async (e) => {
|
|
7564
7521
|
let n = t(e.model, e);
|
|
7565
|
-
if (n instanceof
|
|
7522
|
+
if (n instanceof Hi) throw new G({ functionality: "Short-lived OpenAI credentials for the Live API. Use server WebSocket setup via getServerWebSocketConfig() with a server-side API key instead." });
|
|
7566
7523
|
let r = await n.doCreateClientSecret({
|
|
7567
7524
|
sessionConfig: e.sessionConfig,
|
|
7568
7525
|
expiresAfterSeconds: e.expiresAfterSeconds
|
|
@@ -7574,10 +7531,10 @@ function Bi(e) {
|
|
|
7574
7531
|
};
|
|
7575
7532
|
} });
|
|
7576
7533
|
}
|
|
7577
|
-
var
|
|
7534
|
+
var Xi = J(() => n(L({
|
|
7578
7535
|
instructions: q().nullish(),
|
|
7579
7536
|
speed: W().min(.25).max(4).nullish()
|
|
7580
|
-
}))),
|
|
7537
|
+
}))), Zi = class e {
|
|
7581
7538
|
constructor(e, t) {
|
|
7582
7539
|
this.modelId = e, this.config = t, this.specificationVersion = "v4";
|
|
7583
7540
|
}
|
|
@@ -7597,7 +7554,7 @@ var Vi = J(() => n(L({
|
|
|
7597
7554
|
let s = [], c = await I({
|
|
7598
7555
|
provider: "openai",
|
|
7599
7556
|
providerOptions: o,
|
|
7600
|
-
schema:
|
|
7557
|
+
schema: Xi
|
|
7601
7558
|
}), l = {
|
|
7602
7559
|
model: this.modelId,
|
|
7603
7560
|
input: e,
|
|
@@ -7661,7 +7618,7 @@ var Vi = J(() => n(L({
|
|
|
7661
7618
|
}
|
|
7662
7619
|
};
|
|
7663
7620
|
}
|
|
7664
|
-
},
|
|
7621
|
+
}, Qi = J(() => n(L({
|
|
7665
7622
|
text: q(),
|
|
7666
7623
|
language: q().nullish(),
|
|
7667
7624
|
duration: W().nullish(),
|
|
@@ -7689,7 +7646,7 @@ var Vi = J(() => n(L({
|
|
|
7689
7646
|
text: q(),
|
|
7690
7647
|
speaker: q()
|
|
7691
7648
|
})])).nullish()
|
|
7692
|
-
}))),
|
|
7649
|
+
}))), $i = J(() => n(L({
|
|
7693
7650
|
include: d(q()).optional(),
|
|
7694
7651
|
language: q().optional(),
|
|
7695
7652
|
prompt: q().optional(),
|
|
@@ -7717,10 +7674,10 @@ var Vi = J(() => n(L({
|
|
|
7717
7674
|
include: d(q()).optional()
|
|
7718
7675
|
}).optional()
|
|
7719
7676
|
})));
|
|
7720
|
-
function
|
|
7677
|
+
function ea(e) {
|
|
7721
7678
|
return e === "gpt-realtime-whisper" || e.startsWith("gpt-realtime-whisper-");
|
|
7722
7679
|
}
|
|
7723
|
-
var
|
|
7680
|
+
var ta = {
|
|
7724
7681
|
afrikaans: "af",
|
|
7725
7682
|
arabic: "ar",
|
|
7726
7683
|
armenian: "hy",
|
|
@@ -7778,7 +7735,7 @@ var Ki = {
|
|
|
7778
7735
|
urdu: "ur",
|
|
7779
7736
|
vietnamese: "vi",
|
|
7780
7737
|
welsh: "cy"
|
|
7781
|
-
},
|
|
7738
|
+
}, na = class e {
|
|
7782
7739
|
constructor(e, t) {
|
|
7783
7740
|
this.modelId = e, this.config = t, this.specificationVersion = "v4";
|
|
7784
7741
|
}
|
|
@@ -7798,7 +7755,7 @@ var Ki = {
|
|
|
7798
7755
|
let r = [], i = await I({
|
|
7799
7756
|
provider: "openai",
|
|
7800
7757
|
providerOptions: n,
|
|
7801
|
-
schema:
|
|
7758
|
+
schema: $i
|
|
7802
7759
|
}), a = new FormData(), o = e instanceof Uint8Array ? new Blob([e]) : new Blob([se(e)]);
|
|
7803
7760
|
a.append("model", this.modelId);
|
|
7804
7761
|
let s = ae(t);
|
|
@@ -7813,8 +7770,10 @@ var Ki = {
|
|
|
7813
7770
|
temperature: i.temperature,
|
|
7814
7771
|
timestamp_granularities: i.timestampGranularities
|
|
7815
7772
|
};
|
|
7816
|
-
for (let [e, n] of Object.entries(t)) if (n != null)
|
|
7817
|
-
|
|
7773
|
+
for (let [e, n] of Object.entries(t)) if (n != null) {
|
|
7774
|
+
if (Array.isArray(n)) for (let t of n) a.append(`${e}[]`, String(t));
|
|
7775
|
+
else a.append(e, String(n));
|
|
7776
|
+
}
|
|
7818
7777
|
} else c && a.append("response_format", "diarized_json");
|
|
7819
7778
|
return l != null && a.append("chunking_strategy", typeof l == "string" ? l : JSON.stringify({
|
|
7820
7779
|
type: l.type,
|
|
@@ -7827,7 +7786,7 @@ var Ki = {
|
|
|
7827
7786
|
};
|
|
7828
7787
|
}
|
|
7829
7788
|
async doGenerate(e) {
|
|
7830
|
-
if (
|
|
7789
|
+
if (ea(this.modelId)) throw new G({ functionality: `non-streaming transcription with ${this.modelId}` });
|
|
7831
7790
|
let t = this.config._internal?.currentDate?.() ?? /* @__PURE__ */ new Date(), { formData: n, warnings: r } = await this.getArgs(e), { value: a, responseHeaders: o, rawValue: s } = await De({
|
|
7832
7791
|
url: this.config.url({
|
|
7833
7792
|
path: "/audio/transcriptions",
|
|
@@ -7836,10 +7795,10 @@ var Ki = {
|
|
|
7836
7795
|
headers: H(this.config.headers?.(), e.headers),
|
|
7837
7796
|
formData: n,
|
|
7838
7797
|
failedResponseHandler: Z,
|
|
7839
|
-
successfulResponseHandler: i(
|
|
7798
|
+
successfulResponseHandler: i(Qi),
|
|
7840
7799
|
abortSignal: e.abortSignal,
|
|
7841
7800
|
fetch: this.config.fetch
|
|
7842
|
-
}), c = a.language != null && a.language in
|
|
7801
|
+
}), c = a.language != null && a.language in ta ? ta[a.language] : void 0, l = a.segments?.flatMap((e) => "speaker" in e ? [{
|
|
7843
7802
|
text: e.text,
|
|
7844
7803
|
startSecond: e.start,
|
|
7845
7804
|
endSecond: e.end,
|
|
@@ -7869,11 +7828,11 @@ var Ki = {
|
|
|
7869
7828
|
};
|
|
7870
7829
|
}
|
|
7871
7830
|
async doStream(e) {
|
|
7872
|
-
if (!
|
|
7831
|
+
if (!ea(this.modelId)) throw new G({ functionality: `streaming transcription with ${this.modelId}` });
|
|
7873
7832
|
let t = this.config._internal?.currentDate?.() ?? /* @__PURE__ */ new Date(), n = await I({
|
|
7874
7833
|
provider: "openai",
|
|
7875
7834
|
providerOptions: e.providerOptions,
|
|
7876
|
-
schema:
|
|
7835
|
+
schema: $i
|
|
7877
7836
|
}), r = [], i = e.providerOptions?.openai ?? {};
|
|
7878
7837
|
for (let e of [
|
|
7879
7838
|
"include",
|
|
@@ -7885,7 +7844,7 @@ var Ki = {
|
|
|
7885
7844
|
feature: `providerOptions.openai.${e}`,
|
|
7886
7845
|
details: `OpenAI streaming transcription does not support ${e}.`
|
|
7887
7846
|
});
|
|
7888
|
-
let a = H(this.config.headers?.(), e.headers), o =
|
|
7847
|
+
let a = H(this.config.headers?.(), e.headers), o = ia({
|
|
7889
7848
|
modelId: this.modelId,
|
|
7890
7849
|
inputAudioFormat: e.inputAudioFormat,
|
|
7891
7850
|
providerOptions: n
|
|
@@ -7896,7 +7855,7 @@ var Ki = {
|
|
|
7896
7855
|
timestamp: t,
|
|
7897
7856
|
modelId: this.modelId
|
|
7898
7857
|
},
|
|
7899
|
-
stream:
|
|
7858
|
+
stream: ra({
|
|
7900
7859
|
webSocket: this.config.webSocket,
|
|
7901
7860
|
url: _(this.config.url({
|
|
7902
7861
|
path: "/realtime?intent=transcription",
|
|
@@ -7913,11 +7872,11 @@ var Ki = {
|
|
|
7913
7872
|
};
|
|
7914
7873
|
}
|
|
7915
7874
|
};
|
|
7916
|
-
function
|
|
7875
|
+
function ra({ webSocket: e, url: t, headers: n, sessionUpdate: r, language: i, warnings: a, audio: o, abortSignal: s, includeRawChunks: c }) {
|
|
7917
7876
|
let l = !1, u = () => {};
|
|
7918
7877
|
return new ReadableStream({
|
|
7919
7878
|
start: (d) => {
|
|
7920
|
-
let f =
|
|
7879
|
+
let f = aa(n), p, m;
|
|
7921
7880
|
u = (e) => {
|
|
7922
7881
|
p == null ? o.cancel().catch(() => {}) : p.cancel().catch(() => {}), m?.close(e);
|
|
7923
7882
|
};
|
|
@@ -7982,9 +7941,7 @@ function Ji({ webSocket: e, url: t, headers: n, sessionUpdate: r, language: i, w
|
|
|
7982
7941
|
case "conversation.item.input_audio_transcription.completed":
|
|
7983
7942
|
_(n.transcript ?? "", n.item_id);
|
|
7984
7943
|
break;
|
|
7985
|
-
case "error":
|
|
7986
|
-
g(Error(n.error?.message ?? "OpenAI realtime error"));
|
|
7987
|
-
break;
|
|
7944
|
+
case "error": g(Error(n.error?.message ?? "OpenAI realtime error"));
|
|
7988
7945
|
}
|
|
7989
7946
|
},
|
|
7990
7947
|
onSocketError: () => {
|
|
@@ -8000,7 +7957,7 @@ function Ji({ webSocket: e, url: t, headers: n, sessionUpdate: r, language: i, w
|
|
|
8000
7957
|
}
|
|
8001
7958
|
});
|
|
8002
7959
|
}
|
|
8003
|
-
function
|
|
7960
|
+
function ia({ modelId: e, inputAudioFormat: t, providerOptions: n }) {
|
|
8004
7961
|
return {
|
|
8005
7962
|
type: "session.update",
|
|
8006
7963
|
session: {
|
|
@@ -8021,7 +7978,7 @@ function Yi({ modelId: e, inputAudioFormat: t, providerOptions: n }) {
|
|
|
8021
7978
|
}
|
|
8022
7979
|
};
|
|
8023
7980
|
}
|
|
8024
|
-
function
|
|
7981
|
+
function aa(e) {
|
|
8025
7982
|
let t;
|
|
8026
7983
|
for (let [n, r] of Object.entries(e)) n.toLowerCase() === "authorization" && r != null && (t = r);
|
|
8027
7984
|
let n = t?.match(/^bearer\s+(.+)$/i)?.[1];
|
|
@@ -8033,7 +7990,7 @@ function Xi(e) {
|
|
|
8033
7990
|
headers: Object.fromEntries(Object.entries(e).filter(([e]) => e.toLowerCase() !== "authorization"))
|
|
8034
7991
|
};
|
|
8035
7992
|
}
|
|
8036
|
-
var
|
|
7993
|
+
var oa = J(() => n(L({}))), sa = class e {
|
|
8037
7994
|
constructor(e, t) {
|
|
8038
7995
|
this.modelId = e, this.config = t, this.specificationVersion = "v4";
|
|
8039
7996
|
}
|
|
@@ -8058,10 +8015,10 @@ var Zi = J(() => n(L({}))), Qi = class e {
|
|
|
8058
8015
|
await I({
|
|
8059
8016
|
provider: "openai",
|
|
8060
8017
|
providerOptions: e.providerOptions,
|
|
8061
|
-
schema:
|
|
8018
|
+
schema: oa
|
|
8062
8019
|
});
|
|
8063
8020
|
let n = [];
|
|
8064
|
-
|
|
8021
|
+
ua(e.inputAudioFormat), e.sourceLanguage != null && n.push({
|
|
8065
8022
|
type: "unsupported",
|
|
8066
8023
|
feature: "sourceLanguage",
|
|
8067
8024
|
details: "The OpenAI Realtime translation API auto-detects the source language and does not accept a source language."
|
|
@@ -8070,14 +8027,14 @@ var Zi = J(() => n(L({}))), Qi = class e {
|
|
|
8070
8027
|
feature: "outputAudioFormat",
|
|
8071
8028
|
details: "The OpenAI Realtime translation API always outputs 24kHz 16-bit PCM audio and does not accept an output audio format."
|
|
8072
8029
|
});
|
|
8073
|
-
let r = H(this.config.headers?.(), e.headers), i =
|
|
8030
|
+
let r = H(this.config.headers?.(), e.headers), i = la({ targetLanguage: e.targetLanguage });
|
|
8074
8031
|
return {
|
|
8075
8032
|
request: { body: i },
|
|
8076
8033
|
response: {
|
|
8077
8034
|
timestamp: t,
|
|
8078
8035
|
modelId: this.modelId
|
|
8079
8036
|
},
|
|
8080
|
-
stream:
|
|
8037
|
+
stream: ca({
|
|
8081
8038
|
webSocket: this.config.webSocket,
|
|
8082
8039
|
url: _(this.config.url({
|
|
8083
8040
|
path: `/realtime/translations?model=${encodeURIComponent(this.modelId)}`,
|
|
@@ -8093,11 +8050,11 @@ var Zi = J(() => n(L({}))), Qi = class e {
|
|
|
8093
8050
|
};
|
|
8094
8051
|
}
|
|
8095
8052
|
};
|
|
8096
|
-
function
|
|
8053
|
+
function ca({ webSocket: e, url: t, headers: n, sessionUpdate: r, warnings: i, audio: a, abortSignal: o, includeRawChunks: s }) {
|
|
8097
8054
|
let c = !1, l = () => {};
|
|
8098
8055
|
return new ReadableStream({
|
|
8099
8056
|
start: (u) => {
|
|
8100
|
-
let d =
|
|
8057
|
+
let d = da(n), f, p, m = "", g = "";
|
|
8101
8058
|
l = (e) => {
|
|
8102
8059
|
f == null ? a.cancel().catch(() => {}) : f.cancel().catch(() => {}), p?.close(e);
|
|
8103
8060
|
};
|
|
@@ -8176,12 +8133,10 @@ function $i({ webSocket: e, url: t, headers: n, sessionUpdate: r, warnings: i, a
|
|
|
8176
8133
|
case "session.closed":
|
|
8177
8134
|
v();
|
|
8178
8135
|
break;
|
|
8179
|
-
case "error":
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
});
|
|
8184
|
-
break;
|
|
8136
|
+
case "error": u.enqueue({
|
|
8137
|
+
type: "error",
|
|
8138
|
+
error: Error(n.error?.message ?? "OpenAI realtime error")
|
|
8139
|
+
});
|
|
8185
8140
|
}
|
|
8186
8141
|
},
|
|
8187
8142
|
onSocketError: () => {
|
|
@@ -8197,7 +8152,7 @@ function $i({ webSocket: e, url: t, headers: n, sessionUpdate: r, warnings: i, a
|
|
|
8197
8152
|
}
|
|
8198
8153
|
});
|
|
8199
8154
|
}
|
|
8200
|
-
function
|
|
8155
|
+
function la({ targetLanguage: e }) {
|
|
8201
8156
|
return {
|
|
8202
8157
|
type: "session.update",
|
|
8203
8158
|
session: { audio: {
|
|
@@ -8209,13 +8164,13 @@ function ea({ targetLanguage: e }) {
|
|
|
8209
8164
|
} }
|
|
8210
8165
|
};
|
|
8211
8166
|
}
|
|
8212
|
-
function
|
|
8167
|
+
function ua(e) {
|
|
8213
8168
|
if (e.type !== "audio/pcm" || e.rate != null && e.rate !== 24e3) throw new R({
|
|
8214
8169
|
argument: "inputAudioFormat",
|
|
8215
8170
|
message: "The OpenAI Realtime translation API only supports 24kHz 16-bit PCM input audio."
|
|
8216
8171
|
});
|
|
8217
8172
|
}
|
|
8218
|
-
function
|
|
8173
|
+
function da(e) {
|
|
8219
8174
|
let t;
|
|
8220
8175
|
for (let [n, r] of Object.entries(e)) n.toLowerCase() === "authorization" && r != null && (t = r);
|
|
8221
8176
|
let n = t?.match(/^bearer\s+(.+)$/i)?.[1];
|
|
@@ -8227,7 +8182,7 @@ function na(e) {
|
|
|
8227
8182
|
headers: Object.fromEntries(Object.entries(e).filter(([e]) => e.toLowerCase() !== "authorization"))
|
|
8228
8183
|
};
|
|
8229
8184
|
}
|
|
8230
|
-
var
|
|
8185
|
+
var fa = J(() => n(L({
|
|
8231
8186
|
id: q(),
|
|
8232
8187
|
name: q().nullish(),
|
|
8233
8188
|
description: q().nullish(),
|
|
@@ -8242,7 +8197,7 @@ J(() => n(L({
|
|
|
8242
8197
|
name: q().nullish(),
|
|
8243
8198
|
description: q().nullish()
|
|
8244
8199
|
})));
|
|
8245
|
-
var
|
|
8200
|
+
var pa = class {
|
|
8246
8201
|
constructor(e) {
|
|
8247
8202
|
this.config = e, this.specificationVersion = "v4";
|
|
8248
8203
|
}
|
|
@@ -8265,7 +8220,7 @@ var ia = class {
|
|
|
8265
8220
|
headers: H(this.config.headers()),
|
|
8266
8221
|
formData: n,
|
|
8267
8222
|
failedResponseHandler: Z,
|
|
8268
|
-
successfulResponseHandler: i(
|
|
8223
|
+
successfulResponseHandler: i(fa),
|
|
8269
8224
|
fetch: this.config.fetch
|
|
8270
8225
|
});
|
|
8271
8226
|
return {
|
|
@@ -8281,8 +8236,8 @@ var ia = class {
|
|
|
8281
8236
|
warnings: t
|
|
8282
8237
|
};
|
|
8283
8238
|
}
|
|
8284
|
-
},
|
|
8285
|
-
function
|
|
8239
|
+
}, ma = "4.0.81";
|
|
8240
|
+
function ha(e = {}) {
|
|
8286
8241
|
let t = Oe(s(re({
|
|
8287
8242
|
settingValue: e.baseURL,
|
|
8288
8243
|
environmentVariableName: "OPENAI_BASE_URL"
|
|
@@ -8295,7 +8250,7 @@ function oa(e = {}) {
|
|
|
8295
8250
|
"OpenAI-Organization": e.organization,
|
|
8296
8251
|
"OpenAI-Project": e.project,
|
|
8297
8252
|
...e.headers
|
|
8298
|
-
}, `ai-sdk-openai/${
|
|
8253
|
+
}, `ai-sdk-openai/${ma}`), i = (i) => new at(i, {
|
|
8299
8254
|
provider: `${n}.chat`,
|
|
8300
8255
|
url: ({ path: e }) => `${t}${e}`,
|
|
8301
8256
|
headers: r,
|
|
@@ -8315,19 +8270,19 @@ function oa(e = {}) {
|
|
|
8315
8270
|
url: ({ path: e }) => `${t}${e}`,
|
|
8316
8271
|
headers: r,
|
|
8317
8272
|
fetch: e.fetch
|
|
8318
|
-
}), l = (i) => new
|
|
8273
|
+
}), l = (i) => new na(i, {
|
|
8319
8274
|
provider: `${n}.transcription`,
|
|
8320
8275
|
url: ({ path: e }) => `${t}${e}`,
|
|
8321
8276
|
headers: r,
|
|
8322
8277
|
fetch: e.fetch,
|
|
8323
8278
|
webSocket: e.webSocket
|
|
8324
|
-
}), u = (i) => new
|
|
8279
|
+
}), u = (i) => new sa(i, {
|
|
8325
8280
|
provider: `${n}.speech-translation`,
|
|
8326
8281
|
url: ({ path: e }) => `${t}${e}`,
|
|
8327
8282
|
headers: r,
|
|
8328
8283
|
fetch: e.fetch,
|
|
8329
8284
|
webSocket: e.webSocket
|
|
8330
|
-
}), d = (i) => new
|
|
8285
|
+
}), d = (i) => new Zi(i, {
|
|
8331
8286
|
provider: `${n}.speech`,
|
|
8332
8287
|
url: ({ path: e }) => `${t}${e}`,
|
|
8333
8288
|
headers: r,
|
|
@@ -8337,7 +8292,7 @@ function oa(e = {}) {
|
|
|
8337
8292
|
baseURL: t,
|
|
8338
8293
|
headers: r,
|
|
8339
8294
|
fetch: e.fetch
|
|
8340
|
-
}), p = () => new
|
|
8295
|
+
}), p = () => new pa({
|
|
8341
8296
|
provider: `${n}.skills`,
|
|
8342
8297
|
url: ({ path: e }) => `${t}${e}`,
|
|
8343
8298
|
headers: r,
|
|
@@ -8345,14 +8300,14 @@ function oa(e = {}) {
|
|
|
8345
8300
|
}), m = (e) => {
|
|
8346
8301
|
if (new.target) throw Error("The OpenAI model function cannot be called with the new keyword.");
|
|
8347
8302
|
return h(e);
|
|
8348
|
-
}, h = (i) => new
|
|
8303
|
+
}, h = (i) => new Rr(i, {
|
|
8349
8304
|
provider: `${n}.responses`,
|
|
8350
8305
|
baseURL: t,
|
|
8351
8306
|
url: ({ path: e }) => `${t}${e}`,
|
|
8352
8307
|
headers: r,
|
|
8353
8308
|
fetch: e.fetch,
|
|
8354
8309
|
fileIdPrefixes: ["file-"]
|
|
8355
|
-
}), g = () => new
|
|
8310
|
+
}), g = () => new hi({
|
|
8356
8311
|
provider: `${n}.batch`,
|
|
8357
8312
|
config: {
|
|
8358
8313
|
provider: `${n}.responses`,
|
|
@@ -8368,13 +8323,12 @@ function oa(e = {}) {
|
|
|
8368
8323
|
return _.specificationVersion = "v4", _.languageModel = m, _.chat = i, _.completion = a, _.responses = h, _.evaluationModel = (e) => new Ae({
|
|
8369
8324
|
model: h(e),
|
|
8370
8325
|
provider: `${n}.evaluation`
|
|
8371
|
-
}), _.embedding = o, _.embeddingModel = o, _.textEmbedding = o, _.textEmbeddingModel = o, _.image = c, _.imageModel = c, _.transcription = l, _.transcriptionModel = l, _.translation = u, _.speechTranslationModel = u, _.speech = d, _.speechModel = d, _.files = f, _.skills = p, _.experimental_batch = g, _.experimental_realtime =
|
|
8326
|
+
}), _.embedding = o, _.embeddingModel = o, _.textEmbedding = o, _.textEmbeddingModel = o, _.image = c, _.imageModel = c, _.transcription = l, _.transcriptionModel = l, _.translation = u, _.speechTranslationModel = u, _.speech = d, _.speechModel = d, _.files = f, _.skills = p, _.experimental_batch = g, _.experimental_realtime = Yi({
|
|
8372
8327
|
provider: n,
|
|
8373
8328
|
baseURL: t,
|
|
8374
8329
|
headers: r,
|
|
8375
8330
|
fetch: e.fetch
|
|
8376
|
-
}), _.tools =
|
|
8331
|
+
}), _.tools = Vn, _;
|
|
8377
8332
|
}
|
|
8378
|
-
|
|
8379
|
-
|
|
8380
|
-
export { oa as createOpenAI };
|
|
8333
|
+
ha();
|
|
8334
|
+
export { ha as createOpenAI };
|