@mastra/libsql 0.0.0-working-memory-undefined-20260212204651 → 0.0.0-workshop-yj-20260903030708

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 (109) hide show
  1. package/LICENSE.md +17 -0
  2. package/README.md +13 -107
  3. package/dist/docs/SKILL.md +30 -27
  4. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  5. package/dist/docs/references/docs-agents-human-in-the-loop.md +682 -0
  6. package/dist/docs/references/docs-agents-networks.md +109 -213
  7. package/dist/docs/references/docs-deployment-workers.md +394 -0
  8. package/dist/docs/references/docs-memory-memory-processors.md +162 -91
  9. package/dist/docs/references/docs-memory-message-history.md +160 -70
  10. package/dist/docs/references/docs-memory-multi-user-threads.md +210 -0
  11. package/dist/docs/references/docs-memory-overview.md +248 -25
  12. package/dist/docs/references/docs-memory-semantic-recall.md +228 -79
  13. package/dist/docs/references/docs-memory-working-memory.md +104 -70
  14. package/dist/docs/references/docs-storage.md +222 -0
  15. package/dist/docs/references/docs-studio-editor.md +353 -0
  16. package/dist/docs/references/docs-workflows-snapshots.md +51 -45
  17. package/dist/docs/references/integrations-channels-github.md +152 -0
  18. package/dist/docs/references/{reference-storage-dynamodb.md → integrations-databases-dynamodb.md} +48 -44
  19. package/dist/docs/references/{reference-storage-libsql.md → integrations-databases-libsql.md} +54 -28
  20. package/dist/docs/references/{guides-agent-frameworks-ai-sdk.md → reference-ai-sdk-overview.md} +42 -38
  21. package/dist/docs/references/reference-core-getMemory.md +19 -16
  22. package/dist/docs/references/reference-core-listMemory.md +21 -18
  23. package/dist/docs/references/reference-core-mastra-class.md +119 -28
  24. package/dist/docs/references/reference-file-based-agents-memory.md +62 -0
  25. package/dist/docs/references/reference-file-based-agents-storage.md +34 -0
  26. package/dist/docs/references/reference-memory-memory-class.md +48 -44
  27. package/dist/docs/references/{docs-rag-retrieval.md → reference-rag-retrieval.md} +286 -152
  28. package/dist/docs/references/reference-storage-composite.md +223 -59
  29. package/dist/docs/references/reference-storage-retention.md +250 -0
  30. package/dist/docs/references/reference-vectors-libsql.md +77 -73
  31. package/dist/index.cjs +14255 -7157
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.js +14222 -7140
  34. package/dist/index.js.map +1 -1
  35. package/dist/storage/db/client.d.ts +31 -0
  36. package/dist/storage/db/client.d.ts.map +1 -0
  37. package/dist/storage/db/index.d.ts +86 -2
  38. package/dist/storage/db/index.d.ts.map +1 -1
  39. package/dist/storage/db/utils.d.ts +17 -1
  40. package/dist/storage/db/utils.d.ts.map +1 -1
  41. package/dist/storage/db/write-lock.d.ts +8 -0
  42. package/dist/storage/db/write-lock.d.ts.map +1 -0
  43. package/dist/storage/domains/agents/index.d.ts +1 -0
  44. package/dist/storage/domains/agents/index.d.ts.map +1 -1
  45. package/dist/storage/domains/background-tasks/index.d.ts +29 -0
  46. package/dist/storage/domains/background-tasks/index.d.ts.map +1 -0
  47. package/dist/storage/domains/blobs/index.d.ts +17 -0
  48. package/dist/storage/domains/blobs/index.d.ts.map +1 -0
  49. package/dist/storage/domains/channels/index.d.ts +20 -0
  50. package/dist/storage/domains/channels/index.d.ts.map +1 -0
  51. package/dist/storage/domains/datasets/index.d.ts +43 -0
  52. package/dist/storage/domains/datasets/index.d.ts.map +1 -0
  53. package/dist/storage/domains/experiments/index.d.ts +55 -0
  54. package/dist/storage/domains/experiments/index.d.ts.map +1 -0
  55. package/dist/storage/domains/favorites/index.d.ts +17 -0
  56. package/dist/storage/domains/favorites/index.d.ts.map +1 -0
  57. package/dist/storage/domains/harness/index.d.ts +17 -0
  58. package/dist/storage/domains/harness/index.d.ts.map +1 -0
  59. package/dist/storage/domains/knowledge/index.d.ts +81 -0
  60. package/dist/storage/domains/knowledge/index.d.ts.map +1 -0
  61. package/dist/storage/domains/mcp-clients/index.d.ts.map +1 -1
  62. package/dist/storage/domains/mcp-servers/index.d.ts +26 -0
  63. package/dist/storage/domains/mcp-servers/index.d.ts.map +1 -0
  64. package/dist/storage/domains/memory/index.d.ts +30 -5
  65. package/dist/storage/domains/memory/index.d.ts.map +1 -1
  66. package/dist/storage/domains/notifications/index.d.ts +23 -0
  67. package/dist/storage/domains/notifications/index.d.ts.map +1 -0
  68. package/dist/storage/domains/observability/index.d.ts +9 -1
  69. package/dist/storage/domains/observability/index.d.ts.map +1 -1
  70. package/dist/storage/domains/prompt-blocks/index.d.ts.map +1 -1
  71. package/dist/storage/domains/schedules/index.d.ts +27 -0
  72. package/dist/storage/domains/schedules/index.d.ts.map +1 -0
  73. package/dist/storage/domains/scorer-definitions/index.d.ts.map +1 -1
  74. package/dist/storage/domains/scores/index.d.ts +15 -5
  75. package/dist/storage/domains/scores/index.d.ts.map +1 -1
  76. package/dist/storage/domains/skills/index.d.ts +27 -0
  77. package/dist/storage/domains/skills/index.d.ts.map +1 -0
  78. package/dist/storage/domains/thread-state/index.d.ts +38 -0
  79. package/dist/storage/domains/thread-state/index.d.ts.map +1 -0
  80. package/dist/storage/domains/tool-provider-connections/index.d.ts +14 -0
  81. package/dist/storage/domains/tool-provider-connections/index.d.ts.map +1 -0
  82. package/dist/storage/domains/utils.d.ts +34 -0
  83. package/dist/storage/domains/utils.d.ts.map +1 -0
  84. package/dist/storage/domains/workflow-definitions/index.d.ts +14 -0
  85. package/dist/storage/domains/workflow-definitions/index.d.ts.map +1 -0
  86. package/dist/storage/domains/workflows/index.d.ts +9 -1
  87. package/dist/storage/domains/workflows/index.d.ts.map +1 -1
  88. package/dist/storage/domains/workspaces/index.d.ts +26 -0
  89. package/dist/storage/domains/workspaces/index.d.ts.map +1 -0
  90. package/dist/storage/factory-storage.d.ts +28 -0
  91. package/dist/storage/factory-storage.d.ts.map +1 -0
  92. package/dist/storage/index.d.ts +85 -3
  93. package/dist/storage/index.d.ts.map +1 -1
  94. package/dist/storage/retention.d.ts +77 -0
  95. package/dist/storage/retention.d.ts.map +1 -0
  96. package/dist/vector/filter.d.ts.map +1 -1
  97. package/dist/vector/index.d.ts +26 -1
  98. package/dist/vector/index.d.ts.map +1 -1
  99. package/dist/vector/sql-builder.d.ts.map +1 -1
  100. package/dist/vector/write-lock.d.ts +7 -0
  101. package/dist/vector/write-lock.d.ts.map +1 -0
  102. package/package.json +20 -19
  103. package/CHANGELOG.md +0 -3696
  104. package/dist/docs/references/docs-agents-agent-approval.md +0 -377
  105. package/dist/docs/references/docs-agents-agent-memory.md +0 -212
  106. package/dist/docs/references/docs-agents-network-approval.md +0 -275
  107. package/dist/docs/references/docs-memory-storage.md +0 -261
  108. package/dist/docs/references/docs-observability-overview.md +0 -70
  109. package/dist/docs/references/docs-observability-tracing-exporters-default.md +0 -211
