reasonix 0.29.0 → 0.30.0

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.
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  CODE_SYSTEM_PROMPT,
4
4
  codeSystemPrompt
5
- } from "./chunk-COFBA5FV.js";
5
+ } from "./chunk-RPP24CUB.js";
6
6
  export {
7
7
  CODE_SYSTEM_PROMPT,
8
8
  codeSystemPrompt
9
9
  };
10
- //# sourceMappingURL=prompt-VF7B6BWR.js.map
10
+ //# sourceMappingURL=prompt-5GLHSLO2.js.map
package/dist/index.d.ts CHANGED
@@ -586,6 +586,15 @@ interface SessionSummary {
586
586
  }
587
587
  declare class SessionStats {
588
588
  readonly turns: TurnStats[];
589
+ /** Cost from prior runs of a resumed session, restored from session meta. */
590
+ private _carryoverCost;
591
+ /** Turn count from prior runs of a resumed session. */
592
+ private _carryoverTurns;
593
+ /** Seed totals from a resumed session's persisted meta — only call once at construction. */
594
+ seedCarryover(opts: {
595
+ totalCostUsd?: number;
596
+ turnCount?: number;
597
+ }): void;
589
598
  record(turn: number, model: string, usage: Usage): TurnStats;
590
599
  get totalCost(): number;
591
600
  get totalClaudeEquivalent(): number;
package/dist/index.js CHANGED
@@ -1476,6 +1476,19 @@ function claudeEquivalentCost(usage) {
1476
1476
  }
1477
1477
  var SessionStats = class {
1478
1478
  turns = [];
1479
+ /** Cost from prior runs of a resumed session, restored from session meta. */
1480
+ _carryoverCost = 0;
1481
+ /** Turn count from prior runs of a resumed session. */
1482
+ _carryoverTurns = 0;
1483
+ /** Seed totals from a resumed session's persisted meta — only call once at construction. */
1484
+ seedCarryover(opts) {
1485
+ if (typeof opts.totalCostUsd === "number" && opts.totalCostUsd > 0) {
1486
+ this._carryoverCost = opts.totalCostUsd;
1487
+ }
1488
+ if (typeof opts.turnCount === "number" && opts.turnCount > 0) {
1489
+ this._carryoverTurns = opts.turnCount;
1490
+ }
1491
+ }
1479
1492
  record(turn, model, usage) {
1480
1493
  const cost = costUsd(model, usage);
1481
1494
  const stats = {
@@ -1489,7 +1502,7 @@ var SessionStats = class {
1489
1502
  return stats;
1490
1503
  }
1491
1504
  get totalCost() {
1492
- return this.turns.reduce((sum, t) => sum + t.cost, 0);
1505
+ return this._carryoverCost + this.turns.reduce((sum, t) => sum + t.cost, 0);
1493
1506
  }
1494
1507
  get totalClaudeEquivalent() {
1495
1508
  return this.turns.reduce((sum, t) => sum + claudeEquivalentCost(t.usage), 0);
@@ -1517,7 +1530,7 @@ var SessionStats = class {
1517
1530
  summary() {
1518
1531
  const last = this.turns[this.turns.length - 1];
1519
1532
  return {
1520
- turns: this.turns.length,
1533
+ turns: this.turns.length + this._carryoverTurns,
1521
1534
  totalCostUsd: round(this.totalCost, 6),
1522
1535
  totalInputCostUsd: round(this.totalInputCost, 6),
1523
1536
  totalOutputCostUsd: round(this.totalOutputCost, 6),
@@ -2524,6 +2537,13 @@ var CacheFirstLoop = class {
2524
2537
  const tokensSaved = shrunk.tokensSaved;
2525
2538
  for (const msg of messages) this.log.append(msg);
2526
2539
  this.resumedMessageCount = messages.length;
2540
+ if (messages.length > 0) {
2541
+ const meta = loadSessionMeta(this.sessionName);
2542
+ this.stats.seedCarryover({
2543
+ totalCostUsd: meta.totalCostUsd,
2544
+ turnCount: meta.turnCount
2545
+ });
2546
+ }
2527
2547
  if (healedCount > 0) {
2528
2548
  try {
2529
2549
  rewriteSession(this.sessionName, messages);