nothumanallowed 13.5.40 → 13.5.42

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.40",
3
+ "version": "13.5.42",
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": {
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.40';
8
+ export const VERSION = '13.5.42';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -6239,7 +6239,7 @@ function renderWebCraft(el) {
6239
6239
  var authFieldsHtml = wcState.authFields.map(function(f,i){
6240
6240
  return '<div style="display:flex;align-items:center;gap:6px;padding:5px 8px;background:var(--bg3);border-radius:6px;margin-bottom:4px">' +
6241
6241
  '<input value="'+wcEsc(f.label)+'" onchange="wcUpdateField('+i+',this.value)" style="flex:1;background:transparent;border:none;color:var(--text);font-size:11px;font-family:var(--mono)" />' +
6242
- '<select onchange="wcUpdateFieldType('+i+',this.value)" style="background:var(--bg2);border:1px solid var(--border);border-radius:4px;color:var(--dim);font-size:10px;padding:2px 4px">' +
6242
+ '<select onchange="wcUpdateFieldType('+i+',this.value)" style="background:var(--bg2);border:1px solid var(--border);border-radius:4px;color:var(--dim);font-size:10px;padding:2px 4px;max-width:72px;flex-shrink:0">' +
6243
6243
  ['text','email','password','tel','date','number'].map(function(t){return '<option value="'+t+'"'+(f.type===t?' selected':'')+'>'+t+'</option>'}).join('') +
6244
6244
  '</select>' +
6245
6245
  '<input type="checkbox"'+(f.required?' checked':'')+' onchange="wcToggleRequired('+i+',this.checked)" title="Required" style="accent-color:var(--green3)">' +
@@ -6422,7 +6422,7 @@ async function wcGenerate() {
6422
6422
  for (var fi = 0; fi < filePlan.length; fi++) {
6423
6423
  var fp = filePlan[fi];
6424
6424
  var runBtn = document.getElementById('wcRunBtn');
6425
- if (runBtn) runBtn.textContent = '&#9203; '+t('wc_generating')+' ' + fp.name + ' (' + (fi+1) + '/' + filePlan.length + ')...';
6425
+ if (runBtn) runBtn.innerHTML = '&#9203; '+t('wc_generating')+' ' + fp.name + ' (' + (fi+1) + '/' + filePlan.length + ')...';
6426
6426
  try {
6427
6427
  var _nl2 = String.fromCharCode(10);
6428
6428
  var content = await wcCallLLM(sysPreamble, fp.prompt + _nl2 + _nl2 + 'File to generate: ' + fp.name);
@@ -6445,7 +6445,7 @@ async function wcGenerate() {
6445
6445
  }
6446
6446
 
6447
6447
  async function wcCallLLM(sys, user) {
6448
- var r = await fetch(API + '/studio/webcraft', {
6448
+ var r = await fetch(API + '/api/studio/webcraft', {
6449
6449
  method: 'POST',
6450
6450
  headers: {'Content-Type':'application/json'},
6451
6451
  body: JSON.stringify({system: sys, user: user, max_tokens: 4096})
@@ -6457,22 +6457,89 @@ async function wcCallLLM(sys, user) {
6457
6457
 
6458
6458
  function wcDownloadZip() {
6459
6459
  if (!wcState.generatedFiles.length) return;
6460
- // Build a simple ZIP using JSZip-free approach: store as individual downloads or use blob trick
6461
- // Since we have no JSZip, we offer each file as a combined text archive (tar-like) with clear separators
6462
- var lines = ['# ' + (wcState.projectName || 'project') + ' — Generated by NHA WebCraft', '# Extract manually or use: csplit or awk to split by === FILE: markers', ''];
6460
+ // Build a real ZIP file (PKZIP format, stored/no compression) zero dependencies
6461
+ var enc = new TextEncoder();
6462
+ var parts = [];
6463
+ var centralDir = [];
6464
+ var offset = 0;
6463
6465
  wcState.generatedFiles.forEach(function(f) {
6464
- lines.push('=== FILE: ' + f.name + ' ===');
6465
- lines.push(f.content);
6466
- lines.push('=== END: ' + f.name + ' ===');
6467
- lines.push('');
6466
+ var namBytes = enc.encode(f.name);
6467
+ var dataBytes = enc.encode(f.content);
6468
+ // Local file header
6469
+ var lfh = new Uint8Array(30 + namBytes.length);
6470
+ var lv = new DataView(lfh.buffer);
6471
+ lv.setUint32(0, 0x04034b50, true); // signature
6472
+ lv.setUint16(4, 20, true); // version needed
6473
+ lv.setUint16(6, 0, true); // flags
6474
+ lv.setUint16(8, 0, true); // compression: stored
6475
+ lv.setUint16(10, 0, true); // mod time
6476
+ lv.setUint16(12, 0, true); // mod date
6477
+ var crc = wcCrc32(dataBytes);
6478
+ lv.setUint32(14, crc, true);
6479
+ lv.setUint32(18, dataBytes.length, true);
6480
+ lv.setUint32(22, dataBytes.length, true);
6481
+ lv.setUint16(26, namBytes.length, true);
6482
+ lv.setUint16(28, 0, true);
6483
+ lfh.set(namBytes, 30);
6484
+ // Central directory entry
6485
+ var cde = new Uint8Array(46 + namBytes.length);
6486
+ var cv = new DataView(cde.buffer);
6487
+ cv.setUint32(0, 0x02014b50, true); // signature
6488
+ cv.setUint16(4, 20, true); // version made by
6489
+ cv.setUint16(6, 20, true); // version needed
6490
+ cv.setUint16(8, 0, true); // flags
6491
+ cv.setUint16(10, 0, true); // compression
6492
+ cv.setUint16(12, 0, true); // mod time
6493
+ cv.setUint16(14, 0, true); // mod date
6494
+ cv.setUint32(16, crc, true);
6495
+ cv.setUint32(20, dataBytes.length, true);
6496
+ cv.setUint32(24, dataBytes.length, true);
6497
+ cv.setUint16(28, namBytes.length, true);
6498
+ cv.setUint16(30, 0, true); // extra
6499
+ cv.setUint16(32, 0, true); // comment
6500
+ cv.setUint16(34, 0, true); // disk start
6501
+ cv.setUint16(36, 0, true); // internal attr
6502
+ cv.setUint32(38, 0, true); // external attr
6503
+ cv.setUint32(42, offset, true); // local header offset
6504
+ cde.set(namBytes, 46);
6505
+ parts.push(lfh, dataBytes);
6506
+ centralDir.push(cde);
6507
+ offset += lfh.length + dataBytes.length;
6468
6508
  });
6469
- var blob = new Blob([lines.join(String.fromCharCode(10))], {type:'text/plain'});
6509
+ var cdSize = centralDir.reduce(function(s,c){return s+c.length;},0);
6510
+ var eocd = new Uint8Array(22);
6511
+ var ev = new DataView(eocd.buffer);
6512
+ ev.setUint32(0, 0x06054b50, true);
6513
+ ev.setUint16(4, 0, true);
6514
+ ev.setUint16(6, 0, true);
6515
+ ev.setUint16(8, centralDir.length, true);
6516
+ ev.setUint16(10, centralDir.length, true);
6517
+ ev.setUint32(12, cdSize, true);
6518
+ ev.setUint32(16, offset, true);
6519
+ ev.setUint16(20, 0, true);
6520
+ var all = parts.concat(centralDir).concat([eocd]);
6521
+ var total = all.reduce(function(s,b){return s+b.length;},0);
6522
+ var out = new Uint8Array(total);
6523
+ var pos = 0;
6524
+ all.forEach(function(b){out.set(b,pos);pos+=b.length;});
6525
+ var blob = new Blob([out], {type:'application/zip'});
6470
6526
  var a = document.createElement('a');
6471
6527
  a.href = URL.createObjectURL(blob);
6472
- a.download = (wcState.projectName || 'project') + '-webcraft.txt';
6528
+ a.download = (wcState.projectName || 'project') + '-webcraft.zip';
6473
6529
  a.click();
6474
6530
  URL.revokeObjectURL(a.href);
6475
6531
  }
6532
+ function wcCrc32(buf) {
6533
+ var table = wcCrc32.t;
6534
+ if (!table) {
6535
+ table = new Uint32Array(256);
6536
+ for (var i=0;i<256;i++){var c=i;for(var k=0;k<8;k++)c=c&1?(0xEDB88320^(c>>>1)):(c>>>1);table[i]=c;}
6537
+ wcCrc32.t = table;
6538
+ }
6539
+ var crc = 0xFFFFFFFF;
6540
+ for (var j=0;j<buf.length;j++) crc = table[(crc^buf[j])&0xFF]^(crc>>>8);
6541
+ return (crc^0xFFFFFFFF)>>>0;
6542
+ }
6476
6543
  `;
6477
6544
 
6478
6545
  export function getHTML(port) {