dsh-prime-memory 0.21.0 → 0.22.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/dist/client.js CHANGED
@@ -229,7 +229,8 @@ var __defProp = Object.defineProperty;
229
229
  " --dsh-mem-bg-card: var(--dsw-alias-bg-layer-2, #ffffff);",
230
230
  " --dsh-mem-bg-inset: var(--dsw-alias-bg-overlay, #e9ecf2);",
231
231
  " --dsh-mem-bg-hover: var(--dsw-alias-interactive-bg-hover, rgba(38,49,72,0.06));",
232
- " --dsh-mem-bg-pop: var(--dsw-specific-menu, var(--dsw-alias-bg-layer-3, #ffffff));",
232
+ " --dsh-mem-bg-pop: var(--dsw-alias-bg-layer-3, #ffffff);",
233
+ " --dsh-mem-bg-pop-base: var(--dsw-alias-bg-primary, #ffffff);",
233
234
  " --dsh-mem-border: var(--dsw-alias-border-l2, rgba(0,0,0,0.10));",
234
235
  " --dsh-mem-border-strong: var(--dsw-alias-border-l3, rgba(0,0,0,0.12));",
235
236
  " --dsh-mem-border-pop: var(--dsw-alias-border-inverted, rgba(0,0,0,0));",
@@ -272,7 +273,8 @@ var __defProp = Object.defineProperty;
272
273
  " --dsh-mem-bg-card: var(--dsw-alias-bg-layer-2, #2c2c2e);",
273
274
  " --dsh-mem-bg-inset: var(--dsw-alias-bg-layer-1, #232324);",
274
275
  " --dsh-mem-bg-hover: var(--dsw-alias-interactive-bg-hover, rgba(255,255,255,0.08));",
275
- " --dsh-mem-bg-pop: var(--dsw-specific-menu, var(--dsw-alias-bg-layer-3, #353638));",
276
+ " --dsh-mem-bg-pop: var(--dsw-alias-bg-layer-3, #353638);",
277
+ " --dsh-mem-bg-pop-base: var(--dsw-alias-bg-primary, #1b1c1e);",
276
278
  " --dsh-mem-border: var(--dsw-alias-border-l2, rgba(255,255,255,0.12));",
277
279
  " --dsh-mem-border-strong: var(--dsw-alias-border-l3, rgba(255,255,255,0.16));",
278
280
  " --dsh-mem-border-pop: var(--dsw-alias-border-inverted, rgba(255,255,255,0.06));",
@@ -350,7 +352,8 @@ var __defProp = Object.defineProperty;
350
352
  " position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;",
351
353
  " min-width: 100%; width: max-content; max-width: 340px; max-height: 264px;",
352
354
  " overflow-y: auto; overscroll-behavior: contain; padding: 4px;",
353
- " background: var(--dsh-mem-bg-pop); border: 1px solid var(--dsh-mem-border-pop);",
355
+ " // 不透明实底:基色垫底+别名色整层叠印(别名即使带 alpha 也被垫死),2026-10-09 用户修复",
356
+ " background: linear-gradient(var(--dsh-mem-bg-pop), var(--dsh-mem-bg-pop)) , var(--dsh-mem-bg-pop-base); border: 1px solid var(--dsh-mem-border-pop);",
354
357
  " border-radius: 12px; box-shadow: var(--dsh-mem-shadow-pop);",
355
358
  "}",
356
359
  ".dsh-mem-pop-opt {",
@@ -434,7 +437,7 @@ var __defProp = Object.defineProperty;
434
437
  ".dsh-mem-popover {",
435
438
  " border-radius: 12px;",
436
439
  " border: 1px solid var(--dsh-mem-border-pop);",
437
- " background: var(--dsh-mem-bg-pop);",
440
+ " background: linear-gradient(var(--dsh-mem-bg-pop), var(--dsh-mem-bg-pop)) , var(--dsh-mem-bg-pop-base);",
438
441
  " box-shadow: var(--dsh-mem-shadow-pop);",
439
442
  " color: var(--dsh-mem-text-1);",
440
443
  "}",
