Add Away mode and an agent fork tool

This commit is contained in:
Ian Gulliver
2026-10-19 21:40:24 -07:00
parent bb60b685ba
commit f6f2440635
22 changed files with 617 additions and 317 deletions
+16
View File
@@ -146,6 +146,22 @@ func (m *Manager) ask(ctx context.Context, l *live, raw json.RawMessage) (string
l.asked = true
m.mu.Unlock()
task, err := m.store.GetTask(ctx, l.taskID)
if err != nil {
return "", err
}
creator, err := m.store.GetUser(ctx, task.CreatedBy)
if err != nil {
return "", err
}
if creator.Away {
err = m.answerAway(ctx, creator.Login, id)
if err == nil {
return fmt.Sprintf("Question %s filed, but %s is away, so byre answered it for them at once; the answer reaches you next.", id, creator.Login), nil
}
slog.Error("answer question while away", "item", id, "user", creator.Login, "err", err)
}
return fmt.Sprintf("Question filed in the human's inbox. question_id: %s. End your turn now. The answer will arrive as your next message. "+
"If the human answers it some other way, such as in a chat message, withdraw it with cancel_question and question_id %q.", id, id), nil
}