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): swap chat rail terminals by drag
rubenluetke10-beep3cff2185233b
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsxindex 768e5f41ca..2b1b03b46d 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx@@ -2540,6 +2540,27 @@ describe("chat view", () => {const toChat = () => fireEvent.click(screen.getByTestId("agentic-view-mode-toggle"));+ const railOrder = () =>+ screen+ .getAllByTestId(/^chat-rail-item-/)+ .map((item) => item.dataset.terminal);++ function placeRailItem(name: string, top: number) {+ const item = screen.getByTestId(`chat-rail-item-${name}`);+ item.getBoundingClientRect = () =>+ ({+ left: 0,+ top,+ width: 200,+ height: 36,+ right: 200,+ bottom: top + 36,+ x: 0,+ y: top,+ toJSON: () => ({}),+ }) as DOMRect;+ }+it("starts in the grid, with the rail hidden", () => {renderGrid(FOUR);expect(screen.getByTestId("agentic-chat-rail").className).toContain("hidden");@@ -2633,6 +2654,63 @@ describe("chat view", () => {expect(cellClass("Mika")).toContain("hidden");});+ it("swaps two rail positions by dragging without moving or remounting the panes", async () => {+ renderGrid(FOUR);+ const paneBefore = screen.getByTestId("pane-Mika");+ toChat();+ placeRailItem("Mika", 0);+ placeRailItem("Nova", 36);+ placeRailItem("Aria", 72);+ placeRailItem("Kai", 108);++ fireEvent(+ screen.getByTestId("chat-rail-Mika"),+ new MouseEvent("pointerdown", {+ bubbles: true,+ clientX: 40,+ clientY: 18,+ button: 0,+ }),+ );+ act(() => {+ window.dispatchEvent(+ new MouseEvent("pointermove", { clientX: 40, clientY: 90 }),+ );+ });++ expect(screen.getByTestId("chat-rail-arrange-ghost").textContent).toContain(+ "Mika",+ );+ expect(screen.getByTestId("chat-rail-item-Aria").className).toContain(+ "ring-primary/70",+ );++ await act(async () => {+ window.dispatchEvent(new MouseEvent("pointerup"));+ });++ expect(railOrder()).toEqual(["Aria", "Nova", "Mika", "Kai"]);+ expect(api.moveTerminal).not.toHaveBeenCalled();+ expect(screen.getByTestId("pane-Mika")).toBe(paneBefore);+ // Chromium follows a drag release with a compatibility click on the row+ // below it. That click belongs to the drag and must not switch the stage.+ fireEvent.click(screen.getByTestId("chat-rail-Aria"));+ expect(cellClass("Mika")).not.toContain("hidden");+ expect(cellClass("Aria")).toContain("hidden");+ await waitFor(() =>+ expect(+ JSON.parse(+ window.localStorage.getItem("jarvis.agenticIde.chatOrder.v1.ide_test") ??+ "[]",+ ),+ ).toEqual(["aria@0", "nova@0", "mika@0", "kai@0"]),+ );++ cleanup();+ renderGrid(FOUR);+ expect(railOrder()).toEqual(["Aria", "Nova", "Mika", "Kai"]);+ });+it("grounds deictic voice references in the pane visibly on stage", async () => {renderGrid(FOUR);await waitFor(() =>diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsxindex 0385ce29fd..7e48c220e8 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx@@ -74,7 +74,14 @@ import { PromptPreview } from "./PromptPreview";import { PromptEditor } from "./PromptEditor";import { WorkspaceSettings } from "./WorkspaceSettings";import { usePaneFileDrag } from "./paneFileDrag";-import { initialChatOrder, orderChatTerminals, reconcileChatOrder, sameRows } from "./chatState";+import {+ chatTerminalIdentity,+ initialChatOrder,+ orderChatTerminals,+ reconcileChatOrder,+ sameRows,+ swapChatOrder,+} from "./chatState";import {extractPaneDrop,extractPasteFiles,@@ -1408,6 +1415,43 @@ export function AgenticGrid({.some((field) => String(field).toLowerCase().includes(needle)),);}, [chatTerminals, railFilter]);++ /*+ * The chat rail is a user's reading order, independent of the pane grid.+ * Dropping one row on another exchanges only their stable lifetime keys: no+ * terminal moves, remounts or reconnects, and the existing storage effect+ * below makes the chosen order survive the next visit.+ */+ const suppressRailClickUntil = useRef(0);+ const swapRailTerminals = useCallback(+ (moved: string, targetName: string) => {+ const movedTerminal = session.terminals.find((terminal) => terminal.name === moved);+ const targetTerminal = session.terminals.find(+ (terminal) => terminal.name === targetName,+ );+ if (!movedTerminal || !targetTerminal) return;+ const next = swapChatOrder(+ stableChatKeys,+ chatTerminalIdentity(movedTerminal),+ chatTerminalIdentity(targetTerminal),+ );+ if (next === stableChatKeys) return;+ // Releasing over a row also produces a click in Chromium. Suppress that+ // compatibility click so a reorder does not unexpectedly change stages.+ suppressRailClickUntil.current = Date.now() + 250;+ setChatOrder({ workspaceId: session.id, keys: next });+ },+ [session.id, session.terminals, stableChatKeys],+ );+ const railArrange = usePaneArrange(+ useCallback(+ (moved: string, targetName: string) => swapRailTerminals(moved, targetName),+ [swapRailTerminals],+ ),+ );+ const canReorderRail =+ chatView && !selectionMode && !busy && !working && railTerminals.length > 1;+useEffect(() => {rememberChatOrder(session.id, stableChatKeys);if (chatOrder.workspaceId === session.id && chatOrder.keys === stableChatKeys) {@@ -2427,20 +2471,40 @@ export function AgenticGrid({* button inside a button is invalid HTML, and browsers resolve* it by dropping one of them — usually the one you wanted.*/- <div key={term.key} className="group relative ml-3 mb-0.5">+ <div+ key={term.key}+ ref={railArrange.registerCell(term.name)}+ data-testid={`chat-rail-item-${term.name}`}+ data-terminal={term.name}+ className={cn(+ "group relative ml-3 mb-0.5 rounded-md transition-[opacity,box-shadow,background-color]",+ railArrange.held === term.name && "opacity-50",+ railArrange.hover?.target === term.name &&+ "bg-primary/10 ring-2 ring-inset ring-primary/70",+ )}+ ><buttontype="button"data-testid={`chat-rail-${term.name}`}aria-label={`${title}, ${term.display_name || term.agent}`}aria-pressed={selectionMode ? marked : active}- onClick={() =>+ onPointerDown={+ canReorderRail+ ? (event) => railArrange.start(term.name, event)+ : undefined+ }+ onClick={(event) => {+ if (Date.now() < suppressRailClickUntil.current) {+ event.preventDefault();+ return;+ }// Selection mode borrows the rail: in chat view the grid's// per-pane overlays are hidden with their panes, so the// rail is where a multi-close is composed.selectionMode? toggleTerminalSelection(term.name)- : selectChatPane(term.name, takesPrompts(term))- }+ : selectChatPane(term.name, takesPrompts(term));+ }}/** Selection is a barely-there lift of the surface — no hue,* no border, no fill. Eleven rows of tinted boxes turn a@@ -2456,7 +2520,12 @@ export function AgenticGrid({: active && !selectionMode? "bg-foreground/[0.09]": "hover:bg-foreground/[0.055]",+ canReorderRail &&+ (railArrange.held === term.name+ ? "cursor-grabbing"+ : "cursor-grab"),)}+ style={{ touchAction: canReorderRail ? "none" : undefined }}>{/* The right padding is permanent, not applied on hover:the close button appears where the badge would otherwise@@ -3084,6 +3153,24 @@ export function AgenticGrid({)}</div>)}+ {railArrange.held !== null && railArrange.point !== null && (+ <div+ data-testid="chat-rail-arrange-ghost"+ className="pointer-events-none fixed z-50 flex items-center gap-1.5 rounded-lg border border-primary/60 bg-card px-2.5 py-1.5 text-xs font-semibold shadow-xl"+ style={{ left: railArrange.point.x + 14, top: railArrange.point.y + 14 }}+ >+ <GripVertical className="h-3.5 w-3.5 text-primary" />+ {railArrange.held}+ <span className="font-normal text-muted-foreground">+ {railArrange.hover === null+ ? t("agentic_grid.arrange.carrying")+ : t("agentic_grid.arrange.swap").replace(+ "{0}",+ railArrange.hover.target,+ )}+ </span>+ </div>+ )}</div>);}diff --git a/jarvis/ui/web/frontend/src/components/agentic/chatState.test.ts b/jarvis/ui/web/frontend/src/components/agentic/chatState.test.tsindex 6fcaea0508..63e33ea0c4 100644--- a/jarvis/ui/web/frontend/src/components/agentic/chatState.test.ts+++ b/jarvis/ui/web/frontend/src/components/agentic/chatState.test.ts@@ -6,6 +6,7 @@ import {orderChatTerminals,reconcileChatOrder,sameRows,+ swapChatOrder,} from "./chatState";function terminal(@@ -102,6 +103,17 @@ describe("chat session ordering", () => {);expect(chatTerminalIdentity(replacement)).toBe("new-t1");});++ it("exchanges exactly the two sessions that were dragged together", () => {+ expect(swapChatOrder(["first", "second", "third", "fourth"], "first", "third"))+ .toEqual(["third", "second", "first", "fourth"]);+ });++ it("keeps the existing order object when either dragged session is gone", () => {+ const order = ["first", "second"];+ expect(swapChatOrder(order, "first", "gone")).toBe(order);+ expect(swapChatOrder(order, "first", "first")).toBe(order);+ });});describe("recap poll equality", () => {diff --git a/jarvis/ui/web/frontend/src/components/agentic/chatState.ts b/jarvis/ui/web/frontend/src/components/agentic/chatState.tsindex e09c5f803c..159008181c 100644--- a/jarvis/ui/web/frontend/src/components/agentic/chatState.ts+++ b/jarvis/ui/web/frontend/src/components/agentic/chatState.ts@@ -34,6 +34,22 @@ export function reconcileChatOrder(return sameStrings(previous, next) ? previous : next;}+/** Exchange two session positions without disturbing any rows between them. */+export function swapChatOrder(+ previous: readonly string[],+ first: string,+ second: string,+): readonly string[] {+ if (first === second) return previous;+ const firstIndex = previous.indexOf(first);+ const secondIndex = previous.indexOf(second);+ if (firstIndex < 0 || secondIndex < 0) return previous;+ const next = [...previous];+ next[firstIndex] = second;+ next[secondIndex] = first;+ return next;+}+/** Put terminal objects into the stable order used by the chat rail. */export function orderChatTerminals(terminals: readonly TerminalState[],