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