@slopus/happy-providers 0.0.14 → 0.0.15
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/README.md
CHANGED
|
@@ -55,9 +55,9 @@ application.
|
|
|
55
55
|
|
|
56
56
|
## Installing
|
|
57
57
|
|
|
58
|
-
This is an ESM-only
|
|
59
|
-
filesystem, and networking APIs, so it won't run in browsers, bundlers targeting the
|
|
60
|
-
runtimes, or React Native. The package manifest sets `browser` to `false` on purpose.
|
|
58
|
+
This is an ESM-only server-side library for Node 22.19 and newer or Bun 1.4 and newer. It needs
|
|
59
|
+
real process, filesystem, and networking APIs, so it won't run in browsers, bundlers targeting the
|
|
60
|
+
browser, edge runtimes, or React Native. The package manifest sets `browser` to `false` on purpose.
|
|
61
61
|
|
|
62
62
|
```sh
|
|
63
63
|
pnpm add @slopus/happy-providers @steve.kite/stdlib
|
package/VENDOR_GROK.md
CHANGED
|
@@ -176,6 +176,13 @@ traffic in `grok-4-5-x-search.sse.json` and `grok-4-5-web-search.sse.json`, and
|
|
|
176
176
|
|
|
177
177
|
## Inference request
|
|
178
178
|
|
|
179
|
+
On Node, the Grok connection pairs Undici's `fetch` with an Undici `Agent` so requests reuse a
|
|
180
|
+
pooled HTTP/2 connection and a transport retry can rebuild it as HTTP/1. Bun exposes an `undici`
|
|
181
|
+
compatibility module whose `Agent` does not implement the dispatcher lifecycle. The client checks
|
|
182
|
+
for the real `dispatch` and `close` capabilities before using that path; when they are absent it
|
|
183
|
+
uses the runtime's native `fetch`, which Bun owns and cleans up itself. This keeps Node's explicit
|
|
184
|
+
connection lifecycle without calling missing Undici methods under Bun.
|
|
185
|
+
|
|
179
186
|
`impl/createGrokOpenAIRequest.ts` sends:
|
|
180
187
|
|
|
181
188
|
- `model: "grok-4.5"`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGrokOpenAIClient.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/grok/impl/createGrokOpenAIClient.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC;IAC/D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,gBAAgB,
|
|
1
|
+
{"version":3,"file":"createGrokOpenAIClient.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/grok/impl/createGrokOpenAIClient.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC;IAC/D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,gBAAgB,CA4BnB"}
|
|
@@ -6,16 +6,23 @@ export function createGrokOpenAIClient(options) {
|
|
|
6
6
|
keepAliveTimeout: 60_000,
|
|
7
7
|
keepAliveMaxTimeout: 600_000,
|
|
8
8
|
});
|
|
9
|
+
const runtimeDispatcher = dispatcher;
|
|
10
|
+
const supportsUndiciDispatcher = typeof runtimeDispatcher.dispatch === "function" &&
|
|
11
|
+
typeof runtimeDispatcher.close === "function";
|
|
9
12
|
const client = new OpenAI({
|
|
10
13
|
apiKey: options.token,
|
|
11
14
|
baseURL: options.baseUrl,
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
...(supportsUndiciDispatcher
|
|
16
|
+
? {
|
|
17
|
+
fetch: fetch,
|
|
18
|
+
fetchOptions: { dispatcher },
|
|
19
|
+
}
|
|
20
|
+
: {}),
|
|
14
21
|
maxRetries: 0,
|
|
15
22
|
});
|
|
16
23
|
return {
|
|
17
24
|
responses: client.responses,
|
|
18
|
-
close: () => dispatcher.close(),
|
|
25
|
+
close: supportsUndiciDispatcher ? () => dispatcher.close() : async () => { },
|
|
19
26
|
};
|
|
20
27
|
}
|
|
21
28
|
//# sourceMappingURL=createGrokOpenAIClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGrokOpenAIClient.js","sourceRoot":"","sources":["../../../../sources/vendors/grok/impl/createGrokOpenAIClient.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAMtC,MAAM,UAAU,sBAAsB,CAAC,OAItC;IACG,MAAM,UAAU,GAAG,IAAI,KAAK,CAAC;QACzB,OAAO,EAAE,OAAO,CAAC,UAAU,KAAK,IAAI;QACpC,gBAAgB,EAAE,MAAM;QACxB,mBAAmB,EAAE,OAAO;KAC/B,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;QACtB,MAAM,EAAE,OAAO,CAAC,KAAK;QACrB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,KAAK,EAAE,KAA2C;
|
|
1
|
+
{"version":3,"file":"createGrokOpenAIClient.js","sourceRoot":"","sources":["../../../../sources/vendors/grok/impl/createGrokOpenAIClient.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAMtC,MAAM,UAAU,sBAAsB,CAAC,OAItC;IACG,MAAM,UAAU,GAAG,IAAI,KAAK,CAAC;QACzB,OAAO,EAAE,OAAO,CAAC,UAAU,KAAK,IAAI;QACpC,gBAAgB,EAAE,MAAM;QACxB,mBAAmB,EAAE,OAAO;KAC/B,CAAC,CAAC;IACH,MAAM,iBAAiB,GAAG,UAGzB,CAAC;IACF,MAAM,wBAAwB,GAC1B,OAAO,iBAAiB,CAAC,QAAQ,KAAK,UAAU;QAChD,OAAO,iBAAiB,CAAC,KAAK,KAAK,UAAU,CAAC;IAClD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;QACtB,MAAM,EAAE,OAAO,CAAC,KAAK;QACrB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,GAAG,CAAC,wBAAwB;YACxB,CAAC,CAAC;gBACI,KAAK,EAAE,KAA2C;gBAClD,YAAY,EAAE,EAAE,UAAU,EAAW;aACxC;YACH,CAAC,CAAC,EAAE,CAAC;QACT,UAAU,EAAE,CAAC;KAChB,CAAC,CAAC;IACH,OAAO;QACH,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,KAAK,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,GAAE,CAAC;KAC9E,CAAC;AACN,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slopus/happy-providers",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "Stateful Node.js sessions for Codex, Claude, Grok, Bedrock, and Responses-compatible model providers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -70,11 +70,13 @@
|
|
|
70
70
|
"@anthropic-ai/claude-agent-sdk-win32-x64": "^0.3.226"
|
|
71
71
|
},
|
|
72
72
|
"engines": {
|
|
73
|
+
"bun": ">=1.4.0",
|
|
73
74
|
"node": ">=22.19.0"
|
|
74
75
|
},
|
|
75
76
|
"scripts": {
|
|
76
77
|
"build": "node --eval \"import('node:fs/promises').then(({ rm }) => rm('dist', { force: true, recursive: true }))\" && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
77
78
|
"check": "tsc --noEmit",
|
|
78
|
-
"test": "vitest run --passWithNoTests"
|
|
79
|
+
"test": "vitest run --passWithNoTests && pnpm run test:bun",
|
|
80
|
+
"test:bun": "bun tests/bun/grokOpenAIClient.bun.mjs && bun tests/bun/grokXSearch.bun.mjs"
|
|
79
81
|
}
|
|
80
82
|
}
|