Skip to content

[refactor][P1] coordinator.rs 单文件 3842 行 — 拆分 dictation / qa 子模块 #296

Description

@appergb

背景

coordinator.rs 当前 3842 行,包含:

  • dictation 主听写状态机(hotkey edge → recorder → ASR → polish → insertion)
  • QA 划词追问状态机
  • 双 hotkey supervisor 循环
  • recorder 错误监控
  • Windows IME 会话管理
  • capsule 事件发射
  • 录音 mute 管理
  • 本地 ASR 预加载/释放

单一文件内职责过多,函数拆分已有但未拆 module。

建议

按子状态机拆分:

  • coordinator/dictation.rs — 主听写 session 生命周期
  • coordinator/qa.rs — QA 划词追问 session 生命周期
  • coordinator/resources.rs — recorder / ASR / mute 等资源管理

注意:这是 P1 中风险最大的拆分,必须先有单测覆盖(issue #N 零单测)才能放心做。

来源

docs/audit-2026-05-06.md §1.2 问题 A / §1.4 高风险 #2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions