openzoo 0.50.82 → 0.50.84

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.
@@ -1641,7 +1641,12 @@ export function foldSameRole(messages) {
1641
1641
  messages = (Array.isArray(messages) ? messages : []).map((m) => {
1642
1642
  if (!m || m.role !== 'assistant') return m;
1643
1643
  const out = {};
1644
- for (const [k, v] of Object.entries(m)) if (ASSISTANT_KEYS.has(k)) out[k] = v;
1644
+ for (const [k, v] of Object.entries(m)) {
1645
+ if (!ASSISTANT_KEYS.has(k)) continue;
1646
+ if (k === 'name' && (typeof v !== 'string' || !v)) continue; // name:null is an echo, not a name
1647
+ if (k === 'tool_calls' && !(Array.isArray(v) && v.length)) continue;
1648
+ out[k] = v;
1649
+ }
1645
1650
  if (out.content === undefined && !out.tool_calls) out.content = '';
1646
1651
  if (out.content === null && out.tool_calls) delete out.content;
1647
1652
  return out;
@@ -3007,7 +3012,16 @@ async function zooComplete(prompt, log, agentId, parsed = {}, opts = {}) {
3007
3012
  : userContent,
3008
3013
  });
3009
3014
 
3010
- 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 */ }
3011
3025
  const maxSteps = Math.min(64, Math.max(8, Number(process.env.OPENZOO_ASK_TOOL_STEPS || 32)));
3012
3026
  let lastData = {};
3013
3027
  let turnX402 = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openzoo",
3
- "version": "0.50.82",
3
+ "version": "0.50.84",
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",