gsd-pi 2.34.0-dev.6769913 → 2.34.0-dev.7d38042

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.
@@ -246,12 +246,6 @@ export class AgentSession {
246
246
  private _retryPromise: Promise<void> | undefined = undefined;
247
247
  private _retryResolve: (() => void) | undefined = undefined;
248
248
 
249
- // Cumulative session stats — survives compaction (#1423)
250
- private _cumulativeCost = 0;
251
- private _cumulativeInputTokens = 0;
252
- private _cumulativeOutputTokens = 0;
253
- private _cumulativeToolCalls = 0;
254
-
255
249
  // Bash execution state
256
250
  private _bashAbortController: AbortController | undefined = undefined;
257
251
  private _pendingBashMessages: BashExecutionMessage[] = [];
@@ -444,13 +438,7 @@ export class AgentSession {
444
438
  if (event.message.role === "assistant") {
445
439
  this._lastAssistantMessage = event.message;
446
440
 
447
- // Accumulate session stats that survive compaction (#1423)
448
441
  const assistantMsg = event.message as AssistantMessage;
449
- this._cumulativeCost += assistantMsg.usage?.cost?.total ?? 0;
450
- this._cumulativeInputTokens += assistantMsg.usage?.input ?? 0;
451
- this._cumulativeOutputTokens += assistantMsg.usage?.output ?? 0;
452
- this._cumulativeToolCalls += assistantMsg.content.filter((c) => c.type === "toolCall").length;
453
-
454
442
  if (assistantMsg.stopReason !== "error") {
455
443
  this._overflowRecoveryAttempted = false;
456
444
  }
@@ -3242,17 +3230,17 @@ export class AgentSession {
3242
3230
  sessionId: this.sessionId,
3243
3231
  userMessages,
3244
3232
  assistantMessages,
3245
- toolCalls: Math.max(toolCalls, this._cumulativeToolCalls),
3233
+ toolCalls,
3246
3234
  toolResults,
3247
3235
  totalMessages: state.messages.length,
3248
3236
  tokens: {
3249
- input: Math.max(totalInput, this._cumulativeInputTokens),
3250
- output: Math.max(totalOutput, this._cumulativeOutputTokens),
3237
+ input: totalInput,
3238
+ output: totalOutput,
3251
3239
  cacheRead: totalCacheRead,
3252
3240
  cacheWrite: totalCacheWrite,
3253
- total: Math.max(totalInput + totalOutput, this._cumulativeInputTokens + this._cumulativeOutputTokens) + totalCacheRead + totalCacheWrite,
3241
+ total: totalInput + totalOutput + totalCacheRead + totalCacheWrite,
3254
3242
  },
3255
- cost: Math.max(totalCost, this._cumulativeCost),
3243
+ cost: totalCost,
3256
3244
  };
3257
3245
  }
3258
3246