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.
15 lines
423 B
TypeScript
15 lines
423 B
TypeScript
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()
|
|
}
|