@mastra/memory 0.12.2-alpha.2 → 0.12.3-alpha.0
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/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +48 -0
- package/dist/index.cjs +5 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/integration-tests-v5/.env.test +5 -0
- package/integration-tests-v5/CHANGELOG.md +25 -0
- package/integration-tests-v5/docker-compose.yml +39 -0
- package/integration-tests-v5/node_modules/.bin/next +21 -0
- package/integration-tests-v5/node_modules/.bin/tsc +21 -0
- package/integration-tests-v5/node_modules/.bin/tsserver +21 -0
- package/integration-tests-v5/node_modules/.bin/vitest +21 -0
- package/integration-tests-v5/package.json +43 -0
- package/integration-tests-v5/src/agent-memory.test.ts +621 -0
- package/integration-tests-v5/src/mastra/agents/weather.ts +75 -0
- package/integration-tests-v5/src/mastra/index.ts +13 -0
- package/integration-tests-v5/src/mastra/tools/weather.ts +24 -0
- package/integration-tests-v5/src/processors.test.ts +600 -0
- package/integration-tests-v5/src/streaming-memory.test.ts +367 -0
- package/integration-tests-v5/src/test-utils.ts +146 -0
- package/integration-tests-v5/src/working-memory.test.ts +1064 -0
- package/integration-tests-v5/tsconfig.json +13 -0
- package/integration-tests-v5/vitest.config.ts +18 -0
- package/package.json +7 -6
- package/src/index.ts +4 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true
|
|
10
|
+
},
|
|
11
|
+
"include": ["src/**/*", "vitest.config.ts"],
|
|
12
|
+
"exclude": ["node_modules"]
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
pool: 'forks',
|
|
6
|
+
globals: true,
|
|
7
|
+
environment: 'node',
|
|
8
|
+
testTimeout: 60000,
|
|
9
|
+
hookTimeout: 30000,
|
|
10
|
+
coverage: {
|
|
11
|
+
provider: 'v8',
|
|
12
|
+
reporter: ['text', 'json', 'html'],
|
|
13
|
+
},
|
|
14
|
+
// smaller output to save token space when LLMs run tests
|
|
15
|
+
reporters: 'dot',
|
|
16
|
+
bail: 1,
|
|
17
|
+
},
|
|
18
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/memory",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.3-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,17 +34,18 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@upstash/redis": "^1.35.3",
|
|
36
36
|
"ai": "^4.3.16",
|
|
37
|
+
"ai-v5": "npm:ai@5.0.0",
|
|
37
38
|
"js-tiktoken": "^1.0.20",
|
|
38
39
|
"json-schema": "^0.4.0",
|
|
39
40
|
"pg": "^8.16.3",
|
|
40
41
|
"pg-pool": "^3.10.1",
|
|
41
42
|
"postgres": "^3.4.7",
|
|
42
|
-
"redis": "^5.8.
|
|
43
|
+
"redis": "^5.8.1",
|
|
43
44
|
"async-mutex": "^0.5.0",
|
|
44
45
|
"xxhash-wasm": "^1.1.0",
|
|
45
46
|
"zod": "^3.25.67",
|
|
46
47
|
"zod-to-json-schema": "^3.24.5",
|
|
47
|
-
"@mastra/schema-compat": "0.10.7
|
|
48
|
+
"@mastra/schema-compat": "0.10.7"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
51
|
"@ai-sdk/openai": "^1.3.22",
|
|
@@ -57,9 +58,9 @@
|
|
|
57
58
|
"typescript": "^5.8.3",
|
|
58
59
|
"typescript-eslint": "^8.38.0",
|
|
59
60
|
"vitest": "^3.2.4",
|
|
60
|
-
"@internal/lint": "0.0.
|
|
61
|
-
"@mastra/core": "0.
|
|
62
|
-
"@internal/types-builder": "0.0.
|
|
61
|
+
"@internal/lint": "0.0.29",
|
|
62
|
+
"@mastra/core": "0.14.0-alpha.4",
|
|
63
|
+
"@internal/types-builder": "0.0.4"
|
|
63
64
|
},
|
|
64
65
|
"peerDependencies": {
|
|
65
66
|
"@mastra/core": ">=0.13.0-0 <0.14.0-0"
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { MemoryConfig, SharedMemoryConfig, StorageThreadType, WorkingMemory
|
|
|
7
7
|
import type { StorageGetMessagesArg, ThreadSortOptions, PaginationInfo } from '@mastra/core/storage';
|
|
8
8
|
import { embedMany } from 'ai';
|
|
9
9
|
import type { CoreMessage, TextPart } from 'ai';
|
|
10
|
+
import { embedMany as embedManyV5 } from 'ai-v5';
|
|
10
11
|
import { Mutex } from 'async-mutex';
|
|
11
12
|
import type { JSONSchema7 } from 'json-schema';
|
|
12
13
|
|
|
@@ -522,10 +523,11 @@ export class Memory extends MastraMemory {
|
|
|
522
523
|
await this.firstEmbed;
|
|
523
524
|
}
|
|
524
525
|
|
|
525
|
-
const promise = embedMany({
|
|
526
|
+
const promise = (this.embedder.specificationVersion === `v2` ? embedManyV5 : embedMany)({
|
|
526
527
|
values: chunks,
|
|
527
|
-
model: this.embedder,
|
|
528
528
|
maxRetries: 3,
|
|
529
|
+
// @ts-ignore
|
|
530
|
+
model: this.embedder,
|
|
529
531
|
});
|
|
530
532
|
|
|
531
533
|
if (isFastEmbed && !this.firstEmbed) this.firstEmbed = promise;
|