@mastra/pg 1.20.0-alpha.2 → 1.20.0-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.
Files changed (24) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/docs/SKILL.md +9 -7
  3. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  4. package/dist/docs/references/docs-deployment-workers.md +1 -1
  5. package/dist/docs/references/docs-memory-semantic-recall.md +2 -1
  6. package/dist/docs/references/docs-memory-working-memory.md +1 -0
  7. package/dist/docs/references/docs-storage-overview.md +14 -12
  8. package/dist/docs/references/{reference-storage-dynamodb.md → integrations-databases-dynamodb.md} +1 -1
  9. package/dist/docs/references/integrations-databases-neon.md +220 -0
  10. package/dist/docs/references/{reference-storage-postgresql.md → integrations-databases-postgresql.md} +1 -1
  11. package/dist/docs/references/reference-rag-chunking-and-embedding.md +182 -0
  12. package/dist/docs/references/reference-rag-metadata-filters.md +13 -4
  13. package/dist/docs/references/{guides-rag-overview.md → reference-rag-overview.md} +2 -2
  14. package/dist/docs/references/{guides-rag-retrieval.md → reference-rag-retrieval.md} +18 -1
  15. package/dist/docs/references/{guides-rag-vector-databases.md → reference-rag-vector-databases.md} +42 -1
  16. package/dist/docs/references/reference-storage-composite.md +4 -4
  17. package/dist/docs/references/reference-storage-retention.md +4 -4
  18. package/dist/index.cjs +5 -4
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.js +5 -4
  21. package/dist/index.js.map +1 -1
  22. package/dist/storage/domains/memory/index.d.ts +3 -2
  23. package/dist/storage/domains/memory/index.d.ts.map +1 -1
  24. package/package.json +3 -3
@@ -436,6 +436,23 @@ export const ragAgent = new Agent({
436
436
  })
437
437
  ```
438
438
 
439
+ **OracleDB**:
440
+
441
+ ```ts
442
+ import { ORACLEDB_PROMPT } from '@mastra/oracledb'
443
+
444
+ export const ragAgent = new Agent({
445
+ id: 'rag-agent',
446
+ name: 'RAG Agent',
447
+ model: 'openai/gpt-5.6-sol',
448
+ instructions: `
449
+ Process queries using the provided context. Structure responses to be concise and relevant.
450
+ ${ORACLEDB_PROMPT}
451
+ `,
452
+ tools: { vectorQueryTool },
453
+ })
454
+ ```
455
+
439
456
  **S3Vectors**:
440
457
 
441
458
  ```ts
@@ -517,4 +534,4 @@ The re-ranked results combine vector similarity with semantic understanding to i
517
534
 
