mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-25 09:51:28 +00:00
e3b882bdf9c6f7cee7d2b3e433451fe4f0e10c21
181
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e3b882bdf9 |
feat(sftp): add tree view explorer for SFTP pane (#547)
* feat(sftp): add onListDirectory to SftpPaneCallbacks interface Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * feat(sftp): implement onListDirectory in left and right callbacks * feat(sftp): add tree view i18n keys * feat(sftp): add list/tree view mode toggle to toolbar * feat(sftp): add viewMode state and tree view conditional rendering to SftpPaneView * feat(sftp): implement SftpPaneTreeView with lazy loading and context menu Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * fix(sftp): resolve lint errors in tree view implementation Rename inner `t` and `ts` variables in onListDirectory callbacks to `toSize`/`toTs`/`ms` to avoid shadowing the outer `t` translation param. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * fix(sftp): resolve post-merge lint errors - Remove duplicate sftp.context.copyPath i18n key (upstream added it too) - Remove unused AlertCircle import from SftpPaneFileList (upstream removed usage) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * perf(sftp): optimize SftpPaneTreeView render pipeline Split useMemo into two stages so selection changes no longer rebuild the full node descriptor array. Extract stable selection-aware callbacks (drag, copy, delete) via refs so TreeNode React.memo can reliably bail out. Remove unused props (onNavigateTo, draggedFiles), move NodeDescriptor type to module scope, and fix selectedFiles undefined bug in context menu. * feat(sftp): add path-aware rename and delete for tree view Wire renameFileAtPath and deleteFilesAtPath through the full callback stack so tree view context menu actions operate on full paths instead of basenames. Update useSftpPaneDialogs to accept entryPath in openRenameDialog and resolve parent dir in handleDelete, keeping list view behaviour unchanged. * fix: harden SFTP tree view actions and selection * fix: support tree selection shortcuts and nested create targets * fix: keep SFTP tree view sorting in sync * Improve SFTP tree view interactions and refresh behavior * Optimize SFTP tree refresh and pane state usage * Reduce remaining SFTP tree performance overhead * Fix nested SFTP drop target routing * Restore keyboard access to parent tree entry * Revert "Display approved AI commands in terminal sessions before their output. (#546)" This reverts commit |
||
|
|
2a75f863f8 |
fix: reset cloud sync connect button when OAuth popup is closed (#544)
* fix: reset cloud sync connect button when OAuth popup is closed When users close the OAuth popup without completing authorization, the connect button was stuck in "Connecting" state indefinitely (up to 5-minute timeout). Changes: - Track OAuth popup window and poll for closure (Google, OneDrive) - Cancel OAuth callback server when popup is closed, immediately rejecting the pending promise instead of waiting for timeout - Reset provider status via disconnectProvider on auth failure so the connect button returns to clickable state - Suppress toast for user-initiated cancellation (popup closed) - Also reset GitHub provider status on device flow failure Closes #542 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use resetProviderStatus instead of disconnectProvider on auth failure disconnectProvider tears down existing connections (signOut, delete adapter, clear merge base). If a user was re-authenticating and cancelled, this would destroy their working connection. Add resetProviderStatus() that only resets the UI status to 'disconnected' without any teardown side effects. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: add resetProviderStatus to CloudSyncHook interface Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: remove noreferrer from OAuth popup to enable window tracking noreferrer implies noopener in browser spec, causing window.open() to return null and defeating the popup closure detection entirely. Safe to remove since OAuth targets are trusted providers (Google, Microsoft) and the Referer is just a localhost URL. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: guard resetProviderStatus and cancel delayed popup on early failure - resetProviderStatus only resets if status is 'connecting', preserving already-authenticated providers when sync initialization fails - Cancel the delayed setTimeout for window.open if callbackPromise rejects before 100ms, preventing a stray popup and leaking interval Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: reset GitHub provider status when device flow modal is closed The modal onClose only hid the modal and stopped the polling flag, but the provider status stayed at 'connecting'. Now calls resetProviderStatus('github') so the button returns to clickable. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- 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> |
||
|
|
e6166a1de3 |
feat: AI Provider 高级参数配置 (#532) (#533)
* feat: expose advanced AI model parameters in provider settings (#532) Add collapsible "Advanced Parameters" section to provider config with optional max_tokens, temperature, top_p, frequency_penalty, and presence_penalty fields. Parameters are merged into streamText() calls only when explicitly set, otherwise provider defaults apply. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use maxOutputTokens instead of maxTokens for ai@6 SDK The streamText CallSettings in ai@6 expects maxOutputTokens, not maxTokens. Without this fix the user's max_tokens setting is silently ignored. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: allow negative penalty input and clamp params on save - Use raw string state for penalty fields so typing "-" is not discarded before the digit is entered - Clamp all parameters to valid ranges on save (temperature 0-2, topP 0-1, penalties -2 to 2) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use raw string state for all numeric advanced param inputs Prevents intermediate text like "0." from being normalized to "0" during keyboard entry of decimal values for temperature, topP, and maxTokens fields. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: clamp max_tokens to minimum of 1 after rounding Prevents Math.round(0.4) = 0 from being persisted and causing streamText to reject with "maxOutputTokens must be >= 1". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: reject non-finite max_tokens before persisting Guard with Number.isFinite to prevent Infinity from being stored and forwarded to streamText. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
fa29515095 |
feat: SFTP 全局书签支持 (#529) (#530)
* feat: add global SFTP bookmarks shared across all hosts (#529) - Add global bookmark support with separate localStorage storage - Global bookmarks appear on all hosts with a globe icon indicator - "+Global" button in bookmark popover to save path as global - Global bookmarks sorted before host-specific bookmarks - Improve SFTP error display: use Unplug icon, refined styling, auto-expand connection logs on error Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: toggle bookmark correctly removes global-only bookmarks When a path is only globally bookmarked, the toggle button now removes the global bookmark instead of creating a duplicate host one. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
34f9d2a663 |
chore: 死代码清理与架构分层修复 (#524)
* chore: 移除死代码并修复架构分层违规 - 删除未使用的 ACP 模块 (infrastructure/ai/acp/) - 删除未使用的 AI 组件 (ExecutionPlan, PermissionDialog) - 将 syncPayload.ts 从 domain 移至 application 层,修复分层违规 - 移除未使用的导出 (useSecurityState, useProviderStatus, GitHubAuthState, getAgentCommandLabel, ImageAttachment, HotkeyActions) - 收窄 Electron bridge module.exports,移除未使用的导出函数 - 将仅内部使用的函数/类型取消导出 (isSupportedLocale, SyncDashboard) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: 二次审查清理 — 移除更多死代码和架构违规 - 移除未使用的 ConversationEmptyState 组件和类型 - 移除未使用的 PromptInputSelect 系列组件 (5 个导出) - 移除 global.d.ts 中残留的 SMBConfig 类型和 cloudSyncSmb* 方法声明 - 移除 useAutoSync.ts 中未使用的 toast 导入 (同时修复 application→components 反向依赖) - 清理因删除而产生的多余 import Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: 消除直接 localStorage 访问,提取 safeSend 共享工具 localStorage 集中化: - 新增 storageKeys 常量: SIDE_PANEL_WIDTH, PF_RECONNECT_CANCEL, DEBUG_HOTKEYS, DEBUG_UPDATE_DEMO - TerminalLayer/SettingsApplicationTab/App.tsx/useUpdateCheck 改用 localStorageAdapter - CloudSyncManager 内部方法改用 localStorageAdapter - portForwardingService 改用 localStorageAdapter + 集中 key safeSend 去重: - 新增 electron/bridges/ipcUtils.cjs 共享模块 - sshBridge/sftpBridge/portForwardingBridge/sshAuthHelper/aiBridge 统一引用 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: 终审清理 — 移除未使用的 require 和废弃类型别名 - 移除 sftpBridge.cjs 中未使用的 require("node:net") - 移除 aiBridge.cjs 中未使用的 require("node:path") - 移除 types.ts 中已废弃的 ChatMessageImage 类型别名 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: 修复 ESLint 错误 — 组件不再直接导入 infrastructure - 新增 useStoredNumber hook,TerminalLayer 通过 hook 访问侧边栏宽度 - SettingsApplicationTab 的 isUpdateDemoMode 改为从 useUpdateCheck hook 传入 - 移除 useCloudSync.ts 中未使用的 CloudSyncManager 导入和 GitHubAuthState 接口 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: 提取 notification port,消除 application 层对 components 的依赖 将 toast 通知抽象为 application/notification.ts 端口, UI 层通过 setNotify 注入实现,useAutoSync 改用 notify 接口。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
90d161c1b5 |
refactor: 精简 MCP server 工具集,移除 SFTP/multiExec/terminalWrite
精简 ACP agent 工具集,与 Catty Agent 保持一致,只保留核心工具: - get_environment - terminal_execute - terminal_send_input 移除内容: - 7 个 sftp_* 工具 (sftp_list_directory, sftp_read_file, sftp_write_file, sftp_mkdir, sftp_remove, sftp_rename, sftp_stat) - multi_host_execute 工具 - ENABLE_SFTP_TOOLS 环境变量和 sftpAvailable 字段 - WRITE_METHODS 中的 sftp/multiExec 条目 - dispatch 中的 sftp/multiExec 路由和 multiExec scope 验证 - mcpServerBridge 中的 sessionSupportsSftp/scopeHasSftpSessions 函数 - getContext description 中的 SFTP 说明 bridge 层的 SFTP/multiExec handler 函数保留(UI SFTP 面板仍在使用)。 Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
7a5b6f506e |
feat: Catty Agent 支持串口会话命令执行 (#520)
* feat: Catty Agent 支持串口会话命令执行 (#520) 串口连接的网络设备(华为交换机、Cisco 路由器等)使用厂商自有 CLI, 无法识别 Agent 原有的 shell 包裹语法(__NCMCP_ markers、eval、trap)。 新增 execViaRawPty 函数,直接发送原始命令到串口,通过 idle timeout 检测命令完成,无 shell 语法包裹。 - 新增 execViaRawPty:原始命令执行,2s idle timeout 检测完成 - terminalBridge: 串口 session 添加 protocol/shellKind 字段 - mcpServerBridge: handleGetContext 发现串口会话,handleExec/handleTerminalWrite 支持串口 - aiBridge: ai:exec 和 ai:terminal:write 增加 serialPort 分支 - systemPrompt: Agent 提示词增加串口会话使用指南 Closes #520 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: review 问题全量修复 P1: - handleExec 移除死代码(内层 if 条件永远为 true) - 串口会话跳过 shell 安全黑名单(shutdown 在 Cisco 是正常接口命令) - MCP tool 描述更新:terminal_execute/get_environment/multi_host_execute 不再只说 "shell command" - 串口检查增加 protocol === "serial" guard,不再纯靠 duck typing P2: - execViaRawPty 编码改为 latin1,与 terminalBridge 终端解码一致 - exitCode 改为 null(而非 -1),MCP 响应中 null 时不输出 exit code 行 - idle timer 改为收到第一个数据后才启动,避免慢设备超时返回空输出 - idle timeout 默认从 2s 调为 3s,适配低速串口 - serialPort.write 统一用 safeWrite 包裹 try-catch - echo 剥离仅在 lines.length > 1 时执行,避免误删唯一输出行 P3: - cancelKey 用简单自增序列替代 crypto.randomBytes - serialPort.on 前增加 typeof 检查 - finish 函数签名差异增加注释说明 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: 第二轮 review 问题修复 P2: - MCP server terminal 类工具 (terminal_execute/terminal_send_input/multi_host_execute) 跳过 blocklist,由 bridge 层做 session-aware 检查,解决串口 shutdown 等命令 在 MCP 层就被拦截的问题 - handleTerminalWrite (mcpServerBridge + aiBridge) 串口会话跳过 blocklist, 与 handleExec 保持一致 - handleMultiExec 移除外层 blocklist,每个 session 由 handleExec 独立检查 - 移除 execViaRawPty 中的死代码 receivedFirstChunk 变量 - handleGetContext 返回的 description 补充 serial 会话说明 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Codex review 问题修复 - [P2] toolExecutors.ts executeTerminalExecute 也需要跳过串口 blocklist, 否则 Catty Agent renderer 侧的 checkCommandSafety 会在命令到达 bridge 之前拦截 shutdown 等合法设备命令 - [P2] execViaRawPty 增加 noResponseTimer,无输出命令(enable、 configure terminal 等)不再等满 60s 整体超时,而是 2×idleMs 后正常返回 - [P1] 串口 blocklist skip 设计决策加注释:serial 协议由用户主动选择, 如果串口连的是 Linux shell 应使用 local 协议 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Codex 第二轮 review 修复 - [P2] noResponseTimer 从 2×idleMs 调整为 min(idleMs*4, timeoutMs/4), 默认 12s,避免截断慢速网络设备操作 - [P1] 串口 blocklist skip 设计说明扩充:serial 协议由用户主动选择, 且 execViaRawPty 不做 shell 解释,blocklist 中的 shell 元字符 即使发到串口连接的 Linux shell 也不会被解释执行 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: execViaRawPty echo 阶段使用更长的 idle timeout ping/traceroute/copy 等命令在回显后可能沉默数秒才产出真正输出。 引入 chunkCount 区分 echo 阶段(前 2 个 chunk)和正式输出阶段: echo 阶段使用 2×idleMs(默认 6s),正式输出阶段使用 idleMs(3s)。 避免在回显后就误判命令已完成导致输出截断。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: noResponseTimer 增加无输出提示 设备无响应时返回提示信息 "(no output received — command may have completed silently or may still be running)",让 AI 知道命令可能 仍在执行,避免误认为命令已成功完成后立即发送下一条命令。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Codex 第 5 轮 review 修复 - [P2] terminal_send_input 串口写入时将 \n 转换为 \r, 网络设备期望 CR 作为回车而非 LF - [P2] execViaRawPty 增加 512KB 输出上限,达到上限后停止 重置 idle timer,避免 noisy session(持续发日志的设备) 导致命令永远无法完成 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
0b7c52523e |
feat: 终端沉浸模式 (#517)
* feat: add terminal immersive mode When enabled, the UI chrome (tab bar, sidebar, status bar) adapts its colors to match the active terminal's theme, creating a visually cohesive experience. Colors are derived from the terminal theme's hex values and converted to HSL for CSS custom property overrides. - Add useImmersiveMode hook with hex-to-HSL conversion and token derivation - Add reapplyCurrentTheme to useSettingsState for restoring original theme - Integrate with App.tsx to resolve active terminal's effective theme - Add immersive mode toggle in Appearance settings with i18n (en/zh-CN) - Add CSS transition class for smooth 300ms color changes - Support cross-window sync via IPC for Settings window toggle - Handle per-host theme overrides and workspace focused sessions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: 沉浸模式多项改进与 bug 修复 - 修复 primaryForeground 硬编码白色导致浅色 cursor 对比度不足 - 修复 SettingsPage 直接导入 infrastructure 层违反架构约束 - 修复 TerminalSession 类型未导入导致 TS 编译错误 - 修复 TopTabs memo 缺少 logViews 导致 logView 变化不触发重渲染 - 重构 useImmersiveMode 为纯 effect hook,状态由 useSettingsState 统一管理 - Workspace 多终端主题不一致时禁用沉浸模式 - 排除 logView tab 误触发沉浸模式 - 沉浸模式下禁用 dark/light 切换按钮 - Agent 图标使用 CSS mask 跟随文字颜色 - Agent 下拉菜单 overflow-hidden 修复 hover 溢出 - 退出沉浸模式使用 overlay 淡出避免闪烁 - immersive-transition class 仅在沉浸实际生效时添加 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: 沉浸模式默认开启 新用户默认启用沉浸模式,已有设置的用户不受影响。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * perf: 沉浸模式主题切换性能优化 - 启动时预计算所有内置主题的 CSS 字符串,切换时 O(1) 查表 - 自定义主题懒计算并缓存,后续切换同样 O(1) - useLayoutEffect 替代 useEffect,paint 前完成避免闪烁 - 跳过无效的 dark/light class 切换 - apply 和 restore 逻辑拆分为独立 effect - 去掉主题列表 hover 渐变动画 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: 修复 Codex review 提出的三个问题 - [P1] base UI theme 变化时不再覆盖沉浸模式的 dark/light class - [P2] fingerprint 加入 theme.type,检测自定义主题 dark↔light 编辑 - [P2] 沉浸模式设置接入 sync pipeline (collect/apply/rehydrate) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: focus 模式 workspace 支持沉浸 + settingsVersion 加入 immersiveMode - focus 模式 workspace 使用 focusedSessionId 的主题,不再要求所有 session 一致 - settingsVersion 加入 immersiveMode 依赖,确保 auto-sync 能检测到变化 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: 沉浸模式 sync 一致性修复 - 初始化时将默认值写入 localStorage,确保 collectSyncableSettings 能收集到 - rehydrateAllFromStorage 后通过 IPC 广播给其他窗口 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: focus 模式关闭 focused session 后 fallback 到剩余 session 的主题 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: 沉浸模式加入 storage event 跨窗口同步 将 immersiveMode 加入 settingsSnapshotRef 和 handleStorageChange, 确保 web/preview 场景下多窗口间沉浸模式状态同步。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: 沉浸模式同步 Electron 原生窗口背景色 切换沉浸主题时同步调用 setTheme/setBackgroundColor, 使 Windows 上的窗口边框颜色与沉浸主题一致。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
d6fea6c328 | Preserve AI session state and cleanup across panel unmounts | ||
|
|
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 | ||
|
|
a0a2567fa5 | Validate jump-host proxy credentials early | ||
|
|
2c551cf5e8 | Sanitize proxy credentials for jump hosts | ||
|
|
c54aa52191 | Support proxy config on jump hosts | ||
|
|
f814719b32 | Fix jump-host port forwarding edge cases | ||
|
|
ee6b05892d | Support jump hosts for port forwarding | ||
|
|
54297859e3 | Fix AI cancellation and shell wrapper edge cases | ||
|
|
4971f18bbe | Fix AI terminal execution completion and tool UI | ||
|
|
196b1f8dbb |
feat: add terminal smooth scrolling setting (#471)
- Add smoothScrolling boolean to TerminalSettings (default: true) - Wire setting to xterm.js smoothScrollDuration (120ms when on, 0 when off) - Add toggle in terminal settings UI - Include in sync payload and i18n strings (en, zh-CN) Inspired by #467 (@crawt). Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
c67befa0e9 |
perf(keyword-highlight): reduce latency with throttled rAF and line cache (#469)
* perf(keyword-highlight): reduce highlight latency with throttled rAF and line cache Based on #464 by @crawt with fixes for review feedback: - Split triggerRefresh into immediate (rAF) and debounced (setTimeout) modes so onWriteParsed highlights land with fresh content instead of trailing by 200ms - Throttle the immediate path (50ms min interval) to prevent heavy output like tail -f from refreshing every frame - Add per-line match result cache (LRU, bounded by cacheEntries config) so repeated or scrolled-back lines skip regex scanning entirely - Lazily build cellMap only when a regex match is found, avoiding unnecessary work on non-matching lines - Fix buildStringToCellMap to handle empty cells (codepoint 0) which translateToString() renders as spaces — keeps the map aligned with the string and makes lineText a safe cache key - Clean up animationFrameId and matchCache on dispose/rule change Co-Authored-By: Leo Pan <crawt@users.noreply.github.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: guard rAF callback against stale state and add debounce fallback - Re-check enabled/alternate-buffer inside the rAF callback so a pending frame doesn't resurrect decorations after the user disables highlighting or enters an alternate-buffer app - Schedule a debounce timer alongside rAF so background/hidden tabs (where Chromium suspends rAF) still get highlight updates Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: prevent fallback timer from being cleared on rAF-pending path - Don't clear debounceTimer at the start of immediate mode — in hidden tabs rAF stays pending indefinitely, so repeated onWriteParsed calls were clearing the only timer that could actually fire - Cancel debounceTimer inside the rAF callback instead, so foreground tabs don't get a redundant second refreshViewport() 200ms later - Only arm a new fallback timer if one isn't already pending Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: clear stale rAF in fallback timer and add alternate buffer guard - Cancel the pending rAF and clear animationFrameId in the fallback timer callback so hidden-tab refreshes don't leave animationFrameId stuck, which would block all future immediate refreshes - Add enabled/alternate-buffer re-check in the fallback callback, matching the guard already present in the rAF callback Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: extract executeRefresh to ensure all timer paths clear stale rAF A debounced-path timer (from scroll/resize) could fire without clearing a stale animationFrameId left by an earlier immediate-path rAF that never executed (hidden tab). This left the immediate path permanently blocked. Extract executeRefresh() with rAF cleanup + state guards, used by all three callback sites (rAF, immediate fallback, debounced timer). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Leo Pan <crawt@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
cea83d6cb1 |
Revert "Mod:perf(keyword-highlight): reduce highlight latency and redundant regex scanning (#464)" (#468)
This reverts commit
|
||
|
|
293ee46b26 |
Mod:perf(keyword-highlight): reduce highlight latency and redundant regex scanning (#464)
* perf(keyword-highlight): reduce highlight latency and redundant regex scanning - Split triggerRefresh into two modes: "immediate" (rAF, for new output and rule changes) and "debounced" (setTimeout, for scroll/resize), eliminating the fixed 200ms delay after each write that caused visible highlight lag on commands like `ls`. - Add per-line match result cache (LRU, bounded by cacheEntries config) so repeated or scrolled-back lines skip regex scanning entirely. - Lazily build the string-to-cell column map only when a regex match is actually found, avoiding unnecessary work on non-matching lines. - Clean up animationFrameId and matchCache on dispose/rule change to prevent leaks and stale results. * fix: include cell layout in highlight cache key to prevent misplaced decorations Two IBufferLines can produce identical translateToString() output but differ in cell layout (e.g. empty cells vs real space characters after tab stops). Using lineText alone as the cache key could return cached x/width ranges computed from a different cell layout, producing misplaced or truncated highlights. Build the cellMap eagerly and include it in the cache key so lines with different cell structures get separate cache entries. Pass the pre-built cellMap into scanLine to avoid redundant work. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: panwk <panwukan@suangoo.com> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
1233277277 |
fix: provide detailed error messages for cloud sync failures (#439)
Wrap download and decryption steps in separate try-catch blocks so users see whether a sync failure is caused by a download error or a decryption error (e.g. mismatched master passwords across devices). Ref #436 Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
dcaf25ae57 |
feat: inline approval gate for tool execution (#423)
* feat: inline approval gate for tool execution
Replace SDK-level needsApproval with Promise-based approval gate inside
tool execute functions. The SDK stream stays alive while the UI shows
inline approve/reject buttons on ToolCall blocks.
Changes:
- Add approvalGate.ts: Promise-based approval system with event listeners
- tools.ts: requestApproval() inside execute for confirm mode
- tool-call.tsx: inline approval buttons and keyboard shortcuts
- ChatMessageList.tsx: subscribe to approval events, render approval UI
- useAIChatStreaming.ts: remove old useToolApproval hook integration
- AIChatSidePanel.tsx: remove old approval hook, clean up unused destructuring
- systemPrompt.ts: update confirm mode to not ask for text confirmation
- preload.cjs: filter pager env var prefixes from terminal display
- mcpServerBridge.cjs: add approval gate for ACP/MCP write operations
- aiBridge.cjs: wire IPC for MCP approval response and main window getter
- preload.cjs: add onMcpApprovalRequest/respondMcpApproval APIs
* fix: scope approval gate by chatSessionId and replay for late subscribers
Address Codex PR review comments:
- Add chatSessionId to ApprovalRequest for session isolation
- Scope clearAllPendingApprovals(chatSessionId?) to only clear
approvals belonging to the target session
- Add replayPendingApprovals() so late-mounting ChatMessageList
picks up approvals that fired while unmounted
- Scope MCP clearPendingApprovals in aiBridge cancel handler to
effectiveChatSessionId instead of clearing all
- Pass chatSessionId through MCP approval IPC flow
* chore: remove old approval flow code
- Delete useToolApproval.ts (unused hook)
- Delete InlineApprovalCard.tsx (replaced by ToolCall inline buttons)
- Remove stale comments referencing old hook in AIChatSidePanel
- Remove unused ai.chat.toolApprovalTitle i18n key from en/zh-CN
* fix: session-scoped approval gate and MCP replay survival
- handleStop passes activeSessionId to clearAllPendingApprovals
- setupMcpApprovalBridge stores MCP approvals in pendingApprovals map
so they survive ChatMessageList unmount/remount cycles
- ChatMessageList accepts activeSessionId prop and filters standalone
MCP approval blocks to the current session only
- AIChatSidePanel passes activeSessionId to ChatMessageList
* fix: filter PTY exec marker echoes and exit code lines from terminal
Extend filterMcpMarkers in preload.cjs to strip all shell-visible
artifacts from AI command execution:
- Echoed printf start marker: printf '%s\n' '__NCMCP_..._S'
- Echoed exit code restoration: (exit $__nc)
- PowerShell: Write-Output, $global:LASTEXITCODE, $__nc assignment
- Fish: set __nc $status
- Cmd: echo __NCMCP_...
- Widen guard to also trigger on __nc and PAGER=cat strings
* fix: scope SDK approvals, deny MCP on no renderer, fix memo comparator
- createCattyTools accepts chatSessionId and passes it to
requestApproval so SDK approvals can be matched by
clearAllPendingApprovals(activeSessionId) on stop
- useAIChatStreaming passes sessionId to createCattyTools
- mcpServerBridge: deny (resolve false) when no renderer window is
available instead of auto-approving, preserving confirm mode safety
- ChatMessageList: add activeSessionId to React.memo comparator so
switching sessions triggers re-render for correct MCP approval filter
* fix: MCP listener lifecycle, approval timeout, and UI sync on stop
- Move setupMcpApprovalBridge from ChatMessageList to AIChatSidePanel
so the IPC listener survives tab/panel switches
- Add 5-minute auto-deny timeout to requestApproval to prevent
indefinite isStreaming hangs when user walks away
- Add onApprovalCleared listener system: clearAllPendingApprovals now
notifies UI subscribers so ChatMessageList removes stale cards
- ChatMessageList subscribes to onApprovalCleared to sync local state
* fix: main-process approval timeout and full tool args in payload
- Add 5-minute auto-deny timeout to requestApprovalFromRenderer
matching the renderer-side requestApproval behavior
- Forward all tool params (excluding chatSessionId) to approval UI
instead of cherry-picking command/input/path, so sftpRename
oldPath/newPath and other tool-specific args are visible
* fix: move MCP bridge to TerminalLayer, narrow terminal filter guard
- Move setupMcpApprovalBridge from AIChatSidePanel to TerminalLayer
so the IPC listener stays alive regardless of side panel tab.
AIChatSidePanel only mounts when activeSidePanelTab==='ai'.
- Narrow preload.cjs filter guard back to __NCMCP_ only, preventing
false-positive stripping of user scripts containing __nc or PAGER=cat
* fix: eliminate PTY wrapper echo leakage and duplicate prompts
- Posix wrapper now emits 2 lines instead of 4: start marker + command
on line 1 (joined with ;), end marker + exit on line 2. This
eliminates the duplicate prompt echo from the separate start marker.
- Rename __nc to __NCMCP_rc in all shell variants (posix/fish/powershell)
so every wrapper variable contains the __NCMCP_ prefix. The preload
guard `data.includes("__NCMCP_")` now reliably catches ALL wrapper
artifacts regardless of chunk boundaries.
- Update all filterMcpMarkers regex patterns to match the restructured
wrapper format and renamed variable.
* fix: sync main-process approval timeout with renderer UI cleanup
- When requestApprovalFromRenderer times out, send IPC event
netcatty:ai:mcp:approval-cleared to renderer so stale approval
cards are removed
- Add onMcpApprovalCleared preload bridge for the new IPC channel
- setupMcpApprovalBridge now subscribes to cleared events, removes
timed-out entries from pendingApprovals and notifies clearedListeners
so ChatMessageList drops the stale card
* fix: surface denied inline approvals as errors in UI
- Detect error or denial payloads ("error" string or "ok: false")
returned by tools when the user denies an execution
- Set isError: true on the tool-result message so the ToolCall UI
renders it as a failure (red/rejected) instead of a success (green)
|
||
|
|
17e98090ad |
Add AI support for local terminal sessions (#419)
* Add AI support for local terminal sessions * Fix local AI session metadata and shell safety * Fix local session cloning and multi-exec errors * Refactor local shell detection helpers * Fix local shell helper import path * Fix CJS imports in renderer * Use ESM local shell helpers in renderer * Normalize local shell paths and platform metadata |
||
|
|
b17775307f |
fix: bundle claude-code-acp to prevent crash when binary is missing (#404)
* fix: bundle claude-code-acp to prevent crash when binary is missing (#400) When users select Claude Code in the AI module, the app spawns `claude-code-acp` via ACP. Previously only the `claude` CLI was checked during agent discovery, so if `claude-code-acp` was not on PATH the spawn would fail with ENOENT and crash the Electron main process. - Add `@zed-industries/claude-code-acp` as a bundled dependency - Add `resolveClaudeAcpBinaryPath()` that checks PATH first, then falls back to the npm-bundled binary (mirrors Codex pattern) - Use the resolver in both the primary and fallback ACP provider paths - Update agent discovery to detect agents via bundled ACP binary when the standalone CLI is not installed Closes #400 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: add claude-code-acp and its deps to asarUnpack In packaged Electron builds, files inside app.asar cannot be executed by child_process.spawn. Add claude-code-acp and its runtime dependencies to asarUnpack so the binary is accessible in production. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: migrate from deprecated claude-code-acp to claude-agent-acp The @zed-industries/claude-code-acp package has been renamed to @zed-industries/claude-agent-acp (bin: claude-agent-acp). Update all references across the codebase: - package.json: replace dep with @zed-industries/claude-agent-acp@0.22.2 - electron-builder.config.cjs: update asarUnpack entries, remove stale deps (diff, minimatch) no longer needed by the new package - shellUtils.cjs: update binary name and require.resolve path - aiBridge.cjs: update acpCommand, ALLOWED_AGENT_COMMANDS, isClaudeAgent - settings types, i18n locales: update command references Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
4e2089d7e2 |
feat: add option to auto-open sidebar on host connect (#401)
* feat: add option to auto-open sidebar on host connect Closes #396 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: only auto-open SFTP sidebar for SSH/Mosh connections Use allowlist (ssh, mosh) instead of blocklist so telnet and other non-SSH protocols don't trigger SFTP sidebar which would fail. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: support auto-open SFTP for Quick Connect / temporary sessions Build a minimal Host from session data when hostId is not in the vault, so Quick Connect sessions also trigger auto-open SFTP sidebar. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: sync SFTP auto-open sidebar setting across windows via IPC Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: skip local terminals and preserve username for temp sessions - Don't fallback protocol to 'ssh' so local terminals are excluded - Include session.username in synthesized Host for Quick Connect Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
4e26852482 |
feat: support multimodal attachments in AI chat (#397)
* feat: support multimodal attachments (images, PDFs, files) in AI chat Previously uploaded images were displayed in the UI but never sent to the AI model, and non-image files (PDF, text) were silently rejected. - Rename useImageUpload → useFileUpload; accept image/*, PDF, and text/* - Rename ChatMessageImage → ChatMessageAttachment with filePath support - Build multimodal SDK messages (ImagePart/FilePart) for Catty Agent - Fix ACP agent path: images inline, non-image files via local path hint so ACP agents (Claude Code, etc.) read them with native file access - Use Electron webUtils.getPathForFile() for reliable file path capture - Compact user message bubble padding Closes #294 (AI file upload issues) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: show real tool names in AI chat instead of ACP wrapper names - Unwrap ACP dynamic tool calls in serializeStreamChunk to extract real tool name, args, and toolCallId from chunk.input - Simplify MCP tool name prefixes (mcp__server__tool → tool) - Pass toolCallId from ACP tool-call events to match tool results - Prevent onToolResult from overwriting correct names with wrapper name - Build toolCallNames map in ChatMessageList for tool result display Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: backward-compatible fallback for legacy `images` field in chat messages Persisted sessions may still have `images` instead of `attachments`. Add `?? m.images` fallback in SDK message builder and renderer so historical image attachments are not silently dropped after upgrade. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: broaden file type support and handle pasted files without path - Accept all file types except video/audio (instead of allowlist) so .json, .yaml, .sh, etc. are not silently rejected - For ACP agents, save pasted/virtual files (no filePath) to temp directory so the agent can still read them Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use managed temp dir for pasted ACP attachments Use tempDirBridge.getTempFilePath() instead of manual os.tmpdir() path so pasted file attachments are tracked by the app's cleanup system. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
e35bb708a2 | Show raw AI errors instead of inferred causes | ||
|
|
db9970d040 |
fix: surface streaming provider errors in chat (#386)
* fix: surface streaming provider errors in chat * fix: sanitize streaming status text as ByteString |
||
|
|
3d4fbf8763 |
fix: keep workspace MCP scope in sync (#385)
* fix: keep workspace MCP scope in sync * fix: refresh catty workspace tool context * fix: preserve AI stream state across tab switches * fix: align ACP stop and resume with 1code semantics * fix: harden ACP resume fallback for unsupported agents |
||
|
|
9387590696 |
Fix ACP stop cleanup and cancel state (#384)
* Fix ACP stop cleanup and cancel state * Block ACP tool writes after stop * Kill ACP child processes on cleanup * Cleanup ACP sessions when tabs disappear |
||
|
|
74a04f1d8e |
feat: three-way merge for cloud sync (#381)
Implements automatic three-way merge for cloud sync, replacing the binary USE_REMOTE/USE_LOCAL conflict resolution. Same principle as Git's merge algorithm. After every successful sync, a "base snapshot" is saved (encrypted with AES-256-GCM using the derived master key). When a conflict is detected, the system performs per-entity merge by ID: - Items added on one side → included - Items deleted on one side (unchanged on other) → removed - Items modified on one side only → take that version - Both sides modified same item → prefer local - One side deleted + other modified → keep modification Additional improvements: - Per-provider sync base to prevent cross-provider contamination - Deep merge for nested settings (terminalSettings, customKeyBindings) - Entity merge for array-valued settings (customTerminalThemes) - KnownHost deduplication by (hostname, port, keyType) - Chunked base encoding to avoid stack overflow on large vaults - Base cleared on provider disconnect/reconnect - Correct version numbering after multi-provider merge Closes #378 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
ccfa2d4dd0 |
fix: non-zero exit code is not a failure, include output on real errors (#377)
* fix: treat non-zero exit code as success and include output on failure - Non-zero exit codes (e.g. grep returning 1, ls on missing file) are valid command results, not execution failures. Changed execViaPty and execViaChannel to always return ok:true when the command actually ran. - ok:false is now reserved for real failures: timeout, session gone, stream not writable, etc. - When ok:false, include any partial stdout/stderr in the error message so the user and LLM can see what happened before the failure. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: return stdout+exitCode for all completed commands, clean up dead code - ptyExec: preserve original ok semantics (non-zero = ok:false) so MCP server bridge callers (handleMultiExec, stopOnError) still work - execViaChannel: null exit code (SSH disconnect) returns ok:false - toolExecutors: Catty Agent always returns stdout+exitCode to the LLM regardless of exit code, only treats real failures (timeout, disconnect) as errors — with partial output included - Remove dead code: executeTerminalSendInput, executeSftp*, executeMultiHost - Clean up unused imports, bridge interface, ExecutorContext Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
7c5478b2a5 |
refactor: remove SFTP tools from AI agent (#376)
Remove sftp_list_directory, sftp_read_file, and sftp_write_file tools. The AI can use terminal_execute with standard shell commands (ls, cat, tee, etc.) which is more flexible, supports sudo/pipes/redirects, and reduces tool choice complexity for the LLM. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
fff031eb25 |
fix: remove multi_host_execute and fix MissingToolResultsError (#372)
Remove multi_host_execute tool — the AI can call terminal_execute for each host individually, which is simpler, more reliable, and avoids the hang issue where parallel remote commands block the stream. Fix AI_MissingToolResultsError that occurs after user stops a stream mid-tool-execution: when building SDK messages, skip orphaned tool calls that have no matching tool result instead of including them (which causes the SDK to reject the next message). Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
835a1231a6 |
feat: add skip TLS verification option for self-hosted AI providers (#369)
* feat: add skip TLS verification option for AI providers
Self-hosted AI endpoints (vLLM, text-generation-webui, etc.) often use
self-signed TLS certificates which Node.js rejects by default, causing
502 Bad Gateway errors. Add a per-provider "Skip TLS certificate
verification" checkbox that sets rejectUnauthorized=false on both
streaming and non-streaming requests.
Ref #294
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: surface real error message instead of generic 502 Bad Gateway
- Pass the actual bridge error message in statusText so Vercel AI SDK
shows the real cause (e.g. "HTTP is only allowed for localhost",
"URL host is not in the allowed list", TLS errors)
- Show real error details for 5xx provider errors instead of generic
"The AI provider returned a server error" message
Previously all connection-level errors were masked as "Bad Gateway"
making it impossible for users to diagnose configuration issues.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: pass server error body details through to the user
- Read HTTP error response body before resolving (was resolving before
body was read, losing the error detail)
- Parse OpenAI-compatible JSON error format to extract error.message
- Return error Response with body+statusText for non-2xx instead of
empty stream, so Vercel AI SDK shows the real server error
- Now users see e.g. "502 model not loaded" instead of just "Bad Gateway"
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: widen link modifier key dropdown to prevent text wrapping
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Revert "fix: widen link modifier key dropdown to prevent text wrapping"
This reverts commit
|
||
|
|
6727248924 |
feat: add web search & URL fetch tools for AI agent (#365)
* feat: add web search and URL fetch tools for AI agent Add web_search and url_fetch tools to Catty Agent, allowing the AI to search the internet for current information and fetch webpage content. - Support 5 search providers: Tavily, Exa, Bocha, Zhipu, SearXNG - Settings UI with provider selection, API key encryption, and config - web_search is conditional on config; url_fetch is always available - Both tools are read-only and work in all permission modes (incl. observer) - aiFetch skipHostCheck for AI tool requests to arbitrary URLs - System prompt guidelines for when to use search/fetch - i18n support (en + zh-CN) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address code review findings (SSRF, key exposure, state race) - P1: Restore SSRF protection when skipHostCheck is true — still block localhost, RFC1918, link-local, and cloud metadata endpoints; only skip the domain allowlist for public HTTPS hosts - P2: Move web search API key decryption to main process via dedicated IPC handler, matching the existing provider key security model - P2: Use configRef to avoid stale closure in async settings callbacks that could overwrite newer user changes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address second review — DNS rebinding, url_fetch approval, maxResults - P1: url_fetch now requires approval in confirm mode (outbound GET is a side effect that could exfiltrate data via query strings) - P1: Add DNS resolution check when skipHostCheck is set — resolve hostname and reject if any IP is private/loopback/link-local, blocking DNS rebinding attacks against internal services - P2: Slice search results after provider call to enforce maxResults consistently (Zhipu and SearXNG ignore the limit parameter) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address third review — localhost/IPv6 SSRF, API key blur race - P1: Block localhost/loopback when skipHostCheck is enabled — restructure isAllowedFetchUrl to check private hosts first in the skipHostCheck path, preventing access to local services on allowlisted ports - P1: Handle IPv6 private ranges (fc00::/7, fe80::/10, ::ffff: mapped), strip brackets from URL.hostname, block [::1] and fd00:: addresses - P2: Guard handleApiKeyBlur against provider change during async encryption — skip stale write if provider switched while encrypting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address fourth review — main-process key isolation, SearXNG compat - P1: Replace aiWebSearchDecryptKey IPC with __WEB_SEARCH_KEY__ placeholder pattern — renderer never sees plaintext keys; main process replaces placeholder in headers before HTTP request, matching provider key flow - P1: Search API requests use normal allowlist path (not skipHostCheck), so SearXNG on localhost/HTTP/private networks works via aiSyncWebSearch; only url_fetch uses skipHostCheck for arbitrary public HTTPS URLs - P2: Remove needsApproval from url_fetch — treat as read-only like sftp_read_file, consistent with observer mode allowlist Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address fifth review — private LAN providers, maxResults default - P1: Allow private-IP hosts that are explicitly in the provider/search allowlist (e.g. https://192.168.x.x model providers or SearXNG) - P2: Remove .default(5) from web_search maxResults schema so the user's configured maxResults setting is used when the model omits the param Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address sixth review — HTTPS scope, config gate, redirects - P2: Scope HTTP exception to private/LAN IPs only — remote allowlisted hosts still require HTTPS to protect API keys in transit - P2: Gate web_search tool on complete config (API key for providers that require it, apiHost for SearXNG) to avoid advertising a broken tool - P2: Add redirect following (up to 5 hops) to aiFetch for url_fetch — handles 301/302/307 for short links, www canonicalization, etc. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address seventh review — redirect SSRF, decrypt race, HTTPS-only - P1: Revalidate each redirect hop against SSRF guards (allowlist check + DNS resolution) before following, preventing open-redirect SSRF - P2: Add sequence counter to API key decryption effect — stale promise results from a previous provider are discarded on provider switch - P3: Restrict url_fetch to HTTPS-only URLs, matching the skipHostCheck policy that already rejects HTTP in the bridge Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address eighth review — OS resolver, allowlisted HTTP hosts - P1: Use dns.lookup (OS resolver) instead of dns.resolve4/6 for private IP checks — matches what http.request actually connects to, respects /etc/hosts, mDNS, and other local resolver sources - P2: Allow HTTP for any explicitly allowlisted host (not just literal private IPs), so self-hosted SearXNG at http://searxng.lan works Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address ninth review — HTTP scope, blur ordering, decrypt flag - P1: Narrow HTTP exception to web search apiHost only — AI provider endpoints remain HTTPS-only to protect credentials in transit - P2: Add blur sequence counter to prevent out-of-order encryption results from overwriting newer API key saves - P2: Reset isDecrypting flag when cancelling decrypt on provider switch, preventing permanently disabled API key input Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address tenth review — DNS pinning, prompt/tool alignment - P1: Pin validated DNS result to the HTTP request via custom lookup function, preventing TOCTOU/DNS-rebinding between validation and actual connection - P2: Extract isWebSearchReady() helper and use it consistently in both tool registration and system prompt, so the model isn't told web search is available when config is incomplete Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address eleventh review — single DNS lookup, redirect pinning, CGNAT - P1: Combine DNS validation and pinning into a single lookup call, eliminating the TOCTOU window between hasPrivateResolution and pinnedLookup - P1: Pin DNS for redirect targets too — resolve/validate/pin in one step before following each redirect hop - P2: Add 100.64.0.0/10 (CGNAT) to private IP ranges for Tailscale and similar CGNAT-addressed internal services Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address twelfth review — apiHost validation, sync on enable - P2: Validate apiHost is a well-formed URL in isWebSearchReady(), preventing tool exposure when user enters a malformed host - P2: Add webSearchConfig.enabled to sync effect deps so the main process gets updated immediately when the toggle changes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: remove DNS-level SSRF checks that break fakedns/proxy environments DNS resolution validation (dns.lookup + IP pinning) breaks in proxy environments where fakedns resolves all domains to LAN addresses. Revert to hostname-level checks only (blocking localhost, 127.0.0.1, metadata endpoints, etc.) which are sufficient without false positives. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: resolve empty catch block lint warning Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
ec35daa0dd |
feat: add auto-update toggle setting (#351)
* feat: add auto-update toggle setting (closes #346) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: re-check auto-update toggle when startup timer fires Address review feedback: the startup check effect now re-reads the toggle from localStorage when the delayed timer fires, so toggling off after launch cancels the pending check. Also avoids setting hasCheckedOnStartupRef when disabled, allowing re-enable to trigger a check without restart. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address review feedback on auto-update toggle P1: When autoDownload=false, onUpdateAvailable no longer transitions to 'downloading' status. Instead keeps autoDownloadStatus idle so the manual download link surfaces correctly. P2: Added reactive autoUpdateEnabled state (synced via storage event) as a dependency to the startup check effect. Re-enabling the toggle mid-session now re-triggers the deferred startup check. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address P1/P2 review feedback on auto-update toggle P1: Main process update-available handler now checks updater.autoDownload before setting _lastStatus to 'downloading'. When autoDownload=false, status stays 'idle' so late-opened windows don't hydrate to a stuck 0% download state. P2: useUpdateCheck now accepts autoUpdateEnabled as a prop from the caller instead of relying solely on storage events (which don't fire in the same window). SettingsPage passes settings.autoUpdateEnabled directly, so toggling in the current window takes effect immediately. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: preserve update-available info for late-opening windows When autoDownload is off, use status 'available' (instead of 'idle') in the main process snapshot so late-opening windows can hydrate version info. The renderer maps 'available' to hasUpdate=true while keeping autoDownloadStatus='idle' for the manual download path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: re-schedule auto-check on re-enable and guard startup timer - IPC handler now calls startAutoCheck(2000) when re-enabling so the user gets automatic checks without restarting the app. - startAutoCheck timer checks updater.autoDownload at fire time, so if the renderer disables auto-update via IPC before the 5s startup timer fires, the check is skipped. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: deduplicate auto-check scheduling and clear error on fallback success P1: startAutoCheck now cancels any existing timer before scheduling a new one, preventing duplicate concurrent checks from multiple windows or re-enable toggles. P2: checkNow fallback now clears manualCheckStatus='error' when electron-updater successfully finds an update (res.available=true), so the UI shows 'available' instead of a stale error state. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: only reschedule on actual re-enable and hydrate cache before toggle check P2: Track previous autoDownload state in IPC handler so startAutoCheck is only called on actual false→true transitions, not on every window mount that syncs the current value. P3: Move cache hydration (STORAGE_KEY_UPDATE_LATEST_RELEASE) before the auto-update toggle check so cached update info is always visible even when automatic updates are disabled. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: persist auto-update preference in main process across restarts Read/write auto-update preference to a JSON file in userData so the main process honors it on next launch without waiting for renderer IPC. getAutoUpdater() now initializes autoDownload from the persisted value. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: suppress cached update toast when disabled and update IPC types P2: Cache hydration now gates hasUpdate on autoUpdateEnabled so the App.tsx toast doesn't fire when automatic updates are disabled. P3: Updated global.d.ts to include 'available' in getUpdateStatus status union and 'checking' in checkForUpdate return type. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: preserve dismissed releases, show cached updates in Settings, guard concurrent checks P2a: Updater fallback now checks STORAGE_KEY_UPDATE_DISMISSED_VERSION before re-surfacing a release found by electron-updater. P2b: Cache hydration always sets hasUpdate truthfully so Settings shows the available update. Toast suppression for disabled auto-update moved to App.tsx (reads localStorage directly). P3: Re-enable IPC handler checks _isChecking before scheduling startAutoCheck to prevent concurrent electron-updater calls. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use localStorageAdapter for lint compliance, skip IPC on initial mount P1: Replace direct localStorage access with localStorageAdapter in App.tsx toast guard to fix no-restricted-globals lint error. P2: Skip setAutoUpdate IPC on initial mount to prevent overwriting the main-process preference file when renderer localStorage has been cleared (where the default would be true). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: hydrate auto-update state from main-process preference on mount Add getAutoUpdate IPC handler so the renderer can query the persisted preference from auto-update-pref.json. On mount, useSettingsState reconciles localStorage with the main-process truth, preventing the toggle from showing 'enabled' when the user had previously disabled it and localStorage was cleared. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
1f31629ce0 |
feat: add global hotkey enable/disable toggle (closes #349)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
b973382f9f |
fix: return real HTTP status in streaming bridge and dynamic provider URL allowlist
- streamRequest now resolves on headers arrival with statusCode/statusText so the renderer constructs Response with the real HTTP status (e.g. 401) instead of hardcoded 200 - Provider fetch URL allowlist is now dynamically rebuilt from configured provider baseURLs on sync, supporting custom provider endpoints - Localhost port allowlist properly resets on provider sync (no stale ports) - PTY marker detection requires line-boundary match to avoid false positives - Clarify terminal_send_input vs terminal_execute usage in tool descriptions and system prompt Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
eeb300295d |
refactor: improve security, accessibility, performance, and code organization
- Security: API keys no longer transit IPC as plaintext; renderer sends providerId and main process decrypts via safeStorage. Add ReDoS protection for user-supplied blocklist regex. Sanitize error messages to strip file paths and sensitive URLs before displaying in chat. - Bug fixes: approval timeout now notifies user in chat instead of silently aborting. statusText cleared consistently across all 7 code paths. useAIState persistence race condition fixed with mountedRef guard, storage sync validated with type checks. - Accessibility: InlineApprovalCard uses role="alertdialog" with focus on approve button. ChatInput menus have proper ARIA roles, labels, and aria-expanded. ThinkingBlock toggle has aria-expanded/controls. Model selector submenu supports keyboard navigation. - UX: switching agents preserves old session and creates new one. Approval card buttons disabled immediately after click. - Performance: text-delta streaming batched via requestAnimationFrame. - Refactor: extract useAIChatStreaming, useToolApproval, and useConversationExport hooks from AIChatSidePanel (1514 → 751 lines). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
be36ccd167 |
fix: address security, correctness, and performance issues from code review
Security: add validateSender to agent IPC handlers, remove CODEX_API_KEY and NODE_PATH from SAFE_ENV_KEYS, validate URL scheme before openExternal, add backtick substitution to command blocklist, add 10MB buffer limits. Bugs: fix runExternalAgentTurn timeout hang, fix limitConcurrency undefined entries on error, treat null exitCode as failure, enforce maxBytes for SFTP reads. Performance: debounce addMessageToSession persistence, cache compiled blocklist regexes, add QuotaExceededError handling for localStorage writes. UI: use local onKeyDown for PermissionDialog, move CRITICAL_PATHS to module level. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
71b13a77a3 |
fix: address security, correctness, and performance issues from code review
Security: validate agent spawn commands against allowlist, replace execSync with execFileSync in agent discovery, restrict localhost SSRF to known ports, add observer mode enforcement at IPC layer, add IPC sender validation, expand dangerous env key blocklist, add pending approval timeout. Correctness: replace updateLastMessage with ID-based updateMessageById to fix race condition during streaming, include tool-call/tool-result messages in SDK context, flush debounced persist on unmount, fix ACP client break placement, use proper AI SDK message types. Performance: pre-compile command blocklist regexps, extract shared tool executors to deduplicate executor.ts and tools.ts (~50% reduction each). Also: i18n for hardcoded English strings, remove dead detectDoomLoop code, add bypass-resistant blocklist patterns, include permissionMode in ACP provider reuse fingerprint. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
808d021ebe |
fix: address security, correctness, and performance issues from code review
- Use crypto.randomBytes for PTY markers instead of Math.random - Replace execSync with execFileSync to prevent command injection - Fix sftp_write_file missing safety check (pass path to guardWriteOperation) - Add IPC input validation for handleExec, handleSftpRead, handleMultiExec - Add maxBytes bounds validation in executor, tools, and MCP server - Fix approval race condition (clear ref after destructuring, strict messageId match) - Shorten API key plaintext lifetime in memory - Fix stream cancellation race with AbortController registered before request - Delay revokeObjectURL for download timing - Extract shared limitConcurrency to infrastructure/ai/concurrency.ts - Add execStream null check in execViaChannel Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
b192ee1764 |
fix: address security, correctness, and performance issues from code review
Security: sanitize command input in resolveCliFromPath, add host allowlist to streaming endpoint, enforce permission model in MCP server tools, add safety check to terminal:write IPC, fix broken blocklist regex, remove renderer-controlled allowedHosts parameter. Correctness: use sessionsRef for latest state in handleSend, merge add+update to avoid race condition in streaming, mark assistant message completed after tool-result, return JSON-RPC error for unhandled ACP permission requests, add finished guard in ptyExec. Performance: custom React.memo comparator for ChatMessageList, fix doom loop detection threshold. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
0b9cb86c4e |
fix: address security and correctness issues from code review
- Add command blocklist check to terminal_send_input (executor + SDK tools) - Add session scope validation to all tools in executor.ts - Fix abort handler to call aiChatCancel instead of aiChatStream - Enforce URL allowlist in fetch proxy to prevent SSRF - Wrap event.sender.send with safeSend for destroyed window check - Filter dangerous env vars (LD_PRELOAD, NODE_OPTIONS, etc.) from agent spawn - Fix stale debouncedPersistSessions closure using sessionsRef - Fix cleanupOrphanedSessions race when sessions load before workspaces - Fix limitConcurrency implementation using Set + finally pattern - Improve command blocklist regex patterns with word boundaries - Add regex validation with error feedback in SafetySettings - Add confirmation dialog for provider removal - Fix React key warning for tool-role messages in ChatMessageList - Remove debug console.warn in TerminalLayer - Remove unused nanoid dependency - Remove redundant platform-specific codex-acp binary from dependencies Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |