nothumanallowed 13.2.94 → 13.2.95

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.94",
3
+ "version": "13.2.95",
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": {
@@ -3337,10 +3337,59 @@ ${context ? `## OUTPUT FROM PREVIOUS AGENTS (use only what is RELEVANT to the wo
3337
3337
 
3338
3338
  // Strip think tags from fullOutput before emptiness check
3339
3339
  let fullOutputClean = fullOutput.replace(/<think>[\s\S]*?<\/think>/g, '').trim();
3340
- // Remove empty sections: headings (## N. Title) immediately followed by another heading or end-of-text
3341
- // These appear when LLM runs out of tokens mid-response
3342
- fullOutputClean = fullOutputClean.replace(/^(#{1,4}\s+[^\n]+)\n+(?=#{1,4}\s|$)/gm, '');
3343
- // Also strip trailing lone headings at end of output
3340
+
3341
+ // ── Fill empty sections ──────────────────────────────────────────
3342
+ // Detect headings with no body: heading immediately followed by another heading or end
3343
+ // e.g. "## 6. Piano d'Azione\n\n## 7. ..." section 6 has no content
3344
+ const emptySectionRegex = /^(#{1,4}\s+[^\n]+)\n+(?=#{1,4}\s|$)/gm;
3345
+ const emptySections = [];
3346
+ let emMatch;
3347
+ while ((emMatch = emptySectionRegex.exec(fullOutputClean)) !== null) {
3348
+ emptySections.push(emMatch[1].trim());
3349
+ }
3350
+
3351
+ if (!isCanvasAgent && emptySections.length > 0) {
3352
+ // Fill each empty section with a targeted LLM call
3353
+ sendToken('\n\n[Completando sezioni mancanti...] ');
3354
+ // Pass raw data AND the partial report already written so the model writes in context
3355
+ const dataForFill = (toolData || context || '').slice(0, 4000);
3356
+ const fillConfig = Object.assign({}, config, { thinking: 'off' });
3357
+ for (const emptyHeading of emptySections) {
3358
+ sendToken('\n' + emptyHeading + '\n');
3359
+ let filledContent = '';
3360
+ // Snapshot of the report written so far (trimmed to last 3000 chars for recency)
3361
+ const reportSoFar = fullOutputClean.slice(-3000);
3362
+ try {
3363
+ await withTimeout(
3364
+ callLLMStream(
3365
+ fillConfig,
3366
+ `You are ${agent}. You wrote a report and accidentally left one section empty. Fill in ONLY the missing section — do NOT repeat the heading, do NOT add other sections. Be specific, consistent with the rest of the report, and thorough. Write in ${language}.\n\nSource data:\n${dataForFill}\n\nOverall task: ${task}\n\nReport written so far (for context and style consistency):\n${reportSoFar}`,
3367
+ `Write ONLY the body content for this section (heading already printed, do not repeat it):\n${emptyHeading}`,
3368
+ (tok) => { filledContent += tok; sendToken(tok); },
3369
+ { max_tokens: 1500, thinking: 'off' }
3370
+ ),
3371
+ 45000
3372
+ );
3373
+ } catch {}
3374
+ if (filledContent.trim()) {
3375
+ // Inject the filled content into fullOutputClean right after the heading
3376
+ const escapedH = emptyHeading.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
3377
+ fullOutputClean = fullOutputClean.replace(
3378
+ new RegExp('(' + escapedH + ')\\n+(#{1,4}\\s)', 'g'),
3379
+ '$1\n\n' + filledContent.trim() + '\n\n$2'
3380
+ );
3381
+ // Also handle trailing empty heading (last section)
3382
+ fullOutputClean = fullOutputClean.replace(
3383
+ new RegExp('(' + escapedH + ')\\s*$', 'g'),
3384
+ '$1\n\n' + filledContent.trim()
3385
+ );
3386
+ }
3387
+ }
3388
+ } else {
3389
+ // Remove empty sections if we can't fill them (fallback: no data available)
3390
+ fullOutputClean = fullOutputClean.replace(/^(#{1,4}\s+[^\n]+)\n+(?=#{1,4}\s|$)/gm, '');
3391
+ }
3392
+ // Strip trailing lone headings at end of output (truly unfillable)
3344
3393
  fullOutputClean = fullOutputClean.replace(/(#{1,4}\s+[^\n]+)\s*$/g, '').trim();
3345
3394
 
3346
3395
  // Fallback: if LLM returned empty and we have tool data, send it directly
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.94';
8
+ export const VERSION = '13.2.95';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11