@hintergrund/ui 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BuilderAgentPane-Vj3NCGvZ.js +25916 -0
- package/dist/IntegrationHealth-D1HcBrQn.js +218 -0
- package/dist/admin.js +22766 -28480
- package/dist/anthropic-messages-D8Vp-Ncs.js +3772 -0
- package/dist/azure-openai-responses-DnjyYuiz.js +168 -0
- package/dist/builder.js +27 -22
- package/dist/config.types-DZ5yfeqq.js +20 -0
- package/dist/deferred-tools-nxpq94I4.js +34 -0
- package/dist/diagnostics-x5QOwca_.js +91 -0
- package/dist/error-body-pXgvw5vV.js +68 -0
- package/dist/font-pool/LICENSES.txt +22 -0
- 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 +27 -0
- package/dist/global-xsR9gLDa.js +30568 -0
- package/dist/google-generative-ai-BmzNjEvl.js +291 -0
- package/dist/google-shared-CG2Lbh1z.js +8746 -0
- package/dist/google-vertex-Dfla93V_.js +329 -0
- package/dist/hash-BixfZjoG.js +21 -0
- package/dist/headers-CnTiKpOL.js +24 -0
- package/dist/json-parse-CxjAnWaM.js +231 -0
- package/dist/legacy-Zmnk-v81.js +14 -0
- package/dist/login.js +131 -146
- package/dist/mail.js +694 -789
- package/dist/mistral-conversations-DeDb7Gbd.js +558 -0
- package/dist/openai-ClxLHXsh.js +5371 -0
- package/dist/openai-codex-responses-usgOtWUT.js +909 -0
- package/dist/openai-completions-D_nFQy7A.js +730 -0
- package/dist/openai-prompt-cache-Bm8Re6Vv.js +17 -0
- package/dist/openai-responses-BqL3PFsb.js +192 -0
- package/dist/openai-responses-shared-BhQj78KM.js +481 -0
- package/dist/pi-messages-CRx0yqMp.js +268 -0
- package/dist/pi-user-agent-CsXkkH60.js +20 -0
- package/dist/provider-env-Cj6X7Wly.js +35 -0
- package/dist/provider-retry-BGImU1PV.js +68 -0
- package/dist/rolldown-runtime-nTTD767F.js +37 -0
- package/dist/setup.js +391 -418
- package/dist/transform-messages-DvxSeyBQ.js +383 -0
- package/dist/ui.css +2 -1
- package/package.json +5 -5
- package/dist/BuilderAgentPane-CwG29LOX.js +0 -13938
- package/dist/IntegrationHealth-G_4vzV66.js +0 -209
- package/dist/anthropic-messages-BmLfYiwX.js +0 -5605
- package/dist/azure-openai-responses-yf2M6GVe.js +0 -222
- package/dist/client-Cd7yMX39.js +0 -7860
- package/dist/config.types-iZoywORE.js +0 -15
- package/dist/deferred-tools-BZWMWBYN.js +0 -28
- package/dist/error-body-BUPcH4GF.js +0 -71
- package/dist/github-copilot-headers-B1RBGoZi.js +0 -21
- package/dist/global-CTQcFve1.js +0 -36177
- package/dist/google-generative-ai-DkzwUYzL.js +0 -264
- package/dist/google-shared-DTgKMtfJ.js +0 -11710
- package/dist/google-vertex-D2IzqvQM.js +0 -305
- package/dist/hash-DFlR084x.js +0 -14
- package/dist/headers-D4iLzGaS.js +0 -21
- package/dist/json-parse-LZdWp-Nd.js +0 -232
- package/dist/legacy-CckexQcJ.js +0 -5
- package/dist/mistral-conversations-CNfKG0tU.js +0 -513
- package/dist/openai-codex-responses-BLNjExaC.js +0 -947
- package/dist/openai-completions-46IVoF2N.js +0 -741
- package/dist/openai-prompt-cache-BJwqbEDx.js +0 -13
- package/dist/openai-responses-BfHoZFHI.js +0 -184
- package/dist/openai-responses-shared-DOTQAbCj.js +0 -477
- package/dist/pi-messages-fnW87Z4Z.js +0 -251
- package/dist/pi-user-agent-CUqx-qiX.js +0 -13
- package/dist/provider-env-D2VjEV3S.js +0 -26
- package/dist/provider-retry-BsigVlMg.js +0 -67
- package/dist/select-Cke4DYH1.js +0 -78
- package/dist/transform-messages-CsKsy6b4.js +0 -398
|
@@ -0,0 +1,291 @@
|
|
|
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 { g as e, h as t } from "./BuilderAgentPane-Vj3NCGvZ.js";
|
|
12
|
+
import { i as n } from "./diagnostics-x5QOwca_.js";
|
|
13
|
+
import { n as r } from "./headers-CnTiKpOL.js";
|
|
14
|
+
import { i, p as a } from "./transform-messages-DvxSeyBQ.js";
|
|
15
|
+
import { n as o, t as s } from "./error-body-pXgvw5vV.js";
|
|
16
|
+
import { a as c, c as l, i as u, l as d, n as f, o as p, r as m, s as h, t as g } from "./google-shared-CG2Lbh1z.js";
|
|
17
|
+
//#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/google-generative-ai.js
|
|
18
|
+
var _ = 0, v = (e, r, i) => {
|
|
19
|
+
let a = new n();
|
|
20
|
+
return (async () => {
|
|
21
|
+
let n = {
|
|
22
|
+
role: "assistant",
|
|
23
|
+
content: [],
|
|
24
|
+
api: "google-generative-ai",
|
|
25
|
+
provider: e.provider,
|
|
26
|
+
model: e.id,
|
|
27
|
+
usage: {
|
|
28
|
+
input: 0,
|
|
29
|
+
output: 0,
|
|
30
|
+
cacheRead: 0,
|
|
31
|
+
cacheWrite: 0,
|
|
32
|
+
totalTokens: 0,
|
|
33
|
+
cost: {
|
|
34
|
+
input: 0,
|
|
35
|
+
output: 0,
|
|
36
|
+
cacheRead: 0,
|
|
37
|
+
cacheWrite: 0,
|
|
38
|
+
total: 0
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
stopReason: "pending",
|
|
42
|
+
timestamp: Date.now()
|
|
43
|
+
};
|
|
44
|
+
try {
|
|
45
|
+
if (i?.fetch && i.fetch !== globalThis.fetch) throw Error("Custom fetch is not supported by the Google Generative AI adapter");
|
|
46
|
+
let o = i?.apiKey;
|
|
47
|
+
if (!o) throw Error(`No API key for provider: ${e.provider}`);
|
|
48
|
+
let s = b(e, o, i?.headers), c = x(e, r, i), l = await i?.onPayload?.(c, e);
|
|
49
|
+
l !== void 0 && (c = l);
|
|
50
|
+
let d = await h(() => s.models.generateContentStream(c), i);
|
|
51
|
+
a.push({
|
|
52
|
+
type: "start",
|
|
53
|
+
partial: n
|
|
54
|
+
});
|
|
55
|
+
let f = null, g = n.content, v = () => g.length - 1;
|
|
56
|
+
for await (let r of d) {
|
|
57
|
+
n.responseId ||= r.responseId;
|
|
58
|
+
let i = r.candidates?.[0];
|
|
59
|
+
if (i?.content?.parts) for (let e of i.content.parts) {
|
|
60
|
+
if (e.text !== void 0) {
|
|
61
|
+
let t = m(e);
|
|
62
|
+
(!f || t && f.type !== "thinking" || !t && f.type !== "text") && (f && (f.type === "text" ? a.push({
|
|
63
|
+
type: "text_end",
|
|
64
|
+
contentIndex: g.length - 1,
|
|
65
|
+
content: f.text,
|
|
66
|
+
partial: n
|
|
67
|
+
}) : a.push({
|
|
68
|
+
type: "thinking_end",
|
|
69
|
+
contentIndex: v(),
|
|
70
|
+
content: f.thinking,
|
|
71
|
+
partial: n
|
|
72
|
+
})), t ? (f = {
|
|
73
|
+
type: "thinking",
|
|
74
|
+
thinking: "",
|
|
75
|
+
thinkingSignature: void 0
|
|
76
|
+
}, n.content.push(f), a.push({
|
|
77
|
+
type: "thinking_start",
|
|
78
|
+
contentIndex: v(),
|
|
79
|
+
partial: n
|
|
80
|
+
})) : (f = {
|
|
81
|
+
type: "text",
|
|
82
|
+
text: ""
|
|
83
|
+
}, n.content.push(f), a.push({
|
|
84
|
+
type: "text_start",
|
|
85
|
+
contentIndex: v(),
|
|
86
|
+
partial: n
|
|
87
|
+
}))), f.type === "thinking" ? (f.thinking += e.text, f.thinkingSignature = p(f.thinkingSignature, e.thoughtSignature), a.push({
|
|
88
|
+
type: "thinking_delta",
|
|
89
|
+
contentIndex: v(),
|
|
90
|
+
delta: e.text,
|
|
91
|
+
partial: n
|
|
92
|
+
})) : (f.text += e.text, f.textSignature = p(f.textSignature, e.thoughtSignature), a.push({
|
|
93
|
+
type: "text_delta",
|
|
94
|
+
contentIndex: v(),
|
|
95
|
+
delta: e.text,
|
|
96
|
+
partial: n
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
if (e.functionCall) {
|
|
100
|
+
f &&= (f.type === "text" ? a.push({
|
|
101
|
+
type: "text_end",
|
|
102
|
+
contentIndex: v(),
|
|
103
|
+
content: f.text,
|
|
104
|
+
partial: n
|
|
105
|
+
}) : a.push({
|
|
106
|
+
type: "thinking_end",
|
|
107
|
+
contentIndex: v(),
|
|
108
|
+
content: f.thinking,
|
|
109
|
+
partial: n
|
|
110
|
+
}), null);
|
|
111
|
+
let t = e.functionCall.id, r = {
|
|
112
|
+
type: "toolCall",
|
|
113
|
+
id: !t || n.content.some((e) => e.type === "toolCall" && e.id === t) ? `${e.functionCall.name}_${Date.now()}_${++_}` : t,
|
|
114
|
+
name: e.functionCall.name || "",
|
|
115
|
+
arguments: e.functionCall.args ?? {},
|
|
116
|
+
...e.thoughtSignature && { thoughtSignature: e.thoughtSignature }
|
|
117
|
+
};
|
|
118
|
+
n.content.push(r), a.push({
|
|
119
|
+
type: "toolcall_start",
|
|
120
|
+
contentIndex: v(),
|
|
121
|
+
partial: n
|
|
122
|
+
}), a.push({
|
|
123
|
+
type: "toolcall_delta",
|
|
124
|
+
contentIndex: v(),
|
|
125
|
+
delta: JSON.stringify(r.arguments),
|
|
126
|
+
partial: n
|
|
127
|
+
}), a.push({
|
|
128
|
+
type: "toolcall_end",
|
|
129
|
+
contentIndex: v(),
|
|
130
|
+
toolCall: r,
|
|
131
|
+
partial: n
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
i?.finishReason && (n.rawStopReason = i.finishReason, n.stopReason = u(i.finishReason), n.content.some((e) => e.type === "toolCall") && n.stopReason === "stop" && (n.stopReason = "toolUse")), r.usageMetadata && (n.usage = {
|
|
136
|
+
input: (r.usageMetadata.promptTokenCount || 0) - (r.usageMetadata.cachedContentTokenCount || 0),
|
|
137
|
+
output: (r.usageMetadata.candidatesTokenCount || 0) + (r.usageMetadata.thoughtsTokenCount || 0),
|
|
138
|
+
cacheRead: r.usageMetadata.cachedContentTokenCount || 0,
|
|
139
|
+
cacheWrite: 0,
|
|
140
|
+
reasoning: r.usageMetadata.thoughtsTokenCount || 0,
|
|
141
|
+
totalTokens: r.usageMetadata.totalTokenCount || 0,
|
|
142
|
+
cost: {
|
|
143
|
+
input: 0,
|
|
144
|
+
output: 0,
|
|
145
|
+
cacheRead: 0,
|
|
146
|
+
cacheWrite: 0,
|
|
147
|
+
total: 0
|
|
148
|
+
}
|
|
149
|
+
}, t(e, n.usage));
|
|
150
|
+
}
|
|
151
|
+
if (f && (f.type === "text" ? a.push({
|
|
152
|
+
type: "text_end",
|
|
153
|
+
contentIndex: v(),
|
|
154
|
+
content: f.text,
|
|
155
|
+
partial: n
|
|
156
|
+
}) : a.push({
|
|
157
|
+
type: "thinking_end",
|
|
158
|
+
contentIndex: v(),
|
|
159
|
+
content: f.thinking,
|
|
160
|
+
partial: n
|
|
161
|
+
})), i?.signal?.aborted) throw Error("Request was aborted");
|
|
162
|
+
if (n.stopReason === "pending") throw Error("Google stream ended without a finish reason");
|
|
163
|
+
if (n.stopReason === "aborted" || n.stopReason === "error") {
|
|
164
|
+
let e = n.rawStopReason ? `Provider stopped with: ${n.rawStopReason}` : "An unknown error occurred";
|
|
165
|
+
throw Error(e);
|
|
166
|
+
}
|
|
167
|
+
a.push({
|
|
168
|
+
type: "done",
|
|
169
|
+
reason: n.stopReason,
|
|
170
|
+
message: n
|
|
171
|
+
}), a.end();
|
|
172
|
+
} catch (e) {
|
|
173
|
+
for (let e of n.content) "index" in e && delete e.index;
|
|
174
|
+
n.stopReason = i?.signal?.aborted ? "aborted" : "error", n.errorMessage = s(o(e)), a.push({
|
|
175
|
+
type: "error",
|
|
176
|
+
reason: n.stopReason,
|
|
177
|
+
error: n
|
|
178
|
+
}), a.end();
|
|
179
|
+
}
|
|
180
|
+
})(), a;
|
|
181
|
+
}, y = (t, n, r) => {
|
|
182
|
+
let a = r?.apiKey;
|
|
183
|
+
if (!a) throw Error(`No API key for provider: ${t.provider}`);
|
|
184
|
+
let o = i(t, n, r, a);
|
|
185
|
+
if (!r?.reasoning) return v(t, n, {
|
|
186
|
+
...o,
|
|
187
|
+
thinking: { enabled: !1 }
|
|
188
|
+
});
|
|
189
|
+
let s = e(t, r.reasoning), c = s === "off" ? "high" : s, l = t;
|
|
190
|
+
return C(l) || w(l) || S(l) ? v(t, n, {
|
|
191
|
+
...o,
|
|
192
|
+
thinking: {
|
|
193
|
+
enabled: !0,
|
|
194
|
+
level: E(c, l)
|
|
195
|
+
}
|
|
196
|
+
}) : v(t, n, {
|
|
197
|
+
...o,
|
|
198
|
+
thinking: {
|
|
199
|
+
enabled: !0,
|
|
200
|
+
budgetTokens: D(l, c, r.thinkingBudgets)
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
function b(e, t, n) {
|
|
205
|
+
let i = {};
|
|
206
|
+
e.baseUrl && (i.baseUrl = e.baseUrl, i.apiVersion = "");
|
|
207
|
+
let a = r({
|
|
208
|
+
...e.headers,
|
|
209
|
+
...n
|
|
210
|
+
});
|
|
211
|
+
return a && (i.headers = a), new d({
|
|
212
|
+
apiKey: t,
|
|
213
|
+
httpOptions: Object.keys(i).length > 0 ? i : void 0
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function x(e, t, n = {}) {
|
|
217
|
+
let r = g(e, t), i = {};
|
|
218
|
+
n.temperature !== void 0 && (i.temperature = n.temperature), n.maxTokens !== void 0 && (i.maxOutputTokens = n.maxTokens);
|
|
219
|
+
let o = l(e.id), s = t.tools?.length ? c(t.tools, n.toolChoice, o) : void 0, u = {
|
|
220
|
+
...Object.keys(i).length > 0 && i,
|
|
221
|
+
...t.systemPrompt && { systemInstruction: a(t.systemPrompt) },
|
|
222
|
+
...t.tools && t.tools.length > 0 && { tools: f(t.tools, !1, o) },
|
|
223
|
+
...s !== void 0 && { toolConfig: { functionCallingConfig: { mode: s } } }
|
|
224
|
+
};
|
|
225
|
+
if (n.thinking?.enabled && e.reasoning) {
|
|
226
|
+
let e = { includeThoughts: !0 };
|
|
227
|
+
n.thinking.level === void 0 ? n.thinking.budgetTokens !== void 0 && (e.thinkingBudget = n.thinking.budgetTokens) : e.thinkingLevel = n.thinking.level, u.thinkingConfig = e;
|
|
228
|
+
} else e.reasoning && n.thinking && !n.thinking.enabled && (u.thinkingConfig = T(e));
|
|
229
|
+
if (n.signal) {
|
|
230
|
+
if (n.signal.aborted) throw Error("Request aborted");
|
|
231
|
+
u.abortSignal = n.signal;
|
|
232
|
+
}
|
|
233
|
+
return {
|
|
234
|
+
model: e.id,
|
|
235
|
+
contents: r,
|
|
236
|
+
config: u
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
function S(e) {
|
|
240
|
+
return /gemma-?4/.test(e.id.toLowerCase());
|
|
241
|
+
}
|
|
242
|
+
function C(e) {
|
|
243
|
+
return /gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase());
|
|
244
|
+
}
|
|
245
|
+
function w(e) {
|
|
246
|
+
let t = e.id.toLowerCase();
|
|
247
|
+
return /gemini-3(?:\.\d+)?-flash/.test(t) || t === "gemini-flash-latest" || t === "gemini-flash-lite-latest";
|
|
248
|
+
}
|
|
249
|
+
function T(e) {
|
|
250
|
+
return C(e) ? { thinkingLevel: "LOW" } : w(e) || S(e) ? { thinkingLevel: "MINIMAL" } : { thinkingBudget: 0 };
|
|
251
|
+
}
|
|
252
|
+
function E(e, t) {
|
|
253
|
+
if (C(t)) switch (e) {
|
|
254
|
+
case "minimal":
|
|
255
|
+
case "low": return "LOW";
|
|
256
|
+
case "medium":
|
|
257
|
+
case "high": return "HIGH";
|
|
258
|
+
}
|
|
259
|
+
if (S(t)) switch (e) {
|
|
260
|
+
case "minimal":
|
|
261
|
+
case "low": return "MINIMAL";
|
|
262
|
+
case "medium":
|
|
263
|
+
case "high": return "HIGH";
|
|
264
|
+
}
|
|
265
|
+
switch (e) {
|
|
266
|
+
case "minimal": return "MINIMAL";
|
|
267
|
+
case "low": return "LOW";
|
|
268
|
+
case "medium": return "MEDIUM";
|
|
269
|
+
case "high": return "HIGH";
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function D(e, t, n) {
|
|
273
|
+
return n?.[t] === void 0 ? e.id.includes("2.5-pro") ? {
|
|
274
|
+
minimal: 128,
|
|
275
|
+
low: 2048,
|
|
276
|
+
medium: 8192,
|
|
277
|
+
high: 32768
|
|
278
|
+
}[t] : e.id.includes("2.5-flash-lite") ? {
|
|
279
|
+
minimal: 512,
|
|
280
|
+
low: 2048,
|
|
281
|
+
medium: 8192,
|
|
282
|
+
high: 24576
|
|
283
|
+
}[t] : e.id.includes("2.5-flash") ? {
|
|
284
|
+
minimal: 128,
|
|
285
|
+
low: 2048,
|
|
286
|
+
medium: 8192,
|
|
287
|
+
high: 24576
|
|
288
|
+
}[t] : -1 : n[t];
|
|
289
|
+
}
|
|
290
|
+
//#endregion
|
|
291
|
+
export { v as stream, y as streamSimple };
|