@blockrun/franklin 3.15.37 → 3.15.38

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.
Files changed (2) hide show
  1. package/dist/agent/loop.js +25 -4
  2. package/package.json +1 -1
@@ -403,6 +403,12 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
403
403
  let turnCount = 0;
404
404
  // Resume: hydrate history from the saved JSONL transcript.
405
405
  // Sanitize to drop any orphaned tool_use / tool_result pairs from a crash.
406
+ // Carry over running totals from prior runs so resume preserves them — see
407
+ // the `let sessionInputTokens` comment below.
408
+ let resumedInputTokens = 0;
409
+ let resumedOutputTokens = 0;
410
+ let resumedCostUsd = 0;
411
+ let resumedSavedVsOpusUsd = 0;
406
412
  if (config.resumeSessionId) {
407
413
  const prior = loadSessionHistory(config.resumeSessionId);
408
414
  if (prior.length > 0) {
@@ -411,6 +417,17 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
411
417
  const meta = loadSessionMeta(config.resumeSessionId);
412
418
  if (meta) {
413
419
  turnCount = meta.turnCount ?? 0;
420
+ // Pre-3.15.38 these fell on the floor — every resume reset the
421
+ // running cost/token totals to zero, then `updateSessionMeta`
422
+ // wrote the new (smaller) numbers back over the historical
423
+ // values. Verified 2026-05-04 from a real session: efd5e412
424
+ // had $2.65 + 200K input tokens accumulated, then a resume
425
+ // rewrote the meta to {costUsd: 0, inputTokens: 0, ...}
426
+ // before the user ran their next turn.
427
+ resumedInputTokens = meta.inputTokens ?? 0;
428
+ resumedOutputTokens = meta.outputTokens ?? 0;
429
+ resumedCostUsd = meta.costUsd ?? 0;
430
+ resumedSavedVsOpusUsd = meta.savedVsOpusUsd ?? 0;
414
431
  }
415
432
  }
416
433
  }
@@ -418,10 +435,14 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
418
435
  let lastSessionActivity = Date.now();
419
436
  let lastRoutedModel = ''; // last model chosen by router (for local elo)
420
437
  let lastRoutedCategory = ''; // last category detected (for local elo)
421
- let sessionInputTokens = 0;
422
- let sessionOutputTokens = 0;
423
- let sessionCostUsd = 0;
424
- let sessionSavedVsOpus = 0;
438
+ // Session-cumulative counters. Seeded from prior session meta on resume so
439
+ // `franklin insights` and the status bar show the *true* session total
440
+ // across every restart, not just what happened since the latest process
441
+ // boot.
442
+ let sessionInputTokens = resumedInputTokens;
443
+ let sessionOutputTokens = resumedOutputTokens;
444
+ let sessionCostUsd = resumedCostUsd;
445
+ let sessionSavedVsOpus = resumedSavedVsOpusUsd;
425
446
  // Per-tool call counts aggregated across every turn. Session-scope, not
426
447
  // per-turn. Counts the *name* of each tool invocation only — no inputs,
427
448
  // outputs, or paths. Fed into opt-in telemetry at session end.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/franklin",
3
- "version": "3.15.37",
3
+ "version": "3.15.38",
4
4
  "description": "Franklin — The AI agent with a wallet. Spends USDC autonomously to get real work done. Pay per action, no subscriptions.",
5
5
  "type": "module",
6
6
  "exports": {