@mastra/memory 1.26.1-alpha.3 → 1.26.1-alpha.4

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 CHANGED
@@ -1,5 +1,26 @@
1
1
  # @mastra/memory
2
2
 
3
+ ## 1.26.1-alpha.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix Observational Memory undercounting large tool results. Token accounting now serializes tool results in full instead of reusing the Observer-facing representation, which is truncated to 10k tokens. Oversized tool results now push OM past its thresholds and trigger compaction before the provider's context window overflows. ([#21045](https://github.com/mastra-ai/mastra/pull/21045))
8
+
9
+ - Fixed generated thread titles being clobbered during a turn ([#21041](https://github.com/mastra-ai/mastra/pull/21041))
10
+
11
+ `updateThread` required both `title` and `metadata`, so callers that only needed to
12
+ change metadata (message persistence, working memory, observational memory, channel
13
+ subscriptions) had to read the thread and pass its title back. When title generation
14
+ finished between that read and the write, the freshly generated title was overwritten
15
+ with the stale one.
16
+
17
+ `title` and `metadata` are now independently optional: omitting one leaves that column
18
+ untouched. Callers that only change metadata no longer send a title, and message
19
+ persistence no longer rewrites a thread row it just read.
20
+
21
+ - Updated dependencies [[`1c75e32`](https://github.com/mastra-ai/mastra/commit/1c75e32f7fc0b9fb6f548b4407feaec8a1440212), [`c47165c`](https://github.com/mastra-ai/mastra/commit/c47165c983c87594c6952f1fd2fa51a90205034c), [`e08e789`](https://github.com/mastra-ai/mastra/commit/e08e789c1bf4cd2fe46363f7a4728536ceccc9bd), [`35cc901`](https://github.com/mastra-ai/mastra/commit/35cc90102cf834a84827acaf9eee0b6d6d1e2a3b), [`a8b4cf0`](https://github.com/mastra-ai/mastra/commit/a8b4cf02823cffebc4751a53337dfacf097c1ae1), [`f33264f`](https://github.com/mastra-ai/mastra/commit/f33264f517ae603279afd5c4251e2b40f6dd3618), [`689f2c4`](https://github.com/mastra-ai/mastra/commit/689f2c4b6c0835fe455702b01d21daa8abcd9331), [`eeae63e`](https://github.com/mastra-ai/mastra/commit/eeae63e7fbe8e1f237adc69bca6e2ac13c5ca907), [`4c186a0`](https://github.com/mastra-ai/mastra/commit/4c186a017275f45e6ed4c09de0f89550e2d09e8c), [`b0fa077`](https://github.com/mastra-ai/mastra/commit/b0fa077bcbc9b08551846fe372a0d3d15b71ed72)]:
22
+ - @mastra/core@1.58.0-alpha.8
23
+
3
24
  ## 1.26.1-alpha.3
4
25
 
5
26
  ### Patch Changes
@@ -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.26.1-alpha.3"
6
+ version: "1.26.1-alpha.4"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -50,11 +50,13 @@ Read the individual reference documents for detailed explanations and code examp
50
50
  - [Reference: DynamoDB storage](references/reference-storage-dynamodb.md) - Documentation for the DynamoDB storage implementation in Mastra, using a single-table design with ElectroDB.
51
51
  - [Reference: libSQL storage](references/reference-storage-libsql.md) - Documentation for the libSQL storage implementation in Mastra.
52
52
  - [Reference: MongoDB storage](references/reference-storage-mongodb.md) - Documentation for the MongoDB storage implementation in Mastra.
53
+ - [Reference: OracleDB storage](references/reference-storage-oracledb.md) - Documentation for the Oracle Database storage provider in Mastra.
53
54
  - [Reference: PostgreSQL storage](references/reference-storage-postgresql.md) - Documentation for the PostgreSQL storage implementation in Mastra.
54
55
  - [Reference: Redis Storage](references/reference-storage-redis.md) - Documentation for the Redis storage implementation in Mastra.
55
56
  - [Reference: Upstash storage](references/reference-storage-upstash.md) - Documentation for the Upstash storage implementation in Mastra.
56
57
  - [Reference: libSQL vector store](references/reference-vectors-libsql.md) - Documentation for the LibSQLVector class in Mastra, which provides vector search using libSQL with vector extensions.
57
58
  - [Reference: MongoDB vector store](references/reference-vectors-mongodb.md) - Documentation for the MongoDBVector class in Mastra, which provides vector search using MongoDB Atlas and Atlas Vector Search.
59
+ - [Reference: OracleDB vector store](references/reference-vectors-oracledb.md) - Documentation for the Oracle Database vector provider in Mastra.
58
60
  - [Reference: PG vector store](references/reference-vectors-pg.md) - Documentation for the PgVector class in Mastra, which provides vector search using PostgreSQL with pgvector extension.
59
61
  - [Reference: Upstash vector store](references/reference-vectors-upstash.md) - Documentation for the UpstashVector class in Mastra, which provides vector search using Upstash Vector.
60
62
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.26.1-alpha.3",
2
+ "version": "1.26.1-alpha.4",
3
3
  "package": "@mastra/memory",
4
4
  "exports": {},
5
5
  "modules": {
@@ -156,7 +156,7 @@ const memory = new Memory({
156
156
  })
157
157
  ```
158
158
 
159
- OM requires a storage adapter that supports it: `@mastra/libsql`, `@mastra/pg`, or `@mastra/mongodb`.
159
+ OM requires a storage adapter that supports it: `@mastra/libsql`, `@mastra/pg`, `@mastra/mongodb`, or `@mastra/oracledb`.
160
160
 
161
161
  > **Note:** If you switch the Observer to a weaker model and see facts collapse to a generic `User`, use [`observation.instruction`](https://mastra.ai/reference/memory/observational-memory) to teach the Observer how to read the `<turn>` tag.
162
162
 
@@ -94,7 +94,7 @@ See [configuration options](https://mastra.ai/reference/memory/observational-mem
94
94
  >
95
95
  > For an AI SDK example, see [Using Mastra Memory](https://mastra.ai/guides/build-your-ui/ai-sdk-ui).
96
96
 
97
- > **Note:** OM currently only supports `@mastra/pg`, `@mastra/libsql`, `@mastra/mysql`, `@mastra/mongodb`, and `@mastra/convex` storage adapters. It uses background agents for managing memory. When no model is set, the default model is `google/gemini-2.5-flash`.
97
+ > **Note:** OM currently only supports `@mastra/pg`, `@mastra/libsql`, `@mastra/mysql`, `@mastra/mongodb`, `@mastra/convex`, and `@mastra/oracledb` storage adapters. It uses background agents for managing memory. When no model is set, the default model is `google/gemini-2.5-flash`.
98
98
 
99
99
  ## Temporal gap markers
100
100
 
@@ -148,6 +148,7 @@ Each vector store page below includes installation instructions, configuration p
148
148
  - [libSQL](https://mastra.ai/reference/vectors/libsql)
149
149
  - [MongoDB](https://mastra.ai/reference/vectors/mongodb)
150
150
  - [OpenSearch](https://mastra.ai/reference/vectors/opensearch)
151
+ - [OracleDB](https://mastra.ai/reference/vectors/oracledb)
151
152
  - [Pinecone](https://mastra.ai/reference/vectors/pinecone)
152
153
  - [PostgreSQL](https://mastra.ai/reference/vectors/pg)
153
154
  - [Qdrant](https://mastra.ai/reference/vectors/qdrant)
@@ -180,7 +181,7 @@ const agent = new Agent({
180
181
  })
181
182
  ```
182
183
 
183
- > **Note:** `scope: 'resource'` is supported by the LibSQL, PostgreSQL, MongoDB, and Upstash storage adapters.
184
+ > **Note:** `scope: 'resource'` is supported by the LibSQL, OracleDB, PostgreSQL, MongoDB, and Upstash storage adapters.
184
185
 
185
186
  ### Metadata filtering
186
187
 
@@ -129,6 +129,7 @@ Resource-scoped working memory requires specific storage adapters that support t
129
129
 
130
130
  - **libSQL** (`@mastra/libsql`)
131
131
  - **PostgreSQL** (`@mastra/pg`)
132
+ - **OracleDB** (`@mastra/oracledb`)
132
133
  - **Upstash** (`@mastra/upstash`)
133
134
  - **MongoDB** (`@mastra/mongodb`)
134
135
 
@@ -193,6 +193,7 @@ Each provider page includes installation instructions, configuration parameters,
193
193
  - [libSQL](https://mastra.ai/reference/storage/libsql)
194
194
  - [PostgreSQL](https://mastra.ai/reference/storage/postgresql)
195
195
  - [MongoDB](https://mastra.ai/reference/storage/mongodb)
196
+ - [OracleDB](https://mastra.ai/reference/storage/oracledb)
196
197
  - [Upstash](https://mastra.ai/reference/storage/upstash)
197
198
  - [Redis](https://mastra.ai/reference/storage/redis)
198
199
  - [Cloudflare D1](https://mastra.ai/reference/storage/cloudflare-d1)
@@ -0,0 +1,239 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # OracleDB storage
4
+
5
+ The OracleDB storage provider stores Mastra application state in Oracle Database. It implements Mastra's composite storage interface, so one `OracleStore` instance can back memory, workflow snapshots, observability, scores, scorer definitions, MCP client metadata, and agent registry data.
6
+
7
+ ## Installation
8
+
9
+ **npm**:
10
+
11
+ ```bash
12
+ npm install @mastra/oracledb@latest
13
+ ```
14
+
15
+ **pnpm**:
16
+
17
+ ```bash
18
+ pnpm add @mastra/oracledb@latest
19
+ ```
20
+
21
+ **Yarn**:
22
+
23
+ ```bash
24
+ yarn add @mastra/oracledb@latest
25
+ ```
26
+
27
+ **Bun**:
28
+
29
+ ```bash
30
+ bun add @mastra/oracledb@latest
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ ```ts
36
+ import { OracleStore } from '@mastra/oracledb'
37
+
38
+ const storage = new OracleStore({
39
+ id: 'oracle-storage',
40
+ user: process.env.ORACLE_DATABASE_USER,
41
+ password: process.env.ORACLE_DATABASE_PASSWORD,
42
+ connectString: process.env.ORACLE_DATABASE_CONNECT_STRING,
43
+ })
44
+ ```
45
+
46
+ Use it with Mastra:
47
+
48
+ ```ts
49
+ import { Mastra } from '@mastra/core/mastra'
50
+
51
+ export const mastra = new Mastra({
52
+ storage,
53
+ })
54
+ ```
55
+
56
+ ## Parameters
57
+
58
+ **id** (`string`): Unique identifier for this storage instance.
59
+
60
+ **user** (`string`): Oracle Database user. Required unless using pool or externalAuth.
61
+
62
+ **password** (`string`): Password for the Oracle Database user. Required unless using pool or externalAuth.
63
+
64
+ **connectString** (`string`): Oracle connect string, service name, TNS alias, or Autonomous Database connect descriptor. Required unless using pool.
65
+
66
+ **pool** (`oracledb.Pool`): Existing Oracle connection pool. When provided, Mastra uses the pool but doesn't close it when store.close() is called.
67
+
68
+ **poolManager** (`OraclePoolManager`): Shared Oracle pool manager. Use this to share one Oracle pool between OracleStore and OracleVector.
69
+
70
+ **schemaName** (`string`): Oracle schema name used to qualify storage tables.
71
+
72
+ **poolMin** (`number`): Minimum number of Oracle pool connections. (Default: `0`)
73
+
74
+ **poolMax** (`number`): Maximum number of Oracle pool connections. (Default: `4`)
75
+
76
+ **poolIncrement** (`number`): Number of connections to add when the pool grows. (Default: `1`)
77
+
78
+ **configDir** (`string`): Directory containing Oracle Network configuration files such as tnsnames.ora.
79
+
80
+ **walletLocation** (`string`): Oracle wallet directory for mTLS connections such as Autonomous Database.
81
+
82
+ **walletPassword** (`string`): Password for the Oracle wallet, when required by the wallet configuration.
83
+
84
+ **externalAuth** (`boolean`): Use Oracle external authentication instead of username/password authentication.
85
+
86
+ **disableInit** (`boolean`): When true, automatic schema initialization is disabled. Use this when schema changes are applied separately before the app starts. (Default: `false`)
87
+
88
+ **messageBatchSize** (`number`): Number of messages sent per Oracle executeMany call when saving messages. The operation still commits once at the transaction boundary. (Default: `200`)
89
+
90
+ **skipDefaultIndexes** (`boolean`): When true, default storage indexes aren't created during initialization.
91
+
92
+ **indexes** (`OracleCreateIndexOptions[]`): Custom Oracle index definitions to create during initialization. Indexes are routed to the storage domain that owns the target table.
93
+
94
+ **migrationTableName** (`string`): Oracle table used to track storage schema migrations. (Default: `'MASTRA_ORACLE_MIGRATIONS'`)
95
+
96
+ **vectorRegistryTableName** (`string`): OracleVector registry table used to discover semantic-recall vector tables when threads or messages are deleted. Set this to match OracleVector's registryTableName when that option is customized.
97
+
98
+ ## Connection examples
99
+
100
+ The basic username/password constructor is shown above. For Autonomous Database, add wallet options to the same constructor:
101
+
102
+ ```ts
103
+ const storage = new OracleStore({
104
+ id: 'oracle-storage',
105
+ user: process.env.ORACLE_DATABASE_USER,
106
+ password: process.env.ORACLE_DATABASE_PASSWORD,
107
+ connectString: process.env.ORACLE_DATABASE_CONNECT_STRING,
108
+ walletLocation: process.env.ORACLE_DATABASE_WALLET_DIR,
109
+ walletPassword: process.env.ORACLE_DATABASE_WALLET_PASSWORD,
110
+ configDir: process.env.ORACLE_DATABASE_CONFIG_DIR,
111
+ })
112
+ ```
113
+
114
+ For external authentication, set `externalAuth: true` and omit `password`. To reuse an existing `oracledb.Pool`, pass it as `pool`. Mastra uses it but doesn't close it.
115
+
116
+ `OracleStore` backs memory, workflow snapshots, observability, scores, scorer definitions, MCP client metadata, and agent registry data. When using the store outside a `Mastra` instance, call `await storage.init()` and access a domain with `await storage.getStore('memory')`.
117
+
118
+ ## Initialization
119
+
120
+ When you pass `OracleStore` to `Mastra`, `init()` is called automatically before storage operations run. If you use `OracleStore` directly, call `init()` before reading or writing:
121
+
122
+ ```ts
123
+ await storage.init()
124
+ ```
125
+
126
+ > **Warning:** If initialization is disabled or skipped, storage operations require the Oracle tables and indexes to already exist.
127
+
128
+ `OracleStore.init()` runs repeatable migrations and records the result in the migration ledger table. The default ledger table is `MASTRA_ORACLE_MIGRATIONS`.
129
+
130
+ ```ts
131
+ await storage.migrate()
132
+ const history = await storage.listMigrations()
133
+ ```
134
+
135
+ Repeatable migrations are idempotent. They reconcile the tables and indexes owned by each storage domain on startup, which lets new domain indexes or compatible schema additions apply without changing application code.
136
+
137
+ Initialization also creates the provider's default indexes for common Mastra query paths. Use `skipDefaultIndexes` when indexes are managed separately, or pass `indexes` for custom Oracle indexes. Custom definitions support Oracle options such as `bitmap`, `online`, `invisible`, `parallel`, `compress`, `noLogging`, and `reverse`, as well as function-based expressions like `JSON_VALUE(...)`.
138
+
139
+ Custom indexes are useful when your app repeatedly filters on JSON metadata or when database administrators (DBAs) want to test an index before the optimizer uses it:
140
+
141
+ ```ts
142
+ const storage = new OracleStore({
143
+ id: 'oracle-storage',
144
+ user,
145
+ password,
146
+ connectString,
147
+ indexes: [
148
+ {
149
+ name: 'idx_messages_status',
150
+ table: 'mastra_messages',
151
+ columns: [
152
+ "JSON_VALUE(metadata, '$.status' RETURNING VARCHAR2(32) NULL ON ERROR)",
153
+ 'thread_id',
154
+ ],
155
+ online: true,
156
+ invisible: true,
157
+ },
158
+ ],
159
+ })
160
+ ```
161
+
162
+ Use `invisible` for staged rollout, then remove it after validating query plans. Use `skipDefaultIndexes: true` only when a DBA-managed indexing strategy replaces the defaults.
163
+
164
+ Use `disableInit: true` when schema changes are applied by a separate deployment step or by a database administrator.
165
+
166
+ ## Schema export
167
+
168
+ Use `exportSchemas()` to generate Oracle DDL without connecting to a database. This is useful when schema changes are reviewed or applied outside application startup.
169
+
170
+ ```ts
171
+ import { exportSchemas } from '@mastra/oracledb'
172
+
173
+ const ddl = exportSchemas({
174
+ schemaName: 'MASTRA_APP',
175
+ domains: [
176
+ 'memory',
177
+ 'workflows',
178
+ 'observability',
179
+ 'scores',
180
+ 'scorerDefinitions',
181
+ 'mcpClients',
182
+ 'agents',
183
+ ],
184
+ })
185
+
186
+ console.log(ddl)
187
+ ```
188
+
189
+ `domains` defaults to every supported domain, including `vector`, when omitted.
190
+
191
+ ## Operational notes
192
+
193
+ Use the same `OraclePoolManager` when `OracleStore` and `OracleVector` should share one Oracle connection lifecycle:
194
+
195
+ ```ts
196
+ import { OracleStore, OracleVector } from '@mastra/oracledb'
197
+
198
+ const storage = new OracleStore({ id: 'oracle-storage', user, password, connectString })
199
+ const vector = new OracleVector({
200
+ id: 'oracle-vector',
201
+ poolManager: storage.getPoolManager(),
202
+ })
203
+ ```
204
+
205
+ `OracleStore` exposes `storage.db` and `await storage.getPool()` for advanced use cases. When using these APIs directly, you're responsible for transaction boundaries and connection lifecycle.
206
+
207
+ JSON metadata, payloads, and snapshots are stored in native Oracle JSON columns and encoded server-side, so the rows are readable directly with standard Oracle JDBC tools such as DBeaver and SQL Developer.
208
+
209
+ ## Usage example
210
+
211
+ ### Adding OracleDB memory to an agent
212
+
213
+ ```ts
214
+ import { Agent } from '@mastra/core/agent'
215
+ import { Memory } from '@mastra/memory'
216
+ import { OracleStore } from '@mastra/oracledb'
217
+
218
+ const storage = new OracleStore({
219
+ id: 'oracle-storage',
220
+ user: process.env.ORACLE_DATABASE_USER,
221
+ password: process.env.ORACLE_DATABASE_PASSWORD,
222
+ connectString: process.env.ORACLE_DATABASE_CONNECT_STRING,
223
+ })
224
+
225
+ export const oracleAgent = new Agent({
226
+ id: 'oracle-agent',
227
+ name: 'Oracle Agent',
228
+ instructions: 'You are an assistant with persistent OracleDB-backed memory.',
229
+ model: 'openai/gpt-5.6-sol',
230
+ memory: new Memory({ storage }),
231
+ })
232
+ ```
233
+
234
+ ## Related
235
+
236
+ - [OracleDB vector store](https://mastra.ai/reference/vectors/oracledb)
237
+ - [Storage overview](https://mastra.ai/reference/storage/overview)
238
+ - [Working memory](https://mastra.ai/docs/memory/working-memory)
239
+ - [Workflow snapshots](https://mastra.ai/docs/workflows/snapshots)