openzoo 0.48.40 → 0.48.41

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/lib/launch.js CHANGED
@@ -223,7 +223,15 @@ export async function launchClaude(argv) {
223
223
  // because OPENZOO_KEEP_TAIL_MSGS bounds what is actually sent.
224
224
  // OPENZOO_KEEP_COMPACT=1 restores stock behaviour.
225
225
  const prevCompact = settings.autoCompactEnabled;
226
- if (process.env.OPENZOO_KEEP_COMPACT !== '1') settings.autoCompactEnabled = false;
226
+ // DO NOT touch autoCompactEnabled. Disabling it here mutated the user's
227
+ // GLOBAL ~/.claude/settings.json and applied to every session, openzoo or
228
+ // not — and because Claude Code's HARD ceiling is separate from its
229
+ // AUTOMATIC compaction, it removed the escape hatch without removing the
230
+ // wall. A live session ended up unable to compact AND unable to continue:
231
+ // every keystroke returned "Context limit reached". Strictly worse than
232
+ // stock. The correct lever is CLAUDE_CODE_MAX_CONTEXT_TOKENS on the
233
+ // spawned process (set below), which is scoped to this launch and leaves
234
+ // compaction available as a fallback.
227
235
  fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
228
236
  fs.writeFileSync(settingsPath, `${JSON.stringify(settings, null, 2)}\n`);
229
237
  restoreStatus = () => {
@@ -231,6 +239,7 @@ export async function launchClaude(argv) {
231
239
  const cur = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
232
240
  if (prev === undefined) delete cur.statusLine; else cur.statusLine = prev;
233
241
  // Never leave a global setting mutated after we exit.
242
+ // Clean up the flag older builds left behind in global settings.
234
243
  if (prevCompact === undefined) delete cur.autoCompactEnabled;
235
244
  else cur.autoCompactEnabled = prevCompact;
236
245
  fs.writeFileSync(settingsPath, `${JSON.stringify(cur, null, 2)}\n`);
package/lib/proxy.js CHANGED
@@ -1111,7 +1111,12 @@ export async function startProxy({ silent = false, requireToken = null, sessionM
1111
1111
  // promptTokens, so a tail that rivals the corpus silently falls
1112
1112
  // back to markup and direct collapses onto billed.
1113
1113
  const lc = x.lecore || {};
1114
- log(`spill priced: ${x.pricing} · corpus ${lc.corpusTokens ?? '?'} tok vs sent ${lc.tokensBefore ?? '?'} -> ${lc.tokensAfter ?? '?'} · billed ${(x.billedUsd ?? 0).toFixed(5)} direct ${(x.directUsd ?? 0).toFixed(5)}`);
1114
+ // counterfactualTokensUsed is the basis the gateway ACTUALLY priced
1115
+ // on. lecore.corpusTokens is often absent and reading it printed
1116
+ // 'corpus ?' on calls that were pricing fine — which sent a whole
1117
+ // night's debugging after a number that was never the input.
1118
+ const basis = x.counterfactualTokensUsed ?? lc.corpusTokens;
1119
+ log(`spill priced: ${x.pricing} · basis ${basis ?? '?'} tok vs sent ${lc.tokensBefore ?? '?'} -> ${lc.tokensAfter ?? '?'} · billed ${(x.billedUsd ?? 0).toFixed(5)} direct ${(x.directUsd ?? 0).toFixed(5)}`);
1115
1120
  spillSpend += x.billedUsd;
1116
1121
  spillDirect += typeof x.directUsd === 'number' ? x.directUsd : x.billedUsd;
1117
1122
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openzoo",
3
- "version": "0.48.40",
3
+ "version": "0.48.41",
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",