@mastra/memory 1.20.1-alpha.0 → 1.20.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.
Files changed (28) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/_types/@internal_ai-sdk-v4/dist/index.d.ts +2 -160
  3. package/dist/{chunk-LXU26UVM.js → chunk-KMJQDCCZ.js} +128 -12
  4. package/dist/{chunk-LXU26UVM.js.map → chunk-KMJQDCCZ.js.map} +1 -1
  5. package/dist/{chunk-R2H7SJS2.cjs → chunk-P4BYW7GY.cjs} +127 -11
  6. package/dist/chunk-P4BYW7GY.cjs.map +1 -0
  7. package/dist/docs/SKILL.md +1 -1
  8. package/dist/docs/assets/SOURCE_MAP.json +28 -28
  9. package/dist/docs/references/docs-agents-agent-approval.md +14 -0
  10. package/dist/docs/references/docs-memory-semantic-recall.md +1 -1
  11. package/dist/docs/references/reference-vectors-pg.md +2 -0
  12. package/dist/index.cjs +198 -203
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +189 -194
  16. package/dist/index.js.map +1 -1
  17. package/dist/{observational-memory-L32TPJ5J.cjs → observational-memory-CDLGZL67.cjs} +26 -26
  18. package/dist/{observational-memory-L32TPJ5J.cjs.map → observational-memory-CDLGZL67.cjs.map} +1 -1
  19. package/dist/{observational-memory-GE5MP6W7.js → observational-memory-TJFOX3YN.js} +3 -3
  20. package/dist/{observational-memory-GE5MP6W7.js.map → observational-memory-TJFOX3YN.js.map} +1 -1
  21. package/dist/processors/index.cjs +24 -24
  22. package/dist/processors/index.js +1 -1
  23. package/dist/processors/observational-memory/temporal-markers.d.ts.map +1 -1
  24. package/dist/processors/observational-memory/token-counter.d.ts +1 -0
  25. package/dist/processors/observational-memory/token-counter.d.ts.map +1 -1
  26. package/dist/tools/working-memory.d.ts.map +1 -1
  27. package/package.json +5 -5
  28. package/dist/chunk-R2H7SJS2.cjs.map +0 -1
@@ -3,7 +3,7 @@ name: mastra-memory
3
3
  description: Documentation for @mastra/memory. Use when working with @mastra/memory APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/memory"
