@roomle/embedding-lib 0.0.0-dev-20f436f → 0.0.0-dev-d66646c

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 (74) hide show
  1. package/THIRD-PARTY-NOTICES.txt +2 -2
  2. package/ai.js +8 -8
  3. package/ai.min.js +7 -6
  4. package/{browser-D6M-d6y5.mjs → browser-Cys-y5Hy.mjs} +1 -2
  5. package/chat-model-DooKwd8I.mjs +117 -0
  6. package/chat-model-KHuz1Ej9.mjs +118 -0
  7. package/coerce-CuLRCRlo.mjs +6 -0
  8. package/coerce-Dup0o-HR.mjs +7 -0
  9. package/{comlink-CG3f9q6z.mjs → comlink-7u13Z2ZH.mjs} +2 -3
  10. package/{comlink-hSUzCx9j.mjs → comlink-DKhvPU0o.mjs} +1 -1
  11. package/configurator.js +3 -4
  12. package/configurator.min.js +2 -2
  13. package/construction.js +387 -31
  14. package/construction.min.js +395 -36
  15. package/continuation-COcMrXyj.mjs +14 -0
  16. package/continuation-D2hsmYf1.mjs +13 -0
  17. package/{dist-Cm3aF4sf.mjs → dist-7-X7Xqsl.mjs} +851 -919
  18. package/{dist-BQaw78-_.mjs → dist-BMxyw-Zs.mjs} +411 -405
  19. package/{dist-0WZWTj8T.mjs → dist-BU022PnG.mjs} +4 -9
  20. package/{dist-DkR6G9Kj.mjs → dist-BY8OLJ2p.mjs} +1 -1
  21. package/{dist-6TznX-Ae.mjs → dist-BZSd56sr.mjs} +3850 -3942
  22. package/{dist-70R0b5Mq.mjs → dist-Ba3J8AjB.mjs} +400 -390
  23. package/{dist-CTS0DDwt.mjs → dist-CbQKC1xX.mjs} +1590 -1616
  24. package/{dist-BmOBP9h9.mjs → dist-CiybWJvs.mjs} +44 -41
  25. package/{dist-CPG4atmb.mjs → dist-CkZuNdCU.mjs} +6 -4
  26. package/{dist-Bt1FopV4.mjs → dist-D2ZAAHGn.mjs} +1058 -1042
  27. package/{dist-BWNv7qW9.mjs → dist-DjsS42rR.mjs} +916 -962
  28. package/{dist-9UI7dzwc.mjs → dist-Jcq_kKKT.mjs} +403 -393
  29. package/{dist-D0XFfKEL.mjs → dist-S9sLSjZ4.mjs} +3112 -3104
  30. package/{dist-BV-32IEX.mjs → dist-XECXrV5Q.mjs} +1497 -1558
  31. package/{dist-Bc2s-kJZ.mjs → dist-a5_BIeaS.mjs} +45 -51
  32. package/{dist-Crrp-Bno.mjs → dist-bQAJDeYc.mjs} +698 -748
  33. package/{drag-ghost-BpIDzSdK.mjs → drag-ghost-QZelgA-_.mjs} +2 -3
  34. package/{drag-ghost-Bhb0_67G.mjs → drag-ghost-VmgSWLva.mjs} +5 -7
  35. package/{drag-in-mE_ozj_Q.mjs → drag-in-Cd_67tzS.mjs} +4 -5
  36. package/{drag-in-CGBG4wEk.mjs → drag-in-DlDsgY4T.mjs} +3 -3
  37. package/embedding-plugins.js +1 -2
  38. package/embedding-plugins.min.js +1 -2
  39. package/{experimental-evaluation-FzKFGoye.mjs → experimental-evaluation-B4hKMgFH.mjs} +19 -38
  40. package/{experimental-evaluation-DczxmJme.mjs → experimental-evaluation-DmqghFSx.mjs} +1 -1
  41. package/{from-custom-view-B3fIWMox.mjs → from-custom-view-6HMD_sPe.mjs} +5 -4
  42. package/{from-custom-view-B3HCOhdT.mjs → from-custom-view-BRFynafo.mjs} +16 -16
  43. package/{from-website-DaTahmvJ.mjs → from-website-Dl1VN4h7.mjs} +5 -6
  44. package/{from-website-DUQ9USj1.mjs → from-website-iZzauH4C.mjs} +3 -3
  45. package/hi.js +228 -233
  46. package/hi.min.js +207 -204
  47. package/mcp-tools-C6O2gQZW.mjs +41 -0
  48. package/mcp-tools-m_3IX0vB.mjs +40 -0
  49. package/package.json +1 -1
  50. package/packages/embedding-lib/src/homag-intelligence/hi-planning-assistant.d.ts +3 -0
  51. package/packages/embedding-lib/src/homag-intelligence/hi-planning-usage.d.ts +0 -6
  52. package/packages/web-sdk/packages/assistant.d.ts +3 -1
  53. package/packages/web-sdk/packages/common-core/src/planning-assistant/chat-recovery.d.ts +5 -1
  54. package/packages/web-sdk/packages/common-core/src/planning-assistant/continuation.d.ts +5 -3
  55. package/packages/web-sdk/packages/common-core/src/planning-assistant/runtime.d.ts +4 -1
  56. package/packages/web-sdk/packages/common-core/src/planning-assistant/types.d.ts +2 -0
  57. package/packages/web-sdk/packages/common-core/src/planning-assistant/usage.d.ts +16 -0
  58. package/packages/web-sdk/packages/common-core/src/planning-assistant.d.ts +19 -1
  59. package/rolldown-runtime--db92txo.mjs +10 -0
  60. package/rolldown-runtime-CyjYJMBa.mjs +11 -0
  61. package/roomle-embedding-lib.js +25 -34
  62. package/roomle-embedding-lib.min.js +3 -3
  63. package/sbom.cdx.json +5 -5
  64. package/usage-CgXarvBY.mjs +16 -0
  65. package/usage-c8evaONq.mjs +17 -0
  66. package/{utils-BwWn6Fw4.mjs → utils-CJnKZceY.mjs} +3 -4
  67. package/{utils-BoELtcEK.mjs → utils-DdNhTbJr.mjs} +6 -6
  68. package/chat-model-C1ov616e.mjs +0 -377
  69. package/chat-model-CifTV-8H.mjs +0 -373
  70. package/coerce-CqJod_GZ.mjs +0 -8
  71. package/coerce-CsI42_k0.mjs +0 -6
  72. package/mcp-tools-CC8DTfZA.mjs +0 -2
  73. package/mcp-tools-CfJ_ue_2.mjs +0 -2
  74. /package/{browser-BjtSrqbu.mjs → browser-CzLpXYFF.mjs} +0 -0
