Skip to content

feat: 统一聊天面板(官方 shadcn)+ 1.3.14 审计修复批 + CVE 补丁#767

Merged
appergb merged 7 commits into
betafrom
fix/audit-1.3.14-followups
Jul 6, 2026
Merged

feat: 统一聊天面板(官方 shadcn)+ 1.3.14 审计修复批 + CVE 补丁#767
appergb merged 7 commits into
betafrom
fix/audit-1.3.14-followups

Conversation

@appergb

@appergb appergb commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

User description

概要

三块内容打包:1.3.14 审计修复批、tauri-plugin-shell CVE 补丁、划词追问 / Less Computer 浮窗全量重做(官方 shadcn base 组件)。

统一聊天面板(用户逐条验收的六项修正)

组件库(src/components/chat/):

  • @shadcn/react 官方 primitive + base-rhea registry 原文内嵌(message-scroller/marker/bubble/message/card/empty/input-group/button/input/textarea/spinner),仅按 CLI 规则改 import;button 保留 3 行 React18 inert 归一
  • Tailwind v4 作用域隔离:utilities source(none) + @source 只扫聊天文件、无层导入,主窗口样式零污染(实测)
  • 官方主题 shadcn/tailwind.css + tw-animate-css(shimmer/scroll-fade/scrollbar 全官方定义)
  • 平台门控:非 darwin 构建 DCE 掉 Less Computer chunk

六项体验修正:

  1. 主窗口不再被带出:QA/LC 窗口转非激活 NSPanel(胶囊同管线),焦点命令改主线程 makeKeyAndOrderFront —— 打字不激活 app;frontmost 保持用户原 app,顺带根治划词选区多轮丢失
  2. 划词追问重写为官方 message-scroller-demo 骨架:Card(24px 圆角)+ Message 带头像(右 GitHub / 左旋转 orb)+ Empty 空状态 + InputGroup
  3. 语音状态只在输入区:录音红光 / 转译黑光绕输入组跑圈(conic 彗尾 + @Property 角度动画),问题落定即停;header 副行固定欢迎语
  4. 思考头像不先于用户消息出现(修动画抽搐):thinkingRow 门控 lastRole==='user'
  5. 纯白背景(米白 → oklch(1 0 0))
  6. 出现/消失动画:show 发 chat-panel:shown、hide 先发 chat-panel:closing 240ms 后真隐藏(AtomicU64 世代防快速关-开竞态)

两个真机 bug 根修:

  • Command qa_submit_text not found:桌面 invoke_handler 此前误删 qa_submit_text/qa_toggle_recording(与 qa_window_pin 相邻),已恢复
  • LC「AI 在干活但面板不显示用户的话」:webview 冷加载丢首条 user 事件 —— 事件按全局单调 seq 入环形缓冲(fresh 清空/cap 2048),新命令 less_computer_sync 供 mount 重放,前端按 seq 去重衔接(+2 单测)

审计修复批(558fb51)

Apple Speech 取消泄漏 / IME 未安装分支设置保存锁死 / 侧向键 Released 卡死 + macOS 竞态 + Linux 拒绝 / 火山 429 / clippy 回归 / 前端 clamp + 失败反馈

依赖

  • 新增:tailwindcss v4、@tailwindcss/vite、@base-ui/react、@shadcn/react、cva、clsx、tailwind-merge、lucide-react;devDeps:shadcn(官方主题 CSS)、tw-animate-css
  • 安全:tauri-plugin-shell CVE 补丁(GHSA-c9pr-q8gx-3mgp)

验证

  • cargo test 554/554(新增 LC 事件缓冲 2 例)
  • tsc + vite 生产构建绿;dmg 实机六项验收通过
  • macOS 本地绿;Windows/Android/Linux 侧请以本 PR CI 为准

PR Type

Bug fix, Enhancement, Tests


Description

  • Fix critical bugs: Apple Speech cancel, IME lock, hotkey stuck, volcano 429

  • Unify chat panel with official shadcn/ui components and nonactivating NSPanel

  • Add event buffer for Less Computer cold-start, improve SendInput consistency

  • Add comprehensive tests for all fixes and self-healing logic


Diagram Walkthrough

flowchart LR
  apple_speech["Apple Speech cancel"] --> cancel["SendableTask + poll"]
  ime_lock["IME save lock"] --> shortcut["keyboard_list_pref_short_circuit"]
  hotkey_stuck["Side-aware combo stuck"] --> self_heal["self-healing Released"]
  volcano_429["Volcengine 429"] --> non_retry["rate-limited short-circuit"]
  chat_panel["Unified chat panel"] --> components["shadcn/ui components"]
  chat_panel --> nspanel["Nonactivating NSPanel"]
  chat_panel --> animation["Animated hide"]
  chat_panel --> event_buffer["Event buffer for Less Computer"]
  sendinput["SendInput typing"] --> consistency["classify_sendinput_char single truth"]
Loading

File Walkthrough

Relevant files
Enhancement
29 files
lib.rs
Convert chat panels to nonactivating NSPanel and add animated hide
+111/-83
dictation.rs
Add event buffer for Less Computer cold-start window         
+103/-2 
qa.rs
Add chat panel focus keyboard command and less computer sync
+67/-9   
avatars.tsx
Add chat avatar components: ThinkingOrb, OrbAvatar, UserAvatar
+148/-0 
input-group.tsx
Add shadcn InputGroup component for chat                                 
+155/-0 
bubble.tsx
Add shadcn Bubble component for chat                                         
+128/-0 
orbFeed.ts
Create shared orb rendering feed for chat avatars               
+129/-0 
types.ts
Add event sequence number to LessComputerEvent type           
+7/-2     
message-scroller.tsx
Add shadcn MessageScroller component                                         
+128/-0 
button.tsx
Add shadcn Button component                                                           
+62/-0   
card.tsx
Add shadcn Card component                                                               
+100/-0 
empty.tsx
Add shadcn Empty component                                                             
+105/-0 
message.tsx
Add shadcn Message component                                                         
+92/-0   
index.ts
Add chat index export                                                                       
+64/-0   
marker.tsx
Add shadcn Marker component                                                           
+71/-0   
lifecycle.ts
Add chat lifecycle management                                                       
+51/-0   
markdown.tsx
Add markdown component for chat                                                   
+40/-0   
input.tsx
Add shadcn Input component                                                             
+20/-0   
textarea.tsx
Add shadcn Textarea component                                                       
+18/-0   
chat-panel.ts
Add IPC chat-panel module                                                               
+13/-0   
spinner.tsx
Add shadcn Spinner component                                                         
+18/-0   
utils.ts
Add chat utility functions                                                             
+7/-0     
chat.css
Add chat CSS styles                                                                           
+341/-0 
LessComputerPanel.tsx
Update LessComputerPanel for unified shadcn UI                     
+400/-639
QaPanel.tsx
Update QaPanel for unified shadcn UI                                         
+324/-659
App.tsx
Update App for new chat panel windows                                       
+16/-10 
less-computer.ts
Update less-computer IPC for sync and focus                           
+7/-9     
index.ts
Update IPC index with new commands                                             
+4/-2     
qa.ts
Update QA IPC for new commands                                                     
+0/-4     
Bug fix
8 files
apple_speech_provider.rs
Fix Apple Speech cancellation with SendableTask and polling
+181/-10
side_aware_combo.rs
Add self-healing for side-aware combo stuck and race-free flags
+248/-7 
unicode_keystroke.rs
Unify SendInput character classification to prevent fallback
misdetection
+90/-40 
volcengine.rs
Classify 429 as RateLimited and skip retry                             
+85/-5   
windows_ime_profile.rs
Fix IME save lock by short-circuiting uninstall keyboard list pref
+83/-8   
hotkey_loops.rs
Fix hotkey loops clippy warnings                                                 
+0/-1     
Heatmap.tsx
Fix Heatmap clamp                                                                               
+4/-0     
PermissionsSection.tsx
Update PermissionsSection for IME changes                               
+8/-2     
Refactoring
3 files
coordinator.rs
Refactor coordinator to use shared dictation helpers         
+4/-15   
SiriGL.tsx
Refactor SiriGL to use hostRef and export shaders for orbFeed
+29/-10 
qa.rs
Refactor QA coordinator for unified chat panel                     
+0/-5     
Tests
1 files
insertion.rs
Update insertion tests to use expected_sendinput_typed_chars
+11/-3   
Documentation
5 files
zh-TW.ts
Update Chinese Traditional i18n                                                   
+2/-1     
ja.ts
Update Japanese i18n                                                                         
+2/-1     
ko.ts
Update Korean i18n                                                                             
+2/-1     
zh-CN.ts
Update Chinese Simplified i18n                                                     
+2/-1     
en.ts
Update English i18n                                                                           
+2/-1     
Configuration
2 files
vite.config.ts
Update Vite config for Tailwind v4 scope                                 
+4/-1     
tauri.conf.json
Update Tauri config for chat panels                                           
+1/-1     
Dependencies
1 files
package.json
Update package.json dependencies                                                 
+17/-1   
Additional files
3 files
Marker.tsx +0/-103 
MarketplaceModal.tsx +0/-130 
MessageScroller.tsx +0/-222 

