@avantf/dsh-mem 0.8.1 → 0.10.0

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.
Files changed (57) hide show
  1. package/README.md +42 -43
  2. package/lib/client.js +1181 -327
  3. package/lib/engine/graph-recall/index.d.ts +2 -2
  4. package/lib/engine/graph-recall/traverse.d.ts +2 -2
  5. package/lib/engine/graph-recall/types.d.ts +1 -1
  6. package/lib/engine/mem/config/config_files.d.ts +1 -1
  7. package/lib/engine/mem/db/dao/facts.d.ts +80 -82
  8. package/lib/engine/mem/dbdrivers/sqlite/facts.d.ts +6 -13
  9. package/lib/engine/mem/defaults.d.ts +4 -1
  10. package/lib/engine/mem/entities/extract.d.ts +34 -14
  11. package/lib/engine/mem/facts_io.d.ts +4 -0
  12. package/lib/engine/mem/index.d.ts +1 -0
  13. package/lib/engine/mem/interfaces/repositories.d.ts +5 -19
  14. package/lib/engine/mem/lifecycle/maintenance.d.ts +8 -4
  15. package/lib/engine/mem/lifecycle/tick.d.ts +11 -10
  16. package/lib/engine/mem/lifecycle/trust.d.ts +24 -37
  17. package/lib/engine/mem/modelBootstrap.d.ts +29 -0
  18. package/lib/engine/mem/runtime.d.ts +4 -8
  19. package/lib/engine/mem/store/facts_restore.d.ts +8 -6
  20. package/lib/engine/mem/store/graph_reader.d.ts +2 -2
  21. package/lib/engine/mem/store/memory.d.ts +98 -37
  22. package/lib/engine/mem/store/recall_policy.d.ts +10 -0
  23. package/lib/engine/mem/store/time_filter.d.ts +1 -1
  24. package/lib/engine/mem/trustHeartbeat.d.ts +1 -1
  25. package/lib/engine/mem-contract/config.d.ts +144 -9
  26. package/lib/engine/mem-contract/index.d.ts +2 -0
  27. package/lib/engine/mem-contract/time.d.ts +75 -0
  28. package/lib/engine/mem-contract/tools.d.ts +9 -15
  29. package/lib/engine/mem-contract/trust_curve.d.ts +119 -0
  30. package/lib/engine/mem-contract/types.d.ts +73 -12
  31. package/lib/engine/mem-retrieval/adapters/auto_vstore.d.ts +10 -0
  32. package/lib/engine/mem-retrieval/adapters/hnswlib.d.ts +28 -0
  33. package/lib/engine/mem-retrieval/adapters/local_bge.d.ts +48 -6
  34. package/lib/engine/mem-retrieval/interfaces.d.ts +22 -2
  35. package/lib/engine/mem-retrieval/text_budget.d.ts +31 -0
  36. package/lib/index.js +2349 -665
  37. package/lib/interface-version.json +2 -2
  38. package/lib/types/client/index.d.ts.map +1 -1
  39. package/lib/types/client/paging.d.ts +58 -8
  40. package/lib/types/client/paging.d.ts.map +1 -1
  41. package/lib/types/client/time_filter.d.ts +54 -0
  42. package/lib/types/client/time_filter.d.ts.map +1 -0
  43. package/lib/types/command.d.ts.map +1 -1
  44. package/lib/types/deps_audit.d.ts +88 -0
  45. package/lib/types/deps_audit.d.ts.map +1 -0
  46. package/lib/types/envinit-bootstrap.d.ts +1 -1
  47. package/lib/types/envinit.d.ts +224 -4
  48. package/lib/types/envinit.d.ts.map +1 -1
  49. package/lib/types/hints.d.ts +58 -0
  50. package/lib/types/hints.d.ts.map +1 -1
  51. package/lib/types/index.d.ts.map +1 -1
  52. package/lib/types/remote.d.ts.map +1 -1
  53. package/lib/types/render.d.ts.map +1 -1
  54. package/lib/types/runtime_deps_resource.d.ts +29 -0
  55. package/lib/types/runtime_deps_resource.d.ts.map +1 -0
  56. package/package.json +26 -24
  57. package/res/runtime-deps.yaml +99 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAQlD,OAAO,CAAC,MAAM,0BAA0B,CAAA;AACxC,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAE5E,OAAO,EAAE,mBAAmB,EAAU,MAAM,kCAAkC,CAAA;AAE9E,OAAO,EASL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK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CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,SAAS,CAEnE;AA8BD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB,EAAE,kBA0C9B,CAAA"}
