陈大猫 and Claude Opus 4.6
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 >
2026-03-26 14:14:37 +08:00
陈大猫 and Claude Opus 4.6
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 >
2026-03-26 12:51:43 +08:00
陈大猫 and Claude Opus 4.6
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 >
2026-03-26 12:04:17 +08:00
陈大猫 and Claude Opus 4.6
c49346f6cc
fix: 编辑器查找/替换输入框无法粘贴内容 ( #512 ) ( #515 )
...
自定义粘贴处理器拦截了所有 Ctrl+V 事件,包括查找/替换控件内的输入框。
当焦点在 .find-widget 内时,改为读取剪贴板并直接插入到输入框中,
而非将内容粘贴到编辑器主体。
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
v1.0.68
2026-03-26 02:59:52 +08:00
陈大猫 and Claude Opus 4.6
39a398aa2b
SFTP 右键菜单添加「复制文件路径」功能 ( #514 )
...
* feat(sftp): add "Copy file path" to right-click context menu (#507 )
Add a context menu item that copies the full remote file/directory path
to clipboard using navigator.clipboard.writeText(). Works for both
files and directories.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
* fix: 使用 joinPath 构建复制路径,修复 Windows 路径分隔符问题
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
* fix: joinPath 去除 Unix 路径尾部多余斜杠
避免 currentPath 带 trailing slash 时产生双斜杠路径(如 /var/log//syslog)。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-03-26 02:57:59 +08:00
陈大猫 and Claude Opus 4.6
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 >
2026-03-26 02:47:50 +08:00
陈大猫
cb63f105aa
Merge pull request #513 from crawt/feat/remove-root-paint-polling-use-renderer-ready
...
Feat/remove root paint polling use renderer ready
2026-03-26 00:20:21 +08:00
panwk
316e46de4b
Mod:Removed waitForRootPaint polling helper from electron/bridges/windowManager.cjs.
...
Removed did-finish-load polling trigger that called markRendererReady via DOM child count checks.
Kept deferred show behavior based on:
ready-to-show
renderer-ready IPC from renderer
timeout fallback (dev and prod values unchanged)
2026-03-25 23:48:56 +08:00
panwk
1af5182b59
Merge branch 'main' of https://github.com/crawt/Netcatty
2026-03-25 23:42:06 +08:00
陈大猫
35194036cb
Merge pull request #502 from crawt/perf/settings-window-prewarm-hide-on-close
...
perf(settings): prewarm settings window and hide on close
v1.0.67
2026-03-25 01:24:48 +08:00
陈大猫
6a077a3855
Merge pull request #501 from binaricat/codex/optimize-ai-panel-tab-switch
...
Optimize AI panel tab switching
2026-03-25 01:19:30 +08:00
bincxz
43f4687bb9
Keep AI panel UI inside side panel layout
2026-03-25 01:13:49 +08:00
bincxz
bbb888ae1e
Keep AI state mounted when side panels close
2026-03-25 01:09:36 +08:00
bincxz
c74b78a49d
Reconcile AI session state with live sessions
2026-03-25 01:03:34 +08:00
panwk
7b2590e54e
Merge branch 'main' of https://github.com/crawt/Netcatty
2026-03-25 01:03:00 +08:00
bincxz
a7f42ec93e
Avoid dropping unflushed AI sessions during cleanup
2026-03-25 00:57:48 +08:00
panwk
a886d509f8
perf(settings): prewarm settings window and hide on close
...
Instead of creating a new BrowserWindow on each user click, the settings window is now:
1. Pre-warmed silently 3 s after app startup (showOnLoad: false)
2. Hidden instead of destroyed when the user closes it
3. Instantly shown/focused on subsequent opens
2026-03-25 00:54:32 +08:00
bincxz
d6fea6c328
Preserve AI session state and cleanup across panel unmounts
2026-03-25 00:52:33 +08:00
bincxz
b6169f1735
Optimize AI panel tab switching
2026-03-25 00:46:59 +08:00
陈大猫
c97470a085
Merge pull request #500 from binaricat/codex/preserve-vault-hosts-state
...
Preserve vault hosts state across section switches
2026-03-25 00:38:10 +08:00
bincxz
98cb9d09df
Preserve vault hosts state across vault section switches
2026-03-25 00:37:56 +08:00
陈大猫
9deb39dec2
Merge pull request #499 from binaricat/codex/jump-host-proxy-support
...
Support proxy config on jump hosts
2026-03-25 00:32:09 +08:00
bincxz
bb45279d4e
Track jump-host proxy socket during chain setup
2026-03-25 00:23:55 +08:00
bincxz
6b1d9ee409
Gate jump-proxy checks on usable endpoints
2026-03-25 00:16:16 +08:00
bincxz
c0c0378df0
Ignore incomplete jump-host proxy configs
2026-03-25 00:09:26 +08:00
bincxz
093951150c
Only validate first-hop jump proxies
2026-03-25 00:06:00 +08:00
bincxz
a0418039c4
Prefer jump-host proxy over target proxy guards
2026-03-25 00:04:35 +08:00
bincxz
559e71cfcc
Block jump-host proxy auth placeholders
2026-03-25 00:02:59 +08:00
bincxz
a0a2567fa5
Validate jump-host proxy credentials early
2026-03-25 00:01:24 +08:00
陈大猫
d080a43ae6
Merge pull request #497 from crawt/feat/electron-v8-cache-lazy-bridges
...
feat(electron): enable V8 code cache and lazy-load non-critical bridges
2026-03-25 00:00:21 +08:00
bincxz
2c551cf5e8
Sanitize proxy credentials for jump hosts
2026-03-24 23:58:35 +08:00
bincxz
c54aa52191
Support proxy config on jump hosts
2026-03-24 23:56:28 +08:00
陈大猫
b8c838059a
Merge pull request #496 from binaricat/codex/port-forward-jump-hosts
...
Support jump hosts for port forwarding
2026-03-24 23:55:00 +08:00
bincxz
007b4bd389
Treat cancelled port-forward setup as non-error
2026-03-24 23:50:00 +08:00
bincxz
13fd198243
Allow cancelling proxy setup for port forwarding
2026-03-24 23:48:29 +08:00
bincxz
2c562463c4
Respect cancellation during port-forward startup
2026-03-24 23:47:45 +08:00
bincxz
859d4b8156
Fix auto-start auth readiness checks
2026-03-24 23:45:54 +08:00
bincxz
c6e07cf149
Clean up port forwarding auto-start lint
2026-03-24 23:45:26 +08:00
bincxz
0ab18ce186
Fix port forwarding startup and cleanup races
2026-03-24 23:45:02 +08:00
bincxz
f814719b32
Fix jump-host port forwarding edge cases
2026-03-24 23:43:03 +08:00
bincxz
ee6b05892d
Support jump hosts for port forwarding
2026-03-24 23:36:13 +08:00
陈大猫
0f98ffd4f7
Merge pull request #494 from binaricat/codex/ai-command-exec-fixes
...
Fix AI terminal execution completion and tool UI
2026-03-24 23:22:44 +08:00
bincxz
7ca5d0c832
Track pending ACP cancels during startup
2026-03-24 23:04:08 +08:00
bincxz
1a76d34696
Handle ACP startup cancellation and cmd echo
2026-03-24 23:01:41 +08:00
bincxz
0b2d1b613b
Tighten prompt fallback matching
2026-03-24 22:59:35 +08:00
bincxz
ded989b374
Harden cmd tool-call echo handling
2026-03-24 22:57:18 +08:00
bincxz
04c6348bc0
Fix cmd wrapper variable expansion
2026-03-24 22:55:42 +08:00
bincxz
54297859e3
Fix AI cancellation and shell wrapper edge cases
2026-03-24 22:54:17 +08:00
panwk
d236adcd48
1.Enable V8 code caching for BrowserWindow instances by setting webPreferences.v8CacheOptions to bypassHeatCheck
...
2.Reduce eager main-process module loading by replacing several top-level bridge require() calls in main.cjs with lazy module getters
2026-03-24 22:48:15 +08:00
bincxz
4971f18bbe
Fix AI terminal execution completion and tool UI
2026-03-24 22:41:40 +08:00