@hintergrund/ui 0.2.2 → 0.3.0

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 (47) hide show
  1. package/dist/BuilderAgentPane-EOT6JCrB.js +13849 -0
  2. package/dist/IntegrationHealth-ZCazAhaQ.js +280 -0
  3. package/dist/admin.js +27070 -27430
  4. package/dist/{anthropic-CwpwmW2G.js → anthropic-messages-Dl81zJep.js} +1134 -1055
  5. package/dist/azure-openai-responses-CrrDLA8-.js +222 -0
  6. package/dist/brand-DteO2G6R.js +95 -0
  7. package/dist/builder.js +18 -3
  8. package/dist/client-Cd7yMX39.js +7860 -0
  9. package/dist/deferred-tools-BZWMWBYN.js +28 -0
  10. package/dist/error-body-BUPcH4GF.js +71 -0
  11. package/dist/github-copilot-headers-B1RBGoZi.js +21 -0
  12. package/dist/{global-DdaMTl90.js → global-1QvFLK43.js} +18424 -16815
  13. package/dist/google-generative-ai-DrT6NouV.js +264 -0
  14. package/dist/{google-shared-zl4aoTwW.js → google-shared-mbv_hDdk.js} +1135 -1104
  15. package/dist/google-vertex-CjHfRBgt.js +305 -0
  16. package/dist/headers-D4iLzGaS.js +21 -0
  17. package/dist/json-parse-LZdWp-Nd.js +232 -0
  18. package/dist/{headers-u7rXGJ9f.js → legacy-ByJa-XpS.js} +2 -9
  19. package/dist/login.js +113 -75
  20. package/dist/mail.js +793 -0
  21. package/dist/mistral-conversations-DpV92sl0.js +513 -0
  22. package/dist/openai-codex-responses-Dw4e7edD.js +947 -0
  23. package/dist/openai-completions-DfWju8NF.js +741 -0
  24. package/dist/openai-prompt-cache-BJwqbEDx.js +13 -0
  25. package/dist/openai-responses-D22Qtayx.js +184 -0
  26. package/dist/openai-responses-shared-DGHcHw_F.js +477 -0
  27. package/dist/pi-messages-BJSKKlfC.js +251 -0
  28. package/dist/pi-user-agent-CUqx-qiX.js +13 -0
  29. package/dist/provider-env-D2VjEV3S.js +26 -0
  30. package/dist/provider-retry-BsigVlMg.js +67 -0
  31. package/dist/select-cKciKujV.js +78 -0
  32. package/dist/setup.js +537 -235
  33. package/dist/transform-messages-CsKsy6b4.js +398 -0
  34. package/package.json +5 -5
  35. package/dist/Builder-BhGmzNTC.js +0 -163449
  36. package/dist/azure-openai-responses-yWEFYMG1.js +0 -203
  37. package/dist/client-Sh7wNjbG.js +0 -5277
  38. package/dist/github-copilot-headers-DWh_6bE3.js +0 -35
  39. package/dist/google-BgPPfrTM.js +0 -248
  40. package/dist/google-vertex-D7kAAkZn.js +0 -285
  41. package/dist/json-parse-Dk_xwHcS.js +0 -93
  42. package/dist/mistral-BJWDROjc.js +0 -22932
  43. package/dist/openai-codex-responses-rzy0Aqwg.js +0 -700
  44. package/dist/openai-completions-CUEO2YVR.js +0 -535
  45. package/dist/openai-responses-k6plMvd9.js +0 -142
  46. package/dist/openai-responses-shared-CCD7nRqy.js +0 -324
  47. package/dist/transform-messages-CkpQp6fJ.js +0 -132
