feat: add session-tools-store for tracking tool restrictions per session
In-memory Map-based store that records tool restriction objects (e.g., question: false) by sessionID when prompts are sent. This enables retrieving the original session's tool parameters when background tasks complete and need to notify the parent session.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
const store = new Map<string, Record<string, boolean>>()
|
||||
|
||||
export function setSessionTools(sessionID: string, tools: Record<string, boolean>): void {
|
||||
store.set(sessionID, { ...tools })
|
||||
}
|
||||
|
||||
export function getSessionTools(sessionID: string): Record<string, boolean> | undefined {
|
||||
const tools = store.get(sessionID)
|
||||
return tools ? { ...tools } : undefined
|
||||
}
|
||||
|
||||
export function clearSessionTools(): void {
|
||||
store.clear()
|
||||
}
|
||||
Reference in New Issue
Block a user