Public Access
Add the Avalonia app and the xterm renderer, and fix two real bugs
The terminal works end to end. A new integration test drives a real sshd in a container through a real PTY, the real pump, the real loopback WebSocket with its token and origin checks, and a ClientWebSocket standing in for the page: the login banner arrives, typed input round-trips, and `stty size` reports the 100x30 the session asked for. The only untested link left is xterm drawing bytes it was handed. The WebView is de-risked on Windows, which was the plan's largest risk. Not by assertion: with the app running there is an established TCP connection from msedgewebview2 to the data plane port, so WebView2 launched, navigated to the loopback page, executed terminal.js, and completed the WebSocket handshake against the real token and origin checks. Linux remains unproven and the package's own release notes now corroborate the concern -- Linux uses a WPE backend, and it ships a NativeWebDialog described as useful where embedded WebViews may be unavailable. Two bugs found by building it, both of which would have shipped: - ShellStream.Write buffers and needs an explicit Flush. Without one a keystroke is accepted, reported as written, and never reaches the remote: the terminal displays output perfectly and simply stops responding to input. SSH.NET's own WriteLine flushes, which is why the earlier spike never hit it. Found by isolating the pump against real SSH and reading BytesRead=51 -- banner and prompt through, nothing after. - The Windows app manifest needs a supportedOS list, or Avalonia's native control host fails outright and the terminal never starts. Also fixed a genuinely flaky test I happened to catch: SyncCursorTests tampered with the *last* base64url character, whose low bits the decoder ignores when the input length is not a multiple of three -- so a tampered cursor sometimes decoded to identical bytes and verified. It failed roughly one run in thirty, depending on a random key. Now tampers the penultimate character, which is fully significant at every length; 40 consecutive runs are clean. xterm 6.0.0 plus the fit and webgl addons are vendored as UMD bundles rather than built with npm, so a clean clone needs only the .NET SDK. Provenance and licences are recorded next to them, along with the UMD global names terminal.js depends on -- a bundle that switched to ES modules would load without error and leave Terminal undefined. The renderer acknowledges output from term.write's completion callback, not on receipt. Acknowledging early would return flow-control credit for bytes the screen has not caught up with, which is the one thing the credit window exists to measure. TerminalWorkspace moved into DodoSSH.Client.Terminal: it has no Avalonia dependency, and having it there is what let the end-to-end test exist at all. 404 tests pass, zero warnings on a clean rebuild, format clean.
This commit is contained in:
+37
-7
@@ -28,13 +28,37 @@ or notarization fails with an error that does not name the offending file.
|
||||
|
||||
## Desktop client
|
||||
|
||||
**The Avalonia WebView on Linux is unproven, and is the single largest risk in the plan.** The
|
||||
official control uses WPE WebKit (`libwpewebkit-2.0`); the community `NativeWebView` uses WebKitGTK
|
||||
(`libwebkit2gtk-4.1`), which is far more widely installed. Avalonia's own documentation
|
||||
contradicts itself on whether offscreen rendering works there. *Unverified:* the spike must cover
|
||||
Ubuntu on both Wayland and X11, Fedora KDE, and macOS 15. This is why the terminal sits behind
|
||||
`ITerminalHost` — that abstraction is what preserves the option to swap backends, and it should
|
||||
not be collapsed away for convenience.
|
||||
**The WebView works on Windows.** `Avalonia.Controls.WebView` 12.0.1 (MIT, no licence key) hosts the
|
||||
terminal page successfully: WebView2 launches, navigates to the loopback page, runs its JavaScript and
|
||||
completes the WebSocket handshake. Verified by observing an established TCP connection from
|
||||
`msedgewebview2` to the data plane port.
|
||||
|
||||
**The Windows app manifest must declare a `supportedOS` list.** Without it the process reports a
|
||||
downlevel Windows version and Avalonia's native control host fails outright — *"Unable to create child
|
||||
window for native control host"* — so the WebView, and therefore the terminal, does not start at all.
|
||||
`[STAThread]` on `Main` is equally mandatory: WebView2 checks the apartment state and refuses to
|
||||
initialise on an MTA thread.
|
||||
|
||||
**WebView2 spawns a process tree, not a process.** Around 35 processes were observed for one embedded
|
||||
view. That is the concrete reason the design uses one WebView hosting N terminals rather than one per
|
||||
tab: twenty tabs would mean twenty of those trees.
|
||||
|
||||
**The Avalonia WebView on Linux remains unproven, and is still the largest risk in the plan.** The
|
||||
package's own release notes say `NativeWebView` gained Linux support via a **WPE** backend
|
||||
(`libwpewebkit-2.0`), which is much less widely installed than WebKitGTK — and it ships a separate
|
||||
`NativeWebDialog` described as *"particularly useful for platforms like Linux where embedded WebView
|
||||
controls might not be available"*, which is the vendor confirming the concern. *Unverified:* a spike
|
||||
must cover Ubuntu on both Wayland and X11, Fedora KDE, and macOS 15. This is why the terminal sits
|
||||
behind `ITerminalHost`; that seam should not be collapsed away for convenience.
|
||||
|
||||
**`Avalonia.Diagnostics` has no 12.x release** (latest is 11.3.18), so the developer tools overlay is
|
||||
unavailable on Avalonia 12. Development-only, so nothing ships differently — but debugging a layout
|
||||
problem currently means reasoning rather than inspecting.
|
||||
|
||||
**The xterm bundles are vendored, not built.** `@xterm/xterm` 6.0.0 with the fit and webgl addons, all
|
||||
MIT, committed as UMD bundles under `WebAssets/vendor` and embedded as Avalonia resources. No npm or
|
||||
esbuild step, so a clean clone builds with the .NET SDK alone. The cost is that upgrades are a manual
|
||||
re-download; the licence and versions are recorded here so that stays visible.
|
||||
|
||||
**SSH.NET's `window-change` is verified working** as of 2025.1.0 — resolved, not a flag.
|
||||
`ShellStream.ChangeWindowSize(columns, rows, width, height)` exists and the remote genuinely
|
||||
@@ -43,6 +67,12 @@ repeated resizes each take effect. The `IChannelSession` fallback is not needed.
|
||||
in place as a regression guard, because an upgrade that silently stopped sending the request would
|
||||
present as wrapped output only after a resize — easy to misattribute to the terminal emulator.
|
||||
|
||||
**`ShellStream.Write` buffers and requires an explicit `Flush`.** Without one a keystroke is accepted,
|
||||
reported as written, and never reaches the remote — the terminal displays output perfectly and simply
|
||||
stops responding to input. SSH.NET's own `WriteLine` flushes, which is why a spike that used it never
|
||||
hit this. `SshNetShellSession.WriteAsync` now flushes per write; batching would be wrong anyway, since
|
||||
a terminal has to put a keystroke on the wire immediately.
|
||||
|
||||
**`ShellStream` does not override `ReadAsync`.** The base `Stream` implementation therefore runs
|
||||
the blocking `Read` on a thread-pool thread, so every open session parks one thread for as long as
|
||||
it is idle. Fine for the handful of tabs M1 targets; revisit before advertising many concurrent
|
||||
|
||||
Reference in New Issue
Block a user