@fgv/ts-extras 5.1.0-36 → 5.1.0-39

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.
Files changed (128) hide show
  1. package/dist/packlets/ai-assist/apiClient.js +66 -111
  2. package/dist/packlets/ai-assist/apiClient.js.map +1 -1
  3. package/dist/packlets/ai-assist/converters.js +16 -3
  4. package/dist/packlets/ai-assist/converters.js.map +1 -1
  5. package/dist/packlets/ai-assist/embeddingClient.js +5 -6
  6. package/dist/packlets/ai-assist/embeddingClient.js.map +1 -1
  7. package/dist/packlets/ai-assist/imageOptionsResolver.js +0 -19
  8. package/dist/packlets/ai-assist/imageOptionsResolver.js.map +1 -1
  9. package/dist/packlets/ai-assist/index.js +2 -2
  10. package/dist/packlets/ai-assist/index.js.map +1 -1
  11. package/dist/packlets/ai-assist/model.js +139 -7
  12. package/dist/packlets/ai-assist/model.js.map +1 -1
  13. package/dist/packlets/ai-assist/registry.js +58 -51
  14. package/dist/packlets/ai-assist/registry.js.map +1 -1
  15. package/dist/packlets/ai-assist/streamingAdapters/anthropic.js +38 -11
  16. package/dist/packlets/ai-assist/streamingAdapters/anthropic.js.map +1 -1
  17. package/dist/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.js +187 -36
  18. package/dist/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.js.map +1 -1
  19. package/dist/packlets/ai-assist/streamingAdapters/common.js +13 -0
  20. package/dist/packlets/ai-assist/streamingAdapters/common.js.map +1 -1
  21. package/dist/packlets/ai-assist/streamingAdapters/gemini.js +12 -4
  22. package/dist/packlets/ai-assist/streamingAdapters/gemini.js.map +1 -1
  23. package/dist/packlets/ai-assist/streamingAdapters/openaiChat.js +6 -1
  24. package/dist/packlets/ai-assist/streamingAdapters/openaiChat.js.map +1 -1
  25. package/dist/packlets/ai-assist/streamingAdapters/openaiResponses.js +10 -3
  26. package/dist/packlets/ai-assist/streamingAdapters/openaiResponses.js.map +1 -1
  27. package/dist/packlets/ai-assist/streamingAdapters/proxy.js +5 -2
  28. package/dist/packlets/ai-assist/streamingAdapters/proxy.js.map +1 -1
  29. package/dist/packlets/ai-assist/streamingClient.js +16 -16
  30. package/dist/packlets/ai-assist/streamingClient.js.map +1 -1
  31. package/dist/packlets/crypto-utils/converters.js +18 -0
  32. package/dist/packlets/crypto-utils/converters.js.map +1 -1
  33. package/dist/packlets/crypto-utils/index.browser.js +2 -2
  34. package/dist/packlets/crypto-utils/index.browser.js.map +1 -1
  35. package/dist/packlets/crypto-utils/index.js +2 -2
  36. package/dist/packlets/crypto-utils/index.js.map +1 -1
  37. package/dist/packlets/crypto-utils/keystore/keyStore.js +19 -4
  38. package/dist/packlets/crypto-utils/keystore/keyStore.js.map +1 -1
  39. package/dist/packlets/crypto-utils/keystore/model.js.map +1 -1
  40. package/dist/packlets/crypto-utils/model.js.map +1 -1
  41. package/dist/packlets/crypto-utils/spkiHelpers.js +104 -25
  42. package/dist/packlets/crypto-utils/spkiHelpers.js.map +1 -1
  43. package/dist/ts-extras.d.ts +377 -132
  44. package/dist/tsdoc-metadata.json +1 -1
  45. package/lib/packlets/ai-assist/apiClient.d.ts +12 -2
  46. package/lib/packlets/ai-assist/apiClient.d.ts.map +1 -1
  47. package/lib/packlets/ai-assist/apiClient.js +65 -110
  48. package/lib/packlets/ai-assist/apiClient.js.map +1 -1
  49. package/lib/packlets/ai-assist/converters.d.ts +8 -2
  50. package/lib/packlets/ai-assist/converters.d.ts.map +1 -1
  51. package/lib/packlets/ai-assist/converters.js +17 -4
  52. package/lib/packlets/ai-assist/converters.js.map +1 -1
  53. package/lib/packlets/ai-assist/embeddingClient.d.ts.map +1 -1
  54. package/lib/packlets/ai-assist/embeddingClient.js +4 -5
  55. package/lib/packlets/ai-assist/embeddingClient.js.map +1 -1
  56. package/lib/packlets/ai-assist/imageOptionsResolver.d.ts +0 -8
  57. package/lib/packlets/ai-assist/imageOptionsResolver.d.ts.map +1 -1
  58. package/lib/packlets/ai-assist/imageOptionsResolver.js +0 -19
  59. package/lib/packlets/ai-assist/imageOptionsResolver.js.map +1 -1
  60. package/lib/packlets/ai-assist/index.d.ts +3 -3
  61. package/lib/packlets/ai-assist/index.d.ts.map +1 -1
  62. package/lib/packlets/ai-assist/index.js +6 -1
  63. package/lib/packlets/ai-assist/index.js.map +1 -1
  64. package/lib/packlets/ai-assist/model.d.ts +181 -98
  65. package/lib/packlets/ai-assist/model.d.ts.map +1 -1
  66. package/lib/packlets/ai-assist/model.js +143 -8
  67. package/lib/packlets/ai-assist/model.js.map +1 -1
  68. package/lib/packlets/ai-assist/registry.d.ts.map +1 -1
  69. package/lib/packlets/ai-assist/registry.js +58 -51
  70. package/lib/packlets/ai-assist/registry.js.map +1 -1
  71. package/lib/packlets/ai-assist/streamingAdapters/anthropic.d.ts +1 -1
  72. package/lib/packlets/ai-assist/streamingAdapters/anthropic.d.ts.map +1 -1
  73. package/lib/packlets/ai-assist/streamingAdapters/anthropic.js +37 -10
  74. package/lib/packlets/ai-assist/streamingAdapters/anthropic.js.map +1 -1
  75. package/lib/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.d.ts +82 -3
  76. package/lib/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.d.ts.map +1 -1
  77. package/lib/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.js +187 -35
  78. package/lib/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.js.map +1 -1
  79. package/lib/packlets/ai-assist/streamingAdapters/common.d.ts +24 -1
  80. package/lib/packlets/ai-assist/streamingAdapters/common.d.ts.map +1 -1
  81. package/lib/packlets/ai-assist/streamingAdapters/common.js +14 -1
  82. package/lib/packlets/ai-assist/streamingAdapters/common.js.map +1 -1
  83. package/lib/packlets/ai-assist/streamingAdapters/gemini.d.ts +10 -1
  84. package/lib/packlets/ai-assist/streamingAdapters/gemini.d.ts.map +1 -1
  85. package/lib/packlets/ai-assist/streamingAdapters/gemini.js +12 -4
  86. package/lib/packlets/ai-assist/streamingAdapters/gemini.js.map +1 -1
  87. package/lib/packlets/ai-assist/streamingAdapters/openaiChat.d.ts +1 -1
  88. package/lib/packlets/ai-assist/streamingAdapters/openaiChat.d.ts.map +1 -1
  89. package/lib/packlets/ai-assist/streamingAdapters/openaiChat.js +6 -1
  90. package/lib/packlets/ai-assist/streamingAdapters/openaiChat.js.map +1 -1
  91. package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.d.ts +1 -1
  92. package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.d.ts.map +1 -1
  93. package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.js +10 -3
  94. package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.js.map +1 -1
  95. package/lib/packlets/ai-assist/streamingAdapters/proxy.d.ts.map +1 -1
  96. package/lib/packlets/ai-assist/streamingAdapters/proxy.js +5 -2
  97. package/lib/packlets/ai-assist/streamingAdapters/proxy.js.map +1 -1
  98. package/lib/packlets/ai-assist/streamingClient.d.ts +1 -1
  99. package/lib/packlets/ai-assist/streamingClient.d.ts.map +1 -1
  100. package/lib/packlets/ai-assist/streamingClient.js +15 -15
  101. package/lib/packlets/ai-assist/streamingClient.js.map +1 -1
  102. package/lib/packlets/crypto-utils/converters.d.ts +9 -1
  103. package/lib/packlets/crypto-utils/converters.d.ts.map +1 -1
  104. package/lib/packlets/crypto-utils/converters.js +19 -1
  105. package/lib/packlets/crypto-utils/converters.js.map +1 -1
  106. package/lib/packlets/crypto-utils/index.browser.d.ts +1 -1
  107. package/lib/packlets/crypto-utils/index.browser.d.ts.map +1 -1
  108. package/lib/packlets/crypto-utils/index.browser.js +6 -2
  109. package/lib/packlets/crypto-utils/index.browser.js.map +1 -1
  110. package/lib/packlets/crypto-utils/index.d.ts +1 -1
  111. package/lib/packlets/crypto-utils/index.d.ts.map +1 -1
  112. package/lib/packlets/crypto-utils/index.js +6 -2
  113. package/lib/packlets/crypto-utils/index.js.map +1 -1
  114. package/lib/packlets/crypto-utils/keystore/keyStore.d.ts +9 -2
  115. package/lib/packlets/crypto-utils/keystore/keyStore.d.ts.map +1 -1
  116. package/lib/packlets/crypto-utils/keystore/keyStore.js +19 -4
  117. package/lib/packlets/crypto-utils/keystore/keyStore.js.map +1 -1
  118. package/lib/packlets/crypto-utils/keystore/model.d.ts +7 -0
  119. package/lib/packlets/crypto-utils/keystore/model.d.ts.map +1 -1
  120. package/lib/packlets/crypto-utils/keystore/model.js.map +1 -1
  121. package/lib/packlets/crypto-utils/model.d.ts +11 -1
  122. package/lib/packlets/crypto-utils/model.d.ts.map +1 -1
  123. package/lib/packlets/crypto-utils/model.js.map +1 -1
  124. package/lib/packlets/crypto-utils/spkiHelpers.d.ts +59 -2
  125. package/lib/packlets/crypto-utils/spkiHelpers.d.ts.map +1 -1
  126. package/lib/packlets/crypto-utils/spkiHelpers.js +108 -25
  127. package/lib/packlets/crypto-utils/spkiHelpers.js.map +1 -1
  128. package/package.json +7 -7
