LIVE 模式改為雙向對話(codex exec --json + resume 接力)

摘要:
與 claude-office 同功能:側邊面板聊天室,每則訊息 spawn
codex exec --json,捕捉 thread_id 後下一則以 codex exec resume 接力。

根本原因:
單向 /task 看不到回覆也無法追問。

影響:
watcher 新增 POST /chat 與 chat_* SSE 事件;已實測一輪對話
(thread.started → agent_message → turn.completed)正確回傳。

修法:
- watch.mjs:launchChat 解析 --json 事件流(thread_id / agent_message /
  turn.completed),chatThreads 記憶 thread
- 前端與 claude-office 同步(ChatPanel / chats store / chat_* 對映)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-20 14:59:24 +08:00
co-authored by Claude Fable 5
parent ef07f4b8ad
commit 89a8b75b61
6 changed files with 817 additions and 399 deletions
+102
View File
@@ -348,6 +348,108 @@
border-color: transparent;
}
.chat-panel {
margin-top: 14px;
}
.chat-head {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 6px;
}
.chat-head h3 {
font-size: 11px;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--text-dim);
}
.chat-head .link-btn:disabled {
opacity: 0.4;
cursor: default;
}
.chat-list {
display: flex;
flex-direction: column;
gap: 6px;
max-height: 260px;
overflow-y: auto;
padding: 8px;
margin-bottom: 8px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 10px;
}
.chat-msg {
max-width: 88%;
font-size: 12px;
line-height: 1.5;
padding: 6px 10px;
border-radius: 10px;
white-space: pre-wrap;
overflow-wrap: anywhere;
animation: card-in 0.2s ease-out;
}
.chat-msg.user {
align-self: flex-end;
background: var(--terracotta);
color: #fff;
border-bottom-right-radius: 3px;
}
.chat-msg.assistant {
align-self: flex-start;
background: var(--bg-panel);
border: 1px solid var(--border);
border-bottom-left-radius: 3px;
}
.chat-msg.system {
align-self: center;
color: var(--text-dim);
font-size: 11px;
font-style: italic;
background: none;
padding: 2px 6px;
}
.chat-msg.pending {
align-self: flex-start;
color: var(--text-dim);
font-size: 11px;
background: none;
animation: emote-bob 1.6s ease-in-out infinite;
}
.chat-panel textarea {
width: 100%;
resize: vertical;
font-family: inherit;
font-size: 12px;
line-height: 1.5;
color: var(--text);
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 8px;
padding: 8px 10px;
}
.chat-panel textarea:focus {
outline: none;
border-color: var(--terracotta);
}
.chat-hint {
font-size: 11px;
color: var(--text-dim);
}
.task-composer {
margin-top: 14px;
}