@mastra/clickhouse 1.0.0 → 1.1.0-alpha.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,82 @@
1
1
  # @mastra/clickhouse
2
2
 
3
+ ## 1.1.0-alpha.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added dynamic agent management with CRUD operations and version tracking ([#12038](https://github.com/mastra-ai/mastra/pull/12038))
8
+
9
+ **New Features:**
10
+ - Create, edit, and delete agents directly from the Mastra Studio UI
11
+ - Full version history for agents with compare and restore capabilities
12
+ - Visual diff viewer to compare agent configurations across versions
13
+ - Agent creation modal with comprehensive configuration options (model selection, instructions, tools, workflows, sub-agents, memory)
14
+ - AI-powered instruction enhancement
15
+
16
+ **Storage:**
17
+ - New storage interfaces for stored agents and agent versions
18
+ - PostgreSQL, LibSQL, and MongoDB implementations included
19
+ - In-memory storage for development and testing
20
+
21
+ **API:**
22
+ - RESTful endpoints for agent CRUD operations
23
+ - Version management endpoints (create, list, activate, restore, delete, compare)
24
+ - Automatic versioning on agent updates when enabled
25
+
26
+ **Client SDK:**
27
+ - JavaScript client with full support for stored agents and versions
28
+ - Type-safe methods for all CRUD and version operations
29
+
30
+ **Usage Example:**
31
+
32
+ ```typescript
33
+ // Server-side: Configure storage
34
+ import { Mastra } from '@mastra/core';
35
+ import { PgAgentsStorage } from '@mastra/pg';
36
+
37
+ const mastra = new Mastra({
38
+ agents: { agentOne },
39
+ storage: {
40
+ agents: new PgAgentsStorage({
41
+ connectionString: process.env.DATABASE_URL,
42
+ }),
43
+ },
44
+ });
45
+
46
+ // Client-side: Use the SDK
47
+ import { MastraClient } from '@mastra/client-js';
48
+
49
+ const client = new MastraClient({ baseUrl: 'http://localhost:3000' });
50
+
51
+ // Create a stored agent
52
+ const agent = await client.createStoredAgent({
53
+ name: 'Customer Support Agent',
54
+ description: 'Handles customer inquiries',
55
+ model: { provider: 'ANTHROPIC', name: 'claude-sonnet-4-5' },
56
+ instructions: 'You are a helpful customer support agent...',
57
+ tools: ['search', 'email'],
58
+ });
59
+
60
+ // Create a version snapshot
61
+ await client.storedAgent(agent.id).createVersion({
62
+ name: 'v1.0 - Initial release',
63
+ changeMessage: 'First production version',
64
+ });
65
+
66
+ // Compare versions
67
+ const diff = await client.storedAgent(agent.id).compareVersions('version-1', 'version-2');
68
+ ```
69
+
70
+ **Why:**
71
+ This feature enables teams to manage agents dynamically without code changes, making it easier to iterate on agent configurations and maintain a complete audit trail of changes.
72
+
73
+ - Added `status` field to `listTraces` response. The status field indicates the trace state: `success` (completed without error), `error` (has error), or `running` (still in progress). This makes it easier to filter and display traces by their current state without having to derive it from the `error` and `endedAt` fields. ([#12213](https://github.com/mastra-ai/mastra/pull/12213))
74
+
75
+ ### Patch Changes
76
+
77
+ - Updated dependencies [[`90fc0e5`](https://github.com/mastra-ai/mastra/commit/90fc0e5717cb280c2d4acf4f0410b510bb4c0a72), [`1cf5d2e`](https://github.com/mastra-ai/mastra/commit/1cf5d2ea1b085be23e34fb506c80c80a4e6d9c2b), [`833ae96`](https://github.com/mastra-ai/mastra/commit/833ae96c3e34370e58a1e979571c41f39a720592), [`943772b`](https://github.com/mastra-ai/mastra/commit/943772b4378f625f0f4e19ea2b7c392bd8e71786), [`b5c711b`](https://github.com/mastra-ai/mastra/commit/b5c711b281dd1fb81a399a766bc9f86c55efc13e), [`3efbe5a`](https://github.com/mastra-ai/mastra/commit/3efbe5ae20864c4f3143457f4f3ee7dc2fa5ca76), [`1e49e7a`](https://github.com/mastra-ai/mastra/commit/1e49e7ab5f173582154cb26b29d424de67d09aef), [`751eaab`](https://github.com/mastra-ai/mastra/commit/751eaab4e0d3820a94e4c3d39a2ff2663ded3d91), [`69d8156`](https://github.com/mastra-ai/mastra/commit/69d81568bcf062557c24471ce26812446bec465d), [`60d9d89`](https://github.com/mastra-ai/mastra/commit/60d9d899e44b35bc43f1bcd967a74e0ce010b1af), [`5c544c8`](https://github.com/mastra-ai/mastra/commit/5c544c8d12b08ab40d64d8f37b3c4215bee95b87), [`771ad96`](https://github.com/mastra-ai/mastra/commit/771ad962441996b5c43549391a3e6a02c6ddedc2), [`2b0936b`](https://github.com/mastra-ai/mastra/commit/2b0936b0c9a43eeed9bef63e614d7e02ee803f7e), [`3b04f30`](https://github.com/mastra-ai/mastra/commit/3b04f3010604f3cdfc8a0674731700ad66471cee), [`97e26de`](https://github.com/mastra-ai/mastra/commit/97e26deaebd9836647a67b96423281d66421ca07), [`10523f4`](https://github.com/mastra-ai/mastra/commit/10523f4882d9b874b40ce6e3715f66dbcd4947d2), [`cb72d20`](https://github.com/mastra-ai/mastra/commit/cb72d2069d7339bda8a0e76d4f35615debb07b84), [`42856b1`](https://github.com/mastra-ai/mastra/commit/42856b1c8aeea6371c9ee77ae2f5f5fe34400933), [`66f33ff`](https://github.com/mastra-ai/mastra/commit/66f33ff68620018513e499c394411d1d39b3aa5c), [`ab3c190`](https://github.com/mastra-ai/mastra/commit/ab3c1901980a99910ca9b96a7090c22e24060113), [`d4f06c8`](https://github.com/mastra-ai/mastra/commit/d4f06c85ffa5bb0da38fb82ebf3b040cc6b4ec4e), [`0350626`](https://github.com/mastra-ai/mastra/commit/03506267ec41b67add80d994c0c0fcce93bbc75f), [`bc9fa00`](https://github.com/mastra-ai/mastra/commit/bc9fa00859c5c4a796d53a0a5cae46ab4a3072e4), [`f46a478`](https://github.com/mastra-ai/mastra/commit/f46a4782f595949c696569e891f81c8d26338508), [`90fc0e5`](https://github.com/mastra-ai/mastra/commit/90fc0e5717cb280c2d4acf4f0410b510bb4c0a72), [`f05a3a5`](https://github.com/mastra-ai/mastra/commit/f05a3a5cf2b9a9c2d40c09cb8c762a4b6cd5d565), [`a291da9`](https://github.com/mastra-ai/mastra/commit/a291da9363efd92dafd8775dccb4f2d0511ece7a), [`c5d71da`](https://github.com/mastra-ai/mastra/commit/c5d71da1c680ce5640b1a7f8ca0e024a4ab1cfed), [`07042f9`](https://github.com/mastra-ai/mastra/commit/07042f9f89080f38b8f72713ba1c972d5b1905b8), [`0423442`](https://github.com/mastra-ai/mastra/commit/0423442b7be2dfacba95890bea8f4a810db4d603)]:
78
+ - @mastra/core@1.1.0-alpha.0
79
+
3
80
  ## 1.0.0
4
81
 
5
82
  ### Major Changes
@@ -28,4 +28,4 @@ docs/
28
28
  ## Version
29
29
 
30
30
  Package: @mastra/clickhouse
31
- Version: 1.0.0
31
+ Version: 1.1.0-alpha.0
@@ -5,7 +5,7 @@ description: Documentation for @mastra/clickhouse. Includes links to type defini
5
5
 
6
6
  # @mastra/clickhouse Documentation
7
7
 
8
- > **Version**: 1.0.0
8
+ > **Version**: 1.1.0-alpha.0
9
9
  > **Package**: @mastra/clickhouse
10
10
 
11
11
  ## Quick Navigation
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.0",
2
+ "version": "1.1.0-alpha.0",
3
3
  "package": "@mastra/clickhouse",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -15,14 +15,14 @@
15
15
 
16
16
  `MastraCompositeStore` is included in `@mastra/core`:
17
17
 
18
- ```bash
19
- npm install @mastra/core@beta
18
+ ```bash npm2yarn
19
+ npm install @mastra/core@latest
20
20
  ```
21
21
 
22
22
  You'll also need to install the storage providers you want to compose:
23
23
 
24
- ```bash
25
- npm install @mastra/pg@beta @mastra/libsql@beta
24
+ ```bash npm2yarn
25
+ npm install @mastra/pg@latest @mastra/libsql@latest
26
26
  ```
27
27
 
28
28
  ## Storage domains
@@ -159,7 +159,9 @@ const storage = new MastraCompositeStore({
159
159
 
160
160
  ### Specialized storage for observability
161
161
 
162
- Use a time-series database for traces while keeping other data in PostgreSQL:
162
+ 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.
163
+
164
+ **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:
163
165
 
164
166
  ```typescript
165
167
  import { MastraCompositeStore } from "@mastra/core/storage";
@@ -179,4 +181,8 @@ const storage = new MastraCompositeStore({
179
181
  }),
180
182
  },
181
183
  });
182
- ```
184
+ ```
185
+
186
+ > **Note:**
187
+
188
+ This approach is also required when using storage providers that don't support observability (like Convex, DynamoDB, or Cloudflare). See the [DefaultExporter documentation](https://mastra.ai/docs/observability/tracing/exporters/default#storage-provider-support) for the full list of supported providers.
package/dist/index.cjs CHANGED
@@ -19,7 +19,8 @@ var TABLE_ENGINES = {
19
19
  // keeping the row with the highest updatedAt value. Combined with ORDER BY (traceId, spanId),
20
20
  // this provides eventual uniqueness for the (traceId, spanId) composite key.
21
21
  [storage.TABLE_SPANS]: `ReplacingMergeTree(updatedAt)`,
22
- mastra_agents: `ReplacingMergeTree()`
22
+ mastra_agents: `ReplacingMergeTree()`,
23
+ [storage.TABLE_AGENT_VERSIONS]: `MergeTree()`
23
24
  };
24
25
  var COLUMN_TYPES = {
25
26
  text: "String",
@@ -2354,7 +2355,10 @@ time for large tables. Please ensure you have a backup before proceeding.
2354
2355
  }
2355
2356
  });
2356
2357
  const rows = await result.json();
2357
- const spans = transformRows(rows);
2358
+ const spans = transformRows(rows).map((span) => ({
2359
+ ...span,
2360
+ error: span.error === "" ? null : span.error
2361
+ }));
2358
2362
  return {
2359
2363
  pagination: {
2360
2364
  total,
@@ -2362,7 +2366,7 @@ time for large tables. Please ensure you have a backup before proceeding.
2362
2366
  perPage,
2363
2367
  hasMore: (page + 1) * perPage < total
2364
2368
  },
2365
- spans
2369
+ spans: storage.toTraceSpans(spans)
2366
2370
  };
2367
2371
  } catch (error$1) {
2368
2372
  if (error$1 instanceof error.MastraError) throw error$1;