nothumanallowed 9.8.3 → 9.8.4
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 +1 -1
- package/src/commands/ui.mjs +40 -7
- package/src/constants.mjs +1 -1
- package/src/services/web-ui.mjs +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "9.8.
|
|
3
|
+
"version": "9.8.4",
|
|
4
4
|
"description": "NotHumanAllowed — 38 AI agents, 53 tools. Email, calendar, browser automation, screen capture, canvas, cron/heartbeat, GitHub, Notion, Slack, voice chat, 28 languages. Zero-dependency CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/commands/ui.mjs
CHANGED
|
@@ -1095,14 +1095,35 @@ export async function cmdUI(args) {
|
|
|
1095
1095
|
fullResponse = `\n\n${fullResponse}`;
|
|
1096
1096
|
}
|
|
1097
1097
|
} else if (toolResults.length > 0) {
|
|
1098
|
-
//
|
|
1098
|
+
// Extract canvas/screenshot markers from tool results BEFORE second LLM call
|
|
1099
|
+
// These markers must be preserved in the final response for the UI to render
|
|
1100
|
+
let preservedMarkers = '';
|
|
1099
1101
|
const toolContext = toolResults.map(t => {
|
|
1100
|
-
let clean = t.result
|
|
1101
|
-
|
|
1102
|
+
let clean = t.result;
|
|
1103
|
+
// Extract and preserve canvas markers
|
|
1104
|
+
const canvasMatch = clean.match(/\[CANVAS_RENDER\][\s\S]*?\[\/CANVAS_RENDER\]/);
|
|
1105
|
+
if (canvasMatch) {
|
|
1106
|
+
preservedMarkers += canvasMatch[0] + '\n';
|
|
1107
|
+
clean = clean.replace(/\[CANVAS_RENDER\][\s\S]*?\[\/CANVAS_RENDER\]/, '').trim();
|
|
1108
|
+
}
|
|
1109
|
+
if (clean.includes('[CANVAS_CLEAR]')) {
|
|
1110
|
+
preservedMarkers += '[CANVAS_CLEAR]Canvas cleared.[/CANVAS_CLEAR]\n';
|
|
1111
|
+
clean = clean.replace(/\[CANVAS_CLEAR\][\s\S]*?\[\/CANVAS_CLEAR\]/, '').trim();
|
|
1112
|
+
}
|
|
1113
|
+
// Extract screenshot file markers
|
|
1114
|
+
const ssMatch = clean.match(/\[SCREENSHOT_FILE\].*?\[\/SCREENSHOT_FILE\]/);
|
|
1115
|
+
if (ssMatch) {
|
|
1116
|
+
preservedMarkers += ssMatch[0] + '\n';
|
|
1117
|
+
clean = clean.replace(/\[SCREENSHOT_FILE\].*?\[\/SCREENSHOT_FILE\]/, '').trim();
|
|
1118
|
+
}
|
|
1119
|
+
clean = clean.replace(/\[Screenshot[^\]]*\]/g, '').replace(/!\[.*?\]\(data:image[^)]+\)/g, '').slice(0, 3000);
|
|
1120
|
+
return `[${t.action} result]: ${clean.trim() || 'Done.'}`;
|
|
1102
1121
|
}).join('\n\n');
|
|
1103
1122
|
const followUp = `The user asked: "${body.message}"\n\nI executed these tools and got REAL results:\n\n${toolContext}\n\nNow respond conversationally based ONLY on the REAL data above. Do NOT output any JSON blocks, base64, or image markdown — just natural text.`;
|
|
1104
1123
|
try {
|
|
1105
1124
|
fullResponse = await callLLM(config, enrichedSystemPrompt, followUp);
|
|
1125
|
+
// Prepend preserved markers so the UI can render canvas/screenshots
|
|
1126
|
+
if (preservedMarkers) fullResponse = preservedMarkers + fullResponse;
|
|
1106
1127
|
} catch {
|
|
1107
1128
|
fullResponse = toolResults.map(t => `${t.action}: ${t.result}`).join('\n\n');
|
|
1108
1129
|
}
|
|
@@ -1437,23 +1458,35 @@ export async function cmdUI(args) {
|
|
|
1437
1458
|
// If tools were executed, make a second LLM call with results
|
|
1438
1459
|
let finalResponse = fullResponse;
|
|
1439
1460
|
if (toolResults.length > 0) {
|
|
1461
|
+
// Extract canvas/screenshot markers BEFORE sending to LLM
|
|
1462
|
+
let preservedMarkers = '';
|
|
1440
1463
|
const toolContext = toolResults.map(t => {
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1464
|
+
let clean = t.result;
|
|
1465
|
+
const canvasMatch = clean.match(/\[CANVAS_RENDER\][\s\S]*?\[\/CANVAS_RENDER\]/);
|
|
1466
|
+
if (canvasMatch) { preservedMarkers += canvasMatch[0] + '\n'; clean = clean.replace(/\[CANVAS_RENDER\][\s\S]*?\[\/CANVAS_RENDER\]/, '').trim(); }
|
|
1467
|
+
if (clean.includes('[CANVAS_CLEAR]')) { preservedMarkers += '[CANVAS_CLEAR]Canvas cleared.[/CANVAS_CLEAR]\n'; clean = clean.replace(/\[CANVAS_CLEAR\][\s\S]*?\[\/CANVAS_CLEAR\]/, '').trim(); }
|
|
1468
|
+
clean = clean.replace(/\[Screenshot[^\]]*\]/g, '').replace(/!\[.*?\]\(data:image[^)]+\)/g, '').slice(0, 3000);
|
|
1469
|
+
return `[${t.action} result]: ${clean.trim() || 'Done.'}`;
|
|
1444
1470
|
}).join('\n\n');
|
|
1471
|
+
|
|
1472
|
+
// If we have canvas content, send it to client immediately via SSE
|
|
1473
|
+
if (preservedMarkers.includes('[CANVAS_RENDER]')) {
|
|
1474
|
+
sendSSE('canvas', { markers: preservedMarkers });
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1445
1477
|
const followUp = `The user asked: "${msg}"\n\nI executed these tools and got REAL results:\n\n${toolContext}\n\nNow respond to the user conversationally based ONLY on the REAL data above. Present the results clearly. Do NOT output any JSON blocks, any base64 data, or any image markdown — just natural text. If a screenshot was taken, just mention "Screenshot captured" without embedding it.`;
|
|
1446
1478
|
sendSSE('tool_synthesis', {});
|
|
1447
1479
|
try {
|
|
1448
1480
|
finalResponse = await callLLMStream(config, enrichedPrompt, followUp, (chunk) => {
|
|
1449
1481
|
sendSSE('token', { content: chunk });
|
|
1450
1482
|
});
|
|
1451
|
-
// Strip any JSON blocks and base64 the LLM might have emitted
|
|
1452
1483
|
finalResponse = finalResponse
|
|
1453
1484
|
.replace(/```json[\s\S]*?```/g, '')
|
|
1454
1485
|
.replace(/!\[.*?\]\(data:image\/[^)]+\)/g, '')
|
|
1455
1486
|
.replace(/data:image\/[a-z]+;base64,[A-Za-z0-9+/=]{100,}/g, '[image]')
|
|
1456
1487
|
.trim();
|
|
1488
|
+
// Prepend preserved markers for persistence
|
|
1489
|
+
if (preservedMarkers) finalResponse = preservedMarkers + finalResponse;
|
|
1457
1490
|
} catch {
|
|
1458
1491
|
finalResponse = toolResults.map(t => `${t.action}: ${t.result}`).join('\n\n');
|
|
1459
1492
|
}
|
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 = '9.8.
|
|
8
|
+
export const VERSION = '9.8.4';
|
|
9
9
|
export const BASE_URL = 'https://nothumanallowed.com/cli';
|
|
10
10
|
export const API_BASE = 'https://nothumanallowed.com/api/v1';
|
|
11
11
|
|
package/src/services/web-ui.mjs
CHANGED
|
@@ -652,6 +652,12 @@ function sendChat(){
|
|
|
652
652
|
updateBrowserFrame(data.base64,data.format||'jpeg');
|
|
653
653
|
if(data.url)updateBrowserStatus(data.url);
|
|
654
654
|
}
|
|
655
|
+
if(currentEvent==='canvas'&&data.markers){
|
|
656
|
+
// Canvas content arrived — render it immediately
|
|
657
|
+
var cm=data.markers.match(/\\[CANVAS_RENDER\\]([\\s\\S]*?)\\[\\/CANVAS_RENDER\\]/);
|
|
658
|
+
if(cm){try{var cd=JSON.parse(cm[1]);showCanvas(cd.html,cd.title);}catch(e){}}
|
|
659
|
+
if(data.markers.indexOf('[CANVAS_CLEAR]')!==-1)closeCanvas();
|
|
660
|
+
}
|
|
655
661
|
if(currentEvent==='tool_synthesis'){chatHistory[streamIdx].content='';renderMessages();}
|
|
656
662
|
if(currentEvent==='done'){endStreaming();if(data.content)chatHistory[streamIdx].content=data.content;var ssf=data.screenshotFiles||[];for(var fi=0;fi<ssf.length;fi++){chatHistory[streamIdx].content+='\\n\\n';}renderMessages();loadConvList();if(ssf.length>0)setTimeout(closeBrowserViewer,5000);}
|
|
657
663
|
if(currentEvent==='error'){endStreaming();chatHistory[streamIdx].content='Error: '+(data.message||'Unknown');renderMessages();}
|