1
+ {"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../src/remote.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,oBAAoB,EAGpB,wBAAwB,EACzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAA;AAGhF,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AA8F/D,eAAO,MAAM,WAAW,EAAE,SAAS,oBAAoB,EAsFtD,CAAA;AAED,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB,EAAE,wBAGhC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,eAAO,MAAM,YAAY,IAAI,CAAA;AAE7B;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,SAAS,CAEnE;AA8BD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB,EAAE,kBA0C9B,CAAA"}
@@ -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;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"}
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;AAwC7D,yDAAyD;AACzD,eAAO,MAAM,MAAM;;;;;6BAED,OAAO,SAAS,SAAS,KAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE;CAUpE,CAAA"}
@@ -0,0 +1,29 @@
1
+ import { type RuntimeDepsResource } from '../engine/mem-contract/index.js';
2
+ /** The loader's answer: the parsed resource, or why it could not be used. */
3
+ export type RuntimeDepsResourceLoad = {
4
+ readonly ok: true;
5
+ readonly path: string;
6
+ readonly resource: RuntimeDepsResource;
7
+ } | {
8
+ readonly ok: false;
9
+ readonly path: string;
10
+ readonly reason: string;
11
+ };
12
+ /**
13
+ * `res/runtime-deps.yaml` next to the package that owns this module.
14
+ *
15
+ * `import.meta.url` is the anchor (not `process.cwd()`, not a config path): the file ships beside the
16
+ * code, and an installed plugin must read the copy its own package manager put there.
17
+ */
18
+ export declare function runtimeDepsResourceUrl(): URL;
19
+ /**
20
+ * Read and validate the shipped declaration.
21
+ *
22
+ * Synchronous on purpose: it is a few kilobytes next to the entry module, read once at mount, and the
23
+ * caller's plan (the item specs and the audit entries) has to exist before anything is declared.
24
+ *
25
+ * `url` is injectable so a test can point at a scratch install directory; production always uses
26
+ * {@link runtimeDepsResourceUrl}.
27
+ */
28
+ export declare function loadRuntimeDepsResource(url?: URL): RuntimeDepsResourceLoad;
29
+ //# sourceMappingURL=runtime_deps_resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime_deps_resource.d.ts","sourceRoot":"","sources":["../../src/runtime_deps_resource.ts"],"names":[],"mappings":"AA6BA,OAAO,EAA6B,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE1F,6EAA6E;AAC7E,MAAM,MAAM,uBAAuB,GAC/B;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAA;CAAE,GACpF;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAE1E;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,GAAG,CAE5C;AAYD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,GAA8B,GAAG,uBAAuB,CAiCpG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avantf/dsh-mem",
3
- "version": "0.8.1",
3
+ "version": "0.10.0",
4
4
  "description": "avantf-mem DSH native Cordis plugin: host service + memory tools + RPC + client 记忆 tab",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -34,12 +34,22 @@
34
34
  "!lib/client.js.map",
35
35
  "!lib/types/**/*.js",
36
36
  "!lib/types/**/*.js.map",
37
+ "res",
37
38
  "cordis.patch.yml",
38
39
  "README.md"
39
40
  ],
40
41
  "engines": {
41
42
  "node": ">=22.15.0 <23 || >=23.11.0"
42
43
  },
44
+ "scripts": {
45
+ "build": "node ../../../build/scripts/link-base.mjs && node ../../scripts/link-dsh.mjs && node ../../scripts/link-envinit.mjs && tsc -p tsconfig.json && node ../../scripts/copy-envinit-bootstrap.mjs && node ../../scripts/carry-engine-types.mjs && tsdown",
46
+ "bundle": "tsdown",
47
+ "watch": "tsdown --watch",
48
+ "typecheck": "node ../../../build/scripts/link-base.mjs && node ../../scripts/link-dsh.mjs && tsc -p tsconfig.test.json",
49
+ "test": "node ../../../build/scripts/link-base.mjs && node ../../scripts/link-envinit.mjs && vitest run",
50
+ "test:dsh": "node ../../../build/scripts/link-base.mjs && vitest run --config vitest.dsh.config.ts",
51
+ "prepublishOnly": "node ../../../build/scripts/prepublish-assert.mjs --package @avantf/dsh-mem && node ../../../build/scripts/pack-plugin.mjs"
52
+ },
43
53
  "peerDependencies": {
44
54
  "@deepseek-ai/cordis": "^4.0.0",
45
55
  "@deepseek-ai/dsh-llm": "^0.1.5-rc.2 || ^0.1.7-rc.2 || ^0.2.0-rc.2",
@@ -71,26 +81,26 @@
71
81
  },
