mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-24 17:32:18 +00:00
f1cfce45cf6dfd3efa738143aee26dc4050c9ffd
190
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3efc9ada8e |
Fix Windows mosh startup
Fix Windows mosh startup |
||
|
|
e4e1b54374 | Fix terminal custom accent color (#864) | ||
|
|
a4a5c703b1 | Fix terminal cursor preference handling | ||
|
|
df25d6c4b0 | fix: resolve WebGL blank frame on resize and keep split pane bright on context menu (#837) | ||
|
|
a5b5f15343 |
feat(terminal): quick encoding switch for telnet & serial (closes #804) (#812)
* feat(terminal): extend quick encoding switcher to telnet and serial sessions Closes #804. TerminalToolbar only showed the UTF-8 / GB18030 encoding menu for SSH sessions. Telnet and serial sessions had no runtime control — their decoder was fixed at session start via charsetToNodeEncoding + Node's StringDecoder, which only knows utf8/latin1/ascii/utf16le. Users connecting to legacy telnet daemons or MCU consoles emitting GBK were stuck with the encoding chosen at connect time and could not switch to read non-latin text correctly. Main side (terminalBridge.cjs): - Swap StringDecoder for iconv-lite on the telnet + serial paths so GB18030 actually decodes. Local PTY and mosh keep StringDecoder — local follows the OS locale and mosh frames its own UTF-8, neither needs a runtime swap. - Store the decoder through a mutable decoderRef on the session object so the onData closures stay untouched while a new IPC handler can swap in a fresh decoder mid-session. - Add normalizeTerminalEncoding that resolves user-facing charset names (utf-8/gbk/gb2312/gb18030) into iconv identifiers. - Register netcatty:terminal:setEncoding, which updates the session's encoding + decoderRef (and mirrors to serialEncoding for aiBridge / mcpServerBridge exec calls that still read the legacy field). Renderer + preload: - preload.setSessionEncoding now tries the SSH handler first and falls through to the new terminal handler when the SSH side reports ok: false (non-SSH sessions don't have session.stream). Single preload method, one extra IPC round-trip only for telnet/serial, which only happens on explicit user click. - Drop the isSSHSession gate in TerminalToolbar; replace with encodingSwitchSupported = not local, not mosh, not localhost-PTY. - Terminal.tsx onSessionAttached now syncs the initial encoding for every protocol that supports it (same gate as the toolbar), not only SSH. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ai): decode serial exec output with iconv for non-Buffer encodings Codex flagged (#812 P1) that session.serialEncoding can now be an iconv-only label like gb18030 after a user switches encoding via the new terminal toolbar menu. execViaRawPty then called data.toString(encoding) on the raw Buffer, which throws "TypeError: Unknown encoding" for anything outside Node's utf8/latin1/ascii/utf16le set. The throw landed inside the data listener so Catty Agent / MCP serial exec calls failed and, worse, the uncaught path could destabilize the process. Route the decode through a small decodeBufferAs helper: Node encoding labels still use Buffer.toString for speed; anything else falls back to iconv-lite (which already handles the toolbar's GB18030). A last- resort utf8 fallback keeps the listener from throwing even if iconv itself rejects an unrecognized label. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(terminal): don't overwrite telnet/serial charset on session attach Codex flagged (#812 P1) that extending onSessionAttached to sync the UI encoding for telnet and serial sessions corrupts any host charset outside the toolbar's two values. terminalEncodingRef is derived from a useState that only ever resolves to 'utf-8' or 'gb18030', so a host configured with latin1 / shift_jis had its correct decoder immediately clobbered with one of those two as soon as the session attached. SSH is the only protocol that actually needs this sync: its backend starts in utf-8 regardless of host.charset. startTelnetSession and startSerialSession already apply options.charset through normalizeTerminalEncoding, so leaving them alone keeps arbitrary iconv labels intact; the toolbar's runtime switch remains the path for users who do want to flip to UTF-8 / GB18030 mid-session. Restore the SSH-only gate on the sync and document why the new protocols are intentionally excluded. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * style(terminal): align encoding menu rows with the rest of the popover The encoding section used a different template from every other row in the overflow menu: an uppercase "TERMINAL ENCODING" section header, then two indented rows with a leading check mark instead of a leading icon. Next to Open SFTP / Scripts / Terminal settings it read as a different component and made the popover feel disjointed. Drop the section header and render both encoding options as plain menuItemClass rows — Languages icon on the left to match the Zap / Palette leading-icon pattern, label in the flex-1 slot, and the active row gets a trailing Check in place of a right-side accessory. A single divider above them still groups the choice visually without the uppercase label. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * style(terminal): collapse encoding picker into a proper submenu The previous pass put UTF-8 and GB18030 as flat rows under a separator inside the main overflow popover. It matched the top rows better but still looked like a disjoint block of two choices stuck at the bottom. Turn the encoding picker into a nested submenu so the parent popover stays a flat list of actions and the choice lives behind a single row that mirrors the other menu items exactly: Languages icon on the left, t("terminal.toolbar.encoding") label in the flex slot, the current value as a muted caption, and a ChevronRight to signal the submenu. The submenu itself is a second Popover anchored to the right of the parent. Both popovers are now controlled so picking a value closes the whole chain in one click, and the parent's onInteractOutside ignores clicks that land in the submenu portal — otherwise Radix would treat the submenu click as "outside" the parent and dismiss it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(terminal): drop hostname gate, simplify encoding row label Two issues in one pass: 1. Codex P2 (#812): encodingSwitchSupported still hard-disabled the menu when host.hostname === 'localhost'. That was a leftover from when the only "local" escape hatch was hostname-based, but it incorrectly blocks telnet / SSH sessions aimed at localhost (test daemons, forwarded endpoints) which do have a real backend decoder we can drive. The isLocalTerminal / isMoshSession gates already cover the true local PTY and mosh cases — drop the hostname check. 2. UI: the submenu trigger carried the current value as a muted caption next to the label. At w-48 the row ran out of room and truncated "Terminal Encoding" to "Terminal Enc...". Since the submenu already marks the active choice with a check, the caption is redundant. Remove it so the full label fits. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ai): stream-decode serial output with a stateful per-command decoder Codex flagged (#812 P2) that decoding each serial data event with a stateless decodeBufferAs call corrupts multi-byte characters on GBK/GB18030 consoles: serial ports deliver chunks at arbitrary byte boundaries, so the leading half of a 2-byte char in one event gets emitted as replacement bytes before the trailing half ever arrives. Build a stateful decoder once per execViaRawPty call (StringDecoder for Node-native encodings, iconv.getDecoder for iconv-only labels like gb18030) and feed every chunk through decoder.write(). On finish, decoder.end() flushes any partial bytes the decoder is still holding into the final output before it's handed back to the caller. Strings pass through untouched, same as before. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(terminal): sync SSH encoding on localhost sessions too Codex flagged (#812 P2) that dropping the 'localhost' check from the toolbar's encodingSwitchSupported gate left an inconsistency: Terminal.tsx onSessionAttached still skipped setSessionEncoding when host.hostname === 'localhost', so a user could pick GB18030, reconnect a localhost SSH tab, and the backend would restart in utf-8 while the UI still showed GB18030 — mojibake until manually toggled again. Drop the hostname clause from the isSSH check here as well. SSH to localhost is still a real SSH session whose backend starts in utf-8; the sync is what keeps the UI's picked encoding aligned across reconnects. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(terminal): re-sync telnet/serial encoding after user opt-in Codex flagged (#812 P2) that the SSH-only sync left telnet/serial with a silent UI/backend mismatch across reconnects: a user picks GB18030, the tab disconnects and retries, startTelnetSession/startSerialSession re-apply host.charset, and the UI still shows GB18030 — garbled output until the user toggles again. An unconditional sync isn't right either (earlier review: it would clobber arbitrary host.charset values like latin1 / shift_jis that the UI's two-value state can't represent). Track whether the user has actually clicked the toolbar menu this session via userPickedEncodingRef — once set, any subsequent onSessionAttached for telnet/serial re-applies the picked value; on first attach with no user action the backend's configured charset stays intact. SSH keeps the unconditional sync (its backend always starts in utf-8, so there's no configured charset to preserve). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
a1648adf12 |
Add opt-in setting to preserve mouse selection across keystrokes (#755) (#763)
* Add opt-in setting to preserve mouse selection across keystrokes Closes #755. xterm.js hardcodes a "clear selection on user input" listener (SelectionService.ts: coreService.onUserInput → clearSelection) with no public option to disable. The user-reported workflow this breaks: select a path with the mouse, type a command prefix like `sz `, then middle-click-paste the still-live selection — but the very first keystroke wipes the selection, so there's nothing left to paste. Modern terminals (iTerm2, GNOME Terminal, Windows Terminal) preserve the selection across input by default. We expose this as an opt-in toggle for now since the visual semantics are a behavior change. Implementation is capture-and-restore via xterm.js public APIs (getSelectionPosition / select); xterm clears the selection synchronously, then a queueMicrotask reapplies it on the next tick. A ref (isRestoringSelectionRef) gates copy-on-select so the restore doesn't redundantly rewrite the clipboard and clobber whatever the user copied elsewhere in between. Defaults to false (opt-in); can flip to default-on later if reception is positive. Selection still clears on: - Mouse click in empty space (xterm's mouse-driven path is untouched) - Terminal scroll past the selected rows (existing buffer-trim logic) - Programmatic clearSelection() callers Files: - domain/models.ts — new field, default false - application/syncPayload.ts — added to SYNCABLE_TERMINAL_KEYS - components/terminal/runtime/createXTermRuntime.ts — capture in attachCustomKeyEventHandler, restore via queueMicrotask - components/Terminal.tsx — owns isRestoringSelectionRef, passes it through context, checks in copy-on-select listener - components/settings/tabs/SettingsTerminalTab.tsx — UI toggle - application/i18n/locales/{en,zh-CN}.ts — labels Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Trim verbose i18n descriptions to match neighboring rows Both clearWipesScrollback and preserveSelectionOnInput descriptions were too long. Cut to one sentence each, matching the brevity of adjacent rows like Bracketed paste and OSC-52. Historical context and edge-case caveats belong in the changelog/PR, not the settings UI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
1b23bdcf15 |
[codex] Preserve terminal focus when clicking the toolbar overlay (#734)
* fix terminal toolbar focus loss * restore focus after closing side panels * fix terminal side panel focus helper order |
||
|
|
1ca2cd8ec2 |
feat: add "paste selection" terminal command with bindable shortcut
Adds a new terminal action that pastes the terminal's current selection at the cursor without going through the system clipboard — the equivalent of X11 PRIMARY-selection paste. Default shortcut: ⌘ + Shift + X / Ctrl + Shift + X. Also surfaces the action in the terminal right-click menu, disabled when there is no selection. Does not change middle-click paste behavior. Closes #637 |
||
|
|
3429c498f9 |
fix: cancel pending retry when session is closed or cancelled
Per Codex P1 on #701: the nested term.write callbacks in handleRetry kept a captured reference to startNewSession. If the user hit Cancel or closed the tab while those writes were still queued, cleanupSession ran first but the callback could still fire afterwards — opening a backend session with no owning UI (a ghost connection that nothing would tear down). Introduce retryTokenRef. handleRetry stamps a fresh Symbol, captures it, and the chained callbacks verify the token (plus termRef identity) is still current before proceeding. Invalidate the token from every path that ends the retry intent: handleCancelConnect, handleCloseDisconnected Session, teardown. A subsequent handleRetry naturally invalidates the prior one by overwriting the ref, so rapid double-clicks are also safe. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
dc7b14e323 |
fix: delay new session start until reset sequence has flushed
Per Codex P1 on #701: term.write is asynchronous, but handleRetry was calling sessionStarters.start* synchronously right after scheduling the soft-reset write. On fast reconnect paths (local and serial especially, where the backend has no network round-trip), the new session's first output bytes can reach xterm before the \x1b[!p...\x1b[H reset has been applied. That means the reset/home runs mid-stream of the first prompt, repositioning the cursor or flipping modes partway through the shell's init and producing intermittent corrupted first screens. Extract the protocol dispatch into startNewSession and pass it as the callback of the second term.write, so the new session only starts once every preparation byte (alt-screen exit, viewport preserve, DECSTR, xterm mode disables, cursor home) has actually been applied to the terminal state. State updates that only drive the UI overlay (status, progress logs) stay synchronous so users see "connecting..." immediately. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
5d675b9cef |
fix: exit alt-screen before preserving viewport; use DECSTR for mode reset
Addresses two Codex findings on #701: P1 (alt-screen ordering) — preserveTerminalViewportInScrollback only operates on the normal buffer. If the user disconnected while inside vim/less/top, the alt buffer was active, preserve was a no-op, and when \x1b[?1049l later switched back to normal, the new session wrote over still-visible pre-disconnect content instead of a cleared viewport. Send \x1b[?1049l first, then wait for the write to flush (via xterm's write callback) before calling preserve, so it always runs on the normal buffer. P2 (DECCKM / keypad / other VT220 modes) — the previous reset sequence only disabled xterm extensions (mouse tracking, bracketed paste) and touched SGR / cursor visibility. Full-screen apps commonly enable DECCKM (application cursor keys) and keypad application mode; those would leak into the new session and break arrow-key history navigation and numeric keypad input. Use DECSTR (\x1b[!p) — soft terminal reset — to reset DECCKM, keypad mode, SGR, insert/replace, origin mode, and cursor visibility in one shot without clearing the buffer. Keep explicit disables for the xterm-specific modes DECSTR doesn't cover. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
bf9f0e1fc2 |
fix: reset bracketed-paste mode on reconnect
Per Codex P2 on #701: handleRetry previously removed term.reset() but the replacement escape sequence didn't disable bracketed paste (DECSET 2004). If the disconnected session had turned it on, term.modes .bracketedPasteMode stayed true into the next connection; the paste and snippet paths in createXTermRuntime keep wrapping input with \x1b[200~ ... \x1b[201~ markers. When the new session hasn't itself enabled bracketed paste, the shell echoes those markers as literal text and mangles pastes. Add \x1b[?2004l to the retry reset sequence so bracketed-paste state starts off for the new session; the new shell's init will re-enable it normally if it wants. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
343176120e |
feat: preserve terminal buffer across reconnect (#695)
On disconnect + retry, handleRetry previously called term.reset(), which wipes both the visible screen and the scrollback history — so users lost every bit of context from the previous session the moment they hit "Start Over". Push the current viewport into scrollback via the existing preserveTerminalViewportInScrollback utility, then explicitly disable the modes we actually care about not leaking across sessions (mouse tracking 1000/1002/1003/1006, alt-screen 1049, SGR attributes, hidden cursor) and home the cursor. This keeps the full scrollback intact so users can scroll up to read everything from before the disconnect, while still preventing stale escape-sequence state from bleeding into the new session. Fixes #695 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
1368709f4e |
fix: map scrollback=0 to large value so mouse wheel scrolling works
xterm.js treats scrollback=0 as "no scrollback buffer", which makes hasScrollback return false and converts wheel events into arrow-key sequences. The UI uses 0 to mean "no limit", so map it to 999999 before passing to xterm.js. Closes #689 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
32f4aadab2 |
fix: follow-app-theme now overrides per-host theme settings
When followAppTerminalTheme is on, all terminals should use the UI-matched theme — but three resolution points were still checking per-host overrides: 1. App.tsx resolveTheme() in the activeTerminalTheme computation 2. Terminal.tsx effectiveTheme computation 3. TerminalLayer.tsx focusedThemeId computation Added followAppTerminalTheme prop flowing from App → TerminalLayer → Terminal. When the flag is true, per-host theme resolution is bypassed so all terminals consistently match the app chrome. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
e8b9122270 |
feat: auto-detect network devices from SSH banner and skip stats polling (#680)
* feat: auto-detect network devices from SSH banner and skip stats polling (#674) Fixes rapid AAA session churn reported on Cisco/HPE/similar network devices running Netcatty. The root cause was two separate polls that both open fresh exec channels (each counted as its own AAA session on many network devices): - runDistroDetection() opens a brand new SSH connection every time a host connects to run `cat /etc/os-release || uname -a` - useServerStats polls `conn.exec(statsCommand)` every 5 seconds Both commands fail on non-POSIX CLIs, but the channels still hit AAA. This change avoids both by reading the SSH server identification string that ssh2 already captures during the handshake (`conn._remoteVer`). No extra network round-trips, zero additional AAA entries. ## Changes **sshBridge.cjs** - Store `conn._remoteVer` on the session object at connect time as `session.remoteSshVersion` - New IPC handler `netcatty:ssh:remoteInfo` (`getSessionRemoteInfo`) returning the captured SSH server software string **preload.cjs / global.d.ts / useTerminalBackend.ts** - Thread `getSessionRemoteInfo(sessionId)` through to the renderer **domain/host.ts** - `NETWORK_DEVICE_OPTIONS` constant listing the vendor IDs we can recognize (cisco, juniper, huawei, hpe, mikrotik, fortinet, paloalto, zyxel) - `detectVendorFromSshVersion()` — pure function that parses an SSH server software string and returns a vendor ID or ''. Pattern set is sourced from Nmap nmap-service-probes (authoritative), the ssh-audit software.py reference, and vendor docs; see code comments for the exact matches used. - `classifyDistroId()` returns `linux-like | network-device | other` so features that require a POSIX shell can gate on the result. **createTerminalSessionStarters.ts (runDistroDetection)** - Before running the /etc/os-release probe, call `getSessionRemoteInfo` on the already-connected session and feed the banner into `detectVendorFromSshVersion`. If the vendor maps to a known network device, emit the vendor ID via the existing `onOsDetected` callback and skip the shell probe entirely. For unknown or generic OpenSSH/Dropbear banners the existing behavior is preserved. **Terminal.tsx** - `isSupportedOs` now derives from `classifyDistroId(effectiveDistro)` combined with `host.deviceType !== 'network'`, so neither explicit network-device hosts nor banner-detected ones trigger the stats polling loop. **useServerStats.ts** - Add a consecutive-failure counter. After 3 consecutive failed polls, stop the interval for this session (reset on disconnect / sessionId change / settings toggle). This is the fallback for hosts the banner classifier cannot identify (Juniper JUNOS, Cisco NX-OS, Arista EOS — all present as plain `OpenSSH_*` but do not support the POSIX stats pipeline). **DistroAvatar.tsx / HostDetailsPanel.tsx** - Add 8 network-device vendor icons (Cisco, Juniper, Huawei, HPE, MikroTik, Fortinet, Palo Alto, ZyXEL) alongside the existing Linux distro icons, with brand colors. Icons sourced from Simple Icons (CC0) where available; HPE and ZyXEL use simple abbreviation placeholders. - Network device vendors are added to the manual distro override dropdown so users can pin an icon even if their device has an exotic banner we don't auto-detect. **i18n** - English + Chinese labels for the new vendor options in the Host Details distro selector. Closes #674 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: gate network-device detection on raw host.distro, not manual icon override Per Codex review on PR #680: the stats-polling gate was passing `host` through getEffectiveHostDistro() before classifying, which honors the manual distro override (`distroMode: 'manual'` + `manualDistro`). That meant a user who previously pinned an "ubuntu" icon on a host that later gets banner-detected as Cisco would still be classified as linux-like and keep generating the AAA session flood #674 is meant to eliminate. Separate display from gating: - Display (DistroAvatar, host cards): keeps using getEffectiveHostDistro so users can cosmetically override the icon. - Gating (useServerStats via Terminal.tsx isSupportedOs): reads host.distro directly — the value populated by banner detection — alongside the explicit host.deviceType flag. Manual icon choice can no longer re-enable polling on a detected network device. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: guard distro detection against stale session timers Per Codex review on PR #680: runDistroDetection is scheduled on a 600ms setTimeout after connection and also makes async calls of its own. A quick disconnect + reconnect on the same session slot could fire the old timer against the new session, reading host B's SSH banner via getSessionRemoteInfo and writing host B's vendor onto host A's distro field — wrong icon and wrong stats-polling state. Follow the same pattern already used for the startup-command timer in this file (scheduledSessionId captured at schedule time, checked inside the timer). Capture `id` at schedule time, bail out if ctx.sessionRef.current no longer matches, and re-check after every async await inside runDistroDetection so that a reconnect during the banner fetch or the os-release probe also bails cleanly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address local codex review on PR #680 Addresses three issues found in a local Codex review pass after the remote reviewer gate was flaky: ## P0 — session tokens instead of sessionId for stale-timer guard The previous guard captured `id` returned from startSSHSession and compared against `ctx.sessionRef.current` inside the setTimeout and the async runDistroDetection. But the renderer passes `sessionId: ctx.sessionId` into startSSHSession (see createTerminalSessionStarters.ts:543), meaning a tab reuses the SAME sessionId across disconnect+reconnect. The comparison `T1 === T1` always passed, so the guard was a no-op. Replaced with a module-level Map<sessionId, object> that stores the live "connection token" for each sessionId slot. Each call to startSSH mints a fresh `{}` token and overwrites the entry. Timers and async continuations compare their captured token against the current map value by reference — a reconnect replaces the map entry with a new token, so stale callbacks bail cleanly. ## P1 — run os-release probe on the existing SSH connection The fallback /etc/os-release probe used `execCommand` which creates a brand-new SSHClient() on every call. On network devices that present as plain `OpenSSH_*` and fall through to this step (JUNOS, NX-OS, EOS) it added one extra full-auth AAA session log entry per connect, in addition to the failing stats polls. Added `getSessionDistroInfo(sessionId)` as a new IPC handler that runs the same probe via `session.conn.exec()` — an exec channel on the already-open connection, no new handshake. Plumbed through preload.cjs, global.d.ts, and useTerminalBackend.ts. runDistroDetection uses this instead of execCommand in the fallback path, also removing the unused auth-credentials argument (we are no longer opening a new connection, so no credentials are needed). ## P2.1 — don't re-arm timers after giving up After the consecutive-failure counter trips, useServerStats cleared the interval but a subsequent effect rerun (visibility change, settings tweak, etc.) would schedule a fresh `setTimeout` and `setInterval` that would just call the early-return path forever. The scheduling block now checks `givenUpRef.current` before arming either timer. The flag is still cleared on the normal disconnect / sessionId-change reset path so a reconnect gets a fresh attempt. ## P2.2 — drop the ambiguous IPSSH-* → cisco mapping Nmap's `match ssh m|^SSH-([\d.]+)-IPSSH-` line is labelled as `Cisco/3com IPSSHd` — it cannot identify a specific vendor from the banner alone. Mapping it to `cisco` would risk showing the wrong vendor icon on a 3Com device. Removed the rule entirely and documented why with a code comment; users with such devices can still use the Host Details manual distro override. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address remaining gaps from local codex follow-up review P0 gap — delete connection token on session exit. Previously the map entry lingered after disconnect, so a very late-firing timer could still pass the isConnectionTokenCurrent check even though the session no longer existed. Functionally harmless (the IPC calls would fail) but semantically wrong. Now connectionTokensBySessionId.delete() is called in the onSessionExit handler. P1 new — exec channel leak on timeout in getSessionDistroInfo. The timeout branch resolved the promise but didn't close the stream, so a hanging remote command would leave the exec channel open until the SSH connection itself dropped. Added a settled guard (resolve-once) and stream.close() on timeout. P2.1 gap — givenUpRef not reset on sessionId change. The failure counter reset only happened in the !isConnected branch of the main effect, so a sessionId swap while still connected (rare, but possible if the tab reconnects without toggling connected state) would permanently suppress polling. Added a small dedicated effect that resets both counters when sessionId changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
778b43ceff |
fix: reset mouse tracking on start over to prevent escape sequence leak (#616) (#621)
When "Start Over" reconnects a session, the xterm instance retained mouse tracking modes from the previous session. Mouse movements during reconnection generated SGR mouse sequences (e.g. 35;XX;YYM) that were sent to the new session as visible text input. Fix: disable all mouse tracking modes (?1000l, ?1002l, ?1003l, ?1006l) and reset the terminal before reconnecting. Closes #616 Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
1464cba6da |
feat: add xterm-container class for custom CSS bottom spacing (#614) (#619)
Add a stable .xterm-container CSS class to the terminal container div
so users can adjust bottom spacing via Custom CSS without color
mismatch issues.
Example custom CSS:
.xterm-container { bottom: 10px !important; }
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|
|
d74d9e28a0 |
fix: split shortcut in workspace panes and host delete form freeze (#612) (#618)
* fix: split shortcut in workspace panes and host delete form freeze (#612) Bug 1: Split-pane shortcuts (Ctrl+Shift+D/E) did nothing after the first split because the workspace branch in executeHotkeyAction only logged a message. Now uses workspace.focusedSessionId to split the focused pane. Bug 2: Deleting a host left editingHost state pointing to the removed host, keeping HostDetailsPanel mounted as an overlay that blocked all form interactions. Added a useEffect to close the panel when the edited host is no longer in the hosts array. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Shift+right-click context menu and split content loss (#612) Bug 4: When rightClickBehavior is 'paste' or 'select-word', the context menu was completely disabled with no fallback. Now Shift+Right-Click always opens the context menu regardless of the right-click behavior setting. Bug 5: Splitting a terminal occasionally caused the original pane's content to disappear due to a race between layout reflow and xterm fit(). Added a second delayed fit (350ms) after workspace layout changes as a safety net for cases where the first fit (100ms) runs before the container dimensions have settled. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: guard host-deletion cleanup against unsaved duplicates The cleanup effect that closes the host panel on deletion incorrectly closed it for duplicated/new hosts whose IDs were never in the hosts array. Track known host IDs via ref so the effect only fires when a previously-saved host is actually removed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: check previous host IDs before updating ref in deletion cleanup Merge the two effects into one so the deletion check reads from the previous knownHostIdsRef before overwriting it with the current hosts. Previously both effects ran in the same render cycle, causing the ref to be updated before the check, making it impossible to detect deleted hosts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: open context menu on first Shift+right-click Replace state-based forceMenu approach with always-enabled ContextMenuTrigger. The onContextMenu handler intercepts paste/ select-word actions unless Shift is held, so the Radix context menu opens immediately on the first Shift+Right-Click without needing a second click. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: fallback to first live pane when workspace focus is stale When the focused pane is closed, focusedSessionId may point to a non-existent session. Split shortcuts now fall back to the first session in the workspace tree via collectSessionIds() so the hotkey never silently no-ops. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: validate focusedSessionId against live workspace panes focusedSessionId can be stale (non-null but pointing to a closed pane) after pane closure. Now check it exists in collectSessionIds() before using it, otherwise fall back to the first live pane. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
32b74f4fea |
fix: persist sidebar appearance overrides for quick-connect hosts (#611)
* fix: persist sidebar appearance overrides for quick-connect hosts Quick-connect hosts (id starting with `quick-`) are not in the saved hosts array, so per-host overrides set via the sidebar (fontWeight, theme, fontFamily, fontSize) were silently lost: 1. onUpdateHost only updated existing entries (map), never inserted — change to upsert so quick-connect hosts are added on first override. 2. fontWeight handlers guarded on rawHost from hostMap, which is undefined for quick-connect hosts — fall back to focusedHost. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: only auto-add quick-connect hosts, never re-add deleted saved hosts Restrict the onUpdateHost upsert to quick-connect hosts (id starts with `quick-`). This prevents sidebar appearance changes from silently re-adding a host that was intentionally deleted while its session was still running. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use primary font only in document.fonts.check to fix bold weight fallback document.fonts.check returns false when ANY listed font in the family string is still loading. Our font family strings include a long CJK fallback chain (Sarasa Mono SC, Noto Sans Mono CJK, PingFang SC, etc.) that may not be loaded during early terminal creation. This caused fontWeightBold to incorrectly fall back to the normal fontWeight, making bold text (including shell prompts) render too thin in freshly created terminals while live-updated terminals looked correct. Fix: extract only the primary font family for the check, ignoring the fallback chain that is irrelevant for bold weight availability. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: normalize WebGL fontWeight rendering after terminal connection Work around xterm.js WebGL renderer bug where glyphs rendered via the constructor look visually different from those set dynamically. After the terminal connects and text is on screen, force a fontWeight round-trip (original → normal → original) so the WebGL texture atlas rebuilds through the dynamic path, producing consistent rendering that matches sidebar font weight changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use global settings for quick-connect host appearance changes Quick-connect hosts have ephemeral IDs (quick-${Date.now()}-...) that are never reused across connections. Auto-adding them to the hosts array would accumulate orphaned entries over time. Instead, treat quick-connect hosts like local terminals: sidebar appearance changes (fontWeight, etc.) update the global terminal settings rather than creating per-host overrides. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address code review findings - Apply isFocusedHostEphemeral to theme, fontFamily, fontSize handlers (not just fontWeight) so all appearance changes on ephemeral hosts update global settings - Use hostMap.has() instead of id.startsWith('quick-') to detect ephemeral hosts — saved hosts with quick- prefix are handled correctly - Re-read fontWeight at timer fire time to avoid stale closure - Handle quoted font names with commas in primaryFontFamily parser Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
1e0979e441 |
fix: persist fontWeight in group config save, fix stale closure in font-loading effect
- Add fontWeight/fontWeightOverride to GroupDetailsPanel handleSubmit whitelist - Add effectiveFontWeight to async font-loading effect dependency array Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
9dbd2a5cf7 |
fix: use raw host for font weight save, fix bold fallback to use effective weight
- Font weight change/reset now patches the raw (un-merged) host record instead of writing back the merged host with group defaults baked in - Bold font fallback uses effectiveFontWeight (per-host) instead of global terminalSettings.fontWeight in both update paths Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
702700d93c |
fix: live-sync font weight and scrollbar colors on theme/setting changes
- Font weight now updates on running terminals when slider is adjusted (uses per-host effectiveFontWeight instead of global terminalSettings) - Scrollbar theme colors preserved when switching terminal themes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
4124c03b80 |
fix: maintain scroll position when terminal search bar opens/closes
Re-fit terminal and restore viewport scroll position after search bar toggle to prevent content jumping. Preserves bottom-stick behavior and removes toolbar bottom border for cleaner appearance. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
56a0baebeb |
ui: use accent color for active tab indicator and remove toolbar border
- Active tab top line uses accent/primary color instead of foreground - Remove terminal toolbar bottom border to reduce visual clutter Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
a9e561ee51 |
feat: show "Waiting for remote..." during ZMODEM upload finalization
After all file data is written to the buffer, the progress bar shows 100% but the remote rz is still processing. Now a "finalizing" flag is sent with the last progress event, and the UI displays "Waiting for remote..." instead of the misleading 100% uploading state. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
308d825db7 |
feat: ZMODEM (lrzsz) file transfer support (#579)
* feat: add ZMODEM (lrzsz) file transfer support for terminal sessions Adds ZMODEM protocol detection and file transfer capability to all terminal session types (Local, SSH, Telnet, Mosh, Serial). Uses zmodem.js library with main-process sentry pattern to intercept binary data before string decoding, avoiding IPC pipeline changes. - zmodemHelper.cjs: shared ZMODEM sentry with Electron dialog integration - terminalBridge.cjs: encoding:null for PTY + sentry wrappers for all session types - sshBridge.cjs: sentry wrapper for SSH stream data - preload.cjs + global.d.ts: ZMODEM event IPC bridge and TypeScript types - useZmodemTransfer.ts: React hook for ZMODEM transfer state Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: preserve charset decoding and add ZMODEM progress UI - zmodemHelper: pass raw Buffer to onData, let callers handle decoding - terminalBridge: use StringDecoder for telnet/serial, UTF-8 for local/mosh - sshBridge: restore iconv decoder for SSH session charset support - ZmodemProgressIndicator: floating progress bar with cancel button - Terminal.tsx: wire useZmodemTransfer hook + toast notifications Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: ZMODEM listener cleanup, stream leak, and toast dedup - preload: clean up zmodemListeners on session exit (memory leak) - zmodemHelper: add ws.on('error') handler to close write stream on failure - Terminal: use ref guard to prevent duplicate toast notifications Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address code review findings for ZMODEM - cancel/consume error now send IPC event to renderer (prevents stuck UI) - sanitize download filename with path.basename (path traversal prevention) - add on_detect concurrency guard (deny if transfer already active) - formatBytes: handle negative, zero, and TB+ values safely - closeSession: cancel active ZMODEM before destroying transport Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: prevent double-notification on cancel and stream error resilience - Guard .then()/.catch() in promise chain: skip if cancel() already handled - Download: add writeAborted flag to stop on_input after stream error - Upload: pre-compute file stats to avoid O(N²) statSync calls Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use zsession.abort() instead of close() on dialog cancel close() is only available on Send sessions. Calling it on a Receive session throws, leaving the sentry's internal _zsession dangling and causing subsequent terminal data to be consumed by the abandoned ZMODEM session (terminal freeze). abort() is defined on the base ZmodemSession class and properly fires session_end to reset the sentry. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: handle ZFIN/OO mismatch as successful transfer When sz exits over SSH, the shell prompt often arrives before the ZMODEM "OO" end marker, causing zmodem.js to throw a protocol error. Since ZFIN was already exchanged (= all file data transferred), treat this specific error as a successful completion and forward the shell prompt data back to the terminal via sentry re-consume. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: codex review — UTF-8 decoder, ZFIN abort, session exit cleanup - terminalBridge: use StringDecoder for local/mosh PTY to handle multi-byte UTF-8 split across buffer boundaries (prevents garbled CJK/emoji output) - zmodemHelper: on ZFIN/OO success path, use _on_session_end() instead of abort() to avoid sending CAN (Ctrl-X) bytes to the remote shell - useZmodemTransfer: listen to onSessionExit to reset state when the session dies mid-transfer (prevents stuck progress indicator) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: codex review — file collision handling and stream flush - Download: auto-rename with (1), (2), etc. if file already exists in the target directory, preventing silent overwrite - Download: wait for all write streams to finish flushing before resolving the session_end promise, ensuring data is on disk when the UI reports completion Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: codex review — Windows PTY string compat and Telnet binary safety - Local/Mosh PTY: handle string data from Windows node-pty which ignores encoding: null; convert to Buffer before sentry.consume() - Telnet: bypass IAC negotiation during active ZMODEM transfer to preserve 0xFF bytes in binary data - Telnet writeToRemote: escape 0xFF as 0xFF 0xFF per Telnet spec so ZMODEM binary data is not treated as IAC commands Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: codex review — Windows PTY guard, Telnet IAC, stream cleanup - Local/Mosh: skip ZMODEM sentry on Windows where node-pty can't provide raw bytes; fall back to original string pipeline - Telnet: always run IAC negotiation (even during ZMODEM) since the Telnet layer still escapes 0xFF as IAC IAC; the existing handler already correctly collapses IAC IAC → single 0xFF - Download: destroy un-ended write streams on session_end to prevent hanging promises and leaked file descriptors on abort Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: codex review — early session start, progress throttle, no dup start - Download: call zsession.start() before showing folder picker dialog so lrzsz doesn't time out waiting for ZRINIT - Download: throttle progress IPC to ~10 updates/sec (100ms interval) to avoid overwhelming renderer on fast links - Download: remove duplicate zsession.start() at bottom of Promise Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: handle ZRPOS and prevent terminal flood after ZMODEM abort - Add 500ms cooldown after ZMODEM abort: suppress residual protocol bytes from remote rz/sz that would otherwise flood the terminal - Send 8x CAN (Ctrl-X) on abort/cancel/error to force remote end to stop transmitting even if the initial abort sequence was lost - Handles "Unhandled header: ZRPOS" gracefully (zmodem.js doesn't support error recovery, so abort is the correct response) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: send Ctrl+C after abort in all cancel/error paths Debian's rz stays attached to the TTY after receiving CAN sequences. The cancel() path already sent Ctrl+C via scheduleRemoteInterruptAfterCancel, but dialog-cancel and consume-error paths did not. Now all three abort paths (dialog cancel, consume error, explicit cancel) send Ctrl+C after 150ms to ensure the remote rz/sz process exits and the shell regains control. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add interruptRemote for SSH ZMODEM sentry Pass SSH stream.signal("INT") as interruptRemote callback so the ZMODEM helper can send SIGINT to the remote process when cancelling transfers, complementing the Ctrl+C byte sent via writeToRemote. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: dialog-cancel abort uses module-level helper to avoid ReferenceError sendExtraAbortBytes and writeToRemote are closure-scoped inside createZmodemSentry, not accessible from handleUpload/handleDownload. Extract abortRemoteProcess as a module-level function that takes writeToRemote as a parameter, used in both dialog-cancel paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: dialog cancel throws instead of returning to avoid false complete When user dismisses the file/folder picker, handleUpload/handleDownload now throw "Transfer cancelled" instead of returning normally. This ensures the .catch() handler fires (sending error event) rather than .then() (which would incorrectly send complete event). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: codex review — preserve transferType in progress events - useZmodemTransfer: copy transferType from progress events so the transfer direction is preserved if renderer re-subscribes after the initial detect event was missed - zmodemHelper: clean up upload loop comments (backpressure handled via 64KB chunks + setImmediate yield per iteration) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: codex review — guard stale session cleanup, delete partial downloads - Promise chain .then/.catch/.finally now compare currentZSession identity (=== zsession) instead of truthiness, preventing a new transfer from being clobbered by the old promise settling - Aborted/incomplete downloads are deleted from disk on session_end so users don't end up with corrupt partial files Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: unconditional cooldown suppression after ZMODEM abort The previous cooldown checked if data "looks like residual ZMODEM" which fails for sz's file content (arbitrary printable bytes). Now cooldown unconditionally drops ALL incoming data for 2 seconds after abort, with repeated CAN bursts to ensure the remote sz stops. This prevents the terminal flood seen when cancelling large sz downloads on fast connections. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
945992b80e |
fix: dismiss autocomplete popup on click outside
Closes #572 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
40d80fe535 |
perf: comprehensive UI and state management optimization (#539)
* perf: comprehensive performance optimization across UI and state management - Replace Array.find/includes with Map/Set lookups for O(1) access in hot paths - Add requestAnimationFrame throttling to all mousemove resize handlers - Remove redundant forceUpdate + useSyncExternalStore double subscription - Extract terminal search decoration config to module-level constant - Pause server stats polling and resize handlers for hidden terminals - Add timer cleanup for useEffect/useLayoutEffect with setTimeout - Use useEffectEvent to stabilize effect callbacks and reduce effect re-runs - Use useDeferredValue for QuickSwitcher search input - Batch activeTabStore notifications with microtask coalescing - Memoize sessionLogConfig and activityTrackedSessions to prevent child re-renders - Use ref pattern for stable onTerminalDataCapture callback - Skip TerminalLayer pre-warming when no sessions or workspaces exist Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: flush final resize value before canceling RAF Apply the last computed size synchronously on mouseup/cleanup before canceling the pending requestAnimationFrame. This prevents the final drag delta from being dropped when mouseup fires before the queued frame executes. Addresses review feedback from codex on all 3 RAF-throttled resize handlers: split resize, side panel resize, and SFTP column resize. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: initialize lastClientXRef on resize start to prevent click-collapse Without initialization, a click on the resize handle without dragging would use lastClientXRef=0, computing a large negative diff and collapsing the column to minimum width. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: revert useDeferredValue for QuickSwitcher search useDeferredValue can lag behind the actual input, causing quickResults to reflect a stale query when the user types fast and presses Enter. This is a correctness regression - the selected item may not match the user's intent. The host list is typically small (<200), so synchronous filtering is fast enough without deferral. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: restore runtime activity guard to prevent stale badge on tab switch The pre-filtered activityTrackedSessions reduces subscriptions for disconnected sessions, but removing the runtime shouldMarkSessionActivity check introduced a race: between tab switch and effect re-subscription, old listeners could mark the newly-focused session as unread. Restore the activeTabIdRef.current guard inside the callback as a safety net. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: defer initialConnectDoneRef flag until auto-connect executes Moving the flag inside the setTimeout callback prevents it from being set when the timer is canceled by cleanup. Previously, if the effect re-ran before the setTimeout(0) fired, the timer was cleared but the ref was already true, permanently skipping the initial local connect. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: capture resizingRef fields before setState updater Destructure field/startX/startWidth from the ref upfront so the functional updater closure never reads resizingRef.current after it may have been cleared by handleResizeEnd. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: remove activeTabId from activityTrackedSessions to stabilize subscriptions Depending on activeTabId caused subscriptions to tear down and recreate on every tab switch, resetting the ChunkedEscapeFilter mid-sequence and producing false unread badges. The runtime guard via activeTabIdRef already handles the active-tab check, so pre-filtering only needs to exclude disconnected sessions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: fetch server stats immediately when tab becomes visible again Use hasFetchedRef to distinguish first connect (2s delay for connection stabilization) from tab resume (immediate fetch). Prevents showing stale CPU/memory data for 2 seconds after switching back to a terminal. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: restore cold-start prewarm and reset network stats on tab resume 1. Revert shouldPrewarm guard - TerminalLayer should always prewarm after 1.2s regardless of session/workspace count, as the purpose is to hide lazy-load latency before the user opens their first terminal. 2. Reset netRxSpeed/netTxSpeed to 0 when resuming a hidden terminal tab. The backend computes network throughput as a delta from the previous sample, so the first fetch after a long hidden interval would show artificially low throughput averaged over the gap. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: reset hasFetchedRef on disconnect and preserve built-in theme precedence 1. Clear hasFetchedRef when connection drops so reconnects get the 2s stabilization delay before first stats fetch. 2. Reverse theme merge order in themeById Map so built-in themes are written last and take precedence over custom themes with duplicate IDs, matching the original find() semantics and other resolution sites (customThemeStore.getThemeById, Terminal.tsx). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: also clear per-interface network speeds on tab resume Reset rxSpeed/txSpeed on each netInterfaces entry in addition to the aggregate values, so the network hovercard doesn't show stale throughput while waiting for the first fresh poll after resume. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: reset capture ref on retry and skip warmup for established connections 1. Reset terminalDataCapturedRef in handleRetry() so log capture works for retried sessions (retry doesn't change sessionId, so the effect that resets the ref never re-runs). 2. Track connection start time to skip the 2s warmup delay when a tab becomes visible for a connection that was already established while hidden. Only apply the warmup for truly fresh connections (<2s old). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: prevent overlapping stats requests and track connection time while hidden 1. Add fetchInFlightRef guard to prevent concurrent getServerStats requests that could race and corrupt baseline CPU/network data. 2. Move connectedAtRef initialization before the isVisible check so connections that complete while the tab is hidden record their start time. This ensures the warmup delay is correctly skipped when the tab becomes visible for an already-stable connection. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: reset fetchInFlightRef on disconnect to unblock reconnect stats A pending getServerStats request from a previous connection could keep fetchInFlightRef set, causing the reconnected session's initial fetch to be skipped until the old request timed out. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: clear fetchInFlightRef when tab becomes hidden Ensures the resume fetch isn't blocked by an in-flight request from the previous visible cycle. Any stale response from the old request will be quickly overwritten by the fresh immediate fetch on resume. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use generation counter to invalidate stale stats responses Replace fetchInFlightRef with a generation counter that increments on each fetch. Stale responses from before a hide/show cycle are discarded by comparing the captured generation against the current value, fully preventing pre-hide requests from overwriting zeroed network stats. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: increment fetch generation on effect setup to invalidate in-flight requests The generation was only incremented inside fetchStats, but the resume setTimeout hadn't fired yet when old responses arrived. Incrementing at effect setup time ensures any pre-hide in-flight request is immediately stale, preventing it from overwriting zeroed network stats. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
7df88f5bf7 | fix: keep terminal autocomplete popup off the input line | ||
|
|
23475fb1ce | improve terminal theme preview synchronization | ||
|
|
d3e1a96702 | optimize terminal theme side panel updates | ||
|
|
91fd44cccf | fix terminal autocomplete path and popup behavior | ||
|
|
2d57015ac5 | fix: harden path completion edge cases | ||
|
|
579dab56c2 | fix: tighten path completion popup updates | ||
|
|
f2bcbe5123 |
fix: popup 用 Portal + position:fixed 渲染,不被分屏裁剪
之前 popup 在终端面板内部渲染,分屏时被 overflow:hidden 裁剪, 子面板展开会挤压相邻面板空间。 改为 React Portal 渲染到 document.body: - containerRef 获取终端容器的 getBoundingClientRect - 从相对坐标转换为 viewport 固定坐标 - position: fixed + zIndex: 10000 浮在所有内容之上 - effectiveMaxHeight 根据 viewport 底部剩余空间动态计算 - 移除 overlay div,popup 完全独立于终端 DOM 层级 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
68ab65764e |
feat: 多级级联目录面板 — 支持无限深层展开
重构子目录面板从单个 subDirEntries 改为 subDirPanels 面板栈: - subDirPanels: SubDirPanel[] — 级联面板数组 - subDirFocusLevel: number — 当前焦点层级(-1=主面板) - → 键在任意层级选中目录后展开下一级面板 - ← 键返回上一级(收起当前面板) - ↑↓ 在当前层级导航(同时收起右侧已展开的更深面板) - 已展开但未聚焦的层级用 hover 色标记选中项 - 去掉子面板白色边框 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
14ba1e779c |
fix: 二级菜单白边、深层展开、底部溢出
1. 去掉子面板多余的 borderLeft — sharedBoxStyle 已有完整边框 2. 选择子目录后 50ms 延迟 re-trigger fetchSuggestions, 实现无限深层展开(cd /usr/ → lib/ → → python3/ → ...) 3. overlay 容器和内部 div 设 overflow: visible, 防止子面板在终端底部时被父容器裁剪 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
a96f5c332c |
feat: 目录级联展开 — 选中目录时右侧显示子目录面板
选中一个目录补全项时,自动获取其子目录内容并在右侧展开面板: - ↑↓ 在主面板导航时自动 fetch 目录内容 - → 进入子目录面板(焦点转移到右侧) - ← 返回主面板 - 在子目录面板中 ↑↓ 导航,Enter/Tab/→ 选择并插入 - 选中项带 › 展开指示符 - 子面板带 cursor 颜色左边框标识焦点 - 最多显示 50 个子目录条目 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
ae797e5fb1 |
feat: 远程路径补全 — cd/ls/cat 等命令自动列出文件和目录
通过 SSH exec channel 在远程机器上执行 ls 命令获取目录内容,
在补全菜单中显示文件/目录列表。
实现:
- sshBridge.cjs: 新增 netcatty:ssh:listdir IPC handler,
使用 session.conn.exec() 在独立 channel 执行 ls -1Fap,
不影响交互式终端
- main.cjs: 新增 netcatty:local:listdir,本地终端用 fs.readdir
- preload.cjs: 暴露 listRemoteDir/listLocalDir API
- remotePathCompleter.ts: 路径补全核心模块
- shouldDoPathCompletion: 检测 fig spec template/generators、
PATH_COMMANDS 白名单、或输入以 / ./ ../ ~/ 开头
- resolvePathComponents: 解析目录路径和过滤前缀
- getPathSuggestions: 编排检测→解析→IPC→格式化
- 5 秒 TTL 缓存 + in-flight 请求去重
- completionEngine.ts: SuggestionSource 新增 "path" 类型,
CompletionSuggestion 新增 fileType 字段,
getCompletions 接受 sessionId/protocol/cwd 参数
- AutocompletePopup.tsx: 路径建议显示 📁/📄/🔗 图标
- Terminal.tsx: 传入 protocol 和 getCwd
支持:SSH 远程目录、本地终端、cd 仅显示目录、
空格文件名转义、head -100 限制输出
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|
|
9a7d4decff |
feat: 终端命令自动补全系统 (#527)
* feat: 终端命令自动补全系统 实现类似 WindTerm/Fish 的终端命令自动补全功能,不依赖机器学习: - 历史命令持久化存储:按主机分组,频率+时间衰减排序,跨会话共享 - 前缀匹配引擎:支持精确前缀匹配和模糊匹配(首字符+连续字符+词边界加权) - Prompt 检测器:识别 bash/$、zsh/%、fish/> 等常见 prompt 模式,排除 vim/less 等程序 - Ghost Text 插件:xterm.js 自定义 addon,光标后灰色行内建议,→ 接受全部,Ctrl+→ 接受一词 - 弹出补全菜单:浮动列表 UI,↑↓ 导航,Tab/Enter 选中,Esc 关闭,来源标记(h/c/s/o/a) - @withfig/autocomplete 集成:600+ 命令规范的子命令、选项、参数补全 - 上下文感知:解析命令行 token,根据当前位置提供对应类型的补全 - 用户配置:启用/禁用、Ghost Text、弹出菜单、防抖延迟、最小字符数等 - 快速打字防误触:检测打字速度,快速输入时抑制建议 - 输入防抖 100ms,异步匹配不阻塞 UI Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: 补全菜单混合展示历史命令和 spec 子命令 - 输入已知命令名(如 docker)时即使没有空格也预览子命令 - 历史命令条数从 8 降为 5,留空间给 spec 建议 - 修复 wordIndex === 0 时 spec 补全被跳过的问题 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: 补全菜单在终端底部时向上展开 当光标在终端下方、空间不足时,弹出菜单向上展开(底边对齐光标行), 避免溢出终端区域。列表顺序和选中逻辑不变——最可能的选项始终在顶部, 用户初始向下选择。参考 Termius 的做法。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: 补全菜单跟随终端主题 + Enter 直接执行命令 1. 补全菜单颜色从终端主题动态派生(color-mix),不再硬编码色值, 确保与任何主题视觉一致 2. 在弹出菜单中按 Enter 选择命令时,直接插入并发送 \r 执行, 无需用户再按一次回车 3. Tab/鼠标点击仍然只插入不执行(保留选择后编辑的能力) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: 修复 PR review 发现的全部 20 个问题 功能修复: - #1 修复 selectAndExecute 导致命令双重录入历史:用 suppressNextEnterRecordRef 标志位让 handleInput 的 Enter 分支跳过已经录入过的命令 - #2 修复 Prompt 末尾 $ 误判:重写 findPromptBoundary 为从左到右逐字符扫描, 排除 $HOME/$PATH 等变量引用(检查 $ 前是否有空格、是否在 token 内部) - #6 快速打字检测实际生效:快速打字时 debounce 延迟翻倍(200ms),等用户停顿 - #8 resolveSpecContext 处理带参数的 option(如 --name value): 识别 option 的 args 字段,自动跳过下一个 token - #9 Ghost text 位置随终端滚动/渲染更新:注册 term.onRender 回调 - #13 Escape 键不再拦截 vi-mode:仅在 popup 可见时消费 Escape, ghost text 显示时不拦截(ghost text 是被动的,不应阻止 shell 交互) - #14 所有 setState 统一使用 EMPTY_STATE 常量,不再遗漏 expandUpward 字段 架构修复: - #3 消除 CustomEvent 通信:改为 onAcceptText 回调注入, Terminal.tsx 直接传 writeToSession 回调给 hook, 删除 createXTermRuntime 中约 20 行 listener 代码和 cleanupAutocompleteListener 字段 - #7 xterm 私有 API 访问集中到 xtermUtils.ts:getCellDimensions 统一入口, 带缓存机制,仅在首次访问或 terminal 切换时触发 DOM 测量 - #16 删除 getCommandNameSuggestions 中多余的动态自导入 await import("./figSpecLoader") 性能修复: - #5 合并 ghost text 和 popup 的查询路径:删除独立的 getInlineSuggestion, fetchSuggestions 只调一次 getCompletions,ghost text 取 completions[0] - #10 preloadCommonSpecs 分批加载(每批 8 个,requestIdleCallback 间隔), 延迟 200ms 启动,且检查 enabled 才执行 - #11 scoreEntry 改为 scoreEntryAt(entry, now),now 在查询开始时缓存一次 - #15 scrollIntoView 从 smooth 改为 instant,消除快速导航动画排队 - #19 loadSpec 添加 in-flight 去重(inFlightLoads Map),同一 spec 并发加载只触发一次 import - #20 存储满时淘汰改为按 score 排序后保留前半,而非按插入顺序 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: 修复二审发现的全部 10 个问题 功能修复: - #1(高) insertSuggestion 改用实时 detectPrompt 而非过时的 lastPromptRef, 修复用户继续打字后 Tab 选择建议导致字符重复插入的 bug - #2(中) handleInput Enter 录入历史优先用实时 detectPrompt, 修复快速打字场景下 recordCommand 记录不完整命令 - #9 suppressNextEnterRecordRef 添加 100ms 安全超时清除,防止 flag 残留 - #10 getNextWord 从 index 1 开始搜索分隔符,修复 ghost text 以 / 开头时 一次接受全部而非逐段的问题 性能修复: - #3(中) GhostTextAddon 注册 term.onResize 调用 invalidateCellDimensionCache, 确保 resize/字体变化后 cell 尺寸缓存正确失效 - #4 updatePosition 缓存 lastLeft/lastTop,位置无变化时跳过 DOM 写入; 字体属性移到 show() 中只设置一次,不再每帧写 6 个 style - #5 统一 clearState() 函数替代所有 setState({...EMPTY_STATE}), 带 popupVisible 守卫避免无效 re-render - #6 hasSpec 中 specs.includes() 改为 Set.has(),O(1) 查找 架构修复: - #7 Terminal.tsx 中 autocompleteAcceptTextRef 去掉多余的 useCallback 包装 - #8 删除 AutocompletePopup 的 onClose 死代码 prop Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: popup 默认不选中任何项,用户按 ↑/↓ 后才选中 修复输入 ls 等简单命令时回车误执行联想结果的问题: - selectedIndex 初始为 -1(无选中),Enter 直接执行用户输入的命令 - 用户按 ↑/↓ 导航后 selectedIndex >= 0,此时 Enter 才执行选中的建议 - Tab 仍然可以直接接受第一条建议(主动接受行为) - Enter 无选中时关闭 popup 并让按键透传到终端 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: fig spec 改为从静态资源 fetch 加载,修复生产构建中补全不工作 根因:@vite-ignore 动态 import 在 Electron 生产构建中无法解析 node_modules 路径(app:// 协议只能访问 dist/ 目录)。 修复方案(与 Monaco 编辑器相同的模式): - 新增 scripts/copy-fig-specs.cjs,prebuild 时将全部 739 个 fig spec 从 node_modules/@withfig/autocomplete/build/ 复制到 public/fig-specs/ - Vite 自动将 public/ 内容复制到 dist/,app:// 协议可以正常访问 - figSpecLoader.ts 改用 fetch + Blob URL + dynamic import 加载 spec, 同时保留 @vite-ignore import 作为 fallback(兼容 dev 模式) - public/fig-specs 加入 .gitignore(构建时生成,不进版本控制) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: ESLint 忽略 public/fig-specs 目录(第三方生成代码) 与 public/monaco 相同的处理方式——这些是从 node_modules 复制的 第三方构建产物,不应被项目 ESLint 规则检查。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: 输入完整子命令名时展示其选项(如 git commit 显示 --message 等) 当 currentToken 完全匹配一个子命令时(如 "git commit" 中的 "commit"), 导航进入该子命令并展示其 options 和 sub-subcommands 作为预览。 之前的逻辑因为 name !== currentToken 过滤掉了完全匹配的项, 且 resolveSpecContext 的 consumedTokens 不包含当前 token, 导致停留在父级而看不到子级的选项。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: 修复 fig spec index.js 解析失败导致补全不工作 根因:index.js 格式为 var e=[...],diffVersionedCompletions=[...]; 正则 /var\s+\w+\s*=\s*(\[[\s\S]*?\]);/ 要求 ] 后紧跟 ;, 但第一个数组后面是 , 不是 ;,导致非贪婪匹配跳到第二个 ];, 捕获了两个数组拼在一起,JSON.parse 失败,spec 列表为空。 修复:改用 indexOf 找第一个 [ 和对应的 ],直接截取子串解析。 fig spec 的 index 是简单的字符串平坦数组,无嵌套括号。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: fig spec 改用 URL 直接 dynamic import,移除 fetch+Blob 方案 fetch + Blob URL + import() 方案可能被 Electron CSP 策略阻止。 改为直接用完整 URL 做 dynamic import: - dev: import("http://localhost:5173/fig-specs/git.js") - prod: import("app://./fig-specs/git.js") 两种环境下动态 import 都能正常解析模块,无需 fetch 中间步骤。 同时简化 getAvailableSpecs 也用同样方式,移除 fetch+正则解析。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: fig spec 改为通过 Electron IPC 加载,彻底解决 dev/prod 加载问题 之前的方案(静态文件 + dynamic import / fetch + Blob URL)都因为 Vite dev server 对 .js 文件的模块转换和 Electron CSP 限制而失败。 新方案:通过 main process 的 Node.js require() 加载 fig spec, 通过 IPC 传给 renderer: - main.cjs: 添加 netcatty:figspec:list 和 netcatty:figspec:load handler - preload.cjs: 暴露 listFigSpecs() 和 loadFigSpec() API - figSpecLoader.ts: 通过 window.netcatty bridge 调用 IPC 优势: - main process 直接访问 node_modules,dev 和 production 都可靠 - 无需复制文件到 public/、无需 @vite-ignore hack - spec 数据通过 IPC 序列化传输,无 CSP 限制 - 删除了 scripts/copy-fig-specs.cjs 和 public/fig-specs/ 相关代码 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: main process fig spec 加载改用 import() 替代 require() @withfig/autocomplete 是 ESM 包("type": "module"), CommonJS 的 require() 无法加载 ESM 模块会抛 ERR_REQUIRE_ESM。 改用 dynamic import() 在 async handler 中加载。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: fig spec 加载用 pathToFileURL 绕过 package.json exports 限制 @withfig/autocomplete 的 exports 字段只允许 import "." 和 "./dynamic", Node.js 严格遵守 exports map 拒绝解析 build/git.js 等子路径。 改为手动拼接文件绝对路径 + pathToFileURL 转换为 file:// URL 后 import, 完全绕过 Node.js 的 package exports 限制。 同时修复 promptDetector 不再 trim 尾部空格(用 cursorX 确定实际输入长度), 确保 "git commit " 的尾部空格被保留,触发空 token 显示选项列表。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: 补全菜单添加详情面板 + 清理调试日志 - 选中或悬停补全项时,右侧显示详情面板(类似 VS Code IntelliSense) - 显示完整命令名、来源类型标签(Option/Subcommand/History 等) - 显示完整的描述文本(不再截断) - source 标记移到左侧,与描述分离,更易读 - 悬停和键盘选中都能触发详情面板 - 向上展开时详情面板也正确对齐 - 清理所有临时调试 console.log Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: 清理全部调试日志 移除 autocomplete 模块中所有临时 console.log 调试语句, 仅保留 figSpecLoader 中的 console.warn 用于真实错误报告。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: 三审问题修复 — 移除多余 prop、过滤子路径 spec、防路径遍历 1. 移除 Terminal.tsx 传给 AutocompletePopup 的多余 onClose prop 2. getCommandNameSuggestions 过滤含 / 的 spec 名(aws/s3 等不是直接命令) 3. figspec:load IPC handler 添加 .. 路径遍历检查 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Codex review 5 个问题全部修复 1. [P1] fuzzy 匹配建议不以 userInput 开头时,用 Ctrl+U 清行再写入完整命令, 避免 substring 截断产生损坏的命令行 2. [P2] Ghost addon 初始化改用 polling 等待 termRef,解决首次挂载时 termRef.current 为 null 导致 ghost text 永远不激活的问题 3. [P2] popup overlay 改为 pointer-events-none 透传,仅 popup 自身设 pointer-events: auto,不再阻止终端区域的鼠标交互 4. [P2] getCompletions 异步返回后重新 detectPrompt 校验输入是否已变, 丢弃过时的补全结果避免覆盖新状态 5. [P2] prompt 检测支持折行:当 line.isWrapped 时向上回溯查找 prompt 行, 拼接多行内容作为完整 userInput Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Codex review 第二轮 3 个问题修复 1. [P2] broadcast 模式下 autocomplete 插入也触发广播 — onAcceptText 回调中调用 onBroadcastInputRef 通知其他 session 2. [P2] 支持无尾随空格的 prompt(如 cmd.exe C:\path>)— prompt 字符后允许直接是行尾,boundary 为 i+1 3. [P2] 光标移动 escape 序列(Left/Home/End)清除过时建议 — 不再静默忽略,改为 clearState() 清除 popup 和 ghost text Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Codex review 第三轮 3 个问题修复 1. [P2] commandBufferRef 处理 Ctrl+U 清行 — fuzzy 匹配发送 \x15 时 重置 buffer,避免 onCommandExecuted 记录错误的拼接命令 2. [P2] fetchVersionRef 递增计数器废弃过时异步结果 — clearState/Escape 关闭 popup 时 bump version,getCompletions 返回后检查 version 匹配, 防止已关闭的 popup 被旧请求重新打开 3. [P2] prompt scanLimit 从 80 提高到 200 — 支持包含 git branch、 kube context、长路径的 prompt,超过 80 列不再失效 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Codex review 第四轮 3 个问题修复 1. [P1] 拒绝绝对路径 — figspec:load IPC handler 检查 commandName 不以 / 或 \ 开头,防止 path.join 丢弃前缀导致任意 JS 执行 2. [P1] cmd.exe prompt > 后不要求空格 — 对 > ❯ ➜ › 等 prompt 字符 不强制要求后跟空格,支持 C:\src>dir 格式 3. [P2] serial line mode 下 autocomplete 走 serialLineBufferRef — 在串口 lineMode 时不直接 writeToSession,而是缓冲到 line buffer 并处理 local echo,与正常按键输入行为一致 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Codex review 第五轮 — translateToString(false) 保留尾部空格 translateToString(true) 会 trim 行尾空格,导致 cursorX 截取的 userInput 与实际行内容不一致。改为 translateToString(false) 保留 原始空格,确保 "git commit " 的尾部空格被正确保留用于触发选项补全。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: 设置页添加自动补全开关(启用/Ghost Text/弹出菜单) 在终端设置页末尾新增「自动补全」区域,包含三个开关: - 启用自动补全:总开关 - 行内建议(Ghost Text):光标后灰色建议文本 - 弹出菜单:浮动补全列表 子开关在总开关关闭时 disabled。中英文 i18n 翻译齐全。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Codex review 第六轮 3 个问题修复 1. [P1] 光标不在行尾时禁止补全 — 检测 cursorX 后方是否有字符, 有则 clearState 不显示建议,避免 mid-line 插入导致文本重复 2. [P2] Enter 录入历史改为先尝试实时 detectPrompt,失败则 fallback 到 lastPromptRef 缓存,应对高延迟 SSH 下 buffer 未回显的情况 3. [P2] fuzzy 替换在 Windows host 上用退格清行而非 Ctrl+U — cmd.exe/PowerShell 不支持 Ctrl+U,改为发送 \b 退格序列 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Codex review 第七轮 — commandBuffer 退格处理 + 接受后历史记录 1. [P2] commandBufferRef 处理 \b 退格 — Windows fuzzy 替换用退格 清行时正确移除 buffer 末尾字符,避免记录拼接错误的命令 2. [P3] lastAcceptedCommandRef 追踪接受的补全文本 — Tab/→ 接受后 立即 Enter 时用追踪值录入历史,不依赖可能未回显的 buffer Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Codex review 第八轮 — 历史记录准确性 + 设置同步 1. [P2] 用户继续编辑后清除 lastAcceptedCommandRef — Tab 接受 "git status" 后追加 " --short" 再 Enter 时记录完整编辑后的命令 2. [P2] Ghost text →/Tab 接受路径也设置 lastAcceptedCommandRef — 确保所有接受路径在快速 Enter 时都能准确记录命令 3. [P2] autocomplete 设置加入 SYNCABLE_TERMINAL_KEYS — 跨设备同步时保留自动补全偏好 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Codex review 第九轮 — REPL 误识别 + 本地终端 OS 检测 1. [P1] local terminal 的 hostOs 改用 navigator.platform 检测实际 OS, 避免 Windows 上 fallback 到 "linux" 导致 Ctrl+U 清行失败 2. [P2] 回退 > 无条件接受改动,恢复要求 > 后跟空格或行尾 — 避免 python >>>、mysql>、sqlite> 等 REPL 被误识别为 shell prompt 3. 新增 REPL NON_PROMPT_PATTERNS:>>>(python)和 word>(mysql/redis) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Codex review 第十轮 4 个问题修复 1. [P1] cmd.exe prompt C:\path> — 对 > 特判:前面是 \ 或 / 时允许无空格, 避免误匹配 REPL(python>>>、mysql>)的同时支持 Windows cmd prompt 2. [P2] serial lineMode autocomplete 不再 early return — fall through 到 共享的 commandBuffer/broadcast 更新逻辑 3. [P2] serial 字符模式 + localEcho 时 autocomplete 插入文本也本地回显 4. [P3] 运行时关闭 autocomplete 时调用 clearState() 清除已显示的 popup Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Codex review 第十一轮 — option args、PS2 误识别、bridge 缓存 1. [P2] resolveSpecContext 返回 option 的 args — 当光标在 option 参数 位置时(如 git archive --format |),返回该 option 的 args 而非 subcommand 的 args,使 tar/zip 等枚举值能正确补全 2. [P2] 排除 bare > 作为 shell prompt — bash PS2 续行提示 > 加入 NON_PROMPT_PATTERNS,避免在多行命令续行和 REPL 中误触发补全 3. [P3] bridge 不存在时不缓存 null — preload 时 bridge 可能未就绪, 缓存 null 会永久禁用该命令的 spec 补全 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Codex review 第十二轮 — prompt 检测取最后一个分隔符 Starship/Powerlevel10k 等 prompt 包含多个 prompt 字符 (如 ➜ repo git:(main) $),之前在第一个 ➜ 就停了, 把后续 prompt 文本当成用户输入。 改为收集所有候选 prompt 边界,返回最后一个。确保 "➜ repo git:(main) $ ls" 中 userInput 正确为 "ls"。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Codex review 第十三轮 — prompt 搜索范围限制 + cmd.exe 路径 1. [P2] prompt 扫描限制在行前 60% — 避免 "echo foo > bar" 中的 重定向符 > 被当作 prompt 结束(prompt 不会出现在行尾部分) 2. [P3] cmd.exe 路径检测扩展 — 除了 \ / 前缀,也检测行首是否有 驱动器号 (X:) 模式,支持 C:\Users\me> 等标准 Windows prompt P1 (高延迟 SSH buffer 滞后) 和 P2 (Enter 时 stale prompt) 属于 prompt 检测方案的固有局限,根本解决需要 OSC 133 Shell Integration, 不在本 PR 范围内。已有 lastAcceptedCommandRef fallback 缓解。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
fd938a84e4 |
Merge pull request #485 from yaotiancheng-ola/feature/macos_stats
feat(terminal): support server stats on macOS |
||
|
|
779aa31ef8 |
chore(terminal): clarify server stats scope comment
- update Terminal server-stats comment to reflect Linux/macOS support - no runtime behavior changes |
||
|
|
2c8670a6c6 |
fix(terminal): stop server-stats polling on unsupported OS
- add explicit Linux/macOS guard in server-stats hook - return UNSUPPORTED_OS from ssh bridge when uname is not Linux/Darwin - fail fast when stats payload cannot be parsed to avoid futile polling - wire Terminal to pass supported-OS hint to useServerStats |
||
|
|
04b62f7ba3 |
feat(terminal): support server stats on macOS via remote OS auto-detection
- auto-detect remote OS in sshBridge using uname -s - add macOS stats collection path (CPU, memory, swap, processes, disk, network) - keep existing Linux stats pipeline and parsing logic - remove Linux-only gating in useServerStats and Terminal display logic - show server stats whenever connected (not restricted by host.os) - add CPU hover fallback UI when per-core data is unavailable (e.g. macOS) - update bridge type docs in global.d.ts to reflect cross-OS stats support |
||
|
|
356c27d0fb |
fix: send auto-run Enter outside bracketed paste markers
Codex review caught a P1 regression: when a multi-line snippet had noAutoRun=false, the \r was appended before wrapping in bracketed paste, causing shells to treat the Enter as pasted text instead of a submit action. Now the bracketed paste wraps only the command text, and \r is appended afterward so it is sent as a real keypress. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
ae94e7e529 |
fix: register snippet executor only after terminal is connected
Address Codex review feedback: the snippet executor was registered on mount before the session was ready, causing sidebar snippet clicks to be silently dropped during the connecting/reconnecting window instead of falling through to TerminalLayer's raw writeToSession fallback. Now the executor is only published when status === "connected" and is cleared back to null on disconnect so the fallback path is used for sessions that aren't ready. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
5828503ffc | fix: restore proper snippet paste semantics for sidebar clicks | ||
|
|
196b1f8dbb |
feat: add terminal smooth scrolling setting (#471)
- Add smoothScrolling boolean to TerminalSettings (default: true) - Wire setting to xterm.js smoothScrollDuration (120ms when on, 0 when off) - Add toggle in terminal settings UI - Include in sync payload and i18n strings (en, zh-CN) Inspired by #467 (@crawt). Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
a6af1dffed |
fix: resolve SSH chain connection hang and improve connection progress (#465)
* fix: resolve SSH chain connection hang and improve connection progress - Fix Promise never settling when conn 'close' fires before 'ready' during chain connections, which caused "reply was never sent" error - Replace fake timed progress animation with real backend events - Send granular connection progress for all SSH connections (not just chain), including: connecting, key exchange, auth attempts, forwarding, shell opening - Surface auth method attempts (SSH agent, key names, password) in progress logs so users can diagnose authentication failures - Include error details in progress events for better error visibility Closes #463 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: scope progress events by sessionId, prevent duplicate errors, hide chain UI for direct SSH - Add sessionId to chain progress payload so events are scoped per session (P1) - Set settled=true in error/timeout handlers to prevent close handler from emitting a second misleading 'closed unexpectedly' error (P2) - Only show chain progress UI when total > 1 so direct SSH connections don't render as 'Chain 1/1' (P3) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: mark shell-open failure as settled before closing connection The conn.shell() error branch calls conn.end() which triggers the close handler, but settled was not set yet, causing a duplicate 'closed unexpectedly' error to overwrite the real shell-open failure message. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |