dsh-mnemon 0.4.5 → 0.4.6
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 +5 -3
- package/README.zh-CN.md +5 -3
- package/lib/index.js +32 -9
- package/lib/types/src/contracts.d.ts +29 -18
- package/lib/types/src/session-events.d.ts +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<p align="center">
|
|
25
25
|
<a href="./docs/en/capabilities.md"><strong>Explore the capability map</strong></a> ·
|
|
26
26
|
<a href="./docs/en/getting-started.md">Start in five minutes</a> ·
|
|
27
|
-
<a href="./docs/en/releases/v0.4.
|
|
27
|
+
<a href="./docs/en/releases/v0.4.6.md">Read the v0.4.6 notes</a> ·
|
|
28
28
|
<a href="https://github.com/omdsh-dev/dsh-mnemon/blob/e6ca446e45bdd17991f3c7c98560456de465282b/docs/assets/media/dsh-mnemon-memory-system-demo.mp4">Watch the widescreen demo</a>
|
|
29
29
|
</p>
|
|
30
30
|
|
|
@@ -46,6 +46,8 @@ v0.4.4 fixes session history failures on older DSH hosts by supporting both sess
|
|
|
46
46
|
|
|
47
47
|
v0.4.5 registers Memory System with an installed Better Sidebar while keeping the normal DSH Sidebar entry and both client activation orders working. See the [patch release notes](./docs/en/releases/v0.4.5.md).
|
|
48
48
|
|
|
49
|
+
v0.4.6 keeps DSH 0.1.1-rc.2 as the stable baseline while adding capability-detected support for the Session event snapshots used by DSH 0.1.2-alpha.4 and alpha.5. See the [patch release notes](./docs/en/releases/v0.4.6.md).
|
|
50
|
+
|
|
49
51
|
## Understand the scope in 30 seconds
|
|
50
52
|
|
|
51
53
|
| Tier | Keep here | How it reaches the Agent | Managed by |
|
|
@@ -120,7 +122,7 @@ Windows users can install the official v0.2.3-or-newer release ZIP. The expected
|
|
|
120
122
|
|
|
121
123
|
### 2. Install DSH and the plugin
|
|
122
124
|
|
|
123
|
-
The registry installation remains verified against DSH 0.1.1-rc.2, whose complete profiles require Node.js `^22.19.0 || >=24.0.0`; Node 20 lacks host primitives used by rc.2. Source compatibility is also verified against the
|
|
125
|
+
The registry installation remains verified against stable DSH 0.1.1-rc.2, whose complete profiles require Node.js `^22.19.0 || >=24.0.0`; Node 20 lacks host primitives used by rc.2. Source compatibility is also verified against the latest DSH 0.1.2-alpha.5 preview while rc.2 remains the recommended registry target. The dsh-mnemon package itself retains Node.js 20 compatibility for older compatible DSH hosts. Use the exact published version below for a reproducible installation; plugin authors can follow the [alpha source workflow](./docs/en/development.md#dsh-012-alpha5-source-verification).
|
|
124
126
|
|
|
125
127
|
```sh
|
|
126
128
|
npm install -g @deepseek-ai/dsh@0.1.1-rc.2
|
|
@@ -220,7 +222,7 @@ See [Operations, security, and troubleshooting](./docs/en/operations.md) for bac
|
|
|
220
222
|
| Back up, update, or troubleshoot | [Operations](./docs/en/operations.md) |
|
|
221
223
|
| Integrate tools, commands, or RPC | [Interface reference](./docs/en/interfaces.md) |
|
|
222
224
|
| Build a Layer, Adapter, Strategy, Guard, or MemorySource extension | [Extension guide](./docs/en/extensions.md) |
|
|
223
|
-
| Review the release | [v0.4.
|
|
225
|
+
| Review the release | [v0.4.6 release notes](./docs/en/releases/v0.4.6.md) |
|
|
224
226
|
|
|
225
227
|
See the [documentation hub](./docs/en/README.md) for the full map.
|
|
226
228
|
|
package/README.zh-CN.md
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<p align="center">
|
|
25
25
|
<a href="./docs/zh-CN/capabilities.md"><strong>先看能力地图</strong></a> ·
|
|
26
26
|
<a href="./docs/zh-CN/getting-started.md">5 分钟开始</a> ·
|
|
27
|
-
<a href="./docs/zh-CN/releases/v0.4.
|
|
27
|
+
<a href="./docs/zh-CN/releases/v0.4.6.md">v0.4.6 升级说明</a> ·
|
|
28
28
|
<a href="https://github.com/omdsh-dev/dsh-mnemon/blob/e6ca446e45bdd17991f3c7c98560456de465282b/docs/assets/media/dsh-mnemon-memory-system-demo.mp4">观看宽屏实机演示</a>
|
|
29
29
|
</p>
|
|
30
30
|
|
|
@@ -46,6 +46,8 @@ v0.4.4 同时支持新旧 DSH 会话投影接口,修复旧版宿主读取会
|
|
|
46
46
|
|
|
47
47
|
v0.4.5 在已安装 Better Sidebar 时向其注册记忆系统,同时保留 DSH 普通 Sidebar 入口,并兼容两种客户端加载顺序。详见[补丁发布说明](./docs/zh-CN/releases/v0.4.5.md)。
|
|
48
48
|
|
|
49
|
+
v0.4.6 继续以 DSH 0.1.1-rc.2 作为稳定基线,并通过能力检测兼容 DSH 0.1.2-alpha.4 与 alpha.5 的 Session 事件快照接口。详见[补丁发布说明](./docs/zh-CN/releases/v0.4.6.md)。
|
|
50
|
+
|
|
49
51
|
## 30 秒理解能力边界
|
|
50
52
|
|
|
51
53
|
| 层级 | 适合保存 | 如何进入 Agent 上下文 | 由谁管理 |
|
|
@@ -120,7 +122,7 @@ Windows 推荐安装 v0.2.3 或更高版本的官方 ZIP;标准安装目录与
|
|
|
120
122
|
|
|
121
123
|
### 2. 安装 DSH 与插件
|
|
122
124
|
|
|
123
|
-
Registry
|
|
125
|
+
Registry 安装仍以稳定的 DSH 0.1.1-rc.2 验证;其完整 profile 需要 Node.js `^22.19.0 || >=24.0.0`,Node 20 缺少 rc.2 使用的宿主原语。源码兼容性也已针对最新的 DSH 0.1.2-alpha.5 预览版验证,rc.2 仍是推荐的 registry 安装目标。dsh-mnemon 包本身仍为较旧且兼容的 DSH Host 保留 Node.js 20 支持。下面显式指定已发布版本以保证可复现安装;插件作者可参照 [alpha 源码验证流程](./docs/zh-CN/development.md#dsh-012-alpha5-源码验证)。
|
|
124
126
|
|
|
125
127
|
```sh
|
|
126
128
|
npm install -g @deepseek-ai/dsh@0.1.1-rc.2
|
|
@@ -220,7 +222,7 @@ dsh plugin --profile headless add "link:/absolute/path/to/dsh-mnemon"
|
|
|
220
222
|
| 备份、更新或排障 | [运维指南](./docs/zh-CN/operations.md) |
|
|
221
223
|
| 接入工具、命令或 RPC | [接口参考](./docs/zh-CN/interfaces.md) |
|
|
222
224
|
| 开发 Layer、Adapter、Strategy、Guard 或 MemorySource 扩展 | [扩展开发指南](./docs/zh-CN/extensions.md) |
|
|
223
|
-
| 查看本次升级 | [v0.4.
|
|
225
|
+
| 查看本次升级 | [v0.4.6 发布说明](./docs/zh-CN/releases/v0.4.6.md) |
|
|
224
226
|
|
|
225
227
|
完整目录见[文档中心](./docs/zh-CN/README.md)。
|
|
226
228
|
|
package/lib/index.js
CHANGED
|
@@ -6085,6 +6085,29 @@ var LiveMnemonRuntime = class {
|
|
|
6085
6085
|
}
|
|
6086
6086
|
};
|
|
6087
6087
|
//#endregion
|
|
6088
|
+
//#region src/session-events.ts
|
|
6089
|
+
function eventArray(value) {
|
|
6090
|
+
return Array.isArray(value) ? value : void 0;
|
|
6091
|
+
}
|
|
6092
|
+
/**
|
|
6093
|
+
* Materialize one immutable event-log snapshot across supported DSH releases.
|
|
6094
|
+
* Capability detection keeps alpha and stable rc behavior on one code path.
|
|
6095
|
+
*/
|
|
6096
|
+
function hostSessionEvents(session) {
|
|
6097
|
+
if (typeof session.snapshotEvents === "function") {
|
|
6098
|
+
const events = eventArray(session.snapshotEvents());
|
|
6099
|
+
if (events !== void 0) return events;
|
|
6100
|
+
}
|
|
6101
|
+
const events = eventArray(session.events);
|
|
6102
|
+
if (events !== void 0) return events;
|
|
6103
|
+
throw new TypeError("Unsupported DSH Session event API: expected snapshotEvents() or events[]");
|
|
6104
|
+
}
|
|
6105
|
+
/** Read one exact event without materializing the alpha log when possible. */
|
|
6106
|
+
function hostSessionEventAt(session, seq) {
|
|
6107
|
+
if (typeof session.eventAt === "function") return session.eventAt(seq);
|
|
6108
|
+
return hostSessionEvents(session)[seq];
|
|
6109
|
+
}
|
|
6110
|
+
//#endregion
|
|
6088
6111
|
//#region src/subagent.ts
|
|
6089
6112
|
function isAgentRuntimeSource$1(value) {
|
|
6090
6113
|
return typeof value === "object" && value !== null && "forAgent" in value && typeof value.forAgent === "function";
|
|
@@ -6519,7 +6542,7 @@ function subagentFailureDetail(run, result) {
|
|
|
6519
6542
|
const diagnostic = safeFailureDetail(result.diagnostic);
|
|
6520
6543
|
if (diagnostic !== "") return diagnostic;
|
|
6521
6544
|
}
|
|
6522
|
-
const events = run.localAgent
|
|
6545
|
+
const events = run.localAgent === void 0 ? [] : hostSessionEvents(run.localAgent.session);
|
|
6523
6546
|
for (let index = events.length - 1; index >= 0; index -= 1) {
|
|
6524
6547
|
const event = events[index];
|
|
6525
6548
|
if (event?.type !== "turn/end") continue;
|
|
@@ -7877,7 +7900,7 @@ function agentMemoryScope(agent, graph) {
|
|
|
7877
7900
|
/** The durable log, not a parent session id, identifies the executing turn. */
|
|
7878
7901
|
function openAgentTurn(agent) {
|
|
7879
7902
|
let open;
|
|
7880
|
-
for (const event of agent.session
|
|
7903
|
+
for (const event of hostSessionEvents(agent.session)) {
|
|
7881
7904
|
const turn = typeof event.data.turn === "number" ? event.data.turn : void 0;
|
|
7882
7905
|
if (event.type === "turn/start" && turn !== void 0) open = turn;
|
|
7883
7906
|
else if (event.type === "turn/end" && turn === open) open = void 0;
|
|
@@ -8181,7 +8204,7 @@ var MnemonAgentLifecycle = class {
|
|
|
8181
8204
|
startSource: this.startSource,
|
|
8182
8205
|
primePending: this.primePending,
|
|
8183
8206
|
guidedTurns: this.guidedTurns.size,
|
|
8184
|
-
memoryToolCalls: memoryToolCalls(this.agent.session
|
|
8207
|
+
memoryToolCalls: memoryToolCalls(hostSessionEvents(this.agent.session)),
|
|
8185
8208
|
idleReviewPending: this.idleReviewTimer !== void 0,
|
|
8186
8209
|
reviewRunning: this.reviewRunning,
|
|
8187
8210
|
reviewActivity: this.reviewActivity(),
|
|
@@ -8200,11 +8223,11 @@ var MnemonAgentLifecycle = class {
|
|
|
8200
8223
|
}
|
|
8201
8224
|
/** Incremental snapshot of settled Mnemon activity in this durable log. */
|
|
8202
8225
|
turnMemoryActivities() {
|
|
8203
|
-
return this.memoryActivity.snapshot(this.agent.session
|
|
8226
|
+
return this.memoryActivity.snapshot(hostSessionEvents(this.agent.session));
|
|
8204
8227
|
}
|
|
8205
8228
|
/** Plain text of one finalized assistant message, from this agent's session log. */
|
|
8206
8229
|
assistantMessageText(messageId) {
|
|
8207
|
-
return assistantMessageText(this.agent.session
|
|
8230
|
+
return assistantMessageText(hostSessionEvents(this.agent.session), messageId);
|
|
8208
8231
|
}
|
|
8209
8232
|
memoryWake() {
|
|
8210
8233
|
const pinned = this.memoryTurn?.current;
|
|
@@ -8225,7 +8248,7 @@ var MnemonAgentLifecycle = class {
|
|
|
8225
8248
|
cueAlreadyVisible() {
|
|
8226
8249
|
const nodes = this.agent.session.surface?.nodes;
|
|
8227
8250
|
if (nodes === void 0) return this.cueInjected;
|
|
8228
|
-
for (const seq of nodes) if (isOwnUserMessageEvent(this.agent.session
|
|
8251
|
+
for (const seq of nodes) if (isOwnUserMessageEvent(hostSessionEventAt(this.agent.session, seq))) return true;
|
|
8229
8252
|
return false;
|
|
8230
8253
|
}
|
|
8231
8254
|
/**
|
|
@@ -8315,14 +8338,14 @@ var MnemonAgentLifecycle = class {
|
|
|
8315
8338
|
if (!this.config.lifecycleEnabled || !this.config.writeEnabled || this.config.writebackMode !== "guided") return;
|
|
8316
8339
|
this.cancelIdleReview(true);
|
|
8317
8340
|
const activity = this.ensureTurnActivity(turn);
|
|
8318
|
-
const tools = completedToolActivity(this.agent.session
|
|
8341
|
+
const tools = completedToolActivity(hostSessionEvents(this.agent.session), turn);
|
|
8319
8342
|
activity.toolCallCount = tools.count;
|
|
8320
8343
|
activity.toolNames = tools.names;
|
|
8321
8344
|
if (!this.reviewActivity().eligible || !this.reviewAdmitted(turn)) return;
|
|
8322
8345
|
this.idleReviewTimer = setTimeout(() => {
|
|
8323
8346
|
this.idleReviewTimer = void 0;
|
|
8324
8347
|
if (this.agent.status !== "idle") return;
|
|
8325
|
-
if (!this.agent.session.
|
|
8348
|
+
if (!hostSessionEvents(this.agent.session).some((event) => event.type === "turn/end" && eventTurn(event) === turn) || !this.reviewActivity().eligible || !this.reviewAdmitted(turn)) return;
|
|
8326
8349
|
this.runIdleReview();
|
|
8327
8350
|
}, this.config.idleReviewMs);
|
|
8328
8351
|
}
|
|
@@ -8394,7 +8417,7 @@ var MnemonAgentLifecycle = class {
|
|
|
8394
8417
|
explicitCandidate ||= activity.explicitCandidate;
|
|
8395
8418
|
completedNonMemoryTool ||= activity.toolCallCount > 0 && [...activity.toolNames].some((name) => !name.startsWith("mnemon_"));
|
|
8396
8419
|
}
|
|
8397
|
-
const assistantTextLength = this.agent.session.
|
|
8420
|
+
const assistantTextLength = hostSessionEvents(this.agent.session).filter((event) => {
|
|
8398
8421
|
const turn = eventTurn(event);
|
|
8399
8422
|
return turn !== void 0 && turns.has(turn);
|
|
8400
8423
|
}).map(assistantEventTextLength).reduce((total, length) => total + length, 0);
|
|
@@ -129,6 +129,34 @@ export interface HostSessionEvent {
|
|
|
129
129
|
time?: number;
|
|
130
130
|
data: Record<string, unknown>;
|
|
131
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Minimum session log surface shared by the stable DSH rc line and the 0.1.2
|
|
134
|
+
* alpha line. rc.2 exposes the immutable log through `events`; alpha.4+
|
|
135
|
+
* replaces that property with range snapshots and indexed reads.
|
|
136
|
+
*/
|
|
137
|
+
export interface HostSession {
|
|
138
|
+
header?: {
|
|
139
|
+
origin?: 'subagent';
|
|
140
|
+
parentSession?: string;
|
|
141
|
+
delegationDepth?: number;
|
|
142
|
+
cwd?: string;
|
|
143
|
+
agentPreset?: string;
|
|
144
|
+
};
|
|
145
|
+
/** Stable rc.2 event-log accessor. */
|
|
146
|
+
events?: readonly HostSessionEvent[];
|
|
147
|
+
/** DSH 0.1.2-alpha.4+ event-log accessor. */
|
|
148
|
+
snapshotEvents?(fromSeq?: number, toSeqExclusive?: number): readonly HostSessionEvent[];
|
|
149
|
+
/** DSH 0.1.2-alpha.4+ indexed event accessor. */
|
|
150
|
+
eventAt?(seq: number): HostSessionEvent | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* Model-visible event sequences, in order. Optional because not every host
|
|
153
|
+
* publishes a surface projection; when absent, callers fall back to
|
|
154
|
+
* session-scoped state.
|
|
155
|
+
*/
|
|
156
|
+
surface?: {
|
|
157
|
+
readonly nodes: readonly number[];
|
|
158
|
+
};
|
|
159
|
+
}
|
|
132
160
|
export type HostPreStepDecision = {
|
|
133
161
|
kind: 'reject';
|
|
134
162
|
} | {
|
|
@@ -156,24 +184,7 @@ export interface HostAgent {
|
|
|
156
184
|
model?: string;
|
|
157
185
|
maxTokens?: number;
|
|
158
186
|
};
|
|
159
|
-
session:
|
|
160
|
-
header?: {
|
|
161
|
-
origin?: 'subagent';
|
|
162
|
-
parentSession?: string;
|
|
163
|
-
delegationDepth?: number;
|
|
164
|
-
cwd?: string;
|
|
165
|
-
agentPreset?: string;
|
|
166
|
-
};
|
|
167
|
-
events: readonly HostSessionEvent[];
|
|
168
|
-
/**
|
|
169
|
-
* Model-visible event sequences, in order. Optional because not every host
|
|
170
|
-
* publishes a surface projection; when absent, callers fall back to
|
|
171
|
-
* session-scoped state.
|
|
172
|
-
*/
|
|
173
|
-
surface?: {
|
|
174
|
-
readonly nodes: readonly number[];
|
|
175
|
-
};
|
|
176
|
-
};
|
|
187
|
+
session: HostSession;
|
|
177
188
|
ctx: HostAgentContext;
|
|
178
189
|
followup(message: HostUserMessage): void;
|
|
179
190
|
steer(message: HostUserMessage): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HostSession, HostSessionEvent } from './contracts.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Materialize one immutable event-log snapshot across supported DSH releases.
|
|
4
|
+
* Capability detection keeps alpha and stable rc behavior on one code path.
|
|
5
|
+
*/
|
|
6
|
+
export declare function hostSessionEvents(session: HostSession): readonly HostSessionEvent[];
|
|
7
|
+
/** Read one exact event without materializing the alpha log when possible. */
|
|
8
|
+
export declare function hostSessionEventAt(session: HostSession, seq: number): HostSessionEvent | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mnemon",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "Composable three-tier memory control plane for DeepSeek Harness: persistent runtime context, searchable project documents, pluggable long-term memory, guarded strategies, WebUI, and headless tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|