@mastra/pg 1.13.0-alpha.1 → 1.13.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/CHANGELOG.md CHANGED
@@ -1,5 +1,89 @@
1
1
  # @mastra/pg
2
2
 
3
+ ## 1.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add the v-next observability storage domain for `@mastra/pg`, an insert-only, ([#16760](https://github.com/mastra-ai/mastra/pull/16760))
8
+ partitioned Postgres adapter for low-volume observability (~100 calls/sec,
9
+ up to roughly 1,500 calls/sec sustained on a single primary).
10
+
11
+ The new `PostgresStoreVNext` composes a primary `PostgresStore` (memory,
12
+ workflows, scores, agents, etc.) with an `ObservabilityStoragePostgresVNext`
13
+ for spans, logs, metrics, scores, and feedback. All observability writes go
14
+ through a single multi-row `INSERT ... ON CONFLICT DO NOTHING` path. Storage
15
+ is partitioned per day with three modes auto-detected at `init()` time:
16
+ TimescaleDB hypertables, pg_partman (4.x or 5.x), or native Postgres range
17
+ partitions. Root-span lookups are served by partial indexes, and OLAP queries
18
+ (aggregates, breakdowns, time-series, percentiles) prune partitions by
19
+ `timestamp`. A small discovery cache table powers stale-while-revalidate
20
+ lookups for entity names/types/labels.
21
+
22
+ The `observability` connection is **required** — callers always make an
23
+ explicit decision about where observability data lives. For production,
24
+ point it at a dedicated Postgres instance to keep OLAP scans from
25
+ contending with your primary OLTP workload. Reusing the primary
26
+ connection works for local development and logs a runtime warning on every
27
+ construction.
28
+
29
+ ```typescript
30
+ import { Mastra } from '@mastra/core';
31
+ import { PostgresStoreVNext } from '@mastra/pg';
32
+
33
+ export const mastra = new Mastra({
34
+ storage: new PostgresStoreVNext({
35
+ id: 'app',
36
+ connectionString: process.env.DATABASE_URL!,
37
+ observability: {
38
+ connectionString: process.env.OBSERVABILITY_DATABASE_URL!,
39
+ },
40
+ }),
41
+ });
42
+ ```
43
+
44
+ Delta polling uses Postgres transaction IDs and a safe transaction horizon so
45
+ concurrent writers cannot cause late-committing rows to be skipped. The
46
+ `observability-delta-polling` feature flag is opt-in.
47
+
48
+ `ensureNativePartitions()` swallows the `42P07 relation already exists`
49
+ error around `CREATE TABLE IF NOT EXISTS … PARTITION OF`, matching the
50
+ existing guard used for base-table and index DDL. This makes concurrent
51
+ `init()` from two processes (serverless cold-start, blue/green overlap, two
52
+ stores sharing a schema) idempotent instead of letting the loser surface an
53
+ unhandled duplicate-relation error.
54
+
55
+ ### Patch Changes
56
+
57
+ - dependencies updates: ([#17148](https://github.com/mastra-ai/mastra/pull/17148))
58
+ - Updated dependency [`pg@^8.21.0` ↗︎](https://www.npmjs.com/package/pg/v/8.21.0) (from `^8.20.0`, in `dependencies`)
59
+
60
+ - Added full Agent Builder storage support to the PostgreSQL adapter, bringing it to parity with libSQL. ([#17596](https://github.com/mastra-ai/mastra/pull/17596))
61
+
62
+ Previously, projects using PostgreSQL could not store tool provider connections or agent tool providers, and several Agent Builder tables were missing from the exported schema.
63
+ - Added storage for tool provider connections, so connections can be created, read, listed by author, and deleted on PostgreSQL.
64
+ - Agent versions now persist their tool providers on PostgreSQL across save and load.
65
+ - Fixed schema export so all Agent Builder tables are included.
66
+
67
+ - Fixed `PgVector` ignoring an explicit `ssl` option when the connection string also contained an `sslmode=` (or `ssl=`) query parameter. `node-postgres` re-parses the connection string and overwrote the explicit `ssl` object, causing `UNABLE_TO_GET_ISSUER_CERT_LOCALLY` / "self-signed certificate" errors against self-signed or internal CAs even when verification was meant to be skipped. ([#17650](https://github.com/mastra-ai/mastra/pull/17650))
68
+
69
+ `PgVector` now honors an explicit `ssl` option over the connection string, matching the existing `PostgresStore` behavior. Connection-string-only SSL (`?sslmode=require` with no explicit `ssl`) keeps working as before.
70
+
71
+ ```ts
72
+ import { PgVector } from '@mastra/pg';
73
+
74
+ // This now connects instead of throwing UNABLE_TO_GET_ISSUER_CERT_LOCALLY
75
+ const vector = new PgVector({
76
+ id: 'my-vector',
77
+ connectionString: 'postgresql://user:pass@host:5432/db?sslmode=require',
78
+ ssl: { rejectUnauthorized: false },
79
+ });
80
+ ```
81
+
82
+ - Make atomic db updates better ([#16796](https://github.com/mastra-ai/mastra/pull/16796))
83
+
84
+ - Updated dependencies [[`d468acb`](https://github.com/mastra-ai/mastra/commit/d468acb07aec1bb19a2cb0ada8042b05b46746b2), [`575f815`](https://github.com/mastra-ai/mastra/commit/575f815c5c3567b71c0b83cbb7fa98c8253a9d9c), [`34839c1`](https://github.com/mastra-ai/mastra/commit/34839c1910b6964bf59ed0cee58844efebbb684e), [`053735a`](https://github.com/mastra-ai/mastra/commit/053735a75c2c18e23ce34d9468007efa4a45f4c4), [`306909a`](https://github.com/mastra-ai/mastra/commit/306909a693de77d709b38706e2673c9547d24a28), [`5191af8`](https://github.com/mastra-ai/mastra/commit/5191af80c799eea25357c545fc05d91b3883531d), [`43bd3d4`](https://github.com/mastra-ai/mastra/commit/43bd3d421987463fdf35386a45199c49499ed069), [`e6fa79e`](https://github.com/mastra-ai/mastra/commit/e6fa79ec72a2ddffdd25e85270398951e9d552a4), [`904bcdf`](https://github.com/mastra-ai/mastra/commit/904bcdf7b8004aa7be823f9f70ca63580e47e470), [`7f5ee1d`](https://github.com/mastra-ai/mastra/commit/7f5ee1dca46daee8d2817f2ebe49e6335da81956), [`1e9aab5`](https://github.com/mastra-ai/mastra/commit/1e9aab50ff11e6e88fde4d7cbf512c44a9fe8d61), [`2bccba4`](https://github.com/mastra-ai/mastra/commit/2bccba4c03cadc815c2d54cbf4dd43a922140a8d), [`bf8eb6d`](https://github.com/mastra-ai/mastra/commit/bf8eb6d0ec213a403eb9265a594ad283c44ab3dc), [`e9be4e7`](https://github.com/mastra-ai/mastra/commit/e9be4e747ec3d8b65548bff92f9377db06105376), [`493a328`](https://github.com/mastra-ai/mastra/commit/493a328f4346a1deeb9f1e2e44c8f2a3a4d7591b), [`d53cfc2`](https://github.com/mastra-ai/mastra/commit/d53cfc2c7f8d78343a4aa84ec4e129ba25f3325e), [`65799d4`](https://github.com/mastra-ai/mastra/commit/65799d4d549e5ebb9c848fbe3f51ac090f64becf), [`c268c89`](https://github.com/mastra-ai/mastra/commit/c268c89f4c63a93ee474d3cffdf3ea60bf00d4f2), [`34839c1`](https://github.com/mastra-ai/mastra/commit/34839c1910b6964bf59ed0cee58844efebbb684e), [`014e00f`](https://github.com/mastra-ai/mastra/commit/014e00f2b3a597a016b72f9901c6ab27d491f822), [`029a414`](https://github.com/mastra-ai/mastra/commit/029a4141719793bd3e898a39eb5a0466a55f5f3a), [`d468acb`](https://github.com/mastra-ai/mastra/commit/d468acb07aec1bb19a2cb0ada8042b05b46746b2), [`b147b29`](https://github.com/mastra-ai/mastra/commit/b147b2907f0cd1aa812efe6d6e3f58d22e66fc88), [`d371ac1`](https://github.com/mastra-ai/mastra/commit/d371ac1d9820afaaf7cfdbc380a475946a994d8f), [`2bccba4`](https://github.com/mastra-ai/mastra/commit/2bccba4c03cadc815c2d54cbf4dd43a922140a8d), [`0c72f03`](https://github.com/mastra-ai/mastra/commit/0c72f032abb13254df5a7856d64be2f207b8006d), [`cf182b7`](https://github.com/mastra-ai/mastra/commit/cf182b7fb495767946d9840ef29f19cfa906f31f), [`3b45ea9`](https://github.com/mastra-ai/mastra/commit/3b45ea95015557a6cb9d70dc5252af54ab1b78ac), [`a049c2a`](https://github.com/mastra-ai/mastra/commit/a049c2a9dfb41d0ee2e7a28874a88cd64fd5669f), [`f084be1`](https://github.com/mastra-ai/mastra/commit/f084be1fcbe33ad7480913e44d6130c421c0976f), [`b147b29`](https://github.com/mastra-ai/mastra/commit/b147b2907f0cd1aa812efe6d6e3f58d22e66fc88), [`2a96528`](https://github.com/mastra-ai/mastra/commit/2a9652848dfa3c5a2426f952e9d93554c26fd90f), [`f2ab060`](https://github.com/mastra-ai/mastra/commit/f2ab060162bea81505fda553e2cee29c1979fd04), [`5d302c8`](https://github.com/mastra-ai/mastra/commit/5d302c8eda1a6ac74eab5e442c4f64db6cc97a06), [`34839c1`](https://github.com/mastra-ai/mastra/commit/34839c1910b6964bf59ed0cee58844efebbb684e), [`a952852`](https://github.com/mastra-ai/mastra/commit/a952852c971a21fb646cd907c75fcf4443cdc963), [`2656d9c`](https://github.com/mastra-ai/mastra/commit/2656d9c2976d4f3354253bfbbbf9b88a1b2bbf34), [`63e3fe1`](https://github.com/mastra-ai/mastra/commit/63e3fe13cc1ea96f91d7c68aea92f400faf9e4da), [`1d4ce8d`](https://github.com/mastra-ai/mastra/commit/1d4ce8daaa54511f325c1b609d31b8e54009d677), [`8c68372`](https://github.com/mastra-ai/mastra/commit/8c68372e85fe0b066ec12c58bd29ffb93e54c552)]:
85
+ - @mastra/core@1.42.0
86
+
3
87
  ## 1.13.0-alpha.1
4
88
 
5
89
  ### Patch Changes
@@ -3,7 +3,7 @@ name: mastra-pg
3
3
  description: Documentation for @mastra/pg. Use when working with @mastra/pg APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/pg"
6
- version: "1.13.0-alpha.1"
6
+ version: "1.13.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.13.0-alpha.1",
2
+ "version": "1.13.0",
3
3
  "package": "@mastra/pg",
4
4
  "exports": {},
5
5
  "modules": {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/pg",
3
- "version": "1.13.0-alpha.1",
3
+ "version": "1.13.0",
4
4
  "description": "Postgres provider for Mastra - includes both vector and db storage capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -35,10 +35,10 @@
35
35
  "tsx": "^4.22.4",
36
36
  "typescript": "^6.0.3",
37
37
  "vitest": "4.1.5",
38
- "@internal/lint": "0.0.103",
39
- "@internal/storage-test-utils": "0.0.99",
40
- "@internal/types-builder": "0.0.78",
41
- "@mastra/core": "1.42.0-alpha.4"
38
+ "@internal/lint": "0.0.104",
39
+ "@internal/storage-test-utils": "0.0.100",
40
+ "@internal/types-builder": "0.0.79",
41
+ "@mastra/core": "1.42.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@mastra/core": ">=1.34.0-0 <2.0.0-0"