@mastra/clickhouse 1.1.0 → 1.1.1

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,71 @@
1
1
  # @mastra/clickhouse
2
2
 
3
+ ## 1.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Added prompt block storage implementations. Each store supports full CRUD for prompt blocks and their versions, including JSON serialization for rules and metadata. Also updated agent instructions serialization to support the new `AgentInstructionBlock` array format alongside plain strings. ([#12776](https://github.com/mastra-ai/mastra/pull/12776))
8
+
9
+ - **Updated storage adapters for generic storage domain API** ([#12846](https://github.com/mastra-ai/mastra/pull/12846))
10
+
11
+ All storage adapters now implement the unified `VersionedStorageDomain` method names. Entity-specific methods (`createAgent`, `getAgentById`, `deleteAgent`, etc.) have been replaced with generic equivalents (`create`, `getById`, `delete`, etc.) across agents, prompt blocks, and scorer definitions domains.
12
+
13
+ Added `scorer-definitions` domain support to all adapters.
14
+
15
+ **Before:**
16
+
17
+ ```ts
18
+ const store = storage.getStore('agents');
19
+ await store.createAgent({ agent: input });
20
+ await store.getAgentById({ id: 'abc' });
21
+ await store.deleteAgent({ id: 'abc' });
22
+ ```
23
+
24
+ **After:**
25
+
26
+ ```ts
27
+ const store = storage.getStore('agents');
28
+ await store.create({ agent: input });
29
+ await store.getById('abc');
30
+ await store.delete('abc');
31
+ ```
32
+
33
+ - Updated dependencies [[`717ffab`](https://github.com/mastra-ai/mastra/commit/717ffab42cfd58ff723b5c19ada4939997773004), [`b31c922`](https://github.com/mastra-ai/mastra/commit/b31c922215b513791d98feaea1b98784aa00803a), [`e4b6dab`](https://github.com/mastra-ai/mastra/commit/e4b6dab171c5960e340b3ea3ea6da8d64d2b8672), [`5719fa8`](https://github.com/mastra-ai/mastra/commit/5719fa8880e86e8affe698ec4b3807c7e0e0a06f), [`83cda45`](https://github.com/mastra-ai/mastra/commit/83cda4523e588558466892bff8f80f631a36945a), [`11804ad`](https://github.com/mastra-ai/mastra/commit/11804adf1d6be46ebe216be40a43b39bb8b397d7), [`aa95f95`](https://github.com/mastra-ai/mastra/commit/aa95f958b186ae5c9f4219c88e268f5565c277a2), [`90f7894`](https://github.com/mastra-ai/mastra/commit/90f7894568dc9481f40a4d29672234fae23090bb), [`f5501ae`](https://github.com/mastra-ai/mastra/commit/f5501aedb0a11106c7db7e480d6eaf3971b7bda8), [`44573af`](https://github.com/mastra-ai/mastra/commit/44573afad0a4bc86f627d6cbc0207961cdcb3bc3), [`00e3861`](https://github.com/mastra-ai/mastra/commit/00e3861863fbfee78faeb1ebbdc7c0223aae13ff), [`8109aee`](https://github.com/mastra-ai/mastra/commit/8109aeeab758e16cd4255a6c36f044b70eefc6a6), [`7bfbc52`](https://github.com/mastra-ai/mastra/commit/7bfbc52a8604feb0fff2c0a082c13c0c2a3df1a2), [`1445994`](https://github.com/mastra-ai/mastra/commit/1445994aee19c9334a6a101cf7bd80ca7ed4d186), [`61f44a2`](https://github.com/mastra-ai/mastra/commit/61f44a26861c89e364f367ff40825bdb7f19df55), [`37145d2`](https://github.com/mastra-ai/mastra/commit/37145d25f99dc31f1a9105576e5452609843ce32), [`fdad759`](https://github.com/mastra-ai/mastra/commit/fdad75939ff008b27625f5ec0ce9c6915d99d9ec), [`e4569c5`](https://github.com/mastra-ai/mastra/commit/e4569c589e00c4061a686c9eb85afe1b7050b0a8), [`7309a85`](https://github.com/mastra-ai/mastra/commit/7309a85427281a8be23f4fb80ca52e18eaffd596), [`99424f6`](https://github.com/mastra-ai/mastra/commit/99424f6862ffb679c4ec6765501486034754a4c2), [`44eb452`](https://github.com/mastra-ai/mastra/commit/44eb4529b10603c279688318bebf3048543a1d61), [`6c40593`](https://github.com/mastra-ai/mastra/commit/6c40593d6d2b1b68b0c45d1a3a4c6ac5ecac3937), [`8c1135d`](https://github.com/mastra-ai/mastra/commit/8c1135dfb91b057283eae7ee11f9ec28753cc64f), [`dd39e54`](https://github.com/mastra-ai/mastra/commit/dd39e54ea34532c995b33bee6e0e808bf41a7341), [`b6fad9a`](https://github.com/mastra-ai/mastra/commit/b6fad9a602182b1cc0df47cd8c55004fa829ad61), [`4129c07`](https://github.com/mastra-ai/mastra/commit/4129c073349b5a66643fd8136ebfe9d7097cf793), [`5b930ab`](https://github.com/mastra-ai/mastra/commit/5b930aba1834d9898e8460a49d15106f31ac7c8d), [`4be93d0`](https://github.com/mastra-ai/mastra/commit/4be93d09d68e20aaf0ea3f210749422719618b5f), [`047635c`](https://github.com/mastra-ai/mastra/commit/047635ccd7861d726c62d135560c0022a5490aec), [`8c90ff4`](https://github.com/mastra-ai/mastra/commit/8c90ff4d3414e7f2a2d216ea91274644f7b29133), [`ed232d1`](https://github.com/mastra-ai/mastra/commit/ed232d1583f403925dc5ae45f7bee948cf2a182b), [`3891795`](https://github.com/mastra-ai/mastra/commit/38917953518eb4154a984ee36e6ededdcfe80f72), [`4f955b2`](https://github.com/mastra-ai/mastra/commit/4f955b20c7f66ed282ee1fd8709696fa64c4f19d), [`55a4c90`](https://github.com/mastra-ai/mastra/commit/55a4c9044ac7454349b9f6aeba0bbab5ee65d10f)]:
34
+ - @mastra/core@1.3.0
35
+
36
+ ## 1.1.1-alpha.0
37
+
38
+ ### Patch Changes
39
+
40
+ - Added prompt block storage implementations. Each store supports full CRUD for prompt blocks and their versions, including JSON serialization for rules and metadata. Also updated agent instructions serialization to support the new `AgentInstructionBlock` array format alongside plain strings. ([#12776](https://github.com/mastra-ai/mastra/pull/12776))
41
+
42
+ - **Updated storage adapters for generic storage domain API** ([#12846](https://github.com/mastra-ai/mastra/pull/12846))
43
+
44
+ All storage adapters now implement the unified `VersionedStorageDomain` method names. Entity-specific methods (`createAgent`, `getAgentById`, `deleteAgent`, etc.) have been replaced with generic equivalents (`create`, `getById`, `delete`, etc.) across agents, prompt blocks, and scorer definitions domains.
45
+
46
+ Added `scorer-definitions` domain support to all adapters.
47
+
48
+ **Before:**
49
+
50
+ ```ts
51
+ const store = storage.getStore('agents');
52
+ await store.createAgent({ agent: input });
53
+ await store.getAgentById({ id: 'abc' });
54
+ await store.deleteAgent({ id: 'abc' });
55
+ ```
56
+
57
+ **After:**
58
+
59
+ ```ts
60
+ const store = storage.getStore('agents');
61
+ await store.create({ agent: input });
62
+ await store.getById('abc');
63
+ await store.delete('abc');
64
+ ```
65
+
66
+ - Updated dependencies [[`717ffab`](https://github.com/mastra-ai/mastra/commit/717ffab42cfd58ff723b5c19ada4939997773004), [`e4b6dab`](https://github.com/mastra-ai/mastra/commit/e4b6dab171c5960e340b3ea3ea6da8d64d2b8672), [`5719fa8`](https://github.com/mastra-ai/mastra/commit/5719fa8880e86e8affe698ec4b3807c7e0e0a06f), [`83cda45`](https://github.com/mastra-ai/mastra/commit/83cda4523e588558466892bff8f80f631a36945a), [`11804ad`](https://github.com/mastra-ai/mastra/commit/11804adf1d6be46ebe216be40a43b39bb8b397d7), [`aa95f95`](https://github.com/mastra-ai/mastra/commit/aa95f958b186ae5c9f4219c88e268f5565c277a2), [`f5501ae`](https://github.com/mastra-ai/mastra/commit/f5501aedb0a11106c7db7e480d6eaf3971b7bda8), [`44573af`](https://github.com/mastra-ai/mastra/commit/44573afad0a4bc86f627d6cbc0207961cdcb3bc3), [`00e3861`](https://github.com/mastra-ai/mastra/commit/00e3861863fbfee78faeb1ebbdc7c0223aae13ff), [`7bfbc52`](https://github.com/mastra-ai/mastra/commit/7bfbc52a8604feb0fff2c0a082c13c0c2a3df1a2), [`1445994`](https://github.com/mastra-ai/mastra/commit/1445994aee19c9334a6a101cf7bd80ca7ed4d186), [`61f44a2`](https://github.com/mastra-ai/mastra/commit/61f44a26861c89e364f367ff40825bdb7f19df55), [`37145d2`](https://github.com/mastra-ai/mastra/commit/37145d25f99dc31f1a9105576e5452609843ce32), [`fdad759`](https://github.com/mastra-ai/mastra/commit/fdad75939ff008b27625f5ec0ce9c6915d99d9ec), [`e4569c5`](https://github.com/mastra-ai/mastra/commit/e4569c589e00c4061a686c9eb85afe1b7050b0a8), [`7309a85`](https://github.com/mastra-ai/mastra/commit/7309a85427281a8be23f4fb80ca52e18eaffd596), [`99424f6`](https://github.com/mastra-ai/mastra/commit/99424f6862ffb679c4ec6765501486034754a4c2), [`44eb452`](https://github.com/mastra-ai/mastra/commit/44eb4529b10603c279688318bebf3048543a1d61), [`6c40593`](https://github.com/mastra-ai/mastra/commit/6c40593d6d2b1b68b0c45d1a3a4c6ac5ecac3937), [`8c1135d`](https://github.com/mastra-ai/mastra/commit/8c1135dfb91b057283eae7ee11f9ec28753cc64f), [`dd39e54`](https://github.com/mastra-ai/mastra/commit/dd39e54ea34532c995b33bee6e0e808bf41a7341), [`b6fad9a`](https://github.com/mastra-ai/mastra/commit/b6fad9a602182b1cc0df47cd8c55004fa829ad61), [`4129c07`](https://github.com/mastra-ai/mastra/commit/4129c073349b5a66643fd8136ebfe9d7097cf793), [`5b930ab`](https://github.com/mastra-ai/mastra/commit/5b930aba1834d9898e8460a49d15106f31ac7c8d), [`4be93d0`](https://github.com/mastra-ai/mastra/commit/4be93d09d68e20aaf0ea3f210749422719618b5f), [`047635c`](https://github.com/mastra-ai/mastra/commit/047635ccd7861d726c62d135560c0022a5490aec), [`8c90ff4`](https://github.com/mastra-ai/mastra/commit/8c90ff4d3414e7f2a2d216ea91274644f7b29133), [`ed232d1`](https://github.com/mastra-ai/mastra/commit/ed232d1583f403925dc5ae45f7bee948cf2a182b), [`3891795`](https://github.com/mastra-ai/mastra/commit/38917953518eb4154a984ee36e6ededdcfe80f72), [`4f955b2`](https://github.com/mastra-ai/mastra/commit/4f955b20c7f66ed282ee1fd8709696fa64c4f19d), [`55a4c90`](https://github.com/mastra-ai/mastra/commit/55a4c9044ac7454349b9f6aeba0bbab5ee65d10f)]:
67
+ - @mastra/core@1.3.0-alpha.1
68
+
3
69
  ## 1.1.0
4
70
 
5
71
  ### Minor Changes
@@ -1,32 +1,22 @@
1
1
  ---
2
- name: mastra-clickhouse-docs
3
- description: Documentation for @mastra/clickhouse. Includes links to type definitions and readable implementation code in dist/.
2
+ name: mastra-clickhouse
3
+ description: Documentation for @mastra/clickhouse. Use when working with @mastra/clickhouse APIs, configuration, or implementation.
4
+ metadata:
5
+ package: "@mastra/clickhouse"
6
+ version: "1.1.1"
4
7
  ---
5
8
 
6
- # @mastra/clickhouse Documentation
9
+ ## When to use
7
10
 
8
- > **Version**: 1.1.0
9
- > **Package**: @mastra/clickhouse
11
+ Use this skill whenever you are working with @mastra/clickhouse to obtain the domain-specific knowledge.
10
12
 
11
- ## Quick Navigation
13
+ ## How to use
12
14
 
13
- Use SOURCE_MAP.json to find any export:
15
+ Read the individual reference documents for detailed explanations and code examples.
14
16
 
15
- ```bash
16
- cat docs/SOURCE_MAP.json
17
- ```
17
+ ### Reference
18
18
 
19
- Each export maps to:
20
- - **types**: `.d.ts` file with JSDoc and API signatures
21
- - **implementation**: `.js` chunk file with readable source
22
- - **docs**: Conceptual documentation in `docs/`
19
+ - [Reference: Composite Storage](references/reference-storage-composite.md) - Documentation for combining multiple storage backends in Mastra.
23
20
 
24
- ## Top Exports
25
21
 
26
-
27
-
28
- See SOURCE_MAP.json for the complete list.
29
-
30
- ## Available Topics
31
-
32
- - [Storage](storage/) - 1 file(s)
22
+ Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.0",
2
+ "version": "1.1.1",
3
3
  "package": "@mastra/clickhouse",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -1,41 +1,72 @@
1
- # Storage API Reference
1
+ # Composite Storage
2
2
 
3
- > API reference for storage - 1 entries
3
+ `MastraCompositeStore` can compose storage domains from different providers. Use it when you need different databases for different purposes. For example, use LibSQL for memory and PostgreSQL for workflows.
4
4
 
5
+ ## Installation
5
6
 
6
- ---
7
+ `MastraCompositeStore` is included in `@mastra/core`:
7
8
 
8
- ## Reference: Composite Storage
9
+ **npm**:
9
10
 
10
- > Documentation for combining multiple storage backends in Mastra.
11
+ ```bash
12
+ npm install @mastra/core@latest
13
+ ```
11
14
 
12
- `MastraCompositeStore` can compose storage domains from different providers. Use it when you need different databases for different purposes. For example, use LibSQL for memory and PostgreSQL for workflows.
15
+ **pnpm**:
13
16
 
14
- ## Installation
17
+ ```bash
18
+ pnpm add @mastra/core@latest
19
+ ```
15
20
 
16
- `MastraCompositeStore` is included in `@mastra/core`:
21
+ **Yarn**:
17
22
 
18
- ```bash npm2yarn
19
- npm install @mastra/core@latest
23
+ ```bash
24
+ yarn add @mastra/core@latest
25
+ ```
26
+
27
+ **Bun**:
28
+
29
+ ```bash
30
+ bun add @mastra/core@latest
20
31
  ```
21
32
 
22
33
  You'll also need to install the storage providers you want to compose:
23
34
 
24
- ```bash npm2yarn
35
+ **npm**:
36
+
37
+ ```bash
25
38
  npm install @mastra/pg@latest @mastra/libsql@latest
26
39
  ```
27
40
 
41
+ **pnpm**:
42
+
43
+ ```bash
44
+ pnpm add @mastra/pg@latest @mastra/libsql@latest
45
+ ```
46
+
47
+ **Yarn**:
48
+
49
+ ```bash
50
+ yarn add @mastra/pg@latest @mastra/libsql@latest
51
+ ```
52
+
53
+ **Bun**:
54
+
55
+ ```bash
56
+ bun add @mastra/pg@latest @mastra/libsql@latest
57
+ ```
58
+
28
59
  ## Storage domains
29
60
 
30
61
  Mastra organizes storage into five specialized domains, each handling a specific type of data. Each domain can be backed by a different storage adapter, and domain classes are exported from each storage package.
31
62
 
32
- | Domain | Description |
33
- |--------|-------------|
34
- | `memory` | Conversation persistence for agents. Stores threads (conversation sessions), messages, resources (user identities), and working memory (persistent context across conversations). |
35
- | `workflows` | Workflow execution state. When workflows suspend for human input, external events, or scheduled resumption, their state is persisted here to enable resumption after server restarts. |
36
- | `scores` | Evaluation results from Mastra's evals system. Scores and metrics are persisted here for analysis and comparison over time. |
37
- | `observability` | Telemetry data including traces and spans. Agent interactions, tool calls, and LLM requests generate spans collected into traces for debugging and performance analysis. |
38
- | `agents` | Agent configurations for stored agents. Enables agents to be defined and updated at runtime without code deployments. |
63
+ | Domain | Description |
64
+ | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
65
+ | `memory` | Conversation persistence for agents. Stores threads (conversation sessions), messages, resources (user identities), and working memory (persistent context across conversations). |
66
+ | `workflows` | Workflow execution state. When workflows suspend for human input, external events, or scheduled resumption, their state is persisted here to enable resumption after server restarts. |
67
+ | `scores` | Evaluation results from Mastra's evals system. Scores and metrics are persisted here for analysis and comparison over time. |
68
+ | `observability` | Telemetry data including traces and spans. Agent interactions, tool calls, and LLM requests generate spans collected into traces for debugging and performance analysis. |
69
+ | `agents` | Agent configurations for stored agents. Enables agents to be defined and updated at runtime without code deployments. |
39
70
 
40
71
  ## Usage
41
72
 
@@ -43,7 +74,7 @@ Mastra organizes storage into five specialized domains, each handling a specific
43
74
 
44
75
  Import domain classes directly from each store package and compose them:
45
76
 
46
- ```typescript title="src/mastra/index.ts"
77
+ ```typescript
47
78
  import { MastraCompositeStore } from "@mastra/core/storage";
48
79
  import { WorkflowsPG, ScoresPG } from "@mastra/pg";
49
80
  import { MemoryLibSQL } from "@mastra/libsql";
@@ -65,7 +96,7 @@ export const mastra = new Mastra({
65
96
 
66
97
  Use `default` to specify a fallback storage, then override specific domains:
67
98
 
68
- ```typescript title="src/mastra/index.ts"
99
+ ```typescript
69
100
  import { MastraCompositeStore } from "@mastra/core/storage";
70
101
  import { PostgresStore } from "@mastra/pg";
71
102
  import { MemoryLibSQL } from "@mastra/libsql";
@@ -89,11 +120,29 @@ export const mastra = new Mastra({
89
120
 
90
121
  ## Options
91
122
 
123
+ **id:** (`string`): Unique identifier for this storage instance.
124
+
125
+ **default?:** (`MastraCompositeStore`): Default storage adapter. Domains not explicitly specified in \`domains\` will use this storage's domains as fallbacks.
126
+
127
+ **domains?:** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over the default storage.
128
+
129
+ **domains.memory?:** (`MemoryStorage`): Storage for threads, messages, and resources.
130
+
131
+ **domains.workflows?:** (`WorkflowsStorage`): Storage for workflow snapshots.
132
+
133
+ **domains.scores?:** (`ScoresStorage`): Storage for evaluation scores.
134
+
135
+ **domains.observability?:** (`ObservabilityStorage`): Storage for traces and spans.
136
+
137
+ **domains.agents?:** (`AgentsStorage`): Storage for stored agent configurations.
138
+
139
+ **disableInit?:** (`boolean`): When true, automatic initialization is disabled. You must call init() explicitly.
140
+
92
141
  ## Initialization
93
142
 
94
143
  `MastraCompositeStore` initializes each configured domain independently. When passed to the Mastra class, `init()` is called automatically:
95
144
 
96
- ```typescript title="src/mastra/index.ts"
145
+ ```typescript
97
146
  import { MastraCompositeStore } from "@mastra/core/storage";
98
147
  import { MemoryPG, WorkflowsPG, ScoresPG } from "@mastra/pg";
99
148
  import { Mastra } from "@mastra/core";
@@ -183,6 +232,4 @@ const storage = new MastraCompositeStore({
183
232
  });
184
233
  ```
185
234
 
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.
235
+ > **Info:** 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) for the full list of supported providers.
package/dist/index.cjs CHANGED
@@ -20,7 +20,11 @@ var TABLE_ENGINES = {
20
20
  // this provides eventual uniqueness for the (traceId, spanId) composite key.
21
21
  [storage.TABLE_SPANS]: `ReplacingMergeTree(updatedAt)`,
22
22
  mastra_agents: `ReplacingMergeTree()`,
23
- [storage.TABLE_AGENT_VERSIONS]: `MergeTree()`
23
+ [storage.TABLE_AGENT_VERSIONS]: `MergeTree()`,
24
+ [storage.TABLE_PROMPT_BLOCKS]: `ReplacingMergeTree()`,
25
+ [storage.TABLE_PROMPT_BLOCK_VERSIONS]: `MergeTree()`,
26
+ [storage.TABLE_SCORER_DEFINITIONS]: `ReplacingMergeTree()`,
27
+ [storage.TABLE_SCORER_DEFINITION_VERSIONS]: `MergeTree()`
24
28
  };
25
29
  var COLUMN_TYPES = {
26
30
  text: "String",