@mastra/libsql 0.0.0-structured-output-issue-20260227214155 → 0.0.0-structured-output-errors-20260409185629
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 +344 -3
- package/LICENSE.md +15 -0
- package/dist/docs/SKILL.md +15 -19
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-agents-agent-approval.md +136 -185
- package/dist/docs/references/docs-agents-networks.md +90 -207
- package/dist/docs/references/docs-memory-memory-processors.md +15 -15
- package/dist/docs/references/docs-memory-message-history.md +10 -8
- package/dist/docs/references/docs-memory-overview.md +219 -24
- package/dist/docs/references/docs-memory-semantic-recall.md +54 -29
- package/dist/docs/references/docs-memory-storage.md +14 -16
- package/dist/docs/references/docs-memory-working-memory.md +22 -22
- package/dist/docs/references/docs-rag-retrieval.md +16 -16
- package/dist/docs/references/docs-workflows-snapshots.md +1 -1
- package/dist/docs/references/guides-agent-frameworks-ai-sdk.md +3 -3
- package/dist/docs/references/reference-core-getMemory.md +4 -5
- package/dist/docs/references/reference-core-listMemory.md +3 -4
- package/dist/docs/references/reference-core-mastra-class.md +18 -18
- package/dist/docs/references/reference-memory-memory-class.md +16 -18
- package/dist/docs/references/reference-storage-composite.md +19 -11
- package/dist/docs/references/reference-storage-dynamodb.md +16 -16
- package/dist/docs/references/reference-storage-libsql.md +3 -3
- package/dist/docs/references/reference-vectors-libsql.md +47 -47
- package/dist/index.cjs +512 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +513 -83
- package/dist/index.js.map +1 -1
- package/dist/storage/db/index.d.ts +12 -0
- package/dist/storage/db/index.d.ts.map +1 -1
- package/dist/storage/domains/datasets/index.d.ts.map +1 -1
- package/dist/storage/domains/experiments/index.d.ts +3 -1
- package/dist/storage/domains/experiments/index.d.ts.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +5 -2
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/index.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/docs/references/docs-agents-agent-memory.md +0 -209
- package/dist/docs/references/docs-agents-network-approval.md +0 -275
- package/dist/docs/references/docs-observability-overview.md +0 -70
- package/dist/docs/references/docs-observability-tracing-exporters-default.md +0 -209
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# DynamoDB
|
|
1
|
+
# DynamoDB storage
|
|
2
2
|
|
|
3
3
|
The DynamoDB storage implementation provides a scalable and performant NoSQL database solution for Mastra, leveraging a single-table design pattern with [ElectroDB](https://electrodb.dev/).
|
|
4
4
|
|
|
5
|
-
> **Observability Not Supported:** DynamoDB storage **
|
|
5
|
+
> **Observability Not Supported:** DynamoDB storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to DynamoDB, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with DynamoDB as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
|
|
6
6
|
|
|
7
7
|
> **Item Size Limit:** DynamoDB enforces a **400 KB maximum item size**. This limit can be exceeded when storing messages with base64-encoded attachments such as images. See [Handling large attachments](https://mastra.ai/docs/memory/storage) for workarounds including uploading attachments to external storage.
|
|
8
8
|
|
|
@@ -108,19 +108,19 @@ For local development, you can use [DynamoDB Local](https://docs.aws.amazon.com/
|
|
|
108
108
|
|
|
109
109
|
## Parameters
|
|
110
110
|
|
|
111
|
-
**id
|
|
111
|
+
**id** (`string`): Unique identifier for this storage instance.
|
|
112
112
|
|
|
113
|
-
**config.tableName
|
|
113
|
+
**config.tableName** (`string`): The name of your DynamoDB table.
|
|
114
114
|
|
|
115
|
-
**config.region
|
|
115
|
+
**config.region** (`string`): AWS region. Defaults to 'us-east-1'. For local development, can be set to 'localhost' or similar.
|
|
116
116
|
|
|
117
|
-
**config.endpoint
|
|
117
|
+
**config.endpoint** (`string`): Custom endpoint for DynamoDB (e.g., 'http\://localhost:8000' for local development).
|
|
118
118
|
|
|
119
|
-
**config.credentials
|
|
119
|
+
**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.
|
|
120
120
|
|
|
121
|
-
**config.ttl
|
|
121
|
+
**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).
|
|
122
122
|
|
|
123
|
-
## TTL (
|
|
123
|
+
## TTL (time to live) configuration
|
|
124
124
|
|
|
125
125
|
DynamoDB TTL allows you to automatically delete items after a specified time period. This is useful for:
|
|
126
126
|
|
|
@@ -188,11 +188,11 @@ TTL can be configured for these entity types:
|
|
|
188
188
|
|
|
189
189
|
Each entity type accepts the following configuration:
|
|
190
190
|
|
|
191
|
-
**enabled
|
|
191
|
+
**enabled** (`boolean`): Whether TTL is enabled for this entity type.
|
|
192
192
|
|
|
193
|
-
**attributeName
|
|
193
|
+
**attributeName** (`string`): The DynamoDB attribute name to use for TTL. Must match the TTL attribute configured on your DynamoDB table. Defaults to 'ttl'.
|
|
194
194
|
|
|
195
|
-
**defaultTtlSeconds
|
|
195
|
+
**defaultTtlSeconds** (`number`): Default TTL in seconds from item creation time. Items will be automatically deleted by DynamoDB after this duration.
|
|
196
196
|
|
|
197
197
|
### Enabling TTL on Your DynamoDB Table
|
|
198
198
|
|
|
@@ -211,12 +211,12 @@ aws dynamodb update-time-to-live \
|
|
|
211
211
|
1. Go to the DynamoDB console
|
|
212
212
|
2. Select your table
|
|
213
213
|
3. Go to "Additional settings" tab
|
|
214
|
-
4. Under "Time to Live (TTL)",
|
|
214
|
+
4. Under "Time to Live (TTL)", select "Manage TTL"
|
|
215
215
|
5. Enable TTL and specify the attribute name (default: `ttl`)
|
|
216
216
|
|
|
217
217
|
> **Note:** DynamoDB deletes expired items within 48 hours after expiration. Items remain queryable until actually deleted.
|
|
218
218
|
|
|
219
|
-
## AWS IAM
|
|
219
|
+
## AWS IAM permissions
|
|
220
220
|
|
|
221
221
|
The IAM role or user executing the code needs appropriate permissions to interact with the specified DynamoDB table and its indexes. Below is a sample policy. Replace `${YOUR_TABLE_NAME}` with your actual table name and `${YOUR_AWS_REGION}` and `${YOUR_AWS_ACCOUNT_ID}` with appropriate values.
|
|
222
222
|
|
|
@@ -246,7 +246,7 @@ The IAM role or user executing the code needs appropriate permissions to interac
|
|
|
246
246
|
}
|
|
247
247
|
```
|
|
248
248
|
|
|
249
|
-
## Key
|
|
249
|
+
## Key considerations
|
|
250
250
|
|
|
251
251
|
Before diving into the architectural details, keep these key points in mind when working with the DynamoDB storage adapter:
|
|
252
252
|
|
|
@@ -255,7 +255,7 @@ Before diving into the architectural details, keep these key points in mind when
|
|
|
255
255
|
- **Understanding GSIs:** Familiarity with how the GSIs are structured (as per `TABLE_SETUP.md`) is important for understanding data retrieval and potential query patterns.
|
|
256
256
|
- **ElectroDB:** The adapter uses ElectroDB to manage interactions with DynamoDB, providing a layer of abstraction and type safety over raw DynamoDB operations.
|
|
257
257
|
|
|
258
|
-
## Architectural
|
|
258
|
+
## Architectural approach
|
|
259
259
|
|
|
260
260
|
This storage adapter utilizes a **single-table design pattern** leveraging [ElectroDB](https://electrodb.dev/), a common and recommended approach for DynamoDB. This differs architecturally from relational database adapters (like `@mastra/pg` or `@mastra/libsql`) that typically use multiple tables, each dedicated to a specific entity (threads, messages, etc.).
|
|
261
261
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# libSQL
|
|
1
|
+
# libSQL storage
|
|
2
2
|
|
|
3
3
|
[libSQL](https://docs.turso.tech/libsql) is an open-source, SQLite-compatible database that supports both local and remote deployments. It can be used to store message history, workflow snapshots, traces, and eval scores.
|
|
4
4
|
|
|
@@ -89,9 +89,9 @@ storage: new LibSQLStore({
|
|
|
89
89
|
|
|
90
90
|
## Options
|
|
91
91
|
|
|
92
|
-
**url
|
|
92
|
+
**url** (`string`): Database URL. Use \`:memory:\` for in-memory database, \`file:filename.db\` for a file database, or a libSQL connection string (e.g., \`libsql://your-database.turso.io\`) for remote storage.
|
|
93
93
|
|
|
94
|
-
**authToken
|
|
94
|
+
**authToken** (`string`): Authentication token for remote libSQL databases.
|
|
95
95
|
|
|
96
96
|
## Initialization
|
|
97
97
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# libSQL
|
|
1
|
+
# libSQL vector store
|
|
2
2
|
|
|
3
3
|
The libSQL storage implementation provides a SQLite-compatible vector search [libSQL](https://github.com/tursodatabase/libsql), a fork of SQLite with vector extensions, and [Turso](https://turso.tech/) with vector extensions, offering a lightweight and efficient vector database solution. It's part of the `@mastra/libsql` package and offers efficient vector similarity search with metadata filtering.
|
|
4
4
|
|
|
@@ -69,61 +69,61 @@ const results = await store.query({
|
|
|
69
69
|
});
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
## Constructor
|
|
72
|
+
## Constructor options
|
|
73
73
|
|
|
74
|
-
**url
|
|
74
|
+
**url** (`string`): libSQL database URL. Use ':memory:' for in-memory database, 'file:dbname.db' for local file, or a libSQL-compatible connection string like 'libsql://your-database.turso.io'.
|
|
75
75
|
|
|
76
|
-
**authToken
|
|
76
|
+
**authToken** (`string`): Authentication token for Turso cloud databases
|
|
77
77
|
|
|
78
|
-
**syncUrl
|
|
78
|
+
**syncUrl** (`string`): URL for database replication (Turso specific)
|
|
79
79
|
|
|
80
|
-
**syncInterval
|
|
80
|
+
**syncInterval** (`number`): Interval in milliseconds for database sync (Turso specific)
|
|
81
81
|
|
|
82
82
|
## Methods
|
|
83
83
|
|
|
84
|
-
### createIndex()
|
|
84
|
+
### `createIndex()`
|
|
85
85
|
|
|
86
86
|
Creates a new vector collection. The index name must start with a letter or underscore and can only contain letters, numbers, and underscores. The dimension must be a positive integer.
|
|
87
87
|
|
|
88
|
-
**indexName
|
|
88
|
+
**indexName** (`string`): Name of the index to create
|
|
89
89
|
|
|
90
|
-
**dimension
|
|
90
|
+
**dimension** (`number`): Vector dimension size (must match your embedding model)
|
|
91
91
|
|
|
92
|
-
**metric
|
|
92
|
+
**metric** (`'cosine' | 'euclidean' | 'dotproduct'`): Distance metric for similarity search. Note: Currently only cosine similarity is supported by libSQL. (Default: `cosine`)
|
|
93
93
|
|
|
94
|
-
### upsert()
|
|
94
|
+
### `upsert()`
|
|
95
95
|
|
|
96
96
|
Adds or updates vectors and their metadata in the index. Uses a transaction to ensure all vectors are inserted atomically - if any insert fails, the entire operation is rolled back.
|
|
97
97
|
|
|
98
|
-
**indexName
|
|
98
|
+
**indexName** (`string`): Name of the index to insert into
|
|
99
99
|
|
|
100
|
-
**vectors
|
|
100
|
+
**vectors** (`number[][]`): Array of embedding vectors
|
|
101
101
|
|
|
102
|
-
**metadata
|
|
102
|
+
**metadata** (`Record<string, any>[]`): Metadata for each vector
|
|
103
103
|
|
|
104
|
-
**ids
|
|
104
|
+
**ids** (`string[]`): Optional vector IDs (auto-generated if not provided)
|
|
105
105
|
|
|
106
|
-
### query()
|
|
106
|
+
### `query()`
|
|
107
107
|
|
|
108
108
|
Searches for similar vectors with optional metadata filtering.
|
|
109
109
|
|
|
110
|
-
**indexName
|
|
110
|
+
**indexName** (`string`): Name of the index to search in
|
|
111
111
|
|
|
112
|
-
**queryVector
|
|
112
|
+
**queryVector** (`number[]`): Query vector to find similar vectors for
|
|
113
113
|
|
|
114
|
-
**topK
|
|
114
|
+
**topK** (`number`): Number of results to return (Default: `10`)
|
|
115
115
|
|
|
116
|
-
**filter
|
|
116
|
+
**filter** (`Filter`): Metadata filters
|
|
117
117
|
|
|
118
|
-
**includeVector
|
|
118
|
+
**includeVector** (`boolean`): Whether to include vector data in results (Default: `false`)
|
|
119
119
|
|
|
120
|
-
**minScore
|
|
120
|
+
**minScore** (`number`): Minimum similarity score threshold (Default: `0`)
|
|
121
121
|
|
|
122
|
-
### describeIndex()
|
|
122
|
+
### `describeIndex()`
|
|
123
123
|
|
|
124
124
|
Gets information about an index.
|
|
125
125
|
|
|
126
|
-
**indexName
|
|
126
|
+
**indexName** (`string`): Name of the index to describe
|
|
127
127
|
|
|
128
128
|
Returns:
|
|
129
129
|
|
|
@@ -135,59 +135,59 @@ interface IndexStats {
|
|
|
135
135
|
}
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
-
### deleteIndex()
|
|
138
|
+
### `deleteIndex()`
|
|
139
139
|
|
|
140
140
|
Deletes an index and all its data.
|
|
141
141
|
|
|
142
|
-
**indexName
|
|
142
|
+
**indexName** (`string`): Name of the index to delete
|
|
143
143
|
|
|
144
|
-
### listIndexes()
|
|
144
|
+
### `listIndexes()`
|
|
145
145
|
|
|
146
146
|
Lists all vector indexes in the database.
|
|
147
147
|
|
|
148
148
|
Returns: `Promise<string[]>`
|
|
149
149
|
|
|
150
|
-
### truncateIndex()
|
|
150
|
+
### `truncateIndex()`
|
|
151
151
|
|
|
152
152
|
Removes all vectors from an index while keeping the index structure.
|
|
153
153
|
|
|
154
|
-
**indexName
|
|
154
|
+
**indexName** (`string`): Name of the index to truncate
|
|
155
155
|
|
|
156
|
-
### updateVector()
|
|
156
|
+
### `updateVector()`
|
|
157
157
|
|
|
158
158
|
Update a single vector by ID or by metadata filter. Either `id` or `filter` must be provided, but not both.
|
|
159
159
|
|
|
160
|
-
**indexName
|
|
160
|
+
**indexName** (`string`): Name of the index containing the vector
|
|
161
161
|
|
|
162
|
-
**id
|
|
162
|
+
**id** (`string`): ID of the vector entry to update (mutually exclusive with filter)
|
|
163
163
|
|
|
164
|
-
**filter
|
|
164
|
+
**filter** (`Record<string, any>`): Metadata filter to identify vector(s) to update (mutually exclusive with id)
|
|
165
165
|
|
|
166
|
-
**update
|
|
166
|
+
**update** (`object`): Update data containing vector and/or metadata
|
|
167
167
|
|
|
168
|
-
**update.vector
|
|
168
|
+
**update.vector** (`number[]`): New vector data to update
|
|
169
169
|
|
|
170
|
-
**update.metadata
|
|
170
|
+
**update.metadata** (`Record<string, any>`): New metadata to update
|
|
171
171
|
|
|
172
|
-
### deleteVector()
|
|
172
|
+
### `deleteVector()`
|
|
173
173
|
|
|
174
174
|
Deletes a specific vector entry from an index by its ID.
|
|
175
175
|
|
|
176
|
-
**indexName
|
|
176
|
+
**indexName** (`string`): Name of the index containing the vector
|
|
177
177
|
|
|
178
|
-
**id
|
|
178
|
+
**id** (`string`): ID of the vector entry to delete
|
|
179
179
|
|
|
180
|
-
### deleteVectors()
|
|
180
|
+
### `deleteVectors()`
|
|
181
181
|
|
|
182
182
|
Delete multiple vectors by IDs or by metadata filter. Either `ids` or `filter` must be provided, but not both.
|
|
183
183
|
|
|
184
|
-
**indexName
|
|
184
|
+
**indexName** (`string`): Name of the index containing the vectors to delete
|
|
185
185
|
|
|
186
|
-
**ids
|
|
186
|
+
**ids** (`string[]`): Array of vector IDs to delete (mutually exclusive with filter)
|
|
187
187
|
|
|
188
|
-
**filter
|
|
188
|
+
**filter** (`Record<string, any>`): Metadata filter to identify vectors to delete (mutually exclusive with ids)
|
|
189
189
|
|
|
190
|
-
## Response
|
|
190
|
+
## Response types
|
|
191
191
|
|
|
192
192
|
Query results are returned in this format:
|
|
193
193
|
|
|
@@ -200,7 +200,7 @@ interface QueryResult {
|
|
|
200
200
|
}
|
|
201
201
|
```
|
|
202
202
|
|
|
203
|
-
## Error
|
|
203
|
+
## Error handling
|
|
204
204
|
|
|
205
205
|
The store throws specific errors for different failure cases:
|
|
206
206
|
|
|
@@ -232,7 +232,7 @@ Common error cases include:
|
|
|
232
232
|
- Database connection issues
|
|
233
233
|
- Transaction failures during upsert
|
|
234
234
|
|
|
235
|
-
## Usage
|
|
235
|
+
## Usage example
|
|
236
236
|
|
|
237
237
|
### Local embeddings with fastembed
|
|
238
238
|
|
|
@@ -277,7 +277,7 @@ export const libsqlAgent = new Agent({
|
|
|
277
277
|
name: 'libSQL Agent',
|
|
278
278
|
instructions:
|
|
279
279
|
'You are an AI agent with the ability to automatically recall memories from previous interactions.',
|
|
280
|
-
model: 'openai/gpt-5.
|
|
280
|
+
model: 'openai/gpt-5.4',
|
|
281
281
|
memory: new Memory({
|
|
282
282
|
storage: new LibSQLStore({
|
|
283
283
|
id: 'libsql-agent-storage',
|