@rulvar/anthropic 1.29.0 → 1.30.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.
Files changed (2) hide show
  1. package/dist/index.js +10 -9
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -614,17 +614,18 @@ async function* mapAnthropicStream(stream, ids, options) {
614
614
  */
615
615
  const MAX_RETRY_AFTER_MS = 2147483647;
616
616
  /**
617
- * Parses a Retry-After header into milliseconds. Only the delta
618
- * seconds form is honored: the HTTP date form and any other
619
- * unparsable value return undefined so the engine falls back to its
620
- * computed policy backoff instead of receiving NaN, and a huge but
621
- * finite value is clamped to the Node timer maximum (v1.28.0 review
622
- * P2).
617
+ * Parses a Retry-After header into milliseconds. Only the RFC delta
618
+ * seconds grammar is honored: after trimming optional whitespace the
619
+ * value must be a nonempty run of decimal digits, so the HTTP date
620
+ * form, signs, decimals, hex, exponents, and empty values all return
621
+ * undefined and the engine falls back to its computed policy backoff
622
+ * (v1.29.0 review P3; `Number()` alone accepted every one of those).
623
+ * A huge digit run is clamped to the Node timer maximum.
623
624
  */
624
625
  function retryAfterMsFrom(header) {
625
- const seconds = Number(header);
626
- if (!Number.isFinite(seconds) || seconds < 0) return;
627
- return Math.min(Math.round(seconds * 1e3), MAX_RETRY_AFTER_MS);
626
+ const trimmed = header.trim();
627
+ if (!/^[0-9]+$/.test(trimmed)) return;
628
+ return Math.min(Number(trimmed) * 1e3, MAX_RETRY_AFTER_MS);
628
629
  }
629
630
  /**
630
631
  * Projects an SDK/API error into the retryable WireError vocabulary:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/anthropic",
3
- "version": "1.29.0",
3
+ "version": "1.30.0",
4
4
  "description": "Rulvar first-class provider adapter over @anthropic-ai/sdk.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -23,13 +23,13 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@anthropic-ai/sdk": "^0.110.0",
26
- "@rulvar/core": "1.29.0"
26
+ "@rulvar/core": "1.30.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.29.0"
32
+ "@rulvar/testing": "1.30.0"
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",