@roomle/embedding-lib 0.0.0-dev-20f436f → 0.0.0-dev-86c52f1

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 (76) hide show
  1. package/THIRD-PARTY-NOTICES.txt +2 -2
  2. package/ai-model-host-CS8tMlto.mjs +144 -0
  3. package/ai-model-host-D_b_GVlC.mjs +145 -0
  4. package/ai.js +1 -128
  5. package/ai.min.js +1 -126
  6. package/{browser-D6M-d6y5.mjs → browser-Cys-y5Hy.mjs} +1 -2
  7. package/chat-model-DooKwd8I.mjs +117 -0
  8. package/chat-model-KHuz1Ej9.mjs +118 -0
  9. package/coerce-CuLRCRlo.mjs +6 -0
  10. package/coerce-Dup0o-HR.mjs +7 -0
  11. package/{comlink-CG3f9q6z.mjs → comlink-7u13Z2ZH.mjs} +2 -3
  12. package/{comlink-hSUzCx9j.mjs → comlink-DKhvPU0o.mjs} +1 -1
  13. package/configurator.js +3 -4
  14. package/configurator.min.js +2 -2
  15. package/construction.js +17865 -37
  16. package/construction.min.js +17536 -41
  17. package/{dist-Cm3aF4sf.mjs → dist-7-X7Xqsl.mjs} +851 -919
  18. package/{dist-BQaw78-_.mjs → dist-BMxyw-Zs.mjs} +411 -405
  19. package/{dist-0WZWTj8T.mjs → dist-BU022PnG.mjs} +4 -9
  20. package/{dist-DkR6G9Kj.mjs → dist-BY8OLJ2p.mjs} +1 -1
  21. package/{dist-70R0b5Mq.mjs → dist-Ba3J8AjB.mjs} +400 -390
  22. package/{dist-CTS0DDwt.mjs → dist-CbQKC1xX.mjs} +1590 -1616
  23. package/{dist-BmOBP9h9.mjs → dist-CiybWJvs.mjs} +44 -41
  24. package/{dist-CPG4atmb.mjs → dist-CkZuNdCU.mjs} +6 -4
  25. package/{dist-Bt1FopV4.mjs → dist-D2ZAAHGn.mjs} +1058 -1042
  26. package/{dist-BWNv7qW9.mjs → dist-DjsS42rR.mjs} +916 -962
  27. package/{dist-9UI7dzwc.mjs → dist-Jcq_kKKT.mjs} +403 -393
  28. package/{dist-BV-32IEX.mjs → dist-XECXrV5Q.mjs} +1497 -1558
  29. package/{dist-Bc2s-kJZ.mjs → dist-a5_BIeaS.mjs} +45 -51
  30. package/{dist-Crrp-Bno.mjs → dist-bQAJDeYc.mjs} +698 -748
  31. package/{drag-ghost-BpIDzSdK.mjs → drag-ghost-QZelgA-_.mjs} +2 -3
  32. package/{drag-ghost-Bhb0_67G.mjs → drag-ghost-VmgSWLva.mjs} +5 -7
  33. package/{drag-in-mE_ozj_Q.mjs → drag-in-Cd_67tzS.mjs} +4 -5
  34. package/{drag-in-CGBG4wEk.mjs → drag-in-DlDsgY4T.mjs} +3 -3
  35. package/embedding-plugins.js +1 -2
  36. package/embedding-plugins.min.js +1 -2
  37. package/{experimental-evaluation-FzKFGoye.mjs → experimental-evaluation-B4hKMgFH.mjs} +19 -38
  38. package/{experimental-evaluation-DczxmJme.mjs → experimental-evaluation-DmqghFSx.mjs} +1 -1
  39. package/{from-custom-view-B3fIWMox.mjs → from-custom-view-6HMD_sPe.mjs} +5 -4
  40. package/{from-custom-view-B3HCOhdT.mjs → from-custom-view-BRFynafo.mjs} +16 -16
  41. package/{from-website-DaTahmvJ.mjs → from-website-Dl1VN4h7.mjs} +5 -6
  42. package/{from-website-DUQ9USj1.mjs → from-website-iZzauH4C.mjs} +3 -3
  43. package/hi.js +80 -428
  44. package/hi.min.js +75 -376
  45. package/mcp-tools-C6O2gQZW.mjs +41 -0
  46. package/mcp-tools-m_3IX0vB.mjs +40 -0
  47. package/package.json +1 -1
  48. package/packages/embedding-lib/src/ai-model-host.d.ts +34 -0
  49. package/packages/embedding-lib/src/ai.d.ts +11 -27
  50. package/packages/embedding-lib/src/homag-intelligence/hi-planning-assistant.d.ts +11 -19
  51. package/packages/web-sdk/packages/assistant.d.ts +3 -1
  52. package/packages/web-sdk/packages/common-core/src/planning-assistant/chat-recovery.d.ts +5 -1
  53. package/packages/web-sdk/packages/common-core/src/planning-assistant/continuation.d.ts +5 -3
  54. package/packages/web-sdk/packages/common-core/src/planning-assistant/runtime.d.ts +4 -1
  55. package/packages/web-sdk/packages/common-core/src/planning-assistant/types.d.ts +2 -0
  56. package/packages/web-sdk/packages/common-core/src/planning-assistant/usage.d.ts +31 -0
  57. package/packages/web-sdk/packages/common-core/src/planning-assistant.d.ts +19 -1
  58. package/rolldown-runtime--db92txo.mjs +10 -0
  59. package/rolldown-runtime-CyjYJMBa.mjs +11 -0
  60. package/roomle-embedding-lib.js +25 -34
  61. package/roomle-embedding-lib.min.js +3 -3
  62. package/sbom.cdx.json +5 -5
  63. package/usage-C3HE9yXi.mjs +33 -0
  64. package/usage-CYqDPQOx.mjs +34 -0
  65. package/{utils-BwWn6Fw4.mjs → utils-CJnKZceY.mjs} +3 -4
  66. package/{utils-BoELtcEK.mjs → utils-DdNhTbJr.mjs} +6 -6
  67. package/chat-model-C1ov616e.mjs +0 -377
  68. package/chat-model-CifTV-8H.mjs +0 -373
  69. package/coerce-CqJod_GZ.mjs +0 -8
  70. package/coerce-CsI42_k0.mjs +0 -6
  71. package/dist-6TznX-Ae.mjs +0 -17514
  72. package/dist-D0XFfKEL.mjs +0 -17079
  73. package/mcp-tools-CC8DTfZA.mjs +0 -2
  74. package/mcp-tools-CfJ_ue_2.mjs +0 -2
  75. package/packages/embedding-lib/src/homag-intelligence/hi-planning-usage.d.ts +0 -54
  76. /package/{browser-BjtSrqbu.mjs → browser-CzLpXYFF.mjs} +0 -0
