nothumanallowed 11.5.1 → 11.5.3

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": "11.5.1",
3
+ "version": "11.5.3",
4
4
  "description": "NotHumanAllowed — 38 AI agents, 53 tools. Email, calendar, browser automation, screen capture, canvas, cron/heartbeat, GitHub, Notion, Slack, voice chat, 28 languages. Zero-dependency CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -496,7 +496,7 @@ export async function cmdUI(args) {
496
496
  connected: true,
497
497
  version: VERSION,
498
498
  provider: config.llm.provider,
499
- hasApiKey: !!config.llm.apiKey,
499
+ hasApiKey: !!config.llm.apiKey || config.llm.provider === 'nha',
500
500
  hasGoogle: !!config.google?.clientId,
501
501
  hasMicrosoft: !!config.microsoft?.clientId,
502
502
  mailProvider: detectMailProvider(config),
@@ -535,7 +535,7 @@ export async function cmdUI(args) {
535
535
  profile: config.profile || {},
536
536
  provider: config.llm?.provider || '',
537
537
  model: config.llm?.model || '',
538
- hasApiKey: !!config.llm?.apiKey,
538
+ hasApiKey: !!config.llm?.apiKey || config.llm?.provider === 'nha',
539
539
  planTime: config.ops?.planTime || '07:00',
540
540
  summaryTime: config.ops?.summaryTime || '18:00',
541
541
  meetingAlert: config.ops?.meetingAlertMinutes || 30,
@@ -1087,10 +1087,8 @@ export async function cmdUI(args) {
1087
1087
  }
1088
1088
  }
1089
1089
 
