feat(vscode): update layout thresholds and improve server readiness timeout

This commit is contained in:
Bohdan Triapitsyn
2026-01-16 18:44:11 +02:00
parent 53f8e1324e
commit 458bc0239d
2 changed files with 9 additions and 12 deletions
@@ -12,7 +12,7 @@ import { RiAddLine, RiArrowLeftLine, RiRobot2Line, RiSettings3Line } from '@remi
// Width threshold for mobile vs desktop layout in settings
const MOBILE_WIDTH_THRESHOLD = 550;
// Width threshold for expanded layout (sidebar + chat side by side)
const EXPANDED_LAYOUT_THRESHOLD = 700;
const EXPANDED_LAYOUT_THRESHOLD = 1400;
// Sessions sidebar width in expanded layout
const SESSIONS_SIDEBAR_WIDTH = 280;
@@ -299,7 +299,7 @@ export const VSCodeLayout: React.FC = () => {
// Expanded layout: sessions sidebar + chat side by side
<div className="flex h-full">
{/* Sessions sidebar */}
<div
<div
className="h-full border-r border-border overflow-hidden flex-shrink-0"
style={{ width: SESSIONS_SIDEBAR_WIDTH }}
>
+7 -10
View File
@@ -72,12 +72,12 @@ function getCandidateBaseUrls(serverUrl: string): string[] {
if (!candidates.includes(v)) candidates.push(v);
};
// Prefer SDK-provided url first.
add(normalized);
// Newer OpenCode servers may mount HTTP API under /api.
add(`${origin}/api`);
// Fallback to plain origin (in case SDK url includes path not accepted).
const normalizedPath = parsed.pathname.replace(/\/+$/, '');
// Prefer plain origin. Only keep SDK url when already root.
add(origin);
if (normalizedPath === '' || normalizedPath === '/') {
add(normalized);
}
return candidates;
} catch {
@@ -85,7 +85,7 @@ function getCandidateBaseUrls(serverUrl: string): string[] {
}
}
async function waitForReady(serverUrl: string, timeoutMs = 5000, workingDirectory = ''): Promise<ReadyResult> {
async function waitForReady(serverUrl: string, timeoutMs = 15000, workingDirectory = ''): Promise<ReadyResult> {
const start = Date.now();
const candidates = getCandidateBaseUrls(serverUrl);
let attempts = 0;
@@ -95,13 +95,10 @@ async function waitForReady(serverUrl: string, timeoutMs = 5000, workingDirector
attempts += 1;
try {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 1500);
const timeout = setTimeout(() => controller.abort(), 3000);
// Keep using /config since the UI proxies to it (via /api -> strip prefix).
const url = new URL(`${baseUrl}/config`);
if (workingDirectory) {
url.searchParams.set('directory', workingDirectory);
}
const res = await fetch(url.toString(), {
method: 'GET',
headers: { Accept: 'application/json' },