Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(git): fold the repository row, and show what one agent session changed from the Git tab or the pane header (#732)

Ruben Lütkea7317c9020c4
diff --git a/jarvis/agentic_ide/scm.py b/jarvis/agentic_ide/scm.py
index 38a69c646f..0d57666526 100644
--- a/jarvis/agentic_ide/scm.py
+++ b/jarvis/agentic_ide/scm.py
@@ -1150,3 +1150,34 @@ def commit_file_diff(
"after": after,
"binary": binary_before or binary_after,
}
+
+
+def session_file_diff(folder: str | Path, path: str, base: str) -> dict[str, Any]:
+ """One file an agent session changed: its text at ``base`` and on disk now.
+
+ ``path`` is relative to the session's folder (the workspace, or the pane's
+ own worktree); ``base`` is the commit before the session's first change.
+ """
+ from jarvis.agentic_ide import git_changes
+
+ root = Path(folder).expanduser()
+ try:
+ rel = git_changes.normalize_workspace_path(root, path)
+ before = git_changes.head_text(root, rel, base)
+ except ValueError as exc:
+ raise GitError(str(exc), code="invalid") from exc
+ target = root / rel
+ after: str | None = None
+ binary = False
+ if target.is_file():
+ if target.stat().st_size > MAX_DIFF_TEXT_BYTES:
+ binary = True
+ else:
+ data = target.read_bytes()
+ if b"\0" in data:
+ binary = True
+ else:
+ after = data.decode("utf-8", errors="replace").removeprefix("\ufeff")
+ if before is not None and "\0" in before:
+ binary = True
+ return {"path": rel, "before": before, "after": after, "binary": binary}
diff --git a/jarvis/ui/web/agentic_ide_scm_routes.py b/jarvis/ui/web/agentic_ide_scm_routes.py
index 3c517d1edf..425dd5bcc1 100644
--- a/jarvis/ui/web/agentic_ide_scm_routes.py
+++ b/jarvis/ui/web/agentic_ide_scm_routes.py
@@ -489,3 +489,26 @@ def stash_drop(body: StashDropBody) -> dict:
except GitError as exc:
raise _fail(exc) from exc
return _ok()
+
+
[email protected]("/session-file", summary="Both sides of one file an agent session changed")
+def session_file(
+ workspace_id: str = Query(..., min_length=1),
+ pane: str = Query(..., min_length=1),
+ path: str = Query(..., min_length=1),
+ base: str = Query(..., min_length=7, max_length=64),
+) -> dict:
+ """The file at the commit before the session's first change, and as it is now.
+
+ The pane's own worktree is read when it has one, like its review list.
+ """
+ session = get_registry().get(workspace_id)
+ if session is None:
+ raise HTTPException(status_code=404, detail="Workspace not found.")
+ term = next((entry for entry in session.terminals if entry.name == pane), None)
+ if term is None:
+ raise HTTPException(status_code=404, detail="Terminal not found.")
+ try:
+ return scm.session_file_diff(term.folder or session.folder, path, base)
+ except GitError as exc:
+ raise _fail(exc) from exc
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
index 6d6873aa05..b6f087ad7c 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
@@ -59,6 +59,7 @@ import {
BookOpenText,
Check,
FileDiff,
+ FolderGit2,
GripVertical,
Loader2,
Maximize2,
@@ -159,6 +160,8 @@ import { PromptReceipt } from "./PromptReceipt";
import { PromptHistoryButton } from "./PromptHistoryButton";
import { PaneConversationDialog } from "./PaneConversationDialog";
import { PaneChangesDialog } from "./PaneChangesDialog";
+import { useGitSessionStore } from "@/store/gitSession";
+import { useIdeSidePanelStore } from "@/store/ideSidePanel";
import { prefetchPaneChanges } from "./paneChangesApi";
import { WorkspaceTerminalHeader } from "./WorkspaceTerminalHeader";
import { usePaneContextMenu } from "./usePaneContextMenu";
@@ -2890,6 +2893,14 @@ export function AgenticTerminal({
// A pane whose agent runs on another computer changes files THERE, which
// this machine's git cannot read — so only a local pane offers the review.
const reviewChanges = workspaceId && !computerName ? () => setChangesOpen(true) : undefined;
+ // The Git tab, narrowed to what this pane's agent session changed.
+ const showInGit =
+ workspaceId && !computerName
+ ? () => {
+ useGitSessionStore.getState().show(workspaceId, name);
+ useIdeSidePanelStore.getState().openTab("git");
+ }
+ : undefined;
const prefetchReview = workspaceId && !computerName
? () => {
void loadLocaleChunk("pane_review");
@@ -2923,6 +2934,7 @@ export function AgenticTerminal({
onOpenChat,
onReviewChanges: reviewChanges,
onReviewChangesPrefetch: prefetchReview,
+ onShowInGit: showInGit,
onRestart,
onFork,
branch,
@@ -3236,6 +3248,7 @@ function PaneHeader({
onOpenChat,
onReviewChanges,
onReviewChangesPrefetch,
+ onShowInGit,
}: {
workspaceId?: string;
githubStatusEnabled: boolean;
@@ -3273,6 +3286,8 @@ function PaneHeader({
onReviewChanges?: () => void;
/** Starts reading the review the moment the pointer reaches its button. */
onReviewChangesPrefetch?: () => void;
+ /** Opens the Git tab showing only what this pane's agent session changed. */
+ onShowInGit?: () => void;
}) {
const t = useT();
const light = appearance === "light";
@@ -3806,6 +3821,15 @@ function PaneHeader({
<FileDiff className="h-3.5 w-3.5" aria-hidden="true" />
</PaneAction>
)}
+ {onShowInGit && (
+ <PaneAction
+ label={fill(t("agentic_grid.pane.show_in_git"), { pane: name })}
+ testId={`pane-show-in-git-${name}`}
+ onClick={onShowInGit}
+ >
+ <FolderGit2 className="h-3.5 w-3.5" aria-hidden="true" />
+ </PaneAction>
+ )}
<PaneAction
label={fill(
t(maximized ? "agentic_grid.pane.restore" : "agentic_grid.pane.maximize"),
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.test.tsx
index 030b88a966..9f7c24f522 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.test.tsx
@@ -34,6 +34,19 @@ describe("compact workspace terminal header", () => {
expect(screen.queryByRole("button", { name: "Review changes by Dana" })).toBeNull();
});
+ it("opens the Git tab for this session from a button and a menu entry", () => {
+ const show = vi.fn();
+ const { unmount } = render(<WorkspaceTerminalHeader {...BASE} onShowInGit={show} />);
+ fireEvent.click(screen.getByRole("button", { name: "Show Dana's changes in Git" }));
+ expect(show).toHaveBeenCalledTimes(1);
+ fireEvent.click(screen.getByRole("button", { name: "More actions for Dana" }));
+ fireEvent.click(screen.getByRole("menuitem", { name: "Show changes in Git" }));
+ expect(show).toHaveBeenCalledTimes(2);
+ unmount();
+ render(<WorkspaceTerminalHeader {...BASE} />);
+ expect(screen.queryByRole("button", { name: "Show Dana's changes in Git" })).toBeNull();
+ });
+
it("reads the review ahead when the pointer reaches its button, and after a dwell on the bar", () => {
vi.useFakeTimers();
try {
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.tsx
index 2b40f49600..9312c77410 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalHeader.tsx
@@ -1,6 +1,6 @@
import { useEffect, useId, useLayoutEffect, useRef, useState, type ComponentType, type CSSProperties, type MouseEvent, type PointerEvent, type SVGProps } from "react";
import { createPortal } from "react-dom";
-import { Check, FileDiff, FolderInput, GitBranch, Maximize2, Minimize2, MoreHorizontal, Plus, Server, X } from "lucide-react";
+import { Check, FileDiff, FolderGit2, FolderInput, GitBranch, Maximize2, Minimize2, MoreHorizontal, Plus, Server, X } from "lucide-react";
import { fill, loadLocaleChunk, useT } from "@/i18n";
import { AgentMark } from "./AgentMark";
import { BranchIcon } from "./branchIcon";
@@ -42,6 +42,8 @@ interface Props {
onReviewChanges?: () => void;
/** Starts reading the review ahead of a click: on the button at once, on the title bar after a short dwell. */
onReviewChangesPrefetch?: () => void;
+ /** Opens the Git tab showing only what this pane's agent session changed. */
+ onShowInGit?: () => void;
onRestart?: () => void;
/** Opens the fork dialog: a new agent continuing a copy of this pane's chat. */
onFork?: () => void;
@@ -80,7 +82,7 @@ export function WorkspaceTerminalHeader({
contextMenuRequest, onSwapWithFocused, sendRightClicks = false, onToggleSendRightClicks,
name, workspaceId, promptCount = 0, agent, agentLogoUrl, displayName, status, appearance, arranging = false,
maximized = false, addDisabled = false, onArrangeStart, onActivate, onToggleMaximize,
- onAdd, onClose, onRename, onOpenConversation, onOpenChat, onReviewChanges, onReviewChangesPrefetch, onRestart, onFork, branch,
+ onAdd, onClose, onRename, onOpenConversation, onOpenChat, onReviewChanges, onReviewChangesPrefetch, onShowInGit, onRestart, onFork, branch,
computerName, placementItems, workspaceItems, variant = "bar", focused = false, githubStatusEnabled = true,
}: Props) {
const t = useT();
@@ -222,6 +224,7 @@ export function WorkspaceTerminalHeader({
onOpenConversation && { label: t("ide_panes.header.conversation_history"), run: onOpenConversation },
onOpenChat && { label: t("ide_panes.header.open_as_chat"), run: onOpenChat },
onReviewChanges && { label: t("ide_panes.header.review_changes"), Icon: FileDiff, run: onReviewChanges },
+ onShowInGit && { label: t("ide_panes.header.show_in_git"), Icon: FolderGit2, run: onShowInGit },
stopped && onRestart && { label: t("ide_panes.header.restart_agent"), run: onRestart },
...(workspaceItems ?? []).map((item, index) => ({ ...item, Icon: FolderInput, separated: index === 0 })),
...(placementItems ?? []).map((item, index) => ({ ...item, Icon: Server, separated: index === 0 })),
@@ -301,6 +304,8 @@ export function WorkspaceTerminalHeader({
<div data-header-control="true" className="flex shrink-0 items-center gap-0.5">
{onReviewChanges && <button type="button" data-testid={`pane-review-changes-${name}`} aria-label={fill(t("agentic_grid.pane.review_changes"), { pane: name })}
title={t("ide_panes.header.review_changes")} onClick={onReviewChanges} onPointerEnter={() => { cancelPrefetch(); prefetchReview(); }} className={action}><FileDiff className="h-[15px] w-[15px]" /></button>}
+ {onShowInGit && <button type="button" data-testid={`pane-show-in-git-${name}`} aria-label={fill(t("agentic_grid.pane.show_in_git"), { pane: name })}
+ title={t("ide_panes.header.show_in_git")} onClick={onShowInGit} className={action}><FolderGit2 className="h-[15px] w-[15px]" /></button>}
{moreButton}
{maximizeButton}
{onFork && <button type="button" data-testid={`pane-fork-${name}`} aria-label={fill(t("ide_panes.fork.title"), { pane: name })} title={fill(t("ide_panes.fork.title"), { pane: name })}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.test.tsx
index 4cc71e0442..8f4f701e08 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.test.tsx
@@ -5,6 +5,8 @@ import type { GraphPage, ScmFile, ScmStatus } from "./scm/scmApi";
import { useCodeEditorStore } from "@/store/codeEditor";
import { useEventStore } from "@/store/events";
import { useIdeChatStore } from "@/store/ideChat";
+import { useGitSessionStore } from "@/store/gitSession";
+import { useWorkspacePanesStore } from "@/store/workspacePanes";
vi.mock("./scm/MonacoDiff", () => ({ default: () => <div data-testid="scm-diff-editor" /> }));
@@ -80,6 +82,32 @@ beforeEach(() => {
stat: "1 file changed, 2 insertions(+)",
});
}
+ if (url.includes("/api/agentic-ide/panes")) {
+ const pane = (key: string, display_name: string, recap: string) => ({
+ workspace_id: "w1", workspace_name: "App", folder: "/code/app", workspace_active: true, key, history_id: key, name: key,
+ agent: display_name.toLowerCase(), display_name, accepts_prompts: true, status: "live", exit_code: null, activity: "idle",
+ activity_since: 0, worked: true, started_at: null, last_output_at: null, last_prompt: "", last_prompt_at: null, recap,
+ has_resume: true, readable: true, account: null, account_label: null, archived: false,
+ });
+ return json({ panes: [pane("T1", "Claude Code", "fix the login"), pane("T2", "Codex", "add the widget")], active_id: "w1" });
+ }
+ if (url.includes("/terminals/T2/changes")) {
+ return json({
+ workspace_id: "w1",
+ available: true,
+ branch: "main",
+ truncated: false,
+ reason: "",
+ base: "b0b0b0b0b0b0",
+ since_ms: Date.now() - 600_000,
+ generated: 2,
+ files: [
+ { path: "src/widget.ts", status: "added", added: 3, removed: 0, is_directory: false, authors: [], committed: true },
+ { path: "app.py", status: "modified", added: 1, removed: 1, is_directory: false, authors: [], committed: false },
+ ],
+ });
+ }
+ if (url.includes("/scm/session-file")) return json({ path: "src/widget.ts", before: null, after: "export const w = 1;\n", binary: false });
if (url.includes("/scm/refs")) {
return json({
current: "main",
@@ -261,6 +289,52 @@ describe("GitOverviewTab — changes", () => {
});
});
+describe("GitOverviewTab — one agent session", () => {
+ beforeEach(() => useWorkspacePanesStore.setState({ panes: [], loaded: false }));
+
+ it("folds the repository away from its row", async () => {
+ render(<GitOverviewTab />);
+ fireEvent.click(await screen.findByTestId("scm-repo-row"));
+ expect(screen.queryByTestId("scm-message")).toBeNull();
+ expect(screen.queryByTestId("scm-file")).toBeNull();
+ fireEvent.click(screen.getByTestId("scm-repo-row"));
+ expect(await screen.findByTestId("scm-message")).toBeTruthy();
+ });
+
+ it("narrows the list to the files one session wrote, picked from the filter", async () => {
+ render(<GitOverviewTab />);
+ await screen.findByText("app.py");
+ fireEvent.click(screen.getByTestId("scm-session-filter"));
+ await vi.waitFor(() => expect(screen.getAllByTestId("scm-quick-pick-item").length).toBe(3));
+ const items = screen.getAllByTestId("scm-quick-pick-item");
+ expect(items.map((item) => item.textContent)).toEqual([expect.stringContaining("All Changes"), expect.stringContaining("T1 · Claude Code"), expect.stringContaining("T2 · Codex")]);
+ fireEvent.click(items[2]);
+ const files = await screen.findAllByTestId("scm-session-file");
+ expect(files.map((file) => [file.dataset.path, file.dataset.letter])).toEqual([["src/widget.ts", "A"], ["app.py", "M"]]);
+ expect(screen.getByTestId("scm-session-row").textContent).toContain("T2 · Codex");
+ expect(screen.getByTestId("scm-session-count").textContent).toBe("2");
+ expect(screen.queryByTestId("scm-file")).toBeNull();
+ // Only the pending file can be staged; the committed one is history.
+ expect(within(files[0]).queryByTestId("scm-session-stage")).toBeNull();
+ fireEvent.click(within(files[1]).getByTestId("scm-session-stage"));
+ await vi.waitFor(() => expect(posted("scm/stage")).toEqual([{ workspace_id: "w1", paths: ["app.py"] }]));
+ fireEvent.click(files[0]);
+ expect(await screen.findByTestId("scm-diff-dialog")).toBeTruthy();
+ await vi.waitFor(() => expect(gets.some((url) => url.includes("/scm/session-file") && url.includes("base=b0b0b0b0b0b0"))).toBe(true));
+ fireEvent.click(screen.getByTestId("scm-diff-close"));
+ fireEvent.click(screen.getByTestId("scm-session-clear"));
+ expect(await screen.findByText("notes.txt")).toBeTruthy();
+ expect(screen.queryByTestId("scm-session")).toBeNull();
+ });
+
+ it("opens straight on a session when its pane asks", async () => {
+ render(<GitOverviewTab />);
+ await screen.findByText("app.py");
+ act(() => useGitSessionStore.getState().show("w1", "T2"));
+ expect((await screen.findAllByTestId("scm-session-file")).length).toBe(2);
+ });
+});
+
describe("GitOverviewTab — graph", () => {
it("draws the history with branch and tag badges and opens a commit's files", async () => {
render(<GitOverviewTab />);
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.tsx
index f2f7bf41d9..e39477017c 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.tsx
@@ -1,8 +1,10 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
-import { useT } from "@/i18n";
+import { fill, useT } from "@/i18n";
import { prepareGit } from "@/lib/gitApi";
import { useEventStore } from "@/store/events";
import { useIdeChatStore } from "@/store/ideChat";
+import { useGitSessionStore } from "@/store/gitSession";
+import { useWorkspacePanes } from "@/store/workspacePanes";
import { RepositoryOverview, RestartToConnectCard } from "./RepositoryOverview";
import { ChangesView, IconButton, viewSortMenu, type ListSettings } from "./scm/ChangesView";
import { Codicon } from "./scm/Codicon";
@@ -12,6 +14,7 @@ import { GraphView } from "./scm/GraphView";
import { useQuickInput } from "./scm/QuickInput";
import { ScmMenu, menuPointFor, type MenuItem } from "./scm/ScmMenu";
import { ScmViews } from "./scm/ScmViews";
+import type { SessionPick } from "./scm/SessionChanges";
import type { GraphScope } from "./scm/scmApi";
import { scmStorage, useChoice, useScmCommands, useScmStatus, type CommitOptions } from "./scm/useScm";
@@ -59,6 +62,23 @@ export function GitOverviewTab() {
const [menu, setMenu] = useState<{ items: MenuItem[]; x: number; y: number } | null>(null);
const [goHead, setGoHead] = useState(0);
const [initializing, setInitializing] = useState(false);
+ // One agent session the Changes list is narrowed to (its pane's call-sign), per workspace.
+ const [sessionPane, setSessionPane] = useState<string | null>(null);
+ const panes = useWorkspacePanes(Boolean(workspaceId));
+ const workspacePanes = useMemo(() => panes.filter((row) => row.workspace_id === workspaceId), [panes, workspaceId]);
+ const session: SessionPick | null = useMemo(() => {
+ if (!sessionPane) return null;
+ const row = workspacePanes.find((entry) => entry.key === sessionPane);
+ return { pane: sessionPane, agentName: row?.display_name || row?.agent || "", title: row?.recap || row?.last_prompt || "" };
+ }, [sessionPane, workspacePanes]);
+ useEffect(() => setSessionPane(null), [workspaceId]);
+ // A pane's "show in Git" button narrows the list to that pane.
+ const sessionRequest = useGitSessionStore((state) => state.request);
+ useEffect(() => {
+ if (!sessionRequest || sessionRequest.workspaceId !== workspaceId) return;
+ setSessionPane(sessionRequest.pane);
+ setOpen((current) => ({ ...current, changes: true }));
+ }, [sessionRequest, workspaceId]);
// The commit message is kept per workspace, across restarts, until it is committed.
const [message, setMessageState] = useState(() => (workspaceId ? scmStorage.get(MESSAGE_KEY(workspaceId)) : ""));
const [messageError, setMessageError] = useState("");
@@ -230,6 +250,22 @@ export function GitOverviewTab() {
];
}, [status, settings, commands, runCommit, undoLastCommit, t]);
+ const pickSession = async () => {
+ type Pick = { pane: string | null };
+ const items = [
+ { label: t("ide_side_panel.git.scm.all_changes"), icon: <Codicon name="git-compare" />, value: { pane: null } as Pick },
+ ...workspacePanes.map((row) => ({
+ label: row.display_name || row.agent ? `${row.key} · ${row.display_name || row.agent}` : row.key,
+ description: row.recap || row.last_prompt || "",
+ icon: <Codicon name={row.key === sessionPane ? "check" : "terminal"} />,
+ group: t("ide_side_panel.git.scm.sessions"),
+ value: { pane: row.key } as Pick,
+ })),
+ ];
+ const picked = await quick.pick(items, t("ide_side_panel.git.scm.pick_session"));
+ if (picked) setSessionPane(picked.pane);
+ };
+
const scopeMenu = (): MenuItem[] =>
(["auto", "current", "all"] as GraphScope[]).map((value) => ({
id: `scope-${value}`,
@@ -308,6 +344,9 @@ export function GitOverviewTab() {
onDiff={setDiff}
onRefresh={refresh}
moreMenu={moreMenu}
+ session={session}
+ revision={revision}
+ onClearSession={() => setSessionPane(null)}
/>
);
}
@@ -338,6 +377,14 @@ export function GitOverviewTab() {
onToggle: () => toggleView("changes"),
weight: weights.changes ?? 1,
actions: repository ? (
+ <>
+ <IconButton
+ label={session ? fill(t("ide_side_panel.git.scm.filtered_by"), { pane: session.pane }) : t("ide_side_panel.git.scm.filter_session")}
+ testId="scm-session-filter"
+ onClick={() => void pickSession()}
+ >
+ <Codicon name={session ? "filter-filled" : "filter"} />
+ </IconButton>
<IconButton
label={settings.mode === "list" ? t("ide_side_panel.git.scm.view_tree") : t("ide_side_panel.git.scm.view_list")}
testId="scm-view-mode"
@@ -345,6 +392,7 @@ export function GitOverviewTab() {
>
<Codicon name={settings.mode === "list" ? "list-tree" : "list-flat"} />
</IconButton>
+ </>
) : undefined,
body: changesBody,
},
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/scm/ChangesView.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/scm/ChangesView.tsx
index 2655c96e16..219d53ddda 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/scm/ChangesView.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/scm/ChangesView.tsx
@@ -28,6 +28,7 @@ import { Codicon, Twistie } from "./Codicon";
import { ScmMenu, menuPointFor, type MenuItem } from "./ScmMenu";
import type { CommitOptions, ScmCommands } from "./useScm";
import type { DiffSource } from "./DiffDialog";
+import { SessionChanges, type SessionPick } from "./SessionChanges";
export const ROW_HEIGHT = 22;
/** Each tree level steps in by 8 px. */
@@ -212,6 +213,9 @@ export function ChangesView({
onDiff,
onRefresh,
moreMenu,
+ session = null,
+ revision = "",
+ onClearSession,
}: {
workspaceId: string;
repoName: string;
@@ -228,6 +232,11 @@ export function ChangesView({
onDiff: (source: DiffSource) => void;
onRefresh: () => void;
moreMenu: () => MenuItem[];
+ /** Narrow the list to one agent session's own files; null = every change. */
+ session?: SessionPick | null;
+ /** Bumped when the repository changed (the session list reads again). */
+ revision?: string;
+ onClearSession?: () => void;
}) {
const t = useT();
const pushToast = useEventStore((state) => state.pushToast);
@@ -236,6 +245,8 @@ export function ChangesView({
const [anchor, setAnchor] = useState("");
const [focusKey, setFocusKey] = useState("");
const [menu, setMenu] = useState<{ items: MenuItem[]; x: number; y: number } | null>(null);
+ // The repository row folds the commit box and every list under it away.
+ const [repoOpen, setRepoOpen] = useState(true);
const textarea = messageRef;
const scroller = useRef<HTMLDivElement>(null);
const listTop = useRef<HTMLDivElement>(null);
@@ -513,15 +524,24 @@ export function ChangesView({
return (
<div className="flex h-full min-h-0 flex-col">
<div ref={scroller} data-testid="scm-changes-scroller" onScroll={measure} className="min-h-0 flex-1 overflow-y-auto">
- <div data-testid="scm-repo-row" className="scm-row flex h-[22px] items-center pr-[8px]">
- <Twistie open />
+ <div
+ data-testid="scm-repo-row"
+ role="treeitem"
+ aria-expanded={repoOpen}
+ onClick={() => setRepoOpen((value) => !value)}
+ className="scm-row flex h-[22px] cursor-pointer select-none items-center pr-[8px]"
+ >
+ <Twistie open={repoOpen} />
<Codicon name="repo" className="mr-[6px]" />
<span className="min-w-0 shrink truncate">{repoName}</span>
<QuickTooltip content={t("ide_side_panel.git.scm.checkout_tip")} side="bottom" className="inline-flex min-w-0">
<button
type="button"
data-testid="scm-branch"
- onClick={() => void commands.checkoutTo()}
+ onClick={(event) => {
+ event.stopPropagation();
+ void commands.checkoutTo();
+ }}
className="ml-[0.5em] inline-flex min-w-0 items-center gap-[3px] text-[0.9em] opacity-70 hover:opacity-100"
>
<Codicon name="git-branch" className="!text-[14px]" />
@@ -539,7 +559,10 @@ export function ChangesView({
data-testid="scm-sync"
aria-label={syncLabel}
disabled={busy !== ""}
- onClick={() => void commands.sync()}
+ onClick={(event) => {
+ event.stopPropagation();
+ void commands.sync();
+ }}
className="scm-action !w-auto gap-[2px] px-[3px] text-[12px] tabular-nums"
>
{!status.upstream ? (
@@ -581,6 +604,7 @@ export function ChangesView({
</span>
</div>
+ {repoOpen && (
<div className="pb-[6px] pl-[20px] pr-[12px] pt-[3px]">
{status.operation && status.operation !== "bisect" && (
<div data-testid="scm-operation" className="mb-[6px] flex items-start gap-2 rounded-sm border border-[var(--scm-modified)] px-[6px] py-[2px] text-[12px] leading-[18px]">
@@ -682,6 +706,21 @@ export function ChangesView({
</div>
</div>
+ )}
+
+ {repoOpen && session && (
+ <SessionChanges
+ workspaceId={workspaceId}
+ session={session}
+ status={status}
+ commands={commands}
+ revision={revision}
+ onDiff={onDiff}
+ onClear={() => onClearSession?.()}
+ />
+ )}
+
+ {repoOpen && !session && (
<div
ref={listTop}
role="tree"
@@ -774,6 +813,7 @@ export function ChangesView({
})}
</div>
</div>
+ )}
{status.truncated && <p className="px-[20px] py-[4px] text-[12px] opacity-70">{t("ide_side_panel.git.scm.truncated")}</p>}
</div>
{menu && <ScmMenu items={menu.items} x={menu.x} y={menu.y} onClose={() => setMenu(null)} />}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/scm/SessionChanges.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/scm/SessionChanges.tsx
new file mode 100644
index 0000000000..b4b6755d65
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/scm/SessionChanges.tsx
@@ -0,0 +1,260 @@
+import { useEffect, useMemo, useState } from "react";
+import { fill, useT } from "@/i18n";
+import { useRunLocale } from "@/components/runs/format";
+import { QuickTooltip } from "@/components/ui/tooltip";
+import { cn } from "@/lib/utils";
+import { useCodeEditorStore } from "@/store/codeEditor";
+import { useEventStore } from "@/store/events";
+import { FileTypeIcon } from "../../explorer/FileTypeIcon";
+import { loadPaneChanges, type PaneChanges, type ReviewFile } from "../../../paneChangesApi";
+import { agoLabel } from "../gitBadges";
+import { Codicon, Twistie } from "./Codicon";
+import type { DiffSource } from "./DiffDialog";
+import { scmApi, type ScmLetter, type ScmStatus } from "./scmApi";
+import { baseName, dirName, letterTone } from "./scmModel";
+import type { ScmCommands } from "./useScm";
+
+const ROW = 22;
+/** How often the session's list is read again while it is on screen. */
+const POLL_MS = 8_000;
+
+const LETTER: Record<string, ScmLetter> = { added: "A", untracked: "U", deleted: "D", conflicted: "!", modified: "M" };
+
+/** The one agent session the Changes view is narrowed to. */
+export interface SessionPick {
+ pane: string;
+ /** "Claude Code", "Codex", … as the pane shows it. */
+ agentName: string;
+ /** The pane's title, when it has one. */
+ title: string;
+}
+
+/**
+ * Every file one agent session wrote, committed or not, compared with the code
+ * before its first change. The files come from the agent's own record of its
+ * edits (and the commits its shell made), so other panes' work in the same
+ * folder stays out.
+ */
+export function SessionChanges({
+ workspaceId,
+ session,
+ status,
+ commands,
+ revision,
+ onDiff,
+ onClear,
+}: {
+ workspaceId: string;
+ session: SessionPick;
+ status: ScmStatus;
+ commands: ScmCommands;
+ /** Bumped when the repository changed: the list reads again. */
+ revision: string;
+ onDiff: (source: DiffSource) => void;
+ onClear: () => void;
+}) {
+ const t = useT();
+ const lang = useRunLocale();
+ const pushToast = useEventStore((state) => state.pushToast);
+ const [changes, setChanges] = useState<PaneChanges | null>(null);
+ const [error, setError] = useState("");
+ const [open, setOpen] = useState(true);
+ const [round, setRound] = useState(0);
+
+ useEffect(() => {
+ let alive = true;
+ loadPaneChanges({ workspaceId, pane: session.pane }, "pane", round > 0)
+ .then((answer) => {
+ if (!alive) return;
+ setChanges(answer);
+ setError("");
+ })
+ .catch((err: Error) => alive && setError(err.message));
+ const timer = window.setTimeout(() => setRound((value) => value + 1), POLL_MS);
+ return () => {
+ alive = false;
+ window.clearTimeout(timer);
+ };
+ }, [workspaceId, session.pane, revision, round]);
+
+ useEffect(() => {
+ setChanges(null);
+ setError("");
+ }, [workspaceId, session.pane]);
+
+ // Pending files can be staged or discarded like any other; their repository path carries the prefix.
+ const pending = useMemo(() => new Set(status.changes.map((file) => file.path)), [status.changes]);
+ const files = (changes?.files ?? []).filter((file) => !file.is_directory);
+ const repoPath = (file: ReviewFile) => `${changes?.ownCheckout ? "" : status.prefix}${file.path}`;
+ const actionable = (file: ReviewFile) => !changes?.ownCheckout && pending.has(repoPath(file));
+
+ const openDiff = (file: ReviewFile) => {
+ if (!changes?.base) {
+ // No base: an older reading of uncommitted files only. The editor's diff shows those.
+ if (changes?.ownCheckout) return pushToast("info", t("ide_side_panel.git.scm.outside_workspace"));
+ useCodeEditorStore.getState().openFile(workspaceId, file.path, { mode: "diff" });
+ return;
+ }
+ const base = changes.base;
+ onDiff({
+ title: `${baseName(file.path)} (${session.pane})`,
+ path: file.path,
+ load: () => scmApi.sessionFile(workspaceId, session.pane, file.path, base),
+ });
+ };
+
+ const since = changes?.sinceMs ? fill(t("ide_side_panel.git.scm.session_since"), { when: agoLabel(changes.sinceMs / 1000, lang, t) }) : "";
+ const stageable = files.filter(actionable).map(repoPath);
+
+ return (
+ <div data-testid="scm-session">
+ <div data-testid="scm-session-row" className="flex h-[22px] items-center pl-[8px] pr-[8px]" style={{ background: "var(--scm-hover)" }}>
+ <Codicon name="filter-filled" className="mr-[6px]" />
+ <QuickTooltip content={session.title || session.pane} side="bottom" className="flex min-w-0 flex-1 items-baseline overflow-hidden whitespace-nowrap">
+ <span className="truncate">
+ {session.agentName ? `${session.pane} · ${session.agentName}` : session.pane}
+ </span>
+ {since && <span className="ml-[0.5em] min-w-0 truncate text-[0.9em] opacity-70">{since}</span>}
+ </QuickTooltip>
+ <QuickTooltip content={t("ide_side_panel.git.scm.session_clear")} side="bottom" className="inline-flex shrink-0">
+ <button type="button" data-testid="scm-session-clear" aria-label={t("ide_side_panel.git.scm.session_clear")} onClick={onClear} className="scm-action">
+ <Codicon name="close" />
+ </button>
+ </QuickTooltip>
+ </div>
+ <div
+ role="treeitem"
+ aria-expanded={open}
+ data-testid="scm-group-session"
+ onClick={() => setOpen((value) => !value)}
+ style={{ height: ROW, paddingLeft: 8 }}
+ className="scm-row flex cursor-pointer select-none items-center pr-[12px]"
+ >
+ <Twistie open={open} />
+ <span className="min-w-0 flex-1 truncate">{t("ide_side_panel.git.scm.session_group")}</span>
+ {stageable.length > 0 && (
+ <span className="scm-actions shrink-0 items-center gap-[2px] pr-1">
+ <QuickTooltip content={t("ide_side_panel.git.scm.stage_session")} side="bottom" className="inline-flex shrink-0">
+ <button
+ type="button"
+ data-testid="scm-session-stage-all"
+ aria-label={t("ide_side_panel.git.scm.stage_session")}
+ onClick={(event) => {
+ event.stopPropagation();
+ void commands.stage(stageable);
+ }}
+ className="scm-action"
+ >
+ <Codicon name="add" />
+ </button>
+ </QuickTooltip>
+ </span>
+ )}
+ <span data-testid="scm-session-count" className="scm-badge ml-1 shrink-0 tabular-nums">
+ {files.length}
+ </span>
+ </div>
+ {open && (
+ <>
+ {!changes && !error && (
+ <div className="flex h-[22px] items-center" style={{ paddingLeft: 38 }}>
+ <Codicon name="loading" spin />
+ </div>
+ )}
+ {error && (
+ <p className="px-[20px] py-[4px] text-[13px]" style={{ color: "var(--scm-deleted)" }}>
+ {error}
+ </p>
+ )}
+ {changes && !changes.available && <p className="px-[20px] py-[4px] text-[13px] opacity-70">{changes.reason}</p>}
+ {changes?.available && files.length === 0 && (
+ <p data-testid="scm-session-empty" className="px-[20px] py-[4px] text-[13px] leading-[18px] opacity-70">
+ {t("ide_side_panel.git.scm.session_empty")}
+ </p>
+ )}
+ {files.map((file) => {
+ const letter = LETTER[file.status] ?? "M";
+ const tone = letterTone(letter);
+ const description = [dirName(file.path), file.committed ? t("ide_side_panel.git.scm.session_committed") : ""].filter(Boolean).join(" · ");
+ return (
+ <div
+ key={file.path}
+ role="treeitem"
+ data-testid="scm-session-file"
+ data-path={file.path}
+ data-letter={letter}
+ onClick={() => openDiff(file)}
+ style={{ height: ROW, paddingLeft: 16 }}
+ className="scm-row flex cursor-pointer select-none items-center"
+ >
+ <Twistie visible={false} />
+ <FileTypeIcon path={file.path} className="mr-[6px] h-4 w-4" />
+ <span className="flex min-w-0 flex-1 items-baseline overflow-hidden whitespace-nowrap">
+ <span className={cn("truncate", tone, letter === "D" && "line-through")}>{baseName(file.path)}</span>
+ {description && <span className="ml-[0.5em] min-w-0 truncate text-[0.9em] opacity-70">{description}</span>}
+ </span>
+ <span className="scm-actions shrink-0 items-center gap-[2px] pl-1">
+ {letter !== "D" && !changes?.ownCheckout && (
+ <button
+ type="button"
+ aria-label={t("ide_side_panel.git.scm.open_file")}
+ data-testid="scm-session-open"
+ onClick={(event) => {
+ event.stopPropagation();
+ useCodeEditorStore.getState().openFile(workspaceId, file.path, { preview: false });
+ }}
+ className="scm-action"
+ >
+ <Codicon name="go-to-file" />
+ </button>
+ )}
+ {actionable(file) && (
+ <>
+ <button
+ type="button"
+ aria-label={t("ide_side_panel.git.scm.discard_changes")}
+ data-testid="scm-session-discard"
+ onClick={(event) => {
+ event.stopPropagation();
+ void commands.discardFiles([{ path: repoPath(file), letter: letter === "A" ? "U" : letter }]);
+ }}
+ className="scm-action"
+ >
+ <Codicon name="discard" />
+ </button>
+ <button
+ type="button"
+ aria-label={t("ide_side_panel.git.scm.stage_changes")}
+ data-testid="scm-session-stage"
+ onClick={(event) => {
+ event.stopPropagation();
+ void commands.stage([repoPath(file)]);
+ }}
+ className="scm-action"
+ >
+ <Codicon name="add" />
+ </button>
+ </>
+ )}
+ </span>
+ {file.committed && (
+ <QuickTooltip content={t("ide_side_panel.git.scm.session_committed")} side="bottom" className="inline-flex shrink-0">
+ <Codicon name="git-commit" className="ml-[4px] opacity-70" />
+ </QuickTooltip>
+ )}
+ <span data-testid="scm-letter" className={cn("ml-[5px] mr-[12px] w-4 shrink-0 text-center text-[12px] font-semibold opacity-90", tone)}>
+ {letter}
+ </span>
+ </div>
+ );
+ })}
+ {changes && changes.generated > 0 && (
+ <p className="py-[2px] text-[12px] leading-[18px] opacity-70" style={{ paddingLeft: 38 }}>
+ {fill(t("ide_side_panel.git.scm.session_generated"), { n: changes.generated })}
+ </p>
+ )}
+ </>
+ )}
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/scm/scmApi.ts b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/scm/scmApi.ts
index cdec7dfc48..11e63e108f 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/scm/scmApi.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/scm/scmApi.ts
@@ -160,6 +160,8 @@ export const scmApi = {
commit: (workspace_id: string, commit: string) => get<CommitDetails>("/commit", { workspace_id, commit }),
commitFile: (workspace_id: string, commit: string, path: string, original = "") =>
get<CommitFileDiff>("/commit/file", { workspace_id, commit, path, original }),
+ sessionFile: (workspace_id: string, pane: string, path: string, base: string) =>
+ get<{ path: string; before: string | null; after: string | null; binary: boolean }>("/session-file", { workspace_id, pane, path, base }),
stashes: (workspace_id: string) => get<{ stashes: Stash[] }>("/stashes", { workspace_id }),
stage: (workspace_id: string, paths: string[]) => post("/stage", { workspace_id, paths }),
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index c86e3172b2..6dd5fe2706 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -5759,7 +5759,8 @@
"exited": "{agent} läuft nicht mehr in {pane}.",
"restart_aria": "{pane} neu starten",
"restart_title": "Ein frisches {agent} in {pane} starten",
- "restart": "Neu starten"
+ "restart": "Neu starten",
+ "show_in_git": "Änderungen von {pane} in Git anzeigen"
}
},
"prompt_writer": {
@@ -8236,7 +8237,19 @@
"view_tree": "Als Baum anzeigen",
"view_sort": "Ansicht & Sortierung",
"working_tree": "Arbeitsverzeichnis",
- "yes": "Ja"
+ "yes": "Ja",
+ "all_changes": "Alle Änderungen",
+ "sessions": "Agent-Sessions",
+ "pick_session": "Änderungen einer Agent-Session anzeigen",
+ "filter_session": "Änderungen einer Agent-Session anzeigen…",
+ "filtered_by": "Nur die Änderungen von {pane}",
+ "session_since": "seit {when}",
+ "session_clear": "Alle Änderungen anzeigen",
+ "session_group": "Änderungen der Session",
+ "stage_session": "Offene Änderungen der Session bereitstellen",
+ "session_empty": "Diese Session hat noch keine Datei geändert, oder ihr Agent führt kein Protokoll seiner Änderungen.",
+ "session_committed": "committet",
+ "session_generated": "{n} generierte Dateien ausgeblendet"
}
},
"skills": {
@@ -9255,7 +9268,8 @@
"runs_on": "Läuft auf {computer}. Arbeitet weiter, während diese App geschlossen ist.",
"worktree_branch": "Läuft in einem eigenen Git-Worktree auf Branch {branch}",
"drag_hint": "Zum Umsortieren ziehen, oder diesen Titel fokussieren und Alt mit einer Pfeiltaste drücken.",
- "add_beside": "Agent neben {pane} hinzufügen"
+ "add_beside": "Agent neben {pane} hinzufügen",
+ "show_in_git": "Änderungen in Git anzeigen"
},
"request_failed": "Anfrage fehlgeschlagen ({status}).",
"seam": {
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 720bbcd9dc..d1538bc90e 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -5759,7 +5759,8 @@
"exited": "{agent} is no longer running in {pane}.",
"restart_aria": "Restart {pane}",
"restart_title": "Start a fresh {agent} in {pane}",
- "restart": "Restart"
+ "restart": "Restart",
+ "show_in_git": "Show {pane}'s changes in Git"
}
},
"prompt_writer": {
@@ -8236,7 +8237,19 @@
"view_tree": "View as Tree",
"view_sort": "View & Sort",
"working_tree": "Working Tree",
- "yes": "Yes"
+ "yes": "Yes",
+ "all_changes": "All Changes",
+ "sessions": "Agent sessions",
+ "pick_session": "Show the changes of one agent session",
+ "filter_session": "Show One Agent Session's Changes…",
+ "filtered_by": "Showing only {pane}'s changes",
+ "session_since": "since {when}",
+ "session_clear": "Show All Changes",
+ "session_group": "Session Changes",
+ "stage_session": "Stage the Session's Pending Changes",
+ "session_empty": "This session has not changed any file yet, or its agent keeps no record of its edits.",
+ "session_committed": "committed",
+ "session_generated": "{n} generated files hidden"
}
},
"skills": {
@@ -9255,7 +9268,8 @@
"runs_on": "Runs on {computer}. It keeps working while this app is closed.",
"worktree_branch": "Runs in its own git worktree on branch {branch}",
"drag_hint": "Drag to reorder, or focus this title and press Alt with an arrow key.",
- "add_beside": "Add agent beside {pane}"
+ "add_beside": "Add agent beside {pane}",
+ "show_in_git": "Show changes in Git"
},
"request_failed": "Request failed ({status}).",
"seam": {
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index d65770d865..bea1fc0a4a 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -5759,7 +5759,8 @@
"exited": "{agent} ya no se está ejecutando en {pane}.",
"restart_aria": "Reiniciar {pane}",
"restart_title": "Iniciar un {agent} nuevo en {pane}",
- "restart": "Reiniciar"
+ "restart": "Reiniciar",
+ "show_in_git": "Mostrar los cambios de {pane} en Git"
}
},
"prompt_writer": {
@@ -8236,7 +8237,19 @@
"view_tree": "Ver como árbol",
"view_sort": "Vista y orden",
"working_tree": "Árbol de trabajo",
- "yes": "Sí"
+ "yes": "Sí",
+ "all_changes": "Todos los cambios",
+ "sessions": "Sesiones de agentes",
+ "pick_session": "Mostrar los cambios de una sesión de agente",
+ "filter_session": "Mostrar los cambios de una sesión de agente…",
+ "filtered_by": "Solo los cambios de {pane}",
+ "session_since": "desde {when}",
+ "session_clear": "Mostrar todos los cambios",
+ "session_group": "Cambios de la sesión",
+ "stage_session": "Preparar los cambios pendientes de la sesión",
+ "session_empty": "Esta sesión todavía no ha cambiado ningún archivo, o su agente no guarda registro de sus ediciones.",
+ "session_committed": "confirmado",
+ "session_generated": "{n} archivos generados ocultos"
}
},
"skills": {
@@ -9255,7 +9268,8 @@
"runs_on": "Se ejecuta en {computer}. Sigue trabajando aunque esta app esté cerrada.",
"worktree_branch": "Se ejecuta en su propio worktree de git en la rama {branch}",
"drag_hint": "Arrastra para reordenar, o enfoca este título y pulsa Alt con una flecha.",
- "add_beside": "Añadir agente junto a {pane}"
+ "add_beside": "Añadir agente junto a {pane}",
+ "show_in_git": "Mostrar cambios en Git"
},
"request_failed": "La solicitud ha fallado ({status}).",
"seam": {
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/pt.json b/jarvis/ui/web/frontend/src/i18n/locales/pt.json
index 3f888a688b..98545a66f0 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/pt.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/pt.json
@@ -5759,7 +5759,8 @@
"exited": "{agent} já não está a correr em {pane}.",
"restart_aria": "Reiniciar {pane}",
"restart_title": "Iniciar um {agent} novo em {pane}",
- "restart": "Reiniciar"
+ "restart": "Reiniciar",
+ "show_in_git": "Mostrar as alterações de {pane} no Git"
}
},
"prompt_writer": {
@@ -8236,7 +8237,19 @@
"view_tree": "Ver como árvore",
"view_sort": "Exibição e ordem",
"working_tree": "Árvore de trabalho",
- "yes": "Sim"
+ "yes": "Sim",
+ "all_changes": "Todas as alterações",
+ "sessions": "Sessões de agentes",
+ "pick_session": "Mostrar as alterações de uma sessão de agente",
+ "filter_session": "Mostrar as alterações de uma sessão de agente…",
+ "filtered_by": "Só as alterações de {pane}",
+ "session_since": "desde {when}",
+ "session_clear": "Mostrar todas as alterações",
+ "session_group": "Alterações da sessão",
+ "stage_session": "Preparar as alterações pendentes da sessão",
+ "session_empty": "Esta sessão ainda não alterou nenhum arquivo, ou o agente não guarda registro das edições.",
+ "session_committed": "com commit",
+ "session_generated": "{n} arquivos gerados ocultos"
}
},
"skills": {
@@ -9255,7 +9268,8 @@
"runs_on": "Corre em {computer}. Continua a trabalhar com esta app fechada.",
"worktree_branch": "Corre na sua própria worktree git no ramo {branch}",
"drag_hint": "Arrasta para reordenar, ou foca este título e prime Alt com uma tecla de seta.",
- "add_beside": "Adicionar agente ao lado de {pane}"
+ "add_beside": "Adicionar agente ao lado de {pane}",
+ "show_in_git": "Mostrar alterações no Git"
},
"request_failed": "O pedido falhou ({status}).",
"seam": {
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/zh.json b/jarvis/ui/web/frontend/src/i18n/locales/zh.json
index d31a9d6a5a..be0f9df75d 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/zh.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/zh.json
@@ -5759,7 +5759,8 @@
"exited": "{agent} 已不在 {pane} 中运行。",
"restart_aria": "重启 {pane}",
"restart_title": "在 {pane} 中重新启动一个 {agent}",
- "restart": "重启"
+ "restart": "重启",
+ "show_in_git": "在 Git 中显示 {pane} 的更改"
}
},
"prompt_writer": {
@@ -8236,7 +8237,19 @@
"view_tree": "以树形式查看",
"view_sort": "视图和排序",
"working_tree": "工作树",
- "yes": "是"
+ "yes": "是",
+ "all_changes": "所有更改",
+ "sessions": "代理会话",
+ "pick_session": "显示一个代理会话的更改",
+ "filter_session": "显示一个代理会话的更改…",
+ "filtered_by": "仅显示 {pane} 的更改",
+ "session_since": "自 {when}",
+ "session_clear": "显示所有更改",
+ "session_group": "会话更改",
+ "stage_session": "暂存该会话的待处理更改",
+ "session_empty": "此会话尚未更改任何文件,或其代理不记录编辑。",
+ "session_committed": "已提交",
+ "session_generated": "已隐藏 {n} 个生成的文件"
}
},
"skills": {
@@ -9255,7 +9268,8 @@
"runs_on": "在 {computer} 上运行。此应用关闭时它仍会继续工作。",
"worktree_branch": "在独立的 git worktree 中运行,分支 {branch}",
"drag_hint": "拖动以重新排序,或聚焦此标题后按 Alt 加方向键。",
- "add_beside": "在 {pane} 旁边添加智能体"
+ "add_beside": "在 {pane} 旁边添加智能体",
+ "show_in_git": "在 Git 中显示更改"
},
"request_failed": "请求失败({status})。",
"seam": {
diff --git a/jarvis/ui/web/frontend/src/store/gitSession.ts b/jarvis/ui/web/frontend/src/store/gitSession.ts
new file mode 100644
index 0000000000..cd79cfefbd
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/store/gitSession.ts
@@ -0,0 +1,27 @@
+import { create } from "zustand";
+
+/**
+ * A pane asking the Git tab to show only what its agent session changed.
+ *
+ * The button sits in the pane's header, the list lives in the side panel's
+ * Git tab, and neither reaches the other by props; the ask travels through
+ * here. The `nonce` lets the same pane be asked for twice in a row.
+ */
+export interface GitSessionRequest {
+ workspaceId: string;
+ /** The pane's call-sign (T1, or the name it was given). */
+ pane: string;
+ nonce: number;
+}
+
+interface GitSessionStore {
+ request: GitSessionRequest | null;
+ show: (workspaceId: string, pane: string) => void;
+}
+
+let nonce = 0;
+
+export const useGitSessionStore = create<GitSessionStore>((set) => ({
+ request: null,
+ show: (workspaceId, pane) => set({ request: { workspaceId, pane, nonce: ++nonce } }),
+}));
diff --git a/tests/unit/agentic_ide/test_scm.py b/tests/unit/agentic_ide/test_scm.py
index eeff55e488..dbb708f763 100644
--- a/tests/unit/agentic_ide/test_scm.py
+++ b/tests/unit/agentic_ide/test_scm.py
@@ -321,3 +321,23 @@ def test_status_parser_reads_conflicts_and_branch_headers() -> None:
assert _letters(status.staged) == {"both sides.txt": "M", "new name.txt": "R"}
assert status.staged[1].original == "old name.txt"
assert _letters(status.changes) == {"gone.txt": "D", "both sides.txt": "M", "fresh.txt": "U"}
+
+
+def test_session_file_diff_reads_the_base_and_the_disk(repo: Path) -> None:
+ base = _git(repo, "rev-parse", "HEAD")
+ # Bytes, so the disk side has the same line ending on every OS.
+ (repo / "app.py").write_bytes(b"print('agent')\n")
+ scm.commit(repo, "feat: agent work", all_changes=True)
+ (repo / "added.py").write_bytes(b"x = 1\n")
+ (repo / "old.txt").unlink()
+
+ changed = scm.session_file_diff(repo, "app.py", base)
+ assert changed["before"] == "print('hi')\n" and changed["after"] == "print('agent')\n"
+ added = scm.session_file_diff(repo, "added.py", base)
+ assert added["before"] is None and added["after"] == "x = 1\n"
+ gone = scm.session_file_diff(repo, "old.txt", base)
+ assert gone["before"] == "old\n" and gone["after"] is None
+ with pytest.raises(GitError):
+ scm.session_file_diff(repo, "../outside.txt", base)
+ with pytest.raises(GitError):
+ scm.session_file_diff(repo, "app.py", "not-a-commit")