@frontmcp/plugin-remember 0.0.1 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/esm/index.mjs +1289 -0
  2. package/esm/package.json +65 -0
  3. package/index.d.ts +53 -0
  4. package/index.d.ts.map +1 -0
  5. package/index.js +1316 -0
  6. package/package.json +3 -3
  7. package/providers/index.d.ts +7 -0
  8. package/providers/index.d.ts.map +1 -0
  9. package/providers/remember-accessor.provider.d.ts +124 -0
  10. package/providers/remember-accessor.provider.d.ts.map +1 -0
  11. package/providers/remember-memory.provider.d.ts +53 -0
  12. package/providers/remember-memory.provider.d.ts.map +1 -0
  13. package/providers/remember-redis.provider.d.ts +62 -0
  14. package/providers/remember-redis.provider.d.ts.map +1 -0
  15. package/providers/remember-storage.provider.d.ts +126 -0
  16. package/providers/remember-storage.provider.d.ts.map +1 -0
  17. package/providers/remember-store.interface.d.ts +42 -0
  18. package/providers/remember-store.interface.d.ts.map +1 -0
  19. package/providers/remember-vercel-kv.provider.d.ts +52 -0
  20. package/providers/remember-vercel-kv.provider.d.ts.map +1 -0
  21. package/remember.context-extension.d.ts +65 -0
  22. package/remember.context-extension.d.ts.map +1 -0
  23. package/remember.crypto.d.ts +81 -0
  24. package/remember.crypto.d.ts.map +1 -0
  25. package/remember.plugin.d.ts +41 -0
  26. package/remember.plugin.d.ts.map +1 -0
  27. package/remember.secret-persistence.d.ts +77 -0
  28. package/remember.secret-persistence.d.ts.map +1 -0
  29. package/remember.symbols.d.ts +28 -0
  30. package/remember.symbols.d.ts.map +1 -0
  31. package/remember.types.d.ts +206 -0
  32. package/remember.types.d.ts.map +1 -0
  33. package/tools/forget.tool.d.ts +32 -0
  34. package/tools/forget.tool.d.ts.map +1 -0
  35. package/tools/index.d.ts +9 -0
  36. package/tools/index.d.ts.map +1 -0
  37. package/tools/list-memories.tool.d.ts +33 -0
  38. package/tools/list-memories.tool.d.ts.map +1 -0
  39. package/tools/recall.tool.d.ts +38 -0
  40. package/tools/recall.tool.d.ts.map +1 -0
  41. package/tools/remember-this.tool.d.ts +42 -0
  42. package/tools/remember-this.tool.d.ts.map +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontmcp/plugin-remember",
3
- "version": "0.0.1",
3
+ "version": "0.7.1",
4
4
  "description": "Remember plugin for FrontMCP - encrypted session memory with approval system for secure tool authorization",
5
5
  "author": "AgentFront <info@agentfront.dev>",
6
6
  "license": "Apache-2.0",
@@ -47,8 +47,8 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "ioredis": "^5.8.0",
50
- "@frontmcp/sdk": "0.7.0",
51
- "@frontmcp/utils": "0.7.0",
50
+ "@frontmcp/sdk": "0.7.1",
51
+ "@frontmcp/utils": "0.7.1",
52
52
  "zod": "^4.0.0"
53
53
  },
