@probelabs/probe 0.6.0-rc137 → 0.6.0-rc138
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.
|
@@ -1270,6 +1270,9 @@ When troubleshooting:
|
|
|
1270
1270
|
temperature: 0.3,
|
|
1271
1271
|
});
|
|
1272
1272
|
|
|
1273
|
+
// Get the promise reference BEFORE consuming stream (doesn't lock it)
|
|
1274
|
+
const usagePromise = result.usage;
|
|
1275
|
+
|
|
1273
1276
|
// Collect the streamed response - stream all content for now
|
|
1274
1277
|
for await (const delta of result.textStream) {
|
|
1275
1278
|
assistantResponseContent += delta;
|
|
@@ -1279,8 +1282,8 @@ When troubleshooting:
|
|
|
1279
1282
|
}
|
|
1280
1283
|
}
|
|
1281
1284
|
|
|
1282
|
-
// Record token usage
|
|
1283
|
-
const usage = await
|
|
1285
|
+
// Record token usage - await the promise AFTER stream is consumed
|
|
1286
|
+
const usage = await usagePromise;
|
|
1284
1287
|
if (usage) {
|
|
1285
1288
|
this.tokenCounter.recordUsage(usage, result.experimental_providerMetadata);
|
|
1286
1289
|
}
|
package/build/agent/index.js
CHANGED
|
@@ -49394,13 +49394,14 @@ You are working with a repository located at: ${searchDirectory}
|
|
|
49394
49394
|
maxTokens: maxResponseTokens,
|
|
49395
49395
|
temperature: 0.3
|
|
49396
49396
|
});
|
|
49397
|
+
const usagePromise = result.usage;
|
|
49397
49398
|
for await (const delta of result.textStream) {
|
|
49398
49399
|
assistantResponseContent += delta;
|
|
49399
49400
|
if (options.onStream) {
|
|
49400
49401
|
options.onStream(delta);
|
|
49401
49402
|
}
|
|
49402
49403
|
}
|
|
49403
|
-
const usage = await
|
|
49404
|
+
const usage = await usagePromise;
|
|
49404
49405
|
if (usage) {
|
|
49405
49406
|
this.tokenCounter.recordUsage(usage, result.experimental_providerMetadata);
|
|
49406
49407
|
}
|
package/cjs/agent/ProbeAgent.cjs
CHANGED
|
@@ -74587,13 +74587,14 @@ You are working with a repository located at: ${searchDirectory}
|
|
|
74587
74587
|
maxTokens: maxResponseTokens,
|
|
74588
74588
|
temperature: 0.3
|
|
74589
74589
|
});
|
|
74590
|
+
const usagePromise = result.usage;
|
|
74590
74591
|
for await (const delta of result.textStream) {
|
|
74591
74592
|
assistantResponseContent += delta;
|
|
74592
74593
|
if (options.onStream) {
|
|
74593
74594
|
options.onStream(delta);
|
|
74594
74595
|
}
|
|
74595
74596
|
}
|
|
74596
|
-
const usage = await
|
|
74597
|
+
const usage = await usagePromise;
|
|
74597
74598
|
if (usage) {
|
|
74598
74599
|
this.tokenCounter.recordUsage(usage, result.experimental_providerMetadata);
|
|
74599
74600
|
}
|
package/cjs/index.cjs
CHANGED
|
@@ -74729,13 +74729,14 @@ You are working with a repository located at: ${searchDirectory}
|
|
|
74729
74729
|
maxTokens: maxResponseTokens,
|
|
74730
74730
|
temperature: 0.3
|
|
74731
74731
|
});
|
|
74732
|
+
const usagePromise = result.usage;
|
|
74732
74733
|
for await (const delta of result.textStream) {
|
|
74733
74734
|
assistantResponseContent += delta;
|
|
74734
74735
|
if (options.onStream) {
|
|
74735
74736
|
options.onStream(delta);
|
|
74736
74737
|
}
|
|
74737
74738
|
}
|
|
74738
|
-
const usage = await
|
|
74739
|
+
const usage = await usagePromise;
|
|
74739
74740
|
if (usage) {
|
|
74740
74741
|
this.tokenCounter.recordUsage(usage, result.experimental_providerMetadata);
|
|
74741
74742
|
}
|
package/package.json
CHANGED
package/src/agent/ProbeAgent.js
CHANGED
|
@@ -1270,6 +1270,9 @@ When troubleshooting:
|
|
|
1270
1270
|
temperature: 0.3,
|
|
1271
1271
|
});
|
|
1272
1272
|
|
|
1273
|
+
// Get the promise reference BEFORE consuming stream (doesn't lock it)
|
|
1274
|
+
const usagePromise = result.usage;
|
|
1275
|
+
|
|
1273
1276
|
// Collect the streamed response - stream all content for now
|
|
1274
1277
|
for await (const delta of result.textStream) {
|
|
1275
1278
|
assistantResponseContent += delta;
|
|
@@ -1279,8 +1282,8 @@ When troubleshooting:
|
|
|
1279
1282
|
}
|
|
1280
1283
|
}
|
|
1281
1284
|
|
|
1282
|
-
// Record token usage
|
|
1283
|
-
const usage = await
|
|
1285
|
+
// Record token usage - await the promise AFTER stream is consumed
|
|
1286
|
+
const usage = await usagePromise;
|
|
1284
1287
|
if (usage) {
|
|
1285
1288
|
this.tokenCounter.recordUsage(usage, result.experimental_providerMetadata);
|
|
1286
1289
|
}
|