@roomle/embedding-lib 11.0.0-alpha.1 → 11.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD-PARTY-NOTICES.txt +2 -2
- package/ai.js +86 -17
- package/ai.min.js +83 -13
- package/{browser-D6M-d6y5.mjs → browser-Cys-y5Hy.mjs} +1 -2
- package/chat-model-B7BO8IhK.mjs +212 -0
- package/chat-model-XYf503pT.mjs +213 -0
- package/coerce-CuLRCRlo.mjs +6 -0
- package/coerce-Dup0o-HR.mjs +7 -0
- package/{comlink-m82YLjsS.mjs → comlink-7u13Z2ZH.mjs} +2 -3
- package/{comlink-BYqErFai.mjs → comlink-DKhvPU0o.mjs} +1 -1
- package/configurator.js +7 -7
- package/configurator.min.js +6 -5
- package/construction.js +279 -22
- package/construction.min.js +287 -27
- package/continuation-CswXtOus.mjs +10 -0
- package/continuation-NclHDSgS.mjs +9 -0
- package/{dist-DCzWWudD.mjs → dist-7-X7Xqsl.mjs} +851 -919
- package/{dist-CjIZv2gB.mjs → dist-BMxyw-Zs.mjs} +411 -405
- package/{dist-wPZpiGiu.mjs → dist-BU022PnG.mjs} +4 -9
- package/{dist-CGgFMwb1.mjs → dist-BY8OLJ2p.mjs} +1 -1
- package/{dist-6TznX-Ae.mjs → dist-BZSd56sr.mjs} +3850 -3942
- package/{dist-Ur4DqwwC.mjs → dist-Ba3J8AjB.mjs} +400 -390
- package/{dist-CnTUCpLZ.mjs → dist-CbQKC1xX.mjs} +1590 -1616
- package/{dist-BsVeWZ8R.mjs → dist-CiybWJvs.mjs} +44 -41
- package/{dist-BI_3AeI-.mjs → dist-CkZuNdCU.mjs} +6 -4
- package/{dist-Bt1FopV4.mjs → dist-D2ZAAHGn.mjs} +1058 -1042
- package/{dist-Cxe4osFc.mjs → dist-DjsS42rR.mjs} +916 -962
- package/{dist-Cmx_tCV5.mjs → dist-Jcq_kKKT.mjs} +403 -393
- package/{dist-D0XFfKEL.mjs → dist-S9sLSjZ4.mjs} +3112 -3104
- package/{dist-BV-32IEX.mjs → dist-XECXrV5Q.mjs} +1497 -1558
- package/{dist-CZbrRF4T.mjs → dist-a5_BIeaS.mjs} +45 -51
- package/{dist-Dr3LcjP6.mjs → dist-bQAJDeYc.mjs} +698 -748
- package/docs/md/web/embedding/CHANGELOG.md +20 -175
- package/{drag-ghost-C1WS2KmW.mjs → drag-ghost-QZelgA-_.mjs} +2 -3
- package/{drag-ghost-B24KVqgc.mjs → drag-ghost-VmgSWLva.mjs} +5 -7
- package/{drag-in-O5uwMddL.mjs → drag-in-Cd_67tzS.mjs} +4 -5
- package/{drag-in-CWHSbwvG.mjs → drag-in-DlDsgY4T.mjs} +3 -3
- package/embedding-plugins.js +1 -2
- package/embedding-plugins.min.js +1 -2
- package/{experimental-evaluation-DyONuPyk.mjs → experimental-evaluation-B4hKMgFH.mjs} +19 -38
- package/{experimental-evaluation-DPkDk-5A.mjs → experimental-evaluation-DmqghFSx.mjs} +1 -1
- package/{from-custom-view-BgmiWIEN.mjs → from-custom-view-6HMD_sPe.mjs} +5 -4
- package/{from-custom-view-CxmIIsHU.mjs → from-custom-view-BRFynafo.mjs} +16 -16
- package/{from-website-CvcnHmr2.mjs → from-website-Dl1VN4h7.mjs} +5 -6
- package/{from-website-B8qFEG_R.mjs → from-website-iZzauH4C.mjs} +3 -3
- package/hi.js +251 -214
- package/hi.min.js +330 -288
- package/mcp-tools-BLB7pCga.mjs +42 -0
- package/mcp-tools-BirFT2R0.mjs +41 -0
- package/package.json +1 -1
- package/packages/common/src/utils/ai-model-relay.d.ts +22 -2
- package/packages/embedding-lib/src/ai.d.ts +3 -1
- package/packages/embedding-lib/src/hi.d.ts +1 -1
- package/packages/embedding-lib/src/homag-intelligence/hi-planning-assistant.d.ts +14 -2
- package/packages/embedding-lib/src/planning-assistant/chat-model.d.ts +1 -1
- package/packages/web-sdk/packages/assistant.d.ts +2 -0
- package/packages/web-sdk/packages/common-core/src/planning-assistant/chat-model.d.ts +1 -1
- package/packages/web-sdk/packages/common-core/src/planning-assistant/continuation.d.ts +5 -0
- package/packages/web-sdk/packages/common-core/src/planning-assistant/mcp-tools.d.ts +3 -1
- package/packages/web-sdk/packages/common-core/src/planning-assistant/runtime.d.ts +6 -1
- package/packages/web-sdk/packages/common-core/src/planning-assistant/types.d.ts +3 -1
- package/packages/web-sdk/packages/common-core/src/planning-assistant.d.ts +3 -0
- package/rolldown-runtime--db92txo.mjs +10 -0
- package/rolldown-runtime-CyjYJMBa.mjs +11 -0
- package/roomle-embedding-lib.js +25 -34
- package/roomle-embedding-lib.min.js +3 -3
- package/sbom.cdx.json +5 -5
- package/turn-limits-9LbUeSG2.mjs +9 -0
- package/turn-limits-Ciq383Bd.mjs +10 -0
- package/{utils-BwWn6Fw4.mjs → utils-CJnKZceY.mjs} +3 -4
- package/{utils-BoELtcEK.mjs → utils-DdNhTbJr.mjs} +6 -6
- package/chat-model-CFuHw4cp.mjs +0 -322
- package/chat-model-JqqVnnmY.mjs +0 -327
- package/coerce-CqJod_GZ.mjs +0 -8
- package/coerce-CsI42_k0.mjs +0 -6
- /package/{browser-BjtSrqbu.mjs → browser-CzLpXYFF.mjs} +0 -0
package/THIRD-PARTY-NOTICES.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
Third-party software notices for @roomle/embedding-lib
|
|
2
|
-
Generated 2026-11-
|
|
1
|
+
Third-party software notices for @roomle/embedding-lib f09ffd4d5947a99fb578e6a72e57b24286b7d1f0
|
|
2
|
+
Generated 2026-11-20
|
|
3
3
|
|
|
4
4
|
This product includes the following third-party components.
|
|
5
5
|
|
package/ai.js
CHANGED
|
@@ -1,10 +1,53 @@
|
|
|
1
1
|
/*! Third-party licenses: THIRD-PARTY-NOTICES.txt and sbom.cdx.json in the root of this package */
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { n as e } from "./chat-model-XYf503pT.mjs";
|
|
3
|
+
import { n as t } from "./continuation-CswXtOus.mjs";
|
|
4
|
+
// packages/common/src/utils/ai-model-relay.ts
|
|
5
|
+
var n = "roomle_ai_model_connect", r = () => import("./comlink-7u13Z2ZH.mjs"), i = (e, { transfer: t, proxy: n }) => ({
|
|
6
|
+
generate: async (t, n) => {
|
|
7
|
+
let r = new AbortController();
|
|
8
|
+
n.onmessage = () => r.abort();
|
|
9
|
+
try {
|
|
10
|
+
if (!e.assistantModel) throw Error("The host has no assistant model.");
|
|
11
|
+
let { request: n, response: i, ...a } = await e.assistantModel.generate(t, r.signal);
|
|
12
|
+
return a;
|
|
13
|
+
} finally {
|
|
14
|
+
n.close();
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
stream: async (t, r) => {
|
|
18
|
+
let i = new AbortController(), a;
|
|
19
|
+
r.onmessage = () => {
|
|
20
|
+
i.abort(), a?.cancel().catch(() => void 0);
|
|
21
|
+
};
|
|
22
|
+
try {
|
|
23
|
+
if (!e.assistantModel) throw Error("The host has no assistant model.");
|
|
24
|
+
return a = (await e.assistantModel.stream(t, i.signal)).getReader(), n({
|
|
25
|
+
read: async () => {
|
|
26
|
+
try {
|
|
27
|
+
let e = await a.read();
|
|
28
|
+
return e.done && r.close(), e;
|
|
29
|
+
} catch (e) {
|
|
30
|
+
throw r.close(), e;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
cancel: async () => {
|
|
34
|
+
i.abort();
|
|
35
|
+
try {
|
|
36
|
+
await a.cancel();
|
|
37
|
+
} finally {
|
|
38
|
+
r.close();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
} catch (e) {
|
|
43
|
+
throw r.close(), e;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
4
46
|
request: async (n, r) => {
|
|
5
47
|
let i = new AbortController();
|
|
6
48
|
r.onmessage = () => i.abort();
|
|
7
49
|
try {
|
|
50
|
+
if (!e.onAiModelRequest) throw Error("The host has no rendering model.");
|
|
8
51
|
let r = await e.onAiModelRequest(n, i.signal);
|
|
9
52
|
if (r.status === 0) throw TypeError("The host answered without a status");
|
|
10
53
|
let a = await r.arrayBuffer();
|
|
@@ -25,36 +68,62 @@ var e = "roomle_ai_model_connect", t = () => import("./comlink-m82YLjsS.mjs"), n
|
|
|
25
68
|
return !1;
|
|
26
69
|
}
|
|
27
70
|
}
|
|
28
|
-
}),
|
|
71
|
+
}), a = (e, t, a) => {
|
|
29
72
|
let o = [], s = async (s) => {
|
|
30
73
|
let [c] = s.ports;
|
|
31
|
-
if (s.source !==
|
|
74
|
+
if (s.source !== e || s.origin !== t || s.data?.type !== n || !c) return;
|
|
32
75
|
o.push(c);
|
|
33
|
-
let l = await
|
|
34
|
-
l.expose(
|
|
76
|
+
let l = await r();
|
|
77
|
+
l.expose(i(a, l), c);
|
|
35
78
|
};
|
|
36
79
|
return window.addEventListener("message", s), () => {
|
|
37
80
|
window.removeEventListener("message", s), o.forEach((e) => e.close());
|
|
38
81
|
};
|
|
39
|
-
},
|
|
40
|
-
if (
|
|
41
|
-
|
|
82
|
+
}, o = async (n, { features: r, model: i, ...o }) => {
|
|
83
|
+
if (r?.length === 0) throw Error("serveAiModelRequests: features is empty; leave it out to serve every feature");
|
|
84
|
+
if (i) {
|
|
85
|
+
let t = await e(i), n = (e) => Object.fromEntries([.../* @__PURE__ */ new Set([...Object.keys(t.providerOptions ?? {}), ...Object.keys(e.providerOptions ?? {})])].map((n) => [n, {
|
|
86
|
+
...e.providerOptions?.[n],
|
|
87
|
+
...t.providerOptions?.[n]
|
|
88
|
+
}]));
|
|
89
|
+
o.assistantModel = {
|
|
90
|
+
generate: async (e, r) => t.languageModel.doGenerate({
|
|
91
|
+
...e,
|
|
92
|
+
providerOptions: n(e),
|
|
93
|
+
abortSignal: r
|
|
94
|
+
}),
|
|
95
|
+
stream: async (e, r) => (await t.languageModel.doStream({
|
|
96
|
+
...e,
|
|
97
|
+
providerOptions: n(e),
|
|
98
|
+
abortSignal: r
|
|
99
|
+
})).stream
|
|
100
|
+
}, r = [.../* @__PURE__ */ new Set([
|
|
101
|
+
...r ?? [],
|
|
102
|
+
"configuration-assistant",
|
|
103
|
+
...o.onAiModelRequest ? ["lifestyle-rendering"] : []
|
|
104
|
+
])];
|
|
105
|
+
}
|
|
106
|
+
let s = n.startRelay("ai", (e, t) => a(e, t, o));
|
|
42
107
|
try {
|
|
43
|
-
await
|
|
44
|
-
auth: !!
|
|
45
|
-
...
|
|
108
|
+
await n.ui.setAiModelHost({
|
|
109
|
+
auth: !!o.onRequestAiModelAuth,
|
|
110
|
+
...i && { assistantModel: {
|
|
111
|
+
model: i.model,
|
|
112
|
+
readsImages: i.readsImages,
|
|
113
|
+
responsesProvider: t(i) ?? void 0
|
|
114
|
+
} },
|
|
115
|
+
...r && { features: r }
|
|
46
116
|
});
|
|
47
117
|
} catch (e) {
|
|
48
|
-
throw
|
|
118
|
+
throw s.stop(), e;
|
|
49
119
|
}
|
|
50
120
|
return {
|
|
51
121
|
signOut: async () => {
|
|
52
|
-
|
|
122
|
+
s.isCurrent() && await n.ui.signOutAiModel();
|
|
53
123
|
},
|
|
54
124
|
stop: async () => {
|
|
55
|
-
|
|
125
|
+
s.isCurrent() && (s.stop(), await n.ui.setAiModelHost(null));
|
|
56
126
|
}
|
|
57
127
|
};
|
|
58
128
|
};
|
|
59
|
-
|
|
60
|
-
export { i as serveAiModelRequests };
|
|
129
|
+
export { o as serveAiModelRequests };
|
package/ai.min.js
CHANGED
|
@@ -1,17 +1,82 @@
|
|
|
1
1
|
/*! Third-party licenses: THIRD-PARTY-NOTICES.txt and sbom.cdx.json in the root of this package */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { n as e } from "./chat-model-B7BO8IhK.mjs";
|
|
3
|
+
import { n as t } from "./continuation-NclHDSgS.mjs";
|
|
4
|
+
var n = async (n, { features: r, model: i, ...a }) => {
|
|
5
|
+
if (r?.length === 0) throw Error("serveAiModelRequests: features is empty; leave it out to serve every feature");
|
|
6
|
+
if (i) {
|
|
7
|
+
let t = await e(i), n = (e) => Object.fromEntries([.../* @__PURE__ */ new Set([...Object.keys(t.providerOptions ?? {}), ...Object.keys(e.providerOptions ?? {})])].map((n) => [n, {
|
|
8
|
+
...e.providerOptions?.[n],
|
|
9
|
+
...t.providerOptions?.[n]
|
|
10
|
+
}]));
|
|
11
|
+
a.assistantModel = {
|
|
12
|
+
generate: async (e, r) => t.languageModel.doGenerate({
|
|
13
|
+
...e,
|
|
14
|
+
providerOptions: n(e),
|
|
15
|
+
abortSignal: r
|
|
16
|
+
}),
|
|
17
|
+
stream: async (e, r) => (await t.languageModel.doStream({
|
|
18
|
+
...e,
|
|
19
|
+
providerOptions: n(e),
|
|
20
|
+
abortSignal: r
|
|
21
|
+
})).stream
|
|
22
|
+
}, r = [.../* @__PURE__ */ new Set([
|
|
23
|
+
...r ?? [],
|
|
24
|
+
"configuration-assistant",
|
|
25
|
+
...a.onAiModelRequest ? ["lifestyle-rendering"] : []
|
|
26
|
+
])];
|
|
27
|
+
}
|
|
28
|
+
let o = n.startRelay("ai", (e, t) => ((e, t, n) => {
|
|
5
29
|
let r = [], i = async (i) => {
|
|
6
30
|
let [a] = i.ports;
|
|
7
31
|
if (i.source !== e || i.origin !== t || i.data?.type !== "roomle_ai_model_connect" || !a) return;
|
|
8
32
|
r.push(a);
|
|
9
|
-
let o = await import("./comlink-
|
|
10
|
-
o.expose(((e, { transfer: t }) => ({
|
|
33
|
+
let o = await import("./comlink-DKhvPU0o.mjs");
|
|
34
|
+
o.expose(((e, { transfer: t, proxy: n }) => ({
|
|
35
|
+
generate: async (t, n) => {
|
|
36
|
+
let r = new AbortController();
|
|
37
|
+
n.onmessage = () => r.abort();
|
|
38
|
+
try {
|
|
39
|
+
if (!e.assistantModel) throw Error("The host has no assistant model.");
|
|
40
|
+
let { request: n, response: i, ...a } = await e.assistantModel.generate(t, r.signal);
|
|
41
|
+
return a;
|
|
42
|
+
} finally {
|
|
43
|
+
n.close();
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
stream: async (t, r) => {
|
|
47
|
+
let i = new AbortController(), a;
|
|
48
|
+
r.onmessage = () => {
|
|
49
|
+
i.abort(), a?.cancel().catch(() => {});
|
|
50
|
+
};
|
|
51
|
+
try {
|
|
52
|
+
if (!e.assistantModel) throw Error("The host has no assistant model.");
|
|
53
|
+
return a = (await e.assistantModel.stream(t, i.signal)).getReader(), n({
|
|
54
|
+
read: async () => {
|
|
55
|
+
try {
|
|
56
|
+
let e = await a.read();
|
|
57
|
+
return e.done && r.close(), e;
|
|
58
|
+
} catch (e) {
|
|
59
|
+
throw r.close(), e;
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
cancel: async () => {
|
|
63
|
+
i.abort();
|
|
64
|
+
try {
|
|
65
|
+
await a.cancel();
|
|
66
|
+
} finally {
|
|
67
|
+
r.close();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
} catch (e) {
|
|
72
|
+
throw r.close(), e;
|
|
73
|
+
}
|
|
74
|
+
},
|
|
11
75
|
request: async (n, r) => {
|
|
12
76
|
let i = new AbortController();
|
|
13
77
|
r.onmessage = () => i.abort();
|
|
14
78
|
try {
|
|
79
|
+
if (!e.onAiModelRequest) throw Error("The host has no rendering model.");
|
|
15
80
|
let r = await e.onAiModelRequest(n, i.signal);
|
|
16
81
|
if (r.status === 0) throw TypeError("The host answered without a status");
|
|
17
82
|
let a = await r.arrayBuffer();
|
|
@@ -37,22 +102,27 @@ var e = async (e, { features: t, ...n }) => {
|
|
|
37
102
|
return window.addEventListener("message", i), () => {
|
|
38
103
|
window.removeEventListener("message", i), r.forEach((e) => e.close());
|
|
39
104
|
};
|
|
40
|
-
})(e, t,
|
|
105
|
+
})(e, t, a));
|
|
41
106
|
try {
|
|
42
|
-
await
|
|
43
|
-
auth: !!
|
|
44
|
-
...
|
|
107
|
+
await n.ui.setAiModelHost({
|
|
108
|
+
auth: !!a.onRequestAiModelAuth,
|
|
109
|
+
...i && { assistantModel: {
|
|
110
|
+
model: i.model,
|
|
111
|
+
readsImages: i.readsImages,
|
|
112
|
+
responsesProvider: t(i) ?? void 0
|
|
113
|
+
} },
|
|
114
|
+
...r && { features: r }
|
|
45
115
|
});
|
|
46
116
|
} catch (e) {
|
|
47
|
-
throw
|
|
117
|
+
throw o.stop(), e;
|
|
48
118
|
}
|
|
49
119
|
return {
|
|
50
120
|
signOut: async () => {
|
|
51
|
-
|
|
121
|
+
o.isCurrent() && await n.ui.signOutAiModel();
|
|
52
122
|
},
|
|
53
123
|
stop: async () => {
|
|
54
|
-
|
|
124
|
+
o.isCurrent() && (o.stop(), await n.ui.setAiModelHost(null));
|
|
55
125
|
}
|
|
56
126
|
};
|
|
57
127
|
};
|
|
58
|
-
export {
|
|
128
|
+
export { n as serveAiModelRequests };
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
|
|
2
|
+
var e = (e) => e.flatMap((e) => {
|
|
3
|
+
if (e.role !== "tool") return [e];
|
|
4
|
+
let t = [], n = e.content.map((e) => {
|
|
5
|
+
if (e.type !== "tool-result" || e.output.type !== "content") return e;
|
|
6
|
+
let n = e.output.value.filter((e) => e.type === "file");
|
|
7
|
+
return n.length ? (t.push(...n), {
|
|
8
|
+
...e,
|
|
9
|
+
output: {
|
|
10
|
+
...e.output,
|
|
11
|
+
value: [...e.output.value.filter((e) => e.type !== "file"), {
|
|
12
|
+
type: "text",
|
|
13
|
+
text: "The images of this result follow in the next message."
|
|
14
|
+
}]
|
|
15
|
+
}
|
|
16
|
+
}) : e;
|
|
17
|
+
});
|
|
18
|
+
return t.length ? [{
|
|
19
|
+
...e,
|
|
20
|
+
content: n
|
|
21
|
+
}, {
|
|
22
|
+
role: "user",
|
|
23
|
+
content: t
|
|
24
|
+
}] : [e];
|
|
25
|
+
}), t = (t) => ({
|
|
26
|
+
specificationVersion: t.specificationVersion,
|
|
27
|
+
provider: t.provider,
|
|
28
|
+
modelId: t.modelId,
|
|
29
|
+
supportedUrls: t.supportedUrls,
|
|
30
|
+
doGenerate: (n) => t.doGenerate({
|
|
31
|
+
...n,
|
|
32
|
+
prompt: e(n.prompt)
|
|
33
|
+
}),
|
|
34
|
+
doStream: (n) => t.doStream({
|
|
35
|
+
...n,
|
|
36
|
+
prompt: e(n.prompt)
|
|
37
|
+
})
|
|
38
|
+
}), n = async ({ provider: e, model: n, apiKey: r, baseUrl: i, headers: a, chatCompletions: o, responses: s, storedResponses: c, reasoningEffort: l }, u, d) => {
|
|
39
|
+
let f = u ? { fetch: new Proxy(fetch, { apply: async (e, t, n) => (typeof n[1]?.body == "string" && await u(n[1].body), fetch(...n)) }) } : {};
|
|
40
|
+
switch (e) {
|
|
41
|
+
case "host":
|
|
42
|
+
if (!d) throw Error("The host assistant model is unavailable.");
|
|
43
|
+
return { languageModel: d };
|
|
44
|
+
case "openai": {
|
|
45
|
+
let { createOpenAI: e } = await import("./dist-Jcq_kKKT.mjs");
|
|
46
|
+
return { languageModel: e({
|
|
47
|
+
apiKey: r,
|
|
48
|
+
...f
|
|
49
|
+
})(n) };
|
|
50
|
+
}
|
|
51
|
+
case "azure": {
|
|
52
|
+
let { createAzure: e } = await import("./dist-Ba3J8AjB.mjs"), t = e({
|
|
53
|
+
apiKey: r,
|
|
54
|
+
baseURL: i,
|
|
55
|
+
...f
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
languageModel: o ? t.chat(n) : t(n),
|
|
59
|
+
providerOptions: l ? { azure: { reasoningEffort: l } } : void 0
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
case "openai-compatible": {
|
|
63
|
+
if (!i) throw Error("The provider \"openai-compatible\" needs a baseUrl");
|
|
64
|
+
if (s) {
|
|
65
|
+
let { createOpenAI: e } = await import("./dist-Jcq_kKKT.mjs");
|
|
66
|
+
return {
|
|
67
|
+
languageModel: e({
|
|
68
|
+
baseURL: i,
|
|
69
|
+
apiKey: r ?? "none",
|
|
70
|
+
headers: {
|
|
71
|
+
...r || a?.Authorization ? {} : { Authorization: void 0 },
|
|
72
|
+
...a
|
|
73
|
+
},
|
|
74
|
+
...f
|
|
75
|
+
}).responses(n),
|
|
76
|
+
providerOptions: { openai: c ? { store: !0 } : {
|
|
77
|
+
store: !1,
|
|
78
|
+
forceReasoning: !0
|
|
79
|
+
} }
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
let { createOpenAICompatible: e } = await import("./dist-BY8OLJ2p.mjs");
|
|
83
|
+
return { languageModel: t(e({
|
|
84
|
+
name: "openai-compatible",
|
|
85
|
+
baseURL: i,
|
|
86
|
+
apiKey: r,
|
|
87
|
+
headers: a,
|
|
88
|
+
includeUsage: !0,
|
|
89
|
+
...f
|
|
90
|
+
})(n)) };
|
|
91
|
+
}
|
|
92
|
+
case "mistral": {
|
|
93
|
+
let { createMistral: e } = await import("./dist-CkZuNdCU.mjs");
|
|
94
|
+
return { languageModel: t(e({
|
|
95
|
+
apiKey: r,
|
|
96
|
+
...f
|
|
97
|
+
})(n)) };
|
|
98
|
+
}
|
|
99
|
+
case "anthropic": {
|
|
100
|
+
let { createAnthropic: e } = await import("./dist-CiybWJvs.mjs");
|
|
101
|
+
return { languageModel: e({
|
|
102
|
+
apiKey: r,
|
|
103
|
+
headers: { "anthropic-dangerous-direct-browser-access": "true" },
|
|
104
|
+
...f
|
|
105
|
+
})(n) };
|
|
106
|
+
}
|
|
107
|
+
case "google": {
|
|
108
|
+
let { createGoogleGenerativeAI: e } = await import("./dist-BMxyw-Zs.mjs");
|
|
109
|
+
return { languageModel: e({
|
|
110
|
+
apiKey: r,
|
|
111
|
+
...f
|
|
112
|
+
})(n) };
|
|
113
|
+
}
|
|
114
|
+
default: throw Error(`Unknown provider "${e}" - supported: azure, openai, openai-compatible, mistral, anthropic, google`);
|
|
115
|
+
}
|
|
116
|
+
}, r = {
|
|
117
|
+
undo: "Undo",
|
|
118
|
+
redo: "Redo",
|
|
119
|
+
"change-component-parameter": "Component parameter change",
|
|
120
|
+
"change-global-parameter": "Global parameter change",
|
|
121
|
+
"dock-component": "Component dock",
|
|
122
|
+
"drag-component": "Component drag",
|
|
123
|
+
"delete-component": "Component deletion",
|
|
124
|
+
"load-configuration": "Configuration load",
|
|
125
|
+
"get-configurator-capabilities": "Capabilities read",
|
|
126
|
+
"get-configuration": "Configuration read",
|
|
127
|
+
"get-component-parameters": "Component parameters read",
|
|
128
|
+
"get-global-parameters": "Global parameters read",
|
|
129
|
+
"get-possible-children": "Possible children read",
|
|
130
|
+
"get-docking-positions": "Docking positions read",
|
|
131
|
+
"get-component-docking-positions": "Component docking positions read",
|
|
132
|
+
"get-delete-impact": "Delete impact read"
|
|
133
|
+
}, i = new Set(Object.keys(r).filter((e) => e.startsWith("get-"))), a = (e) => {
|
|
134
|
+
if (e instanceof Error) return e.message;
|
|
135
|
+
try {
|
|
136
|
+
return typeof e == "string" ? e : JSON.stringify(e) ?? String(e);
|
|
137
|
+
} catch {
|
|
138
|
+
return Object.prototype.toString.call(e);
|
|
139
|
+
}
|
|
140
|
+
}, o = (e) => {
|
|
141
|
+
if (e?.structuredContent !== void 0) return e.structuredContent;
|
|
142
|
+
let t = e?.content?.filter((e) => e.type === "text").map((e) => e.text).join("\n");
|
|
143
|
+
if (t === void 0) return e;
|
|
144
|
+
try {
|
|
145
|
+
return JSON.parse(t);
|
|
146
|
+
} catch {
|
|
147
|
+
return t;
|
|
148
|
+
}
|
|
149
|
+
}, s = (e) => {
|
|
150
|
+
if (!e || typeof e != "object") return e == null ? [] : [a(e)];
|
|
151
|
+
let t = [];
|
|
152
|
+
for (let n of [
|
|
153
|
+
"applied",
|
|
154
|
+
"undone",
|
|
155
|
+
"redone",
|
|
156
|
+
"confirmed",
|
|
157
|
+
"canUndo",
|
|
158
|
+
"canRedo"
|
|
159
|
+
]) e[n] !== void 0 && t.push(`${n}: ${a(e[n])}`);
|
|
160
|
+
return e.hint && t.push(a(e.hint)), t;
|
|
161
|
+
}, c = (e, t = {
|
|
162
|
+
subject: "configuration",
|
|
163
|
+
readTools: i
|
|
164
|
+
}) => {
|
|
165
|
+
let n = [];
|
|
166
|
+
return {
|
|
167
|
+
tools: Object.fromEntries(Object.entries(e).map(([e, t]) => {
|
|
168
|
+
if (!t.execute) return [e, t];
|
|
169
|
+
let r = t.execute.bind(t);
|
|
170
|
+
return [e, {
|
|
171
|
+
...t,
|
|
172
|
+
execute: async (t, i) => {
|
|
173
|
+
let a = {
|
|
174
|
+
toolName: e,
|
|
175
|
+
status: "pending"
|
|
176
|
+
};
|
|
177
|
+
n.push(a);
|
|
178
|
+
try {
|
|
179
|
+
let e = await r(t, i);
|
|
180
|
+
return a.result = e, a.status = "returned", e;
|
|
181
|
+
} catch (e) {
|
|
182
|
+
throw a.error = e, a.status = "threw", e;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}];
|
|
186
|
+
})),
|
|
187
|
+
summary: () => {
|
|
188
|
+
let e = ["The assistant's reply was interrupted. Any text above is incomplete."];
|
|
189
|
+
if (!n.length) return e.push(`No tool ran, so the ${t.subject} was not changed.`), e.join("\n\n");
|
|
190
|
+
for (let i of n) {
|
|
191
|
+
let n = r[i.toolName] ?? i.toolName;
|
|
192
|
+
if (t.readTools.has(i.toolName)) {
|
|
193
|
+
let r = i.status === "returned" && !i.result?.isError, a = r ? o(i.result) : void 0;
|
|
194
|
+
e.push(r ? `- Completed ${n}: ${!1 === a?.complete ? "some requested information was unresolved" : "information was returned"}. The read did not change the ${t.subject}.` : `- Incomplete ${n}: ${i.status === "pending" ? "no result was received" : "the read failed"}. The read did not change the ${t.subject}.`);
|
|
195
|
+
} else if (i.status !== "returned" || i.result?.isError) {
|
|
196
|
+
let r = i.status === "threw" ? a(i.error) : i.status === "returned" ? a(o(i.result)) : "no result was received";
|
|
197
|
+
e.push(`- Unconfirmed ${n}: ${r}. Check the ${t.subject} before trying this operation again.`);
|
|
198
|
+
} else {
|
|
199
|
+
let r = o(i.result);
|
|
200
|
+
if (!1 === r?.confirmed) {
|
|
201
|
+
e.push(`- Unconfirmed ${n}: ${r?.hint ?? r?.unresolved?.join(" ") ?? `the SDK did not confirm the ${t.subject} change`}. Check the ${t.subject} before trying this operation again.`);
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
let a = s(r);
|
|
205
|
+
e.push(`- Completed ${n}: ${a.length ? a.join("; ") : "the tool returned successfully."}`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return e.push("These are the recorded tool outcomes; no operation was repeated automatically."), e.join("\n\n");
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
export { n, c as t };
|