@hintergrund/ui 0.1.10 → 0.1.14
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/{Builder-CHLO8Qn6.js → Builder-CeAPIdQ9.js} +8504 -8620
- package/dist/admin.js +6319 -6196
- package/dist/{anthropic-DnGfJCT8.js → anthropic-BJBSVFAF.js} +2 -2
- package/dist/{azure-openai-responses-ixZ4DJpC.js → azure-openai-responses-B13_C2U1.js} +9 -9
- package/dist/builder.js +3 -2
- package/dist/class-D-7kXFKU.js +96 -0
- package/dist/{global-lQxDrO8J.js → global-sT-BxRei.js} +1074 -1133
- package/dist/{google-B52djAfz.js → google-DkGaABDn.js} +22 -22
- package/dist/{google-shared-Vko-wWPR.js → google-shared-DwNDktpf.js} +1 -1
- package/dist/{google-vertex-0_fwJ0sa.js → google-vertex-CSDaY4Og.js} +5 -5
- package/dist/{json-parse-CMq4Lud0.js → json-parse-B4gFxgnW.js} +1 -1
- package/dist/login.js +21 -20
- package/dist/{mistral-DNoNjdHA.js → mistral-CyHo42hq.js} +2 -2
- package/dist/{openai-codex-responses-7B9htNRA.js → openai-codex-responses-lR1Rk7Qg.js} +13 -13
- package/dist/{openai-completions-Dk7BLARV.js → openai-completions-C82SBiye.js} +11 -11
- package/dist/{openai-responses-CTZa0siE.js → openai-responses-oQmN7b31.js} +2 -2
- package/dist/{openai-responses-shared-DGYGIZPG.js → openai-responses-shared-x2D0MKUa.js} +2 -2
- package/dist/props-DkIpnWKa.js +122 -0
- package/dist/setup.js +172 -0
- package/dist/ui.css +1 -1
- package/package.json +67 -66
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import {
|
|
3
|
-
import { b as
|
|
1
|
+
import { i as T, r as x, m as M, G as S, c as R, a as L, b as _ } from "./google-shared-DwNDktpf.js";
|
|
2
|
+
import { v as I, y as G, w as O, x as A } from "./Builder-CeAPIdQ9.js";
|
|
3
|
+
import { b as N, s as P } from "./transform-messages-CkpQp6fJ.js";
|
|
4
4
|
typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
|
|
5
5
|
return Promise.resolve().then(e);
|
|
6
6
|
} });
|
|
7
|
-
let
|
|
7
|
+
let E = 0;
|
|
8
8
|
const f = (e, s, n) => {
|
|
9
9
|
const i = new O();
|
|
10
10
|
return (async () => {
|
|
@@ -26,21 +26,21 @@ const f = (e, s, n) => {
|
|
|
26
26
|
timestamp: Date.now()
|
|
27
27
|
};
|
|
28
28
|
try {
|
|
29
|
-
const r = n?.apiKey ||
|
|
29
|
+
const r = n?.apiKey || I(e.provider) || "", c = W(e, r, n?.headers);
|
|
30
30
|
let u = B(e, s, n);
|
|
31
31
|
const y = await n?.onPayload?.(u, e);
|
|
32
32
|
y !== void 0 && (u = y);
|
|
33
|
-
const
|
|
33
|
+
const v = await c.models.generateContentStream(u);
|
|
34
34
|
i.push({ type: "start", partial: t });
|
|
35
35
|
let a = null;
|
|
36
36
|
const b = t.content, l = () => b.length - 1;
|
|
37
|
-
for await (const g of
|
|
37
|
+
for await (const g of v) {
|
|
38
38
|
t.responseId ||= g.responseId;
|
|
39
39
|
const d = g.candidates?.[0];
|
|
40
40
|
if (d?.content?.parts)
|
|
41
41
|
for (const o of d.content.parts) {
|
|
42
42
|
if (o.text !== void 0) {
|
|
43
|
-
const h =
|
|
43
|
+
const h = T(o);
|
|
44
44
|
(!a || h && a.type !== "thinking" || !h && a.type !== "text") && (a && (a.type === "text" ? i.push({
|
|
45
45
|
type: "text_end",
|
|
46
46
|
contentIndex: b.length - 1,
|
|
@@ -51,12 +51,12 @@ const f = (e, s, n) => {
|
|
|
51
51
|
contentIndex: l(),
|
|
52
52
|
content: a.thinking,
|
|
53
53
|
partial: t
|
|
54
|
-
})), h ? (a = { type: "thinking", thinking: "", thinkingSignature: void 0 }, t.content.push(a), i.push({ type: "thinking_start", contentIndex: l(), partial: t })) : (a = { type: "text", text: "" }, t.content.push(a), i.push({ type: "text_start", contentIndex: l(), partial: t }))), a.type === "thinking" ? (a.thinking += o.text, a.thinkingSignature =
|
|
54
|
+
})), h ? (a = { type: "thinking", thinking: "", thinkingSignature: void 0 }, t.content.push(a), i.push({ type: "thinking_start", contentIndex: l(), partial: t })) : (a = { type: "text", text: "" }, t.content.push(a), i.push({ type: "text_start", contentIndex: l(), partial: t }))), a.type === "thinking" ? (a.thinking += o.text, a.thinkingSignature = x(a.thinkingSignature, o.thoughtSignature), i.push({
|
|
55
55
|
type: "thinking_delta",
|
|
56
56
|
contentIndex: l(),
|
|
57
57
|
delta: o.text,
|
|
58
58
|
partial: t
|
|
59
|
-
})) : (a.text += o.text, a.textSignature =
|
|
59
|
+
})) : (a.text += o.text, a.textSignature = x(a.textSignature, o.thoughtSignature), i.push({
|
|
60
60
|
type: "text_delta",
|
|
61
61
|
contentIndex: l(),
|
|
62
62
|
delta: o.text,
|
|
@@ -77,7 +77,7 @@ const f = (e, s, n) => {
|
|
|
77
77
|
}), a = null);
|
|
78
78
|
const h = o.functionCall.id, p = {
|
|
79
79
|
type: "toolCall",
|
|
80
|
-
id: !h || t.content.some((C) => C.type === "toolCall" && C.id === h) ? `${o.functionCall.name}_${Date.now()}_${++
|
|
80
|
+
id: !h || t.content.some((C) => C.type === "toolCall" && C.id === h) ? `${o.functionCall.name}_${Date.now()}_${++E}` : h,
|
|
81
81
|
name: o.functionCall.name || "",
|
|
82
82
|
arguments: o.functionCall.args ?? {},
|
|
83
83
|
...o.thoughtSignature && { thoughtSignature: o.thoughtSignature }
|
|
@@ -126,11 +126,11 @@ const f = (e, s, n) => {
|
|
|
126
126
|
t.stopReason = n?.signal?.aborted ? "aborted" : "error", t.errorMessage = r instanceof Error ? r.message : JSON.stringify(r), i.push({ type: "error", reason: t.stopReason, error: t }), i.end();
|
|
127
127
|
}
|
|
128
128
|
})(), i;
|
|
129
|
-
},
|
|
130
|
-
const i = n?.apiKey ||
|
|
129
|
+
}, z = (e, s, n) => {
|
|
130
|
+
const i = n?.apiKey || I(e.provider);
|
|
131
131
|
if (!i)
|
|
132
132
|
throw new Error(`No API key for provider: ${e.provider}`);
|
|
133
|
-
const t =
|
|
133
|
+
const t = N(e, n, i);
|
|
134
134
|
if (!n?.reasoning)
|
|
135
135
|
return f(e, s, { ...t, thinking: { enabled: !1 } });
|
|
136
136
|
const r = G(e, n.reasoning), c = r === "off" ? "high" : r, u = e;
|
|
@@ -138,13 +138,13 @@ const f = (e, s, n) => {
|
|
|
138
138
|
...t,
|
|
139
139
|
thinking: {
|
|
140
140
|
enabled: !0,
|
|
141
|
-
level:
|
|
141
|
+
level: K(c, u)
|
|
142
142
|
}
|
|
143
143
|
}) : f(e, s, {
|
|
144
144
|
...t,
|
|
145
145
|
thinking: {
|
|
146
146
|
enabled: !0,
|
|
147
|
-
budgetTokens:
|
|
147
|
+
budgetTokens: U(u, c, n.thinkingBudgets)
|
|
148
148
|
}
|
|
149
149
|
});
|
|
150
150
|
};
|
|
@@ -160,7 +160,7 @@ function B(e, s, n = {}) {
|
|
|
160
160
|
n.temperature !== void 0 && (t.temperature = n.temperature), n.maxTokens !== void 0 && (t.maxOutputTokens = n.maxTokens);
|
|
161
161
|
const r = {
|
|
162
162
|
...Object.keys(t).length > 0 && t,
|
|
163
|
-
...s.systemPrompt && { systemInstruction:
|
|
163
|
+
...s.systemPrompt && { systemInstruction: P(s.systemPrompt) },
|
|
164
164
|
...s.tools && s.tools.length > 0 && { tools: L(s.tools) }
|
|
165
165
|
};
|
|
166
166
|
if (s.tools && s.tools.length > 0 && n.toolChoice ? r.toolConfig = {
|
|
@@ -170,7 +170,7 @@ function B(e, s, n = {}) {
|
|
|
170
170
|
} : r.toolConfig = void 0, n.thinking?.enabled && e.reasoning) {
|
|
171
171
|
const u = { includeThoughts: !0 };
|
|
172
172
|
n.thinking.level !== void 0 ? u.thinkingLevel = n.thinking.level : n.thinking.budgetTokens !== void 0 && (u.thinkingBudget = n.thinking.budgetTokens), r.thinkingConfig = u;
|
|
173
|
-
} else e.reasoning && n.thinking && !n.thinking.enabled && (r.thinkingConfig =
|
|
173
|
+
} else e.reasoning && n.thinking && !n.thinking.enabled && (r.thinkingConfig = H(e));
|
|
174
174
|
if (n.signal) {
|
|
175
175
|
if (n.signal.aborted)
|
|
176
176
|
throw new Error("Request aborted");
|
|
@@ -191,10 +191,10 @@ function m(e) {
|
|
|
191
191
|
function w(e) {
|
|
192
192
|
return /gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase());
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function H(e) {
|
|
195
195
|
return m(e) ? { thinkingLevel: "LOW" } : w(e) ? { thinkingLevel: "MINIMAL" } : k(e) ? { thinkingLevel: "MINIMAL" } : { thinkingBudget: 0 };
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function K(e, s) {
|
|
198
198
|
if (m(s))
|
|
199
199
|
switch (e) {
|
|
200
200
|
case "minimal":
|
|
@@ -224,7 +224,7 @@ function H(e, s) {
|
|
|
224
224
|
return "HIGH";
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function U(e, s, n) {
|
|
228
228
|
return n?.[s] !== void 0 ? n[s] : e.id.includes("2.5-pro") ? {
|
|
229
229
|
minimal: 128,
|
|
230
230
|
low: 2048,
|
|
@@ -244,5 +244,5 @@ function K(e, s, n) {
|
|
|
244
244
|
}
|
|
245
245
|
export {
|
|
246
246
|
f as streamGoogle,
|
|
247
|
-
|
|
247
|
+
z as streamSimpleGoogle
|
|
248
248
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z as ii } from "./Builder-CeAPIdQ9.js";
|
|
2
2
|
import { t as ri, s as re } from "./transform-messages-CkpQp6fJ.js";
|
|
3
3
|
typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(t) {
|
|
4
4
|
return Promise.resolve().then(t);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import {
|
|
1
|
+
import { i as E, r as x, m as v, G as O, c as w, a as R, b as M, T as h, R as G } from "./google-shared-DwNDktpf.js";
|
|
2
|
+
import { y as S, w as N, x as A } from "./Builder-CeAPIdQ9.js";
|
|
3
3
|
import { b as P, s as U } from "./transform-messages-CkpQp6fJ.js";
|
|
4
4
|
typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
|
|
5
5
|
return Promise.resolve().then(e);
|
|
@@ -37,17 +37,17 @@ const k = (e, t, n) => {
|
|
|
37
37
|
let d = z(e, t, n);
|
|
38
38
|
const C = await n?.onPayload?.(d, e);
|
|
39
39
|
C !== void 0 && (d = C);
|
|
40
|
-
const
|
|
40
|
+
const _ = await c.models.generateContentStream(d);
|
|
41
41
|
a.push({ type: "start", partial: i });
|
|
42
42
|
let o = null;
|
|
43
43
|
const I = i.content, u = () => I.length - 1;
|
|
44
|
-
for await (const l of
|
|
44
|
+
for await (const l of _) {
|
|
45
45
|
i.responseId ||= l.responseId;
|
|
46
46
|
const p = l.candidates?.[0];
|
|
47
47
|
if (p?.content?.parts)
|
|
48
48
|
for (const r of p.content.parts) {
|
|
49
49
|
if (r.text !== void 0) {
|
|
50
|
-
const g =
|
|
50
|
+
const g = E(r);
|
|
51
51
|
(!o || g && o.type !== "thinking" || !g && o.type !== "text") && (o && (o.type === "text" ? a.push({
|
|
52
52
|
type: "text_end",
|
|
53
53
|
contentIndex: I.length - 1,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as s } from "./Builder-CeAPIdQ9.js";
|
|
2
2
|
typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
|
|
3
3
|
return Promise.resolve().then(e);
|
|
4
4
|
} });
|
package/dist/login.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Y as F,
|
|
1
|
+
import { Y as F, a6 as G, Z as I, Q as K, ad as t, a7 as u, aa as s, $ as x, a3 as v, a4 as X, a8 as m, a5 as g, ab as $, V as r, ac as i, a0 as q, af as T, ag as Z, a2 as ee, aj as A, ak as W } from "./global-sT-BxRei.js";
|
|
2
|
+
import { p as re } from "./props-DkIpnWKa.js";
|
|
2
3
|
typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(f) {
|
|
3
4
|
return Promise.resolve().then(f);
|
|
4
5
|
} });
|
|
@@ -11,8 +12,8 @@ const le = {
|
|
|
11
12
|
};
|
|
12
13
|
function ue(f, B) {
|
|
13
14
|
G(B, !0), I(f, le);
|
|
14
|
-
let L =
|
|
15
|
-
|
|
15
|
+
let L = re(B, "config", 7), w = m(!1), y = m(""), h = m(""), c = m(""), p = m(""), b = m(!1);
|
|
16
|
+
K(() => {
|
|
16
17
|
const e = new URLSearchParams(window.location.search).get("error");
|
|
17
18
|
e && (t(c, e, !0), window.history.replaceState({}, "", window.location.pathname));
|
|
18
19
|
});
|
|
@@ -20,13 +21,13 @@ function ue(f, B) {
|
|
|
20
21
|
a.preventDefault(), t(c, ""), t(p, ""), t(b, !0);
|
|
21
22
|
try {
|
|
22
23
|
const e = {};
|
|
23
|
-
r(
|
|
24
|
+
r(h) && (e.email = r(h)), r(w) && (e.password = r(y));
|
|
24
25
|
const l = await (await fetch("/api/admin/login", {
|
|
25
26
|
method: "POST",
|
|
26
27
|
headers: { "Content-Type": "application/json" },
|
|
27
28
|
body: JSON.stringify(e)
|
|
28
29
|
})).json();
|
|
29
|
-
l.success ? l.requirePassword ? t(
|
|
30
|
+
l.success ? l.requirePassword ? t(w, !0) : l.emailSent ? t(p, l.message || "Check your email for the login link.", !0) : window.location.href = "/admin" : t(c, l.message ?? "An error occurred. Please try again.", !0);
|
|
30
31
|
} catch {
|
|
31
32
|
t(c, "An error occurred. Please try again.");
|
|
32
33
|
} finally {
|
|
@@ -38,37 +39,37 @@ function ue(f, B) {
|
|
|
38
39
|
return L();
|
|
39
40
|
},
|
|
40
41
|
set config(a) {
|
|
41
|
-
L(a),
|
|
42
|
+
L(a), $();
|
|
42
43
|
}
|
|
43
|
-
}, z = ie(), S = s(z),
|
|
44
|
+
}, z = ie(), S = s(z), j = u(s(S), 2);
|
|
44
45
|
{
|
|
45
46
|
var H = (a) => {
|
|
46
47
|
var e = ae(), n = u(s(e));
|
|
47
|
-
i(e), q(() =>
|
|
48
|
+
i(e), q(() => T(n, ` ${r(c) ?? ""}`)), v(a, e);
|
|
48
49
|
};
|
|
49
|
-
x(
|
|
50
|
+
x(j, (a) => {
|
|
50
51
|
r(c) && a(H);
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
|
-
var J = u(
|
|
54
|
+
var J = u(j, 2);
|
|
54
55
|
{
|
|
55
56
|
var O = (a) => {
|
|
56
57
|
var e = oe(), n = u(s(e));
|
|
57
|
-
i(e), q(() =>
|
|
58
|
+
i(e), q(() => T(n, ` ${r(p) ?? ""}`)), v(a, e);
|
|
58
59
|
}, U = (a) => {
|
|
59
60
|
var e = se(), n = s(e), l = s(n), _ = s(l), C = u(s(_), 2);
|
|
60
|
-
|
|
61
|
-
var
|
|
61
|
+
Z(C), i(_);
|
|
62
|
+
var R = u(_, 2);
|
|
62
63
|
{
|
|
63
64
|
var D = (o) => {
|
|
64
65
|
var d = te(), P = u(s(d), 2);
|
|
65
|
-
|
|
66
|
+
Z(P), i(d), q(() => P.disabled = r(b)), A(P, () => r(y), (Y) => t(y, Y)), v(o, d);
|
|
66
67
|
};
|
|
67
|
-
x(
|
|
68
|
-
r(
|
|
68
|
+
x(R, (o) => {
|
|
69
|
+
r(w) && o(D);
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
|
-
var k = u(
|
|
72
|
+
var k = u(R, 2), N = s(k);
|
|
72
73
|
{
|
|
73
74
|
var Q = (o) => {
|
|
74
75
|
var d = W("Please wait...");
|
|
@@ -82,14 +83,14 @@ function ue(f, B) {
|
|
|
82
83
|
});
|
|
83
84
|
}
|
|
84
85
|
i(k), i(l), i(n), i(e), q(() => {
|
|
85
|
-
C.disabled = r(b) || r(
|
|
86
|
-
}),
|
|
86
|
+
C.disabled = r(b) || r(w), k.disabled = r(b);
|
|
87
|
+
}), ee("submit", l, E), A(C, () => r(h), (o) => t(h, o)), v(a, e);
|
|
87
88
|
};
|
|
88
89
|
x(J, (a) => {
|
|
89
90
|
r(p) ? a(O) : a(U, -1);
|
|
90
91
|
});
|
|
91
92
|
}
|
|
92
|
-
return i(S), i(z), v(f, z),
|
|
93
|
+
return i(S), i(z), v(f, z), X(M);
|
|
93
94
|
}
|
|
94
95
|
customElements.define("hintergrund-login", F(ue, { config: {} }, [], []));
|
|
95
96
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v as Cn, y as Vu, w as Gu, x as Ju } from "./Builder-CeAPIdQ9.js";
|
|
2
2
|
import { s as Bu } from "./hash-DFlR084x.js";
|
|
3
|
-
import { p as Ir } from "./json-parse-
|
|
3
|
+
import { p as Ir } from "./json-parse-B4gFxgnW.js";
|
|
4
4
|
import { b as Yu, t as Qu, s as We } from "./transform-messages-CkpQp6fJ.js";
|
|
5
5
|
typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
|
|
6
6
|
return Promise.resolve().then(e);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v as P, y as Z, w as ee } from "./Builder-CeAPIdQ9.js";
|
|
2
2
|
import { h as N } from "./headers-u7rXGJ9f.js";
|
|
3
|
-
import { c as $, a as te, p as F } from "./openai-responses-shared-
|
|
3
|
+
import { c as $, a as te, p as F } from "./openai-responses-shared-x2D0MKUa.js";
|
|
4
4
|
import { b as re } from "./transform-messages-CkpQp6fJ.js";
|
|
5
5
|
typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
|
|
6
6
|
return Promise.resolve().then(e);
|
|
@@ -87,7 +87,7 @@ const ye = (e, r, t) => {
|
|
|
87
87
|
let a = we(e, r, t);
|
|
88
88
|
const c = await t?.onPayload?.(a, e);
|
|
89
89
|
c !== void 0 && (a = c);
|
|
90
|
-
const l = t?.sessionId || $e(), h = Fe(e.headers, t?.headers, i, n, t?.sessionId), g = Je(e.headers, t?.headers, i, n, l), d = JSON.stringify(a), b = t?.transport || "auto", f = b !== "sse" &&
|
|
90
|
+
const l = t?.sessionId || $e(), h = Fe(e.headers, t?.headers, i, n, t?.sessionId), g = Je(e.headers, t?.headers, i, n, l), d = JSON.stringify(a), b = t?.transport || "auto", f = b !== "sse" && z(t?.sessionId);
|
|
91
91
|
if (f && B(t?.sessionId), b !== "sse" && !f) {
|
|
92
92
|
let w = !1;
|
|
93
93
|
try {
|
|
@@ -160,7 +160,7 @@ const ye = (e, r, t) => {
|
|
|
160
160
|
o.stopReason = t?.signal?.aborted ? "aborted" : "error", o.errorMessage = n instanceof Error ? n.message : String(n), s.push({ type: "error", reason: o.stopReason, error: o }), s.end();
|
|
161
161
|
}
|
|
162
162
|
})(), s;
|
|
163
|
-
},
|
|
163
|
+
}, je = (e, r, t) => {
|
|
164
164
|
const s = t?.apiKey || P(e.provider);
|
|
165
165
|
if (!s)
|
|
166
166
|
throw new Error(`No API key for provider: ${e.provider}`);
|
|
@@ -220,7 +220,7 @@ function he(e) {
|
|
|
220
220
|
return r.protocol === "https:" && (r.protocol = "wss:"), r.protocol === "http:" && (r.protocol = "ws:"), r.toString();
|
|
221
221
|
}
|
|
222
222
|
async function me(e, r, t, s, o) {
|
|
223
|
-
await F(
|
|
223
|
+
await F(V(Se(e)), r, t, s, {
|
|
224
224
|
serviceTier: o?.serviceTier,
|
|
225
225
|
resolveServiceTier: H,
|
|
226
226
|
applyServiceTierPricing: (n, i) => U(n, i, s)
|
|
@@ -242,7 +242,7 @@ class C extends Error {
|
|
|
242
242
|
function ge(e) {
|
|
243
243
|
return e instanceof x || e instanceof C;
|
|
244
244
|
}
|
|
245
|
-
async function*
|
|
245
|
+
async function* V(e) {
|
|
246
246
|
for await (const r of e) {
|
|
247
247
|
const t = typeof r.type == "string" ? r.type : void 0;
|
|
248
248
|
if (t) {
|
|
@@ -318,7 +318,7 @@ async function* Se(e) {
|
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
const ve = "responses_websockets=2026-02-06", ke = 300 * 1e3, m = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(),
|
|
321
|
+
const ve = "responses_websockets=2026-02-06", ke = 300 * 1e3, m = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Set();
|
|
322
322
|
function O(e) {
|
|
323
323
|
let r = q.get(e);
|
|
324
324
|
return r || (r = {
|
|
@@ -348,19 +348,19 @@ function _e(e) {
|
|
|
348
348
|
m.clear();
|
|
349
349
|
}
|
|
350
350
|
se(_e);
|
|
351
|
-
function
|
|
352
|
-
return e ?
|
|
351
|
+
function z(e) {
|
|
352
|
+
return e ? j.has(e) : !1;
|
|
353
353
|
}
|
|
354
354
|
function B(e) {
|
|
355
355
|
if (!e)
|
|
356
356
|
return;
|
|
357
357
|
const r = O(e);
|
|
358
|
-
r.sseFallbacks++, r.websocketFallbackActive =
|
|
358
|
+
r.sseFallbacks++, r.websocketFallbackActive = z(e);
|
|
359
359
|
}
|
|
360
360
|
function Re(e, r) {
|
|
361
361
|
if (!e)
|
|
362
362
|
return;
|
|
363
|
-
|
|
363
|
+
j.add(e);
|
|
364
364
|
const t = O(e);
|
|
365
365
|
t.websocketFailures++, t.lastWebSocketError = _(r), t.websocketFallbackActive = !0;
|
|
366
366
|
}
|
|
@@ -622,7 +622,7 @@ async function Me(e, r, t, s, o, n, i, a) {
|
|
|
622
622
|
const b = a?.transport === "websocket-cached" || a?.transport === "auto", f = r, u = b && l ? Be(l, f) : f, y = a?.sessionId ? O(a.sessionId) : void 0;
|
|
623
623
|
y && (y.requests++, h ? y.connectionsReused++ : y.connectionsCreated++, b && y.cachedContextRequests++, u.store === !0 && y.storeTrueRequests++, y.lastInputItems = u.input?.length ?? 0, u.previous_response_id ? (y.deltaRequests++, y.lastDeltaInputItems = u.input?.length ?? 0, y.lastPreviousResponseId = u.previous_response_id) : (y.fullContextRequests++, y.lastDeltaInputItems = void 0, y.lastPreviousResponseId = void 0));
|
|
624
624
|
try {
|
|
625
|
-
if (c.send(JSON.stringify({ type: "response.create", ...u })), await F(De(
|
|
625
|
+
if (c.send(JSON.stringify({ type: "response.create", ...u })), await F(De(V(We(c, a?.signal)), s, o, i), s, o, n, {
|
|
626
626
|
serviceTier: a?.serviceTier,
|
|
627
627
|
resolveServiceTier: H,
|
|
628
628
|
applyServiceTierPricing: (w, p) => U(w, p, n)
|
|
@@ -696,5 +696,5 @@ function Je(e, r, t, s, o) {
|
|
|
696
696
|
export {
|
|
697
697
|
_e as closeOpenAICodexWebSocketSessions,
|
|
698
698
|
ye as streamOpenAICodexResponses,
|
|
699
|
-
|
|
699
|
+
je as streamSimpleOpenAICodexResponses
|
|
700
700
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { O as H } from "./client-Sh7wNjbG.js";
|
|
2
|
-
import {
|
|
2
|
+
import { v as F, y as j, w as G, x as $ } from "./Builder-CeAPIdQ9.js";
|
|
3
3
|
import { h as W } from "./headers-u7rXGJ9f.js";
|
|
4
|
-
import { p as q } from "./json-parse-
|
|
4
|
+
import { p as q } from "./json-parse-B4gFxgnW.js";
|
|
5
5
|
import { b as J, t as K, s as A } from "./transform-messages-CkpQp6fJ.js";
|
|
6
6
|
import { h as Y, b as V, i as Z, r as Q } from "./github-copilot-headers-DWh_6bE3.js";
|
|
7
7
|
typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
|
|
@@ -60,7 +60,7 @@ const se = (e, n, t) => {
|
|
|
60
60
|
}, { data: T, response: R } = await p.chat.completions.create(d, _).withResponse();
|
|
61
61
|
await t?.onResponse?.({ status: R.status, headers: W(R.headers) }, e), s.push({ type: "start", partial: o });
|
|
62
62
|
let x = null, c = null;
|
|
63
|
-
const k = /* @__PURE__ */ new Map(),
|
|
63
|
+
const k = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map(), v = o.content, C = (a) => v.indexOf(a), L = (a) => {
|
|
64
64
|
const f = C(a);
|
|
65
65
|
f !== -1 && (a.type === "text" ? s.push({
|
|
66
66
|
type: "text_end",
|
|
@@ -85,18 +85,18 @@ const se = (e, n, t) => {
|
|
|
85
85
|
}, v.push(c), s.push({ type: "thinking_start", contentIndex: C(c), partial: o })), c), U = (a) => {
|
|
86
86
|
const f = typeof a.index == "number" ? a.index : void 0;
|
|
87
87
|
let h = f !== void 0 ? k.get(f) : void 0;
|
|
88
|
-
return !h && a.id && (h =
|
|
88
|
+
return !h && a.id && (h = I.get(a.id)), h || (h = {
|
|
89
89
|
type: "toolCall",
|
|
90
90
|
id: a.id || "",
|
|
91
91
|
name: a.function?.name || "",
|
|
92
92
|
arguments: {},
|
|
93
93
|
partialArgs: "",
|
|
94
94
|
streamIndex: f
|
|
95
|
-
}, f !== void 0 && k.set(f, h), a.id &&
|
|
95
|
+
}, f !== void 0 && k.set(f, h), a.id && I.set(a.id, h), v.push(h), s.push({
|
|
96
96
|
type: "toolcall_start",
|
|
97
97
|
contentIndex: C(h),
|
|
98
98
|
partial: o
|
|
99
|
-
})), f !== void 0 && h.streamIndex === void 0 && (h.streamIndex = f, k.set(f, h)), a.id &&
|
|
99
|
+
})), f !== void 0 && h.streamIndex === void 0 && (h.streamIndex = f, k.set(f, h)), a.id && I.set(a.id, h), h;
|
|
100
100
|
};
|
|
101
101
|
for await (const a of T) {
|
|
102
102
|
if (!a || typeof a != "object")
|
|
@@ -142,12 +142,12 @@ const se = (e, n, t) => {
|
|
|
142
142
|
if (f?.delta?.tool_calls)
|
|
143
143
|
for (const g of f.delta.tool_calls) {
|
|
144
144
|
const m = U(g);
|
|
145
|
-
!m.id && g.id && (m.id = g.id,
|
|
146
|
-
let
|
|
147
|
-
g.function?.arguments && (
|
|
145
|
+
!m.id && g.id && (m.id = g.id, I.set(g.id, m)), !m.name && g.function?.name && (m.name = g.function.name);
|
|
146
|
+
let w = "";
|
|
147
|
+
g.function?.arguments && (w = g.function.arguments, m.partialArgs = (m.partialArgs ?? "") + g.function.arguments, m.arguments = q(m.partialArgs)), s.push({
|
|
148
148
|
type: "toolcall_delta",
|
|
149
149
|
contentIndex: C(m),
|
|
150
|
-
delta:
|
|
150
|
+
delta: w,
|
|
151
151
|
partial: o
|
|
152
152
|
});
|
|
153
153
|
}
|
|
@@ -155,7 +155,7 @@ const se = (e, n, t) => {
|
|
|
155
155
|
if (S && Array.isArray(S)) {
|
|
156
156
|
for (const g of S)
|
|
157
157
|
if (g.type === "reasoning.encrypted" && g.id && g.data) {
|
|
158
|
-
const m = o.content.find((
|
|
158
|
+
const m = o.content.find((w) => w.type === "toolCall" && w.id === g.id);
|
|
159
159
|
m && (m.thoughtSignature = JSON.stringify(g));
|
|
160
160
|
}
|
|
161
161
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { O as w } from "./client-Sh7wNjbG.js";
|
|
2
|
-
import {
|
|
2
|
+
import { v as d, y, w as E } from "./Builder-CeAPIdQ9.js";
|
|
3
3
|
import { h as b } from "./headers-u7rXGJ9f.js";
|
|
4
4
|
import { h as I, b as A, i as _, r as P } from "./github-copilot-headers-DWh_6bE3.js";
|
|
5
|
-
import { p as T, c as O, a as S } from "./openai-responses-shared-
|
|
5
|
+
import { p as T, c as O, a as S } from "./openai-responses-shared-x2D0MKUa.js";
|
|
6
6
|
import { b as C } from "./transform-messages-CkpQp6fJ.js";
|
|
7
7
|
typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
|
|
8
8
|
return Promise.resolve().then(e);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { x as S } from "./Builder-CeAPIdQ9.js";
|
|
2
2
|
import { s as v } from "./hash-DFlR084x.js";
|
|
3
|
-
import { p as x } from "./json-parse-
|
|
3
|
+
import { p as x } from "./json-parse-B4gFxgnW.js";
|
|
4
4
|
import { t as T, s as _ } from "./transform-messages-CkpQp6fJ.js";
|
|
5
5
|
typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(r) {
|
|
6
6
|
return Promise.resolve().then(r);
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { V as b, ad as R, j as y, a_ as A, W as D, bj as L, aJ as j, m as _, bh as O, bk as w, bl as P, bm as x, bn as B, bo as Y, bp as M, ao as N, bq as U, u as q, aO as $, br as z, bs as C } from "./global-sT-BxRei.js";
|
|
2
|
+
typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(r) {
|
|
3
|
+
return Promise.resolve().then(r);
|
|
4
|
+
} });
|
|
5
|
+
const G = {
|
|
6
|
+
get(r, t) {
|
|
7
|
+
let n = r.props.length;
|
|
8
|
+
for (; n--; ) {
|
|
9
|
+
let e = r.props[n];
|
|
10
|
+
if (_(e) && (e = e()), typeof e == "object" && e !== null && t in e) return e[t];
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
set(r, t, n) {
|
|
14
|
+
let e = r.props.length;
|
|
15
|
+
for (; e--; ) {
|
|
16
|
+
let i = r.props[e];
|
|
17
|
+
_(i) && (i = i());
|
|
18
|
+
const f = P(i, t);
|
|
19
|
+
if (f && f.set)
|
|
20
|
+
return f.set(n), !0;
|
|
21
|
+
}
|
|
22
|
+
return !1;
|
|
23
|
+
},
|
|
24
|
+
getOwnPropertyDescriptor(r, t) {
|
|
25
|
+
let n = r.props.length;
|
|
26
|
+
for (; n--; ) {
|
|
27
|
+
let e = r.props[n];
|
|
28
|
+
if (_(e) && (e = e()), typeof e == "object" && e !== null && t in e) {
|
|
29
|
+
const i = P(e, t);
|
|
30
|
+
return i && !i.configurable && (i.configurable = !0), i;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
has(r, t) {
|
|
35
|
+
if (t === O || t === w) return !1;
|
|
36
|
+
for (let n of r.props)
|
|
37
|
+
if (_(n) && (n = n()), n != null && t in n) return !0;
|
|
38
|
+
return !1;
|
|
39
|
+
},
|
|
40
|
+
ownKeys(r) {
|
|
41
|
+
const t = [];
|
|
42
|
+
for (let n of r.props)
|
|
43
|
+
if (_(n) && (n = n()), !!n) {
|
|
44
|
+
for (const e in n)
|
|
45
|
+
t.includes(e) || t.push(e);
|
|
46
|
+
for (const e of Object.getOwnPropertySymbols(n))
|
|
47
|
+
t.includes(e) || t.push(e);
|
|
48
|
+
}
|
|
49
|
+
return t;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
function K(...r) {
|
|
53
|
+
return new Proxy({ props: r }, G);
|
|
54
|
+
}
|
|
55
|
+
function V(r, t, n, e) {
|
|
56
|
+
var i = !$ || (n & z) !== 0, f = (n & U) !== 0, I = (n & C) !== 0, a = (
|
|
57
|
+
/** @type {V} */
|
|
58
|
+
e
|
|
59
|
+
), p = !0, g = () => (p && (p = !1, a = I ? q(
|
|
60
|
+
/** @type {() => V} */
|
|
61
|
+
e
|
|
62
|
+
) : (
|
|
63
|
+
/** @type {V} */
|
|
64
|
+
e
|
|
65
|
+
)), a);
|
|
66
|
+
let o;
|
|
67
|
+
if (f) {
|
|
68
|
+
var m = O in r || w in r;
|
|
69
|
+
o = P(r, t)?.set ?? (m && t in r ? (s) => r[t] = s : void 0);
|
|
70
|
+
}
|
|
71
|
+
var l, h = !1;
|
|
72
|
+
f ? [l, h] = x(() => (
|
|
73
|
+
/** @type {V} */
|
|
74
|
+
r[t]
|
|
75
|
+
)) : l = /** @type {V} */
|
|
76
|
+
r[t], l === void 0 && e !== void 0 && (l = g(), o && (i && B(), o(l)));
|
|
77
|
+
var u;
|
|
78
|
+
if (i ? u = () => {
|
|
79
|
+
var s = (
|
|
80
|
+
/** @type {V} */
|
|
81
|
+
r[t]
|
|
82
|
+
);
|
|
83
|
+
return s === void 0 ? g() : (p = !0, s);
|
|
84
|
+
} : u = () => {
|
|
85
|
+
var s = (
|
|
86
|
+
/** @type {V} */
|
|
87
|
+
r[t]
|
|
88
|
+
);
|
|
89
|
+
return s !== void 0 && (a = /** @type {V} */
|
|
90
|
+
void 0), s === void 0 ? a : s;
|
|
91
|
+
}, i && (n & Y) === 0)
|
|
92
|
+
return u;
|
|
93
|
+
if (o) {
|
|
94
|
+
var T = r.$$legacy;
|
|
95
|
+
return (
|
|
96
|
+
/** @type {() => V} */
|
|
97
|
+
(function(s, c) {
|
|
98
|
+
return arguments.length > 0 ? ((!i || !c || T || h) && o(c ? u() : s), s) : u();
|
|
99
|
+
})
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
var v = !1, d = ((n & M) !== 0 ? D : j)(() => (v = !1, u()));
|
|
103
|
+
f && b(d);
|
|
104
|
+
var E = (
|
|
105
|
+
/** @type {Effect} */
|
|
106
|
+
y
|
|
107
|
+
);
|
|
108
|
+
return (
|
|
109
|
+
/** @type {() => V} */
|
|
110
|
+
(function(s, c) {
|
|
111
|
+
if (arguments.length > 0) {
|
|
112
|
+
const S = c ? b(d) : i && f ? N(s) : s;
|
|
113
|
+
return R(d, S), v = !0, a !== void 0 && (a = S), s;
|
|
114
|
+
}
|
|
115
|
+
return L && v || (E.f & A) !== 0 ? d.v : b(d);
|
|
116
|
+
})
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
export {
|
|
120
|
+
V as p,
|
|
121
|
+
K as s
|
|
122
|
+
};
|