Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

feat(switchdash): show what an install is doing while it runs (CHOO-1809)

switch-worker-louis-remote6c21104c79fe
diff --git a/dash/apps/switchdash-desktop/src/main/core/dependencies/install-output.ts b/dash/apps/switchdash-desktop/src/main/core/dependencies/install-output.ts
new file mode 100644
index 000000000..8526e4505
--- /dev/null
+++ b/dash/apps/switchdash-desktop/src/main/core/dependencies/install-output.ts
@@ -0,0 +1,15 @@
+import { Emitter } from '@switchdash/shared';
+
+/** A chunk of output from an install command, as the host produces it. */
+export type InstallOutputChunk = { sshHost: string; chunk: string };
+
+/**
+ * Live output from remote install commands, keyed by host.
+ *
+ * The install runner is built once per host and cached with its dependency
+ * manager, so a caller cannot hand it a callback for one particular install.
+ * This is how output reaches whoever is watching at the time — today the host
+ * setup service, which knows which step is running and turns it into the line
+ * shown beside it.
+ */
+export const installOutput = new Emitter<InstallOutputChunk>();
diff --git a/dash/apps/switchdash-desktop/src/main/core/dependencies/remote-dependency-manager.ts b/dash/apps/switchdash-desktop/src/main/core/dependencies/remote-dependency-manager.ts
index 68391cc68..76a19d78d 100644
--- a/dash/apps/switchdash-desktop/src/main/core/dependencies/remote-dependency-manager.ts
+++ b/dash/apps/switchdash-desktop/src/main/core/dependencies/remote-dependency-manager.ts
@@ -6,6 +6,7 @@ import { ensureSshConnected } from '@main/core/ssh/connect/connect-agent-ssh';
import { log } from '@main/lib/logger';
import { agentUpdateService } from './agent-update-service';
import { CORE_DEPENDENCIES } from './core-dependencies';
+import { installOutput } from './install-output';
import { DEPENDENCIES } from './registry';
import { createSshInstallCommandRunner } from './ssh-install-runner';
@@ -43,7 +44,9 @@ async function buildRemoteDependencyManager(sshHost: string): Promise<HostDepend
const platform = await detectRemotePlatform(ctx);
const manager = new HostDependencyManager(ctx, {
- runInstallCommand: createSshInstallCommandRunner(proxy),
+ runInstallCommand: createSshInstallCommandRunner(proxy, (chunk) =>
+ installOutput.emit({ sshHost, chunk })
+ ),
// Remote hosts use auto-detection only; per-host install overrides are a
// local-only feature today, so no selection is persisted for remote hosts.
getSelection: () => Promise.resolve(null),
diff --git a/dash/apps/switchdash-desktop/src/main/core/dependencies/ssh-install-runner.ts b/dash/apps/switchdash-desktop/src/main/core/dependencies/ssh-install-runner.ts
index 5e5ef0c2c..fc8a0d689 100644
--- a/dash/apps/switchdash-desktop/src/main/core/dependencies/ssh-install-runner.ts
+++ b/dash/apps/switchdash-desktop/src/main/core/dependencies/ssh-install-runner.ts
@@ -13,8 +13,15 @@ import { classifyInstallCommandFailure, type InstallCommandRunner } from './inst
* through the remote shell in a PTY (many installers want a TTY), with the exit
* code classified into an InstallCommandError rather than thrown. Uses the same
* remote shell wrapping as agent session execution so PATH/env match.
+ *
+ * Output is both accumulated (for the failure transcript) and handed to
+ * `onOutput` as it arrives, so a caller can show what the host is doing during
+ * an install that takes minutes rather than only once it is over.
*/
-export function createSshInstallCommandRunner(proxy: SshClientProxy): InstallCommandRunner {
+export function createSshInstallCommandRunner(
+ proxy: SshClientProxy,
+ onOutput: (chunk: string) => void
+): InstallCommandRunner {
return async (command) => {
const profile = await proxy.getRemoteShellProfile();
const remoteCommand = buildRemoteShellCommand(profile, command);
@@ -37,7 +44,10 @@ export function createSshInstallCommandRunner(proxy: SshClientProxy): InstallCom
const pty = opened.data;
return new Promise<Result<void, InstallCommandError>>((resolve) => {
const chunks: string[] = [];
- pty.onData((chunk) => chunks.push(chunk));
+ pty.onData((chunk) => {
+ chunks.push(chunk);
+ onOutput(chunk);
+ });
pty.onExit(({ exitCode }) => {
if (exitCode === 0) {
log.info('[SshDependencyManager] Remote install succeeded');
diff --git a/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/host-setup-service.ts b/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/host-setup-service.ts
index 32e0c86e7..f7bc36f02 100644
--- a/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/host-setup-service.ts
+++ b/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/host-setup-service.ts
@@ -9,6 +9,7 @@
import type { HostDependencyManager } from '@switchdash/core/deps/runtime';
import { CORE_DEPENDENCIES } from '@main/core/dependencies/core-dependencies';
+import { installOutput } from '@main/core/dependencies/install-output';
import {
getRemoteDependencyManager,
remoteDependencyDescriptor,
@@ -17,6 +18,7 @@ import { getRemoteSwitchSetupService } from '@main/core/switch-setup/remote-swit
import { events } from '@main/lib/events';
import { log } from '@main/lib/logger';
import {
+ hostSetupActivityEventChannel,
hostSetupPlanEventChannel,
type HostSetupPlan,
type HostSetupStep,
@@ -24,6 +26,7 @@ import {
import { probeGhAuthStatus } from '../gh-auth';
import { hostReachabilityService } from '../production-host-reachability';
import { HostSetupRunner, type StepCheckResult, type StepInstallResult } from './host-setup-runner';
+import { InstallProgressReader } from './install-progress';
import {
agentPluginStepId,
buildSetupPlan,
@@ -147,6 +150,37 @@ async function checkStep(
return outcomeForDependency(state, Boolean(remoteDependencyDescriptor(step.id)?.minVersion));
}
+/**
+ * Sampling interval for the progress line. Fast enough to read as live, slow
+ * enough that a repainting progress bar does not turn into an IPC flood.
+ */
+const PROGRESS_INTERVAL_MS = 250;
+
+/**
+ * Publish what a step's command is doing, for as long as it is running.
+ *
+ * Returns the stop function, which also clears the line: once the command is
+ * over, what happened belongs to the step itself (satisfied, or failed with its
+ * error and transcript) and a stale half-finished line beside it would only
+ * contradict that.
+ */
+function streamInstallProgress(sshHost: string, stepId: string): () => void {
+ const reader = new InstallProgressReader();
+ const unsubscribe = installOutput.subscribe((event) => {
+ if (event.sshHost === sshHost) reader.push(event.chunk);
+ });
+ const timer = setInterval(() => {
+ const line = reader.take();
+ if (line) events.emit(hostSetupActivityEventChannel, { sshHost, stepId, line });
+ }, PROGRESS_INTERVAL_MS);
+
+ return () => {
+ unsubscribe();
+ clearInterval(timer);
+ events.emit(hostSetupActivityEventChannel, { sshHost, stepId, line: null });
+ };
+}
+
async function installStep(
sshHost: string,
manager: HostDependencyManager,
@@ -160,7 +194,13 @@ async function installStep(
: { ok: false, error: result.message ?? `Could not install the Switch connector.` };
}
- const result = await manager.install(step.id);
+ const stopProgress = streamInstallProgress(sshHost, step.id);
+ let result: Awaited<ReturnType<typeof manager.install>>;
+ try {
+ result = await manager.install(step.id);
+ } finally {
+ stopProgress();
+ }
if (result.success) return { ok: true };
// Surface the installer's own words. The old page discarded these and
diff --git a/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/install-progress.test.ts b/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/install-progress.test.ts
new file mode 100644
index 000000000..847553da3
--- /dev/null
+++ b/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/install-progress.test.ts
@@ -0,0 +1,70 @@
+import { describe, expect, it } from 'vitest';
+import { InstallProgressReader } from './install-progress';
+
+const ESC = '\u001b';
+
+describe('InstallProgressReader', () => {
+ it('reports the line a terminal would be showing', () => {
+ const reader = new InstallProgressReader();
+ reader.push('Reading package lists...\nBuilding dependency tree...\n');
+
+ expect(reader.take()).toBe('Building dependency tree...');
+ });
+
+ it('follows a carriage-return repaint rather than concatenating its frames', () => {
+ // apt draws its progress by rewriting one line hundreds of times. Joining
+ // those frames would produce an unreadable smear of every percentage.
+ const reader = new InstallProgressReader();
+ reader.push('0% [Waiting for headers]\r25% [Connecting]\r90% [Unpacking git]');
+
+ expect(reader.take()).toBe('90% [Unpacking git]');
+ });
+
+ it('assembles a line that arrives split across chunks', () => {
+ const reader = new InstallProgressReader();
+ reader.push('Get:3 http://archive.ubuntu.com ');
+ reader.push('noble/main amd64 git amd64 2.43.0');
+
+ expect(reader.take()).toBe('Get:3 http://archive.ubuntu.com noble/main amd64 git amd64 2.43.0');
+ });
+
+ it('strips the escape sequences a PTY carries', () => {
+ const reader = new InstallProgressReader();
+ reader.push(`${ESC}[1;32mSetting up git${ESC}[0m${ESC}]0;installing${ESC}\\`);
+
+ expect(reader.take()).toBe('Setting up git');
+ });
+
+ it('says nothing when nothing has changed, so a caller can poll freely', () => {
+ const reader = new InstallProgressReader();
+ reader.push('Unpacking git\n');
+
+ expect(reader.take()).toBe('Unpacking git');
+ expect(reader.take()).toBeNull();
+ });
+
+ describe('keeping the last real message on screen', () => {
+ it('does not blank the line for the trailing newline of a message', () => {
+ // Every completed line leaves the cursor on an empty one. Reporting that
+ // emptiness would flicker the display off between messages.
+ const reader = new InstallProgressReader();
+ reader.push('Setting up git (1:2.43.0-1ubuntu7.3) ...\n');
+
+ expect(reader.take()).toBe('Setting up git (1:2.43.0-1ubuntu7.3) ...');
+
+ reader.push('\n\n');
+ expect(reader.take()).toBeNull();
+ });
+
+ it('reports nothing at all before any output arrives', () => {
+ expect(new InstallProgressReader().take()).toBeNull();
+ });
+ });
+
+ it('truncates a line that would reflow the row it is shown in', () => {
+ const reader = new InstallProgressReader();
+ reader.push('x'.repeat(400));
+
+ expect(reader.take()).toHaveLength(160);
+ });
+});
diff --git a/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/install-progress.ts b/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/install-progress.ts
new file mode 100644
index 000000000..1880739a0
--- /dev/null
+++ b/dash/apps/switchdash-desktop/src/main/core/remote-hosts/setup/install-progress.ts
@@ -0,0 +1,70 @@
+/**
+ * Reading an install's live output as one line of progress (CHOO-1809).
+ *
+ * Install commands run in a PTY, so what arrives is terminal output rather than
+ * a log: escape sequences, and carriage returns that redraw the current line
+ * instead of adding a new one. `apt-get` repaints `0% [Waiting for headers]`
+ * dozens of times a second that way.
+ *
+ * What a user wants from that is the one line a terminal would be showing. This
+ * reconstructs it, and nothing else — no history, no buffering of the whole
+ * transcript (the failure path already keeps that).
+ */
+
+/** CSI sequences (colour, cursor moves), OSC strings (title sets), and the rest. */
+const ANSI_ESCAPE =
+ /\u001b\[[0-9;?]*[ -/]*[@-~]|\u001b\][^\u0007\u001b]*(?:\u0007|\u001b\\)?|\u001b[@-Z\\-_]/g;
+
+/** Backspaces, bells and friends: a terminal acts on these rather than showing them. */
+const CONTROL_CHARS = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g;
+
+/**
+ * Long enough to carry a package name and what is happening to it; short enough
+ * that a row does not reflow. Kept from the start of the line — apt puts the
+ * subject first and the byte counts last.
+ */
+const MAX_LINE = 160;
+
+function clean(raw: string): string {
+ return raw.replace(ANSI_ESCAPE, '').replace(CONTROL_CHARS, '').trim().slice(0, MAX_LINE);
+}
+
+export class InstallProgressReader {
+ /** The line being drawn, which may still be mid-arrival. */
+ private line = '';
+ /** The last line that actually said something. */
+ private latest = '';
+ private lastTaken: string | null = null;
+
+ /** Feed a chunk of raw PTY output. */
+ push(chunk: string): void {
+ // Both terminators end the current line. For a newline that starts a
+ // genuinely new one; for a carriage return the same one is repainted. Only
+ // the newest is ever shown, so the distinction does not matter here.
+ const segments = chunk.split(/\r\n|\r|\n/);
+ this.line += segments[0] ?? '';
+ for (let i = 1; i < segments.length; i++) {
+ this.settle();
+ this.line = segments[i]!;
+ }
+ }
+
+ /**
+ * The current line, or null when there is nothing new worth showing.
+ *
+ * Blank output reports null rather than an empty string, and leaves the last
+ * real message standing: every completed line leaves the cursor on an empty
+ * one, and blanking the display for each of those would flicker.
+ */
+ take(): string | null {
+ this.settle();
+ if (!this.latest || this.latest === this.lastTaken) return null;
+ this.lastTaken = this.latest;
+ return this.latest;
+ }
+
+ private settle(): void {
+ const current = clean(this.line);
+ if (current) this.latest = current;
+ }
+}
diff --git a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-setup-store.ts b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-setup-store.ts
index ffd37a21b..435ffccd7 100644
--- a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-setup-store.ts
+++ b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/host-setup-store.ts
@@ -15,22 +15,48 @@
import { makeAutoObservable, runInAction } from 'mobx';
import { events, rpc } from '@renderer/lib/ipc';
import { log } from '@renderer/utils/logger';
-import { hostSetupPlanEventChannel, type HostSetupPlan } from '@shared/core/remote-hosts/setup';
+import {
+ hostSetupActivityEventChannel,
+ hostSetupPlanEventChannel,
+ type HostSetupPlan,
+} from '@shared/core/remote-hosts/setup';
+
+function activityKey(sshHost: string, stepId: string): string {
+ return `${sshHost}\u0000${stepId}`;
+}
class HostSetupStore {
private plans = new Map<string, HostSetupPlan>();
+ /** What each in-flight step's command last printed. Live only — never persisted. */
+ private activity = new Map<string, string>();
private hydrated = false;
private hydrating: Promise<void> | null = null;
constructor() {
- makeAutoObservable<this, 'plans' | 'hydrating'>(this, {
+ makeAutoObservable<this, 'plans' | 'activity' | 'hydrating'>(this, {
plans: true,
+ activity: true,
hydrating: false,
});
events.on(hostSetupPlanEventChannel, (plan) => {
runInAction(() => {
this.plans.set(plan.sshHost, plan);
+ // A progress line outliving the work it described would be a small lie
+ // about what the host is doing, so it goes when the step stops.
+ for (const step of plan.steps) {
+ if (step.state !== 'checking' && step.state !== 'installing') {
+ this.activity.delete(activityKey(plan.sshHost, step.id));
+ }
+ }
+ });
+ });
+
+ events.on(hostSetupActivityEventChannel, ({ sshHost, stepId, line }) => {
+ runInAction(() => {
+ const key = activityKey(sshHost, stepId);
+ if (line === null) this.activity.delete(key);
+ else this.activity.set(key, line);
});
});
}
@@ -62,6 +88,11 @@ class HostSetupStore {
if (!sshHost) return null;
return this.plans.get(sshHost) ?? null;
}
+
+ /** The line a running step last printed, or null when nothing is in flight. */
+ activityFor(sshHost: string, stepId: string): string | null {
+ return this.activity.get(activityKey(sshHost, stepId)) ?? null;
+ }
}
export const hostSetupStore = new HostSetupStore();
diff --git a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/setup-detail-sheet.tsx b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/setup-detail-sheet.tsx
index f2d7b46f3..b2fc263b7 100644
--- a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/setup-detail-sheet.tsx
+++ b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/setup-detail-sheet.tsx
@@ -85,7 +85,16 @@ function OutcomeTile({ step }: { step: HostSetupStep }) {
}
/** What a step observed, in the agents page's "Found `v…`" card. */
-function ObservationCard({ step, actions }: { step: HostSetupStep; actions?: React.ReactNode }) {
+function ObservationCard({
+ step,
+ activity,
+ actions,
+}: {
+ step: HostSetupStep;
+ /** The running command's latest line, when something is in flight. */
+ activity: string | null;
+ actions?: React.ReactNode;
+}) {
return (
<div className="flex flex-col gap-1.5">
<div className="flex items-center gap-2 rounded-lg border p-3">
@@ -112,6 +121,16 @@ function ObservationCard({ step, actions }: { step: HostSetupStep; actions?: Rea
{actions}
</div>
+ {/*
+ A remote install can run for minutes. Showing the line the host is
+ printing is the difference between "this is working" and "this has hung".
+ */}
+ {activity && (
+ <p className="truncate font-mono text-xs text-foreground-muted" title={activity}>
+ {activity}
+ </p>
+ )}
+
{step.state === 'failed' && step.error && (
<p className="text-destructive text-xs">{step.error}</p>
)}
@@ -210,6 +229,7 @@ export function SetupDetailSheet({
sshHost,
plan,
icon,
+ activityFor,
onClose,
onInstall,
installingStepId,
@@ -223,6 +243,8 @@ export function SetupDetailSheet({
plan: HostSetupPlan | null;
/** Icon for the prerequisite being shown; agent types use their own. */
icon: React.ReactNode;
+ /** The running command's latest line for a step, if it is running. */
+ activityFor: (stepId: string) => string | null;
onClose: () => void;
onInstall: (stepId: string) => void;
installingStepId: string | null;
@@ -253,6 +275,7 @@ export function SetupDetailSheet({
<Label>Installation</Label>
<ObservationCard
step={target.step}
+ activity={activityFor(target.step.id)}
actions={
<StepActions
step={target.step}
@@ -272,6 +295,7 @@ export function SetupDetailSheet({
row={target.row}
sshHost={sshHost}
plan={plan}
+ activityFor={activityFor}
onInstall={onInstall}
installingStepId={installingStepId}
onSkip={onSkip}
@@ -291,6 +315,7 @@ function AgentTypeDetail({
row,
sshHost,
plan,
+ activityFor,
onInstall,
installingStepId,
onSkip,
@@ -300,6 +325,7 @@ function AgentTypeDetail({
row: AgentTypeRow;
sshHost: string;
plan: HostSetupPlan | null;
+ activityFor: (stepId: string) => string | null;
onInstall: (stepId: string) => void;
installingStepId: string | null;
onSkip: (stepId: string) => void;
@@ -320,6 +346,7 @@ function AgentTypeDetail({
<Label>Installation</Label>
<ObservationCard
step={row.cli}
+ activity={activityFor(row.cli.id)}
actions={
<StepActions
step={row.cli}
diff --git a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/setup-rows.tsx b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/setup-rows.tsx
index d9a95fa33..3b9862125 100644
--- a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/setup-rows.tsx
+++ b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/setup/setup-rows.tsx
@@ -55,6 +55,7 @@ function Row({
icon,
name,
subtitle,
+ progress,
badge,
highlighted,
action,
@@ -63,6 +64,8 @@ function Row({
icon: React.ReactNode;
name: string;
subtitle?: string | null;
+ /** What the running command last printed. Takes the subtitle's place while it runs. */
+ progress?: string | null;
badge: BadgeSpec;
highlighted?: boolean;
/** Inline fix-it control, so acting on one item costs no navigation. */
@@ -86,7 +89,11 @@ function Row({
</div>
<span className="flex min-w-0 flex-col">
<span className="truncate text-sm text-foreground">{name}</span>
- {subtitle && <span className="truncate text-xs text-foreground-muted">{subtitle}</span>}
+ {progress ? (
+ <span className="truncate font-mono text-[11px] text-foreground-muted">{progress}</span>
+ ) : (
+ subtitle && <span className="truncate text-xs text-foreground-muted">{subtitle}</span>
+ )}
</span>
</button>
<div className="flex shrink-0 items-center gap-2">
@@ -133,12 +140,14 @@ export function PrerequisiteRow({
step,
isCurrent,
installing,
+ activity,
onInstall,
onOpen,
}: {
step: HostSetupStep;
isCurrent: boolean;
installing: boolean;
+ activity: string | null;
onInstall: () => void;
onOpen: () => void;
}) {
@@ -147,6 +156,7 @@ export function PrerequisiteRow({
icon={<PrerequisiteIcon step={step} />}
name={step.name}
subtitle={step.state === 'satisfied' ? step.version : null}
+ progress={activity}
badge={stepBadge(step)}
highlighted={isCurrent}
action={<InstallAction step={step} installing={installing} onInstall={onInstall} />}
@@ -159,12 +169,15 @@ export function AgentTypeRowItem({
row,
isCurrent,
installingStepId,
+ activityFor,
onInstall,
onOpen,
}: {
row: AgentTypeRow;
isCurrent: boolean;
installingStepId: string | null;
+ /** A row covers two steps, so it asks per step which one is talking. */
+ activityFor: (stepId: string) => string | null;
onInstall: (stepId: string) => void;
onOpen: () => void;
}) {
@@ -180,6 +193,7 @@ export function AgentTypeRowItem({
icon={<AgentIcon id={row.agentId} size={16} />}
name={row.name}
subtitle={row.cli.state === 'satisfied' ? row.cli.version : null}
+ progress={activityFor(row.cli.id) ?? (row.plugin ? activityFor(row.plugin.id) : null)}
badge={agentTypeBadge(row)}
highlighted={isCurrent}
action={
diff --git a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/views/remote-host-view.tsx b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/views/remote-host-view.tsx
index b9ea31698..630139b34 100644
--- a/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/views/remote-host-view.tsx
+++ b/dash/apps/switchdash-desktop/src/renderer/features/remote-hosts/views/remote-host-view.tsx
@@ -32,6 +32,7 @@ import { deriveHostStatus } from '@shared/core/remote-hosts/host-status';
import { isHostBlocked } from '@shared/core/remote-hosts/reachability';
import { GhAuthPanel } from '../gh-auth-panel';
import { hostReachabilityStore } from '../host-reachability-store';
+import { hostSetupStore } from '../host-setup-store';
import { HostUnreachablePanel } from '../host-unreachable-panel';
import { SetupDetailSheet, type SheetTarget } from '../setup/setup-detail-sheet';
import {
@@ -97,6 +98,9 @@ export const RemoteHostMainPanel = observer(function RemoteHostMainPanel() {
const busy = prepare.isPending || recheck.isPending || installStep.isPending;
const installingStepId = installStep.isPending ? (installStep.variables ?? null) : null;
const currentStepId = plan.data?.currentStepId ?? null;
+ // Read inside render so mobx tracks it: the line changes several times a
+ // second while an install runs, and nothing else re-renders on that.
+ const activityFor = (stepId: string) => hostSetupStore.activityFor(sshHost, stepId);
// Keep an open sheet in step with pushed plan updates, so a row's detail
// advances while a run is in flight instead of freezing at the state it had
@@ -190,6 +194,7 @@ export const RemoteHostMainPanel = observer(function RemoteHostMainPanel() {
step={step}
isCurrent={step.id === currentStepId}
installing={installingStepId === step.id}
+ activity={activityFor(step.id)}
onInstall={() => installStep.mutate(step.id)}
onOpen={() => setSheetTarget({ kind: 'prerequisite', step })}
/>
@@ -207,6 +212,7 @@ export const RemoteHostMainPanel = observer(function RemoteHostMainPanel() {
row={row}
isCurrent={row.cli.id === currentStepId || row.plugin?.id === currentStepId}
installingStepId={installingStepId}
+ activityFor={activityFor}
onInstall={(stepId) => installStep.mutate(stepId)}
onOpen={() => setSheetTarget({ kind: 'agent-type', row })}
/>
@@ -242,6 +248,7 @@ export const RemoteHostMainPanel = observer(function RemoteHostMainPanel() {
<PrerequisiteIcon step={liveTarget.step} size={24} />
) : null
}
+ activityFor={activityFor}
onClose={() => setSheetTarget(null)}
onInstall={(stepId) => installStep.mutate(stepId)}
installingStepId={installingStepId}
@@ -258,14 +265,10 @@ export const RemoteHostMainPanel = observer(function RemoteHostMainPanel() {
);
});
-function RemoteHostTitlebar() {
- const sshHost = useSshHost();
- return <span className="text-sm text-foreground-muted">{sshHost}</span>;
-}
-
export const remoteHostView = {
WrapView: ({ children }: { children: React.ReactNode; sshHost: string }) => <>{children}</>,
- TitlebarSlot: RemoteHostTitlebar,
+ // No titlebar slot: the page header already names the host and repeats the
+ // alias underneath it, so a third copy in the title bar was only noise.
MainPanel: RemoteHostMainPanel,
canActivate: (params: unknown): GuardResult => {
// Params can come from a snapshot written by an older build, so validate
diff --git a/dash/apps/switchdash-desktop/src/shared/core/remote-hosts/setup.ts b/dash/apps/switchdash-desktop/src/shared/core/remote-hosts/setup.ts
index b70e1b3a0..16c401e8c 100644
--- a/dash/apps/switchdash-desktop/src/shared/core/remote-hosts/setup.ts
+++ b/dash/apps/switchdash-desktop/src/shared/core/remote-hosts/setup.ts
@@ -151,3 +151,25 @@ export function isPlanComplete(plan: HostSetupPlan): boolean {
/** Pushed to the renderer on every plan transition, so the UI never polls. */
export const hostSetupPlanEventChannel = defineEvent<HostSetupPlan>('remote-hosts:setup-changed');
+
+/**
+ * What a step is doing right now, in the running command's own words.
+ *
+ * A remote install can take minutes — fetching packages, unpacking, running
+ * post-install hooks — and a spinner labelled "Installing…" for all of it is
+ * indistinguishable from a hang. This carries the line the host is currently
+ * printing so the user can see it is moving, and roughly on what.
+ *
+ * Deliberately not part of the plan: it is a live view of work in progress, not
+ * a fact about the host. It is never persisted, and `line: null` means the work
+ * has finished — whatever it concluded is then in the step itself.
+ */
+export type HostSetupActivity = {
+ sshHost: string;
+ stepId: string;
+ line: string | null;
+};
+
+export const hostSetupActivityEventChannel = defineEvent<HostSetupActivity>(
+ 'remote-hosts:setup-activity'
+);