@vincemakes/kiso-provider-openai 0.39.2 → 0.40.1

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 +5 -4
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@
16
16
  import { mkdirSync, writeFileSync } from "node:fs";
17
17
  import { join } from "node:path";
18
18
  import OpenAI from "openai";
19
- import { mapApiError, parseRetryAfter, streamFailure } from "@vincemakes/kiso-core";
19
+ import { connectionFailure, mapApiError, parseRetryAfter, streamFailure } from "@vincemakes/kiso-core";
20
20
  /**
21
21
  * High-level factory (round 7): builds the adapter FROM CONFIG, owning the SDK
22
22
  * inside this package. Consumers (and the runtime's lazy provider path)
@@ -531,7 +531,7 @@ function toOpenAIError(err, model) {
531
531
  return { code: "timeout", retryable: true, message: label + err.message };
532
532
  }
533
533
  if (err instanceof OpenAI.APIConnectionError) {
534
- return { code: "network", retryable: true, message: label + err.message };
534
+ return connectionFailure(err, label + err.message);
535
535
  }
536
536
  if (err instanceof OpenAI.APIError) {
537
537
  // CX-1 F8: the kernel owns retries — Retry-After travels with the error
@@ -544,8 +544,9 @@ function toOpenAIError(err, model) {
544
544
  // non-retryable: an error terminal where the mid-stream retry belongs.
545
545
  // The name is fetch's, not the vendor's, so it is a transport failure by
546
546
  // construction — the same class as APIConnectionError above.
547
- if (err instanceof TypeError && (err.message === "terminated" || err.message === "fetch failed")) {
547
+ if (err instanceof TypeError && err.message === "terminated")
548
548
  return streamFailure(label + err.message);
549
- }
549
+ if (err instanceof TypeError && err.message === "fetch failed")
550
+ return connectionFailure(err, label + err.message);
550
551
  return err;
551
552
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincemakes/kiso-provider-openai",
3
- "version": "0.39.2",
3
+ "version": "0.40.1",
4
4
  "description": "kiso OpenAI-compatible adapter \u2014 OpenAI + the compat family (GLM, Kimi, DeepSeek, OpenRouter) via base_url swap, reasoning dialects digested.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -21,7 +21,7 @@
21
21
  "test": "vitest run"
22
22
  },
23
23
  "dependencies": {
24
- "@vincemakes/kiso-core": "0.39.2",
24
+ "@vincemakes/kiso-core": "0.40.1",
25
25
  "openai": "^7.3.0"
26
26
  },
27
27
  "devDependencies": {