Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

fix(ui): serialize terminal input + demo chrome for the Terminal tab

Juan Denis5ceb2d83b78d
diff --git a/docs/REDESIGN_MAP.md b/docs/REDESIGN_MAP.md
index c9dd74f9..a407a84e 100644
--- a/docs/REDESIGN_MAP.md
+++ b/docs/REDESIGN_MAP.md
@@ -285,6 +285,14 @@ the whole output path — `RemoteTerminal` referenced a **nonexistent `SocketCon
reconnect re-subscribe. 'logs' stays the default landing (shell needs a connected agent; panel-host PTY =
§5 gap, local is rejected by TerminalService). Still §5: the unified all-targets rail (WP/DBs/containers
groups) + live non-file log streaming.
+**Verified live end-to-end 2026-06-12** (WSL agent → panel → browser xterm: `echo` round-trip clean). Fixes
+shipped while testing: **keystroke serialization** in RemoteTerminal (each key was its own HTTP POST — parallel
+POSTs reordered fast typing into scrambled input; now queued + flushed sequentially); page header → `PageTopbar`;
+rail rows got server icons + right-aligned glowing dots; shell pane flush against the rail (demo con-main).
+Agent repo fixes found en route: **Linux build was broken** (`agentui/pairer.go` called Windows-only
+`isServiceInstalled`/`waitForServiceStopped` — stubs added to `platform_other.go`) and **`register` panicked**
+(`-c` shorthand collision with global `--config`). NOTE: agent PTY is Unix-only — Windows agents return
+"pty: unsupported" (ConPTY = future agent work).
### 8.4 WordPress — ✅ **JSX-only parts done 2026-06-11**
- List: **bulk-select shipped** — header + per-row checkboxes, accent `is-selected` rows, bulkbar with
diff --git a/frontend/src/components/RemoteTerminal.jsx b/frontend/src/components/RemoteTerminal.jsx
index e344bb2c..9bee2490 100644
--- a/frontend/src/components/RemoteTerminal.jsx
+++ b/frontend/src/components/RemoteTerminal.jsx
@@ -125,21 +125,41 @@ export default function RemoteTerminal({ serverId, onClose }) {
createSession();
}, [serverId]);
- // Handle terminal input
+ // Handle terminal input. Keystrokes MUST be serialized: each send is its
+ // own HTTP POST, and parallel POSTs can reach the agent out of order,
+ // scrambling fast typing. Queue input and flush sequentially, coalescing
+ // whatever arrived while the previous chunk was in flight.
+ const inputQueue = useRef('');
+ const inputSending = useRef(false);
+
useEffect(() => {
if (!terminalInstance.current || !sessionId || !connected) return;
const term = terminalInstance.current;
+ inputQueue.current = '';
- // Handle user input
- const inputDisposable = term.onData(async (data) => {
+ const flushInput = async () => {
+ if (inputSending.current) return;
+ inputSending.current = true;
try {
- // Encode data as base64
- const encoded = btoa(data);
- await api.sendTerminalInput(sessionId, encoded);
+ while (inputQueue.current) {
+ const chunk = inputQueue.current;
+ inputQueue.current = '';
+ await api.sendTerminalInput(sessionId, btoa(chunk));
+ }
} catch (err) {
console.error('Failed to send terminal input:', err);
+ inputQueue.current = '';
+ } finally {
+ inputSending.current = false;
}
+ // drain anything that raced the flag reset
+ if (inputQueue.current) flushInput();
+ };
+
+ const inputDisposable = term.onData((data) => {
+ inputQueue.current += data;
+ flushInput();
});
// Handle resize
diff --git a/frontend/src/pages/Terminal.jsx b/frontend/src/pages/Terminal.jsx
index 94fb3cb1..4f63f991 100644
--- a/frontend/src/pages/Terminal.jsx
+++ b/frontend/src/pages/Terminal.jsx
@@ -10,13 +10,13 @@ import LogFileList from '../components/log-viewer/LogFileList';
import LogToolbar from '../components/log-viewer/LogToolbar';
import LogContent from '../components/log-viewer/LogContent';
import { formatBytes, logKindFromPath } from '../components/log-viewer/logHelpers';
-import { Pill } from '../components/ds';
+import { Pill, PageTopbar } from '../components/ds';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
import {
FileText, Clock, AlertCircle, Search, X, RefreshCw, AlertTriangle, Activity,
- Play, Square, RotateCw, Terminal as TerminalIcon,
+ Play, Square, RotateCw, Terminal as TerminalIcon, Server as ServerIcon,
} from 'lucide-react';
// 'logs' stays first so the default landing keeps working on installs with no
@@ -28,12 +28,11 @@ const Terminal = () => {
return (
<div className="page-container terminal-page">
- <div className="page-header">
- <div>
- <h1>Terminal & Logs</h1>
- <p className="page-subtitle">View logs, manage processes and services</p>
- </div>
- </div>
+ <PageTopbar
+ icon={<TerminalIcon size={18} />}
+ title="Terminal / Logs"
+ meta="shells · logs · processes · services"
+ />
<Tabs value={activeTab} onValueChange={setActiveTab}>
<TabsList>
@@ -144,9 +143,10 @@ const TerminalShellTab = () => {
disabled={!online}
title={online ? `Open a shell on ${s.name}` : `${s.name || s.id} is ${s.status || 'offline'}`}
>
- <span className={`term-shell__dot ${online ? 'is-on' : ''}`} />
+ <ServerIcon size={14} className="term-shell__ico" />
<span className="term-shell__name">{s.name || s.hostname || s.id}</span>
{s.ip_address && <span className="term-shell__sub">{s.ip_address}</span>}
+ <span className={`term-shell__dot ${online ? 'is-on' : ''}`} />
</button>
);
})}
diff --git a/frontend/src/styles/pages/_terminal.scss b/frontend/src/styles/pages/_terminal.scss
index 534e183d..e613d946 100644
--- a/frontend/src/styles/pages/_terminal.scss
+++ b/frontend/src/styles/pages/_terminal.scss
@@ -103,6 +103,11 @@ $lk-default: #646b7a;
&:disabled { opacity: 0.5; cursor: not-allowed; }
}
+ &__ico {
+ flex-shrink: 0;
+ color: var(--text-faint);
+ }
+
&__dot {
width: 7px;
height: 7px;
@@ -131,12 +136,14 @@ $lk-default: #646b7a;
min-width: 0;
min-height: 0;
display: flex;
- padding: $space-3;
- // RemoteTerminal brings drawer chrome — flatten it inside the frame
+ // RemoteTerminal brings drawer chrome — flatten it so the shell pane
+ // joins the rail flush (demo con-main: panes meet on 1px borders)
.remote-terminal-container {
flex: 1;
min-width: 0;
+ border: none;
+ border-radius: 0;
box-shadow: none;
}
}