@@ -1,203 +0,0 @@
1
- import { O as E, a as c, r as p, i as h, b as _ } from "./client-Sh7wNjbG.js";
2
- import { d as f, h as R, e as y } from "./Builder-BhGmzNTC.js";
3
- import { h as g } from "./headers-u7rXGJ9f.js";
4
- import { p as I, c as v, a as O } from "./openai-responses-shared-CCD7nRqy.js";
5
- import { b } from "./transform-messages-CkpQp6fJ.js";
6
- typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(r) {
7
- return Promise.resolve().then(r);
8
- } });
9
- class N extends E {
10
- /**
11
- * API Client for interfacing with the Azure OpenAI API.
12
- *
13
- * @param {string | undefined} [opts.apiVersion=process.env['OPENAI_API_VERSION'] ?? undefined]
14
- * @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/`
15
- * @param {string | undefined} [opts.apiKey=process.env['AZURE_OPENAI_API_KEY'] ?? undefined]
16
- * @param {string | undefined} opts.deployment - A model deployment, if given, sets the base client URL to include `/deployments/{deployment}`.
17
- * @param {string | null | undefined} [opts.organization=process.env['OPENAI_ORG_ID'] ?? null]
18
- * @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/`.
19
- * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
20
- * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
21
- * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
22
- * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
23
- * @param {Headers} opts.defaultHeaders - Default headers to include with every request to the API.
24
- * @param {DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
25
- * @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.
26
- */
27
- constructor({ baseURL: n = p("OPENAI_BASE_URL"), apiKey: e = p("AZURE_OPENAI_API_KEY"), apiVersion: a = p("OPENAI_API_VERSION"), endpoint: t, deployment: s, azureADTokenProvider: o, dangerouslyAllowBrowser: i, ...u } = {}) {
28
- if (!a)
29
- throw new c("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' }).");
30
- if (typeof o == "function" && (i = !0), !o && !e)
31
- throw new c("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");
32
- if (o && e)
33
- throw new c("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");
34
- if (u.defaultQuery = { ...u.defaultQuery, "api-version": a }, n) {
35
- if (t)
36
- throw new c("baseURL and endpoint are mutually exclusive");
37
- } else {
38
- if (t || (t = process.env.AZURE_OPENAI_ENDPOINT), !t)
39
- throw new c("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");
40
- n = `${t}/openai`;
41
- }
42
- super({
43
- apiKey: o ?? e,
44
- baseURL: n,
45
- ...u,
46
- ...i !== void 0 ? { dangerouslyAllowBrowser: i } : {}
47
- }), this.apiVersion = "", this.apiVersion = a, this.deploymentName = s;
48
- }
49
- async buildRequest(n, e = {}) {
50
- if (w.has(n.path) && n.method === "post" && n.body !== void 0) {
51
- if (!h(n.body))
52
- throw new Error("Expected request body to be an object");
53
- const a = this.deploymentName || n.body.model || n.__metadata?.model;
54
- a !== void 0 && !this.baseURL.includes("/deployments") && (n.path = `/deployments/${a}${n.path}`);
55
- }
56
- return super.buildRequest(n, e);
57
- }
58
- async authHeaders(n) {
59
- return typeof this._options.apiKey == "string" ? _([{ "api-key": this.apiKey }]) : super.authHeaders(n);
60
- }
61
- }
62
- const w = /* @__PURE__ */ new Set([
63
- "/completions",
64
- "/chat/completions",
65
- "/embeddings",
66
- "/audio/transcriptions",
67
- "/audio/translations",
68
- "/audio/speech",
69
- "/images/generations",
70
- "/batches",
71
- "/images/edits"
72
- ]), P = "v1", U = /* @__PURE__ */ new Set(["openai", "openai-codex", "opencode", "azure-openai-responses"]);
73
- function z(r) {
74
- const n = /* @__PURE__ */ new Map();
75
- if (!r)
76
- return n;
77
- for (const e of r.split(",")) {
78
- const a = e.trim();
79
- if (!a)
80
- continue;
81
- const [t, s] = a.split("=", 2);
82
- !t || !s || n.set(t.trim(), s.trim());
83
- }
84
- return n;
85
- }
86
- function S(r, n) {
87
- return n?.azureDeploymentName ? n.azureDeploymentName : z(process.env.AZURE_OPENAI_DEPLOYMENT_NAME_MAP).get(r.id) || r.id;
88
- }
89
- const M = (r, n, e) => {
90
- const a = new y();
91
- return (async () => {
92
- const t = S(r, e), s = {
93
- role: "assistant",
94
- content: [],
95
- api: "azure-openai-responses",
96
- provider: r.provider,
97
- model: r.id,
98
- usage: {
99
- input: 0,
100
- output: 0,
101
- cacheRead: 0,
102
- cacheWrite: 0,
103
- totalTokens: 0,
104
- cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
105
- },
106
- stopReason: "stop",
107
- timestamp: Date.now()
108
- };
109
- try {
110
- const o = e?.apiKey || f(r.provider) || "", i = Z(r, o, e);
111
- let u = x(r, n, e, t);
112
- const m = await e?.onPayload?.(u, r);
113
- m !== void 0 && (u = m);
114
- const l = {
115
- ...e?.signal ? { signal: e.signal } : {},
116
- ...e?.timeoutMs !== void 0 ? { timeout: e.timeoutMs } : {},
117
- ...e?.maxRetries !== void 0 ? { maxRetries: e.maxRetries } : {}
118
- }, { data: A, response: d } = await i.responses.create(u, l).withResponse();
119
- if (await e?.onResponse?.({ status: d.status, headers: g(d.headers) }, r), a.push({ type: "start", partial: s }), await I(A, s, a, r), e?.signal?.aborted)
120
- throw new Error("Request was aborted");
121
- if (s.stopReason === "aborted" || s.stopReason === "error")
122
- throw new Error("An unknown error occurred");
123
- a.push({ type: "done", reason: s.stopReason, message: s }), a.end();
124
- } catch (o) {
125
- for (const i of s.content)
126
- delete i.index, delete i.partialJson;
127
- s.stopReason = e?.signal?.aborted ? "aborted" : "error", s.errorMessage = o instanceof Error ? o.message : JSON.stringify(o), a.push({ type: "error", reason: s.stopReason, error: s }), a.end();
128
- }
129
- })(), a;
130
- }, q = (r, n, e) => {
131
- const a = e?.apiKey || f(r.provider);
132
- if (!a)
133
- throw new Error(`No API key for provider: ${r.provider}`);
134
- const t = b(r, e, a), s = e?.reasoning ? R(r, e.reasoning) : void 0;
135
- return M(r, n, {
136
- ...t,
137
- reasoningEffort: s === "off" ? void 0 : s
138
- });
139
- };
140
- function L(r) {
141
- const n = r.trim().replace(/\/+$/, "");
142
- let e;
143
- try {
144
- e = new URL(n);
145
- } catch {
146
- throw new Error(`Invalid Azure OpenAI base URL: ${r}`);
147
- }
148
- const a = e.hostname.endsWith(".openai.azure.com") || e.hostname.endsWith(".cognitiveservices.azure.com"), t = e.pathname.replace(/\/+$/, "");
149
- return a && (t === "" || t === "/" || t === "/openai") && (e.pathname = "/openai/v1", e.search = ""), e.toString().replace(/\/+$/, "");
150
- }
151
- function k(r) {
152
- return `https://${r}.openai.azure.com/openai/v1`;
153
- }
154
- function T(r, n) {
155
- const e = n?.azureApiVersion || process.env.AZURE_OPENAI_API_VERSION || P, a = n?.azureBaseUrl?.trim() || process.env.AZURE_OPENAI_BASE_URL?.trim() || void 0, t = n?.azureResourceName || process.env.AZURE_OPENAI_RESOURCE_NAME;
156
- let s = a;
157
- if (!s && t && (s = k(t)), !s && r.baseUrl && (s = r.baseUrl), !s)
158
- 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.");
159
- return {
160
- baseUrl: L(s),
161
- apiVersion: e
162
- };
163
- }
164
- function Z(r, n, e) {
165
- if (!n) {
166
- if (!process.env.AZURE_OPENAI_API_KEY)
167
- throw new Error("Azure OpenAI API key is required. Set AZURE_OPENAI_API_KEY environment variable or pass it as an argument.");
168
- n = process.env.AZURE_OPENAI_API_KEY;
169
- }
170
- const a = { ...r.headers };
171
- e?.headers && Object.assign(a, e.headers);
172
- const { baseUrl: t, apiVersion: s } = T(r, e);
173
- return new N({
174
- apiKey: n,
175
- apiVersion: s,
176
- dangerouslyAllowBrowser: !0,
177
- defaultHeaders: a,
178
- baseURL: t
179
- });
180
- }
181
- function x(r, n, e, a) {
182
- const t = v(r, n, U), s = {
183
- model: a,
184
- input: t,
185
- stream: !0,
186
- prompt_cache_key: e?.sessionId
187
- };
188
- if (e?.maxTokens && (s.max_output_tokens = e?.maxTokens), e?.temperature !== void 0 && (s.temperature = e?.temperature), n.tools && n.tools.length > 0 && (s.tools = O(n.tools)), r.reasoning)
189
- if (e?.reasoningEffort || e?.reasoningSummary) {
190
- const o = e?.reasoningEffort ? r.thinkingLevelMap?.[e.reasoningEffort] ?? e.reasoningEffort : "medium";
191
- s.reasoning = {
192
- effort: o,
193
- summary: e?.reasoningSummary || "auto"
194
- }, s.include = ["reasoning.encrypted_content"];
195
- } else r.thinkingLevelMap?.off !== null && (s.reasoning = {
196
- effort: r.thinkingLevelMap?.off ?? "none"
197
- });
198
- return s;
199
- }
200
- export {
201
- M as streamAzureOpenAIResponses,
202
- q as streamSimpleAzureOpenAIResponses
203
- };