nothumanallowed 13.2.15 → 13.2.17

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.2.15",
3
+ "version": "13.2.17",
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": {
@@ -2543,13 +2543,16 @@ export async function cmdUI(args) {
2543
2543
  const task = (body.task || '').trim();
2544
2544
  if (!task) { sendJSON(res, 400, { error: 'task required' }); logRequest(method, pathname, 400, Date.now() - start); return; }
2545
2545
 
2546
+ const plannerLang = (() => { const LANG_MAP2 = {en:'English',it:'Italian',es:'Spanish',fr:'French',de:'German',pt:'Portuguese',zh:'Chinese',ja:'Japanese',ar:'Arabic',hi:'Hindi',ru:'Russian',nl:'Dutch',pl:'Polish',tr:'Turkish',ko:'Korean'}; const lc = (config?.language||'it').slice(0,2); return LANG_MAP2[lc]||'Italian'; })();
2546
2547
  const planPrompt = `You are a workflow planner for NHA Studio. The user wants to accomplish this task: "${task}"
2548
+ The workflow will run in ${plannerLang} — all agent prompts must be in ${plannerLang}.
2547
2549
 
2548
- Design a sequential workflow of 2-5 steps. RULES:
2550
+ Design a sequential workflow of 2-6 steps. RULES:
2549
2551
  - Use tool-agents (WebSearchAgent, EmailAgent, CalendarAgent, GitHubAgent, NotionAgent, SlackAgent) FIRST when real live data is needed
2550
- - Use specialist agents (SABER, ATLAS, JARVIS, etc.) for deep domain analysisthey have rich expert system prompts
2551
- - Use CanvasAgent as the LAST step ONLY when a visual HTML report is requested
2552
- - The "prompt" field must be a plain language instruction never JSON or code
2552
+ - ALWAYS use specialist agents (HERALD, ORACLE, NAVI, ATHENA, CASSANDRA, etc.) for analysis, briefings, and synthesis NOT WriterAgent or DataAnalystAgent
2553
+ - For executive briefings use HERALD. For data analysis use NAVI or ORACLE. For tech analysis use ATHENA. For risk use CASSANDRA.
2554
+ - Use CanvasAgent as the LAST step ONLY when a visual HTML report/dashboard is explicitly requested
2555
+ - The "prompt" field must be a plain language instruction in ${plannerLang} — never JSON or code
2553
2556
  - Each agent receives the previous step's output as context automatically
2554
2557
  - Pick the most relevant agents for the task — don't use all of them
2555
2558
 
@@ -2658,11 +2661,14 @@ Respond with ONLY valid JSON, no markdown:
2658
2661
  // Keepalive: send a comment every 5s so the connection doesn't time out during slow tool calls
2659
2662
  const keepalive = setInterval(() => { try { res.write(': keepalive\n\n'); } catch {} }, 5000);
2660
2663
 
2661
- // Timeout wrapper for tool calls 25s max
2662
- const withTimeout = (promise, label) => Promise.race([
2663
- promise,
2664
- new Promise((_, rej) => setTimeout(() => rej(new Error(`${label} timed out after 25s`)), 25000)),
2665
- ]);
2664
+ // Timeout wrapper ms param optional (default 25s for tool calls)
2665
+ const withTimeout = (promise, ms) => {
2666
+ const delay = typeof ms === 'number' ? ms : 25000;
2667
+ return Promise.race([
2668
+ promise,
2669
+ new Promise((_, rej) => setTimeout(() => rej(new Error(`Step timed out after ${delay/1000}s`)), delay)),
2670
+ ]);
2671
+ };
2666
2672
 
2667
2673
  try {
2668
2674
  const stepPrompt = stepDef?.prompt || task;
@@ -2744,14 +2750,19 @@ Respond with ONLY valid JSON, no markdown:
2744
2750
  }
2745
2751
 
2746
2752
  // ── Build system prompt with real tool data ───────────────────
2753
+ const LANG_MAP = {en:'English',it:'Italian',es:'Spanish',fr:'French',de:'German',pt:'Portuguese',zh:'Chinese',ja:'Japanese',ar:'Arabic',hi:'Hindi',ru:'Russian',nl:'Dutch',pl:'Polish',tr:'Turkish',ko:'Korean',sv:'Swedish',da:'Danish',fi:'Finnish',no:'Norwegian',cs:'Czech'};
2754
+ const langCode = (config?.language || 'it').toLowerCase().slice(0,2);
2755
+ const language = LANG_MAP[langCode] || config?.language || 'Italian';
2756
+ const today = new Date().toISOString().split('T')[0];
2747
2757
  const isCanvasAgent = agent === 'CanvasAgent';
2748
2758
  // Tool-data agents: fetch real live data and use buildSystemPrompt (tool calls allowed)
2749
2759
  const isLiveDataAgent = ['CalendarAgent','EmailAgent','GitHubAgent','NotionAgent','SlackAgent','DriveAgent','BrowserAgent','WebSearchAgent','ResearchAgent'].includes(agent);
2750
2760
 
2751
- const canvasSystemPrompt = `You are an HTML report generator. Output a single complete HTML document. No preamble, no explanation.
2761
+ const canvasSystemPrompt = `You are an HTML report generator. Output a single complete HTML document in ${language}. No preamble, no explanation.
2752
2762
  RULES:
2753
2763
  - First character of your response must be < (start of <!DOCTYPE html>)
2754
2764
  - Do NOT use markdown code blocks, JSON, or any wrapper
2765
+ - All text content must be in ${language}
2755
2766
  - Use clean design: white background, Inter/system-ui font, #6366f1 accent color
2756
2767
  - Structure: gradient header, then card sections with the content
2757
2768
  - Make it complete and self-contained`;
@@ -2763,10 +2774,10 @@ RULES:
2763
2774
  userMsg = `Generate a beautiful HTML dashboard report for this content. Start immediately with <!DOCTYPE html>:\n\n${context.slice(0, 8000)}`;
2764
2775
  } else if (isLiveDataAgent) {
2765
2776
  // These agents fetched real data — use buildSystemPrompt so they can call tools too
2766
- const agentInstruction = `You are ${agent}, a specialist AI agent inside NHA Studio.\nYour task: ${stepPrompt}\n` +
2777
+ const agentInstruction = `You are ${agent}, a specialist AI agent inside NHA Studio. Respond in ${language}.\nYour task: ${stepPrompt}\n` +
2767
2778
  (toolData ? `\n## DATA FROM TOOLS:\n${toolData.slice(0, 4000)}\n` : '') +
2768
2779
  (context ? `\n## OUTPUT FROM PREVIOUS AGENTS:\n${context.slice(0, 3000)}\n` : '') +
2769
- '\nWrite your analysis in plain text. Do NOT output JSON, tool calls, or code blocks. Summarize the data clearly.';
2780
+ `\nWrite your analysis in plain text in ${language}. Do NOT output JSON, tool calls, or code blocks. Summarize the data clearly.`;
2770
2781
  sysPrompt = buildSystemPrompt(agent, agentInstruction, config);
2771
2782
  userMsg = toolData
2772
2783
  ? `Summarize the data above for: ${stepPrompt}`
@@ -2776,9 +2787,7 @@ RULES:
2776
2787
  } else {
2777
2788
  // All other agents (WriterAgent, DataAnalystAgent, specialist agents, etc.)
2778
2789
  // Use a focused prompt with NO TOOL_DEFINITIONS to prevent JSON/tool-call output
2779
- const today = new Date().toISOString().split('T')[0];
2780
- const language = config?.language || 'Italian';
2781
- sysPrompt = `You are ${agent}, a specialist AI agent inside NHA Studio. Today is ${today}. Respond in ${language}.
2790
+ sysPrompt = `You are ${agent}, a specialist AI agent inside NHA Studio. Today is ${today}. You MUST respond entirely in ${language}.
2782
2791
 
2783
2792
  CRITICAL RULES:
2784
2793
  - Do NOT output JSON, tool calls, function calls, or code blocks
@@ -2798,6 +2807,7 @@ ${context ? `## CONTEXT FROM PREVIOUS AGENTS:\n${context.slice(0, 5000)}\n` : ''
2798
2807
  // ── Stream LLM response ───────────────────────────────────────
2799
2808
  let fullOutput = '';
2800
2809
  sendToken(isCanvasAgent ? 'Generating visual report...' : '');
2810
+ const llmTimeout = isCanvasAgent ? 120000 : 90000;
2801
2811
  try {
2802
2812
  await withTimeout(
2803
2813
  callLLMStream(config, sysPrompt, userMsg,
@@ -2809,8 +2819,9 @@ ${context ? `## CONTEXT FROM PREVIOUS AGENTS:\n${context.slice(0, 5000)}\n` : ''
2809
2819
  if (stripped) sendToken(stripped);
2810
2820
  }
2811
2821
  },
2822
+ { max_tokens: isCanvasAgent ? 4096 : 2048 },
2812
2823
  ),
2813
- isCanvasAgent ? 60000 : 35000
2824
+ llmTimeout
2814
2825
  );
2815
2826
  } catch (e) {
2816
2827
  if (!isCanvasAgent) sendToken(`[Error: ${e.message}]`);
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.2.15';
8
+ export const VERSION = '13.2.17';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -3036,14 +3036,20 @@ function runStudioStep(idx, node, task, context, stepDef) {
3036
3036
  var ev = JSON.parse(d);
3037
3037
  if (ev.token) {
3038
3038
  // Tool status tokens (start with '[') shown in dim color, LLM output streamed normally
3039
- var isStatus = ev.token.charAt(0) === '[' && ev.token.indexOf(']') > 0 && ev.token.length < 60;
3039
+ var isStatus = ev.token.charAt(0) === '[' && ev.token.indexOf(']') > 0 && ev.token.length < 80;
3040
3040
  if (!isStatus) output += ev.token;
3041
3041
  // Update live log entry
3042
3042
  var entries = document.querySelectorAll('.studio-log-entry');
3043
3043
  var last = entries[entries.length - 1];
3044
3044
  if (last) {
3045
3045
  var tb = last.querySelector('.studio-log-entry__text');
3046
- if (tb) tb.textContent = isStatus ? ev.token.replace(/[\\r\\n]/g, '') : output;
3046
+ if (tb) {
3047
+ if (isStatus) {
3048
+ tb.textContent = ev.token.replace(/[\r\n]/g, '');
3049
+ } else {
3050
+ tb.innerHTML = renderMd(output);
3051
+ }
3052
+ }
3047
3053
  }
3048
3054
  }
3049
3055
  if (ev.canvas) {