From 6b0bb19e914a3bbaeca198ac1627d698c3a13a76 Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Thu, 25 Jun 2026 17:09:57 +0900 Subject: feat(computer): SSH computer selection + status + workspace default (handoff #2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirrors the cwd/workspace UI for the SSH-computer feature: - New feature library src/features/computer/: - logic/view-model.ts (pure): viewComputer/viewComputerStatus/viewTestResult/ summarizeComputers/formatHost/knownHostLabel + state->badge for the 4 ComputerStatusResponse states + SaveComputer/LoadComputerStatus/ TestComputer/LoadComputers ports. 20 view-model tests. - ui/ComputerField.svelte: per-conversation selector (dropdown + connection-status badge + Test-connection, polling the selected alias). - ui/ComputerSelect.svelte: reusable Local/computers dropdown, shared with the workspace default-computer control. - AppStore: computerId state + refreshComputer (at every focus site, parallel to refreshCwd) + setComputer (PUT /conversations/:id/computer, null=clear) + global computers catalog (GET /computers on boot, like models) + computerStatus(alias) + testComputer(alias). chat.send UNCHANGED (resolved server-side like cwd). - App.svelte: ComputerField in the Model sidebar view next to CwdField; adapted ports wrap the store. - workspaces: setDefaultComputer on WorkspaceHttp+WorkspaceStore (PUT /workspaces/:id/default-computer); default-computer selector in WorkspaceCard (reuses ComputerSelect); router passes store.computers through. - Re-mirrored .dispatch/transport-contract.reference.md (Computers section + ChatRequest.computerId); updated .dispatch/wire.reference.md (Computer/ ComputerEntry/defaultComputerId + the provider-retry divergence note from handoff #1); GLOSSARY + backend-handoff.md (handoff #2, §2e). Transparency invariant: the computer is USER-facing only (a tool-execution target, never part of the model prompt); the agent never sees it. Verify: 795/795 tests green; biome clean; vite build succeeds; 0 typecheck errors from the computer feature. (11 pre-existing svelte-check errors remain from the open §2d provider-retry divergence — backend feature/ssh-support still lacks TurnProviderRetryEvent; not from this feature.) --- src/features/computer/ui/ComputerField.svelte | 195 +++++++++++++++++++++++++ src/features/computer/ui/ComputerSelect.svelte | 39 +++++ 2 files changed, 234 insertions(+) create mode 100644 src/features/computer/ui/ComputerField.svelte create mode 100644 src/features/computer/ui/ComputerSelect.svelte (limited to 'src/features/computer/ui') diff --git a/src/features/computer/ui/ComputerField.svelte b/src/features/computer/ui/ComputerField.svelte new file mode 100644 index 0000000..be3ce9c --- /dev/null +++ b/src/features/computer/ui/ComputerField.svelte @@ -0,0 +1,195 @@ + + +
+ Computer (SSH) +
+ + {#if saving} + + {/if} +
+ + {#if !canEdit} +

Start or open a conversation to set its computer.

+ {:else if computerId !== null} + +
+ {#if statusView} + + {#if statusView.busy} + + {/if} + {statusView.statusLabel} + + {:else if statusError} + Status error + {:else} + + {/if} + + + + {#if testResult} + + {testResult.ok ? "Connection OK" : testResult.error ?? "Failed"} + + {/if} +
+ {#if statusView?.error} +

{statusView.error}

+ {/if} + {:else if computers.length === 0} +

+ No computers discovered — add a `Host` block to your `~/.ssh/config` to use a remote computer. +

+ {:else if justSaved && !error} +

Saved.

+ {/if} + + {#if error} +

{error}

+ {/if} + +

+ Where this conversation's tools run. `null` (Local) runs on the server; an alias runs over SSH. Not seen by the agent. +

+
diff --git a/src/features/computer/ui/ComputerSelect.svelte b/src/features/computer/ui/ComputerSelect.svelte new file mode 100644 index 0000000..d693140 --- /dev/null +++ b/src/features/computer/ui/ComputerSelect.svelte @@ -0,0 +1,39 @@ + + + -- cgit v1.2.3 From cdce5197abcf0f5b0576e847a701d3a317384a65 Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Thu, 25 Jun 2026 22:00:38 +0900 Subject: fix(computer): show ✓ check after a successful Test (not a stuck spinner) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the user clicks Test, the button now transitions spinner → ✓ (green) on success / ✗ (red) on failure (persisting until the next test or computer change), instead of reverting to plain 'Test' text with no success indicator. Also refresh the connection-status badge immediately after a test completes, so a stale 'connecting' spinner caught by the 4s poll mid-test is cleared and the badge reflects the real post-test state. Clear the test result when the selected computer changes so a stale ✓ from alias A doesn't persist for alias B. --- src/features/computer/ui/ComputerField.svelte | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/features/computer/ui') diff --git a/src/features/computer/ui/ComputerField.svelte b/src/features/computer/ui/ComputerField.svelte index be3ce9c..ce19b4d 100644 --- a/src/features/computer/ui/ComputerField.svelte +++ b/src/features/computer/ui/ComputerField.svelte @@ -76,8 +76,10 @@ } // Re-fetch on mount + whenever the selected alias changes (incl. after a save). + // Clear the test result so a stale ✓ from alias A doesn't persist for alias B. $effect(() => { void computerId; + testResult = null; void refreshStatus(); }); @@ -106,6 +108,9 @@ testResult = result.ok ? { ok: true, error: null } : { ok: false, error: result.error }; + // Refresh the connection-status badge so it reflects the post-test state + // (clears a stale "connecting" spinner caught by the poll mid-test). + void refreshStatus(); } const badgeClass = $derived.by(() => { @@ -160,9 +165,18 @@ class="btn btn-ghost btn-xs" disabled={testing} onclick={runTest} + title={testResult + ? testResult.ok + ? "Connection OK" + : testResult.error ?? "Failed" + : "Test connection"} > {#if testing} + {:else if testResult?.ok} + + {:else if testResult} + {:else} Test {/if} @@ -170,7 +184,7 @@ {#if testResult} - {testResult.ok ? "Connection OK" : testResult.error ?? "Failed"} + {testResult.ok ? "OK" : testResult.error ?? "Failed"} {/if} -- cgit v1.2.3