@mastra/pg 1.3.0 → 1.4.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +128 -0
  2. package/dist/docs/SKILL.md +1 -1
  3. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  4. package/dist/index.cjs +2423 -180
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.js +2422 -182
  7. package/dist/index.js.map +1 -1
  8. package/dist/storage/db/index.d.ts +23 -4
  9. package/dist/storage/db/index.d.ts.map +1 -1
  10. package/dist/storage/domains/agents/index.d.ts +5 -0
  11. package/dist/storage/domains/agents/index.d.ts.map +1 -1
  12. package/dist/storage/domains/datasets/index.d.ts +48 -0
  13. package/dist/storage/domains/datasets/index.d.ts.map +1 -0
  14. package/dist/storage/domains/experiments/index.d.ts +34 -0
  15. package/dist/storage/domains/experiments/index.d.ts.map +1 -0
  16. package/dist/storage/domains/mcp-clients/index.d.ts +33 -0
  17. package/dist/storage/domains/mcp-clients/index.d.ts.map +1 -0
  18. package/dist/storage/domains/memory/index.d.ts +10 -0
  19. package/dist/storage/domains/memory/index.d.ts.map +1 -1
  20. package/dist/storage/domains/observability/index.d.ts +10 -0
  21. package/dist/storage/domains/observability/index.d.ts.map +1 -1
  22. package/dist/storage/domains/prompt-blocks/index.d.ts +10 -0
  23. package/dist/storage/domains/prompt-blocks/index.d.ts.map +1 -1
  24. package/dist/storage/domains/scorer-definitions/index.d.ts +10 -0
  25. package/dist/storage/domains/scorer-definitions/index.d.ts.map +1 -1
  26. package/dist/storage/domains/scores/index.d.ts +10 -0
  27. package/dist/storage/domains/scores/index.d.ts.map +1 -1
  28. package/dist/storage/domains/workflows/index.d.ts +5 -0
  29. package/dist/storage/domains/workflows/index.d.ts.map +1 -1
  30. package/dist/storage/index.d.ts +10 -2
  31. package/dist/storage/index.d.ts.map +1 -1
  32. package/dist/storage/test-utils.d.ts.map +1 -1
  33. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,133 @@
1
1
  # @mastra/pg