sim added 7 commits July 5, 2026 00:28
@tauri-apps/plugin-shell (npm) 与 tauri-plugin-shell (crate) 的声明下限
——npm `^2.0.1`、crate `"2"`——都落在 GHSA-c9pr-q8gx-3mgp 影响范围
(`< 2.2.1`,CRITICAL:`open` 端点作用域校验绕过,可致 RCE)。本项目
src/lib/ipc/utils.ts 正是通过该 `open` 端点打开外链,属受影响用法。

两个 lockfile 实际已解析到 2.3.5,但清单声明的下限仍是漏洞版本,供应链
扫描(SkillSpector SC4)因此读取到 2.0.1 报警。此处仅把两侧声明下限抬到
最新安全版 2.3.5,使清单与锁定版本一致、扫描不再命中;解析版本不变,无
运行时行为变化。

Closes #668
- CRIT Apple Speech 取消/超时不终止 SFSpeechRecognitionTask(SendableTask+cancel_flag+[task cancel]+100ms 轮询)
- HIGH windows_ime 未安装分支反致设置保存事务锁死(抽纯函数 keyboard_list_pref_short_circuit)
- HIGH 侧向键 Released 卡死自愈 + macOS flags 类位竞态 + Linux 显式拒绝
- HIGH coordinator/hotkey_loops unused_assignments clippy 回归
- MED 火山 429 限流不重试(RateLimited)/ Heatmap clamp / 授权失败反馈 / SendInput 分类单一真相 / SendInputOptions 收敛
- 清理 删死码 ?? '重启' / side_aware 死字段 / 孤儿 MarketplaceModal

