osborn 0.9.128 → 0.9.130

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.
Files changed (2) hide show
  1. package/dist/claude-llm.js +20 -9
  2. package/package.json +1 -1
@@ -149,6 +149,16 @@ function ensureCompactionSettings() {
149
149
  }
150
150
  }
151
151
  ensureCompactionSettings();
152
+ // Enable Opus 4.8's native 1M context window + set the auto-compact threshold
153
+ // at MODULE LOAD — BEFORE any query() spawns — so they actually apply to the
154
+ // persistent session. Setting these per-message in pushMessage() is too late:
155
+ // the SDK subprocess reads env once at cold-start, so later writes never reach
156
+ // the running query — the reason auto-compaction kept firing at ~150k every
157
+ // turn. ENABLE_1M_CONTEXT is Claude Code's documented switch for the context-1m
158
+ // (1M) window; without it opus runs at its 200K default. NOTE: 1M activation
159
+ // also depends on account entitlement (auto on Team seats; else usage credits).
160
+ process.env.ENABLE_1M_CONTEXT = '1';
161
+ process.env.CLAUDE_AUTOCOMPACT_PCT_OVERRIDE = '92';
152
162
  // Research mode tools — full research capabilities
153
163
  // Named sub-agents — the orchestrator delegates to these specialists. Each has
154
164
  // a specific role, model, and tool set. Module-level + exported so the HTTP
@@ -483,7 +493,12 @@ export class ClaudeLLM extends llm.LLM {
483
493
  return 'claude.agent-sdk';
484
494
  }
485
495
  get model() {
486
- return this.#opts.model || 'claude-opus-4-8'; // Opus 4.8 orchestrator with named sub-agents
496
+ // The [1m] suffix opts into Opus 4.8's 1M context window (Claude Code's
497
+ // context-1m-2025-08-07 beta). WITHOUT it the SDK runs opus at its 200k
498
+ // base, so auto-compaction fired at ~153k every ~10 min (confirmed in the
499
+ // live agent log: compact_boundary pre_tokens≈153k). With [1m] the window
500
+ // is 1M and compaction happens far later. Overridable via opts.model.
501
+ return this.#opts.model || 'claude-opus-4-8[1m]';
487
502
  }
488
503
  get sessionId() {
489
504
  return this.#sessionId;
@@ -764,13 +779,9 @@ export class ClaudeLLM extends llm.LLM {
764
779
  * @param callbacks - Event callbacks for the background consumer
765
780
  */
766
781
  pushMessage(userText, sdkOptions, callbacks) {
767
- // Auto-compact threshold — fires PreCompact when context fills to this %.
768
- // Higher = uses more of the window before compacting (more context retained
769
- // per turn, but less headroom for the next reply). Raised 85→92 because
770
- // users reported compaction firing too often; 92% pushes it as late as is
771
- // safe before Claude starts hard-capping replies near the 1M limit. Pairs
772
- // with autoCompactWindow=1_000_000 (settings.json, read via settingSources).
773
- process.env.CLAUDE_AUTOCOMPACT_PCT_OVERRIDE = '92';
782
+ // (Compaction/1M env is set once at module load — see ENABLE_1M_CONTEXT /
783
+ // CLAUDE_AUTOCOMPACT_PCT_OVERRIDE near ensureCompactionSettings(). Setting it
784
+ // here per-message was too late for the persistent query.)
774
785
  const userMessage = {
775
786
  type: 'user',
776
787
  message: { role: 'user', content: [{ type: 'text', text: userText }] },
@@ -1004,7 +1015,7 @@ class ClaudeLLMStream extends llm.LLMStream {
1004
1015
  permissionMode: this.#opts.permissionMode,
1005
1016
  allowedTools,
1006
1017
  // model: this.#opts.model || 'haiku', // haiku for speed with limited tools, sonnet for full research capabilities (including tool use trace in response)
1007
- model: this.#opts.model || 'claude-opus-4-8', // Opus 4.8 orchestrator with named sub-agents (Haiku tested but ignored delegation rules)
1018
+ model: this.#opts.model || 'claude-opus-4-8[1m]', // Opus 4.8 + [1m] → 1M context (see get model() note); prevents ~153k early compaction
1008
1019
  enableFileCheckpointing: true,
1009
1020
  settingSources: ['project', 'user'],
1010
1021
  extraArgs: { 'replay-user-messages': null },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "osborn",
3
- "version": "0.9.128",
3
+ "version": "0.9.130",
4
4
  "description": "Voice AI coding assistant - local agent that connects to Osborn frontend",
5
5
  "type": "module",
6
6
  "bin": {