dsh-sixlayer-memory 2.5.1 → 2.5.3
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 +29 -0
- package/README.md +1 -1
- package/lib/memory/hotkey-helper.ps1 +2 -1
- package/lib/memory/hotkey.js +16 -2
- package/lib/memory/stream-asr.js +5 -3
- package/lib/memory/tools.js +8 -4
- package/package.json +1 -1
- package/tools/_orphan-probe.mjs +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# 变更记录 · dsh-sixlayer-memory(六层记忆底座)
|
|
2
2
|
|
|
3
|
+
## 2.5.3 — 2026-12-05
|
|
4
|
+
|
|
5
|
+
修「按热键一点声音都没有」:热键被上一次留下的孤儿进程占着。
|
|
6
|
+
|
|
7
|
+
### 修复
|
|
8
|
+
|
|
9
|
+
- **孤儿 helper 占着热键**:DSH 重启时父进程换了,但 `hotkey-helper.ps1` 的 PowerShell 子进程不会跟着死,
|
|
10
|
+
继续持有 `Alt+V`,新实例注册直接 `REGFAIL` → 整个动作不执行,连提示音都没有。
|
|
11
|
+
现在启动前先清理 **owner 不是自己** 的 helper(helper 启动时带 `-OwnerPid` 标记,只杀别的进程,不杀同进程的兄弟 listener)。
|
|
12
|
+
- **状态文案**:`mem_hotkey` 原来无论什么动作都写"唤起系统听写",现在按 `stream / asr / dictation` 分别描述。
|
|
13
|
+
|
|
14
|
+
### 回归
|
|
15
|
+
|
|
16
|
+
- `p31` 同进程冲突用例仍然有效 · 全量 35 个套件全绿
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 2.5.2 — 2026-12-05
|
|
21
|
+
|
|
22
|
+
修「按热键只响一声低音,没有字幕条」:模型名传空串把默认值顶掉了。
|
|
23
|
+
|
|
24
|
+
- 调用方写 `config.stream?.model ?? ''` 传进来是 `''`,而 `function f({name = DEFAULT_MODEL})` 的空默认只在
|
|
25
|
+
`undefined` 时生效 → 路径拼成 `...\models\`(少一段),`existsSync` 恒 false → 判定"没装模型",
|
|
26
|
+
`start()` 立刻失败,只响错误音。
|
|
27
|
+
- 修法:`const modelName = (typeof name === 'string' && name.trim()) || DEFAULT_MODEL`
|
|
28
|
+
- 字幕条本身单独验证过:置顶 WPF 小窗,内容实时刷新正常
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
3
32
|
## 2.5.1 — 2026-12-05
|
|
4
33
|
|
|
5
34
|
修「按热键没反应」:流式模型在宿主进程里找不到。
|
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
dsh plugin --profile desktop add dsh-sixlayer-memory
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
**当前版本**:2.5.
|
|
14
|
+
**当前版本**:2.5.3 · **35 个工具** · schema v9 · 零外部依赖 · 回归 35 个套件全绿
|
|
15
15
|
|
|
16
16
|
📦 [npm](https://www.npmjs.com/package/dsh-sixlayer-memory) · 🎬 [40 秒介绍视频](media/intro-40s.mp4) · 📝 [变更记录](CHANGELOG.md)
|
|
17
17
|
|
package/lib/memory/hotkey.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* @module memory/hotkey
|
|
14
14
|
*/
|
|
15
|
-
import { spawn } from 'node:child_process'
|
|
15
|
+
import { spawn, execFileSync } from 'node:child_process'
|
|
16
16
|
import fs from 'node:fs'
|
|
17
17
|
import path from 'node:path'
|
|
18
18
|
import { fileURLToPath } from 'node:url'
|
|
@@ -103,11 +103,25 @@ export class HotkeyListener {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
_spawn() {
|
|
106
|
+
// 清掉**别的进程**留下的 helper:DSH 重启时父进程被换掉,但 PowerShell 子进程不会跟着死,
|
|
107
|
+
// 它继续占着 Alt+V,新实例就永远注册失败(error: 已被其它程序占用)。
|
|
108
|
+
// 只杀 owner 不是自己的,否则同进程内两个 listener 会互相把对方干掉(p31 的冲突用例就测不出来了)。
|
|
109
|
+
try {
|
|
110
|
+
const me = String(process.pid)
|
|
111
|
+
const cmd = [
|
|
112
|
+
"Get-CimInstance Win32_Process -Filter \"name='powershell.exe'\"",
|
|
113
|
+
`| Where-Object { $_.CommandLine -like '*hotkey-helper.ps1*' -and $_.CommandLine -notlike '*-OwnerPid ${me}*' }`,
|
|
114
|
+
'| ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }',
|
|
115
|
+
].join(' ')
|
|
116
|
+
execFileSync('powershell.exe', ['-NoProfile', '-Command', cmd], { windowsHide: true, timeout: 8000, stdio: 'ignore' })
|
|
117
|
+
} catch {
|
|
118
|
+
/* 清不掉也要继续试 */
|
|
119
|
+
}
|
|
106
120
|
let child
|
|
107
121
|
try {
|
|
108
122
|
child = spawn(
|
|
109
123
|
'powershell.exe',
|
|
110
|
-
['-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', HELPER, '-Key', this.parsed.key, '-Mods', String(this.parsed.mods), '-Action', this.action],
|
|
124
|
+
['-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', HELPER, '-Key', this.parsed.key, '-Mods', String(this.parsed.mods), '-Action', this.action, '-OwnerPid', String(process.pid)],
|
|
111
125
|
{ windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] },
|
|
112
126
|
)
|
|
113
127
|
} catch (error) {
|
package/lib/memory/stream-asr.js
CHANGED
|
@@ -37,11 +37,13 @@ export function dshHomeCandidates({ env = process.env } = {}) {
|
|
|
37
37
|
|
|
38
38
|
/** 找模型目录:配置 > 各 $DSH_HOME 候选。返回 {dir, tried} 便于诊断。 */
|
|
39
39
|
export function resolveModelDirDetailed({ name = DEFAULT_MODEL, dataDir = '', env = process.env } = {}) {
|
|
40
|
+
// 注意:调用方常传空串(配置没写),空串不能当"用户指定了空名字",要回落到默认模型。
|
|
41
|
+
const modelName = (typeof name === 'string' && name.trim()) || DEFAULT_MODEL
|
|
40
42
|
const tried = []
|
|
41
43
|
const candidates = []
|
|
42
|
-
if (
|
|
43
|
-
for (const home of dshHomeCandidates({ env })) candidates.push(path.join(home, 'memory-core', 'models',
|
|
44
|
-
if (dataDir) candidates.push(path.join(dataDir, 'models',
|
|
44
|
+
if (path.isAbsolute(modelName)) candidates.push(modelName)
|
|
45
|
+
for (const home of dshHomeCandidates({ env })) candidates.push(path.join(home, 'memory-core', 'models', modelName))
|
|
46
|
+
if (dataDir) candidates.push(path.join(dataDir, 'models', modelName))
|
|
45
47
|
for (const dir of candidates) {
|
|
46
48
|
tried.push(dir)
|
|
47
49
|
if (fs.existsSync(path.join(dir, 'tokens.txt')) && fs.existsSync(path.join(dir, 'encoder-epoch-99-avg-1.onnx'))) {
|
package/lib/memory/tools.js
CHANGED
|
@@ -802,12 +802,16 @@ export function buildRegistry(store, host) {
|
|
|
802
802
|
if (r.reason) ctl.listener.lastError = r.reason
|
|
803
803
|
}
|
|
804
804
|
const st = ctl.listener.status()
|
|
805
|
+
const ACTION_TEXT = {
|
|
806
|
+
stream: '本地流式识别:边说边出字,说完直接作为消息发出去(不看焦点)',
|
|
807
|
+
asr: 'DeepSeek 识别:说完停 1–2 秒,整句一次性投递',
|
|
808
|
+
dictation: 'Windows 听写:边说边出字,但打在光标所在的输入框',
|
|
809
|
+
none: '只记录按键,不做动作',
|
|
810
|
+
}
|
|
805
811
|
const lines = [
|
|
806
|
-
`热键:${st.hotkey || '(未设)'} · 动作:${st.action}
|
|
812
|
+
`热键:${st.hotkey || '(未设)'} · 动作:${st.action}(${ACTION_TEXT[st.action] ?? st.action})`,
|
|
807
813
|
`状态:${st.state}${st.error ? `(${st.error})` : ''} · 已触发 ${st.presses} 次`,
|
|
808
|
-
st.state === 'ready'
|
|
809
|
-
? '按下热键就会唤起 Windows 语音听写;说完文字会自动出现在光标处。'
|
|
810
|
-
: '热键当前没有在监听。用 enabled:true 打开,或换一个 key。',
|
|
814
|
+
st.state === 'ready' ? '按一下开始,再按一下结束。' : '热键当前没有在监听。用 enabled:true 打开,或换一个 key。',
|
|
811
815
|
]
|
|
812
816
|
return { text: lines.join('\n'), ...st }
|
|
813
817
|
},
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HotkeyListener } from '../lib/memory/hotkey.js'
|
|
2
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms))
|
|
3
|
+
|
|
4
|
+
console.log('启动前占用检查:')
|
|
5
|
+
const before = new HotkeyListener({ key: 'Alt+V', action: 'none' })
|
|
6
|
+
console.log(' 当前状态(未启动):', before.state)
|
|
7
|
+
|
|
8
|
+
const l = new HotkeyListener({ key: 'Alt+V', action: 'none' })
|
|
9
|
+
const r = l.start()
|
|
10
|
+
console.log('start ->', JSON.stringify(r))
|
|
11
|
+
for (let i = 0; i < 30 && l.state !== 'ready' && l.state !== 'error'; i += 1) await sleep(300)
|
|
12
|
+
console.log('最终状态:', l.state, '| 错误:', l.lastError || '无')
|
|
13
|
+
l.stop()
|