nothumanallowed 12.1.0 → 12.1.2

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": "12.1.0",
3
+ "version": "12.1.2",
4
4
  "description": "NotHumanAllowed — 38 AI agents, 80 tools. 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": {
@@ -107,7 +107,17 @@ export async function cmdAsk(args) {
107
107
  const imagePrompt = userMessage || 'Describe this image in detail. Extract any text, data, or important information.';
108
108
  let response = '';
109
109
 
110
- if (provider === 'anthropic') {
110
+ if (provider === 'nha') {
111
+ // NHA Free tier — Liara Vision
112
+ const res = await fetch('https://nothumanallowed.com/api/v1/liara/vision', {
113
+ method: 'POST',
114
+ headers: { 'Content-Type': 'application/json' },
115
+ body: JSON.stringify({ image_base64: base64, prompt: imagePrompt }),
116
+ });
117
+ if (!res.ok) throw new Error(`Liara Vision ${res.status}`);
118
+ const data = await res.json();
119
+ response = data.description || data.text || JSON.stringify(data);
120
+ } else if (provider === 'anthropic') {
111
121
  const res = await fetch('https://api.anthropic.com/v1/messages', {
112
122
  method: 'POST',
113
123
  headers: { 'Content-Type': 'application/json', 'x-api-key': apiKey, 'anthropic-version': '2023-06-01' },
@@ -1206,7 +1206,17 @@ export async function cmdUI(args) {
1206
1206
  const imagePrompt = body.message || 'Describe this image in detail. Extract any text or important information.';
1207
1207
  let visionResponse = '';
1208
1208
 
1209
- if (provider === 'anthropic') {
1209
+ if (provider === 'nha') {
1210
+ // NHA Free tier — Liara Vision (zero API key)
1211
+ const r = await fetch('https://nothumanallowed.com/api/v1/liara/vision', {
1212
+ method: 'POST',
1213
+ headers: { 'Content-Type': 'application/json' },
1214
+ body: JSON.stringify({ image_base64: body.imageBase64, prompt: imagePrompt }),
1215
+ });
1216
+ if (!r.ok) throw new Error(`Liara Vision ${r.status}`);
1217
+ const d = await r.json();
1218
+ visionResponse = d.description || d.text || JSON.stringify(d);
1219
+ } else if (provider === 'anthropic') {
1210
1220
  const r = await fetch('https://api.anthropic.com/v1/messages', {
1211
1221
  method: 'POST',
1212
1222
  headers: { 'Content-Type': 'application/json', 'x-api-key': apiKey, 'anthropic-version': '2023-06-01' },
@@ -1673,6 +1683,28 @@ export async function cmdUI(args) {
1673
1683
  }
1674
1684
  }
1675
1685
 
1686
+ // Auto-correct: if LLM called web_search but query looks like a domain, switch to browser_open
1687
+ for (const a of actions) {
1688
+ if (a.action === 'web_search' && a.params.query) {
1689
+ const q = a.params.query.trim();
1690
+ // Detect domain names: corriere.it, github.com, youtube.com, etc.
1691
+ if (/^[a-zA-Z0-9][a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(q) || /^(https?:\/\/)/.test(q)) {
1692
+ a.action = 'browser_open';
1693
+ a.params = { url: q.startsWith('http') ? q : 'https://' + q };
1694
+ }
1695
+ }
1696
+ }
1697
+
1698
+ // Auto-correct: if user said "visita/vai su/apri/open" + domain but LLM used web_search
1699
+ const visitMatch = msg.match(/(?:visita|vai su|apri|open|go to)\s+([a-zA-Z0-9][a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/i);
1700
+ if (visitMatch && !actions.some(a => a.action === 'browser_open')) {
1701
+ const domain = visitMatch[1];
1702
+ // Remove any web_search that was targeting this domain
1703
+ const wsIdx = actions.findIndex(a => a.action === 'web_search' && a.params.query?.toLowerCase().includes(domain.toLowerCase()));
1704
+ if (wsIdx >= 0) actions.splice(wsIdx, 1);
1705
+ actions.unshift({ action: 'browser_open', params: { url: 'https://' + domain } });
1706
+ }
1707
+
1676
1708
  for (const { action, params } of actions) {
1677
1709
  // Force screenshot=true on web_search if user asked for screenshot
1678
1710
  if (action === 'web_search' && wantsScreenshot && !params.screenshot) {
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 = '12.1.0';
8
+ export const VERSION = '12.1.2';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -445,8 +445,12 @@ TOOLS:
445
445
 
446
446
  RULES:
447
447
  - ABSOLUTE RULE: NEVER LIE. NEVER fabricate, invent, or guess information. If you do not know, say "I don't know." If a tool fails, say it failed. If you cannot see something, say so. Honesty is MORE important than being helpful.
448
- - CRITICAL: For web searches, ALWAYS use web_search — NEVER open Google/Bing/DuckDuckGo in the browser.
449
- - CRITICAL: For web searches ("search for X", "find X online", "look up X"), ALWAYS use web_search — NEVER open Google/Bing/DuckDuckGo in the browser. web_search is faster, more reliable, and doesn't get blocked by CAPTCHAs. Only use browser_open for interacting with specific websites (filling forms, clicking buttons, taking screenshots of specific pages).
448
+ - CRITICAL ROUTING RULE browser_open vs web_search:
449
+ * "visita X.com", "vai su X", "apri X.com", "open X", "go to X" ALWAYS use browser_open("https://X.com"). The user wants to SEE a specific website.
450
+ * "cerca X", "search for X", "find X", "look up X" → ALWAYS use web_search. The user wants search results.
451
+ * If the user mentions a SPECIFIC domain name (corriere.it, github.com, youtube.com, etc.) → browser_open, NEVER web_search.
452
+ * NEVER open Google/Bing/DuckDuckGo in the browser — use web_search for searching.
453
+ * web_search is for QUERIES. browser_open is for URLS. If it looks like a website name, it's a URL.
450
454
  - For search/read operations, execute immediately and present results conversationally.
451
455
  - For write/send/delete operations (gmail_send, gmail_reply, gmail_delete, calendar_create, calendar_move, calendar_update, contact_delete, task_done, notify_remind, file_write), DESCRIBE what you're about to do and include the JSON block so the system can ask the user for confirmation.
452
456
  - For schedule_meeting and schedule_draft_email, execute immediately — these are read operations that suggest slots.