{
  "openapi": "3.1.0",
  "info": {
    "title": "mxr HTTP Bridge",
    "description": "Local-first email daemon HTTP/WebSocket surface. All routes (except /api/v1/health) require a bearer token from ~/.config/mxr/bridge-token.",
    "contact": {
      "name": "mxr",
      "url": "https://mxr.sh"
    },
    "license": {
      "name": "MIT OR Apache-2.0"
    },
    "version": "0.6.1"
  },
  "paths": {
    "/api/v1/admin/diagnostics": {
      "get": {
        "tags": [],
        "summary": "Diagnostics report",
        "operationId": "admin_diagnostics",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/admin/diagnostics/bug-report": {
      "get": {
        "tags": [],
        "summary": "Sanitized bug report",
        "operationId": "admin_bug_report",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/admin/events": {
      "get": {
        "tags": [],
        "summary": "Persisted daemon events",
        "operationId": "admin_events",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/admin/logs": {
      "get": {
        "tags": [],
        "summary": "Recent daemon logs",
        "operationId": "admin_logs",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/admin/ping": {
      "post": {
        "tags": [],
        "summary": "Bridge round-trip ping",
        "operationId": "admin_ping",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/admin/shutdown": {
      "post": {
        "tags": [],
        "summary": "Request daemon shutdown",
        "operationId": "admin_shutdown",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/admin/status": {
      "get": {
        "tags": [],
        "summary": "Daemon status snapshot",
        "operationId": "admin_status",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/client/shell": {
      "get": {
        "tags": [],
        "summary": "Client shell manifest",
        "operationId": "client_shell",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/docs": {
      "get": {
        "tags": [],
        "summary": "Swagger UI",
        "operationId": "swagger_ui",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/events": {
      "get": {
        "tags": [],
        "summary": "WebSocket daemon event stream",
        "operationId": "events_ws",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/health": {
      "get": {
        "tags": [],
        "summary": "Unauthenticated bridge liveness probe",
        "operationId": "health",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/actions/invite/reply": {
      "post": {
        "tags": [],
        "summary": "Reply to a calendar invite",
        "operationId": "action_invite_reply",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/actions/snooze": {
      "post": {
        "tags": [],
        "summary": "Snooze messages",
        "operationId": "action_snooze",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/actions/snooze/presets": {
      "get": {
        "tags": [],
        "summary": "List snooze presets",
        "operationId": "action_snooze_presets",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/actions/unsubscribe": {
      "post": {
        "tags": [],
        "summary": "Unsubscribe from list mail",
        "operationId": "action_unsubscribe",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/actions/unsubscribe-purge": {
      "post": {
        "tags": [],
        "summary": "Unsubscribe and clear sender footprint",
        "operationId": "action_unsubscribe_purge",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/attachments/download": {
      "post": {
        "tags": [],
        "summary": "Download an attachment",
        "operationId": "attachment_download",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/attachments/open": {
      "post": {
        "tags": [],
        "summary": "Open an attachment",
        "operationId": "attachment_open",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/commitments": {
      "get": {
        "tags": [],
        "summary": "List detected commitments",
        "operationId": "mail_commitments_list",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/commitments/{commitment_id}/resolve": {
      "post": {
        "tags": [],
        "summary": "Resolve a commitment",
        "operationId": "mail_commitments_resolve",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/compose/session": {
      "post": {
        "tags": [],
        "summary": "Start compose session",
        "operationId": "compose_session_start",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/compose/session/attachment": {
      "post": {
        "tags": [],
        "summary": "Upload compose attachment",
        "operationId": "compose_session_attachment",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/compose/session/collaborators": {
      "post": {
        "tags": [],
        "summary": "Suggest maybe-include recipients for a compose session",
        "operationId": "compose_session_collaborators",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/compose/session/discard": {
      "post": {
        "tags": [],
        "summary": "Discard compose session",
        "operationId": "compose_session_discard",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/compose/session/refresh": {
      "post": {
        "tags": [],
        "summary": "Refresh compose session",
        "operationId": "compose_session_refresh",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/compose/session/restore": {
      "post": {
        "tags": [],
        "summary": "Restore compose session",
        "operationId": "compose_session_restore",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/compose/session/safety-check": {
      "post": {
        "tags": [],
        "summary": "Run the pre-send safety report for a compose session",
        "operationId": "compose_session_safety_check",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/compose/session/save": {
      "post": {
        "tags": [],
        "summary": "Save compose session",
        "operationId": "compose_session_save",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/compose/session/send": {
      "post": {
        "tags": [],
        "summary": "Send compose session",
        "operationId": "compose_session_send",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/compose/session/update": {
      "post": {
        "tags": [],
        "summary": "Update compose session",
        "operationId": "compose_session_update",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/contacts/autocomplete": {
      "get": {
        "tags": [],
        "summary": "Prefix-search known senders",
        "operationId": "contacts_autocomplete",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/contacts/briefing": {
      "get": {
        "tags": [],
        "summary": "Recipient briefing for compose context",
        "operationId": "mail_contacts_briefing",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/contacts/expert": {
      "get": {
        "tags": [],
        "summary": "Find experts who answered similar questions",
        "operationId": "mail_contacts_expert",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/count": {
      "get": {
        "tags": [],
        "summary": "Count matching messages",
        "operationId": "mail_count",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/drafts": {
      "get": {
        "tags": [],
        "summary": "List drafts",
        "operationId": "mail_drafts",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/drafts/compose": {
      "post": {
        "tags": [],
        "summary": "Generate an LLM draft (new message or reply)",
        "operationId": "mail_draft_compose",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/drafts/orphaned": {
      "get": {
        "tags": [],
        "summary": "List orphaned mid-send drafts",
        "operationId": "mail_drafts_orphaned_list",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/drafts/refine": {
      "post": {
        "tags": [],
        "summary": "Refine draft text with LLM",
        "operationId": "mail_draft_refine",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/drafts/save-local": {
      "post": {
        "tags": [],
        "summary": "Persist draft locally (SaveDraft)",
        "operationId": "mail_drafts_save_local",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/drafts/{draft_id}/reset-orphan": {
      "post": {
        "tags": [],
        "summary": "Reset orphaned sending draft",
        "operationId": "mail_drafts_reset_orphan",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/drafts/{draft_id}/send-stored": {
      "post": {
        "tags": [],
        "summary": "Send stored draft by id",
        "operationId": "mail_drafts_send_stored",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/drafts/{draft_id}/stored": {
      "delete": {
        "tags": [],
        "summary": "Delete stored draft",
        "operationId": "mail_drafts_delete_stored",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/export-search": {
      "post": {
        "tags": [],
        "summary": "Export all threads matching a search",
        "operationId": "mail_export_search",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/humanizer/rewrite": {
      "post": {
        "tags": [],
        "summary": "Rewrite draft toward target voice",
        "operationId": "mail_humanizer_rewrite",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/humanizer/score": {
      "post": {
        "tags": [],
        "summary": "Score draft for human-like voice",
        "operationId": "mail_humanizer_score",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/jobs": {
      "get": {
        "tags": [],
        "summary": "List background jobs",
        "operationId": "mail_jobs",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/jobs/{job_id}": {
      "get": {
        "tags": [],
        "summary": "Inspect a background job",
        "operationId": "mail_job_detail",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/labels/create": {
      "post": {
        "tags": [],
        "summary": "Create a label",
        "operationId": "label_create",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/labels/delete": {
      "post": {
        "tags": [],
        "summary": "Delete a label",
        "operationId": "label_delete",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/labels/rename": {
      "post": {
        "tags": [],
        "summary": "Rename a label",
        "operationId": "label_rename",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/mailbox": {
      "get": {
        "tags": [],
        "summary": "Mailbox view",
        "operationId": "mail_mailbox",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/messages/{message_id}/body": {
      "get": {
        "tags": [],
        "summary": "Get message body (IPC GetBody)",
        "operationId": "mail_message_body",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/messages/{message_id}/flags": {
      "post": {
        "tags": [],
        "summary": "Set message flags bitmask",
        "operationId": "mail_message_set_flags",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/messages/{message_id}/headers": {
      "get": {
        "tags": [],
        "summary": "Raw RFC headers",
        "operationId": "mail_message_raw_headers",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/messages/{message_id}/html-images": {
      "get": {
        "tags": [],
        "summary": "List HTML-linked image assets",
        "operationId": "mail_message_html_images",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/mutations/archive": {
      "post": {
        "tags": [],
        "summary": "Archive messages",
        "operationId": "mutation_archive",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/mutations/labels": {
      "post": {
        "tags": [],
        "summary": "Add or remove labels",
        "operationId": "mutation_labels",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/mutations/move": {
      "post": {
        "tags": [],
        "summary": "Move messages to a label or folder",
        "operationId": "mutation_move",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/mutations/read": {
      "post": {
        "tags": [],
        "summary": "Mark messages read or unread",
        "operationId": "mutation_read",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/mutations/read-and-archive": {
      "post": {
        "tags": [],
        "summary": "Read and archive messages",
        "operationId": "mutation_read_archive",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/mutations/route": {
      "post": {
        "tags": [],
        "summary": "Route messages from a queue to a label",
        "operationId": "mutation_route",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/mutations/spam": {
      "post": {
        "tags": [],
        "summary": "Mark messages as spam",
        "operationId": "mutation_spam",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/mutations/star": {
      "post": {
        "tags": [],
        "summary": "Star or unstar messages",
        "operationId": "mutation_star",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/mutations/trash": {
      "post": {
        "tags": [],
        "summary": "Trash messages",
        "operationId": "mutation_trash",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/mutations/undo": {
      "post": {
        "tags": [],
        "summary": "Undo a recent mutation",
        "operationId": "mutation_undo",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/relationship": {
      "get": {
        "tags": [],
        "summary": "Relationship profile for a contact",
        "operationId": "mail_relationship_profile",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/relationship/rebuild": {
      "post": {
        "tags": [],
        "summary": "Rebuild relationship analytics",
        "operationId": "mail_relationship_rebuild",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/reminders": {
      "post": {
        "tags": [],
        "summary": "Schedule an auto-reminder",
        "operationId": "reminders_set",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/reminders/{message_id}": {
      "delete": {
        "tags": [],
        "summary": "Cancel an auto-reminder",
        "operationId": "reminders_cancel",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/reply-later": {
      "get": {
        "tags": [],
        "summary": "List reply-later messages",
        "operationId": "reply_later_list",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/reply-later/{message_id}": {
      "post": {
        "tags": [],
        "summary": "Set or clear reply-later",
        "operationId": "reply_later_set",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/scheduled-sends": {
      "post": {
        "tags": [],
        "summary": "Schedule a draft send",
        "operationId": "scheduled_sends_create",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/scheduled-sends/{draft_id}": {
      "delete": {
        "tags": [],
        "summary": "Cancel a scheduled send",
        "operationId": "scheduled_sends_cancel",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/screener/decisions": {
      "get": {
        "tags": [],
        "summary": "List screener decisions",
        "operationId": "screener_decisions_list",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Set screener decision",
        "operationId": "screener_decisions_set",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      },
      "delete": {
        "tags": [],
        "summary": "Clear screener decision",
        "operationId": "screener_decisions_clear",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/screener/queue": {
      "get": {
        "tags": [],
        "summary": "List screener queue",
        "operationId": "screener_queue",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/search": {
      "get": {
        "tags": [],
        "summary": "Run a mail search",
        "operationId": "mail_search",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/search/groups": {
      "get": {
        "tags": [],
        "summary": "Group a mail search result set",
        "operationId": "mail_search_groups",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/sender": {
      "get": {
        "tags": [],
        "summary": "Sender profile",
        "operationId": "sender_profile",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/signature-defaults": {
      "get": {
        "tags": [],
        "summary": "List signature defaults",
        "operationId": "mail_signature_defaults_list",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/signatures": {
      "get": {
        "tags": [],
        "summary": "List signatures",
        "operationId": "mail_signatures_list",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Create or update signature",
        "operationId": "mail_signatures_upsert",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/signatures/default": {
      "post": {
        "tags": [],
        "summary": "Set default signature",
        "operationId": "mail_signature_default_set",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/signatures/default/clear": {
      "post": {
        "tags": [],
        "summary": "Clear default signature",
        "operationId": "mail_signature_default_clear",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/signatures/resolve": {
      "post": {
        "tags": [],
        "summary": "Resolve signature for compose",
        "operationId": "mail_signature_resolve",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/signatures/{name}": {
      "delete": {
        "tags": [],
        "summary": "Delete signature",
        "operationId": "mail_signatures_delete",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/snippets": {
      "get": {
        "tags": [],
        "summary": "List snippets",
        "operationId": "snippets_list",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Create or update a snippet",
        "operationId": "snippets_set",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/snippets/{name}": {
      "delete": {
        "tags": [],
        "summary": "Delete a snippet",
        "operationId": "snippets_delete",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/snoozed": {
      "get": {
        "tags": [],
        "summary": "List snoozed messages",
        "operationId": "mail_snoozed",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/snoozed/{message_id}/wake": {
      "post": {
        "tags": [],
        "summary": "Wake one snoozed message",
        "operationId": "mail_unsnooze_one",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/sync": {
      "post": {
        "tags": [],
        "summary": "Trigger sync",
        "operationId": "mail_sync",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/sync/status": {
      "get": {
        "tags": [],
        "summary": "Sync status",
        "operationId": "mail_sync_status",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/threads/{thread_id}": {
      "get": {
        "tags": [],
        "summary": "Read a thread",
        "operationId": "mail_thread",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/threads/{thread_id}/briefing": {
      "get": {
        "tags": [],
        "summary": "Briefing for a dormant thread",
        "operationId": "mail_thread_briefing",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/threads/{thread_id}/export": {
      "get": {
        "tags": [],
        "summary": "Export a thread",
        "operationId": "mail_thread_export",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/threads/{thread_id}/summarize": {
      "post": {
        "tags": [],
        "summary": "Summarize a thread",
        "operationId": "thread_summarize",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/openapi.json": {
      "get": {
        "tags": [],
        "summary": "OpenAPI 3.1 document",
        "operationId": "openapi_json",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/accounts": {
      "get": {
        "tags": [],
        "summary": "List runtime accounts",
        "operationId": "accounts_list",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/accounts/authorize": {
      "post": {
        "tags": [],
        "summary": "Authorize or re-authorize account config",
        "operationId": "platform_accounts_authorize",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/accounts/config": {
      "get": {
        "tags": [],
        "summary": "List configured accounts",
        "operationId": "accounts_config",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/accounts/default": {
      "post": {
        "tags": [],
        "summary": "Set default account",
        "operationId": "account_set_default",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/accounts/repair": {
      "post": {
        "tags": [],
        "summary": "Repair account credentials in keychain",
        "operationId": "platform_accounts_repair",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/accounts/test": {
      "post": {
        "tags": [],
        "summary": "Test account connectivity",
        "operationId": "account_test",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/accounts/upsert": {
      "post": {
        "tags": [],
        "summary": "Create or update account",
        "operationId": "account_upsert",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/accounts/{account_id}/addresses": {
      "get": {
        "tags": [],
        "summary": "List account addresses",
        "operationId": "account_addresses_list",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Add account address",
        "operationId": "account_addresses_add",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/accounts/{account_id}/addresses/primary": {
      "post": {
        "tags": [],
        "summary": "Set primary account address",
        "operationId": "account_addresses_primary",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/accounts/{account_id}/addresses/remove": {
      "post": {
        "tags": [],
        "summary": "Remove account address",
        "operationId": "account_addresses_remove",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/accounts/{key}": {
      "delete": {
        "tags": [],
        "summary": "Remove account",
        "operationId": "account_remove",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/accounts/{key}/disable": {
      "post": {
        "tags": [],
        "summary": "Disable account",
        "operationId": "account_disable",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/analytics/contact-asymmetry": {
      "get": {
        "tags": [],
        "summary": "Contact asymmetry",
        "operationId": "analytics_contact_asymmetry",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/analytics/contact-decay": {
      "get": {
        "tags": [],
        "summary": "Contact decay",
        "operationId": "analytics_contact_decay",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/analytics/largest-messages": {
      "get": {
        "tags": [],
        "summary": "Largest messages",
        "operationId": "analytics_largest_messages",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/analytics/rebuild": {
      "post": {
        "tags": [],
        "summary": "Rebuild analytics",
        "operationId": "analytics_rebuild",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/analytics/refresh-contacts": {
      "post": {
        "tags": [],
        "summary": "Refresh contacts",
        "operationId": "analytics_refresh_contacts",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/analytics/response-time": {
      "get": {
        "tags": [],
        "summary": "Response-time analytics",
        "operationId": "analytics_response_time",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/analytics/stale-threads": {
      "get": {
        "tags": [],
        "summary": "Stale threads",
        "operationId": "analytics_stale_threads",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/analytics/storage-breakdown": {
      "get": {
        "tags": [],
        "summary": "Storage breakdown",
        "operationId": "analytics_storage_breakdown",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/analytics/wrapped": {
      "get": {
        "tags": [],
        "summary": "Wrapped analytics",
        "operationId": "analytics_wrapped",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/auth/sessions/start": {
      "post": {
        "tags": [],
        "summary": "Start OAuth session",
        "operationId": "auth_session_start",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/auth/sessions/{session_id}": {
      "get": {
        "tags": [],
        "summary": "Get OAuth session",
        "operationId": "auth_session_get",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/auth/sessions/{session_id}/cancel": {
      "post": {
        "tags": [],
        "summary": "Cancel OAuth session",
        "operationId": "auth_session_cancel",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/auth/sessions/{session_id}/complete": {
      "post": {
        "tags": [],
        "summary": "Complete OAuth session",
        "operationId": "auth_session_complete",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/llm/config": {
      "get": {
        "tags": [],
        "summary": "Get LLM configuration",
        "operationId": "llm_config_get",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Update LLM configuration",
        "operationId": "llm_config_update",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/llm/status": {
      "get": {
        "tags": [],
        "summary": "LLM provider status",
        "operationId": "llm_status",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/rules": {
      "get": {
        "tags": [],
        "summary": "List rules",
        "operationId": "rules_list",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/rules/delete": {
      "post": {
        "tags": [],
        "summary": "Delete rule",
        "operationId": "rule_delete",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/rules/detail": {
      "get": {
        "tags": [],
        "summary": "Rule detail",
        "operationId": "rule_detail",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/rules/dry-run": {
      "get": {
        "tags": [],
        "summary": "Dry-run rules",
        "operationId": "rule_dry_run",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/rules/form": {
      "get": {
        "tags": [],
        "summary": "Rule form payload",
        "operationId": "rule_form",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/rules/history": {
      "get": {
        "tags": [],
        "summary": "Rule history",
        "operationId": "rule_history",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/rules/upsert": {
      "post": {
        "tags": [],
        "summary": "Create or update rule",
        "operationId": "rule_upsert",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/rules/upsert-form": {
      "post": {
        "tags": [],
        "summary": "Create or update rule from form",
        "operationId": "rule_upsert_form",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/saved-searches": {
      "get": {
        "tags": [],
        "summary": "List saved searches",
        "operationId": "saved_searches_list",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/saved-searches/create": {
      "post": {
        "tags": [],
        "summary": "Create saved search",
        "operationId": "saved_searches_create",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/saved-searches/delete": {
      "post": {
        "tags": [],
        "summary": "Delete saved search",
        "operationId": "saved_searches_delete",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/saved-searches/run": {
      "post": {
        "tags": [],
        "summary": "Run saved search",
        "operationId": "saved_searches_run",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/saved-searches/update": {
      "post": {
        "tags": [],
        "summary": "Patch a saved search by name",
        "operationId": "saved_searches_update",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/semantic/backfill": {
      "post": {
        "tags": [],
        "summary": "Backfill semantic chunks",
        "operationId": "semantic_backfill",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/semantic/enable": {
      "post": {
        "tags": [],
        "summary": "Enable semantic search",
        "operationId": "semantic_enable",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/semantic/profiles/install": {
      "post": {
        "tags": [],
        "summary": "Install semantic profile",
        "operationId": "semantic_profile_install",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/semantic/profiles/use": {
      "post": {
        "tags": [],
        "summary": "Use semantic profile",
        "operationId": "semantic_profile_use",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/semantic/reindex": {
      "post": {
        "tags": [],
        "summary": "Reindex semantic search",
        "operationId": "semantic_reindex",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/semantic/status": {
      "get": {
        "tags": [],
        "summary": "Semantic index status",
        "operationId": "semantic_status",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/subscriptions": {
      "get": {
        "tags": [],
        "summary": "List subscriptions",
        "operationId": "subscriptions_list",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/voice": {
      "get": {
        "tags": [],
        "summary": "User voice profile for drafting",
        "operationId": "platform_voice_get",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/voice/rebuild": {
      "post": {
        "tags": [],
        "summary": "Rebuild user voice profile from sent mail",
        "operationId": "platform_voice_rebuild",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AccountAddress": {
        "type": "object",
        "description": "One owned email address per account. Direction inference compares\n`messages.from_email` against this set to decide inbound vs outbound.",
        "required": [
          "account_id",
          "email",
          "is_primary"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "email": {
            "type": "string"
          },
          "is_primary": {
            "type": "boolean"
          }
        }
      },
      "AccountCapabilitiesData": {
        "type": "object",
        "required": [
          "labels",
          "server_search",
          "delta_sync",
          "push",
          "batch_operations",
          "native_thread_ids",
          "supports_send",
          "supports_local_drafts",
          "supports_server_drafts"
        ],
        "properties": {
          "batch_operations": {
            "type": "boolean"
          },
          "delta_sync": {
            "type": "boolean"
          },
          "labels": {
            "type": "boolean"
          },
          "native_thread_ids": {
            "type": "boolean"
          },
          "push": {
            "type": "boolean"
          },
          "server_search": {
            "type": "boolean"
          },
          "supports_local_drafts": {
            "type": "boolean"
          },
          "supports_send": {
            "type": "boolean"
          },
          "supports_server_drafts": {
            "type": "boolean"
          }
        }
      },
      "AccountConfigData": {
        "type": "object",
        "required": [
          "key",
          "name",
          "email",
          "is_default"
        ],
        "properties": {
          "email": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "is_default": {
            "type": "boolean"
          },
          "key": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "send": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AccountSendConfigData"
              }
            ]
          },
          "sync": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AccountSyncConfigData"
              }
            ]
          }
        }
      },
      "AccountEditModeData": {
        "type": "string",
        "enum": [
          "full",
          "runtime_only"
        ]
      },
      "AccountId": {
        "type": "string",
        "format": "uuid"
      },
      "AccountMutationResultData": {
        "type": "object",
        "required": [
          "account_id",
          "account_name",
          "succeeded",
          "skipped",
          "failed"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "account_name": {
            "type": "string"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "failed": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "skipped": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "succeeded": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "AccountOperationResult": {
        "type": "object",
        "required": [
          "ok",
          "summary"
        ],
        "properties": {
          "auth": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AccountOperationStep"
              }
            ]
          },
          "device_code_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "device_code_user_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "ok": {
            "type": "boolean"
          },
          "save": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AccountOperationStep"
              }
            ]
          },
          "send": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AccountOperationStep"
              }
            ]
          },
          "summary": {
            "type": "string"
          },
          "sync": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AccountOperationStep"
              }
            ]
          }
        }
      },
      "AccountOperationStep": {
        "type": "object",
        "required": [
          "ok",
          "detail"
        ],
        "properties": {
          "detail": {
            "type": "string"
          },
          "ok": {
            "type": "boolean"
          }
        }
      },
      "AccountSendConfigData": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "gmail"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "token_ref",
              "type"
            ],
            "properties": {
              "client_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "token_ref": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "enum": [
                  "outlook_personal"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "token_ref",
              "type"
            ],
            "properties": {
              "client_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "token_ref": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "enum": [
                  "outlook_work"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "host",
              "port",
              "username",
              "password_ref",
              "use_tls",
              "type"
            ],
            "properties": {
              "auth_required": {
                "type": "boolean"
              },
              "host": {
                "type": "string"
              },
              "password": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "password_ref": {
                "type": "string"
              },
              "port": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "type": {
                "type": "string",
                "enum": [
                  "smtp"
                ]
              },
              "use_tls": {
                "type": "boolean"
              },
              "username": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "In-memory send provider for tests. Not for production use.",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "fake"
                ]
              }
            }
          }
        ]
      },
      "AccountSourceData": {
        "type": "string",
        "enum": [
          "runtime",
          "config",
          "both"
        ]
      },
      "AccountSummaryData": {
        "type": "object",
        "required": [
          "account_id",
          "name",
          "email",
          "provider_kind",
          "enabled",
          "is_default",
          "source",
          "editable"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "capabilities": {
            "$ref": "#/components/schemas/AccountCapabilitiesData"
          },
          "editable": {
            "$ref": "#/components/schemas/AccountEditModeData"
          },
          "email": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "is_default": {
            "type": "boolean"
          },
          "key": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "provider_kind": {
            "type": "string"
          },
          "send": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AccountSendConfigData"
              }
            ]
          },
          "send_kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "$ref": "#/components/schemas/AccountSourceData"
          },
          "sync": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AccountSyncConfigData"
              }
            ]
          },
          "sync_kind": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "AccountSyncConfigData": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "client_id",
              "token_ref",
              "type"
            ],
            "properties": {
              "client_id": {
                "type": "string"
              },
              "client_secret": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "credential_source": {
                "$ref": "#/components/schemas/GmailCredentialSourceData"
              },
              "token_ref": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "enum": [
                  "gmail"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "host",
              "port",
              "username",
              "password_ref",
              "use_tls",
              "type"
            ],
            "properties": {
              "auth_required": {
                "type": "boolean"
              },
              "host": {
                "type": "string"
              },
              "password": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "password_ref": {
                "type": "string"
              },
              "port": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "type": {
                "type": "string",
                "enum": [
                  "imap"
                ]
              },
              "use_tls": {
                "type": "boolean"
              },
              "username": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "token_ref",
              "type"
            ],
            "properties": {
              "client_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "token_ref": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "enum": [
                  "outlook_personal"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "token_ref",
              "type"
            ],
            "properties": {
              "client_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "token_ref": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "enum": [
                  "outlook_work"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "In-memory provider used for CLI smoke tests. Not for production use.",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "fake"
                ]
              }
            }
          }
        ]
      },
      "AccountSyncStatus": {
        "type": "object",
        "required": [
          "account_id",
          "account_name",
          "consecutive_failures",
          "sync_in_progress",
          "last_synced_count",
          "healthy"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "account_name": {
            "type": "string"
          },
          "backoff_until": {
            "type": [
              "string",
              "null"
            ]
          },
          "consecutive_failures": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "current_cursor_summary": {
            "type": [
              "string",
              "null"
            ]
          },
          "failure_class": {
            "type": [
              "string",
              "null"
            ]
          },
          "healthy": {
            "type": "boolean"
          },
          "last_attempt_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_success_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_synced_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "sync_in_progress": {
            "type": "boolean"
          }
        }
      },
      "ActivityCursor": {
        "type": "object",
        "required": [
          "ts",
          "id"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "ts": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "ActivityEntry": {
        "type": "object",
        "required": [
          "id",
          "ts",
          "source",
          "action",
          "tier",
          "redacted"
        ],
        "properties": {
          "account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "action": {
            "type": "string"
          },
          "context": {
            "description": "Parsed context; clients see structured JSON, not the raw string."
          },
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "redacted": {
            "type": "boolean"
          },
          "source": {
            "$ref": "#/components/schemas/ClientKind"
          },
          "target_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "target_kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "tier": {
            "$ref": "#/components/schemas/ActivityTier"
          },
          "ts": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "ActivityExportFormat": {
        "type": "string",
        "enum": [
          "csv",
          "json",
          "ndjson"
        ]
      },
      "ActivityFilter": {
        "type": "object",
        "properties": {
          "account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "action_prefix": {
            "type": [
              "string",
              "null"
            ]
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "include_redacted": {
            "type": "boolean"
          },
          "query": {
            "type": [
              "string",
              "null"
            ],
            "description": "FTS5 expression against `context_json`."
          },
          "since": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Unix ms inclusive lower bound."
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ClientKind"
            },
            "description": "Empty = any."
          },
          "target_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "target_kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "tiers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActivityTier"
            }
          },
          "until": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Unix ms exclusive upper bound."
          }
        }
      },
      "ActivityStatBucket": {
        "type": "object",
        "required": [
          "key",
          "count"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "format": "int64"
          },
          "key": {
            "type": "string",
            "description": "Group key — depends on `group_by`: action token, ISO date, source,\ntarget kind, or hour-of-day string `00`..`23`."
          }
        }
      },
      "ActivityStatGroupBy": {
        "type": "string",
        "enum": [
          "action",
          "day",
          "source",
          "target_kind",
          "hour"
        ]
      },
      "ActivityTier": {
        "type": "string",
        "description": "Mirror of `mxr_store::Tier`. Three retention buckets used by the\nactivity log: 30 / 90 / 365 days for ephemeral / standard / important.",
        "enum": [
          "ephemeral",
          "standard",
          "important"
        ]
      },
      "Address": {
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ArchiveAnswerData": {
        "type": "object",
        "required": [
          "text",
          "citations",
          "retrieval"
        ],
        "properties": {
          "citations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ArchiveCitationData"
            }
          },
          "retrieval": {
            "$ref": "#/components/schemas/ArchiveRetrievalData"
          },
          "text": {
            "type": "string"
          }
        }
      },
      "ArchiveAskFiltersData": {
        "type": "object",
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AccountId"
              }
            ]
          },
          "after": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "before": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "from": {
            "type": [
              "string",
              "null"
            ]
          },
          "mode": {
            "$ref": "#/components/schemas/ArchiveAskMode"
          },
          "to": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ArchiveAskMode": {
        "type": "string",
        "enum": [
          "hybrid",
          "lexical",
          "semantic"
        ]
      },
      "ArchiveCitationData": {
        "type": "object",
        "required": [
          "message_id",
          "thread_id",
          "subject",
          "date",
          "quote"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "quote": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "ArchiveRetrievalData": {
        "type": "object",
        "required": [
          "requested_mode",
          "executed_mode",
          "candidate_count"
        ],
        "properties": {
          "candidate_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "executed_mode": {
            "$ref": "#/components/schemas/ArchiveAskMode"
          },
          "requested_mode": {
            "$ref": "#/components/schemas/ArchiveAskMode"
          }
        }
      },
      "AttachmentDisposition": {
        "type": "string",
        "enum": [
          "attachment",
          "inline",
          "unspecified"
        ]
      },
      "AttachmentFile": {
        "type": "object",
        "required": [
          "attachment_id",
          "filename",
          "path"
        ],
        "properties": {
          "attachment_id": {
            "$ref": "#/components/schemas/AttachmentId"
          },
          "filename": {
            "type": "string"
          },
          "path": {
            "type": "string"
          }
        }
      },
      "AttachmentId": {
        "type": "string",
        "format": "uuid"
      },
      "AttachmentMeta": {
        "type": "object",
        "required": [
          "id",
          "message_id",
          "filename",
          "mime_type",
          "size_bytes",
          "provider_id"
        ],
        "properties": {
          "content_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "content_location": {
            "type": [
              "string",
              "null"
            ]
          },
          "disposition": {
            "$ref": "#/components/schemas/AttachmentDisposition"
          },
          "filename": {
            "type": "string"
          },
          "id": {
            "$ref": "#/components/schemas/AttachmentId"
          },
          "local_path": {
            "type": [
              "string",
              "null"
            ]
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "mime_type": {
            "type": "string"
          },
          "provider_id": {
            "type": "string"
          },
          "size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "AuthFlowData": {
        "type": "string",
        "enum": [
          "auto",
          "installed",
          "device"
        ]
      },
      "AuthSessionData": {
        "type": "object",
        "required": [
          "session_id",
          "state",
          "flow",
          "account_key"
        ],
        "properties": {
          "account_key": {
            "type": "string"
          },
          "auth_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at_unix": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "flow": {
            "$ref": "#/components/schemas/AuthFlowData"
          },
          "message": {
            "type": [
              "string",
              "null"
            ]
          },
          "poll_interval_secs": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "session_id": {
            "$ref": "#/components/schemas/AuthSessionId"
          },
          "state": {
            "$ref": "#/components/schemas/AuthSessionStateData"
          },
          "user_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "verification_uri": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "AuthSessionId": {
        "type": "string"
      },
      "AuthSessionStateData": {
        "type": "string",
        "enum": [
          "starting",
          "waiting_for_user",
          "authorized",
          "failed",
          "cancelled"
        ]
      },
      "BodyFailure": {
        "type": "object",
        "required": [
          "message_id",
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          }
        }
      },
      "BodyPartSource": {
        "type": "string",
        "enum": [
          "exact",
          "derived_from_plain",
          "derived_from_html",
          "best_effort_summary"
        ]
      },
      "CadenceDriftRowData": {
        "type": "object",
        "required": [
          "email",
          "expected_days",
          "drift_days",
          "total_volume"
        ],
        "properties": {
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "drift_days": {
            "type": "number",
            "format": "double"
          },
          "email": {
            "type": "string"
          },
          "expected_days": {
            "type": "number",
            "format": "double"
          },
          "last_contact_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "total_volume": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "CalendarAttendee": {
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "partstat": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": [
              "string",
              "null"
            ]
          },
          "rsvp": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "uri": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CalendarInviteActionData": {
        "type": "string",
        "enum": [
          "accept",
          "tentative",
          "decline"
        ]
      },
      "CalendarInviteData": {
        "type": "object",
        "required": [
          "id",
          "account_id",
          "message_id",
          "metadata",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "id": {
            "$ref": "#/components/schemas/CalendarInviteId"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "metadata": {
            "$ref": "#/components/schemas/CalendarMetadata"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "CalendarInviteId": {
        "type": "string",
        "format": "uuid"
      },
      "CalendarInviteResponsePreview": {
        "type": "object",
        "required": [
          "message_id",
          "action",
          "attendee_email",
          "organizer_email",
          "subject",
          "body_text",
          "ics",
          "warnings"
        ],
        "properties": {
          "action": {
            "$ref": "#/components/schemas/CalendarInviteActionData"
          },
          "attendee_email": {
            "type": "string"
          },
          "body_text": {
            "type": "string"
          },
          "ics": {
            "type": "string"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "organizer_email": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CalendarInviteResponseResult": {
        "type": "object",
        "required": [
          "message_id",
          "action",
          "rfc2822_message_id"
        ],
        "properties": {
          "action": {
            "$ref": "#/components/schemas/CalendarInviteActionData"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "provider_message_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "rfc2822_message_id": {
            "type": "string"
          }
        }
      },
      "CalendarMetadata": {
        "type": "object",
        "properties": {
          "attendees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CalendarAttendee"
            }
          },
          "component_kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "dtstamp": {
            "type": [
              "string",
              "null"
            ]
          },
          "ends_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_update": {
            "type": "boolean",
            "description": "Derived: true when the daemon has seen a prior REQUEST with the same\nUID and a lower SEQUENCE — i.e. this is a rescheduled / amended\ninvite."
          },
          "location": {
            "type": [
              "string",
              "null"
            ]
          },
          "method": {
            "type": [
              "string",
              "null"
            ]
          },
          "organizer": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CalendarPerson"
              }
            ]
          },
          "raw_ics": {
            "type": [
              "string",
              "null"
            ]
          },
          "recurrence_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "rrule": {
            "type": [
              "string",
              "null"
            ]
          },
          "rsvp_requested": {
            "type": "boolean"
          },
          "sequence": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "starts_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "summary": {
            "type": [
              "string",
              "null"
            ]
          },
          "uid": {
            "type": [
              "string",
              "null"
            ]
          },
          "viewer_attendee_email": {
            "type": [
              "string",
              "null"
            ],
            "description": "Derived: the email of the matched viewer attendee, as it appears in\nthe iCal `ATTENDEE` property. Used by the comment-compose path so the\nREPLY's `ATTENDEE` matches exactly."
          },
          "viewer_partstat": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CalendarPartstat",
                "description": "Derived: the PARTSTAT of the attendee whose address matches one of the\nviewing account's addresses. `None` if no attendee matched or if\nmultiple matched ambiguously (the strict send path errors instead)."
              }
            ]
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CalendarPartstat": {
        "type": "string",
        "description": "Typed view of an iCalendar `PARTSTAT` value, derived for the viewing\naccount's own attendee row. Maps 1:1 to the strings defined in RFC 5545.",
        "enum": [
          "needs_action",
          "accepted",
          "tentative",
          "declined",
          "delegated"
        ]
      },
      "CalendarPerson": {
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "uri": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CitationRef": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string"
          },
          "message_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "quote": {
            "type": "string"
          },
          "thread_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CitationRefData": {
        "type": "object",
        "required": [
          "field",
          "quote"
        ],
        "properties": {
          "field": {
            "type": "string"
          },
          "message_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "quote": {
            "type": "string"
          },
          "thread_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ClientKind": {
        "type": "string",
        "description": "Originating client for an IPC request. Carried on the envelope so the\ndaemon's activity recorder can tag rows with the surface that produced\nthem. Legacy clients (pre-source-field) decode as `Cli` — the most\nrealistic guess for scripts hand-rolled against the socket.",
        "enum": [
          "human",
          "tui",
          "cli",
          "script",
          "web",
          "daemon",
          "agent",
          "mcp"
        ]
      },
      "CommitmentData": {
        "type": "object",
        "required": [
          "id",
          "account_id",
          "email",
          "thread_id",
          "direction",
          "status",
          "who_owes",
          "what",
          "evidence_msg_id",
          "extracted_at"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "by_when": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "direction": {
            "$ref": "#/components/schemas/CommitmentDirectionData"
          },
          "email": {
            "type": "string"
          },
          "evidence_msg_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "extracted_at": {
            "type": "string",
            "format": "date-time"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/CommitmentStatusData"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          },
          "what": {
            "type": "string"
          },
          "who_owes": {
            "type": "string"
          }
        }
      },
      "CommitmentDirectionData": {
        "type": "string",
        "enum": [
          "yours",
          "theirs"
        ]
      },
      "CommitmentStatusData": {
        "type": "string",
        "enum": [
          "open",
          "resolved",
          "expired"
        ]
      },
      "ContactAsymmetryRow": {
        "type": "object",
        "required": [
          "email",
          "total_inbound",
          "total_outbound",
          "asymmetry",
          "last_seen_at"
        ],
        "properties": {
          "asymmetry": {
            "type": "number",
            "format": "double",
            "description": "`|inbound - outbound| / max(inbound, outbound)` in `[0, 1]`. 0 means\nperfectly balanced; 1 means I never responded (or vice versa)."
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": "string"
          },
          "last_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "total_inbound": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "total_outbound": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "ContactDecayRow": {
        "type": "object",
        "required": [
          "email",
          "last_inbound_at",
          "days_since_inbound"
        ],
        "properties": {
          "days_since_inbound": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "days_since_outbound": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": "string"
          },
          "last_inbound_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_outbound_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "ContactRelationshipSummaryData": {
        "type": "object",
        "required": [
          "text",
          "model",
          "known_topics",
          "computed_at",
          "source_hash"
        ],
        "properties": {
          "computed_at": {
            "type": "string",
            "format": "date-time"
          },
          "known_topics": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "model": {
            "type": "string"
          },
          "source_hash": {
            "type": "string"
          },
          "text": {
            "type": "string"
          }
        }
      },
      "ContactStyleData": {
        "type": "object",
        "required": [
          "formality_score",
          "formality_score_theirs",
          "avg_sentence_len",
          "avg_sentence_len_theirs",
          "msg_count_used",
          "msg_count_used_theirs",
          "computed_at",
          "source_hash"
        ],
        "properties": {
          "avg_sentence_len": {
            "type": "number",
            "format": "double"
          },
          "avg_sentence_len_theirs": {
            "type": "number",
            "format": "double"
          },
          "computed_at": {
            "type": "string",
            "format": "date-time"
          },
          "formality_score": {
            "type": "number",
            "format": "double"
          },
          "formality_score_theirs": {
            "type": "number",
            "format": "double"
          },
          "msg_count_used": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "msg_count_used_theirs": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "source_hash": {
            "type": "string"
          }
        }
      },
      "DaemonEvent": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "account_id",
              "messages_synced",
              "event"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "event": {
                "type": "string",
                "enum": [
                  "SyncCompleted"
                ]
              },
              "messages_synced": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account_id",
              "error",
              "event"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "error": {
                "type": "string"
              },
              "event": {
                "type": "string",
                "enum": [
                  "SyncError"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "envelopes",
              "event"
            ],
            "properties": {
              "envelopes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Envelope"
                }
              },
              "event": {
                "type": "string",
                "enum": [
                  "NewMessages"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "event"
            ],
            "properties": {
              "event": {
                "type": "string",
                "enum": [
                  "MessageUnsnoozed"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "description": "A pending auto-reminder fired because its window elapsed without\na reply being detected. Carries the original outbound message\nthe user wanted to be nudged about.",
            "required": [
              "sent_message_id",
              "event"
            ],
            "properties": {
              "event": {
                "type": "string",
                "enum": [
                  "ReminderTriggered"
                ]
              },
              "sent_message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "counts",
              "event"
            ],
            "properties": {
              "counts": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/LabelCount"
                }
              },
              "event": {
                "type": "string",
                "enum": [
                  "LabelCountsUpdated"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "operation_id",
              "operation",
              "message",
              "event"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "event": {
                "type": "string",
                "enum": [
                  "OperationStarted"
                ]
              },
              "message": {
                "type": "string"
              },
              "operation": {
                "type": "string"
              },
              "operation_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "operation_id",
              "operation",
              "current",
              "message",
              "event"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "current": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "event": {
                "type": "string",
                "enum": [
                  "OperationProgress"
                ]
              },
              "message": {
                "type": "string"
              },
              "operation": {
                "type": "string"
              },
              "operation_id": {
                "type": "string"
              },
              "total": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "operation_id",
              "operation",
              "message",
              "event"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "event": {
                "type": "string",
                "enum": [
                  "OperationCompleted"
                ]
              },
              "message": {
                "type": "string"
              },
              "operation": {
                "type": "string"
              },
              "operation_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "operation_id",
              "operation",
              "error",
              "retryable",
              "event"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "error": {
                "type": "string"
              },
              "event": {
                "type": "string",
                "enum": [
                  "OperationFailed"
                ]
              },
              "operation": {
                "type": "string"
              },
              "operation_id": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "operation_id",
              "operation",
              "message",
              "event"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "event": {
                "type": "string",
                "enum": [
                  "OperationCancelled"
                ]
              },
              "message": {
                "type": "string"
              },
              "operation": {
                "type": "string"
              },
              "operation_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Optimistic UI rollback hint: provider/store rejected some or all of a\ntracked mutation (see `Request::Mutation.client_correlation_id`).",
            "required": [
              "client_correlation_id",
              "error_summary",
              "event"
            ],
            "properties": {
              "client_correlation_id": {
                "type": "string"
              },
              "error_summary": {
                "type": "string"
              },
              "event": {
                "type": "string",
                "enum": [
                  "MutationReconciliationFailed"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "This client's event stream lagged and the daemon dropped\n`skipped` broadcast events before it could deliver them (the\nper-client channel filled during a burst, e.g. a large bulk\nmutation or initial backfill). The client's cached views may now\nbe stale, so it should do a full resync. Sent point-to-point to\nthe affected client only — never broadcast.",
            "required": [
              "skipped",
              "event"
            ],
            "properties": {
              "event": {
                "type": "string",
                "enum": [
                  "EventsLagged"
                ]
              },
              "skipped": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              }
            }
          }
        ]
      },
      "DaemonHealthClass": {
        "type": "string",
        "enum": [
          "healthy",
          "degraded",
          "restart_required",
          "repair_required"
        ]
      },
      "DecisionLogEntryData": {
        "type": "object",
        "required": [
          "id",
          "account_id",
          "thread_id",
          "decision",
          "evidence_msg_ids",
          "extracted_at"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "decided_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "decision": {
            "type": "string"
          },
          "evidence_msg_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageId"
            }
          },
          "extracted_at": {
            "type": "string",
            "format": "date-time"
          },
          "id": {
            "type": "string"
          },
          "rationale": {
            "type": [
              "string",
              "null"
            ]
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          },
          "topic": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "DeliveryData": {
        "type": "object",
        "description": "A tracked delivery for the Deliveries surface (CLI/web/TUI).",
        "required": [
          "id",
          "account_id",
          "status",
          "confidence",
          "source",
          "last_event_at",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "carrier": {
            "type": [
              "string",
              "null"
            ]
          },
          "confidence": {
            "type": "number",
            "format": "double"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "delivered_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "dismissed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "eta_from": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "eta_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "id": {
            "$ref": "#/components/schemas/DeliveryId"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeliveryItemData"
            }
          },
          "last_event_at": {
            "type": "string",
            "format": "date-time"
          },
          "merchant": {
            "type": [
              "string",
              "null"
            ]
          },
          "message_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageId"
            },
            "description": "Source message ids (provenance). Populated by GetDelivery."
          },
          "order_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolved_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "source": {
            "type": "string",
            "description": "Detection source: \"schema\" | \"llm\" | \"heuristic\"."
          },
          "status": {
            "type": "string",
            "description": "Normalized lifecycle status, e.g. \"in_transit\", \"delivered\"."
          },
          "thread_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ThreadId",
                "description": "Latest contributing thread, for \"open in mailbox\"."
              }
            ]
          },
          "tracking_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "tracking_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DeliveryId": {
        "type": "string",
        "format": "uuid"
      },
      "DeliveryItemData": {
        "type": "object",
        "description": "One ordered/shipped item within a delivery.",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "quantity": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        }
      },
      "DeliveryScanSummary": {
        "type": "object",
        "description": "Result of a `ScanDeliveries` run.",
        "required": [
          "scanned",
          "created",
          "updated",
          "shortlisted",
          "dry_run"
        ],
        "properties": {
          "created": {
            "type": "integer",
            "format": "int32",
            "description": "Candidates the heuristic created (or would create on a dry run).",
            "minimum": 0
          },
          "dry_run": {
            "type": "boolean",
            "description": "Whether this was a preview (no writes)."
          },
          "scanned": {
            "type": "integer",
            "format": "int32",
            "description": "Messages examined in the window.",
            "minimum": 0
          },
          "shortlisted": {
            "type": "integer",
            "format": "int32",
            "description": "Candidates handed to the LLM for confirmation.",
            "minimum": 0
          },
          "updated": {
            "type": "integer",
            "format": "int32",
            "description": "Candidates merged into an existing delivery.",
            "minimum": 0
          }
        }
      },
      "DoctorDataStats": {
        "type": "object",
        "required": [
          "accounts",
          "labels",
          "messages",
          "unread_messages",
          "starred_messages",
          "messages_with_attachments",
          "message_labels",
          "bodies",
          "attachments",
          "drafts",
          "snoozed",
          "saved_searches",
          "rules",
          "rule_logs",
          "sync_log",
          "sync_runtime_statuses",
          "event_log",
          "semantic_profiles",
          "semantic_chunks",
          "semantic_embeddings"
        ],
        "properties": {
          "accounts": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "attachments": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "bodies": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "drafts": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "event_log": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "labels": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "message_labels": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "messages": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "messages_missing_semantic_chunks": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "messages_with_attachments": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "relationship_drifts": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "rule_logs": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "rules": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "saved_searches": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "semantic_chunks": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "semantic_chunks_missing_embeddings": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "semantic_embeddings": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "semantic_profiles": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "snoozed": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "starred_messages": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "sync_log": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "sync_runtime_statuses": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "unread_messages": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "DoctorFinding": {
        "type": "object",
        "description": "One actionable issue identified by `mxr doctor`. Combines a short\nhuman-readable message with optional shell commands the user can\nrun to remediate.",
        "required": [
          "category",
          "severity",
          "message"
        ],
        "properties": {
          "category": {
            "$ref": "#/components/schemas/DoctorFindingCategory"
          },
          "message": {
            "type": "string"
          },
          "remediation": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Shell-runnable suggestions the user can copy-paste. Empty when\nno automated remediation is available."
          },
          "severity": {
            "$ref": "#/components/schemas/DoctorFindingSeverity"
          }
        }
      },
      "DoctorFindingCategory": {
        "type": "string",
        "description": "Coarse category of a doctor finding. Lets clients group related\nissues without parsing free text.",
        "enum": [
          "generic",
          "sync",
          "o_auth",
          "network",
          "search_index",
          "semantic",
          "sqlite_lock",
          "storage",
          "daemon"
        ]
      },
      "DoctorFindingSeverity": {
        "type": "string",
        "description": "Severity of a doctor finding. Drives whether the CLI exits non-zero\n(`Error`) and how the TUI styles the entry.",
        "enum": [
          "info",
          "warning",
          "error"
        ]
      },
      "DoctorReport": {
        "type": "object",
        "required": [
          "healthy",
          "data_dir_exists",
          "database_exists",
          "index_exists",
          "socket_exists",
          "socket_reachable",
          "stale_socket",
          "daemon_running",
          "index_lock_held",
          "database_path",
          "database_size_bytes",
          "index_path",
          "index_size_bytes",
          "log_path",
          "log_size_bytes",
          "sync_statuses",
          "recent_sync_events",
          "recent_error_logs",
          "recommended_next_steps"
        ],
        "properties": {
          "daemon_build_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "daemon_pid": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "daemon_protocol_version": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "daemon_running": {
            "type": "boolean"
          },
          "daemon_version": {
            "type": [
              "string",
              "null"
            ]
          },
          "data_dir_exists": {
            "type": "boolean"
          },
          "data_stats": {
            "$ref": "#/components/schemas/DoctorDataStats"
          },
          "database_exists": {
            "type": "boolean"
          },
          "database_path": {
            "type": "string"
          },
          "database_size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "feature_health": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/FeatureHealthReport"
              }
            ]
          },
          "findings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DoctorFinding"
            },
            "description": "Structured findings: per-issue category, severity, and\nshell-runnable remediation steps. Replaces the freeform\n`recommended_next_steps` for clients that want to reason about\nindividual problems (TUI, future agent integrations). The\nfreeform field is preserved for backwards-compatibility."
          },
          "health_class": {
            "$ref": "#/components/schemas/DaemonHealthClass"
          },
          "healthy": {
            "type": "boolean"
          },
          "index_exists": {
            "type": "boolean"
          },
          "index_lock_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "index_lock_held": {
            "type": "boolean"
          },
          "index_path": {
            "type": "string"
          },
          "index_size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "last_successful_sync_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "lexical_index_freshness": {
            "$ref": "#/components/schemas/IndexFreshness"
          },
          "lexical_last_rebuilt_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "log_path": {
            "type": "string"
          },
          "log_size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "recent_error_logs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "recent_sync_events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventLogEntry"
            }
          },
          "recommended_next_steps": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "repair_required": {
            "type": "boolean"
          },
          "restart_required": {
            "type": "boolean"
          },
          "semantic_active_profile": {
            "type": [
              "string",
              "null"
            ]
          },
          "semantic_enabled": {
            "type": "boolean"
          },
          "semantic_index_freshness": {
            "$ref": "#/components/schemas/IndexFreshness"
          },
          "semantic_last_indexed_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "socket_exists": {
            "type": "boolean"
          },
          "socket_reachable": {
            "type": "boolean"
          },
          "stale_socket": {
            "type": "boolean"
          },
          "sync_statuses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountSyncStatus"
            }
          }
        }
      },
      "Draft": {
        "type": "object",
        "required": [
          "id",
          "account_id",
          "to",
          "cc",
          "bcc",
          "subject",
          "body_markdown",
          "attachments",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "bcc": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          },
          "body_markdown": {
            "type": "string"
          },
          "cc": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "id": {
            "$ref": "#/components/schemas/DraftId"
          },
          "inline_calendar_reply": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/InlineCalendarReply",
                "description": "Set when this draft is the user-comment compose path for an iCal\ninvite REPLY. The outbound builder emits the special\n`multipart/alternative` (text/plain + text/calendar;method=REPLY)\nlayout when this is `Some`. The daemon's send-completion hook reads\n`source_message_id`+`partstat` to update the local store's PARTSTAT\nafter the email lands in Sent."
              }
            ]
          },
          "intent": {
            "$ref": "#/components/schemas/DraftIntent"
          },
          "reply_headers": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ReplyHeaders"
              }
            ]
          },
          "subject": {
            "type": "string"
          },
          "to": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DraftCommitmentCandidateData": {
        "type": "object",
        "required": [
          "id",
          "draft_id",
          "account_id",
          "email",
          "direction",
          "who_owes",
          "what",
          "extracted_at"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "by_when": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "direction": {
            "$ref": "#/components/schemas/CommitmentDirectionData"
          },
          "draft_id": {
            "$ref": "#/components/schemas/DraftId"
          },
          "email": {
            "type": "string"
          },
          "extracted_at": {
            "type": "string",
            "format": "date-time"
          },
          "id": {
            "type": "string"
          },
          "what": {
            "type": "string"
          },
          "who_owes": {
            "type": "string"
          }
        }
      },
      "DraftId": {
        "type": "string",
        "format": "uuid"
      },
      "DraftIntent": {
        "type": "string",
        "enum": [
          "new",
          "reply",
          "reply_all",
          "forward"
        ]
      },
      "DraftLengthHintData": {
        "type": "string",
        "enum": [
          "short",
          "medium",
          "long"
        ]
      },
      "DraftRefineKnobsData": {
        "type": "object",
        "properties": {
          "add_context": {
            "type": [
              "string",
              "null"
            ]
          },
          "less_emoji": {
            "type": "boolean"
          },
          "more_formal": {
            "type": "boolean"
          },
          "shorter": {
            "type": "boolean"
          },
          "warmer": {
            "type": "boolean"
          }
        }
      },
      "DraftSafetyContextData": {
        "type": "object",
        "properties": {
          "allow_llm": {
            "type": "boolean"
          },
          "mode": {
            "$ref": "#/components/schemas/DraftSafetyModeData"
          },
          "original_message_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/MessageId"
              }
            ]
          },
          "proposed_send_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When set, the safety pipeline runs the send-time check\nagainst the recipients and emits a `Severity::Info` issue\nif the proposed slot is materially slower than the fastest\nhistoric bucket. `None` = check skipped."
          },
          "reply_all": {
            "type": "boolean"
          },
          "thread_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ThreadId"
              }
            ]
          }
        }
      },
      "DraftSafetyIssue": {
        "type": "object",
        "required": [
          "code",
          "severity",
          "message"
        ],
        "properties": {
          "citations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CitationRef"
            }
          },
          "code": {
            "$ref": "#/components/schemas/DraftSafetyIssueCode"
          },
          "detail": {
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "type": "string"
          },
          "override_token": {
            "type": [
              "string",
              "null"
            ]
          },
          "severity": {
            "$ref": "#/components/schemas/DraftSafetySeverity"
          }
        }
      },
      "DraftSafetyIssueCode": {
        "type": "string",
        "enum": [
          "no_recipients",
          "invalid_recipient",
          "missing_reply_all_recipient",
          "wrong_recipient",
          "missing_attachment",
          "reply_all",
          "pii_secret",
          "tone_mismatch",
          "answer_coverage",
          "commitment_candidate",
          "send_time_note"
        ]
      },
      "DraftSafetyModeData": {
        "type": "string",
        "enum": [
          "check",
          "send",
          "scheduled_flush"
        ]
      },
      "DraftSafetyReport": {
        "type": "object",
        "required": [
          "allowed",
          "issues"
        ],
        "properties": {
          "allowed": {
            "type": "boolean"
          },
          "checked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DraftSafetyIssue"
            }
          },
          "verdict": {
            "$ref": "#/components/schemas/DraftSafetyVerdict"
          }
        }
      },
      "DraftSafetySeverity": {
        "type": "string",
        "enum": [
          "info",
          "warning",
          "blocker"
        ]
      },
      "DraftSafetyVerdict": {
        "type": "string",
        "enum": [
          "safe",
          "warn",
          "blocked"
        ]
      },
      "EntityCandidateData": {
        "type": "object",
        "required": [
          "kind",
          "value",
          "mention_count"
        ],
        "properties": {
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "type": "string"
          },
          "mention_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "value": {
            "type": "string"
          }
        }
      },
      "EntityExplanationData": {
        "type": "object",
        "required": [
          "canonical_name",
          "kind",
          "summary",
          "topics",
          "citations",
          "candidates"
        ],
        "properties": {
          "candidates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EntityCandidateData"
            }
          },
          "canonical_name": {
            "type": "string"
          },
          "citations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WhoisCitationData"
            }
          },
          "first_seen_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "kind": {
            "type": "string"
          },
          "last_seen_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "summary": {
            "type": "string"
          },
          "topics": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Envelope": {
        "type": "object",
        "required": [
          "id",
          "account_id",
          "provider_id",
          "thread_id",
          "references",
          "from",
          "to",
          "cc",
          "bcc",
          "subject",
          "date",
          "flags",
          "snippet",
          "has_attachments",
          "size_bytes",
          "unsubscribe"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "bcc": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          },
          "body_word_count": {
            "type": "integer",
            "format": "int32",
            "description": "Word count of the rendered body, snapshot at sync time. Used together\nwith `link_count` to classify newsletter-shaped mail into\n`LinkDensity::Heavy`. `0` if the body word count wasn't computed\n(older rows pre-backfill).",
            "minimum": 0
          },
          "cc": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "flags": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "from": {
            "$ref": "#/components/schemas/Address"
          },
          "has_attachments": {
            "type": "boolean"
          },
          "id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "in_reply_to": {
            "type": [
              "string",
              "null"
            ]
          },
          "keywords": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Custom IMAP-style keywords (`$Forwarded`, `$NotJunk`, user-defined\n`$Work`, etc.). System flags continue to live in `flags`. Stored\ncase-preserved as received; equality is case-sensitive to match\nIMAP atom semantics.",
            "uniqueItems": true
          },
          "label_provider_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Provider-specific label IDs (e.g. \"INBOX\", \"SENT\", \"Label_123\").\nTransient: used during sync to populate the message_labels junction table."
          },
          "link_count": {
            "type": "integer",
            "format": "int32",
            "description": "Count of external links in the body after filtering out tracker /\nunsubscribe / list-management hostnames. Drives the tri-state\n\"link\" indicator on the mail list and the `has:link` search filter.\n`0` means no link indicator.",
            "minimum": 0
          },
          "message_id_header": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_id": {
            "type": "string",
            "description": "Provider-instance identity used for sync and mutations.\n\nStable for Gmail message IDs.\nFor IMAP, this is mailbox-scoped today and may change across moves/copies."
          },
          "references": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "snippet": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          },
          "to": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          },
          "unsubscribe": {
            "$ref": "#/components/schemas/UnsubscribeMethod"
          }
        }
      },
      "EventLogEntry": {
        "type": "object",
        "required": [
          "timestamp",
          "level",
          "category",
          "summary"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AccountId"
              }
            ]
          },
          "category": {
            "type": "string"
          },
          "details": {
            "type": [
              "string",
              "null"
            ]
          },
          "level": {
            "type": "string"
          },
          "message_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "rule_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "summary": {
            "type": "string"
          },
          "timestamp": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "ExpertSuggestionData": {
        "type": "object",
        "required": [
          "email",
          "reason",
          "answered_thread_count",
          "evidence_msg_ids"
        ],
        "properties": {
          "answered_thread_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": "string"
          },
          "evidence_msg_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "ExportFormat": {
        "type": "string",
        "enum": [
          "Markdown",
          "Json",
          "Mbox",
          "LlmContext"
        ]
      },
      "FeatureHealth": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "status"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "healthy"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "reason",
              "status"
            ],
            "properties": {
              "reason": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "degraded"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "status"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "disabled"
                ]
              }
            }
          }
        ]
      },
      "FeatureHealthReport": {
        "type": "object",
        "required": [
          "semantic",
          "summarize",
          "relationship_profile",
          "commitments",
          "draft_assist",
          "voice_match",
          "humanizer"
        ],
        "properties": {
          "commitments": {
            "$ref": "#/components/schemas/FeatureHealth"
          },
          "draft_assist": {
            "$ref": "#/components/schemas/FeatureHealth"
          },
          "humanizer": {
            "$ref": "#/components/schemas/FeatureHealth"
          },
          "relationship_profile": {
            "$ref": "#/components/schemas/FeatureHealth"
          },
          "semantic": {
            "$ref": "#/components/schemas/FeatureHealth"
          },
          "summarize": {
            "$ref": "#/components/schemas/FeatureHealth"
          },
          "voice_match": {
            "$ref": "#/components/schemas/FeatureHealth"
          }
        }
      },
      "ForwardContext": {
        "type": "object",
        "description": "Forward context returned by PrepareForward.",
        "required": [
          "account_id",
          "subject",
          "from",
          "forwarded_content"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "forwarded_content": {
            "type": "string"
          },
          "from": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          }
        }
      },
      "GmailCredentialSourceData": {
        "type": "string",
        "enum": [
          "bundled",
          "custom"
        ]
      },
      "HtmlImageAsset": {
        "type": "object",
        "required": [
          "source",
          "kind",
          "status"
        ],
        "properties": {
          "detail": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "$ref": "#/components/schemas/HtmlImageSourceKind"
          },
          "mime_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "path": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/HtmlImageAssetStatus"
          }
        }
      },
      "HtmlImageAssetStatus": {
        "type": "string",
        "enum": [
          "ready",
          "blocked",
          "missing",
          "unsupported",
          "failed"
        ]
      },
      "HtmlImageSourceKind": {
        "type": "string",
        "enum": [
          "cid",
          "data_uri",
          "remote",
          "content_location",
          "file"
        ]
      },
      "HumanizerHitData": {
        "type": "object",
        "required": [
          "category",
          "matched"
        ],
        "properties": {
          "category": {
            "type": "string"
          },
          "matched": {
            "type": "string"
          },
          "suggestion": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "HumanizerReportSummaryData": {
        "type": "object",
        "required": [
          "score",
          "hits"
        ],
        "properties": {
          "hits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HumanizerHitData"
            }
          },
          "score": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "IndexFreshness": {
        "type": "string",
        "enum": [
          "unknown",
          "current",
          "stale",
          "disabled",
          "indexing",
          "error",
          "repair_required"
        ]
      },
      "InlineCalendarReply": {
        "type": "object",
        "required": [
          "source_message_id",
          "attendee_email",
          "partstat",
          "ics_body"
        ],
        "properties": {
          "attendee_email": {
            "type": "string"
          },
          "ics_body": {
            "type": "string"
          },
          "partstat": {
            "$ref": "#/components/schemas/CalendarPartstat"
          },
          "source_message_id": {
            "$ref": "#/components/schemas/MessageId"
          }
        }
      },
      "IpcErrorKind": {
        "type": "string",
        "enum": [
          "invalid_request",
          "not_found",
          "auth",
          "policy",
          "provider",
          "rate_limited",
          "store",
          "unsupported",
          "internal"
        ]
      },
      "JobData": {
        "type": "object",
        "required": [
          "job_id",
          "kind",
          "status",
          "progress",
          "started_at"
        ],
        "properties": {
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "finished_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "job_id": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "progress": {
            "$ref": "#/components/schemas/JobProgressData"
          },
          "result": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/MutationResultData"
              }
            ]
          },
          "started_at": {
            "type": "integer",
            "format": "int64"
          },
          "status": {
            "$ref": "#/components/schemas/JobStatusData"
          },
          "undo_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "JobProgressData": {
        "type": "object",
        "required": [
          "total",
          "completed",
          "succeeded",
          "skipped",
          "failed"
        ],
        "properties": {
          "completed": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "failed": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "skipped": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "succeeded": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "total": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "JobStatusData": {
        "type": "string",
        "enum": [
          "queued",
          "running",
          "succeeded",
          "failed"
        ]
      },
      "Label": {
        "type": "object",
        "required": [
          "id",
          "account_id",
          "name",
          "kind",
          "provider_id",
          "unread_count",
          "total_count"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "color": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "$ref": "#/components/schemas/LabelId"
          },
          "kind": {
            "$ref": "#/components/schemas/LabelKind"
          },
          "name": {
            "type": "string"
          },
          "provider_id": {
            "type": "string"
          },
          "role": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Role",
                "description": "Well-known semantic role this label/folder plays in the provider's\nmailbox model (Inbox, Sent, Drafts, …). Derived from IMAP SPECIAL-USE\nattributes (RFC 6154) or Gmail system labels at mapping time, and\nsurfaced to clients so they can render the right icon/affordance\nwithout re-parsing names. `None` for user-defined labels/folders.\nMatches MSP §2.3 Folder.role."
              }
            ]
          },
          "total_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "unread_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "LabelCount": {
        "type": "object",
        "required": [
          "label_id",
          "unread_count",
          "total_count"
        ],
        "properties": {
          "label_id": {
            "$ref": "#/components/schemas/LabelId"
          },
          "total_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "unread_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "LabelId": {
        "type": "string",
        "format": "uuid"
      },
      "LabelKind": {
        "type": "string",
        "enum": [
          "System",
          "Folder",
          "User"
        ]
      },
      "LargestMessageRow": {
        "type": "object",
        "description": "Single message ranked by its envelope `size_bytes`. Powers\n`mxr storage --by message`: lets users find and act on the single\nbiggest emails (the 250 MB attachment from a courier service, the\nmassive zip a colleague sent in 2017) instead of just the bucket totals.",
        "required": [
          "message_id",
          "from_email",
          "subject",
          "size_bytes",
          "date"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "from_email": {
            "type": "string"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "subject": {
            "type": "string"
          }
        }
      },
      "LlmConfigData": {
        "type": "object",
        "required": [
          "enabled",
          "base_url",
          "model",
          "api_key_env",
          "context_window",
          "request_timeout_secs"
        ],
        "properties": {
          "allow_cloud_relationship_data": {
            "type": "boolean"
          },
          "api_key_env": {
            "type": "string"
          },
          "base_url": {
            "type": "string"
          },
          "context_window": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "enabled": {
            "type": "boolean"
          },
          "model": {
            "type": "string"
          },
          "overrides": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LlmOverridesData"
              }
            ]
          },
          "request_timeout_secs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "LlmOverrideData": {
        "type": "object",
        "properties": {
          "api_key_env": {
            "type": [
              "string",
              "null"
            ],
            "default": null
          },
          "base_url": {
            "type": [
              "string",
              "null"
            ],
            "default": null
          },
          "context_window": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "default": null,
            "minimum": 0
          },
          "enabled": {
            "type": [
              "boolean",
              "null"
            ],
            "default": null
          },
          "model": {
            "type": [
              "string",
              "null"
            ],
            "default": null
          },
          "request_timeout_secs": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "default": null,
            "minimum": 0
          }
        }
      },
      "LlmOverridesData": {
        "type": "object",
        "properties": {
          "answer_coverage": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              }
            ],
            "default": null
          },
          "archive_ask": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              }
            ],
            "default": null
          },
          "briefing": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              }
            ],
            "default": null
          },
          "commitments": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              }
            ],
            "default": null
          },
          "decision_log": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              }
            ],
            "default": null
          },
          "delivery_extraction": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              }
            ],
            "default": null
          },
          "draft_assist": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              }
            ],
            "default": null
          },
          "draft_new": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              }
            ],
            "default": null
          },
          "draft_refine": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              }
            ],
            "default": null
          },
          "expert": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              }
            ],
            "default": null
          },
          "humanize_rewrite": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              }
            ],
            "default": null
          },
          "relationship_summary": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              }
            ],
            "default": null
          },
          "summarize": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              }
            ],
            "default": null
          },
          "voice_match": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              }
            ],
            "default": null
          }
        }
      },
      "LlmStatusSnapshot": {
        "type": "object",
        "required": [
          "enabled",
          "provider",
          "model",
          "configured_model",
          "api_key_present",
          "context_window",
          "supports_streaming",
          "request_timeout_secs"
        ],
        "properties": {
          "api_key_env": {
            "type": [
              "string",
              "null"
            ]
          },
          "api_key_present": {
            "type": "boolean"
          },
          "base_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "configured_model": {
            "type": "string"
          },
          "context_window": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "enabled": {
            "type": "boolean"
          },
          "model": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "request_timeout_secs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "supports_streaming": {
            "type": "boolean"
          }
        }
      },
      "MessageBody": {
        "type": "object",
        "required": [
          "message_id",
          "attachments",
          "fetched_at"
        ],
        "properties": {
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AttachmentMeta"
            }
          },
          "fetched_at": {
            "type": "string",
            "format": "date-time"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "metadata": {
            "$ref": "#/components/schemas/MessageMetadata"
          },
          "text_html": {
            "type": [
              "string",
              "null"
            ]
          },
          "text_plain": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "MessageId": {
        "type": "string",
        "format": "uuid"
      },
      "MessageMetadata": {
        "type": "object",
        "properties": {
          "auth_results": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "calendar": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CalendarMetadata"
              }
            ]
          },
          "content_language": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "list_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "raw_headers": {
            "type": [
              "string",
              "null"
            ]
          },
          "reply_to": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Address"
            },
            "description": "Addresses from the `Reply-To:` header, if the sender set one.\nReplies target these instead of `From:` (mailing lists and\nno-reply senders rely on it). Empty when absent."
          },
          "text_html_source": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/BodyPartSource"
              }
            ]
          },
          "text_plain_format": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TextPlainFormat"
              }
            ]
          },
          "text_plain_source": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/BodyPartSource"
              }
            ]
          }
        }
      },
      "MutationCommand": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "message_ids",
              "mutation"
            ],
            "properties": {
              "message_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageId"
                }
              },
              "mutation": {
                "type": "string",
                "enum": [
                  "Archive"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_ids",
              "mutation"
            ],
            "properties": {
              "message_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageId"
                }
              },
              "mutation": {
                "type": "string",
                "enum": [
                  "ReadAndArchive"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_ids",
              "mutation"
            ],
            "properties": {
              "message_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageId"
                }
              },
              "mutation": {
                "type": "string",
                "enum": [
                  "Trash"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_ids",
              "mutation"
            ],
            "properties": {
              "message_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageId"
                }
              },
              "mutation": {
                "type": "string",
                "enum": [
                  "Spam"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_ids",
              "starred",
              "mutation"
            ],
            "properties": {
              "message_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageId"
                }
              },
              "mutation": {
                "type": "string",
                "enum": [
                  "Star"
                ]
              },
              "starred": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_ids",
              "read",
              "mutation"
            ],
            "properties": {
              "message_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageId"
                }
              },
              "mutation": {
                "type": "string",
                "enum": [
                  "SetRead"
                ]
              },
              "read": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_ids",
              "add",
              "remove",
              "mutation"
            ],
            "properties": {
              "add": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "message_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageId"
                }
              },
              "mutation": {
                "type": "string",
                "enum": [
                  "ModifyLabels"
                ]
              },
              "remove": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_ids",
              "target_label",
              "mutation"
            ],
            "properties": {
              "message_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageId"
                }
              },
              "mutation": {
                "type": "string",
                "enum": [
                  "Move"
                ]
              },
              "target_label": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_ids",
              "to_label",
              "from_queue_label",
              "mutation"
            ],
            "properties": {
              "archive": {
                "type": "boolean"
              },
              "dry_run": {
                "type": "boolean"
              },
              "from_queue_label": {
                "type": "string"
              },
              "message_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageId"
                }
              },
              "mutation": {
                "type": "string",
                "enum": [
                  "Route"
                ]
              },
              "to_label": {
                "type": "string"
              }
            }
          }
        ],
        "description": "Mutation commands for modifying messages."
      },
      "MutationResultData": {
        "type": "object",
        "required": [
          "requested",
          "succeeded",
          "skipped",
          "failed",
          "accounts"
        ],
        "properties": {
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountMutationResultData"
            }
          },
          "failed": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "mutation_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Set by undoable mutations (Archive / Trash / Spam / SetRead /\nReadAndArchive). Identifies a row in the daemon's\n`mutation_undo_log` that the client can reference via\n`Request::UndoMutation` for ~60s after the mutation lands.\n`None` for non-undoable mutations (Star, ModifyLabels, Move)."
          },
          "requested": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "skipped": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "succeeded": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "undo_unavailable": {
            "type": "boolean",
            "description": "True when an undoable mutation succeeded but persisting its undo\nentry failed, so `mutation_id` is `None` even though undo was\nexpected. Lets clients distinguish \"no undo by design\" from \"undo\nwas lost\" and warn the user instead of silently dropping it."
          }
        }
      },
      "NotificationChimeEventData": {
        "type": "string",
        "enum": [
          "new_mail",
          "sent",
          "archived",
          "trashed",
          "spam",
          "snoozed",
          "unsnoozed",
          "reminder",
          "error"
        ]
      },
      "NotificationChimeSoundData": {
        "type": "string",
        "enum": [
          "none",
          "bell",
          "glass",
          "pop",
          "sent",
          "archive",
          "thud",
          "alert"
        ]
      },
      "NotificationChimesData": {
        "type": "object",
        "required": [
          "enabled",
          "volume",
          "new_mail",
          "sent",
          "archived",
          "trashed",
          "spam",
          "snoozed",
          "unsnoozed",
          "reminder",
          "error"
        ],
        "properties": {
          "archived": {
            "$ref": "#/components/schemas/NotificationChimeSoundData"
          },
          "enabled": {
            "type": "boolean"
          },
          "error": {
            "$ref": "#/components/schemas/NotificationChimeSoundData"
          },
          "new_mail": {
            "$ref": "#/components/schemas/NotificationChimeSoundData"
          },
          "reminder": {
            "$ref": "#/components/schemas/NotificationChimeSoundData"
          },
          "sent": {
            "$ref": "#/components/schemas/NotificationChimeSoundData"
          },
          "snoozed": {
            "$ref": "#/components/schemas/NotificationChimeSoundData"
          },
          "spam": {
            "$ref": "#/components/schemas/NotificationChimeSoundData"
          },
          "trashed": {
            "$ref": "#/components/schemas/NotificationChimeSoundData"
          },
          "unsnoozed": {
            "$ref": "#/components/schemas/NotificationChimeSoundData"
          },
          "volume": {
            "type": "number",
            "format": "float"
          }
        }
      },
      "OwedReplyRowData": {
        "type": "object",
        "required": [
          "thread_id",
          "latest_inbound_msg_id",
          "from_email",
          "subject",
          "latest_inbound_at",
          "waiting_days",
          "expected_days",
          "overdue_score"
        ],
        "properties": {
          "expected_days": {
            "type": "number",
            "format": "double"
          },
          "from_email": {
            "type": "string"
          },
          "from_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "latest_inbound_at": {
            "type": "string",
            "format": "date-time"
          },
          "latest_inbound_msg_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "overdue_score": {
            "type": "number",
            "format": "double"
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          },
          "waiting_days": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "RecipientSendTimeRowData": {
        "type": "object",
        "required": [
          "email",
          "sample_count",
          "best_windows"
        ],
        "properties": {
          "best_expected_reply_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "best_windows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SendWindowData"
            }
          },
          "email": {
            "type": "string"
          },
          "proposed_expected_reply_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "sample_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "RelationshipDriftData": {
        "type": "object",
        "required": [
          "detected_at",
          "reason"
        ],
        "properties": {
          "detected_at": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "RelationshipProfileData": {
        "type": "object",
        "required": [
          "account_id",
          "email"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "drift": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/RelationshipDriftData"
              }
            ]
          },
          "email": {
            "type": "string"
          },
          "open_commitments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommitmentData"
            }
          },
          "style": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ContactStyleData"
              }
            ]
          },
          "summary": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ContactRelationshipSummaryData"
              }
            ]
          }
        }
      },
      "RelationshipWatchEntryData": {
        "type": "object",
        "required": [
          "account_id",
          "email",
          "added_at"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "added_at": {
            "type": "string",
            "format": "date-time"
          },
          "email": {
            "type": "string"
          },
          "expected_days": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ReplyContext": {
        "type": "object",
        "description": "Reply context returned by PrepareReply.",
        "required": [
          "account_id",
          "in_reply_to",
          "references",
          "reply_to",
          "cc",
          "subject",
          "from",
          "thread_context"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "cc": {
            "type": "string"
          },
          "from": {
            "type": "string"
          },
          "in_reply_to": {
            "type": "string"
          },
          "references": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reply_to": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "thread_context": {
            "type": "string"
          },
          "thread_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Provider-native thread hint (e.g. Gmail thread id). None for IMAP."
          }
        }
      },
      "ReplyHeaders": {
        "type": "object",
        "required": [
          "in_reply_to"
        ],
        "properties": {
          "in_reply_to": {
            "type": "string"
          },
          "references": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "thread_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Provider-native thread hint. Gmail uses this to keep replies in-thread;\nIMAP relies on the In-Reply-To/References headers and ignores it."
          }
        }
      },
      "Request": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "limit",
              "offset",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListEnvelopes"
                ]
              },
              "label_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/LabelId"
                  }
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "offset": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_ids",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListEnvelopesByIds"
                ]
              },
              "message_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageId"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetEnvelope"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetBody"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetInvite"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "limit",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListInvites"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "BackfillCalendarInvites"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "action",
              "dry_run",
              "cmd"
            ],
            "properties": {
              "action": {
                "$ref": "#/components/schemas/CalendarInviteActionData"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "RespondInvite"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "description": "Build (without sending) the iCal REPLY for an invite — used by the\n\"respond with comment\" compose path so the SPA / TUI receive the same\n`CalendarInviteResponsePreview` the auto-send path uses internally.",
            "required": [
              "message_id",
              "action",
              "cmd"
            ],
            "properties": {
              "action": {
                "$ref": "#/components/schemas/CalendarInviteActionData"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "PrepareInviteResponse"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "description": "Mark a previously-received invite as answered in the local store.\nCalled by the daemon's send-completion hook after a comment-compose\ndraft (`Draft.inline_calendar_reply.is_some()`) finishes sending, since\nthat path bypasses `RespondInvite`.",
            "required": [
              "message_id",
              "attendee_email",
              "partstat",
              "cmd"
            ],
            "properties": {
              "attendee_email": {
                "type": "string"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "MarkInviteAnswered"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              },
              "partstat": {
                "$ref": "#/components/schemas/CalendarPartstat"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "allow_remote",
              "cmd"
            ],
            "properties": {
              "allow_remote": {
                "type": "boolean"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetHtmlImageAssets"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "attachment_id",
              "cmd"
            ],
            "properties": {
              "attachment_id": {
                "$ref": "#/components/schemas/AttachmentId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "DownloadAttachment"
                ]
              },
              "destination": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Optional user-chosen destination path. When `None`, the daemon\nmaterializes into its internal attachment cache (used by the\nopen-in-app flow). When `Some`, the daemon writes the bytes\ndirectly to this exact path (parent dirs are created; caller\nowns the filename in the path)."
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "attachment_id",
              "cmd"
            ],
            "properties": {
              "attachment_id": {
                "$ref": "#/components/schemas/AttachmentId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "OpenAttachment"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_ids",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListBodies"
                ]
              },
              "message_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageId"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "thread_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetThread"
                ]
              },
              "thread_id": {
                "$ref": "#/components/schemas/ThreadId"
              }
            }
          },
          {
            "type": "object",
            "description": "Paginated list of threads in date-descending order (most-recent\nfirst), with optional account/label filters. Each returned\n`Thread` carries its full `message_ids` member list.",
            "required": [
              "limit",
              "offset",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListThreads"
                ]
              },
              "label_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/LabelId"
                  }
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "offset": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "sort": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/SortOrder"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListLabels"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "name",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "CreateLabel"
                ]
              },
              "color": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "name",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "DeleteLabel"
                ]
              },
              "name": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "old",
              "new",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "RenameLabel"
                ]
              },
              "new": {
                "type": "string"
              },
              "old": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListAccounts"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListAccountsConfig"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account",
              "reauthorize",
              "cmd"
            ],
            "properties": {
              "account": {
                "$ref": "#/components/schemas/AccountConfigData"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "AuthorizeAccountConfig"
                ]
              },
              "reauthorize": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account",
              "reauthorize",
              "cmd"
            ],
            "properties": {
              "account": {
                "$ref": "#/components/schemas/AccountConfigData"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "StartAuthSession"
                ]
              },
              "flow": {
                "$ref": "#/components/schemas/AuthFlowData"
              },
              "reauthorize": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "session_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetAuthSession"
                ]
              },
              "session_id": {
                "$ref": "#/components/schemas/AuthSessionId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "session_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "CancelAuthSession"
                ]
              },
              "session_id": {
                "$ref": "#/components/schemas/AuthSessionId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "session_id",
              "save_account",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "CompleteAuthSession"
                ]
              },
              "save_account": {
                "type": "boolean"
              },
              "session_id": {
                "$ref": "#/components/schemas/AuthSessionId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account",
              "cmd"
            ],
            "properties": {
              "account": {
                "$ref": "#/components/schemas/AccountConfigData"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "UpsertAccountConfig"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "key",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SetDefaultAccount"
                ]
              },
              "key": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account",
              "cmd"
            ],
            "properties": {
              "account": {
                "$ref": "#/components/schemas/AccountConfigData"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "TestAccountConfig"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "key",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "DisableAccountConfig"
                ]
              },
              "key": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "key",
              "purge_local_data",
              "dry_run",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "RemoveAccountConfig"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "key": {
                "type": "string"
              },
              "purge_local_data": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account",
              "cmd"
            ],
            "properties": {
              "account": {
                "$ref": "#/components/schemas/AccountConfigData"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "RepairAccountConfig"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListRules"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "rule",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetRule"
                ]
              },
              "rule": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "rule",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetRuleForm"
                ]
              },
              "rule": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "rule",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "UpsertRule"
                ]
              },
              "rule": {}
            }
          },
          {
            "type": "object",
            "required": [
              "name",
              "condition",
              "action",
              "priority",
              "enabled",
              "cmd"
            ],
            "properties": {
              "action": {
                "type": "string"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "UpsertRuleForm"
                ]
              },
              "condition": {
                "type": "string"
              },
              "enabled": {
                "type": "boolean"
              },
              "existing_rule": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "priority": {
                "type": "integer",
                "format": "int32"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "rule",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "DeleteRule"
                ]
              },
              "rule": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "all",
              "cmd"
            ],
            "properties": {
              "after": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "all": {
                "type": "boolean"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "DryRunRules"
                ]
              },
              "rule": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListSavedSearches"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Return unread match counts per saved search. The TUI uses\nthis to render `(N)` after each tab label. The handler runs\neach saved search's query ANDed with `is:unread` and counts\nhits; queries that can't be parsed return 0 so the tab strip\nstays visible.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListSavedSearchUnreadCounts"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "limit",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListSubscriptions"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "group_by",
              "limit",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListStorageBreakdown"
                ]
              },
              "group_by": {
                "$ref": "#/components/schemas/StorageGroupBy"
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "limit",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListLargestMessages"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "since_days": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "since_unix",
              "until_unix",
              "label",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "Wrapped"
                ]
              },
              "label": {
                "type": "string"
              },
              "since_unix": {
                "type": "integer",
                "format": "int64"
              },
              "until_unix": {
                "type": "integer",
                "format": "int64"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "perspective",
              "older_than_days",
              "within_days",
              "limit",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListStaleThreads"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "older_than_days": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "perspective": {
                "$ref": "#/components/schemas/StaleBallInCourt"
              },
              "within_days": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "min_inbound",
              "limit",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListContactAsymmetry"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "min_inbound": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "threshold_days",
              "max_lookback_days",
              "limit",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListContactDecay"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "max_lookback_days": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "threshold_days": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "RefreshContacts"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "RebuildAnalytics"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Walk every message body and recompute `link_count` + `body_word_count`\nusing the current link-extractor. Drives `mxr doctor --recompute-link-counts`\nfor users who want the link indicator/search filters to populate on\npre-existing rows without waiting for the next sync.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "RecomputeLinkCounts"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "direction",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListResponseTime"
                ]
              },
              "counterparty": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "direction": {
                "$ref": "#/components/schemas/ResponseTimeDirection"
              },
              "since_days": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListAccountAddresses"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account_id",
              "email",
              "primary",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "AddAccountAddress"
                ]
              },
              "email": {
                "type": "string"
              },
              "primary": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account_id",
              "email",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "RemoveAccountAddress"
                ]
              },
              "email": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account_id",
              "email",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SetPrimaryAccountAddress"
                ]
              },
              "email": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetLlmStatus"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetLlmConfig"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "config",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "UpdateLlmConfig"
                ]
              },
              "config": {
                "$ref": "#/components/schemas/LlmConfigData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetNotificationChimes"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "config",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "UpdateNotificationChimes"
                ]
              },
              "config": {
                "$ref": "#/components/schemas/NotificationChimesData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "event",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "PreviewNotificationChime"
                ]
              },
              "event": {
                "$ref": "#/components/schemas/NotificationChimeEventData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetSemanticStatus"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "enabled",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "EnableSemantic"
                ]
              },
              "enabled": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "profile",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "InstallSemanticProfile"
                ]
              },
              "profile": {
                "$ref": "#/components/schemas/SemanticProfile"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "profile",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "UseSemanticProfile"
                ]
              },
              "profile": {
                "$ref": "#/components/schemas/SemanticProfile"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ReindexSemantic"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "BackfillSemantic"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "name",
              "query",
              "search_mode",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "CreateSavedSearch"
                ]
              },
              "name": {
                "type": "string"
              },
              "query": {
                "type": "string"
              },
              "search_mode": {
                "$ref": "#/components/schemas/SearchMode"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "name",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "DeleteSavedSearch"
                ]
              },
              "name": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Patch a saved search by its current name. Any `None` field is left\nuntouched. `icon` is overloaded to also carry a hex color (the web app\nuses it for the pinned-row color tag).",
            "required": [
              "name",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "UpdateSavedSearch"
                ]
              },
              "icon": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "new_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "position": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32"
              },
              "query": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "search_mode": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/SearchMode"
                  }
                ]
              },
              "sort": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/SortOrder"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "name",
              "limit",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "RunSavedSearch"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "name": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "limit",
              "cmd"
            ],
            "properties": {
              "category": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "category_prefix": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Category prefix (e.g. `mutation`, `sync.`). Applied as\n`category LIKE <prefix>%`. Optional."
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListEvents"
                ]
              },
              "level": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "offset": {
                "type": "integer",
                "format": "int32",
                "description": "Result offset for paging. Defaults to 0.",
                "minimum": 0
              },
              "search": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Free-text `LIKE %term%` over the `summary` column. Optional."
              },
              "since": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64",
                "description": "Unix-seconds inclusive lower bound on `timestamp`. Optional."
              },
              "until": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64",
                "description": "Unix-seconds exclusive upper bound on `timestamp`. Optional."
              }
            }
          },
          {
            "type": "object",
            "required": [
              "limit",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetLogs"
                ]
              },
              "level": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "search": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Free-text substring filter against each log line. Case-insensitive."
              }
            }
          },
          {
            "type": "object",
            "description": "Distinct categories present in `event_log`, ordered by recency.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListEventCategories"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Count events matching the same filter shape as `ListEvents`.\nPowers pagination affordances in the diagnostics surfaces.",
            "required": [
              "cmd"
            ],
            "properties": {
              "category": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "category_prefix": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "CountEvents"
                ]
              },
              "level": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "search": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "since": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64"
              },
              "until": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetDoctorReport"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "verbose",
              "full_logs",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GenerateBugReport"
                ]
              },
              "full_logs": {
                "type": "boolean"
              },
              "since": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "verbose": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "query",
              "limit",
              "explain",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "Search"
                ]
              },
              "explain": {
                "type": "boolean"
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "mode": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/SearchMode"
                  }
                ]
              },
              "offset": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "query": {
                "type": "string"
              },
              "sort": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/SortOrder"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SyncNow"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetSyncStatus"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "flags",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SetFlags"
                ]
              },
              "flags": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "query",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "Count"
                ]
              },
              "mode": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/SearchMode"
                  }
                ]
              },
              "query": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "query",
              "group_by",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SearchAggregation"
                ]
              },
              "group_by": {
                "$ref": "#/components/schemas/SearchAggregationGroupBy"
              },
              "limit": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "minimum": 0
              },
              "mode": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/SearchMode"
                  }
                ]
              },
              "query": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetHeaders"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "limit",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListRuleHistory"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "rule": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "allOf": [
              {
                "$ref": "#/components/schemas/MutationCommand"
              },
              {
                "type": "object",
                "properties": {
                  "client_correlation_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "cmd"
                ],
                "properties": {
                  "cmd": {
                    "type": "string",
                    "enum": [
                      "Mutation"
                    ]
                  }
                }
              }
            ]
          },
          {
            "allOf": [
              {
                "$ref": "#/components/schemas/MutationCommand"
              },
              {
                "type": "object",
                "properties": {
                  "client_correlation_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              {
                "type": "object",
                "description": "Start a mutation as a daemon-side background job. Clients poll\n`ListJobs` / `GetJob` for progress and undo ids instead of holding\na long-lived IPC request open.",
                "required": [
                  "cmd"
                ],
                "properties": {
                  "cmd": {
                    "type": "string",
                    "enum": [
                      "StartMutationJob"
                    ]
                  }
                }
              }
            ],
            "description": "Start a mutation as a daemon-side background job. Clients poll\n`ListJobs` / `GetJob` for progress and undo ids instead of holding\na long-lived IPC request open."
          },
          {
            "type": "object",
            "description": "List recent daemon-side jobs (mutation batches, future long-running\nmail operations) with progress and failure/undo state.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListJobs"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Inspect one daemon-side job by id.",
            "required": [
              "job_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetJob"
                ]
              },
              "job_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Reverse a recent undoable mutation by id. Available within ~60s of\nthe mutation landing; daemon refuses with an `Error` response\npast that window.",
            "required": [
              "mutation_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "UndoMutation"
                ]
              },
              "mutation_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "Unsubscribe"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "address",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "address": {
                "type": "string"
              },
              "archive_on_no_method": {
                "type": "boolean",
                "description": "If false, a sender with no usable List-Unsubscribe method previews\nthe footprint but does not archive it. If true, the daemon still\nread-archives the sender footprint and reports that unsubscribe was skipped."
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "UnsubscribePurge"
                ]
              },
              "dry_run": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "wake_at",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "Snooze"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              },
              "wake_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "Unsnooze"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListSnoozed"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Toggle the reply-later flag on a message. Local-only metadata —\nnever roundtrips to the provider. Setting a flag that is already\nset refreshes the timestamp, surfacing the message to the top of\nthe queue.",
            "required": [
              "message_id",
              "flag",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SetReplyLater"
                ]
              },
              "flag": {
                "type": "boolean"
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "description": "List messages currently flagged for reply-later, ordered by most\nrecently flagged first.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListReplyQueue"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Schedule a reminder for an outbound message: \"remind me if no\nreply by `remind_at`.\" Re-sending overwrites any prior reminder\non the same message.",
            "required": [
              "sent_message_id",
              "remind_at",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SetAutoReminder"
                ]
              },
              "remind_at": {
                "type": "string",
                "format": "date-time"
              },
              "sent_message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "description": "Cancel a pending reminder.",
            "required": [
              "sent_message_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "CancelAutoReminder"
                ]
              },
              "sent_message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "description": "Schedule an existing draft to be sent at `send_at`. The flusher\nloop scans due rows on a 60-second cadence and runs them through\nthe same `send_stored_draft` pipeline that interactive sends use.",
            "required": [
              "draft_id",
              "send_at",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ScheduleSend"
                ]
              },
              "draft_id": {
                "$ref": "#/components/schemas/DraftId"
              },
              "send_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          {
            "type": "object",
            "description": "Cancel a pending scheduled send (the draft itself is preserved).",
            "required": [
              "draft_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "CancelScheduledSend"
                ]
              },
              "draft_id": {
                "$ref": "#/components/schemas/DraftId"
              }
            }
          },
          {
            "type": "object",
            "description": "List all snippets, alphabetically by name.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListSnippets"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Create or update a snippet by name.",
            "required": [
              "name",
              "body",
              "vars",
              "cmd"
            ],
            "properties": {
              "body": {
                "type": "string"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SetSnippet"
                ]
              },
              "name": {
                "type": "string"
              },
              "vars": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Delete a snippet by name. No-op if absent.",
            "required": [
              "name",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "DeleteSnippet"
                ]
              },
              "name": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "List tracked deliveries. `filter` is one of \"active\" (default),\n\"delivered\", \"all\", \"dismissed\".",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListDeliveries"
                ]
              },
              "filter": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Fetch a single delivery, including its source message ids.",
            "required": [
              "delivery_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetDelivery"
                ]
              },
              "delivery_id": {
                "$ref": "#/components/schemas/DeliveryId"
              }
            }
          },
          {
            "type": "object",
            "description": "Resolve a delivery (mark delivered/done so it leaves the active list).",
            "required": [
              "delivery_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ResolveDelivery"
                ]
              },
              "delivery_id": {
                "$ref": "#/components/schemas/DeliveryId"
              }
            }
          },
          {
            "type": "object",
            "description": "Dismiss a delivery (hide a false positive).",
            "required": [
              "delivery_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "DismissDelivery"
                ]
              },
              "delivery_id": {
                "$ref": "#/components/schemas/DeliveryId"
              }
            }
          },
          {
            "type": "object",
            "description": "Re-scan recent mail for deliveries. `dry_run` reports what would be\ncreated/updated without writing. `since_days` bounds the window.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ScanDeliveries"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "since_days": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "List outgoing compose signatures, alphabetically by name.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListSignatures"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "List scoped signature defaults.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListSignatureDefaults"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Create or update a signature by name.",
            "required": [
              "name",
              "body",
              "cmd"
            ],
            "properties": {
              "body": {
                "type": "string"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SetSignature"
                ]
              },
              "name": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Delete a signature by name. Also clears defaults pointing at it.",
            "required": [
              "name",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "DeleteSignature"
                ]
              },
              "name": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Set the default signature for a global/account/from-address scope.",
            "required": [
              "name",
              "kind",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SetSignatureDefault"
                ]
              },
              "from_email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "kind": {
                "$ref": "#/components/schemas/SignatureContextData"
              },
              "name": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Clear the default signature for a global/account/from-address scope.",
            "required": [
              "kind",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ClearSignatureDefault"
                ]
              },
              "from_email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "kind": {
                "$ref": "#/components/schemas/SignatureContextData"
              }
            }
          },
          {
            "type": "object",
            "description": "Resolve the signature to insert into a compose draft.",
            "required": [
              "kind",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ResolveSignature"
                ]
              },
              "from_email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "kind": {
                "$ref": "#/components/schemas/SignatureContextData"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Per-sender relationship aggregates: volume, response cadence,\nopen threads. Returns `None` (via `Ok`/`SenderProfileData` with\n`present=false`) if the contact is unknown.",
            "required": [
              "account_id",
              "email",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetSenderProfile"
                ]
              },
              "email": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListSenders"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "since_unix": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64",
                "description": "Restrict counts to messages whose `date >= since_unix`.\n`None` means \"no time bound\" (legacy behavior)."
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account_id",
              "email",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetRelationshipProfile"
                ]
              },
              "email": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account_id",
              "email",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "RebuildRelationshipProfile"
                ]
              },
              "email": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListCommitments"
                ]
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/CommitmentStatusData"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "commitment_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ResolveCommitment"
                ]
              },
              "commitment_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetUserVoice"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "RebuildUserVoice"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "text",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "HumanizerScore"
                ]
              },
              "text": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "text",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "HumanizerRewrite"
                ]
              },
              "max_iterations": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "minimum": 0
              },
              "text": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "List senders who've sent inbound messages but don't have a\nscreener decision yet.",
            "required": [
              "account_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListScreenerQueue"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "All screener decisions for an account.",
            "required": [
              "account_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListScreenerDecisions"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Set or update the screener disposition for one sender.",
            "required": [
              "account_id",
              "sender_email",
              "disposition",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SetScreenerDecision"
                ]
              },
              "disposition": {
                "$ref": "#/components/schemas/ScreenerDispositionData"
              },
              "route_label": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sender_email": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Clear an existing screener decision (returns the sender to\n\"no decision yet\" state).",
            "required": [
              "account_id",
              "sender_email",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ClearScreenerDecision"
                ]
              },
              "sender_email": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Summarize a thread using the configured LLM (structured prompt in\n`handler/summarize.rs`; no fixed sentence-count contract). Returns\n`LlmDisabled` when LLM is not configured.",
            "required": [
              "thread_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SummarizeThread"
                ]
              },
              "thread_id": {
                "$ref": "#/components/schemas/ThreadId"
              }
            }
          },
          {
            "type": "object",
            "description": "Return per-message triage verdicts for a search query. Cached\nmessages are returned without an LLM call; uncached messages use\nthe same summarizer verdict format as `SummarizeThread`.",
            "required": [
              "query",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "TriageSearch"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "mode": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/SearchMode"
                  }
                ]
              },
              "offset": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "query": {
                "type": "string"
              },
              "sort": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/SortOrder"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Generate an LLM draft — a new message, a reply from compose, or a\nreply from the reader — grounded on the conversation (when any) plus\nthe recipient relationship/voice profile. The tone and length are\ninferred from how the user writes to this person unless `register` /\n`length_hint` override them. The result is never auto-sent.\n\nModes (resolved by the daemon):\n- `thread_id` set → reply to that thread.\n- `source_message_id` set → reply to the thread containing it.\n- neither → a brand-new message (requires `to`).\n\n`account_id` is required for a new message and derived from the thread\notherwise.",
            "required": [
              "instruction",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "DraftCompose"
                ]
              },
              "instruction": {
                "type": "string",
                "description": "The user's purpose/instruction (e.g. \"follow up on pricing\",\n\"decline politely\")."
              },
              "length_hint": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/DraftLengthHintData"
                  }
                ]
              },
              "register": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/VoiceRegisterData"
                  }
                ]
              },
              "source_message_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/MessageId"
                  }
                ]
              },
              "thread_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/ThreadId"
                  }
                ]
              },
              "to": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/Address"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "draft_id",
              "knobs",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "DraftRefine"
                ]
              },
              "draft_id": {
                "$ref": "#/components/schemas/DraftId"
              },
              "knobs": {
                "$ref": "#/components/schemas/DraftRefineKnobsData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "reply_all",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "PrepareReply"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              },
              "reply_all": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "PrepareForward"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "draft",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SendDraft"
                ]
              },
              "draft": {
                "$ref": "#/components/schemas/Draft"
              },
              "override_safety_token": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "draft",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SaveDraft"
                ]
              },
              "draft": {
                "$ref": "#/components/schemas/Draft"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "draft_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SendStoredDraft"
                ]
              },
              "draft_id": {
                "$ref": "#/components/schemas/DraftId"
              },
              "override_safety_token": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Run the safety pipeline against a draft without actually sending.\nMirrors the gate that `SendDraft` and `SendStoredDraft` apply\nbefore reaching the provider, so callers can preview the report\nfrom `mxr send --check`, `mxr compose --check`, or the TUI\nconfirm modal.",
            "required": [
              "draft",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "CheckDraftSafety"
                ]
              },
              "context": {
                "$ref": "#/components/schemas/DraftSafetyContextData"
              },
              "draft": {
                "$ref": "#/components/schemas/Draft"
              }
            }
          },
          {
            "type": "object",
            "description": "Extract per-draft commitment candidates (deterministic prefilter\nplus LLM, gated by `LlmFeature::Commitments`). Persists into\n`draft_commitment_candidates`; on successful send, candidates\npromote to `contact_commitments`.",
            "required": [
              "draft",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ExtractDraftCommitments"
                ]
              },
              "draft": {
                "$ref": "#/components/schemas/Draft"
              }
            }
          },
          {
            "type": "object",
            "description": "Explain an entity (email or free-text term) using local\nevidence. Returns a person summary for emails, a citation-\nbacked summary for terms, and a candidate list for ambiguous\nqueries.",
            "required": [
              "account_id",
              "query",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ExplainEntity"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "query": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Find people in the local archive who have answered similar\nquestions before. Ranking distinguishes answerers from askers.",
            "required": [
              "account_id",
              "query",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "FindExpert"
                ]
              },
              "include_self": {
                "type": "boolean"
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "query": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Suggest \"maybe include\" recipients given a draft. Excludes\naddresses already on the draft and never reveals Bcc'd\naddresses from prior threads.",
            "required": [
              "draft",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SuggestCollaborators"
                ]
              },
              "draft": {
                "$ref": "#/components/schemas/Draft"
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "Render a thread briefing for someone returning to a dormant\nthread. Cached unless `refresh = true`.",
            "required": [
              "thread_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetThreadBriefing"
                ]
              },
              "refresh": {
                "type": "boolean"
              },
              "thread_id": {
                "$ref": "#/components/schemas/ThreadId"
              }
            }
          },
          {
            "type": "object",
            "description": "Render a recipient briefing for compose-time context.",
            "required": [
              "account_id",
              "email",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetRecipientBriefing"
                ]
              },
              "email": {
                "type": "string"
              },
              "refresh": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "Add a contact to the cadence watchlist.",
            "required": [
              "account_id",
              "email",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "allow_list_sender": {
                "type": "boolean"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "WatchCadence"
                ]
              },
              "email": {
                "type": "string"
              },
              "expected_days": {
                "type": [
                  "number",
                  "null"
                ],
                "format": "double"
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Remove a contact from the cadence watchlist.",
            "required": [
              "account_id",
              "email",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "UnwatchCadence"
                ]
              },
              "email": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "List currently watched contacts.",
            "required": [
              "account_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListCadenceWatch"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "List watched contacts whose interval since last contact has\nexceeded their cadence (override or contact p50, default 30d).",
            "required": [
              "account_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListCadenceDrift"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Recommend the bucket (weekday, hour) at which the recipient\nis fastest to reply. When `proposed_at` is set, the response\nalso includes the proposed slot's expected reply time so the\ncaller can render a delta against the recipient's best bucket.",
            "required": [
              "account_id",
              "recipients",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SendTimeRecommendation"
                ]
              },
              "proposed_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "recipients": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Walk every thread in the account whose latest message is\nwithin `since_days` days, run the LLM-backed decision-log\nextractor on each candidate, and persist new entries.\nIdempotent: re-running with the same thread content does\nnot produce duplicate rows (source_hash dedupes).",
            "required": [
              "account_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "RebuildDecisionLog"
                ]
              },
              "since_days": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "Fetch a single decision-log row by id. Returns\n`ResponseData::DecisionDetail` with `Option<DecisionLogEntryData>`\n— `None` means the id is unknown (not an error).",
            "required": [
              "id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetDecision"
                ]
              },
              "id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "List entries from the decision log. Optional topic and\nsince-days filters.",
            "required": [
              "account_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListDecisionLog"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "since_days": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "minimum": 0
              },
              "topic": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Citation-validated archive question. Returns a Markdown answer\nplus the cited source messages; LLM-fabricated citations\n(msg ids not in the retrieved set) are rejected at the daemon.",
            "required": [
              "question",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ArchiveAsk"
                ]
              },
              "filters": {
                "$ref": "#/components/schemas/ArchiveAskFiltersData"
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "question": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "List \"owed reply\" threads for an account: latest inbound has\nnot been followed by an outbound, ranked by overdue ratio.",
            "required": [
              "account_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListOwedReplies"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "older_than_days": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "minimum": 0
              },
              "within_days": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "draft_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "DeleteDraft"
                ]
              },
              "draft_id": {
                "$ref": "#/components/schemas/DraftId"
              }
            }
          },
          {
            "type": "object",
            "description": "Save draft to the mail server (e.g. Gmail Drafts folder).",
            "required": [
              "draft",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SaveDraftToServer"
                ]
              },
              "draft": {
                "$ref": "#/components/schemas/Draft"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListDrafts"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "List drafts that look orphaned mid-send: status `'sending'` with\na stale `last_heartbeat_at` (or `status_updated_at` fallback)\nolder than 1h. Surfaces what the daemon-startup recovery loop\nwould also auto-reset.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListOrphanedDrafts"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Force-reset an orphaned `'sending'` draft back to `'draft'` so\nthe user can retry the send. Idempotent: already-`'draft'` rows\nreturn the no-op variant. `'sent'` rows refuse.",
            "required": [
              "draft_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ResetOrphanedDraft"
                ]
              },
              "draft_id": {
                "$ref": "#/components/schemas/DraftId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "thread_id",
              "format",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ExportThread"
                ]
              },
              "format": {
                "$ref": "#/components/schemas/ExportFormat"
              },
              "thread_id": {
                "$ref": "#/components/schemas/ThreadId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "query",
              "format",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountId"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ExportSearch"
                ]
              },
              "format": {
                "$ref": "#/components/schemas/ExportFormat"
              },
              "query": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetStatus"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "Ping"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "Shutdown"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Paginated reverse-chron list of activity rows.",
            "required": [
              "filter",
              "limit",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListActivity"
                ]
              },
              "cursor": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/ActivityCursor"
                  }
                ]
              },
              "filter": {
                "$ref": "#/components/schemas/ActivityFilter"
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "Total matching rows (UI badge counts).",
            "required": [
              "filter",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "CountActivity"
                ]
              },
              "filter": {
                "$ref": "#/components/schemas/ActivityFilter"
              }
            }
          },
          {
            "type": "object",
            "description": "Grouped counts over a time window.",
            "required": [
              "since",
              "until",
              "group_by",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ActivityStats"
                ]
              },
              "group_by": {
                "$ref": "#/components/schemas/ActivityStatGroupBy"
              },
              "since": {
                "type": "integer",
                "format": "int64"
              },
              "until": {
                "type": "integer",
                "format": "int64"
              }
            }
          },
          {
            "type": "object",
            "description": "Export matching rows in CSV / JSON / NDJSON. When `path` is set the\ndaemon writes the file; otherwise it returns the body inline (capped).",
            "required": [
              "filter",
              "format",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ExportActivity"
                ]
              },
              "filter": {
                "$ref": "#/components/schemas/ActivityFilter"
              },
              "format": {
                "$ref": "#/components/schemas/ActivityExportFormat"
              },
              "path": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Tombstone rows (set `redacted=1`, clear `context_json`). Either\n`ids` is non-empty OR `filter` is `Some` — not both, not neither.",
            "required": [
              "ids",
              "dry_run",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "RedactActivity"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "filter": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/ActivityFilter"
                  }
                ]
              },
              "ids": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "format": "int64"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Hard-delete rows older than `before_ts`. Retention pruner uses this.",
            "required": [
              "before_ts",
              "dry_run",
              "cmd"
            ],
            "properties": {
              "before_ts": {
                "type": "integer",
                "format": "int64"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "PruneActivity"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "tier": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/ActivityTier"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Stop recording new rows. `until_ts=None` is indefinite.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "PauseActivity"
                ]
              },
              "until_ts": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64"
              }
            }
          },
          {
            "type": "object",
            "description": "Resume recording.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ResumeActivity"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "List all saved filter presets, most-recently-used first.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListSavedActivityFilters"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Fetch a single preset by slug.",
            "required": [
              "slug",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetSavedActivityFilter"
                ]
              },
              "slug": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Create or update a preset (slug is the primary key).",
            "required": [
              "slug",
              "name",
              "filter",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "UpsertSavedActivityFilter"
                ]
              },
              "filter": {
                "$ref": "#/components/schemas/ActivityFilter"
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Delete a preset by slug.",
            "required": [
              "slug",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "DeleteSavedActivityFilter"
                ]
              },
              "slug": {
                "type": "string"
              }
            }
          }
        ]
      },
      "Response": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "data",
              "status"
            ],
            "properties": {
              "data": {
                "$ref": "#/components/schemas/ResponseData"
              },
              "status": {
                "type": "string",
                "enum": [
                  "Ok"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message",
              "status"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "details": {},
              "kind": {
                "$ref": "#/components/schemas/IpcErrorKind"
              },
              "message": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              },
              "status": {
                "type": "string",
                "enum": [
                  "Error"
                ]
              }
            }
          }
        ]
      },
      "ResponseData": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "envelopes",
              "kind"
            ],
            "properties": {
              "envelopes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Envelope"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Envelopes"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "envelope",
              "kind"
            ],
            "properties": {
              "envelope": {
                "$ref": "#/components/schemas/Envelope"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Envelope"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "body",
              "kind"
            ],
            "properties": {
              "body": {
                "$ref": "#/components/schemas/MessageBody"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Body"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "invite",
              "kind"
            ],
            "properties": {
              "invite": {
                "$ref": "#/components/schemas/CalendarInviteData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Invite"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "invites",
              "kind"
            ],
            "properties": {
              "invites": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CalendarInviteData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Invites"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "backfilled",
              "kind"
            ],
            "properties": {
              "backfilled": {
                "type": "integer",
                "format": "int64",
                "description": "Calendar-invite rows rebuilt from body metadata that was already\nparsed but missing a `calendar_invites` row.",
                "minimum": 0
              },
              "kind": {
                "type": "string",
                "enum": [
                  "CalendarInviteBackfill"
                ]
              },
              "rehydrated": {
                "type": "integer",
                "format": "int64",
                "description": "Messages re-hydrated from the provider because they carried a\ncalendar attachment but no parsed calendar metadata (e.g. Gmail\ninvites whose `.ics` arrived only as an attachment). Defaults to 0\nfor older daemons.",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "preview",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "InviteResponsePreview"
                ]
              },
              "preview": {
                "$ref": "#/components/schemas/CalendarInviteResponsePreview"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "result",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "InviteResponseSent"
                ]
              },
              "result": {
                "$ref": "#/components/schemas/CalendarInviteResponseResult"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "assets",
              "kind"
            ],
            "properties": {
              "assets": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/HtmlImageAsset"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "HtmlImageAssets"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "file",
              "kind"
            ],
            "properties": {
              "file": {
                "$ref": "#/components/schemas/AttachmentFile"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "AttachmentFile"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "bodies",
              "kind"
            ],
            "properties": {
              "bodies": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageBody"
                }
              },
              "failures": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BodyFailure"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Bodies"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "thread",
              "messages",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Thread"
                ]
              },
              "messages": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Envelope"
                }
              },
              "summary": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/ThreadSummaryData"
                  }
                ]
              },
              "thread": {
                "$ref": "#/components/schemas/Thread"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "threads",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Threads"
                ]
              },
              "threads": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Thread"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "labels",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Labels"
                ]
              },
              "labels": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Label"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "label",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Label"
                ]
              },
              "label": {
                "$ref": "#/components/schemas/Label"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "results",
              "kind"
            ],
            "properties": {
              "explain": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/SearchExplain"
                  }
                ]
              },
              "has_more": {
                "type": "boolean"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "SearchResults"
                ]
              },
              "next_offset": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "minimum": 0
              },
              "results": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SearchResultItem"
                }
              },
              "total": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "sync",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SyncStatus"
                ]
              },
              "sync": {
                "$ref": "#/components/schemas/AccountSyncStatus"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "count",
              "kind"
            ],
            "properties": {
              "count": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Count"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "query",
              "group_by",
              "total",
              "groups",
              "kind"
            ],
            "properties": {
              "group_by": {
                "$ref": "#/components/schemas/SearchAggregationGroupBy"
              },
              "groups": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SearchAggregationRow"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "SearchAggregation"
                ]
              },
              "query": {
                "type": "string"
              },
              "total": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "headers",
              "kind"
            ],
            "properties": {
              "headers": {
                "type": "array",
                "items": {
                  "type": "array",
                  "items": false,
                  "prefixItems": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "string"
                    }
                  ]
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Headers"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "context",
              "kind"
            ],
            "properties": {
              "context": {
                "$ref": "#/components/schemas/ReplyContext"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ReplyContext"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "context",
              "kind"
            ],
            "properties": {
              "context": {
                "$ref": "#/components/schemas/ForwardContext"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ForwardContext"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "drafts",
              "kind"
            ],
            "properties": {
              "drafts": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Draft"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Drafts"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "snoozed",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SnoozedMessages"
                ]
              },
              "snoozed": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Snoozed"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "List of messages currently flagged for reply-later.",
            "required": [
              "messages",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ReplyQueue"
                ]
              },
              "messages": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "snippets",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Snippets"
                ]
              },
              "snippets": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SnippetData"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "snippet",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SnippetData"
                ]
              },
              "snippet": {
                "$ref": "#/components/schemas/SnippetData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "deliveries",
              "kind"
            ],
            "properties": {
              "deliveries": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DeliveryData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Deliveries"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "delivery",
              "kind"
            ],
            "properties": {
              "delivery": {
                "$ref": "#/components/schemas/DeliveryData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Delivery"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "summary",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "DeliveryScan"
                ]
              },
              "summary": {
                "$ref": "#/components/schemas/DeliveryScanSummary"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "signatures",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Signatures"
                ]
              },
              "signatures": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SignatureData"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "signature",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SignatureData"
                ]
              },
              "signature": {
                "$ref": "#/components/schemas/SignatureData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "defaults",
              "kind"
            ],
            "properties": {
              "defaults": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SignatureDefaultData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "SignatureDefaults"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ResolvedSignature"
                ]
              },
              "signature": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/SignatureData"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SenderProfile"
                ]
              },
              "profile": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/SenderProfileData"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "senders",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Senders"
                ]
              },
              "senders": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SenderSummaryData"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Per-saved-search unread counts. Map shape so callers can do\nfast id-keyed lookups when rendering the tab strip; missing\nentries render as a bare label (no `(0)` clutter).",
            "required": [
              "counts",
              "kind"
            ],
            "properties": {
              "counts": {
                "type": "object",
                "additionalProperties": {
                  "type": "integer",
                  "format": "int32",
                  "minimum": 0
                },
                "propertyNames": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "SavedSearchUnreadCounts"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "RelationshipProfile"
                ]
              },
              "profile": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/RelationshipProfileData"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "commitments",
              "kind"
            ],
            "properties": {
              "commitments": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CommitmentData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "CommitmentList"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "UserVoice"
                ]
              },
              "profile": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/UserVoiceProfileData"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "report",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "HumanizerReport"
                ]
              },
              "report": {
                "$ref": "#/components/schemas/HumanizerReportSummaryData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "text",
              "report",
              "iterations",
              "kind"
            ],
            "properties": {
              "iterations": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "kind": {
                "type": "string",
                "enum": [
                  "HumanizedText"
                ]
              },
              "report": {
                "$ref": "#/components/schemas/HumanizerReportSummaryData"
              },
              "text": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "entries",
              "kind"
            ],
            "properties": {
              "entries": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ScreenerQueueEntryData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ScreenerQueue"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "decisions",
              "kind"
            ],
            "properties": {
              "decisions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ScreenerDecisionData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ScreenerDecisions"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "text",
              "model",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ThreadSummary"
                ]
              },
              "model": {
                "type": "string"
              },
              "text": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "messages",
              "total",
              "has_more",
              "llm_calls",
              "prompt_version",
              "kind"
            ],
            "properties": {
              "has_more": {
                "type": "boolean"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "TriageResults"
                ]
              },
              "llm_calls": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "messages": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TriageMessageData"
                }
              },
              "next_offset": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "minimum": 0
              },
              "prompt_version": {
                "type": "string"
              },
              "total": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "body",
              "model",
              "kind"
            ],
            "properties": {
              "body": {
                "type": "string"
              },
              "context_note": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "humanizer": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/HumanizerReportSummaryData"
                  }
                ]
              },
              "inferred_length": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/DraftLengthHintData"
                  }
                ]
              },
              "inferred_register": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/VoiceRegisterData",
                    "description": "Tone/length the daemon inferred from the relationship (the\neffective values used, even when the caller overrode them) so\nthe UI can show \"Matched to {sender}\" without re-deriving."
                  }
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "DraftSuggestion"
                ]
              },
              "model": {
                "type": "string"
              },
              "rewrite_iterations": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "voice_match": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/VoiceMatchData"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "content",
              "kind"
            ],
            "properties": {
              "content": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ExportResult"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "result",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "MutationResult"
                ]
              },
              "result": {
                "$ref": "#/components/schemas/MutationResultData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "job",
              "kind"
            ],
            "properties": {
              "job": {
                "$ref": "#/components/schemas/JobData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "JobStarted"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "jobs",
              "kind"
            ],
            "properties": {
              "jobs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/JobData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Jobs"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "job",
              "kind"
            ],
            "properties": {
              "job": {
                "$ref": "#/components/schemas/JobData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Job"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "result",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "UnsubscribePurgeResult"
                ]
              },
              "result": {
                "$ref": "#/components/schemas/UnsubscribePurgeResultData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "rules",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Rules"
                ]
              },
              "rules": {
                "type": "array",
                "items": {}
              }
            }
          },
          {
            "type": "object",
            "required": [
              "rule",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "RuleData"
                ]
              },
              "rule": {}
            }
          },
          {
            "type": "object",
            "required": [
              "accounts",
              "kind"
            ],
            "properties": {
              "accounts": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AccountSummaryData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Accounts"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "accounts",
              "kind"
            ],
            "properties": {
              "accounts": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AccountConfigData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "AccountsConfig"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "result",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "AccountOperation"
                ]
              },
              "result": {
                "$ref": "#/components/schemas/AccountOperationResult"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "session",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "AuthSession"
                ]
              },
              "session": {
                "$ref": "#/components/schemas/AuthSessionData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "form",
              "kind"
            ],
            "properties": {
              "form": {
                "$ref": "#/components/schemas/RuleFormData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "RuleFormData"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "results",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "RuleDryRun"
                ]
              },
              "results": {
                "type": "array",
                "items": {}
              }
            }
          },
          {
            "type": "object",
            "required": [
              "searches",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SavedSearches"
                ]
              },
              "searches": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SavedSearch"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "subscriptions",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Subscriptions"
                ]
              },
              "subscriptions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SubscriptionSummary"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "rows",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "StorageBreakdown"
                ]
              },
              "rows": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/StorageBucket"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "rows",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "LargestMessages"
                ]
              },
              "rows": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/LargestMessageRow"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "summary",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Wrapped"
                ]
              },
              "summary": {
                "$ref": "#/components/schemas/WrappedSummary"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "rows",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "StaleThreads"
                ]
              },
              "rows": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/StaleThreadRow"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "rows",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ContactAsymmetry"
                ]
              },
              "rows": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ContactAsymmetryRow"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "rows",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ContactDecay"
                ]
              },
              "rows": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ContactDecayRow"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "rows",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "RefreshedContacts"
                ]
              },
              "rows": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "directions_reclassified",
              "list_ids_backfilled",
              "reply_pairs_resolved",
              "business_hours_backfilled",
              "contacts_rows",
              "kind"
            ],
            "properties": {
              "business_hours_backfilled": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "contacts_rows": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "directions_reclassified": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "kind": {
                "type": "string",
                "enum": [
                  "AnalyticsRebuildSummary"
                ]
              },
              "list_ids_backfilled": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "reply_pairs_resolved": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "summary",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ResponseTime"
                ]
              },
              "summary": {
                "$ref": "#/components/schemas/ResponseTimeSummary"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "addresses",
              "kind"
            ],
            "properties": {
              "addresses": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AccountAddress"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "AccountAddresses"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "snapshot",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SemanticStatus"
                ]
              },
              "snapshot": {
                "$ref": "#/components/schemas/SemanticStatusSnapshot"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "snapshot",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "LlmStatus"
                ]
              },
              "snapshot": {
                "$ref": "#/components/schemas/LlmStatusSnapshot"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "config",
              "kind"
            ],
            "properties": {
              "config": {
                "$ref": "#/components/schemas/LlmConfigData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "LlmConfig"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "config",
              "kind"
            ],
            "properties": {
              "config": {
                "$ref": "#/components/schemas/NotificationChimesData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "NotificationChimes"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "event",
              "sound",
              "played",
              "kind"
            ],
            "properties": {
              "event": {
                "$ref": "#/components/schemas/NotificationChimeEventData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "NotificationChimePreview"
                ]
              },
              "played": {
                "type": "boolean"
              },
              "sound": {
                "$ref": "#/components/schemas/NotificationChimeSoundData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "search",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SavedSearchData"
                ]
              },
              "search": {
                "$ref": "#/components/schemas/SavedSearch"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "entries",
              "kind"
            ],
            "properties": {
              "entries": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/EventLogEntry"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "EventLogEntries"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "lines",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "LogLines"
                ]
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "report",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "DoctorReport"
                ]
              },
              "report": {
                "$ref": "#/components/schemas/DoctorReport"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "content",
              "kind"
            ],
            "properties": {
              "content": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "BugReport"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "entries",
              "kind"
            ],
            "properties": {
              "entries": {
                "type": "array",
                "items": {}
              },
              "kind": {
                "type": "string",
                "enum": [
                  "RuleHistory"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "uptime_secs",
              "accounts",
              "total_messages",
              "kind"
            ],
            "properties": {
              "accounts": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "daemon_build_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "daemon_pid": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "minimum": 0
              },
              "daemon_version": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "feature_health": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/FeatureHealthReport"
                  }
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Status"
                ]
              },
              "protocol_version": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "repair_required": {
                "type": "boolean"
              },
              "semantic_runtime": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/SemanticRuntimeMetrics"
                  }
                ]
              },
              "sync_statuses": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AccountSyncStatus"
                }
              },
              "total_messages": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "uptime_secs": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Pong"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Ack"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::SendDraft` and `Request::SendStoredDraft` on\nsuccess. Carries the IDs minted during synthetic Sent ingestion so\ncallers can navigate to or reference the just-sent message without\nwaiting for the next sync.",
            "required": [
              "local_message_id",
              "rfc2822_message_id",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SendReceipt"
                ]
              },
              "local_message_id": {
                "$ref": "#/components/schemas/MessageId"
              },
              "provider_message_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "rfc2822_message_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ExtractDraftCommitments`.",
            "required": [
              "candidates",
              "kind"
            ],
            "properties": {
              "candidates": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DraftCommitmentCandidateData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "DraftCommitments"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ListOwedReplies`.",
            "required": [
              "rows",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "OwedReplies"
                ]
              },
              "rows": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/OwedReplyRowData"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ArchiveAsk`.",
            "required": [
              "answer",
              "kind"
            ],
            "properties": {
              "answer": {
                "$ref": "#/components/schemas/ArchiveAnswerData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ArchiveAnswer"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ListDecisionLog`.",
            "required": [
              "decisions",
              "kind"
            ],
            "properties": {
              "decisions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DecisionLogEntryData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "DecisionLog"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetDecision`. `None` when the id is\nunknown — CLI surfaces that as \"not found\", not as an error.",
            "required": [
              "kind"
            ],
            "properties": {
              "decision": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/DecisionLogEntryData"
                  }
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "DecisionDetail"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::RebuildDecisionLog`.",
            "required": [
              "extracted",
              "skipped",
              "errors",
              "kind"
            ],
            "properties": {
              "errors": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "extracted": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "kind": {
                "type": "string",
                "enum": [
                  "DecisionLogRebuildSummary"
                ]
              },
              "skipped": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::SendTimeRecommendation`.",
            "required": [
              "recommendation",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SendTimeRecommendationResponse"
                ]
              },
              "recommendation": {
                "$ref": "#/components/schemas/SendTimeRecommendationData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ListCadenceWatch`.",
            "required": [
              "entries",
              "kind"
            ],
            "properties": {
              "entries": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/RelationshipWatchEntryData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "CadenceWatchList"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ListCadenceDrift`.",
            "required": [
              "rows",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "CadenceDriftList"
                ]
              },
              "rows": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CadenceDriftRowData"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetThreadBriefing` or\n`Request::GetRecipientBriefing`.",
            "required": [
              "briefing",
              "kind"
            ],
            "properties": {
              "briefing": {
                "$ref": "#/components/schemas/ThreadBriefingData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ThreadBriefing"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "briefing",
              "kind"
            ],
            "properties": {
              "briefing": {
                "$ref": "#/components/schemas/ThreadBriefingData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "RecipientBriefing"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::SuggestCollaborators`.",
            "required": [
              "suggestions",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SuggestedCollaborators"
                ]
              },
              "suggestions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SuggestedRecipientData"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::FindExpert`.",
            "required": [
              "experts",
              "kind"
            ],
            "properties": {
              "experts": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ExpertSuggestionData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ExpertSuggestions"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ExplainEntity`.",
            "required": [
              "entity",
              "kind"
            ],
            "properties": {
              "entity": {
                "$ref": "#/components/schemas/EntityExplanationData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "EntityExplanation"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::CheckDraftSafety` and surfaced to CLI / TUI.",
            "required": [
              "report",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "DraftSafetyReportResponse"
                ]
              },
              "report": {
                "$ref": "#/components/schemas/DraftSafetyReport"
              }
            }
          },
          {
            "type": "object",
            "description": "Paginated activity rows. See `Request::ListActivity`.",
            "required": [
              "entries",
              "kind"
            ],
            "properties": {
              "entries": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ActivityEntry"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ActivityEntries"
                ]
              },
              "next_cursor": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/ActivityCursor"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::CountActivity`. (Distinct from the\n`Count { count: u32 }` variant returned by the mail `Count`\nrequest — different scale, different consumer.)",
            "required": [
              "count",
              "kind"
            ],
            "properties": {
              "count": {
                "type": "integer",
                "format": "int64"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ActivityCount"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ActivityStats`. Buckets are pre-sorted.",
            "required": [
              "buckets",
              "kind"
            ],
            "properties": {
              "buckets": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ActivityStatBucket"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ActivityStatBuckets"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ExportActivity`. Either `body` or `path` is set\ndepending on whether the export was inline or written to disk.",
            "required": [
              "format",
              "count",
              "size_bytes",
              "kind"
            ],
            "properties": {
              "body": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "count": {
                "type": "integer",
                "format": "int64"
              },
              "format": {
                "$ref": "#/components/schemas/ActivityExportFormat"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ActivityExportResult"
                ]
              },
              "path": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "size_bytes": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by mutating activity verbs. `count` is the row count\naffected (or that *would* be affected when `dry_run=true`).",
            "required": [
              "count",
              "dry_run",
              "kind"
            ],
            "properties": {
              "count": {
                "type": "integer",
                "format": "int64"
              },
              "dry_run": {
                "type": "boolean"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ActivityAffected"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Generic acknowledgement for verbs that have no return payload\n(`PauseActivity`, `ResumeActivity`).",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Acknowledged"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "entries",
              "kind"
            ],
            "properties": {
              "entries": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SavedActivityFilterEntry"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "SavedActivityFilters"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "kind"
            ],
            "properties": {
              "entry": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/SavedActivityFilterEntry"
                  }
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "SavedActivityFilterDetail"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Distinct event-log categories, recency-ordered.",
            "required": [
              "categories",
              "kind"
            ],
            "properties": {
              "categories": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "EventCategories"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Count for an event-log filter.",
            "required": [
              "count",
              "kind"
            ],
            "properties": {
              "count": {
                "type": "integer",
                "format": "int64"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "EventLogCount"
                ]
              }
            }
          }
        ]
      },
      "ResponseTimeBucket": {
        "type": "object",
        "description": "A single bucket of the response-time histogram. `count` rows had a\nclock latency in `(prev_upper, upper_bound_seconds]`. The last\nbucket uses `u32::MAX` as `upper_bound_seconds` to mean \"no upper\nlimit\".",
        "required": [
          "upper_bound_seconds",
          "count"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "upper_bound_seconds": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "ResponseTimeDirection": {
        "type": "string",
        "enum": [
          "i_replied",
          "they_replied"
        ]
      },
      "ResponseTimeSummary": {
        "type": "object",
        "description": "Aggregate response-time summary for `mxr response-time`. p50/p90 in\nseconds; business-hours percentiles are `None` until the reconciler has\nbackfilled the relevant rows.",
        "required": [
          "direction",
          "sample_count",
          "clock_p50_seconds",
          "clock_p90_seconds"
        ],
        "properties": {
          "business_hours_p50_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "business_hours_p90_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "clock_p50_seconds": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "clock_p90_seconds": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "direction": {
            "$ref": "#/components/schemas/ResponseTimeDirection"
          },
          "histogram": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ResponseTimeBucket"
            },
            "description": "Distribution of clock latencies (seconds) bucketed for the\nhistogram view in the TUI / future CLI surface. Ordered from\nshortest to longest by `upper_bound_seconds`. `#[serde(default)]`\nso older daemons returning the previous payload deserialize\ncleanly during a rolling upgrade."
          },
          "sample_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "Role": {
        "type": "string",
        "description": "Well-known role for a `Label`/folder, mirroring MSP §2.3. The set\ncovers the roles every consumer-mail provider exposes; provider-specific\nroles outside this set are represented as `None` so clients fall back\nto generic styling. New variants land additively under\n`#[non_exhaustive]` to keep wire compatibility cheap.",
        "enum": [
          "inbox",
          "sent",
          "drafts",
          "trash",
          "spam",
          "archive",
          "all_mail",
          "important",
          "starred"
        ]
      },
      "RuleFormData": {
        "type": "object",
        "required": [
          "name",
          "condition",
          "action",
          "priority",
          "enabled"
        ],
        "properties": {
          "action": {
            "type": "string"
          },
          "condition": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "id": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "priority": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "SavedActivityFilterEntry": {
        "type": "object",
        "description": "Wire shape of a saved activity filter preset (Phase 8).",
        "required": [
          "slug",
          "name",
          "filter",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "filter": {
            "$ref": "#/components/schemas/ActivityFilter"
          },
          "last_used_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "SavedSearch": {
        "type": "object",
        "required": [
          "id",
          "name",
          "query",
          "sort",
          "position",
          "created_at"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AccountId"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "icon": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "$ref": "#/components/schemas/SavedSearchId"
          },
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer",
            "format": "int32"
          },
          "query": {
            "type": "string"
          },
          "search_mode": {
            "$ref": "#/components/schemas/SearchMode"
          },
          "sort": {
            "$ref": "#/components/schemas/SortOrder"
          }
        }
      },
      "SavedSearchId": {
        "type": "string",
        "format": "uuid"
      },
      "ScreenerDecisionData": {
        "type": "object",
        "required": [
          "account_id",
          "sender_email",
          "disposition",
          "decided_at"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "decided_at": {
            "type": "string",
            "format": "date-time"
          },
          "disposition": {
            "$ref": "#/components/schemas/ScreenerDispositionData"
          },
          "route_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "sender_email": {
            "type": "string"
          }
        }
      },
      "ScreenerDispositionData": {
        "type": "string",
        "enum": [
          "allow",
          "deny",
          "feed",
          "paper_trail",
          "unknown"
        ]
      },
      "ScreenerQueueEntryData": {
        "type": "object",
        "required": [
          "sender_email",
          "message_count",
          "latest_subject",
          "latest_at"
        ],
        "properties": {
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "latest_at": {
            "type": "string",
            "format": "date-time"
          },
          "latest_subject": {
            "type": "string"
          },
          "message_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "sender_email": {
            "type": "string"
          }
        }
      },
      "SearchAggregationGroupBy": {
        "type": "string",
        "enum": [
          "from",
          "list",
          "category"
        ]
      },
      "SearchAggregationRow": {
        "type": "object",
        "required": [
          "key",
          "label",
          "count",
          "unread"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "newest": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Newest message timestamp in this group (Unix seconds)."
          },
          "oldest": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Oldest message timestamp in this group (Unix seconds)."
          },
          "unread": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "SearchExplain": {
        "type": "object",
        "required": [
          "requested_mode",
          "executed_mode",
          "lexical_window",
          "lexical_candidates",
          "dense_candidates",
          "final_results",
          "notes",
          "results"
        ],
        "properties": {
          "dense_candidates": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "dense_window": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "executed_mode": {
            "$ref": "#/components/schemas/SearchMode"
          },
          "final_results": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "lexical_candidates": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "lexical_window": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "requested_mode": {
            "$ref": "#/components/schemas/SearchMode"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SearchExplainResult"
            }
          },
          "rrf_k": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "semantic_query": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "SearchExplainResult": {
        "type": "object",
        "required": [
          "rank",
          "message_id",
          "final_score"
        ],
        "properties": {
          "dense_rank": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "dense_score": {
            "type": [
              "number",
              "null"
            ],
            "format": "float"
          },
          "final_score": {
            "type": "number",
            "format": "float"
          },
          "lexical_rank": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "lexical_score": {
            "type": [
              "number",
              "null"
            ],
            "format": "float"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "rank": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "SearchMode": {
        "type": "string",
        "enum": [
          "lexical",
          "hybrid",
          "semantic"
        ]
      },
      "SearchResultItem": {
        "type": "object",
        "required": [
          "message_id",
          "account_id",
          "thread_id",
          "score",
          "mode"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "mode": {
            "$ref": "#/components/schemas/SearchMode"
          },
          "score": {
            "type": "number",
            "format": "float"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "SemanticProfile": {
        "type": "string",
        "enum": [
          "bge-small-en-v1.5",
          "multilingual-e5-small",
          "bge-m3"
        ]
      },
      "SemanticProfileId": {
        "type": "string",
        "format": "uuid"
      },
      "SemanticProfileRecord": {
        "type": "object",
        "required": [
          "id",
          "profile",
          "backend",
          "model_revision",
          "dimensions",
          "status",
          "progress_completed",
          "progress_total"
        ],
        "properties": {
          "activated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "backend": {
            "type": "string"
          },
          "dimensions": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "id": {
            "$ref": "#/components/schemas/SemanticProfileId"
          },
          "installed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_indexed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "model_revision": {
            "type": "string"
          },
          "profile": {
            "$ref": "#/components/schemas/SemanticProfile"
          },
          "progress_completed": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "progress_total": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "status": {
            "$ref": "#/components/schemas/SemanticProfileStatus"
          }
        }
      },
      "SemanticProfileStatus": {
        "type": "string",
        "enum": [
          "pending",
          "ready",
          "indexing",
          "error"
        ]
      },
      "SemanticRuntimeMetrics": {
        "type": "object",
        "properties": {
          "in_flight": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "last_embedding_prep_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "last_extract_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "last_ingest_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "last_queue_wait_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "queue_depth": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "SemanticStatusSnapshot": {
        "type": "object",
        "required": [
          "enabled",
          "active_profile",
          "profiles"
        ],
        "properties": {
          "active_profile": {
            "$ref": "#/components/schemas/SemanticProfile"
          },
          "enabled": {
            "type": "boolean"
          },
          "profiles": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SemanticProfileRecord"
            }
          },
          "runtime": {
            "$ref": "#/components/schemas/SemanticRuntimeMetrics"
          }
        }
      },
      "SendTimeConfidenceData": {
        "type": "string",
        "enum": [
          "low",
          "medium",
          "high"
        ]
      },
      "SendTimeRecommendationData": {
        "type": "object",
        "required": [
          "recipient_rows",
          "best_windows",
          "confidence"
        ],
        "properties": {
          "best_windows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SendWindowData"
            }
          },
          "confidence": {
            "$ref": "#/components/schemas/SendTimeConfidenceData"
          },
          "proposed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Slot the caller asked us to evaluate, echoed back so JSON\nconsumers don't have to rebuild it. Present only when the\ncaller passed `proposed_at` on the request."
          },
          "proposed_hour": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Hour (0-23) of `proposed_at` in UTC.",
            "minimum": 0
          },
          "proposed_weekday": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Weekday (0 = Monday) of `proposed_at` in UTC.",
            "minimum": 0
          },
          "recipient_rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecipientSendTimeRowData"
            }
          }
        }
      },
      "SendWindowData": {
        "type": "object",
        "required": [
          "weekday",
          "hour_start",
          "hour_end",
          "expected_reply_seconds"
        ],
        "properties": {
          "expected_reply_seconds": {
            "type": "integer",
            "format": "int64"
          },
          "hour_end": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "hour_start": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "weekday": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "SenderEmailReferenceData": {
        "type": "object",
        "required": [
          "message_id",
          "thread_id",
          "subject",
          "snippet",
          "from_email",
          "date",
          "direction",
          "has_attachments"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "direction": {
            "type": "string"
          },
          "from_email": {
            "type": "string"
          },
          "from_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "has_attachments": {
            "type": "boolean"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "snippet": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "SenderProfileData": {
        "type": "object",
        "required": [
          "account_id",
          "email",
          "first_seen_at",
          "last_seen_at",
          "total_inbound",
          "total_outbound",
          "replied_count",
          "is_list_sender",
          "open_thread_count"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "attachment_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "attachment_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "cadence_days_p50": {
            "type": [
              "number",
              "null"
            ],
            "format": "double"
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": "string"
          },
          "first_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "inbound_storage_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "is_list_sender": {
            "type": "boolean"
          },
          "last_inbound_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_outbound_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "list_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "open_thread_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "outbound_storage_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "recent_messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SenderEmailReferenceData"
            }
          },
          "relationship": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/RelationshipProfileData"
              }
            ]
          },
          "replied_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "response_histogram": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ResponseTimeBucket"
            }
          },
          "total_inbound": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "total_outbound": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "unanswered_question": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SenderUnansweredQuestionData"
              }
            ]
          },
          "weekly_activity": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SenderWeeklyActivityData"
            }
          }
        }
      },
      "SenderSummaryData": {
        "type": "object",
        "required": [
          "account_id",
          "sender_email",
          "message_count",
          "unread_count",
          "latest_subject",
          "latest_at"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "latest_at": {
            "type": "string",
            "format": "date-time"
          },
          "latest_subject": {
            "type": "string"
          },
          "message_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "sender_email": {
            "type": "string"
          },
          "unread_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "SenderUnansweredQuestionData": {
        "type": "object",
        "required": [
          "message_id",
          "thread_id",
          "subject",
          "received_at",
          "days_waiting"
        ],
        "properties": {
          "days_waiting": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "SenderWeeklyActivityData": {
        "type": "object",
        "required": [
          "week_start",
          "inbound_count",
          "outbound_count"
        ],
        "properties": {
          "inbound_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "outbound_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "week_start": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SignatureContextData": {
        "type": "string",
        "enum": [
          "new",
          "reply"
        ]
      },
      "SignatureData": {
        "type": "object",
        "required": [
          "id",
          "name",
          "body",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "body": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "id": {
            "$ref": "#/components/schemas/SignatureId"
          },
          "name": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SignatureDefaultData": {
        "type": "object",
        "required": [
          "kind",
          "signature",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AccountId"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "from_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "$ref": "#/components/schemas/SignatureContextData"
          },
          "signature": {
            "$ref": "#/components/schemas/SignatureData"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SignatureId": {
        "type": "string",
        "format": "uuid"
      },
      "SnippetData": {
        "type": "object",
        "required": [
          "name",
          "body",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "body": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "name": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "vars": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Snoozed": {
        "type": "object",
        "required": [
          "message_id",
          "account_id",
          "snoozed_at",
          "wake_at",
          "original_labels"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "original_labels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LabelId"
            }
          },
          "snoozed_at": {
            "type": "string",
            "format": "date-time"
          },
          "wake_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SortOrder": {
        "type": "string",
        "enum": [
          "DateDesc",
          "DateAsc",
          "Relevance"
        ]
      },
      "StaleBallInCourt": {
        "type": "string",
        "enum": [
          "mine",
          "theirs"
        ]
      },
      "StaleThreadRow": {
        "type": "object",
        "description": "Single row of `mxr stale` output: a thread whose latest message points\nat one party and has been silent past the threshold.",
        "required": [
          "thread_id",
          "latest_message_id",
          "latest_subject",
          "counterparty_email",
          "latest_date",
          "days_stale"
        ],
        "properties": {
          "counterparty_email": {
            "type": "string"
          },
          "days_stale": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "latest_date": {
            "type": "string",
            "format": "date-time"
          },
          "latest_message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "latest_subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "StorageBucket": {
        "type": "object",
        "description": "Single row of `mxr storage` output: how many bytes / how many items\nrolled up under a particular grouping key (sender, mimetype, label).",
        "required": [
          "key",
          "bytes",
          "count"
        ],
        "properties": {
          "bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "key": {
            "type": "string"
          }
        }
      },
      "StorageGroupBy": {
        "type": "string",
        "enum": [
          "mimetype",
          "sender",
          "label"
        ]
      },
      "SubscriptionSummary": {
        "type": "object",
        "required": [
          "account_id",
          "sender_email",
          "message_count",
          "latest_message_id",
          "latest_provider_id",
          "latest_thread_id",
          "latest_subject",
          "latest_snippet",
          "latest_date",
          "latest_flags",
          "latest_has_attachments",
          "latest_size_bytes",
          "unsubscribe"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "archived_unread_count": {
            "type": "integer",
            "format": "int32",
            "description": "Messages that landed in ARCHIVE without ever being read. Strong\n\"this is noise\" signal for the unsubscribe ranker.",
            "minimum": 0
          },
          "latest_date": {
            "type": "string",
            "format": "date-time"
          },
          "latest_flags": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "latest_has_attachments": {
            "type": "boolean"
          },
          "latest_message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "latest_provider_id": {
            "type": "string"
          },
          "latest_size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "latest_snippet": {
            "type": "string"
          },
          "latest_subject": {
            "type": "string"
          },
          "latest_thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          },
          "message_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "opened_count": {
            "type": "integer",
            "format": "int32",
            "description": "Number of messages from this sender that have been marked READ.\nCombined with `message_count` gives the open-rate used by `unsub --rank`.",
            "minimum": 0
          },
          "replied_count": {
            "type": "integer",
            "format": "int32",
            "description": "Number of messages where I replied. Placeholder zero until Slice 9\nwires `reply_pairs`. Field exists so the JSON contract is stable.",
            "minimum": 0
          },
          "sender_email": {
            "type": "string"
          },
          "sender_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "unsubscribe": {
            "$ref": "#/components/schemas/UnsubscribeMethod"
          }
        }
      },
      "SuggestedRecipientData": {
        "type": "object",
        "required": [
          "email",
          "reason",
          "confidence",
          "evidence_msg_ids"
        ],
        "properties": {
          "confidence": {
            "type": "string"
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": "string"
          },
          "evidence_msg_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "TextPlainFormat": {
        "oneOf": [
          {
            "type": "string",
            "enum": [
              "Fixed"
            ]
          },
          {
            "type": "object",
            "required": [
              "Flowed"
            ],
            "properties": {
              "Flowed": {
                "type": "object",
                "required": [
                  "delsp"
                ],
                "properties": {
                  "delsp": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        ]
      },
      "Thread": {
        "type": "object",
        "required": [
          "id",
          "account_id",
          "subject",
          "participants",
          "message_count",
          "unread_count",
          "latest_date",
          "snippet"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "id": {
            "$ref": "#/components/schemas/ThreadId"
          },
          "latest_date": {
            "type": "string",
            "format": "date-time"
          },
          "message_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "message_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageId"
            },
            "description": "Constituent message IDs ordered by `date` ascending, ties\nbroken by `MessageId` ascending. Empty `message_ids` denotes\na tombstoned thread (typically the loser side of a\nmail-threading merge); clients receiving such a Thread in\n`SyncBatch.threads_changed` SHOULD drop any cached metadata\nfor that id."
          },
          "participants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          },
          "snippet": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "unread_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "ThreadBriefingData": {
        "type": "object",
        "required": [
          "thread_id",
          "body_markdown",
          "citations",
          "generated_at",
          "from_cache"
        ],
        "properties": {
          "body_markdown": {
            "type": "string"
          },
          "citations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CitationRefData"
            }
          },
          "from_cache": {
            "type": "boolean"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "thread_id": {
            "type": "string",
            "description": "thread_id (Slice 5.1) or recipient email (Slice 5.2)."
          }
        }
      },
      "ThreadId": {
        "type": "string",
        "format": "uuid"
      },
      "ThreadSummaryData": {
        "type": "object",
        "required": [
          "text",
          "model",
          "generated_at"
        ],
        "properties": {
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "model": {
            "type": "string"
          },
          "text": {
            "type": "string"
          }
        }
      },
      "TriageMessageData": {
        "type": "object",
        "required": [
          "message_id",
          "account_id",
          "thread_id",
          "score",
          "verdict",
          "verdict_token",
          "verdict_line",
          "reason",
          "model",
          "cached",
          "generated_at"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "cached": {
            "type": "boolean"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "model": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "score": {
            "type": "number",
            "format": "float"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          },
          "verdict": {
            "$ref": "#/components/schemas/TriageVerdictData"
          },
          "verdict_line": {
            "type": "string"
          },
          "verdict_token": {
            "type": "string"
          }
        }
      },
      "TriageVerdictData": {
        "type": "string",
        "enum": [
          "ACTION",
          "FYI",
          "ROUTINE"
        ]
      },
      "UnsubscribeMethod": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "OneClick"
            ],
            "properties": {
              "OneClick": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string"
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "HttpLink"
            ],
            "properties": {
              "HttpLink": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string"
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "Mailto"
            ],
            "properties": {
              "Mailto": {
                "type": "object",
                "required": [
                  "address"
                ],
                "properties": {
                  "address": {
                    "type": "string"
                  },
                  "subject": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "BodyLink"
            ],
            "properties": {
              "BodyLink": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string"
                  }
                }
              }
            }
          },
          {
            "type": "string",
            "enum": [
              "None"
            ]
          }
        ]
      },
      "UnsubscribePurgeResultData": {
        "type": "object",
        "required": [
          "address",
          "query",
          "dry_run",
          "method",
          "status",
          "message_count",
          "archived_count"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AccountId"
              }
            ]
          },
          "address": {
            "type": "string"
          },
          "archived_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "dry_run": {
            "type": "boolean"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "message_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "message_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageId"
            }
          },
          "method": {
            "$ref": "#/components/schemas/UnsubscribeMethod"
          },
          "mutation_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "query": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/UnsubscribePurgeStatusData"
          }
        }
      },
      "UnsubscribePurgeStatusData": {
        "type": "string",
        "enum": [
          "preview",
          "unsubscribed",
          "no_method",
          "archive_only",
          "failed"
        ]
      },
      "UserVoiceProfileData": {
        "type": "object",
        "required": [
          "account_id",
          "formality_score",
          "avg_sentence_len",
          "msg_count_used",
          "register_modes",
          "computed_at",
          "source_hash"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "avg_sentence_len": {
            "type": "number",
            "format": "double"
          },
          "computed_at": {
            "type": "string",
            "format": "date-time"
          },
          "formality_score": {
            "type": "number",
            "format": "double"
          },
          "msg_count_used": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "register_modes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserVoiceRegisterModeData"
            }
          },
          "source_hash": {
            "type": "string"
          }
        }
      },
      "UserVoiceRegisterModeData": {
        "type": "object",
        "required": [
          "register",
          "formality_score",
          "avg_sentence_len",
          "exemplar_message_ids"
        ],
        "properties": {
          "avg_sentence_len": {
            "type": "number",
            "format": "double"
          },
          "exemplar_message_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "formality_score": {
            "type": "number",
            "format": "double"
          },
          "register": {
            "$ref": "#/components/schemas/VoiceRegisterData"
          }
        }
      },
      "VoiceMatchConfidenceData": {
        "type": "string",
        "enum": [
          "low",
          "medium",
          "high"
        ]
      },
      "VoiceMatchData": {
        "type": "object",
        "required": [
          "score",
          "confidence",
          "notable_deltas"
        ],
        "properties": {
          "confidence": {
            "$ref": "#/components/schemas/VoiceMatchConfidenceData"
          },
          "notable_deltas": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "score": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "VoiceRegisterData": {
        "type": "string",
        "enum": [
          "casual",
          "neutral",
          "formal"
        ]
      },
      "WhoisCitationData": {
        "type": "object",
        "required": [
          "msg_id",
          "quote"
        ],
        "properties": {
          "msg_id": {
            "type": "string"
          },
          "quote": {
            "type": "string"
          }
        }
      },
      "WrappedContactRank": {
        "type": "object",
        "required": [
          "email",
          "count"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": "string"
          }
        }
      },
      "WrappedLongestThread": {
        "type": "object",
        "required": [
          "thread_id",
          "subject",
          "message_count"
        ],
        "properties": {
          "message_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "WrappedMostGhosted": {
        "type": "object",
        "required": [
          "email",
          "inbound_count",
          "outbound_count"
        ],
        "properties": {
          "email": {
            "type": "string"
          },
          "inbound_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "outbound_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "WrappedNewsletters": {
        "type": "object",
        "required": [
          "unique_lists",
          "list_share_of_inbound_pct"
        ],
        "properties": {
          "list_share_of_inbound_pct": {
            "type": "number",
            "format": "double",
            "description": "0.0–100.0; share of inbound messages that came via a list_id."
          },
          "top_list": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/WrappedTopList"
              }
            ]
          },
          "unique_lists": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "WrappedReplyDiscipline": {
        "type": "object",
        "required": [
          "sample_count",
          "clock_p50_seconds",
          "clock_p90_seconds"
        ],
        "properties": {
          "business_hours_p50_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "business_hours_p90_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "clock_p50_seconds": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "clock_p90_seconds": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "fastest": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/WrappedReplyExtreme",
                "description": "Single fastest reply pair in the window."
              }
            ]
          },
          "sample_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "slowest": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/WrappedReplyExtreme",
                "description": "Single slowest reply pair in the window. Capped at 30 days to\nexclude the pathological \"I replied 8 years later\" cases."
              }
            ]
          }
        }
      },
      "WrappedReplyExtreme": {
        "type": "object",
        "required": [
          "counterparty_email",
          "latency_seconds",
          "replied_at"
        ],
        "properties": {
          "counterparty_email": {
            "type": "string"
          },
          "latency_seconds": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "replied_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WrappedStorage": {
        "type": "object",
        "required": [
          "total_bytes"
        ],
        "properties": {
          "heaviest_message": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LargestMessageRow"
              }
            ]
          },
          "top_mimetype": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/WrappedStorageBucket"
              }
            ]
          },
          "total_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "WrappedStorageBucket": {
        "type": "object",
        "required": [
          "key",
          "bytes",
          "count"
        ],
        "properties": {
          "bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "key": {
            "type": "string"
          }
        }
      },
      "WrappedSummary": {
        "type": "object",
        "description": "Year-in-review summary returned by `mxr wrapped`. Combines volume,\ntime-pattern, contact, reply-discipline, storage, newsletter, and\nsuperlative sections so the CLI can render a single narrative panel.",
        "required": [
          "window_start",
          "window_end",
          "label",
          "volume",
          "time_patterns",
          "top_contacts",
          "storage",
          "newsletters",
          "superlatives"
        ],
        "properties": {
          "label": {
            "type": "string"
          },
          "newsletters": {
            "$ref": "#/components/schemas/WrappedNewsletters"
          },
          "reply_discipline": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/WrappedReplyDiscipline"
              }
            ]
          },
          "storage": {
            "$ref": "#/components/schemas/WrappedStorage"
          },
          "superlatives": {
            "$ref": "#/components/schemas/WrappedSuperlatives"
          },
          "time_patterns": {
            "$ref": "#/components/schemas/WrappedTimePatterns"
          },
          "top_contacts": {
            "$ref": "#/components/schemas/WrappedTopContacts"
          },
          "volume": {
            "$ref": "#/components/schemas/WrappedVolume"
          },
          "window_end": {
            "type": "string",
            "format": "date-time"
          },
          "window_start": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WrappedSuperlatives": {
        "type": "object",
        "properties": {
          "longest_thread": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/WrappedLongestThread"
              }
            ]
          },
          "most_ghosted": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/WrappedMostGhosted"
              }
            ]
          }
        }
      },
      "WrappedTimePatterns": {
        "type": "object",
        "required": [
          "busiest_day_of_week_count",
          "busiest_hour_count",
          "busiest_date_count"
        ],
        "properties": {
          "busiest_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The single calendar day with the most activity, and its count."
          },
          "busiest_date_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "busiest_day_of_week": {
            "type": [
              "string",
              "null"
            ],
            "description": "Day name and message count for the busiest day-of-week (Mon–Sun)."
          },
          "busiest_day_of_week_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "busiest_hour_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "busiest_hour_utc": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Hour 0–23 (UTC) and message count for the busiest hour-of-day.",
            "minimum": 0
          },
          "day_of_week_distribution": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            },
            "description": "Per-day-of-week message counts. Index 0 = Monday … 6 = Sunday.\n`#[serde(default)]` keeps older daemons compatible."
          },
          "hour_distribution": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            },
            "description": "Per-hour message counts (UTC), indexed 0..=23. Powers the\nhour-of-day chart in the TUI Wrapped view.\n`#[serde(default)]` keeps older daemons compatible."
          }
        }
      },
      "WrappedTopContacts": {
        "type": "object",
        "required": [
          "most_emailed_to_me",
          "most_emailed_by_me",
          "most_asymmetric"
        ],
        "properties": {
          "most_asymmetric": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContactAsymmetryRow"
            },
            "description": "Top 3 most-asymmetric counterparties (inbound-heavy)."
          },
          "most_emailed_by_me": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WrappedContactRank"
            },
            "description": "Top 5 recipients I emailed by outbound count."
          },
          "most_emailed_to_me": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WrappedContactRank"
            },
            "description": "Top 5 senders to me by inbound count."
          }
        }
      },
      "WrappedTopList": {
        "type": "object",
        "required": [
          "list_id",
          "message_count",
          "opened_count"
        ],
        "properties": {
          "list_id": {
            "type": "string"
          },
          "message_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "opened_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "WrappedVolume": {
        "type": "object",
        "required": [
          "inbound_count",
          "outbound_count",
          "thread_count"
        ],
        "properties": {
          "inbound_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "outbound_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "thread_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      }
    },
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "opaque",
        "description": "Token from `~/.config/mxr/bridge-token`. Send via `Authorization: Bearer <token>` header. WebSocket clients can also pass it via the `?token=<token>` query string or the `Sec-WebSocket-Protocol: bearer, <token>` subprotocol."
      }
    }
  },
  "security": [
    {
      "bearer": []
    }
  ]
}
