sigma-memory 0.2.1 → 0.2.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/dist/index.d.ts +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -22
- package/dist/index.js.map +1 -1
- package/dist/notes.d.ts +1 -1
- package/dist/notes.d.ts.map +1 -1
- package/dist/notes.js +24 -24
- package/dist/notes.js.map +1 -1
- package/dist/ontology.d.ts +3 -3
- package/dist/ontology.d.ts.map +1 -1
- package/dist/ontology.js +26 -23
- package/dist/ontology.js.map +1 -1
- package/dist/types.d.ts +7 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/vector-store.d.ts +1 -1
- package/dist/vector-store.d.ts.map +1 -1
- package/dist/vector-store.js +39 -33
- package/dist/vector-store.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +176 -176
- package/src/notes.ts +161 -161
- package/src/ontology.ts +359 -352
- package/src/types.ts +63 -63
- package/src/vector-store.ts +356 -357
- package/src/vendor.d.ts +21 -21
package/src/types.ts
CHANGED
|
@@ -1,98 +1,98 @@
|
|
|
1
1
|
export interface MemoryConfig {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
memoryDir: string; // ~/.phi/memory/
|
|
3
|
+
projectMemoryDir: string; // .phi/memory/ (in the current project)
|
|
4
|
+
ontologyPath: string; // ~/.phi/memory/ontology/graph.jsonl
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export interface SearchResult {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
file: string;
|
|
9
|
+
line: number;
|
|
10
|
+
content: string;
|
|
11
|
+
score: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export interface VectorSearchResult {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
file: string;
|
|
16
|
+
chunkIndex: number;
|
|
17
|
+
content: string;
|
|
18
|
+
score: number; // cosine similarity 0-1
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export interface OntologyEntity {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
id: string;
|
|
23
|
+
type: "Person" | "Project" | "Device" | "Account" | "Document" | "Service" | "Concept";
|
|
24
|
+
name: string;
|
|
25
|
+
properties: Record<string, string>;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
updatedAt: string;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export interface OntologyRelation {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
id: string;
|
|
32
|
+
from: string; // entity ID
|
|
33
|
+
to: string; // entity ID
|
|
34
|
+
type: string; // 'owns' | 'uses' | 'deploys' | 'manages' | 'depends_on' | etc.
|
|
35
|
+
properties: Record<string, string>;
|
|
36
|
+
createdAt: string;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export interface Note {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
file: string;
|
|
41
|
+
date: string;
|
|
42
|
+
content: string;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export interface UnifiedSearchResult {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
source: "notes" | "ontology" | "vectors";
|
|
47
|
+
type?: "entity" | "relation" | "note" | "file";
|
|
48
|
+
score: number;
|
|
49
|
+
data: any;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export interface MemoryStatus {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
53
|
+
notes: {
|
|
54
|
+
count: number;
|
|
55
|
+
totalSize: number;
|
|
56
|
+
lastModified: string | null;
|
|
57
|
+
};
|
|
58
|
+
ontology: {
|
|
59
|
+
entities: number;
|
|
60
|
+
relations: number;
|
|
61
|
+
entitiesByType: Record<string, number>;
|
|
62
|
+
relationsByType: Record<string, number>;
|
|
63
|
+
};
|
|
64
|
+
vectors: {
|
|
65
|
+
documentCount: number;
|
|
66
|
+
chunkCount: number;
|
|
67
|
+
lastUpdate: string;
|
|
68
|
+
};
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
// Types for ontology JSONL entries
|
|
72
72
|
export interface OntologyEntityEntry {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
kind: "entity";
|
|
74
|
+
id: string;
|
|
75
|
+
type: "Person" | "Project" | "Device" | "Account" | "Document" | "Service" | "Concept";
|
|
76
|
+
name: string;
|
|
77
|
+
properties: Record<string, string>;
|
|
78
|
+
createdAt: string;
|
|
79
|
+
updatedAt: string;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
export interface OntologyRelationEntry {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
kind: "relation";
|
|
84
|
+
id: string;
|
|
85
|
+
from: string;
|
|
86
|
+
to: string;
|
|
87
|
+
type: string;
|
|
88
|
+
properties: Record<string, string>;
|
|
89
|
+
createdAt: string;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
export interface OntologyDeleteEntry {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
kind: "delete";
|
|
94
|
+
targetId: string;
|
|
95
|
+
deletedAt: string;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
export type OntologyJSONLEntry = OntologyEntityEntry | OntologyRelationEntry | OntologyDeleteEntry;
|