From 9f37bef97a835e91e35033b2c9e644dcae5c0d90 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 9 Oct 2025 07:37:28 +0200 Subject: [PATCH] Add auto-subscription for real-time message notifications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ReceiveMessagesTool subscription activates automatically on startup - No need to call receive_messages manually first - Messages arrive in real-time like chat - Notifications appear instantly when messages sent 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/registry/ToolRegistry.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/registry/ToolRegistry.ts b/src/registry/ToolRegistry.ts index c789574..36c634f 100644 --- a/src/registry/ToolRegistry.ts +++ b/src/registry/ToolRegistry.ts @@ -17,6 +17,21 @@ export class ToolRegistry { async initialize(): Promise { this.setupDiscovery(); + await this.setupMessageSubscription(); + } + + private async setupMessageSubscription(): Promise { + // Auto-activate receive_messages subscription for real-time notifications + const receiveMessagesTool = this.builtinHandlers.get('receive_messages'); + if (receiveMessagesTool) { + try { + // Trigger initial subscription by calling the tool with empty params + await this.executeBuiltinTool(receiveMessagesTool, {}); + logger.info('Message subscription activated for real-time notifications'); + } catch (error) { + logger.warn({ error }, 'Failed to auto-activate message subscription'); + } + } } private setupDiscovery(): void {