nothumanallowed 13.5.159 → 13.5.161

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.159",
3
+ "version": "13.5.161",
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.159';
8
+ export const VERSION = '13.5.161';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -7589,6 +7589,7 @@ function renderWebCraft(el) {
7589
7589
  +'<span style="font-size:10px;color:#fde68a;font-family:var(--mono);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1" id="wcRepairFile">'+wcEsc(wcState.repairCurrent || '')+'</span>'
7590
7590
  +'<span style="font-size:10px;color:var(--dim);flex-shrink:0" id="wcRepairCounter">'+wcState.repairDone+' / '+wcState.repairTotal+'</span>'
7591
7591
  +'<span style="display:flex;gap:3px">'+[0,1,2].map(function(_,idx){ return '<span style="width:4px;height:4px;border-radius:50%;background:#facc15;animation:wcDot 1.1s ease-in-out infinite '+(idx*0.18)+'s"></span>'; }).join('')+'</span>'
7592
+ +'<button onclick="wcStopRepair()" style="padding:2px 8px;background:rgba(239,68,68,0.15);border:1px solid rgba(239,68,68,0.4);border-radius:4px;color:#f87171;font-size:10px;font-weight:700;cursor:pointer;flex-shrink:0">&#9632; Stop</button>'
7592
7593
  +'</div>'
7593
7594
  +'<div style="height:2px;background:rgba(255,255,255,0.07);border-radius:1px;overflow:hidden">'
7594
7595
  +'<div id="wcRepairProg" style="height:100%;width:'+(wcState.repairTotal>0?Math.round((wcState.repairDone/wcState.repairTotal)*100):0)+'%;background:#facc15;border-radius:1px;transition:width .3s ease"></div>'
@@ -8844,15 +8845,24 @@ async function wcGenerate() {
8844
8845
  var splitPrompts = WC_CSS_SPLIT[fp.name];
8845
8846
  if (splitPrompts) {
8846
8847
  // Two-pass generation: streaming on first pass only
8847
- var part1 = await wcCallLLM(sysPreamble, splitPrompts[0] + _nl2 + _nl2 + 'File: ' + fp.name, signal, fp.lang, 8192, onLiveUpdate);
8848
+ var part1 = await wcCallLLM(sysPreamble, splitPrompts[0] + _nl2 + _nl2 + 'File: ' + fp.name, signal, fp.lang, 8192, onLiveUpdate, fp.name);
8848
8849
  part1 = wcStripFences(part1);
8849
8850
  if (signal && signal.aborted) return part1;
8850
- var part2 = await wcCallLLM(sysPreamble, splitPrompts[1] + _nl2 + _nl2 + 'File: ' + fp.name, signal, fp.lang, 8192, function(p2) { if (onLiveUpdate) onLiveUpdate(part1 + _nl2 + _nl2 + p2); });
8851
+ var part2 = await wcCallLLM(sysPreamble, splitPrompts[1] + _nl2 + _nl2 + 'File: ' + fp.name, signal, fp.lang, 8192, function(p2) { if (onLiveUpdate) onLiveUpdate(part1 + _nl2 + _nl2 + p2); }, fp.name);
8851
8852
  part2 = wcStripFences(part2);
8852
8853
  return part1 + _nl2 + _nl2 + part2;
8853
8854
  }
8854
- var content = await wcCallLLM(sysPreamble, fp.prompt + _nl2 + _nl2 + 'File to generate: ' + fp.name, signal, fp.lang, undefined, onLiveUpdate);
8855
+ var content = await wcCallLLM(sysPreamble, fp.prompt + _nl2 + _nl2 + 'File to generate: ' + fp.name, signal, fp.lang, undefined, onLiveUpdate, fp.name);
8855
8856
  content = wcStripFences(content);
8857
+ // Detect model confusion: if output looks like a conversational reply instead of code, retry once
8858
+ var firstLine = content.trim().split(_nl2)[0] || '';
8859
+ var confusionPhrases = ['I notice', 'Could you please', 'I need to know', 'I don', 'To help you', 'Please clarify', 'I apologize', 'Unfortunately', 'As an AI'];
8860
+ var isConfused = confusionPhrases.some(function(p) { return firstLine.indexOf(p) === 0; });
8861
+ if (isConfused && !(signal && signal.aborted)) {
8862
+ var retryPrompt = 'IMPORTANT: Output ONLY the raw file content for ' + fp.name + '. No explanations, no questions, no markdown. Just the code.' + _nl2 + _nl2 + fp.prompt;
8863
+ content = await wcCallLLM(sysPreamble, retryPrompt + _nl2 + _nl2 + 'File to generate: ' + fp.name, signal, fp.lang, undefined, onLiveUpdate, fp.name);
8864
+ content = wcStripFences(content);
8865
+ }
8856
8866
  // Post-process: fix LLM streaming artifacts (spaces inserted inside keywords/identifiers)
8857
8867
  if (fp.lang === 'javascript' || fp.lang === 'typescript') {
8858
8868
  // Fix spaces inside JS/TS keywords that LLMs sometimes split during streaming
@@ -9023,12 +9033,17 @@ async function wcGenerate() {
9023
9033
  // ── Auto-repair pass — fixes _error and _syntaxError files ────────────────
9024
9034
  // Called automatically after generation and available as manual button
9025
9035
  var _wcRepairRunning = false;
9036
+ var _wcRepairAbortCtrl = null;
9037
+ function wcStopRepair() {
9038
+ if (_wcRepairAbortCtrl) { _wcRepairAbortCtrl.abort(); _wcRepairAbortCtrl = null; }
9039
+ }
9026
9040
  async function wcAutoRepair(filePlan, sysPreamble) {
9027
9041
  if (_wcRepairRunning) return;
9028
9042
  // Collect broken files: LLM errors + syntax errors
9029
9043
  var toFix = wcState.generatedFiles.filter(function(f){ return f._error || f._syntaxError; });
9030
9044
  if (toFix.length === 0) return;
9031
9045
 
9046
+ _wcRepairAbortCtrl = new AbortController();
9032
9047
  _wcRepairRunning = true;
9033
9048
  wcState.repairing = true;
9034
9049
  wcState.repairTotal = toFix.length;
@@ -9044,6 +9059,7 @@ async function wcAutoRepair(filePlan, sysPreamble) {
9044
9059
  var sysBase = 'You are an expert full-stack engineer. Output ONLY the complete corrected file content. No explanations, no markdown fences, no preamble. Raw file content only.';
9045
9060
 
9046
9061
  for (var ri = 0; ri < toFix.length; ri++) {
9062
+ if (_wcRepairAbortCtrl && _wcRepairAbortCtrl.signal.aborted) break;
9047
9063
  var broken = toFix[ri];
9048
9064
  var plan = planMap[broken.name];
9049
9065
  wcState.repairDone = ri;
@@ -9091,7 +9107,7 @@ async function wcAutoRepair(filePlan, sysPreamble) {
9091
9107
  // Stream repair tokens directly into the <pre>
9092
9108
  var repairAccum = '';
9093
9109
  var repairLang2 = broken.lang || (plan && plan.lang) || 'text';
9094
- var fixed = await wcCallLLM(fixSys, fixUser, null, repairLang2, 8192, function(tok) {
9110
+ var fixed = await wcCallLLM(fixSys, fixUser, _wcRepairAbortCtrl ? _wcRepairAbortCtrl.signal : null, repairLang2, 8192, function(tok) {
9095
9111
  repairAccum += tok;
9096
9112
  var pre2 = document.getElementById('wcLiveCode');
9097
9113
  if (pre2) { pre2.textContent = repairAccum; pre2.style.opacity = '1'; var cw = document.getElementById('wcCodeWrap'); if(cw) cw.scrollTop = cw.scrollHeight; }
@@ -9116,6 +9132,7 @@ async function wcAutoRepair(filePlan, sysPreamble) {
9116
9132
  }
9117
9133
 
9118
9134
  _wcRepairRunning = false;
9135
+ _wcRepairAbortCtrl = null;
9119
9136
  wcState.repairing = false;
9120
9137
  wcState.repairTotal = 0;
9121
9138
  wcState.repairDone = 0;
@@ -9294,19 +9311,21 @@ async function wcCallLLMRaw(sys, user, signal, maxTok, onToken) {
9294
9311
  }
9295
9312
  }
9296
9313
 
9297
- async function wcCallLLM(sys, user, signal, lang, maxTok, onToken) {
9314
+ async function wcCallLLM(sys, user, signal, lang, maxTok, onToken, fileName) {
9298
9315
  var content = await wcCallLLMRaw(sys, user, signal, maxTok, onToken);
9299
9316
  // Continuation loop: if response is truncated, ask model to continue (no streaming for continuations)
9300
9317
  var maxContinuations = 2;
9301
9318
  for (var ci = 0; ci < maxContinuations; ci++) {
9302
9319
  if (!wcIsTruncated(content, lang || 'text')) break;
9303
9320
  if (signal && signal.aborted) break;
9304
- var continuePrompt = 'Continue generating the file EXACTLY from where you stopped. Do not repeat anything already written. Output ONLY the remaining code, starting from the next character after where you stopped.' +
9305
- String.fromCharCode(10) + String.fromCharCode(10) + 'The file so far ends with:' +
9306
- String.fromCharCode(10) + content.slice(-300);
9321
+ var _nlc = String.fromCharCode(10);
9322
+ var continuePrompt = (fileName ? 'File: ' + fileName + _nlc + _nlc : '') +
9323
+ 'You were generating this file and ran out of tokens. The file is INCOMPLETE.' + _nlc +
9324
+ 'Continue EXACTLY from where you stopped. Output ONLY the remaining code — do NOT repeat anything already written, do NOT explain, do NOT use markdown fences.' + _nlc + _nlc +
9325
+ 'The file so far ends with (last 600 chars):' + _nlc + content.slice(-600);
9307
9326
  var continuation = await wcCallLLMRaw(sys, continuePrompt, signal, maxTok);
9308
9327
  if (!continuation || continuation.trim().length < 5) break;
9309
- content = content + String.fromCharCode(10) + continuation;
9328
+ content = content + _nlc + continuation;
9310
9329
  if (onToken) onToken(content);
9311
9330
  }
9312
9331
  return content;