feat(client): Add sendAndWait() API and auto-ACK for sync messaging (agent-relay-485 + agent-relay-486)#245
feat(client): Add sendAndWait() API and auto-ACK for sync messaging (agent-relay-485 + agent-relay-486)#245khaliqgant wants to merge 6 commits intomainfrom
Conversation
…rdination - Fix AckPayload.response type from boolean to string for richer status codes - Add JSDoc documentation for correlationId, response, responseData fields - Update sendSyncAck() signature and call sites to use 'OK'/'ERROR' strings - Add comprehensive unit tests for sync messaging types (16 new tests) This enables request-response patterns and blocking message semantics for turn-based agent coordination scenarios (e.g., card games, workflows). Closes #483 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add 6 new test cases for daemon pending ACK tracking (agent-relay-484): - Duplicate correlationId rejection with ERROR - Missing correlationId in blocking SEND returns ERROR - Connection cleanup clears pending ACKs - ACK without correlationId is ignored (but still routed) - ACK with unmatched correlationId doesn't resolve wrong pending - Default timeout (30s) when timeoutMs not specified Total: 8 tests for blocking SEND and ACK correlation logic. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…-relay-485)
Add client-side sendAndWait() method that blocks until ACK received or timeout.
Enables agents to wait for specific responses before continuing:
await client.sendAndWait('Target', 'message', { timeoutMs: 30000 })
Also add broadcastAndWait() for waiting on multiple recipients. The handler
manages its own cleanup to support both single and multi-ACK patterns.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Automatically send ACK when receiving message with sync.correlationId.
Agents no longer need boilerplate ACK code for blocking message patterns.
The auto-ACK includes the agent name in responseData for identification:
{ from: 'AgentName' }
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 My Senior Dev — Analysis Complete👤 For @khaliqgant📁 Expert in View your contributor analytics → 📊 55 files reviewed • 6 high risk • 9 need attention 🚨 High Risk:
🚀 Open Interactive Review →The full interface unlocks features not available in GitHub:
💬 Chat here: 📖 View all 12 personas & slash commandsYou can interact with me by mentioning In PR comments or on any line of code:
Slash commands:
AI Personas (mention to get their perspective):
For the best experience, view this PR on myseniordev.com — includes AI chat, file annotations, and interactive reviews. |
|
Closing as superseded. The |
Summary
Implements blocking message API (
sendAndWait) on the client side and auto-ACK functionality for responding to blocking sends.Changes - agent-relay-485
sendAndWait(to, body, options)method to clientbroadcastAndWait(body, options)for multi-recipient blocking sendsChanges - agent-relay-486
meta.sync.correlationId{ from: 'AgentName' }Features
Blocking Sends:
await client.sendAndWait('Agent', 'Confirm action?', { timeoutMs: 5000 })await client.broadcastAndWait('Who is ready?')Auto-ACK:
Tests
55 comprehensive test cases covering:
Depends on: #484 (daemon pending ACK tracking)
Closes #485, #486