@@ -1,211 +0,0 @@
1
- # Default Exporter
2
-
3
- The `DefaultExporter` persists traces to your configured storage backend, making them accessible through Studio. It's automatically enabled when using the default observability configuration and requires no external services.
4
-
5
- > **Production Observability:** Observability data can quickly overwhelm general-purpose databases in production. For high-traffic applications, we recommend using **ClickHouse** for the observability storage domain via [composite storage](https://mastra.ai/reference/storage/composite). See [Production Recommendations](#production-recommendations) for details.
6
-
7
- ## Configuration
8
-
9
- ### Prerequisites
10
-
11
- 1. **Storage Backend**: Configure a storage provider (libSQL, PostgreSQL, etc.)
12
- 2. **Studio**: Install for viewing traces locally
13
-
14
- ### Basic Setup
15
-
16
- ```typescript
17
- import { Mastra } from "@mastra/core";
18
- import { Observability, DefaultExporter } from "@mastra/observability";
19
- import { LibSQLStore } from "@mastra/libsql";
20
-
21
- export const mastra = new Mastra({
22
- storage: new LibSQLStore({
23
- id: 'mastra-storage',
24
- url: "file:./mastra.db", // Required for trace persistence
25
- }),
26
- observability: new Observability({
27
- configs: {
28
- local: {
29
- serviceName: "my-service",
30
- exporters: [new DefaultExporter()],
31
- },
32
- },
33
- }),
34
- });
35
- ```
36
-
37
- ### Recommended Configuration
38
-
39
- Include DefaultExporter in your observability configuration:
40
-
41
- ```typescript
42
- import { Mastra } from "@mastra/core";
43
- import {
44
- Observability,
45
- DefaultExporter,
46
- CloudExporter,
47
- SensitiveDataFilter,
48
- } from "@mastra/observability";
49
- import { LibSQLStore } from "@mastra/libsql";
50
-
51
- export const mastra = new Mastra({
52
- storage: new LibSQLStore({
53
- id: 'mastra-storage',
54
- url: "file:./mastra.db",
55
- }),
56
- observability: new Observability({
57
- configs: {
58
- default: {
59
- serviceName: "mastra",
60
- exporters: [
61
- new DefaultExporter(), // Persists traces to storage for Mastra Studio
62
- new CloudExporter(), // Sends traces to Mastra Cloud (requires MASTRA_CLOUD_ACCESS_TOKEN)
63
- ],
64
- spanOutputProcessors: [
65
- new SensitiveDataFilter(),
66
- ],
67
- },
68
- },
69
- }),
70
- });
71
- ```
72
-
73
- ## Viewing Traces
74
-
75
- ### Studio
76
-
77
- Access your traces through Studio:
78
-
79
- 1. Start Studio
80
- 2. Navigate to Observability
81
- 3. Filter and search your local traces
82
- 4. Inspect detailed span information
83
-
84
- ## Tracing Strategies
85
-
86
- DefaultExporter automatically selects the optimal tracing strategy based on your storage provider. You can also override this selection if needed.
87
-
88
- ### Available Strategies
89
-
90
- | Strategy | Description | Use Case |
91
- | ---------------------- | --------------------------------------------------------- | ----------------------------------- |
92
- | **realtime** | Process each event immediately | Development, debugging, low traffic |
93
- | **batch-with-updates** | Buffer events and batch write with full lifecycle support | Low volume Production |
94
- | **insert-only** | Only process completed spans, ignore updates | High volume Production |
95
-
96
- ### Strategy Configuration
97
-
98
- ```typescript
99
- new DefaultExporter({
100
- strategy: "auto", // Default - let storage provider decide
101
- // or explicitly set:
102
- // strategy: 'realtime' | 'batch-with-updates' | 'insert-only'
103
-
104
- // Batching configuration (applies to both batch-with-updates and insert-only)
105
- maxBatchSize: 1000, // Max spans per batch
106
- maxBatchWaitMs: 5000, // Max wait before flushing
107
- maxBufferSize: 10000, // Max spans to buffer
108
- });
109
- ```
110
-
111
- ## Storage Provider Support
112
-
113
- Different storage providers support different tracing strategies. Some providers support observability for production workloads, while others are intended primarily for local development.
114
-
115
- If you set the strategy to `'auto'`, the `DefaultExporter` automatically selects the optimal strategy for the storage provider. If you set the strategy to a mode that the storage provider doesn't support, you will get an error message.
116
-
117
- ### Providers with Observability Support
118
-
119
- | Storage Provider | Preferred Strategy | Supported Strategies | Recommended Use |
120
- | ---------------------------------------------------------------- | ------------------ | ------------------------------- | ------------------------------------- |
121
- | **ClickHouse** (`@mastra/clickhouse`) | insert-only | insert-only | Production (high-volume) |
122
- | **[PostgreSQL](https://mastra.ai/reference/storage/postgresql)** | batch-with-updates | batch-with-updates, insert-only | Production (low volume) |
123
- | **[MSSQL](https://mastra.ai/reference/storage/mssql)** | batch-with-updates | batch-with-updates, insert-only | Production (low volume) |
124
- | **[MongoDB](https://mastra.ai/reference/storage/mongodb)** | batch-with-updates | batch-with-updates, insert-only | Production (low volume) |
125
- | **[libSQL](https://mastra.ai/reference/storage/libsql)** | batch-with-updates | batch-with-updates, insert-only | Default storage, good for development |
126
-
127
- ### Providers without Observability Support
128
-
129
- The following storage providers **do not support** the observability domain. If you're using one of these providers and need observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider:
130
-
131
- - [Convex](https://mastra.ai/reference/storage/convex)
132
- - [DynamoDB](https://mastra.ai/reference/storage/dynamodb)
133
- - [Cloudflare D1](https://mastra.ai/reference/storage/cloudflare-d1)
134
- - [Cloudflare Durable Objects](https://mastra.ai/reference/storage/cloudflare)
135
- - [Upstash](https://mastra.ai/reference/storage/upstash)
136
- - [LanceDB](https://mastra.ai/reference/storage/lance)
137
-
138
- ### Strategy Benefits
139
-
140
- - **realtime**: Immediate visibility, best for debugging
141
- - **batch-with-updates**: 10-100x throughput improvement, full span lifecycle
142
- - **insert-only**: Additional 70% reduction in database operations, perfect for analytics
143
-
144
- ## Production Recommendations
145
-
146
- Observability data grows quickly in production environments. A single agent interaction can generate hundreds of spans, and high-traffic applications can produce thousands of traces per day. Most general-purpose databases aren't optimized for this write-heavy, append-only workload.
147
-
148
- ### Recommended: ClickHouse for High-Volume Production
149
-
150
- [ClickHouse](https://mastra.ai/reference/storage/composite) is a columnar database designed for high-volume analytics workloads. It's the recommended choice for production observability because:
151
-
152
- - **Optimized for writes**: Handles millions of inserts per second
153
- - **Efficient compression**: Reduces storage costs for trace data
154
- - **Fast queries**: Columnar storage enables quick trace lookups and aggregations
155
- - **Time-series native**: Built-in support for time-based data retention and partitioning
156
-
157
- ### Using Composite Storage
158
-
159
- If you're using a provider without observability support (like Convex or DynamoDB) or want to optimize performance, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to ClickHouse while keeping other data in your primary database.
160
-
161
- ## Batching Behavior
162
-
163
- ### Flush Triggers
164
-
165
- For both batch strategies (`batch-with-updates` and `insert-only`), traces are flushed to storage when any of these conditions are met:
166
-
167
- 1. **Size trigger**: Buffer reaches `maxBatchSize` spans
168
- 2. **Time trigger**: `maxBatchWaitMs` elapsed since first event
169
- 3. **Emergency flush**: Buffer approaches `maxBufferSize` limit
170
- 4. **Shutdown**: Force flush all pending events
171
-
172
- ### Error Handling
173
-
174
- The DefaultExporter includes robust error handling for production use:
175
-
176
- - **Retry Logic**: Exponential backoff (500ms, 1s, 2s, 4s)
177
- - **Transient Failures**: Automatic retry with backoff
178
- - **Persistent Failures**: Drop batch after 4 failed attempts
179
- - **Buffer Overflow**: Prevent memory issues during storage outages
180
-
181
- ### Configuration Examples
182
-
183
- ```typescript
184
- // Zero config - recommended for most users
185
- new DefaultExporter();
186
-
187
- // Development override
188
- new DefaultExporter({
189
- strategy: "realtime", // Immediate visibility for debugging
190
- });
191
-
192
- // High-throughput production
193
- new DefaultExporter({
194
- maxBatchSize: 2000, // Larger batches
195
- maxBatchWaitMs: 10000, // Wait longer to fill batches
196
- maxBufferSize: 50000, // Handle longer outages
197
- });
198
-
199
- // Low-latency production
200
- new DefaultExporter({
201
- maxBatchSize: 100, // Smaller batches
202
- maxBatchWaitMs: 1000, // Flush quickly
203
- });
204
- ```
205
-
206
- ## Related
207
-
208
- - [Tracing Overview](https://mastra.ai/docs/observability/tracing/overview)
209
- - [CloudExporter](https://mastra.ai/docs/observability/tracing/exporters/cloud)
210
- - [Composite Storage](https://mastra.ai/reference/storage/composite) - Combine multiple storage providers
211
- - [Storage Configuration](https://mastra.ai/docs/memory/storage)