72
82
  "dependencies": {
73
83
  "@avantf/dsh-plugin-base": ">=0.3.0 <1.0.0",
74
- "yaml": "^2.5.0"
84
+ "yaml": "catalog:"
75
85
  },
76
86
  "optionalDependencies": {
77
- "@huggingface/transformers": "^4.2.0",
78
- "hnswlib-node": "^2.1.1",
79
- "nodejieba": "^2.6.0"
87
+ "@huggingface/transformers": "catalog:",
88
+ "hnswlib-node": "catalog:",
89
+ "nodejieba": "catalog:"
80
90
  },
81
91
  "devDependencies": {
82
92
  "@avantf/dsh-plugin-base": ">=0.3.0 <1.0.0",
83
- "@avantf/mem": "0.8.1",
84
- "@avantf/mem-contract": "0.8.1",
85
- "@avantf/mem-provision": "0.8.1",
86
- "@types/node": "^22.0.0",
93
+ "@avantf/mem": "workspace:*",
94
+ "@avantf/mem-contract": "workspace:*",
95
+ "@avantf/mem-provision": "workspace:*",
96
+ "@types/node": "catalog:",
87
97
  "@types/react": "^18.3.0",
88
- "lightningcss": "^1.32.0",
89
- "react": "18.3.1",
98
+ "lightningcss": "catalog:",
99
+ "react": "catalog:",
90
100
  "tsdown": "0.22.2",
91
- "typescript": "^5.5.0",
92
- "vitest": "^2.1.0",
93
- "zod": "4.4.3"
101
+ "typescript": "catalog:",
102
+ "vitest": "catalog:",
103
+ "zod": "catalog:"
94
104
  },
95
105
  "license": "MIT",
96
106
  "publishConfig": {
@@ -102,13 +112,5 @@
102
112
  "url": "git@gitee.com:ffeng86/dsh-mem.git",
103
113
  "directory": "packages/plugin"
104
114
  },
