nothumanallowed 16.0.14 → 16.0.15
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": "16.0.
|
|
3
|
+
"version": "16.0.15",
|
|
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.15';
|
|
9
9
|
export const BASE_URL = 'https://nothumanallowed.com/cli';
|
|
10
10
|
export const API_BASE = 'https://nothumanallowed.com/api/v1';
|
|
11
11
|
|
|
@@ -1486,6 +1486,46 @@ class TelegramResponder {
|
|
|
1486
1486
|
// Parse calendar_date / calendar_find tool output. The executor returns
|
|
1487
1487
|
// a human-readable string with each event on its own line plus the
|
|
1488
1488
|
// eventId in parentheses. We extract structured records.
|
|
1489
|
+
/**
|
|
1490
|
+
* Map a list-tool invocation to the (timeMin, timeMax) range that listEvents
|
|
1491
|
+
* would query. Used as a fallback when the textual tool output doesn't
|
|
1492
|
+
* include event IDs (calendar_month, calendar_today, etc).
|
|
1493
|
+
*/
|
|
1494
|
+
_computeRangeForListTool(toolName, args) {
|
|
1495
|
+
const now = new Date();
|
|
1496
|
+
if (toolName === 'calendar_today') {
|
|
1497
|
+
const from = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
|
1498
|
+
return { from, to: new Date(from.getTime() + 86400000) };
|
|
1499
|
+
}
|
|
1500
|
+
if (toolName === 'calendar_tomorrow') {
|
|
1501
|
+
const from = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);
|
|
1502
|
+
return { from, to: new Date(from.getTime() + 86400000) };
|
|
1503
|
+
}
|
|
1504
|
+
if (toolName === 'calendar_week') {
|
|
1505
|
+
const from = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
|
1506
|
+
return { from, to: new Date(from.getTime() + 7 * 86400000) };
|
|
1507
|
+
}
|
|
1508
|
+
if (toolName === 'calendar_month') {
|
|
1509
|
+
let y = now.getFullYear(), m = now.getMonth();
|
|
1510
|
+
if (args?.month && /^\d{4}-\d{2}$/.test(args.month)) {
|
|
1511
|
+
const [yy, mm] = args.month.split('-');
|
|
1512
|
+
y = parseInt(yy, 10);
|
|
1513
|
+
m = parseInt(mm, 10) - 1;
|
|
1514
|
+
}
|
|
1515
|
+
return { from: new Date(y, m, 1), to: new Date(y, m + 1, 1) };
|
|
1516
|
+
}
|
|
1517
|
+
if (toolName === 'calendar_date' && args?.date && /^\d{4}-\d{2}-\d{2}$/.test(args.date)) {
|
|
1518
|
+
const [yy, mm, dd] = args.date.split('-').map(n => parseInt(n, 10));
|
|
1519
|
+
const from = new Date(yy, mm - 1, dd);
|
|
1520
|
+
return { from, to: new Date(from.getTime() + 86400000) };
|
|
1521
|
+
}
|
|
1522
|
+
if (toolName === 'calendar_upcoming') {
|
|
1523
|
+
const hours = parseInt(args?.hours || '48', 10);
|
|
1524
|
+
return { from: now, to: new Date(now.getTime() + hours * 3600000) };
|
|
1525
|
+
}
|
|
1526
|
+
return null;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1489
1529
|
_parseEventsFromToolOutput(toolResult) {
|
|
1490
1530
|
const text = typeof toolResult === 'string' ? toolResult : JSON.stringify(toolResult || '');
|
|
1491
1531
|
const lines = text.split(/\r?\n/);
|
|
@@ -2263,7 +2303,28 @@ class TelegramResponder {
|
|
|
2263
2303
|
const runListAndRemember = async (toolName, args, actionKey) => {
|
|
2264
2304
|
try {
|
|
2265
2305
|
const out = await executeTool(toolName, args, config);
|
|
2266
|
-
|
|
2306
|
+
// Parse from text first (cheap, works when tools include event IDs).
|
|
2307
|
+
let events = this._parseEventsFromToolOutput(String(out));
|
|
2308
|
+
// Fallback: tools like calendar_month don't print event IDs in their
|
|
2309
|
+
// pretty-printed output, so we MUST call listEvents() directly to
|
|
2310
|
+
// get structured objects with real Google Calendar event IDs.
|
|
2311
|
+
// Without this, anaphoric "cancellalo" can never resolve.
|
|
2312
|
+
if (events.length === 0) {
|
|
2313
|
+
try {
|
|
2314
|
+
const { listEvents } = await import('./google-calendar.mjs');
|
|
2315
|
+
const range = this._computeRangeForListTool(toolName, args);
|
|
2316
|
+
if (range) {
|
|
2317
|
+
const evs = await listEvents(config, 'primary', range.from, range.to);
|
|
2318
|
+
events = (evs || []).map(e => ({
|
|
2319
|
+
eventId: e.id,
|
|
2320
|
+
summary: e.summary || '(senza titolo)',
|
|
2321
|
+
time: (e.start || '').slice(11, 16),
|
|
2322
|
+
date: (e.start || '').slice(0, 10),
|
|
2323
|
+
}));
|
|
2324
|
+
this.log(`[direct] LIST structured fallback: ${events.length} events via listEvents(${range.from.toISOString().slice(0,10)}..${range.to.toISOString().slice(0,10)})`);
|
|
2325
|
+
}
|
|
2326
|
+
} catch (e) { this.log(`[direct] LIST structured fallback failed: ${e.message}`); }
|
|
2327
|
+
}
|
|
2267
2328
|
// Even without chatId, save to a global fallback bucket so the
|
|
2268
2329
|
// anaphoric resolution can still find it.
|
|
2269
2330
|
const persistKey = chatId || '__last_list__';
|