@fgv/ts-extras 5.1.0-26 → 5.1.0-27
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.browser.js +2 -2
- package/dist/index.browser.js.map +1 -1
- package/dist/packlets/ai-assist/apiClient.js +300 -213
- package/dist/packlets/ai-assist/apiClient.js.map +1 -1
- package/dist/packlets/ai-assist/chatRequestBuilders.js +6 -0
- package/dist/packlets/ai-assist/chatRequestBuilders.js.map +1 -1
- package/dist/packlets/ai-assist/imageOptionsResolver.js +212 -0
- package/dist/packlets/ai-assist/imageOptionsResolver.js.map +1 -0
- package/dist/packlets/ai-assist/index.js +1 -0
- package/dist/packlets/ai-assist/index.js.map +1 -1
- package/dist/packlets/ai-assist/model.js +1 -1
- package/dist/packlets/ai-assist/model.js.map +1 -1
- package/dist/packlets/ai-assist/registry.js +120 -22
- package/dist/packlets/ai-assist/registry.js.map +1 -1
- package/dist/packlets/ai-assist/sseParser.js +1 -0
- package/dist/packlets/ai-assist/sseParser.js.map +1 -1
- package/dist/packlets/ai-assist/streamingAdapters/anthropic.js +17 -12
- package/dist/packlets/ai-assist/streamingAdapters/anthropic.js.map +1 -1
- package/dist/packlets/ai-assist/streamingAdapters/common.js +2 -0
- package/dist/packlets/ai-assist/streamingAdapters/common.js.map +1 -1
- package/dist/packlets/ai-assist/streamingAdapters/gemini.js +17 -5
- package/dist/packlets/ai-assist/streamingAdapters/gemini.js.map +1 -1
- package/dist/packlets/ai-assist/streamingAdapters/openaiChat.js +19 -4
- package/dist/packlets/ai-assist/streamingAdapters/openaiChat.js.map +1 -1
- package/dist/packlets/ai-assist/streamingAdapters/openaiResponses.js +20 -5
- package/dist/packlets/ai-assist/streamingAdapters/openaiResponses.js.map +1 -1
- package/dist/packlets/ai-assist/streamingAdapters/proxy.js +9 -3
- package/dist/packlets/ai-assist/streamingAdapters/proxy.js.map +1 -1
- package/dist/packlets/ai-assist/streamingClient.js +28 -6
- package/dist/packlets/ai-assist/streamingClient.js.map +1 -1
- package/dist/packlets/ai-assist/thinkingOptionsResolver.js +265 -0
- package/dist/packlets/ai-assist/thinkingOptionsResolver.js.map +1 -0
- package/dist/packlets/conversion/converters.js +1 -0
- package/dist/packlets/conversion/converters.js.map +1 -1
- package/dist/packlets/crypto-utils/keystore/keyStore.js +2 -1
- package/dist/packlets/crypto-utils/keystore/keyStore.js.map +1 -1
- package/dist/ts-extras.d.ts +595 -119
- package/lib/index.browser.d.ts +2 -2
- package/lib/index.browser.d.ts.map +1 -1
- package/lib/index.browser.js +4 -3
- package/lib/index.browser.js.map +1 -1
- package/lib/packlets/ai-assist/apiClient.d.ts +29 -85
- package/lib/packlets/ai-assist/apiClient.d.ts.map +1 -1
- package/lib/packlets/ai-assist/apiClient.js +300 -213
- package/lib/packlets/ai-assist/apiClient.js.map +1 -1
- package/lib/packlets/ai-assist/chatRequestBuilders.d.ts.map +1 -1
- package/lib/packlets/ai-assist/chatRequestBuilders.js +6 -0
- package/lib/packlets/ai-assist/chatRequestBuilders.js.map +1 -1
- package/lib/packlets/ai-assist/imageOptionsResolver.d.ts +74 -0
- package/lib/packlets/ai-assist/imageOptionsResolver.d.ts.map +1 -0
- package/lib/packlets/ai-assist/imageOptionsResolver.js +216 -0
- package/lib/packlets/ai-assist/imageOptionsResolver.js.map +1 -0
- package/lib/packlets/ai-assist/index.d.ts +2 -1
- package/lib/packlets/ai-assist/index.d.ts.map +1 -1
- package/lib/packlets/ai-assist/index.js +4 -1
- package/lib/packlets/ai-assist/index.js.map +1 -1
- package/lib/packlets/ai-assist/model.d.ts +410 -35
- package/lib/packlets/ai-assist/model.d.ts.map +1 -1
- package/lib/packlets/ai-assist/model.js +1 -1
- package/lib/packlets/ai-assist/model.js.map +1 -1
- package/lib/packlets/ai-assist/registry.d.ts.map +1 -1
- package/lib/packlets/ai-assist/registry.js +120 -22
- package/lib/packlets/ai-assist/registry.js.map +1 -1
- package/lib/packlets/ai-assist/sseParser.d.ts.map +1 -1
- package/lib/packlets/ai-assist/sseParser.js +1 -0
- package/lib/packlets/ai-assist/sseParser.js.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/anthropic.d.ts +2 -1
- package/lib/packlets/ai-assist/streamingAdapters/anthropic.d.ts.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/anthropic.js +17 -12
- package/lib/packlets/ai-assist/streamingAdapters/anthropic.js.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/common.d.ts +5 -1
- package/lib/packlets/ai-assist/streamingAdapters/common.d.ts.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/common.js +2 -0
- package/lib/packlets/ai-assist/streamingAdapters/common.js.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/gemini.d.ts +2 -1
- package/lib/packlets/ai-assist/streamingAdapters/gemini.d.ts.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/gemini.js +17 -5
- package/lib/packlets/ai-assist/streamingAdapters/gemini.js.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/openaiChat.d.ts +2 -1
- package/lib/packlets/ai-assist/streamingAdapters/openaiChat.d.ts.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/openaiChat.js +19 -4
- package/lib/packlets/ai-assist/streamingAdapters/openaiChat.js.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.d.ts +2 -1
- package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.d.ts.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.js +20 -5
- package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.js.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/proxy.d.ts.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/proxy.js +9 -3
- package/lib/packlets/ai-assist/streamingAdapters/proxy.js.map +1 -1
- package/lib/packlets/ai-assist/streamingClient.d.ts.map +1 -1
- package/lib/packlets/ai-assist/streamingClient.js +28 -6
- package/lib/packlets/ai-assist/streamingClient.js.map +1 -1
- package/lib/packlets/ai-assist/thinkingOptionsResolver.d.ts +71 -0
- package/lib/packlets/ai-assist/thinkingOptionsResolver.d.ts.map +1 -0
- package/lib/packlets/ai-assist/thinkingOptionsResolver.js +270 -0
- package/lib/packlets/ai-assist/thinkingOptionsResolver.js.map +1 -0
- package/lib/packlets/conversion/converters.d.ts.map +1 -1
- package/lib/packlets/conversion/converters.js +1 -0
- package/lib/packlets/conversion/converters.js.map +1 -1
- package/lib/packlets/crypto-utils/keystore/keyStore.d.ts.map +1 -1
- package/lib/packlets/crypto-utils/keystore/keyStore.js +2 -1
- package/lib/packlets/crypto-utils/keystore/keyStore.js.map +1 -1
- package/package.json +13 -13
package/dist/ts-extras.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Converter } from '@fgv/ts-utils';
|
|
|
3
3
|
import { DateTime } from 'luxon';
|
|
4
4
|
import { FileTree } from '@fgv/ts-json-base';
|
|
5
5
|
import { Hash as Hash_2 } from '@fgv/ts-utils';
|
|
6
|
+
import { JsonObject } from '@fgv/ts-json-base';
|
|
6
7
|
import { JsonValue } from '@fgv/ts-json-base';
|
|
7
8
|
import { Logging } from '@fgv/ts-utils';
|
|
8
9
|
import { Result } from '@fgv/ts-utils';
|
|
@@ -42,6 +43,30 @@ declare namespace AiAssist {
|
|
|
42
43
|
IAiAssistKeyStore,
|
|
43
44
|
IAiImageAttachment,
|
|
44
45
|
IAiImageData,
|
|
46
|
+
AiImageSize,
|
|
47
|
+
AiImageQuality,
|
|
48
|
+
DallE2Size,
|
|
49
|
+
DallE3Size,
|
|
50
|
+
GptImageSize,
|
|
51
|
+
DallE3Quality,
|
|
52
|
+
GptImageQuality,
|
|
53
|
+
DallEModelNames,
|
|
54
|
+
GptImageModelNames,
|
|
55
|
+
GrokImagineModelNames,
|
|
56
|
+
Imagen4ModelNames,
|
|
57
|
+
GeminiFlashImageModelNames,
|
|
58
|
+
IDallEImageGenerationConfig,
|
|
59
|
+
IGptImageGenerationConfig,
|
|
60
|
+
IGrokImagineImageGenerationConfig,
|
|
61
|
+
IImagen4GenerationConfig,
|
|
62
|
+
IGeminiFlashImageGenerationConfig,
|
|
63
|
+
IDallEModelOptions,
|
|
64
|
+
IGptImageModelOptions,
|
|
65
|
+
IGrokImagineModelOptions,
|
|
66
|
+
IImagen4ModelOptions,
|
|
67
|
+
IGeminiFlashImageModelOptions,
|
|
68
|
+
IOtherModelOptions,
|
|
69
|
+
IModelFamilyConfig,
|
|
45
70
|
IAiImageGenerationOptions,
|
|
46
71
|
IAiImageGenerationParams,
|
|
47
72
|
IAiGeneratedImage,
|
|
@@ -61,6 +86,25 @@ declare namespace AiAssist {
|
|
|
61
86
|
MODEL_SPEC_BASE_KEY,
|
|
62
87
|
resolveModel,
|
|
63
88
|
toDataUrl,
|
|
89
|
+
AiThinkingMode,
|
|
90
|
+
IThinkingConfig,
|
|
91
|
+
IThinkingProviderConfig,
|
|
92
|
+
IAnthropicThinkingOptions,
|
|
93
|
+
IOpenAiThinkingOptions,
|
|
94
|
+
IGeminiThinkingOptions,
|
|
95
|
+
IXAiThinkingOptions,
|
|
96
|
+
IOtherThinkingOptions,
|
|
97
|
+
IAnthropicThinkingConfig,
|
|
98
|
+
IOpenAiThinkingConfig,
|
|
99
|
+
IGeminiThinkingConfig,
|
|
100
|
+
IXAiThinkingConfig,
|
|
101
|
+
AnthropicThinkingModelNames,
|
|
102
|
+
OpenAiThinkingModelNames,
|
|
103
|
+
GeminiThinkingModelNames,
|
|
104
|
+
XAiThinkingModelNames,
|
|
105
|
+
IResolvedImageOptions,
|
|
106
|
+
resolveImageOptions,
|
|
107
|
+
validateResolvedOptions,
|
|
64
108
|
allProviderIds,
|
|
65
109
|
getProviderDescriptors,
|
|
66
110
|
getProviderDescriptor,
|
|
@@ -121,8 +165,9 @@ declare const aiAssistSettings: Converter<IAiAssistSettings>;
|
|
|
121
165
|
* @remarks
|
|
122
166
|
* - `'openai-images'` — OpenAI Images API. Routes to `/images/generations`
|
|
123
167
|
* (text-only) or `/images/edits` (when reference images are present).
|
|
124
|
-
* - `'xai-images'` — xAI Images API.
|
|
125
|
-
*
|
|
168
|
+
* - `'xai-images'` — xAI Images API. Text-only JSON generation request.
|
|
169
|
+
* - `'xai-images-edits'` — xAI Images API for Grok Imagine models. Uses JSON
|
|
170
|
+
* body with `{ type: "image_url" }` objects (not multipart).
|
|
126
171
|
* - `'gemini-imagen'` — Google Imagen `:predict` endpoint. Text-only.
|
|
127
172
|
* - `'gemini-image-out'` — Google Gemini chat-style `:generateContent`
|
|
128
173
|
* endpoint that returns image parts (Gemini 2.5 Flash Image / "Nano
|
|
@@ -130,7 +175,13 @@ declare const aiAssistSettings: Converter<IAiAssistSettings>;
|
|
|
130
175
|
*
|
|
131
176
|
* @public
|
|
132
177
|
*/
|
|
133
|
-
declare type AiImageApiFormat = 'openai-images' | 'gemini-imagen' | 'xai-images' | 'gemini-image-out';
|
|
178
|
+
declare type AiImageApiFormat = 'openai-images' | 'gemini-imagen' | 'xai-images' | 'xai-images-edits' | 'gemini-image-out';
|
|
179
|
+
|
|
180
|
+
/** All accepted quality strings across all providers. @public */
|
|
181
|
+
declare type AiImageQuality = DallE3Quality | GptImageQuality;
|
|
182
|
+
|
|
183
|
+
/** All accepted image size strings across all providers. @public */
|
|
184
|
+
declare type AiImageSize = DallE2Size | DallE3Size | GptImageSize;
|
|
134
185
|
|
|
135
186
|
/**
|
|
136
187
|
* Capability vocabulary used to describe what a model can do. Used as both
|
|
@@ -143,7 +194,7 @@ declare type AiImageApiFormat = 'openai-images' | 'gemini-imagen' | 'xai-images'
|
|
|
143
194
|
*
|
|
144
195
|
* @public
|
|
145
196
|
*/
|
|
146
|
-
declare type AiModelCapability = 'chat' | 'tools' | 'vision' | 'image-generation';
|
|
197
|
+
declare type AiModelCapability = 'chat' | 'tools' | 'vision' | 'image-generation' | 'thinking';
|
|
147
198
|
|
|
148
199
|
/**
|
|
149
200
|
* A structured AI prompt with system/user split for direct API calls,
|
|
@@ -206,6 +257,12 @@ declare type AiServerToolType = 'web_search';
|
|
|
206
257
|
*/
|
|
207
258
|
declare const aiServerToolType: Converter<AiServerToolType>;
|
|
208
259
|
|
|
260
|
+
/**
|
|
261
|
+
* Thinking/reasoning mode support for a provider.
|
|
262
|
+
* @public
|
|
263
|
+
*/
|
|
264
|
+
declare type AiThinkingMode = 'optional' | 'required' | 'unsupported';
|
|
265
|
+
|
|
209
266
|
/**
|
|
210
267
|
* Converter for {@link IAiToolEnablement}.
|
|
211
268
|
* @public
|
|
@@ -254,6 +311,12 @@ declare const allModelSpecKeys: ReadonlyArray<ModelSpecKey>;
|
|
|
254
311
|
*/
|
|
255
312
|
declare const allProviderIds: ReadonlyArray<AiProviderId>;
|
|
256
313
|
|
|
314
|
+
/**
|
|
315
|
+
* Model IDs for Anthropic thinking-capable models.
|
|
316
|
+
* @public
|
|
317
|
+
*/
|
|
318
|
+
declare type AnthropicThinkingModelNames = 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7';
|
|
319
|
+
|
|
257
320
|
/**
|
|
258
321
|
* Converter for base64 strings (validates format).
|
|
259
322
|
* @public
|
|
@@ -262,17 +325,8 @@ declare const base64String: Converter<string>;
|
|
|
262
325
|
|
|
263
326
|
/**
|
|
264
327
|
* Calls the appropriate chat completion API for a given provider.
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
* - `'openai'` for xAI, OpenAI, Groq, Mistral
|
|
268
|
-
* - `'anthropic'` for Anthropic Claude
|
|
269
|
-
* - `'gemini'` for Google Gemini
|
|
270
|
-
*
|
|
271
|
-
* When tools are provided and the provider supports them:
|
|
272
|
-
* - OpenAI-format providers switch to the Responses API
|
|
273
|
-
* - Anthropic includes tools in the Messages API request
|
|
274
|
-
* - Gemini includes Google Search grounding
|
|
275
|
-
*
|
|
328
|
+
* Routes by `apiFormat`: `'openai'` (xAI/OpenAI/Groq/Mistral — switches to Responses API when
|
|
329
|
+
* tools are set), `'anthropic'`, or `'gemini'`.
|
|
276
330
|
* @param params - Request parameters including descriptor, API key, prompt, and optional tools
|
|
277
331
|
* @returns The completion response with content and truncation status, or a failure
|
|
278
332
|
* @public
|
|
@@ -301,19 +355,10 @@ declare function callProviderCompletionStream(params: IProviderCompletionStreamP
|
|
|
301
355
|
|
|
302
356
|
/**
|
|
303
357
|
* Calls the appropriate image-generation API for a given provider.
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
* - `'openai-images'` for OpenAI (DALL-E, gpt-image-1)
|
|
309
|
-
* - `'xai-images'` for xAI Grok image models
|
|
310
|
-
* - `'gemini-imagen'` for Google Imagen `:predict`
|
|
311
|
-
* - `'gemini-image-out'` for Gemini chat-style image output (Nano Banana)
|
|
312
|
-
*
|
|
313
|
-
* Image-model selection reuses the existing `'image'` {@link ModelSpecKey}.
|
|
314
|
-
* When `request.referenceImages` is non-empty, the call is rejected up front
|
|
315
|
-
* unless the resolved capability declares `acceptsImageReferenceInput`.
|
|
316
|
-
*
|
|
358
|
+
* Routes by the `format` field of the resolved {@link IAiImageModelCapability}:
|
|
359
|
+
* `'openai-images'`, `'xai-images'`, `'xai-images-edits'`, `'gemini-imagen'`,
|
|
360
|
+
* or `'gemini-image-out'`. Rejects up front if `referenceImages` is set but the
|
|
361
|
+
* capability does not declare `acceptsImageReferenceInput`.
|
|
317
362
|
* @param params - Request parameters including descriptor, API key, and prompt
|
|
318
363
|
* @returns The generated images, or a failure
|
|
319
364
|
* @public
|
|
@@ -321,12 +366,8 @@ declare function callProviderCompletionStream(params: IProviderCompletionStreamP
|
|
|
321
366
|
declare function callProviderImageGeneration(params: IProviderImageGenerationParams): Promise<Result<IAiImageGenerationResponse>>;
|
|
322
367
|
|
|
323
368
|
/**
|
|
324
|
-
* Lists models available from a provider,
|
|
325
|
-
* native provider info
|
|
326
|
-
*
|
|
327
|
-
* Routes based on `descriptor.apiFormat` — listing reuses the existing
|
|
328
|
-
* format dispatch and does not require a separate descriptor field.
|
|
329
|
-
*
|
|
369
|
+
* Lists models available from a provider, routing by `descriptor.apiFormat`.
|
|
370
|
+
* Capabilities are resolved from native provider info and a configurable rule set.
|
|
330
371
|
* @param params - Request parameters including descriptor, API key, and optional capability filter
|
|
331
372
|
* @returns The resolved model list, or a failure
|
|
332
373
|
* @public
|
|
@@ -374,20 +415,11 @@ declare function callProxiedCompletionStream(proxyUrl: string, params: IProvider
|
|
|
374
415
|
/**
|
|
375
416
|
* Calls the image-generation endpoint on a proxy server instead of calling
|
|
376
417
|
* the provider API directly from the browser.
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
* - Success response body: an {@link IAiImageGenerationResponse}
|
|
383
|
-
* - Error response body: `{error: string}` (surfaced as `proxy: ${error}`)
|
|
384
|
-
*
|
|
385
|
-
* The proxy server is responsible for descriptor lookup, model resolution,
|
|
386
|
-
* provider dispatch, and response normalization. When `params.referenceImages`
|
|
387
|
-
* is present, the proxy is also responsible for repackaging it into the
|
|
388
|
-
* upstream wire format (e.g. multipart/form-data for OpenAI `/images/edits`,
|
|
389
|
-
* `inlineData` parts for Gemini `:generateContent`).
|
|
390
|
-
*
|
|
418
|
+
* Endpoint: `POST ${proxyUrl}/api/ai/image-generation`. Request body:
|
|
419
|
+
* `{providerId, apiKey, params, modelOverride?}`. The proxy handles descriptor
|
|
420
|
+
* lookup, model resolution, provider dispatch, and response normalization
|
|
421
|
+
* (including repackaging `referenceImages` for the upstream wire format).
|
|
422
|
+
* Error body `{error: string}` is surfaced as `proxy: ${error}`.
|
|
391
423
|
* @param proxyUrl - Base URL of the proxy server (e.g. `http://localhost:3001`)
|
|
392
424
|
* @param params - Same parameters as {@link callProviderImageGeneration}
|
|
393
425
|
* @returns The generated images, or a failure
|
|
@@ -397,18 +429,9 @@ declare function callProxiedImageGeneration(proxyUrl: string, params: IProviderI
|
|
|
397
429
|
|
|
398
430
|
/**
|
|
399
431
|
* Calls the model-listing endpoint on a proxy server.
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
* - Endpoint: `POST ${proxyUrl}/api/ai/list-models`
|
|
404
|
-
* - Request body: `{providerId, apiKey, capability?}`. Capability config is
|
|
405
|
-
* not forwarded — the proxy applies its own (typically the same default
|
|
406
|
-
* the library ships).
|
|
407
|
-
* - Success response body: an `IAiModelInfo[]` (under key `models`) where
|
|
408
|
-
* `capabilities` is serialized as a string array (not Set, which doesn't
|
|
409
|
-
* round-trip through JSON).
|
|
410
|
-
* - Error response body: `{error: string}`, surfaced as `proxy: ${error}`.
|
|
411
|
-
*
|
|
432
|
+
* Endpoint: `POST ${proxyUrl}/api/ai/list-models`. Capability config is not
|
|
433
|
+
* forwarded. `capabilities` is serialized as a string array. Error body
|
|
434
|
+
* `{error: string}` is surfaced as `proxy: ${error}`.
|
|
412
435
|
* @public
|
|
413
436
|
*/
|
|
414
437
|
declare function callProxiedListModels(proxyUrl: string, params: IProviderListModelsParams): Promise<Result<ReadonlyArray<IAiModelInfo>>>;
|
|
@@ -550,6 +573,18 @@ declare interface CsvOptions {
|
|
|
550
573
|
delimiter?: string;
|
|
551
574
|
}
|
|
552
575
|
|
|
576
|
+
/** Pixel dimension sizes accepted by dall-e-2. @public */
|
|
577
|
+
declare type DallE2Size = '256x256' | '512x512' | '1024x1024';
|
|
578
|
+
|
|
579
|
+
/** Quality values for dall-e-3. @public */
|
|
580
|
+
declare type DallE3Quality = 'standard' | 'hd';
|
|
581
|
+
|
|
582
|
+
/** Pixel dimension sizes accepted by dall-e-3. @public */
|
|
583
|
+
declare type DallE3Size = '1024x1024' | '1792x1024' | '1024x1792';
|
|
584
|
+
|
|
585
|
+
/** Model names in the DALL-E family. @public */
|
|
586
|
+
declare type DallEModelNames = 'dall-e-2' | 'dall-e-3';
|
|
587
|
+
|
|
553
588
|
/**
|
|
554
589
|
* Decrypts an {@link CryptoUtils.IEncryptedFile | encrypted file} and returns the JSON content.
|
|
555
590
|
* @typeParam TPayload - Expected type of decrypted content
|
|
@@ -936,6 +971,15 @@ declare const GCM_AUTH_TAG_SIZE: number;
|
|
|
936
971
|
*/
|
|
937
972
|
declare const GCM_IV_SIZE: number;
|
|
938
973
|
|
|
974
|
+
/** Model names in the Gemini Flash Image family. @public */
|
|
975
|
+
declare type GeminiFlashImageModelNames = 'gemini-2.5-flash-image';
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* Model IDs for Google Gemini thinking-capable models.
|
|
979
|
+
* @public
|
|
980
|
+
*/
|
|
981
|
+
declare type GeminiThinkingModelNames = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite';
|
|
982
|
+
|
|
939
983
|
/**
|
|
940
984
|
* Calls {@link AiAssist.callProviderCompletion}, then runs the response text
|
|
941
985
|
* through a tolerant JSON converter (default:
|
|
@@ -972,6 +1016,18 @@ declare function getProviderDescriptor(id: string): Result<IAiProviderDescriptor
|
|
|
972
1016
|
*/
|
|
973
1017
|
declare function getProviderDescriptors(): ReadonlyArray<IAiProviderDescriptor>;
|
|
974
1018
|
|
|
1019
|
+
/** Model names in the GPT Image family. @public */
|
|
1020
|
+
declare type GptImageModelNames = 'gpt-image-1';
|
|
1021
|
+
|
|
1022
|
+
/** Quality values for gpt-image-1. @public */
|
|
1023
|
+
declare type GptImageQuality = 'low' | 'medium' | 'high' | 'auto';
|
|
1024
|
+
|
|
1025
|
+
/** Pixel dimension sizes accepted by gpt-image-1. @public */
|
|
1026
|
+
declare type GptImageSize = '1024x1024' | '1536x1024' | '1024x1536' | 'auto';
|
|
1027
|
+
|
|
1028
|
+
/** Model names in the xAI Grok Imagine family. @public */
|
|
1029
|
+
declare type GrokImagineModelNames = 'grok-imagine-image' | 'grok-imagine-image-quality';
|
|
1030
|
+
|
|
975
1031
|
declare namespace Hash {
|
|
976
1032
|
export {
|
|
977
1033
|
Md5Normalizer
|
|
@@ -1205,39 +1261,46 @@ declare interface IAiImageData {
|
|
|
1205
1261
|
* Options for image generation requests.
|
|
1206
1262
|
*
|
|
1207
1263
|
* @remarks
|
|
1208
|
-
*
|
|
1209
|
-
*
|
|
1210
|
-
*
|
|
1264
|
+
* Uses a layered architecture:
|
|
1265
|
+
* 1. Generic top-level options (size, count, quality, seed) apply across providers
|
|
1266
|
+
* via the resolved model's registry mapping.
|
|
1267
|
+
* 2. Optional `models` array contains model-family-scoped blocks; the resolver
|
|
1268
|
+
* picks applicable blocks based on the resolved model and applies them in
|
|
1269
|
+
* declaration order.
|
|
1270
|
+
*
|
|
1271
|
+
* **Merge precedence (later wins):**
|
|
1272
|
+
* 1. Generic top-level options (lowest precedence)
|
|
1273
|
+
* 2. Family-generic blocks (matching family, models field omitted)
|
|
1274
|
+
* 3. Model-specific blocks (models array includes resolved model name)
|
|
1275
|
+
* 4. Other blocks (provider: 'other', models array includes resolved model name)
|
|
1276
|
+
*
|
|
1277
|
+
* Provider-mismatch: blocks whose provider doesn't match the dispatcher's
|
|
1278
|
+
* provider lineage are silently skipped.
|
|
1211
1279
|
*
|
|
1212
1280
|
* @public
|
|
1213
1281
|
*/
|
|
1214
1282
|
declare interface IAiImageGenerationOptions {
|
|
1215
1283
|
/**
|
|
1216
|
-
* Image dimensions
|
|
1217
|
-
*
|
|
1218
|
-
* {@link IAiImageGenerationOptions.imagen} `aspectRatio` instead.
|
|
1219
|
-
*
|
|
1220
|
-
* Note: each model has its own accepted set; `dall-e-3` only accepts the
|
|
1221
|
-
* values listed here.
|
|
1284
|
+
* Image dimensions for OpenAI models (mapped to `size` field).
|
|
1285
|
+
* For xAI aspect ratio or Imagen aspect ratio, use the corresponding `models` family block.
|
|
1222
1286
|
*/
|
|
1223
|
-
readonly size?:
|
|
1287
|
+
readonly size?: AiImageSize;
|
|
1288
|
+
/** Number of images. Default 1. Some models enforce a maximum. */
|
|
1289
|
+
readonly count?: number;
|
|
1224
1290
|
/**
|
|
1225
|
-
*
|
|
1226
|
-
*
|
|
1227
|
-
*
|
|
1291
|
+
* Quality tier. Accepted values differ per model:
|
|
1292
|
+
* - dall-e-3: 'standard' | 'hd'
|
|
1293
|
+
* - gpt-image-1: 'low' | 'medium' | 'high' | 'auto'
|
|
1294
|
+
* Other models ignore this field.
|
|
1228
1295
|
*/
|
|
1229
|
-
readonly
|
|
1230
|
-
/**
|
|
1231
|
-
readonly quality?: 'standard' | 'high';
|
|
1232
|
-
/** Random seed for reproducibility, where supported. */
|
|
1296
|
+
readonly quality?: AiImageQuality;
|
|
1297
|
+
/** Reproducibility seed, where supported. */
|
|
1233
1298
|
readonly seed?: number;
|
|
1234
1299
|
/**
|
|
1235
|
-
*
|
|
1300
|
+
* Optional precision via model-family-scoped blocks. The resolver picks
|
|
1301
|
+
* applicable blocks dynamically based on the resolved model.
|
|
1236
1302
|
*/
|
|
1237
|
-
readonly
|
|
1238
|
-
readonly negativePrompt?: string;
|
|
1239
|
-
readonly aspectRatio?: '1:1' | '3:4' | '4:3' | '9:16' | '16:9';
|
|
1240
|
-
};
|
|
1303
|
+
readonly models?: ReadonlyArray<IModelFamilyConfig>;
|
|
1241
1304
|
}
|
|
1242
1305
|
|
|
1243
1306
|
/**
|
|
@@ -1290,13 +1353,25 @@ declare interface IAiImageModelCapability {
|
|
|
1290
1353
|
* Whether matching models accept reference images via
|
|
1291
1354
|
* {@link AiAssist.IAiImageGenerationParams.referenceImages}. When false or
|
|
1292
1355
|
* undefined, calls that include reference images are rejected up front.
|
|
1293
|
-
*
|
|
1294
|
-
* @remarks
|
|
1295
|
-
* Per-model constraints beyond ref support (e.g. dall-e-3 ignores edits)
|
|
1296
|
-
* are not validated here and surface as provider 400s, consistent with the
|
|
1297
|
-
* existing image-generation policy.
|
|
1298
1356
|
*/
|
|
1299
1357
|
readonly acceptsImageReferenceInput?: boolean;
|
|
1358
|
+
/** Accepted size strings. When present, dispatcher pre-validates. */
|
|
1359
|
+
readonly acceptedSizes?: ReadonlyArray<string>;
|
|
1360
|
+
/** When true, quality param is sent. When false/undefined, don't send quality. */
|
|
1361
|
+
readonly supportsQualityParam?: boolean;
|
|
1362
|
+
/** Accepted quality values when supportsQualityParam is true. */
|
|
1363
|
+
readonly acceptedQualities?: ReadonlyArray<string>;
|
|
1364
|
+
/** Maximum count (n). When present, dispatcher pre-validates. */
|
|
1365
|
+
readonly maxCount?: number;
|
|
1366
|
+
/**
|
|
1367
|
+
* How to encode the output format on the wire:
|
|
1368
|
+
* - 'response-format': send response_format: 'b64_json' (dall-e-2, dall-e-3)
|
|
1369
|
+
* - 'output-format': send output_format (gpt-image-1)
|
|
1370
|
+
* - 'none': send neither (Imagen, Gemini Flash)
|
|
1371
|
+
*/
|
|
1372
|
+
readonly outputParamStyle?: 'response-format' | 'output-format' | 'none';
|
|
1373
|
+
/** Default MIME type for response images. */
|
|
1374
|
+
readonly defaultOutputMimeType?: string;
|
|
1300
1375
|
}
|
|
1301
1376
|
|
|
1302
1377
|
/**
|
|
@@ -1386,6 +1461,13 @@ declare interface IAiProviderDescriptor {
|
|
|
1386
1461
|
* `prompt.attachments` are rejected up front.
|
|
1387
1462
|
*/
|
|
1388
1463
|
readonly acceptsImageInput: boolean;
|
|
1464
|
+
/**
|
|
1465
|
+
* Whether this provider supports thinking/reasoning mode.
|
|
1466
|
+
* - 'optional': thinking can be enabled but is not required
|
|
1467
|
+
* - 'required': thinking is always active (e.g. o-series models)
|
|
1468
|
+
* - 'unsupported': thinking is not supported
|
|
1469
|
+
*/
|
|
1470
|
+
readonly thinkingMode: AiThinkingMode;
|
|
1389
1471
|
/**
|
|
1390
1472
|
* Image-generation capabilities, scoped to model id prefixes. Empty or
|
|
1391
1473
|
* undefined means the provider does not support image generation.
|
|
@@ -1510,6 +1592,29 @@ declare interface IAiWebSearchToolConfig {
|
|
|
1510
1592
|
readonly enableImageUnderstanding?: boolean;
|
|
1511
1593
|
}
|
|
1512
1594
|
|
|
1595
|
+
/**
|
|
1596
|
+
* Anthropic-specific thinking configuration.
|
|
1597
|
+
* @public
|
|
1598
|
+
*/
|
|
1599
|
+
declare interface IAnthropicThinkingConfig {
|
|
1600
|
+
/**
|
|
1601
|
+
* Anthropic effort level. Maps 1:1 to `output_config.effort` on the wire.
|
|
1602
|
+
* - 'low' | 'medium' | 'high': all thinking-capable models
|
|
1603
|
+
* - 'max': Opus 4.6 only
|
|
1604
|
+
*/
|
|
1605
|
+
readonly effort?: 'low' | 'medium' | 'high' | 'max';
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
/**
|
|
1609
|
+
* Anthropic-specific thinking options block.
|
|
1610
|
+
* @public
|
|
1611
|
+
*/
|
|
1612
|
+
declare interface IAnthropicThinkingOptions {
|
|
1613
|
+
readonly provider: 'anthropic';
|
|
1614
|
+
readonly models?: ReadonlyArray<AnthropicThinkingModelNames>;
|
|
1615
|
+
readonly config: IAnthropicThinkingConfig;
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1513
1618
|
/**
|
|
1514
1619
|
* A single chat message in OpenAI format.
|
|
1515
1620
|
* @public
|
|
@@ -1742,6 +1847,36 @@ declare interface ICryptoProvider {
|
|
|
1742
1847
|
unwrapBytes(wrapped: IWrappedBytes, recipientPrivateKey: CryptoKey, options: IWrapBytesOptions): Promise<Result<Uint8Array>>;
|
|
1743
1848
|
}
|
|
1744
1849
|
|
|
1850
|
+
/**
|
|
1851
|
+
* Provider-specific config for DALL-E models (dall-e-2, dall-e-3).
|
|
1852
|
+
* @remarks
|
|
1853
|
+
* style is only valid for dall-e-3; the runtime validator rejects it for dall-e-2.
|
|
1854
|
+
* @public
|
|
1855
|
+
*/
|
|
1856
|
+
declare interface IDallEImageGenerationConfig {
|
|
1857
|
+
/** Image dimensions (dall-e-2: 256x256|512x512|1024x1024; dall-e-3: 1024x1024|1792x1024|1024x1792). */
|
|
1858
|
+
readonly size?: DallE2Size | DallE3Size;
|
|
1859
|
+
/** dall-e-3 only. Quality tier. */
|
|
1860
|
+
readonly quality?: DallE3Quality;
|
|
1861
|
+
/** dall-e-3 only. Visual style. */
|
|
1862
|
+
readonly style?: 'vivid' | 'natural';
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
/**
|
|
1866
|
+
* Options block scoped to DALL-E family models.
|
|
1867
|
+
* @public
|
|
1868
|
+
*/
|
|
1869
|
+
declare interface IDallEModelOptions extends INamedModelFamilyConfig {
|
|
1870
|
+
/** Discriminator: openai provider lineage. */
|
|
1871
|
+
readonly provider: 'openai';
|
|
1872
|
+
/** Family identifier. */
|
|
1873
|
+
readonly family: 'dall-e';
|
|
1874
|
+
/** Optional model names this block applies to. Omit = applies to all DALL-E models. */
|
|
1875
|
+
readonly models?: DallEModelNames[];
|
|
1876
|
+
/** Family-specific config. */
|
|
1877
|
+
readonly config: IDallEImageGenerationConfig;
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1745
1880
|
/**
|
|
1746
1881
|
* Parameters for creating a {@link DirectEncryptionProvider}.
|
|
1747
1882
|
* @public
|
|
@@ -1902,6 +2037,58 @@ declare interface IFencedStringifiedJsonOptions<T> extends IFencedStringifiedJso
|
|
|
1902
2037
|
readonly inner: Converter<T> | Validator<T>;
|
|
1903
2038
|
}
|
|
1904
2039
|
|
|
2040
|
+
/**
|
|
2041
|
+
* Provider-specific config for Gemini Flash Image.
|
|
2042
|
+
* @public
|
|
2043
|
+
*/
|
|
2044
|
+
declare interface IGeminiFlashImageGenerationConfig {
|
|
2045
|
+
/** Aspect ratio string. */
|
|
2046
|
+
readonly aspectRatio?: string;
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
/**
|
|
2050
|
+
* Options block scoped to Gemini Flash Image models.
|
|
2051
|
+
* @public
|
|
2052
|
+
*/
|
|
2053
|
+
declare interface IGeminiFlashImageModelOptions extends INamedModelFamilyConfig {
|
|
2054
|
+
readonly provider: 'google';
|
|
2055
|
+
readonly family: 'gemini-flash-image';
|
|
2056
|
+
readonly models?: GeminiFlashImageModelNames[];
|
|
2057
|
+
readonly config: IGeminiFlashImageGenerationConfig;
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
/**
|
|
2061
|
+
* Google Gemini-specific thinking configuration.
|
|
2062
|
+
* @public
|
|
2063
|
+
*/
|
|
2064
|
+
declare interface IGeminiThinkingConfig {
|
|
2065
|
+
/**
|
|
2066
|
+
* Token budget for thinking. Maps 1:1 to `thinkingBudget` on the wire.
|
|
2067
|
+
* - 0: disable thinking (Flash and Flash-Lite only; error on Pro)
|
|
2068
|
+
* - positive integer: soft token cap
|
|
2069
|
+
* - -1: dynamic
|
|
2070
|
+
* - omitted: model default
|
|
2071
|
+
*/
|
|
2072
|
+
readonly thinkingBudget?: number;
|
|
2073
|
+
/**
|
|
2074
|
+
* Whether to include thought summaries in the response.
|
|
2075
|
+
* @remarks
|
|
2076
|
+
* INERT in phase B. Adapters never send `includeThoughts: true`.
|
|
2077
|
+
* Wired up by the followup stream `ai-assist-thinking-events`.
|
|
2078
|
+
*/
|
|
2079
|
+
readonly includeThoughts?: boolean;
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
/**
|
|
2083
|
+
* Google Gemini-specific thinking options block.
|
|
2084
|
+
* @public
|
|
2085
|
+
*/
|
|
2086
|
+
declare interface IGeminiThinkingOptions {
|
|
2087
|
+
readonly provider: 'google';
|
|
2088
|
+
readonly models?: ReadonlyArray<GeminiThinkingModelNames>;
|
|
2089
|
+
readonly config: IGeminiThinkingConfig;
|
|
2090
|
+
}
|
|
2091
|
+
|
|
1905
2092
|
/**
|
|
1906
2093
|
* Parameters for {@link AiAssist.generateJsonCompletion}. Extends
|
|
1907
2094
|
* {@link AiAssist.IProviderCompletionParams} with JSON-validation knobs.
|
|
@@ -1942,6 +2129,90 @@ declare interface IGenerateJsonCompletionResult<T> {
|
|
|
1942
2129
|
readonly response: IAiCompletionResponse;
|
|
1943
2130
|
}
|
|
1944
2131
|
|
|
2132
|
+
/**
|
|
2133
|
+
* Provider-specific config for gpt-image-1.
|
|
2134
|
+
* @public
|
|
2135
|
+
*/
|
|
2136
|
+
declare interface IGptImageGenerationConfig {
|
|
2137
|
+
/** Image dimensions. */
|
|
2138
|
+
readonly size?: GptImageSize;
|
|
2139
|
+
/** Quality tier. */
|
|
2140
|
+
readonly quality?: GptImageQuality;
|
|
2141
|
+
/** Output format (replaces response_format for this model). */
|
|
2142
|
+
readonly outputFormat?: 'png' | 'jpeg' | 'webp';
|
|
2143
|
+
/** JPEG/WebP compression level 0–100. */
|
|
2144
|
+
readonly outputCompression?: number;
|
|
2145
|
+
/** Background transparency control. */
|
|
2146
|
+
readonly background?: 'transparent' | 'opaque' | 'auto';
|
|
2147
|
+
/** Content moderation strictness. */
|
|
2148
|
+
readonly moderation?: 'low' | 'auto';
|
|
2149
|
+
}
|
|
2150
|
+
|
|
2151
|
+
/**
|
|
2152
|
+
* Options block scoped to GPT Image family models.
|
|
2153
|
+
* @public
|
|
2154
|
+
*/
|
|
2155
|
+
declare interface IGptImageModelOptions extends INamedModelFamilyConfig {
|
|
2156
|
+
readonly provider: 'openai';
|
|
2157
|
+
readonly family: 'gpt-image';
|
|
2158
|
+
readonly models?: GptImageModelNames[];
|
|
2159
|
+
readonly config: IGptImageGenerationConfig;
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
/**
|
|
2163
|
+
* Provider-specific config for xAI Grok Imagine models.
|
|
2164
|
+
* @public
|
|
2165
|
+
*/
|
|
2166
|
+
declare interface IGrokImagineImageGenerationConfig {
|
|
2167
|
+
/** Aspect ratio string (xAI uses aspect ratios, not pixel dimensions). */
|
|
2168
|
+
readonly aspectRatio?: string;
|
|
2169
|
+
/** Resolution hint. */
|
|
2170
|
+
readonly resolution?: string;
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
/**
|
|
2174
|
+
* Options block scoped to xAI Grok Imagine family models.
|
|
2175
|
+
* @public
|
|
2176
|
+
*/
|
|
2177
|
+
declare interface IGrokImagineModelOptions extends INamedModelFamilyConfig {
|
|
2178
|
+
readonly provider: 'xai';
|
|
2179
|
+
readonly family: 'grok-imagine';
|
|
2180
|
+
readonly models?: GrokImagineModelNames[];
|
|
2181
|
+
readonly config: IGrokImagineImageGenerationConfig;
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
/**
|
|
2185
|
+
* Provider-specific config for Google Imagen 4 models.
|
|
2186
|
+
* @public
|
|
2187
|
+
*/
|
|
2188
|
+
declare interface IImagen4GenerationConfig {
|
|
2189
|
+
/** Aspect ratio string. */
|
|
2190
|
+
readonly aspectRatio?: '1:1' | '3:4' | '4:3' | '9:16' | '16:9';
|
|
2191
|
+
/** Output resolution. */
|
|
2192
|
+
readonly imageSize?: '1K' | '2K';
|
|
2193
|
+
/** Whether to add SynthID watermark. Must be false to use seed. */
|
|
2194
|
+
readonly addWatermark?: boolean;
|
|
2195
|
+
/** LLM-based prompt rewriting. */
|
|
2196
|
+
readonly enhancePrompt?: boolean;
|
|
2197
|
+
/** Output MIME type. */
|
|
2198
|
+
readonly outputMimeType?: 'image/jpeg' | 'image/png';
|
|
2199
|
+
/** JPEG compression quality. */
|
|
2200
|
+
readonly outputCompressionQuality?: number;
|
|
2201
|
+
/** Person generation policy. */
|
|
2202
|
+
readonly personGeneration?: 'allow_all' | 'allow_adult' | 'dont_allow';
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
/**
|
|
2206
|
+
* Options block scoped to Google Imagen 4 models.
|
|
2207
|
+
* @public
|
|
2208
|
+
*/
|
|
2209
|
+
declare interface IImagen4ModelOptions extends INamedModelFamilyConfig {
|
|
2210
|
+
readonly provider: 'google';
|
|
2211
|
+
readonly family: 'imagen-4';
|
|
2212
|
+
readonly models?: Imagen4ModelNames[];
|
|
2213
|
+
readonly config: IImagen4GenerationConfig;
|
|
2214
|
+
}
|
|
2215
|
+
|
|
1945
2216
|
/**
|
|
1946
2217
|
* Options for importing raw key material via {@link KeyStore.importSecret}.
|
|
1947
2218
|
* Extends {@link IImportSecretOptions} with a type classification.
|
|
@@ -2297,6 +2568,9 @@ declare interface IKeyStoreVaultContents {
|
|
|
2297
2568
|
readonly secrets: Record<string, IKeyStoreEntryJson>;
|
|
2298
2569
|
}
|
|
2299
2570
|
|
|
2571
|
+
/** Model names in the Imagen 4 family. @public */
|
|
2572
|
+
declare type Imagen4ModelNames = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001';
|
|
2573
|
+
|
|
2300
2574
|
/**
|
|
2301
2575
|
* Details about a missing variable in context validation.
|
|
2302
2576
|
* @public
|
|
@@ -2317,6 +2591,13 @@ declare interface IMissingVariableDetail {
|
|
|
2317
2591
|
readonly existingPath: readonly string[];
|
|
2318
2592
|
}
|
|
2319
2593
|
|
|
2594
|
+
/**
|
|
2595
|
+
* Discriminated union of all model-family option blocks.
|
|
2596
|
+
* Discriminated on `provider` + `family` fields.
|
|
2597
|
+
* @public
|
|
2598
|
+
*/
|
|
2599
|
+
declare type IModelFamilyConfig = IDallEModelOptions | IGptImageModelOptions | IGrokImagineModelOptions | IImagen4ModelOptions | IGeminiFlashImageModelOptions | IOtherModelOptions;
|
|
2600
|
+
|
|
2320
2601
|
/**
|
|
2321
2602
|
* A model specification: either a simple model string or a record mapping
|
|
2322
2603
|
* context keys to nested model specs.
|
|
@@ -2329,10 +2610,10 @@ declare interface IMissingVariableDetail {
|
|
|
2329
2610
|
* @example
|
|
2330
2611
|
* ```typescript
|
|
2331
2612
|
* // Simple — same model for all contexts:
|
|
2332
|
-
* const simple: ModelSpec = 'grok-4
|
|
2613
|
+
* const simple: ModelSpec = 'grok-4.3';
|
|
2333
2614
|
*
|
|
2334
|
-
* // Context-aware —
|
|
2335
|
-
* const split: ModelSpec = { base: 'grok-4
|
|
2615
|
+
* // Context-aware — different model for tools and thinking:
|
|
2616
|
+
* const split: ModelSpec = { base: 'grok-4.3', tools: 'grok-4.3', thinking: 'grok-4.3' };
|
|
2336
2617
|
*
|
|
2337
2618
|
* // Future nested — per-tool model selection:
|
|
2338
2619
|
* const nested: ModelSpec = { base: 'grok-fast', tools: { base: 'grok-r', image: 'grok-v' } };
|
|
@@ -2377,6 +2658,15 @@ declare interface IMustacheTemplateOptions {
|
|
|
2377
2658
|
readonly includePartials?: boolean;
|
|
2378
2659
|
}
|
|
2379
2660
|
|
|
2661
|
+
/**
|
|
2662
|
+
* Base shape shared by all named family option blocks.
|
|
2663
|
+
* Provides a typed `models` field for applicability filtering without unsafe casts.
|
|
2664
|
+
* @internal
|
|
2665
|
+
*/
|
|
2666
|
+
declare interface INamedModelFamilyConfig {
|
|
2667
|
+
readonly models?: readonly string[];
|
|
2668
|
+
}
|
|
2669
|
+
|
|
2380
2670
|
/**
|
|
2381
2671
|
* Named secret for encryption/decryption.
|
|
2382
2672
|
* @public
|
|
@@ -2392,6 +2682,67 @@ declare interface INamedSecret {
|
|
|
2392
2682
|
readonly key: Uint8Array;
|
|
2393
2683
|
}
|
|
2394
2684
|
|
|
2685
|
+
/**
|
|
2686
|
+
* OpenAI-specific thinking configuration.
|
|
2687
|
+
* @remarks
|
|
2688
|
+
* Maps to `reasoning_effort` (Chat Completions path) or `reasoning.effort`
|
|
2689
|
+
* (Responses API path) on the wire. The adapter selects the correct field.
|
|
2690
|
+
* @public
|
|
2691
|
+
*/
|
|
2692
|
+
declare interface IOpenAiThinkingConfig {
|
|
2693
|
+
/**
|
|
2694
|
+
* OpenAI reasoning effort. Maps 1:1 to the wire field.
|
|
2695
|
+
* - 'none': disables reasoning (gpt-5.x only; rejected by o-series)
|
|
2696
|
+
* - 'minimal': fastest (gpt-5.x)
|
|
2697
|
+
* - 'low' | 'medium' | 'high': standard tiers
|
|
2698
|
+
* - 'xhigh': highest (select gpt-5.x models only)
|
|
2699
|
+
*
|
|
2700
|
+
* @remarks
|
|
2701
|
+
* When effective effort is 'none', reasoning is disabled and temperature is
|
|
2702
|
+
* accepted by gpt-5.x models. This is the only case where temperature and
|
|
2703
|
+
* thinking config co-exist without a Result.fail.
|
|
2704
|
+
*/
|
|
2705
|
+
readonly effort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
2706
|
+
}
|
|
2707
|
+
|
|
2708
|
+
/**
|
|
2709
|
+
* OpenAI-specific thinking options block.
|
|
2710
|
+
* @public
|
|
2711
|
+
*/
|
|
2712
|
+
declare interface IOpenAiThinkingOptions {
|
|
2713
|
+
readonly provider: 'openai';
|
|
2714
|
+
readonly models?: ReadonlyArray<OpenAiThinkingModelNames>;
|
|
2715
|
+
readonly config: IOpenAiThinkingConfig;
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
/**
|
|
2719
|
+
* Escape-hatch options block for models not covered by a named family.
|
|
2720
|
+
* @remarks
|
|
2721
|
+
* `models` is required — there is no implicit "all" for unknown model families.
|
|
2722
|
+
* `config` is `JsonObject` — passed verbatim to the wire request with no validation.
|
|
2723
|
+
* This is the "trust me, I know what I'm doing" path for callers who need to send
|
|
2724
|
+
* wire params our typed configs don't yet expose.
|
|
2725
|
+
* @public
|
|
2726
|
+
*/
|
|
2727
|
+
declare interface IOtherModelOptions {
|
|
2728
|
+
readonly provider: 'other';
|
|
2729
|
+
readonly models: string[];
|
|
2730
|
+
readonly config: JsonObject;
|
|
2731
|
+
}
|
|
2732
|
+
|
|
2733
|
+
/**
|
|
2734
|
+
* Escape-hatch options block for providers not covered by typed configs.
|
|
2735
|
+
* @remarks
|
|
2736
|
+
* `models` is required — no implicit "all" for unknown providers.
|
|
2737
|
+
* `config` fields are merged verbatim into the wire request.
|
|
2738
|
+
* @public
|
|
2739
|
+
*/
|
|
2740
|
+
declare interface IOtherThinkingOptions {
|
|
2741
|
+
readonly provider: 'other';
|
|
2742
|
+
readonly models: ReadonlyArray<string>;
|
|
2743
|
+
readonly config: JsonObject;
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2395
2746
|
/**
|
|
2396
2747
|
* Pluggable backend that persists raw asymmetric private keys outside of the
|
|
2397
2748
|
* encrypted keystore vault. Concrete implementations live in platform-specific
|
|
@@ -2452,10 +2803,7 @@ declare interface IProviderCompletionParams {
|
|
|
2452
2803
|
readonly apiKey: string;
|
|
2453
2804
|
/** The structured prompt to send */
|
|
2454
2805
|
readonly prompt: AiPrompt;
|
|
2455
|
-
/**
|
|
2456
|
-
* Additional messages to append after system+user (e.g. for correction retries).
|
|
2457
|
-
* These are appended in order after the initial system and user messages.
|
|
2458
|
-
*/
|
|
2806
|
+
/** Additional messages to append after system+user in order (e.g. for correction retries). */
|
|
2459
2807
|
readonly additionalMessages?: ReadonlyArray<IChatMessage>;
|
|
2460
2808
|
/** Sampling temperature (default: 0.7) */
|
|
2461
2809
|
readonly temperature?: number;
|
|
@@ -2468,20 +2816,17 @@ declare interface IProviderCompletionParams {
|
|
|
2468
2816
|
/** Optional abort signal for cancelling the in-flight request. */
|
|
2469
2817
|
readonly signal?: AbortSignal;
|
|
2470
2818
|
/**
|
|
2471
|
-
* Optional override of the descriptor's default base URL
|
|
2472
|
-
*
|
|
2473
|
-
*
|
|
2474
|
-
*
|
|
2475
|
-
*
|
|
2476
|
-
* Must be a well-formed `http`/`https` URL string. Used to dispatch the same
|
|
2477
|
-
* provider descriptor against a self-hosted or local endpoint (e.g.
|
|
2478
|
-
* `http://localhost:11434/v1` for Ollama, or LAN-hosted OpenAI-compatible
|
|
2479
|
-
* servers).
|
|
2480
|
-
*
|
|
2481
|
-
* Setting `endpoint` does not change the auth shape: providers with
|
|
2482
|
-
* `needsSecret === true` still require an API key.
|
|
2819
|
+
* Optional override of the descriptor's default base URL (scheme + host +
|
|
2820
|
+
* optional port + path prefix). The per-route suffix (e.g. `/chat/completions`)
|
|
2821
|
+
* is appended unchanged. Must be a well-formed `http`/`https` URL. Auth shape
|
|
2822
|
+
* is unchanged: `needsSecret` providers still require an API key.
|
|
2483
2823
|
*/
|
|
2484
2824
|
readonly endpoint?: string;
|
|
2825
|
+
/**
|
|
2826
|
+
* Optional thinking/reasoning config. Anthropic, OpenAI, and xAI reject `temperature` when
|
|
2827
|
+
* the effective merged effort is non-`'none'`; Gemini always accepts both.
|
|
2828
|
+
*/
|
|
2829
|
+
readonly thinking?: IThinkingConfig;
|
|
2485
2830
|
}
|
|
2486
2831
|
|
|
2487
2832
|
/**
|
|
@@ -2523,6 +2868,10 @@ declare interface IProviderCompletionStreamParams {
|
|
|
2523
2868
|
* dispatcher; auth shape is unaffected.
|
|
2524
2869
|
*/
|
|
2525
2870
|
readonly endpoint?: string;
|
|
2871
|
+
/**
|
|
2872
|
+
* Optional thinking/reasoning mode configuration.
|
|
2873
|
+
*/
|
|
2874
|
+
readonly thinking?: IThinkingConfig;
|
|
2526
2875
|
}
|
|
2527
2876
|
|
|
2528
2877
|
/**
|
|
@@ -2542,13 +2891,7 @@ declare interface IProviderImageGenerationParams {
|
|
|
2542
2891
|
readonly logger?: Logging.ILogger;
|
|
2543
2892
|
/** Optional abort signal for cancelling the in-flight request. */
|
|
2544
2893
|
readonly signal?: AbortSignal;
|
|
2545
|
-
/**
|
|
2546
|
-
* Optional override of the descriptor's default base URL. Same semantics as
|
|
2547
|
-
* the non-streaming completion path's endpoint: a well-formed `http`/`https`
|
|
2548
|
-
* URL substituted for `descriptor.baseUrl` when composing the request, with
|
|
2549
|
-
* the per-route suffix (e.g. `/images/generations`, `:predict`) appended
|
|
2550
|
-
* unchanged.
|
|
2551
|
-
*/
|
|
2894
|
+
/** Optional override of the descriptor's base URL; per-route suffix is appended unchanged. */
|
|
2552
2895
|
readonly endpoint?: string;
|
|
2553
2896
|
}
|
|
2554
2897
|
|
|
@@ -2569,11 +2912,7 @@ declare interface IProviderListModelsParams {
|
|
|
2569
2912
|
readonly logger?: Logging.ILogger;
|
|
2570
2913
|
/** Optional abort signal for cancelling the in-flight request. */
|
|
2571
2914
|
readonly signal?: AbortSignal;
|
|
2572
|
-
/**
|
|
2573
|
-
* Optional override of the descriptor's default base URL — a well-formed
|
|
2574
|
-
* `http`/`https` URL substituted for `descriptor.baseUrl`, with the
|
|
2575
|
-
* per-format `/models` route appended unchanged.
|
|
2576
|
-
*/
|
|
2915
|
+
/** Optional override of the descriptor's base URL; per-format `/models` route is appended unchanged. */
|
|
2577
2916
|
readonly endpoint?: string;
|
|
2578
2917
|
}
|
|
2579
2918
|
|
|
@@ -2605,6 +2944,38 @@ declare interface IRequiredMustacheTemplateOptions {
|
|
|
2605
2944
|
readonly includePartials: boolean;
|
|
2606
2945
|
}
|
|
2607
2946
|
|
|
2947
|
+
/**
|
|
2948
|
+
* The resolved, merged wire parameters for an image generation request.
|
|
2949
|
+
* Built from the layered options and ready for provider-specific encoding.
|
|
2950
|
+
* @public
|
|
2951
|
+
*/
|
|
2952
|
+
declare interface IResolvedImageOptions {
|
|
2953
|
+
/** Number of images to generate. */
|
|
2954
|
+
readonly n: number;
|
|
2955
|
+
/** Image size (OpenAI-style pixel strings). */
|
|
2956
|
+
readonly size?: string;
|
|
2957
|
+
/** Quality tier. */
|
|
2958
|
+
readonly quality?: string;
|
|
2959
|
+
/** Seed for reproducibility. */
|
|
2960
|
+
readonly seed?: number;
|
|
2961
|
+
readonly style?: string;
|
|
2962
|
+
readonly outputFormat?: string;
|
|
2963
|
+
readonly outputCompression?: number;
|
|
2964
|
+
readonly background?: string;
|
|
2965
|
+
readonly moderation?: string;
|
|
2966
|
+
readonly aspectRatio?: string;
|
|
2967
|
+
readonly resolution?: string;
|
|
2968
|
+
readonly imagenAspectRatio?: string;
|
|
2969
|
+
readonly imageSize?: string;
|
|
2970
|
+
readonly addWatermark?: boolean;
|
|
2971
|
+
readonly enhancePrompt?: boolean;
|
|
2972
|
+
readonly imagenOutputMimeType?: string;
|
|
2973
|
+
readonly imagenOutputCompressionQuality?: number;
|
|
2974
|
+
readonly personGeneration?: string;
|
|
2975
|
+
readonly geminiAspectRatio?: string;
|
|
2976
|
+
readonly otherParams?: JsonObject;
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2608
2979
|
/**
|
|
2609
2980
|
* Checks if a JSON object appears to be an encrypted file.
|
|
2610
2981
|
* Uses the format field as a discriminator.
|
|
@@ -2637,6 +3008,39 @@ declare const isoDate: Converter<Date, unknown>;
|
|
|
2637
3008
|
*/
|
|
2638
3009
|
declare const isoDateTime: Converter<DateTime, unknown>;
|
|
2639
3010
|
|
|
3011
|
+
/**
|
|
3012
|
+
* Thinking/reasoning mode configuration for a completion request.
|
|
3013
|
+
*
|
|
3014
|
+
* @remarks
|
|
3015
|
+
* The generic `effort` field covers the common-subset cross-provider vocabulary.
|
|
3016
|
+
* For provider-specific precision (Anthropic 'max', OpenAI 'xhigh', Gemini token
|
|
3017
|
+
* budgets, xAI effort-level tuning), use the `providers` array.
|
|
3018
|
+
*
|
|
3019
|
+
* Absence (or undefined) means "no thinking mode" — existing callers are unaffected.
|
|
3020
|
+
*
|
|
3021
|
+
* @public
|
|
3022
|
+
*/
|
|
3023
|
+
declare interface IThinkingConfig {
|
|
3024
|
+
/**
|
|
3025
|
+
* Cross-provider effort level. Common-subset mapping:
|
|
3026
|
+
* - 'low': Anthropic effort:low | OpenAI effort:low | Gemini thinkingBudget:1024 | xAI reasoning_effort:low
|
|
3027
|
+
* - 'medium': effort:medium | effort:medium | thinkingBudget:4096 | reasoning_effort:medium
|
|
3028
|
+
* - 'high': effort:high | effort:high | thinkingBudget:8192 | reasoning_effort:high
|
|
3029
|
+
*/
|
|
3030
|
+
readonly effort?: 'low' | 'medium' | 'high';
|
|
3031
|
+
/**
|
|
3032
|
+
* Optional per-provider precision blocks. Blocks for providers that don't
|
|
3033
|
+
* match the resolved model's provider are silently skipped.
|
|
3034
|
+
*/
|
|
3035
|
+
readonly providers?: ReadonlyArray<IThinkingProviderConfig>;
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
/**
|
|
3039
|
+
* Discriminated union of per-provider thinking config blocks.
|
|
3040
|
+
* @public
|
|
3041
|
+
*/
|
|
3042
|
+
declare type IThinkingProviderConfig = IAnthropicThinkingOptions | IOpenAiThinkingOptions | IGeminiThinkingOptions | IXAiThinkingOptions | IOtherThinkingOptions;
|
|
3043
|
+
|
|
2640
3044
|
/**
|
|
2641
3045
|
* Represents a variable reference extracted from a Mustache template.
|
|
2642
3046
|
* @public
|
|
@@ -2714,6 +3118,29 @@ declare interface IWrappedBytes {
|
|
|
2714
3118
|
readonly ciphertext: string;
|
|
2715
3119
|
}
|
|
2716
3120
|
|
|
3121
|
+
/**
|
|
3122
|
+
* xAI-specific thinking configuration.
|
|
3123
|
+
* @public
|
|
3124
|
+
*/
|
|
3125
|
+
declare interface IXAiThinkingConfig {
|
|
3126
|
+
/**
|
|
3127
|
+
* xAI reasoning effort. Maps 1:1 to `reasoning_effort` on the wire.
|
|
3128
|
+
* For grok-4, the adapter omits this field (grok-4 always reasons and
|
|
3129
|
+
* rejects the parameter).
|
|
3130
|
+
*/
|
|
3131
|
+
readonly effort?: 'none' | 'low' | 'medium' | 'high';
|
|
3132
|
+
}
|
|
3133
|
+
|
|
3134
|
+
/**
|
|
3135
|
+
* xAI-specific thinking options block.
|
|
3136
|
+
* @public
|
|
3137
|
+
*/
|
|
3138
|
+
declare interface IXAiThinkingOptions {
|
|
3139
|
+
readonly provider: 'xai';
|
|
3140
|
+
readonly models?: ReadonlyArray<XAiThinkingModelNames>;
|
|
3141
|
+
readonly config: IXAiThinkingConfig;
|
|
3142
|
+
}
|
|
3143
|
+
|
|
2717
3144
|
/**
|
|
2718
3145
|
* Options for YAML serialization, mirroring commonly-used `js-yaml` `DumpOptions`.
|
|
2719
3146
|
* @public
|
|
@@ -3467,7 +3894,7 @@ declare const modelSpec: Converter<ModelSpec>;
|
|
|
3467
3894
|
* Known context keys for model specification maps.
|
|
3468
3895
|
* @public
|
|
3469
3896
|
*/
|
|
3470
|
-
declare type ModelSpecKey = 'base' | 'tools' | 'image';
|
|
3897
|
+
declare type ModelSpecKey = 'base' | 'tools' | 'image' | 'thinking';
|
|
3471
3898
|
|
|
3472
3899
|
/**
|
|
3473
3900
|
* Converter for {@link ModelSpecKey}.
|
|
@@ -3729,6 +4156,12 @@ declare class NodeCryptoProvider implements ICryptoProvider {
|
|
|
3729
4156
|
*/
|
|
3730
4157
|
declare const nodeCryptoProvider: NodeCryptoProvider;
|
|
3731
4158
|
|
|
4159
|
+
/**
|
|
4160
|
+
* Model IDs for OpenAI thinking-capable models.
|
|
4161
|
+
* @public
|
|
4162
|
+
*/
|
|
4163
|
+
declare type OpenAiThinkingModelNames = 'o3' | 'o4-mini' | 'o3-deep-research' | 'o4-mini-deep-research' | 'gpt-5' | 'gpt-5.1' | 'gpt-5.2' | 'gpt-5.5' | 'gpt-5-pro';
|
|
4164
|
+
|
|
3732
4165
|
/**
|
|
3733
4166
|
* Parses CSV data from a string.
|
|
3734
4167
|
* @param body - The CSV string to parse.
|
|
@@ -3966,6 +4399,28 @@ declare function resolveEffectiveTools(descriptor: IAiProviderDescriptor, settin
|
|
|
3966
4399
|
*/
|
|
3967
4400
|
declare function resolveImageCapability(descriptor: IAiProviderDescriptor, modelId: string): IAiImageModelCapability | undefined;
|
|
3968
4401
|
|
|
4402
|
+
/**
|
|
4403
|
+
* Resolves the merged image options for a given model and capability.
|
|
4404
|
+
*
|
|
4405
|
+
* @remarks
|
|
4406
|
+
* **Merge precedence (later wins):**
|
|
4407
|
+
* 1. Generic top-level options (size, count, quality, seed)
|
|
4408
|
+
* 2. Family-generic blocks (models field omitted, provider matches)
|
|
4409
|
+
* 3. Model-specific blocks (models array includes the resolved model name)
|
|
4410
|
+
* 4. Other blocks (provider: 'other', models array includes model name)
|
|
4411
|
+
*
|
|
4412
|
+
* Provider-mismatch blocks are silently skipped.
|
|
4413
|
+
*
|
|
4414
|
+
* Within each tier, declaration order — later declaration wins.
|
|
4415
|
+
*
|
|
4416
|
+
* @param modelId - The resolved model string
|
|
4417
|
+
* @param capability - The resolved IAiImageModelCapability for this model
|
|
4418
|
+
* @param options - Caller-supplied options
|
|
4419
|
+
* @returns The merged wire parameters
|
|
4420
|
+
* @public
|
|
4421
|
+
*/
|
|
4422
|
+
declare function resolveImageOptions(modelId: string, capability: IAiImageModelCapability, options: IAiImageGenerationOptions | undefined): IResolvedImageOptions;
|
|
4423
|
+
|
|
3969
4424
|
/**
|
|
3970
4425
|
* Resolves a {@link ModelSpec} to a concrete model string given an optional context key.
|
|
3971
4426
|
*
|
|
@@ -4055,6 +4510,27 @@ declare function tryDecryptFile<TPayload extends JsonValue = JsonValue, TMetadat
|
|
|
4055
4510
|
*/
|
|
4056
4511
|
declare const uint8ArrayFromBase64: Converter<Uint8Array>;
|
|
4057
4512
|
|
|
4513
|
+
/**
|
|
4514
|
+
* Validates the resolved options against per-model registry constraints.
|
|
4515
|
+
*
|
|
4516
|
+
* @remarks
|
|
4517
|
+
* Fails fast on the first violation. Error format:
|
|
4518
|
+
* `model "${model}": ${field} "${value}" is not accepted; accepted values: ${JSON.stringify(accepted)}`
|
|
4519
|
+
*
|
|
4520
|
+
* @param modelId - The resolved model string
|
|
4521
|
+
* @param capability - The resolved capability entry from the registry
|
|
4522
|
+
* @param resolved - The merged options from resolveImageOptions
|
|
4523
|
+
* @returns The same resolved options on success, or a failure with a contextual message
|
|
4524
|
+
* @public
|
|
4525
|
+
*/
|
|
4526
|
+
declare function validateResolvedOptions(modelId: string, capability: IAiImageModelCapability, resolved: IResolvedImageOptions): Result<IResolvedImageOptions>;
|
|
4527
|
+
|
|
4528
|
+
/**
|
|
4529
|
+
* Model IDs for xAI thinking-capable models.
|
|
4530
|
+
* @public
|
|
4531
|
+
*/
|
|
4532
|
+
declare type XAiThinkingModelNames = 'grok-3-mini' | 'grok-4.3' | 'grok-4';
|
|
4533
|
+
|
|
4058
4534
|
declare namespace Yaml {
|
|
4059
4535
|
export {
|
|
4060
4536
|
yamlConverter,
|