@x12i/ai-dispatcher 2.4.1 → 3.1.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 +31 -8
- package/dist/index.cjs +441 -122
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +77 -3
- package/dist/index.d.ts +77 -3
- package/dist/index.js +434 -122
- package/dist/index.js.map +1 -1
- package/package.json +7 -3
package/dist/index.d.cts
CHANGED
|
@@ -3,6 +3,8 @@ export { ReasoningEffort, ReasoningOutcome, registerHostIntents } from '@x12i/ai
|
|
|
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';
|
|
6
|
+
import { CapabilityApproval } from '@x12i/ai-input/core';
|
|
7
|
+
export { CapabilityApproval } from '@x12i/ai-input/core';
|
|
6
8
|
import { CompiledBedrockRequest, BedrockRuntimeOptions } from '@x12i/bedrock-runtime';
|
|
7
9
|
export { BedrockClientLike, BedrockCredentials, BedrockRuntimeOptions, CompiledBedrockRequest } from '@x12i/bedrock-runtime';
|
|
8
10
|
|
|
@@ -93,6 +95,52 @@ interface OpenAiRuntimeOptions {
|
|
|
93
95
|
logger?: RuntimeLogger;
|
|
94
96
|
}
|
|
95
97
|
|
|
98
|
+
/** Compact and readable write outline. Raw is `JSON.stringify` or the original string. */
|
|
99
|
+
type AiInputMode = "compact" | "readable" | "raw";
|
|
100
|
+
/** Wire codec chosen for one prepared value. Compact and readable default to `outline`. */
|
|
101
|
+
type AiInputCodec = "json" | "toon" | "text" | "outline";
|
|
102
|
+
/** `auto` stays on outline, JSON, or text until a matching approval and a tokenizer allow an alternate. */
|
|
103
|
+
type AiInputCodecChoice = "auto" | AiInputCodec;
|
|
104
|
+
type AiInputReadableFormat = "auto" | "json" | "toon" | "outline";
|
|
105
|
+
type AiInputSharing = "auto" | "off";
|
|
106
|
+
/** `raw` is the model body. `self-describing` adds the `@ai-input/1` header. */
|
|
107
|
+
type AiInputFraming = "self-describing" | "raw";
|
|
108
|
+
/** Optional `gpt-tokenizer` encodings. The package is not installed by the dispatcher. */
|
|
109
|
+
type AiInputTokenizer = "none" | "gpt:o200k_base" | "gpt:cl100k_base" | "gpt:p50k_base" | "gpt:p50k_edit" | "gpt:r50k_base";
|
|
110
|
+
/**
|
|
111
|
+
* How one dispatcher prepares model-visible input.
|
|
112
|
+
* Omitted fields use compact mode, `codec: "auto"`, `sharing: "auto"`, raw framing, and no tokenizer.
|
|
113
|
+
* Compact writes outline for structured values. `codec: "json"` keeps compact JSON. `mode: "raw"` keeps `JSON.stringify`.
|
|
114
|
+
*/
|
|
115
|
+
interface AiInputSettings {
|
|
116
|
+
mode?: AiInputMode;
|
|
117
|
+
codec?: AiInputCodecChoice;
|
|
118
|
+
readableFormat?: AiInputReadableFormat;
|
|
119
|
+
sharing?: AiInputSharing;
|
|
120
|
+
framing?: AiInputFraming;
|
|
121
|
+
/**
|
|
122
|
+
* Approval lookup id. Defaults to the effective model for the call.
|
|
123
|
+
* Does not change the model sent to the provider.
|
|
124
|
+
*/
|
|
125
|
+
model?: string;
|
|
126
|
+
tokenizer?: AiInputTokenizer;
|
|
127
|
+
/** Caller approvals. The dispatcher ships none. */
|
|
128
|
+
approvals?: readonly CapabilityApproval[];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* What preparation did for one call.
|
|
132
|
+
* Omitted when preparation stayed on the unchanged JSON or text baseline.
|
|
133
|
+
*/
|
|
134
|
+
interface InputResolution {
|
|
135
|
+
enabled: boolean;
|
|
136
|
+
/** Approval lookup id. Omitted when preparation is off or the call has no model id. */
|
|
137
|
+
model?: string;
|
|
138
|
+
mode?: AiInputMode;
|
|
139
|
+
codec?: AiInputCodec;
|
|
140
|
+
representation?: "value" | "shared-v1";
|
|
141
|
+
approvalSource?: "none" | "registry" | "explicit-caller" | "baseline";
|
|
142
|
+
changed: boolean;
|
|
143
|
+
}
|
|
96
144
|
/** Caller role stamp. Omitted or blank fields are not stored. */
|
|
97
145
|
interface RoleStamp {
|
|
98
146
|
role?: string;
|
|
@@ -194,6 +242,13 @@ interface AiDispatcherRequest extends RuntimeRequest {
|
|
|
194
242
|
* `endpoint` wins over `apiMode`. Stripped before the provider request is compiled.
|
|
195
243
|
*/
|
|
196
244
|
cloudflare?: CloudflareRequestOptions;
|
|
245
|
+
/**
|
|
246
|
+
* Input preparation for this call.
|
|
247
|
+
* Omit it to use the dispatcher default. `false` skips preparation.
|
|
248
|
+
* A settings object overrides the dispatcher default for this call, including turning it back on.
|
|
249
|
+
* Stripped before the provider payload is built. This is not the Responses `input` field.
|
|
250
|
+
*/
|
|
251
|
+
aiInput?: false | AiInputSettings;
|
|
197
252
|
}
|
|
198
253
|
interface DispatcherMcpTool {
|
|
199
254
|
name: string;
|
|
@@ -234,9 +289,17 @@ interface AiDispatcherOptions {
|
|
|
234
289
|
* The dispatcher trims on every call and adds a `METADATA_RECORD_TRIMMED` warning when it drops keys.
|
|
235
290
|
* The default keeps `agentId`, `orgId`, `stepId`, `skillId`, `role`, `roleLayer`,
|
|
236
291
|
* `roleDigest`, `profileChoice`, `recordId`, and `objectType`.
|
|
292
|
+
* A custom list replaces that default. Include `session_id`, `xtivix.caller`, and `xtivix.gate` when you pass one.
|
|
293
|
+
* With the default list, those short values stay until every longer unlisted value,
|
|
294
|
+
* including `xtivix.execution`, has been dropped.
|
|
237
295
|
*/
|
|
238
296
|
metadataPriority?: readonly string[];
|
|
239
297
|
logger?: RuntimeLogger;
|
|
298
|
+
/**
|
|
299
|
+
* Default input preparation. Omit it and every call uses compact `@x12i/ai-input`.
|
|
300
|
+
* `false` skips preparation unless a call passes settings.
|
|
301
|
+
*/
|
|
302
|
+
aiInput?: false | AiInputSettings;
|
|
240
303
|
}
|
|
241
304
|
interface CompiledOpenAiRequest {
|
|
242
305
|
provider: "openai";
|
|
@@ -248,6 +311,7 @@ interface CompiledOpenAiRequest {
|
|
|
248
311
|
effectiveModel: string;
|
|
249
312
|
reasoningResolution?: ReasoningResolution;
|
|
250
313
|
cacheResolution?: CacheResolution;
|
|
314
|
+
inputResolution?: InputResolution;
|
|
251
315
|
}
|
|
252
316
|
interface CompiledCloudflareRequest {
|
|
253
317
|
provider: "cloudflare";
|
|
@@ -261,6 +325,7 @@ interface CompiledCloudflareRequest {
|
|
|
261
325
|
effectiveModel: string;
|
|
262
326
|
reasoningResolution?: ReasoningResolution;
|
|
263
327
|
cacheResolution?: CacheResolution;
|
|
328
|
+
inputResolution?: InputResolution;
|
|
264
329
|
}
|
|
265
330
|
type CompiledAiRequest = (CompiledOpenRouterRequest & {
|
|
266
331
|
provider: "openrouter";
|
|
@@ -268,12 +333,14 @@ type CompiledAiRequest = (CompiledOpenRouterRequest & {
|
|
|
268
333
|
effectiveModel: string;
|
|
269
334
|
reasoningResolution?: ReasoningResolution;
|
|
270
335
|
cacheResolution?: CacheResolution;
|
|
336
|
+
inputResolution?: InputResolution;
|
|
271
337
|
}) | (CompiledBedrockRequest & {
|
|
272
338
|
provider: "bedrock";
|
|
273
339
|
requestedModel: string;
|
|
274
340
|
effectiveModel: string;
|
|
275
341
|
reasoningResolution?: ReasoningResolution;
|
|
276
342
|
cacheResolution?: CacheResolution;
|
|
343
|
+
inputResolution?: InputResolution;
|
|
277
344
|
}) | CompiledOpenAiRequest | CompiledCloudflareRequest;
|
|
278
345
|
interface AiDispatcherUsage extends RuntimeUsage {
|
|
279
346
|
/** Tokens read from a prompt cache. Omitted when the provider did not report any. */
|
|
@@ -286,6 +353,7 @@ interface AiDispatcherResponse extends RuntimeResponse {
|
|
|
286
353
|
reasoningText?: string;
|
|
287
354
|
reasoningResolution?: ReasoningResolution;
|
|
288
355
|
cacheResolution?: CacheResolution;
|
|
356
|
+
inputResolution?: InputResolution;
|
|
289
357
|
usage?: AiDispatcherUsage;
|
|
290
358
|
}
|
|
291
359
|
interface ProviderCallOptions {
|
|
@@ -309,16 +377,22 @@ interface CompiledOpenAiWireShape {
|
|
|
309
377
|
interface AiDispatcher {
|
|
310
378
|
run(request: AiDispatcherRequest): Promise<AiDispatcherResponse>;
|
|
311
379
|
executeStreamingChat(request: AiDispatcherRequest): AsyncIterable<RuntimeStreamEvent>;
|
|
312
|
-
compile(request: AiDispatcherRequest): CompiledAiRequest
|
|
380
|
+
compile(request: AiDispatcherRequest): Promise<CompiledAiRequest>;
|
|
313
381
|
/** Relists servers that implement `listTools`. Other servers stay as registered. */
|
|
314
382
|
refreshMcp(): Promise<void>;
|
|
315
383
|
readonly provider: AiProviderId;
|
|
316
384
|
}
|
|
317
385
|
|
|
318
|
-
/**
|
|
386
|
+
/**
|
|
387
|
+
* Identity keys stay when a record has to be trimmed. Earlier entries are kept ahead of later ones.
|
|
388
|
+
* `session_id`, `xtivix.caller`, and `xtivix.gate` stay off this list. A custom `metadataPriority` should include them.
|
|
389
|
+
*/
|
|
319
390
|
declare const DEFAULT_METADATA_PRIORITY: readonly ["agentId", "orgId", "stepId", "skillId", "role", "roleLayer", "roleDigest", "profileChoice", "recordId", "objectType"];
|
|
320
391
|
declare function createAiDispatcher(options?: AiDispatcherOptions): AiDispatcher;
|
|
321
392
|
|
|
393
|
+
/** Stored as `xtivix.gate` on every call this package packs. */
|
|
394
|
+
declare const AI_DISPATCHER_GATE = "ai-dispatcher";
|
|
395
|
+
|
|
322
396
|
declare class AiDispatcherError extends Error {
|
|
323
397
|
readonly code: string;
|
|
324
398
|
readonly details?: unknown | undefined;
|
|
@@ -334,4 +408,4 @@ declare function stripReasoningHistoryFields<T>(message: T, paths: readonly stri
|
|
|
334
408
|
|
|
335
409
|
declare function resolveProvider(requestProvider: AiProviderId | undefined, defaultProvider: AiProviderId): ImplementedAiProvider;
|
|
336
410
|
|
|
337
|
-
export { type AiDispatcher, AiDispatcherError, type AiDispatcherOptions, type AiDispatcherRequest, type AiDispatcherResponse, type AiDispatcherUsage, 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 OpenAiRuntimeOptions, type ReasoningResolution, type RoleStamp, createAiDispatcher, isImplementedAiProvider, providerNotImplemented, resolveProvider, stripReasoningHistoryFields };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export { ReasoningEffort, ReasoningOutcome, registerHostIntents } from '@x12i/ai
|
|
|
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';
|
|
6
|
+
import { CapabilityApproval } from '@x12i/ai-input/core';
|
|
7
|
+
export { CapabilityApproval } from '@x12i/ai-input/core';
|
|
6
8
|
import { CompiledBedrockRequest, BedrockRuntimeOptions } from '@x12i/bedrock-runtime';
|
|
7
9
|
export { BedrockClientLike, BedrockCredentials, BedrockRuntimeOptions, CompiledBedrockRequest } from '@x12i/bedrock-runtime';
|
|
8
10
|
|
|
@@ -93,6 +95,52 @@ interface OpenAiRuntimeOptions {
|
|
|
93
95
|
logger?: RuntimeLogger;
|
|
94
96
|
}
|
|
95
97
|
|
|
98
|
+
/** Compact and readable write outline. Raw is `JSON.stringify` or the original string. */
|
|
99
|
+
type AiInputMode = "compact" | "readable" | "raw";
|
|
100
|
+
/** Wire codec chosen for one prepared value. Compact and readable default to `outline`. */
|
|
101
|
+
type AiInputCodec = "json" | "toon" | "text" | "outline";
|
|
102
|
+
/** `auto` stays on outline, JSON, or text until a matching approval and a tokenizer allow an alternate. */
|
|
103
|
+
type AiInputCodecChoice = "auto" | AiInputCodec;
|
|
104
|
+
type AiInputReadableFormat = "auto" | "json" | "toon" | "outline";
|
|
105
|
+
type AiInputSharing = "auto" | "off";
|
|
106
|
+
/** `raw` is the model body. `self-describing` adds the `@ai-input/1` header. */
|
|
107
|
+
type AiInputFraming = "self-describing" | "raw";
|
|
108
|
+
/** Optional `gpt-tokenizer` encodings. The package is not installed by the dispatcher. */
|
|
109
|
+
type AiInputTokenizer = "none" | "gpt:o200k_base" | "gpt:cl100k_base" | "gpt:p50k_base" | "gpt:p50k_edit" | "gpt:r50k_base";
|
|
110
|
+
/**
|
|
111
|
+
* How one dispatcher prepares model-visible input.
|
|
112
|
+
* Omitted fields use compact mode, `codec: "auto"`, `sharing: "auto"`, raw framing, and no tokenizer.
|
|
113
|
+
* Compact writes outline for structured values. `codec: "json"` keeps compact JSON. `mode: "raw"` keeps `JSON.stringify`.
|
|
114
|
+
*/
|
|
115
|
+
interface AiInputSettings {
|
|
116
|
+
mode?: AiInputMode;
|
|
117
|
+
codec?: AiInputCodecChoice;
|
|
118
|
+
readableFormat?: AiInputReadableFormat;
|
|
119
|
+
sharing?: AiInputSharing;
|
|
120
|
+
framing?: AiInputFraming;
|
|
121
|
+
/**
|
|
122
|
+
* Approval lookup id. Defaults to the effective model for the call.
|
|
123
|
+
* Does not change the model sent to the provider.
|
|
124
|
+
*/
|
|
125
|
+
model?: string;
|
|
126
|
+
tokenizer?: AiInputTokenizer;
|
|
127
|
+
/** Caller approvals. The dispatcher ships none. */
|
|
128
|
+
approvals?: readonly CapabilityApproval[];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* What preparation did for one call.
|
|
132
|
+
* Omitted when preparation stayed on the unchanged JSON or text baseline.
|
|
133
|
+
*/
|
|
134
|
+
interface InputResolution {
|
|
135
|
+
enabled: boolean;
|
|
136
|
+
/** Approval lookup id. Omitted when preparation is off or the call has no model id. */
|
|
137
|
+
model?: string;
|
|
138
|
+
mode?: AiInputMode;
|
|
139
|
+
codec?: AiInputCodec;
|
|
140
|
+
representation?: "value" | "shared-v1";
|
|
141
|
+
approvalSource?: "none" | "registry" | "explicit-caller" | "baseline";
|
|
142
|
+
changed: boolean;
|
|
143
|
+
}
|
|
96
144
|
/** Caller role stamp. Omitted or blank fields are not stored. */
|
|
97
145
|
interface RoleStamp {
|
|
98
146
|
role?: string;
|
|
@@ -194,6 +242,13 @@ interface AiDispatcherRequest extends RuntimeRequest {
|
|
|
194
242
|
* `endpoint` wins over `apiMode`. Stripped before the provider request is compiled.
|
|
195
243
|
*/
|
|
196
244
|
cloudflare?: CloudflareRequestOptions;
|
|
245
|
+
/**
|
|
246
|
+
* Input preparation for this call.
|
|
247
|
+
* Omit it to use the dispatcher default. `false` skips preparation.
|
|
248
|
+
* A settings object overrides the dispatcher default for this call, including turning it back on.
|
|
249
|
+
* Stripped before the provider payload is built. This is not the Responses `input` field.
|
|
250
|
+
*/
|
|
251
|
+
aiInput?: false | AiInputSettings;
|
|
197
252
|
}
|
|
198
253
|
interface DispatcherMcpTool {
|
|
199
254
|
name: string;
|
|
@@ -234,9 +289,17 @@ interface AiDispatcherOptions {
|
|
|
234
289
|
* The dispatcher trims on every call and adds a `METADATA_RECORD_TRIMMED` warning when it drops keys.
|
|
235
290
|
* The default keeps `agentId`, `orgId`, `stepId`, `skillId`, `role`, `roleLayer`,
|
|
236
291
|
* `roleDigest`, `profileChoice`, `recordId`, and `objectType`.
|
|
292
|
+
* A custom list replaces that default. Include `session_id`, `xtivix.caller`, and `xtivix.gate` when you pass one.
|
|
293
|
+
* With the default list, those short values stay until every longer unlisted value,
|
|
294
|
+
* including `xtivix.execution`, has been dropped.
|
|
237
295
|
*/
|
|
238
296
|
metadataPriority?: readonly string[];
|
|
239
297
|
logger?: RuntimeLogger;
|
|
298
|
+
/**
|
|
299
|
+
* Default input preparation. Omit it and every call uses compact `@x12i/ai-input`.
|
|
300
|
+
* `false` skips preparation unless a call passes settings.
|
|
301
|
+
*/
|
|
302
|
+
aiInput?: false | AiInputSettings;
|
|
240
303
|
}
|
|
241
304
|
interface CompiledOpenAiRequest {
|
|
242
305
|
provider: "openai";
|
|
@@ -248,6 +311,7 @@ interface CompiledOpenAiRequest {
|
|
|
248
311
|
effectiveModel: string;
|
|
249
312
|
reasoningResolution?: ReasoningResolution;
|
|
250
313
|
cacheResolution?: CacheResolution;
|
|
314
|
+
inputResolution?: InputResolution;
|
|
251
315
|
}
|
|
252
316
|
interface CompiledCloudflareRequest {
|
|
253
317
|
provider: "cloudflare";
|
|
@@ -261,6 +325,7 @@ interface CompiledCloudflareRequest {
|
|
|
261
325
|
effectiveModel: string;
|
|
262
326
|
reasoningResolution?: ReasoningResolution;
|
|
263
327
|
cacheResolution?: CacheResolution;
|
|
328
|
+
inputResolution?: InputResolution;
|
|
264
329
|
}
|
|
265
330
|
type CompiledAiRequest = (CompiledOpenRouterRequest & {
|
|
266
331
|
provider: "openrouter";
|
|
@@ -268,12 +333,14 @@ type CompiledAiRequest = (CompiledOpenRouterRequest & {
|
|
|
268
333
|
effectiveModel: string;
|
|
269
334
|
reasoningResolution?: ReasoningResolution;
|
|
270
335
|
cacheResolution?: CacheResolution;
|
|
336
|
+
inputResolution?: InputResolution;
|
|
271
337
|
}) | (CompiledBedrockRequest & {
|
|
272
338
|
provider: "bedrock";
|
|
273
339
|
requestedModel: string;
|
|
274
340
|
effectiveModel: string;
|
|
275
341
|
reasoningResolution?: ReasoningResolution;
|
|
276
342
|
cacheResolution?: CacheResolution;
|
|
343
|
+
inputResolution?: InputResolution;
|
|
277
344
|
}) | CompiledOpenAiRequest | CompiledCloudflareRequest;
|
|
278
345
|
interface AiDispatcherUsage extends RuntimeUsage {
|
|
279
346
|
/** Tokens read from a prompt cache. Omitted when the provider did not report any. */
|
|
@@ -286,6 +353,7 @@ interface AiDispatcherResponse extends RuntimeResponse {
|
|
|
286
353
|
reasoningText?: string;
|
|
287
354
|
reasoningResolution?: ReasoningResolution;
|
|
288
355
|
cacheResolution?: CacheResolution;
|
|
356
|
+
inputResolution?: InputResolution;
|
|
289
357
|
usage?: AiDispatcherUsage;
|
|
290
358
|
}
|
|
291
359
|
interface ProviderCallOptions {
|
|
@@ -309,16 +377,22 @@ interface CompiledOpenAiWireShape {
|
|
|
309
377
|
interface AiDispatcher {
|
|
310
378
|
run(request: AiDispatcherRequest): Promise<AiDispatcherResponse>;
|
|
311
379
|
executeStreamingChat(request: AiDispatcherRequest): AsyncIterable<RuntimeStreamEvent>;
|
|
312
|
-
compile(request: AiDispatcherRequest): CompiledAiRequest
|
|
380
|
+
compile(request: AiDispatcherRequest): Promise<CompiledAiRequest>;
|
|
313
381
|
/** Relists servers that implement `listTools`. Other servers stay as registered. */
|
|
314
382
|
refreshMcp(): Promise<void>;
|
|
315
383
|
readonly provider: AiProviderId;
|
|
316
384
|
}
|
|
317
385
|
|
|
318
|
-
/**
|
|
386
|
+
/**
|
|
387
|
+
* Identity keys stay when a record has to be trimmed. Earlier entries are kept ahead of later ones.
|
|
388
|
+
* `session_id`, `xtivix.caller`, and `xtivix.gate` stay off this list. A custom `metadataPriority` should include them.
|
|
389
|
+
*/
|
|
319
390
|
declare const DEFAULT_METADATA_PRIORITY: readonly ["agentId", "orgId", "stepId", "skillId", "role", "roleLayer", "roleDigest", "profileChoice", "recordId", "objectType"];
|
|
320
391
|
declare function createAiDispatcher(options?: AiDispatcherOptions): AiDispatcher;
|
|
321
392
|
|
|
393
|
+
/** Stored as `xtivix.gate` on every call this package packs. */
|
|
394
|
+
declare const AI_DISPATCHER_GATE = "ai-dispatcher";
|
|
395
|
+
|
|
322
396
|
declare class AiDispatcherError extends Error {
|
|
323
397
|
readonly code: string;
|
|
324
398
|
readonly details?: unknown | undefined;
|
|
@@ -334,4 +408,4 @@ declare function stripReasoningHistoryFields<T>(message: T, paths: readonly stri
|
|
|
334
408
|
|
|
335
409
|
declare function resolveProvider(requestProvider: AiProviderId | undefined, defaultProvider: AiProviderId): ImplementedAiProvider;
|
|
336
410
|
|
|
337
|
-
export { type AiDispatcher, AiDispatcherError, type AiDispatcherOptions, type AiDispatcherRequest, type AiDispatcherResponse, type AiDispatcherUsage, 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 OpenAiRuntimeOptions, type ReasoningResolution, type RoleStamp, createAiDispatcher, isImplementedAiProvider, providerNotImplemented, resolveProvider, stripReasoningHistoryFields };
|
|
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 };
|