nothumanallowed 13.5.53 → 13.5.54
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 +1 -1
- package/src/commands/ui.mjs +54 -13
- package/src/constants.mjs +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "13.5.
|
|
3
|
+
"version": "13.5.54",
|
|
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": {
|
package/src/commands/ui.mjs
CHANGED
|
@@ -4369,9 +4369,36 @@ module.exports = { get, set, del, exists };
|
|
|
4369
4369
|
walkDir(sandboxDir, '');
|
|
4370
4370
|
}
|
|
4371
4371
|
|
|
4372
|
-
const fileContext = allFiles.map(f => `### FILE: ${f.name}\n\`\`\`\n${f.content}\n\`\`\``).join('\n\n');
|
|
4373
4372
|
const fileList = allFiles.map(f => f.name).join('\n');
|
|
4374
4373
|
|
|
4374
|
+
// Smart file selection: include only relevant files to avoid overflowing context window.
|
|
4375
|
+
// Always include: package.json, server/index.js, .env.example (structure/deps context).
|
|
4376
|
+
// Also include: any file whose name appears in the user message, plus error-related files.
|
|
4377
|
+
const msgLower = (message || '').toLowerCase();
|
|
4378
|
+
const alwaysInclude = ['package.json', 'server/index.js', '.env.example'];
|
|
4379
|
+
const relevantFiles = allFiles.filter(f => {
|
|
4380
|
+
const nameLower = f.name.toLowerCase();
|
|
4381
|
+
if (alwaysInclude.some(a => nameLower.endsWith(a))) return true;
|
|
4382
|
+
// Include if file name or path fragment mentioned in message
|
|
4383
|
+
const parts = f.name.split('/');
|
|
4384
|
+
if (parts.some(p => msgLower.includes(p.replace(/\.[^.]+$/, '').toLowerCase()))) return true;
|
|
4385
|
+
// Include server JS files if message mentions "error", "errore", "fix", "crash", "module"
|
|
4386
|
+
if (/errore|error|fix|crash|module|require|import/i.test(message) && f.name.startsWith('server/') && f.name.endsWith('.js')) return true;
|
|
4387
|
+
return false;
|
|
4388
|
+
});
|
|
4389
|
+
// Cap total context at ~24KB to stay within 7B model limits
|
|
4390
|
+
let contextBudget = 24 * 1024;
|
|
4391
|
+
const selectedFiles = [];
|
|
4392
|
+
for (const f of relevantFiles) {
|
|
4393
|
+
if (contextBudget <= 0) break;
|
|
4394
|
+
selectedFiles.push(f);
|
|
4395
|
+
contextBudget -= f.content.length;
|
|
4396
|
+
}
|
|
4397
|
+
const fileContext = selectedFiles.map(f => `### FILE: ${f.name}\n\`\`\`\n${f.content}\n\`\`\``).join('\n\n');
|
|
4398
|
+
const includedNote = selectedFiles.length < allFiles.length
|
|
4399
|
+
? `\n(Showing ${selectedFiles.length}/${allFiles.length} files most relevant to the request. Ask to read others explicitly.)`
|
|
4400
|
+
: '';
|
|
4401
|
+
|
|
4375
4402
|
// Build attachment context (images/PDF)
|
|
4376
4403
|
const attachCtx = (attachments || []).map((a, i) => `[Allegato ${i+1}: ${a.name || 'file'}, type=${a.mimeType}]`).join('\n');
|
|
4377
4404
|
|
|
@@ -4405,23 +4432,37 @@ REGOLE CRITICHE:
|
|
|
4405
4432
|
- Se usi immagini allegate, descrivile e usale come contesto per il fix`;
|
|
4406
4433
|
|
|
4407
4434
|
const userMsg = message + (attachCtx ? '\n\nAllegati:\n' + attachCtx : '') +
|
|
4408
|
-
'\n\n--- CONTENUTO FILE
|
|
4435
|
+
'\n\n--- CONTENUTO FILE ---' + includedNote + '\n' + fileContext;
|
|
4409
4436
|
|
|
4410
4437
|
// Call LLM - stream tokens
|
|
4411
4438
|
let fullResponse = '';
|
|
4412
4439
|
const visionAttachments = (attachments || []).filter(a => a.base64 && (a.mimeType || '').startsWith('image/'));
|
|
4413
4440
|
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4441
|
+
try {
|
|
4442
|
+
if (visionAttachments.length > 0) {
|
|
4443
|
+
const { callLLMVision } = await import('../services/llm.mjs');
|
|
4444
|
+
const va = visionAttachments[0];
|
|
4445
|
+
fullResponse = await callLLMVision(config, systemPrompt, userMsg, { base64: va.base64, mimeType: va.mimeType });
|
|
4446
|
+
sendEv({ type: 'text', token: fullResponse });
|
|
4447
|
+
} else {
|
|
4448
|
+
await callLLMStream(config, systemPrompt, userMsg, (token) => {
|
|
4449
|
+
fullResponse += token;
|
|
4450
|
+
sendEv({ type: 'text', token });
|
|
4451
|
+
}, { max_tokens: 4096 });
|
|
4452
|
+
}
|
|
4453
|
+
} catch (llmErr) {
|
|
4454
|
+
const errMsg = llmErr.message || String(llmErr);
|
|
4455
|
+
// Surface a clean message instead of raw HTML
|
|
4456
|
+
if (errMsg.includes('502') || errMsg.includes('Bad Gateway')) {
|
|
4457
|
+
sendEv({ type: 'text', token: 'Liara non disponibile al momento (502). Riprova tra qualche secondo, oppure configura una tua API key con: nha config set provider anthropic && nha config set key sk-...' });
|
|
4458
|
+
} else if (errMsg.includes('429') || errMsg.includes('rate limit')) {
|
|
4459
|
+
sendEv({ type: 'text', token: 'Rate limit raggiunto su Liara (max 3 auto-fix per 5 minuti con il piano free). Attendi qualche minuto o usa una tua API key.' });
|
|
4460
|
+
} else {
|
|
4461
|
+
sendEv({ type: 'text', token: 'Errore LLM: ' + errMsg.slice(0, 200) });
|
|
4462
|
+
}
|
|
4463
|
+
sendEv({ type: 'done', changed: false, toolCount: 0 });
|
|
4464
|
+
res.end();
|
|
4465
|
+
return;
|
|
4425
4466
|
}
|
|
4426
4467
|
|
|
4427
4468
|
// Parse and execute tool calls from response
|
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.
|
|
8
|
+
export const VERSION = '13.5.54';
|
|
9
9
|
export const BASE_URL = 'https://nothumanallowed.com/cli';
|
|
10
10
|
export const API_BASE = 'https://nothumanallowed.com/api/v1';
|
|
11
11
|
|