@eidentic/server 0.2.2 → 0.2.3
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/dist/index.cjs +9 -4
- package/dist/index.js +9 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1317,6 +1317,7 @@ function toUIMessageStream(events) {
|
|
|
1317
1317
|
writer.write({ type: "start-step" });
|
|
1318
1318
|
let textBlockOpen = false;
|
|
1319
1319
|
let textBlockId = "text-0";
|
|
1320
|
+
let streamedText = false;
|
|
1320
1321
|
function openTextBlock(id) {
|
|
1321
1322
|
if (!textBlockOpen) {
|
|
1322
1323
|
textBlockId = id;
|
|
@@ -1336,6 +1337,7 @@ function toUIMessageStream(events) {
|
|
|
1336
1337
|
// Streaming token delta — primary hot path for live text streaming
|
|
1337
1338
|
// ------------------------------------------------------------------
|
|
1338
1339
|
case "stream.delta": {
|
|
1340
|
+
streamedText = true;
|
|
1339
1341
|
openTextBlock("streaming-text");
|
|
1340
1342
|
writer.write({ type: "text-delta", delta: ev.delta.text, id: textBlockId });
|
|
1341
1343
|
break;
|
|
@@ -1347,10 +1349,12 @@ function toUIMessageStream(events) {
|
|
|
1347
1349
|
closeTextBlock();
|
|
1348
1350
|
for (const block of ev.content) {
|
|
1349
1351
|
if (block.type === "text") {
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1352
|
+
if (!streamedText) {
|
|
1353
|
+
const id = `text-${crypto.randomUUID()}`;
|
|
1354
|
+
writer.write({ type: "text-start", id });
|
|
1355
|
+
writer.write({ type: "text-delta", delta: block.text, id });
|
|
1356
|
+
writer.write({ type: "text-end", id });
|
|
1357
|
+
}
|
|
1354
1358
|
} else if (block.type === "tool_use") {
|
|
1355
1359
|
writer.write({
|
|
1356
1360
|
type: "tool-input-available",
|
|
@@ -1360,6 +1364,7 @@ function toUIMessageStream(events) {
|
|
|
1360
1364
|
});
|
|
1361
1365
|
}
|
|
1362
1366
|
}
|
|
1367
|
+
streamedText = false;
|
|
1363
1368
|
break;
|
|
1364
1369
|
}
|
|
1365
1370
|
// ------------------------------------------------------------------
|
package/dist/index.js
CHANGED
|
@@ -239,6 +239,7 @@ function toUIMessageStream(events) {
|
|
|
239
239
|
writer.write({ type: "start-step" });
|
|
240
240
|
let textBlockOpen = false;
|
|
241
241
|
let textBlockId = "text-0";
|
|
242
|
+
let streamedText = false;
|
|
242
243
|
function openTextBlock(id) {
|
|
243
244
|
if (!textBlockOpen) {
|
|
244
245
|
textBlockId = id;
|
|
@@ -258,6 +259,7 @@ function toUIMessageStream(events) {
|
|
|
258
259
|
// Streaming token delta — primary hot path for live text streaming
|
|
259
260
|
// ------------------------------------------------------------------
|
|
260
261
|
case "stream.delta": {
|
|
262
|
+
streamedText = true;
|
|
261
263
|
openTextBlock("streaming-text");
|
|
262
264
|
writer.write({ type: "text-delta", delta: ev.delta.text, id: textBlockId });
|
|
263
265
|
break;
|
|
@@ -269,10 +271,12 @@ function toUIMessageStream(events) {
|
|
|
269
271
|
closeTextBlock();
|
|
270
272
|
for (const block of ev.content) {
|
|
271
273
|
if (block.type === "text") {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
274
|
+
if (!streamedText) {
|
|
275
|
+
const id = `text-${crypto.randomUUID()}`;
|
|
276
|
+
writer.write({ type: "text-start", id });
|
|
277
|
+
writer.write({ type: "text-delta", delta: block.text, id });
|
|
278
|
+
writer.write({ type: "text-end", id });
|
|
279
|
+
}
|
|
276
280
|
} else if (block.type === "tool_use") {
|
|
277
281
|
writer.write({
|
|
278
282
|
type: "tool-input-available",
|
|
@@ -282,6 +286,7 @@ function toUIMessageStream(events) {
|
|
|
282
286
|
});
|
|
283
287
|
}
|
|
284
288
|
}
|
|
289
|
+
streamedText = false;
|
|
285
290
|
break;
|
|
286
291
|
}
|
|
287
292
|
// ------------------------------------------------------------------
|