natureco-cli 2.3.0 → 2.3.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "NatureCo AI Bot Terminal Interface",
5
5
  "main": "bin/natureco.js",
6
6
  "bin": {
@@ -211,7 +211,7 @@ body::before{
211
211
  <div class="header-bot-name" id="header-bot-name">Nature Bot</div>
212
212
  <div class="header-bot-model" id="header-bot-model">NatureCo</div>
213
213
  </div>
214
- <div class="version-badge" id="version-badge">v2.3.0</div>
214
+ <div class="version-badge" id="version-badge">v2.3.1</div>
215
215
  </div>
216
216
  <div class="messages" id="messages"></div>
217
217
  <div class="input-area">
@@ -341,7 +341,7 @@ function dashboard(action) {
341
341
  apiKey: cfg.apiKey,
342
342
  defaultBot: cfg.defaultBot,
343
343
  defaultBotId: cfg.defaultBotId,
344
- version: 'v2.3.0',
344
+ version: 'v2.3.1',
345
345
  bots: cfg.bots || [],
346
346
  telegramToken: cfg.telegramToken || null,
347
347
  whatsappConnected: cfg.whatsappConnected || false,
@@ -136,7 +136,7 @@ async function startGateway() {
136
136
 
137
137
  async function runGatewayWorker() {
138
138
  // This runs in the background
139
- log('gateway', 'Starting NatureCo Gateway v2.3.0...', 'green');
139
+ log('gateway', 'Starting NatureCo Gateway v2.3.1...', 'green');
140
140
 
141
141
  // Load config
142
142
  const { getConfig } = require('../utils/config');
@@ -209,12 +209,18 @@ async function startWhatsAppProvider(sessionDir, config) {
209
209
  retryRequestDelayMs: 2000,
210
210
  });
211
211
 
212
+ // Connection update handler
212
213
  sock.ev.on('connection.update', async (update) => {
213
214
  const { connection, lastDisconnect } = update;
214
215
 
215
216
  if (connection === 'close') {
216
217
  const statusCode = lastDisconnect?.error?.output?.statusCode;
217
218
 
219
+ // Remove all event listeners before reconnecting
220
+ sock.ev.removeAllListeners('connection.update');
221
+ sock.ev.removeAllListeners('messages.upsert');
222
+ sock.ev.removeAllListeners('creds.update');
223
+
218
224
  if (statusCode === 515 || statusCode === 408) {
219
225
  log('whatsapp', 'connection lost, reconnecting in 10s...', 'yellow');
220
226
  setTimeout(() => startWhatsAppProvider(sessionDir, config), 10000);