nothumanallowed 13.5.148 → 13.5.150

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.148",
3
+ "version": "13.5.150",
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": {
@@ -570,8 +570,9 @@ function formatToolResult(action, params, result) {
570
570
  export async function cmdChat(args) {
571
571
  const config = loadConfig();
572
572
 
573
- if (!config.llm.apiKey) {
574
- fail('No API key configured. Run: nha config set key YOUR_KEY');
573
+ const activeProvider = config.llm.provider || 'anthropic';
574
+ if (activeProvider !== 'nha' && !config.llm.apiKey) {
575
+ fail('No API key configured. Run: nha config set key YOUR_KEY\n Or use the free tier: nha config set provider nha');
575
576
  process.exit(1);
576
577
  }
577
578
 
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.148';
8
+ export const VERSION = '13.5.150';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -5276,6 +5276,21 @@ function downloadStudioPDF() {
5276
5276
  // ── Sections ─────────────────────────────────────────────────────────────
5277
5277
  sectionsHtml +
5278
5278
 
5279
+ // ── Charts / Canvas section (from CanvasAgent HTML) ──────────────────────
5280
+ (studioState.canvas ? (
5281
+ '<div class="section" style="page-break-before:always">' +
5282
+ '<div class="agent-header"><span class="agent-icon">&#128202;</span>' +
5283
+ '<div><div class="agent-name">Grafici e Dashboard</div>' +
5284
+ '<div class="agent-sub">CANVAS AGENT &nbsp;&#183;&nbsp; Visualizzazioni dati</div></div>' +
5285
+ '</div>' +
5286
+ '<div id="nha-canvas-charts" style="width:100%;overflow:hidden">' +
5287
+ studioState.canvas
5288
+ .replace(new RegExp('<script[^>]*>[\\s\\S]*?<\\/script>', 'gi'), '')
5289
+ .replace(new RegExp('<html[^>]*>|<\\/html>|<head[\\s\\S]*?<\\/head>|<body[^>]*>|<\\/body>', 'gi'), '') +
5290
+ '</div>' +
5291
+ '</div>'
5292
+ ) : '') +
5293
+
5279
5294
  // ── Footer ───────────────────────────────────────────────────────────────
5280
5295
  '<div class="footer-bar">' +
5281
5296
  '<span class="footer-left">NHA Studio &nbsp;&#183;&nbsp; nothumanallowed.com</span>' +
@@ -5283,6 +5298,32 @@ function downloadStudioPDF() {
5283
5298
  (totalTokensIn > 0 ? ' &nbsp;&#183;&nbsp; ' + totalTokensIn.toLocaleString() + ' token in / ' + totalTokensOut.toLocaleString() + ' out' : '') +
5284
5299
  '</span>' +
5285
5300
  '</div>' +
5301
+
5302
+ // ── Canvas-to-image script: converts <canvas> → <img> before printing ────
5303
+ // This runs inside the iframe, ensuring charts are visible in the PDF.
5304
+ '<script>' +
5305
+ 'window.addEventListener("load", function() {' +
5306
+ // Give Chart.js time to render all charts
5307
+ 'setTimeout(function() {' +
5308
+ 'function freezeCanvases() {' +
5309
+ 'var canvases = document.querySelectorAll("canvas");' +
5310
+ 'canvases.forEach(function(cv) {' +
5311
+ 'try {' +
5312
+ 'var img = document.createElement("img");' +
5313
+ 'img.src = cv.toDataURL("image/png");' +
5314
+ 'img.style.cssText = cv.style.cssText || "";' +
5315
+ 'img.style.maxWidth = "100%";' +
5316
+ 'img.style.display = "block";' +
5317
+ 'img.style.margin = "0 auto";' +
5318
+ 'if (cv.parentNode) cv.parentNode.replaceChild(img, cv);' +
5319
+ '} catch(e) {}' +
5320
+ '});' +
5321
+ '}' +
5322
+ 'window.addEventListener("beforeprint", freezeCanvases);' +
5323
+ '}, 1200);' +
5324
+ '});' +
5325
+ '<\/script>' +
5326
+
5286
5327
  '</body></html>';
5287
5328
 
5288
5329
  // ── Generate PDF via hidden in-page iframe ─────────────────────────────────
@@ -5310,7 +5351,8 @@ function downloadStudioPDF() {
5310
5351
 
5311
5352
  // Set up onload BEFORE appending — avoids WebKit race condition
5312
5353
  iframe.onload = function() {
5313
- // Wait for Chart.js to initialize all charts (needs ~800ms for animation frames)
5354
+ // Wait for Chart.js to initialize all charts and freezeCanvases to run (needs ~2s)
5355
+ var waitMs = studioState.canvas ? 2500 : 800;
5314
5356
  setTimeout(function() {
5315
5357
  try {
5316
5358
  iframe.contentWindow.focus();