@avantf/dsh-mem 0.4.0 → 0.4.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/lib/client.js +3 -1
- package/lib/engine/mem/config/config_files.d.ts +1 -1
- package/lib/engine/mem/db/dao/facts.d.ts +12 -0
- package/lib/engine/mem/db/vectors.d.ts +8 -2
- package/lib/engine/mem/store/common.d.ts +19 -9
- package/lib/engine/mem/store/floors.d.ts +28 -12
- package/lib/engine/mem/store/hybrid.d.ts +9 -0
- package/lib/engine/mem/store/knowledge.d.ts +2 -0
- package/lib/engine/mem/store/memory.d.ts +64 -4
- package/lib/engine/mem/store/self_query.d.ts +53 -0
- package/lib/engine/mem-contract/config.d.ts +5 -2
- package/lib/engine/mem-contract/types.d.ts +60 -0
- package/lib/engine/mem-retrieval/adapters/hnswlib.d.ts +11 -9
- package/lib/index.js +595 -104
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/envinit.d.ts +2 -1
- package/lib/types/envinit.d.ts.map +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/render.d.ts.map +1 -1
- package/lib/types/vectorMigration.d.ts +44 -0
- package/lib/types/vectorMigration.d.ts.map +1 -0
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAwGA,wDAAwD;AACxD,UAAU,aAAa;IACrB,KAAK,EAAE;QACL,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAA;QAChD,QAAQ,CACN,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,MAAM,CAAA;SAAE,EACzE,SAAS,EAAE,MAAM,OAAO,GACvB,IAAI,CAAA;KACR,CAAA;IACD,MAAM,EAAE;QACN,wEAAwE;QACxE,MAAM,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;KAC5D,CAAA;IACD;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;CAC3B;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAwGA,wDAAwD;AACxD,UAAU,aAAa;IACrB,KAAK,EAAE;QACL,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAA;QAChD,QAAQ,CACN,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,MAAM,CAAA;SAAE,EACzE,SAAS,EAAE,MAAM,OAAO,GACvB,IAAI,CAAA;KACR,CAAA;IACD,MAAM,EAAE;QACN,wEAAwE;QACxE,MAAM,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;KAC5D,CAAA;IACD;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;CAC3B;AAyhDD,2DAA2D;AAC3D,eAAO,MAAM,IAAI,sBAAsB,CAAA;AAEvC;;;;GAIG;AACH,eAAO,MAAM,MAAM,UAAsB,CAAA;AAEzC,mGAAmG;AACnG,wBAAsB,KAAK,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAoC7D"}
|
package/lib/types/envinit.d.ts
CHANGED
|
@@ -58,7 +58,8 @@ export interface ResourcePlan {
|
|
|
58
58
|
* 2. **The runtime reads its models from elsewhere** — `semantic.cache_dir` is not the framework's
|
|
59
59
|
* `<home>/models`. That happens through the operator escape hatch `AVANTF_MEM_MODEL_CACHE`
|
|
60
60
|
* (env layer ④): the runtime loads from that directory, so a `mem:model` item would install a
|
|
61
|
-
* full second copy under `<home>/models` that nothing ever reads (~
|
|
61
|
+
* full second copy under `<home>/models` that nothing ever reads (~389 MB for the default
|
|
62
|
+
* `Xenova/bge-base-zh-v1.5`). Declaring nothing
|
|
62
63
|
* is the fix; the caller warms from the override directory instead.
|
|
63
64
|
*
|
|
64
65
|
* `files` is the narrow {@link MODEL_FILES} set only for the DEFAULT repo; a user-changed repo has a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envinit.d.ts","sourceRoot":"","sources":["../../src/envinit.ts"],"names":[],"mappings":"AAoDA,OAAO,KAAK,EAAiB,oBAAoB,EAAe,MAAM,yBAAyB,CAAA;AAG/F,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAA;AAKvB,4FAA4F;AAC5F,KAAK,aAAa,GAAG,cAAc,yBAAyB,CAAC,CAAA;AAK7D;;;GAGG;AACH,eAAO,MAAM,WAAW,eAAe,CAAA;AACvC,eAAO,MAAM,UAAU,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"envinit.d.ts","sourceRoot":"","sources":["../../src/envinit.ts"],"names":[],"mappings":"AAoDA,OAAO,KAAK,EAAiB,oBAAoB,EAAe,MAAM,yBAAyB,CAAA;AAG/F,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAA;AAKvB,4FAA4F;AAC5F,KAAK,aAAa,GAAG,cAAc,yBAAyB,CAAC,CAAA;AAK7D;;;GAGG;AACH,eAAO,MAAM,WAAW,eAAe,CAAA;AACvC,eAAO,MAAM,UAAU,cAAc,CAAA;AAmDrC,2EAA2E;AAC3E,UAAU,aAAa;IACrB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,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E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAiB7D,yDAAyD;AACzD,eAAO,MAAM,MAAM;;;;;6BAED,OAAO,SAAS,SAAS,KAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE;CAQpE,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The plugin's driver for the bounded, resumable background migration of persisted vectors into the
|
|
3
|
+
* current embedding space.
|
|
4
|
+
*
|
|
5
|
+
* Changing the embedding space (default model, width, pooling, normalization) is a DATA MIGRATION,
|
|
6
|
+
* not a config tweak: every persisted vector still decodes, but in another model's coordinates, so
|
|
7
|
+
* the semantic leg must not serve it. Measured on the real library after the 512→768 default-model
|
|
8
|
+
* swap, 78 of 80 ACTIVE facts fell out of the semantic leg and retrieval degraded to lexical+entity
|
|
9
|
+
* with no error anywhere — the store's open-time warning now says so, and this module is what
|
|
10
|
+
* repairs it without the operator having to know `vectors --fix` exists.
|
|
11
|
+
*
|
|
12
|
+
* It sits BEHIND the startup gate (`awaitStartupGate`, see index.ts): the model warm and this first
|
|
13
|
+
* batch must not land in the boot window (DESIGN §20.14), and the tokenizer/model are the expensive
|
|
14
|
+
* resources the gate exists to move out. The loop itself lives in the store
|
|
15
|
+
* (`MemoryStore.migrateVectors`), which owns the batch size, the per-batch error handling and the
|
|
16
|
+
* event-loop yield; this module owns the LOGGING (start / progress / end) and the lifecycle
|
|
17
|
+
* (`shouldStop` = plugin disposed or runtime closed).
|
|
18
|
+
*
|
|
19
|
+
* Deliberately no new state in this file: what still needs migrating is derived from the database on
|
|
20
|
+
* every pass, which is exactly what makes the migration resumable across a restart.
|
|
21
|
+
*/
|
|
22
|
+
import { type AvantfRuntime } from '../engine/mem/index.js';
|
|
23
|
+
import type { AvantfLogger } from '../engine/mem-contract/index.js';
|
|
24
|
+
export interface VectorMigrationHandle {
|
|
25
|
+
/**
|
|
26
|
+
* Run one migration pass. Quiet no-op when the store is already current, when a pass is already
|
|
27
|
+
* running, or after {@link stop}. Failures never escape: they are logged and left for the next
|
|
28
|
+
* heartbeat to retry.
|
|
29
|
+
*/
|
|
30
|
+
start(): void;
|
|
31
|
+
/** Stop a running pass at its next batch boundary; later `start()` calls are no-ops. */
|
|
32
|
+
stop(): void;
|
|
33
|
+
/** `true` while a pass is in flight. */
|
|
34
|
+
readonly running: boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare function createVectorMigration(opts: {
|
|
37
|
+
rt: AvantfRuntime;
|
|
38
|
+
logger: AvantfLogger;
|
|
39
|
+
/** False once the plugin's fiber is disposed (profile reload / unload). */
|
|
40
|
+
isActive: () => boolean;
|
|
41
|
+
/** Rows per batch; the store's `DEFAULT_VECTOR_MIGRATION_BATCH` when omitted. */
|
|
42
|
+
batchSize?: number;
|
|
43
|
+
}): VectorMigrationHandle;
|
|
44
|
+
//# sourceMappingURL=vectorMigration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vectorMigration.d.ts","sourceRoot":"","sources":["../../src/vectorMigration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,KAAK,IAAI,IAAI,CAAA;IACb,wFAAwF;IACxF,IAAI,IAAI,IAAI,CAAA;IACZ,wCAAwC;IACxC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,EAAE,EAAE,aAAa,CAAA;IACjB,MAAM,EAAE,YAAY,CAAA;IACpB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,OAAO,CAAA;IACvB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,qBAAqB,CAsExB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avantf/dsh-mem",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "avantf-mem DSH native Cordis plugin: host service + tools + RPC + client tabs 记忆/知识",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -78,10 +78,10 @@
|
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@avantf/dsh-plugin-base": ">=0.3.0 <1.0.0",
|
|
81
|
-
"@avantf/mem": "0.4.
|
|
82
|
-
"@avantf/mem-contract": "0.4.
|
|
83
|
-
"@avantf/mem-convert": "0.4.
|
|
84
|
-
"@avantf/mem-provision": "0.4.
|
|
81
|
+
"@avantf/mem": "0.4.2",
|
|
82
|
+
"@avantf/mem-contract": "0.4.2",
|
|
83
|
+
"@avantf/mem-convert": "0.4.2",
|
|
84
|
+
"@avantf/mem-provision": "0.4.2",
|
|
85
85
|
"@types/node": "^22.0.0",
|
|
86
86
|
"@types/react": "^18.3.0",
|
|
87
87
|
"lightningcss": "^1.32.0",
|