Skip to content

feat: add isolated Rust/Tauri client in ahakey-studio-tauri - #65

Merged
ZephyrKeXiner merged 21 commits into
AhakeyAI:mainfrom
lgcyaxi:codex/rust-client-1.1.5
Sep 20, 2026
Merged

ZephyrKeXiner merged 21 commits into
AhakeyAI:mainfrom
lgcyaxi:codex/rust-client-1.1.5

Conversation

@lgcyaxi

@lgcyaxi lgcyaxi commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Add AhaKey Studio 1.1.5 as an independent Rust/Tauri 2/React subproject and
Windows CI. This does not replace or edit the existing Java, Swift or bridge
clients. It supersedes the withdrawn experimental PR #64.

  • In-process USB/BLE transport, explicit connection readiness and per-slot
    diagnostics for compatible firmware; USB-only pairing reset controls.
  • Four profiles and physical key assignments, hold/toggle voice input,
    WeChat/Windows dictation, optional local SenseVoice and Doubao streaming,
    and target-monitor local/cloud captions.
  • Tray quick actions, macOS app/menu-bar icons, host-side image/card previews,
    and extensible quota providers. Credentials stay on the host.

The complete diff is restricted to the new repository-root ahakey-studio-tauri/
subdirectory and .github/workflows/ahakey-studio-tauri.yml. Existing desktop
client source trees are unchanged.
The parent is current upstream/main, 931ebefd4b6fec4ee6578dfd7ebc0fcc93951c73.
The client includes the reviewed fixes for voice-key lifecycle, credential
isolation, firmware ACK/readback, lighting capability checks and Java Hook
dispatcher migration.

Companion firmware and scope

Fork Release: Windows client 1.1.5 and community X1 firmware 0.1.17.
The firmware HEX is a separate, unofficial experimental Release asset for
AhaKey X1, distributed for personal/noncommercial research under the
binary permission in #63.
No controlled firmware source, schematics, HEX or private documentation is
included in this PR. The Rust client builds without firmware source or binaries;
unsupported firmware features are capability-gated.

Concurrent device links and presentation standby require compatible firmware,
not just the client. Image/quota-card upload to the device is not implemented.
External dictation tools do not expose reliable recording-state readback.

Validation

After the directory move, local macOS checks pass:

  • Frontend: 24 tests, TypeScript checks and production build.
  • Native desktop: 56 tests; BLE library: 18 tests.
  • Rust formatting and Clippy with warnings denied.
  • Native custom-protocol build passed after the directory move.
  • Hook migration also passed with a CRLF-encoded legacy fixture, covering
    Windows checkout line endings.
  • The updated Windows CI validates the final layout and release build.

Regression tests cover normal hold/toggle stops, rapid key release, legacy Hook
migration with backups, custom-script preservation, and firmware lighting and
configuration readback checks. The controlled Windows F18-injection test remains
intentionally ignored. Windows hardware use was reported by the original
maintainer; these review fixes do not add a new hardware certification claim.
macOS/Linux packaging, permissions and clean-machine acceptance remain pending.

Review focus

Please review the transport/security boundaries, firmware capability checks,
settings migration, voice edge handling and the independent-subproject approach.
Happy to coordinate interfaces with the upcoming official Rust runtime mentioned
in #63, or reduce the scope before integration.

@ZephyrKeXiner

Copy link
Copy Markdown
Member

Hi @lgcyaxi,

请问您是否能够分多commit,一个commit对应一个功能提交PR。目前的代码因混杂在一起,无法通过Review并入主线。

Introduce a standalone library and its focused tests.
Introduce a standalone library and its focused tests.
Introduce a standalone library and its focused tests.
Introduce the feature implementation and its focused tests/components.
The following UI and runtime commits connect the shared application entry points.
Introduce the feature implementation and its focused tests/components.
The following UI and runtime commits connect the shared application entry points.
Introduce the feature implementation and its focused tests/components.
The following UI and runtime commits connect the shared application entry points.
Introduce the feature implementation and its focused tests/components.
The following UI and runtime commits connect the shared application entry points.
Introduce the feature implementation and its focused tests/components.
The following UI and runtime commits connect the shared application entry points.
Connect the feature panels through shared contracts and the React entry point.
Connect the preceding feature modules through shared Tauri state, commands and tray controls.
Document platform limits and add the build and packaging verification workflow.
@lgcyaxi
lgcyaxi force-pushed the codex/rust-client-1.1.5 branch from da7be1b to 5e6ccb1 Compare September 14, 2026 10:03
@lgcyaxi

lgcyaxi commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

@ZephyrKeXiner 已按功能和依赖关系将原来的单一提交拆为 11 个 commits,仍在这个 PR 内:

  1. bf7f748 原生 BLE / USB 配置传输库及协议测试。
  2. ce3d3b5 本地 SenseVoice 采集、模型管理和识别库。
  3. 4e18380 豆包流式识别与凭据存储。
  4. 75856cc 四键绑定、profile 和输入偏好持久化。
  5. 0a67e3c 按住说话、语音会话和跟随屏幕的字幕。
  6. 3509906 编程事件 Hook 与键盘灯效映射。
  7. f4394df 设备状态、断线恢复及 A/B 槽位管理。
  8. 33d2d2e 图片预览与可扩展额度卡片。
  9. f35372a React 界面、共享数据契约和设置面板接线。
  10. 1648b2a Tauri 共享状态、命令注册及系统托盘接线。
  11. 5e6ccb1 打包检查、Windows CI 和使用说明。

前三项是独立库;4–8 是功能模块及对应测试/组件,9–10 接入共享的 UI 和运行时入口。因此中间的功能模块提交并不是各自可启动的完整桌面应用,完整应用从第 10 个提交形成,打包检查与 CI 在第 11 个提交补齐。建议按上述顺序逐项查看,公共入口接线可结合第 9–10 项交叉审阅。

本次仅重组历史:最终 Git tree 与拆分前的 da7be1b 完全一致,没有新增功能或改变代码行为。范围仍仅为 ahakey-desktop/** 和对应 CI,不包含受限固件源码。

本地重新验证通过:前端 24 项测试、Rust 73 项测试、格式检查、严格 Clippy 和前端生产构建。受控 Windows 实体按键注入测试仍按原规则跳过;这次没有新增 macOS 或硬件验收结论。新提交的 CI 将另行显示结果。

感谢指出审阅粒度的问题。

@ZephyrKeXiner

Copy link
Copy Markdown
Member

好的,我们将尽快review代码,时刻与你保持联系!

@ZephyrKeXiner ZephyrKeXiner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

已审阅截至 5e6ccb1 的全部 11 个提交,建议合并前修复以下 3 个问题:

  1. 配置写入未检查固件 ACK,仅凭 GATT 写入成功就报告保存成功。应校验固件响应,并对模式和亮度进行状态回读确认。
  2. macOS/Linux 的豆包凭据使用固定命名空间,预览版与正式版可能互相覆盖或删除 token。应按应用身份隔离。
  3. toggle 模式在语音异常结束、界面结束或启动失败后,未同步复位按键状态,导致第一次按键重试被忽略。应保持按键状态与语音会话一致。

验证通过:前端及打包检查共 24 项测试、TypeScript 类型检查、前端生产构建,以及 BLE 库 15 项测试。本次未进行 Windows 原生构建和硬件验证。

Comment thread ahakey-studio-tauri/crates/ble/src/lib.rs
Comment thread ahakey-desktop/crates/cloud/src/credentials.rs Outdated
Comment thread ahakey-studio-tauri/src-tauri/src/voice.rs
write_batch only proved GATT write success, so a rejected config could
still report saved. write_confirmed now awaits the matching firmware ACK
on 0x7344 (docs/ble-protocol.md section 9) and surfaces rejections and
timeouts; set_work_mode and set_light_brightness additionally verify via
status readback. IDE state sync stays fire-and-forget.
macOS/Linux keyring used a fixed service name, so preview and release
identities could read, overwrite, or delete each other's token. The
namespace now follows the application identifier ({identifier}.doubao),
matching the quota module's isolation. Windows stays per-directory.
Toggle mode latched the key state when a session ended via error, UI
stop, the 120s watchdog, or startup failure, swallowing the first retry
press. KeyTest.release_session clears only the logical latch and keeps
the physical press edge, so a held key cannot restart a session while
the next real press starts cleanly.
@lgcyaxi

lgcyaxi commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

已按三条反馈修复并推送(5e6ccb1 → 99ae4af):

  1. 固件 ACK 校验(f694786):新增 write_confirmed——配置写入逐帧等待 0x7344 的匹配 ACK(cmd echo + status),拒绝与超时都向上传递(BleError::Rejected/Timeout);set_work_mode/set_light_brightness 在 ACK 后再做状态回读确认。0x90 IDE 状态同步保持 fire-and-forget。parse_ack 有单元测试覆盖。
  2. 凭据命名空间隔离(3434f92):macOS/Linux keyring service 改为 {identifier}.doubao(对齐 quota 模块的 {identifier}.quota),预览版与正式版互不读写/删除;Windows 维持按目录隔离不变。
  3. 按键状态同步(99ae4af):新增 KeyTest::release_session——只清逻辑锁存、保留物理按下边沿;语音异常结束(Update::Error)、正常结束(Final)、UI 停止与 120s 看门狗(finish_generation)、启动失败与取消(cancel_locked)五条结束路径全部同步复位。input.rs 新增两个回归测试:"toggle 异常结束后的首次重试"与"hold 长按期间不误重启"。

验证:ble 16 项、cloud 15 项、src-tauri 51 项、前端 24 项测试与 TypeScript 检查、release 构建全部通过。真实键盘 ACK 行为的硬件验证依赖固件 0.1.18,如有不符欢迎指出。

@ZephyrKeXiner ZephyrKeXiner changed the title feat: add standalone Rust client with native USB/BLE and voice input feat: add isolated Rust/Tauri client in ahakey-studio-tauri Sep 20, 2026

@ZephyrKeXiner ZephyrKeXiner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

复查最终提交 8c3a2ad:正常 hold/toggle 语音停止、旧 Java Hook 迁移及 Windows 换行兼容、旧固件灯效能力检查和配置回读均已修复,并增加回归测试。客户端已隔离到仓库根目录 ahakey-studio-tauri/;差异仅包含该目录与对应 CI,未修改既有 desktop 客户端。

验证:本地前端 24 项、桌面端 56 项、BLE 18 项测试,严格 Clippy 和原生编译通过;该提交的 Windows 测试/Release 构建、macOS 构建打包和 TypeScript SDK CI 全部通过。Windows 真机交互验收仍不在本次验证范围内。

原审阅问题已解决,同意作为独立子项目合并。

@ZephyrKeXiner
ZephyrKeXiner merged commit f9a690a into AhakeyAI:main Sep 20, 2026
3 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