Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

feat(dashboard): UI improvements from allocation-strategies branch

Data152bf8374ed1
diff --git a/dashboard/index.html b/dashboard/index.html
index 00ca2ee6..847cf3c6 100644
--- a/dashboard/index.html
+++ b/dashboard/index.html
@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
- <link rel="icon" type="image/png" href="/pinchtab-headed-192.png" />
+ <link rel="icon" type="image/png" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>PinchTab</title>
</head>
diff --git a/dashboard/public/favicon.png b/dashboard/public/favicon.png
new file mode 100644
index 00000000..0dac8ca3
Binary files /dev/null and b/dashboard/public/favicon.png differ
diff --git a/dashboard/src/App.tsx b/dashboard/src/App.tsx
index 4e5c7084..3f389ca7 100644
--- a/dashboard/src/App.tsx
+++ b/dashboard/src/App.tsx
@@ -18,7 +18,7 @@ import {
import * as api from "./services/api";
function AppContent() {
- const { setInstances, setProfiles, setAgents } = useAppStore();
+ const { setInstances, setProfiles, setAgents, setServerInfo } = useAppStore();
const location = useLocation();
// Log navigation for debugging
@@ -30,18 +30,20 @@ function AppContent() {
useEffect(() => {
const load = async () => {
try {
- const [instances, profiles] = await Promise.all([
+ const [instances, profiles, health] = await Promise.all([
api.fetchInstances(),
api.fetchProfiles(),
+ api.fetchHealth(),
]);
setInstances(instances);
setProfiles(profiles);
+ setServerInfo(health);
} catch (e) {
console.error("Failed to load initial data", e);
}
};
load();
- }, [setInstances, setProfiles]);
+ }, [setInstances, setProfiles, setServerInfo]);
// Subscribe to SSE events
useEffect(() => {
@@ -73,7 +75,7 @@ function AppContent() {
return (
<div className="flex h-screen flex-col bg-bg-app">
<NavBar />
- <main className="flex flex-1 overflow-hidden">
+ <main className="flex-1 overflow-hidden">
<Routes>
<Route path="/" element={<Navigate to="/monitoring" replace />} />
<Route path="/monitoring" element={<MonitoringPage />} />
diff --git a/dashboard/src/components/molecules/NavBar.tsx b/dashboard/src/components/molecules/NavBar.tsx
index 83583eb6..6d367a02 100644
--- a/dashboard/src/components/molecules/NavBar.tsx
+++ b/dashboard/src/components/molecules/NavBar.tsx
@@ -1,5 +1,6 @@
import { useCallback, useEffect, useRef, useState } from "react";
import { NavLink, useLocation } from "react-router-dom";
+import { useAppStore } from "../../stores/useAppStore";
import "./NavBar.css";
interface Tab {
@@ -20,6 +21,7 @@ interface NavBarProps {
}
export default function NavBar({ onRefresh }: NavBarProps) {
+ const { serverInfo } = useAppStore();
const [refreshing, setRefreshing] = useState(false);
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
const tabsRef = useRef<HTMLElement>(null);
@@ -81,6 +83,14 @@ export default function NavBar({ onRefresh }: NavBarProps) {
</nav>
<div className="ml-auto flex items-center gap-1.5">
+ {serverInfo && (
+ <div className="mr-2 flex items-center gap-1.5 rounded-full bg-success/10 px-2.5 py-1">
+ <div className="h-1.5 w-1.5 rounded-full bg-success animate-pulse" />
+ <span className="text-[10px] font-bold text-success uppercase tracking-wider">
+ Running
+ </span>
+ </div>
+ )}
{onRefresh && (
<button
className={`navbar-icon-btn flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-transparent bg-transparent text-base text-text-muted transition-all duration-150 hover:border-border-subtle hover:bg-bg-elevated hover:text-text-secondary focus-visible:shadow-[0_0_0_2px_var(--primary)/25] focus-visible:outline-none ${
diff --git a/dashboard/src/components/molecules/ServerSummary.tsx b/dashboard/src/components/molecules/ServerSummary.tsx
new file mode 100644
index 00000000..f6e33feb
--- /dev/null
+++ b/dashboard/src/components/molecules/ServerSummary.tsx
@@ -0,0 +1,75 @@
+import { useAppStore } from "../../stores/useAppStore";
+import { Card } from "../atoms";
+
+export default function ServerSummary() {
+ const { serverInfo } = useAppStore();
+
+ if (!serverInfo) return null;
+
+ const uptimeStr = (uptimeMs: number) => {
+ const seconds = Math.floor(uptimeMs / 1000);
+ const h = Math.floor(seconds / 3600);
+ const m = Math.floor((seconds % 3600) / 60);
+ const s = seconds % 60;
+ if (h > 0) return `${h}h ${m}m ${s}s`;
+ if (m > 0) return `${m}m ${s}s`;
+ return `${s}s`;
+ };
+
+ const copyToClipboard = (text: string) => {
+ navigator.clipboard.writeText(text);
+ };
+
+ return (
+ <div className="flex flex-col gap-4">
+ <Card className="p-3 flex flex-col gap-3 bg-bg-surface/50">
+ <div className="mb-1 border-b border-border-subtle pb-2">
+ <h2 className="text-[10px] font-bold tracking-widest text-text-muted uppercase">
+ Server Information
+ </h2>
+ <p className="text-[9px] text-text-muted italic opacity-70">
+ Technical details for current session
+ </p>
+ </div>
+
+ <div className="flex flex-col gap-0.5">
+ <label className="text-[10px] font-semibold text-text-muted uppercase tracking-tight">
+ Version
+ </label>
+ <div className="text-sm font-mono text-text-secondary">
+ {serverInfo.version}
+ </div>
+ </div>
+
+ <div className="flex flex-col gap-0.5">
+ <label className="text-[10px] font-semibold text-text-muted uppercase tracking-tight">
+ Uptime
+ </label>
+ <div className="text-sm text-text-secondary">
+ {uptimeStr(serverInfo.uptime)}
+ </div>
+ </div>
+
+ {serverInfo.configPath && (
+ <div className="flex flex-col gap-0.5">
+ <label className="text-[10px] font-semibold text-text-muted uppercase tracking-tight">
+ Config
+ </label>
+ <div
+ className="group flex cursor-pointer items-center justify-between rounded bg-bg-elevated px-2 py-1 transition-colors hover:bg-border-subtle"
+ onClick={() => copyToClipboard(serverInfo.configPath!)}
+ title="Click to copy path"
+ >
+ <span className="truncate text-[10px] font-mono text-text-muted">
+ {serverInfo.configPath.split("/").pop()}
+ </span>
+ <span className="text-[10px] opacity-0 group-hover:opacity-100 transition-opacity">
+ πŸ“‹
+ </span>
+ </div>
+ </div>
+ )}
+ </Card>
+ </div>
+ );
+}
diff --git a/dashboard/src/components/molecules/TabItem.tsx b/dashboard/src/components/molecules/TabItem.tsx
index 2951fca0..4ea4e010 100644
--- a/dashboard/src/components/molecules/TabItem.tsx
+++ b/dashboard/src/components/molecules/TabItem.tsx
@@ -1,3 +1,4 @@
+import { useState } from "react";
import { Card } from "../atoms";
import type { InstanceTab } from "../../generated/types";
@@ -7,23 +8,59 @@ interface Props {
}
export default function TabItem({ tab, compact }: Props) {
+ const [copied, setCopied] = useState(false);
+
+ const handleCopy = (e: React.MouseEvent) => {
+ e.stopPropagation();
+ navigator.clipboard.writeText(tab.id);
+ setCopied(true);
+ setTimeout(() => setCopied(false), 2000);
+ };
+
+ const shortId = tab.id.split("_").pop()?.substring(0, 8) || tab.id;
+
+ const idBadge = (
+ <button
+ onClick={handleCopy}
+ title={`Click to copy full ID: ${tab.id}`}
+ className="group flex shrink-0 items-center gap-1.5 rounded bg-bg-elevated px-1.5 py-0.5 text-[10px] font-mono text-text-muted transition-colors hover:bg-border-subtle hover:text-text-primary focus:outline-none"
+ >
+ <span>{shortId}</span>
+ <span className="text-[8px] opacity-0 transition-opacity group-hover:opacity-100">
+ {copied ? "βœ…" : "πŸ“‹"}
+ </span>
+ </button>
+ );
+
if (compact) {
return (
<div className="border-b border-border-subtle py-2">
- <div className="truncate text-sm text-text-primary">
- {tab.title || "Untitled"}
+ <div className="flex items-center gap-2 overflow-hidden">
+ {idBadge}
+ <div className="text-text-muted/30">|</div>
+ <div className="truncate text-sm font-medium text-text-primary">
+ {tab.title || "Untitled"}
+ </div>
+ </div>
+ <div className="mt-0.5 truncate text-[11px] text-text-muted opacity-70">
+ {tab.url}
</div>
- <div className="truncate text-xs text-text-muted">{tab.url}</div>
</div>
);
}
return (
- <Card className="p-2">
- <div className="truncate text-sm text-text-primary">
- {tab.title || "Untitled"}
+ <Card className="p-3">
+ <div className="flex items-center gap-2 overflow-hidden">
+ {idBadge}
+ <div className="text-text-muted/30">|</div>
+ <div className="truncate text-sm font-medium text-text-primary">
+ {tab.title || "Untitled"}
+ </div>
+ </div>
+ <div className="mt-1 truncate text-xs text-text-muted opacity-80">
+ {tab.url}
</div>
- <div className="truncate text-xs text-text-muted">{tab.url}</div>
</Card>
);
}
diff --git a/dashboard/src/components/molecules/TabsChart.tsx b/dashboard/src/components/molecules/TabsChart.tsx
index d7bfc268..9e77cf83 100644
--- a/dashboard/src/components/molecules/TabsChart.tsx
+++ b/dashboard/src/components/molecules/TabsChart.tsx
@@ -103,7 +103,7 @@ export default function TabsChart({
// Show empty state if no data or too few points to render meaningfully
if (mergedData.length < 2) {
return (
- <div className="flex h-[200px] items-center justify-center rounded-lg border border-border-subtle bg-bg-surface text-sm text-text-muted">
+ <div className="flex h-50 items-center justify-center rounded-lg border border-border-subtle bg-bg-surface text-sm text-text-muted">
{mergedData.length === 0
? "Collecting data..."
: "Waiting for more data..."}
diff --git a/dashboard/src/components/molecules/index.ts b/dashboard/src/components/molecules/index.ts
index d0098673..dbdc66e9 100644
--- a/dashboard/src/components/molecules/index.ts
+++ b/dashboard/src/components/molecules/index.ts
@@ -8,3 +8,4 @@ export { default as TabItem } from "./TabItem";
export { default as AgentItem } from "./AgentItem";
export { default as ActivityLine } from "./ActivityLine";
export { default as TabsChart } from "./TabsChart";
+export { default as ServerSummary } from "./ServerSummary";
diff --git a/dashboard/src/generated/types.ts b/dashboard/src/generated/types.ts
index 6387fb07..053742c2 100644
--- a/dashboard/src/generated/types.ts
+++ b/dashboard/src/generated/types.ts
@@ -64,7 +64,7 @@ export interface ActivityEvent {
method: string;
path: string;
timestamp: string;
- details?: { [key: string]: any };
+ details?: { [key: string]: any};
}
/**
* ScreencastSettings configures live tab previews.
@@ -107,6 +107,10 @@ export interface ServerInfo {
profiles: number /* int */;
instances: number /* int */;
agents: number /* int */;
+ strategy?: string;
+ allocationPolicy?: string;
+ tabEvictionPolicy?: string;
+ configPath?: string;
}
/**
* CreateProfileRequest is the request body for creating a profile.
diff --git a/dashboard/src/pages/AgentsPage.tsx b/dashboard/src/pages/AgentsPage.tsx
index a83c9264..6c7890ee 100644
--- a/dashboard/src/pages/AgentsPage.tsx
+++ b/dashboard/src/pages/AgentsPage.tsx
@@ -48,7 +48,7 @@ export default function AgentsPage() {
});
return (
- <div className="flex flex-1 flex-col sm:flex-row">
+ <div className="flex h-full flex-col sm:flex-row">
{/* Mobile: Agents carousel (horizontal scroll) */}
<div className="shrink-0 border-b border-border-subtle bg-bg-surface sm:hidden">
<div className="flex items-center gap-2 overflow-x-auto px-4 py-3">
diff --git a/dashboard/src/pages/MonitoringPage.tsx b/dashboard/src/pages/MonitoringPage.tsx
index f1fe364d..e76e05ec 100644
--- a/dashboard/src/pages/MonitoringPage.tsx
+++ b/dashboard/src/pages/MonitoringPage.tsx
@@ -174,11 +174,11 @@ export default function MonitoringPage() {
return (
<ErrorBoundary>
- <div className="flex flex-1 flex-col gap-4 overflow-auto p-4">
+ <div className="flex h-full flex-col gap-4 overflow-hidden p-4">
{/* Chart - always show, even with no instances (displays server metrics) */}
<ErrorBoundary
fallback={
- <div className="flex h-[200px] items-center justify-center rounded-lg border border-destructive/50 bg-bg-surface text-sm text-destructive">
+ <div className="flex h-50 items-center justify-center rounded-lg border border-destructive/50 bg-bg-surface text-sm text-destructive">
Chart crashed - check console
</div>
}
diff --git a/dashboard/src/pages/ProfilesPage.tsx b/dashboard/src/pages/ProfilesPage.tsx
index 421e1f57..c62d3d63 100644
--- a/dashboard/src/pages/ProfilesPage.tsx
+++ b/dashboard/src/pages/ProfilesPage.tsx
@@ -142,7 +142,7 @@ export default function ProfilesPage() {
const instanceByProfile = new Map(instances.map((i) => [i.profileName, i]));
return (
- <div className="flex flex-1 flex-col">
+ <div className="flex h-full flex-col">
<Toolbar
actions={[
{
diff --git a/dashboard/src/pages/SettingsPage.tsx b/dashboard/src/pages/SettingsPage.tsx
index c9784d87..19085578 100644
--- a/dashboard/src/pages/SettingsPage.tsx
+++ b/dashboard/src/pages/SettingsPage.tsx
@@ -1,11 +1,11 @@
-import { useEffect, useState, useMemo } from "react";
+import { useState, useMemo } from "react";
import { useAppStore } from "../stores/useAppStore";
import { Button, Card } from "../components/atoms";
-import * as api from "../services/api";
+import { ServerSummary } from "../components/molecules";
import type { Settings } from "../types";
export default function SettingsPage() {
- const { settings, serverInfo, setSettings, setServerInfo } = useAppStore();
+ const { settings, setSettings, serverInfo } = useAppStore();
const [local, setLocal] = useState<Settings>(settings);
// Check if settings have changed
@@ -14,20 +14,6 @@ export default function SettingsPage() {
[local, settings],
);
- // Load server info on mount (settings come from localStorage via store)
- useEffect(() => {
- const load = async () => {
- try {
- const h = await api.fetchHealth();
- setServerInfo(h);
- } catch (e) {
- console.error("Failed to load server info", e);
- }
- };
- load();
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, []);
-
const handleSave = () => {
// Settings are persisted to localStorage via setSettings
setSettings(local);
@@ -36,9 +22,9 @@ export default function SettingsPage() {
const handleReset = () => setLocal(settings);
return (
- <div className="flex flex-1 flex-col overflow-auto">
+ <div className="flex h-full flex-col overflow-hidden">
<div className="sticky top-0 z-10 border-b border-border-subtle bg-bg-surface px-4 py-2">
- <div className="mx-auto flex w-full max-w-2xl items-center justify-end gap-2">
+ <div className="flex w-full items-center justify-end gap-2">
<Button
variant="secondary"
onClick={handleReset}
@@ -52,221 +38,247 @@ export default function SettingsPage() {
</div>
</div>
- <div className="mx-auto w-full max-w-2xl space-y-6 p-6">
- {/* Screencast */}
- <Card className="p-4">
- <h3 className="mb-4 text-sm font-semibold text-text-primary">
- πŸ“Ί Screencast
- </h3>
- <div className="space-y-4">
- <div className="flex items-center justify-between">
- <label className="text-sm text-text-secondary">Frame Rate</label>
- <div className="flex items-center gap-2">
- <input
- type="range"
- min={1}
- max={15}
- value={local.screencast.fps}
- onChange={(e) =>
- setLocal({
- ...local,
- screencast: { ...local.screencast, fps: +e.target.value },
- })
- }
- className="w-32"
- />
- <span className="w-12 text-right text-sm text-text-muted">
- {local.screencast.fps} fps
- </span>
+ <div className="flex w-full flex-1 overflow-hidden p-6 gap-8">
+ {/* Sidebar Info */}
+ <aside className="w-64 shrink-0 overflow-y-auto">
+ <ServerSummary />
+ </aside>
+
+ {/* Settings Content */}
+ <div className="flex-1 space-y-6 overflow-y-auto pr-2">
+ {/* Policies & Strategy */}
+ {serverInfo && (
+ <Card className="p-4">
+ <h3 className="mb-4 text-sm font-semibold text-text-primary">
+ βš–οΈ Policies & Strategy
+ </h3>
+ <div className="grid grid-cols-3 gap-6">
+ <div className="space-y-1">
+ <label className="text-[10px] font-semibold text-text-muted uppercase tracking-tight">
+ Allocation Strategy
+ </label>
+ <div className="flex">
+ <span className="rounded bg-primary/10 px-2 py-0.5 text-xs font-bold text-primary uppercase">
+ {serverInfo.strategy || "none"}
+ </span>
+ </div>
+ </div>
+ <div className="space-y-1">
+ <label className="text-[10px] font-semibold text-text-muted uppercase tracking-tight">
+ Selection Policy
+ </label>
+ <div className="text-sm text-text-secondary italic">
+ {serverInfo.allocationPolicy || "fcfs"}
+ </div>
+ </div>
+ <div className="space-y-1">
+ <label className="text-[10px] font-semibold text-text-muted uppercase tracking-tight">
+ Tab Eviction
+ </label>
+ <div className="text-sm text-text-secondary italic">
+ {serverInfo.tabEvictionPolicy || "reject"}
+ </div>
+ </div>
</div>
- </div>
- <div className="flex items-center justify-between">
- <label className="text-sm text-text-secondary">Quality</label>
- <div className="flex items-center gap-2">
- <input
- type="range"
- min={10}
- max={80}
- value={local.screencast.quality}
+ </Card>
+ )}
+
+ {/* Screencast */}
+ <Card className="p-4">
+ <h3 className="mb-4 text-sm font-semibold text-text-primary">
+ πŸ“Ί Screencast
+ </h3>
+ <div className="space-y-4">
+ <div className="flex items-center justify-between">
+ <label className="text-sm text-text-secondary">Frame Rate</label>
+ <div className="flex items-center gap-2">
+ <input
+ type="range"
+ min={1}
+ max={15}
+ value={local.screencast.fps}
+ onChange={(e) =>
+ setLocal({
+ ...local,
+ screencast: { ...local.screencast, fps: +e.target.value },
+ })
+ }
+ className="w-32"
+ />
+ <span className="w-12 text-right text-sm text-text-muted">
+ {local.screencast.fps} fps
+ </span>
+ </div>
+ </div>
+ <div className="flex items-center justify-between">
+ <label className="text-sm text-text-secondary">Quality</label>
+ <div className="flex items-center gap-2">
+ <input
+ type="range"
+ min={10}
+ max={80}
+ value={local.screencast.quality}
+ onChange={(e) =>
+ setLocal({
+ ...local,
+ screencast: {
+ ...local.screencast,
+ quality: +e.target.value,
+ },
+ })
+ }
+ className="w-32"
+ />
+ <span className="w-12 text-right text-sm text-text-muted">
+ {local.screencast.quality}%
+ </span>
+ </div>
+ </div>
+ <div className="flex items-center justify-between">
+ <label className="text-sm text-text-secondary">Max Width</label>
+ <select
+ value={local.screencast.maxWidth}
onChange={(e) =>
setLocal({
...local,
screencast: {
...local.screencast,
- quality: +e.target.value,
+ maxWidth: +e.target.value,
},
})
}
- className="w-32"
- />
- <span className="w-12 text-right text-sm text-text-muted">
- {local.screencast.quality}%
- </span>
+ className="rounded border border-border-default bg-bg-elevated px-2 py-1 text-sm text-text-primary"
+ >
+ {[400, 600, 800, 1024, 1280].map((w) => (
+ <option key={w} value={w}>
+ {w}px
+ </option>
+ ))}
+ </select>
</div>
</div>
+ </Card>
+
+ {/* Stealth */}
+ <Card className="p-4">
+ <h3 className="mb-4 text-sm font-semibold text-text-primary">
+ πŸ›‘οΈ Stealth
+ </h3>
<div className="flex items-center justify-between">
- <label className="text-sm text-text-secondary">Max Width</label>
+ <label className="text-sm text-text-secondary">Level</label>
<select
- value={local.screencast.maxWidth}
+ value={local.stealth}
onChange={(e) =>
setLocal({
...local,
- screencast: {
- ...local.screencast,
- maxWidth: +e.target.value,
- },
+ stealth: e.target.value as "light" | "full",
})
}
className="rounded border border-border-default bg-bg-elevated px-2 py-1 text-sm text-text-primary"
>
- {[400, 600, 800, 1024, 1280].map((w) => (
- <option key={w} value={w}>
- {w}px
- </option>
- ))}
+ <option value="light">Light (default)</option>
+ <option value="full">Full (canvas noise, WebGL, fonts)</option>
</select>
</div>
- </div>
- </Card>
-
- {/* Stealth */}
- <Card className="p-4">
- <h3 className="mb-4 text-sm font-semibold text-text-primary">
- πŸ›‘οΈ Stealth
- </h3>
- <div className="flex items-center justify-between">
- <label className="text-sm text-text-secondary">Level</label>
- <select
- value={local.stealth}
- onChange={(e) =>
- setLocal({
- ...local,
- stealth: e.target.value as "light" | "full",
- })
- }
- className="rounded border border-border-default bg-bg-elevated px-2 py-1 text-sm text-text-primary"
- >
- <option value="light">Light (default)</option>
- <option value="full">Full (canvas noise, WebGL, fonts)</option>
- </select>
- </div>
- </Card>
+ </Card>
- {/* Browser */}
- <Card className="p-4">
- <h3 className="mb-4 text-sm font-semibold text-text-primary">
- 🌐 Browser
- </h3>
- <div className="space-y-3">
- {[
- { key: "blockImages", label: "Block Images" },
- { key: "blockMedia", label: "Block Media" },
- { key: "noAnimations", label: "No Animations" },
- ].map(({ key, label }) => (
- <label key={key} className="flex items-center justify-between">
- <span className="text-sm text-text-secondary">{label}</span>
- <input
- type="checkbox"
- checked={local.browser[key as keyof typeof local.browser]}
- onChange={(e) =>
- setLocal({
- ...local,
- browser: { ...local.browser, [key]: e.target.checked },
- })
- }
- className="h-4 w-4"
- />
- </label>
- ))}
- </div>
- </Card>
+ {/* Browser */}
+ <Card className="p-4">
+ <h3 className="mb-4 text-sm font-semibold text-text-primary">
+ 🌐 Browser
+ </h3>
+ <div className="space-y-3">
+ {[
+ { key: "blockImages", label: "Block Images" },
+ { key: "blockMedia", label: "Block Media" },
+ { key: "noAnimations", label: "No Animations" },
+ ].map(({ key, label }) => (
+ <label key={key} className="flex items-center justify-between">
+ <span className="text-sm text-text-secondary">{label}</span>
+ <input
+ type="checkbox"
+ checked={local.browser[key as keyof typeof local.browser]}
+ onChange={(e) =>
+ setLocal({
+ ...local,
+ browser: { ...local.browser, [key]: e.target.checked },
+ })
+ }
+ className="h-4 w-4"
+ />
+ </label>
+ ))}
+ </div>
+ </Card>
- {/* Monitoring */}
- <Card className="p-4">
- <h3 className="mb-4 text-sm font-semibold text-text-primary">
- πŸ“ˆ Monitoring
- </h3>
- <div className="space-y-3">
- <label className="flex items-center justify-between">
- <div>
- <span className="text-sm text-text-secondary">
- Tab Memory Metrics{" "}
- <span className="rounded bg-yellow-500/20 px-1 py-0.5 text-xs text-yellow-500">
- experimental
+ {/* Monitoring */}
+ <Card className="p-4">
+ <h3 className="mb-4 text-sm font-semibold text-text-primary">
+ πŸ“ˆ Monitoring
+ </h3>
+ <div className="space-y-3">
+ <label className="flex items-center justify-between">
+ <div>
+ <span className="text-sm text-text-secondary">
+ Tab Memory Metrics{" "}
+ <span className="rounded bg-yellow-500/20 px-1 py-0.5 text-xs text-yellow-500">
+ experimental
+ </span>
</span>
- </span>
- <p className="text-xs text-text-muted">
- Track JS heap usage per tab via CDP (may cause instability)
- </p>
- </div>
- <input
- type="checkbox"
- checked={local.monitoring?.memoryMetrics ?? false}
- onChange={(e) =>
- setLocal({
- ...local,
- monitoring: {
- ...local.monitoring,
- memoryMetrics: e.target.checked,
- },
- })
- }
- className="h-4 w-4"
- />
- </label>
- <div className="flex items-center justify-between">
- <div>
- <span className="text-sm text-text-secondary">
- Poll Interval
- </span>
- <p className="text-xs text-text-muted">
- How often to fetch tab/memory data
- </p>
- </div>
- <div className="flex items-center gap-2">
+ <p className="text-xs text-text-muted">
+ Track JS heap usage per tab via CDP (may cause instability)
+ </p>
+ </div>
<input
- type="range"
- min={5}
- max={120}
- step={5}
- value={local.monitoring?.pollInterval ?? 30}
+ type="checkbox"
+ checked={local.monitoring?.memoryMetrics ?? false}
onChange={(e) =>
setLocal({
...local,
monitoring: {
...local.monitoring,
- pollInterval: +e.target.value,
+ memoryMetrics: e.target.checked,
},
})
}
- className="w-24"
+ className="h-4 w-4"
/>
- <span className="w-12 text-right text-sm text-text-muted">
- {local.monitoring?.pollInterval ?? 30}s
- </span>
+ </label>
+ <div className="flex items-center justify-between">
+ <div>
+ <span className="text-sm text-text-secondary">
+ Poll Interval
+ </span>
+ <p className="text-xs text-text-muted">
+ How often to fetch tab/memory data
+ </p>
+ </div>
+ <div className="flex items-center gap-2">
+ <input
+ type="range"
+ min={5}
+ max={120}
+ step={5}
+ value={local.monitoring?.pollInterval ?? 30}
+ onChange={(e) =>
+ setLocal({
+ ...local,
+ monitoring: {
+ ...local.monitoring,
+ pollInterval: +e.target.value,
+ },
+ })
+ }
+ className="w-24"
+ />
+ <span className="w-12 text-right text-sm text-text-muted">
+ {local.monitoring?.pollInterval ?? 30}s
+ </span>
+ </div>
</div>
</div>
- </div>
- </Card>
-
- {/* Server Info */}
- {serverInfo && (
- <Card className="p-4">
- <h3 className="mb-4 text-sm font-semibold text-text-primary">
- πŸ“Š Server Info
- </h3>
- <div className="grid grid-cols-2 gap-2 text-sm">
- <div className="text-text-muted">Version</div>
- <div className="text-text-secondary">{serverInfo.version}</div>
- <div className="text-text-muted">Profiles</div>
- <div className="text-text-secondary">{serverInfo.profiles}</div>
- <div className="text-text-muted">Instances</div>
- <div className="text-text-secondary">{serverInfo.instances}</div>
- <div className="text-text-muted">Agents</div>
- <div className="text-text-secondary">{serverInfo.agents}</div>
- </div>
</Card>
- )}
+ </div>
</div>
</div>
);
diff --git a/dashboard/vite.config.ts b/dashboard/vite.config.ts
index 7bcc4e0d..3f0c6af1 100644
--- a/dashboard/vite.config.ts
+++ b/dashboard/vite.config.ts
@@ -16,6 +16,14 @@ export default defineConfig({
},
build: {
outDir: 'dist',
+ rollupOptions: {
+ output: {
+ manualChunks: {
+ 'vendor-ui': ['recharts'],
+ 'vendor-react': ['react', 'react-dom', 'react-router-dom', 'zustand'],
+ },
+ },
+ },
},
test: {
globals: true,
diff --git a/internal/dashboard/dashboard.go b/internal/dashboard/dashboard.go
index f3be9cfc..2deaa6c3 100644
--- a/internal/dashboard/dashboard.go
+++ b/internal/dashboard/dashboard.go
@@ -14,13 +14,6 @@ import (
"github.com/pinchtab/pinchtab/internal/bridge"
)
-func envWithFallback(newKey, oldKey string) string {
- if v := os.Getenv(newKey); v != "" {
- return v
- }
- return os.Getenv(oldKey)
-}
-
type DashboardConfig struct {
IdleTimeout time.Duration
DisconnectTimeout time.Duration
@@ -115,7 +108,7 @@ func NewDashboard(cfg *DashboardConfig) *Dashboard {
sseConns: make(map[chan AgentEvent]struct{}),
sysConns: make(map[chan SystemEvent]struct{}),
cancel: cancel,
- childAuthToken: envWithFallback("PINCHTAB_TOKEN", "BRIDGE_TOKEN"),
+ childAuthToken: os.Getenv("BRIDGE_TOKEN"),
}
return d
}
@@ -132,7 +125,7 @@ func (d *Dashboard) RegisterHandlers(mux *http.ServeMux) {
// Serve static assets under /dashboard/ with long cache (hashed filenames)
mux.Handle("GET /dashboard/assets/", http.StripPrefix("/dashboard", d.withLongCache(fileServer)))
- mux.Handle("GET /dashboard/pinchtab-headed-192.png", http.StripPrefix("/dashboard", d.withLongCache(fileServer)))
+ mux.Handle("GET /dashboard/favicon.png", http.StripPrefix("/dashboard", d.withLongCache(fileServer)))
// SPA: serve dashboard.html for /dashboard
mux.Handle("GET /dashboard", d.withNoCache(http.HandlerFunc(d.handleDashboardUI)))
diff --git a/internal/dashboard/dashboard/favicon.png b/internal/dashboard/dashboard/favicon.png
new file mode 100644
index 00000000..0dac8ca3
Binary files /dev/null and b/internal/dashboard/dashboard/favicon.png differ
diff --git a/internal/dashboard/dashboard/pinchtab-headed-192.png b/internal/dashboard/dashboard/pinchtab-headed-192.png
deleted file mode 100644
index df0c4290..00000000
Binary files a/internal/dashboard/dashboard/pinchtab-headed-192.png and /dev/null differ
diff --git a/scripts/build-dashboard.sh b/scripts/build-dashboard.sh
index 3eb94b63..e9ad3405 100755
--- a/scripts/build-dashboard.sh
+++ b/scripts/build-dashboard.sh
@@ -4,6 +4,22 @@ set -e
cd "$(dirname "$0")/.."
+# Generate TypeScript types from Go structs (ensures types are in sync)
+TYGO="${GOPATH:-$HOME/go}/bin/tygo"
+if [ -x "$TYGO" ]; then
+ echo "πŸ”„ Generating TypeScript types..."
+ "$TYGO" generate
+elif command -v tygo &> /dev/null; then
+ echo "πŸ”„ Generating TypeScript types..."
+ tygo generate
+else
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
+ echo "⚠️ WARNING: tygo not found β€” skipping TypeScript type generation"
+ echo " Types in the dashboard might fall out of sync with Go structs."
+ echo " Install it with: go install github.com/gzuidhof/tygo@latest"
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
+fi
+
echo "πŸ“¦ Building React dashboard..."
cd dashboard
@@ -18,18 +34,12 @@ bun run build
echo "πŸ“‹ Copying build to internal/dashboard/dashboard/..."
cd ..
-# Backup assets we want to keep
-cp internal/dashboard/dashboard/pinchtab-headed-192.png /tmp/pinchtab-headed-192.png 2>/dev/null || true
-
# Clear old dashboard (keep directory)
rm -rf internal/dashboard/dashboard/*
# Copy React build
cp -r dashboard/dist/* internal/dashboard/dashboard/
-# Restore assets
-cp /tmp/pinchtab-headed-192.png internal/dashboard/dashboard/ 2>/dev/null || true
-
# Rename index.html to dashboard.html (Go expects this)
mv internal/dashboard/dashboard/index.html internal/dashboard/dashboard/dashboard.html