nothumanallowed 13.5.100 → 13.5.102
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 +30 -25
- package/src/services/web-ui.mjs +16 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "13.5.
|
|
3
|
+
"version": "13.5.102",
|
|
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
|
@@ -4128,6 +4128,32 @@ ${completedHeadings ? `## SECTIONS ALREADY WRITTEN (headings only):\n${completed
|
|
|
4128
4128
|
const sendReady = (port, dir) => res.write(`data: ${JSON.stringify({ type: 'ready', port, dir })}\n\n`);
|
|
4129
4129
|
const sendError = (msg) => res.write(`data: ${JSON.stringify({ type: 'error', msg })}\n\n`);
|
|
4130
4130
|
|
|
4131
|
+
// Helper: write sandbox log to skills/ dir — defined before try so catch can use it
|
|
4132
|
+
const writeSandboxLog = (sandboxDirArg, freePortArg, extraLines, isError) => {
|
|
4133
|
+
try {
|
|
4134
|
+
const _nl = '\n';
|
|
4135
|
+
const _now = new Date();
|
|
4136
|
+
const _pad = n => String(n).padStart(2,'0');
|
|
4137
|
+
const logTs = _now.getFullYear()+'-'+_pad(_now.getMonth()+1)+'-'+_pad(_now.getDate())+' '+_pad(_now.getHours())+':'+_pad(_now.getMinutes())+':'+_pad(_now.getSeconds());
|
|
4138
|
+
const logName = projName + '-latest.log';
|
|
4139
|
+
const logsDir = path.join(sandboxDirArg, 'skills');
|
|
4140
|
+
fs.mkdirSync(logsDir, { recursive: true });
|
|
4141
|
+
const oldLogs = fs.readdirSync(logsDir).filter(f => f.endsWith('.log') && f.startsWith(projName + '-') && f !== logName);
|
|
4142
|
+
oldLogs.forEach(f => { try { fs.unlinkSync(path.join(logsDir, f)); } catch(_) {} });
|
|
4143
|
+
const title = isError ? '# Sandbox Log — ' + projName + ' [ERRORE]' : '# Sandbox Log — ' + projName;
|
|
4144
|
+
const logContent = title + _nl + 'Avviato: ' + logTs + _nl + 'Porta: ' + (freePortArg || '?') + _nl + _nl + _sbLogLines.join(_nl) + (extraLines ? _nl + _nl + extraLines : '');
|
|
4145
|
+
fs.writeFileSync(path.join(logsDir, logName), logContent, 'utf8');
|
|
4146
|
+
const idxPath = path.join(logsDir, '_index.json');
|
|
4147
|
+
let idx = {};
|
|
4148
|
+
try { idx = JSON.parse(fs.readFileSync(idxPath, 'utf8')); } catch(_) {}
|
|
4149
|
+
idx[logName] = 'log';
|
|
4150
|
+
fs.writeFileSync(idxPath, JSON.stringify(idx), 'utf8');
|
|
4151
|
+
} catch(_) {}
|
|
4152
|
+
};
|
|
4153
|
+
|
|
4154
|
+
let _sandboxDir = null;
|
|
4155
|
+
let _freePort = null;
|
|
4156
|
+
|
|
4131
4157
|
try {
|
|
4132
4158
|
// Kill previous sandbox if running
|
|
4133
4159
|
if (global._wcSandboxProc) {
|
|
@@ -4136,6 +4162,7 @@ ${completedHeadings ? `## SECTIONS ALREADY WRITTEN (headings only):\n${completed
|
|
|
4136
4162
|
}
|
|
4137
4163
|
|
|
4138
4164
|
const sandboxDir = path.join(os.homedir(), '.nha', 'webcraft', projName);
|
|
4165
|
+
_sandboxDir = sandboxDir;
|
|
4139
4166
|
sendLog(`📁 Percorso sandbox: ${sandboxDir}`);
|
|
4140
4167
|
fs.mkdirSync(sandboxDir, { recursive: true });
|
|
4141
4168
|
|
|
@@ -4553,6 +4580,7 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
|
|
|
4553
4580
|
const srv = netMod.createServer();
|
|
4554
4581
|
srv.listen(0, '127.0.0.1', () => { const p = srv.address().port; srv.close(() => resolve(p)); });
|
|
4555
4582
|
});
|
|
4583
|
+
_freePort = freePort;
|
|
4556
4584
|
|
|
4557
4585
|
// Patch PORT in .env
|
|
4558
4586
|
fs.writeFileSync(path.join(sandboxDir, '.env'), envContent.replace('PORT=0', `PORT=${freePort}`), 'utf8');
|
|
@@ -4603,29 +4631,6 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
|
|
|
4603
4631
|
sendLog(' [server] ' + l);
|
|
4604
4632
|
});
|
|
4605
4633
|
|
|
4606
|
-
// Helper: write sandbox log to skills/ dir (called on both success and error)
|
|
4607
|
-
const writeSandboxLog = (extraLines, isError) => {
|
|
4608
|
-
try {
|
|
4609
|
-
const _nl = '\n';
|
|
4610
|
-
const _now = new Date();
|
|
4611
|
-
const _pad = n => String(n).padStart(2,'0');
|
|
4612
|
-
const logTs = _now.getFullYear()+'-'+_pad(_now.getMonth()+1)+'-'+_pad(_now.getDate())+' '+_pad(_now.getHours())+':'+_pad(_now.getMinutes())+':'+_pad(_now.getSeconds());
|
|
4613
|
-
const logName = projName + '-latest.log';
|
|
4614
|
-
const logsDir = path.join(sandboxDir, 'skills');
|
|
4615
|
-
fs.mkdirSync(logsDir, { recursive: true });
|
|
4616
|
-
const oldLogs = fs.readdirSync(logsDir).filter(f => f.endsWith('.log') && f.startsWith(projName + '-') && f !== logName);
|
|
4617
|
-
oldLogs.forEach(f => { try { fs.unlinkSync(path.join(logsDir, f)); } catch(_) {} });
|
|
4618
|
-
const title = isError ? '# Sandbox Log — ' + projName + ' [ERRORE]' : '# Sandbox Log — ' + projName;
|
|
4619
|
-
const logContent = title + _nl + 'Avviato: ' + logTs + _nl + 'Porta: ' + freePort + _nl + _nl + _sbLogLines.join(_nl) + (extraLines ? _nl + _nl + extraLines : '');
|
|
4620
|
-
fs.writeFileSync(path.join(logsDir, logName), logContent, 'utf8');
|
|
4621
|
-
const idxPath = path.join(logsDir, '_index.json');
|
|
4622
|
-
let idx = {};
|
|
4623
|
-
try { idx = JSON.parse(fs.readFileSync(idxPath, 'utf8')); } catch(_) {}
|
|
4624
|
-
idx[logName] = 'log';
|
|
4625
|
-
fs.writeFileSync(idxPath, JSON.stringify(idx), 'utf8');
|
|
4626
|
-
} catch(_) {}
|
|
4627
|
-
};
|
|
4628
|
-
|
|
4629
4634
|
// Wait for server to be ready (max 10s)
|
|
4630
4635
|
await new Promise((resolve, reject) => {
|
|
4631
4636
|
let attempts = 0;
|
|
@@ -4642,11 +4647,11 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
|
|
|
4642
4647
|
});
|
|
4643
4648
|
|
|
4644
4649
|
sendLog(`✅ Sandbox pronta!`);
|
|
4645
|
-
writeSandboxLog(null, false);
|
|
4650
|
+
writeSandboxLog(sandboxDir, freePort, null, false);
|
|
4646
4651
|
|
|
4647
4652
|
sendReady(freePort, sandboxDir);
|
|
4648
4653
|
} catch (e) {
|
|
4649
|
-
writeSandboxLog('❌ ERRORE: ' + e.message, true);
|
|
4654
|
+
if (_sandboxDir) writeSandboxLog(_sandboxDir, _freePort, '❌ ERRORE: ' + e.message, true);
|
|
4650
4655
|
sendError(e.message);
|
|
4651
4656
|
}
|
|
4652
4657
|
res.end();
|
package/src/services/web-ui.mjs
CHANGED
|
@@ -7531,7 +7531,13 @@ function wcStopAutoFixPoller() {
|
|
|
7531
7531
|
}
|
|
7532
7532
|
|
|
7533
7533
|
async function wcTriggerAutoFix(missingModule) {
|
|
7534
|
-
if (wcChatRunning)
|
|
7534
|
+
if (wcChatRunning) {
|
|
7535
|
+
var waited = 0;
|
|
7536
|
+
await new Promise(function(resolve) {
|
|
7537
|
+
var t = setInterval(function() { waited += 500; if (!wcChatRunning || waited >= 30000) { clearInterval(t); resolve(); } }, 500);
|
|
7538
|
+
});
|
|
7539
|
+
if (wcChatRunning) return;
|
|
7540
|
+
}
|
|
7535
7541
|
var fixMsg = 'AUTO-FIX: Cannot find module ' + missingModule + String.fromCharCode(10) + 'Analizza tutti i file del progetto e correggi il require/import per questo modulo. Se il modulo non esiste, rimuovi il require e implementa la funzionalita con moduli disponibili o Node.js built-in.';
|
|
7536
7542
|
wcChat.push({ role: 'user', text: '\uD83E\uDD16 Auto-fix modulo mancante: ' + missingModule });
|
|
7537
7543
|
wcChatRunning = true;
|
|
@@ -7577,7 +7583,14 @@ async function wcTriggerAutoFix(missingModule) {
|
|
|
7577
7583
|
wcScrollChatToBottom();
|
|
7578
7584
|
}
|
|
7579
7585
|
async function wcTriggerCrashFix(errorMsg) {
|
|
7580
|
-
if (wcChatRunning)
|
|
7586
|
+
if (wcChatRunning) {
|
|
7587
|
+
// Wait up to 30s for current agent to finish, then retry
|
|
7588
|
+
var waited = 0;
|
|
7589
|
+
await new Promise(function(resolve) {
|
|
7590
|
+
var t = setInterval(function() { waited += 500; if (!wcChatRunning || waited >= 30000) { clearInterval(t); resolve(); } }, 500);
|
|
7591
|
+
});
|
|
7592
|
+
if (wcChatRunning) return;
|
|
7593
|
+
}
|
|
7581
7594
|
var fixMsg = 'AUTO-FIX: ' + errorMsg + String.fromCharCode(10) + 'Il server Express ha crashato con questo errore. Analizza tutti i file del progetto, individua la causa e correggi il codice. Modifica i file necessari usando i tool disponibili.';
|
|
7582
7595
|
wcChat.push({ role: 'user', text: '\uD83E\uDD16 Auto-fix crash: ' + errorMsg });
|
|
7583
7596
|
wcChatRunning = true;
|
|
@@ -8536,11 +8549,8 @@ async function wcStartSandbox() {
|
|
|
8536
8549
|
_wcAutoFixAttempts++;
|
|
8537
8550
|
wcTriggerAutoFix(modMatch[1]);
|
|
8538
8551
|
} else if (errMsg && !modMatch && _wcAutoFixAttempts < 3) {
|
|
8539
|
-
// Generic crash: post error to chat so agent can see it
|
|
8540
8552
|
_wcAutoFixAttempts++;
|
|
8541
|
-
|
|
8542
|
-
renderWebCraft(document.getElementById('content'));
|
|
8543
|
-
wcScrollChatToBottom();
|
|
8553
|
+
wcTriggerCrashFix(errMsg);
|
|
8544
8554
|
}
|
|
8545
8555
|
}
|
|
8546
8556
|
} catch(_) {}
|