nothumanallowed 13.5.168 → 13.5.170
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/constants.mjs +1 -1
- package/src/services/message-responder.mjs +69 -5
- package/src/services/web-ui.mjs +47 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "13.5.
|
|
3
|
+
"version": "13.5.170",
|
|
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.
|
|
8
|
+
export const VERSION = '13.5.170';
|
|
9
9
|
export const BASE_URL = 'https://nothumanallowed.com/cli';
|
|
10
10
|
export const API_BASE = 'https://nothumanallowed.com/api/v1';
|
|
11
11
|
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* Routing: keyword-based (no LLM call) to save API costs. Falls back to CONDUCTOR.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { callAgent } from './llm.mjs';
|
|
11
|
+
import { callAgent, callLLM } from './llm.mjs';
|
|
12
|
+
import { buildSystemPrompt, parseActions, executeTool, TOOL_DEFINITIONS } from './tool-executor.mjs';
|
|
12
13
|
import https from 'https';
|
|
13
14
|
import http from 'http';
|
|
14
15
|
import { URL } from 'url';
|
|
@@ -109,6 +110,64 @@ function routeMessage(text, useAutoRoute = true) {
|
|
|
109
110
|
return bestAgent;
|
|
110
111
|
}
|
|
111
112
|
|
|
113
|
+
// ── Tool-aware agent call (LLM + tool execution loop) ────────────────────────
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Call an agent with full tool execution support.
|
|
117
|
+
* Like chat.mjs but headless — no confirmation prompts, all tools auto-executed.
|
|
118
|
+
* Returns a human-readable summary of what was done.
|
|
119
|
+
*/
|
|
120
|
+
async function callAgentWithTools(config, agentName, userMessage) {
|
|
121
|
+
const today = new Date().toISOString().split('T')[0];
|
|
122
|
+
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
123
|
+
const locale = Intl.DateTimeFormat().resolvedOptions().locale || 'en';
|
|
124
|
+
const LANG_MAP = { en: 'English', it: 'Italian', es: 'Spanish', fr: 'French', de: 'German', pt: 'Portuguese', nl: 'Dutch', pl: 'Polish', ru: 'Russian', ja: 'Japanese', ko: 'Korean', zh: 'Chinese', ar: 'Arabic', hi: 'Hindi', tr: 'Turkish' };
|
|
125
|
+
const language = config?.language || LANG_MAP[locale.split('-')[0]] || 'English';
|
|
126
|
+
|
|
127
|
+
const systemPrompt = TOOL_DEFINITIONS
|
|
128
|
+
.replace('{{TODAY}}', today)
|
|
129
|
+
.replace('{{TIMEZONE}}', tz)
|
|
130
|
+
.replace(/\{\{LANGUAGE\}\}/g, language);
|
|
131
|
+
|
|
132
|
+
// Multi-turn: serialize history as [User]/[Assistant] string (same pattern as chat.mjs)
|
|
133
|
+
const history = []; // [{role, content}]
|
|
134
|
+
let finalText = '';
|
|
135
|
+
|
|
136
|
+
for (let round = 0; round < 3; round++) {
|
|
137
|
+
// Build serialized message
|
|
138
|
+
const parts = history.map(h => (h.role === 'user' ? '[User]' : '[Assistant]') + ' ' + h.content);
|
|
139
|
+
parts.push('[User] ' + userMessage);
|
|
140
|
+
if (round > 0) {
|
|
141
|
+
// Replace last user with tool results continuation
|
|
142
|
+
}
|
|
143
|
+
const serialized = parts.join('\n\n');
|
|
144
|
+
|
|
145
|
+
const response = await callLLM(config, systemPrompt, serialized);
|
|
146
|
+
const { textParts, actions } = parseActions(response);
|
|
147
|
+
finalText = textParts.join('\n').trim();
|
|
148
|
+
|
|
149
|
+
if (actions.length === 0) break; // No tools — pure text response
|
|
150
|
+
|
|
151
|
+
// Execute all tools and collect results
|
|
152
|
+
const toolResults = [];
|
|
153
|
+
for (const { action, params } of actions) {
|
|
154
|
+
try {
|
|
155
|
+
const result = await executeTool(action, params, config);
|
|
156
|
+
const resultStr = typeof result === 'string' ? result : JSON.stringify(result);
|
|
157
|
+
toolResults.push(`[${action}] ${resultStr}`);
|
|
158
|
+
} catch (err) {
|
|
159
|
+
toolResults.push(`[${action}] Error: ${err.message}`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Feed results back: append assistant response + tool results as next user turn
|
|
164
|
+
history.push({ role: 'assistant', content: response });
|
|
165
|
+
userMessage = 'Tool results:\n' + toolResults.join('\n') + '\n\nNow give the user a concise confirmation in ' + language + '. Do NOT use HERALD format — respond conversationally.';
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return finalText || 'Done.';
|
|
169
|
+
}
|
|
170
|
+
|
|
112
171
|
// ── Telegram Bot (Long Polling via native fetch) ─────────────────────────────
|
|
113
172
|
|
|
114
173
|
class TelegramResponder {
|
|
@@ -226,8 +285,11 @@ class TelegramResponder {
|
|
|
226
285
|
// Send typing indicator
|
|
227
286
|
await this._telegramCall('sendChatAction', { chat_id: chatId, action: 'typing' });
|
|
228
287
|
|
|
229
|
-
//
|
|
230
|
-
|
|
288
|
+
// Tool-capable agents use the full tool execution loop
|
|
289
|
+
// Pure reasoning/analysis agents use the simple callAgent (no tools)
|
|
290
|
+
const TOOL_AGENTS = new Set(['herald', 'hermes', 'edi', 'jarvis', 'flux', 'echo', 'mercury', 'pipe', 'navi', 'link', 'prometheus', 'tempest']);
|
|
291
|
+
const callFn = TOOL_AGENTS.has(agent) ? callAgentWithTools : callAgent;
|
|
292
|
+
const response = await callFn(this.config, agent, cleanText);
|
|
231
293
|
|
|
232
294
|
// Truncate if too long for Telegram (4096 char limit)
|
|
233
295
|
const truncated = response.length > 4000
|
|
@@ -607,8 +669,10 @@ class DiscordResponder {
|
|
|
607
669
|
// Send typing indicator
|
|
608
670
|
await this._discordApiCall('POST', `/channels/${channelId}/typing`);
|
|
609
671
|
|
|
610
|
-
//
|
|
611
|
-
const
|
|
672
|
+
// Tool-capable agents use the full tool execution loop
|
|
673
|
+
const TOOL_AGENTS = new Set(['herald', 'hermes', 'edi', 'jarvis', 'flux', 'echo', 'mercury', 'pipe', 'navi', 'link', 'prometheus', 'tempest']);
|
|
674
|
+
const callFn = TOOL_AGENTS.has(agent) ? callAgentWithTools : callAgent;
|
|
675
|
+
const response = await callFn(this.config, agent, cleanText);
|
|
612
676
|
|
|
613
677
|
// Discord message limit is 2000 chars
|
|
614
678
|
const truncated = response.length > 1900
|
package/src/services/web-ui.mjs
CHANGED
|
@@ -3817,15 +3817,8 @@ function handleDaemonEvent(msg) {
|
|
|
3817
3817
|
}
|
|
3818
3818
|
if (msg.done) {
|
|
3819
3819
|
var upStatus = document.getElementById('npmUpdateStatus');
|
|
3820
|
-
if (upStatus) upStatus.textContent = '
|
|
3821
|
-
//
|
|
3822
|
-
setTimeout(function pollReconnect() {
|
|
3823
|
-
fetch(API + '/api/status').then(function() {
|
|
3824
|
-
window.location.reload();
|
|
3825
|
-
}).catch(function() {
|
|
3826
|
-
setTimeout(pollReconnect, 1500);
|
|
3827
|
-
});
|
|
3828
|
-
}, 3000);
|
|
3820
|
+
if (upStatus) upStatus.textContent = 'npm install complete — server restarting...';
|
|
3821
|
+
// Reload is handled by the independent poll in npmUpdate()
|
|
3829
3822
|
}
|
|
3830
3823
|
if (msg.error) {
|
|
3831
3824
|
var upStatus2 = document.getElementById('npmUpdateStatus');
|
|
@@ -3838,7 +3831,6 @@ function handleDaemonEvent(msg) {
|
|
|
3838
3831
|
}
|
|
3839
3832
|
|
|
3840
3833
|
function npmUpdate() {
|
|
3841
|
-
// Show modal
|
|
3842
3834
|
var existing = document.getElementById('npmUpdateModal');
|
|
3843
3835
|
if (existing) existing.remove();
|
|
3844
3836
|
var modal = document.createElement('div');
|
|
@@ -3854,8 +3846,52 @@ function npmUpdate() {
|
|
|
3854
3846
|
'</div>' +
|
|
3855
3847
|
'</div>';
|
|
3856
3848
|
document.body.appendChild(modal);
|
|
3857
|
-
|
|
3849
|
+
|
|
3850
|
+
// Start update — fire and forget (server will exit after npm install)
|
|
3858
3851
|
apiPost('/api/update-npm', {}).catch(function(){});
|
|
3852
|
+
|
|
3853
|
+
// Independent reconnect poll — does NOT depend on WebSocket
|
|
3854
|
+
// Phase 1: wait for server to go down (up to 3 min)
|
|
3855
|
+
// Phase 2: wait for server to come back up, then reload
|
|
3856
|
+
var serverWasUp = true;
|
|
3857
|
+
var pollStart = Date.now();
|
|
3858
|
+
var MAX_WAIT = 180000; // 3 min total
|
|
3859
|
+
function pollDown() {
|
|
3860
|
+
if (Date.now() - pollStart > MAX_WAIT) {
|
|
3861
|
+
var st = document.getElementById('npmUpdateStatus');
|
|
3862
|
+
if (st) { st.textContent = 'Timeout — reload the page manually.'; st.style.color = 'var(--red)'; }
|
|
3863
|
+
var cb = document.getElementById('npmUpdateCloseBtn');
|
|
3864
|
+
if (cb) cb.style.display = 'inline-block';
|
|
3865
|
+
return;
|
|
3866
|
+
}
|
|
3867
|
+
fetch(window.location.origin + '/api/status', { cache: 'no-store' }).then(function() {
|
|
3868
|
+
setTimeout(pollDown, 1000); // still up, keep waiting
|
|
3869
|
+
}).catch(function() {
|
|
3870
|
+
// Server went down — now wait for it to come back
|
|
3871
|
+
var st = document.getElementById('npmUpdateStatus');
|
|
3872
|
+
if (st) st.textContent = 'Server restarting — reconnecting...';
|
|
3873
|
+
setTimeout(pollUp, 1500);
|
|
3874
|
+
});
|
|
3875
|
+
}
|
|
3876
|
+
function pollUp() {
|
|
3877
|
+
if (Date.now() - pollStart > MAX_WAIT) {
|
|
3878
|
+
var st = document.getElementById('npmUpdateStatus');
|
|
3879
|
+
if (st) { st.textContent = 'Server took too long — reload the page manually.'; st.style.color = 'var(--red)'; }
|
|
3880
|
+
var cb = document.getElementById('npmUpdateCloseBtn');
|
|
3881
|
+
if (cb) cb.style.display = 'inline-block';
|
|
3882
|
+
return;
|
|
3883
|
+
}
|
|
3884
|
+
fetch(window.location.origin + '/api/status', { cache: 'no-store' }).then(function() {
|
|
3885
|
+
// Server is back — reload at same origin (works on localhost AND VM IP)
|
|
3886
|
+
var st = document.getElementById('npmUpdateStatus');
|
|
3887
|
+
if (st) st.textContent = 'Update complete! Reloading...';
|
|
3888
|
+
setTimeout(function() { window.location.reload(); }, 800);
|
|
3889
|
+
}).catch(function() {
|
|
3890
|
+
setTimeout(pollUp, 1500);
|
|
3891
|
+
});
|
|
3892
|
+
}
|
|
3893
|
+
// Start polling for server going down after a short delay
|
|
3894
|
+
setTimeout(pollDown, 5000);
|
|
3859
3895
|
}
|
|
3860
3896
|
|
|
3861
3897
|
// ---- VOICE INPUT (in chat view) ----
|