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