nothumanallowed 16.0.18 → 16.0.20
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 +52 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "16.0.
|
|
3
|
+
"version": "16.0.20",
|
|
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 = '16.0.
|
|
8
|
+
export const VERSION = '16.0.20';
|
|
9
9
|
export const BASE_URL = 'https://nothumanallowed.com/cli';
|
|
10
10
|
export const API_BASE = 'https://nothumanallowed.com/api/v1';
|
|
11
11
|
|
|
@@ -329,7 +329,7 @@ function isCompletedAction(text) {
|
|
|
329
329
|
return DONE_SIGNALS.some(s => lower.includes(s));
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
-
async function callAgentWithTools(config, agentName, userMessage, languageOverride, preHistory) {
|
|
332
|
+
async function callAgentWithTools(config, agentName, userMessage, languageOverride, preHistory, chatId) {
|
|
333
333
|
const today = new Date().toISOString().split('T')[0];
|
|
334
334
|
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
335
335
|
const locale = Intl.DateTimeFormat().resolvedOptions().locale || 'en';
|
|
@@ -397,12 +397,17 @@ async function callAgentWithTools(config, agentName, userMessage, languageOverri
|
|
|
397
397
|
break;
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
-
// Execute all tools
|
|
400
|
+
// Execute all tools — use the remembering variant so list-tools auto-
|
|
401
|
+
// populate the anaphoric cache (lastList_*). Critical for "Si spostalo"
|
|
402
|
+
// pattern: HERALD calls calendar_find inside the loop, the result must
|
|
403
|
+
// land in lastCalendarEvents so the next turn's anaphoric dispatcher
|
|
404
|
+
// can resolve "spostalo" deterministically.
|
|
405
|
+
const { executeToolAndRemember: _exec } = await import('./tool-executor.mjs');
|
|
401
406
|
const toolResults = [];
|
|
402
407
|
let authError = null;
|
|
403
408
|
for (const { action, params } of actions) {
|
|
404
409
|
try {
|
|
405
|
-
const result = await
|
|
410
|
+
const result = await _exec(action, params, config, chatId);
|
|
406
411
|
const resultStr = typeof result === 'string' ? result : JSON.stringify(result);
|
|
407
412
|
toolResults.push(`[${action}] ${resultStr}`);
|
|
408
413
|
} catch (err) {
|
|
@@ -1275,7 +1280,7 @@ class TelegramResponder {
|
|
|
1275
1280
|
} catch {}
|
|
1276
1281
|
|
|
1277
1282
|
if (TOOL_AGENTS.has(agent)) {
|
|
1278
|
-
const result = await callAgentWithTools(this.config, agent, enrichedMessage, detectedLang, preHistory);
|
|
1283
|
+
const result = await callAgentWithTools(this.config, agent, enrichedMessage, detectedLang, preHistory, chatId);
|
|
1279
1284
|
responseText = result.text;
|
|
1280
1285
|
responseHistory = result.history;
|
|
1281
1286
|
} else {
|
|
@@ -2602,12 +2607,22 @@ class TelegramResponder {
|
|
|
2602
2607
|
if (extracted.date || extracted.title) {
|
|
2603
2608
|
let events = [];
|
|
2604
2609
|
try {
|
|
2610
|
+
const { listEvents } = await import('./google-calendar.mjs');
|
|
2605
2611
|
if (extracted.date) {
|
|
2606
|
-
const
|
|
2607
|
-
|
|
2612
|
+
const [yy, mm, dd] = extracted.date.split('-').map(n => parseInt(n, 10));
|
|
2613
|
+
const from = new Date(yy, mm - 1, dd);
|
|
2614
|
+
const to = new Date(from.getTime() + 86400000);
|
|
2615
|
+
const evs = await listEvents(config, 'primary', from, to);
|
|
2616
|
+
events = (evs || []).map(e => ({
|
|
2617
|
+
eventId: e.id, summary: e.summary || '', time: (e.start || '').slice(11, 16),
|
|
2618
|
+
}));
|
|
2608
2619
|
} else if (extracted.title) {
|
|
2609
|
-
const
|
|
2610
|
-
|
|
2620
|
+
const from = new Date();
|
|
2621
|
+
const to = new Date(from.getTime() + 60 * 86400000);
|
|
2622
|
+
const evs = await listEvents(config, 'primary', from, to);
|
|
2623
|
+
events = (evs || []).map(e => ({
|
|
2624
|
+
eventId: e.id, summary: e.summary || '', time: (e.start || '').slice(11, 16),
|
|
2625
|
+
}));
|
|
2611
2626
|
}
|
|
2612
2627
|
} catch (e) {
|
|
2613
2628
|
return { action: 'calendar_verify', success: false, message: `Errore durante la verifica: ${e.message}` };
|
|
@@ -2688,16 +2703,26 @@ class TelegramResponder {
|
|
|
2688
2703
|
if (isMove && !isDelete && !isVerify && !isCreate) {
|
|
2689
2704
|
const parsed = await this._nluExtractCalendarMove(userMessage, config);
|
|
2690
2705
|
if (parsed && (parsed.title || parsed.oldDate) && parsed.newStart) {
|
|
2691
|
-
// Find the source event
|
|
2706
|
+
// Find the source event — use listEvents directly (parser fails
|
|
2707
|
+
// because calendar_date/find don't expose eventIds in their text).
|
|
2692
2708
|
let candidates = [];
|
|
2693
2709
|
try {
|
|
2710
|
+
const { listEvents } = await import('./google-calendar.mjs');
|
|
2694
2711
|
if (parsed.oldDate) {
|
|
2695
|
-
const
|
|
2696
|
-
|
|
2712
|
+
const [yy, mm, dd] = parsed.oldDate.split('-').map(n => parseInt(n, 10));
|
|
2713
|
+
const from = new Date(yy, mm - 1, dd);
|
|
2714
|
+
const to = new Date(from.getTime() + 86400000);
|
|
2715
|
+
const evs = await listEvents(config, 'primary', from, to);
|
|
2716
|
+
candidates = (evs || []).map(e => ({ eventId: e.id, summary: e.summary || '' }));
|
|
2697
2717
|
}
|
|
2698
2718
|
if (candidates.length === 0 && parsed.title) {
|
|
2699
|
-
|
|
2700
|
-
|
|
2719
|
+
// Broad search across next 60 days
|
|
2720
|
+
const from = new Date();
|
|
2721
|
+
const to = new Date(from.getTime() + 60 * 86400000);
|
|
2722
|
+
const evs = await listEvents(config, 'primary', from, to);
|
|
2723
|
+
candidates = (evs || [])
|
|
2724
|
+
.filter(e => String(e.summary || '').toLowerCase().includes(parsed.title.toLowerCase()))
|
|
2725
|
+
.map(e => ({ eventId: e.id, summary: e.summary || '' }));
|
|
2701
2726
|
}
|
|
2702
2727
|
} catch (e) {
|
|
2703
2728
|
return { action: 'calendar_move', success: false, message: `Errore nella ricerca dell'evento: ${e.message}` };
|
|
@@ -2909,13 +2934,23 @@ class TelegramResponder {
|
|
|
2909
2934
|
|
|
2910
2935
|
let candidates = [];
|
|
2911
2936
|
try {
|
|
2937
|
+
const { listEvents } = await import('./google-calendar.mjs');
|
|
2912
2938
|
if (extracted.date) {
|
|
2913
|
-
const
|
|
2914
|
-
|
|
2939
|
+
const [yy, mm, dd] = extracted.date.split('-').map(n => parseInt(n, 10));
|
|
2940
|
+
const from = new Date(yy, mm - 1, dd);
|
|
2941
|
+
const to = new Date(from.getTime() + 86400000);
|
|
2942
|
+
const evs = await listEvents(config, 'primary', from, to);
|
|
2943
|
+
candidates = (evs || []).map(e => ({
|
|
2944
|
+
eventId: e.id, summary: e.summary || '', time: (e.start || '').slice(11, 16),
|
|
2945
|
+
}));
|
|
2915
2946
|
}
|
|
2916
2947
|
if (candidates.length === 0 && extracted.title) {
|
|
2917
|
-
const
|
|
2918
|
-
|
|
2948
|
+
const from = new Date();
|
|
2949
|
+
const to = new Date(from.getTime() + 60 * 86400000);
|
|
2950
|
+
const evs = await listEvents(config, 'primary', from, to);
|
|
2951
|
+
candidates = (evs || [])
|
|
2952
|
+
.filter(e => String(e.summary || '').toLowerCase().includes(extracted.title.toLowerCase()))
|
|
2953
|
+
.map(e => ({ eventId: e.id, summary: e.summary || '', time: (e.start || '').slice(11, 16) }));
|
|
2919
2954
|
}
|
|
2920
2955
|
} catch (err) {
|
|
2921
2956
|
this.log(`[Telegram] direct-fresh delete lookup failed: ${err.message}`);
|