1. 实时观测本轮修改
订阅 runtime 事件流:
EventToolDiff — 每个写工具执行后,展示文件变更和 unified diff。
EventBashSideEffect — bash 产生未捕获变更时,提示未覆盖文件路径。
EventCheckpointCreated — 可选,用于展示 checkpoint 时间线。
ToolDiffPayload 同时提供单文件兼容字段(FilePath / Diff / WasNew)和多文件字段(Files + Diffs),TUI 按 Files 长度判断场景。
2. Checkpoint 列表与 Diff 预览
通过 Gateway RPC:
ListCheckpoints(sessionID) — 获取可恢复 checkpoint 列表,按 Reason 分组展示,标记包含代码快照的项(CodeCheckpointRef 非空)。
CheckpointDiff(sessionID, checkpointID) — 查询目标 checkpoint 相对于上一个代码 checkpoint 的端到端差异,返回 Files(Added/Deleted/Modified 分类)和 Patch(unified diff)。建议在 restore 确认弹窗中展示,帮助用户决策。
3. Restore 与 Undo
通过 Gateway RPC:
checkpoint_restore — 输入 session_id + checkpoint_id + force。
checkpoint_undo_restore — 输入 session_id,恢复到最近一次 restore 前的 guard 点。
Restore 成功后 TUI 会收到 EventCheckpointRestored,应刷新消息列表、todo、plan、以及已打开的文件内容。
4. 运行时快照刷新(自动)
Restore 成功后 runtimeSnapshots 缓存被删除,TUI 下次调用 GetRuntimeSnapshot 时自动从 DB 重新加载恢复后的状态,无需额外处理。
1. 实时观测本轮修改
订阅 runtime 事件流:
EventToolDiff— 每个写工具执行后,展示文件变更和 unified diff。EventBashSideEffect— bash 产生未捕获变更时,提示未覆盖文件路径。EventCheckpointCreated— 可选,用于展示 checkpoint 时间线。ToolDiffPayload同时提供单文件兼容字段(FilePath/Diff/WasNew)和多文件字段(Files+Diffs),TUI 按Files长度判断场景。2. Checkpoint 列表与 Diff 预览
通过 Gateway RPC:
ListCheckpoints(sessionID)— 获取可恢复 checkpoint 列表,按Reason分组展示,标记包含代码快照的项(CodeCheckpointRef非空)。CheckpointDiff(sessionID, checkpointID)— 查询目标 checkpoint 相对于上一个代码 checkpoint 的端到端差异,返回Files(Added/Deleted/Modified 分类)和Patch(unified diff)。建议在 restore 确认弹窗中展示,帮助用户决策。3. Restore 与 Undo
通过 Gateway RPC:
checkpoint_restore— 输入session_id+checkpoint_id+force。checkpoint_undo_restore— 输入session_id,恢复到最近一次 restore 前的 guard 点。Restore 成功后 TUI 会收到
EventCheckpointRestored,应刷新消息列表、todo、plan、以及已打开的文件内容。4. 运行时快照刷新(自动)
Restore 成功后
runtimeSnapshots缓存被删除,TUI 下次调用GetRuntimeSnapshot时自动从 DB 重新加载恢复后的状态,无需额外处理。