/ services / autoDream / config.ts
config.ts
 1  // Leaf config module — intentionally minimal imports so UI components
 2  // can read the auto-dream enabled state without dragging in the forked
 3  // agent / task registry / message builder chain that autoDream.ts pulls in.
 4  
 5  import { getInitialSettings } from '../../utils/settings/settings.js'
 6  import { getFeatureValue_CACHED_MAY_BE_STALE } from '../analytics/growthbook.js'
 7  
 8  /**
 9   * Whether background memory consolidation should run. User setting
10   * (autoDreamEnabled in settings.json) overrides the GrowthBook default
11   * when explicitly set; otherwise falls through to tengu_onyx_plover.
12   */
13  export function isAutoDreamEnabled(): boolean {
14    const setting = getInitialSettings().autoDreamEnabled
15    if (setting !== undefined) return setting
16    const gb = getFeatureValue_CACHED_MAY_BE_STALE<{ enabled?: unknown } | null>(
17      'tengu_onyx_plover',
18      null,
19    )
20    return gb?.enabled === true
21  }