neoagent 2.4.1-beta.26 → 2.4.1-beta.28

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.
@@ -80,6 +80,8 @@ router.post('/disconnect', async (req, res) => {
80
80
  try {
81
81
  const { platform } = req.body;
82
82
  const agentId = resolveAgentId(req.session.userId, getAgentIdFromRequest(req));
83
+ if (!platform) return res.status(400).json({ error: 'Platform is required' });
84
+
83
85
  const manager = req.app.locals.messagingManager;
84
86
  const result = await manager.disconnectPlatform(req.session.userId, platform, { agentId });
85
87
  res.json(result);
@@ -473,10 +473,11 @@ class MessagingManager extends EventEmitter {
473
473
  const agentId = this._agentId(userId, options);
474
474
  const key = this._key(userId, agentId, platformName);
475
475
  const platform = this.platforms.get(key);
476
- if (!platform) return { status: 'not_connected' };
477
476
 
478
- await platform.disconnect();
479
- this.platforms.delete(key);
477
+ if (platform) {
478
+ await platform.disconnect();
479
+ this.platforms.delete(key);
480
+ }
480
481
 
481
482
  db.prepare('UPDATE platform_connections SET status = ? WHERE user_id = ? AND agent_id = ? AND platform = ?')
482
483
  .run('disconnected', userId, agentId, platformName);