@absolutejs/ai 0.6.3 → 0.6.4

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.
@@ -8,6 +8,8 @@ export type ProviderErrorInit = {
8
8
  /** Provider-specific error type, e.g. Anthropic's "overloaded_error". */
9
9
  type?: string | null;
10
10
  retryable: boolean;
11
+ /** No request was sent (for example, a locally blocked provider). */
12
+ notSent?: boolean;
11
13
  cause?: unknown;
12
14
  /** Provider-native structured details, when the response exposes them. */
13
15
  metadata?: Record<string, unknown>;
@@ -19,6 +21,8 @@ export declare class ProviderError extends Error {
19
21
  readonly type: string | null;
20
22
  /** Whether retrying the same request later could plausibly succeed. */
21
23
  readonly retryable: boolean;
24
+ readonly billingUnavailable: boolean;
25
+ readonly notSent: boolean;
22
26
  readonly metadata: Record<string, unknown> | undefined;
23
27
  /** Provider status page, when known — for surfacing "is it them?" to users. */
24
28
  readonly statusPageUrl: string | null;
@@ -50,3 +50,4 @@ export { inspectAIContext, streamWithAIContext, isAIContextRejection, } from "./
50
50
  export type { AIContextBudget, AIContextCapacity, AIContextPolicy, AIContextEvent, AIContextRecoveryReason, } from "./contextPolicy";
51
51
  export { createAIStoredToolResultRecovery } from "./storedToolResultRecovery";
52
52
  export { createAIProviderRouter } from "./providerRouter";
53
+ export { streamWithProviderFallback } from "./providerFallback";
@@ -0,0 +1,14 @@
1
+ import type { AIChunk } from "../../types/ai";
2
+ import { ProviderError } from "./errors/providerError";
3
+ /** Execute approved, individually metered alternatives. Never replay a stream
4
+ * after any chunk (including tools or usage), or after caller cancellation. */
5
+ export declare function streamWithProviderFallback(options: {
6
+ models: readonly string[];
7
+ stream: (model: string) => AsyncIterable<AIChunk>;
8
+ signal?: AbortSignal;
9
+ onFallback?: (event: {
10
+ from: string;
11
+ to: string;
12
+ error: ProviderError;
13
+ }) => void | Promise<void>;
14
+ }): AsyncIterable<AIChunk>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/ai",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "homepage": "https://github.com/absolutejs/ai",
5
5
  "bugs": {
6
6
  "url": "https://github.com/absolutejs/ai/issues"
@@ -114,7 +114,7 @@
114
114
  "react": "^19.2.0",
115
115
  "svelte": "^5.35.2",
116
116
  "vue": "^3.5.27",
117
- "@absolutejs/sync": ">=2.14.0 <4"
117
+ "@absolutejs/sync": ">=2.14.0 <3"
118
118
  },
119
119
  "peerDependenciesMeta": {
120
120
  "@absolutejs/isolated-jsc": {
@@ -137,7 +137,7 @@
137
137
  "@absolutejs/absolute": "^0.20.0-beta.0",
138
138
  "@absolutejs/changelog": "^0.6.0",
139
139
  "@absolutejs/isolated-jsc": "0.6.0",
140
- "@absolutejs/sync": "3.0.0",
140
+ "@absolutejs/sync": "2.14.0",
141
141
  "@angular/core": "^21.0.0",
142
142
  "@eslint/js": "^10.0.1",
143
143
  "@types/bun": "1.3.9",