nothumanallowed 13.2.84 → 13.2.86

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.84",
3
+ "version": "13.2.86",
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": {
@@ -3313,7 +3313,7 @@ ${context ? `## OUTPUT FROM PREVIOUS AGENTS (use only what is RELEVANT to the wo
3313
3313
  if (stripped) sendToken(stripped);
3314
3314
  }
3315
3315
  },
3316
- { max_tokens: 4096 },
3316
+ { max_tokens: 8192 },
3317
3317
  ),
3318
3318
  llmTimeout
3319
3319
  );
@@ -3340,7 +3340,7 @@ ${context ? `## OUTPUT FROM PREVIOUS AGENTS (use only what is RELEVANT to the wo
3340
3340
  callLLMStream(retryConfig, `You are ${agent}. Analyze the following data and complete the task. Be thorough and write in ${language}.\n\nDATA:\n${context}\n\nTASK: ${stepPrompt}`,
3341
3341
  'Write your complete analysis now.',
3342
3342
  (tok) => { retryOutput += tok; sendToken(tok); },
3343
- { max_tokens: 4096 },
3343
+ { max_tokens: 8192 },
3344
3344
  ),
3345
3345
  60000
3346
3346
  );
@@ -3577,7 +3577,7 @@ ${context ? `## OUTPUT FROM PREVIOUS AGENTS (use only what is RELEVANT to the wo
3577
3577
  const buildCrossReadCtx = (excludeAgent) =>
3578
3578
  eligibleProposals
3579
3579
  .filter(p => p.agent !== excludeAgent)
3580
- .map(p => `## ${p.label || p.agent} (Round 1):\n${p.output.slice(0, 2000)}`)
3580
+ .map(p => `## ${p.label || p.agent} (Round 1):\n${p.output.slice(0, 4000)}`)
3581
3581
  .join('\n\n---\n\n');
3582
3582
 
3583
3583
  // Round 2: cross-reading + refinement (sequential to save tokens)
@@ -3605,9 +3605,17 @@ DELIBERATION ROUND 2 — REFINEMENT:
3605
3605
  5. Keep your analysis focused on: ${task}`;
3606
3606
 
3607
3607
  let r2Out = '';
3608
+ let r2TokCount = 0;
3608
3609
  try {
3609
3610
  await callLLMStream(config, r2Sys, 'Produce your refined Round 2 response.',
3610
- (tok) => { r2Out += tok; }, { max_tokens: 2048 });
3611
+ (tok) => {
3612
+ r2Out += tok;
3613
+ r2TokCount += Math.ceil(tok.length / 4);
3614
+ // Stream live token count to client every ~20 tokens
3615
+ if (r2TokCount % 20 < 3) {
3616
+ sendTok2(`[Round 2 ${proposal.label || proposal.agent}: ${r2TokCount} token] `);
3617
+ }
3618
+ }, { max_tokens: 6144 });
3611
3619
  } catch (e) { r2Out = proposal.output; }
3612
3620
  r2Results.push({ agent: proposal.agent, label: proposal.label, icon: proposal.icon, output: r2Out });
3613
3621
  sendEv2({ deliberation_r2: { agent: proposal.agent, label: proposal.label, icon: proposal.icon, output: r2Out } });
@@ -3640,7 +3648,7 @@ MEDIATION TASK:
3640
3648
  5. Output a complete executive summary with concrete action items for: ${task}`;
3641
3649
  try {
3642
3650
  await callLLMStream(config, medSys, 'Produce the mediated Parliament consensus.',
3643
- (tok) => { mediationOutput += tok; }, { max_tokens: 3000 });
3651
+ (tok) => { mediationOutput += tok; }, { max_tokens: 6144 });
3644
3652
  } catch (e) { mediationOutput = ''; }
3645
3653
  sendEv2({ deliberation_r3: { output: mediationOutput } });
3646
3654
  }
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.84';
8
+ export const VERSION = '13.2.86';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -27,6 +27,7 @@ const MAX_REDIRECTS = 5;
27
27
  const MAX_RESULTS = 8;
28
28
 
29
29
  const USER_AGENT = 'NHA-CLI/9.0 (NotHumanAllowed; +https://nothumanallowed.com)';
