Add auto-subscription for real-time message notifications

- 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 <noreply@anthropic.com>
This commit is contained in:
root
2025-10-09 07:37:28 +02:00
parent ee104d0d0c
commit 9f37bef97a

View File

@@ -17,6 +17,21 @@ export class ToolRegistry {
async initialize(): Promise<void> {
this.setupDiscovery();
await this.setupMessageSubscription();
}
private async setupMessageSubscription(): Promise<void> {
// 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 {