@bastani/pi-ai 0.9.38-alpha.6 → 0.9.38-alpha.7

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 (42) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +5 -5
  3. package/dist/api/anthropic-messages.d.ts.map +1 -1
  4. package/dist/api/anthropic-messages.js +32 -23
  5. package/dist/api/anthropic-messages.js.map +1 -1
  6. package/dist/api/bedrock-converse-stream.js +14 -16
  7. package/dist/api/bedrock-converse-stream.js.map +1 -1
  8. package/dist/api/google-shared.js +1 -1
  9. package/dist/api/google-shared.js.map +1 -1
  10. package/dist/api/openai-codex-responses.d.ts +1 -0
  11. package/dist/api/openai-codex-responses.d.ts.map +1 -1
  12. package/dist/api/openai-codex-responses.js +2 -1
  13. package/dist/api/openai-codex-responses.js.map +1 -1
  14. package/dist/api/openai-completions.js +1 -1
  15. package/dist/api/openai-completions.js.map +1 -1
  16. package/dist/api/openai-responses-shared.js +1 -1
  17. package/dist/api/openai-responses-shared.js.map +1 -1
  18. package/dist/api/transform-messages.d.ts +16 -1
  19. package/dist/api/transform-messages.d.ts.map +1 -1
  20. package/dist/api/transform-messages.js +28 -15
  21. package/dist/api/transform-messages.js.map +1 -1
  22. package/dist/index.d.ts +1 -0
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +1 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/providers/compat-schema.d.ts +156 -0
  27. package/dist/providers/compat-schema.d.ts.map +1 -1
  28. package/dist/providers/compat-schema.js +4 -2
  29. package/dist/providers/compat-schema.js.map +1 -1
  30. package/dist/providers/data/.manifest.json +1 -1
  31. package/dist/providers/data/anthropic.json +1 -1
  32. package/dist/providers/data/opencode.json +1 -1
  33. package/dist/providers/data/openrouter.json +1 -1
  34. package/dist/providers/data/radius.json +1 -1
  35. package/dist/providers/data/vercel-ai-gateway.json +1 -1
  36. package/dist/providers/model-schema.d.ts.map +1 -1
  37. package/dist/providers/model-schema.js +4 -2
  38. package/dist/providers/model-schema.js.map +1 -1
  39. package/dist/utils/retry.d.ts.map +1 -1
  40. package/dist/utils/retry.js +7 -1
  41. package/dist/utils/retry.js.map +1 -1
  42. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"model-schema.d.ts","sourceRoot":"","sources":["../../src/providers/model-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAuB,IAAI,EAAE,MAAM,SAAS,CAAC;AAEjE,eAAO,MAAM,eAAe,YAAI,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAU,CAAC;AAC7F,eAAO,MAAM,qBAAqB,sEAAuC,CAAC;AAC1E,eAAO,MAAM,sBAAsB,YAAI,MAAM,EAAE,OAAO,EAAE,KAAK,CAAU,CAAC;AACxE,eAAO,MAAM,gBAAgB,YAAI,MAAM,EAAE,OAAO,EAAE,MAAM,CAAU,CAAC;AACnE,eAAO,MAAM,6BAA6B,YAAI,OAAO,EAAE,MAAM,CAAU,CAAC;AAExE,eAAO,MAAM,mBAAmB,kEAA6B,CAAC;AAC9D,eAAO,MAAM,wBAAwB,yEAAmC,CAAC;AACzE,eAAO,MAAM,wBAAwB,sCAAoC,CAAC;AAC1E,eAAO,MAAM,oBAAoB,uCAA8B,CAAC;AAGhE,eAAO,MAAM,sBAAsB;;;;;;;;EAAmF,CAAC;AAEvH,eAAO,MAAM,sBAAsB;;;EAMlC,CAAC;AASF,eAAO,MAAM,oBAAoB;;;;;EAAwC,CAAC;AAC1E,eAAO,MAAM,mBAAmB;;;;;;EAK9B,CAAC;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;EAO1B,CAAC;AAgBH,eAAO,MAAM,6BAA6B;;;;;EAA4B,CAAC;AAEvE,eAAO,MAAM,2BAA2B;;;;;;;;;EAYtC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;EAKjC,CAAC;AAEH,M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,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC;AACvD,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACnF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAC/E,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -9,9 +9,11 @@ export const ModelThinkingLevelSchema = Type.Enum(MODEL_THINKING_LEVELS);
9
9
  export const ModelInputModalitySchema = Type.Enum(MODEL_INPUT_MODALITIES);
10
10
  export const CacheRetentionSchema = Type.Enum(CACHE_RETENTIONS);
11
11
  const ThinkingLevelMapValueSchema = Type.Union([Type.String(), Type.Null()]);
12
- export const ThinkingLevelMapSchema = Type.Partial(Type.Record(ModelThinkingLevelSchema, ThinkingLevelMapValueSchema));
12
+ export const ThinkingLevelMapSchema = Type.Partial(Type.Record(ModelThinkingLevelSchema, ThinkingLevelMapValueSchema), {
13
+ description: "Provider value sent for each thinking level. null marks a level unsupported. Levels the model does not map use the provider's default value through high; xhigh and max are unsupported.",
14
+ });
13
15
  export const ModelPromptCacheSchema = Type.Partial(Type.Record(Type.Enum(MODEL_PROMPT_CACHE_RETENTIONS), Type.Number({ exclusiveMinimum: 0 })), {
14
- description: "Best-effort prompt cache lifetime in seconds for each retention tier. A missing tier means the lifetime is unknown, so Pi does not warm it.",
16
+ description: "Best-effort prompt cache lifetime in seconds for the short and long retention tiers. Atomic warms only tiers with a known lifetime.",
15
17
  });
16
18
  const ModelCostRatesProperties = {
17
19
  input: Type.Number({ description: "Input cost in USD per million tokens." }),
@@ -1 +1 @@
1
- {"version":3,"file":"model-schema.js","sourceRoot":"","sources":["../../src/providers/model-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,IAAI,EAAE,MAAM,SAAS,CAAC;AAEjE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAS,EAA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E,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,+CAA+C,EAAE,CAAC,CAC1F;QACD,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;KACtE,EACD,OAAO,CACP,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAG,uBAAuB,EAAE,CAAC;AAEvE,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC,MAAM,CAAC;IACtD,MAAM,EAAE,IAAI,CAAC,QAAQ,CACpB,uBAAuB,CAAC;QACvB,WAAW,EAAE,mFAAmF;KAChG,CAAC,CACF;IACD,aAAa,EAAE,IAAI,CAAC,QAAQ,CAC3B,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,kDAAkD,EAAE,CAAC,CAC7F;IACD,aAAa,EAAE,IAAI,CAAC,QAAQ,CAC3B,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,sDAAsD,EAAE,CAAC,CACjG;CACD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,MAAM,CAAC;IACjD,eAAe,EAAE,IAAI,CAAC,QAAQ,CAC7B,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,oDAAoD,EAAE,CAAC,CAC/F;IACD,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,2BAA2B,CAAC;CAClD,CAAC,CAAC","sourcesContent":["import { type Static, type TSchemaOptions, Type } from \"typebox\";\n\nexport const THINKING_LEVELS = [\"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"] as const;\nexport const MODEL_THINKING_LEVELS = [\"off\", ...THINKING_LEVELS] as const;\nexport const MODEL_INPUT_MODALITIES = [\"text\", \"image\", \"pdf\"] as const;\nexport const CACHE_RETENTIONS = [\"none\", \"short\", \"long\"] as const;\nexport const MODEL_PROMPT_CACHE_RETENTIONS = [\"short\", \"long\"] as const;\n\nexport const ThinkingLevelSchema = Type.Enum(THINKING_LEVELS);\nexport const ModelThinkingLevelSchema = Type.Enum(MODEL_THINKING_LEVELS);\nexport const ModelInputModalitySchema = Type.Enum(MODEL_INPUT_MODALITIES);\nexport const CacheRetentionSchema = Type.Enum(CACHE_RETENTIONS);\n\nconst ThinkingLevelMapValueSchema = Type.Union([Type.String(), Type.Null()]);\nexport const ThinkingLevelMapSchema = Type.Partial(Type.Record(ModelThinkingLevelSchema, ThinkingLevelMapValueSchema));\n\nexport const ModelPromptCacheSchema = Type.Partial(\n\tType.Record(Type.Enum(MODEL_PROMPT_CACHE_RETENTIONS), Type.Number({ exclusiveMinimum: 0 })),\n\t{\n\t\tdescription:\n\t\t\t\"Best-effort prompt cache lifetime in seconds for each retention tier. A missing tier means the lifetime is unknown, so Pi does not warm it.\",\n\t},\n);\n\nconst ModelCostRatesProperties = {\n\tinput: Type.Number({ description: \"Input cost in USD per million tokens.\" }),\n\toutput: Type.Number({ description: \"Output cost in USD per million tokens.\" }),\n\tcacheRead: Type.Number({ description: \"Cache-read cost in USD per million tokens.\" }),\n\tcacheWrite: Type.Number({ description: \"Cache-write cost in USD per million tokens.\" }),\n};\n\nexport const ModelCostRatesSchema = Type.Object(ModelCostRatesProperties);\nexport const ModelCostTierSchema = Type.Object({\n\tinputTokensAbove: Type.Number({\n\t\tdescription: \"Use this tier when total request input exceeds this token count.\",\n\t}),\n\t...ModelCostRatesProperties,\n});\nexport const ModelCostSchema = Type.Object({\n\t...ModelCostRatesProperties,\n\ttiers: Type.Optional(\n\t\tType.Array(ModelCostTierSchema, {\n\t\t\tdescription: \"Request-wide pricing tiers. The highest matching input threshold applies to the full request.\",\n\t\t}),\n\t),\n});\n\nfunction modelImageResizeOptions(options?: TSchemaOptions) {\n\treturn Type.Object(\n\t\t{\n\t\t\tmaxWidth: Type.Optional(Type.Integer({ minimum: 1 })),\n\t\t\tmaxHeight: Type.Optional(Type.Integer({ minimum: 1 })),\n\t\t\tmaxBytes: Type.Optional(\n\t\t\t\tType.Integer({ minimum: 1, description: \"Maximum base64-encoded payload size in bytes.\" }),\n\t\t\t),\n\t\t\tjpegQuality: Type.Optional(Type.Integer({ minimum: 1, maximum: 100 })),\n\t\t},\n\t\toptions,\n\t);\n}\n\nexport const ModelImageResizeOptionsSchema = modelImageResizeOptions();\n\nexport const ModelImageInputLimitsSchema = Type.Object({\n\tresize: Type.Optional(\n\t\tmodelImageResizeOptions({\n\t\t\tdescription: \"Cache-safe resize profile applied before a new image enters conversation history.\",\n\t\t}),\n\t),\n\tmaxPerMessage: Type.Optional(\n\t\tType.Integer({ minimum: 1, description: \"Maximum images accepted in one provider message.\" }),\n\t),\n\tmaxPerRequest: Type.Optional(\n\t\tType.Integer({ minimum: 1, description: \"Maximum images accepted across one provider request.\" }),\n\t),\n});\n\nexport const ModelInputLimitsSchema = Type.Object({\n\tmaxRequestBytes: Type.Optional(\n\t\tType.Integer({ minimum: 1, description: \"Maximum serialized provider request size in bytes.\" }),\n\t),\n\timages: Type.Optional(ModelImageInputLimitsSchema),\n});\n\nexport type ThinkingLevel = Static<typeof ThinkingLevelSchema>;\nexport type ModelThinkingLevel = Static<typeof ModelThinkingLevelSchema>;\nexport type ThinkingLevelMap = Static<typeof ThinkingLevelMapSchema>;\nexport type ModelInputModality = Static<typeof ModelInputModalitySchema>;\nexport type CacheRetention = Static<typeof CacheRetentionSchema>;\nexport type ModelPromptCache = Static<typeof ModelPromptCacheSchema>;\nexport type ModelCostRates = Static<typeof ModelCostRatesSchema>;\nexport type ModelCostTier = Static<typeof ModelCostTierSchema>;\nexport type ModelCost = Static<typeof ModelCostSchema>;\nexport type ModelImageResizeOptions = Static<typeof ModelImageResizeOptionsSchema>;\nexport type ModelImageInputLimits = Static<typeof ModelImageInputLimitsSchema>;\nexport type ModelInputLimits =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C,2BAA2B,CAAC;CAClD,CAAC,CAAC","sourcesContent":["import { type Static, type TSchemaOptions, Type } from \"typebox\";\n\nexport const THINKING_LEVELS = [\"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"] as const;\nexport const MODEL_THINKING_LEVELS = [\"off\", ...THINKING_LEVELS] as const;\nexport const MODEL_INPUT_MODALITIES = [\"text\", \"image\", \"pdf\"] as const;\nexport const CACHE_RETENTIONS = [\"none\", \"short\", \"long\"] as const;\nexport const MODEL_PROMPT_CACHE_RETENTIONS = [\"short\", \"long\"] as const;\n\nexport const ThinkingLevelSchema = Type.Enum(THINKING_LEVELS);\nexport const ModelThinkingLevelSchema = Type.Enum(MODEL_THINKING_LEVELS);\nexport const ModelInputModalitySchema = Type.Enum(MODEL_INPUT_MODALITIES);\nexport const CacheRetentionSchema = Type.Enum(CACHE_RETENTIONS);\n\nconst ThinkingLevelMapValueSchema = Type.Union([Type.String(), Type.Null()]);\nexport const ThinkingLevelMapSchema = Type.Partial(Type.Record(ModelThinkingLevelSchema, ThinkingLevelMapValueSchema), {\n\tdescription:\n\t\t\"Provider value sent for each thinking level. null marks a level unsupported. Levels the model does not map use the provider's default value through high; xhigh and max are unsupported.\",\n});\n\nexport const ModelPromptCacheSchema = Type.Partial(\n\tType.Record(Type.Enum(MODEL_PROMPT_CACHE_RETENTIONS), Type.Number({ exclusiveMinimum: 0 })),\n\t{\n\t\tdescription:\n\t\t\t\"Best-effort prompt cache lifetime in seconds for the short and long retention tiers. Atomic warms only tiers with a known lifetime.\",\n\t},\n);\n\nconst ModelCostRatesProperties = {\n\tinput: Type.Number({ description: \"Input cost in USD per million tokens.\" }),\n\toutput: Type.Number({ description: \"Output cost in USD per million tokens.\" }),\n\tcacheRead: Type.Number({ description: \"Cache-read cost in USD per million tokens.\" }),\n\tcacheWrite: Type.Number({ description: \"Cache-write cost in USD per million tokens.\" }),\n};\n\nexport const ModelCostRatesSchema = Type.Object(ModelCostRatesProperties);\nexport const ModelCostTierSchema = Type.Object({\n\tinputTokensAbove: Type.Number({\n\t\tdescription: \"Use this tier when total request input exceeds this token count.\",\n\t}),\n\t...ModelCostRatesProperties,\n});\nexport const ModelCostSchema = Type.Object({\n\t...ModelCostRatesProperties,\n\ttiers: Type.Optional(\n\t\tType.Array(ModelCostTierSchema, {\n\t\t\tdescription: \"Request-wide pricing tiers. The highest matching input threshold applies to the full request.\",\n\t\t}),\n\t),\n});\n\nfunction modelImageResizeOptions(options?: TSchemaOptions) {\n\treturn Type.Object(\n\t\t{\n\t\t\tmaxWidth: Type.Optional(Type.Integer({ minimum: 1 })),\n\t\t\tmaxHeight: Type.Optional(Type.Integer({ minimum: 1 })),\n\t\t\tmaxBytes: Type.Optional(\n\t\t\t\tType.Integer({ minimum: 1, description: \"Maximum base64-encoded payload size in bytes.\" }),\n\t\t\t),\n\t\t\tjpegQuality: Type.Optional(Type.Integer({ minimum: 1, maximum: 100 })),\n\t\t},\n\t\toptions,\n\t);\n}\n\nexport const ModelImageResizeOptionsSchema = modelImageResizeOptions();\n\nexport const ModelImageInputLimitsSchema = Type.Object({\n\tresize: Type.Optional(\n\t\tmodelImageResizeOptions({\n\t\t\tdescription: \"Cache-safe resize profile applied before a new image enters conversation history.\",\n\t\t}),\n\t),\n\tmaxPerMessage: Type.Optional(\n\t\tType.Integer({ minimum: 1, description: \"Maximum images accepted in one provider message.\" }),\n\t),\n\tmaxPerRequest: Type.Optional(\n\t\tType.Integer({ minimum: 1, description: \"Maximum images accepted across one provider request.\" }),\n\t),\n});\n\nexport const ModelInputLimitsSchema = Type.Object({\n\tmaxRequestBytes: Type.Optional(\n\t\tType.Integer({ minimum: 1, description: \"Maximum serialized provider request size in bytes.\" }),\n\t),\n\timages: Type.Optional(ModelImageInputLimitsSchema),\n});\n\nexport type ThinkingLevel = Static<typeof ThinkingLevelSchema>;\nexport type ModelThinkingLevel = Static<typeof ModelThinkingLevelSchema>;\nexport type ThinkingLevelMap = Static<typeof ThinkingLevelMapSchema>;\nexport type ModelInputModality = Static<typeof ModelInputModalitySchema>;\nexport type CacheRetention = Static<typeof CacheRetentionSchema>;\nexport type ModelPromptCache = Static<typeof ModelPromptCacheSchema>;\nexport type ModelCostRates = Static<typeof ModelCostRatesSchema>;\nexport type ModelCostTier = Static<typeof ModelCostTierSchema>;\nexport type ModelCost = Static<typeof ModelCostSchema>;\nexport type ModelImageResizeOptions = Static<typeof ModelImageResizeOptionsSchema>;\nexport type ModelImageInputLimits = Static<typeof ModelImageInputLimitsSchema>;\nexport type ModelInputLimits = Static<typeof ModelInputLimitsSchema>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/utils/retry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAwHpD;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,qFAAqF;IACrF,UAAU,EAAE,MAAM,CAAC;IACnB,0FAA0F;IAC1F,WAAW,EAAE,MAAM,CAAC;IACpB,sEAAsE;IACtE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,gCAAgC,QAAS,CAAC;AAEvD,wBAAgB,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,aAAa,GAAG,iBAAiB,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAIlH;AAED,KAAK,YAAY,GAAG,IAAI,CAAC,gBAAgB,EAAE,YAAY,GAAG,cAAc,GAAG,cAAc,CAAC,CAAC;AAE3F;;;GAGG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,aAAa,GAAG,iBAAiB,GAAG,iBAAiB,CAAC,EAChF,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,cAAc,CAAC,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,CAAC,CAAC;CACnG;AA0BD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,kBAAkB,CACvC,OAAO,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,EACxC,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,SAAS,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,gBAAgB,CAAC,CA4C3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAKxE"}
@@ -35,7 +35,8 @@ const RETRYABLE_PROVIDER_ERROR_PATTERN = buildProviderErrorPattern([
35
35
  "520",
36
36
  "\\b52[1-3]\\b",
37
37
  "524",
38
- "service.?unavailable",
38
+ // Also matches "The service is temporarily unavailable" (#10965).
39
+ "service.?(?:is.?)?(?:temporarily.?)?unavailable",
39
40
  "server.?error",
40
41
  "internal.?error",
41
42
  // Wrapper/provider text for transient upstream failures, including OpenRouter
@@ -43,6 +44,10 @@ const RETRYABLE_PROVIDER_ERROR_PATTERN = buildProviderErrorPattern([
43
44
  "provider.?returned.?(?:an.?)?error",
44
45
  "exceeded request buffer limit while retrying upstream",
45
46
  "unable to forward upstream",
47
+ "upstream.?request.?failed",
48
+ "upstream_stream_read_error",
49
+ "stream was interrupted",
50
+ "http/?2 stream failed",
46
51
  // Network, proxy, and fetch transport failures. This includes OpenAI Codex
47
52
  // raw-fetch failures such as "upstream connect", "connection refused", and
48
53
  // "reset before headers" (#733), plus OpenRouter connection drops (#3317).
@@ -54,6 +59,7 @@ const RETRYABLE_PROVIDER_ERROR_PATTERN = buildProviderErrorPattern([
54
59
  "connection.?reset",
55
60
  "other side closed",
56
61
  "fetch failed",
62
+ "request to \\S+ failed, reason:",
57
63
  "getaddrinfo",
58
64
  "ENOTFOUND",
59
65
  "EAI_AGAIN",
@@ -1 +1 @@
1
- {"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/utils/retry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AM,CAAC,CAAC;QAC9B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,SAAS,EAAE,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;YAC3E,IAAI,KAAK,YAAY,oBAAoB,EAAE,CAAC;gBAC3C,OAAO,EAAE,GAAG,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;YACxE,CAAC;YACD,MAAM,KAAK,CAAC;QACb,CAAC;QACD,MAAM,SAAS,EAAE,mBAAmB,EAAE,EAAE,CAAC;IAC1C,CAAC;AACF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAqB;IAC9D,IAAI,OAAO,CAAC,UAAU,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY;QAAE,OAAO,KAAK,CAAC;IAC1E,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAC1C,IAAI,0CAA0C,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,OAAO,KAAK,CAAC;IAChF,OAAO,gCAAgC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["import type { AssistantMessage } from \"../types.ts\";\n\nfunction buildProviderErrorPattern(patterns: readonly string[]): RegExp {\n\treturn new RegExp(patterns.join(\"|\"), \"i\");\n}\n\nconst NON_RETRYABLE_PROVIDER_LIMIT_ERROR_PATTERN = buildProviderErrorPattern([\n\t// OpenCode Go/free-tier limits returned as 429 JSON error types by OpenCode's\n\t// Zen API. These are subscription/account limits, not transient throttles.\n\t\"GoUsageLimitError\",\n\t\"FreeUsageLimitError\",\n\n\t// OpenCode Go subscription-limit text asks users to enable available-balance\n\t// usage after rolling/weekly/monthly limits are reached.\n\t\"Monthly usage limit reached\",\n\t\"available balance\",\n\n\t// Generic quota/budget/billing exhaustion. `insufficient_quota` is OpenAI's\n\t// quota/billing error code; the other strings cover common gateway wording.\n\t\"insufficient_quota\",\n\t\"out of budget\",\n\t\"quota exceeded\",\n\t\"billing\",\n\t\"subscription_sharing_usage_limit_exceeded\",\n]);\n\nconst RETRYABLE_PROVIDER_ERROR_PATTERN = buildProviderErrorPattern([\n\t// Generic provider load, HTTP status, and server-side transient failures.\n\t\"overloaded\",\n\t\"server_busy\",\n\t\"servers are currently busy\",\n\t\"currently experiencing high demand\",\n\t\"model is at capacity\",\n\t\"rate.?limit\",\n\t\"too many requests\",\n\t\"429\",\n\t\"500\",\n\t\"502\",\n\t\"503\",\n\t\"504\",\n\t\"520\",\n\t\"\\\\b52[1-3]\\\\b\",\n\t\"524\",\n\t\"service.?unavailable\",\n\t\"server.?error\",\n\t\"internal.?error\",\n\n\t// Wrapper/provider text for transient upstream failures, including OpenRouter\n\t// \"Provider returned error\" responses (#2264).\n\t\"provider.?returned.?(?:an.?)?error\",\n\t\"exceeded request buffer limit while retrying upstream\",\n\t\"unable to forward upstream\",\n\n\t// Network, proxy, and fetch transport failures. This includes OpenAI Codex\n\t// raw-fetch failures such as \"upstream connect\", \"connection refused\", and\n\t// \"reset before headers\" (#733), plus OpenRouter connection drops (#3317).\n\t\"network.?error\",\n\t\"connection.?error\",\n\t\"connection.?refused\",\n\t\"connection.?lost\",\n\t\"ECONNRESET\",\n\t\"connection.?reset\",\n\t\"other side closed\",\n\t\"fetch failed\",\n\t\"getaddrinfo\",\n\t\"ENOTFOUND\",\n\t\"EAI_AGAIN\",\n\t\"upstream.?connect\",\n\t\"reset before headers\",\n\t\"socket hang up\",\n\t\"socket connection was closed\",\n\t\"timed? out\",\n\t\"timeout\",\n\t\"terminated\",\n\n\t// WebSocket transports can report close/error text instead of HTTP/fetch text.\n\t\"websocket.?closed\",\n\t\"websocket.?error\",\n\n\t// Response-body decompression failures. Node/Bun zlib rejects a body whose\n\t// Content-Encoding lied or whose compressed bytes were corrupted, and the\n\t// fetch/WebSocket layer wraps it with a \"Library error:\" prefix. GitHub\n\t// Copilot on the default `transport: \"auto\"` reports this as\n\t// \"Library error: zlib error: incorrect header check\" (#2553). The transfer\n\t// is already unusable, and a fresh attempt normally succeeds, so treat every\n\t// variant as a transient transport failure rather than a deterministic error.\n\t\"zlib\",\n\t\"incorrect header check\",\n\t\"decompress\",\n\t\"library error\",\n\n\t// Idle-stream deadline enforced below the HTTP layer by `withStreamDeadline`\n\t// so a stream that never settles cannot hang an attempt forever (#2553).\n\t\"stream deadline exceeded\",\n\n\t// Premature stream endings from SDKs and transports. Anthropic can throw\n\t// \"stream ended without ...\" and \"Anthropic stream ended before message_stop\"\n\t// (#4433); Bedrock/Smithy can throw an HTTP/2 no-response error (#3594).\n\t\"ended without\",\n\t\"stream ended before message_stop\",\n\t\"stream ended before a terminal response event\",\n\t\"http2 request did not get a response\",\n\t\"pending stream has been canceled\",\n\n\t// Provider-requested retry delay cap failures should flow through the outer\n\t// retry policy so callers can surface/abort the backoff (#1123).\n\t\"retry delay\",\n\n\t// Explicit retry guidance emitted mid-stream by OpenAI Responses and Bedrock\n\t// stream exceptions (#6019).\n\t\"you can retry your request\",\n\t\"try your request again\",\n\t\"please retry your request\",\n\n\t// gRPC based providers (e.g. NVIDIA NIM)\n\t\"ResourceExhausted\",\n\t\"subscription_sharing_usage_unavailable\",\n\t\"subscription_sharing_user_unavailable\",\n]);\n\n/**\n * Retry policy: bounded attempts with exponential backoff (`baseDelayMs * 2^(attempt-1)`).\n * Each delay is capped by `maxAgentDelayMs` (60 seconds by default).\n * Matches `settings.retry` (`enabled`, `maxRetries`, `baseDelayMs`) in coding-agent; kept\n * here so the classifier and the policy-driven retry loop live together and stay reusable\n * by the SDK and other callers.\n */\nexport interface RetryPolicy {\n\tenabled: boolean;\n\t/** Max retry attempts (0 = no retries). The initial call never counts as a retry. */\n\tmaxRetries: number;\n\t/** Base delay in ms. Per-attempt delay is `baseDelayMs * 2^(attempt-1)` before jitter. */\n\tbaseDelayMs: number;\n\t/** Cap for agent-level retry delays in ms. Defaults to 60 seconds. */\n\tmaxAgentDelayMs?: number;\n\t/**\n\t * Cap for a server retry hint (`Retry-After-Ms`, `Retry-After`, a body `retry_after`).\n\t * Defaults to 60 seconds; 0 caps the hint by `maxAgentDelayMs` instead.\n\t */\n\tmaxRetryDelayMs?: number;\n}\n\nexport const DEFAULT_MAX_AGENT_RETRY_DELAY_MS = 60_000;\n\nexport function retryDelayMs(policy: Pick<RetryPolicy, \"baseDelayMs\" | \"maxAgentDelayMs\">, attempt: number): number {\n\tconst delay = policy.baseDelayMs * 2 ** Math.max(0, attempt - 1);\n\tconst safeDelay = Number.isSafeInteger(delay) ? delay : Number.MAX_SAFE_INTEGER;\n\treturn Math.min(safeDelay, policy.maxAgentDelayMs ?? DEFAULT_MAX_AGENT_RETRY_DELAY_MS);\n}\n\ntype RetryFailure = Pick<AssistantMessage, \"stopReason\" | \"errorMessage\" | \"retryAfterMs\">;\n\n/**\n * Wait before retry `attempt` (1-indexed): the server retry hint when the failure\n * carries one, capped by `maxRetryDelayMs`, otherwise the exponential backoff.\n */\nexport function failureRetryDelayMs(\n\tpolicy: Pick<RetryPolicy, \"baseDelayMs\" | \"maxAgentDelayMs\" | \"maxRetryDelayMs\">,\n\tattempt: number,\n\tfailure: Pick<AssistantMessage, \"retryAfterMs\">,\n): number {\n\tconst hintMs = failure.retryAfterMs;\n\tif (hintMs === undefined || !Number.isFinite(hintMs) || hintMs <= 0) return retryDelayMs(policy, attempt);\n\tconst capMs = policy.maxRetryDelayMs || (policy.maxAgentDelayMs ?? DEFAULT_MAX_AGENT_RETRY_DELAY_MS);\n\treturn Math.min(hintMs, capMs);\n}\n\n/**\n * Delay before retry `attempt` (1-indexed) of a failed assistant call, or `undefined`\n * when it is not retryable or `maxRetries` is spent.\n */\nexport function assistantRetryDelayMs(policy: RetryPolicy, attempt: number, message: RetryFailure): number | undefined {\n\tif (!policy.enabled || attempt > policy.maxRetries || !isRetryableAssistantError(message)) return undefined;\n\treturn failureRetryDelayMs(policy, attempt, message);\n}\n\n/** Optional callbacks emitted by {@link retryAssistantCall} around each retry. */\nexport interface RetryCallbacks {\n\t/** Emitted before the backoff sleep of each retry attempt (1-indexed). */\n\tonRetryScheduled?: (\n\t\tattempt: number,\n\t\tmaxAttempts: number,\n\t\tdelayMs: number,\n\t\terrorMessage: string,\n\t) => void | Promise<void>;\n\t/** Emitted after the backoff sleep, immediately before the retried call starts. */\n\tonRetryAttemptStart?: () => void | Promise<void>;\n\t/** Emitted once when the loop ends: success if a later call completed normally. */\n\tonRetryFinished?: (success: boolean, attempt: number, finalError?: string) => void | Promise<void>;\n}\n\nclass RetrySleepAbortError extends Error {\n\tconstructor() {\n\t\tsuper(\"Aborted\");\n\t}\n}\n\nfunction sleep(ms: number, signal?: AbortSignal): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tif (signal?.aborted) {\n\t\t\treject(new RetrySleepAbortError());\n\t\t\treturn;\n\t\t}\n\t\tconst timeout = setTimeout(resolve, ms);\n\t\tsignal?.addEventListener(\n\t\t\t\"abort\",\n\t\t\t() => {\n\t\t\t\tclearTimeout(timeout);\n\t\t\t\treject(new RetrySleepAbortError());\n\t\t\t},\n\t\t\t{ once: true },\n\t\t);\n\t});\n}\n\n/**\n * Run a single assistant-producing call with bounded retry on transient errors.\n *\n * Behavior:\n * - A successful response is returned immediately. Aborts are terminal and never\n * retried, but reported as unsuccessful if they happen after a retry was scheduled.\n * Aborts during the backoff sleep are normalized to an aborted `AssistantMessage`\n * too, so callers do not need to care when cancellation happened.\n * - A non-retryable error (per {@link isRetryableAssistantError}, including quota/\n * billing exhaustion) is returned immediately so deterministic errors fail fast.\n * - Otherwise retries up to `maxRetries` times, waiting for the server retry hint or\n * the exponential backoff (see {@link assistantRetryDelayMs}), emitting\n * `onRetryScheduled` before each sleep, `onRetryAttemptStart` after each sleep before\n * the retried call starts, and `onRetryFinished` once at the end (whether the loop\n * ends in success, exhausted retries, or an aborted backoff).\n *\n * When `policy` is undefined or disabled, the first response is returned unchanged\n * (equivalent to calling `produce()` directly).\n */\nexport async function retryAssistantCall(\n\tproduce: () => Promise<AssistantMessage>,\n\tpolicy: RetryPolicy | undefined,\n\tsignal: AbortSignal | undefined,\n\tcallbacks?: RetryCallbacks,\n): Promise<AssistantMessage> {\n\tconst maxAttempts = policy?.enabled ? policy.maxRetries : 0;\n\n\tlet attempt = 0;\n\tlet lastRetry: { attempt: number; errorMessage: string } | undefined;\n\tfor (;;) {\n\t\tconst response = await produce();\n\n\t\t// Abort: terminal but not successful. Never retry an aborted message.\n\t\tif (response.stopReason === \"aborted\") {\n\t\t\tif (lastRetry) await callbacks?.onRetryFinished?.(false, lastRetry.attempt);\n\t\t\treturn response;\n\t\t}\n\n\t\t// Success: non-error, non-abort responses return as-is.\n\t\tif (response.stopReason !== \"error\") {\n\t\t\tif (lastRetry) await callbacks?.onRetryFinished?.(true, lastRetry.attempt);\n\t\t\treturn response;\n\t\t}\n\n\t\t// Non-retryable, or budget exhausted: return the final error message.\n\t\tconst delayMs = policy ? assistantRetryDelayMs(policy, attempt + 1, response) : undefined;\n\t\tif (delayMs === undefined) {\n\t\t\tif (lastRetry) await callbacks?.onRetryFinished?.(false, lastRetry.attempt, response.errorMessage);\n\t\t\treturn response;\n\t\t}\n\n\t\tattempt++;\n\t\tlastRetry = { attempt, errorMessage: response.errorMessage || \"Unknown error\" };\n\t\tawait callbacks?.onRetryScheduled?.(attempt, maxAttempts, delayMs, lastRetry.errorMessage);\n\n\t\t// Normalize aborts during retry backoff to the same AssistantMessage shape as\n\t\t// provider stream aborts, so callers do not need to care when cancellation happened.\n\t\ttry {\n\t\t\tawait sleep(delayMs, signal);\n\t\t} catch (error) {\n\t\t\tawait callbacks?.onRetryFinished?.(false, attempt, lastRetry.errorMessage);\n\t\t\tif (error instanceof RetrySleepAbortError) {\n\t\t\t\treturn { ...response, stopReason: \"aborted\", errorMessage: undefined };\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t\tawait callbacks?.onRetryAttemptStart?.();\n\t}\n}\n\n/**\n * Classifies whether a failed assistant message looks like a transient provider\n * or transport error, so callers can decide if the last assistant turn should be\n * restarted.\n *\n * This does not implement retry policy. Callers should first handle context\n * overflow separately, then apply their own retry budget, backoff, and reporting\n * before restarting the assistant turn.\n */\nexport function isRetryableAssistantError(message: RetryFailure): boolean {\n\tif (message.stopReason !== \"error\" || !message.errorMessage) return false;\n\tconst errorMessage = message.errorMessage;\n\tif (NON_RETRYABLE_PROVIDER_LIMIT_ERROR_PATTERN.test(errorMessage)) return false;\n\treturn RETRYABLE_PROVIDER_ERROR_PATTERN.test(errorMessage);\n}\n"]}
1
+ {"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/utils/retry.ts"],"names":[],"mappings":"AAEA,SAAS,yBAAyB,CAAC,QAA2B;IAC7D,OAAO,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,0CAA0C,GAAG,yBAAyB,CAAC;IAC5E,8EAA8E;IAC9E,2EAA2E;IAC3E,mBAAmB;IACnB,qBAAqB;IAErB,6EAA6E;IAC7E,yDAAyD;IACzD,6BAA6B;IAC7B,mBAAmB;IAEnB,4EAA4E;IAC5E,4EAA4E;IAC5E,oBAAoB;IACpB,eAAe;IACf,gBAAgB;IAChB,SAAS;IACT,2CAA2C;CAC3C,CAAC,CAAC;AAEH,MAAM,gCAAgC,GAAG,yBAAyB,CAAC;IAClE,0EAA0E;IAC1E,YAAY;IACZ,aAAa;IACb,4BAA4B;IAC5B,oCAAoC;IACpC,sBAAsB;IACtB,aAAa;IACb,mBAAmB;IACnB,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,eAAe;IACf,KAAK;IACL,kEAAkE;IAClE,iDAAiD;IACjD,eAAe;IACf,iBAAiB;IAEjB,8EAA8E;IAC9E,+CAA+C;IAC/C,oCAAoC;IACpC,uDAAuD;IACvD,4BAA4B;IAC5B,2BAA2B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CAAC,YAAY,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["import type { AssistantMessage } from \"../types.ts\";\n\nfunction buildProviderErrorPattern(patterns: readonly string[]): RegExp {\n\treturn new RegExp(patterns.join(\"|\"), \"i\");\n}\n\nconst NON_RETRYABLE_PROVIDER_LIMIT_ERROR_PATTERN = buildProviderErrorPattern([\n\t// OpenCode Go/free-tier limits returned as 429 JSON error types by OpenCode's\n\t// Zen API. These are subscription/account limits, not transient throttles.\n\t\"GoUsageLimitError\",\n\t\"FreeUsageLimitError\",\n\n\t// OpenCode Go subscription-limit text asks users to enable available-balance\n\t// usage after rolling/weekly/monthly limits are reached.\n\t\"Monthly usage limit reached\",\n\t\"available balance\",\n\n\t// Generic quota/budget/billing exhaustion. `insufficient_quota` is OpenAI's\n\t// quota/billing error code; the other strings cover common gateway wording.\n\t\"insufficient_quota\",\n\t\"out of budget\",\n\t\"quota exceeded\",\n\t\"billing\",\n\t\"subscription_sharing_usage_limit_exceeded\",\n]);\n\nconst RETRYABLE_PROVIDER_ERROR_PATTERN = buildProviderErrorPattern([\n\t// Generic provider load, HTTP status, and server-side transient failures.\n\t\"overloaded\",\n\t\"server_busy\",\n\t\"servers are currently busy\",\n\t\"currently experiencing high demand\",\n\t\"model is at capacity\",\n\t\"rate.?limit\",\n\t\"too many requests\",\n\t\"429\",\n\t\"500\",\n\t\"502\",\n\t\"503\",\n\t\"504\",\n\t\"520\",\n\t\"\\\\b52[1-3]\\\\b\",\n\t\"524\",\n\t// Also matches \"The service is temporarily unavailable\" (#10965).\n\t\"service.?(?:is.?)?(?:temporarily.?)?unavailable\",\n\t\"server.?error\",\n\t\"internal.?error\",\n\n\t// Wrapper/provider text for transient upstream failures, including OpenRouter\n\t// \"Provider returned error\" responses (#2264).\n\t\"provider.?returned.?(?:an.?)?error\",\n\t\"exceeded request buffer limit while retrying upstream\",\n\t\"unable to forward upstream\",\n\t\"upstream.?request.?failed\",\n\t\"upstream_stream_read_error\",\n\t\"stream was interrupted\",\n\t\"http/?2 stream failed\",\n\n\t// Network, proxy, and fetch transport failures. This includes OpenAI Codex\n\t// raw-fetch failures such as \"upstream connect\", \"connection refused\", and\n\t// \"reset before headers\" (#733), plus OpenRouter connection drops (#3317).\n\t\"network.?error\",\n\t\"connection.?error\",\n\t\"connection.?refused\",\n\t\"connection.?lost\",\n\t\"ECONNRESET\",\n\t\"connection.?reset\",\n\t\"other side closed\",\n\t\"fetch failed\",\n\t\"request to \\\\S+ failed, reason:\",\n\t\"getaddrinfo\",\n\t\"ENOTFOUND\",\n\t\"EAI_AGAIN\",\n\t\"upstream.?connect\",\n\t\"reset before headers\",\n\t\"socket hang up\",\n\t\"socket connection was closed\",\n\t\"timed? out\",\n\t\"timeout\",\n\t\"terminated\",\n\n\t// WebSocket transports can report close/error text instead of HTTP/fetch text.\n\t\"websocket.?closed\",\n\t\"websocket.?error\",\n\n\t// Response-body decompression failures. Node/Bun zlib rejects a body whose\n\t// Content-Encoding lied or whose compressed bytes were corrupted, and the\n\t// fetch/WebSocket layer wraps it with a \"Library error:\" prefix. GitHub\n\t// Copilot on the default `transport: \"auto\"` reports this as\n\t// \"Library error: zlib error: incorrect header check\" (#2553). The transfer\n\t// is already unusable, and a fresh attempt normally succeeds, so treat every\n\t// variant as a transient transport failure rather than a deterministic error.\n\t\"zlib\",\n\t\"incorrect header check\",\n\t\"decompress\",\n\t\"library error\",\n\n\t// Idle-stream deadline enforced below the HTTP layer by `withStreamDeadline`\n\t// so a stream that never settles cannot hang an attempt forever (#2553).\n\t\"stream deadline exceeded\",\n\n\t// Premature stream endings from SDKs and transports. Anthropic can throw\n\t// \"stream ended without ...\" and \"Anthropic stream ended before message_stop\"\n\t// (#4433); Bedrock/Smithy can throw an HTTP/2 no-response error (#3594).\n\t\"ended without\",\n\t\"stream ended before message_stop\",\n\t\"stream ended before a terminal response event\",\n\t\"http2 request did not get a response\",\n\t\"pending stream has been canceled\",\n\n\t// Provider-requested retry delay cap failures should flow through the outer\n\t// retry policy so callers can surface/abort the backoff (#1123).\n\t\"retry delay\",\n\n\t// Explicit retry guidance emitted mid-stream by OpenAI Responses and Bedrock\n\t// stream exceptions (#6019).\n\t\"you can retry your request\",\n\t\"try your request again\",\n\t\"please retry your request\",\n\n\t// gRPC based providers (e.g. NVIDIA NIM)\n\t\"ResourceExhausted\",\n\t\"subscription_sharing_usage_unavailable\",\n\t\"subscription_sharing_user_unavailable\",\n]);\n\n/**\n * Retry policy: bounded attempts with exponential backoff (`baseDelayMs * 2^(attempt-1)`).\n * Each delay is capped by `maxAgentDelayMs` (60 seconds by default).\n * Matches `settings.retry` (`enabled`, `maxRetries`, `baseDelayMs`) in coding-agent; kept\n * here so the classifier and the policy-driven retry loop live together and stay reusable\n * by the SDK and other callers.\n */\nexport interface RetryPolicy {\n\tenabled: boolean;\n\t/** Max retry attempts (0 = no retries). The initial call never counts as a retry. */\n\tmaxRetries: number;\n\t/** Base delay in ms. Per-attempt delay is `baseDelayMs * 2^(attempt-1)` before jitter. */\n\tbaseDelayMs: number;\n\t/** Cap for agent-level retry delays in ms. Defaults to 60 seconds. */\n\tmaxAgentDelayMs?: number;\n\t/**\n\t * Cap for a server retry hint (`Retry-After-Ms`, `Retry-After`, a body `retry_after`).\n\t * Defaults to 60 seconds; 0 caps the hint by `maxAgentDelayMs` instead.\n\t */\n\tmaxRetryDelayMs?: number;\n}\n\nexport const DEFAULT_MAX_AGENT_RETRY_DELAY_MS = 60_000;\n\nexport function retryDelayMs(policy: Pick<RetryPolicy, \"baseDelayMs\" | \"maxAgentDelayMs\">, attempt: number): number {\n\tconst delay = policy.baseDelayMs * 2 ** Math.max(0, attempt - 1);\n\tconst safeDelay = Number.isSafeInteger(delay) ? delay : Number.MAX_SAFE_INTEGER;\n\treturn Math.min(safeDelay, policy.maxAgentDelayMs ?? DEFAULT_MAX_AGENT_RETRY_DELAY_MS);\n}\n\ntype RetryFailure = Pick<AssistantMessage, \"stopReason\" | \"errorMessage\" | \"retryAfterMs\">;\n\n/**\n * Wait before retry `attempt` (1-indexed): the server retry hint when the failure\n * carries one, capped by `maxRetryDelayMs`, otherwise the exponential backoff.\n */\nexport function failureRetryDelayMs(\n\tpolicy: Pick<RetryPolicy, \"baseDelayMs\" | \"maxAgentDelayMs\" | \"maxRetryDelayMs\">,\n\tattempt: number,\n\tfailure: Pick<AssistantMessage, \"retryAfterMs\">,\n): number {\n\tconst hintMs = failure.retryAfterMs;\n\tif (hintMs === undefined || !Number.isFinite(hintMs) || hintMs <= 0) return retryDelayMs(policy, attempt);\n\tconst capMs = policy.maxRetryDelayMs || (policy.maxAgentDelayMs ?? DEFAULT_MAX_AGENT_RETRY_DELAY_MS);\n\treturn Math.min(hintMs, capMs);\n}\n\n/**\n * Delay before retry `attempt` (1-indexed) of a failed assistant call, or `undefined`\n * when it is not retryable or `maxRetries` is spent.\n */\nexport function assistantRetryDelayMs(policy: RetryPolicy, attempt: number, message: RetryFailure): number | undefined {\n\tif (!policy.enabled || attempt > policy.maxRetries || !isRetryableAssistantError(message)) return undefined;\n\treturn failureRetryDelayMs(policy, attempt, message);\n}\n\n/** Optional callbacks emitted by {@link retryAssistantCall} around each retry. */\nexport interface RetryCallbacks {\n\t/** Emitted before the backoff sleep of each retry attempt (1-indexed). */\n\tonRetryScheduled?: (\n\t\tattempt: number,\n\t\tmaxAttempts: number,\n\t\tdelayMs: number,\n\t\terrorMessage: string,\n\t) => void | Promise<void>;\n\t/** Emitted after the backoff sleep, immediately before the retried call starts. */\n\tonRetryAttemptStart?: () => void | Promise<void>;\n\t/** Emitted once when the loop ends: success if a later call completed normally. */\n\tonRetryFinished?: (success: boolean, attempt: number, finalError?: string) => void | Promise<void>;\n}\n\nclass RetrySleepAbortError extends Error {\n\tconstructor() {\n\t\tsuper(\"Aborted\");\n\t}\n}\n\nfunction sleep(ms: number, signal?: AbortSignal): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tif (signal?.aborted) {\n\t\t\treject(new RetrySleepAbortError());\n\t\t\treturn;\n\t\t}\n\t\tconst timeout = setTimeout(resolve, ms);\n\t\tsignal?.addEventListener(\n\t\t\t\"abort\",\n\t\t\t() => {\n\t\t\t\tclearTimeout(timeout);\n\t\t\t\treject(new RetrySleepAbortError());\n\t\t\t},\n\t\t\t{ once: true },\n\t\t);\n\t});\n}\n\n/**\n * Run a single assistant-producing call with bounded retry on transient errors.\n *\n * Behavior:\n * - A successful response is returned immediately. Aborts are terminal and never\n * retried, but reported as unsuccessful if they happen after a retry was scheduled.\n * Aborts during the backoff sleep are normalized to an aborted `AssistantMessage`\n * too, so callers do not need to care when cancellation happened.\n * - A non-retryable error (per {@link isRetryableAssistantError}, including quota/\n * billing exhaustion) is returned immediately so deterministic errors fail fast.\n * - Otherwise retries up to `maxRetries` times, waiting for the server retry hint or\n * the exponential backoff (see {@link assistantRetryDelayMs}), emitting\n * `onRetryScheduled` before each sleep, `onRetryAttemptStart` after each sleep before\n * the retried call starts, and `onRetryFinished` once at the end (whether the loop\n * ends in success, exhausted retries, or an aborted backoff).\n *\n * When `policy` is undefined or disabled, the first response is returned unchanged\n * (equivalent to calling `produce()` directly).\n */\nexport async function retryAssistantCall(\n\tproduce: () => Promise<AssistantMessage>,\n\tpolicy: RetryPolicy | undefined,\n\tsignal: AbortSignal | undefined,\n\tcallbacks?: RetryCallbacks,\n): Promise<AssistantMessage> {\n\tconst maxAttempts = policy?.enabled ? policy.maxRetries : 0;\n\n\tlet attempt = 0;\n\tlet lastRetry: { attempt: number; errorMessage: string } | undefined;\n\tfor (;;) {\n\t\tconst response = await produce();\n\n\t\t// Abort: terminal but not successful. Never retry an aborted message.\n\t\tif (response.stopReason === \"aborted\") {\n\t\t\tif (lastRetry) await callbacks?.onRetryFinished?.(false, lastRetry.attempt);\n\t\t\treturn response;\n\t\t}\n\n\t\t// Success: non-error, non-abort responses return as-is.\n\t\tif (response.stopReason !== \"error\") {\n\t\t\tif (lastRetry) await callbacks?.onRetryFinished?.(true, lastRetry.attempt);\n\t\t\treturn response;\n\t\t}\n\n\t\t// Non-retryable, or budget exhausted: return the final error message.\n\t\tconst delayMs = policy ? assistantRetryDelayMs(policy, attempt + 1, response) : undefined;\n\t\tif (delayMs === undefined) {\n\t\t\tif (lastRetry) await callbacks?.onRetryFinished?.(false, lastRetry.attempt, response.errorMessage);\n\t\t\treturn response;\n\t\t}\n\n\t\tattempt++;\n\t\tlastRetry = { attempt, errorMessage: response.errorMessage || \"Unknown error\" };\n\t\tawait callbacks?.onRetryScheduled?.(attempt, maxAttempts, delayMs, lastRetry.errorMessage);\n\n\t\t// Normalize aborts during retry backoff to the same AssistantMessage shape as\n\t\t// provider stream aborts, so callers do not need to care when cancellation happened.\n\t\ttry {\n\t\t\tawait sleep(delayMs, signal);\n\t\t} catch (error) {\n\t\t\tawait callbacks?.onRetryFinished?.(false, attempt, lastRetry.errorMessage);\n\t\t\tif (error instanceof RetrySleepAbortError) {\n\t\t\t\treturn { ...response, stopReason: \"aborted\", errorMessage: undefined };\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t\tawait callbacks?.onRetryAttemptStart?.();\n\t}\n}\n\n/**\n * Classifies whether a failed assistant message looks like a transient provider\n * or transport error, so callers can decide if the last assistant turn should be\n * restarted.\n *\n * This does not implement retry policy. Callers should first handle context\n * overflow separately, then apply their own retry budget, backoff, and reporting\n * before restarting the assistant turn.\n */\nexport function isRetryableAssistantError(message: RetryFailure): boolean {\n\tif (message.stopReason !== \"error\" || !message.errorMessage) return false;\n\tconst errorMessage = message.errorMessage;\n\tif (NON_RETRYABLE_PROVIDER_LIMIT_ERROR_PATTERN.test(errorMessage)) return false;\n\treturn RETRYABLE_PROVIDER_ERROR_PATTERN.test(errorMessage);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/pi-ai",
3
- "version": "0.9.38-alpha.6",
3
+ "version": "0.9.38-alpha.7",
4
4
  "description": "Bastani-branded unified LLM API with automatic model discovery and provider configuration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -77,7 +77,7 @@
77
77
  "dependencies": {
78
78
  "@anthropic-ai/sdk": "0.129.0",
79
79
  "@aws-sdk/client-bedrock-runtime": "3.1127.0",
80
- "@earendil-works/pi-telemetry": "1.2.0",
80
+ "@earendil-works/pi-telemetry": "1.3.0",
81
81
  "@google/genai": "2.21.0",
82
82
  "@smithy/node-http-handler": "4.12.1",
83
83
  "http-proxy-agent": "9.1.0",