nothumanallowed 13.5.77 → 13.5.79

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.77",
3
+ "version": "13.5.79",
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": {
@@ -4606,17 +4606,18 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
4606
4606
  sendLog(`✅ Sandbox pronta!`);
4607
4607
 
4608
4608
  // Write sandbox log to skills/ so the agent can read it as context
4609
+ // Always overwrite the same file (latest.log) — no accumulation across restarts
4609
4610
  try {
4610
4611
  const _nl = '\n';
4611
4612
  const _now = new Date();
4612
4613
  const _pad = n => String(n).padStart(2,'0');
4613
4614
  const logTs = _now.getFullYear()+'-'+_pad(_now.getMonth()+1)+'-'+_pad(_now.getDate())+' '+_pad(_now.getHours())+':'+_pad(_now.getMinutes())+':'+_pad(_now.getSeconds());
4614
- const logName = projName + '-' + logTs.replace(/[: ]/g, '-') + '.log';
4615
+ const logName = projName + '-latest.log';
4615
4616
  const logsDir = path.join(sandboxDir, 'skills');
4616
4617
  fs.mkdirSync(logsDir, { recursive: true });
4617
- // Keep only last 3 log files to avoid bloat
4618
- const existing = fs.readdirSync(logsDir).filter(f => f.endsWith('.log') && f.startsWith(projName + '-'));
4619
- existing.sort().slice(0, -2).forEach(f => { try { fs.unlinkSync(path.join(logsDir, f)); } catch(_) {} });
4618
+ // Clean up old timestamped log files (migration from previous format)
4619
+ const oldLogs = fs.readdirSync(logsDir).filter(f => f.endsWith('.log') && f.startsWith(projName + '-') && f !== logName);
4620
+ oldLogs.forEach(f => { try { fs.unlinkSync(path.join(logsDir, f)); } catch(_) {} });
4620
4621
  const logContent = '# Sandbox Log — ' + projName + _nl + 'Avviato: ' + logTs + _nl + 'Porta: ' + freePort + _nl + _nl + _sbLogLines.join(_nl);
4621
4622
  fs.writeFileSync(path.join(logsDir, logName), logContent, 'utf8');
4622
4623
  // Also update _index.json so the UI knows the type
@@ -4635,7 +4636,7 @@ module.exports = { validateEmail, sanitizeText, validatePassword, validateUserna
4635
4636
  const _now2 = new Date();
4636
4637
  const _pad2 = n => String(n).padStart(2,'0');
4637
4638
  const logTs = _now2.getFullYear()+'-'+_pad2(_now2.getMonth()+1)+'-'+_pad2(_now2.getDate())+' '+_pad2(_now2.getHours())+':'+_pad2(_now2.getMinutes())+':'+_pad2(_now2.getSeconds());
4638
- const logName = projName + '-' + logTs.replace(/[: ]/g, '-') + '-ERROR.log';
4639
+ const logName = projName + '-latest.log';
4639
4640
  const logsDir = path.join(sandboxDir, 'skills');
4640
4641
  fs.mkdirSync(logsDir, { recursive: true });
4641
4642
  const logContent = '# Sandbox Log — ' + projName + ' [ERRORE]' + _nl + 'Avviato: ' + logTs + _nl + _nl + _sbLogLines.join(_nl) + _nl + _nl + '❌ ERRORE: ' + e.message;
@@ -6568,14 +6568,19 @@ function renderWebCraft(el) {
6568
6568
  ? '<div id="wcFileTabsRow" style="display:flex;gap:0;overflow-x:auto;border-bottom:1px solid var(--border);margin-bottom:0;flex-shrink:0;scrollbar-width:none">' +
6569
6569
  wcState.generatedFiles.map(function(f,i){
6570
6570
  var active = i === wcState.activeFile;
6571
- return '<button id="wcTab'+i+'" onclick="wcSetFile('+i+')" style="padding:6px 14px;font-size:11px;font-family:var(--mono);font-weight:'+(active?'700':'400')+';background:'+(active?'var(--bg3)':'transparent')+';border:none;border-bottom:2px solid '+(active?'var(--green3)':'transparent')+';color:'+(active?'var(--green)':'var(--dim)')+';cursor:pointer;white-space:nowrap;flex-shrink:0">'+wcEsc(f.name)+'</button>';
6571
+ var hasErr = !!f._error;
6572
+ var tabColor = hasErr ? (active ? '#f87171' : '#7f4040') : (active ? 'var(--green)' : 'var(--dim)');
6573
+ var tabBorder = hasErr ? (active ? '#f87171' : 'transparent') : (active ? 'var(--green3)' : 'transparent');
6574
+ return '<button id="wcTab'+i+'" onclick="wcSetFile('+i+')" style="padding:6px 14px;font-size:11px;font-family:var(--mono);font-weight:'+(active?'700':'400')+';background:'+(active?'var(--bg3)':'transparent')+';border:none;border-bottom:2px solid '+tabBorder+';color:'+tabColor+';cursor:pointer;white-space:nowrap;flex-shrink:0">'+(hasErr?'&#9888; ':'')+wcEsc(f.name)+'</button>';
6572
6575
  }).join('') +
6573
6576
  '</div>'
6574
6577
  : '';
6575
6578
 
6576
- var codeHtml = wcState.generatedFiles.length > 0 && wcState.generatedFiles[wcState.activeFile]
6579
+ var _activeFile = wcState.generatedFiles[wcState.activeFile];
6580
+ var codeHtml = wcState.generatedFiles.length > 0 && _activeFile
6577
6581
  ? '<div id="wcCodeWrap" style="flex:1;overflow:auto;background:var(--bg3);border-radius:0 0 8px 8px">' +
6578
- '<pre style="margin:0;padding:14px 16px;font-size:11px;line-height:1.6;color:var(--text);font-family:var(--mono);white-space:pre-wrap;word-break:break-all">'+wcEsc(wcState.generatedFiles[wcState.activeFile].content)+'</pre>' +
6582
+ (_activeFile._error ? '<div style="padding:8px 14px;background:rgba(239,68,68,0.12);border-bottom:1px solid rgba(239,68,68,0.3);font-size:11px;color:#f87171;display:flex;align-items:center;gap:6px">&#9888; Generazione fallita — chiedi al modello di rigenerare questo file</div>' : '') +
6583
+ '<pre style="margin:0;padding:14px 16px;font-size:11px;line-height:1.6;color:'+(_activeFile._error?'#f87171':'var(--text)')+';font-family:var(--mono);white-space:pre-wrap;word-break:break-all">'+wcEsc(_activeFile.content)+'</pre>' +
6579
6584
  '</div>'
6580
6585
  : '<div style="flex:1;display:flex;align-items:center;justify-content:center;color:var(--dim);font-size:12px;flex-direction:column;gap:8px">' +
6581
6586
  '<span style="font-size:36px;opacity:.25">&#128736;</span>' +
@@ -7882,31 +7887,61 @@ async function wcGenerate() {
7882
7887
  '<div style="display:flex;gap:4px;margin-top:10px">'+[0,1,2,3,4].map(function(_,idx){ return '<div style="width:6px;height:6px;border-radius:50%;background:var(--green);animation:wcDot 1.1s ease-in-out infinite '+(idx*0.14)+'s"></div>'; }).join('')+'</div>';
7883
7888
  }
7884
7889
 
7890
+ // Helper: generate one file, returns {ok, content} or {ok:false, err}
7891
+ async function wcGenOneFile(fp, signal) {
7892
+ var _nl2 = String.fromCharCode(10);
7893
+ var content = await wcCallLLM(sysPreamble, fp.prompt + _nl2 + _nl2 + 'File to generate: ' + fp.name, signal);
7894
+ var _fence = String.fromCharCode(96,96,96);
7895
+ var wcLines = content.split(_nl2);
7896
+ if (wcLines.length > 0 && wcLines[0].indexOf(_fence) === 0) wcLines.shift();
7897
+ if (wcLines.length > 0 && wcLines[wcLines.length-1].trim() === _fence) wcLines.pop();
7898
+ return wcLines.join(_nl2).trim();
7899
+ }
7900
+
7885
7901
  for (var fi = 0; fi < filePlan.length; fi++) {
7886
7902
  var fp = filePlan[fi];
7887
7903
  wcUpdateGenOverlay(fi, filePlan.length, fp.name);
7888
- // Check if aborted
7889
7904
  if (_wcGenAbortCtrl && _wcGenAbortCtrl.signal.aborted) break;
7890
7905
  try {
7891
- var _nl2 = String.fromCharCode(10);
7892
- var content = await wcCallLLM(sysPreamble, fp.prompt + _nl2 + _nl2 + 'File to generate: ' + fp.name, _wcGenAbortCtrl ? _wcGenAbortCtrl.signal : null);
7893
- // Strip markdown code fences if model added them anyway
7894
- var _fence = String.fromCharCode(96,96,96);
7895
- var wcLines = content.split(_nl2);
7896
- if (wcLines.length > 0 && wcLines[0].indexOf(_fence) === 0) wcLines.shift();
7897
- if (wcLines.length > 0 && wcLines[wcLines.length-1].trim() === _fence) wcLines.pop();
7898
- content = wcLines.join(_nl2).trim();
7906
+ var content = await wcGenOneFile(fp, _wcGenAbortCtrl ? _wcGenAbortCtrl.signal : null);
7899
7907
  wcState.generatedFiles.push({ name: fp.name, content: content, lang: fp.lang });
7900
7908
  if (fi === 0) wcState.activeFile = 0;
7901
7909
  renderWebCraft(document.getElementById('content'));
7902
7910
  } catch(e) {
7903
7911
  if (e && e.name === 'AbortError') break;
7904
- wcState.generatedFiles.push({ name: fp.name, content: '// Error generating this file: ' + (e.message || 'unknown error'), lang: fp.lang });
7912
+ wcState.generatedFiles.push({ name: fp.name, content: '// Error generating this file: ' + (e.message || 'unknown error'), lang: fp.lang, _error: true });
7905
7913
  if (fi === 0) wcState.activeFile = 0;
7906
7914
  renderWebCraft(document.getElementById('content'));
7907
7915
  }
7908
7916
  }
7909
7917
 
7918
+ // ── Retry pass: regenerate files that failed ──────────────────────────────
7919
+ var failedFiles = wcState.generatedFiles.filter(function(f){ return f._error; });
7920
+ if (failedFiles.length > 0 && !(_wcGenAbortCtrl && _wcGenAbortCtrl.signal.aborted)) {
7921
+ var retryPlan = filePlan.filter(function(fp){ return failedFiles.some(function(f){ return f.name === fp.name; }); });
7922
+ for (var ri = 0; ri < retryPlan.length; ri++) {
7923
+ var rfp = retryPlan[ri];
7924
+ wcUpdateGenOverlay(ri, retryPlan.length, 'Retry: ' + rfp.name);
7925
+ if (_wcGenAbortCtrl && _wcGenAbortCtrl.signal.aborted) break;
7926
+ // Wait 3s before retry to let Liara recover
7927
+ await new Promise(function(resolve){ setTimeout(resolve, 3000); });
7928
+ try {
7929
+ var retryContent = await wcGenOneFile(rfp, _wcGenAbortCtrl ? _wcGenAbortCtrl.signal : null);
7930
+ // Replace the error entry with the successful one
7931
+ for (var gi = 0; gi < wcState.generatedFiles.length; gi++) {
7932
+ if (wcState.generatedFiles[gi].name === rfp.name) {
7933
+ wcState.generatedFiles[gi] = { name: rfp.name, content: retryContent, lang: rfp.lang };
7934
+ break;
7935
+ }
7936
+ }
7937
+ renderWebCraft(document.getElementById('content'));
7938
+ } catch(re) {
7939
+ if (re && re.name === 'AbortError') break;
7940
+ // Keep as error — already in generatedFiles
7941
+ }
7942
+ }
7943
+ }
7944
+
7910
7945
  wcState.running = false;
7911
7946
  _wcGenAbortCtrl = null;
7912
7947
  _wcOverlayMinimized = false;
@@ -8095,7 +8130,7 @@ async function wcStartSandbox() {
8095
8130
  headers: {'Content-Type':'application/json'},
8096
8131
  body: JSON.stringify({
8097
8132
  projectName: wcState.projectName || 'webcraft-sandbox',
8098
- files: wcState.generatedFiles
8133
+ files: wcState.generatedFiles.filter(function(f){ return !f._error; })
8099
8134
  })
8100
8135
  });
8101
8136
  if (!r.ok || !r.body) throw new Error('Sandbox error ' + r.status);