mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
Add agent color styling and session persistence
This commit is contained in:
1 parent
13ebfc12b6
commit
f368a2fa62
5 files changed
+253
-85
No files matched your search
@@ -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 }),
|
||||
}
|
||||
)
|
||||
)
|
||||
Reference in new issue
Block a user