Skip to content

feat: 1.5.0 体验改进(大文件预览、无响应提示、错误 UI、数字角标、自动更新、本机用量统计) - #10

Merged
OpenX123 merged 23 commits into
mainfrom
feat/1.5.0-experience
Nov 22, 2026
Merged

OpenX123 merged 23 commits into
mainfrom
feat/1.5.0-experience

Conversation

@OpenX123

Copy link
Copy Markdown
Owner

背景

用户反馈 1.4.2 的几处体验问题:大文件无法预览(256KB 上限)、Claude 长时间无输出时毫无提示、顶部"更改 +N"显示与对话无关的工作区 diff、错误 UI 难看且错误码不便查看、Windows 角标只是红点、模型名带冗余 "Claude" 前缀且思考档位过长、更新需要手动下载、使用统计只覆盖 ZCode 自身会话。决策记录:docs/plans/2026-11-22-experience-1.5.0.md。

修改前后

项 修改前 修改后
文件预览 >256KB 整体拒绝 ≤1MB 正常;1–50MB 分块按需读取 + 虚拟滚动纯文本,可"仍然渲染";>50MB 提示外部打开;HTML 默认源码
无响应 只有墙钟"工作中 X 分" runtime 下发 turnActivity;60s 提示、5min 警告,提供中断并重试/中断/查看日志;工具执行中不算卡住;不自动处理
更改条数 顶部胶囊显示工作区全部 git diff 移除;每轮末尾"已更改 N 个文件 +x −y"卡片,可审阅该轮 diff
错误 UI 行内 HTTP chip + 横幅两套样式 一行(图标+人话+重试+详情),展开为等宽诊断卡+复制全部;常见错误码中英文解释;横幅只承载非轮次错误
模型/档位 Claude Opus 4.7 · Extra high Opus 4.7 XHigh(Min/Low/Med/High/XHigh/Max/Ultra/Auto)
角标 Windows 红点 数字(1–9、9+)= 未读完成 + 待你操作
提示音 单一 pop,localStorage 6 种(含合成 5 种)+ 静音,任务完成 / 需要你操作分别选择,存入 AppSettings
更新 自动检查,手动下载 可配置自动检查/自动下载;后台下载校验后"重启以更新",退出时安装
使用统计 仅 agent-db 加入本机 Claude Code / Codex 日志(增量扫描、去重、按 API 价格估算),来源筛选、按模型/项目/请求明细/定价

无响应状态所有者与事件顺序

sequenceDiagram
  participant E as 引擎 (ACP/原生)
  participant R as CLI ProductProjection(唯一所有者)
  participant H as Host
  participant U as UI turn-stall(纯派生)
  E->>R: 文本/思考/工具事件
  R->>R: 更新 lastActivityAt / activityPhase(≤5s 节流,不计 revision)
  R->>H: snapshot/delta.turnActivity
  H->>U: 转发(重连/重放得到同一事实)
  U->>U: now - lastActivityAt ≥60s → hint,≥5min → warning;running_tool → 工具耗时
Loading

验证

  • pnpm typecheck:通过;pnpm lint:0 errors(89 个既有 warning);pnpm architecture:check --changed:0 违规。
  • 改动/新增的 39 个根 UT 文件 613 条全部通过;CLI build + typecheck 通过;CLI usage-query、usage-stats-builder、product-projection-turn-activity 通过。
  • product-projection.test.ts 2 条 API 重试用例失败,已在 origin/main 源码上复现,为既有失败。
  • 未执行:桌面 E2E(HTML 预览、usage-stats 用例已改写未运行)、真机验收(任务栏数字清晰度、静默安装/退出安装、提示音听感、远程大文件读取)。
  • 推断未核实:ZCode 启动的外部引擎会话 ID 与 Claude/Codex 日志会话 ID 的对应关系(依据 claude-agent-acp / codex-acp 行为推断,已在 spec 标注)。

🤖 Generated with Claude Code

OpenX123 and others added 23 commits November 22, 2026 02:10
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Model names drop the leading "Claude " at the display layer only, effort
buttons use <=5 letter abbreviations (Min/Low/Med/High/XHigh/Max/Ultra/Auto),
and the combined trigger renders "Opus 4.7 XHigh" without a middle dot.
Popover, slider readout and accessible names keep full names; the popover
adds a one-line effort description.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es card

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…age facts

Add docs/usage-stats-local-sources.md (ZCode / Claude Code / Codex local
usage, parsing + dedup rules, cursor cache, pricing, ownership).
CLI queryAppUsage now also returns per-day/model/cwd token facts and the
external engine native session ids so the Host can price ZCode native
usage and tag ZCode-launched Claude/Codex sessions without double counting.
Shared: additive usageFacts/externalSessions on AppUsageSnapshot and the
LocalUsage* zod schemas used across RPC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s card

