@hintergrund/ui 0.3.4 → 0.3.7

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.
Files changed (87) hide show
  1. package/dist/BuilderAgentPane-Vj3NCGvZ.js +25916 -0
  2. package/dist/IntegrationHealth-D1HcBrQn.js +218 -0
  3. package/dist/admin.js +22766 -28480
  4. package/dist/anthropic-messages-D8Vp-Ncs.js +3772 -0
  5. package/dist/azure-openai-responses-DnjyYuiz.js +168 -0
  6. package/dist/builder.js +27 -22
  7. package/dist/config.types-DZ5yfeqq.js +20 -0
  8. package/dist/deferred-tools-nxpq94I4.js +34 -0
  9. package/dist/diagnostics-x5QOwca_.js +91 -0
  10. package/dist/error-body-pXgvw5vV.js +68 -0
  11. package/dist/font-pool/LICENSES.txt +22 -0
  12. package/dist/font-pool/inter.ttf +0 -0
  13. package/dist/font-pool/inter.woff2 +0 -0
  14. package/dist/font-pool/jetbrains-mono.ttf +0 -0
  15. package/dist/font-pool/jetbrains-mono.woff2 +0 -0
  16. package/dist/font-pool/lora.ttf +0 -0
  17. package/dist/font-pool/lora.woff2 +0 -0
  18. package/dist/font-pool/merriweather.ttf +0 -0
  19. package/dist/font-pool/merriweather.woff2 +0 -0
  20. package/dist/font-pool/montserrat.ttf +0 -0
  21. package/dist/font-pool/montserrat.woff2 +0 -0
  22. package/dist/font-pool/playfair-display.ttf +0 -0
  23. package/dist/font-pool/playfair-display.woff2 +0 -0
  24. package/dist/font-pool/poppins.ttf +0 -0
  25. package/dist/font-pool/poppins.woff2 +0 -0
  26. package/dist/font-pool/roboto.ttf +0 -0
  27. package/dist/font-pool/roboto.woff2 +0 -0
  28. package/dist/font-pool/space-grotesk.ttf +0 -0
  29. package/dist/font-pool/space-grotesk.woff2 +0 -0
  30. package/dist/font-pool/work-sans.ttf +0 -0
  31. package/dist/font-pool/work-sans.woff2 +0 -0
  32. package/dist/github-copilot-headers-pRo3v4t7.js +27 -0
  33. package/dist/global-xsR9gLDa.js +30568 -0
  34. package/dist/google-generative-ai-BmzNjEvl.js +291 -0
  35. package/dist/google-shared-CG2Lbh1z.js +8746 -0
  36. package/dist/google-vertex-Dfla93V_.js +329 -0
  37. package/dist/hash-BixfZjoG.js +21 -0
  38. package/dist/headers-CnTiKpOL.js +24 -0
  39. package/dist/json-parse-CxjAnWaM.js +231 -0
  40. package/dist/legacy-Zmnk-v81.js +14 -0
  41. package/dist/login.js +131 -146
  42. package/dist/mail.js +694 -789
  43. package/dist/mistral-conversations-DeDb7Gbd.js +558 -0
  44. package/dist/openai-ClxLHXsh.js +5371 -0
  45. package/dist/openai-codex-responses-usgOtWUT.js +909 -0
  46. package/dist/openai-completions-D_nFQy7A.js +730 -0
  47. package/dist/openai-prompt-cache-Bm8Re6Vv.js +17 -0
  48. package/dist/openai-responses-BqL3PFsb.js +192 -0
  49. package/dist/openai-responses-shared-BhQj78KM.js +481 -0
  50. package/dist/pi-messages-CRx0yqMp.js +268 -0
  51. package/dist/pi-user-agent-CsXkkH60.js +20 -0
  52. package/dist/provider-env-Cj6X7Wly.js +35 -0
  53. package/dist/provider-retry-BGImU1PV.js +68 -0
  54. package/dist/rolldown-runtime-nTTD767F.js +37 -0
  55. package/dist/setup.js +391 -418
  56. package/dist/transform-messages-DvxSeyBQ.js +383 -0
  57. package/dist/ui.css +2 -1
  58. package/package.json +5 -5
  59. package/dist/BuilderAgentPane-CwG29LOX.js +0 -13938
  60. package/dist/IntegrationHealth-G_4vzV66.js +0 -209
  61. package/dist/anthropic-messages-BmLfYiwX.js +0 -5605
  62. package/dist/azure-openai-responses-yf2M6GVe.js +0 -222
  63. package/dist/client-Cd7yMX39.js +0 -7860
  64. package/dist/config.types-iZoywORE.js +0 -15
  65. package/dist/deferred-tools-BZWMWBYN.js +0 -28
  66. package/dist/error-body-BUPcH4GF.js +0 -71
  67. package/dist/github-copilot-headers-B1RBGoZi.js +0 -21
  68. package/dist/global-CTQcFve1.js +0 -36177
  69. package/dist/google-generative-ai-DkzwUYzL.js +0 -264
  70. package/dist/google-shared-DTgKMtfJ.js +0 -11710
  71. package/dist/google-vertex-D2IzqvQM.js +0 -305
  72. package/dist/hash-DFlR084x.js +0 -14
  73. package/dist/headers-D4iLzGaS.js +0 -21
  74. package/dist/json-parse-LZdWp-Nd.js +0 -232
  75. package/dist/legacy-CckexQcJ.js +0 -5
  76. package/dist/mistral-conversations-CNfKG0tU.js +0 -513
  77. package/dist/openai-codex-responses-BLNjExaC.js +0 -947
  78. package/dist/openai-completions-46IVoF2N.js +0 -741
  79. package/dist/openai-prompt-cache-BJwqbEDx.js +0 -13
  80. package/dist/openai-responses-BfHoZFHI.js +0 -184
  81. package/dist/openai-responses-shared-DOTQAbCj.js +0 -477
  82. package/dist/pi-messages-fnW87Z4Z.js +0 -251
  83. package/dist/pi-user-agent-CUqx-qiX.js +0 -13
  84. package/dist/provider-env-D2VjEV3S.js +0 -26
  85. package/dist/provider-retry-BsigVlMg.js +0 -67
  86. package/dist/select-Cke4DYH1.js +0 -78
  87. package/dist/transform-messages-CsKsy6b4.js +0 -398
