dsh-memory-palace 1.2.0 → 1.2.2

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
@@ -80,7 +80,7 @@ turn/end ──► 轻量兜底闸门
80
80
 
81
81
  ```bash
82
82
  dsh plugin --profile web add github:lovezi0/dsh-memory-palace
83
- # 锁定版本:dsh plugin --profile web add github:lovezi0/dsh-memory-palace#v1.2.0
83
+ # 锁定版本:dsh plugin --profile web add github:lovezi0/dsh-memory-palace#v1.2.2
84
84
  ```
85
85
 
86
86
  方式二:clone 后本地安装(开发 / 修改源码场景)
@@ -93,6 +93,19 @@ npm run build # src/ → lib/(服务端递归复制 + 客户端零依
93
93
  dsh plugin --profile web add . # 装入 web profile(profile 名按你的实际配置调整)
94
94
  ```
95
95
 
96
+ 方式三:通过 npm 安装(已发布到 npm registry,可走镜像加速)
97
+
98
+ ```bash
99
+ # 直接由 dsh 从 npm 拉取并装入(本机若已配镜像会自动走镜像)
100
+ dsh plugin --profile web add dsh-memory-palace
101
+ # 锁定版本:
102
+ dsh plugin --profile web add dsh-memory-palace@1.2.2
103
+
104
+ # 或先手动用 npm 安装(显式指定镜像),再装入:
105
+ npm install dsh-memory-palace --registry=https://registry.npmmirror.com/
106
+ dsh plugin --profile web add dsh-memory-palace
107
+ ```
108
+
96
109
  卸载:
97
110
 
98
111
  ```bash
@@ -143,6 +156,10 @@ dsh plugin --profile web remove dsh-memory-palace
143
156
 
144
157
  ## 版本历史
145
158
 
159
+ - **1.2.2**
160
+ - 🐛修复智能模式自定义摘要模型不生效的问题
161
+ - **1.2.1**
162
+ - 💪发布npm
146
163
  - **1.2.0**
147
164
  - 🔥会话标题栏【记忆】按钮
148
165
  - 🔥手动蒸馏会话与项目记忆
package/lib/client.js CHANGED
@@ -220,7 +220,8 @@ window.__ModuleLoader__.load({
220
220
  const opts = [];
221
221
  for (const g of groups || []) {
222
222
  for (const m of (g && g.models) || []) {
223
- opts.push({ value: g.id + "/" + m.id, label: g.name + " / " + m.name });
223
+ // m.id 已经包含 provider 前缀(如 nvidia/nemotron-3-ultra-550b-a55b),直接用,避免重复拼接
224
+ opts.push({ value: m.id, label: g.name + " / " + m.name });
224
225
  }
225
226
  }
226
227
  if (alive) setModelOptions(opts);
@@ -478,7 +479,9 @@ window.__ModuleLoader__.load({
478
479
  draft.memoryMode === "smart"
479
480
  ? row(t("summaryModelLabel"), t("summaryModelHint"),
480
481
  h("select", {
481
- value: draft.summaryModel || "",
482
+ // 已存储值不在下拉选项内(如旧版双前缀脏数据)→ 归零为「复用当前会话模型」,
483
+ // 避免 select 显示悬空值、保存时又把脏值写回 settings.yaml。
484
+ value: modelOptions.some((o) => o.value === draft.summaryModel) ? draft.summaryModel : "",
482
485
  disabled,
483
486
  onChange: (e) => edit("summaryModel", e.target.value)
484
487
  }, [
package/lib/distill.mjs CHANGED
@@ -13,6 +13,25 @@ import { appendLineDedup } from "./common/records.mjs";
13
13
  export function createDistill({ ctx, getConfig, paths, records, state }) {
14
14
  const cfg = () => getConfig();
15
15
 
16
+ // 模型解析(v1.2.3 修复):summaryModel 存的是注册表 models[].id 原样(client 下拉 value = m.id),
17
+ // pi-ai getModel(provider, id) 按 model.id 全等匹配(pi-ai models.js: getModels(provider).find(m => m.id === id)),
18
+ // 所以 model 参数必须【原样直传】summaryModel——绝不能 split 拆段。v1.2.2 之前拆段把
19
+ // `nvidia/nemotron-3-ultra-550b-a55b` 变成裸 id `nemotron-3-ultra-550b-a55b`,全等匹配失败抛 UNKNOWN_MODEL。
20
+ // provider 取 summaryModel 首段(带前缀 id 的 route key,如 nvidia/nemotron-3-ultra-550b-a55b → nvidia)。
21
+ // summaryModel 为空 → 会话 requestHeader config 兜底(复用当前会话 provider/model,原样直传)。
22
+ // 边界:裸 id 格式(如 GLM-4.7-Flash,无 provider 前缀)首段取不到正确 provider → 需要
23
+ // ctx.llm.listProviders() 反查注册表;当前配置(nvidia 带前缀 / zai 裸 id)用首段即可,裸 id 场景暂不处理。
24
+ function resolveModel(summaryModel, session) {
25
+ const sm = (summaryModel || "").trim();
26
+ if (sm) {
27
+ const provider = sm.split("/")[0].trim();
28
+ if (provider) return { provider, model: sm };
29
+ }
30
+ const conf = session?.requestHeader?.()?.config;
31
+ if (conf && conf.provider && conf.model) return { provider: conf.provider, model: conf.model };
32
+ return null;
33
+ }
34
+
16
35
  // 项目蒸馏乐观锁:按目标 MEMORY.md 绝对路径防并发重复蒸馏。
17
36
  const distillLocks = new Set();
18
37
 
@@ -26,28 +45,13 @@ export function createDistill({ ctx, getConfig, paths, records, state }) {
26
45
  return { ok: false };
27
46
  }
28
47
  const c = cfg();
29
- // 1. 模型解析:显式 summaryModel > 复用当前会话模型;皆缺 → 降级。
30
- let provider;
31
- let model;
32
- const sm = (c.summaryModel || "").trim();
33
- if (sm) {
34
- const parts = sm.split("/");
35
- if (parts.length === 2) {
36
- provider = parts[0].trim();
37
- model = parts[1].trim();
38
- }
39
- }
40
- if (!provider || !model) {
41
- const conf = session.requestHeader?.()?.config;
42
- if (conf && conf.provider && conf.model) {
43
- provider = conf.provider;
44
- model = conf.model;
45
- }
46
- }
47
- if (!provider || !model) {
48
+ // 1. 模型解析:summaryModel 原样直传(注册表 id)> 复用当前会话模型;皆缺 → 降级。
49
+ const resolved = resolveModel(c.summaryModel, session);
50
+ if (!resolved) {
48
51
  dbg("no model", { summaryModel: c.summaryModel, header: JSON.stringify(session.requestHeader?.()?.config) });
49
52
  return { ok: false };
50
53
  }
54
+ const { provider, model } = resolved;
51
55
  // 2. 输入:取 seq >= fromSeq 的 surface 事件,投影成模型视角 Message[]。
52
56
  const SURFACE = new Set(["user/message", "assistant/message", "tool/result"]);
53
57
  const newEvents = (session.events || []).filter(
@@ -173,27 +177,12 @@ export function createDistill({ ctx, getConfig, paths, records, state }) {
173
177
  if (distillLocks.has(memFile)) return { ok: false, message: "蒸馏正在进行中,请稍候再试。" };
174
178
  distillLocks.add(memFile);
175
179
  try {
176
- // 模型解析:与 distillSessionCore 同序(summaryModel > 会话 requestHeader)。
177
- let provider;
178
- let model;
179
- const sm = (c.summaryModel || "").trim();
180
- if (sm) {
181
- const parts = sm.split("/");
182
- if (parts.length === 2) {
183
- provider = parts[0].trim();
184
- model = parts[1].trim();
185
- }
186
- }
187
- if (!provider || !model) {
188
- const conf = session?.requestHeader?.()?.config;
189
- if (conf && conf.provider && conf.model) {
190
- provider = conf.provider;
191
- model = conf.model;
192
- }
193
- }
194
- if (!provider || !model) {
180
+ // 模型解析:与 distillSessionCore 同序(summaryModel 原样直传 > 会话 requestHeader)。
181
+ const resolved = resolveModel(c.summaryModel, session);
182
+ if (!resolved) {
195
183
  return { ok: false, message: "无法确定蒸馏模型(summaryModel 未配置且会话无模型信息)。" };
196
184
  }
185
+ const { provider, model } = resolved;
197
186
 
198
187
  // LLM 蒸馏:system = 固化 DISTILL_PROMPT,user = MEMORY.md 全文。
199
188
  const timeoutMs = c.summaryTimeoutMs || 60000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-memory-palace",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "把 WorkBuddy 的文件式记忆系统移植进 DeepSeek Harness:用户级 + 工作区的人类可读 Markdown 记忆(~/.deepseek-harness/MEMORY.md 与 <cwd>/.deepseek-harness/memory/)。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -18,6 +18,10 @@
18
18
  "publishConfig": {
19
19
  "registry": "https://registry.npmjs.org/"
20
20
  },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/lovezi0/dsh-memory-palace.git"
24
+ },
21
25
  "license": "MIT",
22
26
  "dsh": {
23
27
  "bundle": {