feat: add allowedAgents config for memory hooks#28
feat: add allowedAgents config for memory hooks#28rbutera wants to merge 3 commits intosupermemoryai:mainfrom
Conversation
…fined When cfg.allowedAgents is set and sessionKey is undefined, the guard condition used optional chaining (sessionKey?.includes()) which returns undefined. Array.some() treated undefined as falsy, so .some() returned false. The negation (!false) triggered an early return, silently blocking capture/recall for sessions without a sessionKey. Fix: only apply the allowedAgents filter when sessionKey is present. Sessions without a sessionKey fall through and are processed normally, restoring prior behavior. Also adds two regression tests covering the undefined sessionKey case.
|
Good catch - the bug is real. When Fixed in the latest commit by gating the filter on |
|
Hey @Dhravya @Prasanna721, this is ready for review whenever you get a chance. CI is green, and the undefined sessionKey edge case from the Seer review is fixed with regression tests. Would love to get this merged so we can set up per-agent memory isolation. Thanks! |
Summary
allowedAgents?: string[]to plugin config parsing and schemasessionKeydoes not match an allowed agentsessionKeydoes not match an allowed agentCloses #27.
Behavior
When
allowedAgentsis omitted, behavior stays the same as today.When
allowedAgentsis set, auto-capture and auto-recall only run for sessions whosesessionKeyincludes one of the configured agent IDs, for exampleagent:navi:main.Test plan
bun test allowed-agents.test.tsbun run check-typesbun run lint