2
2
 
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added datasets and experiments storage implementations. Includes dataset CRUD, item versioning with SCD-2, experiment runs with scorer results, and table/type configurations for dataset and experiment tables. ([#12747](https://github.com/mastra-ai/mastra/pull/12747))
8
+
9
+ **Requires `@mastra/core` >= 1.4.0**
10
+
11
+ ### Patch Changes
12
+
13
+ - Fixed agent version storage to persist the requestContextSchema field. Previously, requestContextSchema was defined on the agent snapshot type but was not included in the database schema, INSERT statements, or row parsing logic, causing it to be silently dropped when saving and loading agent versions. ([#13003](https://github.com/mastra-ai/mastra/pull/13003))
14
+
15
+ - Fixed observational memory writing non-integer token counts to PostgreSQL, which caused `invalid input syntax for type integer` errors. Token counts are now correctly rounded to integers before all database writes. ([#12976](https://github.com/mastra-ai/mastra/pull/12976))
16
+
17
+ - Added MCP client storage domain and ToolProvider interface for integrating external tool catalogs with stored agents. ([#12974](https://github.com/mastra-ai/mastra/pull/12974))
18
+
19
+ **MCP Client Storage**
20
+
21
+ New storage domain for persisting MCP client configurations with CRUD operations. Each MCP client can contain multiple servers with independent tool selection:
22
+
23
+ ```ts
24
+ // Store an MCP client with multiple servers
25
+ await storage.mcpClients.create({
26
+ id: 'my-mcp',
27
+ name: 'My MCP Client',
28
+ servers: {
29
+ 'github-server': { url: 'https://mcp.github.com/sse' },
30
+ 'slack-server': { url: 'https://mcp.slack.com/sse' },
31
+ },
32
+ });
33
+ ```
34
+
35
+ LibSQL, PostgreSQL, and MongoDB storage adapters all implement the new MCP client domain.
36
+
37
+ **ToolProvider Interface**
38
+
39
+ New `ToolProvider` interface at `@mastra/core/tool-provider` enables third-party tool catalog integration (e.g., Composio, Arcade AI):
40
+
41
+ ```ts
42
+ import type { ToolProvider } from '@mastra/core/tool-provider';
43
+
44
+ # Providers implement: listToolkits(), listTools(), getToolSchema(), resolveTools()
45
+ ```
46
+
47
+ `resolveTools()` receives `requestContext` from the current request, enabling per-user API keys and credentials in multi-tenant setups:
48
+
49
+ ```ts
50
+ const tools = await provider.resolveTools(slugs, configs, {
51
+ requestContext: { apiKey: 'user-specific-key', userId: 'tenant-123' },
52
+ });
53
+ ```
54
+
55
+ **Tool Selection Semantics**
56
+
57
+ Both `mcpClients` and `integrationTools` on stored agents follow consistent three-state selection:
58
+ - `{ tools: undefined }` — provider registered, no tools selected
59
+ - `{ tools: {} }` — all tools from provider included
60
+ - `{ tools: { 'TOOL_SLUG': { description: '...' } } }` — specific tools with optional overrides
61
+
62
+ - Fixed schema exports to include indexes, timestamp triggers, and the observational memory table so exports are complete. ([#12990](https://github.com/mastra-ai/mastra/pull/12990))
63
+
64
+ - Updated dependencies [[`7ef618f`](https://github.com/mastra-ai/mastra/commit/7ef618f3c49c27e2f6b27d7f564c557c0734325b), [`b373564`](https://github.com/mastra-ai/mastra/commit/b37356491d43b4d53067f10cb669abaf2502f218), [`927c2af`](https://github.com/mastra-ai/mastra/commit/927c2af9792286c122e04409efce0f3c804f777f), [`b896b41`](https://github.com/mastra-ai/mastra/commit/b896b41343de7fcc14442fb40fe82d189e65bbe2), [`6415277`](https://github.com/mastra-ai/mastra/commit/6415277a438faa00db2af850ead5dee25f40c428), [`0831bbb`](https://github.com/mastra-ai/mastra/commit/0831bbb5bc750c18e9b22b45f18687c964b70828), [`63f7eda`](https://github.com/mastra-ai/mastra/commit/63f7eda605eb3e0c8c35ee3912ffe7c999c69f69), [`a5b67a3`](https://github.com/mastra-ai/mastra/commit/a5b67a3589a74415feb663a55d1858324a2afde9), [`877b02c`](https://github.com/mastra-ai/mastra/commit/877b02cdbb15e199184c7f2b8f217be8d3ebada7), [`7567222`](https://github.com/mastra-ai/mastra/commit/7567222b1366f0d39980594792dd9d5060bfe2ab), [`af71458`](https://github.com/mastra-ai/mastra/commit/af71458e3b566f09c11d0e5a0a836dc818e7a24a), [`eb36bd8`](https://github.com/mastra-ai/mastra/commit/eb36bd8c52fcd6ec9674ac3b7a6412405b5983e1), [`3cbf121`](https://github.com/mastra-ai/mastra/commit/3cbf121f55418141924754a83102aade89835947)]:
65
+ - @mastra/core@1.4.0
66
+
67
+ ## 1.4.0-alpha.0
68
+
69
+ ### Minor Changes
70
+
71
+ - Added datasets and experiments storage implementations. Includes dataset CRUD, item versioning with SCD-2, experiment runs with scorer results, and table/type configurations for dataset and experiment tables. ([#12747](https://github.com/mastra-ai/mastra/pull/12747))
72
+
73
+ **Requires `@mastra/core` >= 1.4.0**
74
+
75
+ ### Patch Changes
76
+
77
+ - Fixed agent version storage to persist the requestContextSchema field. Previously, requestContextSchema was defined on the agent snapshot type but was not included in the database schema, INSERT statements, or row parsing logic, causing it to be silently dropped when saving and loading agent versions. ([#13003](https://github.com/mastra-ai/mastra/pull/13003))
78
+
79
+ - Fixed observational memory writing non-integer token counts to PostgreSQL, which caused `invalid input syntax for type integer` errors. Token counts are now correctly rounded to integers before all database writes. ([#12976](https://github.com/mastra-ai/mastra/pull/12976))
80
+
81
+ - Added MCP client storage domain and ToolProvider interface for integrating external tool catalogs with stored agents. ([#12974](https://github.com/mastra-ai/mastra/pull/12974))
82
+
83
+ **MCP Client Storage**
84
+
85
+ New storage domain for persisting MCP client configurations with CRUD operations. Each MCP client can contain multiple servers with independent tool selection:
86
+
87
+ ```ts
88
+ // Store an MCP client with multiple servers
89
+ await storage.mcpClients.create({
90
+ id: 'my-mcp',
91
+ name: 'My MCP Client',
92
+ servers: {
93
+ 'github-server': { url: 'https://mcp.github.com/sse' },
94
+ 'slack-server': { url: 'https://mcp.slack.com/sse' },
95
+ },
96
+ });
97
+ ```
98
+
99
+ LibSQL, PostgreSQL, and MongoDB storage adapters all implement the new MCP client domain.
100
+
101
+ **ToolProvider Interface**
102
+
103
+ New `ToolProvider` interface at `@mastra/core/tool-provider` enables third-party tool catalog integration (e.g., Composio, Arcade AI):
104
+
105
+ ```ts
106
+ import type { ToolProvider } from '@mastra/core/tool-provider';
107
+
108
+ # Providers implement: listToolkits(), listTools(), getToolSchema(), resolveTools()
109
+ ```
110
+
111
+ `resolveTools()` receives `requestContext` from the current request, enabling per-user API keys and credentials in multi-tenant setups:
112
+
113
+ ```ts
114
+ const tools = await provider.resolveTools(slugs, configs, {
115
+ requestContext: { apiKey: 'user-specific-key', userId: 'tenant-123' },
116
+ });
117
+ ```
118
+
119
+ **Tool Selection Semantics**
120
+
121
+ Both `mcpClients` and `integrationTools` on stored agents follow consistent three-state selection:
122
+ - `{ tools: undefined }` — provider registered, no tools selected
123
+ - `{ tools: {} }` — all tools from provider included
124
+ - `{ tools: { 'TOOL_SLUG': { description: '...' } } }` — specific tools with optional overrides
125
+
126
+ - Fixed schema exports to include indexes, timestamp triggers, and the observational memory table so exports are complete. ([#12990](https://github.com/mastra-ai/mastra/pull/12990))
127
+
128
+ - Updated dependencies [[`7ef618f`](https://github.com/mastra-ai/mastra/commit/7ef618f3c49c27e2f6b27d7f564c557c0734325b), [`b373564`](https://github.com/mastra-ai/mastra/commit/b37356491d43b4d53067f10cb669abaf2502f218), [`927c2af`](https://github.com/mastra-ai/mastra/commit/927c2af9792286c122e04409efce0f3c804f777f), [`b896b41`](https://github.com/mastra-ai/mastra/commit/b896b41343de7fcc14442fb40fe82d189e65bbe2), [`6415277`](https://github.com/mastra-ai/mastra/commit/6415277a438faa00db2af850ead5dee25f40c428), [`0831bbb`](https://github.com/mastra-ai/mastra/commit/0831bbb5bc750c18e9b22b45f18687c964b70828), [`63f7eda`](https://github.com/mastra-ai/mastra/commit/63f7eda605eb3e0c8c35ee3912ffe7c999c69f69), [`a5b67a3`](https://github.com/mastra-ai/mastra/commit/a5b67a3589a74415feb663a55d1858324a2afde9), [`877b02c`](https://github.com/mastra-ai/mastra/commit/877b02cdbb15e199184c7f2b8f217be8d3ebada7), [`7567222`](https://github.com/mastra-ai/mastra/commit/7567222b1366f0d39980594792dd9d5060bfe2ab), [`af71458`](https://github.com/mastra-ai/mastra/commit/af71458e3b566f09c11d0e5a0a836dc818e7a24a), [`eb36bd8`](https://github.com/mastra-ai/mastra/commit/eb36bd8c52fcd6ec9674ac3b7a6412405b5983e1), [`3cbf121`](https://github.com/mastra-ai/mastra/commit/3cbf121f55418141924754a83102aade89835947)]:
129
+ - @mastra/core@1.4.0-alpha.0
130
+
3
131
  ## 1.3.0
4
132
 
5
133
  ### Minor 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.3.0"
6
+ version: "1.4.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.0",
2
+ "version": "1.4.0",
3
3
  "package": "@mastra/pg",
4
4
  "exports": {},
5
5
  "modules": {}