@roomle/embedding-lib 0.0.0-dev-ac159d1 → 0.0.0-dev-2fa1a85

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.
package/hi.js CHANGED
@@ -3,12 +3,12 @@ import { t as e } from "./utils-CJnKZceY.mjs";
3
3
  import { t } from "./browser-Cys-y5Hy.mjs";
4
4
  import { t as n } from "./chat-model-KHuz1Ej9.mjs";
5
5
  import { t as r } from "./mcp-tools-C6O2gQZW.mjs";
6
- import { t as i } from "./ai-model-host-DHfBsFC2.mjs";
7
- import { o as a } from "./usage-CYqDPQOx.mjs";
8
- var o = (e, t) => t === e.libraryId ? e : {
6
+ import { n as i, t as a } from "./ai-model-host-HAJONHCj.mjs";
7
+ import { o } from "./usage-CYqDPQOx.mjs";
8
+ var s = (e, t) => t === e.libraryId ? e : {
9
9
  ...e,
10
10
  libraryId: t
11
- }, s = async (e, t, n, r = { property: "default" }) => {
11
+ }, c = async (e, t, n, r = { property: "default" }) => {
12
12
  let i = n.serverOptions ?? {}, a = { headers: {
13
13
  "Content-Type": t === "json" ? "application/json" : "text/plain",
14
14
  "Access-Control-Allow-Origin": "*"
@@ -21,22 +21,22 @@ var o = (e, t) => t === e.libraryId ? e : {
21
21
  } catch (e) {
22
22
  throw console.warn(`Failed to fetch data from ${r.property}`), console.error(e), e;
23
23
  }
24
- }, c = { "e2fe8b3d-da31-4a20-92ab-ab6e3839300e": /* @__PURE__ */ new Set(["Furniture_Smith"]) }, l = (e, t) => {
25
- c[e] || (c[e] = /* @__PURE__ */ new Set()), c[e].add(t);
26
- }, u = (e, t) => {
27
- c[e]?.delete(t), c[e]?.size === 0 && delete c[e];
24
+ }, l = { "e2fe8b3d-da31-4a20-92ab-ab6e3839300e": /* @__PURE__ */ new Set(["Furniture_Smith"]) }, u = (e, t) => {
25
+ l[e] || (l[e] = /* @__PURE__ */ new Set()), l[e].add(t);
28
26
  }, d = (e, t) => {
27
+ l[e]?.delete(t), l[e]?.size === 0 && delete l[e];
28
+ }, f = (e, t) => {
29
29
  let { libraryId: n, serverOptions: r } = e;
30
- return r?.subscriptionId && c[r.subscriptionId]?.has(n) ? `api/pos/${t}?libraryId=${n}` : `api/pos/libraries/${n}/${t}`;
31
- }, f = async (e) => await (await s(d(e, "articles"), "json", e, { property: "articles" })).json(), p = async (e) => await (await s(d(e, "masterData"), "json", e, { property: "masterData" })).json(), m = async (e) => {
32
- let t = await (await s(d(e, "calc.js"), "text", e, { property: "calc.js" })).text();
30
+ return r?.subscriptionId && l[r.subscriptionId]?.has(n) ? `api/pos/${t}?libraryId=${n}` : `api/pos/libraries/${n}/${t}`;
31
+ }, p = async (e) => await (await c(f(e, "articles"), "json", e, { property: "articles" })).json(), m = async (e) => await (await c(f(e, "masterData"), "json", e, { property: "masterData" })).json(), h = async (e) => {
32
+ let t = await (await c(f(e, "calc.js"), "text", e, { property: "calc.js" })).text();
33
33
  if (!t) throw Error("Script load error");
34
34
  return t;
35
- }, h = (e) => ({
36
- onLoadJavascript: (t) => m(o(e, t)),
37
- onLoadArticleCatalog: (t) => f(o(e, t)),
38
- onLoadMasterData: (t) => p(o(e, t))
39
- }), g = async (e, t, n, r) => {
35
+ }, g = (e) => ({
36
+ onLoadJavascript: (t) => h(s(e, t)),
37
+ onLoadArticleCatalog: (t) => p(s(e, t)),
38
+ onLoadMasterData: (t) => m(s(e, t))
39
+ }), _ = async (e, t, n, r) => {
40
40
  let { baseUrl: i, om: a } = e.serverOptions ?? {}, o = encodeURIComponent(a?.endpointUrl || ""), s = encodeURIComponent(a?.subscriptionId || ""), c = a?.key || "", l = await fetch((i ?? "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=") + `${encodeURIComponent(t)}&subscriptionId=${s}&apiKey=${c}&baseUrl=${o}`, {
41
41
  ...n,
42
42
  headers: {
@@ -49,40 +49,39 @@ var o = (e, t) => t === e.libraryId ? e : {
49
49
  throw Error(`Order Manager request ${t} failed with ${e}${n ? `: ${n}` : ""}`);
50
50
  }
51
51
  return l.json();
52
- }, _ = async (e, t, n, r = {}) => g(e, n, {
52
+ }, v = async (e, t, n, r = {}) => _(e, n, {
53
53
  method: "POST",
54
54
  body: JSON.stringify(t)
55
- }, r), v = async (e, t, n = {}) => g(e, t, { method: "GET" }, n), y = (e, n) => {
55
+ }, r), y = async (e, t, n = {}) => _(e, t, { method: "GET" }, n), b = (e, n) => {
56
56
  e.serverOptions ||= {}, !e.serverOptions.language && n?.locale && (e.serverOptions.language = n.locale), e.serverOptions.language || (e.serverOptions.language = t(null, !0));
57
- }, b = null, x = async (t, n = {}) => {
58
- b && window.removeEventListener("message", b);
57
+ }, x = null, S = async (t, n = {}) => {
58
+ x && window.removeEventListener("message", x);
59
59
  let r = typeof t == "string" ? { libraryId: t } : t;
60
- n.onLoadJavascript === void 0 && (n.onLoadJavascript = (e) => m(o(r, e))), n.onLoadArticleCatalog === void 0 && (n.onLoadArticleCatalog = (e) => f(o(r, e))), n.onLoadMasterData === void 0 && (n.onLoadMasterData = (e) => p(o(r, e)));
60
+ n.onLoadJavascript === void 0 && (n.onLoadJavascript = (e) => h(s(r, e))), n.onLoadArticleCatalog === void 0 && (n.onLoadArticleCatalog = (e) => p(s(r, e))), n.onLoadMasterData === void 0 && (n.onLoadMasterData = (e) => m(s(r, e)));
61
61
  let { expose: i } = await import("./comlink-7u13Z2ZH.mjs");
62
- b = (t) => {
62
+ x = (t) => {
63
63
  if (t.data.type === "connect_hi" && t.data.port) {
64
64
  let a = t.data.port;
65
- y(r, t.data.globalInitData || {}), a.start?.(), i(e(n), a);
65
+ b(r, t.data.globalInitData || {}), a.start?.(), i(e(n), a);
66
66
  }
67
- }, window.addEventListener("message", b);
68
- }, S = () => {
69
- b &&= (window.removeEventListener("message", b), null);
70
- }, C = async ({ extended: e }) => {
67
+ }, window.addEventListener("message", x);
68
+ }, C = () => {
69
+ x &&= (window.removeEventListener("message", x), null);
70
+ }, w = async ({ extended: e }) => {
71
71
  if (typeof e.getExternalObjectAgentTools != "function") throw Error("The planner has no HI agent tools: it needs a Rubens UI with getExternalObjectAgentTools.");
72
72
  return r(await e.getExternalObjectAgentTools(), (t, n) => e.callExternalObjectAgentTool(t, n), "hi-mcp");
73
- }, w = (e) => {
74
- let t = a(e);
73
+ }, T = (e) => {
74
+ let t = o(e);
75
75
  return {
76
76
  provider: "host",
77
77
  model: e.model,
78
78
  readsImages: e.readsImages,
79
- ...e.readsDocuments === !0 && { readsDocuments: !0 },
80
79
  ...t && { responsesProvider: t },
81
80
  ...e.provider === "azure" && !e.chatCompletions && e.referenceCacheBreakpoint === !0 && { referenceCacheBreakpoint: !0 },
82
81
  ...e.decisionApiKey && { decisionApiKey: e.decisionApiKey }
83
82
  };
84
- }, T = async (e, t, n) => {
85
- let r = e.extended, a = async (e) => {
83
+ }, E = async (e, t, n) => {
84
+ let r = e.extended, o = async (e) => {
86
85
  console.log("[planning-assistant]", e), await r.planningAssistantOutput({
87
86
  type: "availability",
88
87
  available: !1,
@@ -90,42 +89,44 @@ var o = (e, t) => t === e.libraryId ? e : {
90
89
  });
91
90
  };
92
91
  if (typeof r.startExternalObjectPlanningAssistant != "function") {
93
- await a("The planner has no HI Planning Assistant: it needs a Rubens UI with startExternalObjectPlanningAssistant.");
92
+ await o("The planner has no HI Planning Assistant: it needs a Rubens UI with startExternalObjectPlanningAssistant.");
94
93
  return;
95
94
  }
96
95
  if (n.aborted) return;
97
- let o = crypto.randomUUID();
96
+ let s = crypto.randomUUID(), { startRelay: c, ui: l } = e, u = c && l ? e : void 0, d = async () => {
97
+ u && await i(u, t);
98
+ };
98
99
  try {
99
- let { startRelay: n, ui: a } = e, s = n && a ? await i(e, t) : t;
100
- await r.startExternalObjectPlanningAssistant(w({
101
- ...s,
100
+ let e = u ? await a(u, t) : t;
101
+ await r.startExternalObjectPlanningAssistant(T({
102
+ ...e,
102
103
  decisionApiKey: t.decisionApiKey
103
- }), o);
104
+ }), s);
104
105
  } catch (e) {
105
- await a(String(e));
106
+ await o(String(e)), await d();
106
107
  return;
107
108
  }
108
- let s, c = () => {
109
- l();
110
- }, l = () => s ??= (async () => {
111
- n.removeEventListener("abort", c), await r.stopPlanningAssistant?.(o);
109
+ let f, p = () => {
110
+ m();
111
+ }, m = () => f ??= (async () => {
112
+ n.removeEventListener("abort", p), await r.stopPlanningAssistant?.(s), await d();
112
113
  })();
113
- if (n.addEventListener("abort", c, { once: !0 }), n.aborted) await l();
114
+ if (n.addEventListener("abort", p, { once: !0 }), n.aborted) await m();
114
115
  else return {
115
116
  suspend: async () => {
116
- s || await r.suspendPlanningAssistant?.();
117
+ f || await r.suspendPlanningAssistant?.();
117
118
  },
118
119
  resume: async () => {
119
- s || await r.resumePlanningAssistant?.();
120
+ f || await r.resumePlanningAssistant?.();
120
121
  },
121
- dispose: l
122
+ dispose: m
122
123
  };
123
- }, E = 5e3, D = async ({ serverUrl: e, authorization: t }) => {
124
+ }, D = 5e3, O = async ({ serverUrl: e, authorization: t }) => {
124
125
  let n = t ? { Authorization: t } : {}, r;
125
126
  try {
126
127
  let t = await fetch(`${e}/backends/list`, {
127
128
  headers: n,
128
- signal: AbortSignal.timeout(E)
129
+ signal: AbortSignal.timeout(D)
129
130
  });
130
131
  r = t.ok ? await t.json() : [];
131
132
  } catch (e) {
@@ -153,12 +154,12 @@ var o = (e, t) => t === e.libraryId ? e : {
153
154
  headers: n
154
155
  } }
155
156
  };
156
- }, O = (e = "1:1") => {
157
+ }, k = (e = "1:1") => {
157
158
  let [t, n] = e.split(":").map(Number);
158
159
  return t === n ? "1024x1024" : t > n ? "1536x1024" : "1024x1536";
159
- }, k = async (e) => (await fetch(e)).blob(), A = async (e, t, { baseUrl: n, model: r, headers: i }) => {
160
- let { prompt: a, image: o, aspect: s } = JSON.parse(e.body), c = await k(o), l = new FormData();
161
- l.append("model", r), l.append("prompt", a), l.append("size", O(s)), l.append("quality", "medium"), l.append("output_format", "png"), l.append("image", c, `scene.${c.type.split("/")[1]}`);
160
+ }, A = async (e) => (await fetch(e)).blob(), j = async (e, t, { baseUrl: n, model: r, headers: i }) => {
161
+ let { prompt: a, image: o, aspect: s } = JSON.parse(e.body), c = await A(o), l = new FormData();
162
+ l.append("model", r), l.append("prompt", a), l.append("size", k(s)), l.append("quality", "medium"), l.append("output_format", "png"), l.append("image", c, `scene.${c.type.split("/")[1]}`);
162
163
  let u = await fetch(`${n}/images/edits`, {
163
164
  method: "POST",
164
165
  headers: i,
@@ -167,11 +168,11 @@ var o = (e, t) => t === e.libraryId ? e : {
167
168
  });
168
169
  if (!u.ok) return u;
169
170
  let { data: d } = await u.json(), f = d?.[0]?.b64_json, p = new FormData();
170
- return f ? p.append("image", await k(`data:image/png;base64,${f}`)) : p.append("text", "The endpoint returned no image"), new Response(p);
171
- }, j = {
171
+ return f ? p.append("image", await A(`data:image/png;base64,${f}`)) : p.append("text", "The endpoint returned no image"), new Response(p);
172
+ }, M = {
172
173
  png: "image/png",
173
174
  jpg: "image/jpeg"
174
- }, M = (e, t, { baseUrl: n, model: r, headers: i }) => {
175
+ }, N = (e, t, { baseUrl: n, model: r, headers: i }) => {
175
176
  let { state: a, questions: o, assets: s = {} } = JSON.parse(e.body);
176
177
  return fetch(`${n}/decisions`, {
177
178
  method: "POST",
@@ -190,15 +191,15 @@ var o = (e, t) => t === e.libraryId ? e : {
190
191
  }, {
191
192
  type: "image",
192
193
  data: t.data_base64,
193
- mime_type: j[t.format]
194
+ mime_type: M[t.format]
194
195
  }])],
195
196
  questions: o
196
197
  }),
197
198
  signal: t
198
199
  });
199
- }, N = {
200
+ }, P = {
200
201
  HIDE: "hide",
201
202
  SHOW_ATTRIBUTES: "attributes",
202
203
  SHOW_ARTICLES: "articles"
203
204
  };
204
- export { N as HI_PANEL_ACTION, S as cleanupHi, h as createHiLibraryCallbacks, C as createHiMcpTools, f as libLoadArticleCatalog, m as libLoadCalcScript, p as libLoadMasterData, n as loadChatModel, v as omGetRequest, _ as omPostRequest, l as registerLegacyUrlFormat, M as requestDecisions, A as requestImageEdits, D as resolveHiModelProxy, x as setupHi, T as startPlanningAssistant, u as unregisterLegacyUrlFormat };
205
+ export { P as HI_PANEL_ACTION, C as cleanupHi, g as createHiLibraryCallbacks, w as createHiMcpTools, p as libLoadArticleCatalog, h as libLoadCalcScript, m as libLoadMasterData, n as loadChatModel, y as omGetRequest, v as omPostRequest, u as registerLegacyUrlFormat, N as requestDecisions, j as requestImageEdits, O as resolveHiModelProxy, S as setupHi, E as startPlanningAssistant, d as unregisterLegacyUrlFormat };
package/hi.min.js CHANGED
@@ -3,12 +3,12 @@ import { t as e } from "./utils-DdNhTbJr.mjs";
3
3
  import { t } from "./browser-CzLpXYFF.mjs";
4
4
  import { t as n } from "./chat-model-DooKwd8I.mjs";
5
5
  import { t as r } from "./mcp-tools-m_3IX0vB.mjs";
6
- import { t as i } from "./ai-model-host-BE_xdV6e.mjs";
7
- import { o as a } from "./usage-C3HE9yXi.mjs";
8
- var o = (e, t) => t === e.libraryId ? e : {
6
+ import { n as i, t as a } from "./ai-model-host-CaiYrZkh.mjs";
7
+ import { o } from "./usage-C3HE9yXi.mjs";
8
+ var s = (e, t) => t === e.libraryId ? e : {
9
9
  ...e,
10
10
  libraryId: t
11
- }, s = async (e, t, n, r = { property: "default" }) => {
11
+ }, c = async (e, t, n, r = { property: "default" }) => {
12
12
  let i = n.serverOptions ?? {}, a = { headers: {
13
13
  "Content-Type": t === "json" ? "application/json" : "text/plain",
14
14
  "Access-Control-Allow-Origin": "*"
@@ -22,22 +22,22 @@ var o = (e, t) => t === e.libraryId ? e : {
22
22
  } catch (e) {
23
23
  throw e;
24
24
  }
25
- }, c = { "e2fe8b3d-da31-4a20-92ab-ab6e3839300e": /* @__PURE__ */ new Set(["Furniture_Smith"]) }, l = (e, t) => {
26
- c[e] || (c[e] = /* @__PURE__ */ new Set()), c[e].add(t);
27
- }, u = (e, t) => {
28
- c[e]?.delete(t), c[e]?.size === 0 && delete c[e];
25
+ }, l = { "e2fe8b3d-da31-4a20-92ab-ab6e3839300e": /* @__PURE__ */ new Set(["Furniture_Smith"]) }, u = (e, t) => {
26
+ l[e] || (l[e] = /* @__PURE__ */ new Set()), l[e].add(t);
29
27
  }, d = (e, t) => {
28
+ l[e]?.delete(t), l[e]?.size === 0 && delete l[e];
29
+ }, f = (e, t) => {
30
30
  let { libraryId: n, serverOptions: r } = e;
31
- return r?.subscriptionId && c[r.subscriptionId]?.has(n) ? `api/pos/${t}?libraryId=${n}` : `api/pos/libraries/${n}/${t}`;
32
- }, f = async (e) => await (await s(d(e, "articles"), "json", e, { property: "articles" })).json(), p = async (e) => await (await s(d(e, "masterData"), "json", e, { property: "masterData" })).json(), m = async (e) => {
33
- let t = await (await s(d(e, "calc.js"), "text", e, { property: "calc.js" })).text();
31
+ return r?.subscriptionId && l[r.subscriptionId]?.has(n) ? `api/pos/${t}?libraryId=${n}` : `api/pos/libraries/${n}/${t}`;
32
+ }, p = async (e) => await (await c(f(e, "articles"), "json", e, { property: "articles" })).json(), m = async (e) => await (await c(f(e, "masterData"), "json", e, { property: "masterData" })).json(), h = async (e) => {
33
+ let t = await (await c(f(e, "calc.js"), "text", e, { property: "calc.js" })).text();
34
34
  if (!t) throw Error("Script load error");
35
35
  return t;
36
- }, h = (e) => ({
37
- onLoadJavascript: (t) => m(o(e, t)),
38
- onLoadArticleCatalog: (t) => f(o(e, t)),
39
- onLoadMasterData: (t) => p(o(e, t))
40
- }), g = async (e, t, n, r) => {
36
+ }, g = (e) => ({
37
+ onLoadJavascript: (t) => h(s(e, t)),
38
+ onLoadArticleCatalog: (t) => p(s(e, t)),
39
+ onLoadMasterData: (t) => m(s(e, t))
40
+ }), _ = async (e, t, n, r) => {
41
41
  let { baseUrl: i, om: a } = e.serverOptions ?? {}, o = encodeURIComponent(a?.endpointUrl || ""), s = encodeURIComponent(a?.subscriptionId || ""), c = a?.key || "", l = await fetch((i ?? "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=") + `${encodeURIComponent(t)}&subscriptionId=${s}&apiKey=${c}&baseUrl=${o}`, {
42
42
  ...n,
43
43
  headers: {
@@ -50,75 +50,76 @@ var o = (e, t) => t === e.libraryId ? e : {
50
50
  throw Error(`Order Manager request ${t} failed with ${e}${n ? `: ${n}` : ""}`);
51
51
  }
52
52
  return l.json();
53
- }, _ = async (e, t, n, r = {}) => g(e, n, {
53
+ }, v = async (e, t, n, r = {}) => _(e, n, {
54
54
  method: "POST",
55
55
  body: JSON.stringify(t)
56
- }, r), v = async (e, t, n = {}) => g(e, t, { method: "GET" }, n), y = null, b = async (n, r = {}) => {
57
- y && window.removeEventListener("message", y);
56
+ }, r), y = async (e, t, n = {}) => _(e, t, { method: "GET" }, n), b = null, x = async (n, r = {}) => {
57
+ b && window.removeEventListener("message", b);
58
58
  let i = typeof n == "string" ? { libraryId: n } : n;
59
- r.onLoadJavascript === void 0 && (r.onLoadJavascript = (e) => m(o(i, e))), r.onLoadArticleCatalog === void 0 && (r.onLoadArticleCatalog = (e) => f(o(i, e))), r.onLoadMasterData === void 0 && (r.onLoadMasterData = (e) => p(o(i, e)));
59
+ r.onLoadJavascript === void 0 && (r.onLoadJavascript = (e) => h(s(i, e))), r.onLoadArticleCatalog === void 0 && (r.onLoadArticleCatalog = (e) => p(s(i, e))), r.onLoadMasterData === void 0 && (r.onLoadMasterData = (e) => m(s(i, e)));
60
60
  let { expose: a } = await import("./comlink-DKhvPU0o.mjs");
61
- y = (n) => {
61
+ b = (n) => {
62
62
  if (n.data.type === "connect_hi" && n.data.port) {
63
63
  let o = n.data.port;
64
64
  ((e, n) => {
65
65
  e.serverOptions ||= {}, !e.serverOptions.language && n?.locale && (e.serverOptions.language = n.locale), e.serverOptions.language || (e.serverOptions.language = t(null, !0));
66
66
  })(i, n.data.globalInitData || {}), o.start?.(), a(e(r), o);
67
67
  }
68
- }, window.addEventListener("message", y);
69
- }, x = () => {
70
- y &&= (window.removeEventListener("message", y), null);
71
- }, S = async ({ extended: e }) => {
68
+ }, window.addEventListener("message", b);
69
+ }, S = () => {
70
+ b &&= (window.removeEventListener("message", b), null);
71
+ }, C = async ({ extended: e }) => {
72
72
  if (typeof e.getExternalObjectAgentTools != "function") throw Error("The planner has no HI agent tools: it needs a Rubens UI with getExternalObjectAgentTools.");
73
73
  return r(await e.getExternalObjectAgentTools(), (t, n) => e.callExternalObjectAgentTool(t, n), "hi-mcp");
74
- }, C = async (e, t, n) => {
75
- let r = e.extended, o = async (e) => {
74
+ }, w = async (e, t, n) => {
75
+ let r = e.extended, s = async (e) => {
76
76
  await r.planningAssistantOutput({
77
77
  type: "availability",
78
78
  available: !1,
79
79
  text: e
80
80
  });
81
81
  };
82
- if (typeof r.startExternalObjectPlanningAssistant != "function") return void await o("The planner has no HI Planning Assistant: it needs a Rubens UI with startExternalObjectPlanningAssistant.");
82
+ if (typeof r.startExternalObjectPlanningAssistant != "function") return void await s("The planner has no HI Planning Assistant: it needs a Rubens UI with startExternalObjectPlanningAssistant.");
83
83
  if (n.aborted) return;
84
- let s = crypto.randomUUID();
84
+ let c = crypto.randomUUID(), { startRelay: l, ui: u } = e, d = l && u ? e : void 0, f = async () => {
85
+ d && await i(d, t);
86
+ };
85
87
  try {
86
- let { startRelay: n, ui: o } = e, c = n && o ? await i(e, t) : t;
88
+ let e = d ? await a(d, t) : t;
87
89
  await r.startExternalObjectPlanningAssistant(((e) => {
88
- let t = a(e);
90
+ let t = o(e);
89
91
  return {
90
92
  provider: "host",
91
93
  model: e.model,
92
94
  readsImages: e.readsImages,
93
- ...!0 === e.readsDocuments && { readsDocuments: !0 },
94
95
  ...t && { responsesProvider: t },
95
96
  ...e.provider === "azure" && !e.chatCompletions && !0 === e.referenceCacheBreakpoint && { referenceCacheBreakpoint: !0 },
96
97
  ...e.decisionApiKey && { decisionApiKey: e.decisionApiKey }
97
98
  };
98
99
  })({
99
- ...c,
100
+ ...e,
100
101
  decisionApiKey: t.decisionApiKey
101
- }), s);
102
+ }), c);
102
103
  } catch (e) {
103
- await o(String(e));
104
+ await s(String(e)), await f();
104
105
  return;
105
106
  }
106
- let c, l = () => {
107
- u();
108
- }, u = () => c ??= (async () => {
109
- n.removeEventListener("abort", l), await r.stopPlanningAssistant?.(s);
107
+ let p, m = () => {
108
+ h();
109
+ }, h = () => p ??= (async () => {
110
+ n.removeEventListener("abort", m), await r.stopPlanningAssistant?.(c), await f();
110
111
  })();
111
- if (n.addEventListener("abort", l, { once: !0 }), !n.aborted) return {
112
+ if (n.addEventListener("abort", m, { once: !0 }), !n.aborted) return {
112
113
  suspend: async () => {
113
- c || await r.suspendPlanningAssistant?.();
114
+ p || await r.suspendPlanningAssistant?.();
114
115
  },
115
116
  resume: async () => {
116
- c || await r.resumePlanningAssistant?.();
117
+ p || await r.resumePlanningAssistant?.();
117
118
  },
118
- dispose: u
119
+ dispose: h
119
120
  };
120
- await u();
121
- }, w = async ({ serverUrl: e, authorization: t }) => {
121
+ await h();
122
+ }, T = async ({ serverUrl: e, authorization: t }) => {
122
123
  let n = t ? { Authorization: t } : {}, r;
123
124
  try {
124
125
  let t = await fetch(`${e}/backends/list`, {
@@ -151,8 +152,8 @@ var o = (e, t) => t === e.libraryId ? e : {
151
152
  headers: n
152
153
  } }
153
154
  };
154
- }, T = async (e) => (await fetch(e)).blob(), E = async (e, t, { baseUrl: n, model: r, headers: i }) => {
155
- let { prompt: a, image: o, aspect: s } = JSON.parse(e.body), c = await T(o), l = new FormData();
155
+ }, E = async (e) => (await fetch(e)).blob(), D = async (e, t, { baseUrl: n, model: r, headers: i }) => {
156
+ let { prompt: a, image: o, aspect: s } = JSON.parse(e.body), c = await E(o), l = new FormData();
156
157
  l.append("model", r), l.append("prompt", a), l.append("size", ((e = "1:1") => {
157
158
  let [t, n] = e.split(":").map(Number);
158
159
  return t === n ? "1024x1024" : t > n ? "1536x1024" : "1024x1536";
@@ -165,11 +166,11 @@ var o = (e, t) => t === e.libraryId ? e : {
165
166
  });
166
167
  if (!u.ok) return u;
167
168
  let { data: d } = await u.json(), f = d?.[0]?.b64_json, p = new FormData();
168
- return f ? p.append("image", await T(`data:image/png;base64,${f}`)) : p.append("text", "The endpoint returned no image"), new Response(p);
169
- }, D = {
169
+ return f ? p.append("image", await E(`data:image/png;base64,${f}`)) : p.append("text", "The endpoint returned no image"), new Response(p);
170
+ }, O = {
170
171
  png: "image/png",
171
172
  jpg: "image/jpeg"
172
- }, O = (e, t, { baseUrl: n, model: r, headers: i }) => {
173
+ }, k = (e, t, { baseUrl: n, model: r, headers: i }) => {
173
174
  let { state: a, questions: o, assets: s = {} } = JSON.parse(e.body);
174
175
  return fetch(`${n}/decisions`, {
175
176
  method: "POST",
@@ -188,15 +189,15 @@ var o = (e, t) => t === e.libraryId ? e : {
188
189
  }, {
189
190
  type: "image",
190
191
  data: t.data_base64,
191
- mime_type: D[t.format]
192
+ mime_type: O[t.format]
192
193
  }])],
193
194
  questions: o
194
195
  }),
195
196
  signal: t
196
197
  });
197
- }, k = {
198
+ }, A = {
198
199
  HIDE: "hide",
199
200
  SHOW_ATTRIBUTES: "attributes",
200
201
  SHOW_ARTICLES: "articles"
201
202
  };
202
- export { k as HI_PANEL_ACTION, x as cleanupHi, h as createHiLibraryCallbacks, S as createHiMcpTools, f as libLoadArticleCatalog, m as libLoadCalcScript, p as libLoadMasterData, n as loadChatModel, v as omGetRequest, _ as omPostRequest, l as registerLegacyUrlFormat, O as requestDecisions, E as requestImageEdits, w as resolveHiModelProxy, b as setupHi, C as startPlanningAssistant, u as unregisterLegacyUrlFormat };
203
+ export { A as HI_PANEL_ACTION, S as cleanupHi, g as createHiLibraryCallbacks, C as createHiMcpTools, p as libLoadArticleCatalog, h as libLoadCalcScript, m as libLoadMasterData, n as loadChatModel, y as omGetRequest, v as omPostRequest, u as registerLegacyUrlFormat, k as requestDecisions, D as requestImageEdits, T as resolveHiModelProxy, x as setupHi, w as startPlanningAssistant, d as unregisterLegacyUrlFormat };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomle/embedding-lib",
3
- "version": "0.0.0-dev-ac159d1",
3
+ "version": "0.0.0-dev-2fa1a85",
4
4
  "description": "This is a small library which can be used to communicate with the Roomle Configurator. ES modules only (browser-compatible).",
5
5
  "type": "module",
6
6
  "main": "./roomle-embedding-lib.js",
@@ -32,4 +32,5 @@ export declare const hostAssistantModel: (model: PlanningAssistantConfig) => Pro
32
32
  export declare const serveAiModelRequests: (instance: AiModelInstance, options: AiModelHostOptions) => Promise<AiModelHostControl>;
33
33
  /** Serves the model of the HI Planning Assistant beside the host's registration. */
34
34
  export declare const keepAssistantModel: (instance: AiModelInstance, model: PlanningAssistantConfig) => Promise<PlanningAssistantConfig>;
35
+ export declare const releaseAssistantModel: (instance: AiModelInstance, model: PlanningAssistantConfig) => Promise<void>;
35
36
  export {};
@@ -3,8 +3,9 @@ import { PlanningAssistantOutput, PlanningAssistantPrompt } from '../planning-as
3
3
  import { PlanningAssistantConfig } from './chat-model';
4
4
  import { AgentMcpTools } from './mcp-tools';
5
5
  import { ConfigurationAssistantLog } from './session-log';
6
+ import { TurnAccess } from './turn-loop';
6
7
  /** Runs a browser agent with the tools and prompts supplied by its SDK domain. */
7
- export declare const createAssistant: (config: PlanningAssistantConfig, signal: AbortSignal, output: (part: PlanningAssistantOutput) => unknown, setupDomain: () => Promise<{
8
+ export declare const createAssistant: (config: PlanningAssistantConfig, signal: AbortSignal, output: (part: PlanningAssistantOutput) => unknown, setupDomain: (access: TurnAccess) => Promise<{
8
9
  prompts: {
9
10
  systemPrompt: string;
10
11
  imagePrompt: string;
@@ -28,8 +28,6 @@ export interface PlanningAssistantConfig {
28
28
  referenceCacheBreakpoint?: boolean;
29
29
  /** Whether the model reads images: the window offers the image drop only then. */
30
30
  readsImages: boolean;
31
- /** HI planning assistant only: whether the model reads PDF documents; the window offers the drop of a PDF only then. */
32
- readsDocuments?: boolean;
33
31
  /** HI planning assistant only: a Gemini key of the user's own for the decisions before a turn, sent with each decision request through the Roomle AI Gateway; without it the window's Roomle session pays, if any. */
34
32
  decisionApiKey?: string;
35
33
  }
@@ -232,10 +232,7 @@ var t = class {
232
232
  resolve: e,
233
233
  reject: t
234
234
  };
235
- };
236
- // packages/common/src/utils/rapi-version.ts
237
- (/* @__PURE__ */ "/items./items/{id}./items/{id}/renderings./items/{id}/conversions./items/{id}/3d-exports./items/{id}/perspectiveImage./items/{id}/perspectiveImageHD./items/{id}/topImage./items/{id}/tags./items/{id}/tagConnections./items/{id}/additionalContents./items/{id}/assetProcessings./items/{id}/3dAssets/{format}./items/{id}/3dAssets/{format}/{dummyFileName}./configurations./configurations/{id}./configurations/{id}/shares./configurations/{id}/renderings./configurations/{id}/3d-exports./configurations/{id}/3dAssets/{format}./configurations/{id}/3dAssets/{format}/{dummyFileName}./auth/signin./auth/signout./auth/reset./auth/reset/confirm./auth/change/pwd./auth/context./assets/analyze./version".split(".")).map((e) => RegExp("^" + e.replace(/\{[^}]+\}/g, "[^/]+") + "/?$"));
238
- var w = /\/v[23]\/?$/, T = (e, t) => w.test(e) ? e.replace(w, "/v2") + t : e + t, E = {
235
+ }, w = /\/v[23]\/?$/, T = (e, t) => e.replace(w, "/" + t), E = {
239
236
  SDK: "extended",
240
237
  CONFIGURATOR_SDK: "configurator",
241
238
  CALLBACKS: "callbacks",
@@ -258,7 +255,7 @@ var w = /\/v[23]\/?$/, T = (e, t) => w.test(e) ? e.replace(w, "/v2") + t : e + t
258
255
  return r.filter(M).map((e) => t + "." + i + e);
259
256
  }, P = async (e, t) => {
260
257
  if (typeof e != "string") throw Error("Configurator ID is not a string type: \"" + typeof e + "\"");
261
- let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = T(n, "/configurators/" + e), a = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), o = new Request(i, {
258
+ let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = T(n, "v2") + "/configurators/" + e, a = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), o = new Request(i, {
262
259
  method: "GET",
263
260
  headers: new Headers({
264
261
  apiKey: "roomle_portal_v2",
@@ -216,9 +216,7 @@ var t = class {
216
216
  resolve: e,
217
217
  reject: t
218
218
  };
219
- };
220
- (/* @__PURE__ */ "/items./items/{id}./items/{id}/renderings./items/{id}/conversions./items/{id}/3d-exports./items/{id}/perspectiveImage./items/{id}/perspectiveImageHD./items/{id}/topImage./items/{id}/tags./items/{id}/tagConnections./items/{id}/additionalContents./items/{id}/assetProcessings./items/{id}/3dAssets/{format}./items/{id}/3dAssets/{format}/{dummyFileName}./configurations./configurations/{id}./configurations/{id}/shares./configurations/{id}/renderings./configurations/{id}/3d-exports./configurations/{id}/3dAssets/{format}./configurations/{id}/3dAssets/{format}/{dummyFileName}./auth/signin./auth/signout./auth/reset./auth/reset/confirm./auth/change/pwd./auth/context./assets/analyze./version".split(".")).map((e) => RegExp("^" + e.replace(/\{[^}]+\}/g, "[^/]+") + "/?$"));
221
- var h = /\/v[23]\/?$/, g = {
219
+ }, h = /\/v[23]\/?$/, g = {
222
220
  SDK: "extended",
223
221
  CONFIGURATOR_SDK: "configurator",
224
222
  CALLBACKS: "callbacks",
@@ -241,9 +239,7 @@ var h = /\/v[23]\/?$/, g = {
241
239
  return r.filter(S).map((e) => t + "." + i + e);
242
240
  }, w = async (e, t) => {
243
241
  if (typeof e != "string") throw Error("Configurator ID is not a string type: \"" + typeof e + "\"");
244
- let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = (a = n, o = "/configurators/" + e, h.test(a) ? a.replace(h, "/v2") + o : a + o);
245
- var a, o;
246
- let s = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), c = new Request(i, {
242
+ let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = n.replace(h, "/v2") + "/configurators/" + e, a = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), o = new Request(i, {
247
243
  method: "GET",
248
244
  headers: new Headers({
249
245
  apiKey: "roomle_portal_v2",
@@ -251,13 +247,13 @@ var h = /\/v[23]\/?$/, g = {
251
247
  locale: "en",
252
248
  language: "en",
253
249
  device: 1,
254
- token: s,
250
+ token: a,
255
251
  platform: "web"
256
252
  }),
257
253
  mode: "cors",
258
254
  cache: "default"
259
- }), { configurator: l } = await (await fetch(c)).json();
260
- return l;
255
+ }), { configurator: s } = await (await fetch(o)).json();
256
+ return s;
261
257
  }, T = "data-rml-interaction-container", E = (e, t, n) => {
262
258
  let r = null;
263
259
  Object.defineProperty(e, t, {
package/sbom.cdx.json CHANGED
@@ -3,14 +3,14 @@
3
3
  "bomFormat": "CycloneDX",
4
4
  "specVersion": "1.6",
5
5
  "version": 1,
6
- "serialNumber": "urn:uuid:8272c322-285a-55a9-978f-7b990da33d31",
6
+ "serialNumber": "urn:uuid:9131fdc7-1eec-57df-b6d1-d468cd4611e6",
7
7
  "metadata": {
8
- "timestamp": "2026-11-24T08:25:07.000Z",
8
+ "timestamp": "2026-11-24T16:27:11.000Z",
9
9
  "component": {
10
10
  "type": "library",
11
11
  "name": "@roomle/embedding-lib",
12
- "version": "ac159d1e03147911a5fb6eef466f658423c3253b",
13
- "bom-ref": "@roomle/embedding-lib@ac159d1e03147911a5fb6eef466f658423c3253b"
12
+ "version": "2fa1a852f106ade433898ebf1c5192d1b37811b6",
13
+ "bom-ref": "@roomle/embedding-lib@2fa1a852f106ade433898ebf1c5192d1b37811b6"
14
14
  }
15
15
  },
16
16
  "components": [
@@ -351,7 +351,7 @@
351
351
  ],
352
352
  "dependencies": [
353
353
  {
354
- "ref": "@roomle/embedding-lib@ac159d1e03147911a5fb6eef466f658423c3253b"
354
+ "ref": "@roomle/embedding-lib@2fa1a852f106ade433898ebf1c5192d1b37811b6"
355
355
  },
356
356
  {
357
357
  "ref": "pkg:npm/%40ai-sdk/anthropic@4.0.68"