/** * Storage-Based Elicitation Store * * Unified elicitation store implementation using @frontmcp/utils storage abstractions. * Works with Memory, Redis, and Upstash backends. * * @module elicitation/store/storage-elicitation.store */ import type { NamespacedStorage } from '@frontmcp/utils'; import type { FrontMcpLogger } from '../../common'; import type { ElicitationStore, PendingElicitRecord, ElicitResultCallback, ElicitUnsubscribe } from './elicitation.store'; import type { ElicitResult, PendingElicitFallback, ResolvedElicitResult, FallbackExecutionResult, FallbackResultCallback } from '../elicitation.types'; /** * Elicitation store using @frontmcp/utils storage abstractions. * * Features: * - Uses TypedStorage for type-safe JSON serialization * - Uses NamespacedStorage for key prefixing * - Uses native pub/sub from storage adapter (works with Memory, Redis, Upstash) * - Automatic TTL-based expiration * * Storage layout: * - `pending:{sessionId}` - Pending elicitation records * - `fallback:{elicitId}` - Fallback context for re-invocation * - `resolved:{elicitId}` - Pre-resolved results for fallback flow * - Pub/sub channel: `result:{elicitId}` - Result routing */ export declare class StorageElicitationStore implements ElicitationStore { private readonly storage; private readonly pending; private readonly fallback; private readonly resolved; private readonly logger?; /** Local callback registry for pub/sub (maps elicitId -> callbacks) */ private readonly localCallbacks; /** Active subscriptions (maps elicitId -> unsubscribe function) */ private readonly activeSubscriptions; /** Pending subscriptions guard to prevent duplicate concurrent subscribe calls */ private readonly pendingSubscriptions; /** Local callback registry for fallback results (maps elicitId -> callbacks) */ private readonly fallbackResultCallbacks; /** Active fallback subscriptions (maps elicitId -> unsubscribe function) */ private readonly activeFallbackSubscriptions; /** Pending fallback subscriptions guard */ private readonly pendingFallbackSubscriptions; constructor(storage: NamespacedStorage, logger?: FrontMcpLogger); /** * Store a pending elicitation with TTL. */ setPending(record: PendingElicitRecord): Promise; /** * Get a pending elicitation by session ID. */ getPending(sessionId: string): Promise; /** * Delete a pending elicitation by session ID. */ deletePending(sessionId: string): Promise; /** * Subscribe to elicitation results for a specific elicit ID. * Uses in-flight subscription guard to prevent duplicate concurrent subscriptions. */ subscribeResult(elicitId: string, callback: ElicitResultCallback, _sessionId?: string): Promise; /** * Publish an elicitation result. * * When pub/sub is supported, we rely entirely on the pub/sub mechanism * to deliver messages (even locally). This avoids double-invocation for * memory-based storage where pub/sub IS local. * * When pub/sub is not supported, we invoke local callbacks directly. */ publishResult(elicitId: string, sessionId: string, result: ElicitResult): Promise; /** * Store a pending elicitation fallback context. */ setPendingFallback(record: PendingElicitFallback): Promise; /** * Get a pending elicitation fallback by elicit ID. */ getPendingFallback(elicitId: string, _sessionId?: string): Promise; /** * Delete a pending elicitation fallback by elicit ID. */ deletePendingFallback(elicitId: string): Promise; /** * Store a resolved elicit result for re-invocation. */ setResolvedResult(elicitId: string, result: ElicitResult, _sessionId?: string): Promise; /** * Get a resolved elicit result by elicit ID. */ getResolvedResult(elicitId: string, _sessionId?: string): Promise; /** * Delete a resolved elicit result by elicit ID. */ deleteResolvedResult(elicitId: string): Promise; /** * Subscribe to fallback execution results for a specific elicit ID. * Uses in-flight subscription guard to prevent duplicate concurrent subscriptions. */ subscribeFallbackResult(elicitId: string, callback: FallbackResultCallback, _sessionId?: string): Promise; /** * Publish a fallback execution result. * * When pub/sub is supported, we rely entirely on the pub/sub mechanism * to deliver messages (even locally). This avoids double-invocation for * memory-based storage where pub/sub IS local. * * When pub/sub is not supported, we invoke local callbacks directly. */ publishFallbackResult(elicitId: string, sessionId: string, result: FallbackExecutionResult): Promise; /** * Clean up store resources. */ destroy(): Promise; } //# sourceMappingURL=storage-elicitation.store.d.ts.map