nothumanallowed 13.5.143 → 13.5.144

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.143",
3
+ "version": "13.5.144",
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": {
@@ -5776,7 +5776,7 @@ Per leggere un file (se hai bisogno di piu contesto):
5776
5776
 
5777
5777
  REGOLE CRITICHE:
5778
5778
  - Spiega SEMPRE in linguaggio naturale cosa stai facendo PRIMA dei blocchi tool
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'}
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. (4) SyntaxError "Unexpected identifier" con nomi spezzati tipo "create Transport" o "SMTP _HOST" o "trans porter" = c\'è uno SPAZIO nel mezzo di un nome di variabile/metodo/property — unisci le parole: createTransport, SMTP_HOST, transporter. (5) "nodemailer.createTransporter is not a function" = il metodo corretto di nodemailer e\' createTransport (senza r finale). Includi il contenuto COMPLETO del file nel campo "content".' : 'Usa "edit" (old/new) quando possibile, "write" solo per file nuovi o riscritture complete'}
5780
5780
  - old_string deve essere ESATTO come appare nel file (copy-paste)
5781
5781
  - Non inventare moduli npm: usa solo quelli in package.json o standard Node.js
5782
5782
  - Dopo ogni fix spiega brevemente cosa hai cambiato e perche
@@ -5834,7 +5834,7 @@ REGOLE CRITICHE:
5834
5834
  _inTool = false;
5835
5835
  }
5836
5836
  }
5837
- }, { max_tokens: 4096 });
5837
+ }, { max_tokens: 8192 });
5838
5838
  // Flush any remaining visible text after stream ends
5839
5839
  if (!_inTool && _toolBuf.trim()) sendEv({ type: 'text', token: _toolBuf });
5840
5840
  }
@@ -5854,18 +5854,35 @@ REGOLE CRITICHE:
5854
5854
  }
5855
5855
 
5856
5856
  // Parse and execute tool calls from response
5857
- // Sanitize JSON from LLM: replace literal newlines inside JSON strings with \n
5858
- // Models often write multiline strings without escaping, which breaks JSON.parse
5857
+ // Sanitize JSON from LLM: replace literal newlines and invalid escape sequences inside JSON strings
5858
+ // Models often write multiline strings without escaping, or use \s \d \w in regex inside content
5859
5859
  const sanitizeToolJson = (raw) => {
5860
- // Replace literal CR/LF inside JSON string values with escaped versions
5861
- // Strategy: walk char by char, track if we're inside a JSON string
5860
+ // Valid JSON escape chars after backslash: " \ / b f n r t u
5861
+ const validEscapes = new Set(['"', '\\', '/', 'b', 'f', 'n', 'r', 't', 'u']);
5862
5862
  let out = '';
5863
5863
  let inStr = false;
5864
5864
  let escaped = false;
5865
5865
  for (let ci = 0; ci < raw.length; ci++) {
5866
5866
  const ch = raw[ci];
5867
- if (escaped) { out += ch; escaped = false; continue; }
5868
- if (ch === '\\') { out += ch; escaped = true; continue; }
5867
+ if (escaped) {
5868
+ escaped = false;
5869
+ // If this is not a valid JSON escape char, double the backslash
5870
+ if (!validEscapes.has(ch)) {
5871
+ out += '\\\\' + ch;
5872
+ } else {
5873
+ out += ch;
5874
+ }
5875
+ continue;
5876
+ }
5877
+ if (ch === '\\') {
5878
+ if (inStr) {
5879
+ escaped = true;
5880
+ out += ch;
5881
+ } else {
5882
+ out += ch;
5883
+ }
5884
+ continue;
5885
+ }
5869
5886
  if (ch === '"') { inStr = !inStr; out += ch; continue; }
5870
5887
  if (inStr && (ch === '\n' || ch === '\r')) {
5871
5888
  out += ch === '\n' ? '\\n' : '\\r';
@@ -5937,7 +5954,7 @@ REGOLE CRITICHE:
5937
5954
  const fallbackSys = `Sei un esperto di Node.js. Riscrivi il seguente file correggendo questo problema: ${message.slice(0, 500)}
5938
5955
  Rispondi SOLO con il contenuto completo del file corretto, senza markdown fence, senza spiegazioni.`;
5939
5956
  const fallbackUser = `FILE: ${toolCall.path}\n\`\`\`\n${content}\n\`\`\``;
5940
- const newContent = await callLLM(config, fallbackSys, fallbackUser, { max_tokens: 4096 });
5957
+ const newContent = await callLLM(config, fallbackSys, fallbackUser, { max_tokens: 8192 });
5941
5958
  const cleaned = newContent.replace(/^```[\w]*\n?/m, '').replace(/\n?```\s*$/m, '').trim();
5942
5959
  if (cleaned && cleaned.length > 20) {
5943
5960
  fs.writeFileSync(fp, cleaned, 'utf8');
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.143';
8
+ export const VERSION = '13.5.144';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11