@compilr-dev/sdk 0.7.27 → 0.7.28
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/dist/agent.js +11 -9
- package/dist/config.d.ts +12 -2
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -298,15 +298,17 @@ class CompilrAgentImpl {
|
|
|
298
298
|
observationMask: contextManager ? observationMask : undefined,
|
|
299
299
|
windowing: contextManager
|
|
300
300
|
? config?.context?.windowing !== false
|
|
301
|
-
? {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
301
|
+
? (() => {
|
|
302
|
+
const wCfg = typeof config?.context?.windowing === 'object' ? config.context.windowing : {};
|
|
303
|
+
const historyRatio = wCfg.targetHistoryRatio ?? 0.1;
|
|
304
|
+
const recentRatio = wCfg.recentWindowRatio ?? 0.025;
|
|
305
|
+
return {
|
|
306
|
+
// Derive from model context window, overridable with explicit values
|
|
307
|
+
targetHistoryTokens: wCfg.targetHistoryTokens ?? Math.round(contextLimit * historyRatio),
|
|
308
|
+
recentWindowTokens: wCfg.recentWindowTokens ?? Math.round(contextLimit * recentRatio),
|
|
309
|
+
enabled: wCfg.enabled,
|
|
310
|
+
};
|
|
311
|
+
})()
|
|
310
312
|
: false
|
|
311
313
|
: undefined,
|
|
312
314
|
hooks: mergedHooks,
|
package/dist/config.d.ts
CHANGED
|
@@ -110,10 +110,20 @@ export interface ContextConfig {
|
|
|
110
110
|
* Smart windowing — programmatic context compaction.
|
|
111
111
|
* Compacts old messages when history exceeds token budget.
|
|
112
112
|
* Three zones: recent (intact), middle (truncated), old (event log).
|
|
113
|
-
*
|
|
113
|
+
*
|
|
114
|
+
* When omitted, targets are derived from the model's context window:
|
|
115
|
+
* targetHistoryTokens = contextLimit * targetHistoryRatio (default 0.10)
|
|
116
|
+
* recentWindowTokens = contextLimit * recentWindowRatio (default 0.025)
|
|
117
|
+
*
|
|
114
118
|
* Set to false to disable windowing entirely.
|
|
119
|
+
* Set explicit targetHistoryTokens/recentWindowTokens to override proportional defaults.
|
|
115
120
|
*/
|
|
116
|
-
windowing?: Partial<WindowingConfig>
|
|
121
|
+
windowing?: (Partial<WindowingConfig> & {
|
|
122
|
+
/** Fraction of context window for target history. Default: 0.10 (10%) */
|
|
123
|
+
targetHistoryRatio?: number;
|
|
124
|
+
/** Fraction of context window for recent window. Default: 0.025 (2.5%) */
|
|
125
|
+
recentWindowRatio?: number;
|
|
126
|
+
}) | false;
|
|
117
127
|
}
|
|
118
128
|
/**
|
|
119
129
|
* Usage information for the agent
|