@mastra/libsql 1.15.1 → 1.16.0-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.
Files changed (28) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/docs/SKILL.md +4 -2
  3. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  4. package/dist/docs/references/docs-agent-builder-overview.md +4 -3
  5. package/dist/docs/references/docs-agents-agent-approval.md +25 -2
  6. package/dist/docs/references/docs-agents-networks.md +1 -1
  7. package/dist/docs/references/docs-memory-memory-processors.md +67 -0
  8. package/dist/docs/references/docs-memory-message-history.md +56 -2
  9. package/dist/docs/references/docs-memory-overview.md +5 -3
  10. package/dist/docs/references/docs-memory-semantic-recall.md +36 -2
  11. package/dist/docs/references/docs-memory-working-memory.md +3 -3
  12. package/dist/docs/references/docs-storage-overview.md +214 -0
  13. package/dist/docs/references/docs-workflows-snapshots.md +1 -1
  14. package/dist/docs/references/reference-core-mastra-class.md +1 -1
  15. package/dist/docs/references/reference-file-based-agents-memory.md +58 -0
  16. package/dist/docs/references/reference-file-based-agents-storage.md +30 -0
  17. package/dist/docs/references/reference-memory-memory-class.md +1 -1
  18. package/dist/docs/references/reference-storage-composite.md +64 -6
  19. package/dist/docs/references/reference-storage-dynamodb.md +1 -1
  20. package/dist/docs/references/reference-storage-retention.md +74 -6
  21. package/dist/index.cjs +25 -0
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.js +25 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/vector/index.d.ts +12 -0
  26. package/dist/vector/index.d.ts.map +1 -1
  27. package/package.json +8 -8
  28. package/dist/docs/references/docs-memory-storage.md +0 -267
