fix(FN-XXX): harden windows path handling

This commit is contained in:
gsxdsm
2026-04-29 07:35:23 -07:00
parent dba6059080
commit bd14cf84e3
17 changed files with 189 additions and 32 deletions

View File

@@ -40,6 +40,7 @@ import {
writeProjectMemoryFile,
updatePiExtensionDisabledIds,
} from "@fusion/core";
import { createFnAgent as engineCreateFnAgent } from "@fusion/engine";
import { ApiError, badRequest } from "../api-error.js";
import { generateRemoteToken, issueRemoteAuthToken, maskRemoteToken } from "../remote-auth.js";
import { invalidateAllGlobalSettingsCaches } from "../project-store-resolver.js";
@@ -1008,7 +1009,6 @@ export function registerSettingsMemoryRoutes(ctx: ApiRoutesContext, deps: Settin
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let session: any = null;
try {
await initCreateFnAgentForInsights();
if (!createFnAgentForInsights) {
throw new ApiError(503, "AI service unavailable for dream processing");
}
@@ -1070,20 +1070,8 @@ export function registerSettingsMemoryRoutes(ctx: ApiRoutesContext, deps: Settin
// ── Memory Insights Routes ───────────────────────────────────────────
// Lazy-loaded createFnAgent for AI operations (same pattern as ai-refine.ts)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let createFnAgentForInsights: any;
async function initCreateFnAgentForInsights(): Promise<void> {
if (createFnAgentForInsights) return;
try {
// Use dynamic import with @vite-ignore to prevent static analysis issues
const engine = await import(/* @vite-ignore */ "@fusion/engine");
createFnAgentForInsights = engine.createFnAgent;
} catch {
createFnAgentForInsights = undefined;
}
}
const createFnAgentForInsights: any = engineCreateFnAgent;
/**
* GET /api/memory/insights
@@ -1148,8 +1136,6 @@ export function registerSettingsMemoryRoutes(ctx: ApiRoutesContext, deps: Settin
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let session: any = null;
try {
await initCreateFnAgentForInsights();
if (!createFnAgentForInsights) {
throw new ApiError(503, "AI engine not available");
}