@mastra/pg 1.9.2 → 1.9.3-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 +9 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-memory-working-memory.md +1 -1
- package/dist/docs/references/reference-storage-composite.md +5 -3
- package/dist/index.cjs +18 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -16
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +10 -0
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @mastra/pg
|
|
2
2
|
|
|
3
|
+
## 1.9.3-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed auto-migration for the `mastra_observational_memory` table to include the `reflectedObservationLineCount` column. Previously, upgrading from older versions would crash on `Memory.cloneThread()` because this column was missing from the `ifNotExists` migration list. ([#15892](https://github.com/mastra-ai/mastra/pull/15892))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`6db978c`](https://github.com/mastra-ai/mastra/commit/6db978c42e94e75540a504f7230086f0b5cd35f9)]:
|
|
10
|
+
- @mastra/core@1.29.1-alpha.0
|
|
11
|
+
|
|
3
12
|
## 1.9.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -208,7 +208,7 @@ const paragraphMemory = new Memory({
|
|
|
208
208
|
|
|
209
209
|
## Structured working memory
|
|
210
210
|
|
|
211
|
-
Working memory can also be defined using a structured schema instead of a Markdown template. This allows you to specify the exact fields and types that should be tracked, using a [Zod](https://zod.dev/)
|
|
211
|
+
Working memory can also be defined using a structured schema instead of a Markdown template. This allows you to specify the exact fields and types that should be tracked, using a [Standard JSON Schema](https://standardschema.dev/json-schema) ([Zod](https://zod.dev/), [Valibot](https://valibot.dev/), [ArkType](https://arktype.io/), etc.). When using a schema, the agent will see and update working memory as a JSON object matching your schema.
|
|
212
212
|
|
|
213
213
|
**Important:** You must specify either `template` or `schema`, but not both.
|
|
214
214
|
|
|
@@ -218,12 +218,12 @@ const storage = new MastraCompositeStore({
|
|
|
218
218
|
|
|
219
219
|
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.
|
|
220
220
|
|
|
221
|
-
**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:
|
|
221
|
+
**[ClickHouse](https://mastra.ai/reference/storage/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:
|
|
222
222
|
|
|
223
223
|
```typescript
|
|
224
224
|
import { MastraCompositeStore } from '@mastra/core/storage'
|
|
225
225
|
import { MemoryPG, WorkflowsPG, ScoresPG } from '@mastra/pg'
|
|
226
|
-
import {
|
|
226
|
+
import { ObservabilityStorageClickhouseVNext } from '@mastra/clickhouse'
|
|
227
227
|
|
|
228
228
|
const storage = new MastraCompositeStore({
|
|
229
229
|
id: 'composite',
|
|
@@ -231,7 +231,7 @@ const storage = new MastraCompositeStore({
|
|
|
231
231
|
memory: new MemoryPG({ connectionString: process.env.DATABASE_URL }),
|
|
232
232
|
workflows: new WorkflowsPG({ connectionString: process.env.DATABASE_URL }),
|
|
233
233
|
scores: new ScoresPG({ connectionString: process.env.DATABASE_URL }),
|
|
234
|
-
observability: new
|
|
234
|
+
observability: new ObservabilityStorageClickhouseVNext({
|
|
235
235
|
url: process.env.CLICKHOUSE_URL,
|
|
236
236
|
username: process.env.CLICKHOUSE_USERNAME,
|
|
237
237
|
password: process.env.CLICKHOUSE_PASSWORD,
|
|
@@ -240,4 +240,6 @@ const storage = new MastraCompositeStore({
|
|
|
240
240
|
})
|
|
241
241
|
```
|
|
242
242
|
|
|
243
|
+
> **Note:** `ObservabilityStorageClickhouseVNext` is the current observability domain implementation. The legacy `ObservabilityStorageClickhouse` class is also exported and remains supported for projects that have not migrated. See the [ClickHouse storage reference](https://mastra.ai/reference/storage/clickhouse) for details.
|
|
244
|
+
|
|
243
245
|
> **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
|
@@ -7463,6 +7463,23 @@ var MCPServersPG = class _MCPServersPG extends storage.MCPServersStorage {
|
|
|
7463
7463
|
}
|
|
7464
7464
|
};
|
|
7465
7465
|
var OM_TABLE = "mastra_observational_memory";
|
|
7466
|
+
var OM_MIGRATION_COLUMNS = [
|
|
7467
|
+
"observedMessageIds",
|
|
7468
|
+
"observedTimezone",
|
|
7469
|
+
"bufferedObservations",
|
|
7470
|
+
"bufferedObservationTokens",
|
|
7471
|
+
"bufferedMessageIds",
|
|
7472
|
+
"bufferedReflection",
|
|
7473
|
+
"bufferedReflectionTokens",
|
|
7474
|
+
"bufferedReflectionInputTokens",
|
|
7475
|
+
"reflectedObservationLineCount",
|
|
7476
|
+
"bufferedObservationChunks",
|
|
7477
|
+
"isBufferingObservation",
|
|
7478
|
+
"isBufferingReflection",
|
|
7479
|
+
"lastBufferedAtTokens",
|
|
7480
|
+
"lastBufferedAtTime",
|
|
7481
|
+
"metadata"
|
|
7482
|
+
];
|
|
7466
7483
|
var _omTableSchema;
|
|
7467
7484
|
try {
|
|
7468
7485
|
const __require2 = typeof __require === "function" ? __require : module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
@@ -7514,22 +7531,7 @@ var MemoryPG = class _MemoryPG extends storage.MemoryStorage {
|
|
|
7514
7531
|
await this.#db.alterTable({
|
|
7515
7532
|
tableName: OM_TABLE,
|
|
7516
7533
|
schema: omSchema,
|
|
7517
|
-
ifNotExists:
|
|
7518
|
-
"observedMessageIds",
|
|
7519
|
-
"observedTimezone",
|
|
7520
|
-
"bufferedObservations",
|
|
7521
|
-
"bufferedObservationTokens",
|
|
7522
|
-
"bufferedMessageIds",
|
|
7523
|
-
"bufferedReflection",
|
|
7524
|
-
"bufferedReflectionTokens",
|
|
7525
|
-
"bufferedReflectionInputTokens",
|
|
7526
|
-
"bufferedObservationChunks",
|
|
7527
|
-
"isBufferingObservation",
|
|
7528
|
-
"isBufferingReflection",
|
|
7529
|
-
"lastBufferedAtTokens",
|
|
7530
|
-
"lastBufferedAtTime",
|
|
7531
|
-
"metadata"
|
|
7532
|
-
]
|
|
7534
|
+
ifNotExists: OM_MIGRATION_COLUMNS
|
|
7533
7535
|
});
|
|
7534
7536
|
}
|
|
7535
7537
|
await this.#db.alterTable({
|