@zyro-sec/ai 1.0.0 → 1.0.1
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/AGENTS.md +23 -0
- package/example/tutorial.ts +284 -0
- package/package.json +11 -166
- package/script/pack.ts +5 -0
- package/script/recording-cost-report.ts +250 -0
- package/script/setup-recording-env.ts +602 -0
- package/src/ai-client.ts +28 -0
- package/src/cache-policy.ts +249 -0
- package/src/decision-client.ts +88 -0
- package/src/decision.ts +335 -0
- package/src/effect.ts +44 -0
- package/src/effort-updates.ts +25 -0
- package/src/embedding-client.ts +46 -0
- package/src/embedding.ts +167 -0
- package/src/experimental/cloudflare-run-extraction.ts +112 -0
- package/src/experimental/extraction.ts +190 -0
- package/src/experimental/realtime.ts +211 -0
- package/src/experimental.ts +51 -0
- package/src/generation.ts +210 -0
- package/src/image-client.ts +89 -0
- package/src/image.ts +236 -0
- package/src/index.ts +363 -0
- package/src/llm.ts +364 -0
- package/src/loop.ts +214 -0
- package/src/media-client.ts +94 -0
- package/src/media-model.ts +129 -0
- package/src/media.ts +408 -0
- package/src/protocols/alibaba-chat.ts +95 -0
- package/src/protocols/alibaba-images.ts +126 -0
- package/src/protocols/alibaba-messages.ts +49 -0
- package/src/protocols/alibaba-responses.ts +86 -0
- package/src/protocols/anthropic-messages.ts +1664 -0
- package/src/protocols/assemblyai-transcription.ts +209 -0
- package/src/protocols/bedrock-converse.ts +984 -0
- package/src/protocols/bedrock-event-stream.ts +147 -0
- package/src/protocols/cartesia-speech.ts +182 -0
- package/src/protocols/cloudflare-run-decisions.ts +55 -0
- package/src/protocols/cloudflare-workers-ai-images.ts +124 -0
- package/src/protocols/cohere-chat.ts +353 -0
- package/src/protocols/deepgram-speech.ts +148 -0
- package/src/protocols/deepgram-transcription.ts +179 -0
- package/src/protocols/elevenlabs-speech.ts +207 -0
- package/src/protocols/elevenlabs-transcription.ts +211 -0
- package/src/protocols/gemini.ts +908 -0
- package/src/protocols/google-decisions.ts +179 -0
- package/src/protocols/google-embed-content.ts +165 -0
- package/src/protocols/google-images.ts +255 -0
- package/src/protocols/google-interactions-video.ts +264 -0
- package/src/protocols/google-interactions.ts +904 -0
- package/src/protocols/google-speech.ts +157 -0
- package/src/protocols/google-transcription.ts +206 -0
- package/src/protocols/google-vertex-predict-embeddings.ts +104 -0
- package/src/protocols/index.ts +21 -0
- package/src/protocols/meta-images.ts +162 -0
- package/src/protocols/meta-messages.ts +67 -0
- package/src/protocols/meta-responses.ts +249 -0
- package/src/protocols/minimax-images.ts +215 -0
- package/src/protocols/minimax-video.ts +406 -0
- package/src/protocols/mistral-chat.ts +768 -0
- package/src/protocols/open-responses-channel.ts +198 -0
- package/src/protocols/open-responses-continuation.ts +218 -0
- package/src/protocols/open-responses.ts +1636 -0
- package/src/protocols/openai-chat.ts +1431 -0
- package/src/protocols/openai-compatible-chat.ts +22 -0
- package/src/protocols/openai-compatible-responses.ts +21 -0
- package/src/protocols/openai-decisions.ts +174 -0
- package/src/protocols/openai-embeddings.ts +105 -0
- package/src/protocols/openai-freeform.ts +287 -0
- package/src/protocols/openai-images.ts +442 -0
- package/src/protocols/openai-responses.ts +442 -0
- package/src/protocols/openai-speech.ts +164 -0
- package/src/protocols/openai-transcription.ts +295 -0
- package/src/protocols/openrouter-video.ts +215 -0
- package/src/protocols/seedance-video.ts +301 -0
- package/src/protocols/shared.ts +552 -0
- package/src/protocols/system-one.ts +335 -0
- package/src/protocols/utils/bedrock-auth.ts +147 -0
- package/src/protocols/utils/bedrock-cache.ts +56 -0
- package/src/protocols/utils/bedrock-media.ts +121 -0
- package/src/protocols/utils/cache.ts +44 -0
- package/src/protocols/utils/claude-model.ts +19 -0
- package/src/protocols/utils/gateway-protocol.ts +92 -0
- package/src/protocols/utils/gemini-generate-content.ts +172 -0
- package/src/protocols/utils/gemini-json-schema.ts +77 -0
- package/src/protocols/utils/image-sizing.ts +117 -0
- package/src/protocols/utils/lifecycle.ts +120 -0
- package/src/protocols/utils/media-input.ts +98 -0
- package/src/protocols/utils/mistral-tool-id.ts +34 -0
- package/src/protocols/utils/open-responses-options.ts +82 -0
- package/src/protocols/utils/partial-json-options.ts +62 -0
- package/src/protocols/utils/partial-json.ts +283 -0
- package/src/protocols/utils/responses-checkpoint.ts +115 -0
- package/src/protocols/utils/responses-compaction.ts +210 -0
- package/src/protocols/utils/responses-hosted-tools.ts +104 -0
- package/src/protocols/utils/speaker-turns.ts +10 -0
- package/src/protocols/utils/speech-stream.ts +111 -0
- package/src/protocols/utils/tool-schema.ts +115 -0
- package/src/protocols/utils/tool-stream.ts +240 -0
- package/src/protocols/venice-chat.ts +356 -0
- package/src/protocols/xai-images.ts +137 -0
- package/src/protocols/xai-responses.ts +106 -0
- package/src/protocols/xai-video.ts +232 -0
- package/src/protocols/zai-chat.ts +71 -0
- package/src/protocols/zai-images.ts +120 -0
- package/src/protocols/zai-messages.ts +34 -0
- package/src/protocols.ts +1 -0
- package/src/provider-error.ts +291 -0
- package/src/provider-package.ts +32 -0
- package/src/providers/alibaba/chat.ts +1 -0
- package/src/providers/alibaba/embeddings.ts +2 -0
- package/src/providers/alibaba/images.ts +2 -0
- package/src/providers/alibaba/messages.ts +3 -0
- package/src/providers/alibaba/responses.ts +3 -0
- package/src/providers/alibaba.ts +177 -0
- package/src/providers/amazon-bedrock/mantle/chat.ts +2 -0
- package/src/providers/amazon-bedrock/mantle/messages.ts +2 -0
- package/src/providers/amazon-bedrock/mantle/responses.ts +2 -0
- package/src/providers/amazon-bedrock/mantle.ts +2 -0
- package/src/providers/amazon-bedrock-mantle.ts +192 -0
- package/src/providers/amazon-bedrock.ts +81 -0
- package/src/providers/anthropic-compatible.ts +80 -0
- package/src/providers/anthropic.ts +66 -0
- package/src/providers/assemblyai.ts +32 -0
- package/src/providers/azure/chat.ts +2 -0
- package/src/providers/azure/embeddings.ts +2 -0
- package/src/providers/azure/images.ts +2 -0
- package/src/providers/azure/messages.ts +2 -0
- package/src/providers/azure/responses.ts +2 -0
- package/src/providers/azure.ts +240 -0
- package/src/providers/baseten/decisions.ts +2 -0
- package/src/providers/baseten.ts +88 -0
- package/src/providers/byteplus/videos.ts +2 -0
- package/src/providers/byteplus.ts +39 -0
- package/src/providers/cartesia.ts +28 -0
- package/src/providers/cerebras.ts +56 -0
- package/src/providers/cloudflare-ai-gateway/decisions.ts +2 -0
- package/src/providers/cloudflare-ai-gateway.ts +199 -0
- package/src/providers/cloudflare-shared.ts +29 -0
- package/src/providers/cloudflare-workers-ai/decisions.ts +2 -0
- package/src/providers/cloudflare-workers-ai/images.ts +2 -0
- package/src/providers/cloudflare-workers-ai.ts +104 -0
- package/src/providers/cohere/chat.ts +8 -0
- package/src/providers/cohere/embeddings.ts +2 -0
- package/src/providers/cohere.ts +72 -0
- package/src/providers/deepgram.ts +33 -0
- package/src/providers/deepinfra/embeddings.ts +2 -0
- package/src/providers/deepinfra.ts +76 -0
- package/src/providers/deepseek.ts +54 -0
- package/src/providers/digitalocean/decisions.ts +2 -0
- package/src/providers/digitalocean/embeddings.ts +2 -0
- package/src/providers/digitalocean/images.ts +2 -0
- package/src/providers/digitalocean/responses.ts +4 -0
- package/src/providers/digitalocean.ts +144 -0
- package/src/providers/elevenlabs.ts +35 -0
- package/src/providers/fireworks/embeddings.ts +2 -0
- package/src/providers/fireworks.ts +66 -0
- package/src/providers/google/decisions.ts +2 -0
- package/src/providers/google/embeddings.ts +2 -0
- package/src/providers/google/images.ts +2 -0
- package/src/providers/google/interactions.ts +13 -0
- package/src/providers/google/videos.ts +2 -0
- package/src/providers/google-vertex/chat.ts +2 -0
- package/src/providers/google-vertex/embeddings.ts +2 -0
- package/src/providers/google-vertex/gemini.ts +2 -0
- package/src/providers/google-vertex/images.ts +2 -0
- package/src/providers/google-vertex/interactions.ts +2 -0
- package/src/providers/google-vertex/messages.ts +2 -0
- package/src/providers/google-vertex/mistral.ts +2 -0
- package/src/providers/google-vertex/responses.ts +2 -0
- package/src/providers/google-vertex-chat.ts +63 -0
- package/src/providers/google-vertex-interactions.ts +104 -0
- package/src/providers/google-vertex-messages.ts +99 -0
- package/src/providers/google-vertex-mistral.ts +79 -0
- package/src/providers/google-vertex-responses.ts +64 -0
- package/src/providers/google-vertex-shared.ts +176 -0
- package/src/providers/google-vertex.ts +228 -0
- package/src/providers/google.ts +121 -0
- package/src/providers/groq.ts +98 -0
- package/src/providers/index.ts +45 -0
- package/src/providers/meta/chat.ts +2 -0
- package/src/providers/meta/images.ts +2 -0
- package/src/providers/meta/messages.ts +2 -0
- package/src/providers/meta/responses.ts +2 -0
- package/src/providers/meta.ts +161 -0
- package/src/providers/minimax/chat.ts +8 -0
- package/src/providers/minimax/images.ts +4 -0
- package/src/providers/minimax/messages.ts +1 -0
- package/src/providers/minimax/responses.ts +8 -0
- package/src/providers/minimax/videos.ts +4 -0
- package/src/providers/minimax.ts +162 -0
- package/src/providers/mistral.ts +40 -0
- package/src/providers/moonshot/chat.ts +1 -0
- package/src/providers/moonshot/messages.ts +8 -0
- package/src/providers/moonshot/responses.ts +8 -0
- package/src/providers/moonshot.ts +134 -0
- package/src/providers/open-responses-options.ts +4 -0
- package/src/providers/openai/chat.ts +2 -0
- package/src/providers/openai/embeddings.ts +2 -0
- package/src/providers/openai/images.ts +2 -0
- package/src/providers/openai/responses.ts +2 -0
- package/src/providers/openai-compatible/decisions.ts +2 -0
- package/src/providers/openai-compatible/embeddings.ts +2 -0
- package/src/providers/openai-compatible/images.ts +2 -0
- package/src/providers/openai-compatible/responses.ts +1 -0
- package/src/providers/openai-compatible-responses.ts +52 -0
- package/src/providers/openai-compatible.ts +108 -0
- package/src/providers/openai-options.ts +66 -0
- package/src/providers/openai.ts +207 -0
- package/src/providers/opencode/decisions.ts +2 -0
- package/src/providers/opencode.ts +45 -0
- package/src/providers/openrouter/decisions.ts +2 -0
- package/src/providers/openrouter/embeddings.ts +2 -0
- package/src/providers/openrouter/images.ts +2 -0
- package/src/providers/openrouter/responses.ts +3 -0
- package/src/providers/openrouter/videos.ts +2 -0
- package/src/providers/openrouter.ts +347 -0
- package/src/providers/settings.ts +54 -0
- package/src/providers/togetherai.ts +53 -0
- package/src/providers/typesafe-ai/decisions.ts +2 -0
- package/src/providers/typesafe-ai.ts +45 -0
- package/src/providers/venice/responses.ts +4 -0
- package/src/providers/venice.ts +93 -0
- package/src/providers/vercel-ai-gateway/chat.ts +2 -0
- package/src/providers/vercel-ai-gateway/decisions.ts +2 -0
- package/src/providers/vercel-ai-gateway/embeddings.ts +2 -0
- package/src/providers/vercel-ai-gateway/images.ts +2 -0
- package/src/providers/vercel-ai-gateway/messages.ts +2 -0
- package/src/providers/vercel-ai-gateway/responses.ts +2 -0
- package/src/providers/vercel-ai-gateway.ts +300 -0
- package/src/providers/volcengine/videos.ts +2 -0
- package/src/providers/volcengine.ts +39 -0
- package/src/providers/xai/images.ts +2 -0
- package/src/providers/xai/videos.ts +2 -0
- package/src/providers/xai.ts +125 -0
- package/src/providers/zai/chat.ts +1 -0
- package/src/providers/zai/images.ts +2 -0
- package/src/providers/zai-coding-plan/chat.ts +1 -0
- package/src/providers/zai-coding-plan/messages.ts +8 -0
- package/src/providers/zai-coding-plan/responses.ts +8 -0
- package/src/providers/zai-coding-plan.ts +86 -0
- package/src/providers/zai.ts +73 -0
- package/src/providers.ts +1 -0
- package/src/public.ts +204 -0
- package/src/route/auth-options.ts +62 -0
- package/src/route/auth.ts +164 -0
- package/src/route/client.ts +700 -0
- package/src/route/decision.ts +150 -0
- package/src/route/embedding.ts +175 -0
- package/src/route/endpoint.ts +63 -0
- package/src/route/executor-service.ts +191 -0
- package/src/route/executor.ts +361 -0
- package/src/route/framing.ts +112 -0
- package/src/route/index.ts +47 -0
- package/src/route/media-protocol.ts +321 -0
- package/src/route/media.ts +507 -0
- package/src/route/protocol.ts +97 -0
- package/src/route/transport/http.ts +103 -0
- package/src/route/transport/index.ts +59 -0
- package/src/route/transport/websocket-channel.ts +51 -0
- package/src/route/transport/websocket.ts +443 -0
- package/src/route.ts +1 -0
- package/src/schema/errors.ts +246 -0
- package/src/schema/events.ts +744 -0
- package/src/schema/ids.ts +24 -0
- package/src/schema/index.ts +5 -0
- package/src/schema/messages.ts +529 -0
- package/src/schema/options.ts +445 -0
- package/src/speech-client.ts +25 -0
- package/src/speech.ts +211 -0
- package/src/testing.ts +218 -0
- package/src/tool-history.ts +91 -0
- package/src/tool-runtime.ts +107 -0
- package/src/tool-updates.ts +139 -0
- package/src/tool.ts +281 -0
- package/src/transcription-client.ts +19 -0
- package/src/transcription.ts +234 -0
- package/src/utils/bytes.ts +9 -0
- package/src/utils/json.ts +5 -0
- package/src/utils/media-type.ts +93 -0
- package/src/utils/provider-codes.ts +43 -0
- package/src/utils/record.ts +3 -0
- package/src/utils/sanitize.ts +33 -0
- package/src/video-client.ts +66 -0
- package/src/video.ts +181 -0
- package/test/adapter.test.ts +180 -0
- package/test/auth-options.types.ts +283 -0
- package/test/auth.test.ts +112 -0
- package/test/cache-policy.test.ts +578 -0
- package/test/compaction-http.test.ts +96 -0
- package/test/compaction.test.ts +107 -0
- package/test/compile.test.ts +600 -0
- package/test/continuation-scenarios.ts +115 -0
- package/test/decision.test.ts +983 -0
- package/test/decision.types.ts +117 -0
- package/test/effort-updates.test.ts +574 -0
- package/test/embedding.test.ts +455 -0
- package/test/endpoint.test.ts +58 -0
- package/test/error-partial.test.ts +140 -0
- package/test/executor.test.ts +1095 -0
- package/test/exports.test.ts +222 -0
- package/test/extraction.test.ts +227 -0
- package/test/fixtures/audio/dialog.mp3 +0 -0
- package/test/fixtures/audio/hello.mp3 +0 -0
- package/test/fixtures/images/edit-source.jpg +0 -0
- package/test/fixtures/media/restroom.png +0 -0
- package/test/fixtures/recordings/alibaba-chat/qwen-3-7-plus-streams-thinking-disabled.json +35 -0
- package/test/fixtures/recordings/alibaba-chat/qwen-3-7-plus-streams-thinking-enabled.json +35 -0
- package/test/fixtures/recordings/alibaba-chat/qwen-3-8-flash-reads-image-bytes.json +34 -0
- package/test/fixtures/recordings/alibaba-chat/qwen-3-8-max-obeys-named-tool-choice.json +35 -0
- package/test/fixtures/recordings/alibaba-chat/qwen-3-8-max-replays-reasoning-through-a-tool-loop-and-follow-up.json +73 -0
- package/test/fixtures/recordings/alibaba-chat/qwen-3-8-max-returns-a-json-object.json +34 -0
- package/test/fixtures/recordings/alibaba-chat/qwen-3-8-max-streams-default-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-chat/qwen-3-8-max-streams-high-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-chat/qwen-3-8-max-streams-low-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-chat/qwen-3-8-max-streams-max-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-chat/qwen-3-8-max-streams-medium-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-chat/qwen-3-8-max-streams-minimal-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-chat/qwen-3-8-max-streams-none-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-chat/qwen-3-8-max-streams-xhigh-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-images/edits-an-image.json +33 -0
- package/test/fixtures/recordings/alibaba-images/generates-qwen-image-images.json +33 -0
- package/test/fixtures/recordings/alibaba-images/generates-wan-images.json +33 -0
- package/test/fixtures/recordings/alibaba-messages/qwen-3-7-plus-streams-thinking-disabled.json +35 -0
- package/test/fixtures/recordings/alibaba-messages/qwen-3-7-plus-streams-thinking-enabled.json +35 -0
- package/test/fixtures/recordings/alibaba-messages/qwen-3-8-flash-reads-image-bytes.json +34 -0
- package/test/fixtures/recordings/alibaba-messages/qwen-3-8-max-follows-a-json-schema.json +34 -0
- package/test/fixtures/recordings/alibaba-messages/qwen-3-8-max-obeys-named-tool-choice.json +35 -0
- package/test/fixtures/recordings/alibaba-messages/qwen-3-8-max-replays-reasoning-through-a-tool-loop-and-follow-up.json +73 -0
- package/test/fixtures/recordings/alibaba-messages/qwen-3-8-max-streams-default-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-messages/qwen-3-8-max-streams-high-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-messages/qwen-3-8-max-streams-low-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-messages/qwen-3-8-max-streams-max-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-messages/qwen-3-8-max-streams-medium-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-messages/qwen-3-8-max-streams-xhigh-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-responses/qwen-3-7-plus-streams-thinking-disabled.json +35 -0
- package/test/fixtures/recordings/alibaba-responses/qwen-3-7-plus-streams-thinking-enabled.json +35 -0
- package/test/fixtures/recordings/alibaba-responses/qwen-3-8-flash-reads-image-bytes.json +34 -0
- package/test/fixtures/recordings/alibaba-responses/qwen-3-8-max-continues-a-stored-response.json +53 -0
- package/test/fixtures/recordings/alibaba-responses/qwen-3-8-max-obeys-named-tool-choice.json +35 -0
- package/test/fixtures/recordings/alibaba-responses/qwen-3-8-max-replays-reasoning-through-a-tool-loop-and-follow-up.json +73 -0
- package/test/fixtures/recordings/alibaba-responses/qwen-3-8-max-streams-default-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-responses/qwen-3-8-max-streams-high-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-responses/qwen-3-8-max-streams-low-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-responses/qwen-3-8-max-streams-max-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-responses/qwen-3-8-max-streams-medium-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-responses/qwen-3-8-max-streams-minimal-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-responses/qwen-3-8-max-streams-none-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-responses/qwen-3-8-max-streams-xhigh-effort.json +36 -0
- package/test/fixtures/recordings/alibaba-responses/qwen-3-8-max-uses-hosted-code-interpreter.json +35 -0
- package/test/fixtures/recordings/alibaba-responses/qwen-3-8-max-uses-hosted-web-search-and-extraction.json +36 -0
- package/test/fixtures/recordings/anthropic-compatible-messages/minimax-m3-anthropic-compatible-text.json +40 -0
- package/test/fixtures/recordings/anthropic-compatible-messages/minimax-m3-anthropic-compatible-tool-call.json +41 -0
- package/test/fixtures/recordings/anthropic-compatible-messages/minimax-m3-anthropic-compatible-tool-loop.json +60 -0
- package/test/fixtures/recordings/anthropic-messages/anthropic-opus-4-7-image-tool-result.json +43 -0
- package/test/fixtures/recordings/anthropic-messages-cache/keeps-a-long-tool-turn-inside-the-cache-lookback.json +48 -0
- package/test/fixtures/recordings/anthropic-messages-cache/writes-then-reads-cache-control-on-identical-second-call.json +48 -0
- package/test/fixtures/recordings/assemblyai-transcription/uploads-submits-and-polls-a-transcript.json +98 -0
- package/test/fixtures/recordings/azure/chat-streams-text-from-a-foundry-models-url.json +31 -0
- package/test/fixtures/recordings/azure/chat-streams-text.json +28 -0
- package/test/fixtures/recordings/azure/messages-calls-a-tool.json +31 -0
- package/test/fixtures/recordings/azure/messages-streams-text.json +31 -0
- package/test/fixtures/recordings/azure/responses-calls-a-tool.json +31 -0
- package/test/fixtures/recordings/azure/responses-continues-after-a-tool-result.json +31 -0
- package/test/fixtures/recordings/azure/responses-streams-text.json +31 -0
- package/test/fixtures/recordings/baseten-decision/decides-choice-score-and-predicate-questions.json +33 -0
- package/test/fixtures/recordings/bedrock-converse/continues-after-parallel-tool-results.json +36 -0
- package/test/fixtures/recordings/bedrock-converse/drives-a-tool-loop.json +55 -0
- package/test/fixtures/recordings/bedrock-converse/streams-a-tool-call.json +29 -0
- package/test/fixtures/recordings/bedrock-converse/streams-text.json +29 -0
- package/test/fixtures/recordings/bedrock-converse-cache/writes-then-reads-cachepoint-on-identical-second-call.json +48 -0
- package/test/fixtures/recordings/bedrock-converse-options/constrains-claude-output-to-a-json-schema.json +33 -0
- package/test/fixtures/recordings/bedrock-converse-options/sends-claude-effort-with-adaptive-thinking-service-tier-and-request-metadata.json +34 -0
- package/test/fixtures/recordings/bedrock-converse-options/sends-gpt-oss-reasoning-effort-with-the-priority-tier.json +34 -0
- package/test/fixtures/recordings/bedrock-converse-options/sends-nova-2-reasoning-effort.json +34 -0
- package/test/fixtures/recordings/bedrock-converse-thinking-binding/accepts-the-default-binding-with-no-thinking-configured.json +34 -0
- package/test/fixtures/recordings/bedrock-converse-thinking-binding/keeps-a-session-working-after-the-system-prompt-changes.json +71 -0
- package/test/fixtures/recordings/bedrock-mantle/streams-text.json +33 -0
- package/test/fixtures/recordings/bedrock-mantle-messages/applies-mid-conversation-effort-updates-and-thinking-block-binding-on-opus-5-5.json +57 -0
- package/test/fixtures/recordings/bedrock-mantle-messages/lowers-system-updates-to-wrapped-user-text-on-haiku-4-5-with-budget-thinking.json +37 -0
- package/test/fixtures/recordings/bedrock-mantle-messages/replays-signed-thinking-through-a-tool-loop-and-native-system-update.json +59 -0
- package/test/fixtures/recordings/bedrock-mantle-messages/strips-unsupported-mid-conversation-effort-updates-on-opus-5-0.json +37 -0
- package/test/fixtures/recordings/cartesia-speech/generates-speech.json +34 -0
- package/test/fixtures/recordings/cartesia-speech/streams-speech-with-timestamps.json +33 -0
- package/test/fixtures/recordings/cerebras-chat/cerebras-gpt-oss-120b-text.json +32 -0
- package/test/fixtures/recordings/cerebras-chat/cerebras-gpt-oss-120b-tool-call.json +32 -0
- package/test/fixtures/recordings/cerebras-chat/cerebras-gpt-oss-120b-tool-loop.json +50 -0
- package/test/fixtures/recordings/cloudflare-ai-gateway/cloudflare-ai-gateway-claude-haiku-4-5-text.json +38 -0
- package/test/fixtures/recordings/cloudflare-ai-gateway/cloudflare-ai-gateway-claude-haiku-4-5-tool-loop.json +58 -0
- package/test/fixtures/recordings/cloudflare-ai-gateway/cloudflare-ai-gateway-openai-gpt-5-nano-text.json +37 -0
- package/test/fixtures/recordings/cloudflare-ai-gateway/cloudflare-ai-gateway-openai-gpt-5-nano-tool-loop.json +56 -0
- package/test/fixtures/recordings/cloudflare-ai-gateway/cloudflare-ai-gateway-workers-ai-gpt-oss-20b-tools-tool-call.json +32 -0
- package/test/fixtures/recordings/cloudflare-ai-gateway/cloudflare-ai-gateway-workers-ai-llama-3-1-8b-text.json +32 -0
- package/test/fixtures/recordings/cloudflare-ai-gateway-decision/decides-choice-score-and-predicate-questions.json +33 -0
- package/test/fixtures/recordings/cloudflare-workers-ai/cloudflare-workers-ai-gpt-oss-20b-tools-tool-call.json +32 -0
- package/test/fixtures/recordings/cloudflare-workers-ai/cloudflare-workers-ai-llama-3-1-8b-text.json +32 -0
- package/test/fixtures/recordings/cloudflare-workers-ai-decision/decides-choice-score-and-predicate-questions.json +33 -0
- package/test/fixtures/recordings/cloudflare-workers-ai-extraction/extracts-invoice-fields.json +33 -0
- package/test/fixtures/recordings/cloudflare-workers-ai-images/generates-a-flux-2-image-from-multipart-fields.json +32 -0
- package/test/fixtures/recordings/cloudflare-workers-ai-images/generates-a-raw-binary-image.json +33 -0
- package/test/fixtures/recordings/cohere/continues-a-native-tool-call.json +49 -0
- package/test/fixtures/recordings/cohere/streams-compatible-chat-reasoning.json +31 -0
- package/test/fixtures/recordings/cohere/streams-native-text-and-usage.json +31 -0
- package/test/fixtures/recordings/cohere/streams-native-thinking-with-a-budget.json +31 -0
- package/test/fixtures/recordings/cohere-embedding/embeds-text-through-the-compatibility-api.json +33 -0
- package/test/fixtures/recordings/deepgram-speech/generates-speech.json +36 -0
- package/test/fixtures/recordings/deepgram-speech/streams-speech.json +36 -0
- package/test/fixtures/recordings/deepgram-transcription/splits-utterances-at-speaker-changes.json +32 -0
- package/test/fixtures/recordings/deepgram-transcription/transcribes-raw-audio-with-speakers-and-word-timestamps.json +50 -0
- package/test/fixtures/recordings/deepinfra-chat/deepinfra-llama-3-3-70b-text.json +32 -0
- package/test/fixtures/recordings/deepinfra-chat/deepinfra-llama-3-3-70b-tool-call.json +32 -0
- package/test/fixtures/recordings/deepinfra-chat/deepinfra-llama-3-3-70b-tool-loop.json +50 -0
- package/test/fixtures/recordings/digitalocean-chat/gpt-nano-continues-a-tool-call-with-cache-markers.json +54 -0
- package/test/fixtures/recordings/digitalocean-chat/gpt-nano-reuses-a-cached-prompt.json +53 -0
- package/test/fixtures/recordings/digitalocean-chat/haiku-continues-a-tool-call-with-cache-markers.json +54 -0
- package/test/fixtures/recordings/digitalocean-chat/haiku-reuses-a-cached-prompt.json +53 -0
- package/test/fixtures/recordings/digitalocean-decision/decides-choice-score-and-predicate-questions.json +33 -0
- package/test/fixtures/recordings/digitalocean-responses/calls-a-freeform-text-tool.json +35 -0
- package/test/fixtures/recordings/digitalocean-responses/continues-a-tool-call.json +53 -0
- package/test/fixtures/recordings/digitalocean-responses/streams-text.json +35 -0
- package/test/fixtures/recordings/elevenlabs-speech/generates-speech.json +35 -0
- package/test/fixtures/recordings/elevenlabs-speech/streams-speech-with-timestamps.json +34 -0
- package/test/fixtures/recordings/elevenlabs-transcription/groups-diarized-words-into-speaker-turns.json +32 -0
- package/test/fixtures/recordings/elevenlabs-transcription/transcribes-audio-with-word-timestamps.json +50 -0
- package/test/fixtures/recordings/gemini/gemini-2-5-flash-image.json +32 -0
- package/test/fixtures/recordings/gemini-cache/reports-cachedcontenttokencount-on-identical-second-call.json +46 -0
- package/test/fixtures/recordings/google-decision/decides-choice-score-and-predicate-questions.json +33 -0
- package/test/fixtures/recordings/google-embedding/embeds-an-image-and-text-into-one-vector-each.json +32 -0
- package/test/fixtures/recordings/google-embedding/embeds-text-through-batchembedcontents.json +32 -0
- package/test/fixtures/recordings/google-embedding/maps-inputtype-to-a-task-type-for-gemini-embedding-001.json +50 -0
- package/test/fixtures/recordings/google-images/edits-an-image.json +28 -0
- package/test/fixtures/recordings/google-images/generates-an-image.json +28 -0
- package/test/fixtures/recordings/google-interactions/continues-tool-results-with-previous-interaction-id.json +66 -0
- package/test/fixtures/recordings/google-interactions/replays-native-tool-results-and-signatures-statelessly.json +50 -0
- package/test/fixtures/recordings/google-interactions/streams-reasoning-and-retains-thought-signatures.json +32 -0
- package/test/fixtures/recordings/google-interactions/streams-text-and-reports-usage.json +32 -0
- package/test/fixtures/recordings/google-interactions-video/generates-a-video.json +96 -0
- package/test/fixtures/recordings/google-speech/generates-speech.json +32 -0
- package/test/fixtures/recordings/google-speech/streams-speech.json +32 -0
- package/test/fixtures/recordings/google-transcription/streams-speaker-turns.json +32 -0
- package/test/fixtures/recordings/google-transcription/transcribes-with-speakers-and-word-timestamps.json +32 -0
- package/test/fixtures/recordings/google-vertex/calls-a-tool.json +32 -0
- package/test/fixtures/recordings/google-vertex/continues-after-a-tool-result.json +32 -0
- package/test/fixtures/recordings/google-vertex/streams-text.json +32 -0
- package/test/fixtures/recordings/google-vertex-embedding/embeds-gemini-embedding-001-one-text-per-predict-request.json +50 -0
- package/test/fixtures/recordings/google-vertex-embedding/embeds-text-through-predict.json +32 -0
- package/test/fixtures/recordings/groq-chat/continues-qwen-parallel-tool-calls.json +47 -0
- package/test/fixtures/recordings/groq-chat/replays-gpt-oss-reasoning-through-a-tool-loop.json +47 -0
- package/test/fixtures/recordings/groq-chat/streams-qwen-parsed-reasoning.json +29 -0
- package/test/fixtures/recordings/groq-chat/streams-text-with-usage.json +29 -0
- package/test/fixtures/recordings/meta-chat/continues-a-generated-tool-call.json +56 -0
- package/test/fixtures/recordings/meta-chat/streams-text-with-default-reasoning.json +37 -0
- package/test/fixtures/recordings/meta-chat/streams-text-with-high-reasoning.json +29 -0
- package/test/fixtures/recordings/meta-chat/streams-text-with-low-reasoning.json +29 -0
- package/test/fixtures/recordings/meta-chat/streams-text-with-max-reasoning.json +29 -0
- package/test/fixtures/recordings/meta-chat/streams-text-with-medium-reasoning.json +37 -0
- package/test/fixtures/recordings/meta-chat/streams-text-with-minimal-reasoning.json +37 -0
- package/test/fixtures/recordings/meta-chat/streams-text-with-xhigh-reasoning.json +29 -0
- package/test/fixtures/recordings/meta-images/edits-image-bytes-and-returns-png.json +29 -0
- package/test/fixtures/recordings/meta-images/generates-default-webp-bytes.json +29 -0
- package/test/fixtures/recordings/meta-images/replays-a-signed-image-handle-for-a-responses-edit.json +55 -0
- package/test/fixtures/recordings/meta-messages/replays-encrypted-thinking-through-a-tool-loop.json +54 -0
- package/test/fixtures/recordings/meta-messages/streams-text-with-adaptive-thinking.json +36 -0
- package/test/fixtures/recordings/meta-messages/streams-text-with-enabled-thinking.json +36 -0
- package/test/fixtures/recordings/meta-responses/replays-encrypted-reasoning-through-a-tool-loop.json +56 -0
- package/test/fixtures/recordings/meta-responses/streams-text-with-default-reasoning.json +37 -0
- package/test/fixtures/recordings/meta-responses/streams-text-with-high-reasoning.json +37 -0
- package/test/fixtures/recordings/meta-responses/streams-text-with-low-reasoning.json +37 -0
- package/test/fixtures/recordings/meta-responses/streams-text-with-max-reasoning.json +37 -0
- package/test/fixtures/recordings/meta-responses/streams-text-with-medium-reasoning.json +37 -0
- package/test/fixtures/recordings/meta-responses/streams-text-with-minimal-reasoning.json +37 -0
- package/test/fixtures/recordings/meta-responses/streams-text-with-xhigh-reasoning.json +37 -0
- package/test/fixtures/recordings/meta-search/searches-and-replays-grounded-messages.json +56 -0
- package/test/fixtures/recordings/meta-search/searches-and-replays-grounded-responses.json +56 -0
- package/test/fixtures/recordings/minimax-chat/m3-continues-a-tool-loop-with-default-thinking.json +56 -0
- package/test/fixtures/recordings/minimax-chat/m3-streams-text-with-thinking-disabled.json +36 -0
- package/test/fixtures/recordings/minimax-images/generates-an-image.json +32 -0
- package/test/fixtures/recordings/minimax-images/generates-from-a-subject-reference.json +32 -0
- package/test/fixtures/recordings/minimax-messages/m2-7-streams-default-thinking.json +36 -0
- package/test/fixtures/recordings/minimax-messages/m3-continues-a-tool-loop-with-adaptive-thinking.json +56 -0
- package/test/fixtures/recordings/minimax-messages/m3-generates-a-named-tool-call-with-default-thinking-off.json +36 -0
- package/test/fixtures/recordings/minimax-messages/m3-streams-adaptive-thinking.json +36 -0
- package/test/fixtures/recordings/minimax-messages/m3-streams-text-with-thinking-disabled.json +36 -0
- package/test/fixtures/recordings/minimax-responses/m3-continues-a-tool-loop-with-effort-minimal.json +56 -0
- package/test/fixtures/recordings/minimax-responses/m3-streams-text-with-effort-none.json +36 -0
- package/test/fixtures/recordings/minimax-video/generates-a-hailuo-video-from-a-first-frame.json +176 -0
- package/test/fixtures/recordings/minimax-video/generates-an-h3-video.json +96 -0
- package/test/fixtures/recordings/mistral-chat/drives-a-tool-loop.json +54 -0
- package/test/fixtures/recordings/mistral-chat/replays-native-reasoning.json +47 -0
- package/test/fixtures/recordings/mistral-chat/streams-text-with-usage.json +29 -0
- package/test/fixtures/recordings/mistral-chat-glm/streams-an-indexed-tool-call.json +36 -0
- package/test/fixtures/recordings/moonshot-chat/k3-reads-image-bytes.json +29 -0
- package/test/fixtures/recordings/moonshot-chat/k3-respects-tool-choice-none.json +29 -0
- package/test/fixtures/recordings/moonshot-chat/k3-respects-tool-choice-required.json +29 -0
- package/test/fixtures/recordings/moonshot-chat/k3-returns-native-structured-output.json +29 -0
- package/test/fixtures/recordings/moonshot-chat/k3-streams-text-with-default-effort.json +29 -0
- package/test/fixtures/recordings/moonshot-chat/k3-streams-text-with-high-effort.json +29 -0
- package/test/fixtures/recordings/moonshot-chat/k3-streams-text-with-low-effort.json +29 -0
- package/test/fixtures/recordings/moonshot-chat/k3-streams-text-with-max-effort.json +29 -0
- package/test/fixtures/recordings/moonshot-chat/kimi-k2-6-preserves-reasoning-through-a-tool-loop-and-follow-up.json +74 -0
- package/test/fixtures/recordings/moonshot-chat/kimi-k2-6-streams-text-with-default-thinking.json +29 -0
- package/test/fixtures/recordings/moonshot-chat/kimi-k2-6-streams-text-with-disabled-thinking.json +29 -0
- package/test/fixtures/recordings/moonshot-chat/kimi-k2-6-streams-text-with-enabled-thinking.json +29 -0
- package/test/fixtures/recordings/moonshot-chat/kimi-k2-7-code-highspeed-preserves-reasoning-through-a-tool-loop-and-follow-up.json +74 -0
- package/test/fixtures/recordings/moonshot-chat/kimi-k2-7-code-highspeed-streams-text-with-default-thinking.json +29 -0
- package/test/fixtures/recordings/moonshot-chat/kimi-k2-7-code-preserves-reasoning-through-a-tool-loop-and-follow-up.json +74 -0
- package/test/fixtures/recordings/moonshot-chat/kimi-k2-7-code-streams-text-with-default-thinking.json +29 -0
- package/test/fixtures/recordings/moonshot-chat/kimi-k3-preserves-reasoning-through-a-tool-loop-and-follow-up.json +74 -0
- package/test/fixtures/recordings/moonshot-messages/k3-reads-image-bytes.json +36 -0
- package/test/fixtures/recordings/moonshot-messages/k3-respects-tool-choice-none.json +36 -0
- package/test/fixtures/recordings/moonshot-messages/k3-respects-tool-choice-required.json +36 -0
- package/test/fixtures/recordings/moonshot-messages/k3-returns-native-structured-output.json +35 -0
- package/test/fixtures/recordings/moonshot-messages/k3-streams-text-with-default-effort.json +36 -0
- package/test/fixtures/recordings/moonshot-messages/k3-streams-text-with-high-effort.json +36 -0
- package/test/fixtures/recordings/moonshot-messages/k3-streams-text-with-low-effort.json +36 -0
- package/test/fixtures/recordings/moonshot-messages/k3-streams-text-with-max-effort.json +36 -0
- package/test/fixtures/recordings/moonshot-messages/kimi-k3-preserves-reasoning-through-a-tool-loop-and-follow-up.json +74 -0
- package/test/fixtures/recordings/moonshot-responses/k3-reads-image-bytes.json +36 -0
- package/test/fixtures/recordings/moonshot-responses/k3-rejects-unsupported-tool-choice-none.json +36 -0
- package/test/fixtures/recordings/moonshot-responses/k3-rejects-unsupported-tool-choice-required.json +36 -0
- package/test/fixtures/recordings/moonshot-responses/k3-returns-native-structured-output.json +35 -0
- package/test/fixtures/recordings/moonshot-responses/k3-streams-text-with-default-effort.json +36 -0
- package/test/fixtures/recordings/moonshot-responses/k3-streams-text-with-high-effort.json +36 -0
- package/test/fixtures/recordings/moonshot-responses/k3-streams-text-with-low-effort.json +36 -0
- package/test/fixtures/recordings/moonshot-responses/k3-streams-text-with-max-effort.json +36 -0
- package/test/fixtures/recordings/moonshot-responses/kimi-k3-preserves-reasoning-through-a-tool-loop-and-follow-up.json +74 -0
- package/test/fixtures/recordings/openai-compatible-chat/gemini-parallel-tool-signatures.json +54 -0
- package/test/fixtures/recordings/openai-compatible-chat/togetherai-streams-text.json +28 -0
- package/test/fixtures/recordings/openai-compatible-chat/togetherai-streams-tool-call.json +28 -0
- package/test/fixtures/recordings/openai-decision/decides-choice-score-and-predicate-questions-about-json-state.json +33 -0
- package/test/fixtures/recordings/openai-embedding/embeds-text-with-requested-dimensions.json +33 -0
- package/test/fixtures/recordings/openai-images/edits-an-image.json +28 -0
- package/test/fixtures/recordings/openai-images/generates-an-image.json +28 -0
- package/test/fixtures/recordings/openai-images/streams-a-partial-image-before-the-final-image.json +32 -0
- package/test/fixtures/recordings/openai-responses/openai-responses-gpt-5-5-image-tool-result.json +42 -0
- package/test/fixtures/recordings/openai-responses/openai-responses-gpt-5-5-reasoning-continuation.json +58 -0
- package/test/fixtures/recordings/openai-responses/openai-responses-gpt-5-5-reasoning.json +38 -0
- package/test/fixtures/recordings/openai-responses/openai-responses-gpt-5-5-tool-loop.json +57 -0
- package/test/fixtures/recordings/openai-responses-cache/caches-the-system-prompt-on-gpt-6-2-sol.json +51 -0
- package/test/fixtures/recordings/openai-responses-cache/reports-cached-tokens-on-identical-second-call.json +51 -0
- package/test/fixtures/recordings/openai-responses-images/generates-and-edits-an-image-with-the-hosted-tool.json +50 -0
- package/test/fixtures/recordings/openai-responses-websocket/continues-a-tool-call-over-one-socket.json +588 -0
- package/test/fixtures/recordings/openai-responses-websocket/reconstructs-full-context-after-reconnect.json +167 -0
- package/test/fixtures/recordings/openai-responses-websocket/recovers-from-explicit-continuation-rejection.json +167 -0
- package/test/fixtures/recordings/openai-speech/generates-speech.json +33 -0
- package/test/fixtures/recordings/openai-speech/streams-speech.json +32 -0
- package/test/fixtures/recordings/openai-transcription/diarizes-speakers-into-segments.json +32 -0
- package/test/fixtures/recordings/openai-transcription/returns-whisper-word-timestamps.json +32 -0
- package/test/fixtures/recordings/openai-transcription/streams-text-deltas.json +32 -0
- package/test/fixtures/recordings/openai-transcription/transcribes-with-a-language-hint.json +32 -0
- package/test/fixtures/recordings/opencode-decision/decides-choice-score-and-predicate-questions.json +33 -0
- package/test/fixtures/recordings/openrouter-decision/decides-choice-score-and-predicate-questions.json +33 -0
- package/test/fixtures/recordings/openrouter-images/edits-an-image-through-input-references.json +32 -0
- package/test/fixtures/recordings/openrouter-images/renders-flux-3-from-an-aspect-ratio-and-tier.json +32 -0
- package/test/fixtures/recordings/openrouter-images/renders-gemini-at-the-requested-2k-tier.json +32 -0
- package/test/fixtures/recordings/openrouter-reasoning-tool-loop.json +55 -0
- package/test/fixtures/recordings/openrouter-reasoning.json +29 -0
- package/test/fixtures/recordings/openrouter-responses/calls-a-freeform-text-tool.json +35 -0
- package/test/fixtures/recordings/openrouter-responses/continues-a-tool-call.json +53 -0
- package/test/fixtures/recordings/openrouter-responses/streams-text.json +35 -0
- package/test/fixtures/recordings/openrouter-video/generates-a-video.json +113 -0
- package/test/fixtures/recordings/pdf/anthropic-tool-result.json +28 -0
- package/test/fixtures/recordings/pdf/anthropic-user-input.json +28 -0
- package/test/fixtures/recordings/pdf/bedrock-tool-result.json +29 -0
- package/test/fixtures/recordings/pdf/bedrock-user-input.json +29 -0
- package/test/fixtures/recordings/pdf/gemini-tool-result.json +53 -0
- package/test/fixtures/recordings/pdf/gemini-user-input.json +28 -0
- package/test/fixtures/recordings/pdf/openai-tool-result.json +35 -0
- package/test/fixtures/recordings/pdf/openai-user-input.json +34 -0
- package/test/fixtures/recordings/pdf/xai-tool-result.json +35 -0
- package/test/fixtures/recordings/pdf/xai-user-input.json +34 -0
- package/test/fixtures/recordings/typesafe-decision/decides-choice-score-and-predicate-questions.json +33 -0
- package/test/fixtures/recordings/venice-chat/claude-opus-4-8-preserves-reasoning-through-a-tool-loop-and-follow-up.json +75 -0
- package/test/fixtures/recordings/venice-chat/deepseek-v4-flash-preserves-reasoning-through-a-tool-loop-and-follow-up.json +75 -0
- package/test/fixtures/recordings/venice-chat/gemini-3-1-pro-preview-preserves-reasoning-through-a-tool-loop-and-follow-up.json +75 -0
- package/test/fixtures/recordings/venice-chat/gemini-preserves-per-call-signatures-through-parallel-tools.json +71 -0
- package/test/fixtures/recordings/venice-chat/openai-gpt-54-mini-preserves-reasoning-through-a-tool-loop-and-follow-up.json +75 -0
- package/test/fixtures/recordings/venice-chat/qwen-disables-reasoning.json +35 -0
- package/test/fixtures/recordings/venice-chat/surfaces-venice-model-errors.json +33 -0
- package/test/fixtures/recordings/venice-responses/calls-a-freeform-text-tool.json +35 -0
- package/test/fixtures/recordings/venice-responses/continues-a-tool-call.json +53 -0
- package/test/fixtures/recordings/venice-responses/streams-text.json +35 -0
- package/test/fixtures/recordings/vercel-ai-gateway-images/generates-an-image.json +32 -0
- package/test/fixtures/recordings/vercel-ai-gateway-images/sizes-grok-through-xai-provider-options.json +32 -0
- package/test/fixtures/recordings/vercel-ai-gateway-reasoning-tool-loop.json +55 -0
- package/test/fixtures/recordings/vercel-ai-gateway-reasoning.json +29 -0
- package/test/fixtures/recordings/vercel-native/automatically-caches-distinct-claude-system-blocks.json +49 -0
- package/test/fixtures/recordings/vercel-native/continues-chat-claude-reasoning-and-tools.json +49 -0
- package/test/fixtures/recordings/vercel-native/continues-chat-muse-reasoning-and-tools.json +49 -0
- package/test/fixtures/recordings/vercel-native/continues-messages-claude-reasoning-and-tools.json +49 -0
- package/test/fixtures/recordings/vercel-native/continues-messages-deepseek-reasoning-and-tools.json +49 -0
- package/test/fixtures/recordings/vercel-native/continues-messages-gemini-reasoning-and-tools.json +49 -0
- package/test/fixtures/recordings/vercel-native/continues-responses-gpt-reasoning-and-tools.json +49 -0
- package/test/fixtures/recordings/vercel-native/continues-responses-grok-reasoning-and-tools.json +49 -0
- package/test/fixtures/recordings/vercel-native/rejects-invalid-credentials-without-retryable-classification.json +31 -0
- package/test/fixtures/recordings/xai-images/edits-an-image.json +28 -0
- package/test/fixtures/recordings/xai-images/generates-an-image.json +28 -0
- package/test/fixtures/recordings/xai-video/generates-a-video.json +129 -0
- package/test/fixtures/recordings/zai-chat/glm-4-5-calls-a-tool-without-streaming-arguments.json +28 -0
- package/test/fixtures/recordings/zai-chat/glm-4-7-streams-thinking-disabled.json +28 -0
- package/test/fixtures/recordings/zai-chat/glm-4-7-streams-thinking-enabled.json +28 -0
- package/test/fixtures/recordings/zai-chat/glm-5-2-streams-high-effort.json +28 -0
- package/test/fixtures/recordings/zai-chat/glm-5-2-streams-low-effort.json +28 -0
- package/test/fixtures/recordings/zai-chat/glm-5-2-streams-max-effort.json +28 -0
- package/test/fixtures/recordings/zai-chat/glm-5-2-streams-medium-effort.json +28 -0
- package/test/fixtures/recordings/zai-chat/glm-5-2-streams-minimal-effort.json +28 -0
- package/test/fixtures/recordings/zai-chat/glm-5-2-streams-none-effort.json +28 -0
- package/test/fixtures/recordings/zai-chat/glm-5-2-streams-thinking-disabled.json +28 -0
- package/test/fixtures/recordings/zai-chat/glm-5-2-streams-thinking-enabled.json +28 -0
- package/test/fixtures/recordings/zai-chat/glm-5-2-streams-xhigh-effort.json +28 -0
- package/test/fixtures/recordings/zai-chat/glm-5-3-flash-reads-image-bytes.json +28 -0
- package/test/fixtures/recordings/zai-chat/glm-5-3-preserves-reasoning-through-a-tool-loop-and-follow-up.json +64 -0
- package/test/fixtures/recordings/zai-chat/glm-5-3-rejects-disabled-thinking.json +27 -0
- package/test/fixtures/recordings/zai-chat/glm-5-3-returns-a-json-object.json +28 -0
- package/test/fixtures/recordings/zai-chat/glm-5-3-streams-default-effort.json +28 -0
- package/test/fixtures/recordings/zai-chat/glm-5-3-streams-high-effort.json +28 -0
- package/test/fixtures/recordings/zai-chat/glm-5-3-streams-low-effort.json +28 -0
- package/test/fixtures/recordings/zai-chat/glm-5-3-streams-max-effort.json +28 -0
- package/test/fixtures/recordings/zai-images/generates-an-image.json +28 -0
- package/test/generate-object.test.ts +281 -0
- package/test/generation.test.ts +191 -0
- package/test/google-interactions-video.test.ts +351 -0
- package/test/http-hooks.test.ts +137 -0
- package/test/http-timeout.test.ts +287 -0
- package/test/image-job.test.ts +199 -0
- package/test/image-sizing.test.ts +47 -0
- package/test/image.test.ts +1114 -0
- package/test/image.types.ts +203 -0
- package/test/keyless-auth.test.ts +85 -0
- package/test/lib/effect.ts +50 -0
- package/test/lib/env.ts +30 -0
- package/test/lib/http.ts +141 -0
- package/test/lib/image.ts +29 -0
- package/test/lib/openai-chunks.ts +27 -0
- package/test/lib/sse.ts +20 -0
- package/test/lib/tool-runtime.ts +152 -0
- package/test/llm-option-types.types.ts +153 -0
- package/test/llm.test.ts +286 -0
- package/test/loop-steps.test.ts +77 -0
- package/test/loop-tools.types.ts +79 -0
- package/test/loop.test.ts +425 -0
- package/test/media-input.test.ts +98 -0
- package/test/media-usage.test.ts +13 -0
- package/test/media.test.ts +340 -0
- package/test/minimax-video.test.ts +553 -0
- package/test/openai-freeform.test.ts +252 -0
- package/test/openrouter-video.test.ts +294 -0
- package/test/partial-json.test.ts +58 -0
- package/test/promise-parity.types.ts +83 -0
- package/test/promise.test.ts +632 -0
- package/test/provider/alibaba-capabilities.recorded.test.ts +253 -0
- package/test/provider/alibaba-images.recorded.test.ts +71 -0
- package/test/provider/alibaba-images.test.ts +199 -0
- package/test/provider/alibaba.recorded.test.ts +165 -0
- package/test/provider/alibaba.test.ts +419 -0
- package/test/provider/anthropic-compaction.test.ts +171 -0
- package/test/provider/anthropic-messages-cache.recorded.test.ts +111 -0
- package/test/provider/anthropic-messages.recorded.test.ts +45 -0
- package/test/provider/anthropic-messages.test.ts +2609 -0
- package/test/provider/anthropic-thinking-binding.test.ts +65 -0
- package/test/provider/assemblyai-transcription.recorded.test.ts +39 -0
- package/test/provider/azure.recorded.test.ts +139 -0
- package/test/provider/azure.test.ts +48 -0
- package/test/provider/bedrock-converse-cache.recorded.test.ts +61 -0
- package/test/provider/bedrock-converse-cache.test.ts +168 -0
- package/test/provider/bedrock-converse-options.recorded.test.ts +119 -0
- package/test/provider/bedrock-converse-options.test.ts +149 -0
- package/test/provider/bedrock-converse-thinking-binding.recorded.test.ts +103 -0
- package/test/provider/bedrock-converse-thinking-binding.test.ts +107 -0
- package/test/provider/bedrock-converse.test.ts +2548 -0
- package/test/provider/bedrock-mantle.test.ts +444 -0
- package/test/provider/bedrock-mistral-ids.test.ts +86 -0
- package/test/provider/cartesia-speech.recorded.test.ts +47 -0
- package/test/provider/checkpoint.test.ts +324 -0
- package/test/provider/cloudflare-workers-ai-images.recorded.test.ts +57 -0
- package/test/provider/cloudflare-workers-ai-images.test.ts +155 -0
- package/test/provider/cloudflare.test.ts +330 -0
- package/test/provider/cohere.recorded.test.ts +94 -0
- package/test/provider/cohere.test.ts +301 -0
- package/test/provider/compaction-websocket.test.ts +50 -0
- package/test/provider/compaction.recorded.test.ts +89 -0
- package/test/provider/compaction.test.ts +178 -0
- package/test/provider/conversation-lowering.test.ts +31 -0
- package/test/provider/decision.recorded.test.ts +211 -0
- package/test/provider/deepgram-speech.recorded.test.ts +41 -0
- package/test/provider/deepgram-transcription.recorded.test.ts +47 -0
- package/test/provider/digitalocean.recorded.test.ts +78 -0
- package/test/provider/digitalocean.test.ts +123 -0
- package/test/provider/elevenlabs-speech.recorded.test.ts +54 -0
- package/test/provider/elevenlabs-transcription.recorded.test.ts +50 -0
- package/test/provider/embedding.recorded.test.ts +109 -0
- package/test/provider/empty-tool-choice.test.ts +80 -0
- package/test/provider/error-retention.test.ts +158 -0
- package/test/provider/explicit-compaction.test.ts +503 -0
- package/test/provider/extraction.recorded.test.ts +46 -0
- package/test/provider/freeform-tools.test.ts +446 -0
- package/test/provider/gemini-cache.recorded.test.ts +49 -0
- package/test/provider/gemini-openai-chat.recorded.test.ts +69 -0
- package/test/provider/gemini.test.ts +2336 -0
- package/test/provider/golden.recorded.test.ts +287 -0
- package/test/provider/google-images.recorded.test.ts +53 -0
- package/test/provider/google-interactions-video.recorded.test.ts +48 -0
- package/test/provider/google-interactions.recorded.test.ts +169 -0
- package/test/provider/google-interactions.test.ts +593 -0
- package/test/provider/google-speech.recorded.test.ts +45 -0
- package/test/provider/google-transcription.recorded.test.ts +54 -0
- package/test/provider/google-vertex-interactions.test.ts +307 -0
- package/test/provider/google-vertex.recorded.test.ts +75 -0
- package/test/provider/google-vertex.test.ts +595 -0
- package/test/provider/groq.recorded.test.ts +187 -0
- package/test/provider/groq.test.ts +134 -0
- package/test/provider/image-detail.test.ts +58 -0
- package/test/provider/media-entrypoints.test.ts +618 -0
- package/test/provider/meta-capabilities.test.ts +216 -0
- package/test/provider/meta-images.recorded.test.ts +119 -0
- package/test/provider/meta-messages.recorded.test.ts +121 -0
- package/test/provider/meta-search.recorded.test.ts +97 -0
- package/test/provider/meta.recorded.test.ts +182 -0
- package/test/provider/meta.test.ts +140 -0
- package/test/provider/minimax-images.recorded.test.ts +52 -0
- package/test/provider/minimax-images.test.ts +236 -0
- package/test/provider/minimax-video.recorded.test.ts +83 -0
- package/test/provider/minimax.recorded.test.ts +257 -0
- package/test/provider/minimax.test.ts +110 -0
- package/test/provider/missing-tool-input.test.ts +73 -0
- package/test/provider/mistral-chat.test.ts +757 -0
- package/test/provider/mistral.recorded.test.ts +170 -0
- package/test/provider/moonshot-capabilities.recorded.test.ts +131 -0
- package/test/provider/moonshot.recorded.test.ts +191 -0
- package/test/provider/moonshot.test.ts +218 -0
- package/test/provider/native-providers.test.ts +299 -0
- package/test/provider/open-responses-errors.test.ts +141 -0
- package/test/provider/open-responses-finals.test.ts +209 -0
- package/test/provider/open-responses-lifecycle.test.ts +526 -0
- package/test/provider/open-responses-replay.test.ts +120 -0
- package/test/provider/openai-chat-reasoning.recorded.test.ts +154 -0
- package/test/provider/openai-chat.test.ts +2505 -0
- package/test/provider/openai-compatible-chat.test.ts +819 -0
- package/test/provider/openai-compatible-responses.test.ts +1139 -0
- package/test/provider/openai-images.recorded.test.ts +91 -0
- package/test/provider/openai-responses-cache.recorded.test.ts +68 -0
- package/test/provider/openai-responses-images.recorded.test.ts +66 -0
- package/test/provider/openai-responses-websocket.recorded.test.ts +221 -0
- package/test/provider/openai-responses.test.ts +5414 -0
- package/test/provider/openai-speech.recorded.test.ts +38 -0
- package/test/provider/openai-transcription.recorded.test.ts +91 -0
- package/test/provider/openrouter-images.recorded.test.ts +76 -0
- package/test/provider/openrouter-video.recorded.test.ts +53 -0
- package/test/provider/openrouter.test.ts +656 -0
- package/test/provider/pdf.recorded.test.ts +211 -0
- package/test/provider/queued-recording.ts +10 -0
- package/test/provider/responses-routes.recorded.test.ts +91 -0
- package/test/provider/seedance-video.recorded.test.ts +52 -0
- package/test/provider/speech-recording.ts +19 -0
- package/test/provider/transcription-recording.ts +41 -0
- package/test/provider/venice.recorded.test.ts +237 -0
- package/test/provider/venice.test.ts +373 -0
- package/test/provider/vercel-ai-gateway-images.recorded.test.ts +55 -0
- package/test/provider/vercel-ai-gateway.recorded.test.ts +125 -0
- package/test/provider/vercel-ai-gateway.test.ts +303 -0
- package/test/provider/xai-images.recorded.test.ts +54 -0
- package/test/provider/xai-images.test.ts +109 -0
- package/test/provider/xai-responses.test.ts +339 -0
- package/test/provider/xai-video.recorded.test.ts +54 -0
- package/test/provider/zai-capabilities.recorded.test.ts +156 -0
- package/test/provider/zai-images.recorded.test.ts +33 -0
- package/test/provider/zai-images.test.ts +163 -0
- package/test/provider/zai.recorded.test.ts +115 -0
- package/test/provider/zai.test.ts +374 -0
- package/test/provider-api-methods.types.ts +8 -0
- package/test/provider-error.test.ts +800 -0
- package/test/provider-model.types.ts +37 -0
- package/test/provider-options/alibaba.types.ts +46 -0
- package/test/provider-options/amazon-bedrock.types.ts +33 -0
- package/test/provider-options/anthropic-compatible.types.ts +13 -0
- package/test/provider-options/anthropic.types.ts +30 -0
- package/test/provider-options/azure.types.ts +13 -0
- package/test/provider-options/checkpoint.types.ts +150 -0
- package/test/provider-options/cloudflare.types.ts +13 -0
- package/test/provider-options/compaction.types.ts +146 -0
- package/test/provider-options/google-vertex-chat.types.ts +7 -0
- package/test/provider-options/google-vertex-interactions.types.ts +29 -0
- package/test/provider-options/google-vertex-messages.types.ts +13 -0
- package/test/provider-options/google-vertex-responses.types.ts +14 -0
- package/test/provider-options/google-vertex.types.ts +17 -0
- package/test/provider-options/google.types.ts +43 -0
- package/test/provider-options/minimax.types.ts +33 -0
- package/test/provider-options/mistral.types.ts +24 -0
- package/test/provider-options/moonshot.types.ts +45 -0
- package/test/provider-options/openai-compatible-responses.types.ts +17 -0
- package/test/provider-options/openai-compatible.types.ts +13 -0
- package/test/provider-options/openai.types.ts +27 -0
- package/test/provider-options/openrouter.types.ts +55 -0
- package/test/provider-options/venice.types.ts +39 -0
- package/test/provider-options/vercel-ai-gateway.types.ts +30 -0
- package/test/provider-options/xai.types.ts +14 -0
- package/test/provider-options/zai.types.ts +42 -0
- package/test/provider-package.test.ts +586 -0
- package/test/raw-events.test.ts +75 -0
- package/test/realtime.test.ts +172 -0
- package/test/recorded-golden.ts +104 -0
- package/test/recorded-runner.ts +101 -0
- package/test/recorded-scenarios.ts +468 -0
- package/test/recorded-test.ts +127 -0
- package/test/recorded-utils.ts +56 -0
- package/test/request-encoding.test.ts +57 -0
- package/test/request-transport.test.ts +74 -0
- package/test/response.test.ts +203 -0
- package/test/route.test.ts +225 -0
- package/test/sanitize.test.ts +80 -0
- package/test/schema.test.ts +412 -0
- package/test/seedance-video.test.ts +418 -0
- package/test/speech.test.ts +297 -0
- package/test/speech.types.ts +33 -0
- package/test/testing.test.ts +372 -0
- package/test/tool-history.test.ts +162 -0
- package/test/tool-runtime.test.ts +926 -0
- package/test/tool-schema-projection.test.ts +427 -0
- package/test/tool-stream.test.ts +252 -0
- package/test/tool-updates.test.ts +849 -0
- package/test/tool.types.ts +131 -0
- package/test/transcription.test.ts +618 -0
- package/test/transcription.types.ts +44 -0
- package/test/video.test.ts +447 -0
- package/test/video.types.ts +110 -0
- package/tsconfig.build.json +8 -0
- package/tsconfig.json +17 -0
- package/tsconfig.types.json +16 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { Effect, Option } from "effect"
|
|
2
|
+
import { AIError, LLMEvent, type ProviderMetadata, type ToolCall, type ToolInputError } from "../../schema/index.js"
|
|
3
|
+
import { eventError, parseToolInput, type ToolAccumulator } from "../shared.js"
|
|
4
|
+
import { parse } from "./partial-json.js"
|
|
5
|
+
|
|
6
|
+
type StreamKey = string | number
|
|
7
|
+
const parsePartialInput = Option.liftThrowable(parse)
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* One pending streamed tool call. Providers emit the tool identity and JSON
|
|
11
|
+
* argument text across separate chunks; `input` is the raw JSON string collected
|
|
12
|
+
* so far, not the parsed object.
|
|
13
|
+
*/
|
|
14
|
+
export interface PendingTool extends ToolAccumulator {
|
|
15
|
+
readonly providerExecuted?: boolean
|
|
16
|
+
readonly providerMetadata?: ProviderMetadata
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Sparse parser state keyed by the provider's stream-local tool identifier.
|
|
21
|
+
*
|
|
22
|
+
* This key is not the final tool-call id (`call_...`). It is the id/index the
|
|
23
|
+
* provider uses while streaming a partial call: OpenAI Chat / Anthropic /
|
|
24
|
+
* Bedrock use numeric content indexes, while OpenAI Responses uses string
|
|
25
|
+
* `item_id`s. The generic keeps each protocol internally consistent.
|
|
26
|
+
*/
|
|
27
|
+
export type State<K extends StreamKey> = Partial<Record<K, PendingTool>>
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Result of adding argument text to one pending tool call. It returns both the
|
|
31
|
+
* next `tools` state and the updated `tool` because parsers often need the
|
|
32
|
+
* current id/name immediately. `events` contains lifecycle and delta events
|
|
33
|
+
* produced by the append; metadata-only deltas update identity without output.
|
|
34
|
+
*/
|
|
35
|
+
export interface AppendOutcome<K extends StreamKey> {
|
|
36
|
+
readonly tools: State<K>
|
|
37
|
+
readonly tool: PendingTool
|
|
38
|
+
readonly events: ReadonlyArray<LLMEvent>
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Create empty accumulator state for one provider stream. */
|
|
42
|
+
export const empty = <K extends StreamKey>(): State<K> => ({})
|
|
43
|
+
|
|
44
|
+
const withTool = <K extends StreamKey>(tools: State<K>, key: K, tool: PendingTool): State<K> => {
|
|
45
|
+
return { ...tools, [key]: tool }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const withoutTool = <K extends StreamKey>(tools: State<K>, key: K): State<K> => {
|
|
49
|
+
const next = { ...tools }
|
|
50
|
+
delete next[key]
|
|
51
|
+
return next
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const inputStart = (tool: PendingTool) =>
|
|
55
|
+
LLMEvent.toolInputStart({
|
|
56
|
+
id: tool.id,
|
|
57
|
+
name: tool.name,
|
|
58
|
+
namespace: tool.namespace,
|
|
59
|
+
providerExecuted: tool.providerExecuted ? true : undefined,
|
|
60
|
+
providerMetadata: tool.providerMetadata,
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const inputDelta = (tool: PendingTool, text: string): LLMEvent => {
|
|
64
|
+
const raw = tool.input
|
|
65
|
+
let parsed: unknown
|
|
66
|
+
return {
|
|
67
|
+
...LLMEvent.toolInputDelta({
|
|
68
|
+
id: tool.id,
|
|
69
|
+
name: tool.name,
|
|
70
|
+
namespace: tool.namespace,
|
|
71
|
+
text,
|
|
72
|
+
}),
|
|
73
|
+
get input() {
|
|
74
|
+
return (parsed ??= Option.getOrElse(parsePartialInput(raw), () => ({})))
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const toolCall = (route: string, tool: PendingTool, inputOverride?: string) => {
|
|
80
|
+
const raw = inputOverride ?? tool.input
|
|
81
|
+
return parseToolInput(route, tool.name, raw).pipe(
|
|
82
|
+
Effect.map(
|
|
83
|
+
(input): ToolCall =>
|
|
84
|
+
LLMEvent.toolCall({
|
|
85
|
+
id: tool.id,
|
|
86
|
+
name: tool.name,
|
|
87
|
+
namespace: tool.namespace,
|
|
88
|
+
input,
|
|
89
|
+
providerExecuted: tool.providerExecuted ? true : undefined,
|
|
90
|
+
providerMetadata: tool.providerMetadata,
|
|
91
|
+
}),
|
|
92
|
+
),
|
|
93
|
+
Effect.catch((error) =>
|
|
94
|
+
tool.providerExecuted
|
|
95
|
+
? Effect.fail(error)
|
|
96
|
+
: Effect.succeed(LLMEvent.toolInputError({ id: tool.id, name: tool.name, namespace: tool.namespace, raw })),
|
|
97
|
+
),
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const finishEvents = (tool: PendingTool, event: ToolCall | ToolInputError): ReadonlyArray<LLMEvent> => [
|
|
102
|
+
LLMEvent.toolInputEnd({
|
|
103
|
+
id: tool.id,
|
|
104
|
+
name: tool.name,
|
|
105
|
+
namespace: tool.namespace,
|
|
106
|
+
providerMetadata: tool.providerMetadata,
|
|
107
|
+
}),
|
|
108
|
+
event,
|
|
109
|
+
]
|
|
110
|
+
|
|
111
|
+
/** Store the updated tool and produce the optional public delta event. */
|
|
112
|
+
const appendTool = <K extends StreamKey>(
|
|
113
|
+
tools: State<K>,
|
|
114
|
+
key: K,
|
|
115
|
+
tool: PendingTool,
|
|
116
|
+
text: string,
|
|
117
|
+
): AppendOutcome<K> => {
|
|
118
|
+
const events: LLMEvent[] = []
|
|
119
|
+
if (!tools[key]) events.push(inputStart(tool))
|
|
120
|
+
if (text.length > 0) events.push(inputDelta(tool, text))
|
|
121
|
+
return {
|
|
122
|
+
tools: withTool(tools, key, tool),
|
|
123
|
+
tool,
|
|
124
|
+
events,
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export const isError = <K extends StreamKey>(result: AppendOutcome<K> | AIError): result is AIError =>
|
|
129
|
+
result instanceof AIError
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Register a tool call whose start event arrived before any argument deltas.
|
|
133
|
+
* Used by Anthropic `content_block_start`, Bedrock `contentBlockStart`, and
|
|
134
|
+
* OpenAI Responses `response.output_item.added`.
|
|
135
|
+
*/
|
|
136
|
+
export const start = <K extends StreamKey>(
|
|
137
|
+
tools: State<K>,
|
|
138
|
+
key: K,
|
|
139
|
+
tool: Omit<PendingTool, "input"> & { readonly input?: string },
|
|
140
|
+
) => withTool(tools, key, { ...tool, input: tool.input ?? "" })
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Append a streamed argument delta, starting the tool if this provider encodes
|
|
144
|
+
* identity on the first delta instead of a separate start event. OpenAI Chat has
|
|
145
|
+
* this shape: `tool_calls[].index` is the stream key, and `id` / `name` may only
|
|
146
|
+
* appear on the first delta for that index.
|
|
147
|
+
*/
|
|
148
|
+
export const appendOrStart = <K extends StreamKey>(
|
|
149
|
+
route: string,
|
|
150
|
+
tools: State<K>,
|
|
151
|
+
key: K,
|
|
152
|
+
delta: {
|
|
153
|
+
readonly id?: string
|
|
154
|
+
readonly name?: string
|
|
155
|
+
readonly text: string
|
|
156
|
+
readonly providerMetadata?: ProviderMetadata
|
|
157
|
+
},
|
|
158
|
+
missingToolMessage: string,
|
|
159
|
+
): AppendOutcome<K> | AIError => {
|
|
160
|
+
const current = tools[key]
|
|
161
|
+
const id = current?.id ?? delta.id
|
|
162
|
+
const name = current?.name ?? delta.name
|
|
163
|
+
if (!id || !name) return eventError(route, missingToolMessage)
|
|
164
|
+
|
|
165
|
+
const tool = {
|
|
166
|
+
id,
|
|
167
|
+
name,
|
|
168
|
+
namespace: current?.namespace,
|
|
169
|
+
input: `${current?.input ?? ""}${delta.text}`,
|
|
170
|
+
providerExecuted: current?.providerExecuted,
|
|
171
|
+
providerMetadata: current?.providerMetadata ?? delta.providerMetadata,
|
|
172
|
+
}
|
|
173
|
+
if (current && delta.text.length === 0 && current.id === id && current.name === name)
|
|
174
|
+
return { tools, tool: current, events: [] }
|
|
175
|
+
return appendTool(tools, key, tool, delta.text)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Append argument text to a started tool. Returns `undefined` when no tool is
|
|
180
|
+
* open under `key`, for protocols that ignore deltas without a matching block.
|
|
181
|
+
*/
|
|
182
|
+
export const append = <K extends StreamKey>(tools: State<K>, key: K, text: string): AppendOutcome<K> | undefined => {
|
|
183
|
+
const current = tools[key]
|
|
184
|
+
if (!current) return undefined
|
|
185
|
+
if (text.length === 0) return { tools, tool: current, events: [] }
|
|
186
|
+
return appendTool(tools, key, { ...current, input: `${current.input}${text}` }, text)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Append argument text to a tool that must already have been started. This keeps
|
|
191
|
+
* protocols honest when their stream grammar promises a start event before any
|
|
192
|
+
* argument delta.
|
|
193
|
+
*/
|
|
194
|
+
export const appendExisting = <K extends StreamKey>(
|
|
195
|
+
route: string,
|
|
196
|
+
tools: State<K>,
|
|
197
|
+
key: K,
|
|
198
|
+
text: string,
|
|
199
|
+
missingToolMessage: string,
|
|
200
|
+
): AppendOutcome<K> | AIError => append(tools, key, text) ?? eventError(route, missingToolMessage)
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Finalize one pending tool call: parse the accumulated raw JSON, remove it
|
|
204
|
+
* from state, and reject malformed local arguments without repairing them.
|
|
205
|
+
* Missing keys are a no-op because some providers emit stop events for
|
|
206
|
+
* non-tool content blocks.
|
|
207
|
+
*
|
|
208
|
+
* Pass `input` when the provider sends an authoritative final input string.
|
|
209
|
+
* OpenAI Responses can send accumulated deltas and then repeat the completed
|
|
210
|
+
* arguments on `response.output_item.done`; the final value wins.
|
|
211
|
+
*/
|
|
212
|
+
export const finish = <K extends StreamKey>(route: string, tools: State<K>, key: K, input?: string) =>
|
|
213
|
+
Effect.gen(function* () {
|
|
214
|
+
const tool = tools[key]
|
|
215
|
+
if (!tool) return { tools }
|
|
216
|
+
return {
|
|
217
|
+
tools: withoutTool(tools, key),
|
|
218
|
+
events: finishEvents(tool, yield* toolCall(route, tool, input)),
|
|
219
|
+
}
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Finalize every pending tool call at once. OpenAI Chat has this shape: it does
|
|
224
|
+
* not emit per-tool stop events, so all accumulated calls finish independently
|
|
225
|
+
* when the choice receives a terminal `finish_reason`.
|
|
226
|
+
*/
|
|
227
|
+
export const finishAll = <K extends StreamKey>(route: string, tools: State<K>) =>
|
|
228
|
+
Effect.gen(function* () {
|
|
229
|
+
const pending = Object.values<PendingTool | undefined>(tools).filter(
|
|
230
|
+
(tool): tool is PendingTool => tool !== undefined,
|
|
231
|
+
)
|
|
232
|
+
return {
|
|
233
|
+
tools: empty<K>(),
|
|
234
|
+
events: yield* Effect.forEach(pending, (tool) =>
|
|
235
|
+
toolCall(route, tool).pipe(Effect.map((event) => finishEvents(tool, event))),
|
|
236
|
+
).pipe(Effect.map((events) => events.flat())),
|
|
237
|
+
}
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
export * as ToolStream from "./tool-stream.js"
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect"
|
|
2
|
+
import { Protocol } from "../route/protocol.js"
|
|
3
|
+
import {
|
|
4
|
+
AIError,
|
|
5
|
+
LLMEvent,
|
|
6
|
+
type LanguageModelCompatibility,
|
|
7
|
+
type LLMRequest,
|
|
8
|
+
type Capabilities,
|
|
9
|
+
} from "../schema/index.js"
|
|
10
|
+
import { classifyProviderFailure } from "../provider-error.js"
|
|
11
|
+
import { OpenAIChat } from "./openai-chat.js"
|
|
12
|
+
import { JsonObject, optionalArray, optionalNull, ProviderShared } from "./shared.js"
|
|
13
|
+
import { cacheControl } from "./utils/cache.js"
|
|
14
|
+
import { OpenResponsesOptions } from "./utils/open-responses-options.js"
|
|
15
|
+
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Public options and request body
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
|
|
20
|
+
export type ReasoningEffort = OpenResponsesOptions.ReasoningEffort
|
|
21
|
+
|
|
22
|
+
const Parameters = Schema.Struct({
|
|
23
|
+
enableWebSearch: Schema.optional(ProviderShared.knownString<"off" | "on" | "auto">()),
|
|
24
|
+
enableWebScraping: Schema.optional(Schema.Boolean),
|
|
25
|
+
enableWebCitations: Schema.optional(Schema.Boolean),
|
|
26
|
+
enableXSearch: Schema.optional(Schema.Boolean),
|
|
27
|
+
stripThinkingResponse: Schema.optional(Schema.Boolean),
|
|
28
|
+
disableThinking: Schema.optional(Schema.Boolean),
|
|
29
|
+
includeVeniceSystemPrompt: Schema.optional(Schema.Boolean),
|
|
30
|
+
characterSlug: Schema.optional(Schema.String),
|
|
31
|
+
includeSearchResultsInStream: Schema.optional(Schema.Boolean),
|
|
32
|
+
returnSearchResultsAsDocuments: Schema.optional(Schema.Boolean),
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const Reasoning = Schema.Struct({
|
|
36
|
+
effort: Schema.optional(OpenResponsesOptions.ReasoningEffort),
|
|
37
|
+
enabled: Schema.optional(Schema.Boolean),
|
|
38
|
+
summary: Schema.optional(ProviderShared.knownString<"auto" | "concise" | "detailed">()),
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const Options = Schema.Struct({
|
|
42
|
+
reasoningEffort: Schema.optional(OpenResponsesOptions.ReasoningEffort),
|
|
43
|
+
reasoning: Schema.optional(Reasoning),
|
|
44
|
+
veniceParameters: Schema.optional(Parameters),
|
|
45
|
+
promptCacheKey: Schema.optional(Schema.String),
|
|
46
|
+
promptCacheRetention: Schema.optional(ProviderShared.knownString<"default" | "extended" | "24h">()),
|
|
47
|
+
parallelToolCalls: Schema.optional(Schema.Boolean),
|
|
48
|
+
maxCompletionTokens: Schema.optional(Schema.Number),
|
|
49
|
+
maxTokens: Schema.optional(Schema.Number),
|
|
50
|
+
minP: Schema.optional(Schema.Number),
|
|
51
|
+
repetitionPenalty: Schema.optional(Schema.Number),
|
|
52
|
+
stopTokenIds: Schema.optional(Schema.Array(Schema.Number)),
|
|
53
|
+
logprobs: Schema.optional(Schema.Boolean),
|
|
54
|
+
topLogprobs: Schema.optional(Schema.Number),
|
|
55
|
+
maxTemp: Schema.optional(Schema.Number),
|
|
56
|
+
minTemp: Schema.optional(Schema.Number),
|
|
57
|
+
responseFormat: Schema.optional(JsonObject),
|
|
58
|
+
user: Schema.optional(Schema.String),
|
|
59
|
+
})
|
|
60
|
+
export type OptionsInput = typeof Options.Type
|
|
61
|
+
|
|
62
|
+
const ToolCall = Schema.Struct({
|
|
63
|
+
...OpenAIChat.OpenAIChatAssistantToolCall.fields,
|
|
64
|
+
thought_signature: Schema.optional(Schema.String),
|
|
65
|
+
})
|
|
66
|
+
const Assistant = Schema.StructWithRest(
|
|
67
|
+
Schema.Struct({
|
|
68
|
+
...OpenAIChat.OpenAIChatMessage.cases.assistant.schema.fields,
|
|
69
|
+
tool_calls: optionalArray(Schema.Union([ToolCall, OpenAIChat.OpenAIChatAssistantCustomToolCall])),
|
|
70
|
+
thought_signature: Schema.optional(Schema.String),
|
|
71
|
+
}),
|
|
72
|
+
[JsonObject],
|
|
73
|
+
)
|
|
74
|
+
const Messages = Schema.Array(
|
|
75
|
+
Schema.Union([
|
|
76
|
+
OpenAIChat.OpenAIChatMessage.cases.system,
|
|
77
|
+
OpenAIChat.OpenAIChatMessage.cases.user,
|
|
78
|
+
Assistant,
|
|
79
|
+
OpenAIChat.OpenAIChatMessage.cases.tool,
|
|
80
|
+
]),
|
|
81
|
+
)
|
|
82
|
+
const Body = Schema.Struct({
|
|
83
|
+
...OpenAIChat.bodyFields,
|
|
84
|
+
messages: Messages,
|
|
85
|
+
reasoning: Schema.optional(Reasoning),
|
|
86
|
+
venice_parameters: Schema.Record(Schema.String, Schema.Union([Schema.String, Schema.Boolean])),
|
|
87
|
+
prompt_cache_retention: Options.fields.promptCacheRetention,
|
|
88
|
+
parallel_tool_calls: Options.fields.parallelToolCalls,
|
|
89
|
+
min_p: Options.fields.minP,
|
|
90
|
+
top_k: Schema.optional(Schema.Number),
|
|
91
|
+
repetition_penalty: Options.fields.repetitionPenalty,
|
|
92
|
+
stop_token_ids: Options.fields.stopTokenIds,
|
|
93
|
+
logprobs: Options.fields.logprobs,
|
|
94
|
+
top_logprobs: Options.fields.topLogprobs,
|
|
95
|
+
max_temp: Options.fields.maxTemp,
|
|
96
|
+
min_temp: Options.fields.minTemp,
|
|
97
|
+
response_format: Options.fields.responseFormat,
|
|
98
|
+
user: Options.fields.user,
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
// Streaming schemas and state
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
|
|
105
|
+
const ToolDelta = Schema.Struct({
|
|
106
|
+
...OpenAIChat.OpenAIChatToolCallDelta.fields,
|
|
107
|
+
thought_signature: optionalNull(Schema.String),
|
|
108
|
+
})
|
|
109
|
+
const Delta = Schema.StructWithRest(
|
|
110
|
+
Schema.Struct({
|
|
111
|
+
...OpenAIChat.OpenAIChatDelta.schema.fields,
|
|
112
|
+
tool_calls: optionalNull(Schema.Array(ToolDelta)),
|
|
113
|
+
thought_signature: optionalNull(Schema.String),
|
|
114
|
+
}),
|
|
115
|
+
[JsonObject],
|
|
116
|
+
)
|
|
117
|
+
const Choice = Schema.StructWithRest(
|
|
118
|
+
Schema.Struct({ ...OpenAIChat.OpenAIChatChoice.schema.fields, delta: optionalNull(Delta) }),
|
|
119
|
+
[JsonObject],
|
|
120
|
+
)
|
|
121
|
+
const Usage = Schema.StructWithRest(
|
|
122
|
+
Schema.Struct({
|
|
123
|
+
...OpenAIChat.OpenAIChatUsage.schema.fields,
|
|
124
|
+
prompt_tokens_details: optionalNull(
|
|
125
|
+
Schema.StructWithRest(
|
|
126
|
+
Schema.Struct({
|
|
127
|
+
cached_tokens: optionalNull(Schema.Number),
|
|
128
|
+
cache_write_tokens: optionalNull(Schema.Number),
|
|
129
|
+
cache_creation_input_tokens: optionalNull(Schema.Number),
|
|
130
|
+
}),
|
|
131
|
+
[JsonObject],
|
|
132
|
+
),
|
|
133
|
+
),
|
|
134
|
+
}),
|
|
135
|
+
[JsonObject],
|
|
136
|
+
)
|
|
137
|
+
const Event = Schema.StructWithRest(
|
|
138
|
+
Schema.Struct({
|
|
139
|
+
...OpenAIChat.OpenAIChatEvent.schema.fields,
|
|
140
|
+
choices: optionalNull(Schema.Array(Choice)),
|
|
141
|
+
usage: optionalNull(Usage),
|
|
142
|
+
error: optionalNull(Schema.Union([Schema.String, OpenAIChat.OpenAIChatEvent.schema.fields.error.schema])),
|
|
143
|
+
issues: optionalArray(
|
|
144
|
+
Schema.Struct({
|
|
145
|
+
message: Schema.String,
|
|
146
|
+
path: Schema.optional(Schema.Array(Schema.Union([Schema.String, Schema.Number]))),
|
|
147
|
+
}),
|
|
148
|
+
),
|
|
149
|
+
}),
|
|
150
|
+
[JsonObject],
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
interface State {
|
|
154
|
+
readonly shared: OpenAIChat.ParserState
|
|
155
|
+
readonly pending: string
|
|
156
|
+
readonly reasoning: string
|
|
157
|
+
readonly encrypted: boolean
|
|
158
|
+
readonly signature?: string
|
|
159
|
+
readonly tools: Readonly<Record<string, string>>
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const MARKER = "__ENCRYPTED_REASONING__"
|
|
163
|
+
|
|
164
|
+
// ---------------------------------------------------------------------------
|
|
165
|
+
// Request lowering
|
|
166
|
+
// ---------------------------------------------------------------------------
|
|
167
|
+
|
|
168
|
+
const fromRequest = Effect.fn("VeniceChat.fromRequest")(function* (request: LLMRequest) {
|
|
169
|
+
const options = yield* ProviderShared.validateWith(Schema.decodeUnknownEffect(Options))(request.providerOptions ?? {})
|
|
170
|
+
const body = yield* OpenAIChat.fromRequest(request, {
|
|
171
|
+
cacheControl: cacheControl(),
|
|
172
|
+
assistant: (source, message) => {
|
|
173
|
+
if (message.role !== "assistant") return message
|
|
174
|
+
const parts = source.content.filter(
|
|
175
|
+
(part) => part.type === "text" || part.type === "reasoning" || part.type === "tool-call",
|
|
176
|
+
)
|
|
177
|
+
const calls = source.content.filter((part) => part.type === "tool-call")
|
|
178
|
+
const signature = parts
|
|
179
|
+
.map((part) => part.providerMetadata?.venice?.messageThoughtSignature)
|
|
180
|
+
.find((value) => typeof value === "string")
|
|
181
|
+
const raw = parts
|
|
182
|
+
.map((part) => part.providerMetadata?.venice?.encryptedReasoningContent)
|
|
183
|
+
.find((value) => typeof value === "string")
|
|
184
|
+
return {
|
|
185
|
+
...message,
|
|
186
|
+
...(signature === undefined ? {} : { thought_signature: signature }),
|
|
187
|
+
...(raw === undefined ? {} : { reasoning_content: raw }),
|
|
188
|
+
tool_calls: message.tool_calls?.map((call, index) => {
|
|
189
|
+
const signature = calls[index]?.providerMetadata?.venice?.thoughtSignature
|
|
190
|
+
return { ...call, ...(typeof signature === "string" ? { thought_signature: signature } : {}) }
|
|
191
|
+
}),
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
})
|
|
195
|
+
return {
|
|
196
|
+
...body,
|
|
197
|
+
max_completion_tokens: options.maxCompletionTokens ?? options.maxTokens ?? request.maxTokens,
|
|
198
|
+
reasoning_effort: undefined,
|
|
199
|
+
reasoning:
|
|
200
|
+
options.reasoningEffort === undefined
|
|
201
|
+
? options.reasoning
|
|
202
|
+
: { ...options.reasoning, effort: options.reasoningEffort },
|
|
203
|
+
// Match the previous Venice SDK default, not the gateway's added prompt.
|
|
204
|
+
venice_parameters: Object.fromEntries(
|
|
205
|
+
Object.entries({
|
|
206
|
+
...options.veniceParameters,
|
|
207
|
+
includeVeniceSystemPrompt: options.veniceParameters?.includeVeniceSystemPrompt ?? false,
|
|
208
|
+
})
|
|
209
|
+
.filter(([, value]) => value !== undefined)
|
|
210
|
+
.map(([key, value]) => [key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), value]),
|
|
211
|
+
),
|
|
212
|
+
prompt_cache_retention: options.promptCacheRetention ?? body.prompt_cache_retention,
|
|
213
|
+
parallel_tool_calls: options.parallelToolCalls,
|
|
214
|
+
min_p: options.minP,
|
|
215
|
+
top_k: request.topK,
|
|
216
|
+
repetition_penalty: options.repetitionPenalty,
|
|
217
|
+
stop_token_ids: options.stopTokenIds,
|
|
218
|
+
logprobs: options.logprobs,
|
|
219
|
+
top_logprobs: options.topLogprobs,
|
|
220
|
+
max_temp: options.maxTemp,
|
|
221
|
+
min_temp: options.minTemp,
|
|
222
|
+
response_format: options.responseFormat,
|
|
223
|
+
user: options.user,
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
// ---------------------------------------------------------------------------
|
|
228
|
+
// Venice normalization around the shared Chat state machine
|
|
229
|
+
// ---------------------------------------------------------------------------
|
|
230
|
+
|
|
231
|
+
const step = Effect.fn("VeniceChat.step")(function* (state: State, event: typeof Event.Type) {
|
|
232
|
+
if (typeof event.error === "string")
|
|
233
|
+
return yield* new AIError({
|
|
234
|
+
reason: classifyProviderFailure({
|
|
235
|
+
message: [
|
|
236
|
+
event.error,
|
|
237
|
+
...(event.issues ?? []).map(
|
|
238
|
+
(issue) => `${issue.path?.length ? `${issue.path.join(".")}: ` : ""}${issue.message}`,
|
|
239
|
+
),
|
|
240
|
+
].join("; "),
|
|
241
|
+
rawBody: ProviderShared.encodeJson(event),
|
|
242
|
+
}),
|
|
243
|
+
})
|
|
244
|
+
const delta = event.choices?.[0]?.delta
|
|
245
|
+
const scalar = delta?.reasoning_content ?? ""
|
|
246
|
+
const text = state.pending + scalar
|
|
247
|
+
const marker = text.indexOf(MARKER)
|
|
248
|
+
const pending =
|
|
249
|
+
marker >= 0 || state.encrypted
|
|
250
|
+
? 0
|
|
251
|
+
: (Array.from({ length: Math.min(text.length, MARKER.length - 1) }, (_, index) => index + 1)
|
|
252
|
+
.filter((length) => text.endsWith(MARKER.slice(0, length)))
|
|
253
|
+
.at(-1) ?? 0)
|
|
254
|
+
const visible = state.encrypted ? "" : marker >= 0 ? text.slice(0, marker) : text.slice(0, text.length - pending)
|
|
255
|
+
const result = yield* OpenAIChat.protocol.stream.step(state.shared, {
|
|
256
|
+
...event,
|
|
257
|
+
error: event.error,
|
|
258
|
+
usage: event.usage
|
|
259
|
+
? {
|
|
260
|
+
...event.usage,
|
|
261
|
+
prompt_tokens_details: event.usage.prompt_tokens_details
|
|
262
|
+
? {
|
|
263
|
+
...event.usage.prompt_tokens_details,
|
|
264
|
+
cache_write_tokens:
|
|
265
|
+
event.usage.prompt_tokens_details.cache_write_tokens ??
|
|
266
|
+
event.usage.prompt_tokens_details.cache_creation_input_tokens,
|
|
267
|
+
}
|
|
268
|
+
: event.usage.prompt_tokens_details,
|
|
269
|
+
}
|
|
270
|
+
: event.usage,
|
|
271
|
+
choices: event.choices?.map((choice, index) =>
|
|
272
|
+
index === 0 && choice.delta
|
|
273
|
+
? {
|
|
274
|
+
...choice,
|
|
275
|
+
delta: {
|
|
276
|
+
...choice.delta,
|
|
277
|
+
reasoning_content: visible || undefined,
|
|
278
|
+
// Opaque-only scalar reasoning still needs a canonical part for replay.
|
|
279
|
+
reasoning_details: choice.delta.reasoning_details ?? (marker >= 0 ? [] : undefined),
|
|
280
|
+
},
|
|
281
|
+
}
|
|
282
|
+
: choice,
|
|
283
|
+
),
|
|
284
|
+
})
|
|
285
|
+
const tools = { ...state.tools }
|
|
286
|
+
for (const call of delta?.tool_calls ?? []) {
|
|
287
|
+
if (!call.thought_signature) continue
|
|
288
|
+
const index = call.index ?? result[0].latestToolIndex
|
|
289
|
+
const id =
|
|
290
|
+
call.id ?? (index === undefined ? undefined : (result[0].tools[index]?.id ?? result[0].pendingTools[index]?.id))
|
|
291
|
+
if (id) tools[id] = call.thought_signature
|
|
292
|
+
}
|
|
293
|
+
return [
|
|
294
|
+
{
|
|
295
|
+
shared: result[0],
|
|
296
|
+
pending: pending ? text.slice(-pending) : "",
|
|
297
|
+
reasoning: state.reasoning + scalar,
|
|
298
|
+
encrypted: state.encrypted || marker >= 0,
|
|
299
|
+
signature: delta?.thought_signature ?? state.signature,
|
|
300
|
+
tools,
|
|
301
|
+
},
|
|
302
|
+
result[1],
|
|
303
|
+
] as const
|
|
304
|
+
})
|
|
305
|
+
|
|
306
|
+
const onHalt = Effect.fn("VeniceChat.onHalt")(function* (state: State) {
|
|
307
|
+
const events = yield* OpenAIChat.finishEvents(state.shared)
|
|
308
|
+
return events.flatMap((event): LLMEvent[] => {
|
|
309
|
+
if (
|
|
310
|
+
event.type !== "reasoning-end" &&
|
|
311
|
+
event.type !== "text-end" &&
|
|
312
|
+
event.type !== "tool-call" &&
|
|
313
|
+
event.type !== "tool-input-end"
|
|
314
|
+
)
|
|
315
|
+
return [event]
|
|
316
|
+
const signature = event.type === "tool-call" || event.type === "tool-input-end" ? state.tools[event.id] : undefined
|
|
317
|
+
const providerMetadata = {
|
|
318
|
+
...event.providerMetadata,
|
|
319
|
+
venice: {
|
|
320
|
+
...event.providerMetadata?.venice,
|
|
321
|
+
...(state.signature ? { messageThoughtSignature: state.signature } : {}),
|
|
322
|
+
...(signature ? { thoughtSignature: signature } : {}),
|
|
323
|
+
...(event.type === "reasoning-end" && state.encrypted ? { encryptedReasoningContent: state.reasoning } : {}),
|
|
324
|
+
},
|
|
325
|
+
}
|
|
326
|
+
if (event.type === "reasoning-end" && state.pending)
|
|
327
|
+
return [LLMEvent.reasoningDelta({ id: event.id, text: state.pending }), { ...event, providerMetadata }]
|
|
328
|
+
return [{ ...event, providerMetadata }]
|
|
329
|
+
})
|
|
330
|
+
})
|
|
331
|
+
|
|
332
|
+
export const compatibility = {
|
|
333
|
+
maxTokensField: "max_completion_tokens",
|
|
334
|
+
} satisfies LanguageModelCompatibility
|
|
335
|
+
|
|
336
|
+
export const capabilities = { promptCacheKey: true } satisfies Capabilities
|
|
337
|
+
|
|
338
|
+
export const protocol = Protocol.make({
|
|
339
|
+
id: "venice-chat",
|
|
340
|
+
body: { schema: Body, from: fromRequest },
|
|
341
|
+
stream: {
|
|
342
|
+
event: Schema.Union([Schema.Literal("[DONE]"), Protocol.jsonEvent(Event)]),
|
|
343
|
+
initial: (request): State => ({
|
|
344
|
+
shared: OpenAIChat.protocol.stream.initial(request),
|
|
345
|
+
pending: "",
|
|
346
|
+
reasoning: "",
|
|
347
|
+
encrypted: false,
|
|
348
|
+
tools: {},
|
|
349
|
+
}),
|
|
350
|
+
step: (state: State, event) => (event === "[DONE]" ? Effect.succeed([state, []] as const) : step(state, event)),
|
|
351
|
+
terminal: (event) => event === "[DONE]",
|
|
352
|
+
onHalt,
|
|
353
|
+
},
|
|
354
|
+
})
|
|
355
|
+
|
|
356
|
+
export * as VeniceChat from "./venice-chat.js"
|