Skip to content

armgit / Wake

Public Imported from GitHub
0

All your AI agent sessions in one place — browse, search, resume. Rust + GPUI.

Rust

Restore the UI polish

Corey Chiu7761eb0e26d3
diff --git a/DESIGN.md b/DESIGN.md
index d9274c0..31cb1f4 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -9,7 +9,7 @@ description: 本地 Coding Agent 会话资料库的 macOS 桌面设计系统
## 设计命题
-Wake 的目标不是展示技术感,而是让用户在几秒内重新找到并继续一段对话。界面采用 macOS 原生资料库心智:左侧导航与全局搜索,中间扫读会话,右侧阅读内容;全文搜索作为贯穿整个资料库的命令级能力。
+Wake 的目标不是展示技术感,而是让用户在几秒内重新找到并继续一段对话。界面采用 macOS 原生资料库心智,以稳定三栏承载范围、会话和正文;全文搜索作为贯穿整个工作台的命令级能力。
视觉遵循现代 macOS Liquid Glass 的层级原则:
@@ -27,9 +27,9 @@ Wake 的目标不是展示技术感,而是让用户在几秒内重新找到并
1. **资料库侧栏**:全部会话、收藏、智能体和项目。
2. **会话流**:当前范围的会话,按更新时间扫读和筛选。
-3. **阅读区**:当前会话的身份、主操作、元信息和完整正文。
+3. **阅读区**:当前会话的身份、操作、完整元信息和正文。
-选择状态显式且稳定。收藏、置顶、导出、显示原文件和删除都围绕当前会话发生;设置若增加,应使用独立场景,不作为侧栏目的地。
+选择状态显式且稳定。收藏、置顶、导出、显示原文件和删除都围绕当前会话发生;设置使用独立场景,不作为侧栏目的地。
## 窗口与布局
@@ -40,10 +40,9 @@ Wake 的目标不是展示技术感,而是让用户在几秒内重新找到并
| 窗口顶部 | macOS 不设全宽标题栏,交通灯与拖拽区收在侧栏顶部;Windows 用原生标题栏,Linux 视 compositor 装饰协商而定 |
| 资料库侧栏 | 224px 固定宽度 |
| 会话流 | 336px 固定宽度 |
-| 阅读区 | 剩余宽度,`min_w(0)` |
-| 阅读卡 | 阅读区内边距 `SPACE_MD` 12px,卡内 20 × 16,12px 圆角 |
+| 阅读区 | 剩余宽度,`min_w(0)`;正文最大宽度 720px |
-窗口不绘制全宽标题栏。侧栏承接交通灯、窗口拖拽区和唯一的全文搜索入口;会话流与阅读区直接延伸到窗口顶部。侧栏、会话流、阅读区分别使用 `sidebar`、`list`、`background` 材质,以色差分区,不画竖向分隔线。
+窗口不绘制全宽标题栏。侧栏承接交通灯、窗口拖拽区和唯一的全文搜索入口;会话流与阅读区直接延伸到窗口顶部。侧栏、会话流、详情头和正文分别使用 `sidebar`、`list`、`background`、`popover` 材质表达层级,不加投影。
## 颜色
@@ -57,7 +56,7 @@ Wake 的目标不是展示技术感,而是让用户在几秒内重新找到并
| `sidebar` | `#EDEDEA` | `#1B1B1A` | 资料库侧栏 |
| `list` | `#F7F7F5` | `#20201F` | 会话流 |
| `background` | `#F1F1EF` | `#242422` | 阅读区外层 |
-| `popover` | `#FDFDFC` | `#2C2C2A` | 阅读卡、对话框、菜单 |
+| `popover` | `#FDFDFC` | `#2C2C2A` | 阅读面、对话框、菜单 |
| `muted` | `#E8E8E5` | `#323230` | 图标底、角标、静默面 |
| `secondary` | `#E8E8E5` | `#30302E` | 次级按钮、快捷键标签 |
@@ -134,16 +133,18 @@ macOS 不设置横跨三栏的自定义 header。系统交通灯保留在侧栏
- 行内容 = 行首元素 + 标题 + 计数;计数一律 Label 档 muted。
- 组头 "Agents"/"Projects" 用 Body 档常规字重 + muted 色(与主导航同字号同字重,仅靠颜色和"无行首图标"区分——加粗会让组头压过它统辖的行),带 13px chevron 可折叠。
- 底部工具条常驻,顶部 hairline 分隔,按钮靠右排列(次要操作区:透明底、hover 才出色,不与导航行选中态抢注意力)——左为齿轮 "Settings",右为 refresh。Settings 同时进入 Wake 菜单并绑定 `⌘,`(其他平台 `Ctrl+,`),保持单例窗口。
-- Settings 采用固定窄侧栏 + 内容页结构,固定为 General / Locations / Data / Updates / About 五项;About 与功能设置分离并钉在侧栏底部,Wake 菜单的 About Wake 直达同一页。About 沿用 Kooky/Birth 的信息顺序:产品图标、名称、版本、tagline、GitHub、短分隔线、版权/许可证与作者署名。Updates 是独立功能页,仅在用户点击页面按钮或 macOS Wake 菜单的 Check for Updates 时读取 GitHub 最新正式 Release 元数据,明确呈现检查中/最新版/有新版/失败四种状态;有新版时打开 Release 页供用户下载,不后台检查、不自行覆盖应用包。内部常规文字按钮统一沿用主界面的 24px 高、6px 圆角和主题交互色,普通页面动作使用 muted 填充 + hairline;发现新版后的 View Update 是需要用户继续完成的主操作,使用 32px 高 primary 填充和轻阴影。Appearance 分段选择器也使用同一材质。General 只放真实可用的全局偏好,当前为持久化的 System / Light / Dark 外观选择;不提供默认 “Open In” 终端。Data 只展示 Wake 本地存储位置、会话数与磁盘占用并提供文件管理器入口,不重复放刷新或清库动作;常规 Refresh 的唯一入口仍是主侧栏底部。Locations 页按 AgentId 声明序以 agent 分组,品牌名只在组头出现一次;本机有数据的组优先,未检测到的 agent 默认收进可展开区。每条路径以路径为主信息、会话数/不可用状态为 muted 副信息,最右为逐路径开关;停用行整体降噪,不再重复显示 Disabled badge。行本身不承担编辑,`…` 菜单集中 Edit / Show in Finder / 自定义 Remove。顶部操作为低强调的 Add location,Restore defaults 收进页级 `…` 菜单且无偏离时禁用。添加/编辑仍复用 agent 下拉 + 可手输路径 + 目录选择表单;关闭 location 后保留配置、停止扫描/监听并从会话与搜索结果排除,重新开启即增量扫回;纯路径管理不做内容校验。
+- Settings 默认 820×600,采用 180px 窄侧栏 + 内容页结构,固定为 General / Locations / Data / Updates / About 五项;About 与功能设置分离并钉在侧栏底部,Wake 菜单的 About Wake 直达同一页。About 沿用 Kooky/Birth 的信息顺序:产品图标、名称、版本、tagline、GitHub、短分隔线、版权/许可证与作者署名。Updates 是独立功能页,仅在用户点击页面按钮或 macOS Wake 菜单的 Check for Updates 时读取 GitHub 最新正式 Release 元数据,明确呈现检查中/最新版/有新版/失败四种状态;有新版时打开 Release 页供用户下载,不后台检查、不自行覆盖应用包。内部常规文字按钮统一沿用主界面的 24px 高、6px 圆角和主题交互色,普通页面动作使用 muted 填充 + hairline;发现新版后的 View Update 是需要用户继续完成的主操作,使用 32px 高 primary 填充和轻阴影。Appearance 分段选择器也使用同一材质。General 只放真实可用的全局偏好,当前为持久化的 System / Light / Dark 外观选择;不提供默认 “Open In” 终端。Data 只展示 Wake 本地存储位置、会话数与磁盘占用并提供文件管理器入口,不重复放刷新或清库动作;常规 Refresh 的唯一入口仍是主侧栏底部。Locations 页按 AgentId 声明序以 agent 分组,品牌名只在组头出现一次;本机有数据的组优先,未检测到的 agent 默认收进可展开区。每条路径以路径为主信息、会话数/不可用状态为 muted 副信息,最右为逐路径开关;停用时只降低文字层级,开关与菜单保持完整对比度。行本身不承担编辑,`…` 菜单集中 Edit / Show in Finder / 自定义 Remove。顶部操作为低强调的 Add location,Restore defaults 收进页级 `…` 菜单且无偏离时禁用。添加/编辑仍复用 agent 下拉 + 可手输路径 + 目录选择表单;关闭 location 后保留配置、停止扫描/监听并从会话与搜索结果排除,重新开启即增量扫回;纯路径管理不做内容校验。
- 工具条内的**状态行"常态沉默"**:仅刷新中或监听不可用时出现在按钮行上方;文案须可 truncate,窄侧栏放不下长句(故为 "Live updates off" 而非带操作建议的整句)。
+- 手动 Refresh 始终后台运行;进度复用侧栏状态行,完成后发通知,不用模态框阻断浏览、搜索或阅读。
- 不把项目包装成卡片,不堆叠分支、时间或重复图标。项目行不加彩色标识——同一图标重复十几次不传递信息。
### 会话流
-- 顶部由 22px 上下文标题、会话总数角标和无边框系统输入组成。
-- 会话行使用 Body 14 标题与 Label 11 元信息,共两行;行内 `SPACE_SM` 上下内边距 + `SPACE_XS` 两行间距,单行约 50px。
-- 第二行固定为:品牌图标 15px → 项目名 badge(muted 底 4px 圆角)→ 弹性空隙 → 相对时间。
-- 分支、消息数、token 和归档状态不在列表重复展示,移入详情元信息。
+- 顶部由 22px 上下文标题、会话总数角标和 icon-only 排序按钮组成;排序按钮与详情工具栏统一为 16px 图标、透明 ghost 常态、6px 圆角,当前排序字段和方向放在 tooltip 与菜单选中态中。
+- 会话流固定 336px;顶部使用 22px 上下文标题、Label 11 会话数量和 icon-only 排序按钮。
+- 会话行使用 Body 14 标题与 Label 11 元信息,共两行;行内 `SPACE_SM` 上下内边距 + `SPACE_XS` 两行间距。
+- 第二行固定为品牌图标 15px、项目名 badge、弹性空隙和右对齐相对时间。
+- 分支、token 和归档状态不在列表重复展示,移入详情元信息。
- 收藏和置顶允许以 11px 系统蓝图标出现在标题尾部。
- 当前行使用低饱和蓝材质,不额外描边。
- 会话流不重复提供全文搜索入口;列表内输入只筛选当前范围。
@@ -152,26 +153,30 @@ macOS 不设置横跨三栏的自定义 header。系统交通灯保留在侧栏
层级从上到下为:
-1. 品牌图标 15px、Agent 名、项目名 badge、git 分支(Label 档 muted)。
-2. 22px 会话标题与操作区。
-3. 项目路径、分支、消息数和 token。
+1. Agent、项目、分支等来源上下文与右侧操作工具条。
+2. 独占整行、最多两行的 22px 会话标题。
+3. 独占一行的项目路径。
+4. 模型、来源 badge 与消息数、token 组成的统计行。
+5. 精确到秒的创建时间与更新时间;两者作为同一组从信息区左边界依次排列。
+
+五层信息一项不减,但不可压回同一横行。层内保持紧凑,层间至少 8–12px,让来源、标题、位置、运行统计和时间上下文能被分别扫读。
“在终端继续”是唯一主按钮。收藏、置顶保留为独立图标按钮;导出、Finder 和删除进入“更多”菜单。按钮圆角固定 6px,危险操作在菜单中用分组隔开并继续走确认框。
-头部元信息(路径/属性/时间/文件)四行收成 4px 紧组,与标题区之间保持 8px——组内紧、组间松,四行等距摊开会读成四个并列区块(2026-08-24 polish)。
+详情正文使用 `popover` 阅读底色,与 `background` 详情头形成明确分区;阅读面横向铺满且不套大号圆角卡。内容限制在 720px 阅读宽度并居中。助手正文保持平铺,不在每条回复前重复 Agent 署名。只有 thinking、没有回复正文或工具调用的中间事件不进入阅读视图;带正文的 thinking 摘要保留,工具调用继续默认折叠。
对话框标题一律 Heading 16 semibold:组件内建 `.title()` 不设字号(实渲窗口默认 14px),必须显式补 `text_size(FONT_HEADING)`。破坏性确认的主按钮点名动作并用 danger 形态("Move to Trash",Windows 上经 trash_copy! 平台文案为 "Move to Recycle Bin",不留裸 "OK");表单弹窗内控件同档取齐(输入框与下拉/浏览钮同高,次级动作行才允许 small)。
-### 阅读卡
+### 对话阅读面
-正文位于 `popover` 材质的 12px 圆角阅读卡中,外层使用 `background`。正文 15px,可选择、可滚动,代码继续使用 tree-sitter 高亮。
+正文横向铺在 `popover` 材质阅读面中,与 `background` 详情头用 hairline 分开,不再套圆角大卡。助手正文 13px、用户正文 13.5px,可选择、可滚动,代码继续使用 tree-sitter 高亮。
-对话角色标题不使用 emoji(界面语言英文):
+对话角色不使用常驻标题或 emoji:
-- 用户显示 "You"。
-- 助手显示具体 Agent 名称,如 "Codex" 或 "Claude Code"。
-- 思考显示 "Thinking · …"。
-- 工具调用显示 "Tool · 名称";失败追加 " · failed"。
+- 用户使用靠右的低饱和引用块。
+- 助手正文平铺,不在每条回复前重复 Agent 名称。
+- 仅有 thinking、没有正文或工具的中间事件不进入阅读视图;带正式回复的思考摘要显示 `Thinking · …`。
+- 工具调用合并为折叠簇,失败项才内联输出。
emoji 不再承担界面或正文结构图标职责。
diff --git a/crates/wake/src/format.rs b/crates/wake/src/format.rs
index dfa8e54..ed86818 100644
--- a/crates/wake/src/format.rs
+++ b/crates/wake/src/format.rs
@@ -24,7 +24,7 @@ pub fn relative_time(ts: i64) -> String {
}
}
-/// 绝对时间(详情页时间行):yyyy-MM-dd HH:mm:ss
+/// 详情页时间信息:保留到秒,避免相对时间丢失会话的精确时间上下文。
pub fn abs_date(ts: i64) -> String {
if ts <= 0 {
return String::new();
@@ -46,8 +46,8 @@ pub fn fmt_tokens(n: Option<i64>) -> String {
}
}
-/// 进程内不变的 HOME,缓存住:折叠(tilde_path 经 display_file_path 落在
-/// 详情页 header,每帧都跑)与手输展开(expand_tilde)共用同一份
+/// 进程内不变的 HOME,缓存住:数据源路径折叠与手输展开(expand_tilde)
+/// 共用同一份。
fn cached_home() -> Option<&'static str> {
static HOME: std::sync::OnceLock<Option<String>> = std::sync::OnceLock::new();
HOME.get_or_init(|| {
@@ -63,8 +63,7 @@ fn cached_home() -> Option<&'static str> {
.as_deref()
}
-/// 绝对路径 → `~/…` 形式,**不折叠中段**。数据源面板要如实给出完整路径
-/// (display_file_path 那种 `~/a/…/file` 的折叠在那里会把信息吃掉)
+/// 绝对路径 → `~/…` 形式,**不折叠中段**。数据源面板要如实给出完整路径。
pub fn tilde_path(p: &str) -> String {
// 边界必须落在分隔符上:裸 starts_with 会把 HOME 的同名前缀兄弟目录
// 也折叠掉(HOME=/Users/al 时 /Users/al-data → "~-data",一个并不存在
@@ -95,29 +94,6 @@ pub fn expand_tilde(p: &str) -> String {
}
}
-/// 会话文件路径的展示形态(详情页路径行):SQLite 虚拟路径剥 `#<id>`、
-/// HOME 缩成 `~`、深路径折叠中段(根目录 + … + 文件名)。
-/// 仅用于展示——Reveal in Finder 仍传原始完整路径。
-pub fn display_file_path(path: &str) -> String {
- // 虚拟路径 <db>#<id>:id 不是路径的一部分,展示到库文件为止
- let p = path
- .rsplit_once('#')
- .filter(|(db, _)| db.ends_with(".db"))
- .map(|(db, _)| db)
- .unwrap_or(path);
- let tilde = tilde_path(p);
- let parts: Vec<&str> = tilde.split(std::path::is_separator).collect();
- match (parts.first(), parts.get(1), parts.last()) {
- // 超过 根/次级/…/文件 四段的深路径折叠中段(重拼用本平台主分隔符,
- // Windows 展示 `~\a\…\file` 与系统一致)
- (Some(root), Some(second), Some(file)) if parts.len() > 4 => {
- let s = std::path::MAIN_SEPARATOR;
- format!("{root}{s}{second}{s}…{s}{file}")
- }
- _ => tilde,
- }
-}
-
/// 首行截断预览
pub fn one_line(s: &str, max_chars: usize) -> String {
let joined = s.split_whitespace().collect::<Vec<_>>().join(" ");
diff --git a/crates/wake/src/settings.rs b/crates/wake/src/settings.rs
index 0ab7bab..877f119 100644
--- a/crates/wake/src/settings.rs
+++ b/crates/wake/src/settings.rs
@@ -18,7 +18,8 @@ use crate::update::{self, UpdateStatus};
use crate::workbench::{DataSourceRow, OpenAbout, OpenSettings, OpenUpdates, Workbench};
use crate::{theme, theme::AppearancePreference};
-const SETTINGS_SIDEBAR_W: Pixels = px(188.);
+const SETTINGS_SIDEBAR_W: Pixels = px(180.);
+const SETTINGS_PAGE_TOP: Pixels = px(38.);
fn icon(path: &'static str) -> Icon {
Icon::empty().path(path)
@@ -277,7 +278,7 @@ impl SettingsView {
v_flex()
.flex_shrink_0()
.px(SPACE_XXL)
- .pt(px(44.))
+ .pt(SETTINGS_PAGE_TOP)
.pb(SPACE_XL)
.gap(px(5.))
.child(
@@ -295,73 +296,63 @@ impl SettingsView {
),
)
.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,
- )),
- ),
- ),
+ v_flex().px(SPACE_XXL).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()
}
@@ -400,7 +391,7 @@ impl SettingsView {
v_flex()
.flex_shrink_0()
.px(SPACE_XXL)
- .pt(px(44.))
+ .pt(SETTINGS_PAGE_TOP)
.pb(SPACE_XL)
.gap(px(5.))
.child(
@@ -514,7 +505,7 @@ impl SettingsView {
v_flex()
.w(px(360.))
.items_center()
- .pt(px(64.))
+ .pt(px(52.))
.child(
img("brands/wake.svg")
.size(px(78.))
@@ -626,7 +617,7 @@ impl SettingsView {
v_flex()
.flex_shrink_0()
.px(SPACE_XXL)
- .pt(px(44.))
+ .pt(SETTINGS_PAGE_TOP)
.pb(SPACE_XL)
.gap(px(5.))
.child(
@@ -739,7 +730,6 @@ impl SettingsView {
.px(SPACE_LG)
.gap(SPACE_MD)
.items_center()
- .when(!enabled, |this| this.opacity(0.55))
.child(
v_flex()
.flex_1()
@@ -750,13 +740,17 @@ impl SettingsView {
.w_full()
.truncate()
.text_size(FONT_BODY)
- .text_color(theme.foreground)
+ .text_color(if enabled {
+ theme.foreground
+ } else {
+ theme.muted_foreground
+ })
.child(row.display),
)
.child(
div()
.text_size(FONT_CAPTION)
- .text_color(if exists {
+ .text_color(if !enabled || exists {
theme.muted_foreground
} else {
theme.warning
@@ -876,7 +870,7 @@ impl SettingsView {
h_flex()
.flex_shrink_0()
.px(SPACE_XXL)
- .pt(px(44.))
+ .pt(SETTINGS_PAGE_TOP)
.pb(SPACE_XL)
.gap(SPACE_LG)
.items_start()
@@ -950,7 +944,7 @@ impl SettingsView {
.id("settings-unavailable-locations")
.h(px(36.))
.w_full()
- .px(SPACE_SM)
+ .pr(SPACE_SM)
.gap(SPACE_SM)
.items_center()
.rounded(theme.radius)
@@ -962,12 +956,20 @@ impl SettingsView {
cx.notify();
}))
.child(
- icon(if self.show_unavailable {
- "icons/chevron-down.svg"
- } else {
- "icons/chevron-right.svg"
- })
- .with_size(px(13.)),
+ div()
+ .w(px(17.))
+ .flex_shrink_0()
+ .flex()
+ .items_center()
+ .justify_center()
+ .child(
+ icon(if self.show_unavailable {
+ "icons/chevron-down.svg"
+ } else {
+ "icons/chevron-right.svg"
+ })
+ .with_size(px(13.)),
+ ),
)
.child(
div()
diff --git a/crates/wake/src/workbench.rs b/crates/wake/src/workbench.rs
index 003cf2d..8f10809 100644
--- a/crates/wake/src/workbench.rs
+++ b/crates/wake/src/workbench.rs
@@ -7,8 +7,8 @@
// lucide 单线图标、SF 系统字体 14px 基准;agent 品牌色仅作识别圆点。
// STORY: 打开即见全部会话按时间流动;左栏收窄范围,中栏定位会话,右栏读全文;
// ⌘K 直达任意一句话;一键回到终端继续。
-// FIRST VIEWPORT: 全高三栏——240px 侧栏(全局搜索/全部/收藏/智能体/项目)、
-// 372px 会话列表(22px 上下文标题+双行卡),余宽详情(标题+操作+markdown 正文)。
+// FIRST VIEWPORT: 全高三栏——224px 侧栏(全局搜索/全部/收藏/智能体/项目)、
+// 336px 会话列表(上下文标题+会话数量+双行列表),余宽为详情阅读器。
// FORM: brief-pinned canon(用户指定"现代 macOS 设计规范",对标 Things/Bear);
// concept tournament 依规跳过,canon at full fidelity。
// FINISH: unreviewed and undocumented is unfinished; this build ends with the
@@ -28,7 +28,6 @@ use gpui_component::input::{Input, InputEvent, InputState};
use gpui_component::list::{List, ListDelegate, ListEvent, ListItem, ListState};
use gpui_component::menu::{DropdownMenu as _, PopupMenuItem};
use gpui_component::notification::Notification;
-use gpui_component::progress::Progress;
use gpui_component::scroll::ScrollableElement as _;
use gpui_component::spinner::Spinner;
use gpui_component::text::{TextView, TextViewStyle};
@@ -46,9 +45,7 @@ use wake_core::scanner::{run_scan, ScanEvents, ScanProgress};
use wake_core::services::{exporter, terminal};
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::format::{abs_date, expand_tilde, fmt_tokens, one_line, relative_time, tilde_path};
use crate::settings::{SettingsPage, SettingsView};
use crate::ui::*;
use crate::update::{self, UpdateStatus};
@@ -425,8 +422,8 @@ pub struct Workbench {
/// 单一写入点就不会互相失步——把派生出的文案反过来当守卫,正是
/// "扫描失败后刷新按钮再也点不动"的来源
scan: ScanProgress,
- /// 用户主动重扫中(模态进度弹窗开着,阻断其他操作)。与 scan.scanning 正交:
- /// 那是"扫没扫",这是"要不要弹模态"
+ /// 用户主动发起的重扫。与 scan.scanning 正交:前者决定终态通知,后者是
+ /// 所有自动/手动扫描共用的实际运行状态。
refreshing: bool,
/// location 变更撞上进行中的扫描时置位:那轮扫描持旧 roster,不补扫的话
/// 新根不收录、被移根不出清,要等手动 ⌘R(2026-08-24 Codex review)。
@@ -436,10 +433,6 @@ pub struct Workbench {
settings_window: Option<AnyWindowHandle>,
settings_page: SettingsPage,
update_status: UpdateStatus,
- /// 全量解析进度 (done, total);None = 仍在枚举文件。
- /// 用 Rc<Cell> 而非 entity 字段:进度弹窗 builder 在本 entity 的
- /// render 期间执行,entity.read(cx) 会 double-lease panic。
- refresh_progress: Rc<Cell<Option<(usize, usize)>>>,
total_sessions: i64,
list_state: Entity<ListState<SessionsDelegate>>,
@@ -573,14 +566,11 @@ impl Workbench {
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);
- })
+ .update(cx, |_, window, cx| window.push_notification(note, cx))
.ok();
}
}
@@ -619,7 +609,6 @@ impl Workbench {
settings_window: None,
settings_page: SettingsPage::General,
update_status: UpdateStatus::Idle,
- refresh_progress: Rc::new(Cell::new(None)),
total_sessions: 0,
list_state,
palette_list,
@@ -704,8 +693,8 @@ impl Workbench {
}
/// 手动全量重扫(菜单 File → Refresh Sessions,⌘R)。刷新中忽略重复触发。
- /// 弹出模态进度弹窗阻断其他操作,完成后 on_bg_event 自动关闭。
- fn refresh_sessions(&mut self, window: &mut Window, cx: &mut Context<Self>) {
+ /// 扫描在后台进行,侧栏持续显示进度;浏览、搜索和阅读不被阻断。
+ fn refresh_sessions(&mut self, _window: &mut Window, cx: &mut Context<Self>) {
if self.scan.scanning {
return;
}
@@ -713,7 +702,6 @@ impl Workbench {
scanning: true,
..Default::default()
};
- self.refresh_progress.set(None);
self.refreshing = true;
cx.notify();
spawn_scan(
@@ -722,44 +710,6 @@ impl Workbench {
self.scan_events.clone(),
true,
);
-
- let shared_progress = self.refresh_progress.clone();
- window.open_dialog(cx, move |dialog, _window, cx| {
- let progress = shared_progress.get();
- let theme = cx.theme();
- let (pct, note) = match progress {
- Some((done, total)) if total > 0 => (
- ((done as f32 / total as f32) * 100.).max(3.),
- format!("{done} of {total} sessions"),
- ),
- _ => (3., "Looking for sessions…".to_string()),
- };
- dialog
- .w(px(380.))
- .close_button(false)
- .overlay_closable(false)
- .keyboard(false)
- .child(
- v_flex()
- .gap(SPACE_LG)
- .child(
- h_flex().gap(SPACE_SM).child(Spinner::new().small()).child(
- div()
- .text_size(FONT_HEADING)
- .font_semibold()
- .text_color(theme.foreground)
- .child("Refreshing sessions"),
- ),
- )
- .child(Progress::new().value(pct))
- .child(
- div()
- .text_size(FONT_CAPTION)
- .text_color(theme.muted_foreground)
- .child(note),
- ),
- )
- });
}
/// Settings/Locations 页的数据快照。路径与 active roster 来自同一次
@@ -923,7 +873,7 @@ impl Workbench {
}
workbench.update(cx, |this, _| this.settings_window = None);
}
- let bounds = Bounds::centered(None, size(px(880.), px(640.)), cx);
+ let bounds = Bounds::centered(None, size(px(820.), px(600.)), cx);
let titlebar = if cfg!(target_os = "macos") {
TitlebarOptions {
title: None,
@@ -942,7 +892,7 @@ impl Workbench {
WindowOptions {
titlebar: Some(titlebar),
window_bounds: Some(WindowBounds::Windowed(bounds)),
- window_min_size: Some(size(px(740.), px(520.))),
+ window_min_size: Some(size(px(720.), px(520.))),
app_id: Some("wake-settings".into()),
window_decorations: Some(WindowDecorations::Client),
..Default::default()
@@ -1613,11 +1563,6 @@ impl Workbench {
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 {
- Some((p.done, p.total))
- } else {
- None
- });
let note = if !p.scanning && self.refreshing {
self.refreshing = false;
Some(match &p.error {
@@ -1686,9 +1631,6 @@ impl Workbench {
}
pub fn toggle_search(&mut self, _: &ToggleSearch, window: &mut Window, cx: &mut Context<Self>) {
- if self.refreshing {
- return;
- }
if window.has_active_dialog(cx) {
window.close_dialog(cx);
return;
@@ -2551,6 +2493,18 @@ impl Workbench {
fn render_session_list(&self, cx: &Context<Self>) -> impl IntoElement {
let theme = cx.theme();
let shown = self.list_state.read(cx).delegate().sessions.len();
+ let library_empty = self.agent_counts.iter().map(|(_, n)| *n).sum::<i64>() == 0;
+ let listed_count = self.total_sessions.max(0);
+ let shown_label: SharedString = format!(
+ "{} {}",
+ listed_count,
+ if listed_count == 1 {
+ "session"
+ } else {
+ "sessions"
+ }
+ )
+ .into();
let sort_key = self.sort_key;
let sort_ascending = self.sort_ascending;
let sort_entity = cx.entity();
@@ -2559,14 +2513,21 @@ impl Workbench {
SortKey::Created => "Date created",
SortKey::Messages => "Message count",
};
- // ghost + 当前排序文案(outline/muted 胶囊都试过,用户定的 ghost)
+ let sort_tooltip = format!(
+ "Sort by {} · {}",
+ sort_label,
+ if sort_ascending {
+ "Ascending"
+ } else {
+ "Descending"
+ }
+ );
+ // 与详情工具栏统一:icon-only ghost,常态透明、hover 才出现背景。
let sort_menu = Button::new("sort-sessions")
.ghost()
- .small()
.rounded(RADIUS_BUTTON)
- .icon(icon("icons/arrow-up-down.svg").with_size(px(13.)))
- .label(sort_label)
- .tooltip("Sort sessions")
+ .icon(icon("icons/arrow-up-down.svg").with_size(px(16.)))
+ .tooltip(sort_tooltip)
.dropdown_menu(move |menu, _, _| {
let mk_key = |label: &'static str, key: SortKey| {
let entity = sort_entity.clone();
@@ -2607,6 +2568,7 @@ impl Workbench {
.child(
v_flex()
.id("list-header")
+ .w_full()
.flex_shrink_0()
.window_control_area(WindowControlArea::Drag)
.px(SPACE_LG)
@@ -2614,34 +2576,97 @@ impl Workbench {
.pb(SPACE_MD)
.child(
h_flex()
- .items_center()
+ .items_start()
.justify_between()
.child(
- div()
- .text_size(FONT_TITLE)
- .font_semibold()
- .child(self.context_title()),
+ v_flex()
+ .gap(px(2.))
+ .child(
+ div()
+ .text_size(FONT_TITLE)
+ .font_semibold()
+ .child(self.context_title()),
+ )
+ .child(
+ div()
+ .text_size(FONT_LABEL)
+ .text_color(theme.muted_foreground)
+ .child(shown_label),
+ ),
)
- .child(sort_menu),
+ .child(div().pt(px(2.)).child(sort_menu)),
),
)
.child(if shown == 0 {
- v_flex()
- .flex_1()
- .justify_center()
- .child(empty_state(
- "icons/inbox.svg",
- px(48.),
- px(22.),
- "No matching sessions",
- "Try different filters or clear the query",
- cx,
- ))
- .into_any_element()
+ if library_empty && self.scan.scanning {
+ v_flex()
+ .flex_1()
+ .w_full()
+ .items_center()
+ .justify_center()
+ .gap(SPACE_MD)
+ .text_color(theme.muted_foreground)
+ .child(Spinner::new())
+ .child(
+ div()
+ .text_size(FONT_BODY)
+ .font_medium()
+ .text_color(theme.foreground)
+ .child("Building your library"),
+ )
+ .child(
+ div()
+ .text_size(FONT_CAPTION)
+ .child("Looking for local agent sessions…"),
+ )
+ .into_any_element()
+ } else if library_empty {
+ v_flex()
+ .flex_1()
+ .w_full()
+ .items_center()
+ .justify_center()
+ .gap(SPACE_LG)
+ .child(empty_state(
+ "icons/layers.svg",
+ px(48.),
+ px(22.),
+ "Your library is empty",
+ "Add a local session location to get started.",
+ cx,
+ ))
+ .child(
+ Button::new("empty-open-settings")
+ .primary()
+ .small()
+ .rounded(RADIUS_BUTTON)
+ .label("Add a location")
+ .on_click(cx.listener(|this, _, _window, cx| {
+ this.settings_page = SettingsPage::Locations;
+ this.open_settings(cx);
+ })),
+ )
+ .into_any_element()
+ } else {
+ v_flex()
+ .flex_1()
+ .w_full()
+ .justify_center()
+ .child(empty_state(
+ "icons/inbox.svg",
+ px(48.),
+ px(22.),
+ "No matching sessions",
+ "Try a different agent, project, or filter.",
+ cx,
+ ))
+ .into_any_element()
+ }
} else {
List::new(&self.list_state)
.flex_1()
.min_h_0()
+ .w_full()
.into_any_element()
})
}
@@ -2673,6 +2698,15 @@ impl Workbench {
let Some(m) = transcript.get(ix) else {
return div().into_any_element();
};
+ // 只有 thinking、没有回复正文或工具调用的中间事件属于运行日志,
+ // 连续铺在阅读视图里会把真正的对话切碎;完整原始记录仍保留在源文件中。
+ if matches!(m.role, Role::Assistant)
+ && m.text.is_empty()
+ && m.tool_calls.is_empty()
+ && m.thinking.is_some()
+ {
+ return div().into_any_element();
+ }
// 搜索跳转的落点消息:淡 primary 底色保持高亮,直到换会话
let is_jump_target = jump_seq == Some(m.seq);
@@ -2689,8 +2723,8 @@ impl Workbench {
.min_w_0()
.rounded(theme.radius_lg)
.bg(theme.muted)
- .px(px(12.))
- .py(px(7.))
+ .px(px(14.))
+ .py(SPACE_SM)
.text_size(FONT_MSG_USER)
.child(
TextView::markdown(
@@ -2705,21 +2739,24 @@ impl Workbench {
is_dark: dark,
..Default::default()
})
+ .line_height(relative(1.45))
.selectable(true),
),
)
.into_any_element(),
Role::Assistant => {
- let mut col = v_flex().w_full().min_w_0().gap(px(6.));
- if let Some(th) = &m.thinking {
- col = col.child(
- div()
- .text_size(FONT_MSG_THINKING)
- .italic()
- .text_color(muted_fg)
- .truncate()
- .child(format!("Thinking · {}", one_line(th, 200))),
- );
+ let mut col = v_flex().w_full().min_w_0().gap(SPACE_SM);
+ if !m.text.is_empty() {
+ if let Some(th) = &m.thinking {
+ col = col.child(
+ div()
+ .text_size(FONT_MSG_THINKING)
+ .italic()
+ .text_color(muted_fg)
+ .truncate()
+ .child(format!("Thinking · {}", one_line(th, 200))),
+ );
+ }
}
if !m.text.is_empty() {
col = col.child(
@@ -2736,6 +2773,7 @@ impl Workbench {
is_dark: dark,
..Default::default()
})
+ .line_height(relative(1.5))
.selectable(true),
),
);
@@ -2768,9 +2806,9 @@ impl Workbench {
.w_full()
.flex()
.justify_center()
- // 10px:用户定稿(2026-08-18),16 显大 8 显小,不在 4px 网格上是有意的
- .px(px(10.))
- .py(px(6.))
+ // 与详情头共用 24px 阅读轴,正文、标题和元信息形成一条竖线。
+ .px(SPACE_XXL)
+ .py(SPACE_SM)
.when(ix == 0, |d| d.pt(SPACE_LG))
.when(ix + 1 == total, |d| d.pb(SPACE_XXL))
.child(
@@ -2881,6 +2919,25 @@ impl Workbench {
})
.anchor(Corner::TopRight);
+ let detail_path: SharedString = if meta.project_path.is_empty() {
+ "Unknown project".to_string()
+ } else {
+ meta.project_path.clone()
+ }
+ .into();
+ let mut detail_facts: Vec<String> = Vec::new();
+ if meta.message_count > 0 {
+ detail_facts.push(format!("{} messages", meta.message_count));
+ }
+ if let Some(tokens) = meta.tokens_used {
+ detail_facts.push(format!("{} tokens", fmt_tokens(Some(tokens))));
+ }
+ let detail_fact_line: SharedString = detail_facts.join(" · ").into();
+ let created_time: Option<SharedString> =
+ (meta.created_at > 0).then(|| format!("Created {}", abs_date(meta.created_at)).into());
+ let updated_time: Option<SharedString> =
+ (meta.updated_at > 0).then(|| format!("Updated {}", abs_date(meta.updated_at)).into());
+
v_flex()
.flex_1()
.min_w_0()
@@ -2890,14 +2947,20 @@ impl Workbench {
v_flex()
.id("detail-header")
.flex_shrink_0()
+ .relative()
.window_control_area(WindowControlArea::Drag)
- .px(SPACE_LG)
+ .px(SPACE_XXL)
.pt(SPACE_XL)
- .pb(SPACE_MD)
- .gap(SPACE_SM)
+ .pb(SPACE_XL)
+ .gap(SPACE_MD)
+ .border_b_1()
+ .border_color(theme.border)
.child(
h_flex()
+ .min_w_0()
+ .pr(px(156.))
.gap(SPACE_SM)
+ .items_center()
.text_size(FONT_LABEL)
.text_color(theme.muted_foreground)
.child(img(meta.agent.brand_icon(theme.mode.is_dark())).size(px(15.)).flex_shrink_0())
@@ -2915,19 +2978,27 @@ impl Workbench {
)
.child(
h_flex()
+ .items_start()
.justify_between()
.gap(SPACE_LG)
.child(
div()
.flex_1()
.min_w_0()
+ .max_h(px(54.))
+ .overflow_hidden()
.text_size(FONT_TITLE)
+ .line_height(relative(1.15))
.font_semibold()
- .truncate()
.child(meta.title.clone()),
)
.child(
h_flex()
+ .absolute()
+ // 当前元素属于标题行,负偏移到上一层来源行;来源行右侧
+ // 已预留 156px,因此不会遮住 Agent / 项目 / 分支。
+ .top(-px(27.))
+ .right(SPACE_XXL)
.flex_shrink_0()
.gap(SPACE_XS)
.child({
@@ -3094,95 +3165,72 @@ impl Workbench {
),
)
.child(
- // 元信息四行收成 4px 紧组:与标题区之间保持 SPACE_SM,
- // "组内紧、组间松"——四行等距摊开读起来像四个并列区块
v_flex()
- .gap(SPACE_XS)
- .child(
- h_flex()
- .gap(px(6.))
- .text_size(FONT_LABEL)
- .text_color(theme.muted_foreground)
- .child(icon("icons/folder.svg").with_size(px(12.)).flex_shrink_0())
- .child(div().min_w_0().truncate().child(
- if meta.project_path.is_empty() {
- "Unknown project".to_string()
- } else {
- meta.project_path.clone()
- },
- )),
- )
- .child({
- // 属性行:model / source outline badge + 统计;空值自动省略
- let mut stats: Vec<String> = Vec::new();
- if meta.message_count > 0 {
- stats.push(format!("{} messages", meta.message_count));
- }
- if let Some(tokens) = meta.tokens_used {
- stats.push(format!("{} tokens", fmt_tokens(Some(tokens))));
- }
- h_flex()
+ .min_w_0()
+ .pt(SPACE_XS)
.gap(SPACE_SM)
.text_size(FONT_LABEL)
.text_color(theme.muted_foreground)
- .when_some(meta.model.clone(), |this, model| {
- this.child(outline_badge(
- model,
- rgb(crate::theme::MODEL_BADGE_BG).into(),
- ))
- })
- .when_some(
- meta.source.clone().filter(|s| !s.is_empty()),
- |this, source| {
- // opencode2 是版本代际标记而非发起平台,
- // 用 primary 蓝与 via 徽章(绿)区分
- let color = if source == "opencode2" {
- theme.primary
- } else {
- theme.success
- };
- this.child(outline_badge(source, color))
- },
+ .child(
+ h_flex()
+ .min_w_0()
+ .gap(px(6.))
+ .child(
+ icon("icons/folder.svg")
+ .with_size(px(12.))
+ .flex_shrink_0(),
+ )
+ .child(div().min_w_0().truncate().child(detail_path)),
)
- .child(div().min_w_0().truncate().child(stats.join(" · ")))
- })
- .child({
- // 时间行:创建 / 最后活动,精确时间
- let mut times: Vec<String> = Vec::new();
- if meta.created_at > 0 {
- times.push(format!("Created {}", abs_date(meta.created_at)));
- }
- if meta.updated_at > 0 {
- times.push(format!("Updated {}", abs_date(meta.updated_at)));
- }
- div()
- .text_size(FONT_LABEL)
- .text_color(theme.muted_foreground)
- .truncate()
- .child(times.join(" · "))
- })
- .child({
- // 会话文件路径(header 末行):展示用折叠形态(~ 缩写 +
- // 中段省略),点击在 Finder 中显示(传原始完整路径)
- let file_path = meta.file_path.clone();
- h_flex()
- .id("detail-file-path")
- .gap(px(6.))
- .text_size(FONT_LABEL)
- .text_color(theme.muted_foreground)
- .cursor_pointer()
- .hover(|s| s.text_colored(theme.foreground, FONT_LABEL))
- .on_click(move |_, _, _| {
- terminal::reveal_in_file_manager(&file_path);
- })
- .child(icon("icons/file-text.svg").with_size(px(12.)).flex_shrink_0())
- .child(div().min_w_0().truncate().child(display_file_path(&meta.file_path)))
- })
+ .child(
+ h_flex()
+ .min_w_0()
+ .gap(SPACE_MD)
+ .items_center()
+ .when_some(meta.model.clone(), |this, model| {
+ this.child(outline_badge(
+ model,
+ rgb(crate::theme::MODEL_BADGE_BG).into(),
+ ))
+ })
+ .when_some(
+ meta.source.clone().filter(|s| !s.is_empty()),
+ |this, source| {
+ let color = if source == "opencode2" {
+ theme.primary
+ } else {
+ theme.success
+ };
+ this.child(outline_badge(source, color))
+ },
+ )
+ .child(
+ div()
+ .min_w_0()
+ .truncate()
+ .child(detail_fact_line),
+ ),
+ )
+ .when(created_time.is_some() || updated_time.is_some(), |this| {
+ this.child(
+ h_flex()
+ .w_full()
+ .min_w_0()
+ .gap(SPACE_XL)
+ .when_some(created_time.clone(), |row, created| {
+ row.child(div().min_w_0().truncate().child(created))
+ })
+ .when_some(updated_time.clone(), |row, updated| {
+ row.child(div().flex_shrink_0().child(updated))
+ }),
+ )
+ }),
),
)
.child(if detail.loading {
h_flex()
.flex_1()
+ .bg(theme.popover)
.items_center()
.justify_center()
.gap(SPACE_SM)
@@ -3195,29 +3243,20 @@ impl Workbench {
div()
.flex_1()
.min_h_0()
- .px(SPACE_MD)
- .pb(SPACE_MD)
+ .bg(theme.popover)
+ .relative()
.child(
- div()
- .size_full()
- .rounded(theme.radius_lg)
- .bg(theme.popover)
- .relative()
- .child(
- gpui::list(detail.msg_list.clone(), move |ix, window, cx| {
- entity
- .upgrade()
- .map(|e| {
- e.update(cx, |this, cx| {
- this.render_msg_row(ix, window, cx)
- })
- })
- .unwrap_or_else(|| div().into_any_element())
+ gpui::list(detail.msg_list.clone(), move |ix, window, cx| {
+ entity
+ .upgrade()
+ .map(|e| {
+ e.update(cx, |this, cx| this.render_msg_row(ix, window, cx))
})
- .size_full(),
- )
- .vertical_scrollbar(&detail.msg_list),
+ .unwrap_or_else(|| div().into_any_element())
+ })
+ .size_full(),
)
+ .vertical_scrollbar(&detail.msg_list)
.into_any_element()
})
.into_any_element()