Skip to content

armgit / Wake

Public Imported from GitHub
0

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

Rust

feat: copy session source paths from the detail toolbar (#33)

Corey Chiue80e09cb6a26
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d777578..4fd7694 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@
## [0.7.0] — Unreleased
- New: session cleanup from the sidebar — filter by date, agent or project, sort by size, and preview before moving session files to the system trash. Includes cleanup history.
+- New: Copy Session Path in the session detail toolbar copies the source file path directly, with inline confirmation. Database-backed sessions copy the shared database path; remote sessions copy the local mirror path, as indicated in the tooltip (#33, thanks @ItsRyanWu)
## [0.6.7] — 2026-09-15
diff --git a/DESIGN.md b/DESIGN.md
index 7f5d04e..f42b67a 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -167,7 +167,7 @@ macOS 不设置横跨三栏的自定义 header。主窗口透明标题栏高 44p
五层信息一项不减;标题下方的三行信息不压进来源与标题区域。元信息区与标题、底部分隔线均保留 8px,层间保持 8px,让来源、标题、运行统计、位置和时间上下文能被分别扫读。
-“在终端继续”是唯一主按钮。收藏、置顶保留为独立图标按钮;导出、Finder 和删除进入“更多”菜单。按钮圆角固定 6px,危险操作在菜单中用分组隔开,图标与文案统一使用 danger 红色,并继续走确认框。
+“在终端继续”是唯一主按钮。收藏、置顶、拷贝会话路径保留为独立图标按钮;导出、Finder 和删除进入“更多”菜单。拷贝路径在“更多”左侧,成功后原地显示勾号与「已拷贝」提示 1.6s,不弹通知;数据库会话复制去掉会话 ID 后缀的共享数据库路径,远程会话复制本地镜像路径,tooltip 明确这两种情况。按钮圆角固定 6px,危险操作在菜单中用分组隔开,图标与文案统一使用 danger 红色,并继续走确认框。
详情正文使用 `popover` 阅读底色,与 `background` 详情头形成明确分区;阅读面横向铺满且不套大号圆角卡。内容限制在 720px 阅读宽度并居中。助手正文保持平铺,不在每条回复前重复 Agent 署名。只有 thinking、没有回复正文或工具调用的中间事件不进入阅读视图;带正文的 thinking 摘要保留,工具调用继续默认折叠。
diff --git a/crates/wake-core/src/adapters/mod.rs b/crates/wake-core/src/adapters/mod.rs
index e63b718..ab66e8f 100644
--- a/crates/wake-core/src/adapters/mod.rs
+++ b/crates/wake-core/src/adapters/mod.rs
@@ -23,6 +23,10 @@ pub(crate) mod parse_utils;
pub(crate) mod pi_format;
pub(crate) mod sqlite_ro;
+/// The local source file for a session, including mirrored remote sessions.
+/// Database-backed sessions resolve to their shared database, without `#<id>`.
+pub use sqlite_ro::strip_virtual_path as session_source_path;
+
use crate::models::*;
use anyhow::Result;
use std::path::Path;
diff --git a/crates/wake/locales/zh-Hans.json b/crates/wake/locales/zh-Hans.json
index 5204588..8d646ac 100644
--- a/crates/wake/locales/zh-Hans.json
+++ b/crates/wake/locales/zh-Hans.json
@@ -62,6 +62,10 @@
"Copied": "已拷贝",
"Copy": "拷贝",
"Copy SSH command": "拷贝 SSH 命令",
+ "Copy Session Path": "拷贝会话路径",
+ "Copy Session Path (local copy)": "拷贝会话路径(本地副本)",
+ "Copy Session Path (local copy of shared database)": "拷贝会话路径(共享数据库的本地副本)",
+ "Copy Session Path (shared database)": "拷贝会话路径(共享数据库)",
"Copy code": "拷贝代码",
"Copy command": "拷贝命令",
"Copy config": "拷贝配置",
diff --git a/crates/wake/src/workbench.rs b/crates/wake/src/workbench.rs
index 70af3bf..cde2ab0 100644
--- a/crates/wake/src/workbench.rs
+++ b/crates/wake/src/workbench.rs
@@ -40,12 +40,13 @@ use gpui_component::scroll::{AutoScroll, ScrollableElement as _};
use gpui_component::spinner::Spinner;
use gpui_component::text::{TextView, TextViewStyle};
use gpui_component::{
- h_flex, v_flex, ActiveTheme as _, Icon, IndexPath, Root, Sizable as _, StyledExt as _,
- TitleBar, WindowExt as _,
+ h_flex, v_flex, ActiveTheme as _, Disableable as _, Icon, IndexPath, Root, Sizable as _,
+ StyledExt as _, TitleBar, WindowExt as _,
};
use wake_core::adapters::{
- adapter_for, create_adapter_roster_for, path_owns, AdapterLocation, AgentAdapter,
+ adapter_for, create_adapter_roster_for, path_owns, session_source_path, AdapterLocation,
+ AgentAdapter,
};
use wake_core::db::Store;
use wake_core::models::Role as MessageRole;
@@ -1611,6 +1612,10 @@ fn toggle_expanded_row(rows: &mut HashSet<usize>, ix: usize) {
struct DetailState {
load_id: u64,
meta: SessionMeta,
+ /// Resolved in the background independently of the transcript; None while pending.
+ source_path: Option<String>,
+ /// Its lifetime is also the inline copy feedback; copying again resets the timer.
+ copy_path_reset: Option<Task<()>>,
/// 过滤后的可见消息。Rc 让行渲染以引用计数克隆代替整条消息深拷贝
transcript: Rc<Vec<TranscriptMessage>>,
loading: bool,
@@ -1638,6 +1643,8 @@ impl DetailState {
static NEXT_LOAD: AtomicU64 = AtomicU64::new(0);
Self {
load_id: NEXT_LOAD.fetch_add(1, Ordering::Relaxed),
+ source_path: None,
+ copy_path_reset: None,
meta,
transcript: Rc::new(Vec::new()),
loading: true,
@@ -4267,6 +4274,36 @@ impl Workbench {
// ---------- 详情 ----------
+ fn copy_session_path(&mut self, cx: &mut Context<Self>) {
+ let Some(detail) = &mut self.detail else {
+ return;
+ };
+ let Some(path) = detail.source_path.as_ref().filter(|path| !path.is_empty()) else {
+ return;
+ };
+ cx.write_to_clipboard(ClipboardItem::new_string(path.clone()));
+ let key = detail.meta.key.clone();
+ let load_id = detail.load_id;
+ detail.copy_path_reset = Some(cx.spawn(async move |this, cx| {
+ cx.background_executor()
+ .timer(std::time::Duration::from_millis(1_600))
+ .await;
+ this.update(cx, |this, cx| {
+ if let Some(detail) = detail_for_load(
+ &mut this.detail,
+ &mut this.cleanup.saved_detail,
+ &key,
+ load_id,
+ ) {
+ detail.copy_path_reset = None;
+ cx.notify();
+ }
+ })
+ .ok();
+ }));
+ cx.notify();
+ }
+
fn open_detail(
&mut self,
key: &str,
@@ -4290,6 +4327,29 @@ impl Workbench {
}
cx.notify();
+ // Resolving a virtual path can stat a slow/unavailable custom location.
+ // Keep that off the UI thread, without waiting for transcript parsing.
+ let source_key = meta.key.clone();
+ let file_path = meta.file_path.clone();
+ let source_task =
+ cx.background_spawn(async move { session_source_path(&file_path).to_string() });
+ cx.spawn(async move |this, cx| {
+ let source_path = source_task.await;
+ this.update(cx, |this, cx| {
+ if let Some(detail) = detail_for_load(
+ &mut this.detail,
+ &mut this.cleanup.saved_detail,
+ &source_key,
+ load_id,
+ ) {
+ detail.source_path = Some(source_path);
+ cx.notify();
+ }
+ })
+ .ok();
+ })
+ .detach();
+
let adapters = self.adapters.clone();
let task = cx.background_spawn(async move {
let result = load_visible_transcript(&adapters, &meta).map(|mut messages| {
@@ -6220,6 +6280,37 @@ impl Workbench {
.into_any_element();
};
let meta = &detail.meta;
+ let path_copied = detail.copy_path_reset.is_some();
+ let copy_path_hint = match (
+ !meta.host.is_empty(),
+ detail
+ .source_path
+ .as_ref()
+ .is_some_and(|path| path != &meta.file_path),
+ ) {
+ (false, false) => t("Copy Session Path"),
+ (false, true) => t("Copy Session Path (shared database)"),
+ (true, false) => t("Copy Session Path (local copy)"),
+ (true, true) => t("Copy Session Path (local copy of shared database)"),
+ };
+ let copy_path = Button::new("copy-session-path")
+ .ghost()
+ .rounded(RADIUS_BUTTON)
+ .icon(
+ icon(if path_copied {
+ "icons/check.svg"
+ } else {
+ "icons/copy.svg"
+ })
+ .with_size(px(16.)),
+ )
+ .tooltip(if path_copied {
+ t("Copied")
+ } else {
+ copy_path_hint
+ })
+ .disabled(detail.source_path.as_deref().is_none_or(str::is_empty))
+ .on_click(cx.listener(|this, _, _, cx| this.copy_session_path(cx)));
let detail_title_tooltip: SharedString = meta.title.clone().into();
let session_id = meta.id.clone();
let export_entity = cx.entity();
@@ -6599,6 +6690,7 @@ impl Workbench {
this.toggle_pinned(window, cx)
}),
))
+ .child(copy_path)
.child(more_menu),
),
)