@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,383 +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
|
-
//#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/utils/sanitize-unicode.js
|
|
12
|
-
function e(e) {
|
|
13
|
-
return e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g, "");
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
//#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/constrained-sampling.js
|
|
17
|
-
var t = class extends Error {}, n = [
|
|
18
|
-
"$ref",
|
|
19
|
-
"$defs",
|
|
20
|
-
"definitions",
|
|
21
|
-
"allOf",
|
|
22
|
-
"oneOf",
|
|
23
|
-
"patternProperties",
|
|
24
|
-
"dependentSchemas",
|
|
25
|
-
"dependencies",
|
|
26
|
-
"unevaluatedProperties",
|
|
27
|
-
"propertyNames",
|
|
28
|
-
"contains",
|
|
29
|
-
"prefixItems",
|
|
30
|
-
"not",
|
|
31
|
-
"if",
|
|
32
|
-
"then",
|
|
33
|
-
"else"
|
|
34
|
-
];
|
|
35
|
-
function r(e) {
|
|
36
|
-
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
37
|
-
}
|
|
38
|
-
function i(e) {
|
|
39
|
-
if (!r(e)) return !1;
|
|
40
|
-
let t = typeof e.type == "string" ? [e.type] : Array.isArray(e.type) ? e.type : [];
|
|
41
|
-
return t.includes("object") || t.includes("array") || e.properties !== void 0 || e.items !== void 0;
|
|
42
|
-
}
|
|
43
|
-
function a(e) {
|
|
44
|
-
return r(e) ? e.type === "null" || Array.isArray(e.type) && e.type.includes("null") || e.const === null || Array.isArray(e.enum) && e.enum.includes(null) ? !0 : Array.isArray(e.anyOf) && e.anyOf.some((e) => a(e)) : !1;
|
|
45
|
-
}
|
|
46
|
-
function o(e) {
|
|
47
|
-
if (!r(e)) throw new t("boolean schemas are unsupported");
|
|
48
|
-
for (let r of n) if (e[r] !== void 0) throw new t(`${r} schemas are unsupported`);
|
|
49
|
-
if (e.anyOf !== void 0) {
|
|
50
|
-
if (!Array.isArray(e.anyOf) || e.anyOf.length === 0) throw new t("anyOf must contain at least one schema");
|
|
51
|
-
for (let n of e.anyOf) {
|
|
52
|
-
if (i(n)) throw new t("object and array unions are unsupported");
|
|
53
|
-
o(n);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (e.items !== void 0) {
|
|
57
|
-
if (Array.isArray(e.items)) throw new t("tuple schemas are unsupported");
|
|
58
|
-
o(e.items);
|
|
59
|
-
}
|
|
60
|
-
let s = e.type === "object";
|
|
61
|
-
if (e.properties !== void 0 && !s) throw new t("properties require type object");
|
|
62
|
-
if (!s) return;
|
|
63
|
-
if (e.additionalProperties !== void 0 && e.additionalProperties !== !1) throw new t("schema-valued or true additionalProperties is unsupported");
|
|
64
|
-
if (e.properties !== void 0 && !r(e.properties)) throw new t("object properties must be a schema map");
|
|
65
|
-
if (e.required !== void 0 && (!Array.isArray(e.required) || e.required.some((e) => typeof e != "string"))) throw new t("object required must be a string array");
|
|
66
|
-
let c = e.properties ?? {}, l = Object.keys(c), u = new Set(Array.isArray(e.required) ? e.required : []);
|
|
67
|
-
if ([...u].some((e) => !l.includes(e))) throw new t("required contains an unknown property");
|
|
68
|
-
for (let [e, t] of Object.entries(c)) o(t), !u.has(e) && !a(t) && (c[e] = { anyOf: [t, { type: "null" }] });
|
|
69
|
-
e.required = l, e.additionalProperties = !1;
|
|
70
|
-
}
|
|
71
|
-
function s(e) {
|
|
72
|
-
let n = structuredClone(e);
|
|
73
|
-
if (!r(n) || (o(n), n.type !== "object")) throw new t("root schema must have type object");
|
|
74
|
-
return n;
|
|
75
|
-
}
|
|
76
|
-
function c(e, t) {
|
|
77
|
-
return t === !0 ? s(e.parameters) : e.parameters;
|
|
78
|
-
}
|
|
79
|
-
function l(e, t, n) {
|
|
80
|
-
let r = t[n];
|
|
81
|
-
if (typeof r != "string") throw Error(`Grammar tool call "${e}" requires argument "${n}" to be a string.`);
|
|
82
|
-
return r;
|
|
83
|
-
}
|
|
84
|
-
function u(e, t, n, r) {
|
|
85
|
-
if (e.closed) {
|
|
86
|
-
if (r && n === e.input) return;
|
|
87
|
-
throw Error(`grammar tool input for property "${t}" changed after it was closed`);
|
|
88
|
-
}
|
|
89
|
-
if (!n.startsWith(e.input)) throw Error(`grammar tool input for property "${t}" changed non-monotonically`);
|
|
90
|
-
let i = n.slice(e.input.length);
|
|
91
|
-
if (!r && i.length === 0) return;
|
|
92
|
-
let a = "";
|
|
93
|
-
return e.started ||= (a += `{${JSON.stringify(t)}:"`, !0), a += JSON.stringify(i).slice(1, -1), e.input = n, r && (a += "\"}", e.closed = !0), a;
|
|
94
|
-
}
|
|
95
|
-
function d(e) {
|
|
96
|
-
let t = e.parameters;
|
|
97
|
-
if (t.type !== "object") throw Error("grammar constrained sampling requires an object parameter schema");
|
|
98
|
-
if (!Array.isArray(t.required) || t.required.length !== 1 || typeof t.required[0] != "string") throw Error("grammar constrained sampling requires exactly one required string property");
|
|
99
|
-
let n = t.required[0];
|
|
100
|
-
if (!t.properties?.[n]) throw Error(`grammar constrained sampling requires a properties entry for ${n}`);
|
|
101
|
-
if (t.properties[n]?.type !== "string") throw Error(`grammar constrained sampling property ${n} must have type string`);
|
|
102
|
-
return n;
|
|
103
|
-
}
|
|
104
|
-
function f(e, n) {
|
|
105
|
-
let r = e.constrainedSampling;
|
|
106
|
-
if (r && r.type === "json_schema") {
|
|
107
|
-
if (n) try {
|
|
108
|
-
return s(e.parameters), !0;
|
|
109
|
-
} catch (n) {
|
|
110
|
-
if (!(n instanceof t)) throw n;
|
|
111
|
-
if (r.strict !== "require") return;
|
|
112
|
-
throw Error(`Tool "${e.name}" requires JSON-schema constrained sampling, but ${n.message}.`);
|
|
113
|
-
}
|
|
114
|
-
if (r.strict === "require") throw Error(`Tool "${e.name}" requires JSON-schema constrained sampling, but strict tools are unsupported.`);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
function p(e, t) {
|
|
118
|
-
let n = e.constrainedSampling;
|
|
119
|
-
if (!n || n.type !== "grammar" || !t) return;
|
|
120
|
-
let r = n.variants.openai_lark, i = n.variants.openai_regex, a = typeof r == "string" && r.trim().length > 0, o = typeof i == "string" && i.trim().length > 0;
|
|
121
|
-
if (!a && !o) throw Error(`Tool "${e.name}" cannot use grammar constrained sampling: no supported grammar variant was provided.`);
|
|
122
|
-
try {
|
|
123
|
-
return {
|
|
124
|
-
format: a ? "lark" : "regex",
|
|
125
|
-
definition: a ? r : i,
|
|
126
|
-
inputProperty: d(e)
|
|
127
|
-
};
|
|
128
|
-
} catch (t) {
|
|
129
|
-
let n = t instanceof Error ? t.message : String(t);
|
|
130
|
-
throw Error(`Tool "${e.name}" cannot use grammar constrained sampling: ${n}.`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
function m(e, t) {
|
|
134
|
-
let n = /* @__PURE__ */ new Map();
|
|
135
|
-
for (let r of e ?? []) {
|
|
136
|
-
let e = p(r, t);
|
|
137
|
-
e && n.set(r.name, e.inputProperty);
|
|
138
|
-
}
|
|
139
|
-
return n;
|
|
140
|
-
}
|
|
141
|
-
//#endregion
|
|
142
|
-
//#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/utils/estimate.js
|
|
143
|
-
var h = 4, g = 4800;
|
|
144
|
-
function _(e) {
|
|
145
|
-
return e.totalTokens || e.input + e.output + e.cacheRead + e.cacheWrite;
|
|
146
|
-
}
|
|
147
|
-
function v(e) {
|
|
148
|
-
try {
|
|
149
|
-
return JSON.stringify(e) ?? "undefined";
|
|
150
|
-
} catch {
|
|
151
|
-
return "[unserializable]";
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
function y(e) {
|
|
155
|
-
if (typeof e == "string") return e.length;
|
|
156
|
-
let t = 0;
|
|
157
|
-
for (let n of e) t += n.type === "text" ? n.text.length : g;
|
|
158
|
-
return t;
|
|
159
|
-
}
|
|
160
|
-
function b(e) {
|
|
161
|
-
return Math.ceil(e.length / h);
|
|
162
|
-
}
|
|
163
|
-
function x(e) {
|
|
164
|
-
return Math.ceil(y(e) / h);
|
|
165
|
-
}
|
|
166
|
-
function S(e) {
|
|
167
|
-
let t = 0;
|
|
168
|
-
if (e.role === "user" || e.role === "toolResult") return x(e.content);
|
|
169
|
-
for (let n of e.content) n.type === "text" ? t += n.text.length : n.type === "thinking" ? t += n.thinking.length : t += n.name.length + v(n.arguments).length;
|
|
170
|
-
return Math.ceil(t / h);
|
|
171
|
-
}
|
|
172
|
-
function C(e) {
|
|
173
|
-
let t = -Infinity, n;
|
|
174
|
-
for (let r = 0; r < e.length; r++) {
|
|
175
|
-
let i = e[r];
|
|
176
|
-
if (i.role === "assistant") {
|
|
177
|
-
let e = i;
|
|
178
|
-
e.timestamp >= t && e.stopReason !== "aborted" && e.stopReason !== "error" && _(e.usage) > 0 && (n = {
|
|
179
|
-
usage: e.usage,
|
|
180
|
-
index: r
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
t = Math.max(t, i.timestamp);
|
|
184
|
-
}
|
|
185
|
-
return n;
|
|
186
|
-
}
|
|
187
|
-
function w(e) {
|
|
188
|
-
let t = C(e);
|
|
189
|
-
if (t) {
|
|
190
|
-
let n = _(t.usage), r = 0;
|
|
191
|
-
for (let n = t.index + 1; n < e.length; n++) r += S(e[n]);
|
|
192
|
-
return {
|
|
193
|
-
tokens: n + r,
|
|
194
|
-
usageTokens: n,
|
|
195
|
-
trailingTokens: r,
|
|
196
|
-
lastUsageIndex: t.index
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
let n = 0;
|
|
200
|
-
for (let t of e) n += S(t);
|
|
201
|
-
return {
|
|
202
|
-
tokens: n,
|
|
203
|
-
usageTokens: 0,
|
|
204
|
-
trailingTokens: n,
|
|
205
|
-
lastUsageIndex: null
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
function T(e) {
|
|
209
|
-
return !e || e.length === 0 ? 0 : b(v(e));
|
|
210
|
-
}
|
|
211
|
-
function E(e) {
|
|
212
|
-
return Array.isArray(e);
|
|
213
|
-
}
|
|
214
|
-
function D(e) {
|
|
215
|
-
if (E(e)) return w(e);
|
|
216
|
-
let t = w(e.messages);
|
|
217
|
-
if (t.lastUsageIndex !== null) {
|
|
218
|
-
let n = new Set(e.messages.slice(t.lastUsageIndex + 1).filter((e) => e.role === "toolResult").flatMap((e) => e.addedToolNames ?? [])), r = T(e.tools?.filter((e) => n.has(e.name)));
|
|
219
|
-
return {
|
|
220
|
-
tokens: t.tokens + r,
|
|
221
|
-
usageTokens: t.usageTokens,
|
|
222
|
-
trailingTokens: t.trailingTokens + r,
|
|
223
|
-
lastUsageIndex: t.lastUsageIndex
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
let n = (e.systemPrompt ? b(e.systemPrompt) : 0) + T(e.tools);
|
|
227
|
-
return {
|
|
228
|
-
tokens: t.tokens + n,
|
|
229
|
-
usageTokens: t.usageTokens,
|
|
230
|
-
trailingTokens: t.trailingTokens + n,
|
|
231
|
-
lastUsageIndex: t.lastUsageIndex
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
//#endregion
|
|
235
|
-
//#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/simple-options.js
|
|
236
|
-
var O = 4096, k = 1;
|
|
237
|
-
function A(e, t, n) {
|
|
238
|
-
if (e.contextWindow <= 0) return Math.max(k, n);
|
|
239
|
-
let r = e.contextWindow - D(t).tokens - O;
|
|
240
|
-
return Math.min(n, Math.max(k, r));
|
|
241
|
-
}
|
|
242
|
-
function j(e, t, n, r) {
|
|
243
|
-
let i = e.samplingParams || n?.samplingParams ? {
|
|
244
|
-
...e.samplingParams,
|
|
245
|
-
...n?.samplingParams
|
|
246
|
-
} : void 0;
|
|
247
|
-
return {
|
|
248
|
-
temperature: n?.temperature,
|
|
249
|
-
samplingParams: i,
|
|
250
|
-
maxTokens: A(e, t, n?.maxTokens ?? e.maxTokens),
|
|
251
|
-
signal: n?.signal,
|
|
252
|
-
telemetryContext: n?.telemetryContext,
|
|
253
|
-
apiKey: r || n?.apiKey,
|
|
254
|
-
fetch: n?.fetch,
|
|
255
|
-
transport: n?.transport,
|
|
256
|
-
cacheRetention: n?.cacheRetention,
|
|
257
|
-
sessionId: n?.sessionId,
|
|
258
|
-
headers: n?.headers,
|
|
259
|
-
onPayload: n?.onPayload,
|
|
260
|
-
onResponse: n?.onResponse,
|
|
261
|
-
timeoutMs: n?.timeoutMs,
|
|
262
|
-
websocketConnectTimeoutMs: n?.websocketConnectTimeoutMs,
|
|
263
|
-
maxRetries: n?.maxRetries,
|
|
264
|
-
maxRetryDelayMs: n?.maxRetryDelayMs,
|
|
265
|
-
metadata: n?.metadata,
|
|
266
|
-
env: n?.env
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
var M = 1024;
|
|
270
|
-
function N(e) {
|
|
271
|
-
return e === "xhigh" || e === "max" ? "high" : e;
|
|
272
|
-
}
|
|
273
|
-
function P(e, t, n, r) {
|
|
274
|
-
let i = {
|
|
275
|
-
minimal: 1024,
|
|
276
|
-
low: 2048,
|
|
277
|
-
medium: 8192,
|
|
278
|
-
high: 16384,
|
|
279
|
-
...r
|
|
280
|
-
}[N(n)], a = e === void 0 ? t : Math.min(e + i, t);
|
|
281
|
-
return a <= i && (i = Math.max(0, a - M)), {
|
|
282
|
-
maxTokens: a,
|
|
283
|
-
thinkingBudget: i
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
//#endregion
|
|
287
|
-
//#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/transform-messages.js
|
|
288
|
-
var F = "(image omitted: model does not support images)", I = "(tool image omitted: model does not support images)";
|
|
289
|
-
function L(e, t) {
|
|
290
|
-
let n = [], r = !1;
|
|
291
|
-
for (let i of e) {
|
|
292
|
-
if (i.type === "image") {
|
|
293
|
-
r || n.push({
|
|
294
|
-
type: "text",
|
|
295
|
-
text: t
|
|
296
|
-
}), r = !0;
|
|
297
|
-
continue;
|
|
298
|
-
}
|
|
299
|
-
n.push(i), r = i.text === t;
|
|
300
|
-
}
|
|
301
|
-
return n;
|
|
302
|
-
}
|
|
303
|
-
function R(e, t) {
|
|
304
|
-
return t.input.includes("image") ? e : e.map((e) => e.role === "user" && Array.isArray(e.content) ? {
|
|
305
|
-
...e,
|
|
306
|
-
content: L(e.content, F)
|
|
307
|
-
} : e.role === "toolResult" ? {
|
|
308
|
-
...e,
|
|
309
|
-
content: L(e.content, I)
|
|
310
|
-
} : e);
|
|
311
|
-
}
|
|
312
|
-
function z(e, t, n) {
|
|
313
|
-
let r = /* @__PURE__ */ new Map(), i = R(e.map((e) => e.content == null ? {
|
|
314
|
-
...e,
|
|
315
|
-
content: []
|
|
316
|
-
} : e), t).map((e) => {
|
|
317
|
-
if (e.role === "user") return e;
|
|
318
|
-
if (e.role === "toolResult") {
|
|
319
|
-
let t = r.get(e.toolCallId);
|
|
320
|
-
return t && t !== e.toolCallId ? {
|
|
321
|
-
...e,
|
|
322
|
-
toolCallId: t
|
|
323
|
-
} : e;
|
|
324
|
-
}
|
|
325
|
-
if (e.role === "assistant") {
|
|
326
|
-
let i = e, a = i.provider === t.provider && i.api === t.api && i.model === t.id, o = i.content.flatMap((e) => {
|
|
327
|
-
if (e.type === "thinking") return e.redacted ? a ? e : [] : a && e.thinkingSignature ? e : !e.thinking || e.thinking.trim() === "" ? [] : a ? e : {
|
|
328
|
-
type: "text",
|
|
329
|
-
text: e.thinking
|
|
330
|
-
};
|
|
331
|
-
if (e.type === "text") return a ? e : {
|
|
332
|
-
type: "text",
|
|
333
|
-
text: e.text
|
|
334
|
-
};
|
|
335
|
-
if (e.type === "toolCall") {
|
|
336
|
-
let o = e, s = o;
|
|
337
|
-
if (!a && o.thoughtSignature && (s = { ...o }, delete s.thoughtSignature), !a && n) {
|
|
338
|
-
let e = n(o.id, t, i);
|
|
339
|
-
e !== o.id && (r.set(o.id, e), s = {
|
|
340
|
-
...s,
|
|
341
|
-
id: e
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
return s;
|
|
345
|
-
}
|
|
346
|
-
return e;
|
|
347
|
-
});
|
|
348
|
-
return {
|
|
349
|
-
...i,
|
|
350
|
-
content: o
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
|
-
return e;
|
|
354
|
-
}), a = [], o = [], s = /* @__PURE__ */ new Set(), c = () => {
|
|
355
|
-
if (o.length > 0) {
|
|
356
|
-
for (let e of o) s.has(e.id) || a.push({
|
|
357
|
-
role: "toolResult",
|
|
358
|
-
toolCallId: e.id,
|
|
359
|
-
toolName: e.name,
|
|
360
|
-
content: [{
|
|
361
|
-
type: "text",
|
|
362
|
-
text: "No result provided"
|
|
363
|
-
}],
|
|
364
|
-
isError: !0,
|
|
365
|
-
timestamp: Date.now()
|
|
366
|
-
});
|
|
367
|
-
o = [], s = /* @__PURE__ */ new Set();
|
|
368
|
-
}
|
|
369
|
-
};
|
|
370
|
-
for (let e = 0; e < i.length; e++) {
|
|
371
|
-
let t = i[e];
|
|
372
|
-
if (t.role === "assistant") {
|
|
373
|
-
c();
|
|
374
|
-
let e = t;
|
|
375
|
-
if (e.stopReason === "error" || e.stopReason === "aborted") continue;
|
|
376
|
-
let n = e.content.filter((e) => e.type === "toolCall");
|
|
377
|
-
n.length > 0 && (o = n, s = /* @__PURE__ */ new Set()), a.push(t);
|
|
378
|
-
} else t.role === "toolResult" ? (s.add(t.toolCallId), a.push(t)) : (t.role === "user" && c(), a.push(t));
|
|
379
|
-
}
|
|
380
|
-
return c(), a;
|
|
381
|
-
}
|
|
382
|
-
//#endregion
|
|
383
|
-
export { A as a, m as c, p as d, f, j as i, l, M as n, N as o, e as p, P as r, u as s, z as t, c as u };
|