@olivia-db/mastra 0.1.0 → 0.1.2
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/README.md +41 -0
- package/package.json +4 -3
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
|
2
|
+
# @olivia-db/mastra
|
|
3
|
+
|
|
4
|
+
[OliviaDB](https://olivia-db.com/) storage for [Mastra](https://mastra.ai/) memory: the
|
|
5
|
+
`MemoryStorage` domain (`OliviaDBMemoryStorage`) keeps threads, messages, resources and
|
|
6
|
+
working memory in OliviaDB, so they outlive the process and every instance that reaches the
|
|
7
|
+
server shares them. A concurrent change is reported (`OliviaDbConflictError`), never lost.
|
|
8
|
+
Tested with @mastra/core 1.86.0 and @mastra/memory 1.41.3.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install @olivia-db/mastra @olivia-db/client @mastra/core @mastra/memory
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { OliviaDbClient } from "@olivia-db/client";
|
|
20
|
+
import { OliviaDBMemoryStorage } from "@olivia-db/mastra";
|
|
21
|
+
import { MastraCompositeStore } from "@mastra/core/storage";
|
|
22
|
+
import { Memory } from "@mastra/memory";
|
|
23
|
+
|
|
24
|
+
const client = new OliviaDbClient({ baseUrl: "https://localhost:8443", apiKey: process.env.OLIVIADB_API_KEY });
|
|
25
|
+
const storage = new MastraCompositeStore({
|
|
26
|
+
id: "oliviadb",
|
|
27
|
+
domains: { memory: new OliviaDBMemoryStorage(client, ["mastra", "support"]) },
|
|
28
|
+
});
|
|
29
|
+
const memory = new Memory({ storage, options: { lastMessages: 10 } });
|
|
30
|
+
const thread = await memory.createThread({ resourceId: "user-1", title: "Support" });
|
|
31
|
+
console.log(thread.id);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Give the same `memory` to a Mastra `Agent`.
|
|
35
|
+
|
|
36
|
+
## Links
|
|
37
|
+
|
|
38
|
+
* Documentation: <https://docs.olivia-db.com/>
|
|
39
|
+
* Repository: <https://github.com/OliviaDB/oliviadb-js> (`adapters/mastra`)
|
|
40
|
+
|
|
41
|
+
Licence: Apache-2.0.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olivia-db/mastra",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Mastra memory storage backed by OliviaDB",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
|
-
"src"
|
|
17
|
+
"src",
|
|
18
|
+
"README.md"
|
|
18
19
|
],
|
|
19
20
|
"repository": {
|
|
20
21
|
"type": "git",
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
"test": "node --test --test-force-exit test/*.test.ts"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"@olivia-db/client": "0.1.
|
|
35
|
+
"@olivia-db/client": "0.1.2",
|
|
35
36
|
"@mastra/core": "1.86.0",
|
|
36
37
|
"@mastra/memory": "1.41.3"
|
|
37
38
|
}
|