@broberg/ai-sdk 0.36.3 → 0.36.5
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.d.ts +25 -3
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,28 @@ export { AvailabilitySource, AvailabilityStatus, ModelStatus, ModelUnavailableEr
|
|
|
15
15
|
* it passes every OpenRouter call. Only `region === "eu"` may be treated as EU-resident.
|
|
16
16
|
*/
|
|
17
17
|
type Region = "eu" | "us" | "cn" | "unknown";
|
|
18
|
+
/** Region of the endpoint a call will actually hit. Never throws — a residency
|
|
19
|
+
* reading must not be able to break a call that already succeeded. */
|
|
20
|
+
declare function regionOfHost(url: string | undefined): Region;
|
|
21
|
+
/** Classify a provider REGION STRING — a Vertex/GCP location like `europe-west1`, or
|
|
22
|
+
* an Azure region like `westeurope`. Anything unrecognised is `"unknown"`: a region
|
|
23
|
+
* name we have never seen is exactly the case where guessing is most tempting and
|
|
24
|
+
* least defensible. Never throws — a residency reading must not be able to break a
|
|
25
|
+
* call that already succeeded. */
|
|
26
|
+
declare function classifyRegionName(name: string | undefined): Region;
|
|
27
|
+
/** Region for an adapter whose endpoint is fixed. Unknown provider → `"unknown"`.
|
|
28
|
+
*
|
|
29
|
+
* **DO NOT BUILD A RESIDENCY GUARD ON THIS.** Use {@link regionOfHost} on the base URL
|
|
30
|
+
* the call will actually use. Found by a consumer building exactly that guard (super,
|
|
31
|
+
* 2026-08-30): `regionOfProvider("mistral")` is `"unknown"` — correct, because Mistral
|
|
32
|
+
* takes a `baseUrl` and a name cannot answer for residency — but a guard written as
|
|
33
|
+
* `regionOfProvider(p) === "eu"` therefore REJECTS Mistral, which is the only EU route
|
|
34
|
+
* we have. It fails closed and is useless: it filters out the thing it exists to allow.
|
|
35
|
+
*
|
|
36
|
+
* The trap is invisible from the signature, which is why it is written here rather than
|
|
37
|
+
* only in the docs. This function answers "is this provider's endpoint fixed, and where
|
|
38
|
+
* is it?" — a narrower question than "where will my call go?". */
|
|
39
|
+
declare function regionOfProvider(provider: string): Region;
|
|
18
40
|
|
|
19
41
|
/** How a call reaches the model. `http` = provider REST API; `subprocess` = local
|
|
20
42
|
* `claude -p` CLI (Max plan, costUsd 0). */
|
|
@@ -2178,8 +2200,8 @@ declare const falStubAdapter: ProviderAdapter;
|
|
|
2178
2200
|
* wires the live adapters. */
|
|
2179
2201
|
declare const stubProviders: Record<string, ProviderAdapter>;
|
|
2180
2202
|
|
|
2181
|
-
declare const VERSION: "0.36.
|
|
2182
|
-
declare const SDK_TAG: "@broberg/ai-sdk@0.36.
|
|
2203
|
+
declare const VERSION: "0.36.5";
|
|
2204
|
+
declare const SDK_TAG: "@broberg/ai-sdk@0.36.5";
|
|
2183
2205
|
|
|
2184
2206
|
/** Built-in defaults. Every entry is overridable via AiConfig.defaults or a
|
|
2185
2207
|
* per-call override.
|
|
@@ -2590,4 +2612,4 @@ interface StreamTransportRequest extends TransportRequest {
|
|
|
2590
2612
|
*/
|
|
2591
2613
|
declare function streamTransport(req: StreamTransportRequest): AsyncIterable<string>;
|
|
2592
2614
|
|
|
2593
|
-
export { AZURE_DANISH_VOICES, AZURE_DANISH_VOICE_LIST, type AiClient, type AiConfig, type AzureVoiceInfo, type BatchJob, type BatchRequestItem, type BatchResultItem, type BflAdapterConfig, type BflCredits, type BudgetConfig, BudgetExceededError, BudgetGuard, type BudgetStore, type CallOptions, type Capability, type ChatInput, type ChatRequest, type ChatResult, type ChatStreamEvent, type CheckVoiceOptions, type ClassifyInput, type ClassifyResult, type ContentPart, type Contracts, type CostQuery, type CostSink, type CostSummary, type CostSummaryQuery, type CostTimeseriesQuery, DEFAULT_TIER_MAP, type DesignInput, type DesignResult, type DialogueRequest, type DialogueTurn, type DiscordSinkConfig, ELEVENLABS_DANISH_VOICES, type EmbeddingInput, type EmbeddingRequest, type EmbeddingResult, type ExtractInput, type ExtractResult, type FalAdapterConfig, type HttpResponse, type ImageInput, type ImageRequest, type ImageResult, type LoraWeight, type Message, type MockupInput, type MockupResult, type ModerationInput, type ModerationItem, type ModerationRequest, type ModerationResult, type OcrInput, type OcrPage, type OcrRequest, type OcrResult, type OpenAICompatibleConfig, type PodcastInput, type PodcastResult, type PricingEntry, type ProviderAdapter, type RefreshOptions, type RefreshResult, type RerankInput, type RerankResult, type Role, SDK_TAG, type SqliteBudgetStoreConfig, type SqliteSinkConfig, StreamHttpError, type SubprocessResponse, type Tier, type TierSpec, type Tool, type ToolCall, type TrainStyleInput, type TrainStyleRequest, type TrainStyleResult, type TranscribeInput, type TranscribeRequest, type TranscribeResult, type TranslateInput, type TranslateResult, type Transport, type TransportRequest, type TransportResponse, type TtsInput, type TtsRequest, type UpmetricsCostClientConfig, UpmetricsCostError, type UpmetricsCostRow, type UpmetricsCostSummary, type UpmetricsCostTimeseries, type UpmetricsSinkConfig, type Usage, VERSION, type VideoInput, type VisionInput, type VoiceInfo, type VoiceProvider, type VoiceResolveResult, type VoiceStatus, VoiceUnavailableError, aiConfigSchema, anthropicAdapter, anthropicApiAdapter, anthropicSubprocessAdapter, azureAdapter, bflAdapter, bflCredits, chatInputSchema, checkVoice, computeCost, createAI, deepinfraAdapter, deeplAdapter, deepseekAdapter, defaultProviders, discordSink, elevenlabsAdapter, embeddingInputSchema, falAdapter, falStubAdapter, freshUsage, fromProviderToolCall, geminiAdapter, getCostSummary, getPrice, httpTransport, imageInputSchema, listAzureDanishVoices, listVoices, makeContracts, makeOpenAICompatibleAdapter, messageSchema, mistralAdapter, mistralStubAdapter, multiSink, noopSink, openaiAdapter, openaiStubAdapter, openrouterAdapter, parseClaudeCliJson, parseJsonLoose, refreshAvailability, requestyAdapter, resetRefreshState, resetRegistry, resolveAzureVoice, resolveTier, resolveVoice, sqliteBudgetStore, sqliteSink, streamTransport, stubProviders, subprocessTransport, tierSpecSchema, toProviderTools, toolSchema, translateInputSchema, upmetricsCostClient, upmetricsSink, usdFromMicro, vertexAdapter, visionInputSchema };
|
|
2615
|
+
export { AZURE_DANISH_VOICES, AZURE_DANISH_VOICE_LIST, type AiClient, type AiConfig, type AzureVoiceInfo, type BatchJob, type BatchRequestItem, type BatchResultItem, type BflAdapterConfig, type BflCredits, type BudgetConfig, BudgetExceededError, BudgetGuard, type BudgetStore, type CallOptions, type Capability, type ChatInput, type ChatRequest, type ChatResult, type ChatStreamEvent, type CheckVoiceOptions, type ClassifyInput, type ClassifyResult, type ContentPart, type Contracts, type CostQuery, type CostSink, type CostSummary, type CostSummaryQuery, type CostTimeseriesQuery, DEFAULT_TIER_MAP, type DesignInput, type DesignResult, type DialogueRequest, type DialogueTurn, type DiscordSinkConfig, ELEVENLABS_DANISH_VOICES, type EmbeddingInput, type EmbeddingRequest, type EmbeddingResult, type ExtractInput, type ExtractResult, type FalAdapterConfig, type HttpResponse, type ImageInput, type ImageRequest, type ImageResult, type LoraWeight, type Message, type MockupInput, type MockupResult, type ModerationInput, type ModerationItem, type ModerationRequest, type ModerationResult, type OcrInput, type OcrPage, type OcrRequest, type OcrResult, type OpenAICompatibleConfig, type PodcastInput, type PodcastResult, type PricingEntry, type ProviderAdapter, type RefreshOptions, type RefreshResult, type Region, type RerankInput, type RerankResult, type Role, SDK_TAG, type SqliteBudgetStoreConfig, type SqliteSinkConfig, StreamHttpError, type SubprocessResponse, type Tier, type TierSpec, type Tool, type ToolCall, type TrainStyleInput, type TrainStyleRequest, type TrainStyleResult, type TranscribeInput, type TranscribeRequest, type TranscribeResult, type TranslateInput, type TranslateResult, type Transport, type TransportRequest, type TransportResponse, type TtsInput, type TtsRequest, type UpmetricsCostClientConfig, UpmetricsCostError, type UpmetricsCostRow, type UpmetricsCostSummary, type UpmetricsCostTimeseries, type UpmetricsSinkConfig, type Usage, VERSION, type VideoInput, type VisionInput, type VoiceInfo, type VoiceProvider, type VoiceResolveResult, type VoiceStatus, VoiceUnavailableError, aiConfigSchema, anthropicAdapter, anthropicApiAdapter, anthropicSubprocessAdapter, azureAdapter, bflAdapter, bflCredits, chatInputSchema, checkVoice, classifyRegionName, computeCost, createAI, deepinfraAdapter, deeplAdapter, deepseekAdapter, defaultProviders, discordSink, elevenlabsAdapter, embeddingInputSchema, falAdapter, falStubAdapter, freshUsage, fromProviderToolCall, geminiAdapter, getCostSummary, getPrice, httpTransport, imageInputSchema, listAzureDanishVoices, listVoices, makeContracts, makeOpenAICompatibleAdapter, messageSchema, mistralAdapter, mistralStubAdapter, multiSink, noopSink, openaiAdapter, openaiStubAdapter, openrouterAdapter, parseClaudeCliJson, parseJsonLoose, refreshAvailability, regionOfHost, regionOfProvider, requestyAdapter, resetRefreshState, resetRegistry, resolveAzureVoice, resolveTier, resolveVoice, sqliteBudgetStore, sqliteSink, streamTransport, stubProviders, subprocessTransport, tierSpecSchema, toProviderTools, toolSchema, translateInputSchema, upmetricsCostClient, upmetricsSink, usdFromMicro, vertexAdapter, visionInputSchema };
|
package/dist/index.js
CHANGED
|
@@ -2986,8 +2986,8 @@ var aiConfigSchema = z.object({
|
|
|
2986
2986
|
});
|
|
2987
2987
|
|
|
2988
2988
|
// src/version.ts
|
|
2989
|
-
var VERSION = "0.36.
|
|
2990
|
-
var SDK_TAG = "@broberg/ai-sdk@0.36.
|
|
2989
|
+
var VERSION = "0.36.5";
|
|
2990
|
+
var SDK_TAG = "@broberg/ai-sdk@0.36.5";
|
|
2991
2991
|
|
|
2992
2992
|
// src/cost/sinks/upmetrics.ts
|
|
2993
2993
|
function upmetricsSink(config) {
|
|
@@ -3991,6 +3991,7 @@ export {
|
|
|
3991
3991
|
bflCredits,
|
|
3992
3992
|
chatInputSchema,
|
|
3993
3993
|
checkVoice,
|
|
3994
|
+
classifyRegionName,
|
|
3994
3995
|
computeCost,
|
|
3995
3996
|
createAI,
|
|
3996
3997
|
deepinfraAdapter,
|
|
@@ -4025,6 +4026,8 @@ export {
|
|
|
4025
4026
|
parseClaudeCliJson,
|
|
4026
4027
|
parseJsonLoose,
|
|
4027
4028
|
refreshAvailability,
|
|
4029
|
+
regionOfHost,
|
|
4030
|
+
regionOfProvider,
|
|
4028
4031
|
requestyAdapter,
|
|
4029
4032
|
resetRefreshState,
|
|
4030
4033
|
resetRegistry,
|