@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/esm/index.mjs +284 -212
- package/esm/package.json +4 -4
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +293 -220
- package/package.json +4 -4
- package/remember.errors.d.ts +9 -0
- package/remember.errors.d.ts.map +1 -1
- package/remember.plugin.d.ts +6 -1
- package/remember.plugin.d.ts.map +1 -1
- package/tools/forget.tool.d.ts +24 -0
- package/tools/forget.tool.d.ts.map +1 -1
- package/tools/index.d.ts +2 -0
- package/tools/index.d.ts.map +1 -1
- package/tools/list-memories.tool.d.ts +25 -0
- package/tools/list-memories.tool.d.ts.map +1 -1
- package/tools/recall.tool.d.ts +26 -0
- package/tools/recall.tool.d.ts.map +1 -1
- package/tools/remember-this.tool.d.ts +33 -0
- package/tools/remember-this.tool.d.ts.map +1 -1
- package/tools/remember-tool-names.d.ts +9 -0
- package/tools/remember-tool-names.d.ts.map +1 -0
- package/tools/remember-tools.factory.d.ts +8 -0
- package/tools/remember-tools.factory.d.ts.map +1 -0
package/esm/index.mjs
CHANGED
|
@@ -289,6 +289,16 @@ var RememberIdentityError = class extends PublicMcpError {
|
|
|
289
289
|
super(message, "REMEMBER_IDENTITY_REQUIRED", 403);
|
|
290
290
|
}
|
|
291
291
|
};
|
|
292
|
+
var RememberScopeNotAllowedError = class extends PublicMcpError {
|
|
293
|
+
name = "RememberScopeNotAllowedError";
|
|
294
|
+
constructor(scope, allowedScopes) {
|
|
295
|
+
super(
|
|
296
|
+
`Scope '${scope}' is not allowed. Allowed scopes: ${allowedScopes.join(", ")}`,
|
|
297
|
+
"REMEMBER_SCOPE_NOT_ALLOWED",
|
|
298
|
+
400
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
292
302
|
|
|
293
303
|
// plugins/plugin-remember/src/remember.legacy-purge.ts
|
|
294
304
|
var LEGACY_SCOPES = ["session", "tool", "user"];
|
|
@@ -1129,6 +1139,265 @@ var RememberAccessorToken = /* @__PURE__ */ Symbol(
|
|
|
1129
1139
|
"plugin:remember:accessor"
|
|
1130
1140
|
);
|
|
1131
1141
|
|
|
1142
|
+
// plugins/plugin-remember/src/tools/remember-tools.factory.ts
|
|
1143
|
+
import { Tool as Tool5 } from "@frontmcp/sdk";
|
|
1144
|
+
|
|
1145
|
+
// plugins/plugin-remember/src/tools/forget.tool.ts
|
|
1146
|
+
import { z as z2 } from "@frontmcp/lazy-zod";
|
|
1147
|
+
import { Tool, ToolContext } from "@frontmcp/sdk";
|
|
1148
|
+
|
|
1149
|
+
// plugins/plugin-remember/src/tools/remember-scope.description.ts
|
|
1150
|
+
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.";
|
|
1151
|
+
|
|
1152
|
+
// plugins/plugin-remember/src/tools/remember-tool-names.ts
|
|
1153
|
+
function rememberToolNames(prefix = "") {
|
|
1154
|
+
return {
|
|
1155
|
+
rememberThis: `${prefix}remember_this`,
|
|
1156
|
+
recall: `${prefix}recall`,
|
|
1157
|
+
forget: `${prefix}forget`,
|
|
1158
|
+
listMemories: `${prefix}list_memories`
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
// plugins/plugin-remember/src/tools/forget.tool.ts
|
|
1163
|
+
var forgetInputSchema = {
|
|
1164
|
+
key: z2.string().min(1).describe("What memory to forget"),
|
|
1165
|
+
scope: z2.enum(["session", "user", "tool", "global"]).optional().describe(REMEMBER_SCOPE_DESCRIPTION)
|
|
1166
|
+
};
|
|
1167
|
+
var forgetOutputSchema = z2.object({
|
|
1168
|
+
success: z2.boolean(),
|
|
1169
|
+
key: z2.string(),
|
|
1170
|
+
scope: z2.string(),
|
|
1171
|
+
existed: z2.boolean()
|
|
1172
|
+
});
|
|
1173
|
+
function forgetDescription() {
|
|
1174
|
+
return "Forget a previously remembered value. Use this when the user wants to delete stored preferences or information.";
|
|
1175
|
+
}
|
|
1176
|
+
function forgetToolMetadata(names = rememberToolNames()) {
|
|
1177
|
+
return {
|
|
1178
|
+
name: names.forget,
|
|
1179
|
+
description: forgetDescription(),
|
|
1180
|
+
inputSchema: forgetInputSchema,
|
|
1181
|
+
outputSchema: forgetOutputSchema,
|
|
1182
|
+
annotations: { readOnlyHint: false }
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
var ForgetTool = class extends ToolContext {
|
|
1186
|
+
async execute(input) {
|
|
1187
|
+
const remember = this.get(RememberAccessorToken);
|
|
1188
|
+
const config = this.get(RememberConfigToken);
|
|
1189
|
+
const scope = input.scope ?? "session";
|
|
1190
|
+
const allowedScopes = config.tools?.allowedScopes ?? ["session", "user", "tool", "global"];
|
|
1191
|
+
if (!allowedScopes.includes(scope)) {
|
|
1192
|
+
throw this.fail(new RememberScopeNotAllowedError(scope, allowedScopes));
|
|
1193
|
+
}
|
|
1194
|
+
const existed = await remember.knows(input.key, { scope });
|
|
1195
|
+
await remember.forget(input.key, { scope });
|
|
1196
|
+
return {
|
|
1197
|
+
success: true,
|
|
1198
|
+
key: input.key,
|
|
1199
|
+
scope,
|
|
1200
|
+
existed
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
};
|
|
1204
|
+
ForgetTool = __decorateClass([
|
|
1205
|
+
Tool(forgetToolMetadata())
|
|
1206
|
+
], ForgetTool);
|
|
1207
|
+
|
|
1208
|
+
// plugins/plugin-remember/src/tools/list-memories.tool.ts
|
|
1209
|
+
import { z as z3 } from "@frontmcp/lazy-zod";
|
|
1210
|
+
import { Tool as Tool2, ToolContext as ToolContext2 } from "@frontmcp/sdk";
|
|
1211
|
+
var listMemoriesInputSchema = {
|
|
1212
|
+
scope: z3.enum(["session", "user", "tool", "global"]).optional().describe(REMEMBER_SCOPE_DESCRIPTION),
|
|
1213
|
+
pattern: z3.string().optional().describe('Pattern to filter keys (e.g., "user_*")'),
|
|
1214
|
+
limit: z3.number().positive().max(100).optional().describe("Maximum number of keys to return (default: 50)")
|
|
1215
|
+
};
|
|
1216
|
+
var listMemoriesOutputSchema = z3.object({
|
|
1217
|
+
keys: z3.array(z3.string()),
|
|
1218
|
+
scope: z3.string(),
|
|
1219
|
+
count: z3.number(),
|
|
1220
|
+
truncated: z3.boolean()
|
|
1221
|
+
});
|
|
1222
|
+
function listMemoriesDescription(names = rememberToolNames()) {
|
|
1223
|
+
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.`;
|
|
1224
|
+
}
|
|
1225
|
+
function listMemoriesToolMetadata(names = rememberToolNames()) {
|
|
1226
|
+
return {
|
|
1227
|
+
name: names.listMemories,
|
|
1228
|
+
description: listMemoriesDescription(names),
|
|
1229
|
+
inputSchema: listMemoriesInputSchema,
|
|
1230
|
+
outputSchema: listMemoriesOutputSchema,
|
|
1231
|
+
annotations: { readOnlyHint: true }
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
1234
|
+
var ListMemoriesTool = class extends ToolContext2 {
|
|
1235
|
+
async execute(input) {
|
|
1236
|
+
const remember = this.get(RememberAccessorToken);
|
|
1237
|
+
const config = this.get(RememberConfigToken);
|
|
1238
|
+
const scope = input.scope ?? "session";
|
|
1239
|
+
const allowedScopes = config.tools?.allowedScopes ?? ["session", "user", "tool", "global"];
|
|
1240
|
+
if (!allowedScopes.includes(scope)) {
|
|
1241
|
+
throw this.fail(new RememberScopeNotAllowedError(scope, allowedScopes));
|
|
1242
|
+
}
|
|
1243
|
+
const limit = input.limit ?? 50;
|
|
1244
|
+
let keys = await remember.list({ scope, pattern: input.pattern });
|
|
1245
|
+
const truncated = keys.length > limit;
|
|
1246
|
+
if (truncated) {
|
|
1247
|
+
keys = keys.slice(0, limit);
|
|
1248
|
+
}
|
|
1249
|
+
return {
|
|
1250
|
+
keys,
|
|
1251
|
+
scope,
|
|
1252
|
+
count: keys.length,
|
|
1253
|
+
truncated
|
|
1254
|
+
};
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
ListMemoriesTool = __decorateClass([
|
|
1258
|
+
Tool2(listMemoriesToolMetadata())
|
|
1259
|
+
], ListMemoriesTool);
|
|
1260
|
+
|
|
1261
|
+
// plugins/plugin-remember/src/tools/recall.tool.ts
|
|
1262
|
+
import { z as z4 } from "@frontmcp/lazy-zod";
|
|
1263
|
+
import { Tool as Tool3, ToolContext as ToolContext3 } from "@frontmcp/sdk";
|
|
1264
|
+
var recallInputSchema = {
|
|
1265
|
+
key: z4.string().min(1).describe("What memory to recall"),
|
|
1266
|
+
scope: z4.enum(["session", "user", "tool", "global"]).optional().describe(REMEMBER_SCOPE_DESCRIPTION)
|
|
1267
|
+
};
|
|
1268
|
+
var recallOutputSchema = z4.object({
|
|
1269
|
+
found: z4.boolean(),
|
|
1270
|
+
key: z4.string(),
|
|
1271
|
+
value: z4.unknown().optional(),
|
|
1272
|
+
scope: z4.string(),
|
|
1273
|
+
createdAt: z4.number().optional(),
|
|
1274
|
+
expiresAt: z4.number().optional()
|
|
1275
|
+
});
|
|
1276
|
+
function recallDescription(names = rememberToolNames()) {
|
|
1277
|
+
return `Recall something that was previously remembered. Use this to retrieve stored preferences, settings, or any information that was saved with ${names.rememberThis}.`;
|
|
1278
|
+
}
|
|
1279
|
+
function recallToolMetadata(names = rememberToolNames()) {
|
|
1280
|
+
return {
|
|
1281
|
+
name: names.recall,
|
|
1282
|
+
description: recallDescription(names),
|
|
1283
|
+
inputSchema: recallInputSchema,
|
|
1284
|
+
outputSchema: recallOutputSchema,
|
|
1285
|
+
annotations: { readOnlyHint: true }
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
var RecallTool = class extends ToolContext3 {
|
|
1289
|
+
async execute(input) {
|
|
1290
|
+
const remember = this.get(RememberAccessorToken);
|
|
1291
|
+
const config = this.get(RememberConfigToken);
|
|
1292
|
+
const scope = input.scope ?? "session";
|
|
1293
|
+
const allowedScopes = config.tools?.allowedScopes ?? ["session", "user", "tool", "global"];
|
|
1294
|
+
if (!allowedScopes.includes(scope)) {
|
|
1295
|
+
throw this.fail(new RememberScopeNotAllowedError(scope, allowedScopes));
|
|
1296
|
+
}
|
|
1297
|
+
const entry = await remember.getEntry(input.key, { scope });
|
|
1298
|
+
if (!entry) {
|
|
1299
|
+
return {
|
|
1300
|
+
found: false,
|
|
1301
|
+
key: input.key,
|
|
1302
|
+
scope
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
return {
|
|
1306
|
+
found: true,
|
|
1307
|
+
key: input.key,
|
|
1308
|
+
value: entry.value,
|
|
1309
|
+
scope,
|
|
1310
|
+
createdAt: entry.createdAt,
|
|
1311
|
+
expiresAt: entry.expiresAt
|
|
1312
|
+
};
|
|
1313
|
+
}
|
|
1314
|
+
};
|
|
1315
|
+
RecallTool = __decorateClass([
|
|
1316
|
+
Tool3(recallToolMetadata())
|
|
1317
|
+
], RecallTool);
|
|
1318
|
+
|
|
1319
|
+
// plugins/plugin-remember/src/tools/remember-this.tool.ts
|
|
1320
|
+
import { z as z5 } from "@frontmcp/lazy-zod";
|
|
1321
|
+
import { Tool as Tool4, ToolContext as ToolContext4 } from "@frontmcp/sdk";
|
|
1322
|
+
var rememberThisInputSchema = {
|
|
1323
|
+
key: z5.string().min(1).describe('What to call this memory (e.g., "user_preference", "last_action")'),
|
|
1324
|
+
value: z5.unknown().describe("The value to remember (any JSON-serializable data)"),
|
|
1325
|
+
scope: z5.enum(["session", "user", "tool", "global"]).optional().describe(REMEMBER_SCOPE_DESCRIPTION),
|
|
1326
|
+
ttl: z5.number().positive().optional().describe("Forget after this many seconds"),
|
|
1327
|
+
brand: z5.enum(["preference", "cache", "state", "conversation", "custom"]).optional().describe("Type hint for the stored value")
|
|
1328
|
+
};
|
|
1329
|
+
var rememberThisOutputSchema = z5.object({
|
|
1330
|
+
success: z5.boolean(),
|
|
1331
|
+
key: z5.string(),
|
|
1332
|
+
scope: z5.string(),
|
|
1333
|
+
expiresAt: z5.number().optional()
|
|
1334
|
+
});
|
|
1335
|
+
function rememberThisDescription(names = rememberToolNames()) {
|
|
1336
|
+
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.`;
|
|
1337
|
+
}
|
|
1338
|
+
function rememberThisToolMetadata(names = rememberToolNames()) {
|
|
1339
|
+
return {
|
|
1340
|
+
name: names.rememberThis,
|
|
1341
|
+
description: rememberThisDescription(names),
|
|
1342
|
+
inputSchema: rememberThisInputSchema,
|
|
1343
|
+
outputSchema: rememberThisOutputSchema,
|
|
1344
|
+
annotations: { readOnlyHint: false }
|
|
1345
|
+
};
|
|
1346
|
+
}
|
|
1347
|
+
var RememberThisTool = class extends ToolContext4 {
|
|
1348
|
+
async execute(input) {
|
|
1349
|
+
const remember = this.get(RememberAccessorToken);
|
|
1350
|
+
const config = this.get(RememberConfigToken);
|
|
1351
|
+
const scope = input.scope ?? "session";
|
|
1352
|
+
const allowedScopes = config.tools?.allowedScopes ?? ["session", "user", "tool", "global"];
|
|
1353
|
+
if (!allowedScopes.includes(scope)) {
|
|
1354
|
+
throw this.fail(new RememberScopeNotAllowedError(scope, allowedScopes));
|
|
1355
|
+
}
|
|
1356
|
+
await remember.set(input.key, input.value, {
|
|
1357
|
+
scope,
|
|
1358
|
+
ttl: input.ttl,
|
|
1359
|
+
brand: input.brand
|
|
1360
|
+
});
|
|
1361
|
+
const expiresAt = input.ttl ? Date.now() + input.ttl * 1e3 : void 0;
|
|
1362
|
+
return {
|
|
1363
|
+
success: true,
|
|
1364
|
+
key: input.key,
|
|
1365
|
+
scope,
|
|
1366
|
+
expiresAt
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
1370
|
+
RememberThisTool = __decorateClass([
|
|
1371
|
+
Tool4(rememberThisToolMetadata())
|
|
1372
|
+
], RememberThisTool);
|
|
1373
|
+
|
|
1374
|
+
// plugins/plugin-remember/src/tools/remember-tools.factory.ts
|
|
1375
|
+
function createRememberTools(prefix = "") {
|
|
1376
|
+
if (!prefix) return [RememberThisTool, RecallTool, ForgetTool, ListMemoriesTool];
|
|
1377
|
+
const names = rememberToolNames(prefix);
|
|
1378
|
+
let PrefixedRememberThisTool = class extends RememberThisTool {
|
|
1379
|
+
};
|
|
1380
|
+
PrefixedRememberThisTool = __decorateClass([
|
|
1381
|
+
Tool5(rememberThisToolMetadata(names))
|
|
1382
|
+
], PrefixedRememberThisTool);
|
|
1383
|
+
let PrefixedRecallTool = class extends RecallTool {
|
|
1384
|
+
};
|
|
1385
|
+
PrefixedRecallTool = __decorateClass([
|
|
1386
|
+
Tool5(recallToolMetadata(names))
|
|
1387
|
+
], PrefixedRecallTool);
|
|
1388
|
+
let PrefixedForgetTool = class extends ForgetTool {
|
|
1389
|
+
};
|
|
1390
|
+
PrefixedForgetTool = __decorateClass([
|
|
1391
|
+
Tool5(forgetToolMetadata(names))
|
|
1392
|
+
], PrefixedForgetTool);
|
|
1393
|
+
let PrefixedListMemoriesTool = class extends ListMemoriesTool {
|
|
1394
|
+
};
|
|
1395
|
+
PrefixedListMemoriesTool = __decorateClass([
|
|
1396
|
+
Tool5(listMemoriesToolMetadata(names))
|
|
1397
|
+
], PrefixedListMemoriesTool);
|
|
1398
|
+
return [PrefixedRememberThisTool, PrefixedRecallTool, PrefixedForgetTool, PrefixedListMemoriesTool];
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1132
1401
|
// plugins/plugin-remember/src/remember.plugin.ts
|
|
1133
1402
|
var RememberPlugin = class extends DynamicPlugin {
|
|
1134
1403
|
options;
|
|
@@ -1145,6 +1414,11 @@ __publicField(RememberPlugin, "defaultOptions", {
|
|
|
1145
1414
|
keyPrefix: "remember:",
|
|
1146
1415
|
encryption: { enabled: true }
|
|
1147
1416
|
});
|
|
1417
|
+
/**
|
|
1418
|
+
* The memory tools, when `tools.enabled` is set: `remember_this`, `recall`, `forget` and
|
|
1419
|
+
* `list_memories`, under `tools.prefix`.
|
|
1420
|
+
*/
|
|
1421
|
+
__publicField(RememberPlugin, "dynamicTools", (options) => options.tools?.enabled ? createRememberTools(options.tools.prefix) : []);
|
|
1148
1422
|
/**
|
|
1149
1423
|
* Dynamic providers based on plugin options.
|
|
1150
1424
|
*/
|
|
@@ -1276,222 +1550,19 @@ RememberPlugin = __decorateClass([
|
|
|
1276
1550
|
], RememberPlugin);
|
|
1277
1551
|
|
|
1278
1552
|
// plugins/plugin-remember/src/remember.types.ts
|
|
1279
|
-
import { z as
|
|
1280
|
-
var rememberScopeSchema =
|
|
1553
|
+
import { z as z6 } from "@frontmcp/lazy-zod";
|
|
1554
|
+
var rememberScopeSchema = z6.enum(["session", "user", "tool", "global"]);
|
|
1281
1555
|
function brand(data, _brand) {
|
|
1282
1556
|
return data;
|
|
1283
1557
|
}
|
|
1284
|
-
var rememberEntrySchema =
|
|
1285
|
-
value:
|
|
1286
|
-
brand:
|
|
1287
|
-
createdAt:
|
|
1288
|
-
updatedAt:
|
|
1289
|
-
expiresAt:
|
|
1290
|
-
metadata:
|
|
1291
|
-
});
|
|
1292
|
-
|
|
1293
|
-
// plugins/plugin-remember/src/tools/remember-this.tool.ts
|
|
1294
|
-
import { z as z3 } from "@frontmcp/lazy-zod";
|
|
1295
|
-
import { Tool, ToolContext } from "@frontmcp/sdk";
|
|
1296
|
-
|
|
1297
|
-
// plugins/plugin-remember/src/tools/remember-scope.description.ts
|
|
1298
|
-
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.";
|
|
1299
|
-
|
|
1300
|
-
// plugins/plugin-remember/src/tools/remember-this.tool.ts
|
|
1301
|
-
var rememberThisInputSchema = {
|
|
1302
|
-
key: z3.string().min(1).describe('What to call this memory (e.g., "user_preference", "last_action")'),
|
|
1303
|
-
value: z3.unknown().describe("The value to remember (any JSON-serializable data)"),
|
|
1304
|
-
scope: z3.enum(["session", "user", "tool", "global"]).optional().describe(REMEMBER_SCOPE_DESCRIPTION),
|
|
1305
|
-
ttl: z3.number().positive().optional().describe("Forget after this many seconds"),
|
|
1306
|
-
brand: z3.enum(["preference", "cache", "state", "conversation", "custom"]).optional().describe("Type hint for the stored value")
|
|
1307
|
-
};
|
|
1308
|
-
var rememberThisOutputSchema = z3.object({
|
|
1309
|
-
success: z3.boolean(),
|
|
1310
|
-
key: z3.string(),
|
|
1311
|
-
scope: z3.string(),
|
|
1312
|
-
expiresAt: z3.number().optional()
|
|
1313
|
-
});
|
|
1314
|
-
var RememberThisTool = class extends ToolContext {
|
|
1315
|
-
async execute(input) {
|
|
1316
|
-
const remember = this.get(RememberAccessorToken);
|
|
1317
|
-
const config = this.get(RememberConfigToken);
|
|
1318
|
-
const scope = input.scope ?? "session";
|
|
1319
|
-
const allowedScopes = config.tools?.allowedScopes ?? ["session", "user", "tool", "global"];
|
|
1320
|
-
if (!allowedScopes.includes(scope)) {
|
|
1321
|
-
throw this.fail(new Error(`Scope '${scope}' is not allowed. Allowed scopes: ${allowedScopes.join(", ")}`));
|
|
1322
|
-
}
|
|
1323
|
-
await remember.set(input.key, input.value, {
|
|
1324
|
-
scope,
|
|
1325
|
-
ttl: input.ttl,
|
|
1326
|
-
brand: input.brand
|
|
1327
|
-
});
|
|
1328
|
-
const expiresAt = input.ttl ? Date.now() + input.ttl * 1e3 : void 0;
|
|
1329
|
-
return {
|
|
1330
|
-
success: true,
|
|
1331
|
-
key: input.key,
|
|
1332
|
-
scope,
|
|
1333
|
-
expiresAt
|
|
1334
|
-
};
|
|
1335
|
-
}
|
|
1336
|
-
};
|
|
1337
|
-
RememberThisTool = __decorateClass([
|
|
1338
|
-
Tool({
|
|
1339
|
-
name: "remember_this",
|
|
1340
|
-
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.",
|
|
1341
|
-
inputSchema: rememberThisInputSchema,
|
|
1342
|
-
outputSchema: rememberThisOutputSchema,
|
|
1343
|
-
annotations: {
|
|
1344
|
-
readOnlyHint: false
|
|
1345
|
-
}
|
|
1346
|
-
})
|
|
1347
|
-
], RememberThisTool);
|
|
1348
|
-
|
|
1349
|
-
// plugins/plugin-remember/src/tools/recall.tool.ts
|
|
1350
|
-
import { z as z4 } from "@frontmcp/lazy-zod";
|
|
1351
|
-
import { Tool as Tool2, ToolContext as ToolContext2 } from "@frontmcp/sdk";
|
|
1352
|
-
var recallInputSchema = {
|
|
1353
|
-
key: z4.string().min(1).describe("What memory to recall"),
|
|
1354
|
-
scope: z4.enum(["session", "user", "tool", "global"]).optional().describe(REMEMBER_SCOPE_DESCRIPTION)
|
|
1355
|
-
};
|
|
1356
|
-
var recallOutputSchema = z4.object({
|
|
1357
|
-
found: z4.boolean(),
|
|
1358
|
-
key: z4.string(),
|
|
1359
|
-
value: z4.unknown().optional(),
|
|
1360
|
-
scope: z4.string(),
|
|
1361
|
-
createdAt: z4.number().optional(),
|
|
1362
|
-
expiresAt: z4.number().optional()
|
|
1363
|
-
});
|
|
1364
|
-
var RecallTool = class extends ToolContext2 {
|
|
1365
|
-
async execute(input) {
|
|
1366
|
-
const remember = this.get(RememberAccessorToken);
|
|
1367
|
-
const config = this.get(RememberConfigToken);
|
|
1368
|
-
const scope = input.scope ?? "session";
|
|
1369
|
-
const allowedScopes = config.tools?.allowedScopes ?? ["session", "user", "tool", "global"];
|
|
1370
|
-
if (!allowedScopes.includes(scope)) {
|
|
1371
|
-
this.fail(new Error(`Scope '${scope}' is not allowed. Allowed scopes: ${allowedScopes.join(", ")}`));
|
|
1372
|
-
}
|
|
1373
|
-
const entry = await remember.getEntry(input.key, { scope });
|
|
1374
|
-
if (!entry) {
|
|
1375
|
-
return {
|
|
1376
|
-
found: false,
|
|
1377
|
-
key: input.key,
|
|
1378
|
-
scope
|
|
1379
|
-
};
|
|
1380
|
-
}
|
|
1381
|
-
return {
|
|
1382
|
-
found: true,
|
|
1383
|
-
key: input.key,
|
|
1384
|
-
value: entry.value,
|
|
1385
|
-
scope,
|
|
1386
|
-
createdAt: entry.createdAt,
|
|
1387
|
-
expiresAt: entry.expiresAt
|
|
1388
|
-
};
|
|
1389
|
-
}
|
|
1390
|
-
};
|
|
1391
|
-
RecallTool = __decorateClass([
|
|
1392
|
-
Tool2({
|
|
1393
|
-
name: "recall",
|
|
1394
|
-
description: "Recall something that was previously remembered. Use this to retrieve stored preferences, settings, or any information that was saved with remember_this.",
|
|
1395
|
-
inputSchema: recallInputSchema,
|
|
1396
|
-
outputSchema: recallOutputSchema,
|
|
1397
|
-
annotations: {
|
|
1398
|
-
readOnlyHint: true
|
|
1399
|
-
}
|
|
1400
|
-
})
|
|
1401
|
-
], RecallTool);
|
|
1402
|
-
|
|
1403
|
-
// plugins/plugin-remember/src/tools/forget.tool.ts
|
|
1404
|
-
import { z as z5 } from "@frontmcp/lazy-zod";
|
|
1405
|
-
import { Tool as Tool3, ToolContext as ToolContext3 } from "@frontmcp/sdk";
|
|
1406
|
-
var forgetInputSchema = {
|
|
1407
|
-
key: z5.string().min(1).describe("What memory to forget"),
|
|
1408
|
-
scope: z5.enum(["session", "user", "tool", "global"]).optional().describe(REMEMBER_SCOPE_DESCRIPTION)
|
|
1409
|
-
};
|
|
1410
|
-
var forgetOutputSchema = z5.object({
|
|
1411
|
-
success: z5.boolean(),
|
|
1412
|
-
key: z5.string(),
|
|
1413
|
-
scope: z5.string(),
|
|
1414
|
-
existed: z5.boolean()
|
|
1415
|
-
});
|
|
1416
|
-
var ForgetTool = class extends ToolContext3 {
|
|
1417
|
-
async execute(input) {
|
|
1418
|
-
const remember = this.get(RememberAccessorToken);
|
|
1419
|
-
const config = this.get(RememberConfigToken);
|
|
1420
|
-
const scope = input.scope ?? "session";
|
|
1421
|
-
const allowedScopes = config.tools?.allowedScopes ?? ["session", "user", "tool", "global"];
|
|
1422
|
-
if (!allowedScopes.includes(scope)) {
|
|
1423
|
-
throw this.fail(new Error(`Scope '${scope}' is not allowed. Allowed scopes: ${allowedScopes.join(", ")}`));
|
|
1424
|
-
}
|
|
1425
|
-
const existed = await remember.knows(input.key, { scope });
|
|
1426
|
-
await remember.forget(input.key, { scope });
|
|
1427
|
-
return {
|
|
1428
|
-
success: true,
|
|
1429
|
-
key: input.key,
|
|
1430
|
-
scope,
|
|
1431
|
-
existed
|
|
1432
|
-
};
|
|
1433
|
-
}
|
|
1434
|
-
};
|
|
1435
|
-
ForgetTool = __decorateClass([
|
|
1436
|
-
Tool3({
|
|
1437
|
-
name: "forget",
|
|
1438
|
-
description: "Forget a previously remembered value. Use this when the user wants to delete stored preferences or information.",
|
|
1439
|
-
inputSchema: forgetInputSchema,
|
|
1440
|
-
outputSchema: forgetOutputSchema,
|
|
1441
|
-
annotations: {
|
|
1442
|
-
readOnlyHint: false
|
|
1443
|
-
}
|
|
1444
|
-
})
|
|
1445
|
-
], ForgetTool);
|
|
1446
|
-
|
|
1447
|
-
// plugins/plugin-remember/src/tools/list-memories.tool.ts
|
|
1448
|
-
import { z as z6 } from "@frontmcp/lazy-zod";
|
|
1449
|
-
import { Tool as Tool4, ToolContext as ToolContext4 } from "@frontmcp/sdk";
|
|
1450
|
-
var listMemoriesInputSchema = {
|
|
1451
|
-
scope: z6.enum(["session", "user", "tool", "global"]).optional().describe(REMEMBER_SCOPE_DESCRIPTION),
|
|
1452
|
-
pattern: z6.string().optional().describe('Pattern to filter keys (e.g., "user_*")'),
|
|
1453
|
-
limit: z6.number().positive().max(100).optional().describe("Maximum number of keys to return (default: 50)")
|
|
1454
|
-
};
|
|
1455
|
-
var listMemoriesOutputSchema = z6.object({
|
|
1456
|
-
keys: z6.array(z6.string()),
|
|
1457
|
-
scope: z6.string(),
|
|
1458
|
-
count: z6.number(),
|
|
1459
|
-
truncated: z6.boolean()
|
|
1558
|
+
var rememberEntrySchema = z6.object({
|
|
1559
|
+
value: z6.unknown(),
|
|
1560
|
+
brand: z6.enum(["approval", "preference", "cache", "state", "conversation", "custom"]).optional(),
|
|
1561
|
+
createdAt: z6.number(),
|
|
1562
|
+
updatedAt: z6.number(),
|
|
1563
|
+
expiresAt: z6.number().optional(),
|
|
1564
|
+
metadata: z6.record(z6.string(), z6.unknown()).optional()
|
|
1460
1565
|
});
|
|
1461
|
-
var ListMemoriesTool = class extends ToolContext4 {
|
|
1462
|
-
async execute(input) {
|
|
1463
|
-
const remember = this.get(RememberAccessorToken);
|
|
1464
|
-
const config = this.get(RememberConfigToken);
|
|
1465
|
-
const scope = input.scope ?? "session";
|
|
1466
|
-
const allowedScopes = config.tools?.allowedScopes ?? ["session", "user", "tool", "global"];
|
|
1467
|
-
if (!allowedScopes.includes(scope)) {
|
|
1468
|
-
throw this.fail(new Error(`Scope '${scope}' is not allowed. Allowed scopes: ${allowedScopes.join(", ")}`));
|
|
1469
|
-
}
|
|
1470
|
-
const limit = input.limit ?? 50;
|
|
1471
|
-
let keys = await remember.list({ scope, pattern: input.pattern });
|
|
1472
|
-
const truncated = keys.length > limit;
|
|
1473
|
-
if (truncated) {
|
|
1474
|
-
keys = keys.slice(0, limit);
|
|
1475
|
-
}
|
|
1476
|
-
return {
|
|
1477
|
-
keys,
|
|
1478
|
-
scope,
|
|
1479
|
-
count: keys.length,
|
|
1480
|
-
truncated
|
|
1481
|
-
};
|
|
1482
|
-
}
|
|
1483
|
-
};
|
|
1484
|
-
ListMemoriesTool = __decorateClass([
|
|
1485
|
-
Tool4({
|
|
1486
|
-
name: "list_memories",
|
|
1487
|
-
description: "List the remembered keys in one scope (default: session). Use this to see what memories are stored before you recall or forget one.",
|
|
1488
|
-
inputSchema: listMemoriesInputSchema,
|
|
1489
|
-
outputSchema: listMemoriesOutputSchema,
|
|
1490
|
-
annotations: {
|
|
1491
|
-
readOnlyHint: true
|
|
1492
|
-
}
|
|
1493
|
-
})
|
|
1494
|
-
], ListMemoriesTool);
|
|
1495
1566
|
|
|
1496
1567
|
// plugins/plugin-remember/src/remember.context-extension.ts
|
|
1497
1568
|
function getRemember(ctx) {
|
|
@@ -1514,6 +1585,7 @@ export {
|
|
|
1514
1585
|
RememberMemoryProvider,
|
|
1515
1586
|
RememberPlugin,
|
|
1516
1587
|
RememberRedisProvider,
|
|
1588
|
+
RememberScopeNotAllowedError,
|
|
1517
1589
|
RememberStoreToken,
|
|
1518
1590
|
RememberThisTool,
|
|
1519
1591
|
RememberVercelKvProvider,
|
package/esm/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/plugin-remember",
|
|
3
|
-
"version": "1.8.
|
|
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.
|
|
53
|
-
"@frontmcp/utils": "1.8.
|
|
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.
|
|
57
|
+
"@frontmcp/lazy-zod": "1.8.7",
|
|
58
58
|
"@vercel/kv": "^2.0.0 || ^3.0.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependenciesMeta": {
|
package/index.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export type { RememberScope, RememberEntry, RememberPluginOptions, RememberPlugi
|
|
|
45
45
|
export { brand } from './remember.types';
|
|
46
46
|
export type { RememberStoreInterface } from './providers/remember-store.interface';
|
|
47
47
|
export { RememberAccessor } from './providers/remember-accessor.provider';
|
|
48
|
-
export { RememberIdentityError } from './remember.errors';
|
|
48
|
+
export { RememberIdentityError, RememberScopeNotAllowedError } from './remember.errors';
|
|
49
49
|
export { default as RememberMemoryProvider } from './providers/remember-memory.provider';
|
|
50
50
|
export { default as RememberRedisProvider } from './providers/remember-redis.provider';
|
|
51
51
|
export { default as RememberVercelKvProvider } from './providers/remember-vercel-kv.provider';
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAGH,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGvE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGpG,YAAY,EACV,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,YAAY,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAGH,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGvE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGpG,YAAY,EACV,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,YAAY,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AAG9F,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAKrF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC"}
|