openzoo 0.50.83 → 0.50.85

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.
@@ -3012,7 +3012,16 @@ async function zooComplete(prompt, log, agentId, parsed = {}, opts = {}) {
3012
3012
  : userContent,
3013
3013
  });
3014
3014
 
3015
- const maxTok = Number(process.env.OPENZOO_ASK_MAX_TOKENS || 8192);
3015
+ // 8192 was a ceiling for one-line asks. A reasoning model spends most of it
3016
+ // thinking and returns nothing (finish=length, 0 visible — measured
3017
+ // 2026-09-02, seven times in a row). Default 32768, clamped to what the
3018
+ // catalog says this model can emit so no provider rejects the request.
3019
+ let maxTok = Number(process.env.OPENZOO_ASK_MAX_TOKENS || 32768);
3020
+ try {
3021
+ const row = await zooModelRow(model);
3022
+ const cap = Number(row?.max_output_tokens ?? row?.top_provider?.max_completion_tokens ?? 0);
3023
+ if (Number.isFinite(cap) && cap > 0 && cap < maxTok) maxTok = cap;
3024
+ } catch { /* catalog unreachable: keep the default */ }
3016
3025
  const maxSteps = Math.min(64, Math.max(8, Number(process.env.OPENZOO_ASK_TOOL_STEPS || 32)));
3017
3026
  let lastData = {};
3018
3027
  let turnX402 = {};
package/lib/models.js CHANGED
@@ -398,8 +398,13 @@ export function augmentModelList(payload, { aliases: withAliases = true } = {})
398
398
  }
399
399
  }
400
400
 
401
- // Auto is no longer published: routing lives on the backend, and a shim
402
- // that advertises openzoo/auto would have to route it.
401
+ // CONTRACT (clarified 2026-09-02, prompted by a downstream reviewer reading
402
+ // the old comment here as "auto is gone"): the SHIM no longer mints an auto
403
+ // row of its own — routing lives on the backend — but the backend's catalog
404
+ // still carries `openzoo/auto` / `openzoo-auto` / `auto`, they pass through
405
+ // `data` untouched, and the gateway routes them on the wire. Measured on
406
+ // 0.50.84: /v1/models lists all three, and a paid `model:"auto"` completion
407
+ // returns 200. Integrators may rely on auto being published and routed.
403
408
  return { ...payload, object: payload?.object || 'list', data: [...data, ...aliases, ...bare, ...family] };
404
409
  }
405
410
 
package/lib/x402.js CHANGED
@@ -120,12 +120,22 @@ export function paymentHeaders(header) {
120
120
  return { 'PAYMENT-SIGNATURE': header, 'X-PAYMENT': header };
121
121
  }
122
122
 
123
- const EVM_NAME_CHAINS = { base: 8453, 'base-sepolia': 84532 };
123
+ const EVM_NAME_CHAINS = { base: 8453, 'base-sepolia': 84532, polygon: 137, avalanche: 43114 };
124
+ /** x402 v1 network names → CAIP-2. A v1-style 402 says "solana"/"base"; our
125
+ * facilitator's /nonce and the gateway's verify speak CAIP-2. Either form is
126
+ * accepted here so a seller can switch its v1 body to v1 names without
127
+ * stranding this client. */
128
+ const V1_TO_CAIP2 = {
129
+ solana: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
130
+ 'solana-devnet': 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
131
+ base: 'eip155:8453', 'base-sepolia': 'eip155:84532', polygon: 'eip155:137', avalanche: 'eip155:43114',
132
+ };
133
+ export function toCaip2(network) { return V1_TO_CAIP2[network] || network || ''; }
124
134
 
125
135
  /** Which rail an accepts[] row settles on: 'solana' | 'base' | 'robinhood' | 'evm' | null. */
126
136
  export function railOf(accept) {
127
137
  const net = accept?.network || '';
128
- if (net.startsWith('solana:')) return 'solana';
138
+ if (net.startsWith('solana:') || net === 'solana' || net === 'solana-devnet') return 'solana';
129
139
  const m = /^eip155:(\d+)$/.exec(net);
130
140
  const chainId = m ? Number(m[1]) : EVM_NAME_CHAINS[net];
131
141
  if (chainId === 8453 || chainId === 84532) return 'base';
@@ -385,7 +395,7 @@ export async function buildPaymentOnline(connection, keypair, accept) {
385
395
  // OPENZOO_NONCE=0 is the kill switch back to recent blockhashes.
386
396
  if (facilitator && process.env.OPENZOO_NONCE !== '0') {
387
397
  try {
388
- const r = await fetch(`${facilitator}/nonce?network=${encodeURIComponent(accept.network)}`, {
398
+ const r = await fetch(`${facilitator}/nonce?network=${encodeURIComponent(toCaip2(accept.network))}`, {
389
399
  signal: AbortSignal.timeout(4000),
390
400
  });
391
401
  if (r.ok) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openzoo",
3
- "version": "0.50.83",
3
+ "version": "0.50.85",
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",