Add agent color styling and session persistence

This commit is contained in:
Chris Scott committed 2026-02-27 17:01:56 -05:00
1 parent 13ebfc12b6
commit f368a2fa62
5 files changed
+253 -85

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
import { create } from 'zustand'
import { persist } from 'zustand/middleware'
interface SessionAgentStore {
agents: Record<string, string>
setAgent: (sessionID: string, agent: string) => void
getAgent: (sessionID: string) => string | null
}
export const useSessionAgentStore = create<SessionAgentStore>()(
persist(
(set, get) => ({
agents: {},
setAgent: (sessionID: string, agent: string) =>
set((state) => ({
agents: { ...state.agents, [sessionID]: agent },
})),
getAgent: (sessionID: string) => get().agents[sessionID] ?? null,
}),
{
name: 'opencode-session-agents',
partialize: (state) => ({ agents: state.agents }),
}
)
)