@mastra/libsql 1.1.0 → 1.2.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.
- package/CHANGELOG.md +89 -0
- package/dist/docs/README.md +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/SOURCE_MAP.json +1 -1
- package/dist/docs/memory/02-storage.md +10 -0
- package/dist/index.cjs +673 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +673 -15
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/agents/index.d.ts +2 -1
- package/dist/storage/domains/agents/index.d.ts.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +14 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,94 @@
|
|
|
1
1
|
# @mastra/libsql
|
|
2
2
|
|
|
3
|
+
## 1.2.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added Observational Memory — a new memory system that keeps your agent's context window small while preserving long-term memory across conversations. ([#12599](https://github.com/mastra-ai/mastra/pull/12599))
|
|
8
|
+
|
|
9
|
+
**Why:** Long conversations cause context rot and waste tokens. Observational Memory compresses conversation history into observations (5–40x compression) and periodically condenses those into reflections. Your agent stays fast and focused, even after thousands of messages.
|
|
10
|
+
|
|
11
|
+
**Usage:**
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { Memory } from '@mastra/memory';
|
|
15
|
+
import { PostgresStore } from '@mastra/pg';
|
|
16
|
+
|
|
17
|
+
const memory = new Memory({
|
|
18
|
+
storage: new PostgresStore({ connectionString: process.env.DATABASE_URL }),
|
|
19
|
+
options: {
|
|
20
|
+
observationalMemory: true,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const agent = new Agent({
|
|
25
|
+
name: 'my-agent',
|
|
26
|
+
model: openai('gpt-4o'),
|
|
27
|
+
memory,
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**What's new:**
|
|
32
|
+
- `observationalMemory: true` enables the three-tier memory system (recent messages → observations → reflections)
|
|
33
|
+
- Thread-scoped (per-conversation) and resource-scoped (shared across all threads for a user) modes
|
|
34
|
+
- Manual `observe()` API for triggering observation outside the normal agent loop
|
|
35
|
+
- New OM storage methods for pg, libsql, and mongodb adapters (conditionally enabled)
|
|
36
|
+
- `Agent.findProcessor()` method for looking up processors by ID
|
|
37
|
+
- `processorStates` for persisting processor state across loop iterations
|
|
38
|
+
- Abort signal propagation to processors
|
|
39
|
+
- `ProcessorStreamWriter` for custom stream events from processors
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Created @mastra/editor package for managing and resolving stored agent configurations ([#12631](https://github.com/mastra-ai/mastra/pull/12631))
|
|
44
|
+
|
|
45
|
+
This major addition introduces the editor package, which provides a complete solution for storing, versioning, and instantiating agent configurations from a database. The editor seamlessly integrates with Mastra's storage layer to enable dynamic agent management.
|
|
46
|
+
|
|
47
|
+
**Key Features:**
|
|
48
|
+
- **Agent Storage & Retrieval**: Store complete agent configurations including instructions, model settings, tools, workflows, nested agents, scorers, processors, and memory configuration
|
|
49
|
+
- **Version Management**: Create and manage multiple versions of agents, with support for activating specific versions
|
|
50
|
+
- **Dependency Resolution**: Automatically resolves and instantiates all agent dependencies (tools, workflows, sub-agents, etc.) from the Mastra registry
|
|
51
|
+
- **Caching**: Built-in caching for improved performance when repeatedly accessing stored agents
|
|
52
|
+
- **Type Safety**: Full TypeScript support with proper typing for stored configurations
|
|
53
|
+
|
|
54
|
+
**Usage Example:**
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { MastraEditor } from '@mastra/editor';
|
|
58
|
+
import { Mastra } from '@mastra/core';
|
|
59
|
+
|
|
60
|
+
// Initialize editor with Mastra
|
|
61
|
+
const mastra = new Mastra({
|
|
62
|
+
/* config */
|
|
63
|
+
editor: new MastraEditor(),
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Store an agent configuration
|
|
67
|
+
const agentId = await mastra.storage.stores?.agents?.createAgent({
|
|
68
|
+
name: 'customer-support',
|
|
69
|
+
instructions: 'Help customers with inquiries',
|
|
70
|
+
model: { provider: 'openai', name: 'gpt-4' },
|
|
71
|
+
tools: ['search-kb', 'create-ticket'],
|
|
72
|
+
workflows: ['escalation-flow'],
|
|
73
|
+
memory: { vector: 'pinecone-db' },
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Retrieve and use the stored agent
|
|
77
|
+
const agent = await mastra.getEditor()?.getStoredAgentById(agentId);
|
|
78
|
+
const response = await agent?.generate('How do I reset my password?');
|
|
79
|
+
|
|
80
|
+
// List all stored agents
|
|
81
|
+
const agents = await mastra.getEditor()?.listStoredAgents({ pageSize: 10 });
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Storage Improvements:**
|
|
85
|
+
- Fixed JSONB handling in LibSQL, PostgreSQL, and MongoDB adapters
|
|
86
|
+
- Improved agent resolution queries to properly merge version data
|
|
87
|
+
- Enhanced type safety for serialized configurations
|
|
88
|
+
|
|
89
|
+
- Updated dependencies [[`2770921`](https://github.com/mastra-ai/mastra/commit/2770921eec4d55a36b278d15c3a83f694e462ee5), [`b1695db`](https://github.com/mastra-ai/mastra/commit/b1695db2d7be0c329d499619c7881899649188d0), [`4133d48`](https://github.com/mastra-ai/mastra/commit/4133d48eaa354cdb45920dc6265732ffbc96788d), [`5dd01cc`](https://github.com/mastra-ai/mastra/commit/5dd01cce68d61874aa3ecbd91ee17884cfd5aca2), [`13e0a2a`](https://github.com/mastra-ai/mastra/commit/13e0a2a2bcec01ff4d701274b3727d5e907a6a01), [`c987384`](https://github.com/mastra-ai/mastra/commit/c987384d6c8ca844a9701d7778f09f5a88da7f9f), [`cb8cc12`](https://github.com/mastra-ai/mastra/commit/cb8cc12bfadd526aa95a01125076f1da44e4afa7), [`62f5d50`](https://github.com/mastra-ai/mastra/commit/62f5d5043debbba497dacb7ab008fe86b38b8de3)]:
|
|
90
|
+
- @mastra/core@1.2.0-alpha.1
|
|
91
|
+
|
|
3
92
|
## 1.1.0
|
|
4
93
|
|
|
5
94
|
### Minor Changes
|
package/dist/docs/README.md
CHANGED
package/dist/docs/SKILL.md
CHANGED
|
@@ -15,6 +15,16 @@ export const mastra = new Mastra({
|
|
|
15
15
|
}),
|
|
16
16
|
});
|
|
17
17
|
```
|
|
18
|
+
|
|
19
|
+
> **Sharing the database with Mastra Studio**
|
|
20
|
+
When running `mastra dev` alongside your application (e.g., Next.js), use an absolute path to ensure both processes access the same database:
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
url: "file:/absolute/path/to/your/project/mastra.db"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Relative paths like `file:./mastra.db` resolve based on each process's working directory, which may differ.
|
|
27
|
+
|
|
18
28
|
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.
|
|
19
29
|
|
|
20
30
|
Mastra automatically creates the necessary tables on first interaction. See the [core schema](https://mastra.ai/reference/storage/overview#core-schema) for details on what gets created, including tables for messages, threads, resources, workflows, traces, and evaluation datasets.
|