openclaw/src/context-engine/init.ts

24 lines
703 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { registerLegacyContextEngine } from "./legacy.js";
/**
* Ensures all built-in context engines are registered exactly once.
*
* The legacy engine is always registered as a safe fallback so that
* `resolveContextEngine()` can resolve the default "legacy" slot without
* callers needing to remember manual registration.
*
* Additional engines are registered by their own plugins via
* `api.registerContextEngine()` during plugin load.
*/
let initialized = false;
export function ensureContextEnginesInitialized(): void {
if (initialized) {
return;
}
initialized = true;
// Always available safe fallback for the "legacy" slot default.
registerLegacyContextEngine();
}