105
- "author": "qunqi.ff",
106
- "scripts": {
107
- "build": "node ../../../build/scripts/link-base.mjs && node ../../scripts/link-dsh.mjs && node ../../scripts/link-envinit.mjs && tsc -p tsconfig.json && node ../../scripts/copy-envinit-bootstrap.mjs && node ../../scripts/carry-engine-types.mjs && tsdown",
108
- "bundle": "tsdown",
109
- "watch": "tsdown --watch",
110
- "typecheck": "node ../../../build/scripts/link-base.mjs && node ../../scripts/link-dsh.mjs && tsc -p tsconfig.test.json",
111
- "test": "node ../../../build/scripts/link-base.mjs && node ../../scripts/link-envinit.mjs && vitest run",
112
- "test:dsh": "node ../../../build/scripts/link-base.mjs && vitest run --config vitest.dsh.config.ts"
113
- }
114
- }
115
+ "author": "qunqi.ff"
116
+ }
@@ -0,0 +1,99 @@
1
+ # Dependency declaration shipped WITH @avantf/dsh-mem.
2
+ #
3
+ # This file is DATA, not policy: it names the optional modules this build looks for, where an install
4
+ # may come from, and what a session is told when one of them cannot be loaded. It travels inside the
5
+ # published tarball (`files: ["res"]` in package.json) and is read from the INSTALL directory at
6
+ # mount — never from a user's `configs/common.yaml`, so a profile cannot drift from the code that
7
+ # depends on it. The only per-deployment knobs left in the user config are the two `enabled` switches
8
+ # (`semantic.self_heal.enabled`, `semantic.native_self_heal.enabled`); everything below is the
9
+ # plugin's own declaration.
10
+ #
11
+ # Shape: `RuntimeDepsResourceSchema` in @avantf/mem-contract. A malformed file is a packaging bug: the
12
+ # plugin logs it and degrades (no self-heal item, no dependency audit) instead of refusing the mount.
13
+ #
14
+ # `sources[].cache: ''` on a source with NO registry means the family root's npm cache
15
+ # (`<home>/cache/npm`); a source WITH a registry is a registry source.
16
+ version: 1
17
+
18
+ # `@huggingface/transformers` — the local ONNX embedding backend's optional module (plus its
19
+ # transitive onnxruntime-node). Mirrors the providers this project has always used: the domestic
20
+ # mirror first, then npmjs, each also once with ONNXRUNTIME_NODE_INSTALL=skip (onnxruntime-node's
21
+ # postinstall download returns 302 on some mirrors and the WASM/CPU fallback is enough), then a
22
+ # cache-only (offline) attempt.
23
+ semantic:
24
+ packages:
25
+ "@huggingface/transformers": "^4.2.0"
26
+ sources:
27
+ - { id: npmmirror, registry: "https://registry.npmmirror.com", cache: "" }
28
+ - { id: npmjs, registry: "https://registry.npmjs.org", cache: "" }
29
+ - { id: local-store, registry: "", cache: "" }
30
+ attempts:
31
+ - { source: npmmirror, env: {}, allowScripts: true }
32
+ - { source: npmmirror, env: { ONNXRUNTIME_NODE_INSTALL: skip }, allowScripts: true }
33
+ - { source: npmjs, env: {}, allowScripts: true }
34
+ - { source: npmjs, env: { ONNXRUNTIME_NODE_INSTALL: skip }, allowScripts: true }
35
+ - { source: local-store, env: {}, allowScripts: true }
36
+ verify: ["@huggingface/transformers"]
37
+
38
+ # The native optional dependencies. Both are node-gyp builds, so `allowScripts: true` is REQUIRED:
39
+ # the install script is what produces the binding, and an --ignore-scripts install would resolve and
40
+ # then fail on first use. They go into their own content-addressed root (a different package set is a
41
+ # different key), never the transformers one.
42
+ native:
43
+ packages:
44
+ nodejieba: "^2.6.0"
45
+ "hnswlib-node": "^2.1.1"
46
+ sources:
47
+ - { id: npmmirror, registry: "https://registry.npmmirror.com", cache: "" }
48
+ - { id: npmjs, registry: "https://registry.npmjs.org", cache: "" }
49
+ - { id: local-store, registry: "", cache: "" }
50
+ attempts:
51
+ - { source: npmmirror, env: {}, allowScripts: true }
52
+ - { source: npmjs, env: {}, allowScripts: true }
53
+ - { source: local-store, env: {}, allowScripts: true }
54
+ verify: ["nodejieba", "hnswlib-node"]
55
+
56
+ # The startup dependency audit + the session notices it drives. `kind: module` LOADS the specifier
57
+ # (a real require/import, so a native addon's binding is loaded rather than merely found) from a ready
58
+ # self-heal root first and from this tree otherwise; `kind: runtime-deps` observes that item's state.
59
+ # Delivery: `when` against the observed state (`failed` / `missing` / `degraded`; `pending` and
60
+ # `unknown` match nothing), and `min_vectors` (optional) holds a line back until the corpus is big
61
+ # enough for the missing piece to matter. These sentences are what a session is told — they belong to
62
+ # this deployment's vocabulary (Chinese, per DESIGN §12), not to base or engine code.
63
+ audit:
64
+ - id: mem:nodejieba
65
+ kind: module
66
+ specifier: nodejieba
67
+ severity: warning
68
+ when: missing
69
+ body: |
70
+ [avantf-mem] 分词依赖 nodejieba 不可用:实体/关系抽取已退化为正则,实体腿与 Jaccard 腿会变弱。
71
+ - id: mem:hnswlib
72
+ kind: module
73
+ specifier: hnswlib-node
74
+ severity: info
75
+ when: missing
76
+ min_vectors: 2000
77
+ body: |
78
+ [avantf-mem] 向量索引依赖 hnswlib-node 不可用:语义检索仍然可用,但语料达到阈值后改走暴力检索(更慢)。
79
+ - id: mem:transformers
80
+ kind: module
81
+ specifier: "@huggingface/transformers"
82
+ severity: degraded
83
+ when: missing
84
+ body: |
85
+ [avantf-mem] 语义检索依赖 @huggingface/transformers 不可用:检索仅剩 FTS+实体(语义腿关闭)。
86
+ - id: mem:semantic-deps
87
+ kind: runtime-deps
88
+ item: mem:semantic-deps
89
+ severity: degraded
90
+ when: failed
91
+ body: |
92
+ [avantf-mem] 语义依赖自愈未完成:检索已降级到 FTS+实体,修复后新会话不再出现本提示。
93
+ - id: mem:native-deps
94
+ kind: runtime-deps
95
+ item: mem:native-deps
96
+ severity: warning
97
+ when: failed
98
+ body: |
99
+ [avantf-mem] 原生依赖自愈未完成:分词与向量索引按各自的回退继续工作,修复后新会话不再出现本提示。