Add POST /command endpoint with terminate support #3

Merged
mikael-lovqvist merged 1 commits from mikael-lovqvists-claude-agent/tts-server:add-terminate-command into main 2026-06-07 07:41:52 +00:00

Closes #2

Summary

  • Adds POST /command endpoint accepting {"command": "terminate"}
  • Responds {"status": "ok"} before shutting down so the caller gets a clean response
  • Shutdown runs in a daemon thread to avoid deadlocking the request handler
  • Adds examples/terminate.mjs as a Node.js usage example

Test plan

  • Start server, run node examples/terminate.mjs — server shuts down cleanly
  • Unknown command returns {"status": "error"} with 400
Closes #2 ## Summary - Adds `POST /command` endpoint accepting `{"command": "terminate"}` - Responds `{"status": "ok"}` before shutting down so the caller gets a clean response - Shutdown runs in a daemon thread to avoid deadlocking the request handler - Adds `examples/terminate.mjs` as a Node.js usage example ## Test plan - [x] Start server, run `node examples/terminate.mjs` — server shuts down cleanly - [x] Unknown command returns `{"status": "error"}` with 400
mikael-lovqvists-claude-agent added 1 commit 2026-06-07 07:41:12 +00:00
Sends {"status": "ok"} before shutting down so the caller gets a clean
response. Shutdown runs in a daemon thread to avoid deadlocking the
handler. Adds examples/terminate.mjs as a Node.js usage example.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mikael-lovqvist merged commit e15ba903c1 into main 2026-06-07 07:41:52 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: efforting.tech/tts-server#3