dsh-memu-memory 1.2.2 → 1.2.4
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/AGENTS.md +4 -1
- package/README.md +12 -16
- package/README.zh.md +13 -17
- package/docs/client-conventions.md +2 -0
- package/docs/contributing.md +7 -6
- package/docs/emotion-model-spec.md +2 -2
- package/docs/env-and-commands.md +63 -1
- package/docs/host-api.md +19 -0
- package/docs/memory-semantics.md +10 -1
- package/docs/troubleshooting.md +77 -3
- package/lib/activity-log.js +1 -1
- package/lib/binding-diagnostics.js +1 -1
- package/lib/client.js +223 -19
- package/lib/cycle.js +9 -1
- package/lib/embedding-catalog.js +416 -138
- package/lib/embedding-download.js +36 -11
- package/lib/freshness.js +97 -0
- package/lib/graph.js +244 -2
- package/lib/inject.js +218 -11
- package/lib/local-embedding-manager.js +3 -2
- package/lib/local-embedding-protocol.js +40 -3
- package/lib/local-embedding-worker.js +36 -6
- package/lib/local-vector-service.js +18 -4
- package/lib/memory.js +83 -17
- package/lib/memu.js +15 -7
- package/lib/private.js +25 -5
- package/lib/rpc.js +17 -3
- package/lib/salient-wake.js +402 -0
- package/lib/state.js +173 -1
- package/package.json +3 -2
- package/scripts/drive-session.mjs +864 -0
- package/scripts/mock-llm.mjs +903 -0
- package/scripts/simulate-injection.mjs +298 -0
- package/tests/client-render.test.mjs +69 -2
- package/tests/consolidation-fork.test.mjs +14 -1
- package/tests/drive-session.test.mjs +152 -0
- package/tests/embedding-catalog.test.mjs +116 -8
- package/tests/embedding-download.test.mjs +97 -2
- package/tests/embedding-runtime.test.mjs +21 -13
- package/tests/entity-merge.test.mjs +261 -0
- package/tests/fixtures/mock-llm/reply.txt +1 -0
- package/tests/freshness.test.mjs +140 -0
- package/tests/help-page.test.mjs +4 -4
- package/tests/injection-chain.test.mjs +176 -0
- package/tests/injection-rollback.test.mjs +230 -0
- package/tests/local-embedding-env.test.mjs +51 -0
- package/tests/local-embedding-manager.test.mjs +18 -0
- package/tests/local-embedding-protocol.test.mjs +28 -2
- package/tests/local-embedding-worker.test.mjs +94 -0
- package/tests/mock-llm.test.mjs +225 -0
- package/tests/open-loop-date.test.mjs +406 -0
- package/tests/salient-wake.test.mjs +362 -0
- package/tests/settings-plumbing.test.mjs +76 -0
- package/tests/sidebar.test.mjs +5 -1
- package/tests/simulate-injection.test.mjs +76 -0
- package/tests/stubs/dsh-schedule.js +105 -0
- package/tests/vector-profile.test.mjs +28 -4
- package/tests/webui-auth.test.mjs +4 -0
package/lib/client.js
CHANGED
|
@@ -132,10 +132,15 @@ window.__ModuleLoader__.load({
|
|
|
132
132
|
logKindError: '错误',
|
|
133
133
|
logKindSystem: '系统',
|
|
134
134
|
logKindCheck: '主动检查',
|
|
135
|
+
logKindWake: '日期唤醒',
|
|
135
136
|
logClear: '清空日志',
|
|
136
137
|
runLogTitle: '整理记录',
|
|
137
138
|
runLogEmpty: '还没有整理记录。',
|
|
138
139
|
runLogOpen: '全部日志',
|
|
140
|
+
logStateFailed: '失败',
|
|
141
|
+
logStateFailedHint: '这一条是失败或超时:原因见正文。整理超时会自动退避重试,超时前已写入的记忆会保留。',
|
|
142
|
+
logDegraded: '降级',
|
|
143
|
+
logDegradedHint: '没有失败,但走了退路(例如向量未激活、自动关联跳过)。',
|
|
139
144
|
dedupedNotice: '未写入:库里已有几乎相同的记忆 [{id}]。要补充内容请在原条目上编辑合并;确属两次独立观测时才需要 allow_duplicate 重写。',
|
|
140
145
|
consolidateFeedTitle: '整理提醒',
|
|
141
146
|
consolidateFailedCol: '失败',
|
|
@@ -172,6 +177,15 @@ window.__ModuleLoader__.load({
|
|
|
172
177
|
viewMemory: '查看此记忆',
|
|
173
178
|
entityDelete: '删除实体',
|
|
174
179
|
entityDeleteForceHint: '仍被记忆或关系引用;再点一次将连同引用一起删除',
|
|
180
|
+
entityMergeTitle: '合并候选',
|
|
181
|
+
entityMergeHint: '写法相近的实体只是建议,不会自动合并。合并后来源实体的记忆链接改指主节点,别名并入,来源实体消失;记忆本身不删除。',
|
|
182
|
+
entityMergeAction: '合并',
|
|
183
|
+
entityMergeConfirm: '确认合并',
|
|
184
|
+
entityMergeDone: '已把「{from}」并入「{to}」:{links} 条记忆链接改指,别名共 {aliases} 个',
|
|
185
|
+
entityMergeDropped: '({n} 个别名超出上限,未并入)',
|
|
186
|
+
entityMergeConflict: '({n} 条关系快照与主节点侧冲突,保留主节点侧)',
|
|
187
|
+
mergeReasonContainment: '名称包含',
|
|
188
|
+
mergeReasonDistance: '写法相近',
|
|
175
189
|
openMemu: '打开 MemU WebUI',
|
|
176
190
|
saved: '已保存',
|
|
177
191
|
copied: '已复制',
|
|
@@ -270,6 +284,16 @@ window.__ModuleLoader__.load({
|
|
|
270
284
|
globalEveryNTurns: '全局每 N 轮',
|
|
271
285
|
minUserChars: '最短用户消息',
|
|
272
286
|
randomCueChance: '随机侧事件概率',
|
|
287
|
+
openLoopRemindDays: '未了之事复提间隔(天)',
|
|
288
|
+
freshnessHint: '时效提示',
|
|
289
|
+
freshnessDays: '写够多久算过时(天)',
|
|
290
|
+
freshnessHintHint: '召回里有条目带时间敏感信号时,在块尾提示模型先核实再回答「现在怎样」。',
|
|
291
|
+
salientWake: '日期到点唤醒',
|
|
292
|
+
salientWakeOff: '关闭(只被动注入)',
|
|
293
|
+
salientWakeSchedule: '到点唤醒会话',
|
|
294
|
+
salientWakeHour: '唤醒时间(HH:mm)',
|
|
295
|
+
salientWakeTimeZone: '唤醒时区(留空跟随系统)',
|
|
296
|
+
salientWakeHint: '实验特性,默认关闭。唤醒走宿主定时任务投递,会替会话开一整轮;只有宿主进程活着才会触发,任务在宿主的定时任务界面可见、可手动删除。还没做过真机验收,建议先在测试库里试开。',
|
|
273
297
|
autoInstall: '自动安装引擎',
|
|
274
298
|
sleepConsolidation: '空闲后整理记忆',
|
|
275
299
|
sleepAfterIdleMinutes: '空闲多久后整理(分钟)',
|
|
@@ -312,6 +336,13 @@ window.__ModuleLoader__.load({
|
|
|
312
336
|
salientDateLabel: '日期(MM-DD 每年复现,YYYY-MM-DD 一次性)',
|
|
313
337
|
salientDatePlaceholder: '例如 10-29 或 2026-10-29,留空则不设日期',
|
|
314
338
|
moodTag: '情绪',
|
|
339
|
+
arousalLabel: '激活',
|
|
340
|
+
dominanceLabel: '掌控',
|
|
341
|
+
emotionSourceLabel: '来源',
|
|
342
|
+
emotionSourceModel: '模型标注',
|
|
343
|
+
emotionSourceSession: '会话心情',
|
|
344
|
+
emotionSourceContent: '正文识别',
|
|
345
|
+
emotionSourceUnknown: '未知',
|
|
315
346
|
reviews: '待复核',
|
|
316
347
|
reviewsEmpty: '没有等待复核的记忆。',
|
|
317
348
|
reviewScopePrivate: '私有库',
|
|
@@ -391,6 +422,8 @@ window.__ModuleLoader__.load({
|
|
|
391
422
|
managedVectorRuntimeInstall: '下载运行时',
|
|
392
423
|
managedVectorRuntimeTitle: '运行环境',
|
|
393
424
|
managedVectorModelsTitle: '模型',
|
|
425
|
+
managedVectorSource: '下载来源',
|
|
426
|
+
managedVectorSourceHint: '同一个固定 commit 的同一批文件;换来源不改向量空间——每个文件都要过目录里 pin 住的 sha256。',
|
|
394
427
|
managedVectorReady: '已就绪',
|
|
395
428
|
vectorRebuildTitle: '重建进度',
|
|
396
429
|
vectorStagePreparing: '准备中',
|
|
@@ -819,6 +852,8 @@ window.__ModuleLoader__.load({
|
|
|
819
852
|
helpFaq9A: '不会。会话被删除后,空闲整理扫描会把它标记为 sessionGone 并跳过,只记一条 check 级日志,不反复重试,也不影响其他会话的整理。',
|
|
820
853
|
helpFaq10: '本地向量模型未激活怎么办?',
|
|
821
854
|
helpFaq10A: '没有 active 向量代际时会回退词法检索,仍可用但语义更弱。「当前已入向量库 N 条」指 active 代际里的条数;切换模型或修复失败后要重建,旧代际在重建期间只读,失败不会动当前代际,可再点一次续建。',
|
|
855
|
+
helpFaq11: '对话里为什么会主动提「那个日子已经过了」或「这条可能过时了」?',
|
|
856
|
+
helpFaq11A: '三种情况都来自记忆本身,不是模型即兴:① 带 `YYYY-MM-DD` 的未了之事过期后,会按「未了之事复提间隔」(默认 7 天)重新提一次,同一天不重复,也没日期的承诺仍是提过一次就安静;② 召回里有时效信号的条目(日期已过、标题带「最新/价格/版本」这类词、或写得够久)会让注入块尾多一行提示,让模型在会话有搜索工具时先核实——它不声称工具一定存在;③「日期到点唤醒」是**实验特性**且默认关闭,打开后宿主会在日子当天用定时任务让会话开一轮,那种回合不跑常规召回,所以只带着那条日期说话。三者都只是提示:不自动写记忆、不自动关闭约定,也不自动删除任何东西。',
|
|
822
857
|
helpFeedback: '反馈',
|
|
823
858
|
helpOpenIssue: '提交 Issue',
|
|
824
859
|
helpCopyDiagnostics: '复制诊断信息',
|
|
@@ -851,10 +886,15 @@ window.__ModuleLoader__.load({
|
|
|
851
886
|
logKindError: 'Error',
|
|
852
887
|
logKindSystem: 'System',
|
|
853
888
|
logKindCheck: 'Check',
|
|
889
|
+
logKindWake: 'Date wake',
|
|
854
890
|
logClear: 'Clear log',
|
|
855
891
|
runLogTitle: 'Runs',
|
|
856
892
|
runLogEmpty: 'No runs recorded yet.',
|
|
857
893
|
runLogOpen: 'All logs',
|
|
894
|
+
logStateFailed: 'Failed',
|
|
895
|
+
logStateFailedHint: 'This row failed or timed out; the reason is in the message. Timed-out consolidation retries itself with backoff, and memories written before the timeout are kept.',
|
|
896
|
+
logDegraded: 'Degraded',
|
|
897
|
+
logDegradedHint: 'Not a failure — a fallback path was taken (e.g. no active vector generation, auto-link skipped).',
|
|
858
898
|
dedupedNotice: 'Not written: the library already holds a near-identical memory [{id}]. Edit and merge into that entry instead; pass allow_duplicate only for two genuinely independent observations.',
|
|
859
899
|
consolidateFeedTitle: 'Consolidation alerts',
|
|
860
900
|
consolidateFailedCol: 'Failed',
|
|
@@ -891,6 +931,15 @@ window.__ModuleLoader__.load({
|
|
|
891
931
|
viewMemory: 'View',
|
|
892
932
|
entityDelete: 'Delete entity',
|
|
893
933
|
entityDeleteForceHint: 'Still referenced by memories or relations; click again to delete with its links',
|
|
934
|
+
entityMergeTitle: 'Merge candidates',
|
|
935
|
+
entityMergeHint: 'Similar spellings are only suggestions and are never merged automatically. Merging redirects the source entity memory links to the main node, folds its aliases in, and drops the source entity; memories themselves are never deleted.',
|
|
936
|
+
entityMergeAction: 'Merge',
|
|
937
|
+
entityMergeConfirm: 'Confirm merge',
|
|
938
|
+
entityMergeDone: 'Merged "{from}" into "{to}": {links} memory links redirected, {aliases} aliases in total',
|
|
939
|
+
entityMergeDropped: '({n} aliases over the cap were not folded in)',
|
|
940
|
+
entityMergeConflict: '({n} relationship snapshots clashed with the target side and were dropped)',
|
|
941
|
+
mergeReasonContainment: 'Name contained',
|
|
942
|
+
mergeReasonDistance: 'Similar spelling',
|
|
894
943
|
openMemu: 'Open MemU WebUI',
|
|
895
944
|
saved: 'Saved',
|
|
896
945
|
copied: 'Copied',
|
|
@@ -989,6 +1038,16 @@ window.__ModuleLoader__.load({
|
|
|
989
1038
|
globalEveryNTurns: 'Global every N turns',
|
|
990
1039
|
minUserChars: 'Min user chars',
|
|
991
1040
|
randomCueChance: 'Random cue chance',
|
|
1041
|
+
openLoopRemindDays: 'Re-remind open loops every N days',
|
|
1042
|
+
freshnessHint: 'Freshness hint',
|
|
1043
|
+
freshnessDays: 'Age treated as stale (days)',
|
|
1044
|
+
freshnessHintHint: 'When recalled entries carry time-sensitive signals, add one line telling the model to verify before answering about the present.',
|
|
1045
|
+
salientWake: 'Wake on salient dates',
|
|
1046
|
+
salientWakeOff: 'Off (passive injection only)',
|
|
1047
|
+
salientWakeSchedule: 'Wake the conversation',
|
|
1048
|
+
salientWakeHour: 'Wake time (HH:mm)',
|
|
1049
|
+
salientWakeTimeZone: 'Wake time zone (empty = system)',
|
|
1050
|
+
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.',
|
|
992
1051
|
autoInstall: 'Auto-install engine',
|
|
993
1052
|
sleepConsolidation: 'Consolidate after idle',
|
|
994
1053
|
sleepAfterIdleMinutes: 'Idle minutes before consolidating',
|
|
@@ -1031,6 +1090,13 @@ window.__ModuleLoader__.load({
|
|
|
1031
1090
|
salientDateLabel: 'Date (MM-DD recurs yearly, YYYY-MM-DD is one-off)',
|
|
1032
1091
|
salientDatePlaceholder: 'e.g. 10-29 or 2026-10-29; empty for no date',
|
|
1033
1092
|
moodTag: 'mood',
|
|
1093
|
+
arousalLabel: 'arousal',
|
|
1094
|
+
dominanceLabel: 'dominance',
|
|
1095
|
+
emotionSourceLabel: 'source',
|
|
1096
|
+
emotionSourceModel: 'model',
|
|
1097
|
+
emotionSourceSession: 'session',
|
|
1098
|
+
emotionSourceContent: 'content',
|
|
1099
|
+
emotionSourceUnknown: 'unknown',
|
|
1034
1100
|
reviews: 'Awaiting review',
|
|
1035
1101
|
reviewsEmpty: 'No memories are waiting for review.',
|
|
1036
1102
|
reviewScopePrivate: 'private library',
|
|
@@ -1109,6 +1175,8 @@ window.__ModuleLoader__.load({
|
|
|
1109
1175
|
managedVectorRuntimeUnsupported: 'No verified runtime artifacts for this platform',
|
|
1110
1176
|
managedVectorRuntimeInstall: 'Download runtime',
|
|
1111
1177
|
managedVectorRuntimeTitle: 'Runtime',
|
|
1178
|
+
managedVectorSource: 'Download source',
|
|
1179
|
+
managedVectorSourceHint: 'The same files from one pinned commit. Switching source does not change the vector space: every file is verified against the sha256 pinned in the catalog.',
|
|
1112
1180
|
managedVectorModelsTitle: 'Models',
|
|
1113
1181
|
managedVectorReady: 'Ready',
|
|
1114
1182
|
vectorRebuildTitle: 'Rebuild progress',
|
|
@@ -1537,6 +1605,8 @@ window.__ModuleLoader__.load({
|
|
|
1537
1605
|
helpFaq9A: 'No. Once a conversation is deleted, the idle sweep marks it sessionGone and skips it, records a check-level log instead of an error, and does not retry forever or affect other conversations.',
|
|
1538
1606
|
helpFaq10: 'The vector model is inactive — what happens?',
|
|
1539
1607
|
helpFaq10A: 'Recall falls back to lexical search: still usable, weaker semantically. "Currently indexed N items" counts the active generation. Switching models or repairing a failure requires a rebuild; the old generation stays read-only during it, a failed rebuild leaves the active generation unchanged, and pressing again resumes.',
|
|
1608
|
+
helpFaq11: 'Why does the conversation bring up "that date already passed" or "this may be out of date"?',
|
|
1609
|
+
helpFaq11A: 'All three cases come from the memories themselves, not the model improvising: (1) an open loop whose `YYYY-MM-DD` has passed is raised again on the "re-remind every N days" cadence (default 7), never twice on one day, while undated promises stay quiet after their first mention; (2) recalled entries with time-sensitive signals (a past date, wording like "latest / price / version", or enough age) append one line to the recall block telling the model to verify first if the conversation has a search tool — it never claims the tool exists; (3) date wake-up is an experimental switch and off by default: with it enabled the host scheduler opens a turn on the day itself, and that turn runs no normal recall, so it only carries that date. All three are hints: nothing is written automatically, no commitment is closed automatically, nothing is deleted.',
|
|
1540
1610
|
helpFeedback: 'Feedback',
|
|
1541
1611
|
helpOpenIssue: 'Open an issue',
|
|
1542
1612
|
helpCopyDiagnostics: 'Copy diagnostics',
|
|
@@ -1752,6 +1822,9 @@ window.__ModuleLoader__.load({
|
|
|
1752
1822
|
.dshm-card:hover{transform:translateY(-2px);box-shadow:0 10px 28px -12px rgba(0,0,0,.28)}
|
|
1753
1823
|
.dshm-rise{animation:dshm-rise-in .34s cubic-bezier(.22,1,.36,1) both;animation-delay:calc(var(--d,0) * 38ms)}
|
|
1754
1824
|
.dshm-card-head{display:flex;align-items:flex-start;gap:11px}
|
|
1825
|
+
.dshm-logrow.is-failed{border-left:2px solid var(--dsw-alias-label-error,#c0392b);background:color-mix(in srgb,var(--dsw-alias-label-error,#c0392b) 7%,transparent)}
|
|
1826
|
+
.dshm-logrow.is-failed .dshm-logmsg{color:var(--dsw-alias-label-error,#c0392b)}
|
|
1827
|
+
.dshm-logrow.is-degraded{border-left:2px solid var(--dsw-alias-label-warning,#b7791f)}
|
|
1755
1828
|
.dshm-card-ico{width:32px;height:32px;flex:none;border-radius:10px;display:grid;place-items:center;color:var(--dsw-alias-brand-primary,#2563eb);background:color-mix(in srgb,var(--dsw-alias-brand-primary,#2563eb) 12%,transparent)}
|
|
1756
1829
|
.dshm-card-title{font-size:13.5px;font-weight:600;line-height:1.3}
|
|
1757
1830
|
.dshm-card-sub{margin-top:3px;font-size:11.5px;line-height:1.5;color:var(--dsw-alias-label-secondary,rgba(127,127,127,.8));max-width:60ch}
|
|
@@ -2214,17 +2287,56 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
2214
2287
|
.join('/')
|
|
2215
2288
|
}
|
|
2216
2289
|
|
|
2290
|
+
const EMOTION_SOURCE_LABELS = {
|
|
2291
|
+
model: 'emotionSourceModel',
|
|
2292
|
+
session: 'emotionSourceSession',
|
|
2293
|
+
content: 'emotionSourceContent',
|
|
2294
|
+
unknown: 'emotionSourceUnknown',
|
|
2295
|
+
}
|
|
2296
|
+
// Read-only affect metadata. Old entries have no arousal/dominance at all; do
|
|
2297
|
+
// not infer them from valence, and do not show a lone source line.
|
|
2298
|
+
function emotionMetaText(entry, t) {
|
|
2299
|
+
const arousal = typeof entry?.arousal === 'number' && Number.isFinite(entry.arousal) ? entry.arousal : null
|
|
2300
|
+
const dominance = typeof entry?.dominance === 'number' && Number.isFinite(entry.dominance) ? entry.dominance : null
|
|
2301
|
+
if (arousal === null && dominance === null) return ''
|
|
2302
|
+
const parts = []
|
|
2303
|
+
if (arousal !== null) parts.push(`${t('arousalLabel')} ${arousal.toFixed(1)}`)
|
|
2304
|
+
if (dominance !== null) parts.push(`${t('dominanceLabel')} ${dominance > 0 ? '+' : ''}${dominance.toFixed(1)}`)
|
|
2305
|
+
if (entry?.emotionSource) {
|
|
2306
|
+
parts.push(`${t('emotionSourceLabel')} ${t(EMOTION_SOURCE_LABELS[entry.emotionSource] || 'emotionSourceUnknown')}`)
|
|
2307
|
+
}
|
|
2308
|
+
return parts.join(' · ')
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2217
2311
|
// Tags are labels, not decoration — except when the label is a warning. A memory
|
|
2218
2312
|
// marked "never say out loud" has to look different from one that can be said,
|
|
2219
2313
|
// otherwise the badge is just more grey text to skim past.
|
|
2220
2314
|
const TAG_TONES = {
|
|
2221
2315
|
warn: { color: V.warn, background: 'color-mix(in srgb, currentColor 12%, transparent)' },
|
|
2316
|
+
danger: { color: V.danger, background: 'color-mix(in srgb, currentColor 12%, transparent)' },
|
|
2222
2317
|
info: { color: V.accent, background: V.accentSoft },
|
|
2223
2318
|
}
|
|
2224
2319
|
|
|
2225
|
-
function Tag({ children, tone }) {
|
|
2320
|
+
function Tag({ children, tone, title }) {
|
|
2226
2321
|
const style = tone && TAG_TONES[tone] ? { ...S.tag, ...TAG_TONES[tone] } : S.tag
|
|
2227
|
-
return h('span', { style }, children)
|
|
2322
|
+
return h('span', { style, title }, children)
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2325
|
+
// 活动日志行的三档状态。失败 = ok=false 或 level=error;level=warn 而 ok 不为 false
|
|
2326
|
+
// 是「降级」(向量未激活、自动关联跳过),不能跟失败同色——真失败会被降级噪声淹没。
|
|
2327
|
+
// 只看 level==='error' 会漏:整理超时记的是 warn + ok=false(lib/private.js 的超时路径)。
|
|
2328
|
+
function logRowState(row) {
|
|
2329
|
+
if (!row || typeof row !== 'object') return null
|
|
2330
|
+
if (row.ok === false || row.level === 'error') return 'failed'
|
|
2331
|
+
if (row.level === 'warn') return 'degraded'
|
|
2332
|
+
return null
|
|
2333
|
+
}
|
|
2334
|
+
function logRowClass(row) {
|
|
2335
|
+
const state = logRowState(row)
|
|
2336
|
+
return state ? `dshm-logrow is-${state}` : 'dshm-logrow'
|
|
2337
|
+
}
|
|
2338
|
+
function logMessageClass(row) {
|
|
2339
|
+
return logRowState(row) === 'failed' ? 'dshm-logmsg' : undefined
|
|
2228
2340
|
}
|
|
2229
2341
|
|
|
2230
2342
|
// The host lists untitled sessions (renamed title events are async), so fall
|
|
@@ -2499,6 +2611,10 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
2499
2611
|
const [armed, setArmed] = React.useState('')
|
|
2500
2612
|
// deleteEntity 被后端拒绝(仍被引用)的实体 id:此时再点确认升级为 force。
|
|
2501
2613
|
const [deleteRefused, setDeleteRefused] = React.useState('')
|
|
2614
|
+
// 工单 F:实体合并候选。后端只出建议,合并必须由用户逐条确认;候选读失败不影响
|
|
2615
|
+
// 图谱其余部分,所以单独 catch 成空列表。
|
|
2616
|
+
const [merges, setMerges] = React.useState([])
|
|
2617
|
+
const [mergeNotice, setMergeNotice] = React.useState('')
|
|
2502
2618
|
const [error, setError] = React.useState('')
|
|
2503
2619
|
const requestId = React.useRef(0)
|
|
2504
2620
|
const mounted = React.useRef(true)
|
|
@@ -2508,12 +2624,13 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
2508
2624
|
}, [])
|
|
2509
2625
|
const refresh = React.useCallback(async () => {
|
|
2510
2626
|
const id = ++requestId.current
|
|
2511
|
-
const [next, list] = await Promise.all([
|
|
2627
|
+
const [next, list, suggested] = await Promise.all([
|
|
2512
2628
|
call('getGraph', { libraryId, focusId: focus || null, depth: 2, limit: 200 }),
|
|
2513
2629
|
call('listEntities', { libraryId }),
|
|
2630
|
+
call('suggestEntityMerges', { libraryId }).catch(() => null),
|
|
2514
2631
|
])
|
|
2515
2632
|
if (mounted.current && id === requestId.current) {
|
|
2516
|
-
setGraph(next); setEntities(list.items || []); setError('')
|
|
2633
|
+
setGraph(next); setEntities(list.items || []); setMerges(suggested?.items || []); setError('')
|
|
2517
2634
|
}
|
|
2518
2635
|
}, [call, libraryId, focus])
|
|
2519
2636
|
React.useEffect(() => {
|
|
@@ -2531,6 +2648,12 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
2531
2648
|
const timer = setTimeout(() => setError(''), 2600)
|
|
2532
2649
|
return () => clearTimeout(timer)
|
|
2533
2650
|
}, [error])
|
|
2651
|
+
// 合并影响面要说清"多少条链接改了指向",比普通错误停留更久。
|
|
2652
|
+
React.useEffect(() => {
|
|
2653
|
+
if (!mergeNotice) return undefined
|
|
2654
|
+
const timer = setTimeout(() => setMergeNotice(''), 9000)
|
|
2655
|
+
return () => clearTimeout(timer)
|
|
2656
|
+
}, [mergeNotice])
|
|
2534
2657
|
const act = async (method, payload) => {
|
|
2535
2658
|
try {
|
|
2536
2659
|
await call(method, { libraryId, ...payload })
|
|
@@ -2538,6 +2661,28 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
2538
2661
|
if (mounted.current) await refresh()
|
|
2539
2662
|
} catch (error) { if (mounted.current) setError(String(error.message || error)) }
|
|
2540
2663
|
}
|
|
2664
|
+
const entityLabel = (id) => {
|
|
2665
|
+
const found = entities.find(item => item.id === id)
|
|
2666
|
+
return found ? (found.name || found.id) : id
|
|
2667
|
+
}
|
|
2668
|
+
const doMerge = async (item) => {
|
|
2669
|
+
try {
|
|
2670
|
+
const result = await call('mergeEntities', { libraryId, targetId: item.targetId, sourceIds: [item.sourceId] })
|
|
2671
|
+
let message = t('entityMergeDone')
|
|
2672
|
+
.replace('{from}', entityLabel(item.sourceId))
|
|
2673
|
+
.replace('{to}', entityLabel(item.targetId))
|
|
2674
|
+
.replace('{links}', String(result?.remappedLinks ?? 0))
|
|
2675
|
+
.replace('{aliases}', String((result?.aliases || []).length))
|
|
2676
|
+
const dropped = (result?.droppedAliases || []).length
|
|
2677
|
+
if (dropped) message += ' ' + t('entityMergeDropped').replace('{n}', String(dropped))
|
|
2678
|
+
const conflicts = (result?.relationships?.conflicts || []).length
|
|
2679
|
+
if (conflicts) message += ' ' + t('entityMergeConflict').replace('{n}', String(conflicts))
|
|
2680
|
+
setArmed('')
|
|
2681
|
+
setMergeNotice(message)
|
|
2682
|
+
notifyMemoryWrite('relation', libraryId)
|
|
2683
|
+
if (mounted.current) await refresh()
|
|
2684
|
+
} catch (failure) { if (mounted.current) setError(String(failure.message || failure)) }
|
|
2685
|
+
}
|
|
2541
2686
|
const titles = new Map(graph.nodes.map(node => [node.id, node.missing ? t('deletedNode') : node.title]))
|
|
2542
2687
|
const edges = graph.edges.filter(edge => !focus || edge.from === focus || edge.to === focus).sort((a, b) => b.confidence - a.confidence)
|
|
2543
2688
|
// 实体行:改名表单 + 删除按钮。删除是文字按钮(§6.4 包 D,原灰色 × 读不出
|
|
@@ -2614,6 +2759,23 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
2614
2759
|
h('select', { value: entityKind, title: t('entityKind'), onChange: event => setEntityKind(event.target.value) }, ['person', 'place', 'thing', 'org'].map(value => h('option', { key: value, value }, value))),
|
|
2615
2760
|
h(Button, { disabled: !entityName.trim(), onClick: () => act('createEntity', { name: entityName, kind: entityKind }) }, t('entityNew'))),
|
|
2616
2761
|
h(RelationshipPanel, { call, libraryId, entities, files, t }),
|
|
2762
|
+
// 工单 F:合并候选只列出来,永不自动合并。两次点击确认沿用删除的 armed 模式,
|
|
2763
|
+
// 合并后的影响面(改指多少条链接、并入多少别名)用一行回执说清。
|
|
2764
|
+
mergeNotice ? h('div', { style: { ...S.muted, marginTop: 6, color: V.accent }, role: 'status' }, mergeNotice) : null,
|
|
2765
|
+
merges.length ? h('div', { style: { margin: '10px 0' } },
|
|
2766
|
+
h('div', { style: { fontSize: 12, fontWeight: 600 } }, t('entityMergeTitle')),
|
|
2767
|
+
h('div', { style: { ...S.muted, margin: '4px 0 6px', lineHeight: 1.5 } }, t('entityMergeHint')),
|
|
2768
|
+
merges.map(item => {
|
|
2769
|
+
const key = 'merge:' + item.sourceId + '>' + item.targetId
|
|
2770
|
+
return h('div', { key, className: 'dshm-graph-tools' },
|
|
2771
|
+
h('span', { style: { minWidth: 0, overflowWrap: 'anywhere' } }, entityLabel(item.sourceId) + ' → ' + entityLabel(item.targetId)),
|
|
2772
|
+
h(Tag, { tone: 'info' }, item.reason === 'containment' ? t('mergeReasonContainment') : t('mergeReasonDistance')),
|
|
2773
|
+
h(Button, {
|
|
2774
|
+
style: armed === key ? { ...S.btn, color: V.danger, borderColor: V.danger } : S.btn,
|
|
2775
|
+
title: t('entityMergeHint'),
|
|
2776
|
+
onClick: () => { if (armed !== key) { setArmed(key); return } void doMerge(item) },
|
|
2777
|
+
}, armed === key ? t('entityMergeConfirm') : t('entityMergeAction')))
|
|
2778
|
+
})) : null,
|
|
2617
2779
|
entities.length === 0 ? h(Empty, null, t('entityEmpty')) : null,
|
|
2618
2780
|
// 孤立分组(§6.4 包 D):listEntities 给出 linked 派生标记。被引用的实体照常
|
|
2619
2781
|
// 渲染;孤立实体(linked=false,没有任何记忆 link/关系快照指着)收进折叠区,
|
|
@@ -2917,7 +3079,8 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
2917
3079
|
t('openLoopTag'))),
|
|
2918
3080
|
h('div', { className: 'dshm-drawer-note' },
|
|
2919
3081
|
t('decay') + ' ' + Math.round((Number(shown.decay) || 0) * 100) + '% · ' +
|
|
2920
|
-
(shown.updatedAt ? String(shown.updatedAt).slice(0, 16).replace('T', ' ') : ''))
|
|
3082
|
+
(shown.updatedAt ? String(shown.updatedAt).slice(0, 16).replace('T', ' ') : '')),
|
|
3083
|
+
emotionMetaText(shown, t) ? h('div', { className: 'dshm-drawer-note' }, emotionMetaText(shown, t)) : null)
|
|
2921
3084
|
: detail && detail.file && detail.readonly
|
|
2922
3085
|
? (() => {
|
|
2923
3086
|
// 全局条目只读(spec §6.7 UI):详情抽屉里只读展示 links / absorbedFrom,
|
|
@@ -3622,6 +3785,8 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
3622
3785
|
const [busy, setBusy] = React.useState(false)
|
|
3623
3786
|
const [vectorOperation, setVectorOperation] = React.useState('')
|
|
3624
3787
|
const [vectorError, setVectorError] = React.useState('')
|
|
3788
|
+
// 每张卡片各自记下载来源;没选过就用目录的默认顺序(第一个已固定的 provider)。
|
|
3789
|
+
const [vectorProvider, setVectorProvider] = React.useState({})
|
|
3625
3790
|
// 全局记忆页"查看此记忆"的接力棒:带着 id 切到 MemU 记忆页,墙直接开对应抽屉。
|
|
3626
3791
|
const [wallFocus, setWallFocus] = React.useState(null)
|
|
3627
3792
|
// Success messages need their own slot: reusing `error` would paint a good
|
|
@@ -4526,9 +4691,9 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
4526
4691
|
setVectorOperation('')
|
|
4527
4692
|
}
|
|
4528
4693
|
}
|
|
4529
|
-
const managedVectorDownload = async (id) => {
|
|
4694
|
+
const managedVectorDownload = async (id, provider) => {
|
|
4530
4695
|
if (!confirmAction(`download:${id}`)) return
|
|
4531
|
-
await managedVectorAction('downloadLocalVectorModel', { id, confirmed: true })
|
|
4696
|
+
await managedVectorAction('downloadLocalVectorModel', { id, confirmed: true, ...(provider ? { provider } : {}) })
|
|
4532
4697
|
}
|
|
4533
4698
|
const managedVectorSelect = async (id) => managedVectorAction('selectLocalVectorModel', { id })
|
|
4534
4699
|
const managedVectorSwitch = async () => {
|
|
@@ -4916,20 +5081,40 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
4916
5081
|
const isRequested = localVector.vector?.requested?.catalogId === entry.id
|
|
4917
5082
|
const canSelect = install.installed === true && install.fingerprintMatches !== false
|
|
4918
5083
|
const pendingArtifact = entry.availability === 'pending' || (entry.pendingReasons || []).length > 0
|
|
4919
|
-
const
|
|
5084
|
+
const providers = entry.providers || []
|
|
5085
|
+
const chosenSource = vectorProvider[entry.id] || providers[0]?.id || ''
|
|
5086
|
+
const bytes = Number(entry.totalBytes)
|
|
5087
|
+
const sizeText = bytes > 0
|
|
5088
|
+
? (bytes >= 1048576 ? `${(bytes / 1048576).toFixed(bytes >= 10485760 ? 0 : 1)} MB` : `${Math.max(1, Math.round(bytes / 1024))} KB`)
|
|
5089
|
+
: t('managedVectorSizePending')
|
|
4920
5090
|
const statusText = install.installed ? t('managedVectorInstalled') : pendingArtifact ? t('managedVectorPending') : (install.status || entry.availability || t('managedVectorUnavailable'))
|
|
4921
5091
|
return h('div', { key: entry.id, className: 'dshm-model' },
|
|
4922
5092
|
h('div', null,
|
|
4923
5093
|
h('div', { className: 'dshm-step-title' }, entry.displayName || entry.id),
|
|
4924
5094
|
h('div', { className: 'dshm-model-meta' },
|
|
4925
5095
|
h(Tag, null, `${entry.dimension || '?'}d`),
|
|
5096
|
+
(entry.languages || []).length ? h(Tag, null, (entry.languages || []).join(' · ')) : null,
|
|
4926
5097
|
h(Tag, null, sizeText),
|
|
4927
5098
|
h(Tag, install.installed ? { tone: 'info' } : pendingArtifact ? { tone: 'warn' } : null, statusText),
|
|
4928
5099
|
isActive ? h(Tag, { tone: 'info' }, t('managedVectorActive')) : null,
|
|
4929
5100
|
isRequested ? h(Tag, { tone: 'warn' }, t('managedVectorRequested')) : null)),
|
|
5101
|
+
// 多个已固定来源才能选(只有一个就没有「选」这件事)。默认是目录顺序的
|
|
5102
|
+
// 第一个,也就是 Qwen3 卡片上的 hf-mirror;换源不改向量空间——每个文件
|
|
5103
|
+
// 都要过同一个 pin 住的 sha256。
|
|
5104
|
+
providers.length > 1 ? h('div', { className: 'dshm-nav-list is-row', role: 'tablist', 'aria-label': t('managedVectorSource') },
|
|
5105
|
+
providers.map(item => h('button', {
|
|
5106
|
+
key: item.id,
|
|
5107
|
+
type: 'button',
|
|
5108
|
+
role: 'tab',
|
|
5109
|
+
title: t('managedVectorSourceHint'),
|
|
5110
|
+
'aria-selected': chosenSource === item.id,
|
|
5111
|
+
disabled: busy || install.installed,
|
|
5112
|
+
className: `dshm-nav-item${chosenSource === item.id ? ' on' : ''}`,
|
|
5113
|
+
onClick: () => setVectorProvider(current => ({ ...current, [entry.id]: item.id })),
|
|
5114
|
+
}, item.label))) : null,
|
|
4930
5115
|
h('div', { className: 'dshm-step-actions' },
|
|
4931
5116
|
!install.installed && entry.availability === 'available'
|
|
4932
|
-
? h(Button, { onClick: () => managedVectorDownload(entry.id), disabled: busy, primary: true, title: t('managedVectorDownload') }, actionLabel(`download:${entry.id}`, t('managedVectorDownload')))
|
|
5117
|
+
? h(Button, { onClick: () => managedVectorDownload(entry.id, providers.length > 1 ? chosenSource : ''), disabled: busy, primary: true, title: t('managedVectorDownload') }, actionLabel(`download:${entry.id}`, t('managedVectorDownload')))
|
|
4933
5118
|
: null,
|
|
4934
5119
|
canSelect && !isActive
|
|
4935
5120
|
? h(Button, { onClick: () => managedVectorSelect(entry.id), disabled: busy, title: t('managedVectorSelect'), style: S.ghost }, t('managedVectorSelect'))
|
|
@@ -4969,6 +5154,17 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
4969
5154
|
h(Field, { label: t('minUserChars') }, h('input', { type: 'number', style: S.input, value: settings.minUserChars ?? 6, onChange: (e) => setSetting('minUserChars', Number(e.target.value)) })),
|
|
4970
5155
|
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)) })),
|
|
4971
5156
|
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)) })),
|
|
5157
|
+
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)) })),
|
|
5158
|
+
h(Field, { label: t('freshnessHint') }, h(Toggle, { checked: settings.freshnessHint !== false, label: t('freshnessHint'), onChange: value => setSetting('freshnessHint', value) })),
|
|
5159
|
+
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)) })),
|
|
5160
|
+
h('div', { className: 'dshm-settings-note', style: { ...S.muted, marginTop: 6, lineHeight: 1.55 } }, t('freshnessHintHint')),
|
|
5161
|
+
h(Field, { label: t('salientWake') },
|
|
5162
|
+
h('select', { style: S.input, value: settings.salientWake || 'off', onChange: (e) => setSetting('salientWake', e.target.value) },
|
|
5163
|
+
h('option', { value: 'off' }, t('salientWakeOff')),
|
|
5164
|
+
h('option', { value: 'schedule' }, t('salientWakeSchedule')))),
|
|
5165
|
+
h(Field, { label: t('salientWakeHour') }, h('input', { type: 'time', style: S.input, value: settings.salientWakeHour || '09:00', onChange: (e) => setSetting('salientWakeHour', e.target.value) })),
|
|
5166
|
+
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) })),
|
|
5167
|
+
h('div', { className: 'dshm-settings-note', style: { ...S.muted, marginTop: 6, lineHeight: 1.55 } }, t('salientWakeHint')),
|
|
4972
5168
|
h(Field, { label: t('autoInstall') }, h('input', { type: 'checkbox', checked: settings.autoInstallEngine !== false, onChange: (e) => setSetting('autoInstallEngine', e.target.checked) })),
|
|
4973
5169
|
h(Field, { label: t('newSessionPrompt') }, h('input', { type: 'checkbox', checked: settings.newSessionPromptDismissed !== true, onChange: (e) => setSetting('newSessionPromptDismissed', !e.target.checked) })),
|
|
4974
5170
|
h(Field, { label: t('habitsInjection') }, h('input', { type: 'checkbox', checked: settings.habitsInjection !== false, onChange: (e) => setSetting('habitsInjection', e.target.checked) })),
|
|
@@ -5303,7 +5499,7 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
5303
5499
|
f.salientDate
|
|
5304
5500
|
? h(Tag, null, `${/^\d{4}-\d{2}-\d{2}$/.test(f.salientDate) ? t('dueDateTag') : t('anniversaryTag')} ${f.salientDate}`)
|
|
5305
5501
|
: null,
|
|
5306
|
-
moodText ? h(Tag,
|
|
5502
|
+
moodText ? h(Tag, { title: emotionMetaText(f, t) || undefined }, `${t('moodTag')} ${moodText}`) : null,
|
|
5307
5503
|
typeof f.accuracy === 'number' && typeof f.confidence === 'number' && f.accuracy <= 0.6 && f.accuracy < f.confidence - 0.1
|
|
5308
5504
|
? h(Tag, { tone: 'warn' }, `${t('accuracyTag')} ${f.accuracy}`) : null,
|
|
5309
5505
|
h(Tag, null, enumText(t, STATUS_LABELS, f.status || 'active'))),
|
|
@@ -5720,7 +5916,7 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
5720
5916
|
},
|
|
5721
5917
|
})
|
|
5722
5918
|
|
|
5723
|
-
// 帮助页 v2(包 G4):快速开始 5 步 + 七个详解区 + FAQ
|
|
5919
|
+
// 帮助页 v2(包 G4):快速开始 5 步 + 七个详解区 + FAQ 11 条 + 反馈入口。
|
|
5724
5920
|
// 所有跳转都走既有 setPage(不新增路由/RPC/localStorage),诊断复制只序列化
|
|
5725
5921
|
// getSettingsState 已有快照(复用上方 copyText);正文全部走 i18n,段落/列表/
|
|
5726
5922
|
// 表格只由本地小助手拼装,样式复用 Section/Tag/Button 与 S 里的既有 token。
|
|
@@ -5813,7 +6009,7 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
5813
6009
|
helpBullets(['helpSidebarAlerts', 'helpSidebarReview', 'helpSidebarRunLog',
|
|
5814
6010
|
'helpSidebarReviewMode', 'helpSidebarFirstRun', 'helpSidebarFallback', 'helpSidebarScope'])),
|
|
5815
6011
|
h(Section, { title: t('helpFaq'), icon: GlyphQuestion },
|
|
5816
|
-
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(n => h('details', { key: 'helpFaq' + n, style: { margin: '0 0 8px' } },
|
|
6012
|
+
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map(n => h('details', { key: 'helpFaq' + n, style: { margin: '0 0 8px' } },
|
|
5817
6013
|
h('summary', { style: { cursor: 'pointer', fontSize: 12.5, fontWeight: 600, lineHeight: 1.5 } }, t('helpFaq' + n)),
|
|
5818
6014
|
h('div', { style: { ...S.muted, marginTop: 5, fontSize: 12, lineHeight: 1.7 } }, t('helpFaq' + n + 'A'))))),
|
|
5819
6015
|
h(Section, { title: t('helpFeedback'), icon: GlyphGlobe },
|
|
@@ -5833,6 +6029,7 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
5833
6029
|
const LOG_KIND_LABELS = {
|
|
5834
6030
|
recall: t('logKindRecall'), write: t('logKindWrite'), consolidate: t('logKindConsolidate'),
|
|
5835
6031
|
curate: t('logKindCurate'), vector: t('logKindVector'), error: t('logKindError'), system: t('logKindSystem'), check: t('logKindCheck'),
|
|
6032
|
+
wake: t('logKindWake'),
|
|
5836
6033
|
}
|
|
5837
6034
|
const logsBlock = h(React.Fragment, null,
|
|
5838
6035
|
h(Section, {
|
|
@@ -5867,7 +6064,7 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
5867
6064
|
onChange: (event) => setLogKind(event.target.value),
|
|
5868
6065
|
},
|
|
5869
6066
|
h('option', { value: '' }, t('logAllKinds')),
|
|
5870
|
-
['recall', 'write', 'consolidate', 'curate', 'vector', 'error', 'check'].map(kind => h('option', { key: kind, value: kind }, LOG_KIND_LABELS[kind]))),
|
|
6067
|
+
['recall', 'write', 'consolidate', 'curate', 'vector', 'error', 'check', 'wake'].map(kind => h('option', { key: kind, value: kind }, LOG_KIND_LABELS[kind]))),
|
|
5871
6068
|
h('input', {
|
|
5872
6069
|
style: S.input,
|
|
5873
6070
|
value: logQueryInput,
|
|
@@ -5883,10 +6080,12 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
5883
6080
|
logNotice ? h('div', { style: { ...S.muted, marginTop: 6, color: V.accent } }, logNotice) : null,
|
|
5884
6081
|
logRows.length === 0
|
|
5885
6082
|
? h(Empty, null, t('logEmpty'))
|
|
5886
|
-
: h('div', { style: S.list }, logRows.map(row => h('div', { key: row.id, style: S.item },
|
|
6083
|
+
: h('div', { style: S.list }, logRows.map(row => h('div', { key: row.id, style: S.item, className: logRowClass(row) },
|
|
5887
6084
|
h('div', { style: { display: 'flex', justifyContent: 'space-between', gap: 8, alignItems: 'center' } },
|
|
5888
6085
|
h('div', { style: { display: 'flex', gap: 6, alignItems: 'center', minWidth: 0, flexWrap: 'wrap' } },
|
|
5889
|
-
h(Tag,
|
|
6086
|
+
h(Tag, null, LOG_KIND_LABELS[row.kind] || row.kind),
|
|
6087
|
+
logRowState(row) === 'failed' ? h(Tag, { tone: 'danger', title: t('logStateFailedHint') }, t('logStateFailed')) : null,
|
|
6088
|
+
logRowState(row) === 'degraded' ? h(Tag, { tone: 'warn', title: t('logDegradedHint') }, t('logDegraded')) : null,
|
|
5890
6089
|
h('span', { style: S.muted }, new Date(row.at).toLocaleString()),
|
|
5891
6090
|
// 整理/提炼日志挂上会话标题与文件夹名,裸 id 只做回退:日志页要回答
|
|
5892
6091
|
// "这是哪个对话、哪个库",光靠 sessionId 后 10 位查不动。
|
|
@@ -5909,7 +6108,7 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
5909
6108
|
setLogNotice(ok ? t('copied') : t('copyFailed'))
|
|
5910
6109
|
},
|
|
5911
6110
|
}, t('logCopyOne')))),
|
|
5912
|
-
h('div', { style: { marginTop: 4, whiteSpace: 'pre-wrap' } }, row.message),
|
|
6111
|
+
h('div', { className: logMessageClass(row), style: { marginTop: 4, whiteSpace: 'pre-wrap' } }, row.message),
|
|
5913
6112
|
Array.isArray(row.refs) && row.refs.length
|
|
5914
6113
|
? h('div', { style: { ...S.muted, marginTop: 4 } }, row.refs.join(' · '))
|
|
5915
6114
|
: null,
|
|
@@ -6265,10 +6464,15 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
6265
6464
|
const RUN_KIND_LABELS = {
|
|
6266
6465
|
recall: t('logKindRecall'), write: t('logKindWrite'), consolidate: t('logKindConsolidate'),
|
|
6267
6466
|
curate: t('logKindCurate'), vector: t('logKindVector'), error: t('logKindError'), system: t('logKindSystem'),
|
|
6467
|
+
check: t('logKindCheck'), wake: t('logKindWake'),
|
|
6268
6468
|
}
|
|
6469
|
+
// 侧栏的「整理记录」只放正常流水:失败已经由上方「整理提醒」负责(跨会话、可清除、
|
|
6470
|
+
// 可跳转),在这里再重复一遍只会让 5 行里挤满红字。红色与「失败/降级」标签只在
|
|
6471
|
+
// WebUI › 全部日志 里出现——那里才是按时间翻全部事件的地方。
|
|
6472
|
+
const sidebarRuns = runLog.filter((row) => logRowState(row) !== 'failed')
|
|
6269
6473
|
const renderRunRow = (row) => h('div', { key: row.id, style: S.item },
|
|
6270
6474
|
h('div', { style: { display: 'flex', gap: 6, alignItems: 'center', flexWrap: 'wrap' } },
|
|
6271
|
-
h(Tag,
|
|
6475
|
+
h(Tag, null, RUN_KIND_LABELS[row.kind] || row.kind),
|
|
6272
6476
|
h('span', { style: S.muted }, new Date(row.at).toLocaleTimeString())),
|
|
6273
6477
|
h('div', { style: { marginTop: 2, whiteSpace: 'pre-wrap', fontSize: 12 } }, row.message))
|
|
6274
6478
|
|
|
@@ -6327,9 +6531,9 @@ const SOURCE_LABELS = { user_said: 'sourceUserSaid', inferred: 'sourceInferred',
|
|
|
6327
6531
|
},
|
|
6328
6532
|
h('span', { style: { ...S.muted, fontWeight: 600 } }, t('runLogTitle')),
|
|
6329
6533
|
h('span', { style: { marginLeft: 'auto', fontSize: 11, fontWeight: 600, color: V.accent } }, t('runLogOpen') + ' ↗')),
|
|
6330
|
-
|
|
6534
|
+
sidebarRuns.length === 0
|
|
6331
6535
|
? h('div', { style: S.muted }, t('runLogEmpty'))
|
|
6332
|
-
: h('div', { style: S.list },
|
|
6536
|
+
: h('div', { style: S.list }, sidebarRuns.slice(0, 5).map(renderRunRow)))),
|
|
6333
6537
|
// 作用域放在控制卡之后:它是一组低频字段,先让用户看到记忆开关和整理入口。
|
|
6334
6538
|
h(ContextScope, { binding, sessionId, call, t })
|
|
6335
6539
|
)
|
package/lib/cycle.js
CHANGED
|
@@ -7,6 +7,7 @@ import { expireShortTerm } from './memory.js'
|
|
|
7
7
|
import { requestPrivateConsolidation } from './private.js'
|
|
8
8
|
import { startGlobalCuration } from './curator.js'
|
|
9
9
|
import { runVisibilityMigrationPass } from './migrate.js'
|
|
10
|
+
import { runSalientWakePass } from './salient-wake.js'
|
|
10
11
|
import { record } from './activity-log.js'
|
|
11
12
|
import { ACTIVE_MEMORY_POLICY, suppressionReason } from './active-memory.js'
|
|
12
13
|
import { clearSessionState } from './consolidation-ledger.js'
|
|
@@ -256,7 +257,14 @@ export async function runCyclePasses(ctx, options = {}) {
|
|
|
256
257
|
// updated mid-flight. Reads are already normalized, so this only keeps the files in
|
|
257
258
|
// step with the code (see lib/migrate.js); it is cheap and idempotent.
|
|
258
259
|
const migrated = runVisibilityMigrationPass({ log: options.log })
|
|
259
|
-
|
|
260
|
+
// 工单 E:纪念日到点唤醒。放在最后:它是唯一会碰宿主 schedule 服务的 pass,宿主没
|
|
261
|
+
// 这个服务时只返回 `{skipped:'service'}`;即使它整体失败,上面的短期过期、睡眠整理、
|
|
262
|
+
// 自动提炼和库迁移已经跑完,下一次 sweep 照常重试。
|
|
263
|
+
const salientWake = await runSalientWakePass(ctx, { now: options.now ?? new Date(), log: options.log }).catch((error) => {
|
|
264
|
+
try { options.log?.(`salient wake pass failed: ${error?.message || error}`) } catch {}
|
|
265
|
+
return { created: 0, cleaned: 0, skipped: 0, errors: 1 }
|
|
266
|
+
})
|
|
267
|
+
return { shortTerm, sleep, curate, libraries, migrated, salientWake }
|
|
260
268
|
}
|
|
261
269
|
|
|
262
270
|
// DSH has no host scheduler a plugin can register a *global* job with
|