spacecode 2.2.1 → 2.2.2
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.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/repl.mjs +5 -3
- package/package.json +1 -1
package/dist/repl.mjs
CHANGED
|
@@ -97777,7 +97777,8 @@ async function parseStreamResponse(body, emit, signal) {
|
|
|
97777
97777
|
let buffer = "";
|
|
97778
97778
|
const content = [];
|
|
97779
97779
|
let stopReason = "end_turn";
|
|
97780
|
-
let
|
|
97780
|
+
let inputFromStart = 0;
|
|
97781
|
+
let inputFromDelta = 0;
|
|
97781
97782
|
let outputTokens = 0;
|
|
97782
97783
|
let cacheCreationInputTokens = 0;
|
|
97783
97784
|
let cacheReadInputTokens = 0;
|
|
@@ -97810,7 +97811,7 @@ async function parseStreamResponse(body, emit, signal) {
|
|
|
97810
97811
|
switch (event.type) {
|
|
97811
97812
|
case "message_start": {
|
|
97812
97813
|
if (event.message?.usage) {
|
|
97813
|
-
|
|
97814
|
+
inputFromStart += event.message.usage.input_tokens ?? 0;
|
|
97814
97815
|
cacheCreationInputTokens += event.message.usage.cache_creation_input_tokens ?? 0;
|
|
97815
97816
|
cacheReadInputTokens += event.message.usage.cache_read_input_tokens ?? 0;
|
|
97816
97817
|
}
|
|
@@ -97887,6 +97888,7 @@ async function parseStreamResponse(body, emit, signal) {
|
|
|
97887
97888
|
}
|
|
97888
97889
|
if (event.usage) {
|
|
97889
97890
|
outputTokens += event.usage.output_tokens ?? 0;
|
|
97891
|
+
inputFromDelta = Math.max(inputFromDelta, event.usage.input_tokens ?? 0);
|
|
97890
97892
|
}
|
|
97891
97893
|
break;
|
|
97892
97894
|
}
|
|
@@ -97915,7 +97917,7 @@ async function parseStreamResponse(body, emit, signal) {
|
|
|
97915
97917
|
content,
|
|
97916
97918
|
stop_reason: stopReason,
|
|
97917
97919
|
usage: {
|
|
97918
|
-
input_tokens:
|
|
97920
|
+
input_tokens: Math.max(inputFromStart, inputFromDelta),
|
|
97919
97921
|
output_tokens: outputTokens,
|
|
97920
97922
|
cache_creation_input_tokens: cacheCreationInputTokens,
|
|
97921
97923
|
cache_read_input_tokens: cacheReadInputTokens
|