@roomle/embedding-lib 0.0.0-dev-ec00289 → 0.0.0-dev-2e65be5

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 (60) hide show
  1. package/THIRD-PARTY-NOTICES.txt +2 -2
  2. package/ai.d.ts +2 -0
  3. package/ai.js +60 -0
  4. package/ai.min.js +58 -0
  5. package/chat-model-DKlWonm6.mjs +322 -0
  6. package/chat-model-gyIajfDW.mjs +327 -0
  7. package/{comlink-Dc3LZUoi.mjs → comlink-BYqErFai.mjs} +87 -77
  8. package/{comlink-Cmiqa2s0.mjs → comlink-m82YLjsS.mjs} +29 -22
  9. package/configurator.js +1 -1
  10. package/configurator.min.js +1 -1
  11. package/{dist-XEy6Tk_Y.mjs → dist-6TznX-Ae.mjs} +1657 -1484
  12. package/{dist-B9yy8ym8.mjs → dist-BsVeWZ8R.mjs} +1 -1
  13. package/{dist-Bb2L1Zel.mjs → dist-CjIZv2gB.mjs} +1 -1
  14. package/{dist-5jYYtT4q.mjs → dist-Cmx_tCV5.mjs} +1 -1
  15. package/{dist-C5fKJXpB.mjs → dist-CnTUCpLZ.mjs} +1 -1
  16. package/{dist-GTk8ppiK.mjs → dist-Cxe4osFc.mjs} +1 -1
  17. package/{dist-DJtonrDM.mjs → dist-D0XFfKEL.mjs} +3081 -2908
  18. package/{dist-Bo3WzRdf.mjs → dist-DCzWWudD.mjs} +1 -1
  19. package/{drag-ghost-yXe7c8jA.mjs → drag-ghost-B24KVqgc.mjs} +1 -1
  20. package/{drag-ghost-D7FnWbO4.mjs → drag-ghost-C1WS2KmW.mjs} +1 -1
  21. package/{drag-in-t7T6Pqwc.mjs → drag-in-CWHSbwvG.mjs} +3 -3
  22. package/{drag-in-BiEe2Lgv.mjs → drag-in-O5uwMddL.mjs} +3 -3
  23. package/embedding-plugins.js +1 -1
  24. package/embedding-plugins.min.js +1 -1
  25. package/fence.d.ts +2 -0
  26. package/fence.js +58 -0
  27. package/fence.min.js +56 -0
  28. package/{from-custom-view-CTBapIc6.mjs → from-custom-view-BgmiWIEN.mjs} +3 -3
  29. package/{from-custom-view-xbjgsLll.mjs → from-custom-view-CxmIIsHU.mjs} +3 -3
  30. package/{from-website-JwG7Ic_U.mjs → from-website-B8qFEG_R.mjs} +3 -3
  31. package/{from-website-DUPMQPl6.mjs → from-website-CvcnHmr2.mjs} +3 -3
  32. package/hi.js +81 -63
  33. package/hi.min.js +70 -52
  34. package/package.json +15 -1
  35. package/packages/embedding-lib/src/ai.d.ts +28 -0
  36. package/packages/embedding-lib/src/construction-agent/construction-mcp-tools.d.ts +10 -0
  37. package/packages/embedding-lib/src/construction-agent/construction-planning-assistant.d.ts +7 -0
  38. package/packages/embedding-lib/src/construction.d.ts +3 -0
  39. package/packages/embedding-lib/src/planning-assistant/chat-recovery.d.ts +1 -0
  40. package/packages/embedding-lib/src/planning-assistant/planning-assistant.d.ts +15 -0
  41. package/packages/embedding-lib/src/roomle-embedding-lib.d.ts +17 -0
  42. package/packages/web-sdk/packages/assistant.d.ts +3 -1
  43. package/packages/web-sdk/packages/common-core/src/planning-assistant/types.d.ts +5 -0
  44. package/roomle-embedding-lib.js +17 -4
  45. package/roomle-embedding-lib.min.js +17 -4
  46. package/sbom.cdx.json +5 -5
  47. package/mcp-tools-Cnhgobge.mjs +0 -153
  48. package/mcp-tools-D3Ei3Apu.mjs +0 -151
  49. /package/{browser-D6As4Zxr.mjs → browser-BjtSrqbu.mjs} +0 -0
  50. /package/{browser-zrjtYpL8.mjs → browser-D6M-d6y5.mjs} +0 -0
  51. /package/{dist-CXemOs84.mjs → dist-BI_3AeI-.mjs} +0 -0
  52. /package/{dist-CqpDM10w.mjs → dist-CGgFMwb1.mjs} +0 -0
  53. /package/{dist-CqP0aX0A.mjs → dist-CZbrRF4T.mjs} +0 -0
  54. /package/{dist-D0kh4WfT.mjs → dist-Dr3LcjP6.mjs} +0 -0
  55. /package/{dist-COgAdYY1.mjs → dist-Ur4DqwwC.mjs} +0 -0
  56. /package/{dist-D5HdKuwj.mjs → dist-wPZpiGiu.mjs} +0 -0
  57. /package/{experimental-evaluation-D56MbtjO.mjs → experimental-evaluation-DPkDk-5A.mjs} +0 -0
  58. /package/{experimental-evaluation-BgWFolud.mjs → experimental-evaluation-DyONuPyk.mjs} +0 -0
  59. /package/{utils-CAAGdgk8.mjs → utils-BoELtcEK.mjs} +0 -0
  60. /package/{utils-WeolMfC5.mjs → utils-BwWn6Fw4.mjs} +0 -0
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { At as e, Bt as t, E as n, Et as r, H as i, Ht as a, I as o, J as s, Jt as c, K as l, L as u, Lt as d, M as f, N as p, O as m, Ot as h, P as g, Q as _, Rt as v, S as y, Sn as b, St as x, T as S, Tt as C, U as w, Vt as T, W as E, Wt as D, X as O, Yt as k, _ as A, _t as j, a as M, an as N, bn as P, bt as F, dn as I, dt as ee, f as L, fn as R, g as te, gn as z, h as ne, in as B, it as re, j as V, jn as H, jt as U, kn as ie, kt as ae, ln as W, m as oe, nn as se, nt as ce, ot as G, p as le, pt as ue, rn as de, rt as fe, sn as K, st as pe, tn as q, ut as me, w as he, wt as J, y as ge, zt as _e } from "./dist-BV-32IEX.mjs";
3
- import { t as ve } from "./experimental-evaluation-BgWFolud.mjs";
3
+ import { t as ve } from "./experimental-evaluation-DyONuPyk.mjs";
4
4
  //#region node_modules/@ai-sdk/google/dist/index.js
