@fgv/ts-extras 5.1.0-3 → 5.1.0-30
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 +4 -2
- package/dist/index.browser.js.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/packlets/ai-assist/apiClient.js +958 -131
- package/dist/packlets/ai-assist/apiClient.js.map +1 -0
- package/dist/packlets/ai-assist/chatRequestBuilders.js +186 -0
- package/dist/packlets/ai-assist/chatRequestBuilders.js.map +1 -0
- package/dist/packlets/ai-assist/converters.js +2 -1
- package/dist/packlets/ai-assist/converters.js.map +1 -0
- package/dist/packlets/ai-assist/endpoint.js +78 -0
- package/dist/packlets/ai-assist/endpoint.js.map +1 -0
- 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 +7 -3
- package/dist/packlets/ai-assist/index.js.map +1 -0
- package/dist/packlets/ai-assist/jsonCompletion.js +95 -0
- package/dist/packlets/ai-assist/jsonCompletion.js.map +1 -0
- package/dist/packlets/ai-assist/jsonResponse.js +149 -0
- package/dist/packlets/ai-assist/jsonResponse.js.map +1 -0
- package/dist/packlets/ai-assist/model.js +21 -4
- package/dist/packlets/ai-assist/model.js.map +1 -0
- package/dist/packlets/ai-assist/registry.js +235 -10
- package/dist/packlets/ai-assist/registry.js.map +1 -0
- package/dist/packlets/ai-assist/sseParser.js +123 -0
- package/dist/packlets/ai-assist/sseParser.js.map +1 -0
- package/dist/packlets/ai-assist/streamingAdapters/anthropic.js +197 -0
- package/dist/packlets/ai-assist/streamingAdapters/anthropic.js.map +1 -0
- package/dist/packlets/ai-assist/streamingAdapters/common.js +79 -0
- package/dist/packlets/ai-assist/streamingAdapters/common.js.map +1 -0
- package/dist/packlets/ai-assist/streamingAdapters/gemini.js +172 -0
- package/dist/packlets/ai-assist/streamingAdapters/gemini.js.map +1 -0
- package/dist/packlets/ai-assist/streamingAdapters/openaiChat.js +165 -0
- package/dist/packlets/ai-assist/streamingAdapters/openaiChat.js.map +1 -0
- package/dist/packlets/ai-assist/streamingAdapters/openaiResponses.js +179 -0
- package/dist/packlets/ai-assist/streamingAdapters/openaiResponses.js.map +1 -0
- package/dist/packlets/ai-assist/streamingAdapters/proxy.js +163 -0
- package/dist/packlets/ai-assist/streamingAdapters/proxy.js.map +1 -0
- package/dist/packlets/ai-assist/streamingClient.js +116 -0
- package/dist/packlets/ai-assist/streamingClient.js.map +1 -0
- package/dist/packlets/ai-assist/thinkingOptionsResolver.js +265 -0
- package/dist/packlets/ai-assist/thinkingOptionsResolver.js.map +1 -0
- package/dist/packlets/ai-assist/toolFormats.js.map +1 -0
- package/dist/packlets/conversion/converters.js +35 -1
- package/dist/packlets/conversion/converters.js.map +1 -0
- package/dist/packlets/conversion/index.js.map +1 -0
- package/dist/packlets/crypto-utils/constants.js.map +1 -0
- package/dist/packlets/crypto-utils/converters.js +24 -4
- package/dist/packlets/crypto-utils/converters.js.map +1 -0
- package/dist/packlets/crypto-utils/directEncryptionProvider.js.map +1 -0
- package/dist/packlets/crypto-utils/encryptedFile.js.map +1 -0
- package/dist/packlets/crypto-utils/hpkeProvider.js +333 -0
- package/dist/packlets/crypto-utils/hpkeProvider.js.map +1 -0
- package/dist/packlets/crypto-utils/index.browser.js +7 -0
- package/dist/packlets/crypto-utils/index.browser.js.map +1 -0
- package/dist/packlets/crypto-utils/index.js +6 -0
- package/dist/packlets/crypto-utils/index.js.map +1 -0
- package/dist/packlets/crypto-utils/keyPairAlgorithmParams.js +71 -0
- package/dist/packlets/crypto-utils/keyPairAlgorithmParams.js.map +1 -0
- package/dist/packlets/crypto-utils/keystore/converters.js +103 -11
- package/dist/packlets/crypto-utils/keystore/converters.js.map +1 -0
- package/dist/packlets/crypto-utils/keystore/index.js +1 -0
- package/dist/packlets/crypto-utils/keystore/index.js.map +1 -0
- package/dist/packlets/crypto-utils/keystore/keyStore.js +618 -118
- package/dist/packlets/crypto-utils/keystore/keyStore.js.map +1 -0
- package/dist/packlets/crypto-utils/keystore/model.js +22 -1
- package/dist/packlets/crypto-utils/keystore/model.js.map +1 -0
- package/dist/packlets/crypto-utils/keystore/privateKeyStorage.js +21 -0
- package/dist/packlets/crypto-utils/keystore/privateKeyStorage.js.map +1 -0
- package/dist/packlets/crypto-utils/model.js +32 -0
- package/dist/packlets/crypto-utils/model.js.map +1 -0
- package/dist/packlets/crypto-utils/nodeCryptoProvider.js +270 -1
- package/dist/packlets/crypto-utils/nodeCryptoProvider.js.map +1 -0
- package/dist/packlets/crypto-utils/spkiHelpers.js +130 -0
- package/dist/packlets/crypto-utils/spkiHelpers.js.map +1 -0
- package/dist/packlets/csv/csvFileHelpers.js +0 -14
- package/dist/packlets/csv/csvFileHelpers.js.map +1 -0
- package/dist/packlets/csv/csvHelpers.js +14 -0
- package/dist/packlets/csv/csvHelpers.js.map +1 -0
- package/dist/packlets/csv/index.browser.js +1 -3
- package/dist/packlets/csv/index.browser.js.map +1 -0
- package/dist/packlets/csv/index.js.map +1 -0
- package/dist/packlets/experimental/extendedArray.js.map +1 -0
- package/dist/packlets/experimental/formatter.js.map +1 -0
- package/dist/packlets/experimental/index.js.map +1 -0
- package/dist/packlets/experimental/rangeOf.js.map +1 -0
- package/dist/packlets/hash/index.browser.js.map +1 -0
- package/dist/packlets/hash/index.js.map +1 -0
- package/dist/packlets/hash/index.node.js.map +1 -0
- package/dist/packlets/hash/md5Normalizer.browser.js.map +1 -0
- package/dist/packlets/hash/md5Normalizer.js.map +1 -0
- package/dist/packlets/mustache/index.js.map +1 -0
- package/dist/packlets/mustache/interfaces.js.map +1 -0
- package/dist/packlets/mustache/mustacheTemplate.js +42 -4
- package/dist/packlets/mustache/mustacheTemplate.js.map +1 -0
- package/dist/packlets/record-jar/index.browser.js +1 -3
- package/dist/packlets/record-jar/index.browser.js.map +1 -0
- package/dist/packlets/record-jar/index.js.map +1 -0
- package/dist/packlets/record-jar/recordJarFileHelpers.js +0 -18
- package/dist/packlets/record-jar/recordJarFileHelpers.js.map +1 -0
- package/dist/packlets/record-jar/recordJarHelpers.js +18 -0
- package/dist/packlets/record-jar/recordJarHelpers.js.map +1 -0
- package/dist/packlets/yaml/converters.js.map +1 -0
- package/dist/packlets/yaml/index.js +1 -0
- package/dist/packlets/yaml/index.js.map +1 -0
- package/dist/packlets/yaml/serializers.js +48 -0
- package/dist/packlets/yaml/serializers.js.map +1 -0
- package/dist/packlets/zip-file-tree/index.js.map +1 -0
- package/dist/packlets/zip-file-tree/zipFileTreeAccessors.js +2 -2
- package/dist/packlets/zip-file-tree/zipFileTreeAccessors.js.map +1 -0
- package/dist/packlets/zip-file-tree/zipFileTreeWriter.js.map +1 -0
- package/dist/ts-extras.d.ts +2869 -154
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/index.browser.d.ts +4 -2
- package/lib/index.browser.d.ts.map +1 -0
- package/lib/index.browser.js +8 -3
- package/lib/index.browser.js.map +1 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js.map +1 -0
- package/lib/packlets/ai-assist/apiClient.d.ts +99 -16
- package/lib/packlets/ai-assist/apiClient.d.ts.map +1 -0
- package/lib/packlets/ai-assist/apiClient.js +961 -130
- package/lib/packlets/ai-assist/apiClient.js.map +1 -0
- package/lib/packlets/ai-assist/chatRequestBuilders.d.ts +89 -0
- package/lib/packlets/ai-assist/chatRequestBuilders.d.ts.map +1 -0
- package/lib/packlets/ai-assist/chatRequestBuilders.js +195 -0
- package/lib/packlets/ai-assist/chatRequestBuilders.js.map +1 -0
- package/lib/packlets/ai-assist/converters.d.ts.map +1 -0
- package/lib/packlets/ai-assist/converters.js +2 -1
- package/lib/packlets/ai-assist/converters.js.map +1 -0
- package/lib/packlets/ai-assist/endpoint.d.ts +28 -0
- package/lib/packlets/ai-assist/endpoint.d.ts.map +1 -0
- package/lib/packlets/ai-assist/endpoint.js +82 -0
- package/lib/packlets/ai-assist/endpoint.js.map +1 -0
- 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 +7 -3
- package/lib/packlets/ai-assist/index.d.ts.map +1 -0
- package/lib/packlets/ai-assist/index.js +21 -1
- package/lib/packlets/ai-assist/index.js.map +1 -0
- package/lib/packlets/ai-assist/jsonCompletion.d.ts +93 -0
- package/lib/packlets/ai-assist/jsonCompletion.d.ts.map +1 -0
- package/lib/packlets/ai-assist/jsonCompletion.js +99 -0
- package/lib/packlets/ai-assist/jsonCompletion.js.map +1 -0
- package/lib/packlets/ai-assist/jsonResponse.d.ts +91 -0
- package/lib/packlets/ai-assist/jsonResponse.d.ts.map +1 -0
- package/lib/packlets/ai-assist/jsonResponse.js +154 -0
- package/lib/packlets/ai-assist/jsonResponse.js.map +1 -0
- package/lib/packlets/ai-assist/model.d.ts +720 -7
- package/lib/packlets/ai-assist/model.d.ts.map +1 -0
- package/lib/packlets/ai-assist/model.js +22 -4
- package/lib/packlets/ai-assist/model.js.map +1 -0
- package/lib/packlets/ai-assist/registry.d.ts +34 -1
- package/lib/packlets/ai-assist/registry.d.ts.map +1 -0
- package/lib/packlets/ai-assist/registry.js +238 -11
- package/lib/packlets/ai-assist/registry.js.map +1 -0
- package/lib/packlets/ai-assist/sseParser.d.ts +45 -0
- package/lib/packlets/ai-assist/sseParser.d.ts.map +1 -0
- package/lib/packlets/ai-assist/sseParser.js +128 -0
- package/lib/packlets/ai-assist/sseParser.js.map +1 -0
- package/lib/packlets/ai-assist/streamingAdapters/anthropic.d.ts +19 -0
- package/lib/packlets/ai-assist/streamingAdapters/anthropic.d.ts.map +1 -0
- package/lib/packlets/ai-assist/streamingAdapters/anthropic.js +200 -0
- package/lib/packlets/ai-assist/streamingAdapters/anthropic.js.map +1 -0
- package/lib/packlets/ai-assist/streamingAdapters/common.d.ts +83 -0
- package/lib/packlets/ai-assist/streamingAdapters/common.d.ts.map +1 -0
- package/lib/packlets/ai-assist/streamingAdapters/common.js +83 -0
- package/lib/packlets/ai-assist/streamingAdapters/common.js.map +1 -0
- package/lib/packlets/ai-assist/streamingAdapters/gemini.d.ts +20 -0
- package/lib/packlets/ai-assist/streamingAdapters/gemini.d.ts.map +1 -0
- package/lib/packlets/ai-assist/streamingAdapters/gemini.js +175 -0
- package/lib/packlets/ai-assist/streamingAdapters/gemini.js.map +1 -0
- package/lib/packlets/ai-assist/streamingAdapters/openaiChat.d.ts +19 -0
- package/lib/packlets/ai-assist/streamingAdapters/openaiChat.d.ts.map +1 -0
- package/lib/packlets/ai-assist/streamingAdapters/openaiChat.js +168 -0
- package/lib/packlets/ai-assist/streamingAdapters/openaiChat.js.map +1 -0
- package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.d.ts +20 -0
- package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.d.ts.map +1 -0
- package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.js +182 -0
- package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.js.map +1 -0
- package/lib/packlets/ai-assist/streamingAdapters/proxy.d.ts +34 -0
- package/lib/packlets/ai-assist/streamingAdapters/proxy.d.ts.map +1 -0
- package/lib/packlets/ai-assist/streamingAdapters/proxy.js +166 -0
- package/lib/packlets/ai-assist/streamingAdapters/proxy.js.map +1 -0
- package/lib/packlets/ai-assist/streamingClient.d.ts +33 -0
- package/lib/packlets/ai-assist/streamingClient.d.ts.map +1 -0
- package/lib/packlets/ai-assist/streamingClient.js +121 -0
- package/lib/packlets/ai-assist/streamingClient.js.map +1 -0
- 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/ai-assist/toolFormats.d.ts.map +1 -0
- package/lib/packlets/ai-assist/toolFormats.js.map +1 -0
- package/lib/packlets/conversion/converters.d.ts +8 -1
- package/lib/packlets/conversion/converters.d.ts.map +1 -0
- package/lib/packlets/conversion/converters.js +36 -2
- package/lib/packlets/conversion/converters.js.map +1 -0
- package/lib/packlets/conversion/index.d.ts.map +1 -0
- package/lib/packlets/conversion/index.js.map +1 -0
- package/lib/packlets/crypto-utils/constants.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/constants.js.map +1 -0
- package/lib/packlets/crypto-utils/converters.d.ts +12 -1
- package/lib/packlets/crypto-utils/converters.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/converters.js +25 -5
- package/lib/packlets/crypto-utils/converters.js.map +1 -0
- package/lib/packlets/crypto-utils/directEncryptionProvider.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/directEncryptionProvider.js.map +1 -0
- package/lib/packlets/crypto-utils/encryptedFile.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/encryptedFile.js.map +1 -0
- package/lib/packlets/crypto-utils/hpkeProvider.d.ts +142 -0
- package/lib/packlets/crypto-utils/hpkeProvider.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/hpkeProvider.js +337 -0
- package/lib/packlets/crypto-utils/hpkeProvider.js.map +1 -0
- package/lib/packlets/crypto-utils/index.browser.d.ts +3 -0
- package/lib/packlets/crypto-utils/index.browser.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/index.browser.js +14 -1
- package/lib/packlets/crypto-utils/index.browser.js.map +1 -0
- package/lib/packlets/crypto-utils/index.d.ts +3 -0
- package/lib/packlets/crypto-utils/index.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/index.js +13 -1
- package/lib/packlets/crypto-utils/index.js.map +1 -0
- package/lib/packlets/crypto-utils/keyPairAlgorithmParams.d.ts +54 -0
- package/lib/packlets/crypto-utils/keyPairAlgorithmParams.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/keyPairAlgorithmParams.js +74 -0
- package/lib/packlets/crypto-utils/keyPairAlgorithmParams.js.map +1 -0
- package/lib/packlets/crypto-utils/keystore/converters.d.ts +68 -6
- package/lib/packlets/crypto-utils/keystore/converters.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/keystore/converters.js +101 -9
- package/lib/packlets/crypto-utils/keystore/converters.js.map +1 -0
- package/lib/packlets/crypto-utils/keystore/index.d.ts +1 -0
- package/lib/packlets/crypto-utils/keystore/index.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/keystore/index.js +1 -0
- package/lib/packlets/crypto-utils/keystore/index.js.map +1 -0
- package/lib/packlets/crypto-utils/keystore/keyStore.d.ts +198 -13
- package/lib/packlets/crypto-utils/keystore/keyStore.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/keystore/keyStore.js +624 -124
- package/lib/packlets/crypto-utils/keystore/keyStore.js.map +1 -0
- package/lib/packlets/crypto-utils/keystore/model.d.ts +268 -19
- package/lib/packlets/crypto-utils/keystore/model.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/keystore/model.js +24 -2
- package/lib/packlets/crypto-utils/keystore/model.js.map +1 -0
- package/lib/packlets/crypto-utils/keystore/privateKeyStorage.d.ts +50 -0
- package/lib/packlets/crypto-utils/keystore/privateKeyStorage.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/keystore/privateKeyStorage.js +22 -0
- package/lib/packlets/crypto-utils/keystore/privateKeyStorage.js.map +1 -0
- package/lib/packlets/crypto-utils/model.d.ts +338 -10
- package/lib/packlets/crypto-utils/model.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/model.js +33 -1
- package/lib/packlets/crypto-utils/model.js.map +1 -0
- package/lib/packlets/crypto-utils/nodeCryptoProvider.d.ts +110 -2
- package/lib/packlets/crypto-utils/nodeCryptoProvider.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/nodeCryptoProvider.js +269 -0
- package/lib/packlets/crypto-utils/nodeCryptoProvider.js.map +1 -0
- 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/lib/packlets/csv/csvFileHelpers.d.ts +0 -10
- package/lib/packlets/csv/csvFileHelpers.d.ts.map +1 -0
- package/lib/packlets/csv/csvFileHelpers.js +0 -15
- package/lib/packlets/csv/csvFileHelpers.js.map +1 -0
- package/lib/packlets/csv/csvHelpers.d.ts +10 -0
- package/lib/packlets/csv/csvHelpers.d.ts.map +1 -0
- package/lib/packlets/csv/csvHelpers.js +15 -0
- package/lib/packlets/csv/csvHelpers.js.map +1 -0
- package/lib/packlets/csv/index.browser.d.ts +0 -1
- package/lib/packlets/csv/index.browser.d.ts.map +1 -0
- package/lib/packlets/csv/index.browser.js +1 -5
- package/lib/packlets/csv/index.browser.js.map +1 -0
- package/lib/packlets/csv/index.d.ts.map +1 -0
- package/lib/packlets/csv/index.js.map +1 -0
- package/lib/packlets/experimental/extendedArray.d.ts.map +1 -0
- package/lib/packlets/experimental/extendedArray.js.map +1 -0
- package/lib/packlets/experimental/formatter.d.ts.map +1 -0
- package/lib/packlets/experimental/formatter.js.map +1 -0
- package/lib/packlets/experimental/index.d.ts.map +1 -0
- package/lib/packlets/experimental/index.js.map +1 -0
- package/lib/packlets/experimental/rangeOf.d.ts.map +1 -0
- package/lib/packlets/experimental/rangeOf.js.map +1 -0
- package/lib/packlets/hash/index.browser.d.ts.map +1 -0
- package/lib/packlets/hash/index.browser.js.map +1 -0
- package/lib/packlets/hash/index.d.ts.map +1 -0
- package/lib/packlets/hash/index.js.map +1 -0
- package/lib/packlets/hash/index.node.d.ts.map +1 -0
- package/lib/packlets/hash/index.node.js.map +1 -0
- package/lib/packlets/hash/md5Normalizer.browser.d.ts.map +1 -0
- package/lib/packlets/hash/md5Normalizer.browser.js.map +1 -0
- package/lib/packlets/hash/md5Normalizer.d.ts.map +1 -0
- package/lib/packlets/hash/md5Normalizer.js.map +1 -0
- package/lib/packlets/mustache/index.d.ts +1 -1
- package/lib/packlets/mustache/index.d.ts.map +1 -0
- package/lib/packlets/mustache/index.js.map +1 -0
- package/lib/packlets/mustache/interfaces.d.ts +34 -0
- package/lib/packlets/mustache/interfaces.d.ts.map +1 -0
- package/lib/packlets/mustache/interfaces.js.map +1 -0
- package/lib/packlets/mustache/mustacheTemplate.d.ts +2 -0
- package/lib/packlets/mustache/mustacheTemplate.d.ts.map +1 -0
- package/lib/packlets/mustache/mustacheTemplate.js +42 -4
- package/lib/packlets/mustache/mustacheTemplate.js.map +1 -0
- package/lib/packlets/record-jar/index.browser.d.ts +0 -1
- package/lib/packlets/record-jar/index.browser.d.ts.map +1 -0
- package/lib/packlets/record-jar/index.browser.js +1 -5
- package/lib/packlets/record-jar/index.browser.js.map +1 -0
- package/lib/packlets/record-jar/index.d.ts.map +1 -0
- package/lib/packlets/record-jar/index.js.map +1 -0
- package/lib/packlets/record-jar/recordJarFileHelpers.d.ts +0 -11
- package/lib/packlets/record-jar/recordJarFileHelpers.d.ts.map +1 -0
- package/lib/packlets/record-jar/recordJarFileHelpers.js +0 -19
- package/lib/packlets/record-jar/recordJarFileHelpers.js.map +1 -0
- package/lib/packlets/record-jar/recordJarHelpers.d.ts +11 -0
- package/lib/packlets/record-jar/recordJarHelpers.d.ts.map +1 -0
- package/lib/packlets/record-jar/recordJarHelpers.js +19 -0
- package/lib/packlets/record-jar/recordJarHelpers.js.map +1 -0
- package/lib/packlets/yaml/converters.d.ts.map +1 -0
- package/lib/packlets/yaml/converters.js.map +1 -0
- package/lib/packlets/yaml/index.d.ts +1 -0
- package/lib/packlets/yaml/index.d.ts.map +1 -0
- package/lib/packlets/yaml/index.js +1 -0
- package/lib/packlets/yaml/index.js.map +1 -0
- package/lib/packlets/yaml/serializers.d.ts +45 -0
- package/lib/packlets/yaml/serializers.d.ts.map +1 -0
- package/lib/packlets/yaml/serializers.js +84 -0
- package/lib/packlets/yaml/serializers.js.map +1 -0
- package/lib/packlets/zip-file-tree/index.d.ts.map +1 -0
- package/lib/packlets/zip-file-tree/index.js.map +1 -0
- package/lib/packlets/zip-file-tree/zipFileTreeAccessors.d.ts +2 -2
- package/lib/packlets/zip-file-tree/zipFileTreeAccessors.d.ts.map +1 -0
- package/lib/packlets/zip-file-tree/zipFileTreeAccessors.js +2 -2
- package/lib/packlets/zip-file-tree/zipFileTreeAccessors.js.map +1 -0
- package/lib/packlets/zip-file-tree/zipFileTreeWriter.d.ts.map +1 -0
- package/lib/packlets/zip-file-tree/zipFileTreeWriter.js.map +1 -0
- package/package.json +16 -15
|
@@ -3,6 +3,50 @@
|
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
5
|
import { type Result } from '@fgv/ts-utils';
|
|
6
|
+
import { type JsonObject } from '@fgv/ts-json-base';
|
|
7
|
+
/**
|
|
8
|
+
* Universal image representation used for both image input (vision prompts)
|
|
9
|
+
* and image output (generation responses).
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* The base64 string is raw — no `data:` URL prefix. Use {@link AiAssist.toDataUrl} to
|
|
13
|
+
* format it for browser-display contexts.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export interface IAiImageData {
|
|
18
|
+
/** MIME type, e.g. `'image/png'`, `'image/jpeg'`, `'image/webp'`. */
|
|
19
|
+
readonly mimeType: string;
|
|
20
|
+
/** Base64-encoded image bytes (no `data:` prefix). */
|
|
21
|
+
readonly base64: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Formats an {@link IAiImageData} as a `data:` URL suitable for browser display.
|
|
25
|
+
* @param image - The image to format
|
|
26
|
+
* @returns A `data:<mime>;base64,<data>` URL string
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export declare function toDataUrl(image: IAiImageData): string;
|
|
30
|
+
/**
|
|
31
|
+
* Image attachment for a vision (image-input) prompt.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Extends {@link IAiImageData} with an OpenAI-specific `detail` hint that is
|
|
35
|
+
* silently ignored by Anthropic, Gemini, and other providers.
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
export interface IAiImageAttachment extends IAiImageData {
|
|
40
|
+
/**
|
|
41
|
+
* OpenAI vision detail hint:
|
|
42
|
+
* - `'low'`: faster, cheaper, lower fidelity
|
|
43
|
+
* - `'high'`: slower, more expensive, higher fidelity
|
|
44
|
+
* - `'auto'` (default): provider chooses
|
|
45
|
+
*
|
|
46
|
+
* Ignored by providers other than OpenAI.
|
|
47
|
+
*/
|
|
48
|
+
readonly detail?: 'low' | 'high' | 'auto';
|
|
49
|
+
}
|
|
6
50
|
/**
|
|
7
51
|
* A structured AI prompt with system/user split for direct API calls,
|
|
8
52
|
* and a lazily-constructed combined version for copy/paste workflows.
|
|
@@ -13,8 +57,18 @@ export declare class AiPrompt {
|
|
|
13
57
|
readonly system: string;
|
|
14
58
|
/** User request: the specific entity generation request. */
|
|
15
59
|
readonly user: string;
|
|
16
|
-
|
|
17
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Optional image attachments. When present, vision-capable providers will
|
|
62
|
+
* include them in the user message; non-vision providers will reject the
|
|
63
|
+
* call up front (see {@link AiAssist.IAiProviderDescriptor.acceptsImageInput}).
|
|
64
|
+
*/
|
|
65
|
+
readonly attachments: ReadonlyArray<IAiImageAttachment>;
|
|
66
|
+
constructor(user: string, system: string, attachments?: ReadonlyArray<IAiImageAttachment>);
|
|
67
|
+
/**
|
|
68
|
+
* Combined single-string version (user + system joined) for copy/paste.
|
|
69
|
+
* When attachments are present, includes a sentinel noting they aren't
|
|
70
|
+
* part of the copied text.
|
|
71
|
+
*/
|
|
18
72
|
get combined(): string;
|
|
19
73
|
}
|
|
20
74
|
/**
|
|
@@ -73,7 +127,7 @@ export interface IAiToolEnablement {
|
|
|
73
127
|
* Known context keys for model specification maps.
|
|
74
128
|
* @public
|
|
75
129
|
*/
|
|
76
|
-
export type ModelSpecKey = 'base' | 'tools' | 'image';
|
|
130
|
+
export type ModelSpecKey = 'base' | 'tools' | 'image' | 'thinking';
|
|
77
131
|
/**
|
|
78
132
|
* All valid {@link ModelSpecKey} values.
|
|
79
133
|
* @public
|
|
@@ -96,10 +150,10 @@ export declare const MODEL_SPEC_BASE_KEY: ModelSpecKey;
|
|
|
96
150
|
* @example
|
|
97
151
|
* ```typescript
|
|
98
152
|
* // Simple — same model for all contexts:
|
|
99
|
-
* const simple: ModelSpec = 'grok-4
|
|
153
|
+
* const simple: ModelSpec = 'grok-4.3';
|
|
100
154
|
*
|
|
101
|
-
* // Context-aware —
|
|
102
|
-
* const split: ModelSpec = { base: 'grok-4
|
|
155
|
+
* // Context-aware — different model for tools and thinking:
|
|
156
|
+
* const split: ModelSpec = { base: 'grok-4.3', tools: 'grok-4.3', thinking: 'grok-4.3' };
|
|
103
157
|
*
|
|
104
158
|
* // Future nested — per-tool model selection:
|
|
105
159
|
* const nested: ModelSpec = { base: 'grok-fast', tools: { base: 'grok-r', image: 'grok-v' } };
|
|
@@ -133,12 +187,29 @@ export declare function resolveModel(spec: ModelSpec, context?: string): string;
|
|
|
133
187
|
* All known AI provider identifiers.
|
|
134
188
|
* @public
|
|
135
189
|
*/
|
|
136
|
-
export type AiProviderId = 'copy-paste' | 'xai-grok' | 'openai' | 'anthropic' | 'google-gemini' | 'groq' | 'mistral';
|
|
190
|
+
export type AiProviderId = 'copy-paste' | 'xai-grok' | 'openai' | 'openai-compat' | 'anthropic' | 'google-gemini' | 'groq' | 'mistral' | 'ollama';
|
|
137
191
|
/**
|
|
138
192
|
* API format categories for provider routing.
|
|
139
193
|
* @public
|
|
140
194
|
*/
|
|
141
195
|
export type AiApiFormat = 'openai' | 'anthropic' | 'gemini';
|
|
196
|
+
/**
|
|
197
|
+
* API format categories for image-generation provider routing.
|
|
198
|
+
*
|
|
199
|
+
* @remarks
|
|
200
|
+
* - `'openai-images'` — OpenAI Images API. Routes to `/images/generations`
|
|
201
|
+
* (text-only) or `/images/edits` (when reference images are present).
|
|
202
|
+
* - `'xai-images'` — xAI Images API. Text-only JSON generation request.
|
|
203
|
+
* - `'xai-images-edits'` — xAI Images API for Grok Imagine models. Uses JSON
|
|
204
|
+
* body with `{ type: "image_url" }` objects (not multipart).
|
|
205
|
+
* - `'gemini-imagen'` — Google Imagen `:predict` endpoint. Text-only.
|
|
206
|
+
* - `'gemini-image-out'` — Google Gemini chat-style `:generateContent`
|
|
207
|
+
* endpoint that returns image parts (Gemini 2.5 Flash Image / "Nano
|
|
208
|
+
* Banana"). Accepts reference images.
|
|
209
|
+
*
|
|
210
|
+
* @public
|
|
211
|
+
*/
|
|
212
|
+
export type AiImageApiFormat = 'openai-images' | 'gemini-imagen' | 'xai-images' | 'xai-images-edits' | 'gemini-image-out';
|
|
142
213
|
/**
|
|
143
214
|
* Result of an AI provider completion call.
|
|
144
215
|
* @public
|
|
@@ -149,6 +220,72 @@ export interface IAiCompletionResponse {
|
|
|
149
220
|
/** Whether the response was truncated due to token limits */
|
|
150
221
|
readonly truncated: boolean;
|
|
151
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* A text-content delta arriving during a streaming completion.
|
|
225
|
+
* @public
|
|
226
|
+
*/
|
|
227
|
+
export interface IAiStreamTextDelta {
|
|
228
|
+
readonly type: 'text-delta';
|
|
229
|
+
/** The newly arrived text fragment. */
|
|
230
|
+
readonly delta: string;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* A server-side tool progress event arriving during a streaming completion.
|
|
234
|
+
* Surfaced for providers that emit explicit tool-progress markers (OpenAI
|
|
235
|
+
* Responses API, Anthropic). Gemini's grounding doesn't emit these.
|
|
236
|
+
* @public
|
|
237
|
+
*/
|
|
238
|
+
export interface IAiStreamToolEvent {
|
|
239
|
+
readonly type: 'tool-event';
|
|
240
|
+
/** Which server-side tool this event describes. */
|
|
241
|
+
readonly toolType: AiServerToolType;
|
|
242
|
+
/** Tool lifecycle phase. */
|
|
243
|
+
readonly phase: 'started' | 'completed';
|
|
244
|
+
/**
|
|
245
|
+
* Optional provider-specific detail. For web_search this is typically the
|
|
246
|
+
* search query when available; format varies by provider.
|
|
247
|
+
*/
|
|
248
|
+
readonly detail?: string;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Terminal success event for a streaming completion. Carries the aggregated
|
|
252
|
+
* full text and truncation status for callers that want both the progressive
|
|
253
|
+
* UI and the complete result.
|
|
254
|
+
* @public
|
|
255
|
+
*/
|
|
256
|
+
export interface IAiStreamDone {
|
|
257
|
+
readonly type: 'done';
|
|
258
|
+
/** Whether the response was truncated due to token limits. */
|
|
259
|
+
readonly truncated: boolean;
|
|
260
|
+
/** The full concatenated text from all `text-delta` events. */
|
|
261
|
+
readonly fullText: string;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Terminal failure event for a streaming completion. After this event no
|
|
265
|
+
* further events are emitted.
|
|
266
|
+
*
|
|
267
|
+
* @remarks
|
|
268
|
+
* Connection-time failures (auth, network, pre-flight CORS rejection) are
|
|
269
|
+
* surfaced via the outer `Result.fail` returned by
|
|
270
|
+
* `callProviderCompletionStream` rather than as an `error` event, so callers
|
|
271
|
+
* can distinguish "didn't start" from "started but errored mid-stream."
|
|
272
|
+
*
|
|
273
|
+
* @public
|
|
274
|
+
*/
|
|
275
|
+
export interface IAiStreamError {
|
|
276
|
+
readonly type: 'error';
|
|
277
|
+
readonly message: string;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Discriminated union of events emitted by a streaming completion.
|
|
281
|
+
* @public
|
|
282
|
+
*/
|
|
283
|
+
export type IAiStreamEvent = IAiStreamTextDelta | IAiStreamToolEvent | IAiStreamDone | IAiStreamError;
|
|
284
|
+
/**
|
|
285
|
+
* Thinking/reasoning mode support for a provider.
|
|
286
|
+
* @public
|
|
287
|
+
*/
|
|
288
|
+
export type AiThinkingMode = 'optional' | 'required' | 'unsupported';
|
|
152
289
|
/**
|
|
153
290
|
* Describes a single AI provider — single source of truth for all metadata.
|
|
154
291
|
* @public
|
|
@@ -172,6 +309,574 @@ export interface IAiProviderDescriptor {
|
|
|
172
309
|
readonly supportedTools: ReadonlyArray<AiServerToolType>;
|
|
173
310
|
/** Whether this provider's API enforces CORS restrictions that prevent direct browser calls. */
|
|
174
311
|
readonly corsRestricted: boolean;
|
|
312
|
+
/**
|
|
313
|
+
* Whether this provider's streaming completion endpoint requires a proxy
|
|
314
|
+
* for direct browser calls. Some providers gate streaming separately from
|
|
315
|
+
* non-streaming (rare), so this is tracked independently from
|
|
316
|
+
* {@link IAiProviderDescriptor.corsRestricted}.
|
|
317
|
+
*
|
|
318
|
+
* @remarks
|
|
319
|
+
* When `true`, `callProviderCompletionStream` rejects up front unless the
|
|
320
|
+
* call is being routed through a proxy.
|
|
321
|
+
*/
|
|
322
|
+
readonly streamingCorsRestricted: boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Whether this provider's chat completions API accepts image input
|
|
325
|
+
* (i.e. supports vision prompts). When false, calls with
|
|
326
|
+
* `prompt.attachments` are rejected up front.
|
|
327
|
+
*/
|
|
328
|
+
readonly acceptsImageInput: boolean;
|
|
329
|
+
/**
|
|
330
|
+
* Whether this provider supports thinking/reasoning mode.
|
|
331
|
+
* - 'optional': thinking can be enabled but is not required
|
|
332
|
+
* - 'required': thinking is always active (e.g. o-series models)
|
|
333
|
+
* - 'unsupported': thinking is not supported
|
|
334
|
+
*/
|
|
335
|
+
readonly thinkingMode: AiThinkingMode;
|
|
336
|
+
/**
|
|
337
|
+
* Image-generation capabilities, scoped to model id prefixes. Empty or
|
|
338
|
+
* undefined means the provider does not support image generation.
|
|
339
|
+
*
|
|
340
|
+
* @remarks
|
|
341
|
+
* The dispatcher matches the resolved model id against each rule's
|
|
342
|
+
* `modelPrefix` and selects the longest match (see
|
|
343
|
+
* {@link AiAssist.resolveImageCapability}). An empty `modelPrefix` is the
|
|
344
|
+
* catch-all and matches every model id.
|
|
345
|
+
*
|
|
346
|
+
* Multiple entries support providers that host more than one image-API
|
|
347
|
+
* surface under one baseUrl. Google Gemini is the canonical case: the
|
|
348
|
+
* `imagen-*` family is predict-only via `:predict`, while
|
|
349
|
+
* `gemini-2.5-flash-image` uses chat-style `:generateContent` and accepts
|
|
350
|
+
* reference images. Listing both lets callers pick the right model and the
|
|
351
|
+
* dispatcher routes accordingly.
|
|
352
|
+
*
|
|
353
|
+
* Image-model selection reuses the existing `image` {@link ModelSpecKey}.
|
|
354
|
+
* Providers that declare `imageGeneration` should declare a model in
|
|
355
|
+
* `defaultModel.image`, e.g. `{ base: 'gpt-4o', image: 'dall-e-3' }`.
|
|
356
|
+
*/
|
|
357
|
+
readonly imageGeneration?: ReadonlyArray<IAiImageModelCapability>;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Image-generation capability for a model family within a provider. Used as
|
|
361
|
+
* an entry in {@link IAiProviderDescriptor.imageGeneration}.
|
|
362
|
+
*
|
|
363
|
+
* @public
|
|
364
|
+
*/
|
|
365
|
+
export interface IAiImageModelCapability {
|
|
366
|
+
/**
|
|
367
|
+
* Prefix matched against the resolved image model id. The empty string is
|
|
368
|
+
* the catch-all and matches every model. When multiple rules' prefixes
|
|
369
|
+
* match a model id, the longest prefix wins; ties are broken by
|
|
370
|
+
* first-encountered.
|
|
371
|
+
*/
|
|
372
|
+
readonly modelPrefix: string;
|
|
373
|
+
/** API format used to dispatch requests for matching models. */
|
|
374
|
+
readonly format: AiImageApiFormat;
|
|
375
|
+
/**
|
|
376
|
+
* Whether matching models accept reference images via
|
|
377
|
+
* {@link AiAssist.IAiImageGenerationParams.referenceImages}. When false or
|
|
378
|
+
* undefined, calls that include reference images are rejected up front.
|
|
379
|
+
*/
|
|
380
|
+
readonly acceptsImageReferenceInput?: boolean;
|
|
381
|
+
/** Accepted size strings. When present, dispatcher pre-validates. */
|
|
382
|
+
readonly acceptedSizes?: ReadonlyArray<string>;
|
|
383
|
+
/** When true, quality param is sent. When false/undefined, don't send quality. */
|
|
384
|
+
readonly supportsQualityParam?: boolean;
|
|
385
|
+
/** Accepted quality values when supportsQualityParam is true. */
|
|
386
|
+
readonly acceptedQualities?: ReadonlyArray<string>;
|
|
387
|
+
/** Maximum count (n). When present, dispatcher pre-validates. */
|
|
388
|
+
readonly maxCount?: number;
|
|
389
|
+
/**
|
|
390
|
+
* How to encode the output format on the wire:
|
|
391
|
+
* - 'response-format': send response_format: 'b64_json' (dall-e-2, dall-e-3)
|
|
392
|
+
* - 'output-format': send output_format (gpt-image-1)
|
|
393
|
+
* - 'none': send neither (Imagen, Gemini Flash)
|
|
394
|
+
*/
|
|
395
|
+
readonly outputParamStyle?: 'response-format' | 'output-format' | 'none';
|
|
396
|
+
/** Default MIME type for response images. */
|
|
397
|
+
readonly defaultOutputMimeType?: string;
|
|
398
|
+
}
|
|
399
|
+
/** Pixel dimension sizes accepted by dall-e-2. @public */
|
|
400
|
+
export type DallE2Size = '256x256' | '512x512' | '1024x1024';
|
|
401
|
+
/** Pixel dimension sizes accepted by dall-e-3. @public */
|
|
402
|
+
export type DallE3Size = '1024x1024' | '1792x1024' | '1024x1792';
|
|
403
|
+
/** Pixel dimension sizes accepted by gpt-image-1. @public */
|
|
404
|
+
export type GptImageSize = '1024x1024' | '1536x1024' | '1024x1536' | 'auto';
|
|
405
|
+
/** All accepted image size strings across all providers. @public */
|
|
406
|
+
export type AiImageSize = DallE2Size | DallE3Size | GptImageSize;
|
|
407
|
+
/** Quality values for dall-e-3. @public */
|
|
408
|
+
export type DallE3Quality = 'standard' | 'hd';
|
|
409
|
+
/** Quality values for gpt-image-1. @public */
|
|
410
|
+
export type GptImageQuality = 'low' | 'medium' | 'high' | 'auto';
|
|
411
|
+
/** All accepted quality strings across all providers. @public */
|
|
412
|
+
export type AiImageQuality = DallE3Quality | GptImageQuality;
|
|
413
|
+
/** Model names in the DALL-E family. @public */
|
|
414
|
+
export type DallEModelNames = 'dall-e-2' | 'dall-e-3';
|
|
415
|
+
/** Model names in the GPT Image family. @public */
|
|
416
|
+
export type GptImageModelNames = 'gpt-image-1';
|
|
417
|
+
/** Model names in the xAI Grok Imagine family. @public */
|
|
418
|
+
export type GrokImagineModelNames = 'grok-imagine-image' | 'grok-imagine-image-quality';
|
|
419
|
+
/** Model names in the Imagen 4 family. @public */
|
|
420
|
+
export type Imagen4ModelNames = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001';
|
|
421
|
+
/** Model names in the Gemini Flash Image family. @public */
|
|
422
|
+
export type GeminiFlashImageModelNames = 'gemini-2.5-flash-image';
|
|
423
|
+
/**
|
|
424
|
+
* Provider-specific config for DALL-E models (dall-e-2, dall-e-3).
|
|
425
|
+
* @remarks
|
|
426
|
+
* style is only valid for dall-e-3; the runtime validator rejects it for dall-e-2.
|
|
427
|
+
* @public
|
|
428
|
+
*/
|
|
429
|
+
export interface IDallEImageGenerationConfig {
|
|
430
|
+
/** Image dimensions (dall-e-2: 256x256|512x512|1024x1024; dall-e-3: 1024x1024|1792x1024|1024x1792). */
|
|
431
|
+
readonly size?: DallE2Size | DallE3Size;
|
|
432
|
+
/** dall-e-3 only. Quality tier. */
|
|
433
|
+
readonly quality?: DallE3Quality;
|
|
434
|
+
/** dall-e-3 only. Visual style. */
|
|
435
|
+
readonly style?: 'vivid' | 'natural';
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Provider-specific config for gpt-image-1.
|
|
439
|
+
* @public
|
|
440
|
+
*/
|
|
441
|
+
export interface IGptImageGenerationConfig {
|
|
442
|
+
/** Image dimensions. */
|
|
443
|
+
readonly size?: GptImageSize;
|
|
444
|
+
/** Quality tier. */
|
|
445
|
+
readonly quality?: GptImageQuality;
|
|
446
|
+
/** Output format (replaces response_format for this model). */
|
|
447
|
+
readonly outputFormat?: 'png' | 'jpeg' | 'webp';
|
|
448
|
+
/** JPEG/WebP compression level 0–100. */
|
|
449
|
+
readonly outputCompression?: number;
|
|
450
|
+
/** Background transparency control. */
|
|
451
|
+
readonly background?: 'transparent' | 'opaque' | 'auto';
|
|
452
|
+
/** Content moderation strictness. */
|
|
453
|
+
readonly moderation?: 'low' | 'auto';
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Provider-specific config for xAI Grok Imagine models.
|
|
457
|
+
* @public
|
|
458
|
+
*/
|
|
459
|
+
export interface IGrokImagineImageGenerationConfig {
|
|
460
|
+
/** Aspect ratio string (xAI uses aspect ratios, not pixel dimensions). */
|
|
461
|
+
readonly aspectRatio?: string;
|
|
462
|
+
/** Resolution hint. */
|
|
463
|
+
readonly resolution?: string;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Provider-specific config for Google Imagen 4 models.
|
|
467
|
+
* @public
|
|
468
|
+
*/
|
|
469
|
+
export interface IImagen4GenerationConfig {
|
|
470
|
+
/** Aspect ratio string. */
|
|
471
|
+
readonly aspectRatio?: '1:1' | '3:4' | '4:3' | '9:16' | '16:9';
|
|
472
|
+
/** Output resolution. */
|
|
473
|
+
readonly imageSize?: '1K' | '2K';
|
|
474
|
+
/** Whether to add SynthID watermark. Must be false to use seed. */
|
|
475
|
+
readonly addWatermark?: boolean;
|
|
476
|
+
/** LLM-based prompt rewriting. */
|
|
477
|
+
readonly enhancePrompt?: boolean;
|
|
478
|
+
/** Output MIME type. */
|
|
479
|
+
readonly outputMimeType?: 'image/jpeg' | 'image/png';
|
|
480
|
+
/** JPEG compression quality. */
|
|
481
|
+
readonly outputCompressionQuality?: number;
|
|
482
|
+
/** Person generation policy. */
|
|
483
|
+
readonly personGeneration?: 'allow_all' | 'allow_adult' | 'dont_allow';
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Provider-specific config for Gemini Flash Image.
|
|
487
|
+
* @public
|
|
488
|
+
*/
|
|
489
|
+
export interface IGeminiFlashImageGenerationConfig {
|
|
490
|
+
/** Aspect ratio string. */
|
|
491
|
+
readonly aspectRatio?: string;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Base shape shared by all named family option blocks.
|
|
495
|
+
* Provides a typed `models` field for applicability filtering without unsafe casts.
|
|
496
|
+
* @internal
|
|
497
|
+
*/
|
|
498
|
+
export interface INamedModelFamilyConfig {
|
|
499
|
+
readonly models?: readonly string[];
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Options block scoped to DALL-E family models.
|
|
503
|
+
* @public
|
|
504
|
+
*/
|
|
505
|
+
export interface IDallEModelOptions extends INamedModelFamilyConfig {
|
|
506
|
+
/** Discriminator: openai provider lineage. */
|
|
507
|
+
readonly provider: 'openai';
|
|
508
|
+
/** Family identifier. */
|
|
509
|
+
readonly family: 'dall-e';
|
|
510
|
+
/** Optional model names this block applies to. Omit = applies to all DALL-E models. */
|
|
511
|
+
readonly models?: DallEModelNames[];
|
|
512
|
+
/** Family-specific config. */
|
|
513
|
+
readonly config: IDallEImageGenerationConfig;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Options block scoped to GPT Image family models.
|
|
517
|
+
* @public
|
|
518
|
+
*/
|
|
519
|
+
export interface IGptImageModelOptions extends INamedModelFamilyConfig {
|
|
520
|
+
readonly provider: 'openai';
|
|
521
|
+
readonly family: 'gpt-image';
|
|
522
|
+
readonly models?: GptImageModelNames[];
|
|
523
|
+
readonly config: IGptImageGenerationConfig;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Options block scoped to xAI Grok Imagine family models.
|
|
527
|
+
* @public
|
|
528
|
+
*/
|
|
529
|
+
export interface IGrokImagineModelOptions extends INamedModelFamilyConfig {
|
|
530
|
+
readonly provider: 'xai';
|
|
531
|
+
readonly family: 'grok-imagine';
|
|
532
|
+
readonly models?: GrokImagineModelNames[];
|
|
533
|
+
readonly config: IGrokImagineImageGenerationConfig;
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Options block scoped to Google Imagen 4 models.
|
|
537
|
+
* @public
|
|
538
|
+
*/
|
|
539
|
+
export interface IImagen4ModelOptions extends INamedModelFamilyConfig {
|
|
540
|
+
readonly provider: 'google';
|
|
541
|
+
readonly family: 'imagen-4';
|
|
542
|
+
readonly models?: Imagen4ModelNames[];
|
|
543
|
+
readonly config: IImagen4GenerationConfig;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Options block scoped to Gemini Flash Image models.
|
|
547
|
+
* @public
|
|
548
|
+
*/
|
|
549
|
+
export interface IGeminiFlashImageModelOptions extends INamedModelFamilyConfig {
|
|
550
|
+
readonly provider: 'google';
|
|
551
|
+
readonly family: 'gemini-flash-image';
|
|
552
|
+
readonly models?: GeminiFlashImageModelNames[];
|
|
553
|
+
readonly config: IGeminiFlashImageGenerationConfig;
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Escape-hatch options block for models not covered by a named family.
|
|
557
|
+
* @remarks
|
|
558
|
+
* `models` is required — there is no implicit "all" for unknown model families.
|
|
559
|
+
* `config` is `JsonObject` — passed verbatim to the wire request with no validation.
|
|
560
|
+
* This is the "trust me, I know what I'm doing" path for callers who need to send
|
|
561
|
+
* wire params our typed configs don't yet expose.
|
|
562
|
+
* @public
|
|
563
|
+
*/
|
|
564
|
+
export interface IOtherModelOptions {
|
|
565
|
+
readonly provider: 'other';
|
|
566
|
+
readonly models: string[];
|
|
567
|
+
readonly config: JsonObject;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Discriminated union of all model-family option blocks.
|
|
571
|
+
* Discriminated on `provider` + `family` fields.
|
|
572
|
+
* @public
|
|
573
|
+
*/
|
|
574
|
+
export type IModelFamilyConfig = IDallEModelOptions | IGptImageModelOptions | IGrokImagineModelOptions | IImagen4ModelOptions | IGeminiFlashImageModelOptions | IOtherModelOptions;
|
|
575
|
+
/**
|
|
576
|
+
* Options for image generation requests.
|
|
577
|
+
*
|
|
578
|
+
* @remarks
|
|
579
|
+
* Uses a layered architecture:
|
|
580
|
+
* 1. Generic top-level options (size, count, quality, seed) apply across providers
|
|
581
|
+
* via the resolved model's registry mapping.
|
|
582
|
+
* 2. Optional `models` array contains model-family-scoped blocks; the resolver
|
|
583
|
+
* picks applicable blocks based on the resolved model and applies them in
|
|
584
|
+
* declaration order.
|
|
585
|
+
*
|
|
586
|
+
* **Merge precedence (later wins):**
|
|
587
|
+
* 1. Generic top-level options (lowest precedence)
|
|
588
|
+
* 2. Family-generic blocks (matching family, models field omitted)
|
|
589
|
+
* 3. Model-specific blocks (models array includes resolved model name)
|
|
590
|
+
* 4. Other blocks (provider: 'other', models array includes resolved model name)
|
|
591
|
+
*
|
|
592
|
+
* Provider-mismatch: blocks whose provider doesn't match the dispatcher's
|
|
593
|
+
* provider lineage are silently skipped.
|
|
594
|
+
*
|
|
595
|
+
* @public
|
|
596
|
+
*/
|
|
597
|
+
export interface IAiImageGenerationOptions {
|
|
598
|
+
/**
|
|
599
|
+
* Image dimensions for OpenAI models (mapped to `size` field).
|
|
600
|
+
* For xAI aspect ratio or Imagen aspect ratio, use the corresponding `models` family block.
|
|
601
|
+
*/
|
|
602
|
+
readonly size?: AiImageSize;
|
|
603
|
+
/** Number of images. Default 1. Some models enforce a maximum. */
|
|
604
|
+
readonly count?: number;
|
|
605
|
+
/**
|
|
606
|
+
* Quality tier. Accepted values differ per model:
|
|
607
|
+
* - dall-e-3: 'standard' | 'hd'
|
|
608
|
+
* - gpt-image-1: 'low' | 'medium' | 'high' | 'auto'
|
|
609
|
+
* Other models ignore this field.
|
|
610
|
+
*/
|
|
611
|
+
readonly quality?: AiImageQuality;
|
|
612
|
+
/** Reproducibility seed, where supported. */
|
|
613
|
+
readonly seed?: number;
|
|
614
|
+
/**
|
|
615
|
+
* Optional precision via model-family-scoped blocks. The resolver picks
|
|
616
|
+
* applicable blocks dynamically based on the resolved model.
|
|
617
|
+
*/
|
|
618
|
+
readonly models?: ReadonlyArray<IModelFamilyConfig>;
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Parameters for an image-generation request.
|
|
622
|
+
* @public
|
|
623
|
+
*/
|
|
624
|
+
export interface IAiImageGenerationParams {
|
|
625
|
+
/** The text prompt describing the desired image. */
|
|
626
|
+
readonly prompt: string;
|
|
627
|
+
/** Optional generation options. */
|
|
628
|
+
readonly options?: IAiImageGenerationOptions;
|
|
629
|
+
/**
|
|
630
|
+
* Optional reference images. When present, the provider will use them as
|
|
631
|
+
* visual context (e.g. to preserve a character's appearance across multiple
|
|
632
|
+
* generations). The dispatcher resolves the
|
|
633
|
+
* {@link AiAssist.IAiImageModelCapability} for the requested model and
|
|
634
|
+
* rejects the call up front if `acceptsImageReferenceInput` is not set on
|
|
635
|
+
* the matching capability. An empty array is treated identically to
|
|
636
|
+
* `undefined`.
|
|
637
|
+
*/
|
|
638
|
+
readonly referenceImages?: ReadonlyArray<IAiImageAttachment>;
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* A single generated image.
|
|
642
|
+
* @public
|
|
643
|
+
*/
|
|
644
|
+
export interface IAiGeneratedImage extends IAiImageData {
|
|
645
|
+
/**
|
|
646
|
+
* The prompt as rewritten by the provider, if any. OpenAI's image models
|
|
647
|
+
* commonly rewrite prompts; other providers do not.
|
|
648
|
+
*/
|
|
649
|
+
readonly revisedPrompt?: string;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Capability vocabulary used to describe what a model can do. Used as both
|
|
653
|
+
* a filter and as a tag in {@link AiAssist.IAiModelInfo.capabilities}.
|
|
654
|
+
*
|
|
655
|
+
* @remarks
|
|
656
|
+
* Adding a new capability is cheap; adding the *first* one after consumers
|
|
657
|
+
* already exist forces churn. The initial vocabulary is intentionally broad
|
|
658
|
+
* even though only `image-generation` is fully exercised today.
|
|
659
|
+
*
|
|
660
|
+
* @public
|
|
661
|
+
*/
|
|
662
|
+
export type AiModelCapability = 'chat' | 'tools' | 'vision' | 'image-generation' | 'thinking';
|
|
663
|
+
/**
|
|
664
|
+
* Information about a single model returned by a provider's list endpoint,
|
|
665
|
+
* with capabilities already resolved (native + config rules).
|
|
666
|
+
* @public
|
|
667
|
+
*/
|
|
668
|
+
export interface IAiModelInfo {
|
|
669
|
+
/** Provider-native model identifier. */
|
|
670
|
+
readonly id: string;
|
|
671
|
+
/** Resolved capability set — union of native declarations and config rules. */
|
|
672
|
+
readonly capabilities: ReadonlySet<AiModelCapability>;
|
|
673
|
+
/** Friendly name for display, when known. */
|
|
674
|
+
readonly displayName?: string;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* One rule in an {@link IAiModelCapabilityConfig}. Multiple rules can match
|
|
678
|
+
* a single model — their capability arrays are unioned.
|
|
679
|
+
* @public
|
|
680
|
+
*/
|
|
681
|
+
export interface IAiModelCapabilityRule {
|
|
682
|
+
/** RegExp tested against the model id (using `.test`). */
|
|
683
|
+
readonly idPattern: RegExp;
|
|
684
|
+
/** Capabilities this rule attributes to matching models. */
|
|
685
|
+
readonly capabilities: ReadonlyArray<AiModelCapability>;
|
|
686
|
+
/**
|
|
687
|
+
* Friendly display-name override for matching models. The function form
|
|
688
|
+
* lets one rule format many ids (e.g. `(id) => id.toUpperCase()`).
|
|
689
|
+
* If multiple matching rules supply `displayName`, the first match wins.
|
|
690
|
+
*/
|
|
691
|
+
readonly displayName?: string | ((id: string) => string);
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* Configuration that maps model id patterns to capabilities. Used to
|
|
695
|
+
* augment (or, where the provider supplies no capability info, fully
|
|
696
|
+
* derive) the capability set for each listed model.
|
|
697
|
+
* @public
|
|
698
|
+
*/
|
|
699
|
+
export interface IAiModelCapabilityConfig {
|
|
700
|
+
/** Per-provider rules. Tried before {@link AiAssist.IAiModelCapabilityConfig.global}. */
|
|
701
|
+
readonly perProvider?: {
|
|
702
|
+
readonly [P in AiProviderId]?: ReadonlyArray<IAiModelCapabilityRule>;
|
|
703
|
+
};
|
|
704
|
+
/** Cross-provider fallback rules. */
|
|
705
|
+
readonly global?: ReadonlyArray<IAiModelCapabilityRule>;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Result of an image-generation call.
|
|
709
|
+
* @public
|
|
710
|
+
*/
|
|
711
|
+
export interface IAiImageGenerationResponse {
|
|
712
|
+
/** The generated images, in provider-returned order. */
|
|
713
|
+
readonly images: ReadonlyArray<IAiGeneratedImage>;
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Model IDs for Anthropic thinking-capable models.
|
|
717
|
+
* @public
|
|
718
|
+
*/
|
|
719
|
+
export type AnthropicThinkingModelNames = 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7';
|
|
720
|
+
/**
|
|
721
|
+
* Model IDs for OpenAI thinking-capable models.
|
|
722
|
+
* @public
|
|
723
|
+
*/
|
|
724
|
+
export 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';
|
|
725
|
+
/**
|
|
726
|
+
* Model IDs for Google Gemini thinking-capable models.
|
|
727
|
+
* @public
|
|
728
|
+
*/
|
|
729
|
+
export type GeminiThinkingModelNames = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite';
|
|
730
|
+
/**
|
|
731
|
+
* Model IDs for xAI thinking-capable models.
|
|
732
|
+
* @public
|
|
733
|
+
*/
|
|
734
|
+
export type XAiThinkingModelNames = 'grok-3-mini' | 'grok-4.3' | 'grok-4';
|
|
735
|
+
/**
|
|
736
|
+
* Anthropic-specific thinking configuration.
|
|
737
|
+
* @public
|
|
738
|
+
*/
|
|
739
|
+
export interface IAnthropicThinkingConfig {
|
|
740
|
+
/**
|
|
741
|
+
* Anthropic effort level. Maps 1:1 to `output_config.effort` on the wire.
|
|
742
|
+
* - 'low' | 'medium' | 'high': all thinking-capable models
|
|
743
|
+
* - 'max': Opus 4.6 only
|
|
744
|
+
*/
|
|
745
|
+
readonly effort?: 'low' | 'medium' | 'high' | 'max';
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* OpenAI-specific thinking configuration.
|
|
749
|
+
* @remarks
|
|
750
|
+
* Maps to `reasoning_effort` (Chat Completions path) or `reasoning.effort`
|
|
751
|
+
* (Responses API path) on the wire. The adapter selects the correct field.
|
|
752
|
+
* @public
|
|
753
|
+
*/
|
|
754
|
+
export interface IOpenAiThinkingConfig {
|
|
755
|
+
/**
|
|
756
|
+
* OpenAI reasoning effort. Maps 1:1 to the wire field.
|
|
757
|
+
* - 'none': disables reasoning (gpt-5.x only; rejected by o-series)
|
|
758
|
+
* - 'minimal': fastest (gpt-5.x)
|
|
759
|
+
* - 'low' | 'medium' | 'high': standard tiers
|
|
760
|
+
* - 'xhigh': highest (select gpt-5.x models only)
|
|
761
|
+
*
|
|
762
|
+
* @remarks
|
|
763
|
+
* When effective effort is 'none', reasoning is disabled and temperature is
|
|
764
|
+
* accepted by gpt-5.x models. This is the only case where temperature and
|
|
765
|
+
* thinking config co-exist without a Result.fail.
|
|
766
|
+
*/
|
|
767
|
+
readonly effort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Google Gemini-specific thinking configuration.
|
|
771
|
+
* @public
|
|
772
|
+
*/
|
|
773
|
+
export interface IGeminiThinkingConfig {
|
|
774
|
+
/**
|
|
775
|
+
* Token budget for thinking. Maps 1:1 to `thinkingBudget` on the wire.
|
|
776
|
+
* - 0: disable thinking (Flash and Flash-Lite only; error on Pro)
|
|
777
|
+
* - positive integer: soft token cap
|
|
778
|
+
* - -1: dynamic
|
|
779
|
+
* - omitted: model default
|
|
780
|
+
*/
|
|
781
|
+
readonly thinkingBudget?: number;
|
|
782
|
+
/**
|
|
783
|
+
* Whether to include thought summaries in the response.
|
|
784
|
+
* @remarks
|
|
785
|
+
* INERT in phase B. Adapters never send `includeThoughts: true`.
|
|
786
|
+
* Wired up by the followup stream `ai-assist-thinking-events`.
|
|
787
|
+
*/
|
|
788
|
+
readonly includeThoughts?: boolean;
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* xAI-specific thinking configuration.
|
|
792
|
+
* @public
|
|
793
|
+
*/
|
|
794
|
+
export interface IXAiThinkingConfig {
|
|
795
|
+
/**
|
|
796
|
+
* xAI reasoning effort. Maps 1:1 to `reasoning_effort` on the wire.
|
|
797
|
+
* For grok-4, the adapter omits this field (grok-4 always reasons and
|
|
798
|
+
* rejects the parameter).
|
|
799
|
+
*/
|
|
800
|
+
readonly effort?: 'none' | 'low' | 'medium' | 'high';
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Anthropic-specific thinking options block.
|
|
804
|
+
* @public
|
|
805
|
+
*/
|
|
806
|
+
export interface IAnthropicThinkingOptions {
|
|
807
|
+
readonly provider: 'anthropic';
|
|
808
|
+
readonly models?: ReadonlyArray<AnthropicThinkingModelNames>;
|
|
809
|
+
readonly config: IAnthropicThinkingConfig;
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* OpenAI-specific thinking options block.
|
|
813
|
+
* @public
|
|
814
|
+
*/
|
|
815
|
+
export interface IOpenAiThinkingOptions {
|
|
816
|
+
readonly provider: 'openai';
|
|
817
|
+
readonly models?: ReadonlyArray<OpenAiThinkingModelNames>;
|
|
818
|
+
readonly config: IOpenAiThinkingConfig;
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Google Gemini-specific thinking options block.
|
|
822
|
+
* @public
|
|
823
|
+
*/
|
|
824
|
+
export interface IGeminiThinkingOptions {
|
|
825
|
+
readonly provider: 'google';
|
|
826
|
+
readonly models?: ReadonlyArray<GeminiThinkingModelNames>;
|
|
827
|
+
readonly config: IGeminiThinkingConfig;
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* xAI-specific thinking options block.
|
|
831
|
+
* @public
|
|
832
|
+
*/
|
|
833
|
+
export interface IXAiThinkingOptions {
|
|
834
|
+
readonly provider: 'xai';
|
|
835
|
+
readonly models?: ReadonlyArray<XAiThinkingModelNames>;
|
|
836
|
+
readonly config: IXAiThinkingConfig;
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Escape-hatch options block for providers not covered by typed configs.
|
|
840
|
+
* @remarks
|
|
841
|
+
* `models` is required — no implicit "all" for unknown providers.
|
|
842
|
+
* `config` fields are merged verbatim into the wire request.
|
|
843
|
+
* @public
|
|
844
|
+
*/
|
|
845
|
+
export interface IOtherThinkingOptions {
|
|
846
|
+
readonly provider: 'other';
|
|
847
|
+
readonly models: ReadonlyArray<string>;
|
|
848
|
+
readonly config: JsonObject;
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Discriminated union of per-provider thinking config blocks.
|
|
852
|
+
* @public
|
|
853
|
+
*/
|
|
854
|
+
export type IThinkingProviderConfig = IAnthropicThinkingOptions | IOpenAiThinkingOptions | IGeminiThinkingOptions | IXAiThinkingOptions | IOtherThinkingOptions;
|
|
855
|
+
/**
|
|
856
|
+
* Thinking/reasoning mode configuration for a completion request.
|
|
857
|
+
*
|
|
858
|
+
* @remarks
|
|
859
|
+
* The generic `effort` field covers the common-subset cross-provider vocabulary.
|
|
860
|
+
* For provider-specific precision (Anthropic 'max', OpenAI 'xhigh', Gemini token
|
|
861
|
+
* budgets, xAI effort-level tuning), use the `providers` array.
|
|
862
|
+
*
|
|
863
|
+
* Absence (or undefined) means "no thinking mode" — existing callers are unaffected.
|
|
864
|
+
*
|
|
865
|
+
* @public
|
|
866
|
+
*/
|
|
867
|
+
export interface IThinkingConfig {
|
|
868
|
+
/**
|
|
869
|
+
* Cross-provider effort level. Common-subset mapping:
|
|
870
|
+
* - 'low': Anthropic effort:low | OpenAI effort:low | Gemini thinkingBudget:1024 | xAI reasoning_effort:low
|
|
871
|
+
* - 'medium': effort:medium | effort:medium | thinkingBudget:4096 | reasoning_effort:medium
|
|
872
|
+
* - 'high': effort:high | effort:high | thinkingBudget:8192 | reasoning_effort:high
|
|
873
|
+
*/
|
|
874
|
+
readonly effort?: 'low' | 'medium' | 'high';
|
|
875
|
+
/**
|
|
876
|
+
* Optional per-provider precision blocks. Blocks for providers that don't
|
|
877
|
+
* match the resolved model's provider are silently skipped.
|
|
878
|
+
*/
|
|
879
|
+
readonly providers?: ReadonlyArray<IThinkingProviderConfig>;
|
|
175
880
|
}
|
|
176
881
|
/**
|
|
177
882
|
* Configuration for a single AI assist provider.
|
|
@@ -186,6 +891,14 @@ export interface IAiAssistProviderConfig {
|
|
|
186
891
|
readonly model?: ModelSpec;
|
|
187
892
|
/** Tool enablement/configuration. Tools are disabled unless explicitly enabled. */
|
|
188
893
|
readonly tools?: ReadonlyArray<IAiToolEnablement>;
|
|
894
|
+
/**
|
|
895
|
+
* Optional caller-supplied endpoint URL (http/https). Overrides
|
|
896
|
+
* `descriptor.baseUrl` for this provider. Used to point a provider at a
|
|
897
|
+
* self-hosted server (Ollama, LM Studio, llama.cpp's openai-server) or a
|
|
898
|
+
* local proxy. Validation lives in `@fgv/ts-extras` — query strings,
|
|
899
|
+
* fragments, and userinfo are rejected.
|
|
900
|
+
*/
|
|
901
|
+
readonly endpoint?: string;
|
|
189
902
|
}
|
|
190
903
|
/**
|
|
191
904
|
* AI assist settings — which providers are enabled and their configuration.
|