@wrongstack/vector-memory 1.0.2 → 1.0.4
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 +6 -6
- package/dist/index.d.ts +9 -9
- package/dist/index.js +1323 -1329
- package/dist/sage-sync.d.ts +30 -0
- package/dist/transformers-provider.d.ts +2 -2
- package/package.json +5 -8
package/dist/sage-sync.d.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* First-boot SAGE → vector-memory mirror.
|
|
3
|
+
*
|
|
4
|
+
* `VectorMemoryStore.syncFromSage()` has no production caller on its own;
|
|
5
|
+
* this module is that caller. On the first boot per project (no sync marker
|
|
6
|
+
* next to the vector db), the active SAGE corpus is mirrored into the vector
|
|
7
|
+
* store so semantic search starts with the project's existing knowledge
|
|
8
|
+
* instead of an empty index.
|
|
9
|
+
*
|
|
10
|
+
* Semantics:
|
|
11
|
+
* - Fire-and-forget: the CLI never waits on the sync (first run pays the
|
|
12
|
+
* ONNX model download; boot must not block on it).
|
|
13
|
+
* - Marker-based: `sage-sync.complete.json` in `store.directory`. A
|
|
14
|
+
* `complete` marker means "corpus fully mirrored — don't rescan". A
|
|
15
|
+
* `running` marker owned by a LIVE pid means another CLI process owns the
|
|
16
|
+
* sync; takeover happens when the marker is >10 minutes old AND the owning
|
|
17
|
+
* pid is confirmed dead (`process.kill(pid, 0)`), or when the pid is our
|
|
18
|
+
* own (second call in-process).
|
|
19
|
+
* - The `complete` marker is only written when the sync had zero failures
|
|
20
|
+
* and the embedding provider was available. Anything less leaves no
|
|
21
|
+
* marker, so the next boot retries — content-hash dedup inside
|
|
22
|
+
* `syncFromSage` makes that retry cheap (already-mirrored texts skip).
|
|
23
|
+
* - Privacy: the adapter (createSageSurfaceSyncSource) deliberately omits
|
|
24
|
+
* sessionId/includeAllSessions, keeping SAGE's under-report default for
|
|
25
|
+
* session-scoped memories — another session's private records are never
|
|
26
|
+
* mirrored into this shared project-scoped store.
|
|
27
|
+
* - Teardown race: if the store is closed mid-sync, subsequent remember()
|
|
28
|
+
* calls throw inside syncFromSage's per-entry guard, the report comes
|
|
29
|
+
* back with failures, and no marker is written — next boot retries.
|
|
30
|
+
*/
|
|
1
31
|
import type { MemoryPort } from '@wrongstack/core/types';
|
|
2
32
|
import type { VectorMemoryStore } from './store.js';
|
|
3
33
|
/** Sync marker file written next to the vector db (`running` → `complete` phases). */
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* feature-extraction pipeline as a sage `EmbeddingProvider`.
|
|
4
4
|
*
|
|
5
5
|
* The provider is lazy: nothing is imported until `embed()` is first called.
|
|
6
|
-
* If `@huggingface/transformers` is not installed
|
|
7
|
-
*
|
|
6
|
+
* If the opt-in `@huggingface/transformers` package is not installed,
|
|
7
|
+
* `isAvailable()` returns false and `embed()` throws
|
|
8
8
|
* a descriptive `VectorMemoryProviderUnavailableError` so callers can
|
|
9
9
|
* fall back to `HashingEmbeddingProvider`.
|
|
10
10
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/vector-memory",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "WrongStack Vector Memory — an additional vector-search memory store powered by @huggingface/transformers (local ONNX embeddings), alongside the SAGE lexical memory system.",
|
|
6
6
|
"repository": {
|
|
@@ -27,12 +27,9 @@
|
|
|
27
27
|
"README.md"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@wrongstack/core": "1.0.
|
|
31
|
-
"@wrongstack/persistence": "1.0.
|
|
32
|
-
"@wrongstack/sage": "1.0.
|
|
33
|
-
},
|
|
34
|
-
"optionalDependencies": {
|
|
35
|
-
"@huggingface/transformers": "^4.2.0"
|
|
30
|
+
"@wrongstack/core": "1.0.4",
|
|
31
|
+
"@wrongstack/persistence": "1.0.4",
|
|
32
|
+
"@wrongstack/sage": "1.0.4"
|
|
36
33
|
},
|
|
37
34
|
"devDependencies": {
|
|
38
35
|
"@types/node": "^26.2.0",
|
|
@@ -45,7 +42,7 @@
|
|
|
45
42
|
},
|
|
46
43
|
"scripts": {
|
|
47
44
|
"build": "node ../../scripts/build-package.mjs",
|
|
48
|
-
"typecheck": "tsc --noEmit
|
|
45
|
+
"typecheck": "tsc --noEmit",
|
|
49
46
|
"test": "vitest run",
|
|
50
47
|
"test:integration": "WRONGSTACK_VECTOR_INTEGRATION=1 vitest run tests/integration.test.ts",
|
|
51
48
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
|