@@ -1,3 +1,4 @@
1
+ import { Brand } from '@fgv/ts-utils';
1
2
  import { Conversion } from '@fgv/ts-utils';
2
3
  import { Converter } from '@fgv/ts-utils';
3
4
  import { DateTime } from 'luxon';
@@ -34,6 +35,7 @@ declare namespace AiAssist {
34
35
  AiToolConfig,
35
36
  IAiWebSearchToolConfig,
36
37
  IAiClientToolConfig,
38
+ IAiToolAnnotations,
37
39
  IAiClientTool,
38
40
  IAiClientToolCallSummary,
39
41
  IAiClientToolContinuation,
@@ -60,25 +62,16 @@ declare namespace AiAssist {
60
62
  IAiImageData,
61
63
  AiImageSize,
62
64
  AiImageQuality,
63
- DallE2Size,
64
- DallE3Size,
65
65
  GptImageSize,
66
- DallE3Quality,
67
66
  GptImageQuality,
68
- DallEModelNames,
69
67
  GptImageModelNames,
70
68
  GrokImagineModelNames,
71
- Imagen4ModelNames,
72
69
  GeminiFlashImageModelNames,
73
- IDallEImageGenerationConfig,
74
70
  IGptImageGenerationConfig,
75
71
  IGrokImagineImageGenerationConfig,
76
- IImagen4GenerationConfig,
77
72
  IGeminiFlashImageGenerationConfig,
78
- IDallEModelOptions,
79
73
  IGptImageModelOptions,
80
74
  IGrokImagineModelOptions,
81
- IImagen4ModelOptions,
82
75
  IGeminiFlashImageModelOptions,
83
76
  IOtherModelOptions,
84
77
  IModelFamilyConfig,
@@ -103,6 +96,11 @@ declare namespace AiAssist {
103
96
  allModelSpecKeys,
104
97
  MODEL_SPEC_BASE_KEY,
105
98
  resolveModel,
99
+ IModelAliasMap,
100
+ MODEL_ALIAS_SIGIL,
101
+ resolveModelAlias,
102
+ resolveProviderModel,
103
+ isResponsesOnlyModel,
106
104
  toDataUrl,
107
105
  AiThinkingMode,
108
106
  IThinkingConfig,
@@ -149,10 +147,12 @@ declare namespace AiAssist {
149
147
  executeClientToolTurn,
150
148
  IExecuteClientToolTurnParams,
151
149
  IExecuteClientToolTurnResult,
150
+ IToolExecutionDecision,
152
151
  aiProviderId,
153
152
  aiServerToolType,
154
153
  aiWebSearchToolConfig,
155
154
  aiServerToolConfig,
155
+ aiToolAnnotations,
156
156
  aiClientToolConfig,
157
157
  aiToolEnablement,
158
158
  aiAssistProviderConfig,
@@ -190,7 +190,8 @@ declare const aiAssistSettings: Converter<IAiAssistSettings>;
190
190
 
191
191
  /**
192
192
  * Converter for {@link AiAssist.IAiClientToolConfig}. Validates the wrapper shape: `type`,
193
- * `name`, `description`, and the presence of a usable `parametersSchema`.
193
+ * `name`, `description`, the presence of a usable `parametersSchema`, and optional
194
+ * host-advisory `annotations`.
194
195
  * Does not inspect the inner JSON Schema structure — `JsonSchema.object(...)` already
195
196
  * guarantees the schema is valid.
196
197
  * @public
@@ -240,20 +241,19 @@ declare type AiEmbeddingTaskType = 'retrieval-query' | 'retrieval-document' | 's
240
241
  * - `'xai-images'` — xAI Images API. Text-only JSON generation request.
241
242
  * - `'xai-images-edits'` — xAI Images API for Grok Imagine models. Uses JSON
242
243
  * body with `{ type: "image_url" }` objects (not multipart).
243
- * - `'gemini-imagen'` — Google Imagen `:predict` endpoint. Text-only.
244
244
  * - `'gemini-image-out'` — Google Gemini chat-style `:generateContent`
245
- * endpoint that returns image parts (Gemini 2.5 Flash Image / "Nano
245
+ * endpoint that returns image parts (Gemini Flash Image / "Nano
246
246
  * Banana"). Accepts reference images.
247
247
  *
248
248
  * @public
249
249
  */
250
- declare type AiImageApiFormat = 'openai-images' | 'gemini-imagen' | 'xai-images' | 'xai-images-edits' | 'gemini-image-out';
250
+ declare type AiImageApiFormat = 'openai-images' | 'xai-images' | 'xai-images-edits' | 'gemini-image-out';
251
251
 
252
252
  /** All accepted quality strings across all providers. @public */
253
- declare type AiImageQuality = DallE3Quality | GptImageQuality;
253
+ declare type AiImageQuality = GptImageQuality;
254
254
 
255
255
  /** All accepted image size strings across all providers. @public */
256
- declare type AiImageSize = DallE2Size | DallE3Size | GptImageSize;
256
+ declare type AiImageSize = GptImageSize;
257
257
 
258
258
  /**
259
259
  * Capability vocabulary used to describe what a model can do. Used as both
@@ -344,6 +344,12 @@ declare const aiServerToolType: Converter<AiServerToolType>;
344
344
  */
345
345
  declare type AiThinkingMode = 'optional' | 'required' | 'unsupported';
346
346
 
347
+ /**
348
+ * Converter for {@link AiAssist.IAiToolAnnotations} — the five optional host-advisory hints.
349
+ * @public
350
+ */
351
+ declare const aiToolAnnotations: Converter<IAiToolAnnotations>;
352
+
347
353
  /**
348
354
  * Union of all tool configurations: server-side or client-defined.
349
355
  * Discriminated on `type`.
@@ -421,9 +427,14 @@ declare function anthropicEffortToBudgetTokens(effort: NonNullable<IAnthropicThi
421
427
 
422
428
  /**
423
429
  * Model IDs for Anthropic thinking-capable models.
430
+ *
431
+ * @remarks
432
+ * Only thinking-capable lines are listed. The non-tier `@anthropic:haiku` / `@anthropic:fable`
433
+ * aliases (reachable via `modelOverride` only) are deliberately omitted — they are not
434
+ * documented as thinking-capable, so naming them in a thinking-model filter would be misleading.
424
435
  * @public
425
436
  */
426
- declare type AnthropicThinkingModelNames = 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7';
437
+ declare type AnthropicThinkingModelNames = 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-sonnet-5' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8';
427
438
 
428
439
  /**
429
440
  * Recommended OWASP 2023 minimum Argon2id parameters.
@@ -450,6 +461,31 @@ declare const argon2idKeyDerivationParams: Converter<IArgon2idKeyDerivationParam
450
461
  */
451
462
  declare const base64String: Converter<string>;
452
463
 
464
+ /**
465
+ * Decodes a base64url (no-padding) string (RFC 4648 §5) back to a `Uint8Array`.
466
+ *
467
+ * This is the bare primitive with no multibase prefix; use
468
+ * {@link CryptoUtils.multibaseBase64UrlDecode} to decode a multibase-`'m'`-prefixed value.
469
+ *
470
+ * @param encoded - The base64url-no-pad body to decode.
471
+ * @returns `Success` with the decoded bytes, or `Failure` with error context.
472
+ * @public
473
+ */
474
+ declare function base64UrlNoPadDecode(encoded: string): Result<Uint8Array>;
475
+
476
+ /**
477
+ * Encodes a `Uint8Array` as a base64url (no-padding) string (RFC 4648 §5).
478
+ *
479
+ * The body uses the base64url alphabet (`+` → `-`, `/` → `_`) and trailing `=`
480
+ * padding is stripped. This is the bare primitive with no multibase prefix; use
481
+ * {@link CryptoUtils.multibaseBase64UrlEncode} when a multibase-`'m'`-prefixed value is required.
482
+ *
483
+ * @param data - The binary data to encode.
484
+ * @returns The base64url-no-pad string.
485
+ * @public
486
+ */
487
+ declare function base64UrlNoPadEncode(data: Uint8Array): string;
488
+
453
489
  /**
454
490
  * Calls the appropriate chat completion API for a given provider. Routes by
455
491
  * `apiFormat`: `'openai'` (xAI/OpenAI/Groq/Mistral — switches to Responses API
@@ -501,7 +537,7 @@ declare function callProviderEmbedding(params: IProviderEmbeddingParams): Promis
501
537
  /**
502
538
  * Calls the appropriate image-generation API for a given provider. Routes by the
503
539
  * `format` field of the resolved {@link IAiImageModelCapability}:
504
- * `'openai-images'`, `'xai-images'`, `'xai-images-edits'`, `'gemini-imagen'`, or
540
+ * `'openai-images'`, `'xai-images'`, `'xai-images-edits'`, or
505
541
  * `'gemini-image-out'`. Rejects up front if `referenceImages` is set but the
506
542
  * capability does not declare `acceptsImageReferenceInput`.
507
543
  * @param params - Request parameters including descriptor, API key, and prompt
@@ -638,6 +674,7 @@ declare namespace Converters_3 {
638
674
  argon2idKeyDerivationParams,
639
675
  keyDerivationParams,
640
676
  base64String,
677
+ multibaseSpkiPublicKey,
641
678
  uint8ArrayFromBase64,
642
679
  namedSecret,
643
680
  encryptedFile
@@ -685,13 +722,18 @@ declare namespace CryptoUtils {
685
722
  ICreateEncryptedFileParams,
686
723
  toBase64,
687
724
  tryDecryptFile,
725
+ base64UrlNoPadDecode,
726
+ base64UrlNoPadEncode,
688
727
  exportPublicKeyAsMultibaseSpki,
689
728
  importPublicKeyFromMultibaseSpki,
729
+ isValidMultibaseSpkiPublicKey,
730
+ MultibaseSpkiPublicKeyRegExp,
690
731
  multibaseBase64UrlDecode,
691
732
  multibaseBase64UrlEncode,
692
733
  HpkeProvider,
693
734
  IHpkeSealResult,
694
735
  isEncryptedFile,
736
+ MultibaseSpkiPublicKey,
695
737
  EncryptionAlgorithm,
696
738
  EncryptedFileFormat,
697
739
  INamedSecret,
@@ -736,18 +778,6 @@ declare interface CsvOptions {
736
778
  delimiter?: string;
737
779
  }
738
780
 
739
- /** Pixel dimension sizes accepted by dall-e-2. @public */
740
- declare type DallE2Size = '256x256' | '512x512' | '1024x1024';
741
-
742
- /** Quality values for dall-e-3. @public */
743
- declare type DallE3Quality = 'standard' | 'hd';
744
-
745
- /** Pixel dimension sizes accepted by dall-e-3. @public */
746
- declare type DallE3Size = '1024x1024' | '1792x1024' | '1024x1792';
747
-
748
- /** Model names in the DALL-E family. @public */
749
- declare type DallEModelNames = 'dall-e-2' | 'dall-e-3';
750
-
751
781
  /**
752
782
  * Decrypts an {@link CryptoUtils.IEncryptedFile | encrypted file} and returns the JSON content.
753
783
  * @typeParam TPayload - Expected type of decrypted content
@@ -1059,7 +1089,7 @@ export { Experimental }
1059
1089
  * @returns `Success` with the multibase SPKI string, or `Failure` with error context.
1060
1090
  * @public
1061
1091
  */
1062
- declare function exportPublicKeyAsMultibaseSpki(key: CryptoKey, provider: ICryptoProvider): Promise<Result<string>>;
1092
+ declare function exportPublicKeyAsMultibaseSpki(key: CryptoKey, provider: ICryptoProvider): Promise<Result<MultibaseSpkiPublicKey>>;
1063
1093
 
1064
1094
  /**
1065
1095
  * An experimental array template which extend built-in `Array` to include a handful
@@ -1267,13 +1297,13 @@ declare const GCM_AUTH_TAG_SIZE: number;
1267
1297
  declare const GCM_IV_SIZE: number;
1268
1298
 
1269
1299
  /** Model names in the Gemini Flash Image family. @public */
1270
- declare type GeminiFlashImageModelNames = 'gemini-2.5-flash-image';
1300
+ declare type GeminiFlashImageModelNames = 'gemini-3.1-flash-image-preview';
1271
1301
 
1272
1302
  /**
1273
1303
  * Model IDs for Google Gemini thinking-capable models.
1274
1304
  * @public
1275
1305
  */
1276
- declare type GeminiThinkingModelNames = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite';
1306
+ declare type GeminiThinkingModelNames = 'gemini-3.1-pro-preview' | 'gemini-3.5-flash' | 'gemini-3.1-flash-lite';
1277
1307
 
1278
1308
  /**
1279
1309
  * Calls {@link AiAssist.callProviderCompletion}, then runs the response text
@@ -1312,7 +1342,7 @@ declare function getProviderDescriptor(id: string): Result<IAiProviderDescriptor
1312
1342
  declare function getProviderDescriptors(): ReadonlyArray<IAiProviderDescriptor>;
1313
1343
 
1314
1344
  /** Model names in the GPT Image family. @public */
1315
- declare type GptImageModelNames = 'gpt-image-1';
1345
+ declare type GptImageModelNames = 'gpt-image-1' | 'gpt-image-1.5';
1316
1346
 
1317
1347
  /** Quality values for gpt-image-1. @public */
1318
1348
  declare type GptImageQuality = 'low' | 'medium' | 'high' | 'auto';
@@ -1471,6 +1501,13 @@ declare interface IAddKeyPairOptions {
1471
1501
  * displaced storage blob; see the keystore design doc for details.
1472
1502
  */
1473
1503
  readonly replace?: boolean;
1504
+ /**
1505
+ * Overrides the storage-backend-derived extractability for this key only.
1506
+ * Omit to keep the default (`!privateKeyStorage.supportsNonExtractable`).
1507
+ * A value the backend cannot honor fails loudly rather than silently
1508
+ * downgrading.
1509
+ */
1510
+ readonly extractable?: boolean;
1474
1511
  }
1475
1512
 
1476
1513
  /**
@@ -1696,6 +1733,12 @@ declare interface IAiClientToolConfig<TParams = unknown> {
1696
1733
  * `.toJson()` and validates model-returned args via `.validate(rawArgs)`.
1697
1734
  */
1698
1735
  readonly parametersSchema: JsonSchema.ISchemaValidator<TParams>;
1736
+ /**
1737
+ * Optional host-advisory behavior annotations (read-only / destructive /
1738
+ * idempotent / open-world hints + display title). Consumed by the host's
1739
+ * tool loop; never serialized to the model. See {@link IAiToolAnnotations}.
1740
+ */
1741
+ readonly annotations?: IAiToolAnnotations;
1699
1742
  }
1700
1743
 
1701
1744
  /**
@@ -1949,14 +1992,13 @@ declare interface IAiImageData {
1949
1992
  declare interface IAiImageGenerationOptions {
1950
1993
  /**
1951
1994
  * Image dimensions for OpenAI models (mapped to `size` field).
1952
- * For xAI aspect ratio or Imagen aspect ratio, use the corresponding `models` family block.
1995
+ * For xAI or Gemini Flash aspect ratio, use the corresponding `models` family block.
1953
1996
  */
1954
1997
  readonly size?: AiImageSize;
1955
1998
  /** Number of images. Default 1. Some models enforce a maximum. */
1956
1999
  readonly count?: number;
1957
2000
  /**
1958
2001
  * Quality tier. Accepted values differ per model:
1959
- * - dall-e-3: 'standard' | 'hd'
1960
2002
  * - gpt-image-1: 'low' | 'medium' | 'high' | 'auto'
1961
2003
  * Other models ignore this field.
1962
2004
  */
@@ -2032,9 +2074,9 @@ declare interface IAiImageModelCapability {
2032
2074
  readonly maxCount?: number;
2033
2075
  /**
2034
2076
  * How to encode the output format on the wire:
2035
- * - 'response-format': send response_format: 'b64_json' (dall-e-2, dall-e-3)
2077
+ * - 'response-format': send response_format: 'b64_json' (openai-images catch-all)
2036
2078
  * - 'output-format': send output_format (gpt-image-1)
2037
- * - 'none': send neither (Imagen, Gemini Flash)
2079
+ * - 'none': send neither (Gemini Flash)
2038
2080
  */
2039
2081
  readonly outputParamStyle?: 'response-format' | 'output-format' | 'none';
2040
2082
  /** Default MIME type for response images. */
@@ -2107,6 +2149,19 @@ declare interface IAiProviderDescriptor {
2107
2149
  readonly baseUrl: string;
2108
2150
  /** Default model specification — string or context-aware map. */
2109
2151
  readonly defaultModel: ModelSpec;
2152
+ /**
2153
+ * Canonical fgv alias → concrete model map for this provider. Absent means the
2154
+ * provider defines no aliases and every model string passes through verbatim.
2155
+ *
2156
+ * @remarks
2157
+ * Keys are full fgv aliases (`@<providerId>:<role>`); values are the current
2158
+ * concrete model id (or a provider-native alias). Consulted by
2159
+ * {@link resolveModelAlias} / {@link resolveProviderModel} at each call-time
2160
+ * resolution chokepoint, downstream of the {@link ModelSpecKey} walk. Additive
2161
+ * and optional — composes with the existing per-descriptor `imageGeneration` /
2162
+ * `embedding` capability arrays.
2163
+ */
2164
+ readonly aliases?: IModelAliasMap;
2110
2165
  /** Which server-side tools this provider supports (empty = none). */
2111
2166
  readonly supportedTools: ReadonlyArray<AiServerToolType>;
2112
2167
  /** Whether this provider's API enforces CORS restrictions that prevent direct browser calls. */
@@ -2146,15 +2201,13 @@ declare interface IAiProviderDescriptor {
2146
2201
  * catch-all and matches every model id.
2147
2202
  *
2148
2203
  * Multiple entries support providers that host more than one image-API
2149
- * surface under one baseUrl. Google Gemini is the canonical case: the
2150
- * `imagen-*` family is predict-only via `:predict`, while
2151
- * `gemini-2.5-flash-image` uses chat-style `:generateContent` and accepts
2152
- * reference images. Listing both lets callers pick the right model and the
2153
- * dispatcher routes accordingly.
2204
+ * surface under one baseUrl. The dispatcher selects the longest-matching
2205
+ * prefix, so a provider can list a specific-prefix surface alongside an
2206
+ * empty-prefix catch-all and the right model routes to the right API.
2154
2207
  *
2155
2208
  * Image-model selection reuses the existing `image` {@link ModelSpecKey}.
2156
2209
  * Providers that declare `imageGeneration` should declare a model in
2157
- * `defaultModel.image`, e.g. `{ base: 'gpt-4o', image: 'dall-e-3' }`.
2210
+ * `defaultModel.image`, e.g. `{ base: '@openai:mini', image: '@openai:image' }`.
2158
2211
  */
2159
2212
  readonly imageGeneration?: ReadonlyArray<IAiImageModelCapability>;
2160
2213
  /**
@@ -2169,11 +2222,27 @@ declare interface IAiProviderDescriptor {
2169
2222
  *
2170
2223
  * Embedding-model selection uses the `embedding` {@link ModelSpecKey}.
2171
2224
  * Providers that declare `embedding` should declare a model in
2172
- * `defaultModel.embedding`, e.g. `{ base: 'gpt-4o', embedding: 'text-embedding-3-small' }`.
2225
+ * `defaultModel.embedding`, e.g. `{ base: '@openai:mini', embedding: '@openai:embedding' }`.
2173
2226
  * Self-hosted providers (`ollama`, `openai-compat`) leave it unset — the
2174
2227
  * caller supplies the embedding model via `modelOverride`.
2175
2228
  */
2176
2229
  readonly embedding?: ReadonlyArray<IAiEmbeddingModelCapability>;
2230
+ /**
2231
+ * Concrete model ids (prefix-matched) that must be invoked via the OpenAI
2232
+ * Responses API rather than chat completions — e.g. `gpt-5.5-pro`. Non-OpenAI
2233
+ * `apiFormat`s ignore this.
2234
+ *
2235
+ * @remarks
2236
+ * Some current-generation OpenAI models (the `-pro` tier) are Responses-API-only
2237
+ * and 400 on `/chat/completions`. The completion and streaming dispatch consult
2238
+ * this list (via the sibling predicate {@link AiAssist.isResponsesOnlyModel})
2239
+ * and route a matching model to the Responses path
2240
+ * even when no tools are requested. Mirrors the prefix-matching shape of the
2241
+ * `imageGeneration` / `embedding` capability arrays; adding a new Responses-only
2242
+ * line is a one-entry descriptor edit. Empty or undefined means no model is
2243
+ * Responses-only.
2244
+ */
2245
+ readonly responsesOnlyModelPrefixes?: ReadonlyArray<string>;
2177
2246
  }
2178
2247
 
2179
2248
  /**
@@ -2311,6 +2380,35 @@ declare interface IAiStreamToolUseStart {
2311
2380
  readonly callId?: string;
2312
2381
  }
2313
2382
 
2383
+ /**
2384
+ * Behavior annotations for a client-defined tool.
2385
+ *
2386
+ * @remarks
2387
+ * These are **host-advisory-only hints** describing a tool's side-effect profile.
2388
+ * They are consumed by the host's tool loop (e.g. a before-execute gate) and are
2389
+ * **never serialized to the model** — the provider wire tool-schemas whitelist
2390
+ * `{name, description, parameters}` and ignore this field.
2391
+ *
2392
+ * Field names mirror MCP's `ToolAnnotations` (`@modelcontextprotocol/sdk`) 1:1 so
2393
+ * an MCP tool's annotations pass through unchanged. Per the MCP spec, all fields
2394
+ * are hints — a host should never make tool-use decisions based on annotations
2395
+ * received from an untrusted server without its own validation.
2396
+ *
2397
+ * @public
2398
+ */
2399
+ declare interface IAiToolAnnotations {
2400
+ /** Optional human-readable display title for the tool. */
2401
+ readonly title?: string;
2402
+ /** Hint: the tool does not modify its environment (read-only). */
2403
+ readonly readOnlyHint?: boolean;
2404
+ /** Hint: the tool may perform destructive updates (only meaningful when not read-only). */
2405
+ readonly destructiveHint?: boolean;
2406
+ /** Hint: repeated calls with the same arguments have no additional effect. */
2407
+ readonly idempotentHint?: boolean;
2408
+ /** Hint: the tool interacts with an open world of external entities. */
2409
+ readonly openWorldHint?: boolean;
2410
+ }
2411
+
2314
2412
  /**
2315
2413
  * Declares a tool as enabled/disabled in provider settings.
2316
2414
  * Tools are disabled by default — consuming apps must opt in explicitly.
@@ -2786,36 +2884,6 @@ declare interface ICryptoProvider {
2786
2884
  verifyHmacSha256(key: CryptoKey, signature: Uint8Array, data: Uint8Array): Promise<Result<boolean>>;
2787
2885
  }
2788
2886
 
2789
- /**
2790
- * Provider-specific config for DALL-E models (dall-e-2, dall-e-3).
2791
- * @remarks
2792
- * style is only valid for dall-e-3; the runtime validator rejects it for dall-e-2.
2793
- * @public
2794
- */
2795
- declare interface IDallEImageGenerationConfig {
2796
- /** Image dimensions (dall-e-2: 256x256|512x512|1024x1024; dall-e-3: 1024x1024|1792x1024|1024x1792). */
2797
- readonly size?: DallE2Size | DallE3Size;
2798
- /** dall-e-3 only. Quality tier. */
2799
- readonly quality?: DallE3Quality;
2800
- /** dall-e-3 only. Visual style. */
2801
- readonly style?: 'vivid' | 'natural';
2802
- }
2803
-
2804
- /**
2805
- * Options block scoped to DALL-E family models.
2806
- * @public
2807
- */
2808
- declare interface IDallEModelOptions extends INamedModelFamilyConfig {
2809
- /** Discriminator: openai provider lineage. */
2810
- readonly provider: 'openai';
2811
- /** Family identifier. */
2812
- readonly family: 'dall-e';
2813
- /** Optional model names this block applies to. Omit = applies to all DALL-E models. */
2814
- readonly models?: DallEModelNames[];
2815
- /** Family-specific config. */
2816
- readonly config: IDallEImageGenerationConfig;
2817
- }
2818
-
2819
2887
  /**
2820
2888
  * Parameters for creating a {@link DirectEncryptionProvider}.
2821
2889
  * @public
@@ -3030,7 +3098,10 @@ declare interface IExecuteClientToolTurnParams extends IChatRequest {
3030
3098
  * normalized-message path strips provider-native fields.
3031
3099
  */
3032
3100
  readonly continuationMessages?: ReadonlyArray<JsonObject>;
3033
- /** Temperature (default: 0.7). */
3101
+ /**
3102
+ * Sampling temperature. Sent to the provider only when explicitly provided; omitted otherwise
3103
+ * so the provider's own default applies (current-gen models reject a caller-supplied default).
3104
+ */
3034
3105
  readonly temperature?: number;
3035
3106
  /** Server-side tools to include. */
3036
3107
  readonly tools?: ReadonlyArray<AiServerToolConfig>;
@@ -3054,6 +3125,22 @@ declare interface IExecuteClientToolTurnParams extends IChatRequest {
3054
3125
  readonly resolvedThinking?: IResolvedThinkingConfig;
3055
3126
  /** Resolved model string (pre-resolved by the caller). When omitted, uses the descriptor's default model. */
3056
3127
  readonly model?: string;
3128
+ /**
3129
+ * Optional host gate invoked for each client-tool call **after** the model's raw
3130
+ * args have been validated against the tool's `parametersSchema` and **before**
3131
+ * `tool.execute(...)` runs. The full `tool` (including `tool.config.annotations`)
3132
+ * and the validated `args` are passed so gate logic can key off a tool's behavior
3133
+ * annotations (e.g. deny a `destructiveHint` call pending confirmation).
3134
+ *
3135
+ * Returning `{ action: 'proceed' }` (or omitting the callback) runs `execute`
3136
+ * normally. Returning `{ action: 'deny', reason }` skips `execute` and synthesizes
3137
+ * a denial tool-result carrying `reason` into the continuation (the model sees the
3138
+ * denial and can react); **the turn continues**. A callback that returns `Result.fail`
3139
+ * or rejects is a hard error that **terminates the turn** (fails `nextTurn` + emits an
3140
+ * inline `error` event) — distinct from a `tool.execute` failure, which continues the
3141
+ * turn with an `isError` result. A deny must therefore be explicit.
3142
+ */
3143
+ readonly onBeforeToolExecute?: (tool: IAiClientTool, args: unknown) => Promise<Result<IToolExecutionDecision>>;
3057
3144
  }
3058
3145
 
3059
3146
  /**
@@ -3263,38 +3350,6 @@ declare interface IHpkeSealResult {
3263
3350
  readonly ciphertext: Uint8Array;
3264
3351
  }
3265
3352
 
3266
- /**
3267
- * Provider-specific config for Google Imagen 4 models.
3268
- * @public
3269
- */
3270
- declare interface IImagen4GenerationConfig {
3271
- /** Aspect ratio string. */
3272
- readonly aspectRatio?: '1:1' | '3:4' | '4:3' | '9:16' | '16:9';
3273
- /** Output resolution. */
3274
- readonly imageSize?: '1K' | '2K';
3275
- /** Whether to add SynthID watermark. Must be false to use seed. */
3276
- readonly addWatermark?: boolean;
3277
- /** LLM-based prompt rewriting. */
3278
- readonly enhancePrompt?: boolean;
3279
- /** Output MIME type. */
3280
- readonly outputMimeType?: 'image/jpeg' | 'image/png';
3281
- /** JPEG compression quality. */
3282
- readonly outputCompressionQuality?: number;
3283
- /** Person generation policy. */
3284
- readonly personGeneration?: 'allow_all' | 'allow_adult' | 'dont_allow';
3285
- }
3286
-
3287
- /**
3288
- * Options block scoped to Google Imagen 4 models.
3289
- * @public
3290
- */
3291
- declare interface IImagen4ModelOptions extends INamedModelFamilyConfig {
3292
- readonly provider: 'google';
3293
- readonly family: 'imagen-4';
3294
- readonly models?: Imagen4ModelNames[];
3295
- readonly config: IImagen4GenerationConfig;
3296
- }
3297
-
3298
3353
  /**
3299
3354
  * Options for importing raw key material via {@link KeyStore.importSecret}.
3300
3355
  * Extends {@link IImportSecretOptions} with a type classification.
@@ -3637,9 +3692,6 @@ declare interface IKeyStoreVaultContents {
3637
3692
  readonly secrets: Record<string, IKeyStoreEntryJson>;
3638
3693
  }
3639
3694
 
3640
- /** Model names in the Imagen 4 family. @public */
3641
- declare type Imagen4ModelNames = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001';
3642
-
3643
3695
  /**
3644
3696
  * Details about a missing variable in context validation.
3645
3697
  * @public
@@ -3660,12 +3712,27 @@ declare interface IMissingVariableDetail {
3660
3712
  readonly existingPath: readonly string[];
3661
3713
  }
3662
3714
 
3715
+ /**
3716
+ * Canonical fgv alias → concrete provider model map.
3717
+ *
3718
+ * @remarks
3719
+ * Keys are full fgv aliases (`@<providerId>:<role>`, e.g. `@google-gemini:flash`);
3720
+ * values are the current concrete provider model id (or a provider-native alias,
3721
+ * which is resolved with one further indirection hop). Additive; absence of an
3722
+ * `aliases` field on a descriptor means "this provider defines no aliases" and
3723
+ * every model string passes through verbatim.
3724
+ * @public
3725
+ */
3726
+ declare interface IModelAliasMap {
3727
+ readonly [alias: string]: string;
3728
+ }
3729
+
3663
3730
  /**
3664
3731
  * Discriminated union of all model-family option blocks.
3665
3732
  * Discriminated on `provider` + `family` fields.
3666
3733
  * @public
3667
3734
  */
3668
- declare type IModelFamilyConfig = IDallEModelOptions | IGptImageModelOptions | IGrokImagineModelOptions | IImagen4ModelOptions | IGeminiFlashImageModelOptions | IOtherModelOptions;
3735
+ declare type IModelFamilyConfig = IGptImageModelOptions | IGrokImagineModelOptions | IGeminiFlashImageModelOptions | IOtherModelOptions;
3669
3736
 
3670
3737
  /**
3671
3738
  * A model specification: either a simple model string or a record mapping
@@ -3674,18 +3741,18 @@ declare type IModelFamilyConfig = IDallEModelOptions | IGptImageModelOptions | I
3674
3741
  * @remarks
3675
3742
  * A bare string is equivalent to `{ base: string }`. This keeps the simple
3676
3743
  * case simple while allowing context-aware model selection (e.g. different
3677
- * models for tool-augmented vs. base completions).
3744
+ * models for different quality tiers).
3678
3745
  *
3679
3746
  * @example
3680
3747
  * ```typescript
3681
3748
  * // Simple — same model for all contexts:
3682
3749
  * const simple: ModelSpec = 'grok-4.3';
3683
3750
  *
3684
- * // Context-aware — different model for tools and thinking:
3685
- * const split: ModelSpec = { base: 'grok-4.3', tools: 'grok-4.3', thinking: 'grok-4.3' };
3751
+ * // Context-aware — different model per quality tier:
3752
+ * const split: ModelSpec = { base: 'gpt-5.4-mini', advanced: 'gpt-5.5', frontier: 'gpt-5.5-pro' };
3686
3753
  *
3687
- * // Future nested per-tool model selection:
3688
- * const nested: ModelSpec = { base: 'grok-fast', tools: { base: 'grok-r', image: 'grok-v' } };
3754
+ * // Nesteda tier branch is itself a spec:
3755
+ * const nested: ModelSpec = { base: 'grok-fast', advanced: { base: 'grok-r', image: 'grok-v' } };
3689
3756
  * ```
3690
3757
  * @public
3691
3758
  */
@@ -3700,6 +3767,10 @@ declare interface IModelSpecMap {
3700
3767
  * the provider to import the key with the algorithm parameters from
3701
3768
  * {@link CryptoUtils.keyPairAlgorithmParams}.
3702
3769
  *
3770
+ * Accepts a plain `string` (not only a branded {@link CryptoUtils.MultibaseSpkiPublicKey}),
3771
+ * so callers holding an unbranded value read from storage or the wire can import
3772
+ * it directly; a malformed value fails with error context rather than throwing.
3773
+ *
3703
3774
  * @param encoded - A multibase SPKI string produced by {@link CryptoUtils.exportPublicKeyAsMultibaseSpki}.
3704
3775
  * @param algorithm - The {@link CryptoUtils.KeyPairAlgorithm} the key was generated for.
3705
3776
  * @param provider - The {@link CryptoUtils.ICryptoProvider} to use for the import operation.
@@ -3905,10 +3976,20 @@ declare interface IProviderCompletionParams extends IChatRequest {
3905
3976
  readonly descriptor: IAiProviderDescriptor;
3906
3977
  /** API key for authentication */
3907
3978
  readonly apiKey: string;
3908
- /** Sampling temperature (default: 0.7) */
3979
+ /**
3980
+ * Sampling temperature. Sent to the provider only when explicitly provided; omitted otherwise
3981
+ * so the provider's own default applies (current-gen models reject a caller-supplied default).
3982
+ */
3909
3983
  readonly temperature?: number;
3910
3984
  /** Optional model override — string or context-aware map (uses descriptor.defaultModel otherwise) */
3911
3985
  readonly modelOverride?: ModelSpec;
3986
+ /**
3987
+ * Optional quality tier selecting which completion model to use. `undefined`
3988
+ * selects the `base` tier; `'frontier'` cascades to `advanced` then `base`
3989
+ * when a tier is unset for a provider. Orthogonal to `thinking` and `tools`,
3990
+ * which never select a model.
3991
+ */
3992
+ readonly tier?: 'advanced' | 'frontier';
3912
3993
  /** Optional logger for request/response observability. */
3913
3994
  readonly logger?: Logging.ILogger;
3914
3995
  /** Server-side tools to include in the request. Overrides settings-level tool config when provided. */
@@ -3947,10 +4028,20 @@ declare interface IProviderCompletionStreamParams extends IChatRequest {
3947
4028
  readonly descriptor: IAiProviderDescriptor;
3948
4029
  /** API key for authentication */
3949
4030
  readonly apiKey: string;
3950
- /** Sampling temperature (default: 0.7) */
4031
+ /**
4032
+ * Sampling temperature. Sent to the provider only when explicitly provided; omitted otherwise
4033
+ * so the provider's own default applies (current-gen models reject a caller-supplied default).
4034
+ */
3951
4035
  readonly temperature?: number;
3952
4036
  /** Optional model override — string or context-aware map. */
3953
4037
  readonly modelOverride?: ModelSpec;
4038
+ /**
4039
+ * Optional quality tier selecting which completion model to use. `undefined`
4040
+ * selects the `base` tier; `'frontier'` cascades to `advanced` then `base`
4041
+ * when a tier is unset for a provider. Orthogonal to `thinking` and `tools`,
4042
+ * which never select a model.
4043
+ */
4044
+ readonly tier?: 'advanced' | 'frontier';
3954
4045
  /** Optional logger for request/response observability. */
3955
4046
  readonly logger?: Logging.ILogger;
3956
4047
  /** Server-side tools to include in the request. */
@@ -4082,20 +4173,12 @@ declare interface IResolvedImageOptions {
4082
4173
  readonly quality?: string;
4083
4174
  /** Seed for reproducibility. */
4084
4175
  readonly seed?: number;
4085
- readonly style?: string;
4086
4176
  readonly outputFormat?: string;
4087
4177
  readonly outputCompression?: number;
4088
4178
  readonly background?: string;
4089
4179
  readonly moderation?: string;
4090
4180
  readonly aspectRatio?: string;
4091
4181
  readonly resolution?: string;
4092
- readonly imagenAspectRatio?: string;
4093
- readonly imageSize?: string;
4094
- readonly addWatermark?: boolean;
4095
- readonly enhancePrompt?: boolean;
4096
- readonly imagenOutputMimeType?: string;
4097
- readonly imagenOutputCompressionQuality?: number;
4098
- readonly personGeneration?: string;
4099
4182
  readonly geminiAspectRatio?: string;
4100
4183
  readonly otherParams?: JsonObject;
4101
4184
  }
@@ -4154,6 +4237,40 @@ declare const isoDate: Converter<Date, unknown>;
4154
4237
  */
4155
4238
  declare const isoDateTime: Converter<DateTime, unknown>;
4156
4239
 
4240
+ /**
4241
+ * Determines whether a concrete (already-resolved) model id must be invoked via
4242
+ * the OpenAI Responses API rather than chat completions.
4243
+ *
4244
+ * @remarks
4245
+ * Matches `modelId` against the descriptor's
4246
+ * {@link IAiProviderDescriptor.responsesOnlyModelPrefixes} by prefix. A provider
4247
+ * that declares no list (the common case) always returns `false`. Consulted by
4248
+ * both the completion (`callProviderCompletion`) and streaming
4249
+ * (`callProviderCompletionStream`) OpenAI dispatch branches so a Responses-only
4250
+ * model (e.g. `gpt-5.5-pro`) routes correctly even with no tools requested.
4251
+ *
4252
+ * @param descriptor - The provider descriptor supplying the prefix list.
4253
+ * @param modelId - The resolved concrete model id to test.
4254
+ * @returns `true` when `modelId` starts with any declared Responses-only prefix.
4255
+ * @public
4256
+ */
4257
+ declare function isResponsesOnlyModel(descriptor: IAiProviderDescriptor, modelId: string): boolean;
4258
+
4259
+ /**
4260
+ * Type guard for {@link CryptoUtils.MultibaseSpkiPublicKey}: a string matching
4261
+ * {@link CryptoUtils.MultibaseSpkiPublicKeyRegExp} (multibase `'m'` prefix + a
4262
+ * non-empty base64url-no-pad body) whose body also satisfies the base64url-no-pad
4263
+ * length rule shared with {@link CryptoUtils.base64UrlNoPadDecode}. This is a
4264
+ * structural *shape* check, not full validation — it does not decode the DER SPKI
4265
+ * or verify the key material/algorithm (a malformed-but-well-shaped string fails
4266
+ * later, with clear context, in {@link CryptoUtils.importPublicKeyFromMultibaseSpki}).
4267
+ *
4268
+ * @param value - The value to test.
4269
+ * @returns `true` if `value` is a well-formed multibase SPKI public key string.
4270
+ * @public
4271
+ */
4272
+ declare function isValidMultibaseSpkiPublicKey(value: unknown): value is MultibaseSpkiPublicKey;
4273
+
4157
4274
  /**
4158
4275
  * Thinking/reasoning mode configuration for a completion request.
4159
4276
  *
@@ -4187,6 +4304,32 @@ declare interface IThinkingConfig {
4187
4304
  */
4188
4305
  declare type IThinkingProviderConfig = IAnthropicThinkingOptions | IOpenAiThinkingOptions | IGeminiThinkingOptions | IXAiThinkingOptions | IOtherThinkingOptions;
4189
4306
 
4307
+ /**
4308
+ * Decision returned by an {@link IExecuteClientToolTurnParams.onBeforeToolExecute}
4309
+ * gate for a single client-tool call.
4310
+ *
4311
+ * @remarks
4312
+ * - `{ action: 'proceed' }` — run the tool's `execute` normally.
4313
+ * - `{ action: 'deny', reason }` — do NOT run `execute`; a synthesized tool-result
4314
+ * carrying `reason` is fed into the continuation exactly like a normal result so
4315
+ * the model can react, and a `client-tool-result` event is emitted for the call.
4316
+ * The turn continues.
4317
+ *
4318
+ * A gate that wants to signal a hard error (as opposed to a deliberate deny) should
4319
+ * return `Result.fail` (or reject) from the callback. Note this is NOT the same as a
4320
+ * `tool.execute` failure: an `execute` failure yields an `isError` tool-result and the
4321
+ * **turn continues**, whereas a gate `fail`/reject **terminates the turn** — it fails
4322
+ * `nextTurn` (and emits an inline `error` event) rather than synthesizing a deny.
4323
+ *
4324
+ * @public
4325
+ */
4326
+ declare type IToolExecutionDecision = {
4327
+ readonly action: 'proceed';
4328
+ } | {
4329
+ readonly action: 'deny';
4330
+ readonly reason: string;
4331
+ };
4332
+
4190
4333
  /**
4191
4334
  * Represents a variable reference extracted from a Mustache template.
4192
4335
  * @public
@@ -4800,9 +4943,16 @@ declare class KeyStore_2 implements IEncryptionProvider {
4800
4943
  * Requires a {@link CryptoUtils.KeyStore.IPrivateKeyStorage} backend
4801
4944
  * supplied at construction.
4802
4945
  *
4946
+ * Extractability of the generated private key defaults to the storage
4947
+ * backend's {@link CryptoUtils.KeyStore.IPrivateKeyStorage.supportsNonExtractable}.
4948
+ * `options.extractable` overrides that default for this key only; requesting
4949
+ * `extractable: false` against a backend that cannot store non-extractable
4950
+ * keys fails loudly rather than silently generating an extractable key.
4951
+ *
4803
4952
  * @param name - Unique name for the entry
4804
- * @param options - Algorithm, optional description, replace flag
4805
- * @returns Success with the new entry, Failure if locked, no provider, or storage write failed
4953
+ * @param options - Algorithm, optional description, replace flag, extractable override
4954
+ * @returns Success with the new entry, Failure if locked, no provider, storage write failed,
4955
+ * or the requested extractability cannot be honored by the backend
4806
4956
  * @public
4807
4957
  */
4808
4958
  addKeyPair(name: string, options: IAddKeyPairOptions): Promise<Result<IAddKeyPairResult>>;
@@ -5050,6 +5200,18 @@ declare class Md5Normalizer extends Hash_2.HashingNormalizer {
5050
5200
  */
5051
5201
  declare const MIN_SALT_LENGTH: number;
5052
5202
 
5203
+ /**
5204
+ * Marker prefix for an fgv model alias.
5205
+ *
5206
+ * @remarks
5207
+ * A model string is an fgv alias **iff** it begins with this sigil. Everything
5208
+ * else is a raw provider model id and passes through {@link resolveModelAlias}
5209
+ * untouched — this is what keeps the alias layer back-compatible (no current
5210
+ * `defaultModel`, `modelOverride`, or self-hosted `model:tag` id starts with `@`).
5211
+ * @public
5212
+ */
5213
+ declare const MODEL_ALIAS_SIGIL: '@';
5214
+
5053
5215
  /**
5054
5216
  * Default context key used as fallback when resolving a {@link ModelSpec}.
5055
5217
  * @public
@@ -5074,7 +5236,7 @@ declare const modelSpec: Converter<ModelSpec>;
5074
5236
  * Known context keys for model specification maps.
5075
5237
  * @public
5076
5238
  */
5077
- declare type ModelSpecKey = 'base' | 'tools' | 'image' | 'thinking' | 'embedding';
5239
+ declare type ModelSpecKey = 'base' | 'advanced' | 'frontier' | 'image' | 'embedding';
5078
5240
 
5079
5241
  /**
5080
5242
  * Converter for {@link ModelSpecKey}.
@@ -5107,6 +5269,43 @@ declare function multibaseBase64UrlDecode(encoded: string): Result<Uint8Array>;
5107
5269
  */
5108
5270
  declare function multibaseBase64UrlEncode(data: Uint8Array): string;
5109
5271
 
5272
+ /**
5273
+ * A multibase base64url-encoded SPKI (SubjectPublicKeyInfo) public key string —
5274
+ * a `'m'` multibase prefix followed by a base64url-no-pad body. Produced by
5275
+ * {@link CryptoUtils.exportPublicKeyAsMultibaseSpki} and consumed by
5276
+ * {@link CryptoUtils.importPublicKeyFromMultibaseSpki}. Obtain the brand at a
5277
+ * boundary via {@link CryptoUtils.isValidMultibaseSpkiPublicKey} or the
5278
+ * {@link CryptoUtils.Converters.multibaseSpkiPublicKey} converter.
5279
+ * @public
5280
+ */
5281
+ declare type MultibaseSpkiPublicKey = Brand<string, 'MultibaseSpkiPublicKey'>;
5282
+
5283
+ /**
5284
+ * Converter for {@link CryptoUtils.MultibaseSpkiPublicKey | multibase SPKI public key} strings.
5285
+ * Validates that the value is a string with the `'m'` multibase prefix and a well-formed
5286
+ * base64url-no-pad body, and yields the branded value. Fails with context on a non-string,
5287
+ * bad-prefix, or malformed-body input.
5288
+ * @public
5289
+ */
5290
+ declare const multibaseSpkiPublicKey: Converter<MultibaseSpkiPublicKey>;
5291
+
5292
+ /**
5293
+ * The structural *shape* of a {@link CryptoUtils.MultibaseSpkiPublicKey}: the
5294
+ * multibase `'m'` prefix followed by a non-empty base64url-no-pad body
5295
+ * (`A-Z`, `a-z`, `0-9`, `-`, `_`).
5296
+ *
5297
+ * This is a shape prefilter, not full validation: it does not decode the DER
5298
+ * SPKI or verify the key material or algorithm (that happens in
5299
+ * {@link CryptoUtils.importPublicKeyFromMultibaseSpki}). The authoritative guard
5300
+ * is {@link CryptoUtils.isValidMultibaseSpkiPublicKey}, which enforces this
5301
+ * pattern **and** additionally rejects a body whose length is an impossible
5302
+ * base64 remainder. Exposed for callers that need the pattern directly (e.g. a
5303
+ * JSON-schema `pattern` field); prefer the guard/converter for validation.
5304
+ *
5305
+ * @public
5306
+ */
5307
+ declare const MultibaseSpkiPublicKeyRegExp: RegExp;
5308
+
5110
5309
  declare namespace Mustache {
5111
5310
  export {
5112
5311
  IContextValidationResult,
@@ -5399,7 +5598,7 @@ declare const nodeCryptoProvider: NodeCryptoProvider;
5399
5598
  * Model IDs for OpenAI thinking-capable models.
5400
5599
  * @public
5401
5600
  */
5402
- 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';
5601
+ declare type OpenAiThinkingModelNames = 'o3' | 'o4-mini' | 'o3-deep-research' | 'o4-mini-deep-research' | 'gpt-5' | 'gpt-5.1' | 'gpt-5.2' | 'gpt-5.4-mini' | 'gpt-5.5' | 'gpt-5.5-pro' | 'gpt-5-pro';
5403
5602
 
5404
5603
  /**
5405
5604
  * Parses CSV data from a string.
@@ -5686,17 +5885,63 @@ declare function resolveImageOptions(modelId: string, capability: IAiImageModelC
5686
5885
  * @remarks
5687
5886
  * Resolution rules:
5688
5887
  * 1. If the spec is a string, return it directly (context is irrelevant).
5689
- * 2. If the spec is an object and the context key exists, recurse into that branch.
5888
+ * 2. If the spec is an object, walk the ordered candidate keys for the context:
5889
+ * a quality-tier context (`advanced`/`frontier`) cascades through the
5890
+ * tier-fallback table (`frontier → advanced → base`, `advanced → base`);
5891
+ * every other context resolves flat (`[context]`); `undefined` resolves to
5892
+ * the shared `base` fallback. The first present key wins.
5690
5893
  * 3. Otherwise, fall back to the {@link MODEL_SPEC_BASE_KEY | 'base'} key.
5691
5894
  * 4. If neither context nor `'base'` exists, use the first available value.
5692
5895
  *
5693
5896
  * @param spec - The model specification to resolve
5694
- * @param context - Optional context key (e.g. `'tools'`)
5897
+ * @param context - Optional context key (e.g. `'advanced'`)
5695
5898
  * @returns The resolved model string
5696
5899
  * @public
5697
5900
  */
5698
5901
  declare function resolveModel(spec: ModelSpec, context?: string): string;
5699
5902
 
5903
+ /**
5904
+ * Resolves a single (possibly-aliased) model string against a provider descriptor.
5905
+ *
5906
+ * @remarks
5907
+ * Resolution rules:
5908
+ * 1. No leading {@link MODEL_ALIAS_SIGIL} → raw provider id, returned verbatim.
5909
+ * 2. Leading sigil + registered in `descriptor.aliases` → the registered target,
5910
+ * which is itself resolved — so a chain of `@` aliases is followed until a
5911
+ * non-`@` (concrete provider) id is reached. The canonical case is a single
5912
+ * hop (an fgv alias targeting a provider-native alias), but longer chains
5913
+ * resolve too.
5914
+ * 3. Leading sigil + unregistered → fails loudly, naming the provider and alias.
5915
+ *
5916
+ * An `@`→`@` cycle is guarded by a visited-set and fails rather than exhausting
5917
+ * the stack.
5918
+ *
5919
+ * @param descriptor - The provider descriptor whose `aliases` map is consulted.
5920
+ * @param model - The (possibly-aliased) model string to resolve.
5921
+ * @returns `Result` with the concrete provider model id, or a failure.
5922
+ * @public
5923
+ */
5924
+ declare function resolveModelAlias(descriptor: IAiProviderDescriptor, model: string): Result<string>;
5925
+
5926
+ /**
5927
+ * The full provider model-resolution chokepoint: the {@link ModelSpecKey} walk
5928
+ * (via {@link resolveModel}) THEN {@link resolveModelAlias}.
5929
+ *
5930
+ * @remarks
5931
+ * Replaces the bare `resolveModel(modelOverride ?? descriptor.defaultModel, context)`
5932
+ * call plus the duplicated empty-result check at each call-time chokepoint. The
5933
+ * `ModelSpec` branch is selected first; the resulting string — which may itself
5934
+ * be an fgv alias — is then resolved to a concrete id.
5935
+ *
5936
+ * @param descriptor - The provider descriptor (supplies `defaultModel` and `aliases`).
5937
+ * @param modelOverride - An optional caller-supplied `ModelSpec` that takes precedence
5938
+ * over `descriptor.defaultModel`. May itself contain or be an alias.
5939
+ * @param context - Optional {@link ModelSpecKey} selecting the spec branch.
5940
+ * @returns `Result` with the concrete provider model id, or a failure.
5941
+ * @public
5942
+ */
5943
+ declare function resolveProviderModel(descriptor: IAiProviderDescriptor, modelOverride: ModelSpec | undefined, context?: ModelSpecKey): Result<string>;
5944
+
5700
5945
  /**
5701
5946
  * Function type for dynamic secret retrieval.
5702
5947
  * @public