@boldvideo/bold-js 1.9.0 → 1.10.0
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/CHANGELOG.md +11 -0
- package/dist/index.cjs +3 -2
- package/dist/index.d.ts +21 -0
- package/dist/index.js +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @boldvideo/bold-js
|
|
2
2
|
|
|
3
|
+
## 1.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a9402d1: Add missing SSE event types and fix streaming termination
|
|
8
|
+
|
|
9
|
+
- Add `token`, `answer`, and `complete` event types to the `AIEvent` type union
|
|
10
|
+
- Add `AnswerMetadata` interface for answer event metadata
|
|
11
|
+
- Fix AsyncIterable not signaling completion: now terminates on `complete` event in addition to `message_complete` and `error`
|
|
12
|
+
- Add error logging for malformed SSE JSON to aid debugging
|
|
13
|
+
|
|
3
14
|
## 1.9.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -269,11 +269,12 @@ async function* parseSSE(response) {
|
|
|
269
269
|
const raw = JSON.parse(json);
|
|
270
270
|
const event = camelizeKeys(raw);
|
|
271
271
|
yield event;
|
|
272
|
-
if (event.type === "message_complete" || event.type === "error") {
|
|
272
|
+
if (event.type === "message_complete" || event.type === "complete" || event.type === "error") {
|
|
273
273
|
await reader.cancel();
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
276
|
-
} catch {
|
|
276
|
+
} catch (err) {
|
|
277
|
+
console.error("[bold-js] Failed to parse SSE JSON:", json, err);
|
|
277
278
|
}
|
|
278
279
|
}
|
|
279
280
|
if (done)
|
package/dist/index.d.ts
CHANGED
|
@@ -198,6 +198,14 @@ interface AIUsage {
|
|
|
198
198
|
inputTokens: number;
|
|
199
199
|
outputTokens: number;
|
|
200
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Metadata included with answer events
|
|
203
|
+
*/
|
|
204
|
+
interface AnswerMetadata {
|
|
205
|
+
topScore: number;
|
|
206
|
+
chunksFound: number;
|
|
207
|
+
videosSearched: number;
|
|
208
|
+
}
|
|
201
209
|
/**
|
|
202
210
|
* SSE event types for AI streaming responses
|
|
203
211
|
*/
|
|
@@ -211,6 +219,9 @@ type AIEvent = {
|
|
|
211
219
|
} | {
|
|
212
220
|
type: "text_delta";
|
|
213
221
|
delta: string;
|
|
222
|
+
} | {
|
|
223
|
+
type: "token";
|
|
224
|
+
content: string;
|
|
214
225
|
} | {
|
|
215
226
|
type: "clarification";
|
|
216
227
|
content: string;
|
|
@@ -218,6 +229,14 @@ type AIEvent = {
|
|
|
218
229
|
} | {
|
|
219
230
|
type: "recommendations";
|
|
220
231
|
recommendations: Recommendation[];
|
|
232
|
+
} | {
|
|
233
|
+
type: "answer";
|
|
234
|
+
content: string;
|
|
235
|
+
metadata: AnswerMetadata;
|
|
236
|
+
usage?: AIUsage;
|
|
237
|
+
confidence?: string;
|
|
238
|
+
responseStrategy?: string;
|
|
239
|
+
citations?: Source[];
|
|
221
240
|
} | {
|
|
222
241
|
type: "message_complete";
|
|
223
242
|
conversationId?: string;
|
|
@@ -227,6 +246,8 @@ type AIEvent = {
|
|
|
227
246
|
context?: AIContextMessage[];
|
|
228
247
|
recommendations?: Recommendation[];
|
|
229
248
|
guidance?: string;
|
|
249
|
+
} | {
|
|
250
|
+
type: "complete";
|
|
230
251
|
} | {
|
|
231
252
|
type: "error";
|
|
232
253
|
code: string;
|
package/dist/index.js
CHANGED
|
@@ -231,11 +231,12 @@ async function* parseSSE(response) {
|
|
|
231
231
|
const raw = JSON.parse(json);
|
|
232
232
|
const event = camelizeKeys(raw);
|
|
233
233
|
yield event;
|
|
234
|
-
if (event.type === "message_complete" || event.type === "error") {
|
|
234
|
+
if (event.type === "message_complete" || event.type === "complete" || event.type === "error") {
|
|
235
235
|
await reader.cancel();
|
|
236
236
|
return;
|
|
237
237
|
}
|
|
238
|
-
} catch {
|
|
238
|
+
} catch (err) {
|
|
239
|
+
console.error("[bold-js] Failed to parse SSE JSON:", json, err);
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
242
|
if (done)
|