nothumanallowed 13.5.48 โ†’ 13.5.50

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nothumanallowed",
3
- "version": "13.5.48",
3
+ "version": "13.5.50",
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": {
@@ -4115,7 +4115,47 @@ module.exports = { get, set, del, exists };
4115
4115
  fs.mkdirSync(path.join(sandboxDir, 'server', 'services'), { recursive: true });
4116
4116
  fs.writeFileSync(path.join(sandboxDir, 'server', 'services', 'cache.js'), cacheShim, 'utf8');
4117
4117
 
4118
- sendLog('๐Ÿ”ง Shim iniettati: DB (in-memory), Sentinel WAF, Cache');
4118
+ // Patch all generated JS files: fix known wrong require() names
4119
+ // The LLM often uses 'bcrypt' instead of 'bcryptjs', 'pg' instead of nothing, etc.
4120
+ const requireFixes = [
4121
+ [/require\(['"]bcrypt['"]\)/g, "require('bcryptjs')"],
4122
+ [/require\(['"]node-postgres['"]\)/g, "require('./db')"],
4123
+ [/require\(['"]pg['"]\)/g, "require('./db')"],
4124
+ [/require\(['"]ioredis['"]\)/g, "require('../services/cache')"],
4125
+ [/require\(['"]redis['"]\)/g, "require('../services/cache')"],
4126
+ [/require\(['"]ip['"]\)/g, "({address:()=>'127.0.0.1',toLong:()=>0})"],
4127
+ [/require\(['"]express-async-errors['"]\)/g, "{}"],
4128
+ [/require\(['"]multer['"]\)/g, "({single:()=>(r,s,n)=>n(),array:()=>(r,s,n)=>n(),memoryStorage:()=>({})})"],
4129
+ [/require\(['"]sharp['"]\)/g, "({})"],
4130
+ [/require\(['"]uuid['"]\)/g, "{v4:()=>Math.random().toString(36).slice(2)}"],
4131
+ [/require\(['"]nanoid['"]\)/g, "{nanoid:()=>Math.random().toString(36).slice(2)}"],
4132
+ [/require\(['"]joi['"]\)/g, "{object:()=>({keys:()=>({validate:()=>({error:null})})})}"],
4133
+ [/require\(['"]zod['"]\)/g, "{z:{object:()=>({parse:(x)=>x}),string:()=>({min:()=>({max:()=>({email:()=>({optional:()=>({})})})})})}"],
4134
+ [/require\(['"]winston['"]\)/g, "{createLogger:()=>({info:()=>{},error:()=>{},warn:()=>{}}),transports:{Console:function(){}},format:{combine:()=>{},timestamp:()=>{},json:()=>{}}}"],
4135
+ [/require\(['"]morgan['"]\)/g, "(()=>(r,s,n)=>n())"],
4136
+ [/require\(['"]compression['"]\)/g, "(()=>(r,s,n)=>n())"],
4137
+ [/require\(['"]cookie-parser['"]\)/g, "(()=>(r,s,n)=>{r.cookies=r.cookies||{};n()})"],
4138
+ [/require\(['"]passport['"]\)/g, "{initialize:()=>(r,s,n)=>n(),session:()=>(r,s,n)=>n(),authenticate:()=>(r,s,n)=>n&&n()}"],
4139
+ [/require\(['"]express-session['"]\)/g, "(()=>(r,s,n)=>{r.session=r.session||{};n()})"],
4140
+ [/require\(['"]connect-flash['"]\)/g, "(()=>(r,s,n)=>n())"],
4141
+ ];
4142
+ function patchJsFiles(dir) {
4143
+ if (!fs.existsSync(dir)) return;
4144
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
4145
+ const full = path.join(dir, entry.name);
4146
+ if (entry.isDirectory()) { patchJsFiles(full); continue; }
4147
+ if (!entry.name.endsWith('.js')) continue;
4148
+ let src = fs.readFileSync(full, 'utf8');
4149
+ let changed = false;
4150
+ for (const [pat, rep] of requireFixes) {
4151
+ const next = src.replace(pat, rep);
4152
+ if (next !== src) { src = next; changed = true; }
4153
+ }
4154
+ if (changed) fs.writeFileSync(full, src, 'utf8');
4155
+ }
4156
+ }
4157
+ patchJsFiles(path.join(sandboxDir, 'server'));
4158
+ sendLog('๐Ÿ”ง Shim iniettati: DB (in-memory), Sentinel WAF, Cache โ€” require() patchati');
4119
4159
 
4120
4160
  // Patch package.json to remove pg, add only what's needed
4121
4161
  const pkgPath = path.join(sandboxDir, 'package.json');
@@ -4198,7 +4238,20 @@ module.exports = { get, set, del, exists };
4198
4238
  global._wcSandboxDir = sandboxDir;
4199
4239
 
4200
4240
  proc.stdout.on('data', d => { const l = d.toString().trim(); if (l) sendLog(' [server] ' + l); });
4201
- proc.stderr.on('data', d => { const l = d.toString().trim(); if (l) sendLog(' [server] ' + l); });
4241
+ proc.stderr.on('data', d => {
4242
+ const raw = d.toString();
4243
+ // Extract meaningful error: MODULE_NOT_FOUND
4244
+ const modMatch = raw.match(/Cannot find module '([^']+)'/);
4245
+ if (modMatch) {
4246
+ sendLog(' โŒ Modulo mancante: ' + modMatch[1]);
4247
+ sendLog(' โ†’ Questo modulo non รจ supportato in sandbox. Contatta il supporto NHA.');
4248
+ return;
4249
+ }
4250
+ // Skip node internals noise
4251
+ const l = raw.trim();
4252
+ if (!l || l.startsWith('at ') || l.startsWith('(node:') || l === '^') return;
4253
+ sendLog(' [server] ' + l);
4254
+ });
4202
4255
 
4203
4256
  // Wait for server to be ready (max 10s)
4204
4257
  await new Promise((resolve, reject) => {
package/src/constants.mjs CHANGED
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'url';
5
5
  const __filename = fileURLToPath(import.meta.url);
6
6
  const __dirname = path.dirname(__filename);
7
7
 
8
- export const VERSION = '13.5.48';
8
+ export const VERSION = '13.5.50';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -6245,6 +6245,7 @@ var wcState = {
6245
6245
  var wcRightTab = 'files';
6246
6246
  var wcMainTab = 'new'; // 'new' | 'projects'
6247
6247
  var wcProjectsList = []; // cached list from server
6248
+ var wcSandboxExpanded = {}; // { phaseKey: true/false }
6248
6249
 
6249
6250
  function wcEsc(s){return s?String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;'):''}
6250
6251
 
@@ -6375,6 +6376,8 @@ function wcPickExample(i) {
6375
6376
  function wcTabFiles() { wcRightTab = 'files'; renderWebCraft(document.getElementById('content')); }
6376
6377
  function wcTabPreview() { wcRightTab = 'preview'; renderWebCraft(document.getElementById('content')); }
6377
6378
  function wcOpenSandbox() { if (wcState.sandbox.port) window.open('http://127.0.0.1:' + wcState.sandbox.port, '_blank'); }
6379
+ var _wcPhaseKeys = ['files','shims','pkg','env','deps','install','start'];
6380
+ function wcTogglePhase(idx) { var k = _wcPhaseKeys[idx]; if (k) { wcSandboxExpanded[k] = !wcSandboxExpanded[k]; renderWebCraft(document.getElementById('content')); } }
6378
6381
 
6379
6382
  function wcMainTabNew() { wcMainTab = 'new'; renderWebCraft(document.getElementById('content')); }
6380
6383
  function wcMainTabProjects() {
@@ -6640,30 +6643,49 @@ function wcSandboxPanelHtml() {
6640
6643
  var statusColor = { done:'var(--green)', active:'var(--amber)', pending:'var(--dim)', error:'var(--red)' };
6641
6644
  var statusIcon = { done:'&#10003;', active:'&#9203;', pending:'&#9675;', error:'&#10060;' };
6642
6645
 
6643
- var phasesHtml = phases.map(function(ph){
6646
+ var phasesHtml = phases.map(function(ph, phi){
6644
6647
  var st = phaseStatus(ph.key);
6645
6648
  var lines = byPhase[ph.key] || [];
6646
- // Filter noise: skip npm audit/funding lines
6647
6649
  var clean = lines.filter(function(l){ return l.indexOf('npm fund') === -1 && l.indexOf('run ') === -1 && l.indexOf('npm audit') === -1; });
6648
- // Collapse file list: show count instead of every file
6649
- var detail = '';
6650
- if (ph.key === 'files' && clean.length > 2) {
6651
- var count = clean.filter(function(l){ return l.indexOf('โœ“') !== -1; }).length;
6652
- detail = count ? '<div style="font-size:10px;color:var(--dim);margin-top:2px">'+count+' file scritti</div>' : '';
6653
- } else if (ph.key === 'deps' && clean.length > 2) {
6654
- var depCount = clean.filter(function(l){ return l.indexOf('โ€ข') !== -1; }).length;
6655
- detail = depCount ? '<div style="font-size:10px;color:var(--dim);margin-top:2px">'+depCount+' dipendenze</div>' : '';
6650
+ var isOpen = !!wcSandboxExpanded[ph.key];
6651
+ var hasContent = clean.length > 0;
6652
+
6653
+ // Summary line (always visible)
6654
+ var summary = '';
6655
+ if (ph.key === 'files') {
6656
+ var cnt = clean.filter(function(l){ return l.indexOf('โœ“') !== -1; }).length;
6657
+ summary = cnt ? cnt + ' file scritti' : '';
6658
+ } else if (ph.key === 'deps') {
6659
+ var dcnt = clean.filter(function(l){ return l.indexOf('โ€ข') !== -1; }).length;
6660
+ summary = dcnt ? dcnt + ' dipendenze' : '';
6656
6661
  } else if (clean.length > 0) {
6657
- var shown = clean.filter(function(l){ return l.trim() && l.indexOf('Percorso:') === -1; }).slice(-2);
6658
- detail = shown.map(function(l){ return '<div style="font-size:10px;font-family:var(--mono);color:var(--dim);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">'+wcEsc(l.trim())+'</div>'; }).join('');
6662
+ var last = clean.filter(function(l){ return l.trim(); }).slice(-1)[0] || '';
6663
+ summary = wcEsc(last.trim().slice(0, 60));
6659
6664
  }
6660
- return '<div style="display:flex;gap:10px;align-items:flex-start;padding:8px 12px;border-bottom:1px solid var(--border)">' +
6661
- '<span style="font-size:13px;flex-shrink:0">'+ph.icon+'</span>' +
6662
- '<div style="flex:1;min-width:0">' +
6663
- '<div style="font-size:11px;font-weight:600;color:'+(st==='pending'?'var(--dim)':'var(--text)')+'">'+ph.label+'</div>' +
6664
- detail +
6665
+
6666
+ // Expanded detail โ€” all lines
6667
+ var expandedHtml = '';
6668
+ if (isOpen && hasContent) {
6669
+ expandedHtml = '<div style="margin-top:6px;padding:8px;background:var(--bg);border-radius:6px;max-height:180px;overflow-y:auto">' +
6670
+ clean.map(function(l){
6671
+ var col = l.indexOf('โŒ') !== -1 || l.indexOf('Error') !== -1 ? 'var(--red)' : l.indexOf('โœ“') !== -1 || l.indexOf('โœ…') !== -1 ? 'var(--green)' : 'var(--dim)';
6672
+ return '<div style="font-size:10px;font-family:var(--mono);color:'+col+';line-height:1.6;white-space:pre-wrap;word-break:break-all">'+wcEsc(l)+'</div>';
6673
+ }).join('') +
6674
+ '</div>';
6675
+ }
6676
+
6677
+ var clickable = hasContent && st !== 'pending';
6678
+ return '<div style="border-bottom:1px solid var(--border)">' +
6679
+ '<div onclick="'+(clickable?'wcTogglePhase('+phi+')':'')+'" style="display:flex;gap:10px;align-items:center;padding:9px 12px;cursor:'+(clickable?'pointer':'default')+'">' +
6680
+ '<span style="font-size:13px;flex-shrink:0">'+ph.icon+'</span>' +
6681
+ '<div style="flex:1;min-width:0">' +
6682
+ '<div style="font-size:11px;font-weight:600;color:'+(st==='pending'?'var(--dim)':'var(--text)')+'">'+ph.label+'</div>' +
6683
+ (summary && !isOpen ? '<div style="font-size:10px;color:var(--dim);margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">'+summary+'</div>' : '') +
6684
+ '</div>' +
6685
+ (clickable ? '<span style="font-size:10px;color:var(--dim);flex-shrink:0">'+(isOpen?'&#9650;':'&#9660;')+'</span>' : '') +
6686
+ '<span style="font-size:13px;color:'+statusColor[st]+';flex-shrink:0;margin-left:4px">'+statusIcon[st]+'</span>' +
6665
6687
  '</div>' +
6666
- '<span style="font-size:13px;color:'+statusColor[st]+';flex-shrink:0">'+statusIcon[st]+'</span>' +
6688
+ (isOpen ? '<div style="padding:0 12px 10px">' + expandedHtml + '</div>' : '') +
6667
6689
  '</div>';
6668
6690
  }).join('');
6669
6691