/** * Bot-namespaced session storage — worker-safe (no env, no process, no * signals; runs identically on Node and Cloudflare Workers). * * `botSession(opts)` — drop-in replacement for `@gramio/session`'s * `session()` that AUTOMATICALLY namespaces every key with the * calling bot's id (parsed from `ctx.bot.options.token`). When * several bots share one storage instance, each writes to a * disjoint keyspace (`bot-:`) with no manual wiring. * Every plugin in this package (`accessControl`, `botMenu`, * `llmHistory`, …) derives the SAME prefix from `ctx.bot` for its * own storage access, so the whole package stays isolated by * construction. Use this instead of `session()` — full stop. * * Peer deps: `gramio`, `@gramio/session`. * * @example * import { redisStorage } from '@gramio/storage-redis' * import { botSession } from '@adriangalilea/utils/bot/session' * * const storage = redisStorage() // share across bots, safe * const userSession = botSession({ storage, initial: () => ({}) }) * bot.extend(userSession) */ import { type SessionOptions, session } from "@gramio/session"; /** * Drop-in replacement for `@gramio/session`'s `session()` that forces * the storage key to include the calling bot's id. Equivalent to * passing `getSessionKey: (ctx) => bot-${id}:${senderId}` explicitly, * but baked in so no consumer can forget. * * Returns a plain `@gramio/session` plugin — same shape, same derives, * fully interchangeable in `.extend(userSession)` chains and plugin * options like `accessControl({ session: userSession, … })`. * * `getSessionKey` can still be overridden for advanced cases (e.g. a * per-chat session in groups); the override is wrapped so it still * receives the `bot-:` prefix. Don't override unless you know what * you're doing — every plugin in this package expects the * `bot-:` shape for cross-user storage reads. */ export declare const botSession: (opts: SessionOptions) => ReturnType>; //# sourceMappingURL=session.d.ts.map