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