@mastra/memory 1.6.0 → 1.6.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.
- package/CHANGELOG.md +54 -0
- package/dist/{chunk-5UYAHJVJ.cjs → chunk-D6II7EP4.cjs} +660 -531
- package/dist/chunk-D6II7EP4.cjs.map +1 -0
- package/dist/{chunk-A62BQK35.js → chunk-GBBQIJQF.js} +660 -531
- package/dist/chunk-GBBQIJQF.js.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +25 -25
- package/dist/docs/references/docs-agents-agent-approval.md +61 -31
- package/dist/docs/references/docs-agents-supervisor-agents.md +1 -1
- package/dist/docs/references/docs-memory-observational-memory.md +9 -0
- package/dist/docs/references/docs-memory-semantic-recall.md +17 -1
- package/dist/docs/references/reference-core-getMemory.md +2 -2
- package/dist/docs/references/reference-core-listMemory.md +1 -1
- package/dist/docs/references/reference-memory-clone-utilities.md +5 -5
- package/dist/docs/references/reference-memory-cloneThread.md +17 -21
- package/dist/docs/references/reference-memory-createThread.md +10 -10
- package/dist/docs/references/reference-memory-getThreadById.md +2 -2
- package/dist/docs/references/reference-memory-listThreads.md +5 -5
- package/dist/docs/references/reference-memory-memory-class.md +12 -14
- package/dist/docs/references/reference-memory-observational-memory.md +102 -94
- package/dist/docs/references/reference-processors-token-limiter-processor.md +11 -13
- package/dist/docs/references/reference-storage-dynamodb.md +9 -9
- package/dist/docs/references/reference-storage-libsql.md +2 -2
- package/dist/docs/references/reference-storage-mongodb.md +5 -5
- package/dist/docs/references/reference-storage-postgresql.md +25 -25
- package/dist/docs/references/reference-storage-upstash.md +3 -3
- package/dist/docs/references/reference-vectors-libsql.md +31 -31
- package/dist/docs/references/reference-vectors-mongodb.md +32 -32
- package/dist/docs/references/reference-vectors-pg.md +60 -44
- package/dist/docs/references/reference-vectors-upstash.md +25 -25
- package/dist/index.cjs +246 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +246 -57
- package/dist/index.js.map +1 -1
- package/dist/{observational-memory-MXI54VC7.cjs → observational-memory-AHVELJX4.cjs} +17 -17
- package/dist/{observational-memory-MXI54VC7.cjs.map → observational-memory-AHVELJX4.cjs.map} +1 -1
- package/dist/{observational-memory-SR6G4HN5.js → observational-memory-QFQUF5EY.js} +3 -3
- package/dist/{observational-memory-SR6G4HN5.js.map → observational-memory-QFQUF5EY.js.map} +1 -1
- package/dist/processors/index.cjs +15 -15
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/date-utils.d.ts +35 -0
- package/dist/processors/observational-memory/date-utils.d.ts.map +1 -0
- package/dist/processors/observational-memory/markers.d.ts +94 -0
- package/dist/processors/observational-memory/markers.d.ts.map +1 -0
- package/dist/processors/observational-memory/observational-memory.d.ts +0 -76
- package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
- package/dist/processors/observational-memory/operation-registry.d.ts +14 -0
- package/dist/processors/observational-memory/operation-registry.d.ts.map +1 -0
- package/dist/processors/observational-memory/thresholds.d.ts +52 -0
- package/dist/processors/observational-memory/thresholds.d.ts.map +1 -0
- package/dist/processors/observational-memory/token-counter.d.ts +4 -0
- package/dist/processors/observational-memory/token-counter.d.ts.map +1 -1
- package/dist/tools/working-memory.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/chunk-5UYAHJVJ.cjs.map +0 -1
- package/dist/chunk-A62BQK35.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -79,6 +79,18 @@ export declare class Memory extends MastraMemory {
|
|
|
79
79
|
memoryConfig?: MemoryConfig;
|
|
80
80
|
}): Promise<StorageThreadType>;
|
|
81
81
|
deleteThread(threadId: string): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Lists all vector indexes that match the memory messages prefix.
|
|
84
|
+
* Handles separator differences across vector store backends (e.g. '_' vs '-').
|
|
85
|
+
*/
|
|
86
|
+
private getMemoryVectorIndexes;
|
|
87
|
+
/**
|
|
88
|
+
* Deletes all vector embeddings associated with a thread.
|
|
89
|
+
* This is called internally by deleteThread to clean up orphaned vectors.
|
|
90
|
+
*
|
|
91
|
+
* @param threadId - The ID of the thread whose vectors should be deleted
|
|
92
|
+
*/
|
|
93
|
+
private deleteThreadVectors;
|
|
82
94
|
updateWorkingMemory({ threadId, resourceId, workingMemory, memoryConfig, }: {
|
|
83
95
|
threadId: string;
|
|
84
96
|
resourceId?: string;
|
|
@@ -185,6 +197,13 @@ export declare class Memory extends MastraMemory {
|
|
|
185
197
|
* @returns Promise that resolves when all messages are deleted
|
|
186
198
|
*/
|
|
187
199
|
deleteMessages(input: MessageDeleteInput): Promise<void>;
|
|
200
|
+
/**
|
|
201
|
+
* Deletes vector embeddings for specific messages.
|
|
202
|
+
* This is called internally by deleteMessages to clean up orphaned vectors.
|
|
203
|
+
*
|
|
204
|
+
* @param messageIds - The IDs of the messages whose vectors should be deleted
|
|
205
|
+
*/
|
|
206
|
+
private deleteMessageVectors;
|
|
188
207
|
/**
|
|
189
208
|
* Clone a thread and its messages to create a new independent thread.
|
|
190
209
|
* The cloned thread will have metadata tracking its source.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKhD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAwD,MAAM,qBAAqB,CAAC;AACzG,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAEnB,MAAM,qBAAqB,CAAC;AAe7B,OAAO,KAAK,EACV,cAAc,EACd,wBAAwB,EACxB,eAAe,EACf,yBAAyB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,E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;;;;OAWG;IACU,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAmB5E;;;;;;;OAOG;IACG,kBAAkB,CACtB,oBAAoB,GAAE,wBAAwB,EAAO,EACrD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,cAAc,EAAE,CAAC;IAY5B;;;;OAIG;IACG,mBAAmB,CACvB,oBAAoB,GAAE,yBAAyB,EAAO,EACtD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,eAAe,EAAE,CAAC;IAW7B;;;;OAIG;YACW,iBAAiB;CAyFhC;AAGD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGxF,YAAY,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9564,7 +9564,7 @@ function withUserAgentSuffix2(headers, ...userAgentSuffixParts) {
|
|
|
9564
9564
|
);
|
|
9565
9565
|
return Object.fromEntries(normalizedHeaders.entries());
|
|
9566
9566
|
}
|
|
9567
|
-
var VERSION4 = "4.0.
|
|
9567
|
+
var VERSION4 = "4.0.19";
|
|
9568
9568
|
var getOriginalFetch3 = () => globalThis.fetch;
|
|
9569
9569
|
var getFromApi2 = async ({
|
|
9570
9570
|
url,
|
|
@@ -9649,8 +9649,8 @@ function loadOptionalSetting2({
|
|
|
9649
9649
|
}
|
|
9650
9650
|
return settingValue;
|
|
9651
9651
|
}
|
|
9652
|
-
var suspectProtoRx2 = /"
|
|
9653
|
-
var suspectConstructorRx2 = /"
|
|
9652
|
+
var suspectProtoRx2 = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/;
|
|
9653
|
+
var suspectConstructorRx2 = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
|
|
9654
9654
|
function _parse2(text4) {
|
|
9655
9655
|
const obj = JSON.parse(text4);
|
|
9656
9656
|
if (obj === null || typeof obj !== "object") {
|
|
@@ -9670,7 +9670,7 @@ function filter2(obj) {
|
|
|
9670
9670
|
if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
|
|
9671
9671
|
throw new SyntaxError("Object contains forbidden prototype property");
|
|
9672
9672
|
}
|
|
9673
|
-
if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
|
|
9673
|
+
if (Object.prototype.hasOwnProperty.call(node, "constructor") && node.constructor !== null && typeof node.constructor === "object" && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
|
|
9674
9674
|
throw new SyntaxError("Object contains forbidden prototype property");
|
|
9675
9675
|
}
|
|
9676
9676
|
for (const key in node) {
|
|
@@ -12234,16 +12234,14 @@ var GatewayVideoModel = class {
|
|
|
12234
12234
|
var _a932;
|
|
12235
12235
|
const resolvedHeaders = await resolve2(this.config.headers());
|
|
12236
12236
|
try {
|
|
12237
|
-
const {
|
|
12238
|
-
responseHeaders,
|
|
12239
|
-
value: responseBody
|
|
12240
|
-
} = await postJsonToApi2({
|
|
12237
|
+
const { responseHeaders, value: responseBody } = await postJsonToApi2({
|
|
12241
12238
|
url: this.getUrl(),
|
|
12242
12239
|
headers: combineHeaders2(
|
|
12243
12240
|
resolvedHeaders,
|
|
12244
12241
|
headers != null ? headers : {},
|
|
12245
12242
|
this.getModelConfigHeaders(),
|
|
12246
|
-
await resolve2(this.config.o11yHeaders)
|
|
12243
|
+
await resolve2(this.config.o11yHeaders),
|
|
12244
|
+
{ accept: "text/event-stream" }
|
|
12247
12245
|
),
|
|
12248
12246
|
body: {
|
|
12249
12247
|
prompt,
|
|
@@ -12256,9 +12254,70 @@ var GatewayVideoModel = class {
|
|
|
12256
12254
|
...providerOptions && { providerOptions },
|
|
12257
12255
|
...image && { image: maybeEncodeVideoFile(image) }
|
|
12258
12256
|
},
|
|
12259
|
-
successfulResponseHandler:
|
|
12260
|
-
|
|
12261
|
-
|
|
12257
|
+
successfulResponseHandler: async ({
|
|
12258
|
+
response,
|
|
12259
|
+
url,
|
|
12260
|
+
requestBodyValues
|
|
12261
|
+
}) => {
|
|
12262
|
+
if (response.body == null) {
|
|
12263
|
+
throw new APICallError3({
|
|
12264
|
+
message: "SSE response body is empty",
|
|
12265
|
+
url,
|
|
12266
|
+
requestBodyValues,
|
|
12267
|
+
statusCode: response.status
|
|
12268
|
+
});
|
|
12269
|
+
}
|
|
12270
|
+
const eventStream = parseJsonEventStream2({
|
|
12271
|
+
stream: response.body,
|
|
12272
|
+
schema: gatewayVideoEventSchema
|
|
12273
|
+
});
|
|
12274
|
+
const reader = eventStream.getReader();
|
|
12275
|
+
const { done, value: parseResult } = await reader.read();
|
|
12276
|
+
reader.releaseLock();
|
|
12277
|
+
if (done || !parseResult) {
|
|
12278
|
+
throw new APICallError3({
|
|
12279
|
+
message: "SSE stream ended without a data event",
|
|
12280
|
+
url,
|
|
12281
|
+
requestBodyValues,
|
|
12282
|
+
statusCode: response.status
|
|
12283
|
+
});
|
|
12284
|
+
}
|
|
12285
|
+
if (!parseResult.success) {
|
|
12286
|
+
throw new APICallError3({
|
|
12287
|
+
message: "Failed to parse video SSE event",
|
|
12288
|
+
cause: parseResult.error,
|
|
12289
|
+
url,
|
|
12290
|
+
requestBodyValues,
|
|
12291
|
+
statusCode: response.status
|
|
12292
|
+
});
|
|
12293
|
+
}
|
|
12294
|
+
const event = parseResult.value;
|
|
12295
|
+
if (event.type === "error") {
|
|
12296
|
+
throw new APICallError3({
|
|
12297
|
+
message: event.message,
|
|
12298
|
+
statusCode: event.statusCode,
|
|
12299
|
+
url,
|
|
12300
|
+
requestBodyValues,
|
|
12301
|
+
responseHeaders: Object.fromEntries([...response.headers]),
|
|
12302
|
+
responseBody: JSON.stringify(event),
|
|
12303
|
+
data: {
|
|
12304
|
+
error: {
|
|
12305
|
+
message: event.message,
|
|
12306
|
+
type: event.errorType,
|
|
12307
|
+
param: event.param
|
|
12308
|
+
}
|
|
12309
|
+
}
|
|
12310
|
+
});
|
|
12311
|
+
}
|
|
12312
|
+
return {
|
|
12313
|
+
value: {
|
|
12314
|
+
videos: event.videos,
|
|
12315
|
+
warnings: event.warnings,
|
|
12316
|
+
providerMetadata: event.providerMetadata
|
|
12317
|
+
},
|
|
12318
|
+
responseHeaders: Object.fromEntries([...response.headers])
|
|
12319
|
+
};
|
|
12320
|
+
},
|
|
12262
12321
|
failedResponseHandler: createJsonErrorResponseHandler2({
|
|
12263
12322
|
errorSchema: z$1.any(),
|
|
12264
12323
|
errorToMessage: (data) => data
|
|
@@ -12330,11 +12389,21 @@ var gatewayVideoWarningSchema = z$1.discriminatedUnion("type", [
|
|
|
12330
12389
|
message: z$1.string()
|
|
12331
12390
|
})
|
|
12332
12391
|
]);
|
|
12333
|
-
var
|
|
12334
|
-
|
|
12335
|
-
|
|
12336
|
-
|
|
12337
|
-
|
|
12392
|
+
var gatewayVideoEventSchema = z$1.discriminatedUnion("type", [
|
|
12393
|
+
z$1.object({
|
|
12394
|
+
type: z$1.literal("result"),
|
|
12395
|
+
videos: z$1.array(gatewayVideoDataSchema),
|
|
12396
|
+
warnings: z$1.array(gatewayVideoWarningSchema).optional(),
|
|
12397
|
+
providerMetadata: z$1.record(z$1.string(), providerMetadataEntrySchema22).optional()
|
|
12398
|
+
}),
|
|
12399
|
+
z$1.object({
|
|
12400
|
+
type: z$1.literal("error"),
|
|
12401
|
+
message: z$1.string(),
|
|
12402
|
+
errorType: z$1.string(),
|
|
12403
|
+
statusCode: z$1.number(),
|
|
12404
|
+
param: z$1.unknown().nullable()
|
|
12405
|
+
})
|
|
12406
|
+
]);
|
|
12338
12407
|
var parallelSearchInputSchema = lazySchema(
|
|
12339
12408
|
() => zodSchema3(
|
|
12340
12409
|
z.object({
|
|
@@ -12511,7 +12580,7 @@ async function getVercelRequestId2() {
|
|
|
12511
12580
|
var _a932;
|
|
12512
12581
|
return (_a932 = (0, import_oidc3.getContext)().headers) == null ? void 0 : _a932["x-vercel-id"];
|
|
12513
12582
|
}
|
|
12514
|
-
var VERSION5 = "3.0.
|
|
12583
|
+
var VERSION5 = "3.0.66";
|
|
12515
12584
|
var AI_GATEWAY_PROTOCOL_VERSION2 = "0.0.1";
|
|
12516
12585
|
function createGatewayProvider2(options = {}) {
|
|
12517
12586
|
var _a932, _b92;
|
|
@@ -12554,13 +12623,18 @@ function createGatewayProvider2(options = {}) {
|
|
|
12554
12623
|
settingValue: void 0,
|
|
12555
12624
|
environmentVariableName: "VERCEL_REGION"
|
|
12556
12625
|
});
|
|
12626
|
+
const projectId = loadOptionalSetting2({
|
|
12627
|
+
settingValue: void 0,
|
|
12628
|
+
environmentVariableName: "VERCEL_PROJECT_ID"
|
|
12629
|
+
});
|
|
12557
12630
|
return async () => {
|
|
12558
12631
|
const requestId = await getVercelRequestId2();
|
|
12559
12632
|
return {
|
|
12560
12633
|
...deploymentId && { "ai-o11y-deployment-id": deploymentId },
|
|
12561
12634
|
...environment && { "ai-o11y-environment": environment },
|
|
12562
12635
|
...region && { "ai-o11y-region": region },
|
|
12563
|
-
...requestId && { "ai-o11y-request-id": requestId }
|
|
12636
|
+
...requestId && { "ai-o11y-request-id": requestId },
|
|
12637
|
+
...projectId && { "ai-o11y-project-id": projectId }
|
|
12564
12638
|
};
|
|
12565
12639
|
};
|
|
12566
12640
|
};
|
|
@@ -13579,7 +13653,7 @@ function getTotalTimeoutMs(timeout) {
|
|
|
13579
13653
|
}
|
|
13580
13654
|
return timeout.totalMs;
|
|
13581
13655
|
}
|
|
13582
|
-
var VERSION33 = "6.0.
|
|
13656
|
+
var VERSION33 = "6.0.116";
|
|
13583
13657
|
var dataContentSchema3 = z$1.union([
|
|
13584
13658
|
z$1.string(),
|
|
13585
13659
|
z$1.instanceof(Uint8Array),
|
|
@@ -15129,6 +15203,25 @@ var updateWorkingMemoryTool = (memoryConfig) => {
|
|
|
15129
15203
|
workingMemory = JSON.stringify(mergedData);
|
|
15130
15204
|
} else {
|
|
15131
15205
|
workingMemory = typeof inputData.memory === "string" ? inputData.memory : JSON.stringify(inputData.memory);
|
|
15206
|
+
const existingRaw = await memory.getWorkingMemory({
|
|
15207
|
+
threadId,
|
|
15208
|
+
resourceId,
|
|
15209
|
+
memoryConfig
|
|
15210
|
+
});
|
|
15211
|
+
if (existingRaw) {
|
|
15212
|
+
const template = await memory.getWorkingMemoryTemplate({ memoryConfig });
|
|
15213
|
+
if (template?.content) {
|
|
15214
|
+
const normalizedNew = workingMemory.replace(/\s+/g, " ").trim();
|
|
15215
|
+
const normalizedTemplate = template.content.replace(/\s+/g, " ").trim();
|
|
15216
|
+
const normalizedExisting = existingRaw.replace(/\s+/g, " ").trim();
|
|
15217
|
+
if (normalizedNew === normalizedTemplate && normalizedExisting !== normalizedTemplate) {
|
|
15218
|
+
return {
|
|
15219
|
+
success: false,
|
|
15220
|
+
message: "Attempted to replace existing working memory with empty template. Update skipped to prevent data loss."
|
|
15221
|
+
};
|
|
15222
|
+
}
|
|
15223
|
+
}
|
|
15224
|
+
}
|
|
15132
15225
|
}
|
|
15133
15226
|
await memory.updateWorkingMemory({
|
|
15134
15227
|
threadId,
|
|
@@ -15219,6 +15312,7 @@ function normalizeObservationalMemoryConfig(config) {
|
|
|
15219
15312
|
var CHARS_PER_TOKEN = 4;
|
|
15220
15313
|
var DEFAULT_MESSAGE_RANGE = { before: 1, after: 1 };
|
|
15221
15314
|
var DEFAULT_TOP_K = 4;
|
|
15315
|
+
var VECTOR_DELETE_BATCH_SIZE = 100;
|
|
15222
15316
|
var isZodObject = (v) => v instanceof ZodObject;
|
|
15223
15317
|
var Memory = class extends MastraMemory {
|
|
15224
15318
|
constructor(config = {}) {
|
|
@@ -15408,6 +15502,45 @@ var Memory = class extends MastraMemory {
|
|
|
15408
15502
|
async deleteThread(threadId) {
|
|
15409
15503
|
const memoryStore = await this.getMemoryStore();
|
|
15410
15504
|
await memoryStore.deleteThread({ threadId });
|
|
15505
|
+
if (this.vector) {
|
|
15506
|
+
void this.deleteThreadVectors(threadId);
|
|
15507
|
+
}
|
|
15508
|
+
}
|
|
15509
|
+
/**
|
|
15510
|
+
* Lists all vector indexes that match the memory messages prefix.
|
|
15511
|
+
* Handles separator differences across vector store backends (e.g. '_' vs '-').
|
|
15512
|
+
*/
|
|
15513
|
+
async getMemoryVectorIndexes() {
|
|
15514
|
+
if (!this.vector) return [];
|
|
15515
|
+
const separator = this.vector.indexSeparator ?? "_";
|
|
15516
|
+
const prefix = `memory${separator}messages`;
|
|
15517
|
+
const indexes = await this.vector.listIndexes();
|
|
15518
|
+
return indexes.filter((name21) => name21.startsWith(prefix));
|
|
15519
|
+
}
|
|
15520
|
+
/**
|
|
15521
|
+
* Deletes all vector embeddings associated with a thread.
|
|
15522
|
+
* This is called internally by deleteThread to clean up orphaned vectors.
|
|
15523
|
+
*
|
|
15524
|
+
* @param threadId - The ID of the thread whose vectors should be deleted
|
|
15525
|
+
*/
|
|
15526
|
+
async deleteThreadVectors(threadId) {
|
|
15527
|
+
try {
|
|
15528
|
+
const memoryIndexes = await this.getMemoryVectorIndexes();
|
|
15529
|
+
await Promise.all(
|
|
15530
|
+
memoryIndexes.map(async (indexName) => {
|
|
15531
|
+
try {
|
|
15532
|
+
await this.vector.deleteVectors({
|
|
15533
|
+
indexName,
|
|
15534
|
+
filter: { thread_id: threadId }
|
|
15535
|
+
});
|
|
15536
|
+
} catch {
|
|
15537
|
+
this.logger.debug(`Failed to delete vectors for thread ${threadId} in ${indexName}, skipping`);
|
|
15538
|
+
}
|
|
15539
|
+
})
|
|
15540
|
+
);
|
|
15541
|
+
} catch {
|
|
15542
|
+
this.logger.debug(`Failed to clean up vectors for thread ${threadId}`);
|
|
15543
|
+
}
|
|
15411
15544
|
}
|
|
15412
15545
|
async updateWorkingMemory({
|
|
15413
15546
|
threadId,
|
|
@@ -15425,25 +15558,33 @@ var Memory = class extends MastraMemory {
|
|
|
15425
15558
|
`Memory error: Resource-scoped working memory is enabled but no resourceId was provided. Either provide a resourceId or explicitly set workingMemory.scope to 'thread'.`
|
|
15426
15559
|
);
|
|
15427
15560
|
}
|
|
15428
|
-
const
|
|
15429
|
-
|
|
15430
|
-
|
|
15431
|
-
|
|
15432
|
-
|
|
15433
|
-
|
|
15434
|
-
|
|
15435
|
-
|
|
15436
|
-
|
|
15437
|
-
throw new Error(`Thread ${threadId} not found`);
|
|
15438
|
-
}
|
|
15439
|
-
await memoryStore.updateThread({
|
|
15440
|
-
id: threadId,
|
|
15441
|
-
title: thread.title || "",
|
|
15442
|
-
metadata: {
|
|
15443
|
-
...thread.metadata,
|
|
15561
|
+
const mutexKey = scope === "resource" ? `resource-${resourceId}` : `thread-${threadId}`;
|
|
15562
|
+
const mutex = this.updateWorkingMemoryMutexes.has(mutexKey) ? this.updateWorkingMemoryMutexes.get(mutexKey) : new Mutex();
|
|
15563
|
+
this.updateWorkingMemoryMutexes.set(mutexKey, mutex);
|
|
15564
|
+
const release = await mutex.acquire();
|
|
15565
|
+
try {
|
|
15566
|
+
const memoryStore = await this.getMemoryStore();
|
|
15567
|
+
if (scope === "resource" && resourceId) {
|
|
15568
|
+
await memoryStore.updateResource({
|
|
15569
|
+
resourceId,
|
|
15444
15570
|
workingMemory
|
|
15571
|
+
});
|
|
15572
|
+
} else {
|
|
15573
|
+
const thread = await this.getThreadById({ threadId });
|
|
15574
|
+
if (!thread) {
|
|
15575
|
+
throw new Error(`Thread ${threadId} not found`);
|
|
15445
15576
|
}
|
|
15446
|
-
|
|
15577
|
+
await memoryStore.updateThread({
|
|
15578
|
+
id: threadId,
|
|
15579
|
+
title: thread.title || "",
|
|
15580
|
+
metadata: {
|
|
15581
|
+
...thread.metadata,
|
|
15582
|
+
workingMemory
|
|
15583
|
+
}
|
|
15584
|
+
});
|
|
15585
|
+
}
|
|
15586
|
+
} finally {
|
|
15587
|
+
release();
|
|
15447
15588
|
}
|
|
15448
15589
|
}
|
|
15449
15590
|
updateWorkingMemoryMutexes = /* @__PURE__ */ new Map();
|
|
@@ -15469,16 +15610,26 @@ var Memory = class extends MastraMemory {
|
|
|
15469
15610
|
const existingWorkingMemory = await this.getWorkingMemory({ threadId, resourceId, memoryConfig }) || "";
|
|
15470
15611
|
const template = await this.getWorkingMemoryTemplate({ memoryConfig });
|
|
15471
15612
|
let reason = "";
|
|
15613
|
+
const normalizeForComparison = (str) => str.replace(/\s+/g, " ").trim();
|
|
15614
|
+
const normalizedNewMemory = normalizeForComparison(workingMemory);
|
|
15615
|
+
const normalizedTemplate = template?.content ? normalizeForComparison(template.content) : "";
|
|
15472
15616
|
if (existingWorkingMemory) {
|
|
15473
15617
|
if (searchString && existingWorkingMemory?.includes(searchString)) {
|
|
15474
15618
|
workingMemory = existingWorkingMemory.replace(searchString, workingMemory);
|
|
15475
15619
|
reason = `found and replaced searchString with newMemory`;
|
|
15476
|
-
} else if (existingWorkingMemory.includes(workingMemory) || template?.content?.trim() === workingMemory.trim()
|
|
15620
|
+
} else if (existingWorkingMemory.includes(workingMemory) || template?.content?.trim() === workingMemory.trim() || // Also check normalized versions to catch template variations with different whitespace
|
|
15621
|
+
normalizedNewMemory === normalizedTemplate) {
|
|
15477
15622
|
return {
|
|
15478
15623
|
success: false,
|
|
15479
15624
|
reason: `attempted to insert duplicate data into working memory. this entry was skipped`
|
|
15480
15625
|
};
|
|
15481
15626
|
} else {
|
|
15627
|
+
if (normalizedNewMemory === normalizedTemplate) {
|
|
15628
|
+
return {
|
|
15629
|
+
success: false,
|
|
15630
|
+
reason: `attempted to append empty template to working memory. this entry was skipped`
|
|
15631
|
+
};
|
|
15632
|
+
}
|
|
15482
15633
|
if (searchString) {
|
|
15483
15634
|
reason = `attempted to replace working memory string that doesn't exist. Appending to working memory instead.`;
|
|
15484
15635
|
} else {
|
|
@@ -15487,7 +15638,7 @@ var Memory = class extends MastraMemory {
|
|
|
15487
15638
|
workingMemory = existingWorkingMemory + `
|
|
15488
15639
|
${workingMemory}`;
|
|
15489
15640
|
}
|
|
15490
|
-
} else if (workingMemory === template?.content) {
|
|
15641
|
+
} else if (workingMemory === template?.content || normalizedNewMemory === normalizedTemplate) {
|
|
15491
15642
|
return {
|
|
15492
15643
|
success: false,
|
|
15493
15644
|
reason: `try again when you have data to add. newMemory was equal to the working memory template`
|
|
@@ -15495,7 +15646,13 @@ ${workingMemory}`;
|
|
|
15495
15646
|
} else {
|
|
15496
15647
|
reason = `started new working memory`;
|
|
15497
15648
|
}
|
|
15498
|
-
|
|
15649
|
+
if (template?.content) {
|
|
15650
|
+
workingMemory = workingMemory.replaceAll(template.content, "");
|
|
15651
|
+
const templateWithUnixLineEndings = template.content.replace(/\r\n/g, "\n");
|
|
15652
|
+
const templateWithWindowsLineEndings = template.content.replace(/\n/g, "\r\n");
|
|
15653
|
+
workingMemory = workingMemory.replaceAll(templateWithUnixLineEndings, "");
|
|
15654
|
+
workingMemory = workingMemory.replaceAll(templateWithWindowsLineEndings, "");
|
|
15655
|
+
}
|
|
15499
15656
|
const scope = config.workingMemory.scope || "resource";
|
|
15500
15657
|
if (scope === "resource" && !resourceId) {
|
|
15501
15658
|
throw new Error(
|
|
@@ -15971,24 +16128,25 @@ Notes:
|
|
|
15971
16128
|
const messageIdsNeedingDeletion = /* @__PURE__ */ new Set([...messageIdsWithClearedContent, ...messageIdsWithNewEmbeddings]);
|
|
15972
16129
|
if (messageIdsNeedingDeletion.size > 0) {
|
|
15973
16130
|
try {
|
|
15974
|
-
const
|
|
15975
|
-
const
|
|
15976
|
-
|
|
15977
|
-
|
|
15978
|
-
|
|
15979
|
-
|
|
15980
|
-
|
|
15981
|
-
|
|
15982
|
-
|
|
15983
|
-
|
|
15984
|
-
|
|
15985
|
-
|
|
15986
|
-
|
|
16131
|
+
const memoryIndexes = await this.getMemoryVectorIndexes();
|
|
16132
|
+
const idsToDelete = [...messageIdsNeedingDeletion];
|
|
16133
|
+
await Promise.all(
|
|
16134
|
+
memoryIndexes.map(async (indexName) => {
|
|
16135
|
+
for (let i = 0; i < idsToDelete.length; i += VECTOR_DELETE_BATCH_SIZE) {
|
|
16136
|
+
const batch = idsToDelete.slice(i, i + VECTOR_DELETE_BATCH_SIZE);
|
|
16137
|
+
try {
|
|
16138
|
+
await this.vector.deleteVectors({
|
|
16139
|
+
indexName,
|
|
16140
|
+
filter: { message_id: { $in: batch } }
|
|
16141
|
+
});
|
|
16142
|
+
} catch {
|
|
16143
|
+
this.logger.debug(`Failed to delete vector batch in ${indexName} (batch offset ${i}), skipping`);
|
|
16144
|
+
}
|
|
15987
16145
|
}
|
|
15988
|
-
}
|
|
15989
|
-
|
|
16146
|
+
})
|
|
16147
|
+
);
|
|
15990
16148
|
} catch {
|
|
15991
|
-
this.logger.debug(`
|
|
16149
|
+
this.logger.debug(`Failed to clean up old vectors during message update`);
|
|
15992
16150
|
}
|
|
15993
16151
|
}
|
|
15994
16152
|
if (embeddingData.length > 0 && dimension !== void 0) {
|
|
@@ -16039,6 +16197,37 @@ Notes:
|
|
|
16039
16197
|
}
|
|
16040
16198
|
const memoryStore = await this.getMemoryStore();
|
|
16041
16199
|
await memoryStore.deleteMessages(messageIds);
|
|
16200
|
+
if (this.vector) {
|
|
16201
|
+
void this.deleteMessageVectors(messageIds);
|
|
16202
|
+
}
|
|
16203
|
+
}
|
|
16204
|
+
/**
|
|
16205
|
+
* Deletes vector embeddings for specific messages.
|
|
16206
|
+
* This is called internally by deleteMessages to clean up orphaned vectors.
|
|
16207
|
+
*
|
|
16208
|
+
* @param messageIds - The IDs of the messages whose vectors should be deleted
|
|
16209
|
+
*/
|
|
16210
|
+
async deleteMessageVectors(messageIds) {
|
|
16211
|
+
try {
|
|
16212
|
+
const memoryIndexes = await this.getMemoryVectorIndexes();
|
|
16213
|
+
await Promise.all(
|
|
16214
|
+
memoryIndexes.map(async (indexName) => {
|
|
16215
|
+
for (let i = 0; i < messageIds.length; i += VECTOR_DELETE_BATCH_SIZE) {
|
|
16216
|
+
const batch = messageIds.slice(i, i + VECTOR_DELETE_BATCH_SIZE);
|
|
16217
|
+
try {
|
|
16218
|
+
await this.vector.deleteVectors({
|
|
16219
|
+
indexName,
|
|
16220
|
+
filter: { message_id: { $in: batch } }
|
|
16221
|
+
});
|
|
16222
|
+
} catch {
|
|
16223
|
+
this.logger.debug(`Failed to delete vector batch in ${indexName} (batch offset ${i}), skipping`);
|
|
16224
|
+
}
|
|
16225
|
+
}
|
|
16226
|
+
})
|
|
16227
|
+
);
|
|
16228
|
+
} catch {
|
|
16229
|
+
this.logger.debug(`Failed to clean up vectors for deleted messages`);
|
|
16230
|
+
}
|
|
16042
16231
|
}
|
|
16043
16232
|
/**
|
|
16044
16233
|
* Clone a thread and its messages to create a new independent thread.
|
|
@@ -16453,7 +16642,7 @@ Notes:
|
|
|
16453
16642
|
"Observational memory async buffering is enabled by default but the installed version of @mastra/core does not support it. Either upgrade @mastra/core, @mastra/memory, and your storage adapter (@mastra/libsql, @mastra/pg, or @mastra/mongodb) to the latest version, or explicitly disable async buffering by setting `observation: { bufferTokens: false }` in your observationalMemory config."
|
|
16454
16643
|
);
|
|
16455
16644
|
}
|
|
16456
|
-
const { ObservationalMemory } = await import('./observational-memory-
|
|
16645
|
+
const { ObservationalMemory } = await import('./observational-memory-QFQUF5EY.js');
|
|
16457
16646
|
return new ObservationalMemory({
|
|
16458
16647
|
storage: memoryStore,
|
|
16459
16648
|
scope: omConfig.scope,
|