@areev/areev 1.0.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-APACHE +202 -0
- package/LICENSE-MIT +21 -0
- package/README.md +55 -0
- package/index.d.ts +372 -0
- package/index.js +704 -0
- package/package.json +55 -0
package/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MindGryd Software Private Limited
|
|
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,55 @@
|
|
|
1
|
+
# areev-js
|
|
2
|
+
|
|
3
|
+
Node.js (napi-rs) bindings for Areev, the embedded memory engine for AI agents.
|
|
4
|
+
|
|
5
|
+
`areev-js` is the napi-rs native addon that exposes Areev to Node.js as the
|
|
6
|
+
`areev` package. It mirrors the Python binding with the same thin,
|
|
7
|
+
version-stable FFI convention: scalar arguments in, JSON strings out for
|
|
8
|
+
anything structured, and errors thrown as JavaScript `Error`s. Because the
|
|
9
|
+
underlying engine is native, this is a compiled Node addon rather than WASM. One
|
|
10
|
+
memory is one file, opened with a namespace, giving JavaScript agents durable
|
|
11
|
+
add / recall / supersede / forget over content-addressed memory.
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
const { Areev } = require('areev')
|
|
15
|
+
|
|
16
|
+
const mem = new Areev('caller.db', 'caller') // 3rd arg: passphrase for AES-256 at rest
|
|
17
|
+
const h = await mem.addFact('john', 'prefers', 'tea', 0.95)
|
|
18
|
+
console.log(await mem.recall('john')) // JSON string, newest-first
|
|
19
|
+
|
|
20
|
+
await mem.setEmbedderCommand('python3 embed.py') // vector recall via a host command
|
|
21
|
+
await mem.migrate('mem0', exportJson, historyJson) // import from mem0/Zep/Letta/… (docs/migrate.md)
|
|
22
|
+
await mem.memoryTool('{"command": "view", "path": "/memories"}') // Anthropic memory-tool backend
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Every method returns a promise
|
|
26
|
+
|
|
27
|
+
Store calls run on libuv's thread pool, not on the thread running your
|
|
28
|
+
application. They used to run inline: a single `migrate` or `importBundle` held
|
|
29
|
+
the event loop for its whole duration, so timers, sockets and any HTTP server in
|
|
30
|
+
the same process stopped until it finished. Measured on a 400-record `migrate`,
|
|
31
|
+
a 5 ms timer now fires **263 times** during the call; before, it could not fire
|
|
32
|
+
at all.
|
|
33
|
+
|
|
34
|
+
Two things follow, and the second is the one that bites:
|
|
35
|
+
|
|
36
|
+
- **The constructor stays synchronous.** Opening a file should fail loudly, at
|
|
37
|
+
the line that opened it.
|
|
38
|
+
- **Await your writes.** Promises settle in completion order, not call order,
|
|
39
|
+
and concurrent calls contend for one lock inside the store. This is a race:
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
mem.addFact('john', 'prefers', 'tea') // not awaited
|
|
43
|
+
const rows = await mem.recall('john') // may or may not see it
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Awaiting the write fixes it. If you want several independent writes to
|
|
47
|
+
overlap, `Promise.all` them and await the group.
|
|
48
|
+
|
|
49
|
+
Errors arrive as rejections, so `try`/`catch` around `await`, or `.catch()`.
|
|
50
|
+
An un-awaited call that fails becomes an unhandled rejection, which recent Node
|
|
51
|
+
versions treat as fatal.
|
|
52
|
+
|
|
53
|
+
Part of [Areev](https://github.com/AreevAI/areev) — an embedded memory engine for AI agents. See the [architecture overview](https://github.com/AreevAI/areev/blob/main/ARCHITECTURE.md).
|
|
54
|
+
|
|
55
|
+
Licensed under MIT OR Apache-2.0.
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/* auto-generated by NAPI-RS */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export declare class Areev {
|
|
4
|
+
constructor(path: string, ns?: string | undefined | null, passphrase?: string | undefined | null, actor?: string | undefined | null, telemetry?: string | undefined | null, principal?: string | undefined | null, indexText?: boolean | undefined | null)
|
|
5
|
+
/**
|
|
6
|
+
* Release this handle's claim on the memory file.
|
|
7
|
+
*
|
|
8
|
+
* One memory is one writer: a second handle on the same file is refused at
|
|
9
|
+
* open. Rust and Python release on drop, but Node's is whenever GC runs —
|
|
10
|
+
* so without this there is no way to say "I am done with this file" and
|
|
11
|
+
* reopen it in the same process. Calling a method afterwards is an error,
|
|
12
|
+
* not a silent reopen. Idempotent; in-flight async calls finish first.
|
|
13
|
+
*/
|
|
14
|
+
close(): void
|
|
15
|
+
/**
|
|
16
|
+
* Reconciliation warnings from open (file-vs-host declaration changes,
|
|
17
|
+
* embedding-model mismatches). JSON list string.
|
|
18
|
+
*/
|
|
19
|
+
openWarnings(): Promise<string>
|
|
20
|
+
/**
|
|
21
|
+
* Set the host-scoped run identifier copied into subsequent recall
|
|
22
|
+
* telemetry. Pass null to clear it; it is never a file truth.
|
|
23
|
+
*/
|
|
24
|
+
setRunId(runId?: string | undefined | null): void
|
|
25
|
+
/**
|
|
26
|
+
* Install a command embedder (same contract as the CLI's --embed-cmd):
|
|
27
|
+
* the command gets the text on stdin and must print a JSON array of
|
|
28
|
+
* numbers. Probed once here to learn the dimension. Enables the vector
|
|
29
|
+
* recall leg; grains added afterwards are embedded. (For an
|
|
30
|
+
* in-process callback embedder, see `setEmbedder`; the command
|
|
31
|
+
* embedder remains the zero-dependency path.)
|
|
32
|
+
*/
|
|
33
|
+
setEmbedderCommand(cmd: string, model?: string | undefined | null): Promise<void>
|
|
34
|
+
/**
|
|
35
|
+
* Install an embedding callback: `embed(text: string): number[]` —
|
|
36
|
+
* the JS mirror of Python's `set_embedder`. Probed once here (on the
|
|
37
|
+
* JS thread) to learn the dimension, recorded as the file's embedding
|
|
38
|
+
* provenance; store-side embeds run on worker threads and call back
|
|
39
|
+
* through a threadsafe function.
|
|
40
|
+
*/
|
|
41
|
+
setEmbedder(embed: (arg: string) => Array<number>, model?: string | undefined | null): void
|
|
42
|
+
/**
|
|
43
|
+
* Batch-add grains in ONE write transaction — the JS mirror of
|
|
44
|
+
* Python's `add_batch`. `grainsJson` is a JSON array of
|
|
45
|
+
* `{grain_type|type, fields}` objects; returns a JSON array of
|
|
46
|
+
* hashes. Worth ~1.6x over one-at-a-time `add()`, and only with the
|
|
47
|
+
* BM25 text index off (with it on, per-row index cost swamps
|
|
48
|
+
* batching).
|
|
49
|
+
*/
|
|
50
|
+
addBatch(grainsJson: string, ns?: string | undefined | null): Promise<string>
|
|
51
|
+
/**
|
|
52
|
+
* Free-text recall over the BM25 (and vector, when an embedder is
|
|
53
|
+
* installed) legs — the JS mirror of Python's `search`, the same path
|
|
54
|
+
* as `areev search` and CAL's `RECALL … ABOUT`. Returns a JSON list
|
|
55
|
+
* string shaped like `recall()`. Errors loudly when the file has
|
|
56
|
+
* neither leg, instead of a silent empty list.
|
|
57
|
+
*/
|
|
58
|
+
search(query: string, subject?: string | undefined | null, relation?: string | undefined | null, k?: number | undefined | null, ns?: string | undefined | null): Promise<string>
|
|
59
|
+
/**
|
|
60
|
+
* Backfill + rebuild the BM25 text index (e.g. after bulk loads, or on
|
|
61
|
+
* a file that flipped text indexing on later). Returns rows backfilled.
|
|
62
|
+
*/
|
|
63
|
+
reindexText(): Promise<number>
|
|
64
|
+
/**
|
|
65
|
+
* Rebuild the link indexes: reverse provenance, run correlation, and
|
|
66
|
+
* `related_to` cross-links. Returns index rows written.
|
|
67
|
+
*
|
|
68
|
+
* `open()` heals a file that predates these indexes, so this is for
|
|
69
|
+
* rebuilding on demand — the counterpart of `reindexText()`, and what
|
|
70
|
+
* `areev reindex` runs.
|
|
71
|
+
*/
|
|
72
|
+
reindexLinks(): Promise<number>
|
|
73
|
+
/**
|
|
74
|
+
* Anthropic memory-tool command (view/create/str_replace/insert/delete/
|
|
75
|
+
* rename over /memories): pass the tool-call object as JSON; returns the
|
|
76
|
+
* tool result text. Wire this as your memory-tool backend.
|
|
77
|
+
*/
|
|
78
|
+
memoryTool(commandJson: string, ns?: string | undefined | null): Promise<string>
|
|
79
|
+
/**
|
|
80
|
+
* Import another memory system's export. `source`: mem0 | mem0-history |
|
|
81
|
+
* langgraph | letta | letta-archival | zep | jsonl. `payload` is the
|
|
82
|
+
* export file's contents; `history` the optional mem0 history payload.
|
|
83
|
+
* (basic-memory vault directories import via the CLI: `areev migrate`.)
|
|
84
|
+
* Returns {added, superseded, forgotten, skipped, notes} as JSON.
|
|
85
|
+
* Re-runs skip what is already imported.
|
|
86
|
+
*/
|
|
87
|
+
migrate(source: string, payload: string, history?: string | undefined | null, ns?: string | undefined | null): Promise<string>
|
|
88
|
+
/**
|
|
89
|
+
* Add a Fact. Returns the content address (64-hex).
|
|
90
|
+
* Add a Fact. With `idempotent = true`, a re-add of the value already at
|
|
91
|
+
* the `(subject, relation)` head writes nothing and returns the existing
|
|
92
|
+
* hash (value-level dedup, not just byte-identical replay).
|
|
93
|
+
*/
|
|
94
|
+
addFact(subject: string, relation: string, object: string, confidence?: number | undefined | null, ns?: string | undefined | null, idempotent?: boolean | undefined | null): Promise<string>
|
|
95
|
+
/** Add any grain type from a JSON fields object. Returns the hash. */
|
|
96
|
+
add(grainType: string, fieldsJson: string, ns?: string | undefined | null): Promise<string>
|
|
97
|
+
/** Structural recall, newest-first. Returns a JSON list string. */
|
|
98
|
+
recall(subject: string, relation?: string | undefined | null, k?: number | undefined | null, ns?: string | undefined | null): Promise<string>
|
|
99
|
+
/** Current head for (subject, relation) — JSON string or null. */
|
|
100
|
+
latest(subject: string, relation: string, ns?: string | undefined | null): Promise<string | null>
|
|
101
|
+
/** Supersede old_hash with a new version (append-only evolution). */
|
|
102
|
+
supersede(oldHash: string, grainType: string, fieldsJson: string, ns?: string | undefined | null): Promise<string>
|
|
103
|
+
/**
|
|
104
|
+
* Erase a grain from the hot store (tombstoned). Host-level op.
|
|
105
|
+
* Routed through the facade so it carries the same `delete` check and
|
|
106
|
+
* Tier-2 audit record as CAL's `FORGET <hash>`.
|
|
107
|
+
*/
|
|
108
|
+
forget(hash: string): Promise<void>
|
|
109
|
+
/**
|
|
110
|
+
* Right-to-erasure for one identity: erase every grain holding a
|
|
111
|
+
* STRUCTURED reference to `subject` in the session namespace (or `ns`) —
|
|
112
|
+
* the full supersession history, grains referencing it in object
|
|
113
|
+
* position, its thread events, its dictionary entry, and erased-only
|
|
114
|
+
* vocabulary — with replicating tombstones. Resolves to the erasure
|
|
115
|
+
* report as JSON (counts only, no identity material). Host-level
|
|
116
|
+
* destructive op: gate it like your other compliance endpoints. See
|
|
117
|
+
* docs/erasure.md for the scope contract.
|
|
118
|
+
* Identity matching always covers partition-style keys (`pat`,
|
|
119
|
+
* `pat#visit1` — never `patricia`); pass `textMentions=true` to ALSO
|
|
120
|
+
* erase grains whose indexed text mentions the identity's tokens
|
|
121
|
+
* (search symmetry — opt-in because token matching over-reaches for
|
|
122
|
+
* common-word identifiers).
|
|
123
|
+
*/
|
|
124
|
+
forgetSubject(subject: string, ns?: string | undefined | null, textMentions?: boolean | undefined | null): Promise<string>
|
|
125
|
+
/**
|
|
126
|
+
* DSAR read (GDPR Art. 15/20): everything `forgetSubject` WOULD erase
|
|
127
|
+
* for one identity — exact + partition keys, full history — as
|
|
128
|
+
* `{"identity_names": [...], "grains": [{hash, type, fields}, ...]}`.
|
|
129
|
+
* The same selector as erasure, in show-me mode.
|
|
130
|
+
*/
|
|
131
|
+
subjectReport(subject: string, ns?: string | undefined | null, textMentions?: boolean | undefined | null): Promise<string>
|
|
132
|
+
/**
|
|
133
|
+
* Export the subject selection as a portable MGB1 bundle (GDPR Art. 20
|
|
134
|
+
* portability) — importable into any OMS store. Resolves to the bundle
|
|
135
|
+
* stats JSON.
|
|
136
|
+
*/
|
|
137
|
+
subjectBundle(path: string, subject: string, ns?: string | undefined | null, textMentions?: boolean | undefined | null): Promise<string>
|
|
138
|
+
/**
|
|
139
|
+
* Retention sweep: erase every grain with `created_at` older than
|
|
140
|
+
* `cutoffMs` (epoch milliseconds), optionally limited to one grain type
|
|
141
|
+
* (e.g. "event") and scoped to the session namespace (or `ns`; pass
|
|
142
|
+
* ns="" to sweep every namespace). Resolves to the report JSON.
|
|
143
|
+
*/
|
|
144
|
+
forgetOlderThan(cutoffMs: number, ns?: string | undefined | null, grainType?: string | undefined | null): Promise<string>
|
|
145
|
+
/**
|
|
146
|
+
* remember(): store content as an Event, then attach the facts
|
|
147
|
+
* distilled from it. Three routes to those facts, in precedence order:
|
|
148
|
+
* `factsJson` (pre-extracted by the host — a JSON list of
|
|
149
|
+
* {subject, relation, object, confidence}), `llmCmd` (a subprocess
|
|
150
|
+
* backend), or `model` ("openai:gpt-4o-mini", key from the env).
|
|
151
|
+
*
|
|
152
|
+
* The raw text is written before the model is called, so a failed
|
|
153
|
+
* extraction never costs the raw text — the error names the hash it was
|
|
154
|
+
* stored under. Model-extracted facts are stamped
|
|
155
|
+
* `verification_status="unverified"` unless `groundModel`/`groundCmd`
|
|
156
|
+
* runs a separate entailment pass (proposer ≠ scorer); facts it does not
|
|
157
|
+
* support are dropped and survivors are stamped `"verified"`.
|
|
158
|
+
*
|
|
159
|
+
* The raw text is stored as an **Event** grain (a transcript turn) —
|
|
160
|
+
* pass `sessionId`/`role` to place it in a conversation thread.
|
|
161
|
+
*
|
|
162
|
+
* Returns {"event", "facts"} JSON, plus {"model", "proposed",
|
|
163
|
+
* "dropped", "verification_status"} when a model ran.
|
|
164
|
+
*/
|
|
165
|
+
remember(content: string, factsJson?: string | undefined | null, observer?: string | undefined | null, ns?: string | undefined | null, model?: string | undefined | null, llmCmd?: string | undefined | null, groundModel?: string | undefined | null, groundCmd?: string | undefined | null, extractHint?: string | undefined | null, minConfidence?: number | undefined | null, sessionId?: string | undefined | null, role?: string | undefined | null, runId?: string | undefined | null): Promise<string>
|
|
166
|
+
/**
|
|
167
|
+
* Execute CAL. Returns the wire-format payload as a JSON string.
|
|
168
|
+
* Non-fatal `CAL-Wnnn` warnings ride along under a `warnings` key
|
|
169
|
+
* (absent when the query raised none).
|
|
170
|
+
*/
|
|
171
|
+
cal(query: string): Promise<string>
|
|
172
|
+
/** Supersession-chain history for (subject, relation), newest first. */
|
|
173
|
+
history(subject: string, relation: string, ns?: string | undefined | null): Promise<string>
|
|
174
|
+
/**
|
|
175
|
+
* Reverse provenance: grains distilled from `sourceHash` (their
|
|
176
|
+
* `derived_from`), newest first, as a JSON list string.
|
|
177
|
+
*/
|
|
178
|
+
provenance(sourceHash: string): Promise<string>
|
|
179
|
+
/**
|
|
180
|
+
* Advise-mode novelty check: nearest existing grains to `text`, optionally
|
|
181
|
+
* scoped to (subject, relation), as a JSON list of {hash, similarity},
|
|
182
|
+
* most similar first. Requires an installed embedder; never writes.
|
|
183
|
+
*/
|
|
184
|
+
nearest(text: string, subject?: string | undefined | null, relation?: string | undefined | null, k?: number | undefined | null, ns?: string | undefined | null): Promise<string>
|
|
185
|
+
/** Store statistics as JSON. */
|
|
186
|
+
stats(): Promise<string>
|
|
187
|
+
/** Incremental backup to a bundle file. Returns last_op_seq cursor. */
|
|
188
|
+
bundle(path: string, since?: number | undefined | null): Promise<number>
|
|
189
|
+
/** Apply a bundle (fast-forward, idempotent). Returns ops applied. */
|
|
190
|
+
importBundle(path: string): Promise<number>
|
|
191
|
+
/** Integrity + content-address verification. Throws on failure. */
|
|
192
|
+
verify(): Promise<string>
|
|
193
|
+
/**
|
|
194
|
+
* Bounded k-hop walk over the entity graph.
|
|
195
|
+
*
|
|
196
|
+
* `relations` is comma-separated. `direction` is out|in|both — in/both use
|
|
197
|
+
* the reverse index, which only covers relations the file declares
|
|
198
|
+
* entity-valued, so they find nothing for relations outside that set.
|
|
199
|
+
*
|
|
200
|
+
* Argument validation happens inside the task so a bad `direction` or an
|
|
201
|
+
* empty relation list *rejects* the promise, matching every other method
|
|
202
|
+
* here — throwing synchronously would contradict the `Promise<string>`
|
|
203
|
+
* signature napi generates.
|
|
204
|
+
*/
|
|
205
|
+
related(start: string, relations: string, direction?: string | undefined | null, depth?: number | undefined | null, limit?: number | undefined | null, ns?: string | undefined | null): Promise<string>
|
|
206
|
+
/**
|
|
207
|
+
* As-of read on two axes: `world` = what was true at `at`,
|
|
208
|
+
* `knowledge` = what the agent knew at `at`. `at` is epoch milliseconds.
|
|
209
|
+
*/
|
|
210
|
+
entityAt(subject: string, relation: string, at: number, axis?: string | undefined | null, ns?: string | undefined | null): Promise<string>
|
|
211
|
+
/**
|
|
212
|
+
* What a run recorded, and what it produced downstream.
|
|
213
|
+
*
|
|
214
|
+
* Returns `{run_id, trace, produced}` — `trace` is the run's own grains,
|
|
215
|
+
* `produced` is what was derived from them and is not itself part of the
|
|
216
|
+
* run. This is the query that crosses from execution history into
|
|
217
|
+
* semantic memory.
|
|
218
|
+
*/
|
|
219
|
+
runTrace(runId: string, limit?: number | undefined | null, includeYield?: boolean | undefined | null, ns?: string | undefined | null): Promise<string>
|
|
220
|
+
/**
|
|
221
|
+
* One page of a run's grains, **oldest first**, from an exclusive
|
|
222
|
+
* `afterSeq` cursor — the complete journal read (`runTrace` clamps at
|
|
223
|
+
* 1024 with no cursor). Returns `{run_id, entries: [{seq, grain}...],
|
|
224
|
+
* next_after_seq}`; `next_after_seq` is null when exhausted.
|
|
225
|
+
*/
|
|
226
|
+
runGrains(runId: string, afterSeq?: number | undefined | null, limit?: number | undefined | null, ns?: string | undefined | null): Promise<string>
|
|
227
|
+
/**
|
|
228
|
+
* Vector-in nearest-neighbour search: cosine top-k against a
|
|
229
|
+
* caller-supplied query vector — no embedder needed. Same
|
|
230
|
+
* `[{hash, similarity}]` shape as `nearest()`; dimension is checked
|
|
231
|
+
* against the file's declared embedding provenance.
|
|
232
|
+
*/
|
|
233
|
+
nearestVector(vector: Array<number>, subject?: string | undefined | null, relation?: string | undefined | null, k?: number | undefined | null, ns?: string | undefined | null): Promise<string>
|
|
234
|
+
/**
|
|
235
|
+
* Install or replace the indexed embedding for a stored grain — the
|
|
236
|
+
* write half of the external-embedding seam. The vector never enters the
|
|
237
|
+
* grain blob, so the hash is unchanged. Bundles carry blobs, not index
|
|
238
|
+
* rows: replicas must have vectors re-supplied.
|
|
239
|
+
*/
|
|
240
|
+
addEmbedding(hash: string, vector: Array<number>): Promise<string>
|
|
241
|
+
/**
|
|
242
|
+
* The file's declared embedding provenance as `{model, dim}` JSON, or
|
|
243
|
+
* `null` when the file has never seen a vector.
|
|
244
|
+
*/
|
|
245
|
+
declaredEmbedding(): Promise<string>
|
|
246
|
+
/**
|
|
247
|
+
* Which runs produced or refined this grain — the reverse join.
|
|
248
|
+
*
|
|
249
|
+
* Runs that merely *read* the grain are not recorded: a read leaves no
|
|
250
|
+
* grain behind, so nothing in an append-only store can attest to it.
|
|
251
|
+
*/
|
|
252
|
+
runsTouching(hash: string, depth?: number | undefined | null, ns?: string | undefined | null): Promise<string>
|
|
253
|
+
/**
|
|
254
|
+
* Execution records for a workflow: which grains ran which of its nodes.
|
|
255
|
+
*
|
|
256
|
+
* A Workflow grain is immutable, so runs point at the plan rather than
|
|
257
|
+
* mutating it — retries show up as several records for one node.
|
|
258
|
+
*/
|
|
259
|
+
stepActions(workflow: string, node?: string | undefined | null, limit?: number | undefined | null, ns?: string | undefined | null): Promise<string>
|
|
260
|
+
/**
|
|
261
|
+
* Record a tool call as a Tool grain — the flagship analyzer's food.
|
|
262
|
+
*
|
|
263
|
+
* `callId` is the invocation's own id (the provider's `tool_call_id`),
|
|
264
|
+
* stored on the grain and queryable — the correlation key back to the LLM
|
|
265
|
+
* transcript. Omitted, one is synthesized. Either way each call is its own
|
|
266
|
+
* occurrence, which is what makes a tool that failed five times read as
|
|
267
|
+
* five failures; recording is append-only, never de-duplicating.
|
|
268
|
+
* Wave-0 extension mirrored from Python: `runId` correlates to a run,
|
|
269
|
+
* `workflowHash` + `nodeId` (both or neither) write the `mg:step_action`
|
|
270
|
+
* link, and `status`/`failureCause`/`executorKind`/`correlationId` carry
|
|
271
|
+
* the async lifecycle with strict enum validation.
|
|
272
|
+
*/
|
|
273
|
+
recordToolCall(name: string, result: string, isError?: boolean | undefined | null, thread?: string | undefined | null, callId?: string | undefined | null, input?: string | undefined | null, runId?: string | undefined | null, workflowHash?: string | undefined | null, nodeId?: string | undefined | null, status?: string | undefined | null, failureCause?: string | undefined | null, executorKind?: string | undefined | null, correlationId?: string | undefined | null): Promise<string>
|
|
274
|
+
/** Persist a content-addressed harness config and the run -> config link. */
|
|
275
|
+
recordRunManifest(runId: string, config: string): Promise<string>
|
|
276
|
+
/**
|
|
277
|
+
* Run one analysis pass. Bare it never gates. `fullSweep` re-analyzes
|
|
278
|
+
* the whole memory (`areev loop reflect` semantics); `policy` is a path
|
|
279
|
+
* to a host `loop-policy.json` — the only way auto-apply is granted
|
|
280
|
+
* from the bindings. Returns run-outcome JSON.
|
|
281
|
+
*/
|
|
282
|
+
loopRun(minNew?: number | undefined | null, minNewErrors?: number | undefined | null, ifStale?: string | undefined | null, model?: string | undefined | null, llmCmd?: string | undefined | null, groundModel?: string | undefined | null, groundCmd?: string | undefined | null, analyzerCmd?: string | undefined | null, fullSweep?: boolean | undefined | null, policy?: string | undefined | null): Promise<string>
|
|
283
|
+
/**
|
|
284
|
+
* List recommendations. `filter` is optional JSON, e.g. `{"status":
|
|
285
|
+
* "pending"}`; `{"status":"all"}` clears the filter. JSON list.
|
|
286
|
+
*/
|
|
287
|
+
recommendations(filter?: string | undefined | null): Promise<string>
|
|
288
|
+
/**
|
|
289
|
+
* Approve and apply a recommendation in one audited step (§6.6). The
|
|
290
|
+
* `because` reason is mandatory. A refused apply leaves the recommendation
|
|
291
|
+
* **pending**, so it can still be dismissed.
|
|
292
|
+
*
|
|
293
|
+
* `scopes` is a comma-separated subset of `read,write,review,apply,admin`;
|
|
294
|
+
* omit it for all scopes.
|
|
295
|
+
*/
|
|
296
|
+
applyRecommendation(hash: string, because: string, allowDestructive?: boolean | undefined | null, scopes?: string | undefined | null): Promise<string>
|
|
297
|
+
/**
|
|
298
|
+
* Approve a recommendation **without** applying it — the two-person flow
|
|
299
|
+
* the CLI's separate `approve` verb enables, so a supervising agent can
|
|
300
|
+
* approve for a human to apply later.
|
|
301
|
+
*/
|
|
302
|
+
approveRecommendation(hash: string, because: string, scopes?: string | undefined | null): Promise<string>
|
|
303
|
+
/**
|
|
304
|
+
* Health snapshot of the loop: when it last ran, how much is un-analyzed
|
|
305
|
+
* since, the queue counts, and whether it looks stalled. Parity with bare
|
|
306
|
+
* `areev loop` and `GET /api/loop/health`.
|
|
307
|
+
*/
|
|
308
|
+
loopHealth(): Promise<string>
|
|
309
|
+
/** The analyzer roster: id, whether it is enabled, and its settings. */
|
|
310
|
+
loopAnalyzers(): Promise<string>
|
|
311
|
+
/**
|
|
312
|
+
* Enable/disable one analyzer, or set its parameters — reachable from the
|
|
313
|
+
* console's Setup tab (`POST /api/loop/config`) but not, until now, from
|
|
314
|
+
* the bindings. `paramsJson` is an optional JSON object of overrides.
|
|
315
|
+
*/
|
|
316
|
+
setAnalyzerConfig(analyzerId: string, enabled?: boolean | undefined | null, paramsJson?: string | undefined | null): Promise<string>
|
|
317
|
+
/** Reject a recommendation with a reason (library-friendly `reject`). */
|
|
318
|
+
dismissRecommendation(hash: string, why: string, scopes?: string | undefined | null): Promise<string>
|
|
319
|
+
/**
|
|
320
|
+
* Roll back an applied recommendation (retracts the grains it created).
|
|
321
|
+
* Mandatory reason; fails for non-rollbackable applies (FORGET has no
|
|
322
|
+
* inverse). Parity with `areev loop rollback`.
|
|
323
|
+
*/
|
|
324
|
+
rollbackRecommendation(hash: string, because: string): Promise<string>
|
|
325
|
+
/**
|
|
326
|
+
* Measured outcomes of applied recommendations — the Verify gate's
|
|
327
|
+
* record (`held` / `regressed` per checkpoint). JSON list, parity with
|
|
328
|
+
* `areev loop outcomes`.
|
|
329
|
+
*/
|
|
330
|
+
loopOutcomes(): Promise<string>
|
|
331
|
+
/**
|
|
332
|
+
* Start a governed run. Returns the session JSON:
|
|
333
|
+
* `{"finished": …}` or `{"parked": envelope}`.
|
|
334
|
+
*/
|
|
335
|
+
runStart(workflow: string, runId: string, inputJson?: string | undefined | null, toolCmd?: string | undefined | null, maxTokens?: number | undefined | null, maxUsdMicros?: number | undefined | null, maxWallMs?: number | undefined | null, askTtlSec?: number | undefined | null): Promise<string>
|
|
336
|
+
/** Resume a parked/interrupted run from its latest checkpoint. */
|
|
337
|
+
runResume(runId: string, toolCmd?: string | undefined | null): Promise<string>
|
|
338
|
+
/**
|
|
339
|
+
* Answer a pending Client ask. `responder` is REQUIRED — approval
|
|
340
|
+
* separation of duties (responder ≠ triggering principal) is structural.
|
|
341
|
+
*/
|
|
342
|
+
runRespond(runId: string, toolCallId: string, resultJson: string, responder: string, isError?: boolean | undefined | null): Promise<string>
|
|
343
|
+
/** Write the kill-switch marker (the lowest-privilege run verb). */
|
|
344
|
+
runCancel(runId: string, because?: string | undefined | null): Promise<string>
|
|
345
|
+
/** Journal-consistent replay; writes nothing. JSON report. */
|
|
346
|
+
runVerify(runId: string): Promise<string>
|
|
347
|
+
/** Shadow evaluation over journaled runs — zero effect dispatches. */
|
|
348
|
+
runShadow(runIds: Array<string>): Promise<string>
|
|
349
|
+
/**
|
|
350
|
+
* §5.4 time-travel fork / migration: seed a new run from a base run's
|
|
351
|
+
* checkpoint (optionally at a specific superstep, optionally onto a new
|
|
352
|
+
* plan hash). Returns the seed checkpoint hash (hex).
|
|
353
|
+
*/
|
|
354
|
+
runFork(baseRunId: string, newRunId: string, atSuperstep?: number | undefined | null, plan?: string | undefined | null): Promise<string>
|
|
355
|
+
/**
|
|
356
|
+
* Op-log cursor read — the change feed the audit/evidence story rides.
|
|
357
|
+
* Returns `[{op_seq, hlc, op, hash}...]`, ascending; pass the last
|
|
358
|
+
* `op_seq` back as the next cursor. `hlc` is a STRING: HLC values
|
|
359
|
+
* exceed 2^53 and would silently lose bits in `JSON.parse`.
|
|
360
|
+
*/
|
|
361
|
+
changesSince(afterOpSeq?: number | undefined | null, limit?: number | undefined | null): Promise<string>
|
|
362
|
+
/** Recent run ids, newest first. JSON list string. */
|
|
363
|
+
runList(limit?: number | undefined | null): Promise<string>
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Drop a memory schema entirely — the postgres backend's memory-level
|
|
368
|
+
* erasure primitive (`DROP SCHEMA … CASCADE`), the analogue of deleting a
|
|
369
|
+
* memory file. Destroys the memory AND its telemetry/blobs. Admin surface:
|
|
370
|
+
* gate it like any destructive operation in your host.
|
|
371
|
+
*/
|
|
372
|
+
export declare function dropPostgresSchema(url: string, schema: string): void
|