feat(FN-1776): expose AgentStore for SSE event forwarding with ephemeral agent filtering

- Expose getAgentStore from runtime and engine packages
- Add includeSystem filter to getOrgTree API endpoint
- Wire AgentStore into SSE endpoint for event forwarding
- Forward agent events through the SSE pipeline
- Exclude ephemeral agents from org tree API and UI
- Filter ephemeral agents in useAgents hook
- Update AgentsView test to expect includeSystem filter
- Document agent SSE event forwarding architecture
This commit is contained in:
Fusion
2026-04-16 01:44:54 -07:00
committed by gsxdsm
parent 8a3c192301
commit 45b6b5cfad
12 changed files with 85 additions and 15 deletions

View File

@@ -9,6 +9,13 @@
- `agent.metadata?.managedBy === "task-executor"` — executor-managed agents
- Default: `includeSystem: false` excludes these from the agents page UI
- **`FN-1776 Agent SSE Event Forwarding`**: Agent lifecycle events are now forwarded through the SSE pipeline:
- `createSSE()` accepts an optional `AgentStore` parameter for forwarding `agent:created`, `agent:updated`, `agent:deleted`, and `agent:stateChanged` events
- `getOrgTree()` accepts `{ includeSystem?: boolean }` filter matching `listAgents()` pattern
- `GET /api/agents/org-tree` supports `includeSystem` query parameter
- `useAgents` hook passes `includeSystem: false` by default, excluding ephemeral agents
- Server SSE endpoint resolves `AgentStore` from engine via `getAgentStore()` for project-scoped streams
- **`FN-1736 Multi-Project Scoping Audit`**: Comprehensive audit of project-scoping across the Fusion stack found:
- SSE/WebSocket endpoints (`/api/tasks/:id/logs/stream`, `/api/events`, `/api/ws`) already use `resolveProjectScopedStore()` or `getProjectContext()` correctly
- Badge WebSocket (`setupBadgeWebSocket`) properly scopes per-project with listeners on scoped stores