Skip to content

feat(email): Drafted column — agent-drafted replies awaiting approval #1011

@itomek

Description

@itomek

Goal

When the agent calls draft_reply (existing tool, see PR #965), the resulting draft lands in the dashboard's Drafted column with per-draft Send / Edit / Discard actions — not as text in a chat. This is the first column that demonstrates the dashboard's "agent does work, human approves" loop, which is the central trust-arc claim for this surface.

Why now

Fourth sub-issue under #1007. Comes after the state machine (#1010) because drafts are stateful items (drafted → approved → sent). Comes before persistence (#1007 sub-issue 7) because we want the loop visible even if it doesn't survive restart yet.

Scope

  • When the agent invokes draft_reply, surface the result in the dashboard's Drafted column, not (only) in the chat stream.
  • Each drafted-reply card displays:
    • Recipient(s), subject, body preview (truncated, expandable).
    • Three actions: Send (gates through existing TOOLS_REQUIRING_CONFIRMATION for send_draft), Edit (opens the draft for inline edit before send), Discard (state → dismissed, agent's draft is dropped).
  • Send action reuses the existing send_draft tool — no parallel send path.
  • Edit action: minimal inline editor (textarea), saved edits update the action store payload before send.
  • Drafts persist in the in-session store across Refreshes during the same session.
  • Render the count badge on the column header (e.g. "Drafted (2)").

Acceptance

  • Agent's draft_reply results appear in the Drafted column with no chat-driving required.
  • Send → confirmation dialog → send_draft tool fires → state moves to sent on success, item removed from Drafted column, summary appears in Archived-this-session column.
  • Edit applies user changes to the draft before send; tested round-trip.
  • Discard moves state to dismissed and the agent's draft is dropped (no future Refresh resurrects it in this session).
  • Existing send_draft confirmation gating is preserved — no bypass path.
  • Body preview truncation matches the existing 100-char convention from PR #965.
  • Tests for the draft state transitions.

Out of scope

  • Persistent drafts across restarts (sub-issue 7).
  • Auto-drafting from background events (sub-issue 9).
  • Multi-recipient cc/bcc UI beyond what send_draft already accepts.

Depends on

  • #1010 (state machine + store)

Refs

  • Parent: #1007
  • Existing draft / send tooling: PR #965

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentdomain:automationScheduler, autonomy, RAG, web search, watchers, researchenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions