nothumanallowed 4.1.0 → 6.0.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 +10 -3
- package/src/cli.mjs +181 -5
- package/src/commands/autostart.mjs +342 -0
- package/src/commands/chat.mjs +14 -8
- package/src/commands/microsoft-auth.mjs +29 -0
- package/src/commands/ops.mjs +37 -0
- package/src/commands/plugin.mjs +481 -0
- package/src/commands/ui.mjs +28 -7
- package/src/commands/voice.mjs +845 -0
- package/src/config.mjs +61 -0
- package/src/constants.mjs +9 -1
- package/src/services/llm.mjs +22 -1
- package/src/services/mail-router.mjs +298 -0
- package/src/services/memory.mjs +627 -0
- package/src/services/message-responder.mjs +778 -0
- package/src/services/microsoft-calendar.mjs +319 -0
- package/src/services/microsoft-mail.mjs +308 -0
- package/src/services/microsoft-oauth.mjs +345 -0
- package/src/services/ops-daemon.mjs +620 -11
- package/src/services/ops-pipeline.mjs +7 -8
- package/src/services/token-store.mjs +41 -14
- package/src/services/tool-executor.mjs +392 -0
- package/src/services/web-ui.mjs +187 -1
package/src/commands/ui.mjs
CHANGED
|
@@ -13,9 +13,10 @@ import { exec } from 'child_process';
|
|
|
13
13
|
import fs from 'fs';
|
|
14
14
|
import path from 'path';
|
|
15
15
|
import { loadConfig } from '../config.mjs';
|
|
16
|
+
import { detectMailProvider, hasMailProvider, getProviderStatus } from '../services/mail-router.mjs';
|
|
16
17
|
import { callLLM, callAgent, parseAgentFile } from '../services/llm.mjs';
|
|
17
|
-
import { getUnreadImportant, getMessage, listMessages, sendEmail, createDraft } from '../services/
|
|
18
|
-
import { getTodayEvents, getUpcomingEvents, createEvent, updateEvent, getEventsForDate } from '../services/
|
|
18
|
+
import { getUnreadImportant, getMessage, listMessages, sendEmail, createDraft } from '../services/mail-router.mjs';
|
|
19
|
+
import { getTodayEvents, getUpcomingEvents, createEvent, updateEvent, getEventsForDate } from '../services/mail-router.mjs';
|
|
19
20
|
import {
|
|
20
21
|
getTasks,
|
|
21
22
|
addTask,
|
|
@@ -25,6 +26,7 @@ import {
|
|
|
25
26
|
import { runPlanningPipeline } from '../services/ops-pipeline.mjs';
|
|
26
27
|
import { AGENTS, AGENTS_DIR, NHA_DIR, VERSION } from '../constants.mjs';
|
|
27
28
|
import { getHTML } from '../services/web-ui.mjs';
|
|
29
|
+
import { loadChatHistory, saveChatHistory, extractMemory, buildMemoryContext } from '../services/memory.mjs';
|
|
28
30
|
import { info, ok, fail, warn, C, G, D, NC, BOLD } from '../ui.mjs';
|
|
29
31
|
|
|
30
32
|
// ── Constants ──────────────────────────────────────────────────────────────
|
|
@@ -431,6 +433,9 @@ export async function cmdUI(args) {
|
|
|
431
433
|
provider: config.llm.provider,
|
|
432
434
|
hasApiKey: !!config.llm.apiKey,
|
|
433
435
|
hasGoogle: !!config.google?.clientId,
|
|
436
|
+
hasMicrosoft: !!config.microsoft?.clientId,
|
|
437
|
+
mailProvider: detectMailProvider(config),
|
|
438
|
+
mailProviders: getProviderStatus(),
|
|
434
439
|
agentName: config.agent?.name || null,
|
|
435
440
|
timestamp: new Date().toISOString(),
|
|
436
441
|
});
|
|
@@ -541,18 +546,25 @@ export async function cmdUI(args) {
|
|
|
541
546
|
return;
|
|
542
547
|
}
|
|
543
548
|
|
|
544
|
-
// Build message with history
|
|
545
|
-
const
|
|
549
|
+
// Build message with history (merge persisted + request history)
|
|
550
|
+
const requestHistory = body.history || [];
|
|
546
551
|
const parts = [];
|
|
547
|
-
for (const turn of
|
|
552
|
+
for (const turn of requestHistory) {
|
|
548
553
|
const prefix = turn.role === 'user' ? '[User]' : '[Assistant]';
|
|
549
554
|
parts.push(`${prefix} ${turn.content}`);
|
|
550
555
|
}
|
|
551
556
|
parts.push(`[User] ${body.message}`);
|
|
552
557
|
const userMessage = parts.join('\n\n');
|
|
553
558
|
|
|
559
|
+
// Inject episodic memory context into the system prompt
|
|
560
|
+
let enrichedSystemPrompt = chatSystemPrompt;
|
|
554
561
|
try {
|
|
555
|
-
const
|
|
562
|
+
const memCtx = buildMemoryContext('chat', body.message);
|
|
563
|
+
if (memCtx) enrichedSystemPrompt = chatSystemPrompt + memCtx;
|
|
564
|
+
} catch { /* memory unavailable */ }
|
|
565
|
+
|
|
566
|
+
try {
|
|
567
|
+
const response = await callLLM(config, enrichedSystemPrompt, userMessage);
|
|
556
568
|
const { textParts, actions } = parseActions(response);
|
|
557
569
|
const textResponse = textParts.join('\n\n');
|
|
558
570
|
|
|
@@ -573,7 +585,7 @@ export async function cmdUI(args) {
|
|
|
573
585
|
const toolContext = toolResults.map(t => `[${t.action} result]: ${t.result}`).join('\n\n');
|
|
574
586
|
const followUp = `The user asked: "${body.message}"\n\nI executed these tools and got REAL results:\n\n${toolContext}\n\nNow respond to the user based ONLY on the REAL data above. Do NOT invent or fabricate any information. Present the actual results clearly.`;
|
|
575
587
|
try {
|
|
576
|
-
fullResponse = await callLLM(config,
|
|
588
|
+
fullResponse = await callLLM(config, enrichedSystemPrompt, followUp);
|
|
577
589
|
} catch {
|
|
578
590
|
// Fallback: show raw results
|
|
579
591
|
fullResponse = toolResults.map(t => `${t.action}: ${t.result}`).join('\n\n');
|
|
@@ -582,6 +594,15 @@ export async function cmdUI(args) {
|
|
|
582
594
|
fullResponse = textResponse;
|
|
583
595
|
}
|
|
584
596
|
|
|
597
|
+
// Persist chat history and extract episodic memory (fire-and-forget)
|
|
598
|
+
try {
|
|
599
|
+
const persistedHistory = loadChatHistory();
|
|
600
|
+
persistedHistory.push({ role: 'user', content: body.message });
|
|
601
|
+
persistedHistory.push({ role: 'assistant', content: fullResponse });
|
|
602
|
+
saveChatHistory(persistedHistory);
|
|
603
|
+
} catch { /* non-critical */ }
|
|
604
|
+
try { extractMemory('chat', body.message, fullResponse); } catch { /* non-critical */ }
|
|
605
|
+
|
|
585
606
|
sendJSON(res, 200, { response: fullResponse, toolResults, actions });
|
|
586
607
|
} catch (e) {
|
|
587
608
|
sendJSON(res, 200, { response: null, error: e.message });
|