Repository navigation
Save drafts without a window, address drafts by id, forward draft/open modes (carries #154) - #158
Conversation
compose_email(mode="draft") made a hidden message (visible:false) and
then ran "close window 1 saving yes". The message has no window, so that
acted on whichever Mail window was in front. It now calls "save" on the
hidden message, which files it in Drafts without opening anything, and
reports the new draft's id. manage_drafts(action="create") had no save
step at all; it now saves the same way and reports the id.
The id is found by snapshotting the ids in Mail's Drafts mailbox before
the message is made and taking the one new draft with the same subject.
manage_drafts takes draft_id, so open, send and delete can act on one
draft by its Mail id ("«class mssg» id N", re-read to catch a miss)
instead of the first subject match. action="list" shows each id.
With body_html, compose_email still pastes the body into a compose
window, so that draft path is unchanged.
forward_email could only send. It now takes mode ("send", the default,
"draft" or "open") and message_id, which looks the message up directly
instead of taking the first subject match.
mode="open" runs Mail's own forward and leaves its compose window up for
review without sending.
mode="draft" saves to Drafts without opening a window. Mail's forward
command opens a compose window even "without opening window", so the
draft is a new hidden message instead: the original's plain-text content
under a "Begin forwarded message:" header, with a copy of each original
attachment (saved to a temporary folder, attached, then removed). It is
saved and its id found as compose_email's drafts are. It has no HTML
formatting.
With a non-sending mode, forward_email no longer needs to be removed
under --read-only; like compose_email and reply_to_email it stays
registered and refuses only mode="send". Its "to" parameter now comes
second, since subject_keyword is optional when message_id is given.
…edit #154 in CHANGELOG Attachment names come from incoming mail; a "/" in one would let 'save' write outside the per-attachment temp folder. Replace "/" with "_" and fall back to "attachment" for empty, "." or ".." names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CoqrHaj3Ru8RUcwAATtUT1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CoqrHaj3Ru8RUcwAATtUT1
…the snapshot and lookups; skip attachments that can't be copied From the second review of #154: - The Drafts snapshot runs in its own try, so a Drafts mailbox Mail can't read no longer stops a draft from being saved (main didn't need it). - Lookups after 'save' can't raise: an error there made the tool report 'Error' for a saved draft, and a retry created a duplicate. - More than one new matching draft (Gmail sync copies) is reported as ambiguous instead of picking the first id. - compose/create/forward print the success line and draft id only when the draft was found; otherwise they say the save is not verified. - forward draft: an attachment that can't be saved (e.g. not downloaded on IMAP) is skipped and reported instead of losing the whole draft. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CoqrHaj3Ru8RUcwAATtUT1
…dn't be read Second-review follow-ups: new drafts sharing a Message-ID count as one (matching the reply-draft path), a failed snapshot reports that Drafts could not be read, and VerifiedSaveTests moves above the __main__ guard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CoqrHaj3Ru8RUcwAATtUT1
|
Posted by Claude (AI maintainer agent) on Patrick's behalf. Merging. What: plain-text drafts from Thanks again @planttltd. The live checks on iCloud made this much easier to trust. Generated by Claude Code |
Carries #154 by @planttltd (its two commits are kept unchanged, with authorship).
What it does
compose_email(mode="draft")(plain text) andmanage_drafts(action="create")save the hidden message withsaveinstead ofclose window 1 saving yes. That command acted on whichever Mail window was in front, which could close or save the user's own window. Neither path opens a window now, and both report the new draft's id.manage_draftstakesdraft_id, soopen,sendanddeletecan target one exact draft, andlistshows each draft's id. This is id-first targeting, per Epic: reply-safety redesign (verified drafts, body placement, simpler compose surface) #80.forward_emailtakesmode(senddefault,draft,open) andmessage_id. Under--read-onlyit stays registered and refuses onlymode="send".Maintainer changes on top
savecan't write outside the per-attachment temp folder.try, lookups aftersavecan't raise (an error there would make an agent retry into a duplicate), several new matching drafts are reported as ambiguous, and the success line plus draft id print only when the draft was actually found in Drafts. Otherwise the output says "not verified, check Drafts before retrying".Testing
Not changed here: HTML drafts and
reply_to_email(mode="draft")still need a compose window. The reply path still useswindow 1, tracked in #157.Generated by Claude Code