@roomle/embedding-lib 9.1.0-alpha.3 → 10.0.0-alpha.1

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 (53) hide show
  1. package/THIRD-PARTY-NOTICES.txt +1 -1
  2. package/chat-model-DKlWonm6.mjs +322 -0
  3. package/chat-model-gyIajfDW.mjs +327 -0
  4. package/configurator.js +1 -1
  5. package/configurator.min.js +1 -1
  6. package/construction.d.ts +2 -0
  7. package/construction.js +58 -0
  8. package/construction.min.js +56 -0
  9. package/{dist-XEy6Tk_Y.mjs → dist-6TznX-Ae.mjs} +1657 -1484
  10. package/{dist-B9yy8ym8.mjs → dist-BsVeWZ8R.mjs} +1 -1
  11. package/{dist-Bb2L1Zel.mjs → dist-CjIZv2gB.mjs} +1 -1
  12. package/{dist-5jYYtT4q.mjs → dist-Cmx_tCV5.mjs} +1 -1
  13. package/{dist-C5fKJXpB.mjs → dist-CnTUCpLZ.mjs} +1 -1
  14. package/{dist-GTk8ppiK.mjs → dist-Cxe4osFc.mjs} +1 -1
  15. package/{dist-DJtonrDM.mjs → dist-D0XFfKEL.mjs} +3081 -2908
  16. package/{dist-Bo3WzRdf.mjs → dist-DCzWWudD.mjs} +1 -1
  17. package/docs/md/web/embedding/CHANGELOG.md +46 -120
  18. package/{drag-ghost-yXe7c8jA.mjs → drag-ghost-B24KVqgc.mjs} +1 -1
  19. package/{drag-ghost-D7FnWbO4.mjs → drag-ghost-C1WS2KmW.mjs} +1 -1
  20. package/{drag-in-t7T6Pqwc.mjs → drag-in-CWHSbwvG.mjs} +3 -3
  21. package/{drag-in-BiEe2Lgv.mjs → drag-in-O5uwMddL.mjs} +3 -3
  22. package/embedding-plugins.js +1 -1
  23. package/embedding-plugins.min.js +1 -1
  24. package/{from-custom-view-CTBapIc6.mjs → from-custom-view-BgmiWIEN.mjs} +3 -3
  25. package/{from-custom-view-xbjgsLll.mjs → from-custom-view-CxmIIsHU.mjs} +3 -3
  26. package/{from-website-JwG7Ic_U.mjs → from-website-B8qFEG_R.mjs} +3 -3
  27. package/{from-website-DUPMQPl6.mjs → from-website-CvcnHmr2.mjs} +3 -3
  28. package/hi.js +4 -4
  29. package/hi.min.js +4 -4
  30. package/package.json +8 -1
  31. package/packages/embedding-lib/src/construction-agent/construction-mcp-tools.d.ts +10 -0
  32. package/packages/embedding-lib/src/construction-agent/construction-planning-assistant.d.ts +7 -0
  33. package/packages/embedding-lib/src/construction.d.ts +3 -0
  34. package/packages/embedding-lib/src/planning-assistant/chat-recovery.d.ts +1 -0
  35. package/packages/embedding-lib/src/planning-assistant/planning-assistant.d.ts +15 -0
  36. package/packages/web-sdk/packages/assistant.d.ts +3 -1
  37. package/roomle-embedding-lib.js +2 -2
  38. package/roomle-embedding-lib.min.js +2 -2
  39. package/sbom.cdx.json +5 -5
  40. package/mcp-tools-Cnhgobge.mjs +0 -153
  41. package/mcp-tools-D3Ei3Apu.mjs +0 -151
  42. /package/{browser-D6As4Zxr.mjs → browser-BjtSrqbu.mjs} +0 -0
  43. /package/{browser-zrjtYpL8.mjs → browser-D6M-d6y5.mjs} +0 -0
  44. /package/{dist-CXemOs84.mjs → dist-BI_3AeI-.mjs} +0 -0
  45. /package/{dist-CqpDM10w.mjs → dist-CGgFMwb1.mjs} +0 -0
  46. /package/{dist-CqP0aX0A.mjs → dist-CZbrRF4T.mjs} +0 -0
  47. /package/{dist-D0kh4WfT.mjs → dist-Dr3LcjP6.mjs} +0 -0
  48. /package/{dist-COgAdYY1.mjs → dist-Ur4DqwwC.mjs} +0 -0
  49. /package/{dist-D5HdKuwj.mjs → dist-wPZpiGiu.mjs} +0 -0
  50. /package/{experimental-evaluation-D56MbtjO.mjs → experimental-evaluation-DPkDk-5A.mjs} +0 -0
  51. /package/{experimental-evaluation-BgWFolud.mjs → experimental-evaluation-DyONuPyk.mjs} +0 -0
  52. /package/{utils-CAAGdgk8.mjs → utils-BoELtcEK.mjs} +0 -0
  53. /package/{utils-WeolMfC5.mjs → utils-BwWn6Fw4.mjs} +0 -0
@@ -1,4 +1,4 @@
1
- Third-party software notices for @roomle/embedding-lib 5d3d52ca37742547fdded8befb045096fbca4756
1
+ Third-party software notices for @roomle/embedding-lib 74570fef0c256d9c51b34ef2a4376ec43e3f7ca5
2
2
  Generated 2026-11-09
3
3
 
4
4
  This product includes the following third-party components.
@@ -0,0 +1,322 @@
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, reasoningEffort: c }, l) => {
40
+ let u = l ? { fetch: new Proxy(fetch, { apply: async (e, t, n) => (typeof n[1]?.body == "string" && await l(n[1].body), fetch(...n)) }) } : {};
41
+ switch (e) {
42
+ case "openai": {
43
+ let { createOpenAI: e } = await import("./dist-Cmx_tCV5.mjs");
44
+ return { languageModel: e({
45
+ apiKey: r,
46
+ ...u
47
+ })(t) };
48
+ }
49
+ case "azure": {
50
+ let { createAzure: e } = await import("./dist-Ur4DqwwC.mjs"), n = e({
51
+ apiKey: r,
52
+ baseURL: i,
53
+ ...u
54
+ });
55
+ return {
56
+ languageModel: o ? n.chat(t) : n(t),
57
+ providerOptions: c ? { azure: { reasoningEffort: c } } : void 0
58
+ };
59
+ }
60
+ case "openai-compatible": {
61
+ if (!i) throw Error("The provider \"openai-compatible\" needs a baseUrl");
62
+ if (s) {
63
+ let { createOpenAI: e } = await import("./dist-Cmx_tCV5.mjs");
64
+ return {
65
+ languageModel: e({
66
+ baseURL: i,
67
+ apiKey: r ?? "none",
68
+ headers: {
69
+ ...r || a?.Authorization ? {} : { Authorization: void 0 },
70
+ ...a
71
+ },
72
+ ...u
73
+ }).responses(t),
74
+ providerOptions: { openai: {
75
+ store: !1,
76
+ forceReasoning: !0
77
+ } }
78
+ };
79
+ }
80
+ let { createOpenAICompatible: e } = await import("./dist-CGgFMwb1.mjs");
81
+ return { languageModel: n(e({
82
+ name: "openai-compatible",
83
+ baseURL: i,
84
+ apiKey: r,
85
+ headers: a,
86
+ includeUsage: !0,
87
+ ...u
88
+ })(t)) };
89
+ }
90
+ case "mistral": {
91
+ let { createMistral: e } = await import("./dist-BI_3AeI-.mjs");
92
+ return { languageModel: n(e({
93
+ apiKey: r,
94
+ ...u
95
+ })(t)) };
96
+ }
97
+ case "anthropic": {
98
+ let { createAnthropic: e } = await import("./dist-BsVeWZ8R.mjs");
99
+ return { languageModel: e({
100
+ apiKey: r,
101
+ headers: { "anthropic-dangerous-direct-browser-access": "true" },
102
+ ...u
103
+ })(t) };
104
+ }
105
+ case "google": {
106
+ let { createGoogleGenerativeAI: e } = await import("./dist-CjIZv2gB.mjs");
107
+ return { languageModel: e({
108
+ apiKey: r,
109
+ ...u
110
+ })(t) };
111
+ }
112
+ default: throw Error(`Unknown provider "${e}" - supported: azure, openai, openai-compatible, mistral, anthropic, google`);
113
+ }
114
+ }, i = ({ output: e }) => ({
115
+ type: "content",
116
+ value: e.content.map((e) => e.type === "text" ? {
117
+ type: "text",
118
+ text: e.text
119
+ } : {
120
+ type: "file",
121
+ mediaType: e.mimeType,
122
+ data: {
123
+ type: "data",
124
+ data: e.data
125
+ }
126
+ })
127
+ }), a = (e, t, n) => Object.fromEntries(e.map(({ name: e, description: r, inputSchema: a, annotations: o }) => {
128
+ let s = () => a;
129
+ return [e, {
130
+ type: "dynamic",
131
+ ...o && { annotations: o },
132
+ description: r,
133
+ inputSchema: { "~standard": {
134
+ version: 1,
135
+ vendor: n,
136
+ validate: (e) => ({ value: e }),
137
+ jsonSchema: {
138
+ input: s,
139
+ output: s
140
+ }
141
+ } },
142
+ execute: (n) => t(e, n).catch((e) => ({
143
+ content: [{
144
+ type: "text",
145
+ text: e instanceof Error ? e.message : String(e)
146
+ }],
147
+ isError: !0
148
+ })),
149
+ toModelOutput: i
150
+ }];
151
+ })), o = (e = {}) => ({
152
+ inputTokens: e.inputTokens ?? null,
153
+ outputTokens: e.outputTokens ?? null,
154
+ totalTokens: e.totalTokens ?? (e.inputTokens !== void 0 && e.outputTokens !== void 0 ? e.inputTokens + e.outputTokens : null)
155
+ }), s = (e) => e.some((e) => e !== null) ? e.reduce((e, t) => e + (t ?? 0), 0) : null, c = async (t, n, i, a, c) => {
156
+ let l = await Promise.all([
157
+ import("./dist-D0XFfKEL.mjs").then((e) => e.t),
158
+ r(t),
159
+ a()
160
+ ]);
161
+ n.throwIfAborted();
162
+ let [{ streamText: u, stepCountIs: d }, f, { prompts: p, tools: m }] = l, h = [];
163
+ return async ({ text: t, images: r }) => {
164
+ let a = [], l, g = !1, _ = {
165
+ role: "user",
166
+ content: [{
167
+ type: "text",
168
+ text: t || p.imagePrompt
169
+ }, ...r.map((e) => ({
170
+ type: "file",
171
+ data: e,
172
+ mediaType: "image/jpeg"
173
+ }))]
174
+ }, v = c?.recovery(m), y = new AbortController(), b = () => y.abort(n.reason);
175
+ n.addEventListener("abort", b, { once: !0 }), n.aborted && b();
176
+ let x = c ? setTimeout(() => y.abort(/* @__PURE__ */ Error("The assistant turn exceeded five minutes.")), c.timeoutMs) : void 0;
177
+ try {
178
+ let e = u({
179
+ model: f.languageModel,
180
+ providerOptions: f.providerOptions,
181
+ instructions: p.systemPrompt,
182
+ messages: [...h, _],
183
+ tools: v?.tools ?? m,
184
+ stopWhen: d(16),
185
+ abortSignal: c ? y.signal : n,
186
+ prepareStep: ({ stepNumber: e }) => e === 15 ? { toolChoice: "none" } : void 0
187
+ });
188
+ for await (let t of e.stream) if (t.type === "text-delta") i({
189
+ type: "text",
190
+ text: t.text
191
+ });
192
+ else if (t.type === "tool-call") i({
193
+ type: "activity",
194
+ text: t.toolName
195
+ });
196
+ else {
197
+ if (t.type === "error") throw t.error;
198
+ if (t.type === "finish-step") a.push(o(t.usage));
199
+ else if (t.type === "finish") l = o(t.totalUsage);
200
+ else if (t.type === "abort" && (g = !0, c)) throw y.signal.reason ?? /* @__PURE__ */ Error("Turn aborted");
201
+ }
202
+ if (c && y.signal.aborted) throw y.signal.reason;
203
+ h.push(_, ...await e.responseMessages), i({ type: "done" });
204
+ } catch (t) {
205
+ let n = v?.summary();
206
+ n && h.push(_, {
207
+ role: "assistant",
208
+ content: n
209
+ }), i({
210
+ type: "error",
211
+ ...e.isInstance(t) && { statusCode: t.statusCode },
212
+ text: `The planning assistant failed: ${t instanceof Error ? t.message : String(t)}${n ? `\n\n${n}` : ""}`
213
+ });
214
+ } finally {
215
+ clearTimeout(x), n.removeEventListener("abort", b);
216
+ let e = {
217
+ inputTokens: l?.inputTokens ?? s(a.map((e) => e.inputTokens)),
218
+ outputTokens: l?.outputTokens ?? s(a.map((e) => e.outputTokens)),
219
+ totalTokens: l?.totalTokens ?? s(a.map((e) => e.totalTokens))
220
+ };
221
+ Object.values(e).some((e) => e !== null), l && !g && !y.signal.aborted && Object.values(e).every((e) => e !== null) && a.every((e) => Object.values(e).every((e) => e !== null));
222
+ }
223
+ };
224
+ }, l = {
225
+ undo: "Undo",
226
+ redo: "Redo",
227
+ "change-component-parameter": "Component parameter change",
228
+ "change-global-parameter": "Global parameter change",
229
+ "dock-component": "Component dock",
230
+ "drag-component": "Component drag",
231
+ "delete-component": "Component deletion",
232
+ "load-configuration": "Configuration load",
233
+ "get-configurator-capabilities": "Capabilities read",
234
+ "get-configuration": "Configuration read",
235
+ "get-component-parameters": "Component parameters read",
236
+ "get-global-parameters": "Global parameters read",
237
+ "get-possible-children": "Possible children read",
238
+ "get-docking-positions": "Docking positions read",
239
+ "get-component-docking-positions": "Component docking positions read",
240
+ "get-delete-impact": "Delete impact read"
241
+ }, u = new Set(Object.keys(l).filter((e) => e.startsWith("get-"))), d = (e) => {
242
+ if (e instanceof Error) return e.message;
243
+ try {
244
+ return typeof e == "string" ? e : JSON.stringify(e) ?? String(e);
245
+ } catch {
246
+ return Object.prototype.toString.call(e);
247
+ }
248
+ }, f = (e) => {
249
+ if (e?.structuredContent !== void 0) return e.structuredContent;
250
+ let t = e?.content?.filter((e) => e.type === "text").map((e) => e.text).join("\n");
251
+ if (t === void 0) return e;
252
+ try {
253
+ return JSON.parse(t);
254
+ } catch {
255
+ return t;
256
+ }
257
+ }, p = (e) => {
258
+ if (!e || typeof e != "object") return e == null ? [] : [d(e)];
259
+ let t = [];
260
+ for (let n of [
261
+ "applied",
262
+ "undone",
263
+ "redone",
264
+ "confirmed",
265
+ "canUndo",
266
+ "canRedo"
267
+ ]) e[n] !== void 0 && t.push(`${n}: ${d(e[n])}`);
268
+ return e.hint && t.push(d(e.hint)), t;
269
+ }, m = (e, t = {
270
+ subject: "configuration",
271
+ readTools: u
272
+ }) => {
273
+ let n = [];
274
+ return {
275
+ tools: Object.fromEntries(Object.entries(e).map(([e, t]) => {
276
+ if (!t.execute) return [e, t];
277
+ let r = t.execute.bind(t);
278
+ return [e, {
279
+ ...t,
280
+ execute: async (t) => {
281
+ let i = {
282
+ toolName: e,
283
+ status: "pending"
284
+ };
285
+ n.push(i);
286
+ try {
287
+ let e = await r(t);
288
+ return i.result = e, i.status = "returned", e;
289
+ } catch (e) {
290
+ throw i.error = e, i.status = "threw", e;
291
+ }
292
+ }
293
+ }];
294
+ })),
295
+ summary: () => {
296
+ let e = ["The assistant's reply was interrupted. Any text above is incomplete."];
297
+ if (!n.length) return e.push(`No tool ran, so the ${t.subject} was not changed.`), e.join("\n\n");
298
+ for (let r of n) {
299
+ let n = l[r.toolName] ?? r.toolName;
300
+ if (t.readTools.has(r.toolName)) {
301
+ let i = r.status === "returned" && !r.result?.isError, a = i ? f(r.result) : void 0;
302
+ 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}.`);
303
+ continue;
304
+ }
305
+ if (r.status !== "returned" || r.result?.isError) {
306
+ let i = r.status === "threw" ? d(r.error) : r.status === "returned" ? d(f(r.result)) : "no result was received";
307
+ e.push(`- Unconfirmed ${n}: ${i}. Check the ${t.subject} before trying this operation again.`);
308
+ } else {
309
+ let i = f(r.result);
310
+ if (!1 === i?.confirmed) {
311
+ 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.`);
312
+ continue;
313
+ }
314
+ let a = p(i);
315
+ e.push(`- Completed ${n}: ${a.length ? a.join("; ") : "the tool returned successfully."}`);
316
+ }
317
+ }
318
+ return e.push("These are the recorded tool outcomes; no operation was repeated automatically."), e.join("\n\n");
319
+ }
320
+ };
321
+ };
322
+ export { r as i, c as n, a as r, m as t };
@@ -0,0 +1,327 @@
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, reasoningEffort: c }, l) => {
41
+ let u = l ? { fetch: new Proxy(fetch, { apply: async (e, t, n) => (typeof n[1]?.body == "string" && await l(n[1].body), fetch(...n)) }) } : {};
42
+ switch (e) {
43
+ case "openai": {
44
+ let { createOpenAI: e } = await import("./dist-Cxe4osFc.mjs");
45
+ return { languageModel: e({
46
+ apiKey: n,
47
+ ...u
48
+ })(t) };
49
+ }
50
+ case "azure": {
51
+ let { createAzure: e } = await import("./dist-Dr3LcjP6.mjs"), r = e({
52
+ apiKey: n,
53
+ baseURL: i,
54
+ ...u
55
+ });
56
+ return {
57
+ languageModel: o ? r.chat(t) : r(t),
58
+ providerOptions: c ? { azure: { reasoningEffort: c } } : void 0
59
+ };
60
+ }
61
+ case "openai-compatible": {
62
+ if (!i) throw Error("The provider \"openai-compatible\" needs a baseUrl");
63
+ if (s) {
64
+ let { createOpenAI: e } = await import("./dist-Cxe4osFc.mjs"), r = {
65
+ ...!n && !a?.Authorization ? { Authorization: void 0 } : {},
66
+ ...a
67
+ };
68
+ return {
69
+ languageModel: e({
70
+ baseURL: i,
71
+ apiKey: n ?? "none",
72
+ headers: r,
73
+ ...u
74
+ }).responses(t),
75
+ providerOptions: { openai: {
76
+ store: !1,
77
+ forceReasoning: !0
78
+ } }
79
+ };
80
+ }
81
+ let { createOpenAICompatible: e } = await import("./dist-wPZpiGiu.mjs");
82
+ return { languageModel: r(e({
83
+ name: "openai-compatible",
84
+ baseURL: i,
85
+ apiKey: n,
86
+ headers: a,
87
+ includeUsage: !0,
88
+ ...u
89
+ })(t)) };
90
+ }
91
+ case "mistral": {
92
+ let { createMistral: e } = await import("./dist-CZbrRF4T.mjs");
93
+ return { languageModel: r(e({
94
+ apiKey: n,
95
+ ...u
96
+ })(t)) };
97
+ }
98
+ case "anthropic": {
99
+ let { createAnthropic: e } = await import("./dist-CnTUCpLZ.mjs");
100
+ return { languageModel: e({
101
+ apiKey: n,
102
+ headers: { "anthropic-dangerous-direct-browser-access": "true" },
103
+ ...u
104
+ })(t) };
105
+ }
106
+ case "google": {
107
+ let { createGoogleGenerativeAI: e } = await import("./dist-DCzWWudD.mjs");
108
+ return { languageModel: e({
109
+ apiKey: n,
110
+ ...u
111
+ })(t) };
112
+ }
113
+ default: throw Error(`Unknown provider "${e}" - supported: azure, openai, openai-compatible, mistral, anthropic, google`);
114
+ }
115
+ }, a = ({ output: e }) => ({
116
+ type: "content",
117
+ value: e.content.map((e) => e.type === "text" ? {
118
+ type: "text",
119
+ text: e.text
120
+ } : {
121
+ type: "file",
122
+ mediaType: e.mimeType,
123
+ data: {
124
+ type: "data",
125
+ data: e.data
126
+ }
127
+ })
128
+ }), o = (e, t, n) => Object.fromEntries(e.map(({ name: e, description: r, inputSchema: i, annotations: o }) => {
129
+ let s = () => i;
130
+ return [e, {
131
+ type: "dynamic",
132
+ ...o && { annotations: o },
133
+ description: r,
134
+ inputSchema: { "~standard": {
135
+ version: 1,
136
+ vendor: n,
137
+ validate: (e) => ({ value: e }),
138
+ jsonSchema: {
139
+ input: s,
140
+ output: s
141
+ }
142
+ } },
143
+ execute: (n) => t(e, n).catch((e) => ({
144
+ content: [{
145
+ type: "text",
146
+ text: e instanceof Error ? e.message : String(e)
147
+ }],
148
+ isError: !0
149
+ })),
150
+ toModelOutput: a
151
+ }];
152
+ })), s = (e = {}) => ({
153
+ inputTokens: e.inputTokens ?? null,
154
+ outputTokens: e.outputTokens ?? null,
155
+ totalTokens: e.totalTokens ?? (e.inputTokens !== void 0 && e.outputTokens !== void 0 ? e.inputTokens + e.outputTokens : null)
156
+ }), c = (e) => e.some((e) => e !== null) ? e.reduce((e, t) => e + (t ?? 0), 0) : null, l = async (t, n, r, a, o) => {
157
+ let l = await Promise.all([
158
+ import("./dist-6TznX-Ae.mjs").then((e) => e.t),
159
+ i(t),
160
+ a()
161
+ ]);
162
+ n.throwIfAborted();
163
+ let [{ streamText: u, stepCountIs: d }, f, { prompts: p, tools: m }] = l, h = [];
164
+ return async ({ text: i, images: a }) => {
165
+ let l = [], g, _ = !1, v = {
166
+ role: "user",
167
+ content: [{
168
+ type: "text",
169
+ text: i || p.imagePrompt
170
+ }, ...a.map((e) => ({
171
+ type: "file",
172
+ data: e,
173
+ mediaType: "image/jpeg"
174
+ }))]
175
+ }, y = o?.recovery(m), b = new AbortController(), x = () => b.abort(n.reason);
176
+ n.addEventListener("abort", x, { once: !0 }), n.aborted && x();
177
+ let S = o ? setTimeout(() => b.abort(/* @__PURE__ */ Error("The assistant turn exceeded five minutes.")), o.timeoutMs) : void 0;
178
+ try {
179
+ let e = u({
180
+ model: f.languageModel,
181
+ providerOptions: f.providerOptions,
182
+ instructions: p.systemPrompt,
183
+ messages: [...h, v],
184
+ tools: y?.tools ?? m,
185
+ stopWhen: d(16),
186
+ abortSignal: o ? b.signal : n,
187
+ prepareStep: ({ stepNumber: e }) => e === 15 ? { toolChoice: "none" } : void 0
188
+ });
189
+ for await (let t of e.stream) if (t.type === "text-delta") r({
190
+ type: "text",
191
+ text: t.text
192
+ });
193
+ else if (t.type === "tool-call") r({
194
+ type: "activity",
195
+ text: t.toolName
196
+ });
197
+ else if (t.type === "error") throw t.error;
198
+ else if (t.type === "finish-step") l.push(s(t.usage));
199
+ else if (t.type === "finish") g = s(t.totalUsage);
200
+ else if (t.type === "abort" && (_ = !0, o)) throw b.signal.reason ?? /* @__PURE__ */ Error("Turn aborted");
201
+ if (o && b.signal.aborted) throw b.signal.reason;
202
+ h.push(v, ...await e.responseMessages), r({ type: "done" });
203
+ } catch (t) {
204
+ let n = y?.summary();
205
+ n && h.push(v, {
206
+ role: "assistant",
207
+ content: n
208
+ }), r({
209
+ type: "error",
210
+ ...e.isInstance(t) && { statusCode: t.statusCode },
211
+ text: `The planning assistant failed: ${t instanceof Error ? t.message : String(t)}${n ? `\n\n${n}` : ""}`
212
+ });
213
+ } finally {
214
+ clearTimeout(S), n.removeEventListener("abort", x);
215
+ let e = {
216
+ inputTokens: g?.inputTokens ?? c(l.map((e) => e.inputTokens)),
217
+ outputTokens: g?.outputTokens ?? c(l.map((e) => e.outputTokens)),
218
+ totalTokens: g?.totalTokens ?? c(l.map((e) => e.totalTokens))
219
+ }, r = Object.values(e).some((e) => e !== null), i = g && !_ && !b.signal.aborted && Object.values(e).every((e) => e !== null) && l.every((e) => Object.values(e).every((e) => e !== null));
220
+ console.log(`[planning-assistant] usage ${JSON.stringify({
221
+ provider: t.provider,
222
+ model: t.model,
223
+ status: r ? i ? "complete" : "partial" : "unavailable",
224
+ ...e
225
+ })}`);
226
+ }
227
+ };
228
+ }, u = {
229
+ undo: "Undo",
230
+ redo: "Redo",
231
+ "change-component-parameter": "Component parameter change",
232
+ "change-global-parameter": "Global parameter change",
233
+ "dock-component": "Component dock",
234
+ "drag-component": "Component drag",
235
+ "delete-component": "Component deletion",
236
+ "load-configuration": "Configuration load",
237
+ "get-configurator-capabilities": "Capabilities read",
238
+ "get-configuration": "Configuration read",
239
+ "get-component-parameters": "Component parameters read",
240
+ "get-global-parameters": "Global parameters read",
241
+ "get-possible-children": "Possible children read",
242
+ "get-docking-positions": "Docking positions read",
243
+ "get-component-docking-positions": "Component docking positions read",
244
+ "get-delete-impact": "Delete impact read"
245
+ }, d = new Set(Object.keys(u).filter((e) => e.startsWith("get-"))), f = (e) => {
246
+ if (e instanceof Error) return e.message;
247
+ try {
248
+ return typeof e == "string" ? e : JSON.stringify(e) ?? String(e);
249
+ } catch {
250
+ return Object.prototype.toString.call(e);
251
+ }
252
+ }, p = (e) => {
253
+ if (e?.structuredContent !== void 0) return e.structuredContent;
254
+ let t = e?.content?.filter((e) => e.type === "text").map((e) => e.text).join("\n");
255
+ if (t === void 0) return e;
256
+ try {
257
+ return JSON.parse(t);
258
+ } catch {
259
+ return t;
260
+ }
261
+ }, m = (e) => {
262
+ if (!e || typeof e != "object") return e == null ? [] : [f(e)];
263
+ let t = [];
264
+ for (let n of [
265
+ "applied",
266
+ "undone",
267
+ "redone",
268
+ "confirmed",
269
+ "canUndo",
270
+ "canRedo"
271
+ ]) e[n] !== void 0 && t.push(`${n}: ${f(e[n])}`);
272
+ return e.hint && t.push(f(e.hint)), t;
273
+ }, h = (e, t = {
274
+ subject: "configuration",
275
+ readTools: d
276
+ }) => {
277
+ let n = [];
278
+ return {
279
+ tools: Object.fromEntries(Object.entries(e).map(([e, t]) => {
280
+ if (!t.execute) return [e, t];
281
+ let r = t.execute.bind(t);
282
+ return [e, {
283
+ ...t,
284
+ execute: async (t) => {
285
+ let i = {
286
+ toolName: e,
287
+ status: "pending"
288
+ };
289
+ n.push(i);
290
+ try {
291
+ let e = await r(t);
292
+ return i.result = e, i.status = "returned", e;
293
+ } catch (e) {
294
+ throw i.error = e, i.status = "threw", e;
295
+ }
296
+ }
297
+ }];
298
+ })),
299
+ summary: () => {
300
+ let e = ["The assistant's reply was interrupted. Any text above is incomplete."];
301
+ if (!n.length) return e.push(`No tool ran, so the ${t.subject} was not changed.`), e.join("\n\n");
302
+ for (let r of n) {
303
+ let n = u[r.toolName] ?? r.toolName;
304
+ if (t.readTools.has(r.toolName)) {
305
+ let i = r.status === "returned" && !r.result?.isError, a = i ? p(r.result) : void 0;
306
+ 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}.`);
307
+ continue;
308
+ }
309
+ if (r.status === "returned" && !r.result?.isError) {
310
+ let i = p(r.result);
311
+ if (i?.confirmed === !1) {
312
+ 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.`);
313
+ continue;
314
+ }
315
+ let a = m(i);
316
+ e.push(`- Completed ${n}: ${a.length ? a.join("; ") : "the tool returned successfully."}`);
317
+ } else {
318
+ let i = r.status === "threw" ? f(r.error) : r.status === "returned" ? f(p(r.result)) : "no result was received";
319
+ e.push(`- Unconfirmed ${n}: ${i}. Check the ${t.subject} before trying this operation again.`);
320
+ }
321
+ }
322
+ return e.push("These are the recorded tool outcomes; no operation was repeated automatically."), e.join("\n\n");
323
+ }
324
+ };
325
+ };
326
+ //#endregion
327
+ export { i, l as n, o as r, h as t };
package/configurator.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*! Third-party licenses: THIRD-PARTY-NOTICES.txt and sbom.cdx.json in the root of this package */
2
- import { n as e, t } from "./mcp-tools-Cnhgobge.mjs";
2
+ import { i as e, r as t } from "./chat-model-gyIajfDW.mjs";
3
3
  //#region packages/embedding-lib/src/configurator-agent/configurator-mcp-tools.ts
4
4
  var n = async (e) => {
5
5
  if (typeof e.getConfiguratorAgentTools != "function" || typeof e.callConfiguratorAgentTool != "function") throw Error("Update the Rubens UI: configurator agent tools are unavailable.");
@@ -1,5 +1,5 @@
1
1
  /*! Third-party licenses: THIRD-PARTY-NOTICES.txt and sbom.cdx.json in the root of this package */
2
- import { n as e, t } from "./mcp-tools-D3Ei3Apu.mjs";
2
+ import { i as e, r as t } from "./chat-model-DKlWonm6.mjs";
3
3
  var n = async (e) => {
4
4
  if (typeof e.getConfiguratorAgentTools != "function" || typeof e.callConfiguratorAgentTool != "function") throw Error("Update the Rubens UI: configurator agent tools are unavailable.");
5
5
  return t(await e.getConfiguratorAgentTools(), (t, n) => e.callConfiguratorAgentTool(t, n), "configurator-mcp");
@@ -0,0 +1,2 @@
1
+ export * from './packages/embedding-lib/src/construction'
2
+ export {}