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(ide): split Changes and Folder into their own side-panel tabs and name the agent behind each change

rubenluetke10-beepdf31da92ede5
diff --git a/jarvis/agentic_ide/agent_transcript.py b/jarvis/agentic_ide/agent_transcript.py
index 194960b88f..b2e4daf79a 100644
--- a/jarvis/agentic_ide/agent_transcript.py
+++ b/jarvis/agentic_ide/agent_transcript.py
@@ -1096,7 +1096,8 @@ def _codex_events(session_id: str, home: Path | None, live: bool) -> list[dict[s
log.text(joined, item_id, ts)
# `developer` is the harness briefing the model — not conversation.
elif ptype in ("function_call", "local_shell_call", "custom_tool_call"):
- arguments = payload.get("arguments")
+ # A custom tool (apply_patch) carries its body as `input`, not `arguments`.
+ arguments = payload.get("arguments", payload.get("input"))
if isinstance(arguments, str):
try:
arguments = json.loads(arguments)
diff --git a/jarvis/agentic_ide/change_authors.py b/jarvis/agentic_ide/change_authors.py
new file mode 100644
index 0000000000..1432aabb68
--- /dev/null
+++ b/jarvis/agentic_ide/change_authors.py
@@ -0,0 +1,229 @@
+"""Which coding agent changed which file, read from the agents' own records.
+
+Git says WHAT changed in a workspace; it cannot say WHO — every pane writes
+through the same working tree. The coding CLIs, though, write down every tool
+call they make, with its arguments (:mod:`.agent_transcript`). A file-writing
+call names the file it wrote, so the Changes tab can put the agent next to
+each changed file without guessing from the screen.
+
+Deliberately narrow:
+
+* **Only writing tools count.** A call whose tool name says it writes (edit,
+ write, patch, replace, create, notebook) and that did not fail. A file an
+ agent changed through a shell command (``sed -i``, a formatter, a build) has
+ no author here — an honest blank beats a wrong name.
+* **Only panes still in the workspace.** Their records are what can be read;
+ a closed pane's edits keep their diff, just without a name.
+* **Capability, not product.** Every CLI with a readable record goes through
+ the same event vocabulary; no branch on which CLI wrote it (AP-21).
+* **Cached.** The Changes tab polls every few seconds; a record is re-read at
+ most every :data:`CACHE_TTL_S` per pane, off the event loop by the caller.
+
+Cross-platform: paths are compared as resolved :class:`~pathlib.Path` objects
+and answered as POSIX paths relative to the workspace root, the same shape
+:mod:`.git_changes` uses.
+"""
+
+from __future__ import annotations
+
+import re
+import time
+from collections.abc import Callable, Iterable
+from dataclasses import dataclass
+from pathlib import Path, PurePosixPath
+from typing import Any
+
+from loguru import logger
+
+from . import agent_transcript
+
+#: How long one pane's list of written files is reused before its record is read again.
+CACHE_TTL_S = 20.0
+
+#: A tool whose name says it writes a file. Read-only tools (Read, Grep, Glob,
+#: view) never match; ``shell``/``Bash`` never match either — see the module doc.
+_WRITING_TOOL = re.compile(r"edit|write|patch|replace|create|notebook", re.IGNORECASE)
+
+#: The arguments a writing tool names its file in, across the CLIs.
+_PATH_KEYS = (
+ "file_path",
+ "path",
+ "target_file",
+ "filePath",
+ "absolute_path",
+ "AbsolutePath",
+ "notebook_path",
+ "TargetFile",
+)
+
+#: A file header inside an apply_patch body (Codex and the CLIs that copied it).
+_PATCH_FILE = re.compile(
+ r"^\*\*\* (?:Update|Add|Delete) File: (.+?)\s*$|^\*\*\* Move to: (.+?)\s*$", re.MULTILINE
+)
+
+
+@dataclass(frozen=True, slots=True)
+class PaneRecord:
+ """What is needed to read one pane's record."""
+
+ pane: str
+ history_id: str
+ agent: str
+ display_name: str
+ session_id: str
+ home: Path | None
+ #: Where the pane's agent runs, which relative paths in its calls resolve against.
+ folder: str
+
+
+@dataclass(frozen=True, slots=True)
+class ChangeAuthor:
+ pane: str
+ history_id: str
+ agent: str
+ display_name: str
+ #: When this pane last wrote the file (epoch milliseconds), 0 when unknown.
+ last_edit_ms: int
+
+
+def _patch_paths(value: Any) -> list[str]:
+ """Every file an apply_patch body names, found in any string argument."""
+ found: list[str] = []
+ stack = [value]
+ while stack:
+ item = stack.pop()
+ if isinstance(item, str):
+ if "*** " in item:
+ found.extend(a or b for a, b in _PATCH_FILE.findall(item))
+ elif isinstance(item, dict):
+ stack.extend(item.values())
+ elif isinstance(item, list | tuple):
+ stack.extend(item)
+ return found
+
+
+def written_paths(events: Iterable[dict[str, Any]]) -> dict[str, int]:
+ """``{path as written in the call: last write ms}`` for successful writing calls."""
+ calls: dict[str, tuple[list[str], int]] = {}
+ failed: set[str] = set()
+ for event in events:
+ kind = event.get("kind")
+ payload = event.get("payload") or {}
+ if kind == "tool_result" and payload.get("is_error"):
+ failed.add(str(payload.get("call_id")))
+ continue
+ if kind != "tool_call":
+ continue
+ name = str(payload.get("name") or "")
+ if not _WRITING_TOOL.search(name):
+ continue
+ args = payload.get("input")
+ paths: list[str] = []
+ if isinstance(args, dict):
+ for key in _PATH_KEYS:
+ value = args.get(key)
+ if isinstance(value, str) and value.strip():
+ paths.append(value.strip())
+ break
+ paths.extend(_patch_paths(args))
+ if paths:
+ calls[str(payload.get("call_id"))] = (paths, int(event.get("ts_ms") or 0))
+ out: dict[str, int] = {}
+ for call_id, (paths, ts) in calls.items():
+ if call_id in failed:
+ continue
+ for path in paths:
+ out[path] = max(out.get(path, 0), ts)
+ return out
+
+
+def _relative(raw: str, base: Path, root: Path) -> str | None:
+ """``raw`` as a POSIX path relative to ``root``, or None when outside it."""
+ candidate = Path(raw.strip().strip('"'))
+ if not candidate.is_absolute():
+ candidate = base / candidate
+ try:
+ relative = candidate.resolve(strict=False).relative_to(root)
+ except (ValueError, OSError):
+ return None
+ text = PurePosixPath(*relative.parts).as_posix()
+ return None if text in ("", ".") else text
+
+
+Reader = Callable[[PaneRecord], list[dict[str, Any]] | None]
+
+
+def _read_events(record: PaneRecord) -> list[dict[str, Any]] | None:
+ return agent_transcript.read_events(record.agent, record.session_id, home=record.home)
+
+
+_cache: dict[tuple[str, str], tuple[float, dict[str, int]]] = {}
+
+
+def _pane_writes(record: PaneRecord, reader: Reader, now: float) -> dict[str, int]:
+ key = (record.history_id, record.session_id)
+ cached = _cache.get(key)
+ if cached is not None and now - cached[0] < CACHE_TTL_S:
+ return cached[1]
+ try:
+ events = reader(record) or []
+ except Exception as exc: # a record the CLI rewrote mid-read: no names this round
+ logger.info("Change authors: pane {} record unreadable: {}", record.pane, exc)
+ events = []
+ writes = written_paths(events)
+ _cache[key] = (now, writes)
+ return writes
+
+
+def change_authors(
+ workspace_folder: str | Path,
+ panes: Iterable[PaneRecord],
+ *,
+ reader: Reader = _read_events,
+ now: float | None = None,
+) -> dict[str, list[ChangeAuthor]]:
+ """``{workspace-relative path: authors, newest edit first}``."""
+ root = Path(workspace_folder).expanduser().resolve(strict=False)
+ moment = time.monotonic() if now is None else now
+ for key in [k for k, (at, _w) in _cache.items() if moment - at > 10 * CACHE_TTL_S]:
+ del _cache[key]
+ by_path: dict[str, list[ChangeAuthor]] = {}
+ for record in panes:
+ base = Path(record.folder or root).expanduser()
+ # One pane may spell one file two ways (relative, then absolute).
+ latest: dict[str, int] = {}
+ for raw, ts in _pane_writes(record, reader, moment).items():
+ relative = _relative(raw, base, root)
+ if relative is not None:
+ latest[relative] = max(latest.get(relative, 0), ts)
+ for relative, ts in latest.items():
+ by_path.setdefault(relative, []).append(
+ ChangeAuthor(
+ pane=record.pane,
+ history_id=record.history_id,
+ agent=record.agent,
+ display_name=record.display_name,
+ last_edit_ms=ts,
+ )
+ )
+ for authors in by_path.values():
+ authors.sort(key=lambda author: author.last_edit_ms, reverse=True)
+ return by_path
+
+
+def authors_for(
+ path: str, is_directory: bool, by_path: dict[str, list[ChangeAuthor]]
+) -> list[ChangeAuthor]:
+ """The authors of one git entry; an untracked folder gathers everything inside it."""
+ if not is_directory:
+ return by_path.get(path, [])
+ prefix = path.rstrip("/") + "/"
+ newest: dict[str, ChangeAuthor] = {}
+ for written, authors in by_path.items():
+ if not written.startswith(prefix):
+ continue
+ for author in authors:
+ known = newest.get(author.history_id)
+ if known is None or author.last_edit_ms > known.last_edit_ms:
+ newest[author.history_id] = author
+ return sorted(newest.values(), key=lambda author: author.last_edit_ms, reverse=True)
diff --git a/jarvis/ui/web/agentic_ide_routes.py b/jarvis/ui/web/agentic_ide_routes.py
index 09ff1288e2..fbdfeb1416 100644
--- a/jarvis/ui/web/agentic_ide_routes.py
+++ b/jarvis/ui/web/agentic_ide_routes.py
@@ -81,6 +81,7 @@ from pydantic import BaseModel, Field
from jarvis.agentic_ide import (
agent_transcript,
+ change_authors,
drop_analysis,
drops,
git_changes,
@@ -829,6 +830,16 @@ class WorkspaceFilesResponse(BaseModel):
error: str | None = None
+class ChangeAuthorItem(BaseModel):
+ """A pane whose coding agent wrote a changed file, by its own record."""
+
+ pane: str = Field(description="The pane's call-sign, e.g. 'T3'.")
+ history_id: str
+ agent: str
+ display_name: str
+ last_edit_ms: int = Field(default=0, description="When it last wrote the file; 0 if unknown.")
+
+
class ChangedFileItem(BaseModel):
"""One path an agent changed, relative to the workspace root."""
@@ -837,6 +848,10 @@ class ChangedFileItem(BaseModel):
added: int | None = Field(default=None, description="Lines added; null when unknown.")
removed: int | None = Field(default=None, description="Lines removed; null when unknown.")
is_directory: bool = False
+ authors: list[ChangeAuthorItem] = Field(
+ default_factory=list,
+ description="Panes whose agent wrote this file, newest first; empty when unknown.",
+ )
class WorkspaceChangesResponse(BaseModel):
@@ -1635,11 +1650,36 @@ async def get_workspace_changes(workspace_id: str) -> WorkspaceChangesResponse:
if session is None:
raise HTTPException(status_code=404, detail="Workspace not found.")
changes = await asyncio.to_thread(git_changes.workspace_changes, session.folder)
+ authors: dict[str, list[change_authors.ChangeAuthor]] = {}
+ if changes.files:
+ records = [
+ change_authors.PaneRecord(
+ pane=term.name,
+ history_id=term.history_id,
+ agent=term.agent,
+ display_name=term.display_name,
+ session_id=term.resume.id,
+ home=account_home(term.agent, term.account),
+ folder=term.folder or session.folder,
+ )
+ for term in session.terminals
+ if term.resume is not None and agent_transcript.can_read(term.agent)
+ ]
+ authors = await asyncio.to_thread(change_authors.change_authors, session.folder, records)
return WorkspaceChangesResponse(
workspace_id=workspace_id,
available=changes.available,
branch=changes.branch,
- files=[ChangedFileItem(**asdict(item)) for item in changes.files],
+ files=[
+ ChangedFileItem(
+ **asdict(item),
+ authors=[
+ ChangeAuthorItem(**asdict(a))
+ for a in change_authors.authors_for(item.path, item.is_directory, authors)
+ ],
+ )
+ for item in changes.files
+ ],
truncated=changes.truncated,
reason=changes.reason,
)
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx
index e271dc3e90..407e6f9435 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx
@@ -65,7 +65,7 @@ describe("IdeSidePanel", () => {
});
it("disables + while every tab is already open", () => {
- act(() => useIdeSidePanelStore.setState({ open: true, tabs: ["agents", "files"], active: "agents" }));
+ act(() => useIdeSidePanelStore.setState({ open: true, tabs: ["agents", "changes", "files"], active: "agents" }));
render(<Harness />);
expect((screen.getByTestId("ide-side-panel-add") as HTMLButtonElement).disabled).toBe(true);
});
@@ -91,7 +91,8 @@ describe("IdeSidePanel", () => {
render(<Harness />);
const rail = screen.getByTestId("ide-side-panel-rail");
expect(rail.textContent).toContain("Agents");
- expect(rail.textContent).toContain("Explorer");
+ expect(rail.textContent).toContain("Changes");
+ expect(rail.textContent).toContain("Folder");
fireEvent.click(screen.getByTestId("ide-side-panel-rail-files"));
expect(useIdeSidePanelStore.getState()).toMatchObject({ open: true, active: "files" });
expect(screen.queryByTestId("ide-side-panel-rail")).toBeNull();
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx
index f64b20ecd4..63ce1d9e12 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx
@@ -283,7 +283,8 @@ export function IdeSidePanel() {
<PanelRightClose className="h-4 w-4" aria-hidden />
</button>
</div>
- <div id={`${SIDE_PANEL_ID}-content`} role="tabpanel" className="min-h-0 flex-1">
+ {/* Keyed by tab: Changes and Folder share one component and must not share its state. */}
+ <div key={active} id={`${SIDE_PANEL_ID}-content`} role="tabpanel" className="min-h-0 flex-1">
{current?.render()}
</div>
</aside>
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/explorer/ExplorerPanel.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/explorer/ExplorerPanel.test.tsx
index 396576eb9a..0705ae729d 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/explorer/ExplorerPanel.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/explorer/ExplorerPanel.test.tsx
@@ -16,7 +16,14 @@ const CHANGES = {
truncated: false,
reason: "",
files: [
- { path: "src/app.ts", status: "modified", added: 3, removed: 1, is_directory: false },
+ {
+ path: "src/app.ts",
+ status: "modified",
+ added: 3,
+ removed: 1,
+ is_directory: false,
+ authors: [{ pane: "T2", history_id: "h2", agent: "codex", display_name: "Codex", last_edit_ms: 5 }],
+ },
{ path: "old.md", status: "deleted", added: 0, removed: 4, is_directory: false },
],
};
@@ -64,8 +71,8 @@ beforeEach(() => {
}));
useEventStore.setState({ activeSection: "agentic-ide" });
useIdeChatStore.setState({ workspace: { id: "w1", name: "App", path: "/code/app" }, stagedPane: null });
- useIdeExplorerStore.setState({ view: "changes", opened: null });
- useIdeSidePanelStore.setState({ open: false, tabs: ["agents", "files"], active: "agents" });
+ useIdeExplorerStore.setState({ opened: { changes: null, files: null } });
+ useIdeSidePanelStore.setState({ open: false, tabs: ["agents", "changes", "files"], active: "agents" });
});
afterEach(() => {
@@ -75,7 +82,7 @@ afterEach(() => {
describe("ExplorerPanel", () => {
it("lists what changed — deleted red, edited green — with line counts and the branch", async () => {
- render(<ExplorerPanel />);
+ render(<ExplorerPanel view="changes" />);
const rows = await screen.findAllByTestId("explorer-change-row");
expect(rows.map((row) => row.dataset.path)).toEqual(["src/app.ts", "old.md"]);
expect(rows[0].textContent).toContain("+3");
@@ -85,8 +92,18 @@ describe("ExplorerPanel", () => {
expect(screen.getByTestId("explorer-branch").textContent).toBe("main");
});
+ it("names the coding agent that changed a file, and only where one is known", async () => {
+ render(<ExplorerPanel view="changes" />);
+ const rows = await screen.findAllByTestId("explorer-change-row");
+ const authors = rows[0].querySelector('[data-testid="explorer-change-authors"]');
+ expect(authors?.textContent).toContain("Codex");
+ expect(authors?.getAttribute("title")).toContain("T2");
+ expect(rows[1].querySelector('[data-testid="explorer-change-authors"]')).toBeNull();
+ expect(screen.queryByRole("tablist")).toBeNull();
+ });
+
it("hands a terminal the absolute path when a row is dragged", async () => {
- render(<ExplorerPanel />);
+ render(<ExplorerPanel view="changes" />);
const [row] = await screen.findAllByTestId("explorer-change-row");
const data: Record<string, string> = {};
const dataTransfer = { setData: (type: string, value: string) => { data[type] = value; }, effectAllowed: "" };
@@ -95,7 +112,7 @@ describe("ExplorerPanel", () => {
});
it("opens a changed file as a diff with removed and added lines", async () => {
- render(<ExplorerPanel />);
+ render(<ExplorerPanel view="changes" />);
const [row] = await screen.findAllByTestId("explorer-change-row");
fireEvent.click(row);
const diff = await screen.findByTestId("explorer-diff");
@@ -105,9 +122,8 @@ describe("ExplorerPanel", () => {
expect(diff.querySelector('[data-kind="add"]')?.className).toContain("bg-success/10");
});
- it("shows the folder as a lazy tree in the Files view", async () => {
- useIdeExplorerStore.setState({ view: "files" });
- render(<ExplorerPanel />);
+ it("shows the folder as a lazy tree in the Folder tab", async () => {
+ render(<ExplorerPanel view="files" />);
await waitFor(() => expect(screen.getAllByTestId("explorer-tree-row")).toHaveLength(2));
const rows = screen.getAllByTestId("explorer-tree-row");
expect(rows.map((row) => row.dataset.path)).toEqual(["src", "README.md"]);
@@ -117,12 +133,12 @@ describe("ExplorerPanel", () => {
});
describe("terminal path clicks", () => {
- it("open the file in the Explorer instead of the OS when the IDE is mounted", async () => {
+ it("open the file in the Folder tab instead of the OS when the IDE is mounted", async () => {
renderHook(() => useExplorerPathRouting());
act(() =>
activateTerminalLink(new MouseEvent("click", { button: 0, ctrlKey: true }), "src/app.ts", { workspaceId: "w1" }),
);
- expect(useIdeExplorerStore.getState().opened).toEqual({ workspaceId: "w1", path: "src/app.ts" });
+ expect(useIdeExplorerStore.getState().opened.files).toEqual({ workspaceId: "w1", path: "src/app.ts" });
expect(useIdeSidePanelStore.getState()).toMatchObject({ open: true, active: "files" });
expect(calls.some((url) => url.includes("terminal-target"))).toBe(false);
});
@@ -130,7 +146,7 @@ describe("terminal path clicks", () => {
it("fall back to the OS for another workspace's pane", () => {
renderHook(() => useExplorerPathRouting());
activateTerminalLink(new MouseEvent("click", { button: 0, ctrlKey: true }), "src/app.ts", { workspaceId: "w9" });
- expect(useIdeExplorerStore.getState().opened).toBeNull();
+ expect(useIdeExplorerStore.getState().opened.files).toBeNull();
expect(calls.some((url) => url.includes("terminal-target"))).toBe(true);
});
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/explorer/ExplorerPanel.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/explorer/ExplorerPanel.tsx
index 7fb81ed624..4eef504a6f 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/explorer/ExplorerPanel.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/explorer/ExplorerPanel.tsx
@@ -24,14 +24,18 @@ import {
type WorkspaceFilePreviewResponse,
} from "@/lib/agenticIdeApi";
import { WORKSPACE_PATH_TYPE } from "@/components/agentic/paneDrop";
+import { AgentMark } from "@/components/agentic/AgentMark";
import { useEventStore } from "@/store/events";
import { useIdeChatStore } from "@/store/ideChat";
-import { useIdeExplorerStore } from "@/store/ideExplorer";
+import { useIdeExplorerStore, type ExplorerView } from "@/store/ideExplorer";
+import { paneTitleFrom, usePaneRecapPoll, usePaneRecapsStore } from "@/store/paneRecaps";
+import { useWorkspacePanesStore } from "@/store/workspacePanes";
import { DiffView } from "./DiffView";
import {
absoluteWorkspacePath,
fetchFileDiff,
fetchWorkspaceChanges,
+ type ChangeAuthor,
type ChangeStatus,
type ChangedFile,
type FileDiff,
@@ -39,7 +43,7 @@ import {
} from "./explorerApi";
import { fileIcon } from "./fileIcon";
-/** How often git is asked what changed while the Explorer is on screen. */
+/** How often git is asked what changed while the Changes or Folder tab is on screen. */
const CHANGES_POLL_MS = 6000;
const CHANGES_JITTER_MS = 1200;
@@ -127,18 +131,60 @@ function StatusLetter({ status }: { status: ChangeStatus }) {
}
/**
- * The Explorer tab: the workspace's folder as a tree, what the agents changed,
- * and any file's diff — drag a row onto a terminal to reference that file.
+ * Which coding agents wrote a changed file: each one's brand mark and the
+ * pane's title (its call-sign's CLI when it has none yet), newest first.
*/
-export function ExplorerPanel() {
+function ChangeAuthors({ authors, workspaceId }: { authors: ChangeAuthor[]; workspaceId: string }) {
+ const t = useT();
+ const recaps = usePaneRecapsStore((state) => (state.workspaceId === workspaceId ? state.byName : undefined));
+ const rows = useWorkspacePanesStore((state) => state.panes);
+ if (authors.length === 0) return null;
+ const named = authors.map((author) => {
+ const row = rows.find((pane) => pane.history_id === author.history_id);
+ const title = paneTitleFrom(recaps?.[author.pane], row);
+ return { ...author, label: title || author.display_name || author.agent };
+ });
+ const who = named.map((author) => `${author.label} (${author.pane}, ${author.display_name})`).join(", ");
+ const [first, ...rest] = named;
+ return (
+ <span
+ data-testid="explorer-change-authors"
+ title={fill(t("ide_side_panel.explorer.changed_by"), { who })}
+ className="flex min-w-0 max-w-[60%] shrink items-center gap-1 text-[10.5px] text-muted-foreground"
+ >
+ <span className="flex shrink-0 items-center -space-x-1">
+ {named.slice(0, 3).map((author) => (
+ <AgentMark
+ key={author.history_id}
+ agent={author.agent}
+ label={author.display_name}
+ size="sm"
+ variant="plain"
+ className="h-3.5 w-3.5"
+ />
+ ))}
+ </span>
+ <span className="truncate">{first.label}</span>
+ {rest.length > 0 && <span className="shrink-0 tabular-nums">+{rest.length}</span>}
+ </span>
+ );
+}
+
+/**
+ * The Changes tab (what the agents changed, and which agent) or the Folder tab
+ * (the workspace's folder as a tree); either opens any file's diff — drag a
+ * row onto a terminal to reference that file.
+ */
+export function ExplorerPanel({ view }: { view: ExplorerView }) {
const t = useT();
const workspace = useIdeChatStore((state) => state.workspace);
const stagedPane = useIdeChatStore((state) => state.stagedPane);
- const view = useIdeExplorerStore((state) => state.view);
- const setView = useIdeExplorerStore((state) => state.setView);
- const opened = useIdeExplorerStore((state) => state.opened);
- const open = useIdeExplorerStore((state) => state.open);
- const close = useIdeExplorerStore((state) => state.close);
+ const opened = useIdeExplorerStore((state) => state.opened[view]);
+ const openIn = useIdeExplorerStore((state) => state.open);
+ const closeIn = useIdeExplorerStore((state) => state.close);
+ const close = () => closeIn(view);
+ // Pane titles for the "changed by" line.
+ usePaneRecapPoll();
const pushToast = useEventStore((state) => state.pushToast);
const [filter, setFilter] = useState("");
const workspaceId = workspace?.id ?? null;
@@ -195,10 +241,16 @@ export function ExplorerPanel() {
const needle = filter.trim().toLowerCase();
const changedFiles = (changes?.files ?? []).filter((file) => !needle || file.path.toLowerCase().includes(needle));
- const openFile = (path: string) => open({ workspaceId, path });
+ const openFile = (path: string) => openIn(view, { workspaceId, path });
+ const changeCount = changes?.files.length ?? 0;
return (
- <section data-testid="ide-explorer" aria-label={t("ide_side_panel.explorer.aria")} className="flex h-full min-h-0 flex-col">
+ <section
+ data-testid="ide-explorer"
+ data-view={view}
+ aria-label={t(view === "changes" ? "ide_side_panel.tabs.changes" : "ide_side_panel.tabs.files")}
+ className="flex h-full min-h-0 flex-col"
+ >
<div className="shrink-0 space-y-2 border-b border-border/60 px-3 pb-2.5 pt-3">
<div className="flex items-center gap-2">
<FolderOpen className="h-4 w-4 shrink-0 text-muted-foreground" aria-hidden />
@@ -214,6 +266,14 @@ export function ExplorerPanel() {
<span className="truncate">{changes.branch}</span>
</span>
)}
+ {view === "changes" && changeCount > 0 && (
+ <span
+ data-testid="explorer-change-count"
+ className="shrink-0 rounded bg-success/15 px-1 text-[10px] tabular-nums text-success"
+ >
+ {changeCount}
+ </span>
+ )}
<button
type="button"
onClick={refresh}
@@ -224,27 +284,6 @@ export function ExplorerPanel() {
<RefreshCw className="h-3.5 w-3.5" aria-hidden />
</button>
</div>
- <div role="tablist" aria-label={t("ide_side_panel.explorer.views")} className="grid grid-cols-2 gap-1 rounded-lg bg-muted/60 p-0.5">
- {(["changes", "files"] as const).map((id) => (
- <button
- key={id}
- type="button"
- role="tab"
- aria-selected={view === id}
- data-testid={`explorer-view-${id}`}
- onClick={() => setView(id)}
- className={cn(
- "flex h-7 items-center justify-center gap-1.5 rounded-md text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
- view === id ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground",
- )}
- >
- {t(`ide_side_panel.explorer.view_${id}`)}
- {id === "changes" && (changes?.files.length ?? 0) > 0 && (
- <span className="rounded bg-success/15 px-1 text-[10px] tabular-nums text-success">{changes?.files.length}</span>
- )}
- </button>
- ))}
- </div>
<label className="flex h-8 items-center gap-2 rounded-lg border border-border/60 bg-background/50 px-2.5 focus-within:border-ring">
<Search className="h-3.5 w-3.5 shrink-0 text-muted-foreground" aria-hidden />
<input
@@ -283,6 +322,7 @@ export function ExplorerPanel() {
<ul data-testid="explorer-changes">
{changedFiles.map((file) => {
const Icon = file.is_directory ? Folder : fileIcon(file.path);
+ const authors = file.authors ?? [];
return (
<li key={file.path}>
<button
@@ -293,15 +333,25 @@ export function ExplorerPanel() {
data-testid="explorer-change-row"
data-path={file.path}
title={`${file.path} — ${t("ide_side_panel.explorer.drag_hint")}`}
- className="group flex h-9 w-full items-center gap-2 px-3 text-left hover:bg-muted/60 focus-visible:bg-muted/60 focus-visible:outline-none"
+ className="group flex min-h-9 w-full items-center gap-2 px-3 py-1 text-left hover:bg-muted/60 focus-visible:bg-muted/60 focus-visible:outline-none"
>
<Icon className={cn("h-4 w-4 shrink-0", STATUS_TONE[file.status])} aria-hidden />
<span className="flex min-w-0 flex-1 flex-col leading-tight">
<span className={cn("truncate text-[13px] text-foreground", file.status === "deleted" && "line-through decoration-destructive/60")}>
{baseName(file.path)}
</span>
- {parentPath(file.path) && (
- <span className="truncate text-[10.5px] text-muted-foreground">{parentPath(file.path)}</span>
+ {(parentPath(file.path) || authors.length > 0) && (
+ <span className="flex min-w-0 items-center gap-1.5">
+ {parentPath(file.path) && (
+ <span className="min-w-0 truncate text-[10.5px] text-muted-foreground">{parentPath(file.path)}</span>
+ )}
+ {parentPath(file.path) && authors.length > 0 && (
+ <span className="shrink-0 text-[10.5px] text-muted-foreground/60" aria-hidden>
+ ·
+ </span>
+ )}
+ <ChangeAuthors authors={authors} workspaceId={workspaceId} />
+ </span>
)}
</span>
<ChangeCounts file={file} />
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/explorer/explorerApi.ts b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/explorer/explorerApi.ts
index 5f0a5926d8..6aab5cae4c 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/explorer/explorerApi.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/explorer/explorerApi.ts
@@ -2,6 +2,17 @@
export type ChangeStatus = "modified" | "added" | "deleted" | "untracked" | "conflicted";
+/** A pane whose coding agent wrote a changed file, read from that agent's own record. */
+export interface ChangeAuthor {
+ /** The pane's call-sign, e.g. "T3". */
+ pane: string;
+ history_id: string;
+ agent: string;
+ display_name: string;
+ /** When it last wrote the file (epoch ms); 0 when unknown. */
+ last_edit_ms: number;
+}
+
export interface ChangedFile {
/** POSIX path relative to the workspace root. */
path: string;
@@ -9,6 +20,8 @@ export interface ChangedFile {
added: number | null;
removed: number | null;
is_directory: boolean;
+ /** Newest first; empty when no agent's record names the file (a shell edit, a closed pane). */
+ authors?: ChangeAuthor[];
}
export interface WorkspaceChanges {
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/sidePanelTabs.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/sidePanelTabs.tsx
index 3dac728aef..d99c333d0a 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/sidePanelTabs.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/sidePanelTabs.tsx
@@ -1,5 +1,5 @@
import type { ReactNode } from "react";
-import { Bot, FolderTree, type LucideIcon } from "lucide-react";
+import { Bot, FileDiff, FolderTree, type LucideIcon } from "lucide-react";
import type { SidePanelTabId } from "@/store/ideSidePanel";
import { AgentsOverview } from "./AgentsOverview";
import { ExplorerPanel } from "./explorer/ExplorerPanel";
@@ -27,11 +27,17 @@ export const SIDE_PANEL_TABS: readonly SidePanelTabDef[] = [
icon: Bot,
render: () => <AgentsOverview />,
},
+ {
+ id: "changes",
+ labelKey: "ide_side_panel.tabs.changes",
+ icon: FileDiff,
+ render: () => <ExplorerPanel view="changes" />,
+ },
{
id: "files",
labelKey: "ide_side_panel.tabs.files",
icon: FolderTree,
- render: () => <ExplorerPanel />,
+ render: () => <ExplorerPanel view="files" />,
},
];
diff --git a/jarvis/ui/web/frontend/src/store/ideExplorer.ts b/jarvis/ui/web/frontend/src/store/ideExplorer.ts
index f3d3587cc2..4be85c9f49 100644
--- a/jarvis/ui/web/frontend/src/store/ideExplorer.ts
+++ b/jarvis/ui/web/frontend/src/store/ideExplorer.ts
@@ -6,12 +6,13 @@ import { useIdeChatStore } from "@/store/ideChat";
import { useIdeSidePanelStore } from "@/store/ideSidePanel";
/**
- * The Explorer tab's state: which list it shows and which file is open.
+ * The Changes and Folder tabs' state: which file each of them has open.
*
* Kept outside the component because a file can be opened from elsewhere: a
* Ctrl+click on a path a coding agent printed in its terminal lands here (see
- * `OPEN_PATH_EVENT`), opens the side panel on the Explorer, and shows that
- * file's diff.
+ * `OPEN_PATH_EVENT`), opens the side panel on the Folder tab, and shows that
+ * file's diff. Each tab keeps its own open file, so opening one in Changes
+ * does not cover the tree in Folder.
*/
export type ExplorerView = "files" | "changes";
@@ -22,19 +23,15 @@ export interface OpenedFile {
}
interface IdeExplorerState {
- view: ExplorerView;
- opened: OpenedFile | null;
- setView: (view: ExplorerView) => void;
- open: (file: OpenedFile) => void;
- close: () => void;
+ opened: Record<ExplorerView, OpenedFile | null>;
+ open: (view: ExplorerView, file: OpenedFile) => void;
+ close: (view: ExplorerView) => void;
}
export const useIdeExplorerStore = create<IdeExplorerState>((set) => ({
- view: "changes",
- opened: null,
- setView: (view) => set({ view }),
- open: (file) => set({ opened: file }),
- close: () => set({ opened: null }),
+ opened: { files: null, changes: null },
+ open: (view, file) => set((state) => ({ opened: { ...state.opened, [view]: file } })),
+ close: (view) => set((state) => ({ opened: { ...state.opened, [view]: null } })),
}));
export interface OpenPathDetail {
@@ -42,14 +39,14 @@ export interface OpenPathDetail {
path: string;
}
-/** Open a file in the side panel's Explorer, bringing the panel up if needed. */
+/** Open a file in the side panel's Folder tab, bringing the panel up if needed. */
export function openInExplorer(file: OpenedFile): void {
- useIdeExplorerStore.getState().open(file);
+ useIdeExplorerStore.getState().open("files", file);
useIdeSidePanelStore.getState().openTab("files");
}
/**
- * Route terminal path clicks into the Explorer while the Agentic IDE is mounted.
+ * Route terminal path clicks into the Folder tab while the Agentic IDE is mounted.
*
* Only for the workspace on screen: a path from another workspace's pane has
* no tree here to show it in, so it keeps the old behaviour.
diff --git a/jarvis/ui/web/frontend/src/store/ideSidePanel.ts b/jarvis/ui/web/frontend/src/store/ideSidePanel.ts
index cf9d2cb035..ee2ba415ed 100644
--- a/jarvis/ui/web/frontend/src/store/ideSidePanel.ts
+++ b/jarvis/ui/web/frontend/src/store/ideSidePanel.ts
@@ -11,15 +11,15 @@ import { create } from "zustand";
*/
/** Every function the panel can show. A new one is a new id plus a registry entry. */
-export type SidePanelTabId = "agents" | "files";
+export type SidePanelTabId = "agents" | "changes" | "files";
-export const SIDE_PANEL_TAB_IDS: readonly SidePanelTabId[] = ["agents", "files"];
+export const SIDE_PANEL_TAB_IDS: readonly SidePanelTabId[] = ["agents", "changes", "files"];
const OPEN_KEY = "jarvis.agenticIde.sidePanelOpen";
-// v2: the Explorer joined the default tabs; a v1 list would have hidden it.
-const TABS_KEY = "jarvis.agenticIde.sidePanelTabs.v2";
+// v3: Changes became its own tab beside Folder; a v2 list would have hidden it.
+const TABS_KEY = "jarvis.agenticIde.sidePanelTabs.v3";
-const DEFAULT_TABS: SidePanelTabId[] = ["agents", "files"];
+const DEFAULT_TABS: SidePanelTabId[] = ["agents", "changes", "files"];
const isTabId = (value: unknown): value is SidePanelTabId =>
typeof value === "string" && (SIDE_PANEL_TAB_IDS as readonly string[]).includes(value);
diff --git a/tests/unit/agentic_ide/test_change_authors.py b/tests/unit/agentic_ide/test_change_authors.py
new file mode 100644
index 0000000000..37c21ca4cb
--- /dev/null
+++ b/tests/unit/agentic_ide/test_change_authors.py
@@ -0,0 +1,108 @@
+"""Which pane's agent wrote which changed file, from the agents' own records."""
+
+from __future__ import annotations
+
+from pathlib import Path
+from typing import Any
+
+import pytest
+
+from jarvis.agentic_ide import change_authors
+from jarvis.agentic_ide.change_authors import PaneRecord
+
+
[email protected](autouse=True)
+def _fresh_cache() -> None:
+ change_authors._cache.clear()
+
+
+def _call(call_id: str, name: str, args: Any, ts: int) -> dict[str, Any]:
+ return {
+ "kind": "tool_call",
+ "ts_ms": ts,
+ "payload": {"call_id": call_id, "name": name, "input": args},
+ }
+
+
+def _result(call_id: str, *, error: bool = False) -> dict[str, Any]:
+ return {"kind": "tool_result", "ts_ms": 0, "payload": {"call_id": call_id, "is_error": error}}
+
+
+def _pane(name: str, folder: Path, agent: str = "claude") -> PaneRecord:
+ return PaneRecord(
+ pane=name,
+ history_id=f"h-{name}",
+ agent=agent,
+ display_name="Claude Code" if agent == "claude" else "Codex",
+ session_id=f"s-{name}",
+ home=None,
+ folder=str(folder),
+ )
+
+
+def test_written_paths_counts_only_successful_writing_tools() -> None:
+ events = [
+ _call("1", "Edit", {"file_path": "a.py"}, 10),
+ _result("1"),
+ _call("2", "Read", {"file_path": "b.py"}, 20),
+ _call("3", "Bash", {"command": "sed -i s/x/y/ c.py"}, 30),
+ _call("4", "Write", {"file_path": "d.py"}, 40),
+ _result("4", error=True),
+ _call("5", "Edit", {"file_path": "a.py"}, 50),
+ ]
+ assert change_authors.written_paths(events) == {"a.py": 50}
+
+
+def test_written_paths_reads_apply_patch_bodies() -> None:
+ patch = (
+ "*** Begin Patch\n*** Update File: src/app.py\n@@\n-x\n+y\n"
+ "*** Add File: docs/new.md\n+hi\n*** End Patch"
+ )
+ events = [_call("1", "apply_patch", {"input": patch}, 7)]
+ assert change_authors.written_paths(events) == {"src/app.py": 7, "docs/new.md": 7}
+
+
+def test_change_authors_maps_panes_to_workspace_paths(tmp_path: Path) -> None:
+ root = tmp_path / "repo"
+ (root / "src").mkdir(parents=True)
+ records = {
+ "T1": [_call("1", "Edit", {"file_path": str(root / "src" / "a.py")}, 100)],
+ "T2": [
+ _call("1", "apply_patch", {"input": "*** Update File: src/a.py\n"}, 200),
+ _call("2", "Write", {"file_path": str(tmp_path / "elsewhere.py")}, 300),
+ ],
+ }
+ panes = [_pane("T1", root), _pane("T2", root, agent="codex")]
+
+ by_path = change_authors.change_authors(
+ root, panes, reader=lambda record: records[record.pane], now=1.0
+ )
+
+ assert list(by_path) == ["src/a.py"]
+ assert [(a.pane, a.last_edit_ms) for a in by_path["src/a.py"]] == [("T2", 200), ("T1", 100)]
+
+
+def test_untracked_folder_gathers_the_authors_inside_it(tmp_path: Path) -> None:
+ root = tmp_path / "repo"
+ root.mkdir()
+ records = {
+ "T1": [_call("1", "Write", {"file_path": "out/a.txt"}, 5)],
+ "T2": [_call("1", "Write", {"file_path": "out/deep/b.txt"}, 9)],
+ }
+ by_path = change_authors.change_authors(
+ root,
+ [_pane("T1", root), _pane("T2", root)],
+ reader=lambda record: records[record.pane],
+ now=2.0,
+ )
+
+ folder = change_authors.authors_for("out", True, by_path)
+ assert [a.pane for a in folder] == ["T2", "T1"]
+ assert change_authors.authors_for("out", False, by_path) == []
+
+
+def test_unreadable_record_yields_no_authors(tmp_path: Path) -> None:
+ def broken(_record: PaneRecord) -> list[dict[str, Any]]:
+ raise OSError("gone")
+
+ assert change_authors.change_authors(tmp_path, [_pane("T9", tmp_path)], reader=broken) == {}