Chat tools: argument validation, replace, file snapshots, server-fetched images, show_run, show_diff head/paths, schedule_followup

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-02 19:44:47 +00:00
parent c441400f36
commit d204ce3187
27 changed files with 1988 additions and 79 deletions
+13 -5
View File
@@ -801,12 +801,20 @@ func (h *chatHub) nextPrompt(room *chatRoom) (*chatQueuedPrompt, chan struct{},
return nil, nil, false
}
var wait time.Duration
head, followupWait := chatQueueHead(room.queue, h.clock())
if len(room.queue) > 0 {
switch now := h.clock(); {
case room.queue[0].sendAt.After(now):
case head < 0:
// Only agent follow-ups that are not due yet: sleep until the
// first of them.
wait = min(followupWait, chatQueueScheduleRecheck)
case room.queue[head].sendAt.After(now):
// A scheduled head waits for its time; the queue is FIFO, so
// later prompts wait behind it. A timer wakes the runner then.
wait = min(room.queue[0].sendAt.Sub(now), chatQueueScheduleRecheck)
wait = min(room.queue[head].sendAt.Sub(now), chatQueueScheduleRecheck)
if followupWait > 0 {
wait = min(wait, followupWait)
}
case room.observedTurn:
wait = chatQueueBusyPoll
if !room.running {
@@ -826,9 +834,9 @@ func (h *chatHub) nextPrompt(room *chatRoom) (*chatQueuedPrompt, chan struct{},
h.mu.Lock()
if busy {
wait = chatQueueBusyPoll
} else if len(room.queue) > 0 && !room.observedTurn && room.ctx.Err() == nil && !room.queue[0].sendAt.After(h.clock()) {
p := room.queue[0]
room.queue = room.queue[1:]
} else if index, _ := chatQueueHead(room.queue, h.clock()); index >= 0 && !room.observedTurn && room.ctx.Err() == nil && !room.queue[index].sendAt.After(h.clock()) {
p := room.queue[index]
room.queue = append(room.queue[:index:index], room.queue[index+1:]...)
room.running = true
room.nativeTurnID = ""
room.turnDone = make(chan struct{})