fix(FN-000): improve setup wizard browse flow

This commit is contained in:
gsxdsm
2026-04-22 18:50:09 -07:00
parent 0c690dd94e
commit 0c7fa7a91c
6 changed files with 325 additions and 89 deletions

View File

@@ -303,8 +303,8 @@ describe("browseDirectory API function", () => {
await browseDirectory("/home", false, "node-remote-1", "node-local-1");
expect(globalThis.fetch).toHaveBeenCalledWith(
expect.stringContaining("/api/proxy/node-remote-1/browse-directory"),
expect.any(Object)
expect.stringContaining("/api/browse-directory?path=%2Fhome&nodeId=node-remote-1"),
expect.any(Object),
);
});

View File

@@ -15028,7 +15028,7 @@ async function persistImportedSkills(
// Node-aware proxying: route to remote node if nodeId is provided and not local
if (nodeId) {
const { CentralCore } = await import("@fusion/core");
const central = new CentralCore();
const central = new CentralCore(store.getFusionDir());
await central.init();
const localNodes = await central.listNodes();
@@ -15063,6 +15063,10 @@ async function persistImportedSkills(
signal: AbortSignal.timeout(30000),
});
if (proxyRes.status === 401 && !node.apiKey) {
throw unauthorized("Remote node rejected directory browse request. Configure an apiKey for that node in Fusion settings.");
}
const body = Buffer.from(await proxyRes.arrayBuffer());
// Filter hop-by-hop headers
const skipHeaders = new Set(["connection", "keep-alive", "transfer-encoding", "upgrade"]);