nothumanallowed 13.5.22 → 13.5.24

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.5.22",
3
+ "version": "13.5.24",
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": {
@@ -3576,7 +3576,9 @@ Use ## prefix for each heading. Maximum 8 sections. Example:
3576
3576
  const sectionParts = [];
3577
3577
  for (let si = 0; si < headingLines.length; si++) {
3578
3578
  const heading = headingLines[si];
3579
- const writtenSoFar = sectionParts.join('\n\n');
3579
+ // Pass only the headings of completed sections (not full content) to keep context small
3580
+ // and leave maximum token budget for the current section body.
3581
+ const completedHeadings = sectionParts.map(p => p.split('\n')[0]).join('\n');
3580
3582
  const secSys = `You are ${agent}, a specialist AI agent inside NHA Studio. Today is ${today}. Respond entirely in ${language}.
3581
3583
 
3582
3584
  ## OVERALL WORKFLOW GOAL:
@@ -3589,13 +3591,13 @@ CRITICAL RULES:
3589
3591
  - Be thorough, specific, and complete — this is one section of an executive report
3590
3592
 
3591
3593
  ${dataBlock}
3592
- ${writtenSoFar ? `## REPORT WRITTEN SO FAR (for consistency):\n${writtenSoFar.slice(-3000)}` : ''}`;
3594
+ ${completedHeadings ? `## SECTIONS ALREADY WRITTEN (headings only, for consistency):\n${completedHeadings}` : ''}`;
3593
3595
  const secUser = `Write the complete body content for this section (do NOT repeat the heading):\n${heading}`;
3594
3596
  sendToken('\n\n' + heading + '\n');
3595
3597
  sendToken('[Sezione ' + (si + 1) + ' di ' + headingLines.length + '...] ');
3596
3598
  let secContent = '';
3597
3599
  try {
3598
- secContent = await streamCall(secSys, secUser, { max_tokens: 2000, thinking: 'off' }, 60000, sendToken);
3600
+ secContent = await streamCall(secSys, secUser, { max_tokens: 4000, thinking: 'off' }, 90000, sendToken);
3599
3601
  } catch {}
3600
3602
  if (secContent.trim()) {
3601
3603
  sectionParts.push(heading + '\n\n' + secContent.trim());
@@ -3614,8 +3616,8 @@ ${writtenSoFar ? `## REPORT WRITTEN SO FAR (for consistency):\n${writtenSoFar.sl
3614
3616
  fullOutputClean = stripThink(fullOutput);
3615
3617
  }
3616
3618
 
