nothumanallowed 13.5.173 → 13.5.175

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.173",
3
+ "version": "13.5.175",
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": {
@@ -649,24 +649,19 @@ export async function cmdUI(args) {
649
649
  if (code === 0) {
650
650
  wsBroadcast({ type: 'npm-update', line: '\n✅ Update complete! Restarting server...\n', done: true });
651
651
  setTimeout(async () => {
652
- // Self-restart: spawn the new nha binary with same args, then exit
653
- // Works on Windows/Mac/Linux without PM2
652
+ // Self-restart: launch new nha ui process, then exit current one
654
653
  try {
655
- const { execPath } = process;
656
- // Find the nha bin: look for it next to the current node executable
657
- // or use `nha` from PATH (npm -g installs it there)
654
+ const { exec: execCmd } = await import('child_process');
658
655
  const isWindows = process.platform === 'win32';
659
- const nhaCmd = isWindows ? 'nha.cmd' : 'nha';
660
- const restartArgs = ['ui', '--no-browser', ...(lanMode ? ['--lan'] : []), `--port=${port}`];
661
- const restartChild = spawn(nhaCmd, restartArgs, {
662
- detached: true,
663
- stdio: 'ignore',
664
- shell: isWindows,
665
- env: process.env,
666
- });
667
- restartChild.unref();
656
+ const extraArgs = (lanMode ? ' --lan' : '') + (port !== DEFAULT_PORT ? ` --port=${port}` : '');
657
+ if (isWindows) {
658
+ // start /B launches detached in background on Windows
659
+ execCmd(`start /B nha ui --no-browser${extraArgs}`, { shell: true });
660
+ } else {
661
+ execCmd(`nohup nha ui --no-browser${extraArgs} </dev/null >/dev/null 2>&1 &`);
662
+ }
668
663
  } catch (_) {}
669
- process.exit(0);
664
+ setTimeout(() => process.exit(0), 500);
670
665
  }, 1500);
671
666
  } else {
672
667
  wsBroadcast({ type: 'npm-update', line: '\n❌ Update failed (exit code ' + code + '). Check output above.\n', error: true });
@@ -2819,7 +2814,12 @@ export async function cmdUI(args) {
2819
2814
  const browserThumbs = res._browserThumbs || [];
2820
2815
  sendSSE('done', { content: finalResponse, screenshotFiles: ssFiles, browserThumbs, inlineHtml: inlineEmbeds || '' });
2821
2816
  } catch (e) {
2822
- sendSSE('error', { message: e.message });
2817
+ // SENTINEL blocked — send done with flag so client shows message but does NOT save to history
2818
+ if (e.__sentinel_blocked) {
2819
+ sendSSE('done', { content: e.message, __sentinel_blocked: true, screenshotFiles: [], browserThumbs: [], inlineHtml: '' });
2820
+ } else {
2821
+ sendSSE('error', { message: e.message });
2822
+ }
2823
2823
  }
2824
2824
 
2825
2825
  res.end();
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.173';
8
+ export const VERSION = '13.5.175';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -563,6 +563,14 @@ export async function callLLMStream(config, systemPrompt, userMessage, onToken,
563
563
  }
564
564
  // Non-streaming: vLLM returns complete text — no BPE subword splitting issues
565
565
  const nhaJson = await nhaRes.json();
566
+ // SENTINEL blocked — throw special error so caller skips conversation persistence
567
+ if (nhaJson.__sentinel_blocked) {
568
+ const blockedMsg = nhaJson.choices?.[0]?.message?.content || 'Message blocked by SENTINEL.';
569
+ if (onToken) onToken(blockedMsg);
570
+ const err = new Error(blockedMsg);
571
+ err.__sentinel_blocked = true;
572
+ throw err;
573
+ }
566
574
  let fullNhaText = nhaJson.choices?.[0]?.message?.content || '';
567
575
  // Strip <think>...</think> blocks
568
576
  fullNhaText = fullNhaText.replace(/<think>[\s\S]*?<\/think>/g, '').trim();
@@ -1036,7 +1036,7 @@ function sendChat(){
1036
1036
  if(data.markers.indexOf('[CANVAS_CLEAR]')!==-1)closeCanvas();
1037
1037
  }
1038
1038
  if(currentEvent==='tool_synthesis'){chatHistory[streamIdx].content='';renderMessages();}
1039
- if(currentEvent==='done'){endStreaming();if(data.content){chatHistory[streamIdx].content=data.content.replace(/<think>[\\s\\S]*?<\\/think>/g,'').trim();}else{chatHistory[streamIdx].content=chatHistory[streamIdx].content.replace(/<think>[\\s\\S]*?<\\/think>/g,'').trim();}var ssf=data.screenshotFiles||[];for(var fi=0;fi<ssf.length;fi++){chatHistory[streamIdx].content+='\\n![Screenshot](/api/screenshots/'+ssf[fi]+')\\n';}if(data.inlineHtml){chatHistory[streamIdx].inlineHtml=data.inlineHtml;}var bt=data.browserThumbs||[];if(bt.length>0){var cd=getConvCanvasData();for(var bti=0;bti<bt.length;bti++){var exists=cd.browsers.some(function(b){return b.file===bt[bti].file;});if(!exists)cd.browsers.push({file:bt[bti].file,url:bt[bti].url,ts:new Date().toLocaleTimeString()});}browserIdx=cd.browsers.length-1;saveCanvasData();}renderMessages();loadConvList();if(activeConvId){setTimeout(function(){loadConv(activeConvId);},500);}}
1039
+ if(currentEvent==='done'){endStreaming();if(data.__sentinel_blocked){chatHistory.splice(streamIdx-1,2);var sentinelWarn=data.content||'Message blocked by SENTINEL.';var el=document.getElementById('chatMessages');if(el){var warn=document.createElement('div');warn.className='msg msg--assistant';warn.style.cssText='border-left:3px solid #ff9800;margin:8px 0;opacity:0.85';warn.innerHTML='<div class="msg__label">SENTINEL</div><div class="msg__bubble md-body" style="color:#ff9800">'+esc(sentinelWarn)+'</div>';el.appendChild(warn);el.scrollTop=el.scrollHeight;}renderMessages();return;}if(data.content){chatHistory[streamIdx].content=data.content.replace(/<think>[\\s\\S]*?<\\/think>/g,'').trim();}else{chatHistory[streamIdx].content=chatHistory[streamIdx].content.replace(/<think>[\\s\\S]*?<\\/think>/g,'').trim();}var ssf=data.screenshotFiles||[];for(var fi=0;fi<ssf.length;fi++){chatHistory[streamIdx].content+='\\n![Screenshot](/api/screenshots/'+ssf[fi]+')\\n';}if(data.inlineHtml){chatHistory[streamIdx].inlineHtml=data.inlineHtml;}var bt=data.browserThumbs||[];if(bt.length>0){var cd=getConvCanvasData();for(var bti=0;bti<bt.length;bti++){var exists=cd.browsers.some(function(b){return b.file===bt[bti].file;});if(!exists)cd.browsers.push({file:bt[bti].file,url:bt[bti].url,ts:new Date().toLocaleTimeString()});}browserIdx=cd.browsers.length-1;saveCanvasData();}renderMessages();loadConvList();if(activeConvId){setTimeout(function(){loadConv(activeConvId);},500);}}
1040
1040
  if(currentEvent==='error'){endStreaming();chatHistory[streamIdx].content='Error: '+(data.message||'Unknown');renderMessages();}
1041
1041
  }catch(e){}
1042
1042
  }