@sandagent/runner-cli 0.2.20 → 0.2.21
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/bundle.mjs +18 -2
- package/package.json +1 -1
package/dist/bundle.mjs
CHANGED
|
@@ -256,6 +256,13 @@ var AISDKStreamConverter = class {
|
|
|
256
256
|
}
|
|
257
257
|
throw new Error("Part ID not found");
|
|
258
258
|
}
|
|
259
|
+
/** Returns part ID for index or undefined if not tracked (e.g. content_block_stop without a prior start). */
|
|
260
|
+
tryGetPartId(index) {
|
|
261
|
+
if (!this.sessionId)
|
|
262
|
+
return void 0;
|
|
263
|
+
const partIdKey = `${this.sessionId}-${index}`;
|
|
264
|
+
return this.partIdMap.get(partIdKey);
|
|
265
|
+
}
|
|
259
266
|
/**
|
|
260
267
|
* Helper to emit tool call
|
|
261
268
|
*/
|
|
@@ -296,9 +303,18 @@ var AISDKStreamConverter = class {
|
|
|
296
303
|
delta: event.delta.text
|
|
297
304
|
});
|
|
298
305
|
}
|
|
306
|
+
if (event.type === "content_block_start" && event.content_block.type === "thinking") {
|
|
307
|
+
const partId = `reasoning_${generateId()}`;
|
|
308
|
+
this.setPartId(event.index, partId);
|
|
309
|
+
}
|
|
310
|
+
if (event.type === "content_block_delta" && event.delta?.type === "thinking_delta") {
|
|
311
|
+
if (event.delta.thinking) {
|
|
312
|
+
yield this.emit({ type: "reasoning", text: event.delta.thinking });
|
|
313
|
+
}
|
|
314
|
+
}
|
|
299
315
|
if (event.type === "content_block_stop") {
|
|
300
|
-
const partId = this.
|
|
301
|
-
if (partId
|
|
316
|
+
const partId = this.tryGetPartId(event.index);
|
|
317
|
+
if (partId?.startsWith("text_")) {
|
|
302
318
|
yield this.emit({ type: "text-end", id: partId });
|
|
303
319
|
}
|
|
304
320
|
}
|
package/package.json
CHANGED