@roomle/embedding-lib 0.0.0-dev-60bc7cd → 0.0.0-dev-a95b24e

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.
Files changed (27) hide show
  1. package/{drag-ghost-BOwjMbG3.mjs → drag-ghost-BxqPJdhq.mjs} +1 -1
  2. package/{drag-ghost-BQ8r6NVo.mjs → drag-ghost-CDFtC1pd.mjs} +1 -1
  3. package/{drag-in-BP_E53zb.mjs → drag-in-CV1E-DO6.mjs} +2 -2
  4. package/{drag-in-QhL3zGC0.mjs → drag-in-ClPpCYyi.mjs} +2 -2
  5. package/embedding-plugins.js +1 -1
  6. package/embedding-plugins.min.js +1 -1
  7. package/{from-custom-view-BM_zRJCf.mjs → from-custom-view-Q9A-J7qV.mjs} +2 -2
  8. package/{from-custom-view-D2Z1YmCx.mjs → from-custom-view-Sx6P6iDI.mjs} +2 -2
  9. package/{from-website-DlklVbxU.mjs → from-website-BmCO2xli.mjs} +2 -2
  10. package/{from-website-CPVeVVMI.mjs → from-website-DZJy_l42.mjs} +2 -2
  11. package/hi.js +53 -13
  12. package/hi.min.js +51 -11
  13. package/package.json +1 -1
  14. package/packages/embedding-lib/src/hi.d.ts +1 -3
  15. package/packages/embedding-lib/src/homag-intelligence/hi-mcp-tools.d.ts +65 -8
  16. package/packages/embedding-lib/src/homag-intelligence/hi-planning-assistant.d.ts +2 -2
  17. package/roomle-embedding-lib.js +63 -56
  18. package/roomle-embedding-lib.min.js +8 -1
  19. package/hi-mcp-server-B4BAKDmw.mjs +0 -5288
  20. package/hi-mcp-server-DxIvpJmq.mjs +0 -4879
  21. package/packages/embedding-lib/src/homag-intelligence/hi-mcp/agent-facing.d.ts +0 -35
  22. package/packages/embedding-lib/src/homag-intelligence/hi-mcp/hi-mcp-server.d.ts +0 -3
  23. package/packages/embedding-lib/src/homag-intelligence/hi-mcp/mcp-tool.d.ts +0 -69
  24. package/packages/embedding-lib/src/homag-intelligence/hi-mcp/plan-history.d.ts +0 -33
  25. package/packages/embedding-lib/src/homag-intelligence/hi-mcp/planner-api.d.ts +0 -32
  26. package/packages/embedding-lib/src/homag-intelligence/hi-mcp/skills.d.ts +0 -23
  27. package/packages/embedding-lib/src/homag-intelligence/hi-mcp/tool-executors.d.ts +0 -4
@@ -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-QhL3zGC0.mjs";
1
+ import { a as e, c as t, i as n, m as r, o as i, s as a } from "./drag-in-ClPpCYyi.mjs";
2
2
  import "./embedding-plugins.js";
3
3
  //#region packages/common/src/utils/drag.ts
