mentedb 0.11.10 → 0.11.12
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/mentedb.darwin-arm64.node +0 -0
- package/mentedb.darwin-x64.node +0 -0
- package/mentedb.linux-arm64-gnu.node +0 -0
- package/mentedb.linux-x64-gnu.node +0 -0
- package/mentedb.win32-x64-msvc.node +0 -0
- package/npm/client.d.ts +22 -1
- package/npm/client.js +25 -0
- package/npm/types.d.ts +55 -0
- package/package.json +1 -1
|
Binary file
|
package/mentedb.darwin-x64.node
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/npm/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EdgeType, type StoreOptions, type RecallResult, type SearchResult } from './types';
|
|
1
|
+
import { EdgeType, type StoreOptions, type RecallResult, type SearchResult, type ProcessTurnResult, type IngestResult } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* MenteDB client. Wraps the native Rust database engine and exposes a
|
|
4
4
|
* TypeScript-friendly API for storing, recalling, searching, relating, and
|
|
@@ -7,6 +7,27 @@ import { EdgeType, type StoreOptions, type RecallResult, type SearchResult } fro
|
|
|
7
7
|
export declare class MenteDB {
|
|
8
8
|
private native;
|
|
9
9
|
constructor(dataDir?: string);
|
|
10
|
+
/**
|
|
11
|
+
* Process one conversation turn through the full cognitive pipeline.
|
|
12
|
+
*
|
|
13
|
+
* This is the primary API. A single call embeds the message, runs hybrid
|
|
14
|
+
* recall (vector + keyword + graph), stores the turn, extracts facts,
|
|
15
|
+
* detects contradictions, and returns attention-ordered context plus what
|
|
16
|
+
* was learned. The field you use most is `context`: inject those memories
|
|
17
|
+
* into your next prompt.
|
|
18
|
+
*
|
|
19
|
+
* Fact extraction and contradiction detection require an LLM. Set
|
|
20
|
+
* `MENTEDB_LLM_PROVIDER` and `MENTEDB_LLM_API_KEY` in the environment;
|
|
21
|
+
* without them you still get storage and recall.
|
|
22
|
+
*/
|
|
23
|
+
processTurn(userMessage: string, assistantResponse?: string, turnId?: number, projectContext?: string, agentId?: string, sessionId?: string): ProcessTurnResult;
|
|
24
|
+
/**
|
|
25
|
+
* Extract memories from a raw conversation transcript and store them.
|
|
26
|
+
*
|
|
27
|
+
* Requires an LLM. Set `MENTEDB_LLM_PROVIDER` and `MENTEDB_LLM_API_KEY`,
|
|
28
|
+
* or pass `provider` ("openai", "anthropic", or "ollama") explicitly.
|
|
29
|
+
*/
|
|
30
|
+
ingest(conversation: string, provider?: string, agentId?: string): IngestResult;
|
|
10
31
|
/** Store a memory and return its UUID. */
|
|
11
32
|
store(options: StoreOptions): string;
|
|
12
33
|
/** Recall memories using an MQL query string. */
|
package/npm/client.js
CHANGED
|
@@ -74,6 +74,31 @@ class MenteDB {
|
|
|
74
74
|
constructor(dataDir = './mentedb-data') {
|
|
75
75
|
this.native = new nativeBinding.MenteDb(dataDir);
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Process one conversation turn through the full cognitive pipeline.
|
|
79
|
+
*
|
|
80
|
+
* This is the primary API. A single call embeds the message, runs hybrid
|
|
81
|
+
* recall (vector + keyword + graph), stores the turn, extracts facts,
|
|
82
|
+
* detects contradictions, and returns attention-ordered context plus what
|
|
83
|
+
* was learned. The field you use most is `context`: inject those memories
|
|
84
|
+
* into your next prompt.
|
|
85
|
+
*
|
|
86
|
+
* Fact extraction and contradiction detection require an LLM. Set
|
|
87
|
+
* `MENTEDB_LLM_PROVIDER` and `MENTEDB_LLM_API_KEY` in the environment;
|
|
88
|
+
* without them you still get storage and recall.
|
|
89
|
+
*/
|
|
90
|
+
processTurn(userMessage, assistantResponse, turnId = 0, projectContext, agentId, sessionId) {
|
|
91
|
+
return this.native.processTurn(userMessage, assistantResponse ?? null, turnId, projectContext ?? null, agentId ?? null, sessionId ?? null);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Extract memories from a raw conversation transcript and store them.
|
|
95
|
+
*
|
|
96
|
+
* Requires an LLM. Set `MENTEDB_LLM_PROVIDER` and `MENTEDB_LLM_API_KEY`,
|
|
97
|
+
* or pass `provider` ("openai", "anthropic", or "ollama") explicitly.
|
|
98
|
+
*/
|
|
99
|
+
ingest(conversation, provider, agentId) {
|
|
100
|
+
return this.native.ingest(conversation, provider ?? null, agentId ?? null);
|
|
101
|
+
}
|
|
77
102
|
/** Store a memory and return its UUID. */
|
|
78
103
|
store(options) {
|
|
79
104
|
const { content, memoryType = types_1.MemoryType.Episodic, embedding = [], agentId, tags, } = options;
|
package/npm/types.d.ts
CHANGED
|
@@ -32,3 +32,58 @@ export interface StoreOptions {
|
|
|
32
32
|
agentId?: string;
|
|
33
33
|
tags?: string[];
|
|
34
34
|
}
|
|
35
|
+
/** A single memory selected for the working-context window. */
|
|
36
|
+
export interface ContextItem {
|
|
37
|
+
id: string;
|
|
38
|
+
content: string;
|
|
39
|
+
score: number;
|
|
40
|
+
}
|
|
41
|
+
export interface PainWarning {
|
|
42
|
+
signalId: string;
|
|
43
|
+
intensity: number;
|
|
44
|
+
description: string;
|
|
45
|
+
}
|
|
46
|
+
export interface DetectedAction {
|
|
47
|
+
actionType: string;
|
|
48
|
+
detail: string;
|
|
49
|
+
}
|
|
50
|
+
export interface ProactiveRecall {
|
|
51
|
+
memoryId: string;
|
|
52
|
+
content: string;
|
|
53
|
+
relevance: number;
|
|
54
|
+
actionType: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Everything one `processTurn` call produced. The field you use most is
|
|
58
|
+
* `context`: the attention-ordered memories to inject into your next prompt.
|
|
59
|
+
*/
|
|
60
|
+
export interface ProcessTurnResult {
|
|
61
|
+
/** Attention-ordered memories relevant to this turn. Inject into your next prompt. */
|
|
62
|
+
context: ContextItem[];
|
|
63
|
+
/** IDs of the memories stored from this turn. */
|
|
64
|
+
storedIds: string[];
|
|
65
|
+
episodicId?: string;
|
|
66
|
+
painWarnings: PainWarning[];
|
|
67
|
+
cacheHit: boolean;
|
|
68
|
+
inferenceActions: number;
|
|
69
|
+
detectedActions: DetectedAction[];
|
|
70
|
+
proactiveRecalls: ProactiveRecall[];
|
|
71
|
+
correctionId?: string;
|
|
72
|
+
sentiment: number;
|
|
73
|
+
phantomCount: number;
|
|
74
|
+
contradictionCount: number;
|
|
75
|
+
predictedTopics: string[];
|
|
76
|
+
/** Facts extracted this turn. Zero unless an LLM is configured (see MENTEDB_LLM_PROVIDER). */
|
|
77
|
+
factsExtracted: number;
|
|
78
|
+
edgesCreated: number;
|
|
79
|
+
enrichmentPending: boolean;
|
|
80
|
+
deltaAdded: string[];
|
|
81
|
+
deltaRemoved: string[];
|
|
82
|
+
}
|
|
83
|
+
export interface IngestResult {
|
|
84
|
+
memoriesStored: number;
|
|
85
|
+
rejectedLowQuality: number;
|
|
86
|
+
rejectedDuplicate: number;
|
|
87
|
+
contradictions: number;
|
|
88
|
+
storedIds: string[];
|
|
89
|
+
}
|