@@ -42,6 +42,18 @@ export declare class LibSQLVector extends MastraVector<LibSQLVectorFilter> {
42
42
  constructor({ url, authToken, syncUrl, syncInterval, maxRetries, initialBackoffMs, vectorTopKOverFetchMultiplier, id, }: LibSQLVectorConfig & {
43
43
  id: string;
44
44
  });
45
+ /**
46
+ * Closes the underlying libsql client, releasing all OS file handles.
47
+ *
48
+ * For local file databases, first runs PRAGMA wal_checkpoint(TRUNCATE) and
49
+ * switches back to journal_mode=DELETE so the -wal and -shm sidecar files
50
+ * are released promptly (mirrors LibSQLStore.close()).
51
+ *
52
+ * Remote (Turso) databases skip the WAL pragmas and just close the client.
53
+ *
54
+ * Safe to call more than once; subsequent calls are no-ops.
55
+ */
56
+ close(): Promise<void>;
45
57
  private discoverVectorIndexes;
46
58
  private executeWriteOperationWithRetry;
47
59
  transformFilter(filter?: LibSQLVectorFilter): LibSQLVectorFilter;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vector/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAqC,MAAM,qBAAqB,CAAC;AACtF,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,UAAU,uBAAwB,SAAQ,iBAAiB,CAAC,kBAAkB,CAAC;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,6BAA6B,CAAC,EAAE,MAAM,CAAC;CACxC;AAED,qBAAa,YAAa,SAAQ,YAAY,CAAC,kBAAkB,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;YAmB9C,cAAc;IAQrB,aAAa,CAAC,IAAI,EAAE,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;YAIpE,eAAe;IAiHtB,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;YAgB9C,gBAAgB;CAM/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/libsql",
3
- "version": "1.15.1",
3
+ "version": "1.16.0-alpha.0",
4
4
  "description": "Libsql provider for Mastra - includes both vector and db storage capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -24,17 +24,17 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "22.19.21",
27
- "@vitest/coverage-v8": "4.1.8",
28
- "@vitest/ui": "4.1.8",
27
+ "@vitest/coverage-v8": "4.1.9",
28
+ "@vitest/ui": "4.1.9",
29
29
  "eslint": "^10.4.1",
30
30
  "tsup": "^8.5.1",
31
31
  "tsx": "^4.22.4",
32
32
  "typescript": "^6.0.3",
33
- "vitest": "4.1.8",
34
- "@internal/storage-test-utils": "0.0.108",
35
- "@internal/lint": "0.0.112",
36
- "@internal/types-builder": "0.0.87",
37
- "@mastra/core": "1.50.0"
33
+ "vitest": "4.1.9",
34
+ "@internal/lint": "0.0.113",
35
+ "@internal/storage-test-utils": "0.0.109",
36
+ "@internal/types-builder": "0.0.88",
37
+ "@mastra/core": "1.51.0-alpha.2"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@mastra/core": ">=1.50.0-0 <2.0.0-0"
@@ -1,267 +0,0 @@
1
- > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
-
3
- # Storage
4
-
5
- For agents to remember previous interactions, Mastra needs a storage adapter. Use one of the [supported providers](#supported-providers) and pass it to your Mastra instance.
6
-
7
- ```typescript
8
- import { Mastra } from '@mastra/core'
9
- import { LibSQLStore } from '@mastra/libsql'
10
-
11
- export const mastra = new Mastra({
12
- storage: new LibSQLStore({
13
- id: 'mastra-storage',
14
- url: 'file:./mastra.db',
15
- }),
16
- })
17
- ```
18
-
19
- > **Sharing the database with Studio:** When running `mastra dev` alongside your application (e.g., Next.js), use an absolute path to ensure both processes access the same database:
20
- >
21
- > ```typescript
22
- > url: 'file:/absolute/path/to/your/project/mastra.db'
23
- > ```
24
- >
25
- > Relative paths like `file:./mastra.db` resolve based on each process's working directory, which may differ.
26
-
27
- This configures instance-level storage, which all agents share by default. You can also configure [agent-level storage](#agent-level-storage) for isolated data boundaries.
28
-
29
- Mastra automatically initializes the necessary storage structures on first interaction. See [Storage Overview](https://mastra.ai/reference/storage/overview) for domain coverage and the schema used by the built-in database-backed domains.
30
-
31
- ## Supported providers
32
-
33
- Each provider page includes installation instructions, configuration parameters, and usage examples:
34
-
35
- - [libSQL](https://mastra.ai/reference/storage/libsql)
36
- - [PostgreSQL](https://mastra.ai/reference/storage/postgresql)
37
- - [MongoDB](https://mastra.ai/reference/storage/mongodb)
38
- - [Upstash](https://mastra.ai/reference/storage/upstash)
39
- - [Redis](https://mastra.ai/reference/storage/redis)
40
- - [Cloudflare D1](https://mastra.ai/reference/storage/cloudflare-d1)
41
- - [Cloudflare KV & Durable Objects](https://mastra.ai/reference/storage/cloudflare)
42
- - [Convex](https://mastra.ai/reference/storage/convex)
43
- - [DynamoDB](https://mastra.ai/reference/storage/dynamodb)
44
- - [LanceDB](https://mastra.ai/reference/storage/lance)
45
- - [Microsoft SQL Server](https://mastra.ai/reference/storage/mssql)
46
- - [Google Cloud Spanner](https://mastra.ai/reference/storage/spanner)
47
-
48
- > **Tip:** libSQL is the easiest way to get started because it doesn’t require running a separate database server.
49
-
50
- ## Configuration scope
51
-
52
- Storage can be configured at the instance level (shared by all agents) or at the agent level (isolated to a specific agent).
53
-
54
- ### Instance-level storage
55
-
56
- Add storage to your Mastra instance so all agents, workflows, observability traces, and scores share the same storage backend:
57
-
58
- ```typescript
59
- import { Mastra } from '@mastra/core'
60
- import { PostgresStore } from '@mastra/pg'
61
-
62
- export const mastra = new Mastra({
63
- storage: new PostgresStore({
64
- id: 'mastra-storage',
65
- connectionString: process.env.DATABASE_URL,
66
- }),
67
- })
68
-
69
- // Both agents inherit storage from the Mastra instance above
70
- const agent1 = new Agent({ id: 'agent-1', memory: new Memory() })
71
- const agent2 = new Agent({ id: 'agent-2', memory: new Memory() })
72
- ```
73
-
74
- This is useful when all primitives share the same storage backend and have similar performance, scaling, and operational requirements.
75
-
76
- #### Composite storage
77
-
78
- [Composite storage](https://mastra.ai/reference/storage/composite) is an alternative way to configure instance-level storage. Use `MastraCompositeStore` to route `memory` and any other [supported domains](https://mastra.ai/reference/storage/composite) to different storage providers.
79
-
80
- ```typescript
81
- import { Mastra } from '@mastra/core'
82
- import { MastraCompositeStore } from '@mastra/core/storage'
83
- import { MemoryLibSQL } from '@mastra/libsql'
84
- import { WorkflowsPG } from '@mastra/pg'
85
- import { ObservabilityStorageClickhouse } from '@mastra/clickhouse'
86
-
87
- export const mastra = new Mastra({
88
- storage: new MastraCompositeStore({
89
- id: 'composite',
90
- domains: {
91
- memory: new MemoryLibSQL({ url: 'file:./memory.db' }),
92
- workflows: new WorkflowsPG({ connectionString: process.env.DATABASE_URL }),
93
- observability: new ObservabilityStorageClickhouse({
94
- url: process.env.CLICKHOUSE_URL,
95
- username: process.env.CLICKHOUSE_USERNAME,
96
- password: process.env.CLICKHOUSE_PASSWORD,
97
- }),
98
- },
99
- }),
100
- })
101
- ```
102
-
103
- This is useful when different types of data have different performance or operational requirements, such as low-latency storage for memory, durable storage for workflows, and high-throughput storage for observability.
104
-
105
- #### Retention
106
-
107
- Storage grows without bound by default. To cap growth, declare per-table `maxAge` policies in the `retention` config and call `storage.prune()` from your own scheduler to delete old rows. Anything you don't configure is kept forever. See [Storage retention](https://mastra.ai/reference/storage/retention) for `prune()` and the full config shape.
108
-
109
- ### Agent-level storage
110
-
111
- Agent-level storage overrides storage configured at the instance level. Add storage to a specific agent when you need to keep data separate or use different providers per agent.
112
-
113
- ```typescript
114
- import { Agent } from '@mastra/core/agent'
115
- import { Memory } from '@mastra/memory'
116
- import { PostgresStore } from '@mastra/pg'
117
-
118
- export const agent = new Agent({
119
- id: 'agent',
120
- memory: new Memory({
121
- storage: new PostgresStore({
122
- id: 'agent-storage',
123
- connectionString: process.env.AGENT_DATABASE_URL,
124
- }),
125
- }),
126
- })
127
- ```
128
-
129
- ## Threads and resources
130
-
131
- Mastra organizes conversations using two identifiers:
132
-
133
- - **Thread**: A conversation session containing a sequence of messages.
134
- - **Resource**: The entity that owns the thread, such as a user, organization, project, or any other domain entity in your application.
135
-
136
- Both identifiers are required for agents to store information:
137
-
138
- **.generate()**:
139
-
140
- ```typescript
141
- const response = await agent.generate('hello', {
142
- memory: {
143
- thread: 'conversation-abc-123',
144
- resource: 'user_123',
145
- },
146
- })
147
- ```
148
-
149
- **.stream()**:
150
-
151
- ```typescript
152
- const stream = await agent.stream('hello', {
153
- memory: {
154
- thread: 'conversation-abc-123',
155
- resource: 'user_123',
156
- },
157
- })
158
- ```
159
-
160
- > **Note:** [Studio](https://mastra.ai/docs/studio/overview) automatically generates a thread and resource ID for you. When calling `stream()` or `generate()` yourself, remember to provide these identifiers explicitly.
161
-
162
- ### Thread title generation
163
-
164
- Mastra can automatically generate descriptive thread titles based on the user's first message when `generateTitle` is enabled.
165
-
166
- Use this option when implementing a ChatGPT-style chat interface to render a title alongside each thread in the conversation list (for example, in a sidebar) derived from the thread’s initial user message.
167
-
168
- ```typescript
169
- export const agent = new Agent({
170
- id: 'agent',
171
- memory: new Memory({
172
- options: {
173
- generateTitle: true,
174
- },
175
- }),
176
- })
177
- ```
178
-
179
- Title generation runs asynchronously after the agent responds and doesn't affect response time.
180
-
181
- To optimize cost or behavior, provide a smaller [`model`](https://mastra.ai/models) and custom `instructions`:
182
-
183
- ```typescript
184
- export const agent = new Agent({
185
- id: 'agent',
186
- memory: new Memory({
187
- options: {
188
- generateTitle: {
189
- model: 'openai/gpt-5-mini',
190
- instructions: 'Generate a 1 word title',
191
- },
192
- },
193
- }),
194
- })
195
- ```
196
-
197
- ## Semantic recall
198
-
199
- Semantic recall has different storage requirements - it needs a vector database in addition to the standard storage adapter. See [Semantic recall](https://mastra.ai/docs/memory/semantic-recall) for setup and supported vector providers.
200
-
201
- ## Handling large attachments
202
-
203
- Some storage providers enforce record size limits that base64-encoded file attachments (such as images) can exceed:
204
-
205
- | Provider | Record size limit |
206
- | ------------------------------------------------------------------ | ----------------- |
207
- | [DynamoDB](https://mastra.ai/reference/storage/dynamodb) | 400 KB |
208
- | [Convex](https://mastra.ai/reference/storage/convex) | 1 MiB |
209
- | [Cloudflare D1](https://mastra.ai/reference/storage/cloudflare-d1) | 1 MiB |
210
-
211
- PostgreSQL, MongoDB, and libSQL have higher limits and are generally unaffected.
212
-
213
- To avoid this, use an input processor to upload attachments to external storage (S3, R2, GCS, [Convex file storage](https://docs.convex.dev/file-storage), etc.) and replace them with URL references before persistence.
214
-
215
- ```typescript
216
- import type { Processor } from '@mastra/core/processors'
217
- import type { MastraDBMessage } from '@mastra/core/memory'
218
-
219
- export class AttachmentUploader implements Processor {
220
- id = 'attachment-uploader'
221
-
222
- async processInput({ messages }: { messages: MastraDBMessage[] }) {
223
- return Promise.all(messages.map(msg => this.processMessage(msg)))
224
- }
225
-
226
- async processMessage(msg: MastraDBMessage) {
227
- const attachments = msg.content.experimental_attachments
228
- if (!attachments?.length) return msg
229
-
230
- const uploaded = await Promise.all(
231
- attachments.map(async att => {
232
- // Skip if already a URL
233
- if (!att.url?.startsWith('data:')) return att
234
-
235
- // Upload base64 data and replace with URL
236
- const url = await this.upload(att.url, att.contentType)
237
- return { ...att, url }
238
- }),
239
- )
240
-
241
- return { ...msg, content: { ...msg.content, experimental_attachments: uploaded } }
242
- }
243
-
244
- async upload(dataUri: string, contentType?: string): Promise<string> {
245
- const base64 = dataUri.split(',')[1]
246
- const buffer = Buffer.from(base64, 'base64')
247
-
248
- // Replace with your storage provider (S3, R2, GCS, Convex, etc.)
249
- // return await s3.upload(buffer, contentType);
250
- throw new Error('Implement upload() with your storage provider')
251
- }
252
- }
253
- ```
254
-
255
- Use the processor with your agent:
256
-
257
- ```typescript
258
- import { Agent } from '@mastra/core/agent'
259
- import { Memory } from '@mastra/memory'
260
- import { AttachmentUploader } from './processors/attachment-uploader'
261
-
262
- const agent = new Agent({
263
- id: 'my-agent',
264
- memory: new Memory({ storage: yourStorage }),
265
- inputProcessors: [new AttachmentUploader()],
266
- })
267
- ```