All your AI agent sessions in one place — browse, search, resume. Rust + GPUI.
Rust
Release v0.2.9: add Settings and About
Corey Chiudf4f966b27f7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 158b0cd..6e81ad8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,15 @@# Changelog+## [0.2.9] — 2026-08-25++- Update: Session location management now lives in a dedicated Settings window, available from the sidebar gear, the Wake menu, or `⌘,`+- Update: locations are grouped by agent, undetected agents stay collapsed by default, and row actions move into a compact overflow menu+- New: Settings now includes General, Locations, Data, and About pages, with a persistent System / Light / Dark appearance choice+- New: About Wake mirrors the Kooky/Birth information hierarchy with Wake's icon, version, tagline, GitHub link, license, and author credit; the Wake menu opens the same page+- New: the Data page shows Wake's local storage path and size and opens it in the file manager; session refresh remains in the main sidebar+- Update: Settings buttons and the appearance selector now share Wake's compact sizing, corner radius, and quiet secondary treatment+- Fix: location scans continue to reach their terminal state when the main window closes while Settings remains open+## [0.2.8] — 2026-08-25- New: every Session location has its own on/off switch — disabled paths stop scanning and disappear from browse/search results without losing their configurationdiff --git a/Cargo.lock b/Cargo.lockindex fb592d9..dee0991 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -6804,7 +6804,7 @@ dependencies = [[[package]]name = "wake"-version = "0.2.8"+version = "0.2.9"dependencies = ["anyhow","chrono",@@ -6820,7 +6820,7 @@ dependencies = [[[package]]name = "wake-core"-version = "0.2.8"+version = "0.2.9"dependencies = ["anyhow","chrono",diff --git a/Cargo.toml b/Cargo.tomlindex 064a392..e482958 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -3,7 +3,7 @@ resolver = "2"members = ["crates/wake-core", "crates/wake"][workspace.package]-version = "0.2.8"+version = "0.2.9"edition = "2021"license = "MIT"diff --git a/DESIGN.md b/DESIGN.mdindex 1c7e52f..684c811 100644--- a/DESIGN.md+++ b/DESIGN.md@@ -133,7 +133,8 @@ macOS 不设置横跨三栏的自定义 header。系统交通灯保留在侧栏- 线条图标比实心品牌图视觉轻,同档里给小一号:分组项 Lucide 14 / 品牌图 18,主导航 Lucide 15。- 行内容 = 行首元素 + 标题 + 计数;计数一律 Label 档 muted。- 组头 "Agents"/"Projects" 用 Body 档常规字重 + muted 色(与主导航同字号同字重,仅靠颜色和"无行首图标"区分——加粗会让组头压过它统辖的行),带 13px chevron 可折叠。-- 底部工具条常驻,顶部 hairline 分隔,按钮靠右排列(次要操作区:透明底、hover 才出色,不与导航行选中态抢注意力)——左为 "Session locations"(硬盘图标,开面板列出每家 agent 的数据路径、会话数与**逐路径开关**;关闭后保留配置,停止扫描/监听并从会话与搜索结果排除,重新开启即增量扫回。行按 AgentId 声明序稳定成组(自定义根紧随该家默认根之后),**行点击即编辑**;只有自定义 location 可真正 Remove,内置 location 只可启停或改指其他路径。添加/编辑共用一个表单弹窗(480px,agent 下拉 + 路径输入框可手输 ~ 展开 + 目录选择钮,Add|Save / Cancel)**压栈**在面板之上,esc/取消原生弹回面板;**纯路径管理无内容校验**(2026-08-24 定稿),保存后先出通知、待补扫终态(增量,常亚秒)再重开面板——此刻计数才是真值。启用行尾显示计数 badge,停用行显示 Disabled,最右为系统式小开关;Show in Finder 与自定义 Remove 收进编辑表单动作行。底部 hairline 下左 "Add location" 右 "Restore defaults"(仅存在偏离时出现,清空自定义、被移除预设与停用状态;hover 胶囊只包按钮本体)),右为 refresh。+- 底部工具条常驻,顶部 hairline 分隔,按钮靠右排列(次要操作区:透明底、hover 才出色,不与导航行选中态抢注意力)——左为齿轮 "Settings",右为 refresh。Settings 同时进入 Wake 菜单并绑定 `⌘,`(其他平台 `Ctrl+,`),保持单例窗口。+- Settings 采用固定窄侧栏 + 内容页结构,固定为 General / Locations / Data / About 四项;About 与功能设置分离并钉在侧栏底部,Wake 菜单的 About Wake 直达同一页。About 沿用 Kooky/Birth 的信息顺序:产品图标、名称、版本、tagline、GitHub、短分隔线、版权/许可证与作者署名。内部文字按钮统一沿用主界面的 24px 高、6px 圆角和主题交互色,页面动作一律使用 muted 填充 + hairline;高饱和 primary 只留给确认弹窗里的最终提交,不在轻量设置页标题区抢注意力。Appearance 分段选择器也使用同一材质。General 只放真实可用的全局偏好,当前为持久化的 System / Light / Dark 外观选择;不提供默认 “Open In” 终端。Data 只展示 Wake 本地存储位置、会话数与磁盘占用并提供文件管理器入口,不重复放刷新或清库动作;常规 Refresh 的唯一入口仍是主侧栏底部。Locations 页按 AgentId 声明序以 agent 分组,品牌名只在组头出现一次;本机有数据的组优先,未检测到的 agent 默认收进可展开区。每条路径以路径为主信息、会话数/不可用状态为 muted 副信息,最右为逐路径开关;停用行整体降噪,不再重复显示 Disabled badge。行本身不承担编辑,`…` 菜单集中 Edit / Show in Finder / 自定义 Remove。顶部操作为低强调的 Add location,Restore defaults 收进页级 `…` 菜单且无偏离时禁用。添加/编辑仍复用 agent 下拉 + 可手输路径 + 目录选择表单;关闭 location 后保留配置、停止扫描/监听并从会话与搜索结果排除,重新开启即增量扫回;纯路径管理不做内容校验。- 工具条内的**状态行"常态沉默"**:仅刷新中或监听不可用时出现在按钮行上方;文案须可 truncate,窄侧栏放不下长句(故为 "Live updates off" 而非带操作建议的整句)。- 不把项目包装成卡片,不堆叠分支、时间或重复图标。项目行不加彩色标识——同一图标重复十几次不传递信息。diff --git a/PRODUCT.md b/PRODUCT.mdindex 8cf15e5..7e162ea 100644--- a/PRODUCT.md+++ b/PRODUCT.md@@ -12,7 +12,7 @@ Rust + gpui 0.2 + gpui-component 0.5(用户既定,workspace: crates/wake-core## Users-Corey 本人(独立开发者,主力工具 Claude Code 与 Codex,中文为主)。已开源(2026-08-18 v0.1.0 首发,当前 v0.2.7 2026-08-25,github.com/iAmCorey/Wake,MIT):面向同时使用多个 coding agent 的开发者。+Corey 本人(独立开发者,主力工具 Claude Code 与 Codex,中文为主)。已开源(2026-08-18 v0.1.0 首发,当前 v0.2.9 2026-08-25,github.com/iAmCorey/Wake,MIT):面向同时使用多个 coding agent 的开发者。## Product Purpose@@ -34,7 +34,7 @@ Corey 本人(独立开发者,主力工具 Claude Code 与 Codex,中文为主)。## Brand Commitments-名称 Wake(2026-08-14 由 Vibex 更名;取「船迹」——agent 驶过的痕迹,兼「唤醒」恢复会话之意)。界面语言英文(2026-08-14 由中文切换,用户反馈中文 UI 词汇观感生硬)。视觉基准(用户 2026-08-14 确认):现代 macOS 原生规范,工艺对标 Things / Bear(优雅轻盈的原生感);外观跟随系统(浅+深双模式)。agent 品牌色作为功能性识别色保留(Claude 橙 #D97757、Codex 绿 #12A06B 等,见 models.rs)。+名称 Wake(2026-08-14 由 Vibex 更名;取「船迹」——agent 驶过的痕迹,兼「唤醒」恢复会话之意)。界面语言英文(2026-08-14 由中文切换,用户反馈中文 UI 词汇观感生硬)。视觉基准(用户 2026-08-14 确认):现代 macOS 原生规范,工艺对标 Things / Bear(优雅轻盈的原生感);支持跟随系统或固定浅/深外观。agent 品牌色作为功能性识别色保留(Claude 橙 #D97757、Codex 绿 #12A06B 等,见 models.rs)。Session locations 自 0.2.9 起归入独立 Settings 窗口,主界面只保留齿轮入口;Settings 固定为 General / Locations / Data / About,不提供默认 “Open In” 终端选择。## Evidence on Handdiff --git a/crates/wake-core/src/adapters/antigravity.rs b/crates/wake-core/src/adapters/antigravity.rsindex ae61702..926ceec 100644--- a/crates/wake-core/src/adapters/antigravity.rs+++ b/crates/wake-core/src/adapters/antigravity.rs@@ -30,7 +30,9 @@ impl AntigravityAdapter {}fn rows(&self) -> Option<Vec<AgRow>> {- let mtime = std::fs::metadata(&self.db).map(|m| mtime_ms(&m)).unwrap_or(0);+ let mtime = std::fs::metadata(&self.db)+ .map(|m| mtime_ms(&m))+ .unwrap_or(0);self.rows_cache.get_or_try_build(mtime, || {let ro = open_sqlite_ro(&self.db, "antigravity")?;let mut stmt = ro@@ -65,7 +67,11 @@ impl AntigravityAdapter {.or_else(|| Some(clean_title_candidate(&row.preview)).filter(|t| !t.is_empty())).unwrap_or_else(|| UNTITLED.to_string());// 库里只有 last_modified 一个时间,created/updated 同源- let ts = if row.modified_ms > 0 { row.modified_ms } else { r.mtime_ms };+ let ts = if row.modified_ms > 0 {+ row.modified_ms+ } else {+ r.mtime_ms+ };SessionMeta {key: format!("antigravity:{}", row.id),id: row.id.clone(),@@ -125,7 +131,11 @@ fn first_workspace(raw: &str) -> String {let Ok(v) = serde_json::from_str::<serde_json::Value>(raw) else {return String::new();};- let Some(uri) = v.as_array().and_then(|a| a.first()).and_then(|x| x.as_str()) else {+ let Some(uri) = v+ .as_array()+ .and_then(|a| a.first())+ .and_then(|x| x.as_str())+ else {return String::new();};let path = uri.strip_prefix("file://").unwrap_or(uri);@@ -208,7 +218,9 @@ impl AgentAdapter for AntigravityAdapter {fn with_custom_root(&self, dir: PathBuf) -> Box<dyn AgentAdapter> {// 选中 `~/.gemini` 形态(含 antigravity-cli/)、库所在目录,或直接// 给到库文件路径都认(Codex review)- let nested = dir.join("antigravity-cli").join("conversation_summaries.db");+ let nested = dir+ .join("antigravity-cli")+ .join("conversation_summaries.db");let db = if dir.is_file() {dir} else if nested.is_file() {diff --git a/crates/wake-core/src/adapters/claude.rs b/crates/wake-core/src/adapters/claude.rsindex d8cd996..5a721b8 100644--- a/crates/wake-core/src/adapters/claude.rs+++ b/crates/wake-core/src/adapters/claude.rs@@ -177,7 +177,12 @@ fn parse_claude_jsonl(path: &Path, include_sidechain: bool) -> Result<ParseResulflush_assistant(&mut pending, &mut messages, &mut tool_index);let subtype = row.get("subtype").and_then(|v| v.as_str());if subtype == Some("compact_boundary") {- messages.push(mk_msg(Role::System, MessageKind::CompactSummary, "── Context compacted ──", ts));+ messages.push(mk_msg(+ Role::System,+ MessageKind::CompactSummary,+ "── Context compacted ──",+ ts,+ ));} else if let Some(content) = row.get("content").and_then(|v| v.as_str()) {if !content.is_empty() {let (text, truncated) = clip(content, MAX_TOOL_IO);@@ -216,7 +221,8 @@ fn parse_claude_jsonl(path: &Path, include_sidechain: bool) -> Result<ParseResul}Some("tool_result") => {had_tool_result = true;- let id = b.get("tool_use_id").and_then(|v| v.as_str()).unwrap_or("");+ let id =+ b.get("tool_use_id").and_then(|v| v.as_str()).unwrap_or("");if let Some(&(mi, ti)) = tool_index.get(id) {let out = stringify_tool_result(b.get("content"));let target = &mut messages[mi].tool_calls[ti];@@ -295,8 +301,14 @@ fn parse_claude_jsonl(path: &Path, include_sidechain: bool) -> Result<ParseResul}}if let Some(usage) = message.get("usage") {- tokens_used += usage.get("input_tokens").and_then(|v| v.as_i64()).unwrap_or(0)- + usage.get("output_tokens").and_then(|v| v.as_i64()).unwrap_or(0)+ tokens_used += usage+ .get("input_tokens")+ .and_then(|v| v.as_i64())+ .unwrap_or(0)+ + usage+ .get("output_tokens")+ .and_then(|v| v.as_i64())+ .unwrap_or(0)+ usage.get("cache_creation_input_tokens").and_then(|v| v.as_i64())@@ -321,10 +333,15 @@ fn parse_claude_jsonl(path: &Path, include_sidechain: bool) -> Result<ParseResul}}Some("tool_use") => {- let id = b.get("id").and_then(|v| v.as_str()).unwrap_or("").to_string();+ let id = b+ .get("id")+ .and_then(|v| v.as_str())+ .unwrap_or("")+ .to_string();let input = b.get("input").cloned().unwrap_or(Value::Null);let name = b.get("name").and_then(|v| v.as_str()).unwrap_or("tool");- p.tool_calls.push(tool_call_view(id, name, &input, None, false));+ p.tool_calls+ .push(tool_call_view(id, name, &input, None, false));}_ => {}}@@ -405,8 +422,16 @@ fn build_meta(r: &SessionFileRef, p: &ParseResult) -> SessionMeta {project_path: p.cwd.clone(),project_name,file_path: r.file_path.clone(),- created_at: if p.created_at > 0 { p.created_at } else { r.mtime_ms },- updated_at: if p.updated_at > 0 { p.updated_at } else { r.mtime_ms },+ created_at: if p.created_at > 0 {+ p.created_at+ } else {+ r.mtime_ms+ },+ updated_at: if p.updated_at > 0 {+ p.updated_at+ } else {+ r.mtime_ms+ },message_count: p.messages.iter()@@ -415,7 +440,11 @@ fn build_meta(r: &SessionFileRef, p: &ParseResult) -> SessionMeta {size_bytes: r.size,git_branch: p.git_branch.clone(),model: p.model.clone(),- tokens_used: if p.tokens_used > 0 { Some(p.tokens_used) } else { None },+ tokens_used: if p.tokens_used > 0 {+ Some(p.tokens_used)+ } else {+ None+ },archived: false,source: None,favorite: false,@@ -451,9 +480,18 @@ fn list_sidechains(r: &SessionFileRef) -> Vec<SidechainInfo> {};if let Ok(meta_raw) = fs::read_to_string(dir.join(format!("{id}.meta.json"))) {if let Ok(meta) = serde_json::from_str::<Value>(&meta_raw) {- info.agent_type = meta.get("agentType").and_then(|v| v.as_str()).map(String::from);- info.description = meta.get("description").and_then(|v| v.as_str()).map(String::from);- info.tool_use_id = meta.get("toolUseId").and_then(|v| v.as_str()).map(String::from);+ info.agent_type = meta+ .get("agentType")+ .and_then(|v| v.as_str())+ .map(String::from);+ info.description = meta+ .get("description")+ .and_then(|v| v.as_str())+ .map(String::from);+ info.tool_use_id = meta+ .get("toolUseId")+ .and_then(|v| v.as_str())+ .map(String::from);}}out.push(info);@@ -532,7 +570,11 @@ impl AgentAdapter for ClaudeAdapter {})}- fn load_sidechain(&self, r: &SessionFileRef, sidechain_id: &str) -> Result<Vec<TranscriptMessage>> {+ fn load_sidechain(+ &self,+ r: &SessionFileRef,+ sidechain_id: &str,+ ) -> Result<Vec<TranscriptMessage>> {let file = subagents_dir(r).join(format!("{sidechain_id}.jsonl"));if !file.is_file() {return Ok(Vec::new());@@ -564,7 +606,11 @@ impl AgentAdapter for ClaudeAdapter {fn with_custom_root(&self, dir: PathBuf) -> Box<dyn AgentAdapter> {// 选中 `~/.claude` 形态(含 projects/)或直接选中 projects 目录都认- let root = if dir.join("projects").is_dir() { dir.join("projects") } else { dir };+ let root = if dir.join("projects").is_dir() {+ dir.join("projects")+ } else {+ dir+ };Box::new(Self { root })}@@ -572,4 +618,3 @@ impl AgentAdapter for ClaudeAdapter {vec![self.root.clone()]}}-diff --git a/crates/wake-core/src/adapters/copilot.rs b/crates/wake-core/src/adapters/copilot.rsindex 29d3462..b15e679 100644--- a/crates/wake-core/src/adapters/copilot.rs+++ b/crates/wake-core/src/adapters/copilot.rs@@ -30,7 +30,9 @@ impl CopilotAdapter {}fn db_mtime(&self) -> i64 {- std::fs::metadata(&self.db).map(|m| mtime_ms(&m)).unwrap_or(0)+ std::fs::metadata(&self.db)+ .map(|m| mtime_ms(&m))+ .unwrap_or(0)}fn rows(&self) -> Option<Vec<CopilotRow>> {@@ -80,12 +82,24 @@ impl CopilotAdapter {key: format!("copilot:{}", row.id),id: row.id.clone(),agent: AgentId::Copilot,- title: if title.is_empty() { UNTITLED.to_string() } else { title },+ title: if title.is_empty() {+ UNTITLED.to_string()+ } else {+ title+ },project_path: row.cwd.clone(),project_name: project_name_of(&row.cwd),file_path: r.file_path.clone(),- created_at: if row.created_ms > 0 { row.created_ms } else { r.mtime_ms },- updated_at: if row.updated_ms > 0 { row.updated_ms } else { r.mtime_ms },+ created_at: if row.created_ms > 0 {+ row.created_ms+ } else {+ r.mtime_ms+ },+ updated_at: if row.updated_ms > 0 {+ row.updated_ms+ } else {+ r.mtime_ms+ },message_count,size_bytes: r.size,git_branch: row.branch.clone().filter(|b| !b.is_empty()),@@ -149,7 +163,10 @@ impl CopilotAdapter {}}assign_seq(&mut messages);- let count = messages.iter().filter(|m| m.kind == MessageKind::Text).count() as i64;+ let count = messages+ .iter()+ .filter(|m| m.kind == MessageKind::Text)+ .count() as i64;let mut meta = self.build_meta(r, &row, count);// summary 缺失时回退首条用户消息if meta.title == UNTITLED {@@ -229,7 +246,11 @@ impl AgentAdapter for CopilotAdapter {fn with_custom_root(&self, dir: PathBuf) -> Box<dyn AgentAdapter> {// 手输/预填的就是库文件路径时直接认,不再往下拼(Codex review)- let db = if dir.is_file() { dir } else { dir.join("session-store.db") };+ let db = if dir.is_file() {+ dir+ } else {+ dir.join("session-store.db")+ };Box::new(Self {db,rows_cache: Mutex::new(None),diff --git a/crates/wake-core/src/adapters/cursor.rs b/crates/wake-core/src/adapters/cursor.rsindex b390611..9c31d6a 100644--- a/crates/wake-core/src/adapters/cursor.rs+++ b/crates/wake-core/src/adapters/cursor.rs@@ -60,7 +60,8 @@ fn cursor_ts_ms(s: &str) -> i64 {(|| -> Option<i64> {let (dt_part, tz_part) = s.rsplit_once(" (")?;let naive =- chrono::NaiveDateTime::parse_from_str(dt_part.trim(), "%A, %b %d, %Y, %I:%M %p").ok()?;+ chrono::NaiveDateTime::parse_from_str(dt_part.trim(), "%A, %b %d, %Y, %I:%M %p")+ .ok()?;let off = tz_part.trim_end_matches(')').strip_prefix("UTC")?;let (sign, rest) = match off.as_bytes().first()? {b'+' => (1i32, &off[1..]),@@ -73,7 +74,12 @@ fn cursor_ts_ms(s: &str) -> i64 {};let offset = chrono::FixedOffset::east_opt(sign * secs)?;use chrono::TimeZone;- Some(offset.from_local_datetime(&naive).single()?.timestamp_millis())+ Some(+ offset+ .from_local_datetime(&naive)+ .single()?+ .timestamp_millis(),+ )})().unwrap_or(0)}@@ -203,7 +209,13 @@ fn parse_cursor_jsonl(path: &Path) -> Result<CursorParse> {let input = b.get("input").cloned().unwrap_or(Value::Null);let name = b.get("name").and_then(|v| v.as_str()).unwrap_or("tool");// transcript 不落盘工具结果,output 恒 None- p.tool_calls.push(tool_call_view(String::new(), name, &input, None, false));+ p.tool_calls.push(tool_call_view(+ String::new(),+ name,+ &input,+ None,+ false,+ ));}_ => {}}@@ -246,8 +258,16 @@ fn build_meta(r: &SessionFileRef, p: &CursorParse) -> SessionMeta {project_path: cwd.clone(),project_name: project_name_of(&cwd),file_path: r.file_path.clone(),- created_at: if p.created_at > 0 { p.created_at } else { r.mtime_ms },- updated_at: if p.updated_at > 0 { p.updated_at } else { r.mtime_ms },+ created_at: if p.created_at > 0 {+ p.created_at+ } else {+ r.mtime_ms+ },+ updated_at: if p.updated_at > 0 {+ p.updated_at+ } else {+ r.mtime_ms+ },message_count: p.messages.iter()@@ -360,7 +380,11 @@ impl AgentAdapter for CursorAdapter {})}- fn load_sidechain(&self, r: &SessionFileRef, sidechain_id: &str) -> Result<Vec<TranscriptMessage>> {+ fn load_sidechain(+ &self,+ r: &SessionFileRef,+ sidechain_id: &str,+ ) -> Result<Vec<TranscriptMessage>> {let file = subagents_dir(r).join(format!("{sidechain_id}.jsonl"));if !file.is_file() {return Ok(Vec::new());@@ -370,7 +394,11 @@ impl AgentAdapter for CursorAdapter {fn with_custom_root(&self, dir: PathBuf) -> Box<dyn AgentAdapter> {// 选中 `~/.cursor` 形态(含 projects/)或直接选中 projects 目录都认- let root = if dir.join("projects").is_dir() { dir.join("projects") } else { dir };+ let root = if dir.join("projects").is_dir() {+ dir.join("projects")+ } else {+ dir+ };Box::new(Self { root })}diff --git a/crates/wake-core/src/adapters/dsh.rs b/crates/wake-core/src/adapters/dsh.rsindex 477484b..83053cf 100644--- a/crates/wake-core/src/adapters/dsh.rs+++ b/crates/wake-core/src/adapters/dsh.rs@@ -22,7 +22,10 @@ pub struct DshAdapter {impl DshAdapter {pub fn new() -> Self {Self {- root: super::home_dir().unwrap_or_default().join(".dsh").join("sessions"),+ root: super::home_dir()+ .unwrap_or_default()+ .join(".dsh")+ .join("sessions"),}}}@@ -52,10 +55,17 @@ fn parse_header(v: &serde_json::Value) -> Option<DshHeader> {}Some(DshHeader {id: v.get("id")?.as_str()?.to_string(),- cwd: v.get("cwd").and_then(|c| c.as_str()).unwrap_or_default().to_string(),+ cwd: v+ .get("cwd")+ .and_then(|c| c.as_str())+ .unwrap_or_default()+ .to_string(),created_at: v.get("createdAt").and_then(|t| t.as_i64()).unwrap_or(0),subagent: v.get("origin").and_then(|o| o.as_str()) == Some("subagent")- || v.get("delegationDepth").and_then(|d| d.as_i64()).unwrap_or(0) > 0,+ || v.get("delegationDepth")+ .and_then(|d| d.as_i64())+ .unwrap_or(0)+ > 0,})}@@ -204,7 +214,12 @@ fn parse_dsh_log(path: &Path) -> Result<DshParse> {let mut thinking_parts: Vec<&str> = Vec::new();let mut tools: Vec<ToolCallView> = Vec::new();for b in content.as_array().into_iter().flatten() {- let block_text = || b.get("text").and_then(|v| v.as_str()).map(str::trim).filter(|t| !t.is_empty());+ let block_text = || {+ b.get("text")+ .and_then(|v| v.as_str())+ .map(str::trim)+ .filter(|t| !t.is_empty())+ };match b.get("type").and_then(|v| v.as_str()) {Some("text") => text_parts.extend(block_text()),Some("reasoning") => thinking_parts.extend(block_text()),@@ -212,7 +227,10 @@ fn parse_dsh_log(path: &Path) -> Result<DshParse> {let id = b.get("id").and_then(|v| v.as_str()).unwrap_or_default();let name = b.get("name").and_then(|v| v.as_str()).unwrap_or_default();// arguments 是模型原样输出的 JSON 字符串,解析失败保留原文- let raw = b.get("arguments").and_then(|v| v.as_str()).unwrap_or_default();+ let raw = b+ .get("arguments")+ .and_then(|v| v.as_str())+ .unwrap_or_default();let input = serde_json::from_str::<serde_json::Value>(raw).unwrap_or(serde_json::Value::String(raw.to_string()));tools.push(tool_call_view(id.to_string(), name, &input, None, false));@@ -224,7 +242,10 @@ fn parse_dsh_log(path: &Path) -> Result<DshParse> {// 用来挂 usage 的载体(dsh-session surface.d.ts:"exists only to// host usage",如撞上 max-tokens 的调用),提前 continue 会把这次// 调用的 model 与 token 一起丢掉——它落在会话末尾时最明显- let model = msg.pointer("/source/model").and_then(|v| v.as_str()).map(String::from);+ let model = msg+ .pointer("/source/model")+ .and_then(|v| v.as_str())+ .map(String::from);if model.is_some() {p.model = model.clone();}@@ -232,10 +253,15 @@ fn parse_dsh_log(path: &Path) -> Result<DshParse> {// TokenUsage 是"one model call"的账、三项 input 互斥(billed =// 三项之和),所以**按调用累加**,不能 last-wins:一个 turn 多个// step,last-wins 只会剩最后一次调用的量- let sum = ["inputTokens", "outputTokens", "cacheReadTokens", "cacheWriteTokens"]- .iter()- .filter_map(|k| u.get(*k).and_then(|v| v.as_i64()))- .sum::<i64>();+ let sum = [+ "inputTokens",+ "outputTokens",+ "cacheReadTokens",+ "cacheWriteTokens",+ ]+ .iter()+ .filter_map(|k| u.get(*k).and_then(|v| v.as_i64()))+ .sum::<i64>();if sum > 0 {p.tokens_used = Some(p.tokens_used.unwrap_or(0) + sum);}@@ -297,7 +323,8 @@ fn parse_dsh_log(path: &Path) -> Result<DshParse> {};if let Some(&(mi, ti)) = tool_index.get(call_id) {let tc = &mut p.messages[mi].tool_calls[ti];- let text = blocks_text(block.get("content").unwrap_or(&serde_json::Value::Null));+ let text =+ blocks_text(block.get("content").unwrap_or(&serde_json::Value::Null));if !text.is_empty() {tc.output = Some(clip(&text, MAX_TOOL_IO).0);}@@ -359,7 +386,11 @@ fn build_meta(r: &SessionFileRef, p: &DshParse) -> SessionMeta {file_path: r.file_path.clone(),created_at: if created > 0 { created } else { r.mtime_ms },updated_at: if p.last_ts > 0 { p.last_ts } else { r.mtime_ms },- message_count: p.messages.iter().filter(|m| m.kind == MessageKind::Text).count() as i64,+ message_count: p+ .messages+ .iter()+ .filter(|m| m.kind == MessageKind::Text)+ .count() as i64,size_bytes: r.size,git_branch: None,model: p.model.clone(),@@ -417,7 +448,11 @@ impl AgentAdapter for DshAdapter {// 压缩配置换挡会新旧后缀并存:陈旧的一份让位(mtime 平局 .zstd 赢,与// 写端当前默认一致)。裁决在此单点,list 与 watcher 两条入口共用——// 只做在 list 会让 watcher 把陈旧 sibling 的事件当主文件解析- let sibling = if name == "session.jsonl" { "session.jsonl.zstd" } else { "session.jsonl" };+ let sibling = if name == "session.jsonl" {+ "session.jsonl.zstd"+ } else {+ "session.jsonl"+ };if let Ok(sib) = fs::metadata(path.with_file_name(sibling)) {let (own_m, sib_m) = (mtime_ms(&meta), mtime_ms(&sib));if sib_m > own_m || (sib_m == own_m && name == "session.jsonl") {@@ -465,7 +500,11 @@ impl AgentAdapter for DshAdapter {}fn with_custom_root(&self, dir: PathBuf) -> Box<dyn AgentAdapter> {- let root = if dir.join("sessions").is_dir() { dir.join("sessions") } else { dir };+ let root = if dir.join("sessions").is_dir() {+ dir.join("sessions")+ } else {+ dir+ };Box::new(Self { root })}diff --git a/crates/wake-core/src/adapters/gemini.rs b/crates/wake-core/src/adapters/gemini.rsindex 521ea42..8b56b5a 100644--- a/crates/wake-core/src/adapters/gemini.rs+++ b/crates/wake-core/src/adapters/gemini.rs@@ -31,7 +31,9 @@ impl GeminiAdapter {/// slug → 项目真实路径fn slug_map(&self) -> HashMap<String, String> {- let mtime = fs::metadata(&self.projects_json).map(|m| mtime_ms(&m)).unwrap_or(0);+ let mtime = fs::metadata(&self.projects_json)+ .map(|m| mtime_ms(&m))+ .unwrap_or(0);{let cache = self.slug_cache.lock().unwrap();if let Some((t, map)) = cache.as_ref() {@@ -168,8 +170,16 @@ fn build_meta(r: &SessionFileRef, p: &GeminiParse, cwd: &str) -> SessionMeta {project_path: cwd.to_string(),project_name: project_name_of(cwd),file_path: r.file_path.clone(),- created_at: if p.created_at > 0 { p.created_at } else { r.mtime_ms },- updated_at: if p.updated_at > 0 { p.updated_at } else { r.mtime_ms },+ created_at: if p.created_at > 0 {+ p.created_at+ } else {+ r.mtime_ms+ },+ updated_at: if p.updated_at > 0 {+ p.updated_at+ } else {+ r.mtime_ms+ },message_count: p.messages.iter()diff --git a/crates/wake-core/src/adapters/grok.rs b/crates/wake-core/src/adapters/grok.rsindex 1d890bd..fefd6b2 100644--- a/crates/wake-core/src/adapters/grok.rs+++ b/crates/wake-core/src/adapters/grok.rs@@ -21,7 +21,10 @@ pub struct GrokAdapter {impl GrokAdapter {pub fn new() -> Self {Self {- root: super::home_dir().unwrap_or_default().join(".grok").join("sessions"),+ root: super::home_dir()+ .unwrap_or_default()+ .join(".grok")+ .join("sessions"),}}}@@ -48,7 +51,11 @@ fn read_summary(updates_path: &Path) -> Summary {let path = updates_path.with_file_name("summary.json");if let Ok(raw) = fs::read_to_string(&path) {if let Ok(v) = serde_json::from_str::<Value>(&raw) {- if let Some(c) = v.get("info").and_then(|i| i.get("cwd")).and_then(|x| x.as_str()) {+ if let Some(c) = v+ .get("info")+ .and_then(|i| i.get("cwd"))+ .and_then(|x| x.as_str())+ {s.cwd = c.to_string();}// generated_title 与 session_summary 通常同值,前者更语义化@@ -108,7 +115,9 @@ impl Replay {}fn flush(&mut self) {- let Some(role) = self.cur_role.take() else { return };+ let Some(role) = self.cur_role.take() else {+ return;+ };let text = std::mem::take(&mut self.cur_text);let thinking = std::mem::take(&mut self.cur_thinking);let tools = std::mem::take(&mut self.cur_tools);@@ -139,14 +148,20 @@ impl Replay {/// user/agent chunk 的 content 文本({content:{type:text,text}}),借用零分配fn chunk_text(update: &Value) -> &str {- update.pointer("/content/text").and_then(Value::as_str).unwrap_or_default()+ update+ .pointer("/content/text")+ .and_then(Value::as_str)+ .unwrap_or_default()}fn tool_content_text(content: &Value) -> String {let mut parts: Vec<String> = Vec::new();for item in content.as_array().into_iter().flatten() {let inner = item.get("content").unwrap_or(item);- let t = inner.get("text").and_then(|x| x.as_str()).unwrap_or_default();+ let t = inner+ .get("text")+ .and_then(|x| x.as_str())+ .unwrap_or_default();if !t.trim().is_empty() {parts.push(t.trim().to_string());}@@ -214,10 +229,17 @@ fn parse_grok_updates(path: &Path) -> Result<(Vec<TranscriptMessage>, u32)> {}Some("tool_call") => {rp.ensure(Role::Assistant, ts);- let id = update.get("toolCallId").and_then(|v| v.as_str()).unwrap_or_default();- let name = update.get("title").and_then(|v| v.as_str()).unwrap_or_default();+ let id = update+ .get("toolCallId")+ .and_then(|v| v.as_str())+ .unwrap_or_default();+ let name = update+ .get("title")+ .and_then(|v| v.as_str())+ .unwrap_or_default();let input = update.get("rawInput").cloned().unwrap_or(Value::Null);- rp.cur_tools.push(tool_call_view(id.to_string(), name, &input, None, false));+ rp.cur_tools+ .push(tool_call_view(id.to_string(), name, &input, None, false));}Some("tool_call_update") => {let Some(id) = update.get("toolCallId").and_then(|v| v.as_str()) else {@@ -256,7 +278,11 @@ fn build_meta(r: &SessionFileRef, side: &Summary, messages: &[TranscriptMessage].filter(|t| !t.is_empty()).or_else(|| title_from_messages(messages)).unwrap_or_else(|| UNTITLED.to_string());- let msg_ts_max = messages.iter().filter_map(|m| m.timestamp).max().unwrap_or(0);+ let msg_ts_max = messages+ .iter()+ .filter_map(|m| m.timestamp)+ .max()+ .unwrap_or(0);SessionMeta {key: format!("grok:{}", r.native_id),id: r.native_id.clone(),@@ -265,12 +291,19 @@ fn build_meta(r: &SessionFileRef, side: &Summary, messages: &[TranscriptMessage]project_path: side.cwd.clone(),project_name: project_name_of(&side.cwd),file_path: r.file_path.clone(),- created_at: if side.created_ms > 0 { side.created_ms } else { r.mtime_ms },+ created_at: if side.created_ms > 0 {+ side.created_ms+ } else {+ r.mtime_ms+ },updated_at: match side.updated_ms.max(msg_ts_max) {t if t > 0 => t,_ => r.mtime_ms,},- message_count: messages.iter().filter(|m| m.kind == MessageKind::Text).count() as i64,+ message_count: messages+ .iter()+ .filter(|m| m.kind == MessageKind::Text)+ .count() as i64,size_bytes: r.size,git_branch: side.git_branch.clone(),model: side.model.clone(),@@ -295,7 +328,9 @@ impl AgentAdapter for GrokAdapter {// session_search.sqlite 等根级文件对 read_dir 自然失败跳过;// 会话主文件的判定(存在、非空、native_id)统一走 file_reffor cwd_dir in cwds.flatten() {- let Ok(sessions) = fs::read_dir(cwd_dir.path()) else { continue };+ let Ok(sessions) = fs::read_dir(cwd_dir.path()) else {+ continue;+ };for sess in sessions.flatten() {if let Some(r) = self.file_ref(&sess.path().join("updates.jsonl")) {refs.push(r);@@ -348,7 +383,11 @@ impl AgentAdapter for GrokAdapter {}fn with_custom_root(&self, dir: PathBuf) -> Box<dyn AgentAdapter> {- let root = if dir.join("sessions").is_dir() { dir.join("sessions") } else { dir };+ let root = if dir.join("sessions").is_dir() {+ dir.join("sessions")+ } else {+ dir+ };Box::new(Self { root })}diff --git a/crates/wake-core/src/adapters/kimi.rs b/crates/wake-core/src/adapters/kimi.rsindex 5a2bf38..6fa0acd 100644--- a/crates/wake-core/src/adapters/kimi.rs+++ b/crates/wake-core/src/adapters/kimi.rs@@ -32,13 +32,17 @@ impl KimiAdapter {}fn cwd_map(&self) -> HashMap<String, String> {- let mtime = fs::metadata(&self.index_path).map(|m| mtime_ms(&m)).unwrap_or(0);+ let mtime = fs::metadata(&self.index_path)+ .map(|m| mtime_ms(&m))+ .unwrap_or(0);self.cwd_cache.get_or_try_build(mtime, || {let mut out = HashMap::new();if let Ok(raw) = fs::read_to_string(&self.index_path) {for line in raw.lines() {- let Ok(v) = serde_json::from_str::<Value>(line) else { continue };+ let Ok(v) = serde_json::from_str::<Value>(line) else {+ continue;+ };if let (Some(id), Some(wd)) = (v.get("sessionId").and_then(|x| x.as_str()),v.get("workDir").and_then(|x| x.as_str()),@@ -81,7 +85,9 @@ fn read_state(wire_path: &Path) -> KimiState {created_ms: 0,updated_ms: 0,};- let Some(session_dir) = session_dir_of(wire_path) else { return s };+ let Some(session_dir) = session_dir_of(wire_path) else {+ return s;+ };if let Ok(raw) = fs::read_to_string(session_dir.join("state.json")) {if let Ok(v) = serde_json::from_str::<Value>(&raw) {if let Some(t) = v.get("title").and_then(|x| x.as_str()) {@@ -186,7 +192,12 @@ fn parse_kimi_wire(path: &Path) -> Result<(Vec<TranscriptMessage>, u32)> {Ok((messages, unknown))}-fn build_meta(r: &SessionFileRef, state: &KimiState, cwd: &str, messages: &[TranscriptMessage]) -> SessionMeta {+fn build_meta(+ r: &SessionFileRef,+ state: &KimiState,+ cwd: &str,+ messages: &[TranscriptMessage],+) -> SessionMeta {let title = Some(clean_title_candidate(&state.title)).filter(|t| !t.is_empty()).or_else(|| title_from_messages(messages))@@ -199,9 +210,20 @@ fn build_meta(r: &SessionFileRef, state: &KimiState, cwd: &str, messages: &[Tranproject_path: cwd.to_string(),project_name: project_name_of(cwd),file_path: r.file_path.clone(),- created_at: if state.created_ms > 0 { state.created_ms } else { r.mtime_ms },- updated_at: if state.updated_ms > 0 { state.updated_ms } else { r.mtime_ms },- message_count: messages.iter().filter(|m| m.kind == MessageKind::Text).count() as i64,+ created_at: if state.created_ms > 0 {+ state.created_ms+ } else {+ r.mtime_ms+ },+ updated_at: if state.updated_ms > 0 {+ state.updated_ms+ } else {+ r.mtime_ms+ },+ message_count: messages+ .iter()+ .filter(|m| m.kind == MessageKind::Text)+ .count() as i64,size_bytes: r.size,git_branch: None,model: None,@@ -216,7 +238,12 @@ fn build_meta(r: &SessionFileRef, state: &KimiState, cwd: &str, messages: &[Tran/// 会话目录名即 native_id(与 session_index.jsonl 的 sessionId 同形,/// resume 直接可用)fn native_id_of(wire_path: &Path) -> Option<String> {- Some(session_dir_of(wire_path)?.file_name()?.to_string_lossy().to_string())+ Some(+ session_dir_of(wire_path)?+ .file_name()?+ .to_string_lossy()+ .to_string(),+ )}impl AgentAdapter for KimiAdapter {@@ -231,7 +258,9 @@ impl AgentAdapter for KimiAdapter {};// 主文件判定(session_ 前缀、存在、非空、native_id)统一走 file_reffor wd in wds.flatten() {- let Ok(sessions) = fs::read_dir(wd.path()) else { continue };+ let Ok(sessions) = fs::read_dir(wd.path()) else {+ continue;+ };for sess in sessions.flatten() {let wire = sess.path().join("agents").join("main").join("wire.jsonl");if let Some(r) = self.file_ref(&wire) {diff --git a/crates/wake-core/src/adapters/kiro.rs b/crates/wake-core/src/adapters/kiro.rsindex d616377..d015864 100644--- a/crates/wake-core/src/adapters/kiro.rs+++ b/crates/wake-core/src/adapters/kiro.rs@@ -130,7 +130,11 @@ fn build_meta(r: &SessionFileRef, side: &Sidecar, messages: &[TranscriptMessage].filter(|t| !t.is_empty()).or_else(|| title_from_messages(messages)).unwrap_or_else(|| UNTITLED.to_string());- let msg_ts_max = messages.iter().filter_map(|m| m.timestamp).max().unwrap_or(0);+ let msg_ts_max = messages+ .iter()+ .filter_map(|m| m.timestamp)+ .max()+ .unwrap_or(0);SessionMeta {key: format!("kiro:{}", r.native_id),id: r.native_id.clone(),@@ -139,12 +143,19 @@ fn build_meta(r: &SessionFileRef, side: &Sidecar, messages: &[TranscriptMessage]project_path: side.cwd.clone(),project_name: project_name_of(&side.cwd),file_path: r.file_path.clone(),- created_at: if side.created_ms > 0 { side.created_ms } else { r.mtime_ms },+ created_at: if side.created_ms > 0 {+ side.created_ms+ } else {+ r.mtime_ms+ },updated_at: match side.updated_ms.max(msg_ts_max) {t if t > 0 => t,_ => r.mtime_ms,},- message_count: messages.iter().filter(|m| m.kind == MessageKind::Text).count() as i64,+ message_count: messages+ .iter()+ .filter(|m| m.kind == MessageKind::Text)+ .count() as i64,size_bytes: r.size,git_branch: None,model: side.model.clone(),diff --git a/crates/wake-core/src/adapters/parse_utils.rs b/crates/wake-core/src/adapters/parse_utils.rsindex e14d8d0..7382f99 100644--- a/crates/wake-core/src/adapters/parse_utils.rs+++ b/crates/wake-core/src/adapters/parse_utils.rs@@ -33,7 +33,11 @@ pub fn user_kind(text: &str) -> MessageKind {/// 纯文本消息构造(clip + user 注入判定),多家 adapter 共用pub fn text_msg(role: Role, text: &str, ts: i64) -> TranscriptMessage {let (clipped, truncated) = clip(text.trim(), MAX_MSG_TEXT);- let kind = if role == Role::User { user_kind(text) } else { MessageKind::Text };+ let kind = if role == Role::User {+ user_kind(text)+ } else {+ MessageKind::Text+ };TranscriptMessage {seq: 0,role,@@ -170,9 +174,17 @@ pub fn tool_call_view(};ToolCallView {id,- name: if name.is_empty() { "tool".to_string() } else { name.to_string() },+ name: if name.is_empty() {+ "tool".to_string()+ } else {+ name.to_string()+ },input_preview: make_preview(input),- input: if input_json.is_empty() { None } else { Some(clip(&input_json, MAX_TOOL_IO).0) },+ input: if input_json.is_empty() {+ None+ } else {+ Some(clip(&input_json, MAX_TOOL_IO).0)+ },output: output.map(|o| clip(&o, MAX_TOOL_IO).0),is_error,sidechain_ref: None,@@ -237,7 +249,10 @@ pub fn clean_title_candidate(raw: &str) -> String {let args = extract_tag(&s, "command-args");let name = extract_tag(&s, "command-name");if args.is_some() || name.is_some() {- s = args.filter(|a| !a.trim().is_empty()).or(name).unwrap_or_default();+ s = args+ .filter(|a| !a.trim().is_empty())+ .or(name)+ .unwrap_or_default();}// 去掉残余短标签let mut out = String::with_capacity(s.len());@@ -344,17 +359,33 @@ pub fn is_injected_user_content(text: &str) -> bool {pub fn make_preview(input: &Value) -> String {const MAX: usize = 200;let cand = if let Value::Object(obj) = input {- ["command", "file_path", "path", "pattern", "query", "url", "description"]- .iter()- .find_map(|k| obj.get(*k).and_then(|v| v.as_str()).filter(|s| !s.trim().is_empty()))- .map(|s| s.to_string())- .or_else(|| serde_json::to_string(input).ok())+ [+ "command",+ "file_path",+ "path",+ "pattern",+ "query",+ "url",+ "description",+ ]+ .iter()+ .find_map(|k| {+ obj.get(*k)+ .and_then(|v| v.as_str())+ .filter(|s| !s.trim().is_empty())+ })+ .map(|s| s.to_string())+ .or_else(|| serde_json::to_string(input).ok())} else if let Value::String(s) = input {Some(s.clone())} else {serde_json::to_string(input).ok()};- let one = cand.unwrap_or_default().split_whitespace().collect::<Vec<_>>().join(" ");+ let one = cand+ .unwrap_or_default()+ .split_whitespace()+ .collect::<Vec<_>>()+ .join(" ");let chars: Vec<char> = one.chars().collect();if chars.len() > MAX {let mut t: String = chars[..MAX].iter().collect();diff --git a/crates/wake-core/src/adapters/pi.rs b/crates/wake-core/src/adapters/pi.rsindex d2fcb1d..e9c48d8 100644--- a/crates/wake-core/src/adapters/pi.rs+++ b/crates/wake-core/src/adapters/pi.rs@@ -106,7 +106,11 @@ fn parse_pi_jsonl(path: &Path) -> Result<PiParse> {p.unknown_lines += 1;continue;};- let ts = row.get("timestamp").and_then(|v| v.as_str()).map(iso_ms).unwrap_or(0);+ let ts = row+ .get("timestamp")+ .and_then(|v| v.as_str())+ .map(iso_ms)+ .unwrap_or(0);p.last_ts = p.last_ts.max(ts);let content = msg.get("content").unwrap_or(&serde_json::Value::Null);match msg.get("role").and_then(|v| v.as_str()) {@@ -122,9 +126,19 @@ fn parse_pi_jsonl(path: &Path) -> Result<PiParse> {for b in content.as_array().into_iter().flatten() {if b.get("type").and_then(|v| v.as_str()) == Some("toolCall") {let id = b.get("id").and_then(|v| v.as_str()).unwrap_or_default();- let name = b.get("name").and_then(|v| v.as_str()).unwrap_or_default();- let input = b.get("arguments").cloned().unwrap_or(serde_json::Value::Null);- tools.push(tool_call_view(id.to_string(), name, &input, None, false));+ let name =+ b.get("name").and_then(|v| v.as_str()).unwrap_or_default();+ let input = b+ .get("arguments")+ .cloned()+ .unwrap_or(serde_json::Value::Null);+ tools.push(tool_call_view(+ id.to_string(),+ name,+ &input,+ None,+ false,+ ));}}if text.is_empty() && tools.is_empty() {@@ -211,9 +225,17 @@ fn build_meta(agent: AgentId, r: &SessionFileRef, p: &PiParse) -> SessionMeta {project_path: p.cwd.clone(),project_name: project_name_of(&p.cwd),file_path: r.file_path.clone(),- created_at: if p.created_at > 0 { p.created_at } else { r.mtime_ms },+ created_at: if p.created_at > 0 {+ p.created_at+ } else {+ r.mtime_ms+ },updated_at: if p.last_ts > 0 { p.last_ts } else { r.mtime_ms },- message_count: p.messages.iter().filter(|m| m.kind == MessageKind::Text).count() as i64,+ message_count: p+ .messages+ .iter()+ .filter(|m| m.kind == MessageKind::Text)+ .count() as i64,size_bytes: r.size,git_branch: None,model: p.model.clone(),diff --git a/crates/wake-core/src/bin/scan.rs b/crates/wake-core/src/bin/scan.rsindex 22ff88b..3804130 100644--- a/crates/wake-core/src/bin/scan.rs+++ b/crates/wake-core/src/bin/scan.rs@@ -32,7 +32,10 @@ fn main() -> Result<()> {let adapters = create_adapters_for(&store);eprintln!("adapters: {:?}",- adapters.iter().map(|a| a.agent().as_str()).collect::<Vec<_>>()+ adapters+ .iter()+ .map(|a| a.agent().as_str())+ .collect::<Vec<_>>());let t0 = std::time::Instant::now();@@ -66,7 +69,12 @@ fn main() -> Result<()> {}// 搜索冒烟- if let Some(q) = args.iter().position(|a| a == "--search").map(|i| args.get(i + 1)).flatten() {+ if let Some(q) = args+ .iter()+ .position(|a| a == "--search")+ .map(|i| args.get(i + 1))+ .flatten()+ {let t1 = std::time::Instant::now();let (hits, degraded) = store.search(q, &[], None, 10)?;println!(@@ -79,7 +87,11 @@ fn main() -> Result<()> {" {} #{}: {}",h.session.title.chars().take(24).collect::<String>(),h.seq,- h.snippet.chars().take(60).collect::<String>().replace('\n', " ")+ h.snippet+ .chars()+ .take(60)+ .collect::<String>()+ .replace('\n', " "));}}diff --git a/crates/wake-core/src/models.rs b/crates/wake-core/src/models.rsindex 7da81ff..46e7938 100644--- a/crates/wake-core/src/models.rs+++ b/crates/wake-core/src/models.rs@@ -73,7 +73,7 @@ impl AgentId {"kimi" => Some(AgentId::Kimi),"antigravity" => Some(AgentId::Antigravity),"dsh" => Some(AgentId::Dsh),- _ => None,+ _ => None,}}@@ -105,31 +105,54 @@ impl AgentId {AgentId::ClaudeCode => "brands/claude-code.png",AgentId::Codex => "brands/codex.png",AgentId::Copilot => {- if dark { "brands/copilot.png" } else { "brands/copilot-light.png" }+ if dark {+ "brands/copilot.png"+ } else {+ "brands/copilot-light.png"+ }}AgentId::Cursor => {- if dark { "brands/cursor.png" } else { "brands/cursor-light.png" }+ if dark {+ "brands/cursor.png"+ } else {+ "brands/cursor-light.png"+ }}AgentId::Opencode => {- if dark { "brands/opencode.png" } else { "brands/opencode-light.png" }+ if dark {+ "brands/opencode.png"+ } else {+ "brands/opencode-light.png"+ }}AgentId::Kiro => "brands/kiro.png",AgentId::Gemini => "brands/gemini.png",AgentId::Pi => {- if dark { "brands/pi.png" } else { "brands/pi-light.png" }+ if dark {+ "brands/pi.png"+ } else {+ "brands/pi-light.png"+ }}AgentId::Omp => "brands/omp.png",AgentId::Grok => {- if dark { "brands/grok.png" } else { "brands/grok-light.png" }+ if dark {+ "brands/grok.png"+ } else {+ "brands/grok-light.png"+ }}AgentId::Kimi => {- if dark { "brands/kimi.png" } else { "brands/kimi-light.png" }+ if dark {+ "brands/kimi.png"+ } else {+ "brands/kimi-light.png"+ }}AgentId::Antigravity => "brands/antigravity.png",AgentId::Dsh => "brands/deepseek.png",}}-}/// 会话元数据 —— 列表页/索引库统一模型diff --git a/crates/wake-core/src/scanner.rs b/crates/wake-core/src/scanner.rsindex 368bc93..51348f2 100644--- a/crates/wake-core/src/scanner.rs+++ b/crates/wake-core/src/scanner.rs@@ -119,8 +119,7 @@ fn run_scan_inner(//(2026-08-24 Codex review P1).filter(|r| {!store.is_tombstoned(&r.file_path)- && !store- .is_key_tombstoned(&format!("{}:{}", r.agent.as_str(), r.native_id))+ && !store.is_key_tombstoned(&format!("{}:{}", r.agent.as_str(), r.native_id))})// 无任何根认领的引用(越界枚举或合成测试)保守放行给枚举者;// 过滤只裁决"确有更深的根拥有它"的情形@@ -214,7 +213,9 @@ fn run_scan_inner(Some((mtime, size, _)) => *mtime != r.mtime_ms || *size != r.size,};if full || changed {- let quick = quick_map.as_ref().and_then(|m| m.get(&r.file_path).cloned());+ let quick = quick_map+ .as_ref()+ .and_then(|m| m.get(&r.file_path).cloned());let fallbacks = candidates.get(&(r.agent, r.native_id.clone())).filter(|v| v.len() > 1)@@ -268,8 +269,7 @@ fn run_scan_inner(// 全量写入也走事务内副本裁决:扫描快照里的旧副本不得覆盖// watcher 并发间隙写入的更新副本(启动扫描与手动刷新期间// watcher 都活着,2026-08-24 Codex review P1)- if let Err(e) = store.write_session_guarded(&meta, item.r.mtime_ms, &parsed.units)- {+ if let Err(e) = store.write_session_guarded(&meta, item.r.mtime_ms, &parsed.units) {eprintln!("[scanner] write failed {}: {e}", item.r.file_path);}}diff --git a/crates/wake-core/src/services/exporter.rs b/crates/wake-core/src/services/exporter.rsindex 67e8d7b..219fd95 100644--- a/crates/wake-core/src/services/exporter.rs+++ b/crates/wake-core/src/services/exporter.rs@@ -43,7 +43,9 @@ fn render_message(m: &TranscriptMessage, out: &mut String) {return;}if let Some(th) = &m.thinking {- out.push_str(&format!("<details><summary>🧠 Thinking</summary>\n\n{th}\n\n</details>\n\n"));+ out.push_str(&format!(+ "<details><summary>🧠 Thinking</summary>\n\n{th}\n\n</details>\n\n"+ ));}if !m.text.is_empty() {out.push_str(&m.text);@@ -150,7 +152,11 @@ pub fn default_file_name(meta: &SessionMeta, ext: &str) -> String {.take(40).collect();let date = Local- .timestamp_millis_opt(if meta.updated_at > 0 { meta.updated_at } else { crate::db::now_ms() })+ .timestamp_millis_opt(if meta.updated_at > 0 {+ meta.updated_at+ } else {+ crate::db::now_ms()+ }).single().map(|d| d.format("%Y%m%d").to_string()).unwrap_or_default();diff --git a/crates/wake-core/src/services/terminal/linux.rs b/crates/wake-core/src/services/terminal/linux.rsindex 4c869ed..4b14a77 100644--- a/crates/wake-core/src/services/terminal/linux.rs+++ b/crates/wake-core/src/services/terminal/linux.rs@@ -81,7 +81,10 @@ impl TerminalApp {TerminalApp::WezTerm => &["start", "--"],TerminalApp::XfceTerminal => &["-x"],TerminalApp::Kitty => &[],- TerminalApp::Konsole | TerminalApp::Ghostty | TerminalApp::Alacritty | TerminalApp::Xterm => &["-e"],+ TerminalApp::Konsole+ | TerminalApp::Ghostty+ | TerminalApp::Alacritty+ | TerminalApp::Xterm => &["-e"],}}}@@ -145,7 +148,9 @@ pub(super) fn copy_to_clipboard(text: &str) -> bool {} else {[xclip, xsel, wl]};- order.into_iter().any(|(bin, args)| pipe_to(bin, args, text))+ order+ .into_iter()+ .any(|(bin, args)| pipe_to(bin, args, text))}/// 批量删进回收站(freedesktop Trash spec,trash crate 纯库实现,文件@@ -158,7 +163,11 @@ pub(super) fn trash_existing(paths: &[&str]) -> anyhow::Result<()> {/// 已落过 stderr(从 .desktop 启动的场景由 journald 收)pub(super) fn alert_dialog(message: &str) {let zenity = Command::new("zenity")- .args(["--error", "--title=Wake can't start", &format!("--text={message}")])+ .args([+ "--error",+ "--title=Wake can't start",+ &format!("--text={message}"),+ ]).status();if zenity.map(|s| s.success()).unwrap_or(false) {return;@@ -203,6 +212,9 @@ pub(super) fn reveal_path(path: &str) {if shown {return;}- let parent = Path::new(path).parent().and_then(|d| d.to_str()).unwrap_or(path);+ let parent = Path::new(path)+ .parent()+ .and_then(|d| d.to_str())+ .unwrap_or(path);open_dir(parent);}diff --git a/crates/wake-core/src/services/terminal/macos.rs b/crates/wake-core/src/services/terminal/macos.rsindex 34631f3..8f834e3 100644--- a/crates/wake-core/src/services/terminal/macos.rs+++ b/crates/wake-core/src/services/terminal/macos.rs@@ -125,7 +125,9 @@ pub fn ensure_app_icons(cache_dir: &Path) -> HashMap<String, std::path::PathBuf>let mut script =String::from("ObjC.import('AppKit');\nconst ws = $.NSWorkspace.sharedWorkspace;\n");for (t, png) in &jobs {- let Some(app) = t.resolved_app_path() else { continue };+ let Some(app) = t.resolved_app_path() else {+ continue;+ };script.push_str(&format!("{{ const i = ws.iconForFile('{app}'); const rep = $.NSBitmapImageRep.imageRepWithData(i.TIFFRepresentation); \const png = rep.representationUsingTypeProperties(4, $.NSDictionary.dictionary); \@@ -294,25 +296,45 @@ pub(super) fn copy_to_clipboard(text: &str) -> bool {/// `open --cwd <项目> -e "<命令>"`,与 Terminal/iTerm 收命令文本同级。/// 命令从 session_bin + resume_args 拼(与真终端路径同一来源),cd 由 --cwd 承担fn launch_kooky_cli(meta: &SessionMeta) -> ResumeOutcome {- let fail = |command: String, error: String| ResumeOutcome { ok: false, command, error: Some(error) };+ let fail = |command: String, error: String| ResumeOutcome {+ ok: false,+ command,+ error: Some(error),+ };let Some(cli) = kooky_cli_path() else {- return fail(String::new(), "kooky-cli not found — update Kooky to 0.51+".into());+ return fail(+ String::new(),+ "kooky-cli not found — update Kooky to 0.51+".into(),+ );};let Some((bin, (args, _))) = session_bin(meta).zip(resume_args(meta.agent, &meta.id)) else {- return fail(String::new(), format!("Resume isn't supported for {} yet", meta.agent.display_name()));+ return fail(+ String::new(),+ format!(+ "Resume isn't supported for {} yet",+ meta.agent.display_name()+ ),+ );};// agent CLI 走与真终端路径同一次解析(GUI 进程 PATH 不全,过 login shell),// 顺带承担"装没装"的判断:少了这步,kooky 会开出一个只写着 command not// found 的 tab,而 Wake 这边照报成功let Some(exe) = resolve_cli(bin) else {- return fail(String::new(), format!("Command {bin} not found — is it installed?"));+ return fail(+ String::new(),+ format!("Command {bin} not found — is it installed?"),+ );};let cmd = std::iter::once(exe.as_str()).chain(args.iter().map(|s| s.as_str())).map(posix_quote).collect::<Vec<_>>().join(" ");- let shown = format!("kooky-cli open --cwd {} -e {}", posix_quote(&meta.project_path), posix_quote(&cmd));+ let shown = format!(+ "kooky-cli open --cwd {} -e {}",+ posix_quote(&meta.project_path),+ posix_quote(&cmd)+ );// 手动兜底的是能直接粘进任何终端跑的那条(kooky 的 --cwd 得自己 cd 回来)let cwd_ok = !meta.project_path.is_empty() && Path::new(&meta.project_path).is_dir();let manual = if cwd_ok {@@ -321,18 +343,35 @@ fn launch_kooky_cli(meta: &SessionMeta) -> ResumeOutcome {cmd.clone()};let bail = |reason: String| {- fail(shown.clone(), format!("{reason}. {}", super::clipboard_fallback(&manual)))+ fail(+ shown.clone(),+ format!("{reason}. {}", super::clipboard_fallback(&manual)),+ )};// 项目挪走了 kooky 的 --cwd 就没法落地。走同一条兜底,别让 Kooky 目标// 比 Terminal 少一份可手动执行的命令if !cwd_ok {- return bail(format!("Project directory no longer exists: {}", meta.project_path));+ return bail(format!(+ "Project directory no longer exists: {}",+ meta.project_path+ ));}- match Command::new(cli).args(["open", "--cwd", &meta.project_path, "-e", &cmd]).output() {- Ok(out) if out.status.success() => ResumeOutcome { ok: true, command: shown, error: None },+ match Command::new(cli)+ .args(["open", "--cwd", &meta.project_path, "-e", &cmd])+ .output()+ {+ Ok(out) if out.status.success() => ResumeOutcome {+ ok: true,+ command: shown,+ error: None,+ },Ok(out) => {let reason = String::from_utf8_lossy(&out.stderr).trim().to_string();- bail(if reason.is_empty() { "kooky-cli refused the request".into() } else { reason })+ bail(if reason.is_empty() {+ "kooky-cli refused the request".into()+ } else {+ reason+ })}Err(e) => bail(format!("Couldn't run kooky-cli: {e}")),}@@ -345,14 +384,22 @@ fn launch_kooky(meta: &SessionMeta) -> ResumeOutcome {if !KOOKY_ROSTER.contains(&meta.agent) {return launch_kooky_cli(meta);}- let id_ok = meta.id.chars().next().is_some_and(|c| c.is_ascii_alphanumeric())+ let id_ok = meta+ .id+ .chars()+ .next()+ .is_some_and(|c| c.is_ascii_alphanumeric())&& meta.id.len() <= 200&& meta.id.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '_' | '.' | '-'));if id_ok {- let mut url = format!("kooky://resume?agent={}&id={}", meta.agent.as_str(), meta.id);+ let mut url = format!(+ "kooky://resume?agent={}&id={}",+ meta.agent.as_str(),+ meta.id+ );if !meta.project_path.is_empty() && Path::new(&meta.project_path).is_dir() {url.push_str("&cwd=");url.push_str(&percent_encode(&meta.project_path, false));@@ -363,7 +410,11 @@ fn launch_kooky(meta: &SessionMeta) -> ResumeOutcome {.map(|o| o.status.success()).unwrap_or(false);if deep_ok {- return ResumeOutcome { ok: true, command: url, error: None };+ return ResumeOutcome {+ ok: true,+ command: url,+ error: None,+ };}}let ok = Command::new("open")@@ -387,7 +438,10 @@ pub(super) fn trash_existing(paths: &[&str]) -> anyhow::Result<()> {"tell application \"Finder\" to delete (POSIX file \"{esc}\" as alias)")])?;if !out.status.success() {- anyhow::bail!("Failed to move to Trash: {}", String::from_utf8_lossy(&out.stderr));+ anyhow::bail!(+ "Failed to move to Trash: {}",+ String::from_utf8_lossy(&out.stderr)+ );}}Ok(())diff --git a/crates/wake-core/src/services/terminal/mod.rs b/crates/wake-core/src/services/terminal/mod.rsindex e3008b2..05aecca 100644--- a/crates/wake-core/src/services/terminal/mod.rs+++ b/crates/wake-core/src/services/terminal/mod.rs@@ -65,7 +65,11 @@ static CLI_CACHE: Mutex<Option<HashMap<String, Option<String>>>> = Mutex::new(Nofn resolve_clis(bins: &[&str]) -> HashMap<String, Option<String>> {let mut cache = CLI_CACHE.lock().unwrap();let map = cache.get_or_insert_with(HashMap::new);- let missing: Vec<&str> = bins.iter().filter(|b| !map.contains_key(**b)).copied().collect();+ let missing: Vec<&str> = bins+ .iter()+ .filter(|b| !map.contains_key(**b))+ .copied()+ .collect();if !missing.is_empty() {let found = probe_clis(&missing);for b in missing {@@ -150,7 +154,10 @@ pub fn resume_session_in(meta: &SessionMeta, term: TerminalApp) -> ResumeOutcomereturn ResumeOutcome {ok: false,command: String::new(),- error: Some(format!("Resume isn't supported for {} yet", meta.agent.display_name())),+ error: Some(format!(+ "Resume isn't supported for {} yet",+ meta.agent.display_name()+ )),};};let bin = session_bin(meta);@@ -174,7 +181,10 @@ pub fn resume_session_in(meta: &SessionMeta, term: TerminalApp) -> ResumeOutcomereturn ResumeOutcome {ok: false,command,- error: Some(format!("Project directory no longer exists: {}. {hint}", meta.project_path)),+ error: Some(format!(+ "Project directory no longer exists: {}. {hint}",+ meta.project_path+ )),};}diff --git a/crates/wake-core/src/services/terminal/posix.rs b/crates/wake-core/src/services/terminal/posix.rsindex 831e7b5..0012b91 100644--- a/crates/wake-core/src/services/terminal/posix.rs+++ b/crates/wake-core/src/services/terminal/posix.rs@@ -100,7 +100,10 @@ pub(crate) fn percent_encode(s: &str, keep_slash: bool) -> String {/// windows.rs 直接调 Win32 剪贴板。pub(crate) fn pipe_to(bin: &str, args: &[&str], text: &str) -> bool {use std::io::Write;- let Ok(mut child) = Command::new(bin).args(args).stdin(std::process::Stdio::piped()).spawn()+ let Ok(mut child) = Command::new(bin)+ .args(args)+ .stdin(std::process::Stdio::piped())+ .spawn()else {return false;};diff --git a/crates/wake-core/src/services/terminal/windows.rs b/crates/wake-core/src/services/terminal/windows.rsindex c97aa43..d7a82a3 100644--- a/crates/wake-core/src/services/terminal/windows.rs+++ b/crates/wake-core/src/services/terminal/windows.rs@@ -369,7 +369,9 @@ pub(super) fn copy_to_clipboard(text: &str) -> bool {};// GlobalFree 归 Foundation(windows-sys 的分模块与 MSDN 头文件不同名)use windows_sys::Win32::Foundation::GlobalFree;- use windows_sys::Win32::System::Memory::{GlobalAlloc, GlobalLock, GlobalUnlock, GMEM_MOVEABLE};+ use windows_sys::Win32::System::Memory::{+ GlobalAlloc, GlobalLock, GlobalUnlock, GMEM_MOVEABLE,+ };use windows_sys::Win32::UI::WindowsAndMessaging::{CreateWindowExW, DestroyWindow, HWND_MESSAGE,};diff --git a/crates/wake-core/src/watcher.rs b/crates/wake-core/src/watcher.rsindex 8506cd5..f39ed96 100644--- a/crates/wake-core/src/watcher.rs+++ b/crates/wake-core/src/watcher.rs@@ -58,8 +58,12 @@ pub fn promote_survivors(if !seen.insert(key.as_str()) {continue;}- let Some((agent_str, native_id)) = key.split_once(':') else { continue };- let Some(agent) = AgentId::from_str(agent_str) else { continue };+ let Some((agent_str, native_id)) = key.split_once(':') else {+ continue;+ };+ let Some(agent) = AgentId::from_str(agent_str) else {+ continue;+ };let mut agent_refs: Vec<SessionFileRef> = Vec::new();for a in adapters.iter().filter(|a| a.agent() == agent) {if let Ok(refs) = a.list_session_files() {@@ -135,7 +139,9 @@ pub fn start_watcher(};let mut batch = vec![first];let deadline = std::time::Instant::now() + Duration::from_millis(800);- while let Ok(ev) = rx.recv_timeout(deadline.saturating_duration_since(std::time::Instant::now())) {+ while let Ok(ev) =+ rx.recv_timeout(deadline.saturating_duration_since(std::time::Instant::now()))+ {batch.push(ev);if std::time::Instant::now() >= deadline {break;diff --git a/crates/wake-core/tests/db_roundtrip.rs b/crates/wake-core/tests/db_roundtrip.rsindex 5a2880e..5a2f3ed 100644--- a/crates/wake-core/tests/db_roundtrip.rs+++ b/crates/wake-core/tests/db_roundtrip.rs@@ -96,8 +96,34 @@ fn user_data_survives_rebuild() {.set_user_data("claude-code:s3", Some(true), Some(true)).unwrap();- // 重建索引(sessions/messages 清空重来)后,收藏/置顶必须还在+ let removed = meta("claude-code:removed", "已删除的会话");+ store+ .write_session(&removed, removed.updated_at, &[])+ .unwrap();+ store.remove_session("claude-code:removed", true).unwrap();+ store.add_custom_root("codex", "/tmp/codex-copy").unwrap();+ store.add_removed_default("gemini").unwrap();+ store+ .set_location_enabled("codex", "/tmp/codex-copy/sessions", false)+ .unwrap();++ // 重建索引只动可派生表;用户选择与防复活墓碑都必须保留。store.rebuild_all().unwrap();+ assert!(store.is_key_tombstoned("claude-code:removed"));+ assert_eq!(+ store.list_custom_roots().unwrap(),+ vec![("codex".to_string(), "/tmp/codex-copy".to_string())]+ );+ assert_eq!(+ store.list_removed_defaults().unwrap(),+ vec!["gemini".to_string()]+ );+ assert_eq!(+ store.list_disabled_locations().unwrap(),+ vec![("codex".to_string(), "/tmp/codex-copy/sessions".to_string())]+ );++ // session 被扫描器重新写回后,独立 user_data 重新合并进结果。store.write_session(&m, m.updated_at, &[]).unwrap();let got = store.get_session("claude-code:s3").unwrap().unwrap();assert!(got.favorite, "重建后收藏丢失 = user_data 未独立");diff --git a/crates/wake-core/tests/scanner_finale.rs b/crates/wake-core/tests/scanner_finale.rsindex dce6de1..6db046b 100644--- a/crates/wake-core/tests/scanner_finale.rs+++ b/crates/wake-core/tests/scanner_finale.rs@@ -57,7 +57,9 @@ impl AgentAdapter for FailingAdapter {}fn assert_terminal_event(events: &[ScanProgress], ctx: &str) {- let last = events.last().unwrap_or_else(|| panic!("{ctx}: 无任何进度事件"));+ let last = events+ .last()+ .unwrap_or_else(|| panic!("{ctx}: 无任何进度事件"));assert!(!last.scanning,"{ctx}: 最后一个事件 scanning 仍为 true,UI 刷新弹窗将永久锁死"@@ -239,7 +241,10 @@ fn tombstoned_session_does_not_resurrect_on_rescan() {let rec = Recorder::new();run_scan(&adapters, &store, &rec, true).unwrap();- assert!(store.get_session("codex:ghost").unwrap().is_some(), "首扫应写入");+ assert!(+ store.get_session("codex:ghost").unwrap().is_some(),+ "首扫应写入"+ );store.remove_session("codex:ghost", true).unwrap();run_scan(&adapters, &store, &rec, true).unwrap();@@ -258,7 +263,13 @@ fn duplicate_session_across_roots_resolves_to_newest() {let store = temp_store(dir.path());let adapters: Vec<Box<dyn AgentAdapter>> = vec![Box::new(seed(AgentId::Codex, "/live", "/live/dup.jsonl", "dup", 9)),- Box::new(seed(AgentId::Codex, "/backup", "/backup/dup.jsonl", "dup", 5)),+ Box::new(seed(+ AgentId::Codex,+ "/backup",+ "/backup/dup.jsonl",+ "dup",+ 5,+ )),];let rec = Recorder::new();for round in 0..2 {@@ -303,13 +314,19 @@ fn incremental_write_respects_duplicate_winner() {let live = seed(AgentId::Codex, "/live", "/live/dup.jsonl", "dup", 9);let backup = seed(AgentId::Codex, "/backup", "/backup/dup.jsonl", "dup", 5);let backup_ref = backup.r.clone();- let newer_ref = SessionFileRef { mtime_ms: 12, ..backup.r.clone() };+ let newer_ref = SessionFileRef {+ mtime_ms: 12,+ ..backup.r.clone()+ };let mut newer_backup = seed(AgentId::Codex, "/backup", "/backup/dup.jsonl", "dup", 12);newer_backup.r = newer_ref.clone();let adapters: Vec<Box<dyn AgentAdapter>> = vec![Box::new(live), Box::new(backup)];let rec = Recorder::new();run_scan(&adapters, &store, &rec, true).unwrap();- assert_eq!(store.get_session("codex:dup").unwrap().unwrap().file_path, "/live/dup.jsonl");+ assert_eq!(+ store.get_session("codex:dup").unwrap().unwrap().file_path,+ "/live/dup.jsonl"+ );// 旧副本来了个文件事件:必须被裁决挡下wake_core::scanner::scan_files(&adapters, &store, &rec, vec![backup_ref]);@@ -335,8 +352,13 @@ fn incremental_write_respects_duplicate_winner() {fn pure_deletion_scan_notifies_sessions_changed() {let dir = tempfile::tempdir().unwrap();let store = temp_store(dir.path());- let adapters: Vec<Box<dyn AgentAdapter>> =- vec![Box::new(seed(AgentId::Codex, "/live", "/live/one.jsonl", "one", 5))];+ let adapters: Vec<Box<dyn AgentAdapter>> = vec![Box::new(seed(+ AgentId::Codex,+ "/live",+ "/live/one.jsonl",+ "one",+ 5,+ ))];run_scan(&adapters, &store, &Recorder::new(), true).unwrap();assert!(store.get_session("codex:one").unwrap().is_some());@@ -344,8 +366,14 @@ fn pure_deletion_scan_notifies_sessions_changed() {let rec = Recorder::new();let empty: Vec<Box<dyn AgentAdapter>> = Vec::new();run_scan(&empty, &store, &rec, false).unwrap();- assert!(store.get_session("codex:one").unwrap().is_none(), "行应被出清");- assert!(rec.changed() > 0, "纯删除轮未发 on_sessions_changed,UI 不会刷新");+ assert!(+ store.get_session("codex:one").unwrap().is_none(),+ "行应被出清"+ );+ assert!(+ rec.changed() > 0,+ "纯删除轮未发 on_sessions_changed,UI 不会刷新"+ );}/// 胜者副本损坏时按裁决顺位回退:会话不得从索引消失(2026-08-24 Codex review P2)@@ -357,7 +385,13 @@ fn corrupt_winner_falls_back_to_valid_copy() {broken_live.fail_parse = true;let adapters: Vec<Box<dyn AgentAdapter>> = vec![Box::new(broken_live),- Box::new(seed(AgentId::Codex, "/backup", "/backup/dup.jsonl", "dup", 5)),+ Box::new(seed(+ AgentId::Codex,+ "/backup",+ "/backup/dup.jsonl",+ "dup",+ 5,+ )),];run_scan(&adapters, &store, &Recorder::new(), true).unwrap();let s = store@@ -375,21 +409,42 @@ fn survivor_copy_promoted_after_winner_deleted() {let store = temp_store(dir.path());let adapters: Vec<Box<dyn AgentAdapter>> = vec![Box::new(seed(AgentId::Codex, "/live", "/live/dup.jsonl", "dup", 9)),- Box::new(seed(AgentId::Codex, "/backup", "/backup/dup.jsonl", "dup", 5)),+ Box::new(seed(+ AgentId::Codex,+ "/backup",+ "/backup/dup.jsonl",+ "dup",+ 5,+ )),];let rec = Recorder::new();run_scan(&adapters, &store, &rec, true).unwrap();- assert_eq!(store.get_session("codex:dup").unwrap().unwrap().file_path, "/live/dup.jsonl");+ assert_eq!(+ store.get_session("codex:dup").unwrap().unwrap().file_path,+ "/live/dup.jsonl"+ );- let key = store.remove_by_path("/live/dup.jsonl").unwrap().expect("应返回被删 key");+ let key = store+ .remove_by_path("/live/dup.jsonl")+ .unwrap()+ .expect("应返回被删 key");assert!(store.get_session("codex:dup").unwrap().is_none());// 真实世界里被删文件不会再被枚举;SeedAdapter 是静态的,用"删除后"的// roster(只剩 backup 实例)喂给上位逻辑- let after: Vec<Box<dyn AgentAdapter>> =- vec![Box::new(seed(AgentId::Codex, "/backup", "/backup/dup.jsonl", "dup", 5))];+ let after: Vec<Box<dyn AgentAdapter>> = vec![Box::new(seed(+ AgentId::Codex,+ "/backup",+ "/backup/dup.jsonl",+ "dup",+ 5,+ ))];wake_core::watcher::promote_survivors(&after, &store, &rec, &[key]);assert_eq!(- store.get_session("codex:dup").unwrap().expect("幸存副本应上位").file_path,+ store+ .get_session("codex:dup")+ .unwrap()+ .expect("幸存副本应上位")+ .file_path,"/backup/dup.jsonl");}@@ -410,8 +465,14 @@ fn owner_change_migrates_existing_rows() {let as_omp: Vec<Box<dyn AgentAdapter>> =vec![Box::new(seed(AgentId::Omp, "/d", "/d/s.jsonl", "s", 7))];run_scan(&as_omp, &store, &Recorder::new(), false).unwrap();- assert!(store.get_session("pi:s").unwrap().is_none(), "旧 agent 行应被清理");- assert!(store.get_session("omp:s").unwrap().is_some(), "新 agent 行应入库");+ assert!(+ store.get_session("pi:s").unwrap().is_none(),+ "旧 agent 行应被清理"+ );+ assert!(+ store.get_session("omp:s").unwrap().is_some(),+ "新 agent 行应入库"+ );}/// 墓碑双轨(不变量 3 的多副本延伸):删除只 trash 了胜者文件,另一 location@@ -429,7 +490,13 @@ fn tombstone_blocks_all_copies() {};let adapters: Vec<Box<dyn AgentAdapter>> = vec![Box::new(seed(AgentId::Codex, "/live", "/live/dup.jsonl", "dup", 9)),- Box::new(seed(AgentId::Codex, "/backup", "/backup/dup.jsonl", "dup", 5)),+ Box::new(seed(+ AgentId::Codex,+ "/backup",+ "/backup/dup.jsonl",+ "dup",+ 5,+ )),];let rec = Recorder::new();run_scan(&adapters, &store, &rec, true).unwrap();@@ -461,7 +528,10 @@ fn quick_meta_respects_key_tombstone() {let adapters: Vec<Box<dyn AgentAdapter>> = vec![Box::new(a)];let rec = Recorder::new();run_scan(&adapters, &store, &rec, true).unwrap();- assert!(store.get_session("codex:thread-1").unwrap().is_some(), "quick 改名 key 应入库");+ assert!(+ store.get_session("codex:thread-1").unwrap().is_some(),+ "quick 改名 key 应入库"+ );store.remove_session("codex:thread-1", true).unwrap();run_scan(&adapters, &store, &rec, true).unwrap();@@ -469,7 +539,10 @@ fn quick_meta_respects_key_tombstone() {store.get_session("codex:thread-1").unwrap().is_none(),"quick 快路径复活了已删会话");- assert!(store.get_session("codex:dup").unwrap().is_none(), "native key 也不得复活");+ assert!(+ store.get_session("codex:dup").unwrap().is_none(),+ "native key 也不得复活"+ );}/// key 后缀是内容 id 的家(gemini/pi/dsh):上位反查文件名对不上时,@@ -479,7 +552,13 @@ fn survivor_promotion_matches_content_keys() {let dir = tempfile::tempdir().unwrap();let store = temp_store(dir.path());// meta.key 的后缀(LOGICAL)与文件名 native_id(session-123)不同- let mut backup = seed(AgentId::Gemini, "/backup", "/backup/session-123.jsonl", "session-123", 5);+ let mut backup = seed(+ AgentId::Gemini,+ "/backup",+ "/backup/session-123.jsonl",+ "session-123",+ 5,+ );backup.meta.key = "gemini:LOGICAL".to_string();backup.meta.id = "LOGICAL".to_string();let after: Vec<Box<dyn AgentAdapter>> = vec![Box::new(backup)];diff --git a/crates/wake/assets/icons/database.svg b/crates/wake/assets/icons/database.svgnew file mode 100644index 0000000..7f22b7b--- /dev/null+++ b/crates/wake/assets/icons/database.svg@@ -0,0 +1,17 @@+<!-- @license lucide-static v0.462.0 - ISC -->+<svg+ class="lucide lucide-database"+ xmlns="http://www.w3.org/2000/svg"+ width="24"+ height="24"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ stroke-width="2"+ stroke-linecap="round"+ stroke-linejoin="round"+>+ <ellipse cx="12" cy="5" rx="9" ry="3" />+ <path d="M3 5v14c0 1.7 4 3 9 3s9-1.3 9-3V5" />+ <path d="M3 12c0 1.7 4 3 9 3s9-1.3 9-3" />+</svg>diff --git a/crates/wake/assets/icons/info.svg b/crates/wake/assets/icons/info.svgnew file mode 100644index 0000000..aaac8fd--- /dev/null+++ b/crates/wake/assets/icons/info.svg@@ -0,0 +1,5 @@+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <circle cx="12" cy="12" r="10"/>+ <path d="M12 16v-4"/>+ <path d="M12 8h.01"/>+</svg>diff --git a/crates/wake/assets/icons/settings.svg b/crates/wake/assets/icons/settings.svgnew file mode 100644index 0000000..32030ea--- /dev/null+++ b/crates/wake/assets/icons/settings.svg@@ -0,0 +1,16 @@+<!-- @license lucide-static v0.462.0 - ISC -->+<svg+ class="lucide lucide-settings"+ xmlns="http://www.w3.org/2000/svg"+ width="24"+ height="24"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ stroke-width="2"+ stroke-linecap="round"+ stroke-linejoin="round"+>+ <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.09a2 2 0 0 1 1 1.74v.5a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.38a2 2 0 0 0-.73-2.73l-.15-.09a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" />+ <circle cx="12" cy="12" r="3" />+</svg>diff --git a/crates/wake/src/assets.rs b/crates/wake/src/assets.rsindex 093eff1..b7ee952 100644--- a/crates/wake/src/assets.rs+++ b/crates/wake/src/assets.rs@@ -56,6 +56,13 @@ brands!("deepseek",);+fn lookup_product(path: &str) -> Option<&'static [u8]> {+ match path {+ "brands/wake.png" => Some(include_bytes!("../assets/icon-1024.png")),+ _ => None,+ }+}+icons!(// gpui-component TitleBar 的 Linux 窗口控制按钮(IconName::Window* 按这// 四个路径取图;缺了按钮就渲染成隐形热区——2026-08-24 Codex review)@@ -89,12 +96,18 @@ icons!("file-text","more-horizontal","hard-drive",+ "database",+ "settings","plus",+ "info",);impl AssetSource for Assets {fn load(&self, path: &str) -> Result<Option<Cow<'static, [u8]>>> {- Ok(lookup(path).or_else(|| lookup_brand(path)).map(Cow::Borrowed))+ Ok(lookup(path)+ .or_else(|| lookup_brand(path))+ .or_else(|| lookup_product(path))+ .map(Cow::Borrowed))}fn list(&self, _path: &str) -> Result<Vec<SharedString>> {diff --git a/crates/wake/src/main.rs b/crates/wake/src/main.rsindex 5cd5fba..583874f 100644--- a/crates/wake/src/main.rs+++ b/crates/wake/src/main.rs@@ -1,10 +1,14 @@// release 挂 windows 子系统:双击启动不带控制台黑窗。debug 保留控制台,// eprintln 的诊断日志还有处落;GUI 子系统下致命错误走 MessageBox//(wake-core 的 show_fatal_alert),不依赖 stderr。-#![cfg_attr(all(target_os = "windows", not(debug_assertions)), windows_subsystem = "windows")]+#![cfg_attr(+ all(target_os = "windows", not(debug_assertions)),+ windows_subsystem = "windows"+)]mod assets;mod format;+mod settings;mod theme;mod ui;mod workbench;@@ -13,7 +17,8 @@ use assets::Assets;use gpui::*;use gpui_component::Root;use workbench::{- PaletteDown, PaletteUp, RefreshSessions, ToggleSearch, Workbench, KEY_CONTEXT, PALETTE_CONTEXT,+ OpenAbout, OpenSettings, PaletteDown, PaletteUp, RefreshSessions, ToggleSearch, Workbench,+ KEY_CONTEXT, PALETTE_CONTEXT,};actions!(wake_app, [Quit, CloseWindow]);@@ -35,6 +40,7 @@ fn main() {cx.bind_keys([KeyBinding::new(ui::SEARCH_KEYSTROKE, ToggleSearch, Some(KEY_CONTEXT)),KeyBinding::new("secondary-r", RefreshSessions, Some(KEY_CONTEXT)),+ KeyBinding::new("secondary-,", OpenSettings, None),KeyBinding::new("secondary-q", Quit, None),KeyBinding::new("secondary-w", CloseWindow, None),// ⌘K 面板:焦点在搜索输入框,↑↓ 冒泡到面板容器挪选中@@ -44,7 +50,13 @@ fn main() {cx.set_menus(vec![Menu {name: "Wake".into(),- items: vec![MenuItem::action("Quit Wake", Quit)],+ items: vec![+ MenuItem::action("About Wake", OpenAbout),+ MenuItem::separator(),+ MenuItem::action("Settings…", OpenSettings),+ MenuItem::separator(),+ MenuItem::action("Quit Wake", Quit),+ ],},Menu {name: "File".into(),diff --git a/crates/wake/src/settings.rs b/crates/wake/src/settings.rsnew file mode 100644index 0000000..9bafc14--- /dev/null+++ b/crates/wake/src/settings.rs@@ -0,0 +1,889 @@+use gpui::prelude::FluentBuilder as _;+use gpui::*;+use gpui_component::button::{Button, ButtonCustomVariant, ButtonVariants as _};+use gpui_component::menu::{DropdownMenu as _, PopupMenuItem};+use gpui_component::switch::Switch;+use gpui_component::{+ h_flex, v_flex, ActiveTheme as _, Icon, Root, Selectable as _, Sizable as _, StyledExt as _,+ TitleBar, WindowExt as _,+};++use wake_core::models::AgentId;++use crate::ui::{+ BUTTON_SM_H, FONT_BODY, FONT_CAPTION, FONT_DISPLAY, FONT_HEADING, FONT_LABEL, FONT_TITLE,+ RADIUS_BUTTON, SHOW_IN_FM, SPACE_LG, SPACE_MD, SPACE_SM, SPACE_XL, SPACE_XS, SPACE_XXL,+};+use crate::workbench::{DataSourceRow, OpenAbout, OpenSettings, Workbench};+use crate::{theme, theme::AppearancePreference};++const SETTINGS_SIDEBAR_W: Pixels = px(188.);++fn icon(path: &'static str) -> Icon {+ Icon::empty().path(path)+}++fn format_storage_size(bytes: u64) -> String {+ const KIB: f64 = 1024.;+ const MIB: f64 = KIB * 1024.;+ const GIB: f64 = MIB * 1024.;+ let bytes = bytes as f64;+ if bytes >= GIB {+ format!("{:.1} GB", bytes / GIB)+ } else if bytes >= MIB {+ format!("{:.1} MB", bytes / MIB)+ } else if bytes >= KIB {+ format!("{:.1} KB", bytes / KIB)+ } else {+ format!("{} bytes", bytes as u64)+ }+}++#[derive(Clone, Copy, PartialEq, Eq)]+pub(crate) enum SettingsPage {+ General,+ Locations,+ Data,+ About,+}++/// Settings 内所有文字按钮共用一套尺寸和材质;避免页面各自混用+/// outline / primary / 默认 ButtonGroup 后形成多套视觉语言。设置页里的+/// 页面动作都保持低强调,确认弹窗里的最终提交才使用 primary。+fn settings_button(button: Button, cx: &App) -> Button {+ let theme = cx.theme();+ button+ .custom(+ ButtonCustomVariant::new(cx)+ .color(theme.secondary)+ .foreground(theme.secondary_foreground)+ .border(theme.border)+ .hover(theme.secondary_hover)+ .active(theme.secondary_active),+ )+ .small()+ .rounded(RADIUS_BUTTON)+}++pub(crate) struct SettingsView {+ focus_handle: FocusHandle,+ workbench: Entity<Workbench>,+ appearance: AppearancePreference,+ show_unavailable: bool,+ _workbench_observer: Option<Subscription>,+}++impl SettingsView {+ pub(crate) fn new(+ workbench: Entity<Workbench>,+ window: &mut Window,+ cx: &mut Context<Self>,+ ) -> Self {+ let observed = workbench.clone();+ // Settings 是在 Workbench::open_settings 的 update 栈内创建的;此处+ // 立即 observe 会尝试反读仍被独占借用的 Workbench,触发 double lease。+ // 下一帧注册时外层 update 已退出。+ cx.on_next_frame(window, move |this, _, cx| {+ this._workbench_observer = Some(cx.observe(&observed, |_, _, cx| cx.notify()));+ });+ Self {+ focus_handle: cx.focus_handle(),+ workbench,+ appearance: theme::appearance_preference(),+ show_unavailable: false,+ _workbench_observer: None,+ }+ }++ fn render_nav_item(+ &self,+ id: &'static str,+ label: &'static str,+ icon_path: &'static str,+ page: SettingsPage,+ cx: &Context<Self>,+ ) -> AnyElement {+ let theme = cx.theme();+ let active = self.workbench.read(cx).settings_page() == page;+ let workbench = self.workbench.clone();+ h_flex()+ .id(id)+ .h(px(34.))+ .w_full()+ .px(SPACE_MD)+ .gap(SPACE_SM)+ .items_center()+ .rounded(theme.radius)+ .cursor_pointer()+ .when(active, |this| {+ this.bg(theme.sidebar_accent)+ .text_color(theme.sidebar_accent_foreground)+ })+ .when(!active, |this| {+ this.text_color(theme.sidebar_foreground)+ .hover(|style| style.bg(theme.sidebar_accent.opacity(0.55)))+ })+ .on_click(move |_, _, cx| {+ workbench.update(cx, |this, cx| this.select_settings_page(page, cx));+ })+ .child(icon(icon_path).with_size(px(15.)).flex_shrink_0())+ .child(div().text_size(FONT_BODY).font_medium().child(label))+ .into_any_element()+ }++ fn render_sidebar(&self, window: &Window, cx: &Context<Self>) -> AnyElement {+ let theme = cx.theme();+ let show_titlebar = cfg!(target_os = "macos")+ || matches!(window.window_decorations(), Decorations::Client { .. });++ v_flex()+ .w(SETTINGS_SIDEBAR_W)+ .h_full()+ .flex_shrink_0()+ .bg(theme.sidebar)+ .border_r_1()+ .border_color(theme.sidebar_border)+ .when(show_titlebar, |this| this.child(TitleBar::new()))+ .child(+ div()+ .px(SPACE_LG)+ .pt(SPACE_SM)+ .pb(SPACE_XL)+ .text_size(FONT_HEADING)+ .font_semibold()+ .text_color(theme.sidebar_foreground)+ .child("Settings"),+ )+ .child(+ v_flex()+ .flex_1()+ .px(SPACE_SM)+ .gap(px(2.))+ .child(self.render_nav_item(+ "settings-general-nav",+ "General",+ "icons/settings.svg",+ SettingsPage::General,+ cx,+ ))+ .child(self.render_nav_item(+ "settings-locations-nav",+ "Locations",+ "icons/hard-drive.svg",+ SettingsPage::Locations,+ cx,+ ))+ .child(self.render_nav_item(+ "settings-data-nav",+ "Data",+ "icons/database.svg",+ SettingsPage::Data,+ cx,+ )),+ )+ .child(div().px(SPACE_SM).pb(SPACE_SM).child(self.render_nav_item(+ "settings-about-nav",+ "About",+ "icons/info.svg",+ SettingsPage::About,+ cx,+ )))+ .into_any_element()+ }++ fn appearance_button(+ &self,+ id: &'static str,+ label: &'static str,+ preference: AppearancePreference,+ cx: &Context<Self>,+ ) -> Button {+ let theme = cx.theme();+ let selected = self.appearance == preference;+ Button::new(id)+ .custom(+ ButtonCustomVariant::new(cx)+ .color(theme.transparent)+ .foreground(if selected {+ theme.foreground+ } else {+ theme.muted_foreground+ })+ .border(theme.transparent)+ .hover(theme.secondary_hover)+ .active(theme.popover),+ )+ .small()+ .w(px(64.))+ .rounded(RADIUS_BUTTON)+ .label(label)+ .selected(selected)+ .when(selected, |this| this.shadow_xs())+ .on_click(cx.listener(move |this, _, window, cx| {+ match theme::set_appearance(preference, Some(window), cx) {+ Ok(()) => {+ this.appearance = preference;+ cx.notify();+ }+ Err(error) => window.push_notification(+ gpui_component::notification::Notification::error(format!(+ "Couldn't save appearance: {error}"+ )),+ cx,+ ),+ }+ }))+ }++ fn render_general(&mut self, cx: &mut Context<Self>) -> AnyElement {+ let theme = cx.theme();+ v_flex()+ .flex_1()+ .min_w_0()+ .h_full()+ .bg(theme.background)+ .child(+ v_flex()+ .flex_shrink_0()+ .px(SPACE_XXL)+ .pt(px(44.))+ .pb(SPACE_XL)+ .gap(px(5.))+ .child(+ div()+ .text_size(FONT_TITLE)+ .font_semibold()+ .text_color(theme.foreground)+ .child("General"),+ )+ .child(+ div()+ .text_size(FONT_CAPTION)+ .text_color(theme.muted_foreground)+ .child("Customize how Wake looks."),+ ),+ )+ .child(+ v_flex()+ .px(SPACE_XXL)+ .gap(SPACE_SM)+ .child(+ div()+ .text_size(FONT_CAPTION)+ .font_semibold()+ .text_color(theme.foreground)+ .child("Appearance"),+ )+ .child(+ h_flex()+ .min_h(px(72.))+ .w_full()+ .px(SPACE_LG)+ .gap(SPACE_LG)+ .items_center()+ .rounded(theme.radius_lg)+ .border_1()+ .border_color(theme.border)+ .bg(theme.popover)+ .child(+ v_flex()+ .flex_1()+ .min_w_0()+ .gap(px(3.))+ .child(+ div()+ .text_size(FONT_BODY)+ .text_color(theme.foreground)+ .child("Appearance"),+ )+ .child(+ div()+ .text_size(FONT_CAPTION)+ .text_color(theme.muted_foreground)+ .child("Follow the system or keep Wake light or dark."),+ ),+ )+ .child(+ h_flex()+ .h(BUTTON_SM_H + px(4.))+ .p(px(2.))+ .rounded(theme.radius)+ .border_1()+ .border_color(theme.border)+ .bg(theme.secondary)+ .child(self.appearance_button(+ "appearance-system",+ "System",+ AppearancePreference::System,+ cx,+ ))+ .child(self.appearance_button(+ "appearance-light",+ "Light",+ AppearancePreference::Light,+ cx,+ ))+ .child(self.appearance_button(+ "appearance-dark",+ "Dark",+ AppearancePreference::Dark,+ cx,+ )),+ ),+ ),+ )+ .into_any_element()+ }++ fn render_data(&mut self, cx: &mut Context<Self>) -> AnyElement {+ let theme = cx.theme();+ let snapshot = self.workbench.read(cx).data_settings_snapshot();+ let session_word = if snapshot.session_count == 1 {+ "session"+ } else {+ "sessions"+ };+ let summary: SharedString = format!(+ "{} {session_word} · {}",+ snapshot.session_count,+ format_storage_size(snapshot.size_bytes)+ )+ .into();+ let reveal_path = snapshot.raw_path.clone();+ let show_in_finder = settings_button(+ Button::new("settings-show-data")+ .icon(icon("icons/folder.svg").with_size(px(13.)))+ .label(SHOW_IN_FM),+ cx,+ )+ .on_click(move |_, _, _| {+ wake_core::services::terminal::open_in_file_manager(reveal_path.as_ref())+ });++ v_flex()+ .flex_1()+ .min_w_0()+ .h_full()+ .bg(theme.background)+ .child(+ v_flex()+ .flex_shrink_0()+ .px(SPACE_XXL)+ .pt(px(44.))+ .pb(SPACE_XL)+ .gap(px(5.))+ .child(+ div()+ .text_size(FONT_TITLE)+ .font_semibold()+ .text_color(theme.foreground)+ .child("Data"),+ )+ .child(+ div()+ .text_size(FONT_CAPTION)+ .text_color(theme.muted_foreground)+ .child(+ "See where Wake stores local data. Sessions refresh automatically.",+ ),+ ),+ )+ .child(+ v_flex()+ .px(SPACE_XXL)+ .gap(SPACE_SM)+ .child(+ div()+ .text_size(FONT_CAPTION)+ .font_semibold()+ .text_color(theme.foreground)+ .child("Storage"),+ )+ .child(+ v_flex()+ .w_full()+ .overflow_hidden()+ .rounded(theme.radius_lg)+ .border_1()+ .border_color(theme.border)+ .bg(theme.popover)+ .child(+ h_flex()+ .min_h(px(84.))+ .px(SPACE_LG)+ .gap(SPACE_LG)+ .items_center()+ .child(+ v_flex()+ .flex_1()+ .min_w_0()+ .gap(px(3.))+ .child(+ div()+ .text_size(FONT_BODY)+ .text_color(theme.foreground)+ .child("Wake data"),+ )+ .child(+ div()+ .w_full()+ .truncate()+ .text_size(FONT_CAPTION)+ .text_color(theme.muted_foreground)+ .child(snapshot.display_path),+ )+ .child(+ div()+ .text_size(FONT_CAPTION)+ .text_color(theme.muted_foreground)+ .child(summary),+ ),+ )+ .child(show_in_finder),+ ),+ ),+ )+ .into_any_element()+ }++ fn about_link(+ &self,+ id: &'static str,+ label: &'static str,+ url: &'static str,+ cx: &Context<Self>,+ ) -> AnyElement {+ let theme = cx.theme();+ div()+ .id(id)+ .cursor_pointer()+ .text_size(FONT_LABEL)+ .font_family(theme.mono_font_family.clone())+ .text_color(theme.foreground)+ .hover(|style| style.text_decoration_1())+ .on_click(move |_, _, cx| cx.open_url(url))+ .child(label)+ .into_any_element()+ }++ /// 与 Kooky / Birth 的 About 面板使用同一信息层级,但落在 Wake 已有的+ /// Settings 场景内:产品图标、名称、版本、tagline、仓库和作者署名。+ fn render_about(&mut self, cx: &mut Context<Self>) -> AnyElement {+ let theme = cx.theme();+ let faint = theme.muted_foreground.opacity(0.72);+ let version: SharedString = format!("Version {}", env!("CARGO_PKG_VERSION")).into();++ v_flex()+ .flex_1()+ .min_w_0()+ .h_full()+ .items_center()+ .bg(theme.background)+ .child(+ v_flex()+ .w(px(360.))+ .items_center()+ .pt(px(64.))+ .child(+ img("brands/wake.png")+ .size(px(78.))+ .flex_shrink_0()+ .mb(SPACE_MD),+ )+ .child(+ div()+ .text_size(FONT_DISPLAY)+ .font_medium()+ .text_color(theme.foreground)+ .child("Wake"),+ )+ .child(+ div()+ .mt(SPACE_XS)+ .text_size(FONT_LABEL)+ .font_family(theme.mono_font_family.clone())+ .text_color(theme.muted_foreground)+ .child(version),+ )+ .child(+ div()+ .mt(SPACE_MD)+ .text_size(FONT_CAPTION)+ .text_color(theme.muted_foreground)+ .child("All your AI agent sessions, in one place."),+ )+ .child(div().mt(px(14.)).child(self.about_link(+ "about-github",+ "GitHub ↗",+ "https://github.com/iAmCorey/Wake",+ cx,+ )))+ .child(div().w(px(32.)).h(px(1.)).my(SPACE_LG).bg(theme.border))+ .child(+ div()+ .text_size(FONT_LABEL)+ .font_family(theme.mono_font_family.clone())+ .text_color(faint)+ .child("© 2026 Corey Chiu · MIT License"),+ )+ .child(+ h_flex()+ .mt(SPACE_XS)+ .text_size(FONT_LABEL)+ .font_family(theme.mono_font_family.clone())+ .text_color(faint)+ .child("Built with ❤️ by ")+ .child(self.about_link(+ "about-author",+ "Corey Chiu",+ "https://coreychiu.com?utm_source=wake",+ cx,+ )),+ ),+ )+ .into_any_element()+ }++ fn render_location_row(&self, row: DataSourceRow, ix: usize, cx: &Context<Self>) -> AnyElement {+ let theme = cx.theme();+ let enabled = row.enabled;+ let exists = row.exists;+ let raw = row.raw.clone();++ let edit_workbench = self.workbench.clone();+ let edit_row = row.clone();+ let reveal_path = row.raw.clone();+ let remove_target = row.custom.clone();+ let remove_agent = row.agent;+ let menu = Button::new(("settings-location-menu", ix))+ .ghost()+ .small()+ .rounded(RADIUS_BUTTON)+ .icon(icon("icons/more-horizontal.svg").with_size(px(14.)))+ .dropdown_menu(move |menu, _, _| {+ let workbench = edit_workbench.clone();+ let edit_row = edit_row.clone();+ let mut menu = menu+ .min_w(px(180.))+ .item(PopupMenuItem::new("Edit…").on_click(move |_, window, cx| {+ let row = edit_row.clone();+ workbench+ .update(cx, |this, cx| this.open_edit_location_form(row, window, cx));+ }));+ if exists {+ let path = reveal_path.clone();+ menu = menu.item(PopupMenuItem::new(SHOW_IN_FM).on_click(move |_, _, _| {+ wake_core::services::terminal::open_in_file_manager(path.as_ref())+ }));+ }+ if let Some(stored) = remove_target.clone() {+ let workbench = edit_workbench.clone();+ menu = menu.separator().item(PopupMenuItem::new("Remove").on_click(+ move |_, window, cx| {+ let stored = stored.clone();+ workbench.update(cx, |this, cx| {+ this.delete_location(remove_agent, stored, window, cx)+ });+ },+ ));+ }+ menu+ });++ let toggle_workbench = self.workbench.clone();+ let toggle_path = raw;+ let toggle_agent = row.agent;+ h_flex()+ .id(("settings-location-row", ix))+ .min_h(px(60.))+ .w_full()+ .px(SPACE_LG)+ .gap(SPACE_MD)+ .items_center()+ .when(!enabled, |this| this.opacity(0.55))+ .child(+ v_flex()+ .flex_1()+ .min_w_0()+ .gap(px(3.))+ .child(+ div()+ .w_full()+ .truncate()+ .text_size(FONT_BODY)+ .text_color(theme.foreground)+ .child(row.display),+ )+ .child(+ div()+ .text_size(FONT_CAPTION)+ .text_color(if exists {+ theme.muted_foreground+ } else {+ theme.warning+ })+ .child(row.tally),+ ),+ )+ .child(menu)+ .child(+ Switch::new(("settings-location-enabled", ix))+ .checked(enabled)+ .small()+ .tooltip(if enabled {+ "Disable location"+ } else {+ "Enable location"+ })+ .on_click(move |enabled, window, cx| {+ let path = toggle_path.clone();+ toggle_workbench.update(cx, |this, cx| {+ this.set_location_enabled(toggle_agent, path, *enabled, window, cx)+ });+ }),+ )+ .into_any_element()+ }++ fn render_agent_group(+ &self,+ agent: AgentId,+ rows: Vec<DataSourceRow>,+ row_offset: usize,+ cx: &Context<Self>,+ ) -> AnyElement {+ let theme = cx.theme();+ let dark = theme.mode.is_dark();+ v_flex()+ .gap(SPACE_SM)+ .child(+ h_flex()+ .h(px(24.))+ .gap(SPACE_SM)+ .items_center()+ .child(img(agent.brand_icon(dark)).size(px(17.)).flex_shrink_0())+ .child(+ div()+ .text_size(FONT_CAPTION)+ .font_semibold()+ .text_color(theme.foreground)+ .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(self.render_location_row(row, row_offset + ix, cx))+ })),+ )+ .into_any_element()+ }++ fn render_locations(&mut self, cx: &mut Context<Self>) -> impl IntoElement {+ let theme = cx.theme();+ let snapshot = self.workbench.read(cx).location_settings_snapshot();+ let mut groups: Vec<(AgentId, Vec<DataSourceRow>)> = Vec::new();+ for row in snapshot.rows {+ match groups.last_mut() {+ Some((agent, rows)) if *agent == row.agent => rows.push(row),+ _ => groups.push((row.agent, vec![row])),+ }+ }+ let (available, unavailable): (Vec<_>, Vec<_>) = groups+ .into_iter()+ .partition(|(_, rows)| rows.iter().any(|row| row.exists || row.custom.is_some()));+ let unavailable_count = unavailable.len();+ let add_workbench = self.workbench.clone();+ let restore_workbench = self.workbench.clone();+ let diverged = snapshot.diverged;++ let mut row_offset = 0usize;+ let available_elements: Vec<AnyElement> = available+ .into_iter()+ .map(|(agent, rows)| {+ let start = row_offset;+ row_offset += rows.len();+ self.render_agent_group(agent, rows, start, cx)+ })+ .collect();+ let unavailable_elements: Vec<AnyElement> = if self.show_unavailable {+ unavailable+ .into_iter()+ .map(|(agent, rows)| {+ let start = row_offset;+ row_offset += rows.len();+ self.render_agent_group(agent, rows, start, cx)+ })+ .collect()+ } else {+ Vec::new()+ };++ v_flex()+ .flex_1()+ .min_w_0()+ .h_full()+ .bg(theme.background)+ .child(+ h_flex()+ .flex_shrink_0()+ .px(SPACE_XXL)+ .pt(px(44.))+ .pb(SPACE_XL)+ .gap(SPACE_LG)+ .items_start()+ .child(+ v_flex()+ .flex_1()+ .min_w_0()+ .gap(px(5.))+ .child(+ div()+ .text_size(FONT_TITLE)+ .font_semibold()+ .text_color(theme.foreground)+ .child("Session locations"),+ )+ .child(+ div()+ .text_size(FONT_CAPTION)+ .text_color(theme.muted_foreground)+ .child("Choose where Wake looks for local agent sessions."),+ ),+ )+ .child(+ settings_button(+ Button::new("settings-add-location")+ .icon(icon("icons/plus.svg").with_size(px(13.)))+ .label("Add location"),+ cx,+ )+ .on_click(move |_, window, cx| {+ add_workbench+ .update(cx, |this, cx| this.open_add_location_form(window, cx));+ }),+ )+ .child(+ Button::new("settings-location-more")+ .ghost()+ .small()+ .rounded(RADIUS_BUTTON)+ .icon(icon("icons/more-horizontal.svg").with_size(px(14.)))+ .dropdown_menu(move |menu, _, _| {+ let workbench = restore_workbench.clone();+ menu.min_w(px(180.)).item(+ PopupMenuItem::new("Restore defaults")+ .disabled(!diverged)+ .on_click(move |_, window, cx| {+ workbench.update(cx, |this, cx| {+ this.restore_default_locations(window, cx)+ });+ }),+ )+ }),+ ),+ )+ .child(+ v_flex()+ .id("settings-location-list")+ .flex_1()+ .min_h_0()+ .overflow_y_scroll()+ .px(SPACE_XXL)+ .pb(px(40.))+ .gap(SPACE_XL)+ .children(available_elements)+ .when(unavailable_count > 0, |this| {+ this.child(+ v_flex()+ .gap(SPACE_LG)+ .child(+ h_flex()+ .id("settings-unavailable-locations")+ .h(px(36.))+ .w_full()+ .px(SPACE_SM)+ .gap(SPACE_SM)+ .items_center()+ .rounded(theme.radius)+ .cursor_pointer()+ .text_color(theme.muted_foreground)+ .hover(|style| style.bg(theme.secondary_hover))+ .on_click(cx.listener(|this, _, _, cx| {+ this.show_unavailable = !this.show_unavailable;+ cx.notify();+ }))+ .child(+ icon(if self.show_unavailable {+ "icons/chevron-down.svg"+ } else {+ "icons/chevron-right.svg"+ })+ .with_size(px(13.)),+ )+ .child(+ div()+ .flex_1()+ .text_size(FONT_CAPTION)+ .font_medium()+ .child("Not detected"),+ )+ .child(+ div()+ .text_size(FONT_LABEL)+ .child(unavailable_count.to_string()),+ ),+ )+ .children(unavailable_elements),+ )+ }),+ )+ }+}++impl Focusable for SettingsView {+ fn focus_handle(&self, _cx: &App) -> FocusHandle {+ self.focus_handle.clone()+ }+}++impl Render for SettingsView {+ fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {+ let background = cx.theme().background;+ let foreground = cx.theme().foreground;+ let sidebar = self.render_sidebar(window, cx);+ let selected_page = self.workbench.read(cx).settings_page();+ let content = match selected_page {+ SettingsPage::General => self.render_general(cx),+ SettingsPage::Locations => self.render_locations(cx).into_any_element(),+ SettingsPage::Data => self.render_data(cx),+ SettingsPage::About => self.render_about(cx),+ };+ div()+ .id("wake-settings")+ .track_focus(&self.focus_handle)+ .on_action(cx.listener(|this, _: &OpenSettings, _window, cx| {+ this.workbench+ .update(cx, |workbench, cx| workbench.open_settings(cx));+ }))+ .on_action(cx.listener(|this, _: &OpenAbout, _window, cx| {+ this.workbench+ .update(cx, |workbench, cx| workbench.open_about(cx));+ }))+ .size_full()+ .bg(background)+ .text_color(foreground)+ .child(h_flex().size_full().child(sidebar).child(content))+ .children(Root::render_dialog_layer(window, cx))+ .children(Root::render_notification_layer(window, cx))+ }+}diff --git a/crates/wake/src/theme.rs b/crates/wake/src/theme.rsindex af051bf..595e5b5 100644--- a/crates/wake/src/theme.rs+++ b/crates/wake/src/theme.rs@@ -3,6 +3,68 @@use gpui::{App, Hsla, Rgba, Window};use gpui_component::{ActiveTheme as _, Theme, ThemeMode};+#[derive(Debug, Clone, Copy, PartialEq, Eq)]+pub enum AppearancePreference {+ System,+ Light,+ Dark,+}++impl AppearancePreference {+ pub fn as_str(self) -> &'static str {+ match self {+ Self::System => "system",+ Self::Light => "light",+ Self::Dark => "dark",+ }+ }++ fn parse(value: &str) -> Self {+ match value.trim() {+ "light" => Self::Light,+ "dark" => Self::Dark,+ _ => Self::System,+ }+ }+}++fn appearance_path() -> std::path::PathBuf {+ let base = dirs::config_dir()+ .or_else(dirs::data_dir)+ .unwrap_or_else(|| std::path::PathBuf::from("."));+ base.join("wake").join("appearance")+}++pub fn appearance_preference() -> AppearancePreference {+ std::fs::read_to_string(appearance_path())+ .map(|value| AppearancePreference::parse(&value))+ .unwrap_or(AppearancePreference::System)+}++fn apply_appearance(preference: AppearancePreference, window: Option<&mut Window>, cx: &mut App) {+ match preference {+ AppearancePreference::System => Theme::sync_system_appearance(window, cx),+ AppearancePreference::Light => Theme::change(ThemeMode::Light, window, cx),+ AppearancePreference::Dark => Theme::change(ThemeMode::Dark, window, cx),+ }+ apply_wake_theme(cx);+ cx.refresh_windows();+}++pub fn set_appearance(+ preference: AppearancePreference,+ window: Option<&mut Window>,+ cx: &mut App,+) -> std::io::Result<()> {+ let path = appearance_path();+ if let Some(parent) = path.parent() {+ std::fs::create_dir_all(parent)?;+ }+ std::fs::write(path, preference.as_str())?;+ apply_appearance(preference, window, cx);+ Ok(())+}+/// 带透明度的色值(文字选区等叠加层用)fn ca(hex: u32, a: f32) -> Hsla {let mut col = c(hex);@@ -173,17 +235,10 @@ pub fn apply_wake_theme(cx: &mut App) {/// 跟随系统外观:同步模式 → 重套 Wake token。pub fn sync_appearance(window: Option<&mut Window>, cx: &mut App) {// WAKE_THEME=dark|light 可强制模式(调试/截图用)- match std::env::var("WAKE_THEME").as_deref() {- Ok("dark") => Theme::change(ThemeMode::Dark, window, cx),- Ok("light") => Theme::change(ThemeMode::Light, window, cx),- _ => Theme::sync_system_appearance(window, cx),- }- apply_wake_theme(cx);-}--/// 手动切换(调试/后续设置页用)-#[allow(dead_code)]-pub fn set_mode(mode: ThemeMode, window: Option<&mut Window>, cx: &mut App) {- Theme::change(mode, window, cx);- apply_wake_theme(cx);+ let preference = match std::env::var("WAKE_THEME").as_deref() {+ Ok("dark") => AppearancePreference::Dark,+ Ok("light") => AppearancePreference::Light,+ _ => appearance_preference(),+ };+ apply_appearance(preference, window, cx);}diff --git a/crates/wake/src/ui.rs b/crates/wake/src/ui.rsindex bca3964..a0ef506 100644--- a/crates/wake/src/ui.rs+++ b/crates/wake/src/ui.rs@@ -4,6 +4,8 @@//! 颜色只用三级:foreground(主文字)/muted_foreground(辅助)/primary(强调)。use gpui::{px, Hsla, Pixels, Styled};+/// 产品展示名(About)——medium+pub const FONT_DISPLAY: Pixels = px(28.);/// 上下文大标题(中栏头部)——semiboldpub const FONT_TITLE: Pixels = px(22.);/// 区块标题(详情页会话标题)——semibold@@ -51,8 +53,7 @@ pub const REVEAL_IN_FM: &str = if cfg!(target_os = "macos") {// ——与 wake-core 各平台 trash_existing 的失败文案也得是同一个词。//// 全部是 &'static str 而非调用点 format!:确认框内容活在 **dialog builder-// 闭包**里,面板开着时每帧重跑(见 show_data_sources 处那条注释),留-// format! 在里面就是每帧堆分配。+// 闭包**里,对话框开着时每帧重跑,留 format! 在里面就是每帧堆分配。macro_rules! trash_copy {($noun:literal, $body:literal) => {/// 删除确认框主按钮 / 更多菜单项@@ -60,8 +61,11 @@ macro_rules! trash_copy {/// 删除成功通知pub const SESSION_TRASHED: &str = concat!("Session moved to ", $noun);/// 删除确认框正文首句(冠词随名词变,故整句单列)- pub const TRASH_CONFIRM_BODY: &str =- concat!("The session file will be moved to ", $body, ". You can restore it anytime:");+ pub const TRASH_CONFIRM_BODY: &str = concat!(+ "The session file will be moved to ",+ $body,+ ". You can restore it anytime:"+ );};}#[cfg(target_os = "windows")]diff --git a/crates/wake/src/workbench.rs b/crates/wake/src/workbench.rsindex c52b195..5f0cfaf 100644--- a/crates/wake/src/workbench.rs+++ b/crates/wake/src/workbench.rs@@ -31,7 +31,6 @@ use gpui_component::notification::Notification;use gpui_component::progress::Progress;use gpui_component::scroll::ScrollableElement as _;use gpui_component::spinner::Spinner;-use gpui_component::switch::Switch;use gpui_component::text::{TextView, TextViewStyle};use gpui_component::{h_flex, v_flex, ActiveTheme as _, Icon, IndexPath, Root, Sizable as _, StyledExt as _,@@ -50,11 +49,19 @@ use wake_core::watcher::{start_watcher, SessionWatcher};use crate::format::{abs_date, display_file_path, expand_tilde, fmt_tokens, one_line, relative_time, tilde_path,};+use crate::settings::{SettingsPage, SettingsView};use crate::ui::*;actions!(wake,- [ToggleSearch, RefreshSessions, PaletteUp, PaletteDown]+ [+ ToggleSearch,+ RefreshSessions,+ OpenSettings,+ OpenAbout,+ PaletteUp,+ PaletteDown+ ]);pub const KEY_CONTEXT: &str = "Workbench";@@ -423,10 +430,9 @@ pub struct Workbench {/// 新根不收录、被移根不出清,要等手动 ⌘R(2026-08-24 Codex review)。/// 终态事件到达后由 on_bg_event 消费,用新 roster 补一轮增量pending_rescan: bool,- /// location 变更成功后置位:面板等**补扫终态**再重开——立即重开抓到的是- /// 扫描前的计数快照,新根会一直显示 0(2026-08-24 Codex review)。补扫- /// 是增量,通常亚秒;期间成功通知先行反馈。用户若已开了别的弹窗则放弃重开- reopen_locations_after_scan: bool,+ /// Settings 是单例窗口;句柄不保活,关闭后下次点击会检测失败并重建。+ settings_window: Option<AnyWindowHandle>,+ settings_page: SettingsPage,/// 全量解析进度 (done, total);None = 仍在枚举文件。/// 用 Rc<Cell> 而非 entity 字段:进度弹窗 builder 在本 entity 的/// render 期间执行,entity.read(cx) 会 double-lease panic。@@ -451,31 +457,38 @@ pub struct Workbench {_subs: Vec<Subscription>,}-/// "Session locations" 面板的一行(= 一个数据源路径)。文本字段一律-/// SharedString:dialog builder 每帧重跑,clone 只该是 refcount 而非堆分配-struct DataSourceRow {- agent: AgentId,+/// Settings/Locations 的一行(= 一个数据源路径)。文本字段用 SharedString,+/// 让跨窗口快照与菜单闭包的 clone 只做引用计数。+#[derive(Clone)]+pub(crate) struct DataSourceRow {+ pub(crate) agent: AgentId,/// `~/…` 展示形态- display: SharedString,+ pub(crate) display: SharedString,/// 原始完整路径,交给 Finder- raw: SharedString,+ pub(crate) raw: SharedString,/// 会话数,或路径不可用时的状态词- tally: SharedString,+ pub(crate) tally: SharedString,/// 路径当前存在(行是否可点)- exists: bool,+ pub(crate) exists: bool,/// Some(落库路径) = 自定义行(路径可能是本行根的上层目录);None = 预设行- custom: Option<SharedString>,+ pub(crate) custom: Option<SharedString>,/// 预设行是否能只压制本路径,而不关闭该 agent 的整个默认实例。- individual_default: bool,- /// Rc<Cell> 让开关成功后原位刷新;dialog builder 捕获的是静态行快照,- /// 不能在 render 中反读 Workbench(会触发 double-lease)。- enabled: Rc<Cell<bool>>,+ pub(crate) individual_default: bool,+ pub(crate) enabled: bool,+}++#[derive(Clone)]+pub(crate) struct LocationSettingsSnapshot {+ pub(crate) rows: Vec<DataSourceRow>,+ pub(crate) diverged: bool,}#[derive(Clone)]-struct LocationToggleState {- enabled: Rc<Cell<bool>>,- diverged: Rc<Cell<bool>>,+pub(crate) struct DataSettingsSnapshot {+ pub(crate) display_path: SharedString,+ pub(crate) raw_path: SharedString,+ pub(crate) size_bytes: u64,+ pub(crate) session_count: i64,}/// location 表单的语义目标。预设行的“编辑”落库为**压制默认 + 记自定义**;@@ -547,13 +560,25 @@ impl Workbench {let watcher = start_watcher(adapters.clone(), store.clone(), events.clone());let scan_events = events.clone();- cx.spawn_in(window, async move |this, cx| {+ // 事件泵跟 Workbench entity 走,而不是跟主窗口走:Settings 会在主窗口+ // 关闭后继续持有 Workbench;若这里绑定 window,update_in 会失败并让+ // scan.scanning 永远收不到终态,后续 location 变更也无法再补扫。+ let main_window = window.window_handle();+ cx.spawn(async move |this, cx| {while let Some(ev) = rx.next().await {- if this- .update_in(cx, |this, window, cx| this.on_bg_event(ev, window, cx))- .is_err()- {- break;+ let note = match this.update(cx, |this, cx| this.on_bg_event(ev, cx)) {+ Ok(note) => note,+ Err(_) => break,+ };+ // 手动 Refresh 的进度框只存在于主窗口。主窗口已关闭时状态+ // 仍正常收尾,只是不再尝试展示无处承载的完成通知。+ if let Some(note) = note {+ main_window+ .update(cx, |_, window, cx| {+ window.close_dialog(cx);+ window.push_notification(note, cx);+ })+ .ok();}}})@@ -588,7 +613,8 @@ impl Workbench {},refreshing: false,pending_rescan: false,- reopen_locations_after_scan: false,+ settings_window: None,+ settings_page: SettingsPage::General,refresh_progress: Rc::new(Cell::new(None)),total_sessions: 0,list_state,@@ -602,7 +628,7 @@ impl Workbench {preferred_terminal: None,_subs: subs,};- this.refresh(window, cx);+ this.refresh(cx);// 索引重建过就告诉用户一声——收藏/置顶没了,总得让人知道为什么。// defer 到下一帧:此刻 Root 还没建好,notification 层挂不上@@ -648,7 +674,7 @@ impl Workbench {}}- fn refresh(&mut self, _window: &mut Window, cx: &mut Context<Self>) {+ fn refresh(&mut self, cx: &mut Context<Self>) {let filter = self.current_filter();if let Ok((sessions, total)) = self.store.list_sessions(&filter) {self.total_sessions = total;@@ -732,25 +758,12 @@ impl Workbench {});}- /// "Wake 读哪些路径"面板(侧栏底部数据源钮)。列全十三家含本机没装的,- /// 呼应"只读你的目录、零网络"的产品承诺;行点击即编辑,底部 Add location- /// 打开增改共用的表单。数据在打开前一次算好- /// move 进闭包——dialog builder 在宿主 render 期间执行,闭包内 read 宿主- /// entity 必 double-lease panic- fn show_data_sources(&mut self, window: &mut Window, cx: &mut Context<Self>) {- // 数据源必须读 data_locations——它与 scanner/watcher 的 active roster- // 由同一批 adapter 实例派生,既保留停用行,又避免二次构造时 env- // (CODEX_HOME/XDG_DATA_HOME)或文件系统探测产生不同根路径快照。- // prefixes 与各行由同一份 flat 派生,计数与显示不会错位。- // 文本一律预先算成 SharedString:dialog builder 存的是 Rc<dyn Fn>,- // 面板开着时每帧重跑,留 format!/String::clone 在里面就是每帧堆分配+ /// Settings/Locations 页的数据快照。路径与 active roster 来自同一次+ /// adapter 构造,因此停用项仍然可见,环境变量根也不会二次探测后错位。+ pub(crate) fn location_settings_snapshot(&self) -> LocationSettingsSnapshot {let mut flat = self.data_locations.as_ref().clone();- // 按 AgentId 声明序稳定排序:自定义根紧随该家默认根之后成组展示- // (roster 里 customs 追加在尾部,不排会飘到列表底部与所属家分离);- // 稳定排序保证同家内默认在前、codex 的 sessions/archived 相邻不散+ // 自定义根紧随所属 agent 的默认根;同家内部保持 adapter 声明顺序。flat.sort_by_key(|location| location.agent);- // 带上 agent:计数按 (agent, 根) 归属,不然一家的根被 env 搬进另一家- // 树下时,会话会整批记到别家行上let prefixes: Vec<(String, String)> = flat.iter().map(|location| {@@ -764,265 +777,142 @@ impl Workbench {.store.counts_by_path_prefix(&prefixes).unwrap_or_else(|_| vec![0; prefixes.len()]);- // 直接查库,不设镜像字段:面板打开是点击路径,微秒级查询无需缓存let (customs, removed, removed_roots) = self.store.location_overrides();let customs: Vec<(AgentId, SharedString)> = customs.into_iter()- .map(|(a, p)| (a, SharedString::from(p.to_string_lossy().to_string())))+ .map(|(agent, path)| {+ (+ agent,+ SharedString::from(path.to_string_lossy().to_string()),+ )+ }).collect();- let rows: Vec<DataSourceRow> = flat+ let rows = flat.iter().zip(prefixes).zip(counts)- .map(|((location, (_, raw)), n)| {- // 存在性逐路径判断:某家的归档目录可能还没建,不该按整家一刀切+ .map(|((location, (_, raw)), count)| {let exists = location.path.exists();- // 本行根落在同家某个自定义 location 之下 → 可移除行。- // 携带**落库路径**而非本行根:codex 一个自定义家目录派生- // sessions/archived 两行,删除按落库那条删- let custom = custom_owner(&customs, location.agent, &raw).cloned();DataSourceRow {agent: location.agent,display: tilde_path(&raw).into(),- raw: raw.into(),+ raw: raw.clone().into(),tally: if exists {- n.to_string().into()+ match count {+ 1 => "1 session".into(),+ n => format!("{n} sessions").into(),+ }} else {- "Not found".into()+ "Folder not found".into()},exists,- custom,+ custom: custom_owner(&customs, location.agent, &raw).cloned(),individual_default: location.individually_removable,- enabled: Rc::new(Cell::new(location.enabled)),+ enabled: location.enabled,}}).collect();- // 有任何偏离(自定义、被移除的预设或停用项)才给 Restore defaults 出场;- // 开关与 footer 共享 Cell,面板无需关闭重开即可同步显隐。- let diverged = Rc::new(Cell::new(- !customs.is_empty()- || !removed.is_empty()- || !removed_roots.is_empty()- || self.data_locations.iter().any(|location| !location.enabled),- ));- let entity = cx.entity();- window.open_dialog(cx, move |dialog, _window, cx| {- let theme = cx.theme();- // 左右内边距从默认 24 收到 14,让出的 10px 由标题与各行自己的- // px(10) 补回:内容绝对位置不变,而 hover 底色能向外铺满这 10px。- // 早先用容器负 margin 做,被 overflow_y_scroll 的裁剪吃掉了- dialog.w(px(620.)).pl(px(14.)).pr(px(14.)).child(- v_flex()- .gap(SPACE_SM)- .child(- // 显式收行高:默认按 1.5 倍算,16px 标题会撑出 24px 的块,- // 上下白边把标题与列表推得过开- div()- .px(px(10.))- .text_size(FONT_HEADING)- .line_height(px(20.))- .font_semibold()- .text_color(theme.foreground)- .child("Session locations"),- )- .child(- v_flex()- .id("data-source-list")- .max_h(px(400.))- .overflow_y_scroll()- .children(rows.iter().enumerate().map(|(ix, row)| {- // 点击行 = 编辑(2026-08-24 定稿)- // 表单与 with_custom_root 的契约是**目录**;SQLite- // 型预设行的 raw 是库文件,预填其父目录——照文件- // 路径保存会拼出 <db>/<db> 的死路径(Codex review)- let edit_path = row.custom.clone().unwrap_or_else(|| {- let raw = row.raw.as_ref();- if std::path::Path::new(raw).is_file() {- std::path::Path::new(raw)- .parent()- .map(|p| {- SharedString::from(p.to_string_lossy().to_string())- })- .unwrap_or_else(|| row.raw.clone())- } else {- row.raw.clone()- }- });- let edit_target = FormTarget::Edit {- agent: row.agent,- custom: row.custom.is_some(),- path: edit_path,- root: row.raw.clone(),- individual_default: row.individual_default,- };- let edit_entity = entity.clone();- let toggle_entity = entity.clone();- let toggle_state = LocationToggleState {- enabled: row.enabled.clone(),- diverged: diverged.clone(),- };- let toggle_agent = row.agent;- let toggle_path = row.raw.clone();- h_flex()- .id(("data-source-row", ix))- .h(ROW_HEIGHT_SUB)- .w_full()- // 行内 padding + dialog 让出的等量边距:hover- // 底色左右各留 10px 呼吸,内容仍与标题左对齐- .px(px(10.))- .rounded(theme.radius)- .gap(SPACE_SM)- .items_center()- .cursor_pointer()- .hover(|s| s.bg(theme.secondary_hover))- .on_click(move |_, window, cx| {- let t = edit_target.clone();- edit_entity.update(cx, |this, cx| {- this.open_location_form(t, window, cx)- });- })- .child(- img(row.agent.brand_icon(theme.mode.is_dark()))- .size(px(14.))- .flex_shrink_0(),- )- .child(- div()- .w(px(118.))- .flex_shrink_0()- .truncate()- .text_size(FONT_CAPTION)- .text_color(theme.foreground)- .child(row.agent.display_name()),- )- .child(- div()- .flex_1()- .min_w_0()- .truncate()- .text_size(FONT_CAPTION)- .text_color(theme.muted_foreground)- .child(row.display.clone()),- )- .child(- // 停用时以状态替代已过期计数;重新开启后的- // 增量扫描会恢复真值,下次打开面板即更新。- h_flex()- .w(px(88.))- .flex_shrink_0()- .justify_end()- .text_size(FONT_LABEL)- .child({- if !row.enabled.get() {- badge(- SharedString::from("Disabled"),- theme.muted,- theme.muted_foreground,- )- } else {- // 有目录取中性灰(同项目名 badge);目录不在- // 取 warning 淡底 tint——这是"本机没这家"的- // 陈述而非报错,不用实心告警色。文字实色,- // 只有底叠 opacity- let (bg, fg) = if row.exists {- (theme.muted, theme.muted_foreground)- } else {- (theme.warning.opacity(0.14), theme.warning)- };- badge(row.tally.clone(), bg, fg)- }- }),- )- .child(- Switch::new(("data-source-enabled", ix))- .checked(row.enabled.get())- .small()- .tooltip(if row.enabled.get() {- "Disable location"- } else {- "Enable location"- })- .on_click(move |enabled, window, cx| {- let state = toggle_state.clone();- let path = toggle_path.clone();- toggle_entity.update(cx, |this, cx| {- this.set_location_enabled(- toggle_agent,- path,- *enabled,- state.clone(),- window,- cx,- )- });- }),- )- })),- )- .child(div().h(px(1.)).bg(theme.border).mx(px(10.)))- .child(- h_flex()- .items_center()- .justify_between()- .child(- // 底部添加按钮:加号与行图标同列对齐(px10 内边- // 同构),hover 胶囊只包按钮本体——整行 hover- // 否决(2026-08-24);上方 hairline 与侧栏- // footer 同语言,分开数据区与动作区- h_flex()- .id("add-location")- .h(ROW_HEIGHT_SUB)- .px(px(10.))- .rounded(theme.radius)- .gap(SPACE_SM)- .items_center()- .cursor_pointer()- .text_color(theme.muted_foreground)- .hover(|s| s.bg(theme.secondary_hover))- .on_click({- let entity = entity.clone();- move |_, window, cx| {- // 面板不关:dialog 是栈,表单压在其上,- // esc/取消原生弹回面板- entity.update(cx, |this, cx| {- this.open_location_form(FormTarget::Add, window, cx)- });- }- })- .child(- icon("icons/plus.svg").with_size(px(14.)).flex_shrink_0(),- )- .child(div().text_size(FONT_CAPTION).child("Add location")),- )- .when(diverged.get(), |el| {- el.child(- // 恢复初始:清空全部偏离,回到内置默认路径- h_flex()- .id("restore-defaults")- .h(ROW_HEIGHT_SUB)- .px(px(10.))- .rounded(theme.radius)- .items_center()- .cursor_pointer()- .text_color(theme.muted_foreground)- .hover(|s| s.bg(theme.secondary_hover))- .on_click({- let entity = entity.clone();- move |_, window, cx| {- window.close_dialog(cx);- entity.update(cx, |this, cx| {- this.restore_default_locations(window, cx)- });- }- })- .child(- div().text_size(FONT_CAPTION).child("Restore defaults"),- ),- )- }),- ),- )- });+ let diverged = !customs.is_empty()+ || !removed.is_empty()+ || !removed_roots.is_empty()+ || self.data_locations.iter().any(|location| !location.enabled);+ LocationSettingsSnapshot { rows, diverged }+ }++ pub(crate) fn data_settings_snapshot(&self) -> DataSettingsSnapshot {+ let path = wake_core::db::default_db_path();+ let raw = path.to_string_lossy().to_string();+ let size_bytes = ["", "-wal", "-shm"]+ .iter()+ .filter_map(|suffix| std::fs::metadata(format!("{raw}{suffix}")).ok())+ .map(|metadata| metadata.len())+ .sum();+ DataSettingsSnapshot {+ display_path: tilde_path(&raw).into(),+ raw_path: raw.into(),+ size_bytes,+ session_count: self.agent_counts.iter().map(|(_, count)| count).sum(),+ }+ }++ pub(crate) fn settings_page(&self) -> SettingsPage {+ self.settings_page+ }++ pub(crate) fn select_settings_page(&mut self, page: SettingsPage, cx: &mut Context<Self>) {+ self.settings_page = page;+ cx.notify();+ }++ pub(crate) fn open_about(&mut self, cx: &mut Context<Self>) {+ self.settings_page = SettingsPage::About;+ cx.notify();+ self.open_settings(cx);+ }++ /// 打开单例 Settings 窗口。开窗必须 defer 到当前 Workbench update 退出+ /// 之后:Settings 首帧会读取 location 快照,同步开窗会反读仍被独占借用+ /// 的 Workbench,触发 GPUI double lease。+ pub(crate) fn open_settings(&mut self, cx: &mut Context<Self>) {+ let workbench = cx.entity();+ cx.defer(move |cx| Self::show_settings_window(workbench, cx));+ }++ fn show_settings_window(workbench: Entity<Self>, cx: &mut App) {+ // 先把 Copy 句柄取出,确保 read lease 在后续 update 前结束。+ let existing = workbench.read(cx).settings_window;+ if let Some(handle) = existing {+ if handle+ .update(cx, |_, window, _| window.activate_window())+ .is_ok()+ {+ cx.activate(true);+ return;+ }+ workbench.update(cx, |this, _| this.settings_window = None);+ }+ let bounds = Bounds::centered(None, size(px(880.), px(640.)), cx);+ let titlebar = if cfg!(target_os = "macos") {+ TitlebarOptions {+ title: None,+ appears_transparent: true,+ traffic_light_position: Some(point(px(20.), px(11.))),+ }+ } else {+ TitlebarOptions {+ title: Some("Wake Settings".into()),+ appears_transparent: false,+ traffic_light_position: None,+ }+ };+ let settings_workbench = workbench.clone();+ match cx.open_window(+ WindowOptions {+ titlebar: Some(titlebar),+ window_bounds: Some(WindowBounds::Windowed(bounds)),+ window_min_size: Some(size(px(740.), px(520.))),+ app_id: Some("wake-settings".into()),+ window_decorations: Some(WindowDecorations::Client),+ ..Default::default()+ },+ move |window, cx| {+ window+ .observe_window_appearance(|window, cx| {+ crate::theme::sync_appearance(Some(window), cx);+ })+ .detach();+ crate::theme::sync_appearance(Some(window), cx);+ let settings = cx.new(|cx| SettingsView::new(settings_workbench, window, cx));+ window.focus(&settings.read(cx).focus_handle(cx));+ cx.new(|cx| Root::new(settings, window, cx))+ },+ ) {+ Ok(handle) => {+ workbench.update(cx, |this, _| this.settings_window = Some(handle.into()));+ cx.activate(true);+ }+ Err(error) => eprintln!("failed to open Wake settings: {error}"),+ }}/// store 的 location 配置 → active roster + 全量路径快照。new 与@@ -1050,7 +940,43 @@ impl Workbench {/// location 表单(添加/编辑共用一套 UI,2026-08-24 定稿):agent 下拉 +/// 路径输入框(可手输,~ 展开)+ 目录选择按钮;Cancel/Save 只在有改动时- /// 出现。压栈在面板之上,esc/取消原生弹回+ /// 出现。表单作为 Settings 窗口的模态层,esc/取消回到 Locations 页。+ pub(crate) fn open_add_location_form(&mut self, window: &mut Window, cx: &mut Context<Self>) {+ self.open_location_form(FormTarget::Add, window, cx);+ }++ pub(crate) fn open_edit_location_form(+ &mut self,+ row: DataSourceRow,+ window: &mut Window,+ cx: &mut Context<Self>,+ ) {+ // location 的配置单位是目录;SQLite 型 adapter 的展示根可能是文件,+ // 编辑时预填父目录,避免保存成 <db>/<db>。+ let path = row.custom.clone().unwrap_or_else(|| {+ let raw = row.raw.as_ref();+ if std::path::Path::new(raw).is_file() {+ std::path::Path::new(raw)+ .parent()+ .map(|path| SharedString::from(path.to_string_lossy().to_string()))+ .unwrap_or_else(|| row.raw.clone())+ } else {+ row.raw.clone()+ }+ });+ self.open_location_form(+ FormTarget::Edit {+ agent: row.agent,+ path,+ root: row.raw,+ custom: row.custom.is_some(),+ individual_default: row.individual_default,+ },+ window,+ cx,+ );+ }+fn open_location_form(&mut self,target: FormTarget,@@ -1508,8 +1434,8 @@ impl Workbench {window.push_notification(Notification::error(format!("Save failed: {e}")), cx);return false;}- // 整栈收场(表单+过期的面板快照),统一收尾重开新面板。- // 返回 false 阻止机制再 pop(那会关掉刚开的新面板)+ // Settings 页本身是动态快照,只需收起表单;Workbench notify 会让+ // SettingsView 观察者刷新列表。window.close_all_dialogs(cx);let note = match &target {FormTarget::Add => "Location added",@@ -1521,7 +1447,7 @@ impl Workbench {/// 真正删除一个自定义 location。内置 location 不提供 Remove,只能用/// 行内开关暂时停用;磁盘文件始终不动。- fn delete_location(+ pub(crate) fn delete_location(&mut self,agent: AgentId,stored: SharedString,@@ -1542,7 +1468,11 @@ impl Workbench {/// Restore defaults:清空全部偏离(自定义、被移除的预设与停用状态),/// 回到全部启用的内置默认 location。- fn restore_default_locations(&mut self, window: &mut Window, cx: &mut Context<Self>) {+ pub(crate) fn restore_default_locations(+ &mut self,+ window: &mut Window,+ cx: &mut Context<Self>,+ ) {let res = self.store.clear_location_overrides();self.apply_location_change(res,@@ -1553,14 +1483,12 @@ impl Workbench {);}- /// Session locations 行内开关。状态先落库,再整体换 active roster 与 watcher;- /// 当前面板通过共享 Cell 原位反映行状态与 Restore defaults,配置行始终保留。- fn set_location_enabled(+ /// Session locations 行内开关。状态先落库,再整体换 active roster 与 watcher。+ pub(crate) fn set_location_enabled(&mut self,agent: AgentId,path: SharedString,enabled: bool,- state: LocationToggleState,window: &mut Window,cx: &mut Context<Self>,) {@@ -1573,15 +1501,7 @@ impl Workbench {cx,),Ok(()) => {- state.enabled.set(enabled);self.rebuild_roster(cx);- let (customs, removed, removed_roots) = self.store.location_overrides();- state.diverged.set(- !customs.is_empty()- || !removed.is_empty()- || !removed_roots.is_empty()- || self.data_locations.iter().any(|location| !location.enabled),- );self.kick_incremental_scan(cx);window.push_notification(Notification::info(if enabled {@@ -1596,9 +1516,8 @@ impl Workbench {}}- /// location 变更的统一收尾(删/恢复/表单提交成功共用):失败提示后立即回- /// 面板;成功则 roster 换代 + 补增量 + 提示,面板等补扫终态再重开(此时- /// 计数才是真值)——第四个变更入口出现时,收尾步骤只在这里长+ /// location 变更的统一收尾(删/恢复/表单提交成功共用)。Settings 页+ /// 观察 Workbench 的 notify 并重读快照,不需要关闭/重开管理面板。fn apply_location_change(&mut self,res: anyhow::Result<()>,@@ -1610,11 +1529,9 @@ impl Workbench {match res {Err(e) => {window.push_notification(Notification::error(format!("{err_prefix}: {e}")), cx);- self.show_data_sources(window, cx);}Ok(()) => {self.rebuild_roster(cx);- self.reopen_locations_after_scan = true;self.kick_incremental_scan(cx);window.push_notification(ok_note, cx);}@@ -1622,7 +1539,7 @@ impl Workbench {}/// roster 换代后补一轮增量:新根收录、被移根出清。撞上进行中的扫描- /// (变更后面板自动重开,连续操作两次就会撞)则排队,由终态事件补扫+ /// 撞上进行中的扫描则排队,由终态事件补扫。fn kick_incremental_scan(&mut self, cx: &mut Context<Self>) {if self.scan.scanning {self.pending_rescan = true;@@ -1641,7 +1558,7 @@ impl Workbench {);}- fn on_bg_event(&mut self, ev: BgEvent, window: &mut Window, cx: &mut Context<Self>) {+ fn on_bg_event(&mut self, ev: BgEvent, cx: &mut Context<Self>) -> Option<Notification> {match ev {BgEvent::Progress(p) => {self.refresh_progress.set(if p.total > 0 {@@ -1649,15 +1566,15 @@ impl Workbench {} else {None});- if !p.scanning && self.refreshing {+ let note = if !p.scanning && self.refreshing {self.refreshing = false;- window.close_dialog(cx);- let note = match &p.error {+ Some(match &p.error {None => Notification::success("Sessions refreshed"),Some(err) => Notification::error(format!("Refresh failed: {err}")),- };- window.push_notification(note, cx);- }+ })+ } else {+ None+ };self.scan = p;// 扫描期间发生过 location 变更:那轮用的是旧 roster,// 终态一到立刻用当前 roster 补一轮增量@@ -1665,17 +1582,13 @@ impl Workbench {self.pending_rescan = false;self.kick_incremental_scan(cx);}- // location 变更的面板重开等到终态:此刻计数才是真值。- // 用户若在空档里开了别的弹窗(⌘K 等),不去压它- if !self.scan.scanning && self.reopen_locations_after_scan {- self.reopen_locations_after_scan = false;- if !window.has_active_dialog(cx) {- self.show_data_sources(window, cx);- }- }cx.notify();+ note+ }+ BgEvent::Changed => {+ self.refresh(cx);+ None}- BgEvent::Changed => self.refresh(window, cx),}}@@ -2038,11 +1951,11 @@ impl Workbench {/// 清空过滤回 All Sessions 视图(侧栏点击与搜索打开共用;/// 已在 All Sessions 时 refresh 幂等,微秒级)- fn show_all_sessions(&mut self, window: &mut Window, cx: &mut Context<Self>) {+ fn show_all_sessions(&mut self, _window: &mut Window, cx: &mut Context<Self>) {self.selected_agent = None;self.selected_project = None;self.favorite_only = false;- self.refresh(window, cx);+ self.refresh(cx);}/// 搜索命中打开:侧栏切回 All Sessions(搜索是全库范围,过滤视图下@@ -2116,21 +2029,21 @@ impl Workbench {});}- fn toggle_favorite(&mut self, window: &mut Window, cx: &mut Context<Self>) {+ fn toggle_favorite(&mut self, _window: &mut Window, cx: &mut Context<Self>) {if let Some(detail) = &mut self.detail {let v = !detail.meta.favorite;let _ = self.store.set_user_data(&detail.meta.key, Some(v), None);detail.meta.favorite = v;- self.refresh(window, cx);+ self.refresh(cx);}}- fn toggle_pinned(&mut self, window: &mut Window, cx: &mut Context<Self>) {+ fn toggle_pinned(&mut self, _window: &mut Window, cx: &mut Context<Self>) {if let Some(detail) = &mut self.detail {let v = !detail.meta.pinned;let _ = self.store.set_user_data(&detail.meta.key, None, Some(v));detail.meta.pinned = v;- self.refresh(window, cx);+ self.refresh(cx);}}@@ -2188,7 +2101,7 @@ impl Workbench {}window.push_notification(Notification::success(SESSION_TRASHED), cx);// 立刻把它从列表摘掉,不等 watcher 那 800ms 去抖- this.refresh(window, cx);+ this.refresh(cx);}Err(e) => {window.push_notification(Notification::error(format!("Delete failed: {e}")), cx)@@ -2437,13 +2350,13 @@ impl Workbench {},self.favorite_only,RowLevel::Primary,- cx.listener(|this, _, window, cx| {+ cx.listener(|this, _, _window, cx| {this.favorite_only = !this.favorite_only;if this.favorite_only {this.selected_agent = None;this.selected_project = None;}- this.refresh(window, cx);+ this.refresh(cx);}),cx,)),@@ -2478,7 +2391,7 @@ impl Workbench {Some(*count),self.selected_agent == Some(agent),RowLevel::Sub,- cx.listener(move |this, _, window, cx| {+ cx.listener(move |this, _, _window, cx| {this.selected_agent = if this.selected_agent == Some(agent) {None} else {@@ -2486,7 +2399,7 @@ impl Workbench {};this.selected_project = None;this.favorite_only = false;- this.refresh(window, cx);+ this.refresh(cx);}),cx,)@@ -2512,7 +2425,7 @@ impl Workbench {Some(p.session_count),self.selected_project.as_deref() == Some(p.path.as_str()),RowLevel::Sub,- cx.listener(move |this, _, window, cx| {+ cx.listener(move |this, _, _window, cx| {this.selected_project = if this.selected_project.as_deref()== Some(path.as_str()){@@ -2522,7 +2435,7 @@ impl Workbench {};this.selected_agent = None;this.favorite_only = false;- this.refresh(window, cx);+ this.refresh(cx);}),cx,)@@ -2554,18 +2467,13 @@ impl Workbench {.justify_end().gap(SPACE_XS).child(sidebar_tool_btn(- "data-sources",- "Session locations",- // 扫描期间禁用:面板的计数是打开那一刻查库所得、- // 之后不再跟进(dialog builder 里是静态 rows),- // 首扫途中开出来会是 0 或半截数字且一直不更新- !self.scan.scanning,- icon("icons/hard-drive.svg")+ "settings",+ "Settings",+ true,+ icon("icons/settings.svg").with_size(px(14.)).into_any_element(),- cx.listener(|this, _, window, cx| {- this.show_data_sources(window, cx)- }),+ cx.listener(|this, _, _window, cx| this.open_settings(cx)),cx,)).child(sidebar_tool_btn(@@ -2611,10 +2519,10 @@ impl Workbench {let mk_key = |label: &'static str, key: SortKey| {let entity = sort_entity.clone();PopupMenuItem::new(label).checked(sort_key == key).on_click(- move |_, window, cx| {+ move |_, _window, cx| {entity.update(cx, |this, cx| {this.sort_key = key;- this.refresh(window, cx);+ this.refresh(cx);});},)@@ -2623,10 +2531,10 @@ impl Workbench {let entity = sort_entity.clone();PopupMenuItem::new(label).checked(sort_ascending == ascending)- .on_click(move |_, window, cx| {+ .on_click(move |_, _window, cx| {entity.update(cx, |this, cx| {this.sort_ascending = ascending;- this.refresh(window, cx);+ this.refresh(cx);});})};@@ -3704,6 +3612,8 @@ impl Render for Workbench {.on_action(cx.listener(|this, _: &RefreshSessions, window, cx| {this.refresh_sessions(window, cx)}))+ .on_action(cx.listener(|this, _: &OpenSettings, _window, cx| this.open_settings(cx)))+ .on_action(cx.listener(|this, _: &OpenAbout, _window, cx| this.open_about(cx))).size_full().bg(theme.background).text_color(theme.foreground)