Files
memind_adm/src/admin/pages/memory-v2-config.ts
T
john 4c33f210da fix(memory-v2): align Runtime Control section enabled badge with active switches.
Runtime control has no top-level enabled field; derive section status from agent resolve, injection mode, and lifecycle flags so the admin page matches saved production config.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 21:37:02 +08:00

35 lines
939 B
TypeScript

import type { MemoryV2AdminSection } from '../../types';
type CapabilityKey =
| 'candidateMemory'
| 'runtimeControl'
| 'policy'
| 'retriever'
| 'lifecycle'
| 'persona'
| 'graph'
| 'userMemory'
| 'pluginHealth';
function modeEnabled(value: unknown) {
const mode = String(value ?? 'off').trim().toLowerCase();
return mode !== '' && mode !== 'off';
}
export function isMemoryV2SectionEnabled(
sectionKey: CapabilityKey,
section: MemoryV2AdminSection | undefined,
): boolean {
const config = section ?? {};
if (sectionKey === 'runtimeControl') {
return Boolean(config.agentResolveEnabled)
|| modeEnabled(config.agentInjectionMode)
|| Boolean(config.promotionEnabled)
|| Boolean(config.compactionV2Enabled)
|| Boolean(config.reflectionEnabled)
|| Boolean(config.lifecycleWorkerEnabled)
|| modeEnabled(config.lifecycleRolloutMode);
}
return Boolean(config.enabled);
}