mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-17 13:01:24 +00:00
0e02bbc2fbbd67f92bbc5a99ea81d5e439d84d1d
115
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3e8965f9a9 | Fix pr987 (#1010) | ||
|
|
88732040aa |
fix(terminal): separate prompt after unterminated command output (#987)
* fix(terminal): separate prompt after unterminated command output Add a display-layer prompt line break handler so recognized shell prompts move to the next visual line when the final command output line is not newline terminated. Also add a terminal setting to toggle the behavior, sync support, i18n copy, and focused tests for prompt insertion. * fix review issue * Fix prompt cache initialization * Serialize terminal output writes for prompt breaks * Keep terminal status lines ordered with output * Fix prompt arming without command callback * Keep prompt display breaks out of session logs * Avoid prompt breaks for output suffix matches --------- Co-authored-by: yuzifu <yuzifu@TB16PGen5.Info> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com> |
||
|
|
ff6b4a4625 |
Broadcast pasted terminal input (#927) (#996)
* Broadcast user paste to terminals * Use workspace session id for context paste broadcast * Consume paste broadcast suppression before toggle check |
||
|
|
fb9400a5fb |
fix #984: After running the clear command, the inline session log will be cleared (#990)
Co-authored-by: yuzifu <yuzifu@TB16PGen5.Info> |
||
|
|
84416d04bf |
[codex] Fix issue 957 long paste display (#959)
* Fix long paste display artifacts * Fix serial line mode pasted chunks * Narrow long paste display cleanup scope * Strip only matched paste echo highlights * Honor paste scroll setting through xterm paste |
||
|
|
92ecd84edf |
Fix #939: per-host SSH keepalive override + cloud-friendly defaults (#947)
* fix(ssh): per-host keepalive override + cloud-friendly defaults (#939, #581)
Issues #939 (cloud / Aliyun sessions silently freezing after 15-20 min idle
because no SSH keepalive packets are sent) and #581 (older routers like
NOKIA / ALCATEL being killed by ssh2 after a few unanswered keepalives) are
in direct tension at the global-setting level: cloud users want keepalive
ON, embedded-device users want it OFF, and any single global default hurts
the other group.
Resolves the conflict by moving keepalive to a per-host setting (mirroring
the existing `legacyAlgorithms` per-host pattern), with cloud-friendly
global defaults:
Domain:
- Host gains `keepaliveOverride?: boolean` + `keepaliveInterval?: number`
+ `keepaliveCountMax?: number`. When override is true, the host's
values are used; otherwise the global TerminalSettings values apply.
Per-field fallback so a host can override interval only or countMax only.
- TerminalSettings gains `keepaliveCountMax: number` so the second knob
(number of unanswered keepalives before declaring dead) is no longer
hardcoded at 3 in the bridge.
- DEFAULT_TERMINAL_SETTINGS: keepaliveInterval bumped from 0 to 30, and
keepaliveCountMax = 10. Cloud LBs / NAT tables stay populated; brief
network glitches don't trip the dead-connection check; an actually
dead session is detected within ~5 minutes. Existing users with 0
saved keep their value (no migration) — they were the #581 router
cohort and their setup still works untouched.
Plumbing:
- domain/host.ts adds resolveHostKeepalive(host, globalSettings) with
five unit tests covering both directions of the override flag and
per-field fallback.
- components/terminal/runtime/createTerminalSessionStarters.ts uses the
resolver when building startSSHSession options.
- electron/bridges/sshBridge.cjs reads keepaliveCountMax from options
(defaulting to 10) at both connection sites (direct + jump host) and
still routes interval=0 through to a fully disabled keepalive
(preserving #581's escape hatch).
UI:
- Settings → Terminal → Connection grows a second input next to the
existing interval: "Max unanswered keepalives".
- Host details panel gains a Keepalive section with a "Override global
keepalive" toggle that, when on, exposes per-host interval +
countMax inputs and an inline hint when interval = 0 (explaining
the implications). Same visual pattern as the existing Legacy
Algorithms section.
Sync:
- keepaliveCountMax added to SYNCABLE_TERMINAL_KEYS so the new global
field rides existing sync infrastructure. Per-host fields ride the
hosts array passthrough automatically (older clients receiving them
ignore unknown fields, per the existing lenient sync contract).
i18n: en + zh-CN strings for the new settings row, the host section
header, and the override toggle / inputs / disabled hint.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(ssh): resolve keepalive per jump host, not just the final target
Addresses codex review on PR #947:
https://github.com/binaricat/Netcatty/pull/947#discussion_r3217027xxx
The first cut only resolved keepalive for the final target host and
forwarded a single interval/countMax pair across the whole start-SSH
call. connectThroughChain in sshBridge.cjs then applied that one pair
to every hop, so a chain like:
router (bastion, needs keepalive=0) → cloud target (needs 30s)
would either kill the router (with cloud-friendly defaults) or fail
to keep the target alive (with router-friendly 0). The per-host
override was effectively useless for bastion hosts.
Fix:
- NetcattyJumpHost gains optional keepaliveInterval / keepaliveCountMax.
- createTerminalSessionStarters runs resolveHostKeepalive() per
jumpHost when building the chain, so each hop carries its own
resolved pair.
- sshBridge.cjs's chain connector reads jump.keepaliveInterval /
jump.keepaliveCountMax for each hop, falling back to the call's
target-level options for backward compatibility with older
serializers that don't yet populate the per-hop fields.
The final target's keepalive path is unchanged — it still reads
options.keepaliveInterval / options.keepaliveCountMax that the
session starter resolves from the target host.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(ssh): per-host keepalive for SFTP + port forwarding too
Follow-up to the maintainer review on PR #947 — terminal SSH was the
only path that honored per-host keepalive overrides. SFTP and port
forwarding share the same NetcattyJumpHost type but their builders
weren't resolving keepalive per-hop, and their bridges hardcoded the
old 10s/3 defaults. Net result: a router-as-bastion in a chain still
got killed when reached via the SFTP file panel or a port-forwarding
tunnel, even though the user had toggled per-host override.
Plumbing:
- useSftpHostCredentials / buildSftpHostCredentials: accept optional
terminalSettings; call resolveHostKeepalive() for the target and
each jump entry; emit keepaliveInterval / keepaliveCountMax in the
returned NetcattySSHOptions.
- useSftpConnections + useSftpState + SftpStateOptions thread the
setting down. SftpSidePanel passes the global terminalSettings prop
it already has from TerminalLayer.
- portForwardingService.startPortForward: accepts terminalSettings
as an 8th argument, resolves per-host (target + each jump), and
populates the bridge payload.
- usePortForwardingState.startTunnel and usePortForwardingAutoStart
forward the new parameter; App.tsx supplies terminalSettings (via
a ref in the once-on-launch auto-start effect so changing global
keepalive later doesn't re-fire it).
Bridges:
- sftpBridge.cjs target connect: now also reads keepaliveCountMax
from options (was hardcoded 3). 10s/3 stays as the bridge-level
fallback to preserve the #669 protection when the renderer hasn't
supplied a value.
- sftpBridge.cjs jump hop: reads jump.keepaliveInterval /
jump.keepaliveCountMax, then falls back to the target-call options
(matches the symmetric SSH bridge change).
- portForwardingBridge.cjs: reads keepaliveInterval /
keepaliveCountMax from the IPC payload; same 10s/3 fallback.
Types:
- NetcattyJumpHost already grew keepalive fields earlier; this
commit also adds them to PortForwardOptions so the IPC contract
is explicit.
End-to-end: a chain `[router-as-bastion, cloud-host]` with the
router host's keepaliveOverride=true / interval=0 now correctly
disables keepalive on the router hop for terminal SSH AND SFTP AND
port forwarding, while the cloud target still gets the resolved
30s/10 default for each path.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(ssh): honor explicit keepalive=0 in SFTP + port forwarding bridges
Addresses codex review on PR #947:
- https://github.com/binaricat/Netcatty/pull/947#discussion_r3217448xxx
- https://github.com/binaricat/Netcatty/pull/947#discussion_r3217449xxx
The previous follow-up commit (
|
||
|
|
478e148b40 |
Drop noisy [XTerm] renderer=... boot log
The line printed once per terminal session and offered no diagnostic value beyond what window.__xtermRenderer already exposes for ad-hoc introspection. Keep the detection + retry + window publish; just stop polluting the console. Rename logRenderer → trackRenderer to match the now-narrowed responsibility. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
bce33f34ee | Fix SSH known host verification | ||
|
|
b6c59b9683 |
Merge pull request #924 from bet4it/shift-enter-support
Support Shift+Enter |
||
|
|
ff6b75aba7 | Harden Shift+Enter keyboard support | ||
|
|
2329014e22 | fix: harden SSH key passphrase flows | ||
|
|
5c5ab21b10 | support Shift+Enter | ||
|
|
f1cfce45cf | feat: Enhance SSH key management with reference key support and UI updates | ||
|
|
eb1fd9c127 | Harden Telnet auto-login | ||
|
|
b9ac14f497 | Improve Telnet credential login | ||
|
|
3efc9ada8e |
Fix Windows mosh startup
Fix Windows mosh startup |
||
|
|
72e305fb7a | Add reusable proxy profiles | ||
|
|
8ccefc821c |
[codex] Use dedicated mosh binary repository (#881)
* Use dedicated mosh binary repository * Require bundled mosh client * Auto-fill saved password for mosh SSH handshake * Harden bundled mosh binary flow |
||
|
|
d86c5ed05a |
[codex] Remove mosh client path setting (#878)
* fix(terminal): remove mosh client path setting * fix(terminal): remove stale mosh detection bridge |
||
|
|
a4a5c703b1 | Fix terminal cursor preference handling | ||
|
|
74d56cdcb8 |
[codex] Settings: detect & override mosh client path (#849)
* Add Mosh client detection and override in Settings → Terminal Builds on PR #847 (auto-detection across PATH gaps). Power users with non-standard install locations (containers, custom builds, multiple mosh versions) can now point the app at a specific mosh binary; less technical users get a one-click "Detect" button to confirm where mosh was found, with a Browse fallback for clicker-only flows. Backend (electron/bridges/terminalBridge.cjs): - detectMoshClient() returns { platform, found, path, searchedPaths }. Reuses resolvePosixExecutable; surfaces the searched dirs so the UI can tell users where to look when nothing was found. - pickMoshClient() opens a native file picker via dialog.showOpenDialog. - startMoshSession honors options.moshClientPath when provided. Strict failure: a missing/non-executable explicit path produces a clear error instead of falling back to auto-detect, so users notice typos and stale paths instead of getting silent recovery. UI (components/settings/tabs/SettingsTerminalTab.tsx): - New SettingRow under "Connection" with text input + Detect + Browse buttons, mirroring the localShell validation pattern. Shows inline validation (notFound/isDirectory) and the last detect result with searched directories on miss. Plumbing: - TerminalSettings.moshClientPath: string field with default "" so empty == auto-detect (matches existing PR #847 semantics). - preload exposes detectMoshClient + pickMoshClient. - createTerminalSessionStarters passes terminalSettings.moshClientPath into the IPC call, undefined when blank. - en.ts / zh-CN.ts get the 9 new strings. Verified locally: - vite build succeeds; settings tab renders. - detectMoshClient() against the live machine returns /opt/homebrew/bin/mosh with the expected searchedPaths list. - Existing PR #847 auto-detection path is unchanged when the field is empty. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Skip POSIX execute-bit check for explicit Windows mosh path Address Codex P2 on PR #849 commit |
||
|
|
08e566adb0 |
[codex] Add X11 forwarding support (#835)
* Add X11 forwarding support * Address X11 forwarding review feedback * Handle X11 auth for unix socket display paths * Tighten X11 forwarding compatibility handling |
||
|
|
c58f018d24 |
fix(terminal): preserve selection when typing Space or uppercase letters (closes #819) (#820)
PR #763 captured and restored the mouse selection in a keydown-only microtask. That covers lowercase letters — xterm's _keyDown calls triggerDataEvent synchronously, so the selection is cleared before the microtask drains and the restore runs. Space (keyCode 32) and A–Z (the _keyDown macOS-IME HACK) are instead routed through the keypress event, which fires in a *later* macrotask. The keydown microtask drains first, sees the selection still intact, and no-ops. Then keypress clears it without any restore. Fix: hook both keydown and keypress in attachCustomKeyEventHandler. The keypress path gives us a second microtask that drains after _keyPress has cleared the selection, so the restore actually runs for those keys. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
9bf4aed44f |
fix(autocomplete): stop prepending theme cwd ("~ ") to completed commands (closes #806) (#814)
* fix(autocomplete): honor typed keystrokes when the prompt parser over-captures Closes #806. ## Root cause findPromptBoundary stops at the first "PROMPT_CHAR + space" it sees on the current line. Themes that render additional content after the prompt char — most notably oh-my-zsh robbyrussell's "➜ ~ " where "~" is the cwd — trip it: promptText becomes "➜ ", userInput becomes "~ sudo id". Every consumer downstream treats the theme's cwd marker as part of the user's command, so: 1. recordCommand logs entries like "~ sudo id" into history. 2. fuzzyQueryHistory later returns those polluted entries as suggestions. 3. When the user hits Tab, insertSuggestion compares suggestion.text ("~ ls") against userInput ("~ lo"), falls into the Ctrl-U-plus-rewrite path, and the phantom "~ " ends up on the real command line. The reporter hit this right after `sudo` because sudo's password interaction gave history enough polluted entries to start winning fuzzy matches; without sudo the popup stays empty so the Ctrl-U rewrite path never fires and the bug is invisible. ## Fix Track what the user actually typed in an independent keystroke buffer (typedInputBufferRef) inside the autocomplete hook: - Append every printable char / paste chunk. - Pop on backspace, word-kill on Ctrl+W. - Clear on Enter, Ctrl+C, Ctrl+U, and any escape sequence / unhandled control char (cursor moves we can't follow invalidate the buffer). Introduce reconcilePromptWithTypedInput: if detectPrompt's userInput ends with the typed buffer and is longer, the parser over-captured — move the excess back to promptText so userInput matches what was actually typed. Apply at every detectPrompt call site (fetchSuggestions, the stale-result recheck, insertSuggestion). For Enter-record the typed buffer wins outright when present, but only after a live detectPrompt confirms we're at a shell prompt — otherwise a password-entry Enter would log the password as a command. insertSuggestion / ghost-text accept update the typed buffer to the accepted text so a subsequent Enter records the right command. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(autocomplete): track keystroke-buffer reliability, skip it after cursor moves Codex flagged (#814 P1) that clearing typedInputBufferRef on escape / control sequences and then re-appending printable keys leaves the buffer holding only the post-navigation suffix of the real line. A classic Up-arrow-recall workflow — ↑ to pull "git commit -m fix" out of history, append one char, Enter — would record just that one char as the command, polluting history and skewing future fuzzy matches. Add typedBufferReliableRef as a companion flag: - Reset (reliable=true) on Enter / Ctrl-C / Ctrl-U (zle wipes the line, our buffer is a true view of the empty line again). - Also reset by insertSuggestion and ghost-text right-arrow accept once they write the full accepted text and we re-align the buffer to it. - Cleared (reliable=false) when any escape sequence, unhandled control char (Ctrl-P / Ctrl-N / Ctrl-R / Ctrl-A / Ctrl-E / ...) arrives — those can move the cursor or swap the zle line in ways an append-only buffer can't follow. All four call sites now gate on the flag: - reconcilePromptWithTypedInput receives the buffer only when reliable, so an unreliable buffer never trims the detector's userInput (avoids a symmetric flavor of the original bug where the detector is right and the buffer is wrong). - Enter-record prefers the buffer only when reliable; otherwise it falls straight through to detectPrompt. - The Ctrl+Right (next-word ghost accept) append is skipped when unreliable so we don't seed the buffer with just that word. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(autocomplete): resync typed buffer when sub-dir select rewrites the line Codex flagged (#814 P2) that handleSubDirSelect rewrites the command line via writeToTerminal(Ctrl-U + cmdPrefix + fullPath) but never touches typedInputBufferRef. After the rewrite the buffer still holds whatever was typed before, so pressing Enter records that stale partial input as the executed command — polluting history and steering later suggestions off course. Same commit also routes handleSubDirSelect through reconcilePromptWithTypedInput. The raw detectPrompt would include the robbyrussell "~ " cwd marker in the command prefix it reconstructs, which is the original symmetric #806 bug leaking into this path too. After the rewrite, set the buffer to the newly written command string and flip reliability back on — the terminal line content now matches it exactly, so the next Enter-record does the right thing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(autocomplete): reset typed buffer when a paste chunk carries a newline Codex flagged (#814 P2) that multi-character paste payloads skip the top-of-handleInput Enter guard (which compares data === "\r" exactly), so a paste like "cmd\r" goes through the paste branch and the "\r" gets appended to typedInputBufferRef verbatim. The shell executes "cmd", but our buffer is left holding "cmd\r...", still marked reliable. The next Enter then records whatever combined stale string lives there. Detect line terminators inside multi-char paste chunks: slice from the last \r or \n onward and keep only that tail as the new buffer content (and flip reliability back on, since the tail now matches the shell's zle line). Skip synthesizing recordCommand entries for the flushed intermediate lines — onCommandExecuted in createXTermRuntime already tracks pasted multi-line input independently, so duplicating the logic here would risk double-counting. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(autocomplete): clear lastAcceptedCommandRef on paste-with-newline early return Codex flagged (#814 P2) that the multi-line-paste branch clears the keystroke buffer and bails out before the rest of handleInput runs — including the line that resets lastAcceptedCommandRef. If the user had just accepted a suggestion (Tab / → / popup click), the embedded newline still flushes it in the shell, but our fast-path cache keeps holding it. The next Enter then takes the lastAcceptedCommandRef shortcut and logs that old suggestion as the executed command, polluting history with something the user didn't actually run. Null lastAcceptedCommandRef.current at the same point we reset the typed buffer so the fast path stays aligned with the shell. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(autocomplete): require typed buffer to align with live line before recording Codex flagged (#814 P1) that paste paths which bypass handleInput — the createXTermRuntime hotkey / context-menu / middle-click handlers all call writeToSession(...) directly — leave typedInputBufferRef stale while still marked reliable. A "type prefix → paste remainder → Enter" flow would then record just the keyboard-typed prefix, feeding garbage back into autocomplete ranking. Require alignment: livePrompt.userInput must end with the typed buffer before we trust it. reconcilePromptWithTypedInput already snaps the two together when they *are* aligned — if its endsWith check fails, the buffer is stale (or mid-navigation) and we fall back to livePrompt.userInput instead. That drops the #806 fix for this one paste-bypass case, but the same flow would have hit the same pollution before this PR, so it's a no-regression fallback. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(autocomplete): route out-of-band paste writes through handleInput Codex flagged (#814 P1) that the reconcile path in fetchSuggestions has the same stale-buffer failure mode the Enter-record path now guards against: snippet / keyboard-paste / selection-paste / middle-click-paste handlers in createXTermRuntime call writeToSession directly, so typedInputBufferRef only holds whatever was typed *after* the paste. reconcilePromptWithTypedInput then treats the pasted prefix as prompt text and trims it, completions fetch on the truncated input, and accepting a suggestion rewrites the command incorrectly. Fix at the source: notify the autocomplete hook with the raw (pre-bracket-wrap) bytes at every paste site so its keystroke buffer absorbs them through the same handleInput path keyboard input uses. handleInput's multi-char paste branch already resets / aligns the buffer (and invalidates on embedded escape sequences), so this single extra call per paste site is enough — no new hook API needed. The existing onData-driven notification at line 684 already covers the non-paste keyboard path, and the snippet / paste / pasteSelection / middle-click handlers are the only remaining paths that bypass it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(autocomplete): preserve inner newlines of bracketed-paste input Codex flagged (#814 P2) that the multi-char-paste branch in handleInput drops everything before the last newline, but when bracketed paste is active those newlines are literal input staying on the zle line — not command terminators. A multi-line paste like "cmd1\ncmd2" then left only "cmd2" in typedInputBufferRef and the next Enter recorded / trusted just the tail. Teach handleInput to recognize the bracketed-paste wrapper "\x1b[200~...\x1b[201~" and append the enclosed content verbatim (reliability flag stays on — we know exactly what was added). Matching change in createXTermRuntime: pass the final (possibly bracket-wrapped) bytes to ctx.onAutocompleteInput instead of the raw pre-wrap text so the handle sees the markers when applicable. Non-bracketed pastes still hit the existing newline-split branch so each "\n" resets the buffer to the post-terminator tail. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * refactor(autocomplete): route every prompt consumer through getAlignedPrompt Each Codex round on #814 surfaced one more code path that needed the "consume the keystroke buffer only when it's aligned with the live line" gate: Enter-record, fetchSuggestions (×2), insertSuggestion, handleSubDirSelect, fetchSubDirForIndex. The fixes were correct but the guard ended up spelled three different ways across the file: reconcilePromptWithTypedInput(detectPrompt(term), reliable ? buf : "") plus a separate `userInput.endsWith(buf)` check in the Enter branch. That scatter is exactly how the next out-of-band writer gets missed and regresses #806. Collapse all six sites onto one helper: getAlignedPrompt(term, buffer, reliable) → { prompt, alignedTyped } The helper owns the policy — reliability + endsWith alignment — in one place. Non-aligned buffers fall through as raw detector output (same pre-PR behavior, so the worst case for any future forgotten path is a degrade, not a pollution). Enter-record additionally consumes alignedTyped, which is only non-null when the buffer truly matches the tail, so it can record the clean typed command directly without redoing the endsWith check. No behavior change from the previous commit; this is purely deduplication of the alignment guard. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(autocomplete): inherit reliability on bracketed paste instead of resetting Codex flagged (#814 P1 follow-up) that the bracketed-paste branch unconditionally flipped typedBufferReliableRef back to true. A history-recall-then-paste flow (↑ marks the buffer unreliable, then bracketed paste arrives) would then set reliable=true even though the buffer only contains the pasted tail, not the recalled head. getAlignedPrompt's endsWith check can pass trivially for a short paste tail that happens to equal the last N chars of the recalled line, and Enter would record just the pasted fragment. Reliability is now inherited across a bracketed paste rather than reset: if the buffer was already aligned, appending the paste keeps it aligned; if the buffer was unreliable (post-recall / post-cursor- move), it stays unreliable and the alignment guard in getAlignedPrompt falls through to the raw detector result the way it should. 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> |
||
|
|
484ac5f463 |
Honor CSI 3 J by default; add toggle to preserve scrollback on clear (#761)
* Honor CSI 3 J by default; add toggle to preserve scrollback on `clear` Default `clear` (ncurses ≥ 2013) emits CSI 2 J + CSI 3 J to wipe both visible screen and scrollback. PR #633 unconditionally intercepted CSI 3 J to keep history across `clear`, which broke POSIX semantics — users running standard `clear` could not wipe scrollback at all (#757). Restore the standard behavior as the default and expose a toggle for the iTerm2-style "preserve history" preference (matches what #622 asked for): - domain/models.ts: add `clearWipesScrollback: boolean` (default true) - createXTermRuntime.ts: CSI 3 J handler now reads the setting and only intercepts when the user opts out - SettingsTerminalTab.tsx + i18n: expose the toggle with a description explaining the tradeoff - The right-click "Clear Buffer" menu action keeps its independent semantics (always preserves scrollback) regardless of this setting, since it goes through `clearTerminalViewport`, not the CSI path Closes #757 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix: include clearWipesScrollback in cloud-sync terminal keys Codex review on PR #761 caught that the new toggle was added to TerminalSettings but not to SYNCABLE_TERMINAL_KEYS, so it would never travel across devices via cloud sync — users disabling it on one device would silently get the default back on another after sync. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
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 |
||
|
|
02967d9258 |
fix: do not clear terminal buffer at the top of session starters
Each session starter (startSSH / startTelnet / startMosh / startLocal) called term.clear() as its first step. In xterm.js, clear() wipes the entire buffer including scrollback. On initial connect this is harmless (the buffer is already empty), but on retry it undoes the viewport preservation that handleRetry just performed — so #695 remained broken for any protocol that went through these starters (i.e. all of them). The clear call served no purpose: xterm mounts with an empty buffer and nothing writes to it before the starter runs. Remove the four try/catch(term.clear()) blocks so handleRetry's preserveTerminalViewportInScrollback actually sticks across reconnect on SSH reboots, telnet drops, mosh/local respawns, etc. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
97e78624bb |
fix: remove hardcoded Ctrl+F handler that bypassed configurable shortcuts
The xterm custom key event handler intercepted plain Ctrl+F / Cmd+F to open terminal search, ignoring the user's configured keybinding scheme. This conflicted with zsh's forward-char (Ctrl+F) and gave users no way to disable it via the Shortcuts settings tab. The configurable keybinding system below already routes the searchTerminal action via checkAppShortcut, with defaults of Ctrl+Shift+F (PC) and Cmd+F (Mac). Dropping the hardcoded branch lets the user's settings take effect. Also remove the stale "(Ctrl+F)" label from the toolbar tooltip since the shortcut is configurable and the default on PC is Ctrl+Shift+F. Fixes #694 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> |
||
|
|
76cd1f2883 |
fix: remove unused variables flagged by eslint
- App.tsx: remove unused followAppTerminalTheme/setFollowAppTerminalTheme from destructuring (they flow through settings object, not App props) - createTerminalSessionStarters.ts: remove dead usedKey/usedPassword assignments left over from PR #680 which changed runDistroDetection to use the existing session's connection instead of auth credentials 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> |
||
|
|
890abd1c4c |
Fix/terminal clear preserve scrollback (#633)
* fixd:issure #622 * fix: use baseY instead of viewportY for active screen row count When the user scrolls up to browse history, viewportY differs from baseY (the active screen origin). _core.scroll always operates on the active screen, so counting rows from viewportY preserves the wrong number of lines and may evict older scrollback unexpectedly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use term.clear() for local clear to preserve prompt line The escape sequence \x1b[H\x1b[2J erases the entire display including the current prompt/input line, which is a regression from term.clear() that keeps the prompt as the first visible line. Remote CSI 2 J is already handled separately by the CSI parser handler. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: preserve both scrollback and prompt in local clear term.clear() destroys scrollback (truncates buffer lines). The escape sequence approach erases the prompt. This commit uses _core.scroll to push lines above cursor into scrollback, then clears below the prompt with CSI 0 J and repositions the cursor — preserving both history and the current prompt line. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: panwk <panwk@88.com> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.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> |
||
|
|
0413e02bf0 |
feat: make font weight a per-host setting with override support
- Add fontWeight/fontWeightOverride to Host and GroupConfig interfaces - Add resolve/has/clear helpers in terminalAppearance.ts - Wire per-host font weight through TerminalLayer → ThemeSidePanel - ThemeSidePanel shows "Use Global" button when host overrides weight - createXTermRuntime resolves per-host font weight - Add to INHERITABLE_KEYS for group config inheritance Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
e26f1350f5 |
feat(xterm-6): add scrollbar theming and cleanup log messages
- Add scrollbar slider theme colors derived from foreground color (scrollbarSliderBackground/Hover/Active — new in xterm 6.0) - Update log messages to say 'DOM' instead of 'canvas' Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
d36fc2db1b | fix: use correct unicode version name '15-graphemes' | ||
|
|
32ebc01552 |
feat: upgrade xterm.js to 6.0.0 with all addons
- @xterm/xterm: 5.5.0 → 6.0.0 - @xterm/addon-webgl: 0.18.0 → 0.19.0 - @xterm/addon-fit: 0.10.0 → 0.11.0 - @xterm/addon-search: 0.15.0 → 0.16.0 - @xterm/addon-serialize: 0.13.0 → 0.14.0 - @xterm/addon-web-links: 0.11.0 → 0.12.0 - Replace @xterm/addon-unicode11 with @xterm/addon-unicode-graphemes for more accurate CJK/emoji character width handling - Enable rescaleOverlappingGlyphs for CJK glyph rendering compliance - Replace 'canvas' renderer option with 'dom' (canvas removed in 6.0) - Migrate saved 'canvas' setting to 'dom' automatically - Fixes WebGL glyph atlas corruption causing garbled text (#5278) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
6ac36be04b | feat: local shell selection with auto-discovery (#605) | ||
|
|
8ed1588fdb |
feat: add per-host option for Backspace sends ^H (#604)
* feat: add per-host option for Backspace sends ^H (#602) Add backspaceSendsCtrlH option at host and group level to send ^H (0x08) instead of DEL (0x7F) when pressing Backspace, for legacy system compatibility. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add per-host backspace behavior option (#602) Add backspaceBehavior option at host and group level. When not configured, xterm default behavior is preserved with zero interception. When set to 'ctrl-h', remaps DEL (0x7F) → ^H (0x08) for legacy system compatibility. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use remapped backspace byte for broadcast input Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
3a862cbd0c |
feat: show transport error in disconnect dialog
When a session disconnects due to a transport error (e.g. "Keepalive timeout", "ECONNRESET"), the error message is now surfaced in the disconnect dialog instead of showing a generic "Disconnected" label. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
262bc57a21 |
feat: enable Unicode 11 for improved Nerd Fonts rendering (#545)
Load @xterm/addon-unicode11 and set activeVersion to '11' for better character width handling of Nerd Fonts, Powerline glyphs, and CJK characters. This matches the approach used by tabby terminal. Closes #543 (Nerd Fonts portion) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
9563ae9dcc |
Revert "feat: enable Unicode 11 for improved Nerd Fonts rendering"
This reverts commit
|
||
|
|
349b215d3d |
feat: enable Unicode 11 for improved Nerd Fonts rendering
Load @xterm/addon-unicode11 and set activeVersion to '11' for better character width handling of Nerd Fonts, Powerline glyphs, and CJK characters. This matches the approach used by tabby terminal. Closes #543 (Nerd Fonts portion) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
c3224d30c6 |
feat: network device mode for SSH + serial charset encoding support (#540)
* feat: add deviceType field to Host model for network device support Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: pass deviceType through session metadata pipeline Thread deviceType from Host model through AITerminalSessionInfo, IPC types, and mcpServerBridge so AI agents can inspect device type per session. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: route network device SSH sessions to raw PTY execution When deviceType === 'network', handleExec now uses execViaRawPty instead of execViaPty so vendor CLIs (Huawei VRP, Cisco IOS, etc.) receive commands as-is without POSIX shell wrapping or markers. The command blocklist is also skipped for network devices, consistent with the existing serial session bypass. AI context description updated to document the raw-execution behaviour for network device sessions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: add network device mode toggle to host settings UI Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add network device awareness to Catty Agent system prompt Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: extend network device mode to Catty Agent exec path and host context - Add network device detection and raw execution routing to aiBridge.cjs (the primary Catty Agent command path), not just the MCP bridge - Export getSessionMeta from mcpServerBridge for reuse in aiBridge - Surface deviceType in Catty Agent system prompt host list so the AI can identify which sessions are network devices - Pass deviceType through buildSystemPrompt context Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: exempt network device sessions from client-side blocklist and update ACP context - Add deviceType to ExecutorContext sessions type - Skip renderer-side command blocklist for deviceType=network sessions in shared toolExecutors.ts (not just main-process side) - Update ACP agent context hint to mention network device sessions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: only show network device mode toggle for SSH hosts Telnet and local hosts don't support the network device execution path, so hiding the toggle prevents users from enabling a broken configuration. Serial hosts already use raw mode by default. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: exclude Mosh sessions from network device raw execution path Mosh uses a shell-backed PTY and cannot connect to vendor CLIs, so network device mode should only apply to SSH and serial sessions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: prefer session.protocol over metadata for Mosh detection Mosh tabs report protocol:"ssh" in renderer metadata but "mosh" in the main-process session object. Prioritize session.protocol (runtime truth) to correctly exclude Mosh from network device raw execution. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: suppress deviceType metadata for Mosh sessions Mosh requires a shell-backed PTY and cannot connect to vendor CLIs, so omit deviceType from AI-facing metadata when session is Mosh-backed. This prevents the AI from being told to use vendor CLI syntax when the actual execution path uses normal shell wrapping. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use exit code 0 for network device sessions and hide toggle for Mosh - Network device / serial sessions return exitCode: null from vendor CLIs. Default to 0 instead of -1 so the AI doesn't misinterpret successful commands as failures. - Hide the network device mode toggle when Mosh is enabled, since the setting is suppressed at runtime for Mosh sessions anyway. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: preserve null exit codes and restrict raw mode to SSH/serial - Preserve exitCode: null for network device sessions instead of coercing to 0, so the AI knows exit status is unavailable rather than seeing a misleading success code. - Explicitly whitelist SSH/serial protocols for network device mode instead of just excluding mosh, preventing local/telnet sessions from accidentally entering raw execution. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use UTF-8 encoding for SSH network device raw execution execViaRawPty hardcodes latin1 for serial port data decoding. Add an encoding option (default: latin1) and pass utf8 from SSH network device call sites so multi-byte characters aren't corrupted. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use host charset for serial port decoding instead of hardcoded latin1 - Extract charsetToNodeEncoding() to module scope in terminalBridge - Serial sessions now read options.charset (from Host.charset) for both terminal display decoding and AI command output - Store serialEncoding on session object so exec paths can use it - Pass encoding through all execViaRawPty call sites - Default encoding changed from latin1 to utf8 (matches most modern network equipment and is the safer default for CJK environments) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: move serialEncoding declaration before session object creation serialEncoding was referenced in the session object literal before its const declaration, causing a TDZ ReferenceError that would crash every serial connection. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: tighten isNetworkDevice logic and clean up edge cases - Align toolExecutors isNetworkDevice check with bridge logic: require explicit SSH/serial protocol match instead of trusting deviceType alone - Remove empty-string protocol match from isSshOrSerial in both bridges to prevent local/unknown sessions from being treated as network devices - Widen exitCode return type to `number | null` to match actual behavior - Clear deviceType when enabling Mosh (incompatible combination) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: update MCP server tool descriptions for network device sessions The get_environment and terminal_execute tool descriptions only mentioned serial/raw sessions for network devices. Updated to also reference deviceType: network SSH sessions so external AI agents (Claude, Codex) know about the new execution mode. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: include deviceType in get_environment and guard execViaChannel fallback - Add deviceType to executeWorkspaceGetInfo session mapping and return type so Catty Agent's get_environment tool matches MCP bridge output - Guard both aiBridge and mcpServerBridge against falling through to execViaChannel for network device sessions — network devices require an interactive PTY and exec channels would produce broken behavior Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add charset setting to serial host configuration UI Serial hosts now have a charset input in the Advanced section, defaulting to UTF-8. The value is saved to Host.charset and used by the serial decoder in terminalBridge. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add charset to serial quick-connect modal with full pipeline - Add charset input to SerialConnectModal (Advanced section) - Thread charset through onConnect callback → handleConnectSerial → createSerialSession → TerminalSession.charset - Add charset field to TerminalSession interface - Include charset in fallback host builder for quick-connect sessions so createTerminalSessionStarters can pass it to startSerialSession - Saved hosts also store charset via onSaveHost Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: constrain serial connect modal height with scrollable content Modal content could overflow the viewport when Advanced section was expanded. Add max-h-[85vh] to DialogContent with flex layout so the content area scrolls while header and footer buttons stay visible. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: propagate charset through all serial session creation paths - Add charset to startSerialSession type in global.d.ts - Copy host.charset to TerminalSession in connectToHost serial path - Copy host.charset in createWorkspaceWithHosts serial path - Propagate session.charset in splitSession (both workspace and standalone) - Propagate session.charset in copySession Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: propagate charset in remaining session creation paths Add host.charset to connectToHost (non-serial), createWorkspaceWithHosts (non-serial), and runSnippet session creation for consistency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- 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> |
||
|
|
6b1d9ee409 | Gate jump-proxy checks on usable endpoints | ||
|
|
c0c0378df0 | Ignore incomplete jump-host proxy configs | ||
|
|
093951150c | Only validate first-hop jump proxies | ||
|
|
a0418039c4 | Prefer jump-host proxy over target proxy guards |