All your AI agent sessions in one place — browse, search, resume. Rust + GPUI.
Rust
feat(connect): give the CLI and the skill their own blocks
Corey Chiuf9fc27a2adb9
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d4559cf..f803e6d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,9 @@# Changelog+## Unreleased++- New: Settings → Connect now covers all three ways in — the MCP server, the `wake-cli` command line and the Wake skill each get their own block, with the path to copy, the command that puts `wake-cli` on your PATH, and the one-liner that installs the skill; the MCP and command-line blocks link straight to their reference docs+## [0.6.0] — 2026-09-11- New: `wake-cli` — search your session history, list what you worked on in a project and read a transcript straight from the terminal, so any agent that can run a shell command gets the same answers a connected MCP client does; run `wake-cli setup` for the path and how to point an agent at it (see docs/cli.md)diff --git a/DESIGN.md b/DESIGN.mdindex b451e8d..ba058b1 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 / Remote hosts / Connect / Data / Updates / About 七项(Connect 为 0.5.0 新增,插在 Remote hosts 与 Data 之间——两页都是"把 Wake 接到外部"的集成面,Data 之后是纯本地信息);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 描边。Connect 页沿用 Data 页的版式,**只放状态与动作,不放文档**(用户 2026-09-08 三轮定稿:平级双卡带代码块、嵌套同卡、缩进从属卡都试过,根源是设置窗里塞了 README 内容,怎么排都像教程):标题 + 一句说明(不点名 MCP、不写 read-only 声明);「MCP server」卡 84px 一行显示 wake-mcp 名称与 mono 字体的 `~/…` 路径,右侧 Copy path,不放"Ready"状态行,只在找不到二进制时给一行 danger 文案;「Agents」卡三行(Claude Code / Codex / Cursor),17px 品牌图标领行、客户端名为主信息、用法提示为 muted 副信息、右侧是 ghost 的 Show/Hide 切换(chevron 图标 + 文案,muted 前景,用户 2026-09-08 追加)加 Copy command / Copy config;代码块**默认收起**,展开后出现在该行下方、左缘对齐到文字轴(行内边距 16 + 图标 17 + 间距 12),secondary 填充 + 主题圆角的 mono 逐行渲染,Settings 重开即复位;页尾一句 caption 说四个只读工具是什么,后跟 primary 色的 Setup guide 链接直达仓库的 docs/mcp.md(完整参考:参数、输出、key/ref 格式、错误语义、排障),README 的 Connect 段只留概览并链过去。整页一屏放下不滚动。复制反馈是按钮原地变 "Copied"(check 图标)1.6s 后复原,**不弹通知**——gpui-component 的 toast 在窗口失活或被悬停时暂停自动关闭,在 Settings 从属窗里经常就挂着不走(用户 2026-09-08 反馈),且主界面的 Copy Session ID / Copy code 本来就不弹;页面只展示不代写别家配置。+- Settings 默认 820×600,采用 180px 窄侧栏 + 内容页结构,固定为 General / Locations / Remote hosts / Connect / Data / Updates / About 七项(Connect 为 0.5.0 新增,插在 Remote hosts 与 Data 之间——两页都是"把 Wake 接到外部"的集成面,Data 之后是纯本地信息);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 描边。Connect 页沿用 Data 页的版式,**只放状态与动作,不放文档**(用户 2026-09-08 三轮定稿:平级双卡带代码块、嵌套同卡、缩进从属卡都试过,根源是设置窗里塞了 README 内容,怎么排都像教程):标题 + 一句说明(不点名 MCP、不写 read-only 声明);「MCP server」卡 84px 一行显示 wake-mcp 名称与 mono 字体的 `~/…` 路径,右侧 Copy path,不放"Ready"状态行,只在找不到二进制时给一行 danger 文案;「MCP clients」卡三行(Claude Code / Codex / Cursor),17px 品牌图标领行、客户端名为主信息、用法提示为 muted 副信息、右侧是 ghost 的 Show/Hide 切换(chevron 图标 + 文案,muted 前景,用户 2026-09-08 追加)加 Copy command / Copy config;代码块**默认收起**,展开后出现在该行下方、左缘对齐到文字轴(行内边距 16 + 图标 17 + 间距 12),secondary 填充 + 主题圆角的 mono 逐行渲染,Settings 重开即复位。0.6.x 起页面是**四个区块**(用户 2026-09-11 定稿):MCP server / MCP clients / Command line / Skill——前三者各一张 84px 信息卡(wake-mcp、wake-cli 是二进制名与 mono 路径 + Copy path;wake-cli 那张在 Copy path **左侧**多一个 Copy command,复制「把它放进 PATH」的那行命令——右侧留给两张卡同名的 Copy path,纵向才对得齐;deb/tar 已装进 `…/bin` 或 Windows 上没有可粘命令时这个按钮不出现;Skill 是 `npx skills add …` + Copy command),区块标题为「Agents」时看不出这块特指 MCP,故改名 MCP clients 与上方 MCP server 成对。**说明性 caption 一律不放**——那正是"设置窗里塞 README"的复发形态;Setup guide 链接改挂在区块标题右端,规则是**每个面的第一个区块挂自己的文档**:MCP server → docs/mcp.md,Command line → docs/cli.md(MCP clients 与 Skill 分属这两个面的第二块,不重复挂)。四块之后整页**超过一屏、需要滚动**——2026-09-08 那条"一屏放下"的约束随第三、四个区块作废,滚动容器本来就在(`flex_1().min_h_0().overflow_y_scroll()`),卡片记得 `flex_shrink_0` 否则会被压扁。复制反馈是按钮原地变 "Copied"(check 图标)1.6s 后复原,**不弹通知**——gpui-component 的 toast 在窗口失活或被悬停时暂停自动关闭,在 Settings 从属窗里经常就挂着不走(用户 2026-09-08 反馈),且主界面的 Copy Session ID / Copy code 本来就不弹;页面只展示不代写别家配置。- 工具条内的**状态行"常态沉默"**:仅刷新中或监听不可用时出现在按钮行上方;文案须可 truncate,窄侧栏放不下长句(故为 "Live updates off" 而非带操作建议的整句)。- 手动 Refresh 始终后台运行;进度复用侧栏状态行,完成后发通知,不用模态框阻断浏览、搜索或阅读。- 不把项目包装成卡片,不堆叠分支、时间或重复图标。项目行不加彩色标识——同一图标重复十几次不传递信息。diff --git a/crates/wake-core/src/bin/wake_cli.rs b/crates/wake-core/src/bin/wake_cli.rsindex 5a377fd..19beee0 100644--- a/crates/wake-core/src/bin/wake_cli.rs+++ b/crates/wake-core/src/bin/wake_cli.rs@@ -83,8 +83,8 @@ fn run(db: &Option<PathBuf>, tool: &str, args: &serde_json::Value) -> ExitCode {fn setup(db: &Option<PathBuf>) -> String {let cli_bin = std::env::current_exe().unwrap_or_else(|_| PathBuf::from("wake-cli"));- // sibling_binary 取的就是 current_exe 同级目录,从 wake-cli 调恰好对- let mcp_bin = mcp::sibling_binary().filter(|p| p.exists());+ // sibling_named 取的就是 current_exe 同级目录,从 wake-cli 调恰好对+ let mcp_bin = mcp::sibling_named("wake-mcp").filter(|p| p.exists());let path = db_path(db);// 只探库,不必为一行提示把十六家 roster 建起来let db_error = Store::open_read_only(&path).err().map(|e| format!("{e:#}"));diff --git a/crates/wake-core/src/cli.rs b/crates/wake-core/src/cli.rsindex 57a2812..cda6478 100644--- a/crates/wake-core/src/cli.rs+++ b/crates/wake-core/src/cli.rs@@ -638,8 +638,20 @@ whether an error has been seen before — git history does not hold that.Everything is read-only.";/// 一行装好 skill。`owner/repo` 形式由 vercel-labs 的 skills CLI 认,仓库里-/// 有 `skills/` 目录即可被发现-const SKILL_INSTALL: &str = "npx skills add iAmCorey/Wake";+/// 有 `skills/` 目录即可被发现。Settings → Connect 的 Skill 卡展示的就是它,+/// 与 `wake-cli setup` 同一个来源+pub const SKILL_INSTALL: &str = "npx skills add iAmCorey/Wake";++/// 把 CLI 放进 PATH 的那一条**可粘命令**,给 GUI 的 Copy 按钮用。与+/// `wake-cli setup` 打印的是同一个来源。返回 None 的两种情况都不该给按钮:+/// 已经装在 `…/bin` 里(deb / tar)、以及 Windows——那边 path_hint 给的是+/// "把这个目录加进 PATH" 的说明,不是能粘进终端跑的东西+pub fn path_command(cli_bin: &Path) -> Option<String> {+ if cfg!(target_os = "windows") {+ return None;+ }+ path_hint(cli_bin)+}/// `wake-cli setup` 要说的事实(由 bin 查好传进来,函数本身仍是纯的)pub struct SetupFacts<'a> {@@ -1065,6 +1077,23 @@ mod tests {assert!(t.trim_end().ends_with("Note: no Wake index at /tmp/wake.db"));}+ #[test]+ fn path_command_is_pasteable_or_absent() {+ let bundled = PathBuf::from("/Apps/Wake.app/Contents/MacOS/wake-cli");+ if cfg!(target_os = "windows") {+ // Windows 的 path_hint 是散文,绝不能进剪贴板+ assert_eq!(path_command(&bundled), None);+ } else {+ let c = path_command(&bundled).expect("bundle 里要给命令");+ assert!(c.contains("wake-cli"), "{c}");+ assert_eq!(c.lines().count(), 1, "要能一行粘进终端: {c}");+ }+ // 已经在 …/bin 里就不必说了+ assert_eq!(path_command(Path::new("/usr/bin/wake-cli")), None);+ // current_exe 失败时的裸名兜底,没有目录可言+ assert_eq!(path_command(Path::new("wake-cli")), None);+ }+#[test]fn path_hint_quotes_spaces_and_skips_bin_dirs() {assert_eq!(path_hint(Path::new("/usr/bin/wake-cli")), None);diff --git a/crates/wake-core/src/mcp/mod.rs b/crates/wake-core/src/mcp/mod.rsindex 8bd730f..70bea1b 100644--- a/crates/wake-core/src/mcp/mod.rs+++ b/crates/wake-core/src/mcp/mod.rs@@ -17,7 +17,7 @@ pub mod tools;use std::io::{BufRead, Write};use std::path::{Path, PathBuf};-use std::sync::{Arc, OnceLock};+use std::sync::Arc;use serde_json::{json, Value};@@ -230,21 +230,17 @@ pub fn open_index(db: &Path) -> Result<(Arc<Store>, Vec<Box<dyn AgentAdapter>>),Ok((store, adapters))}-/// 与本进程同目录的 wake-mcp 可执行文件(GUI 的 Settings → Connect 展示用;-/// 打包时 bin 与 Wake 主程序并排:macOS 在 Contents/MacOS,Linux/Windows 同目录)。-/// current_exe 进程内不变,算一次缓存住——调用方可能在 render 里问-pub fn sibling_binary() -> Option<PathBuf> {- static BIN: OnceLock<Option<PathBuf>> = OnceLock::new();- BIN.get_or_init(|| {- let exe = std::env::current_exe().ok()?;- let name = if cfg!(target_os = "windows") {- "wake-mcp.exe"- } else {- "wake-mcp"- };- Some(exe.parent()?.join(name))- })- .clone()+/// 与本进程同目录的某个辅助可执行文件(Windows 补 .exe)。打包时辅助 bin 与+/// Wake 主程序并排:macOS 在 Contents/MacOS,Linux/Windows 同目录。+/// current_exe 是系统调用,**别在 render 里问**——GUI 一律开窗时算一次+pub fn sibling_named(stem: &str) -> Option<PathBuf> {+ let exe = std::env::current_exe().ok()?;+ let name = if cfg!(target_os = "windows") {+ format!("{stem}.exe")+ } else {+ stem.to_string()+ };+ Some(exe.parent()?.join(name))}/// 一段可复制的接入配置diff --git a/crates/wake/locales/zh-Hans.json b/crates/wake/locales/zh-Hans.jsonindex b94e105..f274759 100644--- a/crates/wake/locales/zh-Hans.json+++ b/crates/wake/locales/zh-Hans.json@@ -1,7 +1,7 @@{+ "$name": "简体中文"," Copy Session ID": " 拷贝会话 ID"," Export as Markdown": " 导出为 Markdown",- "$name": "简体中文","%-I:%M %p": "%H:%M","%B": "%-m月","%B %Y": "%Y年%-m月",@@ -21,9 +21,9 @@"Add host": "添加主机","Add location": "添加位置","Add remote host": "添加远程主机",+ "Add to ~/.codex/config.toml": "加到 ~/.codex/config.toml","Agent": "Agent","Agents": "Agent",- "Agents get four read-only tools: search, recent sessions, transcripts, projects.": "Agent 会获得四个只读工具:搜索、最近会话、转录、项目。","All Sessions": "全部会话","All your AI agent sessions, in one place.": "所有 AI agent 会话,集中在一处。","Appearance": "外观",@@ -46,6 +46,7 @@"Choose where Wake looks for local agent sessions.": "选择 Wake 查找本地 agent 会话的位置。","Close": "关闭","Close Window": "关闭窗口",+ "Command line": "命令行","Compared with the 7 days before": "与之前 7 天相比","Connect": "连接","Context compacted": "上下文已压缩",@@ -53,6 +54,8 @@"Copy": "拷贝","Copy SSH command": "拷贝 SSH 命令","Copy code": "拷贝代码",+ "Copy command": "拷贝命令",+ "Copy config": "拷贝配置","Copy full {}": "拷贝完整{}","Copy image": "拷贝图片","Copy path": "拷贝路径",@@ -126,9 +129,11 @@"Locations restored to defaults": "位置已恢复默认","Longest {} days": "最长 {} 天","Looking for local agent sessions…": "正在查找本地 agent 会话…",+ "MCP clients": "MCP 客户端","MCP server": "MCP 服务器","Main Window": "主窗口","Matches natural language and code, like \"useEffect(\".": "自然语言与代码都能匹配,例如 \"useEffect(\"。",+ "Merge into ~/.cursor/mcp.json": "并入 ~/.cursor/mcp.json","Message count": "消息数","Minimize": "最小化","Models": "模型",@@ -154,7 +159,7 @@"No tool calls": "无工具调用","No {} adapter is available for this session path.": "此会话路径没有可用的 {} 适配器。","Not detected": "未检测到",- "Not found next to the Wake app — reinstall Wake, or build it with `cargo build -p wake-core --bin wake-mcp`": "未在 Wake 应用旁找到 —— 请重新安装 Wake,或用 `cargo build -p wake-core --bin wake-mcp` 自行构建",+ "Not found next to the Wake app — reinstall Wake": "没在 Wake 应用旁边找到 —— 重装 Wake","Only the local file is removed — Codex's own records stay intact.": "只会删除本地文件 —— Codex 自己的记录不受影响。","Open this session": "打开此会话","Open this session in {}": "在 {} 中打开此会话",@@ -197,6 +202,7 @@"Reveal in File Explorer": "在文件资源管理器中显示","Reveal in File Manager": "在文件管理器中显示","Reveal in Finder": "在访达中显示",+ "Run in a terminal": "在终端里运行","SSH command copied: {}": "已拷贝 SSH 命令:{}","Same as last week": "与上周持平","Sat": "周六",@@ -227,6 +233,7 @@"Show in File Manager": "在文件管理器中显示","Show in Finder": "在访达中显示","Since {}": "自 {} 起",+ "Skill": "Skill","Sort by {} · {}": "排序:{} · {}","Star": "收藏","Starred": "已收藏",@@ -271,6 +278,7 @@"Wake couldn't open or rebuild its index at {}. {}": "Wake 无法在 {} 打开或重建索引。{}","Wake couldn't {} its window: {}": "Wake 无法{}窗口:{}","Wake data": "Wake 数据",+ "Wake skill": "Wake Skill","Wake {} is available. Open the release page to download it.": "Wake {} 已发布。打开发布页即可下载。","Wed": "周三","Wednesdays": "周三",diff --git a/crates/wake/src/i18n.rs b/crates/wake/src/i18n.rsindex ad87f41..f2bd76e 100644--- a/crates/wake/src/i18n.rs+++ b/crates/wake/src/i18n.rs@@ -591,7 +591,7 @@ mod tests {];for (tag, _, text) in BUNDLED {for key in parse(text).into_keys() {- if key == NAME_KEY || assembled_elsewhere(&key) {+ if key == NAME_KEY || assembled_elsewhere(&key) || from_wake_core(&key) {continue;}// 源码里是字面量形式,反斜杠与引号都带着转义@@ -604,6 +604,17 @@ mod tests {}}+ /// Settings → Connect 把 wake-core 的接入片段在显示边界上过一道 `t()`+ /// (`t(s.hint)` / `t(s.copy_label)`),所以这些 key 的英文原文不在 UI 源码里,+ /// 而在 `setup_snippets` 里。**不要把它们塞进 `assembled_elsewhere`**——+ /// wake-core 不参与 i18n,可以随时改这些字面量,恰恰最需要棘轮看着;+ /// 这里直接问那个 API,改了名就在这里红,而不是变成一条静默的死译文+ fn from_wake_core(key: &str) -> bool {+ wake_core::mcp::setup_snippets(std::path::Path::new("x"))+ .iter()+ .any(|s| s.hint == key || s.copy_label == key)+ }+/// 文本扫描找不到的 key:ui.rs 由 `concat!` 拼出整句(平台名词只写一次),/// 开窗动词由 `t(what)` 间接传入fn assembled_elsewhere(key: &str) -> bool {diff --git a/crates/wake/src/settings.rs b/crates/wake/src/settings.rsindex 47b0b40..ec7724d 100644--- a/crates/wake/src/settings.rs+++ b/crates/wake/src/settings.rs@@ -23,8 +23,9 @@ use crate::{theme, theme::AppearancePreference};const SETTINGS_SIDEBAR_W: Pixels = px(180.);const SETTINGS_PAGE_TOP: Pixels = px(38.);-/// Settings → Connect 页尾 Setup guide 的去处:仓库里的 MCP 完整文档+/// Connect 页两条 Setup guide 的去处:MCP 面与命令行面各自的完整文档const CONNECT_GUIDE_URL: &str = "https://github.com/iAmCorey/Wake/blob/main/docs/mcp.md";+const CONNECT_CLI_GUIDE_URL: &str = "https://github.com/iAmCorey/Wake/blob/main/docs/cli.md";fn icon(path: &'static str) -> Icon {Icon::empty().path(path)@@ -162,27 +163,51 @@ fn settings_info_card()}-/// Connect 页展示的 wake-mcp 事实,开窗时算一次:current_exe/stat/片段拼装都-/// 不该跑在每帧的 render 里(CLAUDE.md:render 里的路径探测必须缓存)+/// 一个并排辅助二进制的三件事。两张卡同构,所以探测也只写一遍+struct BinaryFacts {+ path: String,+ display: SharedString,+ exists: bool,+}++impl BinaryFacts {+ fn probe(stem: &str) -> Self {+ let found = wake_core::mcp::sibling_named(stem);+ let exists = found.as_ref().is_some_and(|p| p.is_file());+ // 找不到就退回裸名,展示时至少还是个可辨认的东西+ let path = found+ .map(|p| p.to_string_lossy().to_string())+ .unwrap_or_else(|| stem.to_string());+ Self {+ display: tilde_path(&path).into(),+ exists,+ path,+ }+ }+}++/// Connect 页展示的事实,开窗时算一次:current_exe/stat/片段拼装都不该跑在+/// 每帧的 render 里(CLAUDE.md:render 里的路径探测必须缓存)struct ConnectInfo {- bin_path: String,- bin_display: SharedString,- bin_exists: bool,+ mcp: BinaryFacts,+ cli: BinaryFacts,+ /// 把 wake-cli 放进 PATH 的那条命令;deb/tar 已在 `…/bin` 里、或 Windows+ /// 上没有一行命令能说清时为 None,那时就不给这个按钮+ cli_path_command: Option<String>,+ /// MCP clients 卡的三行:文案与片段来自 wake-core,与 `wake-mcp setup`+ /// 同源;GUI 只展示与复制,不代写别家配置snippets: Vec<wake_core::mcp::SetupSnippet>,}impl ConnectInfo {fn probe() -> Self {- let bin = wake_core::mcp::sibling_binary();- let bin_exists = bin.as_ref().is_some_and(|p| p.is_file());- let bin_path = bin- .map(|p| p.to_string_lossy().to_string())- .unwrap_or_else(|| "wake-mcp".to_string());+ let mcp = BinaryFacts::probe("wake-mcp");+ let cli = BinaryFacts::probe("wake-cli");Self {- bin_display: tilde_path(&bin_path).into(),- bin_exists,- snippets: wake_core::mcp::setup_snippets(std::path::Path::new(&bin_path)),- bin_path,+ snippets: wake_core::mcp::setup_snippets(std::path::Path::new(&mcp.path)),+ cli_path_command: wake_core::cli::path_command(std::path::Path::new(&cli.path)),+ mcp,+ cli,}}}@@ -674,7 +699,7 @@ impl SettingsView {let shown = self.connect_shown.contains(&ix);let copy = self.copy_button(format!("connect-copy-{ix}").into(),- s.copy_label,+ t(s.copy_label),s.text.clone(),cx,);@@ -704,11 +729,6 @@ impl SettingsView {}cx.notify();}));- let lines: Vec<AnyElement> = s- .text- .lines()- .map(|l| div().child(l.to_string()).into_any_element())- .collect();v_flex().w_full().when(ix + 1 < count, |this| {@@ -738,13 +758,18 @@ impl SettingsView {div().text_size(FONT_CAPTION).text_color(theme.muted_foreground)- .child(s.hint),+ .child(t(s.hint)),),).child(toggle).child(copy),).when(shown, |this| {+ // 默认收起,所以行元素只在展开时才建+ let lines = s+ .text+ .lines()+ .map(|l| div().child(l.to_string()).into_any_element());this.child(// 左缘对齐到文字轴:行内边距 + 图标 17 + 间距 12v_flex()@@ -765,29 +790,69 @@ impl SettingsView {}).collect();- let copy_path = self.copy_button(- "connect-copy-path".into(),- t("Copy path"),- info.bin_path.clone(),+ // 信息卡里那条 mono 副信息;exists=false 再补一句红字+ let mono_details = |display: SharedString, exists: bool| {+ let mut out = vec![div()+ .w_full()+ .truncate()+ .text_size(FONT_CAPTION)+ .font_family(mono.clone())+ .text_color(theme.muted_foreground)+ .child(display)+ .into_any_element()];+ if !exists {+ out.push(+ div()+ .text_size(FONT_CAPTION)+ .text_color(theme.danger)+ .child(t("Not found next to the Wake app — reinstall Wake"))+ .into_any_element(),+ );+ }+ out+ };+ // wake-mcp 与 wake-cli 的卡完全同构,只差名字、路径与按钮 id+ let binary_card = |primary: &'static str,+ id: &'static str,+ f: &BinaryFacts,+ extra: Option<AnyElement>| {+ settings_info_card(+ primary,+ mono_details(f.display.clone(), f.exists),+ // Copy path 恒在最右,两张卡的同名动作才对得齐;附加动作放它左边+ h_flex()+ .flex_shrink_0()+ .gap(SPACE_SM)+ .items_center()+ .children(extra)+ .child(self.copy_button(id.into(), t("Copy path"), f.path.clone(), cx))+ .into_any_element(),+ px(84.),+ cx,+ )+ };+ let copy_cli_command = info.cli_path_command.clone().map(|cmd| {+ self.copy_button(+ "connect-copy-cli-command".into(),+ t("Copy command"),+ cmd,+ cx,+ )+ .into_any_element()+ });+ let skill_card = settings_info_card(+ t("Wake skill"),+ mono_details(wake_core::cli::SKILL_INSTALL.into(), true),+ self.copy_button(+ "connect-copy-skill".into(),+ t("Copy command"),+ wake_core::cli::SKILL_INSTALL.to_string(),+ cx,+ )+ .into_any_element(),+ px(84.),cx,);- let mut details = vec![div()- .w_full()- .truncate()- .text_size(FONT_CAPTION)- .font_family(mono.clone())- .text_color(theme.muted_foreground)- .child(info.bin_display.clone())- .into_any_element()];- if !info.bin_exists {- details.push(- div()- .text_size(FONT_CAPTION)- .text_color(theme.danger)- .child(t("Not found next to the Wake app — reinstall Wake, or build it with `cargo build -p wake-core --bin wake-mcp`"))- .into_any_element(),- );- }let section = |label: &'static str| {div()@@ -797,14 +862,26 @@ impl SettingsView {.text_color(theme.foreground).child(label)};- let guide = div()- .id("connect-setup-guide")- .cursor_pointer()- .flex_shrink_0()- .text_size(FONT_CAPTION)- .text_color(theme.primary)- .on_click(|_, _, cx| cx.open_url(CONNECT_GUIDE_URL))- .child(t("Setup guide"));+ // 区块标题右侧的文档链接:MCP 面与命令行面各链自己那份,页尾只放一条+ // 会让读 CLI 那半页的人点进 MCP 的参考里。设置窗里不放文档,所以这页+ // 只有状态、动作与这两个去处,没有解释性的散文(用户 2026-09-11 定)+ let titled = |label: &'static str, guide: Option<(&'static str, &'static str)>| {+ h_flex()+ .flex_shrink_0()+ .gap(SPACE_SM)+ .items_center()+ .child(section(label).flex_1())+ .children(guide.map(|(id, url)| {+ div()+ .id(id)+ .cursor_pointer()+ .flex_shrink_0()+ .text_size(FONT_CAPTION)+ .text_color(theme.primary)+ .on_click(move |_, _, cx| cx.open_url(url))+ .child(t("Setup guide"))+ }))+ };v_flex().flex_1()@@ -825,15 +902,22 @@ impl SettingsView {.px(SPACE_XXL).pb(SPACE_XXL).gap(SPACE_SM)- .child(section(t("MCP server")))- .child(settings_info_card(+ // 四个区块同一种写法,有没有文档链接写在参数里,不靠两种拼法+ // 区分。规则一句话:**每个面的第一个区块挂自己的文档**——+ // MCP 面 = MCP server + MCP clients,命令行面 = Command line+ // + Skill,所以链接落在第一、第三块上。第五个区块该不该有+ // 链接,照这条判就行,不用再拍脑袋+ .child(titled(+ t("MCP server"),+ Some(("connect-setup-guide", CONNECT_GUIDE_URL)),+ ))+ .child(binary_card("wake-mcp",- details,- copy_path.into_any_element(),- px(84.),- cx,+ "connect-copy-path",+ &info.mcp,+ None,))- .child(section(t("Agents")).pt(SPACE_LG))+ .child(titled(t("MCP clients"), None).pt(SPACE_LG)).child(v_flex().w_full()@@ -846,21 +930,20 @@ impl SettingsView {.children(agent_rows),).child(- h_flex()- .flex_shrink_0()- .pt(SPACE_SM)- .gap(SPACE_SM)- .items_center()- .child(- div()- .flex_1()- .min_w_0()- .text_size(FONT_CAPTION)- .text_color(theme.muted_foreground)- .child(t("Agents get four read-only tools: search, recent sessions, transcripts, projects.")),- )- .child(guide),- ),+ titled(+ t("Command line"),+ Some(("connect-cli-setup-guide", CONNECT_CLI_GUIDE_URL)),+ )+ .pt(SPACE_LG),+ )+ .child(binary_card(+ "wake-cli",+ "connect-copy-cli-path",+ &info.cli,+ copy_cli_command,+ ))+ .child(titled(t("Skill"), None).pt(SPACE_LG))+ .child(skill_card),).into_any_element()}diff --git a/docs/mcp.md b/docs/mcp.mdindex a8ef189..560de45 100644--- a/docs/mcp.md+++ b/docs/mcp.md@@ -250,6 +250,10 @@ wake-mcp --version- Wake's read-only rules apply: other agents' directories and databases are opened read-only and credential files are never read.- Because an agent's own session is also indexed by Wake, a `wake_search` call it makes today (the tool name and query) will show up in tomorrow's search results for the same term. Tool outputs are not indexed, so the results themselves do not.+## See also++[docs/cli.md](cli.md) — `wake-cli`, the same index from a shell, for agents that run commands rather than call tools. It prints the identical text.+## Troubleshooting- **The client reports the server failed to start.** Run the binary in a terminal: `no Wake index at … — launch Wake once to build it` means Wake has never run on this machine (or `--db` points to the wrong place). `… is empty or from an older version` means the index predates this Wake version; launching Wake once upgrades it.