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.

perf(ui): bring the startup bundle back under budget (1474 KB -> 1009 KB)

rubenluetke10-beepd2b55d6328e4
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 72c4befdf6..192ddf10fd 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx
@@ -4,7 +4,7 @@ import { fill, useT } from "@/i18n";
import { cn } from "@/lib/utils";
import { useResizablePane } from "@/hooks/useResizablePane";
import { PaneResizer } from "@/components/layout/PaneResizer";
-import { useIdeSidePanelStore } from "@/store/ideSidePanel";
+import { SIDE_PANEL_ID, useIdeSidePanelStore } from "@/store/ideSidePanel";
import { useExplorerPathRouting } from "@/store/ideExplorer";
import { usePaneReviewTracking } from "@/store/paneReviews";
import { useIdeProjectsStore } from "@/store/ideProjects";
@@ -21,8 +21,6 @@ const OFFICE_MIN_PX = 520;
/** Terminal canvas kept visible while the panel is open. */
const GRID_RESERVED_PX = 320;
-export const SIDE_PANEL_ID = "ide-side-panel";
-
const HEADER_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 " +
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanelToggle.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanelToggle.tsx
index 538bb6e419..522eae8241 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanelToggle.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanelToggle.tsx
@@ -2,8 +2,7 @@ import { PanelRightClose, PanelRightOpen } from "lucide-react";
import { useT } from "@/i18n";
import { cn } from "@/lib/utils";
import { useEventStore } from "@/store/events";
-import { useIdeSidePanelStore } from "@/store/ideSidePanel";
-import { SIDE_PANEL_ID } from "./IdeSidePanel";
+import { SIDE_PANEL_ID, useIdeSidePanelStore } from "@/store/ideSidePanel";
/**
* Opens and shuts the Agentic IDE's right-hand side panel.
diff --git a/jarvis/ui/web/frontend/src/components/home/TurnSteps.test.tsx b/jarvis/ui/web/frontend/src/components/home/TurnSteps.test.tsx
index 282d328599..bf617c1fe1 100644
--- a/jarvis/ui/web/frontend/src/components/home/TurnSteps.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/home/TurnSteps.test.tsx
@@ -1,19 +1,25 @@
import { cleanup, render, screen } from "@testing-library/react";
-import { afterEach, expect, it } from "vitest";
-import { TurnSteps, formatThoughtDuration, traceWorthShowing } from "./TurnSteps";
+import { afterEach, beforeAll, expect, it } from "vitest";
+import { TurnSteps, formatThoughtDuration, loadTurnTrace, traceWorthShowing } from "./TurnSteps";
import type { ThinkingStep } from "@/lib/thinkingSteps";
afterEach(cleanup);
-it("keeps brief voice errors visible", () => {
+// The trace renderer is a lazy chunk (see TurnSteps). Loading it once up front
+// keeps a slow first transform out of the per-test wait; what it draws still
+// arrives a tick after the render, so the assertions use findBy*.
+beforeAll(async () => {
+ await loadTurnTrace();
+}, 30_000);
+it("keeps brief voice errors visible", async () => {
const steps: ThinkingStep[] = [{ id: "s", kind: "note", status: "error", labelKey: "thinking.step_update", error: "Connection lost", startedTs: 0 }];
expect(traceWorthShowing(steps, 20, false)).toBe(true);
render(<TurnSteps steps={steps} durationMs={20} />);
- expect(screen.getByText("Connection lost")).toBeTruthy();
+ expect(await screen.findByText("Connection lost")).toBeTruthy();
});
-it("does not hide live work with no events", () => {
+it("does not hide live work with no events", async () => {
const { rerender, container } = render(<TurnSteps steps={[]} />);
expect(container.textContent).toBe("");
rerender(<TurnSteps steps={[]} live />);
- expect(screen.getByRole("status").textContent).toContain("Working");
+ expect((await screen.findByRole("status")).textContent).toContain("Working");
});
it("preserves the public duration formatter", () => {
expect(formatThoughtDuration(65000)).toBe("1m 05s");
diff --git a/jarvis/ui/web/frontend/src/components/home/TurnSteps.tsx b/jarvis/ui/web/frontend/src/components/home/TurnSteps.tsx
index 1407dc3b8e..3404d5b64c 100644
--- a/jarvis/ui/web/frontend/src/components/home/TurnSteps.tsx
+++ b/jarvis/ui/web/frontend/src/components/home/TurnSteps.tsx
@@ -1,5 +1,21 @@
+import { lazy, Suspense } from "react";
import type { ThinkingStep } from "@/lib/thinkingSteps";
-import { VoiceWorkTrace } from "@/components/agentchat/VoiceWorkTrace";
+
+/**
+ * The trace renderer is code-split out of the entry chunk.
+ *
+ * The voice stage is the front page, but a trace only exists once a turn has
+ * run — and the renderer behind it (WorkTrace) carries the whole markdown
+ * stack (react-markdown, micromark, mdast/hast, remark-gfm) plus the tool and
+ * brand logo tables, over 300 KB the WebView would otherwise parse before its
+ * first paint just to show an empty greeting. `MainView` warms this chunk in its first idle slot through
+ * {@link loadTurnTrace}, so by the time a turn starts it is already resolved
+ * and renders synchronously.
+ */
+export const loadTurnTrace = () =>
+ import("@/components/agentchat/VoiceWorkTrace").then((m) => ({ default: m.VoiceWorkTrace }));
+
+const VoiceWorkTrace = lazy(loadTurnTrace);
export interface TurnStepsProps {
steps: ThinkingStep[];
@@ -38,5 +54,11 @@ export function traceWorthShowing(
export function TurnSteps({ steps, live = false, durationMs, className }: TurnStepsProps) {
if (!traceWorthShowing(steps, durationMs, live)) return null;
- return <VoiceWorkTrace steps={steps} live={live} durationMs={durationMs} className={className} />;
+ // No placeholder while the chunk is in flight: the trace appears with its
+ // turn anyway, and an empty slot is quieter than a row that swaps shape.
+ return (
+ <Suspense fallback={null}>
+ <VoiceWorkTrace steps={steps} live={live} durationMs={durationMs} className={className} />
+ </Suspense>
+ );
}
diff --git a/jarvis/ui/web/frontend/src/components/layout/MainView.tsx b/jarvis/ui/web/frontend/src/components/layout/MainView.tsx
index 3f689716e4..e87e30807a 100644
--- a/jarvis/ui/web/frontend/src/components/layout/MainView.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/MainView.tsx
@@ -22,6 +22,7 @@ import { cn } from "@/lib/utils";
import { ViewErrorBoundary } from "@/components/ViewErrorBoundary";
import { DetachedViewPlaceholder } from "@/components/layout/DetachedViewPlaceholder";
import { SETTINGS_HUB_IDS } from "@/components/layout/navGroups";
+import { loadTurnTrace } from "@/components/home/TurnSteps";
// Type-only, so the section's chunk stays split out of the entry bundle.
import type { AgenticIdeViewProps } from "@/views/AgenticIdeView";
// The default section is the one view that must be on screen the moment React
@@ -57,6 +58,11 @@ type ViewLoader = () => Promise<ViewModule>;
*/
const prefetchQueue: (() => Promise<unknown>)[] = [];
+// First in line: the turn-trace renderer of the front page's voice stage. It
+// is split out of the entry (see TurnSteps) but belongs to the screen that is
+// already open, so it is warmed before any other section.
+prefetchQueue.push(loadTurnTrace);
+
function lazyView(loader: ViewLoader): LazyExoticComponent<ComponentType> {
prefetchQueue.push(loader);
return lazy(loader);
diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
index bd26df5883..4ea6d87502 100644
--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
@@ -32,7 +32,8 @@ import { useAgentChatStore } from "@/store/agentChat";
import { IdeProjectTree } from "@/components/agentic/IdeProjectTree";
import { useIdeProjectsStore } from "@/store/ideProjects";
import { useAppInstance } from "@/hooks/useAppInstance";
-import { usePublishIdentity } from "@/components/marketplace/PublishIdentity";
+// The query alone, not ./PublishIdentity: the sign-in UI stays out of the entry chunk.
+import { usePublishIdentity } from "@/components/marketplace/publishIdentityQuery";
import { GigiMark } from "@/components/GigiMark";
import * as Dialog from "@radix-ui/react-dialog";
import { startNewVoiceRun } from "@/lib/chatsApi";
diff --git a/jarvis/ui/web/frontend/src/components/marketplace/PublishIdentity.tsx b/jarvis/ui/web/frontend/src/components/marketplace/PublishIdentity.tsx
index a072499f99..64cc1f63be 100644
--- a/jarvis/ui/web/frontend/src/components/marketplace/PublishIdentity.tsx
+++ b/jarvis/ui/web/frontend/src/components/marketplace/PublishIdentity.tsx
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useRef, useState } from "react";
-import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import { useMutation, useQueryClient } from "@tanstack/react-query";
import {
AlertTriangle,
Check,
@@ -19,6 +19,13 @@ import { fill, useLocaleChunk, useT } from "@/i18n";
import { robustCopy } from "@/lib/clipboard";
import { openExternalUrl } from "@/lib/openExternal";
import { cn } from "@/lib/utils";
+import { PUBLISH_IDENTITY_KEY, usePublishIdentity, type PublishIdentityWire } from "./publishIdentityQuery";
+
+// The identity query itself lives in ./publishIdentityQuery so the always-on
+// sidebar can read who is signed in without linking this module (the sign-in
+// flow, its dialog and the publisher chips) into the entry chunk. Re-exported
+// here so every publishing surface keeps one import.
+export { PUBLISH_IDENTITY_KEY, usePublishIdentity, type PublishIdentityWire };
// ---------------------------------------------------------------------------
// One identity for everything the app publishes.
@@ -37,18 +44,6 @@ import { cn } from "@/lib/utils";
// nothing on their account.
// ---------------------------------------------------------------------------
-export interface PublishIdentityWire {
- /** Package publishing (plugins and skills) is configured. */
- enabled: boolean;
- /** The wallpaper lane is configured — a fork may run one without the other. */
- wallpapers_enabled?: boolean;
- signed_in: boolean;
- login?: string;
- avatar_url?: string | null;
- /** Set when GitHub could not be reached — NOT the same as signed out. */
- unreachable?: string;
-}
-
interface SigninStartWire {
flow_id: string;
user_code: string;
@@ -57,21 +52,8 @@ interface SigninStartWire {
interval?: number;
}
-export const PUBLISH_IDENTITY_KEY = ["marketplace-publish-identity"] as const;
-
const GITHUB_DEVICE_URL = "https://github.com/login/device";
-async function fetchIdentity(): Promise<PublishIdentityWire> {
- const res = await fetch("/api/marketplace/publish/identity", { cache: "no-store" });
- if (!res.ok) throw new Error(`Identity request failed (${res.status})`);
- return res.json();
-}
-
-/** Who is signed in, shared by every surface that publishes. */
-export function usePublishIdentity() {
- return useQuery({ queryKey: PUBLISH_IDENTITY_KEY, queryFn: fetchIdentity });
-}
-
/**
* The device-flow state machine: start → poll → connected | error, plus
* cancel and sign-out. One hook so the header chip, the sign-in dialog and
diff --git a/jarvis/ui/web/frontend/src/components/marketplace/publishIdentityQuery.ts b/jarvis/ui/web/frontend/src/components/marketplace/publishIdentityQuery.ts
new file mode 100644
index 0000000000..8b7cdde6ee
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/marketplace/publishIdentityQuery.ts
@@ -0,0 +1,34 @@
+import { useQuery } from "@tanstack/react-query";
+
+/**
+ * Who is signed in to publish — the one query every publishing surface shares.
+ *
+ * Split out of ./PublishIdentity so the sidebar, which shows the signed-in
+ * login on every screen, reads it without pulling the device-flow sign-in UI
+ * into the entry chunk. ./PublishIdentity re-exports all of it.
+ */
+
+export interface PublishIdentityWire {
+ /** Package publishing (plugins and skills) is configured. */
+ enabled: boolean;
+ /** The wallpaper lane is configured — a fork may run one without the other. */
+ wallpapers_enabled?: boolean;
+ signed_in: boolean;
+ login?: string;
+ avatar_url?: string | null;
+ /** Set when GitHub could not be reached — NOT the same as signed out. */
+ unreachable?: string;
+}
+
+export const PUBLISH_IDENTITY_KEY = ["marketplace-publish-identity"] as const;
+
+async function fetchIdentity(): Promise<PublishIdentityWire> {
+ const res = await fetch("/api/marketplace/publish/identity", { cache: "no-store" });
+ if (!res.ok) throw new Error(`Identity request failed (${res.status})`);
+ return res.json();
+}
+
+/** Who is signed in, shared by every surface that publishes. */
+export function usePublishIdentity() {
+ return useQuery({ queryKey: PUBLISH_IDENTITY_KEY, queryFn: fetchIdentity });
+}
diff --git a/jarvis/ui/web/frontend/src/store/ideSidePanel.ts b/jarvis/ui/web/frontend/src/store/ideSidePanel.ts
index d75867d55a..37a4b3c356 100644
--- a/jarvis/ui/web/frontend/src/store/ideSidePanel.ts
+++ b/jarvis/ui/web/frontend/src/store/ideSidePanel.ts
@@ -15,6 +15,15 @@ export type SidePanelTabId = "agents" | "changes" | "files" | "git" | "office";
export const SIDE_PANEL_TAB_IDS: readonly SidePanelTabId[] = ["agents", "changes", "files", "git", "office"];
+/**
+ * DOM id of the panel host, for the toggle's `aria-controls`.
+ *
+ * It lives here rather than in the panel's module because the toggle sits in
+ * the always-loaded window caption: importing it from `IdeSidePanel` linked the
+ * whole panel (explorer, git overview, agents overview) into the entry chunk.
+ */
+export 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.