squidclaw 0.5.3 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/engine.js +42 -0
  2. package/package.json +1 -1
package/lib/engine.js CHANGED
@@ -74,6 +74,48 @@ export class SquidclawEngine {
74
74
  console.log(" 🔧 Tools: basic mode");
75
75
  }
76
76
 
77
+ // 3e. Telegram Bot
78
+ if (this.config.channels?.telegram?.enabled && this.config.channels?.telegram?.token) {
79
+ try {
80
+ const { TelegramManager } = await import('./channels/telegram/bot.js');
81
+ this.telegramManager = new TelegramManager(this.config, this.agentManager);
82
+
83
+ // Set up message handler
84
+ this.telegramManager.onMessage = async (agentId, contactId, message, metadata) => {
85
+ const agent = this.agentManager.get(agentId);
86
+ if (!agent) return;
87
+
88
+ // Allowlist check
89
+ const allowFrom = this.config.channels?.telegram?.allowFrom;
90
+ if (allowFrom && allowFrom !== '*') {
91
+ const senderId = contactId.replace('tg_', '');
92
+ const allowed = Array.isArray(allowFrom) ? allowFrom.includes(senderId) : String(allowFrom) === senderId;
93
+ if (!allowed) return;
94
+ }
95
+
96
+ const result = await agent.processMessage(contactId, message, metadata);
97
+
98
+ if (result.reaction && metadata.messageId) {
99
+ try { await this.telegramManager.sendReaction(agentId, contactId, metadata.messageId, result.reaction, metadata); } catch {}
100
+ }
101
+
102
+ if (result.messages && result.messages.length > 0) {
103
+ await this.telegramManager.sendMessages(agentId, contactId, result.messages, metadata);
104
+ }
105
+ };
106
+
107
+ // Start bot for all agents with telegram config
108
+ for (const agent of agents) {
109
+ try {
110
+ await this.telegramManager.startBot(agent.id, this.config.channels.telegram.token);
111
+ } catch (err) {}
112
+ }
113
+ console.log(' ✈️ Telegram: connected');
114
+ } catch (err) {
115
+ console.log(' ✈️ Telegram: failed (' + err.message + ')');
116
+ }
117
+ }
118
+
77
119
  // 4. WhatsApp Manager
78
120
  this.whatsappManager = new WhatsAppManager(this.config, this.agentManager, this.home);
79
121
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squidclaw",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "\ud83e\udd91 AI agent platform \u2014 human-like agents for WhatsApp, Telegram & more",
5
5
  "main": "lib/engine.js",
6
6
  "bin": {