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.

fix(agentic-ide): dock explorer right

rubenluetke10-beep56d0355609e8
diff --git a/jarvis/agentic_ide/folders.py b/jarvis/agentic_ide/folders.py
index 4351209185..ee824a96f1 100644
--- a/jarvis/agentic_ide/folders.py
+++ b/jarvis/agentic_ide/folders.py
@@ -24,7 +24,7 @@ from __future__ import annotations
import os
from collections import deque
from dataclasses import asdict, dataclass, field
-from pathlib import Path
+from pathlib import Path, PurePosixPath
# Directory names that are never interesting as a project root and would bury
# the real folders in the picker.
@@ -116,6 +116,22 @@ class WorkspaceListing:
error: str | None = None
+def _workspace_relative_parts(relative: str | Path) -> tuple[str, ...]:
+ """Parse one wire path consistently on Windows, macOS, and Linux.
+
+ Explorer paths are POSIX-style on the wire. Splitting them before the
+ native ``Path`` join keeps ordinary separators stable; the resolved native
+ path still passes the workspace-containment check below, which also catches
+ Windows drive, UNC, and backslash traversal forms without rejecting valid
+ Unix filenames that happen to contain a colon or backslash.
+ """
+ raw = os.fspath(relative) or "."
+ posix = PurePosixPath(raw)
+ if posix.is_absolute() or ".." in posix.parts:
+ raise ValueError("That folder is outside the open workspace.")
+ return tuple(part for part in posix.parts if part not in {"", "."})
+
+
@dataclass(slots=True)
class ProjectProfile:
"""Compact, cheap description of a chosen folder."""
@@ -290,12 +306,10 @@ def list_workspace_dir(
part of the machine.
"""
root_path = Path(root).expanduser().resolve(strict=True)
- relative_path = Path(relative or ".")
- if relative_path.is_absolute():
- raise ValueError("Workspace paths must be relative.")
+ relative_parts = _workspace_relative_parts(relative)
try:
- target = (root_path / relative_path).resolve(strict=True)
+ target = root_path.joinpath(*relative_parts).resolve(strict=True)
target.relative_to(root_path)
except (OSError, ValueError) as exc:
raise ValueError("That folder is outside the open workspace.") from exc
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
index aad6d12453..d445754577 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
@@ -2463,6 +2463,9 @@ describe("the workspace header row", () => {
expect(await screen.findByTestId("workspace-explorer")).toBeTruthy();
expect(toggle.getAttribute("aria-expanded")).toBe("true");
expect(screen.getByTestId("pane-Mika")).toBe(pane);
+ expect(screen.getByTestId("agentic-grid").nextElementSibling).toBe(
+ screen.getByTestId("workspace-explorer-host"),
+ );
fireEvent.click(screen.getByRole("button", { name: "Close the explorer" }));
expect(screen.queryByTestId("workspace-explorer")).toBeNull();
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
index ab756a19d5..97b621d8a0 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
@@ -2589,26 +2589,6 @@ export function AgenticGrid({
change of clothes.
*/}
<div className={cn("min-h-0 flex-1", browserOpen ? "hidden" : "flex")}>
- {/* This zero-width host is ALWAYS present. Only its child mounts when
- the explorer is open, so toggling the panel never shifts the live
- terminal children in React's sibling order (and therefore never
- tears down their PTY sockets). */}
- <div
- className={cn(
- "h-full shrink-0 overflow-hidden transition-[width] duration-200 motion-reduce:transition-none",
- explorerOpen ? "w-[280px]" : "w-0",
- )}
- aria-hidden={!explorerOpen}
- >
- {explorerOpen && (
- <WorkspaceExplorer
- workspaceId={session.id}
- rootName={project.name}
- onClose={() => setExplorerOpen(false)}
- />
- )}
- </div>
-
{/* ------------------------------------------------------ chat rail */}
<aside
data-testid="agentic-chat-rail"
@@ -3254,6 +3234,27 @@ export function AgenticGrid({
</div>
)}
</div>
+
+ {/* The explorer owns the right edge. This zero-width host is ALWAYS
+ present, so opening or closing it changes only width and never the
+ sibling identity of a live terminal or its PTY socket. */}
+ <div
+ data-testid="workspace-explorer-host"
+ className={cn(
+ "h-full shrink-0 overflow-hidden transition-[width] duration-200 motion-reduce:transition-none",
+ explorerOpen ? "w-[280px]" : "w-0",
+ )}
+ aria-hidden={!explorerOpen}
+ >
+ {explorerOpen && (
+ <WorkspaceExplorer
+ workspaceId={session.id}
+ rootName={project.name}
+ onClose={() => setExplorerOpen(false)}
+ />
+ )}
+ </div>
+
</div>
{/* Closing a terminal kills a working agent, so it always asks first. */}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceExplorer.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceExplorer.test.tsx
index 1a07e62b5d..5e4634ed7a 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceExplorer.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceExplorer.test.tsx
@@ -94,9 +94,9 @@ describe("WorkspaceExplorer", () => {
);
expect(await screen.findByText(".gitignore")).toBeTruthy();
- expect(screen.getByTestId("workspace-explorer").className).toContain(
- "jarvis-panel-surface",
- );
+ const explorer = screen.getByTestId("workspace-explorer");
+ expect(explorer.className).toContain("border-l");
+ expect(explorer.style.background).toContain("0.22");
expect(screen.getByText("project")).toBeTruthy();
fireEvent.click(screen.getByRole("treeitem", { name: /src/i }));
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceExplorer.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceExplorer.tsx
index c42f574e06..912a3a903b 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceExplorer.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceExplorer.tsx
@@ -148,7 +148,8 @@ export function WorkspaceExplorer({
<aside
id="workspace-explorer"
data-testid="workspace-explorer"
- className="jarvis-panel-surface flex h-full w-[280px] shrink-0 flex-col border-r border-border/70 backdrop-blur-xl"
+ className="flex h-full w-[280px] shrink-0 flex-col border-l border-border/55 backdrop-blur-md"
+ style={{ background: "rgb(var(--shell-rgb) / 0.22)" }}
aria-label={t("agentic_grid.explorer.title")}
>
<header className="flex h-10 shrink-0 items-center gap-2 border-b border-border/60 px-3">
diff --git a/tests/unit/agentic_ide/test_workspace_explorer.py b/tests/unit/agentic_ide/test_workspace_explorer.py
index 5dbcef3fa5..7e2d2bea71 100644
--- a/tests/unit/agentic_ide/test_workspace_explorer.py
+++ b/tests/unit/agentic_ide/test_workspace_explorer.py
@@ -46,7 +46,19 @@ def test_nested_listing_keeps_every_path_workspace_relative(tmp_path: Path) -> N
assert str(tmp_path) not in repr(listing)
[email protected]("path", ["..", "../outside", "src/../../outside"])
+ "path",
+ [
+ "..",
+ "../outside",
+ "src/../../outside",
+ r"..\outside",
+ "/etc",
+ "C:/Windows",
+ r"C:\Windows",
+ r"\\server\share",
+ ],
+)
def test_listing_rejects_workspace_traversal(tmp_path: Path, path: str) -> None:
(tmp_path / "src").mkdir()
(tmp_path.parent / "outside").mkdir(exist_ok=True)
@@ -55,6 +67,32 @@ def test_listing_rejects_workspace_traversal(tmp_path: Path, path: str) -> None:
list_workspace_dir(tmp_path, path)
+def test_listing_uses_portable_wire_paths_for_unicode_and_spaces(tmp_path: Path) -> None:
+ nested = tmp_path / "folder with space" / "unicode-Δ"
+ nested.mkdir(parents=True)
+ (nested / "overview-π.md").write_text("ready\n", encoding="utf-8")
+
+ listing = list_workspace_dir(tmp_path, "folder with space/unicode-Δ")
+
+ assert listing.path == "folder with space/unicode-Δ"
+ assert [entry.path for entry in listing.entries] == [
+ "folder with space/unicode-Δ/overview-π.md"
+ ]
+ assert all("\\" not in entry.path for entry in listing.entries)
+
+
[email protected](os.name == "nt", reason="These characters are Windows separators")
+def test_unix_names_that_resemble_windows_paths_remain_browsable(tmp_path: Path) -> None:
+ for name in ("C:notes", r"folder\name"):
+ folder = tmp_path / name
+ folder.mkdir()
+ (folder / "entry.txt").write_text("ready\n", encoding="utf-8")
+
+ listing = list_workspace_dir(tmp_path, name)
+
+ assert [entry.name for entry in listing.entries] == ["entry.txt"]
+
+
def test_symlinked_directories_are_visible_but_not_expandable(tmp_path: Path) -> None:
outside = tmp_path.parent / "outside-link-target"
outside.mkdir(exist_ok=True)