@roomle/embedding-lib 0.0.0-dev-bd4d1d1 → 0.0.0-dev-5e54d0f
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/hi.js
CHANGED
|
@@ -156,7 +156,7 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
156
156
|
otherBytes: n.bytes - i - o
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
|
-
}, D = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, O = 16, k =
|
|
159
|
+
}, D = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, 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 = async ({ provider: e, model: t, apiKey: n, baseUrl: r, chatCompletions: i, reasoningEffort: a }, o) => {
|
|
160
160
|
let s = o ? { fetch: async (e, t) => (typeof t?.body == "string" && await o(t.body), fetch(e, t)) } : {};
|
|
161
161
|
switch (e) {
|
|
162
162
|
case "openai": {
|
|
@@ -164,13 +164,10 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
164
164
|
/* @vite-ignore */
|
|
165
165
|
D("@ai-sdk/openai@4.0.81")
|
|
166
166
|
);
|
|
167
|
-
return {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
})(t),
|
|
172
|
-
providerOptions: { openai: { reasoningSummary: k } }
|
|
173
|
-
};
|
|
167
|
+
return { languageModel: e({
|
|
168
|
+
apiKey: n,
|
|
169
|
+
...s
|
|
170
|
+
})(t) };
|
|
174
171
|
}
|
|
175
172
|
case "azure": {
|
|
176
173
|
let { createAzure: e } = await import(
|
|
@@ -181,15 +178,9 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
181
178
|
baseURL: r,
|
|
182
179
|
...s
|
|
183
180
|
});
|
|
184
|
-
return
|
|
185
|
-
languageModel: o.chat(t),
|
|
181
|
+
return {
|
|
182
|
+
languageModel: i ? o.chat(t) : o(t),
|
|
186
183
|
providerOptions: a ? { azure: { reasoningEffort: a } } : void 0
|
|
187
|
-
} : {
|
|
188
|
-
languageModel: o(t),
|
|
189
|
-
providerOptions: { azure: {
|
|
190
|
-
reasoningSummary: k,
|
|
191
|
-
...a && { reasoningEffort: a }
|
|
192
|
-
} }
|
|
193
184
|
};
|
|
194
185
|
}
|
|
195
186
|
case "mistral": {
|
|
@@ -225,7 +216,7 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
225
216
|
}
|
|
226
217
|
default: throw Error(`Unknown provider "${e}" - supported: azure, openai, mistral, anthropic, google`);
|
|
227
218
|
}
|
|
228
|
-
},
|
|
219
|
+
}, M = async (e, t, n) => {
|
|
229
220
|
let r = e.extended, i = (e) => r.planningAssistantOutput(e), a = [], o = null, s = /* @__PURE__ */ new Set(), c;
|
|
230
221
|
try {
|
|
231
222
|
c = await Promise.all([
|
|
@@ -233,7 +224,7 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
233
224
|
/* @vite-ignore */
|
|
234
225
|
D("ai@7.0.122")
|
|
235
226
|
),
|
|
236
|
-
|
|
227
|
+
j(t, async (e) => {
|
|
237
228
|
a.push({
|
|
238
229
|
...await E(e, s),
|
|
239
230
|
stepNumber: o
|
|
@@ -254,7 +245,7 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
254
245
|
r.callbacks.onPlanningAssistantPrompt = async ({ text: e, images: r }) => {
|
|
255
246
|
let c = performance.now();
|
|
256
247
|
a = [], o = null, s.clear();
|
|
257
|
-
let _ = [], v = [], y = null, b = [], E, D = !1, k = !1, j = null,
|
|
248
|
+
let _ = [], v = [], y = null, b = [], E, D = !1, k = !1, j = null, M = 0, N = {
|
|
258
249
|
role: "user",
|
|
259
250
|
content: [{
|
|
260
251
|
type: "text",
|
|
@@ -286,11 +277,11 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
286
277
|
j = await T(JSON.stringify({
|
|
287
278
|
instructions: m,
|
|
288
279
|
messages: r
|
|
289
|
-
})),
|
|
280
|
+
})), M = performance.now() - e;
|
|
290
281
|
let a = [
|
|
291
282
|
...r,
|
|
292
283
|
...h,
|
|
293
|
-
|
|
284
|
+
N
|
|
294
285
|
], s = [], f = 0, S;
|
|
295
286
|
do {
|
|
296
287
|
S = void 0;
|
|
@@ -336,13 +327,7 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
336
327
|
} }
|
|
337
328
|
};
|
|
338
329
|
}
|
|
339
|
-
})
|
|
340
|
-
let e = A(N);
|
|
341
|
-
!F && e && (F = !0, i({
|
|
342
|
-
type: "activity",
|
|
343
|
-
text: e
|
|
344
|
-
}));
|
|
345
|
-
};
|
|
330
|
+
});
|
|
346
331
|
for await (let e of T.stream) if (e.type === "text-delta") y ??= performance.now() - c, i({
|
|
347
332
|
type: "text",
|
|
348
333
|
text: e.text
|
|
@@ -351,17 +336,14 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
351
336
|
type: "activity",
|
|
352
337
|
text: e.toolName
|
|
353
338
|
});
|
|
354
|
-
else if (e.type === "reasoning-start") N = "", F = !1;
|
|
355
|
-
else if (e.type === "reasoning-delta") N += e.text, N.includes("\n") && I();
|
|
356
|
-
else if (e.type === "reasoning-end") I();
|
|
357
339
|
else if (e.type === "error") {
|
|
358
|
-
if (w.length > 0 &&
|
|
340
|
+
if (w.length > 0 && A(e.error)) {
|
|
359
341
|
S = e.error;
|
|
360
342
|
break;
|
|
361
343
|
}
|
|
362
344
|
throw e.error;
|
|
363
345
|
} else e.type === "finish-step" ? (b.push(x(e.usage)), _.push(C(e.usage))) : e.type === "finish" ? (E = s.length ? void 0 : x(e.totalUsage), D = !0) : e.type === "abort" && (k = !0);
|
|
364
|
-
S ? (console.log(`[planning-assistant] continuation rejected (${S.message}) - continuing with the whole history`), s.push(...w)) : !k && !n.aborted && h.push(
|
|
346
|
+
S ? (console.log(`[planning-assistant] continuation rejected (${S.message}) - continuing with the whole history`), s.push(...w)) : !k && !n.aborted && h.push(N, ...s, ...await T.responseMessages);
|
|
365
347
|
} while (S);
|
|
366
348
|
i({ type: "done" });
|
|
367
349
|
} catch (e) {
|
|
@@ -386,7 +368,7 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
386
368
|
modelCalls: v,
|
|
387
369
|
requests: a,
|
|
388
370
|
reference: j,
|
|
389
|
-
referenceAcquisitionMs:
|
|
371
|
+
referenceAcquisitionMs: M,
|
|
390
372
|
firstTextMs: y,
|
|
391
373
|
turnMs: performance.now() - c
|
|
392
374
|
}
|
|
@@ -399,10 +381,10 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
399
381
|
type: "availability",
|
|
400
382
|
available: !0
|
|
401
383
|
});
|
|
402
|
-
},
|
|
384
|
+
}, N = {
|
|
403
385
|
HIDE: "hide",
|
|
404
386
|
SHOW_ATTRIBUTES: "attributes",
|
|
405
387
|
SHOW_ARTICLES: "articles"
|
|
406
388
|
};
|
|
407
389
|
//#endregion
|
|
408
|
-
export {
|
|
390
|
+
export { N as HI_PANEL_ACTION, _ as cleanupHi, d as createHiLibraryCallbacks, y as createHiMcpTools, c as libLoadArticleCatalog, u as libLoadCalcScript, l as libLoadMasterData, j as loadChatModel, p as omGetRequest, f as omPostRequest, a as registerLegacyUrlFormat, g as setupHi, M as startPlanningAssistant, o as unregisterLegacyUrlFormat };
|
package/hi.min.js
CHANGED
|
@@ -144,18 +144,15 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
144
144
|
otherBytes: n.bytes - i - o
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
|
-
}, T = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, E =
|
|
147
|
+
}, T = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, E = /^(Previous response with id '[^']*' not found|No tool output found for function call )/, D = (e) => e instanceof Error && E.test(e.message), O = async ({ provider: e, model: t, apiKey: n, baseUrl: r, chatCompletions: i, reasoningEffort: a }, o) => {
|
|
148
148
|
let s = o ? { fetch: async (e, t) => (typeof t?.body == "string" && await o(t.body), fetch(e, t)) } : {};
|
|
149
149
|
switch (e) {
|
|
150
150
|
case "openai": {
|
|
151
151
|
let { createOpenAI: e } = await import(T("@ai-sdk/openai@4.0.81"));
|
|
152
|
-
return {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
})(t),
|
|
157
|
-
providerOptions: { openai: { reasoningSummary: E } }
|
|
158
|
-
};
|
|
152
|
+
return { languageModel: e({
|
|
153
|
+
apiKey: n,
|
|
154
|
+
...s
|
|
155
|
+
})(t) };
|
|
159
156
|
}
|
|
160
157
|
case "azure": {
|
|
161
158
|
let { createAzure: e } = await import(T("@ai-sdk/azure@4.0.85")), o = e({
|
|
@@ -163,15 +160,9 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
163
160
|
baseURL: r,
|
|
164
161
|
...s
|
|
165
162
|
});
|
|
166
|
-
return
|
|
167
|
-
languageModel: o.chat(t),
|
|
163
|
+
return {
|
|
164
|
+
languageModel: i ? o.chat(t) : o(t),
|
|
168
165
|
providerOptions: a ? { azure: { reasoningEffort: a } } : void 0
|
|
169
|
-
} : {
|
|
170
|
-
languageModel: o(t),
|
|
171
|
-
providerOptions: { azure: {
|
|
172
|
-
reasoningSummary: E,
|
|
173
|
-
...a && { reasoningEffort: a }
|
|
174
|
-
} }
|
|
175
166
|
};
|
|
176
167
|
}
|
|
177
168
|
case "mistral": {
|
|
@@ -198,12 +189,12 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
198
189
|
}
|
|
199
190
|
default: throw Error(`Unknown provider "${e}" - supported: azure, openai, mistral, anthropic, google`);
|
|
200
191
|
}
|
|
201
|
-
},
|
|
192
|
+
}, k = async (e, t, n) => {
|
|
202
193
|
let r = e.extended, i = (e) => r.planningAssistantOutput(e), a = [], o = null, s = /* @__PURE__ */ new Set(), c;
|
|
203
194
|
try {
|
|
204
195
|
c = await Promise.all([
|
|
205
196
|
import(T("ai@7.0.122")),
|
|
206
|
-
|
|
197
|
+
O(t, async (e) => {
|
|
207
198
|
a.push({
|
|
208
199
|
...await w(e, s),
|
|
209
200
|
stepNumber: o
|
|
@@ -224,7 +215,7 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
224
215
|
r.callbacks.onPlanningAssistantPrompt = async ({ text: e, images: r }) => {
|
|
225
216
|
let c = performance.now();
|
|
226
217
|
a = [], o = null, s.clear();
|
|
227
|
-
let _ = [], v = [], y = null, w = [], T, E = !1,
|
|
218
|
+
let _ = [], v = [], y = null, w = [], T, E = !1, O = !1, k = null, A = {
|
|
228
219
|
role: "user",
|
|
229
220
|
content: [{
|
|
230
221
|
type: "text",
|
|
@@ -304,13 +295,7 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
304
295
|
} }
|
|
305
296
|
};
|
|
306
297
|
}
|
|
307
|
-
})
|
|
308
|
-
let e = M.split("\n")[0].replace(/\*\*|__|^#+\s*/g, "").trim().slice(0, 120);
|
|
309
|
-
!N && e && (N = !0, i({
|
|
310
|
-
type: "activity",
|
|
311
|
-
text: e
|
|
312
|
-
}));
|
|
313
|
-
};
|
|
298
|
+
});
|
|
314
299
|
for await (let e of j.stream) if (e.type === "text-delta") y ??= performance.now() - c, i({
|
|
315
300
|
type: "text",
|
|
316
301
|
text: e.text
|
|
@@ -319,20 +304,17 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
319
304
|
type: "activity",
|
|
320
305
|
text: e.toolName
|
|
321
306
|
});
|
|
322
|
-
else if (e.type === "reasoning-start") M = "", N = !1;
|
|
323
|
-
else if (e.type === "reasoning-delta") M += e.text, M.includes("\n") && P();
|
|
324
|
-
else if (e.type === "reasoning-end") P();
|
|
325
307
|
else {
|
|
326
308
|
if (e.type === "error") {
|
|
327
|
-
if (C.length > 0 &&
|
|
309
|
+
if (C.length > 0 && D(e.error)) {
|
|
328
310
|
f = e.error;
|
|
329
311
|
break;
|
|
330
312
|
}
|
|
331
313
|
throw e.error;
|
|
332
314
|
}
|
|
333
|
-
e.type === "finish-step" ? (w.push(b(e.usage)), _.push(S(e.usage))) : e.type === "finish" ? (T = s.length ? void 0 : b(e.totalUsage), E = !0) : e.type === "abort" && (
|
|
315
|
+
e.type === "finish-step" ? (w.push(b(e.usage)), _.push(S(e.usage))) : e.type === "finish" ? (T = s.length ? void 0 : b(e.totalUsage), E = !0) : e.type === "abort" && (O = !0);
|
|
334
316
|
}
|
|
335
|
-
f ? s.push(...C) :
|
|
317
|
+
f ? s.push(...C) : O || n.aborted || h.push(A, ...s, ...await j.responseMessages);
|
|
336
318
|
} while (f);
|
|
337
319
|
i({ type: "done" });
|
|
338
320
|
} catch (e) {
|
|
@@ -346,7 +328,7 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
346
328
|
outputTokens: T?.outputTokens ?? x(w.map((e) => e.outputTokens)),
|
|
347
329
|
totalTokens: T?.totalTokens ?? x(w.map((e) => e.totalTokens))
|
|
348
330
|
};
|
|
349
|
-
Object.values(e).some((e) => e !== null), E && !
|
|
331
|
+
Object.values(e).some((e) => e !== null), E && !O && !n.aborted && Object.values(e).every((e) => e !== null) && w.every((e) => Object.values(e).every((e) => e !== null));
|
|
350
332
|
}
|
|
351
333
|
}, i({
|
|
352
334
|
type: "images",
|
|
@@ -355,9 +337,9 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
355
337
|
type: "availability",
|
|
356
338
|
available: !0
|
|
357
339
|
});
|
|
358
|
-
},
|
|
340
|
+
}, A = {
|
|
359
341
|
HIDE: "hide",
|
|
360
342
|
SHOW_ATTRIBUTES: "attributes",
|
|
361
343
|
SHOW_ARTICLES: "articles"
|
|
362
344
|
};
|
|
363
|
-
export {
|
|
345
|
+
export { A as HI_PANEL_ACTION, g as cleanupHi, d as createHiLibraryCallbacks, v as createHiMcpTools, c as libLoadArticleCatalog, u as libLoadCalcScript, l as libLoadMasterData, O as loadChatModel, p as omGetRequest, f as omPostRequest, a as registerLegacyUrlFormat, h as setupHi, k 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-
|
|
3
|
+
"version": "0.0.0-dev-5e54d0f",
|
|
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",
|
|
@@ -42,32 +42,14 @@ export type PlanningAssistantPlannerApi = HiMcpPlannerApi & {
|
|
|
42
42
|
/** The AI SDK language model of the config and the provider options `streamText` takes with it. */
|
|
43
43
|
export declare const loadChatModel: ({ provider, model, apiKey, baseUrl, chatCompletions, reasoningEffort, }: PlanningAssistantConfig, observeRequest?: (body: string) => Promise<void>) => Promise<{
|
|
44
44
|
languageModel: any;
|
|
45
|
-
providerOptions
|
|
46
|
-
openai: {
|
|
47
|
-
reasoningSummary: string;
|
|
48
|
-
};
|
|
49
|
-
azure?: undefined;
|
|
50
|
-
};
|
|
51
|
-
} | {
|
|
52
|
-
languageModel: any;
|
|
53
|
-
providerOptions: {
|
|
54
|
-
azure: {
|
|
55
|
-
reasoningEffort: string;
|
|
56
|
-
};
|
|
57
|
-
openai?: undefined;
|
|
58
|
-
};
|
|
45
|
+
providerOptions?: undefined;
|
|
59
46
|
} | {
|
|
60
47
|
languageModel: any;
|
|
61
48
|
providerOptions: {
|
|
62
49
|
azure: {
|
|
63
50
|
reasoningEffort: string;
|
|
64
|
-
reasoningSummary: string;
|
|
65
51
|
};
|
|
66
|
-
openai?: undefined;
|
|
67
52
|
};
|
|
68
|
-
} | {
|
|
69
|
-
languageModel: any;
|
|
70
|
-
providerOptions?: undefined;
|
|
71
53
|
}>;
|
|
72
54
|
/**
|
|
73
55
|
* Runs the planning agent of the AI Planning Assistant window
|