@membank/core 0.9.0 → 0.9.1
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 +18 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,11 +28,12 @@ Default location can be overridden via `DatabaseManager.open(customPath)`.
|
|
|
28
28
|
### Initialize
|
|
29
29
|
|
|
30
30
|
```typescript
|
|
31
|
-
import { DatabaseManager, EmbeddingService, MemoryRepository, QueryEngine } from '@membank/core'
|
|
31
|
+
import { DatabaseManager, EmbeddingService, MemoryRepository, ProjectRepository, QueryEngine } from '@membank/core'
|
|
32
32
|
|
|
33
33
|
const db = DatabaseManager.open()
|
|
34
34
|
const embedding = new EmbeddingService()
|
|
35
|
-
const
|
|
35
|
+
const projects = new ProjectRepository(db)
|
|
36
|
+
const repo = new MemoryRepository(db, embedding, projects)
|
|
36
37
|
const engine = new QueryEngine(db, embedding, repo)
|
|
37
38
|
```
|
|
38
39
|
|
|
@@ -64,8 +65,8 @@ for (const { content, score } of results) {
|
|
|
64
65
|
```typescript
|
|
65
66
|
import { SessionContextBuilder } from '@membank/core'
|
|
66
67
|
|
|
67
|
-
const builder = new SessionContextBuilder(db
|
|
68
|
-
const { stats, pinnedGlobal, pinnedProject } =
|
|
68
|
+
const builder = new SessionContextBuilder(db)
|
|
69
|
+
const { stats, pinnedGlobal, pinnedProject } = builder.getSessionContext(projectHash)
|
|
69
70
|
```
|
|
70
71
|
|
|
71
72
|
## Memory types
|
|
@@ -104,9 +105,10 @@ score = 0.40 × type_weight
|
|
|
104
105
|
Each memory is tagged with a scope derived from the project's git remote URL (SHA256, first 16 chars). Falls back to a hash of the current working directory if git is unavailable. Global memories use `"global"` as scope.
|
|
105
106
|
|
|
106
107
|
```typescript
|
|
107
|
-
import { resolveScope } from '@membank/core'
|
|
108
|
+
import { resolveProject, resolveScope } from '@membank/core'
|
|
108
109
|
|
|
109
|
-
const
|
|
110
|
+
const { hash, name } = await resolveProject() // preferred: returns hash + repo name
|
|
111
|
+
const scopeHash = await resolveScope() // returns hash string only
|
|
110
112
|
```
|
|
111
113
|
|
|
112
114
|
## Embeddings
|
|
@@ -149,6 +151,15 @@ query(options: QueryOptions): Promise<Array<Memory & { score: number }>>
|
|
|
149
151
|
### `SessionContextBuilder`
|
|
150
152
|
|
|
151
153
|
```typescript
|
|
152
|
-
|
|
154
|
+
new SessionContextBuilder(db: DatabaseManager)
|
|
155
|
+
getSessionContext(projectHash: string, synthesis?: string): SessionContext
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### `listMemoryTypes`
|
|
159
|
+
|
|
160
|
+
Standalone function (not a class method):
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
import { listMemoryTypes } from '@membank/core'
|
|
153
164
|
listMemoryTypes(): MemoryType[]
|
|
154
165
|
```
|