30
+ const BROWSER_UA = 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0';
30
31
 
31
32
  // ── SSRF Protection ──────────────────────────────────────────────────────────
32
33
 
@@ -291,9 +292,13 @@ export async function webSearch(query, maxResults = MAX_RESULTS) {
291
292
  try {
292
293
  const res = await fetch(searchUrl, {
293
294
  headers: {
294
- 'User-Agent': USER_AGENT,
295
- 'Accept': 'text/html',
296
- 'Accept-Language': 'en-US,en;q=0.9',
295
+ 'User-Agent': BROWSER_UA,
296
+ 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
297
+ 'Accept-Language': 'en-US,en;q=0.5',
298
+ 'Accept-Encoding': 'identity',
299
+ 'DNT': '1',
300
+ 'Connection': 'keep-alive',
301
+ 'Upgrade-Insecure-Requests': '1',
297
302
  },
298
303
  signal: controller.signal,
299
304
  });
@@ -325,58 +330,55 @@ export async function webSearch(query, maxResults = MAX_RESULTS) {
325
330
  /**
326
331
  * Parse DuckDuckGo HTML results page.
327
332
  * Extracts title, URL, and snippet from result items.
333
+ *
334
+ * DDG HTML structure (current):
335
+ * <div class="result results_links results_links_deep web-result ">
336
+ * <h2 class="result__title">
337
+ * <a class="result__a" href="//duckduckgo.com/l/?uddg=ENCODED_URL&...">Title</a>
338
+ * </h2>
339
+ * <a class="result__snippet" href="...">Snippet text</a>
340
+ * </div>
328
341
  */
329
342
  function parseDuckDuckGoResults(html, maxResults) {
330
343
  const results = [];
331
344
 
332
- // DuckDuckGo HTML wraps results in <div class="result..."> with
333
- // <a class="result__a" href="...">title</a> and
334
- // <a class="result__snippet">snippet</a>
335
- const resultBlocks = html.split(/class="result\s/);
345
+ // Split on individual result divs. Each web result starts with this class sequence.
346
+ const resultBlocks = html.split('class="result results_links');
336
347
 
337
348
  for (let i = 1; i < resultBlocks.length && results.length < maxResults; i++) {
338
349
  const block = resultBlocks[i];
339
350
 
340
- // Extract URL DuckDuckGo uses redirect URLs, extract the actual destination
351
+ // Extract URL from uddg= parameter in the result__a href
341
352
  let url = '';
342
- const urlMatch = block.match(/class="result__a"\s+href="([^"]+)"/);
343
- if (urlMatch) {
344
- url = urlMatch[1];
345
- // DuckDuckGo wraps URLs: //duckduckgo.com/l/?uddg=ENCODED_URL&...
346
- if (url.includes('uddg=')) {
347
- const uddgMatch = url.match(/uddg=([^&]+)/);
348
- if (uddgMatch) {
349
- try {
350
- url = decodeURIComponent(uddgMatch[1]);
351
- } catch {
352
- url = uddgMatch[1];
353
- }
354
- }
353
+ const uddgMatch = block.match(/uddg=([^&"]+)/);
354
+ if (uddgMatch) {
355
+ try {
356
+ url = decodeURIComponent(uddgMatch[1]);
357
+ } catch {
358
+ url = uddgMatch[1];
355
359
  }
356
- // Handle protocol-relative URLs
357
- if (url.startsWith('//')) url = 'https:' + url;
358
360
  }
361
+ if (!url) continue;
359
362
 
360
- // Extract title
363
+ // Extract title from result__a anchor text
361
364
  let title = '';
362
365
  const titleMatch = block.match(/class="result__a"[^>]*>([\s\S]*?)<\/a>/);
363
366
  if (titleMatch) {
364
367
  title = htmlToText(titleMatch[1]).trim();
365
368
  }
369
+ if (!title) continue;
366
370
 
367
- // Extract snippet
371
+ // Extract snippet from result__snippet anchor
368
372
  let snippet = '';
369
373
  const snippetMatch = block.match(/class="result__snippet"[^>]*>([\s\S]*?)<\/a>/);
370
- if (!snippetMatch) {
374
+ if (snippetMatch) {
375
+ snippet = htmlToText(snippetMatch[1]).trim();
376
+ } else {
371
377
  const altSnippet = block.match(/class="result__snippet"[^>]*>([\s\S]*?)<\//);
372
378
  if (altSnippet) snippet = htmlToText(altSnippet[1]).trim();
373
- } else {
374
- snippet = htmlToText(snippetMatch[1]).trim();
375
379
  }
376
380
 
377
- if (url && title) {
378
- results.push({ title, url, snippet: snippet.slice(0, 300) });
379
- }
381
+ results.push({ title, url, snippet: snippet.slice(0, 300) });
380
382
  }
381
383
 
382
384
  return results;
@@ -3849,18 +3849,60 @@ async function runStudio() {
3849
3849
  try {
3850
3850
  var dev = JSON.parse(dd);
3851
3851
  if (dev.token) {
3852
- // Status tokens from server update last log entry text inline
3853
- var delEntries = document.querySelectorAll(\x27.studio-log-entry\x27);
3854
- var delLast = delEntries[delEntries.length - 1];
3855
- if (delLast) { var delTb = delLast.querySelector(\x27.studio-log-entry__text\x27); if (delTb) delTb.textContent = dev.token; }
3852
+ // Status tokens check for Round 2 start to add new animated log entry
3853
+ var r2StartM = dev.token.match(/^\\[Round 2: (.+?)\\]\\s*$/);
3854
+ var r2LiveM = dev.token.match(/^\\[Round 2 (.+?): (\\d+) token\\]\\s*$/);
3855
+ if (r2StartM) {
3856
+ // New R2 agent starting — add a new log entry with thinking animation
3857
+ var r2Label = r2StartM[1];
3858
+ studioLog(r2Label, \x27&#x2656;\x27, \x27\x27, \x27agent\x27, false);
3859
+ var delEnts2 = document.querySelectorAll(\x27.studio-log-entry\x27);
3860
+ var delL2 = delEnts2[delEnts2.length - 1];
3861
+ if (delL2) {
3862
+ delL2.setAttribute(\x27data-r2-agent\x27, r2Label);
3863
+ var delTb2 = delL2.querySelector(\x27.studio-log-entry__text\x27);
3864
+ if (delTb2) delTb2.innerHTML = \x27<span style="color:var(--green);font-family:var(--mono);font-size:10px">&#x2656; Deliberando Round 2<span class="thinking-dots"><span></span><span></span><span></span></span></span>\x27;
3865
+ }
3866
+ } else if (r2LiveM) {
3867
+ // Live token count update for the current R2 agent
3868
+ var r2AgentName = r2LiveM[1];
3869
+ var r2Toks = parseInt(r2LiveM[2], 10);
3870
+ var delAllEnts = document.querySelectorAll(\x27[data-r2-agent]\x27);
3871
+ var r2Entry = null;
3872
+ for (var rei = delAllEnts.length - 1; rei >= 0; rei--) {
3873
+ if (delAllEnts[rei].getAttribute(\x27data-r2-agent\x27) === r2AgentName) { r2Entry = delAllEnts[rei]; break; }
3874
+ }
3875
+ if (!r2Entry) {
3876
+ var delAllE = document.querySelectorAll(\x27.studio-log-entry\x27);
3877
+ r2Entry = delAllE[delAllE.length - 1];
3878
+ }
3879
+ if (r2Entry) {
3880
+ var r2Tb = r2Entry.querySelector(\x27.studio-log-entry__text\x27);
3881
+ if (r2Tb) r2Tb.innerHTML = \x27<span style="color:var(--green);font-family:var(--mono);font-size:10px">&#x2656; Deliberando Round 2 \u2014 \x27 + r2Toks + \x27 token<span class="thinking-dots"><span></span><span></span><span></span></span></span>\x27;
3882
+ }
3883
+ studioAddTokens(0, 20); // approx chunk size
3884
+ } else {
3885
+ // Other status tokens — update last log entry
3886
+ var delEntries = document.querySelectorAll(\x27.studio-log-entry\x27);
3887
+ var delLast = delEntries[delEntries.length - 1];
3888
+ if (delLast) { var delTb = delLast.querySelector(\x27.studio-log-entry__text\x27); if (delTb) delTb.textContent = dev.token.replace(new RegExp(\x27[\\r\\n]+\x27,\x27g\x27),\x27 \x27); }
3889
+ }
3856
3890
  } else if (dev.deliberation_r2) {
3857
3891
  var r2d = dev.deliberation_r2;
3858
- studioLog(r2d.label || r2d.agent, \x27&#x2656;\x27, \x27[R2] \x27 + (r2d.output || \x27\x27).slice(0, 300), \x27agent\x27, true);
3892
+ // Full output in log no truncation
3893
+ studioLog(r2d.label || r2d.agent, \x27&#x2656;\x27, \x27[R2] \x27 + (r2d.output || \x27\x27), \x27agent\x27, true);
3859
3894
  var ni2 = studioState.nodes.findIndex(function(x){return x.agent===r2d.agent;});
3860
- if (ni2 >= 0) { studioState.nodes[ni2].output = r2d.output; }
3895
+ if (ni2 >= 0) {
3896
+ studioState.nodes[ni2].output = r2d.output;
3897
+ studioState.nodes[ni2].status = \x27done\x27;
3898
+ }
3899
+ // Estimate tokens for R2 (approx 1 token ≈ 4 chars)
3900
+ studioAddTokens(0, Math.ceil((r2d.output||'').length / 4));
3901
+ renderStudioNodes();
3861
3902
  context = r2d.output || context;
3862
3903
  } else if (dev.deliberation_r3) {
3863
- studioLog(\x27HERALD\x27, \x27&#128295;\x27, \x27[Mediazione] \x27 + (dev.deliberation_r3.output || \x27\x27).slice(0, 300), \x27system\x27, true);
3904
+ studioLog(\x27HERALD\x27, \x27&#128295;\x27, \x27[Mediazione] \x27 + (dev.deliberation_r3.output || \x27\x27), \x27system\x27, true);
3905
+ studioAddTokens(0, Math.ceil((dev.deliberation_r3.output||'').length / 4));
3864
3906
  context = dev.deliberation_r3.output || context;
3865
3907
  } else if (dev.deliberation_done) {
3866
3908
  var r2Conv = Math.round((dev.r2_convergence || 0) * 100);
@@ -4072,7 +4114,15 @@ function runStudioStep(idx, node, task, context, stepDef, signal) {
4072
4114
  var tb = last.querySelector(\x27.studio-log-entry__text\x27);
4073
4115
  if (tb) {
4074
4116
  if (isStatus) {
4075
- tb.textContent = ev.token.replace(new RegExp(\x27[\\\\r\\\\n]+\x27,\x27g\x27), \x27 \x27);
4117
+ var st = ev.token.replace(new RegExp(\x27[\\\\r\\\\n]+\x27,\x27g\x27), \x27 \x27);
4118
+ // Render [Searching: "query"] as a styled search chip
4119
+ var srchM = st.match(/^\\[Searching:\\s*"([^"]+)"\\]\\s*$/);
4120
+ if (srchM) {
4121
+ var qEsc = srchM[1].replace(/&/g,\x27&amp;\x27).replace(/</g,\x27&lt;\x27).replace(/>/g,\x27&gt;\x27);
4122
+ tb.innerHTML = \x27<span style="display:inline-flex;align-items:center;gap:6px;background:#1c1c28;border:1px solid #6366f133;border-radius:20px;padding:3px 10px 3px 8px;font-size:11px;font-family:var(--mono)"><span style="color:#6366f1">&#128269;</span><span style="color:var(--dim)">Cercando</span><strong style="color:#a5b4fc">\x27 + qEsc + \x27</strong><span style="color:#6366f1;animation:pulse 1s infinite">&#183;&#183;&#183;</span></span>\x27;
4123
+ } else {
4124
+ tb.textContent = st;
4125
+ }
4076
4126
  } else {
4077
4127
  // Live token counter — shows progress without raw content
4078
4128
  var chars = output.length;