1090
- if (!config.llm.apiKey) {
1091
- if (config.llm.provider !== 'nha') {
1092
- sendJSON(res, 200, { response: 'No API key configured. Run: nha config set key YOUR_KEY\nOr use NHA Free (no key needed): nha config set provider nha', error: 'no_api_key' });
1093
- }
1090
+ if (!config.llm.apiKey && config.llm.provider !== 'nha') {
1091
+ sendJSON(res, 200, { response: 'No API key configured. Run: nha config set key YOUR_KEY\nOr use NHA Free (no key needed): nha config set provider nha', error: 'no_api_key' });
1094
1092
  logRequest(method, pathname, 200, Date.now() - start);
1095
1093
  return;
1096
1094
  }
@@ -1916,7 +1914,7 @@ export async function cmdUI(args) {
1916
1914
  return;
1917
1915
  }
1918
1916
 
1919
- if (!config.llm.apiKey) {
1917
+ if (!config.llm.apiKey && config.llm.provider !== 'nha') {
1920
1918
  sendJSON(res, 200, { response: null, error: 'No API key configured.' });
1921
1919
  logRequest(method, pathname, 200, Date.now() - start);
1922
1920
  return;
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 = '11.5.1';
8
+ export const VERSION = '11.5.3';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -418,7 +418,7 @@ function renderChat(el){
418
418
  '</div>'+
419
419
  '<div class="chat"><div class="chat__messages" id="chatMessages"></div>'+
420
420
  '<div id="chatAttachInfo" style="display:none;padding:4px 12px;font-size:11px;color:var(--cyan);background:var(--bg2);border-top:1px solid var(--border)"><span id="chatAttachName"></span> <button onclick="clearChatAttach()" style="background:none;border:none;color:#f44;cursor:pointer;font-size:14px;font-weight:700">&times;</button></div>'+
421
- '<div class="chat__bar"><button class="chat__mic" id="chatMic" onclick="toggleVoiceInput()" title="Voice input">&#127908;</button><button onclick="document.getElementById(\\x27chatFileInput\\x27).click()" style="background:none;border:none;cursor:pointer;font-size:16px;padding:4px" title="Attach file">&#128206;</button><button onclick="document.getElementById(\\x27chatImageInput\\x27).click()" style="background:none;border:none;cursor:pointer;font-size:16px;padding:4px" title="Attach image">&#128247;</button><input type="file" id="chatFileInput" style="display:none" onchange="handleChatFile(this)"><input type="file" id="chatImageInput" accept="image/*" style="display:none" onchange="handleChatImage(this)"><textarea class="chat__input" id="chatInput" placeholder="Ask anything... (or attach file/image first)" rows="1"></textarea><button class="chat__send" id="chatSend">Send</button><button class="chat__stop" id="chatStop" onclick="stopChat()">Stop</button><button onclick="reopenCanvas()" style="background:none;border:1px solid var(--border2);border-radius:6px;cursor:pointer;font-size:11px;padding:4px 8px;color:var(--dim);font-family:var(--mono);display:flex;align-items:center;gap:4px" title="Open Canvas / Browser panel"><span style="font-size:13px">&#x25A3;</span>Panel</button></div>'+
421
+ '<div class="chat__bar"><button class="chat__mic" id="chatMic" onclick="toggleVoiceInput()" title="Voice input">&#127908;</button><button onclick="document.getElementById(\\x27chatFileInput\\x27).click()" style="background:none;border:none;cursor:pointer;font-size:16px;padding:4px" title="Attach file">&#128206;</button><button onclick="document.getElementById(\\x27chatImageInput\\x27).click()" style="background:none;border:none;cursor:pointer;font-size:16px;padding:4px" title="Attach image">&#128247;</button><input type="file" id="chatFileInput" style="display:none" onchange="handleChatFile(this)"><input type="file" id="chatImageInput" accept="image/*" style="display:none" onchange="handleChatImage(this)"><textarea class="chat__input" id="chatInput" placeholder="Ask anything... (or attach file/image first)" rows="1"></textarea><button class="chat__send" id="chatSend">Send</button><button class="chat__stop" id="chatStop" onclick="stopChat()">Stop</button><button onclick="reopenCanvas()" style="background:none;border:1px solid var(--border2);border-radius:6px;cursor:pointer;font-size:11px;padding:4px 8px;color:var(--dim);font-family:var(--mono);display:flex;align-items:center;gap:4px" title="Open Canvas / Browser panel"><span style="font-size:13px">&#x25A3;</span>Panel</button><button id="thinkingToggle" onclick="toggleThinking()" style="background:none;border:1px solid var(--border2);border-radius:6px;cursor:pointer;font-size:10px;padding:4px 8px;color:var(--dim);font-family:var(--mono)" title="Toggle Extended Thinking (NHA Free only)">Think: off</button></div>'+
422
422
  '</div>'+
423
423
  '</div>'+
424
424
  '</div>';
@@ -766,6 +766,25 @@ function navigateFork(nodeId,dir){
766
766
  if(r&&r.ok&&r.messages){chatHistory=r.messages;renderMessages();}
767
767
  });
768
768
  }
769
+ var thinkingEnabled=false;
770
+ function toggleThinking(){
771
+ thinkingEnabled=!thinkingEnabled;
772
+ apiPost('/api/config',{key:'thinking',value:thinkingEnabled?'on':'off'}).catch(function(){});
773
+ var btn=document.getElementById('thinkingToggle');
774
+ if(btn){
775
+ btn.textContent='Think: '+(thinkingEnabled?'on':'off');
776
+ btn.style.color=thinkingEnabled?'var(--amber)':'var(--dim)';
777
+ btn.style.borderColor=thinkingEnabled?'var(--amber3)':'var(--border2)';
778
+ }
779
+ }
780
+ // Init thinking state from config
781
+ apiGet('/api/config').then(function(r){
782
+ if(r&&(r.thinking===true||r.thinking==='on'||r.thinking==='true')){
783
+ thinkingEnabled=true;
784
+ var btn=document.getElementById('thinkingToggle');
785
+ if(btn){btn.textContent='Think: on';btn.style.color='var(--amber)';btn.style.borderColor='var(--amber3)';}
786
+ }
787
+ }).catch(function(){});
769
788
  function sendChat(){
770
789
  var inp=document.getElementById('chatInput');if(!inp)return;
771
790
  var msg=inp.value.trim();
@@ -840,8 +859,16 @@ function sendChat(){
840
859
  var data=JSON.parse(line.slice(6));
841
860
  if(currentEvent==='token'&&data.content){
842
861
  chatHistory[streamIdx].content+=data.content;
862
+ // Strip <think>...</think> for display, show indicator
863
+ var displayContent=chatHistory[streamIdx].content;
864
+ var isThinking=displayContent.indexOf('<think>')!==-1&&displayContent.indexOf('</think>')===-1;
865
+ if(isThinking){
866
+ displayContent='\\u{1F4AD} Thinking...';
867
+ } else {
868
+ displayContent=displayContent.replace(/<think>[\\s\\S]*?<\\/think>/g,'').trim();
869
+ }
843
870
  var el=document.getElementById('chatMessages');
844
- if(el){var msgs=el.querySelectorAll('.msg');var last=msgs[msgs.length-1];if(last){var bub=last.querySelector('.msg__bubble');if(bub)bub.textContent=chatHistory[streamIdx].content;}el.scrollTop=el.scrollHeight;}
871
+ if(el){var msgs=el.querySelectorAll('.msg');var last=msgs[msgs.length-1];if(last){var bub=last.querySelector('.msg__bubble');if(bub)bub.textContent=displayContent||'Thinking...';}el.scrollTop=el.scrollHeight;}
845
872
  }
846
873
  if(currentEvent==='tool'){
847
874
  var toolLabels={browser_open:'Opening page',browser_screenshot:'Taking screenshot',browser_click:'Clicking element',browser_type:'Typing text',browser_extract:'Extracting content',browser_js:'Running JavaScript',browser_wait:'Waiting for element',browser_scroll:'Scrolling page',browser_key:'Pressing key',browser_close:'Closing browser',web_search:'Searching the web',fetch_url:'Fetching URL',gmail_list:'Searching emails',gmail_read:'Reading email',gmail_send:'Sending email',calendar_today:'Loading calendar',calendar_create:'Creating event'};
@@ -876,7 +903,7 @@ function sendChat(){
876
903
  if(data.markers.indexOf('[CANVAS_CLEAR]')!==-1)closeCanvas();
877
904
  }
878
905
  if(currentEvent==='tool_synthesis'){chatHistory[streamIdx].content='';renderMessages();}
879
- if(currentEvent==='done'){endStreaming();if(data.content)chatHistory[streamIdx].content=data.content;var ssf=data.screenshotFiles||[];for(var fi=0;fi<ssf.length;fi++){chatHistory[streamIdx].content+='\\n![Screenshot](/api/screenshots/'+ssf[fi]+')\\n';}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);}}
906
+ 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';}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);}}
880
907
  if(currentEvent==='error'){endStreaming();chatHistory[streamIdx].content='Error: '+(data.message||'Unknown');renderMessages();}
881
908
  }catch(e){}
882
909
  }