@mastra/clickhouse 0.15.8 → 0.15.9

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,27 @@
1
1
  # @mastra/clickhouse
2
2
 
3
+ ## 0.15.9
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: ensure score responses match saved payloads for Mastra Stores. ([#10570](https://github.com/mastra-ai/mastra/pull/10570))
8
+
9
+ - Fix message sorting in getMessagesPaginated when using semantic recall (include parameter). Messages are now always sorted by createdAt after combining paginated and included messages, ensuring correct chronological ordering of conversation history. All stores now consistently use MessageList for deduplication followed by explicit sorting. ([#10573](https://github.com/mastra-ai/mastra/pull/10573))
10
+
11
+ - Updated dependencies [[`5657314`](https://github.com/mastra-ai/mastra/commit/5657314a1f9d49019bb53f357fa48f75a69247ca), [`e5aca78`](https://github.com/mastra-ai/mastra/commit/e5aca78bb7f263bb8b470bedae81efe9805d7544), [`33a607a`](https://github.com/mastra-ai/mastra/commit/33a607a1f716c2029d4a1ff1603dd756129a33b3), [`cc10fc1`](https://github.com/mastra-ai/mastra/commit/cc10fc192d9f527c71a23cc9def10d8718935ee1), [`1f7ee84`](https://github.com/mastra-ai/mastra/commit/1f7ee841a643ef12d90392125881f06fdf877293), [`e7d5149`](https://github.com/mastra-ai/mastra/commit/e7d514995260b63b2108308e85c64de37dcd0f71), [`f195082`](https://github.com/mastra-ai/mastra/commit/f1950822a2425d5ccae78c5d010e02ddb027a869), [`d9986dd`](https://github.com/mastra-ai/mastra/commit/d9986dd3513f7ca3244a8e599a440ccf4d8bc28b), [`a45b0f0`](https://github.com/mastra-ai/mastra/commit/a45b0f0cd19eab1fe4deceae3abf029442c22f74), [`f6e8eb3`](https://github.com/mastra-ai/mastra/commit/f6e8eb3dac53b70b06e906b2818b1d2a5b0486d7), [`ce57a2b`](https://github.com/mastra-ai/mastra/commit/ce57a2b62fd0d5f6532e4ecd1ba9ba93ac9b95fc), [`3236f35`](https://github.com/mastra-ai/mastra/commit/3236f352ae13cc8552c2965164e97bd125dae48d), [`ce57a2b`](https://github.com/mastra-ai/mastra/commit/ce57a2b62fd0d5f6532e4ecd1ba9ba93ac9b95fc), [`0230321`](https://github.com/mastra-ai/mastra/commit/02303217870bedea0ef009bea9a952f24ed38aaf), [`7b541f4`](https://github.com/mastra-ai/mastra/commit/7b541f49eda6f5a87b738198edbd136927599475), [`0eea842`](https://github.com/mastra-ai/mastra/commit/0eea8423cbdd37f2111593c6f7d2efcde4b7e4ce), [`63ae8a2`](https://github.com/mastra-ai/mastra/commit/63ae8a22c0c09bbb8b9779f5f38934cd75f616af), [`bf810c5`](https://github.com/mastra-ai/mastra/commit/bf810c5c561bd8ef221c0f6bd84e69770b9a38cc), [`ac7ef07`](https://github.com/mastra-ai/mastra/commit/ac7ef07633caee89707142171d2873c888ffef85), [`522f0b4`](https://github.com/mastra-ai/mastra/commit/522f0b45330719858794eabffffde4f343f55549), [`bf810c5`](https://github.com/mastra-ai/mastra/commit/bf810c5c561bd8ef221c0f6bd84e69770b9a38cc), [`8b51d55`](https://github.com/mastra-ai/mastra/commit/8b51d55bae531edf7e383958d7ecee04df31f5d5), [`2131ac5`](https://github.com/mastra-ai/mastra/commit/2131ac571d5065f0a656c57494bca98691bb7609)]:
12
+ - @mastra/core@0.24.6
13
+
14
+ ## 0.15.9-alpha.0
15
+
16
+ ### Patch Changes
17
+
18
+ - fix: ensure score responses match saved payloads for Mastra Stores. ([#10570](https://github.com/mastra-ai/mastra/pull/10570))
19
+
20
+ - Fix message sorting in getMessagesPaginated when using semantic recall (include parameter). Messages are now always sorted by createdAt after combining paginated and included messages, ensuring correct chronological ordering of conversation history. All stores now consistently use MessageList for deduplication followed by explicit sorting. ([#10573](https://github.com/mastra-ai/mastra/pull/10573))
21
+
22
+ - Updated dependencies [[`5657314`](https://github.com/mastra-ai/mastra/commit/5657314a1f9d49019bb53f357fa48f75a69247ca), [`e5aca78`](https://github.com/mastra-ai/mastra/commit/e5aca78bb7f263bb8b470bedae81efe9805d7544), [`33a607a`](https://github.com/mastra-ai/mastra/commit/33a607a1f716c2029d4a1ff1603dd756129a33b3), [`cc10fc1`](https://github.com/mastra-ai/mastra/commit/cc10fc192d9f527c71a23cc9def10d8718935ee1), [`1f7ee84`](https://github.com/mastra-ai/mastra/commit/1f7ee841a643ef12d90392125881f06fdf877293), [`e7d5149`](https://github.com/mastra-ai/mastra/commit/e7d514995260b63b2108308e85c64de37dcd0f71), [`f195082`](https://github.com/mastra-ai/mastra/commit/f1950822a2425d5ccae78c5d010e02ddb027a869), [`d9986dd`](https://github.com/mastra-ai/mastra/commit/d9986dd3513f7ca3244a8e599a440ccf4d8bc28b), [`a45b0f0`](https://github.com/mastra-ai/mastra/commit/a45b0f0cd19eab1fe4deceae3abf029442c22f74), [`f6e8eb3`](https://github.com/mastra-ai/mastra/commit/f6e8eb3dac53b70b06e906b2818b1d2a5b0486d7), [`ce57a2b`](https://github.com/mastra-ai/mastra/commit/ce57a2b62fd0d5f6532e4ecd1ba9ba93ac9b95fc), [`3236f35`](https://github.com/mastra-ai/mastra/commit/3236f352ae13cc8552c2965164e97bd125dae48d), [`ce57a2b`](https://github.com/mastra-ai/mastra/commit/ce57a2b62fd0d5f6532e4ecd1ba9ba93ac9b95fc), [`0230321`](https://github.com/mastra-ai/mastra/commit/02303217870bedea0ef009bea9a952f24ed38aaf), [`7b541f4`](https://github.com/mastra-ai/mastra/commit/7b541f49eda6f5a87b738198edbd136927599475), [`0eea842`](https://github.com/mastra-ai/mastra/commit/0eea8423cbdd37f2111593c6f7d2efcde4b7e4ce), [`63ae8a2`](https://github.com/mastra-ai/mastra/commit/63ae8a22c0c09bbb8b9779f5f38934cd75f616af), [`bf810c5`](https://github.com/mastra-ai/mastra/commit/bf810c5c561bd8ef221c0f6bd84e69770b9a38cc), [`ac7ef07`](https://github.com/mastra-ai/mastra/commit/ac7ef07633caee89707142171d2873c888ffef85), [`522f0b4`](https://github.com/mastra-ai/mastra/commit/522f0b45330719858794eabffffde4f343f55549), [`bf810c5`](https://github.com/mastra-ai/mastra/commit/bf810c5c561bd8ef221c0f6bd84e69770b9a38cc), [`8b51d55`](https://github.com/mastra-ai/mastra/commit/8b51d55bae531edf7e383958d7ecee04df31f5d5), [`2131ac5`](https://github.com/mastra-ai/mastra/commit/2131ac571d5065f0a656c57494bca98691bb7609)]:
23
+ - @mastra/core@0.24.6-alpha.0
24
+
3
25
  ## 0.15.8
4
26
 
5
27
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1004,11 +1004,11 @@ var MemoryStorageClickhouse = class extends storage.MemoryStorage {
1004
1004
  const rows = await result.json();
1005
1005
  const paginatedMessages = transformRows(rows.data);
1006
1006
  messages.push(...paginatedMessages);
1007
- if (selectBy?.last) {
1008
- messages.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
1009
- }
1007
+ const list = new agent.MessageList().add(messages, "memory");
1008
+ let finalMessages = format === "v2" ? list.get.all.v2() : list.get.all.v1();
1009
+ finalMessages = finalMessages.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
1010
1010
  return {
1011
- messages: format === "v2" ? messages : messages,
1011
+ messages: finalMessages,
1012
1012
  total,
1013
1013
  page,
1014
1014
  perPage,
@@ -1733,18 +1733,16 @@ var ScoresStorageClickhouse = class extends storage.ScoresStorage {
1733
1733
  const scorer = storage.safelyParseJSON(row.scorer);
1734
1734
  const preprocessStepResult = storage.safelyParseJSON(row.preprocessStepResult);
1735
1735
  const analyzeStepResult = storage.safelyParseJSON(row.analyzeStepResult);
1736
- const metadata = storage.safelyParseJSON(row.metadata);
1737
1736
  const input = storage.safelyParseJSON(row.input);
1738
1737
  const output = storage.safelyParseJSON(row.output);
1739
1738
  const additionalContext = storage.safelyParseJSON(row.additionalContext);
1740
1739
  const runtimeContext = storage.safelyParseJSON(row.runtimeContext);
1741
1740
  const entity = storage.safelyParseJSON(row.entity);
1742
- return {
1741
+ const data = {
1743
1742
  ...row,
1744
1743
  scorer,
1745
1744
  preprocessStepResult,
1746
1745
  analyzeStepResult,
1747
- metadata,
1748
1746
  input,
1749
1747
  output,
1750
1748
  additionalContext,
@@ -1753,6 +1751,14 @@ var ScoresStorageClickhouse = class extends storage.ScoresStorage {
1753
1751
  createdAt: new Date(row.createdAt),
1754
1752
  updatedAt: new Date(row.updatedAt)
1755
1753
  };
1754
+ const result = {};
1755
+ for (const [key, value] of Object.entries(data)) {
1756
+ if (value === "_null_") {
1757
+ continue;
1758
+ }
1759
+ result[key] = value;
1760
+ }
1761
+ return result;
1756
1762
  }
1757
1763
  async getScoreById({ id }) {
1758
1764
  try {
@@ -1801,9 +1807,15 @@ var ScoresStorageClickhouse = class extends storage.ScoresStorage {
1801
1807
  );
1802
1808
  }
1803
1809
  try {
1804
- const record = {
1805
- ...parsedScore
1806
- };
1810
+ const record = {};
1811
+ for (const key of Object.keys(storage.SCORERS_SCHEMA)) {
1812
+ const value = parsedScore[key];
1813
+ if (key === "createdAt" || key === "updatedAt") {
1814
+ record[key] = (/* @__PURE__ */ new Date()).toISOString();
1815
+ continue;
1816
+ }
1817
+ record[key] = value === void 0 || value === null ? "_null_" : value;
1818
+ }
1807
1819
  await this.client.insert({
1808
1820
  table: storage.TABLE_SCORERS,
1809
1821
  values: [record],