Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
agent-voice: Cartesia TTS defaults to sonic-3.6 (#5905)
garrytan423024256ebd
diff --git a/recipes/agent-voice/README.md b/recipes/agent-voice/README.mdindex 8687f11674..4452920f97 100644--- a/recipes/agent-voice/README.md+++ b/recipes/agent-voice/README.md@@ -54,6 +54,15 @@ Three rules for new recipes following this shape:- `code/lib/personas/private-name-blocklist.json` — privacy guard source of truth (read by the shipped guard script and by host-side prompt-shape tests).- `code/lib/personas/context-builder.contract.md` — API the operator implements for live brain context.+## Provider notes++- Cartesia TTS (`code/pipeline.mjs`, the deferred DIY pipeline): the default+ model is `sonic-3.6`. Cartesia switched `sonic-english` off on 2026-06-01 and+ requests naming it return an error (#5905). Pass `modelId` to+ `CartesiaTtsAdapter` or set `CARTESIA_MODEL_ID` to pin another current model+ (`sonic-3.5`, `sonic-3`). `tests/unit/cartesia-default-model.test.mjs` pins+ the default without calling the API.+## Files (in `bundle = code/ + tests/unit/ + skills/ + package.json`) — copied to host repoThe install subcommand reads `install/manifest.json` and copies each listed file to its target path under the host repo. SHA-256s computed at copy time get persisted into `<host>/services/<name>/.gbrain-source.json` so `--refresh` can do three-way classification (unchanged-identical / unchanged-stale / locally-modified) without re-walking the entire bundle.diff --git a/recipes/agent-voice/code/pipeline.mjs b/recipes/agent-voice/code/pipeline.mjsindex fb363254fc..7b9a5431ee 100644--- a/recipes/agent-voice/code/pipeline.mjs+++ b/recipes/agent-voice/code/pipeline.mjs@@ -36,12 +36,13 @@* DEEPGRAM_API_KEY (STT)* ANTHROPIC_API_KEY (LLM)* CARTESIA_API_KEY (TTS, primary) OR OPENAI_API_KEY (TTS fallback)+ * CARTESIA_MODEL_ID (optional: Cartesia TTS model; default 'sonic-3.6')* DIY_VAD_PRESET (optional: quiet|normal|noisy|very_noisy; default 'normal')** Latency budget (typical):* STT (Deepgram nova-2 streaming): ~300ms end-of-utterance* LLM (Claude Sonnet 4.6 streaming): ~400ms time-to-first-sentence- * TTS (Cartesia sonic): ~150ms time-to-first-audio+ * TTS (Cartesia sonic-3.6): ~150ms time-to-first-audio* Total time-to-first-audio: ~850ms (vs OpenAI Realtime ~600ms)*/@@ -260,8 +261,13 @@ class ClaudeStreamAdapter extends EventEmitter {// ── TTS: Cartesia primary, OpenAI TTS fallback ──────────────────────+// Cartesia retired `sonic-english` on 2026-06-01 (requests to it return an+// error, #5905); `sonic-3.6` is the current generation. Override per call+// with `modelId`, or set CARTESIA_MODEL_ID for createPipeline().+export const CARTESIA_DEFAULT_MODEL_ID = 'sonic-3.6';+class CartesiaTtsAdapter extends EventEmitter {- constructor({ apiKey, modelId = 'sonic-english', voiceId = '794f9389-aac1-45b6-b726-9d9369183238' /* "professional" default */, outputFormat = { container: 'raw', encoding: 'pcm_s16le', sample_rate: 16000 } }) {+ constructor({ apiKey, modelId = CARTESIA_DEFAULT_MODEL_ID, voiceId = '794f9389-aac1-45b6-b726-9d9369183238' /* "professional" default */, outputFormat = { container: 'raw', encoding: 'pcm_s16le', sample_rate: 16000 } }) {super();this.apiKey = apiKey;this.modelId = modelId;@@ -378,7 +384,7 @@ export function createPipeline({ personaPrompt, sttProvider = 'deepgram', llmProif (ttsProviderChosen === 'cartesia') {if (!process.env.CARTESIA_API_KEY) throw new Error('CARTESIA_API_KEY required for Cartesia TTS');- tts = new CartesiaTtsAdapter({ apiKey: process.env.CARTESIA_API_KEY });+ tts = new CartesiaTtsAdapter({ apiKey: process.env.CARTESIA_API_KEY, ...(process.env.CARTESIA_MODEL_ID ? { modelId: process.env.CARTESIA_MODEL_ID } : {}) });} else if (ttsProviderChosen === 'openai') {if (!process.env.OPENAI_API_KEY) throw new Error('OPENAI_API_KEY required for OpenAI TTS fallback');tts = new OpenAiTtsAdapter({ apiKey: process.env.OPENAI_API_KEY });diff --git a/recipes/agent-voice/tests/unit/cartesia-default-model.test.mjs b/recipes/agent-voice/tests/unit/cartesia-default-model.test.mjsnew file mode 100644index 0000000000..e62d883253--- /dev/null+++ b/recipes/agent-voice/tests/unit/cartesia-default-model.test.mjs@@ -0,0 +1,33 @@+/**+ * cartesia-default-model.test.mjs — #5905: Cartesia retired `sonic-english`+ * on 2026-06-01; the adapter's default must be a current model. String-only:+ * the adapter is constructed, never asked to speak, and fetch is replaced by+ * a counter that must stay at zero.+ *+ * Not in install/manifest.json: `code/pipeline.mjs` is the deferred DIY+ * pipeline and is not copied to host repos, so this test stays gbrain-side.+ */++import { afterEach, beforeEach, describe, expect, it } from 'vitest';+import { CARTESIA_DEFAULT_MODEL_ID, CartesiaTtsAdapter } from '../../code/pipeline.mjs';++describe('Cartesia TTS default model (#5905)', () => {+ let calls = 0;+ const realFetch = globalThis.fetch;+ beforeEach(() => { calls = 0; globalThis.fetch = async () => { calls++; throw new Error('no TTS calls in this test'); }; });+ afterEach(() => { globalThis.fetch = realFetch; });++ it('defaults to sonic-3.6, never sonic-english, and makes no TTS call', () => {+ const tts = new CartesiaTtsAdapter({ apiKey: 'test-key' });+ expect(CARTESIA_DEFAULT_MODEL_ID).toBe('sonic-3.6');+ expect(tts.modelId).toBe('sonic-3.6');+ expect(tts.modelId).not.toBe('sonic-english');+ expect(calls).toBe(0);+ });++ it('an explicit modelId still wins', () => {+ const tts = new CartesiaTtsAdapter({ apiKey: 'test-key', modelId: 'sonic-3.5' });+ expect(tts.modelId).toBe('sonic-3.5');+ expect(calls).toBe(0);+ });+});