feat: context usage ring and tool image previews

- the composer shows a context ring and percentage from the last
  token-bearing assistant message, toned at 75% and 90%; tapping opens a
  sheet with the model, used tokens, limits, output reserve and turn cost
- images a tool call names (read attachments as data URLs, input paths,
  and image paths in output text) get a link under the tool row; tapping
  previews it from the data URL or /api/fs/raw, allowing paths outside
  the workspace
- directory-scoped requests now send x-opencode-directory-encoding: uri,
  which scoped routes such as /api/fs/raw need to decode the header
- ocprobe gains a raw file command for checking previews

Bump version to 0.2.2 (build 16).
This commit is contained in:
blumia committed 2026-11-18 02:15:11 +08:00
1 parent dc3730eba7
commit 2fb4a8ea79
16 files changed
+884 -26

No files matched your search

+3
View File
@@ -53,6 +53,9 @@ M0 完成,并继续做到了 M3。所有验证都连的是本机正在运行
| 图片内联预览 | 发送的图片附件保留本地副本,消息气泡内直接显示缩略图(200×150 圆角),不受后续重载影响 |
| 撤回 | 用户消息菜单「撤回此消息及之后」:二次确认后 stage+commit 服务端 revert,删除该消息及之后内容 |
| 应用图标 | 使用 OpenChamber 官方图标(`assets/icon.png`,取自 `packages/mobile/assets/icon-only.png`) |
| 上下文占用 | 输入区右侧环形进度 + 百分比(绿/橙/红阈值 75%/90%,与官方一致);点击打开详情 Sheet:模型、已用 tokens、上下文上限、输出预留、占用百分比、本轮费用;阈值按 `上限 - min(输出, 32K)` 计算 |
| 工具图片预览 | 工具调用涉及图片时(read 的 `state.attachments` data URL、输入 `filePath/path`、输出文本中的绝对图片路径),在工具行下显示图片链接;点击后从 data URL 解码或经 `/api/fs/raw`(带 `allowOutsideWorkspace=true`,工作区外的 /tmp 截图也能看)取回,全屏 Sheet 预览并缓存 |
| 目录请求头 | `x-opencode-directory` 附带 `x-opencode-directory-encoding: uri`,修复 scoped 请求(如 `/api/fs/raw`)被当成未解码路径的问题 |
| Agent 选择 | 只列 `mode=primary` 的 Agent,子智能体(General/Explore)不再出现 |
| 模型/Agent | 聊天页顶栏打开选择 Sheet(可搜索),切换后同步会话列表 |
| 新建会话 | 会话页「新建」:标题 + 工作目录(服务端默认目录与已加载会话的目录),创建后直接进入聊天 |