@roomle/embedding-lib 0.0.0-dev-a95b24e → 0.0.0-dev-9d077e2
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/configurator.d.ts +2 -0
- package/configurator.js +119 -0
- package/configurator.min.js +117 -0
- package/{drag-ghost-BxqPJdhq.mjs → drag-ghost-BOwjMbG3.mjs} +1 -1
- package/{drag-ghost-CDFtC1pd.mjs → drag-ghost-BQ8r6NVo.mjs} +1 -1
- package/{drag-in-CV1E-DO6.mjs → drag-in-BP_E53zb.mjs} +2 -2
- package/{drag-in-ClPpCYyi.mjs → drag-in-QhL3zGC0.mjs} +2 -2
- package/embedding-plugins.js +1 -1
- package/embedding-plugins.min.js +1 -1
- package/{from-custom-view-Q9A-J7qV.mjs → from-custom-view-BM_zRJCf.mjs} +2 -2
- package/{from-custom-view-Sx6P6iDI.mjs → from-custom-view-D2Z1YmCx.mjs} +2 -2
- package/{from-website-DZJy_l42.mjs → from-website-CPVeVVMI.mjs} +2 -2
- package/{from-website-BmCO2xli.mjs → from-website-DlklVbxU.mjs} +2 -2
- package/hi.js +39 -177
- package/hi.min.js +38 -161
- package/package.json +8 -1
- package/packages/embedding-lib/src/configurator-agent/chat-recovery.d.ts +9 -0
- package/packages/embedding-lib/src/configurator-agent/configurator-mcp-tools.d.ts +11 -0
- package/packages/embedding-lib/src/configurator-agent/configurator-planning-assistant.d.ts +8 -0
- package/packages/embedding-lib/src/configurator.d.ts +3 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp-tools.d.ts +4 -61
- package/packages/embedding-lib/src/homag-intelligence/hi-planning-assistant.d.ts +4 -40
- package/packages/embedding-lib/src/planning-assistant/chat-model.d.ts +33 -0
- package/packages/embedding-lib/src/planning-assistant/mcp-tools.d.ts +52 -0
- package/packages/embedding-lib/src/planning-assistant/planning-assistant.d.ts +23 -0
- package/planning-assistant-BW9fNGZO.mjs +158 -0
- package/planning-assistant-CyVA2uUX.mjs +143 -0
- package/roomle-embedding-lib.js +3 -1
- package/roomle-embedding-lib.min.js +3 -1
- /package/{comlink-B2Kj_5Ge.mjs → comlink-BJnhpJa4.mjs} +0 -0
- /package/{comlink-B5lV2OWp.mjs → comlink-lSsogKgb.mjs} +0 -0
package/configurator.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { n as e, r as t, t as n } from "./planning-assistant-BW9fNGZO.mjs";
|
|
2
|
+
//#region packages/embedding-lib/src/configurator-agent/configurator-mcp-tools.ts
|
|
3
|
+
var r = async (e) => {
|
|
4
|
+
if (typeof e.getConfiguratorAgentTools != "function" || typeof e.callConfiguratorAgentTool != "function") throw Error("Update the Rubens UI: configurator agent tools are unavailable.");
|
|
5
|
+
return t(await e.getConfiguratorAgentTools(), (t, n) => e.callConfiguratorAgentTool(t, n), "configurator-mcp");
|
|
6
|
+
}, i = {
|
|
7
|
+
undo: "Undo",
|
|
8
|
+
redo: "Redo",
|
|
9
|
+
"change-component-parameter": "Component parameter change",
|
|
10
|
+
"change-global-parameter": "Global parameter change",
|
|
11
|
+
"dock-component": "Component dock",
|
|
12
|
+
"drag-component": "Component drag",
|
|
13
|
+
"delete-component": "Component deletion",
|
|
14
|
+
"load-configuration": "Configuration load",
|
|
15
|
+
"get-configurator-capabilities": "Capabilities read",
|
|
16
|
+
"get-configuration": "Configuration read",
|
|
17
|
+
"get-component-parameters": "Component parameters read",
|
|
18
|
+
"get-global-parameters": "Global parameters read",
|
|
19
|
+
"get-possible-children": "Possible children read",
|
|
20
|
+
"get-docking-positions": "Docking positions read",
|
|
21
|
+
"get-component-docking-positions": "Component docking positions read",
|
|
22
|
+
"get-delete-impact": "Delete impact read"
|
|
23
|
+
}, a = new Set([
|
|
24
|
+
"get-configurator-capabilities",
|
|
25
|
+
"get-configuration",
|
|
26
|
+
"get-component-parameters",
|
|
27
|
+
"get-global-parameters",
|
|
28
|
+
"get-possible-children",
|
|
29
|
+
"get-docking-positions",
|
|
30
|
+
"get-component-docking-positions",
|
|
31
|
+
"get-delete-impact"
|
|
32
|
+
]), o = (e) => {
|
|
33
|
+
if (e instanceof Error) return e.message;
|
|
34
|
+
try {
|
|
35
|
+
return typeof e == "string" ? e : JSON.stringify(e) ?? String(e);
|
|
36
|
+
} catch {
|
|
37
|
+
return Object.prototype.toString.call(e);
|
|
38
|
+
}
|
|
39
|
+
}, s = (e) => {
|
|
40
|
+
if (e?.structuredContent !== void 0) return e.structuredContent;
|
|
41
|
+
let t = e?.content?.filter((e) => e.type === "text").map((e) => e.text).join("\n");
|
|
42
|
+
if (t === void 0) return e;
|
|
43
|
+
try {
|
|
44
|
+
return JSON.parse(t);
|
|
45
|
+
} catch {
|
|
46
|
+
return t;
|
|
47
|
+
}
|
|
48
|
+
}, c = (e) => {
|
|
49
|
+
if (!e || typeof e != "object") return e == null ? [] : [o(e)];
|
|
50
|
+
let t = [];
|
|
51
|
+
for (let n of [
|
|
52
|
+
"undone",
|
|
53
|
+
"redone",
|
|
54
|
+
"confirmed",
|
|
55
|
+
"canUndo",
|
|
56
|
+
"canRedo"
|
|
57
|
+
]) e[n] !== void 0 && t.push(`${n}: ${o(e[n])}`);
|
|
58
|
+
return e.hint && t.push(o(e.hint)), t;
|
|
59
|
+
}, l = (e) => {
|
|
60
|
+
let t = [];
|
|
61
|
+
return {
|
|
62
|
+
tools: Object.fromEntries(Object.entries(e).map(([e, n]) => {
|
|
63
|
+
if (!n.execute) return [e, n];
|
|
64
|
+
let r = n.execute.bind(n);
|
|
65
|
+
return [e, {
|
|
66
|
+
...n,
|
|
67
|
+
execute: async (n) => {
|
|
68
|
+
let i = {
|
|
69
|
+
toolName: e,
|
|
70
|
+
status: "pending"
|
|
71
|
+
};
|
|
72
|
+
t.push(i);
|
|
73
|
+
try {
|
|
74
|
+
let e = await r(n);
|
|
75
|
+
return i.result = e, i.status = "returned", e;
|
|
76
|
+
} catch (e) {
|
|
77
|
+
throw i.error = e, i.status = "threw", e;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}];
|
|
81
|
+
})),
|
|
82
|
+
summary: () => {
|
|
83
|
+
let e = ["The assistant's reply was interrupted. Any text above is incomplete."];
|
|
84
|
+
if (!t.length) return e.push("No tool ran, so the configuration was not changed."), e.join("\n\n");
|
|
85
|
+
for (let n of t) {
|
|
86
|
+
let t = i[n.toolName] ?? n.toolName;
|
|
87
|
+
if (a.has(n.toolName)) {
|
|
88
|
+
let r = n.status === "returned" && !n.result?.isError, i = r ? s(n.result) : void 0;
|
|
89
|
+
e.push(r ? `- Completed ${t}: ${i?.complete === !1 ? "some requested information was unresolved" : "information was returned"}. The read did not change the configuration.` : `- Incomplete ${t}: ${n.status === "pending" ? "no result was received" : "the read failed"}. The read did not change the configuration.`);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (n.status === "returned" && !n.result?.isError) {
|
|
93
|
+
let r = s(n.result);
|
|
94
|
+
if (r?.confirmed === !1) {
|
|
95
|
+
e.push(`- Unconfirmed ${t}: ${r?.hint ?? "the configurator did not report the change"}. Check the configuration before trying this operation again.`);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
let i = c(r);
|
|
99
|
+
e.push(`- Completed ${t}: ${i.length ? i.join("; ") : "the tool returned successfully."}`);
|
|
100
|
+
} else {
|
|
101
|
+
let r = n.status === "threw" ? o(n.error) : n.status === "returned" ? o(s(n.result)) : "no result was received";
|
|
102
|
+
e.push(`- Unconfirmed ${t}: ${r}. Check the configuration before trying this operation again.`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return e.push("These are the recorded tool outcomes; no operation was repeated automatically."), e.join("\n\n");
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}, u = (e, t, i) => n(e.window, t, i, async () => {
|
|
109
|
+
let [t, n] = await Promise.all([e.configurator.getConfiguratorAgentPrompts(), r(e.configurator)]);
|
|
110
|
+
return {
|
|
111
|
+
prompts: t,
|
|
112
|
+
tools: n
|
|
113
|
+
};
|
|
114
|
+
}, {
|
|
115
|
+
timeoutMs: 5 * 6e4,
|
|
116
|
+
recovery: l
|
|
117
|
+
});
|
|
118
|
+
//#endregion
|
|
119
|
+
export { r as createConfiguratorMcpTools, e as loadChatModel, u as startConfiguratorPlanningAssistant };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { n as e, r as t, t as n } from "./planning-assistant-CyVA2uUX.mjs";
|
|
2
|
+
var r = async (e) => {
|
|
3
|
+
if (typeof e.getConfiguratorAgentTools != "function" || typeof e.callConfiguratorAgentTool != "function") throw Error("Update the Rubens UI: configurator agent tools are unavailable.");
|
|
4
|
+
return t(await e.getConfiguratorAgentTools(), (t, n) => e.callConfiguratorAgentTool(t, n), "configurator-mcp");
|
|
5
|
+
}, i = {
|
|
6
|
+
undo: "Undo",
|
|
7
|
+
redo: "Redo",
|
|
8
|
+
"change-component-parameter": "Component parameter change",
|
|
9
|
+
"change-global-parameter": "Global parameter change",
|
|
10
|
+
"dock-component": "Component dock",
|
|
11
|
+
"drag-component": "Component drag",
|
|
12
|
+
"delete-component": "Component deletion",
|
|
13
|
+
"load-configuration": "Configuration load",
|
|
14
|
+
"get-configurator-capabilities": "Capabilities read",
|
|
15
|
+
"get-configuration": "Configuration read",
|
|
16
|
+
"get-component-parameters": "Component parameters read",
|
|
17
|
+
"get-global-parameters": "Global parameters read",
|
|
18
|
+
"get-possible-children": "Possible children read",
|
|
19
|
+
"get-docking-positions": "Docking positions read",
|
|
20
|
+
"get-component-docking-positions": "Component docking positions read",
|
|
21
|
+
"get-delete-impact": "Delete impact read"
|
|
22
|
+
}, a = new Set([
|
|
23
|
+
"get-configurator-capabilities",
|
|
24
|
+
"get-configuration",
|
|
25
|
+
"get-component-parameters",
|
|
26
|
+
"get-global-parameters",
|
|
27
|
+
"get-possible-children",
|
|
28
|
+
"get-docking-positions",
|
|
29
|
+
"get-component-docking-positions",
|
|
30
|
+
"get-delete-impact"
|
|
31
|
+
]), o = (e) => {
|
|
32
|
+
if (e instanceof Error) return e.message;
|
|
33
|
+
try {
|
|
34
|
+
return typeof e == "string" ? e : JSON.stringify(e) ?? String(e);
|
|
35
|
+
} catch {
|
|
36
|
+
return Object.prototype.toString.call(e);
|
|
37
|
+
}
|
|
38
|
+
}, s = (e) => {
|
|
39
|
+
if (e?.structuredContent !== void 0) return e.structuredContent;
|
|
40
|
+
let t = e?.content?.filter((e) => e.type === "text").map((e) => e.text).join("\n");
|
|
41
|
+
if (t === void 0) return e;
|
|
42
|
+
try {
|
|
43
|
+
return JSON.parse(t);
|
|
44
|
+
} catch {
|
|
45
|
+
return t;
|
|
46
|
+
}
|
|
47
|
+
}, c = (e) => {
|
|
48
|
+
if (!e || typeof e != "object") return e == null ? [] : [o(e)];
|
|
49
|
+
let t = [];
|
|
50
|
+
for (let n of [
|
|
51
|
+
"undone",
|
|
52
|
+
"redone",
|
|
53
|
+
"confirmed",
|
|
54
|
+
"canUndo",
|
|
55
|
+
"canRedo"
|
|
56
|
+
]) e[n] !== void 0 && t.push(`${n}: ${o(e[n])}`);
|
|
57
|
+
return e.hint && t.push(o(e.hint)), t;
|
|
58
|
+
}, l = (e) => {
|
|
59
|
+
let t = [];
|
|
60
|
+
return {
|
|
61
|
+
tools: Object.fromEntries(Object.entries(e).map(([e, n]) => {
|
|
62
|
+
if (!n.execute) return [e, n];
|
|
63
|
+
let r = n.execute.bind(n);
|
|
64
|
+
return [e, {
|
|
65
|
+
...n,
|
|
66
|
+
execute: async (n) => {
|
|
67
|
+
let i = {
|
|
68
|
+
toolName: e,
|
|
69
|
+
status: "pending"
|
|
70
|
+
};
|
|
71
|
+
t.push(i);
|
|
72
|
+
try {
|
|
73
|
+
let e = await r(n);
|
|
74
|
+
return i.result = e, i.status = "returned", e;
|
|
75
|
+
} catch (e) {
|
|
76
|
+
throw i.error = e, i.status = "threw", e;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}];
|
|
80
|
+
})),
|
|
81
|
+
summary: () => {
|
|
82
|
+
let e = ["The assistant's reply was interrupted. Any text above is incomplete."];
|
|
83
|
+
if (!t.length) return e.push("No tool ran, so the configuration was not changed."), e.join("\n\n");
|
|
84
|
+
for (let n of t) {
|
|
85
|
+
let t = i[n.toolName] ?? n.toolName;
|
|
86
|
+
if (a.has(n.toolName)) {
|
|
87
|
+
let r = n.status === "returned" && !n.result?.isError, i = r ? s(n.result) : void 0;
|
|
88
|
+
e.push(r ? `- Completed ${t}: ${!1 === i?.complete ? "some requested information was unresolved" : "information was returned"}. The read did not change the configuration.` : `- Incomplete ${t}: ${n.status === "pending" ? "no result was received" : "the read failed"}. The read did not change the configuration.`);
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (n.status !== "returned" || n.result?.isError) {
|
|
92
|
+
let r = n.status === "threw" ? o(n.error) : n.status === "returned" ? o(s(n.result)) : "no result was received";
|
|
93
|
+
e.push(`- Unconfirmed ${t}: ${r}. Check the configuration before trying this operation again.`);
|
|
94
|
+
} else {
|
|
95
|
+
let r = s(n.result);
|
|
96
|
+
if (!1 === r?.confirmed) {
|
|
97
|
+
e.push(`- Unconfirmed ${t}: ${r?.hint ?? "the configurator did not report the change"}. Check the configuration before trying this operation again.`);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
let i = c(r);
|
|
101
|
+
e.push(`- Completed ${t}: ${i.length ? i.join("; ") : "the tool returned successfully."}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return e.push("These are the recorded tool outcomes; no operation was repeated automatically."), e.join("\n\n");
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}, u = (e, t, i) => n(e.window, t, i, async () => {
|
|
108
|
+
let [t, n] = await Promise.all([e.configurator.getConfiguratorAgentPrompts(), r(e.configurator)]);
|
|
109
|
+
return {
|
|
110
|
+
prompts: t,
|
|
111
|
+
tools: n
|
|
112
|
+
};
|
|
113
|
+
}, {
|
|
114
|
+
timeoutMs: 3e5,
|
|
115
|
+
recovery: l
|
|
116
|
+
});
|
|
117
|
+
export { r as createConfiguratorMcpTools, e as loadChatModel, u as startConfiguratorPlanningAssistant };
|
|
@@ -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-QhL3zGC0.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-BP_E53zb.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-DlklVbxU.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-D2Z1YmCx.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-CPVeVVMI.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-BM_zRJCf.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-QhL3zGC0.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-BP_E53zb.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-QhL3zGC0.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-BOwjMbG3.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-BP_E53zb.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-BQ8r6NVo.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-QhL3zGC0.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-BOwjMbG3.mjs";
|
|
4
4
|
//#region packages/embedding-lib/src/plugins/strategy/from-website.ts
|
|
5
5
|
var u = class {
|
|
6
6
|
_options = {};
|
|
@@ -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-BP_E53zb.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-BQ8r6NVo.mjs";
|
|
4
4
|
var u = class {
|
|
5
5
|
_options = {};
|
|
6
6
|
_instance;
|
package/hi.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { t as e } from "./browser-CW9o-dtT.mjs";
|
|
2
2
|
import { t } from "./utils-DxJ3PcKe.mjs";
|
|
3
|
-
|
|
3
|
+
import { n, r, t as i } from "./planning-assistant-BW9fNGZO.mjs";
|
|
4
|
+
var a = (e, t) => t === e.libraryId ? e : {
|
|
4
5
|
...e,
|
|
5
6
|
libraryId: t
|
|
6
|
-
},
|
|
7
|
+
}, o = async (e, t, n, r = { property: "default" }) => {
|
|
7
8
|
let i = n.serverOptions ?? {}, a = { headers: {
|
|
8
9
|
"Content-Type": t === "json" ? "application/json" : "text/plain",
|
|
9
10
|
"Access-Control-Allow-Origin": "*"
|
|
@@ -16,22 +17,22 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
16
17
|
} catch (e) {
|
|
17
18
|
throw console.warn(`Failed to fetch data from ${r.property}`), console.error(e), e;
|
|
18
19
|
}
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
},
|
|
20
|
+
}, s = { "e2fe8b3d-da31-4a20-92ab-ab6e3839300e": new Set(["Furniture_Smith"]) }, c = (e, t) => {
|
|
21
|
+
s[e] || (s[e] = /* @__PURE__ */ new Set()), s[e].add(t);
|
|
22
|
+
}, l = (e, t) => {
|
|
23
|
+
s[e]?.delete(t), s[e]?.size === 0 && delete s[e];
|
|
24
|
+
}, u = (e, t) => {
|
|
24
25
|
let { libraryId: n, serverOptions: r } = e;
|
|
25
|
-
return r?.subscriptionId &&
|
|
26
|
-
},
|
|
27
|
-
let t = await (await
|
|
26
|
+
return r?.subscriptionId && s[r.subscriptionId]?.has(n) ? `api/pos/${t}?libraryId=${n}` : `api/pos/libraries/${n}/${t}`;
|
|
27
|
+
}, d = async (e) => await (await o(u(e, "articles"), "json", e, { property: "articles" })).json(), f = async (e) => await (await o(u(e, "masterData"), "json", e, { property: "masterData" })).json(), p = async (e) => {
|
|
28
|
+
let t = await (await o(u(e, "calc.js"), "text", e, { property: "calc.js" })).text();
|
|
28
29
|
if (!t) throw Error("Script load error");
|
|
29
30
|
return t;
|
|
30
|
-
},
|
|
31
|
-
onLoadJavascript: (t) =>
|
|
32
|
-
onLoadArticleCatalog: (t) =>
|
|
33
|
-
onLoadMasterData: (t) =>
|
|
34
|
-
}),
|
|
31
|
+
}, m = (e) => ({
|
|
32
|
+
onLoadJavascript: (t) => p(a(e, t)),
|
|
33
|
+
onLoadArticleCatalog: (t) => d(a(e, t)),
|
|
34
|
+
onLoadMasterData: (t) => f(a(e, t))
|
|
35
|
+
}), h = async (e, t, n, r = {}) => {
|
|
35
36
|
let { baseUrl: i, om: a } = e.serverOptions ?? {}, o = encodeURIComponent(a?.endpointUrl || ""), s = encodeURIComponent(a?.subscriptionId || ""), c = a?.key || "";
|
|
36
37
|
return await (await fetch((i ?? "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=") + `${encodeURIComponent(n)}&subscriptionId=${s}&apiKey=${c}&baseUrl=${o}`, {
|
|
37
38
|
method: "POST",
|
|
@@ -41,7 +42,7 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
41
42
|
...r
|
|
42
43
|
}
|
|
43
44
|
})).json();
|
|
44
|
-
},
|
|
45
|
+
}, g = async (e, t, n = {}) => {
|
|
45
46
|
let { baseUrl: r, om: i } = e.serverOptions ?? {}, a = encodeURIComponent(i?.endpointUrl || ""), o = encodeURIComponent(i?.subscriptionId || ""), s = i?.key || "";
|
|
46
47
|
return await (await fetch((r ?? "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=") + `${encodeURIComponent(t)}&subscriptionId=${o}&apiKey=${s}&baseUrl=${a}`, {
|
|
47
48
|
method: "GET",
|
|
@@ -50,173 +51,34 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
50
51
|
...n
|
|
51
52
|
}
|
|
52
53
|
})).json();
|
|
53
|
-
},
|
|
54
|
+
}, _ = (t, n) => {
|
|
54
55
|
t.serverOptions ||= {}, !t.serverOptions.language && n?.locale && (t.serverOptions.language = n.locale), t.serverOptions.language || (t.serverOptions.language = e(null, !0));
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
let
|
|
58
|
-
|
|
59
|
-
let { expose:
|
|
60
|
-
|
|
56
|
+
}, v = null, y = async (e, n = {}) => {
|
|
57
|
+
v && window.removeEventListener("message", v);
|
|
58
|
+
let r = typeof e == "string" ? { libraryId: e } : e;
|
|
59
|
+
n.onLoadJavascript === void 0 && (n.onLoadJavascript = (e) => p(a(r, e))), n.onLoadArticleCatalog === void 0 && (n.onLoadArticleCatalog = (e) => d(a(r, e))), n.onLoadMasterData === void 0 && (n.onLoadMasterData = (e) => f(a(r, e)));
|
|
60
|
+
let { expose: i } = await import("./comlink-lSsogKgb.mjs");
|
|
61
|
+
v = (e) => {
|
|
61
62
|
if (e.data.type === "connect_hi" && e.data.port) {
|
|
62
|
-
let
|
|
63
|
-
|
|
63
|
+
let a = e.data.port;
|
|
64
|
+
_(r, e.data.globalInitData || {}), a.start?.(), i(t(n), a);
|
|
64
65
|
}
|
|
65
|
-
}, window.addEventListener("message",
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
},
|
|
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 }) => {
|
|
66
|
+
}, window.addEventListener("message", v);
|
|
67
|
+
}, b = () => {
|
|
68
|
+
v &&= (window.removeEventListener("message", v), null);
|
|
69
|
+
}, x = async ({ extended: e }) => {
|
|
82
70
|
if (typeof e.getExternalObjectAgentTools != "function") throw Error("The planner has no HI agent tools: it needs a Rubens UI with getExternalObjectAgentTools.");
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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 = async ({ provider: e, model: t, apiKey: n, baseUrl: r, chatCompletions: i, reasoningEffort: a }) => {
|
|
109
|
-
switch (e) {
|
|
110
|
-
case "azure": {
|
|
111
|
-
let { createAzure: e } = await import(
|
|
112
|
-
/* @vite-ignore */
|
|
113
|
-
b("@ai-sdk/azure@4.0.85")
|
|
114
|
-
), o = e({
|
|
115
|
-
apiKey: n,
|
|
116
|
-
baseURL: r
|
|
117
|
-
});
|
|
118
|
-
return {
|
|
119
|
-
languageModel: i ? o.chat(t) : o(t),
|
|
120
|
-
providerOptions: a ? { azure: { reasoningEffort: a } } : void 0
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
case "mistral": {
|
|
124
|
-
let { createMistral: e } = await import(
|
|
125
|
-
/* @vite-ignore */
|
|
126
|
-
b("@ai-sdk/mistral@4.0.54")
|
|
127
|
-
);
|
|
128
|
-
return { languageModel: e({ apiKey: n })(t) };
|
|
129
|
-
}
|
|
130
|
-
case "anthropic": {
|
|
131
|
-
let { createAnthropic: e } = await import(
|
|
132
|
-
/* @vite-ignore */
|
|
133
|
-
b("@ai-sdk/anthropic@4.0.68")
|
|
134
|
-
);
|
|
135
|
-
return { languageModel: e({
|
|
136
|
-
apiKey: n,
|
|
137
|
-
headers: { "anthropic-dangerous-direct-browser-access": "true" }
|
|
138
|
-
})(t) };
|
|
139
|
-
}
|
|
140
|
-
case "google": {
|
|
141
|
-
let { createGoogleGenerativeAI: e } = await import(
|
|
142
|
-
/* @vite-ignore */
|
|
143
|
-
b("@ai-sdk/google@4.0.85")
|
|
144
|
-
);
|
|
145
|
-
return { languageModel: e({ apiKey: n })(t) };
|
|
146
|
-
}
|
|
147
|
-
default: throw Error(`Unknown provider "${e}" - supported: azure, mistral, anthropic, google`);
|
|
148
|
-
}
|
|
149
|
-
}, C = async (e, t, n) => {
|
|
150
|
-
let r = e.extended, i = (e) => r.planningAssistantOutput(e), a;
|
|
151
|
-
try {
|
|
152
|
-
a = await Promise.all([
|
|
153
|
-
import(
|
|
154
|
-
/* @vite-ignore */
|
|
155
|
-
b("ai@7.0.122")
|
|
156
|
-
),
|
|
157
|
-
S(t),
|
|
158
|
-
r.getExternalObjectAgentPrompts(),
|
|
159
|
-
y(e)
|
|
160
|
-
]);
|
|
161
|
-
} catch (e) {
|
|
162
|
-
console.log("[planning-assistant]", String(e)), i({
|
|
163
|
-
type: "availability",
|
|
164
|
-
available: !1,
|
|
165
|
-
text: String(e)
|
|
166
|
-
});
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
let [{ streamText: o, stepCountIs: s }, c, l, u] = a, d = [];
|
|
170
|
-
r.callbacks.onPlanningAssistantPrompt = async ({ text: e, images: t }) => {
|
|
171
|
-
let r = {
|
|
172
|
-
role: "user",
|
|
173
|
-
content: [{
|
|
174
|
-
type: "text",
|
|
175
|
-
text: e || l.imagePrompt
|
|
176
|
-
}, ...t.map((e) => ({
|
|
177
|
-
type: "file",
|
|
178
|
-
data: e,
|
|
179
|
-
mediaType: "image/jpeg"
|
|
180
|
-
}))]
|
|
181
|
-
};
|
|
182
|
-
try {
|
|
183
|
-
let e = o({
|
|
184
|
-
model: c.languageModel,
|
|
185
|
-
providerOptions: c.providerOptions,
|
|
186
|
-
instructions: l.systemPrompt,
|
|
187
|
-
messages: [...d, r],
|
|
188
|
-
tools: u,
|
|
189
|
-
stopWhen: s(x),
|
|
190
|
-
abortSignal: n,
|
|
191
|
-
prepareStep: ({ stepNumber: e }) => e === x - 1 ? { toolChoice: "none" } : void 0
|
|
192
|
-
});
|
|
193
|
-
for await (let t of e.stream) if (t.type === "text-delta") i({
|
|
194
|
-
type: "text",
|
|
195
|
-
text: t.text
|
|
196
|
-
});
|
|
197
|
-
else if (t.type === "tool-call") i({
|
|
198
|
-
type: "activity",
|
|
199
|
-
text: t.toolName
|
|
200
|
-
});
|
|
201
|
-
else if (t.type === "error") throw t.error;
|
|
202
|
-
d.push(r, ...await e.responseMessages), i({ type: "done" });
|
|
203
|
-
} catch (e) {
|
|
204
|
-
console.log("[planning-assistant]", String(e)), i({
|
|
205
|
-
type: "error",
|
|
206
|
-
text: `The planning assistant failed: ${e instanceof Error ? e.message : String(e)}`
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
}, i({
|
|
210
|
-
type: "images",
|
|
211
|
-
enabled: t.readsImages
|
|
212
|
-
}), i({
|
|
213
|
-
type: "availability",
|
|
214
|
-
available: !0
|
|
215
|
-
});
|
|
216
|
-
}, w = {
|
|
71
|
+
return r(await e.getExternalObjectAgentTools(), (t, n) => e.callExternalObjectAgentTool(t, n), "hi-mcp");
|
|
72
|
+
}, S = (e, t, n) => i(e.extended, t, n, async () => {
|
|
73
|
+
let [t, n] = await Promise.all([e.extended.getExternalObjectAgentPrompts(), x(e)]);
|
|
74
|
+
return {
|
|
75
|
+
prompts: t,
|
|
76
|
+
tools: n
|
|
77
|
+
};
|
|
78
|
+
}), C = {
|
|
217
79
|
HIDE: "hide",
|
|
218
80
|
SHOW_ATTRIBUTES: "attributes",
|
|
219
81
|
SHOW_ARTICLES: "articles"
|
|
220
82
|
};
|
|
221
83
|
//#endregion
|
|
222
|
-
export {
|
|
84
|
+
export { C as HI_PANEL_ACTION, b as cleanupHi, m as createHiLibraryCallbacks, x as createHiMcpTools, d as libLoadArticleCatalog, p as libLoadCalcScript, f as libLoadMasterData, n as loadChatModel, g as omGetRequest, h as omPostRequest, c as registerLegacyUrlFormat, y as setupHi, S as startPlanningAssistant, l as unregisterLegacyUrlFormat };
|