3617
- // Strip trailing lone headings at end of output (truly unfillable edge cases)
3618
- fullOutputClean = fullOutputClean.replace(/(#{1,4}\s+[^\n]+)\s*$/g, '').trim();
3619
+ // Note: do NOT strip trailing headings a heading with content follows in the structured
3620
+ // output and stripping it would silently delete the last section of the report.
3619
3621
 
3620
3622
  // Fallback: if LLM returned empty and we have tool data, send it directly
3621
3623
  if (!isCanvasAgent && !fullOutputClean && toolData) {
@@ -3927,31 +3929,59 @@ DELIBERATION ROUND 2 — REFINEMENT:
3927
3929
  sendTok2(`[Parlamento — Round 2 convergenza: ${(r2Convergence * 100).toFixed(0)}%] `);
3928
3930
  const converged = r2Convergence >= 0.30;
3929
3931
 
3930
- // Round 3: mediation only if still divergent
3932
+ // Round 3: HERALD always produces the final unified synthesis.
3933
+ // If converged: synthesize the consensus + surface any surviving divergences.
3934
+ // If divergent: actively mediate and make editorial choices.
3931
3935
  let mediationOutput = '';
3932
- if (!converged) {
3933
- sendTok2('[Parlamento — Round 3: Mediazione...] ');
3936
+ {
3934
3937
  const allR2Ctx = r2Results
3935
- .map(r => `## ${r.label || r.agent}:\n${r.output.slice(0, 1500)}`)
3938
+ .map(r => `## ${r.label || r.agent}:\n${r.output.slice(0, 2000)}`)
3936
3939
  .join('\n\n---\n\n');
3940
+
3941
+ // Extract [CONTRADICTION] tags from R2 outputs to surface them explicitly
3942
+ const contradictions = [];
3943
+ for (const r of r2Results) {
3944
+ const matches = r.output.match(/\[CONTRADICTION\][^\n]*/g) || [];
3945
+ matches.forEach(m => contradictions.push(`- ${r.label || r.agent}: ${m.replace('[CONTRADICTION]', '').trim()}`));
3946
+ }
3947
+ const contradictionBlock = contradictions.length > 0
3948
+ ? `\n\n## DIVERGENZE RILEVATE DAL ROUND 2:\n${contradictions.join('\n')}`
3949
+ : '';
3950
+
3951
+ if (!converged) {
3952
+ sendTok2('[Parlamento — Round 3: Mediazione HERALD...] ');
3953
+ } else {
3954
+ sendTok2('[Parlamento — Round 3: Sintesi finale HERALD...] ');
3955
+ }
3956
+
3957
+ const medTask = converged
3958
+ ? `SYNTHESIS TASK (convergenza ${(r2Convergence * 100).toFixed(0)}% — agenti sostanzialmente d'accordo):
3959
+ 1. Presenta il CONSENSO raggiunto — cosa tutti gli agenti concordano
3960
+ 2. Segnala esplicitamente ogni sfumatura o punto di divergenza residua, nominando l'agente che la ha sollevata e perché è stata inclusa o scartata
3961
+ 3. Produci un executive summary unificato con azioni concrete per: ${task}
3962
+ 4. Includi una sezione "Voci dissonanti" se esistono posizioni che meritano attenzione nonostante la convergenza`
3963
+ : `MEDIATION TASK (convergenza ${(r2Convergence * 100).toFixed(0)}% — divergenza significativa):
3964
+ 1. Identifica i punti di ACCORDO tra tutti gli agenti
3965
+ 2. Per ogni disaccordo: valuta quale posizione ha evidenze più solide, NOMINA l'agente che ha sollevato la posizione minoritaria e spiega perché è stata accolta o scartata
3966
+ 3. Produci una sintesi UNIFICATA preservando gli insight genuini di ogni agente
3967
+ 4. Fai scelte editoriali nette — NON miscelare ciecamente posizioni incompatibili
3968
+ 5. Output: executive summary completo con azioni concrete per: ${task}`;
3969
+
3937
3970
  const medSys = `You are HERALD, the Parliament Mediator in NHA Studio. Today is ${today}. Respond entirely in ${language}.
3938
3971
 
3939
3972
  ## WORKFLOW GOAL: ${task}
3940
3973
 
3941
3974
  ## ALL AGENTS' REFINED POSITIONS (Round 2):
3942
- ${allR2Ctx}
3943
-
3944
- MEDIATION TASK:
3945
- 1. Identify core points of AGREEMENT across all agents
3946
- 2. For each disagreement, evaluate which position has stronger evidence
3947
- 3. Produce a UNIFIED synthesis preserving genuine insights from each agent
3948
- 4. Make clear editorial choices — do NOT blend blindly
3949
- 5. Output a complete executive summary with concrete action items for: ${task}`;
3975
+ ${allR2Ctx}${contradictionBlock}
3976
+
3977
+ ${medTask}
3978
+
3979
+ CRITICAL: Every agent's contribution must be traceable in the final synthesis. If an agent raised a point that was NOT incorporated, explicitly state why. The reader must understand WHO said WHAT and WHETHER it was listened to.`;
3950
3980
  try {
3951
- await callLLMStream(config, medSys, 'Produce the mediated Parliament consensus.',
3981
+ await callLLMStream(config, medSys, 'Produce the Parliament final synthesis.',
3952
3982
  (tok) => { mediationOutput += tok; }, { max_tokens: 6144 });
3953
3983
  } catch (e) { mediationOutput = ''; }
3954
- sendEv2({ deliberation_r3: { output: mediationOutput } });
3984
+ sendEv2({ deliberation_r3: { output: mediationOutput, converged } });
3955
3985
  }
3956
3986
 
3957
3987
  clearInterval(keepaliveD);
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.5.22';
8
+ export const VERSION = '13.5.24';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -3325,7 +3325,7 @@ var studioAbortController = null;
3325
3325
  var parlActiveAgent = null; // active agent label during parliament streaming
3326
3326
  var parlDoneAgents = {}; // set of completed agent labels during parliament
3327
3327
  var _parlPersistHtml = null; // persists parliament block HTML across tab navigations
3328
- var _PARL_STAMP = '<!--nha-parl-v13.5.22-->';
3328
+ var _PARL_STAMP = '<!--nha-parl-v13.5.24-->';
3329
3329
 
3330
3330
  function stopStudio() {
3331
3331
  if (!studioState.running) return;
@@ -5157,7 +5157,8 @@ async function runStudio() {
5157
5157
  context = r2d.output || context;
5158
5158
  } else if (dev.deliberation_r3) {
5159
5159
  renderParlBlock(\x27r3\x27, null, null);
5160
- studioLog(\x27HERALD\x27, \x27&#128295;\x27, \x27[Mediazione] \x27 + (dev.deliberation_r3.output || \x27\x27), \x27system\x27, true);
5160
+ var r3label = dev.deliberation_r3.converged ? \x27[Sintesi Consiglio] \x27 : \x27[Mediazione] \x27;
5161
+ studioLog(\x27HERALD\x27, \x27&#128295;\x27, r3label + (dev.deliberation_r3.output || \x27\x27), \x27system\x27, true);
5161
5162
  studioAddTokens(0, Math.ceil((dev.deliberation_r3.output||'').length / 4));
5162
5163
  context = dev.deliberation_r3.output || context;
5163
5164
  } else if (dev.deliberation_done) {