@mastra/pg 1.15.0 → 1.15.1-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 +11 -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-memory-memory-class.md +5 -5
- package/dist/docs/references/reference-storage-composite.md +2 -2
- package/dist/docs/references/reference-storage-dynamodb.md +1 -1
- package/dist/docs/references/reference-storage-postgresql.md +2 -2
- package/dist/docs/references/reference-storage-retention.md +5 -5
- package/dist/docs/references/reference-tools-vector-query-tool.md +1 -1
- package/dist/docs/references/reference-vectors-pg.md +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/schedules/index.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @mastra/pg
|
|
2
2
|
|
|
3
|
+
## 1.15.1-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Update `@mastra/core` peer dependency for the unified schedules API ([#18874](https://github.com/mastra-ai/mastra/pull/18874))
|
|
8
|
+
|
|
9
|
+
- Schedule rows persisted with the legacy `target.type: 'heartbeat'` are now normalized to `target.type: 'agent'` when read, so existing agent schedules keep firing after the heartbeats-to-schedules rename in `@mastra/core`. ([#18874](https://github.com/mastra-ai/mastra/pull/18874))
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`b291760`](https://github.com/mastra-ai/mastra/commit/b291760df9d6c7e4fc72606c8f0a4af2cf6e946c), [`29b7ea6`](https://github.com/mastra-ai/mastra/commit/29b7ea64e72b5523d5bdcbd34ee03d2b854d54e1), [`10959d5`](https://github.com/mastra-ai/mastra/commit/10959d509d824f682d40ff96e05ee044aec3b0e5), [`ffc3c17`](https://github.com/mastra-ai/mastra/commit/ffc3c17274ea17c11aa6f73d3140649cd7fc8abc), [`3908e53`](https://github.com/mastra-ai/mastra/commit/3908e53ce04bbea04f5e0c097d7aa298c35fabee)]:
|
|
12
|
+
- @mastra/core@1.50.0-alpha.3
|
|
13
|
+
|
|
3
14
|
## 1.15.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -399,7 +399,7 @@ const response = await agent.generate('What do you know about me?', {
|
|
|
399
399
|
|
|
400
400
|
## Opt in to state signals (experimental)
|
|
401
401
|
|
|
402
|
-
By default, working memory reaches the model as part of the system message. You can opt into delivering it as a [state signal](https://mastra.ai/docs/agents/signals) instead by setting `useStateSignals: true`:
|
|
402
|
+
By default, working memory reaches the model as part of the system message. You can opt into delivering it as a [state signal](https://mastra.ai/docs/long-running-agents/signals) instead by setting `useStateSignals: true`:
|
|
403
403
|
|
|
404
404
|
```typescript
|
|
405
405
|
const memory = new Memory({
|
|
@@ -29,23 +29,23 @@ export const agent = new Agent({
|
|
|
29
29
|
|
|
30
30
|
## Constructor parameters
|
|
31
31
|
|
|
32
|
-
**storage** (`MastraCompositeStore`): Storage implementation for persisting memory data. Defaults to
|
|
32
|
+
**storage** (`MastraCompositeStore`): Storage implementation for persisting memory data. Defaults to new DefaultStorage({ config: { url: "file:memory.db" } }) if not provided.
|
|
33
33
|
|
|
34
|
-
**vector** (`MastraVector | false`): Vector store for semantic search capabilities. Set to
|
|
34
|
+
**vector** (`MastraVector | false`): Vector store for semantic search capabilities. Set to false to disable vector operations.
|
|
35
35
|
|
|
36
36
|
**embedder** (`EmbeddingModel<string> | EmbeddingModelV2<string>`): Embedder instance for vector embeddings. Required when semantic recall is enabled.
|
|
37
37
|
|
|
38
38
|
**options** (`MemoryConfig`): Memory configuration options.
|
|
39
39
|
|
|
40
|
-
**options.lastMessages** (`number | false`): Number of most recent messages to include in context. Set to
|
|
40
|
+
**options.lastMessages** (`number | false`): Number of most recent messages to include in context. Set to false to disable loading conversation history into context. Use Number.MAX\_SAFE\_INTEGER to retrieve all messages with no limit. To prevent saving new messages, use the readOnly option instead.
|
|
41
41
|
|
|
42
42
|
**options.readOnly** (`boolean`): When true, prevents memory from saving new messages and provides working memory as read-only context (without the updateWorkingMemory tool). Useful for read-only operations like previews, internal routing agents, or sub agents that should reference but not modify memory.
|
|
43
43
|
|
|
44
44
|
**options.semanticRecall** (`boolean | { topK: number; messageRange: number | { before: number; after: number }; scope?: 'thread' | 'resource' }`): Enable semantic search in message history. Can be a boolean or an object with configuration options. When enabled, requires both vector store and embedder to be configured. Default topK is 4, default messageRange is {before: 1, after: 1}.
|
|
45
45
|
|
|
46
|
-
**options.workingMemory** (`WorkingMemory`): Configuration for working memory feature. Can be
|
|
46
|
+
**options.workingMemory** (`WorkingMemory`): Configuration for working memory feature. Can be { enabled: boolean; template?: string; schema?: ZodObject\<any> | JSONSchema7; scope?: 'thread' | 'resource' } or { enabled: boolean } to disable.
|
|
47
47
|
|
|
48
|
-
**options.observationalMemory** (`boolean | ObservationalMemoryOptions`): Enable Observational Memory for long-context agentic memory. Set to
|
|
48
|
+
**options.observationalMemory** (`boolean | ObservationalMemoryOptions`): Enable Observational Memory for long-context agentic memory. Set to true for defaults, or pass a config object to customize token budgets, models, and scope. See Observational Memory reference for configuration details.
|
|
49
49
|
|
|
50
50
|
**options.generateTitle** (`boolean | { model: DynamicArgument<MastraLanguageModel>; instructions?: DynamicArgument<string> }`): Controls automatic thread title generation from the user's first message. Can be a boolean or an object with custom model and instructions.
|
|
51
51
|
|
|
@@ -128,11 +128,11 @@ export const mastra = new Mastra({
|
|
|
128
128
|
|
|
129
129
|
**id** (`string`): Unique identifier for this storage instance.
|
|
130
130
|
|
|
131
|
-
**default** (`MastraCompositeStore`): Default storage adapter. Domains not explicitly specified in
|
|
131
|
+
**default** (`MastraCompositeStore`): Default storage adapter. Domains not explicitly specified in domains will use this storage's domains as fallbacks.
|
|
132
132
|
|
|
133
133
|
**disableInit** (`boolean`): When true, automatic initialization is disabled. You must call init() explicitly.
|
|
134
134
|
|
|
135
|
-
**domains** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over both
|
|
135
|
+
**domains** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over both editor and default storage.
|
|
136
136
|
|
|
137
137
|
**domains.memory** (`MemoryStorage`): Storage for threads, messages, and resources.
|
|
138
138
|
|
|
@@ -118,7 +118,7 @@ For local development, you can use [DynamoDB Local](https://docs.aws.amazon.com/
|
|
|
118
118
|
|
|
119
119
|
**config.endpoint** (`string`): Custom endpoint for DynamoDB (e.g., 'http\://localhost:8000' for local development).
|
|
120
120
|
|
|
121
|
-
**config.credentials** (`object`): AWS credentials object with
|
|
121
|
+
**config.credentials** (`object`): AWS credentials object with accessKeyId and secretAccessKey. If not provided, the AWS SDK will attempt to source credentials from environment variables, IAM roles (e.g., for EC2/Lambda), or the shared AWS credentials file.
|
|
122
122
|
|
|
123
123
|
**config.ttl** (`object`): TTL (Time To Live) configuration for automatic data expiration. Configure per entity type: thread, message, trace, eval, workflow\_snapshot, resource, score. Each entity config includes: enabled (boolean), attributeName (string, default: 'ttl'), defaultTtlSeconds (number).
|
|
124
124
|
|
|
@@ -45,7 +45,7 @@ const storage = new PostgresStore({
|
|
|
45
45
|
|
|
46
46
|
**id** (`string`): Unique identifier for this storage instance.
|
|
47
47
|
|
|
48
|
-
**connectionString** (`string`): PostgreSQL connection string (e.g., postgresql://user:pass\@host:5432/dbname). Required unless using
|
|
48
|
+
**connectionString** (`string`): PostgreSQL connection string (e.g., postgresql://user:pass\@host:5432/dbname). Required unless using pool or individual host-based parameters (host, port, database, user, password).
|
|
49
49
|
|
|
50
50
|
**host** (`string`): Database server hostname or IP address. Used with other host-based parameters as an alternative to connectionString.
|
|
51
51
|
|
|
@@ -57,7 +57,7 @@ const storage = new PostgresStore({
|
|
|
57
57
|
|
|
58
58
|
**password** (`string`): Password for the database user.
|
|
59
59
|
|
|
60
|
-
**pool** (`pg.Pool`): Pre-configured pg.Pool instance. Use this to reuse an existing connection pool. When provided, Mastra will not create its own pool and will not close it when
|
|
60
|
+
**pool** (`pg.Pool`): Pre-configured pg.Pool instance. Use this to reuse an existing connection pool. When provided, Mastra will not create its own pool and will not close it when store.close() is called.
|
|
61
61
|
|
|
62
62
|
**schemaName** (`string`): The name of the schema you want the storage to use. Defaults to 'public'.
|
|
63
63
|
|
|
@@ -55,11 +55,11 @@ Set the `retention` field on the store config.
|
|
|
55
55
|
|
|
56
56
|
**retention** (`RetentionConfig`): Per-domain, per-table age policies. Unset domains and tables are kept forever.
|
|
57
57
|
|
|
58
|
-
**retention.\[domain]** (`Record<TableKey, TableRetentionPolicy>`): A real storage domain key (e.g.
|
|
58
|
+
**retention.\[domain]** (`Record<TableKey, TableRetentionPolicy>`): A real storage domain key (e.g. memory, observability). Maps that domain's retention-eligible table keys to their policies.
|
|
59
59
|
|
|
60
60
|
### TableRetentionPolicy
|
|
61
61
|
|
|
62
|
-
**maxAge** (`Duration`): Maximum age to keep rows. Rows whose anchor timestamp is strictly older than
|
|
62
|
+
**maxAge** (`Duration`): Maximum age to keep rows. Rows whose anchor timestamp is strictly older than Date.now() - maxAge are eligible for deletion. A number is milliseconds, or a string with a unit suffix: ms, s, m, h, d, w (e.g. '30d', '12h').
|
|
63
63
|
|
|
64
64
|
**batchSize** (`number`): Rows deleted per batch. Each batch is its own transaction, which bounds lock duration and WAL growth on large tables. (Default: `1000`)
|
|
65
65
|
|
|
@@ -122,13 +122,13 @@ Returns: `Promise<PruneResult[]>`
|
|
|
122
122
|
|
|
123
123
|
##### PruneOptions
|
|
124
124
|
|
|
125
|
-
**maxBatches** (`number`): Maximum delete batches per table per call. When reached, that table's result is returned with
|
|
125
|
+
**maxBatches** (`number`): Maximum delete batches per table per call. When reached, that table's result is returned with done: false.
|
|
126
126
|
|
|
127
|
-
**maxRows** (`number`): Maximum rows deleted per table per call. When reached, that table's result is returned with
|
|
127
|
+
**maxRows** (`number`): Maximum rows deleted per table per call. When reached, that table's result is returned with done: false.
|
|
128
128
|
|
|
129
129
|
**pauseMs** (`number`): Delay in milliseconds between batches, to avoid starving live traffic.
|
|
130
130
|
|
|
131
|
-
**signal** (`AbortSignal`): Cooperative cancellation. The batch loop checks it between batches and stops cleanly, returning partial results with
|
|
131
|
+
**signal** (`AbortSignal`): Cooperative cancellation. The batch loop checks it between batches and stops cleanly, returning partial results with done: false.
|
|
132
132
|
|
|
133
133
|
##### PruneResult
|
|
134
134
|
|
|
@@ -71,7 +71,7 @@ const queryTool = createVectorQueryTool({
|
|
|
71
71
|
|
|
72
72
|
**providerOptions** (`Record<string, Record<string, any>>`): Provider-specific options for the embedding model (e.g., outputDimensionality). \*\*Important\*\*: Only works with AI SDK EmbeddingModelV2 models. For V1 models, configure options when creating the model itself.
|
|
73
73
|
|
|
74
|
-
**vectorStore** (`MastraVector | VectorStoreResolver`): Direct vector store instance or a resolver function for dynamic selection. Use a function for multi-tenant applications where the vector store is selected based on request context. When provided,
|
|
74
|
+
**vectorStore** (`MastraVector | VectorStoreResolver`): Direct vector store instance or a resolver function for dynamic selection. Use a function for multi-tenant applications where the vector store is selected based on request context. When provided, vectorStoreName becomes optional.
|
|
75
75
|
|
|
76
76
|
## Returns
|
|
77
77
|
|
|
@@ -28,7 +28,7 @@ The PgVector class provides vector search using [PostgreSQL](https://www.postgre
|
|
|
28
28
|
|
|
29
29
|
**pgPoolOptions** (`PoolConfig`): Additional pg pool configuration options
|
|
30
30
|
|
|
31
|
-
**disableInit** (`boolean`): When true, automatic DDL (schema, extension, table, and index creation) inside
|
|
31
|
+
**disableInit** (`boolean`): When true, automatic DDL (schema, extension, table, and index creation) inside createIndex is skipped. Useful for CI/CD pipelines where schema and indexes are managed separately and the runtime database role lacks DDL privileges. Can also be enabled with the MASTRA\_DISABLE\_STORAGE\_INIT environment variable. (Default: `false`)
|
|
32
32
|
|
|
33
33
|
## Constructor examples
|
|
34
34
|
|
package/dist/index.cjs
CHANGED
|
@@ -16457,7 +16457,7 @@ function rowToSchedule(row) {
|
|
|
16457
16457
|
}
|
|
16458
16458
|
const schedule = {
|
|
16459
16459
|
id: String(row.id),
|
|
16460
|
-
target,
|
|
16460
|
+
target: storage.normalizeScheduleTarget(target),
|
|
16461
16461
|
cron: String(row.cron),
|
|
16462
16462
|
status: String(row.status),
|
|
16463
16463
|
nextFireAt: toNumber(row.next_fire_at),
|