Skip to content

feat: WebSocket inbound message push#2

Merged
lucasmpramos merged 2 commits intomainfrom
feature/ws-inbound-push
Feb 8, 2026
Merged

feat: WebSocket inbound message push#2
lucasmpramos merged 2 commits intomainfrom
feature/ws-inbound-push

Conversation

@lucasmpramos
Copy link
Copy Markdown

Adds a new Gateway WS event for real-time inbound messages (no polling). Includes a safe pub/sub emitter, gateway broadcast, and cleanup.

Notes:

  • Intended for dashboard real-time updates
  • Web UI tool stream remains separate (verbose-gated)

- Add new 'message.inbound' event to GATEWAY_EVENTS
- Create src/infra/inbound-events.ts with pub/sub mechanism
- Emit inbound message events from dispatch-from-config.ts
- Subscribe to inbound events in gateway server and broadcast
- Add proper cleanup in gateway close handler

This allows connected WebSocket clients (e.g., dashboard) to receive
real-time notifications when messages arrive on any channel (WhatsApp,
Telegram, Discord, etc.) without polling.

Event payload includes:
- messageId, sessionKey, channel, accountId
- from, senderName, content, timestamp
- chatType (dm/group), conversationId, threadId
- hasMedia, mediaType, metadata
@lucasmpramos lucasmpramos merged commit c754bcf into main Feb 8, 2026
lucasmpramos added a commit that referenced this pull request Mar 9, 2026
Merges 33 commits from work branch:
- WhatsApp login tool HTTP invoke (openclaw#21/openclaw#25)
- Audio inbound transcription for webchat (openclaw#21)
- TTS audio playback in chat (openclaw#22)
- /media endpoint for audio/image serving (openclaw#19)
- image_generate tool with Gemini (openclaw#20)
- imageReady/mediaReady event pipeline (openclaw#22)
- Chat.send internal routing simplification (openclaw#23)
- Silent reply filter removal (openclaw#24)
- ThinkingDefault shortcut (openclaw#26)

Conflict resolution:
- patches/README.md: unified numbering (our #2-18 + his openclaw#19-26)
- patches/verify-patches.sh: combined both check sets (24 total)
- server-methods/chat.ts: used work version as base (has media pipeline),
  route resolution removal from openclaw#23 is intentional for webchat

Build: clean. Patches: 24/24 passing.

Co-authored-by: Bob
guiramos added a commit that referenced this pull request Mar 29, 2026
- get_agent: increase search limit to 25 to avoid missing exact hostname match
- search: clamp limit to 1-50 range, cap capabilities to 20 max

Per Codex review (issues #1 and #2)
guiramos added a commit that referenced this pull request Mar 31, 2026
CRITICAL:
- #1: Fix InboxMessage.from type from number to string (Pilot address)
- #2: Fix parseNodeIdFromPilotAddress to extract only last hex group
- #3: Rebuild hostnameToNodeId cache from Convex on startup
- #4: Fix AgentNetworkConfig → AgentRegistryConfig type reference
- #5: Track processed message hashes to prevent re-processing on clear failure

HIGH:
- #7: Change default pollIntervalSeconds from 300 to 15
- #8: Fix startDaemon regex to match Pilot address format (0:xxxx.xxxx.xxxx)
- #9: Use registerAgent() for re-registration to preserve enriched metadata
- #10: Fix search query param from 'query' to 'q'
- #12: handleRefresh supports optional accountId, refreshes all if omitted
- #13: Move spawn import to top-level, remove 7 inline dynamic imports
- #14: Mark inbox tool action as debug-only (poll loop handles processing)

MEDIUM:
- #15: Add installation_id to PilotPeer interface and agentToPeer
- #16: Use exact /by-hostname/ endpoint for get_agent action
- #17: Add LRU-style eviction to hostnameToNodeId (max 1000 entries)
- openclaw#18: Add mutex (isPolling flag) to executePollCycle
- openclaw#19: Add lifecycle comments to startDaemon/stopDaemon (container vs local)
- openclaw#20: Pass gatewayToken in fetchNetworkMetadata Convex query
- openclaw#21: Wrap sendText fallback in try/catch with error handling
- openclaw#23: Document sendMessage JSON vs raw text design intent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant