nothumanallowed 12.3.0 → 12.4.0

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": "12.3.0",
3
+ "version": "12.4.0",
4
4
  "description": "NotHumanAllowed — 38 AI agents, 80 tools. 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": {
@@ -1785,6 +1785,7 @@ export async function cmdUI(args) {
1785
1785
  // Parse and execute tools
1786
1786
  const { textParts, actions } = parseActions(fullResponse);
1787
1787
  const toolResults = [];
1788
+ let inlineEmbeds = ''; // Accumulated inline cards/browser frames for the response
1788
1789
 
1789
1790
  // Auto-detect search + screenshot intent from user message
1790
1791
  const wantsScreenshot = /screenshot|screen\s*shot|schermo|cattura|foto|immagine/i.test(msg);
@@ -1949,12 +1950,9 @@ export async function cmdUI(args) {
1949
1950
  });
1950
1951
  cardHtml += '</div>';
1951
1952
 
1952
- // Append inline markers to the tool result so they end up in the response
1953
- if (inlineBrowserMarker || cardHtml.length > 50) {
1954
- const inlineMarkers = (inlineBrowserMarker ? inlineBrowserMarker + '\n' : '') + '[INLINE_CARD]' + cardHtml + '[/INLINE_CARD]';
1955
- // Append to the last tool result so LLM includes it in response
1956
- toolResults[toolResults.length - 1].result += '\n' + inlineMarkers;
1957
- }
1953
+ // Accumulate inline embeds will be appended to final response AFTER LLM
1954
+ if (inlineBrowserMarker) inlineEmbeds += '\n' + inlineBrowserMarker;
1955
+ if (cardHtml.length > 50) inlineEmbeds += '\n[INLINE_CARD]' + cardHtml + '[/INLINE_CARD]';
1958
1956
  } catch { /* non-critical */ }
1959
1957
  }
1960
1958
 