5
5
  var ye = "4.0.85", Y = he({
6
6
  errorSchema: G(() => t(N({ error: N({
@@ -1,5 +1,5 @@
1
1
 
2
- import { a as e, c as t, i as n, m as r, o as i, s as a } from "./drag-in-BiEe2Lgv.mjs";
2
+ import { a as e, c as t, i as n, m as r, o as i, s as a } from "./drag-in-O5uwMddL.mjs";
3
3
  import "./embedding-plugins.js";
4
4
  //#region packages/common/src/utils/drag.ts
5
5
  var o = (e, t, n = 0, r = 0) => {
@@ -1,5 +1,5 @@
1
1
 
2
- import { a as e, c as t, i as n, m as r, o as i, s as a } from "./drag-in-t7T6Pqwc.mjs";
2
+ import { a as e, c as t, i as n, m as r, o as i, s as a } from "./drag-in-CWHSbwvG.mjs";
3
3
  import "./embedding-plugins.min.js";
4
4
  var o = (e, t, n = 0, r = 0) => {
5
5
  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;
@@ -1,5 +1,5 @@
1
1
 
2
- import { t as e } from "./dist-DJtonrDM.mjs";
2
+ import { n as e } from "./dist-D0XFfKEL.mjs";
3
3
  var t = "rml-drag-in-styles", n = "rml-drag-in-drag-element", r = "rml-drag-in-overlay", i = "rml-drag-in-drag-ghost", a = "rml-drag-in-fade-in", o = "rml-drag-in-fade-out", s = { DISPLAY_NONE: "rml-display-none" }, c = .5, l = "250ms", u = "forwards", d = `@keyframes ${a} {from{opacity: 0;}to {opacity: 0.5;}}`, f = `@keyframes ${o} {from{opacity: 0.5;}to {opacity: 0;}}`, p = `${a} ${l} ${u}`, m = `${o} ${l} ${u}`, h = "https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg", g = 112, _ = 112, v = class {
4
4
  _mainDomElement;
5
5
  _instance;
@@ -29,7 +29,7 @@ var t = "rml-drag-in-styles", n = "rml-drag-in-drag-element", r = "rml-drag-in-o
29
29
  }
30
30
  async init() {
31
31
  if (await super.init(), this._mode === "website") try {
32
- let { DragInFromWebsiteStrategy: e } = await import("./from-website-JwG7Ic_U.mjs");
32
+ let { DragInFromWebsiteStrategy: e } = await import("./from-website-B8qFEG_R.mjs");
33
33
  this._strategy = new e(this._instance, this._mainDomElement, {
34
34
  settings: this.options,
35
35
  mode: "website"
@@ -40,7 +40,7 @@ var t = "rml-drag-in-styles", n = "rml-drag-in-drag-element", r = "rml-drag-in-o
40
40
  else {
41
41
  if (this._mode !== "custom-view") throw Error("Unsupported mode");
42
42
  try {
43
- let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-CTBapIc6.mjs");
43
+ let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-BgmiWIEN.mjs");
44
44
  this._strategy = new e(this._instance, this._mainDomElement, this.options, this._viewName);
45
45
  } catch (e) {
46
46
  throw e;
@@ -1,5 +1,5 @@
1
1
 
2
- import { t as e } from "./dist-XEy6Tk_Y.mjs";
2
+ import { n as e } from "./dist-6TznX-Ae.mjs";
3
3
  //#region packages/embedding-lib/src/plugins/constants.ts
4
4
  var t = "rml-drag-in-styles", n = "rml-drag-in-drag-element", r = "rml-drag-in-overlay", i = "rml-drag-in-drag-ghost", a = "rml-drag-in-fade-in", o = "rml-drag-in-fade-out", s = { DISPLAY_NONE: "rml-display-none" }, c = .5, l = "250ms", u = "forwards", d = `@keyframes ${a} {from{opacity: 0;}to {opacity: ${c};}}`, f = `@keyframes ${o} {from{opacity: ${c};}to {opacity: 0;}}`, p = `${a} ${l} ${u}`, m = `${o} ${l} ${u}`, h = "https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg", g = 112, _ = 112, v = class {
5
5
  _mainDomElement;
@@ -36,7 +36,7 @@ var t = "rml-drag-in-styles", n = "rml-drag-in-drag-element", r = "rml-drag-in-o
36
36
  }
37
37
  async init() {
38
38
  if (await super.init(), this._mode === "website") try {
39
- let { DragInFromWebsiteStrategy: e } = await import("./from-website-DUPMQPl6.mjs");
39
+ let { DragInFromWebsiteStrategy: e } = await import("./from-website-CvcnHmr2.mjs");
40
40
  this._strategy = new e(this._instance, this._mainDomElement, {
41
41
  settings: this.options,
42
42
  mode: "website"
@@ -45,7 +45,7 @@ var t = "rml-drag-in-styles", n = "rml-drag-in-drag-element", r = "rml-drag-in-o
45
45
  throw console.error("Could not load Dragin strategy \"FromWebsite\""), e;
46
46
  }
47
47
  else if (this._mode === "custom-view") try {
48
- let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-xbjgsLll.mjs");
48
+ let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-CxmIIsHU.mjs");
49
49
  this._strategy = new e(this._instance, this._mainDomElement, this.options, this._viewName);
50
50
  } catch (e) {
51
51
  throw console.error("Could not load Dragin strategy \"FromCustomView\""), e;
@@ -1,3 +1,3 @@
1
1
  /*! Third-party licenses: THIRD-PARTY-NOTICES.txt and sbom.cdx.json in the root of this package */
2
- 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-BiEe2Lgv.mjs";
2
+ 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-O5uwMddL.mjs";
3
3
  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,3 +1,3 @@
1
1
  /*! Third-party licenses: THIRD-PARTY-NOTICES.txt and sbom.cdx.json in the root of this package */
2
- 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-t7T6Pqwc.mjs";
2
+ 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-CWHSbwvG.mjs";
3
3
  export { l as DragIn, a as RML_DRAG_GHOST_FADE_IN, e as RML_DRAG_GHOST_FADE_IN_ANIMATION_CSS, s as RML_DRAG_GHOST_FADE_OUT, c as RML_DRAG_GHOST_FADE_OUT_ANIMATION_CSS, t as RML_DRAG_IN_DRAG_ELEMENT_ID, u as RML_DRAG_IN_FALLBACK_GHOST_HEIGHT, n as RML_DRAG_IN_FALLBACK_GHOST_URL, r as RML_DRAG_IN_FALLBACK_GHOST_WIDTH, o as RML_DRAG_IN_STYLES_ID, i as TARGET_OPACITY };
package/fence.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './packages/embedding-lib/src/construction'
2
+ export {}
package/fence.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
+ import { i as e, n as t, r as n, t as r } from "./chat-model-gyIajfDW.mjs";
3
+ //#region packages/embedding-lib/src/construction-agent/construction-mcp-tools.ts
4
+ var i = async (e) => {
5
+ if (typeof e.getConstructionAgentTools != "function" || typeof e.callConstructionAgentTool != "function") throw Error("Update the Rubens UI: fence agent tools are unavailable.");
6
+ return n(await e.getConstructionAgentTools(), (t, n) => e.callConstructionAgentTool(t, n), "fence-mcp");
7
+ }, a = async (e, n, r, i, a) => {
8
+ let o = (t) => {
9
+ r.aborted || e.planningAssistantOutput(t);
10
+ };
11
+ try {
12
+ let s = await t(n, r, o, i, a);
13
+ r.throwIfAborted();
14
+ let c = e.callbacks.onPlanningAssistantPrompt;
15
+ e.callbacks.onPlanningAssistantPrompt = s, r.addEventListener("abort", () => {
16
+ e.callbacks.onPlanningAssistantPrompt === s && (e.callbacks.onPlanningAssistantPrompt = c, e.planningAssistantOutput({
17
+ type: "availability",
18
+ available: !1
19
+ }));
20
+ }, { once: !0 }), o({
21
+ type: "images",
22
+ enabled: n.readsImages
23
+ }), o({
24
+ type: "availability",
25
+ available: !0
26
+ });
27
+ } catch (e) {
28
+ o({
29
+ type: "availability",
30
+ available: !1,
31
+ text: String(e)
32
+ });
33
+ }
34
+ }, o = (e, t, n) => a(e.window, t, n, async () => {
35
+ let [t, n] = await Promise.all([e.planner.getConstructionAgentPrompts(), i(e.planner)]);
36
+ return {
37
+ prompts: t,
38
+ tools: n
39
+ };
40
+ }, {
41
+ timeoutMs: 5 * 6e4,
42
+ recovery: (e) => r(e, {
43
+ subject: "plan",
44
+ readTools: new Set([
45
+ "get-construction-capabilities",
46
+ "get-terrain-context",
47
+ "get-construction-context",
48
+ "get-construction-products",
49
+ "get-construction-parameters",
50
+ "get-construction-edit-impact",
51
+ "get-construction-overview",
52
+ "get-terrain-height",
53
+ "get-terrain-edit-impact"
54
+ ])
55
+ })
56
+ });
57
+ //#endregion
58
+ export { i as createConstructionMcpTools, e as loadChatModel, o as startFencePlanningAssistant };
package/fence.min.js ADDED
@@ -0,0 +1,56 @@
1
+ /*! Third-party licenses: THIRD-PARTY-NOTICES.txt and sbom.cdx.json in the root of this package */
2
+ import { i as e, n as t, r as n, t as r } from "./chat-model-DKlWonm6.mjs";
3
+ var i = async (e) => {
4
+ if (typeof e.getConstructionAgentTools != "function" || typeof e.callConstructionAgentTool != "function") throw Error("Update the Rubens UI: fence agent tools are unavailable.");
5
+ return n(await e.getConstructionAgentTools(), (t, n) => e.callConstructionAgentTool(t, n), "fence-mcp");
6
+ }, a = (e, n, a) => (async (n, r, a, o, s) => {
7
+ let c = (e) => {
8
+ a.aborted || n.planningAssistantOutput(e);
9
+ };
10
+ try {
11
+ let o = await t(r, a, c, async () => {
12
+ let [t, n] = await Promise.all([e.planner.getConstructionAgentPrompts(), i(e.planner)]);
13
+ return {
14
+ prompts: t,
15
+ tools: n
16
+ };
17
+ }, s);
18
+ a.throwIfAborted();
19
+ let l = n.callbacks.onPlanningAssistantPrompt;
20
+ n.callbacks.onPlanningAssistantPrompt = o, a.addEventListener("abort", () => {
21
+ n.callbacks.onPlanningAssistantPrompt === o && (n.callbacks.onPlanningAssistantPrompt = l, n.planningAssistantOutput({
22
+ type: "availability",
23
+ available: !1
24
+ }));
25
+ }, { once: !0 }), c({
26
+ type: "images",
27
+ enabled: r.readsImages
28
+ }), c({
29
+ type: "availability",
30
+ available: !0
31
+ });
32
+ } catch (e) {
33
+ c({
34
+ type: "availability",
35
+ available: !1,
36
+ text: String(e)
37
+ });
38
+ }
39
+ })(e.window, n, a, 0, {
40
+ timeoutMs: 3e5,
41
+ recovery: (e) => r(e, {
42
+ subject: "plan",
43
+ readTools: new Set([
44
+ "get-construction-capabilities",
45
+ "get-terrain-context",
46
+ "get-construction-context",
47
+ "get-construction-products",
48
+ "get-construction-parameters",
49
+ "get-construction-edit-impact",
50
+ "get-construction-overview",
51
+ "get-terrain-height",
52
+ "get-terrain-edit-impact"
53
+ ])
54
+ })
55
+ });
56
+ export { i as createConstructionMcpTools, e as loadChatModel, a as startFencePlanningAssistant };
@@ -1,7 +1,7 @@
1
1
 
2
- import { a as e, c as t, n } from "./utils-CAAGdgk8.mjs";
3
- import { d as r } from "./drag-in-t7T6Pqwc.mjs";
4
- import { t as i } from "./drag-ghost-D7FnWbO4.mjs";
2
+ import { a as e, c as t, n } from "./utils-BoELtcEK.mjs";
3
+ import { d as r } from "./drag-in-CWHSbwvG.mjs";
4
+ import { t as i } from "./drag-ghost-C1WS2KmW.mjs";
5
5
  var a = (e, n = 0) => t(e) ? {
6
6
  clientX: e.touches[n].clientX,
7
7
  clientY: e.touches[n].clientY
@@ -1,7 +1,7 @@
1
1
 
2
- import { a as e, c as t, n } from "./utils-WeolMfC5.mjs";
3
- import { d as r } from "./drag-in-BiEe2Lgv.mjs";
4
- import { t as i } from "./drag-ghost-yXe7c8jA.mjs";
2
+ import { a as e, c as t, n } from "./utils-BwWn6Fw4.mjs";
3
+ import { d as r } from "./drag-in-O5uwMddL.mjs";
4
+ import { t as i } from "./drag-ghost-B24KVqgc.mjs";
5
5
  var a = (e, n = 0) => t(e) ? {
6
6
  clientX: e.touches[n].clientX,
7
7
  clientY: e.touches[n].clientY
@@ -1,7 +1,7 @@
1
1
 
2
- import { c as e, i as t, n, o as r, r as i, s as a } from "./utils-CAAGdgk8.mjs";
3
- import { l as o, p as s, r as c } from "./drag-in-t7T6Pqwc.mjs";
4
- import { t as l } from "./drag-ghost-D7FnWbO4.mjs";
2
+ import { c as e, i as t, n, o as r, r as i, s as a } from "./utils-BoELtcEK.mjs";
3
+ import { l as o, p as s, r as c } from "./drag-in-CWHSbwvG.mjs";
4
+ import { t as l } from "./drag-ghost-C1WS2KmW.mjs";
5
5
  var u = class {
6
6
  _options = {};
7
7
  _instance;
@@ -1,7 +1,7 @@
1
1
 
2
- import { c as e, i as t, n, o as r, r as i, s as a } from "./utils-WeolMfC5.mjs";
3
- import { l as o, p as s, r as c } from "./drag-in-BiEe2Lgv.mjs";
4
- import { t as l } from "./drag-ghost-yXe7c8jA.mjs";
2
+ import { c as e, i as t, n, o as r, r as i, s as a } from "./utils-BwWn6Fw4.mjs";
3
+ import { l as o, p as s, r as c } from "./drag-in-O5uwMddL.mjs";
4
+ import { t as l } from "./drag-ghost-B24KVqgc.mjs";
5
5
  //#region packages/embedding-lib/src/plugins/strategy/from-website.ts
6
6
  var u = class {
7
7
  _options = {};
package/hi.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*! Third-party licenses: THIRD-PARTY-NOTICES.txt and sbom.cdx.json in the root of this package */
2
- import { t as e } from "./browser-zrjtYpL8.mjs";
3
- import { t } from "./utils-WeolMfC5.mjs";
4
- import { n, t as r } from "./mcp-tools-Cnhgobge.mjs";
2
+ import { t as e } from "./browser-D6M-d6y5.mjs";
3
+ import { t } from "./utils-BwWn6Fw4.mjs";
4
+ import { i as n, r } from "./chat-model-gyIajfDW.mjs";
5
5
  var i = (e, t) => t === e.libraryId ? e : {
6
6
  ...e,
7
7
  libraryId: t
@@ -58,7 +58,7 @@ var i = (e, t) => t === e.libraryId ? e : {
58
58
  _ && window.removeEventListener("message", _);
59
59
  let r = typeof e == "string" ? { libraryId: e } : e;
60
60
  n.onLoadJavascript === void 0 && (n.onLoadJavascript = (e) => f(i(r, e))), n.onLoadArticleCatalog === void 0 && (n.onLoadArticleCatalog = (e) => u(i(r, e))), n.onLoadMasterData === void 0 && (n.onLoadMasterData = (e) => d(i(r, e)));
61
- let { expose: a } = await import("./comlink-Cmiqa2s0.mjs");
61
+ let { expose: a } = await import("./comlink-m82YLjsS.mjs");
62
62
  _ = (e) => {
63
63
  if (e.data.type === "connect_hi" && e.data.port) {
64
64
  let i = e.data.port;
@@ -121,16 +121,22 @@ var i = (e, t) => t === e.libraryId ? e : {
121
121
  otherBytes: n.bytes - i - o
122
122
  }
123
123
  };
124
- }, O = 16, k = /^(Previous response with id '[^']*' not found|No tool output found for function call )/, A = (e) => e instanceof Error && k.test(e.message), j = [
124
+ }, O = 16, k = /^(Previous response with id '[^']*' not found|No tool output found for function call )/, A = (e) => e instanceof Error && k.test(e.message), j = (e) => e.role !== "assistant" || typeof e.content == "string" ? e : {
125
+ ...e,
126
+ content: e.content.map((e) => (e.type === "text" || e.type === "reasoning") && e.providerOptions ? {
127
+ ...e,
128
+ providerOptions: Object.fromEntries(Object.entries(e.providerOptions).map(([e, t]) => [e, Object.fromEntries(Object.entries(t).filter(([e]) => e !== "itemId"))]))
129
+ } : e)
130
+ }, M = [
125
131
  "rooms",
126
132
  "groups",
127
133
  "obstacles",
128
134
  "installationElements"
129
- ], M = 500, N = 240, P = ({ content: e }) => e.filter((e) => e.type === "text").map((e) => e.text).join("\n"), F = async (e, t, r) => {
135
+ ], N = 500, P = 240, F = ({ content: e }) => e.filter((e) => e.type === "text").map((e) => e.text).join("\n"), I = async (e, t, r) => {
130
136
  let i = e.extended, a = (e) => i.planningAssistantOutput(e), o = [], s = null, c = /* @__PURE__ */ new Set(), l;
131
137
  try {
132
138
  l = await Promise.all([
133
- import("./dist-XEy6Tk_Y.mjs"),
139
+ import("./dist-6TznX-Ae.mjs").then((e) => e.t),
134
140
  n(t, async (e) => {
135
141
  o.push({
136
142
  ...await D(e, c),
@@ -148,22 +154,22 @@ var i = (e, t) => t === e.libraryId ? e : {
148
154
  });
149
155
  return;
150
156
  }
151
- let [{ streamText: u, stepCountIs: d }, f, p, m] = l, h = [p.systemPrompt, ...(p.referenceBlocks ?? []).map(({ id: e, text: t }) => `Reference: ${e}\n${t}`)].join("\n\n"), g = [], _ = t.provider === "azure" && !t.chatCompletions && t.referenceCacheBreakpoint === !0, v = !1, y = async () => {
152
- for (let e = 0; e < N; e += 1) {
153
- if (v || r.aborted) return;
157
+ let [{ streamText: u, stepCountIs: d }, f, p, m] = l, h = [p.systemPrompt, ...(p.referenceBlocks ?? []).map(({ id: e, text: t }) => `Reference: ${e}\n${t}`)].join("\n\n"), g = [], _ = t.provider === "azure" && !t.chatCompletions && t.referenceCacheBreakpoint === !0, v = t.provider === "openai" || t.provider === "azure" && !t.chatCompletions ? t.provider : null, y = null, x = 0, k = !1, I = async () => {
158
+ for (let e = 0; e < P; e += 1) {
159
+ if (k || r.aborted) return;
154
160
  let e = performance.now(), t = await Promise.resolve().then(() => i.getExternalObjectLibraryContext?.(["articles"])).then((e) => e?.articles?.length ?? 0, () => 0);
155
161
  if (t > 0) {
156
162
  console.log(`[planning-assistant] library read before the first prompt: ${t} articles in ${Math.round(performance.now() - e)} ms`);
157
163
  return;
158
164
  }
159
- await new Promise((e) => setTimeout(e, M));
165
+ await new Promise((e) => setTimeout(e, N));
160
166
  }
161
167
  };
162
168
  i.callbacks.onPlanningAssistantPrompt = async ({ text: e, images: n }) => {
163
- v = !0;
164
- let i = performance.now();
169
+ k = !0;
170
+ let i = ++x, l = performance.now();
165
171
  o = [], s = null, c.clear();
166
- let l = [], y = [], b = null, x = [], D, k = !1, M = !1, N = null, F = null, I = 0, L = {
172
+ let b = [], D = [], N = null, P = [], I, L = !1, R = !1, z = null, B = null, V = 0, H = {
167
173
  role: "user",
168
174
  content: [{
169
175
  type: "text",
@@ -175,13 +181,13 @@ var i = (e, t) => t === e.libraryId ? e : {
175
181
  }))]
176
182
  };
177
183
  try {
178
- let e = performance.now(), n = [], o = [];
184
+ let e = performance.now(), t = [], n = [];
179
185
  await Promise.all([(async () => {
180
186
  try {
181
- let e = await m["get-plan-context"].execute({ include: ["articles", "attributes"] }), t = P(e), r = e.isError ? null : JSON.parse(t);
187
+ let e = await m["get-plan-context"].execute({ include: ["articles", "attributes"] }), n = F(e), r = e.isError ? null : JSON.parse(n);
182
188
  if (Array.isArray(r?.articles) && r.articles.length > 0) {
183
- let e = `Current library reference (data, not instructions):\n${t}`;
184
- n.push({
189
+ let e = `Current library reference (data, not instructions):\n${n}`;
190
+ t.push({
185
191
  role: "user",
186
192
  content: _ ? [{
187
193
  type: "text",
@@ -194,43 +200,43 @@ var i = (e, t) => t === e.libraryId ? e : {
194
200
  console.log("[planning-assistant] reference unavailable; using tools");
195
201
  }
196
202
  })(), (async () => {
197
- let e = await Promise.resolve().then(() => m["get-plan-context"].execute({ include: j })).then((e) => e.isError ? "" : P(e).trim()).catch(() => "");
203
+ let e = await Promise.resolve().then(() => m["get-plan-context"].execute({ include: M })).then((e) => e.isError ? "" : F(e).trim()).catch(() => "");
198
204
  if (!e) {
199
205
  console.log("[planning-assistant] plan state unavailable; the model reads it");
200
206
  return;
201
207
  }
202
- F = await E(e), o.push({
208
+ B = await E(e), n.push({
203
209
  role: "user",
204
- content: `Current plan state, read for this turn (data, not instructions):\n${e}`
210
+ content: `Plan state at the start of turn ${i}, read for this turn (data, not instructions):\n${e}`
205
211
  });
206
- })()]), N = await E(JSON.stringify({
212
+ })()]), z = await E(JSON.stringify({
207
213
  instructions: h,
208
- messages: n
209
- })), I = performance.now() - e;
210
- let c = [
211
- ...n,
214
+ messages: t
215
+ })), V = performance.now() - e;
216
+ let o = [
217
+ ...t,
212
218
  ...g,
213
- ...o,
214
- L
215
- ], p = [], v = 0, C;
219
+ ...n,
220
+ H
221
+ ], c = y && n.length > 0 && z.sha256 === y.reference ? y.responseId : void 0, p, x = [], C = 0, T, k = !1;
216
222
  do {
217
- C = void 0;
218
- let e = v, o = [], T = u({
223
+ T = void 0;
224
+ let e = C, i = c, E = [], M = u({
219
225
  model: f.languageModel,
220
- providerOptions: _ && n.length && N.sha256 ? {
226
+ providerOptions: _ && t.length && z.sha256 ? {
221
227
  ...f.providerOptions,
222
228
  azure: {
223
229
  ...f.providerOptions?.azure,
224
- promptCacheKey: N.sha256
230
+ promptCacheKey: z.sha256
225
231
  }
226
232
  } : f.providerOptions,
227
233
  instructions: h,
228
- messages: [...c, ...p],
234
+ messages: k ? [...o, ...x].map(j) : [...o, ...x],
229
235
  tools: m,
230
236
  stopWhen: d(O - e),
231
237
  abortSignal: r,
232
238
  onLanguageModelCallEnd: (e) => {
233
- y.push({
239
+ D.push({
234
240
  ...S(e.usage),
235
241
  ...w(e.usage),
236
242
  responseTimeMs: e.performance.responseTimeMs,
@@ -239,26 +245,35 @@ var i = (e, t) => t === e.libraryId ? e : {
239
245
  });
240
246
  },
241
247
  onStepEnd: (e) => {
242
- o.push(...e.response.messages), v++;
248
+ E.push(...e.response.messages), C++, p = v ? e.providerMetadata?.[v]?.responseId ?? void 0 : void 0;
243
249
  },
244
- prepareStep: (n) => {
245
- s = e + n.stepNumber;
246
- let r = s === O - 1 ? { toolChoice: "none" } : {}, i = t.provider === "openai" || t.provider === "azure" && !t.chatCompletions ? t.provider : null;
247
- if (!i || n.stepNumber === 0) return r;
248
- let a = n.steps.at(-1), o = a.providerMetadata?.[i]?.responseId;
250
+ prepareStep: (t) => {
251
+ s = e + t.stepNumber;
252
+ let r = s === O - 1 ? { toolChoice: "none" } : {};
253
+ if (!v) return r;
254
+ if (t.stepNumber === 0) return i ? {
255
+ ...r,
256
+ instructions: [],
257
+ messages: [...n, H],
258
+ providerOptions: { [v]: {
259
+ previousResponseId: i,
260
+ store: !0
261
+ } }
262
+ } : r;
263
+ let a = t.steps.at(-1), o = a.providerMetadata?.[v]?.responseId;
249
264
  if (!o) throw Error("The previous model response has no continuation ID");
250
265
  return {
251
266
  ...r,
252
267
  instructions: [],
253
268
  messages: a.response.messages.filter(({ role: e }) => e === "tool"),
254
- providerOptions: { [i]: {
269
+ providerOptions: { [v]: {
255
270
  previousResponseId: o,
256
271
  store: !0
257
272
  } }
258
273
  };
259
274
  }
260
275
  });
261
- for await (let e of T.stream) if (e.type === "text-delta") b ??= performance.now() - i, a({
276
+ for await (let e of M.stream) if (e.type === "text-delta") N ??= performance.now() - l, a({
262
277
  type: "text",
263
278
  text: e.text
264
279
  });
@@ -267,14 +282,17 @@ var i = (e, t) => t === e.libraryId ? e : {
267
282
  text: e.toolName
268
283
  });
269
284
  else if (e.type === "error") {
270
- if (o.length > 0 && A(e.error)) {
271
- C = e.error;
285
+ if ((E.length > 0 || i) && A(e.error)) {
286
+ T = e.error;
272
287
  break;
273
288
  }
274
289
  throw e.error;
275
- } else e.type === "finish-step" ? (x.push(S(e.usage)), l.push(w(e.usage))) : e.type === "finish" ? (D = p.length ? void 0 : S(e.totalUsage), k = !0) : e.type === "abort" && (M = !0);
276
- C ? (console.log(`[planning-assistant] continuation rejected (${C.message}) - continuing with the whole history`), p.push(...o)) : !M && !r.aborted && g.push(L, ...p, ...await T.responseMessages);
277
- } while (C);
290
+ } else e.type === "finish-step" ? (P.push(S(e.usage)), b.push(w(e.usage))) : e.type === "finish" ? (I = x.length ? void 0 : S(e.totalUsage), L = !0) : e.type === "abort" && (R = !0);
291
+ T ? (console.log(`[planning-assistant] continuation rejected (${T.message}) - continuing with the whole history`), x.push(...E), c = void 0, k = !0) : !R && !r.aborted && (g.push(H, ...x, ...await M.responseMessages), y = p && z.sha256 ? {
292
+ responseId: p,
293
+ reference: z.sha256
294
+ } : null);
295
+ } while (T);
278
296
  a({ type: "done" });
279
297
  } catch (e) {
280
298
  console.log("[planning-assistant]", String(e)), a({
@@ -283,39 +301,39 @@ var i = (e, t) => t === e.libraryId ? e : {
283
301
  });
284
302
  } finally {
285
303
  let e = {
286
- inputTokens: D?.inputTokens ?? C(x.map((e) => e.inputTokens)),
287
- outputTokens: D?.outputTokens ?? C(x.map((e) => e.outputTokens)),
288
- totalTokens: D?.totalTokens ?? C(x.map((e) => e.totalTokens))
289
- }, n = Object.values(e).some((e) => e !== null), a = k && !M && !r.aborted && Object.values(e).every((e) => e !== null) && x.every((e) => Object.values(e).every((e) => e !== null));
304
+ inputTokens: I?.inputTokens ?? C(P.map((e) => e.inputTokens)),
305
+ outputTokens: I?.outputTokens ?? C(P.map((e) => e.outputTokens)),
306
+ totalTokens: I?.totalTokens ?? C(P.map((e) => e.totalTokens))
307
+ }, n = Object.values(e).some((e) => e !== null), i = L && !R && !r.aborted && Object.values(e).every((e) => e !== null) && P.every((e) => Object.values(e).every((e) => e !== null));
290
308
  console.log(`[planning-assistant] usage ${JSON.stringify({
291
309
  provider: t.provider,
292
310
  model: t.model,
293
- status: n ? a ? "complete" : "partial" : "unavailable",
311
+ status: n ? i ? "complete" : "partial" : "unavailable",
294
312
  ...e,
295
313
  diagnostics: {
296
314
  version: 1,
297
- details: T(l),
298
- modelCalls: y,
315
+ details: T(b),
316
+ modelCalls: D,
299
317
  requests: o,
300
- reference: N,
301
- planState: F,
302
- referenceAcquisitionMs: I,
303
- firstTextMs: b,
304
- turnMs: performance.now() - i
318
+ reference: z,
319
+ planState: B,
320
+ referenceAcquisitionMs: V,
321
+ firstTextMs: N,
322
+ turnMs: performance.now() - l
305
323
  }
306
324
  })}`);
307
325
  }
308
- }, i.getExternalObjectLibraryContext && y(), a({
326
+ }, i.getExternalObjectLibraryContext && I(), a({
309
327
  type: "images",
310
328
  enabled: t.readsImages
311
329
  }), a({
312
330
  type: "availability",
313
331
  available: !0
314
332
  });
315
- }, I = {
333
+ }, L = {
316
334
  HIDE: "hide",
317
335
  SHOW_ATTRIBUTES: "attributes",
318
336
  SHOW_ARTICLES: "articles"
319
337
  };
320
338
  //#endregion
321
- export { I as HI_PANEL_ACTION, y as cleanupHi, p as createHiLibraryCallbacks, b as createHiMcpTools, u as libLoadArticleCatalog, f as libLoadCalcScript, d as libLoadMasterData, n as loadChatModel, h as omGetRequest, m as omPostRequest, s as registerLegacyUrlFormat, v as setupHi, F as startPlanningAssistant, c as unregisterLegacyUrlFormat };
339
+ export { L as HI_PANEL_ACTION, y as cleanupHi, p as createHiLibraryCallbacks, b as createHiMcpTools, u as libLoadArticleCatalog, f as libLoadCalcScript, d as libLoadMasterData, n as loadChatModel, h as omGetRequest, m as omPostRequest, s as registerLegacyUrlFormat, v as setupHi, I as startPlanningAssistant, c as unregisterLegacyUrlFormat };