fix(FN-1952): restore pi auth and extension loading

This commit is contained in:
gsxdsm
2026-04-16 21:42:16 -07:00
parent a99af24297
commit 8df18fab2b
30 changed files with 644 additions and 72 deletions

View File

@@ -101,7 +101,11 @@ async function initEngine() {
}
}
const engineReady = initEngine();
let engineReady: Promise<void> | undefined;
function ensureEngineReady() {
engineReady ??= initEngine();
return engineReady;
}
// ── Constants ───────────────────────────────────────────────────────────────
@@ -492,6 +496,7 @@ function cleanupExpiredSessions(): void {
}
const cleanupInterval = setInterval(cleanupExpiredSessions, CLEANUP_INTERVAL_MS);
cleanupInterval.unref?.();
process.on("beforeExit", () => clearInterval(cleanupInterval));
// ── Stream Manager ──────────────────────────────────────────────────────────
@@ -671,7 +676,7 @@ async function createTargetInterviewAgent(
session: TargetInterviewSession,
rootDir: string,
): Promise<AgentResult> {
await engineReady;
await ensureEngineReady();
return createKbAgent({
cwd: rootDir,