518
535
  For more details about re-ranking, see the [rerank()](https://mastra.ai/reference/rag/rerankWithScorer) method.
519
536
 
520
- For graph-based retrieval that follows connections between chunks, see the [GraphRAG](https://mastra.ai/guides/rag/graph-rag) documentation.
537
+ For graph-based retrieval that follows connections between chunks, see the [GraphRAG](https://mastra.ai/reference/rag/graph-rag-guide) documentation.
@@ -78,6 +78,35 @@ await store.upsert({
78
78
 
79
79
  PostgreSQL with the pgvector extension is a good solution for teams already using PostgreSQL who want to minimize infrastructure complexity. For detailed setup instructions and best practices, see the [official pgvector repository](https://github.com/pgvector/pgvector).
80
80
 
81
+ **OracleDB**:
82
+
83
+ ```ts
84
+ import { OracleVector } from '@mastra/oracledb'
85
+
86
+ const store = new OracleVector({
87
+ id: 'oracle-vector',
88
+ user: process.env.ORACLE_DATABASE_USER,
89
+ password: process.env.ORACLE_DATABASE_PASSWORD,
90
+ connectString: process.env.ORACLE_DATABASE_CONNECT_STRING,
91
+ })
92
+
93
+ await store.createIndex({
94
+ indexName: 'myCollection',
95
+ dimension: 1536,
96
+ indexConfig: { type: 'none' },
97
+ })
98
+
99
+ await store.upsert({
100
+ indexName: 'myCollection',
101
+ vectors: embeddings,
102
+ metadata: chunks.map(chunk => ({ text: chunk.text })),
103
+ })
104
+ ```
105
+
106
+ ### Using Oracle Database Vector Search
107
+
108
+ OracleDB stores embeddings in native `VECTOR` columns and metadata in Oracle JSON. Exact search is the default; HNSW and IVF indexes can be configured for tuned deployments.
109
+
81
110
  **Pinecone**:
82
111
 
83
112
  ```ts
@@ -378,7 +407,7 @@ await store.createIndex({
378
407
 
379
408
  The dimension size must match the output dimension of your chosen embedding model. Common dimension sizes are:
380
409
 
381
- - `OpenAI text-embedding-3-small`: 1536 dimensions (or custom, e.g., 256)
410
+ - OpenAI `text-embedding-3-small`: 1536 dimensions (or custom, e.g., 256)
382
411
  - `Cohere embed-multilingual-v3`: 1024 dimensions
383
412
  - `VoyageAI voyage-3.5`: 1024 dimensions (or custom: 256, 512, 1024, 2048)
384
413
  - `Google gemini-embedding-001`: 768 dimensions (or custom)
@@ -410,6 +439,18 @@ Index names must:
410
439
  - Example: `my_index_123` is valid
411
440
  - Example: `my-index` is not valid (contains hyphen)
412
441
 
442
+ **OracleDB**:
443
+
444
+ Index names are logical Mastra names. OracleDB maps each logical index to a physical Oracle table internally.
445
+
446
+ Logical index names must:
447
+
448
+ - Be non-empty
449
+ - Be 512 characters or fewer
450
+ - Be stable for the lifetime of the vector index
451
+ - Example: `my_collection_123` is valid
452
+ - Example: `customer-support/docs:v1` is valid and is mapped to a safe Oracle table name
453
+
413
454
  **Pinecone**:
414
455
 
415
456
  Index names must:
@@ -338,7 +338,7 @@ const storage = new MastraCompositeStore({
338
338
 
339
339
  Observability data can quickly overwhelm general-purpose databases in production. A single agent interaction can generate hundreds of spans, and high-traffic applications can produce thousands of traces per day.
340
340
 
341
- **[ClickHouse](https://mastra.ai/reference/storage/clickhouse)** is recommended for production observability because it's optimized for high-volume, write-heavy analytics workloads. Use composite storage to route observability to ClickHouse while keeping other data in your primary database:
341
+ **[ClickHouse](https://mastra.ai/integrations/databases/clickhouse)** is recommended for production observability because it's optimized for high-volume, write-heavy analytics workloads. Use composite storage to route observability to ClickHouse while keeping other data in your primary database:
342
342
 
343
343
  ```typescript
344
344
  import { MastraCompositeStore } from '@mastra/core/storage'
@@ -360,7 +360,7 @@ const storage = new MastraCompositeStore({
360
360
  })
361
361
  ```
362
362
 
363
- > **Note:** `ObservabilityStorageClickhouseVNext` is the current observability domain implementation. The legacy `ObservabilityStorageClickhouse` class is also exported and remains supported for projects that haven't migrated. See the [ClickHouse storage reference](https://mastra.ai/reference/storage/clickhouse) for details.
363
+ > **Note:** `ObservabilityStorageClickhouseVNext` is the current observability domain implementation. The legacy `ObservabilityStorageClickhouse` class is also exported and remains supported for projects that haven't migrated. See the [ClickHouse storage reference](https://mastra.ai/integrations/databases/clickhouse) for details.
364
364
 
365
365
  ### Replicated ClickHouse for multi-replica clusters
366
366
 
@@ -392,6 +392,6 @@ const storage = new MastraCompositeStore({
392
392
  })
393
393
  ```
394
394
 
395
- Don't set `replication` on ClickHouse Cloud. Cloud rewrites `MergeTree` to `SharedMergeTree` server-side. See the [ClickHouse storage reference](https://mastra.ai/reference/storage/clickhouse) for the full config shape and operator notes.
395
+ Don't set `replication` on ClickHouse Cloud. Cloud rewrites `MergeTree` to `SharedMergeTree` server-side. See the [ClickHouse storage reference](https://mastra.ai/integrations/databases/clickhouse) for the full config shape and operator notes.
396
396
 
397
- > **Info:** This approach is also required when using storage providers that don't support observability (like Convex, DynamoDB, or Cloudflare). See the [MastraStorageExporter documentation](https://mastra.ai/docs/observability/integrations/exporters/mastra-storage) for the full list of supported providers.
397
+ > **Note:** This approach is also required when using storage providers that don't support observability (like Convex, DynamoDB, or Cloudflare). See the [MastraStorageExporter documentation](https://mastra.ai/docs/observability/integrations/exporters/mastra-storage) for the full list of supported providers.
@@ -8,7 +8,7 @@ Storage grows without bound by default. Retention is an opt-in, age-based cleanu
8
8
 
9
9
  Retention covers **growth tables** only: tables that accumulate rows unbounded as a side effect of normal operation (conversation history, telemetry, job and run records, schedule fire history, event feeds). User-authored artifacts and config (agents, skills, workspaces, prompt blocks, datasets, schedule definitions, channel installations, and so on) grow with user intent and are edited or deleted explicitly, so they're not valid retention keys.
10
10
 
11
- The reference implementations are [libSQL](https://mastra.ai/reference/storage/libsql), [PostgreSQL](https://mastra.ai/reference/storage/postgresql), and [MongoDB](https://mastra.ai/reference/storage/mongodb). Other adapters keep rows forever until they implement retention.
11
+ The reference implementations are [libSQL](https://mastra.ai/integrations/databases/libsql), [PostgreSQL](https://mastra.ai/integrations/databases/postgresql), and [MongoDB](https://mastra.ai/integrations/databases/mongodb). Other adapters keep rows forever until they implement retention.
12
12
 
13
13
  ## Usage example
14
14
 
@@ -238,11 +238,11 @@ Handing that free space back to the OS is a separate concern that Mastra doesn't
238
238
 
239
239
  For MongoDB, deleted documents are reused by future insertions. To reclaim disk space, run [`db.runCommand({ compact: "collection_name" })`](https://www.mongodb.com/docs/manual/reference/command/compact/) during a maintenance window.
240
240
 
241
- > **LibSQL and Turso:** [Turso Cloud](https://mastra.ai/reference/storage/libsql) manages storage compaction for you, so there's nothing to reclaim manually. This applies only to self-hosted libSQL files.
241
+ > **LibSQL and Turso:** [Turso Cloud](https://mastra.ai/integrations/databases/libsql) manages storage compaction for you, so there's nothing to reclaim manually. This applies only to self-hosted libSQL files.
242
242
 
243
243
  ## Related
244
244
 
245
- - [libSQL storage](https://mastra.ai/reference/storage/libsql)
246
- - [PostgreSQL storage](https://mastra.ai/reference/storage/postgresql)
245
+ - [libSQL storage](https://mastra.ai/integrations/databases/libsql)
246
+ - [PostgreSQL storage](https://mastra.ai/integrations/databases/postgresql)
247
247
  - [Composite storage](https://mastra.ai/reference/storage/composite)
248
248
  - [Storage overview](https://mastra.ai/reference/storage/overview)
package/dist/index.cjs CHANGED
@@ -8728,6 +8728,7 @@ function dedupeMessagesForSave(messages) {
8728
8728
  return Array.from(deduped.values());
8729
8729
  }
8730
8730
  var MemoryPG = class MemoryPG extends _mastra_core_storage.MemoryStorage {
8731
+ supportsPartialThreadUpdate = true;
8731
8732
  supportsObservationalMemory = true;
8732
8733
  /**
8733
8734
  * Retention-eligible tables. `threads`, `messages`, and `resources` all anchor
@@ -9200,7 +9201,7 @@ var MemoryPG = class MemoryPG extends _mastra_core_storage.MemoryStorage {
9200
9201
  text: `Thread ${id} not found`,
9201
9202
  details: {
9202
9203
  threadId: id,
9203
- title
9204
+ title: title ?? null
9204
9205
  }
9205
9206
  });
9206
9207
  const mergedMetadata = {
@@ -9211,14 +9212,14 @@ var MemoryPG = class MemoryPG extends _mastra_core_storage.MemoryStorage {
9211
9212
  const nowStr = toUtcISOString(/* @__PURE__ */ new Date());
9212
9213
  const thread = await this.#db.client.one(`UPDATE ${threadTableName}
9213
9214
  SET
9214
- title = $1,
9215
+ title = COALESCE($1, title),
9215
9216
  metadata = $2,
9216
9217
  "updatedAt" = $3,
9217
9218
  "updatedAtZ" = $4
9218
9219
  WHERE id = $5
9219
9220
  RETURNING *
9220
9221
  `, [
9221
- title,
9222
+ title ?? null,
9222
9223
  mergedMetadata,
9223
9224
  nowStr,
9224
9225
  nowStr,
@@ -9239,7 +9240,7 @@ var MemoryPG = class MemoryPG extends _mastra_core_storage.MemoryStorage {
9239
9240
  category: _mastra_core_error.ErrorCategory.THIRD_PARTY,
9240
9241
  details: {
9241
9242
  threadId: id,
9242
- title
9243
+ title: title ?? null
9243
9244
  }
9244
9245
  }, error);
9245
9246
  }