feat: 跨平台 Tauri 2 重写(macOS + Windows)#8
Merged
Merged
Conversation
整套新代码放在 openless-all/ 目录下,与原 Swift 项目并行不冲突。 代码结构: - openless -all/app/src/ React + TS UI(参考 design_handoff_openless 实现) - openless -all/app/src-tauri/ Rust 后端(8 模块,与 Swift 库一一对应) - openless -all/app/scripts/ 构建脚本(macOS Info.plist 后注入 + ad-hoc 重签) - .github/workflows/release-tauri.yml 推 v*-tauri tag 触发 macOS+Windows 矩阵构建 后端模块: - hotkey: macOS CGEventTap 原生 FFI / 其他 rdev;自动重试,Accessibility 一授权立即接管 - recorder: cpal 16kHz Int16 PCM - asr: Volcengine SAUC bigmodel WebSocket(二进制帧 + 热词 context 注入) - polish: OpenAI 兼容 Chat Completions(中文 prompt 一字不改自 Swift) - insertion: macOS CGEventPost 原生 FFI 模拟 Cmd+V / 其他 enigo;不再用 enigo on macOS(TSM 主线程断言坑) - persistence: ~/.openless/credentials.json v1 schema(同 Swift dev 路径,不走 Keychain 避免 ad-hoc 签名换 hash 反复弹框) - coordinator: 状态机(idle/listening/processing),emit capsule:state 给胶囊窗口 - permissions: AVAudioApplication.recordPermission(同 Swift,与 cpal/AVAudioEngine 共享权限轨道) UI: - FloatingShell 主窗 + 5 tab(概览/历史/词汇表/风格/设置) - Capsule 浮动胶囊(176×42 浅色磨砂 + 5 根 audio bars envelope,与 Swift CapsuleView 同源) - 菜单栏托盘(LSUIElement = true,无 Dock 图标,关红按钮 = 隐藏) - Onboarding 首次运行权限引导(辅助功能 + 麦克风) 跨平台已知限制: - macOS:ad-hoc 签名,首次启动需要"右键 → 打开"或在 Gatekeeper 弹窗里点"仍要打开" - Windows:无证书,SmartScreen 会警告
There was a problem hiding this comment.
Sorry @appergb, your pull request is larger than the review limit of 150000 diff characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
把 OpenLess 从 macOS-only Swift 应用整体重写成跨平台 Tauri 2 (Rust + React + TS) 应用。老 Swift 代码原样保留在
Sources/,不删不改,不会破坏现有 Sparkle 发版链路。新代码全部落在
openless -all/app/,与老项目目录平级。What's in this PR
新增模块
openless -all/app/src/(React + TS UI,严格按design_handoff_openless高保真原型 + SwiftCapsuleView实现)openless -all/app/src-tauri/(Rust 后端,8 模块一一对应 Swift 库):hotkey— macOS CGEventTap 原生 FFI / 其他 rdev;自动重试,Accessibility 一授权立即接管(无需重启 App)recorder— cpal 16kHz Int16 PCMasr— Volcengine SAUC bigmodel WebSocket(二进制帧 + 热词 context)polish— OpenAI 兼容 Chat Completions(中文 prompt 一字不改自 SwiftPolishPrompts.swift)insertion— macOS CGEventPost 原生 FFI 模拟 Cmd+V / 其他 enigopersistence—~/.openless/credentials.jsonv1 schema(同 Swift,不走 Keychain避免 ad-hoc 签名换 hash 反复弹框)coordinator— 状态机 + emitcapsule:state给胶囊窗permissions—AVAudioApplication.recordPermission(同 Swift,与 cpal/AVAudioEngine 共享权限轨道).github/workflows/release-tauri.yml— 推v*-tauritag 触发 macOS + Windows matrix 构建,自动 GitHub Release关键 bug 与避坑(都已写到 commit message + 代码注释)
build_input_stream不会触发 macOS 麦克风弹框 — 必须.play()才查 TCCWindows 路径修复
credentials_path()之前硬编码\$HOME,Windows 没这个变量;改成%APPDATA%\OpenLess\credentials.jsonlog_dir_path()Windows 之前落到temp_dir()(重启清空),改成%LOCALAPPDATA%\OpenLess\Logs已知限制
Test plan
scripts/build-mac.sh)v1.1.0-tauri触发完整 release 流程How to release
merge 这个 PR 之后:
```bash
git checkout main && git pull
git tag v1.1.0-tauri
git push origin v1.1.0-tauri
```
GitHub Actions 5-10 分钟后会在 Releases 页放上 .dmg + .msi + .exe。
🤖 Generated with Claude Code