neoagent 2.1.18-beta.69 → 2.1.18-beta.70

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": "neoagent",
3
- "version": "2.1.18-beta.69",
3
+ "version": "2.1.18-beta.70",
4
4
  "description": "Proactive personal AI agent with no limits",
5
5
  "license": "MIT",
6
6
  "main": "server/index.js",
@@ -37,6 +37,6 @@ _flutter.buildConfig = {"engineRevision":"59aa584fdf100e6c78c785d8a5b565d1de4b48
37
37
 
38
38
  _flutter.loader.load({
39
39
  serviceWorkerSettings: {
40
- serviceWorkerVersion: "3944686487" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */
40
+ serviceWorkerVersion: "3444073706" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */
41
41
  }
42
42
  });
@@ -193,6 +193,48 @@ class MessagingManager extends EventEmitter {
193
193
  }
194
194
  }
195
195
 
196
+ _persistableConfig(value, seen = new WeakSet()) {
197
+ if (value == null) return value;
198
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
199
+ return value;
200
+ }
201
+ if (typeof value === 'bigint' || typeof value === 'function' || typeof value === 'symbol') {
202
+ return undefined;
203
+ }
204
+ if (value instanceof Date) {
205
+ return value.toISOString();
206
+ }
207
+ if (Array.isArray(value)) {
208
+ return value
209
+ .map((item) => this._persistableConfig(item, seen))
210
+ .filter((item) => item !== undefined);
211
+ }
212
+ if (typeof value === 'object') {
213
+ if (seen.has(value)) {
214
+ return undefined;
215
+ }
216
+ seen.add(value);
217
+
218
+ const proto = Object.getPrototypeOf(value);
219
+ const isPlainObject = proto === Object.prototype || proto === null;
220
+ if (!isPlainObject) {
221
+ seen.delete(value);
222
+ return undefined;
223
+ }
224
+
225
+ const result = {};
226
+ for (const [key, entryValue] of Object.entries(value)) {
227
+ const normalized = this._persistableConfig(entryValue, seen);
228
+ if (normalized !== undefined) {
229
+ result[key] = normalized;
230
+ }
231
+ }
232
+ seen.delete(value);
233
+ return result;
234
+ }
235
+ return undefined;
236
+ }
237
+
196
238
  async connectPlatform(userId, platformName, config = {}, options = {}) {
197
239
  const agentId = this._agentId(userId, options);
198
240
  config = { ...(config || {}) };
@@ -276,6 +318,8 @@ class MessagingManager extends EventEmitter {
276
318
  }
277
319
  }
278
320
 
321
+ const storedConfig = JSON.stringify(this._persistableConfig(config) || {});
322
+
279
323
  const key = this._key(userId, agentId, platformName);
280
324
  let platform = this.platforms.get(key);
281
325
 
@@ -291,7 +335,7 @@ class MessagingManager extends EventEmitter {
291
335
  if (!currentPlatform()) return;
292
336
  this.io.to(`user:${userId}`).emit('messaging:qr', { agentId, platform: platformName, qr });
293
337
  db.prepare('UPDATE platform_connections SET status = ?, config = ? WHERE user_id = ? AND agent_id = ? AND platform = ?')
294
- .run('awaiting_qr', JSON.stringify(config), userId, agentId, platformName);
338
+ .run('awaiting_qr', storedConfig, userId, agentId, platformName);
295
339
  });
296
340
 
297
341
  platform.on('connected', () => {
@@ -347,10 +391,10 @@ class MessagingManager extends EventEmitter {
347
391
  const existing = db.prepare('SELECT id FROM platform_connections WHERE user_id = ? AND agent_id = ? AND platform = ?').get(userId, agentId, platformName);
348
392
  if (!existing) {
349
393
  db.prepare('INSERT INTO platform_connections (user_id, agent_id, platform, config, status) VALUES (?, ?, ?, ?, ?)')
350
- .run(userId, agentId, platformName, JSON.stringify(config), 'connecting');
394
+ .run(userId, agentId, platformName, storedConfig, 'connecting');
351
395
  } else {
352
396
  db.prepare('UPDATE platform_connections SET config = ?, status = ? WHERE user_id = ? AND agent_id = ? AND platform = ?')
353
- .run(JSON.stringify(config), 'connecting', userId, agentId, platformName);
397
+ .run(storedConfig, 'connecting', userId, agentId, platformName);
354
398
  }
355
399
 
356
400
  await platform.connect();