nothumanallowed 13.2.82 → 13.2.83

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.82",
3
+ "version": "13.2.83",
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": {
@@ -3358,16 +3358,117 @@ ${context ? `## OUTPUT FROM PREVIOUS AGENTS (use only what is RELEVANT to the wo
3358
3358
  const stopWords = new Set(['di','la','il','lo','le','gli','un','una','dei','del','della','per','che','con','su','in','e','a','da','è','come','analizza','analisi','ricerca','crea','genera','fai','fammi','dammi','the','of','for','and','a','an','in','with','on','about','analyze','analysis','research','create','generate','make','find','search']);
3359
3359
  const titleWords = task.replace(/[.,;:!?]/g,'').split(/\s+/).filter(w => w.length > 2 && !stopWords.has(w.toLowerCase())).slice(0, 6);
3360
3360
  const reportTitle = titleWords.length > 0 ? titleWords.map(w => w.charAt(0).toUpperCase()+w.slice(1)).join(' ') : 'Studio Report';
3361
- // Fallback: if LLM output is empty or has no HTML tags, build body from context using markdown→HTML conversion
3361
+ // Convert markdown to NHA-classed HTML handles the case where Liara/Qwen3
3362
+ // returns markdown instead of HTML despite instructions.
3363
+ const mdToNhaHtml = (md) => {
3364
+ const esc = s => s.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
3365
+ // inline: bold, italic, inline-code, links
3366
+ const inl = s => s
3367
+ .replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
3368
+ .replace(/\*([^*]+)\*/g, '<em>$1</em>')
3369
+ .replace(/`([^`]+)`/g, '<code style="background:#1c1c28;padding:1px 5px;border-radius:3px;font-size:12px">$1</code>')
3370
+ .replace(/\[([^\]]+)\]\((https?:\/\/[^)]+)\)/g, '<a href="$2" target="_blank">$1</a>');
3371
+
3372
+ const lines = md.split('\n');
3373
+ let out = [];
3374
+ let i = 0;
3375
+ let currentSection = null; // accumulates section content
3376
+
3377
+ const flushSection = () => {
3378
+ if (currentSection) { out.push(currentSection + '</div>'); currentSection = null; }
3379
+ };
3380
+
3381
+ while (i < lines.length) {
3382
+ const l = lines[i];
3383
+ // H1 — treat as sub-header inside a new section
3384
+ if (/^# /.test(l)) {
3385
+ flushSection();
3386
+ const title = esc(l.replace(/^# /, '').replace(/\*\*/g,'').replace(/\*/g,''));
3387
+ currentSection = `<div class="section"><div class="section-title">${title}</div>`;
3388
+ i++; continue;
3389
+ }
3390
+ // H2 / H3 — new section
3391
+ if (/^#{2,3} /.test(l)) {
3392
+ flushSection();
3393
+ const title = esc(l.replace(/^#{2,3} /, '').replace(/\*\*/g,'').replace(/\*/g,''));
3394
+ currentSection = `<div class="section"><div class="section-title">${title}</div>`;
3395
+ i++; continue;
3396
+ }
3397
+ // H4 — sub-heading inside current section
3398
+ if (/^#### /.test(l)) {
3399
+ const h = esc(l.replace(/^#### /, '').replace(/\*\*/g,'').replace(/\*/g,''));
3400
+ const frag = `<h3>${h}</h3>`;
3401
+ if (currentSection) currentSection += frag; else out.push(frag);
3402
+ i++; continue;
3403
+ }
3404
+ // Horizontal rule — divider
3405
+ if (/^---+$/.test(l.trim())) {
3406
+ const frag = '<div class="divider"></div>';
3407
+ if (currentSection) currentSection += frag; else out.push(frag);
3408
+ i++; continue;
3409
+ }
3410
+ // Table row
3411
+ if (l.trim().startsWith('|') && l.includes('|', 1)) {
3412
+ // Collect all table lines
3413
+ const tableLines = [];
3414
+ while (i < lines.length && lines[i].trim().startsWith('|')) {
3415
+ if (!/^\|[\s:|-]+\|$/.test(lines[i].trim())) tableLines.push(lines[i]);
3416
+ i++;
3417
+ }
3418
+ if (tableLines.length > 0) {
3419
+ const isHeader = tableLines.length > 1;
3420
+ let tHtml = '<table style="width:100%;border-collapse:collapse;margin:10px 0;font-size:12px">';
3421
+ tableLines.forEach((tl, ti) => {
3422
+ const cells = tl.split('|').slice(1,-1).map(c => c.trim());
3423
+ const tag = (ti === 0 && isHeader) ? 'th' : 'td';
3424
+ const bg = ti === 0 && isHeader ? 'background:#1c1c28;color:#a5b4fc;font-weight:700' : (ti % 2 === 0 ? 'background:#15151f' : 'background:#1a1a28');
3425
+ tHtml += '<tr>' + cells.map(c => `<${tag} style="${bg};padding:6px 10px;border:1px solid #2a2a38;text-align:left">${inl(esc(c))}</${tag}>`).join('') + '</tr>';
3426
+ });
3427
+ tHtml += '</table>';
3428
+ if (currentSection) currentSection += tHtml; else out.push(tHtml);
3429
+ }
3430
+ continue;
3431
+ }
3432
+ // Unordered list block
3433
+ if (/^(\s*[-*+] )/.test(l)) {
3434
+ const items = [];
3435
+ while (i < lines.length && /^(\s*[-*+] )/.test(lines[i])) {
3436
+ items.push(inl(esc(lines[i].replace(/^\s*[-*+] /, ''))));
3437
+ i++;
3438
+ }
3439
+ const frag = '<ul>' + items.map(it => `<li>${it}</li>`).join('') + '</ul>';
3440
+ if (currentSection) currentSection += frag; else out.push(frag);
3441
+ continue;
3442
+ }
3443
+ // Ordered list block
3444
+ if (/^\d+\. /.test(l)) {
3445
+ const items = [];
3446
+ while (i < lines.length && /^\d+\. /.test(lines[i])) {
3447
+ items.push(inl(esc(lines[i].replace(/^\d+\. /, ''))));
3448
+ i++;
3449
+ }
3450
+ const frag = '<ol>' + items.map(it => `<li>${it}</li>`).join('') + '</ol>';
3451
+ if (currentSection) currentSection += frag; else out.push(frag);
3452
+ continue;
3453
+ }
3454
+ // Blank line — skip
3455
+ if (!l.trim()) { i++; continue; }
3456
+ // Regular paragraph
3457
+ const frag = `<p>${inl(esc(l))}</p>`;
3458
+ if (currentSection) currentSection += frag; else out.push(frag);
3459
+ i++;
3460
+ }
3461
+ flushSection();
3462
+ return out.join('');
3463
+ };
3464
+
3465
+ // If LLM output has no HTML tags → it's markdown → convert
3362
3466
  if (!bodyHtml || !bodyHtml.includes('<')) {
3363
- const sections = context.split(/\n#{1,3} |(?=\n\n)/).filter(s => s.trim()).slice(0, 12);
3467
+ const source = bodyHtml || context;
3468
+ const converted = mdToNhaHtml(source);
3469
+ const agentNames = (stepDef && Array.isArray(stepDef)) ? '' : '';
3364
3470
  bodyHtml = `<div class="header"><h1>${reportTitle.replace(/</g,'&lt;')}</h1><p>NHA Studio Report \u00b7 ${today}</p><div class="meta"><span>${today}</span></div></div>` +
3365
- sections.map(s => {
3366
- const lines = s.replace(/\*\*/g,'').replace(/\*/g,'').trim().split('\n').filter(Boolean);
3367
- const stitle = lines[0] || '';
3368
- const body = lines.slice(1).map(l => `<p>${l.replace(/</g,'&lt;')}</p>`).join('');
3369
- return `<div class="section"><div class="section-title">${stitle.replace(/</g,'&lt;')}</div>${body}</div>`;
3370
- }).join('') +
3471
+ converted +
3371
3472
  `<div class="footer">NHA Studio \u00b7 ${today}</div>`;
3372
3473
  } else {
3373
3474
  // Replace the h1 inside existing header div if the model included the full prompt as title
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.82';
8
+ export const VERSION = '13.2.83';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11