mimir-memory 0.1.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/LICENSE +21 -0
- package/README.md +66 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.js +85 -0
- package/package.json +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Arjun Subburaj
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# mimir-memory (npm)
|
|
2
|
+
|
|
3
|
+
> TypeScript/JavaScript SDK for the [Mimir](https://github.com/junainfinity/Mimir) agentic memory system.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
Mimir's Python server must be running:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install mimir-memory[server]
|
|
11
|
+
mimir-server # starts on http://localhost:8484
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install mimir-memory
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { Mimir } from "mimir-memory";
|
|
24
|
+
|
|
25
|
+
const mimir = new Mimir(); // defaults to http://localhost:8484
|
|
26
|
+
|
|
27
|
+
// Archive a fact
|
|
28
|
+
await mimir.archive({
|
|
29
|
+
content: "John lives in London",
|
|
30
|
+
source: "user",
|
|
31
|
+
relation: "lives_in",
|
|
32
|
+
target: "London",
|
|
33
|
+
scope: "user",
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// Search memory
|
|
37
|
+
const result = await mimir.search({ query: "Where does John live?" });
|
|
38
|
+
console.log(result);
|
|
39
|
+
// { result: "Found Context:\n- [... → Present]: user --(lives_in)--> London" }
|
|
40
|
+
|
|
41
|
+
// Temporal query
|
|
42
|
+
const past = await mimir.search({
|
|
43
|
+
query: "Where did John live?",
|
|
44
|
+
timestamp: "2026-01-01T00:00:00",
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Health check
|
|
48
|
+
const health = await mimir.health();
|
|
49
|
+
console.log(health); // { status: "ok", version: "0.1.0" }
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## API
|
|
53
|
+
|
|
54
|
+
### `new Mimir(options?)`
|
|
55
|
+
| Option | Type | Default | Description |
|
|
56
|
+
|--------|------|---------|-------------|
|
|
57
|
+
| `baseUrl` | `string` | `http://localhost:8484` | Mimir server URL |
|
|
58
|
+
|
|
59
|
+
### `mimir.archive(params)`
|
|
60
|
+
Archive a fact into bitemporal memory.
|
|
61
|
+
|
|
62
|
+
### `mimir.search(params)`
|
|
63
|
+
Search memory with optional temporal filtering.
|
|
64
|
+
|
|
65
|
+
### `mimir.health()`
|
|
66
|
+
Check server status.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mimir Memory SDK
|
|
3
|
+
*
|
|
4
|
+
* TypeScript/JavaScript client for the Mimir agentic memory REST API.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { Mimir } from "mimir-memory";
|
|
9
|
+
*
|
|
10
|
+
* const mimir = new Mimir(); // defaults to http://localhost:8484
|
|
11
|
+
*
|
|
12
|
+
* await mimir.archive({
|
|
13
|
+
* content: "John lives in London",
|
|
14
|
+
* source: "user",
|
|
15
|
+
* relation: "lives_in",
|
|
16
|
+
* target: "London",
|
|
17
|
+
* scope: "user",
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* const results = await mimir.search({ query: "Where does John live?" });
|
|
21
|
+
* console.log(results);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export interface MimirOptions {
|
|
25
|
+
/** Base URL of the Mimir REST server. Defaults to `http://localhost:8484`. */
|
|
26
|
+
baseUrl?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ArchiveParams {
|
|
29
|
+
/** Raw text content to embed and store. */
|
|
30
|
+
content: string;
|
|
31
|
+
/** Source entity (e.g. "user"). */
|
|
32
|
+
source: string;
|
|
33
|
+
/** Relationship type (e.g. "lives_in"). */
|
|
34
|
+
relation: string;
|
|
35
|
+
/** Target entity (e.g. "London"). */
|
|
36
|
+
target: string;
|
|
37
|
+
/** Scope tag: "user", "session", or "system". Defaults to "user". */
|
|
38
|
+
scope?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface SearchParams {
|
|
41
|
+
/** Natural language search query. */
|
|
42
|
+
query: string;
|
|
43
|
+
/** Optional ISO timestamp for temporal queries. */
|
|
44
|
+
timestamp?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface MemoryResponse {
|
|
47
|
+
result: string;
|
|
48
|
+
}
|
|
49
|
+
export interface HealthResponse {
|
|
50
|
+
status: string;
|
|
51
|
+
version: string;
|
|
52
|
+
}
|
|
53
|
+
export declare class Mimir {
|
|
54
|
+
private baseUrl;
|
|
55
|
+
constructor(options?: MimirOptions);
|
|
56
|
+
private request;
|
|
57
|
+
/**
|
|
58
|
+
* Check if the Mimir server is reachable.
|
|
59
|
+
*/
|
|
60
|
+
health(): Promise<HealthResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* Archive a new fact into Mimir's bitemporal memory.
|
|
63
|
+
*
|
|
64
|
+
* The content is embedded via the server's local embedding model,
|
|
65
|
+
* stored in Zvec, and a bitemporal edge is created in SQLite.
|
|
66
|
+
*/
|
|
67
|
+
archive(params: ArchiveParams): Promise<MemoryResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Search Mimir's memory with a natural language query.
|
|
70
|
+
*
|
|
71
|
+
* Optionally pass a `timestamp` to retrieve facts valid at that point in time.
|
|
72
|
+
*/
|
|
73
|
+
search(params: SearchParams): Promise<MemoryResponse>;
|
|
74
|
+
}
|
|
75
|
+
export default Mimir;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Mimir Memory SDK
|
|
4
|
+
*
|
|
5
|
+
* TypeScript/JavaScript client for the Mimir agentic memory REST API.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { Mimir } from "mimir-memory";
|
|
10
|
+
*
|
|
11
|
+
* const mimir = new Mimir(); // defaults to http://localhost:8484
|
|
12
|
+
*
|
|
13
|
+
* await mimir.archive({
|
|
14
|
+
* content: "John lives in London",
|
|
15
|
+
* source: "user",
|
|
16
|
+
* relation: "lives_in",
|
|
17
|
+
* target: "London",
|
|
18
|
+
* scope: "user",
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* const results = await mimir.search({ query: "Where does John live?" });
|
|
22
|
+
* console.log(results);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Mimir = void 0;
|
|
27
|
+
// ── Client ──────────────────────────────────────────────────────────────
|
|
28
|
+
class Mimir {
|
|
29
|
+
constructor(options = {}) {
|
|
30
|
+
this.baseUrl = (options.baseUrl || "http://localhost:8484").replace(/\/$/, "");
|
|
31
|
+
}
|
|
32
|
+
// -- helpers --
|
|
33
|
+
async request(path, method, body) {
|
|
34
|
+
const url = `${this.baseUrl}${path}`;
|
|
35
|
+
const init = {
|
|
36
|
+
method,
|
|
37
|
+
headers: { "Content-Type": "application/json" },
|
|
38
|
+
};
|
|
39
|
+
if (body !== undefined) {
|
|
40
|
+
init.body = JSON.stringify(body);
|
|
41
|
+
}
|
|
42
|
+
const res = await fetch(url, init);
|
|
43
|
+
if (!res.ok) {
|
|
44
|
+
const text = await res.text();
|
|
45
|
+
throw new Error(`Mimir API error ${res.status}: ${text}`);
|
|
46
|
+
}
|
|
47
|
+
return (await res.json());
|
|
48
|
+
}
|
|
49
|
+
// -- public API --
|
|
50
|
+
/**
|
|
51
|
+
* Check if the Mimir server is reachable.
|
|
52
|
+
*/
|
|
53
|
+
async health() {
|
|
54
|
+
return this.request("/health", "GET");
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Archive a new fact into Mimir's bitemporal memory.
|
|
58
|
+
*
|
|
59
|
+
* The content is embedded via the server's local embedding model,
|
|
60
|
+
* stored in Zvec, and a bitemporal edge is created in SQLite.
|
|
61
|
+
*/
|
|
62
|
+
async archive(params) {
|
|
63
|
+
return this.request("/archive", "POST", {
|
|
64
|
+
content: params.content,
|
|
65
|
+
source: params.source,
|
|
66
|
+
relation: params.relation,
|
|
67
|
+
target: params.target,
|
|
68
|
+
scope: params.scope ?? "user",
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Search Mimir's memory with a natural language query.
|
|
73
|
+
*
|
|
74
|
+
* Optionally pass a `timestamp` to retrieve facts valid at that point in time.
|
|
75
|
+
*/
|
|
76
|
+
async search(params) {
|
|
77
|
+
const body = { query: params.query };
|
|
78
|
+
if (params.timestamp) {
|
|
79
|
+
body.timestamp = params.timestamp;
|
|
80
|
+
}
|
|
81
|
+
return this.request("/search", "POST", body);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.Mimir = Mimir;
|
|
85
|
+
exports.default = Mimir;
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mimir-memory",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript/JavaScript SDK for the Mimir agentic memory system — archive and search with bitemporal guarantees",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/",
|
|
9
|
+
"README.md",
|
|
10
|
+
"LICENSE"
|
|
11
|
+
],
|
|
12
|
+
"keywords": [
|
|
13
|
+
"llm",
|
|
14
|
+
"memory",
|
|
15
|
+
"agent",
|
|
16
|
+
"vector-search",
|
|
17
|
+
"bitemporal",
|
|
18
|
+
"ai"
|
|
19
|
+
],
|
|
20
|
+
"author": "Arjun Subburaj",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/junainfinity/Mimir"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc",
|
|
28
|
+
"prepublishOnly": "npm run build"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"typescript": "^5.7.0"
|
|
32
|
+
}
|
|
33
|
+
}
|