fix(llm-task): load runEmbeddedPiAgent from dist/extensionAPI in installs

This commit is contained in:
vignesh07
2026-03-05 17:16:14 -08:00
parent d86a12eb62
commit 3cd4978a09

View File

@@ -25,11 +25,14 @@ async function loadRunEmbeddedPiAgent(): Promise<RunEmbeddedPiAgentFn> {
}
// Bundled install (built)
const mod = await import("../../../src/agents/pi-embedded-runner.js");
if (typeof mod.runEmbeddedPiAgent !== "function") {
// NOTE: there is no src/ tree in a packaged install. Prefer a stable internal entrypoint.
const mod = await import("../../../dist/extensionAPI.js");
// oxlint-disable-next-line typescript/no-explicit-any
const fn = (mod as any).runEmbeddedPiAgent;
if (typeof fn !== "function") {
throw new Error("Internal error: runEmbeddedPiAgent not available");
}
return mod.runEmbeddedPiAgent as RunEmbeddedPiAgentFn;
return fn as RunEmbeddedPiAgentFn;
}
function stripCodeFences(s: string): string {