nothumanallowed 3.7.0 → 3.8.0
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/ui.mjs +38 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "NotHumanAllowed — 38 AI agents for security, code, DevOps, data & daily ops. Ask agents directly, plan your day with 5 specialist agents, manage tasks, connect Gmail + Calendar.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/commands/ui.mjs
CHANGED
|
@@ -597,7 +597,7 @@ export async function cmdUI(args) {
|
|
|
597
597
|
return;
|
|
598
598
|
}
|
|
599
599
|
|
|
600
|
-
// POST /api/ask
|
|
600
|
+
// POST /api/ask — agent call with personal context (email, calendar, tasks)
|
|
601
601
|
if (method === 'POST' && pathname === '/api/ask') {
|
|
602
602
|
const body = await parseBody(req);
|
|
603
603
|
if (!body.agent || !body.prompt) {
|
|
@@ -619,7 +619,43 @@ export async function cmdUI(args) {
|
|
|
619
619
|
}
|
|
620
620
|
|
|
621
621
|
try {
|
|
622
|
-
|
|
622
|
+
// Build personal context from Gmail + Calendar + Tasks
|
|
623
|
+
let context = '';
|
|
624
|
+
try {
|
|
625
|
+
const [emails, events] = await Promise.all([
|
|
626
|
+
getUnreadImportant(config, 15).catch(() => []),
|
|
627
|
+
getTodayEvents(config).catch(() => []),
|
|
628
|
+
]);
|
|
629
|
+
const tasks = getTasks();
|
|
630
|
+
|
|
631
|
+
if (emails.length > 0) {
|
|
632
|
+
context += '\n\n[USER EMAIL CONTEXT — real data from their Gmail]\n';
|
|
633
|
+
emails.slice(0, 10).forEach((e, i) => {
|
|
634
|
+
context += `${i + 1}. From: ${e.from} | Subject: ${e.subject} | Date: ${e.date}\n ${e.snippet.slice(0, 150)}\n URLs: ${e.urls.join(', ') || 'none'}\n`;
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
if (events.length > 0) {
|
|
639
|
+
context += '\n\n[USER CALENDAR — today]\n';
|
|
640
|
+
events.forEach(e => {
|
|
641
|
+
const time = e.isAllDay ? 'All day' : `${e.start} - ${e.end}`;
|
|
642
|
+
context += `${time}: ${e.summary}${e.location ? ' @ ' + e.location : ''}${e.attendees?.length ? ' with ' + e.attendees.map(a => a.name || a.email).join(', ') : ''}\n`;
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
if (tasks.length > 0) {
|
|
647
|
+
context += '\n\n[USER TASKS — today]\n';
|
|
648
|
+
tasks.forEach(t => {
|
|
649
|
+
context += `#${t.id} [${t.priority}] ${t.status === 'done' ? '[DONE] ' : ''}${t.description}\n`;
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
} catch { /* context loading failed, proceed without it */ }
|
|
653
|
+
|
|
654
|
+
const enrichedPrompt = body.prompt + (context
|
|
655
|
+
? '\n\nIMPORTANT: Below is the user\'s REAL personal data (emails, calendar, tasks). Use this actual data in your analysis — do NOT make up fictional examples.\n' + context
|
|
656
|
+
: '');
|
|
657
|
+
|
|
658
|
+
const response = await callAgent(config, body.agent, enrichedPrompt);
|
|
623
659
|
sendJSON(res, 200, { response, agent: body.agent });
|
|
624
660
|
} catch (e) {
|
|
625
661
|
sendJSON(res, 200, { response: null, error: e.message });
|