multica/apps/web/app/hooks/use-active-agent.ts
Naiyuan Qing c5bf56282f feat(web): add gateway, hub, active-agent hooks and real message state
- use-gateway: GatewayClient WebSocket lifecycle with auto-connect/disconnect
- use-hub: REST polling for Hub status and agent CRUD operations
- use-active-agent: Zustand store for cross-component selected agent state
- use-messages: replace mock data with real addUser/addAssistant/clear API

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 22:40:50 +08:00

11 lines
312 B
TypeScript

import { create } from "zustand"
interface ActiveAgentState {
activeAgentId: string | null
setActiveAgentId: (id: string | null) => void
}
export const useActiveAgent = create<ActiveAgentState>()((set) => ({
activeAgentId: null,
setActiveAgentId: (id: string | null) => set({ activeAgentId: id }),
}))