LIVE 模式改為雙向對話,參考 claudecodeui 的 resume 接力機制
摘要:
側邊面板從單向任務派發升級為聊天室:每則訊息 spawn
claude -p --output-format stream-json,捕捉 session_id 後
下一則自動 --resume 接力,對話得以連續;回覆同步顯示在
聊天串與小人頭上的對話氣泡。
根本原因:
單向 /task 發出後看不到回覆內容,也無法追問;claudecodeui
證明 headless + resume 接力即可實現連續對話,無需常駐 runtime。
影響:
watcher 新增 POST /chat(每專案一個 office thread、busy 檢查、
reset 會終止進行中的執行);SSE 新增 chat_start/chat_text/chat_done。
/task API 保留。已實測兩輪對話,第二輪正確記得第一輪內容。
修法:
- watch.mjs:launchChat 解析 stream-json(init 抓 session_id、
assistant 文字轉發、result 收尾),chatThreads 記憶 thread
- store:chats Map + chatAppend/chatSetBusy/chatClear
- live.ts:sendChat/resetChat + chat_* 事件對映
- SidePanel:ChatPanel(氣泡串、自動捲底、Enter 送出、新對話)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>