@compilr-dev/sdk 0.7.25 → 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 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: {
@@ -294,6 +296,19 @@ class CompilrAgentImpl {
294
296
  contextManager,
295
297
  autoContextManagement: contextManager !== undefined,
296
298
  observationMask: contextManager ? observationMask : undefined,
299
+ windowing: contextManager
300
+ ? config?.context?.windowing !== false
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
308
+ ...(typeof config?.context?.windowing === 'object' ? config.context.windowing : {}),
309
+ }
310
+ : false
311
+ : undefined,
297
312
  hooks: mergedHooks,
298
313
  pins: {},
299
314
  permissions: {
package/dist/config.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * SDK configuration types
3
3
  */
4
- import type { LLMProvider, Message, Tool, ToolPermission, HooksConfig, AnchorInput, AgentEvent, ToolExecutionResult, DelegationConfig, ObservationMaskConfig } from '@compilr-dev/agents';
4
+ import type { LLMProvider, Message, Tool, ToolPermission, HooksConfig, AnchorInput, AgentEvent, ToolExecutionResult, DelegationConfig, ObservationMaskConfig, WindowingConfig } from '@compilr-dev/agents';
5
5
  import type { Preset } from './presets/types.js';
6
6
  import type { ToolProfile } from './team/tool-config.js';
7
7
  import type { ConditionalModule } from './capabilities/hook.js';
@@ -106,6 +106,14 @@ export interface ContextConfig {
106
106
  * Set to false to disable masking entirely.
107
107
  */
108
108
  observationMask?: Partial<ObservationMaskConfig> | false;
109
+ /**
110
+ * Smart windowing — programmatic context compaction.
111
+ * Compacts old messages when history exceeds token budget.
112
+ * Three zones: recent (intact), middle (truncated), old (event log).
113
+ * When omitted, SDK defaults are used (60K target, 15K recent window).
114
+ * Set to false to disable windowing entirely.
115
+ */
116
+ windowing?: Partial<WindowingConfig> | false;
109
117
  }
110
118
  /**
111
119
  * Usage information for the agent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.7.25",
3
+ "version": "0.7.27",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -53,11 +53,11 @@
53
53
  "node": ">=18.0.0"
54
54
  },
55
55
  "dependencies": {
56
+ "@compilr-dev/agents": "^0.4.0",
56
57
  "@compilr-dev/sdk": "^0.5.4",
57
58
  "ajv": "^6.14.0"
58
59
  },
59
60
  "peerDependencies": {
60
- "@compilr-dev/agents": "^0.3.25",
61
61
  "@compilr-dev/agents-coding": "^1.0.2",
62
62
  "better-sqlite3": "^11.0.0 || ^12.0.0"
63
63
  },
@@ -68,7 +68,6 @@
68
68
  },
69
69
  "devDependencies": {
70
70
  "@anthropic-ai/sdk": "^0.78.0",
71
- "@compilr-dev/agents": "^0.3.28",
72
71
  "@compilr-dev/agents-coding": "^1.0.2",
73
72
  "@eslint/js": "^9.39.1",
74
73
  "@opentelemetry/api": "^1.9.0",