feat: stream real-time progress for agent SDK install/upgrade/uninstall

Replace the spinner-only UX with live log output during agent SDK
operations, matching the existing OpenCode plugin install experience.

Backend: emit structured events (started/log/completed/failed) via
EventEmitter during npm install and binary download. npm commands now
run with piped stdio for line-by-line streaming; binary downloads
report chunked progress every 1 MB.

Frontend: subscribe to `app://agent-install` events through a new
`useAgentInstallStream` hook and render a theme-aware log terminal
below the preflight checks panel.

Also fixes the install log container in both agent settings and the
OpenCode plugins modal: auto-scroll no longer shifts the outer page,
and colours now follow the active light/dark theme.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
xintaofei
2026-04-12 21:43:54 +08:00
parent 6c69f432b9
commit a763adaf36
10 changed files with 541 additions and 118 deletions

View File

@@ -50,6 +50,9 @@ pub enum EventEmitter {
#[cfg(feature = "tauri-runtime")]
Tauri(tauri::AppHandle),
WebOnly(Arc<WebEventBroadcaster>),
/// Silent no-op emitter — drops all events. Used when streaming progress
/// is not needed (e.g. legacy non-streaming call paths).
Noop,
}
/// Unified event emission: sends to both Tauri webview and Web clients (if applicable).
@@ -70,5 +73,6 @@ pub fn emit_event(
EventEmitter::WebOnly(broadcaster) => {
broadcaster.send(event, &payload);
}
EventEmitter::Noop => {}
}
}