dsh-memu-memory 1.2.6 → 1.2.7

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.
@@ -75,7 +75,7 @@ npm run check # node --check + i18n 键对齐 + package.j
75
75
 
76
76
  ### 5.3 新增一个 RPC 方法
77
77
 
78
- <!-- rpc-method-count: 95 -->
78
+ <!-- rpc-method-count: 97 -->
79
79
 
80
80
  1. `lib/rpc.js` 的 `switch` 加 case(共 95 个方法,按功能分组,别乱插)。
81
81
  2. 返回**形状稳定**:客户端 `call()` 直接解构,列表类给 `{items, total}` 而不是裸数组。
@@ -253,7 +253,7 @@ headless 会禁用 `deepseek-account`;没有配假模型时会以 `MISSING_CRE
253
253
  ### 5.4 没测的
254
254
 
255
255
  - 桌面壳(Windows 标题栏、原生按钮区)——本插件不写 DOM app-region,但仍未在 0.2.2 桌面上跑过。
256
- - 全局整理(`subagents.startActivation`)与历史会话 fork(`agents.create` + `followup`)只核对了类型/源码,没有在 0.2.2 真机上跑完一整次作业。
256
+ - ~~全局整理(`subagents.startActivation`)与历史会话 fork(`agents.create` + `followup`)只核对了类型/源码,没有在 0.2.2 真机上跑完一整次作业。~~ **1.2.7 实证补记**:这条漏测面被内部真机评测击中——rc.1 的种子校验(`assertAssistantSettlementShape`)要求 `assistant/message.data.stream` 是数组,而插件种子清噪曾直接删除该字段,**0.2.2-rc.1 上每个整理 fork 种子必被拒**(1.2.6 已发布版中招)。已修:种子携带**空 stream 数组**(`lib/private.js` compactSeedEvents),并用 `node scripts/check-seed-compat.mjs --session-pkg <宿主 dsh-session 的 lib/index.js>` 固化为**每个新宿主版本适配检查表的必跑项**(PASS 后再跑完整整理作业)。全局整理(startActivation)仍属源码核对面。
257
257
  - 日期唤醒的**真实投递**没有等 5 分钟周期;只核对了 `ctx.schedule` 的 rc.1 类型与单测。
258
258
  - 从 0.2.1 升级上来的旧库/旧 state.json:未在 0.2.2 上做迁移回归(数据格式未变,但不宣称已测)。
259
259
 
@@ -61,7 +61,7 @@
61
61
  - **只有三个 key 分域**:`system-guide`、`private-policy`、`private-consolidation`;`global-curator` 不分域。
62
62
  - **远程与本地共用一份 `private-consolidation`**:正文讲「记什么、字段怎么填」,差异只有输出协议(`CONSOLIDATION_CONTRACTS.local` 调工具 / `.remote` 返回 JSON,代码追加)。不要拆第二份。
63
63
  - **1.2.2 起整理稿负责标题质量**:title 按「只看标题就知道具体事实」写(8–40 字、具体关键词、集合稿覆盖全部来源),`global-curator` 同一口径。词典/关联的工具调用属于**本地工作流**:领域整理稿与远程 JSON 路径共用,因此不写 `memu_*` 工具名;领域稿只保留「可抽什么词」的差异,稳定复用的黑话/梗/术语先 `memu_lexicon_search` 再 `memu_lexicon_propose`、写完用 `memu_private_link_suggest` 裁决候选的工具流程只出现在 local worker brief。远程契约明确「没有工具」,title 长度同样是 8–40 字。
64
- - RP 与 coding 是**内容**差异:coding 记事实(决定、约束、踩过的坑、工程偏好),召回当「可能过期的事实」,与代码冲突时以代码为准;rp 记经验(具体瞬间、半句原话、身体感觉、没说出口的话),允许模糊记错,不确定就标低 `confidence`。
64
+ - RP 与 coding 是**内容**差异:coding 记事实(决定、约束、踩过的坑、工程偏好),召回当「可能过期的事实」,与代码冲突时以代码为准;rp 记经验(具体瞬间、半句原话、身体感觉、没说出口的话),允许模糊记错,不确定就标低 `confidence`。rp/mixed 同时收对方主动给出的**现实生活事实**(作息、行程、口味、健康、家人朋友、在忙的事):`about_user` 平实短条(30–80 字),不需要「瞬间+影响」模板,剧情与现实条分开写、不互相合并;单次提及低 confidence 或 `short_term`,重复出现才升 `long_term`(`寒暄不留`的口径只拦寒暄本身,不拦寒暄里夹带的事实)。
65
65
  - **KV cache**:section 文本随 domain 变,但同一会话内恒定,缓存不受影响;中途改 domain 会让该会话失效一次缓存。别在文档里写「文本恒定」。
66
66
 
67
67
  ### 8.6 可见范围只剩两档,它决定「自动浮现」而不是「谁能读」
@@ -146,6 +146,8 @@
146
146
 
147
147
  服务不可用时仅回退词法并保留可见错误信号;不暗切远端、不调用 LLM。真实 embedding 质量、延迟和跨模型收益仍需单独评测;W8(助手重复提示)已决定不做,结论与理由见 `AGENTS.md`。
148
148
 
149
+ **语义召回缓存(1.2.7)**:`managedRecall` 的成功语义召回段被 `lib/recall-cache.js` 的进程内 LRU 缓存(max=256、TTL 120s)包住,命中直接复用融合结果,词面 localRecall 仍每轮计算。只缓存成功路径:`byId` 直达、local-fallback、带 `errors` 的降级结果一律不缓存(fail-open 信号不能被缓存吞掉)。缓存键含 `memoryRevision()`(state.js 的每次索引/状态落盘自增,自动覆盖 remember/update/整理提交/graph/迁移全部写路径)+ 向量代数 token + query/topK/libraryId/domain/sessionId/context/automatic,写记忆后下一轮键即变化、无 stale;跨进程写入靠 TTL 兜底(revision 是进程内的)。缓存自身故障按未命中处理并 `warn` 留痕(`stats()` 暴露 hits/misses/errors)。显式召回(`memu_private_recall`)命中率为 ~0 是正确行为:其 `touchAccess` 写会推进 revision 使键失效,accessCount 参与 decay 加成不能被缓存短路。
150
+
149
151
  模型下载、进度与 profile 切换/迁移已有实现,但真实模型/runtime 下载、原生推理及切换全链路在本轮仍未验证。candidate / `pending` artifact 不是可用制品,必须通过制品、校验与迁移门槛后才可进入可用/激活状态。
150
152
 
151
153
  回归与管线测试:`tests/hybrid-recall.test.mjs` 仅保留 RRF、去重、稳定排序、资格过滤与候选上限等通用融合 helper 覆盖;managed vector 行为由 `tests/managed-memory.test.mjs` 覆盖。
@@ -91,6 +91,8 @@ S8 展示回写 client.js 面板 + useMemoryBeat 心跳 + rpc.js allowed + tool
91
91
 
92
92
  **守卫**:同库连续两次写后条目数对不上即可确认;并发用例见 `tests/storage.test.mjs`。
93
93
 
94
+ **召回缓存(1.2.7)不是本症状的成因**:写路径(remember/update/整理提交)都会推进 `memoryRevision()`,缓存键随之变化,同进程写后立即召回不会命中旧键。唯一残留窗口是**跨进程写**(第二窗口/独立进程改库):revision 是进程内的,另一进程最多多看 120s(TTL)旧召回,之后自动刷新;`bumpGeneration()` 可手动清。
95
+
94
96
  ### 3.5 面板不自动刷新(S8 心跳)
95
97
 
96
98
  **症状**:侧边栏 / 设置页要手点刷新才更新,心跳却一直在跑。
@@ -360,7 +362,7 @@ S8 展示回写 client.js 面板 + useMemoryBeat 心跳 + rpc.js allowed + tool
360
362
 
361
363
  ### 2.1 模块地图
362
364
 
363
- <!-- rpc-method-count: 95 -->
365
+ <!-- rpc-method-count: 97 -->
364
366
 
365
367
  | 文件 | 职责 / 什么时候碰它 |
366
368
  |---|---|
@@ -54,9 +54,9 @@ export const RUNTIME_STATE = Object.freeze([
54
54
  { layer: 'temporary-map', file: 'lib/inbound.js:13', name: 'calls', keyedBy: 'sessionId', clearedBy: 'tool/result or turn/end' },
55
55
  { layer: 'temporary-map', file: 'lib/inbound.js:14', name: 'sessions', keyedBy: 'sessionId', clearedBy: 'session/disposed (releaseInboundSession)' },
56
56
  { layer: 'temporary-map', file: 'lib/media.js:19', name: 'captures', keyedBy: 'sessionId', clearedBy: 'capture settle' },
57
- { layer: 'temporary-map', file: 'lib/private.js:528', name: 'inFlight', keyedBy: 'sessionId', clearedBy: 'consolidation settle' },
57
+ { layer: 'temporary-map', file: 'lib/private.js:535', name: 'inFlight', keyedBy: 'sessionId', clearedBy: 'consolidation settle' },
58
58
  { layer: 'temporary-map', file: 'lib/curator.js:50', name: 'jobs', keyedBy: 'job id', clearedBy: 'curation settle' },
59
- { layer: 'cache', file: 'lib/state.js:1144', name: 'indexCache', keyedBy: 'libraryId', clearedBy: 'next load / external write' },
59
+ { layer: 'cache', file: 'lib/state.js:1186', name: 'indexCache', keyedBy: 'libraryId', clearedBy: 'next load / external write' },
60
60
  { layer: 'cache', file: 'lib/paths.js:52', name: 'readFailures', keyedBy: 'absolute file', clearedBy: 'a later successful read' },
61
61
  ])
62
62
 
package/lib/client.js CHANGED
@@ -274,11 +274,24 @@ window.__ModuleLoader__.load({
274
274
  warning: '更新到未经验证的最新版可能导致 CLI 变化或记忆功能损坏。只安装插件声明的推荐版本。',
275
275
  memorySettings: '记忆设置',
276
276
  settingsTuning: '注入与召回',
277
+ settingsHeaderNote: '改动即时保存(约 0.25 秒后写盘);「恢复默认」需两次点击确认。',
278
+ settingsGroupRecall: '召回与注入',
279
+ settingsGroupRecallDesc: '每轮注入什么、注入多少:注入模式、召回条数、token 预算与去重。',
280
+ settingsGroupLifecycle: '记忆生命周期',
281
+ settingsGroupLifecycleDesc: '永久上限、短期保留、未了之事复提与归档清理节奏。',
282
+ settingsGroupCuration: '整理与唤醒',
283
+ settingsGroupCurationDesc: '空闲整理与全局自动提炼的节奏,以及日期到点唤醒。',
284
+ settingsGroupEngine: '引擎与后端',
285
+ settingsGroupEngineDesc: 'MemU 存储模式与引擎自动安装。',
286
+ settingsGroupSession: '会话与界面',
287
+ settingsGroupSessionDesc: '新会话提示、侧边栏设置入口与图片描述。',
288
+ settingsGroupIntegration: '集成',
289
+ settingsGroupIntegrationDesc: '对外暴露的消息工具白名单与视觉描述服务。',
277
290
  autoInject: '注入模式',
278
291
  privateTopK: '私有 topK',
279
292
  globalTopK: '全局 topK',
280
293
  crossLibraryRecall: '跨库召回(仅同领域)',
281
- crossLibraryRecallHint: '开启后,自动召回、memu_private_recall、memu_private_list 与侧栏私有列表会合并其它“同领域”私有记忆库;词典的锚点摘要、本回合匹配与 memu_lexicon_search 走同一个作用域。显式浏览某个库时仍只显示该库。写入仍只写当前库(全局词典只有你能写)。跨文件夹读取会改变隔离边界,默认关闭。',
294
+ crossLibraryRecallHint: '开启后,这些读取会合并其它「同领域」私有库:自动召回、memu_private_recall、memu_private_list、侧栏私有列表,以及词典的锚点摘要、本回合匹配与 memu_lexicon_search。\n显式浏览某个库时,仍只显示该库。\n写入不受影响,仍只写当前库;全局词典只有你能写。\n跨库读取改变隔离边界,默认关闭。',
282
295
  mustRememberCap: '永久记忆软上限',
283
296
  shortTermTtlHours: '短期记忆保留(小时,0=关闭)',
284
297
  anchorTokens: '锚点 token',
@@ -297,12 +310,34 @@ window.__ModuleLoader__.load({
297
310
  salientWakeSchedule: '到点唤醒会话',
298
311
  salientWakeHour: '唤醒时间(HH:mm)',
299
312
  salientWakeTimeZone: '唤醒时区(留空跟随系统)',
300
- salientWakeHint: '实验特性,默认关闭。唤醒走宿主定时任务投递,会替会话开一整轮;只有宿主进程活着才会触发,任务在宿主的定时任务界面可见、可手动删除。还没做过真机验收,建议先在测试库里试开。',
313
+ salientWakeHint: '实验特性,默认关闭:唤醒会替会话开一整轮,由宿主定时任务投递。\n只有宿主进程活着才会触发;任务在宿主的定时任务界面可见、可手动删除。\n还没做过真机验收,建议先在测试库里试开。',
301
314
  autoInstall: '自动安装引擎',
302
315
  sleepConsolidation: '空闲后整理记忆',
303
316
  sleepAfterIdleMinutes: '空闲多久后整理(分钟)',
304
317
  autoCurateEveryHours: '全局自动提炼间隔(小时,0=关闭)',
305
318
  autoCurateSessionLimit: '每次最多纳入的对话数',
319
+ consolidationModelMode: '整理模型',
320
+ consolidationModeInherit: '继承当前会话',
321
+ consolidationModeHost: '指定宿主模型',
322
+ consolidationModeCustom: '自定义接入点',
323
+ consolidationHostProvider: '宿主 Provider',
324
+ consolidationHostModel: '宿主模型',
325
+ consolidationProviderPick: '选择 provider',
326
+ consolidationModelPick: '选择模型',
327
+ consolidationCatalogLoading: '正在读取宿主模型目录…',
328
+ consolidationCatalogDegraded: '拿不到宿主模型目录(或目录为空),直接按 provider/model 手填。',
329
+ consolidationHostHint: '这里列出的是宿主已配置的 provider/route,整理 fork 直接指名它,不新建连接。',
330
+ consolidationKeyKeep: '已配置,留空保持不变',
331
+ consolidationKeyEmpty: '选填;本地网关可以没有 key',
332
+ consolidationCustomModel: '模型 ID',
333
+ consolidationCustomApiLabel: '线协议',
334
+ consolidationDiscover: '拉取模型列表',
335
+ consolidationDiscoverDone: '拉到 {n} 个模型',
336
+ consolidationDiscoverFailed: '拉取失败',
337
+ consolidationCustomHint: '每次整理前自动注册这个接入点(无需重启),失败自动降级回继承并在日志里说明;API key 只存本地,不进日志。',
338
+ consolidationCustomUnavailable: '这台宿主缺少挂载自定义接入点的能力(llm.registerAdapter 或 PiAiAdapter 不在),改用「指定宿主模型」或「继承当前会话」。',
339
+ curatorModel: '全局整理模型',
340
+ curatorModelHint: '全局记忆提炼用的模型,格式 provider/model,留空跟随当前会话;与上面的私有整理模型是两条路。',
306
341
  memoryMode: 'MemU 存储模式',
307
342
  memoryModeHint: 'local 把记忆留在本机;cloud 交给 MemU 官方后端,需要 ~/.memu/config.env 里的厂商凭据。',
308
343
  memoryBackend: '记忆后端',
@@ -1043,11 +1078,24 @@ window.__ModuleLoader__.load({
1043
1078
  warning: 'Unverified latest releases can change the CLI or break memory. Only the recommended version declared by the plugin is installed.',
1044
1079
  memorySettings: 'Memory settings',
1045
1080
  settingsTuning: 'Injection & recall',
1081
+ settingsHeaderNote: 'Edits save themselves about 0.25s after each change; Reset defaults asks for a second click.',
1082
+ settingsGroupRecall: 'Recall & injection',
1083
+ settingsGroupRecallDesc: 'What each turn injects and how much: injection mode, topK, token budgets, dedupe.',
1084
+ settingsGroupLifecycle: 'Memory lifecycle',
1085
+ settingsGroupLifecycleDesc: 'Permanent cap, short-term retention, open-loop reminders and archive cleanup.',
1086
+ settingsGroupCuration: 'Curation & wake',
1087
+ settingsGroupCurationDesc: 'Idle consolidation and global auto-curation cadence, plus salient-date wake.',
1088
+ settingsGroupEngine: 'Engine & backend',
1089
+ settingsGroupEngineDesc: 'MemU storage mode and engine auto-install.',
1090
+ settingsGroupSession: 'Session & interface',
1091
+ settingsGroupSessionDesc: 'New-session prompt, sidebar settings entry and image captioning.',
1092
+ settingsGroupIntegration: 'Integration',
1093
+ settingsGroupIntegrationDesc: 'External message tool allowlist and the vision caption service.',
1046
1094
  autoInject: 'Injection mode',
1047
1095
  privateTopK: 'Private topK',
1048
1096
  globalTopK: 'Global topK',
1049
1097
  crossLibraryRecall: 'Cross-library recall (same domain)',
1050
- crossLibraryRecallHint: 'When on, automatic recall, memu_private_recall, memu_private_list and the sidebar private list merge other private libraries that use the same domain; the lexicon anchor, this-turn match and memu_lexicon_search follow the same scope. An explicit library browser still shows only that library. Writes still go to the bound library only (the global lexicon is yours alone to write). Reading across folders changes the isolation boundary, so this is off by default.',
1098
+ crossLibraryRecallHint: 'When on, these reads merge other same-domain private libraries: automatic recall, memu_private_recall, memu_private_list, the sidebar private list, plus the lexicon anchor summaries, this-turn matching and memu_lexicon_search.\nExplicitly browsing a library still shows that library only.\nWrites are unaffected and still go to the current library; the global lexicon stays yours alone to write.\nReading across libraries changes the isolation boundary, so this is off by default.',
1051
1099
  mustRememberCap: 'Permanent memory cap',
1052
1100
  shortTermTtlHours: 'Short-term TTL in hours (0=off)',
1053
1101
  anchorTokens: 'Anchor tokens',
@@ -1066,12 +1114,34 @@ window.__ModuleLoader__.load({
1066
1114
  salientWakeSchedule: 'Wake the conversation',
1067
1115
  salientWakeHour: 'Wake time (HH:mm)',
1068
1116
  salientWakeTimeZone: 'Wake time zone (empty = system)',
1069
- salientWakeHint: 'Experimental and off by default. Delivery goes through the host scheduler and opens a full turn for the conversation. It only fires while the host process is alive, and the tasks are visible (and deletable) in the host schedule UI. Not yet verified on a real install — try it on a test library first.',
1117
+ salientWakeHint: 'Experimental and off by default: a wake opens a full turn for the conversation, delivered by the host scheduler.\nIt only fires while the host process is alive; tasks stay visible (and deletable) in the host schedule UI.\nNot yet verified on a real install — try it on a test library first.',
1070
1118
  autoInstall: 'Auto-install engine',
1071
1119
  sleepConsolidation: 'Consolidate after idle',
1072
1120
  sleepAfterIdleMinutes: 'Idle minutes before consolidating',
1073
1121
  autoCurateEveryHours: 'Auto global curation every N hours (0=off)',
1074
1122
  autoCurateSessionLimit: 'Max conversations per auto run',
1123
+ consolidationModelMode: 'Consolidation model',
1124
+ consolidationModeInherit: 'Inherit the conversation',
1125
+ consolidationModeHost: 'Pick a host model',
1126
+ consolidationModeCustom: 'Custom endpoint',
1127
+ consolidationHostProvider: 'Host provider',
1128
+ consolidationHostModel: 'Host model',
1129
+ consolidationProviderPick: 'Pick a provider',
1130
+ consolidationModelPick: 'Pick a model',
1131
+ consolidationCatalogLoading: 'Loading the host model catalog…',
1132
+ consolidationCatalogDegraded: 'Host catalog unavailable (or empty) — type provider/model directly.',
1133
+ consolidationHostHint: 'These are the providers/routes the host already configured; the consolidation fork names one of them directly, no new connection.',
1134
+ consolidationKeyKeep: 'Configured; leave blank to keep',
1135
+ consolidationKeyEmpty: 'Optional; local gateways may run without a key',
1136
+ consolidationCustomModel: 'Model ID',
1137
+ consolidationCustomApiLabel: 'Wire protocol',
1138
+ consolidationDiscover: 'Fetch model list',
1139
+ consolidationDiscoverDone: 'Found {n} models',
1140
+ consolidationDiscoverFailed: 'Fetch failed',
1141
+ consolidationCustomHint: 'The endpoint is re-registered before every consolidation (no restart needed); on failure the fork falls back to inherit with a log line. The API key stays on this machine and never enters logs.',
1142
+ consolidationCustomUnavailable: 'This host cannot mount a custom endpoint (llm.registerAdapter or PiAiAdapter missing); use "Pick a host model" or "Inherit the conversation".',
1143
+ curatorModel: 'Global curator model',
1144
+ curatorModelHint: 'Model for global memory curation, format provider/model; empty follows the current conversation — a separate path from the private consolidation model above.',
1075
1145
  memoryMode: 'MemU storage mode',
1076
1146
  memoryModeHint: 'local keeps memory on this machine; cloud hands storage to the MemU backend and needs vendor credentials in ~/.memu/config.env.',
1077
1147
  memoryBackend: 'Memory backend',
@@ -3973,6 +4043,17 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
3973
4043
  // Which snapshot the painted settings belong to (task E). Refetched only when
3974
4044
  // the marker moves, so a write made in another window lands within one beat.
3975
4045
  const markerRef = React.useRef(null)
4046
+ // 整理 fork 的宿主模型目录(listForkModelOptions):切到 host/custom 时懒加载一次并
4047
+ // 缓存。失败只置 error 状态,相关行降级为手填输入——用户不被卡死。
4048
+ const [forkCatalog, setForkCatalog] = React.useState(null)
4049
+ const [forkCatalogState, setForkCatalogState] = React.useState('idle')
4050
+ // custom 模式的 key 草稿:密码框只养草稿,留空或删光都不覆盖已存的 key
4051
+ //(后端 updateSettings 对空串的语义是「清空」,所以 UI 只在有输入时才写)。
4052
+ const [forkKeyDraft, setForkKeyDraft] = React.useState('')
4053
+ const [forkDiscoverBusy, setForkDiscoverBusy] = React.useState(false)
4054
+ const [forkDiscoverNote, setForkDiscoverNote] = React.useState('')
4055
+ const [forkDiscoverModels, setForkDiscoverModels] = React.useState(null)
4056
+ const forkCatalogLoadingRef = React.useRef(false)
3976
4057
 
3977
4058
  const adoptState = (value) => {
3978
4059
  setState({ ...value, settings: { ...value?.settings, ...pendingSettings.current } })
@@ -4028,6 +4109,22 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
4028
4109
  window.addEventListener?.('pagehide', flush)
4029
4110
  return () => { window.removeEventListener?.('pagehide', flush); clearTimeout(settingsTimer.current); flush() }
4030
4111
  }, [flushSettings])
4112
+ // 宿主模型目录懒加载:切到 host/custom 时拉一次,缓存在组件状态里,之后不再重复
4113
+ // 拉。失败不抛——目录拿不到只是降级成手填,设置页不该为一个目录炸掉。
4114
+ const loadForkCatalog = React.useCallback(async () => {
4115
+ if (forkCatalogLoadingRef.current) return
4116
+ forkCatalogLoadingRef.current = true
4117
+ setForkCatalogState('loading')
4118
+ try {
4119
+ setForkCatalog(await call('listForkModelOptions', {}))
4120
+ setForkCatalogState('loaded')
4121
+ } catch {
4122
+ setForkCatalog(null)
4123
+ setForkCatalogState('error')
4124
+ } finally {
4125
+ forkCatalogLoadingRef.current = false
4126
+ }
4127
+ }, [call])
4031
4128
  React.useEffect(() => {
4032
4129
  if (!standalone) return undefined
4033
4130
  const sync = () => {
@@ -4222,6 +4319,13 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
4222
4319
  void loadReviews()
4223
4320
  }
4224
4321
  }, [page, foldersLoaded, promptsLoaded, globalLoaded, loadFolders, loadPrompts, loadGlobal, loadSessions, loadReviews])
4322
+ // host 需要 provider/model 枚举,custom 需要 customAvailable/discoveryAvailable
4323
+ // 能力位——三态不在 inherit 时目录才值得拉(一次,之后吃缓存)。
4324
+ React.useEffect(() => {
4325
+ const mode = state?.settings?.consolidationModelMode || 'inherit'
4326
+ if (mode !== 'host' && mode !== 'custom') return
4327
+ if (forkCatalogState === 'idle') void loadForkCatalog()
4328
+ }, [state?.settings?.consolidationModelMode, forkCatalogState, loadForkCatalog])
4225
4329
  React.useEffect(() => {
4226
4330
  if (page !== PAGE.browser || !browseLibId) return undefined
4227
4331
  let alive = true
@@ -4279,9 +4383,6 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
4279
4383
  return () => { alive = false; clearInterval(id) }
4280
4384
  }, [page, expandedKey, loadFolderSessions])
4281
4385
 
4282
- const saveSettings = async () => {
4283
- await flushSettings()
4284
- }
4285
4386
  // Defaults live on the server (state.js DEFAULT_SETTINGS): the page asks for
4286
4387
  // them rather than carrying a second copy that would drift from the code.
4287
4388
  const resetSettingsNow = async () => {
@@ -4416,6 +4517,33 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
4416
4517
  clearTimeout(settingsTimer.current)
4417
4518
  settingsTimer.current = setTimeout(() => { void flushSettings() }, 250)
4418
4519
  }
4520
+ // 「拉取模型列表」:把草稿端点转给 discoverForkModels。apiKey 是一次性草稿凭据——
4521
+ // 密码框里有输入就带草稿,留空就声明复用已存 key(useStoredKey),两者都不回显、
4522
+ // 不进日志。结果只填下拉,失败给一行自清状态。
4523
+ const discoverConsolidationModels = async () => {
4524
+ setForkDiscoverBusy(true)
4525
+ setForkDiscoverNote('')
4526
+ try {
4527
+ const res = await call('discoverForkModels', {
4528
+ baseURL: state?.settings?.consolidationCustomBaseURL || '',
4529
+ api: state?.settings?.consolidationCustomApi || 'openai-completions',
4530
+ apiKey: forkKeyDraft,
4531
+ useStoredKey: !forkKeyDraft,
4532
+ })
4533
+ if (res?.ok === true) {
4534
+ const models = Array.isArray(res.models) ? res.models : []
4535
+ setForkDiscoverModels(models)
4536
+ setForkDiscoverNote(t('consolidationDiscoverDone').replace('{n}', String(models.length)))
4537
+ } else {
4538
+ setForkDiscoverNote(res?.reason ? `${t('consolidationDiscoverFailed')} · ${res.reason}` : t('consolidationDiscoverFailed'))
4539
+ }
4540
+ } catch (e) {
4541
+ setForkDiscoverNote(`${t('consolidationDiscoverFailed')} · ${String(e?.message || e)}`)
4542
+ } finally {
4543
+ setForkDiscoverBusy(false)
4544
+ }
4545
+ setTimeout(() => setForkDiscoverNote(''), 2600)
4546
+ }
4419
4547
  const setBackend = async (backend) => {
4420
4548
  setSetting('memoryBackend', backend)
4421
4549
  setConfigNotice('')
@@ -5301,13 +5429,120 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
5301
5429
 
5302
5430
  )
5303
5431
 
5432
+ // 每组一个 Section(title + desc 走 i18n),组内沿用同一个 dshm-settings-grid。
5433
+ // 这里只是重排 + 分组:行与取值逻辑(含 ?? 回落、反向语义开关)一行不增不减。
5434
+ const settingsGroup = (title, desc, ...rows) => h(Section, { title, desc },
5435
+ h('div', { className: 'dshm-settings-grid' }, rows))
5436
+
5437
+ // —— 整理 fork 的模型选择(三模式)行 ——————————————————————————————
5438
+ // 行随 consolidationModelMode 条件渲染:inherit 只露模式选择;host 露宿主目录的
5439
+ // provider/model 两行(目录拿不到就降级成 provider/model 手填,同样写
5440
+ // consolidationModel,用户不被卡死);custom 露接入点四件套(这台宿主确认挂不了
5441
+ // custom 时整组降级为一行说明)。curatorModel 是全局提炼的模型,与这里的私有
5442
+ // 整理模型是两条路,恒常显示。
5443
+ const consolidationMode = settings.consolidationModelMode || 'inherit'
5444
+ const consolidationModelValue = String(settings.consolidationModel || '')
5445
+ const consolidationSlash = consolidationModelValue.indexOf('/')
5446
+ const consolidationProvider = consolidationSlash > 0 ? consolidationModelValue.slice(0, consolidationSlash) : ''
5447
+ const consolidationModelId = consolidationSlash > 0 ? consolidationModelValue.slice(consolidationSlash + 1) : ''
5448
+ const forkProviders = Array.isArray(forkCatalog?.providers) ? forkCatalog.providers : []
5449
+ const forkCatalogReady = forkCatalogState === 'loaded' && forkProviders.length > 0
5450
+ const forkProviderIds = forkCatalogReady ? forkProviders.map((p) => String(p?.id || '')).filter(Boolean) : []
5451
+ const forkModelEntries = forkCatalogReady ? (forkProviders.find((p) => p?.id === consolidationProvider)?.models || []) : []
5452
+ const forkOptionLabel = (item) => (item?.name && item.name !== item.id ? `${item.name} (${item.id})` : String(item?.id || ''))
5453
+ // 下拉要能显示当前值:已有 consolidationModel 但不在目录里(宿主 route 下线)时
5454
+ // 把当前值补成一个选项,显示与状态不脱节。
5455
+ const providerChoices = []
5456
+ if (!consolidationProvider) providerChoices.push({ id: '', label: t('consolidationProviderPick') })
5457
+ if (consolidationProvider && !forkProviderIds.includes(consolidationProvider)) providerChoices.push({ id: consolidationProvider, label: consolidationProvider })
5458
+ for (const id of forkProviderIds) providerChoices.push({ id, label: forkOptionLabel(forkProviders.find((p) => p?.id === id)) })
5459
+ const modelChoices = []
5460
+ if (!consolidationModelId) modelChoices.push({ id: '', label: t('consolidationModelPick') })
5461
+ if (consolidationModelId && !forkModelEntries.some((m) => m?.id === consolidationModelId)) modelChoices.push({ id: consolidationModelId, label: consolidationModelId })
5462
+ for (const m of forkModelEntries) modelChoices.push({ id: m.id, label: forkOptionLabel(m) })
5463
+ const consolidationModelRows = []
5464
+ if (consolidationMode === 'host') {
5465
+ if (forkCatalogReady) {
5466
+ consolidationModelRows.push(
5467
+ h(Field, { label: t('consolidationHostProvider') },
5468
+ h('select', { style: S.input, value: consolidationProvider, onChange: (e) => {
5469
+ const provider = e.target.value
5470
+ if (!provider) { setSetting('consolidationModel', null); return }
5471
+ // 换 provider 顺手选它的第一个模型,避免留下 "<provider>/" 这种
5472
+ // 解析不过的中间态;该 provider 没目录时才留半截让用户接着选。
5473
+ const first = forkProviders.find((p) => p?.id === provider)?.models?.[0]?.id || ''
5474
+ setSetting('consolidationModel', first ? `${provider}/${first}` : `${provider}/`)
5475
+ } },
5476
+ providerChoices.map((choice) => h('option', { key: choice.id, value: choice.id }, choice.label)))),
5477
+ h(Field, { label: t('consolidationHostModel') },
5478
+ h('select', { style: S.input, value: consolidationModelId, onChange: (e) => {
5479
+ if (!e.target.value || !consolidationProvider) return
5480
+ setSetting('consolidationModel', `${consolidationProvider}/${e.target.value}`)
5481
+ } },
5482
+ modelChoices.map((choice) => h('option', { key: choice.id, value: choice.id }, choice.label)))),
5483
+ h('div', { className: 'dshm-settings-note', style: { ...S.muted, marginTop: 6, lineHeight: 1.55 } }, t('consolidationHostHint')))
5484
+ } else {
5485
+ consolidationModelRows.push(
5486
+ h(Field, { label: t('consolidationHostModel') },
5487
+ h('input', { type: 'text', style: S.input, placeholder: 'provider/model', value: consolidationModelValue,
5488
+ onChange: (e) => setSetting('consolidationModel', e.target.value || null) })),
5489
+ h('div', { className: 'dshm-settings-note', style: { ...S.muted, marginTop: 6, lineHeight: 1.55 } },
5490
+ forkCatalogState === 'loading' ? t('consolidationCatalogLoading') : t('consolidationCatalogDegraded')))
5491
+ }
5492
+ }
5493
+ if (consolidationMode === 'custom') {
5494
+ if (forkCatalog && forkCatalog.customAvailable === false) {
5495
+ consolidationModelRows.push(h('div', { className: 'dshm-settings-note', style: { ...S.muted, marginTop: 6, lineHeight: 1.55 } }, t('consolidationCustomUnavailable')))
5496
+ } else {
5497
+ const customModelId = String(settings.consolidationCustomModel || '')
5498
+ // key 永不回显明文:占位只给「已配置」+ 服务端打码尾 4 位;草稿有输入才写
5499
+ // setSetting(留空/删光 = 保留原值,因为后端对空串的语义是清空)。
5500
+ const keyConfigured = settings.hasConsolidationCustomApiKey === true || Boolean(String(settings.consolidationCustomApiKey || ''))
5501
+ const keyTail = String(settings.consolidationCustomApiKeyTail || '')
5502
+ const keyPlaceholder = keyConfigured
5503
+ ? t('consolidationKeyKeep') + (keyTail && keyTail !== '****' ? ` ····${keyTail}` : '')
5504
+ : t('consolidationKeyEmpty')
5505
+ const discovered = Array.isArray(forkDiscoverModels) ? forkDiscoverModels : []
5506
+ const customModelChoices = []
5507
+ if (!customModelId) customModelChoices.push({ id: '', label: t('consolidationModelPick') })
5508
+ if (customModelId && !discovered.some((m) => m?.id === customModelId)) customModelChoices.push({ id: customModelId, label: customModelId })
5509
+ for (const m of discovered) customModelChoices.push({ id: m.id, label: forkOptionLabel(m) })
5510
+ consolidationModelRows.push(
5511
+ h(Field, { label: t('baseUrl') },
5512
+ h('input', { type: 'text', style: S.input, placeholder: 'http://127.0.0.1:8899', value: settings.consolidationCustomBaseURL || '',
5513
+ onChange: (e) => setSetting('consolidationCustomBaseURL', e.target.value) })),
5514
+ h(Field, { label: t('apiKey') },
5515
+ h('input', { type: 'password', style: S.input, autoComplete: 'new-password', placeholder: keyPlaceholder, value: forkKeyDraft,
5516
+ onChange: (e) => { const next = e.target.value; setForkKeyDraft(next); if (next) setSetting('consolidationCustomApiKey', next) } })),
5517
+ h(Field, { label: t('consolidationCustomModel') },
5518
+ discovered.length
5519
+ ? h('select', { style: S.input, value: customModelId, onChange: (e) => { if (e.target.value) setSetting('consolidationCustomModel', e.target.value) } },
5520
+ customModelChoices.map((choice) => h('option', { key: choice.id, value: choice.id }, choice.label)))
5521
+ : h('input', { type: 'text', style: S.input, placeholder: 'GLM-5.3-Flash', value: customModelId,
5522
+ onChange: (e) => setSetting('consolidationCustomModel', e.target.value) })),
5523
+ h(Field, { label: t('consolidationCustomApiLabel') },
5524
+ h('select', { style: S.input, value: settings.consolidationCustomApi || 'openai-completions', onChange: (e) => setSetting('consolidationCustomApi', e.target.value) },
5525
+ ['openai-completions', 'openai-responses', 'anthropic-messages'].map((v) => h('option', { key: v, value: v }, v)))),
5526
+ forkCatalog?.discoveryAvailable === true
5527
+ ? h('div', { style: S.row },
5528
+ h(Button, { onClick: discoverConsolidationModels, disabled: forkDiscoverBusy, title: t('consolidationDiscover') },
5529
+ forkDiscoverBusy ? t('loading') : t('consolidationDiscover')),
5530
+ forkDiscoverNote ? h('span', { style: S.muted, role: 'status' }, forkDiscoverNote) : null)
5531
+ : null,
5532
+ h('div', { className: 'dshm-settings-note', style: { ...S.muted, marginTop: 6, lineHeight: 1.55 } }, t('consolidationCustomHint')))
5533
+ }
5534
+ }
5535
+
5536
+ // 页首精简头部:标题 + 一句话说明 + 恢复默认。保存机制保持原样:设置项即时保存
5537
+ //(250ms trailing debounce + pagehide flush),页首不放「保存」按钮——改动落盘
5538
+ // 由 debounce 兜底;「恢复默认」仍是两段确认后调 resetSettings RPC。
5304
5539
  const settingsBlock = h(React.Fragment, null, h(Section, {
5305
5540
  title: t('settingsTuning'),
5306
5541
  right: h('div', { style: { display: 'flex', gap: 6, flexShrink: 0 } },
5307
- h(Button, { onClick: resetSettingsNow, disabled: busy, style: S.ghost }, resetArmed ? t('settingsResetConfirm') : t('settingsReset')),
5308
- h(Button, { onClick: saveSettings, disabled: busy, primary: true }, t('save'))),
5542
+ h(Button, { onClick: resetSettingsNow, disabled: busy, style: S.ghost, title: resetArmed ? t('settingsResetConfirm') : t('settingsReset') }, resetArmed ? t('settingsResetConfirm') : t('settingsReset'))),
5309
5543
  },
5310
- h('div', { className: 'dshm-settings-grid' },
5544
+ h('div', { className: 'dshm-settings-note', style: { ...S.muted, lineHeight: 1.55 } }, t('settingsHeaderNote'))),
5545
+ settingsGroup(t('settingsGroupRecall'), t('settingsGroupRecallDesc'),
5311
5546
  h(Field, { label: t('autoInject') },
5312
5547
  h('select', { style: S.input, value: settings.autoInject || 'smart', onChange: (e) => setSetting('autoInject', e.target.value) },
5313
5548
  ['smart', 'anchor-only', 'per-turn', 'off'].map((v) => h('option', { key: v, value: v }, enumText(t, INJECT_LABELS, v))))),
@@ -5319,8 +5554,6 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
5319
5554
  h(Field, { label: t('globalTopK') }, h('input', { type: 'number', style: S.input, value: settings.globalTopK ?? 5, onChange: (e) => setSetting('globalTopK', Number(e.target.value)) })),
5320
5555
  h(Field, { label: t('crossLibraryRecall') }, h(Toggle, { checked: settings.crossLibraryRecall === true, label: t('crossLibraryRecall'), onChange: value => setSetting('crossLibraryRecall', value) })),
5321
5556
  h('div', { className: 'dshm-settings-note', style: { ...S.muted, marginTop: 6, lineHeight: 1.55 } }, t('crossLibraryRecallHint')),
5322
- h(Field, { label: t('mustRememberCap') }, h('input', { type: 'number', style: S.input, value: settings.mustRememberCap ?? 12, onChange: (e) => setSetting('mustRememberCap', Number(e.target.value)) })),
5323
- h(Field, { label: t('shortTermTtlHours') }, h('input', { type: 'number', min: 0, style: S.input, value: settings.shortTermTtlHours ?? 72, onChange: (e) => setSetting('shortTermTtlHours', Number(e.target.value)) })),
5324
5557
  h(Field, { label: t('anchorTokens') }, h('input', { type: 'number', style: S.input, value: settings.anchorTokens ?? 800, onChange: (e) => setSetting('anchorTokens', Number(e.target.value)) })),
5325
5558
  h(Field, { label: t('turnTokens') }, h('input', { type: 'number', style: S.input, value: settings.turnTokens ?? 800, onChange: (e) => setSetting('turnTokens', Number(e.target.value)) })),
5326
5559
  h(Field, { label: t('injectionTotalTokens') }, h('input', { type: 'number', style: S.input, value: settings.injectionTotalTokens ?? 2000, onChange: (e) => setSetting('injectionTotalTokens', Number(e.target.value)) })),
@@ -5329,35 +5562,50 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
5329
5562
  h(Field, { label: t('minUserChars') }, h('input', { type: 'number', style: S.input, value: settings.minUserChars ?? 6, onChange: (e) => setSetting('minUserChars', Number(e.target.value)) })),
5330
5563
  h(Field, { label: t('relevanceThreshold') }, h('input', { type: 'number', step: '0.05', min: 0, max: 1, style: S.input, value: settings.relevanceThreshold ?? 0.4, onChange: (e) => setSetting('relevanceThreshold', Number(e.target.value)) })),
5331
5564
  h(Field, { label: t('randomCueChance') }, h('input', { type: 'number', step: '0.01', min: 0, max: 1, style: S.input, value: settings.randomCueChance ?? 0.02, onChange: (e) => setSetting('randomCueChance', Number(e.target.value)) })),
5332
- h(Field, { label: t('openLoopRemindDays') }, h('input', { type: 'number', min: 1, max: 365, style: S.input, value: settings.openLoopRemindDays ?? 7, onChange: (e) => setSetting('openLoopRemindDays', Number(e.target.value)) })),
5333
5565
  h(Field, { label: t('freshnessHint') }, h(Toggle, { checked: settings.freshnessHint !== false, label: t('freshnessHint'), onChange: value => setSetting('freshnessHint', value) })),
5334
5566
  h(Field, { label: t('freshnessDays') }, h('input', { type: 'number', min: 1, max: 3650, style: S.input, value: settings.freshnessDays ?? 30, onChange: (e) => setSetting('freshnessDays', Number(e.target.value)) })),
5335
5567
  h('div', { className: 'dshm-settings-note', style: { ...S.muted, marginTop: 6, lineHeight: 1.55 } }, t('freshnessHintHint')),
5568
+ h(Field, { label: t('habitsInjection') }, h('input', { type: 'checkbox', checked: settings.habitsInjection !== false, onChange: (e) => setSetting('habitsInjection', e.target.checked) }))),
5569
+ settingsGroup(t('settingsGroupLifecycle'), t('settingsGroupLifecycleDesc'),
5570
+ h(Field, { label: t('mustRememberCap') }, h('input', { type: 'number', style: S.input, value: settings.mustRememberCap ?? 12, onChange: (e) => setSetting('mustRememberCap', Number(e.target.value)) })),
5571
+ h(Field, { label: t('shortTermTtlHours') }, h('input', { type: 'number', min: 0, style: S.input, value: settings.shortTermTtlHours ?? 72, onChange: (e) => setSetting('shortTermTtlHours', Number(e.target.value)) })),
5572
+ h(Field, { label: t('openLoopRemindDays') }, h('input', { type: 'number', min: 1, max: 365, style: S.input, value: settings.openLoopRemindDays ?? 7, onChange: (e) => setSetting('openLoopRemindDays', Number(e.target.value)) })),
5573
+ h(Field, { label: t('purgeArchivedAfterDays') }, h('input', { type: 'number', min: 0, style: S.input, value: settings.purgeArchivedAfterDays ?? 0, onChange: (e) => setSetting('purgeArchivedAfterDays', Number(e.target.value)) }))),
5574
+ settingsGroup(t('settingsGroupCuration'), t('settingsGroupCurationDesc'),
5575
+ h(Field, { label: t('sleepConsolidation') }, h('input', { type: 'checkbox', checked: settings.sleepConsolidation === true, onChange: (e) => setSetting('sleepConsolidation', e.target.checked) })),
5576
+ h(Field, { label: t('sleepAfterIdleMinutes') }, h('input', { type: 'number', min: 1, style: S.input, value: settings.sleepAfterIdleMinutes ?? 2, onChange: (e) => setSetting('sleepAfterIdleMinutes', Number(e.target.value)) })),
5577
+ h(Field, { label: t('autoCurateEveryHours') }, h('input', { type: 'number', min: 0, style: S.input, value: settings.autoCurateEveryHours ?? 0, onChange: (e) => setSetting('autoCurateEveryHours', Number(e.target.value)) })),
5578
+ h(Field, { label: t('autoCurateSessionLimit') }, h('input', { type: 'number', min: 1, max: 30, style: S.input, value: settings.autoCurateSessionLimit ?? 8, onChange: (e) => setSetting('autoCurateSessionLimit', Number(e.target.value)) })),
5579
+ h(Field, { label: t('consolidationModelMode') },
5580
+ h('select', { style: S.input, value: consolidationMode, onChange: (e) => setSetting('consolidationModelMode', e.target.value) },
5581
+ h('option', { value: 'inherit' }, t('consolidationModeInherit')),
5582
+ h('option', { value: 'host' }, t('consolidationModeHost')),
5583
+ h('option', { value: 'custom' }, t('consolidationModeCustom')))),
5584
+ ...consolidationModelRows,
5585
+ h(Field, { label: t('curatorModel') }, h('input', { type: 'text', style: S.input, placeholder: 'provider/model', value: settings.curatorModel || '', onChange: (e) => setSetting('curatorModel', e.target.value || null) })),
5586
+ h('div', { className: 'dshm-settings-note', style: { ...S.muted, marginTop: 6, lineHeight: 1.55 } }, t('curatorModelHint')),
5336
5587
  h(Field, { label: t('salientWake') },
5337
5588
  h('select', { style: S.input, value: settings.salientWake || 'off', onChange: (e) => setSetting('salientWake', e.target.value) },
5338
5589
  h('option', { value: 'off' }, t('salientWakeOff')),
5339
5590
  h('option', { value: 'schedule' }, t('salientWakeSchedule')))),
5340
5591
  h(Field, { label: t('salientWakeHour') }, h('input', { type: 'time', style: S.input, value: settings.salientWakeHour || '09:00', onChange: (e) => setSetting('salientWakeHour', e.target.value) })),
5341
5592
  h(Field, { label: t('salientWakeTimeZone') }, h('input', { type: 'text', style: S.input, placeholder: 'Asia/Shanghai', value: settings.salientWakeTimeZone || '', onChange: (e) => setSetting('salientWakeTimeZone', e.target.value) })),
5342
- h('div', { className: 'dshm-settings-note', style: { ...S.muted, marginTop: 6, lineHeight: 1.55 } }, t('salientWakeHint')),
5343
- h(Field, { label: t('autoInstall') }, h('input', { type: 'checkbox', checked: settings.autoInstallEngine !== false, onChange: (e) => setSetting('autoInstallEngine', e.target.checked) })),
5593
+ h('div', { className: 'dshm-settings-note', style: { ...S.muted, marginTop: 6, lineHeight: 1.55 } }, t('salientWakeHint'))),
5594
+ settingsGroup(t('settingsGroupEngine'), t('settingsGroupEngineDesc'),
5595
+ h(Field, { label: t('memoryMode') },
5596
+ h('select', { style: S.input, value: settings.memoryMode || 'local', onChange: (e) => setSetting('memoryMode', e.target.value) },
5597
+ ['local', 'cloud'].map((v) => h('option', { key: v, value: v }, v)))),
5598
+ h('div', { className: 'dshm-settings-note', style: { ...S.muted, marginTop: 6, lineHeight: 1.55 } }, t('memoryModeHint')),
5599
+ h(Field, { label: t('autoInstall') }, h('input', { type: 'checkbox', checked: settings.autoInstallEngine !== false, onChange: (e) => setSetting('autoInstallEngine', e.target.checked) }))),
5600
+ settingsGroup(t('settingsGroupSession'), t('settingsGroupSessionDesc'),
5344
5601
  h(Field, { label: t('newSessionPrompt') }, h('input', { type: 'checkbox', checked: settings.newSessionPromptDismissed !== true, onChange: (e) => setSetting('newSessionPromptDismissed', !e.target.checked) })),
5345
- h(Field, { label: t('habitsInjection') }, h('input', { type: 'checkbox', checked: settings.habitsInjection !== false, onChange: (e) => setSetting('habitsInjection', e.target.checked) })),
5346
5602
  h(Field, { label: t('sidebarSettings') }, h(Toggle, { checked: settings.sidebarSettings === true, label: t('sidebarSettings'), onChange: value => setSetting('sidebarSettings', value) })),
5347
- h(Field, { label: t('visionCaptionEnabled') }, h(Toggle, { checked: settings.visionCaptionEnabled === true, label: t('visionCaptionEnabled'), onChange: value => setSetting('visionCaptionEnabled', value) })),
5603
+ h(Field, { label: t('visionCaptionEnabled') }, h(Toggle, { checked: settings.visionCaptionEnabled === true, label: t('visionCaptionEnabled'), onChange: value => setSetting('visionCaptionEnabled', value) }))),
5604
+ settingsGroup(t('settingsGroupIntegration'), t('settingsGroupIntegrationDesc'),
5348
5605
  h(Field, { label: t('inboundToolNames') }, h(InboundToolsInput, {
5349
5606
  names: settings.inboundToolNames || [], onChange: values => setSetting('inboundToolNames', values),
5350
- })),
5351
- h(Field, { label: t('sleepConsolidation') }, h('input', { type: 'checkbox', checked: settings.sleepConsolidation === true, onChange: (e) => setSetting('sleepConsolidation', e.target.checked) })),
5352
- h(Field, { label: t('sleepAfterIdleMinutes') }, h('input', { type: 'number', min: 1, style: S.input, value: settings.sleepAfterIdleMinutes ?? 2, onChange: (e) => setSetting('sleepAfterIdleMinutes', Number(e.target.value)) })),
5353
- h(Field, { label: t('autoCurateEveryHours') }, h('input', { type: 'number', min: 0, style: S.input, value: settings.autoCurateEveryHours ?? 0, onChange: (e) => setSetting('autoCurateEveryHours', Number(e.target.value)) })),
5354
- h(Field, { label: t('autoCurateSessionLimit') }, h('input', { type: 'number', min: 1, max: 30, style: S.input, value: settings.autoCurateSessionLimit ?? 8, onChange: (e) => setSetting('autoCurateSessionLimit', Number(e.target.value)) })),
5355
- h(Field, { label: t('purgeArchivedAfterDays') }, h('input', { type: 'number', min: 0, style: S.input, value: settings.purgeArchivedAfterDays ?? 0, onChange: (e) => setSetting('purgeArchivedAfterDays', Number(e.target.value)) })),
5356
- h(Field, { label: t('memoryMode') },
5357
- h('select', { style: S.input, value: settings.memoryMode || 'local', onChange: (e) => setSetting('memoryMode', e.target.value) },
5358
- ['local', 'cloud'].map((v) => h('option', { key: v, value: v }, v)))),
5359
- h('div', { className: 'dshm-settings-note', style: { ...S.muted, marginTop: 6, lineHeight: 1.55 } }, t('memoryModeHint')))),
5360
- h(Section, { title: t('visionService') }, h(VisionConfigPanel, { call, config: state.visionConfig, t })))
5607
+ }))),
5608
+ h(Section, { title: t('visionService') }, h(VisionConfigPanel, { call, config: state.visionConfig, t })))
5361
5609
 
5362
5610
  const renderLibraryItem = (lib) => h('div', { key: lib.id, style: S.item },
5363
5611
  h('div', { style: { display: 'flex', justifyContent: 'space-between', gap: 8, alignItems: 'center' } },