@@ -209,7 +209,7 @@ usage) {
209
209
  let ackDegradeWarned = false;
210
210
  // §E 压缩感知(memorax-absorb):宿主 `compaction/end`(无 error)→ 该会话下一轮
211
211
  // 做一次"定向增强召回"——跳过去重压制、画像立即重注入、占用账本归零;消费即清。
212
- // 会话级回退路径保留(下方 session-start source='compact' 全量重置),两者幂等。
212
+ // 会话级回退路径保留(下方 agent/created source='compact' 全量重置),两者幂等。
213
213
  // 宿主无压缩计数器(compactionId 为 per-transaction UUID),故不做 generation 对账。
214
214
  const postCompaction = new PostCompactionTracker();
215
215
  ctx.on('session/event', (session, event) => {
@@ -156,13 +156,20 @@ export function registerSlotsProjection(ctx, store, l1) {
156
156
  .sessionProjections;
157
157
  if (registry === undefined || typeof registry.register !== 'function')
158
158
  return;
159
- registry.register({
159
+ // 双代平面(TL beta.29 同款判别式):0.1.0-rc.8 的 registry 是唯一的平面契约
160
+ // (def.schema.parse(def.view(state))),0.1.1+ 消费 wire:{viewSchema,view}。
161
+ // wire 形状镜像成平面键挂上,两代 registry 各取所需;一个缺 schema 的注册
162
+ // 单元会毒化旧 registry 的全部冷会话历史加载。
163
+ const definition = {
160
164
  key: MEMORY_SLOTS_KEY,
161
165
  stateSchema,
162
166
  init: () => buildState(store, l1),
163
167
  apply: (state, event) => applySlotsEvent(state, event, store, l1),
164
168
  wire: { viewSchema, view },
169
+ schema: viewSchema,
170
+ view,
165
171
  stateVersion: 0,
166
- });
172
+ };
173
+ registry.register(definition);
167
174
  });
168
175
  }
package/dist/settings.js CHANGED
@@ -1,4 +1,4 @@
1
- import { EFFORT_CHOICES } from './config.js';
1
+ import { EFFORT_CHOICES, liveSettingsSchema } from './config.js';
2
2
  /** 运行时路由链上限(写入门与 UI 同限,防误粘贴巨数组撑爆 settings 存储)。 */
3
3
  export const DISTILL_CHAIN_MAX = 8;
4
4
  /**
@@ -120,23 +120,115 @@ export function registerLiveSettings(ctx, config, logger) {
120
120
  ? `,蒸馏模型=${current.distillProvider}/${current.distillModel}`
121
121
  : '') + budgetNote + inputNote);
122
122
  });
123
- // 写面:settings 服务(宿主服务,可能晚于本插件就绪)——用 inject 惰性握手,
124
- // 服务替换时 cordis 会重跑回调换上新实例,无需手工判活。
123
+ // ── 读写面三代腰(纯特性检测,playbook §5:勿按版本号分支)──────────────
124
+ // 代 1(0.1.7+):settings 服务有 SettingsForms.update(ns,patch) —— 读走 Config
125
+ // live volatile 引用(read()),写走 forms.update(整节提交)。
126
+ // 代 2(0.1.2/0.1.5):settings.register 返回 SettingsScope(get/watch/update)
127
+ // —— 读写全走 scope(写活读死:0.1.2/0.1.5 的 scope.get() 快照可能恒默认,
128
+ // 磁盘才是真值,调用方以持久化成功为准)。
129
+ // 代 2'(register 缺失):installSection 只回 hooks —— 读走 setSource 注入的
130
+ // thunk,写显式拒绝。
131
+ // 代 3(0.1.0/0.1.1):settings 服务整体缺席 → 恒开降级,internal/service 上线
132
+ // 重试。参考件:compat/0.1.5 registerLiveSettings 的 tryAttach 全套。
125
133
  let forms;
126
134
  ctx.inject(['settings'], (sctx) => {
127
135
  forms = sctx.get('settings');
128
136
  });
137
+ let inner = {
138
+ supported: false,
139
+ get: () => ({ ...ALWAYS_ON, distillChain: [] }),
140
+ update: () => Promise.reject(new Error('settings 服务不可用,记忆开关无法写入')),
141
+ };
142
+ const wireScope = (scope) => {
143
+ return {
144
+ supported: true,
145
+ get: () => resolveSettings(scope.get()),
146
+ update: async (patch) => {
147
+ await scope.update(patch);
148
+ },
149
+ };
150
+ };
151
+ const tryAttachOld = () => {
152
+ const settings = ctx.get('settings');
153
+ if (!settings || typeof forms?.update === 'function')
154
+ return true; // 代 1 生效,老臂不必挂
155
+ if (typeof settings.register === 'function') {
156
+ try {
157
+ const scope = settings.register(MEMORY_ENTRY_ID, liveSettingsSchema(), { applies: 'live' });
158
+ inner = wireScope(scope);
159
+ logger.info('[memory] 记忆模式开关就绪(settings.register,命名空间 dsh-memory)');
160
+ return true;
161
+ }
162
+ catch (err) {
163
+ logger.warn(`[memory] 记忆模式开关注册失败(保持全开): ${err instanceof Error ? err.message : String(err)}`);
164
+ return true;
165
+ }
166
+ }
167
+ if (typeof settings.installSection === 'function') {
168
+ try {
169
+ let source = () => ({ ...ALWAYS_ON, distillChain: [] });
170
+ let notify;
171
+ const bridge = {
172
+ get: () => resolveSettings(source()),
173
+ watch: (callback) => {
174
+ notify = () => void callback(bridge.get());
175
+ return () => {
176
+ notify = undefined;
177
+ };
178
+ },
179
+ update: () => Promise.reject(new Error('installSection 桥接模式不支持运行时写入')),
180
+ };
181
+ settings.installSection(ctx, MEMORY_ENTRY_ID, liveSettingsSchema(), { ...ALWAYS_ON, distillChain: [] }, {
182
+ setSource: (current) => {
183
+ source = current;
184
+ },
185
+ onChange: () => notify?.(),
186
+ });
187
+ inner = wireScope(bridge);
188
+ logger.info('[memory] 记忆模式开关就绪(settings.installSection 桥接,运行时写入不可用)');
189
+ return true;
190
+ }
191
+ catch (err) {
192
+ logger.warn(`[memory] 记忆模式开关 installSection 桥接失败(保持全开): ${err instanceof Error ? err.message : String(err)}`);
193
+ return true;
194
+ }
195
+ }
196
+ logger.warn('[memory] settings 服务无可用的 register/installSection API,记忆模式开关降级为恒开');
197
+ return true;
198
+ };
199
+ if (!tryAttachOld()) {
200
+ logger.warn('[memory] settings 服务未就绪,记忆模式开关暂不可用(保持全开,等待服务上线)');
201
+ }
202
+ // 服务迁移自愈(代 2/2' 臂):下线 → 降级;换实例/上线 → 立即重试挂接(幂等)。
203
+ ctx.on('internal/service', (name) => {
204
+ if (name !== 'settings')
205
+ return;
206
+ inner = {
207
+ supported: false,
208
+ get: () => ({ ...ALWAYS_ON, distillChain: [] }),
209
+ update: () => Promise.reject(new Error('settings 服务不可用,记忆开关无法写入')),
210
+ };
211
+ tryAttachOld();
212
+ });
213
+ const modernWrite = () => {
214
+ const f = forms;
215
+ return !!(f && typeof f.update === 'function');
216
+ };
129
217
  return {
130
218
  supported: true,
131
- get: read,
219
+ get: () => (modernWrite() ? read() : inner.get()),
132
220
  update: async (patch) => {
133
- if (!forms)
134
- throw new Error('settings 服务不可用,记忆开关无法写入');
135
- // patch 合并语义与旧 scope.update 一致:只改传入键。合并在插件侧完成后
136
- // **整节提交**——宿主的表单 update 按 volatile 节整体写入 profile patch,
137
- // 部分对象会覆盖掉未提交字段。写失败(update 抛错)对调用方可观测。
138
- const next = { ...read(), ...patch };
139
- await forms.update(MEMORY_ENTRY_ID, { live: next });
221
+ if (modernWrite()) {
222
+ if (!forms)
223
+ throw new Error('settings 服务不可用,记忆开关无法写入');
224
+ // patch 合并语义与旧 scope.update 一致:只改传入键。合并在插件侧完成后
225
+ // **整节提交**——宿主的表单 update 按 volatile 节整体写入 profile patch,
226
+ // 部分对象会覆盖掉未提交字段。写失败(update 抛错)对调用方可观测。
227
+ const next = { ...read(), ...patch };
228
+ await forms.update(MEMORY_ENTRY_ID, { live: next });
229
+ return;
230
+ }
231
+ await inner.update(patch);
140
232
  },
141
233
  };
142
234
  }
package/dsh.plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "dsh-prime-memory",
3
3
  "name": "dsh-prime-memory",
4
- "version": "0.20.0-beta.6-dsh0.2.0.1",
4
+ "version": "0.22.1",
5
5
  "description": {
6
6
  "en": "Layered distilled memory plugin (L0 capture → L1 atomic memory → L2 scenes → L3 persona) with automatic recall injection before each model step.",
7
7
  "zh": "L0~L3 分层蒸馏记忆插件:自动捕获对话、抽取原子记忆、整合场景块、蒸馏核心画像,并在模型步骤前自动召回注入。"
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "license": "MIT",
15
15
  "engines": {
16
- "dsh": ">=0.2.0-rc.1 <0.2.1-0"
16
+ "dsh": ">=0.1.0-rc.2"
17
17
  },
18
18
  "components": {
19
19
  "host": "dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-prime-memory",
3
- "version": "0.21.0",
3
+ "version": "0.22.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public",
@@ -24,8 +24,7 @@
24
24
  },
25
25
  "client": {
26
26
  "inject": [
27
- "@deepseek-ai/dsh-client-ui-primitives",
28
- "@deepseek-ai/dsh-client-connection"
27
+ "@deepseek-ai/dsh-client-ui-primitives"
29
28
  ],
30
29
  "platform": "web"
31
30
  }
@@ -57,11 +56,12 @@
57
56
  "build:smoke": "tsc src/smoke.ts --outDir dist-smoke --module nodenext --moduleResolution nodenext --target es2022 --strict --skipLibCheck --esModuleInterop",
58
57
  "lint": "eslint src client/src scripts tests",
59
58
  "test": "vitest run",
60
- "wing-migrate": "npm run build && node scripts/wing-migrate.mjs"
59
+ "wing-migrate": "npm run build && node scripts/wing-migrate.mjs",
60
+ "prepack": "npm run build"
61
61
  },
62
62
  "engines": {
63
63
  "node": ">=22.16.0",
64
- "dsh": ">=0.2.0-rc.1 <0.2.1-0"
64
+ "dsh": ">=0.1.0-rc.2"
65
65
  },
66
66
  "keywords": [
67
67
  "dsh",
@@ -83,15 +83,15 @@
83
83
  },
84
84
  "peerDependencies": {
85
85
  "@deepseek-ai/cordis": "^4.0.1",
86
- "@deepseek-ai/dsh-agent": ">=0.2.0-rc.1 <0.2.1-0",
87
- "@deepseek-ai/dsh-client-connection": ">=0.2.0-rc.1 <0.2.1-0",
88
- "@deepseek-ai/dsh-client-ui-primitives": ">=0.2.0-rc.1 <0.2.1-0",
89
- "@deepseek-ai/dsh-home-paths": ">=0.2.0-rc.1 <0.2.1-0",
90
- "@deepseek-ai/dsh-llm": ">=0.2.0-rc.1 <0.2.1-0",
91
- "@deepseek-ai/dsh-session": ">=0.2.0-rc.1 <0.2.1-0",
92
- "@deepseek-ai/dsh-settings": ">=0.2.0-rc.1 <0.2.1-0",
93
- "@deepseek-ai/dsh-system-prompt": ">=0.2.0-rc.1 <0.2.1-0",
94
- "@deepseek-ai/dsh-tools": ">=0.2.0-rc.1 <0.2.1-0"
86
+ "@deepseek-ai/dsh-agent": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
87
+ "@deepseek-ai/dsh-client-connection": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
88
+ "@deepseek-ai/dsh-client-ui-primitives": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
89
+ "@deepseek-ai/dsh-home-paths": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
90
+ "@deepseek-ai/dsh-llm": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
91
+ "@deepseek-ai/dsh-session": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
92
+ "@deepseek-ai/dsh-settings": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
93
+ "@deepseek-ai/dsh-system-prompt": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2",
94
+ "@deepseek-ai/dsh-tools": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2"
95
95
  },
96
96
  "peerDependenciesMeta": {
97
97
  "@deepseek-ai/dsh-agent": {