Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
Keep reminder internals as test hooks, not public exports
Claude0e9f2abdecec
diff --git a/server/services/humanActionReminders.js b/server/services/humanActionReminders.jsindex c566aa5146..fd4669d406 100644--- a/server/services/humanActionReminders.js+++ b/server/services/humanActionReminders.js@@ -38,7 +38,7 @@ function disarm(id) {}/** Send the reminder for one thread if it is still due and not yet reminded. */-export async function fireHumanActionReminder(threadId, deps = {}) {+async function fireHumanActionReminder(threadId, deps = {}) {const storage = deps.storage || brainStorage;const notify = deps.addNotification || addNotification;const now = deps.now ? deps.now() : Date.now();@@ -65,7 +65,7 @@ export async function fireHumanActionReminder(threadId, deps = {}) {}/** Arm, re-arm, disarm or fire for every human action thread this machine created. */-export async function reconcileHumanActionReminders(deps = {}) {+async function reconcileHumanActionReminders(deps = {}) {const storage = deps.storage || brainStorage;const scheduler = deps.scheduler || eventScheduler;const now = deps.now ? deps.now() : Date.now();@@ -125,10 +125,17 @@ export async function initHumanActionReminders() {console.log(`⏰ Human action reminders ready${count ? ` (${count} armed)` : ''}${fired ? `, ${fired} caught up` : ''}`);}-export function stopHumanActionReminders() {+function stopHumanActionReminders() {brainEvents.off('threads:upserted', onThreadEvent);brainEvents.off('threads:deleted', onThreadEvent);brainEvents.off('record:changed', onRecordChanged);for (const id of [...armed.keys()]) disarm(id);started = false;}++// Test hooks: the clock with injected storage, scheduler and time.+export {+ fireHumanActionReminder as _fireHumanActionReminder,+ reconcileHumanActionReminders as _reconcileHumanActionReminders,+ stopHumanActionReminders as _stopHumanActionReminders,+};diff --git a/server/services/humanActionReminders.test.js b/server/services/humanActionReminders.test.jsindex bf3a9bcb74..91685c1861 100644--- a/server/services/humanActionReminders.test.js+++ b/server/services/humanActionReminders.test.js@@ -4,7 +4,11 @@ vi.mock('./brainStorage.js', () => ({ brainEvents: { on: vi.fn(), off: vi.fn() }vi.mock('./eventScheduler.js', () => ({ schedule: vi.fn(), cancel: vi.fn() }));vi.mock('./notifications.js', () => ({ addNotification: vi.fn(), NOTIFICATION_TYPES: { ACTION_DUE: 'action_due' } }));-import { fireHumanActionReminder, reconcileHumanActionReminders, stopHumanActionReminders } from './humanActionReminders.js';+import {+ _fireHumanActionReminder as fireHumanActionReminder,+ _reconcileHumanActionReminders as reconcileHumanActionReminders,+ _stopHumanActionReminders as stopHumanActionReminders,+} from './humanActionReminders.js';const NOW = Date.parse('2026-10-06T18:00:00.000Z');const ME = 'instance-a';diff --git a/server/services/musicVideo/promotionPlan.test.js b/server/services/musicVideo/promotionPlan.test.jsindex 3c110e2781..e64cb7b10d 100644--- a/server/services/musicVideo/promotionPlan.test.js+++ b/server/services/musicVideo/promotionPlan.test.js@@ -1,6 +1,6 @@import { describe, it, expect, vi } from 'vitest';import { planMusicVideoPromotion } from './promotionPlan.js';-import { buildPromotionPlanPrompt, promotionPlanKey, promotionStepDueAt } from './promotionPlanText.js';+import { buildPromotionPlanPrompt, parsePromotionPlan, promotionPlanKey } from './promotionPlanText.js';// 2026-10-06 11:00 in Los Angeles.const NOW = Date.parse('2026-10-06T18:00:00.000Z');@@ -78,7 +78,9 @@ describe('promotion plan text', () => {it('places a step across a DST change at its local time', () => {// 2026-11-01 is the US fall-back day; 18:00 local is 02:00Z the next day (PST, UTC-8).- expect(promotionStepDueAt(0, '18:00', TZ, Date.parse('2026-11-01T17:00:00.000Z'))).toBe('2026-11-02T02:00:00.000Z');+ const reply = JSON.stringify({ steps: [{ title: 'Post', day: 0, time: '18:00', instructions: ['Post it.'] }] });+ const [step] = parsePromotionPlan(reply, { timezone: TZ, now: Date.parse('2026-11-01T17:00:00.000Z') });+ expect(step.dueAt).toBe('2026-11-02T02:00:00.000Z');});it('says nothing has been posted when nothing has', () => {diff --git a/server/services/musicVideo/promotionPlanText.js b/server/services/musicVideo/promotionPlanText.jsindex 0207b2c7be..33bd1c294b 100644--- a/server/services/musicVideo/promotionPlanText.js+++ b/server/services/musicVideo/promotionPlanText.js@@ -83,7 +83,7 @@ export function buildPromotionPlanPrompt(project, { goal = '', audience = '', da}/** Local `day` (0 = today) at `time` HH:MM in `timezone`, as an ISO instant; never in the past. */-export function promotionStepDueAt(day, time, timezone, now = Date.now()) {+function promotionStepDueAt(day, time, timezone, now = Date.now()) {const today = todayInTimezone(timezone, new Date(now));const [y, m, d] = today.split('-').map(Number);const target = new Date(Date.UTC(y, m - 1, d + day)).toISOString().slice(0, 10);