nothumanallowed 13.5.68 → 13.5.69

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": "nothumanallowed",
3
- "version": "13.5.68",
3
+ "version": "13.5.69",
4
4
  "description": "NotHumanAllowed — 38 AI agents, 80 tools, Studio (visual agentic workflows). Email, calendar, browser automation, screen capture, canvas, cron/heartbeat, Alexandria E2E messaging, GitHub, Notion, Slack, voice chat, free AI (Liara), 28 languages. Zero-dependency CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -4321,11 +4321,12 @@ module.exports = { get, set, del, exists };
4321
4321
  [/require\(['"]\.\.\/middleware\/limiter['"]\)/g, "require('../middleware/security')"],
4322
4322
  [/require\(['"]\.\/middleware\/limiter['"]\)/g, "require('./middleware/security')"],
4323
4323
  ];
4324
- function patchJsFiles(dir) {
4324
+ function patchJsFiles(dir, rootDir) {
4325
4325
  if (!fs.existsSync(dir)) return;
4326
+ const _rootDir = rootDir || dir;
4326
4327
  for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
4327
4328
  const full = path.join(dir, entry.name);
4328
- if (entry.isDirectory()) { patchJsFiles(full); continue; }
4329
+ if (entry.isDirectory()) { patchJsFiles(full, _rootDir); continue; }
4329
4330
  if (!entry.name.endsWith('.js')) continue;
4330
4331
  let src = fs.readFileSync(full, 'utf8');
4331
4332
  let changed = false;
@@ -4333,10 +4334,22 @@ module.exports = { get, set, del, exists };
4333
4334
  const next = src.replace(pat, rep);
4334
4335
  if (next !== src) { src = next; changed = true; }
4335
4336
  }
4337
+ // Context-aware db path fix: if file is in a subdirectory of server/
4338
+ // (e.g. routes/, middleware/, services/) and does require('./db'),
4339
+ // correct to require('../db') since db.js lives in server/
4340
+ const depth = path.relative(_rootDir, dir).split(path.sep).filter(Boolean).length;
4341
+ if (depth > 0) {
4342
+ const prefix = '../'.repeat(depth);
4343
+ const next2 = src.replace(/require\(['"]\.\/db['"]\)/g, "require('" + prefix + "db')");
4344
+ if (next2 !== src) { src = next2; changed = true; }
4345
+ // Also fix ./models/* → ../models/*
4346
+ const next3 = src.replace(/require\(['"]\.\/(models\/[^'"]+)['"]\)/g, "require('../$1')");
4347
+ if (next3 !== src) { src = next3; changed = true; }
4348
+ }
4336
4349
  if (changed) fs.writeFileSync(full, src, 'utf8');
4337
4350
  }
4338
4351
  }
4339
- patchJsFiles(path.join(sandboxDir, 'server'));
4352
+ patchJsFiles(path.join(sandboxDir, 'server'), path.join(sandboxDir, 'server'));
4340
4353
  sendLog('🔧 Shim iniettati: DB (in-memory), Sentinel WAF, Cache — require() patchati');
4341
4354
 
4342
4355
  // Patch package.json to remove pg, add only what's needed