@radheim/ai 0.0.0-stage → 2.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1890 -3
- package/dist/ai.d.ts +36 -0
- package/dist/ai.js +46 -0
- package/dist/cache-policy.d.ts +6 -0
- package/dist/cache-policy.js +205 -0
- package/dist/decision-client.d.ts +10 -0
- package/dist/decision-client.js +42 -0
- package/dist/decision.d.ts +378 -0
- package/dist/decision.js +171 -0
- package/dist/effect.d.ts +59 -0
- package/dist/effect.js +33 -0
- package/dist/effort-updates.d.ts +12 -0
- package/dist/effort-updates.js +23 -0
- package/dist/embedding-client.d.ts +10 -0
- package/dist/embedding-client.js +17 -0
- package/dist/embedding.d.ts +113 -0
- package/dist/embedding.js +76 -0
- package/dist/experimental/cloudflare-run-extraction.d.ts +17 -0
- package/dist/experimental/cloudflare-run-extraction.js +85 -0
- package/dist/experimental/extraction.d.ts +153 -0
- package/dist/experimental/extraction.js +103 -0
- package/dist/experimental/realtime.d.ts +80 -0
- package/dist/experimental/realtime.js +96 -0
- package/dist/experimental.d.ts +10 -0
- package/dist/experimental.js +6 -0
- package/dist/fetch-middleware.d.ts +7 -0
- package/dist/fetch-middleware.js +41 -0
- package/dist/generation.d.ts +77 -0
- package/dist/generation.js +109 -0
- package/dist/image-client.d.ts +14 -0
- package/dist/image-client.js +39 -0
- package/dist/image.d.ts +323 -0
- package/dist/image.js +103 -0
- package/dist/index.d.ts +300 -0
- package/dist/index.js +179 -0
- package/dist/llm.d.ts +109 -0
- package/dist/llm.js +177 -0
- package/dist/loop.d.ts +38 -0
- package/dist/loop.js +139 -0
- package/dist/media-client.d.ts +30 -0
- package/dist/media-client.js +44 -0
- package/dist/media-model.d.ts +49 -0
- package/dist/media-model.js +55 -0
- package/dist/media.d.ts +237 -0
- package/dist/media.js +285 -0
- package/dist/promise-media.d.ts +20 -0
- package/dist/promise-media.js +16 -0
- package/dist/protocols/alibaba-chat.d.ts +315 -0
- package/dist/protocols/alibaba-chat.js +78 -0
- package/dist/protocols/alibaba-images.d.ts +22 -0
- package/dist/protocols/alibaba-images.js +77 -0
- package/dist/protocols/alibaba-messages.d.ts +413 -0
- package/dist/protocols/alibaba-messages.js +44 -0
- package/dist/protocols/alibaba-responses.d.ts +298 -0
- package/dist/protocols/alibaba-responses.js +67 -0
- package/dist/protocols/anthropic-messages.d.ts +1213 -0
- package/dist/protocols/anthropic-messages.js +1412 -0
- package/dist/protocols/assemblyai-transcription.d.ts +41 -0
- package/dist/protocols/assemblyai-transcription.js +137 -0
- package/dist/protocols/bedrock-converse.d.ts +548 -0
- package/dist/protocols/bedrock-converse.js +801 -0
- package/dist/protocols/bedrock-event-stream.d.ts +14 -0
- package/dist/protocols/bedrock-event-stream.js +100 -0
- package/dist/protocols/cartesia-speech.d.ts +117 -0
- package/dist/protocols/cartesia-speech.js +120 -0
- package/dist/protocols/cloudflare-run-decisions.d.ts +9 -0
- package/dist/protocols/cloudflare-run-decisions.js +36 -0
- package/dist/protocols/cloudflare-workers-ai-images.d.ts +23 -0
- package/dist/protocols/cloudflare-workers-ai-images.js +80 -0
- package/dist/protocols/cohere-chat.d.ts +184 -0
- package/dist/protocols/cohere-chat.js +317 -0
- package/dist/protocols/deepgram-speech.d.ts +109 -0
- package/dist/protocols/deepgram-speech.js +93 -0
- package/dist/protocols/deepgram-transcription.d.ts +26 -0
- package/dist/protocols/deepgram-transcription.js +119 -0
- package/dist/protocols/elevenlabs-speech.d.ts +112 -0
- package/dist/protocols/elevenlabs-speech.js +111 -0
- package/dist/protocols/elevenlabs-transcription.d.ts +28 -0
- package/dist/protocols/elevenlabs-transcription.js +137 -0
- package/dist/protocols/gemini.d.ts +388 -0
- package/dist/protocols/gemini.js +741 -0
- package/dist/protocols/google-decisions.d.ts +13 -0
- package/dist/protocols/google-decisions.js +133 -0
- package/dist/protocols/google-embed-content.d.ts +34 -0
- package/dist/protocols/google-embed-content.js +110 -0
- package/dist/protocols/google-images.d.ts +18 -0
- package/dist/protocols/google-images.js +169 -0
- package/dist/protocols/google-interactions-video.d.ts +38 -0
- package/dist/protocols/google-interactions-video.js +185 -0
- package/dist/protocols/google-interactions.d.ts +554 -0
- package/dist/protocols/google-interactions.js +756 -0
- package/dist/protocols/google-speech.d.ts +120 -0
- package/dist/protocols/google-speech.js +94 -0
- package/dist/protocols/google-transcription.d.ts +148 -0
- package/dist/protocols/google-transcription.js +129 -0
- package/dist/protocols/google-vertex-predict-embeddings.d.ts +18 -0
- package/dist/protocols/google-vertex-predict-embeddings.js +74 -0
- package/dist/protocols/index.d.ts +21 -0
- package/dist/protocols/index.js +21 -0
- package/dist/protocols/meta-images.d.ts +26 -0
- package/dist/protocols/meta-images.js +101 -0
- package/dist/protocols/meta-messages.d.ts +423 -0
- package/dist/protocols/meta-messages.js +63 -0
- package/dist/protocols/meta-responses.d.ts +533 -0
- package/dist/protocols/meta-responses.js +189 -0
- package/dist/protocols/minimax-images.d.ts +25 -0
- package/dist/protocols/minimax-images.js +150 -0
- package/dist/protocols/minimax-video.d.ts +45 -0
- package/dist/protocols/minimax-video.js +296 -0
- package/dist/protocols/mistral-chat.d.ts +565 -0
- package/dist/protocols/mistral-chat.js +606 -0
- package/dist/protocols/open-responses-channel.d.ts +25 -0
- package/dist/protocols/open-responses-channel.js +137 -0
- package/dist/protocols/open-responses-continuation.d.ts +18 -0
- package/dist/protocols/open-responses-continuation.js +172 -0
- package/dist/protocols/open-responses.d.ts +2509 -0
- package/dist/protocols/open-responses.js +1335 -0
- package/dist/protocols/openai-chat.d.ts +2571 -0
- package/dist/protocols/openai-chat.js +1140 -0
- package/dist/protocols/openai-compatible-chat.d.ts +184 -0
- package/dist/protocols/openai-compatible-chat.js +19 -0
- package/dist/protocols/openai-compatible-responses.d.ts +231 -0
- package/dist/protocols/openai-compatible-responses.js +18 -0
- package/dist/protocols/openai-decisions.d.ts +22 -0
- package/dist/protocols/openai-decisions.js +141 -0
- package/dist/protocols/openai-embeddings.d.ts +16 -0
- package/dist/protocols/openai-embeddings.js +76 -0
- package/dist/protocols/openai-freeform.d.ts +78 -0
- package/dist/protocols/openai-freeform.js +222 -0
- package/dist/protocols/openai-images.d.ts +148 -0
- package/dist/protocols/openai-images.js +303 -0
- package/dist/protocols/openai-responses.d.ts +1600 -0
- package/dist/protocols/openai-responses.js +360 -0
- package/dist/protocols/openai-speech.d.ts +110 -0
- package/dist/protocols/openai-speech.js +112 -0
- package/dist/protocols/openai-transcription.d.ts +185 -0
- package/dist/protocols/openai-transcription.js +206 -0
- package/dist/protocols/openrouter-video.d.ts +36 -0
- package/dist/protocols/openrouter-video.js +139 -0
- package/dist/protocols/seedance-video.d.ts +45 -0
- package/dist/protocols/seedance-video.js +217 -0
- package/dist/protocols/shared.d.ts +249 -0
- package/dist/protocols/shared.js +446 -0
- package/dist/protocols/system-one.d.ts +145 -0
- package/dist/protocols/system-one.js +272 -0
- package/dist/protocols/utils/bedrock-auth.d.ts +60 -0
- package/dist/protocols/utils/bedrock-auth.js +86 -0
- package/dist/protocols/utils/bedrock-cache.d.ts +19 -0
- package/dist/protocols/utils/bedrock-cache.js +49 -0
- package/dist/protocols/utils/bedrock-media.d.ts +53 -0
- package/dist/protocols/utils/bedrock-media.js +98 -0
- package/dist/protocols/utils/cache.d.ts +25 -0
- package/dist/protocols/utils/cache.js +33 -0
- package/dist/protocols/utils/claude-model.d.ts +8 -0
- package/dist/protocols/utils/claude-model.js +15 -0
- package/dist/protocols/utils/gateway-protocol.d.ts +17 -0
- package/dist/protocols/utils/gateway-protocol.js +59 -0
- package/dist/protocols/utils/gemini-generate-content.d.ts +75 -0
- package/dist/protocols/utils/gemini-generate-content.js +96 -0
- package/dist/protocols/utils/gemini-json-schema.d.ts +8 -0
- package/dist/protocols/utils/gemini-json-schema.js +76 -0
- package/dist/protocols/utils/image-sizing.d.ts +31 -0
- package/dist/protocols/utils/image-sizing.js +73 -0
- package/dist/protocols/utils/lifecycle.d.ts +24 -0
- package/dist/protocols/utils/lifecycle.js +62 -0
- package/dist/protocols/utils/media-input.d.ts +32 -0
- package/dist/protocols/utils/media-input.js +62 -0
- package/dist/protocols/utils/mistral-tool-id.d.ts +5 -0
- package/dist/protocols/utils/mistral-tool-id.js +31 -0
- package/dist/protocols/utils/open-responses-options.d.ts +54 -0
- package/dist/protocols/utils/open-responses-options.js +59 -0
- package/dist/protocols/utils/partial-json-options.d.ts +61 -0
- package/dist/protocols/utils/partial-json-options.js +51 -0
- package/dist/protocols/utils/partial-json.d.ts +8 -0
- package/dist/protocols/utils/partial-json.js +280 -0
- package/dist/protocols/utils/responses-checkpoint.d.ts +4 -0
- package/dist/protocols/utils/responses-checkpoint.js +103 -0
- package/dist/protocols/utils/responses-compaction.d.ts +6 -0
- package/dist/protocols/utils/responses-compaction.js +162 -0
- package/dist/protocols/utils/responses-hosted-tools.d.ts +122 -0
- package/dist/protocols/utils/responses-hosted-tools.js +63 -0
- package/dist/protocols/utils/speaker-turns.d.ts +3 -0
- package/dist/protocols/utils/speaker-turns.js +9 -0
- package/dist/protocols/utils/speech-stream.d.ts +49 -0
- package/dist/protocols/utils/speech-stream.js +64 -0
- package/dist/protocols/utils/tool-schema.d.ts +10 -0
- package/dist/protocols/utils/tool-schema.js +109 -0
- package/dist/protocols/utils/tool-stream.d.ts +478 -0
- package/dist/protocols/utils/tool-stream.js +153 -0
- package/dist/protocols/venice-chat.d.ts +340 -0
- package/dist/protocols/venice-chat.js +283 -0
- package/dist/protocols/xai-images.d.ts +25 -0
- package/dist/protocols/xai-images.js +87 -0
- package/dist/protocols/xai-responses.d.ts +294 -0
- package/dist/protocols/xai-responses.js +86 -0
- package/dist/protocols/xai-video.d.ts +35 -0
- package/dist/protocols/xai-video.js +159 -0
- package/dist/protocols/zai-chat.d.ts +296 -0
- package/dist/protocols/zai-chat.js +56 -0
- package/dist/protocols/zai-images.d.ts +20 -0
- package/dist/protocols/zai-images.js +79 -0
- package/dist/protocols/zai-messages.d.ts +409 -0
- package/dist/protocols/zai-messages.js +30 -0
- package/dist/protocols.d.ts +1 -0
- package/dist/protocols.js +1 -0
- package/dist/provider-error.d.ts +22 -0
- package/dist/provider-error.js +228 -0
- package/dist/provider-package.d.ts +17 -0
- package/dist/provider-package.js +1 -0
- package/dist/providers/alibaba/chat.d.ts +1 -0
- package/dist/providers/alibaba/chat.js +1 -0
- package/dist/providers/alibaba/embeddings.d.ts +2 -0
- package/dist/providers/alibaba/embeddings.js +1 -0
- package/dist/providers/alibaba/images.d.ts +2 -0
- package/dist/providers/alibaba/images.js +1 -0
- package/dist/providers/alibaba/messages.d.ts +3 -0
- package/dist/providers/alibaba/messages.js +1 -0
- package/dist/providers/alibaba/responses.d.ts +3 -0
- package/dist/providers/alibaba/responses.js +1 -0
- package/dist/providers/alibaba.d.ts +905 -0
- package/dist/providers/alibaba.js +119 -0
- package/dist/providers/amazon-bedrock/mantle/chat.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle/chat.js +1 -0
- package/dist/providers/amazon-bedrock/mantle/messages.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle/messages.js +1 -0
- package/dist/providers/amazon-bedrock/mantle/responses.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle/responses.js +1 -0
- package/dist/providers/amazon-bedrock/mantle.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle.js +1 -0
- package/dist/providers/amazon-bedrock-mantle.d.ts +789 -0
- package/dist/providers/amazon-bedrock-mantle.js +107 -0
- package/dist/providers/amazon-bedrock.d.ts +190 -0
- package/dist/providers/amazon-bedrock.js +44 -0
- package/dist/providers/anthropic-compatible.d.ts +364 -0
- package/dist/providers/anthropic-compatible.js +47 -0
- package/dist/providers/anthropic.d.ts +362 -0
- package/dist/providers/anthropic.js +36 -0
- package/dist/providers/assemblyai.d.ts +19 -0
- package/dist/providers/assemblyai.js +19 -0
- package/dist/providers/azure/chat.d.ts +2 -0
- package/dist/providers/azure/chat.js +1 -0
- package/dist/providers/azure/embeddings.d.ts +2 -0
- package/dist/providers/azure/embeddings.js +1 -0
- package/dist/providers/azure/images.d.ts +2 -0
- package/dist/providers/azure/images.js +1 -0
- package/dist/providers/azure/messages.d.ts +2 -0
- package/dist/providers/azure/messages.js +1 -0
- package/dist/providers/azure/responses.d.ts +2 -0
- package/dist/providers/azure/responses.js +1 -0
- package/dist/providers/azure.d.ts +1074 -0
- package/dist/providers/azure.js +150 -0
- package/dist/providers/baseten/decisions.d.ts +2 -0
- package/dist/providers/baseten/decisions.js +1 -0
- package/dist/providers/baseten.d.ts +384 -0
- package/dist/providers/baseten.js +56 -0
- package/dist/providers/byteplus/videos.d.ts +2 -0
- package/dist/providers/byteplus/videos.js +1 -0
- package/dist/providers/byteplus.d.ts +24 -0
- package/dist/providers/byteplus.js +21 -0
- package/dist/providers/cartesia.d.ts +18 -0
- package/dist/providers/cartesia.js +17 -0
- package/dist/providers/cerebras.d.ts +375 -0
- package/dist/providers/cerebras.js +33 -0
- package/dist/providers/cloudflare-ai-gateway/decisions.d.ts +2 -0
- package/dist/providers/cloudflare-ai-gateway/decisions.js +1 -0
- package/dist/providers/cloudflare-ai-gateway.d.ts +1581 -0
- package/dist/providers/cloudflare-ai-gateway.js +120 -0
- package/dist/providers/cloudflare-shared.d.ts +9 -0
- package/dist/providers/cloudflare-shared.js +25 -0
- package/dist/providers/cloudflare-workers-ai/decisions.d.ts +2 -0
- package/dist/providers/cloudflare-workers-ai/decisions.js +1 -0
- package/dist/providers/cloudflare-workers-ai/images.d.ts +2 -0
- package/dist/providers/cloudflare-workers-ai/images.js +1 -0
- package/dist/providers/cloudflare-workers-ai.d.ts +391 -0
- package/dist/providers/cloudflare-workers-ai.js +69 -0
- package/dist/providers/cohere/chat.d.ts +4 -0
- package/dist/providers/cohere/chat.js +3 -0
- package/dist/providers/cohere/embeddings.d.ts +2 -0
- package/dist/providers/cohere/embeddings.js +1 -0
- package/dist/providers/cohere.d.ts +502 -0
- package/dist/providers/cohere.js +55 -0
- package/dist/providers/deepgram.d.ts +22 -0
- package/dist/providers/deepgram.js +20 -0
- package/dist/providers/deepinfra/embeddings.d.ts +2 -0
- package/dist/providers/deepinfra/embeddings.js +1 -0
- package/dist/providers/deepinfra.d.ts +378 -0
- package/dist/providers/deepinfra.js +52 -0
- package/dist/providers/deepseek.d.ts +376 -0
- package/dist/providers/deepseek.js +30 -0
- package/dist/providers/digitalocean/decisions.d.ts +2 -0
- package/dist/providers/digitalocean/decisions.js +1 -0
- package/dist/providers/digitalocean/embeddings.d.ts +2 -0
- package/dist/providers/digitalocean/embeddings.js +1 -0
- package/dist/providers/digitalocean/images.d.ts +2 -0
- package/dist/providers/digitalocean/images.js +1 -0
- package/dist/providers/digitalocean/responses.d.ts +4 -0
- package/dist/providers/digitalocean/responses.js +1 -0
- package/dist/providers/digitalocean.d.ts +874 -0
- package/dist/providers/digitalocean.js +106 -0
- package/dist/providers/elevenlabs.d.ts +22 -0
- package/dist/providers/elevenlabs.js +22 -0
- package/dist/providers/fireworks/embeddings.d.ts +2 -0
- package/dist/providers/fireworks/embeddings.js +1 -0
- package/dist/providers/fireworks.d.ts +379 -0
- package/dist/providers/fireworks.js +40 -0
- package/dist/providers/google/decisions.d.ts +2 -0
- package/dist/providers/google/decisions.js +1 -0
- package/dist/providers/google/embeddings.d.ts +2 -0
- package/dist/providers/google/embeddings.js +1 -0
- package/dist/providers/google/images.d.ts +2 -0
- package/dist/providers/google/images.js +1 -0
- package/dist/providers/google/interactions.d.ts +7 -0
- package/dist/providers/google/interactions.js +3 -0
- package/dist/providers/google/videos.d.ts +2 -0
- package/dist/providers/google/videos.js +1 -0
- package/dist/providers/google-vertex/chat.d.ts +2 -0
- package/dist/providers/google-vertex/chat.js +1 -0
- package/dist/providers/google-vertex/embeddings.d.ts +2 -0
- package/dist/providers/google-vertex/embeddings.js +1 -0
- package/dist/providers/google-vertex/gemini.d.ts +2 -0
- package/dist/providers/google-vertex/gemini.js +1 -0
- package/dist/providers/google-vertex/images.d.ts +2 -0
- package/dist/providers/google-vertex/images.js +1 -0
- package/dist/providers/google-vertex/interactions.d.ts +2 -0
- package/dist/providers/google-vertex/interactions.js +1 -0
- package/dist/providers/google-vertex/messages.d.ts +2 -0
- package/dist/providers/google-vertex/messages.js +1 -0
- package/dist/providers/google-vertex/mistral.d.ts +2 -0
- package/dist/providers/google-vertex/mistral.js +1 -0
- package/dist/providers/google-vertex/responses.d.ts +2 -0
- package/dist/providers/google-vertex/responses.js +1 -0
- package/dist/providers/google-vertex-chat.d.ts +204 -0
- package/dist/providers/google-vertex-chat.js +29 -0
- package/dist/providers/google-vertex-interactions.d.ts +111 -0
- package/dist/providers/google-vertex-interactions.js +62 -0
- package/dist/providers/google-vertex-messages.d.ts +362 -0
- package/dist/providers/google-vertex-messages.js +51 -0
- package/dist/providers/google-vertex-mistral.d.ts +120 -0
- package/dist/providers/google-vertex-mistral.js +43 -0
- package/dist/providers/google-vertex-responses.d.ts +253 -0
- package/dist/providers/google-vertex-responses.js +30 -0
- package/dist/providers/google-vertex-shared.d.ts +58 -0
- package/dist/providers/google-vertex-shared.js +128 -0
- package/dist/providers/google-vertex.d.ts +132 -0
- package/dist/providers/google-vertex.js +161 -0
- package/dist/providers/google.d.ts +246 -0
- package/dist/providers/google.js +80 -0
- package/dist/providers/groq.d.ts +470 -0
- package/dist/providers/groq.js +63 -0
- package/dist/providers/index.d.ts +45 -0
- package/dist/providers/index.js +45 -0
- package/dist/providers/meta/chat.d.ts +2 -0
- package/dist/providers/meta/chat.js +1 -0
- package/dist/providers/meta/images.d.ts +2 -0
- package/dist/providers/meta/images.js +1 -0
- package/dist/providers/meta/messages.d.ts +2 -0
- package/dist/providers/meta/messages.js +1 -0
- package/dist/providers/meta/responses.d.ts +2 -0
- package/dist/providers/meta/responses.js +1 -0
- package/dist/providers/meta.d.ts +804 -0
- package/dist/providers/meta.js +96 -0
- package/dist/providers/minimax/chat.d.ts +4 -0
- package/dist/providers/minimax/chat.js +3 -0
- package/dist/providers/minimax/images.d.ts +3 -0
- package/dist/providers/minimax/images.js +1 -0
- package/dist/providers/minimax/messages.d.ts +1 -0
- package/dist/providers/minimax/messages.js +1 -0
- package/dist/providers/minimax/responses.d.ts +4 -0
- package/dist/providers/minimax/responses.js +3 -0
- package/dist/providers/minimax/videos.d.ts +3 -0
- package/dist/providers/minimax/videos.js +1 -0
- package/dist/providers/minimax.d.ts +798 -0
- package/dist/providers/minimax.js +99 -0
- package/dist/providers/mistral.d.ts +208 -0
- package/dist/providers/mistral.js +17 -0
- package/dist/providers/moonshot/chat.d.ts +1 -0
- package/dist/providers/moonshot/chat.js +1 -0
- package/dist/providers/moonshot/messages.d.ts +4 -0
- package/dist/providers/moonshot/messages.js +3 -0
- package/dist/providers/moonshot/responses.d.ts +4 -0
- package/dist/providers/moonshot/responses.js +3 -0
- package/dist/providers/moonshot.d.ts +785 -0
- package/dist/providers/moonshot.js +78 -0
- package/dist/providers/open-responses-options.d.ts +5 -0
- package/dist/providers/open-responses-options.js +1 -0
- package/dist/providers/openai/chat.d.ts +2 -0
- package/dist/providers/openai/chat.js +1 -0
- package/dist/providers/openai/embeddings.d.ts +2 -0
- package/dist/providers/openai/embeddings.js +1 -0
- package/dist/providers/openai/images.d.ts +2 -0
- package/dist/providers/openai/images.js +1 -0
- package/dist/providers/openai/responses.d.ts +2 -0
- package/dist/providers/openai/responses.js +1 -0
- package/dist/providers/openai-compatible/decisions.d.ts +2 -0
- package/dist/providers/openai-compatible/decisions.js +1 -0
- package/dist/providers/openai-compatible/embeddings.d.ts +2 -0
- package/dist/providers/openai-compatible/embeddings.js +1 -0
- package/dist/providers/openai-compatible/images.d.ts +2 -0
- package/dist/providers/openai-compatible/images.js +1 -0
- package/dist/providers/openai-compatible/responses.d.ts +1 -0
- package/dist/providers/openai-compatible/responses.js +1 -0
- package/dist/providers/openai-compatible-responses.d.ts +250 -0
- package/dist/providers/openai-compatible-responses.js +26 -0
- package/dist/providers/openai-compatible.d.ts +208 -0
- package/dist/providers/openai-compatible.js +71 -0
- package/dist/providers/openai-options.d.ts +21 -0
- package/dist/providers/openai-options.js +37 -0
- package/dist/providers/openai.d.ts +522 -0
- package/dist/providers/openai.js +118 -0
- package/dist/providers/opencode/decisions.d.ts +2 -0
- package/dist/providers/opencode/decisions.js +1 -0
- package/dist/providers/opencode.d.ts +23 -0
- package/dist/providers/opencode.js +25 -0
- package/dist/providers/openrouter/decisions.d.ts +2 -0
- package/dist/providers/openrouter/decisions.js +1 -0
- package/dist/providers/openrouter/embeddings.d.ts +2 -0
- package/dist/providers/openrouter/embeddings.js +1 -0
- package/dist/providers/openrouter/images.d.ts +2 -0
- package/dist/providers/openrouter/images.js +1 -0
- package/dist/providers/openrouter/responses.d.ts +3 -0
- package/dist/providers/openrouter/responses.js +1 -0
- package/dist/providers/openrouter/videos.d.ts +2 -0
- package/dist/providers/openrouter/videos.js +1 -0
- package/dist/providers/openrouter.d.ts +1204 -0
- package/dist/providers/openrouter.js +210 -0
- package/dist/providers/settings.d.ts +40 -0
- package/dist/providers/settings.js +18 -0
- package/dist/providers/togetherai.d.ts +375 -0
- package/dist/providers/togetherai.js +30 -0
- package/dist/providers/typesafe-ai/decisions.d.ts +2 -0
- package/dist/providers/typesafe-ai/decisions.js +1 -0
- package/dist/providers/typesafe-ai.d.ts +23 -0
- package/dist/providers/typesafe-ai.js +25 -0
- package/dist/providers/venice/responses.d.ts +4 -0
- package/dist/providers/venice/responses.js +1 -0
- package/dist/providers/venice.d.ts +632 -0
- package/dist/providers/venice.js +57 -0
- package/dist/providers/vercel-ai-gateway/chat.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/chat.js +1 -0
- package/dist/providers/vercel-ai-gateway/decisions.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/decisions.js +1 -0
- package/dist/providers/vercel-ai-gateway/embeddings.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/embeddings.js +1 -0
- package/dist/providers/vercel-ai-gateway/images.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/images.js +1 -0
- package/dist/providers/vercel-ai-gateway/messages.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/messages.js +1 -0
- package/dist/providers/vercel-ai-gateway/responses.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/responses.js +1 -0
- package/dist/providers/vercel-ai-gateway.d.ts +111 -0
- package/dist/providers/vercel-ai-gateway.js +181 -0
- package/dist/providers/volcengine/videos.d.ts +2 -0
- package/dist/providers/volcengine/videos.js +1 -0
- package/dist/providers/volcengine.d.ts +24 -0
- package/dist/providers/volcengine.js +21 -0
- package/dist/providers/xai/images.d.ts +2 -0
- package/dist/providers/xai/images.js +1 -0
- package/dist/providers/xai/videos.d.ts +2 -0
- package/dist/providers/xai/videos.js +1 -0
- package/dist/providers/xai.d.ts +235 -0
- package/dist/providers/xai.js +89 -0
- package/dist/providers/zai/chat.d.ts +1 -0
- package/dist/providers/zai/chat.js +1 -0
- package/dist/providers/zai/images.d.ts +2 -0
- package/dist/providers/zai/images.js +1 -0
- package/dist/providers/zai-coding-plan/chat.d.ts +1 -0
- package/dist/providers/zai-coding-plan/chat.js +1 -0
- package/dist/providers/zai-coding-plan/messages.d.ts +4 -0
- package/dist/providers/zai-coding-plan/messages.js +3 -0
- package/dist/providers/zai-coding-plan/responses.d.ts +4 -0
- package/dist/providers/zai-coding-plan/responses.js +3 -0
- package/dist/providers/zai-coding-plan.d.ts +846 -0
- package/dist/providers/zai-coding-plan.js +56 -0
- package/dist/providers/zai.d.ts +285 -0
- package/dist/providers/zai.js +44 -0
- package/dist/providers.d.ts +1 -0
- package/dist/providers.js +1 -0
- package/dist/public.d.ts +18 -0
- package/dist/public.js +7 -0
- package/dist/route/auth-options.d.ts +35 -0
- package/dist/route/auth-options.js +17 -0
- package/dist/route/auth.d.ts +52 -0
- package/dist/route/auth.js +92 -0
- package/dist/route/client.d.ts +229 -0
- package/dist/route/client.js +293 -0
- package/dist/route/decision.d.ts +55 -0
- package/dist/route/decision.js +73 -0
- package/dist/route/embedding.d.ts +58 -0
- package/dist/route/embedding.js +85 -0
- package/dist/route/endpoint.d.ts +29 -0
- package/dist/route/endpoint.js +21 -0
- package/dist/route/executor-service.d.ts +54 -0
- package/dist/route/executor-service.js +115 -0
- package/dist/route/executor.d.ts +37 -0
- package/dist/route/executor.js +225 -0
- package/dist/route/framing.d.ts +44 -0
- package/dist/route/framing.js +63 -0
- package/dist/route/index.d.ts +21 -0
- package/dist/route/index.js +18 -0
- package/dist/route/media-protocol.d.ts +187 -0
- package/dist/route/media-protocol.js +117 -0
- package/dist/route/media.d.ts +91 -0
- package/dist/route/media.js +251 -0
- package/dist/route/protocol.d.ts +85 -0
- package/dist/route/protocol.js +19 -0
- package/dist/route/transport/http.d.ts +34 -0
- package/dist/route/transport/http.js +67 -0
- package/dist/route/transport/index.d.ts +42 -0
- package/dist/route/transport/index.js +4 -0
- package/dist/route/transport/websocket-channel.d.ts +56 -0
- package/dist/route/transport/websocket-channel.js +1 -0
- package/dist/route/transport/websocket.d.ts +32 -0
- package/dist/route/transport/websocket.js +315 -0
- package/dist/route.d.ts +1 -0
- package/dist/route.js +1 -0
- package/dist/schema/errors.d.ts +194 -0
- package/dist/schema/errors.js +217 -0
- package/dist/schema/events.d.ts +11001 -0
- package/dist/schema/events.js +542 -0
- package/dist/schema/ids.d.ts +17 -0
- package/dist/schema/ids.js +10 -0
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/index.js +5 -0
- package/dist/schema/messages.d.ts +2706 -0
- package/dist/schema/messages.js +344 -0
- package/dist/schema/options.d.ts +270 -0
- package/dist/schema/options.js +198 -0
- package/dist/speech.d.ts +266 -0
- package/dist/speech.js +114 -0
- package/dist/test-ai.d.ts +15 -0
- package/dist/test-ai.js +49 -0
- package/dist/testing.d.ts +1585 -0
- package/dist/testing.js +108 -0
- package/dist/tool-history.d.ts +2 -0
- package/dist/tool-history.js +91 -0
- package/dist/tool-runtime.d.ts +22 -0
- package/dist/tool-runtime.js +55 -0
- package/dist/tool-updates.d.ts +34 -0
- package/dist/tool-updates.js +93 -0
- package/dist/tool.d.ts +150 -0
- package/dist/tool.js +159 -0
- package/dist/transcription.d.ts +254 -0
- package/dist/transcription.js +119 -0
- package/dist/utils/bytes.d.ts +1 -0
- package/dist/utils/bytes.js +10 -0
- package/dist/utils/json.d.ts +4 -0
- package/dist/utils/json.js +4 -0
- package/dist/utils/media-type.d.ts +8 -0
- package/dist/utils/media-type.js +93 -0
- package/dist/utils/provider-codes.d.ts +3 -0
- package/dist/utils/provider-codes.js +41 -0
- package/dist/utils/record.d.ts +2 -0
- package/dist/utils/record.js +2 -0
- package/dist/utils/sanitize.d.ts +5 -0
- package/dist/utils/sanitize.js +31 -0
- package/dist/video-client.d.ts +12 -0
- package/dist/video-client.js +24 -0
- package/dist/video.d.ts +178 -0
- package/dist/video.js +79 -0
- package/package.json +648 -4
|
@@ -0,0 +1,2706 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { Tool } from "@radheim/schema/tool";
|
|
3
|
+
import { type BaseRequest, CacheHint, type CachePolicy, JsonSchema, type LanguageModel, type LanguageModelProviderOptions, ReasoningEffort, type GenerationOptionsFields } from "./options.js";
|
|
4
|
+
import { Media } from "../media.js";
|
|
5
|
+
import { type ToolChangesInput } from "../tool.js";
|
|
6
|
+
export declare const MessageRole: Schema.Literals<readonly ["system", "user", "assistant", "tool"]>;
|
|
7
|
+
export type MessageRole = Schema.Schema.Type<typeof MessageRole>;
|
|
8
|
+
declare const systemPartSchema: Schema.Struct<{
|
|
9
|
+
readonly type: Schema.Literal<"text">;
|
|
10
|
+
readonly text: Schema.String;
|
|
11
|
+
readonly cache: Schema.optional<typeof CacheHint>;
|
|
12
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
13
|
+
}>;
|
|
14
|
+
export type SystemPart = Schema.Schema.Type<typeof systemPartSchema>;
|
|
15
|
+
export declare const SystemPart: Schema.Codec<SystemPart, typeof systemPartSchema.Encoded> & {
|
|
16
|
+
readonly make: (text: string, options?: Omit<SystemPart, "type" | "text">) => SystemPart;
|
|
17
|
+
};
|
|
18
|
+
declare const textPartSchema: Schema.Struct<{
|
|
19
|
+
readonly type: Schema.Literal<"text">;
|
|
20
|
+
readonly text: Schema.String;
|
|
21
|
+
readonly cache: Schema.optional<typeof CacheHint>;
|
|
22
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
23
|
+
}>;
|
|
24
|
+
export type TextPart = Schema.Schema.Type<typeof textPartSchema>;
|
|
25
|
+
export declare const TextPart: Schema.Codec<TextPart, typeof textPartSchema.Encoded> & {
|
|
26
|
+
readonly make: (text: string, options?: Omit<TextPart, "type" | "text">) => TextPart;
|
|
27
|
+
};
|
|
28
|
+
declare const mediaPartSchema: Schema.Struct<{
|
|
29
|
+
readonly type: Schema.Literal<"media">;
|
|
30
|
+
readonly media: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
31
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
32
|
+
readonly type: Schema.Literal<"bytes">;
|
|
33
|
+
readonly data: Schema.Uint8Array;
|
|
34
|
+
readonly mediaType: Schema.String;
|
|
35
|
+
}>, Schema.Struct<{
|
|
36
|
+
readonly type: Schema.Literal<"base64">;
|
|
37
|
+
readonly data: Schema.String;
|
|
38
|
+
readonly mediaType: Schema.String;
|
|
39
|
+
}>, Schema.Struct<{
|
|
40
|
+
readonly type: Schema.Literal<"url">;
|
|
41
|
+
readonly url: Schema.String;
|
|
42
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
43
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
44
|
+
}>, Schema.Struct<{
|
|
45
|
+
readonly type: Schema.Literal<"ref">;
|
|
46
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
47
|
+
readonly id: Schema.String;
|
|
48
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
49
|
+
}>]>;
|
|
50
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
51
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
52
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
53
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
54
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
55
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
56
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
57
|
+
readonly format: Schema.optional<Schema.String>;
|
|
58
|
+
}>>;
|
|
59
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
60
|
+
}>, never, never>;
|
|
61
|
+
readonly filename: Schema.optional<Schema.String>;
|
|
62
|
+
readonly cache: Schema.optional<typeof CacheHint>;
|
|
63
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
64
|
+
}>;
|
|
65
|
+
export type MediaPart = Schema.Schema.Type<typeof mediaPartSchema>;
|
|
66
|
+
/** A media part as input: `media` may be plain data, with `mediaType` naming its type when the content can't. */
|
|
67
|
+
export type MediaPartInput = Omit<MediaPart, "media"> & {
|
|
68
|
+
readonly media: Media.Input;
|
|
69
|
+
readonly mediaType?: string;
|
|
70
|
+
};
|
|
71
|
+
export declare const MediaPart: Schema.Struct<{
|
|
72
|
+
readonly type: Schema.Literal<"media">;
|
|
73
|
+
readonly media: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
74
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
75
|
+
readonly type: Schema.Literal<"bytes">;
|
|
76
|
+
readonly data: Schema.Uint8Array;
|
|
77
|
+
readonly mediaType: Schema.String;
|
|
78
|
+
}>, Schema.Struct<{
|
|
79
|
+
readonly type: Schema.Literal<"base64">;
|
|
80
|
+
readonly data: Schema.String;
|
|
81
|
+
readonly mediaType: Schema.String;
|
|
82
|
+
}>, Schema.Struct<{
|
|
83
|
+
readonly type: Schema.Literal<"url">;
|
|
84
|
+
readonly url: Schema.String;
|
|
85
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
86
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
87
|
+
}>, Schema.Struct<{
|
|
88
|
+
readonly type: Schema.Literal<"ref">;
|
|
89
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
90
|
+
readonly id: Schema.String;
|
|
91
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
92
|
+
}>]>;
|
|
93
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
94
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
95
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
96
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
97
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
98
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
99
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
100
|
+
readonly format: Schema.optional<Schema.String>;
|
|
101
|
+
}>>;
|
|
102
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
103
|
+
}>, never, never>;
|
|
104
|
+
readonly filename: Schema.optional<Schema.String>;
|
|
105
|
+
readonly cache: Schema.optional<typeof CacheHint>;
|
|
106
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
107
|
+
}> & {
|
|
108
|
+
make: (media: MediaPartInput["media"], options?: Omit<MediaPartInput, "type" | "media">) => MediaPart;
|
|
109
|
+
};
|
|
110
|
+
declare const toolResultValueSchema: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
|
|
111
|
+
readonly type: Schema.Literal<"json">;
|
|
112
|
+
readonly value: Schema.Unknown;
|
|
113
|
+
}>, Schema.Struct<{
|
|
114
|
+
readonly type: Schema.Literal<"text">;
|
|
115
|
+
readonly value: Schema.Unknown;
|
|
116
|
+
}>, Schema.Struct<{
|
|
117
|
+
readonly type: Schema.Literal<"error">;
|
|
118
|
+
readonly value: Schema.Unknown;
|
|
119
|
+
}>, Schema.Struct<{
|
|
120
|
+
readonly type: Schema.Literal<"content">;
|
|
121
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
122
|
+
readonly type: Schema.Literal<"text">;
|
|
123
|
+
readonly text: Schema.String;
|
|
124
|
+
}>, Schema.Struct<{
|
|
125
|
+
readonly type: Schema.Literal<"file">;
|
|
126
|
+
readonly uri: Schema.String;
|
|
127
|
+
readonly mime: Schema.String;
|
|
128
|
+
readonly name: Schema.optional<Schema.String>;
|
|
129
|
+
}>]>>;
|
|
130
|
+
}>]>;
|
|
131
|
+
export type ToolResultValue = Schema.Schema.Type<typeof toolResultValueSchema>;
|
|
132
|
+
export declare const ToolResultValue: Schema.Union<readonly [Schema.Struct<{
|
|
133
|
+
readonly type: Schema.Literal<"json">;
|
|
134
|
+
readonly value: Schema.Unknown;
|
|
135
|
+
}>, Schema.Struct<{
|
|
136
|
+
readonly type: Schema.Literal<"text">;
|
|
137
|
+
readonly value: Schema.Unknown;
|
|
138
|
+
}>, Schema.Struct<{
|
|
139
|
+
readonly type: Schema.Literal<"error">;
|
|
140
|
+
readonly value: Schema.Unknown;
|
|
141
|
+
}>, Schema.Struct<{
|
|
142
|
+
readonly type: Schema.Literal<"content">;
|
|
143
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
144
|
+
readonly type: Schema.Literal<"text">;
|
|
145
|
+
readonly text: Schema.String;
|
|
146
|
+
}>, Schema.Struct<{
|
|
147
|
+
readonly type: Schema.Literal<"file">;
|
|
148
|
+
readonly uri: Schema.String;
|
|
149
|
+
readonly mime: Schema.String;
|
|
150
|
+
readonly name: Schema.optional<Schema.String>;
|
|
151
|
+
}>]>>;
|
|
152
|
+
}>]> & {
|
|
153
|
+
readonly tag: "type";
|
|
154
|
+
readonly discriminants: readonly ["json", "text", "error", "content"];
|
|
155
|
+
readonly cases: {
|
|
156
|
+
content: Schema.Struct<{
|
|
157
|
+
readonly type: Schema.Literal<"content">;
|
|
158
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
159
|
+
readonly type: Schema.Literal<"text">;
|
|
160
|
+
readonly text: Schema.String;
|
|
161
|
+
}>, Schema.Struct<{
|
|
162
|
+
readonly type: Schema.Literal<"file">;
|
|
163
|
+
readonly uri: Schema.String;
|
|
164
|
+
readonly mime: Schema.String;
|
|
165
|
+
readonly name: Schema.optional<Schema.String>;
|
|
166
|
+
}>]>>;
|
|
167
|
+
}>;
|
|
168
|
+
error: Schema.Struct<{
|
|
169
|
+
readonly type: Schema.Literal<"error">;
|
|
170
|
+
readonly value: Schema.Unknown;
|
|
171
|
+
}>;
|
|
172
|
+
json: Schema.Struct<{
|
|
173
|
+
readonly type: Schema.Literal<"json">;
|
|
174
|
+
readonly value: Schema.Unknown;
|
|
175
|
+
}>;
|
|
176
|
+
text: Schema.Struct<{
|
|
177
|
+
readonly type: Schema.Literal<"text">;
|
|
178
|
+
readonly value: Schema.Unknown;
|
|
179
|
+
}>;
|
|
180
|
+
};
|
|
181
|
+
readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
|
|
182
|
+
readonly type: "json";
|
|
183
|
+
readonly value: unknown;
|
|
184
|
+
} | {
|
|
185
|
+
readonly type: "text";
|
|
186
|
+
readonly value: unknown;
|
|
187
|
+
} | {
|
|
188
|
+
readonly type: "error";
|
|
189
|
+
readonly value: unknown;
|
|
190
|
+
} | {
|
|
191
|
+
readonly type: "content";
|
|
192
|
+
readonly value: readonly ({
|
|
193
|
+
readonly type: "text";
|
|
194
|
+
readonly text: string;
|
|
195
|
+
} | {
|
|
196
|
+
readonly type: "file";
|
|
197
|
+
readonly uri: string;
|
|
198
|
+
readonly mime: string;
|
|
199
|
+
readonly name?: string | undefined;
|
|
200
|
+
})[];
|
|
201
|
+
}) => value is Extract<{
|
|
202
|
+
readonly type: "json";
|
|
203
|
+
readonly value: unknown;
|
|
204
|
+
}, {
|
|
205
|
+
readonly type: Keys;
|
|
206
|
+
}> | Extract<{
|
|
207
|
+
readonly type: "text";
|
|
208
|
+
readonly value: unknown;
|
|
209
|
+
}, {
|
|
210
|
+
readonly type: Keys;
|
|
211
|
+
}> | Extract<{
|
|
212
|
+
readonly type: "error";
|
|
213
|
+
readonly value: unknown;
|
|
214
|
+
}, {
|
|
215
|
+
readonly type: Keys;
|
|
216
|
+
}> | Extract<{
|
|
217
|
+
readonly type: "content";
|
|
218
|
+
readonly value: readonly ({
|
|
219
|
+
readonly type: "text";
|
|
220
|
+
readonly text: string;
|
|
221
|
+
} | {
|
|
222
|
+
readonly type: "file";
|
|
223
|
+
readonly uri: string;
|
|
224
|
+
readonly mime: string;
|
|
225
|
+
readonly name?: string | undefined;
|
|
226
|
+
})[];
|
|
227
|
+
}, {
|
|
228
|
+
readonly type: Keys;
|
|
229
|
+
}>;
|
|
230
|
+
readonly guards: {
|
|
231
|
+
content: (u: unknown) => u is {
|
|
232
|
+
readonly type: "content";
|
|
233
|
+
readonly value: readonly ({
|
|
234
|
+
readonly type: "text";
|
|
235
|
+
readonly text: string;
|
|
236
|
+
} | {
|
|
237
|
+
readonly type: "file";
|
|
238
|
+
readonly uri: string;
|
|
239
|
+
readonly mime: string;
|
|
240
|
+
readonly name?: string | undefined;
|
|
241
|
+
})[];
|
|
242
|
+
};
|
|
243
|
+
error: (u: unknown) => u is {
|
|
244
|
+
readonly type: "error";
|
|
245
|
+
readonly value: unknown;
|
|
246
|
+
};
|
|
247
|
+
json: (u: unknown) => u is {
|
|
248
|
+
readonly type: "json";
|
|
249
|
+
readonly value: unknown;
|
|
250
|
+
};
|
|
251
|
+
text: (u: unknown) => u is {
|
|
252
|
+
readonly type: "text";
|
|
253
|
+
readonly value: unknown;
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
readonly match: {
|
|
257
|
+
<Handlers extends { [K in "content" | "error" | "json" | "text"]: (value: {
|
|
258
|
+
readonly content: Schema.Struct<{
|
|
259
|
+
readonly type: Schema.Literal<"content">;
|
|
260
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
261
|
+
readonly type: Schema.Literal<"text">;
|
|
262
|
+
readonly text: Schema.String;
|
|
263
|
+
}>, Schema.Struct<{
|
|
264
|
+
readonly type: Schema.Literal<"file">;
|
|
265
|
+
readonly uri: Schema.String;
|
|
266
|
+
readonly mime: Schema.String;
|
|
267
|
+
readonly name: Schema.optional<Schema.String>;
|
|
268
|
+
}>]>>;
|
|
269
|
+
}>;
|
|
270
|
+
readonly error: Schema.Struct<{
|
|
271
|
+
readonly type: Schema.Literal<"error">;
|
|
272
|
+
readonly value: Schema.Unknown;
|
|
273
|
+
}>;
|
|
274
|
+
readonly json: Schema.Struct<{
|
|
275
|
+
readonly type: Schema.Literal<"json">;
|
|
276
|
+
readonly value: Schema.Unknown;
|
|
277
|
+
}>;
|
|
278
|
+
readonly text: Schema.Struct<{
|
|
279
|
+
readonly type: Schema.Literal<"text">;
|
|
280
|
+
readonly value: Schema.Unknown;
|
|
281
|
+
}>;
|
|
282
|
+
}[K]["Type"]) => any; }>(value: {
|
|
283
|
+
readonly type: "json";
|
|
284
|
+
readonly value: unknown;
|
|
285
|
+
} | {
|
|
286
|
+
readonly type: "text";
|
|
287
|
+
readonly value: unknown;
|
|
288
|
+
} | {
|
|
289
|
+
readonly type: "error";
|
|
290
|
+
readonly value: unknown;
|
|
291
|
+
} | {
|
|
292
|
+
readonly type: "content";
|
|
293
|
+
readonly value: readonly ({
|
|
294
|
+
readonly type: "text";
|
|
295
|
+
readonly text: string;
|
|
296
|
+
} | {
|
|
297
|
+
readonly type: "file";
|
|
298
|
+
readonly uri: string;
|
|
299
|
+
readonly mime: string;
|
|
300
|
+
readonly name?: string | undefined;
|
|
301
|
+
})[];
|
|
302
|
+
}, cases: Handlers): import("effect/Unify").Unify<ReturnType<Handlers["content" | "error" | "json" | "text"]>>;
|
|
303
|
+
<Handlers extends { [K in "content" | "error" | "json" | "text"]: (value: {
|
|
304
|
+
readonly content: Schema.Struct<{
|
|
305
|
+
readonly type: Schema.Literal<"content">;
|
|
306
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
307
|
+
readonly type: Schema.Literal<"text">;
|
|
308
|
+
readonly text: Schema.String;
|
|
309
|
+
}>, Schema.Struct<{
|
|
310
|
+
readonly type: Schema.Literal<"file">;
|
|
311
|
+
readonly uri: Schema.String;
|
|
312
|
+
readonly mime: Schema.String;
|
|
313
|
+
readonly name: Schema.optional<Schema.String>;
|
|
314
|
+
}>]>>;
|
|
315
|
+
}>;
|
|
316
|
+
readonly error: Schema.Struct<{
|
|
317
|
+
readonly type: Schema.Literal<"error">;
|
|
318
|
+
readonly value: Schema.Unknown;
|
|
319
|
+
}>;
|
|
320
|
+
readonly json: Schema.Struct<{
|
|
321
|
+
readonly type: Schema.Literal<"json">;
|
|
322
|
+
readonly value: Schema.Unknown;
|
|
323
|
+
}>;
|
|
324
|
+
readonly text: Schema.Struct<{
|
|
325
|
+
readonly type: Schema.Literal<"text">;
|
|
326
|
+
readonly value: Schema.Unknown;
|
|
327
|
+
}>;
|
|
328
|
+
}[K]["Type"]) => any; }>(cases: Handlers): (value: {
|
|
329
|
+
readonly type: "json";
|
|
330
|
+
readonly value: unknown;
|
|
331
|
+
} | {
|
|
332
|
+
readonly type: "text";
|
|
333
|
+
readonly value: unknown;
|
|
334
|
+
} | {
|
|
335
|
+
readonly type: "error";
|
|
336
|
+
readonly value: unknown;
|
|
337
|
+
} | {
|
|
338
|
+
readonly type: "content";
|
|
339
|
+
readonly value: readonly ({
|
|
340
|
+
readonly type: "text";
|
|
341
|
+
readonly text: string;
|
|
342
|
+
} | {
|
|
343
|
+
readonly type: "file";
|
|
344
|
+
readonly uri: string;
|
|
345
|
+
readonly mime: string;
|
|
346
|
+
readonly name?: string | undefined;
|
|
347
|
+
})[];
|
|
348
|
+
}) => import("effect/Unify").Unify<ReturnType<Handlers["content" | "error" | "json" | "text"]>>;
|
|
349
|
+
};
|
|
350
|
+
readonly matchOrElse: {
|
|
351
|
+
<Handlers, OrElse>(value: {
|
|
352
|
+
readonly type: "json";
|
|
353
|
+
readonly value: unknown;
|
|
354
|
+
} | {
|
|
355
|
+
readonly type: "text";
|
|
356
|
+
readonly value: unknown;
|
|
357
|
+
} | {
|
|
358
|
+
readonly type: "error";
|
|
359
|
+
readonly value: unknown;
|
|
360
|
+
} | {
|
|
361
|
+
readonly type: "content";
|
|
362
|
+
readonly value: readonly ({
|
|
363
|
+
readonly type: "text";
|
|
364
|
+
readonly text: string;
|
|
365
|
+
} | {
|
|
366
|
+
readonly type: "file";
|
|
367
|
+
readonly uri: string;
|
|
368
|
+
readonly mime: string;
|
|
369
|
+
readonly name?: string | undefined;
|
|
370
|
+
})[];
|
|
371
|
+
}, cases: Handlers & {
|
|
372
|
+
readonly content?: ((value: {
|
|
373
|
+
readonly type: "content";
|
|
374
|
+
readonly value: readonly ({
|
|
375
|
+
readonly type: "text";
|
|
376
|
+
readonly text: string;
|
|
377
|
+
} | {
|
|
378
|
+
readonly type: "file";
|
|
379
|
+
readonly uri: string;
|
|
380
|
+
readonly mime: string;
|
|
381
|
+
readonly name?: string | undefined;
|
|
382
|
+
})[];
|
|
383
|
+
}) => any) | undefined;
|
|
384
|
+
readonly error?: ((value: {
|
|
385
|
+
readonly type: "error";
|
|
386
|
+
readonly value: unknown;
|
|
387
|
+
}) => any) | undefined;
|
|
388
|
+
readonly json?: ((value: {
|
|
389
|
+
readonly type: "json";
|
|
390
|
+
readonly value: unknown;
|
|
391
|
+
}) => any) | undefined;
|
|
392
|
+
readonly text?: ((value: {
|
|
393
|
+
readonly type: "text";
|
|
394
|
+
readonly value: unknown;
|
|
395
|
+
}) => any) | undefined;
|
|
396
|
+
} & (Exclude<keyof Handlers, "content" | "error" | "json" | "text"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
|
|
397
|
+
readonly type: "json";
|
|
398
|
+
readonly value: unknown;
|
|
399
|
+
}, {
|
|
400
|
+
readonly type: keyof Handlers;
|
|
401
|
+
}> | Exclude<{
|
|
402
|
+
readonly type: "text";
|
|
403
|
+
readonly value: unknown;
|
|
404
|
+
}, {
|
|
405
|
+
readonly type: keyof Handlers;
|
|
406
|
+
}> | Exclude<{
|
|
407
|
+
readonly type: "error";
|
|
408
|
+
readonly value: unknown;
|
|
409
|
+
}, {
|
|
410
|
+
readonly type: keyof Handlers;
|
|
411
|
+
}> | Exclude<{
|
|
412
|
+
readonly type: "content";
|
|
413
|
+
readonly value: readonly ({
|
|
414
|
+
readonly type: "text";
|
|
415
|
+
readonly text: string;
|
|
416
|
+
} | {
|
|
417
|
+
readonly type: "file";
|
|
418
|
+
readonly uri: string;
|
|
419
|
+
readonly mime: string;
|
|
420
|
+
readonly name?: string | undefined;
|
|
421
|
+
})[];
|
|
422
|
+
}, {
|
|
423
|
+
readonly type: keyof Handlers;
|
|
424
|
+
}>) => any)): import("effect/Unify").Unify<{ [K in keyof Handlers]-?: NonNullable<Handlers[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Handlers] | (OrElse extends (...args: Array<any>) => infer R ? R : never)>;
|
|
425
|
+
<Handlers, OrElse>(cases: Handlers & {
|
|
426
|
+
readonly content?: ((value: {
|
|
427
|
+
readonly type: "content";
|
|
428
|
+
readonly value: readonly ({
|
|
429
|
+
readonly type: "text";
|
|
430
|
+
readonly text: string;
|
|
431
|
+
} | {
|
|
432
|
+
readonly type: "file";
|
|
433
|
+
readonly uri: string;
|
|
434
|
+
readonly mime: string;
|
|
435
|
+
readonly name?: string | undefined;
|
|
436
|
+
})[];
|
|
437
|
+
}) => any) | undefined;
|
|
438
|
+
readonly error?: ((value: {
|
|
439
|
+
readonly type: "error";
|
|
440
|
+
readonly value: unknown;
|
|
441
|
+
}) => any) | undefined;
|
|
442
|
+
readonly json?: ((value: {
|
|
443
|
+
readonly type: "json";
|
|
444
|
+
readonly value: unknown;
|
|
445
|
+
}) => any) | undefined;
|
|
446
|
+
readonly text?: ((value: {
|
|
447
|
+
readonly type: "text";
|
|
448
|
+
readonly value: unknown;
|
|
449
|
+
}) => any) | undefined;
|
|
450
|
+
} & (Exclude<keyof Handlers, "content" | "error" | "json" | "text"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
|
|
451
|
+
readonly type: "json";
|
|
452
|
+
readonly value: unknown;
|
|
453
|
+
}, {
|
|
454
|
+
readonly type: keyof Handlers;
|
|
455
|
+
}> | Exclude<{
|
|
456
|
+
readonly type: "text";
|
|
457
|
+
readonly value: unknown;
|
|
458
|
+
}, {
|
|
459
|
+
readonly type: keyof Handlers;
|
|
460
|
+
}> | Exclude<{
|
|
461
|
+
readonly type: "error";
|
|
462
|
+
readonly value: unknown;
|
|
463
|
+
}, {
|
|
464
|
+
readonly type: keyof Handlers;
|
|
465
|
+
}> | Exclude<{
|
|
466
|
+
readonly type: "content";
|
|
467
|
+
readonly value: readonly ({
|
|
468
|
+
readonly type: "text";
|
|
469
|
+
readonly text: string;
|
|
470
|
+
} | {
|
|
471
|
+
readonly type: "file";
|
|
472
|
+
readonly uri: string;
|
|
473
|
+
readonly mime: string;
|
|
474
|
+
readonly name?: string | undefined;
|
|
475
|
+
})[];
|
|
476
|
+
}, {
|
|
477
|
+
readonly type: keyof Handlers;
|
|
478
|
+
}>) => any)): (value: {
|
|
479
|
+
readonly type: "json";
|
|
480
|
+
readonly value: unknown;
|
|
481
|
+
} | {
|
|
482
|
+
readonly type: "text";
|
|
483
|
+
readonly value: unknown;
|
|
484
|
+
} | {
|
|
485
|
+
readonly type: "error";
|
|
486
|
+
readonly value: unknown;
|
|
487
|
+
} | {
|
|
488
|
+
readonly type: "content";
|
|
489
|
+
readonly value: readonly ({
|
|
490
|
+
readonly type: "text";
|
|
491
|
+
readonly text: string;
|
|
492
|
+
} | {
|
|
493
|
+
readonly type: "file";
|
|
494
|
+
readonly uri: string;
|
|
495
|
+
readonly mime: string;
|
|
496
|
+
readonly name?: string | undefined;
|
|
497
|
+
})[];
|
|
498
|
+
}) => import("effect/Unify").Unify<{ [K in keyof Handlers]-?: NonNullable<Handlers[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Handlers] | (OrElse extends (...args: Array<any>) => infer R ? R : never)>;
|
|
499
|
+
};
|
|
500
|
+
} & {
|
|
501
|
+
make: (value: unknown, type?: ToolResultValue["type"]) => ToolResultValue;
|
|
502
|
+
};
|
|
503
|
+
export interface ToolOutput {
|
|
504
|
+
readonly structured: unknown;
|
|
505
|
+
readonly content: ReadonlyArray<Tool.Content>;
|
|
506
|
+
}
|
|
507
|
+
export declare const ToolOutput: Schema.Struct<{
|
|
508
|
+
readonly structured: Schema.Unknown;
|
|
509
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
510
|
+
readonly type: Schema.Literal<"text">;
|
|
511
|
+
readonly text: Schema.String;
|
|
512
|
+
}>, Schema.Struct<{
|
|
513
|
+
readonly type: Schema.Literal<"file">;
|
|
514
|
+
readonly uri: Schema.String;
|
|
515
|
+
readonly mime: Schema.String;
|
|
516
|
+
readonly name: Schema.optional<Schema.String>;
|
|
517
|
+
}>]>>;
|
|
518
|
+
}> & {
|
|
519
|
+
make: (structured: unknown, content?: ReadonlyArray<Tool.Content>) => ToolOutput;
|
|
520
|
+
fromResultValue: (result: ToolResultValue) => ToolOutput | undefined;
|
|
521
|
+
toResultValue: (output: ToolOutput) => ToolResultValue;
|
|
522
|
+
};
|
|
523
|
+
export declare const ToolCallPart: Schema.Struct<{
|
|
524
|
+
readonly type: Schema.Literal<"tool-call">;
|
|
525
|
+
readonly id: Schema.String;
|
|
526
|
+
readonly name: Schema.String;
|
|
527
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
528
|
+
readonly input: Schema.Unknown;
|
|
529
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
530
|
+
readonly cache: Schema.optional<typeof CacheHint>;
|
|
531
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
532
|
+
}> & {
|
|
533
|
+
make: (input: Omit<ToolCallPart, "type">) => ToolCallPart;
|
|
534
|
+
};
|
|
535
|
+
export type ToolCallPart = Schema.Schema.Type<typeof ToolCallPart>;
|
|
536
|
+
export declare const ToolResultPart: Schema.Struct<{
|
|
537
|
+
readonly type: Schema.Literal<"tool-result">;
|
|
538
|
+
readonly id: Schema.String;
|
|
539
|
+
readonly name: Schema.String;
|
|
540
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
541
|
+
readonly result: Schema.Union<readonly [Schema.Struct<{
|
|
542
|
+
readonly type: Schema.Literal<"json">;
|
|
543
|
+
readonly value: Schema.Unknown;
|
|
544
|
+
}>, Schema.Struct<{
|
|
545
|
+
readonly type: Schema.Literal<"text">;
|
|
546
|
+
readonly value: Schema.Unknown;
|
|
547
|
+
}>, Schema.Struct<{
|
|
548
|
+
readonly type: Schema.Literal<"error">;
|
|
549
|
+
readonly value: Schema.Unknown;
|
|
550
|
+
}>, Schema.Struct<{
|
|
551
|
+
readonly type: Schema.Literal<"content">;
|
|
552
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
553
|
+
readonly type: Schema.Literal<"text">;
|
|
554
|
+
readonly text: Schema.String;
|
|
555
|
+
}>, Schema.Struct<{
|
|
556
|
+
readonly type: Schema.Literal<"file">;
|
|
557
|
+
readonly uri: Schema.String;
|
|
558
|
+
readonly mime: Schema.String;
|
|
559
|
+
readonly name: Schema.optional<Schema.String>;
|
|
560
|
+
}>]>>;
|
|
561
|
+
}>]> & {
|
|
562
|
+
readonly tag: "type";
|
|
563
|
+
readonly discriminants: readonly ["json", "text", "error", "content"];
|
|
564
|
+
readonly cases: {
|
|
565
|
+
content: Schema.Struct<{
|
|
566
|
+
readonly type: Schema.Literal<"content">;
|
|
567
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
568
|
+
readonly type: Schema.Literal<"text">;
|
|
569
|
+
readonly text: Schema.String;
|
|
570
|
+
}>, Schema.Struct<{
|
|
571
|
+
readonly type: Schema.Literal<"file">;
|
|
572
|
+
readonly uri: Schema.String;
|
|
573
|
+
readonly mime: Schema.String;
|
|
574
|
+
readonly name: Schema.optional<Schema.String>;
|
|
575
|
+
}>]>>;
|
|
576
|
+
}>;
|
|
577
|
+
error: Schema.Struct<{
|
|
578
|
+
readonly type: Schema.Literal<"error">;
|
|
579
|
+
readonly value: Schema.Unknown;
|
|
580
|
+
}>;
|
|
581
|
+
json: Schema.Struct<{
|
|
582
|
+
readonly type: Schema.Literal<"json">;
|
|
583
|
+
readonly value: Schema.Unknown;
|
|
584
|
+
}>;
|
|
585
|
+
text: Schema.Struct<{
|
|
586
|
+
readonly type: Schema.Literal<"text">;
|
|
587
|
+
readonly value: Schema.Unknown;
|
|
588
|
+
}>;
|
|
589
|
+
};
|
|
590
|
+
readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
|
|
591
|
+
readonly type: "json";
|
|
592
|
+
readonly value: unknown;
|
|
593
|
+
} | {
|
|
594
|
+
readonly type: "text";
|
|
595
|
+
readonly value: unknown;
|
|
596
|
+
} | {
|
|
597
|
+
readonly type: "error";
|
|
598
|
+
readonly value: unknown;
|
|
599
|
+
} | {
|
|
600
|
+
readonly type: "content";
|
|
601
|
+
readonly value: readonly ({
|
|
602
|
+
readonly type: "text";
|
|
603
|
+
readonly text: string;
|
|
604
|
+
} | {
|
|
605
|
+
readonly type: "file";
|
|
606
|
+
readonly uri: string;
|
|
607
|
+
readonly mime: string;
|
|
608
|
+
readonly name?: string | undefined;
|
|
609
|
+
})[];
|
|
610
|
+
}) => value is Extract<{
|
|
611
|
+
readonly type: "json";
|
|
612
|
+
readonly value: unknown;
|
|
613
|
+
}, {
|
|
614
|
+
readonly type: Keys;
|
|
615
|
+
}> | Extract<{
|
|
616
|
+
readonly type: "text";
|
|
617
|
+
readonly value: unknown;
|
|
618
|
+
}, {
|
|
619
|
+
readonly type: Keys;
|
|
620
|
+
}> | Extract<{
|
|
621
|
+
readonly type: "error";
|
|
622
|
+
readonly value: unknown;
|
|
623
|
+
}, {
|
|
624
|
+
readonly type: Keys;
|
|
625
|
+
}> | Extract<{
|
|
626
|
+
readonly type: "content";
|
|
627
|
+
readonly value: readonly ({
|
|
628
|
+
readonly type: "text";
|
|
629
|
+
readonly text: string;
|
|
630
|
+
} | {
|
|
631
|
+
readonly type: "file";
|
|
632
|
+
readonly uri: string;
|
|
633
|
+
readonly mime: string;
|
|
634
|
+
readonly name?: string | undefined;
|
|
635
|
+
})[];
|
|
636
|
+
}, {
|
|
637
|
+
readonly type: Keys;
|
|
638
|
+
}>;
|
|
639
|
+
readonly guards: {
|
|
640
|
+
content: (u: unknown) => u is {
|
|
641
|
+
readonly type: "content";
|
|
642
|
+
readonly value: readonly ({
|
|
643
|
+
readonly type: "text";
|
|
644
|
+
readonly text: string;
|
|
645
|
+
} | {
|
|
646
|
+
readonly type: "file";
|
|
647
|
+
readonly uri: string;
|
|
648
|
+
readonly mime: string;
|
|
649
|
+
readonly name?: string | undefined;
|
|
650
|
+
})[];
|
|
651
|
+
};
|
|
652
|
+
error: (u: unknown) => u is {
|
|
653
|
+
readonly type: "error";
|
|
654
|
+
readonly value: unknown;
|
|
655
|
+
};
|
|
656
|
+
json: (u: unknown) => u is {
|
|
657
|
+
readonly type: "json";
|
|
658
|
+
readonly value: unknown;
|
|
659
|
+
};
|
|
660
|
+
text: (u: unknown) => u is {
|
|
661
|
+
readonly type: "text";
|
|
662
|
+
readonly value: unknown;
|
|
663
|
+
};
|
|
664
|
+
};
|
|
665
|
+
readonly match: {
|
|
666
|
+
<Handlers extends { [K in "content" | "error" | "json" | "text"]: (value: {
|
|
667
|
+
readonly content: Schema.Struct<{
|
|
668
|
+
readonly type: Schema.Literal<"content">;
|
|
669
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
670
|
+
readonly type: Schema.Literal<"text">;
|
|
671
|
+
readonly text: Schema.String;
|
|
672
|
+
}>, Schema.Struct<{
|
|
673
|
+
readonly type: Schema.Literal<"file">;
|
|
674
|
+
readonly uri: Schema.String;
|
|
675
|
+
readonly mime: Schema.String;
|
|
676
|
+
readonly name: Schema.optional<Schema.String>;
|
|
677
|
+
}>]>>;
|
|
678
|
+
}>;
|
|
679
|
+
readonly error: Schema.Struct<{
|
|
680
|
+
readonly type: Schema.Literal<"error">;
|
|
681
|
+
readonly value: Schema.Unknown;
|
|
682
|
+
}>;
|
|
683
|
+
readonly json: Schema.Struct<{
|
|
684
|
+
readonly type: Schema.Literal<"json">;
|
|
685
|
+
readonly value: Schema.Unknown;
|
|
686
|
+
}>;
|
|
687
|
+
readonly text: Schema.Struct<{
|
|
688
|
+
readonly type: Schema.Literal<"text">;
|
|
689
|
+
readonly value: Schema.Unknown;
|
|
690
|
+
}>;
|
|
691
|
+
}[K]["Type"]) => any; }>(value: {
|
|
692
|
+
readonly type: "json";
|
|
693
|
+
readonly value: unknown;
|
|
694
|
+
} | {
|
|
695
|
+
readonly type: "text";
|
|
696
|
+
readonly value: unknown;
|
|
697
|
+
} | {
|
|
698
|
+
readonly type: "error";
|
|
699
|
+
readonly value: unknown;
|
|
700
|
+
} | {
|
|
701
|
+
readonly type: "content";
|
|
702
|
+
readonly value: readonly ({
|
|
703
|
+
readonly type: "text";
|
|
704
|
+
readonly text: string;
|
|
705
|
+
} | {
|
|
706
|
+
readonly type: "file";
|
|
707
|
+
readonly uri: string;
|
|
708
|
+
readonly mime: string;
|
|
709
|
+
readonly name?: string | undefined;
|
|
710
|
+
})[];
|
|
711
|
+
}, cases: Handlers): import("effect/Unify").Unify<ReturnType<Handlers["content" | "error" | "json" | "text"]>>;
|
|
712
|
+
<Handlers extends { [K in "content" | "error" | "json" | "text"]: (value: {
|
|
713
|
+
readonly content: Schema.Struct<{
|
|
714
|
+
readonly type: Schema.Literal<"content">;
|
|
715
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
716
|
+
readonly type: Schema.Literal<"text">;
|
|
717
|
+
readonly text: Schema.String;
|
|
718
|
+
}>, Schema.Struct<{
|
|
719
|
+
readonly type: Schema.Literal<"file">;
|
|
720
|
+
readonly uri: Schema.String;
|
|
721
|
+
readonly mime: Schema.String;
|
|
722
|
+
readonly name: Schema.optional<Schema.String>;
|
|
723
|
+
}>]>>;
|
|
724
|
+
}>;
|
|
725
|
+
readonly error: Schema.Struct<{
|
|
726
|
+
readonly type: Schema.Literal<"error">;
|
|
727
|
+
readonly value: Schema.Unknown;
|
|
728
|
+
}>;
|
|
729
|
+
readonly json: Schema.Struct<{
|
|
730
|
+
readonly type: Schema.Literal<"json">;
|
|
731
|
+
readonly value: Schema.Unknown;
|
|
732
|
+
}>;
|
|
733
|
+
readonly text: Schema.Struct<{
|
|
734
|
+
readonly type: Schema.Literal<"text">;
|
|
735
|
+
readonly value: Schema.Unknown;
|
|
736
|
+
}>;
|
|
737
|
+
}[K]["Type"]) => any; }>(cases: Handlers): (value: {
|
|
738
|
+
readonly type: "json";
|
|
739
|
+
readonly value: unknown;
|
|
740
|
+
} | {
|
|
741
|
+
readonly type: "text";
|
|
742
|
+
readonly value: unknown;
|
|
743
|
+
} | {
|
|
744
|
+
readonly type: "error";
|
|
745
|
+
readonly value: unknown;
|
|
746
|
+
} | {
|
|
747
|
+
readonly type: "content";
|
|
748
|
+
readonly value: readonly ({
|
|
749
|
+
readonly type: "text";
|
|
750
|
+
readonly text: string;
|
|
751
|
+
} | {
|
|
752
|
+
readonly type: "file";
|
|
753
|
+
readonly uri: string;
|
|
754
|
+
readonly mime: string;
|
|
755
|
+
readonly name?: string | undefined;
|
|
756
|
+
})[];
|
|
757
|
+
}) => import("effect/Unify").Unify<ReturnType<Handlers["content" | "error" | "json" | "text"]>>;
|
|
758
|
+
};
|
|
759
|
+
readonly matchOrElse: {
|
|
760
|
+
<Handlers, OrElse>(value: {
|
|
761
|
+
readonly type: "json";
|
|
762
|
+
readonly value: unknown;
|
|
763
|
+
} | {
|
|
764
|
+
readonly type: "text";
|
|
765
|
+
readonly value: unknown;
|
|
766
|
+
} | {
|
|
767
|
+
readonly type: "error";
|
|
768
|
+
readonly value: unknown;
|
|
769
|
+
} | {
|
|
770
|
+
readonly type: "content";
|
|
771
|
+
readonly value: readonly ({
|
|
772
|
+
readonly type: "text";
|
|
773
|
+
readonly text: string;
|
|
774
|
+
} | {
|
|
775
|
+
readonly type: "file";
|
|
776
|
+
readonly uri: string;
|
|
777
|
+
readonly mime: string;
|
|
778
|
+
readonly name?: string | undefined;
|
|
779
|
+
})[];
|
|
780
|
+
}, cases: Handlers & {
|
|
781
|
+
readonly content?: ((value: {
|
|
782
|
+
readonly type: "content";
|
|
783
|
+
readonly value: readonly ({
|
|
784
|
+
readonly type: "text";
|
|
785
|
+
readonly text: string;
|
|
786
|
+
} | {
|
|
787
|
+
readonly type: "file";
|
|
788
|
+
readonly uri: string;
|
|
789
|
+
readonly mime: string;
|
|
790
|
+
readonly name?: string | undefined;
|
|
791
|
+
})[];
|
|
792
|
+
}) => any) | undefined;
|
|
793
|
+
readonly error?: ((value: {
|
|
794
|
+
readonly type: "error";
|
|
795
|
+
readonly value: unknown;
|
|
796
|
+
}) => any) | undefined;
|
|
797
|
+
readonly json?: ((value: {
|
|
798
|
+
readonly type: "json";
|
|
799
|
+
readonly value: unknown;
|
|
800
|
+
}) => any) | undefined;
|
|
801
|
+
readonly text?: ((value: {
|
|
802
|
+
readonly type: "text";
|
|
803
|
+
readonly value: unknown;
|
|
804
|
+
}) => any) | undefined;
|
|
805
|
+
} & (Exclude<keyof Handlers, "content" | "error" | "json" | "text"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
|
|
806
|
+
readonly type: "json";
|
|
807
|
+
readonly value: unknown;
|
|
808
|
+
}, {
|
|
809
|
+
readonly type: keyof Handlers;
|
|
810
|
+
}> | Exclude<{
|
|
811
|
+
readonly type: "text";
|
|
812
|
+
readonly value: unknown;
|
|
813
|
+
}, {
|
|
814
|
+
readonly type: keyof Handlers;
|
|
815
|
+
}> | Exclude<{
|
|
816
|
+
readonly type: "error";
|
|
817
|
+
readonly value: unknown;
|
|
818
|
+
}, {
|
|
819
|
+
readonly type: keyof Handlers;
|
|
820
|
+
}> | Exclude<{
|
|
821
|
+
readonly type: "content";
|
|
822
|
+
readonly value: readonly ({
|
|
823
|
+
readonly type: "text";
|
|
824
|
+
readonly text: string;
|
|
825
|
+
} | {
|
|
826
|
+
readonly type: "file";
|
|
827
|
+
readonly uri: string;
|
|
828
|
+
readonly mime: string;
|
|
829
|
+
readonly name?: string | undefined;
|
|
830
|
+
})[];
|
|
831
|
+
}, {
|
|
832
|
+
readonly type: keyof Handlers;
|
|
833
|
+
}>) => any)): import("effect/Unify").Unify<{ [K in keyof Handlers]-?: NonNullable<Handlers[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Handlers] | (OrElse extends (...args: Array<any>) => infer R ? R : never)>;
|
|
834
|
+
<Handlers, OrElse>(cases: Handlers & {
|
|
835
|
+
readonly content?: ((value: {
|
|
836
|
+
readonly type: "content";
|
|
837
|
+
readonly value: readonly ({
|
|
838
|
+
readonly type: "text";
|
|
839
|
+
readonly text: string;
|
|
840
|
+
} | {
|
|
841
|
+
readonly type: "file";
|
|
842
|
+
readonly uri: string;
|
|
843
|
+
readonly mime: string;
|
|
844
|
+
readonly name?: string | undefined;
|
|
845
|
+
})[];
|
|
846
|
+
}) => any) | undefined;
|
|
847
|
+
readonly error?: ((value: {
|
|
848
|
+
readonly type: "error";
|
|
849
|
+
readonly value: unknown;
|
|
850
|
+
}) => any) | undefined;
|
|
851
|
+
readonly json?: ((value: {
|
|
852
|
+
readonly type: "json";
|
|
853
|
+
readonly value: unknown;
|
|
854
|
+
}) => any) | undefined;
|
|
855
|
+
readonly text?: ((value: {
|
|
856
|
+
readonly type: "text";
|
|
857
|
+
readonly value: unknown;
|
|
858
|
+
}) => any) | undefined;
|
|
859
|
+
} & (Exclude<keyof Handlers, "content" | "error" | "json" | "text"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
|
|
860
|
+
readonly type: "json";
|
|
861
|
+
readonly value: unknown;
|
|
862
|
+
}, {
|
|
863
|
+
readonly type: keyof Handlers;
|
|
864
|
+
}> | Exclude<{
|
|
865
|
+
readonly type: "text";
|
|
866
|
+
readonly value: unknown;
|
|
867
|
+
}, {
|
|
868
|
+
readonly type: keyof Handlers;
|
|
869
|
+
}> | Exclude<{
|
|
870
|
+
readonly type: "error";
|
|
871
|
+
readonly value: unknown;
|
|
872
|
+
}, {
|
|
873
|
+
readonly type: keyof Handlers;
|
|
874
|
+
}> | Exclude<{
|
|
875
|
+
readonly type: "content";
|
|
876
|
+
readonly value: readonly ({
|
|
877
|
+
readonly type: "text";
|
|
878
|
+
readonly text: string;
|
|
879
|
+
} | {
|
|
880
|
+
readonly type: "file";
|
|
881
|
+
readonly uri: string;
|
|
882
|
+
readonly mime: string;
|
|
883
|
+
readonly name?: string | undefined;
|
|
884
|
+
})[];
|
|
885
|
+
}, {
|
|
886
|
+
readonly type: keyof Handlers;
|
|
887
|
+
}>) => any)): (value: {
|
|
888
|
+
readonly type: "json";
|
|
889
|
+
readonly value: unknown;
|
|
890
|
+
} | {
|
|
891
|
+
readonly type: "text";
|
|
892
|
+
readonly value: unknown;
|
|
893
|
+
} | {
|
|
894
|
+
readonly type: "error";
|
|
895
|
+
readonly value: unknown;
|
|
896
|
+
} | {
|
|
897
|
+
readonly type: "content";
|
|
898
|
+
readonly value: readonly ({
|
|
899
|
+
readonly type: "text";
|
|
900
|
+
readonly text: string;
|
|
901
|
+
} | {
|
|
902
|
+
readonly type: "file";
|
|
903
|
+
readonly uri: string;
|
|
904
|
+
readonly mime: string;
|
|
905
|
+
readonly name?: string | undefined;
|
|
906
|
+
})[];
|
|
907
|
+
}) => import("effect/Unify").Unify<{ [K in keyof Handlers]-?: NonNullable<Handlers[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Handlers] | (OrElse extends (...args: Array<any>) => infer R ? R : never)>;
|
|
908
|
+
};
|
|
909
|
+
} & {
|
|
910
|
+
make: (value: unknown, type?: ToolResultValue["type"]) => ToolResultValue;
|
|
911
|
+
};
|
|
912
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
913
|
+
readonly cache: Schema.optional<typeof CacheHint>;
|
|
914
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
915
|
+
}> & {
|
|
916
|
+
make: (input: Omit<ToolResultPart, "type" | "result"> & {
|
|
917
|
+
readonly result: unknown;
|
|
918
|
+
readonly resultType?: ToolResultValue["type"];
|
|
919
|
+
}) => ToolResultPart;
|
|
920
|
+
};
|
|
921
|
+
export type ToolResultPart = Schema.Schema.Type<typeof ToolResultPart>;
|
|
922
|
+
declare const reasoningPartSchema: Schema.Struct<{
|
|
923
|
+
readonly type: Schema.Literal<"reasoning">;
|
|
924
|
+
readonly text: Schema.String;
|
|
925
|
+
readonly encrypted: Schema.optional<Schema.String>;
|
|
926
|
+
readonly cache: Schema.optional<typeof CacheHint>;
|
|
927
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
928
|
+
}>;
|
|
929
|
+
export type ReasoningPart = Schema.Schema.Type<typeof reasoningPartSchema>;
|
|
930
|
+
export declare const ReasoningPart: Schema.Codec<ReasoningPart, typeof reasoningPartSchema.Encoded> & {
|
|
931
|
+
readonly make: (text: string, options?: Omit<ReasoningPart, "type" | "text">) => ReasoningPart;
|
|
932
|
+
};
|
|
933
|
+
/** A provider-generated context checkpoint, distinct from visible assistant text. */
|
|
934
|
+
type CompactionContent = {
|
|
935
|
+
readonly encrypted: string;
|
|
936
|
+
readonly text?: never;
|
|
937
|
+
} | {
|
|
938
|
+
readonly text: string | null;
|
|
939
|
+
readonly encrypted?: never;
|
|
940
|
+
};
|
|
941
|
+
declare const compactionPartSchema: Schema.refine<{
|
|
942
|
+
readonly type: "compaction";
|
|
943
|
+
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
944
|
+
readonly id?: string | undefined;
|
|
945
|
+
readonly encrypted?: string | undefined;
|
|
946
|
+
readonly text?: string | null | undefined;
|
|
947
|
+
} & CompactionContent, Schema.Struct<{
|
|
948
|
+
readonly type: Schema.Literal<"compaction">;
|
|
949
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
950
|
+
readonly id: Schema.optional<Schema.String>;
|
|
951
|
+
readonly encrypted: Schema.optional<Schema.String>;
|
|
952
|
+
/** Null means the provider failed to produce a summary; prior history must be retained. */
|
|
953
|
+
readonly text: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
954
|
+
}>>;
|
|
955
|
+
export type CompactionPart = typeof compactionPartSchema.Type;
|
|
956
|
+
export declare const CompactionPart: Schema.refine<{
|
|
957
|
+
readonly type: "compaction";
|
|
958
|
+
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
959
|
+
readonly id?: string | undefined;
|
|
960
|
+
readonly encrypted?: string | undefined;
|
|
961
|
+
readonly text?: string | null | undefined;
|
|
962
|
+
} & CompactionContent, Schema.Struct<{
|
|
963
|
+
readonly type: Schema.Literal<"compaction">;
|
|
964
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
965
|
+
readonly id: Schema.optional<Schema.String>;
|
|
966
|
+
readonly encrypted: Schema.optional<Schema.String>;
|
|
967
|
+
/** Null means the provider failed to produce a summary; prior history must be retained. */
|
|
968
|
+
readonly text: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
969
|
+
}>> & {
|
|
970
|
+
make: (input: Omit<CompactionPart, "type" | "encrypted" | "text"> & CompactionContent) => CompactionPart;
|
|
971
|
+
};
|
|
972
|
+
/** Reasoning effort changed here, from `previous` to `effort`; `undefined` is the model default. */
|
|
973
|
+
declare const effortPartSchema: Schema.Struct<{
|
|
974
|
+
readonly type: Schema.Literal<"effort">;
|
|
975
|
+
readonly effort: Schema.optional<Schema.declare<ReasoningEffort, ReasoningEffort>>;
|
|
976
|
+
readonly previous: Schema.optional<Schema.declare<ReasoningEffort, ReasoningEffort>>;
|
|
977
|
+
}>;
|
|
978
|
+
export type EffortPart = Schema.Schema.Type<typeof effortPartSchema>;
|
|
979
|
+
export declare const EffortPart: Schema.Codec<EffortPart, typeof effortPartSchema.Encoded> & {
|
|
980
|
+
readonly make: (input?: Omit<EffortPart, "type">) => EffortPart;
|
|
981
|
+
};
|
|
982
|
+
export declare const ContentPart: Schema.toTaggedUnion<"type", readonly [Schema.Codec<{
|
|
983
|
+
readonly type: "text";
|
|
984
|
+
readonly text: string;
|
|
985
|
+
readonly cache?: CacheHint | undefined;
|
|
986
|
+
readonly providerMetadata?: {
|
|
987
|
+
readonly [x: string]: {
|
|
988
|
+
readonly [x: string]: unknown;
|
|
989
|
+
};
|
|
990
|
+
} | undefined;
|
|
991
|
+
}, {
|
|
992
|
+
readonly type: "text";
|
|
993
|
+
readonly text: string;
|
|
994
|
+
readonly cache?: {
|
|
995
|
+
readonly type: "ephemeral" | "persistent";
|
|
996
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
997
|
+
} | undefined;
|
|
998
|
+
readonly providerMetadata?: {
|
|
999
|
+
readonly [x: string]: {
|
|
1000
|
+
readonly [x: string]: unknown;
|
|
1001
|
+
};
|
|
1002
|
+
} | undefined;
|
|
1003
|
+
}, never, never> & {
|
|
1004
|
+
readonly make: (text: string, options?: Omit<TextPart, "type" | "text">) => TextPart;
|
|
1005
|
+
}, Schema.Struct<{
|
|
1006
|
+
readonly type: Schema.Literal<"media">;
|
|
1007
|
+
readonly media: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
1008
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
1009
|
+
readonly type: Schema.Literal<"bytes">;
|
|
1010
|
+
readonly data: Schema.Uint8Array;
|
|
1011
|
+
readonly mediaType: Schema.String;
|
|
1012
|
+
}>, Schema.Struct<{
|
|
1013
|
+
readonly type: Schema.Literal<"base64">;
|
|
1014
|
+
readonly data: Schema.String;
|
|
1015
|
+
readonly mediaType: Schema.String;
|
|
1016
|
+
}>, Schema.Struct<{
|
|
1017
|
+
readonly type: Schema.Literal<"url">;
|
|
1018
|
+
readonly url: Schema.String;
|
|
1019
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
1020
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
1021
|
+
}>, Schema.Struct<{
|
|
1022
|
+
readonly type: Schema.Literal<"ref">;
|
|
1023
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
1024
|
+
readonly id: Schema.String;
|
|
1025
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
1026
|
+
}>]>;
|
|
1027
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
1028
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
1029
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
1030
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
1031
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
1032
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
1033
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
1034
|
+
readonly format: Schema.optional<Schema.String>;
|
|
1035
|
+
}>>;
|
|
1036
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1037
|
+
}>, never, never>;
|
|
1038
|
+
readonly filename: Schema.optional<Schema.String>;
|
|
1039
|
+
readonly cache: Schema.optional<typeof CacheHint>;
|
|
1040
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1041
|
+
}> & {
|
|
1042
|
+
make: (media: MediaPartInput["media"], options?: Omit<MediaPartInput, "type" | "media">) => MediaPart;
|
|
1043
|
+
}, Schema.Struct<{
|
|
1044
|
+
readonly type: Schema.Literal<"tool-call">;
|
|
1045
|
+
readonly id: Schema.String;
|
|
1046
|
+
readonly name: Schema.String;
|
|
1047
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
1048
|
+
readonly input: Schema.Unknown;
|
|
1049
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
1050
|
+
readonly cache: Schema.optional<typeof CacheHint>;
|
|
1051
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1052
|
+
}> & {
|
|
1053
|
+
make: (input: Omit<ToolCallPart, "type">) => ToolCallPart;
|
|
1054
|
+
}, Schema.Struct<{
|
|
1055
|
+
readonly type: Schema.Literal<"tool-result">;
|
|
1056
|
+
readonly id: Schema.String;
|
|
1057
|
+
readonly name: Schema.String;
|
|
1058
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
1059
|
+
readonly result: Schema.Union<readonly [Schema.Struct<{
|
|
1060
|
+
readonly type: Schema.Literal<"json">;
|
|
1061
|
+
readonly value: Schema.Unknown;
|
|
1062
|
+
}>, Schema.Struct<{
|
|
1063
|
+
readonly type: Schema.Literal<"text">;
|
|
1064
|
+
readonly value: Schema.Unknown;
|
|
1065
|
+
}>, Schema.Struct<{
|
|
1066
|
+
readonly type: Schema.Literal<"error">;
|
|
1067
|
+
readonly value: Schema.Unknown;
|
|
1068
|
+
}>, Schema.Struct<{
|
|
1069
|
+
readonly type: Schema.Literal<"content">;
|
|
1070
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
1071
|
+
readonly type: Schema.Literal<"text">;
|
|
1072
|
+
readonly text: Schema.String;
|
|
1073
|
+
}>, Schema.Struct<{
|
|
1074
|
+
readonly type: Schema.Literal<"file">;
|
|
1075
|
+
readonly uri: Schema.String;
|
|
1076
|
+
readonly mime: Schema.String;
|
|
1077
|
+
readonly name: Schema.optional<Schema.String>;
|
|
1078
|
+
}>]>>;
|
|
1079
|
+
}>]> & {
|
|
1080
|
+
readonly tag: "type";
|
|
1081
|
+
readonly discriminants: readonly ["json", "text", "error", "content"];
|
|
1082
|
+
readonly cases: {
|
|
1083
|
+
content: Schema.Struct<{
|
|
1084
|
+
readonly type: Schema.Literal<"content">;
|
|
1085
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
1086
|
+
readonly type: Schema.Literal<"text">;
|
|
1087
|
+
readonly text: Schema.String;
|
|
1088
|
+
}>, Schema.Struct<{
|
|
1089
|
+
readonly type: Schema.Literal<"file">;
|
|
1090
|
+
readonly uri: Schema.String;
|
|
1091
|
+
readonly mime: Schema.String;
|
|
1092
|
+
readonly name: Schema.optional<Schema.String>;
|
|
1093
|
+
}>]>>;
|
|
1094
|
+
}>;
|
|
1095
|
+
error: Schema.Struct<{
|
|
1096
|
+
readonly type: Schema.Literal<"error">;
|
|
1097
|
+
readonly value: Schema.Unknown;
|
|
1098
|
+
}>;
|
|
1099
|
+
json: Schema.Struct<{
|
|
1100
|
+
readonly type: Schema.Literal<"json">;
|
|
1101
|
+
readonly value: Schema.Unknown;
|
|
1102
|
+
}>;
|
|
1103
|
+
text: Schema.Struct<{
|
|
1104
|
+
readonly type: Schema.Literal<"text">;
|
|
1105
|
+
readonly value: Schema.Unknown;
|
|
1106
|
+
}>;
|
|
1107
|
+
};
|
|
1108
|
+
readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
|
|
1109
|
+
readonly type: "json";
|
|
1110
|
+
readonly value: unknown;
|
|
1111
|
+
} | {
|
|
1112
|
+
readonly type: "text";
|
|
1113
|
+
readonly value: unknown;
|
|
1114
|
+
} | {
|
|
1115
|
+
readonly type: "error";
|
|
1116
|
+
readonly value: unknown;
|
|
1117
|
+
} | {
|
|
1118
|
+
readonly type: "content";
|
|
1119
|
+
readonly value: readonly ({
|
|
1120
|
+
readonly type: "text";
|
|
1121
|
+
readonly text: string;
|
|
1122
|
+
} | {
|
|
1123
|
+
readonly type: "file";
|
|
1124
|
+
readonly uri: string;
|
|
1125
|
+
readonly mime: string;
|
|
1126
|
+
readonly name?: string | undefined;
|
|
1127
|
+
})[];
|
|
1128
|
+
}) => value is Extract<{
|
|
1129
|
+
readonly type: "json";
|
|
1130
|
+
readonly value: unknown;
|
|
1131
|
+
}, {
|
|
1132
|
+
readonly type: Keys;
|
|
1133
|
+
}> | Extract<{
|
|
1134
|
+
readonly type: "text";
|
|
1135
|
+
readonly value: unknown;
|
|
1136
|
+
}, {
|
|
1137
|
+
readonly type: Keys;
|
|
1138
|
+
}> | Extract<{
|
|
1139
|
+
readonly type: "error";
|
|
1140
|
+
readonly value: unknown;
|
|
1141
|
+
}, {
|
|
1142
|
+
readonly type: Keys;
|
|
1143
|
+
}> | Extract<{
|
|
1144
|
+
readonly type: "content";
|
|
1145
|
+
readonly value: readonly ({
|
|
1146
|
+
readonly type: "text";
|
|
1147
|
+
readonly text: string;
|
|
1148
|
+
} | {
|
|
1149
|
+
readonly type: "file";
|
|
1150
|
+
readonly uri: string;
|
|
1151
|
+
readonly mime: string;
|
|
1152
|
+
readonly name?: string | undefined;
|
|
1153
|
+
})[];
|
|
1154
|
+
}, {
|
|
1155
|
+
readonly type: Keys;
|
|
1156
|
+
}>;
|
|
1157
|
+
readonly guards: {
|
|
1158
|
+
content: (u: unknown) => u is {
|
|
1159
|
+
readonly type: "content";
|
|
1160
|
+
readonly value: readonly ({
|
|
1161
|
+
readonly type: "text";
|
|
1162
|
+
readonly text: string;
|
|
1163
|
+
} | {
|
|
1164
|
+
readonly type: "file";
|
|
1165
|
+
readonly uri: string;
|
|
1166
|
+
readonly mime: string;
|
|
1167
|
+
readonly name?: string | undefined;
|
|
1168
|
+
})[];
|
|
1169
|
+
};
|
|
1170
|
+
error: (u: unknown) => u is {
|
|
1171
|
+
readonly type: "error";
|
|
1172
|
+
readonly value: unknown;
|
|
1173
|
+
};
|
|
1174
|
+
json: (u: unknown) => u is {
|
|
1175
|
+
readonly type: "json";
|
|
1176
|
+
readonly value: unknown;
|
|
1177
|
+
};
|
|
1178
|
+
text: (u: unknown) => u is {
|
|
1179
|
+
readonly type: "text";
|
|
1180
|
+
readonly value: unknown;
|
|
1181
|
+
};
|
|
1182
|
+
};
|
|
1183
|
+
readonly match: {
|
|
1184
|
+
<Handlers extends { [K in "content" | "error" | "json" | "text"]: (value: {
|
|
1185
|
+
readonly content: Schema.Struct<{
|
|
1186
|
+
readonly type: Schema.Literal<"content">;
|
|
1187
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
1188
|
+
readonly type: Schema.Literal<"text">;
|
|
1189
|
+
readonly text: Schema.String;
|
|
1190
|
+
}>, Schema.Struct<{
|
|
1191
|
+
readonly type: Schema.Literal<"file">;
|
|
1192
|
+
readonly uri: Schema.String;
|
|
1193
|
+
readonly mime: Schema.String;
|
|
1194
|
+
readonly name: Schema.optional<Schema.String>;
|
|
1195
|
+
}>]>>;
|
|
1196
|
+
}>;
|
|
1197
|
+
readonly error: Schema.Struct<{
|
|
1198
|
+
readonly type: Schema.Literal<"error">;
|
|
1199
|
+
readonly value: Schema.Unknown;
|
|
1200
|
+
}>;
|
|
1201
|
+
readonly json: Schema.Struct<{
|
|
1202
|
+
readonly type: Schema.Literal<"json">;
|
|
1203
|
+
readonly value: Schema.Unknown;
|
|
1204
|
+
}>;
|
|
1205
|
+
readonly text: Schema.Struct<{
|
|
1206
|
+
readonly type: Schema.Literal<"text">;
|
|
1207
|
+
readonly value: Schema.Unknown;
|
|
1208
|
+
}>;
|
|
1209
|
+
}[K]["Type"]) => any; }>(value: {
|
|
1210
|
+
readonly type: "json";
|
|
1211
|
+
readonly value: unknown;
|
|
1212
|
+
} | {
|
|
1213
|
+
readonly type: "text";
|
|
1214
|
+
readonly value: unknown;
|
|
1215
|
+
} | {
|
|
1216
|
+
readonly type: "error";
|
|
1217
|
+
readonly value: unknown;
|
|
1218
|
+
} | {
|
|
1219
|
+
readonly type: "content";
|
|
1220
|
+
readonly value: readonly ({
|
|
1221
|
+
readonly type: "text";
|
|
1222
|
+
readonly text: string;
|
|
1223
|
+
} | {
|
|
1224
|
+
readonly type: "file";
|
|
1225
|
+
readonly uri: string;
|
|
1226
|
+
readonly mime: string;
|
|
1227
|
+
readonly name?: string | undefined;
|
|
1228
|
+
})[];
|
|
1229
|
+
}, cases: Handlers): import("effect/Unify").Unify<ReturnType<Handlers["content" | "error" | "json" | "text"]>>;
|
|
1230
|
+
<Handlers extends { [K in "content" | "error" | "json" | "text"]: (value: {
|
|
1231
|
+
readonly content: Schema.Struct<{
|
|
1232
|
+
readonly type: Schema.Literal<"content">;
|
|
1233
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
1234
|
+
readonly type: Schema.Literal<"text">;
|
|
1235
|
+
readonly text: Schema.String;
|
|
1236
|
+
}>, Schema.Struct<{
|
|
1237
|
+
readonly type: Schema.Literal<"file">;
|
|
1238
|
+
readonly uri: Schema.String;
|
|
1239
|
+
readonly mime: Schema.String;
|
|
1240
|
+
readonly name: Schema.optional<Schema.String>;
|
|
1241
|
+
}>]>>;
|
|
1242
|
+
}>;
|
|
1243
|
+
readonly error: Schema.Struct<{
|
|
1244
|
+
readonly type: Schema.Literal<"error">;
|
|
1245
|
+
readonly value: Schema.Unknown;
|
|
1246
|
+
}>;
|
|
1247
|
+
readonly json: Schema.Struct<{
|
|
1248
|
+
readonly type: Schema.Literal<"json">;
|
|
1249
|
+
readonly value: Schema.Unknown;
|
|
1250
|
+
}>;
|
|
1251
|
+
readonly text: Schema.Struct<{
|
|
1252
|
+
readonly type: Schema.Literal<"text">;
|
|
1253
|
+
readonly value: Schema.Unknown;
|
|
1254
|
+
}>;
|
|
1255
|
+
}[K]["Type"]) => any; }>(cases: Handlers): (value: {
|
|
1256
|
+
readonly type: "json";
|
|
1257
|
+
readonly value: unknown;
|
|
1258
|
+
} | {
|
|
1259
|
+
readonly type: "text";
|
|
1260
|
+
readonly value: unknown;
|
|
1261
|
+
} | {
|
|
1262
|
+
readonly type: "error";
|
|
1263
|
+
readonly value: unknown;
|
|
1264
|
+
} | {
|
|
1265
|
+
readonly type: "content";
|
|
1266
|
+
readonly value: readonly ({
|
|
1267
|
+
readonly type: "text";
|
|
1268
|
+
readonly text: string;
|
|
1269
|
+
} | {
|
|
1270
|
+
readonly type: "file";
|
|
1271
|
+
readonly uri: string;
|
|
1272
|
+
readonly mime: string;
|
|
1273
|
+
readonly name?: string | undefined;
|
|
1274
|
+
})[];
|
|
1275
|
+
}) => import("effect/Unify").Unify<ReturnType<Handlers["content" | "error" | "json" | "text"]>>;
|
|
1276
|
+
};
|
|
1277
|
+
readonly matchOrElse: {
|
|
1278
|
+
<Handlers, OrElse>(value: {
|
|
1279
|
+
readonly type: "json";
|
|
1280
|
+
readonly value: unknown;
|
|
1281
|
+
} | {
|
|
1282
|
+
readonly type: "text";
|
|
1283
|
+
readonly value: unknown;
|
|
1284
|
+
} | {
|
|
1285
|
+
readonly type: "error";
|
|
1286
|
+
readonly value: unknown;
|
|
1287
|
+
} | {
|
|
1288
|
+
readonly type: "content";
|
|
1289
|
+
readonly value: readonly ({
|
|
1290
|
+
readonly type: "text";
|
|
1291
|
+
readonly text: string;
|
|
1292
|
+
} | {
|
|
1293
|
+
readonly type: "file";
|
|
1294
|
+
readonly uri: string;
|
|
1295
|
+
readonly mime: string;
|
|
1296
|
+
readonly name?: string | undefined;
|
|
1297
|
+
})[];
|
|
1298
|
+
}, cases: Handlers & {
|
|
1299
|
+
readonly content?: ((value: {
|
|
1300
|
+
readonly type: "content";
|
|
1301
|
+
readonly value: readonly ({
|
|
1302
|
+
readonly type: "text";
|
|
1303
|
+
readonly text: string;
|
|
1304
|
+
} | {
|
|
1305
|
+
readonly type: "file";
|
|
1306
|
+
readonly uri: string;
|
|
1307
|
+
readonly mime: string;
|
|
1308
|
+
readonly name?: string | undefined;
|
|
1309
|
+
})[];
|
|
1310
|
+
}) => any) | undefined;
|
|
1311
|
+
readonly error?: ((value: {
|
|
1312
|
+
readonly type: "error";
|
|
1313
|
+
readonly value: unknown;
|
|
1314
|
+
}) => any) | undefined;
|
|
1315
|
+
readonly json?: ((value: {
|
|
1316
|
+
readonly type: "json";
|
|
1317
|
+
readonly value: unknown;
|
|
1318
|
+
}) => any) | undefined;
|
|
1319
|
+
readonly text?: ((value: {
|
|
1320
|
+
readonly type: "text";
|
|
1321
|
+
readonly value: unknown;
|
|
1322
|
+
}) => any) | undefined;
|
|
1323
|
+
} & (Exclude<keyof Handlers, "content" | "error" | "json" | "text"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
|
|
1324
|
+
readonly type: "json";
|
|
1325
|
+
readonly value: unknown;
|
|
1326
|
+
}, {
|
|
1327
|
+
readonly type: keyof Handlers;
|
|
1328
|
+
}> | Exclude<{
|
|
1329
|
+
readonly type: "text";
|
|
1330
|
+
readonly value: unknown;
|
|
1331
|
+
}, {
|
|
1332
|
+
readonly type: keyof Handlers;
|
|
1333
|
+
}> | Exclude<{
|
|
1334
|
+
readonly type: "error";
|
|
1335
|
+
readonly value: unknown;
|
|
1336
|
+
}, {
|
|
1337
|
+
readonly type: keyof Handlers;
|
|
1338
|
+
}> | Exclude<{
|
|
1339
|
+
readonly type: "content";
|
|
1340
|
+
readonly value: readonly ({
|
|
1341
|
+
readonly type: "text";
|
|
1342
|
+
readonly text: string;
|
|
1343
|
+
} | {
|
|
1344
|
+
readonly type: "file";
|
|
1345
|
+
readonly uri: string;
|
|
1346
|
+
readonly mime: string;
|
|
1347
|
+
readonly name?: string | undefined;
|
|
1348
|
+
})[];
|
|
1349
|
+
}, {
|
|
1350
|
+
readonly type: keyof Handlers;
|
|
1351
|
+
}>) => any)): import("effect/Unify").Unify<{ [K in keyof Handlers]-?: NonNullable<Handlers[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Handlers] | (OrElse extends (...args: Array<any>) => infer R ? R : never)>;
|
|
1352
|
+
<Handlers, OrElse>(cases: Handlers & {
|
|
1353
|
+
readonly content?: ((value: {
|
|
1354
|
+
readonly type: "content";
|
|
1355
|
+
readonly value: readonly ({
|
|
1356
|
+
readonly type: "text";
|
|
1357
|
+
readonly text: string;
|
|
1358
|
+
} | {
|
|
1359
|
+
readonly type: "file";
|
|
1360
|
+
readonly uri: string;
|
|
1361
|
+
readonly mime: string;
|
|
1362
|
+
readonly name?: string | undefined;
|
|
1363
|
+
})[];
|
|
1364
|
+
}) => any) | undefined;
|
|
1365
|
+
readonly error?: ((value: {
|
|
1366
|
+
readonly type: "error";
|
|
1367
|
+
readonly value: unknown;
|
|
1368
|
+
}) => any) | undefined;
|
|
1369
|
+
readonly json?: ((value: {
|
|
1370
|
+
readonly type: "json";
|
|
1371
|
+
readonly value: unknown;
|
|
1372
|
+
}) => any) | undefined;
|
|
1373
|
+
readonly text?: ((value: {
|
|
1374
|
+
readonly type: "text";
|
|
1375
|
+
readonly value: unknown;
|
|
1376
|
+
}) => any) | undefined;
|
|
1377
|
+
} & (Exclude<keyof Handlers, "content" | "error" | "json" | "text"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
|
|
1378
|
+
readonly type: "json";
|
|
1379
|
+
readonly value: unknown;
|
|
1380
|
+
}, {
|
|
1381
|
+
readonly type: keyof Handlers;
|
|
1382
|
+
}> | Exclude<{
|
|
1383
|
+
readonly type: "text";
|
|
1384
|
+
readonly value: unknown;
|
|
1385
|
+
}, {
|
|
1386
|
+
readonly type: keyof Handlers;
|
|
1387
|
+
}> | Exclude<{
|
|
1388
|
+
readonly type: "error";
|
|
1389
|
+
readonly value: unknown;
|
|
1390
|
+
}, {
|
|
1391
|
+
readonly type: keyof Handlers;
|
|
1392
|
+
}> | Exclude<{
|
|
1393
|
+
readonly type: "content";
|
|
1394
|
+
readonly value: readonly ({
|
|
1395
|
+
readonly type: "text";
|
|
1396
|
+
readonly text: string;
|
|
1397
|
+
} | {
|
|
1398
|
+
readonly type: "file";
|
|
1399
|
+
readonly uri: string;
|
|
1400
|
+
readonly mime: string;
|
|
1401
|
+
readonly name?: string | undefined;
|
|
1402
|
+
})[];
|
|
1403
|
+
}, {
|
|
1404
|
+
readonly type: keyof Handlers;
|
|
1405
|
+
}>) => any)): (value: {
|
|
1406
|
+
readonly type: "json";
|
|
1407
|
+
readonly value: unknown;
|
|
1408
|
+
} | {
|
|
1409
|
+
readonly type: "text";
|
|
1410
|
+
readonly value: unknown;
|
|
1411
|
+
} | {
|
|
1412
|
+
readonly type: "error";
|
|
1413
|
+
readonly value: unknown;
|
|
1414
|
+
} | {
|
|
1415
|
+
readonly type: "content";
|
|
1416
|
+
readonly value: readonly ({
|
|
1417
|
+
readonly type: "text";
|
|
1418
|
+
readonly text: string;
|
|
1419
|
+
} | {
|
|
1420
|
+
readonly type: "file";
|
|
1421
|
+
readonly uri: string;
|
|
1422
|
+
readonly mime: string;
|
|
1423
|
+
readonly name?: string | undefined;
|
|
1424
|
+
})[];
|
|
1425
|
+
}) => import("effect/Unify").Unify<{ [K in keyof Handlers]-?: NonNullable<Handlers[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Handlers] | (OrElse extends (...args: Array<any>) => infer R ? R : never)>;
|
|
1426
|
+
};
|
|
1427
|
+
} & {
|
|
1428
|
+
make: (value: unknown, type?: ToolResultValue["type"]) => ToolResultValue;
|
|
1429
|
+
};
|
|
1430
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
1431
|
+
readonly cache: Schema.optional<typeof CacheHint>;
|
|
1432
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1433
|
+
}> & {
|
|
1434
|
+
make: (input: Omit<ToolResultPart, "type" | "result"> & {
|
|
1435
|
+
readonly result: unknown;
|
|
1436
|
+
readonly resultType?: ToolResultValue["type"];
|
|
1437
|
+
}) => ToolResultPart;
|
|
1438
|
+
}, Schema.Codec<{
|
|
1439
|
+
readonly type: "reasoning";
|
|
1440
|
+
readonly text: string;
|
|
1441
|
+
readonly encrypted?: string | undefined;
|
|
1442
|
+
readonly cache?: CacheHint | undefined;
|
|
1443
|
+
readonly providerMetadata?: {
|
|
1444
|
+
readonly [x: string]: {
|
|
1445
|
+
readonly [x: string]: unknown;
|
|
1446
|
+
};
|
|
1447
|
+
} | undefined;
|
|
1448
|
+
}, {
|
|
1449
|
+
readonly type: "reasoning";
|
|
1450
|
+
readonly text: string;
|
|
1451
|
+
readonly encrypted?: string | undefined;
|
|
1452
|
+
readonly cache?: {
|
|
1453
|
+
readonly type: "ephemeral" | "persistent";
|
|
1454
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
1455
|
+
} | undefined;
|
|
1456
|
+
readonly providerMetadata?: {
|
|
1457
|
+
readonly [x: string]: {
|
|
1458
|
+
readonly [x: string]: unknown;
|
|
1459
|
+
};
|
|
1460
|
+
} | undefined;
|
|
1461
|
+
}, never, never> & {
|
|
1462
|
+
readonly make: (text: string, options?: Omit<ReasoningPart, "type" | "text">) => ReasoningPart;
|
|
1463
|
+
}, Schema.refine<{
|
|
1464
|
+
readonly type: "compaction";
|
|
1465
|
+
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
1466
|
+
readonly id?: string | undefined;
|
|
1467
|
+
readonly encrypted?: string | undefined;
|
|
1468
|
+
readonly text?: string | null | undefined;
|
|
1469
|
+
} & CompactionContent, Schema.Struct<{
|
|
1470
|
+
readonly type: Schema.Literal<"compaction">;
|
|
1471
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
1472
|
+
readonly id: Schema.optional<Schema.String>;
|
|
1473
|
+
readonly encrypted: Schema.optional<Schema.String>;
|
|
1474
|
+
/** Null means the provider failed to produce a summary; prior history must be retained. */
|
|
1475
|
+
readonly text: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
1476
|
+
}>> & {
|
|
1477
|
+
make: (input: Omit<CompactionPart, "type" | "encrypted" | "text"> & CompactionContent) => CompactionPart;
|
|
1478
|
+
}, Schema.Codec<{
|
|
1479
|
+
readonly type: "effort";
|
|
1480
|
+
readonly effort?: ReasoningEffort | undefined;
|
|
1481
|
+
readonly previous?: ReasoningEffort | undefined;
|
|
1482
|
+
}, {
|
|
1483
|
+
readonly type: "effort";
|
|
1484
|
+
readonly effort?: ReasoningEffort | undefined;
|
|
1485
|
+
readonly previous?: ReasoningEffort | undefined;
|
|
1486
|
+
}, never, never> & {
|
|
1487
|
+
readonly make: (input?: Omit<EffortPart, "type">) => EffortPart;
|
|
1488
|
+
}]>;
|
|
1489
|
+
export type ContentPart = Schema.Schema.Type<typeof ContentPart>;
|
|
1490
|
+
/** Tools changed here: `add` appends or redefines tools by name, `remove` drops them by name. */
|
|
1491
|
+
export declare const ToolChanges: Schema.Struct<{
|
|
1492
|
+
readonly add: Schema.$Array<Schema.suspend<Schema.Codec<ToolEntry, ToolEntry, never, never>>>;
|
|
1493
|
+
readonly remove: Schema.$Array<Schema.String>;
|
|
1494
|
+
}>;
|
|
1495
|
+
export type ToolChanges = Schema.Schema.Type<typeof ToolChanges>;
|
|
1496
|
+
declare const SystemMessage_base: Schema.Class<SystemMessage, Schema.Struct<{
|
|
1497
|
+
readonly id: Schema.optional<Schema.String>;
|
|
1498
|
+
readonly role: Schema.Literal<"system">;
|
|
1499
|
+
readonly content: Schema.$Array<Schema.toTaggedUnion<"type", readonly [Schema.Codec<{
|
|
1500
|
+
readonly type: "text";
|
|
1501
|
+
readonly text: string;
|
|
1502
|
+
readonly cache?: CacheHint | undefined;
|
|
1503
|
+
readonly providerMetadata?: {
|
|
1504
|
+
readonly [x: string]: {
|
|
1505
|
+
readonly [x: string]: unknown;
|
|
1506
|
+
};
|
|
1507
|
+
} | undefined;
|
|
1508
|
+
}, {
|
|
1509
|
+
readonly type: "text";
|
|
1510
|
+
readonly text: string;
|
|
1511
|
+
readonly cache?: {
|
|
1512
|
+
readonly type: "ephemeral" | "persistent";
|
|
1513
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
1514
|
+
} | undefined;
|
|
1515
|
+
readonly providerMetadata?: {
|
|
1516
|
+
readonly [x: string]: {
|
|
1517
|
+
readonly [x: string]: unknown;
|
|
1518
|
+
};
|
|
1519
|
+
} | undefined;
|
|
1520
|
+
}, never, never> & {
|
|
1521
|
+
readonly make: (text: string, options?: Omit<TextPart, "type" | "text">) => TextPart;
|
|
1522
|
+
}, Schema.Codec<{
|
|
1523
|
+
readonly type: "effort";
|
|
1524
|
+
readonly effort?: ReasoningEffort | undefined;
|
|
1525
|
+
readonly previous?: ReasoningEffort | undefined;
|
|
1526
|
+
}, {
|
|
1527
|
+
readonly type: "effort";
|
|
1528
|
+
readonly effort?: ReasoningEffort | undefined;
|
|
1529
|
+
readonly previous?: ReasoningEffort | undefined;
|
|
1530
|
+
}, never, never> & {
|
|
1531
|
+
readonly make: (input?: Omit<EffortPart, "type">) => EffortPart;
|
|
1532
|
+
}]>>;
|
|
1533
|
+
readonly tools: Schema.optional<Schema.Struct<{
|
|
1534
|
+
readonly add: Schema.$Array<Schema.suspend<Schema.Codec<ToolEntry, ToolEntry, never, never>>>;
|
|
1535
|
+
readonly remove: Schema.$Array<Schema.String>;
|
|
1536
|
+
}>>;
|
|
1537
|
+
}>, {}>;
|
|
1538
|
+
export declare class SystemMessage extends SystemMessage_base {
|
|
1539
|
+
}
|
|
1540
|
+
declare const UserMessage_base: Schema.Class<UserMessage, Schema.Struct<{
|
|
1541
|
+
readonly id: Schema.optional<Schema.String>;
|
|
1542
|
+
readonly role: Schema.Literal<"user">;
|
|
1543
|
+
readonly content: Schema.$Array<Schema.toTaggedUnion<"type", readonly [Schema.Codec<{
|
|
1544
|
+
readonly type: "text";
|
|
1545
|
+
readonly text: string;
|
|
1546
|
+
readonly cache?: CacheHint | undefined;
|
|
1547
|
+
readonly providerMetadata?: {
|
|
1548
|
+
readonly [x: string]: {
|
|
1549
|
+
readonly [x: string]: unknown;
|
|
1550
|
+
};
|
|
1551
|
+
} | undefined;
|
|
1552
|
+
}, {
|
|
1553
|
+
readonly type: "text";
|
|
1554
|
+
readonly text: string;
|
|
1555
|
+
readonly cache?: {
|
|
1556
|
+
readonly type: "ephemeral" | "persistent";
|
|
1557
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
1558
|
+
} | undefined;
|
|
1559
|
+
readonly providerMetadata?: {
|
|
1560
|
+
readonly [x: string]: {
|
|
1561
|
+
readonly [x: string]: unknown;
|
|
1562
|
+
};
|
|
1563
|
+
} | undefined;
|
|
1564
|
+
}, never, never> & {
|
|
1565
|
+
readonly make: (text: string, options?: Omit<TextPart, "type" | "text">) => TextPart;
|
|
1566
|
+
}, Schema.Struct<{
|
|
1567
|
+
readonly type: Schema.Literal<"media">;
|
|
1568
|
+
readonly media: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
1569
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
1570
|
+
readonly type: Schema.Literal<"bytes">;
|
|
1571
|
+
readonly data: Schema.Uint8Array;
|
|
1572
|
+
readonly mediaType: Schema.String;
|
|
1573
|
+
}>, Schema.Struct<{
|
|
1574
|
+
readonly type: Schema.Literal<"base64">;
|
|
1575
|
+
readonly data: Schema.String;
|
|
1576
|
+
readonly mediaType: Schema.String;
|
|
1577
|
+
}>, Schema.Struct<{
|
|
1578
|
+
readonly type: Schema.Literal<"url">;
|
|
1579
|
+
readonly url: Schema.String;
|
|
1580
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
1581
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
1582
|
+
}>, Schema.Struct<{
|
|
1583
|
+
readonly type: Schema.Literal<"ref">;
|
|
1584
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
1585
|
+
readonly id: Schema.String;
|
|
1586
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
1587
|
+
}>]>;
|
|
1588
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
1589
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
1590
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
1591
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
1592
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
1593
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
1594
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
1595
|
+
readonly format: Schema.optional<Schema.String>;
|
|
1596
|
+
}>>;
|
|
1597
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1598
|
+
}>, never, never>;
|
|
1599
|
+
readonly filename: Schema.optional<Schema.String>;
|
|
1600
|
+
readonly cache: Schema.optional<typeof CacheHint>;
|
|
1601
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1602
|
+
}> & {
|
|
1603
|
+
make: (media: MediaPartInput["media"], options?: Omit<MediaPartInput, "type" | "media">) => MediaPart;
|
|
1604
|
+
}]>>;
|
|
1605
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1606
|
+
}>, {}>;
|
|
1607
|
+
export declare class UserMessage extends UserMessage_base {
|
|
1608
|
+
}
|
|
1609
|
+
declare const AssistantMessage_base: Schema.Class<AssistantMessage, Schema.Struct<{
|
|
1610
|
+
readonly id: Schema.optional<Schema.String>;
|
|
1611
|
+
readonly role: Schema.Literal<"assistant">;
|
|
1612
|
+
readonly content: Schema.$Array<Schema.toTaggedUnion<"type", readonly [Schema.Codec<{
|
|
1613
|
+
readonly type: "text";
|
|
1614
|
+
readonly text: string;
|
|
1615
|
+
readonly cache?: CacheHint | undefined;
|
|
1616
|
+
readonly providerMetadata?: {
|
|
1617
|
+
readonly [x: string]: {
|
|
1618
|
+
readonly [x: string]: unknown;
|
|
1619
|
+
};
|
|
1620
|
+
} | undefined;
|
|
1621
|
+
}, {
|
|
1622
|
+
readonly type: "text";
|
|
1623
|
+
readonly text: string;
|
|
1624
|
+
readonly cache?: {
|
|
1625
|
+
readonly type: "ephemeral" | "persistent";
|
|
1626
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
1627
|
+
} | undefined;
|
|
1628
|
+
readonly providerMetadata?: {
|
|
1629
|
+
readonly [x: string]: {
|
|
1630
|
+
readonly [x: string]: unknown;
|
|
1631
|
+
};
|
|
1632
|
+
} | undefined;
|
|
1633
|
+
}, never, never> & {
|
|
1634
|
+
readonly make: (text: string, options?: Omit<TextPart, "type" | "text">) => TextPart;
|
|
1635
|
+
}, Schema.Codec<{
|
|
1636
|
+
readonly type: "reasoning";
|
|
1637
|
+
readonly text: string;
|
|
1638
|
+
readonly encrypted?: string | undefined;
|
|
1639
|
+
readonly cache?: CacheHint | undefined;
|
|
1640
|
+
readonly providerMetadata?: {
|
|
1641
|
+
readonly [x: string]: {
|
|
1642
|
+
readonly [x: string]: unknown;
|
|
1643
|
+
};
|
|
1644
|
+
} | undefined;
|
|
1645
|
+
}, {
|
|
1646
|
+
readonly type: "reasoning";
|
|
1647
|
+
readonly text: string;
|
|
1648
|
+
readonly encrypted?: string | undefined;
|
|
1649
|
+
readonly cache?: {
|
|
1650
|
+
readonly type: "ephemeral" | "persistent";
|
|
1651
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
1652
|
+
} | undefined;
|
|
1653
|
+
readonly providerMetadata?: {
|
|
1654
|
+
readonly [x: string]: {
|
|
1655
|
+
readonly [x: string]: unknown;
|
|
1656
|
+
};
|
|
1657
|
+
} | undefined;
|
|
1658
|
+
}, never, never> & {
|
|
1659
|
+
readonly make: (text: string, options?: Omit<ReasoningPart, "type" | "text">) => ReasoningPart;
|
|
1660
|
+
}, Schema.Struct<{
|
|
1661
|
+
readonly type: Schema.Literal<"tool-call">;
|
|
1662
|
+
readonly id: Schema.String;
|
|
1663
|
+
readonly name: Schema.String;
|
|
1664
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
1665
|
+
readonly input: Schema.Unknown;
|
|
1666
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
1667
|
+
readonly cache: Schema.optional<typeof CacheHint>;
|
|
1668
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1669
|
+
}> & {
|
|
1670
|
+
make: (input: Omit<ToolCallPart, "type">) => ToolCallPart;
|
|
1671
|
+
}, Schema.Struct<{
|
|
1672
|
+
readonly type: Schema.Literal<"tool-result">;
|
|
1673
|
+
readonly id: Schema.String;
|
|
1674
|
+
readonly name: Schema.String;
|
|
1675
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
1676
|
+
readonly result: Schema.Union<readonly [Schema.Struct<{
|
|
1677
|
+
readonly type: Schema.Literal<"json">;
|
|
1678
|
+
readonly value: Schema.Unknown;
|
|
1679
|
+
}>, Schema.Struct<{
|
|
1680
|
+
readonly type: Schema.Literal<"text">;
|
|
1681
|
+
readonly value: Schema.Unknown;
|
|
1682
|
+
}>, Schema.Struct<{
|
|
1683
|
+
readonly type: Schema.Literal<"error">;
|
|
1684
|
+
readonly value: Schema.Unknown;
|
|
1685
|
+
}>, Schema.Struct<{
|
|
1686
|
+
readonly type: Schema.Literal<"content">;
|
|
1687
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
1688
|
+
readonly type: Schema.Literal<"text">;
|
|
1689
|
+
readonly text: Schema.String;
|
|
1690
|
+
}>, Schema.Struct<{
|
|
1691
|
+
readonly type: Schema.Literal<"file">;
|
|
1692
|
+
readonly uri: Schema.String;
|
|
1693
|
+
readonly mime: Schema.String;
|
|
1694
|
+
readonly name: Schema.optional<Schema.String>;
|
|
1695
|
+
}>]>>;
|
|
1696
|
+
}>]> & {
|
|
1697
|
+
readonly tag: "type";
|
|
1698
|
+
readonly discriminants: readonly ["json", "text", "error", "content"];
|
|
1699
|
+
readonly cases: {
|
|
1700
|
+
content: Schema.Struct<{
|
|
1701
|
+
readonly type: Schema.Literal<"content">;
|
|
1702
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
1703
|
+
readonly type: Schema.Literal<"text">;
|
|
1704
|
+
readonly text: Schema.String;
|
|
1705
|
+
}>, Schema.Struct<{
|
|
1706
|
+
readonly type: Schema.Literal<"file">;
|
|
1707
|
+
readonly uri: Schema.String;
|
|
1708
|
+
readonly mime: Schema.String;
|
|
1709
|
+
readonly name: Schema.optional<Schema.String>;
|
|
1710
|
+
}>]>>;
|
|
1711
|
+
}>;
|
|
1712
|
+
error: Schema.Struct<{
|
|
1713
|
+
readonly type: Schema.Literal<"error">;
|
|
1714
|
+
readonly value: Schema.Unknown;
|
|
1715
|
+
}>;
|
|
1716
|
+
json: Schema.Struct<{
|
|
1717
|
+
readonly type: Schema.Literal<"json">;
|
|
1718
|
+
readonly value: Schema.Unknown;
|
|
1719
|
+
}>;
|
|
1720
|
+
text: Schema.Struct<{
|
|
1721
|
+
readonly type: Schema.Literal<"text">;
|
|
1722
|
+
readonly value: Schema.Unknown;
|
|
1723
|
+
}>;
|
|
1724
|
+
};
|
|
1725
|
+
readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
|
|
1726
|
+
readonly type: "json";
|
|
1727
|
+
readonly value: unknown;
|
|
1728
|
+
} | {
|
|
1729
|
+
readonly type: "text";
|
|
1730
|
+
readonly value: unknown;
|
|
1731
|
+
} | {
|
|
1732
|
+
readonly type: "error";
|
|
1733
|
+
readonly value: unknown;
|
|
1734
|
+
} | {
|
|
1735
|
+
readonly type: "content";
|
|
1736
|
+
readonly value: readonly ({
|
|
1737
|
+
readonly type: "text";
|
|
1738
|
+
readonly text: string;
|
|
1739
|
+
} | {
|
|
1740
|
+
readonly type: "file";
|
|
1741
|
+
readonly uri: string;
|
|
1742
|
+
readonly mime: string;
|
|
1743
|
+
readonly name?: string | undefined;
|
|
1744
|
+
})[];
|
|
1745
|
+
}) => value is Extract<{
|
|
1746
|
+
readonly type: "json";
|
|
1747
|
+
readonly value: unknown;
|
|
1748
|
+
}, {
|
|
1749
|
+
readonly type: Keys;
|
|
1750
|
+
}> | Extract<{
|
|
1751
|
+
readonly type: "text";
|
|
1752
|
+
readonly value: unknown;
|
|
1753
|
+
}, {
|
|
1754
|
+
readonly type: Keys;
|
|
1755
|
+
}> | Extract<{
|
|
1756
|
+
readonly type: "error";
|
|
1757
|
+
readonly value: unknown;
|
|
1758
|
+
}, {
|
|
1759
|
+
readonly type: Keys;
|
|
1760
|
+
}> | Extract<{
|
|
1761
|
+
readonly type: "content";
|
|
1762
|
+
readonly value: readonly ({
|
|
1763
|
+
readonly type: "text";
|
|
1764
|
+
readonly text: string;
|
|
1765
|
+
} | {
|
|
1766
|
+
readonly type: "file";
|
|
1767
|
+
readonly uri: string;
|
|
1768
|
+
readonly mime: string;
|
|
1769
|
+
readonly name?: string | undefined;
|
|
1770
|
+
})[];
|
|
1771
|
+
}, {
|
|
1772
|
+
readonly type: Keys;
|
|
1773
|
+
}>;
|
|
1774
|
+
readonly guards: {
|
|
1775
|
+
content: (u: unknown) => u is {
|
|
1776
|
+
readonly type: "content";
|
|
1777
|
+
readonly value: readonly ({
|
|
1778
|
+
readonly type: "text";
|
|
1779
|
+
readonly text: string;
|
|
1780
|
+
} | {
|
|
1781
|
+
readonly type: "file";
|
|
1782
|
+
readonly uri: string;
|
|
1783
|
+
readonly mime: string;
|
|
1784
|
+
readonly name?: string | undefined;
|
|
1785
|
+
})[];
|
|
1786
|
+
};
|
|
1787
|
+
error: (u: unknown) => u is {
|
|
1788
|
+
readonly type: "error";
|
|
1789
|
+
readonly value: unknown;
|
|
1790
|
+
};
|
|
1791
|
+
json: (u: unknown) => u is {
|
|
1792
|
+
readonly type: "json";
|
|
1793
|
+
readonly value: unknown;
|
|
1794
|
+
};
|
|
1795
|
+
text: (u: unknown) => u is {
|
|
1796
|
+
readonly type: "text";
|
|
1797
|
+
readonly value: unknown;
|
|
1798
|
+
};
|
|
1799
|
+
};
|
|
1800
|
+
readonly match: {
|
|
1801
|
+
<Handlers extends { [K in "content" | "error" | "json" | "text"]: (value: {
|
|
1802
|
+
readonly content: Schema.Struct<{
|
|
1803
|
+
readonly type: Schema.Literal<"content">;
|
|
1804
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
1805
|
+
readonly type: Schema.Literal<"text">;
|
|
1806
|
+
readonly text: Schema.String;
|
|
1807
|
+
}>, Schema.Struct<{
|
|
1808
|
+
readonly type: Schema.Literal<"file">;
|
|
1809
|
+
readonly uri: Schema.String;
|
|
1810
|
+
readonly mime: Schema.String;
|
|
1811
|
+
readonly name: Schema.optional<Schema.String>;
|
|
1812
|
+
}>]>>;
|
|
1813
|
+
}>;
|
|
1814
|
+
readonly error: Schema.Struct<{
|
|
1815
|
+
readonly type: Schema.Literal<"error">;
|
|
1816
|
+
readonly value: Schema.Unknown;
|
|
1817
|
+
}>;
|
|
1818
|
+
readonly json: Schema.Struct<{
|
|
1819
|
+
readonly type: Schema.Literal<"json">;
|
|
1820
|
+
readonly value: Schema.Unknown;
|
|
1821
|
+
}>;
|
|
1822
|
+
readonly text: Schema.Struct<{
|
|
1823
|
+
readonly type: Schema.Literal<"text">;
|
|
1824
|
+
readonly value: Schema.Unknown;
|
|
1825
|
+
}>;
|
|
1826
|
+
}[K]["Type"]) => any; }>(value: {
|
|
1827
|
+
readonly type: "json";
|
|
1828
|
+
readonly value: unknown;
|
|
1829
|
+
} | {
|
|
1830
|
+
readonly type: "text";
|
|
1831
|
+
readonly value: unknown;
|
|
1832
|
+
} | {
|
|
1833
|
+
readonly type: "error";
|
|
1834
|
+
readonly value: unknown;
|
|
1835
|
+
} | {
|
|
1836
|
+
readonly type: "content";
|
|
1837
|
+
readonly value: readonly ({
|
|
1838
|
+
readonly type: "text";
|
|
1839
|
+
readonly text: string;
|
|
1840
|
+
} | {
|
|
1841
|
+
readonly type: "file";
|
|
1842
|
+
readonly uri: string;
|
|
1843
|
+
readonly mime: string;
|
|
1844
|
+
readonly name?: string | undefined;
|
|
1845
|
+
})[];
|
|
1846
|
+
}, cases: Handlers): import("effect/Unify").Unify<ReturnType<Handlers["content" | "error" | "json" | "text"]>>;
|
|
1847
|
+
<Handlers extends { [K in "content" | "error" | "json" | "text"]: (value: {
|
|
1848
|
+
readonly content: Schema.Struct<{
|
|
1849
|
+
readonly type: Schema.Literal<"content">;
|
|
1850
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
1851
|
+
readonly type: Schema.Literal<"text">;
|
|
1852
|
+
readonly text: Schema.String;
|
|
1853
|
+
}>, Schema.Struct<{
|
|
1854
|
+
readonly type: Schema.Literal<"file">;
|
|
1855
|
+
readonly uri: Schema.String;
|
|
1856
|
+
readonly mime: Schema.String;
|
|
1857
|
+
readonly name: Schema.optional<Schema.String>;
|
|
1858
|
+
}>]>>;
|
|
1859
|
+
}>;
|
|
1860
|
+
readonly error: Schema.Struct<{
|
|
1861
|
+
readonly type: Schema.Literal<"error">;
|
|
1862
|
+
readonly value: Schema.Unknown;
|
|
1863
|
+
}>;
|
|
1864
|
+
readonly json: Schema.Struct<{
|
|
1865
|
+
readonly type: Schema.Literal<"json">;
|
|
1866
|
+
readonly value: Schema.Unknown;
|
|
1867
|
+
}>;
|
|
1868
|
+
readonly text: Schema.Struct<{
|
|
1869
|
+
readonly type: Schema.Literal<"text">;
|
|
1870
|
+
readonly value: Schema.Unknown;
|
|
1871
|
+
}>;
|
|
1872
|
+
}[K]["Type"]) => any; }>(cases: Handlers): (value: {
|
|
1873
|
+
readonly type: "json";
|
|
1874
|
+
readonly value: unknown;
|
|
1875
|
+
} | {
|
|
1876
|
+
readonly type: "text";
|
|
1877
|
+
readonly value: unknown;
|
|
1878
|
+
} | {
|
|
1879
|
+
readonly type: "error";
|
|
1880
|
+
readonly value: unknown;
|
|
1881
|
+
} | {
|
|
1882
|
+
readonly type: "content";
|
|
1883
|
+
readonly value: readonly ({
|
|
1884
|
+
readonly type: "text";
|
|
1885
|
+
readonly text: string;
|
|
1886
|
+
} | {
|
|
1887
|
+
readonly type: "file";
|
|
1888
|
+
readonly uri: string;
|
|
1889
|
+
readonly mime: string;
|
|
1890
|
+
readonly name?: string | undefined;
|
|
1891
|
+
})[];
|
|
1892
|
+
}) => import("effect/Unify").Unify<ReturnType<Handlers["content" | "error" | "json" | "text"]>>;
|
|
1893
|
+
};
|
|
1894
|
+
readonly matchOrElse: {
|
|
1895
|
+
<Handlers, OrElse>(value: {
|
|
1896
|
+
readonly type: "json";
|
|
1897
|
+
readonly value: unknown;
|
|
1898
|
+
} | {
|
|
1899
|
+
readonly type: "text";
|
|
1900
|
+
readonly value: unknown;
|
|
1901
|
+
} | {
|
|
1902
|
+
readonly type: "error";
|
|
1903
|
+
readonly value: unknown;
|
|
1904
|
+
} | {
|
|
1905
|
+
readonly type: "content";
|
|
1906
|
+
readonly value: readonly ({
|
|
1907
|
+
readonly type: "text";
|
|
1908
|
+
readonly text: string;
|
|
1909
|
+
} | {
|
|
1910
|
+
readonly type: "file";
|
|
1911
|
+
readonly uri: string;
|
|
1912
|
+
readonly mime: string;
|
|
1913
|
+
readonly name?: string | undefined;
|
|
1914
|
+
})[];
|
|
1915
|
+
}, cases: Handlers & {
|
|
1916
|
+
readonly content?: ((value: {
|
|
1917
|
+
readonly type: "content";
|
|
1918
|
+
readonly value: readonly ({
|
|
1919
|
+
readonly type: "text";
|
|
1920
|
+
readonly text: string;
|
|
1921
|
+
} | {
|
|
1922
|
+
readonly type: "file";
|
|
1923
|
+
readonly uri: string;
|
|
1924
|
+
readonly mime: string;
|
|
1925
|
+
readonly name?: string | undefined;
|
|
1926
|
+
})[];
|
|
1927
|
+
}) => any) | undefined;
|
|
1928
|
+
readonly error?: ((value: {
|
|
1929
|
+
readonly type: "error";
|
|
1930
|
+
readonly value: unknown;
|
|
1931
|
+
}) => any) | undefined;
|
|
1932
|
+
readonly json?: ((value: {
|
|
1933
|
+
readonly type: "json";
|
|
1934
|
+
readonly value: unknown;
|
|
1935
|
+
}) => any) | undefined;
|
|
1936
|
+
readonly text?: ((value: {
|
|
1937
|
+
readonly type: "text";
|
|
1938
|
+
readonly value: unknown;
|
|
1939
|
+
}) => any) | undefined;
|
|
1940
|
+
} & (Exclude<keyof Handlers, "content" | "error" | "json" | "text"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
|
|
1941
|
+
readonly type: "json";
|
|
1942
|
+
readonly value: unknown;
|
|
1943
|
+
}, {
|
|
1944
|
+
readonly type: keyof Handlers;
|
|
1945
|
+
}> | Exclude<{
|
|
1946
|
+
readonly type: "text";
|
|
1947
|
+
readonly value: unknown;
|
|
1948
|
+
}, {
|
|
1949
|
+
readonly type: keyof Handlers;
|
|
1950
|
+
}> | Exclude<{
|
|
1951
|
+
readonly type: "error";
|
|
1952
|
+
readonly value: unknown;
|
|
1953
|
+
}, {
|
|
1954
|
+
readonly type: keyof Handlers;
|
|
1955
|
+
}> | Exclude<{
|
|
1956
|
+
readonly type: "content";
|
|
1957
|
+
readonly value: readonly ({
|
|
1958
|
+
readonly type: "text";
|
|
1959
|
+
readonly text: string;
|
|
1960
|
+
} | {
|
|
1961
|
+
readonly type: "file";
|
|
1962
|
+
readonly uri: string;
|
|
1963
|
+
readonly mime: string;
|
|
1964
|
+
readonly name?: string | undefined;
|
|
1965
|
+
})[];
|
|
1966
|
+
}, {
|
|
1967
|
+
readonly type: keyof Handlers;
|
|
1968
|
+
}>) => any)): import("effect/Unify").Unify<{ [K in keyof Handlers]-?: NonNullable<Handlers[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Handlers] | (OrElse extends (...args: Array<any>) => infer R ? R : never)>;
|
|
1969
|
+
<Handlers, OrElse>(cases: Handlers & {
|
|
1970
|
+
readonly content?: ((value: {
|
|
1971
|
+
readonly type: "content";
|
|
1972
|
+
readonly value: readonly ({
|
|
1973
|
+
readonly type: "text";
|
|
1974
|
+
readonly text: string;
|
|
1975
|
+
} | {
|
|
1976
|
+
readonly type: "file";
|
|
1977
|
+
readonly uri: string;
|
|
1978
|
+
readonly mime: string;
|
|
1979
|
+
readonly name?: string | undefined;
|
|
1980
|
+
})[];
|
|
1981
|
+
}) => any) | undefined;
|
|
1982
|
+
readonly error?: ((value: {
|
|
1983
|
+
readonly type: "error";
|
|
1984
|
+
readonly value: unknown;
|
|
1985
|
+
}) => any) | undefined;
|
|
1986
|
+
readonly json?: ((value: {
|
|
1987
|
+
readonly type: "json";
|
|
1988
|
+
readonly value: unknown;
|
|
1989
|
+
}) => any) | undefined;
|
|
1990
|
+
readonly text?: ((value: {
|
|
1991
|
+
readonly type: "text";
|
|
1992
|
+
readonly value: unknown;
|
|
1993
|
+
}) => any) | undefined;
|
|
1994
|
+
} & (Exclude<keyof Handlers, "content" | "error" | "json" | "text"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
|
|
1995
|
+
readonly type: "json";
|
|
1996
|
+
readonly value: unknown;
|
|
1997
|
+
}, {
|
|
1998
|
+
readonly type: keyof Handlers;
|
|
1999
|
+
}> | Exclude<{
|
|
2000
|
+
readonly type: "text";
|
|
2001
|
+
readonly value: unknown;
|
|
2002
|
+
}, {
|
|
2003
|
+
readonly type: keyof Handlers;
|
|
2004
|
+
}> | Exclude<{
|
|
2005
|
+
readonly type: "error";
|
|
2006
|
+
readonly value: unknown;
|
|
2007
|
+
}, {
|
|
2008
|
+
readonly type: keyof Handlers;
|
|
2009
|
+
}> | Exclude<{
|
|
2010
|
+
readonly type: "content";
|
|
2011
|
+
readonly value: readonly ({
|
|
2012
|
+
readonly type: "text";
|
|
2013
|
+
readonly text: string;
|
|
2014
|
+
} | {
|
|
2015
|
+
readonly type: "file";
|
|
2016
|
+
readonly uri: string;
|
|
2017
|
+
readonly mime: string;
|
|
2018
|
+
readonly name?: string | undefined;
|
|
2019
|
+
})[];
|
|
2020
|
+
}, {
|
|
2021
|
+
readonly type: keyof Handlers;
|
|
2022
|
+
}>) => any)): (value: {
|
|
2023
|
+
readonly type: "json";
|
|
2024
|
+
readonly value: unknown;
|
|
2025
|
+
} | {
|
|
2026
|
+
readonly type: "text";
|
|
2027
|
+
readonly value: unknown;
|
|
2028
|
+
} | {
|
|
2029
|
+
readonly type: "error";
|
|
2030
|
+
readonly value: unknown;
|
|
2031
|
+
} | {
|
|
2032
|
+
readonly type: "content";
|
|
2033
|
+
readonly value: readonly ({
|
|
2034
|
+
readonly type: "text";
|
|
2035
|
+
readonly text: string;
|
|
2036
|
+
} | {
|
|
2037
|
+
readonly type: "file";
|
|
2038
|
+
readonly uri: string;
|
|
2039
|
+
readonly mime: string;
|
|
2040
|
+
readonly name?: string | undefined;
|
|
2041
|
+
})[];
|
|
2042
|
+
}) => import("effect/Unify").Unify<{ [K in keyof Handlers]-?: NonNullable<Handlers[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Handlers] | (OrElse extends (...args: Array<any>) => infer R ? R : never)>;
|
|
2043
|
+
};
|
|
2044
|
+
} & {
|
|
2045
|
+
make: (value: unknown, type?: ToolResultValue["type"]) => ToolResultValue;
|
|
2046
|
+
};
|
|
2047
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
2048
|
+
readonly cache: Schema.optional<typeof CacheHint>;
|
|
2049
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2050
|
+
}> & {
|
|
2051
|
+
make: (input: Omit<ToolResultPart, "type" | "result"> & {
|
|
2052
|
+
readonly result: unknown;
|
|
2053
|
+
readonly resultType?: ToolResultValue["type"];
|
|
2054
|
+
}) => ToolResultPart;
|
|
2055
|
+
}, Schema.Struct<{
|
|
2056
|
+
readonly type: Schema.Literal<"media">;
|
|
2057
|
+
readonly media: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
2058
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
2059
|
+
readonly type: Schema.Literal<"bytes">;
|
|
2060
|
+
readonly data: Schema.Uint8Array;
|
|
2061
|
+
readonly mediaType: Schema.String;
|
|
2062
|
+
}>, Schema.Struct<{
|
|
2063
|
+
readonly type: Schema.Literal<"base64">;
|
|
2064
|
+
readonly data: Schema.String;
|
|
2065
|
+
readonly mediaType: Schema.String;
|
|
2066
|
+
}>, Schema.Struct<{
|
|
2067
|
+
readonly type: Schema.Literal<"url">;
|
|
2068
|
+
readonly url: Schema.String;
|
|
2069
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
2070
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
2071
|
+
}>, Schema.Struct<{
|
|
2072
|
+
readonly type: Schema.Literal<"ref">;
|
|
2073
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
2074
|
+
readonly id: Schema.String;
|
|
2075
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
2076
|
+
}>]>;
|
|
2077
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
2078
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
2079
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
2080
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
2081
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
2082
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
2083
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
2084
|
+
readonly format: Schema.optional<Schema.String>;
|
|
2085
|
+
}>>;
|
|
2086
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2087
|
+
}>, never, never>;
|
|
2088
|
+
readonly filename: Schema.optional<Schema.String>;
|
|
2089
|
+
readonly cache: Schema.optional<typeof CacheHint>;
|
|
2090
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2091
|
+
}> & {
|
|
2092
|
+
make: (media: MediaPartInput["media"], options?: Omit<MediaPartInput, "type" | "media">) => MediaPart;
|
|
2093
|
+
}, Schema.refine<{
|
|
2094
|
+
readonly type: "compaction";
|
|
2095
|
+
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
2096
|
+
readonly id?: string | undefined;
|
|
2097
|
+
readonly encrypted?: string | undefined;
|
|
2098
|
+
readonly text?: string | null | undefined;
|
|
2099
|
+
} & CompactionContent, Schema.Struct<{
|
|
2100
|
+
readonly type: Schema.Literal<"compaction">;
|
|
2101
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
2102
|
+
readonly id: Schema.optional<Schema.String>;
|
|
2103
|
+
readonly encrypted: Schema.optional<Schema.String>;
|
|
2104
|
+
/** Null means the provider failed to produce a summary; prior history must be retained. */
|
|
2105
|
+
readonly text: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
2106
|
+
}>> & {
|
|
2107
|
+
make: (input: Omit<CompactionPart, "type" | "encrypted" | "text"> & CompactionContent) => CompactionPart;
|
|
2108
|
+
}]>>;
|
|
2109
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2110
|
+
}>, {}>;
|
|
2111
|
+
export declare class AssistantMessage extends AssistantMessage_base {
|
|
2112
|
+
}
|
|
2113
|
+
declare const ToolMessage_base: Schema.Class<ToolMessage, Schema.Struct<{
|
|
2114
|
+
readonly id: Schema.optional<Schema.String>;
|
|
2115
|
+
readonly role: Schema.Literal<"tool">;
|
|
2116
|
+
readonly content: Schema.$Array<Schema.Struct<{
|
|
2117
|
+
readonly type: Schema.Literal<"tool-result">;
|
|
2118
|
+
readonly id: Schema.String;
|
|
2119
|
+
readonly name: Schema.String;
|
|
2120
|
+
readonly namespace: Schema.optional<Schema.String>;
|
|
2121
|
+
readonly result: Schema.Union<readonly [Schema.Struct<{
|
|
2122
|
+
readonly type: Schema.Literal<"json">;
|
|
2123
|
+
readonly value: Schema.Unknown;
|
|
2124
|
+
}>, Schema.Struct<{
|
|
2125
|
+
readonly type: Schema.Literal<"text">;
|
|
2126
|
+
readonly value: Schema.Unknown;
|
|
2127
|
+
}>, Schema.Struct<{
|
|
2128
|
+
readonly type: Schema.Literal<"error">;
|
|
2129
|
+
readonly value: Schema.Unknown;
|
|
2130
|
+
}>, Schema.Struct<{
|
|
2131
|
+
readonly type: Schema.Literal<"content">;
|
|
2132
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
2133
|
+
readonly type: Schema.Literal<"text">;
|
|
2134
|
+
readonly text: Schema.String;
|
|
2135
|
+
}>, Schema.Struct<{
|
|
2136
|
+
readonly type: Schema.Literal<"file">;
|
|
2137
|
+
readonly uri: Schema.String;
|
|
2138
|
+
readonly mime: Schema.String;
|
|
2139
|
+
readonly name: Schema.optional<Schema.String>;
|
|
2140
|
+
}>]>>;
|
|
2141
|
+
}>]> & {
|
|
2142
|
+
readonly tag: "type";
|
|
2143
|
+
readonly discriminants: readonly ["json", "text", "error", "content"];
|
|
2144
|
+
readonly cases: {
|
|
2145
|
+
content: Schema.Struct<{
|
|
2146
|
+
readonly type: Schema.Literal<"content">;
|
|
2147
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
2148
|
+
readonly type: Schema.Literal<"text">;
|
|
2149
|
+
readonly text: Schema.String;
|
|
2150
|
+
}>, Schema.Struct<{
|
|
2151
|
+
readonly type: Schema.Literal<"file">;
|
|
2152
|
+
readonly uri: Schema.String;
|
|
2153
|
+
readonly mime: Schema.String;
|
|
2154
|
+
readonly name: Schema.optional<Schema.String>;
|
|
2155
|
+
}>]>>;
|
|
2156
|
+
}>;
|
|
2157
|
+
error: Schema.Struct<{
|
|
2158
|
+
readonly type: Schema.Literal<"error">;
|
|
2159
|
+
readonly value: Schema.Unknown;
|
|
2160
|
+
}>;
|
|
2161
|
+
json: Schema.Struct<{
|
|
2162
|
+
readonly type: Schema.Literal<"json">;
|
|
2163
|
+
readonly value: Schema.Unknown;
|
|
2164
|
+
}>;
|
|
2165
|
+
text: Schema.Struct<{
|
|
2166
|
+
readonly type: Schema.Literal<"text">;
|
|
2167
|
+
readonly value: Schema.Unknown;
|
|
2168
|
+
}>;
|
|
2169
|
+
};
|
|
2170
|
+
readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
|
|
2171
|
+
readonly type: "json";
|
|
2172
|
+
readonly value: unknown;
|
|
2173
|
+
} | {
|
|
2174
|
+
readonly type: "text";
|
|
2175
|
+
readonly value: unknown;
|
|
2176
|
+
} | {
|
|
2177
|
+
readonly type: "error";
|
|
2178
|
+
readonly value: unknown;
|
|
2179
|
+
} | {
|
|
2180
|
+
readonly type: "content";
|
|
2181
|
+
readonly value: readonly ({
|
|
2182
|
+
readonly type: "text";
|
|
2183
|
+
readonly text: string;
|
|
2184
|
+
} | {
|
|
2185
|
+
readonly type: "file";
|
|
2186
|
+
readonly uri: string;
|
|
2187
|
+
readonly mime: string;
|
|
2188
|
+
readonly name?: string | undefined;
|
|
2189
|
+
})[];
|
|
2190
|
+
}) => value is Extract<{
|
|
2191
|
+
readonly type: "json";
|
|
2192
|
+
readonly value: unknown;
|
|
2193
|
+
}, {
|
|
2194
|
+
readonly type: Keys;
|
|
2195
|
+
}> | Extract<{
|
|
2196
|
+
readonly type: "text";
|
|
2197
|
+
readonly value: unknown;
|
|
2198
|
+
}, {
|
|
2199
|
+
readonly type: Keys;
|
|
2200
|
+
}> | Extract<{
|
|
2201
|
+
readonly type: "error";
|
|
2202
|
+
readonly value: unknown;
|
|
2203
|
+
}, {
|
|
2204
|
+
readonly type: Keys;
|
|
2205
|
+
}> | Extract<{
|
|
2206
|
+
readonly type: "content";
|
|
2207
|
+
readonly value: readonly ({
|
|
2208
|
+
readonly type: "text";
|
|
2209
|
+
readonly text: string;
|
|
2210
|
+
} | {
|
|
2211
|
+
readonly type: "file";
|
|
2212
|
+
readonly uri: string;
|
|
2213
|
+
readonly mime: string;
|
|
2214
|
+
readonly name?: string | undefined;
|
|
2215
|
+
})[];
|
|
2216
|
+
}, {
|
|
2217
|
+
readonly type: Keys;
|
|
2218
|
+
}>;
|
|
2219
|
+
readonly guards: {
|
|
2220
|
+
content: (u: unknown) => u is {
|
|
2221
|
+
readonly type: "content";
|
|
2222
|
+
readonly value: readonly ({
|
|
2223
|
+
readonly type: "text";
|
|
2224
|
+
readonly text: string;
|
|
2225
|
+
} | {
|
|
2226
|
+
readonly type: "file";
|
|
2227
|
+
readonly uri: string;
|
|
2228
|
+
readonly mime: string;
|
|
2229
|
+
readonly name?: string | undefined;
|
|
2230
|
+
})[];
|
|
2231
|
+
};
|
|
2232
|
+
error: (u: unknown) => u is {
|
|
2233
|
+
readonly type: "error";
|
|
2234
|
+
readonly value: unknown;
|
|
2235
|
+
};
|
|
2236
|
+
json: (u: unknown) => u is {
|
|
2237
|
+
readonly type: "json";
|
|
2238
|
+
readonly value: unknown;
|
|
2239
|
+
};
|
|
2240
|
+
text: (u: unknown) => u is {
|
|
2241
|
+
readonly type: "text";
|
|
2242
|
+
readonly value: unknown;
|
|
2243
|
+
};
|
|
2244
|
+
};
|
|
2245
|
+
readonly match: {
|
|
2246
|
+
<Handlers extends { [K in "content" | "error" | "json" | "text"]: (value: {
|
|
2247
|
+
readonly content: Schema.Struct<{
|
|
2248
|
+
readonly type: Schema.Literal<"content">;
|
|
2249
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
2250
|
+
readonly type: Schema.Literal<"text">;
|
|
2251
|
+
readonly text: Schema.String;
|
|
2252
|
+
}>, Schema.Struct<{
|
|
2253
|
+
readonly type: Schema.Literal<"file">;
|
|
2254
|
+
readonly uri: Schema.String;
|
|
2255
|
+
readonly mime: Schema.String;
|
|
2256
|
+
readonly name: Schema.optional<Schema.String>;
|
|
2257
|
+
}>]>>;
|
|
2258
|
+
}>;
|
|
2259
|
+
readonly error: Schema.Struct<{
|
|
2260
|
+
readonly type: Schema.Literal<"error">;
|
|
2261
|
+
readonly value: Schema.Unknown;
|
|
2262
|
+
}>;
|
|
2263
|
+
readonly json: Schema.Struct<{
|
|
2264
|
+
readonly type: Schema.Literal<"json">;
|
|
2265
|
+
readonly value: Schema.Unknown;
|
|
2266
|
+
}>;
|
|
2267
|
+
readonly text: Schema.Struct<{
|
|
2268
|
+
readonly type: Schema.Literal<"text">;
|
|
2269
|
+
readonly value: Schema.Unknown;
|
|
2270
|
+
}>;
|
|
2271
|
+
}[K]["Type"]) => any; }>(value: {
|
|
2272
|
+
readonly type: "json";
|
|
2273
|
+
readonly value: unknown;
|
|
2274
|
+
} | {
|
|
2275
|
+
readonly type: "text";
|
|
2276
|
+
readonly value: unknown;
|
|
2277
|
+
} | {
|
|
2278
|
+
readonly type: "error";
|
|
2279
|
+
readonly value: unknown;
|
|
2280
|
+
} | {
|
|
2281
|
+
readonly type: "content";
|
|
2282
|
+
readonly value: readonly ({
|
|
2283
|
+
readonly type: "text";
|
|
2284
|
+
readonly text: string;
|
|
2285
|
+
} | {
|
|
2286
|
+
readonly type: "file";
|
|
2287
|
+
readonly uri: string;
|
|
2288
|
+
readonly mime: string;
|
|
2289
|
+
readonly name?: string | undefined;
|
|
2290
|
+
})[];
|
|
2291
|
+
}, cases: Handlers): import("effect/Unify").Unify<ReturnType<Handlers["content" | "error" | "json" | "text"]>>;
|
|
2292
|
+
<Handlers extends { [K in "content" | "error" | "json" | "text"]: (value: {
|
|
2293
|
+
readonly content: Schema.Struct<{
|
|
2294
|
+
readonly type: Schema.Literal<"content">;
|
|
2295
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
2296
|
+
readonly type: Schema.Literal<"text">;
|
|
2297
|
+
readonly text: Schema.String;
|
|
2298
|
+
}>, Schema.Struct<{
|
|
2299
|
+
readonly type: Schema.Literal<"file">;
|
|
2300
|
+
readonly uri: Schema.String;
|
|
2301
|
+
readonly mime: Schema.String;
|
|
2302
|
+
readonly name: Schema.optional<Schema.String>;
|
|
2303
|
+
}>]>>;
|
|
2304
|
+
}>;
|
|
2305
|
+
readonly error: Schema.Struct<{
|
|
2306
|
+
readonly type: Schema.Literal<"error">;
|
|
2307
|
+
readonly value: Schema.Unknown;
|
|
2308
|
+
}>;
|
|
2309
|
+
readonly json: Schema.Struct<{
|
|
2310
|
+
readonly type: Schema.Literal<"json">;
|
|
2311
|
+
readonly value: Schema.Unknown;
|
|
2312
|
+
}>;
|
|
2313
|
+
readonly text: Schema.Struct<{
|
|
2314
|
+
readonly type: Schema.Literal<"text">;
|
|
2315
|
+
readonly value: Schema.Unknown;
|
|
2316
|
+
}>;
|
|
2317
|
+
}[K]["Type"]) => any; }>(cases: Handlers): (value: {
|
|
2318
|
+
readonly type: "json";
|
|
2319
|
+
readonly value: unknown;
|
|
2320
|
+
} | {
|
|
2321
|
+
readonly type: "text";
|
|
2322
|
+
readonly value: unknown;
|
|
2323
|
+
} | {
|
|
2324
|
+
readonly type: "error";
|
|
2325
|
+
readonly value: unknown;
|
|
2326
|
+
} | {
|
|
2327
|
+
readonly type: "content";
|
|
2328
|
+
readonly value: readonly ({
|
|
2329
|
+
readonly type: "text";
|
|
2330
|
+
readonly text: string;
|
|
2331
|
+
} | {
|
|
2332
|
+
readonly type: "file";
|
|
2333
|
+
readonly uri: string;
|
|
2334
|
+
readonly mime: string;
|
|
2335
|
+
readonly name?: string | undefined;
|
|
2336
|
+
})[];
|
|
2337
|
+
}) => import("effect/Unify").Unify<ReturnType<Handlers["content" | "error" | "json" | "text"]>>;
|
|
2338
|
+
};
|
|
2339
|
+
readonly matchOrElse: {
|
|
2340
|
+
<Handlers, OrElse>(value: {
|
|
2341
|
+
readonly type: "json";
|
|
2342
|
+
readonly value: unknown;
|
|
2343
|
+
} | {
|
|
2344
|
+
readonly type: "text";
|
|
2345
|
+
readonly value: unknown;
|
|
2346
|
+
} | {
|
|
2347
|
+
readonly type: "error";
|
|
2348
|
+
readonly value: unknown;
|
|
2349
|
+
} | {
|
|
2350
|
+
readonly type: "content";
|
|
2351
|
+
readonly value: readonly ({
|
|
2352
|
+
readonly type: "text";
|
|
2353
|
+
readonly text: string;
|
|
2354
|
+
} | {
|
|
2355
|
+
readonly type: "file";
|
|
2356
|
+
readonly uri: string;
|
|
2357
|
+
readonly mime: string;
|
|
2358
|
+
readonly name?: string | undefined;
|
|
2359
|
+
})[];
|
|
2360
|
+
}, cases: Handlers & {
|
|
2361
|
+
readonly content?: ((value: {
|
|
2362
|
+
readonly type: "content";
|
|
2363
|
+
readonly value: readonly ({
|
|
2364
|
+
readonly type: "text";
|
|
2365
|
+
readonly text: string;
|
|
2366
|
+
} | {
|
|
2367
|
+
readonly type: "file";
|
|
2368
|
+
readonly uri: string;
|
|
2369
|
+
readonly mime: string;
|
|
2370
|
+
readonly name?: string | undefined;
|
|
2371
|
+
})[];
|
|
2372
|
+
}) => any) | undefined;
|
|
2373
|
+
readonly error?: ((value: {
|
|
2374
|
+
readonly type: "error";
|
|
2375
|
+
readonly value: unknown;
|
|
2376
|
+
}) => any) | undefined;
|
|
2377
|
+
readonly json?: ((value: {
|
|
2378
|
+
readonly type: "json";
|
|
2379
|
+
readonly value: unknown;
|
|
2380
|
+
}) => any) | undefined;
|
|
2381
|
+
readonly text?: ((value: {
|
|
2382
|
+
readonly type: "text";
|
|
2383
|
+
readonly value: unknown;
|
|
2384
|
+
}) => any) | undefined;
|
|
2385
|
+
} & (Exclude<keyof Handlers, "content" | "error" | "json" | "text"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
|
|
2386
|
+
readonly type: "json";
|
|
2387
|
+
readonly value: unknown;
|
|
2388
|
+
}, {
|
|
2389
|
+
readonly type: keyof Handlers;
|
|
2390
|
+
}> | Exclude<{
|
|
2391
|
+
readonly type: "text";
|
|
2392
|
+
readonly value: unknown;
|
|
2393
|
+
}, {
|
|
2394
|
+
readonly type: keyof Handlers;
|
|
2395
|
+
}> | Exclude<{
|
|
2396
|
+
readonly type: "error";
|
|
2397
|
+
readonly value: unknown;
|
|
2398
|
+
}, {
|
|
2399
|
+
readonly type: keyof Handlers;
|
|
2400
|
+
}> | Exclude<{
|
|
2401
|
+
readonly type: "content";
|
|
2402
|
+
readonly value: readonly ({
|
|
2403
|
+
readonly type: "text";
|
|
2404
|
+
readonly text: string;
|
|
2405
|
+
} | {
|
|
2406
|
+
readonly type: "file";
|
|
2407
|
+
readonly uri: string;
|
|
2408
|
+
readonly mime: string;
|
|
2409
|
+
readonly name?: string | undefined;
|
|
2410
|
+
})[];
|
|
2411
|
+
}, {
|
|
2412
|
+
readonly type: keyof Handlers;
|
|
2413
|
+
}>) => any)): import("effect/Unify").Unify<{ [K in keyof Handlers]-?: NonNullable<Handlers[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Handlers] | (OrElse extends (...args: Array<any>) => infer R ? R : never)>;
|
|
2414
|
+
<Handlers, OrElse>(cases: Handlers & {
|
|
2415
|
+
readonly content?: ((value: {
|
|
2416
|
+
readonly type: "content";
|
|
2417
|
+
readonly value: readonly ({
|
|
2418
|
+
readonly type: "text";
|
|
2419
|
+
readonly text: string;
|
|
2420
|
+
} | {
|
|
2421
|
+
readonly type: "file";
|
|
2422
|
+
readonly uri: string;
|
|
2423
|
+
readonly mime: string;
|
|
2424
|
+
readonly name?: string | undefined;
|
|
2425
|
+
})[];
|
|
2426
|
+
}) => any) | undefined;
|
|
2427
|
+
readonly error?: ((value: {
|
|
2428
|
+
readonly type: "error";
|
|
2429
|
+
readonly value: unknown;
|
|
2430
|
+
}) => any) | undefined;
|
|
2431
|
+
readonly json?: ((value: {
|
|
2432
|
+
readonly type: "json";
|
|
2433
|
+
readonly value: unknown;
|
|
2434
|
+
}) => any) | undefined;
|
|
2435
|
+
readonly text?: ((value: {
|
|
2436
|
+
readonly type: "text";
|
|
2437
|
+
readonly value: unknown;
|
|
2438
|
+
}) => any) | undefined;
|
|
2439
|
+
} & (Exclude<keyof Handlers, "content" | "error" | "json" | "text"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
|
|
2440
|
+
readonly type: "json";
|
|
2441
|
+
readonly value: unknown;
|
|
2442
|
+
}, {
|
|
2443
|
+
readonly type: keyof Handlers;
|
|
2444
|
+
}> | Exclude<{
|
|
2445
|
+
readonly type: "text";
|
|
2446
|
+
readonly value: unknown;
|
|
2447
|
+
}, {
|
|
2448
|
+
readonly type: keyof Handlers;
|
|
2449
|
+
}> | Exclude<{
|
|
2450
|
+
readonly type: "error";
|
|
2451
|
+
readonly value: unknown;
|
|
2452
|
+
}, {
|
|
2453
|
+
readonly type: keyof Handlers;
|
|
2454
|
+
}> | Exclude<{
|
|
2455
|
+
readonly type: "content";
|
|
2456
|
+
readonly value: readonly ({
|
|
2457
|
+
readonly type: "text";
|
|
2458
|
+
readonly text: string;
|
|
2459
|
+
} | {
|
|
2460
|
+
readonly type: "file";
|
|
2461
|
+
readonly uri: string;
|
|
2462
|
+
readonly mime: string;
|
|
2463
|
+
readonly name?: string | undefined;
|
|
2464
|
+
})[];
|
|
2465
|
+
}, {
|
|
2466
|
+
readonly type: keyof Handlers;
|
|
2467
|
+
}>) => any)): (value: {
|
|
2468
|
+
readonly type: "json";
|
|
2469
|
+
readonly value: unknown;
|
|
2470
|
+
} | {
|
|
2471
|
+
readonly type: "text";
|
|
2472
|
+
readonly value: unknown;
|
|
2473
|
+
} | {
|
|
2474
|
+
readonly type: "error";
|
|
2475
|
+
readonly value: unknown;
|
|
2476
|
+
} | {
|
|
2477
|
+
readonly type: "content";
|
|
2478
|
+
readonly value: readonly ({
|
|
2479
|
+
readonly type: "text";
|
|
2480
|
+
readonly text: string;
|
|
2481
|
+
} | {
|
|
2482
|
+
readonly type: "file";
|
|
2483
|
+
readonly uri: string;
|
|
2484
|
+
readonly mime: string;
|
|
2485
|
+
readonly name?: string | undefined;
|
|
2486
|
+
})[];
|
|
2487
|
+
}) => import("effect/Unify").Unify<{ [K in keyof Handlers]-?: NonNullable<Handlers[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Handlers] | (OrElse extends (...args: Array<any>) => infer R ? R : never)>;
|
|
2488
|
+
};
|
|
2489
|
+
} & {
|
|
2490
|
+
make: (value: unknown, type?: ToolResultValue["type"]) => ToolResultValue;
|
|
2491
|
+
};
|
|
2492
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
2493
|
+
readonly cache: Schema.optional<typeof CacheHint>;
|
|
2494
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2495
|
+
}> & {
|
|
2496
|
+
make: (input: Omit<ToolResultPart, "type" | "result"> & {
|
|
2497
|
+
readonly result: unknown;
|
|
2498
|
+
readonly resultType?: ToolResultValue["type"];
|
|
2499
|
+
}) => ToolResultPart;
|
|
2500
|
+
}>;
|
|
2501
|
+
}>, {}>;
|
|
2502
|
+
export declare class ToolMessage extends ToolMessage_base {
|
|
2503
|
+
}
|
|
2504
|
+
export type Message = SystemMessage | UserMessage | AssistantMessage | ToolMessage;
|
|
2505
|
+
export type ContentPartInput = Exclude<ContentPart, MediaPart> | MediaPartInput;
|
|
2506
|
+
export declare namespace Message {
|
|
2507
|
+
export type ContentInput<Part extends {
|
|
2508
|
+
readonly type: string;
|
|
2509
|
+
} = ContentPartInput> = string | Part | ReadonlyArray<Part>;
|
|
2510
|
+
export type SystemContentInput = ContentInput<TextPart>;
|
|
2511
|
+
export type UserContentInput = ContentInput<TextPart | MediaPartInput>;
|
|
2512
|
+
export type AssistantContentInput = ContentInput<Exclude<AssistantMessage["content"][number], MediaPart> | MediaPartInput>;
|
|
2513
|
+
type RoleInput<Props, Content> = Omit<Props, "content"> & {
|
|
2514
|
+
readonly content: Content;
|
|
2515
|
+
};
|
|
2516
|
+
export type SystemInput = RoleInput<Omit<ConstructorParameters<typeof SystemMessage>[0], "tools">, ContentInput<SystemMessage["content"][number]>> & {
|
|
2517
|
+
readonly tools?: ToolChangesInput;
|
|
2518
|
+
};
|
|
2519
|
+
export type UserInput = RoleInput<ConstructorParameters<typeof UserMessage>[0], UserContentInput>;
|
|
2520
|
+
export type AssistantInput = RoleInput<ConstructorParameters<typeof AssistantMessage>[0], AssistantContentInput>;
|
|
2521
|
+
export type ToolInput = RoleInput<ConstructorParameters<typeof ToolMessage>[0], ToolResultPart | ReadonlyArray<ToolResultPart>>;
|
|
2522
|
+
export type Input = SystemInput | UserInput | AssistantInput | ToolInput;
|
|
2523
|
+
export {};
|
|
2524
|
+
}
|
|
2525
|
+
declare function make(input: SystemMessage | Message.SystemInput): SystemMessage;
|
|
2526
|
+
declare function make(input: UserMessage | Message.UserInput): UserMessage;
|
|
2527
|
+
declare function make(input: AssistantMessage | Message.AssistantInput): AssistantMessage;
|
|
2528
|
+
declare function make(input: ToolMessage | Message.ToolInput): ToolMessage;
|
|
2529
|
+
declare function make(input: Message | Message.Input): Message;
|
|
2530
|
+
export declare const Message: Schema.Union<readonly [typeof SystemMessage, typeof UserMessage, typeof AssistantMessage, typeof ToolMessage]> & {
|
|
2531
|
+
/** Concatenated text of a message's text parts. */
|
|
2532
|
+
text: (message: Message) => string;
|
|
2533
|
+
/** Concatenated text of an assistant message's reasoning parts. */
|
|
2534
|
+
reasoning: (message: AssistantMessage) => string;
|
|
2535
|
+
/** The tool calls in an assistant message, provider-executed ones included. */
|
|
2536
|
+
toolCalls: (message: AssistantMessage) => {
|
|
2537
|
+
readonly type: "tool-call";
|
|
2538
|
+
readonly id: string;
|
|
2539
|
+
readonly name: string;
|
|
2540
|
+
readonly namespace?: string | undefined;
|
|
2541
|
+
readonly input: unknown;
|
|
2542
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2543
|
+
readonly cache?: CacheHint | undefined;
|
|
2544
|
+
readonly providerMetadata?: {
|
|
2545
|
+
readonly [x: string]: {
|
|
2546
|
+
readonly [x: string]: unknown;
|
|
2547
|
+
};
|
|
2548
|
+
} | undefined;
|
|
2549
|
+
}[];
|
|
2550
|
+
make: typeof make;
|
|
2551
|
+
user: (input: Message.UserContentInput) => UserMessage;
|
|
2552
|
+
assistant: (input: Message.AssistantContentInput) => AssistantMessage;
|
|
2553
|
+
/**
|
|
2554
|
+
* Add an operator-authored instruction at this chronological point in the
|
|
2555
|
+
* conversation. This is distinct from the initial `LLMRequest.system`
|
|
2556
|
+
* prompt. Keep raw retrieved, tool, and web content out of privileged system
|
|
2557
|
+
* updates; pass that untrusted content through ordinary user/tool channels.
|
|
2558
|
+
*/
|
|
2559
|
+
system: (input: Message.SystemContentInput) => SystemMessage;
|
|
2560
|
+
effort: (input: {
|
|
2561
|
+
readonly effort?: ReasoningEffort;
|
|
2562
|
+
readonly previous?: ReasoningEffort;
|
|
2563
|
+
}) => SystemMessage;
|
|
2564
|
+
/**
|
|
2565
|
+
* Change the available tools at this point. A route sends the change in place when the model's `tools.updates`
|
|
2566
|
+
* allows it, and otherwise folds it into the top-level `tools`. Returns message input that keeps the tool objects,
|
|
2567
|
+
* so `ai.loop` can run an executable tool added here.
|
|
2568
|
+
*/
|
|
2569
|
+
tools: (input: ToolChangesInput) => {
|
|
2570
|
+
role: "system";
|
|
2571
|
+
content: never[];
|
|
2572
|
+
tools: ToolChangesInput;
|
|
2573
|
+
};
|
|
2574
|
+
tool: (result: ToolResultPart | Parameters<typeof ToolResultPart.make>[0]) => ToolMessage;
|
|
2575
|
+
};
|
|
2576
|
+
/**
|
|
2577
|
+
* Raw-text wire encoding for a tool with exactly one required string parameter, or the one its `field` names among
|
|
2578
|
+
* others. Models that accept the format write that parameter's value directly instead of JSON arguments, after a
|
|
2579
|
+
* first line holding the others; calls still decode to the normal object input.
|
|
2580
|
+
*/
|
|
2581
|
+
export declare const Freeform: Schema.Union<readonly [Schema.Struct<{
|
|
2582
|
+
readonly type: Schema.Literal<"text">;
|
|
2583
|
+
readonly field: Schema.optionalKey<Schema.String>;
|
|
2584
|
+
}>, Schema.Struct<{
|
|
2585
|
+
readonly type: Schema.Literal<"regex">;
|
|
2586
|
+
readonly pattern: Schema.String;
|
|
2587
|
+
readonly field: Schema.optionalKey<Schema.String>;
|
|
2588
|
+
}>, Schema.Struct<{
|
|
2589
|
+
readonly type: Schema.Literal<"lark">;
|
|
2590
|
+
readonly grammar: Schema.String;
|
|
2591
|
+
readonly field: Schema.optionalKey<Schema.String>;
|
|
2592
|
+
}>]>;
|
|
2593
|
+
export type Freeform = Tool.Freeform;
|
|
2594
|
+
declare const toolDefinitionFields: {
|
|
2595
|
+
name: Schema.String;
|
|
2596
|
+
description: Schema.String;
|
|
2597
|
+
inputSchema: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
2598
|
+
outputSchema: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
2599
|
+
freeform: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
2600
|
+
readonly type: Schema.Literal<"text">;
|
|
2601
|
+
readonly field: Schema.optionalKey<Schema.String>;
|
|
2602
|
+
}>, Schema.Struct<{
|
|
2603
|
+
readonly type: Schema.Literal<"regex">;
|
|
2604
|
+
readonly pattern: Schema.String;
|
|
2605
|
+
readonly field: Schema.optionalKey<Schema.String>;
|
|
2606
|
+
}>, Schema.Struct<{
|
|
2607
|
+
readonly type: Schema.Literal<"lark">;
|
|
2608
|
+
readonly grammar: Schema.String;
|
|
2609
|
+
readonly field: Schema.optionalKey<Schema.String>;
|
|
2610
|
+
}>]>>;
|
|
2611
|
+
cache: Schema.optional<typeof CacheHint>;
|
|
2612
|
+
native: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
2613
|
+
};
|
|
2614
|
+
export type ToolDefinitionInput = Schema.Struct.Type<typeof toolDefinitionFields>;
|
|
2615
|
+
declare const ToolDefinition_base: Schema.Class<ToolDefinition, Schema.Struct<{
|
|
2616
|
+
readonly name: Schema.String;
|
|
2617
|
+
readonly description: Schema.String;
|
|
2618
|
+
readonly inputSchema: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
2619
|
+
readonly outputSchema: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
2620
|
+
readonly freeform: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
2621
|
+
readonly type: Schema.Literal<"text">;
|
|
2622
|
+
readonly field: Schema.optionalKey<Schema.String>;
|
|
2623
|
+
}>, Schema.Struct<{
|
|
2624
|
+
readonly type: Schema.Literal<"regex">;
|
|
2625
|
+
readonly pattern: Schema.String;
|
|
2626
|
+
readonly field: Schema.optionalKey<Schema.String>;
|
|
2627
|
+
}>, Schema.Struct<{
|
|
2628
|
+
readonly type: Schema.Literal<"lark">;
|
|
2629
|
+
readonly grammar: Schema.String;
|
|
2630
|
+
readonly field: Schema.optionalKey<Schema.String>;
|
|
2631
|
+
}>]>>;
|
|
2632
|
+
readonly cache: Schema.optional<typeof CacheHint>;
|
|
2633
|
+
readonly native: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
2634
|
+
readonly type: Schema.Literal<"tool">;
|
|
2635
|
+
}>, {}>;
|
|
2636
|
+
export declare class ToolDefinition extends ToolDefinition_base {
|
|
2637
|
+
constructor(input: ToolDefinitionInput);
|
|
2638
|
+
}
|
|
2639
|
+
export declare namespace ToolDefinition {
|
|
2640
|
+
type Input = ToolDefinition | ToolDefinitionInput;
|
|
2641
|
+
/** Normalize tool definition input into the canonical `ToolDefinition` class. */
|
|
2642
|
+
const make: (input: Input) => ToolDefinition;
|
|
2643
|
+
/**
|
|
2644
|
+
* The parameter a freeform call fills, when it is a required string: the one the format's `field` names, otherwise
|
|
2645
|
+
* the input schema's only property.
|
|
2646
|
+
*/
|
|
2647
|
+
const freeformField: (schema: JsonSchema, freeform?: Freeform) => string | undefined;
|
|
2648
|
+
}
|
|
2649
|
+
export type ToolNamespace = {
|
|
2650
|
+
readonly type: "namespace";
|
|
2651
|
+
readonly name: string;
|
|
2652
|
+
readonly description?: string;
|
|
2653
|
+
readonly tools: ReadonlyArray<ToolEntry>;
|
|
2654
|
+
};
|
|
2655
|
+
export type ToolNamespaceInput = Omit<ToolNamespace, "type" | "tools"> & {
|
|
2656
|
+
readonly tools: ReadonlyArray<ToolEntryInput>;
|
|
2657
|
+
};
|
|
2658
|
+
export type ToolNamespaceEntryInput = ToolNamespaceInput & {
|
|
2659
|
+
readonly type: "namespace";
|
|
2660
|
+
};
|
|
2661
|
+
export declare const ToolNamespace: Schema.Codec<ToolNamespace> & {
|
|
2662
|
+
readonly make: (input: ToolNamespace | ToolNamespaceInput) => ToolNamespace;
|
|
2663
|
+
};
|
|
2664
|
+
export type ToolEntry = ToolDefinition | ToolNamespace;
|
|
2665
|
+
export type ToolEntryInput = ToolDefinition.Input | ToolNamespaceEntryInput;
|
|
2666
|
+
export declare const ToolEntry: Schema.Codec<ToolEntry> & {
|
|
2667
|
+
readonly make: (input: ToolEntryInput) => ToolEntry;
|
|
2668
|
+
};
|
|
2669
|
+
declare const toolChoiceSchema: Schema.Union<readonly [Schema.Struct<{
|
|
2670
|
+
readonly type: Schema.Literal<"auto">;
|
|
2671
|
+
readonly disableParallelToolUse: Schema.optional<Schema.Boolean>;
|
|
2672
|
+
}>, Schema.Struct<{
|
|
2673
|
+
readonly type: Schema.Literal<"none">;
|
|
2674
|
+
readonly disableParallelToolUse: Schema.optional<Schema.Boolean>;
|
|
2675
|
+
}>, Schema.Struct<{
|
|
2676
|
+
readonly type: Schema.Literal<"required">;
|
|
2677
|
+
readonly disableParallelToolUse: Schema.optional<Schema.Boolean>;
|
|
2678
|
+
}>, Schema.Struct<{
|
|
2679
|
+
readonly type: Schema.Literal<"tool">;
|
|
2680
|
+
readonly name: Schema.String;
|
|
2681
|
+
readonly disableParallelToolUse: Schema.optional<Schema.Boolean>;
|
|
2682
|
+
}>]>;
|
|
2683
|
+
/** How the model may use tools: a mode (`auto`, `none`, `required`) or one tool forced by name. */
|
|
2684
|
+
export type ToolChoice = typeof toolChoiceSchema.Type;
|
|
2685
|
+
export declare namespace ToolChoice {
|
|
2686
|
+
type Mode = Exclude<ToolChoice["type"], "tool">;
|
|
2687
|
+
/** What a request's `toolChoice` takes: a mode, or `{ type: "tool", name }` to force one of the request's tools. */
|
|
2688
|
+
type Input = Mode | ToolChoice;
|
|
2689
|
+
}
|
|
2690
|
+
export declare const ToolChoice: Schema.Codec<ToolChoice>;
|
|
2691
|
+
/**
|
|
2692
|
+
* A normalized text request, the plain object `ai.request(...)` returns. Edit it with a spread, such as
|
|
2693
|
+
* `{ ...request, messages: [...request.messages, next] }`, or pass the edited object back to `ai.request`.
|
|
2694
|
+
*/
|
|
2695
|
+
export interface LLMRequest<Model extends LanguageModel = LanguageModel> extends BaseRequest<Model, LanguageModelProviderOptions<Model>>, GenerationOptionsFields {
|
|
2696
|
+
readonly system: ReadonlyArray<SystemPart>;
|
|
2697
|
+
readonly messages: ReadonlyArray<Message>;
|
|
2698
|
+
readonly tools: ReadonlyArray<ToolEntry>;
|
|
2699
|
+
readonly toolChoice?: ToolChoice;
|
|
2700
|
+
readonly cache?: CachePolicy;
|
|
2701
|
+
/** Stable cache affinity for protocols that support provider-managed prompt caching. */
|
|
2702
|
+
readonly affinity?: string;
|
|
2703
|
+
/** Emit a `raw` event with each provider frame before the events parsed from it. */
|
|
2704
|
+
readonly includeRaw?: boolean;
|
|
2705
|
+
}
|
|
2706
|
+
export {};
|