openzoo 0.48.56 → 0.48.57
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/proxy.js +16 -5
- package/package.json +1 -1
package/lib/proxy.js
CHANGED
|
@@ -406,7 +406,12 @@ async function spillTranscript(body, log, req) {
|
|
|
406
406
|
// saving — a bigger tail is a bigger `sent` — and that is the correct trade:
|
|
407
407
|
// measured 8.13x on the fleet leaves room to spend some of it on an agent
|
|
408
408
|
// that remembers its own last few moves.
|
|
409
|
-
|
|
409
|
+
// 12 was set while the model was ALSO missing its own last turn to a brief
|
|
410
|
+
// spliced in behind it (fixed in 0.48.56), so part of that floor was paying
|
|
411
|
+
// for a bug rather than for coherence. 6 turns still covers "what did I just
|
|
412
|
+
// do" — the case retrieval cannot answer, because the model does not know to
|
|
413
|
+
// query for it — and hands the rest back as saving.
|
|
414
|
+
const minTurns = Number(process.env.OPENZOO_TAIL_MIN_TURNS || 6);
|
|
410
415
|
if (msgs.length - cut < minTurns) {
|
|
411
416
|
for (let i = Math.max(firstSpillable + 1, msgs.length - minTurns); i > firstSpillable; i--) {
|
|
412
417
|
if (severable(i)) { cut = i; break; }
|
|
@@ -534,12 +539,18 @@ async function spillTranscript(body, log, req) {
|
|
|
534
539
|
// far less context than a detailed one — and is clamped so a huge ask cannot
|
|
535
540
|
// drag the whole corpus back in.
|
|
536
541
|
const askChars = msgText(msgs[msgs.length - 1] || {}).length;
|
|
542
|
+
// BREADTH IS THE LEVER, AND MORE OF IT IS WORSE. MEASURED on a 56,265-token
|
|
543
|
+
// corpus: top_k 32 handed back 9,990 tokens and scored 2.45x, top_k 8 handed
|
|
544
|
+
// back 2,574 and scored 4.73x — same question, same answer, nearly double the
|
|
545
|
+
// saving. Spilling 34k tokens to recall 22k of them back is a round trip, not
|
|
546
|
+
// a saving. So budget the recall tighter and cap k where the measurement says
|
|
547
|
+
// the value is, rather than at the largest number that still fits.
|
|
537
548
|
const budget = Math.min(
|
|
538
|
-
Number(process.env.OPENZOO_RECALL_MAX_TOKENS ||
|
|
539
|
-
Math.max(Number(process.env.OPENZOO_RECALL_MIN_TOKENS ||
|
|
540
|
-
Math.round(askChars /
|
|
549
|
+
Number(process.env.OPENZOO_RECALL_MAX_TOKENS || 3000),
|
|
550
|
+
Math.max(Number(process.env.OPENZOO_RECALL_MIN_TOKENS || 1200),
|
|
551
|
+
Math.round(askChars / 3)),
|
|
541
552
|
);
|
|
542
|
-
const topK = Math.max(4, Math.min(
|
|
553
|
+
const topK = Math.max(4, Math.min(12, Math.round(budget / 320)));
|
|
543
554
|
|
|
544
555
|
return {
|
|
545
556
|
body: Buffer.from(JSON.stringify({ ...body, messages: [...head, ...msgs.slice(cut)] })),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openzoo",
|
|
3
|
-
"version": "0.48.
|
|
3
|
+
"version": "0.48.57",
|
|
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",
|