@sayknow-cli/agent-core 0.7.12 → 0.7.14

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
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.7.14] - 2026-11-02
6
+
5
7
  ## [0.7.12] - 2026-10-24
6
8
 
7
9
  ### Fixed
@@ -148,6 +148,15 @@ export declare function emergencyCompactionReason(sample: EmergencyCompactionSam
148
148
  */
149
149
  export declare function computeAdaptiveThresholdPercent(basePercent: number, contextTokens: number, contextWindow: number, state: AdaptiveCompactionDecisionState | undefined, options: AdaptiveCompactionOptions | undefined): number;
150
150
  export declare function resolveThresholdTokens(contextWindow: number, settings: CompactionSettings, maxOutputTokens?: number, contextTokens?: number): number;
151
+ /**
152
+ * Threshold for compaction inside a running tool loop. The configured threshold
153
+ * is applied at answer boundaries (agent_end, before a prompt). Compacting in the
154
+ * middle of a run makes the model redo work it already did, so when the window
155
+ * has room past the default ceiling, a lower configured threshold does not apply
156
+ * mid-run: the run compacts at the ceiling. Smaller windows have no such room and
157
+ * keep the configured threshold, which is what keeps them under the provider limit.
158
+ */
159
+ export declare function resolveMidRunThresholdTokens(contextWindow: number, settings: CompactionSettings): number;
151
160
  /**
152
161
  * Image content has no tokenizer representation; charge a fixed estimate
153
162
  * matching what providers typically bill for inline images.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@sayknow-cli/agent-core",
4
- "version": "0.7.12",
4
+ "version": "0.7.14",
5
5
  "description": "General-purpose agent with transport abstraction, state management, and attachment support",
6
6
  "homepage": "https://sayknow-cli.com",
7
7
  "author": "jaybeyond",
@@ -35,9 +35,9 @@
35
35
  "fmt": "biome format --write ."
36
36
  },
37
37
  "dependencies": {
38
- "@sayknow-cli/ai": "0.7.12",
39
- "@sayknow-cli/natives": "0.7.12",
40
- "@sayknow-cli/utils": "0.7.12",
38
+ "@sayknow-cli/ai": "0.7.14",
39
+ "@sayknow-cli/natives": "0.7.14",
40
+ "@sayknow-cli/utils": "0.7.14",
41
41
  "@opentelemetry/api": "^1.9.0"
42
42
  },
43
43
  "devDependencies": {
@@ -502,6 +502,21 @@ export function resolveThresholdTokens(
502
502
  return Math.floor(contextWindow * (adaptiveThresholdPercent / 100));
503
503
  }
504
504
 
505
+ /**
506
+ * Threshold for compaction inside a running tool loop. The configured threshold
507
+ * is applied at answer boundaries (agent_end, before a prompt). Compacting in the
508
+ * middle of a run makes the model redo work it already did, so when the window
509
+ * has room past the default ceiling, a lower configured threshold does not apply
510
+ * mid-run: the run compacts at the ceiling. Smaller windows have no such room and
511
+ * keep the configured threshold, which is what keeps them under the provider limit.
512
+ */
513
+ export function resolveMidRunThresholdTokens(contextWindow: number, settings: CompactionSettings): number {
514
+ const configured = resolveThresholdTokens(contextWindow, settings);
515
+ const windowLimit = contextWindow - effectiveReserveTokens(contextWindow, settings);
516
+ if (windowLimit <= DEFAULT_AUTO_THRESHOLD_CEILING_TOKENS) return configured;
517
+ return Math.max(configured, DEFAULT_AUTO_THRESHOLD_CEILING_TOKENS);
518
+ }
519
+
505
520
  // ============================================================================
506
521
  // Cut point detection
507
522
  // ============================================================================