@rulvar/openai 1.29.0 → 1.31.0
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/dist/index.js +13 -9
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -541,17 +541,21 @@ function failedResponseError(code, message) {
|
|
|
541
541
|
*/
|
|
542
542
|
const MAX_RETRY_AFTER_MS = 2147483647;
|
|
543
543
|
/**
|
|
544
|
-
* Parses a Retry-After header into milliseconds. Only the delta
|
|
545
|
-
* seconds
|
|
546
|
-
*
|
|
547
|
-
*
|
|
548
|
-
*
|
|
549
|
-
*
|
|
544
|
+
* Parses a Retry-After header into milliseconds. Only the RFC delta
|
|
545
|
+
* seconds grammar is honored: a nonempty run of decimal digits padded
|
|
546
|
+
* by HTTP optional whitespace at most (OWS is space and horizontal
|
|
547
|
+
* tab, nothing else), so the HTTP date form, signs, decimals, hex,
|
|
548
|
+
* exponents, and empty values all return undefined and the engine
|
|
549
|
+
* falls back to its computed policy backoff (v1.29.0 review P3;
|
|
550
|
+
* `Number()` alone accepted every one of those). ECMAScript trim()
|
|
551
|
+
* was wider than OWS and let newline, carriage return, vertical tab,
|
|
552
|
+
* form feed, and NBSP padded values through (v1.30.0 review P3). A
|
|
553
|
+
* huge digit run is clamped to the Node timer maximum.
|
|
550
554
|
*/
|
|
551
555
|
function retryAfterMsFrom(header) {
|
|
552
|
-
const
|
|
553
|
-
if (
|
|
554
|
-
return Math.min(
|
|
556
|
+
const match = /^[\t ]*([0-9]+)[\t ]*$/.exec(header);
|
|
557
|
+
if (match === null) return;
|
|
558
|
+
return Math.min(Number(match[1]) * 1e3, MAX_RETRY_AFTER_MS);
|
|
555
559
|
}
|
|
556
560
|
/** Projects SDK/API errors into the retryable WireError vocabulary. */
|
|
557
561
|
function openAiErrorToWire(error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/openai",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"description": "Rulvar first-class provider adapter for the OpenAI Responses API, plus the openaiCompatible factory.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"openai": "^6.45.0",
|
|
26
|
-
"@rulvar/core": "1.
|
|
26
|
+
"@rulvar/core": "1.31.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^22.20.0",
|
|
30
30
|
"tsdown": "^0.22.3",
|
|
31
31
|
"typescript": "~6.0.3",
|
|
32
|
-
"@rulvar/testing": "1.
|
|
32
|
+
"@rulvar/testing": "1.31.0"
|
|
33
33
|
},
|
|
34
34
|
"repository": {
|
|
35
35
|
"type": "git",
|