@hintergrund/ui 0.3.10 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -55
- package/dist/BuilderAgentPane-BEPxOdtX.js +1 -0
- package/dist/IntegrationHealth-DlJvUzAy.js +1 -0
- package/dist/Mail-CO8ofiRH.js +1 -0
- package/dist/admin.js +2 -23351
- package/dist/anthropic-messages-55IP99zJ.js +2 -0
- package/dist/builder.js +1 -28
- package/dist/config.types-D99vLLC0.js +1 -0
- package/dist/error-body-B13t5xBI.js +1 -0
- package/dist/github-copilot-headers-EfqOaQ0F.js +1 -0
- package/dist/global-CGDFyqFU.js +2 -0
- package/dist/google-generative-ai-CpvpostP.js +1 -0
- package/dist/invoice-pdf-BT1piHr5.js +5 -0
- package/dist/login.js +1 -133
- package/dist/mail.js +1 -698
- package/dist/node.browser-BA-G-7jw.js +1 -0
- package/dist/node.browser-DFm1vJzK.js +1 -0
- package/dist/openai-completions-BomoAgqc.js +1 -0
- package/dist/openai-decisions-D-Vz80po.js +1 -0
- package/dist/openai-prompt-cache-C4mUbgCW.js +1 -0
- package/dist/openai-responses-DmFfjUOu.js +1 -0
- package/dist/provider-retry-DNH2SSUZ.js +1 -0
- package/dist/rolldown-runtime-9urLBz53.js +1 -0
- package/dist/setup.js +1 -402
- package/dist/transform-messages-DBJvNMd6.js +1 -0
- package/package.json +7 -5
- package/dist/BuilderAgentPane-B6zkx8zw.js +0 -23164
- package/dist/IntegrationHealth-2p7QXJqB.js +0 -218
- package/dist/anthropic-messages-k-Bsbioz.js +0 -3772
- package/dist/azure-openai-responses-DZenJI-m.js +0 -168
- package/dist/config.types-DZ5yfeqq.js +0 -20
- package/dist/deferred-tools-nxpq94I4.js +0 -34
- package/dist/diagnostics-x5QOwca_.js +0 -91
- package/dist/error-body-pXgvw5vV.js +0 -68
- package/dist/font-pool/LICENSES.txt +0 -22
- package/dist/font-pool/inter.ttf +0 -0
- package/dist/font-pool/inter.woff2 +0 -0
- package/dist/font-pool/jetbrains-mono.ttf +0 -0
- package/dist/font-pool/jetbrains-mono.woff2 +0 -0
- package/dist/font-pool/lora.ttf +0 -0
- package/dist/font-pool/lora.woff2 +0 -0
- package/dist/font-pool/merriweather.ttf +0 -0
- package/dist/font-pool/merriweather.woff2 +0 -0
- package/dist/font-pool/montserrat.ttf +0 -0
- package/dist/font-pool/montserrat.woff2 +0 -0
- package/dist/font-pool/playfair-display.ttf +0 -0
- package/dist/font-pool/playfair-display.woff2 +0 -0
- package/dist/font-pool/poppins.ttf +0 -0
- package/dist/font-pool/poppins.woff2 +0 -0
- package/dist/font-pool/roboto.ttf +0 -0
- package/dist/font-pool/roboto.woff2 +0 -0
- package/dist/font-pool/space-grotesk.ttf +0 -0
- package/dist/font-pool/space-grotesk.woff2 +0 -0
- package/dist/font-pool/work-sans.ttf +0 -0
- package/dist/font-pool/work-sans.woff2 +0 -0
- package/dist/github-copilot-headers-pRo3v4t7.js +0 -27
- package/dist/global-DMXVTUMq.js +0 -33351
- package/dist/google-generative-ai-D2RQTVlL.js +0 -291
- package/dist/google-shared-CG2Lbh1z.js +0 -8746
- package/dist/google-vertex-BjniYIZ1.js +0 -329
- package/dist/hash-BixfZjoG.js +0 -21
- package/dist/headers-CnTiKpOL.js +0 -24
- package/dist/json-parse-CxjAnWaM.js +0 -231
- package/dist/legacy-C2ziK2Om.js +0 -14
- package/dist/mistral-conversations-CPZ7CuMx.js +0 -558
- package/dist/openai-ClxLHXsh.js +0 -5371
- package/dist/openai-codex-responses-CqmMU3UY.js +0 -909
- package/dist/openai-completions-Dc8OEKqJ.js +0 -730
- package/dist/openai-prompt-cache-Bm8Re6Vv.js +0 -17
- package/dist/openai-responses-DZ1U8uxZ.js +0 -192
- package/dist/openai-responses-shared-B0rkV1lD.js +0 -481
- package/dist/pi-messages-CRx0yqMp.js +0 -268
- package/dist/pi-user-agent-CsXkkH60.js +0 -20
- package/dist/provider-env-Cj6X7Wly.js +0 -35
- package/dist/provider-retry-BGImU1PV.js +0 -68
- package/dist/rolldown-runtime-nTTD767F.js +0 -37
- package/dist/transform-messages-DvxSeyBQ.js +0 -383
|
@@ -1,730 +0,0 @@
|
|
|
1
|
-
globalThis.process === void 0 && (globalThis.process = {
|
|
2
|
-
env: {},
|
|
3
|
-
platform: "browser",
|
|
4
|
-
version: "",
|
|
5
|
-
versions: {},
|
|
6
|
-
browser: !0,
|
|
7
|
-
nextTick: function(e) {
|
|
8
|
-
return Promise.resolve().then(e);
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
import { m as e, p as t } from "./BuilderAgentPane-B6zkx8zw.js";
|
|
12
|
-
import { i as n } from "./diagnostics-x5QOwca_.js";
|
|
13
|
-
import { n as r } from "./json-parse-CxjAnWaM.js";
|
|
14
|
-
import { t as i } from "./provider-env-Cj6X7Wly.js";
|
|
15
|
-
import { t as a } from "./headers-CnTiKpOL.js";
|
|
16
|
-
import { t as o } from "./provider-retry-BGImU1PV.js";
|
|
17
|
-
import { c as s, d as c, f as l, i as u, l as d, n as f, o as p, p as m, s as h, t as g, u as _ } from "./transform-messages-DvxSeyBQ.js";
|
|
18
|
-
import { n as v, t as y } from "./github-copilot-headers-pRo3v4t7.js";
|
|
19
|
-
import { n as b } from "./openai-ClxLHXsh.js";
|
|
20
|
-
import { n as x, t as S } from "./error-body-pXgvw5vV.js";
|
|
21
|
-
import { t as C } from "./openai-prompt-cache-Bm8Re6Vv.js";
|
|
22
|
-
import { t as w } from "./hash-BixfZjoG.js";
|
|
23
|
-
//#region ../../../../node_modules/.pnpm/@earendil-works+pi-ai@0.84.2_supports-color@10.2.2_ws@8.21.3_zod@4.4.3/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js
|
|
24
|
-
function T(e, t) {
|
|
25
|
-
if (!e) return !1;
|
|
26
|
-
let n = t.toLowerCase();
|
|
27
|
-
for (let [t, r] of Object.entries(e)) if (t.toLowerCase() === n && r !== null && r.trim().length > 0) return !0;
|
|
28
|
-
return !1;
|
|
29
|
-
}
|
|
30
|
-
function E(e, t, n) {
|
|
31
|
-
if (t) return t;
|
|
32
|
-
if (T(n, "authorization") || T(n, "cf-aig-authorization")) return "unused";
|
|
33
|
-
throw Error(`No API key for provider: ${e}`);
|
|
34
|
-
}
|
|
35
|
-
function D(e) {
|
|
36
|
-
for (let t of e) if (t.role === "toolResult" || t.role === "assistant" && t.content.some((e) => e.type === "toolCall")) return !0;
|
|
37
|
-
return !1;
|
|
38
|
-
}
|
|
39
|
-
function O(e) {
|
|
40
|
-
let t = /* @__PURE__ */ new Set();
|
|
41
|
-
for (let n of e) if (n.role === "toolResult") for (let e of n.addedToolNames ?? []) t.add(e);
|
|
42
|
-
return t;
|
|
43
|
-
}
|
|
44
|
-
function k(e, t) {
|
|
45
|
-
if (!e) return [];
|
|
46
|
-
let n = new Map(e.map((e) => [e.name, e]));
|
|
47
|
-
return Array.from(t).map((e) => n.get(e)).filter((e) => e !== void 0);
|
|
48
|
-
}
|
|
49
|
-
function A(e) {
|
|
50
|
-
return e.type === "text";
|
|
51
|
-
}
|
|
52
|
-
function j(e) {
|
|
53
|
-
return e.type === "thinking";
|
|
54
|
-
}
|
|
55
|
-
function M(e) {
|
|
56
|
-
return e.type === "toolCall";
|
|
57
|
-
}
|
|
58
|
-
function N(e) {
|
|
59
|
-
return e.type === "image";
|
|
60
|
-
}
|
|
61
|
-
function P(e) {
|
|
62
|
-
if (typeof e != "object" || !e) return !1;
|
|
63
|
-
let t = e;
|
|
64
|
-
return t.type === "reasoning.encrypted" && typeof t.id == "string" && t.id.length > 0 && typeof t.data == "string" && t.data.length > 0;
|
|
65
|
-
}
|
|
66
|
-
function F(e, t) {
|
|
67
|
-
return e || (i("PI_CACHE_RETENTION", t) === "long" ? "long" : "short");
|
|
68
|
-
}
|
|
69
|
-
var I = (e, t, i) => {
|
|
70
|
-
let c = new n();
|
|
71
|
-
return (async () => {
|
|
72
|
-
let n = {
|
|
73
|
-
role: "assistant",
|
|
74
|
-
content: [],
|
|
75
|
-
api: e.api,
|
|
76
|
-
provider: e.provider,
|
|
77
|
-
model: e.id,
|
|
78
|
-
usage: {
|
|
79
|
-
input: 0,
|
|
80
|
-
output: 0,
|
|
81
|
-
cacheRead: 0,
|
|
82
|
-
cacheWrite: 0,
|
|
83
|
-
totalTokens: 0,
|
|
84
|
-
cost: {
|
|
85
|
-
input: 0,
|
|
86
|
-
output: 0,
|
|
87
|
-
cacheRead: 0,
|
|
88
|
-
cacheWrite: 0,
|
|
89
|
-
total: 0
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
stopReason: "pending",
|
|
93
|
-
timestamp: Date.now()
|
|
94
|
-
};
|
|
95
|
-
try {
|
|
96
|
-
let l = E(e.provider, i?.apiKey, i?.headers), u = $(e), d = s(t.tools, u.supportsOpenAIGrammarTools), f = F(i?.cacheRetention, i?.env), p = f === "none" ? void 0 : i?.sessionId, m = R(e, t, l, i?.headers, i?.fetch, p, u), g = z(e, t, i, u, f, d), _ = await i?.onPayload?.(g, e);
|
|
97
|
-
_ !== void 0 && (g = _);
|
|
98
|
-
let v = {
|
|
99
|
-
...i?.signal ? { signal: i.signal } : {},
|
|
100
|
-
...i?.timeoutMs === void 0 ? {} : { timeout: i.timeoutMs },
|
|
101
|
-
maxRetries: 0
|
|
102
|
-
}, { data: y, response: b } = await o(() => m.chat.completions.create(g, v).withResponse(), {
|
|
103
|
-
maxRetries: i?.maxRetries,
|
|
104
|
-
maxRetryDelayMs: i?.maxRetryDelayMs,
|
|
105
|
-
signal: i?.signal
|
|
106
|
-
});
|
|
107
|
-
await i?.onResponse?.({
|
|
108
|
-
status: b.status,
|
|
109
|
-
headers: a(b.headers)
|
|
110
|
-
}, e), c.push({
|
|
111
|
-
type: "start",
|
|
112
|
-
partial: n
|
|
113
|
-
});
|
|
114
|
-
let x = null, S = null, C = !1, w = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), O = n.content, k = (e) => O.indexOf(e), A = (e) => {
|
|
115
|
-
let t = e.customInput?.property;
|
|
116
|
-
if (t === void 0) return "";
|
|
117
|
-
let n = e.arguments[t];
|
|
118
|
-
return typeof n == "string" ? n : "";
|
|
119
|
-
}, j = (e, t, n) => {
|
|
120
|
-
let r = e.customInput;
|
|
121
|
-
if (!r) return;
|
|
122
|
-
let i = h(r.jsonBuffer, r.property, t, n);
|
|
123
|
-
return e.arguments = { [r.property]: t }, i;
|
|
124
|
-
}, M = (e) => {
|
|
125
|
-
let t = k(e);
|
|
126
|
-
if (t !== -1) {
|
|
127
|
-
if (e.type === "text") c.push({
|
|
128
|
-
type: "text_end",
|
|
129
|
-
contentIndex: t,
|
|
130
|
-
content: e.text,
|
|
131
|
-
partial: n
|
|
132
|
-
});
|
|
133
|
-
else if (e.type === "thinking") c.push({
|
|
134
|
-
type: "thinking_end",
|
|
135
|
-
contentIndex: t,
|
|
136
|
-
content: e.thinking,
|
|
137
|
-
partial: n
|
|
138
|
-
});
|
|
139
|
-
else if (e.type === "toolCall") {
|
|
140
|
-
if (e.customInput) {
|
|
141
|
-
let r = j(e, A(e), !0);
|
|
142
|
-
r !== void 0 && c.push({
|
|
143
|
-
type: "toolcall_delta",
|
|
144
|
-
contentIndex: t,
|
|
145
|
-
delta: r,
|
|
146
|
-
partial: n
|
|
147
|
-
});
|
|
148
|
-
} else e.arguments = r(e.partialArgs);
|
|
149
|
-
delete e.partialArgs, delete e.customInput, delete e.streamIndex, c.push({
|
|
150
|
-
type: "toolcall_end",
|
|
151
|
-
contentIndex: t,
|
|
152
|
-
toolCall: e,
|
|
153
|
-
partial: n
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}, N = () => (x || (x = {
|
|
158
|
-
type: "text",
|
|
159
|
-
text: ""
|
|
160
|
-
}, O.push(x), c.push({
|
|
161
|
-
type: "text_start",
|
|
162
|
-
contentIndex: k(x),
|
|
163
|
-
partial: n
|
|
164
|
-
})), x), I = (e) => (S || (S = {
|
|
165
|
-
type: "thinking",
|
|
166
|
-
thinking: "",
|
|
167
|
-
thinkingSignature: e
|
|
168
|
-
}, O.push(S), c.push({
|
|
169
|
-
type: "thinking_start",
|
|
170
|
-
contentIndex: k(S),
|
|
171
|
-
partial: n
|
|
172
|
-
})), S), L = (e) => {
|
|
173
|
-
if (!e.id) return;
|
|
174
|
-
let t = D.get(e.id);
|
|
175
|
-
t && (e.thoughtSignature = t, D.delete(e.id));
|
|
176
|
-
}, B = (e) => {
|
|
177
|
-
let t = typeof e.index == "number" ? e.index : void 0, r = e.function?.name ?? e.custom?.name ?? "", i = t === void 0 ? void 0 : w.get(t);
|
|
178
|
-
if (!i && e.id && (i = T.get(e.id)), !i) {
|
|
179
|
-
let a = e.custom && !e.function ? d.get(r) ?? "input" : void 0, o = a !== void 0;
|
|
180
|
-
i = {
|
|
181
|
-
type: "toolCall",
|
|
182
|
-
id: e.id || "",
|
|
183
|
-
name: r,
|
|
184
|
-
arguments: o ? { [a]: "" } : {},
|
|
185
|
-
partialArgs: o ? void 0 : "",
|
|
186
|
-
customInput: o ? {
|
|
187
|
-
property: a,
|
|
188
|
-
jsonBuffer: {
|
|
189
|
-
input: "",
|
|
190
|
-
started: !1,
|
|
191
|
-
closed: !1
|
|
192
|
-
}
|
|
193
|
-
} : void 0,
|
|
194
|
-
streamIndex: t
|
|
195
|
-
}, t !== void 0 && w.set(t, i), e.id && T.set(e.id, i), O.push(i), c.push({
|
|
196
|
-
type: "toolcall_start",
|
|
197
|
-
contentIndex: k(i),
|
|
198
|
-
partial: n
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
if (t !== void 0 && i.streamIndex === void 0 && (i.streamIndex = t, w.set(t, i)), e.id && T.set(e.id, i), !i.name && r && (i.name = r), e.custom && !e.function && !i.customInput) {
|
|
202
|
-
let e = d.get(i.name) ?? "input";
|
|
203
|
-
i.arguments = { [e]: "" }, i.customInput = {
|
|
204
|
-
property: e,
|
|
205
|
-
jsonBuffer: {
|
|
206
|
-
input: "",
|
|
207
|
-
started: !1,
|
|
208
|
-
closed: !1
|
|
209
|
-
}
|
|
210
|
-
}, delete i.partialArgs;
|
|
211
|
-
}
|
|
212
|
-
return L(i), i;
|
|
213
|
-
};
|
|
214
|
-
for await (let t of y) {
|
|
215
|
-
if (!t || typeof t != "object") continue;
|
|
216
|
-
n.responseId ||= t.id, typeof t.model == "string" && t.model.length > 0 && t.model !== e.id && (n.responseModel ||= t.model), t.usage && (n.usage = Q(t.usage, e));
|
|
217
|
-
let i = Array.isArray(t.choices) ? t.choices[0] : void 0;
|
|
218
|
-
if (i) {
|
|
219
|
-
if (!t.usage && i.usage && (n.usage = Q(i.usage, e)), i.finish_reason) {
|
|
220
|
-
n.rawStopReason = i.finish_reason;
|
|
221
|
-
let e = ee(i.finish_reason);
|
|
222
|
-
n.stopReason = e.stopReason, e.errorMessage && (n.errorMessage = e.errorMessage), C = !0;
|
|
223
|
-
}
|
|
224
|
-
if (i.delta) {
|
|
225
|
-
if (i.delta.content !== null && i.delta.content !== void 0 && i.delta.content.length > 0) {
|
|
226
|
-
let e = N();
|
|
227
|
-
e.text += i.delta.content, c.push({
|
|
228
|
-
type: "text_delta",
|
|
229
|
-
contentIndex: k(e),
|
|
230
|
-
delta: i.delta.content,
|
|
231
|
-
partial: n
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
let t = [
|
|
235
|
-
"reasoning_content",
|
|
236
|
-
"reasoning",
|
|
237
|
-
"reasoning_text"
|
|
238
|
-
], a = i.delta, o = null;
|
|
239
|
-
for (let e of t) {
|
|
240
|
-
let t = a[e];
|
|
241
|
-
if (typeof t == "string" && t.length > 0) {
|
|
242
|
-
o = e;
|
|
243
|
-
break;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
if (o) {
|
|
247
|
-
let t = a[o];
|
|
248
|
-
if (typeof t == "string" && t.length > 0) {
|
|
249
|
-
let r = I(e.provider === "opencode-go" && o === "reasoning" ? "reasoning_content" : o);
|
|
250
|
-
r.thinking += t, c.push({
|
|
251
|
-
type: "thinking_delta",
|
|
252
|
-
contentIndex: k(r),
|
|
253
|
-
delta: t,
|
|
254
|
-
partial: n
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
if (i?.delta?.tool_calls) for (let e of i.delta.tool_calls) {
|
|
259
|
-
let t = B(e);
|
|
260
|
-
!t.id && e.id && (t.id = e.id, T.set(e.id, t));
|
|
261
|
-
let i = e.function?.name ?? e.custom?.name;
|
|
262
|
-
!t.name && i && (t.name = i);
|
|
263
|
-
let a = "";
|
|
264
|
-
e.function?.arguments ? (a = e.function.arguments, t.partialArgs = (t.partialArgs ?? "") + e.function.arguments, t.arguments = r(t.partialArgs)) : e.custom?.input && (a = j(t, A(t) + e.custom.input, !1) ?? ""), c.push({
|
|
265
|
-
type: "toolcall_delta",
|
|
266
|
-
contentIndex: k(t),
|
|
267
|
-
delta: a,
|
|
268
|
-
partial: n
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
let s = i.delta.reasoning_details;
|
|
272
|
-
if (Array.isArray(s)) {
|
|
273
|
-
for (let e of s) if (P(e)) {
|
|
274
|
-
let t = JSON.stringify(e), n = T.get(e.id);
|
|
275
|
-
n ? n.thoughtSignature = t : D.set(e.id, t);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
for (let e of O) M(e);
|
|
282
|
-
if (i?.signal?.aborted || n.stopReason === "aborted") throw Error("Request was aborted");
|
|
283
|
-
if (!C && !u.supportsFinishReason && (n.stopReason = n.content.some((e) => e.type === "toolCall") ? "toolUse" : "stop"), n.stopReason === "error") throw Error(n.errorMessage || "Provider returned an error stop reason");
|
|
284
|
-
if (u.supportsFinishReason && !C || n.stopReason === "pending") throw Error("Stream ended without finish_reason");
|
|
285
|
-
c.push({
|
|
286
|
-
type: "done",
|
|
287
|
-
reason: n.stopReason,
|
|
288
|
-
message: n
|
|
289
|
-
}), c.end();
|
|
290
|
-
} catch (e) {
|
|
291
|
-
for (let e of n.content) delete e.index, delete e.partialArgs, delete e.customInput, delete e.streamIndex;
|
|
292
|
-
n.stopReason = i?.signal?.aborted ? "aborted" : "error", n.errorMessage = S(x(e));
|
|
293
|
-
let t = e?.error?.metadata?.raw;
|
|
294
|
-
t && !n.errorMessage.includes(String(t)) && (n.errorMessage += `\n${t}`), c.push({
|
|
295
|
-
type: "error",
|
|
296
|
-
reason: n.stopReason,
|
|
297
|
-
error: n
|
|
298
|
-
}), c.end();
|
|
299
|
-
}
|
|
300
|
-
})(), c;
|
|
301
|
-
}, L = (t, n, r) => {
|
|
302
|
-
E(t.provider, r?.apiKey, r?.headers);
|
|
303
|
-
let i = u(t, n, r, r?.apiKey), a = r?.reasoning ? e(t, r.reasoning) : void 0, o = a === "off" ? void 0 : a, s = r?.toolChoice;
|
|
304
|
-
return I(t, n, {
|
|
305
|
-
...i,
|
|
306
|
-
reasoningEffort: o,
|
|
307
|
-
toolChoice: s,
|
|
308
|
-
thinkingBudgets: r?.thinkingBudgets
|
|
309
|
-
});
|
|
310
|
-
};
|
|
311
|
-
function R(e, t, n, r, i, a, o = $(e)) {
|
|
312
|
-
let s = { ...e.headers };
|
|
313
|
-
if (e.provider === "github-copilot") {
|
|
314
|
-
let e = v(t.messages), n = y({
|
|
315
|
-
messages: t.messages,
|
|
316
|
-
hasImages: e
|
|
317
|
-
});
|
|
318
|
-
Object.assign(s, n);
|
|
319
|
-
}
|
|
320
|
-
return a && o.sendSessionAffinityHeaders && (o.sessionAffinityFormat === "openrouter" ? s["x-session-id"] = a : (o.sessionAffinityFormat === "openai" && (s.session_id = a), s["x-client-request-id"] = a, s["x-session-affinity"] = a)), r && Object.assign(s, r), new b({
|
|
321
|
-
apiKey: n,
|
|
322
|
-
baseURL: e.baseUrl,
|
|
323
|
-
dangerouslyAllowBrowser: !0,
|
|
324
|
-
fetch: i,
|
|
325
|
-
defaultHeaders: s
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
function z(e, t, n, r = $(e), i = F(n?.cacheRetention, n?.env), a = s(t.tools, r.supportsOpenAIGrammarTools)) {
|
|
329
|
-
let o = X(e, t, r, { grammarToolInputProperties: a }), c = H(r, i), l = {
|
|
330
|
-
model: e.id,
|
|
331
|
-
messages: o,
|
|
332
|
-
stream: !0,
|
|
333
|
-
prompt_cache_key: e.baseUrl.includes("api.openai.com") && i !== "none" || i === "long" && r.supportsLongCacheRetention ? C(n?.sessionId) : void 0,
|
|
334
|
-
prompt_cache_retention: i === "long" && r.supportsLongCacheRetention ? "24h" : void 0
|
|
335
|
-
};
|
|
336
|
-
r.supportsUsageInStreaming !== !1 && (l.stream_options = { include_usage: !0 }), r.supportsStore && (l.store = !1), n?.maxTokens && (r.maxTokensField === "max_tokens" ? l.max_tokens = n.maxTokens : l.max_completion_tokens = n.maxTokens), n?.temperature !== void 0 && (l.temperature = n.temperature);
|
|
337
|
-
let u = r.deferredToolsMode === "kimi" ? O(t.messages) : /* @__PURE__ */ new Set(), d = t.tools?.filter((e) => !u.has(e.name));
|
|
338
|
-
if (d && d.length > 0 ? (l.tools = Z(d, r), r.zaiToolStream && (l.tool_stream = !0)) : D(t.messages) && (l.tools = []), c && U(o, l.tools, c), n?.toolChoice && (l.tool_choice = n.toolChoice), r.thinkingFormat === "zai" && e.reasoning) {
|
|
339
|
-
let t = l;
|
|
340
|
-
if (t.thinking = n?.reasoningEffort ? {
|
|
341
|
-
type: "enabled",
|
|
342
|
-
clear_thinking: !1
|
|
343
|
-
} : { type: "disabled" }, n?.reasoningEffort && r.supportsReasoningEffort) {
|
|
344
|
-
let r = e.thinkingLevelMap?.[n.reasoningEffort], i = r === void 0 ? n.reasoningEffort : r;
|
|
345
|
-
typeof i == "string" && (t.reasoning_effort = i);
|
|
346
|
-
}
|
|
347
|
-
} else if (r.thinkingFormat === "qwen" && e.reasoning) {
|
|
348
|
-
if (l.enable_thinking = !!n?.reasoningEffort, n?.reasoningEffort && r.supportsReasoningEffort) {
|
|
349
|
-
let t = e.thinkingLevelMap?.[n.reasoningEffort] ?? n.reasoningEffort;
|
|
350
|
-
typeof t == "string" && (l.reasoning_effort = t);
|
|
351
|
-
}
|
|
352
|
-
} else if (r.thinkingFormat === "qwen-chat-template" && e.reasoning) l.chat_template_kwargs = {
|
|
353
|
-
enable_thinking: !!n?.reasoningEffort,
|
|
354
|
-
preserve_thinking: !0
|
|
355
|
-
};
|
|
356
|
-
else if (r.thinkingFormat === "chat-template" && e.reasoning) {
|
|
357
|
-
let t = B(e, n, r.chatTemplateKwargs);
|
|
358
|
-
t && (l.chat_template_kwargs = t);
|
|
359
|
-
} else if (r.thinkingFormat === "baseten" && e.reasoning) {
|
|
360
|
-
let t = l, i = B(e, n, r.chatTemplateArgs);
|
|
361
|
-
if (i && (t.chat_template_args = i), r.supportsReasoningEffort) {
|
|
362
|
-
let r = n?.reasoningEffort, i = r ? e.thinkingLevelMap?.[r] : e.thinkingLevelMap?.off, a = i === void 0 ? r : i;
|
|
363
|
-
typeof a == "string" && (t.reasoning_effort = a);
|
|
364
|
-
}
|
|
365
|
-
} else if (r.thinkingFormat === "deepseek" && e.reasoning) n?.reasoningEffort ? l.thinking = { type: "enabled" } : e.thinkingLevelMap?.off !== null && (l.thinking = { type: "disabled" }), n?.reasoningEffort && r.supportsReasoningEffort && (l.reasoning_effort = e.thinkingLevelMap?.[n.reasoningEffort] ?? n.reasoningEffort);
|
|
366
|
-
else if (r.thinkingFormat === "openrouter" && e.reasoning) {
|
|
367
|
-
let t = l;
|
|
368
|
-
n?.reasoningEffort ? t.reasoning = { effort: e.thinkingLevelMap?.[n.reasoningEffort] ?? n.reasoningEffort } : e.thinkingLevelMap?.off !== null && (t.reasoning = { effort: e.thinkingLevelMap?.off ?? "none" });
|
|
369
|
-
} else if (r.thinkingFormat === "ant-ling" && e.reasoning && n?.reasoningEffort) {
|
|
370
|
-
let t = e.thinkingLevelMap?.[n.reasoningEffort];
|
|
371
|
-
typeof t == "string" && (l.reasoning = { effort: t });
|
|
372
|
-
} else if (r.thinkingFormat === "together" && e.reasoning) {
|
|
373
|
-
let t = l;
|
|
374
|
-
t.reasoning = { enabled: !!n?.reasoningEffort }, n?.reasoningEffort && r.supportsReasoningEffort && (t.reasoning_effort = e.thinkingLevelMap?.[n.reasoningEffort] ?? n.reasoningEffort);
|
|
375
|
-
} else if (r.thinkingFormat === "string-thinking" && e.reasoning) {
|
|
376
|
-
let t = l;
|
|
377
|
-
n?.reasoningEffort ? t.thinking = e.thinkingLevelMap?.[n.reasoningEffort] ?? n.reasoningEffort : e.thinkingLevelMap?.off !== null && (t.thinking = e.thinkingLevelMap?.off ?? "none");
|
|
378
|
-
} else if (n?.reasoningEffort && e.reasoning && r.supportsReasoningEffort) l.reasoning_effort = e.thinkingLevelMap?.[n.reasoningEffort] ?? n.reasoningEffort;
|
|
379
|
-
else if (!n?.reasoningEffort && e.reasoning && r.supportsReasoningEffort) {
|
|
380
|
-
let t = e.thinkingLevelMap?.off;
|
|
381
|
-
typeof t == "string" && (l.reasoning_effort = t);
|
|
382
|
-
}
|
|
383
|
-
if (r.supportsThinkingTokenBudget && n?.reasoningEffort && e.reasoning) {
|
|
384
|
-
let t = p(n.reasoningEffort), r = {
|
|
385
|
-
minimal: 1024,
|
|
386
|
-
low: 2048,
|
|
387
|
-
medium: 8192,
|
|
388
|
-
high: 16384,
|
|
389
|
-
...n.thinkingBudgets
|
|
390
|
-
}, i = l.max_tokens ?? l.max_completion_tokens ?? e.maxTokens, a = Math.min(r[t], Math.max(0, i - f));
|
|
391
|
-
a > 0 && (l.thinking_token_budget = a);
|
|
392
|
-
}
|
|
393
|
-
if (e.compat?.openRouterRouting && (l.provider = e.compat.openRouterRouting), e.compat?.vercelGatewayRouting) {
|
|
394
|
-
let t = e.compat.vercelGatewayRouting;
|
|
395
|
-
if (t.only || t.order) {
|
|
396
|
-
let e = {};
|
|
397
|
-
t.only && (e.only = t.only), t.order && (e.order = t.order), l.providerOptions = { gateway: e };
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
return n?.samplingParams && Object.assign(l, n.samplingParams), l;
|
|
401
|
-
}
|
|
402
|
-
function B(e, t, n) {
|
|
403
|
-
let r = {};
|
|
404
|
-
for (let [i, a] of Object.entries(n)) {
|
|
405
|
-
let n = V(e, t, a);
|
|
406
|
-
n !== void 0 && (r[i] = n);
|
|
407
|
-
}
|
|
408
|
-
return Object.keys(r).length > 0 ? r : void 0;
|
|
409
|
-
}
|
|
410
|
-
function V(e, t, n) {
|
|
411
|
-
if (typeof n != "object" || !n) return n;
|
|
412
|
-
let r = t?.reasoningEffort;
|
|
413
|
-
if (!r && n.omitWhenOff) return;
|
|
414
|
-
if (n.$var === "thinking.enabled") return !!r;
|
|
415
|
-
let i = r ? e.thinkingLevelMap?.[r] : e.thinkingLevelMap?.off;
|
|
416
|
-
return i === void 0 ? r : typeof i == "string" ? i : void 0;
|
|
417
|
-
}
|
|
418
|
-
function H(e, t) {
|
|
419
|
-
if (e.cacheControlFormat !== "anthropic" || t === "none") return;
|
|
420
|
-
let n = t === "long" && e.supportsLongCacheRetention ? "1h" : void 0;
|
|
421
|
-
return {
|
|
422
|
-
type: "ephemeral",
|
|
423
|
-
...n ? { ttl: n } : {}
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
function U(e, t, n) {
|
|
427
|
-
W(e, n), K(t, n), G(e, n);
|
|
428
|
-
}
|
|
429
|
-
function W(e, t) {
|
|
430
|
-
for (let n of e) if (n.role === "system" || n.role === "developer") {
|
|
431
|
-
q(n, t);
|
|
432
|
-
return;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
function G(e, t) {
|
|
436
|
-
for (let n = e.length - 1; n >= 0; n--) {
|
|
437
|
-
let r = e[n];
|
|
438
|
-
if ((r.role === "user" || r.role === "assistant" || r.role === "tool") && J(r, t)) return;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
function K(e, t) {
|
|
442
|
-
if (!e || e.length === 0) return;
|
|
443
|
-
let n = e[e.length - 1];
|
|
444
|
-
n.cache_control = t;
|
|
445
|
-
}
|
|
446
|
-
function q(e, t) {
|
|
447
|
-
return Y(e, t);
|
|
448
|
-
}
|
|
449
|
-
function J(e, t) {
|
|
450
|
-
return e.role === "user" || e.role === "assistant" || e.role === "tool" ? Y(e, t) : !1;
|
|
451
|
-
}
|
|
452
|
-
function Y(e, t) {
|
|
453
|
-
let n = e.content;
|
|
454
|
-
if (typeof n == "string") return n.length !== 0 && (e.content = [{
|
|
455
|
-
type: "text",
|
|
456
|
-
text: n,
|
|
457
|
-
cache_control: t
|
|
458
|
-
}], !0);
|
|
459
|
-
if (!Array.isArray(n)) return !1;
|
|
460
|
-
for (let e = n.length - 1; e >= 0; e--) {
|
|
461
|
-
let r = n[e];
|
|
462
|
-
if (r?.type === "text") {
|
|
463
|
-
let e = r;
|
|
464
|
-
return e.cache_control = t, !0;
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
return !1;
|
|
468
|
-
}
|
|
469
|
-
function X(e, t, n, r) {
|
|
470
|
-
let i = [], a = (t) => {
|
|
471
|
-
if (t.includes("|")) {
|
|
472
|
-
let e = t.indexOf("|"), n = t.slice(0, e).replace(/[^a-zA-Z0-9_-]/g, "_"), r = t.slice(e + 1).replace(/[^a-zA-Z0-9_-]/g, "_"), i = r.length > 0 ? `${n}_${r}` : n;
|
|
473
|
-
if (i.length <= 40) return i;
|
|
474
|
-
let a = w(t).slice(0, 8);
|
|
475
|
-
return `${n.slice(0, Math.max(1, 40 - a.length - 1))}_${a}`;
|
|
476
|
-
}
|
|
477
|
-
return e.provider === "openai" && t.length > 40 ? t.slice(0, 40) : t;
|
|
478
|
-
}, o = g(t.messages, e, (e) => a(e));
|
|
479
|
-
if (t.systemPrompt) {
|
|
480
|
-
let r = e.reasoning && n.supportsDeveloperRole ? "developer" : "system";
|
|
481
|
-
i.push({
|
|
482
|
-
role: r,
|
|
483
|
-
content: m(t.systemPrompt)
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
let s = null;
|
|
487
|
-
for (let a = 0; a < o.length; a++) {
|
|
488
|
-
let c = o[a];
|
|
489
|
-
if (n.requiresAssistantAfterToolResult && s === "toolResult" && c.role === "user" && i.push({
|
|
490
|
-
role: "assistant",
|
|
491
|
-
content: "I have processed the tool results."
|
|
492
|
-
}), c.role === "user") {
|
|
493
|
-
if (typeof c.content == "string") i.push({
|
|
494
|
-
role: "user",
|
|
495
|
-
content: m(c.content)
|
|
496
|
-
});
|
|
497
|
-
else {
|
|
498
|
-
let e = c.content.map((e) => e.type === "text" ? {
|
|
499
|
-
type: "text",
|
|
500
|
-
text: m(e.text)
|
|
501
|
-
} : {
|
|
502
|
-
type: "image_url",
|
|
503
|
-
image_url: { url: `data:${e.mimeType};base64,${e.data}` }
|
|
504
|
-
});
|
|
505
|
-
if (e.length === 0) continue;
|
|
506
|
-
i.push({
|
|
507
|
-
role: "user",
|
|
508
|
-
content: e
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
} else if (c.role === "assistant") {
|
|
512
|
-
let t = {
|
|
513
|
-
role: "assistant",
|
|
514
|
-
content: n.requiresAssistantAfterToolResult ? "" : null
|
|
515
|
-
}, a = c.content.filter(A).filter((e) => e.text.trim().length > 0).map((e) => ({
|
|
516
|
-
type: "text",
|
|
517
|
-
text: m(e.text)
|
|
518
|
-
})), o = a.map((e) => e.text).join(""), s = c.content.filter(j).filter((e) => e.thinking.trim().length > 0);
|
|
519
|
-
if (s.length > 0) {
|
|
520
|
-
if (n.requiresThinkingAsText) t.content = [{
|
|
521
|
-
type: "text",
|
|
522
|
-
text: s.map((e) => m(e.thinking)).join("\n\n")
|
|
523
|
-
}, ...a];
|
|
524
|
-
else {
|
|
525
|
-
o.length > 0 && (t.content = o);
|
|
526
|
-
let n = s[0].thinkingSignature;
|
|
527
|
-
e.provider === "opencode-go" && n === "reasoning" && (n = "reasoning_content"), n && n.length > 0 && (t[n] = s.map((e) => e.thinking).join("\n"));
|
|
528
|
-
}
|
|
529
|
-
} else o.length > 0 && (t.content = o);
|
|
530
|
-
let l = c.content.filter(M);
|
|
531
|
-
if (l.length > 0) {
|
|
532
|
-
t.tool_calls = l.map((e) => {
|
|
533
|
-
let t = r?.grammarToolInputProperties?.get(e.name);
|
|
534
|
-
return t === void 0 ? {
|
|
535
|
-
id: e.id,
|
|
536
|
-
type: "function",
|
|
537
|
-
function: {
|
|
538
|
-
name: e.name,
|
|
539
|
-
arguments: JSON.stringify(e.arguments)
|
|
540
|
-
}
|
|
541
|
-
} : {
|
|
542
|
-
id: e.id,
|
|
543
|
-
type: "custom",
|
|
544
|
-
custom: {
|
|
545
|
-
name: e.name,
|
|
546
|
-
input: m(d(e.name, e.arguments, t))
|
|
547
|
-
}
|
|
548
|
-
};
|
|
549
|
-
});
|
|
550
|
-
let e = l.filter((e) => e.thoughtSignature).map((e) => {
|
|
551
|
-
try {
|
|
552
|
-
return JSON.parse(e.thoughtSignature);
|
|
553
|
-
} catch {
|
|
554
|
-
return null;
|
|
555
|
-
}
|
|
556
|
-
}).filter(Boolean);
|
|
557
|
-
e.length > 0 && (t.reasoning_details = e);
|
|
558
|
-
}
|
|
559
|
-
n.requiresReasoningContentOnAssistantMessages && e.reasoning && t.reasoning_content === void 0 && (t.reasoning_content = "");
|
|
560
|
-
let u = t.content;
|
|
561
|
-
if (!(u != null && u.length > 0) && !t.tool_calls) continue;
|
|
562
|
-
i.push(t);
|
|
563
|
-
} else if (c.role === "toolResult") {
|
|
564
|
-
let r = [], c = /* @__PURE__ */ new Set(), l = a;
|
|
565
|
-
for (; l < o.length && o[l].role === "toolResult"; l++) {
|
|
566
|
-
let t = o[l], a = t.content.filter(A).map((e) => e.text).join("\n"), s = t.content.some((e) => e.type === "image"), u = a.length > 0 ? a : s ? "(see attached image)" : "(no tool output)", d = {
|
|
567
|
-
role: "tool",
|
|
568
|
-
content: m(u),
|
|
569
|
-
tool_call_id: t.toolCallId
|
|
570
|
-
};
|
|
571
|
-
if (n.requiresToolResultName && t.toolName && (d.name = t.toolName), i.push(d), n.deferredToolsMode === "kimi") for (let e of t.addedToolNames ?? []) c.add(e);
|
|
572
|
-
if (s && e.input.includes("image")) for (let e of t.content) N(e) && r.push({
|
|
573
|
-
type: "image_url",
|
|
574
|
-
image_url: { url: `data:${e.mimeType};base64,${e.data}` }
|
|
575
|
-
});
|
|
576
|
-
}
|
|
577
|
-
if (a = l - 1, r.length > 0 ? (n.requiresAssistantAfterToolResult && i.push({
|
|
578
|
-
role: "assistant",
|
|
579
|
-
content: "I have processed the tool results."
|
|
580
|
-
}), i.push({
|
|
581
|
-
role: "user",
|
|
582
|
-
content: [{
|
|
583
|
-
type: "text",
|
|
584
|
-
text: "Attached image(s) from tool result:"
|
|
585
|
-
}, ...r]
|
|
586
|
-
}), s = "user") : s = "toolResult", c.size > 0) {
|
|
587
|
-
let e = k(t.tools, c);
|
|
588
|
-
if (e.length > 0) {
|
|
589
|
-
let t = {
|
|
590
|
-
role: "system",
|
|
591
|
-
tools: Z(e, n)
|
|
592
|
-
};
|
|
593
|
-
i.push(t);
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
continue;
|
|
597
|
-
}
|
|
598
|
-
s = c.role;
|
|
599
|
-
}
|
|
600
|
-
return i;
|
|
601
|
-
}
|
|
602
|
-
function Z(e, t) {
|
|
603
|
-
return e.map((e) => {
|
|
604
|
-
let n = c(e, t.supportsOpenAIGrammarTools);
|
|
605
|
-
if (n) return {
|
|
606
|
-
type: "custom",
|
|
607
|
-
custom: {
|
|
608
|
-
name: e.name,
|
|
609
|
-
description: e.description,
|
|
610
|
-
format: {
|
|
611
|
-
type: "grammar",
|
|
612
|
-
grammar: {
|
|
613
|
-
syntax: n.format,
|
|
614
|
-
definition: n.definition
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
};
|
|
619
|
-
let r = l(e, t.supportsStrictMode !== !1);
|
|
620
|
-
return {
|
|
621
|
-
type: "function",
|
|
622
|
-
function: {
|
|
623
|
-
name: e.name,
|
|
624
|
-
description: e.description,
|
|
625
|
-
parameters: _(e, r),
|
|
626
|
-
...t.supportsStrictMode !== !1 && { strict: r ?? !1 }
|
|
627
|
-
}
|
|
628
|
-
};
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
function Q(e, n) {
|
|
632
|
-
let r = e.prompt_tokens || 0, i = e.prompt_tokens_details?.cached_tokens ?? e.prompt_cache_hit_tokens ?? 0, a = e.prompt_tokens_details?.cache_write_tokens || 0, o = Math.max(0, r - i - a), s = e.completion_tokens || 0, c = {
|
|
633
|
-
input: o,
|
|
634
|
-
output: s,
|
|
635
|
-
cacheRead: i,
|
|
636
|
-
cacheWrite: a,
|
|
637
|
-
reasoning: e.completion_tokens_details?.reasoning_tokens || 0,
|
|
638
|
-
totalTokens: o + s + i + a,
|
|
639
|
-
cost: {
|
|
640
|
-
input: 0,
|
|
641
|
-
output: 0,
|
|
642
|
-
cacheRead: 0,
|
|
643
|
-
cacheWrite: 0,
|
|
644
|
-
total: 0
|
|
645
|
-
}
|
|
646
|
-
};
|
|
647
|
-
return t(n, c), c;
|
|
648
|
-
}
|
|
649
|
-
function ee(e) {
|
|
650
|
-
if (e === null) return { stopReason: "stop" };
|
|
651
|
-
switch (e) {
|
|
652
|
-
case "stop":
|
|
653
|
-
case "end": return { stopReason: "stop" };
|
|
654
|
-
case "length": return { stopReason: "length" };
|
|
655
|
-
case "function_call":
|
|
656
|
-
case "tool_calls": return { stopReason: "toolUse" };
|
|
657
|
-
case "content_filter": return {
|
|
658
|
-
stopReason: "error",
|
|
659
|
-
errorMessage: "Provider finish_reason: content_filter"
|
|
660
|
-
};
|
|
661
|
-
case "network_error": return {
|
|
662
|
-
stopReason: "error",
|
|
663
|
-
errorMessage: "Provider finish_reason: network_error"
|
|
664
|
-
};
|
|
665
|
-
default: return {
|
|
666
|
-
stopReason: "error",
|
|
667
|
-
errorMessage: `Provider finish_reason: ${e}`
|
|
668
|
-
};
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
function te(e) {
|
|
672
|
-
let t = e.provider, n = e.baseUrl, r = t === "zai" || t === "zai-coding-cn" || n.includes("api.z.ai") || n.includes("open.bigmodel.cn"), i = t === "together" || n.includes("api.together.ai") || n.includes("api.together.xyz"), a = t === "moonshotai" || t === "moonshotai-cn" || n.includes("api.moonshot."), o = t === "openrouter" || n.includes("openrouter.ai"), s = t === "cloudflare-workers-ai" || n.includes("api.cloudflare.com"), c = t === "cloudflare-ai-gateway" || n.includes("gateway.ai.cloudflare.com"), l = t === "nvidia" || n.includes("integrate.api.nvidia.com"), u = t === "ant-ling" || n.includes("api.ant-ling.com"), d = t === "deepseek" || n.toLowerCase().includes("deepseek.com"), f = l || t === "cerebras" || n.includes("cerebras.ai") || t === "xai" || n.includes("api.x.ai") || i || n.includes("chutes.ai") || d || r || a || t === "opencode" || n.includes("opencode.ai") || s || c || u, p = n.includes("chutes.ai") || d || a || c || i || l || u || r, m = t === "xai" || n.includes("api.x.ai"), h = o && (e.id.startsWith("anthropic/") || e.id.startsWith("openai/")), g = t === "openrouter" && e.id.startsWith("anthropic/") ? "anthropic" : void 0;
|
|
673
|
-
return {
|
|
674
|
-
supportsStore: !f,
|
|
675
|
-
supportsDeveloperRole: h || !f && !o,
|
|
676
|
-
supportsReasoningEffort: !m && !r && !a && !i && !c && !l && !u,
|
|
677
|
-
supportsUsageInStreaming: !0,
|
|
678
|
-
supportsFinishReason: !0,
|
|
679
|
-
maxTokensField: p ? "max_tokens" : "max_completion_tokens",
|
|
680
|
-
requiresToolResultName: !1,
|
|
681
|
-
requiresAssistantAfterToolResult: !1,
|
|
682
|
-
requiresThinkingAsText: !1,
|
|
683
|
-
requiresReasoningContentOnAssistantMessages: d,
|
|
684
|
-
thinkingFormat: d ? "deepseek" : r ? "zai" : i ? "together" : u ? "ant-ling" : o ? "openrouter" : "openai",
|
|
685
|
-
openRouterRouting: {},
|
|
686
|
-
vercelGatewayRouting: {},
|
|
687
|
-
chatTemplateKwargs: {},
|
|
688
|
-
chatTemplateArgs: {},
|
|
689
|
-
zaiToolStream: !1,
|
|
690
|
-
supportsThinkingTokenBudget: !1,
|
|
691
|
-
supportsStrictMode: !a && !i && !c && !l,
|
|
692
|
-
supportsOpenAIGrammarTools: !1,
|
|
693
|
-
cacheControlFormat: g,
|
|
694
|
-
sendSessionAffinityHeaders: !1,
|
|
695
|
-
deferredToolsMode: void 0,
|
|
696
|
-
sessionAffinityFormat: o ? "openrouter" : "openai",
|
|
697
|
-
supportsLongCacheRetention: !(i || s || c || l || u)
|
|
698
|
-
};
|
|
699
|
-
}
|
|
700
|
-
function $(e) {
|
|
701
|
-
let t = te(e);
|
|
702
|
-
return e.compat ? {
|
|
703
|
-
supportsStore: e.compat.supportsStore ?? t.supportsStore,
|
|
704
|
-
supportsDeveloperRole: e.compat.supportsDeveloperRole ?? t.supportsDeveloperRole,
|
|
705
|
-
supportsReasoningEffort: e.compat.supportsReasoningEffort ?? t.supportsReasoningEffort,
|
|
706
|
-
supportsUsageInStreaming: e.compat.supportsUsageInStreaming ?? t.supportsUsageInStreaming,
|
|
707
|
-
supportsFinishReason: e.compat.supportsFinishReason ?? t.supportsFinishReason,
|
|
708
|
-
maxTokensField: e.compat.maxTokensField ?? t.maxTokensField,
|
|
709
|
-
requiresToolResultName: e.compat.requiresToolResultName ?? t.requiresToolResultName,
|
|
710
|
-
requiresAssistantAfterToolResult: e.compat.requiresAssistantAfterToolResult ?? t.requiresAssistantAfterToolResult,
|
|
711
|
-
requiresThinkingAsText: e.compat.requiresThinkingAsText ?? t.requiresThinkingAsText,
|
|
712
|
-
requiresReasoningContentOnAssistantMessages: e.compat.requiresReasoningContentOnAssistantMessages ?? t.requiresReasoningContentOnAssistantMessages,
|
|
713
|
-
thinkingFormat: e.compat.thinkingFormat ?? t.thinkingFormat,
|
|
714
|
-
openRouterRouting: e.compat.openRouterRouting ?? {},
|
|
715
|
-
vercelGatewayRouting: e.compat.vercelGatewayRouting ?? t.vercelGatewayRouting,
|
|
716
|
-
chatTemplateKwargs: e.compat.chatTemplateKwargs ?? t.chatTemplateKwargs,
|
|
717
|
-
chatTemplateArgs: e.compat.chatTemplateArgs ?? t.chatTemplateArgs,
|
|
718
|
-
zaiToolStream: e.compat.zaiToolStream ?? t.zaiToolStream,
|
|
719
|
-
supportsThinkingTokenBudget: e.compat.supportsThinkingTokenBudget ?? t.supportsThinkingTokenBudget,
|
|
720
|
-
supportsStrictMode: e.compat.supportsStrictMode ?? t.supportsStrictMode,
|
|
721
|
-
supportsOpenAIGrammarTools: e.compat.supportsOpenAIGrammarTools ?? t.supportsOpenAIGrammarTools,
|
|
722
|
-
cacheControlFormat: e.compat.cacheControlFormat ?? t.cacheControlFormat,
|
|
723
|
-
sendSessionAffinityHeaders: e.compat.sendSessionAffinityHeaders ?? t.sendSessionAffinityHeaders,
|
|
724
|
-
deferredToolsMode: e.compat.deferredToolsMode ?? t.deferredToolsMode,
|
|
725
|
-
sessionAffinityFormat: e.compat.sessionAffinityFormat ?? t.sessionAffinityFormat,
|
|
726
|
-
supportsLongCacheRetention: e.compat.supportsLongCacheRetention ?? t.supportsLongCacheRetention
|
|
727
|
-
} : t;
|
|
728
|
-
}
|
|
729
|
-
//#endregion
|
|
730
|
-
export { X as convertMessages, I as stream, L as streamSimple };
|