@wrongstack/core 0.8.2 → 0.8.4

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.
@@ -4842,12 +4842,18 @@ var AutoCompactionMiddleware = class _AutoCompactionMiddleware {
4842
4842
  failureMode;
4843
4843
  policyProvider;
4844
4844
  /**
4845
- * Overhead factor applied to the rough message-token estimate to produce a
4846
- * figure comparable to the real API request size (system prompt + tool defs).
4847
- * Without this factor, raw message tokens undercount real load by 15-50% in
4848
- * short conversations, causing premature compaction triggers.
4845
+ * Calibration factor applied to the estimator output. The estimator is now
4846
+ * expected to already include messages + system prompt + tool definitions
4847
+ * (see `estimateRequestTokens.total`), so no overhead boost is needed. Kept
4848
+ * as a constant so a future calibration against real provider tokenization
4849
+ * (BPE vs the chars/3.5 rough estimator) can dial this without touching the
4850
+ * threshold-check math.
4851
+ *
4852
+ * Historical note: was 1.3 when the estimator only counted messages — that
4853
+ * double-counted system+tools once the estimator was upgraded, firing
4854
+ * compaction ~30% earlier than intended (e.g. real 56% load showed as 73%).
4849
4855
  */
4850
- static OVERHEAD_FACTOR = 1.3;
4856
+ static OVERHEAD_FACTOR = 1;
4851
4857
  /**
4852
4858
  * Once a compaction attempt reduces nothing (preserveK protects everything,
4853
4859
  * no oversized tool_results remain to elide), retrying on every iteration