@roomle/embedding-lib 0.0.0-dev-a95b24e → 0.0.0-dev-c1bdbb4
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 +27 -10
- package/hi.min.js +23 -9
- package/package.json +1 -1
- package/roomle-embedding-lib.js +2 -0
- package/roomle-embedding-lib.min.js +2 -0
package/hi.js
CHANGED
|
@@ -105,7 +105,11 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
105
105
|
toModelOutput: v
|
|
106
106
|
}];
|
|
107
107
|
}));
|
|
108
|
-
}, b = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, x = 16, S =
|
|
108
|
+
}, b = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, x = 16, S = (e = {}) => ({
|
|
109
|
+
inputTokens: e.inputTokens ?? null,
|
|
110
|
+
outputTokens: e.outputTokens ?? null,
|
|
111
|
+
totalTokens: e.totalTokens ?? (e.inputTokens !== void 0 && e.outputTokens !== void 0 ? e.inputTokens + e.outputTokens : null)
|
|
112
|
+
}), C = (e) => e.some((e) => e !== null) ? e.reduce((e, t) => e + (t ?? 0), 0) : null, w = async ({ provider: e, model: t, apiKey: n, baseUrl: r, chatCompletions: i, reasoningEffort: a }) => {
|
|
109
113
|
switch (e) {
|
|
110
114
|
case "azure": {
|
|
111
115
|
let { createAzure: e } = await import(
|
|
@@ -146,7 +150,7 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
146
150
|
}
|
|
147
151
|
default: throw Error(`Unknown provider "${e}" - supported: azure, mistral, anthropic, google`);
|
|
148
152
|
}
|
|
149
|
-
},
|
|
153
|
+
}, T = async (e, t, n) => {
|
|
150
154
|
let r = e.extended, i = (e) => r.planningAssistantOutput(e), a;
|
|
151
155
|
try {
|
|
152
156
|
a = await Promise.all([
|
|
@@ -154,7 +158,7 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
154
158
|
/* @vite-ignore */
|
|
155
159
|
b("ai@7.0.122")
|
|
156
160
|
),
|
|
157
|
-
|
|
161
|
+
w(t),
|
|
158
162
|
r.getExternalObjectAgentPrompts(),
|
|
159
163
|
y(e)
|
|
160
164
|
]);
|
|
@@ -167,13 +171,13 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
167
171
|
return;
|
|
168
172
|
}
|
|
169
173
|
let [{ streamText: o, stepCountIs: s }, c, l, u] = a, d = [];
|
|
170
|
-
r.callbacks.onPlanningAssistantPrompt = async ({ text: e, images:
|
|
171
|
-
let
|
|
174
|
+
r.callbacks.onPlanningAssistantPrompt = async ({ text: e, images: r }) => {
|
|
175
|
+
let a = [], f, p = !1, m = {
|
|
172
176
|
role: "user",
|
|
173
177
|
content: [{
|
|
174
178
|
type: "text",
|
|
175
179
|
text: e || l.imagePrompt
|
|
176
|
-
}, ...
|
|
180
|
+
}, ...r.map((e) => ({
|
|
177
181
|
type: "file",
|
|
178
182
|
data: e,
|
|
179
183
|
mediaType: "image/jpeg"
|
|
@@ -184,7 +188,7 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
184
188
|
model: c.languageModel,
|
|
185
189
|
providerOptions: c.providerOptions,
|
|
186
190
|
instructions: l.systemPrompt,
|
|
187
|
-
messages: [...d,
|
|
191
|
+
messages: [...d, m],
|
|
188
192
|
tools: u,
|
|
189
193
|
stopWhen: s(x),
|
|
190
194
|
abortSignal: n,
|
|
@@ -199,12 +203,25 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
199
203
|
text: t.toolName
|
|
200
204
|
});
|
|
201
205
|
else if (t.type === "error") throw t.error;
|
|
202
|
-
|
|
206
|
+
else t.type === "finish-step" ? a.push(S(t.usage)) : t.type === "finish" ? f = S(t.totalUsage) : t.type === "abort" && (p = !0);
|
|
207
|
+
d.push(m, ...await e.responseMessages), i({ type: "done" });
|
|
203
208
|
} catch (e) {
|
|
204
209
|
console.log("[planning-assistant]", String(e)), i({
|
|
205
210
|
type: "error",
|
|
206
211
|
text: `The planning assistant failed: ${e instanceof Error ? e.message : String(e)}`
|
|
207
212
|
});
|
|
213
|
+
} finally {
|
|
214
|
+
let e = {
|
|
215
|
+
inputTokens: f?.inputTokens ?? C(a.map((e) => e.inputTokens)),
|
|
216
|
+
outputTokens: f?.outputTokens ?? C(a.map((e) => e.outputTokens)),
|
|
217
|
+
totalTokens: f?.totalTokens ?? C(a.map((e) => e.totalTokens))
|
|
218
|
+
}, r = Object.values(e).some((e) => e !== null), i = f && !p && !n.aborted && Object.values(e).every((e) => e !== null) && a.every((e) => Object.values(e).every((e) => e !== null));
|
|
219
|
+
console.log(`[planning-assistant] usage ${JSON.stringify({
|
|
220
|
+
provider: t.provider,
|
|
221
|
+
model: t.model,
|
|
222
|
+
status: r ? i ? "complete" : "partial" : "unavailable",
|
|
223
|
+
...e
|
|
224
|
+
})}`);
|
|
208
225
|
}
|
|
209
226
|
}, i({
|
|
210
227
|
type: "images",
|
|
@@ -213,10 +230,10 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
213
230
|
type: "availability",
|
|
214
231
|
available: !0
|
|
215
232
|
});
|
|
216
|
-
},
|
|
233
|
+
}, E = {
|
|
217
234
|
HIDE: "hide",
|
|
218
235
|
SHOW_ATTRIBUTES: "attributes",
|
|
219
236
|
SHOW_ARTICLES: "articles"
|
|
220
237
|
};
|
|
221
238
|
//#endregion
|
|
222
|
-
export {
|
|
239
|
+
export { E as HI_PANEL_ACTION, _ as cleanupHi, d as createHiLibraryCallbacks, y as createHiMcpTools, c as libLoadArticleCatalog, u as libLoadCalcScript, l as libLoadMasterData, w as loadChatModel, p as omGetRequest, f as omPostRequest, a as registerLegacyUrlFormat, g as setupHi, T as startPlanningAssistant, o as unregisterLegacyUrlFormat };
|
package/hi.min.js
CHANGED
|
@@ -106,7 +106,11 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
106
106
|
toModelOutput: _
|
|
107
107
|
}];
|
|
108
108
|
}));
|
|
109
|
-
}, y = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, b =
|
|
109
|
+
}, y = (e) => `https://esm.sh/${e}?deps=zod@4.6.5`, b = (e = {}) => ({
|
|
110
|
+
inputTokens: e.inputTokens ?? null,
|
|
111
|
+
outputTokens: e.outputTokens ?? null,
|
|
112
|
+
totalTokens: e.totalTokens ?? (e.inputTokens !== void 0 && e.outputTokens !== void 0 ? e.inputTokens + e.outputTokens : null)
|
|
113
|
+
}), x = (e) => e.some((e) => e !== null) ? e.reduce((e, t) => e + (t ?? 0), 0) : null, S = async ({ provider: e, model: t, apiKey: n, baseUrl: r, chatCompletions: i, reasoningEffort: a }) => {
|
|
110
114
|
switch (e) {
|
|
111
115
|
case "azure": {
|
|
112
116
|
let { createAzure: e } = await import(y("@ai-sdk/azure@4.0.85")), o = e({
|
|
@@ -135,12 +139,12 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
135
139
|
}
|
|
136
140
|
default: throw Error(`Unknown provider "${e}" - supported: azure, mistral, anthropic, google`);
|
|
137
141
|
}
|
|
138
|
-
},
|
|
142
|
+
}, C = async (e, t, n) => {
|
|
139
143
|
let r = e.extended, i = (e) => r.planningAssistantOutput(e), a;
|
|
140
144
|
try {
|
|
141
145
|
a = await Promise.all([
|
|
142
146
|
import(y("ai@7.0.122")),
|
|
143
|
-
|
|
147
|
+
S(t),
|
|
144
148
|
r.getExternalObjectAgentPrompts(),
|
|
145
149
|
v(e)
|
|
146
150
|
]);
|
|
@@ -154,7 +158,7 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
154
158
|
}
|
|
155
159
|
let [{ streamText: o, stepCountIs: s }, c, l, u] = a, d = [];
|
|
156
160
|
r.callbacks.onPlanningAssistantPrompt = async ({ text: e, images: t }) => {
|
|
157
|
-
let r = {
|
|
161
|
+
let r = [], a, f = !1, p = {
|
|
158
162
|
role: "user",
|
|
159
163
|
content: [{
|
|
160
164
|
type: "text",
|
|
@@ -170,7 +174,7 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
170
174
|
model: c.languageModel,
|
|
171
175
|
providerOptions: c.providerOptions,
|
|
172
176
|
instructions: l.systemPrompt,
|
|
173
|
-
messages: [...d,
|
|
177
|
+
messages: [...d, p],
|
|
174
178
|
tools: u,
|
|
175
179
|
stopWhen: s(16),
|
|
176
180
|
abortSignal: n,
|
|
@@ -184,13 +188,23 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
184
188
|
type: "activity",
|
|
185
189
|
text: t.toolName
|
|
186
190
|
});
|
|
187
|
-
else
|
|
188
|
-
|
|
191
|
+
else {
|
|
192
|
+
if (t.type === "error") throw t.error;
|
|
193
|
+
t.type === "finish-step" ? r.push(b(t.usage)) : t.type === "finish" ? a = b(t.totalUsage) : t.type === "abort" && (f = !0);
|
|
194
|
+
}
|
|
195
|
+
d.push(p, ...await e.responseMessages), i({ type: "done" });
|
|
189
196
|
} catch (e) {
|
|
190
197
|
i({
|
|
191
198
|
type: "error",
|
|
192
199
|
text: `The planning assistant failed: ${e instanceof Error ? e.message : String(e)}`
|
|
193
200
|
});
|
|
201
|
+
} finally {
|
|
202
|
+
let e = {
|
|
203
|
+
inputTokens: a?.inputTokens ?? x(r.map((e) => e.inputTokens)),
|
|
204
|
+
outputTokens: a?.outputTokens ?? x(r.map((e) => e.outputTokens)),
|
|
205
|
+
totalTokens: a?.totalTokens ?? x(r.map((e) => e.totalTokens))
|
|
206
|
+
};
|
|
207
|
+
Object.values(e).some((e) => e !== null), a && !f && !n.aborted && Object.values(e).every((e) => e !== null) && r.every((e) => Object.values(e).every((e) => e !== null));
|
|
194
208
|
}
|
|
195
209
|
}, i({
|
|
196
210
|
type: "images",
|
|
@@ -199,9 +213,9 @@ var n = (e, t) => t === e.libraryId ? e : {
|
|
|
199
213
|
type: "availability",
|
|
200
214
|
available: !0
|
|
201
215
|
});
|
|
202
|
-
},
|
|
216
|
+
}, w = {
|
|
203
217
|
HIDE: "hide",
|
|
204
218
|
SHOW_ATTRIBUTES: "attributes",
|
|
205
219
|
SHOW_ARTICLES: "articles"
|
|
206
220
|
};
|
|
207
|
-
export {
|
|
221
|
+
export { w as HI_PANEL_ACTION, g as cleanupHi, d as createHiLibraryCallbacks, v as createHiMcpTools, c as libLoadArticleCatalog, u as libLoadCalcScript, l as libLoadMasterData, S as loadChatModel, p as omGetRequest, f as omPostRequest, a as registerLegacyUrlFormat, h as setupHi, C 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-c1bdbb4",
|
|
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",
|
package/roomle-embedding-lib.js
CHANGED