Turn failures render as one line (icon, human message, Retry, Details) and
expand into a monospace muted card with error code, HTTP status, request /
trace id, URL and raw error plus Copy all. Common failures (401/403/429/
529 overloaded/timeout/network/context too long) map to zh/en explanations
and suggestions. The composer banner keeps carrying only non-turn errors
with the same calm styling and explanations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Host-side LocalUsageScanner owns per-file cursors (mtime/size/offset/tail
hash + Codex parser state), streams jsonl incrementally, dedupes Claude by
message.id+requestId (stop_reason first, else larger output) and Codex by
timestamp+total signature, and persists a compact cache under
~/.zcode/v2/usage-stats. ZCode native facts and external session mapping
come from the CLI usage store and are cached for offline use.
ModelPricingStore holds manual overrides and models.dev sync (manual only).
IUsageStatsService gains getLocalUsageSnapshot / setModelPriceOverride /
syncModelPrices with zod validation. Tests use synthetic fixtures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…default

- readTextFile single-call cap raised to 1MB with UTF-8 boundary-safe chunks
- 1MB-50MB files open in a virtualized plain-text viewer that loads 1MB chunks
  on demand, with a render-anyway action; >50MB keeps the external editor hint
- HTML files default to source view with a preview toggle

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ProductProjection records lastActivityAt / phaseStartedAt / activityPhase
(waiting_model | running_tool) from engine event timestamps, throttled to
5s, cleared when the turn leaves running. The new snapshot/patch key is
strict-validated, degrades unknown shapes to null and does not bump revision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Derives a hint at 60s and a warning at 5min of silence from the runtime
turnActivity; running tools show elapsed time instead of a warning.
Warning offers interrupt-and-retry (sendText startNow with the same user
input), interrupt and view logs. No auto-cancel or auto-retry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Settings > Usage now renders LocalUsagePanel: source filter (all / ZCode /
Claude Code / Codex), ranges today/7d/30d/all/custom, cost / requests /
tokens / cache hit cards (estimated at API prices), Tokens/requests/cost
trend, 53-week heatmap, by-model / by-project / request detail / pricing
tabs with manual price override and manual models.dev sync. ZCode runtime
metrics (agent-db) only show for all/ZCode sources. Scans only while the
panel is mounted (+30s refresh, skipped when hidden).

Replaces the old App Usage charts. New code lives in managed modules
usage-stats-local-protocol (shared), usage-stats-local (services) and
usage-stats-local-ui (ui); i18n under settings.usageStats.local.* for
zh-CN and en-US. Desktop E2E updated for the new panel (not re-run).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fable 5/5.1/5.2, Opus 4.8/5/5.5, Sonnet 5/5.5 and Haiku 5.5 from the
official price table; cache write 5m = 1.25x input, 1h = 2x input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Windows taskbar overlay and tray now draw a legible number (1-9, 9+)
  at native 16/32px instead of a red dot; macOS dock / Linux keep
  app.setBadgeCount with the same count.
- Badge count = unread completed tasks + tasks waiting for approval or
  input, deduped per task; waiting states are acknowledged once the
  task is viewed in a focused window and re-counted on a new request.
- Spec: docs/desktop/windows-taskbar-unread-badge.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- New local settings desktopUpdateAutoCheck / desktopUpdateAutoDownload
  (both default on), applied live through syncAppSettings.
- After a check finds an installable version, Main downloads and
  verifies it in the background and shows "Restart to update"; download
  no longer opens the installer, background failures fall back to
  update-available without a persistent error.
- Restart to update: Windows runs the NSIS installer silently with
  --force-run, macOS uses the existing helper; on normal quit a verified
  installer is handed off inside the quit barrier (<=60s, no relaunch).
- Settings rows and sidebar copy in desktop-updates UI; CONTRACT.md and
  docs/desktop/github-desktop-update-spec.md updated.
- Shared AppSettings/notification preference types used by the next
  commit are introduced here as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Two sound categories (task completed / needs your action: approval,
  question, error), each choosing default pop, five synthesized tones
  (crisp, soft, woodblock, droplet, two-tone) or mute, with preview.
- Tones are generated by scripts/generate-notification-sounds.mjs
  (deterministic additive/FM synthesis, no third-party samples, <30KB).
- Sounds play only when the app is in the background unless "play when
  focused" is on; Main/web pass {category, appFocused} and the renderer
  player is the single decision point.
- Preferences move from localStorage to local AppSettings shared across
  windows (SettingsChanged), with one-time legacy key migration; the
  Zustand notification fields and broadcast are removed.
- New managed module task-notifications-ui; spec
  docs/desktop/task-notification-sounds.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	architecture-policy.yaml
… capsule

- Collapsed status capsule no longer shows the worktree +x -y metric; the
  expanded Git Tools section and Git pane still show workspace changes
- Turn file summary reads "已更改 N 个文件 +x -y" and gains a Review action
  that opens the whole turn as one multi-file diff in the side pane

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
架构检查要求新文件落在 managed 模块内:pack B 新增的 error-explanations.ts
位于未受管的 ui 目录,合并后 architecture:check 报 unmanaged-new-file。
迁入 packages/ui/src/error-explanations 并登记,external-engine-ui 声明依赖。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@OpenX123
OpenX123 merged commit ee3bf1b into main Nov 22, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant