nothumanallowed 13.5.72 → 13.5.73
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 +26 -1
- package/src/services/web-ui.mjs +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "13.5.
|
|
3
|
+
"version": "13.5.73",
|
|
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
|
@@ -4278,6 +4278,24 @@ module.exports = { get, set, del, exists };
|
|
|
4278
4278
|
fs.mkdirSync(path.join(sandboxDir, 'server', 'services'), { recursive: true });
|
|
4279
4279
|
fs.writeFileSync(path.join(sandboxDir, 'server', 'services', 'cache.js'), cacheShim, 'utf8');
|
|
4280
4280
|
|
|
4281
|
+
// Errors middleware shim — LLM often generates a custom error handler middleware file
|
|
4282
|
+
const errorsShim = `
|
|
4283
|
+
// NHA WebCraft Sandbox — middleware/errors shim
|
|
4284
|
+
class AppError extends Error { constructor(message, statusCode) { super(message); this.statusCode = statusCode || 500; this.isOperational = true; } }
|
|
4285
|
+
function errorHandler(err, req, res, next) {
|
|
4286
|
+
var code = err.statusCode || err.status || 500;
|
|
4287
|
+
var msg = (process.env.NODE_ENV !== 'production' || err.isOperational) ? err.message : 'Internal Server Error';
|
|
4288
|
+
res.status(code).json({ error: msg });
|
|
4289
|
+
}
|
|
4290
|
+
module.exports = errorHandler;
|
|
4291
|
+
module.exports.AppError = AppError;
|
|
4292
|
+
module.exports.errorHandler = errorHandler;
|
|
4293
|
+
`;
|
|
4294
|
+
fs.mkdirSync(path.join(sandboxDir, 'server', 'middleware'), { recursive: true });
|
|
4295
|
+
if (!fs.existsSync(path.join(sandboxDir, 'server', 'middleware', 'errors.js'))) {
|
|
4296
|
+
fs.writeFileSync(path.join(sandboxDir, 'server', 'middleware', 'errors.js'), errorsShim, 'utf8');
|
|
4297
|
+
}
|
|
4298
|
+
|
|
4281
4299
|
// Models shim — LLM often generates require('../models/User') etc. that don't exist
|
|
4282
4300
|
// Create a generic User model shim backed by the in-memory DB shim
|
|
4283
4301
|
const userModelShim = `
|
|
@@ -4373,6 +4391,11 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
|
|
|
4373
4391
|
[/require\(['"]\.\.\/\.\.\/config['"]\)/g, "{env:process.env}"],
|
|
4374
4392
|
[/require\(['"]\.\.\/config['"]\)/g, "{env:process.env}"],
|
|
4375
4393
|
[/require\(['"]\.\/config['"]\)/g, "{env:process.env}"],
|
|
4394
|
+
// middleware/errors — LLM generates a custom error handler that doesn't exist
|
|
4395
|
+
[/require\(['"]\.\.\/middleware\/errors['"]\)/g, "require('../middleware/errors')"],
|
|
4396
|
+
[/require\(['"]\.\/middleware\/errors['"]\)/g, "require('./middleware/errors')"],
|
|
4397
|
+
[/require\(['"]\.\.\/middleware\/errorHandler['"]\)/g, "require('../middleware/errors')"],
|
|
4398
|
+
[/require\(['"]\.\.\/middleware\/error['"]\)/g, "require('../middleware/errors')"],
|
|
4376
4399
|
// models/* — redirect to shims in server/models/
|
|
4377
4400
|
[/require\(['"]\.\.\/models\/User['"]\)/g, "require('../models/User')"],
|
|
4378
4401
|
[/require\(['"]\.\/models\/User['"]\)/g, "require('./models/User')"],
|
|
@@ -4504,6 +4527,7 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
|
|
|
4504
4527
|
global._wcSandboxPort = freePort;
|
|
4505
4528
|
global._wcSandboxDir = sandboxDir;
|
|
4506
4529
|
|
|
4530
|
+
let _lastMissingModule = null;
|
|
4507
4531
|
proc.stdout.on('data', d => { const l = d.toString().trim(); if (l) sendLog(' [server] ' + l); });
|
|
4508
4532
|
proc.stderr.on('data', d => {
|
|
4509
4533
|
const raw = d.toString();
|
|
@@ -4511,6 +4535,7 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
|
|
|
4511
4535
|
const modMatch = raw.match(/Cannot find module '([^']+)'/);
|
|
4512
4536
|
if (modMatch) {
|
|
4513
4537
|
const missingMod = modMatch[1];
|
|
4538
|
+
_lastMissingModule = missingMod;
|
|
4514
4539
|
sendLog(' ❌ Modulo mancante: ' + missingMod);
|
|
4515
4540
|
// Store error for auto-fix agent — will be picked up by frontend
|
|
4516
4541
|
if (!global._wcAutoFixQueue) global._wcAutoFixQueue = [];
|
|
@@ -4532,7 +4557,7 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
|
|
|
4532
4557
|
s.on('connect', () => { s.destroy(); resolve(); });
|
|
4533
4558
|
s.on('error', () => {
|
|
4534
4559
|
s.destroy();
|
|
4535
|
-
if (++attempts > 20) reject(new Error('Server non risponde dopo 10s'));
|
|
4560
|
+
if (++attempts > 20) reject(new Error(_lastMissingModule ? "Cannot find module '" + _lastMissingModule + "'" : 'Server non risponde dopo 10s'));
|
|
4536
4561
|
else setTimeout(tryConnect, 500);
|
|
4537
4562
|
});
|
|
4538
4563
|
};
|
package/src/services/web-ui.mjs
CHANGED
|
@@ -7366,7 +7366,7 @@ function wcStopAutoFixPoller() {
|
|
|
7366
7366
|
async function wcTriggerAutoFix(missingModule) {
|
|
7367
7367
|
if (wcChatRunning) return;
|
|
7368
7368
|
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.';
|
|
7369
|
-
wcChat.push({ role: 'user', text: '
|
|
7369
|
+
wcChat.push({ role: 'user', text: '\uD83E\uDD16 Auto-fix modulo mancante: ' + missingModule });
|
|
7370
7370
|
wcChatRunning = true;
|
|
7371
7371
|
renderWebCraft(document.getElementById('content'));
|
|
7372
7372
|
wcScrollChatToBottom();
|
|
@@ -8084,7 +8084,7 @@ async function wcFixSandboxError() {
|
|
|
8084
8084
|
String.fromCharCode(10) + String.fromCharCode(10) +
|
|
8085
8085
|
'STACKTRACE COMPLETO:' + String.fromCharCode(10) + errText;
|
|
8086
8086
|
// Push as user message so it appears in chat
|
|
8087
|
-
wcChat.push({ role: 'user', text: '
|
|
8087
|
+
wcChat.push({ role: 'user', text: '\uD83E\uDD16 Correggi errore sandbox' });
|
|
8088
8088
|
wcScrollChatToBottom();
|
|
8089
8089
|
wcChatRunning = true;
|
|
8090
8090
|
renderWebCraft(document.getElementById('content'));
|