@fgv/ts-extras 5.1.0-25 → 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/index.browser.js +2 -0
- package/dist/packlets/crypto-utils/index.browser.js.map +1 -1
- package/dist/packlets/crypto-utils/index.js +2 -0
- package/dist/packlets/crypto-utils/index.js.map +1 -1
- package/dist/packlets/crypto-utils/keyPairAlgorithmParams.js +8 -0
- package/dist/packlets/crypto-utils/keyPairAlgorithmParams.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/packlets/crypto-utils/model.js +2 -1
- package/dist/packlets/crypto-utils/model.js.map +1 -1
- package/dist/packlets/crypto-utils/nodeCryptoProvider.js +25 -0
- package/dist/packlets/crypto-utils/nodeCryptoProvider.js.map +1 -1
- package/dist/packlets/crypto-utils/spkiHelpers.js +130 -0
- package/dist/packlets/crypto-utils/spkiHelpers.js.map +1 -0
- package/dist/ts-extras.d.ts +695 -126
- 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/index.browser.d.ts +1 -0
- package/lib/packlets/crypto-utils/index.browser.d.ts.map +1 -1
- package/lib/packlets/crypto-utils/index.browser.js +7 -1
- package/lib/packlets/crypto-utils/index.browser.js.map +1 -1
- package/lib/packlets/crypto-utils/index.d.ts +1 -0
- package/lib/packlets/crypto-utils/index.d.ts.map +1 -1
- package/lib/packlets/crypto-utils/index.js +7 -1
- package/lib/packlets/crypto-utils/index.js.map +1 -1
- package/lib/packlets/crypto-utils/keyPairAlgorithmParams.d.ts +10 -6
- package/lib/packlets/crypto-utils/keyPairAlgorithmParams.d.ts.map +1 -1
- package/lib/packlets/crypto-utils/keyPairAlgorithmParams.js +8 -0
- package/lib/packlets/crypto-utils/keyPairAlgorithmParams.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/lib/packlets/crypto-utils/model.d.ts +19 -1
- package/lib/packlets/crypto-utils/model.d.ts.map +1 -1
- package/lib/packlets/crypto-utils/model.js +2 -1
- package/lib/packlets/crypto-utils/model.js.map +1 -1
- package/lib/packlets/crypto-utils/nodeCryptoProvider.d.ts +13 -0
- package/lib/packlets/crypto-utils/nodeCryptoProvider.d.ts.map +1 -1
- package/lib/packlets/crypto-utils/nodeCryptoProvider.js +25 -0
- package/lib/packlets/crypto-utils/nodeCryptoProvider.js.map +1 -1
- package/lib/packlets/crypto-utils/spkiHelpers.d.ts +53 -0
- package/lib/packlets/crypto-utils/spkiHelpers.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/spkiHelpers.js +136 -0
- package/lib/packlets/crypto-utils/spkiHelpers.js.map +1 -0
- 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>>>;
|
|
@@ -507,6 +530,10 @@ declare namespace CryptoUtils {
|
|
|
507
530
|
ICreateEncryptedFileParams,
|
|
508
531
|
toBase64,
|
|
509
532
|
tryDecryptFile,
|
|
533
|
+
exportPublicKeyAsMultibaseSpki,
|
|
534
|
+
importPublicKeyFromMultibaseSpki,
|
|
535
|
+
multibaseBase64UrlDecode,
|
|
536
|
+
multibaseBase64UrlEncode,
|
|
510
537
|
isEncryptedFile,
|
|
511
538
|
EncryptionAlgorithm,
|
|
512
539
|
EncryptedFileFormat,
|
|
@@ -546,6 +573,18 @@ declare interface CsvOptions {
|
|
|
546
573
|
delimiter?: string;
|
|
547
574
|
}
|
|
548
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
|
+
|
|
549
588
|
/**
|
|
550
589
|
* Decrypts an {@link CryptoUtils.IEncryptedFile | encrypted file} and returns the JSON content.
|
|
551
590
|
* @typeParam TPayload - Expected type of decrypted content
|
|
@@ -713,6 +752,20 @@ declare namespace Experimental {
|
|
|
713
752
|
}
|
|
714
753
|
export { Experimental }
|
|
715
754
|
|
|
755
|
+
/**
|
|
756
|
+
* Exports a public `CryptoKey` as a multibase base64url-encoded SPKI blob.
|
|
757
|
+
*
|
|
758
|
+
* The SPKI (SubjectPublicKeyInfo) format is the standard DER-encoded structure
|
|
759
|
+
* for public keys defined in RFC 5280, RFC 5480, and RFC 8410. It is
|
|
760
|
+
* algorithm-agnostic and suitable for storage and transmission.
|
|
761
|
+
*
|
|
762
|
+
* @param key - The `CryptoKey` to export. Must have `key.type === 'public'`.
|
|
763
|
+
* @param provider - The {@link CryptoUtils.ICryptoProvider} to use for the export operation.
|
|
764
|
+
* @returns `Success` with the multibase SPKI string, or `Failure` with error context.
|
|
765
|
+
* @public
|
|
766
|
+
*/
|
|
767
|
+
declare function exportPublicKeyAsMultibaseSpki(key: CryptoKey, provider: ICryptoProvider): Promise<Result<string>>;
|
|
768
|
+
|
|
716
769
|
/**
|
|
717
770
|
* An experimental array template which extend built-in `Array` to include a handful
|
|
718
771
|
* of predicates which return `Result<T>`.
|
|
@@ -918,6 +971,15 @@ declare const GCM_AUTH_TAG_SIZE: number;
|
|
|
918
971
|
*/
|
|
919
972
|
declare const GCM_IV_SIZE: number;
|
|
920
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
|
+
|
|
921
983
|
/**
|
|
922
984
|
* Calls {@link AiAssist.callProviderCompletion}, then runs the response text
|
|
923
985
|
* through a tolerant JSON converter (default:
|
|
@@ -954,6 +1016,18 @@ declare function getProviderDescriptor(id: string): Result<IAiProviderDescriptor
|
|
|
954
1016
|
*/
|
|
955
1017
|
declare function getProviderDescriptors(): ReadonlyArray<IAiProviderDescriptor>;
|
|
956
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
|
+
|
|
957
1031
|
declare namespace Hash {
|
|
958
1032
|
export {
|
|
959
1033
|
Md5Normalizer
|
|
@@ -1187,39 +1261,46 @@ declare interface IAiImageData {
|
|
|
1187
1261
|
* Options for image generation requests.
|
|
1188
1262
|
*
|
|
1189
1263
|
* @remarks
|
|
1190
|
-
*
|
|
1191
|
-
*
|
|
1192
|
-
*
|
|
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.
|
|
1193
1279
|
*
|
|
1194
1280
|
* @public
|
|
1195
1281
|
*/
|
|
1196
1282
|
declare interface IAiImageGenerationOptions {
|
|
1197
1283
|
/**
|
|
1198
|
-
* Image dimensions
|
|
1199
|
-
*
|
|
1200
|
-
* {@link IAiImageGenerationOptions.imagen} `aspectRatio` instead.
|
|
1201
|
-
*
|
|
1202
|
-
* Note: each model has its own accepted set; `dall-e-3` only accepts the
|
|
1203
|
-
* 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.
|
|
1204
1286
|
*/
|
|
1205
|
-
readonly size?:
|
|
1287
|
+
readonly size?: AiImageSize;
|
|
1288
|
+
/** Number of images. Default 1. Some models enforce a maximum. */
|
|
1289
|
+
readonly count?: number;
|
|
1206
1290
|
/**
|
|
1207
|
-
*
|
|
1208
|
-
*
|
|
1209
|
-
*
|
|
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.
|
|
1210
1295
|
*/
|
|
1211
|
-
readonly
|
|
1212
|
-
/**
|
|
1213
|
-
readonly quality?: 'standard' | 'high';
|
|
1214
|
-
/** Random seed for reproducibility, where supported. */
|
|
1296
|
+
readonly quality?: AiImageQuality;
|
|
1297
|
+
/** Reproducibility seed, where supported. */
|
|
1215
1298
|
readonly seed?: number;
|
|
1216
1299
|
/**
|
|
1217
|
-
*
|
|
1300
|
+
* Optional precision via model-family-scoped blocks. The resolver picks
|
|
1301
|
+
* applicable blocks dynamically based on the resolved model.
|
|
1218
1302
|
*/
|
|
1219
|
-
readonly
|
|
1220
|
-
readonly negativePrompt?: string;
|
|
1221
|
-
readonly aspectRatio?: '1:1' | '3:4' | '4:3' | '9:16' | '16:9';
|
|
1222
|
-
};
|
|
1303
|
+
readonly models?: ReadonlyArray<IModelFamilyConfig>;
|
|
1223
1304
|
}
|
|
1224
1305
|
|
|
1225
1306
|
/**
|
|
@@ -1272,13 +1353,25 @@ declare interface IAiImageModelCapability {
|
|
|
1272
1353
|
* Whether matching models accept reference images via
|
|
1273
1354
|
* {@link AiAssist.IAiImageGenerationParams.referenceImages}. When false or
|
|
1274
1355
|
* undefined, calls that include reference images are rejected up front.
|
|
1275
|
-
*
|
|
1276
|
-
* @remarks
|
|
1277
|
-
* Per-model constraints beyond ref support (e.g. dall-e-3 ignores edits)
|
|
1278
|
-
* are not validated here and surface as provider 400s, consistent with the
|
|
1279
|
-
* existing image-generation policy.
|
|
1280
1356
|
*/
|
|
1281
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;
|
|
1282
1375
|
}
|
|
1283
1376
|
|
|
1284
1377
|
/**
|
|
@@ -1368,6 +1461,13 @@ declare interface IAiProviderDescriptor {
|
|
|
1368
1461
|
* `prompt.attachments` are rejected up front.
|
|
1369
1462
|
*/
|
|
1370
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;
|
|
1371
1471
|
/**
|
|
1372
1472
|
* Image-generation capabilities, scoped to model id prefixes. Empty or
|
|
1373
1473
|
* undefined means the provider does not support image generation.
|
|
@@ -1492,6 +1592,29 @@ declare interface IAiWebSearchToolConfig {
|
|
|
1492
1592
|
readonly enableImageUnderstanding?: boolean;
|
|
1493
1593
|
}
|
|
1494
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
|
+
|
|
1495
1618
|
/**
|
|
1496
1619
|
* A single chat message in OpenAI format.
|
|
1497
1620
|
* @public
|
|
@@ -1667,6 +1790,20 @@ declare interface ICryptoProvider {
|
|
|
1667
1790
|
* @returns Success with the imported public `CryptoKey`, or Failure with error context.
|
|
1668
1791
|
*/
|
|
1669
1792
|
importPublicKeyJwk(jwk: JsonWebKey, algorithm: KeyPairAlgorithm): Promise<Result<CryptoKey>>;
|
|
1793
|
+
/**
|
|
1794
|
+
* Exports a public `CryptoKey` as a DER-encoded SPKI (SubjectPublicKeyInfo) blob.
|
|
1795
|
+
* SPKI is the standard algorithm-agnostic format for public key storage and transport.
|
|
1796
|
+
* @param publicKey - The `CryptoKey` to export. Must have `key.type === 'public'`.
|
|
1797
|
+
* @returns `Success` with the raw SPKI bytes, or `Failure` with error context.
|
|
1798
|
+
*/
|
|
1799
|
+
exportPublicKeySpki(publicKey: CryptoKey): Promise<Result<Uint8Array>>;
|
|
1800
|
+
/**
|
|
1801
|
+
* Imports a public key from a DER-encoded SPKI blob.
|
|
1802
|
+
* @param spkiBytes - The raw SPKI bytes produced by {@link CryptoUtils.ICryptoProvider.exportPublicKeySpki | exportPublicKeySpki}.
|
|
1803
|
+
* @param algorithm - The {@link CryptoUtils.KeyPairAlgorithm | algorithm} the key was generated for.
|
|
1804
|
+
* @returns `Success` with the imported public `CryptoKey`, or `Failure` with error context.
|
|
1805
|
+
*/
|
|
1806
|
+
importPublicKeySpki(spkiBytes: Uint8Array, algorithm: KeyPairAlgorithm): Promise<Result<CryptoKey>>;
|
|
1670
1807
|
/**
|
|
1671
1808
|
* Wraps `plaintext` for delivery to the holder of the private key paired
|
|
1672
1809
|
* with `recipientPublicKey`. Uses ECIES with ECDH P-256, HKDF-SHA256, and
|
|
@@ -1710,6 +1847,36 @@ declare interface ICryptoProvider {
|
|
|
1710
1847
|
unwrapBytes(wrapped: IWrappedBytes, recipientPrivateKey: CryptoKey, options: IWrapBytesOptions): Promise<Result<Uint8Array>>;
|
|
1711
1848
|
}
|
|
1712
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
|
+
|
|
1713
1880
|
/**
|
|
1714
1881
|
* Parameters for creating a {@link DirectEncryptionProvider}.
|
|
1715
1882
|
* @public
|
|
@@ -1870,6 +2037,58 @@ declare interface IFencedStringifiedJsonOptions<T> extends IFencedStringifiedJso
|
|
|
1870
2037
|
readonly inner: Converter<T> | Validator<T>;
|
|
1871
2038
|
}
|
|
1872
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
|
+
|
|
1873
2092
|
/**
|
|
1874
2093
|
* Parameters for {@link AiAssist.generateJsonCompletion}. Extends
|
|
1875
2094
|
* {@link AiAssist.IProviderCompletionParams} with JSON-validation knobs.
|
|
@@ -1910,6 +2129,90 @@ declare interface IGenerateJsonCompletionResult<T> {
|
|
|
1910
2129
|
readonly response: IAiCompletionResponse;
|
|
1911
2130
|
}
|
|
1912
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
|
+
|
|
1913
2216
|
/**
|
|
1914
2217
|
* Options for importing raw key material via {@link KeyStore.importSecret}.
|
|
1915
2218
|
* Extends {@link IImportSecretOptions} with a type classification.
|
|
@@ -1966,22 +2269,26 @@ declare interface IKeyPairAlgorithmParams {
|
|
|
1966
2269
|
* Algorithm parameters for `crypto.subtle.generateKey`. Always an asymmetric
|
|
1967
2270
|
* variant — these algorithms produce a `CryptoKeyPair`, not a single key.
|
|
1968
2271
|
* The literal `{ name: 'Ed25519' }` member covers WebCrypto's Secure-Curves
|
|
1969
|
-
* Ed25519 algorithm
|
|
1970
|
-
*
|
|
1971
|
-
* supports.
|
|
2272
|
+
* Ed25519 algorithm; `{ name: 'X25519' }` covers the X25519 key-agreement
|
|
2273
|
+
* algorithm. Both take only a `name`; using literals rather than the base
|
|
2274
|
+
* `Algorithm` keeps the union closed to the algorithms this table supports.
|
|
1972
2275
|
*/
|
|
1973
2276
|
readonly generateKey: RsaHashedKeyGenParams | EcKeyGenParams | {
|
|
1974
2277
|
readonly name: 'Ed25519';
|
|
2278
|
+
} | {
|
|
2279
|
+
readonly name: 'X25519';
|
|
1975
2280
|
};
|
|
1976
2281
|
/**
|
|
1977
2282
|
* Algorithm parameters for `crypto.subtle.importKey('jwk', ...)` when
|
|
1978
2283
|
* importing the public half of a keypair. The literal `{ name: 'Ed25519' }`
|
|
1979
|
-
* member covers Ed25519 imports
|
|
1980
|
-
*
|
|
1981
|
-
* this table supports.
|
|
2284
|
+
* member covers Ed25519 imports; `{ name: 'X25519' }` covers X25519 imports.
|
|
2285
|
+
* Both take only a `name`; using literals rather than the base `Algorithm`
|
|
2286
|
+
* keeps the union closed to the algorithms this table supports.
|
|
1982
2287
|
*/
|
|
1983
2288
|
readonly importPublicKey: RsaHashedImportParams | EcKeyImportParams | {
|
|
1984
2289
|
readonly name: 'Ed25519';
|
|
2290
|
+
} | {
|
|
2291
|
+
readonly name: 'X25519';
|
|
1985
2292
|
};
|
|
1986
2293
|
/**
|
|
1987
2294
|
* Default key usages for the generated `CryptoKeyPair`. Both halves receive
|
|
@@ -2261,6 +2568,9 @@ declare interface IKeyStoreVaultContents {
|
|
|
2261
2568
|
readonly secrets: Record<string, IKeyStoreEntryJson>;
|
|
2262
2569
|
}
|
|
2263
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
|
+
|
|
2264
2574
|
/**
|
|
2265
2575
|
* Details about a missing variable in context validation.
|
|
2266
2576
|
* @public
|
|
@@ -2281,6 +2591,13 @@ declare interface IMissingVariableDetail {
|
|
|
2281
2591
|
readonly existingPath: readonly string[];
|
|
2282
2592
|
}
|
|
2283
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
|
+
|
|
2284
2601
|
/**
|
|
2285
2602
|
* A model specification: either a simple model string or a record mapping
|
|
2286
2603
|
* context keys to nested model specs.
|
|
@@ -2293,10 +2610,10 @@ declare interface IMissingVariableDetail {
|
|
|
2293
2610
|
* @example
|
|
2294
2611
|
* ```typescript
|
|
2295
2612
|
* // Simple — same model for all contexts:
|
|
2296
|
-
* const simple: ModelSpec = 'grok-4
|
|
2613
|
+
* const simple: ModelSpec = 'grok-4.3';
|
|
2297
2614
|
*
|
|
2298
|
-
* // Context-aware —
|
|
2299
|
-
* 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' };
|
|
2300
2617
|
*
|
|
2301
2618
|
* // Future nested — per-tool model selection:
|
|
2302
2619
|
* const nested: ModelSpec = { base: 'grok-fast', tools: { base: 'grok-r', image: 'grok-v' } };
|
|
@@ -2307,6 +2624,21 @@ declare interface IModelSpecMap {
|
|
|
2307
2624
|
readonly [key: string]: ModelSpec;
|
|
2308
2625
|
}
|
|
2309
2626
|
|
|
2627
|
+
/**
|
|
2628
|
+
* Imports a public key from a multibase base64url-encoded SPKI blob.
|
|
2629
|
+
*
|
|
2630
|
+
* Decodes the multibase prefix, decodes the base64url body, then uses
|
|
2631
|
+
* the provider to import the key with the algorithm parameters from
|
|
2632
|
+
* {@link CryptoUtils.keyPairAlgorithmParams}.
|
|
2633
|
+
*
|
|
2634
|
+
* @param encoded - A multibase SPKI string produced by {@link CryptoUtils.exportPublicKeyAsMultibaseSpki}.
|
|
2635
|
+
* @param algorithm - The {@link CryptoUtils.KeyPairAlgorithm} the key was generated for.
|
|
2636
|
+
* @param provider - The {@link CryptoUtils.ICryptoProvider} to use for the import operation.
|
|
2637
|
+
* @returns `Success` with the imported public `CryptoKey`, or `Failure` with error context.
|
|
2638
|
+
* @public
|
|
2639
|
+
*/
|
|
2640
|
+
declare function importPublicKeyFromMultibaseSpki(encoded: string, algorithm: KeyPairAlgorithm, provider: ICryptoProvider): Promise<Result<CryptoKey>>;
|
|
2641
|
+
|
|
2310
2642
|
/**
|
|
2311
2643
|
* Options for template parsing and validation.
|
|
2312
2644
|
* @public
|
|
@@ -2326,6 +2658,15 @@ declare interface IMustacheTemplateOptions {
|
|
|
2326
2658
|
readonly includePartials?: boolean;
|
|
2327
2659
|
}
|
|
2328
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
|
+
|
|
2329
2670
|
/**
|
|
2330
2671
|
* Named secret for encryption/decryption.
|
|
2331
2672
|
* @public
|
|
@@ -2341,6 +2682,67 @@ declare interface INamedSecret {
|
|
|
2341
2682
|
readonly key: Uint8Array;
|
|
2342
2683
|
}
|
|
2343
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
|
+
|
|
2344
2746
|
/**
|
|
2345
2747
|
* Pluggable backend that persists raw asymmetric private keys outside of the
|
|
2346
2748
|
* encrypted keystore vault. Concrete implementations live in platform-specific
|
|
@@ -2401,10 +2803,7 @@ declare interface IProviderCompletionParams {
|
|
|
2401
2803
|
readonly apiKey: string;
|
|
2402
2804
|
/** The structured prompt to send */
|
|
2403
2805
|
readonly prompt: AiPrompt;
|
|
2404
|
-
/**
|
|
2405
|
-
* Additional messages to append after system+user (e.g. for correction retries).
|
|
2406
|
-
* These are appended in order after the initial system and user messages.
|
|
2407
|
-
*/
|
|
2806
|
+
/** Additional messages to append after system+user in order (e.g. for correction retries). */
|
|
2408
2807
|
readonly additionalMessages?: ReadonlyArray<IChatMessage>;
|
|
2409
2808
|
/** Sampling temperature (default: 0.7) */
|
|
2410
2809
|
readonly temperature?: number;
|
|
@@ -2417,20 +2816,17 @@ declare interface IProviderCompletionParams {
|
|
|
2417
2816
|
/** Optional abort signal for cancelling the in-flight request. */
|
|
2418
2817
|
readonly signal?: AbortSignal;
|
|
2419
2818
|
/**
|
|
2420
|
-
* Optional override of the descriptor's default base URL
|
|
2421
|
-
*
|
|
2422
|
-
*
|
|
2423
|
-
*
|
|
2424
|
-
*
|
|
2425
|
-
* Must be a well-formed `http`/`https` URL string. Used to dispatch the same
|
|
2426
|
-
* provider descriptor against a self-hosted or local endpoint (e.g.
|
|
2427
|
-
* `http://localhost:11434/v1` for Ollama, or LAN-hosted OpenAI-compatible
|
|
2428
|
-
* servers).
|
|
2429
|
-
*
|
|
2430
|
-
* Setting `endpoint` does not change the auth shape: providers with
|
|
2431
|
-
* `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.
|
|
2432
2823
|
*/
|
|
2433
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;
|
|
2434
2830
|
}
|
|
2435
2831
|
|
|
2436
2832
|
/**
|
|
@@ -2472,6 +2868,10 @@ declare interface IProviderCompletionStreamParams {
|
|
|
2472
2868
|
* dispatcher; auth shape is unaffected.
|
|
2473
2869
|
*/
|
|
2474
2870
|
readonly endpoint?: string;
|
|
2871
|
+
/**
|
|
2872
|
+
* Optional thinking/reasoning mode configuration.
|
|
2873
|
+
*/
|
|
2874
|
+
readonly thinking?: IThinkingConfig;
|
|
2475
2875
|
}
|
|
2476
2876
|
|
|
2477
2877
|
/**
|
|
@@ -2491,13 +2891,7 @@ declare interface IProviderImageGenerationParams {
|
|
|
2491
2891
|
readonly logger?: Logging.ILogger;
|
|
2492
2892
|
/** Optional abort signal for cancelling the in-flight request. */
|
|
2493
2893
|
readonly signal?: AbortSignal;
|
|
2494
|
-
/**
|
|
2495
|
-
* Optional override of the descriptor's default base URL. Same semantics as
|
|
2496
|
-
* the non-streaming completion path's endpoint: a well-formed `http`/`https`
|
|
2497
|
-
* URL substituted for `descriptor.baseUrl` when composing the request, with
|
|
2498
|
-
* the per-route suffix (e.g. `/images/generations`, `:predict`) appended
|
|
2499
|
-
* unchanged.
|
|
2500
|
-
*/
|
|
2894
|
+
/** Optional override of the descriptor's base URL; per-route suffix is appended unchanged. */
|
|
2501
2895
|
readonly endpoint?: string;
|
|
2502
2896
|
}
|
|
2503
2897
|
|
|
@@ -2518,11 +2912,7 @@ declare interface IProviderListModelsParams {
|
|
|
2518
2912
|
readonly logger?: Logging.ILogger;
|
|
2519
2913
|
/** Optional abort signal for cancelling the in-flight request. */
|
|
2520
2914
|
readonly signal?: AbortSignal;
|
|
2521
|
-
/**
|
|
2522
|
-
* Optional override of the descriptor's default base URL — a well-formed
|
|
2523
|
-
* `http`/`https` URL substituted for `descriptor.baseUrl`, with the
|
|
2524
|
-
* per-format `/models` route appended unchanged.
|
|
2525
|
-
*/
|
|
2915
|
+
/** Optional override of the descriptor's base URL; per-format `/models` route is appended unchanged. */
|
|
2526
2916
|
readonly endpoint?: string;
|
|
2527
2917
|
}
|
|
2528
2918
|
|
|
@@ -2554,6 +2944,38 @@ declare interface IRequiredMustacheTemplateOptions {
|
|
|
2554
2944
|
readonly includePartials: boolean;
|
|
2555
2945
|
}
|
|
2556
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
|
+
|
|
2557
2979
|
/**
|
|
2558
2980
|
* Checks if a JSON object appears to be an encrypted file.
|
|
2559
2981
|
* Uses the format field as a discriminator.
|
|
@@ -2586,6 +3008,39 @@ declare const isoDate: Converter<Date, unknown>;
|
|
|
2586
3008
|
*/
|
|
2587
3009
|
declare const isoDateTime: Converter<DateTime, unknown>;
|
|
2588
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
|
+
|
|
2589
3044
|
/**
|
|
2590
3045
|
* Represents a variable reference extracted from a Mustache template.
|
|
2591
3046
|
* @public
|
|
@@ -2663,6 +3118,29 @@ declare interface IWrappedBytes {
|
|
|
2663
3118
|
readonly ciphertext: string;
|
|
2664
3119
|
}
|
|
2665
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
|
+
|
|
2666
3144
|
/**
|
|
2667
3145
|
* Options for YAML serialization, mirroring commonly-used `js-yaml` `DumpOptions`.
|
|
2668
3146
|
* @public
|
|
@@ -2802,9 +3280,13 @@ declare const keyDerivationParams: Converter<IKeyDerivationParams>;
|
|
|
2802
3280
|
* and message rather than sampled randomly, eliminating the random-nonce
|
|
2803
3281
|
* reuse risk that ECDSA carries. Distinct from X25519 (key agreement over
|
|
2804
3282
|
* the Montgomery form, Curve25519).
|
|
3283
|
+
* - `'x25519'`: Diffie-Hellman key agreement over the Montgomery form of
|
|
3284
|
+
* Curve25519. Key-agreement only — use `deriveBits`/`deriveKey` to produce
|
|
3285
|
+
* a shared secret from one party's private key and the peer's public key.
|
|
3286
|
+
* Distinct from Ed25519 (which uses the twisted-Edwards form for signing).
|
|
2805
3287
|
* @public
|
|
2806
3288
|
*/
|
|
2807
|
-
declare type KeyPairAlgorithm = 'ecdsa-p256' | 'rsa-oaep-2048' | 'ecdh-p256' | 'ed25519';
|
|
3289
|
+
declare type KeyPairAlgorithm = 'ecdsa-p256' | 'rsa-oaep-2048' | 'ecdh-p256' | 'ed25519' | 'x25519';
|
|
2808
3290
|
|
|
2809
3291
|
/**
|
|
2810
3292
|
* Converter for {@link CryptoUtils.KeyStore.KeyPairAlgorithm | key pair algorithm}.
|
|
@@ -3412,7 +3894,7 @@ declare const modelSpec: Converter<ModelSpec>;
|
|
|
3412
3894
|
* Known context keys for model specification maps.
|
|
3413
3895
|
* @public
|
|
3414
3896
|
*/
|
|
3415
|
-
declare type ModelSpecKey = 'base' | 'tools' | 'image';
|
|
3897
|
+
declare type ModelSpecKey = 'base' | 'tools' | 'image' | 'thinking';
|
|
3416
3898
|
|
|
3417
3899
|
/**
|
|
3418
3900
|
* Converter for {@link ModelSpecKey}.
|
|
@@ -3420,6 +3902,31 @@ declare type ModelSpecKey = 'base' | 'tools' | 'image';
|
|
|
3420
3902
|
*/
|
|
3421
3903
|
declare const modelSpecKey: Converter<ModelSpecKey>;
|
|
3422
3904
|
|
|
3905
|
+
/**
|
|
3906
|
+
* Decodes a multibase base64url (no-padding) string back to a `Uint8Array`.
|
|
3907
|
+
*
|
|
3908
|
+
* Validates that the first character is `'m'` (the multibase prefix for
|
|
3909
|
+
* RFC 4648 base64url without padding), then decodes the remaining body.
|
|
3910
|
+
*
|
|
3911
|
+
* @param encoded - A multibase-prefixed base64url string.
|
|
3912
|
+
* @returns `Success` with the decoded bytes, or `Failure` with error context.
|
|
3913
|
+
* @public
|
|
3914
|
+
*/
|
|
3915
|
+
declare function multibaseBase64UrlDecode(encoded: string): Result<Uint8Array>;
|
|
3916
|
+
|
|
3917
|
+
/**
|
|
3918
|
+
* Encodes a `Uint8Array` as a multibase base64url (no-padding) string.
|
|
3919
|
+
*
|
|
3920
|
+
* The multibase prefix `'m'` identifies the encoding as RFC 4648 base64url
|
|
3921
|
+
* without padding. The body uses base64url alphabet: `+` → `-`, `/` → `_`,
|
|
3922
|
+
* and trailing `=` padding is stripped.
|
|
3923
|
+
*
|
|
3924
|
+
* @param data - The binary data to encode.
|
|
3925
|
+
* @returns A multibase-prefixed base64url string (`'m' + base64url-no-pad`).
|
|
3926
|
+
* @public
|
|
3927
|
+
*/
|
|
3928
|
+
declare function multibaseBase64UrlEncode(data: Uint8Array): string;
|
|
3929
|
+
|
|
3423
3930
|
declare namespace Mustache {
|
|
3424
3931
|
export {
|
|
3425
3932
|
IContextValidationResult,
|
|
@@ -3609,6 +4116,19 @@ declare class NodeCryptoProvider implements ICryptoProvider {
|
|
|
3609
4116
|
* @returns `Success` with the imported public `CryptoKey`, or `Failure` with an error.
|
|
3610
4117
|
*/
|
|
3611
4118
|
importPublicKeyJwk(jwk: JsonWebKey, algorithm: KeyPairAlgorithm): Promise<Result<CryptoKey>>;
|
|
4119
|
+
/**
|
|
4120
|
+
* Exports a public `CryptoKey` as a DER-encoded SPKI blob.
|
|
4121
|
+
* @param publicKey - The public `CryptoKey` to export.
|
|
4122
|
+
* @returns `Success` with the raw SPKI bytes, or `Failure` with error context.
|
|
4123
|
+
*/
|
|
4124
|
+
exportPublicKeySpki(publicKey: CryptoKey): Promise<Result<Uint8Array>>;
|
|
4125
|
+
/**
|
|
4126
|
+
* Imports a public key from a DER-encoded SPKI blob.
|
|
4127
|
+
* @param spkiBytes - The raw SPKI bytes.
|
|
4128
|
+
* @param algorithm - The algorithm the key was generated for.
|
|
4129
|
+
* @returns `Success` with the imported public `CryptoKey`, or `Failure` with error context.
|
|
4130
|
+
*/
|
|
4131
|
+
importPublicKeySpki(spkiBytes: Uint8Array, algorithm: KeyPairAlgorithm): Promise<Result<CryptoKey>>;
|
|
3612
4132
|
/**
|
|
3613
4133
|
* Wraps `plaintext` for the holder of `recipientPublicKey` using
|
|
3614
4134
|
* ECIES (ECDH P-256 + HKDF-SHA256 + AES-GCM-256). See
|
|
@@ -3636,6 +4156,12 @@ declare class NodeCryptoProvider implements ICryptoProvider {
|
|
|
3636
4156
|
*/
|
|
3637
4157
|
declare const nodeCryptoProvider: NodeCryptoProvider;
|
|
3638
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
|
+
|
|
3639
4165
|
/**
|
|
3640
4166
|
* Parses CSV data from a string.
|
|
3641
4167
|
* @param body - The CSV string to parse.
|
|
@@ -3873,6 +4399,28 @@ declare function resolveEffectiveTools(descriptor: IAiProviderDescriptor, settin
|
|
|
3873
4399
|
*/
|
|
3874
4400
|
declare function resolveImageCapability(descriptor: IAiProviderDescriptor, modelId: string): IAiImageModelCapability | undefined;
|
|
3875
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
|
+
|
|
3876
4424
|
/**
|
|
3877
4425
|
* Resolves a {@link ModelSpec} to a concrete model string given an optional context key.
|
|
3878
4426
|
*
|
|
@@ -3962,6 +4510,27 @@ declare function tryDecryptFile<TPayload extends JsonValue = JsonValue, TMetadat
|
|
|
3962
4510
|
*/
|
|
3963
4511
|
declare const uint8ArrayFromBase64: Converter<Uint8Array>;
|
|
3964
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
|
+
|
|
3965
4534
|
declare namespace Yaml {
|
|
3966
4535
|
export {
|
|
3967
4536
|
yamlConverter,
|