feat(chat): let the context ring lead with used or remaining capacity (D396 / ADR 0222) - #230
Merged
Merged
Conversation
|
Someone is attempting to deploy a commit to the vastsa's projects Team on Vercel. A member of the Team first needs to authorize it. |
added 2 commits
September 11, 2026 15:38
Composer 工具栏的上下文用量环此前固定显示剩余容量。新增设置项 AppSettings.contextUsageDisplay(remaining 默认 / used),让环弧长、 触发器百分比与令牌标签、弹层标题、tooltip 与 aria-label 跟随所选数值。 颜色分级(remaining ≤ 25% warning、≤ 10% critical)仍按剩余容量判定, 避免「已用 90%」显示为安全色。设置入口位于 AI → 默认项卡片。
…223) 新增 ADR 0223 与决策 D398,同步设置信息架构、组件规格与 E2E-250 场景(含中英 spec 对),并把 E2E-250 登记进 §8 追溯矩阵。 说明默认 remaining、颜色阈值仍按剩余容量,以及本次为纯渲染器改动、 无协议与存储迁移。
panda-z519
force-pushed
the
feat/context-usage-display
branch
from
September 11, 2026 07:39
a4e96a4 to
a7f8032
Compare
vastsa
reviewed
Sep 11, 2026
| | D393 | User-invoked Skills in the composer | **Amend D123 / D174 / ADR 0024 / ADR 0039: active built-in, plugin, and user Skills appear in a separate `Skills` group at the end of the composer slash menu. Selecting one inserts its exact id; Electron main revalidates the active project scope at send time and asks the model to call the local `Skill` tool, preserving on-demand body loading and existing permissions. Existing command names win collisions; inactive Skills remain literal slash text. See ADR 0219 and E2E-088b.** | D174's model-invoked catalog remains the body-loading and security contract, while a final explicit entry makes known workflows discoverable without moving Skill bodies into the renderer, prompt, or host protocol. | | ||
| | D394 | Windows work-panel chrome keeps one resource action cluster | **Amend D154 / D357 / ADR 0195: the open work-panel header keeps one compact resource switcher; resource close is owned by the existing keyboard-operable context-menu rows, the viewport-fixed toggle remains the only panel collapse control, and subagent detail returns with a back chevron. Windows/Linux native controls remain fixed at the window edge. Renderer-only; no panel state, window geometry, IPC, protocol, or storage change. See ADR 0220 and E2E-067.** | The header resource `X`, viewport-fixed toggle, and Windows native close cluster read as duplicate close actions and became cramped at narrow panel widths. | | ||
| | D396 | Renderer and plugin-panel scrollbars share one compact contract | **Amend D300: every renderer scroll container uses one 6px, trackless, transparent-at-rest scrollbar with the same hover, focus-within, scroll-reveal, and dragged-thumb states. Remove the sidebar-specific width and opacity override. The plugin-panel preload applies the same contract and 300ms reveal mark to docked and detached plugin documents, including the bundled Files view. External pages loaded inside the Browser guest remain page-owned. Presentation-only; no protocol, storage, host runtime, or external-page behavior change. See E2E-157.** | Windows' classic scrollbar made the right-side work-panel Files view visibly heavier than the conversation, while the sidebar retained a second scrollbar treatment. | | ||
| | D398 | Context usage display preference | **Amend D347 / ADR 0184: the context usage inspector's leading figure — the trigger ring arc, percentage, token label, popover heading, tooltip, and `aria-label` — is configurable via `AppSettings.contextUsageDisplay` (`"remaining"` or `"used"`). Default and fallback for absent/unrecognised values is `"remaining"`. When `"used"`, the ring fills by `usedRatio`, and text shows the used-capacity pair. Warning and critical color thresholds (remaining ≤ 25 % / ≤ 10 %) stay based on remaining capacity regardless of display mode. Settings → AI → Defaults adds a segmented control (Remaining / Used) after Link open destination and before Enter-to-send. Renderer only; no protocol, storage, host, or migration change. See ADR 0222 and E2E-250.** | The remaining-only display gave weak signal at low occupancy and did not match users who reason in terms of "how much have I spent". Color must stay on remaining to avoid a misleading green ring at 90 % used. | |
Owner
There was a problem hiding this comment.
[P2] 将 ADR 交叉引用改为 0223。此提交新增的是 docs/adr/0223-context-usage-display-preference.md,而 ADR 0222 在当前 main 中已被原生文件/文件夹拖拽决策占用;这里仍写 0222 会把读者带到错误的决策文档。中文镜像同样需要同步修正。
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.
What
在 composer 工具栏的上下文用量检查器上,让「引导数值」可由用户选择:剩余容量(现有行为,默认)或已用容量。
Why
检查器此前固定显示剩余容量。在低占用时剩余数字接近窗口总量,一眼看去信号很弱;而且对习惯「已经花了多少」心智模型的用户不直观。
How
AppSettings.contextUsageDisplay?: "remaining" | "used"(缺省/非法值回退remaining)。strokeDashoffset)、触发器百分比与令牌标签、弹层标题、tooltip 与aria-label全部跟随该设置。Verification
在本分支(基于
main,含f1b6916b)实测:pnpm --filter @pi-desktop/desktop typechecknode --test apps/desktop/test/*.test.mjspackages/i18n(renderer-keys/catalogs/user-facing-copy)node scripts/check-style-tokens.mjs(lint)node docs/scripts/check-locales.mjs未运行 E2E(按仓库规则,仅在你明确要求时运行)。
Docs
decisions-log.md表格 + 日期小节,中英同步)。Impacted specs / E2E
docs/adr/0222-context-usage-display-preference.mddocs/spec/04-ux/06-settings-ia.md、04-ux/08-component-spec.mddocs/spec/06-delivery/04-e2e-test-plan.md(E2E-250)docs/spec/08-meta/decisions-log.md(D398)Notes for the maintainer
settings-segment分段控件模式,因而与既有的CloseBehaviorSection一样没有 roving tabindex / 方向键导航(既有可达性债务,本次未扩大范围)。usedRatio恰落在取整边界时,remaining与used两种模式可能相差 1 个百分点(同源usedRatio取整),已在 ADR 中如实记录。