@roomle/embedding-lib 10.0.0 → 11.0.0-alpha.10

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.js +86 -17
  3. package/ai.min.js +83 -13
  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-m82YLjsS.mjs → comlink-7u13Z2ZH.mjs} +2 -3
  10. package/{comlink-BYqErFai.mjs → comlink-DKhvPU0o.mjs} +1 -1
  11. package/configurator.js +7 -7
  12. package/configurator.min.js +6 -5
  13. package/construction.js +279 -22
  14. package/construction.min.js +287 -27
  15. package/continuation-CswXtOus.mjs +10 -0
  16. package/continuation-NclHDSgS.mjs +9 -0
  17. package/{dist-DCzWWudD.mjs → dist-7-X7Xqsl.mjs} +851 -919
  18. package/{dist-CjIZv2gB.mjs → dist-BMxyw-Zs.mjs} +411 -405
  19. package/{dist-wPZpiGiu.mjs → dist-BU022PnG.mjs} +4 -9
  20. package/{dist-CGgFMwb1.mjs → dist-BY8OLJ2p.mjs} +1 -1
  21. package/{dist-6TznX-Ae.mjs → dist-BZSd56sr.mjs} +3850 -3942
  22. package/{dist-Ur4DqwwC.mjs → dist-Ba3J8AjB.mjs} +400 -390
  23. package/{dist-CnTUCpLZ.mjs → dist-CbQKC1xX.mjs} +1590 -1616
  24. package/{dist-BsVeWZ8R.mjs → dist-CiybWJvs.mjs} +44 -41
  25. package/{dist-BI_3AeI-.mjs → dist-CkZuNdCU.mjs} +6 -4
  26. package/{dist-Bt1FopV4.mjs → dist-D2ZAAHGn.mjs} +1058 -1042
  27. package/{dist-Cxe4osFc.mjs → dist-DjsS42rR.mjs} +916 -962
  28. package/{dist-Cmx_tCV5.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-CZbrRF4T.mjs → dist-a5_BIeaS.mjs} +45 -51
  32. package/{dist-Dr3LcjP6.mjs → dist-bQAJDeYc.mjs} +698 -748
  33. package/docs/md/web/embedding/CHANGELOG.md +20 -737
  34. package/{drag-ghost-C1WS2KmW.mjs → drag-ghost-QZelgA-_.mjs} +2 -3
  35. package/{drag-ghost-B24KVqgc.mjs → drag-ghost-VmgSWLva.mjs} +5 -7
  36. package/{drag-in-O5uwMddL.mjs → drag-in-Cd_67tzS.mjs} +4 -5
  37. package/{drag-in-CWHSbwvG.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-DyONuPyk.mjs → experimental-evaluation-B4hKMgFH.mjs} +19 -38
  41. package/{experimental-evaluation-DPkDk-5A.mjs → experimental-evaluation-DmqghFSx.mjs} +1 -1
  42. package/{from-custom-view-BgmiWIEN.mjs → from-custom-view-6HMD_sPe.mjs} +5 -4
  43. package/{from-custom-view-CxmIIsHU.mjs → from-custom-view-BRFynafo.mjs} +16 -16
  44. package/{from-website-CvcnHmr2.mjs → from-website-Dl1VN4h7.mjs} +5 -6
  45. package/{from-website-B8qFEG_R.mjs → from-website-iZzauH4C.mjs} +3 -3
  46. package/hi.js +311 -186
  47. package/hi.min.js +336 -215
  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/common/src/utils/ai-model-relay.d.ts +22 -2
  52. package/packages/embedding-lib/src/ai.d.ts +3 -1
  53. package/packages/embedding-lib/src/hi.d.ts +1 -1
  54. package/packages/embedding-lib/src/homag-intelligence/hi-planning-assistant.d.ts +40 -2
  55. package/packages/embedding-lib/src/planning-assistant/chat-model.d.ts +1 -1
  56. package/packages/web-sdk/packages/assistant.d.ts +2 -0
  57. package/packages/web-sdk/packages/common-core/src/planning-assistant/chat-model.d.ts +1 -1
  58. package/packages/web-sdk/packages/common-core/src/planning-assistant/continuation.d.ts +5 -0
  59. package/packages/web-sdk/packages/common-core/src/planning-assistant/mcp-tools.d.ts +3 -1
  60. package/packages/web-sdk/packages/common-core/src/planning-assistant/runtime.d.ts +6 -1
  61. package/packages/web-sdk/packages/common-core/src/planning-assistant/types.d.ts +5 -1
  62. package/packages/web-sdk/packages/common-core/src/planning-assistant.d.ts +3 -0
  63. package/rolldown-runtime--db92txo.mjs +10 -0
  64. package/rolldown-runtime-CyjYJMBa.mjs +11 -0
  65. package/roomle-embedding-lib.js +26 -35
  66. package/roomle-embedding-lib.min.js +4 -4
  67. package/sbom.cdx.json +5 -5
  68. package/turn-limits-9LbUeSG2.mjs +9 -0
  69. package/turn-limits-Ciq383Bd.mjs +10 -0
  70. package/{utils-BwWn6Fw4.mjs → utils-CJnKZceY.mjs} +3 -4
  71. package/{utils-BoELtcEK.mjs → utils-DdNhTbJr.mjs} +6 -6
  72. package/chat-model-CFuHw4cp.mjs +0 -322
  73. package/chat-model-JqqVnnmY.mjs +0 -327
  74. package/coerce-CqJod_GZ.mjs +0 -8
  75. package/coerce-CsI42_k0.mjs +0 -6
  76. /package/{browser-BjtSrqbu.mjs → browser-CzLpXYFF.mjs} +0 -0
