nothumanallowed 13.5.140 → 13.5.142

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.140",
3
+ "version": "13.5.142",
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": {
@@ -5706,11 +5706,23 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
5706
5706
  return abs.startsWith(sandboxDir) ? abs.slice(sandboxDir.length + 1) : abs.split('/').slice(-3).join('/');
5707
5707
  }));
5708
5708
 
5709
+ // For autofix: also detect "Cannot find module './redis'" style errors and extract the requiring file
5710
+ // Stack trace line: "at Object.<anonymous> (/path/server/middleware/security.js:3:X)"
5711
+ // We want to guarantee the file that contains the bad require() is always in context.
5712
+ const moduleNotFoundMatch = autofix ? message.match(/Cannot find module '([^']+)'[\s\S]*?at Object[^(]*\(([^)]+\.js):\d+:\d+\)/) : null;
5713
+ if (moduleNotFoundMatch) {
5714
+ const requirerAbs = moduleNotFoundMatch[2];
5715
+ const requirerRel = requirerAbs.startsWith(sandboxDir) ? requirerAbs.slice(sandboxDir.length + 1) : requirerAbs.split('/').slice(-3).join('/');
5716
+ stackFiles.add(requirerRel);
5717
+ }
5718
+
5719
+ const isStackFile = (f) => stackFiles.size > 0 && [...stackFiles].some(sf => f.name.includes(sf) || sf.includes(f.name));
5720
+
5709
5721
  const relevantFiles = allFiles.filter(f => {
5710
5722
  const nameLower = f.name.toLowerCase();
5711
5723
  if (alwaysInclude.some(a => nameLower.endsWith(a))) return true;
5712
- // Always include files mentioned in stack trace (autofix)
5713
- if (stackFiles.size > 0 && [...stackFiles].some(sf => f.name.includes(sf) || sf.includes(f.name))) return true;
5724
+ // Always include files mentioned in stack trace (autofix) — highest priority
5725
+ if (isStackFile(f)) return true;
5714
5726
  // Include if file name or path fragment mentioned in message
5715
5727
  const parts = f.name.split('/');
5716
5728
  if (parts.some(p => msgLower.includes(p.replace(/\.[^.]+$/, '').toLowerCase()))) return true;
@@ -5718,11 +5730,19 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
5718
5730
  if (/errore|error|fix|crash|module|require|import/i.test(message) && f.name.startsWith('server/') && f.name.endsWith('.js')) return true;
5719
5731
  return false;
5720
5732
  });
5733
+ // Sort: stack trace files first (guaranteed to be in context regardless of budget)
5734
+ relevantFiles.sort((a, b) => {
5735
+ const aStack = isStackFile(a) ? 0 : 1;
5736
+ const bStack = isStackFile(b) ? 0 : 1;
5737
+ return aStack - bStack;
5738
+ });
5721
5739
  // Cap total context at ~24KB to stay within 7B model limits
5740
+ // Stack trace files are always included even if over budget
5722
5741
  let contextBudget = 24 * 1024;
5723
5742
  const selectedFiles = [];
5724
5743
  for (const f of relevantFiles) {
5725
- if (contextBudget <= 0) break;
5744
+ const isRequired = isStackFile(f) || alwaysInclude.some(a => f.name.toLowerCase().endsWith(a));
5745
+ if (contextBudget <= 0 && !isRequired) break;
5726
5746
  selectedFiles.push(f);
5727
5747
  contextBudget -= f.content.length;
5728
5748
  }
@@ -5756,7 +5776,7 @@ Per leggere un file (se hai bisogno di piu contesto):
5756
5776
 
5757
5777
  REGOLE CRITICHE:
5758
5778
  - Spiega SEMPRE in linguaggio naturale cosa stai facendo PRIMA dei blocchi tool
5759
- - ${autofix ? 'MODALITA AUTO-FIX: usa "write" per riscrivere i file problematici nella loro interezza — è più affidabile di "edit" quando il file ha già subito modifiche. Includi il contenuto COMPLETO del file nel campo "content".' : 'Usa "edit" (old/new) quando possibile, "write" solo per file nuovi o riscritture complete'}
5779
+ - ${autofix ? 'MODALITA AUTO-FIX: il file incriminato è già incluso qui sotto. Riscrivilo COMPLETAMENTE con "write" — è più affidabile di "edit" quando il file ha già subito modifiche. REGOLE CRITICHE PER IL FIX: (1) SyntaxError "Unexpected token \';\'" in helmet/CSP = stai usando punto-e-virgola invece di virgola negli oggetti JS — usa VIRGOLE. (2) "Cannot find module \'./redis\'" = rimuovi il require e usa solo i moduli in package.json. (3) NON aggiungere require() di moduli non in package.json. Includi il contenuto COMPLETO del file nel campo "content".' : 'Usa "edit" (old/new) quando possibile, "write" solo per file nuovi o riscritture complete'}
5760
5780
  - old_string deve essere ESATTO come appare nel file (copy-paste)
5761
5781
  - Non inventare moduli npm: usa solo quelli in package.json o standard Node.js
5762
5782
  - Dopo ogni fix spiega brevemente cosa hai cambiato e perche
package/src/constants.mjs CHANGED
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'url';
5
5
  const __filename = fileURLToPath(import.meta.url);
6
6
  const __dirname = path.dirname(__filename);
7
7
 
8
- export const VERSION = '13.5.140';
8
+ export const VERSION = '13.5.142';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -609,7 +609,7 @@ function buildRequestBody(provider, model, systemPrompt, userMessage, stream) {
609
609
  };
610
610
  const req = {
611
611
  model: model || modelDefaults[provider] || 'gpt-4o',
612
- max_tokens: provider === 'nha' ? 4096 : 8192,
612
+ max_tokens: opts.max_tokens || (provider === 'nha' ? 8192 : 8192),
613
613
  messages: [
614
614
  { role: 'system', content: systemPrompt },
615
615
  { role: 'user', content: userMessage },