Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions crates/ui/src/files/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,19 @@ impl FileDocument {
self.saved_revision = self.revision;
}

/// The whole file as read, when there is one to copy: a truncated read
/// would copy only part of it.
pub fn copyable_text(&self) -> Option<&str> {
if matches!(self.phase, DocumentPhase::Loading | DocumentPhase::Error(_)) {
return None;
}
self.file
.as_ref()
.filter(|file| !file.truncated)
.and_then(|file| file.text.as_deref())
.filter(|text| !text.is_empty())
}

pub fn content_hash(&self) -> Option<&str> {
self.file.as_ref()?.content_hash.as_deref()
}
Expand Down Expand Up @@ -430,6 +443,29 @@ mod tests {
assert!(!document.accepts(&key("src/main.rs"), document.generation));
}

#[test]
fn only_a_complete_non_empty_read_can_be_copied() {
let mut document = FileDocument::loading(key("src/lib.rs"));
assert_eq!(document.copyable_text(), None);
document.set_loaded(text_file());
assert_eq!(document.copyable_text(), Some("fn main() {}"));

let mut truncated = text_file();
truncated.truncated = true;
document.set_loaded(truncated);
assert_eq!(document.copyable_text(), None);

let mut empty = text_file();
empty.text = Some(String::new());
document.set_loaded(empty);
assert_eq!(document.copyable_text(), None);

let mut binary = text_file();
binary.text = None;
document.set_loaded(binary);
assert_eq!(document.copyable_text(), None);
}

