dsh-memvault 0.9.10 → 0.9.12

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 CHANGED
@@ -12,7 +12,8 @@
12
12
  </p>
13
13
 
14
14
  <p align="center">
15
- <img alt="version" src="https://img.shields.io/badge/version-0.9.10-4a6cf7">
15
+ <img alt="version" src="https://img.shields.io/badge/version-0.9.12-4a6cf7">
16
+ <img alt="npm" src="https://img.shields.io/npm/v/dsh-memvault?color=cb3837">
16
17
  <img alt="license" src="https://img.shields.io/badge/license-MIT-30a46c">
17
18
  <img alt="platform" src="https://img.shields.io/badge/platform-DeepSeek%20Harness-f76b15">
18
19
  <img alt="runtime deps" src="https://img.shields.io/badge/runtime%20deps-zero-888">
@@ -64,8 +65,8 @@ The plugin does three things:
64
65
 
65
66
  | Question | Answer |
66
67
  |---|---|
67
- | **DSH Desktop** | ✅ Verified live on **0.2.1-rc.3** with the reserved `desktop` profile: the bundle (`dsh.bundle.patch`) loads, the plugin row is `active`, `/memvault/api/status` answers 200, and the injected blocks appear in the runtime-context snapshot. |
68
- | **DSH versions** | Supports the 0.1.x and 0.2.x lines, including 0.2.1 prereleases. `engines.dsh` and both DSH peer declarations carry **one range**; its `>=0.2.1-0 <0.3.0-0` arm exists for **strict** readers that do not pass `includePrerelease` (npm/pnpm peer resolution, the market's discovery preflight) — without it they reject `0.2.1-rc.3`. |
68
+ | **DSH Desktop** | ✅ Verified live on **0.2.1-rc.5** with the reserved `desktop` profile: the bundle (`dsh.bundle.patch`) loads, the plugin row is `active`, `/memvault/api/status` answers 200, and the injected blocks appear in the runtime-context snapshot. |
69
+ | **DSH versions** | Supports the 0.1.x and 0.2.x lines, including 0.2.1 prereleases. `engines.dsh` and both DSH peer declarations carry **one range**; its `>=0.2.1-0 <0.3.0-0` arm exists for **strict** readers that do not pass `includePrerelease` (npm/pnpm peer resolution, the market's discovery preflight) — without it they reject `0.2.1-rc.5`. |
69
70
  | **Do I need a client half?** | Only for the panel. `dsh.client.platform: 'web'` serves the browser half; the memory bridge itself runs entirely host-side, so disabling the client half costs visibility, never injection. |
70
71
  | **DSH Web / headless / SDK profiles** | ✅ The same bundle works wherever the host runs. Headless compositions simply have no `webServer`, and the panel's child fiber waits for it instead of failing. `systemPrompt` is the only *required* service. |
71
72
  | **Is the panel visible?** | ✅ Two seats: a **记忆** tab beside 聊天 / 轨迹 in the conversation ring, and a **MemVault 记忆桥** page under Settings → Plugins. Both are read-only views over the injected blocks and the extraction state. |
@@ -77,6 +78,12 @@ The plugin does three things:
77
78
 
78
79
  **Prerequisite:** a working MemVault checkout — its virtualenv and its `memvault.db` (the store is shared with the MemVault service and MCP clients; this plugin only ever `SELECT`s from it).
79
80
 
81
+ Install from npm (0.9.12 and newer):
82
+
83
+ ```powershell
84
+ dsh plugin --profile desktop add dsh-memvault
85
+ ```
86
+
80
87
  Self-owned install (what this repo does on the author's machine):
81
88
 
82
89
  ```jsonc
package/README.zh.md CHANGED
@@ -12,7 +12,8 @@
12
12
  </p>
13
13
 
14
14
  <p align="center">
15
- <img alt="version" src="https://img.shields.io/badge/version-0.9.10-4a6cf7">
15
+ <img alt="version" src="https://img.shields.io/badge/version-0.9.12-4a6cf7">
16
+ <img alt="npm" src="https://img.shields.io/npm/v/dsh-memvault?color=cb3837">
16
17
  <img alt="license" src="https://img.shields.io/badge/license-MIT-30a46c">
17
18
  <img alt="platform" src="https://img.shields.io/badge/platform-DeepSeek%20Harness-f76b15">
18
19
  <img alt="runtime deps" src="https://img.shields.io/badge/runtime%20deps-zero-888">
@@ -64,8 +65,8 @@
64
65
 
65
66
  | 问题 | 结论 |
66
67
  |---|---|
67
- | **DSH 桌面端** | ✅ 已在 **0.2.1-rc.3** 的保留 `desktop` profile 上**实测**:bundle(`dsh.bundle.patch`)加载成功,插件行状态 `active`,`/memvault/api/status` 回 200,注入的块出现在 runtime 上下文快照里。 |
68
- | **DSH 版本区间** | 支持 0.1.x 与 0.2.x 两条线,含 0.2.1 的预发布。`engines.dsh` 与两条 DSH peer 声明写的是**同一个区间**;其中 `>=0.2.1-0 <0.3.0-0` 这一段专给**不带 `includePrerelease`** 的严格判定器(npm/pnpm 的 peer 解析、市场的发现前检),否则 `0.2.1-rc.3` 会被它们判成不满足。 |
68
+ | **DSH 桌面端** | ✅ 已在 **0.2.1-rc.5** 的保留 `desktop` profile 上**实测**:bundle(`dsh.bundle.patch`)加载成功,插件行状态 `active`,`/memvault/api/status` 回 200,注入的块出现在 runtime 上下文快照里。 |
69
+ | **DSH 版本区间** | 支持 0.1.x 与 0.2.x 两条线,含 0.2.1 的预发布。`engines.dsh` 与两条 DSH peer 声明写的是**同一个区间**;其中 `>=0.2.1-0 <0.3.0-0` 这一段专给**不带 `includePrerelease`** 的严格判定器(npm/pnpm 的 peer 解析、市场的发现前检),否则 `0.2.1-rc.5` 会被它们判成不满足。 |
69
70
  | **需要客户端半边吗?** | 只有面板需要。`dsh.client.platform: 'web'` 负责把浏览器半边提供出去;记忆桥本身完全跑在 host 侧,所以关掉客户端半边损失的是可见性,绝不是注入。 |
70
71
  | **Web / 无头 / SDK profile** | ✅ 只要 host 在跑,同一个 bundle 就能用。无头组合没有 `webServer`,面板那条子 fiber 会等着它而不是失败。唯一**必需**的服务是 `systemPrompt`。 |
71
72
  | **面板可见吗?** | ✅ 两个位置:会话页签环里 聊天 / 轨迹 旁边的 **记忆** 页签,以及 Settings → Plugins 里的 **MemVault 记忆桥** 页。两者都是只读视图,数据来自注入的块与抽取状态。 |
@@ -77,6 +78,12 @@
77
78
 
78
79
  **前置条件**:一份能跑的 MemVault checkout——它的 virtualenv 与 `memvault.db`(该库与 MemVault 服务、MCP 客户端共享;本插件只对它 `SELECT`)。
79
80
 
81
+ 从 npm 安装(0.9.12 起):
82
+
83
+ ```powershell
84
+ dsh plugin --profile desktop add dsh-memvault
85
+ ```
86
+
80
87
  本机自持式安装(也就是本仓库在作者机器上的装法):
81
88
 
82
89
  ```jsonc
package/docs/DEVLOG.md CHANGED
@@ -773,6 +773,84 @@ npm/pnpm 说"不满足"。同一份声明,两个答案——这就是要消掉
773
773
  20. **`/plugins/<包名>/client.js` 在 0.2.1 里裸访问是 404,这是设计不是故障。** 客户端模块路由只认组合出的
774
774
  `??...&rev=...` 批地址与带 `rev` 的 chunk 地址(`bundleResource` 先查响应表,查不到就 404)。
775
775
  拿不带 `rev` 的地址去探"面板有没有被服务"只会得到假信号——和 §21 教训二同一类:**探针报"没有"时,先怀疑探针**。
776
- 21. **市场里的"未声明"和"不兼容"是两种结论。** `basis: 'unavailable'`(清单取不到,比如还没发布)与
776
+ 21. **市场里的"未声明"和"不兼容"是两种结论。** `basis: 'unavailable'`(清单取不到,比如刚发布、索引还没抓到)与
777
777
  `basis: 'undeclared'`(没有任何 DSH 声明)都**保持可见**,只有拿到清单且判定为 false 才隐藏。
778
778
  所以"在市场里找不到自己"要先看有没有发布,而不是先怀疑兼容性。
779
+
780
+ ### 22.5 上架记录(2026-10-25)
781
+
782
+ - **包名 `dsh-memvault`(无 scope),版本 0.9.10**,`npm publish --registry https://registry.npmjs.org --access public`,
783
+ 发布账号 `zheexinn`。发布前 `npm view` 是 404(名字可用),发布后 `dist-tags.latest = 0.9.10`。
784
+ - **发布物自检,而不是仓库自检**:把 registry 上的 tgz 拉下来解包,在解包目录里跑 `node scripts/smoke-package.mjs` → ALL PASS。
785
+ 仓库绿不等于别人装到的东西绿,这一步验的是后者(tarball 4,263,095 字节,与本地 `npm pack` 一致)。
786
+ - **市场里的条目早就在,不全是因为这次发布**:`awesome-dsh-plugin.com/plugins.json` 里
787
+ `zhang66633/dsh-memvault` 从 **2026-10-13** 起就是一条 GitHub 条目(`npm: null`),由站点自己的每日探测补
788
+ `npm`/`version`(`build-site.yml`:只有 nightly 02:23 UTC 与手动 dispatch 会全量探测,push 构建不探测)。
789
+ 所以 npm 安装入口会出现在**下一次 nightly 之后**;这不在本仓库能触发的范围内。
790
+ - **市场自己的兼容判定不依赖那个索引**:它会直接查 npm 清单。发布后对
791
+ `/dsh-market/discovery-compatibility` 传 `dsh-memvault`,返回 `compatible`,`declarations` 就是 §22.2 那一条区间。
792
+ - 一个 registry 细节:新包发布时 packument 里会短暂出现 `0.0.0-stage`(比正式版本早 66 秒的占位条目),
793
+ `dist-tags.latest` 不受影响;不要去 `npm unpublish` 它。
794
+
795
+ ## 23. 0.2.1-rc.5 适配(v0.9.11,2026-11-01)
796
+
797
+ ### 23.1 为什么只升补丁
798
+
799
+ 宿主从 `0.2.1-rc.3` 升到 `0.2.1-rc.5`,但插件侧没有运行时改动:`engines.dsh` 与两条 DSH peer 的
800
+ `>=0.2.1-0 <0.3.0-0` 区间本来就覆盖整条 0.2.1 预发布线(§22 已把严格 SemVer 的洞补齐),
801
+ bundle、注入与面板路由都不依赖 rc.3 → rc.5 之间的差异。所以这是一次**实测后的声明更新**,不是行为变更。
802
+
803
+ ### 23.2 在 0.2.1-rc.5 上实测(规则 ③)
804
+
805
+ 1. **活宿主**:桌面端 `0.2.1-rc.5`,保留 `desktop` profile。`/memvault/api/status` 回 **200**;
806
+ 返回里 `read.enabled=true`、`blocks=3`、`configIssues` 为空,六项路径自检(python / projectDir / db /
807
+ state / 服务端库 / 服务端嵌入器)全部 ok。
808
+ 2. **注入**:本会话 system prompt 的 runtime 上下文里有 `memvault:core`,内容与 `status` 返回的三块一致。
809
+ 3. **`npm test`**:六个 smoke 全绿(package / config / 主流程 / extract / panel / panel-routes)。
810
+ 4. **面板**:浏览器半边没有在本轮重新截图取证。裸访问 `/plugins/<包名>/client.js` 是 404 属于设计要求
811
+ (§22.4 教训 20),host 侧路由已证,客户端能力由构建产物契约测试覆盖。
812
+
813
+ ### 23.3 改了哪些字
814
+
815
+ - `package.json` 0.9.10 → 0.9.11;两版 README 的版本徽章与安装行同步。
816
+ - README 兼容性表:实测宿主 `0.2.1-rc.3` → `0.2.1-rc.5`(中英各一处;严格判定器的示例同步)。
817
+
818
+ ### 23.4 发版记录(2026-11-01)
819
+
820
+ - **`npm publish --registry https://registry.npmjs.org --access public`**,账号 `zheexinn`,
821
+ 发布 `dsh-memvault@0.9.11`;`dist-tags.latest` 在约 50 秒后变为 `0.9.11`。
822
+ - **发布物自检**(§22.5 的流程):从 registry 拉下 tgz 解包后跑 `node scripts/smoke-package.mjs` → ALL PASS;
823
+ 字节数 4,264,727,sha512 与本地 `npm pack`、registry 的 `dist.integrity` 三者一致。
824
+ - **传播延迟**:packument / `dist-tags` 先更新,tarball 地址在约 3 分钟内仍回 404,之后变 200——
825
+ 与 §22.5 记录的 registry 传播特性同类,不是发布失败,不要因此重发或 `npm unpublish`。
826
+
827
+ ## 24. 2026-11-01:抽取一直 `added=0`(v0.9.12)
828
+
829
+ ### 24.1 现象
830
+
831
+ 面板停在 10-26。状态文件里当天的 5 次抽取:2 次 `failed: httpx.ReadTimeout`,3 次 `ok added=0`;
832
+ 库内 `max(created_at)` = `2026-10-26T15:11:36Z`。
833
+
834
+ ### 24.2 根因(实测,不是推断)
835
+
836
+ 1. **抽取只送 `user/message`,而 DSH 的 user 事件里混着机器文本**:runtime context(其中还嵌着
837
+ MemVault 自己注入的核心块)、checkpoint 摘要、skill catalog、`<system-reminder>`、background job
838
+ 输出、`Time sampled` 时间戳。当天 5 个窗口里机器文本占 **32%–67%**;一个真实会话 97 条 user 消息,
839
+ 最长的是 **20,133 字**的 skill catalog 与 **13,118 字**的 checkpoint。
840
+ 2. **真实用户回合极短**:同一会话里多为「现状」「继续做 R26」「现况,服务器docker现在有哪些」(2–55 字)。
841
+ 3. **提示词只收「用户自述的长期事实」**,所以这些窗口返回 `[]` 是**符合契约**的结果,不是抽取器坏了。
842
+ 另有一层独立问题:`LLMExtractor` 的 HTTP 超时硬编码 60s,慢网关下会整窗失败(今天的 2 次)。
843
+
844
+ ### 24.3 改了什么(v0.9.12)
845
+
846
+ - `renderTranscript` 在渲染 user 文本前丢弃机器前缀(runtime context / MemVault 核心块 / checkpoint /
847
+ system-reminder / skill catalog / background job / 时间戳 / hindsight refresh),预算与模型注意力回到
848
+ 真人说的话上。
849
+ - `smoke-extract` 新增 2 条:机器文本被丢、真实回合存活。
850
+
851
+ ### 24.4 没有改什么
852
+
853
+ - 没有打开 `includeAssistant`,也没有放宽抽取提示词——那会把项目过程写进记忆,属于产品取舍。
854
+ - 实测:把最近 8 条含助手结论的对话(4,262 字)喂给同一管线,仍返回 0 条。**所以「多送助手文本」本身
855
+ 不解决这个问题**;要让项目结论入库,需要显式 `memory_add`(procedural)或改抽取范围与提示词。
856
+ - 本轮手动写入 3 条 procedural 记忆(MCP 修复、发布流程、本根因),面板因此重新出现 11-01 的记录。
package/lib/extract.js CHANGED
@@ -33,6 +33,38 @@ function blockText(block) {
33
33
  return undefined
34
34
  }
35
35
 
36
+ /**
37
+ * Harness-injected, user-role text that the user did not write.
38
+ *
39
+ * The session log stores all of this as ordinary `user/message` events: the
40
+ * runtime-context block (which even carries the injected core memory), timing
41
+ * stamps, background-job reports, checkpoints, skill-catalog reminders and the
42
+ * Hindsight refresh. Measured on 2026-11-01: a 2 248-char window was 67 % this
43
+ * material, and one real transcript held a 20 k-char skill catalog next to a
44
+ * 7-char command ("继续做 R26") — the extractor then correctly returns [] for a
45
+ * window that contains nothing of the user. Dropping these keeps the budget and
46
+ * the model's attention on what the person actually said.
47
+ */
48
+ const MACHINE_USER_PREFIXES = [
49
+ 'Current runtime context',
50
+ 'MemVault core memory (persistent facts',
51
+ 'Time sampled while preparing',
52
+ 'Browser time zone for this request',
53
+ 'Elapsed since the preceding',
54
+ 'Current DeepSeek Harness Web GUI URL',
55
+ 'background job ',
56
+ '<system-reminder>',
57
+ '<hindsight_knowledge_refresh>',
58
+ 'This is an automatically generated checkpoint',
59
+ ]
60
+
61
+ /** Whether a user-role text was produced by the harness rather than the person. */
62
+ export function isMachineUserText(text) {
63
+ const trimmed = text.trimStart()
64
+ return MACHINE_USER_PREFIXES.some((prefix) => trimmed.startsWith(prefix))
65
+ }
66
+
67
+
36
68
  /**
37
69
  * Render an event span as a bounded transcript, newest content kept.
38
70
  *
@@ -55,7 +87,7 @@ export function renderTranscript(events, maxChars = 6000, { includeAssistant = f
55
87
  if (event.type === 'user/message') {
56
88
  for (const block of event.data?.content ?? []) {
57
89
  const text = blockText(block)
58
- if (text) lines.push(`用户: ${text}`)
90
+ if (text && !isMachineUserText(text)) lines.push(`用户: ${text}`)
59
91
  }
60
92
  } else if (event.type === 'assistant/message') {
61
93
  for (const block of event.data?.message?.content ?? []) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-memvault",
3
- "version": "0.9.10",
3
+ "version": "0.9.12",
4
4
  "description": "DeepSeek Harness plugin: inject MemVault core memory blocks into the system prompt, extract finished turns as one windowed pass, and show, edit, trace, review and replay all of it in a memory panel",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -67,6 +67,27 @@ check('skips non-text blocks', !rendered.includes('image'))
67
67
  check('honours the char budget', renderTranscript(events, 30).length <= 30,
68
68
  `len=${renderTranscript(events, 30).length} of 30`)
69
69
 
70
+ // Harness-injected user-role text (runtime context, checkpoints, skill catalogs,
71
+ // background-job reports) is not something the person wrote. Measured 2026-11-01:
72
+ // a 2 248-char window was 67 % this material, and one transcript was a 20 k-char
73
+ // skill catalog next to a 7-char command — extraction returned [] and the panel
74
+ // looked frozen at an old date.
75
+ const noisy = [
76
+ { seq: 1, type: 'user/message', data: { content: [{ type: 'text', text: 'Current runtime context. This snapshot supersedes earlier ones.'.repeat(20) }] } },
77
+ { seq: 2, type: 'user/message', data: { content: [{ type: 'text', text: '<system-reminder> The available skill catalog changed.'.repeat(10) }] } },
78
+ { seq: 3, type: 'user/message', data: { content: [{ type: 'text', text: 'background job pwsh-abc finished: exit 1'.repeat(10) }] } },
79
+ { seq: 4, type: 'user/message', data: { content: [{ type: 'text', text: 'This is an automatically generated checkpoint condensing an earlier span'.repeat(10) }] } },
80
+ { seq: 5, type: 'user/message', data: { content: [{ type: 'text', text: '继续做 R26' }] } },
81
+ ]
82
+ const cleaned = renderTranscript(noisy, 6000)
83
+ check('drops harness-generated user text',
84
+ !cleaned.includes('Current runtime context') && !cleaned.includes('system-reminder')
85
+ && !cleaned.includes('background job') && !cleaned.includes('automatically generated checkpoint'),
86
+ cleaned.includes('Current runtime context') ? 'runtime context survived' : 'noise dropped')
87
+ check('keeps the real user turn when machine noise is dropped',
88
+ cleaned.trim() === '用户: 继续做 R26', JSON.stringify(cleaned))
89
+
90
+
70
91
  // ── turnSpanByBoundary (replaces the seq-window slice) ───────────────────────
71
92
  const turnEvents = [
72
93
  { seq: 0, type: 'turn/start' },
package/scripts/smoke.mjs CHANGED
@@ -53,9 +53,12 @@ check('formatter returns empty string for no blocks', formatCoreBlocks([]) === '
53
53
  all.length === 0 || headerOnly === headerOnly.split('\n')[0],
54
54
  `header_len=${headerOnly.length}`)
55
55
  const full = formatCoreBlocks(all, { maxChars: 4000 })
56
+ // A block's value may wrap onto several lines (the rules/persona blocks do),
57
+ // so "kept" is checked per block, not per physical line.
58
+ const kept = all.every((block) => full.includes(block.value.split('\n')[0].slice(0, 24)))
56
59
  check('budget: the default budget keeps every block',
57
- all.length === 0 || full.split('\n').length === all.length + 1,
58
- `lines=${full.split('\n').length} vs blocks=${all.length}`)
60
+ all.length === 0 || kept,
61
+ `len=${full.length} vs blocks=${all.length}`)
59
62
  }
60
63
 
61
64
  check('missing db fails soft (throws, caller catches)', (() => {