feat(desktop): Memory Hub UI wiring, AI insights, background analysis (P3/P4 finishing) - #3808
feat(desktop): Memory Hub UI wiring, AI insights, background analysis (P3/P4 finishing)#3808lengjingxu wants to merge 25 commits into
Conversation
Signed-off-by: Leng <Lengjingxu@gmail.com>
fix(desktop): harden worker tabs and add collaboration docs
Signed-off-by: Leng <Lengjingxu@gmail.com>
…ation docs(dev-rules): make collaboration playbook reusable
Signed-off-by: Leng <Lengjingxu@gmail.com>
…ce-kit docs(templates): add copy-ready collaboration kit
Signed-off-by: Leng <Lengjingxu@gmail.com>
…sections Signed-off-by: Leng <Lengjingxu@gmail.com>
Signed-off-by: Leng <Lengjingxu@gmail.com>
docs(product-rules): propose Memory Hub viewing and management plan
Signed-off-by: Leng <Lengjingxu@gmail.com>
docs(product-rules): incorporate upstream feedback into Memory Hub plan
Signed-off-by: Leng <Lengjingxu@gmail.com>
Signed-off-by: Leng <Lengjingxu@gmail.com>
feat(desktop): add read-only Memory Hub (P1) with hub IPC and i18n
Signed-off-by: Leng <Lengjingxu@gmail.com>
fix(memory): scope hub listing to maker memory
…4 background trigger Signed-off-by: Leng <Lengjingxu@gmail.com>
feat(memory): add P2 event log/trash, P3 recommendations/insights, P4 background trigger
- MemoryHubDialog: entries/insights/trash tabs with edit form, history drawer, delete-to-trash with confirmation, restore, rule-based recommendation cards with confirm-execute - AI insights: one-shot analysis via system default model (requestUtilityText), cached per scope, read-only, never injected into prompts; manual trigger + background scheduler output share one cache path - Background scheduler (P4): 30min tick, delta threshold on memory_events, 7d frequency cap, quiet-window skip on recent writes, settings toggle (default on) persisted in memory-hub-settings.json - Fix P2 preload block to use channel string literals (MAKER_INVOKE is not in preload scope; surfaced once desktop typecheck could run) - Add shared types, vite-env declarations, 5-locale i18n keys, and unit tests for prompt build/response parse Signed-off-by: Leng <Lengjingxu@gmail.com>
…edback Signed-off-by: Leng <Lengjingxu@gmail.com> # Conflicts: # apps/desktop/src/main/maker-ipc/register.ts
|
| Filename | Overview |
|---|---|
| packages/maker-core/src/memory/store.ts | 新增软删除与恢复 facade,但 softDelete 实际执行永久删除,导致回收站功能失效并造成数据丢失。 |
| packages/maker-core/src/memory/storage.ts | 新增回收站读取和恢复实现;恢复缺少同名目标冲突保护。 |
| apps/desktop/src/main/maker-host/memory-hub-analysis-scheduler.ts | 新增后台分析调度与按 scope 缓存,但手动和后台并发写入可能发生整文件 lost update。 |
| apps/desktop/src/main/maker-host/memory-hub-ai-analysis.ts | 新增摘要 prompt 构造、模型响应解析及 one-shot 分析调用,解析失败按 best-effort 处理。 |
| apps/desktop/src/main/maker-ipc/register.ts | 新增完整 Memory Hub IPC 接线,其中删除和分析缓存路径暴露了上述存储与并发缺陷。 |
| apps/desktop/src/renderer/components/settings/MemoryHubDialog.tsx | 新增条目、洞察、回收站交互,并通过 preload API 调用对应主进程能力。 |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
UI[Memory Hub UI] --> IPC[Preload / Maker IPC]
IPC --> Store[MakerMemoryStore]
Store --> Files[Memory shards]
Store --> Trash[.trash]
Store --> FTS[FTS events and history]
UI --> Manual[Manual AI refresh]
Scheduler[Background scheduler] --> Analysis[AI analysis]
Manual --> Analysis
Analysis --> Model[Utility model]
Analysis --> Cache[memory-hub-analysis-state.json]
Cache --> UI
Prompt To Fix All With AI
### Issue 1
packages/maker-core/src/memory/store.ts:248-249
**软删除实际永久删除**
用户确认删除条目或执行废弃推荐时,`softDelete` 直接调用最终执行 `fs.unlink` 的 `storage.delete`,没有把文件移入 `.trash`,导致条目永久丢失且无法从回收站恢复。
### Issue 2
packages/maker-core/src/memory/storage.ts:461-464
**恢复静默覆盖同名条目**
当删除后又创建了同名记忆时,恢复操作直接将回收站文件 `rename` 到主目录且不检查目标是否存在;在允许替换目标的平台上,这会用旧版本静默覆盖新条目,在其他平台则会产生不同的失败语义。
### Issue 3
apps/desktop/src/main/maker-host/memory-hub-analysis-scheduler.ts:94-96
**并发分析丢失缓存状态**
如果用户手动刷新一个 scope 时后台分析正为另一个 scope 完成,两个调用会分别读取旧状态并整文件写回,后写入者将覆盖另一方的缓存及 `lastAnalysisAt`,导致洞察回退并可能绕过七天频率限制而重复调用模型。
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "feat(desktop): wire Memory Hub UI, AI in..." | Re-trigger Greptile
Signed-off-by: Leng <Lengjingxu@gmail.com>
…ness check Signed-off-by: Leng <Lengjingxu@gmail.com>
|
这条 PR 正在等维护者确认,当前不会自动合并。 改动会让用户在设置里看到新的记忆中心(条目 / 洞察 / 回收站)、条目编辑删除,以及 AI 洞察和后台分析开关。另外还改了产品规则和协作文档。请维护者直接在 PR 上 Approve;如果要改,请 Request Changes。讨论 issue:#3813 另外:PR 描述还缺「风险」段,合入前需要补上。UI 改动也还没有界面效果证据(截图 / 录屏 / HTML 预览)。 |
MagicLizi
left a comment
There was a problem hiding this comment.
PR 描述缺「风险」段,格式门未过。
请按仓库 PR 模板补上「风险」:风险分类、影响范围与回滚方式。当前 Description 写了功能、范围和验证,但没有风险段,无法判断权限/用户数据/后台分析这些面的影响。
补全后重新请求 review 即可。
|
命中 UI 路径(apps/desktop/src/renderer/components/settings/MemoryHubDialog.tsx / apps/desktop/src/renderer/components/settings/MemorySection.tsx / apps/desktop/src/renderer/lib/memoryHub.ts)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面(```html 代码块、.html 附件或在线预览链接),便于确认界面符合 DESIGN.md 设计规范 |
|
@lengjingxu 👋 这个 PR 还有 3 条 review conversation 没 resolve(packages/maker-core/src/memory/store.ts / packages/maker-core/src/memory/storage.ts / apps/desktop/src/main/maker-host/memory-hub-analysis-scheduler.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
|
@lengjingxu 👋 这个 PR 目前与 请在本地 merge 最新的 |
…edback Signed-off-by: Leng <Lengjingxu@gmail.com> # Conflicts: # docs/design-rules/design-inventory.md
Review P1 fixes from PR makecindy#3808: - softDelete now renames the shard into .trash/ via new MemoryStorage.softDelete instead of unlinking through MemoryStorage.delete; trash listing/restore now operate on real data (regression-tested in memory/trash.test.ts) - restore fails closed with already-exists when the same filename exists in the store, instead of silently overwriting the newer entry - analysis state cache writes go through an in-process serial queue with tmp+rename atomicity so a manual refresh and a background tick can no longer clobber each other's lastAnalysisAt/cached entry Signed-off-by: Leng <Lengjingxu@gmail.com>
|
已按反馈处理:
本地门禁:maker-core/desktop typecheck ✅、glossary ✅、memory 测试 57/57 ✅、i18nCompleteness ✅。 |
|
@lengjingxu 👋 这个 PR 现在在等维护者确认,确认之前流程不会合并它 —— 不是卡住了,也不是在等你再改一版(你推的改动流程都读到了,判的就是最新一版代码)。
这条是流程自动发的状态提醒(同一版代码只发一次),不用回复。 |
|
@lengjingxu 👋 这个 PR 目前与 请在本地 merge 最新的 |
这些问题已在当前 head 的后续 commit 中修复(格式门/安全门已通过),自动 dismiss 旧的 CHANGES_REQUESTED 以解除合并阻塞。
这次改了什么
摘要
P2/P3/P4 后端能力合入后的接线与体验层收尾(含 review 修正):
变更类型
范围
UI 变化
怎么验证的
自动验证
手工验证
未执行的验证
风险
风险分类
影响与回滚
提交前检查
git commit -s,见 DCO)