@a9i5k4/dsh-auto-memory 2.4.2 → 2.5.1
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/docs/internal/GROUP-DIGEST-SETUP.md +62 -0
- package/docs/internal/GROUP-LISTENER-SETUP.md +49 -0
- package/docs/internal/GROUP-WEBHOOK-SETUP.md +60 -0
- package/docs/internal/HANDOFF-TO-ZCODE.md +168 -0
- package/docs/internal/NEXT-VERSION-TODO.md +29 -1
- package/docs/internal/RELEASE-PROCESS.md +16 -0
- package/docs/internal/TODO-BACKLOG.md +142 -0
- package/docs/prompts/DOCS-AUDIT-AGENT.md +32 -0
- package/docs/prompts/README.md +4 -0
- package/docs/prompts/REGRESSION-AGENT.md +42 -0
- package/docs/prompts/RELEASE-AGENT.md +125 -0
- package/docs/prompts/TRACE-PATROL-AGENT.md +29 -0
- package/lib/client.js +30 -8
- package/lib/index.js +143 -25
- package/lib/subagent-gc.js +30 -1
- package/package.json +1 -1
package/lib/subagent-gc.js
CHANGED
|
@@ -90,6 +90,35 @@ export function decodeZstdFrames(buf) {
|
|
|
90
90
|
return Buffer.concat(parts).toString('utf8')
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* 头帧解码:仅解压前 maxFrames 帧(或累计超 maxBytes 即停)。
|
|
95
|
+
*
|
|
96
|
+
* 背景(实测 2026-09-11,DSH Desktop 0.5.10 / Electron 内置 Node 22.22.1):
|
|
97
|
+
* Node 22 的实验性 `node:zlib` zstd 在解压巨型会话文件(数 MB 压缩、数万帧)
|
|
98
|
+
* 时会令整个宿主进程直接崩溃(crashpad not connected,无 JS 异常可捕获);
|
|
99
|
+
* 同样的文件在 Node 24 下正常。扫描会话头(header + subagent descriptor)
|
|
100
|
+
* 只需要最前面几帧,因此扫描路径一律改用本函数,避免全量解压巨型旧会话。
|
|
101
|
+
* @param {Buffer} buf - 原始文件内容。
|
|
102
|
+
* @param {number} [maxFrames=8] - 最多解压的帧数。
|
|
103
|
+
* @param {number} [maxBytes=4*1024*1024] - 解压结果累计上限(字节),超出即停。
|
|
104
|
+
* @returns {string} 前若干帧解压文本(坏帧跳过)。
|
|
105
|
+
*/
|
|
106
|
+
export function decodeZstdFramesHead(buf, maxFrames = 8, maxBytes = 4 * 1024 * 1024) {
|
|
107
|
+
const parts = []
|
|
108
|
+
let frames = 0
|
|
109
|
+
let bytes = 0
|
|
110
|
+
for (const fr of scanZstdFrames(buf)) {
|
|
111
|
+
if (frames >= maxFrames || bytes >= maxBytes) break
|
|
112
|
+
try {
|
|
113
|
+
const part = zstdDecompressSync(buf.subarray(fr.start, fr.end))
|
|
114
|
+
parts.push(part)
|
|
115
|
+
frames++
|
|
116
|
+
bytes += part.length
|
|
117
|
+
} catch (e) { /* 坏帧跳过 */ }
|
|
118
|
+
}
|
|
119
|
+
return Buffer.concat(parts).toString('utf8')
|
|
120
|
+
}
|
|
121
|
+
|
|
93
122
|
/**
|
|
94
123
|
* 从会话日志文本里取首帧 header 与 subagent descriptor。
|
|
95
124
|
* @param {string} text - 解压后的 JSONL 文本。
|
|
@@ -180,7 +209,7 @@ export async function scanPluginSubagentSessions(opts = {}) {
|
|
|
180
209
|
}
|
|
181
210
|
if (!st) { bump('no-file'); continue }
|
|
182
211
|
let text = ''
|
|
183
|
-
try { text =
|
|
212
|
+
try { text = decodeZstdFramesHead(await readFile(file)) } catch (e) { bump('decode-error'); continue }
|
|
184
213
|
const head = parseSessionHead(text)
|
|
185
214
|
if (!head.header) { bump('no-header'); continue }
|
|
186
215
|
if (head.header.origin === 'subagent') out.subagents++
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a9i5k4/dsh-auto-memory",
|
|
3
3
|
"description": "Proactive associative memory for DSH: zero-prompt recall injected before the model speaks, three-layer auto-consolidation, skill crystallization, and Astra-style context management - handoff ledgers, PLAN whiteboard, water-level sensing. Local-first, model-agnostic, zero deps. 主动联想记忆+Astra 式上下文管理:自动唤回/自动沉淀/技能固化/交接账本与白板跨窗口续命/水位感知。",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.5.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|