- Add DispatchContext field to Task model for rule metadata storage - Add BlocklistEmails config (BLOCKLIST_EMAILS env var) - Wire rules.Pipeline into IMAPWatcher, replacing inline whitelist check - Pass rule metadata through DispatchContext to OpenClaw dispatch - Remove isWhitelisted method (now handled by WhitelistRule) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
37 lines
1.0 KiB
Go
37 lines
1.0 KiB
Go
package database
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// Task status constants matching the requirement's state machine.
|
|
const (
|
|
StatusIgnored = "IGNORED"
|
|
StatusReceived = "RECEIVED"
|
|
StatusAIProcessing = "AI_PROCESSING"
|
|
StatusCallbackDone = "CALLBACK_DONE"
|
|
StatusSMTPRetrying = "SMTP_RETRYING"
|
|
StatusCompleted = "COMPLETED"
|
|
StatusFailed = "FAILED"
|
|
)
|
|
|
|
// Task represents a single email processing unit tracked through the pipeline.
|
|
type Task struct {
|
|
ID uint `gorm:"primaryKey;autoIncrement"`
|
|
TaskUUID string `gorm:"uniqueIndex;not null"`
|
|
ThreadID string `gorm:"index"`
|
|
MessageID string `gorm:"index"`
|
|
Sender string
|
|
Subject string
|
|
BodyPlain string
|
|
DispatchContext string // JSON metadata from external rules pipeline.
|
|
AIResponse string
|
|
Status string `gorm:"index;not null"`
|
|
AttemptOpenClaw int `gorm:"default:0"`
|
|
AttemptSMTP int `gorm:"default:0"`
|
|
LastError *string
|
|
NextRetryAt *time.Time
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|