nothumanallowed 9.3.6 → 9.3.8
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/chat.mjs +2 -1
- package/src/commands/ui.mjs +9 -6
- package/src/constants.mjs +1 -1
- package/src/services/web-ui.mjs +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.8",
|
|
4
4
|
"description": "NotHumanAllowed — 38 AI agents + 58 tools + browser automation + web search. Streaming chat, headless Chrome CDP, multi-conversation, export. Gmail, Calendar, Drive, GitHub, Notion, Slack. Zero-dependency CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/commands/chat.mjs
CHANGED
|
@@ -59,7 +59,8 @@ const MAX_HISTORY = 20;
|
|
|
59
59
|
const CHAT_PERSONA = `You are NHA Chat, a personal operations assistant inside the NotHumanAllowed CLI. ` +
|
|
60
60
|
`You help the user manage their emails, calendar, tasks, GitHub issues, Notion pages, and Slack channels through natural conversation. ` +
|
|
61
61
|
`Be concise, helpful, and proactive. When presenting data, format it clearly. ` +
|
|
62
|
-
`Never output raw JSON to the user — always wrap results in natural language
|
|
62
|
+
`Never output raw JSON to the user — always wrap results in natural language. ` +
|
|
63
|
+
`ALWAYS respond in the same language the user writes in. If the user writes in English, respond in English. If the user writes in Italian, respond in Italian. Match their language exactly.`;
|
|
63
64
|
|
|
64
65
|
// ── System Prompt Builder ────────────────────────────────────────────────────
|
|
65
66
|
|
package/src/commands/ui.mjs
CHANGED
|
@@ -175,7 +175,8 @@ export async function cmdUI(args) {
|
|
|
175
175
|
const UI_PERSONA = `You are NHA Chat, a personal operations assistant inside the NotHumanAllowed web UI. ` +
|
|
176
176
|
`You help the user manage their emails, calendar, tasks, GitHub issues, Notion pages, and Slack channels through natural conversation. ` +
|
|
177
177
|
`Be concise, helpful, and proactive. When presenting data, format it clearly. ` +
|
|
178
|
-
`Never output raw JSON to the user
|
|
178
|
+
`Never output raw JSON to the user. ` +
|
|
179
|
+
`ALWAYS respond in the same language the user writes in. If the user writes in English, respond in English. If the user writes in Italian, respond in Italian. Match their language exactly.`;
|
|
179
180
|
const chatSystemPrompt = buildSystemPrompt('NHA UI', UI_PERSONA, config);
|
|
180
181
|
|
|
181
182
|
// ── Route Handlers ──────────────────────────────────────────────────────
|
|
@@ -987,7 +988,7 @@ export async function cmdUI(args) {
|
|
|
987
988
|
let fullResponse;
|
|
988
989
|
if (toolResults.length > 0) {
|
|
989
990
|
// Second LLM call with real tool results — forces the LLM to use actual data
|
|
990
|
-
const toolContext = toolResults.map(t => `[${t.action} result]: ${t.result}`).join('\n\n');
|
|
991
|
+
const toolContext = toolResults.map(t => `[${t.action} result]: ${t.result.slice(0, 3000)}`).join('\n\n');
|
|
991
992
|
const followUp = `The user asked: "${body.message}"\n\nI executed these tools and got REAL results:\n\n${toolContext}\n\nNow respond to the user based ONLY on the REAL data above. Do NOT invent or fabricate any information. Present the actual results clearly.`;
|
|
992
993
|
try {
|
|
993
994
|
fullResponse = await callLLM(config, enrichedSystemPrompt, followUp);
|
|
@@ -1119,12 +1120,14 @@ export async function cmdUI(args) {
|
|
|
1119
1120
|
let enrichedPrompt = basePrompt;
|
|
1120
1121
|
try { const m = buildMemoryContext('chat', effectiveMsg); if (m) enrichedPrompt = basePrompt + m; } catch {}
|
|
1121
1122
|
|
|
1122
|
-
// Build message with conversation history
|
|
1123
|
-
const history = body.history || [];
|
|
1123
|
+
// Build message with conversation history (capped to prevent token overflow)
|
|
1124
|
+
const history = (body.history || []).slice(-20);
|
|
1124
1125
|
const parts = [];
|
|
1125
1126
|
for (const turn of history) {
|
|
1126
1127
|
const prefix = turn.role === 'user' ? '[User]' : '[Assistant]';
|
|
1127
|
-
|
|
1128
|
+
// Strip any base64 image data that leaked into history
|
|
1129
|
+
const clean = (turn.content || '').replace(/!\[Screenshot\]\(data:image\/[^)]+\)/g, '[Screenshot]').slice(0, 2000);
|
|
1130
|
+
parts.push(`${prefix} ${clean}`);
|
|
1128
1131
|
}
|
|
1129
1132
|
parts.push(`[User] ${effectiveMsg}`);
|
|
1130
1133
|
const userMessage = parts.join('\n\n');
|
|
@@ -1214,7 +1217,7 @@ export async function cmdUI(args) {
|
|
|
1214
1217
|
// If tools were executed, make a second LLM call with results
|
|
1215
1218
|
let finalResponse = fullResponse;
|
|
1216
1219
|
if (toolResults.length > 0) {
|
|
1217
|
-
const toolContext = toolResults.map(t => `[${t.action} result]: ${t.result}`).join('\n\n');
|
|
1220
|
+
const toolContext = toolResults.map(t => `[${t.action} result]: ${t.result.slice(0, 3000)}`).join('\n\n');
|
|
1218
1221
|
const followUp = `The user asked: "${msg}"\n\nI executed these tools and got REAL results:\n\n${toolContext}\n\nNow respond to the user based ONLY on the REAL data above. Present the actual results clearly.`;
|
|
1219
1222
|
sendSSE('tool_synthesis', {});
|
|
1220
1223
|
try {
|
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.3.
|
|
8
|
+
export const VERSION = '9.3.8';
|
|
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
|
@@ -483,7 +483,9 @@ function sendChat(){
|
|
|
483
483
|
chatHistory.push({role:'assistant',content:''});
|
|
484
484
|
renderMessages();
|
|
485
485
|
var streamIdx=chatHistory.length-1;
|
|
486
|
-
var
|
|
486
|
+
var recentHistory=chatHistory.slice(-21,-1);
|
|
487
|
+
var cleanHistory=recentHistory.map(function(m){return{role:m.role,content:(m.content||'').replace(/!\\[Screenshot\\]\\(data:image\\/[^)]+\\)/g,'[Screenshot was shown]').slice(0,2000)};});
|
|
488
|
+
var payload={message:msg,history:cleanHistory,conversationId:activeConvId};
|
|
487
489
|
|
|
488
490
|
fetch(API+'/api/chat/stream',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(payload)}).then(function(response){
|
|
489
491
|
if(!response.ok||!response.body){chatHistory[streamIdx].content='Error: connection failed';chatStreaming=false;renderMessages();return;}
|