54
54
  "peerDependencies": {
@@ -0,0 +1,7 @@
1
+ export type { RememberStoreInterface } from './remember-store.interface';
2
+ export { default as RememberMemoryProvider } from './remember-memory.provider';
3
+ export { default as RememberRedisProvider } from './remember-redis.provider';
4
+ export { default as RememberVercelKvProvider } from './remember-vercel-kv.provider';
5
+ export { RememberStorageProvider, RememberStorageProviderOptions, createRememberMemoryProvider, } from './remember-storage.provider';
6
+ export { RememberAccessor, createRememberAccessor } from './remember-accessor.provider';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGzE,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAGpF,OAAO,EACL,uBAAuB,EACvB,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,124 @@
1
+ import { FrontMcpContext } from '@frontmcp/sdk';
2
+ import type { RememberStoreInterface } from './remember-store.interface';
3
+ import type { RememberScope, RememberEntry, RememberPluginOptions, RememberSetOptions, RememberGetOptions, RememberForgetOptions, RememberKnowsOptions, RememberListOptions } from '../remember.types';
4
+ /**
5
+ * Context-scoped accessor for remember storage.
6
+ * Provides a human-friendly API for storing and retrieving values.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const remember = this.get(RememberAccessorToken);
11
+ *
12
+ * // Store a value
13
+ * await remember.set('theme', 'dark');
14
+ *
15
+ * // Retrieve a value
16
+ * const theme = await remember.get('theme', { defaultValue: 'light' });
17
+ *
18
+ * // Store with scope and TTL
19
+ * await remember.set('token', 'xyz', { scope: 'session', ttl: 300 });
20
+ *
21
+ * // Check if remembered
22
+ * if (await remember.knows('onboarded')) { ... }
23
+ *
24
+ * // Forget something
25
+ * await remember.forget('token');
26
+ * ```
27
+ */
28
+ export declare class RememberAccessor {
29
+ private readonly store;
30
+ private readonly ctx;
31
+ private readonly config;
32
+ private readonly keyPrefix;
33
+ private readonly encryptionEnabled;
34
+ constructor(store: RememberStoreInterface, ctx: FrontMcpContext, config: RememberPluginOptions);
35
+ /**
36
+ * Store a value in memory.
37
+ *
38
+ * @param key - The key to store under
39
+ * @param value - The value to store (any JSON-serializable data)
40
+ * @param options - Storage options (scope, ttl, brand, metadata)
41
+ */
42
+ set<T>(key: string, value: T, options?: RememberSetOptions): Promise<void>;
43
+ /**
44
+ * Retrieve a value from memory.
45
+ *
46
+ * @param key - The key to retrieve
47
+ * @param options - Retrieval options (scope, defaultValue)
48
+ * @returns The stored value or defaultValue if not found
49
+ */
50
+ get<T>(key: string, options?: RememberGetOptions<T>): Promise<T | undefined>;
51
+ /**
52
+ * Get the full entry including metadata.
53
+ *
54
+ * @param key - The key to retrieve
55
+ * @param options - Retrieval options (scope)
56
+ * @returns The full entry or undefined if not found
57
+ */
58
+ getEntry<T>(key: string, options?: {
59
+ scope?: RememberScope;
60
+ }): Promise<RememberEntry<T> | undefined>;
61
+ /**
62
+ * Forget (delete) a value from memory.
63
+ *
64
+ * @param key - The key to forget
65
+ * @param options - Options (scope)
66
+ */
67
+ forget(key: string, options?: RememberForgetOptions): Promise<void>;
68
+ /**
69
+ * Check if a key is remembered (exists and not expired).
70
+ *
71
+ * @param key - The key to check
72
+ * @param options - Options (scope)
73
+ * @returns true if the key exists
74
+ */
75
+ knows(key: string, options?: RememberKnowsOptions): Promise<boolean>;
76
+ /**
77
+ * List all remembered keys for a scope.
78
+ *
79
+ * @param options - Options (scope, pattern)
80
+ * @returns Array of keys (without the scope prefix)
81
+ */
82
+ list(options?: RememberListOptions): Promise<string[]>;
83
+ /**
84
+ * Update an existing entry's value while preserving metadata.
85
+ *
86
+ * @param key - The key to update
87
+ * @param value - The new value
88
+ * @param options - Options (scope, ttl)
89
+ */
90
+ update<T>(key: string, value: T, options?: {
91
+ scope?: RememberScope;
92
+ ttl?: number;
93
+ }): Promise<boolean>;
94
+ /**
95
+ * Get the session ID from context.
96
+ */
97
+ get sessionId(): string;
98
+ /**
99
+ * Get the user ID from context (if available).
100
+ */
101
+ get userId(): string | undefined;
102
+ /**
103
+ * Build the full storage key including scope prefix.
104
+ */
105
+ private buildStorageKey;
106
+ /**
107
+ * Build the scope-specific prefix.
108
+ */
109
+ private buildScopePrefix;
110
+ /**
111
+ * Get the encryption key source for a scope.
112
+ */
113
+ private getKeySource;
114
+ /**
115
+ * Parse a JSON entry (when encryption is disabled).
116
+ */
117
+ private parseEntry;
118
+ }
119
+ /**
120
+ * Factory function for creating RememberAccessor instances.
121
+ * Used by the plugin's dynamicProviders.
122
+ */
123
+ export declare function createRememberAccessor(store: RememberStoreInterface, ctx: FrontMcpContext, config: RememberPluginOptions): RememberAccessor;
124
+ //# sourceMappingURL=remember-accessor.provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remember-accessor.provider.d.ts","sourceRoot":"","sources":["../../src/providers/remember-accessor.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA6C,MAAM,eAAe,CAAC;AAC3F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EAEpB,MAAM,mBAAmB,CAAC;AAI3B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAKa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyB;IAC/C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAkB;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;IAC/C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAU;gBAEhC,KAAK,EAAE,sBAAsB,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,qBAAqB;IAY9F;;;;;;OAMG;IACG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBpF;;;;;;OAMG;IACG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAkB,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAsBtF;;;;;;OAMG;IACG,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,aAAa,CAAA;KAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAsB9G;;;;;OAKG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;IAM7E;;;;;;OAMG;IACG,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,OAAO,CAAC;IAM9E;;;;;OAKG;IACG,IAAI,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAWhE;;;;;;OAMG;IACG,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,aAAa,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IA0B/G;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,GAAG,SAAS,CAS/B;IAMD;;OAEG;IACH,OAAO,CAAC,eAAe;IAIvB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAgBxB;;OAEG;IACH,OAAO,CAAC,YAAY;IAQpB;;OAEG;IACH,OAAO,CAAC,UAAU;CAOnB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,sBAAsB,EAC7B,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE,qBAAqB,GAC5B,gBAAgB,CAElB"}
@@ -0,0 +1,53 @@
1
+ import type { RememberStoreInterface } from './remember-store.interface';
2
+ /**
3
+ * In-memory storage provider for RememberPlugin.
4
+ * Provides fast, local storage with automatic TTL expiration.
5
+ */
6
+ export default class RememberMemoryProvider implements RememberStoreInterface {
7
+ private readonly memory;
8
+ private sweeper?;
9
+ constructor(sweepIntervalSeconds?: number);
10
+ /**
11
+ * Store a value with optional TTL.
12
+ * Always JSON-serializes the value for consistent storage/retrieval.
13
+ */
14
+ setValue(key: string, value: unknown, ttlSeconds?: number): Promise<void>;
15
+ /**
16
+ * Retrieve a value by key.
17
+ * JSON-parses the stored value to match the setValue serialization.
18
+ */
19
+ getValue<T = unknown>(key: string, defaultValue?: T): Promise<T | undefined>;
20
+ /**
21
+ * Delete a key.
22
+ */
23
+ delete(key: string): Promise<void>;
24
+ /**
25
+ * Check if a key exists (and is not expired).
26
+ */
27
+ exists(key: string): Promise<boolean>;
28
+ /**
29
+ * List keys matching a glob-style pattern.
30
+ * Supports * and ? wildcards.
31
+ */
32
+ keys(pattern?: string): Promise<string[]>;
33
+ /**
34
+ * Gracefully close the provider.
35
+ */
36
+ close(): Promise<void>;
37
+ private isExpired;
38
+ /**
39
+ * Periodically remove expired keys to keep memory tidy.
40
+ */
41
+ private sweep;
42
+ private static readonly MAX_PATTERN_LENGTH;
43
+ private static readonly MAX_WILDCARDS;
44
+ /**
45
+ * Convert a glob-style pattern to a RegExp.
46
+ * * matches any sequence of characters
47
+ * ? matches any single character
48
+ *
49
+ * Includes ReDoS protection: validates pattern length and wildcard count.
50
+ */
51
+ private patternToRegex;
52
+ }
53
+ //# sourceMappingURL=remember-memory.provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remember-memory.provider.d.ts","sourceRoot":"","sources":["../../src/providers/remember-memory.provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAgBzE;;;GAGG;AAMH,MAAM,CAAC,OAAO,OAAO,sBAAuB,YAAW,sBAAsB;IAC3E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4B;IACnD,OAAO,CAAC,OAAO,CAAC,CAAiB;gBAErB,oBAAoB,SAAK;IAMrC;;;OAGG;IACG,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA8B/E;;;OAGG;IACG,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAkBlF;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxC;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAU3C;;;OAGG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAiC/C;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAY5B,OAAO,CAAC,SAAS;IAIjB;;OAEG;IACH,OAAO,CAAC,KAAK;IAYb,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAO;IACjD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAM;IAE3C;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;CAkBvB"}
@@ -0,0 +1,62 @@
1
+ import type { RememberStoreInterface } from './remember-store.interface';
2
+ import type { RedisRememberPluginOptions, RedisClientRememberPluginOptions } from '../remember.types';
3
+ /**
4
+ * Combined options type for Redis provider.
5
+ */
6
+ export type RedisRememberOptions = RedisRememberPluginOptions | RedisClientRememberPluginOptions;
7
+ /**
8
+ * Redis storage provider for RememberPlugin.
9
+ * Provides persistent, distributed storage with native TTL support.
10
+ */
11
+ export default class RememberRedisProvider implements RememberStoreInterface {
12
+ private readonly client;
13
+ /**
14
+ * Prefix prepended to all Redis keys.
15
+ * Include any separator (e.g., "myapp:" or "user:123:") as part of the prefix.
16
+ */
17
+ private readonly keyPrefix;
18
+ /** True if this provider created the client (and should close it), false if externally provided */
19
+ private readonly ownsClient;
20
+ constructor(options: RedisRememberOptions);
21
+ /**
22
+ * Store a value with optional TTL.
23
+ *
24
+ * @param key - The key to store under
25
+ * @param value - The value to store (must not be undefined)
26
+ * @param ttlSeconds - Optional TTL in seconds (must be positive integer if provided)
27
+ * @throws Error if value is undefined or ttlSeconds is invalid
28
+ */
29
+ setValue(key: string, value: unknown, ttlSeconds?: number): Promise<void>;
30
+ /**
31
+ * Retrieve a value by key.
32
+ *
33
+ * Returns the parsed JSON value if successful, or `defaultValue` if:
34
+ * - The key does not exist
35
+ * - The stored value is not valid JSON (malformed or legacy data)
36
+ *
37
+ * @param key - The key to retrieve
38
+ * @param defaultValue - Value to return if key doesn't exist or parsing fails
39
+ * @returns The parsed value as T, or defaultValue/undefined
40
+ */
41
+ getValue<T = unknown>(key: string, defaultValue?: T): Promise<T | undefined>;
42
+ /**
43
+ * Delete a key.
44
+ */
45
+ delete(key: string): Promise<void>;
46
+ /**
47
+ * Check if a key exists.
48
+ */
49
+ exists(key: string): Promise<boolean>;
50
+ /**
51
+ * List keys matching a pattern.
52
+ * Uses Redis SCAN for efficient iteration.
53
+ */
54
+ keys(pattern?: string): Promise<string[]>;
55
+ /**
56
+ * Gracefully close the Redis connection.
57
+ * Only closes if this provider owns the client (created it internally).
58
+ * Externally-provided clients are left open for the caller to manage.
59
+ */
60
+ close(): Promise<void>;
61
+ }
62
+ //# sourceMappingURL=remember-redis.provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remember-redis.provider.d.ts","sourceRoot":"","sources":["../../src/providers/remember-redis.provider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,0BAA0B,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAEtG;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,0BAA0B,GAAG,gCAAgC,CAAC;AAEjG;;;GAGG;AAMH,MAAM,CAAC,OAAO,OAAO,qBAAsB,YAAW,sBAAsB;IAC1E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,mGAAmG;IACnG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAU;gBAEzB,OAAO,EAAE,oBAAoB;IA6BzC;;;;;;;OAOG;IACG,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA6B/E;;;;;;;;;;OAUG;IACG,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAclF;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxC;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK3C;;;OAGG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAkB/C;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAK7B"}
@@ -0,0 +1,126 @@
1
+ import { type RootStorage, type NamespacedStorage, type StorageConfig } from '@frontmcp/utils';
2
+ import type { RememberStoreInterface } from './remember-store.interface';
3
+ /**
4
+ * Configuration options for RememberStorageProvider.
5
+ */
6
+ export interface RememberStorageProviderOptions {
7
+ /**
8
+ * Storage configuration. If not provided, uses auto-detection.
9
+ * @default { type: 'auto' }
10
+ */
11
+ storage?: StorageConfig;
12
+ /**
13
+ * Use an existing storage instance instead of creating a new one.
14
+ * Takes precedence over `storage` config.
15
+ */
16
+ storageInstance?: RootStorage | NamespacedStorage;
17
+ /**
18
+ * Namespace prefix for remember keys.
19
+ * @default 'remember'
20
+ */
21
+ namespace?: string;
22
+ /**
23
+ * Default TTL in seconds for values without explicit TTL.
24
+ * @default undefined (no default TTL)
25
+ */
26
+ defaultTTLSeconds?: number;
27
+ }
28
+ /**
29
+ * Storage-backed implementation of the RememberStoreInterface.
30
+ * Works with any storage backend (memory, Redis, Vercel KV, Upstash).
31
+ *
32
+ * @example Memory storage (development)
33
+ * ```typescript
34
+ * const provider = new RememberStorageProvider();
35
+ * await provider.initialize();
36
+ * await provider.setValue('key', { data: 'value' });
37
+ * ```
38
+ *
39
+ * @example Redis storage (production)
40
+ * ```typescript
41
+ * const provider = new RememberStorageProvider({
42
+ * storage: { type: 'redis', redis: { url: 'redis://localhost:6379' } }
43
+ * });
44
+ * await provider.initialize();
45
+ * ```
46
+ *
47
+ * @example Auto-detection from environment
48
+ * ```typescript
49
+ * // Will use Redis if REDIS_URL is set, otherwise memory
50
+ * const provider = new RememberStorageProvider({ storage: { type: 'auto' } });
51
+ * await provider.initialize();
52
+ * ```
53
+ *
54
+ * @example With existing storage instance
55
+ * ```typescript
56
+ * const rootStorage = await createStorage({ type: 'redis' });
57
+ * const provider = new RememberStorageProvider({
58
+ * storageInstance: rootStorage.namespace('myapp')
59
+ * });
60
+ * await provider.initialize();
61
+ * ```
62
+ */
63
+ export declare class RememberStorageProvider implements RememberStoreInterface {
64
+ private storage;
65
+ private readonly options;
66
+ private initialized;
67
+ private ownedStorage;
68
+ constructor(options?: RememberStorageProviderOptions);
69
+ /**
70
+ * Initialize the storage connection.
71
+ * Must be called before using the provider.
72
+ */
73
+ initialize(): Promise<void>;
74
+ /**
75
+ * Ensure initialization before operations.
76
+ */
77
+ private ensureInitialized;
78
+ /**
79
+ * Store a value with optional TTL.
80
+ * @param key - Storage key
81
+ * @param value - Value to store (will be JSON serialized)
82
+ * @param ttlSeconds - Optional time-to-live in seconds
83
+ */
84
+ setValue(key: string, value: unknown, ttlSeconds?: number): Promise<void>;
85
+ /**
86
+ * Retrieve a value by key.
87
+ * @param key - Storage key
88
+ * @param defaultValue - Value to return if key doesn't exist
89
+ * @returns The stored value or defaultValue
90
+ */
91
+ getValue<T = unknown>(key: string, defaultValue?: T): Promise<T | undefined>;
92
+ /**
93
+ * Delete a value by key.
94
+ * @param key - Storage key to delete
95
+ */
96
+ delete(key: string): Promise<void>;
97
+ /**
98
+ * Check if a key exists.
99
+ * @param key - Storage key to check
100
+ * @returns true if key exists
101
+ */
102
+ exists(key: string): Promise<boolean>;
103
+ /**
104
+ * List keys matching a pattern.
105
+ * @param pattern - Glob-style pattern (e.g., "user:*")
106
+ * @returns Array of matching keys
107
+ */
108
+ keys(pattern?: string): Promise<string[]>;
109
+ /**
110
+ * Gracefully close the storage connection.
111
+ */
112
+ close(): Promise<void>;
113
+ }
114
+ /**
115
+ * Create a RememberStorageProvider with synchronous memory storage.
116
+ * Convenience function for simple use cases.
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * const provider = createRememberMemoryProvider();
121
+ * await provider.initialize(); // Required before use
122
+ * await provider.setValue('key', { data: 'value' });
123
+ * ```
124
+ */
125
+ export declare function createRememberMemoryProvider(options?: Omit<RememberStorageProviderOptions, 'storage' | 'storageInstance'>): RememberStorageProvider;
126
+ //# sourceMappingURL=remember-storage.provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remember-storage.provider.d.ts","sourceRoot":"","sources":["../../src/providers/remember-storage.provider.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAMzE;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;;OAGG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;OAGG;IACH,eAAe,CAAC,EAAE,WAAW,GAAG,iBAAiB,CAAC;IAElD;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAKa,uBAAwB,YAAW,sBAAsB;IACpE,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAGtB;IACF,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,YAAY,CAAS;gBAEjB,OAAO,GAAE,8BAAmC;IASxD;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAkBjC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAMzB;;;;;OAKG;IACG,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgC/E;;;;;OAKG;IACG,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAelF;;;OAGG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxC;;;;OAIG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK3C;;;;OAIG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAK/C;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ7B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,GAAE,IAAI,CAAC,8BAA8B,EAAE,SAAS,GAAG,iBAAiB,CAAM,GAChF,uBAAuB,CAMzB"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Interface for Remember storage providers.
3
+ * All providers must implement this interface.
4
+ */
5
+ export interface RememberStoreInterface {
6
+ /**
7
+ * Store a value with optional TTL.
8
+ * @param key - Storage key
9
+ * @param value - Value to store (will be JSON serialized)
10
+ * @param ttlSeconds - Optional time-to-live in seconds
11
+ */
12
+ setValue(key: string, value: unknown, ttlSeconds?: number): Promise<void>;
13
+ /**
14
+ * Retrieve a value by key.
15
+ * @param key - Storage key
16
+ * @param defaultValue - Value to return if key doesn't exist
17
+ * @returns The stored value or defaultValue
18
+ */
19
+ getValue<T = unknown>(key: string, defaultValue?: T): Promise<T | undefined>;
20
+ /**
21
+ * Delete a value by key.
22
+ * @param key - Storage key to delete
23
+ */
24
+ delete(key: string): Promise<void>;
25
+ /**
26
+ * Check if a key exists.
27
+ * @param key - Storage key to check
28
+ * @returns true if key exists
29
+ */
30
+ exists(key: string): Promise<boolean>;
31
+ /**
32
+ * List keys matching a pattern.
33
+ * @param pattern - Glob-style pattern (e.g., "user:*")
34
+ * @returns Array of matching keys
35
+ */
36
+ keys(pattern?: string): Promise<string[]>;
37
+ /**
38
+ * Gracefully close the storage connection.
39
+ */
40
+ close(): Promise<void>;
41
+ }
42
+ //# sourceMappingURL=remember-store.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remember-store.interface.d.ts","sourceRoot":"","sources":["../../src/providers/remember-store.interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1E;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAE7E;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnC;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtC;;;;OAIG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAE1C;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
@@ -0,0 +1,52 @@
1
+ import type { RememberStoreInterface } from './remember-store.interface';
2
+ /**
3
+ * Options for the Vercel KV provider.
4
+ */
5
+ export interface RememberVercelKvProviderOptions {
6
+ /** Vercel KV URL (defaults to KV_REST_API_URL env var) */
7
+ url?: string;
8
+ /** Vercel KV token (defaults to KV_REST_API_TOKEN env var) */
9
+ token?: string;
10
+ /** Key prefix for all storage keys */
11
+ keyPrefix?: string;
12
+ /** Default TTL in seconds */
13
+ defaultTTL?: number;
14
+ }
15
+ /**
16
+ * Vercel KV storage provider for RememberPlugin.
17
+ * Provides serverless-compatible, edge-ready storage.
18
+ */
19
+ export default class RememberVercelKvProvider implements RememberStoreInterface {
20
+ private kv;
21
+ private readonly keyPrefix;
22
+ private readonly defaultTTL?;
23
+ constructor(options?: RememberVercelKvProviderOptions);
24
+ private prefixKey;
25
+ /**
26
+ * Store a value with optional TTL.
27
+ */
28
+ setValue(key: string, value: unknown, ttlSeconds?: number): Promise<void>;
29
+ /**
30
+ * Retrieve a value by key.
31
+ */
32
+ getValue<T = unknown>(key: string, defaultValue?: T): Promise<T | undefined>;
33
+ /**
34
+ * Delete a key.
35
+ */
36
+ delete(key: string): Promise<void>;
37
+ /**
38
+ * Check if a key exists.
39
+ */
40
+ exists(key: string): Promise<boolean>;
41
+ /**
42
+ * List keys matching a pattern.
43
+ * Uses SCAN for efficient iteration.
44
+ */
45
+ keys(pattern?: string): Promise<string[]>;
46
+ /**
47
+ * Gracefully close the provider.
48
+ * No-op for Vercel KV as it uses stateless REST API.
49
+ */
50
+ close(): Promise<void>;
51
+ }
52
+ //# sourceMappingURL=remember-vercel-kv.provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remember-vercel-kv.provider.d.ts","sourceRoot":"","sources":["../../src/providers/remember-vercel-kv.provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAezE;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AAMH,MAAM,CAAC,OAAO,OAAO,wBAAyB,YAAW,sBAAsB;IAC7E,OAAO,CAAC,EAAE,CAAiB;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAS;gBAEzB,OAAO,GAAE,+BAAoC;IA6BzD,OAAO,CAAC,SAAS;IAIjB;;OAEG;IACG,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY/E;;OAEG;IACG,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAkBlF;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxC;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK3C;;;OAGG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAmC/C;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Context Extension Types for RememberPlugin
3
+ *
4
+ * Declares TypeScript types for `this.remember` property
5
+ * on ExecutionContextBase (ToolContext, AgentContext, etc.).
6
+ *
7
+ * The SDK handles the runtime installation via `contextExtensions` in plugin metadata.
8
+ * This file only provides TypeScript type augmentation.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * // When RememberPlugin is installed, you can use:
13
+ * class MyTool extends ToolContext {
14
+ * async execute(input) {
15
+ * // Direct property access (throws if plugin not installed)
16
+ * await this.remember.set('key', 'value');
17
+ * const val = await this.remember.get('key');
18
+ * }
19
+ * }
20
+ * ```
21
+ *
22
+ * @packageDocumentation
23
+ */
24
+ import type { RememberAccessor } from './providers/remember-accessor.provider';
25
+ declare module '@frontmcp/sdk' {
26
+ interface ExecutionContextBase {
27
+ /**
28
+ * Access the remember accessor for storing/retrieving session memory.
29
+ * Only available when RememberPlugin is installed.
30
+ *
31
+ * @throws Error if RememberPlugin is not installed
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * await this.remember.set('theme', 'dark');
36
+ * const theme = await this.remember.get('theme');
37
+ * ```
38
+ */
39
+ readonly remember: RememberAccessor;
40
+ }
41
+ interface PromptContext {
42
+ /**
43
+ * Access the remember accessor for storing/retrieving session memory.
44
+ * Only available when RememberPlugin is installed.
45
+ */
46
+ readonly remember: RememberAccessor;
47
+ }
48
+ }
49
+ /**
50
+ * Get the RememberAccessor from an execution context.
51
+ * Alternative to `this.remember` for explicit function-style access.
52
+ *
53
+ * @throws Error if RememberPlugin is not installed
54
+ */
55
+ export declare function getRemember<T extends {
56
+ get: (token: unknown) => unknown;
57
+ }>(ctx: T): RememberAccessor;
58
+ /**
59
+ * Try to get the RememberAccessor, returning undefined if not available.
60
+ * Use this for graceful degradation when the plugin might not be installed.
61
+ */
62
+ export declare function tryGetRemember<T extends {
63
+ tryGet?: (token: unknown) => unknown;
64
+ }>(ctx: T): RememberAccessor | undefined;
65
+ //# sourceMappingURL=remember.context-extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remember.context-extension.d.ts","sourceRoot":"","sources":["../src/remember.context-extension.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAO/E,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,oBAAoB;QAC5B;;;;;;;;;;;WAWG;QACH,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;KACrC;IAGD,UAAU,aAAa;QACrB;;;WAGG;QACH,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;KACrC;CACF;AAMD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS;IAAE,GAAG,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAA;CAAE,EAAE,GAAG,EAAE,CAAC,GAAG,gBAAgB,CAEpG;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS;IAAE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAA;CAAE,EAC/E,GAAG,EAAE,CAAC,GACL,gBAAgB,GAAG,SAAS,CAK9B"}