@prestyj/ai 5.13.0 → 5.16.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.
package/dist/index.cjs CHANGED
@@ -126,6 +126,7 @@ var PROVIDER_DISPLAY = {
126
126
  openrouter: "OpenRouter",
127
127
  sakana: "Sakana",
128
128
  xai: "xAI (Grok)",
129
+ huggingface: "Hugging Face",
129
130
  xiaomi: "Xiaomi (MiMo)",
130
131
  minimax: "MiniMax"
131
132
  };
@@ -193,7 +194,7 @@ function formatError(err) {
193
194
  provider: err.provider,
194
195
  statusCode: err.statusCode,
195
196
  ...err.requestId ? { requestId: err.requestId } : {},
196
- guidance: "Request access via your Anthropic account team (see platform.claude.com/docs/en/about-claude/models/overview), or switch to Claude Fable 5 via the model selector \u2014 same underlying model, generally available."
197
+ guidance: "Request access via your Anthropic account team (see platform.claude.com/docs/en/about-claude/models/overview), or switch to Claude Fable 5.1 via the model selector \u2014 same underlying model, generally available."
197
198
  };
198
199
  }
199
200
  if (isUsageLimitError(err)) {
@@ -1621,7 +1622,15 @@ async function* runStream(options) {
1621
1622
  yield keepalive;
1622
1623
  break;
1623
1624
  }
1624
- // message_stop — loop exits naturally
1625
+ // message_stop — loop exits naturally.
1626
+ //
1627
+ // Deliberately NOT breaking early here. Breaking makes the SDK iterator
1628
+ // run `if (!done) controller.abort()` in its `finally`
1629
+ // (core/streaming.js:97), which tears the connection down instead of
1630
+ // returning it to the keep-alive pool — every turn would then pay a
1631
+ // fresh TLS handshake. Draining to the end is what every other Anthropic
1632
+ // client does, and the stall it guards against is handled by the agent
1633
+ // loop's idle timeout.
1625
1634
  default:
1626
1635
  yield keepalive;
1627
1636
  break;
@@ -3031,6 +3040,7 @@ var CODE_ASSIST_SUPPORTED_MODELS = /* @__PURE__ */ new Set([
3031
3040
  "gemini-3.5-flash",
3032
3041
  "gemini-3-flash",
3033
3042
  "gemini-3.1-flash-lite",
3043
+ "gemini-3.7-flash",
3034
3044
  "gemini-2.5-pro",
3035
3045
  "gemini-2.5-flash",
3036
3046
  "gemma-4-31b-it",
@@ -3053,13 +3063,14 @@ var ACCOUNT_GATED_MODELS = /* @__PURE__ */ new Set([
3053
3063
  "gemini-3-flash",
3054
3064
  "gemini-3.5-flash",
3055
3065
  "gemini-3.1-pro-preview",
3056
- "gemini-3.1-pro-preview-customtools"
3066
+ "gemini-3.1-pro-preview-customtools",
3067
+ "gemini-3.7-flash"
3057
3068
  ]);
3058
3069
  function accountGatedMessage(model) {
3059
3070
  return `Your Google account isn't entitled to "${model}" over Gemini Code Assist OAuth, so the API reports it as not found. This is an account-access limit, not a ezcoder bug.`;
3060
3071
  }
3061
3072
  function accountGatedHint() {
3062
- return `Newer Gemini models (3.5 Flash, 3.1 Pro Preview) are available only to Code Assist Standard/Enterprise accounts with preview/GA access enabled by a cloud admin \u2014 free/personal accounts usually can't call them. Switch to Gemini 3.1 Flash Lite (it works on this account) with /model, or sign in with a Code Assist Standard/Enterprise account that has preview access.`;
3073
+ return `Newer Gemini models (3.7 Flash, 3.5 Flash, 3.1 Pro Preview) are available only to Code Assist Standard/Enterprise accounts with preview/GA access enabled by a cloud admin \u2014 free/personal accounts usually can't call them. Switch to Gemini 3.1 Flash Lite (it works on this account) with /model, or sign in with a Code Assist Standard/Enterprise account that has preview access.`;
3063
3074
  }
3064
3075
  function formatErrorMessage(status, body, model) {
3065
3076
  if (status === 404 && !CODE_ASSIST_SUPPORTED_MODELS.has(model)) {
@@ -3743,6 +3754,18 @@ providerRegistry.register("openrouter", {
3743
3754
  baseUrl: options.baseUrl ?? "https://openrouter.ai/api/v1"
3744
3755
  })
3745
3756
  });
3757
+ providerRegistry.register("huggingface", {
3758
+ // Hugging Face Inference Providers router — one HF token (hf.co/settings/tokens,
3759
+ // "Make calls to Inference Providers" permission) routes to whichever hosted
3760
+ // backend serves each open model. Chat Completions-compatible; model ids are
3761
+ // Hub repo paths ("Qwen/Qwen3-Coder-480B-A35B-Instruct"), optionally with an
3762
+ // ":auto"/":fastest"/":cheapest" provider-selection suffix. Billing follows
3763
+ // each backend's per-token rates on the HF account (small free tier).
3764
+ stream: (options) => streamOpenAI({
3765
+ ...options,
3766
+ baseUrl: options.baseUrl ?? "https://router.huggingface.co/v1"
3767
+ })
3768
+ });
3746
3769
  providerRegistry.register("sakana", {
3747
3770
  // Sakana Fugu is a multi-agent system exposed as a standard LLM through the
3748
3771
  // OpenAI-compatible Sakana API. We ride the Chat Completions transport (the