Commit 0cbb397
committed
feat(memory)!: memoryProvider auto-wires on all four agent call paths
Pass memoryProvider on createAgent and memory getContext + observe fire
on every call path: agent.stream(), agent.generate(), agent.session().send(),
agent.session().stream(). Previously only session paths invoked memory.
AgentMemoryProvider interface replaces memoryProvider?: any. Shared
applyMemoryProvider helper consolidates the wiring across all four
paths. Hook timeout, fire-and-forget observes, and user-hook chaining
semantics match the existing session-path behavior.
BREAKING CHANGE: Direct agent.stream() / agent.generate() now invoke
memoryProvider.getContext before the LLM call and memoryProvider.observe
after. Callers who passed memoryProvider on createAgent but did not want
it to fire on direct calls (no legitimate use case) will see behavior
change. Callers using .session() paths are unaffected — behavior
unchanged.
Type change: memoryProvider: any is now typed as AgentMemoryProvider
interface with optional getContext + observe methods. Callers passing
malformed providers will see TypeScript errors at the provider
boundary.
Migration:
- .session() path: no change required, behavior unchanged.
- Direct path wanting memory: already passed memoryProvider; now it
works. Remove any manual onBeforeGeneration wiring that previously
worked around the silent-ignore.
- Direct path not wanting memory: remove memoryProvider from the
createAgent config.1 parent f57c21e commit 0cbb397
0 file changed
0 commit comments