@a9i5k4/dsh-auto-memory 0.1.32 → 0.1.34
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 +12 -0
- package/README.zh-CN.md +12 -0
- package/lib/client.js +12 -4
- package/lib/index.js +2 -0
- package/lib/semantic-js.js +6 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -220,6 +220,18 @@ Then edit `package.json` in that directory and append to the `dsh.profile.bundle
|
|
|
220
220
|
|
|
221
221
|
Restart **dsh web** (the 「Memory」entry appears in the sidebar).
|
|
222
222
|
|
|
223
|
+
### Semantic engine (optional but recommended)
|
|
224
|
+
|
|
225
|
+
The built-in JS semantic tier (e5-small q8, ~130MB) needs the `@huggingface/transformers` inference library, installed automatically as an optional dependency of the main package. If your pnpm security policy blocked its native scripts (you see `ERR_PNPM_IGNORED_BUILDS` / `Ignored build scripts: onnxruntime-node, sharp`), approve and reinstall once:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
# approve the onnxruntime-node / sharp native install scripts, then reinstall transformers
|
|
229
|
+
pnpm approve-builds
|
|
230
|
+
pnpm add @huggingface/transformers
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Restart `dsh web` — the welcome tour's semantic-engine step auto-detects readiness (SHA256 verify + inference self-test). Lexical BM25 (0GB) always works as a fallback; skipping the engine only lowers recall precision.
|
|
234
|
+
|
|
223
235
|
> No pnpm? `npm install @a9i5k4/dsh-auto-memory` works the same.
|
|
224
236
|
> pnpm v11 blocks packages published <1 day ago: set `minimumReleaseAge: 0` in pnpm-workspace.yaml or pin an explicit version for same-day updates.
|
|
225
237
|
|
package/README.zh-CN.md
CHANGED
|
@@ -230,6 +230,18 @@ cd ~/.dsh/profiles/web
|
|
|
230
230
|
pnpm add @a9i5k4/dsh-auto-memory
|
|
231
231
|
```
|
|
232
232
|
|
|
233
|
+
### 语义引擎(可选但推荐)
|
|
234
|
+
|
|
235
|
+
内置 JS 语义档(e5-small q8 ~130MB)需要推理库 `@huggingface/transformers`(随主包作为可选依赖自动安装)。若你的 pnpm 因安全策略拦截了它的原生脚本(提示 `ERR_PNPM_IGNORED_BUILDS` / `Ignored build scripts: onnxruntime-node, sharp`),执行一次批准后重装即可:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# 批准 onnxruntime-node / sharp 的原生安装脚本,再重装 transformers
|
|
239
|
+
pnpm approve-builds
|
|
240
|
+
pnpm add @huggingface/transformers
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
装完重启 `dsh web`,向导的语义引擎步会自动检测到就绪(SHA256 校验 + 推理自检)。词法检索 0GB 永远兜底,不装也能用(仅召回精度较低)。
|
|
244
|
+
|
|
233
245
|
然后编辑同目录 `package.json`,在 `dsh.profile.bundles` 数组追加:
|
|
234
246
|
|
|
235
247
|
```json
|
package/lib/client.js
CHANGED
|
@@ -492,6 +492,9 @@ window.__ModuleLoader__.load({
|
|
|
492
492
|
'修复:更新弹窗在小卡形态下内容被裁剪、底部按钮不可达导致无法关闭——新增右上 ✕ 关闭(同步已读版本),内容区自动滚动。',
|
|
493
493
|
'改进:「唤起回顾」决策↔投递时间线——每条决策标注真实投递结果(✓投递×N/未投递/技能✓),判定队列汇总与政策提示;记忆固化(stale 门降版本容忍,语料升版不再整单压制召回)。',
|
|
494
494
|
'补丁 0.1.31:发布物运行时 section 名 dsh:m6-reference-tail → 裸名(发布身份统一,不再带预览标识)。',
|
|
495
|
+
'补丁 0.1.32:「记忆唤起」开关与设置页双向联动(导览与设置走同一 semantic-emit 接口);语义引擎分级引导(无引擎自动装 JS 档,发烧友可选 Python)。',
|
|
496
|
+
'补丁 0.1.33:修复语义引擎下载 404(镜像 URL 重复前缀);transformers 推理库声明为可选依赖并随包分发。',
|
|
497
|
+
'补丁 0.1.34:修复推理库检测——pnpm 把 transformers 提升到 profile 根 node_modules,检测补该路径,新用户装完即用,无需手动操作。',
|
|
495
498
|
], en: [
|
|
496
499
|
'★ MAJOR: Brand-new Welcome Tour — after first launch or upgrade, every feature is introduced step by step with per-feature switches right in the tour (association / snapshot / greeting / night unattended / reflection / summaries / external memory / skill promotion…); engine detection, download, self-test and live external-source scanning are all inline.',
|
|
497
500
|
'★ New brand visuals: an Office/Fluent-style liquid-glass app icon family — each step gets its own colored glass squircle icon (cyan inject / amber greeting / green calendar / violet engine / sky radar / coral finish) with dedicated looping motion (bell sway, page flip, linked rings, prism spin, radar sweep, rising spark); the signature three-slab frosted-glass logo stays on the Core step.',
|
|
@@ -502,6 +505,9 @@ window.__ModuleLoader__.load({
|
|
|
502
505
|
'Fix: The update dialog could become impossible to close when its content overflowed the compact card — added an ✕ in the top-right (marks version seen) and made the content area scrollable.',
|
|
503
506
|
'Improved: Recall-review decision↔delivery timeline (delivered×N / not delivered / skill badges per decision), review-queue digest with policy hints, and consolidation stale-gate version tolerance so corpus version bumps no longer suppress recall.',
|
|
504
507
|
'Patch 0.1.31: release runtime section name dsh:m6-reference-tail → bare name (unified release identity, no preview marker).',
|
|
508
|
+
'Patch 0.1.32: the "Memory recall" switch now syncs bidirectionally with Settings (tour and settings share the semantic-emit endpoint); tiered engine onboarding (auto-install JS tier, Python optional for enthusiasts).',
|
|
509
|
+
'Patch 0.1.33: fixed semantic-engine download 404 (duplicate prefix in mirror URL); transformers inference lib declared as an optional dependency and shipped with the package.',
|
|
510
|
+
'Patch 0.1.34: fixed inference-lib detection — pnpm hoists transformers to the profile-root node_modules; detection now covers that path, so fresh installs work out of the box.',
|
|
505
511
|
] },
|
|
506
512
|
'0.1.29': { zh: [
|
|
507
513
|
'修复:工作区总览一直显示「未发现带记忆的工作区」——DSH 新版会话持久化改为 session.jsonl.zstd 压缩帧,旧逻辑只认 .jsonl 扫描不到任何会话;现已用 zstd 解压读取首行提取 cwd,并让空的 summary 缓存短时失效,避免空结果被永久固化。',
|
|
@@ -2547,14 +2553,14 @@ window.__ModuleLoader__.load({
|
|
|
2547
2553
|
}, [tourShowing])
|
|
2548
2554
|
useEffect(function () {
|
|
2549
2555
|
if (!tourShowing) return undefined
|
|
2550
|
-
if (
|
|
2556
|
+
if (wizSt.ready) return undefined // 已就绪无需轮询
|
|
2551
2557
|
var iv = setInterval(function () {
|
|
2552
2558
|
fetch('/api/dsh-auto-memory/semantic-status').then(function (r) { return r.json() }).then(function (j) {
|
|
2553
2559
|
Object.assign(wizSt, j); try { dlgTick() } catch (e10) {}
|
|
2554
2560
|
}).catch(function () {})
|
|
2555
2561
|
}, 1500)
|
|
2556
2562
|
return function () { clearInterval(iv) }
|
|
2557
|
-
}, [tourShowing, tourDlPhase])
|
|
2563
|
+
}, [tourShowing, tourDlPhase, wizSt.ready])
|
|
2558
2564
|
// 无语义引擎自动引导:进入引擎下载步且引擎未就绪/未下载/未出错时,自动开始下载内置 JS 档(C2 默认)。
|
|
2559
2565
|
// 用户可稍后在设置页手动装 Python 进阶档;词法检索 0GB 永远兜底,不阻塞。
|
|
2560
2566
|
useEffect(function () {
|
|
@@ -2728,7 +2734,9 @@ window.__ModuleLoader__.load({
|
|
|
2728
2734
|
: dl.phase === 'verifying' ? t('dlVerifying')
|
|
2729
2735
|
: dl.phase === 'downloading' ? (t('dlDownloading') + ' · ' + fmtMB(dl.bytesDone || 0) + ' / ' + fmtMB(dl.bytesTotal || totalBytes))
|
|
2730
2736
|
: dl.phase === 'error' ? (t('dlError') + ': ' + String(dl.error || '').slice(0, 90))
|
|
2731
|
-
: dl.phase === 'done' ?
|
|
2737
|
+
: dl.phase === 'done' ? (wizSt.assetPresent && !wizSt.peerPresent
|
|
2738
|
+
? (locale === 'zh' ? '模型已下载,推理库缺失——先 pnpm approve-builds(批准原生脚本),再 pnpm add @huggingface/transformers,重启生效' : 'Model downloaded, inference lib missing — run pnpm approve-builds, then pnpm add @huggingface/transformers, restart')
|
|
2739
|
+
: t('dlDone'))
|
|
2732
2740
|
: (locale === 'zh' ? '未下载 · 词法检索照常可用' : 'Not downloaded · lexical search keeps working')
|
|
2733
2741
|
var startDl = function () {
|
|
2734
2742
|
apiPost('/api/dsh-auto-memory/semantic-download', { action: 'start', mirror: 'auto' }).catch(function () {})
|
|
@@ -3269,7 +3277,7 @@ window.__ModuleLoader__.load({
|
|
|
3269
3277
|
else if (dl.phase === 'error') { stateTxt = t('dlError'); stateBg = 'rgba(196,74,74,.22)' }
|
|
3270
3278
|
else if (dl.phase === 'cancelled') { stateTxt = t('dlCancelled'); stateBg = 'rgba(196,138,42,.2)' }
|
|
3271
3279
|
else if (isJs && dlActive) { stateTxt = dl.phase === 'verifying' ? t('dlVerifying') : t('dlDownloading'); stateBg = 'rgba(36,86,196,.2)' }
|
|
3272
|
-
else if (isJs && sem.assetPresent && !sem.peerPresent) { stateTxt = locale === 'zh' ? '
|
|
3280
|
+
else if (isJs && sem.assetPresent && !sem.peerPresent) { stateTxt = locale === 'zh' ? '模型已存在,缺推理库——pnpm approve-builds 后 pnpm add @huggingface/transformers' : 'Model present, runtime missing — pnpm approve-builds && pnpm add @huggingface/transformers'; stateBg = 'rgba(196,138,42,.2)' }
|
|
3273
3281
|
else { stateTxt = locale === 'zh' ? '未下载' : 'Not downloaded'; stateBg = 'rgba(196,138,42,.2)' }
|
|
3274
3282
|
var progress = dlActive || (isJs && dl.phase === 'done')
|
|
3275
3283
|
? Math.min(100, Math.round(((dl.bytesDone || 0) / Math.max(1, dl.bytesTotal || totalJs)) * 100))
|
package/lib/index.js
CHANGED
|
@@ -4255,6 +4255,8 @@ export function apply(ctx, config) {
|
|
|
4255
4255
|
const modelOnnx = cands.find((c) => fsMod.existsSync(c)) || cands[0]
|
|
4256
4256
|
const peerCands = [
|
|
4257
4257
|
path.join(pluginDir, 'node_modules', '@huggingface', 'transformers'),
|
|
4258
|
+
// pnpm 默认把 peer/optional 依赖提升到 profile 根 node_modules(pluginDir 上两级)
|
|
4259
|
+
path.join(pluginDir, '..', '..', '..', 'node_modules', '@huggingface', 'transformers'),
|
|
4258
4260
|
path.join(pluginDir, '..', 'artifacts', 'm7-live-pre', 'js-semantic-trial', 'node_modules', '@huggingface', 'transformers'),
|
|
4259
4261
|
]
|
|
4260
4262
|
const peerDir = peerCands.find((c) => fsMod.existsSync(c)) || peerCands[0]
|
package/lib/semantic-js.js
CHANGED
|
@@ -76,6 +76,8 @@ function defaultModelsDirCandidates(pluginDir) {
|
|
|
76
76
|
function defaultPeerDirCandidates(pluginDir) {
|
|
77
77
|
return [
|
|
78
78
|
path.join(pluginDir, 'node_modules', '@huggingface', 'transformers'),
|
|
79
|
+
// pnpm 默认把 peer/optional 依赖提升到 profile 根 node_modules(pluginDir 上两级)
|
|
80
|
+
path.join(pluginDir, '..', '..', '..', 'node_modules', '@huggingface', 'transformers'),
|
|
79
81
|
path.join(pluginDir, '..', 'artifacts', 'm7-live-pre', 'js-semantic-trial', 'node_modules', '@huggingface', 'transformers'),
|
|
80
82
|
]
|
|
81
83
|
}
|
|
@@ -282,7 +284,10 @@ export function createSemanticDownloaderPre(opts = {}) {
|
|
|
282
284
|
function tmpDir() { return path.join(modelsRoot, '.tmp-dl') }
|
|
283
285
|
|
|
284
286
|
async function fetchToFile(fileRec, base) {
|
|
285
|
-
|
|
287
|
+
// 镜像 base 已含模型子目录(Xenova/multilingual-e5-small/resolve/main/),
|
|
288
|
+
// rel 带 multilingual-e5-small/ 前缀用于落位;URL 拼接时剥掉前缀避免路径重复 404。
|
|
289
|
+
const urlRel = fileRec.rel.indexOf(E5_MODELS_SUBDIR + '/') === 0 ? fileRec.rel.slice(E5_MODELS_SUBDIR.length + 1) : fileRec.rel
|
|
290
|
+
const res = await doFetch(base + fileRelUrl(urlRel), { redirect: 'follow' })
|
|
286
291
|
if (!res.ok) throw new Error('http-' + res.status)
|
|
287
292
|
if (!res.body) throw new Error('no-body')
|
|
288
293
|
const total = Number(res.headers.get('content-length')) || fileRec.bytes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a9i5k4/dsh-auto-memory",
|
|
3
3
|
"description": "主动联想记忆插件:记忆不靠模型调用,自己被唤回——Host 观察情境,NLP+向量化双轨检索,固定边界注入不破坏前缀缓存。三层记忆自动沉淀、欢迎向导、唤起回顾、无人值守、AI 问候与反思、日历、跨工具记忆继承。Proactive associative memory for DSH: zero-call recall, three-layer auto-consolidation, welcome tour, unattended mode.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.34",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -42,5 +42,8 @@
|
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@deepseek-ai/cordis": "^4.0.1"
|
|
44
44
|
},
|
|
45
|
+
"optionalDependencies": {
|
|
46
|
+
"@huggingface/transformers": "^3.7.6"
|
|
47
|
+
},
|
|
45
48
|
"license": "BSD-3-Clause"
|
|
46
49
|
}
|