Apply a production-safe patch workflow for OpenClaw installs where tts.convert and /media/tts/<id>.mp3 routing are broken or incomplete.
Always back up hashed dist files before edits, patch minimally, restart gateway, and verify with authenticated range curl.
gateway-cli-*.js files.*.bak before modifying.GET/HEAD /media/tts/<id>.mp3 with auth, validation, binary output, and Range.tts.convert payload returns audioUrl under /media/tts/<id>.mp3 and mp3 metadata.--range).Use scripts/find_gateway_cli.sh to locate candidate files:
bash
bash scripts/find_gateway_cli.sh
If multiple candidates exist, patch only the currently used runtime build(s).
For each target:
bash
cp /path/to/gateway-cli-<hash>.js /path/to/gateway-cli-<hash>.js.bak
Never skip backups.
Implement or fix handler for GET and HEAD at /media/tts/<id>.mp3:
.mp3).Content-Type: audio/mpeg.Accept-Ranges: bytes.404, 405, 416, 200/206.For tts.convert, ensure response structure:
json
{
"ok": true,
"payload": {
"audioUrl": "/media/tts/<id>.mp3",
"mimeType": "audio/mpeg",
"format": "mp3"
}
}
TTL behavior: keep files temporary and auto-clean in 2–5 minutes.
bash
openclaw gateway restart
Use scripts/verify_tts_media_route.sh or run manually:
bash
curl -i -H "Authorization: Bearer <token>" \
"http://<host>:<port>/media/tts/<id>.mp3" \
--range 0-127
Expected:
200 or 206Content-Type: audio/mpeg/media/tts/*..bak and retry.find_gateway_cli.sh — locate hashed runtime files for patching.verify_tts_media_route.sh — quick authenticated range-check for MP3 route.patch-checklist.md — concise checklist of required behaviors and acceptance criteria.