@caupulican/pi-adaptative 0.80.71 → 0.80.73

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,26 @@
1
+ ## [0.80.73] - 2026-06-28
2
+
3
+ ### Fixed
4
+
5
+ - Cross-session recall hardening: recalled past-session pages are now injected as a GC-managed
6
+ `<memory_context>` block (instead of a plain user message), so stale recall pages pack down over long
7
+ sessions instead of accumulating verbatim; oversize transcript logs are skipped before parsing; and
8
+ recall is scoped to the current working directory so transcripts from other projects can't leak in.
9
+ - Memory injection cost guard: the persistent-memory block (`MEMORY.md`/`USER.md`) injected into the
10
+ system prompt is now capped at read time as well as on write, so a memory file bloated by an external
11
+ edit can no longer inflate every turn's context. The file on disk is untouched and truncation is noted.
12
+ - Background reflection debounce (cost guard): native end-of-turn reflection no longer launches
13
+ overlapping or back-to-back passes during a rapid multi-turn correction session; a minimum interval and
14
+ an in-flight guard prevent redundant background model calls. Skipped corrections are still reflected on
15
+ the next eligible pass over the accumulated turn text.
16
+
17
+ ## [0.80.72] - 2026-06-28
18
+
19
+ ### Fixed
20
+
21
+ - 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.
22
+ - 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.
23
+
1
24
  ## [0.80.71] - 2026-06-28
2
25
 
3
26
  ### Fixed
@@ -21,7 +21,7 @@ import { type ContextUsage, type ExtensionCommandContextActions, type ExtensionC
21
21
  import { type ChannelProvider, GatewayRegistry, type JobSchedulerProvider } from "./gateways/channel-provider.ts";
22
22
  import { type DemandSignals, type ReflectionResult } from "./learning/reflection-engine.ts";
23
23
  import type { MemoryProvider } from "./memory/memory-provider.ts";
24
- import type { CustomMessage } from "./messages.ts";
24
+ import { type CustomMessage } from "./messages.ts";
25
25
  import type { ModelRegistry } from "./model-registry.ts";
26
26
  import { type PromptTemplate } from "./prompt-templates.ts";
27
27
  import type { ResourceLoader } from "./resource-loader.ts";
@@ -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