@frontmcp/plugin-remember 1.8.6 → 1.8.7

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.
package/index.js CHANGED
@@ -50,6 +50,7 @@ __export(index_exports, {
50
50
  RememberMemoryProvider: () => RememberMemoryProvider,
51
51
  RememberPlugin: () => RememberPlugin,
52
52
  RememberRedisProvider: () => RememberRedisProvider,
53
+ RememberScopeNotAllowedError: () => RememberScopeNotAllowedError,
53
54
  RememberStoreToken: () => RememberStoreToken,
54
55
  RememberThisTool: () => RememberThisTool,
55
56
  RememberVercelKvProvider: () => RememberVercelKvProvider,
@@ -61,7 +62,7 @@ __export(index_exports, {
61
62
  module.exports = __toCommonJS(index_exports);
62
63
 
63
64
  // plugins/plugin-remember/src/remember.plugin.ts
64
- var import_sdk6 = require("@frontmcp/sdk");
65
+ var import_sdk11 = require("@frontmcp/sdk");
65
66
 
66
67
  // plugins/plugin-remember/src/providers/remember-accessor.provider.ts
67
68
  var import_sdk2 = require("@frontmcp/sdk");
@@ -310,6 +311,16 @@ var RememberIdentityError = class extends import_sdk.PublicMcpError {
310
311
  super(message, "REMEMBER_IDENTITY_REQUIRED", 403);
311
312
  }
312
313
  };
314
+ var RememberScopeNotAllowedError = class extends import_sdk.PublicMcpError {
315
+ name = "RememberScopeNotAllowedError";
316
+ constructor(scope, allowedScopes) {
317
+ super(
318
+ `Scope '${scope}' is not allowed. Allowed scopes: ${allowedScopes.join(", ")}`,
319
+ "REMEMBER_SCOPE_NOT_ALLOWED",
320
+ 400
321
+ );
322
+ }
323
+ };
313
324
 
314
325
  // plugins/plugin-remember/src/remember.legacy-purge.ts
315
326
  var LEGACY_SCOPES = ["session", "tool", "user"];
@@ -1150,8 +1161,267 @@ var RememberAccessorToken = /* @__PURE__ */ Symbol(
1150
1161
  "plugin:remember:accessor"
1151
1162
  );
1152
1163
 
1164
+ // plugins/plugin-remember/src/tools/remember-tools.factory.ts
1165
+ var import_sdk10 = require("@frontmcp/sdk");
1166
+
1167
+ // plugins/plugin-remember/src/tools/forget.tool.ts
1168
+ var import_lazy_zod2 = require("@frontmcp/lazy-zod");
1169
+ var import_sdk6 = require("@frontmcp/sdk");
1170
+
1171
+ // plugins/plugin-remember/src/tools/remember-scope.description.ts
1172
+ var REMEMBER_SCOPE_DESCRIPTION = "Whose memory to use (default: session). session: this session; without one (stateless HTTP, MCP 2026-07-28), the signed-in caller across its requests. user: the signed-in caller, across all of its sessions. tool: the tool running the call, for the same caller as session; each memory tool has its own, so the other memory tools do not see what one of them stores in tool scope. global: shared by every caller. An anonymous caller cannot use user scope, nor session or tool scope without a session.";
1173
+
1174
+ // plugins/plugin-remember/src/tools/remember-tool-names.ts
1175
+ function rememberToolNames(prefix = "") {
1176
+ return {
1177
+ rememberThis: `${prefix}remember_this`,
1178
+ recall: `${prefix}recall`,
1179
+ forget: `${prefix}forget`,
1180
+ listMemories: `${prefix}list_memories`
1181
+ };
1182
+ }
1183
+
1184
+ // plugins/plugin-remember/src/tools/forget.tool.ts
1185
+ var forgetInputSchema = {
1186
+ key: import_lazy_zod2.z.string().min(1).describe("What memory to forget"),
1187
+ scope: import_lazy_zod2.z.enum(["session", "user", "tool", "global"]).optional().describe(REMEMBER_SCOPE_DESCRIPTION)
1188
+ };
1189
+ var forgetOutputSchema = import_lazy_zod2.z.object({
1190
+ success: import_lazy_zod2.z.boolean(),
1191
+ key: import_lazy_zod2.z.string(),
1192
+ scope: import_lazy_zod2.z.string(),
1193
+ existed: import_lazy_zod2.z.boolean()
1194
+ });
1195
+ function forgetDescription() {
1196
+ return "Forget a previously remembered value. Use this when the user wants to delete stored preferences or information.";
1197
+ }
1198
+ function forgetToolMetadata(names = rememberToolNames()) {
1199
+ return {
1200
+ name: names.forget,
1201
+ description: forgetDescription(),
1202
+ inputSchema: forgetInputSchema,
1203
+ outputSchema: forgetOutputSchema,
1204
+ annotations: { readOnlyHint: false }
1205
+ };
1206
+ }
1207
+ var ForgetTool = class extends import_sdk6.ToolContext {
1208
+ async execute(input) {
1209
+ const remember = this.get(RememberAccessorToken);
1210
+ const config = this.get(RememberConfigToken);
1211
+ const scope = input.scope ?? "session";
1212
+ const allowedScopes = config.tools?.allowedScopes ?? ["session", "user", "tool", "global"];
1213
+ if (!allowedScopes.includes(scope)) {
1214
+ throw this.fail(new RememberScopeNotAllowedError(scope, allowedScopes));
1215
+ }
1216
+ const existed = await remember.knows(input.key, { scope });
1217
+ await remember.forget(input.key, { scope });
1218
+ return {
1219
+ success: true,
1220
+ key: input.key,
1221
+ scope,
1222
+ existed
1223
+ };
1224
+ }
1225
+ };
1226
+ ForgetTool = __decorateClass([
1227
+ (0, import_sdk6.Tool)(forgetToolMetadata())
1228
+ ], ForgetTool);
1229
+
1230
+ // plugins/plugin-remember/src/tools/list-memories.tool.ts
1231
+ var import_lazy_zod3 = require("@frontmcp/lazy-zod");
1232
+ var import_sdk7 = require("@frontmcp/sdk");
1233
+ var listMemoriesInputSchema = {
1234
+ scope: import_lazy_zod3.z.enum(["session", "user", "tool", "global"]).optional().describe(REMEMBER_SCOPE_DESCRIPTION),
1235
+ pattern: import_lazy_zod3.z.string().optional().describe('Pattern to filter keys (e.g., "user_*")'),
1236
+ limit: import_lazy_zod3.z.number().positive().max(100).optional().describe("Maximum number of keys to return (default: 50)")
1237
+ };
1238
+ var listMemoriesOutputSchema = import_lazy_zod3.z.object({
1239
+ keys: import_lazy_zod3.z.array(import_lazy_zod3.z.string()),
1240
+ scope: import_lazy_zod3.z.string(),
1241
+ count: import_lazy_zod3.z.number(),
1242
+ truncated: import_lazy_zod3.z.boolean()
1243
+ });
1244
+ function listMemoriesDescription(names = rememberToolNames()) {
1245
+ return `List the remembered keys in one scope (default: session). Use this to see what memories are stored before you ${names.recall} or ${names.forget} one.`;
1246
+ }
1247
+ function listMemoriesToolMetadata(names = rememberToolNames()) {
1248
+ return {
1249
+ name: names.listMemories,
1250
+ description: listMemoriesDescription(names),
1251
+ inputSchema: listMemoriesInputSchema,
1252
+ outputSchema: listMemoriesOutputSchema,
1253
+ annotations: { readOnlyHint: true }
1254
+ };
1255
+ }
1256
+ var ListMemoriesTool = class extends import_sdk7.ToolContext {
1257
+ async execute(input) {
1258
+ const remember = this.get(RememberAccessorToken);
1259
+ const config = this.get(RememberConfigToken);
1260
+ const scope = input.scope ?? "session";
1261
+ const allowedScopes = config.tools?.allowedScopes ?? ["session", "user", "tool", "global"];
1262
+ if (!allowedScopes.includes(scope)) {
1263
+ throw this.fail(new RememberScopeNotAllowedError(scope, allowedScopes));
1264
+ }
1265
+ const limit = input.limit ?? 50;
1266
+ let keys = await remember.list({ scope, pattern: input.pattern });
1267
+ const truncated = keys.length > limit;
1268
+ if (truncated) {
1269
+ keys = keys.slice(0, limit);
1270
+ }
1271
+ return {
1272
+ keys,
1273
+ scope,
1274
+ count: keys.length,
1275
+ truncated
1276
+ };
1277
+ }
1278
+ };
1279
+ ListMemoriesTool = __decorateClass([
1280
+ (0, import_sdk7.Tool)(listMemoriesToolMetadata())
1281
+ ], ListMemoriesTool);
1282
+
1283
+ // plugins/plugin-remember/src/tools/recall.tool.ts
1284
+ var import_lazy_zod4 = require("@frontmcp/lazy-zod");
1285
+ var import_sdk8 = require("@frontmcp/sdk");
1286
+ var recallInputSchema = {
1287
+ key: import_lazy_zod4.z.string().min(1).describe("What memory to recall"),
1288
+ scope: import_lazy_zod4.z.enum(["session", "user", "tool", "global"]).optional().describe(REMEMBER_SCOPE_DESCRIPTION)
1289
+ };
1290
+ var recallOutputSchema = import_lazy_zod4.z.object({
1291
+ found: import_lazy_zod4.z.boolean(),
1292
+ key: import_lazy_zod4.z.string(),
1293
+ value: import_lazy_zod4.z.unknown().optional(),
1294
+ scope: import_lazy_zod4.z.string(),
1295
+ createdAt: import_lazy_zod4.z.number().optional(),
1296
+ expiresAt: import_lazy_zod4.z.number().optional()
1297
+ });
1298
+ function recallDescription(names = rememberToolNames()) {
1299
+ return `Recall something that was previously remembered. Use this to retrieve stored preferences, settings, or any information that was saved with ${names.rememberThis}.`;
1300
+ }
1301
+ function recallToolMetadata(names = rememberToolNames()) {
1302
+ return {
1303
+ name: names.recall,
1304
+ description: recallDescription(names),
1305
+ inputSchema: recallInputSchema,
1306
+ outputSchema: recallOutputSchema,
1307
+ annotations: { readOnlyHint: true }
1308
+ };
1309
+ }
1310
+ var RecallTool = class extends import_sdk8.ToolContext {
1311
+ async execute(input) {
1312
+ const remember = this.get(RememberAccessorToken);
1313
+ const config = this.get(RememberConfigToken);
1314
+ const scope = input.scope ?? "session";
1315
+ const allowedScopes = config.tools?.allowedScopes ?? ["session", "user", "tool", "global"];
1316
+ if (!allowedScopes.includes(scope)) {
1317
+ throw this.fail(new RememberScopeNotAllowedError(scope, allowedScopes));
1318
+ }
1319
+ const entry = await remember.getEntry(input.key, { scope });
1320
+ if (!entry) {
1321
+ return {
1322
+ found: false,
1323
+ key: input.key,
1324
+ scope
1325
+ };
1326
+ }
1327
+ return {
1328
+ found: true,
1329
+ key: input.key,
1330
+ value: entry.value,
1331
+ scope,
1332
+ createdAt: entry.createdAt,
1333
+ expiresAt: entry.expiresAt
1334
+ };
1335
+ }
1336
+ };
1337
+ RecallTool = __decorateClass([
1338
+ (0, import_sdk8.Tool)(recallToolMetadata())
1339
+ ], RecallTool);
1340
+
1341
+ // plugins/plugin-remember/src/tools/remember-this.tool.ts
1342
+ var import_lazy_zod5 = require("@frontmcp/lazy-zod");
1343
+ var import_sdk9 = require("@frontmcp/sdk");
1344
+ var rememberThisInputSchema = {
1345
+ key: import_lazy_zod5.z.string().min(1).describe('What to call this memory (e.g., "user_preference", "last_action")'),
1346
+ value: import_lazy_zod5.z.unknown().describe("The value to remember (any JSON-serializable data)"),
1347
+ scope: import_lazy_zod5.z.enum(["session", "user", "tool", "global"]).optional().describe(REMEMBER_SCOPE_DESCRIPTION),
1348
+ ttl: import_lazy_zod5.z.number().positive().optional().describe("Forget after this many seconds"),
1349
+ brand: import_lazy_zod5.z.enum(["preference", "cache", "state", "conversation", "custom"]).optional().describe("Type hint for the stored value")
1350
+ };
1351
+ var rememberThisOutputSchema = import_lazy_zod5.z.object({
1352
+ success: import_lazy_zod5.z.boolean(),
1353
+ key: import_lazy_zod5.z.string(),
1354
+ scope: import_lazy_zod5.z.string(),
1355
+ expiresAt: import_lazy_zod5.z.number().optional()
1356
+ });
1357
+ function rememberThisDescription(names = rememberToolNames()) {
1358
+ return `Remember something for later: store a value under a key that ${names.recall} can read back, in the scope you choose (this session by default; user scope for the signed-in user across sessions). It lasts until it is forgotten or its ttl runs out. Use this when the user asks you to remember preferences, settings, or any information they want to persist.`;
1359
+ }
1360
+ function rememberThisToolMetadata(names = rememberToolNames()) {
1361
+ return {
1362
+ name: names.rememberThis,
1363
+ description: rememberThisDescription(names),
1364
+ inputSchema: rememberThisInputSchema,
1365
+ outputSchema: rememberThisOutputSchema,
1366
+ annotations: { readOnlyHint: false }
1367
+ };
1368
+ }
1369
+ var RememberThisTool = class extends import_sdk9.ToolContext {
1370
+ async execute(input) {
1371
+ const remember = this.get(RememberAccessorToken);
1372
+ const config = this.get(RememberConfigToken);
1373
+ const scope = input.scope ?? "session";
1374
+ const allowedScopes = config.tools?.allowedScopes ?? ["session", "user", "tool", "global"];
1375
+ if (!allowedScopes.includes(scope)) {
1376
+ throw this.fail(new RememberScopeNotAllowedError(scope, allowedScopes));
1377
+ }
1378
+ await remember.set(input.key, input.value, {
1379
+ scope,
1380
+ ttl: input.ttl,
1381
+ brand: input.brand
1382
+ });
1383
+ const expiresAt = input.ttl ? Date.now() + input.ttl * 1e3 : void 0;
1384
+ return {
1385
+ success: true,
1386
+ key: input.key,
1387
+ scope,
1388
+ expiresAt
1389
+ };
1390
+ }
1391
+ };
1392
+ RememberThisTool = __decorateClass([
1393
+ (0, import_sdk9.Tool)(rememberThisToolMetadata())
1394
+ ], RememberThisTool);
1395
+
1396
+ // plugins/plugin-remember/src/tools/remember-tools.factory.ts
1397
+ function createRememberTools(prefix = "") {
1398
+ if (!prefix) return [RememberThisTool, RecallTool, ForgetTool, ListMemoriesTool];
1399
+ const names = rememberToolNames(prefix);
1400
+ let PrefixedRememberThisTool = class extends RememberThisTool {
1401
+ };
1402
+ PrefixedRememberThisTool = __decorateClass([
1403
+ (0, import_sdk10.Tool)(rememberThisToolMetadata(names))
1404
+ ], PrefixedRememberThisTool);
1405
+ let PrefixedRecallTool = class extends RecallTool {
1406
+ };
1407
+ PrefixedRecallTool = __decorateClass([
1408
+ (0, import_sdk10.Tool)(recallToolMetadata(names))
1409
+ ], PrefixedRecallTool);
1410
+ let PrefixedForgetTool = class extends ForgetTool {
1411
+ };
1412
+ PrefixedForgetTool = __decorateClass([
1413
+ (0, import_sdk10.Tool)(forgetToolMetadata(names))
1414
+ ], PrefixedForgetTool);
1415
+ let PrefixedListMemoriesTool = class extends ListMemoriesTool {
1416
+ };
1417
+ PrefixedListMemoriesTool = __decorateClass([
1418
+ (0, import_sdk10.Tool)(listMemoriesToolMetadata(names))
1419
+ ], PrefixedListMemoriesTool);
1420
+ return [PrefixedRememberThisTool, PrefixedRecallTool, PrefixedForgetTool, PrefixedListMemoriesTool];
1421
+ }
1422
+
1153
1423
  // plugins/plugin-remember/src/remember.plugin.ts
1154
- var RememberPlugin = class extends import_sdk6.DynamicPlugin {
1424
+ var RememberPlugin = class extends import_sdk11.DynamicPlugin {
1155
1425
  options;
1156
1426
  constructor(options = {}) {
1157
1427
  super();
@@ -1166,6 +1436,11 @@ __publicField(RememberPlugin, "defaultOptions", {
1166
1436
  keyPrefix: "remember:",
1167
1437
  encryption: { enabled: true }
1168
1438
  });
1439
+ /**
1440
+ * The memory tools, when `tools.enabled` is set: `remember_this`, `recall`, `forget` and
1441
+ * `list_memories`, under `tools.prefix`.
1442
+ */
1443
+ __publicField(RememberPlugin, "dynamicTools", (options) => options.tools?.enabled ? createRememberTools(options.tools.prefix) : []);
1169
1444
  /**
1170
1445
  * Dynamic providers based on plugin options.
1171
1446
  */
@@ -1180,10 +1455,10 @@ __publicField(RememberPlugin, "dynamicProviders", (options) => {
1180
1455
  providers.push({
1181
1456
  name: "remember:store:global",
1182
1457
  provide: RememberStoreToken,
1183
- inject: () => [import_sdk6.FrontMcpConfig],
1458
+ inject: () => [import_sdk11.FrontMcpConfig],
1184
1459
  useFactory: (frontmcpConfig) => {
1185
- const storeConfig = (0, import_sdk6.getGlobalStoreConfig)("RememberPlugin", frontmcpConfig);
1186
- if ((0, import_sdk6.isVercelKvProvider)(storeConfig)) {
1460
+ const storeConfig = (0, import_sdk11.getGlobalStoreConfig)("RememberPlugin", frontmcpConfig);
1461
+ if ((0, import_sdk11.isVercelKvProvider)(storeConfig)) {
1187
1462
  return new RememberVercelKvProvider({
1188
1463
  url: storeConfig.url,
1189
1464
  token: storeConfig.token,
@@ -1264,14 +1539,14 @@ __publicField(RememberPlugin, "dynamicProviders", (options) => {
1264
1539
  providers.push({
1265
1540
  name: "remember:accessor",
1266
1541
  provide: RememberAccessorToken,
1267
- scope: import_sdk6.ProviderScope.CONTEXT,
1268
- inject: () => [RememberStoreToken, import_sdk6.FRONTMCP_CONTEXT, RememberConfigToken, import_sdk6.FrontMcpLogger],
1542
+ scope: import_sdk11.ProviderScope.CONTEXT,
1543
+ inject: () => [RememberStoreToken, import_sdk11.FRONTMCP_CONTEXT, RememberConfigToken, import_sdk11.FrontMcpLogger],
1269
1544
  useFactory: (store, ctx, cfg, logger) => createRememberAccessor(store, ctx, cfg, logger)
1270
1545
  });
1271
1546
  return providers;
1272
1547
  });
1273
1548
  RememberPlugin = __decorateClass([
1274
- (0, import_sdk6.Plugin)({
1549
+ (0, import_sdk11.Plugin)({
1275
1550
  name: "remember",
1276
1551
  description: "Help your LLM remember things across sessions",
1277
1552
  providers: [
@@ -1297,222 +1572,19 @@ RememberPlugin = __decorateClass([
1297
1572
  ], RememberPlugin);
1298
1573
 
1299
1574
  // plugins/plugin-remember/src/remember.types.ts
1300
- var import_lazy_zod2 = require("@frontmcp/lazy-zod");
1301
- var rememberScopeSchema = import_lazy_zod2.z.enum(["session", "user", "tool", "global"]);
1575
+ var import_lazy_zod6 = require("@frontmcp/lazy-zod");
1576
+ var rememberScopeSchema = import_lazy_zod6.z.enum(["session", "user", "tool", "global"]);
1302
1577
  function brand(data, _brand) {
1303
1578
  return data;
1304
1579
  }
1305
- var rememberEntrySchema = import_lazy_zod2.z.object({
1306
- value: import_lazy_zod2.z.unknown(),
1307
- brand: import_lazy_zod2.z.enum(["approval", "preference", "cache", "state", "conversation", "custom"]).optional(),
1308
- createdAt: import_lazy_zod2.z.number(),
1309
- updatedAt: import_lazy_zod2.z.number(),
1310
- expiresAt: import_lazy_zod2.z.number().optional(),
1311
- metadata: import_lazy_zod2.z.record(import_lazy_zod2.z.string(), import_lazy_zod2.z.unknown()).optional()
1312
- });
1313
-
1314
- // plugins/plugin-remember/src/tools/remember-this.tool.ts
1315
- var import_lazy_zod3 = require("@frontmcp/lazy-zod");
1316
- var import_sdk7 = require("@frontmcp/sdk");
1317
-
1318
- // plugins/plugin-remember/src/tools/remember-scope.description.ts
1319
- var REMEMBER_SCOPE_DESCRIPTION = "Whose memory to use (default: session). session: this session; without one (stateless HTTP, MCP 2026-07-28), the signed-in caller across its requests. user: the signed-in caller, across all of its sessions. tool: the tool running the call, for the same caller as session; each memory tool has its own, so the other memory tools do not see what one of them stores in tool scope. global: shared by every caller. An anonymous caller cannot use user scope, nor session or tool scope without a session.";
1320
-
1321
- // plugins/plugin-remember/src/tools/remember-this.tool.ts
1322
- var rememberThisInputSchema = {
1323
- key: import_lazy_zod3.z.string().min(1).describe('What to call this memory (e.g., "user_preference", "last_action")'),
1324
- value: import_lazy_zod3.z.unknown().describe("The value to remember (any JSON-serializable data)"),
1325
- scope: import_lazy_zod3.z.enum(["session", "user", "tool", "global"]).optional().describe(REMEMBER_SCOPE_DESCRIPTION),
1326
- ttl: import_lazy_zod3.z.number().positive().optional().describe("Forget after this many seconds"),
1327
- brand: import_lazy_zod3.z.enum(["preference", "cache", "state", "conversation", "custom"]).optional().describe("Type hint for the stored value")
1328
- };
1329
- var rememberThisOutputSchema = import_lazy_zod3.z.object({
1330
- success: import_lazy_zod3.z.boolean(),
1331
- key: import_lazy_zod3.z.string(),
1332
- scope: import_lazy_zod3.z.string(),
1333
- expiresAt: import_lazy_zod3.z.number().optional()
1334
- });
1335
- var RememberThisTool = class extends import_sdk7.ToolContext {
1336
- async execute(input) {
1337
- const remember = this.get(RememberAccessorToken);
1338
- const config = this.get(RememberConfigToken);
1339
- const scope = input.scope ?? "session";
1340
- const allowedScopes = config.tools?.allowedScopes ?? ["session", "user", "tool", "global"];
1341
- if (!allowedScopes.includes(scope)) {
1342
- throw this.fail(new Error(`Scope '${scope}' is not allowed. Allowed scopes: ${allowedScopes.join(", ")}`));
1343
- }
1344
- await remember.set(input.key, input.value, {
1345
- scope,
1346
- ttl: input.ttl,
1347
- brand: input.brand
1348
- });
1349
- const expiresAt = input.ttl ? Date.now() + input.ttl * 1e3 : void 0;
1350
- return {
1351
- success: true,
1352
- key: input.key,
1353
- scope,
1354
- expiresAt
1355
- };
1356
- }
1357
- };
1358
- RememberThisTool = __decorateClass([
1359
- (0, import_sdk7.Tool)({
1360
- name: "remember_this",
1361
- description: "Remember something for later: store a value under a key that recall can read back, in the scope you choose (this session by default; user scope for the signed-in user across sessions). It lasts until it is forgotten or its ttl runs out. Use this when the user asks you to remember preferences, settings, or any information they want to persist.",
1362
- inputSchema: rememberThisInputSchema,
1363
- outputSchema: rememberThisOutputSchema,
1364
- annotations: {
1365
- readOnlyHint: false
1366
- }
1367
- })
1368
- ], RememberThisTool);
1369
-
1370
- // plugins/plugin-remember/src/tools/recall.tool.ts
1371
- var import_lazy_zod4 = require("@frontmcp/lazy-zod");
1372
- var import_sdk8 = require("@frontmcp/sdk");
1373
- var recallInputSchema = {
1374
- key: import_lazy_zod4.z.string().min(1).describe("What memory to recall"),
1375
- scope: import_lazy_zod4.z.enum(["session", "user", "tool", "global"]).optional().describe(REMEMBER_SCOPE_DESCRIPTION)
1376
- };
1377
- var recallOutputSchema = import_lazy_zod4.z.object({
1378
- found: import_lazy_zod4.z.boolean(),
1379
- key: import_lazy_zod4.z.string(),
1380
- value: import_lazy_zod4.z.unknown().optional(),
1381
- scope: import_lazy_zod4.z.string(),
1382
- createdAt: import_lazy_zod4.z.number().optional(),
1383
- expiresAt: import_lazy_zod4.z.number().optional()
1384
- });
1385
- var RecallTool = class extends import_sdk8.ToolContext {
1386
- async execute(input) {
1387
- const remember = this.get(RememberAccessorToken);
1388
- const config = this.get(RememberConfigToken);
1389
- const scope = input.scope ?? "session";
1390
- const allowedScopes = config.tools?.allowedScopes ?? ["session", "user", "tool", "global"];
1391
- if (!allowedScopes.includes(scope)) {
1392
- this.fail(new Error(`Scope '${scope}' is not allowed. Allowed scopes: ${allowedScopes.join(", ")}`));
1393
- }
1394
- const entry = await remember.getEntry(input.key, { scope });
1395
- if (!entry) {
1396
- return {
1397
- found: false,
1398
- key: input.key,
1399
- scope
1400
- };
1401
- }
1402
- return {
1403
- found: true,
1404
- key: input.key,
1405
- value: entry.value,
1406
- scope,
1407
- createdAt: entry.createdAt,
1408
- expiresAt: entry.expiresAt
1409
- };
1410
- }
1411
- };
1412
- RecallTool = __decorateClass([
1413
- (0, import_sdk8.Tool)({
1414
- name: "recall",
1415
- description: "Recall something that was previously remembered. Use this to retrieve stored preferences, settings, or any information that was saved with remember_this.",
1416
- inputSchema: recallInputSchema,
1417
- outputSchema: recallOutputSchema,
1418
- annotations: {
1419
- readOnlyHint: true
1420
- }
1421
- })
1422
- ], RecallTool);
1423
-
1424
- // plugins/plugin-remember/src/tools/forget.tool.ts
1425
- var import_lazy_zod5 = require("@frontmcp/lazy-zod");
1426
- var import_sdk9 = require("@frontmcp/sdk");
1427
- var forgetInputSchema = {
1428
- key: import_lazy_zod5.z.string().min(1).describe("What memory to forget"),
1429
- scope: import_lazy_zod5.z.enum(["session", "user", "tool", "global"]).optional().describe(REMEMBER_SCOPE_DESCRIPTION)
1430
- };
1431
- var forgetOutputSchema = import_lazy_zod5.z.object({
1432
- success: import_lazy_zod5.z.boolean(),
1433
- key: import_lazy_zod5.z.string(),
1434
- scope: import_lazy_zod5.z.string(),
1435
- existed: import_lazy_zod5.z.boolean()
1580
+ var rememberEntrySchema = import_lazy_zod6.z.object({
1581
+ value: import_lazy_zod6.z.unknown(),
1582
+ brand: import_lazy_zod6.z.enum(["approval", "preference", "cache", "state", "conversation", "custom"]).optional(),
1583
+ createdAt: import_lazy_zod6.z.number(),
1584
+ updatedAt: import_lazy_zod6.z.number(),
1585
+ expiresAt: import_lazy_zod6.z.number().optional(),
1586
+ metadata: import_lazy_zod6.z.record(import_lazy_zod6.z.string(), import_lazy_zod6.z.unknown()).optional()
1436
1587
  });
1437
- var ForgetTool = class extends import_sdk9.ToolContext {
1438
- async execute(input) {
1439
- const remember = this.get(RememberAccessorToken);
1440
- const config = this.get(RememberConfigToken);
1441
- const scope = input.scope ?? "session";
1442
- const allowedScopes = config.tools?.allowedScopes ?? ["session", "user", "tool", "global"];
1443
- if (!allowedScopes.includes(scope)) {
1444
- throw this.fail(new Error(`Scope '${scope}' is not allowed. Allowed scopes: ${allowedScopes.join(", ")}`));
1445
- }
1446
- const existed = await remember.knows(input.key, { scope });
1447
- await remember.forget(input.key, { scope });
1448
- return {
1449
- success: true,
1450
- key: input.key,
1451
- scope,
1452
- existed
1453
- };
1454
- }
1455
- };
1456
- ForgetTool = __decorateClass([
1457
- (0, import_sdk9.Tool)({
1458
- name: "forget",
1459
- description: "Forget a previously remembered value. Use this when the user wants to delete stored preferences or information.",
1460
- inputSchema: forgetInputSchema,
1461
- outputSchema: forgetOutputSchema,
1462
- annotations: {
1463
- readOnlyHint: false
1464
- }
1465
- })
1466
- ], ForgetTool);
1467
-
1468
- // plugins/plugin-remember/src/tools/list-memories.tool.ts
1469
- var import_lazy_zod6 = require("@frontmcp/lazy-zod");
1470
- var import_sdk10 = require("@frontmcp/sdk");
1471
- var listMemoriesInputSchema = {
1472
- scope: import_lazy_zod6.z.enum(["session", "user", "tool", "global"]).optional().describe(REMEMBER_SCOPE_DESCRIPTION),
1473
- pattern: import_lazy_zod6.z.string().optional().describe('Pattern to filter keys (e.g., "user_*")'),
1474
- limit: import_lazy_zod6.z.number().positive().max(100).optional().describe("Maximum number of keys to return (default: 50)")
1475
- };
1476
- var listMemoriesOutputSchema = import_lazy_zod6.z.object({
1477
- keys: import_lazy_zod6.z.array(import_lazy_zod6.z.string()),
1478
- scope: import_lazy_zod6.z.string(),
1479
- count: import_lazy_zod6.z.number(),
1480
- truncated: import_lazy_zod6.z.boolean()
1481
- });
1482
- var ListMemoriesTool = class extends import_sdk10.ToolContext {
1483
- async execute(input) {
1484
- const remember = this.get(RememberAccessorToken);
1485
- const config = this.get(RememberConfigToken);
1486
- const scope = input.scope ?? "session";
1487
- const allowedScopes = config.tools?.allowedScopes ?? ["session", "user", "tool", "global"];
1488
- if (!allowedScopes.includes(scope)) {
1489
- throw this.fail(new Error(`Scope '${scope}' is not allowed. Allowed scopes: ${allowedScopes.join(", ")}`));
1490
- }
1491
- const limit = input.limit ?? 50;
1492
- let keys = await remember.list({ scope, pattern: input.pattern });
1493
- const truncated = keys.length > limit;
1494
- if (truncated) {
1495
- keys = keys.slice(0, limit);
1496
- }
1497
- return {
1498
- keys,
1499
- scope,
1500
- count: keys.length,
1501
- truncated
1502
- };
1503
- }
1504
- };
1505
- ListMemoriesTool = __decorateClass([
1506
- (0, import_sdk10.Tool)({
1507
- name: "list_memories",
1508
- description: "List the remembered keys in one scope (default: session). Use this to see what memories are stored before you recall or forget one.",
1509
- inputSchema: listMemoriesInputSchema,
1510
- outputSchema: listMemoriesOutputSchema,
1511
- annotations: {
1512
- readOnlyHint: true
1513
- }
1514
- })
1515
- ], ListMemoriesTool);
1516
1588
 
1517
1589
  // plugins/plugin-remember/src/remember.context-extension.ts
1518
1590
  function getRemember(ctx) {
@@ -1536,6 +1608,7 @@ function tryGetRemember(ctx) {
1536
1608
  RememberMemoryProvider,
1537
1609
  RememberPlugin,
1538
1610
  RememberRedisProvider,
1611
+ RememberScopeNotAllowedError,
1539
1612
  RememberStoreToken,
1540
1613
  RememberThisTool,
1541
1614
  RememberVercelKvProvider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontmcp/plugin-remember",
3
- "version": "1.8.6",
3
+ "version": "1.8.7",
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",
@@ -49,12 +49,12 @@
49
49
  }
50
50
  },
51
51
  "dependencies": {
52
- "@frontmcp/sdk": "1.8.6",
53
- "@frontmcp/utils": "1.8.6",
52
+ "@frontmcp/sdk": "1.8.7",
53
+ "@frontmcp/utils": "1.8.7",
54
54
  "ioredis": "^5.8.0"
55
55
  },
56
56
  "peerDependencies": {
57
- "@frontmcp/lazy-zod": "1.8.6",
57
+ "@frontmcp/lazy-zod": "1.8.7",
58
58
  "@vercel/kv": "^2.0.0 || ^3.0.0"
59
59
  },
60
60
  "peerDependenciesMeta": {
@@ -11,4 +11,13 @@ export declare class RememberIdentityError extends PublicMcpError {
11
11
  readonly name = "RememberIdentityError";
12
12
  constructor(message: string);
13
13
  }
14
+ /**
15
+ * Raised when a memory tool is called with a scope outside `tools.allowedScopes`, including the
16
+ * default scope when the caller omitted one. The model needs the message to retry with a valid
17
+ * scope, so it is public rather than an internal-error notice.
18
+ */
19
+ export declare class RememberScopeNotAllowedError extends PublicMcpError {
20
+ readonly name = "RememberScopeNotAllowedError";
21
+ constructor(scope: string, allowedScopes: readonly string[]);
22
+ }
14
23
  //# sourceMappingURL=remember.errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remember.errors.d.ts","sourceRoot":"","sources":["../src/remember.errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;;;;;;GAOG;AACH,qBAAa,qBAAsB,SAAQ,cAAc;IACvD,SAAkB,IAAI,2BAA2B;gBAErC,OAAO,EAAE,MAAM;CAG5B"}
1
+ {"version":3,"file":"remember.errors.d.ts","sourceRoot":"","sources":["../src/remember.errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;;;;;;GAOG;AACH,qBAAa,qBAAsB,SAAQ,cAAc;IACvD,SAAkB,IAAI,2BAA2B;gBAErC,OAAO,EAAE,MAAM;CAG5B;AAED;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,cAAc;IAC9D,SAAkB,IAAI,kCAAkC;gBAE5C,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,MAAM,EAAE;CAO5D"}
@@ -1,4 +1,4 @@
1
- import { DynamicPlugin, type ProviderType } from '@frontmcp/sdk';
1
+ import { DynamicPlugin, type ProviderType, type ToolType } from '@frontmcp/sdk';
2
2
  import type { RememberPluginOptions, RememberPluginOptionsInput } from './remember.types';
3
3
  /**
4
4
  * RememberPlugin - Stateful session memory for FrontMCP.
@@ -33,6 +33,11 @@ export default class RememberPlugin extends DynamicPlugin<RememberPluginOptions,
33
33
  static defaultOptions: RememberPluginOptions;
34
34
  options: RememberPluginOptions;
35
35
  constructor(options?: RememberPluginOptionsInput);
36
+ /**
37
+ * The memory tools, when `tools.enabled` is set: `remember_this`, `recall`, `forget` and
38
+ * `list_memories`, under `tools.prefix`.
39
+ */
40
+ static dynamicTools: (options: RememberPluginOptionsInput) => readonly ToolType[];
36
41
  /**
37
42
  * Dynamic providers based on plugin options.
38
43
  */
@@ -1 +1 @@
1
- {"version":3,"file":"remember.plugin.d.ts","sourceRoot":"","sources":["../src/remember.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EASb,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AAOvB,OAAO,KAAK,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAE1F;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAwBH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,aAAa,CAAC,qBAAqB,EAAE,0BAA0B,CAAC;IAC1G,MAAM,CAAC,cAAc,EAAE,qBAAqB,CAI1C;IAEF,OAAO,EAAE,qBAAqB,CAAC;gBAEnB,OAAO,GAAE,0BAA+B;IAQpD;;OAEG;IACH,OAAgB,gBAAgB,GAAI,SAAS,0BAA0B,KAAG,YAAY,EAAE,CA2HtF;CACH"}
1
+ {"version":3,"file":"remember.plugin.d.ts","sourceRoot":"","sources":["../src/remember.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EASb,KAAK,YAAY,EACjB,KAAK,QAAQ,EACd,MAAM,eAAe,CAAC;AAOvB,OAAO,KAAK,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAG1F;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAwBH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,aAAa,CAAC,qBAAqB,EAAE,0BAA0B,CAAC;IAC1G,MAAM,CAAC,cAAc,EAAE,qBAAqB,CAI1C;IAEF,OAAO,EAAE,qBAAqB,CAAC;gBAEnB,OAAO,GAAE,0BAA+B;IAQpD;;;OAGG;IACH,OAAgB,YAAY,GAAI,SAAS,0BAA0B,KAAG,SAAS,QAAQ,EAAE,CACf;IAE1E;;OAEG;IACH,OAAgB,gBAAgB,GAAI,SAAS,0BAA0B,KAAG,YAAY,EAAE,CA2HtF;CACH"}