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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(agentic-ide): open side panel surfaces from a launcher and add a browser
rubenluetke10-beepa72d4d3b3342
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.tsxindex 873f5ceff4..d3083c9cf5 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@@ -76,7 +76,7 @@ describe("IdeSidePanel", () => {expect(screen.queryByTestId(`shell-${second.id}`)).toBeNull();expect(screen.getByTestId(`shell-${first.id}`)).toBe(firstNode);// Session-only tabs must never respawn shells on a page reload.- expect(localStorage.getItem("jarvis.agenticIde.sidePanelTabs.v4")).not.toContain("terminal:");+ expect(localStorage.getItem("jarvis.agenticIde.sidePanelTabs.v5")).not.toContain("terminal:");});it("keeps terminals pinned to their workspace and offers another shell on every + click", () => {@@ -130,13 +130,76 @@ describe("IdeSidePanel", () => {expect(screen.getByTestId("grid")).toBe(grid);});- it("collapses when the last tab closes and reopens with Agents", () => {+ it("stays open on the launcher when the last tab closes", () => {act(() => useIdeSidePanelStore.getState().setOpen(true));render(<Harness />);fireEvent.click(screen.getByTestId("ide-side-panel-close-agents"));- expect(screen.queryByTestId("ide-side-panel")).toBeNull();+ expect(useIdeSidePanelStore.getState()).toMatchObject({ open: true, tabs: [] });+ expect(screen.getByTestId("ide-side-panel-launcher").textContent).toContain("Open a surface");+ });++ it("opens empty on the launcher and adds only the surface picked there", () => {+ useIdeSidePanelStore.setState({ tabs: [] });+ render(<Harness />);fireEvent.click(screen.getByTestId("ide-side-panel-toggle"));- expect(screen.getByTestId("ide-side-panel-tab-agents")).toBeTruthy();+ const launcher = screen.getByTestId("ide-side-panel-launcher");+ expect(launcher.textContent).toContain("Browser");+ expect(launcher.textContent).toContain("Terminal");+ fireEvent.click(screen.getByTestId("ide-side-panel-launch-files"));+ expect(useIdeSidePanelStore.getState()).toMatchObject({ tabs: ["files"], active: "files" });+ expect(screen.queryByTestId("ide-side-panel-launcher")).toBeNull();+ });++ it("opens a surface from its letter, but never while the reader types", () => {+ act(() => useIdeSidePanelStore.setState({ open: true, tabs: [], active: "agents" }));+ // A closed menu that stays mounted (hidden) must not mute the letters.+ render(<><textarea data-testid="composer" /><div role="menu" hidden /><Harness /></>);+ fireEvent.keyDown(screen.getByTestId("composer"), { key: "g" });+ expect(useIdeSidePanelStore.getState().tabs).toEqual([]);+ fireEvent.keyDown(document.body, { key: "g", ctrlKey: true });+ expect(useIdeSidePanelStore.getState().tabs).toEqual([]);+ fireEvent.keyDown(document.body, { key: "g" });+ expect(useIdeSidePanelStore.getState()).toMatchObject({ tabs: ["git"], active: "git" });+ });++ it("starts a terminal from T and greys it out without a workspace", () => {+ act(() => useIdeSidePanelStore.setState({ open: true, tabs: [], active: "agents" }));+ useIdeChatStore.setState({ workspace: null });+ render(<Harness />);+ const row = screen.getByTestId("ide-side-panel-launch-terminal");+ expect(row.getAttribute("aria-disabled")).toBe("true");+ expect(row.getAttribute("title")).toBe("Select a workspace to open a terminal.");+ fireEvent.keyDown(document.body, { key: "t" });+ expect(useIdeSidePanelStore.getState().terminals).toEqual([]);+ act(() => useIdeChatStore.setState({ workspace: { id: "w1", name: "App", path: "/code/app" } }));+ fireEvent.keyDown(document.body, { key: "t" });+ expect(useIdeSidePanelStore.getState().terminals).toHaveLength(1);+ });++ it("picks a surface by letter from the open + menu", () => {+ act(() => useIdeSidePanelStore.setState({ open: true, tabs: ["agents"], active: "agents" }));+ render(<Harness />);+ const add = screen.getByTestId("ide-side-panel-add");+ fireEvent.click(add);+ expect(screen.getByTestId("ide-side-panel-add-browser").textContent).toContain("B");+ fireEvent.keyDown(add, { key: "s" });+ expect(useIdeSidePanelStore.getState()).toMatchObject({ tabs: ["agents", "search"], active: "search" });+ expect(screen.queryByRole("menu")).toBeNull();+ });++ it("keeps the browser page loaded while another tab is in front", () => {+ localStorage.setItem("jarvis.agenticIde.browserUrl.v1", "http://localhost:5173/");+ act(() => useIdeSidePanelStore.setState({ open: true, tabs: ["browser", "agents"], active: "browser" }));+ render(<Harness />);+ const frame = screen.getByTestId("ide-browser-frame");+ expect(frame.getAttribute("src")).toBe("http://localhost:5173/");+ expect(frame.getAttribute("sandbox")).not.toContain("allow-top-navigation");+ fireEvent.click(screen.getByTestId("ide-side-panel-tab-agents"));+ expect(screen.getByTestId("ide-browser-frame")).toBe(frame);+ fireEvent.change(screen.getByTestId("ide-browser-address"), { target: { value: "8080" } });+ fireEvent.submit(screen.getByTestId("ide-browser-address").closest("form")!);+ expect(screen.getByTestId("ide-browser-frame").getAttribute("src")).toBe("http://localhost:8080/");+ expect(localStorage.getItem("jarvis.agenticIde.browserUrl.v1")).toBe("http://localhost:8080/");});it("keeps + usable with every tab listed, open ones ticked, and focuses an open one", () => {diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsxindex f6d49b9096..f9b21faccd 100644--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx@@ -1,4 +1,4 @@-import { useEffect, useRef, useState, type ReactNode } from "react";+import { useEffect, useRef, useState, type KeyboardEvent as ReactKeyboardEvent, type ReactNode } from "react";import { Check, Maximize2, Minimize2, MoveHorizontal, Plus, SquareTerminal, X } from "lucide-react";import { useT } from "@/i18n";import { cn } from "@/lib/utils";@@ -11,6 +11,7 @@ import type { TerminalAppearance } from "../terminalThemes";import { useExplorerPathRouting } from "@/store/ideExplorer";import { usePaneReviewTracking } from "@/store/paneReviews";import { SIDE_PANEL_TABS, sidePanelTab } from "./sidePanelTabs";+import { SurfaceKbd, SurfaceLauncher, surfaceActionForKey, type SurfaceAction } from "./SurfaceLauncher";import { SIDE_PANEL_ID } from "./sidePanelIds";const WIDTH_KEY = "jarvis.agenticIde.sidePanelWidth.v1";@@ -163,7 +164,8 @@ export function IdeSidePanelFrame({ children, markInUse = false, appearance, onS}/**- * The panel itself: tab header ("+" and maximize) over the active tab's content.+ * The panel itself: tab header ("+" and maximize) over the active tab's content,+ * or the "Open a surface" launcher while no tab is open.* It opens and closes from the window caption (`IdeSidePanelToggle`) only;* a shut panel leaves no rail behind, so the grid or thread gets the full width.*/@@ -186,6 +188,32 @@ export function IdeSidePanel({ appearance, onScreen = true }: { appearance?: Terconst [menuOpen, setMenuOpen] = useState(false);const menu = useRef<HTMLDivElement>(null);const current = sidePanelTab(active);+ const canAddTerminal = !!workspace && terminalCount < MAX_TERMINAL_TABS;+ const registryAction = (tab: (typeof SIDE_PANEL_TABS)[number]): SurfaceAction => ({+ id: tab.id, label: t(tab.labelKey), icon: tab.icon, shortcut: tab.shortcut, available: true,+ isOpen: tabs.includes(tab.id), run: () => openTab(tab.id),+ });+ // Launcher and "+" menu list the same surfaces: the browser, a plain+ // terminal, then every other registry tab.+ const [browserTab, ...otherTabs] = SIDE_PANEL_TABS;+ const actions: SurfaceAction[] = [+ registryAction(browserTab),+ {+ id: "terminal", label: t("ide_side_panel.terminal_label"), icon: SquareTerminal, shortcut: "T",+ available: canAddTerminal,+ reason: t(!workspace ? "ide_side_panel.terminal_workspace_required" : "ide_side_panel.terminal_limit"),+ run: () => { if (workspace) addTerminalTab(workspace.id, workspace.name); },+ },+ ...otherTabs.map(registryAction),+ ];+ const onMenuKey = (event: ReactKeyboardEvent<HTMLDivElement>) => {+ if (!menuOpen) return;+ const action = surfaceActionForKey(actions, event.nativeEvent);+ if (!action) return;+ event.preventDefault();+ setMenuOpen(false);+ action.run();+ };useEffect(() => {if (!menuOpen) return;@@ -251,7 +279,7 @@ export function IdeSidePanel({ appearance, onScreen = true }: { appearance?: Ter);})}</div>- <div ref={menu} className="relative">+ <div ref={menu} className="relative" onKeyDown={onMenuKey}><buttontype="button"data-testid="ide-side-panel-add"@@ -264,36 +292,29 @@ export function IdeSidePanel({ appearance, onScreen = true }: { appearance?: Ter><Plus className="h-4 w-4" aria-hidden /></button>- {/* Every tab the panel can hold, always: an open one is ticked and- picking it brings it forward, a closed one is added. */}+ {/* Every surface the panel can hold, always, with its letter: an open+ tab is ticked and picking it brings it forward, a closed one is added. */}{menuOpen && (- <div role="menu" aria-label={t("ide_side_panel.add_tab")} className="absolute right-0 top-full z-30 mt-1 min-w-48 rounded-lg border border-border bg-popover p-1 shadow-float">- {SIDE_PANEL_TABS.map((tab) => {- const isOpen = tabs.includes(tab.id);- return (- <button- key={tab.id}- type="button"- role="menuitemcheckbox"- aria-checked={isOpen}- data-testid={`ide-side-panel-add-${tab.id}`}- onClick={() => { openTab(tab.id); setMenuOpen(false); }}- className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-foreground hover:bg-secondary"- >- <tab.icon className="h-4 w-4 text-muted-foreground" aria-hidden />- <span className="flex-1">{t(tab.labelKey)}</span>- {isOpen && <Check className="h-3.5 w-3.5 text-accent" aria-hidden />}- </button>- );- })}- <button type="button" role="menuitem" data-testid="ide-side-panel-add-terminal"- disabled={!workspace || terminalCount >= MAX_TERMINAL_TABS}- title={!workspace ? t("ide_side_panel.terminal_workspace_required") : undefined}- onClick={() => { if (workspace) addTerminalTab(workspace.id, workspace.name); setMenuOpen(false); }}- className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-foreground hover:bg-secondary disabled:cursor-default disabled:opacity-40">- <SquareTerminal className="h-4 w-4 text-muted-foreground" aria-hidden />- <span>{t("ide_side_panel.add_terminal")}</span>- </button>+ <div role="menu" aria-label={t("ide_side_panel.add_tab")} className="absolute right-0 top-full z-30 mt-1 min-w-52 rounded-lg border border-border bg-popover p-1 shadow-float">+ {actions.map((action) => (+ <button+ key={action.id}+ type="button"+ role={action.id === "terminal" ? "menuitem" : "menuitemcheckbox"}+ aria-checked={action.id === "terminal" ? undefined : !!action.isOpen}+ aria-keyshortcuts={action.shortcut}+ data-testid={`ide-side-panel-add-${action.id}`}+ disabled={!action.available}+ title={action.available ? undefined : action.reason}+ onClick={() => { action.run(); setMenuOpen(false); }}+ className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-foreground hover:bg-secondary disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent"+ >+ <action.icon className="h-4 w-4 text-muted-foreground" aria-hidden />+ <span className="flex-1">{action.label}</span>+ {action.isOpen && <Check className="h-3.5 w-3.5 text-accent" aria-hidden />}+ <SurfaceKbd>{action.shortcut}</SurfaceKbd>+ </button>+ ))}</div>)}</div>@@ -311,7 +332,11 @@ export function IdeSidePanel({ appearance, onScreen = true }: { appearance?: Ter</div>{/* Keyed by tab: Changes and Folder share one component and must not share its state. */}<div id={`${SIDE_PANEL_ID}-content`} role="tabpanel" className="relative min-h-0 flex-1">- {open && <div key={active} className="h-full min-h-0">{current?.render()}</div>}+ {open && tabs.length === 0 && <SurfaceLauncher actions={actions} keysEnabled={onScreen} />}+ {open && current && !current.keepAlive && <div key={active} className="h-full min-h-0">{current.render()}</div>}+ {SIDE_PANEL_TABS.filter((tab) => tab.keepAlive && tabs.includes(tab.id)).map((tab) => (+ <div key={tab.id} hidden={!open || tab.id !== active} className="absolute inset-0">{tab.render()}</div>+ ))}{terminals.map((terminal) => <div key={terminal.id} hidden={!open || terminal.id !== active}className="absolute inset-0" data-testid={`ide-side-panel-terminal-${terminal.id}`}><WorkspaceTerminal paneKey={terminal.id} agentName="shell" workspaceId={terminal.workspaceId}diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/SurfaceLauncher.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/SurfaceLauncher.tsxnew file mode 100644index 0000000000..e58e0b9a5f--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/SurfaceLauncher.tsx@@ -0,0 +1,154 @@+import { useCallback, useEffect, useRef, useState, type KeyboardEvent as ReactKeyboardEvent, type ReactNode } from "react";+import type { LucideIcon } from "lucide-react";+import { useT } from "@/i18n";+import { cn } from "@/lib/utils";++/** One thing the side panel can open: a registry tab or a plain terminal. */+export interface SurfaceAction {+ id: string;+ label: string;+ icon: LucideIcon;+ shortcut: string;+ available: boolean;+ /** Why it is greyed out, shown as the row's tooltip. */+ reason?: string;+ /** True when the tab is already open (the "+" menu ticks it). */+ isOpen?: boolean;+ run: () => void;+}++/** Open overlays that must keep their own keys while the launcher is showing. */+const BLOCKING_LAYERS = '[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [aria-modal="true"]';++/**+ * True while an overlay is actually showing. Several menus stay mounted while+ * closed (hidden, zero size), so presence alone would mute the letters for good.+ */+function overlayShowing(): boolean {+ return [...document.querySelectorAll(BLOCKING_LAYERS)].some((node) => node.getClientRects().length > 0);+}++type ShortcutEvent = Pick<KeyboardEvent, "altKey" | "ctrlKey" | "defaultPrevented" | "isComposing" | "key" | "metaKey">;++/** The available action a bare letter press picks, or null (modifiers and IME input never pick). */+export function surfaceActionForKey(actions: readonly SurfaceAction[], event: ShortcutEvent): SurfaceAction | null {+ if (event.defaultPrevented || event.isComposing) return null;+ if (event.metaKey || event.ctrlKey || event.altKey) return null;+ const key = event.key.toLowerCase();+ return actions.find((action) => action.available && action.shortcut.toLowerCase() === key) ?? null;+}++/**+ * A focused editable is where the reader's next keystrokes belong, empty or+ * not: a terminal (xterm types through a textarea), the composer, a field.+ * Letters typed there must never open a surface instead.+ */+export function targetsTypingContext(target: EventTarget | null): boolean {+ return target instanceof Element+ && target.closest('input, textarea, select, [contenteditable]:not([contenteditable="false"])') !== null;+}++export function SurfaceKbd({ children }: { children: ReactNode }) {+ return (+ <kbd className="inline-flex h-5 min-w-[1.25rem] shrink-0 items-center justify-center rounded border border-border bg-muted px-1 font-mono text-[11px] font-medium leading-none text-muted-foreground">+ {children}+ </kbd>+ );+}++/**+ * What an empty side panel shows: every surface it can open, one per row,+ * each with its letter. Keyboard first: while the launcher is on screen a+ * bare letter opens its surface from anywhere outside a typing context, and+ * arrows plus Enter work while the list has focus. Surfaces that cannot open+ * right now stay listed, greyed, with the reason as a tooltip.+ */+export function SurfaceLauncher({ actions, keysEnabled }: { actions: readonly SurfaceAction[]; keysEnabled: boolean }) {+ const t = useT();+ // -1: no highlight until the pointer or an arrow key picks a row.+ const [highlight, setHighlight] = useState(-1);+ const available = actions.filter((action) => action.available);+ const index = available.length === 0 ? -1 : Math.min(highlight, available.length - 1);++ const latest = useRef(available);+ latest.current = available;+ useEffect(() => {+ if (!keysEnabled) return;+ // Capture phase, so an app-level handler cannot swallow the letter first.+ const onKey = (event: KeyboardEvent) => {+ const action = surfaceActionForKey(latest.current, event);+ if (!action || targetsTypingContext(event.target)) return;+ if (overlayShowing()) return;+ event.preventDefault();+ event.stopPropagation();+ action.run();+ };+ window.addEventListener("keydown", onKey, true);+ return () => window.removeEventListener("keydown", onKey, true);+ }, [keysEnabled]);++ // Take focus on arrival so arrows work at once, unless the reader is typing+ // somewhere: a panel restored open at startup must not steal the composer.+ const focusOnMount = useCallback((node: HTMLDivElement | null) => {+ if (node && !targetsTypingContext(document.activeElement)) node.focus({ preventScroll: true });+ }, []);++ const onKeyDown = (event: ReactKeyboardEvent<HTMLDivElement>) => {+ if (event.metaKey || event.ctrlKey || event.altKey || available.length === 0) return;+ if (event.key === "ArrowDown") {+ event.preventDefault();+ setHighlight((index + 1) % available.length);+ } else if (event.key === "ArrowUp") {+ event.preventDefault();+ setHighlight(index <= 0 ? available.length - 1 : index - 1);+ } else if (event.key === "Enter" && event.target === event.currentTarget && index >= 0) {+ event.preventDefault();+ available[index].run();+ }+ };++ return (+ <div+ ref={focusOnMount}+ tabIndex={0}+ onKeyDown={onKeyDown}+ aria-label={t("ide_side_panel.launcher.title")}+ data-testid="ide-side-panel-launcher"+ className="flex h-full min-h-0 items-center justify-center overflow-y-auto px-6 outline-none"+ >+ <div className="w-full max-w-xs py-6">+ <h3 className="mb-3 text-center text-sm font-medium text-foreground">{t("ide_side_panel.launcher.title")}</h3>+ <div className="flex flex-col gap-0.5">+ {actions.map((action) => {+ const Icon = action.icon;+ const lit = index >= 0 && available[index] === action;+ return (+ <button+ key={action.id}+ type="button"+ tabIndex={-1}+ // aria-disabled, not disabled: a disabled button shows no tooltip.+ aria-disabled={!action.available}+ title={action.available ? undefined : action.reason}+ aria-keyshortcuts={action.shortcut}+ data-testid={`ide-side-panel-launch-${action.id}`}+ onClick={() => { if (action.available) action.run(); }}+ onMouseEnter={() => action.available && setHighlight(available.indexOf(action))}+ onMouseLeave={() => setHighlight((current) => (current === available.indexOf(action) ? -1 : current))}+ className={cn(+ "flex h-8 w-full items-center gap-2.5 rounded-md px-2.5 text-left text-sm text-foreground transition-colors",+ action.available ? "hover:bg-secondary" : "cursor-default opacity-50",+ lit && "bg-secondary",+ )}+ >+ <Icon className="h-4 w-4 shrink-0" aria-hidden />+ <span className="min-w-0 flex-1 truncate">{action.label}</span>+ <SurfaceKbd>{action.shortcut}</SurfaceKbd>+ </button>+ );+ })}+ </div>+ </div>+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/browser/BrowserTab.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/browser/BrowserTab.tsxnew file mode 100644index 0000000000..36598503af--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/browser/BrowserTab.tsx@@ -0,0 +1,105 @@+import { useRef, useState, type FormEvent } from "react";+import { ExternalLink, Globe, RotateCw } from "lucide-react";+import { useT } from "@/i18n";+import { openExternalUrl } from "@/lib/openExternal";+import { normalizeBrowserAddress } from "./browserAddress";++const URL_KEY = "jarvis.agenticIde.browserUrl.v1";++function storedUrl(): string {+ try {+ return localStorage.getItem(URL_KEY) ?? "";+ } catch {+ return "";+ }+}++function persistUrl(url: string): void {+ try {+ localStorage.setItem(URL_KEY, url);+ } catch {+ /* a convenience only: the page still loads for this session */+ }+}++const TOOL_BTN =+ "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors " ++ "hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring " ++ "disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent";++/**+ * The side panel's Browser surface: an address bar over an embedded page.+ *+ * Built for local previews (a dev server on localhost) and plain pages. Many+ * public sites forbid being shown inside another app; for those the "open in+ * your browser" button hands the address to the system browser. The frame may+ * not navigate the app itself (no `allow-top-navigation`).+ */+export function BrowserTab() {+ const t = useT();+ const [url, setUrl] = useState(storedUrl);+ const [draft, setDraft] = useState(url);+ // Bumped by reload: a new key remounts the frame, which works cross-origin.+ const [generation, setGeneration] = useState(0);+ const input = useRef<HTMLInputElement>(null);++ const go = (event: FormEvent) => {+ event.preventDefault();+ const next = normalizeBrowserAddress(draft);+ if (!next) return;+ setDraft(next);+ setUrl(next);+ persistUrl(next);+ if (next === url) setGeneration((value) => value + 1);+ input.current?.blur();+ };++ return (+ <div data-testid="ide-browser-tab" className="flex h-full min-h-0 flex-col">+ <form onSubmit={go} className="flex h-10 shrink-0 items-center gap-1 border-b border-border/60 px-2">+ <button type="button" onClick={() => setGeneration((value) => value + 1)} disabled={!url}+ aria-label={t("ide_side_panel.browser.reload")} title={t("ide_side_panel.browser.reload")}+ data-testid="ide-browser-reload" className={TOOL_BTN}>+ <RotateCw className="h-3.5 w-3.5" aria-hidden />+ </button>+ <input+ ref={input}+ value={draft}+ onChange={(event) => setDraft(event.target.value)}+ onFocus={(event) => event.target.select()}+ spellCheck={false}+ autoComplete="off"+ placeholder={t("ide_side_panel.browser.placeholder")}+ aria-label={t("ide_side_panel.browser.address")}+ data-testid="ide-browser-address"+ className="h-7 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"+ />+ <button type="button" onClick={() => void openExternalUrl(url)} disabled={!url}+ aria-label={t("ide_side_panel.browser.open_external")} title={t("ide_side_panel.browser.open_external")}+ data-testid="ide-browser-external" className={TOOL_BTN}>+ <ExternalLink className="h-3.5 w-3.5" aria-hidden />+ </button>+ </form>+ {url ? (+ // White in both themes on purpose: it is the page's own canvas, as in+ // any browser. A page without a background would otherwise draw its+ // default black text straight onto the dark theme.+ <iframe+ key={`${url}#${generation}`}+ src={url}+ title={t("ide_side_panel.tabs.browser")}+ data-testid="ide-browser-frame"+ sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-downloads"+ referrerPolicy="no-referrer"+ className="min-h-0 w-full flex-1 border-0 bg-white"+ />+ ) : (+ <div className="flex min-h-0 flex-1 flex-col items-center justify-center gap-2 px-6 text-center">+ <Globe className="h-5 w-5 text-muted-foreground" aria-hidden />+ <p className="text-sm text-foreground">{t("ide_side_panel.browser.empty_title")}</p>+ <p className="max-w-xs text-xs text-muted-foreground">{t("ide_side_panel.browser.empty_hint")}</p>+ </div>+ )}+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/browser/browserAddress.test.ts b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/browser/browserAddress.test.tsnew file mode 100644index 0000000000..ee59e03137--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/browser/browserAddress.test.ts@@ -0,0 +1,23 @@+import { describe, expect, it } from "vitest";+import { normalizeBrowserAddress } from "./browserAddress";++describe("normalizeBrowserAddress", () => {+ it("sends bare ports and local hosts over http", () => {+ expect(normalizeBrowserAddress("5173")).toBe("http://localhost:5173/");+ expect(normalizeBrowserAddress(":3000/app")).toBe("http://localhost:3000/app");+ expect(normalizeBrowserAddress("localhost:8080")).toBe("http://localhost:8080/");+ expect(normalizeBrowserAddress("127.0.0.1:4321/x?y=1")).toBe("http://127.0.0.1:4321/x?y=1");+ });++ it("adds https to other hosts and keeps explicit web schemes", () => {+ expect(normalizeBrowserAddress(" example.com/docs ")).toBe("https://example.com/docs");+ expect(normalizeBrowserAddress("http://intranet.test")).toBe("http://intranet.test/");+ });++ it("refuses non-web schemes, blanks and text with spaces", () => {+ expect(normalizeBrowserAddress("javascript:alert(1)")).toBeNull();+ expect(normalizeBrowserAddress("file:///etc/passwd")).toBeNull();+ expect(normalizeBrowserAddress("")).toBeNull();+ expect(normalizeBrowserAddress("two words")).toBeNull();+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/browser/browserAddress.ts b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/browser/browserAddress.tsnew file mode 100644index 0000000000..d8e7da81e8--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/browser/browserAddress.ts@@ -0,0 +1,27 @@+const LOCAL_HOST = /^(localhost|127(?:\.\d{1,3}){3}|\[::1\]|0\.0\.0\.0)(?::\d+)?(?:[/?#]|$)/i;+const BARE_PORT = /^:?\d{2,5}(?:[/?#]|$)/;++/**+ * Turn what the reader typed into an address the browser surface can load.+ *+ * A bare port (`5173`, `:5173`) and a local host go over plain http, the way+ * dev servers listen; anything else without a scheme gets https. Only web+ * schemes pass: `javascript:`, `file:` and friends return null.+ */+export function normalizeBrowserAddress(raw: string): string | null {+ const text = raw.trim();+ if (!text || /\s/.test(text)) return null;+ let candidate: string;+ if (BARE_PORT.test(text)) candidate = `http://localhost:${text.replace(/^:/, "")}`;+ else if (/^[a-z][a-z\d+.-]*:\/\//i.test(text)) candidate = text;+ else if (LOCAL_HOST.test(text)) candidate = `http://${text}`;+ else candidate = `https://${text}`;+ try {+ const parsed = new URL(candidate);+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return null;+ if (!parsed.hostname) return null;+ return parsed.href;+ } catch {+ return null;+ }+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/sidePanelTabs.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/sidePanelTabs.tsxindex 67014da051..f48da60cdf 100644--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/sidePanelTabs.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/sidePanelTabs.tsx@@ -1,7 +1,8 @@import type { ReactNode } from "react";-import { Bot, Building2, CreditCard, FileDiff, Files, FolderTree, GitBranch, Search, type LucideIcon } from "lucide-react";+import { Bot, Building2, CreditCard, FileDiff, Files, FolderTree, GitBranch, Globe, Search, type LucideIcon } from "lucide-react";import type { SidePanelTabId } from "@/store/ideSidePanel";import { AgentsOverview } from "./AgentsOverview";+import { BrowserTab } from "./browser/BrowserTab";import { ExplorerPanel } from "./explorer/ExplorerPanel";import { GitOverviewTab } from "./git/GitOverviewTab";import { OfficeTab } from "./OfficeTab";@@ -15,62 +16,88 @@ export interface SidePanelTabDef {/** i18n key of the tab's label. */labelKey: string;icon: LucideIcon;+ /**+ * Letter that opens the tab from the "Open a surface" launcher and the "+"+ * menu. Unique across the registry and "T" (reserved for a plain terminal).+ */+ shortcut: string;render: () => ReactNode;+ /**+ * Stay mounted while the tab is open but not in front, so switching away+ * keeps its state (a browser page would otherwise reload on every switch).+ */+ keepAlive?: boolean;}/**- * Everything the side panel can hold, in "+" menu order.+ * Everything the side panel can hold, in launcher and "+" menu order.** Adding a function is one entry here plus its id in `SIDE_PANEL_TAB_IDS`* (`store/ideSidePanel.ts`); the header, the "+" menu and persistence pick* it up from there.*/export const SIDE_PANEL_TABS: readonly SidePanelTabDef[] = [+ {+ id: "browser",+ labelKey: "ide_side_panel.tabs.browser",+ icon: Globe,+ shortcut: "B",+ render: () => <BrowserTab />,+ keepAlive: true,+ },{id: "agents",labelKey: "ide_side_panel.tabs.agents",+ shortcut: "A",icon: Bot,render: () => <AgentsOverview />,},{id: "changes",labelKey: "ide_side_panel.tabs.changes",+ shortcut: "C",icon: FileDiff,render: () => <ExplorerPanel view="changes" />,},{id: "files",labelKey: "ide_side_panel.tabs.files",+ shortcut: "F",icon: FolderTree,render: () => <ExplorerPanel view="files" />,},{id: "search",labelKey: "ide_side_panel.tabs.search",+ shortcut: "S",icon: Search,render: () => <SearchPanel />,},{id: "git",labelKey: "ide_side_panel.tabs.git",+ shortcut: "G",icon: GitBranch,render: () => <GitOverviewTab />,},{id: "skills",labelKey: "ide_side_panel.tabs.skills",+ shortcut: "K",icon: Files,render: () => <SkillsTab />,},{id: "subscriptions",labelKey: "ide_side_panel.tabs.subscriptions",+ shortcut: "U",icon: CreditCard,render: () => <SubscriptionsTab />,},{id: "office",labelKey: "ide_side_panel.tabs.office",+ shortcut: "V",icon: Building2,render: () => <OfficeTab />,},diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 5ed5da7b09..8541d451fb 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -6378,6 +6378,18 @@"add_terminal": "Plain Terminal","terminal_label": "Terminal","terminal_workspace_required": "Wähle einen Workspace, um ein Terminal zu öffnen.",+ "terminal_limit": "Für diesen Workspace sind schon alle Terminal-Tabs offen.",+ "launcher": {+ "title": "Fläche öffnen"+ },+ "browser": {+ "reload": "Neu laden",+ "placeholder": "Adresse, z. B. localhost:5173",+ "address": "Adresse",+ "open_external": "Im Browser öffnen",+ "empty_title": "Gib oben eine Adresse ein",+ "empty_hint": "Gedacht für lokale Vorschauen wie einen Dev-Server. Viele öffentliche Seiten erlauben keine Anzeige in einer anderen App; öffne sie in deinem Browser."+ },"all_open": "Alle Tabs sind bereits offen","close_tab": "Tab schließen","rail_aria": "Tabs der Seitenleiste",@@ -6447,6 +6459,7 @@"skipped_other": "{count} Dateien ließen sich nicht ändern."},"tabs": {+ "browser": "Browser","git": "Git","skills": "Skills","agents": "Agents",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 8ede5a50df..e3923d39b9 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -6378,6 +6378,18 @@"add_terminal": "Plain Terminal","terminal_label": "Terminal","terminal_workspace_required": "Select a workspace to open a terminal.",+ "terminal_limit": "Every terminal tab for this workspace is already open.",+ "launcher": {+ "title": "Open a surface"+ },+ "browser": {+ "reload": "Reload",+ "placeholder": "Address, e.g. localhost:5173",+ "address": "Address",+ "open_external": "Open in your browser",+ "empty_title": "Enter an address above",+ "empty_hint": "Made for local previews such as a dev server. Many public sites do not allow being shown inside another app; open those in your browser."+ },"all_open": "Every tab is already open","close_tab": "Close tab","rail_aria": "Side panel tabs",@@ -6447,6 +6459,7 @@"skipped_other": "{count} files could not be changed."},"tabs": {+ "browser": "Browser","git": "Git","skills": "Skills","agents": "Agents",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 9ef29e125b..968959d93d 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -6378,6 +6378,18 @@"add_terminal": "Plain Terminal","terminal_label": "Terminal","terminal_workspace_required": "Selecciona un espacio de trabajo para abrir una terminal.",+ "terminal_limit": "Ya están abiertas todas las pestañas de terminal de este espacio de trabajo.",+ "launcher": {+ "title": "Abrir una superficie"+ },+ "browser": {+ "reload": "Recargar",+ "placeholder": "Dirección, p. ej. localhost:5173",+ "address": "Dirección",+ "open_external": "Abrir en tu navegador",+ "empty_title": "Escribe una dirección arriba",+ "empty_hint": "Pensado para vistas previas locales, como un servidor de desarrollo. Muchos sitios públicos no permiten mostrarse dentro de otra app; ábrelos en tu navegador."+ },"all_open": "Todas las pestañas ya están abiertas","close_tab": "Cerrar pestaña","rail_aria": "Pestañas del panel lateral",@@ -6447,6 +6459,7 @@"skipped_other": "{count} archivos no se pudieron cambiar."},"tabs": {+ "browser": "Navegador","git": "Git","skills": "Skills","agents": "Agentes",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/zh.json b/jarvis/ui/web/frontend/src/i18n/locales/zh.jsonindex 40dc78f4d4..5d0fb5a61c 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/zh.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/zh.json@@ -6363,6 +6363,18 @@"add_terminal": "普通终端","terminal_label": "终端","terminal_workspace_required": "选择一个工作区以打开终端。",+ "terminal_limit": "此工作区的终端标签页已全部打开。",+ "launcher": {+ "title": "打开一个界面"+ },+ "browser": {+ "reload": "重新加载",+ "placeholder": "地址,例如 localhost:5173",+ "address": "地址",+ "open_external": "在浏览器中打开",+ "empty_title": "在上方输入地址",+ "empty_hint": "适用于本地预览,例如开发服务器。许多公共网站不允许在其他应用中显示;请在浏览器中打开它们。"+ },"all_open": "所有标签页都已打开","close_tab": "关闭标签页","rail_aria": "侧边面板标签页",@@ -6432,6 +6444,7 @@"skipped_other": "有 {count} 个文件无法修改。"},"tabs": {+ "browser": "浏览器","git": "Git","skills": "技能","agents": "智能体",diff --git a/jarvis/ui/web/frontend/src/store/ideSidePanel.ts b/jarvis/ui/web/frontend/src/store/ideSidePanel.tsindex 4916e4937f..15df031239 100644--- a/jarvis/ui/web/frontend/src/store/ideSidePanel.ts+++ b/jarvis/ui/web/frontend/src/store/ideSidePanel.ts@@ -10,7 +10,7 @@ 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" | "changes" | "files" | "search" | "git" | "skills" | "subscriptions" | "office" | `terminal:${string}`;+export type SidePanelTabId = "browser" | "agents" | "changes" | "files" | "search" | "git" | "skills" | "subscriptions" | "office" | `terminal:${string}`;export interface SidePanelTerminal {id: `terminal:${string}`;@@ -21,7 +21,7 @@ export interface SidePanelTerminal {export const MAX_TERMINAL_TABS = 16;-export const SIDE_PANEL_TAB_IDS: readonly SidePanelTabId[] = ["agents", "changes", "files", "search", "git", "skills", "subscriptions", "office"];+export const SIDE_PANEL_TAB_IDS: readonly SidePanelTabId[] = ["browser", "agents", "changes", "files", "search", "git", "skills", "subscriptions", "office"];/*** DOM id of the panel host, for the toggle's `aria-controls`.@@ -33,11 +33,14 @@ export const SIDE_PANEL_TAB_IDS: readonly SidePanelTabId[] = ["agents", "changesexport const SIDE_PANEL_ID = "ide-side-panel";const OPEN_KEY = "jarvis.agenticIde.sidePanelOpen";-// v4: the panel starts with Agents alone and the other tabs are added from-// its "+" menu (maintainer, 2026-09-28); older lists opened every tab.-const TABS_KEY = "jarvis.agenticIde.sidePanelTabs.v4";+// v5: the panel starts empty and offers the "Open a surface" launcher; the+// reader picks what to open (maintainer, 2026-10-07). Older lists reopened+// every tab they had ever added.+const TABS_KEY = "jarvis.agenticIde.sidePanelTabs.v5";-const DEFAULT_TABS: SidePanelTabId[] = ["agents"];+const DEFAULT_TABS: SidePanelTabId[] = [];+/** Stand-in for `active` while no tab is open; the panel then shows the launcher. */+const NO_TAB: SidePanelTabId = "agents";const isTabId = (value: unknown): value is SidePanelTabId =>typeof value === "string" && (SIDE_PANEL_TAB_IDS as readonly string[]).includes(value);@@ -57,10 +60,10 @@ function storedTabs(): { tabs: SidePanelTabId[]; active: SidePanelTabId } {active?: unknown;} | null;const tabs = Array.isArray(raw?.tabs) ? [...new Set(raw.tabs.filter(isTabId))] : [];- if (tabs.length === 0) return { tabs: DEFAULT_TABS, active: DEFAULT_TABS[0] };+ if (tabs.length === 0) return { tabs: DEFAULT_TABS, active: NO_TAB };return { tabs, active: isTabId(raw?.active) && tabs.includes(raw.active) ? raw.active : tabs[0] };} catch {- return { tabs: DEFAULT_TABS, active: DEFAULT_TABS[0] };+ return { tabs: DEFAULT_TABS, active: NO_TAB };}}@@ -70,7 +73,7 @@ function persist(open: boolean, tabs: SidePanelTabId[], active: SidePanelTabId):// Shell processes belong to this window. A reload must not silently start// replacements for commands that were running before the window closed.const saved = tabs.filter(isTabId);- localStorage.setItem(TABS_KEY, JSON.stringify({ tabs: saved, active: isTabId(active) ? active : saved[0] }));+ localStorage.setItem(TABS_KEY, JSON.stringify({ tabs: saved, active: isTabId(active) ? active : saved[0] ?? NO_TAB }));} catch {/* a convenience only: the panel still works for this session */}@@ -95,7 +98,7 @@ interface IdeSidePanelState {/** Open a tab (or bring it forward when it is already open). */openTab: (id: SidePanelTabId) => void;select: (id: SidePanelTabId) => void;- /** Closing the last tab collapses the panel; reopening starts fresh. */+ /** Closing the last tab leaves the panel open on the "Open a surface" launcher. */closeTab: (id: SidePanelTabId) => void;spotlight: PaneSpotlight | null;setSpotlight: (spotlight: PaneSpotlight | null) => void;@@ -162,8 +165,8 @@ export const useIdeSidePanelStore = create<IdeSidePanelState>((set, get) => {const rest = tabs.filter((tab) => tab !== id);set({ terminals: get().terminals.filter((terminal) => terminal.id !== id) });if (rest.length === 0) {- set({ spotlight: null, maximized: false, inUse: false });- commit({ open: false, tabs: DEFAULT_TABS, active: DEFAULT_TABS[0] });+ set({ spotlight: null, maximized: false });+ commit({ tabs: DEFAULT_TABS, active: NO_TAB });return;}commit({ tabs: rest, active: active === id ? rest[Math.max(0, index - 1)] : active });