nothumanallowed 13.5.174 → 13.5.176

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.174",
3
+ "version": "13.5.176",
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": {
@@ -2814,7 +2814,12 @@ export async function cmdUI(args) {
2814
2814
  const browserThumbs = res._browserThumbs || [];
2815
2815
  sendSSE('done', { content: finalResponse, screenshotFiles: ssFiles, browserThumbs, inlineHtml: inlineEmbeds || '' });
2816
2816
  } catch (e) {
2817
- 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
+ }
2818
2823
  }
2819
2824
 
2820
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.174';
8
+ export const VERSION = '13.5.176';
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();
@@ -302,6 +302,12 @@ TOOLS:
302
302
  Returns: title, excerpt, and body text (max 8000 chars). Only fetches text/html/json/xml.
303
303
  Use this when the user provides a specific URL to read, summarize, or analyze.
304
304
 
305
+ 49. get_weather(location: string, lang?: string)
306
+ Get current weather and 3-day forecast for any city or location. No API key needed.
307
+ Returns: temperature (°C/°F), feels like, humidity, wind speed, UV index, weather condition, and 3-day forecast.
308
+ ALWAYS use this for weather requests ("meteo", "tempo", "weather", "temperatura", "piove", "sole", "forecast").
309
+ Examples: get_weather("Viterbo"), get_weather("Rome, Italy"), get_weather("New York")
310
+
305
311
  --- BROWSER AUTOMATION ---
306
312
 
307
313
  49. browser_open(url: string, waitForLoad?: boolean)
@@ -599,7 +605,7 @@ note_add · note_list
599
605
  github_issues · github_prs · github_notifications · github_create_issue
600
606
  notion_search · notion_page
601
607
  slack_channels · slack_messages · slack_send
602
- web_search · fetch_url
608
+ web_search · fetch_url · get_weather
603
609
  browser_open · browser_screenshot · browser_click · browser_type · browser_extract · browser_js · browser_wait · browser_scroll · browser_key · browser_close
604
610
  cron_add · cron_list · cron_remove
605
611
  screen_capture · screen_analyze
@@ -1876,6 +1882,62 @@ export async function executeTool(action, params, config) {
1876
1882
  return lines.join('\n');
1877
1883
  }
1878
1884
 
1885
+ // ── Weather ──────────────────────────────────────────────────────────
1886
+ case 'get_weather': {
1887
+ const location = (params.location || '').trim();
1888
+ if (!location) return 'A location is required (e.g. "Rome", "Viterbo, Italy").';
1889
+ try {
1890
+ const encodedLoc = encodeURIComponent(location);
1891
+ const wttrRes = await fetch(`https://wttr.in/${encodedLoc}?format=j1`, {
1892
+ headers: { 'User-Agent': 'nha-cli/1.0' },
1893
+ signal: AbortSignal.timeout(8000),
1894
+ });
1895
+ if (!wttrRes.ok) return `Weather service returned ${wttrRes.status} for "${location}". Try a different location name.`;
1896
+ const w = await wttrRes.json();
1897
+ const cur = w.current_condition?.[0];
1898
+ const area = w.nearest_area?.[0];
1899
+ if (!cur) return `No weather data found for "${location}".`;
1900
+
1901
+ const cityName = area?.areaName?.[0]?.value || location;
1902
+ const country = area?.country?.[0]?.value || '';
1903
+ const desc = cur.weatherDesc?.[0]?.value || '';
1904
+ const tempC = cur.temp_C;
1905
+ const feelsC = cur.FeelsLikeC;
1906
+ const humidity = cur.humidity;
1907
+ const windKmph = cur.windspeedKmph;
1908
+ const windDir = cur.winddir16Point;
1909
+ const uvIndex = cur.uvIndex;
1910
+ const visibility = cur.visibility;
1911
+ const cloudcover = cur.cloudcover;
1912
+
1913
+ const lines = [
1914
+ `📍 ${cityName}${country ? ', ' + country : ''}`,
1915
+ `🌡️ ${tempC}°C (feels like ${feelsC}°C) — ${desc}`,
1916
+ `💧 Humidity: ${humidity}% | 💨 Wind: ${windKmph} km/h ${windDir}`,
1917
+ `☀️ UV Index: ${uvIndex} | 👁️ Visibility: ${visibility} km | ☁️ Cloud: ${cloudcover}%`,
1918
+ ];
1919
+
1920
+ // 3-day forecast
1921
+ const forecast = w.weather || [];
1922
+ if (forecast.length > 0) {
1923
+ lines.push('');
1924
+ lines.push('📅 3-day forecast:');
1925
+ for (const day of forecast.slice(0, 3)) {
1926
+ const date = day.date;
1927
+ const maxC = day.maxtempC;
1928
+ const minC = day.mintempC;
1929
+ const dayDesc = day.hourly?.[4]?.weatherDesc?.[0]?.value || '';
1930
+ const rain = day.hourly?.[4]?.chanceofrain || '0';
1931
+ lines.push(` ${date}: ${minC}°C → ${maxC}°C ${dayDesc} 🌧️ ${rain}% rain`);
1932
+ }
1933
+ }
1934
+
1935
+ return lines.join('\n');
1936
+ } catch (e) {
1937
+ return `Weather lookup failed: ${e.message}. Try using web_search("weather ${location}") as fallback.`;
1938
+ }
1939
+ }
1940
+
1879
1941
  // ── Cron / Heartbeat ───────────────────────────────────────────────
1880
1942
  case 'cron_add': {
1881
1943
  const { addCronJob } = await import('./ops-daemon.mjs');
@@ -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
  }