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