nothumanallowed 13.5.97 → 13.5.98

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 +26 -41
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nothumanallowed",
3
- "version": "13.5.97",
3
+ "version": "13.5.98",
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>')}"],
@@ -4595,6 +4595,29 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
4595
4595
  sendLog(' [server] ' + l);
4596
4596
  });
4597
4597
 
4598
+ // Helper: write sandbox log to skills/ dir (called on both success and error)
4599
+ const writeSandboxLog = (extraLines, isError) => {
4600
+ try {
4601
+ const _nl = '\n';
4602
+ const _now = new Date();
4603
+ const _pad = n => String(n).padStart(2,'0');
4604
+ const logTs = _now.getFullYear()+'-'+_pad(_now.getMonth()+1)+'-'+_pad(_now.getDate())+' '+_pad(_now.getHours())+':'+_pad(_now.getMinutes())+':'+_pad(_now.getSeconds());
4605
+ const logName = projName + '-latest.log';
4606
+ const logsDir = path.join(sandboxDir, 'skills');
4607
+ fs.mkdirSync(logsDir, { recursive: true });
4608
+ const oldLogs = fs.readdirSync(logsDir).filter(f => f.endsWith('.log') && f.startsWith(projName + '-') && f !== logName);
4609
+ oldLogs.forEach(f => { try { fs.unlinkSync(path.join(logsDir, f)); } catch(_) {} });
4610
+ const title = isError ? '# Sandbox Log — ' + projName + ' [ERRORE]' : '# Sandbox Log — ' + projName;
4611
+ const logContent = title + _nl + 'Avviato: ' + logTs + _nl + 'Porta: ' + freePort + _nl + _nl + _sbLogLines.join(_nl) + (extraLines ? _nl + _nl + extraLines : '');
4612
+ fs.writeFileSync(path.join(logsDir, logName), logContent, 'utf8');
4613
+ const idxPath = path.join(logsDir, '_index.json');
4614
+ let idx = {};
4615
+ try { idx = JSON.parse(fs.readFileSync(idxPath, 'utf8')); } catch(_) {}
4616
+ idx[logName] = 'log';
4617
+ fs.writeFileSync(idxPath, JSON.stringify(idx), 'utf8');
4618
+ } catch(_) {}
4619
+ };
4620
+
4598
4621
  // Wait for server to be ready (max 10s)
4599
4622
  await new Promise((resolve, reject) => {
4600
4623
  let attempts = 0;
@@ -4611,49 +4634,11 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
4611
4634
  });
4612
4635
 
4613
4636
  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(_) {}
4637
+ writeSandboxLog(null, false);
4637
4638
 
4638
4639
  sendReady(freePort, sandboxDir);
4639
4640
  } 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(_) {}
4641
+ writeSandboxLog('❌ ERRORE: ' + e.message, true);
4657
4642
  sendError(e.message);
4658
4643
  }
4659
4644
  res.end();