nothumanallowed 9.3.7 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nothumanallowed",
3
- "version": "9.3.7",
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": {
@@ -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
 
@@ -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 ──────────────────────────────────────────────────────
@@ -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
- parts.push(`${prefix} ${turn.content}`);
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');
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.7';
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
 
@@ -483,7 +483,8 @@ function sendChat(){
483
483
  chatHistory.push({role:'assistant',content:''});
484
484
  renderMessages();
485
485
  var streamIdx=chatHistory.length-1;
486
- var cleanHistory=chatHistory.slice(0,-1).map(function(m){return{role:m.role,content:(m.content||'').replace(/!\\[Screenshot\\]\\(data:image\\/[^)]+\\)/g,'[Screenshot was shown]').slice(0,4000)};});
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)};});
487
488
  var payload={message:msg,history:cleanHistory,conversationId:activeConvId};
488
489
 
489
490
  fetch(API+'/api/chat/stream',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(payload)}).then(function(response){