feat: streamline opencode loading screens and reuse the reload flow for vscode Restart API
Loading screens: drop the internal-jargon progress text on the opencode reload overlay (ConfigUpdateOverlay) and the vscode init splash — show text only on errors. Replace it with a glow pulse on the OpenCode mark on the cube's top face; OpenChamberLogo's isAnimated prop was a no-op and now actually animates. vscode shows the glow on the inline splash logo and the React app stops writing 'Loading data (… Providers, … Agents)…'. Restart API: 'OpenChamber: Restart API Connection' now runs the same full reload flow used after an OpenCode update — the command asks the chat webview to call reloadOpenCodeConfiguration() (overlay + managed restart via the bridge + config/data refresh) instead of a bare manager restart, falling back to the old restart when no webview is open. Mounts ConfigUpdateOverlay in the vscode app so the overlay actually shows there.
This commit is contained in:
@@ -306,6 +306,23 @@ export class ChatViewProvider implements vscode.WebviewViewProvider {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask the webview to run the full OpenCode reload flow (overlay + managed
|
||||
* restart via the bridge + config/data refresh) — the same flow used after an
|
||||
* OpenCode update. Returns false if no webview is resolved to drive it.
|
||||
*/
|
||||
public reloadOpenCode(): boolean {
|
||||
if (!this._view) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this._view.webview.postMessage({
|
||||
type: 'command',
|
||||
command: 'reloadOpenCode',
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
public notifyWindowFocusChanged(focused: boolean): void {
|
||||
if (!this._view) {
|
||||
return;
|
||||
|
||||
@@ -262,6 +262,13 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
context.subscriptions.push(
|
||||
vscode.commands.registerCommand('openchamber.restartApi', async () => {
|
||||
try {
|
||||
// Prefer the full in-app reload flow (overlay + managed restart via the
|
||||
// bridge + config/data refresh) driven by the webview — same as after an
|
||||
// OpenCode update. Fall back to a bare manager restart when no webview is
|
||||
// open to drive it.
|
||||
if (chatViewProvider?.reloadOpenCode()) {
|
||||
return;
|
||||
}
|
||||
await openCodeManager?.restart();
|
||||
vscode.window.showInformationMessage('OpenChamber: API connection restarted');
|
||||
} catch (e) {
|
||||
|
||||
@@ -107,6 +107,17 @@ export function getWebviewHtml(options: WebviewHtmlOptions): string {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
/* Glow pulse on the OpenCode mark on the cube's top face — signals loading without text. */
|
||||
@keyframes oc-logo-glow {
|
||||
0%, 100% { filter: drop-shadow(0 0 0 transparent); }
|
||||
50% { filter: drop-shadow(0 0 4px var(--vscode-foreground)); }
|
||||
}
|
||||
#initial-loading .logo-inner {
|
||||
animation: oc-logo-glow 1.8s ease-in-out infinite;
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
#initial-loading .logo-inner { animation: none; }
|
||||
}
|
||||
/* Logo colors use VS Code foreground color */
|
||||
#initial-loading .logo-stroke {
|
||||
stroke: var(--vscode-foreground);
|
||||
@@ -153,9 +164,8 @@ export function getWebviewHtml(options: WebviewHtmlOptions): string {
|
||||
<path class="logo-fill-dim" d="M-8 -4 L8 -4 L8 12 L-8 12 Z"/>
|
||||
</g>
|
||||
</svg>
|
||||
<div class="status-text" id="loading-status">
|
||||
${initialStatus === 'connecting' ? 'Starting OpenCode API…' : initialStatus === 'connected' ? 'Initializing…' : 'Connecting…'}
|
||||
</div>
|
||||
<!-- Status text stays empty while things are fine; populated only on error. -->
|
||||
<div class="status-text" id="loading-status"></div>
|
||||
${!cliAvailable ? `<div class="error-text">OpenCode CLI not found. Please install it first.</div>` : ''}
|
||||
</div>
|
||||
|
||||
@@ -184,17 +194,13 @@ export function getWebviewHtml(options: WebviewHtmlOptions): string {
|
||||
if (msg && msg.type === 'connectionStatus') {
|
||||
var statusEl = document.getElementById('loading-status');
|
||||
if (statusEl) {
|
||||
if (msg.status === 'connecting') {
|
||||
statusEl.textContent = 'Starting OpenCode API…';
|
||||
statusEl.classList.remove('error-text');
|
||||
} else if (msg.status === 'connected') {
|
||||
statusEl.textContent = 'Connected!';
|
||||
statusEl.classList.remove('error-text');
|
||||
} else if (msg.status === 'error') {
|
||||
// Only show text when something is wrong — progress states stay silent
|
||||
// (the animated logo already signals "working").
|
||||
if (msg.status === 'error') {
|
||||
statusEl.textContent = msg.error || 'Connection error';
|
||||
statusEl.classList.add('error-text');
|
||||
} else {
|
||||
statusEl.textContent = 'Reconnecting…';
|
||||
statusEl.textContent = '';
|
||||
statusEl.classList.remove('error-text');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user