All your AI agent sessions in one place — browse, search, resume. Rust + GPUI.
Rust
feat(remote): align the Remote hosts page with Locations and finish the host badges
Corey Chiud5416948d00d
diff --git a/DESIGN.md b/DESIGN.mdindex bc52873..8495bde 100644--- a/DESIGN.md+++ b/DESIGN.md@@ -134,7 +134,7 @@ macOS 不设置横跨三栏的自定义 header。主窗口透明标题栏高 44p- 行内容 = 行首元素 + 标题 + 计数;计数一律 Label 档 muted。- 组头 "Agents"/"Projects" 用 Body 档常规字重 + muted 色(与主导航同字号同字重,仅靠颜色和"无行首图标"区分——加粗会让组头压过它统辖的行),带 13px chevron 可折叠。- 底部工具条常驻,总高 44px(含顶部 1px hairline),按钮靠右排列(次要操作区:透明底、hover 才出色,不与导航行选中态抢注意力)——依次为 chart-column "Insights"、齿轮 "Settings"、refresh。Insights 页打开时其图标以 primary 点亮,是工具条里唯一有激活态的按钮。Settings 同时进入 Wake 菜单并绑定 `⌘,`(其他平台 `Ctrl+,`),保持单例窗口。-- 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 后保留配置、停止扫描/监听并从会话与搜索结果排除,重新开启即增量扫回;纯路径管理不做内容校验。+- Settings 默认 820×600,采用 180px 窄侧栏 + 内容页结构,固定为 General / Locations / Remote hosts / 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 后保留配置、停止扫描/监听并从会话与搜索结果排除,重新开启即增量扫回;纯路径管理不做内容校验。Remote hosts 页沿用 Locations 的版式:标题 + 说明,右侧低强调的 Sync now / Add host;host 列表为单张 popover 底圆角卡,一行一台(名字为主信息、同步状态为 muted 副信息,失败用 danger),`…` 菜单集中 Sync now / Remove,最右为开关;添加走与 location 同材质的单字段表单弹窗,SSH 前提说明放在字段下方。列表与详情页的远程会话以 `@host` 徽章标识:列表行为 primary 淡底填充胶囊(与 muted 项目胶囊区分),详情页与 model/source 同排用 primary 描边。- 工具条内的**状态行"常态沉默"**:仅刷新中或监听不可用时出现在按钮行上方;文案须可 truncate,窄侧栏放不下长句(故为 "Live updates off" 而非带操作建议的整句)。- 手动 Refresh 始终后台运行;进度复用侧栏状态行,完成后发通知,不用模态框阻断浏览、搜索或阅读。- 不把项目包装成卡片,不堆叠分支、时间或重复图标。项目行不加彩色标识——同一图标重复十几次不传递信息。diff --git a/crates/wake/src/settings.rs b/crates/wake/src/settings.rsindex ac317b8..52e2a17 100644--- a/crates/wake/src/settings.rs+++ b/crates/wake/src/settings.rs@@ -1,7 +1,6 @@use gpui::prelude::FluentBuilder as _;use gpui::*;use gpui_component::button::{Button, ButtonCustomVariant, ButtonVariants as _};-use gpui_component::input::{Input, InputEvent, InputState};use gpui_component::menu::{DropdownMenu as _, PopupMenuItem};use gpui_component::switch::Switch;use gpui_component::{@@ -95,10 +94,7 @@ pub(crate) struct SettingsView {workbench: Entity<Workbench>,appearance: AppearancePreference,show_unavailable: bool,- /// Remote hosts 页的 Add host 输入框(页面内嵌,回车/按钮提交)- host_input: Entity<InputState>,_workbench_observer: Option<Subscription>,- _host_input_subscription: Subscription,}impl SettingsView {@@ -114,38 +110,15 @@ impl SettingsView {cx.on_next_frame(window, move |this, _, cx| {this._workbench_observer = Some(cx.observe(&observed, |_, _, cx| cx.notify()));});- let host_input = cx.new(|cx| {- InputState::new(window, cx).placeholder("SSH alias from ~/.ssh/config, or user@host")- });- let host_input_subscription =- cx.subscribe_in(&host_input, window, |this, _, event, window, cx| {- if matches!(event, InputEvent::PressEnter { .. }) {- this.submit_add_host(window, cx);- }- });Self {focus_handle: cx.focus_handle(),workbench,appearance: theme::appearance_preference(),show_unavailable: false,- host_input,_workbench_observer: None,- _host_input_subscription: host_input_subscription,}}- fn submit_add_host(&mut self, window: &mut Window, cx: &mut Context<Self>) {- let name = self.host_input.read(cx).value().trim().to_string();- if name.is_empty() {- return;- }- self.workbench.update(cx, |workbench, cx| {- workbench.add_remote_host(&name, window, cx)- });- self.host_input- .update(cx, |state, cx| state.set_value("", window, cx));- }-fn render_nav_item(&self,id: &'static str,@@ -1028,100 +1001,121 @@ impl SettingsView {)}- /// Settings → Remote hosts:SSH 会话聚合(阶段 1:只读镜像)。- /// 行结构仿 Locations:名称 + 状态行 + Switch + Remove。+ /// Settings → Remote hosts:SSH 会话聚合(阶段 1:只读镜像)。版式与+ /// Locations 页同一套:标题 + 说明,右侧低强调的 Sync now / Add host;host+ /// 列表是一张 popover 底的圆角卡,一行一台——名字为主信息、同步状态为+ /// muted 副信息(失败用 danger),`…` 菜单集中 Sync now / Remove,最右是+ /// 开关;添加走与 location 同材质的表单弹窗(2026-09-03 用户要求统一)。fn render_remotes(&mut self, cx: &mut Context<Self>) -> AnyElement {let theme = cx.theme();let rows = self.workbench.read(cx).remote_hosts_snapshot();let syncing = self.workbench.read(cx).remote_sync_in_progress();let sync_workbench = self.workbench.clone();+ let add_workbench = self.workbench.clone();let has_hosts = !rows.is_empty();let row_elements: Vec<AnyElement> = rows.into_iter().enumerate().map(|(ix, row)| {+ let menu_workbench = self.workbench.clone();let toggle_workbench = self.workbench.clone();- let remove_workbench = self.workbench.clone();+ let menu_name = row.name.clone();let toggle_name = row.name.clone();- let remove_name = row.name.clone();- let row_fg = if row.enabled {- theme.foreground- } else {- theme.muted_foreground- };- h_flex()- .id(SharedString::from(format!("remote-host-{ix}")))+ let enabled = row.enabled;+ let menu = Button::new(("settings-remote-host-menu", ix))+ .ghost()+ .small()+ .rounded(RADIUS_BUTTON)+ .icon(icon("icons/more-horizontal.svg").with_size(px(14.)))+ .dropdown_menu(move |menu, _, _| {+ let sync_workbench = menu_workbench.clone();+ let sync_name = menu_name.clone();+ let remove_workbench = menu_workbench.clone();+ let remove_name = menu_name.clone();+ menu.min_w(px(180.))+ .item(+ PopupMenuItem::new("Sync now")+ .disabled(syncing || !enabled)+ .on_click(move |_, _, cx| {+ let name = sync_name.to_string();+ sync_workbench.update(cx, |this, cx| {+ this.spawn_remote_sync(vec![name], cx)+ });+ }),+ )+ .separator()+ .item(PopupMenuItem::new("Remove").on_click(move |_, window, cx| {+ let name = remove_name.clone();+ remove_workbench.update(cx, |this, cx| {+ this.confirm_remove_remote_host(name, window, cx)+ });+ }))+ });+ div().w_full()- .px(SPACE_MD)- .py(SPACE_SM)- .gap(SPACE_MD)- .items_center()- .rounded(theme.radius)- .border_1()- .border_color(theme.border)+ .when(ix > 0, |this| this.border_t_1().border_color(theme.border)).child(- icon("icons/server.svg")- .with_size(px(15.))- .flex_shrink_0()- .text_color(row_fg),- )- .child(- v_flex()- .flex_1()- .min_w_0()- .gap(px(2.))+ h_flex()+ .id(("settings-remote-host-row", ix))+ .min_h(px(60.))+ .w_full()+ .px(SPACE_LG)+ .gap(SPACE_MD)+ .items_center().child(- div()- .text_size(FONT_BODY)- .font_medium()- .text_color(row_fg)- .child(row.name.clone()),+ v_flex()+ .flex_1()+ .min_w_0()+ .gap(px(3.))+ .child(+ div()+ .w_full()+ .truncate()+ .text_size(FONT_BODY)+ .text_color(if enabled {+ theme.foreground+ } else {+ theme.muted_foreground+ })+ .child(row.name.clone()),+ )+ .child(+ div()+ .w_full()+ .truncate()+ .text_size(FONT_CAPTION)+ .text_color(if row.failed && enabled {+ theme.danger+ } else {+ theme.muted_foreground+ })+ .child(row.status.clone()),+ ),)+ .child(menu).child(- div()- .min_w_0()- .truncate()- .text_size(FONT_CAPTION)- .text_color(if row.failed {- theme.danger+ Switch::new(("settings-remote-host-enabled", ix))+ .checked(enabled)+ .small()+ .tooltip(if enabled {+ "Disable host"} else {- theme.muted_foreground+ "Enable host"})- .child(row.status.clone()),+ .on_click(move |checked, window, cx| {+ let enabled = *checked;+ toggle_workbench.update(cx, |this, cx| {+ this.set_remote_host_enabled(+ toggle_name.as_ref(),+ enabled,+ window,+ cx,+ );+ });+ }),),)- .child(- Switch::new(SharedString::from(format!("remote-host-toggle-{ix}")))- .checked(row.enabled)- .on_click(move |checked, window, cx| {- let enabled = *checked;- toggle_workbench.update(cx, |this, cx| {- this.set_remote_host_enabled(- toggle_name.as_ref(),- enabled,- window,- cx,- );- });- }),- )- .child(- Button::new(SharedString::from(format!("remote-host-remove-{ix}")))- .ghost()- .small()- .rounded(RADIUS_BUTTON)- .icon(icon("icons/trash-2.svg").with_size(px(14.)))- .on_click(move |_, window, cx| {- remove_workbench.update(cx, |this, cx| {- this.confirm_remove_remote_host(- remove_name.clone(),- window,- cx,- );- });- }),- ).into_any_element()}).collect();@@ -1175,7 +1169,19 @@ impl SettingsView {.update(cx, |this, cx| this.sync_all_remote_hosts(cx));}),)- }),+ })+ .child(+ settings_button(+ Button::new("settings-add-remote-host")+ .icon(icon("icons/plus.svg").with_size(px(13.)))+ .label("Add host"),+ cx,+ )+ .on_click(move |_, window, cx| {+ add_workbench+ .update(cx, |this, cx| this.open_add_remote_host_form(window, cx));+ }),+ ),).child(v_flex()@@ -1185,44 +1191,25 @@ impl SettingsView {.overflow_y_scroll().px(SPACE_XXL).pb(px(40.))- .gap(SPACE_LG)- .child(- h_flex()- .w_full()- .gap(SPACE_SM)- .child(div().flex_1().min_w_0().child(Input::new(&self.host_input)))- .child(- settings_button(- Button::new("settings-add-remote-host")- .icon(icon("icons/plus.svg").with_size(px(13.)))- .label("Add host"),- cx,- )- .on_click(cx.listener(- |this, _, window, cx| {- this.submit_add_host(window, cx);- },- )),- ),- )- .child(- div()- .text_size(FONT_CAPTION)- .text_color(theme.muted_foreground)- .child(- "Needs non-interactive SSH (key in your agent) and rsync on both \- ends — connect once from a terminal first to trust the host key. \- Sessions sync on launch, refresh, and Sync now.",- ),- )- .children(row_elements)+ .gap(SPACE_XL)+ .when(has_hosts, |this| {+ this.child(+ v_flex()+ .w_full()+ .overflow_hidden()+ .rounded(theme.radius_lg)+ .border_1()+ .border_color(theme.border)+ .bg(theme.popover)+ .children(row_elements),+ )+ }).when(!has_hosts, |this| {this.child(div()- .pt(SPACE_LG)- .text_size(FONT_LABEL)+ .text_size(FONT_CAPTION).text_color(theme.muted_foreground)- .child("No remote hosts yet."),+ .child("No remote hosts yet. Add one to mirror its sessions into Wake."),)}),)diff --git a/crates/wake/src/theme.rs b/crates/wake/src/theme.rsindex 9752b0a..4507017 100644--- a/crates/wake/src/theme.rs+++ b/crates/wake/src/theme.rs@@ -217,6 +217,11 @@ pub fn apply_wake_theme(cx: &mut App) {theme.font_family = ".SystemUIFont".into();theme.font_size = gpui::px(14.);theme.radius = gpui::px(8.);+ // 聚焦态只把边框染成 ring 色,不画框外的环:gpui-component 的环是元素框外+ // 2px 的绝对定位子元素,任何裁切祖先(弹窗面板、滚动列表、圆角容器)都会+ // 切掉一截——Add host / Add location 表单与设置页里实测残缺(2026-09-03+ // 用户反馈两轮)。上游自己的建议就是版式裁切多的应用关掉它,边框不占空间+ theme.focus_ring = false;theme.radius_lg = gpui::px(12.);theme.shadow = true;}diff --git a/crates/wake/src/workbench.rs b/crates/wake/src/workbench.rsindex 93d5a83..8a3d8e3 100644--- a/crates/wake/src/workbench.rs+++ b/crates/wake/src/workbench.rs@@ -749,10 +749,13 @@ impl ListDelegate for SessionsDelegate {theme.muted_foreground,)).when(!s.host.is_empty(), |this| {- // 远程会话的 host 徽章:@ 前缀一眼与项目名区分- this.child(outline_badge(+ // 远程会话的 host 徽章:填充胶囊但用 primary 淡底 ++ // primary 字,与紧邻的 muted 项目胶囊拉开(描边版、+ // muted 填充版都试过,用户否决 2026-09-03)+ this.child(badge(format!("@{}", s.host),- theme.muted_foreground,+ theme.primary.opacity(0.14),+ theme.primary,))}).when(show_chevron, |this| {@@ -2769,6 +2772,133 @@ impl Workbench {self.open_location_form(FormTarget::Add, window, cx);}+ /// Remote hosts 的 Add host 表单:与 location 表单同一材质(标题缩进轴、+ /// 标签列宽、Cancel/Add 只在有输入时出现),字段只有一个 host 名;SSH+ /// 前提说明放在字段下方,填的时候才需要看。回车与 Add 同一条提交路,+ /// 校验不过留在表单上改(2026-09-03 用户要求与 Locations 版式统一)+ pub(crate) fn open_add_remote_host_form(+ &mut self,+ window: &mut Window,+ cx: &mut Context<Self>,+ ) {+ let host_input = cx.new(|cx| {+ InputState::new(window, cx).placeholder("alias from ~/.ssh/config, or user@host")+ });+ cx.subscribe_in(&host_input, window, |this, input, event, window, cx| {+ if matches!(event, gpui_component::input::InputEvent::PressEnter { .. }) {+ let name = input.read(cx).text().to_string();+ if this.commit_remote_host_form(&name, window, cx) {+ window.close_all_dialogs(cx);+ }+ }+ })+ .detach();+ let entity = cx.entity();+ open_closable_dialog(window, cx, move |dialog, _window, cx| {+ let theme = cx.theme();+ let field_inset = BUTTON_SM_PX;+ // 有输入才亮出 Cancel/Add(与 location 表单同规则);Rope 直接扫描,+ // builder 每帧跑,禁 to_string+ let dirty = host_input+ .read(cx)+ .text()+ .chars()+ .any(|c| !c.is_whitespace());+ let ok_entity = entity.clone();+ let ok_input = host_input.clone();+ let dialog = dialog+ .title(+ div()+ .pl(field_inset)+ .text_size(FONT_HEADING)+ .font_semibold()+ .child("Add remote host"),+ )+ .w(px(500.))+ .button_props(gpui_component::dialog::DialogButtonProps::default().ok_text("Add"))+ .child(+ v_flex()+ .gap(SPACE_MD)+ .child(+ h_flex()+ .px(field_inset)+ .gap(SPACE_SM)+ .items_center()+ .child(+ div()+ .w(FORM_LABEL_W)+ .flex_shrink_0()+ .text_size(FONT_CAPTION)+ .text_color(theme.muted_foreground)+ .child("Host"),+ )+ .child(div().flex_1().min_w_0().child(Input::new(&host_input))),+ )+ .child(+ // 说明与输入框左缘对齐(跳过标签列)+ div()+ .pl(field_inset + FORM_LABEL_W + SPACE_SM)+ .pr(field_inset)+ .text_size(FONT_CAPTION)+ .text_color(theme.muted_foreground)+ .child(+ "Needs non-interactive SSH (key in your agent) and rsync on \+ both ends. Connect once from a terminal first to trust the \+ host key. Sessions sync on launch, refresh, and Sync now.",+ ),+ ),+ )+ .on_ok(move |_, window, cx| {+ let name = ok_input.read(cx).text().to_string();+ ok_entity.update(cx, |this, cx| {+ this.commit_remote_host_form(&name, window, cx)+ })+ });+ if dirty {+ dialog.footer(+ gpui_component::dialog::DialogFooter::new()+ .w_full()+ .px(field_inset)+ .child(+ gpui_component::dialog::DialogClose::new()+ .child(Button::new("remote-host-cancel").label("Cancel").outline()),+ )+ .child(+ gpui_component::dialog::DialogAction::new()+ .child(Button::new("remote-host-add").label("Add").primary()),+ ),+ )+ } else {+ dialog+ }+ });+ }++ /// Add host 表单提交:校验 → 入库 → 只拉这台;返回 true 关弹窗,false 留在+ /// 表单上改(空输入静默,格式错给通知)+ fn commit_remote_host_form(+ &mut self,+ name: &str,+ window: &mut Window,+ cx: &mut Context<Self>,+ ) -> bool {+ let name = name.trim();+ if name.is_empty() {+ return false;+ }+ if !wake_core::remote::valid_host_name(name) {+ window.push_notification(+ Notification::error(+ "Host must be an SSH alias or user@host (letters, digits, . _ - @)",+ ),+ cx,+ );+ return false;+ }+ self.add_remote_host(name, window, cx);+ true+ }+pub(crate) fn open_edit_location_form(&mut self,row: DataSourceRow,@@ -6306,9 +6436,12 @@ impl Workbench {},).when(!meta.host.is_empty(), |this| {+ // 详情页保持 model/source 同排的描边形态,色相+ // 与列表行的 host 胶囊一致(primary);muted 描边+ // 用户否决 2026-09-03this.child(outline_badge(format!("@{}", meta.host),- theme.muted_foreground,+ theme.primary,))}).when(has_detail_facts, |this| {