* docs(design): add daemon idle detection API design for machine reclamation
When qwen daemon is deployed across multiple machines, an external
scheduler needs a reliable signal to determine if a daemon is idle
and the machine can be reclaimed. This design proposes enhancing
GET /health?deep=true with activePrompts, connectedClients,
channelAlive, lastActivityAt, and idleSinceMs fields.
* feat(serve): add idle-detection fields to GET /health?deep=true
* fix(test): add activePromptCount and lastActivityAt to fakeBridge
Update the test helper to satisfy the expanded AcpSessionBridge
interface so /health?deep=true tests pass with the new fields.
* test(idle-detection): add unit tests for activePromptCount, lastActivityAt and /health?deep=true new fields
* refactor(bridge): replace activePromptCount iteration with O(1) counter
* fix(bridge): move idleSinceMs computation into bridge to eliminate race window
* fix(idle-detection): keep daemon health state consistent
Guard prompt teardown so activePromptCount only decrements once and compute deep health idle fields from the same activity snapshot.
* fix(acp): prevent active prompt leak after channel crash
Reject queued prompts after their session entry has been torn down so daemon health does not report phantom active prompts.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>