openzoo 0.50.32 → 0.50.34
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/fetch.js +10 -7
- package/package.json +1 -1
package/lib/fetch.js
CHANGED
|
@@ -3,17 +3,20 @@
|
|
|
3
3
|
*
|
|
4
4
|
* A hung keep-alive (no headers) must not pin an undici socket forever —
|
|
5
5
|
* that is what wedged GET /v1/session (LISTEN up, HTTP 000) while a
|
|
6
|
-
* brainRace of 4 sat on the same pool.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* brainRace of 4 sat on the same pool. Default 10 minutes: settle + a long
|
|
7
|
+
* grok turn can exceed 2 minutes before Fly writes status (measured: proxy
|
|
8
|
+
* aborted "This operation was aborted" after hijack timeout was already
|
|
9
|
+
* raised). Once headers arrive, the body may stream for as long as generation
|
|
10
|
+
* takes. Do not set fetch `family` here; Happy Eyeballs + ipv4first live in
|
|
11
|
+
* bin/openzoo.js.
|
|
9
12
|
*/
|
|
10
|
-
export const HEADERS_MS = Number(process.env.OPENZOO_UPSTREAM_HEADERS_MS ||
|
|
13
|
+
export const HEADERS_MS = Number(process.env.OPENZOO_UPSTREAM_HEADERS_MS || 10 * 60_000);
|
|
11
14
|
export const UPSTREAM_HEADERS_MS = HEADERS_MS;
|
|
12
15
|
export const CREDIT_TIMEOUT_MS = Number(process.env.OPENZOO_CREDIT_TIMEOUT_MS || 2_500);
|
|
13
16
|
|
|
14
17
|
export function headersMs() {
|
|
15
|
-
const n = Number(process.env.OPENZOO_UPSTREAM_HEADERS_MS ||
|
|
16
|
-
return Number.isFinite(n) && n > 0 ? n :
|
|
18
|
+
const n = Number(process.env.OPENZOO_UPSTREAM_HEADERS_MS || 10 * 60_000);
|
|
19
|
+
return Number.isFinite(n) && n > 0 ? n : 10 * 60_000;
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
function mergeSignal(existing, timeout) {
|
|
@@ -30,7 +33,7 @@ function mergeSignal(existing, timeout) {
|
|
|
30
33
|
/** fetch that aborts if headers have not arrived in `ms`, then lets the stream run. */
|
|
31
34
|
export async function fetchHeaders(url, init = {}, ms = headersMs()) {
|
|
32
35
|
const ac = new AbortController();
|
|
33
|
-
const timer = setTimeout(() => ac.abort(), ms);
|
|
36
|
+
const timer = setTimeout(() => ac.abort(new Error(`upstream headers not in ${ms}ms`)), ms);
|
|
34
37
|
timer.unref?.();
|
|
35
38
|
try {
|
|
36
39
|
const res = await fetch(url, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openzoo",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.34",
|
|
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",
|