@kenz1117/dsh-engram 0.13.8 → 0.13.10
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/CHANGELOG.md +12 -0
- package/README.md +1 -0
- package/lib/client.js +1 -1
- package/lib/client.js.map +1 -1
- package/lib/index.js +2 -2
- package/package.json +2 -2
- package/scripts/backfill-embeddings.mjs +9 -1
package/lib/index.js
CHANGED
|
@@ -13868,7 +13868,7 @@ async function openEngramStore(path, rankBoost = NO_BOOST, automation = DEFAULT_
|
|
|
13868
13868
|
const sqlCountOps = db.prepare("SELECT op, COUNT(*) AS n FROM op_log WHERE at >= ? GROUP BY op");
|
|
13869
13869
|
const sqlRevisionInsert = db.prepare("INSERT INTO nodes_revisions (node_id, memory_id, content, kind, importance, superseded_at) VALUES (?, ?, ?, ?, ?, ?)");
|
|
13870
13870
|
const sqlRevisionsById = db.prepare("SELECT content, kind, importance, superseded_at FROM nodes_revisions WHERE memory_id = ? ORDER BY superseded_at DESC, rowid DESC");
|
|
13871
|
-
const sqlTopActive = db.prepare("SELECT * FROM nodes WHERE scope = ? AND status = 'active' ORDER BY importance DESC,
|
|
13871
|
+
const sqlTopActive = db.prepare("SELECT * FROM nodes WHERE scope = ? AND status = 'active' ORDER BY importance DESC, created_at DESC, id ASC LIMIT ?");
|
|
13872
13872
|
const sqlEdgeUpsert = db.prepare("INSERT OR IGNORE INTO edges (from_id, to_id, type, created_at) VALUES (?, ?, ?, ?)");
|
|
13873
13873
|
const sqlNeighbors = db.prepare(`SELECT * FROM edges WHERE from_id IN (SELECT value FROM json_each(?))
|
|
13874
13874
|
AND type IN ('supports','refines','related') LIMIT ?`);
|
|
@@ -18782,7 +18782,7 @@ function estimateTokens(text) {
|
|
|
18782
18782
|
return Math.ceil(wide * WIDE_TOKENS_PER_CHAR + narrow / 4);
|
|
18783
18783
|
}
|
|
18784
18784
|
// package.json
|
|
18785
|
-
var version = "0.13.
|
|
18785
|
+
var version = "0.13.10";
|
|
18786
18786
|
// src/index.ts
|
|
18787
18787
|
/**
|
|
18788
18788
|
* dsh-engram:DeepSeek Harness 跨会话长期记忆插件(host 半)。
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kenz1117/dsh-engram",
|
|
3
3
|
"description": "Local-first cross-session long-term memory for DeepSeek Harness: dual-scope SQLite stores, hybrid FTS5 + local-vector retrieval with RRF, an evidence gate, provenance audit and SM-2 spaced repetition. 23 narrow tools, zero external services, zero API keys.",
|
|
4
|
-
"version": "0.13.
|
|
4
|
+
"version": "0.13.10",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"logo": "icon-256.svg",
|
|
7
7
|
"publishConfig": {
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"optional": true
|
|
124
124
|
}
|
|
125
125
|
},
|
|
126
|
-
"
|
|
126
|
+
"optionalDependencies": {
|
|
127
127
|
"@huggingface/transformers": "^4.3.2"
|
|
128
128
|
},
|
|
129
129
|
"devDependencies": {
|
|
@@ -183,7 +183,15 @@ function findDatabases(dbDir) {
|
|
|
183
183
|
*/
|
|
184
184
|
async function createEmbedder(options) {
|
|
185
185
|
// 动态 import:--help 与参数错误不加载模型运行时。
|
|
186
|
-
|
|
186
|
+
// 引擎是 optionalDependencies:弱网安装可能被跳过。这里必须说清发生了什么、
|
|
187
|
+
// 怎么补,而不是抛一段裸栈。
|
|
188
|
+
let transformers
|
|
189
|
+
try {
|
|
190
|
+
transformers = await import('@huggingface/transformers')
|
|
191
|
+
} catch {
|
|
192
|
+
throw new Error(`本地嵌入引擎未随插件安装(弱网安装可能跳过 optionalDependencies)。请网络稳定时更新/重装插件,或手动执行:pnpm add @huggingface/transformers --filter "@kenz1117/dsh-engram"`)
|
|
193
|
+
}
|
|
194
|
+
const { env, pipeline } = transformers
|
|
187
195
|
env.cacheDir = options.cacheDir
|
|
188
196
|
// 下载端点可经 HF_ENDPOINT 覆盖(镜像);模型已在缓存时不会访问网络。
|
|
189
197
|
if (process.env.HF_ENDPOINT) env.remoteHost = process.env.HF_ENDPOINT
|