@@ -1,222 +0,0 @@
1
- import { O as y, a as p, r as f, i as R, b as g } from "./client-Cd7yMX39.js";
2
- import { D as _, G as I } from "./BuilderAgentPane-CwG29LOX.js";
3
- import { f as O, n as v } from "./error-body-BUPcH4GF.js";
4
- import { h as P } from "./headers-D4iLzGaS.js";
5
- import { g as m } from "./provider-env-D2VjEV3S.js";
6
- import { r as b } from "./provider-retry-BsigVlMg.js";
7
- import { c as h, b as w } from "./transform-messages-CsKsy6b4.js";
8
- import { c as N } from "./openai-prompt-cache-BJwqbEDx.js";
9
- import { p as U, c as z, a as S } from "./openai-responses-shared-DOTQAbCj.js";
10
- typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(r) {
11
- return Promise.resolve().then(r);
12
- } });
13
- class M extends y {
14
- /**
15
- * API Client for interfacing with the Azure OpenAI API.
16
- *
17
- * @param {string | undefined} [opts.apiVersion=process.env['OPENAI_API_VERSION'] ?? undefined]
18
- * @param {string | undefined} [opts.endpoint=process.env['AZURE_OPENAI_ENDPOINT'] ?? undefined] - Your Azure endpoint, including the resource, e.g. `https://example-resource.azure.openai.com/`
19
- * @param {string | undefined} [opts.apiKey=process.env['AZURE_OPENAI_API_KEY'] ?? undefined]
20
- * @param {string | undefined} opts.deployment - A model deployment, if given, sets the base client URL to include `/deployments/{deployment}`.
21
- * @param {string | null | undefined} [opts.organization=process.env['OPENAI_ORG_ID'] ?? null]
22
- * @param {string} [opts.baseURL=process.env['OPENAI_BASE_URL']] - Sets the base URL for the API, e.g. `https://example-resource.azure.openai.com/openai/`.
23
- * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
24
- * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
25
- * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
26
- * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
27
- * @param {Headers} opts.defaultHeaders - Default headers to include with every request to the API.
28
- * @param {DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
29
- * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
30
- */
31
- constructor({ baseURL: a = f("OPENAI_BASE_URL"), apiKey: e = f("AZURE_OPENAI_API_KEY"), apiVersion: t = f("OPENAI_API_VERSION"), endpoint: n, deployment: s, azureADTokenProvider: o, dangerouslyAllowBrowser: i, ...u } = {}) {
32
- if (!t)
33
- throw new p("The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).");
34
- if (typeof o == "function" && (i = !0), !o && !e)
35
- throw new p("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");
36
- if (o && e)
37
- throw new p("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");
38
- if (u.defaultQuery = { ...u.defaultQuery, "api-version": t }, a) {
39
- if (n)
40
- throw new p("baseURL and endpoint are mutually exclusive");
41
- } else {
42
- if (n || (n = process.env.AZURE_OPENAI_ENDPOINT), !n)
43
- throw new p("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");
44
- a = `${n}/openai`;
45
- }
46
- super({
47
- apiKey: o ?? e,
48
- baseURL: a,
49
- ...u,
50
- ...i !== void 0 ? { dangerouslyAllowBrowser: i } : {}
51
- }), this.apiVersion = "", this.apiVersion = t, this.deploymentName = s;
52
- }
53
- async buildRequest(a, e = {}) {
54
- if (T.has(a.path) && a.method === "post" && a.body !== void 0) {
55
- if (!R(a.body))
56
- throw new Error("Expected request body to be an object");
57
- const t = this.deploymentName || a.body.model || a.__metadata?.model;
58
- t !== void 0 && !this.baseURL.includes("/deployments") && (a.path = `/deployments/${t}${a.path}`);
59
- }
60
- return super.buildRequest(a, e);
61
- }
62
- async authHeaders(a, e) {
63
- const t = e ?? { bearerAuth: !0, adminAPIKeyAuth: !0 };
64
- return t.bearerAuth && typeof this._options.apiKey == "string" ? g([{ "api-key": this.apiKey }]) : super.authHeaders(a, t);
65
- }
66
- }
67
- const T = /* @__PURE__ */ new Set([
68
- "/completions",
69
- "/chat/completions",
70
- "/embeddings",
71
- "/audio/transcriptions",
72
- "/audio/translations",
73
- "/audio/speech",
74
- "/images/generations",
75
- "/batches",
76
- "/images/edits"
77
- ]), L = "v1", k = /* @__PURE__ */ new Set(["openai", "openai-codex", "opencode", "azure-openai-responses"]), D = 16;
78
- function x(r) {
79
- const a = /* @__PURE__ */ new Map();
80
- if (!r)
81
- return a;
82
- for (const e of r.split(",")) {
83
- const t = e.trim();
84
- if (!t)
85
- continue;
86
- const [n, s] = t.split("=", 2);
87
- !n || !s || a.set(n.trim(), s.trim());
88
- }
89
- return a;
90
- }
91
- function K(r, a) {
92
- return a?.azureDeploymentName ? a.azureDeploymentName : x(m("AZURE_OPENAI_DEPLOYMENT_NAME_MAP", a?.env)).get(r.id) || r.id;
93
- }
94
- function V(r) {
95
- return O(v(r), "Azure OpenAI API error");
96
- }
97
- const Z = (r, a, e) => {
98
- const t = new _();
99
- return (async () => {
100
- const n = K(r, e), s = {
101
- role: "assistant",
102
- content: [],
103
- api: "azure-openai-responses",
104
- provider: r.provider,
105
- model: r.id,
106
- usage: {
107
- input: 0,
108
- output: 0,
109
- cacheRead: 0,
110
- cacheWrite: 0,
111
- totalTokens: 0,
112
- cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
113
- },
114
- stopReason: "pending",
115
- timestamp: Date.now()
116
- };
117
- try {
118
- const o = e?.apiKey;
119
- if (!o)
120
- throw new Error(`No API key for provider: ${r.provider}`);
121
- const i = C(r, o, e), u = h(a.tools, r.compat?.supportsOpenAIGrammarTools ?? !1);
122
- let c = G(r, a, e, n, u);
123
- const l = await e?.onPayload?.(c, r);
124
- l !== void 0 && (c = l);
125
- const A = {
126
- ...e?.signal ? { signal: e.signal } : {},
127
- ...e?.timeoutMs !== void 0 ? { timeout: e.timeoutMs } : {},
128
- maxRetries: 0
129
- }, { data: E, response: d } = await b(() => i.responses.create(c, A).withResponse(), {
130
- maxRetries: e?.maxRetries,
131
- maxRetryDelayMs: e?.maxRetryDelayMs,
132
- signal: e?.signal
133
- });
134
- if (await e?.onResponse?.({ status: d.status, headers: P(d.headers) }, r), t.push({ type: "start", partial: s }), await U(E, s, t, r, { grammarToolInputProperties: u }), e?.signal?.aborted)
135
- throw new Error("Request was aborted");
136
- if (s.stopReason === "pending")
137
- throw new Error("Azure OpenAI Responses stream ended without a stop reason");
138
- if (s.stopReason === "aborted" || s.stopReason === "error")
139
- throw new Error(s.errorMessage || "An unknown error occurred");
140
- t.push({ type: "done", reason: s.stopReason, message: s }), t.end();
141
- } catch (o) {
142
- for (const i of s.content)
143
- delete i.index, delete i.partialJson, delete i.customInput;
144
- s.stopReason = e?.signal?.aborted ? "aborted" : "error", s.errorMessage = V(o), t.push({ type: "error", reason: s.stopReason, error: s }), t.end();
145
- }
146
- })(), t;
147
- }, re = (r, a, e) => {
148
- const t = e?.apiKey;
149
- if (!t)
150
- throw new Error(`No API key for provider: ${r.provider}`);
151
- const n = w(r, a, e, t), s = e?.reasoning ? I(r, e.reasoning) : void 0;
152
- return Z(r, a, {
153
- ...n,
154
- reasoningEffort: s === "off" ? void 0 : s
155
- });
156
- };
157
- function $(r) {
158
- const a = r.trim().replace(/\/+$/, "");
159
- let e;
160
- try {
161
- e = new URL(a);
162
- } catch {
163
- throw new Error(`Invalid Azure OpenAI base URL: ${r}`);
164
- }
165
- const t = e.hostname.endsWith(".openai.azure.com") || e.hostname.endsWith(".cognitiveservices.azure.com") || e.hostname.endsWith(".ai.azure.com"), n = e.pathname.replace(/\/+$/, "");
166
- return t && (n === "" || n === "/" || n === "/openai" || n === "/openai/v1/responses") && (e.pathname = "/openai/v1", e.search = ""), e.toString().replace(/\/+$/, "");
167
- }
168
- function B(r) {
169
- return `https://${r}.openai.azure.com/openai/v1`;
170
- }
171
- function q(r, a) {
172
- const e = a?.azureApiVersion || m("AZURE_OPENAI_API_VERSION", a?.env) || L, t = a?.azureBaseUrl?.trim() || m("AZURE_OPENAI_BASE_URL", a?.env)?.trim() || void 0, n = a?.azureResourceName || m("AZURE_OPENAI_RESOURCE_NAME", a?.env);
173
- let s = t;
174
- if (!s && n && (s = B(n)), !s && r.baseUrl && (s = r.baseUrl), !s)
175
- throw new Error("Azure OpenAI base URL is required. Set AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME, or pass azureBaseUrl, azureResourceName, or model.baseUrl.");
176
- return {
177
- baseUrl: $(s),
178
- apiVersion: e
179
- };
180
- }
181
- function C(r, a, e) {
182
- const t = { ...r.headers };
183
- e?.headers && Object.assign(t, e.headers);
184
- const { baseUrl: n, apiVersion: s } = q(r, e);
185
- return new M({
186
- apiKey: a,
187
- apiVersion: s,
188
- dangerouslyAllowBrowser: !0,
189
- fetch: e?.fetch,
190
- defaultHeaders: t,
191
- baseURL: n
192
- });
193
- }
194
- function G(r, a, e, t, n = h(a.tools, r.compat?.supportsOpenAIGrammarTools ?? !1)) {
195
- const s = z(r, a, k, {
196
- grammarToolInputProperties: n
197
- }), o = {
198
- model: t,
199
- input: s,
200
- stream: !0,
201
- prompt_cache_key: N(e?.sessionId),
202
- store: !1
203
- };
204
- if (e?.maxTokens && (o.max_output_tokens = Math.max(e.maxTokens, D)), e?.temperature !== void 0 && (o.temperature = e?.temperature), a.tools && a.tools.length > 0 && (o.tools = S(a.tools, {
205
- supportsStrictMode: r.compat?.supportsStrictMode ?? !0,
206
- supportsOpenAIGrammarTools: r.compat?.supportsOpenAIGrammarTools ?? !1
207
- })), r.reasoning)
208
- if (e?.reasoningEffort || e?.reasoningSummary) {
209
- const i = e?.reasoningEffort ? r.thinkingLevelMap?.[e.reasoningEffort] ?? e.reasoningEffort : "medium";
210
- o.reasoning = {
211
- effort: i,
212
- summary: e?.reasoningSummary || "auto"
213
- }, o.include = ["reasoning.encrypted_content"];
214
- } else r.thinkingLevelMap?.off !== null && (o.reasoning = {
215
- effort: r.thinkingLevelMap?.off ?? "none"
216
- });
217
- return e?.samplingParams && Object.assign(o, e.samplingParams), o;
218
- }
219
- export {
220
- Z as stream,
221
- re as streamSimple
222
- };