- • 单一
Update goroutine 串行处理所有 tea.Msg
- •
Update 只返回新 model + tea.Cmd,永不阻塞
- • 尾部固定链:syncScroll → syncMouse → settleTranscript
- •
View() 返回 tea.View,alt-screen 全屏托管
- •
runAgent 在 goroutine 内跑 Agent Loop
- • 回调
OnText/OnToolCall* 经 RuntimeMessageSink
- • sink →
program.Send 把消息投回 Update
- •
runID != activeRunID 的迟到消息被丢弃
- • 权限/追问用
chan 让 goroutine 挂起
- • 主循环渲染卡片,用户按键调用
decide()/answer()
- • channel 收到值后 goroutine 恢复执行
- •
ctx.Done()(取消)也会解阻塞并拒绝
- •
beginRun:runID++、pending=true、清理上回合状态
- • pending 期间新 prompt 进入
queueMessage
- •
agentResponseMsg 收尾并 launch 排队消息
- • Ctrl+C 取消:延迟 quit 直到 checkpoint flush 完成
- • sessionEvents 落盘保
/resume 与 /rewind
- • 每个 mutating 工具前写 checkpoint blob
- • SelfCorrect 默认开:LSP 诊断,按权限模式自动修
- •
/selfcorrect on 才追加项目测试
- •
Run():非 TTY 直接退出码 2(防止挂起)
- •
Init() 主动请求 WindowSize,不依赖终端推送
- • auto 主题请求背景色决定明/暗
- • 模型发现预热 context 用量计(token 窗口)