@x12i/ai-dispatcher 3.1.0 → 3.3.0
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/README.md +36 -17
- package/dist/index.cjs +408 -105
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -4
- package/dist/index.d.ts +21 -4
- package/dist/index.js +407 -105
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { ReasoningOutcome } from '@x12i/ai-profiles';
|
|
2
|
+
export { ReasoningOutcome, registerHostIntents, resolveAIProfile } from '@x12i/ai-profiles';
|
|
3
3
|
import * as _x12i_openrouter_runtime from '@x12i/openrouter-runtime';
|
|
4
4
|
import { RuntimeToolExecutor, RuntimeLogger, RuntimeRequest, RuntimeResponse, RuntimeUsage, RuntimeStreamEvent, CompiledOpenRouterRequest, OpenRouterRuntimeOptions } from '@x12i/openrouter-runtime';
|
|
5
5
|
export { CompiledOpenRouterRequest, METADATA_NORMALIZATION_MAP, NormalizedMetadataKey, OpenRouterRuntimeOptions, RuntimeDefaults, RuntimeLogger, RuntimeMessage, RuntimeRequest, RuntimeResponse, RuntimeServerToolsPolicy, RuntimeStreamEvent, canonicalMetadataKey, decodeProviderMetadata, normalizeMetadata } from '@x12i/openrouter-runtime';
|
|
@@ -95,6 +95,11 @@ interface OpenAiRuntimeOptions {
|
|
|
95
95
|
logger?: RuntimeLogger;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Effort name for one call.
|
|
100
|
+
* It is valid when the target model's `reasoning.supportedEfforts` lists it.
|
|
101
|
+
*/
|
|
102
|
+
type ReasoningEffort = string;
|
|
98
103
|
/** Compact and readable write outline. Raw is `JSON.stringify` or the original string. */
|
|
99
104
|
type AiInputMode = "compact" | "readable" | "raw";
|
|
100
105
|
/** Wire codec chosen for one prepared value. Compact and readable default to `outline`. */
|
|
@@ -152,9 +157,13 @@ interface RoleStamp {
|
|
|
152
157
|
* Catalog resolution for one call.
|
|
153
158
|
* `outcome` is present only when the catalog resolver ran.
|
|
154
159
|
* `bypassed` is true when an explicit provider control took precedence.
|
|
160
|
+
* `sentEffort` is the effort written on the wire. `reportedEffort` is the effort
|
|
161
|
+
* the provider returned, when it returned one.
|
|
155
162
|
*/
|
|
156
163
|
interface ReasoningResolution {
|
|
157
164
|
requestedEffort?: ReasoningEffort;
|
|
165
|
+
sentEffort?: ReasoningEffort;
|
|
166
|
+
reportedEffort?: ReasoningEffort;
|
|
158
167
|
target: ImplementedAiProvider;
|
|
159
168
|
requestedModel: string;
|
|
160
169
|
effectiveModel: string;
|
|
@@ -214,10 +223,18 @@ interface AiDispatcherRequest extends RuntimeRequest {
|
|
|
214
223
|
*/
|
|
215
224
|
role?: RoleStamp;
|
|
216
225
|
/**
|
|
217
|
-
*
|
|
226
|
+
* Effort to send. Valid when the target model's `reasoning.supportedEfforts`
|
|
227
|
+
* lists it. The mapping supplies response paths and the body shape.
|
|
228
|
+
* The effort string is written unchanged.
|
|
218
229
|
* An explicit provider control on the same request wins and the catalog is not called.
|
|
219
230
|
*/
|
|
220
231
|
reasoningEffort?: ReasoningEffort;
|
|
232
|
+
/**
|
|
233
|
+
* Use the mapping's substitution when the requested effort is not in the
|
|
234
|
+
* model's `supportedEfforts`. The resolution then records both efforts and
|
|
235
|
+
* `outcome: "degraded"`. Omitted, an unsupported effort fails with `EFFORT_UNSUPPORTED`.
|
|
236
|
+
*/
|
|
237
|
+
degradeReasoningEffort?: boolean;
|
|
221
238
|
/**
|
|
222
239
|
* Bedrock Converse escape hatch. When `additionalModelRequestFields` is set,
|
|
223
240
|
* it is the explicit reasoning control for Bedrock and the catalog is not applied.
|
|
@@ -408,4 +425,4 @@ declare function stripReasoningHistoryFields<T>(message: T, paths: readonly stri
|
|
|
408
425
|
|
|
409
426
|
declare function resolveProvider(requestProvider: AiProviderId | undefined, defaultProvider: AiProviderId): ImplementedAiProvider;
|
|
410
427
|
|
|
411
|
-
export { AI_DISPATCHER_GATE, type AiDispatcher, AiDispatcherError, type AiDispatcherOptions, type AiDispatcherRequest, type AiDispatcherResponse, type AiDispatcherUsage, type AiInputCodec, type AiInputCodecChoice, type AiInputFraming, type AiInputMode, type AiInputReadableFormat, type AiInputSettings, type AiInputSharing, type AiInputTokenizer, type AiProviderAdapter, type AiProviderId, type CacheMode, type CacheOutcome, type CachePolicy, type CacheResolution, type CacheTtl, type CloudflareBackoff, type CloudflareCallContext, type CloudflareEndpoint, type CloudflareEndpointChoice, type CloudflareGatewayControls, type CloudflareRequestOptions, type CloudflareRunOptions, type CloudflareRuntimeOptions, type CloudflareWebhookFormat, type CompiledAiRequest, type CompiledCloudflareRequest, type CompiledOpenAiRequest, DEFAULT_METADATA_PRIORITY, type DispatcherMcpOptions, type DispatcherMcpServer, type DispatcherMcpTool, IMPLEMENTED_AI_PROVIDERS, type ImplementedAiProvider, type InputResolution, type OpenAiRuntimeOptions, type ReasoningResolution, type RoleStamp, createAiDispatcher, isImplementedAiProvider, providerNotImplemented, resolveProvider, stripReasoningHistoryFields };
|
|
428
|
+
export { AI_DISPATCHER_GATE, type AiDispatcher, AiDispatcherError, type AiDispatcherOptions, type AiDispatcherRequest, type AiDispatcherResponse, type AiDispatcherUsage, type AiInputCodec, type AiInputCodecChoice, type AiInputFraming, type AiInputMode, type AiInputReadableFormat, type AiInputSettings, type AiInputSharing, type AiInputTokenizer, type AiProviderAdapter, type AiProviderId, type CacheMode, type CacheOutcome, type CachePolicy, type CacheResolution, type CacheTtl, type CloudflareBackoff, type CloudflareCallContext, type CloudflareEndpoint, type CloudflareEndpointChoice, type CloudflareGatewayControls, type CloudflareRequestOptions, type CloudflareRunOptions, type CloudflareRuntimeOptions, type CloudflareWebhookFormat, type CompiledAiRequest, type CompiledCloudflareRequest, type CompiledOpenAiRequest, DEFAULT_METADATA_PRIORITY, type DispatcherMcpOptions, type DispatcherMcpServer, type DispatcherMcpTool, IMPLEMENTED_AI_PROVIDERS, type ImplementedAiProvider, type InputResolution, type OpenAiRuntimeOptions, type ReasoningEffort, type ReasoningResolution, type RoleStamp, createAiDispatcher, isImplementedAiProvider, providerNotImplemented, resolveProvider, stripReasoningHistoryFields };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { ReasoningOutcome } from '@x12i/ai-profiles';
|
|
2
|
+
export { ReasoningOutcome, registerHostIntents, resolveAIProfile } from '@x12i/ai-profiles';
|
|
3
3
|
import * as _x12i_openrouter_runtime from '@x12i/openrouter-runtime';
|
|
4
4
|
import { RuntimeToolExecutor, RuntimeLogger, RuntimeRequest, RuntimeResponse, RuntimeUsage, RuntimeStreamEvent, CompiledOpenRouterRequest, OpenRouterRuntimeOptions } from '@x12i/openrouter-runtime';
|
|
5
5
|
export { CompiledOpenRouterRequest, METADATA_NORMALIZATION_MAP, NormalizedMetadataKey, OpenRouterRuntimeOptions, RuntimeDefaults, RuntimeLogger, RuntimeMessage, RuntimeRequest, RuntimeResponse, RuntimeServerToolsPolicy, RuntimeStreamEvent, canonicalMetadataKey, decodeProviderMetadata, normalizeMetadata } from '@x12i/openrouter-runtime';
|
|
@@ -95,6 +95,11 @@ interface OpenAiRuntimeOptions {
|
|
|
95
95
|
logger?: RuntimeLogger;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Effort name for one call.
|
|
100
|
+
* It is valid when the target model's `reasoning.supportedEfforts` lists it.
|
|
101
|
+
*/
|
|
102
|
+
type ReasoningEffort = string;
|
|
98
103
|
/** Compact and readable write outline. Raw is `JSON.stringify` or the original string. */
|
|
99
104
|
type AiInputMode = "compact" | "readable" | "raw";
|
|
100
105
|
/** Wire codec chosen for one prepared value. Compact and readable default to `outline`. */
|
|
@@ -152,9 +157,13 @@ interface RoleStamp {
|
|
|
152
157
|
* Catalog resolution for one call.
|
|
153
158
|
* `outcome` is present only when the catalog resolver ran.
|
|
154
159
|
* `bypassed` is true when an explicit provider control took precedence.
|
|
160
|
+
* `sentEffort` is the effort written on the wire. `reportedEffort` is the effort
|
|
161
|
+
* the provider returned, when it returned one.
|
|
155
162
|
*/
|
|
156
163
|
interface ReasoningResolution {
|
|
157
164
|
requestedEffort?: ReasoningEffort;
|
|
165
|
+
sentEffort?: ReasoningEffort;
|
|
166
|
+
reportedEffort?: ReasoningEffort;
|
|
158
167
|
target: ImplementedAiProvider;
|
|
159
168
|
requestedModel: string;
|
|
160
169
|
effectiveModel: string;
|
|
@@ -214,10 +223,18 @@ interface AiDispatcherRequest extends RuntimeRequest {
|
|
|
214
223
|
*/
|
|
215
224
|
role?: RoleStamp;
|
|
216
225
|
/**
|
|
217
|
-
*
|
|
226
|
+
* Effort to send. Valid when the target model's `reasoning.supportedEfforts`
|
|
227
|
+
* lists it. The mapping supplies response paths and the body shape.
|
|
228
|
+
* The effort string is written unchanged.
|
|
218
229
|
* An explicit provider control on the same request wins and the catalog is not called.
|
|
219
230
|
*/
|
|
220
231
|
reasoningEffort?: ReasoningEffort;
|
|
232
|
+
/**
|
|
233
|
+
* Use the mapping's substitution when the requested effort is not in the
|
|
234
|
+
* model's `supportedEfforts`. The resolution then records both efforts and
|
|
235
|
+
* `outcome: "degraded"`. Omitted, an unsupported effort fails with `EFFORT_UNSUPPORTED`.
|
|
236
|
+
*/
|
|
237
|
+
degradeReasoningEffort?: boolean;
|
|
221
238
|
/**
|
|
222
239
|
* Bedrock Converse escape hatch. When `additionalModelRequestFields` is set,
|
|
223
240
|
* it is the explicit reasoning control for Bedrock and the catalog is not applied.
|
|
@@ -408,4 +425,4 @@ declare function stripReasoningHistoryFields<T>(message: T, paths: readonly stri
|
|
|
408
425
|
|
|
409
426
|
declare function resolveProvider(requestProvider: AiProviderId | undefined, defaultProvider: AiProviderId): ImplementedAiProvider;
|
|
410
427
|
|
|
411
|
-
export { AI_DISPATCHER_GATE, type AiDispatcher, AiDispatcherError, type AiDispatcherOptions, type AiDispatcherRequest, type AiDispatcherResponse, type AiDispatcherUsage, type AiInputCodec, type AiInputCodecChoice, type AiInputFraming, type AiInputMode, type AiInputReadableFormat, type AiInputSettings, type AiInputSharing, type AiInputTokenizer, type AiProviderAdapter, type AiProviderId, type CacheMode, type CacheOutcome, type CachePolicy, type CacheResolution, type CacheTtl, type CloudflareBackoff, type CloudflareCallContext, type CloudflareEndpoint, type CloudflareEndpointChoice, type CloudflareGatewayControls, type CloudflareRequestOptions, type CloudflareRunOptions, type CloudflareRuntimeOptions, type CloudflareWebhookFormat, type CompiledAiRequest, type CompiledCloudflareRequest, type CompiledOpenAiRequest, DEFAULT_METADATA_PRIORITY, type DispatcherMcpOptions, type DispatcherMcpServer, type DispatcherMcpTool, IMPLEMENTED_AI_PROVIDERS, type ImplementedAiProvider, type InputResolution, type OpenAiRuntimeOptions, type ReasoningResolution, type RoleStamp, createAiDispatcher, isImplementedAiProvider, providerNotImplemented, resolveProvider, stripReasoningHistoryFields };
|
|
428
|
+
export { AI_DISPATCHER_GATE, type AiDispatcher, AiDispatcherError, type AiDispatcherOptions, type AiDispatcherRequest, type AiDispatcherResponse, type AiDispatcherUsage, type AiInputCodec, type AiInputCodecChoice, type AiInputFraming, type AiInputMode, type AiInputReadableFormat, type AiInputSettings, type AiInputSharing, type AiInputTokenizer, type AiProviderAdapter, type AiProviderId, type CacheMode, type CacheOutcome, type CachePolicy, type CacheResolution, type CacheTtl, type CloudflareBackoff, type CloudflareCallContext, type CloudflareEndpoint, type CloudflareEndpointChoice, type CloudflareGatewayControls, type CloudflareRequestOptions, type CloudflareRunOptions, type CloudflareRuntimeOptions, type CloudflareWebhookFormat, type CompiledAiRequest, type CompiledCloudflareRequest, type CompiledOpenAiRequest, DEFAULT_METADATA_PRIORITY, type DispatcherMcpOptions, type DispatcherMcpServer, type DispatcherMcpTool, IMPLEMENTED_AI_PROVIDERS, type ImplementedAiProvider, type InputResolution, type OpenAiRuntimeOptions, type ReasoningEffort, type ReasoningResolution, type RoleStamp, createAiDispatcher, isImplementedAiProvider, providerNotImplemented, resolveProvider, stripReasoningHistoryFields };
|