mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 20:11:08 +00:00
* 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>
108 lines
4.5 KiB
JSON
Executable File
108 lines
4.5 KiB
JSON
Executable File
{
|
|
"name": "netcatty",
|
|
"description": "Netcatty is a modern SSH manager and terminal app with host grouping, SFTP, keychain, port forwarding, and a rich UI.",
|
|
"homepage": "https://github.com/binaricat/Netcatty",
|
|
"private": true,
|
|
"version": "0.0.0",
|
|
"type": "module",
|
|
"author": "binaricat <support@netcatty.com>",
|
|
"license": "GPL-3.0-or-later",
|
|
"main": "electron/main.cjs",
|
|
"scripts": {
|
|
"dev": "npm run lint && concurrently -k \"vite\" \"npm:dev:electron\"",
|
|
"dev:electron": "wait-on http-get://localhost:5173 && cross-env VITE_DEV_SERVER_URL=http://localhost:5173 node electron/launch.cjs",
|
|
"prebuild": "node scripts/copy-monaco.cjs",
|
|
"build": "vite build",
|
|
"preview": "vite preview",
|
|
"start": "node electron/launch.cjs",
|
|
"pack": "npm run build && cross-env NODE_OPTIONS=--disable-warning=DEP0190 electron-builder --config electron-builder.config.cjs --publish=never",
|
|
"pack:dir": "npm run build && cross-env NODE_OPTIONS=--disable-warning=DEP0190 electron-builder --config electron-builder.config.cjs --dir --publish=never",
|
|
"pack:win": "npm run build && cross-env NODE_OPTIONS=--disable-warning=DEP0190 electron-builder --config electron-builder.config.cjs --win --publish=never",
|
|
"pack:mac": "npm run build && cross-env NODE_OPTIONS=--disable-warning=DEP0190 electron-builder --config electron-builder.config.cjs --mac --publish=never",
|
|
"pack:linux": "npm run build && cross-env NODE_OPTIONS=--disable-warning=DEP0190 electron-builder --config electron-builder.config.cjs --linux --publish=never",
|
|
"pack:linux-x64": "npm run build && cross-env NODE_OPTIONS=--disable-warning=DEP0190 electron-builder --config electron-builder.config.cjs --linux --x64 --publish=never",
|
|
"pack:linux-arm64": "npm run build && cross-env NODE_OPTIONS=--disable-warning=DEP0190 electron-builder --config electron-builder.config.cjs --linux --arm64 --publish=never",
|
|
"postinstall": "electron-builder install-app-deps && patch-package",
|
|
"rebuild": "electron-builder install-app-deps",
|
|
"lint": "eslint .",
|
|
"lint:fix": "eslint . --fix"
|
|
},
|
|
"dependencies": {
|
|
"@ai-sdk/anthropic": "^3.0.58",
|
|
"@ai-sdk/google": "^3.0.43",
|
|
"@ai-sdk/openai": "^3.0.41",
|
|
"@aws-sdk/client-s3": "^3.956.0",
|
|
"@fontsource/jetbrains-mono": "^5.2.8",
|
|
"@fontsource/space-grotesk": "^5.2.10",
|
|
"@google/genai": "1.33.0",
|
|
"@mcpc-tech/acp-ai-provider": "0.2.8",
|
|
"@monaco-editor/react": "^4.7.0",
|
|
"@radix-ui/react-collapsible": "1.1.12",
|
|
"@radix-ui/react-context-menu": "2.2.16",
|
|
"@radix-ui/react-dialog": "1.1.15",
|
|
"@radix-ui/react-hover-card": "^1.1.15",
|
|
"@radix-ui/react-popover": "1.1.15",
|
|
"@radix-ui/react-scroll-area": "1.2.10",
|
|
"@radix-ui/react-select": "2.2.6",
|
|
"@radix-ui/react-slot": "1.2.4",
|
|
"@radix-ui/react-tabs": "1.1.13",
|
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
"@streamdown/cjk": "^1.0.2",
|
|
"@streamdown/code": "^1.1.0",
|
|
"@withfig/autocomplete": "^2.692.3",
|
|
"@xterm/addon-fit": "^0.10.0",
|
|
"@xterm/addon-search": "^0.15.0",
|
|
"@xterm/addon-serialize": "^0.13.0",
|
|
"@xterm/addon-unicode11": "^0.9.0",
|
|
"@xterm/addon-web-links": "^0.11.0",
|
|
"@xterm/addon-webgl": "^0.18.0",
|
|
"@xterm/xterm": "^5.5.0",
|
|
"@zed-industries/claude-agent-acp": "0.22.2",
|
|
"@zed-industries/codex-acp": "0.10.0",
|
|
"ai": "^6.0.116",
|
|
"clsx": "2.1.1",
|
|
"electron-updater": "^6.8.3",
|
|
"iconv-lite": "^0.6.3",
|
|
"lucide-react": "0.560.0",
|
|
"monaco-editor": "^0.55.1",
|
|
"node-pty": "1.1.0",
|
|
"react": "^19.2.1",
|
|
"react-dom": "^19.2.1",
|
|
"serialport": "^13.0.0",
|
|
"ssh2-sftp-client": "^12.0.1",
|
|
"streamdown": "^2.4.0",
|
|
"tailwind-merge": "3.4.0",
|
|
"use-stick-to-bottom": "^1.1.3",
|
|
"uuid": "^13.0.0",
|
|
"webdav": "^5.8.0",
|
|
"zmodem.js": "^0.1.10",
|
|
"zod": "^4.3.6"
|
|
},
|
|
"devDependencies": {
|
|
"@eslint/js": "^9.39.1",
|
|
"@tailwindcss/postcss": "^4.1.17",
|
|
"@tailwindcss/vite": "^4.1.17",
|
|
"@types/node": "^25.0.0",
|
|
"@typescript-eslint/eslint-plugin": "^8.49.0",
|
|
"@typescript-eslint/parser": "^8.49.0",
|
|
"@vitejs/plugin-react": "^5.1.2",
|
|
"@withfig/autocomplete-types": "^1.31.0",
|
|
"concurrently": "^9.2.1",
|
|
"cross-env": "^10.1.0",
|
|
"electron": "^40.1.0",
|
|
"electron-builder": "^26.0.12",
|
|
"eslint": "^9.39.1",
|
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
"eslint-plugin-unused-imports": "^4.3.0",
|
|
"patch-package": "^8.0.0",
|
|
"tailwindcss": "^4.1.17",
|
|
"typescript": "~5.9.3",
|
|
"vite": "^7.2.7",
|
|
"wait-on": "^9.0.3"
|
|
},
|
|
"overrides": {
|
|
"cpu-features": "npm:empty-npm-package@1.0.0",
|
|
"axios": "1.13.5"
|
|
}
|
|
}
|