cargo test 552-0 / npm build 绿。windows cfg 部分需 CI 四平台验证。
@shadcn/react 官方 primitive + base-rhea registry 原文内嵌 components/chat/ui/
(message-scroller/marker/bubble/message/card/empty/input-group/button/input/
textarea/spinner,仅按 CLI 规则改 import 路径;button 保留 3 行 React18 inert
归一)。Tailwind v4 作用域隔离:utilities source(none) + @source 只扫聊天文件、
无层导入压过 global.css;官方主题 shadcn/tailwind.css + tw-animate-css。
胶囊同款思考动画(orbFeed 单 GL 源镜像多头像)、GitHub 头像(CSP img-src 放行)、
出现/消失生命周期 hook。平台门控:非 darwin 构建 DCE 掉 Less Computer chunk。
删除旧自制 Marker/MessageScroller 组件。
Card + Empty + InputGroup + MessageScroller 官方组合;QA=Message 带头像形态
(右 GitHub / 左旋转 orb),LC=Marker 工具行形态(无头像)。
语音状态只在输入区:录音红光/转译黑光绕输入组跑圈,问题落定即停;
思考头像行门控在用户消息落定之后(修「AI 头像先出现、动画抽搐」)。
LC 事件空轮自愈 + mount 后 less_computer_sync 重放(webview 冷加载丢
user 事件导致「后端在跑前端空白/用户的话不显示」)。纯白背景、官方
24px 圆角、出现/消失动画(chat-panel:shown/closing)。
- 恢复桌面 invoke_handler 的 qa_submit_text / qa_toggle_recording(此前删
  qa_window_pin 时误删相邻项,真机报 Command qa_submit_text not found)
- QA/LC 窗口转非激活 NSPanel(胶囊同管线:NonactivatingPanelMask +
  CanJoinAllSpaces|FullScreenAuxiliary),chat_panel_focus_keyboard 改主线程
  makeKeyAndOrderFront:打字不激活 app、主窗口不再被带出、frontmost 保持
  用户原 app(划词选区在多轮期间仍可读)
- Less Computer 事件按全局单调 seq 写入环形缓冲(fresh user 清空、cap 2048
  丢最旧),新命令 less_computer_sync 供前端 mount 重放(仅 less-computer
  窗口可调);附 2 个单测
- show/hide 生命周期:show 发 chat-panel:shown 并作废挂起 hide;hide 先发
  chat-panel:closing、240ms 后真正隐藏(AtomicU64 世代防快速关-开竞态)
- QA/LC 窗口统一固定 420×540;删除 qa_window_pin / less_computer_window_resize
  整链(无消费方)
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

@appergb

appergb commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

自审记录(两路独立审查,双 Approve)

Rust 侧(scope: src-tauri 全部 diff;cargo check/test 554-0 复跑):

  • ✅ epoch 世代方案在 hide→show→hide / show→hide→show 交错下人工推演无竞态窗口(每次 hide 取新鲜 token、show 无条件推进、hide 幂等)
  • ✅ NSWindow/NSPanel 操作全部经 run_on_main_thread;objc2::exception::catch 的 unsafe 作用域与 SAFETY 注释对照 objc2 0.6.4 源码核实正确
  • ✅ 事件缓冲锁临界区仅内存操作无 I/O/await;10 个 emit 调用点逐一确认 payload 有界;锁中毒降级为跳过缓冲照常 emit
  • ✅ 跨平台 cfg:android 早返回路径、hide 的 cfg 子集关系、Windows/Linux 编译路径逐一核对
  • ⚠️ LOW ×1(非阻塞):chat_panel_focus_keyboard 的 run_on_main_thread Result 被吞——与同文件 show_*_window 既有约定一致,保持现状

TypeScript 侧(scope: src 全部 diff;tsc 零错误):

  • ✅ LC 事件同步协议(listener 先行→sync 重放→pending 放行→seq 去重)取消/竞态路径完整
  • ✅ 模块级去重水位在 StrictMode 双挂载下不重放、webview 重载归零语义自洽
  • ✅ applyEvent 全函数式 setState 无 stale read;orbFeed 引用计数正确释放 GL;markdown 双重 XSS 防护
  • ✅ Android embedded 模式回归确认无副作用;删除组件无残留 import
  • ⚠️ MEDIUM 观察 ×1(非缺陷):列表 index key 在「只整体替换或尾部追加」的数据流下安全

结论:无 CRITICAL/HIGH,不需要改动。等 CI 四平台绿后合并。

@H-Chris233 H-Chris233 self-assigned this Jul 6, 2026

@H-Chris233 H-Chris233 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

经过一轮验证,未发现明显问题。建议进行实机测试后合并。

@appergb appergb merged commit d8789c7 into beta Jul 6, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants