nothumanallowed 13.5.100 → 13.5.101
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "13.5.
|
|
3
|
+
"version": "13.5.101",
|
|
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();
|