@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/hi.min.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { t as e } from "./browser-BxG7yIaK.mjs";
|
|
2
2
|
import { t } from "./utils-wJ80awOA.mjs";
|
|
3
|
-
|
|
3
|
+
import { n, r, t as i } from "./planning-assistant-CyVA2uUX.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": "*"
|
|
@@ -17,22 +18,22 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
17
18
|
} catch (e) {
|
|
18
19
|
throw e;
|
|
19
20
|
}
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
},
|
|
21
|
+
}, s = { "e2fe8b3d-da31-4a20-92ab-ab6e3839300e": new Set(["Furniture_Smith"]) }, c = (e, t) => {
|
|
22
|
+
s[e] || (s[e] = /* @__PURE__ */ new Set()), s[e].add(t);
|
|
23
|
+
}, l = (e, t) => {
|
|
24
|
+
s[e]?.delete(t), s[e]?.size === 0 && delete s[e];
|
|
25
|
+
}, u = (e, t) => {
|
|
25
26
|
let { libraryId: n, serverOptions: r } = e;
|
|
26
|
-
return r?.subscriptionId &&
|
|
27
|
-
},
|
|
28
|
-
let t = await (await
|
|
27
|
+
return r?.subscriptionId && s[r.subscriptionId]?.has(n) ? `api/pos/${t}?libraryId=${n}` : `api/pos/libraries/${n}/${t}`;
|
|
28
|
+
}, 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) => {
|
|
29
|
+
let t = await (await o(u(e, "calc.js"), "text", e, { property: "calc.js" })).text();
|
|
29
30
|
if (!t) throw Error("Script load error");
|
|
30
31
|
return t;
|
|
31
|
-
},
|
|
32
|
-
onLoadJavascript: (t) =>
|
|
33
|
-
onLoadArticleCatalog: (t) =>
|
|
34
|
-
onLoadMasterData: (t) =>
|
|
35
|
-
}),
|
|
32
|
+
}, m = (e) => ({
|
|
33
|
+
onLoadJavascript: (t) => p(a(e, t)),
|
|
34
|
+
onLoadArticleCatalog: (t) => d(a(e, t)),
|
|
35
|
+
onLoadMasterData: (t) => f(a(e, t))
|
|
36
|
+
}), h = async (e, t, n, r = {}) => {
|
|
36
37
|
let { baseUrl: i, om: a } = e.serverOptions ?? {}, o = encodeURIComponent(a?.endpointUrl || ""), s = encodeURIComponent(a?.subscriptionId || ""), c = a?.key || "";
|
|
37
38
|
return await (await fetch((i ?? "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=") + `${encodeURIComponent(n)}&subscriptionId=${s}&apiKey=${c}&baseUrl=${o}`, {
|
|
38
39
|
method: "POST",
|
|
@@ -42,7 +43,7 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
42
43
|
...r
|
|
43
44
|
}
|
|
44
45
|
})).json();
|
|
45
|
-
},
|
|
46
|
+
}, g = async (e, t, n = {}) => {
|
|
46
47
|
let { baseUrl: r, om: i } = e.serverOptions ?? {}, a = encodeURIComponent(i?.endpointUrl || ""), o = encodeURIComponent(i?.subscriptionId || ""), s = i?.key || "";
|
|
47
48
|
return await (await fetch((r ?? "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=") + `${encodeURIComponent(t)}&subscriptionId=${o}&apiKey=${s}&baseUrl=${a}`, {
|
|
48
49
|
method: "GET",
|
|
@@ -51,157 +52,33 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
51
52
|
...n
|
|
52
53
|
}
|
|
53
54
|
})).json();
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
let
|
|
57
|
-
|
|
58
|
-
let { expose: o } = await import("./comlink-
|
|
59
|
-
|
|
55
|
+
}, _ = null, v = async (n, r = {}) => {
|
|
56
|
+
_ && window.removeEventListener("message", _);
|
|
57
|
+
let i = typeof n == "string" ? { libraryId: n } : n;
|
|
58
|
+
r.onLoadJavascript === void 0 && (r.onLoadJavascript = (e) => p(a(i, e))), r.onLoadArticleCatalog === void 0 && (r.onLoadArticleCatalog = (e) => d(a(i, e))), r.onLoadMasterData === void 0 && (r.onLoadMasterData = (e) => f(a(i, e)));
|
|
59
|
+
let { expose: o } = await import("./comlink-BJnhpJa4.mjs");
|
|
60
|
+
_ = (n) => {
|
|
60
61
|
if (n.data.type === "connect_hi" && n.data.port) {
|
|
61
|
-
let
|
|
62
|
+
let a = n.data.port;
|
|
62
63
|
((t, n) => {
|
|
63
64
|
t.serverOptions ||= {}, !t.serverOptions.language && n?.locale && (t.serverOptions.language = n.locale), t.serverOptions.language || (t.serverOptions.language = e(null, !0));
|
|
64
|
-
})(
|
|
65
|
+
})(i, n.data.globalInitData || {}), a.start?.(), o(t(r), a);
|
|
65
66
|
}
|
|
66
|
-
}, window.addEventListener("message",
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
},
|
|
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 }) => {
|
|
67
|
+
}, window.addEventListener("message", _);
|
|
68
|
+
}, y = () => {
|
|
69
|
+
_ &&= (window.removeEventListener("message", _), null);
|
|
70
|
+
}, b = async ({ extended: e }) => {
|
|
83
71
|
if (typeof e.getExternalObjectAgentTools != "function") throw Error("The planner has no HI agent tools: it needs a Rubens UI with getExternalObjectAgentTools.");
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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 = async ({ provider: e, model: t, apiKey: n, baseUrl: r, chatCompletions: i, reasoningEffort: a }) => {
|
|
110
|
-
switch (e) {
|
|
111
|
-
case "azure": {
|
|
112
|
-
let { createAzure: e } = await import(y("@ai-sdk/azure@4.0.85")), o = e({
|
|
113
|
-
apiKey: n,
|
|
114
|
-
baseURL: r
|
|
115
|
-
});
|
|
116
|
-
return {
|
|
117
|
-
languageModel: i ? o.chat(t) : o(t),
|
|
118
|
-
providerOptions: a ? { azure: { reasoningEffort: a } } : void 0
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
case "mistral": {
|
|
122
|
-
let { createMistral: e } = await import(y("@ai-sdk/mistral@4.0.54"));
|
|
123
|
-
return { languageModel: e({ apiKey: n })(t) };
|
|
124
|
-
}
|
|
125
|
-
case "anthropic": {
|
|
126
|
-
let { createAnthropic: e } = await import(y("@ai-sdk/anthropic@4.0.68"));
|
|
127
|
-
return { languageModel: e({
|
|
128
|
-
apiKey: n,
|
|
129
|
-
headers: { "anthropic-dangerous-direct-browser-access": "true" }
|
|
130
|
-
})(t) };
|
|
131
|
-
}
|
|
132
|
-
case "google": {
|
|
133
|
-
let { createGoogleGenerativeAI: e } = await import(y("@ai-sdk/google@4.0.85"));
|
|
134
|
-
return { languageModel: e({ apiKey: n })(t) };
|
|
135
|
-
}
|
|
136
|
-
default: throw Error(`Unknown provider "${e}" - supported: azure, mistral, anthropic, google`);
|
|
137
|
-
}
|
|
138
|
-
}, x = async (e, t, n) => {
|
|
139
|
-
let r = e.extended, i = (e) => r.planningAssistantOutput(e), a;
|
|
140
|
-
try {
|
|
141
|
-
a = await Promise.all([
|
|
142
|
-
import(y("ai@7.0.122")),
|
|
143
|
-
b(t),
|
|
144
|
-
r.getExternalObjectAgentPrompts(),
|
|
145
|
-
v(e)
|
|
146
|
-
]);
|
|
147
|
-
} catch (e) {
|
|
148
|
-
i({
|
|
149
|
-
type: "availability",
|
|
150
|
-
available: !1,
|
|
151
|
-
text: String(e)
|
|
152
|
-
});
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
let [{ streamText: o, stepCountIs: s }, c, l, u] = a, d = [];
|
|
156
|
-
r.callbacks.onPlanningAssistantPrompt = async ({ text: e, images: t }) => {
|
|
157
|
-
let r = {
|
|
158
|
-
role: "user",
|
|
159
|
-
content: [{
|
|
160
|
-
type: "text",
|
|
161
|
-
text: e || l.imagePrompt
|
|
162
|
-
}, ...t.map((e) => ({
|
|
163
|
-
type: "file",
|
|
164
|
-
data: e,
|
|
165
|
-
mediaType: "image/jpeg"
|
|
166
|
-
}))]
|
|
167
|
-
};
|
|
168
|
-
try {
|
|
169
|
-
let e = o({
|
|
170
|
-
model: c.languageModel,
|
|
171
|
-
providerOptions: c.providerOptions,
|
|
172
|
-
instructions: l.systemPrompt,
|
|
173
|
-
messages: [...d, r],
|
|
174
|
-
tools: u,
|
|
175
|
-
stopWhen: s(16),
|
|
176
|
-
abortSignal: n,
|
|
177
|
-
prepareStep: ({ stepNumber: e }) => e === 15 ? { toolChoice: "none" } : void 0
|
|
178
|
-
});
|
|
179
|
-
for await (let t of e.stream) if (t.type === "text-delta") i({
|
|
180
|
-
type: "text",
|
|
181
|
-
text: t.text
|
|
182
|
-
});
|
|
183
|
-
else if (t.type === "tool-call") i({
|
|
184
|
-
type: "activity",
|
|
185
|
-
text: t.toolName
|
|
186
|
-
});
|
|
187
|
-
else if (t.type === "error") throw t.error;
|
|
188
|
-
d.push(r, ...await e.responseMessages), i({ type: "done" });
|
|
189
|
-
} catch (e) {
|
|
190
|
-
i({
|
|
191
|
-
type: "error",
|
|
192
|
-
text: `The planning assistant failed: ${e instanceof Error ? e.message : String(e)}`
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
}, i({
|
|
196
|
-
type: "images",
|
|
197
|
-
enabled: t.readsImages
|
|
198
|
-
}), i({
|
|
199
|
-
type: "availability",
|
|
200
|
-
available: !0
|
|
201
|
-
});
|
|
202
|
-
}, S = {
|
|
72
|
+
return r(await e.getExternalObjectAgentTools(), (t, n) => e.callExternalObjectAgentTool(t, n), "hi-mcp");
|
|
73
|
+
}, x = (e, t, n) => i(e.extended, t, n, async () => {
|
|
74
|
+
let [t, n] = await Promise.all([e.extended.getExternalObjectAgentPrompts(), b(e)]);
|
|
75
|
+
return {
|
|
76
|
+
prompts: t,
|
|
77
|
+
tools: n
|
|
78
|
+
};
|
|
79
|
+
}), S = {
|
|
203
80
|
HIDE: "hide",
|
|
204
81
|
SHOW_ATTRIBUTES: "attributes",
|
|
205
82
|
SHOW_ARTICLES: "articles"
|
|
206
83
|
};
|
|
207
|
-
export { S as HI_PANEL_ACTION,
|
|
84
|
+
export { S as HI_PANEL_ACTION, y as cleanupHi, m as createHiLibraryCallbacks, b as createHiMcpTools, d as libLoadArticleCatalog, p as libLoadCalcScript, f as libLoadMasterData, n as loadChatModel, g as omGetRequest, h as omPostRequest, c as registerLegacyUrlFormat, v as setupHi, x as startPlanningAssistant, l 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-9d077e2",
|
|
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,6 +29,13 @@
|
|
|
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"
|
|
32
39
|
}
|
|
33
40
|
},
|
|
34
41
|
"scripts": {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AgentMcpTools } from '../planning-assistant/mcp-tools';
|
|
2
|
+
/**
|
|
3
|
+
* Records tool execution independently of whether the model finishes its
|
|
4
|
+
* step, so an interrupted reply can say what the tools changed.
|
|
5
|
+
*/
|
|
6
|
+
export declare const createChatRecovery: (tools: AgentMcpTools) => {
|
|
7
|
+
tools: AgentMcpTools;
|
|
8
|
+
summary: () => string;
|
|
9
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AgentToolDefinition, McpToolResult } from '../../../web-sdk/packages';
|
|
2
|
+
export interface ConfiguratorAgentApi {
|
|
3
|
+
getConfiguratorAgentTools(): Promise<AgentToolDefinition[]>;
|
|
4
|
+
callConfiguratorAgentTool(name: string, input: unknown): Promise<McpToolResult>;
|
|
5
|
+
getConfiguratorAgentPrompts(): Promise<{
|
|
6
|
+
systemPrompt: string;
|
|
7
|
+
imagePrompt: string;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
/** The native configurator's agent tools forwarded through the embedding bridge. */
|
|
11
|
+
export declare const createConfiguratorMcpTools: (api: ConfiguratorAgentApi) => Promise<import('../hi').HiMcpTools>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AssistantWindow } from '../planning-assistant/planning-assistant';
|
|
2
|
+
import { PlanningAssistantConfig } from '../planning-assistant/chat-model';
|
|
3
|
+
import { ConfiguratorAgentApi } from './configurator-mcp-tools';
|
|
4
|
+
/** Runs a native configurator assistant, with its window supplied separately for planner isolation. */
|
|
5
|
+
export declare const startConfiguratorPlanningAssistant: (endpoints: {
|
|
6
|
+
configurator: ConfiguratorAgentApi;
|
|
7
|
+
window: AssistantWindow;
|
|
8
|
+
}, config: PlanningAssistantConfig, signal: AbortSignal) => Promise<void>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { createConfiguratorMcpTools, type ConfiguratorAgentApi, } from './configurator-agent/configurator-mcp-tools';
|
|
2
|
+
export { startConfiguratorPlanningAssistant } from './configurator-agent/configurator-planning-assistant';
|
|
3
|
+
export { loadChatModel, type PlanningAssistantConfig, } from './planning-assistant/chat-model';
|
|
@@ -1,68 +1,11 @@
|
|
|
1
1
|
import { HiAgentToolDefinition, McpToolResult } from '../../../web-sdk/packages';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
type: 'content';
|
|
5
|
-
value: ({
|
|
6
|
-
type: 'text';
|
|
7
|
-
text: string;
|
|
8
|
-
} | {
|
|
9
|
-
type: 'file';
|
|
10
|
-
mediaType: string;
|
|
11
|
-
data: {
|
|
12
|
-
type: 'data';
|
|
13
|
-
data: string;
|
|
14
|
-
};
|
|
15
|
-
})[];
|
|
16
|
-
}
|
|
17
|
-
/** The input schema of a tool as a Standard Schema with its JSON Schema. */
|
|
18
|
-
export interface HiMcpInputSchema {
|
|
19
|
-
'~standard': {
|
|
20
|
-
version: 1;
|
|
21
|
-
vendor: string;
|
|
22
|
-
validate: (value: unknown) => {
|
|
23
|
-
value: unknown;
|
|
24
|
-
};
|
|
25
|
-
jsonSchema: {
|
|
26
|
-
input: (options: {
|
|
27
|
-
target: string;
|
|
28
|
-
}) => Record<string, unknown>;
|
|
29
|
-
output: (options: {
|
|
30
|
-
target: string;
|
|
31
|
-
}) => Record<string, unknown>;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/** A tool of the HI MCP tool set, in the shape of an AI SDK dynamic tool. */
|
|
36
|
-
export interface HiMcpTool {
|
|
37
|
-
type: 'dynamic';
|
|
38
|
-
description: string;
|
|
39
|
-
inputSchema: HiMcpInputSchema;
|
|
40
|
-
execute: (input: unknown) => Promise<McpToolResult>;
|
|
41
|
-
toModelOutput: (options: {
|
|
42
|
-
output: McpToolResult;
|
|
43
|
-
}) => HiMcpModelOutput;
|
|
44
|
-
}
|
|
45
|
-
/** The HI MCP tools by name, the tool set an AI SDK `streamText` takes. */
|
|
46
|
-
export type HiMcpTools = Record<string, HiMcpTool>;
|
|
47
|
-
/** The planner methods the HI MCP tools forward to: the HI agent tools of the planner. */
|
|
2
|
+
export { mcpToModelOutput } from '../planning-assistant/mcp-tools';
|
|
3
|
+
export type { AgentMcpTool as HiMcpTool, AgentMcpTools as HiMcpTools, AgentMcpModelOutput as HiMcpModelOutput, AgentMcpInputSchema as HiMcpInputSchema, } from '../planning-assistant/mcp-tools';
|
|
48
4
|
export interface HiMcpPlannerApi {
|
|
49
5
|
extended: {
|
|
50
6
|
getExternalObjectAgentTools(): Promise<HiAgentToolDefinition[]>;
|
|
51
7
|
callExternalObjectAgentTool(name: string, input: unknown): Promise<McpToolResult>;
|
|
52
8
|
};
|
|
53
9
|
}
|
|
54
|
-
/** The
|
|
55
|
-
export declare const
|
|
56
|
-
output: McpToolResult;
|
|
57
|
-
}) => HiMcpModelOutput;
|
|
58
|
-
/**
|
|
59
|
-
* Creates the HI MCP tools for an AI agent that plans in the planner of this
|
|
60
|
-
* page: the HI agent tools of the planner as an AI SDK tool set, without the
|
|
61
|
-
* MCP protocol. The host passes the tool set as `tools` to its own
|
|
62
|
-
* `streamText`. The tools run in the planner; every call is forwarded to
|
|
63
|
-
* `callExternalObjectAgentTool`. The AI SDK gets the JSON Schema of each input
|
|
64
|
-
* and lets every input through: the planner validates it and answers an
|
|
65
|
-
* invalid input and a failed call as an MCP error result (`isError`), as a
|
|
66
|
-
* forwarding error is answered here.
|
|
67
|
-
*/
|
|
68
|
-
export declare const createHiMcpTools: ({ extended, }: HiMcpPlannerApi) => Promise<HiMcpTools>;
|
|
10
|
+
/** The planner's HI agent tools, forwarded through the embedding bridge. */
|
|
11
|
+
export declare const createHiMcpTools: ({ extended }: HiMcpPlannerApi) => Promise<import('./hi-mcp-tools').HiMcpTools>;
|
|
@@ -1,25 +1,7 @@
|
|
|
1
1
|
import { PlanningAssistantOutput, PlanningAssistantPrompt } from '../../../web-sdk/packages';
|
|
2
2
|
import { HiMcpPlannerApi } from './hi-mcp-tools';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* `loadChatModel` and `startPlanningAssistant` need to reach it.
|
|
6
|
-
*/
|
|
7
|
-
export interface PlanningAssistantConfig {
|
|
8
|
-
/** `azure` for a deployment on an Azure AI Foundry resource, else the provider of the model. */
|
|
9
|
-
provider: 'azure' | 'mistral' | 'anthropic' | 'google';
|
|
10
|
-
/** The model id at the provider; for `azure` the name of the deployment. */
|
|
11
|
-
model: string;
|
|
12
|
-
/** The API key of the provider; for `azure` the key of the Foundry resource. */
|
|
13
|
-
apiKey: string;
|
|
14
|
-
/** `azure` only: the OpenAI v1 endpoint of the Foundry resource, e.g. `https://<resource>.services.ai.azure.com/openai/v1`. */
|
|
15
|
-
baseUrl?: string;
|
|
16
|
-
/** `azure` only: call the deployment through the Chat Completions API instead of the Responses API. */
|
|
17
|
-
chatCompletions?: boolean;
|
|
18
|
-
/** `azure` only: the reasoning effort of the deployment; its default when unset. */
|
|
19
|
-
reasoningEffort?: string;
|
|
20
|
-
/** Whether the model reads images: the window offers the image drop only then. */
|
|
21
|
-
readsImages: boolean;
|
|
22
|
-
}
|
|
3
|
+
import { PlanningAssistantConfig } from '../planning-assistant/chat-model';
|
|
4
|
+
export { loadChatModel, type PlanningAssistantConfig, } from '../planning-assistant/chat-model';
|
|
23
5
|
/** The planner the planning assistant runs in: the HI MCP tools' planner API, the agent prompts and the window. */
|
|
24
6
|
export type PlanningAssistantPlannerApi = HiMcpPlannerApi & {
|
|
25
7
|
extended: {
|
|
@@ -33,23 +15,5 @@ export type PlanningAssistantPlannerApi = HiMcpPlannerApi & {
|
|
|
33
15
|
};
|
|
34
16
|
};
|
|
35
17
|
};
|
|
36
|
-
/**
|
|
37
|
-
export declare const
|
|
38
|
-
languageModel: any;
|
|
39
|
-
providerOptions: {
|
|
40
|
-
azure: {
|
|
41
|
-
reasoningEffort: string;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
} | {
|
|
45
|
-
languageModel: any;
|
|
46
|
-
providerOptions?: undefined;
|
|
47
|
-
}>;
|
|
48
|
-
/**
|
|
49
|
-
* Runs the planning agent of the AI Planning Assistant window
|
|
50
|
-
* (featureFlags.planningAssistant) in this page: the window hands every
|
|
51
|
-
* message to "onPlanningAssistantPrompt", the agent calls the HI MCP tools,
|
|
52
|
-
* the tools run in the planner of this page, and the agent's output goes to
|
|
53
|
-
* "planningAssistantOutput". Aborting the signal ends a running turn.
|
|
54
|
-
*/
|
|
55
|
-
export declare const startPlanningAssistant: (roomDesignerApi: PlanningAssistantPlannerApi, config: PlanningAssistantConfig, signal: AbortSignal) => Promise<void>;
|
|
18
|
+
/** Runs the HI planning assistant in the host page. */
|
|
19
|
+
export declare const startPlanningAssistant: (api: PlanningAssistantPlannerApi, config: PlanningAssistantConfig, signal: AbortSignal) => Promise<void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The model of the AI Planning Assistant as a JSON object: everything
|
|
3
|
+
* `loadChatModel` and `startPlanningAssistant` need to reach it.
|
|
4
|
+
*/
|
|
5
|
+
export interface PlanningAssistantConfig {
|
|
6
|
+
/** `azure` for a deployment on an Azure AI Foundry resource, else the provider of the model. */
|
|
7
|
+
provider: 'azure' | 'mistral' | 'anthropic' | 'google';
|
|
8
|
+
/** The model id at the provider; for `azure` the name of the deployment. */
|
|
9
|
+
model: string;
|
|
10
|
+
/** The API key of the provider; for `azure` the key of the Foundry resource. */
|
|
11
|
+
apiKey: string;
|
|
12
|
+
/** `azure` only: the OpenAI v1 endpoint of the Foundry resource, e.g. `https://<resource>.services.ai.azure.com/openai/v1`. */
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
/** `azure` only: call the deployment through the Chat Completions API instead of the Responses API. */
|
|
15
|
+
chatCompletions?: boolean;
|
|
16
|
+
/** `azure` only: the reasoning effort of the deployment; its default when unset. */
|
|
17
|
+
reasoningEffort?: string;
|
|
18
|
+
/** Whether the model reads images: the window offers the image drop only then. */
|
|
19
|
+
readsImages: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const esm: (module: string) => string;
|
|
22
|
+
/** The AI SDK language model of the config and the provider options `streamText` takes with it. */
|
|
23
|
+
export declare const loadChatModel: ({ provider, model, apiKey, baseUrl, chatCompletions, reasoningEffort, }: PlanningAssistantConfig) => Promise<{
|
|
24
|
+
languageModel: any;
|
|
25
|
+
providerOptions: {
|
|
26
|
+
azure: {
|
|
27
|
+
reasoningEffort: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
} | {
|
|
31
|
+
languageModel: any;
|
|
32
|
+
providerOptions?: undefined;
|
|
33
|
+
}>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AgentToolDefinition, McpToolResult } from '../../../web-sdk/packages';
|
|
2
|
+
/** What the model gets of a tool result, as `@ai-sdk/mcp` hands it to the AI SDK. */
|
|
3
|
+
export interface AgentMcpModelOutput {
|
|
4
|
+
type: 'content';
|
|
5
|
+
value: ({
|
|
6
|
+
type: 'text';
|
|
7
|
+
text: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'file';
|
|
10
|
+
mediaType: string;
|
|
11
|
+
data: {
|
|
12
|
+
type: 'data';
|
|
13
|
+
data: string;
|
|
14
|
+
};
|
|
15
|
+
})[];
|
|
16
|
+
}
|
|
17
|
+
/** The input schema of a tool as a Standard Schema with its JSON Schema. */
|
|
18
|
+
export interface AgentMcpInputSchema {
|
|
19
|
+
'~standard': {
|
|
20
|
+
version: 1;
|
|
21
|
+
vendor: string;
|
|
22
|
+
validate: (value: unknown) => {
|
|
23
|
+
value: unknown;
|
|
24
|
+
};
|
|
25
|
+
jsonSchema: {
|
|
26
|
+
input: (options: {
|
|
27
|
+
target: string;
|
|
28
|
+
}) => Record<string, unknown>;
|
|
29
|
+
output: (options: {
|
|
30
|
+
target: string;
|
|
31
|
+
}) => Record<string, unknown>;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** A tool of the HI MCP tool set, in the shape of an AI SDK dynamic tool. */
|
|
36
|
+
export interface AgentMcpTool {
|
|
37
|
+
type: 'dynamic';
|
|
38
|
+
annotations?: AgentToolDefinition['annotations'];
|
|
39
|
+
description: string;
|
|
40
|
+
inputSchema: AgentMcpInputSchema;
|
|
41
|
+
execute: (input: unknown) => Promise<McpToolResult>;
|
|
42
|
+
toModelOutput: (options: {
|
|
43
|
+
output: McpToolResult;
|
|
44
|
+
}) => AgentMcpModelOutput;
|
|
45
|
+
}
|
|
46
|
+
/** The HI MCP tools by name, the tool set an AI SDK `streamText` takes. */
|
|
47
|
+
export type AgentMcpTools = Record<string, AgentMcpTool>;
|
|
48
|
+
/** The tool result as `@ai-sdk/mcp` passes it to the model: text parts and images as file parts. */
|
|
49
|
+
export declare const mcpToModelOutput: ({ output, }: {
|
|
50
|
+
output: McpToolResult;
|
|
51
|
+
}) => AgentMcpModelOutput;
|
|
52
|
+
export declare const createAgentMcpTools: (definitions: AgentToolDefinition[], call: (name: string, input: unknown) => Promise<McpToolResult>, vendor: string) => AgentMcpTools;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PlanningAssistantOutput, PlanningAssistantPrompt } from '../../../web-sdk/packages';
|
|
2
|
+
import { PlanningAssistantConfig } from './chat-model';
|
|
3
|
+
import { AgentMcpTools } from './mcp-tools';
|
|
4
|
+
export interface AssistantWindow {
|
|
5
|
+
planningAssistantOutput(part: PlanningAssistantOutput): unknown;
|
|
6
|
+
callbacks: {
|
|
7
|
+
onPlanningAssistantPrompt?: (prompt: PlanningAssistantPrompt) => Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/** Runs a browser agent with the tools and prompts supplied by its SDK domain. */
|
|
11
|
+
export declare const startAssistant: (windowApi: AssistantWindow, config: PlanningAssistantConfig, signal: AbortSignal, setupDomain: () => Promise<{
|
|
12
|
+
prompts: {
|
|
13
|
+
systemPrompt: string;
|
|
14
|
+
imagePrompt: string;
|
|
15
|
+
};
|
|
16
|
+
tools: AgentMcpTools;
|
|
17
|
+
}>, turnPolicy?: {
|
|
18
|
+
timeoutMs: number;
|
|
19
|
+
recovery: (tools: AgentMcpTools) => {
|
|
20
|
+
tools: AgentMcpTools;
|
|
21
|
+
summary(): string;
|
|
22
|
+
};
|
|
23
|
+
}) => Promise<void>;
|