openzoo 0.48.42 → 0.48.44

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/lib/launch.js +60 -4
  2. package/package.json +1 -1
package/lib/launch.js CHANGED
@@ -159,8 +159,36 @@ export async function launchClaude(argv) {
159
159
  // OPENZOO_NO_ALIAS=1 opts out. Worth knowing: model-specific client behaviour
160
160
  // (thinking budget, tool formats) also keys off the name, so if a session
161
161
  // behaves oddly this is the first thing to turn off.
162
- if (process.env.OPENZOO_NO_ALIAS !== '1' && !process.env.ANTHROPIC_MODEL) {
163
- env.ANTHROPIC_MODEL = process.env.OPENZOO_CLAUDE_ALIAS || 'openzoo-claude-sonnet-5';
162
+ // Applies to WHATEVER model you are on — opus, fable, sonnet, haiku. The
163
+ // 200k table is keyed by name, so every recognised Claude id hits it; the
164
+ // alias is minted from the requested model rather than pinned to sonnet.
165
+ if (process.env.OPENZOO_NO_ALIAS !== '1') {
166
+ const want = process.env.OPENZOO_CLAUDE_ALIAS
167
+ || process.env.ANTHROPIC_MODEL
168
+ || 'claude-sonnet-5';
169
+ // idempotent: never openzoo-openzoo-…; strip a vendor prefix so the SUFFIX
170
+ // resolver in models.js gets the bare family name it matches on.
171
+ const bare = String(want).replace(/^openzoo-/, '').replace(/^[^/]+\//, '');
172
+ // ONLY families whose alias was VERIFIED to resolve back to themselves.
173
+ // openzoo-claude-haiku-4-5 resolved to deepseek/deepseek-v4-pro-0813 — the
174
+ // suffix scorer found no haiku in the catalog and picked a neighbour, so
175
+ // aliasing it would silently swap the user's model. A compaction fix is
176
+ // never worth answering as a different model than the one asked for.
177
+ const SAFE = /^claude-(opus|sonnet|fable)-/;
178
+ if (SAFE.test(bare)) env.ANTHROPIC_MODEL = `openzoo-${bare}`;
179
+ }
180
+ // THE ACTUAL SWITCHES. Three earlier attempts missed these entirely:
181
+ // autoCompactEnabled in settings (global, trapped a session), a raised
182
+ // CLAUDE_CODE_MAX_CONTEXT_TOKENS (clamped to 200k by the model table), and an
183
+ // unrecognised model alias (resolves fine, still compacted). DISABLE_COMPACT
184
+ // and DISABLE_AUTO_COMPACT are in the binary and are the direct controls.
185
+ //
186
+ // Correct here for the same reason as everything else in this block: the
187
+ // proxy binds the prefix and forwards a bounded tail, so the request that
188
+ // leaves this machine stays small no matter how long the conversation runs.
189
+ if (process.env.OPENZOO_KEEP_COMPACT !== '1') {
190
+ env.DISABLE_COMPACT = process.env.DISABLE_COMPACT || '1';
191
+ env.DISABLE_AUTO_COMPACT = process.env.DISABLE_AUTO_COMPACT || '1';
164
192
  }
165
193
  // RAISE THE CEILING, because the proxy already removed it.
166
194
  //
@@ -395,8 +423,36 @@ export async function launchHarness(cmd, args) {
395
423
  // OPENZOO_NO_ALIAS=1 opts out. Worth knowing: model-specific client behaviour
396
424
  // (thinking budget, tool formats) also keys off the name, so if a session
397
425
  // behaves oddly this is the first thing to turn off.
398
- if (process.env.OPENZOO_NO_ALIAS !== '1' && !process.env.ANTHROPIC_MODEL) {
399
- env.ANTHROPIC_MODEL = process.env.OPENZOO_CLAUDE_ALIAS || 'openzoo-claude-sonnet-5';
426
+ // Applies to WHATEVER model you are on — opus, fable, sonnet, haiku. The
427
+ // 200k table is keyed by name, so every recognised Claude id hits it; the
428
+ // alias is minted from the requested model rather than pinned to sonnet.
429
+ if (process.env.OPENZOO_NO_ALIAS !== '1') {
430
+ const want = process.env.OPENZOO_CLAUDE_ALIAS
431
+ || process.env.ANTHROPIC_MODEL
432
+ || 'claude-sonnet-5';
433
+ // idempotent: never openzoo-openzoo-…; strip a vendor prefix so the SUFFIX
434
+ // resolver in models.js gets the bare family name it matches on.
435
+ const bare = String(want).replace(/^openzoo-/, '').replace(/^[^/]+\//, '');
436
+ // ONLY families whose alias was VERIFIED to resolve back to themselves.
437
+ // openzoo-claude-haiku-4-5 resolved to deepseek/deepseek-v4-pro-0813 — the
438
+ // suffix scorer found no haiku in the catalog and picked a neighbour, so
439
+ // aliasing it would silently swap the user's model. A compaction fix is
440
+ // never worth answering as a different model than the one asked for.
441
+ const SAFE = /^claude-(opus|sonnet|fable)-/;
442
+ if (SAFE.test(bare)) env.ANTHROPIC_MODEL = `openzoo-${bare}`;
443
+ }
444
+ // THE ACTUAL SWITCHES. Three earlier attempts missed these entirely:
445
+ // autoCompactEnabled in settings (global, trapped a session), a raised
446
+ // CLAUDE_CODE_MAX_CONTEXT_TOKENS (clamped to 200k by the model table), and an
447
+ // unrecognised model alias (resolves fine, still compacted). DISABLE_COMPACT
448
+ // and DISABLE_AUTO_COMPACT are in the binary and are the direct controls.
449
+ //
450
+ // Correct here for the same reason as everything else in this block: the
451
+ // proxy binds the prefix and forwards a bounded tail, so the request that
452
+ // leaves this machine stays small no matter how long the conversation runs.
453
+ if (process.env.OPENZOO_KEEP_COMPACT !== '1') {
454
+ env.DISABLE_COMPACT = process.env.DISABLE_COMPACT || '1';
455
+ env.DISABLE_AUTO_COMPACT = process.env.DISABLE_AUTO_COMPACT || '1';
400
456
  }
401
457
  // RAISE THE CEILING, because the proxy already removed it.
402
458
  //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openzoo",
3
- "version": "0.48.42",
3
+ "version": "0.48.44",
4
4
  "description": "Local x402-paying proxy + MCP server for openzoo.fun — point any OpenAI-compatible harness (Cursor, Claude Code, aider, SDKs) at localhost and it pays per call from a local burner wallet. Solana and Base rails live; Robinhood experimental.",
5
5
  "license": "MIT",
6
6
  "type": "module",