@compilr-dev/sdk 0.7.26 → 0.7.27
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 +9 -1
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -121,8 +121,10 @@ class CompilrAgentImpl {
|
|
|
121
121
|
}
|
|
122
122
|
// Build context manager if configured
|
|
123
123
|
let contextManager;
|
|
124
|
+
const contextLimit = config?.context
|
|
125
|
+
? (config.context.contextLimit ?? getContextWindow(config.model))
|
|
126
|
+
: getContextWindow(config?.model);
|
|
124
127
|
if (config?.context) {
|
|
125
|
-
const contextLimit = config.context.contextLimit ?? getContextWindow(config.model);
|
|
126
128
|
contextManager = new ContextManager({
|
|
127
129
|
provider,
|
|
128
130
|
config: {
|
|
@@ -297,6 +299,12 @@ class CompilrAgentImpl {
|
|
|
297
299
|
windowing: contextManager
|
|
298
300
|
? config?.context?.windowing !== false
|
|
299
301
|
? {
|
|
302
|
+
// Scale windowing targets to model's context window:
|
|
303
|
+
// targetHistoryTokens: 10% of context (e.g., 100K for 1M, 20K for 200K, 12.8K for 128K)
|
|
304
|
+
// recentWindowTokens: 25% of target (e.g., 25K for 1M, 5K for 200K)
|
|
305
|
+
targetHistoryTokens: Math.round(contextLimit * 0.10),
|
|
306
|
+
recentWindowTokens: Math.round(contextLimit * 0.025),
|
|
307
|
+
// User overrides take precedence
|
|
300
308
|
...(typeof config?.context?.windowing === 'object' ? config.context.windowing : {}),
|
|
301
309
|
}
|
|
302
310
|
: false
|