fix(inject): 适配新版 Codex 输入框额度耗尽横幅并修复切换闪烁 - #2229
Merged
Merged
Conversation
- 适配新版将额度耗尽提示移至 [data-codex-composer-root] aside 的 DOM 结构 - 增加 composerUsageAlertBanners,支持常见中英、繁体额度文案精准匹配 - 优化 officialUsageAlertContainer 提取单一子元素父容器,避免留白 - 在 installStyle 中增加局部 :has 预隐藏规则,解决切换会话瞬间闪烁 - 更新与补充 renderer-inject.test.ts 单元测试,确保回归测试通过
- 精确限制 CSS 防闪烁选择器至 billing/upgrade 特征,避免误伤 composer 其他普通通知 - 增强正则对多行排版、空白符规范化与常见限额提示的覆盖能力,并补充升级操作兜底 - 加固 officialUsageAlertContainer 容器判定,防止意外隐藏根级或表单容器 - 将 refreshOfficialUsageAlertVisibility 改为增量更新,减少高频 scan 下的 DOM 扰动 - 扩展 renderer-inject.test.ts,增加防误伤负向断言与多语言用例
旧版左下角只预隐藏带进度条和关闭按钮的额度卡。新版输入框横幅不再用「有标题就隐藏」的 CSS,改为在 MutationObserver 回调里按 26.915 的中英文标题同步判定,不等 200ms 全量扫描。非额度提示不再被标成隐藏。
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.
变更背景
Codex 26.915 把官方低额度提示从左下角挪到了输入框上方,而且不能关闭。切换会话时,注入脚本的全量扫描有 200ms 防抖,横幅会先画出来再被藏掉。
旧版卡片仍在左下角:
aside.app-shell-left-panel里带progress和「关闭使用量提醒」按钮。两边都要能关,但不能把沙箱、安全、上传失败这类 composer 提示一起藏掉。修复内容
Dismiss usage alert/关闭使用量提醒/關閉用量提示/關閉使用量警示的 status。排除条件写在卡片上,不再写在整块侧边栏上。[data-codex-composer-root] aside只要有标题就先display: none」。26.915 的横幅和沙箱、安全提示共用aside > h3,那条规则会误伤。你的 Codex 和工作使用额度已用完、你的 Codex 和工作用量均已用完、您即将达到使用限额、此模型的使用额度已用完、所选模型已超出使用限额,以及对应的英文耗尽、即将用尽和模型额度标题。data-codex-plus-usage-alert-hidden="true"。其它提示不再被标成false后靠宽 CSS 放出来。测试
apps/codex-plus-manager:npm test235 passed。