- Updated runtime memory config loading and backend resolution so `memory.backend === "local"` now enables the local pipeline directly, while `memories.enabled` is treated only as a legacy migration input. - Switched the `memory.backend` default to `off` and kept `memories.enabled` hidden from the Memory tab UI for migration compatibility. - Adjusted memory runtime, resolver, and documentation/tests to match the new backend-selection semantics.
25 lines
967 B
TypeScript
25 lines
967 B
TypeScript
import type { Settings } from "../config/settings";
|
|
import { hindsightBackend } from "../hindsight";
|
|
import { localBackend } from "./local-backend";
|
|
import { offBackend } from "./off-backend";
|
|
import type { MemoryBackend } from "./types";
|
|
|
|
/**
|
|
* Pick the active memory backend for a Settings instance.
|
|
*
|
|
* Selection rules (single source of truth — every memory consumer routes
|
|
* through this):
|
|
* - `memory.backend === "hindsight"` → Hindsight remote memory
|
|
* - `memory.backend === "local"` → local pipeline
|
|
* - everything else → no-op
|
|
*
|
|
* `memories.enabled` remains accepted only as a legacy migration input. Once
|
|
* a config is loaded, `memory.backend` is the sole runtime selector.
|
|
*/
|
|
export function resolveMemoryBackend(settings: Settings): MemoryBackend {
|
|
const id = settings.get("memory.backend");
|
|
if (id === "hindsight") return hindsightBackend;
|
|
if (id === "local") return localBackend;
|
|
return offBackend;
|
|
}
|