状态:canonical(2026-09-07 以源码为准重写);更新:2026-09-07。范围以2.0 需求为准;本文是长接口与实现参考,交接材料以交接目录为准。
openless-all/app/contract/backend-2.0.json(contractVersion 2.0.0)顶层键:
| 键 | 内容 |
|---|---|
startupSnapshot |
启动快照结构与版本校验规则;UI 必须先消费快照再渲染 |
backendEvent |
语义事件清单、顺序与重放规则 |
lessComputerVoice |
Less Computer 语音事件面 |
androidJni |
Android JNI 合同(src-tauri android 桥接共用) |
linuxFacade |
Linux 专用 facade 面(LinuxHost 公开方法对应) |
enums |
共享枚举(provider 类型、状态、错误等) |
linux-egui/src/lib.rs:pub struct LinuxHost;LinuxHost::new(Arc<OpenLessBackend>)、with_settings_runtime、backend()、subscribe() -> EventSubscription、snapshot() -> BackendSnapshot、save_settings(...)、update_settings_strict(...)、drain_events(...)、feed_less_computer_pcm(&[u8])。linux-egui/src/backend.rs:LinuxBackendRuntime;LinuxBackendBuilder::from_shared_providers(BackendConfig)+with_task_spawner / with_recorder / with_auxiliary_polisher / with_text_inserter / with_credential_store / with_services / with_host_actions / with_settings_runtime / with_local_asr_runtime / with_polish_failure_policy→build() -> LinuxBackendRuntime。- 事件消费:
drain_events(lib.rs)批量取走 Core 语义事件;订阅经EventSubscription。
AudioRecorder、TextPolisher、TextInserter、CredentialStore、SettingsRuntime、TaskSpawner、EditObservationSink/EditObservationAdapter(默认 NoopEditObservationAdapter)、LinuxHostActions。缺省实现表示"未接线",不是"不支持"。
- 云 ASR/LLM/Omni/Auxiliary 实现两端共用(Core
asr/、provider_*、omni、llm_gemini);平台 Host 只注入原生录音、凭据、窗口、进程、焦点与插入 Adapter。 - 旧 React command/event 名称只保留在 Tauri 兼容 Adapter;Linux 与 Core 同进程,经类型化 Rust Interface 调用。
- provider 公开目录:Core
provider_rules::provider_descriptors→ 生成src/lib/ipc/provider-descriptors.generated.json(cargo run --locked -p openless-core --example export_provider_descriptors)。