Repository navigation
Conversation
之前的状况:Tauri 有完整更新链路(`appCheckUpdateWithChannel` → plugin-updater / Android 安装器);egui 侧完全没有 —— `supports_auto_update` 恒为 false, `settings.recording.autoUpdateCheckLabel` 这一行被刻意藏起来(`auto_update_check` 存下来没人读),关于页只有链接。也就是说「检查更新」在 Linux 上根本不存在。 Linux 只发 deb/rpm,没有可自替换的封装,所以这里做到「发现新版本 + 打开下载页」, 不假装能自安装: - 新增 `linux-egui/src/update_check.rs`:解析 GitHub Releases 的**公开 atom 源** (与 Tauri 的 Beta 检测同源,CDN 缓存、没有 REST 的 60 次/小时限流)。 标签从 `<id>` 里取 —— `<title>` 是 `OpenLess v2.0.2-Beta.3-tauri`,带产品名前缀, 不能直接当标签。版本比较忽略构建后缀 `-149`,同一基线上正式版 > 预发布版, `Beta.10 > Beta.9` 按数字比。 - 关于页新增「更新」卡片:Beta 频道开关(写 `update_channel` + `update_channel_explicit`,与 Tauri 同一组偏好)、按频道切换文案的检查按钮、 状态行(检查中 / 已是最新 / 有新版本 vX / 失败原因),发现新版本时出现 「打开 Releases」。 - `auto_update_check` 现在真的被读取:启动后查一次、之后每 60 分钟一次(空闲态才 触发,避免和手动检查并发)。录音设置里的那一行开关因此从「藏起来」恢复成真开关。 - 网络走 `openless_core::net`(沿用系统代理偏好 + 重试)。 验证:`update_check` 4 个单测(解析 / 频道选择 / 版本比较 / 空源);一个 `--ignored` 的真源演练(真连 GitHub 解析当前发布,本地跑通);crate 全量测试、 clippy `-D warnings`、`localization_contract`、前端 144 个契约测试全绿。
与 Tauri 的 AutoUpdateGate 对齐:后台检查(启动 + 每 60 分钟)找到新版本时, Linux 侧不能自动安装,所以只发一条通知 + 状态行提示「有新版本 vX」, 用户自己去设置 → 关于 打开下载页。手动检查不打扰。
这两个功能在 Linux 上一直不存在 —— Tauri 侧的 `supports_auto_update` 式门禁只是 「Tauri 版不在 Linux 上跑」的副作用,不是「Linux 不需要」。Core 早就准备好了 `host_context` / `edit_observation` 两个注入点,Linux 一直注入的是 Noop。 底座:fcitx5 插件的 `GetSurroundingText` - 新 D-Bus 方法返回焦点输入上下文自报的 `valid⇟program⇟cursor⇟anchor⇟text` (偏移是**字符**数)。应用不支持 surrounding text 时 `valid=0`。 - 为什么走 IME 而不是 AT-SPI:提交文字本来就走这条 input context,应用自报的 光标位置比遍历无障碍树可靠,且不需要额外权限。 - 返回单字符串而不是 D-Bus struct:fcitx 的 vtable 对多返回值类型的签名校验 不接受 `std::tuple`,实测编译失败;用 `\x1f` 分段(文本在最后一段)更简单也 不会和文本内容冲突。 光标上下文(`linux-egui/src/host_context.rs`) - `LinuxHostContextAdapter` 读一次 surrounding text,按 600 字符预算切出光标前后 两段交给 `prompts::cursor_context_input`,模型就能接着用户正在写的内容润色。 - 设置 → 隐私与数据 新增开关(Core 偏好 `cursor_context_enabled`)。 - `include_cursor=false` 时**连 surrounding text 都不读**(不是读了再丢)。 自动学词 - `LinuxEditObservationAdapter`:插入完成后每 250 ms 采样一次,内容变了就用 Core 的 `minimal_edit` 求最小编辑对,只有「改动落在刚插入的文本里」 (`edit_is_within_typed_text`)才上报给 `EditObservationSink`;Core 接受则推进 基线继续观察(同一轮多处修改都能收集),拒绝则立即停止读文档。 - 设置 → 高级 新增「自动学词」页:开关 + 观察时长 / 建议时限 / 短语长度上限 + 恢复默认。 隐私门禁 密码管理器与终端一律不读:`is_sensitive_program` 在**读取之前**判断 (keepass/1password/bitwarden/lastpass/dashlane + terminal/konsole/alacritty/ kitty/wezterm/xterm/tilix/guake/yakuake/putty/tmux/screen),命中时连 surrounding text 都不请求,并在日志里只记程序名。 验证 - `host_context` 9 个单测:敏感应用识别、光标切分、空文档、越界光标(不 panic)、 预算上限、编辑落在插入文本内/外、敏感应用直接停、假 reader 驱动整条观察循环。 - `fcitx5_contract` 新增 surrounding text 契约(无焦点时必须 `Ok(None)` 而不是报错)。 - fcitx5 插件 `build.sh` + `ctest` 通过;crate 274 测试、clippy `-D warnings`、 `localization_contract`(测试样例已改英文,避免污染中文基线)全绿。
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Collaborator
Author
|
并进 #1280 了 —— 一个 PR 收口 Linux egui 的功能补齐(更新检测 + 光标上下文 + 自动学词 + 后续多屏),不拆着开。 |
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.
先纠正一件事:我上一轮把「Tauri 按平台门禁」当成了「Linux 不需要」,这个判断是错的 —— Tauri 的门禁只是「Tauri 版不在 Linux 上跑」的副作用。Core 早就把
host_context/edit_observation两个注入点留好了,Linux 一直注入的是 Noop,所以光标上下文和自动学词在 Linux 上是「根本没有」,不是「平台不支持」。本 PR 把两者一起落地,共用同一个底座。
底座:fcitx5 的
GetSurroundingText新增 D-Bus 方法,返回焦点输入上下文自报的
valid␟program␟cursor␟anchor␟text(偏移是字符数,不是字节)。应用不支持 surrounding text 时valid=0。static_assert类型校验,std::tuple多返回值直接编译失败(实测)。用\x1f分段、文本放最后一段,既简单又不会和内容冲突。光标上下文
LinuxHostContextAdapter读一次 surrounding text,按 600 字符预算(与 Tauri 的DEFAULT_BUDGET_CHARS一致)切出光标前后两段,交给prompts::cursor_context_input。设置 → 隐私与数据 新增开关(Core 偏好cursor_context_enabled)。include_cursor=false时连 surrounding text 都不读 —— 不是读了再丢。自动学词
LinuxEditObservationAdapter:插入完成后每 250 ms 采样 surrounding text,内容变了就用 Core 的minimal_edit求最小编辑对;只有改动落在刚插入的文本里(edit_is_within_typed_text)才sink.publish。Core 接受则推进基线继续观察(一轮里多处修改都能收),拒绝则立刻停止读文档。设置 → 高级 新增「自动学词」页:开关 + 观察时长 / 建议时限 / 短语长度上限 + 恢复默认。隐私
密码管理器与终端一律不读:
is_sensitive_program在读取之前判断(keepass / 1password / bitwarden / lastpass / dashlane / terminal / konsole / alacritty / kitty / wezterm / xterm / tilix / guake / yakuake / putty / tmux / screen),命中时连 surrounding text 都不请求,日志里只记程序名。验证
还差一件
多屏胶囊(
CapsuleDisplayMode: 光标所在屏 / 主屏 / 前台窗口所在屏 / 全部屏幕)我单独做:X11 侧要按 monitor 摆位、全部屏幕要每个屏一个胶囊;Wayland 侧layer-shell的 output 绑定是另一套逻辑,和这两条混在一个 PR 里不好 review。