Wire bounded resident Void rumination
This commit is contained in:
parent
84c7d30038
commit
b09267ed34
9 changed files with 45 additions and 2 deletions
|
|
@ -12,6 +12,9 @@ import { projectVoidModerationOperations } from "./void-moderation-text-actuator
|
|||
import { runVoidModerationEnforcement } from "./void-moderation-enforcement-organ.js";
|
||||
import { runVoidCandidateDelivery } from "./void-candidate-delivery-organ.js";
|
||||
import { deliverVoidCandidateViaBifrost } from "./bifrost-discord-delivery-actuator.js";
|
||||
import { runVoidRumination } from "./void-rumination-organ.js";
|
||||
import { projectVoidRuminationOperations } from "./void-rumination-text-actuator.js";
|
||||
import { readVoidModerationEvidence } from "./void-moderation-evidence-source.js";
|
||||
|
||||
const config = loadConfig();
|
||||
const intervalMs = Math.max(1, config.repoFaceHeartbeats.intervalMinutes) * 60_000;
|
||||
|
|
@ -20,8 +23,10 @@ let activeTick: Promise<void> | undefined;
|
|||
let timer: NodeJS.Timeout | undefined;
|
||||
let lastPhysiologyAt = 0;
|
||||
let lastModerationAt = 0;
|
||||
let lastRuminationAt = 0;
|
||||
const physiologyIntervalMs = Math.max(5, Number(process.env.VOIDBOT_MOOD_INTERVAL_MINUTES) || 5) * 60_000;
|
||||
const moderationIntervalMs = config.voidModerationDaemon.intervalMinutes * 60_000;
|
||||
const ruminationIntervalMs = config.voidRuminationDaemon.intervalMinutes * 60_000;
|
||||
|
||||
function runTick(): Promise<void> {
|
||||
if (activeTick) {
|
||||
|
|
@ -75,6 +80,25 @@ function runTick(): Promise<void> {
|
|||
console.error(`Void moderation-enforcement pulse failed; pending cases remain typed debt for the next cadence. ${error instanceof Error ? error.stack ?? error.message : String(error)}`);
|
||||
}
|
||||
}
|
||||
if (config.voidRuminationDaemon.enabled && Date.now() - lastRuminationAt >= ruminationIntervalMs) {
|
||||
lastRuminationAt = Date.now();
|
||||
try {
|
||||
const evidence = await readVoidModerationEvidence({ fallbackHours: 6, limit: 80 });
|
||||
const latestMessage = evidence.messages.at(-1);
|
||||
const rumination = await runVoidRumination({
|
||||
statePath: resolve(config.storageRoot, "private", "void-self-state.cc"),
|
||||
recentHistory: { messages: evidence.messages },
|
||||
recentConversationTarget: latestMessage ? { channelId: latestMessage.channelId, replyToMessageId: latestMessage.id } : undefined,
|
||||
publicSpeechTarget: config.repoFaceHeartbeats.defaultChannelId ? { channelId: config.repoFaceHeartbeats.defaultChannelId } : undefined,
|
||||
doctrine: await readFile(resolve("config", "void-rumination-doctrine.md"), "utf8"),
|
||||
rules: await readFile(resolve("config", "discord-server-rules.md"), "utf8"),
|
||||
voice: await readFile(resolve(config.stylePackPath), "utf8"),
|
||||
}, { projectText: (prompt) => projectVoidRuminationOperations({ prompt, config }) });
|
||||
console.log(`Void rumination pulse completed. ${JSON.stringify(rumination)}`);
|
||||
} catch (error) {
|
||||
console.error(`Void rumination pulse failed without cadence retry. ${error instanceof Error ? error.stack ?? error.message : String(error)}`);
|
||||
}
|
||||
}
|
||||
if (config.voidCandidateDelivery.enabled) {
|
||||
try {
|
||||
const delivery = await runVoidCandidateDelivery({
|
||||
|
|
|
|||
Loading…
Reference in a new issue