feat: add dynamic autonomous DAVE presence
This commit is contained in:
14
server.mjs
14
server.mjs
@@ -17,6 +17,7 @@ import { generateLLMIdeas } from './lib/llm/ideas.mjs';
|
||||
import { TelegramChatAssistant, buildTelegramChatContext } from './lib/llm/telegram-chat.mjs';
|
||||
import { TerminalAgent } from './lib/agent/terminal-agent.mjs';
|
||||
import { createTerminalToolRegistry } from './lib/agent/terminal-tools.mjs';
|
||||
import { DavePresence } from './lib/agent/dave-presence.mjs';
|
||||
import { SecurityProfileStore } from './lib/security/security-profile-store.mjs';
|
||||
import { SecurityOnboarding } from './lib/security/security-onboarding.mjs';
|
||||
import { evaluateSecurityAlertPolicy } from './lib/security/security-alert-policy.mjs';
|
||||
@@ -97,11 +98,21 @@ const telegramChatAssistant = new TelegramChatAssistant({
|
||||
maxTokens: config.telegram.aiMaxTokens,
|
||||
timeoutMs: config.telegram.aiTimeoutMs,
|
||||
});
|
||||
const davePresence = new DavePresence({
|
||||
agent: terminalAgent,
|
||||
alerter: telegramAlerter,
|
||||
profileStore: securityProfileStore,
|
||||
getContext: () => buildTelegramChatContext(currentData, buildHealth()),
|
||||
getRuntime: () => ({ data: currentData, delta: memory.getLastDelta() }),
|
||||
statePath: join(RUNS_DIR, 'dave-presence-state.json'),
|
||||
config: config.davePresence,
|
||||
});
|
||||
|
||||
if (llmProvider) console.log(`[Crucix] LLM enabled: ${llmProvider.name} (${llmProvider.model})`);
|
||||
else if (config.llm.provider) console.warn(`[Crucix] LLM provider "${config.llm.provider}" is not configured; LLM features disabled`);
|
||||
if (telegramAlerter.isConfigured) {
|
||||
console.log('[Crucix] Telegram alerts enabled');
|
||||
telegramAlerter.onActivity(() => davePresence.noteUserInteraction());
|
||||
|
||||
// ─── Two-Way Bot Commands ───────────────────────────────────────────────
|
||||
|
||||
@@ -299,6 +310,7 @@ if (telegramAlerter.isConfigured) {
|
||||
console.error('[Security Manager] Initial onboarding failed:', error.message);
|
||||
});
|
||||
}
|
||||
if (davePresence.start()) console.log('[DAVE Presence] Dynamic presence enabled');
|
||||
}
|
||||
|
||||
// === Discord Bot ===
|
||||
@@ -704,6 +716,7 @@ function buildHealth() {
|
||||
maxSteps: config.telegram.agentMaxSteps,
|
||||
proactive: Boolean(config.telegram.agentEnabled && config.telegram.agentProactiveEnabled),
|
||||
},
|
||||
davePresence: davePresence.status(),
|
||||
discordEnabled: !!(config.discord?.botToken || config.discord?.webhookUrl),
|
||||
terminalActionsEnabled: config.terminalActionsEnabled,
|
||||
terminalActionsTokenRequired: !!config.sweepToken,
|
||||
@@ -881,6 +894,7 @@ async function runSweepCycle() {
|
||||
memory.pruneAlertedSignals();
|
||||
|
||||
currentData = synthesized;
|
||||
davePresence.nudge(delta);
|
||||
lastSuccessfulSweepTime = lastSweepTime;
|
||||
intelligenceStore.recordRun(currentData, delta);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user