6
- version: "1.20.1-alpha.0"
6
+ version: "1.20.1-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,119 +1,119 @@
1
1
  {
2
- "version": "1.20.1-alpha.0",
2
+ "version": "1.20.1-alpha.1",
3
3
  "package": "@mastra/memory",
4
4
  "exports": {
5
5
  "ModelByInputTokens": {
6
6
  "types": "dist/processors/index.d.ts",
7
- "implementation": "dist/chunk-LXU26UVM.js",
7
+ "implementation": "dist/chunk-KMJQDCCZ.js",
8
8
  "line": 787
9
9
  },
10
10
  "OBSERVER_SYSTEM_PROMPT": {
11
11
  "types": "dist/processors/index.d.ts",
12
- "implementation": "dist/chunk-LXU26UVM.js"
12
+ "implementation": "dist/chunk-KMJQDCCZ.js"
13
13
  },
14
14
  "ObservationalMemory": {
15
15
  "types": "dist/processors/index.d.ts",
16
- "implementation": "dist/chunk-LXU26UVM.js",
17
- "line": 7060
16
+ "implementation": "dist/chunk-KMJQDCCZ.js",
17
+ "line": 7175
18
18
  },
19
19
  "ObservationalMemoryProcessor": {
20
20
  "types": "dist/processors/index.d.ts",
21
- "implementation": "dist/chunk-LXU26UVM.js",
22
- "line": 9631
21
+ "implementation": "dist/chunk-KMJQDCCZ.js",
22
+ "line": 9747
23
23
  },
24
24
  "TokenCounter": {
25
25
  "types": "dist/processors/index.d.ts",
26
- "implementation": "dist/chunk-LXU26UVM.js",
26
+ "implementation": "dist/chunk-KMJQDCCZ.js",
27
27
  "line": 6506
28
28
  },
29
29
  "buildObserverPrompt": {
30
30
  "types": "dist/processors/index.d.ts",
31
- "implementation": "dist/chunk-LXU26UVM.js",
31
+ "implementation": "dist/chunk-KMJQDCCZ.js",
32
32
  "line": 3774
33
33
  },
34
34
  "buildObserverSystemPrompt": {
35
35
  "types": "dist/processors/index.d.ts",
36
- "implementation": "dist/chunk-LXU26UVM.js",
36
+ "implementation": "dist/chunk-KMJQDCCZ.js",
37
37
  "line": 3045
38
38
  },
39
39
  "combineObservationGroupRanges": {
40
40
  "types": "dist/processors/index.d.ts",
41
- "implementation": "dist/chunk-LXU26UVM.js",
41
+ "implementation": "dist/chunk-KMJQDCCZ.js",
42
42
  "line": 879
43
43
  },
44
44
  "deriveObservationGroupProvenance": {
45
45
  "types": "dist/processors/index.d.ts",
46
- "implementation": "dist/chunk-LXU26UVM.js",
46
+ "implementation": "dist/chunk-KMJQDCCZ.js",
47
47
  "line": 913
48
48
  },
49
49
  "extractCurrentTask": {
50
50
  "types": "dist/processors/index.d.ts",
51
- "implementation": "dist/chunk-LXU26UVM.js",
51
+ "implementation": "dist/chunk-KMJQDCCZ.js",
52
52
  "line": 3888
53
53
  },
54
54
  "formatMessagesForObserver": {
55
55
  "types": "dist/processors/index.d.ts",
56
- "implementation": "dist/chunk-LXU26UVM.js",
56
+ "implementation": "dist/chunk-KMJQDCCZ.js",
57
57
  "line": 3500
58
58
  },
59
59
  "getObservationsAsOf": {
60
60
  "types": "dist/processors/index.d.ts",
61
- "implementation": "dist/chunk-LXU26UVM.js",
62
- "line": 9844
61
+ "implementation": "dist/chunk-KMJQDCCZ.js",
62
+ "line": 9960
63
63
  },
64
64
  "hasCurrentTaskSection": {
65
65
  "types": "dist/processors/index.d.ts",
66
- "implementation": "dist/chunk-LXU26UVM.js",
66
+ "implementation": "dist/chunk-KMJQDCCZ.js",
67
67
  "line": 3876
68
68
  },
69
69
  "injectAnchorIds": {
70
70
  "types": "dist/processors/index.d.ts",
71
- "implementation": "dist/chunk-LXU26UVM.js",
71
+ "implementation": "dist/chunk-KMJQDCCZ.js",
72
72
  "line": 2593
73
73
  },
74
74
  "optimizeObservationsForContext": {
75
75
  "types": "dist/processors/index.d.ts",
76
- "implementation": "dist/chunk-LXU26UVM.js",
76
+ "implementation": "dist/chunk-KMJQDCCZ.js",
77
77
  "line": 3899
78
78
  },
79
79
  "parseAnchorId": {
80
80
  "types": "dist/processors/index.d.ts",
81
- "implementation": "dist/chunk-LXU26UVM.js",
81
+ "implementation": "dist/chunk-KMJQDCCZ.js",
82
82
  "line": 2566
83
83
  },
84
84
  "parseObservationGroups": {
85
85
  "types": "dist/processors/index.d.ts",
86
- "implementation": "dist/chunk-LXU26UVM.js",
86
+ "implementation": "dist/chunk-KMJQDCCZ.js",
87
87
  "line": 848
88
88
  },
89
89
  "parseObserverOutput": {
90
90
  "types": "dist/processors/index.d.ts",
91
- "implementation": "dist/chunk-LXU26UVM.js",
91
+ "implementation": "dist/chunk-KMJQDCCZ.js",
92
92
  "line": 3784
93
93
  },
94
94
  "reconcileObservationGroupsFromReflection": {
95
95
  "types": "dist/processors/index.d.ts",
96
- "implementation": "dist/chunk-LXU26UVM.js",
96
+ "implementation": "dist/chunk-KMJQDCCZ.js",
97
97
  "line": 937
98
98
  },
99
99
  "renderObservationGroupsForReflection": {
100
100
  "types": "dist/processors/index.d.ts",
101
- "implementation": "dist/chunk-LXU26UVM.js",
101
+ "implementation": "dist/chunk-KMJQDCCZ.js",
102
102
  "line": 893
103
103
  },
104
104
  "stripEphemeralAnchorIds": {
105
105
  "types": "dist/processors/index.d.ts",
106
- "implementation": "dist/chunk-LXU26UVM.js",
106
+ "implementation": "dist/chunk-KMJQDCCZ.js",
107
107
  "line": 2623
108
108
  },
109
109
  "stripObservationGroups": {
110
110
  "types": "dist/processors/index.d.ts",
111
- "implementation": "dist/chunk-LXU26UVM.js",
111
+ "implementation": "dist/chunk-KMJQDCCZ.js",
112
112
  "line": 870
113
113
  },
114
114
  "wrapInObservationGroup": {
115
115
  "types": "dist/processors/index.d.ts",
116
- "implementation": "dist/chunk-LXU26UVM.js",
116
+ "implementation": "dist/chunk-KMJQDCCZ.js",
117
117
  "line": 841
118
118
  },
119
119
  "OBSERVATIONAL_MEMORY_DEFAULTS": {
@@ -149,7 +149,7 @@
149
149
  "processors": {
150
150
  "index": "dist/processors/index.js",
151
151
  "chunks": [
152
- "chunk-LXU26UVM.js",
152
+ "chunk-KMJQDCCZ.js",
153
153
  "chunk-VKRZ3O5X.js"
154
154
  ]
155
155
  }
@@ -86,6 +86,20 @@ for await (const chunk of stream.fullStream) {
86
86
  }
87
87
  ```
88
88
 
89
+ #### Conditional approval with a function
90
+
91
+ Instead of a boolean, `requireToolApproval` accepts a function that decides per tool call. It receives the `toolName`, the `args` the model passed, the `requestContext`, and the `workspace`. Return `true` to require approval for that call, or `false` to allow it. This lets you gate approval dynamically — for example, only for tools whose name matches a pattern:
92
+
93
+ ```typescript
94
+ const stream = await agent.stream('Clean up old records', {
95
+ requireToolApproval: ({ toolName }) => /^delete_/.test(toolName),
96
+ })
97
+ ```
98
+
99
+ A tool's own `requireApproval` setting still takes precedence: if a tool defines its own approval rule, that rule decides for that tool and the function above does not override it. If the function throws, the call requires approval (fail-safe).
100
+
101
+ > **Note:** Function-based `requireToolApproval` is only available on regular `stream()` / `generate()` calls. Durable agents and stored agents persist their options, and a function can't be serialized, so they accept only a boolean. If you pass a function in those contexts it falls back to requiring approval for every tool call.
102
+
89
103
  ### Runtime suspension with `suspend()`
90
104
 
91
105
  A tool can also pause _during_ its `execute` function by calling `suspend()`. This is useful when the tool starts running and then discovers it needs additional user input or confirmation before it can finish.
@@ -247,7 +247,7 @@ const agent = new Agent({
247
247
  })
248
248
  ```
249
249
 
250
- The model router automatically handles API key detection from environment variables (`OPENAI_API_KEY`, `GOOGLE_GENERATIVE_AI_API_KEY`, `OPENROUTER_API_KEY`).
250
+ The model router automatically handles API key detection from environment variables (`OPENAI_API_KEY`, `GOOGLE_API_KEY`, `OPENROUTER_API_KEY`). Google models also fall back to `GOOGLE_GENERATIVE_AI_API_KEY`.
251
251
 
252
252
  ### Using AI SDK Packages
253
253
 
@@ -26,6 +26,8 @@ The PgVector class provides vector search using [PostgreSQL](https://www.postgre
26
26
 
27
27
  **pgPoolOptions** (`PoolConfig`): Additional pg pool configuration options
28
28
 
29
+ **disableInit** (`boolean`): When true, automatic DDL (schema, extension, table, and index creation) inside \`createIndex\` is skipped. Useful for CI/CD pipelines where schema and indexes are managed separately and the runtime database role lacks DDL privileges. Can also be enabled with the \`MASTRA\_DISABLE\_STORAGE\_INIT\` environment variable. (Default: `false`)
30
+
29
31
  ## Constructor examples
30
32
 
31
33
  ### Connection String