@oh-my-pi/pi-ai 12.19.0 → 12.19.3
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/CHANGELOG.md +10 -0
- package/package.json +20 -20
- package/src/providers/anthropic.ts +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [12.19.1] - 2026-02-22
|
|
6
|
+
### Added
|
|
7
|
+
|
|
8
|
+
- Exported `isProviderRetryableError` function for detecting rate-limit and transient stream errors
|
|
9
|
+
- Support for retrying malformed JSON stream-envelope parse errors from Anthropic-compatible proxy endpoints
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Expanded retry detection to include JSON parse errors (unterminated strings, unexpected end of input) in addition to rate-limit errors
|
|
14
|
+
|
|
5
15
|
## [12.19.0] - 2026-02-22
|
|
6
16
|
### Added
|
|
7
17
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-ai",
|
|
4
|
-
"version": "12.19.
|
|
4
|
+
"version": "12.19.3",
|
|
5
5
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
6
6
|
"homepage": "https://github.com/can1357/oh-my-pi",
|
|
7
|
-
"author": "Can
|
|
7
|
+
"author": "Can Boluk",
|
|
8
8
|
"contributors": [
|
|
9
9
|
"Mario Zechner"
|
|
10
10
|
],
|
|
@@ -37,26 +37,26 @@
|
|
|
37
37
|
"test": "bun test"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@anthropic-ai/sdk": "^0.
|
|
41
|
-
"@aws-sdk/client-bedrock-runtime": "^3.
|
|
42
|
-
"@bufbuild/protobuf": "^2.11
|
|
43
|
-
"@connectrpc/connect": "^2.1
|
|
44
|
-
"@connectrpc/connect-node": "^2.1
|
|
45
|
-
"@google/genai": "^1.
|
|
46
|
-
"@mistralai/mistralai": "^1.14
|
|
47
|
-
"@oh-my-pi/pi-utils": "12.19.
|
|
48
|
-
"@sinclair/typebox": "^0.34
|
|
49
|
-
"@smithy/node-http-handler": "^4.4
|
|
50
|
-
"ajv": "^8.18
|
|
51
|
-
"ajv-formats": "^3.0
|
|
52
|
-
"chalk": "^5.6
|
|
53
|
-
"openai": "^6.22
|
|
54
|
-
"partial-json": "^0.1
|
|
55
|
-
"zod": "^4.3
|
|
56
|
-
"zod-to-json-schema": "^3.25
|
|
40
|
+
"@anthropic-ai/sdk": "^0.78",
|
|
41
|
+
"@aws-sdk/client-bedrock-runtime": "^3.995",
|
|
42
|
+
"@bufbuild/protobuf": "^2.11",
|
|
43
|
+
"@connectrpc/connect": "^2.1",
|
|
44
|
+
"@connectrpc/connect-node": "^2.1",
|
|
45
|
+
"@google/genai": "^1.42",
|
|
46
|
+
"@mistralai/mistralai": "^1.14",
|
|
47
|
+
"@oh-my-pi/pi-utils": "12.19.3",
|
|
48
|
+
"@sinclair/typebox": "^0.34",
|
|
49
|
+
"@smithy/node-http-handler": "^4.4",
|
|
50
|
+
"ajv": "^8.18",
|
|
51
|
+
"ajv-formats": "^3.0",
|
|
52
|
+
"chalk": "^5.6",
|
|
53
|
+
"openai": "^6.22",
|
|
54
|
+
"partial-json": "^0.1",
|
|
55
|
+
"zod": "^4.3",
|
|
56
|
+
"zod-to-json-schema": "^3.25"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@types/bun": "^1.3
|
|
59
|
+
"@types/bun": "^1.3"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
62
|
"bun": ">=1.3.7"
|
|
@@ -285,13 +285,19 @@ const PROVIDER_MAX_RETRIES = 3;
|
|
|
285
285
|
const PROVIDER_BASE_DELAY_MS = 2000;
|
|
286
286
|
|
|
287
287
|
/**
|
|
288
|
-
* Check if an error from the Anthropic SDK is a rate-limit
|
|
289
|
-
*
|
|
288
|
+
* Check if an error from the Anthropic SDK is a rate-limit/transient error that
|
|
289
|
+
* should be retried before any content has been emitted.
|
|
290
|
+
*
|
|
291
|
+
* Includes malformed JSON stream-envelope parse errors seen from some
|
|
292
|
+
* Anthropic-compatible proxy endpoints.
|
|
290
293
|
*/
|
|
291
|
-
function isProviderRetryableError(error: unknown): boolean {
|
|
294
|
+
export function isProviderRetryableError(error: unknown): boolean {
|
|
292
295
|
if (!(error instanceof Error)) return false;
|
|
293
296
|
const msg = error.message;
|
|
294
|
-
return
|
|
297
|
+
return (
|
|
298
|
+
/rate.?limit|too many requests|overloaded|service.?unavailable|1302/i.test(msg) ||
|
|
299
|
+
/json parse error|unterminated string|unexpected end of json input/i.test(msg)
|
|
300
|
+
);
|
|
295
301
|
}
|
|
296
302
|
|
|
297
303
|
export const streamAnthropic: StreamFunction<"anthropic-messages"> = (
|