All your AI agent sessions in one place — browse, search, resume. Rust + GPUI.
Rust
feat: bring hidden sessions back from Settings → Data
Corey Chiuf2e086d257d2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6bfc2dd..f51e817 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,10 @@# Changelog+## [Unreleased]++- New: Sessions you hide in Wake can be brought back: Settings → Data lists them, and Unhide puts each one back with the sessions hidden along with it+- Fix: Confirming that you want to hide or delete a session, or remove a remote host, now offers a Cancel button+## [0.9.2] — 2026-10-12- New: Subagents started by Claude Code, Cursor, CodeBuddy, WorkBuddy, Qoder and Kimi Code are sessions of their own, listed under the session that started them, so you can search and open them like any otherdiff --git a/DESIGN.md b/DESIGN.mdindex 2b3833d..9a5bdd1 100644--- a/DESIGN.md+++ b/DESIGN.md@@ -138,7 +138,7 @@ macOS 不设置横跨三栏的自定义 header。主窗口透明标题栏高 44p- 行内容 = 行首元素 + 标题 + 计数;计数一律 Label 档 muted。- 组头 "Agents"/"Projects" 用 Body 档常规字重 + muted 色(与主导航同字号同字重,仅靠颜色区分——加粗会让组头压过它统辖的行)。行首是 15px 的折叠 chevron(收起指右、展开指下;与导航行图标同档,描边粗细一致),中心压 26.75 轴(用户 2026-09-22 定:箭头放到开头,对准上面菜单的图标与红绿灯的红灯;原先 chevron 跟在文字后),**不占 18px 槽位、按自己的框居中压轴**,再接统一的 `ICON_TEXT_GAP`——槽位居中再接同一间距,墨迹到文字会比导航行空出一截(chevron 墨迹只有约 5px 宽,用户同日"间隔太大");按框压轴后墨迹到文字视觉约 10.9px 与导航行相当,文字起点比导航行标签左 1.5px。组头与主导航行**同高(`ROW_HEIGHT` 32px,文字居中)、同 4px 间距**,导航块到组头之间也只隔这 4px:收起时 All Sessions / Starred / Agents / Projects 等距 36px(用户 2026-10-12 定;原先组头上留 12、下留 4,再加两块之间多出的 4px,下面明显更疏)。- 底部工具条常驻,总高 44px(含顶部 1px hairline),两端分置的**纯图标条**(2026-09-21 三轮定稿:六个一样的 ghost 图标挤一排分不出层级;带边框底色的分段盒子放在侧栏里像一个走错地方的表单控件——参照 Zed 状态栏 / Xcode 导航条,不带盒子):按钮统一 28×28、6px 圆角、14px 图标、2px 间距;**左端**——Sessions(messages-square,双气泡;单气泡的 message-square 留给消息级用途)/ Memory(brain)/ Insights(chart-column)三颗页切换,再接 brush-cleaning "Clean Up Sessions"(它是叠在会话视图上的模式,也靠左),当前页(或打开中的清理)那颗用侧栏行的选中色(`sidebar_accent` 底 + `sidebar_accent_foreground` 图标)做圆角底,与导航行选中态同一套语言;**右端只有齿轮 "Settings"**。左内边距 12.75 = 26.75(侧栏中轴)− 14(按钮半宽):最左那颗图标的中心与红绿灯红灯中心、导航行行首在同一条轴上。未选中的一律透明底、muted 图标,hover 才出色。**Refresh 不在工具条**:它住在每页页头右端(All Sessions 页头在 Sort 左侧,Memory / Insights 页头单独一个;tooltip 就叫 "Refresh"),会话页与 Insights 走整库重扫(Insights 的数据是扫描收尾派生的),Memory 页只同步记忆(读 Settings → Memory locations 的当下配置,不重扫会话;用户 2026-09-22 定各刷各的);进行中转圈并禁用,⌘R 恒为刷会话。Settings 同时进入 Wake 菜单并绑定 `⌘,`(其他平台 `Ctrl+,`),保持单例窗口。-- Settings 默认 820×600,采用 180px 窄侧栏 + 内容页结构,固定为 General / Session locations / Memory locations / Remote hosts / Connect / Data / Updates / About 八项(侧栏项原叫 Locations,有了 Memory locations 后改成与页标题一致的 Session locations,用户 2026-09-21 定)(Connect 为 0.5.0 新增,插在 Remote hosts 与 Data 之间——两页都是"把 Wake 接到外部"的集成面,Data 之后是纯本地信息;Memory locations 是记忆可见层二期加的,紧挨 Locations——两页都是"Wake 读哪里");About 与功能设置分离并钉在侧栏底部,Wake 菜单的 About Wake 直达同一页。About 沿用 Kooky/Birth 的信息顺序:产品图标、名称、版本、tagline、GitHub、短分隔线、版权/许可证与作者署名。Updates 是独立功能页,仅在用户点击页面按钮或 macOS Wake 菜单的 Check for Updates 时读取 GitHub 最新正式 Release 元数据,明确呈现检查中/最新版/有新版/失败四种状态;有新版时打开 Release 页供用户下载,不后台检查、不自行覆盖应用包。内部常规文字按钮统一沿用主界面的 24px 高、6px 圆角和主题交互色,普通页面动作使用 muted 填充 + hairline;发现新版后的 View Update 是需要用户继续完成的主操作,使用 32px 高 primary 填充和轻阴影。Appearance 分段选择器也使用同一材质。General 只放真实可用的全局偏好,当前为持久化的 System / Light / Dark 外观选择与 Language(跟随系统或固定某个语言包,0.5.2 起);不提供默认 “Open In” 终端。Data 只展示 Wake 本地存储位置、会话数与磁盘占用并提供文件管理器入口,不重复放刷新或清库动作;常规 Refresh 的唯一入口仍是主侧栏底部。Locations 页按 AgentId 声明序以 agent 分组,品牌名只在组头出现一次;本机有数据的组优先,未检测到的 agent 默认收进可展开区。每条路径以路径为主信息、会话数/不可用状态为 muted 副信息,最右为逐路径开关;停用时只降低文字层级,开关与菜单保持完整对比度。行本身不承担编辑,`…` 菜单集中 Edit / Show in Finder / 自定义 Remove。顶部操作为低强调的 Add location,Restore defaults 收进页级 `…` 菜单且无偏离时禁用。添加/编辑仍复用 agent 下拉 + 可手输路径 + 目录选择表单;关闭 location 后保留配置、停止扫描/监听并从会话与搜索结果排除,重新开启即增量扫回;纯路径管理不做内容校验。**Memory locations 页与 Locations 同版式**(2026-09-21 记忆可见层二期):标题 "Memory locations" + 一句说明 + 右侧 Add location + 页级 `…` 里的 Restore defaults;按 AgentId 声明序分组,一行一个记忆来源——各家默认的(Claude 的 auto-memory 树与 `~/.claude/CLAUDE.md`、Codex 的 memories 目录、逐线程库、`~/.codex/AGENTS.md` 与 `rules/`、Gemini 的 `~/.gemini/GEMINI.md`、ZCode 的记忆树)、项目根模式(`<project>/CLAUDE.md`、`<project>/.cursor/rules` 一类,原样显示占位符)与用户加的自定义目录/文件;路径为主信息、文件数(或 "Not found")为 muted 副信息,最右逐来源开关;`…` 菜单:默认来源只有 Show in Finder(项目模式连这个也没有),自定义来源多 Edit / Remove。添加/编辑与 Session locations 是同一个表单(`open_path_form`),差别是字段叫 "Folder or file"、选择器也收文件。改动不换 roster,只补一轮增量扫描,记忆流随之更新。Remote hosts 页沿用 Locations 的版式:标题 + 说明,右侧低强调的 Sync now / Add host;host 列表为单张 popover 底圆角卡,一行一台(名字为主信息、同步状态为 muted 副信息,失败用 danger),`…` 菜单集中 Sync now / Remove,最右为开关;添加走与 location 同材质的单字段表单弹窗,SSH 前提说明放在字段下方。列表与详情页的远程会话以 `@host` 徽章标识:列表行为 primary 淡底填充胶囊(与 muted 项目胶囊区分),详情页与 model/source 同排用 primary 描边。Connect 页沿用 Data 页的版式,**只放状态与动作,不放文档**(用户 2026-09-08 三轮定稿:平级双卡带代码块、嵌套同卡、缩进从属卡都试过,根源是设置窗里塞了 README 内容,怎么排都像教程):标题 + 一句说明(不点名 MCP、不写 read-only 声明);「MCP server」卡 84px 一行显示 wake-mcp 名称与 mono 字体的 `~/…` 路径,右侧复制钮,不放"Ready"状态行,只在找不到二进制时给一行 danger 文案;「MCP clients」卡三行(Claude Code / Codex / Cursor),17px 品牌图标领行、客户端名为主信息、用法提示为 muted 副信息、右侧是 ghost 的 Show/Hide 切换(chevron 图标 + 文案,muted 前景,用户 2026-09-08 追加)加复制钮;代码块**默认收起**,展开后出现在该行下方、左缘对齐到文字轴(行内边距 16 + 图标 17 + 间距 12),secondary 填充 + 主题圆角的 mono 逐行渲染,Settings 重开即复位。0.6.x 起页面是**四个区块**(用户 2026-09-11 定稿):MCP server / MCP clients / Command line / Skill——MCP server / Command line / Skill 各一张 84px 信息卡、MCP clients 仍是三行客户端列表(wake-mcp、wake-cli 是二进制名与 mono 路径 + 复制路径的钮;wake-cli 那张在它**左侧**多一个终端图标的复制钮,复制「把它放进 PATH」的那行命令——两颗一样的复制图标并排分不清,所以换字形;最右留给两张卡同为复制路径的那颗,纵向才对得齐;deb/tar 已装进 `…/bin` 或 Windows 上没有可粘命令时这个按钮不出现;Skill 是 `npx skills add …` + 复制钮),区块标题为「Agents」时看不出这块特指 MCP,故改名 MCP clients 与上方 MCP server 成对。**说明性 caption 一律不放**——那正是"设置窗里塞 README"的复发形态;Setup guide 链接改挂在区块标题右端,规则是**每个面的第一个区块挂自己的文档**:MCP server → docs/mcp.md,Command line → docs/cli.md(MCP clients 与 Skill 分属这两个面的第二块,不重复挂)。最上面另有两块 **Claude Code plugin** / **Codex plugin**(新会话开场就知道各个 agent 停在哪,并装上 Wake 的 MCP 工具;标题用各家正名,用户 2026-10-09 定——Codex 那块起初是它官方的 hooks 配置,2026-10-10 有了 Codex 插件后改名),各是一个面、各挂自己的 Setup guide(docs/cli.md 的两节);卡是 48px 一行,只有一句用法(正文字号、前景色,与卡片标题行同一种字)+ 右端复制钮,不摆等宽命令、不加品牌图与名字行(区块标题已点名);Windows 上两块都不画。四块之后整页**超过一屏、需要滚动**——2026-09-08 那条"一屏放下"的约束随第三、四个区块作废,滚动容器本来就在(`flex_1().min_h_0().overflow_y_scroll()`),卡片记得 `flex_shrink_0` 否则会被压扁。**复制钮一律只有图标**(用户 2026-10-09 定:卡上已经摆着要复制的东西或一句用法,按钮上再写 Copy path / Copy command 是重复):与文字按钮同材质、同 24px 高的方钮,13px 图标,说明在 tooltip;复制反馈是图标原地变 check(tooltip 变 Copied)1.6s 后复原,**不弹通知**——gpui-component 的 toast 在窗口失活或被悬停时暂停自动关闭,在 Settings 从属窗里经常就挂着不走(用户 2026-09-08 反馈),且主界面的 Copy Session ID / Copy code 本来就不弹;页面只展示不代写别家配置。+- Settings 默认 820×600,采用 180px 窄侧栏 + 内容页结构,固定为 General / Session locations / Memory locations / Remote hosts / Connect / Data / Updates / About 八项(侧栏项原叫 Locations,有了 Memory locations 后改成与页标题一致的 Session locations,用户 2026-09-21 定)(Connect 为 0.5.0 新增,插在 Remote hosts 与 Data 之间——两页都是"把 Wake 接到外部"的集成面,Data 之后是纯本地信息;Memory locations 是记忆可见层二期加的,紧挨 Locations——两页都是"Wake 读哪里");About 与功能设置分离并钉在侧栏底部,Wake 菜单的 About Wake 直达同一页。About 沿用 Kooky/Birth 的信息顺序:产品图标、名称、版本、tagline、GitHub、短分隔线、版权/许可证与作者署名。Updates 是独立功能页,仅在用户点击页面按钮或 macOS Wake 菜单的 Check for Updates 时读取 GitHub 最新正式 Release 元数据,明确呈现检查中/最新版/有新版/失败四种状态;有新版时打开 Release 页供用户下载,不后台检查、不自行覆盖应用包。内部常规文字按钮统一沿用主界面的 24px 高、6px 圆角和主题交互色,普通页面动作使用 muted 填充 + hairline;发现新版后的 View Update 是需要用户继续完成的主操作,使用 32px 高 primary 填充和轻阴影。Appearance 分段选择器也使用同一材质。General 只放真实可用的全局偏好,当前为持久化的 System / Light / Dark 外观选择与 Language(跟随系统或固定某个语言包,0.5.2 起);不提供默认 “Open In” 终端。Data 只展示 Wake 本地存储位置、会话数与磁盘占用并提供文件管理器入口,不重复放刷新或清库动作;下面一块「Hidden sessions」(2026-10-13 用户定"先加吧":删除存在别家自己数据里的会话其实是隐藏,原先隐藏了就再也找不回来),小标题与 Storage 同款,一张 popover 底圆角卡,一次隐藏一行(连同随它一起藏的子会话):17px 品牌图 + 会话标题为主信息、项目 · N 个子会话 · Hidden <日期> 为 muted 副信息,右端 24px 的 Unhide 按钮(进行中转圈、其余禁用),行间 hairline;对照中写 Checking…、没有时写 No hidden sessions;不弹通知,取消隐藏后那一行消失、会话回到主窗口列表;常规 Refresh 的唯一入口仍是主侧栏底部。Locations 页按 AgentId 声明序以 agent 分组,品牌名只在组头出现一次;本机有数据的组优先,未检测到的 agent 默认收进可展开区。每条路径以路径为主信息、会话数/不可用状态为 muted 副信息,最右为逐路径开关;停用时只降低文字层级,开关与菜单保持完整对比度。行本身不承担编辑,`…` 菜单集中 Edit / Show in Finder / 自定义 Remove。顶部操作为低强调的 Add location,Restore defaults 收进页级 `…` 菜单且无偏离时禁用。添加/编辑仍复用 agent 下拉 + 可手输路径 + 目录选择表单;关闭 location 后保留配置、停止扫描/监听并从会话与搜索结果排除,重新开启即增量扫回;纯路径管理不做内容校验。**Memory locations 页与 Locations 同版式**(2026-09-21 记忆可见层二期):标题 "Memory locations" + 一句说明 + 右侧 Add location + 页级 `…` 里的 Restore defaults;按 AgentId 声明序分组,一行一个记忆来源——各家默认的(Claude 的 auto-memory 树与 `~/.claude/CLAUDE.md`、Codex 的 memories 目录、逐线程库、`~/.codex/AGENTS.md` 与 `rules/`、Gemini 的 `~/.gemini/GEMINI.md`、ZCode 的记忆树)、项目根模式(`<project>/CLAUDE.md`、`<project>/.cursor/rules` 一类,原样显示占位符)与用户加的自定义目录/文件;路径为主信息、文件数(或 "Not found")为 muted 副信息,最右逐来源开关;`…` 菜单:默认来源只有 Show in Finder(项目模式连这个也没有),自定义来源多 Edit / Remove。添加/编辑与 Session locations 是同一个表单(`open_path_form`),差别是字段叫 "Folder or file"、选择器也收文件。改动不换 roster,只补一轮增量扫描,记忆流随之更新。Remote hosts 页沿用 Locations 的版式:标题 + 说明,右侧低强调的 Sync now / Add host;host 列表为单张 popover 底圆角卡,一行一台(名字为主信息、同步状态为 muted 副信息,失败用 danger),`…` 菜单集中 Sync now / Remove,最右为开关;添加走与 location 同材质的单字段表单弹窗,SSH 前提说明放在字段下方。列表与详情页的远程会话以 `@host` 徽章标识:列表行为 primary 淡底填充胶囊(与 muted 项目胶囊区分),详情页与 model/source 同排用 primary 描边。Connect 页沿用 Data 页的版式,**只放状态与动作,不放文档**(用户 2026-09-08 三轮定稿:平级双卡带代码块、嵌套同卡、缩进从属卡都试过,根源是设置窗里塞了 README 内容,怎么排都像教程):标题 + 一句说明(不点名 MCP、不写 read-only 声明);「MCP server」卡 84px 一行显示 wake-mcp 名称与 mono 字体的 `~/…` 路径,右侧复制钮,不放"Ready"状态行,只在找不到二进制时给一行 danger 文案;「MCP clients」卡三行(Claude Code / Codex / Cursor),17px 品牌图标领行、客户端名为主信息、用法提示为 muted 副信息、右侧是 ghost 的 Show/Hide 切换(chevron 图标 + 文案,muted 前景,用户 2026-09-08 追加)加复制钮;代码块**默认收起**,展开后出现在该行下方、左缘对齐到文字轴(行内边距 16 + 图标 17 + 间距 12),secondary 填充 + 主题圆角的 mono 逐行渲染,Settings 重开即复位。0.6.x 起页面是**四个区块**(用户 2026-09-11 定稿):MCP server / MCP clients / Command line / Skill——MCP server / Command line / Skill 各一张 84px 信息卡、MCP clients 仍是三行客户端列表(wake-mcp、wake-cli 是二进制名与 mono 路径 + 复制路径的钮;wake-cli 那张在它**左侧**多一个终端图标的复制钮,复制「把它放进 PATH」的那行命令——两颗一样的复制图标并排分不清,所以换字形;最右留给两张卡同为复制路径的那颗,纵向才对得齐;deb/tar 已装进 `…/bin` 或 Windows 上没有可粘命令时这个按钮不出现;Skill 是 `npx skills add …` + 复制钮),区块标题为「Agents」时看不出这块特指 MCP,故改名 MCP clients 与上方 MCP server 成对。**说明性 caption 一律不放**——那正是"设置窗里塞 README"的复发形态;Setup guide 链接改挂在区块标题右端,规则是**每个面的第一个区块挂自己的文档**:MCP server → docs/mcp.md,Command line → docs/cli.md(MCP clients 与 Skill 分属这两个面的第二块,不重复挂)。最上面另有两块 **Claude Code plugin** / **Codex plugin**(新会话开场就知道各个 agent 停在哪,并装上 Wake 的 MCP 工具;标题用各家正名,用户 2026-10-09 定——Codex 那块起初是它官方的 hooks 配置,2026-10-10 有了 Codex 插件后改名),各是一个面、各挂自己的 Setup guide(docs/cli.md 的两节);卡是 48px 一行,只有一句用法(正文字号、前景色,与卡片标题行同一种字)+ 右端复制钮,不摆等宽命令、不加品牌图与名字行(区块标题已点名);Windows 上两块都不画。四块之后整页**超过一屏、需要滚动**——2026-09-08 那条"一屏放下"的约束随第三、四个区块作废,滚动容器本来就在(`flex_1().min_h_0().overflow_y_scroll()`),卡片记得 `flex_shrink_0` 否则会被压扁。**复制钮一律只有图标**(用户 2026-10-09 定:卡上已经摆着要复制的东西或一句用法,按钮上再写 Copy path / Copy command 是重复):与文字按钮同材质、同 24px 高的方钮,13px 图标,说明在 tooltip;复制反馈是图标原地变 check(tooltip 变 Copied)1.6s 后复原,**不弹通知**——gpui-component 的 toast 在窗口失活或被悬停时暂停自动关闭,在 Settings 从属窗里经常就挂着不走(用户 2026-09-08 反馈),且主界面的 Copy Session ID / Copy code 本来就不弹;页面只展示不代写别家配置。- 工具条内的**状态行"常态沉默"**:仅刷新中或监听不可用时出现在按钮行上方;文案须可 truncate,窄侧栏放不下长句(故为 "Live updates off" 而非带操作建议的整句)。刷新中行首是与页头 Refresh 按钮 loading 态同一个 Spinner(12px、muted 色),文字下方 8px 处一条 3px 进度条(`Progress`,primary 色、轨道同色 20%;会话扫描按 done/total 定值,总数未知 / 记忆同步 / 远程同步走不定值滑动;2026-09-22 用户要的),出错时行首回到静态 refresh-cw 图标。- 手动 Refresh 始终后台运行;进度复用侧栏状态行,完成后发通知("Sessions refreshed" / "Memory refreshed"),不用模态框阻断浏览、搜索或阅读。- 不把项目包装成卡片,不堆叠分支、时间或重复图标。项目行不加彩色标识——同一图标重复十几次不传递信息。diff --git a/crates/wake-core/src/cleanup.rs b/crates/wake-core/src/cleanup.rsindex 3206f4f..dfe8e6e 100644--- a/crates/wake-core/src/cleanup.rs+++ b/crates/wake-core/src/cleanup.rs@@ -2,18 +2,22 @@//! per-target Trash results and a durable journal. No source database writes.use crate::{adapters::{adapter_for, child_outlives_parent, AgentAdapter},- db::{put_back_fingerprint, Store},+ db::{put_back_fingerprint, Store, Tombstone},models::*,+ scanner::{copy_order, scan_files, NullEvents, RootOwners},services::terminal,};use anyhow::{bail, ensure, Context, Result};use serde::{Deserialize, Serialize};use sha2::{Digest, Sha256};use std::{- collections::{BTreeSet, HashMap, HashSet},+ collections::{BTreeMap, BTreeSet, HashMap, HashSet},io::Read,path::{Path, PathBuf},- sync::atomic::{AtomicBool, Ordering},+ sync::{+ atomic::{AtomicBool, Ordering},+ Arc,+ },time::UNIX_EPOCH,};@@ -901,6 +905,150 @@ pub fn trash_sessions(store: &Store, sessions: &[SessionMeta], targets: &[StringOk(moved.is_empty())}+/// Settings → Data 里的一项"已隐藏的会话":同一次删除藏起来、来源还在的会话——用户点的那条+/// 连同随它一起藏起来的子会话+#[derive(Clone, Debug)]+pub struct HiddenGroup {+ /// epoch ms+ pub hidden_at: i64,+ /// 用户点的那条(它解析不出来时由下一条代表)+ pub head: SessionMeta,+ /// 随它一起藏起来的子会话有几条+ pub nested: usize,+ /// 取消隐藏时撤掉的墓碑:按 key(墓碑自己记的、各份副本的)也按墓碑的路径+ keys: Vec<String>,+ paths: Vec<String>,+ /// 重新入库时交给扫描的来源(同一会话的几份副本都在,扫描照常按位次挑)+ refs: Vec<SessionFileRef>,+}++/// 被 Wake 藏起来、来源却还在的会话:墓碑压着、各家此刻还列得出来的。主要是存在别家自己数据里的+/// 会话被"删除"(其实是隐藏,`trash_sessions` 一个文件都没移);被放回原处却认不出指纹的文件、+/// 别的 location 里的副本也在其列——副本按路径或列表给的 key 认,文件名不是会话 id 的家(Gemini)+/// 认不出:墓碑记的是解析后的 key,要把这几家的会话逐个解析才对得上,每次进 Data 页都这么做太重,+/// 而那只发生在会话进了废纸篓、另一个 location 还留着一份时,从废纸篓放回原件就回来了。已经进了废纸篓的列不出来;批量清理有自己的恢复(清理记录里+/// 的 Restore,先核对放回的文件),也不在其列。判据与扫描同一套:路径或 key 压在墓碑下,文件只归+/// 拥有它的最深的根(`RootOwners`),被外壳认领的替身撤了墓碑也回不来、不算。按删除分组、最近的+/// 在前。要把有墓碑的那几家的会话列一遍,放后台跑+pub fn hidden_sessions(+ store: &Store,+ adapters: &[Box<dyn AgentAdapter>],+) -> Result<Vec<HiddenGroup>> {+ let cleanups: HashSet<i64> = history(store)?.iter().map(|batch| batch.stamp).collect();+ let tombstones: Vec<Tombstone> = store+ .tombstones()?+ .into_iter()+ .filter(|t| !cleanups.contains(&t.deleted_at))+ .collect();+ if tombstones.is_empty() {+ return Ok(Vec::new());+ }+ let owners = RootOwners::new(adapters);+ // 只列有墓碑的那几家(老墓碑没记 key,按路径归属认)+ let agents: HashSet<AgentId> = tombstones+ .iter()+ .filter_map(|t| {+ t.key+ .split(':')+ .next()+ .and_then(AgentId::from_str)+ .or_else(|| owners.owner_of(&t.file_path).map(|ix| adapters[ix].agent()))+ })+ .collect();+ let by_path: HashMap<&str, usize> = tombstones+ .iter()+ .enumerate()+ .map(|(ix, t)| (t.file_path.as_str(), ix))+ .collect();+ let by_key: HashMap<&str, usize> = tombstones+ .iter()+ .enumerate()+ .filter(|(_, t)| !t.key.is_empty())+ .map(|(ix, t)| (t.key.as_str(), ix))+ .collect();+ let claimed = store.claimed_keys()?;+ let key_of =+ |ix: usize, r: &SessionFileRef| session_key(r.agent, adapters[ix].host(), &r.native_id);+ // 墓碑(按写入先后)→ 压着的来源+ let mut found: BTreeMap<usize, Vec<(usize, SessionFileRef)>> = BTreeMap::new();+ for (ix, adapter) in adapters.iter().enumerate() {+ if !agents.contains(&adapter.agent()) {+ continue;+ }+ // 这一刻读不出的这一家跳过:列不出来就说不清它还在不在+ let Ok(listed) = adapter.list_session_files() else {+ continue;+ };+ for r in listed {+ let key = key_of(ix, &r);+ let Some(&t) = by_path+ .get(r.file_path.as_str())+ .or_else(|| by_key.get(key.as_str()))+ else {+ continue;+ };+ if owners.admits(ix, &r.file_path) && !claimed.contains(&key) {+ found.entry(t).or_default().push((ix, r));+ }+ }+ }+ // 按删除分组;组内按墓碑写入先后,用户点的那条在前+ let mut deletions: BTreeMap<i64, Vec<(usize, Vec<(usize, SessionFileRef)>)>> = BTreeMap::new();+ for (t, mut copies) in found {+ copies.sort_by(|a, b| copy_order(adapters, a, b));+ deletions+ .entry(tombstones[t].deleted_at)+ .or_default()+ .push((t, copies));+ }+ let mut groups = Vec::new();+ for (hidden_at, members) in deletions.into_iter().rev() {+ // 解析得出来的第一条给这一组起名字,每条按扫描的回退顺序挨个试副本;一条都解析不出+ // 就没法说它是什么,不列+ let Some(head) = members.iter().find_map(|(_, copies)| {+ copies+ .iter()+ .find_map(|(ix, r)| adapters[*ix].parse_session(r).ok())+ .map(|parsed| parsed.meta)+ }) else {+ continue;+ };+ let mut group = HiddenGroup {+ hidden_at,+ head,+ nested: members.len() - 1,+ keys: Vec::new(),+ paths: Vec::new(),+ refs: Vec::new(),+ };+ for (t, copies) in members {+ let tombstone = &tombstones[t];+ if !tombstone.key.is_empty() {+ group.keys.push(tombstone.key.clone());+ }+ group.paths.push(tombstone.file_path.clone());+ for (ix, r) in copies {+ group.keys.push(key_of(ix, &r));+ group.refs.push(r);+ }+ }+ groups.push(group);+ }+ Ok(groups)+}++/// 取消隐藏一组:撤掉压着它们的墓碑,按来源重新入库——扫描照常挑副本、挂回父子关系,+/// 收藏与置顶本来就留着+pub fn unhide(+ store: &Arc<Store>,+ adapters: &[Box<dyn AgentAdapter>],+ group: HiddenGroup,+) -> Result<()> {+ store.release_tombstones(&group.keys, &group.paths)?;+ scan_files(adapters, store, &NullEvents, group.refs);+ Ok(())+}+pub fn execute(store: &Store,adapters: &[Box<dyn AgentAdapter>],diff --git a/crates/wake-core/src/db.rs b/crates/wake-core/src/db.rsindex 25a7fc6..ea26b93 100644--- a/crates/wake-core/src/db.rs+++ b/crates/wake-core/src/db.rs@@ -23,6 +23,15 @@ pub struct RemoteHost {pub last_sync_error: Option<String>,}+/// tombstones 表的一行(`Store::tombstones`):一次删除记下的会话。key 在老库里可能为空+#[derive(Debug, Clone)]+pub struct Tombstone {+ pub file_path: String,+ pub key: String,+ /// epoch ms;同一次删除(连同随它一起删的子会话)是同一个值+ pub deleted_at: i64,+}+const DDL: &str = r#"CREATE TABLE IF NOT EXISTS schema_meta (key TEXT PRIMARY KEY, value TEXT);@@ -1133,6 +1142,44 @@ impl Store {Ok(stmt.exists(params![file_path])?)}+ /// 墓碑表的全部行,按写入先后(rowid:一次删除里先写用户点的那条,随它一起删的子会话+ /// 在后)。Settings → Data 的"已隐藏的会话"拿它对照各家此刻还列得出的会话+ /// (`cleanup::hidden_sessions`)+ pub fn tombstones(&self) -> Result<Vec<Tombstone>> {+ let conn = self.read.lock().unwrap();+ let mut stmt = conn.prepare(+ "SELECT file_path, COALESCE(key, ''), COALESCE(deleted_at, 0) FROM tombstones+ ORDER BY rowid",+ )?;+ let rows = stmt.query_map([], |r| {+ Ok(Tombstone {+ file_path: r.get(0)?,+ key: r.get(1)?,+ deleted_at: r.get(2)?,+ })+ })?;+ Ok(rows.collect::<rusqlite::Result<_>>()?)+ }++ /// 取消隐藏:撤掉压着这些会话的墓碑——按 key 也按路径,同一会话别的副本记下的那行一并撤,+ /// 否则扫描照样挡着它(`cleanup::unhide`)+ pub fn release_tombstones(&self, keys: &[String], file_paths: &[String]) -> Result<()> {+ let mut conn = self.write.lock().unwrap();+ let tx = conn.transaction()?;+ {+ let mut by_key = tx.prepare_cached("DELETE FROM tombstones WHERE key = ?1")?;+ for key in keys {+ by_key.execute(params![key])?;+ }+ let mut by_path = tx.prepare_cached("DELETE FROM tombstones WHERE file_path = ?1")?;+ for path in file_paths {+ by_path.execute(params![path])?;+ }+ }+ tx.commit()?;+ Ok(())+ }+/// 放回识别:磁盘上这份文件的指纹(`put_back_fingerprint`)与删除前记下的一致——用户/// 把它从废纸篓放回原处了,撤掉墓碑(路径与 key 是同一行)。返回撤没撤。比较只在这条/// DELETE 的 WHERE 里:没记指纹的墓碑(批量清理、老墓碑、库存型会话)永远对不上,agentdiff --git a/crates/wake-core/src/scanner.rs b/crates/wake-core/src/scanner.rsindex b194c56..23136e6 100644--- a/crates/wake-core/src/scanner.rs+++ b/crates/wake-core/src/scanner.rs@@ -297,6 +297,56 @@ pub fn run_scan(result}+/// 归属表:(根, 实例下标)。跨家/跨实例的重叠根下(自定义 location 可以落进别家树,pi/kiro 的+/// 递归枚举会吞下界内一切 .jsonl),一个文件只属于**最长根**的那个实例——别家枚举到也丢弃,+/// 与 watcher 的最长根分派同一语义。不做这道过滤,两家会对同一 file_path 轮流写库(UNIQUE+/// 冲突 + 错误归属,2026-08-24 Codex review)。全量枚举与"已隐藏的会话"共用+pub(crate) struct RootOwners(Vec<(String, usize)>);++impl RootOwners {+ pub(crate) fn new(adapters: &[Box<dyn AgentAdapter>]) -> Self {+ Self(+ adapters+ .iter()+ .enumerate()+ .flat_map(|(ix, a)| {+ a.data_roots()+ .into_iter()+ .map(move |root| (root.to_string_lossy().to_string(), ix))+ })+ .collect(),+ )+ }++ pub(crate) fn owner_of(&self, path: &str) -> Option<usize> {+ self.0+ .iter()+ .filter(|(root, _)| crate::adapters::path_owns(root, path))+ .max_by_key(|(root, _)| root.len())+ .map(|(_, ix)| *ix)+ }++ /// 实例 `ix` 枚举到的这条引用归不归它:没有更深的根拥有它。无任何根认领的(越界枚举或+ /// 合成测试)保守放行给枚举者,只裁决"确有更深的根拥有它"的情形+ pub(crate) fn admits(&self, ix: usize, path: &str) -> bool {+ self.owner_of(path).is_none_or(|owner| owner == ix)+ }+}++/// 同一会话几份副本的先后:副本 `dedup_rank` 小者、mtime 新者、平局路径字典序小者。全量枚举的+/// 候选排序与"已隐藏的会话"挑哪份展示共用;写事务里的 `write_session_guarded` 是同一把尺子+pub(crate) fn copy_order(+ adapters: &[Box<dyn AgentAdapter>],+ (ia, a): &(usize, SessionFileRef),+ (ib, b): &(usize, SessionFileRef),+) -> std::cmp::Ordering {+ adapters[*ia]+ .dedup_rank(&a.file_path)+ .cmp(&adapters[*ib].dedup_rank(&b.file_path))+ .then_with(|| b.mtime_ms.cmp(&a.mtime_ms))+ .then_with(|| a.file_path.cmp(&b.file_path))+}+/// 这条路径还压在墓碑下吗。用户从废纸篓放回的文件(磁盘上这份的指纹与删除前记下的对得上,/// 比较在 `Store::release_put_back` 里)当场撤掉墓碑放行,放回去的会话在下一轮扫描或 watcher/// 收到放回事件时就重新入库。压着墓碑的路径才去 stat。全量枚举与增量两处共用@@ -397,24 +447,8 @@ fn run_scan_inner(}let mut queue: Vec<WorkItem> = Vec::new();- // 归属表:(根, 实例下标)。跨家/跨实例的重叠根下(自定义 location 可以- // 落进别家树,pi/kiro 的递归枚举会吞下界内一切 .jsonl),一个文件只属于- // **最长根**的那个实例——别家枚举到也丢弃,与 watcher 的最长根分派同一- // 语义。不做这道过滤,两家会对同一 file_path 轮流写库(UNIQUE 冲突 +- // 错误归属,2026-08-24 Codex review)- let mut roots: Vec<(String, usize)> = Vec::new();- for (ix, a) in adapters.iter().enumerate() {- for r in a.data_roots() {- roots.push((r.to_string_lossy().to_string(), ix));- }- }- let owner_of = |path: &str| -> Option<usize> {- roots- .iter()- .filter(|(root, _)| crate::adapters::path_owns(root, path))- .max_by_key(|(root, _)| root.len())- .map(|(_, ix)| *ix)- };+ // 一个文件只归数据根最长的那个实例(`RootOwners`)+ let owners = RootOwners::new(adapters);// 墓碑查询与去重域共用的会话 key:按枚举实例的 host 构造(远程三段),// 下面四处同一口径,别各自 formatlet key_of =@@ -447,9 +481,7 @@ fn run_scan_inner(// 被外壳产品认领的替身(Craft 的 Claude 后端在 ~/.claude 落的那份)不索引:// 不在 seen_paths 里,库里若还有它的行,下面的删除检测一并清掉.filter(|r| !claimed.contains(&key_of(ix, r)))- // 无任何根认领的引用(越界枚举或合成测试)保守放行给枚举者;- // 过滤只裁决"确有更深的根拥有它"的情形- .filter(|r| owner_of(&r.file_path).is_none_or(|o| o == ix))+ .filter(|r| owners.admits(ix, &r.file_path)).collect();per_adapter.push(refs);}@@ -473,13 +505,7 @@ fn run_scan_inner(}}for v in candidates.values_mut() {- v.sort_by(|(ia, a), (ib, b)| {- adapters[*ia]- .dedup_rank(&a.file_path)- .cmp(&adapters[*ib].dedup_rank(&b.file_path))- .then_with(|| b.mtime_ms.cmp(&a.mtime_ms))- .then_with(|| a.file_path.cmp(&b.file_path))- });+ v.sort_by(|a, b| copy_order(adapters, a, b));}for (ix, refs) in per_adapter.iter_mut().enumerate() {refs.retain(|r| {@@ -575,7 +601,9 @@ fn run_scan_inner(// 删除检测:库里有但磁盘没了。枚举失败的那几家这一轮不知道在不在,归它们的行不动let mut pruned = false;for (path, (_, _, key)) in &known {- if !seen_paths.contains(path) && !owner_of(path).is_some_and(|ix| frozen.contains(&ix)) {+ if !seen_paths.contains(path)+ && !owners.owner_of(path).is_some_and(|ix| frozen.contains(&ix))+ {let _ = store.remove_session(key);pruned = true;}diff --git a/crates/wake-core/tests/scanner_finale.rs b/crates/wake-core/tests/scanner_finale.rsindex d42a084..5b5871d 100644--- a/crates/wake-core/tests/scanner_finale.rs+++ b/crates/wake-core/tests/scanner_finale.rs@@ -1982,6 +1982,87 @@ fn grok_bot_card_stands_in_when_the_cache_drops_a_conversation() {"缓存文件还在原处,隐藏照样生效(副本与卡片同一个 key)");assert_eq!(rows(), 4);++ // 隐藏的会话列在 Settings → Data(缓存文件还在原处);取消隐藏当场回来,不等下一轮扫描+ let mut groups = wake_core::cleanup::hidden_sessions(&store, &adapters).unwrap();+ assert_eq!(groups.len(), 1);+ let group = groups.remove(0);+ assert_eq!(+ (+ group.head.key.as_str(),+ group.head.title.as_str(),+ group.nested+ ),+ (key.as_str(), "Ada Lovelace", 0)+ );+ wake_core::cleanup::unhide(&store, &adapters, group).unwrap();+ assert_eq!(+ store+ .get_session(&key)+ .unwrap()+ .expect("取消隐藏")+ .file_path,+ replica.to_string_lossy()+ );+ assert_eq!(rows(), 5);+ assert!(wake_core::cleanup::hidden_sessions(&store, &adapters)+ .unwrap()+ .is_empty());++ // 再藏一次,这回副本坏了、卡片还在:与扫描同样按顺序退到卡片,这一组照样列得出、取消隐藏由卡片接回+ let s = store.get_session(&key).unwrap().unwrap();+ assert!(wake_core::cleanup::trash_sessions(&store, &[s], &[]).unwrap());+ std::fs::write(&replica, b"{ not json").unwrap();+ let mut groups = wake_core::cleanup::hidden_sessions(&store, &adapters).unwrap();+ assert_eq!(groups.len(), 1, "副本读不出,由卡片代表这一组");+ let group = groups.remove(0);+ assert_eq!(group.head.title, "Ada Lovelace");+ wake_core::cleanup::unhide(&store, &adapters, group).unwrap();+ let s = store.get_session(&key).unwrap().expect("卡片接回");+ assert!(s.file_path.ends_with(&format!("#{ID}")), "{}", s.file_path);+}++/// 隐藏一整棵(Claude Code 会话连同它派的子代理,一个文件都不移)是一项:用户点的那条在前,+/// 取消隐藏整棵一起回来、子代理挂回原处。进了废纸篓的(文件已经不在)不在其列+#[test]+fn hidden_trees_come_back_together() {+ let home = tempfile::tempdir().unwrap();+ let projects = home.path().join("projects");+ let (project, a, b) = common::stage_claude_branch(&projects);+ let (task, step) = common::stage_claude_subagents(&project, &a, "o", "toolu_o");+ let adapters: Vec<Box<dyn AgentAdapter>> =+ vec![ClaudeAdapter::new().with_custom_root(projects)];+ let dir = tempfile::tempdir().unwrap();+ let store = temp_store(dir.path());+ run_scan(&adapters, &store, &Recorder::new(), true).unwrap();+ let key = |id: &str| format!("claude-code:{id}");+ let original = store.get_session(&key(&a)).unwrap().unwrap();++ let plan = wake_core::cleanup::delete_plan(&store, &adapters, &original).unwrap();+ assert!(wake_core::cleanup::trash_sessions(&store, &plan.sessions, &[]).unwrap());+ // 分支是另一棵、照常删进废纸篓:它不在已隐藏的会话里+ let branch = store.get_session(&key(&b)).unwrap().unwrap();+ std::fs::remove_file(&branch.file_path).unwrap();+ wake_core::cleanup::trash_sessions(&store, &[branch], &[]).unwrap();+ run_scan(&adapters, &store, &Recorder::new(), true).unwrap();++ let mut groups = wake_core::cleanup::hidden_sessions(&store, &adapters).unwrap();+ assert_eq!(groups.len(), 1, "分支的文件已经不在,不算隐藏");+ let group = groups.remove(0);+ assert_eq!(group.head.key, key(&a), "用户点的那条在前");+ assert_eq!(group.nested, 2, "它派的两个子代理随它一起");++ wake_core::cleanup::unhide(&store, &adapters, group).unwrap();+ for child in [&task, &step] {+ assert_eq!(+ store.parent_key_of(&key(child)).unwrap(),+ Some(key(&a)),+ "{child} 挂回原处"+ );+ }+ assert!(wake_core::cleanup::hidden_sessions(&store, &adapters)+ .unwrap()+ .is_empty());}/// Cursor 两源端到端:转录带正文的会话固定由 CLI 源胜出(它有 slug 可反推diff --git a/crates/wake/locales/zh-Hans.json b/crates/wake/locales/zh-Hans.jsonindex 664673e..aeb27b7 100644--- a/crates/wake/locales/zh-Hans.json+++ b/crates/wake/locales/zh-Hans.json@@ -240,6 +240,7 @@"Remove": "移除","Remove failed": "移除失败","Remove {}?": "移除 {}?",+ "Its sessions leave the index and the local cache is deleted. Nothing on the remote host is touched.": "它的会话会移出索引,本机的缓存会删掉。远程主机上的东西一概不动。","Restore defaults": "恢复默认","Restore failed": "恢复失败","Restored": "已还原",@@ -303,9 +304,9 @@"This path is already in Wake's memory locations": "这个路径已经在 Wake 的记忆位置里了","This session and {} nested session will be moved to {1}. Put them back from {1} and they show up again.": "此会话及其 {0} 个子会话将被移到{1}。从{1}放回原处后,它们会重新出现。","This session and {} nested sessions will be moved to {1}. Put them back from {1} and they show up again.": "此会话及其 {0} 个子会话将被移到{1}。从{1}放回原处后,它们会重新出现。",- "This session and {} nested session are stored in {1}'s own database, which Wake never changes, so no files are moved. Wake just stops listing them.": "此会话及其 {0} 个子会话存放在 {1} 自己的数据库里,Wake 从不改动它,所以不会移动任何文件,只是不再列出它们。",- "This session and {} nested sessions are stored in {1}'s own database, which Wake never changes, so no files are moved. Wake just stops listing them.": "此会话及其 {0} 个子会话存放在 {1} 自己的数据库里,Wake 从不改动它,所以不会移动任何文件,只是不再列出它们。",- "This session is stored in {}'s own database, which Wake never changes, so no files are moved. Wake just stops listing it.": "这个会话存放在 {} 自己的数据库里,Wake 从不改动它,所以不会移动任何文件,只是不再列出它。",+ "This session and {} nested session are stored in {1}'s own data, which Wake never changes, so no files are moved. Wake just stops listing them; you can unhide them in Settings → Data.": "此会话及其 {0} 个子会话存放在 {1} 自己的数据里,Wake 从不改动它,所以不会移动任何文件,只是不再列出它们;可以在 设置 → 数据 里取消隐藏。",+ "This session and {} nested sessions are stored in {1}'s own data, which Wake never changes, so no files are moved. Wake just stops listing them; you can unhide them in Settings → Data.": "此会话及其 {0} 个子会话存放在 {1} 自己的数据里,Wake 从不改动它,所以不会移动任何文件,只是不再列出它们;可以在 设置 → 数据 里取消隐藏。",+ "This session is stored in {}'s own data, which Wake never changes, so no files are moved. Wake just stops listing it; you can unhide it in Settings → Data.": "这个会话存放在 {} 自己的数据里,Wake 从不改动它,所以不会移动任何文件,只是不再列出它;可以在 设置 → 数据 里取消隐藏。","Thu": "周四","Thursdays": "周四","Today": "今天",@@ -499,5 +500,11 @@"Run in a terminal to install the Wake plugin": "在终端里运行,安装 Wake 插件","Copy the command that adds wake-cli to PATH": "拷贝把 wake-cli 加进 PATH 的命令","Codex plugin": "Codex 插件",- "Run in a terminal, then trust its hook in Codex's /hooks": "在终端里运行,再在 Codex 的 /hooks 里信任它的钩子"+ "Run in a terminal, then trust its hook in Codex's /hooks": "在终端里运行,再在 Codex 的 /hooks 里信任它的钩子",+ "Hidden sessions": "已隐藏的会话",+ "No hidden sessions": "没有隐藏的会话",+ "Unhide": "取消隐藏",+ "Hidden {}": "隐藏于 {}",+ "Couldn't list hidden sessions: {}": "列不出已隐藏的会话:{}",+ "Couldn't unhide: {}": "取消隐藏失败:{}"}diff --git a/crates/wake/src/format.rs b/crates/wake/src/format.rsindex 8248885..b39f353 100644--- a/crates/wake/src/format.rs+++ b/crates/wake/src/format.rs@@ -56,13 +56,30 @@ fn smart_time_from(ts: i64, now: &DateTime<Local>) -> String {dt.format(t("%-I:%M %p")).to_string()} else if dt.date_naive() == now.date_naive() - Duration::days(1) {t("Yesterday").to_string()- } else if dt.year() == now.year() {- dt.format(t("%b %-d")).to_string()} else {- dt.format(t("%b %-d, %Y")).to_string()+ calendar_date(&dt, now)}}+/// epoch ms → 日期("Oct 12",不是今年的带上年份),给嵌在句子里的用("Hidden {}"):+/// smart_time 的 "Yesterday" / "Just now" 是独立标签,放进句子里大小写不对+pub fn short_date(ts: i64) -> String {+ match Local.timestamp_millis_opt(ts).single() {+ Some(dt) if ts > 0 => calendar_date(&dt, &Local::now()),+ _ => String::new(),+ }+}++/// 日期,今年的不带年份(smart_time 一天以前的那两档与 short_date 共用)+fn calendar_date(dt: &DateTime<Local>, now: &DateTime<Local>) -> String {+ let format = if dt.year() == now.year() {+ t("%b %-d")+ } else {+ t("%b %-d, %Y")+ };+ dt.format(format).to_string()+}+/// 详情页时间信息:保留到秒,避免相对时间丢失会话的精确时间上下文。pub fn abs_date(ts: i64) -> String {if ts <= 0 {diff --git a/crates/wake/src/settings.rs b/crates/wake/src/settings.rsindex b38cc05..9cefca0 100644--- a/crates/wake/src/settings.rs+++ b/crates/wake/src/settings.rs@@ -158,6 +158,35 @@ fn select_control(.into_any_element()}+/// 页内区块标题(Data 页的 Storage / Hidden sessions、Connect 页的各块)+fn section_title(label: impl Into<SharedString>, cx: &App) -> Div {+ div()+ .flex_shrink_0()+ .text_size(FONT_CAPTION)+ .font_semibold()+ .text_color(cx.theme().foreground)+ .child(label.into())+}++/// 圆角卡,行与行之间一条 hairline(Session / Memory locations 的每一家、Data 页已隐藏的会话)+fn hairline_card(rows: impl IntoIterator<Item = AnyElement>, cx: &App) -> Div {+ let theme = cx.theme();+ v_flex()+ .w_full()+ .flex_shrink_0()+ .overflow_hidden()+ .rounded(theme.radius_lg)+ .border_1()+ .border_color(theme.border)+ .bg(theme.popover)+ .children(rows.into_iter().enumerate().map(|(ix, row)| {+ div()+ .w_full()+ .when(ix > 0, |this| this.border_t_1().border_color(theme.border))+ .child(row)+ }))+}+/// "一张卡一行"的信息卡(Data、Connect、Updates 的卡与 General / Appearance 的设置行/// 共用):popover 底圆角卡,行高由调用方给(设置行 72、其余 84),主信息 FONT_BODY,/// 副行由调用方给(caption 级),右侧一个操作@@ -812,12 +841,7 @@ impl SettingsView {];let rows = [- div()- .text_size(FONT_CAPTION)- .font_semibold()- .text_color(theme.foreground)- .child(t("Storage"))- .into_any_element(),+ section_title(t("Storage"), cx).into_any_element(),settings_info_card(t("Wake data"),details,@@ -826,6 +850,10 @@ impl SettingsView {cx,).into_any_element(),+ section_title(t("Hidden sessions"), cx)+ .pt(SPACE_MD)+ .into_any_element(),+ self.render_hidden_sessions(cx),];Self::rows_page("settings-data-scroll",@@ -837,6 +865,123 @@ impl SettingsView {)}+ /// Data 页的"已隐藏的会话":Wake 不再列出、来源却还在的会话(删除存在别家自己数据里的+ /// 会话其实是隐藏),一次隐藏一行——随它一起藏的子会话算在里面——右端取消隐藏。要把各家的+ /// 会话列一遍才对得出,进页时 Workbench 在后台对(`refresh_hidden_sessions`)+ fn render_hidden_sessions(&self, cx: &Context<Self>) -> AnyElement {+ let theme = cx.theme();+ let hidden = self.workbench.read(cx).hidden_sessions();+ let note = |text: SharedString, color: Hsla| {+ h_flex()+ .min_h(zpx(48.))+ .px(SPACE_LG)+ .items_center()+ .text_size(FONT_CAPTION)+ .text_color(color)+ .child(text)+ .into_any_element()+ };+ let mut rows: Vec<AnyElement> = Vec::new();+ if let Some(error) = &hidden.error {+ rows.push(note(error.clone(), theme.danger));+ }+ if hidden.groups.is_empty() {+ if hidden.checking {+ rows.push(note(t("Checking…").into(), theme.muted_foreground));+ } else if hidden.error.is_none() {+ rows.push(note(t("No hidden sessions").into(), theme.muted_foreground));+ }+ }+ rows.extend(+ hidden+ .groups+ .iter()+ .enumerate()+ .map(|(ix, group)| self.render_hidden_row(ix, group, hidden.unhiding, cx)),+ );+ hairline_card(rows, cx).into_any_element()+ }++ /// 已隐藏的一行:品牌图 + 用户点的那条会话的标题,副行项目 · 一起藏的子会话数 · 哪天藏的+ fn render_hidden_row(+ &self,+ ix: usize,+ group: &wake_core::cleanup::HiddenGroup,+ unhiding: Option<i64>,+ cx: &Context<Self>,+ ) -> AnyElement {+ let theme = cx.theme();+ let head = &group.head;+ let mut caption = vec![if head.project_name.is_empty() {+ t("Unknown project").to_string()+ } else {+ head.project_name.clone()+ }];+ if group.nested > 0 {+ caption.push(crate::workbench::nested_tally(group.nested as i64));+ }+ caption.push(crate::tf!(+ "Hidden {}",+ crate::format::short_date(group.hidden_at)+ ));+ let workbench = self.workbench.clone();+ let hidden_at = group.hidden_at;+ h_flex()+ .id(("settings-hidden-row", ix))+ .min_h(zpx(60.))+ .w_full()+ .px(SPACE_LG)+ .gap(SPACE_MD)+ .items_center()+ .child(+ h_flex()+ .flex_1()+ .min_w_0()+ .gap(ICON_TEXT_GAP)+ .items_center()+ .child(+ img(head.agent.brand_icon(theme.mode.is_dark()))+ .size(zpx(17.))+ .flex_shrink_0(),+ )+ .child(+ v_flex()+ .flex_1()+ .min_w_0()+ .gap(zpx(3.))+ .child(+ div()+ .w_full()+ .truncate()+ .text_size(FONT_BODY)+ .text_color(theme.foreground)+ .child(head.title.clone()),+ )+ .child(+ div()+ .w_full()+ .truncate()+ .text_size(FONT_CAPTION)+ .text_color(theme.muted_foreground)+ .child(caption.join(" · ")),+ ),+ ),+ )+ .child(+ settings_button(+ Button::new(("settings-unhide", ix))+ .label(t("Unhide"))+ .loading(unhiding == Some(hidden_at))+ .disabled(unhiding.is_some()),+ cx,+ )+ .on_click(move |_, _, cx| {+ workbench.update(cx, |this, cx| this.unhide_sessions(hidden_at, cx));+ }),+ )+ .into_any_element()+ }+/// Settings → Connect 的复制钮:只有图标,说明在 tooltip——卡上已经摆着要复制的东西或/// 一句用法,按钮再写一遍 "Copy path" / "Copy command" 是重复(用户 2026-10-09 定,整页/// 统一)。写剪贴板后图标原地变对勾、tooltip 说 Copied,1.6s 复原@@ -1081,14 +1226,6 @@ impl SettingsView {.into_any_element()};- let section = |label: &'static str| {- div()- .flex_shrink_0()- .text_size(FONT_CAPTION)- .font_semibold()- .text_color(theme.foreground)- .child(label)- };// 区块标题右侧的文档链接:MCP 面与命令行面各链自己那份,页尾只放一条// 会让读 CLI 那半页的人点进 MCP 的参考里。设置窗里不放文档,所以这页// 只有状态、动作与这几个去处,没有解释性的散文(用户 2026-09-11 定)@@ -1097,7 +1234,7 @@ impl SettingsView {.flex_shrink_0().gap(SPACE_SM).items_center()- .child(section(label).flex_1())+ .child(section_title(label, cx).flex_1()).children(guide.map(|(id, url)| {div().id(id)@@ -1569,21 +1706,7 @@ impl SettingsView {.child(agent.display_name()),),)- .child(- v_flex()- .w_full()- .overflow_hidden()- .rounded(theme.radius_lg)- .border_1()- .border_color(theme.border)- .bg(theme.popover)- .children(rows.into_iter().enumerate().map(|(ix, row)| {- div()- .w_full()- .when(ix > 0, |this| this.border_t_1().border_color(theme.border))- .child(row)- })),- )+ .child(hairline_card(rows, cx)).into_any_element()}diff --git a/crates/wake/src/ui.rs b/crates/wake/src/ui.rsindex 56075d5..3f7ef29 100644--- a/crates/wake/src/ui.rs+++ b/crates/wake/src/ui.rs@@ -10,12 +10,12 @@ use std::ops::{Add, Mul, Neg, Sub};use gpui::{div, px, AbsoluteLength, AnyElement, App, DefiniteLength, Div, FontWeight, Global, Hsla,- InteractiveElement as _, IntoElement, Length, MouseButton, ParentElement as _, Pixels, Styled,- Window, WindowId,+ InteractiveElement as _, IntoElement, Length, MouseButton, ParentElement as _, Pixels,+ SharedString, Styled, Window, WindowId,};use gpui_component::{- button::Button,- dialog::{AlertDialog, Dialog},+ button::{Button, ButtonVariant},+ dialog::{AlertDialog, Dialog, DialogButtonProps},h_flex, ActiveTheme as _, Root, Sizable as _, WindowExt as _,};@@ -456,6 +456,17 @@ where});}+/// 破坏性确认框的按钮:取消 + 点名动作的 danger 主按钮,不留裸 "OK"。`button_props` 会整个+/// 换掉 `AlertDialog::confirm()` 开的取消按钮(confirm 只是把 show_cancel 置真),所以取消在+/// 这里开(用户 2026-10-13 报:隐藏确认框只有 Hide、没有 Cancel)+pub fn danger_buttons(ok: impl Into<SharedString>) -> DialogButtonProps {+ DialogButtonProps::default()+ .show_cancel(true)+ .cancel_text(crate::i18n::t("Cancel"))+ .ok_text(ok)+ .ok_variant(ButtonVariant::Danger)+}+/// 定宽栏(侧栏、会话流、设置侧栏,合计设计宽 `rails`)的缩放倍数:跟着界面缩放放大,/// 但给窗口其余部分留出它们在 100% 档最小窗口里拿到的宽度(`min_window − rails`)——/// 窗口最小尺寸只在开窗那一刻定、运行时改不了,档位一高就能把其余部分挤没;不够宽时diff --git a/crates/wake/src/workbench.rs b/crates/wake/src/workbench.rsindex c82536c..77b4787 100644--- a/crates/wake/src/workbench.rs+++ b/crates/wake/src/workbench.rs@@ -897,10 +897,8 @@ impl ListDelegate for SessionsDelegate {.flex_shrink_0().child(format!("{child_count}")).tooltip(move |window, cx| {- gpui_component::tooltip::Tooltip::new(crate::tp!(- "{} nested session",- "{} nested sessions",- child_count+ gpui_component::tooltip::Tooltip::new(nested_tally(+ child_count,)).build(window, cx)}),@@ -2220,6 +2218,8 @@ pub struct Workbench {settings_window: Option<AnyWindowHandle>,settings_page: SettingsPage,update_status: UpdateStatus,+ /// Settings → Data 的"已隐藏的会话":要把各家的会话列一遍,进 Data 页时在后台对+ hidden: HiddenSessions,total_sessions: i64,list_state: Entity<ListState<SessionsDelegate>>,@@ -2503,6 +2503,19 @@ pub(crate) struct DataSettingsSnapshot {pub(crate) session_count: i64,}+/// Settings → Data 的"已隐藏的会话"(`cleanup::hidden_sessions`)+#[derive(Default)]+pub(crate) struct HiddenSessions {+ pub(crate) groups: Vec<wake_core::cleanup::HiddenGroup>,+ /// 正在后台对(进 Data 页就起一轮)+ pub(crate) checking: bool,+ /// 对的期间又隐藏或取消隐藏了会话:这一轮读到的墓碑已经过时,结果作废、跑完再对一遍+ recheck: bool,+ /// 正在取消隐藏的那一组(按 hidden_at 认)+ pub(crate) unhiding: Option<i64>,+ pub(crate) error: Option<SharedString>,+}+/// Settings → Remote hosts 的一行(库表 remote_hosts + 会话计数拼装)#[derive(Clone)]pub(crate) struct RemoteHostRow {@@ -2681,6 +2694,7 @@ impl Workbench {settings_window: None,settings_page: SettingsPage::General,update_status: UpdateStatus::Idle,+ hidden: HiddenSessions::default(),total_sessions: 0,list_state,palette_list,@@ -3075,10 +3089,114 @@ impl Workbench {}pub(crate) fn select_settings_page(&mut self, page: SettingsPage, cx: &mut Context<Self>) {+ let changed = self.settings_page != page;self.settings_page = page;+ if changed {+ self.refresh_hidden_sessions(cx);+ }cx.notify();}+ pub(crate) fn hidden_sessions(&self) -> &HiddenSessions {+ &self.hidden+ }++ /// Settings 的 Data 页要显示了(或正显示着):在后台重新对一遍已隐藏的会话(各家的会话要列+ /// 一遍)。不在 Data 页就不对;正在对就记下 `recheck`,这一轮跑完再来一遍+ fn refresh_hidden_sessions(&mut self, cx: &mut Context<Self>) {+ if self.settings_page != SettingsPage::Data {+ return;+ }+ if self.hidden.checking {+ self.hidden.recheck = true;+ return;+ }+ self.hidden.checking = true;+ let store = self.store.clone();+ let adapters = self.adapters.clone();+ let task =+ cx.background_spawn(+ async move { wake_core::cleanup::hidden_sessions(&store, &adapters) },+ );+ cx.spawn(async move |this, cx| {+ let result = task.await;+ this.update(cx, |this, cx| {+ this.hidden.checking = false;+ if std::mem::take(&mut this.hidden.recheck) {+ this.refresh_hidden_sessions(cx);+ return;+ }+ match result {+ Ok(groups) => {+ this.hidden.groups = groups;+ this.hidden.error = None;+ }+ Err(e) => {+ this.hidden.error =+ Some(crate::tf!("Couldn't list hidden sessions: {}", e).into())+ }+ }+ cx.notify();+ })+ .ok();+ })+ .detach();+ }++ /// 取消隐藏一组(`cleanup::unhide`:撤墓碑、重新入库),回来后刷新列表与侧栏计数+ pub(crate) fn unhide_sessions(&mut self, hidden_at: i64, cx: &mut Context<Self>) {+ if self.hidden.unhiding.is_some() {+ return;+ }+ let Some(group) = self+ .hidden+ .groups+ .iter()+ .find(|group| group.hidden_at == hidden_at)+ .cloned()+ else {+ return;+ };+ self.hidden.unhiding = Some(hidden_at);+ self.hidden.error = None;+ cx.notify();+ let store = self.store.clone();+ let adapters = self.adapters.clone();+ let roster = adapters.clone();+ let lock = self.index_lock.clone();+ let task = cx.background_spawn(async move {+ let _lock = lock;+ wake_core::cleanup::unhide(&store, &adapters, group)+ });+ cx.spawn(async move |this, cx| {+ let result = task.await;+ this.update(cx, |this, cx| {+ this.hidden.unhiding = None;+ match result {+ Ok(()) => {+ this.hidden+ .groups+ .retain(|group| group.hidden_at != hidden_at);+ // 正在对的那一轮读的是取消隐藏之前的墓碑,会把这一组列回来+ if this.hidden.checking {+ this.hidden.recheck = true;+ }+ // 取消隐藏期间换了来源配置(停用、移除了 location):旧 roster 可能把新配置下+ // 不该在的会话写了回来,按新配置补一轮增量扫描清掉+ if !Arc::ptr_eq(&roster, &this.adapters) {+ this.kick_incremental_scan(cx);+ }+ this.refresh(cx);+ }+ Err(e) => this.hidden.error = Some(crate::tf!("Couldn't unhide: {}", e).into()),+ }+ cx.notify();+ })+ .ok();+ })+ .detach();+ }+pub(crate) fn open_about(&mut self, cx: &mut Context<Self>) {self.settings_page = SettingsPage::About;cx.notify();@@ -3133,6 +3251,7 @@ impl Workbench {/// 之后:Settings 首帧会读取 location 快照,同步开窗会反读仍被独占借用/// 的 Workbench,触发 GPUI double lease。pub(crate) fn open_settings(&mut self, cx: &mut Context<Self>) {+ self.refresh_hidden_sessions(cx);let workbench = cx.entity();cx.defer(move |cx| Self::show_settings_window(workbench, cx));}@@ -4398,20 +4517,12 @@ impl Workbench {.font_semibold().child(crate::tf!("Remove {}?", name)),)- .confirm()- .button_props(- gpui_component::dialog::DialogButtonProps::default()- .ok_text(t("Remove"))- .ok_variant(gpui_component::button::ButtonVariant::Danger),- )+ .button_props(crate::ui::danger_buttons(t("Remove"))).child(div().text_size(FONT_BODY).text_color(theme.foreground)- .child(- "Its sessions leave the index and the local cache is deleted. \- Nothing on the remote host is touched.",- ),+ .child(t("Its sessions leave the index and the local cache is deleted. Nothing on the remote host is touched.")),).on_ok(move |_, window, cx| {entity.update(cx, |this, cx| {@@ -5500,6 +5611,10 @@ impl Workbench {window.push_notification(Notification::success(message), cx);// 立刻把它从列表摘掉,不等 watcher 那 800ms 去抖this.refresh(cx);+ // Settings 正开在 Data 页:已隐藏的会话跟着多一项+ if hidden && this.settings_window.is_some() {+ this.refresh_hidden_sessions(cx);+ }}Err(e) => window.push_notification(Notification::error(crate::tf!("Delete failed: {}", e)), cx),@@ -5554,8 +5669,8 @@ impl Workbench {(true, true) => (t("Hide this session tree?"),crate::tp!(- "This session and {} nested session are stored in {1}'s own database, which Wake never changes, so no files are moved. Wake just stops listing them.",- "This session and {} nested sessions are stored in {1}'s own database, which Wake never changes, so no files are moved. Wake just stops listing them.",+ "This session and {} nested session are stored in {1}'s own data, which Wake never changes, so no files are moved. Wake just stops listing them; you can unhide them in Settings → Data.",+ "This session and {} nested sessions are stored in {1}'s own data, which Wake never changes, so no files are moved. Wake just stops listing them; you can unhide them in Settings → Data.",nested_count,meta.agent.display_name()),@@ -5563,7 +5678,7 @@ impl Workbench {(true, false) => (t("Hide this session?"),crate::tf!(- "This session is stored in {}'s own database, which Wake never changes, so no files are moved. Wake just stops listing it.",+ "This session is stored in {}'s own data, which Wake never changes, so no files are moved. Wake just stops listing it; you can unhide it in Settings → Data.",meta.agent.display_name()),),@@ -5588,15 +5703,11 @@ impl Workbench {.font_semibold().child(title),)- // 破坏性确认:主按钮点名动作并用 danger 形态,不留裸 "OK"。- // .confirm() 必须显式调用——Dialog 只在设了 footer 时才渲染- // 按钮行,只挂 on_ok 的弹窗实际无按钮(仅回车可确认)- .confirm()- .button_props(- gpui_component::dialog::DialogButtonProps::default()- .ok_text(if hide_only { t("Hide") } else { move_to_trash() })- .ok_variant(gpui_component::button::ButtonVariant::Danger),- )+ .button_props(crate::ui::danger_buttons(if hide_only {+ t("Hide")+ } else {+ move_to_trash()+ })).child(v_flex().gap(SPACE_SM)@@ -9602,6 +9713,11 @@ pub(crate) fn file_tally(n: i64) -> String {crate::tp!("{} file", "{} files", n)}+/// "N nested sessions"(会话行的子会话数提示、Clean up 的树、Data 页已隐藏的会话)+pub(crate) fn nested_tally(n: i64) -> String {+ crate::tp!("{} nested session", "{} nested sessions", n)+}+/// 远程会话的 @host 徽章:填充胶囊但用 primary 淡底 + primary 字,与紧邻的 muted/// 项目胶囊拉开(描边版、muted 填充版都试过,用户否决 2026-09-03)。列表行与 ⌘K/// 结果行共用;详情页的描边版是有意的第三种diff --git a/crates/wake/src/workbench/cleanup.rs b/crates/wake/src/workbench/cleanup.rsindex 0331f18..9608576 100644--- a/crates/wake/src/workbench/cleanup.rs+++ b/crates/wake/src/workbench/cleanup.rs@@ -722,14 +722,7 @@ impl Workbench {};dialog.title(div().text_size(FONT_HEADING).font_semibold().child(title))- .confirm()- .button_props(- gpui_component::dialog::DialogButtonProps::default()- .show_cancel(true)- .cancel_text(t("Cancel"))- .ok_text(t("Confirm"))- .ok_variant(gpui_component::button::ButtonVariant::Danger),- )+ .button_props(crate::ui::danger_buttons(t("Confirm"))).footer(v_flex().w_full()diff --git a/crates/wake/src/workbench/cleanup/rows.rs b/crates/wake/src/workbench/cleanup/rows.rsindex c805e57..e51bcb9 100644--- a/crates/wake/src/workbench/cleanup/rows.rs+++ b/crates/wake/src/workbench/cleanup/rows.rs@@ -191,10 +191,8 @@ impl Workbench {)}).when(selectable && members.len() > 1, |row| {- row.child(crate::tp!(- "{} nested session",- "{} nested sessions",- members.len() - 1+ row.child(crate::workbench::nested_tally(+ members.len() as i64 - 1,))}),),