@caupulican/pi-adaptative 0.80.71 → 0.80.72

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.80.72] - 2026-06-28
2
+
3
+ ### Fixed
4
+
5
+ - Long-session performance: the footer's spawned-cost total is now cached by entry count instead of re-scanning all session entries on every render frame, fixing typing lag and CPU spikes in long sessions.
6
+ - Long-session stability: disposing a session now releases the hooks it installed on the shared agent (so the session and its history can be garbage-collected) and aborts any in-flight background reflection so it can't keep spending tokens or write memory/skills against a closed session.
7
+
1
8
  ## [0.80.71] - 2026-06-28
2
9
 
3
10
  ### Fixed
@@ -279,6 +279,12 @@ export declare class AgentSession {
279
279
  private readonly _effectivenessTracker;
280
280
  /** R8: registry for deployment-supplied gateway channels + schedulers (lifecycle driven by the host runner). */
281
281
  private readonly _gatewayRegistry;
282
+ /** Cache for getSpawnedUsage(), keyed by session entry count (Bug #22 — avoid O(N) per render frame). */
283
+ private _spawnedUsageCache?;
284
+ /** Set on dispose so in-flight background reflection bails instead of writing to a dead session (Bug #21). */
285
+ private _disposed;
286
+ /** Aborts in-flight background reflection completions on dispose (Bug #21). */
287
+ private readonly _reflectionAbort;
282
288
  private readonly _isChildSession;
283
289
  /** Memory providers registered by extensions via pi.registerMemoryProvider, applied on (re)init. */
284
290
  private _pendingMemoryProviders;
@@ -777,7 +783,11 @@ export declare class AgentSession {
777
783
  sourceSessionId?: string;
778
784
  reportId?: string;
779
785
  }): string | undefined;
780
- /** Aggregate all recorded spawned-usage reports (see {@link addSpawnedUsage}). */
786
+ /**
787
+ * Aggregate all recorded spawned-usage reports (see {@link addSpawnedUsage}). Cached by the session
788
+ * entry count so the interactive footer (which calls this every render frame) is O(1) between turns
789
+ * instead of an O(N) scan on every keystroke (Bug #22). Recomputes only when entries change.
790
+ */
781
791
  getSpawnedUsage(): SpawnedUsageTotals;
782
792
  /**
783
793
  * Run a one-shot LLM completion fully ISOLATED from the main session — the load-bearing