feat(FN-1412): add plugin lifecycle event relay over dashboard SSE

- Add PluginLifecycleEvent type and relay infrastructure in sse.ts
- Emit plugin lifecycle events (install, uninstall, enable, disable) via dashboard SSE
- Wire up plugin events in server.ts to broadcast to connected clients
- Add comprehensive tests for SSE plugin event relay and server integration
- Add .fusion/memory.md with plugin lifecycle documentation
This commit is contained in:
gsxdsm
2026-04-10 03:15:45 -07:00
parent a80595e3c1
commit 34f780e63b
5 changed files with 578 additions and 17 deletions

View File

@@ -218,7 +218,7 @@ export function createServer(store: TaskStore, options?: ServerOptions): ReturnT
app.get("/api/events", rateLimit(RATE_LIMITS.sse), async (req, res) => {
const projectId = typeof req.query.projectId === "string" ? req.query.projectId : undefined;
if (!projectId) {
createSSE(store, store.getMissionStore(), aiSessionStore)(req, res);
createSSE(store, store.getMissionStore(), aiSessionStore, store.getPluginStore())(req, res);
return;
}
@@ -226,7 +226,9 @@ export function createServer(store: TaskStore, options?: ServerOptions): ReturnT
// Use the shared project-store resolver so SSE listeners attach to
// the same EventEmitter used by project-scoped task API routes.
const scopedStore = await getOrCreateProjectStore(projectId);
createSSE(scopedStore, scopedStore.getMissionStore(), aiSessionStore)(req, res);
createSSE(scopedStore, scopedStore.getMissionStore(), aiSessionStore, scopedStore.getPluginStore(), {
projectId,
})(req, res);
} catch (err: any) {
sendErrorResponse(res, 500, err.message ?? "Failed to open project event stream");
}