dsh-memu-memory 1.4.3 → 1.4.4
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 +4 -0
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/preset-mount.js +13 -7
- package/lib/worker-pool.js +8 -3
- package/package.json +1 -1
- package/tests/consolidation-fork.test.mjs +4 -3
- package/tests/preset-mount.test.mjs +12 -4
- package/tests/worker-lifecycle.test.mjs +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# 更新日志 / Changelog
|
|
2
2
|
|
|
3
|
+
## [1.4.4] - 2026-11-29
|
|
4
|
+
|
|
5
|
+
- 修复整理预设挂载的发布事务返回值:`AgentSetup` 不再向宿主返回诊断对象——宿主会把返回值当作可选的 publication commit 并调用 `commit()`,普通对象触发 `TypeError`;诊断改由 `onResolved` 回调交付,持久 worker 恢复路径同步改用回调取值。
|
|
6
|
+
|
|
3
7
|
## [1.4.3] - 2026-11-29
|
|
4
8
|
|
|
5
9
|
- 新增记忆生命周期维护队列:无新消息也可复查承诺、未完事项与已结束有效窗口;只读模型复查,源证据与内容/作用域版本校验后受控写入,支持中断恢复。
|
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
It is **local-first by default**. The default `agent` backend stores full text in JSON indexes and recalls lexically — no Python, no embedding service, no API key. The `api` backend switches recall to the optional, pinned MemU engine (vector search). MemU is a plugin for people who want it, not a requirement for the plugin to start.
|
|
29
29
|
|
|
30
|
-
> **Version:** 1.4.
|
|
30
|
+
> **Version:** 1.4.4. See [`docs/`](docs/) for the manual and [`AGENTS.md`](AGENTS.md) for the contributor index. Back up `~/.dsh/dsh-memu-memory` before upgrades; see [Compatibility & limits](#compatibility--limits) for storage and integration boundaries.
|
|
31
31
|
|
|
32
32
|
## Screenshots
|
|
33
33
|
|
package/README.zh.md
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
默认**本地优先**。`agent` 后端把完整正文放在 JSON 索引里、用词法检索——不需要 Python、embedding 服务或 API key。`api` 后端才把检索交给可选的、锁定版本的 MemU 引擎(向量)。MemU 是「想要就用」的后端,不是插件能否启动的前提。
|
|
29
29
|
|
|
30
|
-
> **版本:** 1.4.
|
|
30
|
+
> **版本:** 1.4.4。使用说明见 [`docs/`](docs/),开发索引见 [`AGENTS.md`](AGENTS.md)。升级前请备份 `~/.dsh/dsh-memu-memory`;存储与集成边界见[兼容性与边界](#兼容性与边界)。
|
|
31
31
|
|
|
32
32
|
## 界面
|
|
33
33
|
|
package/lib/preset-mount.js
CHANGED
|
@@ -25,18 +25,23 @@ export function presetSetupFor(ctx, { sessionId = null, presetId = null, selecti
|
|
|
25
25
|
return async (childCtx, child) => {
|
|
26
26
|
const selected = selection || resolveConsolidationPreset(ctx, { sessionId, presetId })
|
|
27
27
|
const target = selected.presetId
|
|
28
|
+
// AgentSetup 的返回值会被宿主当作可选的 publication commit,
|
|
29
|
+
// 随后执行 setupCommit?.commit()。诊断报告不能从这里返回,
|
|
30
|
+
// 否则普通对象会被误当成 commit 并触发 TypeError。
|
|
28
31
|
const report = (confirmed, status) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
try { onResolved?.({ ...selected, confirmed, status }) } catch {}
|
|
33
|
+
}
|
|
34
|
+
if (target === null) {
|
|
35
|
+
report(true, 'none')
|
|
36
|
+
return
|
|
32
37
|
}
|
|
33
|
-
if (target === null) return report(true, 'none')
|
|
34
38
|
const presets = presetsOf(childCtx) || presetsOf(ctx)
|
|
35
39
|
if (!presets || typeof presets.mount !== 'function') {
|
|
36
40
|
const message = `consolidation preset "${target}" could not be mounted; the host exposes no preset mount service`
|
|
37
41
|
try { log?.(message) } catch {}
|
|
38
42
|
try { warn(message) } catch {}
|
|
39
|
-
|
|
43
|
+
report(false, 'unavailable')
|
|
44
|
+
return
|
|
40
45
|
}
|
|
41
46
|
try {
|
|
42
47
|
await presets.mount(childCtx, target)
|
|
@@ -44,13 +49,14 @@ export function presetSetupFor(ctx, { sessionId = null, presetId = null, selecti
|
|
|
44
49
|
const message = `consolidation preset "${target}" could not be mounted; this run uses the ambient composition: ${error?.message || error}`
|
|
45
50
|
try { log?.(message) } catch {}
|
|
46
51
|
try { warn(message) } catch {}
|
|
47
|
-
|
|
52
|
+
report(false, 'failed')
|
|
53
|
+
return
|
|
48
54
|
}
|
|
49
55
|
// 挂成功了才记事件:日志要么与模型所见一致,要么干脆不写。
|
|
50
56
|
try { await child?.session?.append?.('agent-preset/selected', { agentPreset: target }) } catch (error) {
|
|
51
57
|
try { warn(`consolidation preset selection was not recorded in the fork log: ${error?.message || error}`) } catch {}
|
|
52
58
|
}
|
|
53
|
-
|
|
59
|
+
report(true, 'mounted')
|
|
54
60
|
}
|
|
55
61
|
}
|
|
56
62
|
|
package/lib/worker-pool.js
CHANGED
|
@@ -570,9 +570,14 @@ export async function acquireWorker(ctx, binding, {
|
|
|
570
570
|
if (handle && resumed) {
|
|
571
571
|
// Resume does not promise to rerun create.setup. Reapply through the same
|
|
572
572
|
// public mount API, or retire when the resumed context cannot be verified.
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
573
|
+
let mounted = null
|
|
574
|
+
if (handle.agent.ctx || presetSelection.presetId === null) {
|
|
575
|
+
await presetSetupFor(ctx, {
|
|
576
|
+
selection: presetSelection,
|
|
577
|
+
onResolved: result => { mounted = result },
|
|
578
|
+
log: presetLog,
|
|
579
|
+
})(handle.agent.ctx, handle.agent)
|
|
580
|
+
}
|
|
576
581
|
if (!mounted?.confirmed) {
|
|
577
582
|
try { resumeAbort?.abort() } catch {}
|
|
578
583
|
const result = await retireWorker(ctx, epoch.forkSessionId, 'preset-unverified', { handoff: false, now, idleWaitMs })
|
package/package.json
CHANGED
|
@@ -104,9 +104,10 @@ function host({ live = false, whenIdle = null, parentOptions = { provider: 'test
|
|
|
104
104
|
if (childAgents.has(spec.sessionId)) throw new Error('session already exists: ' + spec.sessionId)
|
|
105
105
|
rec.created.push(spec)
|
|
106
106
|
const childSession = { id: spec.sessionId, append: (type, data) => rec.forkLogLines.push({ type, data }) }
|
|
107
|
-
//
|
|
108
|
-
if (
|
|
109
|
-
await spec.setup({ get: (name) => (name === 'agentPresets' ? presets : undefined) }, { session: childSession })
|
|
107
|
+
// 宿主等待 setup 完成,并在发布前提交可选的 setup transaction。
|
|
108
|
+
if (typeof spec.setup === 'function') {
|
|
109
|
+
const setupCommit = await spec.setup({ get: (name) => (name === 'agentPresets' ? presets : undefined) }, { session: childSession })
|
|
110
|
+
setupCommit?.commit()
|
|
110
111
|
}
|
|
111
112
|
const dispose = async () => {
|
|
112
113
|
rec.disposed.push(spec.sessionId)
|
|
@@ -26,8 +26,11 @@ test('the setup hook mounts the preset the parent actually runs, and logs the se
|
|
|
26
26
|
}
|
|
27
27
|
const ctx = fakeCtx({ presets, agents: { get: (id) => (id === 'sess-1' ? { ctx: 'parent-ctx' } : null) } })
|
|
28
28
|
const child = { session: { append: (type, data) => appended.push({ type, data }) } }
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
let report = null
|
|
30
|
+
const setup = presetSetupFor(ctx, { sessionId: 'sess-1', presetId: 'standard', onResolved: value => { report = value } })
|
|
31
|
+
const result = await setup('child-ctx', child)
|
|
32
|
+
assert.equal(result, undefined, 'AgentSetup must not return a diagnostic object to the host')
|
|
33
|
+
assert.deepEqual(report, { found: true, presetId: 'custom-preset', source: 'live', confirmed: true, status: 'mounted' })
|
|
31
34
|
|
|
32
35
|
assert.deepEqual(mounts, [{ childCtx: 'child-ctx', id: 'custom-preset' }],
|
|
33
36
|
'the parent’s live composition wins over the header/log preset')
|
|
@@ -49,7 +52,10 @@ test('no preset at all means no mount and no invented log line', async () => {
|
|
|
49
52
|
let appended = 0
|
|
50
53
|
const presets = { mount: async () => { mounted += 1 }, composedPreset: () => undefined }
|
|
51
54
|
const ctx = fakeCtx({ presets, agents: { get: () => undefined } })
|
|
52
|
-
|
|
55
|
+
let report = null
|
|
56
|
+
const result = await presetSetupFor(ctx, { sessionId: 'sess-none', presetId: null, onResolved: value => { report = value } })('child-ctx', { session: { append: () => { appended += 1 } } })
|
|
57
|
+
assert.equal(result, undefined, 'no preset setup still returns no publication commit')
|
|
58
|
+
assert.deepEqual(report, { found: true, presetId: null, source: 'snapshot', confirmed: true, status: 'none' })
|
|
53
59
|
assert.equal(mounted, 0, 'nothing to mount')
|
|
54
60
|
assert.equal(appended, 0, 'and nothing to claim in the log')
|
|
55
61
|
})
|
|
@@ -101,7 +107,9 @@ test('an explicit live null is found and never falls back to an older selection'
|
|
|
101
107
|
agents: { get: () => ({ ctx: {} }) } })
|
|
102
108
|
const selection = resolveConsolidationPreset(ctx, { sessionId: 'live-null', presetId: 'custom-preset' })
|
|
103
109
|
assert.deepEqual(selection, { found: true, presetId: null, source: 'live' })
|
|
104
|
-
|
|
110
|
+
let result = null
|
|
111
|
+
const setupResult = await presetSetupFor(ctx, { selection, onResolved: value => { result = value } })({}, { session: { append: (...args) => appended.push(args) } })
|
|
112
|
+
assert.equal(setupResult, undefined)
|
|
105
113
|
assert.equal(result.confirmed, true)
|
|
106
114
|
assert.deepEqual(mounts, [])
|
|
107
115
|
assert.deepEqual(appended, [])
|
|
@@ -217,7 +217,8 @@ function host({
|
|
|
217
217
|
headers.set(spec.sessionId, { cwd: spec.meta?.cwd || cwd })
|
|
218
218
|
const record = makeRecord(spec.sessionId, spec.agentOptions)
|
|
219
219
|
registry.set(spec.sessionId, record)
|
|
220
|
-
await spec.setup?.(record.agent.ctx, record.agent)
|
|
220
|
+
const setupCommit = await spec.setup?.(record.agent.ctx, record.agent)
|
|
221
|
+
setupCommit?.commit()
|
|
221
222
|
return record
|
|
222
223
|
},
|
|
223
224
|
}
|