Mark the lead's messages and answers as the lead's, not the human's

This commit is contained in:
Ian Gulliver
2026-10-20 12:20:51 -07:00
parent 181482e5d0
commit 0f33ad4524
14 changed files with 93 additions and 23 deletions
+19 -1
View File
@@ -49,6 +49,24 @@ func isLeadActor(actor string) bool {
return strings.HasSuffix(actor, " (lead)")
}
func leadOwner(actor string) string {
return strings.TrimSuffix(actor, " (lead)")
}
func actorName(actor string) string {
if !isLeadActor(actor) {
return actor
}
return leadOwner(actor) + "'s lead agent"
}
func agentText(actor, text string) string {
if !isLeadActor(actor) {
return text
}
return fmt.Sprintf("This message is from %s, not from %s:\n\n%s", actorName(actor), leadOwner(actor), text)
}
func humanActor(actor string) bool {
return actor != "byre" && actor != agentActor && actor != boardActor && !strings.HasSuffix(actor, leadActor(""))
}
@@ -645,7 +663,7 @@ func (m *Manager) answeredText(ctx context.Context, item api.InboxItem) string {
answer = strings.TrimSpace(answer + " " + *r.Text)
}
recommended := strings.Join(anyStrings(item.Payload["recommended"]), "; ")
return fmt.Sprintf("%s: %s answered question %s %q: %s\nThe agent recommended: %s", m.taskLabel(ctx, item.TaskId), r.User, item.Id, clip(fmt.Sprint(item.Payload["question"]), 300), clip(answer, 600), clip(recommended, 600))
return fmt.Sprintf("%s: %s answered question %s %q: %s\nThe agent recommended: %s", m.taskLabel(ctx, item.TaskId), actorName(r.User), item.Id, clip(fmt.Sprint(item.Payload["question"]), 300), clip(answer, 600), clip(recommended, 600))
}
func remarshal(from any, to any) error {