4
4
  var o = (e, t, n = 0, r = 0) => {
@@ -1,4 +1,4 @@
1
- import { a as e, c as t, i as n, m as r, o as i, s as a } from "./drag-in-BP_E53zb.mjs";
1
+ import { a as e, c as t, i as n, m as r, o as i, s as a } from "./drag-in-CV1E-DO6.mjs";
2
2
  import "./embedding-plugins.min.js";
3
3
  var o = (e, t, n = 0, r = 0) => {
4
4
  let i = t.x + t.width + n, a = t.x - n, o = t.y + t.height + r, s = t.y - r, { x: c, y: l } = e;
@@ -34,7 +34,7 @@ var e = Object.defineProperty, t = (t, n) => {
34
34
  }
35
35
  async init() {
36
36
  if (await super.init(), this._mode === "website") try {
37
- let { DragInFromWebsiteStrategy: e } = await import("./from-website-DlklVbxU.mjs");
37
+ let { DragInFromWebsiteStrategy: e } = await import("./from-website-BmCO2xli.mjs");
38
38
  this._strategy = new e(this._instance, this._mainDomElement, {
39
39
  settings: this.options,
40
40
  mode: "website"
@@ -45,7 +45,7 @@ var e = Object.defineProperty, t = (t, n) => {
45
45
  else {
46
46
  if (this._mode !== "custom-view") throw Error("Unsupported mode");
47
47
  try {
48
- let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-D2Z1YmCx.mjs");
48
+ let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-Sx6P6iDI.mjs");
49
49
  this._strategy = new e(this._instance, this._mainDomElement, this.options, this._viewName);
50
50
  } catch (e) {
51
51
  throw e;
@@ -41,7 +41,7 @@ var e = Object.defineProperty, t = (t, n) => {
41
41
  }
42
42
  async init() {
43
43
  if (await super.init(), this._mode === "website") try {
44
- let { DragInFromWebsiteStrategy: e } = await import("./from-website-CPVeVVMI.mjs");
44
+ let { DragInFromWebsiteStrategy: e } = await import("./from-website-DZJy_l42.mjs");
45
45
  this._strategy = new e(this._instance, this._mainDomElement, {
46
46
  settings: this.options,
47
47
  mode: "website"
@@ -50,7 +50,7 @@ var e = Object.defineProperty, t = (t, n) => {
50
50
  throw console.error("Could not load Dragin strategy \"FromWebsite\""), e;
51
51
  }
52
52
  else if (this._mode === "custom-view") try {
53
- let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-BM_zRJCf.mjs");
53
+ let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-Q9A-J7qV.mjs");
54
54
  this._strategy = new e(this._instance, this._mainDomElement, this.options, this._viewName);
55
55
  } catch (e) {
56
56
  throw console.error("Could not load Dragin strategy \"FromCustomView\""), e;
@@ -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-QhL3zGC0.mjs";
1
+ import { a as e, c as t, d as n, f as r, h as i, i as a, m as o, o as s, s as c, t as l, u } from "./drag-in-ClPpCYyi.mjs";
2
2
  export { l as DragIn, a as RML_DRAG_GHOST_FADE_IN, e as RML_DRAG_GHOST_FADE_IN_ANIMATION_CSS, s as RML_DRAG_GHOST_FADE_OUT, c as RML_DRAG_GHOST_FADE_OUT_ANIMATION_CSS, t as RML_DRAG_IN_DRAG_ELEMENT_ID, u as RML_DRAG_IN_FALLBACK_GHOST_HEIGHT, n as RML_DRAG_IN_FALLBACK_GHOST_URL, r as RML_DRAG_IN_FALLBACK_GHOST_WIDTH, o as RML_DRAG_IN_STYLES_ID, i as TARGET_OPACITY };
@@ -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-BP_E53zb.mjs";
1
+ import { a as e, c as t, d as n, f as r, h as i, i as a, m as o, o as s, s as c, t as l, u } from "./drag-in-CV1E-DO6.mjs";
2
2
  export { l as DragIn, a as RML_DRAG_GHOST_FADE_IN, e as RML_DRAG_GHOST_FADE_IN_ANIMATION_CSS, s as RML_DRAG_GHOST_FADE_OUT, c as RML_DRAG_GHOST_FADE_OUT_ANIMATION_CSS, t as RML_DRAG_IN_DRAG_ELEMENT_ID, u as RML_DRAG_IN_FALLBACK_GHOST_HEIGHT, n as RML_DRAG_IN_FALLBACK_GHOST_URL, r as RML_DRAG_IN_FALLBACK_GHOST_WIDTH, o as RML_DRAG_IN_STYLES_ID, i as TARGET_OPACITY };
@@ -1,6 +1,6 @@
1
- import { d as e } from "./drag-in-QhL3zGC0.mjs";
1
+ import { d as e } from "./drag-in-ClPpCYyi.mjs";
2
2
  import { a as t, c as n, n as r } from "./utils-DxJ3PcKe.mjs";
3
- import { t as i } from "./drag-ghost-BOwjMbG3.mjs";
3
+ import { t as i } from "./drag-ghost-BxqPJdhq.mjs";
4
4
  var a = (e, t = 0) => n(e) ? {
5
5
  clientX: e.touches[t].clientX,
6
6
  clientY: e.touches[t].clientY
@@ -1,6 +1,6 @@
1
- import { d as e } from "./drag-in-BP_E53zb.mjs";
1
+ import { d as e } from "./drag-in-CV1E-DO6.mjs";
2
2
  import { a as t, c as n, n as r } from "./utils-wJ80awOA.mjs";
3
- import { t as i } from "./drag-ghost-BQ8r6NVo.mjs";
3
+ import { t as i } from "./drag-ghost-CDFtC1pd.mjs";
4
4
  var a = (e, t = 0) => n(e) ? {
5
5
  clientX: e.touches[t].clientX,
6
6
  clientY: e.touches[t].clientY
@@ -1,6 +1,6 @@
1
- import { l as e, p as t, r as n } from "./drag-in-BP_E53zb.mjs";
1
+ import { l as e, p as t, r as n } from "./drag-in-CV1E-DO6.mjs";
2
2
  import { c as r, i, n as a, o, r as s, s as c } from "./utils-wJ80awOA.mjs";
3
- import { t as l } from "./drag-ghost-BQ8r6NVo.mjs";
3
+ import { t as l } from "./drag-ghost-CDFtC1pd.mjs";
4
4
  var u = class {
5
5
  _options = {};
6
6
  _instance;
@@ -1,6 +1,6 @@
1
- import { l as e, p as t, r as n } from "./drag-in-QhL3zGC0.mjs";
1
+ import { l as e, p as t, r as n } from "./drag-in-ClPpCYyi.mjs";
2
2
  import { c as r, i, n as a, o, r as s, s as c } from "./utils-DxJ3PcKe.mjs";
3
- import { t as l } from "./drag-ghost-BOwjMbG3.mjs";
3
+ import { t as l } from "./drag-ghost-BxqPJdhq.mjs";
4
4
  //#region packages/embedding-lib/src/plugins/strategy/from-website.ts
5
5
  var u = class {
6
6
  _options = {};
package/hi.js CHANGED
@@ -65,12 +65,52 @@ var n = (e, t) => t === e.libraryId ? e : {
65
65
  }, window.addEventListener("message", h);
66
66
  }, _ = () => {
67
67
  h &&= (window.removeEventListener("message", h), null);
68
- }, v = async (e) => (await import("./hi-mcp-server-B4BAKDmw.mjs")).createHiMcpTools(e), y = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, b = 16, x = async ({ provider: e, model: t, apiKey: n, baseUrl: r, chatCompletions: i, reasoningEffort: a }) => {
68
+ }, v = ({ output: e }) => ({
69
+ type: "content",
70
+ value: e.content.map((e) => e.type === "text" ? {
71
+ type: "text",
72
+ text: e.text
73
+ } : {
74
+ type: "file",
75
+ mediaType: e.mimeType,
76
+ data: {
77
+ type: "data",
78
+ data: e.data
79
+ }
80
+ })
81
+ }), y = async ({ extended: e }) => {
82
+ if (typeof e.getExternalObjectAgentTools != "function") throw Error("The planner has no HI agent tools: it needs a Rubens UI with getExternalObjectAgentTools.");
83
+ let t = await e.getExternalObjectAgentTools();
84
+ return Object.fromEntries(t.map(({ name: t, description: n, inputSchema: r }) => {
85
+ let i = () => r;
86
+ return [t, {
87
+ type: "dynamic",
88
+ description: n,
89
+ inputSchema: { "~standard": {
90
+ version: 1,
91
+ vendor: "hi-mcp",
92
+ validate: (e) => ({ value: e }),
93
+ jsonSchema: {
94
+ input: i,
95
+ output: i
96
+ }
97
+ } },
98
+ execute: (n) => e.callExternalObjectAgentTool(t, n).catch((e) => ({
99
+ content: [{
100
+ type: "text",
101
+ text: e instanceof Error ? e.message : String(e)
102
+ }],
103
+ isError: !0
104
+ })),
105
+ toModelOutput: v
106
+ }];
107
+ }));
108
+ }, b = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, x = 16, S = async ({ provider: e, model: t, apiKey: n, baseUrl: r, chatCompletions: i, reasoningEffort: a }) => {
69
109
  switch (e) {
70
110
  case "azure": {
71
111
  let { createAzure: e } = await import(
72
112
  /* @vite-ignore */
73
- y("@ai-sdk/azure@4.0.85")
113
+ b("@ai-sdk/azure@4.0.85")
74
114
  ), o = e({
75
115
  apiKey: n,
76
116
  baseURL: r
@@ -83,14 +123,14 @@ var n = (e, t) => t === e.libraryId ? e : {
83
123
  case "mistral": {
84
124
  let { createMistral: e } = await import(
85
125
  /* @vite-ignore */
86
- y("@ai-sdk/mistral@4.0.54")
126
+ b("@ai-sdk/mistral@4.0.54")
87
127
  );
88
128
  return { languageModel: e({ apiKey: n })(t) };
89
129
  }
90
130
  case "anthropic": {
91
131
  let { createAnthropic: e } = await import(
92
132
  /* @vite-ignore */
93
- y("@ai-sdk/anthropic@4.0.68")
133
+ b("@ai-sdk/anthropic@4.0.68")
94
134
  );
95
135
  return { languageModel: e({
96
136
  apiKey: n,
@@ -100,23 +140,23 @@ var n = (e, t) => t === e.libraryId ? e : {
100
140
  case "google": {
101
141
  let { createGoogleGenerativeAI: e } = await import(
102
142
  /* @vite-ignore */
103
- y("@ai-sdk/google@4.0.85")
143
+ b("@ai-sdk/google@4.0.85")
104
144
  );
105
145
  return { languageModel: e({ apiKey: n })(t) };
106
146
  }
107
147
  default: throw Error(`Unknown provider "${e}" - supported: azure, mistral, anthropic, google`);
108
148
  }
109
- }, S = async (e, t, n) => {
149
+ }, C = async (e, t, n) => {
110
150
  let r = e.extended, i = (e) => r.planningAssistantOutput(e), a;
111
151
  try {
112
152
  a = await Promise.all([
113
153
  import(
114
154
  /* @vite-ignore */
115
- y("ai@7.0.122")
155
+ b("ai@7.0.122")
116
156
  ),
117
- x(t),
157
+ S(t),
118
158
  r.getExternalObjectAgentPrompts(),
119
- v(e)
159
+ y(e)
120
160
  ]);
121
161
  } catch (e) {
122
162
  console.log("[planning-assistant]", String(e)), i({
@@ -146,9 +186,9 @@ var n = (e, t) => t === e.libraryId ? e : {
146
186
  instructions: l.systemPrompt,
147
187
  messages: [...d, r],
148
188
  tools: u,
149
- stopWhen: s(b),
189
+ stopWhen: s(x),
150
190
  abortSignal: n,
151
- prepareStep: ({ stepNumber: e }) => e === b - 1 ? { toolChoice: "none" } : void 0
191
+ prepareStep: ({ stepNumber: e }) => e === x - 1 ? { toolChoice: "none" } : void 0
152
192
  });
153
193
  for await (let t of e.stream) if (t.type === "text-delta") i({
154
194
  type: "text",
@@ -173,10 +213,10 @@ var n = (e, t) => t === e.libraryId ? e : {
173
213
  type: "availability",
174
214
  available: !0
175
215
  });
176
- }, C = {
216
+ }, w = {
177
217
  HIDE: "hide",
178
218
  SHOW_ATTRIBUTES: "attributes",
179
219
  SHOW_ARTICLES: "articles"
180
220
  };
181
221
  //#endregion
182
- export { C as HI_PANEL_ACTION, _ as cleanupHi, d as createHiLibraryCallbacks, v as createHiMcpTools, c as libLoadArticleCatalog, u as libLoadCalcScript, l as libLoadMasterData, x as loadChatModel, p as omGetRequest, f as omPostRequest, a as registerLegacyUrlFormat, g as setupHi, S as startPlanningAssistant, o as unregisterLegacyUrlFormat };
222
+ export { w as HI_PANEL_ACTION, _ as cleanupHi, d as createHiLibraryCallbacks, y as createHiMcpTools, c as libLoadArticleCatalog, u as libLoadCalcScript, l as libLoadMasterData, S as loadChatModel, p as omGetRequest, f as omPostRequest, a as registerLegacyUrlFormat, g as setupHi, C as startPlanningAssistant, o as unregisterLegacyUrlFormat };
package/hi.min.js CHANGED
@@ -66,10 +66,50 @@ var n = (e, t) => t === e.libraryId ? e : {
66
66
  }, window.addEventListener("message", m);
67
67
  }, g = () => {
68
68
  m &&= (window.removeEventListener("message", m), null);
69
- }, _ = async (e) => (await import("./hi-mcp-server-DxIvpJmq.mjs")).createHiMcpTools(e), v = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, y = async ({ provider: e, model: t, apiKey: n, baseUrl: r, chatCompletions: i, reasoningEffort: a }) => {
69
+ }, _ = ({ output: e }) => ({
70
+ type: "content",
71
+ value: e.content.map((e) => e.type === "text" ? {
72
+ type: "text",
73
+ text: e.text
74
+ } : {
75
+ type: "file",
76
+ mediaType: e.mimeType,
77
+ data: {
78
+ type: "data",
79
+ data: e.data
80
+ }
81
+ })
82
+ }), v = async ({ extended: e }) => {
83
+ if (typeof e.getExternalObjectAgentTools != "function") throw Error("The planner has no HI agent tools: it needs a Rubens UI with getExternalObjectAgentTools.");
84
+ let t = await e.getExternalObjectAgentTools();
85
+ return Object.fromEntries(t.map(({ name: t, description: n, inputSchema: r }) => {
86
+ let i = () => r;
87
+ return [t, {
88
+ type: "dynamic",
89
+ description: n,
90
+ inputSchema: { "~standard": {
91
+ version: 1,
92
+ vendor: "hi-mcp",
93
+ validate: (e) => ({ value: e }),
94
+ jsonSchema: {
95
+ input: i,
96
+ output: i
97
+ }
98
+ } },
99
+ execute: (n) => e.callExternalObjectAgentTool(t, n).catch((e) => ({
100
+ content: [{
101
+ type: "text",
102
+ text: e instanceof Error ? e.message : String(e)
103
+ }],
104
+ isError: !0
105
+ })),
106
+ toModelOutput: _
107
+ }];
108
+ }));
109
+ }, y = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, b = async ({ provider: e, model: t, apiKey: n, baseUrl: r, chatCompletions: i, reasoningEffort: a }) => {
70
110
  switch (e) {
71
111
  case "azure": {
72
- let { createAzure: e } = await import(v("@ai-sdk/azure@4.0.85")), o = e({
112
+ let { createAzure: e } = await import(y("@ai-sdk/azure@4.0.85")), o = e({
73
113
  apiKey: n,
74
114
  baseURL: r
75
115
  });
@@ -79,30 +119,30 @@ var n = (e, t) => t === e.libraryId ? e : {
79
119
  };
80
120
  }
81
121
  case "mistral": {
82
- let { createMistral: e } = await import(v("@ai-sdk/mistral@4.0.54"));
122
+ let { createMistral: e } = await import(y("@ai-sdk/mistral@4.0.54"));
83
123
  return { languageModel: e({ apiKey: n })(t) };
84
124
  }
85
125
  case "anthropic": {
86
- let { createAnthropic: e } = await import(v("@ai-sdk/anthropic@4.0.68"));
126
+ let { createAnthropic: e } = await import(y("@ai-sdk/anthropic@4.0.68"));
87
127
  return { languageModel: e({
88
128
  apiKey: n,
89
129
  headers: { "anthropic-dangerous-direct-browser-access": "true" }
90
130
  })(t) };
91
131
  }
92
132
  case "google": {
93
- let { createGoogleGenerativeAI: e } = await import(v("@ai-sdk/google@4.0.85"));
133
+ let { createGoogleGenerativeAI: e } = await import(y("@ai-sdk/google@4.0.85"));
94
134
  return { languageModel: e({ apiKey: n })(t) };
95
135
  }
96
136
  default: throw Error(`Unknown provider "${e}" - supported: azure, mistral, anthropic, google`);
97
137
  }
98
- }, b = async (e, t, n) => {
138
+ }, x = async (e, t, n) => {
99
139
  let r = e.extended, i = (e) => r.planningAssistantOutput(e), a;
100
140
  try {
101
141
  a = await Promise.all([
102
- import(v("ai@7.0.122")),
103
- y(t),
142
+ import(y("ai@7.0.122")),
143
+ b(t),
104
144
  r.getExternalObjectAgentPrompts(),
105
- _(e)
145
+ v(e)
106
146
  ]);
107
147
  } catch (e) {
108
148
  i({
@@ -159,9 +199,9 @@ var n = (e, t) => t === e.libraryId ? e : {
159
199
  type: "availability",
160
200
  available: !0
161
201
  });
162
- }, x = {
202
+ }, S = {
163
203
  HIDE: "hide",
164
204
  SHOW_ATTRIBUTES: "attributes",
165
205
  SHOW_ARTICLES: "articles"
166
206
  };
167
- export { x as HI_PANEL_ACTION, g as cleanupHi, d as createHiLibraryCallbacks, _ as createHiMcpTools, c as libLoadArticleCatalog, u as libLoadCalcScript, l as libLoadMasterData, y as loadChatModel, p as omGetRequest, f as omPostRequest, a as registerLegacyUrlFormat, h as setupHi, b as startPlanningAssistant, o as unregisterLegacyUrlFormat };
207
+ export { S as HI_PANEL_ACTION, g as cleanupHi, d as createHiLibraryCallbacks, v as createHiMcpTools, c as libLoadArticleCatalog, u as libLoadCalcScript, l as libLoadMasterData, b as loadChatModel, p as omGetRequest, f as omPostRequest, a as registerLegacyUrlFormat, h as setupHi, x as startPlanningAssistant, o as unregisterLegacyUrlFormat };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomle/embedding-lib",
3
- "version": "0.0.0-dev-60bc7cd",
3
+ "version": "0.0.0-dev-a95b24e",
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",
@@ -14,9 +14,7 @@ export { createHiLibraryCallbacks } from './homag-intelligence/hi-callbacks';
14
14
  export { libLoadArticleCatalog, libLoadMasterData, libLoadCalcScript, registerLegacyUrlFormat, unregisterLegacyUrlFormat, } from './homag-intelligence/hi-requests';
15
15
  export { omPostRequest, omGetRequest, } from './homag-intelligence/hi-order-manager';
16
16
  export { setupHi, cleanupHi } from './homag-intelligence/hi-setup';
17
- export { createHiMcpTools } from './homag-intelligence/hi-mcp-tools';
18
- export type { HiMcpTool, HiMcpTools, } from './homag-intelligence/hi-mcp/mcp-tool';
19
- export type { HiMcpPlannerApi } from './homag-intelligence/hi-mcp/planner-api';
17
+ export { createHiMcpTools, type HiMcpTool, type HiMcpTools, type HiMcpPlannerApi, } from './homag-intelligence/hi-mcp-tools';
20
18
  export { loadChatModel, startPlanningAssistant, type PlanningAssistantConfig, type PlanningAssistantPlannerApi, } from './homag-intelligence/hi-planning-assistant';
21
19
  export { type ExternalObjectSnapshotSaveResult, type HiContextAction, } from '../../web-sdk/packages';
22
20
  export { HI_PANEL_ACTION, type HiPanelActionType, type HiOrderHeader, type HiOrder, type HiOrderData, type HiPriceData, type HiCallbacks, } from '../../common/src/hi/hi-types';
@@ -1,11 +1,68 @@
1
- import { HiMcpTools } from './hi-mcp/mcp-tool';
2
- import { HiMcpPlannerApi } from './hi-mcp/planner-api';
1
+ import { HiAgentToolDefinition, 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 HiMcpModelOutput {
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. */
48
+ export interface HiMcpPlannerApi {
49
+ extended: {
50
+ getExternalObjectAgentTools(): Promise<HiAgentToolDefinition[]>;
51
+ callExternalObjectAgentTool(name: string, input: unknown): Promise<McpToolResult>;
52
+ };
53
+ }
54
+ /** The tool result as `@ai-sdk/mcp` passes it to the model: text parts and images as file parts. */
55
+ export declare const mcpToModelOutput: ({ output, }: {
56
+ output: McpToolResult;
57
+ }) => HiMcpModelOutput;
3
58
  /**
4
59
  * Creates the HI MCP tools for an AI agent that plans in the planner of this
5
- * page: the tools of the HI MCP server as an AI SDK tool set, without the MCP
6
- * protocol. The host passes the tool set as `tools` to its own `streamText`.
7
- * The tools call the planner through `roomDesignerApi.extended` and chain its
8
- * `onHistoryChange` callback; a host that sets its own handler sets it before.
9
- * The tool code is loaded on the first call.
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.
10
67
  */
11
- export declare const createHiMcpTools: (roomDesignerApi: HiMcpPlannerApi) => Promise<HiMcpTools>;
68
+ export declare const createHiMcpTools: ({ extended, }: HiMcpPlannerApi) => Promise<HiMcpTools>;
@@ -1,5 +1,5 @@
1
1
  import { PlanningAssistantOutput, PlanningAssistantPrompt } from '../../../web-sdk/packages';
2
- import { HiMcpPlannerApi } from './hi-mcp/planner-api';
2
+ import { HiMcpPlannerApi } from './hi-mcp-tools';
3
3
  /**
4
4
  * The model of the AI Planning Assistant as a JSON object: everything
5
5
  * `loadChatModel` and `startPlanningAssistant` need to reach it.
@@ -49,7 +49,7 @@ export declare const loadChatModel: ({ provider, model, apiKey, baseUrl, chatCom
49
49
  * Runs the planning agent of the AI Planning Assistant window
50
50
  * (featureFlags.planningAssistant) in this page: the window hands every
51
51
  * message to "onPlanningAssistantPrompt", the agent calls the HI MCP tools,
52
- * the tools call the planner of this page, and the agent's output goes to
52
+ * the tools run in the planner of this page, and the agent's output goes to
53
53
  * "planningAssistantOutput". Aborting the signal ends a running turn.
54
54
  */
55
55
  export declare const startPlanningAssistant: (roomDesignerApi: PlanningAssistantPlannerApi, config: PlanningAssistantConfig, signal: AbortSignal) => Promise<void>;