@@ -2076,6 +2074,9 @@ export async function cmdUI(args) {
2076
2074
  // Extract memory
2077
2075
  try { extractMemory('chat', msg, finalResponse); } catch {}
2078
2076
 
2077
+ // Append inline embeds (search cards, browser frames) to the response
2078
+ if (inlineEmbeds) finalResponse += '\n' + inlineEmbeds;
2079
+
2079
2080
  const ssFiles = res._screenshotFiles || [];
2080
2081
  const browserThumbs = res._browserThumbs || [];
2081
2082
  sendSSE('done', { content: finalResponse, screenshotFiles: ssFiles, browserThumbs });
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 = '12.3.0';
8
+ export const VERSION = '12.4.0';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -364,7 +364,16 @@ TOOLS:
364
364
 
365
365
  64. canvas_render(html: string, title?: string)
366
366
  Render HTML in the web UI canvas panel. Show charts, tables, diagrams, reports.
367
- Can use Chart.js, Mermaid, or any CDN library via script tags.
367
+ ALWAYS use Chart.js from CDN for charts and graphs never build charts with raw HTML/CSS.
368
+ Template for charts:
369
+ <html><head><script src="https://cdn.jsdelivr.net/npm/chart.js@4"></script></head>
370
+ <body style="background:#0a0a0a;padding:20px;margin:0">
371
+ <canvas id="c" style="max-height:400px"></canvas>
372
+ <script>new Chart(document.getElementById('c'),{type:'bar',data:{labels:['A','B'],datasets:[{label:'Data',data:[10,20],backgroundColor:['#00ff41','#00e5ff']}]},options:{plugins:{legend:{labels:{color:'#ccc'}}},scales:{x:{ticks:{color:'#888'}},y:{ticks:{color:'#888'}}}}});</script>
373
+ </body></html>
374
+ Supported chart types: bar, line, pie, doughnut, radar, polarArea, scatter, bubble.
375
+ Use dark theme: background #0a0a0a, text #ccc, grid #333, accent colors #00ff41 #00e5ff #ffaa00 #ff4444 #a78bfa.
376
+ For tables: use proper HTML tables with dark styling. For Mermaid diagrams: load from CDN.
368
377
 
369
378
  65. canvas_clear()
370
379
  Clear the canvas panel.
@@ -726,6 +726,51 @@ function reopenCanvas(){
726
726
  renderCanvasPanel();
727
727
  }
728
728
  function closeCanvas(){var p=document.getElementById('canvasPanel');if(p)p.classList.remove('open');}
729
+ function canvasCopyText(){
730
+ var d=getConvCanvasData();var item=d.canvases[canvasIdx];
731
+ if(!item){alert('No canvas content');return;}
732
+ // Extract text from the HTML
733
+ var tmp=document.createElement('div');tmp.innerHTML=item.html.replace(/<script[\s\S]*?<\/script>/gi,'');
734
+ var text=tmp.textContent||tmp.innerText||'';
735
+ navigator.clipboard.writeText(text).then(function(){alert('Text copied!')}).catch(function(){alert('Copy failed')});
736
+ }
737
+ function canvasCopyHTML(){
738
+ var d=getConvCanvasData();var item=d.canvases[canvasIdx];
739
+ if(!item){alert('No canvas content');return;}
740
+ navigator.clipboard.writeText(item.html).then(function(){alert('HTML source copied!')}).catch(function(){alert('Copy failed')});
741
+ }
742
+ function canvasCopyImage(){
743
+ var f=document.getElementById('canvasFrame');
744
+ if(!f){alert('No canvas frame');return;}
745
+ try{
746
+ // Use html2canvas approach — render iframe to canvas then copy
747
+ var iframe=f;
748
+ // For sandboxed iframes, we capture via srcdoc render
749
+ var w=iframe.offsetWidth||800;var h=iframe.offsetHeight||400;
750
+ var canvas=document.createElement('canvas');canvas.width=w*2;canvas.height=h*2;
751
+ var ctx=canvas.getContext('2d');ctx.scale(2,2);
752
+ // Draw white background
753
+ ctx.fillStyle='#0a0a0a';ctx.fillRect(0,0,w,h);
754
+ // Render the srcdoc HTML to an image via SVG foreignObject
755
+ var d=getConvCanvasData();var item=d.canvases[canvasIdx];
756
+ if(!item){alert('No canvas');return;}
757
+ var svg='<svg xmlns="http://www.w3.org/2000/svg" width="'+w+'" height="'+h+'"><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml" style="background:#0a0a0a">'+item.html.replace(/<script[\s\S]*?<\/script>/gi,'')+'</div></foreignObject></svg>';
758
+ var img=new Image();
759
+ img.onload=function(){
760
+ ctx.drawImage(img,0,0,w,h);
761
+ canvas.toBlob(function(blob){
762
+ if(blob){
763
+ navigator.clipboard.write([new ClipboardItem({'image/png':blob})]).then(function(){alert('Image copied!')}).catch(function(){
764
+ // Fallback: download
765
+ var a=document.createElement('a');a.href=URL.createObjectURL(blob);a.download='canvas.png';a.click();
766
+ });
767
+ }
768
+ },'image/png');
769
+ };
770
+ img.onerror=function(){alert('Image render failed — try Copy HTML instead');};
771
+ img.src='data:image/svg+xml;charset=utf-8,'+encodeURIComponent(svg);
772
+ }catch(e){alert('Image copy failed: '+e.message);}
773
+ }
729
774
  function toggleCanvasSize(){
730
775
  var p=document.getElementById('canvasPanel');if(!p)return;
731
776
  if(p.style.width==='80vw'){p.style.width='';p.style.height='';p.style.top='';p.style.right='';}
@@ -2704,7 +2749,7 @@ init();
2704
2749
  </div>
2705
2750
  </div>
2706
2751
 
2707
- <div id="canvasPanel"><div class="cvs-header"><div style="display:flex;align-items:center;gap:8px"><button id="canvasTabC" onclick="canvasShowCanvas()" style="background:none;border:none;border-bottom:2px solid var(--green);color:var(--green);cursor:pointer;font-family:var(--mono);font-size:11px;padding:2px 6px">Canvas</button><button id="canvasTabB" onclick="canvasShowBrowser()" style="background:none;border:none;color:var(--dim);cursor:pointer;font-family:var(--mono);font-size:11px;padding:2px 6px">Browser</button><span id="canvasTitle" style="font-family:var(--mono);color:var(--green);font-size:11px;margin-left:8px">Canvas</span></div><div style="display:flex;align-items:center;gap:4px"><span id="canvasNav" style="display:none;gap:4px"><button onclick="canvasPrev()" style="background:none;border:none;color:var(--dim);cursor:pointer;font-size:14px" title="Previous">&#x25C0;</button><button onclick="canvasNext()" style="background:none;border:none;color:var(--dim);cursor:pointer;font-size:14px" title="Next">&#x25B6;</button></span><button onclick="toggleCanvasSize()" style="background:none;border:none;color:var(--dim);cursor:pointer;font-size:14px" title="Resize">&#x2922;</button><button onclick="closeCanvas()" style="background:none;border:none;color:var(--dim);cursor:pointer;font-size:14px" title="Close">&times;</button></div></div><iframe id="canvasFrame" sandbox="allow-scripts" srcdoc=""></iframe></div>
2752
+ <div id="canvasPanel"><div class="cvs-header"><div style="display:flex;align-items:center;gap:8px"><button id="canvasTabC" onclick="canvasShowCanvas()" style="background:none;border:none;border-bottom:2px solid var(--green);color:var(--green);cursor:pointer;font-family:var(--mono);font-size:11px;padding:2px 6px">Canvas</button><button id="canvasTabB" onclick="canvasShowBrowser()" style="background:none;border:none;color:var(--dim);cursor:pointer;font-family:var(--mono);font-size:11px;padding:2px 6px">Browser</button><span id="canvasTitle" style="font-family:var(--mono);color:var(--green);font-size:11px;margin-left:8px">Canvas</span></div><div style="display:flex;align-items:center;gap:4px"><span id="canvasNav" style="display:none;gap:4px"><button onclick="canvasPrev()" style="background:none;border:none;color:var(--dim);cursor:pointer;font-size:14px" title="Previous">&#x25C0;</button><button onclick="canvasNext()" style="background:none;border:none;color:var(--dim);cursor:pointer;font-size:14px" title="Next">&#x25B6;</button></span><button onclick="canvasCopyText()" style="background:none;border:none;color:var(--dim);cursor:pointer;font-size:11px;font-family:var(--mono)" title="Copy text content">Copy</button><button onclick="canvasCopyHTML()" style="background:none;border:none;color:var(--dim);cursor:pointer;font-size:11px;font-family:var(--mono)" title="Copy HTML source">HTML</button><button onclick="canvasCopyImage()" style="background:none;border:none;color:var(--dim);cursor:pointer;font-size:11px;font-family:var(--mono)" title="Copy as image">IMG</button><button onclick="toggleCanvasSize()" style="background:none;border:none;color:var(--dim);cursor:pointer;font-size:14px" title="Resize">&#x2922;</button><button onclick="closeCanvas()" style="background:none;border:none;color:var(--dim);cursor:pointer;font-size:14px" title="Close">&times;</button></div></div><iframe id="canvasFrame" sandbox="allow-scripts" srcdoc=""></iframe></div>
2708
2753
  <script>${JS}</script>
2709
2754
  </body>
2710
2755
  </html>`;