@@ -1,377 +0,0 @@
1
-
2
- import { _n as e } from "./dist-BV-32IEX.mjs";
3
- //#region packages/web-sdk/packages/common-core/src/planning-assistant/chat-model.ts
4
- var t = "The images of this result follow in the next message.", n = (e) => e.flatMap((e) => {
5
- if (e.role !== "tool") return [e];
6
- let n = [], r = e.content.map((e) => {
7
- if (e.type !== "tool-result" || e.output.type !== "content") return e;
8
- let r = e.output.value.filter((e) => e.type === "file");
9
- return r.length ? (n.push(...r), {
10
- ...e,
11
- output: {
12
- ...e.output,
13
- value: [...e.output.value.filter((e) => e.type !== "file"), {
14
- type: "text",
15
- text: t
16
- }]
17
- }
18
- }) : e;
19
- });
20
- return n.length ? [{
21
- ...e,
22
- content: r
23
- }, {
24
- role: "user",
25
- content: n
26
- }] : [e];
27
- }), r = (e) => ({
28
- specificationVersion: e.specificationVersion,
29
- provider: e.provider,
30
- modelId: e.modelId,
31
- supportedUrls: e.supportedUrls,
32
- doGenerate: (t) => e.doGenerate({
33
- ...t,
34
- prompt: n(t.prompt)
35
- }),
36
- doStream: (t) => e.doStream({
37
- ...t,
38
- prompt: n(t.prompt)
39
- })
40
- }), i = async ({ provider: e, model: t, apiKey: n, baseUrl: i, headers: a, chatCompletions: o, responses: s, storedResponses: c, reasoningEffort: l }, u, d) => {
41
- let f = u ? { fetch: new Proxy(fetch, { apply: async (e, t, n) => (typeof n[1]?.body == "string" && await u(n[1].body), fetch(...n)) }) } : {};
42
- switch (e) {
43
- case "host":
44
- if (!d) throw Error("The host assistant model is unavailable.");
45
- return { languageModel: d };
46
- case "openai": {
47
- let { createOpenAI: e } = await import("./dist-BWNv7qW9.mjs");
48
- return { languageModel: e({
49
- apiKey: n,
50
- ...f
51
- })(t) };
52
- }
53
- case "azure": {
54
- let { createAzure: e } = await import("./dist-Crrp-Bno.mjs"), r = e({
55
- apiKey: n,
56
- baseURL: i,
57
- ...f
58
- });
59
- return {
60
- languageModel: o ? r.chat(t) : r(t),
61
- providerOptions: l ? { azure: { reasoningEffort: l } } : void 0
62
- };
63
- }
64
- case "openai-compatible": {
65
- if (!i) throw Error("The provider \"openai-compatible\" needs a baseUrl");
66
- if (s) {
67
- let { createOpenAI: e } = await import("./dist-BWNv7qW9.mjs"), r = {
68
- ...!n && !a?.Authorization ? { Authorization: void 0 } : {},
69
- ...a
70
- };
71
- return {
72
- languageModel: e({
73
- baseURL: i,
74
- apiKey: n ?? "none",
75
- headers: r,
76
- ...f
77
- }).responses(t),
78
- providerOptions: { openai: c ? { store: !0 } : {
79
- store: !1,
80
- forceReasoning: !0
81
- } }
82
- };
83
- }
84
- let { createOpenAICompatible: e } = await import("./dist-0WZWTj8T.mjs");
85
- return { languageModel: r(e({
86
- name: "openai-compatible",
87
- baseURL: i,
88
- apiKey: n,
89
- headers: a,
90
- includeUsage: !0,
91
- ...f
92
- })(t)) };
93
- }
94
- case "mistral": {
95
- let { createMistral: e } = await import("./dist-Bc2s-kJZ.mjs");
96
- return { languageModel: r(e({
97
- apiKey: n,
98
- ...f
99
- })(t)) };
100
- }
101
- case "anthropic": {
102
- let { createAnthropic: e } = await import("./dist-CTS0DDwt.mjs");
103
- return { languageModel: e({
104
- apiKey: n,
105
- headers: { "anthropic-dangerous-direct-browser-access": "true" },
106
- ...f
107
- })(t) };
108
- }
109
- case "google": {
110
- let { createGoogleGenerativeAI: e } = await import("./dist-Cm3aF4sf.mjs");
111
- return { languageModel: e({
112
- apiKey: n,
113
- ...f
114
- })(t) };
115
- }
116
- default: throw Error(`Unknown provider "${e}" - supported: azure, openai, openai-compatible, mistral, anthropic, google`);
117
- }
118
- }, a = ({ output: e }) => ({
119
- type: "content",
120
- value: e.content.map((e) => e.type === "text" ? {
121
- type: "text",
122
- text: e.text
123
- } : {
124
- type: "file",
125
- mediaType: e.mimeType,
126
- data: {
127
- type: "data",
128
- data: e.data
129
- }
130
- })
131
- }), o = (e, t, n) => Object.fromEntries(e.map(({ name: e, description: r, inputSchema: i, annotations: o }) => {
132
- let s = () => i;
133
- return [e, {
134
- type: "dynamic",
135
- ...o && { annotations: o },
136
- description: r,
137
- inputSchema: { "~standard": {
138
- version: 1,
139
- vendor: n,
140
- validate: (e) => ({ value: e }),
141
- jsonSchema: {
142
- input: s,
143
- output: s
144
- }
145
- } },
146
- execute: async (n, r) => (r?.abortSignal?.throwIfAborted(), t(e, n).catch((e) => ({
147
- content: [{
148
- type: "text",
149
- text: e instanceof Error ? e.message : String(e)
150
- }],
151
- isError: !0
152
- }))),
153
- toModelOutput: a
154
- }];
155
- })), s = (e) => AbortSignal.any(e), c = (e) => e.provider === "host" ? e.responsesProvider ?? null : e.provider === "openai" || e.provider === "openai-compatible" && e.responses && e.storedResponses ? "openai" : e.provider === "azure" && !e.chatCompletions ? "azure" : null, l = /^(Previous response with id '[^']*' not found|No tool output found for function call )/, u = (e) => e instanceof Error && l.test(e.message), d = (e) => e.role !== "assistant" || typeof e.content == "string" ? e : {
156
- ...e,
157
- content: e.content.map((e) => (e.type === "text" || e.type === "reasoning") && e.providerOptions ? {
158
- ...e,
159
- providerOptions: Object.fromEntries(Object.entries(e.providerOptions).map(([e, t]) => [e, Object.fromEntries(Object.entries(t).filter(([e]) => e !== "itemId"))]))
160
- } : e)
161
- }, f = (e = {}) => ({
162
- inputTokens: e.inputTokens ?? null,
163
- outputTokens: e.outputTokens ?? null,
164
- totalTokens: e.totalTokens ?? (e.inputTokens !== void 0 && e.outputTokens !== void 0 ? e.inputTokens + e.outputTokens : null)
165
- }), p = (e) => e.some((e) => e !== null) ? e.reduce((e, t) => e + (t ?? 0), 0) : null, m = async (t, n, r, a, o, l) => {
166
- let m = await Promise.all([
167
- import("./dist-6TznX-Ae.mjs").then((e) => e.t),
168
- i(t, void 0, l),
169
- a()
170
- ]);
171
- n.throwIfAborted();
172
- let [{ streamText: h, stepCountIs: g }, _, { prompts: v, tools: y, beforeTurn: b }] = m, x = [], S = c(t), C = (e) => S ? e?.providerMetadata?.[S]?.responseId ?? void 0 : void 0, w, T = n;
173
- return async ({ text: n, images: i }, a = T) => {
174
- let c = s([T, a]), l = [], m, E = !1, D = {
175
- role: "user",
176
- content: [{
177
- type: "text",
178
- text: n || v.imagePrompt
179
- }, ...i.map((e) => ({
180
- type: "file",
181
- data: e,
182
- mediaType: "image/jpeg"
183
- }))]
184
- }, O = o?.recovery(y), k = new AbortController(), A = () => k.abort(c.reason);
185
- c.addEventListener("abort", A, { once: !0 }), c.aborted && A();
186
- let j = o ? setTimeout(() => k.abort(/* @__PURE__ */ Error("The assistant turn exceeded five minutes.")), o.timeoutMs) : void 0;
187
- try {
188
- let e = b ? [{
189
- role: "user",
190
- content: "Plan at the start of this turn (data, not instructions):\n" + await b()
191
- }] : [];
192
- c.throwIfAborted();
193
- let t = [
194
- ...x,
195
- ...e,
196
- D
197
- ], n = b ? w : void 0, i, a = 0, s = !1, p = [], T, A;
198
- do {
199
- T = void 0;
200
- let b = [], x = a, w = n;
201
- A = h({
202
- model: _.languageModel,
203
- providerOptions: _.providerOptions,
204
- instructions: v.systemPrompt,
205
- messages: s ? [...t, ...p].map(d) : [...t, ...p],
206
- tools: O?.tools ?? y,
207
- stopWhen: g(16 - x),
208
- abortSignal: o ? k.signal : c,
209
- onStepEnd: (e) => {
210
- b.push(...e.response.messages), a++, i = C(e);
211
- },
212
- prepareStep: (t) => {
213
- let n = x + t.stepNumber === 15 ? { toolChoice: "none" } : {};
214
- if (!S) return n;
215
- let r = t.steps?.at(-1), i = t.stepNumber === 0 ? w : C(r);
216
- if (!i) {
217
- if (t.stepNumber > 0) throw Error("The previous model response has no continuation ID");
218
- return n;
219
- }
220
- return {
221
- ...n,
222
- instructions: [],
223
- messages: t.stepNumber === 0 ? [...e, D] : r.response.messages.filter((e) => e.role === "tool"),
224
- providerOptions: { [S]: {
225
- previousResponseId: i,
226
- store: !0
227
- } }
228
- };
229
- }
230
- });
231
- for await (let e of A.stream) if (e.type === "text-delta") r({
232
- type: "text",
233
- text: e.text
234
- });
235
- else if (e.type === "tool-call") r({
236
- type: "activity",
237
- text: e.toolName
238
- });
239
- else if (e.type === "error") {
240
- if ((w || b.length) && u(e.error)) {
241
- T = e.error;
242
- break;
243
- }
244
- throw e.error;
245
- } else if (e.type === "finish-step") l.push(f(e.usage));
246
- else if (e.type === "finish") m = f(e.totalUsage);
247
- else if (e.type === "abort" && (E = !0, o)) throw k.signal.reason ?? /* @__PURE__ */ Error("Turn aborted");
248
- T && (p.push(...b), n = void 0, s = !0);
249
- } while (T);
250
- if (k.signal.aborted) throw k.signal.reason;
251
- x.push(D, ...p, ...await A.responseMessages), w = i, r({ type: "done" });
252
- } catch (t) {
253
- w = void 0;
254
- let n = O?.summary();
255
- n && x.push(D, {
256
- role: "assistant",
257
- content: n
258
- }), r({
259
- type: "error",
260
- ...e.isInstance(t) && { statusCode: t.statusCode },
261
- text: `The planning assistant failed: ${t instanceof Error ? t.message : String(t)}${n ? `\n\n${n}` : ""}`
262
- });
263
- } finally {
264
- clearTimeout(j), c.removeEventListener("abort", A);
265
- let e = {
266
- inputTokens: m?.inputTokens ?? p(l.map((e) => e.inputTokens)),
267
- outputTokens: m?.outputTokens ?? p(l.map((e) => e.outputTokens)),
268
- totalTokens: m?.totalTokens ?? p(l.map((e) => e.totalTokens))
269
- }, n = Object.values(e).some((e) => e !== null), r = m && !E && !k.signal.aborted && Object.values(e).every((e) => e !== null) && l.every((e) => Object.values(e).every((e) => e !== null));
270
- console.log(`[planning-assistant] usage ${JSON.stringify({
271
- provider: t.provider,
272
- model: t.model,
273
- status: n ? r ? "complete" : "partial" : "unavailable",
274
- ...e
275
- })}`);
276
- }
277
- };
278
- }, h = {
279
- undo: "Undo",
280
- redo: "Redo",
281
- "change-component-parameter": "Component parameter change",
282
- "change-global-parameter": "Global parameter change",
283
- "dock-component": "Component dock",
284
- "drag-component": "Component drag",
285
- "delete-component": "Component deletion",
286
- "load-configuration": "Configuration load",
287
- "get-configurator-capabilities": "Capabilities read",
288
- "get-configuration": "Configuration read",
289
- "get-component-parameters": "Component parameters read",
290
- "get-global-parameters": "Global parameters read",
291
- "get-possible-children": "Possible children read",
292
- "get-docking-positions": "Docking positions read",
293
- "get-component-docking-positions": "Component docking positions read",
294
- "get-delete-impact": "Delete impact read"
295
- }, g = new Set(Object.keys(h).filter((e) => e.startsWith("get-"))), _ = (e) => {
296
- if (e instanceof Error) return e.message;
297
- try {
298
- return typeof e == "string" ? e : JSON.stringify(e) ?? String(e);
299
- } catch {
300
- return Object.prototype.toString.call(e);
301
- }
302
- }, v = (e) => {
303
- if (e?.structuredContent !== void 0) return e.structuredContent;
304
- let t = e?.content?.filter((e) => e.type === "text").map((e) => e.text).join("\n");
305
- if (t === void 0) return e;
306
- try {
307
- return JSON.parse(t);
308
- } catch {
309
- return t;
310
- }
311
- }, y = (e) => {
312
- if (!e || typeof e != "object") return e == null ? [] : [_(e)];
313
- let t = [];
314
- for (let n of [
315
- "applied",
316
- "undone",
317
- "redone",
318
- "confirmed",
319
- "canUndo",
320
- "canRedo"
321
- ]) e[n] !== void 0 && t.push(`${n}: ${_(e[n])}`);
322
- return e.hint && t.push(_(e.hint)), t;
323
- }, b = (e, t = {
324
- subject: "configuration",
325
- readTools: g
326
- }) => {
327
- let n = [];
328
- return {
329
- tools: Object.fromEntries(Object.entries(e).map(([e, t]) => {
330
- if (!t.execute) return [e, t];
331
- let r = t.execute.bind(t);
332
- return [e, {
333
- ...t,
334
- execute: async (t, i) => {
335
- let a = {
336
- toolName: e,
337
- status: "pending"
338
- };
339
- n.push(a);
340
- try {
341
- let e = await r(t, i);
342
- return a.result = e, a.status = "returned", e;
343
- } catch (e) {
344
- throw a.error = e, a.status = "threw", e;
345
- }
346
- }
347
- }];
348
- })),
349
- summary: () => {
350
- let e = ["The assistant's reply was interrupted. Any text above is incomplete."];
351
- if (!n.length) return e.push(`No tool ran, so the ${t.subject} was not changed.`), e.join("\n\n");
352
- for (let r of n) {
353
- let n = h[r.toolName] ?? r.toolName;
354
- if (t.readTools.has(r.toolName)) {
355
- let i = r.status === "returned" && !r.result?.isError, a = i ? v(r.result) : void 0;
356
- e.push(i ? `- Completed ${n}: ${a?.complete === !1 ? "some requested information was unresolved" : "information was returned"}. The read did not change the ${t.subject}.` : `- Incomplete ${n}: ${r.status === "pending" ? "no result was received" : "the read failed"}. The read did not change the ${t.subject}.`);
357
- continue;
358
- }
359
- if (r.status === "returned" && !r.result?.isError) {
360
- let i = v(r.result);
361
- if (i?.confirmed === !1) {
362
- e.push(`- Unconfirmed ${n}: ${i?.hint ?? i?.unresolved?.join(" ") ?? `the SDK did not confirm the ${t.subject} change`}. Check the ${t.subject} before trying this operation again.`);
363
- continue;
364
- }
365
- let a = y(i);
366
- e.push(`- Completed ${n}: ${a.length ? a.join("; ") : "the tool returned successfully."}`);
367
- } else {
368
- let i = r.status === "threw" ? _(r.error) : r.status === "returned" ? _(v(r.result)) : "no result was received";
369
- e.push(`- Unconfirmed ${n}: ${i}. Check the ${t.subject} before trying this operation again.`);
370
- }
371
- }
372
- return e.push("These are the recorded tool outcomes; no operation was repeated automatically."), e.join("\n\n");
373
- }
374
- };
375
- };
376
- //#endregion
377
- export { o as a, s as i, m as n, i as o, c as r, b as t };