nothumanallowed 13.5.97 → 13.5.99

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/commands/ui.mjs +27 -41
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nothumanallowed",
3
- "version": "13.5.97",
3
+ "version": "13.5.99",
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": {
@@ -4391,7 +4391,7 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
4391
4391
  [/require\(['"]winston['"]\)/g, "{createLogger:()=>({info:()=>{},error:()=>{},warn:()=>{}}),transports:{Console:function(){}},format:{combine:()=>{},timestamp:()=>{},json:()=>{}}}"],
4392
4392
  [/require\(['"]morgan['"]\)/g, "(()=>(r,s,n)=>n())"],
4393
4393
  [/require\(['"]compression['"]\)/g, "(()=>(r,s,n)=>n())"],
4394
- [/require\(['"]express-validator['"]\)/g, "{body:()=>({isEmail:()=>({normalizeEmail:()=>({run:async()=>{}})}),isLength:()=>({run:async()=>{}}),trim:()=>({escape:()=>({run:async()=>{}})}),notEmpty:()=>({run:async()=>{}})}),validationResult:()=>({isEmpty:()=>true,array:()=>[]})}"],
4394
+ [/require\(['"]express-validator['"]\)/g, "(()=>{function chain(){var p=new Proxy(function(){return p},{get:function(_,k){if(k==='run')return async function(){};if(k==='withMessage'||k==='bail'||k==='optional')return function(){return p};return function(){return p};}});return p;}return {body:chain,param:chain,query:chain,header:chain,cookie:chain,check:chain,validationResult:function(req){return {isEmpty:function(){return true},array:function(){return []},throw:function(){}};},matchedData:function(){return {};},oneOf:function(){return chain();}};})()"],
4395
4395
  [/require\(['"]validator['"]\)/g, "{isEmail:(s)=>/^[^@\\s]+@[^@\\s]+[.][^@\\s]+$/.test(s),escape:(s)=>String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;'),trim:(s)=>String(s).trim(),isEmpty:(s)=>!s||!String(s).trim(),isLength:(s,o)=>{ var l=String(s).length; return (!o.min||l>=o.min)&&(!o.max||l<=o.max); }}"],
4396
4396
  [/require\(['"]handlebars['"]\)/g, "{compile:(t)=>(d)=>t.replace(/\\{\\{([^}]+)\\}\\}/g,(_,k)=>d[k.trim()]||''),registerHelper:()=>{},registerPartial:()=>{}}"],
4397
4397
  [/require\(['"]express-handlebars['"]\)/g, "{engine:()=>(p,o,cb)=>cb(null,'<html>'+JSON.stringify(o)+'</html>')}"],
@@ -4409,6 +4409,7 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
4409
4409
  [/require\(['"]cookie-parser['"]\)/g, "(()=>(r,s,n)=>{r.cookies=r.cookies||{};n()})"],
4410
4410
  [/require\(['"]passport['"]\)/g, "{initialize:()=>(r,s,n)=>n(),session:()=>(r,s,n)=>n(),authenticate:()=>(r,s,n)=>n&&n()}"],
4411
4411
  [/require\(['"]express-session['"]\)/g, "(()=>(r,s,n)=>{r.session=r.session||{};n()})"],
4412
+ [/require\(['"]connect-redis['"]\)/g, "(()=>{function RedisStore(){}; RedisStore.prototype.get=function(k,cb){cb&&cb(null,null);}; RedisStore.prototype.set=function(k,v,cb){cb&&cb();}; RedisStore.prototype.destroy=function(k,cb){cb&&cb();}; return RedisStore;})()"],
4412
4413
  [/require\(['"]connect-flash['"]\)/g, "(()=>(r,s,n)=>n())"],
4413
4414
  // Fix wrong relative paths the LLM generates
4414
4415
  [/require\(['"]\.\.\/middleware\/securityMiddleware['"]\)/g, "require('../middleware/security')"],
@@ -4595,6 +4596,29 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
4595
4596
  sendLog(' [server] ' + l);
4596
4597
  });
4597
4598
 
4599
+ // Helper: write sandbox log to skills/ dir (called on both success and error)
4600
+ const writeSandboxLog = (extraLines, isError) => {
4601
+ try {
4602
+ const _nl = '\n';
4603
+ const _now = new Date();
4604
+ const _pad = n => String(n).padStart(2,'0');
4605
+ const logTs = _now.getFullYear()+'-'+_pad(_now.getMonth()+1)+'-'+_pad(_now.getDate())+' '+_pad(_now.getHours())+':'+_pad(_now.getMinutes())+':'+_pad(_now.getSeconds());
4606
+ const logName = projName + '-latest.log';
4607
+ const logsDir = path.join(sandboxDir, 'skills');
4608
+ fs.mkdirSync(logsDir, { recursive: true });
4609
+ const oldLogs = fs.readdirSync(logsDir).filter(f => f.endsWith('.log') && f.startsWith(projName + '-') && f !== logName);
4610
+ oldLogs.forEach(f => { try { fs.unlinkSync(path.join(logsDir, f)); } catch(_) {} });
4611
+ const title = isError ? '# Sandbox Log — ' + projName + ' [ERRORE]' : '# Sandbox Log — ' + projName;
4612
+ const logContent = title + _nl + 'Avviato: ' + logTs + _nl + 'Porta: ' + freePort + _nl + _nl + _sbLogLines.join(_nl) + (extraLines ? _nl + _nl + extraLines : '');
4613
+ fs.writeFileSync(path.join(logsDir, logName), logContent, 'utf8');
4614
+ const idxPath = path.join(logsDir, '_index.json');
4615
+ let idx = {};
4616
+ try { idx = JSON.parse(fs.readFileSync(idxPath, 'utf8')); } catch(_) {}
4617
+ idx[logName] = 'log';
4618
+ fs.writeFileSync(idxPath, JSON.stringify(idx), 'utf8');
4619
+ } catch(_) {}
4620
+ };
4621
+
4598
4622
  // Wait for server to be ready (max 10s)
4599
4623
  await new Promise((resolve, reject) => {
4600
4624
  let attempts = 0;
@@ -4611,49 +4635,11 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
4611
4635
  });
4612
4636
 
4613
4637
  sendLog(`✅ Sandbox pronta!`);
4614
-
4615
- // Write sandbox log to skills/ so the agent can read it as context
4616
- // Always overwrite the same file (latest.log) — no accumulation across restarts
4617
- try {
4618
- const _nl = '\n';
4619
- const _now = new Date();
4620
- const _pad = n => String(n).padStart(2,'0');
4621
- const logTs = _now.getFullYear()+'-'+_pad(_now.getMonth()+1)+'-'+_pad(_now.getDate())+' '+_pad(_now.getHours())+':'+_pad(_now.getMinutes())+':'+_pad(_now.getSeconds());
4622
- const logName = projName + '-latest.log';
4623
- const logsDir = path.join(sandboxDir, 'skills');
4624
- fs.mkdirSync(logsDir, { recursive: true });
4625
- // Clean up old timestamped log files (migration from previous format)
4626
- const oldLogs = fs.readdirSync(logsDir).filter(f => f.endsWith('.log') && f.startsWith(projName + '-') && f !== logName);
4627
- oldLogs.forEach(f => { try { fs.unlinkSync(path.join(logsDir, f)); } catch(_) {} });
4628
- const logContent = '# Sandbox Log — ' + projName + _nl + 'Avviato: ' + logTs + _nl + 'Porta: ' + freePort + _nl + _nl + _sbLogLines.join(_nl);
4629
- fs.writeFileSync(path.join(logsDir, logName), logContent, 'utf8');
4630
- // Also update _index.json so the UI knows the type
4631
- const idxPath = path.join(logsDir, '_index.json');
4632
- let idx = {};
4633
- try { idx = JSON.parse(fs.readFileSync(idxPath, 'utf8')); } catch(_) {}
4634
- idx[logName] = 'log';
4635
- fs.writeFileSync(idxPath, JSON.stringify(idx), 'utf8');
4636
- } catch(_) {}
4638
+ writeSandboxLog(null, false);
4637
4639
 
4638
4640
  sendReady(freePort, sandboxDir);
4639
4641
  } catch (e) {
4640
- // Write error log too
4641
- try {
4642
- const _nl = '\n';
4643
- const _now2 = new Date();
4644
- const _pad2 = n => String(n).padStart(2,'0');
4645
- const logTs = _now2.getFullYear()+'-'+_pad2(_now2.getMonth()+1)+'-'+_pad2(_now2.getDate())+' '+_pad2(_now2.getHours())+':'+_pad2(_now2.getMinutes())+':'+_pad2(_now2.getSeconds());
4646
- const logName = projName + '-latest.log';
4647
- const logsDir = path.join(sandboxDir, 'skills');
4648
- fs.mkdirSync(logsDir, { recursive: true });
4649
- const logContent = '# Sandbox Log — ' + projName + ' [ERRORE]' + _nl + 'Avviato: ' + logTs + _nl + _nl + _sbLogLines.join(_nl) + _nl + _nl + '❌ ERRORE: ' + e.message;
4650
- fs.writeFileSync(path.join(logsDir, logName), logContent, 'utf8');
4651
- const idxPath = path.join(logsDir, '_index.json');
4652
- let idx = {};
4653
- try { idx = JSON.parse(fs.readFileSync(idxPath, 'utf8')); } catch(_) {}
4654
- idx[logName] = 'log';
4655
- fs.writeFileSync(idxPath, JSON.stringify(idx), 'utf8');
4656
- } catch(_) {}
4642
+ writeSandboxLog('❌ ERRORE: ' + e.message, true);
4657
4643
  sendError(e.message);
4658
4644
  }
4659
4645
  res.end();