billion-context 0.1.59-pr.298.151 → 0.1.59-pr.303.152

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 CHANGED
@@ -52129,8 +52129,15 @@ ${systemPrompt}` : systemPrompt;
52129
52129
  } else if (type === "message_delta") {
52130
52130
  const u2 = data.usage ?? {};
52131
52131
  if (typeof u2.output_tokens === "number") roundOutput = u2.output_tokens;
52132
- if (typeof u2.input_tokens === "number" && u2.input_tokens > 0) roundInput = u2.input_tokens;
52133
- if (typeof u2.cache_read_input_tokens === "number" && u2.cache_read_input_tokens > 0) roundCached = u2.cache_read_input_tokens;
52132
+ const input = typeof u2.input_tokens === "number" ? u2.input_tokens : void 0;
52133
+ const cached = typeof u2.cache_read_input_tokens === "number" ? u2.cache_read_input_tokens : void 0;
52134
+ if (input !== void 0 && input > 0 && cached !== void 0) {
52135
+ roundInput = input;
52136
+ roundCached = cached;
52137
+ } else {
52138
+ if (input !== void 0 && input > 0) roundInput = input;
52139
+ if (cached !== void 0 && cached > 0) roundCached = cached;
52140
+ }
52134
52141
  const d = data.delta ?? {};
52135
52142
  if (typeof d.stop_reason === "string") stopReason = d.stop_reason;
52136
52143
  if (!usageYielded) {