graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
gui: session "files changed" diffs panel + fixes
Pranav Pab24b4de75f3
diff --git a/gui/src-tauri/src/commands.rs b/gui/src-tauri/src/commands.rsindex 721cd5ba..b63bc36c 100644--- a/gui/src-tauri/src/commands.rs+++ b/gui/src-tauri/src/commands.rs@@ -623,6 +623,39 @@ pub(crate) async fn open_path_for_edit(path: String) -> Result<(), String> {crate::desktop_open::open_path_for_edit(std::path::Path::new(&path)).map_err(map_command_error)}+/// Reads a workspace file's current contents so the GUI can synthesize a diff+/// for operations the harness only reports as a byte-count summary (file+/// creates/overwrites). Confined to the workspace and capped in size; large or+/// out-of-tree paths return an error so the caller falls back to a placeholder.+#[tauri::command]+pub(crate) async fn read_workspace_file(+ workspace_path: String,+ path: String,+) -> Result<String, String> {+ const MAX_BYTES: u64 = 512 * 1024;+ let candidate = Path::new(&path);+ let resolved = if candidate.is_absolute() {+ candidate.to_path_buf()+ } else {+ Path::new(&workspace_path).join(candidate)+ };++ let canonical = std::fs::canonicalize(&resolved).map_err(|error| error.to_string())?;+ let workspace = Path::new(&workspace_path);+ let canonical_workspace =+ std::fs::canonicalize(workspace).unwrap_or_else(|_| workspace.to_path_buf());+ if !canonical.starts_with(&canonical_workspace) {+ return Err("path is outside the workspace".into());+ }++ let metadata = std::fs::metadata(&canonical).map_err(|error| error.to_string())?;+ if metadata.len() > MAX_BYTES {+ return Err("file too large".into());+ }++ std::fs::read_to_string(&canonical).map_err(|error| error.to_string())+}+#[tauri::command]pub(crate) async fn save_conversation_layout(input: SaveConversationLayoutInput,diff --git a/gui/src-tauri/src/lib.rs b/gui/src-tauri/src/lib.rsindex 225c086c..dc5598af 100644--- a/gui/src-tauri/src/lib.rs+++ b/gui/src-tauri/src/lib.rs@@ -33,7 +33,8 @@ use commands::{list_commands, list_mcp_servers, list_providers, login_mcp_server, logout_mcp_server,open_external_url, open_in_target, open_path_default, open_path_for_edit, open_path_in_target,open_workspace,- pick_directory, pick_workspace, push_git_branch, quick_start_project, reload_mcp_servers,+ pick_directory, pick_workspace, push_git_branch, quick_start_project, read_workspace_file,+ reload_mcp_servers,remove_mcp_server, remove_provider, rename_saved_workspace, rename_workspace, respond_followup,run_slash_command, save_conversation_layout, select_conversation, send_prompt,image_thumbnail, save_pasted_image, set_active_agent, set_effort, set_fast, start_new_chat, start_provider_auth, stop_prompt, terminal_close,@@ -149,6 +150,7 @@ pub fn run() {open_external_url,open_path_default,open_path_for_edit,+ read_workspace_file,save_conversation_layout,get_conversation_layout,create_saved_workspace,diff --git a/gui/src/components/ProjectSidebarConversationRow.tsx b/gui/src/components/ProjectSidebarConversationRow.tsxindex 3ddf9696..53571f32 100644--- a/gui/src/components/ProjectSidebarConversationRow.tsx+++ b/gui/src/components/ProjectSidebarConversationRow.tsx@@ -53,18 +53,22 @@ export function ProjectSidebarConversationRow({<span className="rounded-full bg-sidebar-accent px-1.5 py-0.5 font-medium text-sidebar-accent-foreground">Running</span>+ ) : updatedAt ? (+ <span className="whitespace-nowrap">{updatedAt}</span>) : null}- {updatedAt ? <span className="whitespace-nowrap">{updatedAt}</span> : null}</span></SidebarMenuSubButton>- <SidebarArchiveAction- ariaLabel={`Archive ${conversation.title}`}- className="right-0.5 group-hover/menu-sub-item:opacity-100 group-focus-within/menu-sub-item:opacity-100"- disabled={conversation.isRunning}- onClick={() =>- onArchiveConversation(workspacePath, conversation.conversationId)- }- />+ {/* Archiving a running conversation is disabled; omit the action entirely so+ its disabled state can't overlay the "Running" badge. */}+ {conversation.isRunning ? null : (+ <SidebarArchiveAction+ ariaLabel={`Archive ${conversation.title}`}+ className="right-0.5 group-hover/menu-sub-item:opacity-100 group-focus-within/menu-sub-item:opacity-100"+ onClick={() =>+ onArchiveConversation(workspacePath, conversation.conversationId)+ }+ />+ )}</SidebarMenuSubItem>);}diff --git a/gui/src/components/chat/activity-results/FileDiffResult.tsx b/gui/src/components/chat/activity-results/FileDiffResult.tsxindex 7e44c1c3..427f787f 100644--- a/gui/src/components/chat/activity-results/FileDiffResult.tsx+++ b/gui/src/components/chat/activity-results/FileDiffResult.tsx@@ -8,22 +8,59 @@ import {appTargets,} from "@/components/conversation-panel/constants/conversationHeader";import { usePreferredOpenTarget } from "@/components/conversation-panel/hooks/usePreferredOpenTarget";+import { LoadingSpinner } from "@/components/ui/LoadingSpinner";import { useWorkspaceMeta } from "@/hooks/useSession";-import {- ActivityResultCard,- ActivityResultPreformattedBody,-} from "./ActivityResultCard";+import { ActivityResultCard } from "./ActivityResultCard";import type { FileDiffResultProps } from "../types/chatComponents";+import { useRenderableFileDiff } from "./hooks/useRenderableFileDiff";import {getFileDiffDisplayName,getFileDiffDisplayPath,- getFileDiffPatchStats,} from "./utils/fileDiff";+import {+ formatFileChangeLabel,+ type FileChangePlaceholder,+} from "./utils/fileChangeLabel";++function FileDiffLoadingBody() {+ return (+ <div className="flex min-h-24 items-center justify-center gap-2 px-3 py-6 text-xs/relaxed text-muted-foreground">+ <LoadingSpinner className="size-4" />+ <span>Loading diff…</span>+ </div>+ );+}++function FileDiffPlaceholderBody({+ placeholder,+}: {+ placeholder: FileChangePlaceholder;+}) {+ const { title, detail } = formatFileChangeLabel(+ placeholder.operation,+ placeholder.byteCount,+ );+ return (+ <div className="flex items-center gap-1.5 px-3 py-2.5 text-xs text-muted-foreground">+ <span className="font-medium text-foreground/80">{title}</span>+ {detail != null ? (+ <>+ <span className="text-muted-foreground/40">·</span>+ <span className="font-mono text-[11px]">{detail}</span>+ </>+ ) : null}+ </div>+ );+}export function FileDiffResult({ result, workspacePath }: FileDiffResultProps) {const workspaceMeta = useWorkspaceMeta(workspacePath);- const isGitPatch = result.patch.startsWith("diff --git ");- const patchStats = getFileDiffPatchStats(result.patch);+ const rendered = useRenderableFileDiff({+ workspacePath,+ path: result.path,+ patch: result.patch,+ operation: result.operation,+ });const displayName = getFileDiffDisplayName(result.path);const displayPath = getFileDiffDisplayPath(result.path, workspacePath);const availableOpenTargets =@@ -49,6 +86,10 @@ export function FileDiffResult({ result, workspacePath }: FileDiffResultProps) {);}, [availableEditorTargets.length, resolvedPreferredAppId, result.path, workspacePath]);+ const stats = rendered.status === "diff"+ ? { additions: rendered.additions, deletions: rendered.deletions }+ : null;+const footer = {leading: (<code className="font-mono text-xs text-muted-foreground">@@ -56,14 +97,10 @@ export function FileDiffResult({ result, workspacePath }: FileDiffResultProps) {</code>),trailing:- patchStats == null ? null : (- <span className="inline-flex items-center gap-2 font-mono text-xs">- <span className="text-success">- +{patchStats.additions}- </span>- <span className="text-destructive">- -{patchStats.deletions}- </span>+ stats == null ? null : (+ <span className="inline-flex items-center gap-2 font-mono text-xs tabular-nums">+ <span className="text-success">+{stats.additions}</span>+ <span className="text-destructive">-{stats.deletions}</span></span>),};@@ -88,17 +125,18 @@ export function FileDiffResult({ result, workspacePath }: FileDiffResultProps) {copyText={result.copyText}footer={footer}>- {isGitPatch ? (- <PatchDiff- patch={result.patch}- className="block max-w-full overflow-hidden text-xs/relaxed"- options={{- lineDiffType: "word",- showFileHeader: false,- }}- />+ {rendered.status === "diff" ? (+ <div className="px-1 py-1.5">+ <PatchDiff+ patch={rendered.patch}+ className="block max-w-full overflow-hidden text-xs/relaxed"+ options={{ lineDiffType: "word", showFileHeader: false }}+ />+ </div>+ ) : rendered.status === "loading" ? (+ <FileDiffLoadingBody />) : (- <ActivityResultPreformattedBody text={result.patch} />+ <FileDiffPlaceholderBody placeholder={rendered} />)}</ActivityResultCard>);diff --git a/gui/src/components/chat/activity-results/hooks/useRenderableFileDiff.ts b/gui/src/components/chat/activity-results/hooks/useRenderableFileDiff.tsnew file mode 100644index 00000000..a3b30b60--- /dev/null+++ b/gui/src/components/chat/activity-results/hooks/useRenderableFileDiff.ts@@ -0,0 +1,59 @@+import { useEffect, useState } from "react";++import type { FileOperation } from "@/services/desktop/types/contracts";++import {+ resolveRenderableFileDiff,+ resolveSyncFileDiff,+ type ResolvedFileDiff,+} from "../utils/renderableFileDiff";++export interface UseRenderableFileDiffInput {+ workspacePath: string | null;+ path: string;+ patch: string;+ operation?: FileOperation | null;+}++export type RenderableFileDiffState = ResolvedFileDiff | { status: "loading" };++/**+ * Resolves a single file change to a renderable diff for the transcript card.+ * Edits render immediately (no flash, no disk read); create/overwrite read the+ * file from disk and synthesize an all-additions diff; removals fall back to a+ * placeholder.+ */+export function useRenderableFileDiff({+ workspacePath,+ path,+ patch,+ operation,+}: UseRenderableFileDiffInput): RenderableFileDiffState {+ const syncDiff = resolveSyncFileDiff(path, patch);+ const hasSyncDiff = syncDiff != null;++ const [asyncState, setAsyncState] = useState<RenderableFileDiffState>({+ status: "loading",+ });++ useEffect(() => {+ if (hasSyncDiff) {+ return;+ }++ let cancelled = false;+ void resolveRenderableFileDiff({ workspacePath, path, patch, operation }).then(+ (resolved) => {+ if (!cancelled) {+ setAsyncState(resolved);+ }+ },+ );++ return () => {+ cancelled = true;+ };+ }, [workspacePath, path, patch, operation, hasSyncDiff]);++ return syncDiff ?? asyncState;+}diff --git a/gui/src/components/chat/activity-results/types/activityResult.ts b/gui/src/components/chat/activity-results/types/activityResult.tsindex 9b614333..f0431be5 100644--- a/gui/src/components/chat/activity-results/types/activityResult.ts+++ b/gui/src/components/chat/activity-results/types/activityResult.ts@@ -1,5 +1,7 @@import type { ReactNode } from "react";+import type { FileOperation } from "@/services/desktop/types/contracts";+export interface ActivityResultFooter {leading: ReactNode;trailing: ReactNode;@@ -21,6 +23,7 @@ export type ActivityResultModel =copyText: string;path: string;patch: string;+ operation?: FileOperation;}| (ActivityResultBase & {kind: "text";diff --git a/gui/src/components/chat/activity-results/utils/fileChangeLabel.ts b/gui/src/components/chat/activity-results/utils/fileChangeLabel.tsnew file mode 100644index 00000000..624e93b0--- /dev/null+++ b/gui/src/components/chat/activity-results/utils/fileChangeLabel.ts@@ -0,0 +1,51 @@+import type { FileOperation } from "@/services/desktop/types/contracts";++export interface FileChangePlaceholder {+ operation: FileOperation | null;+ byteCount: number | null;+}++export function formatBytes(bytes: number): string {+ if (bytes < 1024) {+ return `${bytes} B`;+ }+ if (bytes < 1024 * 1024) {+ return `${(bytes / 1024).toFixed(bytes < 10 * 1024 ? 1 : 0)} KB`;+ }+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;+}++const OPERATION_TITLE: Record<FileOperation, string> = {+ create: "New file",+ overwrite: "File overwritten",+ replace: "File updated",+ remove: "File removed",+ undo: "Change undone",+};++/** Title + optional detail line for a file change with no renderable diff. */+export function formatFileChangeLabel(+ operation: FileOperation | null,+ byteCount: number | null,+): { title: string; detail: string | null } {+ const title = operation != null ? OPERATION_TITLE[operation] : "No inline diff";+ const detail = byteCount != null ? formatBytes(byteCount) : null;+ return { title, detail };+}++/** Short badge text for a file-change row. */+export function fileChangeBadge(+ operation: FileOperation | null,+ editCount: number,+): string | null {+ if (operation === "create") {+ return "added";+ }+ if (operation === "remove") {+ return "removed";+ }+ if (editCount > 1) {+ return `${editCount} edits`;+ }+ return null;+}diff --git a/gui/src/components/chat/activity-results/utils/fileDiff.test.ts b/gui/src/components/chat/activity-results/utils/fileDiff.test.tsindex ee2e9927..23dd66bc 100644--- a/gui/src/components/chat/activity-results/utils/fileDiff.test.ts+++ b/gui/src/components/chat/activity-results/utils/fileDiff.test.ts@@ -22,6 +22,53 @@ describe("fileDiff", () => {expect(getFileDiffPatchStats(patch)).toEqual({ additions: 1, deletions: 1 });});+ test("keeps surrounding edits when an excerpt contains an unparseable gap line", () => {+ // The harness inserts gap/ellipsis markers between non-contiguous regions; one+ // such line must not hide every real edit (regression: greet.ts rendered "File+ // updated" instead of its changes).+ const patch = buildRenderableFileDiffPatch(+ "src/example.ts",+ [+ "1 1 | const before = true;",+ " ...",+ "5 |-removed();",+ " 5 |+added();",+ ].join("\n"),+ );++ expect(patch).toContain("diff --git a/src/example.ts b/src/example.ts");+ expect(patch).toContain(" const before = true;");+ expect(patch).toContain("-removed();");+ expect(patch).toContain("+added();");+ });++ test("splits non-contiguous edit regions into separate hunks", () => {+ const patch = buildRenderableFileDiffPatch(+ "src/example.ts",+ [+ "1 1 | first();",+ "2 |-old();",+ " 2 |+new();",+ "10 10 | tenth();",+ "11 |-gone();",+ ].join("\n"),+ );++ const hunkHeaders = patch+ .split("\n")+ .filter((line) => line.startsWith("@@"));+ expect(hunkHeaders).toHaveLength(2);+ // Each hunk starts at its own region's line numbers, not a single renumbered run.+ expect(hunkHeaders[0]).toContain("-1,");+ expect(hunkHeaders[1]).toContain("-10,");+ });++ test("leaves a byte-summary untouched so it routes to the placeholder path", () => {+ const summary = "wrote 42 bytes to config.json";+ expect(buildRenderableFileDiffPatch("config.json", summary)).toBe(summary);+ expect(getFileDiffPatchStats(summary)).toBeNull();+ });+test("keeps existing unified patches unchanged", () => {const patch = ["diff --git a/src/example.ts b/src/example.ts",diff --git a/gui/src/components/chat/activity-results/utils/fileDiff.ts b/gui/src/components/chat/activity-results/utils/fileDiff.tsindex 336dd812..aa7e1a56 100644--- a/gui/src/components/chat/activity-results/utils/fileDiff.ts+++ b/gui/src/components/chat/activity-results/utils/fileDiff.ts@@ -26,16 +26,6 @@ export function getFileDiffDisplayPath(return normalizedPath;}-function parseOptionalLineNumber(value: string): number | null {- const trimmedValue = value.trim();- if (trimmedValue.length === 0) {- return null;- }-- const lineNumber = Number.parseInt(trimmedValue, 10);- return Number.isFinite(lineNumber) ? lineNumber : null;-}-function parseExcerptDiffLine(line: string): ParsedExcerptDiffLine | null {const separatorIndex = line.indexOf("|");if (separatorIndex < 0) {@@ -43,14 +33,16 @@ function parseExcerptDiffLine(line: string): ParsedExcerptDiffLine | null {}const gutter = line.slice(0, separatorIndex);- const contentWithMarker = line.slice(separatorIndex + 1);- const gutterMatch = gutter.match(/^\s*(\d*)\s*(\d*)\s*$/);- if (gutterMatch == null) {+ // The gutter holds only the before/after line-number columns. Anything else+ // (ellipsis gap markers, stray prose) is not an excerpt line.+ if (!/^[\d\s]*$/.test(gutter)) {return null;}- const beforeLineNumber = parseOptionalLineNumber(gutterMatch[1] ?? "");- const afterLineNumber = parseOptionalLineNumber(gutterMatch[2] ?? "");+ const numbers = (gutter.match(/\d+/g) ?? []).map((value) =>+ Number.parseInt(value, 10),+ );+ const contentWithMarker = line.slice(separatorIndex + 1);const marker = contentWithMarker[0];const kind =marker === "+"@@ -60,6 +52,20 @@ function parseExcerptDiffLine(line: string): ParsedExcerptDiffLine | null {: "context";const text = kind === "context" ? contentWithMarker : contentWithMarker.slice(1);+ // Assign the gutter number(s) by kind — a single column is ambiguous after+ // whitespace collapses, but an addition only carries an "after" number, a+ // deletion only a "before", and context carries both.+ let beforeLineNumber: number | null = null;+ let afterLineNumber: number | null = null;+ if (kind === "addition") {+ afterLineNumber = numbers.at(-1) ?? null;+ } else if (kind === "deletion") {+ beforeLineNumber = numbers[0] ?? null;+ } else {+ beforeLineNumber = numbers[0] ?? null;+ afterLineNumber = numbers[1] ?? numbers[0] ?? null;+ }+if (beforeLineNumber == null &&afterLineNumber == null &&@@ -77,17 +83,85 @@ function parseExcerptDiffLine(line: string): ParsedExcerptDiffLine | null {}function parseExcerptDiffLines(patch: string): ParsedExcerptDiffLine[] | null {+ // Drop lines we don't recognize (gap/ellipsis markers, blank separators between+ // non-contiguous edit regions) instead of discarding the whole excerpt — a single+ // unparseable line must not hide every real edit. Require at least one recognizable+ // line so a pure byte-summary ("wrote N bytes …") still routes to the disk/placeholder+ // path rather than being mistaken for a diff.const parsedLines = patch.split("\n")- .map((line) => parseExcerptDiffLine(line));+ .map((line) => parseExcerptDiffLine(line))+ .filter((line): line is ParsedExcerptDiffLine => line != null);- if (parsedLines.length === 0 || parsedLines.some((line) => line == null)) {- return null;+ return parsedLines.length === 0 ? null : parsedLines;+}++/**+ * Split parsed excerpt lines into contiguous hunks. The harness can report several+ * disjoint edit regions in one excerpt; emitting them as a single hunk would renumber+ * the gutters wrong across the gaps, so we start a new hunk whenever the next line's+ * explicit before/after line number breaks the running sequence.+ */+function groupExcerptHunks(+ lines: ParsedExcerptDiffLine[],+): ParsedExcerptDiffLine[][] {+ const hunks: ParsedExcerptDiffLine[][] = [];+ let current: ParsedExcerptDiffLine[] | null = null;+ let expectedBefore: number | null = null;+ let expectedAfter: number | null = null;++ for (const line of lines) {+ const breaks =+ current != null &&+ ((line.beforeLineNumber != null &&+ expectedBefore != null &&+ line.beforeLineNumber !== expectedBefore) ||+ (line.afterLineNumber != null &&+ expectedAfter != null &&+ line.afterLineNumber !== expectedAfter));++ if (current == null || breaks) {+ current = [];+ hunks.push(current);+ expectedBefore = null;+ expectedAfter = null;+ }++ current.push(line);++ // A line consumes a "before" slot unless it's an addition, and an "after" slot+ // unless it's a deletion; advance the side(s) it occupies.+ if (line.kind !== "addition") {+ expectedBefore = (line.beforeLineNumber ?? expectedBefore ?? 0) + 1;+ }+ if (line.kind !== "deletion") {+ expectedAfter = (line.afterLineNumber ?? expectedAfter ?? 0) + 1;+ }}- return parsedLines.filter(- (line): line is ParsedExcerptDiffLine => line != null,- );+ return hunks;+}++function buildExcerptHunk(lines: ParsedExcerptDiffLine[]): string {+ const beforeCount = lines.filter((line) => line.kind !== "addition").length;+ const afterCount = lines.filter((line) => line.kind !== "deletion").length;+ const beforeStart = findHunkStart(lines, "beforeLineNumber", beforeCount);+ const afterStart = findHunkStart(lines, "afterLineNumber", afterCount);+ const body = lines.map((line) => {+ switch (line.kind) {+ case "context":+ return ` ${line.text}`;+ case "addition":+ return `+${line.text}`;+ case "deletion":+ return `-${line.text}`;+ }+ });++ return [+ `@@ -${beforeStart},${beforeCount} +${afterStart},${afterCount} @@`,+ ...body,+ ].join("\n");}function findHunkStart(@@ -114,36 +188,24 @@ function buildSyntheticGitPatch(lines: ParsedExcerptDiffLine[],): string {const normalizedPath = path.replace(/\\/g, "/");- const beforeLines = lines.filter((line) => line.kind !== "addition");- const afterLines = lines.filter((line) => line.kind !== "deletion");- const beforeCount = beforeLines.length;- const afterCount = afterLines.length;- const beforeStart = findHunkStart(lines, "beforeLineNumber", beforeCount);- const afterStart = findHunkStart(lines, "afterLineNumber", afterCount);- const patchLines = lines.map((line) => {- switch (line.kind) {- case "context":- return ` ${line.text}`;- case "addition":- return `+${line.text}`;- case "deletion":- return `-${line.text}`;- }- });+ // new/deleted-file markers depend on the whole excerpt, not a single hunk.+ const totalBefore = lines.filter((line) => line.kind !== "addition").length;+ const totalAfter = lines.filter((line) => line.kind !== "deletion").length;const headerLines = [`diff --git a/${normalizedPath} b/${normalizedPath}`,- ...(beforeCount === 0+ ...(totalBefore === 0? ["new file mode 100644"]- : afterCount === 0+ : totalAfter === 0? ["deleted file mode 100644"]: []),- `--- ${beforeCount === 0 ? "/dev/null" : `a/${normalizedPath}`}`,- `+++ ${afterCount === 0 ? "/dev/null" : `b/${normalizedPath}`}`,- `@@ -${beforeStart},${beforeCount} +${afterStart},${afterCount} @@`,+ `--- ${totalBefore === 0 ? "/dev/null" : `a/${normalizedPath}`}`,+ `+++ ${totalAfter === 0 ? "/dev/null" : `b/${normalizedPath}`}`,];- return [...headerLines, ...patchLines].join("\n");+ const hunks = groupExcerptHunks(lines).map(buildExcerptHunk);++ return [...headerLines, ...hunks].join("\n");}export function buildRenderableFileDiffPatch(path: string, patch: string): string {@@ -160,6 +222,31 @@ export function buildRenderableFileDiffPatch(path: string, patch: string): strinreturn buildSyntheticGitPatch(path, parsedExcerptDiffLines);}+/**+ * Builds an all-additions git patch from a file's full contents. Used to render+ * a real diff for create/overwrite operations, which the harness only reports as+ * a "wrote N bytes" summary (no line-level diff). The whole file shows as added.+ */+export function buildAdditionPatchFromContent(path: string, content: string): string {+ const normalizedPath = path.replace(/\\/g, "/");+ const rawLines = content.split("\n");+ // A trailing newline yields a final empty element; drop it so we don't render+ // a phantom blank addition.+ if (rawLines.length > 0 && rawLines[rawLines.length - 1] === "") {+ rawLines.pop();+ }+ const count = rawLines.length;+ const headerLines = [+ `diff --git a/${normalizedPath} b/${normalizedPath}`,+ "new file mode 100644",+ "--- /dev/null",+ `+++ b/${normalizedPath}`,+ `@@ -0,0 +1,${count} @@`,+ ];+ const body = rawLines.map((line) => `+${line}`);+ return [...headerLines, ...body].join("\n");+}+export function getFileDiffPatchStats(patch: string,): { additions: number; deletions: number } | null {diff --git a/gui/src/components/chat/activity-results/utils/renderableFileDiff.ts b/gui/src/components/chat/activity-results/utils/renderableFileDiff.tsnew file mode 100644index 00000000..fccc306e--- /dev/null+++ b/gui/src/components/chat/activity-results/utils/renderableFileDiff.ts@@ -0,0 +1,76 @@+import { getPatchStats } from "@codegraff/diffs";++import { readWorkspaceFile } from "@/services/desktop/client";+import type { FileOperation } from "@/services/desktop/types/contracts";++import { buildAdditionPatchFromContent, buildRenderableFileDiffPatch } from "./fileDiff";++export interface RenderableFileDiffInput {+ workspacePath: string | null;+ path: string;+ patch: string;+ operation?: FileOperation | null;+}++export type ResolvedFileDiff =+ | { status: "diff"; patch: string; additions: number; deletions: number }+ | { status: "placeholder"; operation: FileOperation | null; byteCount: number | null };++const WRITE_OPERATIONS: ReadonlySet<FileOperation> = new Set<FileOperation>([+ "create",+ "overwrite",+]);++/** Extract the byte count from a harness "wrote N bytes to <path>" summary. */+export function parseByteCount(summary: string): number | null {+ const match = summary.match(/(\d[\d,]*)\s*bytes?/i);+ if (match == null) {+ return null;+ }+ const value = Number.parseInt(match[1]!.replace(/,/g, ""), 10);+ return Number.isFinite(value) ? value : null;+}++/** Synchronous fast-path: a real git/excerpt diff (edits) needs no disk read. */+export function resolveSyncFileDiff(path: string, patch: string): ResolvedFileDiff | null {+ const normalized = buildRenderableFileDiffPatch(path, patch);+ if (!normalized.startsWith("diff --git ")) {+ return null;+ }+ const stats = getPatchStats(normalized) ?? { additions: 0, deletions: 0 };+ return { status: "diff", patch: normalized, ...stats };+}++/**+ * Resolves a file change to a renderable diff. Edits (already git/excerpt) resolve+ * synchronously; create/overwrite — reported only as a byte summary — read the file+ * from disk and synthesize an all-additions diff. Removals / read failures yield a+ * placeholder.+ */+export async function resolveRenderableFileDiff(+ input: RenderableFileDiffInput,+): Promise<ResolvedFileDiff> {+ const { workspacePath, path, patch, operation } = input;++ const syncDiff = resolveSyncFileDiff(path, patch);+ if (syncDiff != null) {+ return syncDiff;+ }++ if (workspacePath != null && operation != null && WRITE_OPERATIONS.has(operation)) {+ try {+ const content = await readWorkspaceFile(workspacePath, path);+ const synthesized = buildAdditionPatchFromContent(path, content);+ const stats = getPatchStats(synthesized) ?? { additions: 0, deletions: 0 };+ return { status: "diff", patch: synthesized, ...stats };+ } catch {+ // Fall through to a placeholder when the file can't be read (too large, gone, etc.).+ }+ }++ return {+ status: "placeholder",+ operation: operation ?? null,+ byteCount: parseByteCount(patch),+ };+}diff --git a/gui/src/components/chat/utils/getActivityResultModel.ts b/gui/src/components/chat/utils/getActivityResultModel.tsindex f54036b0..1526521b 100644--- a/gui/src/components/chat/utils/getActivityResultModel.ts+++ b/gui/src/components/chat/utils/getActivityResultModel.ts@@ -96,6 +96,7 @@ export function getActivityResultModel(path: operation.detail.path,patch,copyText: patch,+ operation: operation.detail.operation,}: null;}diff --git a/gui/src/components/workspace-board/ChangesPane.tsx b/gui/src/components/workspace-board/ChangesPane.tsxindex 5da6067d..b4b59246 100644--- a/gui/src/components/workspace-board/ChangesPane.tsx+++ b/gui/src/components/workspace-board/ChangesPane.tsx@@ -1,7 +1,8 @@-import { useMemo } from "react";+import { useEffect, useMemo, useState } from "react";import type { IDockviewPanelProps } from "dockview-react";+import { ChevronRight, FileText } from "lucide-react";-import { FilesChanged, type FilesChangedItem } from "@codegraff/diffs/react";+import { PatchDiff } from "@codegraff/diffs/react";import { openWorkspacePathInTarget } from "@/app/sessionClientActions";import {@@ -13,26 +14,132 @@ import {getFileDiffDisplayName,getFileDiffDisplayPath,} from "@/components/chat/activity-results/utils/fileDiff";+import {+ fileChangeBadge,+ formatFileChangeLabel,+} from "@/components/chat/activity-results/utils/fileChangeLabel";+import {+ resolveRenderableFileDiff,+ type ResolvedFileDiff,+} from "@/components/chat/activity-results/utils/renderableFileDiff";+import { cn } from "@/utils/cn";import { PaneSurface } from "@/components/ui/PaneSurface";import { useConversationView, useWorkspaceMeta } from "@/hooks/useSession";import type { PlaceholderPaneParams } from "./types/layout";-import { deriveSessionFileChanges } from "./utils/sessionFileChanges";+import {+ deriveSessionFileChanges,+ type SessionFileChange,+} from "./utils/sessionFileChanges";-function operationBadge(change: {- operation: string | null;- editCount: number;-}): string | undefined {- if (change.operation === "create") {- return "added";- }- if (change.operation === "remove") {- return "removed";- }- if (change.editCount > 1) {- return `${change.editCount} edits`;- }- return undefined;+function PlaceholderBody({+ operation,+ byteCount,+}: {+ operation: SessionFileChange["operation"];+ byteCount: number | null;+}) {+ const { title, detail } = formatFileChangeLabel(operation, byteCount);+ return (+ <div className="flex items-center gap-1.5 px-2 py-1.5 text-xs text-muted-foreground">+ <span className="font-medium text-foreground/80">{title}</span>+ {detail != null ? (+ <>+ <span className="text-muted-foreground/40">·</span>+ <span className="font-mono text-[11px]">{detail}</span>+ </>+ ) : null}+ </div>+ );+}++interface ChangeRowProps {+ change: SessionFileChange;+ resolved: ResolvedFileDiff | null;+ workspacePath: string;+ canOpenInEditor: boolean;+ onOpenInEditor: (path: string) => void;+}++function ChangeRow({+ change,+ resolved,+ workspacePath,+ canOpenInEditor,+ onOpenInEditor,+}: ChangeRowProps) {+ const [open, setOpen] = useState(false);+ const displayName = getFileDiffDisplayName(change.path);+ const displayPath = getFileDiffDisplayPath(change.path, workspacePath);+ const badge = fileChangeBadge(change.operation, change.editCount);+ const stats = resolved?.status === "diff" ? resolved : null;++ return (+ <div className="overflow-hidden rounded-xl border border-border bg-card shadow-[var(--elevation-xs)] ring-1 ring-foreground/[0.04] transition-shadow hover:shadow-[var(--elevation-sm)]">+ <div className="flex items-center gap-2 pr-2">+ <button+ type="button"+ aria-expanded={open}+ onClick={() => setOpen((value) => !value)}+ className="flex min-w-0 flex-1 items-center gap-2 px-3 py-2.5 text-left"+ >+ <ChevronRight+ strokeWidth={2}+ className={cn(+ "size-3.5 shrink-0 text-muted-foreground transition-transform",+ open && "rotate-90",+ )}+ />+ <span className="truncate font-mono text-xs font-medium text-foreground">+ {displayName}+ </span>+ {badge != null ? (+ <span className="shrink-0 rounded-full border border-border px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider text-muted-foreground">+ {badge}+ </span>+ ) : null}+ <span className="ml-auto shrink-0 font-mono text-xs tabular-nums">+ {stats != null ? (+ <span className="inline-flex items-center gap-2">+ <span className="text-success">+{stats.additions}</span>+ <span className="text-destructive">-{stats.deletions}</span>+ </span>+ ) : (+ <span className="text-muted-foreground/60">·</span>+ )}+ </span>+ </button>+ {canOpenInEditor ? (+ <button+ type="button"+ title="Open in editor"+ onClick={() => onOpenInEditor(change.path)}+ className="shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"+ >+ <FileText className="size-3.5" />+ </button>+ ) : null}+ </div>+ {open ? (+ <div className="border-t border-border px-2 py-2">+ {resolved == null ? (+ <div className="px-2 py-3 text-xs text-muted-foreground">Loading diff…</div>+ ) : resolved.status === "diff" ? (+ <PatchDiff+ patch={resolved.patch}+ className="block max-w-full overflow-hidden text-xs/relaxed"+ options={{ lineDiffType: "word", showFileHeader: false }}+ />+ ) : (+ <PlaceholderBody operation={resolved.operation} byteCount={resolved.byteCount} />+ )}+ <div className="px-2 pt-2">+ <code className="font-mono text-[11px] text-muted-foreground">{displayPath}</code>+ </div>+ </div>+ ) : null}+ </div>+ );}export function ChangesPane({@@ -64,65 +171,84 @@ export function ChangesPane({[view?.messages],);- const totals = useMemo(- () =>- changes.reduce(- (acc, change) => ({- additions: acc.additions + change.additions,- deletions: acc.deletions + change.deletions,- }),- { additions: 0, deletions: 0 },- ),- [changes],- );+ // Resolve each change to a renderable diff (reads file contents from disk for+ // create/overwrite, which the harness reports only as a byte summary).+ const [resolvedByPath, setResolvedByPath] = useState<+ Record<string, ResolvedFileDiff>+ >({});+ useEffect(() => {+ let cancelled = false;+ void Promise.all(+ changes.map(async (change) => {+ const result = await resolveRenderableFileDiff({+ workspacePath: params.workspacePath,+ path: change.path,+ patch: change.patch,+ operation: change.operation,+ });+ return [change.path, result] as const;+ }),+ ).then((entries) => {+ if (!cancelled) {+ setResolvedByPath(Object.fromEntries(entries));+ }+ });+ return () => {+ cancelled = true;+ };+ }, [changes, params.workspacePath]);++ const totals = useMemo(() => {+ let additions = 0;+ let deletions = 0;+ for (const change of changes) {+ const resolved = resolvedByPath[change.path];+ if (resolved?.status === "diff") {+ additions += resolved.additions;+ deletions += resolved.deletions;+ }+ }+ return { additions, deletions };+ }, [changes, resolvedByPath]);- const items: FilesChangedItem[] = changes.map((change) => ({- key: change.path,- path: getFileDiffDisplayPath(change.path, params.workspacePath),- patch: change.patch,- additions: change.additions,- deletions: change.deletions,- badge: operationBadge(change),- headerExtra: canOpenInEditor ? (- <button- type="button"- className="cursor-pointer font-mono text-xs text-muted-foreground underline decoration-transparent underline-offset-2 transition hover:text-foreground hover:decoration-current"- onClick={() => {- void openWorkspacePathInTarget(- params.workspacePath,- resolvedPreferredAppId,- change.path,- );- }}- >- {getFileDiffDisplayName(change.path)}- </button>- ) : undefined,- }));+ const handleOpenInEditor = (path: string) => {+ void openWorkspacePathInTarget(params.workspacePath, resolvedPreferredAppId, path);+ };return (- <PaneSurface className="overflow-auto p-3">- <div className="mb-3 flex items-center gap-3 text-xs">+ <PaneSurface className="overflow-auto">+ <div className="sticky top-0 z-10 flex items-center gap-3 border-b border-border bg-background/70 px-4 py-3 text-xs backdrop-blur-md"><span className="font-medium text-foreground">{changes.length === 0? "No files changed": `${changes.length} file${changes.length === 1 ? "" : "s"} changed`}</span>{changes.length > 0 ? (- <span className="inline-flex items-center gap-2 font-mono">+ <span className="inline-flex items-center gap-2 font-mono tabular-nums"><span className="text-success">+{totals.additions}</span><span className="text-destructive">-{totals.deletions}</span></span>) : null}</div>- <FilesChanged- files={items}- emptyState={- <div className="px-1 py-6 text-center text-xs text-muted-foreground">- File edits made during this conversation will appear here.- </div>- }- />++ {changes.length === 0 ? (+ <div className="px-4 py-10 text-center text-xs text-muted-foreground">+ File edits made during this conversation will appear here.+ </div>+ ) : (+ <div className="flex flex-col gap-2 p-3">+ {changes.map((change) => (+ <ChangeRow+ key={change.path}+ change={change}+ resolved={resolvedByPath[change.path] ?? null}+ workspacePath={params.workspacePath}+ canOpenInEditor={canOpenInEditor}+ onOpenInEditor={handleOpenInEditor}+ />+ ))}+ </div>+ )}</PaneSurface>);}diff --git a/gui/src/components/workspace-board/ChatTile.tsx b/gui/src/components/workspace-board/ChatTile.tsxindex f9988a8c..3ecd8039 100644--- a/gui/src/components/workspace-board/ChatTile.tsx+++ b/gui/src/components/workspace-board/ChatTile.tsx@@ -148,7 +148,10 @@ export function ChatTile({const panelParams = activePanel?.params as Partial<PlaceholderPaneParams> | undefined;const kind = panelParams?.kind;- if (activePanel == null || (kind !== "preview" && kind !== "terminal")) {+ if (+ activePanel == null ||+ (kind !== "preview" && kind !== "terminal" && kind !== "changes")+ ) {return null;}@@ -156,13 +159,13 @@ export function ChatTile({activePanel.api.close();};- if (kind === "preview") {+ if (kind === "preview" || kind === "changes") {return (<div className={headerActionsClassName}><Buttonvariant="outline"size="icon-sm"- aria-label="Close preview"+ aria-label={kind === "changes" ? "Close changes" : "Close preview"}onClick={handleClose}><XIcon />diff --git a/gui/src/components/workspace-board/utils/sessionFileChanges.ts b/gui/src/components/workspace-board/utils/sessionFileChanges.tsindex de977187..52c9e8d0 100644--- a/gui/src/components/workspace-board/utils/sessionFileChanges.ts+++ b/gui/src/components/workspace-board/utils/sessionFileChanges.ts@@ -1,93 +1,69 @@-import { getPatchStats } from "@codegraff/diffs";-+import { buildChatThreadItems } from "@/components/chat/utils/chatThread";+import { getActivityResultModel } from "@/components/chat/utils/getActivityResultModel";import type {FileOperation,TranscriptMessage,} from "@/services/desktop/types/contracts";-import { buildRenderableFileDiffPatch } from "@/components/chat/activity-results/utils/fileDiff";export interface SessionFileChange {/** Path as reported by the harness (absolute or workspace-relative). */path: string;- /** Latest git-style patch for the file, normalized for rendering. */+ /** Latest raw renderable patch for the file (git diff, excerpt, or byte summary). */patch: string;- /** Lines added/removed summed across every edit to this file in the session. */- additions: number;- deletions: number;- /** Number of edits observed for this file. */- editCount: number;/** Most recent file operation, when known. */operation: FileOperation | null;-}--interface MutableChange extends SessionFileChange {- order: number;+ /** Number of edits observed for this file in the session. */+ editCount: number;}/**- * Derive the set of files changed during a conversation from its messages.- * Aggregates `file_diff` tool results (and `file_update` tool starts for the- * operation label) into one row per file. Combining multiple edits into a single- * net patch is out of scope — `patch` holds the most recent edit and `editCount`- * reflects how many edits were seen.+ * Derive the files changed during a conversation from its messages.+ *+ * Uses the same aggregation the transcript uses — `buildChatThreadItems`+ * assembles `file_update` tool starts with their result text/summary, and+ * `getActivityResultModel` turns each into a `file_diff` model. (The raw message+ * stream never carries a `file_diff` detail; it's synthesized here.) One row per+ * file, keeping the most recent patch/operation and an edit count.*/export function deriveSessionFileChanges(messages: readonly TranscriptMessage[],): SessionFileChange[] {- const byPath = new Map<string, MutableChange>();+ const items = buildChatThreadItems([...messages], []);+ const byPath = new Map<string, { order: number; change: SessionFileChange }>();let order = 0;- const ensure = (path: string): MutableChange => {- let entry = byPath.get(path);- if (entry == null) {- entry = {- path,- patch: "",- additions: 0,- deletions: 0,- editCount: 0,- operation: null,- order: order += 1,- };- byPath.set(path, entry);- }- return entry;- };-- for (const message of messages) {- if (message.kind === "tool_start" && message.detail.kind === "file_update") {- ensure(message.detail.path).operation = message.detail.operation;+ for (const item of items) {+ if (item.kind !== "request_work") {continue;}+ for (const activity of item.activities) {+ for (const operation of activity.operations) {+ const model = getActivityResultModel(operation);+ if (model?.kind !== "file_diff") {+ continue;+ }- if (- message.kind === "tool_end" &&- message.detail != null &&- message.detail.kind === "file_diff"- ) {- const entry = ensure(message.detail.path);- const renderablePatch = buildRenderableFileDiffPatch(- message.detail.path,- message.detail.patch,- );- const stats = getPatchStats(renderablePatch);- if (stats != null) {- entry.additions += stats.additions;- entry.deletions += stats.deletions;+ const existing = byPath.get(model.path);+ if (existing == null) {+ byPath.set(model.path, {+ order: order += 1,+ change: {+ path: model.path,+ patch: model.patch,+ operation: model.operation ?? null,+ editCount: 1,+ },+ });+ } else {+ existing.change.patch = model.patch;+ existing.change.operation = model.operation ?? existing.change.operation;+ existing.change.editCount += 1;+ }}- entry.patch = renderablePatch;- entry.editCount += 1;}}return Array.from(byPath.values()).sort((left, right) => left.order - right.order)- .map((change) => ({- path: change.path,- patch: change.patch,- additions: change.additions,- deletions: change.deletions,- editCount: change.editCount,- operation: change.operation,- }));+ .map((entry) => entry.change);}diff --git a/gui/src/main.tsx b/gui/src/main.tsxindex 513bdcb6..258380bc 100644--- a/gui/src/main.tsx+++ b/gui/src/main.tsx@@ -3,6 +3,7 @@ import { createRoot } from 'react-dom/client'import 'dockview-react/dist/styles/dockview.css'import '@codegraff/diffs/style.css'import './styles/index.css'+import './styles/diffs.css'import App from './app/App'createRoot(document.getElementById('root')!).render(diff --git a/gui/src/services/desktop/client.ts b/gui/src/services/desktop/client.tsindex 86e51614..d2850dc7 100644--- a/gui/src/services/desktop/client.ts+++ b/gui/src/services/desktop/client.ts@@ -284,6 +284,8 @@ function mockInvokeCommand<T>({ id: `${conversationId}-assistant`, kind: "assistant", requestId: `${conversationId}-request`, text: "QA mock response with a bullet list:\n\n- Markdown bullets align correctly.\n- `inline code` stays readable.\n\n```ts\nconst theme = 'clean-modern';\n```\n\n[Codegraff](https://github.com/justrach/codegraff)" },]) as T);}+ case "read_workspace_file":+ return Promise.resolve("// QA mock file contents\nexport const value = 1;\n" as T);case "list_mcp_servers":return Promise.resolve({ servers: [] } as T);case "pick_workspace":@@ -667,6 +669,13 @@ export function openPathForEdit(path: string): Promise<void> {return invokeCommand("open_path_for_edit", { path });}+export function readWorkspaceFile(+ workspacePath: string,+ path: string,+): Promise<string> {+ return invokeCommand("read_workspace_file", { workspacePath, path });+}+export function saveConversationLayout(input: SaveConversationLayoutInput,): Promise<void> {diff --git a/gui/src/styles/diffs.css b/gui/src/styles/diffs.cssnew file mode 100644index 00000000..5e97c699--- /dev/null+++ b/gui/src/styles/diffs.css@@ -0,0 +1,26 @@+/* Bind @codegraff/diffs to the app's theme tokens so diffs adapt to light/dark+ and every `data-theme` preset automatically. Imported after the package's base+ stylesheet so these overrides win. */++.cgd-root,+.cgd-fc-row {+ --cgd-font: var(--font-mono);+ --cgd-fg: var(--foreground);+ --cgd-muted: var(--muted-foreground);+ --cgd-border: var(--border);+ --cgd-add-bg: var(--diff-add-bg);+ --cgd-del-bg: var(--diff-del-bg);+ --cgd-add-word: color-mix(in oklab, var(--success) 32%, transparent);+ --cgd-del-word: color-mix(in oklab, var(--destructive) 32%, transparent);+ --cgd-add-accent: var(--success);+ --cgd-del-accent: var(--destructive);+ --cgd-hunk-bg: color-mix(in oklab, var(--muted) 60%, transparent);+ --cgd-hunk-fg: var(--muted-foreground);+ --cgd-stat-add: var(--success);+ --cgd-stat-del: var(--destructive);+ --cgd-tok-keyword: var(--sh-keyword);+ --cgd-tok-string: var(--sh-string);+ --cgd-tok-comment: var(--sh-comment);+ --cgd-tok-number: var(--sh-class);+ --cgd-tok-punct: var(--sh-sign);+}diff --git a/packages/diffs/src/style.css b/packages/diffs/src/style.cssindex f11634f1..8cdcc6b7 100644--- a/packages/diffs/src/style.css+++ b/packages/diffs/src/style.css@@ -1,51 +1,54 @@/* @codegraff/diffs — dependency-free diff styling.- Colors are driven by CSS variables so the host app can override them.- Light defaults; dark overrides apply under `.dark` or prefers-color-scheme. */+ All colors come from `--cgd-*` variables; the values below are neutral+ fallbacks for standalone use. A host app (e.g. codegraff) overrides them with+ its own theme tokens, so do NOT add theme-specific (e.g. dark) color blocks+ here — the host drives color. */.cgd-root {--cgd-fg: #1f2328;- --cgd-muted: #656d76;- --cgd-border: #d0d7de;+ --cgd-muted: #8a8f98;+ --cgd-border: #e4e4e7;--cgd-add-bg: #e6ffec;- --cgd-add-word: #abf2bc;--cgd-del-bg: #ffebe9;- --cgd-del-word: #ff9a99;- --cgd-hunk-fg: #57606a;- --cgd-hunk-bg: #f6f8fa;+ --cgd-add-word: rgba(46, 160, 67, 0.32);+ --cgd-del-word: rgba(248, 81, 73, 0.32);+ --cgd-add-accent: #2ea043;+ --cgd-del-accent: #f85149;+ --cgd-hunk-bg: #f3f4f6;+ --cgd-hunk-fg: #6b7280;--cgd-stat-add: #1a7f37;--cgd-stat-del: #cf222e;--cgd-tok-keyword: #cf222e;--cgd-tok-string: #0a3069;--cgd-tok-comment: #6e7781;--cgd-tok-number: #0550ae;- --cgd-tok-punct: #57606a;+ --cgd-tok-punct: #6b7280;+ --cgd-font: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;display: block;color: var(--cgd-fg);- font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;+ font-family: var(--cgd-font);font-size: 12px;- line-height: 1.5;+ line-height: 1.55;-moz-tab-size: 2;tab-size: 2;}.cgd-file + .cgd-file {- margin-top: 12px;+ margin-top: 10px;}.cgd-file-header {display: flex;align-items: center;gap: 8px;- padding: 6px 8px;- border: 1px solid var(--cgd-border);- border-bottom: 0;- border-radius: 6px 6px 0 0;- background: var(--cgd-hunk-bg);+ padding: 6px 10px;+ color: var(--cgd-muted);}.cgd-file-path {font-weight: 600;+ color: var(--cgd-fg);overflow: hidden;text-overflow: ellipsis;white-space: nowrap;@@ -58,7 +61,6 @@padding: 1px 6px;border-radius: 999px;border: 1px solid var(--cgd-border);- color: var(--cgd-muted);}.cgd-file-stats,@@ -66,6 +68,7 @@margin-left: auto;display: inline-flex;gap: 8px;+ font-variant-numeric: tabular-nums;}.cgd-stat--add {@@ -77,18 +80,14 @@}.cgd-body {- border: 1px solid var(--cgd-border);- border-radius: 0 0 6px 6px;overflow-x: auto;}-.cgd-file-header + .cgd-body {- border-radius: 0 0 6px 6px;-}-.cgd-line {display: grid;- grid-template-columns: 44px 44px 16px 1fr;+ grid-template-columns: 40px 40px 18px 1fr;+ width: max-content;+ min-width: 100%;white-space: pre;}@@ -96,39 +95,57 @@text-align: right;padding: 0 8px;color: var(--cgd-muted);+ opacity: 0.55;user-select: none;}.cgd-sign {text-align: center;user-select: none;+ opacity: 0.65;}.cgd-content {- padding-right: 12px;+ padding-right: 16px;}.cgd-line--addition {background: var(--cgd-add-bg);+ box-shadow: inset 2px 0 0 var(--cgd-add-accent);}.cgd-line--deletion {background: var(--cgd-del-bg);+ box-shadow: inset 2px 0 0 var(--cgd-del-accent);}.cgd-line--hunk {background: var(--cgd-hunk-bg);color: var(--cgd-hunk-fg);+ padding-block: 2px;+}++.cgd-line--hunk + .cgd-line--hunk,+.cgd-line:not(.cgd-line--hunk) + .cgd-line--hunk {+ margin-top: 4px;+}++.cgd-line--hunk .cgd-content {+ font-size: 11px;+ letter-spacing: 0.02em;+ opacity: 0.75;}.cgd-word--added {background: var(--cgd-add-word);- border-radius: 2px;+ border-radius: 3px;+ box-shadow: 0 0 0 1px var(--cgd-add-word);}.cgd-word--removed {background: var(--cgd-del-word);- border-radius: 2px;+ border-radius: 3px;+ box-shadow: 0 0 0 1px var(--cgd-del-word);}.cgd-tok--keyword {@@ -157,10 +174,11 @@color: var(--cgd-muted);}-/* Files-changed list */+/* Files-changed list (generic; host apps may restyle the surrounding chrome) */.cgd-fc-row {border: 1px solid var(--cgd-border);- border-radius: 6px;+ border-radius: 10px;+ overflow: hidden;}.cgd-fc-row + .cgd-fc-row {@@ -179,7 +197,7 @@display: flex;align-items: center;gap: 8px;- padding: 8px 10px;+ padding: 9px 12px;background: none;border: 0;font: inherit;@@ -210,52 +228,5 @@}.cgd-fc-body {- padding: 0 10px 10px;-}--.cgd-fc-body .cgd-root {- font-size: 12px;-}--/* Dark theme */-.dark .cgd-root,-.dark .cgd-fc-row {- --cgd-fg: #e6edf3;- --cgd-muted: #8b949e;- --cgd-border: #30363d;- --cgd-add-bg: rgba(46, 160, 67, 0.15);- --cgd-add-word: rgba(46, 160, 67, 0.4);- --cgd-del-bg: rgba(248, 81, 73, 0.15);- --cgd-del-word: rgba(248, 81, 73, 0.4);- --cgd-hunk-fg: #8b949e;- --cgd-hunk-bg: #161b22;- --cgd-stat-add: #3fb950;- --cgd-stat-del: #f85149;- --cgd-tok-keyword: #ff7b72;- --cgd-tok-string: #a5d6ff;- --cgd-tok-comment: #8b949e;- --cgd-tok-number: #79c0ff;- --cgd-tok-punct: #c9d1d9;-}--@media (prefers-color-scheme: dark) {- :root:not(.light) .cgd-root,- :root:not(.light) .cgd-fc-row {- --cgd-fg: #e6edf3;- --cgd-muted: #8b949e;- --cgd-border: #30363d;- --cgd-add-bg: rgba(46, 160, 67, 0.15);- --cgd-add-word: rgba(46, 160, 67, 0.4);- --cgd-del-bg: rgba(248, 81, 73, 0.15);- --cgd-del-word: rgba(248, 81, 73, 0.4);- --cgd-hunk-fg: #8b949e;- --cgd-hunk-bg: #161b22;- --cgd-stat-add: #3fb950;- --cgd-stat-del: #f85149;- --cgd-tok-keyword: #ff7b72;- --cgd-tok-string: #a5d6ff;- --cgd-tok-comment: #8b949e;- --cgd-tok-number: #79c0ff;- --cgd-tok-punct: #c9d1d9;- }+ padding: 0 12px 12px;}