mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 23:01:30 +00:00
Fixes issue where unpaired Unicode surrogates in tool results cause JSON serialization errors in API providers, particularly Anthropic. - Add sanitizeSurrogates() utility function to remove unpaired surrogates - Apply sanitization in all provider convertMessages() functions: - User message text content (string and text blocks) - Assistant message text and thinking blocks - Tool result output - System prompts - Valid emoji (properly paired surrogates) are preserved - Add comprehensive test suite covering all 8 providers Previously only Google and Groq handled unpaired surrogates correctly. Now all providers (Anthropic, OpenAI Completions/Responses, Google, xAI, Groq, Cerebras, zAI) sanitize text before API submission. |
||
|---|---|---|
| .. | ||
| data | ||
| abort.test.ts | ||
| agent.test.ts | ||
| empty.test.ts | ||
| enum-test.ts | ||
| handoff.test.ts | ||
| stream.test.ts | ||
| tool-call-without-result.test.ts | ||
| tool-validation.test.ts | ||
| unicode-surrogate.test.ts | ||