From f04e0458159e9e7ec7cd9e4fa540a49be844cbcd Mon Sep 17 00:00:00 2001 From: Nimrod Gutman Date: Sat, 11 Apr 2026 20:31:49 +0300 Subject: [PATCH] fix(context-engine): restore bundled legacy engine loading (#64936) --- src/context-engine/legacy.registration.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/context-engine/legacy.registration.ts b/src/context-engine/legacy.registration.ts index e7e414421e1..3bd131114be 100644 --- a/src/context-engine/legacy.registration.ts +++ b/src/context-engine/legacy.registration.ts @@ -1,21 +1,20 @@ import { registerContextEngineForOwner } from "./registry.js"; import type { ContextEngine } from "./types.js"; -const LEGACY_CONTEXT_ENGINE_CANDIDATES = ["./legacy.js", "./legacy.ts"] as const; - type LegacyContextEngineModule = { LegacyContextEngine: new () => ContextEngine; }; async function loadLegacyContextEngineModule(): Promise { - for (const candidate of LEGACY_CONTEXT_ENGINE_CANDIDATES) { + try { + return (await import("./legacy.js")) as LegacyContextEngineModule; + } catch { try { - return (await import(candidate)) as LegacyContextEngineModule; + return (await import("./legacy.ts")) as LegacyContextEngineModule; } catch { - // Try runtime/source candidates in order. + throw new Error("Failed to load legacy context engine runtime."); } } - throw new Error("Failed to load legacy context engine runtime."); } export function registerLegacyContextEngine(): void {