@roomle/embedding-lib 0.0.0-dev-9d077e2 → 0.0.0-dev-c1bdbb4
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/{drag-ghost-BOwjMbG3.mjs → drag-ghost-BxqPJdhq.mjs} +1 -1
- package/{drag-ghost-BQ8r6NVo.mjs → drag-ghost-CDFtC1pd.mjs} +1 -1
- package/{drag-in-BP_E53zb.mjs → drag-in-CV1E-DO6.mjs} +2 -2
- package/{drag-in-QhL3zGC0.mjs → drag-in-ClPpCYyi.mjs} +2 -2
- package/embedding-plugins.js +1 -1
- package/embedding-plugins.min.js +1 -1
- package/{from-custom-view-BM_zRJCf.mjs → from-custom-view-Q9A-J7qV.mjs} +2 -2
- package/{from-custom-view-D2Z1YmCx.mjs → from-custom-view-Sx6P6iDI.mjs} +2 -2
- package/{from-website-DlklVbxU.mjs → from-website-BmCO2xli.mjs} +2 -2
- package/{from-website-CPVeVVMI.mjs → from-website-DZJy_l42.mjs} +2 -2
- package/hi.js +194 -39
- package/hi.min.js +175 -38
- package/package.json +1 -8
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp-tools.d.ts +61 -4
- package/packages/embedding-lib/src/homag-intelligence/hi-planning-assistant.d.ts +40 -4
- package/roomle-embedding-lib.js +1 -1
- package/roomle-embedding-lib.min.js +1 -1
- package/configurator.d.ts +0 -2
- package/configurator.js +0 -119
- package/configurator.min.js +0 -117
- package/packages/embedding-lib/src/configurator-agent/chat-recovery.d.ts +0 -9
- package/packages/embedding-lib/src/configurator-agent/configurator-mcp-tools.d.ts +0 -11
- package/packages/embedding-lib/src/configurator-agent/configurator-planning-assistant.d.ts +0 -8
- package/packages/embedding-lib/src/configurator.d.ts +0 -3
- package/packages/embedding-lib/src/planning-assistant/chat-model.d.ts +0 -33
- package/packages/embedding-lib/src/planning-assistant/mcp-tools.d.ts +0 -52
- package/packages/embedding-lib/src/planning-assistant/planning-assistant.d.ts +0 -23
- package/planning-assistant-BW9fNGZO.mjs +0 -158
- package/planning-assistant-CyVA2uUX.mjs +0 -143
- /package/{comlink-BJnhpJa4.mjs → comlink-B2Kj_5Ge.mjs} +0 -0
- /package/{comlink-lSsogKgb.mjs → comlink-B5lV2OWp.mjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, m as r, o as i, s as a } from "./drag-in-
|
|
1
|
+
import { a as e, c as t, i as n, m as r, o as i, s as a } from "./drag-in-ClPpCYyi.mjs";
|
|
2
2
|
import "./embedding-plugins.js";
|
|
3
3
|
//#region packages/common/src/utils/drag.ts
|
|
4
4
|
var o = (e, t, n = 0, r = 0) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, m as r, o as i, s as a } from "./drag-in-
|
|
1
|
+
import { a as e, c as t, i as n, m as r, o as i, s as a } from "./drag-in-CV1E-DO6.mjs";
|
|
2
2
|
import "./embedding-plugins.min.js";
|
|
3
3
|
var o = (e, t, n = 0, r = 0) => {
|
|
4
4
|
let i = t.x + t.width + n, a = t.x - n, o = t.y + t.height + r, s = t.y - r, { x: c, y: l } = e;
|
|
@@ -34,7 +34,7 @@ var e = Object.defineProperty, t = (t, n) => {
|
|
|
34
34
|
}
|
|
35
35
|
async init() {
|
|
36
36
|
if (await super.init(), this._mode === "website") try {
|
|
37
|
-
let { DragInFromWebsiteStrategy: e } = await import("./from-website-
|
|
37
|
+
let { DragInFromWebsiteStrategy: e } = await import("./from-website-BmCO2xli.mjs");
|
|
38
38
|
this._strategy = new e(this._instance, this._mainDomElement, {
|
|
39
39
|
settings: this.options,
|
|
40
40
|
mode: "website"
|
|
@@ -45,7 +45,7 @@ var e = Object.defineProperty, t = (t, n) => {
|
|
|
45
45
|
else {
|
|
46
46
|
if (this._mode !== "custom-view") throw Error("Unsupported mode");
|
|
47
47
|
try {
|
|
48
|
-
let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-
|
|
48
|
+
let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-Sx6P6iDI.mjs");
|
|
49
49
|
this._strategy = new e(this._instance, this._mainDomElement, this.options, this._viewName);
|
|
50
50
|
} catch (e) {
|
|
51
51
|
throw e;
|
|
@@ -41,7 +41,7 @@ var e = Object.defineProperty, t = (t, n) => {
|
|
|
41
41
|
}
|
|
42
42
|
async init() {
|
|
43
43
|
if (await super.init(), this._mode === "website") try {
|
|
44
|
-
let { DragInFromWebsiteStrategy: e } = await import("./from-website-
|
|
44
|
+
let { DragInFromWebsiteStrategy: e } = await import("./from-website-DZJy_l42.mjs");
|
|
45
45
|
this._strategy = new e(this._instance, this._mainDomElement, {
|
|
46
46
|
settings: this.options,
|
|
47
47
|
mode: "website"
|
|
@@ -50,7 +50,7 @@ var e = Object.defineProperty, t = (t, n) => {
|
|
|
50
50
|
throw console.error("Could not load Dragin strategy \"FromWebsite\""), e;
|
|
51
51
|
}
|
|
52
52
|
else if (this._mode === "custom-view") try {
|
|
53
|
-
let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-
|
|
53
|
+
let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-Q9A-J7qV.mjs");
|
|
54
54
|
this._strategy = new e(this._instance, this._mainDomElement, this.options, this._viewName);
|
|
55
55
|
} catch (e) {
|
|
56
56
|
throw console.error("Could not load Dragin strategy \"FromCustomView\""), e;
|
package/embedding-plugins.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, h as i, i as a, m as o, o as s, s as c, t as l, u } from "./drag-in-
|
|
1
|
+
import { a as e, c as t, d as n, f as r, h as i, i as a, m as o, o as s, s as c, t as l, u } from "./drag-in-ClPpCYyi.mjs";
|
|
2
2
|
export { l as DragIn, a as RML_DRAG_GHOST_FADE_IN, e as RML_DRAG_GHOST_FADE_IN_ANIMATION_CSS, s as RML_DRAG_GHOST_FADE_OUT, c as RML_DRAG_GHOST_FADE_OUT_ANIMATION_CSS, t as RML_DRAG_IN_DRAG_ELEMENT_ID, u as RML_DRAG_IN_FALLBACK_GHOST_HEIGHT, n as RML_DRAG_IN_FALLBACK_GHOST_URL, r as RML_DRAG_IN_FALLBACK_GHOST_WIDTH, o as RML_DRAG_IN_STYLES_ID, i as TARGET_OPACITY };
|
package/embedding-plugins.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, h as i, i as a, m as o, o as s, s as c, t as l, u } from "./drag-in-
|
|
1
|
+
import { a as e, c as t, d as n, f as r, h as i, i as a, m as o, o as s, s as c, t as l, u } from "./drag-in-CV1E-DO6.mjs";
|
|
2
2
|
export { l as DragIn, a as RML_DRAG_GHOST_FADE_IN, e as RML_DRAG_GHOST_FADE_IN_ANIMATION_CSS, s as RML_DRAG_GHOST_FADE_OUT, c as RML_DRAG_GHOST_FADE_OUT_ANIMATION_CSS, t as RML_DRAG_IN_DRAG_ELEMENT_ID, u as RML_DRAG_IN_FALLBACK_GHOST_HEIGHT, n as RML_DRAG_IN_FALLBACK_GHOST_URL, r as RML_DRAG_IN_FALLBACK_GHOST_WIDTH, o as RML_DRAG_IN_STYLES_ID, i as TARGET_OPACITY };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as e } from "./drag-in-
|
|
1
|
+
import { d as e } from "./drag-in-ClPpCYyi.mjs";
|
|
2
2
|
import { a as t, c as n, n as r } from "./utils-DxJ3PcKe.mjs";
|
|
3
|
-
import { t as i } from "./drag-ghost-
|
|
3
|
+
import { t as i } from "./drag-ghost-BxqPJdhq.mjs";
|
|
4
4
|
var a = (e, t = 0) => n(e) ? {
|
|
5
5
|
clientX: e.touches[t].clientX,
|
|
6
6
|
clientY: e.touches[t].clientY
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as e } from "./drag-in-
|
|
1
|
+
import { d as e } from "./drag-in-CV1E-DO6.mjs";
|
|
2
2
|
import { a as t, c as n, n as r } from "./utils-wJ80awOA.mjs";
|
|
3
|
-
import { t as i } from "./drag-ghost-
|
|
3
|
+
import { t as i } from "./drag-ghost-CDFtC1pd.mjs";
|
|
4
4
|
var a = (e, t = 0) => n(e) ? {
|
|
5
5
|
clientX: e.touches[t].clientX,
|
|
6
6
|
clientY: e.touches[t].clientY
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { l as e, p as t, r as n } from "./drag-in-
|
|
1
|
+
import { l as e, p as t, r as n } from "./drag-in-CV1E-DO6.mjs";
|
|
2
2
|
import { c as r, i, n as a, o, r as s, s as c } from "./utils-wJ80awOA.mjs";
|
|
3
|
-
import { t as l } from "./drag-ghost-
|
|
3
|
+
import { t as l } from "./drag-ghost-CDFtC1pd.mjs";
|
|
4
4
|
var u = class {
|
|
5
5
|
_options = {};
|
|
6
6
|
_instance;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { l as e, p as t, r as n } from "./drag-in-
|
|
1
|
+
import { l as e, p as t, r as n } from "./drag-in-ClPpCYyi.mjs";
|
|
2
2
|
import { c as r, i, n as a, o, r as s, s as c } from "./utils-DxJ3PcKe.mjs";
|
|
3
|
-
import { t as l } from "./drag-ghost-
|
|
3
|
+
import { t as l } from "./drag-ghost-BxqPJdhq.mjs";
|
|
4
4
|
//#region packages/embedding-lib/src/plugins/strategy/from-website.ts
|
|
5
5
|
var u = class {
|
|
6
6
|
_options = {};
|
package/hi.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { t as e } from "./browser-CW9o-dtT.mjs";
|
|
2
2
|
import { t } from "./utils-DxJ3PcKe.mjs";
|
|
3
|
-
|
|
4
|
-
var a = (e, t) => t === e.libraryId ? e : {
|
|
3
|
+
var n = (e, t) => t === e.libraryId ? e : {
|
|
5
4
|
...e,
|
|
6
5
|
libraryId: t
|
|
7
|
-
},
|
|
6
|
+
}, r = async (e, t, n, r = { property: "default" }) => {
|
|
8
7
|
let i = n.serverOptions ?? {}, a = { headers: {
|
|
9
8
|
"Content-Type": t === "json" ? "application/json" : "text/plain",
|
|
10
9
|
"Access-Control-Allow-Origin": "*"
|
|
@@ -17,22 +16,22 @@ var a = (e, t) => t === e.libraryId ? e : {
|
|
|
17
16
|
} catch (e) {
|
|
18
17
|
throw console.warn(`Failed to fetch data from ${r.property}`), console.error(e), e;
|
|
19
18
|
}
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
},
|
|
19
|
+
}, i = { "e2fe8b3d-da31-4a20-92ab-ab6e3839300e": new Set(["Furniture_Smith"]) }, a = (e, t) => {
|
|
20
|
+
i[e] || (i[e] = /* @__PURE__ */ new Set()), i[e].add(t);
|
|
21
|
+
}, o = (e, t) => {
|
|
22
|
+
i[e]?.delete(t), i[e]?.size === 0 && delete i[e];
|
|
23
|
+
}, s = (e, t) => {
|
|
25
24
|
let { libraryId: n, serverOptions: r } = e;
|
|
26
|
-
return r?.subscriptionId &&
|
|
27
|
-
},
|
|
28
|
-
let t = await (await
|
|
25
|
+
return r?.subscriptionId && i[r.subscriptionId]?.has(n) ? `api/pos/${t}?libraryId=${n}` : `api/pos/libraries/${n}/${t}`;
|
|
26
|
+
}, c = async (e) => await (await r(s(e, "articles"), "json", e, { property: "articles" })).json(), l = async (e) => await (await r(s(e, "masterData"), "json", e, { property: "masterData" })).json(), u = async (e) => {
|
|
27
|
+
let t = await (await r(s(e, "calc.js"), "text", e, { property: "calc.js" })).text();
|
|
29
28
|
if (!t) throw Error("Script load error");
|
|
30
29
|
return t;
|
|
31
|
-
},
|
|
32
|
-
onLoadJavascript: (t) =>
|
|
33
|
-
onLoadArticleCatalog: (t) =>
|
|
34
|
-
onLoadMasterData: (t) =>
|
|
35
|
-
}),
|
|
30
|
+
}, d = (e) => ({
|
|
31
|
+
onLoadJavascript: (t) => u(n(e, t)),
|
|
32
|
+
onLoadArticleCatalog: (t) => c(n(e, t)),
|
|
33
|
+
onLoadMasterData: (t) => l(n(e, t))
|
|
34
|
+
}), f = async (e, t, n, r = {}) => {
|
|
36
35
|
let { baseUrl: i, om: a } = e.serverOptions ?? {}, o = encodeURIComponent(a?.endpointUrl || ""), s = encodeURIComponent(a?.subscriptionId || ""), c = a?.key || "";
|
|
37
36
|
return await (await fetch((i ?? "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=") + `${encodeURIComponent(n)}&subscriptionId=${s}&apiKey=${c}&baseUrl=${o}`, {
|
|
38
37
|
method: "POST",
|
|
@@ -42,7 +41,7 @@ var a = (e, t) => t === e.libraryId ? e : {
|
|
|
42
41
|
...r
|
|
43
42
|
}
|
|
44
43
|
})).json();
|
|
45
|
-
},
|
|
44
|
+
}, p = async (e, t, n = {}) => {
|
|
46
45
|
let { baseUrl: r, om: i } = e.serverOptions ?? {}, a = encodeURIComponent(i?.endpointUrl || ""), o = encodeURIComponent(i?.subscriptionId || ""), s = i?.key || "";
|
|
47
46
|
return await (await fetch((r ?? "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=") + `${encodeURIComponent(t)}&subscriptionId=${o}&apiKey=${s}&baseUrl=${a}`, {
|
|
48
47
|
method: "GET",
|
|
@@ -51,34 +50,190 @@ var a = (e, t) => t === e.libraryId ? e : {
|
|
|
51
50
|
...n
|
|
52
51
|
}
|
|
53
52
|
})).json();
|
|
54
|
-
},
|
|
53
|
+
}, m = (t, n) => {
|
|
55
54
|
t.serverOptions ||= {}, !t.serverOptions.language && n?.locale && (t.serverOptions.language = n.locale), t.serverOptions.language || (t.serverOptions.language = e(null, !0));
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
let
|
|
59
|
-
|
|
60
|
-
let { expose:
|
|
61
|
-
|
|
55
|
+
}, h = null, g = async (e, r = {}) => {
|
|
56
|
+
h && window.removeEventListener("message", h);
|
|
57
|
+
let i = typeof e == "string" ? { libraryId: e } : e;
|
|
58
|
+
r.onLoadJavascript === void 0 && (r.onLoadJavascript = (e) => u(n(i, e))), r.onLoadArticleCatalog === void 0 && (r.onLoadArticleCatalog = (e) => c(n(i, e))), r.onLoadMasterData === void 0 && (r.onLoadMasterData = (e) => l(n(i, e)));
|
|
59
|
+
let { expose: a } = await import("./comlink-B5lV2OWp.mjs");
|
|
60
|
+
h = (e) => {
|
|
62
61
|
if (e.data.type === "connect_hi" && e.data.port) {
|
|
63
|
-
let
|
|
64
|
-
|
|
62
|
+
let n = e.data.port;
|
|
63
|
+
m(i, e.data.globalInitData || {}), n.start?.(), a(t(r), n);
|
|
65
64
|
}
|
|
66
|
-
}, window.addEventListener("message",
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
},
|
|
65
|
+
}, window.addEventListener("message", h);
|
|
66
|
+
}, _ = () => {
|
|
67
|
+
h &&= (window.removeEventListener("message", h), null);
|
|
68
|
+
}, v = ({ output: e }) => ({
|
|
69
|
+
type: "content",
|
|
70
|
+
value: e.content.map((e) => e.type === "text" ? {
|
|
71
|
+
type: "text",
|
|
72
|
+
text: e.text
|
|
73
|
+
} : {
|
|
74
|
+
type: "file",
|
|
75
|
+
mediaType: e.mimeType,
|
|
76
|
+
data: {
|
|
77
|
+
type: "data",
|
|
78
|
+
data: e.data
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
}), y = async ({ extended: e }) => {
|
|
70
82
|
if (typeof e.getExternalObjectAgentTools != "function") throw Error("The planner has no HI agent tools: it needs a Rubens UI with getExternalObjectAgentTools.");
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
83
|
+
let t = await e.getExternalObjectAgentTools();
|
|
84
|
+
return Object.fromEntries(t.map(({ name: t, description: n, inputSchema: r }) => {
|
|
85
|
+
let i = () => r;
|
|
86
|
+
return [t, {
|
|
87
|
+
type: "dynamic",
|
|
88
|
+
description: n,
|
|
89
|
+
inputSchema: { "~standard": {
|
|
90
|
+
version: 1,
|
|
91
|
+
vendor: "hi-mcp",
|
|
92
|
+
validate: (e) => ({ value: e }),
|
|
93
|
+
jsonSchema: {
|
|
94
|
+
input: i,
|
|
95
|
+
output: i
|
|
96
|
+
}
|
|
97
|
+
} },
|
|
98
|
+
execute: (n) => e.callExternalObjectAgentTool(t, n).catch((e) => ({
|
|
99
|
+
content: [{
|
|
100
|
+
type: "text",
|
|
101
|
+
text: e instanceof Error ? e.message : String(e)
|
|
102
|
+
}],
|
|
103
|
+
isError: !0
|
|
104
|
+
})),
|
|
105
|
+
toModelOutput: v
|
|
106
|
+
}];
|
|
107
|
+
}));
|
|
108
|
+
}, b = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, x = 16, S = (e = {}) => ({
|
|
109
|
+
inputTokens: e.inputTokens ?? null,
|
|
110
|
+
outputTokens: e.outputTokens ?? null,
|
|
111
|
+
totalTokens: e.totalTokens ?? (e.inputTokens !== void 0 && e.outputTokens !== void 0 ? e.inputTokens + e.outputTokens : null)
|
|
112
|
+
}), C = (e) => e.some((e) => e !== null) ? e.reduce((e, t) => e + (t ?? 0), 0) : null, w = async ({ provider: e, model: t, apiKey: n, baseUrl: r, chatCompletions: i, reasoningEffort: a }) => {
|
|
113
|
+
switch (e) {
|
|
114
|
+
case "azure": {
|
|
115
|
+
let { createAzure: e } = await import(
|
|
116
|
+
/* @vite-ignore */
|
|
117
|
+
b("@ai-sdk/azure@4.0.85")
|
|
118
|
+
), o = e({
|
|
119
|
+
apiKey: n,
|
|
120
|
+
baseURL: r
|
|
121
|
+
});
|
|
122
|
+
return {
|
|
123
|
+
languageModel: i ? o.chat(t) : o(t),
|
|
124
|
+
providerOptions: a ? { azure: { reasoningEffort: a } } : void 0
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
case "mistral": {
|
|
128
|
+
let { createMistral: e } = await import(
|
|
129
|
+
/* @vite-ignore */
|
|
130
|
+
b("@ai-sdk/mistral@4.0.54")
|
|
131
|
+
);
|
|
132
|
+
return { languageModel: e({ apiKey: n })(t) };
|
|
133
|
+
}
|
|
134
|
+
case "anthropic": {
|
|
135
|
+
let { createAnthropic: e } = await import(
|
|
136
|
+
/* @vite-ignore */
|
|
137
|
+
b("@ai-sdk/anthropic@4.0.68")
|
|
138
|
+
);
|
|
139
|
+
return { languageModel: e({
|
|
140
|
+
apiKey: n,
|
|
141
|
+
headers: { "anthropic-dangerous-direct-browser-access": "true" }
|
|
142
|
+
})(t) };
|
|
143
|
+
}
|
|
144
|
+
case "google": {
|
|
145
|
+
let { createGoogleGenerativeAI: e } = await import(
|
|
146
|
+
/* @vite-ignore */
|
|
147
|
+
b("@ai-sdk/google@4.0.85")
|
|
148
|
+
);
|
|
149
|
+
return { languageModel: e({ apiKey: n })(t) };
|
|
150
|
+
}
|
|
151
|
+
default: throw Error(`Unknown provider "${e}" - supported: azure, mistral, anthropic, google`);
|
|
152
|
+
}
|
|
153
|
+
}, T = async (e, t, n) => {
|
|
154
|
+
let r = e.extended, i = (e) => r.planningAssistantOutput(e), a;
|
|
155
|
+
try {
|
|
156
|
+
a = await Promise.all([
|
|
157
|
+
import(
|
|
158
|
+
/* @vite-ignore */
|
|
159
|
+
b("ai@7.0.122")
|
|
160
|
+
),
|
|
161
|
+
w(t),
|
|
162
|
+
r.getExternalObjectAgentPrompts(),
|
|
163
|
+
y(e)
|
|
164
|
+
]);
|
|
165
|
+
} catch (e) {
|
|
166
|
+
console.log("[planning-assistant]", String(e)), i({
|
|
167
|
+
type: "availability",
|
|
168
|
+
available: !1,
|
|
169
|
+
text: String(e)
|
|
170
|
+
});
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
let [{ streamText: o, stepCountIs: s }, c, l, u] = a, d = [];
|
|
174
|
+
r.callbacks.onPlanningAssistantPrompt = async ({ text: e, images: r }) => {
|
|
175
|
+
let a = [], f, p = !1, m = {
|
|
176
|
+
role: "user",
|
|
177
|
+
content: [{
|
|
178
|
+
type: "text",
|
|
179
|
+
text: e || l.imagePrompt
|
|
180
|
+
}, ...r.map((e) => ({
|
|
181
|
+
type: "file",
|
|
182
|
+
data: e,
|
|
183
|
+
mediaType: "image/jpeg"
|
|
184
|
+
}))]
|
|
185
|
+
};
|
|
186
|
+
try {
|
|
187
|
+
let e = o({
|
|
188
|
+
model: c.languageModel,
|
|
189
|
+
providerOptions: c.providerOptions,
|
|
190
|
+
instructions: l.systemPrompt,
|
|
191
|
+
messages: [...d, m],
|
|
192
|
+
tools: u,
|
|
193
|
+
stopWhen: s(x),
|
|
194
|
+
abortSignal: n,
|
|
195
|
+
prepareStep: ({ stepNumber: e }) => e === x - 1 ? { toolChoice: "none" } : void 0
|
|
196
|
+
});
|
|
197
|
+
for await (let t of e.stream) if (t.type === "text-delta") i({
|
|
198
|
+
type: "text",
|
|
199
|
+
text: t.text
|
|
200
|
+
});
|
|
201
|
+
else if (t.type === "tool-call") i({
|
|
202
|
+
type: "activity",
|
|
203
|
+
text: t.toolName
|
|
204
|
+
});
|
|
205
|
+
else if (t.type === "error") throw t.error;
|
|
206
|
+
else t.type === "finish-step" ? a.push(S(t.usage)) : t.type === "finish" ? f = S(t.totalUsage) : t.type === "abort" && (p = !0);
|
|
207
|
+
d.push(m, ...await e.responseMessages), i({ type: "done" });
|
|
208
|
+
} catch (e) {
|
|
209
|
+
console.log("[planning-assistant]", String(e)), i({
|
|
210
|
+
type: "error",
|
|
211
|
+
text: `The planning assistant failed: ${e instanceof Error ? e.message : String(e)}`
|
|
212
|
+
});
|
|
213
|
+
} finally {
|
|
214
|
+
let e = {
|
|
215
|
+
inputTokens: f?.inputTokens ?? C(a.map((e) => e.inputTokens)),
|
|
216
|
+
outputTokens: f?.outputTokens ?? C(a.map((e) => e.outputTokens)),
|
|
217
|
+
totalTokens: f?.totalTokens ?? C(a.map((e) => e.totalTokens))
|
|
218
|
+
}, r = Object.values(e).some((e) => e !== null), i = f && !p && !n.aborted && Object.values(e).every((e) => e !== null) && a.every((e) => Object.values(e).every((e) => e !== null));
|
|
219
|
+
console.log(`[planning-assistant] usage ${JSON.stringify({
|
|
220
|
+
provider: t.provider,
|
|
221
|
+
model: t.model,
|
|
222
|
+
status: r ? i ? "complete" : "partial" : "unavailable",
|
|
223
|
+
...e
|
|
224
|
+
})}`);
|
|
225
|
+
}
|
|
226
|
+
}, i({
|
|
227
|
+
type: "images",
|
|
228
|
+
enabled: t.readsImages
|
|
229
|
+
}), i({
|
|
230
|
+
type: "availability",
|
|
231
|
+
available: !0
|
|
232
|
+
});
|
|
233
|
+
}, E = {
|
|
79
234
|
HIDE: "hide",
|
|
80
235
|
SHOW_ATTRIBUTES: "attributes",
|
|
81
236
|
SHOW_ARTICLES: "articles"
|
|
82
237
|
};
|
|
83
238
|
//#endregion
|
|
84
|
-
export {
|
|
239
|
+
export { E as HI_PANEL_ACTION, _ as cleanupHi, d as createHiLibraryCallbacks, y as createHiMcpTools, c as libLoadArticleCatalog, u as libLoadCalcScript, l as libLoadMasterData, w as loadChatModel, p as omGetRequest, f as omPostRequest, a as registerLegacyUrlFormat, g as setupHi, T as startPlanningAssistant, o as unregisterLegacyUrlFormat };
|
package/hi.min.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { t as e } from "./browser-BxG7yIaK.mjs";
|
|
2
2
|
import { t } from "./utils-wJ80awOA.mjs";
|
|
3
|
-
|
|
4
|
-
var a = (e, t) => t === e.libraryId ? e : {
|
|
3
|
+
var n = (e, t) => t === e.libraryId ? e : {
|
|
5
4
|
...e,
|
|
6
5
|
libraryId: t
|
|
7
|
-
},
|
|
6
|
+
}, r = async (e, t, n, r = { property: "default" }) => {
|
|
8
7
|
let i = n.serverOptions ?? {}, a = { headers: {
|
|
9
8
|
"Content-Type": t === "json" ? "application/json" : "text/plain",
|
|
10
9
|
"Access-Control-Allow-Origin": "*"
|
|
@@ -18,22 +17,22 @@ var a = (e, t) => t === e.libraryId ? e : {
|
|
|
18
17
|
} catch (e) {
|
|
19
18
|
throw e;
|
|
20
19
|
}
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
},
|
|
20
|
+
}, i = { "e2fe8b3d-da31-4a20-92ab-ab6e3839300e": new Set(["Furniture_Smith"]) }, a = (e, t) => {
|
|
21
|
+
i[e] || (i[e] = /* @__PURE__ */ new Set()), i[e].add(t);
|
|
22
|
+
}, o = (e, t) => {
|
|
23
|
+
i[e]?.delete(t), i[e]?.size === 0 && delete i[e];
|
|
24
|
+
}, s = (e, t) => {
|
|
26
25
|
let { libraryId: n, serverOptions: r } = e;
|
|
27
|
-
return r?.subscriptionId &&
|
|
28
|
-
},
|
|
29
|
-
let t = await (await
|
|
26
|
+
return r?.subscriptionId && i[r.subscriptionId]?.has(n) ? `api/pos/${t}?libraryId=${n}` : `api/pos/libraries/${n}/${t}`;
|
|
27
|
+
}, c = async (e) => await (await r(s(e, "articles"), "json", e, { property: "articles" })).json(), l = async (e) => await (await r(s(e, "masterData"), "json", e, { property: "masterData" })).json(), u = async (e) => {
|
|
28
|
+
let t = await (await r(s(e, "calc.js"), "text", e, { property: "calc.js" })).text();
|
|
30
29
|
if (!t) throw Error("Script load error");
|
|
31
30
|
return t;
|
|
32
|
-
},
|
|
33
|
-
onLoadJavascript: (t) =>
|
|
34
|
-
onLoadArticleCatalog: (t) =>
|
|
35
|
-
onLoadMasterData: (t) =>
|
|
36
|
-
}),
|
|
31
|
+
}, d = (e) => ({
|
|
32
|
+
onLoadJavascript: (t) => u(n(e, t)),
|
|
33
|
+
onLoadArticleCatalog: (t) => c(n(e, t)),
|
|
34
|
+
onLoadMasterData: (t) => l(n(e, t))
|
|
35
|
+
}), f = async (e, t, n, r = {}) => {
|
|
37
36
|
let { baseUrl: i, om: a } = e.serverOptions ?? {}, o = encodeURIComponent(a?.endpointUrl || ""), s = encodeURIComponent(a?.subscriptionId || ""), c = a?.key || "";
|
|
38
37
|
return await (await fetch((i ?? "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=") + `${encodeURIComponent(n)}&subscriptionId=${s}&apiKey=${c}&baseUrl=${o}`, {
|
|
39
38
|
method: "POST",
|
|
@@ -43,7 +42,7 @@ var a = (e, t) => t === e.libraryId ? e : {
|
|
|
43
42
|
...r
|
|
44
43
|
}
|
|
45
44
|
})).json();
|
|
46
|
-
},
|
|
45
|
+
}, p = async (e, t, n = {}) => {
|
|
47
46
|
let { baseUrl: r, om: i } = e.serverOptions ?? {}, a = encodeURIComponent(i?.endpointUrl || ""), o = encodeURIComponent(i?.subscriptionId || ""), s = i?.key || "";
|
|
48
47
|
return await (await fetch((r ?? "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=") + `${encodeURIComponent(t)}&subscriptionId=${o}&apiKey=${s}&baseUrl=${a}`, {
|
|
49
48
|
method: "GET",
|
|
@@ -52,33 +51,171 @@ var a = (e, t) => t === e.libraryId ? e : {
|
|
|
52
51
|
...n
|
|
53
52
|
}
|
|
54
53
|
})).json();
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
let
|
|
58
|
-
|
|
59
|
-
let { expose: o } = await import("./comlink-
|
|
60
|
-
|
|
54
|
+
}, m = null, h = async (r, i = {}) => {
|
|
55
|
+
m && window.removeEventListener("message", m);
|
|
56
|
+
let a = typeof r == "string" ? { libraryId: r } : r;
|
|
57
|
+
i.onLoadJavascript === void 0 && (i.onLoadJavascript = (e) => u(n(a, e))), i.onLoadArticleCatalog === void 0 && (i.onLoadArticleCatalog = (e) => c(n(a, e))), i.onLoadMasterData === void 0 && (i.onLoadMasterData = (e) => l(n(a, e)));
|
|
58
|
+
let { expose: o } = await import("./comlink-B2Kj_5Ge.mjs");
|
|
59
|
+
m = (n) => {
|
|
61
60
|
if (n.data.type === "connect_hi" && n.data.port) {
|
|
62
|
-
let
|
|
61
|
+
let r = n.data.port;
|
|
63
62
|
((t, n) => {
|
|
64
63
|
t.serverOptions ||= {}, !t.serverOptions.language && n?.locale && (t.serverOptions.language = n.locale), t.serverOptions.language || (t.serverOptions.language = e(null, !0));
|
|
65
|
-
})(
|
|
64
|
+
})(a, n.data.globalInitData || {}), r.start?.(), o(t(i), r);
|
|
66
65
|
}
|
|
67
|
-
}, window.addEventListener("message",
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
},
|
|
66
|
+
}, window.addEventListener("message", m);
|
|
67
|
+
}, g = () => {
|
|
68
|
+
m &&= (window.removeEventListener("message", m), null);
|
|
69
|
+
}, _ = ({ output: e }) => ({
|
|
70
|
+
type: "content",
|
|
71
|
+
value: e.content.map((e) => e.type === "text" ? {
|
|
72
|
+
type: "text",
|
|
73
|
+
text: e.text
|
|
74
|
+
} : {
|
|
75
|
+
type: "file",
|
|
76
|
+
mediaType: e.mimeType,
|
|
77
|
+
data: {
|
|
78
|
+
type: "data",
|
|
79
|
+
data: e.data
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
}), v = async ({ extended: e }) => {
|
|
71
83
|
if (typeof e.getExternalObjectAgentTools != "function") throw Error("The planner has no HI agent tools: it needs a Rubens UI with getExternalObjectAgentTools.");
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
let t = await e.getExternalObjectAgentTools();
|
|
85
|
+
return Object.fromEntries(t.map(({ name: t, description: n, inputSchema: r }) => {
|
|
86
|
+
let i = () => r;
|
|
87
|
+
return [t, {
|
|
88
|
+
type: "dynamic",
|
|
89
|
+
description: n,
|
|
90
|
+
inputSchema: { "~standard": {
|
|
91
|
+
version: 1,
|
|
92
|
+
vendor: "hi-mcp",
|
|
93
|
+
validate: (e) => ({ value: e }),
|
|
94
|
+
jsonSchema: {
|
|
95
|
+
input: i,
|
|
96
|
+
output: i
|
|
97
|
+
}
|
|
98
|
+
} },
|
|
99
|
+
execute: (n) => e.callExternalObjectAgentTool(t, n).catch((e) => ({
|
|
100
|
+
content: [{
|
|
101
|
+
type: "text",
|
|
102
|
+
text: e instanceof Error ? e.message : String(e)
|
|
103
|
+
}],
|
|
104
|
+
isError: !0
|
|
105
|
+
})),
|
|
106
|
+
toModelOutput: _
|
|
107
|
+
}];
|
|
108
|
+
}));
|
|
109
|
+
}, y = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, b = (e = {}) => ({
|
|
110
|
+
inputTokens: e.inputTokens ?? null,
|
|
111
|
+
outputTokens: e.outputTokens ?? null,
|
|
112
|
+
totalTokens: e.totalTokens ?? (e.inputTokens !== void 0 && e.outputTokens !== void 0 ? e.inputTokens + e.outputTokens : null)
|
|
113
|
+
}), x = (e) => e.some((e) => e !== null) ? e.reduce((e, t) => e + (t ?? 0), 0) : null, S = async ({ provider: e, model: t, apiKey: n, baseUrl: r, chatCompletions: i, reasoningEffort: a }) => {
|
|
114
|
+
switch (e) {
|
|
115
|
+
case "azure": {
|
|
116
|
+
let { createAzure: e } = await import(y("@ai-sdk/azure@4.0.85")), o = e({
|
|
117
|
+
apiKey: n,
|
|
118
|
+
baseURL: r
|
|
119
|
+
});
|
|
120
|
+
return {
|
|
121
|
+
languageModel: i ? o.chat(t) : o(t),
|
|
122
|
+
providerOptions: a ? { azure: { reasoningEffort: a } } : void 0
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
case "mistral": {
|
|
126
|
+
let { createMistral: e } = await import(y("@ai-sdk/mistral@4.0.54"));
|
|
127
|
+
return { languageModel: e({ apiKey: n })(t) };
|
|
128
|
+
}
|
|
129
|
+
case "anthropic": {
|
|
130
|
+
let { createAnthropic: e } = await import(y("@ai-sdk/anthropic@4.0.68"));
|
|
131
|
+
return { languageModel: e({
|
|
132
|
+
apiKey: n,
|
|
133
|
+
headers: { "anthropic-dangerous-direct-browser-access": "true" }
|
|
134
|
+
})(t) };
|
|
135
|
+
}
|
|
136
|
+
case "google": {
|
|
137
|
+
let { createGoogleGenerativeAI: e } = await import(y("@ai-sdk/google@4.0.85"));
|
|
138
|
+
return { languageModel: e({ apiKey: n })(t) };
|
|
139
|
+
}
|
|
140
|
+
default: throw Error(`Unknown provider "${e}" - supported: azure, mistral, anthropic, google`);
|
|
141
|
+
}
|
|
142
|
+
}, C = async (e, t, n) => {
|
|
143
|
+
let r = e.extended, i = (e) => r.planningAssistantOutput(e), a;
|
|
144
|
+
try {
|
|
145
|
+
a = await Promise.all([
|
|
146
|
+
import(y("ai@7.0.122")),
|
|
147
|
+
S(t),
|
|
148
|
+
r.getExternalObjectAgentPrompts(),
|
|
149
|
+
v(e)
|
|
150
|
+
]);
|
|
151
|
+
} catch (e) {
|
|
152
|
+
i({
|
|
153
|
+
type: "availability",
|
|
154
|
+
available: !1,
|
|
155
|
+
text: String(e)
|
|
156
|
+
});
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
let [{ streamText: o, stepCountIs: s }, c, l, u] = a, d = [];
|
|
160
|
+
r.callbacks.onPlanningAssistantPrompt = async ({ text: e, images: t }) => {
|
|
161
|
+
let r = [], a, f = !1, p = {
|
|
162
|
+
role: "user",
|
|
163
|
+
content: [{
|
|
164
|
+
type: "text",
|
|
165
|
+
text: e || l.imagePrompt
|
|
166
|
+
}, ...t.map((e) => ({
|
|
167
|
+
type: "file",
|
|
168
|
+
data: e,
|
|
169
|
+
mediaType: "image/jpeg"
|
|
170
|
+
}))]
|
|
171
|
+
};
|
|
172
|
+
try {
|
|
173
|
+
let e = o({
|
|
174
|
+
model: c.languageModel,
|
|
175
|
+
providerOptions: c.providerOptions,
|
|
176
|
+
instructions: l.systemPrompt,
|
|
177
|
+
messages: [...d, p],
|
|
178
|
+
tools: u,
|
|
179
|
+
stopWhen: s(16),
|
|
180
|
+
abortSignal: n,
|
|
181
|
+
prepareStep: ({ stepNumber: e }) => e === 15 ? { toolChoice: "none" } : void 0
|
|
182
|
+
});
|
|
183
|
+
for await (let t of e.stream) if (t.type === "text-delta") i({
|
|
184
|
+
type: "text",
|
|
185
|
+
text: t.text
|
|
186
|
+
});
|
|
187
|
+
else if (t.type === "tool-call") i({
|
|
188
|
+
type: "activity",
|
|
189
|
+
text: t.toolName
|
|
190
|
+
});
|
|
191
|
+
else {
|
|
192
|
+
if (t.type === "error") throw t.error;
|
|
193
|
+
t.type === "finish-step" ? r.push(b(t.usage)) : t.type === "finish" ? a = b(t.totalUsage) : t.type === "abort" && (f = !0);
|
|
194
|
+
}
|
|
195
|
+
d.push(p, ...await e.responseMessages), i({ type: "done" });
|
|
196
|
+
} catch (e) {
|
|
197
|
+
i({
|
|
198
|
+
type: "error",
|
|
199
|
+
text: `The planning assistant failed: ${e instanceof Error ? e.message : String(e)}`
|
|
200
|
+
});
|
|
201
|
+
} finally {
|
|
202
|
+
let e = {
|
|
203
|
+
inputTokens: a?.inputTokens ?? x(r.map((e) => e.inputTokens)),
|
|
204
|
+
outputTokens: a?.outputTokens ?? x(r.map((e) => e.outputTokens)),
|
|
205
|
+
totalTokens: a?.totalTokens ?? x(r.map((e) => e.totalTokens))
|
|
206
|
+
};
|
|
207
|
+
Object.values(e).some((e) => e !== null), a && !f && !n.aborted && Object.values(e).every((e) => e !== null) && r.every((e) => Object.values(e).every((e) => e !== null));
|
|
208
|
+
}
|
|
209
|
+
}, i({
|
|
210
|
+
type: "images",
|
|
211
|
+
enabled: t.readsImages
|
|
212
|
+
}), i({
|
|
213
|
+
type: "availability",
|
|
214
|
+
available: !0
|
|
215
|
+
});
|
|
216
|
+
}, w = {
|
|
80
217
|
HIDE: "hide",
|
|
81
218
|
SHOW_ATTRIBUTES: "attributes",
|
|
82
219
|
SHOW_ARTICLES: "articles"
|
|
83
220
|
};
|
|
84
|
-
export {
|
|
221
|
+
export { w as HI_PANEL_ACTION, g as cleanupHi, d as createHiLibraryCallbacks, v as createHiMcpTools, c as libLoadArticleCatalog, u as libLoadCalcScript, l as libLoadMasterData, S as loadChatModel, p as omGetRequest, f as omPostRequest, a as registerLegacyUrlFormat, h as setupHi, C as startPlanningAssistant, o as unregisterLegacyUrlFormat };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roomle/embedding-lib",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-c1bdbb4",
|
|
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",
|
|
@@ -29,13 +29,6 @@
|
|
|
29
29
|
},
|
|
30
30
|
"./plugins/min": {
|
|
31
31
|
"import": "./embedding-plugins.min.js"
|
|
32
|
-
},
|
|
33
|
-
"./configurator": {
|
|
34
|
-
"import": "./configurator.js",
|
|
35
|
-
"types": "./configurator.d.ts"
|
|
36
|
-
},
|
|
37
|
-
"./configurator/min": {
|
|
38
|
-
"import": "./configurator.min.js"
|
|
39
32
|
}
|
|
40
33
|
},
|
|
41
34
|
"scripts": {
|