@@ -1,57 +1,416 @@
1
1
  /*! Third-party licenses: THIRD-PARTY-NOTICES.txt and sbom.cdx.json in the root of this package */
2
- import { a as e, n as t, o as n, t as r } from "./chat-model-CifTV-8H.mjs";
3
- import "./mcp-tools-CC8DTfZA.mjs";
4
- var i = async (t) => {
2
+ import { t as e } from "./mcp-tools-m_3IX0vB.mjs";
3
+ import { a as t, c as n, i as r, l as i, n as a, o, s, t as c } from "./usage-CgXarvBY.mjs";
4
+ import { _n as l } from "./dist-D2ZAAHGn.mjs";
5
+ import { t as u } from "./chat-model-DooKwd8I.mjs";
6
+ import { n as d, r as f, t as p } from "./continuation-D2hsmYf1.mjs";
7
+ var m = {
8
+ done: () => {},
9
+ failed: () => {}
10
+ }, h = {
11
+ systemPrompt: () => {},
12
+ context: () => {},
13
+ text: () => {},
14
+ tool: () => m,
15
+ end: () => {}
16
+ }, g = (e) => {
17
+ let t = "";
18
+ for (let n = 0; n < e.length; n += 32768) t += String.fromCharCode(...e.subarray(n, n + 32768));
19
+ return btoa(t);
20
+ }, _ = (e) => {
21
+ return e.type === "text" ? [{
22
+ type: "text",
23
+ text: e.text ?? ""
24
+ }] : e.type === "file" || e.type === "image" ? [{
25
+ type: "file",
26
+ mediaType: e.mediaType ?? "image/*",
27
+ data: (t = e.type === "file" ? e.data : e.image, typeof t == "string" ? t : t instanceof URL ? t.href : t instanceof ArrayBuffer ? g(new Uint8Array(t)) : t instanceof Uint8Array ? g(t) : String(t))
28
+ }] : [];
29
+ var t;
30
+ }, v = (e) => ({
31
+ role: e.role,
32
+ content: typeof e.content == "string" ? [{
33
+ type: "text",
34
+ text: e.content
35
+ }] : e.content.flatMap(_)
36
+ }), y = (e) => {
37
+ if (e instanceof Error) return e.message;
38
+ try {
39
+ return typeof e == "string" ? e : JSON.stringify(e) ?? String(e);
40
+ } catch {
41
+ return Object.prototype.toString.call(e);
42
+ }
43
+ }, b = (e) => {
44
+ if (e?.structuredContent !== void 0) return e.structuredContent;
45
+ let t = e?.content?.filter((e) => e.type === "text").map((e) => e.text).join("\n");
46
+ if (t === void 0) return e;
47
+ try {
48
+ return JSON.parse(t);
49
+ } catch {
50
+ return t;
51
+ }
52
+ }, x = (e) => {
53
+ if (!e || typeof e != "object") return e == null ? [] : [y(e)];
54
+ let t = [];
55
+ for (let n of [
56
+ "applied",
57
+ "undone",
58
+ "redone",
59
+ "confirmed",
60
+ "canUndo",
61
+ "canRedo"
62
+ ]) e[n] !== void 0 && t.push(`${n}: ${y(e[n])}`);
63
+ return e.hint && t.push(y(e.hint)), t;
64
+ }, S = async (t) => {
5
65
  if (typeof t.getConstructionAgentTools != "function" || typeof t.callConstructionAgentTool != "function") throw Error("Update the Rubens UI: fence agent tools are unavailable.");
6
66
  return e(await t.getConstructionAgentTools(), (e, n) => t.callConstructionAgentTool(e, n), "fence-mcp");
7
- }, a = (e, n, a) => (async (n, r, a, o, s) => {
8
- let c = (e) => {
9
- a.aborted || n.planningAssistantOutput(e);
67
+ }, C = (e, m, g) => (async (e, t, m, g, _) => {
68
+ let y = (t) => {
69
+ m.aborted || e.planningAssistantOutput(t);
10
70
  };
11
71
  try {
12
- let o = await t(r, a, c, async () => {
13
- let [t, n] = await Promise.all([e.planner.getConstructionAgentPrompts(), i(e.planner)]);
14
- return {
15
- prompts: t,
16
- tools: n
17
- };
18
- }, s);
19
- a.throwIfAborted();
20
- let l = n.callbacks.onPlanningAssistantPrompt;
21
- n.callbacks.onPlanningAssistantPrompt = o, a.addEventListener("abort", () => {
22
- n.callbacks.onPlanningAssistantPrompt === o && (n.callbacks.onPlanningAssistantPrompt = l, n.planningAssistantOutput({
72
+ let b = await ((e, t, m, g, _) => (async ({ config: e, signal: t, output: m, hostModel: g, assistantName: _, setupDomain: y, turnPolicy: b, unchangedStep: x, usageLine: S, onRejectedContinuation: C }) => {
73
+ let w = [], T = h, [{ streamText: E, stepCountIs: D }, O, k] = await Promise.all([
74
+ import("./dist-S9sLSjZ4.mjs").then((e) => e.t),
75
+ u(e, async (e) => {
76
+ w.push(c(e));
77
+ }, g),
78
+ y((e, t) => T.tool(e, t))
79
+ ]);
80
+ t.throwIfAborted();
81
+ let A = ((e, t) => {
82
+ let n = {
83
+ provider: e.provider,
84
+ model: e.model,
85
+ tools: t,
86
+ systemPrompts: [],
87
+ turns: []
88
+ }, r = /* @__PURE__ */ new Map();
89
+ return {
90
+ startTurn: (e) => {
91
+ let t = {
92
+ turn: n.turns.length + 1,
93
+ startedAt: (/* @__PURE__ */ new Date()).toISOString(),
94
+ endedAt: null,
95
+ systemPrompt: null,
96
+ context: [],
97
+ prompt: {
98
+ text: e.text,
99
+ images: [...e.images]
100
+ },
101
+ events: [],
102
+ outcome: "running",
103
+ error: null,
104
+ usage: null
105
+ };
106
+ return n.turns.push(t), {
107
+ systemPrompt: (e) => {
108
+ let i = r.get(e);
109
+ i === void 0 && (i = n.systemPrompts.push({
110
+ rootComponentId: e.rootComponentId ?? null,
111
+ text: e.systemPrompt,
112
+ imagePrompt: e.imagePrompt
113
+ }) - 1, r.set(e, i)), t.systemPrompt = i;
114
+ },
115
+ context: (e) => {
116
+ t.context = e.map(v);
117
+ },
118
+ text: (e) => {
119
+ let n = t.events.at(-1);
120
+ n?.type === "text" ? n.text += e : t.events.push({
121
+ type: "text",
122
+ text: e
123
+ });
124
+ },
125
+ tool: (e, n) => {
126
+ let r = {
127
+ type: "tool",
128
+ name: e,
129
+ args: n
130
+ };
131
+ return t.events.push(r), {
132
+ done: (e) => {
133
+ r.result = e;
134
+ },
135
+ failed: (e) => {
136
+ r.error = e;
137
+ }
138
+ };
139
+ },
140
+ end: (e, n, r) => {
141
+ t.outcome = e, t.error = n, t.usage = r, t.endedAt = (/* @__PURE__ */ new Date()).toISOString();
142
+ }
143
+ };
144
+ },
145
+ snapshot: () => structuredClone(n)
146
+ };
147
+ })(e, k.toolDefinitions), j = d(e), M = (e) => j ? e?.providerMetadata?.[j]?.responseId ?? void 0 : void 0, N = [], P;
148
+ return Object.assign(async ({ text: e, images: u }, d = t) => {
149
+ let h = i([t, d]), g = A.startTurn({
150
+ text: e,
151
+ images: u
152
+ });
153
+ T = g;
154
+ let v = "done", y = null;
155
+ w = [];
156
+ let S = [], F = [], I, L = !1, R = !1, z = !1, B = !1, V = !1, H = null, U = null, W = (t) => (g.systemPrompt(t), H = c(t.systemPrompt), {
157
+ role: "user",
158
+ content: [{
159
+ type: "text",
160
+ text: e || t.imagePrompt
161
+ }, ...u.map((e) => ({
162
+ type: "file",
163
+ data: e,
164
+ mediaType: "image/jpeg"
165
+ }))]
166
+ }), G = k.staticPrompts ? W(k.staticPrompts) : void 0, K = b?.recovery(k.tools), q = new AbortController(), J = () => q.abort(h.reason);
167
+ h.addEventListener("abort", J, { once: !0 }), h.aborted && J();
168
+ let Y = b ? Error(n(b.timeoutMs)) : void 0, X = b ? setTimeout(() => q.abort(Y), b.timeoutMs) : void 0;
169
+ try {
170
+ let e = await k.readTurn({
171
+ stopSignal: h,
172
+ abortSignal: q.signal
173
+ }), { prompts: t, context: n } = e, i = G ?? W(t);
174
+ G = i, U = e.configurationBytes, g.context(n);
175
+ let a = [
176
+ ...N,
177
+ ...n,
178
+ i
179
+ ], o, c = P && e.continuesStoredConversation && P.prompts === t ? P.responseId : void 0;
180
+ z = c !== void 0;
181
+ let l = [], u, d, _ = 0, v = !1;
182
+ do {
183
+ u = void 0;
184
+ let e = _, y = c, w = [];
185
+ d = E({
186
+ model: O.languageModel,
187
+ providerOptions: O.providerOptions,
188
+ instructions: t.systemPrompt,
189
+ messages: v ? [...a, ...l].map(f) : [...a, ...l],
190
+ tools: K?.tools ?? k.tools,
191
+ stopWhen: D(32 - e),
192
+ abortSignal: b ? q.signal : h,
193
+ onStepEnd: (e) => {
194
+ w.push(...e.response.messages), _++, o = M(e);
195
+ },
196
+ prepareStep: (r) => {
197
+ let a = e + r.stepNumber, o = s(a, t.systemPrompt);
198
+ if (!j) return Object.keys(o).length ? o : x;
199
+ let c = (e, t) => ({
200
+ instructions: [],
201
+ ...s(a),
202
+ messages: t,
203
+ providerOptions: { [j]: {
204
+ previousResponseId: e,
205
+ store: !0
206
+ } }
207
+ });
208
+ if (r.stepNumber === 0) return y ? c(y, [...n, i]) : o;
209
+ let l = r.steps?.at(-1), u = M(l);
210
+ if (!l || !u) throw Error("The previous model response has no continuation ID");
211
+ return c(u, l.response.messages.filter(({ role: e }) => e === "tool"));
212
+ }
213
+ });
214
+ for await (let e of d.stream) if (e.type === "text-delta") g.text(e.text), m({
215
+ type: "text",
216
+ text: e.text
217
+ });
218
+ else if (e.type === "tool-call") m({
219
+ type: "activity",
220
+ text: e.toolName
221
+ });
222
+ else {
223
+ if (e.type === "error") {
224
+ if ((w.length > 0 || y) && p(e.error)) {
225
+ u = e.error;
226
+ break;
227
+ }
228
+ throw e.error;
229
+ }
230
+ if (e.type === "finish-step") S.push(r(e.usage)), F.push(e.usage?.inputTokenDetails?.cacheReadTokens ?? null);
231
+ else if (e.type === "finish") I = l.length ? void 0 : r(e.totalUsage), L = !0;
232
+ else if (e.type === "abort" && (R = !0, b)) throw q.signal.reason ?? /* @__PURE__ */ Error("Turn aborted");
233
+ }
234
+ u && (C?.(u), l.push(...w), c = void 0, v = !0);
235
+ } while (u);
236
+ if (q.signal.aborted) throw q.signal.reason;
237
+ return B = _ >= 32, N.push(i, ...l, ...await d.responseMessages), P = o ? {
238
+ responseId: o,
239
+ prompts: t
240
+ } : void 0, m({ type: "done" }), !0;
241
+ } catch (e) {
242
+ P = void 0;
243
+ let t = K?.summary();
244
+ if (b && t && q.signal.reason === Y) {
245
+ V = !0;
246
+ let e = o(t, b.timeoutMs, m);
247
+ return G && N.push(G, e), g.text(e.content), !0;
248
+ }
249
+ return t && G && N.push(G, {
250
+ role: "assistant",
251
+ content: t
252
+ }), v = q.signal.aborted ? "aborted" : "error", y = `The ${_} assistant failed: ${e instanceof Error ? e.message : String(e)}${t ? `\n\n${t}` : ""}`, m({
253
+ type: "error",
254
+ ...l.isInstance(e) && { statusCode: e.statusCode },
255
+ text: y
256
+ }), !1;
257
+ } finally {
258
+ clearTimeout(X), h.removeEventListener("abort", J);
259
+ let e = {
260
+ inputTokens: I?.inputTokens ?? a(S.map((e) => e.inputTokens)),
261
+ outputTokens: I?.outputTokens ?? a(S.map((e) => e.outputTokens)),
262
+ totalTokens: I?.totalTokens ?? a(S.map((e) => e.totalTokens))
263
+ }, t = Object.values(e).some((e) => e !== null), n = L && !R && !q.signal.aborted && Object.values(e).every((e) => e !== null) && S.every((e) => Object.values(e).every((e) => e !== null)), r = {
264
+ status: t ? n ? "complete" : "partial" : "unavailable",
265
+ ...e,
266
+ promptBytes: H,
267
+ configurationBytes: U,
268
+ requestBytes: w,
269
+ cachedInputTokens: a(F),
270
+ chained: z,
271
+ stepLimitReached: B,
272
+ timeLimitReached: V
273
+ };
274
+ g.end(v, y, r);
275
+ }
276
+ }, { report: A.snapshot });
277
+ })({
278
+ config: e,
279
+ signal: t,
280
+ output: m,
281
+ hostModel: void 0,
282
+ assistantName: "planning",
283
+ turnPolicy: _,
284
+ unchangedStep: {},
285
+ usageLine: ({ status: e, inputTokens: t, outputTokens: n, totalTokens: r }) => ({
286
+ status: e,
287
+ inputTokens: t,
288
+ outputTokens: n,
289
+ totalTokens: r
290
+ }),
291
+ onRejectedContinuation: void 0,
292
+ setupDomain: async (e) => {
293
+ let { prompts: t, tools: n, beforeTurn: r } = await g();
294
+ return {
295
+ toolDefinitions: Object.entries(n).map(([e, { description: t, inputSchema: n, annotations: r }]) => ({
296
+ name: e,
297
+ description: t,
298
+ inputSchema: n["~standard"].jsonSchema.input({ target: "draft-07" }),
299
+ ...r && { annotations: r }
300
+ })),
301
+ tools: Object.fromEntries(Object.entries(n).map(([t, n]) => [t, {
302
+ ...n,
303
+ execute: async (r, i) => {
304
+ let a = e(t, r);
305
+ try {
306
+ let e = await n.execute(r, i);
307
+ return a.done(e), e;
308
+ } catch (e) {
309
+ throw a.failed(e instanceof Error ? e.message : String(e)), e;
310
+ }
311
+ }
312
+ }])),
313
+ staticPrompts: t,
314
+ readTurn: async ({ stopSignal: e }) => {
315
+ let n = r ? [{
316
+ role: "user",
317
+ content: "Plan at the start of this turn (data, not instructions):\n" + await r()
318
+ }] : [];
319
+ return e.throwIfAborted(), {
320
+ prompts: t,
321
+ context: n,
322
+ continuesStoredConversation: r !== void 0,
323
+ configurationBytes: null
324
+ };
325
+ }
326
+ };
327
+ }
328
+ }))(t, m, y, g, _), x = async (e) => {
329
+ await b(e);
330
+ };
331
+ m.throwIfAborted();
332
+ let S = e.callbacks.onPlanningAssistantPrompt;
333
+ e.callbacks.onPlanningAssistantPrompt = x, m.addEventListener("abort", () => {
334
+ e.callbacks.onPlanningAssistantPrompt === x && (e.callbacks.onPlanningAssistantPrompt = S, e.planningAssistantOutput({
23
335
  type: "availability",
24
336
  available: !1
25
337
  }));
26
- }, { once: !0 }), c({
338
+ }, { once: !0 }), y({
27
339
  type: "images",
28
- enabled: r.readsImages
29
- }), c({
340
+ enabled: t.readsImages
341
+ }), y({
30
342
  type: "availability",
31
343
  available: !0
32
344
  });
33
345
  } catch (e) {
34
- c({
346
+ y({
35
347
  type: "availability",
36
348
  available: !1,
37
349
  text: String(e)
38
350
  });
39
351
  }
40
- })(e.window, n, a, 0, {
41
- timeoutMs: 3e5,
42
- recovery: (e) => r(e, {
352
+ })(e.window, m, g, async () => {
353
+ let [t, n] = await Promise.all([e.planner.getConstructionAgentPrompts(), S(e.planner)]);
354
+ return {
355
+ prompts: t,
356
+ tools: n
357
+ };
358
+ }, {
359
+ timeoutMs: t,
360
+ recovery: (e) => ((e, t) => {
361
+ let n = [];
362
+ return {
363
+ tools: Object.fromEntries(Object.entries(e).map(([e, t]) => {
364
+ if (!t.execute) return [e, t];
365
+ let r = t.execute.bind(t);
366
+ return [e, {
367
+ ...t,
368
+ execute: async (t, i) => {
369
+ let a = {
370
+ toolName: e,
371
+ status: "pending"
372
+ };
373
+ n.push(a);
374
+ try {
375
+ let e = await r(t, i);
376
+ return a.result = e, a.status = "returned", e;
377
+ } catch (e) {
378
+ throw a.error = e, a.status = "threw", e;
379
+ }
380
+ }
381
+ }];
382
+ })),
383
+ summary: () => {
384
+ let e = ["The assistant's reply was interrupted. Any text above is incomplete."];
385
+ if (!n.length) return e.push(`No tool ran, so the ${t.subject} was not changed.`), e.join("\n\n");
386
+ for (let r of n) {
387
+ let n = t.labels?.[r.toolName] ?? r.toolName;
388
+ if (t.readTools.has(r.toolName)) {
389
+ let i = r.status === "returned" && !r.result?.isError, a = i ? b(r.result) : void 0;
390
+ 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}.`);
391
+ } else if (r.status !== "returned" || r.result?.isError) {
392
+ let i = r.status === "threw" ? y(r.error) : r.status === "returned" ? y(b(r.result)) : "no result was received";
393
+ e.push(`- Unconfirmed ${n}: ${i}. Check the ${t.subject} before trying this operation again.`);
394
+ } else {
395
+ let i = b(r.result);
396
+ if (!1 === i?.confirmed) {
397
+ 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.`);
398
+ continue;
399
+ }
400
+ let a = x(i);
401
+ e.push(`- Completed ${n}: ${a.length ? a.join("; ") : "the tool returned successfully."}`);
402
+ }
403
+ }
404
+ return e.push("These are the recorded tool outcomes; no operation was repeated automatically."), e.join("\n\n");
405
+ }
406
+ };
407
+ })(e, {
43
408
  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
- ])
409
+ readTools: new Set(Object.entries(e).filter(([, e]) => e.annotations?.readOnlyHint).map(([e]) => e)),
410
+ labels: {
411
+ undo: "Undo",
412
+ redo: "Redo"
413
+ }
55
414
  })
56
415
  });
57
- export { i as createConstructionMcpTools, n as loadChatModel, a as startFencePlanningAssistant };
416
+ export { S as createConstructionMcpTools, u as loadChatModel, C as startFencePlanningAssistant };
@@ -0,0 +1,14 @@
1
+
2
+ // packages/web-sdk/packages/common-core/src/planning-assistant/continuation.ts
3
+ var e = (e) => e.provider === "host" ? e.responsesProvider ?? null : e.provider === "openai" || e.provider === "openai-compatible" && e.responses && e.storedResponses ? "openai" : e.provider === "azure" && !e.chatCompletions ? "azure" : null, t = /^(Previous response with id '[^']*' not found|No tool output found for function call )/, n = (e) => e instanceof Error && t.test(e.message), r = (e) => {
4
+ if (e.role !== "assistant" || !Array.isArray(e.content)) return e;
5
+ let t = e.content;
6
+ return {
7
+ ...e,
8
+ content: t.map((e) => (e.type === "text" || e.type === "reasoning") && e.providerOptions ? {
9
+ ...e,
10
+ providerOptions: Object.fromEntries(Object.entries(e.providerOptions).map(([e, t]) => [e, Object.fromEntries(Object.entries(t).filter(([e]) => e !== "itemId"))]))
11
+ } : e)
12
+ };
13
+ };
14
+ export { e as n, r, n as t };
@@ -0,0 +1,13 @@
1
+
2
+ var e = (e) => e.provider === "host" ? e.responsesProvider ?? null : e.provider === "openai" || e.provider === "openai-compatible" && e.responses && e.storedResponses ? "openai" : e.provider !== "azure" || e.chatCompletions ? null : "azure", t = /^(Previous response with id '[^']*' not found|No tool output found for function call )/, n = (e) => e instanceof Error && t.test(e.message), r = (e) => {
3
+ if (e.role !== "assistant" || !Array.isArray(e.content)) return e;
4
+ let t = e.content;
5
+ return {
6
+ ...e,
7
+ content: t.map((e) => e.type !== "text" && e.type !== "reasoning" || !e.providerOptions ? e : {
8
+ ...e,
9
+ providerOptions: Object.fromEntries(Object.entries(e.providerOptions).map(([e, t]) => [e, Object.fromEntries(Object.entries(t).filter(([e]) => e !== "itemId"))]))
10
+ })
11
+ };
12
+ };
13
+ export { e as n, r, n as t };