mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-25 09:51:28 +00:00
a1ca1a3443e62ca1157d99f00a41ddf1bcfeb95c
142
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0d6fc5f7f7 | fix(update): recover failed Linux installs | ||
|
|
cc5ad3be16 |
perf: isolate Terminal hot props, cut memory/jank, and repay architecture debt (#2790)
* refactor: migrate architecture-debt hooks into application/state Move SFTP Wave A stores/hooks and related vault/AI/terminal/systemManager hooks out of components into application/state, update importers, and keep thin deprecated re-exports at the old paths. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * refactor(sftp): align local bookmarks store API with global bookmarks Export subscribe/get/set/rehydrate helpers from localSftpBookmarks to match the globalSftpBookmarks external-store pattern. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(electron): reduce baseline memory via spellcheck/GPU/prewarm guards Disable spellcheck on BrowserWindows and the default session, drop spare renderers, gate aggressive GPU switches behind NETCATTY_COMPAT_GPU, and make settings prewarm opt-in via NETCATTY_PREWARM_SETTINGS. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * Isolate notes and customAccent from TerminalLayer hot props Route vault notes through notesStore (shellHistoryStore pattern) and app accent through appearanceChromeStore so note edits and accent-drag ticks no longer rebuild TerminalLayer. Notes/AI slots and Terminal leaves subscribe locally; VaultView and open-note callbacks stay unchanged. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(ui): cut unnecessary AppView/VaultView/settings re-renders Stabilize TopTabs close handler, memo AppHostTreeLayer, exclude accent from settingsVersion, ignore connectionLogs off the logs section, share lastConnected host refs, and keep rename dialog drafts local so chrome domain stays stable. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * chore: package size, dead code, and consolidation cleanup Remove unused direct deps, exclude Vite-bundled renderer packages from electron-builder, delete high-confidence dead code/no-op transfer warm wiring, consolidate cloud provider IDs and KnownHost/SFTP helpers, and land UI/AGENTS quick wins (rAF text batching, notes draft debounce, streaming plain text, tempDirBridge, diagnostics adapter, External MCP setters). Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: stabilize rAF text batching and diagnostics tests Polyfill requestAnimationFrame for Node, flush pending text before steer buffering, bypass rAF while steer is in flight, and stub global localStorage for AI panel diagnostics adapter tests. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: correct import paths after application/state hook migrations Migrated vault/AI/system hooks still used components/-relative imports; point them at repo-root domain/components/types/lib instead. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: address Bugbot/Codex regressions from perf cleanup - Keep blank Enter from closing RenameDraftDialog; only reset rename state after a non-empty submit - Flush note drafts before vault mutations so pending title/body edits are not overwritten - Re-apply appearanceChromeStore accent on appearanceTheme in Terminal, and keep layer themes unaccented Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(notes): flush draft before markdown export paths Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: keep editor-close hotkey ref fresh during render Assign handleRequestCloseEditorTabRef in render instead of useEffect so Cmd/Ctrl+W never hits the App stub before the effect runs. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: keep accent in chrome themes without TerminalLayer thrash Restore accent in globalAppearance for chrome/injection consumers. Keep resolveFocusedAppearance identity stable across accent drag via accent ref, while Terminal leaf still re-applies appearanceChromeStore. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: keep compose chrome accent live and merge note renames Subscribe theme-panel focusedAppearance to appearanceChromeStore so compose-bar chrome updates during color-picker drag even when resolveFocusedAppearance identity stays stable. Tree renames now merge title into the post-flush note instead of replacing from a stale row. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: clear terminal accent when switching back to theme mode Re-resolve appearanceTheme by catalog id before applyCustomAccent so a stale baked custom cursor/selection cannot stick after accentMode returns to theme while TerminalLayer memo ignores accent props. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: register unsaved prompt singleton during render AppView close handlers call promptUnsavedChanges outside the old render-prop. Assign the singleton during render so Cmd/Ctrl+W and tab close never hit the pre-effect null window that auto-cancels. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: keep vault import hooks UI-free and flush notes on teardown Move ImportOptions into application/state and inject a notifier so useVaultImportHandlers no longer imports components. Notes drafts also flush on pagehide/beforeunload when Electron tears down without React unmount. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: move AI terminal session context builders into domain buildAITerminalSessionInfo and AIPanelContext now live under domain/ so application hooks no longer import TerminalLayerSupport and create a UI → application → UI cycle. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: drop duplicate AIPanelContext type from TerminalLayerSupport The type is re-exported from domain; the local definition conflicted. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: keep migrated state hooks free of UI-layer imports Move aiChatStreamingSupport into infrastructure/ai and poll list helpers into domain/systemManager so useAIChatStreaming / useSystemManager no longer import from components. Leave thin re-exports at the old paths. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: move remaining migrated-hook deps out of components Host-key verification types/helpers now live in domain/, and SFTP column layout types live in application/state/sftp/columnLayout. Application hooks no longer import those definitions from the UI layer. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix: clear lint blockers and flush notes when panels hide Move AI panel diagnostics persistence into application/state so components stop importing localStorageAdapter. Flush note drafts when retained NotesManager mounts become inactive, and silence related lint warnings in theme/host-key helpers. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(notes): publish notesStore sync on vault note updates updateNotes/updateNoteGroups now publishNotesSnapshot immediately so AI/notes consumers do not briefly read a stale catalog after a hide flush. Flush inactive drafts in useLayoutEffect before paint. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> |
||
|
|
1289383169 |
fix(windows): track dev appArgs in Explorer menu warm-start identity
Persist and compare development app entry args so moving a checkout re-registers Explorer shell commands instead of keeping a stale electron.exe + old app path launch line. |
||
|
|
3dfb100c50 |
fix(windows): probe default-off without preference and fix dev shell cmds
Record a separate probe marker for ZIP/portable no-verb defaults so a shared AppData profile cannot suppress a later NSIS install. Register development Explorer verbs as electron.exe + absolute app entry. |
||
|
|
b7359fefa6 |
fix(windows): re-register Explorer menu when portable path moves
Persist the last-applied executablePath in the preference record and re-apply shell verbs when it differs from the current launcher path so renamed/moved portable builds keep Open-in-Netcatty working. |
||
|
|
b4d40ab67a |
fix(windows): register portable launcher path for Explorer menu
Codex P2 on #2671: electron-builder portable apps expose the stable launcher via PORTABLE_EXECUTABLE_FILE while process.execPath points at a temp unpack that is deleted on exit. Resolve that path for shell verbs and bump the preference schema so existing installs re-register once. |
||
|
|
61281d79d8 |
fix(windows): toggle Explorer Open-in-Netcatty menu and harden launch
Add a Settings > System switch to enable/disable the Explorer folder context menu, and fix shell launch so Chromium does not swallow --open-terminal-path (args after --, =path form, trailing-dot roots). Closes #2651 Closes #2655 |
||
|
|
3f706abfeb |
feat(ssh): unify transport leases and converge transfer keep-alive
Introduce a main-process SSH transport registry (borrow/return leases, ControlPersist-style idle park) shared by shell, SFTP, transfer, and port-forward. Transfer pool becomes channel concurrency only; remove the separate transfer-pool idle TTL UI in favor of a single SSH keep-alive setting. Register dedicated SFTP dials, reuse parked transports, and fix TTL 0 (park until quit), jump-host endpoint keys, and remote unforwardIn. |
||
|
|
a1e7fdf1e2 | feat(windows): support portable data directory | ||
|
|
7a47187e37 |
feat(plugins): add isolated plugin host runtime (#2303)
* feat(plugins): add isolated plugin host runtime * test(plugins): build runtime dependencies before tests * fix(plugins): harden runtime lifecycle and recovery * fix(plugins): harden runtime extension boundaries * fix(plugins): enforce runtime integrity boundaries * fix(plugins): await utility process exit * fix(plugins): harden utility process containment * fix(plugins): close runtime recovery gaps * fix(plugins): harden runtime lifecycle boundaries |
||
|
|
1a426c4d07 | Fix macOS Dock icon sizing (#2098) | ||
|
|
c02848bb08 |
Add app-level HTTP(S) proxy for cloud sync and AI.
Lets Windows users (and others) route Google Drive / OneDrive / GitHub sync and AI provider traffic through system or custom proxies without touching SSH ProxyJump settings. Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
4e2bd5f783 |
Fix main window focus stealing (#2008)
* Fix main window focus steal * Address focus recovery review findings |
||
|
|
e27a626b8d | [codex] Reuse main window for deep links (#1990) | ||
|
|
1d91c8fbf4 |
[codex] Add telnet URL deep link support (#1988)
* Add telnet URL deep link support * Fix telnet deep link review issues * Keep ssh deep links independent from telnet registration * Address Codex telnet deep link feedback |
||
|
|
f08ca1c08a |
Support JumpServer jms:// client launch links (#1965) (#1976)
* Support JumpServer jms:// client launch links Register Netcatty as an optional jms:// protocol handler (opt-in, default off to avoid conflicting with the official JumpServer client). SSH/SFTP connection payloads decode to an ephemeral host that connects to the JumpServer gateway with the one-time connection token, without saving anything to the vault. Fixes #1958 * Mark jms deep link hosts as ephemeral for session restore exclusion * Open the SFTP side panel for JumpServer sftp launch links jms:// payloads with protocol "sftp" previously landed in a plain shell. Mark the ephemeral host with an autoOpenSftpPanel hint that the session factory forwards as autoOpenSidePanel, and let TerminalLayer open the SFTP side panel for that session once it connects. * Support JumpServer telnet deep links * Keep JumpServer telnet links on SSH gateway --------- Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
34c3c5beca |
[codex] Add Finder folder open terminal support (#1973)
* Add Finder folder open terminal support * Fix Finder terminal path review findings |
||
|
|
94e359f6d7 |
[codex] Add macOS Dock new connection menu (#1935)
* Add macOS Dock new connection menu * Fix Dock menu window readiness * Wait for renderer before Dock menu delivery * Queue Dock host connects until vault ready |
||
|
|
b299d34a6c | merge main into cursor/ca1c24b6 | ||
|
|
7cba6bae2a |
feat(settings): add runtime Dock/taskbar icon variants (#1716)
Let users pick icon styles in Appearance settings with live Dock/window updates, dev public asset resolution, and cross-window sync. Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
f95cc754e7 |
fix(windows): restore main-window input focus on show/hide hotkey (#1722)
Route global hotkey/tray show paths through restoreWindowInputFocus, recover renderer focus on visibility/show, dismiss transient overlays before native hide, and cancel deferred focus callbacks on hide. Closes #1722 |
||
|
|
affe197f26 | Improve Netcatty responsiveness | ||
|
|
f95cf73ca4 | Fix ssh deep link edge cases | ||
|
|
eb1a39dbc2 | Add ssh deep link setting | ||
|
|
feb6f60db2 | Support ssh deep links | ||
|
|
a815e7d2e5 | fix: guard hidden restore windows | ||
|
|
d9334a8e73 | fix: harden session restore isolation | ||
|
|
babe06a944 |
Fix local debug launch
Fix local debug launch |
||
|
|
29a6172120 |
Add duplicate tab to new window
Adds a tab context menu action to duplicate a terminal into an independent peer window, with per-window active-tab titles and multi-window lifecycle safeguards. |
||
|
|
8376e35022 |
fix: macOS 自动更新装不上(进程退不掉) (#1224)
* fix(auto-update): commit app to quit before quitAndInstall on macOS (#1215) macOS in-place auto-update downloaded and unpacked the new version but never installed it: the app appeared to close, ShipIt never ran, and no restart happened. A full uninstall + reinstall did not help; only a manual DMG replace worked. Root cause is a code-level coordination bug, not the release pipeline. The published mac zips are correctly Developer-ID signed, notarized, and stapled (Team H7WS5L2ML4, consistent across 1.1.17 and 1.1.20), and latest-mac.yml is well-formed — so Squirrel.Mac signature validation passes. The failure is that quitAndInstall() drives app.quit() while two normal-quit behaviors keep the process alive: 1. the main-window close handler hides to tray when close-to-tray is enabled (it only closes when isQuitting is true), and 2. the before-quit dirty-editor guard preventDefault()s the quit for a 5s renderer round-trip. Either keeps the parent process running, so Squirrel.Mac's ShipIt helper — which waits on the parent PID to die before swapping the bundle — lands in launchd "pending spawn / on-demand-only" limbo and the service is removed without installing. This matches the reporter's diagnosis exactly ("ShipIt 没有真正启动安装器", launchd on-demand-only). Fix: before quitAndInstall fires app.quit(), mark the app as quitting for an update via windowManager.setQuittingForUpdate(true). That sets isQuitting (bypassing close-to-tray) and the before-quit handler now returns early when isQuittingForUpdate() is true (skipping the dirty-editor round-trip), so the process exits cleanly and ShipIt can run. The same fix also covers the latent Windows NSIS case where close-to-tray would block an in-place update. If the install never actually quits the app (quitAndInstall throws, or returns without app.quit() on a Squirrel follow-up error / stale download), the quitting-for-update flags are rolled back — synchronously on throw, and via a short unref'd watchdog otherwise — so the app does not get stuck permanently bypassing close-to-tray and the quit guard. Tests: unit tests for the new windowManager flags and for the install handler — ordering (setQuittingForUpdate before quitAndInstall), tray cleanup still runs, no-op when the updater fails to load, rollback on synchronous throw, and watchdog rollback when the app never quits. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(auto-update): keep dirty-editor guard during update install setQuittingForUpdate only bypasses close-to-tray (so the window actually closes and Squirrel.Mac's ShipIt can swap the bundle); it must NOT skip the unsaved-work guard, or clicking "Restart Now" with a dirty SFTP editor would silently lose edits. If the user cancels to save, the quit aborts and autoUpdateBridge's watchdog clears the quitting-for-update flags. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(auto-update): clear update-quit state when the quit is cancelled When the user clicks "Restart Now" with a dirty editor open, the before-quit guard cancels the quit (settle "stay"). The update path had already called setQuittingForUpdate(true) (which flips isQuitting=true to bypass close-to-tray for the install), so without clearing it the app stays in a quitting state — close-to-tray and other !isQuitting-gated behavior bypassed — until the 10s watchdog fires. Clear it immediately on the cancelled-quit path (#1215 review). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(auto-update): check for unsaved editors before quitAndInstall (#1215) The previous fix bypassed close-to-tray so the app process actually exits and Squirrel.Mac's ShipIt can swap the bundle, while keeping the before-quit dirty-editor guard as the unsaved-work safety net. But on macOS that net has a hole: quitAndInstall() closes the window FIRST and only then fires before-quit. Once setQuittingForUpdate(true) lets the main window truly close (instead of hiding to tray), the before-quit guard can run after the window is already gone — isReachableByUser is false, so it commits the quit and silently drops unsaved SFTP edits. Fix: move the dirty-editor check to the moment the user clicks "Restart Now", in the install handler, BEFORE setQuittingForUpdate / quitAndInstall — while the window and renderer are still alive: - dirty -> abort the install (don't set the quitting flags, don't quitAndInstall) and broadcast netcatty:update:needs-save so the renderer prompts the user to save and retry. - clean -> proceed with the existing flow (commit-to-quit, tray cleanup, quitAndInstall, watchdog). - no reachable main window / crashed renderer -> install directly (no user to ask), matching the before-quit fail-open path. The before-quit dirty guard is kept as defense-in-depth: if the window is still reachable it re-checks (clean, since we just verified), and if it's already gone it lets the quit through — which is now safe because the install handler already confirmed there were no unsaved editors. The request/reply/timeout round-trip is extracted into a shared helper, electron/bridges/dirtyEditorGuard.cjs (queryDirtyEditors), so the install handler and main.cjs's before-quit guard use one implementation. main.cjs's before-quit is refactored onto it (behavior preserved: sender-filtered reply, fail-open timeout, and the setQuittingForUpdate(false) rollback when the user cancels to save). The needs-save notice is BROADCAST to every window, not just the queried main window: "Restart to Update" can be clicked from the Settings window, which would otherwise see the click do nothing. preload exposes onUpdateNeedsSave; the subscription lives in useUpdateCheck (state layer), and both consumers — App.tsx (main window) and SettingsPage (settings window) — pass an onNeedsSave callback that shows an actionable toast ("save your editors, then click Restart Now again") in en / zh-CN / ru. Also lengthen the quitting-for-update rollback watchdog from 10s to 60s. On macOS quitAndInstall() can return while Squirrel is still pulling the downloaded ZIP from the local update server before it closes the windows; on a large/slow update that can exceed 10s. Clearing isQuitting that early would let the eventual native quit hit a non-quitting close-to-tray handler and strand the install again — the exact #1215 failure. The longer window only fires when the app is realistically stuck, at the cost of close-to-tray staying bypassed a little longer in the rare genuine-failure case. Tests: queryDirtyEditors (result / no-dirty / timeout / wrong-sender / dead or crashed webContents / send-throws / no-ipcMain paths); install handler pre-check (dirty -> no quitAndInstall + needs-save broadcast to all windows; clean -> quitAndInstall runs; no main window -> installs without asking). Existing install-handler tests updated for the now-async handler. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> |
||
|
|
429cb8d6e9 | fix: keep macOS Dock icon consistent with bundle icon (#1166) | ||
|
|
1fec5925eb | Refactor large modules and fix runtime errors (#1136) | ||
|
|
3c100b0ae2 |
fix #1035: support diffie-hellman-group1-sha1 under BoringSSL (#1039)
Electron's BoringSSL dropped several standard MODP groups from the named
crypto.createDiffieHellmanGroup() API — notably the 1024-bit Oakley Group 2
(modp2) that backs SSH's diffie-hellman-group1-sha1. ssh2 calls
createDiffieHellmanGroup('modp2') for that kex, so connecting to legacy
network devices that only speak group1-sha1 failed with "Error: Unknown DH
group".
The underlying DH math still works on BoringSSL via createDiffieHellman()
with an explicit prime, so add a compatibility shim that wraps
createDiffieHellmanGroup and falls back to the well-known prime constants
when (and only when) the runtime can't resolve a group by name. On OpenSSL
builds the original call succeeds and the fallback is never used.
The shim is installed in main.cjs before any ssh2-using bridge loads, since
ssh2 destructures createDiffieHellmanGroup at module load. Once installed,
the existing legacy-group probe detects modp2 as supported again and offers
group1-sha1, so affected devices actually connect (still gated behind the
per-host legacy-algorithms toggle).
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|
|
5b2a048917 | Add transfer target path actions (#997) | ||
|
|
c9da2a5893 |
Sync AI/UI settings and fix multi-display settings window
Extend cloud sync to cover AI provider config, external agents, permission/tool modes, command policy, web search settings, workspace focus style, terminal follow-app theme, SFTP default view, and additional terminal options. Device-bound encrypted apiKey placeholders are stripped from providers and webSearchConfig before upload. Auto-sync now reacts to syncable localStorage changes via a new adapter-level event. Center the Settings window on the display of the window that opened it instead of always using the main window, fixing issue #920. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> |
||
|
|
1fcf77ef4d |
Harden the dirty-editor quit guard (#853)
* Harden the dirty-editor quit guard Follow-up to #840. Three concrete failure modes that round-2 review turned up: 1. `webContents.send` is unguarded. If the renderer is destroyed between the reachability check and the send (e.g. a dying GPU process), the throw escapes the `before-quit` handler with `quitGuardChannelBusy = true` already set and no timeout scheduled yet — the app becomes un-quittable until restart. Wrap the send, and tear the listener/timer down on failure. 2. The timeout vs. response race silently commits a quit on `hasDirty=true`. Once `setTimeout` has already enqueued its callback for the next tick, `clearTimeout` is a no-op and the timeout callback runs even after the response arrived — which unconditionally calls `commitQuit()`, overriding the user's "save first" intent. Funnel both paths through a `settle()` helper that only acts the first time it's called. 3. The reply listener accepted any sender. A rogue or future-buggy `webContents` could decide the quit by sending the channel name first. Validate `evt.sender === wc` and ignore non-matches; switch from `.once` to `.on` + explicit `removeListener` so a rogue early reply doesn't consume the listener slot. Also wrap the renderer-side handler in try/catch so an unexpected throw inside `editorTabStore.getTabs()` reports `hasDirty=false` immediately instead of stranding the main process for 5 s on a silent timeout. Verify `webContents.isCrashed()` before sending so a known-dead renderer skips the round-trip and quits instantly instead of waiting on the timeout fallback. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Tighten dirty-editor quit-guard validation Codex round-2-2 review suggested two small follow-ons: 1. Sender check should reject missing/falsy `evt.sender` outright. In real Electron IPC the sender is always populated; a falsy sender is anomalous and treating it as legit defeats the rogue-reply defence we just added. 2. Wrap `bridge.reportDirtyEditorsResult` in try/catch on the renderer side. If the IPC bridge is in a bad state and the call throws, the rest of the listener body is fine but the React useEffect callback would propagate the error — and an uncaught error in the listener would silently disable the quit guard for the rest of the session. Both are pure tightening; no behaviour change on the happy path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
8296c2c780 |
fix(quit): target main window for dirty-editor check on quit (#840)
* fix(quit): target main window for dirty-editor check on quit Use getMainWindow() instead of BrowserWindow.getAllWindows()[0] so the app:query-dirty-editors round-trip isn't sent to the tray panel or settings window, and skip the check when the main window is hidden to avoid the 5s timeout fallback during tray-initiated quit. * Also gate dirty-editor check on isMinimized for cross-platform robustness A minimized main window has a taskbar/Dock entry the user can click to restore, so the dirty-editor toast is still useful even though the window isn't currently in the foreground. On some platforms isVisible() can return false for a minimized window (see the comment at globalShortcutBridge.cjs:478), so the original `!isVisible()` short-circuit would silently lose dirty-editor protection in that case. Treat a window as "reachable by the user" when either isVisible() or isMinimized() is true. Truly hidden windows (close-to-tray, app.hide() on macOS) still skip the round-trip and quit instantly, which is the behaviour this PR set out to introduce. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
b1ab4d7105 |
[codex] Enable Nerd Font glyphs in terminal (#845)
* Enable Nerd Font glyphs in terminal font picker and rendering
- Grant local-fonts permission on the default session so queryLocalFonts()
can enumerate user-installed fonts; without it the picker only showed
the 20 hard-coded built-ins, hiding Nerd Font sub-families like
"JetBrainsMono Nerd Font Mono".
- Append a Symbols Nerd Font fallback to the terminal fontFamily chain so
PUA icons (powerline / devicons / etc.) resolve even when the primary
font lacks them, matching the cross-font fallback behavior CoreText-based
terminals like Ghostty already provide.
- Whitelist "Symbols Nerd Font" / "Symbols Nerd Font Mono" in the local
monospace allow-list so the symbol-only icon font is not filtered out.
Refs #843
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Restrict permission handler to app origin
Address review feedback on PR #845: the previous permissive fallthrough
granted every permission request/check that hit the default session,
which the in-app OAuth flow uses too. That meant remote OAuth pages
(accounts.google.com, login.microsoftonline.com, ...) could be auto-
approved for camera, microphone, geolocation, notifications, etc.
Gate the handler on the requesting origin: only the app's own renderer
(app://netcatty plus the dev server in dev) gets the local-fonts grant
and the prior approve-by-default behavior. Anything loaded from a
third-party origin is denied outright.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Use explicit permission allow-list for app origin
Address Codex P1 on PR #845 commit
|
||
|
|
08f00ed143 |
fix(editor): address Codex review feedback on PR #808 (#809)
* fix(editor): address Codex review feedback on PR #808 Three issues raised on the merged editor-tab-form PR: P1 — Host-picker switch ignored onDisconnect cancellation SftpPaneDialogs' onSelectLocal / onSelectHost awaited onDisconnect() and unconditionally called onConnect() regardless of the dirty-editor prompt outcome. A user who hit Cancel on the "unsaved changes" dialog would still end up switched to the new host, stranding the editor tabs on a now-stale connection. Change onDisconnect to return Promise<boolean> (true when the disconnect actually ran, false on prompt cancel) and gate onConnect on it. Propagate the new signature through SftpPaneCallbacks, the pane-actions hook result, and both left/right implementations. P2 — setIsQuitting leaked across canceled quits electron/main.cjs called windowManager.setIsQuitting(true) at the top of before-quit, before the dirty-editor check returned. If the renderer reported hasDirty=true and the quit was canceled, isQuitting stayed true, changing later window-close behavior (close-to-tray paths gated on !isQuitting would stop firing). Move the setIsQuitting call into a commitQuit() helper that only runs once we've decided to actually proceed — on hasDirty=true we leave state untouched. P2 — SftpSidePanel unmount only cleaned active-pane connections The cleanup effect inspected only leftPane / rightPane (the active tab per side), missing editor tabs tied to inactive tabs in the same side panel. On unmount those tabs would survive with a dead save bridge. Iterate leftTabs.tabs and rightTabs.tabs and collect every connection id before calling forceCloseBySessions. npm test — 212/212 pass, tsc error count unchanged from main, lint clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * perf(editor): stabilize bridge registration effect and memoize filename dedup Two perf concerns from a focused leak/perf audit of PR #808: 1. Bridge writer effect re-ran on every SFTP state change. SftpView / SftpSidePanel registered their bridge writer in an effect with `[sftp]` deps. The `sftp` object identity changes on every SFTP state update — transfer progress, directory listing, pane updates, tab switches — so the effect would unregister+reregister constantly during routine SFTP use. Not a leak (React runs cleanup before each re-effect), just high-frequency churn on the hot path. Route through sftpRef and run the effect once; writeTextFileByConnection is a methodsRef-backed dispatcher that stays valid across sftp re-renders. 2. O(n²) filename disambiguation scan in TopTabs render. Each editor tab ran `editorTabs.filter(same fileName)` inside the per-tab render branch. Negligible at ~20 tabs but trivially fixable: build a fileName→count map in a useMemo keyed on editorTabs and look up in O(1). Separately noted but NOT fixed here (needs a store refactor and deserves its own PR): App.tsx subscribing to useEditorTabs() means every keystroke in an editor tab re-renders the App root. Would need a useEditorTabIds() selector that only notifies on add/remove. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
b9e9a0d59c |
feat(editor): promote SFTP text editor into top-level tabs (#631) (#808)
* chore: ignore local .worktrees/ directory Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(editor): editorTabStore scaffold with single-tab ops Implements the EditorTabStore class singleton (matching activeTabStore pattern) with updateContent, markSaved, setWordWrap, setSavingState, close, and subscribe. Includes useSyncExternalStore hooks and 6 passing unit tests. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(editor): editorTabStore promoteFromModal with per-session path dedup * feat(editor): confirmCloseBySession for session teardown Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(sftp): writeTextFileByConnection for pane-agnostic saves Adds a new `writeTextFileByConnection(connectionId, expectedHostId, filePath, content, filenameEncoding?)` method to `useSftpExternalOperations` that looks up the SFTP pane by connection ID (with a hostId safety check) instead of the left/right-side coupling used by `writeTextFile`. Threads the existing `getPaneByConnectionId` callback through the call site and re-exports the new method via `SftpStateApi`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(editor): editorSftpBridge singleton for out-of-React saves Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * refactor(editor): extract TextEditorPane from TextEditorModal Lift Monaco editor body + toolbar + theme sync + paste fallback into a pure TextEditorPane component. Adds sftp.editor.maximize i18n key to en.ts and zh-CN.ts locale files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor(editor): drop unused getLanguageId import in TextEditorPane Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * refactor(editor): TextEditorModal delegates to TextEditorPane Replace the monolithic modal (560 lines including full Monaco setup) with a thin Dialog shell (~150 lines) that owns content/saving/saveError/ languageId state, save orchestration, and dirty-check on close, then delegates all editor chrome to <TextEditorPane chrome="modal" />. Exports TextEditorModalSnapshot for the optional onPromoteToTab callback so callers can later wire tab promotion (Task 12) without breaking the existing interface — the new prop is optional and existing callers (SftpOverlays.tsx) are source-compatible with zero changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(editor): include fileName and wordWrap in TextEditorModalSnapshot Task 12 will populate the promoted tab with these fields, so the snapshot must carry them from the modal at maximize time. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(editor): UnsavedChangesDialog three-button confirm * fix(editor): resolve UnsavedChangesDialog re-entrance and unmount leaks - Re-entrance: if prompt() is called while a prior prompt is still pending, cancel the prior one so its caller doesn't hang forever. - Unmount: resolve any in-flight prompt as "cancel" in the effect cleanup so awaiters don't leak when the provider unmounts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(editor): TextEditorTabView tab-form shell Add TextEditorTabView component that binds an editorTabStore entry to TextEditorPane, with CSS display:none toggling for inactive tabs so the Monaco instance persists across tab switches. Also adds setLanguage public method to EditorTabStore (lands Task 15's intent early — Task 15 can be a no-op). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(editor): read live store state in TextEditorTabView handlers React state snapshot lags the store by a microtask. Closing over `tab` meant a keystroke between Monaco's onChange and a Ctrl+S would write stale content and mark a stale baseline. Read via editorTabStore.getTab at call time instead. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(editor): dispatch editor:* tab ids in App and activeTabStore - Add EDITOR_PREFIX, isEditorTabId, toEditorTabId, fromEditorTabId helpers - Add useIsEditorTabActive hook to activeTabStore - Update useIsTerminalLayerVisible to exclude editor tabs - Import useEditorTabs and TextEditorTabView into App.tsx - Append editor tab ids (editor:<id>) to allTabs in hotkey handler - Mount TextEditorTabView per editorTab with CSS visibility toggling - Add editorTabs to executeHotkeyAction useCallback dependency array Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(editor): render editor tabs in TopTabs with icon/dirty/tooltip - Add `fromEditorTabId`, `isEditorTabId` imports to TopTabs.tsx - Add `FileCode`, `FileText` icons; use FileCode for code-like extensions - Extend `TopTabsProps` with `editorTabs`, `onRequestCloseEditorTab`, `hostById` - Build `editorTabMap` for O(1) lookup; add `editor` branch in `orderedTabItems` - Render editor tab chrome matching terminal tab style: file icon, dirty dot (●), filename with disambiguation suffix for duplicate filenames, close button - In App.tsx: add stub `handleRequestCloseEditorTab`, `orderedTabsWithEditors`, pass new props to `<TopTabs>` Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor(editor): hoist editor-tab code-extension regex and use onSelectTab - Move CODE_EXTENSIONS_RE to module scope so it isn't recompiled per render. - Call onSelectTab(tabId) for consistency with other tab types, instead of reaching into activeTabStore directly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(editor): maximize modal to tab and dirty-confirm tab close Wire onPromoteToTab from TextEditorModal through SftpOverlays and useSftpViewFileOps so clicking the maximize button snapshots editor state into editorTabStore and activates the new editor tab. Replace the stub handleRequestCloseEditorTab in App.tsx with a real dirty-confirm flow using UnsavedChangesProvider render-prop: clean tabs close immediately, dirty tabs prompt save/discard/cancel, and save routes through editorSftpBridge with markSaved on success. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(editor): register SFTP bridge and gate session close on dirty editor tabs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(editor): make onDisconnect async so host-picker waits for dirty check The session-close dirty gate added in Task 13 made onDisconnect async, but the host-picker in SftpPaneDialogs still called it synchronously before kicking off onConnect — a fire-and-forget that raced past the dirty prompt and let unsaved editor tabs slip through. Propagate the Promise return type through SftpPaneCallbacks / SftpPaneDialogs / useSftpViewPaneActionsResult and await it at the host-picker call sites. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(editor): block app quit while editor tabs are dirty Add a before-quit IPC guard that asks the renderer whether any editor tab has unsaved changes. If dirty tabs exist, preventDefault() blocks the quit and a warning toast is shown. The app quits normally once editors are clean. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(editor): add 5s timeout fallback to quit-guard IPC check If the renderer crashes or throws before reporting back, the quitGuard would stay busy forever and the app could not be quit. Fall back to force-quit after 5 s if no reply arrives. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(editor): quit-guard uses quitConfirmed flag to prevent re-entry loop The prior flow reset quitGuardChannelBusy before calling app.quit(), which on macOS re-fires before-quit and re-entered the dirty check with the flag cleared — creating an infinite IPC loop. Introduce a separate quitConfirmed flag that commits to quitting before app.quit() fires, so the re-entry takes the fast path. Also extract QUIT_GUARD_TIMEOUT_MS and clarify that a concurrent quit while a check is in flight is swallowed (preventDefault) rather than letting the second event through. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(editor): use absolute inset-0 for tab panel and add sr-only DialogTitle Two bugs surfaced during the first dev-server smoke test: 1. Editor tab content was blank because TextEditorTabView used only className="h-full", while its sibling panels (VaultView, SftpView, TerminalLayerMount, LogView) all fill their flex-1 parent via `absolute inset-0`. In normal flow the editor tab collapsed to zero height. Match the sibling convention. 2. Radix printed an accessibility warning because the Task 7 refactor pulled the DialogTitle out of DialogContent and into the Pane header (now a plain span). Add a visually hidden DialogTitle that mirrors the filename, so screen readers have a title without showing it twice. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(editor): raise tab panel z-index to 20 so it sits above TerminalLayer TerminalLayer's root is visibility:hidden when the active tab is an editor tab, but its inner panels set `absolute inset-0 z-10` on their own and those still paint. Without an explicit z on the editor tab panel, TerminalLayer's inner bg-background div was covering the Monaco content, producing a blank screen. Also add bg-background to the wrapper so the editor tab paints an opaque surface (matches the pattern VaultViewContainer / TerminalLayer follow). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(editor): show host label and remote path next to filename in tab header The editor tab form previously only showed the bare filename in its header, which is ambiguous when the same filename is open against multiple hosts. Add an optional subtitle prop on TextEditorPane and populate it from the tab form with `<hostLabel>:<remotePath>` rendered in muted text beside the filename. The modal keeps its existing filename-only header. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(editor): bridge supports multiple useSftpState instances useSftpState is instantiated in both the top-level SftpView and the terminal's SftpSidePanel, each owning its own pane registry. The editor bridge previously stored only one writer, so maximizing a file opened from the terminal side panel registered nothing (bridge was owned by SftpView which may never have mounted) and save failed with "bridge not registered". Change the bridge to track a Set of writers and dispatch by trying each until one owns the connectionId (signalled by its specific "connection no longer available" error). Add registerEditorSftpWriterScoped that returns an unregister fn so each instance's cleanup removes only its own entry. Register in both SftpView and SftpSidePanel. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(editor): Cmd+W closes editor tab + terminal close forces tab close Two behaviors added after user feedback from dev-server smoke-test: 1. Cmd/Ctrl+W (the closeTab hotkey) previously did nothing on editor tabs because executeHotkeyAction had no branch for editor:* ids. Add one that reaches into the UnsavedChangesProvider render-prop's close flow via a ref, routing through the existing dirty-confirm path. 2. Closing a terminal tab unmounts its SftpSidePanel which destroys the useSftpState instance that owned the connection. Any editor tab promoted from that panel would then be stuck — bridge gone, save channel dead. On SftpSidePanel unmount, gather the connection ids it owned and call a new editorTabStore.forceCloseBySessions to drop matching editor tabs. Dirty state is dropped because the user closed the terminal knowing the file was open — there is no save channel left anyway. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(editor): Cmd/Ctrl+W works when focus is inside Monaco Monaco's internal key-event dispatcher swallows keydown before the capture-phase handler on the Pane's root div can see it, so the global hotkey dispatcher never got the chance to close the editor tab when the editor had focus. Register a Monaco editor command for the close-tab keybinding and route it through a handleCloseRef — mirrors the same pattern used for Cmd/Ctrl+S. Also drop the modal-only guard in the capture-phase handler so the outer-chrome path works in tab mode too. TextEditorTabView now receives an onRequestClose(tabId) prop that App.tsx wires via the render-prop-exposed handleRequestCloseEditorTabRef, same mechanism as the hotkey-dispatcher path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(editor): fall back to Vaults when forceCloseBySessions removes the active tab Closing a terminal tab triggers SftpSidePanel unmount which force-closes its editor tabs. If the editor tab being removed happened to be the active tab (user maximized → then closed the owning terminal from another path), the app ended up on a stale activeTabId with no selected tab and blank content. Inside forceCloseBySessions, if the active tab was one of the removed editor ids, redirect to 'vault'. Picking a more sophisticated neighbor would need the full orderedTabs list which isn't reachable from this layer; Vaults is always valid. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
ec99875dec |
[codex] avoid main-process runtime crashes (#772)
* avoid main-process runtime crashes * fix main-process startup error boundary * tighten main-process startup readiness * fix startup fallback window health checks * exclude hidden windows from recovery checks |
||
|
|
8ef91e1266 |
Ctrl+W close priority + local shell busy confirmation (#739)
* feat(ctrl-w): add ps-node + windows-process-tree + tsx deps for close-priority feature * fix(ctrl-w): drop ps-node dep and add windows-process-tree to asarUnpack Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): add ptyProcessTree bridge with per-platform child-process enumeration Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ctrl-w): ptyProcessTree uses args= for full command + warns on pid overwrite - Replace `comm=` with `args=` in defaultListPosix so the full command line is captured on both macOS (BSD ps) and Linux (GNU ps), avoiding the 15-char TASK_COMM_LEN truncation. - Add console.warn in registerPid when the same sessionId is overwritten with a different pid, making the race condition visible in logs. - Add test: registerPid warns exactly once on a pid change, not on a same-pid re-registration. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): register local PTY pid with ptyProcessTree on spawn/exit Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ctrl-w): unregister pids in cleanupAllSessions to match per-delete invariant Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): add IPC handlers for pty child processes and confirm-close dialog Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ctrl-w): guard BrowserWindow.fromWebContents null and document dialog dismiss contract Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): expose ptyGetChildProcesses and confirmCloseBusy on window.netcatty Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): add i18n strings for close-busy-terminal dialog Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): add resolveCloseIntent pure function with 8 unit tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): expose handleCloseSidePanel via ref to App.tsx Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): wire resolveCloseIntent + local-shell busy confirmation into closeTab hotkey Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(ctrl-w): add re-entrancy guard, aggregate busy count, sync sidebar ref, dedupe intent branches Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ctrl-w): auto-close workspace when its last session is closed Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ctrl-w): sidebar close wins over focused terminal in priority chain Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ctrl-w): sidebar priority applies to single-session tabs too, not just workspaces Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ctrl-w): compute empty-workspace auto-close outside setSessions updater Addresses Codex P2 on #739: React 18+ does not guarantee updater execution timing under concurrent scheduling. Moving the decision outside the updater makes the microtask queue deterministic. --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|
|
db69d5ac39 |
[codex] Harden sync overwrite protection and add local restore history (#720)
* fix: harden sync overwrite recovery * refactor: separate backup retention settings * refactor: align backup retention controls * refactor: simplify backup retention card * fix: address PR #720 deep-review findings - Close the cross-window restore race by holding a time-bounded barrier in localStorage during every destructive apply; useAutoSync skips pushes while it's set, preventing a pre-restore snapshot from clobbering just-restored cloud data. - Round-trip startup three-way merges so merged-in local additions actually reach the cloud instead of living only on the device that ran the merge until the next edit. - Upgrade sync signatures from a 64-char ciphertext prefix to full SHA-256 (v3), closing the tail-mutation replay weakness. - Harden the vault-backup IPC: payload size cap, enum-validated reason, sanitized version strings, strict maxCount, concurrent-call mutex, monotonic createdAt to avoid same-ms ordering ties. - Extract the anchor-change decision into a pure module with unit tests covering no-anchor, resource-id drift, and signature mismatch paths. - Capture the protective backup from the pre-apply closure snapshot so it reflects what's being replaced rather than what was imported. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address PR #720 follow-up review findings Make protective backup abort-on-failure (was best-effort console.error), preserve nested syncedAt in fingerprint, use UTF-8 byte length for size guard, throw on conflict-inspect failure so stale uploads can't leak through, treat unreadable remote as changed, canonical-JSON signature meta, and hold the version stamp on transient backup failures so the retry path still fires. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address second-pass review findings on PR #720 - Hold version-change stamp when payload is non-meaningful (covers the startup vault-rehydrate race where a transient empty snapshot would permanently skip the upgrade backup). - readBackupRecord stat-checks before readFile so an oversized file in the backup dir cannot OOM the renderer on enumeration. - Reject maxBackups input outside 1..100 instead of silently clamping (matches the i18n error copy and the main-process sanitizer bound). - Wrap USE_LOCAL conflict-resolution push in withRestoreBarrier so a concurrent auto-sync in another window cannot interleave. - sha256Hex throws SyncSignatureUnavailableError on missing WebCrypto subtle; createSyncedFileSignature returns null, forcing the unreadable-remote → three-way-merge path instead of a weak length-only pseudo-signature. - Document that array order in normalizePayloadForHash is an invariant enforced by producers, not the hash function. - Drop three-way-merge completion logs from console.log to console.info. - Comment the implicit restore → store-listener refresh chain so future refactors don't silently break the UI reload path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address third-pass review findings on PR #720 Resolves I-3 through I-8 and related cleanup items identified in the deep review. Highlights: - replace setTimeout(0) post-merge round-trip with a direct syncAllProviders call using the already-computed merged payload, removing the React-commit race - resolve the empty-vault confirmation promise on unmount so a mid-dialog window teardown doesn't leak the resolver - retry the version-change backup as hosts/keys hydrate, instead of latching on the first (possibly empty) snapshot - heartbeat-refresh the cross-window restore barrier so long applies cannot expose a post-60s window to concurrent auto-sync - add a diagnostic warning when connected providers hold divergent bases (multi-account configurations) - surface a user-visible "Sync paused" toast when startup inspect fails, replacing the previous silent gate-open - tie-break backup list sort by id when createdAt collides - extract applyProtectedSyncPayload so the main and settings windows cannot drift on restore-barrier / protective-backup handling Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address deep-review findings on PR #720 Deep re-review surfaced six Important issues that survived the prior four review rounds. All are hardened here: - I1: fsync the protective backup file AND its directory before the rename completes, so a system crash between backup creation and the restore it guards cannot leave a torn/zero-length safety net. - I3: persist an apply-in-progress sentinel across the non-atomic localStorage writes in applySyncPayload. A crash mid-apply now surfaces on the next startup (toast + refuse auto-push) instead of silently pushing the half-applied state over an intact cloud copy. - I2: only open the auto-sync gate (remoteCheckDoneRef) when the startup inspect validated cleanly. Add a bounded exponential-backoff retry so a transient inspect failure self-heals instead of wedging auto-sync until restart. - I5: save the sync base BEFORE advancing the per-provider anchor inside uploadToProvider. A renderer crash between the two writes now degrades to "stale anchor forces re-inspect on next run," which re-merges against the fresh base — eliminating the silent base-drift window where a 3rd-device race could misclassify entries. - I6: main process broadcasts a vaultBackups:changed IPC event on every mutation; useLocalVaultBackups subscribes so protective backups created from the main window show up in the Settings backup list without manual refresh. - I4: update PR description + code comment to match the actual (safer) design: auto-sync gate opens on vault init, with hasMeaningfulSyncData + restore barrier preventing empty-push; the version-change backup is best-effort and retries as data hydrates. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: serialize startup checkRemoteVersion and stabilize its deps Re-review flagged that checkRemoteVersion's useCallback depended on `config` — a fresh object literal from App.tsx on every render — so the retry effect restarted with attempt=0 on every vault edit and could spawn overlapping in-flight inspect+apply runs. Two concurrent commitRemoteInspection + onApplyPayload calls could race on the apply-in-progress sentinel around interleaved writes. Route `buildPayload`, `config.onApplyPayload`, and `config.startupReady` through refs so checkRemoteVersion's identity no longer churns with unrelated App state. Add an in-flight guard that returns early when a previous invocation is still awaiting the network, closing the same-window re-entry gap that withRestoreBarrier intentionally doesn't cover. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: release in-flight lock on no-connected-provider early return Third-pass review caught that `checkRemoteInFlightRef` was acquired before the `!connectedProvider` check, so that early return leaked the lock and every subsequent retry-timer tick silently no-op'd. Move the acquisition past the early return so the only path that takes the lock reaches the finally-release. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
ba93e2fa35 |
fix: do not cancel pending close-to-tray hide on window show event
Follow-up to the trailing-show fix. Codex review on #718 flagged that `focusMainWindow()` in main.cjs (called from `app.on("second-instance")` and as the fallback path of `app.on("activate")`) still calls `win.show()/focus()` without cancelling any in-flight close-to-tray pending hide. A user who closes a fullscreen window to tray and then relaunches the app via a second instance would see the window briefly reappear and get hidden again when `leave-full-screen` lands. Add `clearPendingFullscreenHide(win)` at the top of `focusMainWindow()` so every reopen entry point (dock click, second-instance, activate fallback) cancels the pending hide before showing the window. |
||
|
|
880812f48d |
fix: do not cancel pending close-to-tray hide on window show event
macOS emits a `show` event on the BrowserWindow internally while the native fullscreen exit animation lands the window back in its home Space. PR #717's defensive `show` listener in hideWindowRespectingMacFullscreen treated that as user intent and cleared the pending hide, so clicking the red close button on a fullscreen window left it visible on screen instead of going to the tray. Remove the `show` listener entirely. The other paths that legitimately "bring the window back" during the exit animation (openMainWindow, toggleWindowVisibility, setCloseToTray(false), the tray "Open Main Window" menu) already call clearPendingFullscreenHide explicitly, so the listener was only ever catching the internal transition emit. Also wire app.on("activate") in main.cjs to call clearPendingFullscreenHide so a dock-click during the exit animation correctly cancels the pending hide as user intent. Update the existing regression test to assert the new behavior (`show` does not cancel; leave-full-screen still does), and add a new test covering the app-activate path. |
||
|
|
c771979178 |
Add Skills + CLI mode for external agents (#599)
* Add Skills + CLI external agent workflow * feat: add Skills + CLI transport for ACP agents * chore: remove branch-local compatibility shims |
||
|
|
60071424d0 |
fix: prevent crash when clicking external links with no default browser (#676)
* fix: prevent crash when clicking external links with no default browser (#663) On systems like Tiny11 where no default browser is associated with http/https URLs, shell.openExternal() rejects with Windows error 0x483 ("No application is associated..."). The main process treated that rejection as an unhandledRejection, which the global handler re-throws as fatal, crashing the entire app. Root cause: windowManager.cjs used `void shell?.openExternal?.(url)` inside a try/catch, assuming the try would cover the call. `void` only discards the returned Promise — it does not catch async rejections, so when openExternal rejected, the error escaped as a floating unhandledRejection. The IPC handler in main.cjs (`netcatty:openExternal`) also awaited shell.openExternal() without any try/catch. Electron's ipcMain.handle forwards rejections to the renderer over IPC, but the renderer-side fallback called `window.open()`, which re-entered the same buggy windowManager path — and that is where the process actually died. Changes: - windowManager.cjs: attach an explicit `.catch` on the openExternal Promise in both createExternalOnlyWindowOpenHandler and createAppWindowOpenHandler so rejections cannot propagate. - main.cjs: wrap the IPC handler in try/catch and return a structured { success, error } result instead of throwing. This lets the renderer render an informative message. - global.d.ts: update the openExternal return type to match. - useApplicationBackend.ts: read the structured result and throw on failure so callers can react; drop the now-redundant window.open() fallback for the Electron branch (kept only for non-Electron envs). - SettingsApplicationTab.tsx: show a friendly toast ("No default browser configured — please set one in system settings") when openExternal fails, instead of the previous silent failure. - i18n: add en + zh-CN strings for the toast. Closes #663 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: fall back to in-app browser window when system has no default browser Instead of showing a toast when shell.openExternal() fails (e.g. Tiny11 with no default browser), open the URL in a minimal in-app BrowserWindow so users can still read the linked page. windowManager.cjs now exposes: - openFallbackBrowser(url, opts): creates a stripped-down BrowserWindow that loads the URL. No preload script (remote content must never touch contextBridge), contextIsolation/nodeIntegration/sandbox all set to safe defaults, and an isolated persist:netcatty-fallback-browser session so cookies and storage do not leak into the main app. Basic Alt+Left / Alt+Right / Ctrl-or-Cmd+R shortcuts for navigation and reload. - tryOpenExternalWithFallback(shell, url, opts): tries shell.openExternal first; on rejection, falls back to openFallbackBrowser. Returns { success, fallback?: "in-app-browser" }. All three external-URL call paths now route through this helper: - main.cjs netcatty:openExternal IPC handler - createExternalOnlyWindowOpenHandler (popup blocker for child windows) - createAppWindowOpenHandler (main/settings window window-open handler) The renderer-side toast is retained as a last-resort for the rare case that both system and in-app browsers fail (e.g. BrowserWindow creation error). Copy updated to reflect the new behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: preserve rejection semantics for failed external opens Per Codex review on PR #676: returning { success, error } from bridge.openExternal changed the contract from "reject on failure" to "resolve with a failure object on failure", which silently broke callers that rely on rejection to abort flows. useCloudSync's OAuth path is the clearest example: it wraps bridge.openExternal in a try/catch and rejects browserPromise inside the catch. With the resolved-failure contract, that catch never fires, so Promise.race([callbackPromise, browserPromise]) can hang indefinitely when no browser is available. Revert the contract: - tryOpenExternalWithFallback resolves void on success (system browser or in-app fallback) and throws on total failure - main.cjs IPC handler awaits and lets rejections propagate - global.d.ts openExternal is Promise<void> again - useApplicationBackend just awaits — rejections propagate naturally - SettingsApplicationTab's existing try/catch + toast continues to work as before Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: propagate fallback browser loadURL failures Per Codex P2: openFallbackBrowser swallowed loadURL rejections by attaching a .catch that only logged, so any caller using tryOpenExternalWithFallback as a success signal saw an opened window as success even when the page failed to load. OAuth flows would then wait for the downstream callback timeout instead of canceling early on malformed or unreachable URLs. openFallbackBrowser now returns { window, loaded } where `loaded` is the raw loadURL Promise, and tryOpenExternalWithFallback awaits it in the fallback path. On initial load failure, the broken window is closed and the original shell.openExternal error is re-thrown. The internal popup handler inside the fallback window keeps its fire-and-forget behavior (it must return synchronously) but now explicitly catches the loaded rejection to avoid unhandledRejection. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
f1ce541885 |
fix: dock click opens main window instead of settings window (#587)
On macOS, when the main window is closed but the settings window is still open, clicking the Dock icon would focus the settings window instead of re-creating the main window. - focusMainWindow() now explicitly finds the main window via getWindowManager() instead of using getAllWindows()[0] - activate handler creates a new main window even when other windows (settings) are still open Fixes #587 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> |
||
|
|
c924259fc0 |
fix: add local autocomplete specs and isolate command history per host (#536)
Add local spec files for commands missing from @withfig/autocomplete (journalctl, yum, awk) and load them with priority over the upstream package. Also enforce strict per-host isolation for command history — previously cross-host matching by OS leaked host-specific commands (e.g. cd /cq/) into unrelated sessions. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |