diff --git a/src/core/bot.ts b/src/core/bot.ts index 05c17a0..85abf09 100644 --- a/src/core/bot.ts +++ b/src/core/bot.ts @@ -187,7 +187,7 @@ export function resolveHeartbeatConversationKey( } export class LettaBot implements AgentSession { - private store: Store; + readonly store: Store; private config: BotConfig; private channels: Map = new Map(); private messageQueue: Array<{ msg: InboundMessage; adapter: ChannelAdapter }> = []; @@ -485,6 +485,14 @@ export class LettaBot implements AgentSession { return this.sessionManager.warmSession(); } + /** + * Invalidate cached session(s), forcing a fresh session on next message. + * The next message will create a fresh session using the current store state. + */ + invalidateSession(key?: string): void { + this.sessionManager.invalidateSession(key); + } + // ========================================================================= // Channel management // =========================================================================