Skip to content

Commit 34bd9e9

Browse files
committed
docs: document npm run call CLI ergonomics improvements
Add an "npm run call CLI behavior" subsection to AGENTS.md describing the three new behaviors that landed in this branch: - Final-transcript coalescing (utterances render as one line per turn, not one line per Cartesia chunk) - mpg123 buffer-underflow stderr suppression via the bash wrapper - Tool call / handoff / status / hang / transfer event surfacing, with the emoji-prefixed line formats and the `VAPI_CALL_DEBUG=1` discovery toggle for high-frequency events Add a parallel "Test-Call CLI Notes" section to CLAUDE.md so the agent-side reading order picks up the same context when debugging customer issues from the terminal. Doc-only — no code changes.
1 parent fdaabc0 commit 34bd9e9

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,27 @@ npm run build # Type-check
762762

763763
All commands accept an org slug (e.g. `my-org`). Running without arguments launches interactive mode.
764764

765+
### `npm run call` CLI behavior
766+
767+
The test-call CLI cleans its terminal output for the developer loop:
768+
769+
- **Coalesced transcripts.** Chunked TTS providers (Cartesia Sonic, etc.) stream each utterance as 2–4 separate `final` transcript events. The CLI buffers consecutive finals from the same role and flushes them as one merged `🤖 Assistant:` / `🎤 You:` line after a 600 ms quiet window, on role change, on `speech-update` from the opposite role, on `call-ended`, and on Ctrl+C.
770+
- **Suppressed `mpg123` warnings.** macOS speaker output emits `Didn't have any audio data in callback (buffer underflow)` lines from native code on every chunk-boundary gap. The `npm run call` script wraps invocation in `bash -c` + a stderr filter that drops these lines so they no longer dominate the log. Requires `bash` on `PATH` (universal on macOS, Linux, WSL).
771+
- **Tool / handoff / status visibility.** The CLI surfaces previously-dropped WebSocket control messages:
772+
- `🔧 Tool call: <name>(<args>)` — regular tool invocations
773+
- `🔀 Handoff → <Target Name>` — squad handoffs (detected from `handoff_to_<Target_Name>` function names)
774+
- `✅ Tool result: <name> → <preview>` / `❌ Tool failed: <name> → <preview>` — tool responses, truncated to 200 chars
775+
- `📞 Status: <state>[+reason]` — `in-progress`, `forwarding`, `ended`
776+
- `⚠️ Hang warning` — impending termination
777+
- `🔀 Transfer → <destination>` — number / SIP / cross-assistant transfers
778+
- **Discovery mode.** Set `VAPI_CALL_DEBUG=1` in the environment to log unknown control message types (high-frequency events like `conversation-update`, `model-output`, `function-call`, `user-interrupted` are silently dropped by default to keep the log readable):
779+
780+
```bash
781+
VAPI_CALL_DEBUG=1 npm run call -- <org> -s <squad>
782+
```
783+
784+
These are CLI-only changes — no runtime behavior change for the agent, no per-customer config required. Every downstream customer clone of this template inherits them automatically.
785+
765786
---
766787

767788
## Discovering Available Settings

CLAUDE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,12 @@ When both files exist, follow both. If guidance overlaps, treat `AGENTS.md` as t
2525
- Multilingual agents → `docs/learnings/multilingual.md`
2626
- WebSocket transport → `docs/learnings/websocket.md`
2727
- Call time limits / graceful ending → `docs/learnings/call-duration.md`
28+
29+
## Test-Call CLI Notes
30+
31+
When debugging a customer issue with `npm run call -- <org> -s <squad>`:
32+
33+
- Assistant utterances render as one coalesced line per turn (chunked TTS finals are buffered for 600 ms before flushing). If you need to see every raw final fragment for a transcriber/TTS investigation, lower or zero out `COALESCE_TIMEOUT_MS` in `src/call.ts`.
34+
- `mpg123` `buffer underflow` stderr warnings are filtered out by the npm script wrapper. They are normal operational noise on macOS, not errors.
35+
- Tool calls, handoffs (`handoff_to_*`), tool results, status transitions, hang warnings, and transfer events render as distinct emoji-prefixed lines (`🔧`, `🔀`, ``, ``, `📞`, `⚠️`). Use these to trace squad routing without leaving the terminal for the dashboard.
36+
- High-frequency events (`conversation-update`, `model-output`, `function-call`, `user-interrupted`) are silently dropped by default. Set `VAPI_CALL_DEBUG=1` to surface them as `🔍 [debug] <type>: <preview>` lines when enumerating new event shapes.

0 commit comments

Comments
 (0)