#[test]
fn unsupported_and_truncated_files_are_read_only() {
let mut unsupported = text_file();
Expand Down
60 changes: 58 additions & 2 deletions crates/ui/src/files/preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use std::{

use gpui::{
AnyElement, App, Context, Entity, Focusable as _, HighlightStyle, ListAlignment, ListOffset,
ListSizingBehavior, ListState, Render, ScrollHandle, SharedString, Subscription, Window, div,
font, list, point, prelude::*, px,
ListSizingBehavior, ListState, Render, ScrollHandle, SharedString, Subscription, Task, Window,
div, font, list, point, prelude::*, px,
};
use gpui_base::input::{RopeExt as _, TextDecoration, TextDecorationCollection};
use zeron_proto::{
Expand Down Expand Up @@ -114,6 +114,8 @@ pub(super) struct FilePreviewState {
comment_draft: Option<EditorCommentDraft>,
active_comment: Option<String>,
typography_generation: u32,
copied_path: Option<String>,
copied_clear: Option<Task<()>>,
}

impl FilePreviewState {
Expand Down Expand Up @@ -142,6 +144,8 @@ impl FilePreviewState {
comment_draft: None,
active_comment: None,
typography_generation: 0,
copied_path: None,
copied_clear: None,
}
}

Expand Down Expand Up @@ -2299,6 +2303,34 @@ impl FilesSurface {
.into_any_element()
}

/// Copy the open file: the editor's text when it has one, so unsaved
/// edits come along, else the text as read.
fn copy_document_contents(&mut self, path: &str, cx: &mut Context<Self>) {
let Some(document) = self.preview.documents.get(path) else {
return;
};
let Some(read) = document.copyable_text() else {
return;
};
let text = match &document.editor {
Some(editor) => editor.read(cx).value().to_string(),
None => read.to_string(),
};
cx.write_to_clipboard(gpui::ClipboardItem::new_string(text));
self.preview.copied_path = Some(path.to_string());
self.preview.copied_clear = Some(cx.spawn(async move |this, cx| {
cx.background_executor()
.timer(Duration::from_millis(1200))
.await;
let _ = this.update(cx, |this, cx| {
this.preview.copied_path = None;
this.preview.copied_clear = None;
cx.notify();
});
}));
cx.notify();
}

pub(super) fn render_editor_header(
&mut self,
theme: &Theme,
Expand Down Expand Up @@ -2338,6 +2370,14 @@ impl FilesSurface {
.collect::<Vec<_>>();
let reveal_path = path.to_string();
let system_path = self.system_open_path(path);
let copyable = !showing_markdown
&& self
.preview
.documents
.get(path)
.is_some_and(|document| document.copyable_text().is_some());
let copied = self.preview.copied_path.as_deref() == Some(path);
let copy_path = path.to_string();
let tooltip_path: SharedString = path.to_string().into();
let can_save = !self.target_change_pending
&& self
Expand Down Expand Up @@ -2526,6 +2566,22 @@ impl FilesSurface {
.text_color(theme.text_muted),
),
)
.when(copyable, |element| {
element.child(
toolbar_button(
"files-copy-contents",
if copied { "Copied" } else { "Copy contents" },
)
.on_click(cx.listener(move |this, _, _, cx| {
this.copy_document_contents(&copy_path, cx)
}))
.child(
icon(if copied { icons::CHECK } else { icons::COPY })
.size(px(crate::surface_chrome::ICON_SIZE))
.text_color(theme.text_muted),
),
)
})
.when_some(system_path, |element, system_path| {
element.child(
toolbar_button("files-open-with-system", "Open in default editor")
Expand Down
2 changes: 2 additions & 0 deletions docs/godspeed/T3-GAPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ searched for under several names; PARTIAL means Godspeed has a smaller version.
| Sidebar | Auto-settle a thread when its PR merges; keep threads that have an open PR | `settingsSearch.ts` ("Auto-settle merged threads", "Keep threads with a PR"); `packages/contracts/src/settings.ts` (`sidebarAutoSettleOnMerge`) | PARTIAL: auto-settle after 1 day, 3 days or 1 week idle only (`crates/ui/src/settings/thread_lifecycle.rs`); no merged-PR trigger, no keep-PR rule | med |
| Sidebar | Compact idle threads before the prompt cache expires | `packages/contracts/src/settings.ts` (`idleCompaction`); `settingsSearch.ts` ("Compact idle threads") | MISSING (T3-WATCH lists it as queued) | med |
| Sidebar | Unsent-draft rows in the sidebar, with open and discard | `apps/web/src/components/sidebar/SidebarDraftBlock.tsx` | MISSING: drafts persist per chat but never appear as sidebar rows | low |
| Agents | Sign in to an agent's MCP server from its auth warning | `669d8941e2` | MISSING: check how MCP auth failures show in Godspeed | med |
| Sidebar | Copy a thread's branch name or relative path (Copy submenu) | `apps/web/src/components/Sidebar.tsx` ("Branch copied", "Path copied") | PARTIAL: Copy submenu has Path, Godspeed link, harness link, harness session ID (`shell.rs` `render_chat_copy_submenu`); no branch, no relative path | low |
| Composer | Suggested next prompt after a Claude or Codex turn (Labs) | `b24959d579` | MISSING | low |
| Composer | Send in background, or send and open a new thread | `packages/shared/src/keybindings.ts` (`composer.sendBackground`, `composer.sendAndNewThread`) | MISSING | low |
Expand Down Expand Up @@ -221,6 +222,7 @@ These T3 features were checked and Godspeed has them, so they are not rows above

| Feature | Godspeed PR |
|---|---|
| Copy a previewed file's whole contents from the Files header (unsaved edits included; hidden for truncated, binary and empty reads) | #115 |
| Regenerate a chat's title from its whole conversation (chat menu and command palette) | #106 |
| Markdown file previews hide a leading YAML frontmatter block (SKILL.md, agent files) instead of showing it as a rule and a heading; task toggles and line comments keep their offsets | #105 |
| Claude approval, question and MCP form cards close when Claude withdraws the request (a PermissionRequest hook answered it), and the request gets no stale answer | #101 |
Expand Down
14 changes: 13 additions & 1 deletion docs/godspeed/T3-WATCH.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A Godspeed always-on agent ("T3 watch") reviews new T3 Code commits and releases
(github.com/pingdotgg/t3code), decides which features are worth having in Godspeed, implements the
best one natively per run, and opens a pull request for review. It never merges.

Reviewed T3 through: pingdotgg/t3code@3e03072eb6 (2026-11-12)
Reviewed T3 through: pingdotgg/t3code@0dc32b5c8b (2026-11-21)

## Rules

Expand All @@ -23,6 +23,18 @@ Newest first. Status: `PR #n`, `queued` (worth doing, not yet built), `skipped (

| Date | T3 change | Status |
|---|---|---|
| 2026-11-21 | Copy a previewed file's contents from a header button (`07fe456146`) | PR #115 |
| 2026-11-21 | Sign in to an agent's MCP server from its auth warning (`669d8941e2`) | queued (check how Godspeed surfaces MCP auth failures) |
| 2026-11-21 | Claude's answer before a late-read steer stays visible (`0b02be3d5f`) | queued (with the 2026-11-12 Claude steer row) |
| 2026-11-21 | Tell threads when a provider runtime exit kills their background work (`87707319cf`) | queued (check Claude background-task rows on process exit) |
| 2026-11-21 | Explain checkout failures caused by local changes (`6f94a06384`) | queued (check the branch picker's checkout error text) |
| 2026-11-21 | Sidebar New starts the thread in the scoped project (`46ee2fc7ff`); numbered jumps include unsent drafts (`5093d11490`) | queued (check the sidebar New button with a filtered project) |
| 2026-11-21 | PR tools: create pushes an unpushed branch and keeps drafts as drafts; watch on a merged PR reports it; merge accepts a short SHA (`3e837d0bdb`, `f08272f965`, `b076d8c8bf`, `fe9baf8cbb`, `5e59fc677f`) | queued (with the agent PR/CI MCP tools item) |
| 2026-11-21 | Auto-settle waits while the thread's terminal runs a program (`6cbda0cd0a`) | skipped (Godspeed terminals aren't owned by a chat in the engine, and settling is days-scale idle in `chat_lifecycle.rs`) |
| 2026-11-21 | Option + a letter records the letter in the shortcut recorder (`e97e360cfc`) | skipped (GPUI's `Keystroke.key` is already the unmodified letter; the glyph is in `key_char`) |
| 2026-11-21 | A project covers several repositories (`60863edc41`); linked environments read each other's threads (`1cb3a8c753`, `d7f6b3efca`, `6f644f6e91`); environments map (`ccabed086a`) | skipped (large model change / T3 Connect relay, out of scope) |
| 2026-11-21 | Copy a chat table as HTML (`b9879ede83`); click the Tab hint to use the suggested prompt (`1d975f53ea`); thread chip hover cards (`bac0508e08`); browser Reload and Duplicate tab menu items (`a6e81f3002`, `e8b28328da`); Verilog/VHDL highlighting (`f8f4a0b057`); Apple Speech dictation (`285558eb10`); typed turn results (`2770bf3c61`) | skipped (minor or no Godspeed counterpart yet) |
| 2026-11-21 | ~200 minor fixes: Antigravity, mobile, SSH, Linear/GitLab/Azure, launch videos, evals, perf in T3's git/diff server, a11y, i18n, desktop update capsule | skipped (internal/minor) |
| 2026-11-12 | Regenerate a thread's title from the thread menu, now also from a bindable shortcut; the regenerate prompt reads the whole conversation and the previous title (`cfb7cae2b9`, `ThreadTitleRegenerationService`) | PR #106 |
| 2026-11-12 | Reply to an assistant response from its hover actions, quoting it into the composer (`c0f85e7f79`); a quote in a sent message shows as an inset card (`1a8ecc64b7`) | queued (we quote a text selection with Ask; no whole-response Reply, and sent quotes render as plain blockquotes) |
| 2026-11-12 | A steer that cuts off a streaming Claude reply marks it interrupted (`c7618f6c10`); final replies stay visible after steering (`836b86a5d6`); a model change sent with a Claude steer applies to the running turn (`5984bbb36e`) | queued (check `harness/src/claude` steer path) |
Expand Down
Loading