@mastra/memory 1.15.0 → 1.15.1-alpha.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 +17 -0
- package/dist/{chunk-42AZEBIK.js → chunk-HAEQMUD4.js} +4 -4
- package/dist/chunk-HAEQMUD4.js.map +1 -0
- package/dist/{chunk-WNLRMAHY.cjs → chunk-OUMWCVQI.cjs} +3 -3
- package/dist/chunk-OUMWCVQI.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +25 -25
- package/dist/docs/references/docs-memory-memory-processors.md +3 -3
- package/dist/docs/references/docs-memory-message-history.md +2 -2
- package/dist/docs/references/docs-memory-observational-memory.md +1 -1
- package/dist/docs/references/docs-memory-storage.md +0 -2
- package/dist/docs/references/docs-memory-working-memory.md +1 -1
- package/dist/index.cjs +68 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +59 -5
- package/dist/index.js.map +1 -1
- package/dist/{observational-memory-MBL257AG.js → observational-memory-H74M5SB6.js} +3 -3
- package/dist/{observational-memory-MBL257AG.js.map → observational-memory-H74M5SB6.js.map} +1 -1
- package/dist/{observational-memory-3RE2HCRV.cjs → observational-memory-TKXRH2LD.cjs} +26 -26
- package/dist/{observational-memory-3RE2HCRV.cjs.map → observational-memory-TKXRH2LD.cjs.map} +1 -1
- package/dist/processors/index.cjs +24 -24
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/processor.d.ts.map +1 -1
- package/dist/tools/working-memory.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/chunk-42AZEBIK.js.map +0 -1
- package/dist/chunk-WNLRMAHY.cjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __commonJS, require_token_error, __toESM } from './chunk-SVPZMV27.js';
|
|
2
2
|
import { __commonJS as __commonJS$1, require_token_error as require_token_error$1, __toESM as __toESM$1 } from './chunk-RC6RZVYE.js';
|
|
3
|
-
import { truncateStringByTokens, resolveToolResultValue, formatToolResultForObserver } from './chunk-
|
|
4
|
-
export { ModelByInputTokens, getObservationsAsOf } from './chunk-
|
|
3
|
+
import { truncateStringByTokens, resolveToolResultValue, formatToolResultForObserver } from './chunk-HAEQMUD4.js';
|
|
4
|
+
export { ModelByInputTokens, getObservationsAsOf } from './chunk-HAEQMUD4.js';
|
|
5
5
|
import { ZodFirstPartyTypeKind } from 'zod/v3';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import * as z4 from 'zod/v4';
|
|
@@ -16431,6 +16431,25 @@ function deepMergeWorkingMemory(existing, update) {
|
|
|
16431
16431
|
}
|
|
16432
16432
|
return result;
|
|
16433
16433
|
}
|
|
16434
|
+
function stripNullsFromOptional(value, schema) {
|
|
16435
|
+
if (Array.isArray(value)) {
|
|
16436
|
+
const itemSchema = schema.items ?? {};
|
|
16437
|
+
return value.map((item) => stripNullsFromOptional(item, itemSchema));
|
|
16438
|
+
}
|
|
16439
|
+
if (typeof value === "object" && value !== null) {
|
|
16440
|
+
const properties = schema.properties ?? {};
|
|
16441
|
+
const required = schema.required ?? [];
|
|
16442
|
+
const result = {};
|
|
16443
|
+
for (const [key, propertyValue] of Object.entries(value)) {
|
|
16444
|
+
if (propertyValue === null && !required.includes(key)) {
|
|
16445
|
+
continue;
|
|
16446
|
+
}
|
|
16447
|
+
result[key] = stripNullsFromOptional(propertyValue, properties[key] ?? {});
|
|
16448
|
+
}
|
|
16449
|
+
return result;
|
|
16450
|
+
}
|
|
16451
|
+
return value;
|
|
16452
|
+
}
|
|
16434
16453
|
var updateWorkingMemoryTool = (memoryConfig) => {
|
|
16435
16454
|
const schema = memoryConfig?.workingMemory?.schema;
|
|
16436
16455
|
let inputSchema = z.object({
|
|
@@ -16440,7 +16459,7 @@ var updateWorkingMemoryTool = (memoryConfig) => {
|
|
|
16440
16459
|
const standardSchema2 = isStandardSchemaWithJSON$1(schema) ? schema : toStandardSchema$1(schema);
|
|
16441
16460
|
const jsonSchema4 = standardSchemaToJSONSchema(standardSchema2, { io: "input" });
|
|
16442
16461
|
delete jsonSchema4.$schema;
|
|
16443
|
-
|
|
16462
|
+
const wrappedSchema = toStandardSchema$1({
|
|
16444
16463
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
16445
16464
|
type: "object",
|
|
16446
16465
|
description: "The JSON formatted working memory content to store.",
|
|
@@ -16449,6 +16468,41 @@ var updateWorkingMemoryTool = (memoryConfig) => {
|
|
|
16449
16468
|
},
|
|
16450
16469
|
required: ["memory"]
|
|
16451
16470
|
});
|
|
16471
|
+
inputSchema = {
|
|
16472
|
+
"~standard": {
|
|
16473
|
+
version: 1,
|
|
16474
|
+
vendor: "mastra",
|
|
16475
|
+
validate: (value) => {
|
|
16476
|
+
const wrappedResult = wrappedSchema["~standard"].validate(value);
|
|
16477
|
+
if (wrappedResult instanceof Promise) {
|
|
16478
|
+
return wrappedResult.then((result) => {
|
|
16479
|
+
if (!("issues" in result) || !result.issues) {
|
|
16480
|
+
return result;
|
|
16481
|
+
}
|
|
16482
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || "memory" in value) {
|
|
16483
|
+
return result;
|
|
16484
|
+
}
|
|
16485
|
+
return wrappedSchema["~standard"].validate({
|
|
16486
|
+
memory: stripNullsFromOptional(value, jsonSchema4)
|
|
16487
|
+
});
|
|
16488
|
+
});
|
|
16489
|
+
}
|
|
16490
|
+
if (!("issues" in wrappedResult) || !wrappedResult.issues) {
|
|
16491
|
+
return wrappedResult;
|
|
16492
|
+
}
|
|
16493
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || "memory" in value) {
|
|
16494
|
+
return wrappedResult;
|
|
16495
|
+
}
|
|
16496
|
+
return wrappedSchema["~standard"].validate({
|
|
16497
|
+
memory: stripNullsFromOptional(value, jsonSchema4)
|
|
16498
|
+
});
|
|
16499
|
+
},
|
|
16500
|
+
jsonSchema: {
|
|
16501
|
+
input: (props) => wrappedSchema["~standard"].jsonSchema.input(props),
|
|
16502
|
+
output: (props) => wrappedSchema["~standard"].jsonSchema.output(props)
|
|
16503
|
+
}
|
|
16504
|
+
}
|
|
16505
|
+
};
|
|
16452
16506
|
}
|
|
16453
16507
|
const usesMergeSemantics = Boolean(schema);
|
|
16454
16508
|
const description = schema ? `Update the working memory with new information. Data is merged with existing memory - only include fields you want to add or update. To preserve existing data, omit the field entirely. Arrays are replaced entirely when provided, so pass the complete array or omit it to keep the existing values.` : `Update the working memory with new information. Any data not included will be overwritten. Always pass data as string to the memory field. Never pass an object.`;
|
|
@@ -17525,7 +17579,7 @@ ${workingMemory}`;
|
|
|
17525
17579
|
"Observational memory requires @mastra/core support for request-response-id-rotation. Please bump @mastra/core to a newer version."
|
|
17526
17580
|
);
|
|
17527
17581
|
}
|
|
17528
|
-
const { ObservationalMemory: OMClass } = await import('./observational-memory-
|
|
17582
|
+
const { ObservationalMemory: OMClass } = await import('./observational-memory-H74M5SB6.js');
|
|
17529
17583
|
const onIndexObservations = this.hasRetrievalSearch(omConfig.retrieval) ? async (observation) => {
|
|
17530
17584
|
await this.indexObservation(observation);
|
|
17531
17585
|
} : void 0;
|
|
@@ -18448,7 +18502,7 @@ Notes:
|
|
|
18448
18502
|
if (!effectiveConfig) return null;
|
|
18449
18503
|
const engine = await this.omEngine;
|
|
18450
18504
|
if (!engine) return null;
|
|
18451
|
-
const { ObservationalMemoryProcessor } = await import('./observational-memory-
|
|
18505
|
+
const { ObservationalMemoryProcessor } = await import('./observational-memory-H74M5SB6.js');
|
|
18452
18506
|
return new ObservationalMemoryProcessor(engine, this);
|
|
18453
18507
|
}
|
|
18454
18508
|
};
|