Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(human): add readback prefix contract test

Steven Enamakel4e4fea183c5e
diff --git a/app/src/features/human/voice/live/readbackPrefix.ts b/app/src/features/human/voice/live/readbackPrefix.ts
new file mode 100644
index 0000000000..c7fcee9760
--- /dev/null
+++ b/app/src/features/human/voice/live/readbackPrefix.ts
@@ -0,0 +1,12 @@
+/**
+ * Instruction prefix for "speak-back". A slow voice turn (e.g. an email summary)
+ * is acknowledged aloud, finishes in the background, and its result is delivered
+ * to chat AND pushed to the renderer as a `voice_speak` event. While a live voice
+ * session is open, the renderer sends it back into the session as a `text` frame
+ * wrapped with this prefix so the agent reads it verbatim. MUST match
+ * `VOICE_READBACK_PREFIX` in `voice/realtime_harness/prompt.rs`, which uses it to
+ * avoid re-arming speak-back on the read-back turn (loop guard) — pinned by
+ * `readbackPrefix.contract.test.ts`.
+ */
+export const READBACK_PREFIX =
+ 'Please read the following to me, word for word, and say nothing else:';
diff --git a/app/src/features/human/voice/readbackPrefix.contract.test.ts b/app/src/features/human/voice/readbackPrefix.contract.test.ts
index 426dcfe49b..fee11f257c 100644
--- a/app/src/features/human/voice/readbackPrefix.contract.test.ts
+++ b/app/src/features/human/voice/readbackPrefix.contract.test.ts
@@ -14,7 +14,7 @@ import { existsSync, readFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
-import { READBACK_PREFIX } from './useRealtimeVoiceSession';
+import { READBACK_PREFIX } from './live/readbackPrefix';
const HARNESS_RELATIVE = 'crates/openhuman-core/src/voice/realtime_harness/prompt.rs';