Let AI agents unsubscribe from mailing lists the way each message says #30
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
queue
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
romaine-life/tuimail!30
Loading…
Reference in a new issue
No description provided.
Delete branch "agent-unsubscribe"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Work package: https://openproject.home.romaine.life/wp/TUI-16
Lets an AI agent unsubscribe the user from mailing lists, when the user asks it to. Until now agents saw links only as their site and had no call that opens links or sends, so they couldn't.
Added
unsubscribeMCP tool (agent::Call::Unsubscribe, ids from search_messages, at most 50 a call,deny_unknown_fields). For each message, tuimail reads its head (from the cache, else one download shared with reads, within the download limits) and does what its List-Unsubscribe says:List-Unsubscribe=One-Click(RFC 8058), it POSTs that body,application/x-www-form-urlencoded, to the https link over tuimail's own TLS (net::connect). Limits: a 30 s time limit, only the answer's head read (capped at 16 KB), no redirect followed, on a background task. The host must be a name on port 443 (not an IP address or this computer) and must match the sitelink_hostshows. A 2xx answer means done.mailto:'s one address only (the subject comes from the link, else "unsubscribe"). It goes out through the account's SMTP (worker::send), from the account the mail came to, with a copy kept in Sent. A link that names more than one address is refused.Uasks (Confirm::OpenLink, now naming the agent that asked), but only when nothing else is open; otherwise the agent is just told.UNSUBSCRIBES_PER_HOURlimit (200) applies; unsubscribes don't count against the change limits. Refused while agents are off, like every call.op="unsubscribing"by class only (Class::Http(status), timeout, TLS…). SMTP failures are logged byworker::send, as before.http.rs: oauth.rs's HTTP/1.1 form POST and answer parsing, moved out to be shared, pluspost_for_status, which reads only the head.unsubscribe.rs: which way to unsubscribe (way), the one-click target checks, the mailto draft, and the POST.mail::unsubscribe_ofparses only the head.y, the sent message's recipients, a copy in Sent, each way's answer, the OpenLink question, the download path).Changed
mcp::INSTRUCTIONS(1,367 of 2,048 characters): agents may unsubscribe only when the user asks, should use mark_spam for spam, and are told unsubscribe does only what a list's own header offers. The tool's description warns that unsubscribing from real spam confirms the address.SentCopygainsagent, andon_sent's Sent copy is nowkeep_sent_copy. The agent read's download is nowagent_download.Left alone
Ukey and its composer and confirmation behave as before.