feat(mail): add message types and threading support

- Add MessageType enum (task, scavenge, notification, reply)
- Expand Priority from 2 to 4 levels (low, normal, high, urgent)
- Add ThreadID and ReplyTo fields to Message struct
- Add --type and --reply-to flags to 'gt mail send'
- Add 'gt mail thread <id>' command to view conversation threads
- Update inbox/read display to show type and threading info
- Auto-generate thread IDs for new messages
- Reply messages inherit thread from original

Closes: gt-hgk

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-18 20:14:13 -08:00
parent 915594c44c
commit 96902092fd
4 changed files with 369 additions and 16 deletions

View File

@@ -36,9 +36,23 @@ func (r *Router) Send(msg *Message) error {
"-s", msg.Subject,
}
// Add importance flag for high priority
if msg.Priority == PriorityHigh {
args = append(args, "--importance", "high")
// Add priority flag
beadsPriority := PriorityToBeads(msg.Priority)
args = append(args, "--priority", fmt.Sprintf("%d", beadsPriority))
// Add message type if set
if msg.Type != "" && msg.Type != TypeNotification {
args = append(args, "--type", string(msg.Type))
}
// Add thread ID if set
if msg.ThreadID != "" {
args = append(args, "--thread-id", msg.ThreadID)
}
// Add reply-to if set
if msg.ReplyTo != "" {
args = append(args, "--reply-to", msg.ReplyTo)
}
cmd := exec.Command("bd", args...)
@@ -57,7 +71,7 @@ func (r *Router) Send(msg *Message) error {
}
// Optionally notify if recipient is a polecat with active session
if isPolecat(msg.To) && msg.Priority == PriorityHigh {
if isPolecat(msg.To) && (msg.Priority == PriorityHigh || msg.Priority == PriorityUrgent) {
r.notifyPolecat(msg)
}