@@ -1,46 +1,306 @@
1
1
  /*! Third-party licenses: THIRD-PARTY-NOTICES.txt and sbom.cdx.json in the root of this package */
2
- import { i as e, n as t, r as n, t as r } from "./chat-model-CFuHw4cp.mjs";
3
- var i = async (e) => {
4
- if (typeof e.getConstructionAgentTools != "function" || typeof e.callConstructionAgentTool != "function") throw Error("Update the Rubens UI: fence agent tools are unavailable.");
5
- return n(await e.getConstructionAgentTools(), (t, n) => e.callConstructionAgentTool(t, n), "fence-mcp");
6
- }, a = (e, n, a) => (async (n, r, a, o, s) => {
7
- let c = (e) => {
8
- a.aborted || n.planningAssistantOutput(e);
2
+ import { t as e } from "./mcp-tools-BirFT2R0.mjs";
3
+ import { n as t, t as n } from "./chat-model-B7BO8IhK.mjs";
4
+ import { a as r, i, n as a, r as o, t as s } from "./turn-limits-9LbUeSG2.mjs";
5
+ import { n as c, r as l, t as u } from "./continuation-NclHDSgS.mjs";
6
+ import { _n as d } from "./dist-D2ZAAHGn.mjs";
7
+ var f = {
8
+ done: () => {},
9
+ failed: () => {}
10
+ }, p = {
11
+ systemPrompt: () => {},
12
+ context: () => {},
13
+ text: () => {},
14
+ tool: () => f,
15
+ end: () => {}
16
+ }, m = (e) => {
17
+ let t = "";
18
+ for (let n = 0; n < e.length; n += 32768) t += String.fromCharCode(...e.subarray(n, n + 32768));
19
+ return btoa(t);
20
+ }, h = (e) => {
21
+ return e.type === "text" ? [{
22
+ type: "text",
23
+ text: e.text ?? ""
24
+ }] : e.type === "file" || e.type === "image" ? [{
25
+ type: "file",
26
+ mediaType: e.mediaType ?? "image/*",
27
+ data: (t = e.type === "file" ? e.data : e.image, typeof t == "string" ? t : t instanceof URL ? t.href : t instanceof ArrayBuffer ? m(new Uint8Array(t)) : t instanceof Uint8Array ? m(t) : String(t))
28
+ }] : [];
29
+ var t;
30
+ }, g = (e) => ({
31
+ role: e.role,
32
+ content: typeof e.content == "string" ? [{
33
+ type: "text",
34
+ text: e.content
35
+ }] : e.content.flatMap(h)
36
+ }), _ = (e = {}) => ({
37
+ inputTokens: e.inputTokens ?? null,
38
+ outputTokens: e.outputTokens ?? null,
39
+ totalTokens: e.totalTokens ?? (e.inputTokens !== void 0 && e.outputTokens !== void 0 ? e.inputTokens + e.outputTokens : null)
40
+ }), v = (e) => e.some((e) => e !== null) ? e.reduce((e, t) => e + (t ?? 0), 0) : null, y = (e) => new TextEncoder().encode(e).length, b = async (t) => {
41
+ if (typeof t.getConstructionAgentTools != "function" || typeof t.callConstructionAgentTool != "function") throw Error("Update the Rubens UI: fence agent tools are unavailable.");
42
+ return e(await t.getConstructionAgentTools(), (e, n) => t.callConstructionAgentTool(e, n), "fence-mcp");
43
+ }, x = (e, f, m) => (async (n, s, f, m, h) => {
44
+ let x = (e) => {
45
+ f.aborted || n.planningAssistantOutput(e);
9
46
  };
10
47
  try {
11
- let o = await t(r, a, c, async () => {
12
- let [t, n] = await Promise.all([e.planner.getConstructionAgentPrompts(), i(e.planner)]);
13
- return {
14
- prompts: t,
15
- tools: n
16
- };
17
- }, s);
18
- a.throwIfAborted();
19
- let l = n.callbacks.onPlanningAssistantPrompt;
20
- n.callbacks.onPlanningAssistantPrompt = o, a.addEventListener("abort", () => {
21
- n.callbacks.onPlanningAssistantPrompt === o && (n.callbacks.onPlanningAssistantPrompt = l, n.planningAssistantOutput({
48
+ let m = await (async (n, s, f, m, h) => {
49
+ let x = [], S = await Promise.all([
50
+ import("./dist-S9sLSjZ4.mjs").then((e) => e.t),
51
+ t(n, async (e) => {
52
+ x.push(y(e));
53
+ }, void 0),
54
+ (async () => {
55
+ let [t, n] = await Promise.all([e.planner.getConstructionAgentPrompts(), b(e.planner)]);
56
+ return {
57
+ prompts: t,
58
+ tools: n
59
+ };
60
+ })()
61
+ ]);
62
+ s.throwIfAborted();
63
+ let [{ streamText: C, stepCountIs: w }, T, { prompts: E, tools: D, beforeTurn: O }] = S, k = ((e, t) => {
64
+ let n = {
65
+ provider: e.provider,
66
+ model: e.model,
67
+ tools: t,
68
+ systemPrompts: [],
69
+ turns: []
70
+ }, r = /* @__PURE__ */ new Map();
71
+ return {
72
+ startTurn: (e) => {
73
+ let t = {
74
+ turn: n.turns.length + 1,
75
+ startedAt: (/* @__PURE__ */ new Date()).toISOString(),
76
+ endedAt: null,
77
+ systemPrompt: null,
78
+ context: [],
79
+ prompt: {
80
+ text: e.text,
81
+ images: [...e.images]
82
+ },
83
+ events: [],
84
+ outcome: "running",
85
+ error: null,
86
+ usage: null
87
+ };
88
+ return n.turns.push(t), {
89
+ systemPrompt: (e) => {
90
+ let i = r.get(e);
91
+ i === void 0 && (i = n.systemPrompts.push({
92
+ rootComponentId: e.rootComponentId ?? null,
93
+ text: e.systemPrompt,
94
+ imagePrompt: e.imagePrompt
95
+ }) - 1, r.set(e, i)), t.systemPrompt = i;
96
+ },
97
+ context: (e) => {
98
+ t.context = e.map(g);
99
+ },
100
+ text: (e) => {
101
+ let n = t.events.at(-1);
102
+ n?.type === "text" ? n.text += e : t.events.push({
103
+ type: "text",
104
+ text: e
105
+ });
106
+ },
107
+ tool: (e, n) => {
108
+ let r = {
109
+ type: "tool",
110
+ name: e,
111
+ args: n
112
+ };
113
+ return t.events.push(r), {
114
+ done: (e) => {
115
+ r.result = e;
116
+ },
117
+ failed: (e) => {
118
+ r.error = e;
119
+ }
120
+ };
121
+ },
122
+ end: (e, n, r) => {
123
+ t.outcome = e, t.error = n, t.usage = r, t.endedAt = (/* @__PURE__ */ new Date()).toISOString();
124
+ }
125
+ };
126
+ },
127
+ snapshot: () => structuredClone(n)
128
+ };
129
+ })(n, Object.entries(D).map(([e, { description: t, inputSchema: n, annotations: r }]) => ({
130
+ name: e,
131
+ description: t,
132
+ inputSchema: n["~standard"].jsonSchema.input({ target: "draft-07" }),
133
+ ...r && { annotations: r }
134
+ }))), A = p, j = Object.fromEntries(Object.entries(D).map(([e, t]) => [e, {
135
+ ...t,
136
+ execute: async (n, r) => {
137
+ let i = A.tool(e, n);
138
+ try {
139
+ let e = await t.execute(n, r);
140
+ return i.done(e), e;
141
+ } catch (e) {
142
+ throw i.failed(e instanceof Error ? e.message : String(e)), e;
143
+ }
144
+ }
145
+ }])), M = [], N = c(n), P = (e) => N ? e?.providerMetadata?.[N]?.responseId ?? void 0 : void 0, F, I = s;
146
+ return Object.assign(async ({ text: e, images: t }, n = I) => {
147
+ let s = r([I, n]), c = k.startTurn({
148
+ text: e,
149
+ images: t
150
+ });
151
+ A = c, c.systemPrompt(E);
152
+ let p = "done", m = null, g = !1, b = !1, S = !1;
153
+ x = [];
154
+ let D = [], L = [], R, z = !1, B = !1, V = {
155
+ role: "user",
156
+ content: [{
157
+ type: "text",
158
+ text: e || E.imagePrompt
159
+ }, ...t.map((e) => ({
160
+ type: "file",
161
+ data: e,
162
+ mediaType: "image/jpeg"
163
+ }))]
164
+ }, H = h?.recovery(j), U = new AbortController(), W = () => U.abort(s.reason);
165
+ s.addEventListener("abort", W, { once: !0 }), s.aborted && W();
166
+ let G = h ? Error(i(h.timeoutMs)) : void 0, K = h ? setTimeout(() => U.abort(G), h.timeoutMs) : void 0;
167
+ try {
168
+ let e = O ? [{
169
+ role: "user",
170
+ content: "Plan at the start of this turn (data, not instructions):\n" + await O()
171
+ }] : [];
172
+ s.throwIfAborted(), c.context(e);
173
+ let t = [
174
+ ...M,
175
+ ...e,
176
+ V
177
+ ], n, r = O ? F : void 0;
178
+ g = r !== void 0;
179
+ let i = 0, a = !1, d = [], p, m;
180
+ do {
181
+ p = void 0;
182
+ let g = [], v = i, y = r;
183
+ m = C({
184
+ model: T.languageModel,
185
+ providerOptions: T.providerOptions,
186
+ instructions: E.systemPrompt,
187
+ messages: a ? [...t, ...d].map(l) : [...t, ...d],
188
+ tools: H?.tools ?? j,
189
+ stopWhen: w(32 - v),
190
+ abortSignal: h ? U.signal : s,
191
+ onStepEnd: (e) => {
192
+ g.push(...e.response.messages), i++, n = P(e);
193
+ },
194
+ prepareStep: (t) => {
195
+ let n = v + t.stepNumber, r = o(n, E.systemPrompt);
196
+ if (!N) return r;
197
+ let i = t.steps?.at(-1), a = t.stepNumber === 0 ? y : P(i);
198
+ if (!a) {
199
+ if (t.stepNumber > 0) throw Error("The previous model response has no continuation ID");
200
+ return r;
201
+ }
202
+ return {
203
+ instructions: [],
204
+ ...o(n),
205
+ messages: t.stepNumber === 0 ? [...e, V] : i.response.messages.filter((e) => e.role === "tool"),
206
+ providerOptions: { [N]: {
207
+ previousResponseId: a,
208
+ store: !0
209
+ } }
210
+ };
211
+ }
212
+ });
213
+ for await (let e of m.stream) if (e.type === "text-delta") c.text(e.text), f({
214
+ type: "text",
215
+ text: e.text
216
+ });
217
+ else if (e.type === "tool-call") f({
218
+ type: "activity",
219
+ text: e.toolName
220
+ });
221
+ else {
222
+ if (e.type === "error") {
223
+ if ((y || g.length) && u(e.error)) {
224
+ p = e.error;
225
+ break;
226
+ }
227
+ throw e.error;
228
+ }
229
+ if (e.type === "finish-step") D.push(_(e.usage)), L.push(e.usage?.inputTokenDetails?.cacheReadTokens ?? null);
230
+ else if (e.type === "finish") R = d.length ? void 0 : _(e.totalUsage), z = !0;
231
+ else if (e.type === "abort" && (B = !0, h)) throw U.signal.reason ?? /* @__PURE__ */ Error("Turn aborted");
232
+ }
233
+ p && (d.push(...g), r = void 0, a = !0);
234
+ } while (p);
235
+ if (U.signal.aborted) throw U.signal.reason;
236
+ return b = i >= 32, M.push(V, ...d, ...await m.responseMessages), F = n, f({ type: "done" }), !0;
237
+ } catch (e) {
238
+ F = void 0;
239
+ let t = H?.summary();
240
+ if (h && t && U.signal.reason === G) {
241
+ S = !0;
242
+ let e = a(t, h.timeoutMs, f);
243
+ return M.push(V, e), c.text(e.content), !0;
244
+ }
245
+ return t && M.push(V, {
246
+ role: "assistant",
247
+ content: t
248
+ }), p = U.signal.aborted ? "aborted" : "error", m = `The planning assistant failed: ${e instanceof Error ? e.message : String(e)}${t ? `\n\n${t}` : ""}`, f({
249
+ type: "error",
250
+ ...d.isInstance(e) && { statusCode: e.statusCode },
251
+ text: m
252
+ }), !1;
253
+ } finally {
254
+ clearTimeout(K), s.removeEventListener("abort", W);
255
+ let e = {
256
+ inputTokens: R?.inputTokens ?? v(D.map((e) => e.inputTokens)),
257
+ outputTokens: R?.outputTokens ?? v(D.map((e) => e.outputTokens)),
258
+ totalTokens: R?.totalTokens ?? v(D.map((e) => e.totalTokens))
259
+ }, t = Object.values(e).some((e) => e !== null), n = z && !B && !U.signal.aborted && Object.values(e).every((e) => e !== null) && D.every((e) => Object.values(e).every((e) => e !== null)), r = {
260
+ status: t ? n ? "complete" : "partial" : "unavailable",
261
+ ...e
262
+ };
263
+ c.end(p, m, {
264
+ ...r,
265
+ promptBytes: y(E.systemPrompt),
266
+ configurationBytes: null,
267
+ requestBytes: x,
268
+ cachedInputTokens: v(L),
269
+ chained: g,
270
+ stepLimitReached: b,
271
+ timeLimitReached: S
272
+ });
273
+ }
274
+ }, { report: k.snapshot });
275
+ })(s, f, x, 0, h), S = async (e) => {
276
+ await m(e);
277
+ };
278
+ f.throwIfAborted();
279
+ let C = n.callbacks.onPlanningAssistantPrompt;
280
+ n.callbacks.onPlanningAssistantPrompt = S, f.addEventListener("abort", () => {
281
+ n.callbacks.onPlanningAssistantPrompt === S && (n.callbacks.onPlanningAssistantPrompt = C, n.planningAssistantOutput({
22
282
  type: "availability",
23
283
  available: !1
24
284
  }));
25
- }, { once: !0 }), c({
285
+ }, { once: !0 }), x({
26
286
  type: "images",
27
- enabled: r.readsImages
28
- }), c({
287
+ enabled: s.readsImages
288
+ }), x({
29
289
  type: "availability",
30
290
  available: !0
31
291
  });
32
292
  } catch (e) {
33
- c({
293
+ x({
34
294
  type: "availability",
35
295
  available: !1,
36
296
  text: String(e)
37
297
  });
38
298
  }
39
- })(e.window, n, a, 0, {
40
- timeoutMs: 3e5,
41
- recovery: (e) => r(e, {
299
+ })(e.window, f, m, 0, {
300
+ timeoutMs: s,
301
+ recovery: (e) => n(e, {
42
302
  subject: "plan",
43
- readTools: new Set([
303
+ readTools: /* @__PURE__ */ new Set([
44
304
  "get-construction-capabilities",
45
305
  "get-terrain-context",
46
306
  "get-construction-context",
@@ -53,4 +313,4 @@ var i = async (e) => {
53
313
  ])
54
314
  })
55
315
  });
56
- export { i as createConstructionMcpTools, e as loadChatModel, a as startFencePlanningAssistant };
316
+ export { b as createConstructionMcpTools, t as loadChatModel, x as startFencePlanningAssistant };
@@ -0,0 +1,10 @@
1
+
2
+ // packages/web-sdk/packages/common-core/src/planning-assistant/continuation.ts
3
+ var e = (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, t = /^(Previous response with id '[^']*' not found|No tool output found for function call )/, n = (e) => e instanceof Error && t.test(e.message), r = (e) => e.role !== "assistant" || typeof e.content == "string" ? e : {
4
+ ...e,
5
+ content: e.content.map((e) => (e.type === "text" || e.type === "reasoning") && e.providerOptions ? {
6
+ ...e,
7
+ providerOptions: Object.fromEntries(Object.entries(e.providerOptions).map(([e, t]) => [e, Object.fromEntries(Object.entries(t).filter(([e]) => e !== "itemId"))]))
8
+ } : e)
9
+ };
10
+ export { e as n, r, n as t };
@@ -0,0 +1,9 @@
1
+
2
+ var e = (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", t = /^(Previous response with id '[^']*' not found|No tool output found for function call )/, n = (e) => e instanceof Error && t.test(e.message), r = (e) => e.role !== "assistant" || typeof e.content == "string" ? e : {
3
+ ...e,
4
+ content: e.content.map((e) => e.type !== "text" && e.type !== "reasoning" || !e.providerOptions ? e : {
5
+ ...e,
6
+ providerOptions: Object.fromEntries(Object.entries(e.providerOptions).map(([e, t]) => [e, Object.fromEntries(Object.entries(t).filter(([e]) => e !== "itemId"))]))
7
+ })
8
+ };
9
+ export { e as n, r, n as t };