openzoo 0.12.0 → 0.12.2

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/proxy.js +18 -2
  2. package/package.json +1 -1
package/lib/proxy.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { readFileSync } from 'node:fs';
1
2
  import http from 'node:http';
2
3
  import crypto from 'node:crypto';
3
4
  import { Readable } from 'node:stream';
@@ -11,6 +12,7 @@ import { bindCorpus, contextCacheDisabled, BIND_MIN_CHARS } from './hrr.js';
11
12
  import { maybeRewriteModel, rewritablePath, augmentModelList, ALIAS_IDS } from './models.js';
12
13
  import { forgetContext } from './contexts.js';
13
14
  import { injectBrief } from './brief.js';
15
+ import { withNamespace } from './namespace.js';
14
16
 
15
17
  const HOP_BY_HOP = new Set([
16
18
  'host', 'connection', 'keep-alive', 'transfer-encoding', 'upgrade',
@@ -45,7 +47,13 @@ function upstreamHeaders(req) {
45
47
  for (const [k, v] of Object.entries(req.headers)) {
46
48
  if (!HOP_BY_HOP.has(k.toLowerCase())) out[k] = v;
47
49
  }
48
- return out;
50
+ // EVERY forwarded request carries this wallet's context namespace, not just
51
+ // the ones PayClient builds itself. Without it a bind sent THROUGH the proxy
52
+ // (an agent posting to /v1/hrr/bind) landed in the shared tenant while the
53
+ // chat that referenced it looked in the wallet's tenant — the context was
54
+ // unreachable and every spill bind came back 400, silently forwarding the
55
+ // whole body at full price.
56
+ return withNamespace(out);
49
57
  }
50
58
 
51
59
  async function readBody(req) {
@@ -525,7 +533,15 @@ export async function startProxy({ silent = false, requireToken = null, sessionM
525
533
  });
526
534
 
527
535
  if (!silent) {
528
- console.log(`openzoo proxy -> ${config.apiBase}`);
536
+ // VERSION IN THE BANNER, deliberately. `npx openzoo` can serve a STALE
537
+ // cached copy — npx reuses a cache entry that matches the bare spec, so a
538
+ // user running the newest published version still gets old behaviour and
539
+ // no clue why (observed: a missing tunnel and a missing token row, both
540
+ // "fixed" releases ago). Printing the version makes that one glance.
541
+ const { version } = JSON.parse(
542
+ readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
543
+ );
544
+ console.log(`openzoo v${version} -> ${config.apiBase}`);
529
545
  console.log(`listening on http://localhost:${config.port}/v1`);
530
546
  console.log('');
531
547
  if (client.walletCreated) console.log(`new burner wallet created at ${client.walletPath} (chmod 600)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openzoo",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
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",