nothumanallowed 13.5.198 → 13.5.200

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.198",
3
+ "version": "13.5.200",
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": {
@@ -3349,6 +3349,8 @@ export async function cmdUI(args) {
3349
3349
  const body = await parseBody(req);
3350
3350
  const task = (body.task || '').trim();
3351
3351
  if (!task) { sendJSON(res, 400, { error: 'task required' }); logRequest(method, pathname, 400, Date.now() - start); return; }
3352
+ // Reload config so provider changes take effect immediately
3353
+ const config = loadConfig();
3352
3354
 
3353
3355
  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'; })();
3354
3356
 
@@ -3574,6 +3576,9 @@ Rules:
3574
3576
  // ── Studio: run single step (SSE streaming) ──────────────────────
3575
3577
  if (pathname === '/api/studio/run' && method === 'POST') {
3576
3578
  const body = await parseBody(req, 4_194_304); // 4MB — context can be up to 120KB + task + PDF
3579
+ // Reload config on every request so provider/model/apiKey changes take effect immediately
3580
+ // (the top-level `config` is loaded once at startup and would be stale otherwise)
3581
+ const config = loadConfig();
3577
3582
  const { agent, task, context, stepDef } = body;
3578
3583
  const stepPdfBase64 = body.pdfBase64 || null;
3579
3584
  const stepPdfName = body.pdfName || null;
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.198';
8
+ export const VERSION = '13.5.200';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -5199,8 +5199,29 @@ function downloadStudioPDF() {
5199
5199
  var nodes = studioState.nodes || [];
5200
5200
  var fileName = (task).slice(0, 60).replace(/[^a-z0-9\s]/gi,'').trim().replace(/\s+/g,'-') || 'NHA-Studio';
5201
5201
 
5202
- // Always generate the full Studio PDF with all agent outputs.
5203
- // The canvas panel is already open for the HTML dashboard PDF = complete structured report.
5202
+ // When a canvas HTML report exists, print IT directly — it's already pixel-perfect with
5203
+ // charts, tables and @media print CSS. No need to rebuild from markdown.
5204
+ if (studioState.canvas) {
5205
+ // Open canvas HTML in a new window and print it there.
5206
+ // window.open() allows CDN scripts (Chart.js) to fully execute before print —
5207
+ // unlike a hidden off-screen iframe which browsers block for printing.
5208
+ var printWin = window.open('', '_blank', 'width=1100,height=800');
5209
+ if (printWin) {
5210
+ printWin.document.open();
5211
+ printWin.document.write(studioState.canvas);
5212
+ printWin.document.close();
5213
+ // Wait for Chart.js to render all charts, then trigger print dialog
5214
+ printWin.addEventListener('load', function() {
5215
+ setTimeout(function() {
5216
+ printWin.focus();
5217
+ printWin.print();
5218
+ }, 2000);
5219
+ });
5220
+ }
5221
+ return;
5222
+ }
5223
+
5224
+ // No canvas — generate the full text-based Studio PDF from agent markdown outputs.
5204
5225
 
5205
5226
  // ── Markdown → HTML for PDF (full support: tables, lists, headers, inline) ──
5206
5227
  function mdToPdfHtml(raw) {
@@ -6712,10 +6733,10 @@ function renderStudioSessionsBar() {
6712
6733
  '</div>' +
6713
6734
  '<div style="max-height:240px;overflow-y:auto;padding-right:2px;display:flex;flex-direction:column;gap:6px">' +
6714
6735
  sessions.map(function(s,i) {
6715
- return '<div style="background:#1e293b;border:1px solid #334155;border-radius:8px;padding:10px 12px">' +
6716
- '<div style="display:flex;align-items:flex-start;justify-content:space-between;gap:8px;margin-bottom:7px">' +
6717
- '<span style="font-size:11px;color:#f1f5f9;font-weight:600;line-height:1.4;flex:1">' + esc(s.task.slice(0,65)) + (s.task.length>65?'...':'') + '</span>' +
6718
- '<button onclick="deleteStudioSession('+i+')" style="flex-shrink:0;font-size:14px;line-height:1;background:none;border:none;color:#64748b;cursor:pointer;padding:0 2px" title="Delete">&times;</button>' +
6736
+ return '<div style="background:#1e293b;border:1px solid #334155;border-radius:8px;padding:10px 12px;position:relative">' +
6737
+ '<button onclick="deleteStudioSession('+i+')" style="position:absolute;top:6px;right:6px;width:24px;height:24px;display:flex;align-items:center;justify-content:center;font-size:15px;line-height:1;background:#1e293b;border:1px solid #475569;border-radius:50%;color:#94a3b8;cursor:pointer;flex-shrink:0;z-index:1" title="Elimina sessione">&times;</button>' +
6738
+ '<div style="padding-right:28px;margin-bottom:7px">' +
6739
+ '<span style="font-size:11px;color:#f1f5f9;font-weight:600;line-height:1.4">' + esc(s.task.slice(0,65)) + (s.task.length>65?'...':'') + '</span>' +
6719
6740
  '</div>' +
6720
6741
  '<div style="font-size:10px;color:#64748b;margin-bottom:8px">' + esc(s.ts) + '</div>' +
6721
6742
  '<div style="display:flex;gap:6px">' +
@@ -6828,13 +6849,24 @@ function restoreStudioSession(idx) {
6828
6849
  // Restore canvas if present
6829
6850
  if (s.canvas) {
6830
6851
  studioState.canvas = s.canvas;
6831
- // Use showCanvas() so allCanvasData is keyed correctly (activeConvId || '_default')
6832
- // and renderCanvasPanel() is called, loading the iframe properly
6833
- showCanvas(s.canvas, 'Studio Report: ' + s.task.slice(0, 50));
6834
- var scb = document.getElementById('studioCanvasBtn');
6835
- if (scb) scb.style.display = '';
6852
+ // Store in allCanvasData under the active conv key (same key getConvCanvasData() uses)
6853
+ var _restoreKey = activeConvId || '_default';
6854
+ if (!allCanvasData[_restoreKey]) allCanvasData[_restoreKey] = {canvases:[], browsers:[]};
6855
+ var _restoreData = allCanvasData[_restoreKey];
6856
+ var _existRestoreIdx = _restoreData.canvases.findIndex(function(c){ return c.title === 'Studio Report'; });
6857
+ var _restoreItem = {html: s.canvas, title: 'Studio Report', ts: s.ts || ''};
6858
+ if (_existRestoreIdx >= 0) { _restoreData.canvases[_existRestoreIdx] = _restoreItem; canvasIdx = _existRestoreIdx; }
6859
+ else { _restoreData.canvases.push(_restoreItem); canvasIdx = _restoreData.canvases.length - 1; }
6860
+ canvasMode = 'canvas';
6861
+ _canvasFrameLoadedHtml = null; // force iframe reload
6862
+ var cf = document.getElementById('canvasFrame');
6863
+ var cp = document.getElementById('canvasPanel');
6864
+ if (cf) cf.srcdoc = s.canvas;
6865
+ if (cp) cp.classList.add('open');
6836
6866
  var ct = document.getElementById('canvasTitle');
6837
6867
  if (ct) ct.textContent = 'Studio Report';
6868
+ var scb = document.getElementById('studioCanvasBtn');
6869
+ if (scb) { scb.style.display = ''; scb.style.background = 'var(--greendim)'; scb.style.borderColor = 'var(--green3)'; scb.style.color = 'var(--green)'; }
6838
6870
  }
6839
6871
  showToast('success', 'Session restored', s.task.slice(0, 60), 3000);
6840
6872
  }