Files
cc-web/.trellis/tasks/07-17-runtime-image-send/research/runtime-image-input.md
2026-07-18 10:14:38 +08:00

23 lines
1.1 KiB
Markdown

# 运行中图片输入调研
## 协议事实
- 本机 `codex-cli 0.144.1` 生成的 `TurnSteerParams` Schema 定义 `input: UserInput[]`
- `UserInput` 联合类型包含 `{ type: "localImage", path, detail? }`
- cc-web 的普通 Codex App turn 已通过 `codexAppInputFromMessage` 使用这一结构。
## 代码事实
- `handleMessage` 在选择普通 turn 或 steer 之前已经调用 `resolveMessageAttachments`
- `resolveMessageAttachments` 只返回元数据记录存在、未过期且真实文件仍存在的附件。
- `sanitizeMessageForPersist` 对历史附件统一调用 `normalizeMessageAttachments`
- mock app-server 的 `textFromInput` 会把 `localImage` 显示为 `[image:<basename>]`,适合协议回归断言。
- stale completion 使用用户消息的 timestamp + content 定位插入点,保存附件不会破坏顺序。
## 工作树约束
- `public/app.js` 有其他主题相关改动。
- `scripts/regression.js` 有大量其他回归新增。
- `server.js` 现有未提交差异仅涉及 jpg/jpeg 静态 MIME。
- 所有修改必须限制在相关函数与测试邻近区域。